	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function pvr2_i2c_read
_pvr2_i2c_read:                         ## @pvr2_i2c_read
	.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
	subq	$24, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
                                        ## kill: def $r9d killed $r9d def $r9
	movl	%ecx, %r15d
	movl	%esi, %r13d
	xorl	%ebx, %ebx
	testq	%rdx, %rdx
	cmovel	%ebx, %r15d
	cmpl	$5, %r15d
	jb	LBB0_2
## %bb.1:
	movq	_PVR2_TRACE_ERROR_LEGS@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	leaq	L_.str(%rip), %rsi
	movl	%r13d, %edx
	movl	%r15d, %ecx
	movl	$4, %r8d
	callq	_pvr2_trace
	movq	_ENOTSUPP@GOTPCREL(%rip), %rax
	subl	(%rax), %ebx
	jmp	LBB0_19
LBB0_2:
	movq	%rdx, %r14
	movq	%rdi, %r12
	testq	%r8, %r8
	je	LBB0_5
## %bb.3:
	cmpl	$8, %r9d
	jb	LBB0_5
## %bb.4:
	movq	_PVR2_TRACE_ERROR_LEGS@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	leaq	L_.str.1(%rip), %rsi
	movl	%r13d, %edx
	movl	%r9d, %ecx
	movl	$7, %r8d
	callq	_pvr2_trace
	movq	_ENOTSUPP@GOTPCREL(%rip), %rax
	xorl	%ebx, %ebx
	subl	(%rax), %ebx
	jmp	LBB0_19
LBB0_5:
	movq	%r8, -56(%rbp)                  ## 8-byte Spill
	movl	8(%r12), %edi
	movq	%r9, -48(%rbp)                  ## 8-byte Spill
	callq	_LOCK_TAKE
	movq	(%r12), %rdi
	xorl	%esi, %esi
	movl	$8, %edx
	callq	_memset
	movq	-48(%rbp), %rdx                 ## 8-byte Reload
	movq	_FX2CMD_I2C_READ@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movq	(%r12), %rcx
	movl	%eax, (%rcx)
	movl	%r15d, 4(%rcx)
	movl	%edx, 8(%rcx)
	movl	%r13d, 12(%rcx)
	testl	%r15d, %r15d
	je	LBB0_7
## %bb.6:
	addq	$16, %rcx
	movq	%rcx, %rdi
	movq	%r14, %rsi
	movl	%r15d, %edx
	callq	_memcpy
	movq	-48(%rbp), %rdx                 ## 8-byte Reload
	movq	(%r12), %rcx
LBB0_7:
	addl	$4, %r15d
	leal	1(%rdx), %r8d
	movq	%r12, %rdi
	movq	%rcx, %rsi
	movl	%r15d, %edx
	callq	_pvr2_send_request
	movl	%eax, %ebx
	testl	%eax, %eax
	movq	-56(%rbp), %rdi                 ## 8-byte Reload
	je	LBB0_8
LBB0_11:
	testq	%rdi, %rdi
	je	LBB0_18
## %bb.12:
	movq	-48(%rbp), %rdx                 ## 8-byte Reload
	testl	%edx, %edx
	je	LBB0_18
## %bb.13:
	testl	%ebx, %ebx
	je	LBB0_14
## %bb.20:
	xorl	%esi, %esi
                                        ## kill: def $edx killed $edx killed $rdx
	callq	_memset
	jmp	LBB0_18
LBB0_8:
	movq	(%r12), %rsi
	movl	(%rsi), %edx
	cmpl	$8, %edx
	jne	LBB0_9
## %bb.15:
	xorl	%ebx, %ebx
	testq	%rdi, %rdi
	je	LBB0_18
## %bb.16:
	movq	-48(%rbp), %rdx                 ## 8-byte Reload
	testl	%edx, %edx
	jne	LBB0_17
	jmp	LBB0_18
LBB0_9:
	movq	_EIO@GOTPCREL(%rip), %rax
	xorl	%ebx, %ebx
	subl	(%rax), %ebx
	cmpl	$7, %edx
	je	LBB0_11
## %bb.10:
	leaq	L_.str.2(%rip), %rdi
	movl	%r13d, %esi
	callq	_trace_i2c
	movq	-56(%rbp), %rdi                 ## 8-byte Reload
	jmp	LBB0_11
LBB0_14:
	movq	(%r12), %rsi
LBB0_17:
	addq	$4, %rsi
                                        ## kill: def $edx killed $edx killed $rdx
	callq	_memcpy
	xorl	%ebx, %ebx
LBB0_18:
	movl	8(%r12), %edi
	callq	_LOCK_GIVE
LBB0_19:
	movl	%ebx, %eax
	addq	$24, %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 read to %u that has wlen too large (desired=%u limit=%u)"

	.comm	_ENOTSUPP,4,2                   ## @ENOTSUPP
L_.str.1:                               ## @.str.1
	.asciz	"Killing an I2C read to %u that has rlen too large (desired=%u limit=%u)"

	.comm	_FX2CMD_I2C_READ,4,2            ## @FX2CMD_I2C_READ
	.comm	_EIO,4,2                        ## @EIO
L_.str.2:                               ## @.str.2
	.asciz	"unexpected status from i2_read[%d]: %d"

	.no_dead_strip	_pvr2_i2c_read
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function pvr2_i2c_read
_pvr2_i2c_read:                         ; @pvr2_i2c_read
	.cfi_startproc
