	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function opalpci_map_msi
_opalpci_map_msi:                       ## @opalpci_map_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	$24, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%r8, %r12
	movq	%rcx, %r14
	movl	%edx, %r13d
	movl	%esi, -52(%rbp)                 ## 4-byte Spill
	callq	_device_get_softc
	cmpq	$0, 16(%rax)
	je	LBB0_1
## %bb.2:
	movq	%rax, %rbx
	movl	(%rax), %eax
	movl	8(%rbx), %esi
	addl	4(%rbx), %eax
	subl	%eax, %r13d
	movq	_OPAL_PCI_SET_XIVE_PE@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	movq	_OPAL_PCI_DEFAULT_PE@GOTPCREL(%rip), %r15
	movl	(%r15), %edx
	movl	%r13d, %ecx
	xorl	%eax, %eax
	callq	_opal_call
	movl	-52(%rbp), %edi                 ## 4-byte Reload
	callq	_device_get_ivars
	cmpq	$0, (%rax)
	jle	LBB0_5
## %bb.3:
	movq	_PCIM_MSICTRL_64BIT@GOTPCREL(%rip), %rcx
	movl	(%rcx), %ecx
	testl	%ecx, 8(%rax)
	je	LBB0_4
LBB0_5:
	movq	_OPAL_GET_MSI_64@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movl	%eax, -48(%rbp)                 ## 4-byte Spill
	movl	8(%rbx), %eax
	movl	%eax, -44(%rbp)                 ## 4-byte Spill
	movl	(%r15), %r15d
	movq	%r14, %rdi
	callq	_vtophys
	movl	%eax, %ebx
	movq	%r12, %rdi
	callq	_vtophys
	movl	%eax, (%rsp)
	movl	-48(%rbp), %edi                 ## 4-byte Reload
	movl	-44(%rbp), %esi                 ## 4-byte Reload
	movl	%r15d, %edx
	movl	%r13d, %ecx
	movl	$1, %r8d
	movl	%ebx, %r9d
	xorl	%eax, %eax
	callq	_opal_call
	movl	%eax, %ebx
	movl	(%r14), %edi
	callq	_be64toh
	jmp	LBB0_6
LBB0_1:
	movq	_ENODEV@GOTPCREL(%rip), %rax
	jmp	LBB0_11
LBB0_4:
	movq	_OPAL_GET_MSI_32@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movl	%eax, -48(%rbp)                 ## 4-byte Spill
	movl	8(%rbx), %eax
	movl	%eax, -44(%rbp)                 ## 4-byte Spill
	movl	(%r15), %r15d
	leaq	-56(%rbp), %rdi
	callq	_vtophys
	movl	%eax, %ebx
	movq	%r12, %rdi
	callq	_vtophys
	movl	%eax, (%rsp)
	movl	-48(%rbp), %edi                 ## 4-byte Reload
	movl	-44(%rbp), %esi                 ## 4-byte Reload
	movl	%r15d, %edx
	movl	%r13d, %ecx
	movl	$1, %r8d
	movl	%ebx, %r9d
	xorl	%eax, %eax
	callq	_opal_call
	movl	%eax, %ebx
	movl	-56(%rbp), %edi
	callq	_be32toh
LBB0_6:
	movl	%eax, (%r14)
	movl	(%r12), %edi
	callq	_be32toh
	movl	%eax, (%r12)
	movq	_bootverbose@GOTPCREL(%rip), %rax
	cmpq	$0, (%rax)
	je	LBB0_9
## %bb.7:
	testl	%ebx, %ebx
	je	LBB0_9
## %bb.8:
	leaq	L_.str(%rip), %rsi
	movl	-52(%rbp), %edi                 ## 4-byte Reload
	movl	%ebx, %edx
	callq	_device_printf
LBB0_9:
	testl	%ebx, %ebx
	je	LBB0_12
## %bb.10:
	movq	_ENXIO@GOTPCREL(%rip), %rax
LBB0_11:
	movl	(%rax), %ebx
