	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function mt9m001_s_ctrl
_mt9m001_s_ctrl:                        ## @mt9m001_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, %r12
	callq	_v4l2_get_subdevdata
	movq	%rax, %r13
	movq	%rax, %rdi
	callq	_to_mt9m001
	movq	%rax, %r14
	movq	(%r13), %rbx
	movl	(%r12), %esi
	movq	_mt9m001_ops@GOTPCREL(%rip), %rdi
	callq	_soc_camera_find_qctrl
	testq	%rax, %rax
	je	LBB0_1
## %bb.3:
	movl	(%r12), %ecx
	xorl	%r15d, %r15d
	addl	$-128, %ecx
	cmpl	$3, %ecx
	ja	LBB0_37
## %bb.4:
	leaq	LJTI0_0(%rip), %rdx
	movslq	(%rdx,%rcx,4), %rcx
	addq	%rdx, %rcx
	jmpq	*%rcx
LBB0_5:
	cmpq	$0, 8(%r12)
	movq	_MT9M001_READ_OPTIONS2@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%r13, %rdi
	movl	$32768, %edx                    ## imm = 0x8000
	je	LBB0_7
## %bb.6:
	callq	_reg_set
	testl	%eax, %eax
	jns	LBB0_37
	jmp	LBB0_9
LBB0_33:
	cmpq	$0, 8(%r12)
	je	LBB0_36
## %bb.34:
	movl	16(%r14), %r12d
	movq	%r14, -48(%rbp)                 ## 8-byte Spill
	movl	20(%r14), %r14d
	leal	(%r12,%r14), %edx
	addl	$25, %edx
	movq	_MT9M001_SHUTTER_WIDTH@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%r13, %rdi
	callq	_reg_write
	testl	%eax, %eax
	js	LBB0_9
## %bb.35:
	addl	%r14d, %r12d
	movq	(%rbx), %rdi
	movl	$131, %esi
	callq	_soc_camera_find_qctrl
	addl	$24, %r12d
	movq	(%rax), %rcx
	movq	8(%rax), %rsi
	subq	%rsi, %rcx
	imulq	%r12, %rcx
	addq	$524, %rcx                      ## imm = 0x20C
	movabsq	$281629680514649643, %rdx       ## imm = 0x3E88CB3C9484E2B
	movq	%rcx, %rax
	mulq	%rdx
	shrq	$4, %rdx
	addl	%esi, %edx
	movq	-48(%rbp), %rax                 ## 8-byte Reload
	movl	%edx, 8(%rax)
	movl	$1, 12(%rax)
	jmp	LBB0_37
LBB0_26:
	movq	8(%r12), %rdx
	movq	(%rax), %rcx
	cmpq	%rcx, %rdx
	ja	LBB0_1
## %bb.27:
	movq	8(%rax), %rax
	subq	%rax, %rdx
	jb	LBB0_1
## %bb.28:
	subq	%rax, %rcx
	imulq	$1048, %rdx, %rdx               ## imm = 0x418
	movq	%rcx, %rax
	shrq	%rax
	addq	%rdx, %rax
	movq	%rax, %rdx
	orq	%rcx, %rdx
	shrq	$32, %rdx
	movq	%r14, -48(%rbp)                 ## 8-byte Spill
	je	LBB0_29
## %bb.30:
	xorl	%edx, %edx
	divq	%rcx
	movq	%rax, %rbx
	jmp	LBB0_31
LBB0_10:
	movq	8(%r12), %rdx
	movq	(%rax), %rcx
	cmpq	%rcx, %rdx
	ja	LBB0_1
## %bb.11:
	movq	8(%rax), %rbx
	movq	%rdx, %rdi
	subq	%rbx, %rdi
	jae	LBB0_12
LBB0_1:
	movq	_EINVAL@GOTPCREL(%rip), %rax
LBB0_2:
	xorl	%r15d, %r15d
	subl	(%rax), %r15d
LBB0_37:
	movl	%r15d, %eax
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_36:
	movl	$0, 12(%r14)
	jmp	LBB0_37
