	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function ibmcam_find_header
_ibmcam_find_header:                    ## @ibmcam_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
	subq	$24, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	(%rdi), %rsi
	testq	%rsi, %rsi
	js	LBB0_2
## %bb.1:
	movq	_USBVIDEO_NUMFRAMES@GOTPCREL(%rip), %rax
	cmpq	(%rax), %rsi
	jge	LBB0_2
## %bb.3:
	movq	%rdi, %r15
	callq	_IBMCAM_T
	movq	%rax, %r14
	xorl	%edi, %edi
	testq	%rax, %rax
	setne	%dil
	callq	_assert
	movq	(%r15), %rcx
	movq	32(%r15), %r13
	movl	$0, (%r14)
	movl	$-129, %eax
	addl	4(%r14), %eax
	cmpl	$3, %eax
	ja	LBB0_30
## %bb.4:
	leaq	(%rcx,%rcx,2), %rcx
	movq	%rcx, -56(%rbp)                 ## 8-byte Spill
	leaq	(,%rcx,8), %rcx
	addq	%r13, %rcx
	movq	%rcx, -48(%rbp)                 ## 8-byte Spill
	leaq	LJTI0_0(%rip), %rcx
	movslq	(%rcx,%rax,4), %rax
	addq	%rcx, %rax
	jmpq	*%rax
LBB0_20:
	xorl	%eax, %eax
	cmpl	$128, 28(%r15)
	sete	%al
	leal	2(,%rax,8), %r12d
	leaq	24(%r15), %rbx
	jmp	LBB0_21
	.p2align	4, 0x90
LBB0_27:                                ##   in Loop: Header=BB0_21 Depth=1
	movq	%rbx, %rdi
	movl	$1, %esi
	callq	_RING_QUEUE_DEQUEUE_BYTES
LBB0_21:                                ## =>This Inner Loop Header: Depth=1
	movq	%rbx, %rdi
	callq	_RingQueue_GetLength
	cmpl	%r12d, %eax
	jl	LBB0_29
## %bb.22:                              ##   in Loop: Header=BB0_21 Depth=1
	movq	%rbx, %rdi
	xorl	%esi, %esi
	callq	_RING_QUEUE_PEEK
	testl	%eax, %eax
	jne	LBB0_27
## %bb.23:                              ##   in Loop: Header=BB0_21 Depth=1
	movq	%rbx, %rdi
	movl	$1, %esi
	callq	_RING_QUEUE_PEEK
	cmpl	$255, %eax
	jne	LBB0_27
## %bb.24:
	movq	%rbx, %rdi
	movl	%r12d, %esi
	callq	_RING_QUEUE_DEQUEUE_BYTES
	movl	$1, (%r14)
	movq	_HDRSIG_MODEL1_176x144@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movq	-48(%rbp), %rcx                 ## 8-byte Reload
	movl	%eax, (%rcx)
	jmp	LBB0_25
LBB0_2:
	leaq	L_.str(%rip), %rdi
	callq	_err
	movq	_scan_EndParse@GOTPCREL(%rip), %rbx
	jmp	LBB0_33
LBB0_5:
	leaq	24(%r15), %rbx
	movq	%rbx, %rdi
	callq	_RingQueue_GetLength
	cmpl	$4, %eax
	jge	LBB0_6
	jmp	LBB0_29
	.p2align	4, 0x90
LBB0_28:                                ##   in Loop: Header=BB0_6 Depth=1
	movq	%rbx, %rdi
	movl	$1, %esi
	callq	_RING_QUEUE_DEQUEUE_BYTES
	movq	%rbx, %rdi
	callq	_RingQueue_GetLength
	cmpl	$3, %eax
	jle	LBB0_29
LBB0_6:                                 ## =>This Inner Loop Header: Depth=1
	movq	%rbx, %rdi
	xorl	%esi, %esi
	callq	_RING_QUEUE_PEEK
	testl	%eax, %eax
	jne	LBB0_28
