	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function mt9m111_find_mode
_mt9m111_find_mode:                     ## @mt9m111_find_mode
	.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
	movl	%esi, %r15d
	movq	%rdi, %r14
	movl	12(%rdi), %esi
	movq	_MT9M111_MAX_WIDTH@GOTPCREL(%rip), %rax
	cmpl	(%rax), %esi
	jne	LBB0_2
## %bb.1:
	movl	16(%r14), %eax
	movq	_MT9M111_MAX_HEIGHT@GOTPCREL(%rip), %rdi
	cmpl	(%rdi), %eax
	jne	LBB0_2
## %bb.3:
	movq	_MT9M111_MODE_SXGA_15FPS@GOTPCREL(%rip), %rdi
	movl	(%rdi), %r12d
	movl	%esi, %edi
	shrl	$31, %edi
	addl	%esi, %edi
	sarl	%edi
	cmpl	%edx, %edi
	setb	%dl
	movl	%eax, %esi
	shrl	$31, %esi
	addl	%eax, %esi
	sarl	%esi
	cmpl	%ecx, %esi
	setb	%bl
	orb	%dl, %bl
	cmpb	$1, %bl
	jne	LBB0_5
## %bb.4:
	movl	8(%r14), %edi
	leaq	L_.str.1(%rip), %rsi
	callq	_dev_dbg
LBB0_5:
	movq	_MT9M111_NUM_MODES@GOTPCREL(%rip), %rax
	movl	(%rax), %r8d
	movq	_mt9m111_mode_data@GOTPCREL(%rip), %rax
	movq	(%rax), %rdi
	testl	%r8d, %r8d
	jle	LBB0_17
## %bb.6:
	cmpl	$1, %r8d
	jne	LBB0_8
## %bb.7:
	movl	$-1, %esi
	xorl	%ecx, %ecx
LBB0_14:
	testb	$1, %r8b
	je	LBB0_17
## %bb.15:
	movl	(%rdi,%rcx,4), %edx
	cmpl	$30, %edx
	sete	%al
	testb	%al, %bl
	jne	LBB0_17
## %bb.16:
	subl	%r15d, %edx
	movl	%edx, %eax
	negl	%eax
	cmovsl	%edx, %eax
	cmpl	%esi, %eax
	cmovbl	%ecx, %r12d
LBB0_17:
	movslq	%r12d, %rcx
	movq	_MT9M111_MODE_QSXGA_30FPS@GOTPCREL(%rip), %rax
	cmpl	(%rax), %ecx
	jne	LBB0_18
## %bb.19:
	movq	_context_a@GOTPCREL(%rip), %rdx
	jmp	LBB0_20
LBB0_2:
	movl	8(%r14), %edi
	leaq	L_.str(%rip), %rsi
	callq	_dev_info
	xorl	%eax, %eax
	jmp	LBB0_21
LBB0_18:
	movq	_context_b@GOTPCREL(%rip), %rdx
LBB0_20:
	leaq	(%rdi,%rcx,4), %rax
	movq	%rdx, (%r14)
LBB0_21:
	popq	%rbx
	popq	%r12
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_8:
	movl	%r8d, %r9d
	andl	$-2, %r9d
	movl	$-1, %esi
	xorl	%ecx, %ecx
	jmp	LBB0_9
	.p2align	4, 0x90
LBB0_13:                                ##   in Loop: Header=BB0_9 Depth=1
	addq	$2, %rcx
	cmpq	%rcx, %r9
	je	LBB0_14
LBB0_9:                                 ## =>This Inner Loop Header: Depth=1
	movl	(%rdi,%rcx,4), %edx
	cmpl	$30, %edx
	sete	%al
	testb	%al, %bl
	jne	LBB0_11
## %bb.10:                              ##   in Loop: Header=BB0_9 Depth=1
	subl	%r15d, %edx
	movl	%edx, %eax
	negl	%eax
	cmovsl	%edx, %eax
	cmpl	%esi, %eax
	cmovbl	%eax, %esi
	cmovbl	%ecx, %r12d
