	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function ov5640_calc_sys_clk
_ov5640_calc_sys_clk:                   ## @ov5640_calc_sys_clk
	.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	$56, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%r8, -72(%rbp)                  ## 8-byte Spill
	movq	%rcx, -88(%rbp)                 ## 8-byte Spill
	movq	%rdx, -80(%rbp)                 ## 8-byte Spill
	movq	_OV5640_SYSDIV_MIN@GOTPCREL(%rip), %rax
	movq	(%rax), %rcx
	movq	_OV5640_SYSDIV_MAX@GOTPCREL(%rip), %rax
	movq	(%rax), %r8
	movq	%rcx, -48(%rbp)                 ## 8-byte Spill
	cmpq	%r8, %rcx
	jle	LBB0_2
## %bb.1:
	movl	$1, %edx
	movq	$-1, %rax
	movl	$1, %esi
LBB0_14:
	movq	-72(%rbp), %rcx                 ## 8-byte Reload
	movq	%rdx, (%rcx)
	movq	_OV5640_PLL_PREDIV@GOTPCREL(%rip), %rcx
	movq	(%rcx), %rcx
	movq	-80(%rbp), %rdx                 ## 8-byte Reload
	movq	%rcx, (%rdx)
	movq	-88(%rbp), %rcx                 ## 8-byte Reload
	movq	%rsi, (%rcx)
	addq	$56, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_2:
	movq	%rsi, %r12
	movq	%rdi, %rbx
	movq	$-1, %r13
	movl	$1, %eax
	movq	%rax, -64(%rbp)                 ## 8-byte Spill
	movq	_OV5640_PLL_MULT_MAX@GOTPCREL(%rip), %r14
	movl	$1, %eax
	movq	%rax, -56(%rbp)                 ## 8-byte Spill
	jmp	LBB0_3
	.p2align	4, 0x90
LBB0_12:                                ##   in Loop: Header=BB0_3 Depth=1
	movq	_OV5640_SYSDIV_MAX@GOTPCREL(%rip), %rax
	movq	(%rax), %r8
LBB0_13:                                ##   in Loop: Header=BB0_3 Depth=1
	movq	-48(%rbp), %rdi                 ## 8-byte Reload
	leaq	1(%rdi), %r9
	movq	%r13, %rax
	movq	-56(%rbp), %rdx                 ## 8-byte Reload
	movq	-64(%rbp), %rsi                 ## 8-byte Reload
	cmpq	%r8, %rdi
	movq	%r9, -48(%rbp)                  ## 8-byte Spill
	jge	LBB0_14
LBB0_3:                                 ## =>This Loop Header: Depth=1
                                        ##     Child Loop BB0_4 Depth 2
	movq	_OV5640_PLL_MULT_MIN@GOTPCREL(%rip), %rax
	movq	(%rax), %r15
	cmpq	(%r14), %r15
	jle	LBB0_4
	jmp	LBB0_13
	.p2align	4, 0x90
LBB0_10:                                ##   in Loop: Header=BB0_4 Depth=2
	movq	%rax, %r13
	movq	%rdx, -56(%rbp)                 ## 8-byte Spill
	movq	%rsi, -64(%rbp)                 ## 8-byte Spill
	cmpq	%rcx, %r12
	movq	%r8, %rbx
	je	LBB0_14
LBB0_11:                                ##   in Loop: Header=BB0_4 Depth=2
	leaq	1(%r15), %rax
	cmpq	(%r14), %r15
	movq	%rax, %r15
	jge	LBB0_12
LBB0_4:                                 ##   Parent Loop BB0_3 Depth=1
                                        ## =>  This Inner Loop Header: Depth=2
	cmpq	$128, %r15
	jl	LBB0_6
## %bb.5:                               ##   in Loop: Header=BB0_4 Depth=2
	movl	%r15d, %eax
	andl	$1, %eax
	testq	%rax, %rax
	jne	LBB0_11
