	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function native_apic_free_vector
_native_apic_free_vector:               ## @native_apic_free_vector
	.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
	movq	%rdx, %r15
	movq	%rsi, %rbx
	movq	%rdi, %r14
	movq	_APIC_IO_INTS@GOTPCREL(%rip), %r13
	movq	(%r13), %rax
	cmpq	%rsi, %rax
	setle	%cl
	movq	_IDT_SYSCALL@GOTPCREL(%rip), %rdx
	cmpq	%rsi, (%rdx)
	setne	%dl
	andb	%cl, %dl
	movq	_APIC_NUM_IOINTS@GOTPCREL(%rip), %rcx
	addq	(%rcx), %rax
	cmpq	%rsi, %rax
	setge	%al
	andb	%dl, %al
	movzbl	%al, %edi
	callq	_KASSERT
	movq	_num_io_irqs@GOTPCREL(%rip), %rax
	xorl	%edi, %edi
	cmpq	%r15, (%rax)
	setg	%dil
	movq	%r15, %rsi
	callq	_KASSERT
	movq	_lapics@GOTPCREL(%rip), %r12
	movq	(%r12), %rax
	movq	%r14, -48(%rbp)                 ## 8-byte Spill
	movq	(%rax,%r14,8), %rax
	movq	%rbx, %rcx
	subq	(%r13), %rcx
	xorl	%edi, %edi
	cmpq	%r15, (%rax,%rcx,8)
	sete	%dil
	leaq	L_.str.2(%rip), %rsi
	callq	_KASSERT
	movq	_curthread@GOTPCREL(%rip), %rax
	movq	(%rax), %r14
	movq	_rebooting@GOTPCREL(%rip), %r15
	cmpl	$0, (%r15)
	jne	LBB0_4
## %bb.1:
	movq	%r14, %rdi
	callq	_thread_lock
	movq	%r14, %rdi
	callq	_sched_is_bound
	testq	%rax, %rax
	je	LBB0_3
## %bb.2:
	leaq	L_.str.3(%rip), %rdi
	callq	_panic
LBB0_3:
	movq	-48(%rbp), %rdi                 ## 8-byte Reload
	callq	_apic_cpuid
	movq	%r14, %rdi
	movl	%eax, %esi
	callq	_sched_bind
	movq	%r14, %rdi
	callq	_thread_unlock
	movq	_rebooting@GOTPCREL(%rip), %r15
LBB0_4:
	movq	%r14, -56(%rbp)                 ## 8-byte Spill
	movq	_icu_lock@GOTPCREL(%rip), %r14
	movq	%r14, %rdi
	callq	_mtx_lock_spin
	movq	_IRQ_FREE@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	movq	(%r12), %rcx
	movq	-48(%rbp), %rdx                 ## 8-byte Reload
	movq	(%rcx,%rdx,8), %rcx
	subq	(%r13), %rbx
	movq	%rax, (%rcx,%rbx,8)
	movq	%r14, %rdi
	callq	_mtx_unlock_spin
	cmpl	$0, (%r15)
	je	LBB0_6
## %bb.5:
	addq	$24, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_6:
	movq	-56(%rbp), %rbx                 ## 8-byte Reload
	movq	%rbx, %rdi
	callq	_thread_lock
	movq	%rbx, %rdi
	callq	_sched_unbind
	movq	%rbx, %rdi
	addq	$24, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	jmp	_thread_unlock                  ## TAILCALL
	.cfi_endproc
                                        ## -- End function
	.comm	_APIC_IO_INTS,8,3               ## @APIC_IO_INTS
	.comm	_IDT_SYSCALL,8,3                ## @IDT_SYSCALL
	.comm	_APIC_NUM_IOINTS,8,3            ## @APIC_NUM_IOINTS
	.comm	_num_io_irqs,8,3                ## @num_io_irqs
	.comm	_lapics,8,3                     ## @lapics
	.section	__TEXT,__cstring,cstring_literals
L_.str.2:                               ## @.str.2
	.asciz	"IRQ mismatch"

	.comm	_curthread,8,3                  ## @curthread
	.comm	_rebooting,4,2                  ## @rebooting
L_.str.3:                               ## @.str.3
	.asciz	"apic_free_vector: Thread already bound.\n"

	.comm	_icu_lock,4,2                   ## @icu_lock
	.comm	_IRQ_FREE,8,3                   ## @IRQ_FREE
	.comm	_IDT_DTRACE_RET,8,3             ## @IDT_DTRACE_RET
	.no_dead_strip	_native_apic_free_vector
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function native_apic_free_vector
_native_apic_free_vector:               ; @native_apic_free_vector
	.cfi_startproc
