	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_via_wait_irq                   ## -- Begin function via_wait_irq
	.p2align	4, 0x90
_via_wait_irq:                          ## @via_wait_irq
	.cfi_startproc
## %bb.0:
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset %rbp, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register %rbp
	pushq	%r14
	pushq	%rbx
	subq	$16, %rsp
	.cfi_offset %rbx, -32
	.cfi_offset %r14, -24
	movq	%rsi, %rbx
	movq	(%rdi), %rax
	movq	8(%rsi), %rsi
	cmpq	(%rax), %rsi
	jge	LBB0_1
## %bb.3:
	movq	%rdi, %r14
	movl	16(%rbx), %edx
	movq	_VIA_IRQ_FLAGS_MASK@GOTPCREL(%rip), %rcx
	movl	(%rcx), %ecx
	notl	%ecx
	andl	%edx, %ecx
	cmpl	$129, %ecx
	je	LBB0_6
## %bb.4:
	cmpl	$128, %ecx
	jne	LBB0_9
## %bb.5:
	shlq	$2, %rsi
	addq	8(%rax), %rsi
	movq	%rsi, %rdi
	callq	_atomic_read
	addl	%eax, 20(%rbx)
	movq	__DRM_VBLANK_RELATIVE@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	notl	%edx
	andl	16(%rbx), %edx
	movl	%edx, 16(%rbx)
LBB0_6:
	movq	_VIA_IRQ_SIGNAL@GOTPCREL(%rip), %rax
	testl	%edx, (%rax)
	je	LBB0_8
## %bb.7:
	leaq	L_.str.1(%rip), %rdi
	xorl	%ebx, %ebx
	xorl	%eax, %eax
	callq	_DRM_ERROR
	movq	_EINVAL@GOTPCREL(%rip), %rax
	jmp	LBB0_10
LBB0_1:
	leaq	L_.str(%rip), %rdi
	xorl	%ebx, %ebx
	xorl	%eax, %eax
	callq	_DRM_ERROR
	movq	_EINVAL@GOTPCREL(%rip), %rax
	jmp	LBB0_10
LBB0_9:
	movq	_EINVAL@GOTPCREL(%rip), %rax
	xorl	%ebx, %ebx
LBB0_10:
	subl	(%rax), %ebx
	movl	%ebx, %eax
LBB0_11:
	addq	$16, %rsp
	popq	%rbx
	popq	%r14
	popq	%rbp
	retq
LBB0_8:
	movq	_VIA_IRQ_FORCE_SEQUENCE@GOTPCREL(%rip), %rax
	andl	(%rax), %edx
	movq	8(%rbx), %rsi
	leaq	20(%rbx), %rcx
	movq	%r14, %rdi
	callq	_via_driver_irq_wait
	movl	%eax, %r14d
	leaq	-24(%rbp), %rdi
	callq	_do_gettimeofday
	movl	-20(%rbp), %eax
	movl	%eax, 4(%rbx)
	movl	-24(%rbp), %eax
	movl	%eax, (%rbx)
	movl	%r14d, %eax
	jmp	LBB0_11
	.cfi_endproc
                                        ## -- End function
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"Trying to wait on unknown irq %d\n"

	.comm	_EINVAL,4,2                     ## @EINVAL
	.comm	_VIA_IRQ_FLAGS_MASK,4,2         ## @VIA_IRQ_FLAGS_MASK
	.comm	__DRM_VBLANK_RELATIVE,4,2       ## @_DRM_VBLANK_RELATIVE
	.comm	_VIA_IRQ_SIGNAL,4,2             ## @VIA_IRQ_SIGNAL
L_.str.1:                               ## @.str.1
	.asciz	"Signals on Via IRQs not implemented yet.\n"

	.comm	_VIA_IRQ_FORCE_SEQUENCE,4,2     ## @VIA_IRQ_FORCE_SEQUENCE
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_via_wait_irq                   ; -- Begin function via_wait_irq
	.p2align	2
