	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function sc2731_charger_hw_init
_sc2731_charger_hw_init:                ## @sc2731_charger_hw_init
	.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	%r13
	pushq	%r12
	pushq	%rbx
	pushq	%rax
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rdi, %r15
	movq	$0, -48(%rbp)
	movl	(%rdi), %edi
	movq	_SC2731_MODULE_EN1@GOTPCREL(%rip), %rax
	movq	(%rax), %rsi
	movq	_SC2731_CHARGE_EN@GOTPCREL(%rip), %r13
	movl	(%r13), %ecx
	movl	%ecx, %edx
	callq	_regmap_update_bits
	movl	%eax, %ebx
	testl	%eax, %eax
	jne	LBB0_13
## %bb.1:
	movl	16(%r15), %edi
	leaq	-48(%rbp), %rsi
	callq	_power_supply_get_battery_info
	testl	%eax, %eax
	je	LBB0_3
## %bb.2:
	movl	20(%r15), %edi
	leaq	L_.str(%rip), %rsi
	callq	_dev_warn
	movl	$1, %r12d
	movl	$2, %r14d
	jmp	LBB0_9
LBB0_3:
	movslq	-48(%rbp), %rax
	xorl	%r12d, %r12d
	movl	$0, %r14d
	cmpq	$91000, %rax                    ## imm = 0x16378
	jl	LBB0_6
## %bb.4:
	movl	$7, %r14d
	cmpl	$264999, %eax                   ## imm = 0x40B27
	ja	LBB0_6
## %bb.5:
	imulq	$274877907, %rax, %rax          ## imm = 0x10624DD3
	movq	%rax, %rcx
	shrq	$63, %rcx
	sarq	$38, %rax
	addl	%ecx, %eax
	addl	$-90, %eax
	cltq
	imulq	$1374389535, %rax, %rax         ## imm = 0x51EB851F
	movq	%rax, %rcx
	sarq	$35, %rcx
	shrq	$63, %rax
	leal	(%rcx,%rax), %r14d
	incl	%r14d
LBB0_6:
	movslq	-44(%rbp), %rax
	imulq	$274877907, %rax, %rcx          ## imm = 0x10624DD3
	movq	%rcx, %rax
	shrq	$63, %rax
	sarq	$38, %rcx
	addl	%eax, %ecx
	cmpl	$4500, %ecx                     ## imm = 0x1194
	movl	$4500, %eax                     ## imm = 0x1194
	cmovll	%ecx, %eax
	cmpl	$4201, %eax                     ## imm = 0x1069
	jl	LBB0_8
## %bb.7:
	addl	$-4200, %eax                    ## imm = 0xEF98
	movzwl	%ax, %eax
	shrl	$2, %eax
	imull	$5243, %eax, %r12d              ## imm = 0x147B
	shrl	$17, %r12d
LBB0_8:
	movl	16(%r15), %edi
	leaq	-48(%rbp), %rsi
	callq	_power_supply_put_battery_info
LBB0_9:
	movl	(%r15), %edi
	movq	_SC2731_CHG_CFG2@GOTPCREL(%rip), %rax
	movq	(%rax), %rsi
	addq	8(%r15), %rsi
	movq	_SC2731_TERMINATION_CUR_MASK@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	movl	%r14d, %ecx
	callq	_regmap_update_bits
	movl	%eax, %ebx
	testl	%eax, %eax
	jne	LBB0_12
## %bb.10:
	movq	_SC2731_CHG_CFG0@GOTPCREL(%rip), %rax
	movq	(%rax), %rsi
	addq	8(%r15), %rsi
	movq	_SC2731_TERMINATION_VOL_MASK@GOTPCREL(%rip), %rax
	movq	_SC2731_TERMINATION_VOL_CAL_MASK@GOTPCREL(%rip), %rcx
	movl	(%rcx), %edx
	orl	(%rax), %edx
	movq	_SC2731_TERMINATION_VOL_SHIFT@GOTPCREL(%rip), %rax
	movb	(%rax), %cl
	shll	%cl, %r12d
	movl	(%r15), %edi
	movq	_SC2731_TERMINATION_VOL_CAL_SHIFT@GOTPCREL(%rip), %rax
	movb	(%rax), %cl
	movl	$6, %eax
	shll	%cl, %eax
	orl	%r12d, %eax
	movl	%eax, %ecx
	callq	_regmap_update_bits
	movl	%eax, %ebx
	testl	%eax, %eax
	je	LBB0_11
LBB0_12:
	movl	(%r15), %edi
	movq	_SC2731_MODULE_EN1@GOTPCREL(%rip), %rax
	movq	(%rax), %rsi
	movl	(%r13), %edx
	xorl	%ecx, %ecx
	callq	_regmap_update_bits
