	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function polaris10_calculate_sclk_params
_polaris10_calculate_sclk_params:       ## @polaris10_calculate_sclk_params
	.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	%r12
	pushq	%rbx
	subq	$64, %rsp
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rdx, %r15
	movq	%rsi, %rbx
	movq	%rdi, %r14
	movq	8(%rdi), %r12
	movq	%rsi, 64(%rdx)
	leaq	-96(%rbp), %rdx
	callq	_atomctrl_get_engine_pll_dividers_ai
	testl	%eax, %eax
	je	LBB0_1
## %bb.2:
	movq	(%r14), %rdi
	callq	_amdgpu_asic_get_xclk
	movq	%rax, %r14
	movq	_NUM_SCLK_RANGE@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	testq	%rax, %rax
	je	LBB0_8
## %bb.3:
	movq	(%r12), %rcx
	addq	$8, %rcx
	xorl	%edx, %edx
	jmp	LBB0_4
	.p2align	4, 0x90
LBB0_7:                                 ##   in Loop: Header=BB0_4 Depth=1
	incq	%rdx
	addq	$16, %rcx
	cmpq	%rdx, %rax
	je	LBB0_8
LBB0_4:                                 ## =>This Inner Loop Header: Depth=1
	cmpq	%rbx, -8(%rcx)
	jge	LBB0_7
## %bb.5:                               ##   in Loop: Header=BB0_4 Depth=1
	cmpq	%rbx, (%rcx)
	jl	LBB0_7
## %bb.6:
	movq	%rdx, 8(%r15)
LBB0_8:
	movq	8(%r12), %rax
	movq	8(%r15), %rcx
	movb	(%rax,%rcx,8), %cl
	movq	%rbx, %rdi
	shlq	%cl, %rdi
	movq	%rdi, %rax
	orq	%r14, %rax
	shrq	$32, %rax
	je	LBB0_9
## %bb.10:
	movq	%rdi, %rax
	cqto
	idivq	%r14
	jmp	LBB0_11
LBB0_1:
	movl	-96(%rbp), %eax
	movl	%eax, (%r15)
	movups	-48(%rbp), %xmm0
	movups	%xmm0, 40(%r15)
	movq	-88(%rbp), %rax
	movq	%rax, 8(%r15)
	movl	$1024, 16(%r15)                 ## imm = 0x400
	movl	-56(%rbp), %eax
	movl	%eax, 60(%r15)
	movl	$65535, 20(%r15)                ## imm = 0xFFFF
	movl	-80(%rbp), %eax
	movl	%eax, 24(%r15)
	movq	-64(%rbp), %rax
	movq	%rax, 32(%r15)
	movl	-76(%rbp), %eax
	movl	%eax, 28(%r15)
	movl	-72(%rbp), %eax
	movl	%eax, 56(%r15)
	jmp	LBB0_18
LBB0_9:
	movl	%edi, %eax
	xorl	%edx, %edx
	divl	%r14d
                                        ## kill: def $eax killed $eax def $rax
LBB0_11:
	movq	%rax, 48(%r15)
	shll	$16, %edi
                                        ## kill: def $edi killed $edi killed $rdi
	movq	%r14, %rsi
	callq	_do_div
	movl	$0, (%r15)
	movabsq	$-7378697629483820647, %rcx     ## imm = 0x9999999999999999
	movq	%rbx, %rax
	imulq	%rcx
	movq	%rdx, %rax
	shrq	$63, %rax
	sarq	$2, %rdx
	addq	%rax, %rdx
	addq	%rbx, %rdx
	movq	8(%r12), %rax
	movq	8(%r15), %rcx
	movq	(%rax,%rcx,8), %rcx
	shlq	%cl, %rdx
	movq	%rdx, %rax
	orq	%r14, %rax
	shrq	$32, %rax
	je	LBB0_12
## %bb.13:
	movq	%rdx, %rax
	cqto
	idivq	%r14
	movq	%rax, %rsi
	jmp	LBB0_14
LBB0_12:
	movl	%edx, %eax
	xorl	%edx, %edx
	divl	%r14d
	movl	%eax, %esi
LBB0_14:
	movabsq	$6640827866535438581, %rdx      ## imm = 0x5C28F5C28F5C28F5
	movq	%rbx, %rax
	imulq	%rdx
	movq	%rdx, %rdi
	subq	%rbx, %rdi
	movq	%rdi, %rax
	shrq	$63, %rax
	sarq	$5, %rdi
	addq	%rax, %rdi
	addq	%rbx, %rdi
                                        ## kill: def $cl killed $cl killed $rcx
	shlq	%cl, %rdi
	movq	%rsi, 40(%r15)
	movl	$1, 24(%r15)
	movq	%r14, %rax
	orq	%rdi, %rax
	shrq	$32, %rax
	je	LBB0_15
## %bb.16:
	movq	%rdi, %rax
	cqto
	idivq	%r14
	jmp	LBB0_17
LBB0_15:
	movl	%edi, %eax
	xorl	%edx, %edx
	divl	%r14d
                                        ## kill: def $eax killed $eax def $rax
