	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function vlapic_calcdest
_vlapic_calcdest:                       ## @vlapic_calcdest
	.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
	movl	%edx, %ebx
	movq	%rsi, %r14
	movq	%rdi, %r15
	cmpl	$-1, %edx
	jne	LBB0_2
## %bb.1:
	testl	%r9d, %r9d
	jne	LBB0_4
LBB0_2:
	cmpl	$255, %ebx
	jne	LBB0_5
## %bb.3:
	testl	%r9d, %r9d
	jne	LBB0_5
LBB0_4:
	movq	%r15, %rdi
	callq	_vm_active_cpus
	movl	%eax, (%r14)
LBB0_22:
	addq	$24, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_5:
	testl	%ecx, %ecx
	je	LBB0_9
## %bb.6:
	movq	%r14, %rdi
	callq	_CPU_ZERO
	movq	%r15, %rdi
	movl	%ebx, %esi
	callq	_vm_apicid2vcpuid
	movl	%eax, %ebx
	movq	%r15, %rdi
	callq	_vm_active_cpus
	movl	%eax, -44(%rbp)
	movq	%r15, %rdi
	callq	_vm_get_maxcpus
	cmpl	%eax, %ebx
	jge	LBB0_22
## %bb.7:
	leaq	-44(%rbp), %rsi
	movl	%ebx, %edi
	callq	_CPU_ISSET
	testq	%rax, %rax
	je	LBB0_22
## %bb.8:
	movl	%ebx, %edi
	movq	%r14, %rsi
	callq	_CPU_SET
	jmp	LBB0_22
LBB0_9:
	movl	%r8d, -56(%rbp)                 ## 4-byte Spill
	movl	%ebx, %eax
	shrl	$4, %eax
	andl	$15, %eax
	movl	%ebx, %edx
	sarl	$16, %edx
	testl	%r9d, %r9d
	movl	$65535, %ecx                    ## imm = 0xFFFF
	movl	$15, %esi
	cmovnel	%ecx, %esi
	movl	%esi, -48(%rbp)                 ## 4-byte Spill
	cmovel	%eax, %edx
	movl	%edx, -52(%rbp)                 ## 4-byte Spill
	movq	%r14, %rdi
	callq	_CPU_ZERO
	movq	%r15, %rdi
	callq	_vm_active_cpus
	movl	%eax, -44(%rbp)
	leaq	-44(%rbp), %rdi
	callq	_CPU_FFS
	testl	%eax, %eax
	je	LBB0_22
## %bb.10:
	movl	%eax, %r13d
	movzbl	%bl, %eax
	movl	%eax, -60(%rbp)                 ## 4-byte Spill
	andl	%ebx, -48(%rbp)                 ## 4-byte Folded Spill
	leaq	-44(%rbp), %r12
	jmp	LBB0_11
	.p2align	4, 0x90
LBB0_20:                                ##   in Loop: Header=BB0_11 Depth=1
	movq	%rax, %rdi
	leaq	L_.str(%rip), %rsi
	callq	_VLAPIC_CTR1
LBB0_21:                                ##   in Loop: Header=BB0_11 Depth=1
	movq	%r12, %rdi
	callq	_CPU_FFS
	movl	%eax, %r13d
	testl	%eax, %eax
	je	LBB0_22
LBB0_11:                                ## =>This Inner Loop Header: Depth=1
	decl	%r13d
	movl	%r13d, %edi
	movq	%r12, %rsi
	callq	_CPU_CLR
	movq	%r15, %rdi
	movl	%r13d, %esi
	callq	_vm_lapic
	movq	(%rax), %rcx
	movl	(%rcx), %edx
	movl	4(%rcx), %ebx
	movq	_APIC_DFR_MODEL_MASK@GOTPCREL(%rip), %rcx
	movl	(%rcx), %ecx
	andl	%edx, %ecx
	movq	_APIC_DFR_MODEL_FLAT@GOTPCREL(%rip), %rsi
	cmpl	(%rsi), %ecx
	jne	LBB0_13
## %bb.12:                              ##   in Loop: Header=BB0_11 Depth=1
	sarl	$24, %ebx
	movl	-60(%rbp), %ecx                 ## 4-byte Reload
