	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function usbvision_v4l2_open
_usbvision_v4l2_open:                   ## @usbvision_v4l2_open
	.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
	movq	%rdi, %rbx
	callq	_video_drvdata
	movq	%rax, %r15
	movq	_DBG_IO@GOTPCREL(%rip), %r12
	movl	(%r12), %edi
	leaq	L_.str(%rip), %rsi
	callq	_PDEBUG
	leaq	4(%r15), %r14
	movq	%r14, %rdi
	callq	_mutex_lock_interruptible
	testq	%rax, %rax
	je	LBB0_2
## %bb.1:
	movq	_ERESTARTSYS@GOTPCREL(%rip), %rax
	xorl	%ebx, %ebx
	subl	(%rax), %ebx
	jmp	LBB0_16
LBB0_2:
	cmpq	$0, 8(%r15)
	je	LBB0_3
## %bb.8:
	movq	_EBUSY@GOTPCREL(%rip), %rax
	movl	(%rax), %ebx
	testl	%ebx, %ebx
	je	LBB0_9
LBB0_14:
	negl	%ebx
	jmp	LBB0_15
LBB0_3:
	movq	%rbx, %rdi
	callq	_v4l2_fh_open
	movl	%eax, %ebx
	testl	%eax, %eax
	jne	LBB0_15
## %bb.4:
	movq	%r15, %rdi
	callq	_usbvision_scratch_alloc
	movl	%eax, %ebx
	movq	_isoc_mode@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	movq	_ISOC_MODE_COMPRESS@GOTPCREL(%rip), %rcx
	cmpq	(%rcx), %rax
	jne	LBB0_6
## %bb.5:
	movq	%r15, %rdi
	callq	_usbvision_decompress_alloc
	movl	%eax, %ebx
LBB0_6:
	testl	%ebx, %ebx
	je	LBB0_9
## %bb.7:
	movq	%r15, %rdi
	callq	_usbvision_scratch_free
	movq	%r15, %rdi
	callq	_usbvision_decompress_free
	jmp	LBB0_15
LBB0_9:
	cmpl	$0, (%r15)
	jne	LBB0_12
## %bb.10:
	movq	_isoc_mode@GOTPCREL(%rip), %rax
	movq	(%rax), %rsi
	movq	%r15, %rdi
	callq	_usbvision_setup
	testl	%eax, %eax
	je	LBB0_13
## %bb.11:
	movl	$1, (%r15)
LBB0_12:
	movq	%r15, %rdi
	callq	_usbvision_begin_streaming
	movq	%r15, %rdi
	callq	_usbvision_init_isoc
	movl	%eax, %ebx
	movq	%r15, %rdi
	xorl	%esi, %esi
	callq	_usbvision_muxsel
	movq	%r15, %rdi
	callq	_usbvision_empty_framequeues
	incq	8(%r15)
LBB0_15:
	movq	%r14, %rdi
	callq	_mutex_unlock
	movl	(%r12), %edi
	leaq	L_.str.1(%rip), %rsi
	callq	_PDEBUG
LBB0_16:
	movl	%ebx, %eax
	popq	%rbx
	popq	%r12
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_13:
	movq	_EBUSY@GOTPCREL(%rip), %rax
	movl	(%rax), %ebx
	testl	%ebx, %ebx
	jne	LBB0_14
	jmp	LBB0_12
	.cfi_endproc
                                        ## -- End function
	.comm	_DBG_IO,4,2                     ## @DBG_IO
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"open"

	.comm	_ERESTARTSYS,4,2                ## @ERESTARTSYS
	.comm	_EBUSY,4,2                      ## @EBUSY
	.comm	_isoc_mode,8,3                  ## @isoc_mode
	.comm	_ISOC_MODE_COMPRESS,8,3         ## @ISOC_MODE_COMPRESS
L_.str.1:                               ## @.str.1
	.asciz	"success"

	.no_dead_strip	_usbvision_v4l2_open
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function usbvision_v4l2_open
_usbvision_v4l2_open:                   ; @usbvision_v4l2_open
	.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
	mov	x21, x0
	bl	_video_drvdata
	mov	x20, x0
Lloh0:
	adrp	x22, _DBG_IO@GOTPAGE
Lloh1:
	ldr	x22, [x22, _DBG_IO@GOTPAGEOFF]
	ldr	w0, [x22]
Lloh2:
	adrp	x1, l_.str@PAGE
Lloh3:
	add	x1, x1, l_.str@PAGEOFF
	bl	_PDEBUG
	add	x19, x20, #4
	mov	x0, x19
	bl	_mutex_lock_interruptible
	cbz	x0, LBB0_2
; %bb.1:
Lloh4:
	adrp	x8, _ERESTARTSYS@GOTPAGE
