	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function mt9v022_g_ctrl
_mt9v022_g_ctrl:                        ## @mt9v022_g_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	%r12
	pushq	%rbx
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rsi, %r15
	callq	_v4l2_get_subdevdata
	movq	%rax, %rbx
	movl	(%r15), %esi
	movq	_mt9v022_ops@GOTPCREL(%rip), %rdi
	callq	_soc_camera_find_qctrl
	movq	%rax, %r12
	movl	(%r15), %eax
	xorl	%r14d, %r14d
	addl	$-128, %eax
	cmpl	$5, %eax
	ja	LBB0_16
## %bb.1:
	leaq	LJTI0_0(%rip), %rcx
	movslq	(%rcx,%rax,4), %rax
	addq	%rcx, %rax
	jmpq	*%rax
LBB0_2:
	movq	_MT9V022_READ_MODE@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%rbx, %rdi
	callq	_reg_read
	testl	%eax, %eax
	js	LBB0_3
## %bb.7:
	shrl	$4, %eax
	jmp	LBB0_8
LBB0_4:
	movq	_MT9V022_READ_MODE@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%rbx, %rdi
	callq	_reg_read
	testl	%eax, %eax
	js	LBB0_3
## %bb.5:
	shrl	$5, %eax
	jmp	LBB0_8
LBB0_11:
	movq	_MT9V022_ANALOG_GAIN@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%rbx, %rdi
	callq	_reg_read
	testl	%eax, %eax
	js	LBB0_3
## %bb.12:
	movq	(%r12), %rcx
	movq	8(%r12), %rsi
	subq	%rsi, %rcx
	addl	$-16, %eax
	cltq
	imulq	%rcx, %rax
	addq	$24, %rax
	movabsq	$-6148914691236517205, %rcx     ## imm = 0xAAAAAAAAAAAAAAAB
	mulq	%rcx
	shrq	$5, %rdx
	addl	%edx, %esi
	jmp	LBB0_15
LBB0_6:
	movq	_MT9V022_AEC_AGC_ENABLE@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%rbx, %rdi
	callq	_reg_read
	testl	%eax, %eax
	jns	LBB0_8
	jmp	LBB0_3
LBB0_13:
	movq	_MT9V022_TOTAL_SHUTTER_WIDTH@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%rbx, %rdi
	callq	_reg_read
	testl	%eax, %eax
	js	LBB0_3
## %bb.14:
	movq	(%r12), %rdx
	movq	8(%r12), %rsi
	subq	%rsi, %rdx
	decl	%eax
	movslq	%eax, %rcx
	imulq	%rdx, %rcx
	addq	$239, %rcx
	movabsq	$1270861282739906479, %rdx      ## imm = 0x11A3019A748267AF
	movq	%rcx, %rax
	mulq	%rdx
	subq	%rdx, %rcx
	shrq	%rcx
	addq	%rdx, %rcx
	shrq	$8, %rcx
	addl	%ecx, %esi
LBB0_15:
	movl	%esi, 4(%r15)
	jmp	LBB0_16
LBB0_9:
	movq	_MT9V022_AEC_AGC_ENABLE@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%rbx, %rdi
	callq	_reg_read
	testl	%eax, %eax
	js	LBB0_3
## %bb.10:
	shrl	%eax
LBB0_8:
	andl	$1, %eax
	movl	%eax, 4(%r15)
	jmp	LBB0_16
LBB0_3:
	movq	_EIO@GOTPCREL(%rip), %rax
	xorl	%r14d, %r14d
	subl	(%rax), %r14d
LBB0_16:
	movl	%r14d, %eax
	popq	%rbx
	popq	%r12
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
	.p2align	2, 0x90
	.data_region jt32
.set L0_0_set_2, LBB0_2-LJTI0_0
.set L0_0_set_4, LBB0_4-LJTI0_0
.set L0_0_set_11, LBB0_11-LJTI0_0
.set L0_0_set_6, LBB0_6-LJTI0_0
.set L0_0_set_13, LBB0_13-LJTI0_0
.set L0_0_set_9, LBB0_9-LJTI0_0
LJTI0_0:
	.long	L0_0_set_2
	.long	L0_0_set_4
	.long	L0_0_set_11
	.long	L0_0_set_6
	.long	L0_0_set_13
	.long	L0_0_set_9
	.end_data_region
                                        ## -- End function
	.comm	_mt9v022_ops,4,2                ## @mt9v022_ops
	.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
	.comm	_MT9V022_ANALOG_GAIN,4,2        ## @MT9V022_ANALOG_GAIN
	.comm	_MT9V022_TOTAL_SHUTTER_WIDTH,4,2 ## @MT9V022_TOTAL_SHUTTER_WIDTH
	.no_dead_strip	_mt9v022_g_ctrl
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function mt9v022_g_ctrl
_mt9v022_g_ctrl:                        ; @mt9v022_g_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	x19, x1
	bl	_v4l2_get_subdevdata
	mov	x20, x0
	ldr	w1, [x19]
Lloh0:
	adrp	x0, _mt9v022_ops@GOTPAGE
Lloh1:
	ldr	x0, [x0, _mt9v022_ops@GOTPAGEOFF]
	bl	_soc_camera_find_qctrl
	ldr	w8, [x19]
	sub	w8, w8, #128
	cmp	w8, #5
	b.hi	LBB0_4
; %bb.1:
	mov	x21, x0
Lloh2:
	adrp	x9, lJTI0_0@PAGE
Lloh3:
	add	x9, x9, lJTI0_0@PAGEOFF
	adr	x10, LBB0_2
	ldrb	w11, [x9, x8]
	add	x10, x10, x11, lsl #2
	br	x10