LBB0_18:                                ##   in Loop: Header=BB0_11 Depth=1
	testl	%ebx, %ecx
	je	LBB0_21
## %bb.19:                              ##   in Loop: Header=BB0_11 Depth=1
	movl	%r13d, %edi
	movq	%r14, %rsi
	callq	_CPU_SET
	cmpl	$0, -56(%rbp)                   ## 4-byte Folded Reload
	je	LBB0_21
	jmp	LBB0_22
	.p2align	4, 0x90
LBB0_13:                                ##   in Loop: Header=BB0_11 Depth=1
	movq	_APIC_DFR_MODEL_CLUSTER@GOTPCREL(%rip), %rsi
	cmpl	(%rsi), %ecx
	jne	LBB0_20
## %bb.14:                              ##   in Loop: Header=BB0_11 Depth=1
	movq	%rax, %rdi
	callq	_x2apic
	testq	%rax, %rax
	je	LBB0_16
## %bb.15:                              ##   in Loop: Header=BB0_11 Depth=1
	movl	%ebx, %eax
	sarl	$16, %eax
	movzwl	%bx, %ebx
	jmp	LBB0_17
LBB0_16:                                ##   in Loop: Header=BB0_11 Depth=1
	movl	%ebx, %eax
	sarl	$28, %eax
	shrl	$24, %ebx
	andl	$15, %ebx
