	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function ltc294x_set_charge_now
_ltc294x_set_charge_now:                ## @ltc294x_set_charge_now
	.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	%r12
	pushq	%rbx
	subq	$32, %rsp
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rdi, %r14
	movq	___stack_chk_guard@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	movq	%rax, -40(%rbp)
	callq	_convert_uAh_to_bin
                                        ## kill: def $eax killed $eax def $rax
	cmpq	$0, (%r14)
	leal	65535(%rax), %ebx
	cmovnsl	%eax, %ebx
	cmpl	$65536, %ebx                    ## imm = 0x10000
	jb	LBB0_2
## %bb.1:
	movq	_EINVAL@GOTPCREL(%rip), %rcx
	xorl	%eax, %eax
	subl	(%rcx), %eax
	jmp	LBB0_5
LBB0_2:
	movl	8(%r14), %edi
	movq	_LTC294X_REG_CONTROL@GOTPCREL(%rip), %r15
	movl	(%r15), %esi
	leaq	-52(%rbp), %rdx
	movl	$1, %ecx
	callq	_ltc294x_read_regs
	testl	%eax, %eax
	js	LBB0_5
## %bb.3:
	movq	_LTC294X_REG_CONTROL_SHUTDOWN_MASK@GOTPCREL(%rip), %r12
	movl	(%r12), %eax
	orl	%eax, -52(%rbp)
	movl	8(%r14), %edi
	movl	(%r15), %esi
	leaq	-52(%rbp), %rdx
	movl	$1, %ecx
	callq	_ltc294x_write_regs
	testl	%eax, %eax
	js	LBB0_5
## %bb.4:
	movl	%ebx, %edi
	callq	_I16_MSB
	movl	%eax, -48(%rbp)
	movl	%ebx, %edi
	callq	_I16_LSB
	movl	%eax, -44(%rbp)
	movl	8(%r14), %edi
	movq	_LTC294X_REG_ACC_CHARGE_MSB@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	leaq	-48(%rbp), %rdx
	movl	$2, %ecx
	callq	_ltc294x_write_regs
	movl	(%r12), %eax
	notl	%eax
	andl	%eax, -52(%rbp)
	movl	8(%r14), %edi
	movl	(%r15), %esi
	leaq	-52(%rbp), %rdx
	movl	$1, %ecx
	callq	_ltc294x_write_regs
	movl	%eax, %ecx
	sarl	$31, %eax
	andl	%ecx, %eax
LBB0_5:
	movq	___stack_chk_guard@GOTPCREL(%rip), %rcx
	movq	(%rcx), %rcx
	cmpq	-40(%rbp), %rcx
	jne	LBB0_7
## %bb.6:
	addq	$32, %rsp
	popq	%rbx
	popq	%r12
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_7:
	callq	___stack_chk_fail
	.cfi_endproc
                                        ## -- End function
	.comm	_EINVAL,4,2                     ## @EINVAL
	.comm	_LTC294X_REG_CONTROL,4,2        ## @LTC294X_REG_CONTROL
	.comm	_LTC294X_REG_CONTROL_SHUTDOWN_MASK,4,2 ## @LTC294X_REG_CONTROL_SHUTDOWN_MASK
	.comm	_LTC294X_REG_ACC_CHARGE_MSB,4,2 ## @LTC294X_REG_ACC_CHARGE_MSB
	.no_dead_strip	_ltc294x_set_charge_now
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function ltc294x_set_charge_now
_ltc294x_set_charge_now:                ; @ltc294x_set_charge_now
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #80
	.cfi_def_cfa_offset 80
	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
	mov	x19, x0
Lloh0:
	adrp	x8, ___stack_chk_guard@GOTPAGE
Lloh1:
	ldr	x8, [x8, ___stack_chk_guard@GOTPAGEOFF]
