	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function via_driver_irq_wait
_via_driver_irq_wait:                   ## @via_driver_irq_wait
	.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
	pushq	%rax
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rcx, %r13
	movl	%edx, %ebx
	movl	%esi, %r14d
	movq	(%rdi), %r15
	leaq	L_.str(%rip), %rdi
	callq	_DRM_DEBUG
	testq	%r15, %r15
	je	LBB0_1
## %bb.3:
	movq	_drm_via_irq_num@GOTPCREL(%rip), %rax
	cmpl	%r14d, (%rax)
	jbe	LBB0_4
## %bb.6:
	movq	(%r15), %rax
	movl	%r14d, %r12d
	movl	(%rax,%r12,4), %eax
	testl	%eax, %eax
	js	LBB0_7
## %bb.8:
	movq	16(%r15), %rcx
	leaq	(%rcx,%rax,8), %r14
	movl	4(%rcx,%rax,8), %ecx
	movl	%ecx, -48(%rbp)                 ## 4-byte Spill
	movq	_DRM_HZ@GOTPCREL(%rip), %rcx
	movl	(%rcx), %ecx
	leal	(%rcx,%rcx,2), %ecx
	movl	%ecx, -44(%rbp)                 ## 4-byte Spill
	testl	%ebx, %ebx
	jne	LBB0_11
## %bb.9:
	movq	8(%r15), %rbx
	movq	(%rbx,%rax,8), %rax
	cmpl	$0, 8(%rax)
	je	LBB0_11
## %bb.10:
	movq	(%rbx,%r12,8), %rax
	movl	8(%rax), %edi
	callq	_VIA_READ
	movq	(%rbx,%r12,8), %rdx
	andl	12(%rdx), %eax
	xorl	%ecx, %ecx
	cmpl	16(%rdx), %eax
	sete	%cl
	xorl	%edi, %edi
	movl	-48(%rbp), %esi                 ## 4-byte Reload
	movl	-44(%rbp), %edx                 ## 4-byte Reload
	callq	_DRM_WAIT_ON
	movq	%r14, %rdi
	callq	_atomic_read
	movl	%eax, %ebx
	jmp	LBB0_12
LBB0_1:
	leaq	L_.str.1(%rip), %rdi
	xorl	%ebx, %ebx
	xorl	%eax, %eax
	callq	_DRM_ERROR
	jmp	LBB0_2
LBB0_4:
	leaq	L_.str.2(%rip), %rdi
	jmp	LBB0_5
LBB0_7:
	leaq	L_.str.3(%rip), %rdi
LBB0_5:
	xorl	%ebx, %ebx
	movl	%r14d, %esi
	xorl	%eax, %eax
	callq	_DRM_ERROR
LBB0_2:
	movq	_EINVAL@GOTPCREL(%rip), %rax
	subl	(%rax), %ebx
LBB0_13:
	movl	%ebx, %eax
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_11:
	movq	%r14, %rdi
	callq	_atomic_read
	movl	%eax, %ebx
	subl	(%r13), %eax
	xorl	%ecx, %ecx
	cmpl	$8388609, %eax                  ## imm = 0x800001
	setb	%cl
	xorl	%edi, %edi
	movl	-48(%rbp), %esi                 ## 4-byte Reload
	movl	-44(%rbp), %edx                 ## 4-byte Reload
	callq	_DRM_WAIT_ON
LBB0_12:
	movl	%ebx, (%r13)
	xorl	%ebx, %ebx
	jmp	LBB0_13
	.cfi_endproc
                                        ## -- End function
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"\n"

L_.str.1:                               ## @.str.1
	.asciz	"called with no initialization\n"

	.comm	_EINVAL,4,2                     ## @EINVAL
	.comm	_drm_via_irq_num,4,2            ## @drm_via_irq_num
L_.str.2:                               ## @.str.2
	.asciz	"Trying to wait on unknown irq %d\n"