LBB0_17:                                ##   in Loop: Header=BB0_11 Depth=1
	movl	-48(%rbp), %ecx                 ## 4-byte Reload
	cmpl	-52(%rbp), %eax                 ## 4-byte Folded Reload
	jne	LBB0_21
	jmp	LBB0_18
	.cfi_endproc
                                        ## -- End function
	.comm	_APIC_DFR_MODEL_MASK,4,2        ## @APIC_DFR_MODEL_MASK
	.comm	_APIC_DFR_MODEL_FLAT,4,2        ## @APIC_DFR_MODEL_FLAT
	.comm	_APIC_DFR_MODEL_CLUSTER,4,2     ## @APIC_DFR_MODEL_CLUSTER
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"vlapic has bad logical model %x - cannot deliver interrupt"

	.no_dead_strip	_vlapic_calcdest
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function vlapic_calcdest
_vlapic_calcdest:                       ; @vlapic_calcdest
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #112
	.cfi_def_cfa_offset 112
	stp	x28, x27, [sp, #16]             ; 16-byte Folded Spill
	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
	.cfi_offset w27, -88
	.cfi_offset w28, -96
	mov	x21, x4
	mov	x22, x2
	mov	x19, x1
	mov	x20, x0
	cmn	w2, #1
	b.ne	LBB0_2
; %bb.1:
	cbnz	w5, LBB0_4
LBB0_2:
	cmp	w22, #255
	b.ne	LBB0_6
; %bb.3:
	cbnz	w5, LBB0_6
LBB0_4:
	mov	x0, x20
	bl	_vm_active_cpus
	str	w0, [x19]
LBB0_5:
	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
	ldp	x28, x27, [sp, #16]             ; 16-byte Folded Reload
	add	sp, sp, #112
	ret
LBB0_6:
	cbz	w3, LBB0_10
; %bb.7:
	mov	x0, x19
	bl	_CPU_ZERO
	mov	x0, x20
	mov	x1, x22
	bl	_vm_apicid2vcpuid
	mov	x21, x0
	mov	x0, x20
	bl	_vm_active_cpus
	str	w0, [sp, #12]
	mov	x0, x20
	bl	_vm_get_maxcpus
	cmp	w21, w0
	b.ge	LBB0_5
; %bb.8:
	add	x1, sp, #12
	mov	x0, x21
	bl	_CPU_ISSET
	cbz	x0, LBB0_5
; %bb.9:
	mov	x0, x21
	mov	x1, x19
	bl	_CPU_SET
	b	LBB0_5
LBB0_10:
	ubfx	w8, w22, #4, #4
	asr	w9, w22, #16
	mov	w10, #15
	mov	w11, #65535
	cmp	w5, #0
	csel	w23, w11, w10, ne
	csel	w8, w9, w8, ne
	str	w8, [sp, #8]                    ; 4-byte Folded Spill
	mov	x0, x19
	bl	_CPU_ZERO
	mov	x0, x20
	bl	_vm_active_cpus
	str	w0, [sp, #12]
	add	x0, sp, #12
	bl	_CPU_FFS
	cbz	w0, LBB0_5
; %bb.11:
	and	w25, w22, #0xff
	and	w26, w23, w22
Lloh0:
	adrp	x27, _APIC_DFR_MODEL_MASK@GOTPAGE
Lloh1:
	ldr	x27, [x27, _APIC_DFR_MODEL_MASK@GOTPAGEOFF]
Lloh2:
	adrp	x28, _APIC_DFR_MODEL_FLAT@GOTPAGE
Lloh3:
	ldr	x28, [x28, _APIC_DFR_MODEL_FLAT@GOTPAGEOFF]
Lloh4:
	adrp	x22, _APIC_DFR_MODEL_CLUSTER@GOTPAGE
Lloh5:
	ldr	x22, [x22, _APIC_DFR_MODEL_CLUSTER@GOTPAGEOFF]
	b	LBB0_14
LBB0_12:                                ;   in Loop: Header=BB0_14 Depth=1
Lloh6:
	adrp	x1, l_.str@PAGE
Lloh7:
	add	x1, x1, l_.str@PAGEOFF
	bl	_VLAPIC_CTR1
LBB0_13:                                ;   in Loop: Header=BB0_14 Depth=1
	add	x0, sp, #12
	bl	_CPU_FFS
	cbz	w0, LBB0_5
LBB0_14:                                ; =>This Inner Loop Header: Depth=1
	sub	w23, w0, #1
	add	x1, sp, #12
	mov	x0, x23
	bl	_CPU_CLR
	mov	x0, x20
	mov	x1, x23
	bl	_vm_lapic
	ldr	x8, [x0]
	ldp	w2, w24, [x8]
	ldr	w8, [x27]
	and	w8, w8, w2
	ldr	w9, [x28]
	cmp	w8, w9
	b.ne	LBB0_18
; %bb.15:                               ;   in Loop: Header=BB0_14 Depth=1
	asr	w8, w24, #24
	mov	x9, x25
LBB0_16:                                ;   in Loop: Header=BB0_14 Depth=1
	tst	w9, w8
	b.eq	LBB0_13
; %bb.17:                               ;   in Loop: Header=BB0_14 Depth=1
	mov	x0, x23
	mov	x1, x19
	bl	_CPU_SET
	cbz	w21, LBB0_13
	b	LBB0_5
LBB0_18:                                ;   in Loop: Header=BB0_14 Depth=1
	ldr	w9, [x22]
	cmp	w8, w9
	b.ne	LBB0_12
; %bb.19:                               ;   in Loop: Header=BB0_14 Depth=1
	bl	_x2apic
	asr	w8, w24, #28
	ubfx	w9, w24, #24, #4
	asr	w10, w24, #16
	and	w11, w24, #0xffff
	cmp	x0, #0
	csel	w10, w8, w10, eq
	csel	w8, w9, w11, eq
	mov	x9, x26
	ldr	w11, [sp, #8]                   ; 4-byte Folded Reload
	cmp	w10, w11
	b.ne	LBB0_13
	b	LBB0_16
	.loh AdrpLdrGot	Lloh4, Lloh5
	.loh AdrpLdrGot	Lloh2, Lloh3
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpAdd	Lloh6, Lloh7
	.cfi_endproc
                                        ; -- End function
	.comm	_APIC_DFR_MODEL_MASK,4,2        ; @APIC_DFR_MODEL_MASK
	.comm	_APIC_DFR_MODEL_FLAT,4,2        ; @APIC_DFR_MODEL_FLAT
	.comm	_APIC_DFR_MODEL_CLUSTER,4,2     ; @APIC_DFR_MODEL_CLUSTER
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"vlapic has bad logical model %x - cannot deliver interrupt"

	.no_dead_strip	_vlapic_calcdest
.subsections_via_symbols
