	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function init_msix_table
_init_msix_table:                       ## @init_msix_table
	.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
	movq	%rdx, -72(%rbp)                 ## 8-byte Spill
	movq	%rsi, %rbx
	movq	%rdi, -64(%rbp)                 ## 8-byte Spill
	movq	16(%rsi), %r12
	movq	%r12, %rdi
	callq	_pci_msix_table_bar
	testq	%rax, %rax
	js	LBB0_1
## %bb.2:
	movq	%r12, %rdi
	callq	_pci_msix_pba_bar
	movq	%rax, %rdi
	shrq	$63, %rdi
	xorl	$1, %edi
	jmp	LBB0_3
LBB0_1:
	xorl	%edi, %edi
LBB0_3:
                                        ## kill: def $edi killed $edi killed $rdi
	callq	_assert
	movl	(%rbx), %eax
	movl	%eax, -44(%rbp)                 ## 4-byte Spill
	movl	4(%rbx), %eax
	movl	%eax, -48(%rbp)                 ## 4-byte Spill
	movl	8(%rbx), %eax
	movl	%eax, -52(%rbp)                 ## 4-byte Spill
	movq	(%r12), %rdi
	movl	$4096, %esi                     ## imm = 0x1000
	callq	_rounddown2
	movq	%rax, %r13
	movq	(%r12), %rax
	subq	%r13, %rax
	movslq	8(%r12), %rcx
	movq	_MSIX_TABLE_ENTRY_SIZE@GOTPCREL(%rip), %rdx
	movslq	(%rdx), %rdi
	imulq	%rcx, %rdi
	addq	%rax, %rdi
	movl	$4096, %esi                     ## imm = 0x1000
	callq	_roundup2
	movq	%rax, %rsi
	movslq	12(%r12), %rax
	movq	56(%r12), %rcx
	movq	%rax, %rdx
	shlq	$4, %rdx
	movq	(%rcx,%rdx), %r15
	movq	8(%rcx,%rdx), %r14
	cmpl	%eax, 16(%r12)
	jne	LBB0_7
## %bb.4:
	movq	24(%r12), %rax
	leaq	(%rsi,%r13), %r9
	cmpq	%r9, %rax
	jge	LBB0_6
## %bb.5:
	movq	32(%r12), %rcx
	addq	%rax, %rcx
	cmpq	%rcx, %r13
	jge	LBB0_6
## %bb.9:
	addq	$-4096, %r9                     ## imm = 0xF000
	cmpq	%r13, %rax
	cmovleq	%r13, %r9
	movq	%r9, 40(%r12)
	movq	_PROT_READ@GOTPCREL(%rip), %rax
	movq	_PROT_WRITE@GOTPCREL(%rip), %rcx
	movl	(%rcx), %edx
	orl	(%rax), %edx
	movq	_MAP_SHARED@GOTPCREL(%rip), %rax
	movl	(%rax), %ecx
	movq	_memfd@GOTPCREL(%rip), %rax
	movl	(%rax), %r8d
	addq	%r15, %r9
	xorl	%edi, %edi
	movq	%rsi, %rbx
	movl	$4096, %esi                     ## imm = 0x1000
	callq	_mmap
	movq	%rbx, %rsi
	movq	%rax, 48(%r12)
	movq	_MAP_FAILED@GOTPCREL(%rip), %rcx
	cmpq	(%rcx), %rax
	jne	LBB0_7
## %bb.10:
	leaq	L_.str(%rip), %rdi
	movl	-44(%rbp), %esi                 ## 4-byte Reload
	movl	-48(%rbp), %edx                 ## 4-byte Reload
	movl	-52(%rbp), %ecx                 ## 4-byte Reload
	callq	_warn
	movl	$-1, %eax
	jmp	LBB0_16
LBB0_6:
	xorps	%xmm0, %xmm0
	movups	%xmm0, 40(%r12)
LBB0_7:
	testq	%r13, %r13
	jle	LBB0_8
