	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_kvm_lapic_sync_to_vapic        ## -- Begin function kvm_lapic_sync_to_vapic
	.p2align	4, 0x90
_kvm_lapic_sync_to_vapic:               ## @kvm_lapic_sync_to_vapic
	.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	%rdi, %r15
	movq	(%rdi), %r14
	movq	%r14, %rsi
	callq	_apic_sync_pv_eoi_to_guest
	movq	_KVM_APIC_CHECK_VAPIC@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	leaq	8(%r15), %rsi
	callq	_test_bit
	testl	%eax, %eax
	je	LBB0_2
## %bb.1:
	movq	_APIC_TASKPRI@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%r14, %rdi
	callq	_apic_get_reg
	movzbl	%al, %r12d
	movq	%r14, %rdi
	callq	_apic_find_highest_irr
	movl	%eax, %r13d
	xorl	%ebx, %ebx
	testl	%eax, %eax
	cmovlel	%ebx, %r13d
	movq	%r14, %rdi
	callq	_apic_find_highest_isr
	testl	%eax, %eax
	cmovgl	%eax, %ebx
	shll	$8, %ebx
	andl	$61440, %ebx                    ## imm = 0xF000
	orl	%r12d, %ebx
	shll	$24, %r13d
	orl	%ebx, %r13d
	movl	%r13d, -44(%rbp)
	movl	16(%r15), %edi
	movq	(%r15), %rsi
	leaq	-44(%rbp), %rdx
	movl	$4, %ecx
	callq	_kvm_write_guest_cached
LBB0_2:
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_KVM_APIC_CHECK_VAPIC,4,2       ## @KVM_APIC_CHECK_VAPIC
	.comm	_APIC_TASKPRI,4,2               ## @APIC_TASKPRI
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_kvm_lapic_sync_to_vapic        ; -- Begin function kvm_lapic_sync_to_vapic
	.p2align	2
_kvm_lapic_sync_to_vapic:               ; @kvm_lapic_sync_to_vapic
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #64
	.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
	mov	x19, x0
	mov	x21, x0
	ldr	x20, [x21], #8
	mov	x1, x20
	bl	_apic_sync_pv_eoi_to_guest
Lloh0:
	adrp	x8, _KVM_APIC_CHECK_VAPIC@GOTPAGE
Lloh1:
	ldr	x8, [x8, _KVM_APIC_CHECK_VAPIC@GOTPAGEOFF]
Lloh2:
	ldr	w0, [x8]
	mov	x1, x21
	bl	_test_bit
	cbz	w0, LBB0_2
; %bb.1:
Lloh3:
	adrp	x8, _APIC_TASKPRI@GOTPAGE
Lloh4:
	ldr	x8, [x8, _APIC_TASKPRI@GOTPAGEOFF]
Lloh5:
	ldr	w1, [x8]
	mov	x0, x20
	bl	_apic_get_reg
	mov	x21, x0
	mov	x0, x20
	bl	_apic_find_highest_irr
	cmp	w0, #0
	csel	w22, w0, wzr, gt
	mov	x0, x20
	bl	_apic_find_highest_isr
	cmp	w0, #0
	csel	w8, w0, wzr, gt
	lsl	w8, w8, #8
	and	w8, w8, #0xf000
	bfxil	w8, w21, #0, #8
	bfi	w8, w22, #24, #8
	str	w8, [sp, #12]
	ldr	w0, [x19, #16]
	ldr	x1, [x19]
	add	x2, sp, #12
	mov	w3, #4
	bl	_kvm_write_guest_cached
LBB0_2:
	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
	add	sp, sp, #64
	ret
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.cfi_endproc
                                        ; -- End function
	.comm	_KVM_APIC_CHECK_VAPIC,4,2       ; @KVM_APIC_CHECK_VAPIC
	.comm	_APIC_TASKPRI,4,2               ; @APIC_TASKPRI
.subsections_via_symbols