LBB0_7:
	callq	_reg_clear
	testl	%eax, %eax
	jns	LBB0_37
	jmp	LBB0_9
LBB0_12:
	movq	16(%rax), %rsi
	cmpq	%rsi, %rdx
	jbe	LBB0_13
## %bb.17:
	notq	%rsi
	addq	%rsi, %rcx
	addq	%rsi, %rdx
	imulq	$111, %rdx, %rdx
	movq	%rcx, %rax
	shrq	%rax
	addq	%rdx, %rax
	movq	%rax, %rdx
	orq	%rcx, %rdx
	shrq	$32, %rdx
	je	LBB0_18
## %bb.19:
	xorl	%edx, %edx
	divq	%rcx
	jmp	LBB0_20
LBB0_13:
	subq	%rbx, %rsi
	movq	%rsi, %rax
	shrq	%rax
	leaq	(%rax,%rdi,8), %rax
	movq	%rax, %rcx
	orq	%rsi, %rcx
	shrq	$32, %rcx
	je	LBB0_14
## %bb.15:
	xorl	%edx, %edx
	divq	%rsi
	movq	%rax, %rbx
	jmp	LBB0_16
LBB0_29:
                                        ## kill: def $eax killed $eax killed $rax
	xorl	%edx, %edx
	divl	%ecx
	movl	%eax, %ebx
LBB0_31:
	incq	%rbx
	movq	_MT9M001_SHUTTER_WIDTH@GOTPCREL(%rip), %r14
	movl	(%r14), %esi
	movq	%r13, %rdi
	callq	_reg_read
	leaq	L_.str.2(%rip), %rsi
	xorl	%r15d, %r15d
	movq	%r13, %rdi
	movl	%eax, %edx
	movq	%rbx, %rcx
	xorl	%eax, %eax
	callq	_dev_dbg
	movl	(%r14), %esi
	movq	%r13, %rdi
	movl	%ebx, %edx
	callq	_reg_write
	testl	%eax, %eax
	js	LBB0_9
## %bb.32:
	movl	8(%r12), %eax
	movq	-48(%rbp), %rcx                 ## 8-byte Reload
	movl	%eax, 8(%rcx)
	movl	$0, 12(%rcx)
	jmp	LBB0_37
LBB0_18:
                                        ## kill: def $eax killed $eax killed $rax
	xorl	%edx, %edx
	divl	%ecx
                                        ## kill: def $eax killed $eax def $rax
LBB0_20:
	leaq	9(%rax), %rbx
	cmpq	$32, %rbx
	movq	%r14, -48(%rbp)                 ## 8-byte Spill
	jbe	LBB0_24
## %bb.21:
	cmpq	$64, %rbx
	ja	LBB0_23
## %bb.22:
	shlq	$4, %rax
	movabsq	$137438953120, %rbx             ## imm = 0x1FFFFFFEA0
	addq	%rax, %rbx
	shrq	$5, %rbx
	addl	$80, %ebx
	jmp	LBB0_24
LBB0_14:
                                        ## kill: def $eax killed $eax killed $rax
	xorl	%edx, %edx
	divl	%esi
	movl	%eax, %ebx
LBB0_16:
	leaq	L_.str(%rip), %rsi
	movq	%r13, %rdi
	movl	%ebx, %edx
	xorl	%eax, %eax
	callq	_dev_dbg
	movq	_MT9M001_GLOBAL_GAIN@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%r13, %rdi
	movl	%ebx, %edx
	callq	_reg_write
	testl	%eax, %eax
	jns	LBB0_25
LBB0_9:
	movq	_EIO@GOTPCREL(%rip), %rax
	jmp	LBB0_2
LBB0_23:
	leaq	(,%rax,8), %rcx
	subq	%rax, %rcx
	addq	$-357, %rcx                     ## imm = 0xFE9B
	shrq	$3, %rcx
	movabsq	$2635249153387078803, %rdx      ## imm = 0x2492492492492493
	movq	%rcx, %rax
	mulq	%rdx
	movq	%rdx, %rbx
	addl	$96, %ebx
