	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function calc_clk
_calc_clk:                              ## @calc_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	$72, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%r8, %r15
	movl	%ecx, %ebx
	movl	%edx, %r12d
                                        ## kill: def $esi killed $esi def $rsi
	movq	%rsi, -48(%rbp)                 ## 8-byte Spill
	movq	%rdi, %r13
	callq	_nouveau_drm
	movq	%rax, %r14
	movq	%r13, %rdi
	callq	_nouveau_dev
	movq	%rax, -96(%rbp)                 ## 8-byte Spill
	movq	%rax, %rdi
	callq	_nouveau_bios
	movq	$0, (%r15)
	cmpl	$99999, %ebx                    ## imm = 0x1869F
	jg	LBB0_4
## %bb.1:
	testl	%ebx, %ebx
	je	LBB0_7
## %bb.2:
	cmpl	$27000, %ebx                    ## imm = 0x6978
	jne	LBB0_9
## %bb.3:
	movl	$256, 4(%r15)                   ## imm = 0x100
	movl	$27000, %r14d                   ## imm = 0x6978
	jmp	LBB0_21
LBB0_4:
	cmpl	$100000, %ebx                   ## imm = 0x186A0
	je	LBB0_8
## %bb.5:
	cmpl	$108000, %ebx                   ## imm = 0x1A5E0
	jne	LBB0_9
## %bb.6:
	movl	$8512, 4(%r15)                  ## imm = 0x2140
	movl	$108000, %r14d                  ## imm = 0x1A5E0
	jmp	LBB0_21
LBB0_7:
	leaq	L_.str(%rip), %rsi
	movq	%r14, %rdi
	movl	%r12d, %edx
	movq	-48(%rbp), %rcx                 ## 8-byte Reload
                                        ## kill: def $ecx killed $ecx killed $rcx
	callq	_NV_DEBUG
	xorl	%r14d, %r14d
	jmp	LBB0_21
LBB0_8:
	movl	$8448, 4(%r15)                  ## imm = 0x2100
	movl	$100000, %r14d                  ## imm = 0x186A0
	jmp	LBB0_21
LBB0_9:
	movq	%rax, -88(%rbp)                 ## 8-byte Spill
	movq	%r13, %rdi
	movq	-48(%rbp), %rsi                 ## 8-byte Reload
                                        ## kill: def $esi killed $esi killed $rsi
	callq	_read_vco
                                        ## kill: def $eax killed $eax def $rax
	movq	%rax, -80(%rbp)                 ## 8-byte Spill
	addl	%eax, %eax
	leal	-2999(%rbx), %ecx
	movl	%eax, -60(%rbp)                 ## 4-byte Spill
	cltd
	idivl	%ecx
	movl	%eax, %edi
	movl	$65, %esi
	callq	_min
	cmpl	$5, %eax
	jl	LBB0_13
## %bb.10:
	movl	%eax, %ecx
	movl	-60(%rbp), %eax                 ## 4-byte Reload
	cltd
	idivl	%ecx
	movl	%eax, %r14d
	testl	%r12d, %r12d
	je	LBB0_12
## %bb.11:
	movl	%ebx, %eax
	subl	%r14d, %eax
	addl	$2000, %eax                     ## imm = 0x7D0
	cmpl	$4999, %eax                     ## imm = 0x1387
	ja	LBB0_15
LBB0_12:
	shll	$16, %ecx
	addl	$-118528, %ecx                  ## imm = 0xFFFE3100
	movl	%ecx, 4(%r15)
	jmp	LBB0_21
LBB0_13:
	testl	%r12d, %r12d
	je	LBB0_14
LBB0_15:
	leaq	-56(%rbp), %rdx
	movq	-88(%rbp), %rdi                 ## 8-byte Reload
	movl	%r12d, %esi
	callq	_nvbios_pll_parse
	movl	%eax, %r14d
	testl	%eax, %eax
	jne	LBB0_21
