	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function mt9m111_set_selection
_mt9m111_set_selection:                 ## @mt9m111_set_selection
	.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
	subq	$40, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rdx, %rbx
	callq	_v4l2_get_subdevdata
	movq	%rax, %rdi
	callq	_to_mt9m111
	movq	%rax, %r13
	movups	16(%rbx), %xmm0
	movups	32(%rbx), %xmm1
	movaps	%xmm1, -64(%rbp)
	movaps	%xmm0, -80(%rbp)
	movq	(%rbx), %rax
	movq	_V4L2_SUBDEV_FORMAT_ACTIVE@GOTPCREL(%rip), %rcx
	cmpq	(%rcx), %rax
	jne	LBB0_2
## %bb.1:
	movq	8(%rbx), %rax
	movq	_V4L2_SEL_TGT_CROP@GOTPCREL(%rip), %rcx
	cmpq	(%rcx), %rax
	jne	LBB0_2
## %bb.3:
	movq	40(%r13), %rax
	movq	(%rax), %rax
	movq	_MEDIA_BUS_FMT_SBGGR8_1X8@GOTPCREL(%rip), %rcx
	cmpq	(%rcx), %rax
	sete	%cl
	movq	_MEDIA_BUS_FMT_SBGGR10_2X8_PADHI_LE@GOTPCREL(%rip), %rdx
	cmpq	(%rdx), %rax
	sete	%al
	orb	%cl, %al
	movzbl	%al, %ecx
	leaq	-72(%rbp), %rdi
	movq	_MT9M111_MAX_WIDTH@GOTPCREL(%rip), %rbx
	movq	(%rbx), %rdx
	movq	_MT9M111_MAX_HEIGHT@GOTPCREL(%rip), %r15
	subq	$8, %rsp
	leaq	-80(%rbp), %r14
	movl	$2, %esi
	movq	%r14, %r8
	movl	$2, %r9d
	pushq	$0
	pushq	%rcx
	pushq	(%r15)
	callq	_v4l_bound_align_image
	addq	$32, %rsp
	movq	-56(%rbp), %rdi
	movq	_MT9M111_MIN_DARK_COLS@GOTPCREL(%rip), %rax
	movq	(%rax), %rsi
	movq	(%rbx), %rdx
	addq	%rsi, %rdx
	subq	-72(%rbp), %rdx
	callq	_clamp
	movq	%rax, -56(%rbp)
	movq	-64(%rbp), %rdi
	movq	_MT9M111_MIN_DARK_ROWS@GOTPCREL(%rip), %rax
	movq	(%rax), %rsi
	movq	(%r15), %rdx
	addq	%rsi, %rdx
	subq	-80(%rbp), %rdx
	callq	_clamp
	movq	%rax, -64(%rbp)
	movl	(%r13), %edi
	movq	-72(%rbp), %rsi
	callq	_min
	movl	%eax, %r15d
	movl	4(%r13), %edi
	movq	-80(%rbp), %rsi
	callq	_min
	movl	%eax, %r12d
	movq	40(%r13), %rax
	movq	(%rax), %r8
	movq	%r13, %rdi
	movq	%r14, %rsi
	movl	%r15d, %edx
	movl	%r12d, %ecx
	callq	_mt9m111_setup_geometry
	testl	%eax, %eax
	jne	LBB0_5
## %bb.4:
	movaps	-80(%rbp), %xmm0
	movaps	-64(%rbp), %xmm1
	movups	%xmm1, 24(%r13)
	movups	%xmm0, 8(%r13)
	movl	%r15d, (%r13)
	movl	%r12d, 4(%r13)
	xorl	%eax, %eax
	jmp	LBB0_5
LBB0_2:
	movq	_EINVAL@GOTPCREL(%rip), %rcx
	xorl	%eax, %eax
	subl	(%rcx), %eax
