	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function pwc_video_open
_pwc_video_open:                        ## @pwc_video_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	%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, %r14
	callq	_video_devdata
	movq	%rax, %r12
	leaq	L_.str(%rip), %rdi
	xorl	%r13d, %r13d
	movq	%rax, %rsi
	xorl	%eax, %eax
	callq	_PWC_DEBUG_OPEN
	movq	%r12, %rdi
	callq	_video_get_drvdata
	movq	%rax, %rbx
	xorl	%edi, %edi
	testq	%rax, %rax
	sete	%dil
	callq	_BUG_ON
	cmpq	$0, 32(%rbx)
	je	LBB0_2
## %bb.1:
	leaq	L_.str.1(%rip), %rdi
	xorl	%eax, %eax
	callq	_PWC_DEBUG_OPEN
	movq	_EBUSY@GOTPCREL(%rip), %rax
	subl	(%rax), %r13d
	jmp	LBB0_23
LBB0_2:
	movq	%rbx, %r15
	addq	$24, %r15
	movq	%r15, %rdi
	callq	_mutex_lock
	movq	%rbx, %rdi
	callq	_pwc_construct
	cmpl	$0, (%rbx)
	jne	LBB0_5
## %bb.3:
	leaq	L_.str.2(%rip), %rdi
	xorl	%eax, %eax
	callq	_PWC_DEBUG_OPEN
	movl	$1, (%rbx)
	leaq	-44(%rbp), %rsi
	movq	%rbx, %rdi
	callq	_pwc_get_cmos_sensor
	testl	%eax, %eax
	js	LBB0_5
## %bb.4:
	movq	104(%rbx), %rax
	movl	(%rax), %r13d
	movl	-44(%rbp), %edi
	callq	_pwc_sensor_type_to_string
	movl	-44(%rbp), %ecx
	leaq	L_.str.3(%rip), %rdi
	movl	%r13d, %esi
	movl	%eax, %edx
	xorl	%eax, %eax
	callq	_PWC_DEBUG_OPEN
LBB0_5:
	movq	_power_save@GOTPCREL(%rip), %rax
	cmpq	$0, (%rax)
	je	LBB0_8
## %bb.6:
	movq	%rbx, %rdi
	movl	$1, %esi
	callq	_pwc_camera_power
	movl	%eax, -44(%rbp)
	testl	%eax, %eax
	jns	LBB0_8
## %bb.7:
	leaq	L_.str.4(%rip), %rdi
	movl	%eax, %esi
	xorl	%eax, %eax
	callq	_PWC_DEBUG_OPEN
LBB0_8:
	movq	_led_on@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	_led_off@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	movq	%rbx, %rdi
	callq	_pwc_set_leds
	testq	%rax, %rax
	jns	LBB0_10
## %bb.9:
	leaq	L_.str.5(%rip), %rdi
	xorl	%eax, %eax
	callq	_PWC_DEBUG_OPEN
LBB0_10:
	movq	%rbx, %rdi
	callq	_pwc_allocate_buffers
	movl	%eax, -44(%rbp)
	testl	%eax, %eax
	js	LBB0_11
## %bb.13:
	movq	%rbx, %rdi
	callq	_pwc_reset_buffers
	movq	_pwc_mbufs@GOTPCREL(%rip), %rax
	movl	(%rax), %r13d
	testl	%r13d, %r13d
	jle	LBB0_14
## %bb.15:
	movq	96(%rbx), %rdi
	leaq	(,%r13,8), %rsi
	callq	___bzero
	jmp	LBB0_16
LBB0_11:
	leaq	L_.str.6(%rip), %rdi
	jmp	LBB0_12
LBB0_14:
	xorl	%r13d, %r13d
LBB0_16:
	movl	%r13d, -44(%rbp)
	xorps	%xmm0, %xmm0
	movups	%xmm0, 72(%rbx)
	movups	%xmm0, 56(%rbx)
	movq	$0, 88(%rbx)
	movq	%rbx, %rdi
	callq	_pwc_construct
	movq	$0, 48(%rbx)
	movq	_pwc_image_sizes@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	movq	8(%rbx), %rcx
	movl	(%rax,%rcx,8), %edx
	movl	4(%rax,%rcx,8), %esi
	movl	16(%rbx), %ecx
	movl	40(%rbx), %r8d
	xorl	%r13d, %r13d
	movq	%rbx, %rdi
	xorl	%r9d, %r9d
	callq	_pwc_set_video_mode
	movl	%eax, -44(%rbp)
	testl	%eax, %eax
	je	LBB0_22
## %bb.17:
	leaq	L_.str.7(%rip), %rdi
	xorl	%eax, %eax
	callq	_PWC_DEBUG_OPEN
	movl	40(%rbx), %r8d
	cmpl	$730, 20(%rbx)                  ## imm = 0x2DA
	movq	_pwc_image_sizes@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	jl	LBB0_18
