	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_radeon_crtc_handle_flip        ## -- Begin function radeon_crtc_handle_flip
	.p2align	4, 0x90
_radeon_crtc_handle_flip:               ## @radeon_crtc_handle_flip
	.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
	movl	%esi, %r15d
	movq	%rdi, %rbx
	movq	8(%rdi), %rax
	movslq	%esi, %r12
	movq	(%rax,%r12,8), %r13
	movq	(%rdi), %rdi
	callq	_spin_lock_irqsave
	movq	8(%r13), %r14
	testq	%r14, %r14
	je	LBB0_15
## %bb.1:
	movq	16(%r14), %rdi
	testq	%rdi, %rdi
	je	LBB0_3
## %bb.2:
	callq	_radeon_fence_signaled
	testl	%eax, %eax
	je	LBB0_15
LBB0_3:
	cmpl	$0, (%r13)
	je	LBB0_4
## %bb.10:
	movl	$0, (%r13)
LBB0_11:
	leaq	16(%r14), %rax
	movq	%rax, -48(%rbp)                 ## 8-byte Spill
	movq	$0, 8(%r13)
	movq	24(%r14), %r12
	testq	%r12, %r12
	je	LBB0_13
## %bb.12:
	movq	(%rbx), %rdi
	leaq	-64(%rbp), %rdx
	movl	%r15d, %esi
	callq	_drm_vblank_count_and_time
	movl	%eax, 24(%r12)
	movl	-60(%rbp), %eax
	movl	%eax, 20(%r12)
	movl	-64(%rbp), %eax
	movl	%eax, 16(%r12)
	leaq	8(%r12), %rdi
	movq	(%r12), %rsi
	addq	$4, %rsi
	callq	_list_add_tail
	movq	(%r12), %rdi
	callq	_wake_up_interruptible
LBB0_13:
	movq	(%rbx), %rdi
	callq	_spin_unlock_irqrestore
	movq	(%rbx), %rdi
	movl	4(%r13), %esi
	callq	_drm_vblank_put
	movq	-48(%rbp), %rdi                 ## 8-byte Reload
	callq	_radeon_fence_unref
	movl	4(%r14), %esi
	movl	8(%r14), %edi
	callq	_radeon_post_page_flip
	movq	%r14, %rdi
	callq	_schedule_work
LBB0_14:
	addq	$40, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_15:
	movq	(%rbx), %rdi
	addq	$40, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	jmp	_spin_unlock_irqrestore         ## TAILCALL
LBB0_4:
	movl	32(%r14), %edx
	movq	%rbx, %rdi
	movl	%r15d, %esi
	callq	_radeon_page_flip
	testq	%rax, %rax
	je	LBB0_11
## %bb.5:
	movq	_DRM_SCANOUTPOS_VALID@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movl	%eax, -48(%rbp)                 ## 4-byte Spill
	movq	(%rbx), %rdi
	leaq	-52(%rbp), %rdx
	leaq	-68(%rbp), %rcx
	movl	%r15d, %esi
	callq	_radeon_get_crtc_scanoutpos
	testl	%eax, -48(%rbp)                 ## 4-byte Folded Reload
	je	LBB0_9
## %bb.6:
	movl	-52(%rbp), %eax
	movq	8(%rbx), %rcx
	movq	(%rcx,%r12,8), %rcx
	imull	$99, 16(%rcx), %ecx
	movslq	%ecx, %rcx
	imulq	$1374389535, %rcx, %rcx         ## imm = 0x51EB851F
	movq	%rcx, %rdx
	shrq	$63, %rdx
	sarq	$37, %rcx
	addl	%edx, %ecx
	cmpl	%ecx, %eax
	jge	LBB0_11
## %bb.7:
	testl	%eax, %eax
	jns	LBB0_9
## %bb.8:
	movq	%rbx, %rdi
	callq	_ASIC_IS_AVIVO
	testl	%eax, %eax
	je	LBB0_11
