	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_aptina_pll_calculate           ## -- Begin function aptina_pll_calculate
	.p2align	4, 0x90
_aptina_pll_calculate:                  ## @aptina_pll_calculate
	.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
	movq	%rsi, %r12
	movq	%rdi, %r13
	movl	(%rdx), %edx
	movl	4(%rbx), %ecx
	leaq	L_.str(%rip), %rsi
	xorl	%r15d, %r15d
	xorl	%eax, %eax
	callq	_dev_dbg
	movl	(%rbx), %esi
	cmpl	(%r12), %esi
	jb	LBB0_2
## %bb.1:
	cmpl	4(%r12), %esi
	jbe	LBB0_7
LBB0_2:
	leaq	L_.str.1(%rip), %rsi
LBB0_3:
	movq	%r13, %rdi
LBB0_4:
	callq	_dev_err
	movq	_EINVAL@GOTPCREL(%rip), %rax
LBB0_5:
	subl	(%rax), %r15d
LBB0_6:
	movl	%r15d, %eax
	addq	$40, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_7:
	movl	4(%rbx), %edi
	testl	%edi, %edi
	je	LBB0_9
## %bb.8:
	cmpl	8(%r12), %edi
	jbe	LBB0_11
LBB0_9:
	leaq	L_.str.2(%rip), %rsi
LBB0_10:
	movq	%r13, %rdi
	callq	_dev_err
	movq	_EINVAL@GOTPCREL(%rip), %rax
	xorl	%r15d, %r15d
	jmp	LBB0_5
LBB0_11:
	callq	_gcd
	movl	%eax, %ecx
	movl	(%rbx), %edi
	movl	4(%rbx), %eax
	xorl	%r15d, %r15d
	xorl	%edx, %edx
	divl	%ecx
	movl	%eax, %esi
	movl	%eax, 8(%rbx)
	movl	%edi, %eax
	xorl	%edx, %edx
	divl	%ecx
	movl	%eax, %r14d
	movl	%eax, -44(%rbp)                 ## 4-byte Spill
	movl	12(%r12), %edi
	callq	_DIV_ROUND_UP
	movl	%eax, %edi
	movl	16(%r12), %ecx
	movl	(%rbx), %eax
	xorl	%edx, %edx
	divl	20(%r12)
	movl	%eax, %esi
	imull	8(%rbx), %esi
	movl	%ecx, %eax
	xorl	%edx, %edx
	divl	%esi
	movl	%eax, %esi
	callq	_max
	movl	%eax, %edi
	movl	24(%r12), %eax
	imull	20(%r12), %eax
	xorl	%edx, %edx
	divl	%r14d
	movl	%eax, %esi
	callq	_max
	movl	%eax, -48(%rbp)                 ## 4-byte Spill
	movl	(%rbx), %ecx
	movl	8(%rbx), %edi
	movl	28(%r12), %eax
	movl	32(%r12), %esi
	xorl	%edx, %edx
	divl	%edi
	movl	%eax, %r8d
	movl	%ecx, %eax
	xorl	%edx, %edx
	divl	36(%r12)
	movl	%eax, %ecx
	imull	%edi, %ecx
	movl	%esi, %eax
	xorl	%edx, %edx
	divl	%ecx
	movl	%r8d, %edi
	movl	%eax, %esi
	callq	_min
	movl	%eax, %r14d
	movl	40(%r12), %edi
	imull	36(%r12), %edi
	movl	-44(%rbp), %esi                 ## 4-byte Reload
	callq	_DIV_ROUND_UP
	movl	%r14d, %edi
	movl	%eax, %esi
	callq	_min
	movl	%eax, %r14d
	leaq	L_.str.3(%rip), %rsi
	movq	%r13, %rdi
	movl	-48(%rbp), %edx                 ## 4-byte Reload
	movl	%eax, %ecx
	xorl	%eax, %eax
	callq	_dev_dbg
	movl	%r14d, -56(%rbp)                ## 4-byte Spill
	cmpl	%r14d, -48(%rbp)                ## 4-byte Folded Reload
	jbe	LBB0_13
## %bb.12:
	leaq	L_.str.4(%rip), %rsi
	jmp	LBB0_3
LBB0_13:
	movl	24(%r12), %r14d
	testl	%r14d, %r14d
	je	LBB0_18