## %bb.7:                               ##   in Loop: Header=BB0_6 Depth=1
	movq	%rbx, %rdi
	movl	$1, %esi
	callq	_RING_QUEUE_PEEK
	cmpl	$255, %eax
	jne	LBB0_28
## %bb.8:                               ##   in Loop: Header=BB0_6 Depth=1
	movq	%rbx, %rdi
	movl	$2, %esi
	callq	_RING_QUEUE_PEEK
	cmpl	$255, %eax
	je	LBB0_28
## %bb.9:
	movq	%rbx, %rdi
	movl	$2, %esi
	callq	_RING_QUEUE_PEEK
	movl	%eax, %r12d
	movq	%rbx, %rdi
	movl	$3, %esi
	callq	_RING_QUEUE_PEEK
	shll	$8, %r12d
	orl	%eax, %r12d
	movq	-48(%rbp), %rax                 ## 8-byte Reload
	movl	%r12d, (%rax)
LBB0_18:
	movq	%rbx, %rdi
	movl	$4, %esi
	callq	_RING_QUEUE_DEQUEUE_BYTES
	movl	$1, (%r14)
	jmp	LBB0_25
LBB0_10:
	leaq	24(%r15), %rbx
	movq	%rbx, %rdi
	callq	_RingQueue_GetLength
	cmpl	$4, %eax
	jl	LBB0_29
## %bb.11:
	movq	_HDRSIG_MODEL1_352x288@GOTPCREL(%rip), %r12
	jmp	LBB0_12
	.p2align	4, 0x90
LBB0_19:                                ##   in Loop: Header=BB0_12 Depth=1
	movq	%rbx, %rdi
	movl	$1, %esi
	callq	_RING_QUEUE_DEQUEUE_BYTES
	movq	%rbx, %rdi
	callq	_RingQueue_GetLength
	cmpl	$3, %eax
	jle	LBB0_29
LBB0_12:                                ## =>This Inner Loop Header: Depth=1
	movq	%rbx, %rdi
	xorl	%esi, %esi
	callq	_RING_QUEUE_PEEK
	testl	%eax, %eax
	jne	LBB0_19
## %bb.13:                              ##   in Loop: Header=BB0_12 Depth=1
	movq	%rbx, %rdi
	movl	$1, %esi
	callq	_RING_QUEUE_PEEK
	cmpl	$255, %eax
	jne	LBB0_19
## %bb.14:                              ##   in Loop: Header=BB0_12 Depth=1
	movq	%rbx, %rdi
	movl	$2, %esi
	callq	_RING_QUEUE_PEEK
	testl	%eax, %eax
	jne	LBB0_19
## %bb.15:                              ##   in Loop: Header=BB0_12 Depth=1
	movq	%rbx, %rdi
	movl	$3, %esi
	callq	_RING_QUEUE_PEEK
	movq	-48(%rbp), %rcx                 ## 8-byte Reload
	movl	%eax, (%rcx)
	movq	_HDRSIG_MODEL1_128x96@GOTPCREL(%rip), %rcx
	cmpl	(%rcx), %eax
	je	LBB0_18
## %bb.16:                              ##   in Loop: Header=BB0_12 Depth=1
	movq	_HDRSIG_MODEL1_176x144@GOTPCREL(%rip), %rcx
	cmpl	(%rcx), %eax
	je	LBB0_18
## %bb.17:                              ##   in Loop: Header=BB0_12 Depth=1
	cmpl	(%r12), %eax
	jne	LBB0_19
	jmp	LBB0_18
LBB0_29:
	cmpl	$0, (%r14)
	je	LBB0_30
