	.file	"extr_cm32181.c_cm32181_reg_init.c"
	.intel_syntax noprefix
	.text
	.p2align 4
	.type	cm32181_reg_init, @function
cm32181_reg_init:
.LFB0:
	.cfi_startproc
	endbr64
	push	r12
	.cfi_def_cfa_offset 16
	.cfi_offset 12, -16
	mov	esi, DWORD PTR CM32181_REG_ADDR_ID[rip]
	push	rbp
	.cfi_def_cfa_offset 24
	.cfi_offset 6, -24
	mov	rbp, rdi
	push	rbx
	.cfi_def_cfa_offset 32
	.cfi_offset 3, -32
	mov	r12, QWORD PTR 16[rdi]
	mov	rdi, r12
	call	i2c_smbus_read_word_data@PLT
	test	eax, eax
	js	.L1
	cmp	al, -127
	jne	.L10
	mov	rax, QWORD PTR 0[rbp]
	mov	rcx, QWORD PTR CM32181_REG_ADDR_CMD[rip]
	xor	ebx, ebx
	mov	edx, DWORD PTR CM32181_CMD_ALS_ENABLE[rip]
	or	edx, DWORD PTR CM32181_CMD_ALS_IT_DEFAULT[rip]
	or	edx, DWORD PTR CM32181_CMD_ALS_SM_DEFAULT[rip]
	mov	DWORD PTR [rax+rcx*4], edx
	mov	edx, DWORD PTR CM32181_CALIBSCALE_DEFAULT[rip]
	mov	DWORD PTR 8[rbp], edx
	mov	edx, DWORD PTR CM32181_CONF_REG_NUM[rip]
	test	edx, edx
	jg	.L4
	jmp	.L5
	.p2align 4,,10
	.p2align 3
.L11:
	add	rbx, 1
	cmp	DWORD PTR CM32181_CONF_REG_NUM[rip], ebx
	jle	.L5
	mov	rax, QWORD PTR 0[rbp]
.L4:
	mov	edx, DWORD PTR [rax+rbx*4]
	mov	rax, QWORD PTR cm32181_reg[rip]
	mov	rdi, r12
	mov	esi, DWORD PTR [rax+rbx*4]
	call	i2c_smbus_write_word_data@PLT
	test	eax, eax
	jns	.L11
.L1:
	pop	rbx
	.cfi_remember_state
	.cfi_def_cfa_offset 24
	pop	rbp
	.cfi_def_cfa_offset 16
	pop	r12
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L10:
	.cfi_restore_state
	mov	eax, DWORD PTR ENODEV[rip]
	pop	rbx
	.cfi_remember_state
	.cfi_def_cfa_offset 24
	pop	rbp
	.cfi_def_cfa_offset 16
	pop	r12
	.cfi_def_cfa_offset 8
	neg	eax
	ret
	.p2align 4,,10
	.p2align 3
.L5:
	.cfi_restore_state
	pop	rbx
	.cfi_def_cfa_offset 24
	xor	eax, eax
	pop	rbp
	.cfi_def_cfa_offset 16
	pop	r12
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE0:
	.size	cm32181_reg_init, .-cm32181_reg_init
	.comm	cm32181_reg,8,8
	.comm	ENODEV,4,4
	.comm	CM32181_REG_ADDR_ID,4,4
	.comm	CM32181_REG_ADDR_CMD,8,8
	.comm	CM32181_CONF_REG_NUM,4,4
	.comm	CM32181_CMD_ALS_SM_DEFAULT,4,4
	.comm	CM32181_CMD_ALS_IT_DEFAULT,4,4
	.comm	CM32181_CMD_ALS_ENABLE,4,4
	.comm	CM32181_CALIBSCALE_DEFAULT,4,4
	.ident	"GCC: (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0"
	.section	.note.GNU-stack,"",@progbits
	.section	.note.gnu.property,"a"
	.align 8
	.long	 1f - 0f
	.long	 4f - 1f
	.long	 5
0:
	.string	 "GNU"
