	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function ab8500_fg_algorithm_calibrate
_ab8500_fg_algorithm_calibrate:         ## @ab8500_fg_algorithm_calibrate
	.cfi_startproc
## %bb.0:
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset %rbp, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register %rbp
	pushq	%r15
	pushq	%r14
	pushq	%rbx
	pushq	%rax
	.cfi_offset %rbx, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rdi, %rbx
	movl	(%rdi), %eax
	cmpl	$128, %eax
	je	LBB0_10
## %bb.1:
	cmpl	$130, %eax
	je	LBB0_7
## %bb.2:
	cmpl	$129, %eax
	jne	LBB0_6
## %bb.3:
	movl	16(%rbx), %edi
	leaq	L_.str(%rip), %rsi
	callq	_dev_dbg
	movl	16(%rbx), %edi
	movq	_AB8500_GAS_GAUGE@GOTPCREL(%rip), %r14
	movl	(%r14), %esi
	movq	_AB8500_GASG_CC_CTRL_REG@GOTPCREL(%rip), %r15
	movl	(%r15), %edx
	movq	_CC_INT_CAL_N_AVG_MASK@GOTPCREL(%rip), %rax
	movl	(%rax), %ecx
	movq	_CC_INT_CAL_SAMPLES_8@GOTPCREL(%rip), %rax
	movl	(%rax), %r8d
	callq	_abx500_mask_and_set_register_interruptible
	testl	%eax, %eax
	js	LBB0_11
## %bb.4:
	movl	16(%rbx), %edi
	movl	(%r14), %esi
	movl	(%r15), %edx
	movq	_CC_INTAVGOFFSET_ENA@GOTPCREL(%rip), %rax
	movl	(%rax), %ecx
	movl	%ecx, %r8d
	callq	_abx500_mask_and_set_register_interruptible
	testl	%eax, %eax
	js	LBB0_11
## %bb.5:
	movl	$128, (%rbx)
LBB0_6:
	addq	$8, %rsp
	popq	%rbx
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_10:
	movl	16(%rbx), %edi
	leaq	L_.str.2(%rip), %rsi
	addq	$8, %rsp
	popq	%rbx
	popq	%r14
	popq	%r15
	popq	%rbp
	jmp	_dev_dbg                        ## TAILCALL
LBB0_7:
	movl	16(%rbx), %edi
	movq	_AB8500_GAS_GAUGE@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	_AB8500_GASG_CC_CTRL_REG@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	movq	_CC_MUXOFFSET@GOTPCREL(%rip), %rax
	movl	(%rax), %ecx
	movl	%ecx, %r8d
	callq	_abx500_mask_and_set_register_interruptible
	testl	%eax, %eax
	js	LBB0_11
## %bb.8:
	movl	$0, 12(%rbx)
	movl	16(%rbx), %edi
	leaq	L_.str.1(%rip), %rsi
	callq	_dev_dbg
	jmp	LBB0_9
LBB0_11:
	movl	16(%rbx), %edi
	leaq	L_.str.3(%rip), %rsi
	callq	_dev_err
	movl	$0, 12(%rbx)
	movl	$129, (%rbx)
LBB0_9:
	movl	8(%rbx), %edi
	addq	$4, %rbx
	movq	%rbx, %rsi
	xorl	%edx, %edx
	addq	$8, %rsp
	popq	%rbx
	popq	%r14
	popq	%r15
	popq	%rbp
	jmp	_queue_delayed_work             ## TAILCALL
	.cfi_endproc
                                        ## -- End function
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"Calibration ongoing...\n"

	.comm	_AB8500_GAS_GAUGE,4,2           ## @AB8500_GAS_GAUGE
	.comm	_AB8500_GASG_CC_CTRL_REG,4,2    ## @AB8500_GASG_CC_CTRL_REG
	.comm	_CC_INT_CAL_N_AVG_MASK,4,2      ## @CC_INT_CAL_N_AVG_MASK
	.comm	_CC_INT_CAL_SAMPLES_8,4,2       ## @CC_INT_CAL_SAMPLES_8
	.comm	_CC_INTAVGOFFSET_ENA,4,2        ## @CC_INTAVGOFFSET_ENA
	.comm	_CC_MUXOFFSET,4,2               ## @CC_MUXOFFSET