## %bb.11:
	movq	-72(%rbp), %rbx                 ## 8-byte Reload
	movq	%rbx, (%rsp)
	movq	-64(%rbp), %rdi                 ## 8-byte Reload
	movq	%rsi, %r12
	movl	-44(%rbp), %esi                 ## 4-byte Reload
	movl	-48(%rbp), %edx                 ## 4-byte Reload
	movl	-52(%rbp), %ecx                 ## 4-byte Reload
	movq	%r15, %r8
	movq	%r13, %r9
	callq	_vm_map_pptdev_mmio
	testl	%eax, %eax
	jne	LBB0_16
## %bb.12:
	movq	%r12, %rsi
	addq	%r13, %rbx
	addq	%r13, %r15
	subq	%r13, %r14
	subq	%rsi, %r14
	jne	LBB0_14
	jmp	LBB0_15
LBB0_8:
	movq	-72(%rbp), %rbx                 ## 8-byte Reload
	subq	%rsi, %r14
	je	LBB0_15
LBB0_14:
	addq	%rsi, %r15
	addq	%rsi, %rbx
	movq	%rbx, (%rsp)
	movq	-64(%rbp), %rdi                 ## 8-byte Reload
	movl	-44(%rbp), %esi                 ## 4-byte Reload
	movl	-48(%rbp), %edx                 ## 4-byte Reload
	movl	-52(%rbp), %ecx                 ## 4-byte Reload
	movq	%r15, %r8
	movq	%r14, %r9
	callq	_vm_map_pptdev_mmio
	testl	%eax, %eax
	jne	LBB0_16
LBB0_15:
	xorl	%eax, %eax
LBB0_16:
	addq	$40, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_MSIX_TABLE_ENTRY_SIZE,4,2      ## @MSIX_TABLE_ENTRY_SIZE
	.comm	_PROT_READ,4,2                  ## @PROT_READ
	.comm	_PROT_WRITE,4,2                 ## @PROT_WRITE
	.comm	_MAP_SHARED,4,2                 ## @MAP_SHARED
	.comm	_memfd,4,2                      ## @memfd
	.comm	_MAP_FAILED,8,3                 ## @MAP_FAILED
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"Failed to map PBA page for MSI-X on %d/%d/%d"

	.no_dead_strip	_init_msix_table
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function init_msix_table
_init_msix_table:                       ; @init_msix_table
	.cfi_startproc