1:
	.align 8
	.long	 0xc0000002
	.long	 3f - 2f
2:
	.long	 0x3
3:
	.align 8
4:

	.arch armv5t
	.eabi_attribute 20, 1
	.eabi_attribute 21, 1
	.eabi_attribute 23, 3
	.eabi_attribute 24, 1
	.eabi_attribute 25, 1
	.eabi_attribute 26, 2
	.eabi_attribute 30, 2
	.eabi_attribute 34, 0
	.eabi_attribute 18, 4
	.file	"extr_cm32181.c_cm32181_reg_init.c"
	.text
	.align	2
	.syntax unified
	.arm
	.fpu softvfp
	.type	cm32181_reg_init, %function
cm32181_reg_init:
	@ args = 0, pretend = 0, frame = 0
	@ frame_needed = 0, uses_anonymous_args = 0
	push	{r4, r5, r6, r7, r8, lr}
	ldr	r3, .L11
	ldr	r6, [r0, #8]
	mov	r5, r0
	ldr	r1, [r3]
	mov	r0, r6
	bl	i2c_smbus_read_word_data
	cmp	r0, #0
	poplt	{r4, r5, r6, r7, r8, pc}
	and	r0, r0, #255
	cmp	r0, #129
	bne	.L9
	ldr	r3, .L11+4
	ldr	r2, .L11+8
	ldr	r0, .L11+12
	ldr	r1, [r3]
	ldr	r2, [r2]
	ldr	r3, .L11+16
	ldr	r0, [r0]
	orr	r2, r2, r1
	ldr	r1, [r3]
	ldr	r3, [r5]
	orr	r2, r2, r0
	ldr	r7, .L11+20
	str	r2, [r3, r1, lsl #2]
	ldr	r2, .L11+24
	ldr	r1, [r7]
	ldr	r2, [r2]
	cmp	r1, #0
	movgt	r4, #0
	ldrgt	r8, .L11+28
	str	r2, [r5, #4]
	bgt	.L4
	b	.L5
.L10:
	ldr	r3, [r5]
.L4:
	ldr	r1, [r8]
	ldr	r2, [r3, r4, lsl #2]
	ldr	r1, [r1, r4, lsl #2]
	mov	r0, r6
	bl	i2c_smbus_write_word_data
	cmp	r0, #0
	add	r4, r4, #1
	poplt	{r4, r5, r6, r7, r8, pc}
	ldr	r3, [r7]
	cmp	r3, r4
	bgt	.L10
.L5:
	mov	r0, #0
	pop	{r4, r5, r6, r7, r8, pc}
.L9:
	ldr	r3, .L11+32
	ldr	r0, [r3]
	rsb	r0, r0, #0
	pop	{r4, r5, r6, r7, r8, pc}
.L12:
	.align	2
.L11:
	.word	CM32181_REG_ADDR_ID
	.word	CM32181_CMD_ALS_IT_DEFAULT
	.word	CM32181_CMD_ALS_ENABLE
	.word	CM32181_CMD_ALS_SM_DEFAULT
	.word	CM32181_REG_ADDR_CMD
	.word	CM32181_CONF_REG_NUM
	.word	CM32181_CALIBSCALE_DEFAULT
	.word	cm32181_reg
	.word	ENODEV
	.size	cm32181_reg_init, .-cm32181_reg_init
	.comm	cm32181_reg,4,4
	.comm	ENODEV,4,4
	.comm	CM32181_REG_ADDR_ID,4,4
	.comm	CM32181_REG_ADDR_CMD,4,4
	.comm	CM32181_CONF_REG_NUM,4,4
	.comm	CM32181_CMD_ALS_SM_DEFAULT,4,4
	.comm	CM32181_CMD_ALS_IT_DEFAULT,4,4
	.comm	CM32181_CMD_ALS_ENABLE,4,4
	.comm	CM32181_CALIBSCALE_DEFAULT,4,4
	.ident	"GCC: (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0"
	.section	.note.GNU-stack,"",%progbits