; %bb.0:
	stp	x26, x25, [sp, #-80]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 80
	stp	x24, x23, [sp, #16]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #32]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #48]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #64]             ; 16-byte Folded Spill
	add	x29, sp, #64
	.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
	mov	x21, x2
	mov	x19, x1
	mov	x20, x0
Lloh0:
	adrp	x23, _APIC_IO_INTS@GOTPAGE
Lloh1:
	ldr	x23, [x23, _APIC_IO_INTS@GOTPAGEOFF]
	ldr	x8, [x23]
	cmp	x8, x1
Lloh2:
	adrp	x9, _IDT_SYSCALL@GOTPAGE
Lloh3:
	ldr	x9, [x9, _IDT_SYSCALL@GOTPAGEOFF]
Lloh4:
	ldr	x9, [x9]
	ccmp	x9, x1, #4, le
Lloh5:
	adrp	x9, _APIC_NUM_IOINTS@GOTPAGE
Lloh6:
	ldr	x9, [x9, _APIC_NUM_IOINTS@GOTPAGEOFF]
Lloh7:
	ldr	x9, [x9]
	add	x8, x9, x8
	ccmp	x8, x1, #8, ne
	cset	w0, ge
	bl	_KASSERT
Lloh8:
	adrp	x8, _num_io_irqs@GOTPAGE
Lloh9:
	ldr	x8, [x8, _num_io_irqs@GOTPAGEOFF]
Lloh10:
	ldr	x8, [x8]
	cmp	x8, x21
	cset	w0, gt
	mov	x1, x21
	bl	_KASSERT
Lloh11:
	adrp	x24, _lapics@GOTPAGE
Lloh12:
	ldr	x24, [x24, _lapics@GOTPAGEOFF]
	ldr	x8, [x24]
	ldr	x8, [x8, x20, lsl #3]
	ldr	x9, [x23]
	sub	x9, x19, x9
	ldr	x8, [x8, x9, lsl #3]
	cmp	x8, x21
	cset	w0, eq
Lloh13:
	adrp	x1, l_.str.2@PAGE
Lloh14:
	add	x1, x1, l_.str.2@PAGEOFF
	bl	_KASSERT
Lloh15:
	adrp	x8, _curthread@GOTPAGE
Lloh16:
	ldr	x8, [x8, _curthread@GOTPAGEOFF]
Lloh17:
	ldr	x21, [x8]
Lloh18:
	adrp	x25, _rebooting@GOTPAGE
Lloh19:
	ldr	x25, [x25, _rebooting@GOTPAGEOFF]
	ldr	w8, [x25]
	cbnz	w8, LBB0_4
; %bb.1:
	mov	x0, x21
	bl	_thread_lock
	mov	x0, x21
	bl	_sched_is_bound
	cbz	x0, LBB0_3
; %bb.2:
Lloh20:
	adrp	x0, l_.str.3@PAGE
Lloh21:
	add	x0, x0, l_.str.3@PAGEOFF
	bl	_panic
LBB0_3:
	mov	x0, x20
	bl	_apic_cpuid
	mov	x1, x0
	mov	x0, x21
	bl	_sched_bind
	mov	x0, x21
	bl	_thread_unlock
LBB0_4:
Lloh22:
	adrp	x22, _icu_lock@GOTPAGE
Lloh23:
	ldr	x22, [x22, _icu_lock@GOTPAGEOFF]
	mov	x0, x22
	bl	_mtx_lock_spin
Lloh24:
	adrp	x8, _IRQ_FREE@GOTPAGE
Lloh25:
	ldr	x8, [x8, _IRQ_FREE@GOTPAGEOFF]
Lloh26:
	ldr	x8, [x8]
	ldr	x9, [x24]
	ldr	x9, [x9, x20, lsl #3]
	ldr	x10, [x23]
	sub	x10, x19, x10
	str	x8, [x9, x10, lsl #3]
	mov	x0, x22
	bl	_mtx_unlock_spin
	ldr	w8, [x25]
	cbz	w8, LBB0_6
; %bb.5:
	ldp	x29, x30, [sp, #64]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #48]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #32]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #16]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp], #80             ; 16-byte Folded Reload
	ret
LBB0_6:
	mov	x0, x21
	bl	_thread_lock
	mov	x0, x21
	bl	_sched_unbind
	mov	x0, x21
	ldp	x29, x30, [sp, #64]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #48]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #32]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #16]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp], #80             ; 16-byte Folded Reload
	b	_thread_unlock
	.loh AdrpLdrGot	Lloh18, Lloh19
	.loh AdrpLdrGotLdr	Lloh15, Lloh16, Lloh17
	.loh AdrpAdd	Lloh13, Lloh14
	.loh AdrpLdrGot	Lloh11, Lloh12
	.loh AdrpLdrGotLdr	Lloh8, Lloh9, Lloh10
	.loh AdrpLdrGotLdr	Lloh5, Lloh6, Lloh7
	.loh AdrpLdrGotLdr	Lloh2, Lloh3, Lloh4
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpAdd	Lloh20, Lloh21
	.loh AdrpLdrGotLdr	Lloh24, Lloh25, Lloh26
	.loh AdrpLdrGot	Lloh22, Lloh23
	.cfi_endproc
                                        ; -- End function
	.comm	_APIC_IO_INTS,8,3               ; @APIC_IO_INTS
	.comm	_IDT_SYSCALL,8,3                ; @IDT_SYSCALL
	.comm	_APIC_NUM_IOINTS,8,3            ; @APIC_NUM_IOINTS
	.comm	_num_io_irqs,8,3                ; @num_io_irqs
	.comm	_lapics,8,3                     ; @lapics
	.section	__TEXT,__cstring,cstring_literals
l_.str.2:                               ; @.str.2
	.asciz	"IRQ mismatch"

	.comm	_curthread,8,3                  ; @curthread
	.comm	_rebooting,4,2                  ; @rebooting
l_.str.3:                               ; @.str.3
	.asciz	"apic_free_vector: Thread already bound.\n"

	.comm	_icu_lock,4,2                   ; @icu_lock
	.comm	_IRQ_FREE,8,3                   ; @IRQ_FREE
	.comm	_IDT_DTRACE_RET,8,3             ; @IDT_DTRACE_RET
	.no_dead_strip	_native_apic_free_vector
.subsections_via_symbols
