	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_drm_wait_vblank                ## -- Begin function drm_wait_vblank
	.p2align	4, 0x90
_drm_wait_vblank:                       ## @drm_wait_vblank
	.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
	movq	%rdx, %r12
	movq	%rsi, %r14
	movq	%rdi, %r13
	movq	_DRIVER_HAVE_IRQ@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	callq	_drm_core_check_feature
	testq	%rax, %rax
	je	LBB0_4
## %bb.1:
	movq	%r13, %rdi
	callq	_drm_dev_to_irq
	testl	%eax, %eax
	je	LBB0_3
## %bb.2:
	cmpl	$0, 16(%r13)
	je	LBB0_3
LBB0_4:
	movl	(%r14), %esi
	movq	__DRM_VBLANK_SIGNAL@GOTPCREL(%rip), %rax
	testl	%esi, (%rax)
	jne	LBB0_3
## %bb.5:
	movq	__DRM_VBLANK_TYPES_MASK@GOTPCREL(%rip), %rcx
	movq	__DRM_VBLANK_FLAGS_MASK@GOTPCREL(%rip), %rax
	movl	(%rax), %r15d
	movl	(%rcx), %edx
	orl	%r15d, %edx
	movq	__DRM_VBLANK_HIGH_CRTC_MASK@GOTPCREL(%rip), %rax
	movl	(%rax), %ebx
	orl	%ebx, %edx
	movl	%edx, %eax
	notl	%eax
	testl	%eax, %esi
	je	LBB0_7
## %bb.6:
	leaq	L_.str(%rip), %rdi
	callq	_DRM_ERROR
	jmp	LBB0_3
LBB0_7:
	andl	%esi, %r15d
	andl	%esi, %ebx
	je	LBB0_9
## %bb.8:
	movq	__DRM_VBLANK_HIGH_CRTC_SHIFT@GOTPCREL(%rip), %rax
	movb	(%rax), %cl
	shrl	%cl, %ebx
	cmpl	(%r13), %ebx
	jae	LBB0_3
LBB0_11:
	movq	%r13, %rdi
	movl	%ebx, %esi
	callq	_drm_vblank_get
	testl	%eax, %eax
	je	LBB0_13
## %bb.12:
	movl	%eax, %ebx
	leaq	L_.str.1(%rip), %rdi
	movl	%eax, %esi
	xorl	%eax, %eax
	callq	_DRM_DEBUG
	jmp	LBB0_26
LBB0_9:
	movq	__DRM_VBLANK_SECONDARY@GOTPCREL(%rip), %rax
	xorl	%ebx, %ebx
	testl	%r15d, (%rax)
	setne	%bl
	cmpl	(%r13), %ebx
	jb	LBB0_11
LBB0_3:
	movq	_EINVAL@GOTPCREL(%rip), %rax
	xorl	%ebx, %ebx
	subl	(%rax), %ebx
LBB0_26:
	movl	%ebx, %eax
	addq	$24, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_13:
	movl	%ebx, %ecx
	movq	%r13, %rdi
	movl	%ecx, %esi
	callq	_drm_vblank_count
	movl	(%r14), %ecx
	movq	__DRM_VBLANK_TYPES_MASK@GOTPCREL(%rip), %rdx
	movl	(%rdx), %edx
	andl	%ecx, %edx
	cmpl	$129, %edx
	je	LBB0_16
## %bb.14:
	cmpl	$128, %edx
	jne	LBB0_27
## %bb.15:
	addl	%eax, 4(%r14)
	andl	$-129, %ecx
	movl	%ecx, (%r14)
LBB0_16:
	movq	__DRM_VBLANK_EVENT@GOTPCREL(%rip), %rcx
	testl	%r15d, (%rcx)
	je	LBB0_17
## %bb.28:
	movq	%r13, %rdi
	movl	%ebx, %esi
	movq	%r14, %rdx
	movq	%r12, %rcx
	addq	$24, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	jmp	_drm_queue_vblank_event         ## TAILCALL
LBB0_27:
	movl	%ebx, %r15d
	movq	_EINVAL@GOTPCREL(%rip), %rax
	xorl	%ebx, %ebx
	subl	(%rax), %ebx
	jmp	LBB0_25