LBB0_12:
	movl	%ebx, %eax
	addq	$24, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_ENODEV,4,2                     ## @ENODEV
	.comm	_OPAL_PCI_SET_XIVE_PE,4,2       ## @OPAL_PCI_SET_XIVE_PE
	.comm	_OPAL_PCI_DEFAULT_PE,4,2        ## @OPAL_PCI_DEFAULT_PE
	.comm	_PCIM_MSICTRL_64BIT,4,2         ## @PCIM_MSICTRL_64BIT
	.comm	_OPAL_GET_MSI_32,4,2            ## @OPAL_GET_MSI_32
	.comm	_OPAL_GET_MSI_64,4,2            ## @OPAL_GET_MSI_64
	.comm	_bootverbose,8,3                ## @bootverbose
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"OPAL MSI mapping error: %d\n"

	.comm	_ENXIO,4,2                      ## @ENXIO
	.no_dead_strip	_opalpci_map_msi
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function opalpci_map_msi
_opalpci_map_msi:                       ; @opalpci_map_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	x20, x4
	mov	x21, x3
	mov	x22, x2
	mov	x19, x1
	bl	_device_get_softc
	ldr	x8, [x0, #16]
	cbz	x8, LBB0_4
; %bb.1:
	mov	x23, x0
	ldp	w8, w9, [x0]
Lloh0:
	adrp	x10, _OPAL_PCI_SET_XIVE_PE@GOTPAGE
Lloh1:
	ldr	x10, [x10, _OPAL_PCI_SET_XIVE_PE@GOTPAGEOFF]
	add	w8, w8, w9
	sub	w22, w22, w8
Lloh2:
	ldr	w0, [x10]
	ldr	w1, [x23, #8]
Lloh3:
	adrp	x25, _OPAL_PCI_DEFAULT_PE@GOTPAGE
Lloh4:
	ldr	x25, [x25, _OPAL_PCI_DEFAULT_PE@GOTPAGEOFF]
	ldr	w2, [x25]
	mov	x3, x22
	bl	_opal_call
	mov	x0, x19
	bl	_device_get_ivars
	ldr	x8, [x0]
	cmp	x8, #1
	b.lt	LBB0_3
; %bb.2:
	ldr	w8, [x0, #8]
Lloh5:
	adrp	x9, _PCIM_MSICTRL_64BIT@GOTPAGE
Lloh6:
	ldr	x9, [x9, _PCIM_MSICTRL_64BIT@GOTPAGEOFF]
Lloh7:
	ldr	w9, [x9]
	tst	w9, w8
	b.eq	LBB0_5
LBB0_3:
Lloh8:
	adrp	x8, _OPAL_GET_MSI_64@GOTPAGE
Lloh9:
	ldr	x8, [x8, _OPAL_GET_MSI_64@GOTPAGEOFF]
Lloh10:
	ldr	w24, [x8]
	ldr	w23, [x23, #8]
	ldr	w25, [x25]
	mov	x0, x21
	bl	_vtophys
	mov	x26, x0
	mov	x0, x20
	bl	_vtophys
                                        ; kill: def $w0 killed $w0 def $x0
	stp	x26, x0, [sp, #8]
	mov	w8, #1
	str	x8, [sp]
	mov	x0, x24
	mov	x1, x23
	mov	x2, x25
	mov	x3, x22
	bl	_opal_call
	mov	x22, x0
	ldr	w0, [x21]
	bl	_be64toh
	b	LBB0_6
LBB0_4:
Lloh11:
	adrp	x8, _ENODEV@GOTPAGE
Lloh12:
	ldr	x8, [x8, _ENODEV@GOTPAGEOFF]
Lloh13:
	ldr	w0, [x8]
	b	LBB0_10
LBB0_5:
Lloh14:
	adrp	x8, _OPAL_GET_MSI_32@GOTPAGE
Lloh15:
	ldr	x8, [x8, _OPAL_GET_MSI_32@GOTPAGEOFF]
Lloh16:
	ldr	w24, [x8]
	ldr	w23, [x23, #8]
	ldr	w25, [x25]
	add	x0, sp, #28
	bl	_vtophys
	mov	x26, x0
	mov	x0, x20
	bl	_vtophys
                                        ; kill: def $w0 killed $w0 def $x0
	stp	x26, x0, [sp, #8]
	mov	w8, #1
	str	x8, [sp]
	mov	x0, x24
	mov	x1, x23
	mov	x2, x25
	mov	x3, x22
	bl	_opal_call
	mov	x22, x0
	ldr	w0, [sp, #28]
	bl	_be32toh
LBB0_6:
	str	w0, [x21]
	ldr	w0, [x20]
	bl	_be32toh
	str	w0, [x20]
Lloh17:
	adrp	x8, _bootverbose@GOTPAGE
Lloh18:
	ldr	x8, [x8, _bootverbose@GOTPAGEOFF]
Lloh19:
	ldr	x8, [x8]
	cbz	x8, LBB0_9
; %bb.7:
	cbz	w22, LBB0_9
; %bb.8:
Lloh20:
	adrp	x1, l_.str@PAGE
Lloh21:
	add	x1, x1, l_.str@PAGEOFF
	mov	x0, x19
	mov	x2, x22
	bl	_device_printf
LBB0_9:
Lloh22:
	adrp	x8, _ENXIO@GOTPAGE
Lloh23:
	ldr	x8, [x8, _ENXIO@GOTPAGEOFF]
Lloh24:
	ldr	w8, [x8]
	cmp	w22, #0
	csel	w0, wzr, w8, eq
LBB0_10:
	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 AdrpLdrGot	Lloh3, Lloh4
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh5, Lloh6, Lloh7
	.loh AdrpLdrGotLdr	Lloh8, Lloh9, Lloh10
	.loh AdrpLdrGotLdr	Lloh11, Lloh12, Lloh13
	.loh AdrpLdrGotLdr	Lloh14, Lloh15, Lloh16
	.loh AdrpLdrGotLdr	Lloh17, Lloh18, Lloh19
	.loh AdrpAdd	Lloh20, Lloh21
	.loh AdrpLdrGotLdr	Lloh22, Lloh23, Lloh24
	.cfi_endproc
                                        ; -- End function
	.comm	_ENODEV,4,2                     ; @ENODEV
	.comm	_OPAL_PCI_SET_XIVE_PE,4,2       ; @OPAL_PCI_SET_XIVE_PE
	.comm	_OPAL_PCI_DEFAULT_PE,4,2        ; @OPAL_PCI_DEFAULT_PE
	.comm	_PCIM_MSICTRL_64BIT,4,2         ; @PCIM_MSICTRL_64BIT
	.comm	_OPAL_GET_MSI_32,4,2            ; @OPAL_GET_MSI_32
	.comm	_OPAL_GET_MSI_64,4,2            ; @OPAL_GET_MSI_64
	.comm	_bootverbose,8,3                ; @bootverbose
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"OPAL MSI mapping error: %d\n"

	.comm	_ENXIO,4,2                      ; @ENXIO
	.no_dead_strip	_opalpci_map_msi
.subsections_via_symbols