## %bb.14:
	movq	%r13, -72(%rbp)                 ## 8-byte Spill
	movl	16(%r12), %edi
	movl	-44(%rbp), %r15d                ## 4-byte Reload
	imull	%r15d, %edi
	movl	8(%rbx), %esi
	imull	(%rbx), %esi
	callq	_DIV_ROUND_UP
	movl	%r14d, %edi
	movl	%eax, %esi
	callq	_max
	movl	%eax, %r14d
	movl	40(%r12), %edi
	movl	32(%r12), %eax
	movl	8(%rbx), %ecx
	imull	(%rbx), %ecx
	imull	%r15d, %eax
	xorl	%r15d, %r15d
	xorl	%edx, %edx
	divl	%ecx
	movl	%eax, %esi
	callq	_min
	movl	%eax, %r13d
	andl	$-2, %r13d
	movl	%r14d, -52(%rbp)                ## 4-byte Spill
	cmpl	%r14d, %r13d
	jb	LBB0_17
LBB0_15:                                ## =>This Inner Loop Header: Depth=1
	movl	-44(%rbp), %r14d                ## 4-byte Reload
	movl	%r14d, %edi
	movl	%r13d, %esi
	callq	_gcd
	movl	%eax, %ecx
	movl	%r13d, %eax
	xorl	%edx, %edx
	divl	%ecx
	movl	%eax, -60(%rbp)                 ## 4-byte Spill
	movl	(%rbx), %edi
	imull	%r13d, %edi
	movl	44(%r12), %esi
	imull	%r14d, %esi
	callq	_DIV_ROUND_UP
	movl	-48(%rbp), %edi                 ## 4-byte Reload
	movl	%eax, %esi
	callq	_max
	movl	%eax, %edi
	movl	-60(%rbp), %esi                 ## 4-byte Reload
	callq	_roundup
	movl	%eax, %r14d
	movl	(%rbx), %eax
	imull	%r13d, %eax
	movl	48(%r12), %ecx
	imull	-44(%rbp), %ecx                 ## 4-byte Folded Reload
	xorl	%edx, %edx
	divl	%ecx
	movl	-56(%rbp), %edi                 ## 4-byte Reload
	movl	%eax, %esi
	callq	_min
	cmpl	%eax, %r14d
	jbe	LBB0_19
## %bb.16:                              ##   in Loop: Header=BB0_15 Depth=1
	addl	$-2, %r13d
	cmpl	-52(%rbp), %r13d                ## 4-byte Folded Reload
	jae	LBB0_15
LBB0_17:
	leaq	L_.str.7(%rip), %rsi
	movq	-72(%rbp), %rdi                 ## 8-byte Reload
	jmp	LBB0_4
LBB0_18:
	leaq	L_.str.5(%rip), %rsi
	jmp	LBB0_10
LBB0_19:
	movl	-44(%rbp), %eax                 ## 4-byte Reload
	imull	%r14d, %eax
	xorl	%r15d, %r15d
	xorl	%edx, %edx
	divl	%r13d
	movl	%eax, 12(%rbx)
	movl	8(%rbx), %ecx
	imull	%r14d, %ecx
	movl	%ecx, 8(%rbx)
	movl	%r13d, 16(%rbx)
	leaq	L_.str.6(%rip), %rsi
	movq	-72(%rbp), %rdi                 ## 8-byte Reload
	movl	%eax, %edx
	movl	%r13d, %r8d
	xorl	%eax, %eax
	callq	_dev_dbg
	jmp	LBB0_6
	.cfi_endproc
                                        ## -- End function
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"PLL: ext clock %u pix clock %u\n"

L_.str.1:                               ## @.str.1
	.asciz	"pll: invalid external clock frequency.\n"

	.comm	_EINVAL,4,2                     ## @EINVAL
L_.str.2:                               ## @.str.2
	.asciz	"pll: invalid pixel clock frequency.\n"

L_.str.3:                               ## @.str.3
	.asciz	"pll: mf min %u max %u\n"

L_.str.4:                               ## @.str.4
	.asciz	"pll: no valid combined N*P1 divisor.\n"

L_.str.5:                               ## @.str.5
	.asciz	"pll: P1 minimum value must be >0.\n"