L_.str.3:                               ## @.str.3
	.asciz	"Video IRQ %d not available on this hardware.\n"

	.comm	_DRM_HZ,4,2                     ## @DRM_HZ
	.no_dead_strip	_via_driver_irq_wait
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function via_driver_irq_wait
_via_driver_irq_wait:                   ; @via_driver_irq_wait
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #96
	.cfi_def_cfa_offset 96
	stp	x26, x25, [sp, #16]             ; 16-byte Folded Spill
	stp	x24, x23, [sp, #32]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #48]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #64]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #80]             ; 16-byte Folded Spill
	add	x29, sp, #80
	.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	x19, x3
	mov	x24, x2
	mov	x20, x1
	ldr	x25, [x0]
Lloh0:
	adrp	x0, l_.str@PAGE
Lloh1:
	add	x0, x0, l_.str@PAGEOFF
	bl	_DRM_DEBUG
	cbz	x25, LBB0_6
; %bb.1:
Lloh2:
	adrp	x8, _drm_via_irq_num@GOTPAGE
Lloh3:
	ldr	x8, [x8, _drm_via_irq_num@GOTPAGEOFF]
Lloh4:
	ldr	w8, [x8]
	cmp	w8, w20
	b.ls	LBB0_7
; %bb.2:
	ldr	x8, [x25]
	ldr	w8, [x8, w20, uxtw #2]
	tbnz	w8, #31, LBB0_8
; %bb.3:
	ldr	x9, [x25, #16]
	lsl	x8, x8, #3
	add	x23, x9, x8
	ldr	w21, [x23, #4]
Lloh5:
	adrp	x9, _DRM_HZ@GOTPAGE
Lloh6:
	ldr	x9, [x9, _DRM_HZ@GOTPAGEOFF]
Lloh7:
	ldr	w9, [x9]
	add	w22, w9, w9, lsl #1
	cbnz	w24, LBB0_11
; %bb.4:
	ldr	x24, [x25, #8]
	ldr	x8, [x24, x8]
	ldr	w8, [x8, #8]
	cbz	w8, LBB0_11
; %bb.5:
	mov	w8, w20
	lsl	x20, x8, #3
	ldr	x8, [x24, x20]
	ldr	w0, [x8, #8]
	bl	_VIA_READ
	ldr	x8, [x24, x20]
	ldp	w9, w8, [x8, #12]
	and	w9, w9, w0
	cmp	w9, w8
	cset	w3, eq
	mov	w0, #0
	mov	x1, x21
	mov	x2, x22
	bl	_DRM_WAIT_ON
	mov	x0, x23
	bl	_atomic_read
	mov	x20, x0
	b	LBB0_12
LBB0_6:
Lloh8:
	adrp	x0, l_.str.1@PAGE
Lloh9:
	add	x0, x0, l_.str.1@PAGEOFF
	b	LBB0_9
LBB0_7:
	str	x20, [sp]
Lloh10:
	adrp	x0, l_.str.2@PAGE
Lloh11:
	add	x0, x0, l_.str.2@PAGEOFF
	b	LBB0_9
LBB0_8:
                                        ; kill: def $w20 killed $w20 killed $x20 def $x20
	str	x20, [sp]
Lloh12:
	adrp	x0, l_.str.3@PAGE
Lloh13:
	add	x0, x0, l_.str.3@PAGEOFF
LBB0_9:
	bl	_DRM_ERROR
Lloh14:
	adrp	x8, _EINVAL@GOTPAGE
Lloh15:
	ldr	x8, [x8, _EINVAL@GOTPAGEOFF]
Lloh16:
	ldr	w8, [x8]
	neg	w0, w8
LBB0_10:
	ldp	x29, x30, [sp, #80]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #64]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #48]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #32]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp, #16]             ; 16-byte Folded Reload
	add	sp, sp, #96
	ret
LBB0_11:
	mov	x0, x23
	bl	_atomic_read
	mov	x20, x0
	ldr	w8, [x19]
	sub	w8, w0, w8
	cmp	w8, #2048, lsl #12              ; =8388608
	cset	w3, ls
	mov	w0, #0
	mov	x1, x21
	mov	x2, x22
	bl	_DRM_WAIT_ON
LBB0_12:
	mov	w0, #0
	str	w20, [x19]
	b	LBB0_10
	.loh AdrpAdd	Lloh0, Lloh1
	.loh AdrpLdrGotLdr	Lloh2, Lloh3, Lloh4
	.loh AdrpLdrGotLdr	Lloh5, Lloh6, Lloh7
	.loh AdrpAdd	Lloh8, Lloh9
	.loh AdrpAdd	Lloh10, Lloh11
	.loh AdrpAdd	Lloh12, Lloh13
	.loh AdrpLdrGotLdr	Lloh14, Lloh15, Lloh16
	.cfi_endproc
                                        ; -- End function
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"\n"

l_.str.1:                               ; @.str.1
	.asciz	"called with no initialization\n"

	.comm	_EINVAL,4,2                     ; @EINVAL
	.comm	_drm_via_irq_num,4,2            ; @drm_via_irq_num
l_.str.2:                               ; @.str.2
	.asciz	"Trying to wait on unknown irq %d\n"

l_.str.3:                               ; @.str.3
	.asciz	"Video IRQ %d not available on this hardware.\n"

	.comm	_DRM_HZ,4,2                     ; @DRM_HZ
	.no_dead_strip	_via_driver_irq_wait
.subsections_via_symbols
