	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function nv50_crtc_set_scale
_nv50_crtc_set_scale:                   ## @nv50_crtc_set_scale
	.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
	movl	%esi, -52(%rbp)                 ## 4-byte Spill
	movq	%rdi, %r12
	movl	20(%rdi), %edi
	callq	_nv50_mast
	movq	%rax, -48(%rbp)                 ## 8-byte Spill
	movq	_DRM_MODE_SCALE_NONE@GOTPCREL(%rip), %r15
	movl	(%r15), %r14d
	movq	%r12, %rdi
	callq	_nouveau_crtc_connector_get
	movq	%rax, %rbx
	testq	%rax, %rax
	je	LBB0_3
## %bb.1:
	cmpq	$0, 32(%rbx)
	je	LBB0_3
## %bb.2:
	movl	(%rbx), %r14d
LBB0_3:
	cmpl	(%r15), %r14d
	jne	LBB0_5
## %bb.4:
	leaq	8(%r12), %rax
	jmp	LBB0_6
LBB0_5:
	movq	32(%rbx), %rax
LBB0_6:
	movl	(%rax), %r13d
	movl	4(%rax), %r15d
	movq	_DRM_MODE_FLAG_DBLSCAN@GOTPCREL(%rip), %rcx
	movl	(%rcx), %ecx
	testl	%ecx, 8(%rax)
	setne	%cl
	shll	%cl, %r15d
	testq	%rbx, %rbx
	je	LBB0_11
## %bb.7:
	movq	8(%rbx), %rax
	movq	_UNDERSCAN_ON@GOTPCREL(%rip), %rcx
	cmpq	(%rcx), %rax
	jne	LBB0_12
LBB0_8:
	movl	16(%rbx), %esi
	movl	20(%rbx), %ecx
	movl	%r15d, %eax
	shll	$19, %eax
	cltd
	idivl	%r13d
	testl	%esi, %esi
	je	LBB0_17
## %bb.9:
	addl	%esi, %esi
	subl	%esi, %r13d
	testl	%ecx, %ecx
	movq	-48(%rbp), %rbx                 ## 8-byte Reload
	jne	LBB0_18
## %bb.10:
	movl	%r13d, %ecx
	imull	%eax, %ecx
	jmp	LBB0_21
LBB0_12:
	movq	_UNDERSCAN_AUTO@GOTPCREL(%rip), %rcx
	cmpq	(%rcx), %rax
	jne	LBB0_11
## %bb.13:
	movq	24(%rbx), %rdi
	testq	%rdi, %rdi
	je	LBB0_11
## %bb.14:
	callq	_drm_detect_hdmi_monitor
	testq	%rax, %rax
	jne	LBB0_8
LBB0_11:
	movq	-48(%rbp), %rbx                 ## 8-byte Reload
	cmpl	$129, %r14d
	jne	LBB0_23
	jmp	LBB0_25
LBB0_17:
	movl	%r13d, %edx
	sarl	$4, %edx
	negl	%edx
	addl	%edx, %r13d
	addl	$-32, %r13d
	testl	%ecx, %ecx
	movq	-48(%rbp), %rbx                 ## 8-byte Reload
	je	LBB0_20
LBB0_18:
	addl	%ecx, %ecx
	subl	%ecx, %r15d
	cmpl	$129, %r14d
	jne	LBB0_23
LBB0_25:
	cmpl	%r13d, %r15d
	jge	LBB0_27
LBB0_26:
	movl	8(%r12), %eax
	shll	$19, %eax
	cltd
	idivl	12(%r12)
	movl	%eax, %r13d
	shrl	$31, %r13d
	addl	%eax, %r13d
	imull	%r15d, %eax
	sarl	%r13d
	addl	%eax, %r13d
	sarl	$19, %r13d
	jmp	LBB0_28
LBB0_20:
	movl	%eax, %ecx
	imull	%r13d, %ecx
LBB0_21:
	movl	%eax, %r15d
	shrl	$31, %r15d
	addl	%eax, %r15d
	sarl	%r15d
	addl	%ecx, %r15d
	sarl	$19, %r15d
	cmpl	$129, %r14d
	je	LBB0_25
LBB0_23:
	cmpl	$128, %r14d
	jne	LBB0_28
## %bb.24:
	movl	8(%r12), %edi
	movl	%r13d, %esi
	callq	_min
	movl	%eax, %r13d
	movl	12(%r12), %edi
	movl	%r15d, %esi
	callq	_min
	movl	%eax, %r15d
	cmpl	%r13d, %r15d
	jl	LBB0_26