L_.str.6:                               ## @.str.6
	.asciz	"PLL: N %u M %u P1 %u\n"

L_.str.7:                               ## @.str.7
	.asciz	"pll: no valid N and P1 divisors found.\n"

.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_aptina_pll_calculate           ; -- Begin function aptina_pll_calculate
	.p2align	2
_aptina_pll_calculate:                  ; @aptina_pll_calculate
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #112
	.cfi_def_cfa_offset 112
	stp	x28, x27, [sp, #16]             ; 16-byte Folded Spill
	stp	x26, x25, [sp, #32]             ; 16-byte Folded Spill
	stp	x24, x23, [sp, #48]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #64]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #80]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #96]             ; 16-byte Folded Spill
	add	x29, sp, #96
	.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
	mov	x20, x2
	mov	x21, x1
	mov	x19, x0
	ldr	w2, [x2]
	ldr	w3, [x20, #4]
Lloh0:
	adrp	x1, l_.str@PAGE
Lloh1:
	add	x1, x1, l_.str@PAGEOFF
	bl	_dev_dbg
	ldr	w1, [x20]
	ldr	w8, [x21]
	cmp	w1, w8
	b.lo	LBB0_2
; %bb.1:
	ldr	w8, [x21, #4]
	cmp	w1, w8
	b.ls	LBB0_5
LBB0_2:
Lloh2:
	adrp	x1, l_.str.1@PAGE
Lloh3:
	add	x1, x1, l_.str.1@PAGEOFF
LBB0_3:
	mov	x0, x19
	bl	_dev_err
Lloh4:
	adrp	x8, _EINVAL@GOTPAGE
Lloh5:
	ldr	x8, [x8, _EINVAL@GOTPAGEOFF]
Lloh6:
	ldr	w8, [x8]
	neg	w0, w8
LBB0_4:
	ldp	x29, x30, [sp, #96]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #80]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #64]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #48]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp, #32]             ; 16-byte Folded Reload
	ldp	x28, x27, [sp, #16]             ; 16-byte Folded Reload
	add	sp, sp, #112
	ret
LBB0_5:
	ldr	w0, [x20, #4]
	cbz	w0, LBB0_7
; %bb.6:
	ldr	w8, [x21, #8]
	cmp	w0, w8
	b.ls	LBB0_8
LBB0_7:
Lloh7:
	adrp	x1, l_.str.2@PAGE
Lloh8:
	add	x1, x1, l_.str.2@PAGEOFF
	b	LBB0_3
LBB0_8:
	bl	_gcd
	ldp	w9, w8, [x20]
	udiv	w1, w8, w0
	str	w1, [x20, #8]
	ldr	w8, [x21, #12]
	udiv	w22, w9, w0
	mov	x0, x8
	bl	_DIV_ROUND_UP
	ldr	w8, [x20]
	ldp	w9, w10, [x21, #16]
	udiv	w8, w8, w10
	ldr	w10, [x20, #8]
	mul	w8, w10, w8
	udiv	w1, w9, w8
	bl	_max
	ldp	w8, w9, [x21, #20]
	mul	w8, w9, w8
	udiv	w1, w8, w22
	bl	_max
	mov	x23, x0
	ldr	w8, [x20, #8]
	ldp	w9, w10, [x21, #28]
	udiv	w0, w9, w8
	ldr	w9, [x20]
	ldr	w11, [x21, #36]
	udiv	w9, w9, w11
	mul	w8, w9, w8
	udiv	w1, w10, w8
	bl	_min
	mov	x24, x0
	ldp	w8, w9, [x21, #36]
	mul	w0, w9, w8
	mov	x1, x22
	bl	_DIV_ROUND_UP
	mov	x1, x0
	mov	x0, x24
	bl	_min
	mov	x24, x0
Lloh9:
	adrp	x1, l_.str.3@PAGE
Lloh10:
	add	x1, x1, l_.str.3@PAGEOFF
	mov	x0, x19
	mov	x2, x23
	mov	x3, x24
	bl	_dev_dbg
	cmp	w23, w24
	b.ls	LBB0_10
; %bb.9:
Lloh11:
	adrp	x1, l_.str.4@PAGE
Lloh12:
	add	x1, x1, l_.str.4@PAGEOFF
	b	LBB0_3
LBB0_10:
	ldr	w25, [x21, #24]
	cbz	w25, LBB0_15
; %bb.11:
	ldr	w8, [x21, #16]
	mul	w0, w8, w22
	ldr	w8, [x20]
	ldr	w9, [x20, #8]
	mul	w1, w9, w8
	bl	_DIV_ROUND_UP
	mov	x1, x0
	mov	x0, x25
	bl	_max
	mov	x25, x0
	ldr	w0, [x21, #40]
	ldr	w8, [x21, #32]
	mul	w8, w8, w22
	ldr	w9, [x20]
	ldr	w10, [x20, #8]
	mul	w9, w10, w9
	udiv	w1, w8, w9
	bl	_min
	and	w26, w0, #0xfffffffe
	cmp	w26, w25
	b.lo	LBB0_14
LBB0_12:                                ; =>This Inner Loop Header: Depth=1
	mov	x0, x22
	mov	x1, x26
	bl	_gcd
	ldr	w8, [x20]
	mul	w8, w8, w26
	ldr	w9, [x21, #44]
	mul	w1, w9, w22
	udiv	w27, w26, w0
	mov	x0, x8
	bl	_DIV_ROUND_UP
	mov	x1, x0
	mov	x0, x23
	bl	_max
	mov	x1, x27
	bl	_roundup
	mov	x27, x0
	ldr	w8, [x20]
	mul	w8, w8, w26
	ldr	w9, [x21, #48]
	mul	w9, w9, w22
	udiv	w1, w8, w9
	mov	x0, x24
	bl	_min
	cmp	w27, w0
	b.ls	LBB0_16
; %bb.13:                               ;   in Loop: Header=BB0_12 Depth=1
	sub	w26, w26, #2
	cmp	w26, w25
	b.hs	LBB0_12
LBB0_14:
Lloh13:
	adrp	x1, l_.str.7@PAGE
Lloh14:
	add	x1, x1, l_.str.7@PAGEOFF
	b	LBB0_3
LBB0_15:
Lloh15:
	adrp	x1, l_.str.5@PAGE
Lloh16:
	add	x1, x1, l_.str.5@PAGEOFF
	b	LBB0_3
LBB0_16:
	mul	w8, w27, w22
	udiv	w2, w8, w26
	ldr	w8, [x20, #8]
	mul	w3, w8, w27
	stp	w3, w2, [x20, #8]
	str	w26, [x20, #16]
	str	x26, [sp]
Lloh17:
	adrp	x1, l_.str.6@PAGE
Lloh18:
	add	x1, x1, l_.str.6@PAGEOFF
	mov	x0, x19
	bl	_dev_dbg
	mov	w0, #0
	b	LBB0_4
	.loh AdrpAdd	Lloh0, Lloh1
	.loh AdrpAdd	Lloh2, Lloh3
	.loh AdrpLdrGotLdr	Lloh4, Lloh5, Lloh6
	.loh AdrpAdd	Lloh7, Lloh8
	.loh AdrpAdd	Lloh9, Lloh10
	.loh AdrpAdd	Lloh11, Lloh12
	.loh AdrpAdd	Lloh13, Lloh14
	.loh AdrpAdd	Lloh15, Lloh16
	.loh AdrpAdd	Lloh17, Lloh18
	.cfi_endproc
                                        ; -- End function
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"PLL: ext clock %u pix clock %u\n"

l_.str.1:                               ; @.str.1
	.asciz	"pll: invalid external clock frequency.\n"

	.comm	_EINVAL,4,2                     ; @EINVAL
l_.str.2:                               ; @.str.2
	.asciz	"pll: invalid pixel clock frequency.\n"

l_.str.3:                               ; @.str.3
	.asciz	"pll: mf min %u max %u\n"

l_.str.4:                               ; @.str.4
	.asciz	"pll: no valid combined N*P1 divisor.\n"

l_.str.5:                               ; @.str.5
	.asciz	"pll: P1 minimum value must be >0.\n"

l_.str.6:                               ; @.str.6
	.asciz	"PLL: N %u M %u P1 %u\n"

l_.str.7:                               ; @.str.7
	.asciz	"pll: no valid N and P1 divisors found.\n"

.subsections_via_symbols
