	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function vioapic_write
_vioapic_write:                         ## @vioapic_write
	.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
	movl	%esi, %r15d
	movq	%rdi, %rbx
	movzbl	%dl, %eax
	cmpl	$129, %eax
	jne	LBB0_2
## %bb.1:
	movq	_APIC_ID_MASK@GOTPCREL(%rip), %rdx
	movl	(%rdx), %edx
	andl	%ecx, %edx
	movl	%edx, (%rbx)
LBB0_2:
	movq	_IOAPIC_REDTBL@GOTPCREL(%rip), %rdx
	movl	(%rdx), %esi
	movl	%eax, %edx
	subl	%esi, %edx
	jl	LBB0_9
## %bb.3:
	movq	_REDIR_ENTRIES@GOTPCREL(%rip), %rdi
	movl	(%rdi), %edi
	leal	(%rsi,%rdi,2), %esi
	cmpl	%esi, %eax
	jge	LBB0_9
## %bb.4:
	movl	%edx, %r14d
	shrl	$31, %r14d
	addl	%edx, %r14d
	sarl	%r14d
	movq	8(%rbx), %rdx
	movslq	%r14d, %r12
	movl	(%rdx,%r12,8), %r13d
	movq	_RTBL_RO_BITS@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	andl	%r13d, %esi
	movl	%esi, (%rdx,%r12,8)
	movl	(%rax), %eax
	notl	%eax
	andl	%ecx, %eax
	orl	%esi, %eax
	movl	%eax, (%rdx,%r12,8)
	leaq	L_.str(%rip), %rsi
	movq	%rbx, %rdi
	movl	%r12d, %edx
	movl	%eax, %ecx
	callq	_VIOAPIC_CTR2
	movq	8(%rbx), %rax
	movl	(%rax,%r12,8), %ecx
	xorl	%ecx, %r13d
	movq	_IOART_INTMASK@GOTPCREL(%rip), %rdi
	movl	(%rdi), %edx
	movq	_IOART_INTPOL@GOTPCREL(%rip), %rsi
	movl	(%rsi), %esi
	orl	%edx, %esi
	notl	%esi
	testl	%esi, %r13d
	je	LBB0_6
## %bb.5:
	leaq	L_.str.1(%rip), %rsi
	movq	%rdi, %r13
	movq	%rbx, %rdi
	movl	%r12d, %edx
	callq	_VIOAPIC_CTR1
	movq	%rbx, %rdi
	callq	_VIOAPIC_UNLOCK
	movl	16(%rbx), %edi
	callq	_vm_active_cpus
	movl	16(%rbx), %edi
	movq	_vioapic_update_tmr@GOTPCREL(%rip), %rcx
	movl	(%rcx), %ecx
	movl	%r15d, %esi
	movl	%eax, %edx
	xorl	%r8d, %r8d
	callq	_vm_smp_rendezvous
	movq	%rbx, %rdi
	callq	_VIOAPIC_LOCK
	movq	8(%rbx), %rax
	movl	(%rax,%r12,8), %ecx
	movl	(%r13), %edx
LBB0_6:
	andl	%ecx, %edx
	movq	_IOART_INTMCLR@GOTPCREL(%rip), %rsi
	cmpl	(%rsi), %edx
	jne	LBB0_9
## %bb.7:
	movq	_IOART_REM_IRR@GOTPCREL(%rip), %rdx
	testl	%ecx, (%rdx)
	je	LBB0_8
LBB0_9:
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_8:
	movl	4(%rax,%r12,8), %ecx
	testl	%ecx, %ecx
	jle	LBB0_9
## %bb.10:
	leaq	L_.str.2(%rip), %rsi
	movq	%rbx, %rdi
	movl	%r14d, %edx
	callq	_VIOAPIC_CTR2
	movq	%rbx, %rdi
	movl	%r14d, %esi
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	jmp	_vioapic_send_intr              ## TAILCALL
	.cfi_endproc
                                        ## -- End function
	.comm	_APIC_ID_MASK,4,2               ## @APIC_ID_MASK
	.comm	_IOAPIC_REDTBL,4,2              ## @IOAPIC_REDTBL
	.comm	_REDIR_ENTRIES,4,2              ## @REDIR_ENTRIES
	.comm	_RTBL_RO_BITS,4,2               ## @RTBL_RO_BITS
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"ioapic pin%d: redir table entry %#lx"

	.comm	_IOART_INTMASK,4,2              ## @IOART_INTMASK
	.comm	_IOART_INTPOL,4,2               ## @IOART_INTPOL