LBB0_27:
	movl	12(%r12), %eax
	shll	$19, %eax
	cltd
	idivl	8(%r12)
	movl	%eax, %r15d
	shrl	$31, %r15d
	addl	%eax, %r15d
	imull	%r13d, %eax
	sarl	%r15d
	addl	%eax, %r15d
	sarl	$19, %r15d
LBB0_28:
	movq	%rbx, %rdi
	movl	$8, %esi
	callq	_evo_wait
	testq	%rax, %rax
	je	LBB0_34
## %bb.29:
	movq	%rax, %r14
	movq	%rbx, %rdi
	callq	_nv50_vers
	movq	_NVD0_DISP_MAST_CLASS@GOTPCREL(%rip), %rcx
	movl	(%r12), %esi
	cmpq	(%rcx), %rax
	jge	LBB0_31
## %bb.30:
	shll	$10, %esi
	addl	$2264, %esi                     ## imm = 0x8D8
	movq	%r14, %rdi
                                        ## kill: def $esi killed $esi killed $rsi
	movl	$2, %edx
	callq	_evo_mthd
	shll	$16, %r15d
	orl	%r13d, %r15d
	movq	%r14, %rdi
	movl	%r15d, %esi
	callq	_evo_data
	movq	%r14, %rdi
	movl	%r15d, %esi
	callq	_evo_data
	movl	(%r12), %esi
	shll	$10, %esi
	addl	$2212, %esi                     ## imm = 0x8A4
	movq	%r14, %rdi
	movl	$1, %edx
	callq	_evo_mthd
	movq	%r14, %rdi
	xorl	%esi, %esi
	callq	_evo_data
	movl	(%r12), %esi
	shll	$10, %esi
	addl	$2248, %esi                     ## imm = 0x8C8
	jmp	LBB0_32
LBB0_31:
	leal	(%rsi,%rsi,2), %esi
	shll	$8, %esi
	addl	$1216, %esi                     ## imm = 0x4C0
	movq	%r14, %rdi
	movl	$3, %edx
	callq	_evo_mthd
	shll	$16, %r15d
	orl	%r13d, %r15d
	movq	%r14, %rdi
	movl	%r15d, %esi
	callq	_evo_data
	movq	%r14, %rdi
	movl	%r15d, %esi
	callq	_evo_data
	movq	%r14, %rdi
	movl	%r15d, %esi
	callq	_evo_data
	movl	(%r12), %eax
	leal	(%rax,%rax,2), %esi
	shll	$8, %esi
	addl	$1172, %esi                     ## imm = 0x494
	movq	%r14, %rdi
	movl	$1, %edx
	callq	_evo_mthd
	movq	%r14, %rdi
	xorl	%esi, %esi
	callq	_evo_data
	movl	(%r12), %eax
	leal	(%rax,%rax,2), %esi
	shll	$8, %esi
	addl	$1208, %esi                     ## imm = 0x4B8
LBB0_32:
	movq	%r14, %rdi
	movl	$1, %edx
	callq	_evo_mthd
	movl	12(%r12), %esi
	shll	$16, %esi
	orl	8(%r12), %esi
	movq	%r14, %rdi
	callq	_evo_data
	movq	%r14, %rdi
	movq	%rbx, %rsi
	callq	_evo_kick
	cmpl	$0, -52(%rbp)                   ## 4-byte Folded Reload
	je	LBB0_34
## %bb.33:
	addq	$4, %r12
	movq	%r12, %rdi
	callq	_nv50_display_flip_stop
	movl	(%r12), %esi
	movq	%r12, %rdi
	xorl	%edx, %edx
	movl	$1, %ecx
	callq	_nv50_display_flip_next
LBB0_34:
	xorl	%eax, %eax
	addq	$24, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_DRM_MODE_SCALE_NONE,4,2        ## @DRM_MODE_SCALE_NONE
	.comm	_DRM_MODE_FLAG_DBLSCAN,4,2      ## @DRM_MODE_FLAG_DBLSCAN
	.comm	_UNDERSCAN_ON,8,3               ## @UNDERSCAN_ON
	.comm	_UNDERSCAN_AUTO,8,3             ## @UNDERSCAN_AUTO
	.comm	_NVD0_DISP_MAST_CLASS,8,3       ## @NVD0_DISP_MAST_CLASS
	.no_dead_strip	_nv50_crtc_set_scale
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function nv50_crtc_set_scale
_nv50_crtc_set_scale:                   ; @nv50_crtc_set_scale
	.cfi_startproc
