	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function native_lapic_create
_native_lapic_create:                   ## @native_lapic_create
	.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	%rbx
	pushq	%rax
	.cfi_offset %rbx, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movl	%esi, %ebx
	movl	%edi, %esi
	movq	_max_apic_id@GOTPCREL(%rip), %rax
	cmpl	%edi, (%rax)
	jge	LBB0_3
## %bb.1:
	leaq	L_.str(%rip), %rdi
	callq	_printf
	testl	%ebx, %ebx
	je	LBB0_11
## %bb.2:
	leaq	L_.str.1(%rip), %rdi
	addq	$8, %rsp
	popq	%rbx
	popq	%r14
	popq	%r15
	popq	%rbp
	jmp	_panic                          ## TAILCALL
LBB0_3:
	movq	_lapics@GOTPCREL(%rip), %r15
	movq	(%r15), %rax
	movslq	%esi, %r14
	movq	%r14, %rbx
	shlq	$5, %rbx
	xorl	%edi, %edi
	cmpl	$0, (%rax,%rbx)
	sete	%dil
	movq	%r14, %rsi
	callq	_KASSERT
	movq	(%r15), %r15
	movl	$1, (%r15,%rbx)
	movl	%r14d, 4(%r15,%rbx)
	movq	_APIC_LVT_MAX@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	testl	%eax, %eax
	js	LBB0_5
## %bb.4:
	movq	24(%r15,%rbx), %rdi
	leaq	8(,%rax,8), %rsi
	callq	___bzero
LBB0_5:
	movq	_APIC_ELVT_MAX@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	testl	%eax, %eax
	js	LBB0_7
## %bb.6:
	movq	16(%r15,%rbx), %rdi
	leaq	8(,%rax,8), %rsi
	callq	___bzero
LBB0_7:
	movq	_APIC_NUM_IOINTS@GOTPCREL(%rip), %rcx
	cmpl	$0, (%rcx)
	movq	8(%r15,%rbx), %rax
	js	LBB0_10
## %bb.8:
	movq	$-1, %rdx
	movq	_IRQ_FREE@GOTPCREL(%rip), %rsi
	.p2align	4, 0x90
LBB0_9:                                 ## =>This Inner Loop Header: Depth=1
	movl	(%rsi), %edi
	movl	%edi, 4(%rax,%rdx,4)
	movslq	(%rcx), %rdi
	incq	%rdx
	cmpq	%rdi, %rdx
	jl	LBB0_9
LBB0_10:
	movq	_IRQ_SYSCALL@GOTPCREL(%rip), %rcx
	movl	(%rcx), %ecx
	movq	_IDT_SYSCALL@GOTPCREL(%rip), %rdx
	movq	(%rdx), %rdx
	movq	_APIC_IO_INTS@GOTPCREL(%rip), %rsi
	movq	(%rsi), %rsi
	subq	%rsi, %rdx
	movl	%ecx, (%rax,%rdx,4)
	movq	_IRQ_TIMER@GOTPCREL(%rip), %rcx
	movl	(%rcx), %ecx
	movq	_APIC_TIMER_INT@GOTPCREL(%rip), %rdx
	movq	(%rdx), %rdx
	subq	%rsi, %rdx
	movl	%ecx, (%rax,%rdx,4)
LBB0_11:
	addq	$8, %rsp
	popq	%rbx
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_max_apic_id,4,2                ## @max_apic_id
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"APIC: Ignoring local APIC with ID %d\n"

L_.str.1:                               ## @.str.1
	.asciz	"Can't ignore BSP"

	.comm	_lapics,8,3                     ## @lapics
	.comm	_APIC_LVT_MAX,4,2               ## @APIC_LVT_MAX
	.comm	_lvts,8,3                       ## @lvts
	.comm	_APIC_ELVT_MAX,4,2              ## @APIC_ELVT_MAX
	.comm	_elvts,8,3                      ## @elvts
	.comm	_APIC_NUM_IOINTS,4,2            ## @APIC_NUM_IOINTS
	.comm	_IRQ_FREE,4,2                   ## @IRQ_FREE
	.comm	_IRQ_SYSCALL,4,2                ## @IRQ_SYSCALL
	.comm	_IDT_SYSCALL,8,3                ## @IDT_SYSCALL
	.comm	_APIC_IO_INTS,8,3               ## @APIC_IO_INTS
	.comm	_IRQ_TIMER,4,2                  ## @IRQ_TIMER
	.comm	_APIC_TIMER_INT,8,3             ## @APIC_TIMER_INT
	.comm	_IDT_DTRACE_RET,8,3             ## @IDT_DTRACE_RET
	.comm	_IDT_EVTCHN,8,3                 ## @IDT_EVTCHN
	.comm	_IRQ_DTRACE_RET,4,2             ## @IRQ_DTRACE_RET
	.comm	_IRQ_EVTCHN,4,2                 ## @IRQ_EVTCHN
	.no_dead_strip	_native_lapic_create
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function native_lapic_create
_native_lapic_create:                   ; @native_lapic_create
	.cfi_startproc
