	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function max14577_charger_reg_init
_max14577_charger_reg_init:             ## @max14577_charger_reg_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	%rbx
	pushq	%rax
	.cfi_offset %rbx, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rdi, %r15
	movq	16(%rdi), %rax
	movq	(%rax), %r14
	movq	_CDETCTRL1_CHGDETEN_SHIFT@GOTPCREL(%rip), %rax
	movb	(%rax), %cl
	movl	$1, %eax
	shll	%cl, %eax
	movl	$1, %ebx
	movq	_MAX14577_REG_CDETCTRL1@GOTPCREL(%rip), %rcx
	movl	(%rcx), %esi
	movq	_CDETCTRL1_CHGDETEN_MASK@GOTPCREL(%rip), %rcx
	movq	_CDETCTRL1_CHGTYPMAN_MASK@GOTPCREL(%rip), %rdx
	movl	(%rdx), %edx
	orl	(%rcx), %edx
	movq	%r14, %rdi
	movl	%eax, %ecx
	callq	_max14577_update_reg
	movq	_CHGCTRL2_VCHGR_RC_SHIFT@GOTPCREL(%rip), %rax
	movq	_CHGCTRL2_MBCHOSTEN_SHIFT@GOTPCREL(%rip), %rcx
	movb	(%rcx), %cl
	shll	%cl, %ebx
	movb	(%rax), %al
	btsl	%eax, %ebx
	movq	_MAX14577_REG_CHGCTRL2@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%r14, %rdi
	movl	%ebx, %edx
	callq	_max14577_write_reg
	movq	_MAX14577_REG_CHGCTRL6@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%r14, %rdi
	xorl	%edx, %edx
	callq	_max14577_write_reg
	movq	(%r15), %rax
	movl	12(%rax), %esi
	movq	%r15, %rdi
	callq	_max14577_init_constant_voltage
	testl	%eax, %eax
	jne	LBB0_13
## %bb.1:
	movq	(%r15), %rax
	movl	8(%rax), %esi
	movq	%r15, %rdi
	callq	_max14577_init_eoc
	testl	%eax, %eax
	jne	LBB0_13
## %bb.2:
	movq	(%r15), %rax
	movl	4(%rax), %esi
	movq	%r15, %rdi
	callq	_max14577_init_fast_charge
	testl	%eax, %eax
	jne	LBB0_13
## %bb.3:
	movq	_MAXIM_CHARGER_FAST_CHARGE_TIMER_DEFAULT@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%r15, %rdi
	callq	_max14577_set_fast_charge_timer
	testl	%eax, %eax
	jne	LBB0_13
## %bb.4:
	movq	(%r15), %rax
	movl	(%rax), %edx
	cmpl	$6999999, %edx                  ## imm = 0x6ACFBF
	jg	LBB0_8
## %bb.5:
	cmpl	$6000000, %edx                  ## imm = 0x5B8D80
	je	LBB0_11
## %bb.6:
	cmpl	$6500000, %edx                  ## imm = 0x632EA0
	je	LBB0_11
LBB0_7:
	movl	8(%r15), %edi
	leaq	L_.str(%rip), %rsi
                                        ## kill: def $edx killed $edx killed $rdx
	callq	_dev_err
	movq	_EINVAL@GOTPCREL(%rip), %rcx
	xorl	%eax, %eax
	subl	(%rcx), %eax
	jmp	LBB0_13
LBB0_8:
	cmpl	$7500000, %edx                  ## imm = 0x7270E0
	je	LBB0_9
## %bb.10:
	cmpl	$7000000, %edx                  ## imm = 0x6ACFC0
	jne	LBB0_7
LBB0_11:
	addl	$-6000000, %edx                 ## imm = 0xFFA47280
	imulq	$1125899907, %rdx, %rdx         ## imm = 0x431BDE83
	shrq	$49, %rdx
	incl	%edx
	jmp	LBB0_12
LBB0_9:
	xorl	%edx, %edx
