	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function xen_intr_alloc_isrc
_xen_intr_alloc_isrc:                   ## @xen_intr_alloc_isrc
	.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, %r12d
	movl	%edi, %r14d
	movq	_xen_intr_isrc_lock@GOTPCREL(%rip), %rdi
	callq	_mtx_owned
	leaq	L_.str(%rip), %rsi
	movl	%eax, %edi
	callq	_KASSERT
	movq	_xen_intr_auto_vector_count@GOTPCREL(%rip), %rax
	movl	(%rax), %ecx
	movq	_NR_EVENT_CHANNELS@GOTPCREL(%rip), %rdx
	cmpl	(%rdx), %ecx
	jle	LBB0_4
## %bb.1:
	cmpb	$0, _xen_intr_alloc_isrc.warned(%rip)
	je	LBB0_3
## %bb.2:
	xorl	%ebx, %ebx
	jmp	LBB0_10
LBB0_4:
	movq	_EVTCHN_TYPE_PIRQ@GOTPCREL(%rip), %r13
	cmpl	%r14d, (%r13)
	je	LBB0_6
## %bb.5:
	movq	_first_evtchn_irq@GOTPCREL(%rip), %rdx
	movl	(%rdx), %r12d
	addl	%ecx, %r12d
	incl	%ecx
	movl	%ecx, (%rax)
LBB0_6:
	movl	%r12d, %edi
	callq	_intr_lookup_source
	xorl	%edi, %edi
	testq	%rax, %rax
	sete	%dil
	leaq	L_.str.2(%rip), %rsi
	callq	_KASSERT
	movq	_xen_intr_isrc_lock@GOTPCREL(%rip), %r15
	movq	%r15, %rdi
	callq	_mtx_unlock
	movq	_M_XENINTR@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	_M_WAITOK@GOTPCREL(%rip), %rax
	movq	_M_ZERO@GOTPCREL(%rip), %rcx
	movl	(%rcx), %edx
	orl	(%rax), %edx
	movl	$16, %edi
	callq	_malloc
	movq	%rax, %rbx
	cmpl	%r14d, (%r13)
	jne	LBB0_7
## %bb.8:
	movq	_xen_intr_pirq_pic@GOTPCREL(%rip), %rax
	jmp	LBB0_9
LBB0_3:
	movb	$1, _xen_intr_alloc_isrc.warned(%rip)
	leaq	L_str(%rip), %rdi
	callq	_puts
	xorl	%ebx, %ebx
	jmp	LBB0_10
LBB0_7:
	movq	_xen_intr_pic@GOTPCREL(%rip), %rax
LBB0_9:
	leaq	8(%rbx), %rdi
	movq	%rax, 8(%rbx)
	movl	%r12d, (%rbx)
	movl	%r14d, 4(%rbx)
	callq	_intr_register_source
	movq	%r15, %rdi
	callq	_mtx_lock
LBB0_10:
	movq	%rbx, %rax
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
.zerofill __DATA,__bss,_xen_intr_alloc_isrc.warned,1,2 ## @xen_intr_alloc_isrc.warned
	.comm	_xen_intr_isrc_lock,4,2         ## @xen_intr_isrc_lock
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"Evtchn alloc lock not held"

	.comm	_xen_intr_auto_vector_count,4,2 ## @xen_intr_auto_vector_count
	.comm	_NR_EVENT_CHANNELS,4,2          ## @NR_EVENT_CHANNELS
	.comm	_EVTCHN_TYPE_PIRQ,4,2           ## @EVTCHN_TYPE_PIRQ
	.comm	_first_evtchn_irq,4,2           ## @first_evtchn_irq
L_.str.2:                               ## @.str.2
	.asciz	"Trying to use an already allocated vector"

	.comm	_M_XENINTR,4,2                  ## @M_XENINTR
	.comm	_M_WAITOK,4,2                   ## @M_WAITOK
	.comm	_M_ZERO,4,2                     ## @M_ZERO
	.comm	_xen_intr_pirq_pic,4,2          ## @xen_intr_pirq_pic
	.comm	_xen_intr_pic,4,2               ## @xen_intr_pic
L_str:                                  ## @str
	.asciz	"xen_intr_alloc: Event channels exhausted."

	.no_dead_strip	_xen_intr_alloc_isrc
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function xen_intr_alloc_isrc
_xen_intr_alloc_isrc:                   ; @xen_intr_alloc_isrc
	.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	x20, x1
	mov	x19, x0
Lloh0:
	adrp	x0, _xen_intr_isrc_lock@GOTPAGE
Lloh1:
	ldr	x0, [x0, _xen_intr_isrc_lock@GOTPAGEOFF]
	bl	_mtx_owned
Lloh2:
	adrp	x1, l_.str@PAGE
Lloh3:
	add	x1, x1, l_.str@PAGEOFF
	bl	_KASSERT
Lloh4:
	adrp	x8, _xen_intr_auto_vector_count@GOTPAGE
Lloh5:
	ldr	x8, [x8, _xen_intr_auto_vector_count@GOTPAGEOFF]
	ldr	w9, [x8]
Lloh6:
	adrp	x10, _NR_EVENT_CHANNELS@GOTPAGE
Lloh7:
	ldr	x10, [x10, _NR_EVENT_CHANNELS@GOTPAGEOFF]
Lloh8:
	ldr	w10, [x10]
	cmp	w9, w10
	b.le	LBB0_4
; %bb.1:
	adrp	x8, _xen_intr_alloc_isrc.warned@PAGE
	ldrb	w9, [x8, _xen_intr_alloc_isrc.warned@PAGEOFF]
	tbnz	w9, #0, LBB0_3
