	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_xen_register_msi               ## -- Begin function xen_register_msi
	.p2align	4, 0x90
_xen_register_msi:                      ## @xen_register_msi
	.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	$40, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movl	%edx, %r14d
	movl	%esi, %ebx
	movl	%edi, %r12d
	leaq	-72(%rbp), %r15
	movq	%r15, %rdi
	xorl	%esi, %esi
	movl	$28, %edx
	callq	_memset
	movq	_DOMID_SELF@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movl	%eax, -48(%rbp)
	cmpl	$1, %r14d
	movq	%rbx, -80(%rbp)                 ## 8-byte Spill
	jne	LBB0_1
## %bb.2:
	movq	_MAP_PIRQ_TYPE_MSI_SEG@GOTPCREL(%rip), %rax
	jmp	LBB0_3
LBB0_1:
	movq	_MAP_PIRQ_TYPE_MULTI_MSI@GOTPCREL(%rip), %rax
LBB0_3:
	movl	(%rax), %eax
	movl	%eax, -52(%rbp)
	movq	$-1, -72(%rbp)
	movl	%r12d, %edi
	callq	_pci_get_bus
	movl	%eax, %r13d
	movl	%r12d, %edi
	callq	_pci_get_domain
	shll	$16, %eax
	orl	%r13d, %eax
	movl	%eax, -64(%rbp)
	movl	%r12d, %edi
	callq	_pci_get_slot
	movl	%eax, %ebx
	shll	$3, %ebx
	movl	%r12d, %edi
	callq	_pci_get_function
	orl	%ebx, %eax
	movl	%eax, -60(%rbp)
	movl	%r14d, -56(%rbp)
	movq	_PHYSDEVOP_map_pirq@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	movq	%r15, %rsi
	callq	_HYPERVISOR_physdev_op
	testl	%eax, %eax
	jne	LBB0_10
## %bb.4:
	movl	-56(%rbp), %edx
	cmpl	%r14d, %edx
	je	LBB0_6
## %bb.5:
	leaq	L_.str(%rip), %rdi
	movl	%r14d, %esi
	callq	_panic
LBB0_6:
	movq	_xen_intr_isrc_lock@GOTPCREL(%rip), %rdi
	callq	_mtx_lock
	testl	%r14d, %r14d
	movq	-80(%rbp), %r13                 ## 8-byte Reload
	jle	LBB0_9
## %bb.7:
	xorl	%ebx, %ebx
	leaq	L_.str.1(%rip), %r15
	.p2align	4, 0x90
LBB0_8:                                 ## =>This Inner Loop Header: Depth=1
	movq	_EVTCHN_TYPE_PIRQ@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	leal	(%rbx,%r13), %esi
	callq	_xen_intr_alloc_isrc
	movq	%rax, %r12
	xorl	%edi, %edi
	testq	%rax, %rax
	setne	%dil
	movq	%r15, %rsi
	callq	_KASSERT
	movl	-68(%rbp), %eax
	addl	%ebx, %eax
	movl	%eax, (%r12)
	movl	$1, 4(%r12)
	incl	%ebx
	cmpl	%ebx, %r14d
	jne	LBB0_8
LBB0_9:
	movq	_xen_intr_isrc_lock@GOTPCREL(%rip), %rdi
	callq	_mtx_unlock
	xorl	%eax, %eax
LBB0_10:
	addq	$40, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_DOMID_SELF,4,2                 ## @DOMID_SELF
	.comm	_MAP_PIRQ_TYPE_MSI_SEG,4,2      ## @MAP_PIRQ_TYPE_MSI_SEG
	.comm	_MAP_PIRQ_TYPE_MULTI_MSI,4,2    ## @MAP_PIRQ_TYPE_MULTI_MSI
	.comm	_PHYSDEVOP_map_pirq,4,2         ## @PHYSDEVOP_map_pirq
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"unable to setup all requested MSI vectors (expected %d got %d)"

	.comm	_xen_intr_isrc_lock,4,2         ## @xen_intr_isrc_lock
	.comm	_EVTCHN_TYPE_PIRQ,4,2           ## @EVTCHN_TYPE_PIRQ
L_.str.1:                               ## @.str.1
	.asciz	"xen: unable to allocate isrc for interrupt"

.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_xen_register_msi               ; -- Begin function xen_register_msi
	.p2align	2
_xen_register_msi:                      ; @xen_register_msi
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #112
	.cfi_def_cfa_offset 112
	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
	mov	x19, x2
	mov	x20, x1
	mov	x21, x0
	mov	x0, sp
	mov	w1, #0
	mov	w2, #28
	bl	_memset
Lloh0:
	adrp	x8, _DOMID_SELF@GOTPAGE
Lloh1:
	ldr	x8, [x8, _DOMID_SELF@GOTPAGEOFF]