LBB0_5:
	addq	$40, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_V4L2_SUBDEV_FORMAT_ACTIVE,8,3  ## @V4L2_SUBDEV_FORMAT_ACTIVE
	.comm	_V4L2_SEL_TGT_CROP,8,3          ## @V4L2_SEL_TGT_CROP
	.comm	_EINVAL,4,2                     ## @EINVAL
	.comm	_MEDIA_BUS_FMT_SBGGR8_1X8,8,3   ## @MEDIA_BUS_FMT_SBGGR8_1X8
	.comm	_MEDIA_BUS_FMT_SBGGR10_2X8_PADHI_LE,8,3 ## @MEDIA_BUS_FMT_SBGGR10_2X8_PADHI_LE
	.comm	_MT9M111_MAX_WIDTH,8,3          ## @MT9M111_MAX_WIDTH
	.comm	_MT9M111_MAX_HEIGHT,8,3         ## @MT9M111_MAX_HEIGHT
	.comm	_MT9M111_MIN_DARK_COLS,8,3      ## @MT9M111_MIN_DARK_COLS
	.comm	_MT9M111_MIN_DARK_ROWS,8,3      ## @MT9M111_MIN_DARK_ROWS
	.no_dead_strip	_mt9m111_set_selection
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function mt9m111_set_selection
_mt9m111_set_selection:                 ; @mt9m111_set_selection
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #96
	.cfi_def_cfa_offset 96
	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
	mov	x20, x2
	bl	_v4l2_get_subdevdata
	bl	_to_mt9m111
	ldp	q0, q1, [x20, #16]
	stp	q0, q1, [sp, #16]
	ldr	x8, [x20]
Lloh0:
	adrp	x9, _V4L2_SUBDEV_FORMAT_ACTIVE@GOTPAGE
Lloh1:
	ldr	x9, [x9, _V4L2_SUBDEV_FORMAT_ACTIVE@GOTPAGEOFF]
Lloh2:
	ldr	x9, [x9]
	cmp	x8, x9
	b.ne	LBB0_4
; %bb.1:
	ldr	x8, [x20, #8]
Lloh3:
	adrp	x9, _V4L2_SEL_TGT_CROP@GOTPAGE
Lloh4:
	ldr	x9, [x9, _V4L2_SEL_TGT_CROP@GOTPAGEOFF]
Lloh5:
	ldr	x9, [x9]
	cmp	x8, x9
	b.ne	LBB0_4
; %bb.2:
	mov	x19, x0
	ldr	x8, [x0, #40]
	ldr	x8, [x8]
Lloh6:
	adrp	x9, _MEDIA_BUS_FMT_SBGGR8_1X8@GOTPAGE
Lloh7:
	ldr	x9, [x9, _MEDIA_BUS_FMT_SBGGR8_1X8@GOTPAGEOFF]
Lloh8:
	ldr	x9, [x9]
Lloh9:
	adrp	x10, _MEDIA_BUS_FMT_SBGGR10_2X8_PADHI_LE@GOTPAGE
Lloh10:
	ldr	x10, [x10, _MEDIA_BUS_FMT_SBGGR10_2X8_PADHI_LE@GOTPAGEOFF]
	cmp	x8, x9
Lloh11:
	ldr	x9, [x10]
	ccmp	x8, x9, #4, ne
	cset	w3, eq
	add	x8, sp, #16
	orr	x0, x8, #0x8
Lloh12:
	adrp	x20, _MT9M111_MAX_WIDTH@GOTPAGE
Lloh13:
	ldr	x20, [x20, _MT9M111_MAX_WIDTH@GOTPAGEOFF]
	ldr	x2, [x20]
Lloh14:
	adrp	x21, _MT9M111_MAX_HEIGHT@GOTPAGE
Lloh15:
	ldr	x21, [x21, _MT9M111_MAX_HEIGHT@GOTPAGEOFF]
	ldr	x6, [x21]
	str	wzr, [sp]
	add	x4, sp, #16
	mov	w1, #2
	mov	w5, #2
	mov	x7, x3
	bl	_v4l_bound_align_image
Lloh16:
	adrp	x8, _MT9M111_MIN_DARK_COLS@GOTPAGE
Lloh17:
	ldr	x8, [x8, _MT9M111_MIN_DARK_COLS@GOTPAGEOFF]
Lloh18:
	ldr	x1, [x8]
	ldr	x8, [x20]
	ldr	x0, [sp, #40]
	ldr	x9, [sp, #24]
	add	x8, x8, x1
	sub	x2, x8, x9
	bl	_clamp
	str	x0, [sp, #40]
Lloh19:
	adrp	x8, _MT9M111_MIN_DARK_ROWS@GOTPAGE
Lloh20:
	ldr	x8, [x8, _MT9M111_MIN_DARK_ROWS@GOTPAGEOFF]
Lloh21:
	ldr	x1, [x8]
	ldr	x8, [x21]
	ldr	x0, [sp, #32]
	ldr	x9, [sp, #16]
	add	x8, x8, x1
	sub	x2, x8, x9
	bl	_clamp
	str	x0, [sp, #32]
	ldr	w0, [x19]
	ldr	x1, [sp, #24]
	bl	_min
	mov	x20, x0
	ldr	w0, [x19, #4]
	ldr	x1, [sp, #16]
	bl	_min
	mov	x21, x0
	ldr	x8, [x19, #40]
	ldr	x4, [x8]
	add	x1, sp, #16
	mov	x0, x19
	mov	x2, x20
	mov	x3, x21
	bl	_mt9m111_setup_geometry
	cbnz	w0, LBB0_5
; %bb.3:
	ldp	q0, q1, [sp, #16]
	stur	q1, [x19, #24]
	stur	q0, [x19, #8]
	stp	w20, w21, [x19]
	b	LBB0_5
LBB0_4:
Lloh22:
	adrp	x8, _EINVAL@GOTPAGE
Lloh23:
	ldr	x8, [x8, _EINVAL@GOTPAGEOFF]
Lloh24:
	ldr	w8, [x8]
	neg	w0, w8
LBB0_5:
	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
	add	sp, sp, #96
	ret
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh19, Lloh20, Lloh21
	.loh AdrpLdrGotLdr	Lloh16, Lloh17, Lloh18
	.loh AdrpLdrGot	Lloh14, Lloh15
	.loh AdrpLdrGot	Lloh12, Lloh13
	.loh AdrpLdrGotLdr	Lloh9, Lloh10, Lloh11
	.loh AdrpLdrGotLdr	Lloh6, Lloh7, Lloh8
	.loh AdrpLdrGotLdr	Lloh22, Lloh23, Lloh24
	.cfi_endproc
                                        ; -- End function
	.comm	_V4L2_SUBDEV_FORMAT_ACTIVE,8,3  ; @V4L2_SUBDEV_FORMAT_ACTIVE
	.comm	_V4L2_SEL_TGT_CROP,8,3          ; @V4L2_SEL_TGT_CROP
	.comm	_EINVAL,4,2                     ; @EINVAL
	.comm	_MEDIA_BUS_FMT_SBGGR8_1X8,8,3   ; @MEDIA_BUS_FMT_SBGGR8_1X8
	.comm	_MEDIA_BUS_FMT_SBGGR10_2X8_PADHI_LE,8,3 ; @MEDIA_BUS_FMT_SBGGR10_2X8_PADHI_LE
	.comm	_MT9M111_MAX_WIDTH,8,3          ; @MT9M111_MAX_WIDTH
	.comm	_MT9M111_MAX_HEIGHT,8,3         ; @MT9M111_MAX_HEIGHT
	.comm	_MT9M111_MIN_DARK_COLS,8,3      ; @MT9M111_MIN_DARK_COLS
	.comm	_MT9M111_MIN_DARK_ROWS,8,3      ; @MT9M111_MIN_DARK_ROWS
	.no_dead_strip	_mt9m111_set_selection
.subsections_via_symbols