LBB0_17:
	movq	__DRM_VBLANK_NEXTONMISS@GOTPCREL(%rip), %rcx
	movl	4(%r14), %esi
	testl	%r15d, (%rcx)
	je	LBB0_20
## %bb.18:
	movl	%eax, %ecx
	subl	%esi, %ecx
	cmpl	$8388608, %ecx                  ## imm = 0x800000
	ja	LBB0_20
## %bb.19:
	incl	%eax
	movl	%eax, 4(%r14)
	movl	%eax, %esi
LBB0_20:
	leaq	L_.str.2(%rip), %rdi
	movl	%ebx, %edx
	xorl	%eax, %eax
	callq	_DRM_DEBUG
	movl	4(%r14), %eax
	movq	8(%r13), %rcx
	movl	%ebx, %edx
	movl	%eax, (%rcx,%rdx,4)
	movq	24(%r13), %rax
	movl	(%rax,%rdx,4), %eax
	movl	%eax, -44(%rbp)                 ## 4-byte Spill
	movq	_DRM_HZ@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	leal	(%rax,%rax,2), %r12d
	movq	%r13, %rdi
	movl	%ebx, %r15d
	movl	%ebx, %esi
	callq	_drm_vblank_count
	subl	4(%r14), %eax
	movl	$1, %ecx
	cmpl	$8388609, %eax                  ## imm = 0x800001
	jb	LBB0_22
## %bb.21:
	xorl	%ecx, %ecx
	cmpl	$0, 16(%r13)
	sete	%cl
LBB0_22:
	xorl	%ebx, %ebx
	xorl	%edi, %edi
	movl	-44(%rbp), %esi                 ## 4-byte Reload
	movl	%r12d, %edx
	callq	_DRM_WAIT_ON
	movq	_EINTR@GOTPCREL(%rip), %rax
	cmpl	$0, (%rax)
	je	LBB0_24
## %bb.23:
	leaq	-56(%rbp), %rdx
	movq	%r13, %rdi
	movl	%r15d, %esi
	callq	_drm_vblank_count_and_time
	movl	%eax, (%r14)
	movl	-52(%rbp), %ecx
	movl	%ecx, 8(%r14)
	movl	-56(%rbp), %ecx
	movl	%ecx, 4(%r14)
	leaq	L_.str.3(%rip), %rdi
	movl	%eax, %esi
	xorl	%eax, %eax
	callq	_DRM_DEBUG
	jmp	LBB0_25
LBB0_24:
	leaq	L_.str.4(%rip), %rdi
	xorl	%ebx, %ebx
	xorl	%eax, %eax
	callq	_DRM_DEBUG
LBB0_25:
	movq	%r13, %rdi
	movl	%r15d, %esi
	callq	_drm_vblank_put
	jmp	LBB0_26
	.cfi_endproc
                                        ## -- End function
	.comm	_DRIVER_HAVE_IRQ,4,2            ## @DRIVER_HAVE_IRQ
	.comm	_EINVAL,4,2                     ## @EINVAL
	.comm	__DRM_VBLANK_SIGNAL,4,2         ## @_DRM_VBLANK_SIGNAL
	.comm	__DRM_VBLANK_TYPES_MASK,4,2     ## @_DRM_VBLANK_TYPES_MASK
	.comm	__DRM_VBLANK_FLAGS_MASK,4,2     ## @_DRM_VBLANK_FLAGS_MASK
	.comm	__DRM_VBLANK_HIGH_CRTC_MASK,4,2 ## @_DRM_VBLANK_HIGH_CRTC_MASK
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"Unsupported type value 0x%x, supported mask 0x%x\n"

	.comm	__DRM_VBLANK_HIGH_CRTC_SHIFT,4,2 ## @_DRM_VBLANK_HIGH_CRTC_SHIFT
	.comm	__DRM_VBLANK_SECONDARY,4,2      ## @_DRM_VBLANK_SECONDARY
L_.str.1:                               ## @.str.1
	.asciz	"failed to acquire vblank counter, %d\n"

	.comm	__DRM_VBLANK_EVENT,4,2          ## @_DRM_VBLANK_EVENT
	.comm	__DRM_VBLANK_NEXTONMISS,4,2     ## @_DRM_VBLANK_NEXTONMISS