; %bb.0:
	stp	x24, x23, [sp, #-64]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 64
	stp	x22, x21, [sp, #16]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #32]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #48]             ; 16-byte Folded Spill
	add	x29, sp, #48
	.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
	.cfi_offset w23, -56
	.cfi_offset w24, -64
	mov	x22, x1
	cmp	x2, #0
	csel	w23, wzr, w3, eq
	cmp	w23, #5
	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, x22
	mov	x3, x23
	mov	w4, #4
	b	LBB0_5
LBB0_2:
	mov	x20, x5
	mov	x21, x4
	mov	x24, x2
	mov	x19, x0
	cbz	x4, LBB0_6
; %bb.3:
	cmp	w20, #8
	b.lo	LBB0_6
; %bb.4:
Lloh5:
	adrp	x8, _PVR2_TRACE_ERROR_LEGS@GOTPAGE
Lloh6:
	ldr	x8, [x8, _PVR2_TRACE_ERROR_LEGS@GOTPAGEOFF]
Lloh7:
	ldr	w0, [x8]
Lloh8:
	adrp	x1, l_.str.1@PAGE
Lloh9:
	add	x1, x1, l_.str.1@PAGEOFF
	mov	x2, x22
	mov	x3, x20
	mov	w4, #7
LBB0_5:
	bl	_pvr2_trace
Lloh10:
	adrp	x8, _ENOTSUPP@GOTPAGE
Lloh11:
	ldr	x8, [x8, _ENOTSUPP@GOTPAGEOFF]
Lloh12:
	ldr	w8, [x8]
	neg	w23, w8
	b	LBB0_21
LBB0_6:
	ldr	w0, [x19, #8]
	bl	_LOCK_TAKE
	ldr	x0, [x19]
	mov	w1, #0
	mov	w2, #8
	bl	_memset
Lloh13:
	adrp	x8, _FX2CMD_I2C_READ@GOTPAGE
Lloh14:
	ldr	x8, [x8, _FX2CMD_I2C_READ@GOTPAGEOFF]
Lloh15:
	ldr	w8, [x8]
	ldr	x1, [x19]
	stp	w8, w23, [x1]
	stp	w20, w22, [x1, #8]
	cbz	w23, LBB0_8
; %bb.7:
	add	x0, x1, #16
	mov	x1, x24
	mov	x2, x23
	bl	_memcpy
	ldr	x1, [x19]
LBB0_8:
	add	w2, w23, #4
	add	w4, w20, #1
	mov	x0, x19
	mov	x3, x1
	bl	_pvr2_send_request
	mov	x23, x0
	cbz	w0, LBB0_13
LBB0_9:
	cbz	x21, LBB0_20
; %bb.10:
	cbz	w20, LBB0_20
; %bb.11:
	cbz	w23, LBB0_18
; %bb.12:
	mov	x0, x21
	mov	w1, #0
	mov	x2, x20
	bl	_memset
	b	LBB0_20
LBB0_13:
	ldr	x8, [x19]
	ldr	w2, [x8]
	cmp	w2, #8
	b.ne	LBB0_16
; %bb.14:
	mov	w23, #0
	cbz	x21, LBB0_20
; %bb.15:
	cbnz	w20, LBB0_19
	b	LBB0_20
LBB0_16:
Lloh16:
	adrp	x8, _EIO@GOTPAGE
Lloh17:
	ldr	x8, [x8, _EIO@GOTPAGEOFF]
Lloh18:
	ldr	w8, [x8]
	neg	w23, w8
	cmp	w2, #7
	b.eq	LBB0_9
; %bb.17:
Lloh19:
	adrp	x0, l_.str.2@PAGE
Lloh20:
	add	x0, x0, l_.str.2@PAGEOFF
	mov	x1, x22
	bl	_trace_i2c
	b	LBB0_9
LBB0_18:
	ldr	x8, [x19]
LBB0_19:
	add	x1, x8, #4
	mov	x0, x21
	mov	x2, x20
	bl	_memcpy
	mov	w23, #0
LBB0_20:
	ldr	w0, [x19, #8]
	bl	_LOCK_GIVE
LBB0_21:
	mov	x0, x23
	ldp	x29, x30, [sp, #48]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #32]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #16]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp], #64             ; 16-byte Folded Reload
	ret
	.loh AdrpAdd	Lloh3, Lloh4
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpAdd	Lloh8, Lloh9
	.loh AdrpLdrGotLdr	Lloh5, Lloh6, Lloh7
	.loh AdrpLdrGotLdr	Lloh10, Lloh11, Lloh12
	.loh AdrpLdrGotLdr	Lloh13, Lloh14, Lloh15
	.loh AdrpLdrGotLdr	Lloh16, Lloh17, Lloh18
	.loh AdrpAdd	Lloh19, Lloh20
	.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 read to %u that has wlen too large (desired=%u limit=%u)"

	.comm	_ENOTSUPP,4,2                   ; @ENOTSUPP
l_.str.1:                               ; @.str.1
	.asciz	"Killing an I2C read to %u that has rlen too large (desired=%u limit=%u)"

	.comm	_FX2CMD_I2C_READ,4,2            ; @FX2CMD_I2C_READ
	.comm	_EIO,4,2                        ; @EIO
l_.str.2:                               ; @.str.2
	.asciz	"unexpected status from i2_read[%d]: %d"

	.no_dead_strip	_pvr2_i2c_read
.subsections_via_symbols
