	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function opalpci_alloc_msi
_opalpci_alloc_msi:                     ## @opalpci_alloc_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
	pushq	%rax
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%r8, %r13
	movl	%edx, %r14d
	movl	%edi, %r15d
	callq	_device_get_softc
	movq	(%rax), %r12
	testq	%r12, %r12
	je	LBB0_1
## %bb.2:
	movl	%r14d, %edi
	callq	_powerof2
	movq	_VMEM_ADDR_MIN@GOTPCREL(%rip), %rcx
	movl	(%rcx), %r9d
	movq	_VMEM_ADDR_MAX@GOTPCREL(%rip), %rcx
	movl	(%rcx), %r10d
	movq	_M_BESTFIT@GOTPCREL(%rip), %rcx
	movq	_M_WAITOK@GOTPCREL(%rip), %rdx
	movl	(%rdx), %ebx
	orl	(%rcx), %ebx
	subq	$8, %rsp
	leaq	-48(%rbp), %r11
	movq	%r12, %rdi
	movl	%r14d, %esi
	movl	%eax, %edx
	xorl	%ecx, %ecx
	xorl	%r8d, %r8d
	pushq	%r11
	pushq	%rbx
	pushq	%r10
	callq	_vmem_xalloc
	addq	$32, %rsp
	movl	%eax, %r12d
	testl	%eax, %eax
	jne	LBB0_6
## %bb.3:
	movl	%r15d, %edi
	callq	_ofw_bus_get_node
	movl	%eax, %edi
	callq	_OF_xref_from_node
	movl	$0, %r12d
	testl	%r14d, %r14d
	jle	LBB0_6
## %bb.4:
	movl	%eax, %r15d
	movl	%r14d, %r14d
	xorl	%r12d, %r12d
	xorl	%ebx, %ebx
	.p2align	4, 0x90
LBB0_5:                                 ## =>This Inner Loop Header: Depth=1
	movq	-48(%rbp), %rsi
	addq	%rbx, %rsi
	movl	%r15d, %edi
	callq	_MAP_IRQ
	movl	%eax, (%r13,%rbx,4)
	incq	%rbx
	cmpq	%rbx, %r14
	jne	LBB0_5
	jmp	LBB0_6
LBB0_1:
	movq	_ENODEV@GOTPCREL(%rip), %rax
	movl	(%rax), %r12d
LBB0_6:
	movl	%r12d, %eax
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_ENODEV,4,2                     ## @ENODEV
	.comm	_VMEM_ADDR_MIN,4,2              ## @VMEM_ADDR_MIN
	.comm	_VMEM_ADDR_MAX,4,2              ## @VMEM_ADDR_MAX
	.comm	_M_BESTFIT,4,2                  ## @M_BESTFIT
	.comm	_M_WAITOK,4,2                   ## @M_WAITOK
	.no_dead_strip	_opalpci_alloc_msi
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function opalpci_alloc_msi
_opalpci_alloc_msi:                     ; @opalpci_alloc_msi
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #64
	.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
	mov	x19, x4
	mov	x20, x2
	mov	x21, x0
	bl	_device_get_softc
	ldr	x22, [x0]
	cbz	x22, LBB0_6
; %bb.1:
	mov	x0, x20
	bl	_powerof2
	mov	x2, x0
Lloh0:
	adrp	x8, _VMEM_ADDR_MIN@GOTPAGE
Lloh1:
	ldr	x8, [x8, _VMEM_ADDR_MIN@GOTPAGEOFF]
Lloh2:
	ldr	w5, [x8]
Lloh3:
	adrp	x8, _VMEM_ADDR_MAX@GOTPAGE
Lloh4:
	ldr	x8, [x8, _VMEM_ADDR_MAX@GOTPAGEOFF]
Lloh5:
	adrp	x9, _M_BESTFIT@GOTPAGE
Lloh6:
	ldr	x9, [x9, _M_BESTFIT@GOTPAGEOFF]
Lloh7:
	ldr	w6, [x8]
Lloh8:
	ldr	w8, [x9]
Lloh9:
	adrp	x9, _M_WAITOK@GOTPAGE
Lloh10:
	ldr	x9, [x9, _M_WAITOK@GOTPAGEOFF]
Lloh11:
	ldr	w9, [x9]
	orr	w7, w9, w8
	add	x8, sp, #8
	str	x8, [sp]
	mov	x0, x22
	mov	x1, x20
	mov	w3, #0
	mov	w4, #0
	bl	_vmem_xalloc
	cbnz	w0, LBB0_7
; %bb.2:
	mov	x0, x21
	bl	_ofw_bus_get_node
	bl	_OF_xref_from_node
	cmp	w20, #1
	b.lt	LBB0_5
; %bb.3:
	mov	x21, x0
	mov	x22, #0
	mov	w20, w20
LBB0_4:                                 ; =>This Inner Loop Header: Depth=1
	ldr	x8, [sp, #8]
	add	x1, x22, x8
	mov	x0, x21
	bl	_MAP_IRQ
	str	w0, [x19, x22, lsl #2]
	add	x22, x22, #1
	cmp	x20, x22
	b.ne	LBB0_4
LBB0_5:
	mov	w0, #0
	b	LBB0_7
LBB0_6:
Lloh12:
	adrp	x8, _ENODEV@GOTPAGE
Lloh13:
	ldr	x8, [x8, _ENODEV@GOTPAGEOFF]
Lloh14:
	ldr	w0, [x8]
LBB0_7:
	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
	add	sp, sp, #64
	ret
	.loh AdrpLdrGotLdr	Lloh9, Lloh10, Lloh11
	.loh AdrpLdrGotLdr	Lloh5, Lloh6, Lloh8
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh7
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh12, Lloh13, Lloh14
	.cfi_endproc
                                        ; -- End function
	.comm	_ENODEV,4,2                     ; @ENODEV
	.comm	_VMEM_ADDR_MIN,4,2              ; @VMEM_ADDR_MIN
	.comm	_VMEM_ADDR_MAX,4,2              ; @VMEM_ADDR_MAX
	.comm	_M_BESTFIT,4,2                  ; @M_BESTFIT
	.comm	_M_WAITOK,4,2                   ; @M_WAITOK
	.no_dead_strip	_opalpci_alloc_msi
.subsections_via_symbols