Lloh2:
	ldr	x8, [x8]
	str	x8, [sp, #24]
	bl	_convert_uAh_to_bin
	ldr	x8, [x19]
	mov	w9, #65535
	add	w9, w0, w9
	cmp	x8, #0
	csel	w20, w9, w0, lt
	cmp	w20, #16, lsl #12               ; =65536
	b.lo	LBB0_2
; %bb.1:
Lloh3:
	adrp	x8, _EINVAL@GOTPAGE
Lloh4:
	ldr	x8, [x8, _EINVAL@GOTPAGEOFF]
Lloh5:
	ldr	w8, [x8]
	neg	w0, w8
	b	LBB0_5
LBB0_2:
	ldr	w0, [x19, #8]
Lloh6:
	adrp	x21, _LTC294X_REG_CONTROL@GOTPAGE
Lloh7:
	ldr	x21, [x21, _LTC294X_REG_CONTROL@GOTPAGEOFF]
	ldr	w1, [x21]
	add	x2, sp, #12
	mov	w3, #1
	bl	_ltc294x_read_regs
	tbnz	w0, #31, LBB0_5
; %bb.3:
Lloh8:
	adrp	x22, _LTC294X_REG_CONTROL_SHUTDOWN_MASK@GOTPAGE
Lloh9:
	ldr	x22, [x22, _LTC294X_REG_CONTROL_SHUTDOWN_MASK@GOTPAGEOFF]
	ldr	w8, [x22]
	ldr	w9, [sp, #12]
	orr	w8, w9, w8
	str	w8, [sp, #12]
	ldr	w0, [x19, #8]
	ldr	w1, [x21]
	add	x2, sp, #12
	mov	w3, #1
	bl	_ltc294x_write_regs
	tbnz	w0, #31, LBB0_5
; %bb.4:
	mov	x0, x20
	bl	_I16_MSB
	str	w0, [sp, #16]
	mov	x0, x20
	bl	_I16_LSB
	str	w0, [sp, #20]
	ldr	w0, [x19, #8]
Lloh10:
	adrp	x8, _LTC294X_REG_ACC_CHARGE_MSB@GOTPAGE
Lloh11:
	ldr	x8, [x8, _LTC294X_REG_ACC_CHARGE_MSB@GOTPAGEOFF]
Lloh12:
	ldr	w1, [x8]
	add	x2, sp, #16
	mov	w3, #2
	bl	_ltc294x_write_regs
	ldr	w8, [x22]
	ldr	w9, [sp, #12]
	bic	w8, w9, w8
	str	w8, [sp, #12]
	ldr	w0, [x19, #8]
	ldr	w1, [x21]
	add	x2, sp, #12
	mov	w3, #1
	bl	_ltc294x_write_regs
	cmp	w0, #0
	csel	w0, w0, wzr, lt
LBB0_5:
	ldr	x8, [sp, #24]
Lloh13:
	adrp	x9, ___stack_chk_guard@GOTPAGE
Lloh14:
	ldr	x9, [x9, ___stack_chk_guard@GOTPAGEOFF]
Lloh15:
	ldr	x9, [x9]
	cmp	x9, x8
	b.ne	LBB0_7
; %bb.6:
	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
	add	sp, sp, #80
	ret
LBB0_7:
	bl	___stack_chk_fail
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGot	Lloh6, Lloh7
	.loh AdrpLdrGot	Lloh8, Lloh9
	.loh AdrpLdrGotLdr	Lloh10, Lloh11, Lloh12
	.loh AdrpLdrGotLdr	Lloh13, Lloh14, Lloh15
	.cfi_endproc
                                        ; -- End function
	.comm	_EINVAL,4,2                     ; @EINVAL
	.comm	_LTC294X_REG_CONTROL,4,2        ; @LTC294X_REG_CONTROL
	.comm	_LTC294X_REG_CONTROL_SHUTDOWN_MASK,4,2 ; @LTC294X_REG_CONTROL_SHUTDOWN_MASK
	.comm	_LTC294X_REG_ACC_CHARGE_MSB,4,2 ; @LTC294X_REG_ACC_CHARGE_MSB
	.no_dead_strip	_ltc294x_set_charge_now
.subsections_via_symbols
