	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function usbvision_find_header
_usbvision_find_header:                 ## @usbvision_find_header
	.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	%rdi, %r12
	movq	24(%rdi), %rbx
	leaq	32(%rbx), %rax
	movq	%rax, -48(%rbp)                 ## 8-byte Spill
	.p2align	4, 0x90
LBB0_1:                                 ## =>This Inner Loop Header: Depth=1
	movq	%r12, %rdi
	movq	-48(%rbp), %rsi                 ## 8-byte Reload
	callq	_scratch_get_header
	movq	_DBG_HEADER@GOTPCREL(%rip), %rcx
	movl	(%rcx), %edi
	movq	_USBVISION_HEADER_LENGTH@GOTPCREL(%rip), %rcx
	cmpq	(%rcx), %rax
	jne	LBB0_13
## %bb.2:                               ##   in Loop: Header=BB0_1 Depth=1
	movl	76(%rbx), %edx
	movl	72(%rbx), %ecx
	movl	68(%rbx), %r8d
	movl	32(%rbx), %r9d
	movl	64(%rbx), %r10d
	movl	60(%rbx), %r11d
	movl	48(%rbx), %r13d
	movl	52(%rbx), %r15d
	movl	56(%rbx), %r14d
	leaq	L_.str(%rip), %rsi
	xorl	%eax, %eax
	pushq	%r14
	pushq	%r15
	pushq	%r13
	pushq	40(%rbx)
	pushq	%r11
	pushq	%r10
	callq	_PDEBUG
	addq	$48, %rsp
	cmpq	$0, 16(%r12)
	je	LBB0_5
## %bb.3:                               ##   in Loop: Header=BB0_1 Depth=1
	testb	$-128, 48(%rbx)
	je	LBB0_1
## %bb.4:
	movl	$-1, (%r12)
	movq	%r12, %rdi
	callq	_usbvision_unrequest_intra
LBB0_5:
	movl	4(%r12), %eax
	imull	52(%rbx), %eax
	movl	%eax, (%rbx)
	movl	8(%r12), %ecx
	imull	56(%rbx), %ecx
	movl	%ecx, 4(%rbx)
	imull	80(%rbx), %eax
	sarl	$3, %eax
	movl	%eax, 8(%rbx)
	movq	40(%rbx), %rax
	movq	_ISOC_MODE_COMPRESS@GOTPCREL(%rip), %rcx
	cmpq	(%rcx), %rax
	jne	LBB0_9
## %bb.6:
	movl	(%r12), %eax
	testl	%eax, %eax
	js	LBB0_7
## %bb.10:
	incl	%eax
	andl	$31, %eax
	movq	-48(%rbp), %rcx                 ## 8-byte Reload
	movl	(%rcx), %edx
	cmpl	%edx, %eax
	je	LBB0_8
## %bb.11:
	movq	_DBG_HEADER@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	leaq	L_.str.2(%rip), %rsi
	xorl	%eax, %eax
	callq	_PDEBUG
	movq	%r12, %rdi
	callq	_usbvision_request_intra
	movq	_parse_state_next_frame@GOTPCREL(%rip), %rax
	jmp	LBB0_12
LBB0_13:
	leaq	L_.str.1(%rip), %rsi
	xorl	%eax, %eax
	callq	_PDEBUG
	movq	%r12, %rdi
	callq	_scratch_reset
	movq	_parse_state_end_parse@GOTPCREL(%rip), %rax
	jmp	LBB0_12
LBB0_7:
	movq	-48(%rbp), %rax                 ## 8-byte Reload
	movl	(%rax), %eax
LBB0_8:
	movl	%eax, (%r12)
LBB0_9:
	incl	12(%r12)
	movq	_scan_state_lines@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movl	%eax, 24(%rbx)
	movq	$0, 16(%rbx)
	movq	_parse_state_continue@GOTPCREL(%rip), %rax
