	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function bq27xxx_battery_i2c_write
_bq27xxx_battery_i2c_write:             ## @bq27xxx_battery_i2c_write
	.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	$80, %rsp
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movl	%ecx, %r15d
	movl	%edx, %r14d
	movq	%rsi, %r12
	movq	___stack_chk_guard@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	movq	%rax, -40(%rbp)
	movl	(%rdi), %edi
	callq	_to_i2c_client
	cmpl	$0, (%rax)
	je	LBB0_1
## %bb.2:
	movq	%rax, %rbx
	movq	%r12, -80(%rbp)
	testl	%r15d, %r15d
	je	LBB0_4
## %bb.3:
	movslq	%r14d, %rax
	movq	%rax, -72(%rbp)
	movl	$2, %eax
	jmp	LBB0_5
LBB0_1:
	movq	_ENODEV@GOTPCREL(%rip), %rcx
	jmp	LBB0_9
LBB0_4:
	leaq	-72(%rbp), %rsi
	movl	%r14d, %edi
	callq	_put_unaligned_le16
	movl	$3, %eax
LBB0_5:
	movl	%eax, -112(%rbp)
	leaq	-80(%rbp), %rax
	movq	%rax, -88(%rbp)
	movl	4(%rbx), %eax
	movl	%eax, -96(%rbp)
	movq	$0, -104(%rbp)
	movl	(%rbx), %edi
	leaq	-112(%rbp), %rsi
	movl	$1, %edx
	callq	_i2c_transfer
	movl	%eax, %ecx
	testl	%eax, %eax
	js	LBB0_6
## %bb.7:
	xorl	%eax, %eax
	cmpl	$1, %ecx
	je	LBB0_10
## %bb.8:
	movq	_EINVAL@GOTPCREL(%rip), %rcx
LBB0_9:
	xorl	%eax, %eax
	subl	(%rcx), %eax
	jmp	LBB0_10
LBB0_6:
	movl	%ecx, %eax
LBB0_10:
	movq	___stack_chk_guard@GOTPCREL(%rip), %rcx
	movq	(%rcx), %rcx
	cmpq	-40(%rbp), %rcx
	jne	LBB0_12
## %bb.11:
	addq	$80, %rsp
	popq	%rbx
	popq	%r12
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_12:
	callq	___stack_chk_fail
	.cfi_endproc
                                        ## -- End function
	.comm	_ENODEV,4,2                     ## @ENODEV
	.comm	_EINVAL,4,2                     ## @EINVAL
	.no_dead_strip	_bq27xxx_battery_i2c_write
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function bq27xxx_battery_i2c_write
_bq27xxx_battery_i2c_write:             ; @bq27xxx_battery_i2c_write
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #128
	.cfi_def_cfa_offset 128
	stp	x22, x21, [sp, #80]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #96]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #112]            ; 16-byte Folded Spill
	add	x29, sp, #112
	.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	x21, x3
	mov	x20, x2
	mov	x22, x1
Lloh0:
	adrp	x8, ___stack_chk_guard@GOTPAGE
Lloh1:
	ldr	x8, [x8, ___stack_chk_guard@GOTPAGEOFF]
Lloh2:
	ldr	x8, [x8]
	stur	x8, [x29, #-40]
	ldr	w0, [x0]
	bl	_to_i2c_client
	ldr	w8, [x0]
	cbz	w8, LBB0_3
; %bb.1:
	mov	x19, x0
	str	x22, [sp, #40]
	cbz	w21, LBB0_4
; %bb.2:
	sxtw	x8, w20
	str	x8, [sp, #48]
	mov	w8, #2
	b	LBB0_5
LBB0_3:
Lloh3:
	adrp	x8, _ENODEV@GOTPAGE
Lloh4:
	ldr	x8, [x8, _ENODEV@GOTPAGEOFF]
	b	LBB0_9
LBB0_4:
	add	x8, sp, #40
	add	x1, x8, #8
	mov	x0, x20
	bl	_put_unaligned_le16
	mov	w8, #3
LBB0_5:
	str	w8, [sp, #8]
	add	x8, sp, #40
	str	x8, [sp, #32]
	ldr	w8, [x19, #4]
	str	w8, [sp, #24]
	str	xzr, [sp, #16]
	ldr	w0, [x19]
	add	x1, sp, #8
	mov	w2, #1
	bl	_i2c_transfer
	tbnz	w0, #31, LBB0_10
; %bb.6:
	cmp	w0, #1
	b.ne	LBB0_8
; %bb.7:
	mov	w0, #0
	b	LBB0_10
LBB0_8:
Lloh5:
	adrp	x8, _EINVAL@GOTPAGE
Lloh6:
	ldr	x8, [x8, _EINVAL@GOTPAGEOFF]
LBB0_9:
	ldr	w8, [x8]
	neg	w0, w8
LBB0_10:
	ldur	x8, [x29, #-40]
Lloh7:
	adrp	x9, ___stack_chk_guard@GOTPAGE
Lloh8:
	ldr	x9, [x9, ___stack_chk_guard@GOTPAGEOFF]
Lloh9:
	ldr	x9, [x9]
	cmp	x9, x8
	b.ne	LBB0_12
; %bb.11:
	ldp	x29, x30, [sp, #112]            ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #96]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #80]             ; 16-byte Folded Reload
	add	sp, sp, #128
	ret
LBB0_12:
	bl	___stack_chk_fail
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGot	Lloh3, Lloh4
	.loh AdrpLdrGot	Lloh5, Lloh6
	.loh AdrpLdrGotLdr	Lloh7, Lloh8, Lloh9
	.cfi_endproc
                                        ; -- End function
	.comm	_ENODEV,4,2                     ; @ENODEV
	.comm	_EINVAL,4,2                     ; @EINVAL
	.no_dead_strip	_bq27xxx_battery_i2c_write
.subsections_via_symbols