LBB0_2:
Lloh4:
	adrp	x8, _MT9V022_READ_MODE@GOTPAGE
Lloh5:
	ldr	x8, [x8, _MT9V022_READ_MODE@GOTPAGEOFF]
Lloh6:
	ldr	w1, [x8]
	mov	x0, x20
	bl	_reg_read
	tbnz	w0, #31, LBB0_17
; %bb.3:
	mov	x8, x0
	mov	w0, #0
	ubfx	w8, w8, #4, #1
	b	LBB0_16
LBB0_4:
	mov	w0, #0
	b	LBB0_18
LBB0_5:
Lloh7:
	adrp	x8, _MT9V022_READ_MODE@GOTPAGE
Lloh8:
	ldr	x8, [x8, _MT9V022_READ_MODE@GOTPAGEOFF]
Lloh9:
	ldr	w1, [x8]
	mov	x0, x20
	bl	_reg_read
	tbnz	w0, #31, LBB0_17
; %bb.6:
	mov	x8, x0
	mov	w0, #0
	ubfx	w8, w8, #5, #1
	b	LBB0_16
LBB0_7:
Lloh10:
	adrp	x8, _MT9V022_ANALOG_GAIN@GOTPAGE
Lloh11:
	ldr	x8, [x8, _MT9V022_ANALOG_GAIN@GOTPAGEOFF]
Lloh12:
	ldr	w1, [x8]
	mov	x0, x20
	bl	_reg_read
	tbnz	w0, #31, LBB0_17
; %bb.8:
	mov	x8, x0
	mov	w0, #0
	ldp	x9, x10, [x21]
	sub	x9, x9, x10
	sub	w8, w8, #16
	sxtw	x8, w8
	orr	x11, xzr, #0x18
	madd	x8, x9, x8, x11
	mov	x9, #-6148914691236517206
	movk	x9, #43691
	umulh	x8, x8, x9
	lsr	x8, x8, #5
	b	LBB0_13
LBB0_9:
Lloh13:
	adrp	x8, _MT9V022_AEC_AGC_ENABLE@GOTPAGE
Lloh14:
	ldr	x8, [x8, _MT9V022_AEC_AGC_ENABLE@GOTPAGEOFF]
Lloh15:
	ldr	w1, [x8]
	mov	x0, x20
	bl	_reg_read
	tbnz	w0, #31, LBB0_17
; %bb.10:
	mov	x8, x0
	mov	w0, #0
	and	w8, w8, #0x1
	b	LBB0_16
LBB0_11:
Lloh16:
	adrp	x8, _MT9V022_TOTAL_SHUTTER_WIDTH@GOTPAGE
Lloh17:
	ldr	x8, [x8, _MT9V022_TOTAL_SHUTTER_WIDTH@GOTPAGEOFF]
Lloh18:
	ldr	w1, [x8]
	mov	x0, x20
	bl	_reg_read
	tbnz	w0, #31, LBB0_17
; %bb.12:
	mov	x8, x0
	mov	w0, #0
	ldp	x9, x10, [x21]
	sub	x9, x9, x10
	sub	w8, w8, #1
	sxtw	x8, w8
	mul	x8, x9, x8
	add	x8, x8, #239
	mov	x9, #26543
	movk	x9, #29826, lsl #16
	movk	x9, #410, lsl #32
	movk	x9, #4515, lsl #48
	umulh	x9, x8, x9
	sub	x8, x8, x9
	add	x8, x9, x8, lsr #1
	lsr	x8, x8, #8
LBB0_13:
	add	w8, w8, w10
	b	LBB0_16
LBB0_14:
Lloh19:
	adrp	x8, _MT9V022_AEC_AGC_ENABLE@GOTPAGE
Lloh20:
	ldr	x8, [x8, _MT9V022_AEC_AGC_ENABLE@GOTPAGEOFF]
Lloh21:
	ldr	w1, [x8]
	mov	x0, x20
	bl	_reg_read
	tbnz	w0, #31, LBB0_17
; %bb.15:
	mov	x8, x0
	mov	w0, #0
	ubfx	w8, w8, #1, #1
LBB0_16:
	str	w8, [x19, #4]
	b	LBB0_18
LBB0_17:
Lloh22:
	adrp	x8, _EIO@GOTPAGE
Lloh23:
	ldr	x8, [x8, _EIO@GOTPAGEOFF]
Lloh24:
	ldr	w8, [x8]
	neg	w0, w8
LBB0_18:
	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 AdrpLdrGotLdr	Lloh13, Lloh14, Lloh15
	.loh AdrpLdrGotLdr	Lloh16, Lloh17, Lloh18
	.loh AdrpLdrGotLdr	Lloh19, Lloh20, Lloh21
	.loh AdrpLdrGotLdr	Lloh22, Lloh23, Lloh24
	.cfi_endproc
	.section	__TEXT,__const
lJTI0_0:
	.byte	(LBB0_2-LBB0_2)>>2
	.byte	(LBB0_5-LBB0_2)>>2
	.byte	(LBB0_7-LBB0_2)>>2
	.byte	(LBB0_9-LBB0_2)>>2
	.byte	(LBB0_11-LBB0_2)>>2
	.byte	(LBB0_14-LBB0_2)>>2
                                        ; -- End function
	.comm	_mt9v022_ops,4,2                ; @mt9v022_ops
	.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
	.comm	_MT9V022_ANALOG_GAIN,4,2        ; @MT9V022_ANALOG_GAIN
	.comm	_MT9V022_TOTAL_SHUTTER_WIDTH,4,2 ; @MT9V022_TOTAL_SHUTTER_WIDTH
	.no_dead_strip	_mt9v022_g_ctrl
.subsections_via_symbols
