	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function calc_speed
_calc_speed:                            ## @calc_speed
	.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	$24, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movl	%edx, %r14d
	movl	%esi, %r12d
	movq	%rdi, %rbx
	callq	_to_mt9v011
	movq	%rax, %rcx
	xorl	%eax, %eax
	testl	%r12d, %r12d
	je	LBB0_3
## %bb.1:
	testl	%r14d, %r14d
	je	LBB0_3
## %bb.2:
	movq	_R03_MT9V011_HEIGHT@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%rbx, %rdi
	movq	%rcx, -56(%rbp)                 ## 8-byte Spill
	callq	_mt9v011_read
                                        ## kill: def $eax killed $eax def $rax
	movq	%rax, -48(%rbp)                 ## 8-byte Spill
	movq	_R04_MT9V011_WIDTH@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%rbx, %rdi
	callq	_mt9v011_read
	movl	%eax, %r13d
	movq	_R05_MT9V011_HBLANK@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%rbx, %rdi
	callq	_mt9v011_read
	movl	%eax, %r15d
	movq	_R06_MT9V011_VBLANK@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%rbx, %rdi
	callq	_mt9v011_read
                                        ## kill: def $eax killed $eax def $rax
	leal	(%r15,%r13), %ecx
	addl	$113, %ecx
	movq	-48(%rbp), %rdx                 ## 8-byte Reload
	leal	(%rdx,%rax), %r15d
	incl	%r15d
	imull	%ecx, %r15d
	movq	-56(%rbp), %rax                 ## 8-byte Reload
	imull	(%rax), %r12d
	movl	%r14d, %ebx
	shrl	$31, %ebx
	addl	%r14d, %ebx
	sarl	%ebx
	leal	(%r12,%rbx), %r13d
	movl	%r13d, %edi
	movl	%r14d, %esi
	callq	_do_div
	movl	%r13d, %edi
	movl	%r15d, %esi
	callq	_do_div
	leal	(%r12,%rbx), %eax
	addl	$-2, %eax
	cmpl	$15, %eax
	movl	$15, %ecx
	cmovbl	%eax, %ecx
	xorl	%eax, %eax
	cmpl	$2, %r13d
	cmovgel	%ecx, %eax
LBB0_3:
	addq	$24, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_R03_MT9V011_HEIGHT,4,2         ## @R03_MT9V011_HEIGHT
	.comm	_R04_MT9V011_WIDTH,4,2          ## @R04_MT9V011_WIDTH
	.comm	_R05_MT9V011_HBLANK,4,2         ## @R05_MT9V011_HBLANK
	.comm	_R06_MT9V011_VBLANK,4,2         ## @R06_MT9V011_VBLANK
	.no_dead_strip	_calc_speed
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function calc_speed
_calc_speed:                            ; @calc_speed
	.cfi_startproc
; %bb.0:
	stp	x26, x25, [sp, #-80]!           ; 16-byte Folded Spill
	.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
	.cfi_offset w25, -72
	.cfi_offset w26, -80
	mov	x19, x2
	mov	x20, x1
	mov	x21, x0
	bl	_to_mt9v011
	mov	w23, #0
	cbz	w20, LBB0_3
; %bb.1:
	cbz	w19, LBB0_3
; %bb.2:
	mov	x22, x0
Lloh0:
	adrp	x8, _R03_MT9V011_HEIGHT@GOTPAGE
Lloh1:
	ldr	x8, [x8, _R03_MT9V011_HEIGHT@GOTPAGEOFF]
Lloh2:
	ldr	w1, [x8]
	mov	x0, x21
	bl	_mt9v011_read
	mov	x23, x0
Lloh3:
	adrp	x8, _R04_MT9V011_WIDTH@GOTPAGE
Lloh4:
	ldr	x8, [x8, _R04_MT9V011_WIDTH@GOTPAGEOFF]
Lloh5:
	ldr	w1, [x8]
	mov	x0, x21
	bl	_mt9v011_read
	mov	x24, x0
Lloh6:
	adrp	x8, _R05_MT9V011_HBLANK@GOTPAGE
Lloh7:
	ldr	x8, [x8, _R05_MT9V011_HBLANK@GOTPAGEOFF]
Lloh8:
	ldr	w1, [x8]
	mov	x0, x21
	bl	_mt9v011_read
	mov	x25, x0
Lloh9:
	adrp	x8, _R06_MT9V011_VBLANK@GOTPAGE
Lloh10:
	ldr	x8, [x8, _R06_MT9V011_VBLANK@GOTPAGEOFF]
Lloh11:
	ldr	w1, [x8]
	mov	x0, x21
	bl	_mt9v011_read
	ldr	w8, [x22]
	mul	w8, w8, w20
	cmp	w19, #0
	cinc	w9, w19, lt
	add	w20, w8, w9, asr #1
	subs	w8, w20, #2
	mov	w9, #15
	cmp	w8, #15
	csel	w8, w8, w9, lo
	cmp	w20, #2
	add	w9, w24, w25
	add	w21, w9, #113
	add	w22, w23, w0
	csel	w23, wzr, w8, lt
	mov	x0, x20
	mov	x1, x19
	bl	_do_div
	madd	w1, w21, w22, w21
	mov	x0, x20
	bl	_do_div
LBB0_3:
	mov	x0, x23
	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
	ldp	x26, x25, [sp], #80             ; 16-byte Folded Reload
	ret
	.loh AdrpLdrGotLdr	Lloh9, Lloh10, Lloh11
	.loh AdrpLdrGotLdr	Lloh6, Lloh7, Lloh8
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.cfi_endproc
                                        ; -- End function
	.comm	_R03_MT9V011_HEIGHT,4,2         ; @R03_MT9V011_HEIGHT
	.comm	_R04_MT9V011_WIDTH,4,2          ; @R04_MT9V011_WIDTH
	.comm	_R05_MT9V011_HBLANK,4,2         ; @R05_MT9V011_HBLANK
	.comm	_R06_MT9V011_VBLANK,4,2         ; @R06_MT9V011_VBLANK
	.no_dead_strip	_calc_speed
.subsections_via_symbols