## %bb.16:
	movq	-48(%rbp), %rax                 ## 8-byte Reload
	leal	-16(%rax), %esi
	movq	%r13, %rdi
	movl	$1, %edx
	callq	_read_clk
	movl	%eax, -56(%rbp)
	testl	%eax, %eax
	je	LBB0_17
## %bb.19:
	leaq	-72(%rbp), %rax
	movq	%rax, (%rsp)
	leaq	-56(%rbp), %rsi
	leaq	-68(%rbp), %rcx
	leaq	-64(%rbp), %r9
	movq	%r13, %rdi
	movl	%ebx, %edx
	xorl	%r8d, %r8d
	callq	_nva3_calc_pll
	movl	%eax, %r14d
	testl	%eax, %eax
	js	LBB0_21
## %bb.20:
	movq	-48(%rbp), %rax                 ## 8-byte Reload
	leal	16672(,%rax,4), %esi
	movq	-96(%rbp), %rdi                 ## 8-byte Reload
	callq	_nv_rd32
	movl	%eax, 4(%r15)
	movl	-72(%rbp), %eax
	shll	$16, %eax
	movl	-68(%rbp), %ecx
	shll	$8, %ecx
	orl	%eax, %ecx
	orl	-64(%rbp), %ecx
	movl	%ecx, (%r15)
	jmp	LBB0_21
LBB0_14:
	leaq	L_.str.1(%rip), %rsi
	movq	%r14, %rdi
	movq	-48(%rbp), %rdx                 ## 8-byte Reload
                                        ## kill: def $edx killed $edx killed $rdx
	movl	%ebx, %ecx
	movq	-80(%rbp), %r8                  ## 8-byte Reload
                                        ## kill: def $r8d killed $r8d killed $r8
	callq	_NV_ERROR
	movq	_ERANGE@GOTPCREL(%rip), %rax
	jmp	LBB0_18
LBB0_17:
	movq	_EINVAL@GOTPCREL(%rip), %rax
LBB0_18:
	xorl	%r14d, %r14d
	subl	(%rax), %r14d
LBB0_21:
	movl	%r14d, %eax
	addq	$72, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"no clock for 0x%04x/0x%02x\n"

L_.str.1:                               ## @.str.1
	.asciz	"bad freq %02x: %d %d\n"

	.comm	_ERANGE,4,2                     ## @ERANGE
	.comm	_EINVAL,4,2                     ## @EINVAL
	.no_dead_strip	_calc_clk
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function calc_clk
_calc_clk:                              ; @calc_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
	mov	x19, x4
	mov	x21, x3
	mov	x24, x2
	mov	x20, x1
	mov	x22, x0
	bl	_nouveau_drm
	mov	x25, x0
	mov	x0, x22
	bl	_nouveau_dev
	mov	x23, x0
	bl	_nouveau_bios
	mov	x26, x0
	str	xzr, [x19]
	mov	w8, #34463
	movk	w8, #1, lsl #16
	cmp	w21, w8
	b.gt	LBB0_4
; %bb.1:
	cbz	w21, LBB0_7
; %bb.2:
	mov	w8, #27000
	cmp	w21, w8
	b.ne	LBB0_9