Lloh2:
	ldr	w8, [x8]
	str	w8, [sp, #24]
Lloh3:
	adrp	x8, _MAP_PIRQ_TYPE_MSI_SEG@GOTPAGE
Lloh4:
	ldr	x8, [x8, _MAP_PIRQ_TYPE_MSI_SEG@GOTPAGEOFF]
Lloh5:
	adrp	x9, _MAP_PIRQ_TYPE_MULTI_MSI@GOTPAGE
Lloh6:
	ldr	x9, [x9, _MAP_PIRQ_TYPE_MULTI_MSI@GOTPAGEOFF]
	cmp	w19, #1
	csel	x8, x8, x9, eq
	ldr	w8, [x8]
	str	w8, [sp, #20]
	movi.2d	v0, #0xffffffffffffffff
	str	d0, [sp]
	mov	x0, x21
	bl	_pci_get_bus
	mov	x22, x0
	mov	x0, x21
	bl	_pci_get_domain
	orr	w8, w22, w0, lsl #16
	str	w8, [sp, #8]
	mov	x0, x21
	bl	_pci_get_slot
	mov	x22, x0
	mov	x0, x21
	bl	_pci_get_function
	orr	w8, w0, w22, lsl #3
	stp	w8, w19, [sp, #12]
Lloh7:
	adrp	x8, _PHYSDEVOP_map_pirq@GOTPAGE
Lloh8:
	ldr	x8, [x8, _PHYSDEVOP_map_pirq@GOTPAGEOFF]
Lloh9:
	ldr	w0, [x8]
	mov	x1, sp
	bl	_HYPERVISOR_physdev_op
	cbnz	w0, LBB0_7
; %bb.1:
	ldr	w2, [sp, #16]
	cmp	w2, w19
	b.eq	LBB0_3
; %bb.2:
Lloh10:
	adrp	x0, l_.str@PAGE
Lloh11:
	add	x0, x0, l_.str@PAGEOFF
	mov	x1, x19
	bl	_panic
LBB0_3:
Lloh12:
	adrp	x0, _xen_intr_isrc_lock@GOTPAGE
Lloh13:
	ldr	x0, [x0, _xen_intr_isrc_lock@GOTPAGEOFF]
	bl	_mtx_lock
	cmp	w19, #1
	b.lt	LBB0_6
; %bb.4:
	mov	w23, #0
Lloh14:
	adrp	x24, _EVTCHN_TYPE_PIRQ@GOTPAGE
Lloh15:
	ldr	x24, [x24, _EVTCHN_TYPE_PIRQ@GOTPAGEOFF]
	mov	w25, #1
Lloh16:
	adrp	x21, l_.str.1@PAGE
Lloh17:
	add	x21, x21, l_.str.1@PAGEOFF
LBB0_5:                                 ; =>This Inner Loop Header: Depth=1
	ldr	w0, [x24]
	add	w1, w20, w23
	bl	_xen_intr_alloc_isrc
	mov	x22, x0
	cmp	x0, #0
	cset	w0, ne
	mov	x1, x21
	bl	_KASSERT
	ldr	w8, [sp, #4]
	add	w8, w23, w8
	stp	w8, w25, [x22]
	add	w23, w23, #1
	cmp	w19, w23
	b.ne	LBB0_5
LBB0_6:
Lloh18:
	adrp	x0, _xen_intr_isrc_lock@GOTPAGE
Lloh19:
	ldr	x0, [x0, _xen_intr_isrc_lock@GOTPAGEOFF]
	bl	_mtx_unlock
	mov	w0, #0
LBB0_7:
	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
	add	sp, sp, #112
	ret
	.loh AdrpLdrGotLdr	Lloh7, Lloh8, Lloh9
	.loh AdrpLdrGot	Lloh5, Lloh6
	.loh AdrpLdrGot	Lloh3, Lloh4
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpAdd	Lloh10, Lloh11
	.loh AdrpLdrGot	Lloh12, Lloh13
	.loh AdrpAdd	Lloh16, Lloh17
	.loh AdrpLdrGot	Lloh14, Lloh15
	.loh AdrpLdrGot	Lloh18, Lloh19
	.cfi_endproc
                                        ; -- End function
	.comm	_DOMID_SELF,4,2                 ; @DOMID_SELF
	.comm	_MAP_PIRQ_TYPE_MSI_SEG,4,2      ; @MAP_PIRQ_TYPE_MSI_SEG
	.comm	_MAP_PIRQ_TYPE_MULTI_MSI,4,2    ; @MAP_PIRQ_TYPE_MULTI_MSI
	.comm	_PHYSDEVOP_map_pirq,4,2         ; @PHYSDEVOP_map_pirq
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"unable to setup all requested MSI vectors (expected %d got %d)"

	.comm	_xen_intr_isrc_lock,4,2         ; @xen_intr_isrc_lock
	.comm	_EVTCHN_TYPE_PIRQ,4,2           ; @EVTCHN_TYPE_PIRQ
l_.str.1:                               ; @.str.1
	.asciz	"xen: unable to allocate isrc for interrupt"

.subsections_via_symbols
