	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function ov5640_get_sysclk
_ov5640_get_sysclk:                     ## @ov5640_get_sysclk
	.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
	movq	%rdi, %rbx
	movslq	(%rdi), %r12
	movq	_OV5640_REG_SC_PLL_CTRL0@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	leaq	-44(%rbp), %rdx
	callq	_ov5640_read_reg
	testl	%eax, %eax
	jne	LBB0_10
## %bb.1:
	movl	-44(%rbp), %eax
	movl	%eax, %ecx
	andl	$13, %ecx
	shrl	%eax
	andl	$7, %eax
	cmpl	$8, %ecx
	movl	$1, %r15d
	cmovel	%eax, %r15d
	movq	_OV5640_REG_SC_PLL_CTRL1@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	leaq	-44(%rbp), %rdx
	movq	%rbx, %rdi
	callq	_ov5640_read_reg
	testl	%eax, %eax
	jne	LBB0_10
## %bb.2:
	movl	-44(%rbp), %eax
	movl	%eax, %ecx
	sarl	$4, %ecx
	cmpl	$16, %eax
	movl	$16, %r13d
	cmovael	%ecx, %r13d
	movq	_OV5640_REG_SC_PLL_CTRL2@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	leaq	-44(%rbp), %rdx
	movq	%rbx, %rdi
	callq	_ov5640_read_reg
	testl	%eax, %eax
	jne	LBB0_10
## %bb.3:
	movl	-44(%rbp), %eax
	movl	%eax, -52(%rbp)                 ## 4-byte Spill
	movq	_OV5640_REG_SC_PLL_CTRL3@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	leaq	-44(%rbp), %rdx
	movq	%rbx, %rdi
	callq	_ov5640_read_reg
	testl	%eax, %eax
	jne	LBB0_10
## %bb.4:
	movl	-44(%rbp), %eax
	xorl	%r14d, %r14d
	movl	%eax, -48(%rbp)                 ## 4-byte Spill
	btl	$4, %eax
	adcl	$1, %r14d
	movq	_OV5640_REG_SYS_ROOT_DIVIDER@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	leaq	-44(%rbp), %rdx
	movq	%rbx, %rdi
	callq	_ov5640_read_reg
	testl	%eax, %eax
	jne	LBB0_10
## %bb.5:
	movl	-48(%rbp), %ebx                 ## 4-byte Reload
	andl	$15, %ebx
	je	LBB0_8
## %bb.6:
	testl	%r13d, %r13d
	je	LBB0_8
## %bb.7:
	testl	%r15d, %r15d
	je	LBB0_8
## %bb.9:
	imulq	$1759218605, %r12, %rdx         ## imm = 0x68DB8BAD
	movq	%rdx, %rcx
	shrq	$63, %rcx
	sarq	$44, %rdx
	addl	%ecx, %edx
	movl	-52(%rbp), %eax                 ## 4-byte Reload
	imull	%edx, %eax
	movl	-44(%rbp), %ecx
	andl	$3, %ecx
	leaq	L___const.ov5640_get_sysclk.sclk_rdiv_map(%rip), %rsi
	cltd
	idivl	%ebx
	cltd
	idivl	%r13d
	cltd
	idivl	%r14d
	addl	%eax, %eax
	cltd
	idivl	%r15d
	cltd
	idivl	(%rsi,%rcx,4)
	jmp	LBB0_10
LBB0_8:
	movq	_EINVAL@GOTPCREL(%rip), %rcx
	xorl	%eax, %eax
	subl	(%rcx), %eax
LBB0_10:
	addq	$24, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.section	__TEXT,__literal16,16byte_literals
	.p2align	4                               ## @__const.ov5640_get_sysclk.sclk_rdiv_map
L___const.ov5640_get_sysclk.sclk_rdiv_map:
	.long	1                               ## 0x1
	.long	2                               ## 0x2
	.long	4                               ## 0x4
	.long	8                               ## 0x8

	.comm	_OV5640_REG_SC_PLL_CTRL0,4,2    ## @OV5640_REG_SC_PLL_CTRL0
	.comm	_OV5640_REG_SC_PLL_CTRL1,4,2    ## @OV5640_REG_SC_PLL_CTRL1
	.comm	_OV5640_REG_SC_PLL_CTRL2,4,2    ## @OV5640_REG_SC_PLL_CTRL2
	.comm	_OV5640_REG_SC_PLL_CTRL3,4,2    ## @OV5640_REG_SC_PLL_CTRL3
	.comm	_OV5640_REG_SYS_ROOT_DIVIDER,4,2 ## @OV5640_REG_SYS_ROOT_DIVIDER
	.comm	_EINVAL,4,2                     ## @EINVAL
	.no_dead_strip	_ov5640_get_sysclk
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function ov5640_get_sysclk
_ov5640_get_sysclk:                     ; @ov5640_get_sysclk
	.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	x19, x0
	ldrsw	x20, [x0]
Lloh0:
	adrp	x8, _OV5640_REG_SC_PLL_CTRL0@GOTPAGE
Lloh1:
	ldr	x8, [x8, _OV5640_REG_SC_PLL_CTRL0@GOTPAGEOFF]
Lloh2:
	ldr	w1, [x8]
	add	x2, sp, #12
	bl	_ov5640_read_reg
	cbnz	w0, LBB0_10