L_.str.1:                               ## @.str.1
	.asciz	"ioapic pin%d: recalculate vlapic trigger-mode register"

	.comm	_vioapic_update_tmr,4,2         ## @vioapic_update_tmr
	.comm	_IOART_INTMCLR,4,2              ## @IOART_INTMCLR
	.comm	_IOART_REM_IRR,4,2              ## @IOART_REM_IRR
L_.str.2:                               ## @.str.2
	.asciz	"ioapic pin%d: asserted at rtbl write, acnt %d"

	.no_dead_strip	_vioapic_write
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function vioapic_write
_vioapic_write:                         ; @vioapic_write
	.cfi_startproc
; %bb.0:
	stp	x24, x23, [sp, #-64]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 64
	stp	x22, x21, [sp, #16]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #32]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #48]             ; 16-byte Folded Spill
	add	x29, sp, #48
	.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	x21, x1
	mov	x19, x0
	and	w8, w2, #0xff
	cmp	w8, #129
	b.ne	LBB0_2
; %bb.1:
Lloh0:
	adrp	x9, _APIC_ID_MASK@GOTPAGE
Lloh1:
	ldr	x9, [x9, _APIC_ID_MASK@GOTPAGEOFF]
Lloh2:
	ldr	w9, [x9]
	and	w9, w9, w3
	str	w9, [x19]
LBB0_2:
Lloh3:
	adrp	x9, _IOAPIC_REDTBL@GOTPAGE
Lloh4:
	ldr	x9, [x9, _IOAPIC_REDTBL@GOTPAGEOFF]
Lloh5:
	ldr	w10, [x9]
	subs	w9, w8, w10
	b.lt	LBB0_8
; %bb.3:
Lloh6:
	adrp	x11, _REDIR_ENTRIES@GOTPAGE
Lloh7:
	ldr	x11, [x11, _REDIR_ENTRIES@GOTPAGEOFF]
Lloh8:
	ldr	w11, [x11]
	add	w10, w10, w11, lsl #1
	cmp	w8, w10
	b.ge	LBB0_8
; %bb.4:
	cmp	w9, #0
	cinc	w8, w9, lt
	asr	w2, w8, #1
	ldr	x9, [x19, #8]
	sbfiz	x22, x2, #3, #32
	ldr	w23, [x9, x22]
Lloh9:
	adrp	x10, _RTBL_RO_BITS@GOTPAGE
Lloh10:
	ldr	x10, [x10, _RTBL_RO_BITS@GOTPAGEOFF]
	ldr	w11, [x10]
	and	w11, w11, w23
	str	w11, [x9, x22]
	sbfx	x20, x8, #1, #31
	ldr	w8, [x10]
	bic	w8, w3, w8
	orr	w3, w8, w11
	str	w3, [x9, x22]
Lloh11:
	adrp	x1, l_.str@PAGE
Lloh12:
	add	x1, x1, l_.str@PAGEOFF
	mov	x0, x19
                                        ; kill: def $w2 killed $w2 killed $x2
	bl	_VIOAPIC_CTR2
	ldr	x8, [x19, #8]
	ldr	w9, [x8, x22]
	eor	w11, w9, w23
Lloh13:
	adrp	x22, _IOART_INTMASK@GOTPAGE
Lloh14:
	ldr	x22, [x22, _IOART_INTMASK@GOTPAGEOFF]
	ldr	w10, [x22]
Lloh15:
	adrp	x12, _IOART_INTPOL@GOTPAGE
Lloh16:
	ldr	x12, [x12, _IOART_INTPOL@GOTPAGEOFF]
Lloh17:
	ldr	w12, [x12]
	orr	w12, w12, w10
	bics	wzr, w11, w12
	b.eq	LBB0_6
; %bb.5:
Lloh18:
	adrp	x1, l_.str.1@PAGE
Lloh19:
	add	x1, x1, l_.str.1@PAGEOFF
	mov	x0, x19
	mov	x2, x20
	bl	_VIOAPIC_CTR1
	mov	x0, x19
	bl	_VIOAPIC_UNLOCK
	ldr	w0, [x19, #16]
	bl	_vm_active_cpus
	mov	x2, x0
	ldr	w0, [x19, #16]
Lloh20:
	adrp	x8, _vioapic_update_tmr@GOTPAGE
Lloh21:
	ldr	x8, [x8, _vioapic_update_tmr@GOTPAGEOFF]
Lloh22:
	ldr	w3, [x8]
	mov	x1, x21
	mov	x4, #0
	bl	_vm_smp_rendezvous
	mov	x0, x19
	bl	_VIOAPIC_LOCK
	ldr	x8, [x19, #8]
	lsl	x9, x20, #3
	ldr	w9, [x8, x9]
	ldr	w10, [x22]
LBB0_6:
	and	w10, w10, w9
Lloh23:
	adrp	x11, _IOART_INTMCLR@GOTPAGE
Lloh24:
	ldr	x11, [x11, _IOART_INTMCLR@GOTPAGEOFF]
Lloh25:
	ldr	w11, [x11]
	cmp	w10, w11
	b.ne	LBB0_8
; %bb.7:
Lloh26:
	adrp	x10, _IOART_REM_IRR@GOTPAGE
Lloh27:
	ldr	x10, [x10, _IOART_REM_IRR@GOTPAGEOFF]
Lloh28:
	ldr	w10, [x10]
	tst	w10, w9
	b.eq	LBB0_9
LBB0_8:
	ldp	x29, x30, [sp, #48]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #32]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #16]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp], #64             ; 16-byte Folded Reload
	ret
LBB0_9:
	add	x8, x8, x20, lsl #3
	ldr	w3, [x8, #4]
	cmp	w3, #1
	b.lt	LBB0_8
; %bb.10:
Lloh29:
	adrp	x1, l_.str.2@PAGE
Lloh30:
	add	x1, x1, l_.str.2@PAGEOFF
	mov	x0, x19
	mov	x2, x20
	bl	_VIOAPIC_CTR2
	mov	x0, x19
	mov	x1, x20
	ldp	x29, x30, [sp, #48]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #32]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #16]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp], #64             ; 16-byte Folded Reload
	b	_vioapic_send_intr
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh6, Lloh7, Lloh8
	.loh AdrpLdrGotLdr	Lloh15, Lloh16, Lloh17
	.loh AdrpLdrGot	Lloh13, Lloh14
	.loh AdrpAdd	Lloh11, Lloh12
	.loh AdrpLdrGot	Lloh9, Lloh10
	.loh AdrpLdrGotLdr	Lloh20, Lloh21, Lloh22
	.loh AdrpAdd	Lloh18, Lloh19
	.loh AdrpLdrGotLdr	Lloh23, Lloh24, Lloh25
	.loh AdrpLdrGotLdr	Lloh26, Lloh27, Lloh28
	.loh AdrpAdd	Lloh29, Lloh30
	.cfi_endproc
                                        ; -- End function
	.comm	_APIC_ID_MASK,4,2               ; @APIC_ID_MASK
	.comm	_IOAPIC_REDTBL,4,2              ; @IOAPIC_REDTBL
	.comm	_REDIR_ENTRIES,4,2              ; @REDIR_ENTRIES
	.comm	_RTBL_RO_BITS,4,2               ; @RTBL_RO_BITS
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"ioapic pin%d: redir table entry %#lx"

	.comm	_IOART_INTMASK,4,2              ; @IOART_INTMASK
	.comm	_IOART_INTPOL,4,2               ; @IOART_INTPOL
l_.str.1:                               ; @.str.1
	.asciz	"ioapic pin%d: recalculate vlapic trigger-mode register"

	.comm	_vioapic_update_tmr,4,2         ; @vioapic_update_tmr
	.comm	_IOART_INTMCLR,4,2              ; @IOART_INTMCLR
	.comm	_IOART_REM_IRR,4,2              ; @IOART_REM_IRR
l_.str.2:                               ; @.str.2
	.asciz	"ioapic pin%d: asserted at rtbl write, acnt %d"

	.no_dead_strip	_vioapic_write
.subsections_via_symbols
