	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_armada_crtc_select_clock       ## -- Begin function armada_crtc_select_clock
	.p2align	4, 0x90
_armada_crtc_select_clock:              ## @armada_crtc_select_clock
	.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, %rbx
	movq	%rcx, -104(%rbp)                ## 8-byte Spill
	movq	%rdx, -48(%rbp)                 ## 8-byte Spill
	movq	%rsi, -88(%rbp)                 ## 8-byte Spill
	movq	%r9, -64(%rbp)                  ## 8-byte Spill
	imulq	$1000, %r9, %rcx                ## imm = 0x3E8
	movl	(%rdi), %edx
	movq	%rdi, -72(%rbp)                 ## 8-byte Spill
	movl	4(%rdi), %esi
	leaq	L_.str(%rip), %rdi
	movq	%rcx, -56(%rbp)                 ## 8-byte Spill
                                        ## kill: def $ecx killed $ecx killed $rcx
	xorl	%eax, %eax
	callq	_DRM_DEBUG_KMS
	movq	%rbx, -96(%rbp)                 ## 8-byte Spill
	testq	%rbx, %rbx
	je	LBB0_18
## %bb.1:
	xorl	%ebx, %ebx
	jmp	LBB0_2
LBB0_16:                                ##   in Loop: Header=BB0_2 Depth=1
	movq	%rax, %r13
	movq	%rax, %rdi
	movq	-64(%rbp), %rsi                 ## 8-byte Reload
	callq	_DIV_ROUND_UP
	movq	-48(%rbp), %rcx                 ## 8-byte Reload
	cmpq	24(%rcx), %rax
	jbe	LBB0_15
	.p2align	4, 0x90
LBB0_17:                                ##   in Loop: Header=BB0_2 Depth=1
	incq	%rbx
	cmpq	%rbx, -96(%rbp)                 ## 8-byte Folded Reload
	je	LBB0_18
LBB0_2:                                 ## =>This Inner Loop Header: Depth=1
	movq	-104(%rbp), %rax                ## 8-byte Reload
	movq	(%rax,%rbx,8), %r14
	testq	%r14, %r14
	je	LBB0_17
## %bb.3:                               ##   in Loop: Header=BB0_2 Depth=1
	movq	-48(%rbp), %rax                 ## 8-byte Reload
	movl	(%rax), %r15d
	movl	%ebx, %edi
	callq	_BIT
	movq	%r14, %rdi
	testl	%r15d, %eax
	je	LBB0_5
## %bb.4:                               ##   in Loop: Header=BB0_2 Depth=1
	movq	-56(%rbp), %r13                 ## 8-byte Reload
	movq	%r13, %rsi
	callq	_clk_round_rate
	movq	%rax, %r12
	movq	%r13, -80(%rbp)                 ## 8-byte Spill
	cmpq	%r13, %r12
	jne	LBB0_8
	jmp	LBB0_7
	.p2align	4, 0x90
LBB0_5:                                 ##   in Loop: Header=BB0_2 Depth=1
	callq	_clk_get_rate
	movq	%rax, %r12
	movq	%rax, -80(%rbp)                 ## 8-byte Spill
	movq	-56(%rbp), %r13                 ## 8-byte Reload
	cmpq	%r13, %r12
	je	LBB0_7
LBB0_8:                                 ##   in Loop: Header=BB0_2 Depth=1
	movq	%r12, %rdi
	movq	%r13, %rsi
	callq	_DIV_ROUND_CLOSEST
	testq	%rax, %rax
	je	LBB0_17
## %bb.9:                               ##   in Loop: Header=BB0_2 Depth=1
	movq	%rax, %r15
	movq	-48(%rbp), %rax                 ## 8-byte Reload
	cmpq	8(%rax), %r15
	ja	LBB0_17
## %bb.10:                              ##   in Loop: Header=BB0_2 Depth=1
	movq	%r12, %rdi
	movq	%r15, %rsi
	callq	_DIV_ROUND_CLOSEST
	movq	%rax, %r13
	movq	-72(%rbp), %rax                 ## 8-byte Reload
	movl	(%rax), %edx
	movl	4(%rax), %esi
	movq	%r13, (%rsp)
	leaq	L_.str.1(%rip), %rdi
	movl	%ebx, %ecx
	movq	%r12, %r8
	movq	%r15, %r9
	xorl	%eax, %eax
	callq	_DRM_DEBUG_KMS
	movq	%r13, %rax
	cmpq	-56(%rbp), %r13                 ## 8-byte Folded Reload
	jae	LBB0_16