LBB0_17:
	movq	%rax, 32(%r15)
	shll	$16, %edi
                                        ## kill: def $edi killed $edi killed $rdi
	movq	%r14, %rsi
	callq	_do_div
	movl	$0, 28(%r15)
LBB0_18:
	xorl	%eax, %eax
	addq	$64, %rsp
	popq	%rbx
	popq	%r12
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_NUM_SCLK_RANGE,8,3             ## @NUM_SCLK_RANGE
	.no_dead_strip	_polaris10_calculate_sclk_params
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.section	__TEXT,__literal8,8byte_literals
	.p2align	3                               ; -- Begin function polaris10_calculate_sclk_params
lCPI0_0:
	.long	1024                            ; 0x400
	.long	65535                           ; 0xffff
	.section	__TEXT,__text,regular,pure_instructions
	.p2align	2
_polaris10_calculate_sclk_params:       ; @polaris10_calculate_sclk_params
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #112
	.cfi_def_cfa_offset 112
	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
	mov	x19, x2
	mov	x20, x1
	mov	x21, x0
	ldr	x22, [x0, #8]
	str	x1, [x2, #64]
	mov	x2, sp
	bl	_atomctrl_get_engine_pll_dividers_ai
	cbz	w0, LBB0_8
; %bb.1:
	ldr	x0, [x21]
	bl	_amdgpu_asic_get_xclk
	mov	x21, x0
Lloh0:
	adrp	x8, _NUM_SCLK_RANGE@GOTPAGE
Lloh1:
	ldr	x8, [x8, _NUM_SCLK_RANGE@GOTPAGEOFF]
Lloh2:
	ldr	x8, [x8]
	cbz	x8, LBB0_7
; %bb.2:
	mov	x9, #0
	ldr	x10, [x22]
	add	x10, x10, #8
	b	LBB0_4
LBB0_3:                                 ;   in Loop: Header=BB0_4 Depth=1
	add	x9, x9, #1
	add	x10, x10, #16
	cmp	x8, x9
	b.eq	LBB0_7
LBB0_4:                                 ; =>This Inner Loop Header: Depth=1
	ldur	x11, [x10, #-8]
	cmp	x11, x20
	b.ge	LBB0_3
; %bb.5:                                ;   in Loop: Header=BB0_4 Depth=1
	ldr	x11, [x10]
	cmp	x11, x20
	b.lt	LBB0_3
; %bb.6:
	str	x9, [x19, #8]
LBB0_7:
	ldr	x8, [x22, #8]
	ldr	x9, [x19, #8]
	ldr	x8, [x8, x9, lsl #3]
	lsl	x8, x20, x8
	sdiv	x9, x8, x21
	str	x9, [x19, #48]
	lsl	w0, w8, #16
	mov	x1, x21
	bl	_do_div
	str	wzr, [x19]
	mov	x8, #-7378697629483820647
	smulh	x8, x20, x8
	asr	x9, x8, #2
	add	x8, x9, x8, lsr #63
	ldr	x9, [x22, #8]
	ldr	x10, [x19, #8]
	ldr	x9, [x9, x10, lsl #3]
	mov	w10, #1
	str	w10, [x19, #24]
	mov	x10, #10485
	movk	x10, #36700, lsl #16
	movk	x10, #62914, lsl #32
	movk	x10, #23592, lsl #48
	smulh	x10, x20, x10
	sub	x10, x10, x20
	asr	x11, x10, #5
	add	x10, x11, x10, lsr #63
	add	x8, x8, x20
	lsl	x8, x8, x9
	sdiv	x8, x8, x21
	add	x10, x10, x20
	lsl	x9, x10, x9
	sdiv	x10, x9, x21
	stp	x10, x8, [x19, #32]
	lsl	w0, w9, #16
	mov	x1, x21
	bl	_do_div
	str	wzr, [x19, #28]
	b	LBB0_9
LBB0_8:
	ldp	x9, x8, [sp, #48]
	stp	x9, x8, [x19, #40]
	ldr	w8, [sp]
	str	w8, [x19]
	ldr	x8, [sp, #8]
	str	x8, [x19, #8]
	ldr	w8, [sp, #40]
Lloh3:
	adrp	x10, lCPI0_0@PAGE
Lloh4:
	ldr	d0, [x10, lCPI0_0@PAGEOFF]
	str	d0, [x19, #16]
	ldr	x10, [sp, #32]
	str	x10, [x19, #32]
	ldp	w9, w10, [sp, #16]
	stp	w9, w10, [x19, #24]
	ldr	w9, [sp, #24]
	stp	w9, w8, [x19, #56]
LBB0_9:
	mov	w0, #0
	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
	add	sp, sp, #112
	ret
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdr	Lloh3, Lloh4
	.cfi_endproc
                                        ; -- End function
	.comm	_NUM_SCLK_RANGE,8,3             ; @NUM_SCLK_RANGE
	.no_dead_strip	_polaris10_calculate_sclk_params
.subsections_via_symbols
