	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function max14577_init_eoc
_max14577_init_eoc:                     ## @max14577_init_eoc
	.cfi_startproc
## %bb.0:
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset %rbp, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register %rbp
	pushq	%r14
	pushq	%rbx
	.cfi_offset %rbx, -32
	.cfi_offset %r14, -24
                                        ## kill: def $esi killed $esi def $rsi
	movq	%rdi, %r14
	movq	(%rdi), %rax
	cmpl	$128, (%rax)
	jne	LBB0_6
## %bb.1:
	cmpl	$4999, %esi                     ## imm = 0x1387
	jbe	LBB0_9
## %bb.2:
	leal	-7500(%rsi), %eax
	xorl	%ebx, %ebx
	cmpl	$2500, %eax                     ## imm = 0x9C4
	jb	LBB0_8
## %bb.3:
	cmpl	$50000, %esi                    ## imm = 0xC350
	ja	LBB0_5
## %bb.4:
	movzwl	%si, %eax
	shrl	$3, %eax
	imull	$6711, %eax, %ebx               ## imm = 0x1A37
	shrl	$22, %ebx
	jmp	LBB0_8
LBB0_6:
	movq	_MAX14577_CHARGER_EOC_CURRENT_LIMIT_MIN@GOTPCREL(%rip), %rbx
	cmpl	%esi, (%rbx)
	jbe	LBB0_7
LBB0_9:
	movq	_EINVAL@GOTPCREL(%rip), %rcx
	xorl	%eax, %eax
	subl	(%rcx), %eax
	popq	%rbx
	popq	%r14
	popq	%rbp
	retq
LBB0_7:
	movq	_MAX14577_CHARGER_EOC_CURRENT_LIMIT_MAX@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movl	%esi, %edi
	movl	%eax, %esi
	callq	_min
	subl	(%rbx), %eax
	movq	_MAX14577_CHARGER_EOC_CURRENT_LIMIT_STEP@GOTPCREL(%rip), %rcx
	xorl	%edx, %edx
	divl	(%rcx)
	movl	%eax, %ebx
	jmp	LBB0_8
LBB0_5:
	movl	%esi, %edi
	movl	$100000, %esi                   ## imm = 0x186A0
	callq	_min
                                        ## kill: def $eax killed $eax def $rax
	addl	$-50000, %eax                   ## imm = 0xFFFF3CB0
	movl	$3518437209, %ebx               ## imm = 0xD1B71759
	imulq	%rax, %rbx
	shrq	$45, %rbx
	addl	$10, %ebx
LBB0_8:
	movq	_CHGCTRL5_EOCS_SHIFT@GOTPCREL(%rip), %rax
	movb	(%rax), %cl
	shll	%cl, %ebx
	movq	(%r14), %rax
	movl	4(%rax), %edi
	movq	_MAX14577_CHG_REG_CHG_CTRL5@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	_CHGCTRL5_EOCS_MASK@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	movl	%ebx, %ecx
	popq	%rbx
	popq	%r14
	popq	%rbp
	jmp	_max14577_update_reg            ## TAILCALL
	.cfi_endproc
                                        ## -- End function
	.comm	_EINVAL,4,2                     ## @EINVAL
	.comm	_MAX14577_CHARGER_EOC_CURRENT_LIMIT_MIN,4,2 ## @MAX14577_CHARGER_EOC_CURRENT_LIMIT_MIN
	.comm	_MAX14577_CHARGER_EOC_CURRENT_LIMIT_MAX,4,2 ## @MAX14577_CHARGER_EOC_CURRENT_LIMIT_MAX
	.comm	_MAX14577_CHARGER_EOC_CURRENT_LIMIT_STEP,4,2 ## @MAX14577_CHARGER_EOC_CURRENT_LIMIT_STEP
	.comm	_CHGCTRL5_EOCS_SHIFT,4,2        ## @CHGCTRL5_EOCS_SHIFT
	.comm	_MAX14577_CHG_REG_CHG_CTRL5,4,2 ## @MAX14577_CHG_REG_CHG_CTRL5
	.comm	_CHGCTRL5_EOCS_MASK,4,2         ## @CHGCTRL5_EOCS_MASK
	.no_dead_strip	_max14577_init_eoc
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function max14577_init_eoc
_max14577_init_eoc:                     ; @max14577_init_eoc
	.cfi_startproc