LBB0_25:
	movl	$1, (%r14)
	incl	12(%r15)
	movq	_ScanState_Lines@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movq	-56(%rbp), %rcx                 ## 8-byte Reload
	movl	%eax, 16(%r13,%rcx,8)
	movq	$0, 8(%r13,%rcx,8)
	movq	_flags@GOTPCREL(%rip), %rax
	movq	_FLAGS_FORCE_TESTPATTERN@GOTPCREL(%rip), %rcx
	movl	(%rcx), %ecx
	testl	%ecx, (%rax)
	je	LBB0_26
## %bb.32:
	movq	%r15, %rdi
	movl	$1, %esi
	movl	$1, %edx
	callq	_usbvideo_TestPattern
	movq	_scan_NextFrame@GOTPCREL(%rip), %rbx
	jmp	LBB0_33
LBB0_30:
	movq	_scan_EndParse@GOTPCREL(%rip), %rbx
	cmpl	$3, 8(%r15)
	jl	LBB0_33
## %bb.31:
	movq	16(%r15), %rdi
	leaq	L_.str.1(%rip), %rsi
	xorl	%eax, %eax
	callq	_dev_info
	jmp	LBB0_33
LBB0_26:
	movq	_scan_Continue@GOTPCREL(%rip), %rbx
LBB0_33:
	movl	(%rbx), %eax
	addq	$24, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
	.p2align	2, 0x90
	.data_region jt32
.set L0_0_set_20, LBB0_20-LJTI0_0
.set L0_0_set_5, LBB0_5-LJTI0_0
.set L0_0_set_10, LBB0_10-LJTI0_0
LJTI0_0:
	.long	L0_0_set_20
	.long	L0_0_set_5
	.long	L0_0_set_20
	.long	L0_0_set_10
	.end_data_region
                                        ## -- End function
	.comm	_USBVIDEO_NUMFRAMES,8,3         ## @USBVIDEO_NUMFRAMES
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"ibmcam_find_header: Illegal frame %d."

	.comm	_scan_EndParse,4,2              ## @scan_EndParse
	.comm	_HDRSIG_MODEL1_128x96,4,2       ## @HDRSIG_MODEL1_128x96
	.comm	_HDRSIG_MODEL1_176x144,4,2      ## @HDRSIG_MODEL1_176x144
	.comm	_HDRSIG_MODEL1_352x288,4,2      ## @HDRSIG_MODEL1_352x288
L_.str.1:                               ## @.str.1
	.asciz	"Skipping frame, no header\n"

	.comm	_ScanState_Lines,4,2            ## @ScanState_Lines
	.comm	_flags,4,2                      ## @flags
	.comm	_FLAGS_FORCE_TESTPATTERN,4,2    ## @FLAGS_FORCE_TESTPATTERN
	.comm	_scan_NextFrame,4,2             ## @scan_NextFrame
	.comm	_scan_Continue,4,2              ## @scan_Continue
	.no_dead_strip	_ibmcam_find_header
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function ibmcam_find_header
_ibmcam_find_header:                    ; @ibmcam_find_header
	.cfi_startproc