; %bb.2:
	mov	w9, #1
	strb	w9, [x8, _xen_intr_alloc_isrc.warned@PAGEOFF]
Lloh9:
	adrp	x0, l_str@PAGE
Lloh10:
	add	x0, x0, l_str@PAGEOFF
	bl	_puts
LBB0_3:
	mov	x21, #0
	b	LBB0_7
LBB0_4:
Lloh11:
	adrp	x23, _EVTCHN_TYPE_PIRQ@GOTPAGE
Lloh12:
	ldr	x23, [x23, _EVTCHN_TYPE_PIRQ@GOTPAGEOFF]
	ldr	w10, [x23]
	cmp	w10, w19
	b.eq	LBB0_6
; %bb.5:
Lloh13:
	adrp	x10, _first_evtchn_irq@GOTPAGE
Lloh14:
	ldr	x10, [x10, _first_evtchn_irq@GOTPAGEOFF]
Lloh15:
	ldr	w10, [x10]
	add	w20, w10, w9
	add	w9, w9, #1
	str	w9, [x8]
LBB0_6:
	mov	x0, x20
	bl	_intr_lookup_source
	cmp	x0, #0
	cset	w0, eq
Lloh16:
	adrp	x1, l_.str.2@PAGE
Lloh17:
	add	x1, x1, l_.str.2@PAGEOFF
	bl	_KASSERT
Lloh18:
	adrp	x22, _xen_intr_isrc_lock@GOTPAGE
Lloh19:
	ldr	x22, [x22, _xen_intr_isrc_lock@GOTPAGEOFF]
	mov	x0, x22
	bl	_mtx_unlock
Lloh20:
	adrp	x8, _M_XENINTR@GOTPAGE
Lloh21:
	ldr	x8, [x8, _M_XENINTR@GOTPAGEOFF]
Lloh22:
	adrp	x9, _M_WAITOK@GOTPAGE
Lloh23:
	ldr	x9, [x9, _M_WAITOK@GOTPAGEOFF]
Lloh24:
	ldr	w1, [x8]
Lloh25:
	ldr	w8, [x9]
Lloh26:
	adrp	x9, _M_ZERO@GOTPAGE
Lloh27:
	ldr	x9, [x9, _M_ZERO@GOTPAGEOFF]
Lloh28:
	ldr	w9, [x9]
	orr	w2, w9, w8
	mov	w0, #16
	bl	_malloc
	mov	x21, x0
	ldr	w8, [x23]
Lloh29:
	adrp	x9, _xen_intr_pic@GOTPAGE
Lloh30:
	ldr	x9, [x9, _xen_intr_pic@GOTPAGEOFF]
Lloh31:
	adrp	x10, _xen_intr_pirq_pic@GOTPAGE
Lloh32:
	ldr	x10, [x10, _xen_intr_pirq_pic@GOTPAGEOFF]
	cmp	w8, w19
	csel	x8, x10, x9, eq
	str	x8, [x0, #8]!
	stp	w20, w19, [x21]
	bl	_intr_register_source
	mov	x0, x22
	bl	_mtx_lock
LBB0_7:
	mov	x0, x21
	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
	.loh AdrpLdrGotLdr	Lloh6, Lloh7, Lloh8
	.loh AdrpLdrGot	Lloh4, Lloh5
	.loh AdrpAdd	Lloh2, Lloh3
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpAdd	Lloh9, Lloh10
	.loh AdrpLdrGot	Lloh11, Lloh12
	.loh AdrpLdrGotLdr	Lloh13, Lloh14, Lloh15
	.loh AdrpLdrGot	Lloh31, Lloh32
	.loh AdrpLdrGot	Lloh29, Lloh30
	.loh AdrpLdrGotLdr	Lloh26, Lloh27, Lloh28
	.loh AdrpLdrGotLdr	Lloh22, Lloh23, Lloh25
	.loh AdrpLdrGotLdr	Lloh20, Lloh21, Lloh24
	.loh AdrpLdrGot	Lloh18, Lloh19
	.loh AdrpAdd	Lloh16, Lloh17
	.cfi_endproc
                                        ; -- End function
.zerofill __DATA,__bss,_xen_intr_alloc_isrc.warned,1,2 ; @xen_intr_alloc_isrc.warned
	.comm	_xen_intr_isrc_lock,4,2         ; @xen_intr_isrc_lock
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"Evtchn alloc lock not held"

	.comm	_xen_intr_auto_vector_count,4,2 ; @xen_intr_auto_vector_count
	.comm	_NR_EVENT_CHANNELS,4,2          ; @NR_EVENT_CHANNELS
	.comm	_EVTCHN_TYPE_PIRQ,4,2           ; @EVTCHN_TYPE_PIRQ
	.comm	_first_evtchn_irq,4,2           ; @first_evtchn_irq
l_.str.2:                               ; @.str.2
	.asciz	"Trying to use an already allocated vector"

	.comm	_M_XENINTR,4,2                  ; @M_XENINTR
	.comm	_M_WAITOK,4,2                   ; @M_WAITOK
	.comm	_M_ZERO,4,2                     ; @M_ZERO
	.comm	_xen_intr_pirq_pic,4,2          ; @xen_intr_pirq_pic
	.comm	_xen_intr_pic,4,2               ; @xen_intr_pic
l_str:                                  ; @str
	.asciz	"xen_intr_alloc: Event channels exhausted."

	.no_dead_strip	_xen_intr_alloc_isrc
.subsections_via_symbols