; %bb.3:
	mov	w8, #256
	str	w8, [x19, #4]
	mov	w25, #27000
	b	LBB0_21
LBB0_4:
	mov	w8, #34464
	movk	w8, #1, lsl #16
	cmp	w21, w8
	b.eq	LBB0_8
; %bb.5:
	mov	w8, #42464
	movk	w8, #1, lsl #16
	cmp	w21, w8
	b.ne	LBB0_9
; %bb.6:
	mov	w8, #8512
	str	w8, [x19, #4]
	mov	w25, #42464
	movk	w25, #1, lsl #16
	b	LBB0_21
LBB0_7:
Lloh0:
	adrp	x1, l_.str@PAGE
Lloh1:
	add	x1, x1, l_.str@PAGEOFF
	mov	x0, x25
	mov	x2, x24
	mov	x3, x20
	bl	_NV_DEBUG
	mov	w25, #0
	b	LBB0_21
LBB0_8:
	mov	w8, #8448
	str	w8, [x19, #4]
	mov	w25, #34464
	movk	w25, #1, lsl #16
	b	LBB0_21
LBB0_9:
	mov	x0, x22
	mov	x1, x20
	bl	_read_vco
	mov	x27, x0
	lsl	w28, w0, #1
	sub	w8, w21, #2999
	sdiv	w0, w28, w8
	mov	w1, #65
	bl	_min
	cmp	w0, #5
	b.lt	LBB0_13
; %bb.10:
	sdiv	w25, w28, w0
	cbz	w24, LBB0_12
; %bb.11:
	sub	w8, w21, w25
	add	w8, w8, #2000
	lsr	w8, w8, #3
	cmp	w8, #624
	b.hi	LBB0_14
LBB0_12:
	mov	w8, #12544
	movk	w8, #65534, lsl #16
	add	w8, w8, w0, lsl #16
	str	w8, [x19, #4]
	b	LBB0_21
LBB0_13:
	cbz	w24, LBB0_18
LBB0_14:
	add	x2, sp, #24
	mov	x0, x26
	mov	x1, x24
	bl	_nvbios_pll_parse
	mov	x25, x0
	cbnz	w0, LBB0_21
; %bb.15:
	sub	w1, w20, #16
	mov	x0, x22
	mov	w2, #1
	bl	_read_clk
	str	w0, [sp, #24]
	cbz	w0, LBB0_19
; %bb.16:
	add	x1, sp, #24
	add	x3, sp, #16
	add	x5, sp, #12
	add	x6, sp, #20
	mov	x0, x22
	mov	x2, x21
	mov	x4, #0
	bl	_nva3_calc_pll
	mov	x25, x0
	tbnz	w0, #31, LBB0_21
; %bb.17:
	mov	w8, #16672
	add	w1, w8, w20, lsl #2
	mov	x0, x23
	bl	_nv_rd32
	ldp	w9, w8, [sp, #16]
	lsl	w9, w9, #8
	orr	w8, w9, w8, lsl #16
	ldr	w9, [sp, #12]
	orr	w8, w8, w9
	stp	w8, w0, [x19]
	b	LBB0_21
LBB0_18:
Lloh2:
	adrp	x1, l_.str.1@PAGE
Lloh3:
	add	x1, x1, l_.str.1@PAGEOFF
	mov	x0, x25
	mov	x2, x20
	mov	x3, x21
	mov	x4, x27
	bl	_NV_ERROR
Lloh4:
	adrp	x8, _ERANGE@GOTPAGE
Lloh5:
	ldr	x8, [x8, _ERANGE@GOTPAGEOFF]
	b	LBB0_20
LBB0_19:
Lloh6:
	adrp	x8, _EINVAL@GOTPAGE
Lloh7:
	ldr	x8, [x8, _EINVAL@GOTPAGEOFF]
LBB0_20:
	ldr	w8, [x8]
	neg	w25, w8
LBB0_21:
	mov	x0, x25
	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 AdrpAdd	Lloh0, Lloh1
	.loh AdrpLdrGot	Lloh4, Lloh5
	.loh AdrpAdd	Lloh2, Lloh3
	.loh AdrpLdrGot	Lloh6, Lloh7
	.cfi_endproc
                                        ; -- End function
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"no clock for 0x%04x/0x%02x\n"

l_.str.1:                               ; @.str.1
	.asciz	"bad freq %02x: %d %d\n"

	.comm	_ERANGE,4,2                     ; @ERANGE
	.comm	_EINVAL,4,2                     ; @EINVAL
	.no_dead_strip	_calc_clk
.subsections_via_symbols
