	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_pvr2_ioread_setup              ## -- Begin function pvr2_ioread_setup
	.p2align	4, 0x90
_pvr2_ioread_setup:                     ## @pvr2_ioread_setup
	.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
	movq	%rsi, %r14
	movq	%rdi, %r12
	callq	_mutex_lock
	cmpq	$0, 8(%r12)
	je	LBB0_4
## %bb.1:
	movq	_PVR2_TRACE_START_STOP@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	leaq	L_.str(%rip), %rsi
	movq	%r12, %rdx
	callq	_pvr2_trace
	movq	%r12, %rdi
	callq	_pvr2_ioread_stop
	movq	8(%r12), %rdi
	callq	_pvr2_stream_kill
	movq	8(%r12), %rdi
	callq	_pvr2_stream_get_buffer_count
	testq	%rax, %rax
	je	LBB0_3
## %bb.2:
	movq	8(%r12), %rdi
	xorl	%esi, %esi
	callq	_pvr2_stream_set_buffer_count
LBB0_3:
	movq	$0, 8(%r12)
LBB0_4:
	xorl	%ebx, %ebx
	testq	%r14, %r14
	je	LBB0_11
## %bb.5:
	movq	_PVR2_TRACE_START_STOP@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	leaq	L_.str.1(%rip), %rsi
	movq	%r12, %rdx
	callq	_pvr2_trace
	movq	%r14, %rdi
	callq	_pvr2_stream_kill
	movq	_BUFFER_COUNT@GOTPCREL(%rip), %r13
	movl	(%r13), %esi
	movq	%r14, %rdi
	callq	_pvr2_stream_set_buffer_count
	testl	%eax, %eax
	js	LBB0_6
## %bb.7:
	cmpl	$0, (%r13)
	je	LBB0_10
## %bb.8:
	xorl	%ebx, %ebx
	movq	_BUFFER_SIZE@GOTPCREL(%rip), %r15
	.p2align	4, 0x90
LBB0_9:                                 ## =>This Inner Loop Header: Depth=1
	movq	%r14, %rdi
	movl	%ebx, %esi
	callq	_pvr2_stream_get_buffer
	movq	16(%r12), %rcx
	movl	(%rcx,%rbx,4), %esi
	movl	(%r15), %edx
	movq	%rax, %rdi
	callq	_pvr2_buffer_set_buffer
	incq	%rbx
	movl	(%r13), %eax
	cmpq	%rax, %rbx
	jb	LBB0_9
LBB0_10:
	movq	%r14, 8(%r12)
	xorl	%ebx, %ebx
	jmp	LBB0_11
LBB0_6:
	movl	%eax, %ebx
LBB0_11:
	movq	%r12, %rdi
	callq	_mutex_unlock
	movl	%ebx, %eax
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_PVR2_TRACE_START_STOP,4,2      ## @PVR2_TRACE_START_STOP
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"/*---TRACE_READ---*/ pvr2_ioread_setup (tear-down) id=%p"

L_.str.1:                               ## @.str.1
	.asciz	"/*---TRACE_READ---*/ pvr2_ioread_setup (setup) id=%p"

	.comm	_BUFFER_COUNT,4,2               ## @BUFFER_COUNT
	.comm	_BUFFER_SIZE,4,2                ## @BUFFER_SIZE
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_pvr2_ioread_setup              ; -- Begin function pvr2_ioread_setup
	.p2align	2
_pvr2_ioread_setup:                     ; @pvr2_ioread_setup
	.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	x20, x1
	mov	x19, x0
	bl	_mutex_lock
	ldr	x8, [x19, #8]
Lloh0:
	adrp	x21, _PVR2_TRACE_START_STOP@GOTPAGE
Lloh1:
	ldr	x21, [x21, _PVR2_TRACE_START_STOP@GOTPAGEOFF]
	cbz	x8, LBB0_4
; %bb.1:
	ldr	w0, [x21]
Lloh2:
	adrp	x1, l_.str@PAGE
Lloh3:
	add	x1, x1, l_.str@PAGEOFF
	mov	x2, x19
	bl	_pvr2_trace
	mov	x0, x19
	bl	_pvr2_ioread_stop
	ldr	x0, [x19, #8]
	bl	_pvr2_stream_kill
	ldr	x0, [x19, #8]
	bl	_pvr2_stream_get_buffer_count
	cbz	x0, LBB0_3
; %bb.2:
	ldr	x0, [x19, #8]
	mov	w1, #0
	bl	_pvr2_stream_set_buffer_count
LBB0_3:
	str	xzr, [x19, #8]
LBB0_4:
	cbz	x20, LBB0_10
; %bb.5:
	ldr	w0, [x21]
Lloh4:
	adrp	x1, l_.str.1@PAGE
Lloh5:
	add	x1, x1, l_.str.1@PAGEOFF
	mov	x2, x19
	bl	_pvr2_trace
	mov	x0, x20
	bl	_pvr2_stream_kill
Lloh6:
	adrp	x22, _BUFFER_COUNT@GOTPAGE
Lloh7:
	ldr	x22, [x22, _BUFFER_COUNT@GOTPAGEOFF]
	ldr	w1, [x22]
	mov	x0, x20
	bl	_pvr2_stream_set_buffer_count
	tbnz	w0, #31, LBB0_11
; %bb.6:
	ldr	w8, [x22]
	cbz	w8, LBB0_9
; %bb.7:
	mov	x21, #0
Lloh8:
	adrp	x23, _BUFFER_SIZE@GOTPAGE
Lloh9:
	ldr	x23, [x23, _BUFFER_SIZE@GOTPAGEOFF]
LBB0_8:                                 ; =>This Inner Loop Header: Depth=1
	mov	x0, x20
	mov	x1, x21
	bl	_pvr2_stream_get_buffer
	ldr	x8, [x19, #16]
	ldr	w1, [x8, x21, lsl #2]
	ldr	w2, [x23]
	bl	_pvr2_buffer_set_buffer
	add	x21, x21, #1
	ldr	w8, [x22]
	cmp	x21, x8
	b.lo	LBB0_8
LBB0_9:
	mov	w21, #0
	str	x20, [x19, #8]
	b	LBB0_12
LBB0_10:
	mov	w21, #0
	b	LBB0_12
LBB0_11:
	mov	x21, x0
LBB0_12:
	mov	x0, x19
	bl	_mutex_unlock
	mov	x0, x21
	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 AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpAdd	Lloh2, Lloh3
	.loh AdrpLdrGot	Lloh6, Lloh7
	.loh AdrpAdd	Lloh4, Lloh5
	.loh AdrpLdrGot	Lloh8, Lloh9
	.cfi_endproc
                                        ; -- End function
	.comm	_PVR2_TRACE_START_STOP,4,2      ; @PVR2_TRACE_START_STOP
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"/*---TRACE_READ---*/ pvr2_ioread_setup (tear-down) id=%p"

l_.str.1:                               ; @.str.1
	.asciz	"/*---TRACE_READ---*/ pvr2_ioread_setup (setup) id=%p"

	.comm	_BUFFER_COUNT,4,2               ; @BUFFER_COUNT
	.comm	_BUFFER_SIZE,4,2                ; @BUFFER_SIZE
.subsections_via_symbols
