	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function pvr2_i2c_write
_pvr2_i2c_write:                        ## @pvr2_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	%r13
	pushq	%r12
	pushq	%rbx
	pushq	%rax
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movl	%ecx, %ebx
	movl	%esi, %r14d
	xorl	%r12d, %r12d
	testq	%rdx, %rdx
	cmovel	%r12d, %ebx
	cmpl	$6, %ebx
	jb	LBB0_2
## %bb.1:
	movq	_PVR2_TRACE_ERROR_LEGS@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	leaq	L_.str(%rip), %rsi
	movl	%r14d, %edx
	movl	%ebx, %ecx
	movl	$5, %r8d
	callq	_pvr2_trace
	movq	_ENOTSUPP@GOTPCREL(%rip), %rax
	subl	(%rax), %r12d
	jmp	LBB0_9
LBB0_2:
	movq	%rdx, %r13
	movq	%rdi, %r15
	movl	8(%rdi), %edi
	callq	_LOCK_TAKE
	movq	(%r15), %rdi
	xorl	%esi, %esi
	movl	$8, %edx
	callq	_memset
	movq	_FX2CMD_I2C_WRITE@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movq	(%r15), %rcx
	movl	%eax, (%rcx)
	movl	%r14d, 4(%rcx)
	movl	%ebx, 8(%rcx)
	testl	%ebx, %ebx
	je	LBB0_4
## %bb.3:
	addq	$12, %rcx
	movq	%rcx, %rdi
	movq	%r13, %rsi
	movl	%ebx, %edx
	callq	_memcpy
	movq	(%r15), %rcx
LBB0_4:
	addl	$3, %ebx
	movq	%r15, %rdi
	movq	%rcx, %rsi
	movl	%ebx, %edx
	movl	$1, %r8d
	callq	_pvr2_send_request
	movl	%eax, %r12d
	testl	%eax, %eax
	jne	LBB0_8
## %bb.5:
	movq	(%r15), %rax
	movl	(%rax), %edx
	xorl	%r12d, %r12d
	cmpl	$8, %edx
	je	LBB0_8
## %bb.6:
	movq	_EIO@GOTPCREL(%rip), %rax
	xorl	%r12d, %r12d
	subl	(%rax), %r12d
	cmpl	$7, %edx
	je	LBB0_8
## %bb.7:
	leaq	L_.str.1(%rip), %rdi
	movl	%r14d, %esi
	callq	_trace_i2c
LBB0_8:
	movl	8(%r15), %edi
	callq	_LOCK_GIVE
LBB0_9:
	movl	%r12d, %eax
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_PVR2_TRACE_ERROR_LEGS,4,2      ## @PVR2_TRACE_ERROR_LEGS
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"Killing an I2C write to %u that is too large (desired=%u limit=%u)"

	.comm	_ENOTSUPP,4,2                   ## @ENOTSUPP
	.comm	_FX2CMD_I2C_WRITE,4,2           ## @FX2CMD_I2C_WRITE
	.comm	_EIO,4,2                        ## @EIO
L_.str.1:                               ## @.str.1
	.asciz	"unexpected status from i2_write[%d]: %d"

	.no_dead_strip	_pvr2_i2c_write
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function pvr2_i2c_write
_pvr2_i2c_write:                        ; @pvr2_i2c_write
	.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	x20, x1
	cmp	x2, #0
	csel	w21, wzr, w3, eq
	cmp	w21, #6
	b.lo	LBB0_2
; %bb.1:
Lloh0:
	adrp	x8, _PVR2_TRACE_ERROR_LEGS@GOTPAGE
Lloh1:
	ldr	x8, [x8, _PVR2_TRACE_ERROR_LEGS@GOTPAGEOFF]
Lloh2:
	ldr	w0, [x8]
Lloh3:
	adrp	x1, l_.str@PAGE
Lloh4:
	add	x1, x1, l_.str@PAGEOFF
	mov	x2, x20
	mov	x3, x21
	mov	w4, #5
	bl	_pvr2_trace
Lloh5:
	adrp	x8, _ENOTSUPP@GOTPAGE
Lloh6:
	ldr	x8, [x8, _ENOTSUPP@GOTPAGEOFF]
Lloh7:
	ldr	w8, [x8]
	neg	w21, w8
	b	LBB0_10
LBB0_2:
	mov	x22, x2
	mov	x19, x0
	ldr	w0, [x0, #8]
	bl	_LOCK_TAKE
	ldr	x0, [x19]
	mov	w1, #0
	mov	w2, #8
	bl	_memset
Lloh8:
	adrp	x8, _FX2CMD_I2C_WRITE@GOTPAGE
Lloh9:
	ldr	x8, [x8, _FX2CMD_I2C_WRITE@GOTPAGEOFF]
Lloh10:
	ldr	w8, [x8]
	ldr	x1, [x19]
	stp	w8, w20, [x1]
	str	w21, [x1, #8]
	cbz	w21, LBB0_4
; %bb.3:
	add	x0, x1, #12
	mov	x1, x22
	mov	x2, x21
	bl	_memcpy
	ldr	x1, [x19]
LBB0_4:
	add	w2, w21, #3
	mov	x0, x19
	mov	x3, x1
	mov	w4, #1
	bl	_pvr2_send_request
	mov	x21, x0
	cbnz	w0, LBB0_9
; %bb.5:
	ldr	x8, [x19]
	ldr	w2, [x8]
	cmp	w2, #8
	b.ne	LBB0_7
; %bb.6:
	mov	w21, #0
	b	LBB0_9
LBB0_7:
Lloh11:
	adrp	x8, _EIO@GOTPAGE
Lloh12:
	ldr	x8, [x8, _EIO@GOTPAGEOFF]
Lloh13:
	ldr	w8, [x8]
	neg	w21, w8
	cmp	w2, #7
	b.eq	LBB0_9
; %bb.8:
Lloh14:
	adrp	x0, l_.str.1@PAGE
Lloh15:
	add	x0, x0, l_.str.1@PAGEOFF
	mov	x1, x20
	bl	_trace_i2c
LBB0_9:
	ldr	w0, [x19, #8]
	bl	_LOCK_GIVE
LBB0_10:
	mov	x0, x21
	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
	.loh AdrpLdrGotLdr	Lloh5, Lloh6, Lloh7
	.loh AdrpAdd	Lloh3, Lloh4
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh8, Lloh9, Lloh10
	.loh AdrpLdrGotLdr	Lloh11, Lloh12, Lloh13
	.loh AdrpAdd	Lloh14, Lloh15
	.cfi_endproc
                                        ; -- End function
	.comm	_PVR2_TRACE_ERROR_LEGS,4,2      ; @PVR2_TRACE_ERROR_LEGS
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"Killing an I2C write to %u that is too large (desired=%u limit=%u)"

	.comm	_ENOTSUPP,4,2                   ; @ENOTSUPP
	.comm	_FX2CMD_I2C_WRITE,4,2           ; @FX2CMD_I2C_WRITE
	.comm	_EIO,4,2                        ; @EIO
l_.str.1:                               ; @.str.1
	.asciz	"unexpected status from i2_write[%d]: %d"

	.no_dead_strip	_pvr2_i2c_write
.subsections_via_symbols
