	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_pvr2_ioread_avail              ## -- Begin function pvr2_ioread_avail
	.p2align	4, 0x90
_pvr2_ioread_avail:                     ## @pvr2_ioread_avail
	.cfi_startproc
## %bb.0:
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset %rbp, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register %rbp
	pushq	%r14
	pushq	%rbx
	.cfi_offset %rbx, -32
	.cfi_offset %r14, -24
	cmpl	$0, 24(%rdi)
	je	LBB0_1
## %bb.3:
	movq	%rdi, %rbx
	cmpl	$1, (%rdi)
	jne	LBB0_6
## %bb.4:
	movq	%rbx, %rdi
	callq	_pvr2_ioread_filter
	cmpl	$1, (%rbx)
	jne	LBB0_6
## %bb.5:
	movq	_EAGAIN@GOTPCREL(%rip), %rax
	jmp	LBB0_2
LBB0_6:
	movq	16(%rbx), %r14
	movl	8(%rbx), %edi
	callq	_pvr2_stream_get_ready_count
	testq	%r14, %r14
	je	LBB0_11
## %bb.7:
	testl	%eax, %eax
	je	LBB0_8
LBB0_12:
	xorl	%r14d, %r14d
	cmpl	$0, 4(%rbx)
	jne	LBB0_16
## %bb.13:
	movl	$1, 4(%rbx)
	movq	_PVR2_TRACE_DATA_FLOW@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	jmp	LBB0_14
LBB0_1:
	movq	_EIO@GOTPCREL(%rip), %rax
LBB0_2:
	xorl	%r14d, %r14d
	subl	(%rax), %r14d
	jmp	LBB0_16
LBB0_11:
	movq	_BUFFER_COUNT@GOTPCREL(%rip), %rcx
	movl	(%rcx), %ecx
	movl	%ecx, %edx
	shrl	$31, %edx
	addl	%ecx, %edx
	sarl	%edx
	cmpl	%edx, %eax
	jge	LBB0_12
LBB0_8:
	movq	_EAGAIN@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movl	%eax, %r14d
	negl	%r14d
	cmpl	$0, 4(%rbx)
	sete	%cl
	testl	%eax, %eax
	sete	%dl
	xorb	%cl, %dl
	jne	LBB0_16
## %bb.9:
	xorl	%ecx, %ecx
	testl	%eax, %eax
	sete	%cl
	movl	%ecx, 4(%rbx)
	movq	_PVR2_TRACE_DATA_FLOW@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	je	LBB0_14
## %bb.10:
	leaq	L_.str.2(%rip), %rdx
	jmp	LBB0_15
LBB0_14:
	leaq	L_.str.1(%rip), %rdx
	xorl	%r14d, %r14d
LBB0_15:
	leaq	L_.str(%rip), %rsi
	callq	_pvr2_trace
LBB0_16:
	movl	%r14d, %eax
	popq	%rbx
	popq	%r14
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_EIO,4,2                        ## @EIO
	.comm	_EAGAIN,4,2                     ## @EAGAIN
	.comm	_BUFFER_COUNT,4,2               ## @BUFFER_COUNT
	.comm	_PVR2_TRACE_DATA_FLOW,4,2       ## @PVR2_TRACE_DATA_FLOW
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"/*---TRACE_READ---*/ data is %s"

L_.str.1:                               ## @.str.1
	.asciz	"available"

L_.str.2:                               ## @.str.2
	.asciz	"pending"

.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_pvr2_ioread_avail              ; -- Begin function pvr2_ioread_avail
	.p2align	2
_pvr2_ioread_avail:                     ; @pvr2_ioread_avail
	.cfi_startproc
