	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function mt9v022_s_ctrl
_mt9v022_s_ctrl:                        ## @mt9v022_s_ctrl
	.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	%rsi, %rbx
	callq	_v4l2_get_subdevdata
	movq	%rax, %r14
	movl	(%rbx), %esi
	movq	_mt9v022_ops@GOTPCREL(%rip), %rdi
	callq	_soc_camera_find_qctrl
	testq	%rax, %rax
	je	LBB0_16
## %bb.1:
	movl	(%rbx), %ecx
	xorl	%r15d, %r15d
	addl	$-128, %ecx
	cmpl	$5, %ecx
	ja	LBB0_22
## %bb.2:
	leaq	LJTI0_0(%rip), %rdx
	movslq	(%rdx,%rcx,4), %rcx
	addq	%rdx, %rcx
	jmpq	*%rcx
LBB0_3:
	cmpq	$0, 8(%rbx)
	movq	_MT9V022_READ_MODE@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%r14, %rdi
	movl	$16, %edx
	je	LBB0_19
LBB0_4:
	callq	_reg_set
	testl	%eax, %eax
	jns	LBB0_22
	jmp	LBB0_20
LBB0_5:
	cmpq	$0, 8(%rbx)
	movq	_MT9V022_READ_MODE@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%r14, %rdi
	movl	$32, %edx
	jne	LBB0_4
	jmp	LBB0_19
LBB0_7:
	movq	8(%rbx), %rbx
	movq	(%rax), %r12
	cmpq	%r12, %rbx
	ja	LBB0_16
## %bb.8:
	movq	8(%rax), %r13
	subq	%r13, %rbx
	jb	LBB0_16
## %bb.9:
	movq	_MT9V022_AEC_AGC_ENABLE@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%r14, %rdi
	movl	$2, %edx
	callq	_reg_clear
	testl	%eax, %eax
	js	LBB0_20
## %bb.10:
	leaq	(%rbx,%rbx,2), %rcx
	shlq	$4, %rcx
	subq	%r13, %r12
	movq	%r12, %rax
	shrq	%rax
	addq	%rcx, %rax
	movq	%rax, %rcx
	orq	%r12, %rcx
	shrq	$32, %rcx
	je	LBB0_26
## %bb.11:
	xorl	%edx, %edx
	divq	%r12
	jmp	LBB0_27
LBB0_12:
	cmpq	$0, 8(%rbx)
	movq	_MT9V022_AEC_AGC_ENABLE@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%r14, %rdi
	movl	$1, %edx
	jne	LBB0_4
LBB0_19:
	callq	_reg_clear
	testl	%eax, %eax
	jns	LBB0_22
LBB0_20:
	movq	_EIO@GOTPCREL(%rip), %rax
	jmp	LBB0_21
LBB0_14:
	movq	8(%rbx), %rbx
	movq	(%rax), %r12
	cmpq	%r12, %rbx
	ja	LBB0_16
## %bb.15:
	movq	8(%rax), %r13
	subq	%r13, %rbx
	jae	LBB0_23
LBB0_16:
	movq	_EINVAL@GOTPCREL(%rip), %rax
LBB0_21:
	xorl	%r15d, %r15d
	subl	(%rax), %r15d
LBB0_22:
	movl	%r15d, %eax
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_17:
	cmpq	$0, 8(%rbx)
	movq	_MT9V022_AEC_AGC_ENABLE@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%r14, %rdi
	movl	$2, %edx
	jne	LBB0_4
	jmp	LBB0_19
LBB0_23:
	movq	_MT9V022_AEC_AGC_ENABLE@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%r14, %rdi
	movl	$1, %edx
	callq	_reg_clear
	testl	%eax, %eax
	js	LBB0_20
## %bb.24:
	imulq	$479, %rbx, %rcx                ## imm = 0x1DF
	subq	%r13, %r12
	movq	%r12, %rax
	shrq	%rax
	addq	%rcx, %rax
	movq	%rax, %rcx
	orq	%r12, %rcx
	shrq	$32, %rcx
	je	LBB0_28