Lloh5:
	ldr	x8, [x8, _ERESTARTSYS@GOTPAGEOFF]
Lloh6:
	ldr	w8, [x8]
	neg	w21, w8
	b	LBB0_15
LBB0_2:
	ldr	x8, [x20, #8]
	cbz	x8, LBB0_5
; %bb.3:
Lloh7:
	adrp	x8, _EBUSY@GOTPAGE
Lloh8:
	ldr	x8, [x8, _EBUSY@GOTPAGEOFF]
Lloh9:
	ldr	w8, [x8]
	cbz	w8, LBB0_10
LBB0_4:
	neg	w21, w8
	b	LBB0_14
LBB0_5:
	mov	x0, x21
	bl	_v4l2_fh_open
	mov	x21, x0
	cbnz	w0, LBB0_14
; %bb.6:
	mov	x0, x20
	bl	_usbvision_scratch_alloc
Lloh10:
	adrp	x8, _isoc_mode@GOTPAGE
Lloh11:
	ldr	x8, [x8, _isoc_mode@GOTPAGEOFF]
Lloh12:
	ldr	x8, [x8]
Lloh13:
	adrp	x9, _ISOC_MODE_COMPRESS@GOTPAGE
Lloh14:
	ldr	x9, [x9, _ISOC_MODE_COMPRESS@GOTPAGEOFF]
Lloh15:
	ldr	x9, [x9]
	cmp	x8, x9
	b.ne	LBB0_8
; %bb.7:
	mov	x0, x20
	bl	_usbvision_decompress_alloc
LBB0_8:
	mov	x21, x0
	cbz	w0, LBB0_10
; %bb.9:
	mov	x0, x20
	bl	_usbvision_scratch_free
	mov	x0, x20
	bl	_usbvision_decompress_free
	b	LBB0_14
LBB0_10:
	ldr	w8, [x20]
	cbnz	w8, LBB0_13
; %bb.11:
Lloh16:
	adrp	x8, _isoc_mode@GOTPAGE
Lloh17:
	ldr	x8, [x8, _isoc_mode@GOTPAGEOFF]
Lloh18:
	ldr	x1, [x8]
	mov	x0, x20
	bl	_usbvision_setup
	cbz	w0, LBB0_16
; %bb.12:
	mov	w8, #1
	str	w8, [x20]
LBB0_13:
	mov	x0, x20
	bl	_usbvision_begin_streaming
	mov	x0, x20
	bl	_usbvision_init_isoc
	mov	x21, x0
	mov	x0, x20
	mov	w1, #0
	bl	_usbvision_muxsel
	mov	x0, x20
	bl	_usbvision_empty_framequeues
	ldr	x8, [x20, #8]
	add	x8, x8, #1
	str	x8, [x20, #8]
LBB0_14:
	mov	x0, x19
	bl	_mutex_unlock
	ldr	w0, [x22]
Lloh19:
	adrp	x1, l_.str.1@PAGE
Lloh20:
	add	x1, x1, l_.str.1@PAGEOFF
	bl	_PDEBUG
LBB0_15:
	mov	x0, x21
	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_16:
Lloh21:
	adrp	x8, _EBUSY@GOTPAGE
Lloh22:
	ldr	x8, [x8, _EBUSY@GOTPAGEOFF]
Lloh23:
	ldr	w8, [x8]
	cbnz	w8, LBB0_4
	b	LBB0_13
	.loh AdrpAdd	Lloh2, Lloh3
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpLdrGotLdr	Lloh4, Lloh5, Lloh6
	.loh AdrpLdrGotLdr	Lloh7, Lloh8, Lloh9
	.loh AdrpLdrGotLdr	Lloh13, Lloh14, Lloh15
	.loh AdrpLdrGotLdr	Lloh10, Lloh11, Lloh12
	.loh AdrpLdrGotLdr	Lloh16, Lloh17, Lloh18
	.loh AdrpAdd	Lloh19, Lloh20
	.loh AdrpLdrGotLdr	Lloh21, Lloh22, Lloh23
	.cfi_endproc
                                        ; -- End function
	.comm	_DBG_IO,4,2                     ; @DBG_IO
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"open"

	.comm	_ERESTARTSYS,4,2                ; @ERESTARTSYS
	.comm	_EBUSY,4,2                      ; @EBUSY
	.comm	_isoc_mode,8,3                  ; @isoc_mode
	.comm	_ISOC_MODE_COMPRESS,8,3         ; @ISOC_MODE_COMPRESS
l_.str.1:                               ; @.str.1
	.asciz	"success"

	.no_dead_strip	_usbvision_v4l2_open
.subsections_via_symbols