LBB0_13:
	movl	%ebx, %eax
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_11:
	xorl	%ebx, %ebx
	jmp	LBB0_13
	.cfi_endproc
                                        ## -- End function
	.comm	_SC2731_MODULE_EN1,8,3          ## @SC2731_MODULE_EN1
	.comm	_SC2731_CHARGE_EN,4,2           ## @SC2731_CHARGE_EN
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"no battery information is supplied\n"

	.comm	_SC2731_CHG_CFG2,8,3            ## @SC2731_CHG_CFG2
	.comm	_SC2731_TERMINATION_CUR_MASK,4,2 ## @SC2731_TERMINATION_CUR_MASK
	.comm	_SC2731_CHG_CFG0,8,3            ## @SC2731_CHG_CFG0
	.comm	_SC2731_TERMINATION_VOL_MASK,4,2 ## @SC2731_TERMINATION_VOL_MASK
	.comm	_SC2731_TERMINATION_VOL_CAL_MASK,4,2 ## @SC2731_TERMINATION_VOL_CAL_MASK
	.comm	_SC2731_TERMINATION_VOL_SHIFT,4,2 ## @SC2731_TERMINATION_VOL_SHIFT
	.comm	_SC2731_TERMINATION_VOL_CAL_SHIFT,4,2 ## @SC2731_TERMINATION_VOL_CAL_SHIFT
	.no_dead_strip	_sc2731_charger_hw_init
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function sc2731_charger_hw_init
_sc2731_charger_hw_init:                ; @sc2731_charger_hw_init
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #80
	.cfi_def_cfa_offset 80
	stp	x24, x23, [sp, #16]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #32]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #48]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #64]             ; 16-byte Folded Spill
	add	x29, sp, #64
	.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
	.cfi_offset w23, -56
	.cfi_offset w24, -64
	mov	x19, x0
	str	xzr, [sp, #8]
	ldr	w0, [x0]
Lloh0:
	adrp	x21, _SC2731_MODULE_EN1@GOTPAGE
Lloh1:
	ldr	x21, [x21, _SC2731_MODULE_EN1@GOTPAGEOFF]
	ldr	x1, [x21]
Lloh2:
	adrp	x22, _SC2731_CHARGE_EN@GOTPAGE
Lloh3:
	ldr	x22, [x22, _SC2731_CHARGE_EN@GOTPAGEOFF]
	ldr	w2, [x22]
	mov	x3, x2
	bl	_regmap_update_bits
	mov	x20, x0
	cbnz	w0, LBB0_15
; %bb.1:
	ldr	w0, [x19, #16]
	add	x1, sp, #8
	bl	_power_supply_get_battery_info
	cbz	w0, LBB0_3
; %bb.2:
	ldr	w0, [x19, #20]
Lloh4:
	adrp	x1, l_.str@PAGE
Lloh5:
	add	x1, x1, l_.str@PAGEOFF
	bl	_dev_warn
	mov	w23, #1
	mov	w20, #2
	b	LBB0_12
LBB0_3:
	ldrsw	x8, [sp, #8]
	mov	w9, #25464
	movk	w9, #1, lsl #16
	cmp	w8, w9
	b.ge	LBB0_5
; %bb.4:
	mov	w20, #0
	b	LBB0_8
LBB0_5:
	mov	w9, #2855
	movk	w9, #4, lsl #16
	cmp	w8, w9
	b.ls	LBB0_7
; %bb.6:
	mov	w20, #7
	b	LBB0_8
LBB0_7:
	mov	w9, #19923
	movk	w9, #4194, lsl #16
	mul	x8, x8, x9
	lsr	x9, x8, #63
	asr	x8, x8, #38
	add	w8, w8, w9
	sub	w8, w8, #90
	mov	w9, #34079
	movk	w9, #20971, lsl #16
	smull	x8, w8, w9
	lsr	x9, x8, #63
	asr	x8, x8, #35
	add	w8, w8, w9
	add	w20, w8, #1
LBB0_8:
	ldrsw	x8, [sp, #12]
	mov	w9, #19923
	movk	w9, #4194, lsl #16
	mul	x8, x8, x9
	lsr	x9, x8, #63
	asr	x8, x8, #38
	mov	w10, #4500
	add	w8, w8, w9
	cmp	w8, w10
	csel	w8, w8, w10, lt
	mov	w9, #4201
	cmp	w8, w9
	b.lt	LBB0_10
; %bb.9:
	mov	w9, #-4200
	add	w8, w8, w9
	ubfx	w8, w8, #2, #14
	mov	w9, #5243
	mul	w8, w8, w9
	lsr	w23, w8, #17
	b	LBB0_11
LBB0_10:
	mov	w23, #0
LBB0_11:
	ldr	w0, [x19, #16]
	add	x1, sp, #8
	bl	_power_supply_put_battery_info
LBB0_12:
	ldr	w0, [x19]
Lloh6:
	adrp	x8, _SC2731_CHG_CFG2@GOTPAGE
Lloh7:
	ldr	x8, [x8, _SC2731_CHG_CFG2@GOTPAGEOFF]
	ldr	x9, [x19, #8]
Lloh8:
	ldr	x8, [x8]
	add	x1, x8, x9
Lloh9:
	adrp	x8, _SC2731_TERMINATION_CUR_MASK@GOTPAGE
Lloh10:
	ldr	x8, [x8, _SC2731_TERMINATION_CUR_MASK@GOTPAGEOFF]
Lloh11:
	ldr	w2, [x8]
	mov	x3, x20
	bl	_regmap_update_bits
	mov	x20, x0
	cbnz	w0, LBB0_14
; %bb.13:
	ldr	w0, [x19]
	ldr	x8, [x19, #8]
Lloh12:
	adrp	x9, _SC2731_CHG_CFG0@GOTPAGE
Lloh13:
	ldr	x9, [x9, _SC2731_CHG_CFG0@GOTPAGEOFF]
Lloh14:
	ldr	x9, [x9]
	add	x1, x9, x8
Lloh15:
	adrp	x8, _SC2731_TERMINATION_VOL_MASK@GOTPAGE
Lloh16:
	ldr	x8, [x8, _SC2731_TERMINATION_VOL_MASK@GOTPAGEOFF]
Lloh17:
	ldr	w8, [x8]
Lloh18:
	adrp	x9, _SC2731_TERMINATION_VOL_CAL_MASK@GOTPAGE
Lloh19:
	ldr	x9, [x9, _SC2731_TERMINATION_VOL_CAL_MASK@GOTPAGEOFF]
Lloh20:
	ldr	w9, [x9]
	orr	w2, w9, w8
Lloh21:
	adrp	x8, _SC2731_TERMINATION_VOL_SHIFT@GOTPAGE
Lloh22:
	ldr	x8, [x8, _SC2731_TERMINATION_VOL_SHIFT@GOTPAGEOFF]
Lloh23:
	ldr	w8, [x8]
	lsl	w8, w23, w8
Lloh24:
	adrp	x9, _SC2731_TERMINATION_VOL_CAL_SHIFT@GOTPAGE
Lloh25:
	ldr	x9, [x9, _SC2731_TERMINATION_VOL_CAL_SHIFT@GOTPAGEOFF]
Lloh26:
	ldr	w9, [x9]
	mov	w10, #6
	lsl	w9, w10, w9
	orr	w3, w9, w8
	bl	_regmap_update_bits
	mov	x20, x0
	cbz	w0, LBB0_15
LBB0_14:
	ldr	w0, [x19]
	ldr	x1, [x21]
	ldr	w2, [x22]
	mov	w3, #0
	bl	_regmap_update_bits
LBB0_15:
	mov	x0, x20
	ldp	x29, x30, [sp, #64]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #48]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #32]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #16]             ; 16-byte Folded Reload
	add	sp, sp, #80
	ret
	.loh AdrpLdrGot	Lloh2, Lloh3
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpAdd	Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh9, Lloh10, Lloh11
	.loh AdrpLdrGotLdr	Lloh6, Lloh7, Lloh8
	.loh AdrpLdrGotLdr	Lloh24, Lloh25, Lloh26
	.loh AdrpLdrGotLdr	Lloh21, Lloh22, Lloh23
	.loh AdrpLdrGotLdr	Lloh18, Lloh19, Lloh20
	.loh AdrpLdrGotLdr	Lloh15, Lloh16, Lloh17
	.loh AdrpLdrGotLdr	Lloh12, Lloh13, Lloh14
	.cfi_endproc
                                        ; -- End function
	.comm	_SC2731_MODULE_EN1,8,3          ; @SC2731_MODULE_EN1
	.comm	_SC2731_CHARGE_EN,4,2           ; @SC2731_CHARGE_EN
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"no battery information is supplied\n"

	.comm	_SC2731_CHG_CFG2,8,3            ; @SC2731_CHG_CFG2
	.comm	_SC2731_TERMINATION_CUR_MASK,4,2 ; @SC2731_TERMINATION_CUR_MASK
	.comm	_SC2731_CHG_CFG0,8,3            ; @SC2731_CHG_CFG0
	.comm	_SC2731_TERMINATION_VOL_MASK,4,2 ; @SC2731_TERMINATION_VOL_MASK
	.comm	_SC2731_TERMINATION_VOL_CAL_MASK,4,2 ; @SC2731_TERMINATION_VOL_CAL_MASK
	.comm	_SC2731_TERMINATION_VOL_SHIFT,4,2 ; @SC2731_TERMINATION_VOL_SHIFT
	.comm	_SC2731_TERMINATION_VOL_CAL_SHIFT,4,2 ; @SC2731_TERMINATION_VOL_CAL_SHIFT
	.no_dead_strip	_sc2731_charger_hw_init
.subsections_via_symbols
