	.file	"extr_sc27xx_fuel_gauge.c_sc27xx_fgu_get_boot_capacity.c"
	.intel_syntax noprefix
	.text
	.p2align 4
	.type	sc27xx_fgu_get_boot_capacity, @function
sc27xx_fgu_get_boot_capacity:
.LFB0:
	.cfi_startproc
	endbr64
	push	r12
	.cfi_def_cfa_offset 16
	.cfi_offset 12, -16
	mov	r12, rsi
	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
	sub	rsp, 16
	.cfi_def_cfa_offset 48
	mov	rax, QWORD PTR fs:40
	mov	QWORD PTR 8[rsp], rax
	xor	eax, eax
	call	sc27xx_fgu_is_first_poweron@PLT
	test	eax, eax
	jne	.L2
	mov	rsi, r12
	mov	rdi, rbp
	call	sc27xx_fgu_read_last_cap@PLT
	test	eax, eax
	je	.L6
.L1:
	mov	rcx, QWORD PTR 8[rsp]
	xor	rcx, QWORD PTR fs:40
	jne	.L8
	add	rsp, 16
	.cfi_remember_state
	.cfi_def_cfa_offset 32
	pop	rbx
	.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
.L2:
	.cfi_restore_state
	mov	edi, DWORD PTR 24[rbp]
	mov	rsi, QWORD PTR SC27XX_FGU_CLBCNT_QMAXL[rip]
	lea	rdx, 4[rsp]
	add	rsi, QWORD PTR 16[rbp]
	call	regmap_read@PLT
	test	eax, eax
	jne	.L1
	mov	eax, DWORD PTR 4[rsp]
	mov	rdi, rbp
	lea	esi, [rax+rax]
	mov	DWORD PTR 4[rsp], esi
	movsx	rsi, esi
	sub	rsi, QWORD PTR SC27XX_FGU_CUR_BASIC_ADC[rip]
	call	sc27xx_fgu_adc_to_current@PLT
	mov	edi, DWORD PTR 24[rbp]
	mov	rsi, QWORD PTR SC27XX_FGU_POCV[rip]
	mov	rdx, rsp
	add	rsi, QWORD PTR 16[rbp]
	mov	ebx, eax
	call	regmap_read@PLT
	test	eax, eax
	jne	.L1
	mov	esi, DWORD PTR [rsp]
	mov	rdi, rbp
	call	sc27xx_fgu_adc_to_voltage@PLT
	imul	ebx, DWORD PTR 0[rbp]
	mov	esi, DWORD PTR 4[rbp]
	imul	edx, eax, 1000
	mov	edi, DWORD PTR 8[rbp]
	mov	DWORD PTR [rsp], eax
	sub	edx, ebx
	call	power_supply_ocv2cap_simple@PLT
	mov	rdi, rbp
	mov	DWORD PTR [r12], eax
	mov	esi, eax
	call	sc27xx_fgu_save_last_cap@PLT
	test	eax, eax
	jne	.L1
.L6:
	mov	esi, DWORD PTR SC27XX_FGU_NORMAIL_POWERTON[rip]
	mov	rdi, rbp
	call	sc27xx_fgu_save_boot_mode@PLT
	jmp	.L1
.L8:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE0:
	.size	sc27xx_fgu_get_boot_capacity, .-sc27xx_fgu_get_boot_capacity
	.comm	SC27XX_FGU_POCV,8,8
	.comm	SC27XX_FGU_NORMAIL_POWERTON,4,4
	.comm	SC27XX_FGU_CUR_BASIC_ADC,8,8
	.comm	SC27XX_FGU_CLBCNT_QMAXL,8,8
	.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_sc27xx_fuel_gauge.c_sc27xx_fgu_get_boot_capacity.c"
	.text
	.section	.rodata.cst4,"aM",%progbits,4
	.align	2
.LC0:
	.word	__stack_chk_guard
	.text
	.align	2
	.syntax unified
	.arm
	.fpu softvfp
	.type	sc27xx_fgu_get_boot_capacity, %function
sc27xx_fgu_get_boot_capacity:
	@ args = 0, pretend = 0, frame = 16
	@ frame_needed = 0, uses_anonymous_args = 0
	push	{r4, r5, r6, lr}
	ldr	r3, .L9
	sub	sp, sp, #16
	mov	r5, r1
	ldr	r3, [r3]
	str	r3, [sp, #12]
	mov	r3,#0
	mov	r4, r0
	bl	sc27xx_fgu_is_first_poweron
	cmp	r0, #0
	bne	.L2
	mov	r1, r5
	mov	r0, r4
	bl	sc27xx_fgu_read_last_cap
	cmp	r0, #0
	beq	.L6
.L1:
	ldr	r3, .L9
	ldr	r2, [r3]
	ldr	r3, [sp, #12]
	eors	r2, r3, r2
	mov	r3, #0
	bne	.L8
	add	sp, sp, #16
	@ sp needed
	pop	{r4, r5, r6, pc}
.L2:
	ldr	r3, .L9+4
	ldr	r1, [r4, #12]
	ldr	r3, [r3]
	ldr	r0, [r4, #16]
	add	r2, sp, #8
	add	r1, r1, r3
	bl	regmap_read
	cmp	r0, #0
	bne	.L1
	ldr	r2, .L9+8
	ldr	r3, [sp, #8]
	ldr	r1, [r2]
	lsl	r3, r3, #1
	sub	r1, r3, r1
	mov	r0, r4
	str	r3, [sp, #8]
	bl	sc27xx_fgu_adc_to_current
	ldr	r2, .L9+12
	mov	r6, r0
	ldr	r1, [r2]
	ldr	r0, [r4, #12]
	add	r2, sp, #4
	add	r1, r0, r1
	ldr	r0, [r4, #16]
	bl	regmap_read
	cmp	r0, #0
	bne	.L1
	ldr	r1, [sp, #4]
	mov	r0, r4
	bl	sc27xx_fgu_adc_to_voltage
	mov	r3, r0
	ldr	r1, [r4]
	rsb	r2, r0, r0, lsl #5
	mul	r1, r6, r1
	add	r2, r0, r2, lsl #2
	rsb	r2, r1, r2, lsl #3
	ldr	r0, [r4, #8]
	ldr	r1, [r4, #4]
	str	r3, [sp, #4]
	bl	power_supply_ocv2cap_simple
	mov	r1, r0
	mov	r0, r4
	str	r1, [r5]
	bl	sc27xx_fgu_save_last_cap
	cmp	r0, #0
	bne	.L1
.L6:
	ldr	r3, .L9+16
	mov	r0, r4
	ldr	r1, [r3]
	bl	sc27xx_fgu_save_boot_mode
	b	.L1
.L8:
	bl	__stack_chk_fail
.L10:
	.align	2
.L9:
	.word	.LC0
	.word	SC27XX_FGU_CLBCNT_QMAXL
	.word	SC27XX_FGU_CUR_BASIC_ADC
	.word	SC27XX_FGU_POCV
	.word	SC27XX_FGU_NORMAIL_POWERTON
	.size	sc27xx_fgu_get_boot_capacity, .-sc27xx_fgu_get_boot_capacity
	.comm	SC27XX_FGU_POCV,4,4
	.comm	SC27XX_FGU_NORMAIL_POWERTON,4,4
	.comm	SC27XX_FGU_CUR_BASIC_ADC,4,4
	.comm	SC27XX_FGU_CLBCNT_QMAXL,4,4
	.ident	"GCC: (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0"
	.section	.note.GNU-stack,"",%progbits
