	.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	%rbx
	pushq	%rax
	.cfi_offset %rbx, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	callq	_video_drvdata
	movq	%rax, %rbx
	movq	_DBG_IO@GOTPCREL(%rip), %r15
	movl	(%r15), %edi
	leaq	L_.str(%rip), %rsi
	callq	_PDEBUG
	movq	%rbx, %rdi
	callq	_usbvision_reset_power_off_timer
	cmpq	$0, 16(%rbx)
	je	LBB0_1
## %bb.5:
	movq	_EBUSY@GOTPCREL(%rip), %rax
	movl	(%rax), %r14d
	testl	%r14d, %r14d
	je	LBB0_7
## %bb.6:
	negl	%r14d
	jmp	LBB0_16
LBB0_1:
	movq	%rbx, %rdi
	callq	_usbvision_scratch_alloc
	movl	%eax, %r14d
	movq	_isoc_mode@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	movq	_ISOC_MODE_COMPRESS@GOTPCREL(%rip), %rcx
	cmpq	(%rcx), %rax
	jne	LBB0_3
## %bb.2:
	movq	%rbx, %rdi
	callq	_usbvision_decompress_alloc
	movl	%eax, %r14d
LBB0_3:
	testl	%r14d, %r14d
	je	LBB0_7
## %bb.4:
	movq	%rbx, %rdi
	callq	_usbvision_scratch_free
	movq	%rbx, %rdi
	callq	_usbvision_decompress_free
	jmp	LBB0_16
LBB0_7:
	cmpq	$0, (%rbx)
	je	LBB0_8
## %bb.9:
	cmpl	$0, 8(%rbx)
	jne	LBB0_13
	jmp	LBB0_10
LBB0_8:
	movq	%rbx, %rdi
	callq	_usbvision_power_on
	movq	%rbx, %rdi
	callq	_usbvision_i2c_register
	cmpl	$0, 8(%rbx)
	jne	LBB0_13
LBB0_10:
	movq	_isoc_mode@GOTPCREL(%rip), %rax
	movq	(%rax), %rsi
	movq	%rbx, %rdi
	callq	_usbvision_setup
	testl	%eax, %eax
	je	LBB0_12
## %bb.11:
	movl	$1, 8(%rbx)
LBB0_13:
	movq	%rbx, %rdi
	callq	_usbvision_begin_streaming
	movq	%rbx, %rdi
	callq	_usbvision_init_isoc
	movl	%eax, %r14d
	movq	%rbx, %rdi
	xorl	%esi, %esi
	callq	_usbvision_muxsel
	incq	16(%rbx)
LBB0_16:
	movq	%rbx, %rdi
	callq	_usbvision_empty_framequeues
	movl	(%r15), %edi
	leaq	L_.str.1(%rip), %rsi
	callq	_PDEBUG
	movl	%r14d, %eax
	addq	$8, %rsp
	popq	%rbx
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_12:
	movq	_EBUSY@GOTPCREL(%rip), %rax
	movl	(%rax), %r14d
	testl	%r14d, %r14d
	je	LBB0_13
## %bb.14:
	negl	%r14d
	movq	_power_on_at_open@GOTPCREL(%rip), %rax
	cmpq	$0, (%rax)
	je	LBB0_16
## %bb.15:
	movq	%rbx, %rdi
	callq	_usbvision_i2c_unregister
	movq	%rbx, %rdi
	callq	_usbvision_power_off
	movl	$0, 8(%rbx)
	jmp	LBB0_16
	.cfi_endproc
                                        ## -- End function
	.comm	_DBG_IO,4,2                     ## @DBG_IO
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"open"

	.comm	_EBUSY,4,2                      ## @EBUSY
	.comm	_isoc_mode,8,3                  ## @isoc_mode
	.comm	_ISOC_MODE_COMPRESS,8,3         ## @ISOC_MODE_COMPRESS
	.comm	_power_on_at_open,8,3           ## @power_on_at_open
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
	bl	_video_drvdata
	mov	x19, x0
Lloh0:
	adrp	x21, _DBG_IO@GOTPAGE
Lloh1:
	ldr	x21, [x21, _DBG_IO@GOTPAGEOFF]
	ldr	w0, [x21]
Lloh2:
	adrp	x1, l_.str@PAGE
