	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function cpia_usb_streamRead
_cpia_usb_streamRead:                   ## @cpia_usb_streamRead
	.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	%r12
	pushq	%rbx
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movl	$-1, %r15d
	testq	%rdi, %rdi
	je	LBB0_10
## %bb.1:
	movq	%rdi, %rbx
	cmpl	$0, 12(%rdi)
	je	LBB0_10
## %bb.2:
	movq	%rsi, %r14
	movq	(%rbx), %rax
	movq	(%rax), %rax
	movq	_FRAME_READY@GOTPCREL(%rip), %r12
	cmpq	(%r12), %rax
	jne	LBB0_3
## %bb.4:
	leaq	L_.str(%rip), %rdi
	callq	_DBG
	jmp	LBB0_5
LBB0_3:
	leaq	8(%rbx), %rdi
	callq	_interruptible_sleep_on
LBB0_5:
	movq	(%rbx), %rbx
	testq	%rbx, %rbx
	je	LBB0_10
## %bb.6:
	movq	(%rbx), %rax
	cmpq	(%r12), %rax
	jne	LBB0_8
## %bb.7:
	movl	8(%rbx), %edx
	cmpl	$3, %edx
	jg	LBB0_9
LBB0_8:
	leaq	L_.str.1(%rip), %rdi
	callq	_DBG
	jmp	LBB0_10
LBB0_9:
	movl	12(%rbx), %esi
	movq	%r14, %rdi
	callq	_memcpy
	movq	_FRAME_EMPTY@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	movq	%rax, (%rbx)
	movl	8(%rbx), %r15d
LBB0_10:
	movl	%r15d, %eax
	popq	%rbx
	popq	%r12
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_FRAME_READY,8,3                ## @FRAME_READY
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"Frame already waiting!\n"

L_.str.1:                               ## @.str.1
	.asciz	"Something went wrong!\n"

	.comm	_FRAME_EMPTY,8,3                ## @FRAME_EMPTY
	.no_dead_strip	_cpia_usb_streamRead
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function cpia_usb_streamRead
_cpia_usb_streamRead:                   ; @cpia_usb_streamRead
	.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
	cbz	x0, LBB0_8
; %bb.1:
	mov	x20, x0
	ldr	w8, [x0, #12]
	cbz	w8, LBB0_8
; %bb.2:
	mov	x19, x1
	ldr	x8, [x20]
	ldr	x8, [x8]
Lloh0:
	adrp	x21, _FRAME_READY@GOTPAGE
Lloh1:
	ldr	x21, [x21, _FRAME_READY@GOTPAGEOFF]
	ldr	x9, [x21]
	cmp	x8, x9
	b.ne	LBB0_4
; %bb.3:
Lloh2:
	adrp	x0, l_.str@PAGE
Lloh3:
	add	x0, x0, l_.str@PAGEOFF
	bl	_DBG
	ldr	x20, [x20]
	cbnz	x20, LBB0_5
	b	LBB0_8
LBB0_4:
	add	x0, x20, #8
	bl	_interruptible_sleep_on
	ldr	x20, [x20]
	cbz	x20, LBB0_8
LBB0_5:
	ldr	x8, [x20]
	ldr	x9, [x21]
	cmp	x8, x9
	b.ne	LBB0_7
; %bb.6:
	ldr	w2, [x20, #8]
	cmp	w2, #3
	b.gt	LBB0_10
LBB0_7:
Lloh4:
	adrp	x0, l_.str.1@PAGE
Lloh5:
	add	x0, x0, l_.str.1@PAGEOFF
	bl	_DBG
LBB0_8:
	mov	w0, #-1
LBB0_9:
	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
LBB0_10:
	ldr	w1, [x20, #12]
	mov	x0, x19
	bl	_memcpy
Lloh6:
	adrp	x8, _FRAME_EMPTY@GOTPAGE
Lloh7:
	ldr	x8, [x8, _FRAME_EMPTY@GOTPAGEOFF]
Lloh8:
	ldr	x8, [x8]
	str	x8, [x20]
	ldr	w0, [x20, #8]
	b	LBB0_9
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpAdd	Lloh2, Lloh3
	.loh AdrpAdd	Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh6, Lloh7, Lloh8
	.cfi_endproc
                                        ; -- End function
	.comm	_FRAME_READY,8,3                ; @FRAME_READY
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"Frame already waiting!\n"

l_.str.1:                               ; @.str.1
	.asciz	"Something went wrong!\n"

	.comm	_FRAME_EMPTY,8,3                ; @FRAME_EMPTY
	.no_dead_strip	_cpia_usb_streamRead
.subsections_via_symbols