L_.str.2:                               ## @.str.2
	.asciz	"waiting on vblank count %d, crtc %d\n"

	.comm	_DRM_HZ,4,2                     ## @DRM_HZ
	.comm	_EINTR,4,2                      ## @EINTR
L_.str.3:                               ## @.str.3
	.asciz	"returning %d to client\n"

L_.str.4:                               ## @.str.4
	.asciz	"vblank wait interrupted by signal\n"

.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_drm_wait_vblank                ; -- Begin function drm_wait_vblank
	.p2align	2
_drm_wait_vblank:                       ; @drm_wait_vblank
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #112
	.cfi_def_cfa_offset 112
	stp	x26, x25, [sp, #32]             ; 16-byte Folded Spill
	stp	x24, x23, [sp, #48]             ; 16-byte Folded Spill
	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
	.cfi_offset w23, -56
	.cfi_offset w24, -64
	.cfi_offset w25, -72
	.cfi_offset w26, -80
	mov	x22, x2
	mov	x20, x1
	mov	x19, x0
Lloh0:
	adrp	x8, _DRIVER_HAVE_IRQ@GOTPAGE
Lloh1:
	ldr	x8, [x8, _DRIVER_HAVE_IRQ@GOTPAGEOFF]
Lloh2:
	ldr	w1, [x8]
	bl	_drm_core_check_feature
	cbz	x0, LBB0_3
; %bb.1:
	mov	x0, x19
	bl	_drm_dev_to_irq
	cbz	w0, LBB0_12
; %bb.2:
	ldr	w8, [x19, #16]
	cbz	w8, LBB0_12
LBB0_3:
	ldr	w1, [x20]
Lloh3:
	adrp	x8, __DRM_VBLANK_SIGNAL@GOTPAGE
Lloh4:
	ldr	x8, [x8, __DRM_VBLANK_SIGNAL@GOTPAGEOFF]
Lloh5:
	ldr	w8, [x8]
	tst	w8, w1
	b.ne	LBB0_12
; %bb.4:
Lloh6:
	adrp	x25, __DRM_VBLANK_TYPES_MASK@GOTPAGE
Lloh7:
	ldr	x25, [x25, __DRM_VBLANK_TYPES_MASK@GOTPAGEOFF]
	ldr	w9, [x25]
Lloh8:
	adrp	x8, __DRM_VBLANK_FLAGS_MASK@GOTPAGE
Lloh9:
	ldr	x8, [x8, __DRM_VBLANK_FLAGS_MASK@GOTPAGEOFF]
Lloh10:
	ldr	w8, [x8]
	orr	w10, w8, w9
Lloh11:
	adrp	x9, __DRM_VBLANK_HIGH_CRTC_MASK@GOTPAGE
Lloh12:
	ldr	x9, [x9, __DRM_VBLANK_HIGH_CRTC_MASK@GOTPAGEOFF]
Lloh13:
	ldr	w9, [x9]
	orr	w2, w10, w9
	bics	wzr, w1, w2
	b.eq	LBB0_6
; %bb.5:
Lloh14:
	adrp	x0, l_.str@PAGE
Lloh15:
	add	x0, x0, l_.str@PAGEOFF
	bl	_DRM_ERROR
	b	LBB0_12
LBB0_6:
	and	w24, w8, w1
	ands	w8, w9, w1
	b.eq	LBB0_8
; %bb.7:
Lloh16:
	adrp	x9, __DRM_VBLANK_HIGH_CRTC_SHIFT@GOTPAGE
Lloh17:
	ldr	x9, [x9, __DRM_VBLANK_HIGH_CRTC_SHIFT@GOTPAGEOFF]
Lloh18:
	ldr	w9, [x9]
	lsr	w21, w8, w9
	b	LBB0_9
LBB0_8:
Lloh19:
	adrp	x8, __DRM_VBLANK_SECONDARY@GOTPAGE
Lloh20:
	ldr	x8, [x8, __DRM_VBLANK_SECONDARY@GOTPAGEOFF]
Lloh21:
	ldr	w8, [x8]
	tst	w8, w24
	cset	w21, ne
LBB0_9:
	ldr	w8, [x19]
	cmp	w21, w8
	b.hs	LBB0_12
; %bb.10:
	mov	x0, x19
	mov	x1, x21
	bl	_drm_vblank_get
	cbz	w0, LBB0_14
; %bb.11:
	mov	x23, x0
	str	x23, [sp]
Lloh22:
	adrp	x0, l_.str.1@PAGE
Lloh23:
	add	x0, x0, l_.str.1@PAGEOFF
	bl	_DRM_DEBUG
	b	LBB0_13
LBB0_12:
Lloh24:
	adrp	x8, _EINVAL@GOTPAGE
Lloh25:
	ldr	x8, [x8, _EINVAL@GOTPAGEOFF]
Lloh26:
	ldr	w8, [x8]
	neg	w23, w8
LBB0_13:
	mov	x0, x23
	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
	ldp	x24, x23, [sp, #48]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp, #32]             ; 16-byte Folded Reload
	add	sp, sp, #112
	ret
LBB0_14:
	mov	x0, x19
	mov	x1, x21
	bl	_drm_vblank_count
	ldr	w8, [x20]
	ldr	w9, [x25]
	and	w9, w9, w8
	cmp	w9, #129
	b.eq	LBB0_17
; %bb.15:
	cmp	w9, #128
	b.ne	LBB0_19
; %bb.16:
	ldr	w9, [x20, #4]
	add	w9, w9, w0
	and	w8, w8, #0xffffff7f
	stp	w8, w9, [x20]
LBB0_17:
Lloh27:
	adrp	x8, __DRM_VBLANK_EVENT@GOTPAGE
Lloh28:
	ldr	x8, [x8, __DRM_VBLANK_EVENT@GOTPAGEOFF]
Lloh29:
	ldr	w8, [x8]
	tst	w8, w24
	b.eq	LBB0_20
; %bb.18:
	mov	x0, x19
	mov	x1, x21
	mov	x2, x20
	mov	x3, x22
	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
	ldp	x24, x23, [sp, #48]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp, #32]             ; 16-byte Folded Reload
	add	sp, sp, #112
	b	_drm_queue_vblank_event
LBB0_19:
Lloh30:
	adrp	x8, _EINVAL@GOTPAGE
Lloh31:
	ldr	x8, [x8, _EINVAL@GOTPAGEOFF]
Lloh32:
	ldr	w8, [x8]
	neg	w23, w8
	b	LBB0_30
LBB0_20:
	mov	w25, #1
	movk	w25, #128, lsl #16
Lloh33:
	adrp	x8, __DRM_VBLANK_NEXTONMISS@GOTPAGE
Lloh34:
	ldr	x8, [x8, __DRM_VBLANK_NEXTONMISS@GOTPAGEOFF]
Lloh35:
	ldr	w9, [x8]
	ldr	w8, [x20, #4]
	and	w9, w9, w24
	cbz	w9, LBB0_23
; %bb.21:
	sub	w9, w0, w8
	cmp	w9, w25
	b.hs	LBB0_23
; %bb.22:
	add	w8, w0, #1
	str	w8, [x20, #4]
LBB0_23:
	stp	x8, x21, [sp]
Lloh36:
	adrp	x0, l_.str.2@PAGE
Lloh37:
	add	x0, x0, l_.str.2@PAGEOFF
	bl	_DRM_DEBUG
	ldr	w8, [x20, #4]
	ldr	x9, [x19, #8]
	mov	w10, w21
	lsl	x10, x10, #2
	str	w8, [x9, x10]
	ldr	x8, [x19, #24]
	ldr	w22, [x8, x10]
Lloh38:
	adrp	x8, _DRM_HZ@GOTPAGE
Lloh39:
	ldr	x8, [x8, _DRM_HZ@GOTPAGEOFF]
Lloh40:
	ldr	w8, [x8]
	add	w23, w8, w8, lsl #1
	mov	x0, x19
	mov	x1, x21
	bl	_drm_vblank_count
	ldr	w8, [x20, #4]
	sub	w8, w0, w8
	cmp	w8, w25
	b.hs	LBB0_25
; %bb.24:
	mov	w3, #1
	b	LBB0_26
LBB0_25:
	ldr	w8, [x19, #16]
	cmp	w8, #0
	cset	w3, eq
LBB0_26:
	mov	w0, #0
	mov	x1, x22
	mov	x2, x23
	bl	_DRM_WAIT_ON
Lloh41:
	adrp	x8, _EINTR@GOTPAGE
Lloh42:
	ldr	x8, [x8, _EINTR@GOTPAGEOFF]
Lloh43:
	ldr	w8, [x8]
	cbz	w8, LBB0_28
; %bb.27:
	add	x2, sp, #24
	mov	x0, x19
	mov	x1, x21
	bl	_drm_vblank_count_and_time
                                        ; kill: def $w0 killed $w0 def $x0
	str	w0, [x20]
	ldr	d0, [sp, #24]
	stur	d0, [x20, #4]
	str	x0, [sp]
Lloh44:
	adrp	x0, l_.str.3@PAGE
Lloh45:
	add	x0, x0, l_.str.3@PAGEOFF
	b	LBB0_29
LBB0_28:
Lloh46:
	adrp	x0, l_.str.4@PAGE
Lloh47:
	add	x0, x0, l_.str.4@PAGEOFF
LBB0_29:
	bl	_DRM_DEBUG
	mov	w23, #0
LBB0_30:
	mov	x0, x19
	mov	x1, x21
	bl	_drm_vblank_put
	b	LBB0_13
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh11, Lloh12, Lloh13
	.loh AdrpLdrGotLdr	Lloh8, Lloh9, Lloh10
	.loh AdrpLdrGot	Lloh6, Lloh7
	.loh AdrpAdd	Lloh14, Lloh15
	.loh AdrpLdrGotLdr	Lloh16, Lloh17, Lloh18
	.loh AdrpLdrGotLdr	Lloh19, Lloh20, Lloh21
	.loh AdrpAdd	Lloh22, Lloh23
	.loh AdrpLdrGotLdr	Lloh24, Lloh25, Lloh26
	.loh AdrpLdrGotLdr	Lloh27, Lloh28, Lloh29
	.loh AdrpLdrGotLdr	Lloh30, Lloh31, Lloh32
	.loh AdrpLdrGotLdr	Lloh33, Lloh34, Lloh35
	.loh AdrpLdrGotLdr	Lloh38, Lloh39, Lloh40
	.loh AdrpAdd	Lloh36, Lloh37
	.loh AdrpLdrGotLdr	Lloh41, Lloh42, Lloh43
	.loh AdrpAdd	Lloh44, Lloh45
	.loh AdrpAdd	Lloh46, Lloh47
	.cfi_endproc
                                        ; -- End function
	.comm	_DRIVER_HAVE_IRQ,4,2            ; @DRIVER_HAVE_IRQ
	.comm	_EINVAL,4,2                     ; @EINVAL
	.comm	__DRM_VBLANK_SIGNAL,4,2         ; @_DRM_VBLANK_SIGNAL
	.comm	__DRM_VBLANK_TYPES_MASK,4,2     ; @_DRM_VBLANK_TYPES_MASK
	.comm	__DRM_VBLANK_FLAGS_MASK,4,2     ; @_DRM_VBLANK_FLAGS_MASK
	.comm	__DRM_VBLANK_HIGH_CRTC_MASK,4,2 ; @_DRM_VBLANK_HIGH_CRTC_MASK
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"Unsupported type value 0x%x, supported mask 0x%x\n"

	.comm	__DRM_VBLANK_HIGH_CRTC_SHIFT,4,2 ; @_DRM_VBLANK_HIGH_CRTC_SHIFT
	.comm	__DRM_VBLANK_SECONDARY,4,2      ; @_DRM_VBLANK_SECONDARY
l_.str.1:                               ; @.str.1
	.asciz	"failed to acquire vblank counter, %d\n"

	.comm	__DRM_VBLANK_EVENT,4,2          ; @_DRM_VBLANK_EVENT
	.comm	__DRM_VBLANK_NEXTONMISS,4,2     ; @_DRM_VBLANK_NEXTONMISS
l_.str.2:                               ; @.str.2
	.asciz	"waiting on vblank count %d, crtc %d\n"

	.comm	_DRM_HZ,4,2                     ; @DRM_HZ
	.comm	_EINTR,4,2                      ; @EINTR
l_.str.3:                               ; @.str.3
	.asciz	"returning %d to client\n"

l_.str.4:                               ; @.str.4
	.asciz	"vblank wait interrupted by signal\n"

.subsections_via_symbols