LBB0_24:
	movq	_MT9M001_GLOBAL_GAIN@GOTPCREL(%rip), %r14
	movl	(%r14), %esi
	movq	%r13, %rdi
	callq	_reg_read
	leaq	L_.str.1(%rip), %rsi
	movq	%r13, %rdi
	movl	%eax, %edx
	movl	%ebx, %ecx
	xorl	%eax, %eax
	callq	_dev_dbg
	movl	(%r14), %esi
	movq	%r13, %rdi
	movl	%ebx, %edx
	callq	_reg_write
	testl	%eax, %eax
	movq	-48(%rbp), %r14                 ## 8-byte Reload
	js	LBB0_9
LBB0_25:
	movq	8(%r12), %rax
	movq	%rax, (%r14)
	jmp	LBB0_37
	.cfi_endproc
	.p2align	2, 0x90
	.data_region jt32
.set L0_0_set_5, LBB0_5-LJTI0_0
.set L0_0_set_10, LBB0_10-LJTI0_0
.set L0_0_set_33, LBB0_33-LJTI0_0
.set L0_0_set_26, LBB0_26-LJTI0_0
LJTI0_0:
	.long	L0_0_set_5
	.long	L0_0_set_10
	.long	L0_0_set_33
	.long	L0_0_set_26
	.end_data_region
                                        ## -- End function
	.comm	_mt9m001_ops,4,2                ## @mt9m001_ops
	.comm	_EINVAL,4,2                     ## @EINVAL
	.comm	_MT9M001_READ_OPTIONS2,4,2      ## @MT9M001_READ_OPTIONS2
	.comm	_EIO,4,2                        ## @EIO
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"Setting gain %d\n"

	.comm	_MT9M001_GLOBAL_GAIN,4,2        ## @MT9M001_GLOBAL_GAIN
L_.str.1:                               ## @.str.1
	.asciz	"Setting gain from %d to %d\n"