; %bb.0:
	stp	x20, x19, [sp, #-32]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 32
	stp	x29, x30, [sp, #16]             ; 16-byte Folded Spill
	add	x29, sp, #16
	.cfi_def_cfa w29, 16
	.cfi_offset w30, -8
	.cfi_offset w29, -16
	.cfi_offset w19, -24
	.cfi_offset w20, -32
	ldr	w8, [x0, #24]
	cbz	w8, LBB0_8
; %bb.1:
	mov	x19, x0
	ldr	w8, [x0]
	cmp	w8, #1
	b.ne	LBB0_4
; %bb.2:
	mov	x0, x19
	bl	_pvr2_ioread_filter
	ldr	w8, [x19]
	cmp	w8, #1
	b.ne	LBB0_4
; %bb.3:
Lloh0:
	adrp	x8, _EAGAIN@GOTPAGE
Lloh1:
	ldr	x8, [x8, _EAGAIN@GOTPAGEOFF]
	b	LBB0_9
LBB0_4:
	ldr	x20, [x19, #16]
	ldr	w0, [x19, #8]
	bl	_pvr2_stream_get_ready_count
	cbz	x20, LBB0_10
; %bb.5:
	cbz	w0, LBB0_11
LBB0_6:
	ldr	w8, [x19, #4]
	cbz	w8, LBB0_14
; %bb.7:
	mov	w20, #0
	b	LBB0_17
LBB0_8:
Lloh2:
	adrp	x8, _EIO@GOTPAGE
Lloh3:
	ldr	x8, [x8, _EIO@GOTPAGEOFF]
LBB0_9:
	ldr	w8, [x8]
	neg	w20, w8
	b	LBB0_17
LBB0_10:
Lloh4:
	adrp	x8, _BUFFER_COUNT@GOTPAGE
Lloh5:
	ldr	x8, [x8, _BUFFER_COUNT@GOTPAGEOFF]
Lloh6:
	ldr	w8, [x8]
	cmp	w8, #0
	cinc	w8, w8, lt
	cmp	w0, w8, asr #1
	b.ge	LBB0_6
LBB0_11:
Lloh7:
	adrp	x8, _EAGAIN@GOTPAGE
Lloh8:
	ldr	x8, [x8, _EAGAIN@GOTPAGEOFF]
Lloh9:
	ldr	w8, [x8]
	neg	w20, w8
	ldr	w9, [x19, #4]
	cmp	w9, #0
	cset	w10, eq
	cmp	w8, #0
	cset	w9, eq
	eor	w10, w9, w10
	tbnz	w10, #0, LBB0_17
; %bb.12:
	str	w9, [x19, #4]
Lloh10:
	adrp	x9, _PVR2_TRACE_DATA_FLOW@GOTPAGE
Lloh11:
	ldr	x9, [x9, _PVR2_TRACE_DATA_FLOW@GOTPAGEOFF]
Lloh12:
	ldr	w0, [x9]
	cbz	w8, LBB0_15
; %bb.13:
Lloh13:
	adrp	x2, l_.str.2@PAGE
Lloh14:
	add	x2, x2, l_.str.2@PAGEOFF
	b	LBB0_16
LBB0_14:
	mov	w8, #1
	str	w8, [x19, #4]
Lloh15:
	adrp	x8, _PVR2_TRACE_DATA_FLOW@GOTPAGE
Lloh16:
	ldr	x8, [x8, _PVR2_TRACE_DATA_FLOW@GOTPAGEOFF]
Lloh17:
	ldr	w0, [x8]
LBB0_15:
	mov	w20, #0
Lloh18:
	adrp	x2, l_.str.1@PAGE
Lloh19:
	add	x2, x2, l_.str.1@PAGEOFF
LBB0_16:
Lloh20:
	adrp	x1, l_.str@PAGE
Lloh21:
	add	x1, x1, l_.str@PAGEOFF
	bl	_pvr2_trace
LBB0_17:
	mov	x0, x20
	ldp	x29, x30, [sp, #16]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp], #32             ; 16-byte Folded Reload
	ret
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpLdrGot	Lloh2, Lloh3
	.loh AdrpLdrGotLdr	Lloh4, Lloh5, Lloh6
	.loh AdrpLdrGotLdr	Lloh7, Lloh8, Lloh9
	.loh AdrpLdrGotLdr	Lloh10, Lloh11, Lloh12
	.loh AdrpAdd	Lloh13, Lloh14
	.loh AdrpLdrGotLdr	Lloh15, Lloh16, Lloh17
	.loh AdrpAdd	Lloh18, Lloh19
	.loh AdrpAdd	Lloh20, Lloh21
	.cfi_endproc
                                        ; -- End function
	.comm	_EIO,4,2                        ; @EIO
	.comm	_EAGAIN,4,2                     ; @EAGAIN
	.comm	_BUFFER_COUNT,4,2               ; @BUFFER_COUNT
	.comm	_PVR2_TRACE_DATA_FLOW,4,2       ; @PVR2_TRACE_DATA_FLOW
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"/*---TRACE_READ---*/ data is %s"

l_.str.1:                               ; @.str.1
	.asciz	"available"

l_.str.2:                               ; @.str.2
	.asciz	"pending"

.subsections_via_symbols