; %bb.0:
	stp	x28, x27, [sp, #-96]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 96
	stp	x26, x25, [sp, #16]             ; 16-byte Folded Spill
	stp	x24, x23, [sp, #32]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #48]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #64]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #80]             ; 16-byte Folded Spill
	add	x29, sp, #80
	.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
	.cfi_offset w25, -72
	.cfi_offset w26, -80
	.cfi_offset w27, -88
	.cfi_offset w28, -96
	ldr	x1, [x0]
	tbnz	x1, #63, LBB0_10
; %bb.1:
Lloh0:
	adrp	x8, _USBVIDEO_NUMFRAMES@GOTPAGE
Lloh1:
	ldr	x8, [x8, _USBVIDEO_NUMFRAMES@GOTPAGEOFF]
Lloh2:
	ldr	x8, [x8]
	cmp	x1, x8
	b.ge	LBB0_10
; %bb.2:
	mov	x19, x0
	bl	_IBMCAM_T
	mov	x20, x0
	cmp	x0, #0
	cset	w0, ne
	bl	_assert
	ldr	x23, [x19, #32]
	ldr	x24, [x19]
	str	wzr, [x20]
	ldr	w8, [x20, #4]
	sub	w8, w8, #129
	cmp	w8, #3
	b.hi	LBB0_30
; %bb.3:
	mov	w9, #24
	madd	x25, x24, x9, x23
Lloh3:
	adrp	x9, lJTI0_0@PAGE
Lloh4:
	add	x9, x9, lJTI0_0@PAGEOFF
	adr	x10, LBB0_4
	ldrb	w11, [x9, x8]
	add	x10, x10, x11, lsl #2
	br	x10
LBB0_4:
	ldr	w8, [x19, #28]
	mov	w9, #2
	mov	w10, #10
	cmp	w8, #128
	csel	w21, w10, w9, eq
	add	x22, x19, #24
	b	LBB0_6
LBB0_5:                                 ;   in Loop: Header=BB0_6 Depth=1
	mov	x0, x22
	mov	w1, #1
	bl	_RING_QUEUE_DEQUEUE_BYTES
LBB0_6:                                 ; =>This Inner Loop Header: Depth=1
	mov	x0, x22
	bl	_RingQueue_GetLength
	cmp	w0, w21
	b.lt	LBB0_27
; %bb.7:                                ;   in Loop: Header=BB0_6 Depth=1
	mov	x0, x22
	mov	w1, #0
	bl	_RING_QUEUE_PEEK
	cbnz	w0, LBB0_5
; %bb.8:                                ;   in Loop: Header=BB0_6 Depth=1
	mov	x0, x22
	mov	w1, #1
	bl	_RING_QUEUE_PEEK
	cmp	w0, #255
	b.ne	LBB0_5
; %bb.9:
	mov	x0, x22
	mov	x1, x21
	bl	_RING_QUEUE_DEQUEUE_BYTES
	mov	w8, #1
	str	w8, [x20]
Lloh5:
	adrp	x8, _HDRSIG_MODEL1_176x144@GOTPAGE
Lloh6:
	ldr	x8, [x8, _HDRSIG_MODEL1_176x144@GOTPAGEOFF]
Lloh7:
	ldr	w8, [x8]
	str	w8, [x25]
	b	LBB0_28
LBB0_10:
Lloh8:
	adrp	x0, l_.str@PAGE
Lloh9:
	add	x0, x0, l_.str@PAGEOFF
	bl	_err
LBB0_11:
Lloh10:
	adrp	x8, _scan_EndParse@GOTPAGE
Lloh11:
	ldr	x8, [x8, _scan_EndParse@GOTPAGEOFF]
LBB0_12:
	ldr	w0, [x8]
	ldp	x29, x30, [sp, #80]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #64]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #48]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #32]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp, #16]             ; 16-byte Folded Reload
	ldp	x28, x27, [sp], #96             ; 16-byte Folded Reload
	ret
LBB0_13:
	add	x21, x19, #24
	mov	x0, x21
	bl	_RingQueue_GetLength
	cmp	w0, #4
	b.ge	LBB0_15
	b	LBB0_27
LBB0_14:                                ;   in Loop: Header=BB0_15 Depth=1
	mov	x0, x21
	mov	w1, #1
	bl	_RING_QUEUE_DEQUEUE_BYTES
	mov	x0, x21
	bl	_RingQueue_GetLength
	cmp	w0, #3
	b.le	LBB0_27
LBB0_15:                                ; =>This Inner Loop Header: Depth=1
	mov	x0, x21
	mov	w1, #0
	bl	_RING_QUEUE_PEEK
	cbnz	w0, LBB0_14
; %bb.16:                               ;   in Loop: Header=BB0_15 Depth=1
	mov	x0, x21
	mov	w1, #1
	bl	_RING_QUEUE_PEEK
	cmp	w0, #255
	b.ne	LBB0_14
; %bb.17:                               ;   in Loop: Header=BB0_15 Depth=1
	mov	x0, x21
	mov	w1, #2
	bl	_RING_QUEUE_PEEK
	cmp	w0, #255
	b.eq	LBB0_14
; %bb.18:
	mov	x0, x21
	mov	w1, #2
	bl	_RING_QUEUE_PEEK
	mov	x22, x0
	mov	x0, x21
	mov	w1, #3
	bl	_RING_QUEUE_PEEK
	orr	w8, w0, w22, lsl #8
	str	w8, [x25]
	b	LBB0_26
LBB0_19:
	add	x21, x19, #24
	mov	x0, x21
	bl	_RingQueue_GetLength
	cmp	w0, #4
	b.lt	LBB0_27
; %bb.20:
Lloh12:
	adrp	x22, _HDRSIG_MODEL1_128x96@GOTPAGE
Lloh13:
	ldr	x22, [x22, _HDRSIG_MODEL1_128x96@GOTPAGEOFF]
Lloh14:
	adrp	x26, _HDRSIG_MODEL1_176x144@GOTPAGE
Lloh15:
	ldr	x26, [x26, _HDRSIG_MODEL1_176x144@GOTPAGEOFF]
Lloh16:
	adrp	x27, _HDRSIG_MODEL1_352x288@GOTPAGE
Lloh17:
	ldr	x27, [x27, _HDRSIG_MODEL1_352x288@GOTPAGEOFF]
	b	LBB0_22
LBB0_21:                                ;   in Loop: Header=BB0_22 Depth=1
	mov	x0, x21
	mov	w1, #1
	bl	_RING_QUEUE_DEQUEUE_BYTES
	mov	x0, x21
	bl	_RingQueue_GetLength
	cmp	w0, #3
	b.le	LBB0_27
LBB0_22:                                ; =>This Inner Loop Header: Depth=1
	mov	x0, x21
	mov	w1, #0
	bl	_RING_QUEUE_PEEK
	cbnz	w0, LBB0_21
; %bb.23:                               ;   in Loop: Header=BB0_22 Depth=1
	mov	x0, x21
	mov	w1, #1
	bl	_RING_QUEUE_PEEK
	cmp	w0, #255
	b.ne	LBB0_21
; %bb.24:                               ;   in Loop: Header=BB0_22 Depth=1
	mov	x0, x21
	mov	w1, #2
	bl	_RING_QUEUE_PEEK
	cbnz	w0, LBB0_21
; %bb.25:                               ;   in Loop: Header=BB0_22 Depth=1
	mov	x0, x21
	mov	w1, #3
	bl	_RING_QUEUE_PEEK
	str	w0, [x25]
	ldr	w8, [x22]
	ldr	w9, [x26]
	ldr	w10, [x27]
	cmp	w0, w8
	ccmp	w0, w9, #4, ne
	ccmp	w0, w10, #4, ne
	b.ne	LBB0_21
LBB0_26:
	mov	x0, x21
	mov	w1, #4
	bl	_RING_QUEUE_DEQUEUE_BYTES
	mov	w8, #1
	str	w8, [x20]
	b	LBB0_28
LBB0_27:
	ldr	w8, [x20]
	cbz	w8, LBB0_30
LBB0_28:
	mov	w8, #1
	str	w8, [x20]
	ldr	w8, [x19, #12]
	add	w8, w8, #1
	str	w8, [x19, #12]
Lloh18:
	adrp	x8, _ScanState_Lines@GOTPAGE
Lloh19:
	ldr	x8, [x8, _ScanState_Lines@GOTPAGEOFF]
Lloh20:
	ldr	w8, [x8]
	mov	w9, #24
	madd	x9, x24, x9, x23
	str	w8, [x9, #16]
Lloh21:
	adrp	x8, _flags@GOTPAGE
Lloh22:
	ldr	x8, [x8, _flags@GOTPAGEOFF]
	str	xzr, [x9, #8]
Lloh23:
	ldr	w8, [x8]
Lloh24:
	adrp	x9, _FLAGS_FORCE_TESTPATTERN@GOTPAGE
Lloh25:
	ldr	x9, [x9, _FLAGS_FORCE_TESTPATTERN@GOTPAGEOFF]
Lloh26:
	ldr	w9, [x9]
	tst	w9, w8
	b.eq	LBB0_32
; %bb.29:
	mov	x0, x19
	mov	w1, #1
	mov	w2, #1
	bl	_usbvideo_TestPattern
Lloh27:
	adrp	x8, _scan_NextFrame@GOTPAGE
Lloh28:
	ldr	x8, [x8, _scan_NextFrame@GOTPAGEOFF]
	b	LBB0_12
LBB0_30:
	ldr	w8, [x19, #8]
	cmp	w8, #3
	b.lt	LBB0_11
; %bb.31:
	ldr	x0, [x19, #16]
Lloh29:
	adrp	x1, l_.str.1@PAGE
Lloh30:
	add	x1, x1, l_.str.1@PAGEOFF
	bl	_dev_info
	b	LBB0_11
LBB0_32:
Lloh31:
	adrp	x8, _scan_Continue@GOTPAGE
Lloh32:
	ldr	x8, [x8, _scan_Continue@GOTPAGEOFF]
	b	LBB0_12
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpAdd	Lloh3, Lloh4
	.loh AdrpLdrGotLdr	Lloh5, Lloh6, Lloh7
	.loh AdrpAdd	Lloh8, Lloh9
	.loh AdrpLdrGot	Lloh10, Lloh11
	.loh AdrpLdrGot	Lloh16, Lloh17
	.loh AdrpLdrGot	Lloh14, Lloh15
	.loh AdrpLdrGot	Lloh12, Lloh13
	.loh AdrpLdrGotLdr	Lloh24, Lloh25, Lloh26
	.loh AdrpLdrGotLdr	Lloh21, Lloh22, Lloh23
	.loh AdrpLdrGotLdr	Lloh18, Lloh19, Lloh20
	.loh AdrpLdrGot	Lloh27, Lloh28
	.loh AdrpAdd	Lloh29, Lloh30
	.loh AdrpLdrGot	Lloh31, Lloh32
	.cfi_endproc
	.section	__TEXT,__const
lJTI0_0:
	.byte	(LBB0_4-LBB0_4)>>2
	.byte	(LBB0_13-LBB0_4)>>2
	.byte	(LBB0_4-LBB0_4)>>2
	.byte	(LBB0_19-LBB0_4)>>2
                                        ; -- End function
	.comm	_USBVIDEO_NUMFRAMES,8,3         ; @USBVIDEO_NUMFRAMES
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"ibmcam_find_header: Illegal frame %d."

	.comm	_scan_EndParse,4,2              ; @scan_EndParse
	.comm	_HDRSIG_MODEL1_128x96,4,2       ; @HDRSIG_MODEL1_128x96
	.comm	_HDRSIG_MODEL1_176x144,4,2      ; @HDRSIG_MODEL1_176x144
	.comm	_HDRSIG_MODEL1_352x288,4,2      ; @HDRSIG_MODEL1_352x288
l_.str.1:                               ; @.str.1
	.asciz	"Skipping frame, no header\n"

	.comm	_ScanState_Lines,4,2            ; @ScanState_Lines
	.comm	_flags,4,2                      ; @flags
	.comm	_FLAGS_FORCE_TESTPATTERN,4,2    ; @FLAGS_FORCE_TESTPATTERN
	.comm	_scan_NextFrame,4,2             ; @scan_NextFrame
	.comm	_scan_Continue,4,2              ; @scan_Continue
	.no_dead_strip	_ibmcam_find_header
.subsections_via_symbols
