	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function bq2415x_i2c_write
_bq2415x_i2c_write:                     ## @bq2415x_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	%rbx
	subq	$104, %rsp
	.cfi_offset %rbx, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	___stack_chk_guard@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	movq	%rax, -32(%rbp)
	movl	(%rdi), %edi
	callq	_to_i2c_client
	movq	%rax, %rbx
	movaps	16(%rbp), %xmm0
	movaps	32(%rbp), %xmm1
	movaps	%xmm1, -112(%rbp)
	movaps	%xmm0, -128(%rbp)
	movaps	48(%rbp), %xmm0
	movaps	64(%rbp), %xmm1
	movaps	%xmm0, -96(%rbp)
	movaps	%xmm1, -80(%rbp)
	movl	4(%rax), %eax
	movl	%eax, -40(%rbp)
	movq	$0, -48(%rbp)
	leaq	-128(%rbp), %rdi
	movq	%rdi, -56(%rbp)
	callq	_ARRAY_SIZE
	movl	%eax, -64(%rbp)
	movq	_bq2415x_i2c_mutex@GOTPCREL(%rip), %r14
	movq	%r14, %rdi
	callq	_mutex_lock
	movl	(%rbx), %ebx
	leaq	-64(%rbp), %r15
	movq	%r15, %rdi
	callq	_ARRAY_SIZE
	movl	%ebx, %edi
	movq	%r15, %rsi
	movl	%eax, %edx
	callq	_i2c_transfer
	movl	%eax, %ebx
	movq	%r14, %rdi
	callq	_mutex_unlock
	testl	%ebx, %ebx
	js	LBB0_1
## %bb.2:
	xorl	%eax, %eax
	cmpl	$1, %ebx
	je	LBB0_4
## %bb.3:
	movq	_EIO@GOTPCREL(%rip), %rcx
	xorl	%eax, %eax
	subl	(%rcx), %eax
	jmp	LBB0_4
LBB0_1:
	movl	%ebx, %eax
LBB0_4:
	movq	___stack_chk_guard@GOTPCREL(%rip), %rcx
	movq	(%rcx), %rcx
	cmpq	-32(%rbp), %rcx
	jne	LBB0_6
## %bb.5:
	addq	$104, %rsp
	popq	%rbx
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_6:
	callq	___stack_chk_fail
	.cfi_endproc
                                        ## -- End function
	.comm	_bq2415x_i2c_mutex,4,2          ## @bq2415x_i2c_mutex
	.comm	_EIO,4,2                        ## @EIO
	.no_dead_strip	_bq2415x_i2c_write
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function bq2415x_i2c_write
_bq2415x_i2c_write:                     ; @bq2415x_i2c_write
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #160
	.cfi_def_cfa_offset 160
	stp	x22, x21, [sp, #112]            ; 16-byte Folded Spill
	stp	x20, x19, [sp, #128]            ; 16-byte Folded Spill
	stp	x29, x30, [sp, #144]            ; 16-byte Folded Spill
	add	x29, sp, #144
	.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, x2
	mov	x20, 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
	mov	x21, x0
	ldp	q0, q1, [x20]
	stp	q0, q1, [sp]
	ldp	q0, q1, [x19]
	stp	q0, q1, [sp, #32]
	ldr	w8, [x0, #4]
	str	w8, [sp, #96]
	mov	x8, sp
	stp	x8, xzr, [sp, #80]
	mov	x0, sp
	bl	_ARRAY_SIZE
	str	w0, [sp, #72]
Lloh3:
	adrp	x20, _bq2415x_i2c_mutex@GOTPAGE
Lloh4:
	ldr	x20, [x20, _bq2415x_i2c_mutex@GOTPAGEOFF]
	mov	x0, x20
	bl	_mutex_lock
	ldr	w19, [x21]
	add	x0, sp, #72
	bl	_ARRAY_SIZE
	mov	x2, x0
	add	x1, sp, #72
	mov	x0, x19
	bl	_i2c_transfer
	mov	x19, x0
	mov	x0, x20
	bl	_mutex_unlock
	tbnz	w19, #31, LBB0_4
; %bb.1:
	cmp	w19, #1
	b.ne	LBB0_3
; %bb.2:
	mov	w19, #0
	b	LBB0_4
LBB0_3:
Lloh5:
	adrp	x8, _EIO@GOTPAGE
Lloh6:
	ldr	x8, [x8, _EIO@GOTPAGEOFF]
Lloh7:
	ldr	w8, [x8]
	neg	w19, w8
LBB0_4:
	ldur	x8, [x29, #-40]
Lloh8:
	adrp	x9, ___stack_chk_guard@GOTPAGE
Lloh9:
	ldr	x9, [x9, ___stack_chk_guard@GOTPAGEOFF]
Lloh10:
	ldr	x9, [x9]
	cmp	x9, x8
	b.ne	LBB0_6
; %bb.5:
	mov	x0, x19
	ldp	x29, x30, [sp, #144]            ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #128]            ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #112]            ; 16-byte Folded Reload
	add	sp, sp, #160
	ret
LBB0_6:
	bl	___stack_chk_fail
	.loh AdrpLdrGot	Lloh3, Lloh4
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh5, Lloh6, Lloh7
	.loh AdrpLdrGotLdr	Lloh8, Lloh9, Lloh10
	.cfi_endproc
                                        ; -- End function
	.comm	_bq2415x_i2c_mutex,4,2          ; @bq2415x_i2c_mutex
	.comm	_EIO,4,2                        ; @EIO
	.no_dead_strip	_bq2415x_i2c_write
.subsections_via_symbols