; %bb.1:
	ldr	w8, [sp, #12]
	mov	w9, #13
	and	w9, w8, w9
	ubfx	w8, w8, #1, #3
	cmp	w9, #8
	csinc	w21, w8, wzr, eq
Lloh3:
	adrp	x8, _OV5640_REG_SC_PLL_CTRL1@GOTPAGE
Lloh4:
	ldr	x8, [x8, _OV5640_REG_SC_PLL_CTRL1@GOTPAGEOFF]
Lloh5:
	ldr	w1, [x8]
	add	x2, sp, #12
	mov	x0, x19
	bl	_ov5640_read_reg
	cbnz	w0, LBB0_10
; %bb.2:
	ldr	w8, [sp, #12]
	asr	w9, w8, #4
	mov	w10, #16
	cmp	w8, #16
	csel	w22, w10, w9, lo
Lloh6:
	adrp	x8, _OV5640_REG_SC_PLL_CTRL2@GOTPAGE
Lloh7:
	ldr	x8, [x8, _OV5640_REG_SC_PLL_CTRL2@GOTPAGEOFF]
Lloh8:
	ldr	w1, [x8]
	add	x2, sp, #12
	mov	x0, x19
	bl	_ov5640_read_reg
	cbnz	w0, LBB0_10
; %bb.3:
	ldr	w23, [sp, #12]
Lloh9:
	adrp	x8, _OV5640_REG_SC_PLL_CTRL3@GOTPAGE
Lloh10:
	ldr	x8, [x8, _OV5640_REG_SC_PLL_CTRL3@GOTPAGEOFF]
Lloh11:
	ldr	w1, [x8]
	add	x2, sp, #12
	mov	x0, x19
	bl	_ov5640_read_reg
	cbnz	w0, LBB0_10
; %bb.4:
	ldr	w24, [sp, #12]
Lloh12:
	adrp	x8, _OV5640_REG_SYS_ROOT_DIVIDER@GOTPAGE
Lloh13:
	ldr	x8, [x8, _OV5640_REG_SYS_ROOT_DIVIDER@GOTPAGEOFF]
Lloh14:
	ldr	w1, [x8]
	add	x2, sp, #12
	mov	x0, x19
	bl	_ov5640_read_reg
	cbnz	w0, LBB0_10
; %bb.5:
	and	w8, w24, #0xf
	cbz	w8, LBB0_9
; %bb.6:
	cbz	w22, LBB0_9
; %bb.7:
	cbz	w21, LBB0_9
; %bb.8:
	mov	w9, #35757
	movk	w9, #26843, lsl #16
	mul	x9, x20, x9
	lsr	x10, x9, #63
	asr	x9, x9, #44
	add	w9, w9, w10
	ubfx	w10, w24, #4, #1
	add	w10, w10, #1
	ldr	w11, [sp, #12]
	and	x11, x11, #0x3
Lloh15:
	adrp	x12, l___const.ov5640_get_sysclk.sclk_rdiv_map@PAGE
Lloh16:
	add	x12, x12, l___const.ov5640_get_sysclk.sclk_rdiv_map@PAGEOFF
	ldr	w11, [x12, x11, lsl #2]
	mul	w9, w23, w9
	sdiv	w8, w9, w8
	sdiv	w8, w8, w22
	sdiv	w8, w8, w10
	lsl	w8, w8, #1
	sdiv	w8, w8, w21
	sdiv	w0, w8, w11
	b	LBB0_10
LBB0_9:
Lloh17:
	adrp	x8, _EINVAL@GOTPAGE
Lloh18:
	ldr	x8, [x8, _EINVAL@GOTPAGEOFF]
Lloh19:
	ldr	w8, [x8]
	neg	w0, w8
LBB0_10:
	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
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh6, Lloh7, Lloh8
	.loh AdrpLdrGotLdr	Lloh9, Lloh10, Lloh11
	.loh AdrpLdrGotLdr	Lloh12, Lloh13, Lloh14
	.loh AdrpAdd	Lloh15, Lloh16
	.loh AdrpLdrGotLdr	Lloh17, Lloh18, Lloh19
	.cfi_endproc
                                        ; -- End function
	.section	__TEXT,__literal16,16byte_literals
	.p2align	2                               ; @__const.ov5640_get_sysclk.sclk_rdiv_map
l___const.ov5640_get_sysclk.sclk_rdiv_map:
	.long	1                               ; 0x1
	.long	2                               ; 0x2
	.long	4                               ; 0x4
	.long	8                               ; 0x8

	.comm	_OV5640_REG_SC_PLL_CTRL0,4,2    ; @OV5640_REG_SC_PLL_CTRL0
	.comm	_OV5640_REG_SC_PLL_CTRL1,4,2    ; @OV5640_REG_SC_PLL_CTRL1
	.comm	_OV5640_REG_SC_PLL_CTRL2,4,2    ; @OV5640_REG_SC_PLL_CTRL2
	.comm	_OV5640_REG_SC_PLL_CTRL3,4,2    ; @OV5640_REG_SC_PLL_CTRL3
	.comm	_OV5640_REG_SYS_ROOT_DIVIDER,4,2 ; @OV5640_REG_SYS_ROOT_DIVIDER
	.comm	_EINVAL,4,2                     ; @EINVAL
	.no_dead_strip	_ov5640_get_sysclk
.subsections_via_symbols