_via_wait_irq:                          ; @via_wait_irq
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #48
	.cfi_def_cfa_offset 48
	stp	x20, x19, [sp, #16]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #32]             ; 16-byte Folded Spill
	add	x29, sp, #32
	.cfi_def_cfa w29, 16
	.cfi_offset w30, -8
	.cfi_offset w29, -16
	.cfi_offset w19, -24
	.cfi_offset w20, -32
	ldr	x10, [x0]
	ldr	x9, [x1, #8]
	ldr	x8, [x10]
	cmp	x9, x8
	b.ge	LBB0_6
; %bb.1:
	mov	x19, x1
	mov	x20, x0
	ldr	w8, [x1, #16]
Lloh0:
	adrp	x11, _VIA_IRQ_FLAGS_MASK@GOTPAGE
Lloh1:
	ldr	x11, [x11, _VIA_IRQ_FLAGS_MASK@GOTPAGEOFF]
Lloh2:
	ldr	w11, [x11]
	bic	w11, w8, w11
	cmp	w11, #129
	b.eq	LBB0_4
; %bb.2:
	cmp	w11, #128
	b.ne	LBB0_8
; %bb.3:
	ldr	x8, [x10, #8]
	add	x0, x8, x9, lsl #2
	bl	_atomic_read
	ldp	w9, w8, [x19, #16]
	add	w10, w8, w0
Lloh3:
	adrp	x8, __DRM_VBLANK_RELATIVE@GOTPAGE
Lloh4:
	ldr	x8, [x8, __DRM_VBLANK_RELATIVE@GOTPAGEOFF]
Lloh5:
	ldr	w8, [x8]
	bic	w8, w9, w8
	stp	w8, w10, [x19, #16]
LBB0_4:
Lloh6:
	adrp	x9, _VIA_IRQ_SIGNAL@GOTPAGE
Lloh7:
	ldr	x9, [x9, _VIA_IRQ_SIGNAL@GOTPAGEOFF]
Lloh8:
	ldr	w9, [x9]
	tst	w9, w8
	b.eq	LBB0_10
; %bb.5:
Lloh9:
	adrp	x0, l_.str.1@PAGE
Lloh10:
	add	x0, x0, l_.str.1@PAGEOFF
	b	LBB0_7
LBB0_6:
	str	x9, [sp]
Lloh11:
	adrp	x0, l_.str@PAGE
Lloh12:
	add	x0, x0, l_.str@PAGEOFF
LBB0_7:
	bl	_DRM_ERROR
LBB0_8:
Lloh13:
	adrp	x8, _EINVAL@GOTPAGE
Lloh14:
	ldr	x8, [x8, _EINVAL@GOTPAGEOFF]
Lloh15:
	ldr	w8, [x8]
	neg	w0, w8
LBB0_9:
	ldp	x29, x30, [sp, #32]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #16]             ; 16-byte Folded Reload
	add	sp, sp, #48
	ret
LBB0_10:
Lloh16:
	adrp	x9, _VIA_IRQ_FORCE_SEQUENCE@GOTPAGE
Lloh17:
	ldr	x9, [x9, _VIA_IRQ_FORCE_SEQUENCE@GOTPAGEOFF]
Lloh18:
	ldr	w9, [x9]
	and	w2, w9, w8
	ldr	x1, [x19, #8]
	add	x3, x19, #20
	mov	x0, x20
	bl	_via_driver_irq_wait
	mov	x20, x0
	add	x0, sp, #8
	bl	_do_gettimeofday
	ldr	d0, [sp, #8]
	str	d0, [x19]
	mov	x0, x20
	b	LBB0_9
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh6, Lloh7, Lloh8
	.loh AdrpAdd	Lloh9, Lloh10
	.loh AdrpAdd	Lloh11, Lloh12
	.loh AdrpLdrGotLdr	Lloh13, Lloh14, Lloh15
	.loh AdrpLdrGotLdr	Lloh16, Lloh17, Lloh18
	.cfi_endproc
                                        ; -- End function
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"Trying to wait on unknown irq %d\n"

	.comm	_EINVAL,4,2                     ; @EINVAL
	.comm	_VIA_IRQ_FLAGS_MASK,4,2         ; @VIA_IRQ_FLAGS_MASK
	.comm	__DRM_VBLANK_RELATIVE,4,2       ; @_DRM_VBLANK_RELATIVE
	.comm	_VIA_IRQ_SIGNAL,4,2             ; @VIA_IRQ_SIGNAL
l_.str.1:                               ; @.str.1
	.asciz	"Signals on Via IRQs not implemented yet.\n"

	.comm	_VIA_IRQ_FORCE_SEQUENCE,4,2     ; @VIA_IRQ_FORCE_SEQUENCE
.subsections_via_symbols