## %bb.25:
	xorl	%edx, %edx
	divq	%r12
	movq	%rax, %rbx
	jmp	LBB0_29
LBB0_26:
                                        ## kill: def $eax killed $eax killed $rax
	xorl	%edx, %edx
	divl	%r12d
                                        ## kill: def $eax killed $eax def $rax
LBB0_27:
	addq	$16, %rax
	movq	%rax, %rbx
	andq	$-2, %rbx
	cmpq	$32, %rax
	cmovbq	%rax, %rbx
	movq	_MT9V022_ANALOG_GAIN@GOTPCREL(%rip), %r12
	movl	(%r12), %esi
	movq	%r14, %rdi
	callq	_reg_read
	leaq	L_.str(%rip), %rsi
	jmp	LBB0_30
LBB0_28:
                                        ## kill: def $eax killed $eax killed $rax
	xorl	%edx, %edx
	divl	%r12d
	movl	%eax, %ebx
LBB0_29:
	incq	%rbx
	movq	_MT9V022_TOTAL_SHUTTER_WIDTH@GOTPCREL(%rip), %r12
	movl	(%r12), %esi
	movq	%r14, %rdi
	callq	_reg_read
	leaq	L_.str.1(%rip), %rsi
LBB0_30:
	movq	%r14, %rdi
	movl	%eax, %edx
	movq	%rbx, %rcx
	callq	_dev_dbg
	movl	(%r12), %esi
	movq	%r14, %rdi
	movq	%rbx, %rdx
	callq	_reg_write
	testl	%eax, %eax
	jns	LBB0_22
	jmp	LBB0_20
	.cfi_endproc
	.p2align	2, 0x90
	.data_region jt32
.set L0_0_set_3, LBB0_3-LJTI0_0
.set L0_0_set_5, LBB0_5-LJTI0_0
.set L0_0_set_7, LBB0_7-LJTI0_0
.set L0_0_set_12, LBB0_12-LJTI0_0
.set L0_0_set_14, LBB0_14-LJTI0_0
.set L0_0_set_17, LBB0_17-LJTI0_0
LJTI0_0:
	.long	L0_0_set_3
	.long	L0_0_set_5
	.long	L0_0_set_7
	.long	L0_0_set_12
	.long	L0_0_set_14
	.long	L0_0_set_17
	.end_data_region
                                        ## -- End function
	.comm	_mt9v022_ops,4,2                ## @mt9v022_ops
	.comm	_EINVAL,4,2                     ## @EINVAL
	.comm	_MT9V022_READ_MODE,4,2          ## @MT9V022_READ_MODE
	.comm	_EIO,4,2                        ## @EIO
	.comm	_MT9V022_AEC_AGC_ENABLE,4,2     ## @MT9V022_AEC_AGC_ENABLE
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"Setting gain from %d to %lu\n"

	.comm	_MT9V022_ANALOG_GAIN,4,2        ## @MT9V022_ANALOG_GAIN
L_.str.1:                               ## @.str.1
	.asciz	"Shutter width from %d to %lu\n"

	.comm	_MT9V022_TOTAL_SHUTTER_WIDTH,4,2 ## @MT9V022_TOTAL_SHUTTER_WIDTH
	.no_dead_strip	_mt9v022_s_ctrl
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function mt9v022_s_ctrl
_mt9v022_s_ctrl:                        ; @mt9v022_s_ctrl
	.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	x20, x1
	bl	_v4l2_get_subdevdata
	mov	x19, x0
	ldr	w1, [x20]
Lloh0:
	adrp	x0, _mt9v022_ops@GOTPAGE
Lloh1:
	ldr	x0, [x0, _mt9v022_ops@GOTPAGEOFF]
	bl	_soc_camera_find_qctrl
	cbz	x0, LBB0_15
; %bb.1:
	ldr	w8, [x20]
	sub	w8, w8, #128
	cmp	w8, #5
	b.hi	LBB0_12
; %bb.2:
Lloh2:
	adrp	x9, lJTI0_0@PAGE
Lloh3:
	add	x9, x9, lJTI0_0@PAGEOFF
	adr	x10, LBB0_3
	ldrb	w11, [x9, x8]
	add	x10, x10, x11, lsl #2
	br	x10