LBB0_12:
	movl	(%rax), %eax
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_USBVISION_HEADER_LENGTH,8,3    ## @USBVISION_HEADER_LENGTH
	.comm	_DBG_HEADER,4,2                 ## @DBG_HEADER
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"found header: 0x%02x%02x %d %d %d %d %#x 0x%02x %u %u"

L_.str.1:                               ## @.str.1
	.asciz	"skipping scratch data, no header"

	.comm	_parse_state_end_parse,4,2      ## @parse_state_end_parse
	.comm	_ISOC_MODE_COMPRESS,8,3         ## @ISOC_MODE_COMPRESS
L_.str.2:                               ## @.str.2
	.asciz	"Lost frame before %d on USB"

	.comm	_parse_state_next_frame,4,2     ## @parse_state_next_frame
	.comm	_scan_state_lines,4,2           ## @scan_state_lines
	.comm	_parse_state_continue,4,2       ## @parse_state_continue
	.no_dead_strip	_usbvision_find_header
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function usbvision_find_header
_usbvision_find_header:                 ; @usbvision_find_header
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #144
	.cfi_def_cfa_offset 144
	stp	x24, x23, [sp, #80]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #96]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #112]            ; 16-byte Folded Spill
	stp	x29, x30, [sp, #128]            ; 16-byte Folded Spill
	add	x29, sp, #128
	.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	x19, x0
	ldr	x22, [x0, #24]
	add	x20, x22, #32
Lloh0:
	adrp	x24, _USBVISION_HEADER_LENGTH@GOTPAGE
Lloh1:
	ldr	x24, [x24, _USBVISION_HEADER_LENGTH@GOTPAGEOFF]
Lloh2:
	adrp	x23, _DBG_HEADER@GOTPAGE
Lloh3:
	ldr	x23, [x23, _DBG_HEADER@GOTPAGEOFF]
Lloh4:
	adrp	x21, l_.str@PAGE
Lloh5:
	add	x21, x21, l_.str@PAGEOFF
LBB0_1:                                 ; =>This Inner Loop Header: Depth=1
	mov	x0, x19
	mov	x1, x20
	bl	_scratch_get_header
	mov	x8, x0
	ldr	x9, [x24]
	ldr	w0, [x23]
	cmp	x8, x9
	b.ne	LBB0_9
; %bb.2:                                ;   in Loop: Header=BB0_1 Depth=1
	ldr	x8, [x22, #40]
	ldp	w10, w9, [x22, #72]
	ldr	w11, [x22, #32]
	ldp	w13, w12, [x22, #64]
	ldp	w14, w15, [x22, #48]
	ldp	w17, w16, [x22, #56]
	stp	x15, x17, [sp, #64]
	stp	x8, x14, [sp, #48]
	stp	x13, x16, [sp, #32]
	stp	x12, x11, [sp, #16]
	stp	x9, x10, [sp]
	mov	x1, x21
	bl	_PDEBUG
	ldr	x8, [x19, #16]
	cbz	x8, LBB0_5
; %bb.3:                                ;   in Loop: Header=BB0_1 Depth=1
	ldrb	w8, [x22, #48]
	tbz	w8, #7, LBB0_1
; %bb.4:
	mov	w8, #-1
	str	w8, [x19]
	mov	x0, x19
	bl	_usbvision_unrequest_intra
LBB0_5:
	ldur	d0, [x22, #52]
	ldur	d1, [x19, #4]
	mul.2s	v0, v1, v0
	str	d0, [x22]
	ldr	w8, [x22, #80]
	fmov	w9, s0
	mul	w8, w8, w9
	asr	w8, w8, #3
	str	w8, [x22, #8]
	ldr	x8, [x22, #40]
Lloh6:
	adrp	x9, _ISOC_MODE_COMPRESS@GOTPAGE
Lloh7:
	ldr	x9, [x9, _ISOC_MODE_COMPRESS@GOTPAGEOFF]
Lloh8:
	ldr	x9, [x9]
	cmp	x8, x9
	b.ne	LBB0_12
; %bb.6:
	ldr	w8, [x19]
	tbnz	w8, #31, LBB0_10
; %bb.7:
	add	w8, w8, #1
	and	w8, w8, #0x1f
	ldr	w9, [x20]
	cmp	w8, w9
	b.eq	LBB0_11
; %bb.8:
	ldr	w0, [x23]
	str	x9, [sp]
Lloh9:
	adrp	x1, l_.str.2@PAGE
Lloh10:
	add	x1, x1, l_.str.2@PAGEOFF
	bl	_PDEBUG
	mov	x0, x19
	bl	_usbvision_request_intra
Lloh11:
	adrp	x8, _parse_state_next_frame@GOTPAGE
Lloh12:
	ldr	x8, [x8, _parse_state_next_frame@GOTPAGEOFF]
	b	LBB0_13
LBB0_9:
Lloh13:
	adrp	x1, l_.str.1@PAGE
Lloh14:
	add	x1, x1, l_.str.1@PAGEOFF
	bl	_PDEBUG
	mov	x0, x19
	bl	_scratch_reset
Lloh15:
	adrp	x8, _parse_state_end_parse@GOTPAGE
Lloh16:
	ldr	x8, [x8, _parse_state_end_parse@GOTPAGEOFF]
	b	LBB0_13
LBB0_10:
	ldr	w8, [x20]
LBB0_11:
	str	w8, [x19]
LBB0_12:
	ldr	w8, [x19, #12]
	add	w8, w8, #1
Lloh17:
	adrp	x9, _scan_state_lines@GOTPAGE
Lloh18:
	ldr	x9, [x9, _scan_state_lines@GOTPAGEOFF]
	str	w8, [x19, #12]
Lloh19:
	ldr	w8, [x9]
	str	w8, [x22, #24]
	str	xzr, [x22, #16]
Lloh20:
	adrp	x8, _parse_state_continue@GOTPAGE
Lloh21:
	ldr	x8, [x8, _parse_state_continue@GOTPAGEOFF]
LBB0_13:
	ldr	w0, [x8]
	ldp	x29, x30, [sp, #128]            ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #112]            ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #96]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #80]             ; 16-byte Folded Reload
	add	sp, sp, #144
	ret
	.loh AdrpAdd	Lloh4, Lloh5
	.loh AdrpLdrGot	Lloh2, Lloh3
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpLdrGotLdr	Lloh6, Lloh7, Lloh8
	.loh AdrpLdrGot	Lloh11, Lloh12
	.loh AdrpAdd	Lloh9, Lloh10
	.loh AdrpLdrGot	Lloh15, Lloh16
	.loh AdrpAdd	Lloh13, Lloh14
	.loh AdrpLdrGot	Lloh20, Lloh21
	.loh AdrpLdrGotLdr	Lloh17, Lloh18, Lloh19
	.cfi_endproc
                                        ; -- End function
	.comm	_USBVISION_HEADER_LENGTH,8,3    ; @USBVISION_HEADER_LENGTH
	.comm	_DBG_HEADER,4,2                 ; @DBG_HEADER
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"found header: 0x%02x%02x %d %d %d %d %#x 0x%02x %u %u"

l_.str.1:                               ; @.str.1
	.asciz	"skipping scratch data, no header"

	.comm	_parse_state_end_parse,4,2      ; @parse_state_end_parse
	.comm	_ISOC_MODE_COMPRESS,8,3         ; @ISOC_MODE_COMPRESS
l_.str.2:                               ; @.str.2
	.asciz	"Lost frame before %d on USB"

	.comm	_parse_state_next_frame,4,2     ; @parse_state_next_frame
	.comm	_scan_state_lines,4,2           ; @scan_state_lines
	.comm	_parse_state_continue,4,2       ; @parse_state_continue
	.no_dead_strip	_usbvision_find_header
.subsections_via_symbols
