	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_pci_emul_add_msixcap           ## -- Begin function pci_emul_add_msixcap
	.p2align	4, 0x90
_pci_emul_add_msixcap:                  ## @pci_emul_add_msixcap
	.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, %r15d
	testl	%esi, %esi
	setg	%al
	movq	_MAX_MSIX_TABLE_ENTRIES@GOTPCREL(%rip), %rcx
	cmpl	%esi, (%rcx)
	movl	%edx, %r14d
	movq	%rdi, %rbx
	setge	%cl
	andb	%al, %cl
	movzbl	%cl, %edi
	callq	_assert
	testl	%r14d, %r14d
	setns	%al
	movq	_PCIR_MAX_BAR_0@GOTPCREL(%rip), %rcx
	cmpl	%r14d, (%rcx)
	setge	%cl
	andb	%al, %cl
	movzbl	%cl, %edi
	callq	_assert
	movq	_MSIX_TABLE_ENTRY_SIZE@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	imull	%r15d, %edi
	movl	$4096, %esi                     ## imm = 0x1000
	callq	_roundup2
	movl	%eax, %r12d
	movl	%r14d, (%rbx)
	movl	%r14d, 4(%rbx)
	movq	$0, 24(%rbx)
	movl	%r15d, 8(%rbx)
	movl	%eax, 12(%rbx)
	movl	%r15d, %edi
	callq	_PBA_SIZE
	movq	%rax, 16(%rbx)
	movq	%rbx, %rdi
	movl	%r15d, %esi
	callq	_pci_msix_table_init
	leaq	-48(%rbp), %r13
	movq	%r13, %rdi
	movl	%r15d, %esi
	movl	%r14d, %edx
	movl	%r12d, %ecx
	callq	_pci_populate_msixcap
	movq	_PCIBAR_MEM32@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	movslq	%r12d, %rcx
	addq	16(%rbx), %rcx
	movq	%rbx, %rdi
	movl	%r14d, %esi
	callq	_pci_emul_alloc_bar
	movq	%rbx, %rdi
	movq	%r13, %rsi
	movl	$4, %edx
	callq	_pci_emul_add_capability
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_MAX_MSIX_TABLE_ENTRIES,4,2     ## @MAX_MSIX_TABLE_ENTRIES
	.comm	_PCIR_MAX_BAR_0,4,2             ## @PCIR_MAX_BAR_0
	.comm	_MSIX_TABLE_ENTRY_SIZE,4,2      ## @MSIX_TABLE_ENTRY_SIZE
	.comm	_PCIBAR_MEM32,4,2               ## @PCIBAR_MEM32
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_pci_emul_add_msixcap           ; -- Begin function pci_emul_add_msixcap
	.p2align	2
_pci_emul_add_msixcap:                  ; @pci_emul_add_msixcap
	.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	x20, x2
	mov	x21, x1
	mov	x19, x0
	cmp	w1, #0
Lloh0:
	adrp	x8, _MAX_MSIX_TABLE_ENTRIES@GOTPAGE
Lloh1:
	ldr	x8, [x8, _MAX_MSIX_TABLE_ENTRIES@GOTPAGEOFF]
Lloh2:
	ldr	w8, [x8]
	ccmp	w8, w1, #8, gt
	cset	w0, ge
	bl	_assert
	cmp	w20, #0
Lloh3:
	adrp	x8, _PCIR_MAX_BAR_0@GOTPAGE
Lloh4:
	ldr	x8, [x8, _PCIR_MAX_BAR_0@GOTPAGEOFF]
Lloh5:
	ldr	w8, [x8]
	ccmp	w8, w20, #8, ge
	cset	w0, ge
	bl	_assert
Lloh6:
	adrp	x8, _MSIX_TABLE_ENTRY_SIZE@GOTPAGE
Lloh7:
	ldr	x8, [x8, _MSIX_TABLE_ENTRY_SIZE@GOTPAGEOFF]
Lloh8:
	ldr	w8, [x8]
	mul	w0, w8, w21
	mov	w1, #4096
	bl	_roundup2
	mov	x22, x0
	stp	w20, w20, [x19]
	str	xzr, [x19, #24]
	stp	w21, w0, [x19, #8]
	mov	x0, x21
	bl	_PBA_SIZE
	str	x0, [x19, #16]
	mov	x0, x19
	mov	x1, x21
	bl	_pci_msix_table_init
	add	x0, sp, #8
	mov	x1, x21
	mov	x2, x20
	mov	x3, x22
	bl	_pci_populate_msixcap
Lloh9:
	adrp	x8, _PCIBAR_MEM32@GOTPAGE
Lloh10:
	ldr	x8, [x8, _PCIBAR_MEM32@GOTPAGEOFF]
Lloh11:
	ldr	w2, [x8]
	ldr	x8, [x19, #16]
	add	x3, x8, w22, sxtw
	mov	x0, x19
	mov	x1, x20
	bl	_pci_emul_alloc_bar
	add	x1, sp, #8
	mov	x0, x19
	mov	w2, #4
	bl	_pci_emul_add_capability
	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	Lloh6, Lloh7, Lloh8
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.cfi_endproc
                                        ; -- End function
	.comm	_MAX_MSIX_TABLE_ENTRIES,4,2     ; @MAX_MSIX_TABLE_ENTRIES
	.comm	_PCIR_MAX_BAR_0,4,2             ; @PCIR_MAX_BAR_0
	.comm	_MSIX_TABLE_ENTRY_SIZE,4,2      ; @MSIX_TABLE_ENTRY_SIZE
	.comm	_PCIBAR_MEM32,4,2               ; @PCIBAR_MEM32
.subsections_via_symbols
