	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function pvr2_ioread_filter
_pvr2_ioread_filter:                    ## @pvr2_ioread_filter
	.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	%rbx
	pushq	%rax
	.cfi_offset %rbx, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	cmpl	$0, 56(%rdi)
	je	LBB0_19
## %bb.1:
	movq	%rdi, %r15
	cmpl	$1, (%rdi)
	jne	LBB0_19
## %bb.2:
	leaq	52(%r15), %r14
	movq	%r14, %rdi
	callq	_mutex_lock
	.p2align	4, 0x90
LBB0_3:                                 ## =>This Loop Header: Depth=1
                                        ##     Child Loop BB0_8 Depth 2
	movq	%r15, %rdi
	callq	_pvr2_ioread_get_buffer
	testl	%eax, %eax
	je	LBB0_18
## %bb.4:                               ##   in Loop: Header=BB0_3 Depth=1
	movl	4(%r15), %edx
	testq	%rdx, %rdx
	je	LBB0_18
## %bb.5:                               ##   in Loop: Header=BB0_3 Depth=1
	movl	8(%r15), %ecx
	cmpl	%edx, %ecx
	jae	LBB0_6
## %bb.7:                               ##   in Loop: Header=BB0_3 Depth=1
	movq	16(%r15), %rdi
	movq	24(%r15), %r8
	movq	%rcx, %rax
	jmp	LBB0_8
	.p2align	4, 0x90
LBB0_11:                                ##   in Loop: Header=BB0_8 Depth=2
	xorl	%edi, %edi
LBB0_12:                                ##   in Loop: Header=BB0_8 Depth=2
	movq	%rdi, 16(%r15)
	incq	%rax
	cmpq	%rax, %rdx
	je	LBB0_13
LBB0_8:                                 ##   Parent Loop BB0_3 Depth=1
                                        ## =>  This Inner Loop Header: Depth=2
	cmpq	%r8, %rdi
	jae	LBB0_14
## %bb.9:                               ##   in Loop: Header=BB0_8 Depth=2
	movq	32(%r15), %rsi
	movq	40(%r15), %rbx
	movq	(%rsi,%rax,8), %rsi
	cmpq	(%rbx,%rdi,8), %rsi
	jne	LBB0_11
## %bb.10:                              ##   in Loop: Header=BB0_8 Depth=2
	incq	%rdi
	jmp	LBB0_12
	.p2align	4, 0x90
LBB0_6:                                 ##   in Loop: Header=BB0_3 Depth=1
	movq	16(%r15), %rdi
	movq	24(%r15), %r8
	movl	%ecx, %eax
	jmp	LBB0_14
	.p2align	4, 0x90
LBB0_13:                                ##   in Loop: Header=BB0_3 Depth=1
	movl	%edx, %eax
LBB0_14:                                ##   in Loop: Header=BB0_3 Depth=1
	addl	%eax, %ecx
	movl	%ecx, 8(%r15)
	addl	48(%r15), %eax
	movl	%eax, 48(%r15)
	cmpq	%r8, %rdi
	jae	LBB0_15
## %bb.16:                              ##   in Loop: Header=BB0_3 Depth=1
	cmpl	%edx, %ecx
	jae	LBB0_3
## %bb.17:
	movq	_PVR2_TRACE_ERROR_LEGS@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	leaq	L_.str.1(%rip), %rsi
                                        ## kill: def $edx killed $edx killed $rdx
                                        ## kill: def $ecx killed $ecx killed $rcx
	xorl	%eax, %eax
	callq	_pvr2_trace
	jmp	LBB0_18
LBB0_19:
	addq	$8, %rsp
	popq	%rbx
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_15:
	subl	%r8d, %eax
	movl	%eax, 48(%r15)
	movq	_PVR2_TRACE_DATA_FLOW@GOTPCREL(%rip), %rcx
	movl	(%rcx), %edi
	leaq	L_.str(%rip), %rsi
	movl	%eax, %edx
	xorl	%eax, %eax
	callq	_pvr2_trace
	movl	$2, (%r15)
	movq	$0, 16(%r15)
LBB0_18:
	movq	%r14, %rdi
	addq	$8, %rsp
	popq	%rbx
	popq	%r14
	popq	%r15
	popq	%rbp
	jmp	_mutex_unlock                   ## TAILCALL
	.cfi_endproc
                                        ## -- End function
	.comm	_PVR2_TRACE_DATA_FLOW,4,2       ## @PVR2_TRACE_DATA_FLOW
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"/*---TRACE_READ---*/ sync_state <== 2 (skipped %u bytes)"

	.comm	_PVR2_TRACE_ERROR_LEGS,4,2      ## @PVR2_TRACE_ERROR_LEGS