Lloh3:
	add	x1, x1, l_.str@PAGEOFF
	bl	_PDEBUG
	mov	x0, x19
	bl	_usbvision_reset_power_off_timer
	ldr	x8, [x19, #16]
	cbz	x8, LBB0_3
; %bb.1:
Lloh4:
	adrp	x8, _EBUSY@GOTPAGE
Lloh5:
	ldr	x8, [x8, _EBUSY@GOTPAGEOFF]
Lloh6:
	ldr	w8, [x8]
	cbz	w8, LBB0_7
; %bb.2:
	neg	w20, w8
	b	LBB0_13
LBB0_3:
	mov	x0, x19
	bl	_usbvision_scratch_alloc
Lloh7:
	adrp	x8, _isoc_mode@GOTPAGE
Lloh8:
	ldr	x8, [x8, _isoc_mode@GOTPAGEOFF]
Lloh9:
	ldr	x8, [x8]
Lloh10:
	adrp	x9, _ISOC_MODE_COMPRESS@GOTPAGE
Lloh11:
	ldr	x9, [x9, _ISOC_MODE_COMPRESS@GOTPAGEOFF]
Lloh12:
	ldr	x9, [x9]
	cmp	x8, x9
	b.ne	LBB0_5
; %bb.4:
	mov	x0, x19
	bl	_usbvision_decompress_alloc
LBB0_5:
	mov	x20, x0
	cbz	w0, LBB0_7
; %bb.6:
	mov	x0, x19
	bl	_usbvision_scratch_free
	mov	x0, x19
	bl	_usbvision_decompress_free
	b	LBB0_13
LBB0_7:
	ldr	x8, [x19]
	cbz	x8, LBB0_9
; %bb.8:
	ldr	w8, [x19, #8]
	cbnz	w8, LBB0_12
	b	LBB0_10
LBB0_9:
	mov	x0, x19
	bl	_usbvision_power_on
	mov	x0, x19
	bl	_usbvision_i2c_register
	ldr	w8, [x19, #8]
	cbnz	w8, LBB0_12
LBB0_10:
Lloh13:
	adrp	x8, _isoc_mode@GOTPAGE
Lloh14:
	ldr	x8, [x8, _isoc_mode@GOTPAGEOFF]
Lloh15:
	ldr	x1, [x8]
	mov	x0, x19
	bl	_usbvision_setup
	cbz	w0, LBB0_14
; %bb.11:
	mov	w8, #1
	str	w8, [x19, #8]
LBB0_12:
	mov	x0, x19
	bl	_usbvision_begin_streaming
	mov	x0, x19
	bl	_usbvision_init_isoc
	mov	x20, x0
	mov	x0, x19
	mov	w1, #0
	bl	_usbvision_muxsel
	ldr	x8, [x19, #16]
	add	x8, x8, #1
	str	x8, [x19, #16]
LBB0_13:
	mov	x0, x19
	bl	_usbvision_empty_framequeues
	ldr	w0, [x21]
Lloh16:
	adrp	x1, l_.str.1@PAGE
Lloh17:
	add	x1, x1, l_.str.1@PAGEOFF
	bl	_PDEBUG
	mov	x0, x20
	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_14:
Lloh18:
	adrp	x8, _EBUSY@GOTPAGE
Lloh19:
	ldr	x8, [x8, _EBUSY@GOTPAGEOFF]
Lloh20:
	ldr	w8, [x8]
	cbz	w8, LBB0_12
; %bb.15:
	neg	w20, w8
Lloh21:
	adrp	x8, _power_on_at_open@GOTPAGE
Lloh22:
	ldr	x8, [x8, _power_on_at_open@GOTPAGEOFF]
Lloh23:
	ldr	x8, [x8]
	cbz	x8, LBB0_13
; %bb.16:
	mov	x0, x19
	bl	_usbvision_i2c_unregister
	mov	x0, x19
	bl	_usbvision_power_off
	str	wzr, [x19, #8]
	b	LBB0_13
	.loh AdrpAdd	Lloh2, Lloh3
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpLdrGotLdr	Lloh4, Lloh5, Lloh6
	.loh AdrpLdrGotLdr	Lloh10, Lloh11, Lloh12
	.loh AdrpLdrGotLdr	Lloh7, Lloh8, Lloh9
	.loh AdrpLdrGotLdr	Lloh13, Lloh14, Lloh15
	.loh AdrpAdd	Lloh16, Lloh17
	.loh AdrpLdrGotLdr	Lloh18, 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	_EBUSY,4,2                      ; @EBUSY
	.comm	_isoc_mode,8,3                  ; @isoc_mode
	.comm	_ISOC_MODE_COMPRESS,8,3         ; @ISOC_MODE_COMPRESS
	.comm	_power_on_at_open,8,3           ; @power_on_at_open
l_.str.1:                               ; @.str.1
	.asciz	"success"

	.no_dead_strip	_usbvision_v4l2_open
.subsections_via_symbols