; %bb.0:
	stp	x22, x21, [sp, #-48]!           ; 16-byte Folded Spill
	.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
	.cfi_offset w21, -40
	.cfi_offset w22, -48
	mov	x20, x0
Lloh0:
	adrp	x8, _max_apic_id@GOTPAGE
Lloh1:
	ldr	x8, [x8, _max_apic_id@GOTPAGEOFF]
Lloh2:
	ldr	w8, [x8]
	cmp	w8, w0
	b.ge	LBB0_3
; %bb.1:
	mov	x19, x1
Lloh3:
	adrp	x0, l_.str@PAGE
Lloh4:
	add	x0, x0, l_.str@PAGEOFF
	mov	x1, x20
	bl	_printf
	cbz	w19, LBB0_11
; %bb.2:
Lloh5:
	adrp	x0, l_.str.1@PAGE
Lloh6:
	add	x0, x0, l_.str.1@PAGEOFF
	ldp	x29, x30, [sp, #32]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #16]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp], #48             ; 16-byte Folded Reload
	b	_panic
LBB0_3:
Lloh7:
	adrp	x21, _lapics@GOTPAGE
Lloh8:
	ldr	x21, [x21, _lapics@GOTPAGEOFF]
	ldr	x8, [x21]
	sxtw	x19, w20
	sbfiz	x22, x20, #5, #32
	ldr	w8, [x8, x22]
	cmp	w8, #0
	cset	w0, eq
	mov	x1, x19
	bl	_KASSERT
	ldr	x21, [x21]
	add	x8, x21, x22
	mov	w9, #1
	stp	w9, w20, [x8]
Lloh9:
	adrp	x8, _APIC_LVT_MAX@GOTPAGE
Lloh10:
	ldr	x8, [x8, _APIC_LVT_MAX@GOTPAGEOFF]
Lloh11:
	ldr	w8, [x8]
	tbnz	w8, #31, LBB0_5
; %bb.4:
	add	x9, x21, x19, lsl #5
	ldr	x0, [x9, #24]
	lsl	x8, x8, #3
	add	x1, x8, #8
	bl	_bzero
LBB0_5:
Lloh12:
	adrp	x8, _APIC_ELVT_MAX@GOTPAGE
Lloh13:
	ldr	x8, [x8, _APIC_ELVT_MAX@GOTPAGEOFF]
Lloh14:
	ldr	w8, [x8]
	tbnz	w8, #31, LBB0_7
; %bb.6:
	add	x9, x21, x19, lsl #5
	ldr	x0, [x9, #16]
	lsl	x8, x8, #3
	add	x1, x8, #8
	bl	_bzero
LBB0_7:
Lloh15:
	adrp	x9, _APIC_NUM_IOINTS@GOTPAGE
Lloh16:
	ldr	x9, [x9, _APIC_NUM_IOINTS@GOTPAGEOFF]
	ldr	w10, [x9]
	add	x8, x21, x19, lsl #5
	ldr	x8, [x8, #8]
	tbnz	w10, #31, LBB0_10
; %bb.8:
	mov	x10, #0
Lloh17:
	adrp	x11, _IRQ_FREE@GOTPAGE
Lloh18:
	ldr	x11, [x11, _IRQ_FREE@GOTPAGEOFF]
LBB0_9:                                 ; =>This Inner Loop Header: Depth=1
	ldr	w12, [x11]
	str	w12, [x8, x10, lsl #2]
	add	x12, x10, #1
	ldrsw	x13, [x9]
	cmp	x10, x13
	mov	x10, x12
	b.lt	LBB0_9
LBB0_10:
Lloh19:
	adrp	x9, _IRQ_SYSCALL@GOTPAGE
Lloh20:
	ldr	x9, [x9, _IRQ_SYSCALL@GOTPAGEOFF]
Lloh21:
	ldr	w9, [x9]
Lloh22:
	adrp	x10, _IDT_SYSCALL@GOTPAGE
Lloh23:
	ldr	x10, [x10, _IDT_SYSCALL@GOTPAGEOFF]
Lloh24:
	ldr	x10, [x10]
Lloh25:
	adrp	x11, _APIC_IO_INTS@GOTPAGE
Lloh26:
	ldr	x11, [x11, _APIC_IO_INTS@GOTPAGEOFF]
Lloh27:
	ldr	x11, [x11]
	sub	x10, x10, x11
	str	w9, [x8, x10, lsl #2]
Lloh28:
	adrp	x9, _IRQ_TIMER@GOTPAGE
Lloh29:
	ldr	x9, [x9, _IRQ_TIMER@GOTPAGEOFF]
Lloh30:
	ldr	w9, [x9]
Lloh31:
	adrp	x10, _APIC_TIMER_INT@GOTPAGE
Lloh32:
	ldr	x10, [x10, _APIC_TIMER_INT@GOTPAGEOFF]
Lloh33:
	ldr	x10, [x10]
	sub	x10, x10, x11
	str	w9, [x8, x10, lsl #2]
LBB0_11:
	ldp	x29, x30, [sp, #32]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #16]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp], #48             ; 16-byte Folded Reload
	ret
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpAdd	Lloh3, Lloh4
	.loh AdrpAdd	Lloh5, Lloh6
	.loh AdrpLdrGotLdr	Lloh9, Lloh10, Lloh11
	.loh AdrpLdrGot	Lloh7, Lloh8
	.loh AdrpLdrGotLdr	Lloh12, Lloh13, Lloh14
	.loh AdrpLdrGot	Lloh15, Lloh16
	.loh AdrpLdrGot	Lloh17, Lloh18
	.loh AdrpLdrGotLdr	Lloh31, Lloh32, Lloh33
	.loh AdrpLdrGotLdr	Lloh28, Lloh29, Lloh30
	.loh AdrpLdrGotLdr	Lloh25, Lloh26, Lloh27
	.loh AdrpLdrGotLdr	Lloh22, Lloh23, Lloh24
	.loh AdrpLdrGotLdr	Lloh19, Lloh20, Lloh21
	.cfi_endproc
                                        ; -- End function
	.comm	_max_apic_id,4,2                ; @max_apic_id
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"APIC: Ignoring local APIC with ID %d\n"

l_.str.1:                               ; @.str.1
	.asciz	"Can't ignore BSP"

	.comm	_lapics,8,3                     ; @lapics
	.comm	_APIC_LVT_MAX,4,2               ; @APIC_LVT_MAX
	.comm	_lvts,8,3                       ; @lvts
	.comm	_APIC_ELVT_MAX,4,2              ; @APIC_ELVT_MAX
	.comm	_elvts,8,3                      ; @elvts
	.comm	_APIC_NUM_IOINTS,4,2            ; @APIC_NUM_IOINTS
	.comm	_IRQ_FREE,4,2                   ; @IRQ_FREE
	.comm	_IRQ_SYSCALL,4,2                ; @IRQ_SYSCALL
	.comm	_IDT_SYSCALL,8,3                ; @IDT_SYSCALL
	.comm	_APIC_IO_INTS,8,3               ; @APIC_IO_INTS
	.comm	_IRQ_TIMER,4,2                  ; @IRQ_TIMER
	.comm	_APIC_TIMER_INT,8,3             ; @APIC_TIMER_INT
	.comm	_IDT_DTRACE_RET,8,3             ; @IDT_DTRACE_RET
	.comm	_IDT_EVTCHN,8,3                 ; @IDT_EVTCHN
	.comm	_IRQ_DTRACE_RET,4,2             ; @IRQ_DTRACE_RET
	.comm	_IRQ_EVTCHN,4,2                 ; @IRQ_EVTCHN
	.no_dead_strip	_native_lapic_create
.subsections_via_symbols