; %bb.0:
	stp	x28, x27, [sp, #-96]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 96
	stp	x26, x25, [sp, #16]             ; 16-byte Folded Spill
	stp	x24, x23, [sp, #32]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #48]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #64]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #80]             ; 16-byte Folded Spill
	add	x29, sp, #80
	.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
	.cfi_offset w27, -88
	.cfi_offset w28, -96
	mov	x20, x2
	mov	x23, x1
	mov	x19, x0
	ldr	x24, [x1, #16]
	mov	x0, x24
	bl	_pci_msix_table_bar
	tbnz	x0, #63, LBB0_2
; %bb.1:
	mov	x0, x24
	bl	_pci_msix_pba_bar
	lsr	x8, x0, #63
	eor	w0, w8, #0x1
	b	LBB0_3
LBB0_2:
	mov	w0, #0
LBB0_3:
	bl	_assert
	ldp	w21, w22, [x23]
	ldr	w23, [x23, #8]
	ldr	x0, [x24]
	mov	w1, #4096
	bl	_rounddown2
	mov	x26, x0
	ldr	x8, [x24]
	sub	x8, x8, x0
	ldrsw	x9, [x24, #8]
Lloh0:
	adrp	x10, _MSIX_TABLE_ENTRY_SIZE@GOTPAGE
Lloh1:
	ldr	x10, [x10, _MSIX_TABLE_ENTRY_SIZE@GOTPAGEOFF]
Lloh2:
	ldrsw	x10, [x10]
	madd	x0, x10, x9, x8
	mov	w1, #4096
	bl	_roundup2
	mov	x25, x0
	ldr	x8, [x24, #56]
	ldp	w9, w10, [x24, #12]
                                        ; kill: def $w9 killed $w9 def $x9
	sxtw	x9, w9
	add	x8, x8, x9, lsl #4
	ldp	x27, x28, [x8]
	cmp	w10, w9
	b.ne	LBB0_9
; %bb.4:
	ldr	x8, [x24, #24]
	add	x9, x25, x26
	cmp	x8, x9
	b.ge	LBB0_8
; %bb.5:
	ldr	x10, [x24, #32]
	add	x10, x10, x8
	cmp	x26, x10
	b.ge	LBB0_8
; %bb.6:
	sub	x9, x9, #1, lsl #12             ; =4096
	cmp	x8, x26
	csel	x8, x9, x26, gt
	str	x8, [x24, #40]
Lloh3:
	adrp	x9, _PROT_READ@GOTPAGE
Lloh4:
	ldr	x9, [x9, _PROT_READ@GOTPAGEOFF]
Lloh5:
	ldr	w9, [x9]
Lloh6:
	adrp	x10, _PROT_WRITE@GOTPAGE
Lloh7:
	ldr	x10, [x10, _PROT_WRITE@GOTPAGEOFF]
Lloh8:
	ldr	w10, [x10]
Lloh9:
	adrp	x11, _MAP_SHARED@GOTPAGE
Lloh10:
	ldr	x11, [x11, _MAP_SHARED@GOTPAGEOFF]
	orr	w2, w10, w9
Lloh11:
	ldr	w3, [x11]
Lloh12:
	adrp	x9, _memfd@GOTPAGE
Lloh13:
	ldr	x9, [x9, _memfd@GOTPAGEOFF]
Lloh14:
	ldr	w4, [x9]
	add	x5, x8, x27
	mov	x0, #0
	mov	w1, #4096
	bl	_mmap
	str	x0, [x24, #48]
Lloh15:
	adrp	x8, _MAP_FAILED@GOTPAGE
Lloh16:
	ldr	x8, [x8, _MAP_FAILED@GOTPAGEOFF]
Lloh17:
	ldr	x8, [x8]
	cmp	x0, x8
	b.ne	LBB0_9
; %bb.7:
Lloh18:
	adrp	x0, l_.str@PAGE
Lloh19:
	add	x0, x0, l_.str@PAGEOFF
	mov	x1, x21
	mov	x2, x22
	mov	x3, x23
	bl	_warn
	mov	w0, #-1
	b	LBB0_15
LBB0_8:
	stp	xzr, xzr, [x24, #40]
LBB0_9:
	cmp	x26, #1
	b.lt	LBB0_12
; %bb.10:
	mov	x0, x19
	mov	x1, x21
	mov	x2, x22
	mov	x3, x23
	mov	x4, x27
	mov	x5, x26
	mov	x6, x20
	bl	_vm_map_pptdev_mmio
	cbnz	w0, LBB0_15
; %bb.11:
	add	x20, x26, x20
	add	x27, x27, x26
	sub	x28, x28, x26
LBB0_12:
	subs	x5, x28, x25
	b.eq	LBB0_14
; %bb.13:
	add	x4, x27, x25
	add	x6, x20, x25
	mov	x0, x19
	mov	x1, x21
	mov	x2, x22
	mov	x3, x23
	bl	_vm_map_pptdev_mmio
	cbnz	w0, LBB0_15
LBB0_14:
	mov	w0, #0
LBB0_15:
	ldp	x29, x30, [sp, #80]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #64]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #48]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #32]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp, #16]             ; 16-byte Folded Reload
	ldp	x28, x27, [sp], #96             ; 16-byte Folded Reload
	ret
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh15, Lloh16, Lloh17
	.loh AdrpLdrGotLdr	Lloh12, Lloh13, Lloh14
	.loh AdrpLdrGotLdr	Lloh9, Lloh10, Lloh11
	.loh AdrpLdrGotLdr	Lloh6, Lloh7, Lloh8
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpAdd	Lloh18, Lloh19
	.cfi_endproc
                                        ; -- End function
	.comm	_MSIX_TABLE_ENTRY_SIZE,4,2      ; @MSIX_TABLE_ENTRY_SIZE
	.comm	_PROT_READ,4,2                  ; @PROT_READ
	.comm	_PROT_WRITE,4,2                 ; @PROT_WRITE
	.comm	_MAP_SHARED,4,2                 ; @MAP_SHARED
	.comm	_memfd,4,2                      ; @memfd
	.comm	_MAP_FAILED,8,3                 ; @MAP_FAILED
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"Failed to map PBA page for MSI-X on %d/%d/%d"

	.no_dead_strip	_init_msix_table
.subsections_via_symbols