L_.str.1:                               ## @.str.1
	.asciz	"Calibration done...\n"

L_.str.2:                               ## @.str.2
	.asciz	"Calibration WFI\n"

L_.str.3:                               ## @.str.3
	.asciz	"failed to calibrate the CC\n"

	.no_dead_strip	_ab8500_fg_algorithm_calibrate
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function ab8500_fg_algorithm_calibrate
_ab8500_fg_algorithm_calibrate:         ; @ab8500_fg_algorithm_calibrate
	.cfi_startproc
; %bb.0:
	stp	x22, x21, [sp, #-48]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 48
	stp	x20, x19, [sp, #16]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #32]             ; 16-byte Folded Spill
	add	x29, sp, #32
	.cfi_def_cfa w29, 16
	.cfi_offset w30, -8
	.cfi_offset w29, -16
	.cfi_offset w19, -24
	.cfi_offset w20, -32
	.cfi_offset w21, -40
	.cfi_offset w22, -48
	mov	x19, x0
	ldr	w8, [x0]
	cmp	w8, #128
	b.eq	LBB0_7
; %bb.1:
	cmp	w8, #130
	b.eq	LBB0_8
; %bb.2:
	cmp	w8, #129
	b.ne	LBB0_6
; %bb.3:
	ldr	w0, [x19, #16]
Lloh0:
	adrp	x1, l_.str@PAGE
Lloh1:
	add	x1, x1, l_.str@PAGEOFF
	bl	_dev_dbg
	ldr	w0, [x19, #16]
Lloh2:
	adrp	x20, _AB8500_GAS_GAUGE@GOTPAGE
Lloh3:
	ldr	x20, [x20, _AB8500_GAS_GAUGE@GOTPAGEOFF]
	ldr	w1, [x20]
Lloh4:
	adrp	x21, _AB8500_GASG_CC_CTRL_REG@GOTPAGE
Lloh5:
	ldr	x21, [x21, _AB8500_GASG_CC_CTRL_REG@GOTPAGEOFF]
	ldr	w2, [x21]
Lloh6:
	adrp	x8, _CC_INT_CAL_N_AVG_MASK@GOTPAGE
Lloh7:
	ldr	x8, [x8, _CC_INT_CAL_N_AVG_MASK@GOTPAGEOFF]
Lloh8:
	ldr	w3, [x8]
Lloh9:
	adrp	x8, _CC_INT_CAL_SAMPLES_8@GOTPAGE
Lloh10:
	ldr	x8, [x8, _CC_INT_CAL_SAMPLES_8@GOTPAGEOFF]
Lloh11:
	ldr	w4, [x8]
	bl	_abx500_mask_and_set_register_interruptible
	tbnz	w0, #31, LBB0_10
; %bb.4:
	ldr	w0, [x19, #16]
	ldr	w1, [x20]
	ldr	w2, [x21]
Lloh12:
	adrp	x8, _CC_INTAVGOFFSET_ENA@GOTPAGE
Lloh13:
	ldr	x8, [x8, _CC_INTAVGOFFSET_ENA@GOTPAGEOFF]
Lloh14:
	ldr	w3, [x8]
	mov	x4, x3
	bl	_abx500_mask_and_set_register_interruptible
	tbnz	w0, #31, LBB0_10
; %bb.5:
	mov	w8, #128
	str	w8, [x19]
LBB0_6:
	ldp	x29, x30, [sp, #32]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #16]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp], #48             ; 16-byte Folded Reload
	ret
LBB0_7:
	ldr	w0, [x19, #16]
Lloh15:
	adrp	x1, l_.str.2@PAGE
Lloh16:
	add	x1, x1, l_.str.2@PAGEOFF
	ldp	x29, x30, [sp, #32]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #16]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp], #48             ; 16-byte Folded Reload
	b	_dev_dbg
LBB0_8:
	ldr	w0, [x19, #16]
Lloh17:
	adrp	x8, _AB8500_GAS_GAUGE@GOTPAGE
Lloh18:
	ldr	x8, [x8, _AB8500_GAS_GAUGE@GOTPAGEOFF]
Lloh19:
	ldr	w1, [x8]
Lloh20:
	adrp	x8, _AB8500_GASG_CC_CTRL_REG@GOTPAGE
Lloh21:
	ldr	x8, [x8, _AB8500_GASG_CC_CTRL_REG@GOTPAGEOFF]
Lloh22:
	ldr	w2, [x8]
Lloh23:
	adrp	x8, _CC_MUXOFFSET@GOTPAGE
Lloh24:
	ldr	x8, [x8, _CC_MUXOFFSET@GOTPAGEOFF]
Lloh25:
	ldr	w3, [x8]
	mov	x4, x3
	bl	_abx500_mask_and_set_register_interruptible
	tbnz	w0, #31, LBB0_10
; %bb.9:
	str	wzr, [x19, #12]
	ldr	w0, [x19, #16]
Lloh26:
	adrp	x1, l_.str.1@PAGE
Lloh27:
	add	x1, x1, l_.str.1@PAGEOFF
	bl	_dev_dbg
	b	LBB0_11
LBB0_10:
	ldr	w0, [x19, #16]
Lloh28:
	adrp	x1, l_.str.3@PAGE
Lloh29:
	add	x1, x1, l_.str.3@PAGEOFF
	bl	_dev_err
	str	wzr, [x19, #12]
	mov	w8, #129
	str	w8, [x19]
LBB0_11:
	ldr	w0, [x19, #8]
	add	x1, x19, #4
	mov	w2, #0
	ldp	x29, x30, [sp, #32]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #16]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp], #48             ; 16-byte Folded Reload
	b	_queue_delayed_work
	.loh AdrpLdrGotLdr	Lloh9, Lloh10, Lloh11
	.loh AdrpLdrGotLdr	Lloh6, Lloh7, Lloh8
	.loh AdrpLdrGot	Lloh4, Lloh5
	.loh AdrpLdrGot	Lloh2, Lloh3
	.loh AdrpAdd	Lloh0, Lloh1
	.loh AdrpLdrGotLdr	Lloh12, Lloh13, Lloh14
	.loh AdrpAdd	Lloh15, Lloh16
	.loh AdrpLdrGotLdr	Lloh23, Lloh24, Lloh25
	.loh AdrpLdrGotLdr	Lloh20, Lloh21, Lloh22
	.loh AdrpLdrGotLdr	Lloh17, Lloh18, Lloh19
	.loh AdrpAdd	Lloh26, Lloh27
	.loh AdrpAdd	Lloh28, Lloh29
	.cfi_endproc
                                        ; -- End function
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"Calibration ongoing...\n"

	.comm	_AB8500_GAS_GAUGE,4,2           ; @AB8500_GAS_GAUGE
	.comm	_AB8500_GASG_CC_CTRL_REG,4,2    ; @AB8500_GASG_CC_CTRL_REG
	.comm	_CC_INT_CAL_N_AVG_MASK,4,2      ; @CC_INT_CAL_N_AVG_MASK
	.comm	_CC_INT_CAL_SAMPLES_8,4,2       ; @CC_INT_CAL_SAMPLES_8
	.comm	_CC_INTAVGOFFSET_ENA,4,2        ; @CC_INTAVGOFFSET_ENA
	.comm	_CC_MUXOFFSET,4,2               ; @CC_MUXOFFSET
l_.str.1:                               ; @.str.1
	.asciz	"Calibration done...\n"

l_.str.2:                               ; @.str.2
	.asciz	"Calibration WFI\n"

l_.str.3:                               ; @.str.3
	.asciz	"failed to calibrate the CC\n"

	.no_dead_strip	_ab8500_fg_algorithm_calibrate
.subsections_via_symbols
