	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function abx500_chargalg_chg_curr_maxim
_abx500_chargalg_chg_curr_maxim:        ## @abx500_chargalg_chg_curr_maxim
	.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
	movq	(%rdi), %rax
	movq	(%rax), %rsi
	movq	_MAXIM_RET_NOACTION@GOTPCREL(%rip), %r14
	cmpl	$0, 8(%rsi)
	je	LBB0_13
## %bb.1:
	movq	%rdi, %rbx
	cmpq	$0, 64(%rdi)
	je	LBB0_5
## %bb.2:
	movl	12(%rbx), %edx
	movl	56(%rbx), %edi
	leaq	L_.str(%rip), %rsi
	xorl	%eax, %eax
	callq	_dev_dbg
	cmpl	$0, 12(%rbx)
	movl	56(%rbx), %edi
	je	LBB0_3
## %bb.4:
	leaq	L_.str.2(%rip), %rsi
	xorl	%eax, %eax
	callq	_dev_dbg
	movl	12(%rbx), %eax
	movl	%eax, %ecx
	incl	%ecx
	movslq	%ecx, %rcx
	imulq	$1431655766, %rcx, %rcx         ## imm = 0x55555556
	movq	%rcx, %rdx
	shrq	$63, %rdx
	shrq	$32, %rcx
	addl	%edx, %ecx
	leal	(%rcx,%rcx,2), %ecx
	negl	%ecx
	addl	%ecx, %eax
	incl	%eax
	movl	%eax, 12(%rbx)
	jmp	LBB0_13
LBB0_5:
	movl	8(%rbx), %eax
	movl	60(%rbx), %edx
	movl	$0, 12(%rbx)
	cmpl	%edx, %eax
	jge	LBB0_8
## %bb.6:
	movl	56(%rbx), %edi
	movq	24(%rbx), %r8
	leaq	L_.str.3(%rip), %rsi
	movl	%eax, %ecx
	xorl	%eax, %eax
	callq	_dev_dbg
	movslq	8(%rbx), %rax
	cmpq	%rax, 24(%rbx)
	je	LBB0_13
## %bb.7:
	movq	(%rbx), %rcx
	movq	(%rcx), %rcx
	movq	(%rcx), %rcx
	movq	%rcx, 40(%rbx)
	movq	%rax, 24(%rbx)
	movq	$0, 48(%rbx)
	movq	_MAXIM_RET_IBAT_TOO_HIGH@GOTPCREL(%rip), %r14
	jmp	LBB0_13
LBB0_3:
	leaq	L_.str.1(%rip), %rsi
	xorl	%eax, %eax
	callq	_dev_dbg
	incl	12(%rbx)
	movq	(%rbx), %rax
	movq	24(%rbx), %rcx
	movq	(%rax), %rax
	movq	(%rax), %rax
	movq	%rax, 40(%rbx)
	movslq	32(%rbx), %rax
	subq	%rax, %rcx
	movq	%rcx, 16(%rbx)
	movq	%rcx, 24(%rbx)
	decq	48(%rbx)
	movq	_MAXIM_RET_CHANGE@GOTPCREL(%rip), %r14
	jmp	LBB0_13
LBB0_8:
	movl	%eax, %ecx
	subl	%edx, %ecx
	movslq	32(%rbx), %rdx
	cmpl	%edx, %ecx
	jle	LBB0_12
## %bb.9:
	movq	24(%rbx), %rcx
	addq	%rdx, %rcx
	cmpq	16(%rbx), %rcx
	jge	LBB0_12
## %bb.10:
	subq	$1, 40(%rbx)
	jae	LBB0_13
## %bb.11:
	movq	(%rsi), %rsi
	movq	%rsi, 40(%rbx)
	movq	%rcx, 24(%rbx)
	movq	48(%rbx), %r9
	incq	%r9
	movq	%r9, 48(%rbx)
	movl	56(%rbx), %edi
	leaq	L_.str.4(%rip), %rsi
                                        ## kill: def $edx killed $edx killed $rdx
	movl	%eax, %r8d
	xorl	%eax, %eax
	callq	_dev_dbg
	movq	_MAXIM_RET_CHANGE@GOTPCREL(%rip), %r14
	jmp	LBB0_13