L_.str.2:                               ## @.str.2
	.asciz	"Setting shutter width from %d to %lu\n"

	.comm	_MT9M001_SHUTTER_WIDTH,4,2      ## @MT9M001_SHUTTER_WIDTH
	.no_dead_strip	_mt9m001_s_ctrl
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function mt9m001_s_ctrl
_mt9m001_s_ctrl:                        ; @mt9m001_s_ctrl
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #80
	.cfi_def_cfa_offset 80
	stp	x24, x23, [sp, #16]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #32]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #48]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #64]             ; 16-byte Folded Spill
	add	x29, sp, #64
	.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	x20, x1
	bl	_v4l2_get_subdevdata
	mov	x21, x0
	bl	_to_mt9m001
	mov	x19, x0
	ldr	x22, [x21]
	ldr	w1, [x20]
Lloh0:
	adrp	x0, _mt9m001_ops@GOTPAGE
Lloh1:
	ldr	x0, [x0, _mt9m001_ops@GOTPAGEOFF]
	bl	_soc_camera_find_qctrl
	cbz	x0, LBB0_14
; %bb.1:
	ldr	w8, [x20]
	sub	w8, w8, #128
	cmp	w8, #3
	b.hi	LBB0_19
; %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, _MT9M001_READ_OPTIONS2@GOTPAGE
Lloh5:
	ldr	x9, [x9, _MT9M001_READ_OPTIONS2@GOTPAGEOFF]
Lloh6:
	ldr	w1, [x9]
	mov	x0, x21
	mov	w2, #32768
	cbz	x8, LBB0_18
; %bb.4:
	bl	_reg_set
	tbz	w0, #31, LBB0_19
	b	LBB0_31
LBB0_5:
	ldr	x8, [x20, #8]
	cbz	x8, LBB0_16
; %bb.6:
	ldp	w9, w8, [x19, #16]
	add	w20, w9, w8
	add	w2, w20, #25
Lloh7:
	adrp	x8, _MT9M001_SHUTTER_WIDTH@GOTPAGE
Lloh8:
	ldr	x8, [x8, _MT9M001_SHUTTER_WIDTH@GOTPAGEOFF]
Lloh9:
	ldr	w1, [x8]
	mov	x0, x21
	bl	_reg_write
	tbnz	w0, #31, LBB0_31
; %bb.7:
	ldr	x0, [x22]
	mov	w1, #131
	bl	_soc_camera_find_qctrl
	mov	x8, x0
	mov	w0, #0
	add	w9, w20, #24
	ldp	x10, x8, [x8]
	sub	x10, x10, x8
	mul	x9, x10, x9
	add	x9, x9, #524
	mov	x10, #20011
	movk	x10, #51528, lsl #16
	movk	x10, #36019, lsl #32
	movk	x10, #1000, lsl #48
	umulh	x9, x9, x10
	lsr	x9, x9, #4
	add	w8, w9, w8
	mov	w9, #1
	stp	w8, w9, [x19, #8]
	b	LBB0_20
LBB0_8:
	ldr	x9, [x20, #8]
	ldr	x8, [x0]
	cmp	x9, x8
	b.hi	LBB0_14
; %bb.9:
	ldr	x10, [x0, #8]
	subs	x9, x9, x10
	b.lo	LBB0_14
; %bb.10:
	sub	x8, x8, x10
	mov	w10, #1048
	mul	x9, x9, x10
	add	x9, x9, x8, lsr #1
	udiv	x8, x9, x8
	add	x22, x8, #1
Lloh10:
	adrp	x23, _MT9M001_SHUTTER_WIDTH@GOTPAGE
Lloh11:
	ldr	x23, [x23, _MT9M001_SHUTTER_WIDTH@GOTPAGEOFF]
	ldr	w1, [x23]
	mov	x0, x21
	bl	_reg_read
	mov	x2, x0
	str	x22, [sp]
Lloh12:
	adrp	x1, l_.str.2@PAGE
Lloh13:
	add	x1, x1, l_.str.2@PAGEOFF
	mov	x0, x21
	bl	_dev_dbg
	ldr	w1, [x23]
	mov	x0, x21
	mov	x2, x22
	bl	_reg_write
	tbnz	w0, #31, LBB0_31
; %bb.11:
	mov	w0, #0
	ldr	x8, [x20, #8]
	str	w8, [x19, #8]
	b	LBB0_17
LBB0_12:
	ldr	x8, [x20, #8]
	ldr	x9, [x0]
	cmp	x8, x9
	b.hi	LBB0_14
; %bb.13:
	ldr	x11, [x0, #8]
	subs	x10, x8, x11
	b.hs	LBB0_21
LBB0_14:
Lloh14:
	adrp	x8, _EINVAL@GOTPAGE
Lloh15:
	ldr	x8, [x8, _EINVAL@GOTPAGEOFF]
LBB0_15:
	ldr	w8, [x8]
	neg	w0, w8
	b	LBB0_20
LBB0_16:
	mov	w0, #0
LBB0_17:
	str	wzr, [x19, #12]
	b	LBB0_20
LBB0_18:
	bl	_reg_clear
	tbnz	w0, #31, LBB0_31
LBB0_19:
	mov	w0, #0
LBB0_20:
	ldp	x29, x30, [sp, #64]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #48]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #32]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #16]             ; 16-byte Folded Reload
	add	sp, sp, #80
	ret
LBB0_21:
	ldr	x12, [x0, #16]
	cmp	x8, x12
	b.ls	LBB0_24
; %bb.22:
	mvn	x10, x12
	add	x9, x9, x10
	add	x8, x8, x10
	mov	w10, #111
	mul	x8, x8, x10
	add	x8, x8, x9, lsr #1
	udiv	x8, x8, x9
	add	x22, x8, #9
	cmp	x22, #32
	b.hi	LBB0_25
; %bb.23:
                                        ; kill: def $w22 killed $w22 killed $x22 def $x22
	b	LBB0_28
LBB0_24:
	sub	x8, x12, x11
	lsr	x9, x8, #1
	add	x9, x9, x10, lsl #3
	udiv	x22, x9, x8
Lloh16:
	adrp	x1, l_.str@PAGE
Lloh17:
	add	x1, x1, l_.str@PAGEOFF
	mov	x0, x21
	mov	x2, x22
	bl	_dev_dbg
Lloh18:
	adrp	x8, _MT9M001_GLOBAL_GAIN@GOTPAGE
Lloh19:
	ldr	x8, [x8, _MT9M001_GLOBAL_GAIN@GOTPAGEOFF]
Lloh20:
	ldr	w1, [x8]
	b	LBB0_29
LBB0_25:
	cmp	x22, #64
	b.hi	LBB0_27
; %bb.26:
	mov	x9, #137438887936
	movk	x9, #65184
	add	x8, x9, x8, lsl #4
	lsr	x8, x8, #5
	add	w22, w8, #80
	b	LBB0_28
LBB0_27:
	lsl	x9, x8, #3
	sub	x8, x9, x8
	sub	x8, x8, #357
	lsr	x8, x8, #3
	mov	x9, #9363
	movk	x9, #37449, lsl #16
	movk	x9, #18724, lsl #32
	movk	x9, #9362, lsl #48
	umulh	x8, x8, x9
	add	w22, w8, #96
LBB0_28:
Lloh21:
	adrp	x23, _MT9M001_GLOBAL_GAIN@GOTPAGE
Lloh22:
	ldr	x23, [x23, _MT9M001_GLOBAL_GAIN@GOTPAGEOFF]
	ldr	w1, [x23]
	mov	x0, x21
	bl	_reg_read
	mov	x2, x0
	str	x22, [sp]
Lloh23:
	adrp	x1, l_.str.1@PAGE
Lloh24:
	add	x1, x1, l_.str.1@PAGEOFF
	mov	x0, x21
	bl	_dev_dbg
	ldr	w1, [x23]
LBB0_29:
	mov	x0, x21
	mov	x2, x22
	bl	_reg_write
	tbnz	w0, #31, LBB0_31
; %bb.30:
	mov	w0, #0
	ldr	x8, [x20, #8]
	str	x8, [x19]
	b	LBB0_20
LBB0_31:
Lloh25:
	adrp	x8, _EIO@GOTPAGE
Lloh26:
	ldr	x8, [x8, _EIO@GOTPAGEOFF]
	b	LBB0_15
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpAdd	Lloh2, Lloh3
	.loh AdrpLdrGotLdr	Lloh4, Lloh5, Lloh6
	.loh AdrpLdrGotLdr	Lloh7, Lloh8, Lloh9
	.loh AdrpAdd	Lloh12, Lloh13
	.loh AdrpLdrGot	Lloh10, Lloh11
	.loh AdrpLdrGot	Lloh14, Lloh15
	.loh AdrpLdrGotLdr	Lloh18, Lloh19, Lloh20
	.loh AdrpAdd	Lloh16, Lloh17
	.loh AdrpAdd	Lloh23, Lloh24
	.loh AdrpLdrGot	Lloh21, Lloh22
	.loh AdrpLdrGot	Lloh25, Lloh26
	.cfi_endproc
	.section	__TEXT,__const
lJTI0_0:
	.byte	(LBB0_3-LBB0_3)>>2
	.byte	(LBB0_12-LBB0_3)>>2
	.byte	(LBB0_5-LBB0_3)>>2
	.byte	(LBB0_8-LBB0_3)>>2
                                        ; -- End function
	.comm	_mt9m001_ops,4,2                ; @mt9m001_ops
	.comm	_EINVAL,4,2                     ; @EINVAL
	.comm	_MT9M001_READ_OPTIONS2,4,2      ; @MT9M001_READ_OPTIONS2
	.comm	_EIO,4,2                        ; @EIO
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"Setting gain %d\n"

	.comm	_MT9M001_GLOBAL_GAIN,4,2        ; @MT9M001_GLOBAL_GAIN
l_.str.1:                               ; @.str.1
	.asciz	"Setting gain from %d to %d\n"

l_.str.2:                               ; @.str.2
	.asciz	"Setting shutter width from %d to %lu\n"

	.comm	_MT9M001_SHUTTER_WIDTH,4,2      ; @MT9M001_SHUTTER_WIDTH
	.no_dead_strip	_mt9m001_s_ctrl
.subsections_via_symbols