## %bb.19:
	movq	_PSZ_QSIF@GOTPCREL(%rip), %rcx
	jmp	LBB0_20
LBB0_18:
	movq	_PSZ_QCIF@GOTPCREL(%rip), %rcx
LBB0_20:
	movl	(%rcx), %ecx
	movl	(%rax,%rcx,8), %edx
	movl	4(%rax,%rcx,8), %esi
	movq	%rbx, %rdi
	movl	$10, %ecx
	xorl	%r9d, %r9d
	callq	_pwc_set_video_mode
	movl	%eax, -44(%rbp)
	testl	%eax, %eax
	je	LBB0_22
## %bb.21:
	leaq	L_.str.8(%rip), %rdi
LBB0_12:
	xorl	%eax, %eax
	callq	_PWC_DEBUG_OPEN
	movq	%rbx, %rdi
	callq	_pwc_free_buffers
	movq	%r15, %rdi
	callq	_mutex_unlock
	movl	-44(%rbp), %r13d
	jmp	LBB0_23
LBB0_22:
	movq	%rbx, %rdi
	movl	$32767, %esi                    ## imm = 0x7FFF
	callq	_pwc_set_brightness
	movq	%rbx, %rdi
	movl	$1, %esi
	xorl	%edx, %edx
	callq	_pwc_set_agc
	incq	32(%rbx)
	movq	%r12, (%r14)
	movq	%r15, %rdi
	callq	_mutex_unlock
	leaq	L_.str.9(%rip), %rdi
	xorl	%eax, %eax
	callq	_PWC_DEBUG_OPEN
LBB0_23:
	movl	%r13d, %eax
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	">> video_open called(vdev = 0x%p).\n"

L_.str.1:                               ## @.str.1
	.asciz	"I'm busy, someone is using the device.\n"

	.comm	_EBUSY,4,2                      ## @EBUSY
L_.str.2:                               ## @.str.2
	.asciz	"Doing first time initialization.\n"

L_.str.3:                               ## @.str.3
	.asciz	"This %s camera is equipped with a %s (%d).\n"

	.comm	_power_save,8,3                 ## @power_save
L_.str.4:                               ## @.str.4
	.asciz	"Failed to restore power to the camera! (%d)\n"

	.comm	_led_on,4,2                     ## @led_on
	.comm	_led_off,4,2                    ## @led_off
L_.str.5:                               ## @.str.5
	.asciz	"Failed to set LED on/off time.\n"

L_.str.6:                               ## @.str.6
	.asciz	"Failed to allocate buffers memory.\n"

	.comm	_pwc_mbufs,4,2                  ## @pwc_mbufs
	.comm	_pwc_image_sizes,8,3            ## @pwc_image_sizes
L_.str.7:                               ## @.str.7
	.asciz	"First attempt at set_video_mode failed.\n"

	.comm	_PSZ_QSIF,4,2                   ## @PSZ_QSIF
	.comm	_PSZ_QCIF,4,2                   ## @PSZ_QCIF
L_.str.8:                               ## @.str.8
	.asciz	"Second attempt at set_video_mode failed.\n"

L_.str.9:                               ## @.str.9
	.asciz	"<< video_open() returns 0.\n"

	.no_dead_strip	_pwc_video_open
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function pwc_video_open
_pwc_video_open:                        ; @pwc_video_open
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #96
	.cfi_def_cfa_offset 96
	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
	mov	x19, x0
	bl	_video_devdata
	mov	x22, x0
	str	x0, [sp]
Lloh0:
	adrp	x0, l_.str@PAGE