L_.str.1:                               ## @.str.1
	.asciz	"ERROR: pvr2_ioread filter sync problem len=%u offs=%u"

	.no_dead_strip	_pvr2_ioread_filter
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function pvr2_ioread_filter
_pvr2_ioread_filter:                    ; @pvr2_ioread_filter
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #48
	.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
	ldr	w8, [x0, #56]
	cbz	w8, LBB0_14
; %bb.1:
	mov	x20, x0
	ldr	w8, [x0]
	cmp	w8, #1
	b.ne	LBB0_14
; %bb.2:
	add	x19, x20, #52
	mov	x0, x19
	bl	_mutex_lock
LBB0_3:                                 ; =>This Loop Header: Depth=1
                                        ;     Child Loop BB0_7 Depth 2
	mov	x0, x20
	bl	_pvr2_ioread_get_buffer
	cbz	w0, LBB0_16
; %bb.4:                                ;   in Loop: Header=BB0_3 Depth=1
	ldr	w2, [x20, #4]
	cbz	w2, LBB0_16
; %bb.5:                                ;   in Loop: Header=BB0_3 Depth=1
	ldr	w8, [x20, #8]
	cmp	w8, w2
	b.hs	LBB0_10
; %bb.6:                                ;   in Loop: Header=BB0_3 Depth=1
	ldp	x10, x9, [x20, #16]
	mov	x11, x8
LBB0_7:                                 ;   Parent Loop BB0_3 Depth=1
                                        ; =>  This Inner Loop Header: Depth=2
	cmp	x10, x9
	b.hs	LBB0_11
; %bb.8:                                ;   in Loop: Header=BB0_7 Depth=2
	ldp	x12, x13, [x20, #32]
	ldr	x12, [x12, x11, lsl #3]
	ldr	x13, [x13, x10, lsl #3]
	cmp	x12, x13
	csinc	x10, xzr, x10, ne
	str	x10, [x20, #16]
	add	x11, x11, #1
	cmp	x2, x11
	b.ne	LBB0_7
; %bb.9:                                ;   in Loop: Header=BB0_3 Depth=1
	mov	x11, x2
	b	LBB0_11
LBB0_10:                                ;   in Loop: Header=BB0_3 Depth=1
	ldp	x10, x9, [x20, #16]
	mov	x11, x8
LBB0_11:                                ;   in Loop: Header=BB0_3 Depth=1
	add	w8, w11, w8
	str	w8, [x20, #8]
	ldr	w12, [x20, #48]
	add	w11, w12, w11
	str	w11, [x20, #48]
	cmp	x10, x9
	b.hs	LBB0_15
; %bb.12:                               ;   in Loop: Header=BB0_3 Depth=1
	cmp	w8, w2
	b.hs	LBB0_3
; %bb.13:
Lloh0:
	adrp	x9, _PVR2_TRACE_ERROR_LEGS@GOTPAGE
Lloh1:
	ldr	x9, [x9, _PVR2_TRACE_ERROR_LEGS@GOTPAGEOFF]
Lloh2:
	ldr	w0, [x9]
	str	x8, [sp]
Lloh3:
	adrp	x1, l_.str.1@PAGE
Lloh4:
	add	x1, x1, l_.str.1@PAGEOFF
                                        ; kill: def $w2 killed $w2 killed $x2
	bl	_pvr2_trace
	b	LBB0_16
LBB0_14:
	ldp	x29, x30, [sp, #32]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #16]             ; 16-byte Folded Reload
	add	sp, sp, #48
	ret
LBB0_15:
	sub	w2, w11, w9
	str	w2, [x20, #48]
Lloh5:
	adrp	x8, _PVR2_TRACE_DATA_FLOW@GOTPAGE
Lloh6:
	ldr	x8, [x8, _PVR2_TRACE_DATA_FLOW@GOTPAGEOFF]
Lloh7:
	ldr	w0, [x8]
Lloh8:
	adrp	x1, l_.str@PAGE
Lloh9:
	add	x1, x1, l_.str@PAGEOFF
	bl	_pvr2_trace
	mov	w8, #2
	str	w8, [x20]
	str	xzr, [x20, #16]
LBB0_16:
	mov	x0, x19
	ldp	x29, x30, [sp, #32]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #16]             ; 16-byte Folded Reload
	add	sp, sp, #48
	b	_mutex_unlock
	.loh AdrpAdd	Lloh3, Lloh4
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpAdd	Lloh8, Lloh9
	.loh AdrpLdrGotLdr	Lloh5, Lloh6, Lloh7
	.cfi_endproc
                                        ; -- End function
	.comm	_PVR2_TRACE_DATA_FLOW,4,2       ; @PVR2_TRACE_DATA_FLOW
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"/*---TRACE_READ---*/ sync_state <== 2 (skipped %u bytes)"

	.comm	_PVR2_TRACE_ERROR_LEGS,4,2      ; @PVR2_TRACE_ERROR_LEGS
l_.str.1:                               ; @.str.1
	.asciz	"ERROR: pvr2_ioread filter sync problem len=%u offs=%u"

	.no_dead_strip	_pvr2_ioread_filter
.subsections_via_symbols