; %bb.0:
	stp	x26, x25, [sp, #-80]!           ; 16-byte Folded Spill
	.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
	.cfi_offset w25, -72
	.cfi_offset w26, -80
	mov	x20, x1
	mov	x19, x0
	ldr	w0, [x0, #20]
	bl	_nv50_mast
	mov	x21, x0
	add	x23, x19, #8
Lloh0:
	adrp	x22, _DRM_MODE_SCALE_NONE@GOTPAGE
Lloh1:
	ldr	x22, [x22, _DRM_MODE_SCALE_NONE@GOTPAGEOFF]
	ldr	w25, [x22]
	mov	x0, x19
	bl	_nouveau_crtc_connector_get
	mov	x24, x0
	cbz	x0, LBB0_3
; %bb.1:
	ldr	x8, [x24, #32]
	cbz	x8, LBB0_3
; %bb.2:
	ldr	w25, [x24]
LBB0_3:
	ldr	w8, [x22]
	cmp	w25, w8
	b.eq	LBB0_5
; %bb.4:
	ldr	x23, [x24, #32]
LBB0_5:
	ldp	w22, w8, [x23]
	ldr	w9, [x23, #8]
Lloh2:
	adrp	x10, _DRM_MODE_FLAG_DBLSCAN@GOTPAGE
Lloh3:
	ldr	x10, [x10, _DRM_MODE_FLAG_DBLSCAN@GOTPAGEOFF]
Lloh4:
	ldr	w10, [x10]
	tst	w10, w9
	cset	w9, ne
	lsl	w23, w8, w9
	cbz	x24, LBB0_15
; %bb.6:
	ldr	x8, [x24, #8]
Lloh5:
	adrp	x9, _UNDERSCAN_ON@GOTPAGE
Lloh6:
	ldr	x9, [x9, _UNDERSCAN_ON@GOTPAGEOFF]
Lloh7:
	ldr	x9, [x9]
	cmp	x8, x9
	b.ne	LBB0_10
LBB0_7:
	ldp	w10, w9, [x24, #16]
	lsl	w8, w23, #19
	sdiv	w8, w8, w22
	cbz	w10, LBB0_13
; %bb.8:
	sub	w22, w22, w10, lsl #1
	cbz	w9, LBB0_28
; %bb.9:
	sub	w23, w23, w9, lsl #1
	cmp	w25, #129
	b.ne	LBB0_16
	b	LBB0_18
LBB0_10:
Lloh8:
	adrp	x9, _UNDERSCAN_AUTO@GOTPAGE
Lloh9:
	ldr	x9, [x9, _UNDERSCAN_AUTO@GOTPAGEOFF]
Lloh10:
	ldr	x9, [x9]
	cmp	x8, x9
	b.ne	LBB0_15
; %bb.11:
	ldr	x0, [x24, #24]
	cbz	x0, LBB0_15
; %bb.12:
	bl	_drm_detect_hdmi_monitor
	cbnz	x0, LBB0_7
	b	LBB0_15
LBB0_13:
	sub	w10, w22, w22, asr #4
	sub	w22, w10, #32
	cbz	w9, LBB0_29
; %bb.14:
	sub	w23, w23, w9, lsl #1
LBB0_15:
	cmp	w25, #129
	b.eq	LBB0_18
LBB0_16:
	cmp	w25, #128
	b.ne	LBB0_21
; %bb.17:
	ldr	w0, [x19, #8]
	mov	x1, x22
	bl	_min
	mov	x22, x0
	ldr	w0, [x19, #12]
	mov	x1, x23
	bl	_min
	mov	x23, x0
LBB0_18:
	cmp	w23, w22
	b.ge	LBB0_20
; %bb.19:
	ldp	w8, w9, [x19, #8]
	lsl	w8, w8, #19
	sdiv	w8, w8, w9
	mul	w9, w8, w23
	cmp	w8, #0
	cinc	w8, w8, lt
	add	w8, w9, w8, asr #1
	asr	w22, w8, #19
	b	LBB0_21
LBB0_20:
	ldp	w9, w8, [x19, #8]
	lsl	w8, w8, #19
	sdiv	w8, w8, w9
	mul	w9, w8, w22
	cmp	w8, #0
	cinc	w8, w8, lt
	add	w8, w9, w8, asr #1
	asr	w23, w8, #19
LBB0_21:
	mov	x0, x21
	mov	w1, #8
	bl	_evo_wait
	cbz	x0, LBB0_27
; %bb.22:
	mov	x24, x0
	mov	x0, x21
	bl	_nv50_vers
Lloh11:
	adrp	x8, _NVD0_DISP_MAST_CLASS@GOTPAGE
Lloh12:
	ldr	x8, [x8, _NVD0_DISP_MAST_CLASS@GOTPAGEOFF]
Lloh13:
	ldr	x9, [x8]
	ldr	w8, [x19]
	cmp	x0, x9
	b.ge	LBB0_24
; %bb.23:
	lsl	w8, w8, #10
	add	w1, w8, #2264
	mov	x0, x24
	mov	w2, #2
	bl	_evo_mthd
	orr	w22, w22, w23, lsl #16
	mov	x0, x24
	mov	x1, x22
	bl	_evo_data
	mov	x0, x24
	mov	x1, x22
	bl	_evo_data
	ldr	w8, [x19]
	lsl	w8, w8, #10
	add	w1, w8, #2212
	mov	x0, x24
	mov	w2, #1
	bl	_evo_mthd
	mov	x0, x24
	mov	w1, #0
	bl	_evo_data
	ldr	w8, [x19]
	lsl	w8, w8, #10
	add	w1, w8, #2248
	b	LBB0_25
LBB0_24:
	mov	w25, #768
	mul	w8, w8, w25
	add	w1, w8, #1216
	mov	x0, x24
	mov	w2, #3
	bl	_evo_mthd
	orr	w22, w22, w23, lsl #16
	mov	x0, x24
	mov	x1, x22
	bl	_evo_data
	mov	x0, x24
	mov	x1, x22
	bl	_evo_data
	mov	x0, x24
	mov	x1, x22
	bl	_evo_data
	ldr	w8, [x19]
	mul	w8, w8, w25
	add	w1, w8, #1172
	mov	x0, x24
	mov	w2, #1
	bl	_evo_mthd
	mov	x0, x24
	mov	w1, #0
	bl	_evo_data
	ldr	w8, [x19]
	mul	w8, w8, w25
	add	w1, w8, #1208
LBB0_25:
	mov	x0, x24
	mov	w2, #1
	bl	_evo_mthd
	ldp	w9, w8, [x19, #8]
	orr	w1, w9, w8, lsl #16
	mov	x0, x24
	bl	_evo_data
	mov	x0, x24
	mov	x1, x21
	bl	_evo_kick
	cbz	w20, LBB0_27
; %bb.26:
	add	x19, x19, #4
	mov	x0, x19
	bl	_nv50_display_flip_stop
	ldr	w1, [x19]
	mov	x0, x19
	mov	x2, #0
	mov	w3, #1
	bl	_nv50_display_flip_next
LBB0_27:
	mov	w0, #0
	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
	ldp	x26, x25, [sp], #80             ; 16-byte Folded Reload
	ret
LBB0_28:
	mul	w9, w22, w8
	b	LBB0_30
LBB0_29:
	mul	w9, w8, w22
LBB0_30:
	cmp	w8, #0
	cinc	w8, w8, lt
	add	w8, w9, w8, asr #1
	asr	w23, w8, #19
	cmp	w25, #129
	b.ne	LBB0_16
	b	LBB0_18
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpLdrGotLdr	Lloh2, Lloh3, Lloh4
	.loh AdrpLdrGotLdr	Lloh5, Lloh6, Lloh7
	.loh AdrpLdrGotLdr	Lloh8, Lloh9, Lloh10
	.loh AdrpLdrGotLdr	Lloh11, Lloh12, Lloh13
	.cfi_endproc
                                        ; -- End function
	.comm	_DRM_MODE_SCALE_NONE,4,2        ; @DRM_MODE_SCALE_NONE
	.comm	_DRM_MODE_FLAG_DBLSCAN,4,2      ; @DRM_MODE_FLAG_DBLSCAN
	.comm	_UNDERSCAN_ON,8,3               ; @UNDERSCAN_ON
	.comm	_UNDERSCAN_AUTO,8,3             ; @UNDERSCAN_AUTO
	.comm	_NVD0_DISP_MAST_CLASS,8,3       ; @NVD0_DISP_MAST_CLASS
	.no_dead_strip	_nv50_crtc_set_scale
.subsections_via_symbols