LBB0_9:
	movl	$1, (%r13)
	movq	(%rbx), %rdi
	callq	_spin_unlock_irqrestore
	jmp	LBB0_14
	.cfi_endproc
                                        ## -- End function
	.comm	_DRM_SCANOUTPOS_VALID,4,2       ## @DRM_SCANOUTPOS_VALID
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_radeon_crtc_handle_flip        ; -- Begin function radeon_crtc_handle_flip
	.p2align	2
_radeon_crtc_handle_flip:               ; @radeon_crtc_handle_flip
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #80
	.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
	mov	x22, x1
	mov	x20, x0
	ldp	x0, x8, [x0]
	ldr	x23, [x8, w1, sxtw #3]
	bl	_spin_lock_irqsave
	ldr	x19, [x23, #8]
	cbz	x19, LBB0_9
; %bb.1:
	mov	x21, x19
	ldr	x0, [x21, #16]!
	cbz	x0, LBB0_3
; %bb.2:
	bl	_radeon_fence_signaled
	cbz	w0, LBB0_9
LBB0_3:
	ldr	w8, [x23]
	cbz	w8, LBB0_10
; %bb.4:
	str	wzr, [x23]
LBB0_5:
	str	xzr, [x23, #8]
	ldr	x24, [x19, #24]
	cbz	x24, LBB0_7
; %bb.6:
	ldr	x0, [x20]
	add	x2, sp, #8
	mov	x1, x22
	bl	_drm_vblank_count_and_time
	str	w0, [x24, #24]
	ldr	d0, [sp, #8]
	str	d0, [x24, #16]
	add	x0, x24, #8
	ldr	x8, [x24]
	add	x1, x8, #4
	bl	_list_add_tail
	ldr	x0, [x24]
	bl	_wake_up_interruptible
LBB0_7:
	ldr	x0, [x20]
	bl	_spin_unlock_irqrestore
	ldr	x0, [x20]
	ldr	w1, [x23, #4]
	bl	_drm_vblank_put
	mov	x0, x21
	bl	_radeon_fence_unref
	ldp	w1, w0, [x19, #4]
	bl	_radeon_post_page_flip
	mov	x0, x19
	bl	_schedule_work
LBB0_8:
	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
	add	sp, sp, #80
	ret
LBB0_9:
	ldr	x0, [x20]
	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
	add	sp, sp, #80
	b	_spin_unlock_irqrestore
LBB0_10:
	ldr	w2, [x19, #32]
	mov	x0, x20
	mov	x1, x22
	bl	_radeon_page_flip
	cbz	x0, LBB0_5
; %bb.11:
Lloh0:
	adrp	x8, _DRM_SCANOUTPOS_VALID@GOTPAGE
Lloh1:
	ldr	x8, [x8, _DRM_SCANOUTPOS_VALID@GOTPAGEOFF]
Lloh2:
	ldr	w24, [x8]
	ldr	x0, [x20]
	add	x2, sp, #4
	mov	x3, sp
	mov	x1, x22
	bl	_radeon_get_crtc_scanoutpos
	tst	w0, w24
	b.eq	LBB0_15
; %bb.12:
	sxtw	x9, w22
	ldr	w8, [sp, #4]
	ldr	x10, [x20, #8]
	ldr	x9, [x10, x9, lsl #3]
	ldr	w9, [x9, #16]
	mov	w10, #99
	mul	w9, w9, w10
	mov	w10, #34079
	movk	w10, #20971, lsl #16
	smull	x9, w9, w10
	lsr	x10, x9, #63
	asr	x9, x9, #37
	add	w9, w9, w10
	cmp	w8, w9
	b.ge	LBB0_5
; %bb.13:
	tbz	w8, #31, LBB0_15
; %bb.14:
	mov	x0, x20
	bl	_ASIC_IS_AVIVO
	cbz	w0, LBB0_5
LBB0_15:
	mov	w8, #1
	str	w8, [x23]
	ldr	x0, [x20]
	bl	_spin_unlock_irqrestore
	b	LBB0_8
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.cfi_endproc
                                        ; -- End function
	.comm	_DRM_SCANOUTPOS_VALID,4,2       ; @DRM_SCANOUTPOS_VALID
.subsections_via_symbols