LBB0_12:
	movq	(%rsi), %rax
	movq	%rax, 40(%rbx)
LBB0_13:
	movl	(%r14), %eax
	popq	%rbx
	popq	%r14
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_MAXIM_RET_NOACTION,4,2         ## @MAXIM_RET_NOACTION
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"Charger voltage has collapsed %d\n"

L_.str.1:                               ## @.str.1
	.asciz	"lowering current\n"

	.comm	_MAXIM_RET_CHANGE,4,2           ## @MAXIM_RET_CHANGE
L_.str.2:                               ## @.str.2
	.asciz	"waiting\n"

L_.str.3:                               ## @.str.3
	.asciz	" Maximization Ibat (%dmA) too high (limit %dmA) (current iset: %dmA)!\n"

	.comm	_MAXIM_RET_IBAT_TOO_HIGH,4,2    ## @MAXIM_RET_IBAT_TOO_HIGH
L_.str.4:                               ## @.str.4
	.asciz	" Maximization needed, increase with %d mA to %dmA (Optimal ibat: %d) Level %d\n"

	.no_dead_strip	_abx500_chargalg_chg_curr_maxim
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function abx500_chargalg_chg_curr_maxim
_abx500_chargalg_chg_curr_maxim:        ; @abx500_chargalg_chg_curr_maxim
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #64
	.cfi_def_cfa_offset 64
	stp	x20, x19, [sp, #32]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #48]             ; 16-byte Folded Spill
	add	x29, sp, #48
	.cfi_def_cfa w29, 16
	.cfi_offset w30, -8
	.cfi_offset w29, -16
	.cfi_offset w19, -24
	.cfi_offset w20, -32
	ldr	x8, [x0]
	ldr	x9, [x8]
	ldr	w8, [x9, #8]
	cbz	w8, LBB0_14
; %bb.1:
	mov	x19, x0
	ldr	x8, [x0, #64]
	cbz	x8, LBB0_4
; %bb.2:
	ldr	w0, [x19, #56]
	ldr	w8, [x19, #12]
	str	x8, [sp]
Lloh0:
	adrp	x1, l_.str@PAGE
Lloh1:
	add	x1, x1, l_.str@PAGEOFF
	bl	_dev_dbg
	ldr	w8, [x19, #12]
	ldr	w0, [x19, #56]
	cbz	w8, LBB0_7
; %bb.3:
Lloh2:
	adrp	x1, l_.str.2@PAGE
Lloh3:
	add	x1, x1, l_.str.2@PAGEOFF
	bl	_dev_dbg
	ldr	w8, [x19, #12]
	add	w8, w8, #1
	mov	w9, #21846
	movk	w9, #21845, lsl #16
	smull	x9, w8, w9
	lsr	x10, x9, #63
	lsr	x9, x9, #32
	add	w9, w9, w10
	add	w9, w9, w9, lsl #1
	sub	w8, w8, w9
	str	w8, [x19, #12]
	b	LBB0_14
LBB0_4:
	ldr	w8, [x19, #8]
	ldr	w11, [x19, #60]
	str	wzr, [x19, #12]
	cmp	w8, w11
	b.ge	LBB0_9
; %bb.5:
	ldr	w0, [x19, #56]
	ldr	x9, [x19, #24]
	stp	x8, x9, [sp, #8]
	str	x11, [sp]
Lloh4:
	adrp	x1, l_.str.3@PAGE
Lloh5:
	add	x1, x1, l_.str.3@PAGEOFF
	bl	_dev_dbg
	ldr	x9, [x19, #24]
	ldrsw	x8, [x19, #8]
	cmp	x9, x8
	b.eq	LBB0_14
; %bb.6:
	ldr	x9, [x19]
	ldr	x9, [x9]
	ldr	x9, [x9]
	str	x8, [x19, #24]
	stp	x9, xzr, [x19, #40]
Lloh6:
	adrp	x8, _MAXIM_RET_IBAT_TOO_HIGH@GOTPAGE
Lloh7:
	ldr	x8, [x8, _MAXIM_RET_IBAT_TOO_HIGH@GOTPAGEOFF]
	b	LBB0_15
LBB0_7:
Lloh8:
	adrp	x1, l_.str.1@PAGE
Lloh9:
	add	x1, x1, l_.str.1@PAGEOFF
	bl	_dev_dbg
	ldr	w8, [x19, #12]
	add	w8, w8, #1
	str	w8, [x19, #12]
	ldr	x8, [x19, #24]
	ldrsw	x9, [x19, #32]
	sub	x8, x8, x9
	ldr	x9, [x19]
	ldr	x9, [x9]
	ldr	x9, [x9]
	stp	x8, x8, [x19, #16]
	ldr	x8, [x19, #48]
	sub	x8, x8, #1
	stp	x9, x8, [x19, #40]
LBB0_8:
Lloh10:
	adrp	x8, _MAXIM_RET_CHANGE@GOTPAGE
Lloh11:
	ldr	x8, [x8, _MAXIM_RET_CHANGE@GOTPAGEOFF]
	b	LBB0_15
LBB0_9:
	ldrsw	x10, [x19, #32]
	sub	w11, w8, w11
	cmp	w11, w10
	b.le	LBB0_13
; %bb.10:
	ldp	x12, x11, [x19, #16]
	add	x11, x11, x10
	cmp	x11, x12
	b.ge	LBB0_13
; %bb.11:
	ldr	x12, [x19, #40]
	sub	x13, x12, #1
	str	x13, [x19, #40]
	cbnz	x12, LBB0_14
; %bb.12:
	ldr	x9, [x9]
	str	x11, [x19, #24]
	ldr	x12, [x19, #48]
	add	x12, x12, #1
	stp	x9, x12, [x19, #40]
	ldr	w0, [x19, #56]
                                        ; kill: def $w8 killed $w8 killed $x8 def $x8
	stp	x8, x12, [sp, #16]
	stp	x10, x11, [sp]
Lloh12:
	adrp	x1, l_.str.4@PAGE
Lloh13:
	add	x1, x1, l_.str.4@PAGEOFF
	bl	_dev_dbg
	b	LBB0_8
LBB0_13:
	ldr	x8, [x9]
	str	x8, [x19, #40]
LBB0_14:
Lloh14:
	adrp	x8, _MAXIM_RET_NOACTION@GOTPAGE
Lloh15:
	ldr	x8, [x8, _MAXIM_RET_NOACTION@GOTPAGEOFF]
LBB0_15:
	ldr	w0, [x8]
	ldp	x29, x30, [sp, #48]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #32]             ; 16-byte Folded Reload
	add	sp, sp, #64
	ret
	.loh AdrpAdd	Lloh0, Lloh1
	.loh AdrpAdd	Lloh2, Lloh3
	.loh AdrpAdd	Lloh4, Lloh5
	.loh AdrpLdrGot	Lloh6, Lloh7
	.loh AdrpAdd	Lloh8, Lloh9
	.loh AdrpLdrGot	Lloh10, Lloh11
	.loh AdrpAdd	Lloh12, Lloh13
	.loh AdrpLdrGot	Lloh14, Lloh15
	.cfi_endproc
                                        ; -- End function
	.comm	_MAXIM_RET_NOACTION,4,2         ; @MAXIM_RET_NOACTION
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"Charger voltage has collapsed %d\n"

l_.str.1:                               ; @.str.1
	.asciz	"lowering current\n"

	.comm	_MAXIM_RET_CHANGE,4,2           ; @MAXIM_RET_CHANGE
l_.str.2:                               ; @.str.2
	.asciz	"waiting\n"

l_.str.3:                               ; @.str.3
	.asciz	" Maximization Ibat (%dmA) too high (limit %dmA) (current iset: %dmA)!\n"

	.comm	_MAXIM_RET_IBAT_TOO_HIGH,4,2    ; @MAXIM_RET_IBAT_TOO_HIGH
l_.str.4:                               ; @.str.4
	.asciz	" Maximization needed, increase with %d mA to %dmA (Optimal ibat: %d) Level %d\n"

	.no_dead_strip	_abx500_chargalg_chg_curr_maxim
.subsections_via_symbols