## %bb.11:                              ##   in Loop: Header=BB0_2 Depth=1
	movq	%rax, %rdx
	movq	-64(%rbp), %rcx                 ## 8-byte Reload
	orq	%rcx, %rdx
	movq	%rax, %r13
	shrq	$32, %rdx
	je	LBB0_12
## %bb.13:                              ##   in Loop: Header=BB0_2 Depth=1
	xorl	%edx, %edx
	divq	%rcx
	jmp	LBB0_14
LBB0_12:                                ##   in Loop: Header=BB0_2 Depth=1
                                        ## kill: def $eax killed $eax killed $rax
	xorl	%edx, %edx
	divl	%ecx
                                        ## kill: def $eax killed $eax def $rax
LBB0_14:                                ##   in Loop: Header=BB0_2 Depth=1
	movq	-48(%rbp), %rcx                 ## 8-byte Reload
	cmpq	16(%rcx), %rax
	jb	LBB0_17
	jmp	LBB0_15
LBB0_18:
	movq	_ERANGE@GOTPCREL(%rip), %rax
	xorl	%ecx, %ecx
	subl	(%rax), %ecx
	movl	%ecx, %ebx
	jmp	LBB0_19
LBB0_7:
	movl	$1, %r15d
	movq	%r13, %r12
LBB0_15:
	movq	-72(%rbp), %rax                 ## 8-byte Reload
	movl	(%rax), %edx
	movl	4(%rax), %esi
	movq	%r13, (%rsp)
	leaq	L_.str.2(%rip), %rdi
	movl	%ebx, %ecx
	movq	%r12, %r8
	movq	%r15, %r9
	xorl	%eax, %eax
	callq	_DRM_DEBUG_KMS
	movq	-88(%rbp), %rax                 ## 8-byte Reload
	movq	-80(%rbp), %rcx                 ## 8-byte Reload
	movq	%rcx, (%rax)
	movq	%r14, 16(%rax)
	movq	%r15, 8(%rax)
LBB0_19:
	movl	%ebx, %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	"[CRTC:%u:%s] desired clock=%luHz\n"

L_.str.1:                               ## @.str.1
	.asciz	"[CRTC:%u:%s] clk=%u %luHz div=%u real=%luHz\n"

	.comm	_ERANGE,4,2                     ## @ERANGE
L_.str.2:                               ## @.str.2
	.asciz	"[CRTC:%u:%s] selected clk=%u %luHz div=%u real=%luHz\n"

.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_armada_crtc_select_clock       ; -- Begin function armada_crtc_select_clock
	.p2align	2