LBB0_3:
	ldr	x8, [x20, #8]
Lloh4:
	adrp	x9, _MT9V022_READ_MODE@GOTPAGE
Lloh5:
	ldr	x9, [x9, _MT9V022_READ_MODE@GOTPAGEOFF]
Lloh6:
	ldr	w1, [x9]
	mov	x0, x19
	mov	w2, #16
	cbz	x8, LBB0_11
LBB0_4:
	bl	_reg_set
	tbz	w0, #31, LBB0_12
	b	LBB0_20
LBB0_5:
	ldr	x8, [x20, #8]
Lloh7:
	adrp	x9, _MT9V022_READ_MODE@GOTPAGE
Lloh8:
	ldr	x9, [x9, _MT9V022_READ_MODE@GOTPAGEOFF]
Lloh9:
	ldr	w1, [x9]
	mov	x0, x19
	mov	w2, #32
	cbnz	x8, LBB0_4
	b	LBB0_11
LBB0_6:
	ldr	x8, [x20, #8]
	ldr	x20, [x0]
	cmp	x8, x20
	b.hi	LBB0_15
; %bb.7:
	ldr	x21, [x0, #8]
	subs	x22, x8, x21
	b.lo	LBB0_15
; %bb.8:
Lloh10:
	adrp	x8, _MT9V022_AEC_AGC_ENABLE@GOTPAGE
Lloh11:
	ldr	x8, [x8, _MT9V022_AEC_AGC_ENABLE@GOTPAGEOFF]
Lloh12:
	ldr	w1, [x8]
	mov	x0, x19
	mov	w2, #2
	bl	_reg_clear
	tbnz	w0, #31, LBB0_20
; %bb.9:
	mov	w8, #48
	mul	x8, x22, x8
	sub	x9, x20, x21
	add	x8, x8, x9, lsr #1
	udiv	x8, x8, x9
	add	x8, x8, #16
	and	x9, x8, #0xfffffffffffffffe
	cmp	x8, #31
	csel	x20, x9, x8, hi
Lloh13:
	adrp	x21, _MT9V022_ANALOG_GAIN@GOTPAGE
Lloh14:
	ldr	x21, [x21, _MT9V022_ANALOG_GAIN@GOTPAGEOFF]
	ldr	w1, [x21]
	mov	x0, x19
	bl	_reg_read
	mov	x2, x0
Lloh15:
	adrp	x1, l_.str@PAGE
Lloh16:
	add	x1, x1, l_.str@PAGEOFF
	b	LBB0_19
LBB0_10:
	ldr	x8, [x20, #8]
Lloh17:
	adrp	x9, _MT9V022_AEC_AGC_ENABLE@GOTPAGE
Lloh18:
	ldr	x9, [x9, _MT9V022_AEC_AGC_ENABLE@GOTPAGEOFF]
Lloh19:
	ldr	w1, [x9]
	mov	x0, x19
	mov	w2, #1
	cbnz	x8, LBB0_4
LBB0_11:
	bl	_reg_clear
	tbnz	w0, #31, LBB0_20
LBB0_12:
	mov	w0, #0
	b	LBB0_22
LBB0_13:
	ldr	x8, [x20, #8]
	ldr	x20, [x0]
	cmp	x8, x20
	b.hi	LBB0_15
; %bb.14:
	ldr	x21, [x0, #8]
	subs	x22, x8, x21
	b.hs	LBB0_17
LBB0_15:
Lloh20:
	adrp	x8, _EINVAL@GOTPAGE
Lloh21:
	ldr	x8, [x8, _EINVAL@GOTPAGEOFF]
	b	LBB0_21
LBB0_16:
	ldr	x8, [x20, #8]
Lloh22:
	adrp	x9, _MT9V022_AEC_AGC_ENABLE@GOTPAGE
Lloh23:
	ldr	x9, [x9, _MT9V022_AEC_AGC_ENABLE@GOTPAGEOFF]
Lloh24:
	ldr	w1, [x9]
	mov	x0, x19
	mov	w2, #2
	cbnz	x8, LBB0_4
	b	LBB0_11
LBB0_17:
Lloh25:
	adrp	x8, _MT9V022_AEC_AGC_ENABLE@GOTPAGE
Lloh26:
	ldr	x8, [x8, _MT9V022_AEC_AGC_ENABLE@GOTPAGEOFF]
Lloh27:
	ldr	w1, [x8]
	mov	x0, x19
	mov	w2, #1
	bl	_reg_clear
	tbnz	w0, #31, LBB0_20
; %bb.18:
	mov	w8, #479
	mul	x8, x22, x8
	sub	x9, x20, x21
	add	x8, x8, x9, lsr #1
	udiv	x8, x8, x9
	add	x20, x8, #1
Lloh28:
	adrp	x21, _MT9V022_TOTAL_SHUTTER_WIDTH@GOTPAGE
Lloh29:
	ldr	x21, [x21, _MT9V022_TOTAL_SHUTTER_WIDTH@GOTPAGEOFF]
	ldr	w1, [x21]
	mov	x0, x19
	bl	_reg_read
	mov	x2, x0
Lloh30:
	adrp	x1, l_.str.1@PAGE
Lloh31:
	add	x1, x1, l_.str.1@PAGEOFF
LBB0_19:
	mov	x0, x19
	mov	x3, x20
	bl	_dev_dbg
	ldr	w1, [x21]
	mov	x0, x19
	mov	x2, x20
	bl	_reg_write
	tbz	w0, #31, LBB0_12
LBB0_20:
Lloh32:
	adrp	x8, _EIO@GOTPAGE
Lloh33:
	ldr	x8, [x8, _EIO@GOTPAGEOFF]
LBB0_21:
	ldr	w8, [x8]
	neg	w0, w8
LBB0_22:
	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
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpAdd	Lloh2, Lloh3
	.loh AdrpLdrGotLdr	Lloh4, Lloh5, Lloh6
	.loh AdrpLdrGotLdr	Lloh7, Lloh8, Lloh9
	.loh AdrpLdrGotLdr	Lloh10, Lloh11, Lloh12
	.loh AdrpAdd	Lloh15, Lloh16
	.loh AdrpLdrGot	Lloh13, Lloh14
	.loh AdrpLdrGotLdr	Lloh17, Lloh18, Lloh19
	.loh AdrpLdrGot	Lloh20, Lloh21
	.loh AdrpLdrGotLdr	Lloh22, Lloh23, Lloh24
	.loh AdrpLdrGotLdr	Lloh25, Lloh26, Lloh27
	.loh AdrpAdd	Lloh30, Lloh31
	.loh AdrpLdrGot	Lloh28, Lloh29
	.loh AdrpLdrGot	Lloh32, Lloh33
	.cfi_endproc
	.section	__TEXT,__const
lJTI0_0:
	.byte	(LBB0_3-LBB0_3)>>2
	.byte	(LBB0_5-LBB0_3)>>2
	.byte	(LBB0_6-LBB0_3)>>2
	.byte	(LBB0_10-LBB0_3)>>2
	.byte	(LBB0_13-LBB0_3)>>2
	.byte	(LBB0_16-LBB0_3)>>2
                                        ; -- End function
	.comm	_mt9v022_ops,4,2                ; @mt9v022_ops
	.comm	_EINVAL,4,2                     ; @EINVAL
	.comm	_MT9V022_READ_MODE,4,2          ; @MT9V022_READ_MODE
	.comm	_EIO,4,2                        ; @EIO
	.comm	_MT9V022_AEC_AGC_ENABLE,4,2     ; @MT9V022_AEC_AGC_ENABLE
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"Setting gain from %d to %lu\n"

	.comm	_MT9V022_ANALOG_GAIN,4,2        ; @MT9V022_ANALOG_GAIN
l_.str.1:                               ; @.str.1
	.asciz	"Shutter width from %d to %lu\n"

	.comm	_MT9V022_TOTAL_SHUTTER_WIDTH,4,2 ; @MT9V022_TOTAL_SHUTTER_WIDTH
	.no_dead_strip	_mt9v022_s_ctrl
.subsections_via_symbols