LBB0_12:
	movq	_CHGCTRL7_OTPCGHCVS_SHIFT@GOTPCREL(%rip), %rax
	movb	(%rax), %cl
	shll	%cl, %edx
	movq	_MAX14577_REG_CHGCTRL7@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%r14, %rdi
                                        ## kill: def $edx killed $edx killed $rdx
	callq	_max14577_write_reg
	xorl	%eax, %eax
LBB0_13:
	addq	$8, %rsp
	popq	%rbx
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_CDETCTRL1_CHGDETEN_SHIFT,4,2   ## @CDETCTRL1_CHGDETEN_SHIFT
	.comm	_MAX14577_REG_CDETCTRL1,4,2     ## @MAX14577_REG_CDETCTRL1
	.comm	_CDETCTRL1_CHGDETEN_MASK,4,2    ## @CDETCTRL1_CHGDETEN_MASK
	.comm	_CDETCTRL1_CHGTYPMAN_MASK,4,2   ## @CDETCTRL1_CHGTYPMAN_MASK
	.comm	_CHGCTRL2_VCHGR_RC_SHIFT,4,2    ## @CHGCTRL2_VCHGR_RC_SHIFT
	.comm	_CHGCTRL2_MBCHOSTEN_SHIFT,4,2   ## @CHGCTRL2_MBCHOSTEN_SHIFT
	.comm	_MAX14577_REG_CHGCTRL2,4,2      ## @MAX14577_REG_CHGCTRL2
	.comm	_CHGCTRL6_AUTOSTOP_SHIFT,4,2    ## @CHGCTRL6_AUTOSTOP_SHIFT
	.comm	_MAX14577_REG_CHGCTRL6,4,2      ## @MAX14577_REG_CHGCTRL6
	.comm	_MAXIM_CHARGER_FAST_CHARGE_TIMER_DEFAULT,4,2 ## @MAXIM_CHARGER_FAST_CHARGE_TIMER_DEFAULT
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"Wrong value for OVP: %u\n"

	.comm	_EINVAL,4,2                     ## @EINVAL
	.comm	_CHGCTRL7_OTPCGHCVS_SHIFT,4,2   ## @CHGCTRL7_OTPCGHCVS_SHIFT
	.comm	_MAX14577_REG_CHGCTRL7,4,2      ## @MAX14577_REG_CHGCTRL7
	.no_dead_strip	_max14577_charger_reg_init
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function max14577_charger_reg_init
_max14577_charger_reg_init:             ; @max14577_charger_reg_init
	.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	x20, x0
	ldr	x8, [x0, #16]
	ldr	x19, [x8]
Lloh0:
	adrp	x8, _CDETCTRL1_CHGDETEN_SHIFT@GOTPAGE
Lloh1:
	ldr	x8, [x8, _CDETCTRL1_CHGDETEN_SHIFT@GOTPAGEOFF]
Lloh2:
	ldr	w8, [x8]
	mov	w21, #1
	lsl	w3, w21, w8
Lloh3:
	adrp	x8, _MAX14577_REG_CDETCTRL1@GOTPAGE
Lloh4:
	ldr	x8, [x8, _MAX14577_REG_CDETCTRL1@GOTPAGEOFF]
Lloh5:
	adrp	x9, _CDETCTRL1_CHGDETEN_MASK@GOTPAGE
Lloh6:
	ldr	x9, [x9, _CDETCTRL1_CHGDETEN_MASK@GOTPAGEOFF]
Lloh7:
	ldr	w1, [x8]
Lloh8:
	ldr	w8, [x9]
Lloh9:
	adrp	x9, _CDETCTRL1_CHGTYPMAN_MASK@GOTPAGE
Lloh10:
	ldr	x9, [x9, _CDETCTRL1_CHGTYPMAN_MASK@GOTPAGEOFF]
Lloh11:
	ldr	w9, [x9]
	orr	w2, w9, w8
	mov	x0, x19
	bl	_max14577_update_reg
Lloh12:
	adrp	x8, _CHGCTRL2_VCHGR_RC_SHIFT@GOTPAGE
Lloh13:
	ldr	x8, [x8, _CHGCTRL2_VCHGR_RC_SHIFT@GOTPAGEOFF]
Lloh14:
	ldr	w8, [x8]
	lsl	w8, w21, w8
Lloh15:
	adrp	x9, _CHGCTRL2_MBCHOSTEN_SHIFT@GOTPAGE
Lloh16:
	ldr	x9, [x9, _CHGCTRL2_MBCHOSTEN_SHIFT@GOTPAGEOFF]
Lloh17:
	ldr	w9, [x9]
	lsl	w9, w21, w9
	orr	w2, w9, w8
Lloh18:
	adrp	x8, _MAX14577_REG_CHGCTRL2@GOTPAGE
Lloh19:
	ldr	x8, [x8, _MAX14577_REG_CHGCTRL2@GOTPAGEOFF]
Lloh20:
	ldr	w1, [x8]
	mov	x0, x19
	bl	_max14577_write_reg
Lloh21:
	adrp	x8, _MAX14577_REG_CHGCTRL6@GOTPAGE
Lloh22:
	ldr	x8, [x8, _MAX14577_REG_CHGCTRL6@GOTPAGEOFF]
Lloh23:
	ldr	w1, [x8]
	mov	x0, x19
	mov	w2, #0
	bl	_max14577_write_reg
	ldr	x8, [x20]
	ldr	w1, [x8, #12]
	mov	x0, x20
	bl	_max14577_init_constant_voltage
	cbnz	w0, LBB0_14
; %bb.1:
	ldr	x8, [x20]
	ldr	w1, [x8, #8]
	mov	x0, x20
	bl	_max14577_init_eoc
	cbnz	w0, LBB0_14
; %bb.2:
	ldr	x8, [x20]
	ldr	w1, [x8, #4]
	mov	x0, x20
	bl	_max14577_init_fast_charge
	cbnz	w0, LBB0_14
; %bb.3:
Lloh24:
	adrp	x8, _MAXIM_CHARGER_FAST_CHARGE_TIMER_DEFAULT@GOTPAGE
Lloh25:
	ldr	x8, [x8, _MAXIM_CHARGER_FAST_CHARGE_TIMER_DEFAULT@GOTPAGEOFF]
Lloh26:
	ldr	w1, [x8]
	mov	x0, x20
	bl	_max14577_set_fast_charge_timer
	cbnz	w0, LBB0_14
; %bb.4:
	ldr	x8, [x20]
	ldr	w2, [x8]
	mov	w8, #53183
	movk	w8, #106, lsl #16
	cmp	w2, w8
	b.gt	LBB0_7
; %bb.5:
	mov	w8, #36224
	movk	w8, #91, lsl #16
	cmp	w2, w8
	b.eq	LBB0_10
; %bb.6:
	mov	w8, #11936
	movk	w8, #99, lsl #16
	b	LBB0_9
LBB0_7:
	mov	w8, #28896
	movk	w8, #114, lsl #16
	cmp	w2, w8
	b.eq	LBB0_11
; %bb.8:
	mov	w8, #53184
	movk	w8, #106, lsl #16
LBB0_9:
	cmp	w2, w8
	b.ne	LBB0_13
LBB0_10:
	sub	w8, w2, #1464, lsl #12          ; =5996544
	sub	w8, w8, #3456
	mov	w9, #56963
	movk	w9, #17179, lsl #16
	umull	x8, w8, w9
	lsr	x8, x8, #49
	add	w8, w8, #1
	b	LBB0_12
LBB0_11:
	mov	w8, #0
LBB0_12:
Lloh27:
	adrp	x9, _CHGCTRL7_OTPCGHCVS_SHIFT@GOTPAGE
Lloh28:
	ldr	x9, [x9, _CHGCTRL7_OTPCGHCVS_SHIFT@GOTPAGEOFF]
Lloh29:
	ldr	w9, [x9]
	lsl	w2, w8, w9
Lloh30:
	adrp	x8, _MAX14577_REG_CHGCTRL7@GOTPAGE
Lloh31:
	ldr	x8, [x8, _MAX14577_REG_CHGCTRL7@GOTPAGEOFF]
Lloh32:
	ldr	w1, [x8]
	mov	x0, x19
	bl	_max14577_write_reg
	mov	w0, #0
	b	LBB0_14
LBB0_13:
	ldr	w0, [x20, #8]
Lloh33:
	adrp	x1, l_.str@PAGE
Lloh34:
	add	x1, x1, l_.str@PAGEOFF
	bl	_dev_err
Lloh35:
	adrp	x8, _EINVAL@GOTPAGE
Lloh36:
	ldr	x8, [x8, _EINVAL@GOTPAGEOFF]
Lloh37:
	ldr	w8, [x8]
	neg	w0, w8
LBB0_14:
	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
	.loh AdrpLdrGotLdr	Lloh21, Lloh22, Lloh23
	.loh AdrpLdrGotLdr	Lloh18, Lloh19, Lloh20
	.loh AdrpLdrGotLdr	Lloh15, Lloh16, Lloh17
	.loh AdrpLdrGotLdr	Lloh12, Lloh13, Lloh14
	.loh AdrpLdrGotLdr	Lloh9, Lloh10, Lloh11
	.loh AdrpLdrGotLdr	Lloh5, Lloh6, Lloh8
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh7
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh24, Lloh25, Lloh26
	.loh AdrpLdrGotLdr	Lloh30, Lloh31, Lloh32
	.loh AdrpLdrGotLdr	Lloh27, Lloh28, Lloh29
	.loh AdrpLdrGotLdr	Lloh35, Lloh36, Lloh37
	.loh AdrpAdd	Lloh33, Lloh34
	.cfi_endproc
                                        ; -- End function
	.comm	_CDETCTRL1_CHGDETEN_SHIFT,4,2   ; @CDETCTRL1_CHGDETEN_SHIFT
	.comm	_MAX14577_REG_CDETCTRL1,4,2     ; @MAX14577_REG_CDETCTRL1
	.comm	_CDETCTRL1_CHGDETEN_MASK,4,2    ; @CDETCTRL1_CHGDETEN_MASK
	.comm	_CDETCTRL1_CHGTYPMAN_MASK,4,2   ; @CDETCTRL1_CHGTYPMAN_MASK
	.comm	_CHGCTRL2_VCHGR_RC_SHIFT,4,2    ; @CHGCTRL2_VCHGR_RC_SHIFT
	.comm	_CHGCTRL2_MBCHOSTEN_SHIFT,4,2   ; @CHGCTRL2_MBCHOSTEN_SHIFT
	.comm	_MAX14577_REG_CHGCTRL2,4,2      ; @MAX14577_REG_CHGCTRL2
	.comm	_CHGCTRL6_AUTOSTOP_SHIFT,4,2    ; @CHGCTRL6_AUTOSTOP_SHIFT
	.comm	_MAX14577_REG_CHGCTRL6,4,2      ; @MAX14577_REG_CHGCTRL6
	.comm	_MAXIM_CHARGER_FAST_CHARGE_TIMER_DEFAULT,4,2 ; @MAXIM_CHARGER_FAST_CHARGE_TIMER_DEFAULT
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"Wrong value for OVP: %u\n"

	.comm	_EINVAL,4,2                     ; @EINVAL
	.comm	_CHGCTRL7_OTPCGHCVS_SHIFT,4,2   ; @CHGCTRL7_OTPCGHCVS_SHIFT
	.comm	_MAX14577_REG_CHGCTRL7,4,2      ; @MAX14577_REG_CHGCTRL7
	.no_dead_strip	_max14577_charger_reg_init
.subsections_via_symbols