LBB0_11:                                ##   in Loop: Header=BB0_9 Depth=1
	movl	4(%rdi,%rcx,4), %edx
	cmpl	$30, %edx
	sete	%al
	testb	%al, %bl
	jne	LBB0_13
## %bb.12:                              ##   in Loop: Header=BB0_9 Depth=1
	subl	%r15d, %edx
	movl	%edx, %eax
	negl	%eax
	cmovsl	%edx, %eax
	leal	1(%rcx), %edx
	cmpl	%esi, %eax
	cmovbl	%eax, %esi
	cmovbl	%edx, %r12d
	jmp	LBB0_13
	.cfi_endproc
                                        ## -- End function
	.comm	_MT9M111_MODE_SXGA_15FPS,4,2    ## @MT9M111_MODE_SXGA_15FPS
	.comm	_MT9M111_MAX_WIDTH,4,2          ## @MT9M111_MAX_WIDTH
	.comm	_MT9M111_MAX_HEIGHT,4,2         ## @MT9M111_MAX_HEIGHT
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"Framerate selection is not supported for cropped images\n"

L_.str.1:                               ## @.str.1
	.asciz	"Framerates > 15fps are supported only for images not exceeding 640x512\n"

	.comm	_MT9M111_NUM_MODES,4,2          ## @MT9M111_NUM_MODES
	.comm	_mt9m111_mode_data,8,3          ## @mt9m111_mode_data
	.comm	_MT9M111_MODE_QSXGA_30FPS,4,2   ## @MT9M111_MODE_QSXGA_30FPS
	.comm	_context_a,4,2                  ## @context_a
	.comm	_context_b,4,2                  ## @context_b
	.no_dead_strip	_mt9m111_find_mode
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function mt9m111_find_mode
_mt9m111_find_mode:                     ; @mt9m111_find_mode
	.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, x0
	ldr	w8, [x0, #12]
Lloh0:
	adrp	x9, _MT9M111_MAX_WIDTH@GOTPAGE
Lloh1:
	ldr	x9, [x9, _MT9M111_MAX_WIDTH@GOTPAGEOFF]
Lloh2:
	ldr	w9, [x9]
	cmp	w8, w9
	b.ne	LBB0_9
; %bb.1:
	ldr	w9, [x19, #16]
Lloh3:
	adrp	x10, _MT9M111_MAX_HEIGHT@GOTPAGE
Lloh4:
	ldr	x10, [x10, _MT9M111_MAX_HEIGHT@GOTPAGEOFF]
Lloh5:
	ldr	w10, [x10]
	cmp	w9, w10
	b.ne	LBB0_9
; %bb.2:
	mov	x20, x1
Lloh6:
	adrp	x10, _MT9M111_MODE_SXGA_15FPS@GOTPAGE
Lloh7:
	ldr	x10, [x10, _MT9M111_MODE_SXGA_15FPS@GOTPAGEOFF]
Lloh8:
	ldr	w21, [x10]
	cmp	w8, #0
	cinc	w8, w8, lt
	cmp	w9, #0
	cinc	w9, w9, lt
	cmp	w2, w8, asr #1
	asr	w8, w9, #1
	ccmp	w3, w8, #2, ls
	cset	w22, hi
	cmp	w22, #1
	b.ne	LBB0_4
; %bb.3:
	ldr	w0, [x19, #8]
Lloh9:
	adrp	x1, l_.str.1@PAGE
Lloh10:
	add	x1, x1, l_.str.1@PAGEOFF
	bl	_dev_dbg
LBB0_4:
Lloh11:
	adrp	x8, _MT9M111_NUM_MODES@GOTPAGE
Lloh12:
	ldr	x8, [x8, _MT9M111_NUM_MODES@GOTPAGEOFF]
Lloh13:
	ldr	w9, [x8]
Lloh14:
	adrp	x8, _mt9m111_mode_data@GOTPAGE
Lloh15:
	ldr	x8, [x8, _mt9m111_mode_data@GOTPAGEOFF]
Lloh16:
	ldr	x8, [x8]
	cmp	w9, #1
	b.lt	LBB0_10
; %bb.5:
	mov	x10, #0
	mov	w11, #-1
	b	LBB0_7
LBB0_6:                                 ;   in Loop: Header=BB0_7 Depth=1
	add	x10, x10, #1
	cmp	x9, x10
	b.eq	LBB0_10
LBB0_7:                                 ; =>This Inner Loop Header: Depth=1
	ldr	w12, [x8, x10, lsl #2]
	cmp	w12, #30
	cset	w13, eq
	and	w13, w22, w13
	tbnz	w13, #0, LBB0_6
; %bb.8:                                ;   in Loop: Header=BB0_7 Depth=1
	subs	w12, w12, w20
	cneg	w12, w12, mi
	cmp	w12, w11
	csel	w11, w12, w11, lo
	csel	w21, w10, w21, lo
	b	LBB0_6
LBB0_9:
	ldr	w0, [x19, #8]
Lloh17:
	adrp	x1, l_.str@PAGE
Lloh18:
	add	x1, x1, l_.str@PAGEOFF
	bl	_dev_info
	mov	x0, #0
	b	LBB0_11
LBB0_10:
	add	x0, x8, w21, sxtw #2
Lloh19:
	adrp	x8, _MT9M111_MODE_QSXGA_30FPS@GOTPAGE
Lloh20:
	ldr	x8, [x8, _MT9M111_MODE_QSXGA_30FPS@GOTPAGEOFF]
Lloh21:
	adrp	x9, _context_b@GOTPAGE
Lloh22:
	ldr	x9, [x9, _context_b@GOTPAGEOFF]
Lloh23:
	ldr	w8, [x8]
Lloh24:
	adrp	x10, _context_a@GOTPAGE
Lloh25:
	ldr	x10, [x10, _context_a@GOTPAGEOFF]
	cmp	w21, w8
	csel	x8, x10, x9, eq
	str	x8, [x19]
LBB0_11:
	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 AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh6, Lloh7, Lloh8
	.loh AdrpAdd	Lloh9, Lloh10
	.loh AdrpLdrGotLdr	Lloh14, Lloh15, Lloh16
	.loh AdrpLdrGotLdr	Lloh11, Lloh12, Lloh13
	.loh AdrpAdd	Lloh17, Lloh18
	.loh AdrpLdrGot	Lloh24, Lloh25
	.loh AdrpLdrGot	Lloh21, Lloh22
	.loh AdrpLdrGotLdr	Lloh19, Lloh20, Lloh23
	.cfi_endproc
                                        ; -- End function
	.comm	_MT9M111_MODE_SXGA_15FPS,4,2    ; @MT9M111_MODE_SXGA_15FPS
	.comm	_MT9M111_MAX_WIDTH,4,2          ; @MT9M111_MAX_WIDTH
	.comm	_MT9M111_MAX_HEIGHT,4,2         ; @MT9M111_MAX_HEIGHT
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"Framerate selection is not supported for cropped images\n"

l_.str.1:                               ; @.str.1
	.asciz	"Framerates > 15fps are supported only for images not exceeding 640x512\n"

	.comm	_MT9M111_NUM_MODES,4,2          ; @MT9M111_NUM_MODES
	.comm	_mt9m111_mode_data,8,3          ; @mt9m111_mode_data
	.comm	_MT9M111_MODE_QSXGA_30FPS,4,2   ; @MT9M111_MODE_QSXGA_30FPS
	.comm	_context_a,4,2                  ; @context_a
	.comm	_context_b,4,2                  ; @context_b
	.no_dead_strip	_mt9m111_find_mode
.subsections_via_symbols