_armada_crtc_select_clock:              ; @armada_crtc_select_clock
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #144
	.cfi_def_cfa_offset 144
	stp	x28, x27, [sp, #48]             ; 16-byte Folded Spill
	stp	x26, x25, [sp, #64]             ; 16-byte Folded Spill
	stp	x24, x23, [sp, #80]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #96]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #112]            ; 16-byte Folded Spill
	stp	x29, x30, [sp, #128]            ; 16-byte Folded Spill
	add	x29, sp, #128
	.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	x23, x4
	mov	x24, x3
	mov	x25, x2
	stp	x1, x5, [sp, #24]               ; 16-byte Folded Spill
	mov	w8, #1000
	mul	x26, x5, x8
	ldp	w2, w1, [x0]
	str	x0, [sp, #40]                   ; 8-byte Folded Spill
Lloh0:
	adrp	x0, l_.str@PAGE
Lloh1:
	add	x0, x0, l_.str@PAGEOFF
	mov	x3, x26
	bl	_DRM_DEBUG_KMS
	cbz	x23, LBB0_12
; %bb.1:
	mov	x20, #0
	b	LBB0_4
LBB0_2:                                 ;   in Loop: Header=BB0_4 Depth=1
	mov	x0, x21
	ldr	x1, [sp, #32]                   ; 8-byte Folded Reload
	bl	_DIV_ROUND_UP
	ldr	x8, [x25, #24]
	cmp	x0, x8
	b.ls	LBB0_14
LBB0_3:                                 ;   in Loop: Header=BB0_4 Depth=1
	add	x20, x20, #1
	cmp	x23, x20
	b.eq	LBB0_12
LBB0_4:                                 ; =>This Inner Loop Header: Depth=1
	ldr	x27, [x24, x20, lsl #3]
	cbz	x27, LBB0_3
; %bb.5:                                ;   in Loop: Header=BB0_4 Depth=1
	ldr	w19, [x25]
	mov	x0, x20
	bl	_BIT
	tst	w0, w19
	b.eq	LBB0_7
; %bb.6:                                ;   in Loop: Header=BB0_4 Depth=1
	mov	x0, x27
	mov	x1, x26
	bl	_clk_round_rate
	mov	x19, x0
	mov	x28, x26
	cmp	x19, x26
	b.ne	LBB0_8
	b	LBB0_13
LBB0_7:                                 ;   in Loop: Header=BB0_4 Depth=1
	mov	x0, x27
	bl	_clk_get_rate
	mov	x28, x0
	mov	x19, x0
	cmp	x19, x26
	b.eq	LBB0_13
LBB0_8:                                 ;   in Loop: Header=BB0_4 Depth=1
	mov	x0, x19
	mov	x1, x26
	bl	_DIV_ROUND_CLOSEST
	cbz	x0, LBB0_3
; %bb.9:                                ;   in Loop: Header=BB0_4 Depth=1
	mov	x22, x0
	ldr	x8, [x25, #8]
	cmp	x0, x8
	b.hi	LBB0_3
; %bb.10:                               ;   in Loop: Header=BB0_4 Depth=1
	mov	x0, x19
	mov	x1, x22
	bl	_DIV_ROUND_CLOSEST
	mov	x21, x0
	ldr	x8, [sp, #40]                   ; 8-byte Folded Reload
	ldp	w2, w1, [x8]
	stp	x22, x0, [sp, #8]
	str	x19, [sp]
Lloh2:
	adrp	x0, l_.str.1@PAGE
Lloh3:
	add	x0, x0, l_.str.1@PAGEOFF
	mov	x3, x20
	bl	_DRM_DEBUG_KMS
	cmp	x21, x26
	b.hs	LBB0_2
; %bb.11:                               ;   in Loop: Header=BB0_4 Depth=1
	ldr	x8, [sp, #32]                   ; 8-byte Folded Reload
	udiv	x8, x21, x8
	ldr	x9, [x25, #16]
	cmp	x8, x9
	b.lo	LBB0_3
	b	LBB0_14
LBB0_12:
Lloh4:
	adrp	x8, _ERANGE@GOTPAGE
Lloh5:
	ldr	x8, [x8, _ERANGE@GOTPAGEOFF]
Lloh6:
	ldr	w8, [x8]
	neg	w20, w8
	b	LBB0_15
LBB0_13:
	mov	x19, x26
	mov	x21, x26
	mov	w22, #1
LBB0_14:
	ldr	x8, [sp, #40]                   ; 8-byte Folded Reload
	ldp	w2, w1, [x8]
	stp	x22, x21, [sp, #8]
	str	x19, [sp]
Lloh7:
	adrp	x0, l_.str.2@PAGE
Lloh8:
	add	x0, x0, l_.str.2@PAGEOFF
	mov	x3, x20
	bl	_DRM_DEBUG_KMS
	ldr	x8, [sp, #24]                   ; 8-byte Folded Reload
	stp	x22, x27, [x8, #8]
	str	x28, [x8]
LBB0_15:
	mov	x0, x20
	ldp	x29, x30, [sp, #128]            ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #112]            ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #96]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #80]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp, #64]             ; 16-byte Folded Reload
	ldp	x28, x27, [sp, #48]             ; 16-byte Folded Reload
	add	sp, sp, #144
	ret
	.loh AdrpAdd	Lloh0, Lloh1
	.loh AdrpAdd	Lloh2, Lloh3
	.loh AdrpLdrGotLdr	Lloh4, Lloh5, Lloh6
	.loh AdrpAdd	Lloh7, Lloh8
	.cfi_endproc
                                        ; -- End function
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"[CRTC:%u:%s] desired clock=%luHz\n"

l_.str.1:                               ; @.str.1
	.asciz	"[CRTC:%u:%s] clk=%u %luHz div=%u real=%luHz\n"

	.comm	_ERANGE,4,2                     ; @ERANGE
l_.str.2:                               ; @.str.2
	.asciz	"[CRTC:%u:%s] selected clk=%u %luHz div=%u real=%luHz\n"

.subsections_via_symbols