LBB0_6:                                 ##   in Loop: Header=BB0_4 Depth=2
	movq	_OV5640_PLL_PREDIV@GOTPCREL(%rip), %rax
	movq	(%rax), %rsi
	movq	%rbx, %rdi
	movq	%r15, %rdx
	movq	-48(%rbp), %rcx                 ## 8-byte Reload
	callq	_ov5640_compute_sys_clk
	testq	%r12, %r12
	je	LBB0_12
## %bb.7:                               ##   in Loop: Header=BB0_4 Depth=2
	movq	%rax, %rcx
	cmpq	%r12, %rax
	jb	LBB0_11
## %bb.8:                               ##   in Loop: Header=BB0_4 Depth=2
	movq	%rbx, %r8
	movq	%r12, %rax
	subq	%rcx, %rax
	movq	%rax, %rdi
	negq	%rdi
	cmovsq	%rax, %rdi
	movq	%r12, %rax
	subq	%r13, %rax
	movq	%rax, %rbx
	negq	%rbx
	cmovsq	%rax, %rbx
	movq	%rcx, %rax
	movq	-48(%rbp), %rdx                 ## 8-byte Reload
	movq	%r15, %rsi
	cmpq	%rbx, %rdi
	jb	LBB0_10
## %bb.9:                               ##   in Loop: Header=BB0_4 Depth=2
	movq	%r13, %rax
	movq	-56(%rbp), %rdx                 ## 8-byte Reload
	movq	-64(%rbp), %rsi                 ## 8-byte Reload
	jmp	LBB0_10
	.cfi_endproc
                                        ## -- End function
	.comm	_OV5640_SYSDIV_MIN,8,3          ## @OV5640_SYSDIV_MIN
	.comm	_OV5640_SYSDIV_MAX,8,3          ## @OV5640_SYSDIV_MAX
	.comm	_OV5640_PLL_MULT_MIN,8,3        ## @OV5640_PLL_MULT_MIN
	.comm	_OV5640_PLL_MULT_MAX,8,3        ## @OV5640_PLL_MULT_MAX
	.comm	_OV5640_PLL_PREDIV,8,3          ## @OV5640_PLL_PREDIV
	.no_dead_strip	_ov5640_calc_sys_clk
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function ov5640_calc_sys_clk
_ov5640_calc_sys_clk:                   ; @ov5640_calc_sys_clk
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #128
	.cfi_def_cfa_offset 128
	stp	x28, x27, [sp, #32]             ; 16-byte Folded Spill
	stp	x26, x25, [sp, #48]             ; 16-byte Folded Spill
	stp	x24, x23, [sp, #64]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #80]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #96]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #112]            ; 16-byte Folded Spill
	add	x29, sp, #112
	.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
	.cfi_offset w27, -88
	.cfi_offset w28, -96
	stp	x4, x2, [sp, #8]                ; 16-byte Folded Spill
	str	x3, [sp, #24]                   ; 8-byte Folded Spill
Lloh0:
	adrp	x8, _OV5640_SYSDIV_MIN@GOTPAGE
Lloh1:
	ldr	x8, [x8, _OV5640_SYSDIV_MIN@GOTPAGEOFF]
Lloh2:
	ldr	x25, [x8]
Lloh3:
	adrp	x8, _OV5640_SYSDIV_MAX@GOTPAGE
Lloh4:
	ldr	x8, [x8, _OV5640_SYSDIV_MAX@GOTPAGEOFF]
Lloh5:
	ldr	x8, [x8]
Lloh6:
	adrp	x27, _OV5640_PLL_PREDIV@GOTPAGE
Lloh7:
	ldr	x27, [x27, _OV5640_PLL_PREDIV@GOTPAGEOFF]
	cmp	x25, x8
	b.le	LBB0_2
; %bb.1:
	mov	x22, #-1
	mov	w20, #1
	mov	w19, #1
	b	LBB0_12
LBB0_2:
	mov	x23, x1
	mov	x24, x0
	mov	x22, #-1
	mov	w19, #1
Lloh8:
	adrp	x21, _OV5640_PLL_MULT_MIN@GOTPAGE
Lloh9:
	ldr	x21, [x21, _OV5640_PLL_MULT_MIN@GOTPAGEOFF]
Lloh10:
	adrp	x28, _OV5640_PLL_MULT_MAX@GOTPAGE
Lloh11:
	ldr	x28, [x28, _OV5640_PLL_MULT_MAX@GOTPAGEOFF]
	mov	w20, #1
	b	LBB0_5
LBB0_3:                                 ;   in Loop: Header=BB0_5 Depth=1
Lloh12:
	adrp	x8, _OV5640_SYSDIV_MAX@GOTPAGE
Lloh13:
	ldr	x8, [x8, _OV5640_SYSDIV_MAX@GOTPAGEOFF]
Lloh14:
	ldr	x8, [x8]
LBB0_4:                                 ;   in Loop: Header=BB0_5 Depth=1
	add	x9, x25, #1
	cmp	x25, x8
	mov	x25, x9
	b.ge	LBB0_12
LBB0_5:                                 ; =>This Loop Header: Depth=1
                                        ;     Child Loop BB0_7 Depth 2
	ldr	x26, [x21]
	ldr	x9, [x28]
	cmp	x26, x9
	b.le	LBB0_7
	b	LBB0_4
LBB0_6:                                 ;   in Loop: Header=BB0_7 Depth=2
	add	x8, x26, #1
	ldr	x9, [x28]
	cmp	x26, x9
	mov	x26, x8
	b.ge	LBB0_3
LBB0_7:                                 ;   Parent Loop BB0_5 Depth=1
                                        ; =>  This Inner Loop Header: Depth=2
	cmp	x26, #128
	b.lt	LBB0_9
; %bb.8:                                ;   in Loop: Header=BB0_7 Depth=2
	tbnz	w26, #0, LBB0_6
LBB0_9:                                 ;   in Loop: Header=BB0_7 Depth=2
	ldr	x1, [x27]
	mov	x0, x24
	mov	x2, x26
	mov	x3, x25
	bl	_ov5640_compute_sys_clk
	cbz	x23, LBB0_3
; %bb.10:                               ;   in Loop: Header=BB0_7 Depth=2
	cmp	x0, x23
	b.lo	LBB0_6
; %bb.11:                               ;   in Loop: Header=BB0_7 Depth=2
	subs	x8, x23, x0
	cneg	x8, x8, mi
	subs	x9, x23, x22
	cneg	x9, x9, mi
	cmp	x8, x9
	csel	x22, x0, x22, lo
	csel	x20, x25, x20, lo
	csel	x19, x26, x19, lo
	cmp	x23, x0
	b.ne	LBB0_6
LBB0_12:
	ldp	x8, x9, [sp, #8]                ; 16-byte Folded Reload
	str	x20, [x8]
	ldr	x8, [x27]
	str	x8, [x9]
	ldr	x8, [sp, #24]                   ; 8-byte Folded Reload
	str	x19, [x8]
	mov	x0, x22
	ldp	x29, x30, [sp, #112]            ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #96]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #80]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #64]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp, #48]             ; 16-byte Folded Reload
	ldp	x28, x27, [sp, #32]             ; 16-byte Folded Reload
	add	sp, sp, #128
	ret
	.loh AdrpLdrGot	Lloh6, Lloh7
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGot	Lloh10, Lloh11
	.loh AdrpLdrGot	Lloh8, Lloh9
	.loh AdrpLdrGotLdr	Lloh12, Lloh13, Lloh14
	.cfi_endproc
                                        ; -- End function
	.comm	_OV5640_SYSDIV_MIN,8,3          ; @OV5640_SYSDIV_MIN
	.comm	_OV5640_SYSDIV_MAX,8,3          ; @OV5640_SYSDIV_MAX
	.comm	_OV5640_PLL_MULT_MIN,8,3        ; @OV5640_PLL_MULT_MIN
	.comm	_OV5640_PLL_MULT_MAX,8,3        ; @OV5640_PLL_MULT_MAX
	.comm	_OV5640_PLL_PREDIV,8,3          ; @OV5640_PLL_PREDIV
	.no_dead_strip	_ov5640_calc_sys_clk
.subsections_via_symbols