Lloh1:
	add	x0, x0, l_.str@PAGEOFF
	bl	_PWC_DEBUG_OPEN
	mov	x0, x22
	bl	_video_get_drvdata
	mov	x20, x0
	cmp	x0, #0
	cset	w0, eq
	bl	_BUG_ON
	ldr	x8, [x20, #32]
	cbz	x8, LBB0_2
; %bb.1:
Lloh2:
	adrp	x0, l_.str.1@PAGE
Lloh3:
	add	x0, x0, l_.str.1@PAGEOFF
	bl	_PWC_DEBUG_OPEN
Lloh4:
	adrp	x8, _EBUSY@GOTPAGE
Lloh5:
	ldr	x8, [x8, _EBUSY@GOTPAGEOFF]
Lloh6:
	ldr	w8, [x8]
	neg	w0, w8
	b	LBB0_20
LBB0_2:
	add	x21, x20, #24
	mov	x0, x21
	bl	_mutex_lock
	mov	x0, x20
	bl	_pwc_construct
	ldr	w8, [x20]
	cbnz	w8, LBB0_5
; %bb.3:
Lloh7:
	adrp	x0, l_.str.2@PAGE
Lloh8:
	add	x0, x0, l_.str.2@PAGEOFF
	bl	_PWC_DEBUG_OPEN
	mov	w8, #1
	str	w8, [x20]
	add	x1, sp, #28
	mov	x0, x20
	bl	_pwc_get_cmos_sensor
	tbnz	w0, #31, LBB0_5
; %bb.4:
	ldr	x8, [x20, #104]
	ldr	w0, [sp, #28]
	ldr	w23, [x8]
	bl	_pwc_sensor_type_to_string
                                        ; kill: def $w0 killed $w0 def $x0
	ldr	w8, [sp, #28]
	stp	x0, x8, [sp, #8]
	str	x23, [sp]
Lloh9:
	adrp	x0, l_.str.3@PAGE
Lloh10:
	add	x0, x0, l_.str.3@PAGEOFF
	bl	_PWC_DEBUG_OPEN
LBB0_5:
Lloh11:
	adrp	x8, _power_save@GOTPAGE
Lloh12:
	ldr	x8, [x8, _power_save@GOTPAGEOFF]
Lloh13:
	ldr	x8, [x8]
	cbz	x8, LBB0_8
; %bb.6:
	mov	x0, x20
	mov	w1, #1
	bl	_pwc_camera_power
                                        ; kill: def $w0 killed $w0 def $x0
	str	w0, [sp, #28]
	tbz	w0, #31, LBB0_8
; %bb.7:
	str	x0, [sp]
Lloh14:
	adrp	x0, l_.str.4@PAGE
Lloh15:
	add	x0, x0, l_.str.4@PAGEOFF
	bl	_PWC_DEBUG_OPEN
LBB0_8:
Lloh16:
	adrp	x8, _led_on@GOTPAGE
Lloh17:
	ldr	x8, [x8, _led_on@GOTPAGEOFF]
Lloh18:
	ldr	w1, [x8]
Lloh19:
	adrp	x8, _led_off@GOTPAGE
Lloh20:
	ldr	x8, [x8, _led_off@GOTPAGEOFF]
Lloh21:
	ldr	w2, [x8]
	mov	x0, x20
	bl	_pwc_set_leds
	tbz	x0, #63, LBB0_10
; %bb.9:
Lloh22:
	adrp	x0, l_.str.5@PAGE
Lloh23:
	add	x0, x0, l_.str.5@PAGEOFF
	bl	_PWC_DEBUG_OPEN
LBB0_10:
	mov	x0, x20
	bl	_pwc_allocate_buffers
	str	w0, [sp, #28]
	tbnz	w0, #31, LBB0_13
; %bb.11:
	mov	x0, x20
	bl	_pwc_reset_buffers
Lloh24:
	adrp	x8, _pwc_mbufs@GOTPAGE
Lloh25:
	ldr	x8, [x8, _pwc_mbufs@GOTPAGEOFF]
Lloh26:
	ldr	w23, [x8]
	cmp	w23, #1
	b.lt	LBB0_14
; %bb.12:
	ldr	x0, [x20, #96]
	lsl	x1, x23, #3
	bl	_bzero
	b	LBB0_15
LBB0_13:
Lloh27:
	adrp	x0, l_.str.6@PAGE
Lloh28:
	add	x0, x0, l_.str.6@PAGEOFF
	b	LBB0_18
LBB0_14:
	mov	w23, #0
LBB0_15:
	str	w23, [sp, #28]
	movi.2d	v0, #0000000000000000
	stur	q0, [x20, #56]
	stur	q0, [x20, #72]
	str	xzr, [x20, #88]
	mov	x0, x20
	bl	_pwc_construct
	str	xzr, [x20, #48]
Lloh29:
	adrp	x23, _pwc_image_sizes@GOTPAGE
Lloh30:
	ldr	x23, [x23, _pwc_image_sizes@GOTPAGEOFF]
	ldr	x8, [x23]
	ldr	x9, [x20, #8]
	add	x8, x8, x9, lsl #3
	ldp	w2, w1, [x8]
	ldr	w3, [x20, #16]
	ldr	w4, [x20, #40]
	mov	x0, x20
	mov	w5, #0
	bl	_pwc_set_video_mode
	str	w0, [sp, #28]
	cbz	w0, LBB0_19
; %bb.16:
Lloh31:
	adrp	x0, l_.str.7@PAGE
Lloh32:
	add	x0, x0, l_.str.7@PAGEOFF
	bl	_PWC_DEBUG_OPEN
	ldr	w8, [x20, #20]
Lloh33:
	adrp	x9, _PSZ_QSIF@GOTPAGE
Lloh34:
	ldr	x9, [x9, _PSZ_QSIF@GOTPAGEOFF]
Lloh35:
	adrp	x10, _PSZ_QCIF@GOTPAGE
Lloh36:
	ldr	x10, [x10, _PSZ_QCIF@GOTPAGEOFF]
	ldr	x11, [x23]
	cmp	w8, #729
	csel	x8, x9, x10, gt
	ldr	w8, [x8]
	add	x8, x11, x8, lsl #3
	ldp	w2, w1, [x8]
	ldr	w4, [x20, #40]
	mov	x0, x20
	mov	w3, #10
	mov	w5, #0
	bl	_pwc_set_video_mode
	str	w0, [sp, #28]
	cbz	w0, LBB0_19
; %bb.17:
Lloh37:
	adrp	x0, l_.str.8@PAGE
Lloh38:
	add	x0, x0, l_.str.8@PAGEOFF
LBB0_18:
	bl	_PWC_DEBUG_OPEN
	mov	x0, x20
	bl	_pwc_free_buffers
	mov	x0, x21
	bl	_mutex_unlock
	ldr	w0, [sp, #28]
	b	LBB0_20
LBB0_19:
	mov	x0, x20
	mov	w1, #32767
	bl	_pwc_set_brightness
	mov	x0, x20
	mov	w1, #1
	mov	w2, #0
	bl	_pwc_set_agc
	ldr	x8, [x20, #32]
	add	x8, x8, #1
	str	x8, [x20, #32]
	str	x22, [x19]
	mov	x0, x21
	bl	_mutex_unlock
Lloh39:
	adrp	x0, l_.str.9@PAGE
Lloh40:
	add	x0, x0, l_.str.9@PAGEOFF
	bl	_PWC_DEBUG_OPEN
	mov	w0, #0
LBB0_20:
	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
	add	sp, sp, #96
	ret
	.loh AdrpAdd	Lloh0, Lloh1
	.loh AdrpLdrGotLdr	Lloh4, Lloh5, Lloh6
	.loh AdrpAdd	Lloh2, Lloh3
	.loh AdrpAdd	Lloh7, Lloh8
	.loh AdrpAdd	Lloh9, Lloh10
	.loh AdrpLdrGotLdr	Lloh11, Lloh12, Lloh13
	.loh AdrpAdd	Lloh14, Lloh15
	.loh AdrpLdrGotLdr	Lloh19, Lloh20, Lloh21
	.loh AdrpLdrGotLdr	Lloh16, Lloh17, Lloh18
	.loh AdrpAdd	Lloh22, Lloh23
	.loh AdrpLdrGotLdr	Lloh24, Lloh25, Lloh26
	.loh AdrpAdd	Lloh27, Lloh28
	.loh AdrpLdrGot	Lloh29, Lloh30
	.loh AdrpLdrGot	Lloh35, Lloh36
	.loh AdrpLdrGot	Lloh33, Lloh34
	.loh AdrpAdd	Lloh31, Lloh32
	.loh AdrpAdd	Lloh37, Lloh38
	.loh AdrpAdd	Lloh39, Lloh40
	.cfi_endproc
                                        ; -- End function
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	">> video_open called(vdev = 0x%p).\n"

l_.str.1:                               ; @.str.1
	.asciz	"I'm busy, someone is using the device.\n"

	.comm	_EBUSY,4,2                      ; @EBUSY
l_.str.2:                               ; @.str.2
	.asciz	"Doing first time initialization.\n"

l_.str.3:                               ; @.str.3
	.asciz	"This %s camera is equipped with a %s (%d).\n"

	.comm	_power_save,8,3                 ; @power_save
l_.str.4:                               ; @.str.4
	.asciz	"Failed to restore power to the camera! (%d)\n"

	.comm	_led_on,4,2                     ; @led_on
	.comm	_led_off,4,2                    ; @led_off
l_.str.5:                               ; @.str.5
	.asciz	"Failed to set LED on/off time.\n"

l_.str.6:                               ; @.str.6
	.asciz	"Failed to allocate buffers memory.\n"

	.comm	_pwc_mbufs,4,2                  ; @pwc_mbufs
	.comm	_pwc_image_sizes,8,3            ; @pwc_image_sizes
l_.str.7:                               ; @.str.7
	.asciz	"First attempt at set_video_mode failed.\n"

	.comm	_PSZ_QSIF,4,2                   ; @PSZ_QSIF
	.comm	_PSZ_QCIF,4,2                   ; @PSZ_QCIF
l_.str.8:                               ; @.str.8
	.asciz	"Second attempt at set_video_mode failed.\n"

l_.str.9:                               ; @.str.9
	.asciz	"<< video_open() returns 0.\n"

	.no_dead_strip	_pwc_video_open
.subsections_via_symbols
