	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function ngene_i2c_master_xfer
_ngene_i2c_master_xfer:                 ## @ngene_i2c_master_xfer
	.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	$16, %rsp
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movl	%edx, %r12d
	movq	%rsi, %r15
	callq	_i2c_get_adapdata
	movq	%rax, %rbx
	movq	8(%rax), %r14
	movq	%r14, %rdi
	callq	_mutex_lock
	movl	(%rbx), %esi
	movq	%r14, %rdi
	callq	_ngene_i2c_set_bus
	cmpl	$1, %r12d
	je	LBB0_5
## %bb.1:
	cmpl	$2, %r12d
	jne	LBB0_10
## %bb.2:
	movq	_I2C_M_RD@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	testl	%eax, 24(%r15)
	je	LBB0_10
## %bb.3:
	testl	%eax, (%r15)
	jne	LBB0_10
## %bb.4:
	movl	16(%r15), %esi
	movq	8(%r15), %rdx
	movl	4(%r15), %ecx
	movq	32(%r15), %r8
	movl	28(%r15), %r9d
	movl	$0, (%rsp)
	movq	%r14, %rdi
	jmp	LBB0_9
LBB0_5:
	movq	_I2C_M_RD@GOTPCREL(%rip), %rbx
	movl	(%rbx), %eax
	testl	%eax, (%r15)
	je	LBB0_6
LBB0_8:
	movl	16(%r15), %esi
	movq	8(%r15), %r8
	movl	4(%r15), %r9d
	movl	$0, (%rsp)
	movq	%r14, %rdi
	xorl	%edx, %edx
	xorl	%ecx, %ecx
LBB0_9:
	callq	_ngene_command_i2c_read
	testl	%eax, %eax
	je	LBB0_11
LBB0_10:
	movq	%r14, %rdi
	callq	_mutex_unlock
	movq	_EIO@GOTPCREL(%rip), %rax
	xorl	%r12d, %r12d
	subl	(%rax), %r12d
LBB0_12:
	movl	%r12d, %eax
	addq	$16, %rsp
	popq	%rbx
	popq	%r12
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_6:
	movl	16(%r15), %esi
	movq	8(%r15), %rdx
	movl	4(%r15), %ecx
	movq	%r14, %rdi
	callq	_ngene_command_i2c_write
	testl	%eax, %eax
	je	LBB0_11
## %bb.7:
	movl	(%rbx), %eax
	testl	%eax, (%r15)
	jne	LBB0_8
	jmp	LBB0_10
LBB0_11:
	movq	%r14, %rdi
	callq	_mutex_unlock
	jmp	LBB0_12
	.cfi_endproc
                                        ## -- End function
	.comm	_I2C_M_RD,4,2                   ## @I2C_M_RD
	.comm	_EIO,4,2                        ## @EIO
	.no_dead_strip	_ngene_i2c_master_xfer
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function ngene_i2c_master_xfer
_ngene_i2c_master_xfer:                 ; @ngene_i2c_master_xfer
	.cfi_startproc
; %bb.0:
	stp	x22, x21, [sp, #-48]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 48
	stp	x20, x19, [sp, #16]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #32]             ; 16-byte Folded Spill
	add	x29, sp, #32
	.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	x21, x1
	bl	_i2c_get_adapdata
	mov	x22, x0
	ldr	x20, [x0, #8]
	mov	x0, x20
	bl	_mutex_lock
	ldr	w1, [x22]
	mov	x0, x20
	bl	_ngene_i2c_set_bus
	cmp	w19, #1
	b.eq	LBB0_5
; %bb.1:
	cmp	w19, #2
	b.ne	LBB0_8
; %bb.2:
	ldr	w9, [x21, #24]
Lloh0:
	adrp	x8, _I2C_M_RD@GOTPAGE
Lloh1:
	ldr	x8, [x8, _I2C_M_RD@GOTPAGEOFF]
Lloh2:
	ldr	w8, [x8]
	tst	w8, w9
	b.eq	LBB0_8
; %bb.3:
	ldr	w9, [x21]
	tst	w9, w8
	b.ne	LBB0_8
; %bb.4:
	ldr	w1, [x21, #16]
	ldr	x2, [x21, #8]
	ldr	w3, [x21, #4]
	ldr	x4, [x21, #32]
	ldr	w5, [x21, #28]
	mov	x0, x20
	b	LBB0_7
LBB0_5:
	ldr	w8, [x21]
Lloh3:
	adrp	x22, _I2C_M_RD@GOTPAGE
Lloh4:
	ldr	x22, [x22, _I2C_M_RD@GOTPAGEOFF]
	ldr	w9, [x22]
	tst	w9, w8
	b.eq	LBB0_10
LBB0_6:
	ldr	w1, [x21, #16]
	ldr	x4, [x21, #8]
	ldr	w5, [x21, #4]
	mov	x0, x20
	mov	x2, #0
	mov	w3, #0
LBB0_7:
	mov	w6, #0
	bl	_ngene_command_i2c_read
	cbz	w0, LBB0_12
LBB0_8:
	mov	x0, x20
	bl	_mutex_unlock
Lloh5:
	adrp	x8, _EIO@GOTPAGE
Lloh6:
	ldr	x8, [x8, _EIO@GOTPAGEOFF]
Lloh7:
	ldr	w8, [x8]
	neg	w19, w8
LBB0_9:
	mov	x0, x19
	ldp	x29, x30, [sp, #32]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #16]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp], #48             ; 16-byte Folded Reload
	ret
LBB0_10:
	ldr	w1, [x21, #16]
	ldr	x2, [x21, #8]
	ldr	w3, [x21, #4]
	mov	x0, x20
	bl	_ngene_command_i2c_write
	cbz	w0, LBB0_12
; %bb.11:
	ldr	w8, [x21]
	ldr	w9, [x22]
	tst	w9, w8
	b.ne	LBB0_6
	b	LBB0_8
LBB0_12:
	mov	x0, x20
	bl	_mutex_unlock
	b	LBB0_9
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGot	Lloh3, Lloh4
	.loh AdrpLdrGotLdr	Lloh5, Lloh6, Lloh7
	.cfi_endproc
                                        ; -- End function
	.comm	_I2C_M_RD,4,2                   ; @I2C_M_RD
	.comm	_EIO,4,2                        ; @EIO
	.no_dead_strip	_ngene_i2c_master_xfer
.subsections_via_symbols