; %bb.0:
	stp	x20, x19, [sp, #-32]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 32
	stp	x29, x30, [sp, #16]             ; 16-byte Folded Spill
	add	x29, sp, #16
	.cfi_def_cfa w29, 16
	.cfi_offset w30, -8
	.cfi_offset w29, -16
	.cfi_offset w19, -24
	.cfi_offset w20, -32
	mov	x19, x0
	ldr	x8, [x0]
	ldr	w8, [x8]
	cmp	w8, #128
	b.ne	LBB0_4
; %bb.1:
	lsr	w8, w1, #3
	cmp	w8, #624
	b.ls	LBB0_5
; %bb.2:
	mov	w8, #-7500
	add	w8, w1, w8
	cmp	w8, #2500
	b.hs	LBB0_7
; %bb.3:
	mov	w8, #0
	b	LBB0_10
LBB0_4:
Lloh0:
	adrp	x20, _MAX14577_CHARGER_EOC_CURRENT_LIMIT_MIN@GOTPAGE
Lloh1:
	ldr	x20, [x20, _MAX14577_CHARGER_EOC_CURRENT_LIMIT_MIN@GOTPAGEOFF]
	ldr	w8, [x20]
	cmp	w8, w1
	b.ls	LBB0_6
LBB0_5:
Lloh2:
	adrp	x8, _EINVAL@GOTPAGE
Lloh3:
	ldr	x8, [x8, _EINVAL@GOTPAGEOFF]
Lloh4:
	ldr	w8, [x8]
	neg	w0, w8
	ldp	x29, x30, [sp, #16]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp], #32             ; 16-byte Folded Reload
	ret
LBB0_6:
Lloh5:
	adrp	x8, _MAX14577_CHARGER_EOC_CURRENT_LIMIT_MAX@GOTPAGE
Lloh6:
	ldr	x8, [x8, _MAX14577_CHARGER_EOC_CURRENT_LIMIT_MAX@GOTPAGEOFF]
Lloh7:
	ldr	w8, [x8]
	mov	x0, x1
	mov	x1, x8
	bl	_min
	ldr	w8, [x20]
	sub	w8, w0, w8
Lloh8:
	adrp	x9, _MAX14577_CHARGER_EOC_CURRENT_LIMIT_STEP@GOTPAGE
Lloh9:
	ldr	x9, [x9, _MAX14577_CHARGER_EOC_CURRENT_LIMIT_STEP@GOTPAGEOFF]
Lloh10:
	ldr	w9, [x9]
	udiv	w8, w8, w9
	b	LBB0_10
LBB0_7:
	mov	w8, #50000
	cmp	w1, w8
	b.hi	LBB0_9
; %bb.8:
	ubfx	w8, w1, #3, #13
	mov	w9, #6711
	mul	w8, w8, w9
	lsr	w8, w8, #22
	b	LBB0_10
LBB0_9:
	mov	x0, x1
	mov	w1, #34464
	movk	w1, #1, lsl #16
	bl	_min
	mov	w8, #-50000
	add	w8, w0, w8
	mov	w9, #5977
	movk	w9, #53687, lsl #16
	umull	x8, w8, w9
	lsr	x8, x8, #45
	add	w8, w8, #10
LBB0_10:
Lloh11:
	adrp	x9, _CHGCTRL5_EOCS_SHIFT@GOTPAGE
Lloh12:
	ldr	x9, [x9, _CHGCTRL5_EOCS_SHIFT@GOTPAGEOFF]
Lloh13:
	ldr	w9, [x9]
	lsl	w3, w8, w9
	ldr	x8, [x19]
	ldr	w0, [x8, #4]
Lloh14:
	adrp	x8, _MAX14577_CHG_REG_CHG_CTRL5@GOTPAGE
Lloh15:
	ldr	x8, [x8, _MAX14577_CHG_REG_CHG_CTRL5@GOTPAGEOFF]
Lloh16:
	adrp	x9, _CHGCTRL5_EOCS_MASK@GOTPAGE
Lloh17:
	ldr	x9, [x9, _CHGCTRL5_EOCS_MASK@GOTPAGEOFF]
Lloh18:
	ldr	w1, [x8]
Lloh19:
	ldr	w2, [x9]
	ldp	x29, x30, [sp, #16]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp], #32             ; 16-byte Folded Reload
	b	_max14577_update_reg
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpLdrGotLdr	Lloh2, Lloh3, Lloh4
	.loh AdrpLdrGotLdr	Lloh8, Lloh9, Lloh10
	.loh AdrpLdrGotLdr	Lloh5, Lloh6, Lloh7
	.loh AdrpLdrGotLdr	Lloh16, Lloh17, Lloh19
	.loh AdrpLdrGotLdr	Lloh14, Lloh15, Lloh18
	.loh AdrpLdrGotLdr	Lloh11, Lloh12, Lloh13
	.cfi_endproc
                                        ; -- End function
	.comm	_EINVAL,4,2                     ; @EINVAL
	.comm	_MAX14577_CHARGER_EOC_CURRENT_LIMIT_MIN,4,2 ; @MAX14577_CHARGER_EOC_CURRENT_LIMIT_MIN
	.comm	_MAX14577_CHARGER_EOC_CURRENT_LIMIT_MAX,4,2 ; @MAX14577_CHARGER_EOC_CURRENT_LIMIT_MAX
	.comm	_MAX14577_CHARGER_EOC_CURRENT_LIMIT_STEP,4,2 ; @MAX14577_CHARGER_EOC_CURRENT_LIMIT_STEP
	.comm	_CHGCTRL5_EOCS_SHIFT,4,2        ; @CHGCTRL5_EOCS_SHIFT
	.comm	_MAX14577_CHG_REG_CHG_CTRL5,4,2 ; @MAX14577_CHG_REG_CHG_CTRL5
	.comm	_CHGCTRL5_EOCS_MASK,4,2         ; @CHGCTRL5_EOCS_MASK
	.no_dead_strip	_max14577_init_eoc
.subsections_via_symbols
