	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function al_msix_alloc_msi
_al_msix_alloc_msi:                     ## @al_msix_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
	subq	$56, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%r9, %r12
	movq	%r8, %r14
	movl	%edx, %ebx
	movl	%edi, %r13d
	callq	_device_get_softc
	movq	%rax, %r15
	movl	%ebx, %edi
	callq	_powerof2
	cmpl	$8, %ebx
	jg	LBB0_2
## %bb.1:
	testq	%rax, %rax
	je	LBB0_2
## %bb.3:
	movl	32(%r15), %edi
	movq	_M_FIRSTFIT@GOTPCREL(%rip), %rax
	movq	_M_NOWAIT@GOTPCREL(%rip), %rcx
	movl	(%rcx), %edx
	orl	(%rax), %edx
	leaq	-48(%rbp), %rcx
	movl	%ebx, %esi
	callq	_vmem_alloc
	testq	%rax, %rax
	je	LBB0_5
## %bb.4:
	movq	_ENOMEM@GOTPCREL(%rip), %rax
	movl	(%rax), %r13d
	jmp	LBB0_19
LBB0_2:
	movq	_EINVAL@GOTPCREL(%rip), %rax
	movl	(%rax), %r13d
	jmp	LBB0_19
LBB0_5:
	movl	%r13d, -68(%rbp)                ## 4-byte Spill
	movq	%r14, -88(%rbp)                 ## 8-byte Spill
	movq	_GIC_INTR_CELL_CNT@GOTPCREL(%rip), %r14
	movl	(%r14), %eax
	leal	32(,%rax,4), %edi
	movq	_M_AL_MSIX@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	_M_WAITOK@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	callq	_malloc
	movq	_INTR_MAP_DATA_FDT@GOTPCREL(%rip), %rcx
	movl	(%rcx), %ecx
	movl	%ecx, 24(%rax)
	movq	$0, 16(%rax)
	movl	(%r14), %ecx
	movl	%ecx, (%rax)
	movq	_AL_SPI_INTR@GOTPCREL(%rip), %rcx
	movq	(%rcx), %rdx
	movq	%rax, -64(%rbp)                 ## 8-byte Spill
	movq	8(%rax), %rcx
	movq	%rdx, (%rcx)
	movq	$0, 8(%rcx)
	movq	_AL_EDGE_HIGH@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	movq	%rax, 16(%rcx)
	movq	%r15, %rdi
	addq	$16, %rdi
	movq	%rdi, -80(%rbp)                 ## 8-byte Spill
	callq	_mtx_lock
	movq	-48(%rbp), %r14
	movl	%ebx, -52(%rbp)                 ## 4-byte Spill
	movslq	%ebx, %rbx
	leaq	(%r14,%rbx), %rax
	cmpq	%rax, %r14
	jae	LBB0_16
	.p2align	4, 0x90
LBB0_7:                                 ## =>This Inner Loop Header: Depth=1
	movq	8(%r15), %rax
	addq	%r14, %rax
	movq	-64(%rbp), %rsi                 ## 8-byte Reload
	movq	8(%rsi), %rcx
	movq	%rax, 8(%rcx)
	movl	(%r15), %edi
	movq	%r12, %rdx
	callq	_PIC_MAP_INTR
	testl	%eax, %eax
	jne	LBB0_8
## %bb.15:                              ##   in Loop: Header=BB0_7 Depth=1
	movq	(%r12), %rax
	movq	24(%r15), %rcx
	movq	%rax, (%rcx,%r14,8)
	addq	$8, %r12
	incq	%r14
	movq	-48(%rbp), %rax
	addq	%rbx, %rax
	cmpq	%rax, %r14
	jb	LBB0_7
LBB0_16:
	movq	-80(%rbp), %rdi                 ## 8-byte Reload
	callq	_mtx_unlock
	movq	_M_AL_MSIX@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	-64(%rbp), %rdi                 ## 8-byte Reload
	callq	_free
	movq	_bootverbose@GOTPCREL(%rip), %rax
	cmpq	$0, (%rax)
	je	LBB0_18
## %bb.17:
	movslq	-48(%rbp), %rdx
	addq	8(%r15), %rdx
	leaq	L_.str(%rip), %rsi
	movl	-68(%rbp), %edi                 ## 4-byte Reload
	movl	-52(%rbp), %ecx                 ## 4-byte Reload
	callq	_device_printf
LBB0_18:
	movl	(%r15), %eax
	movq	-88(%rbp), %rcx                 ## 8-byte Reload
	movl	%eax, (%rcx)
	xorl	%r13d, %r13d
	jmp	LBB0_19
LBB0_8:
	movl	%eax, %r13d
	movq	-48(%rbp), %rax
	movq	%r14, %rdx
	subq	%rax, %rdx
	movl	-52(%rbp), %ebx                 ## 4-byte Reload
	jbe	LBB0_14
## %bb.9:
	leaq	-1(%rdx), %rcx
	testb	$3, %dl
	je	LBB0_12
## %bb.10:
	movl	%r14d, %edx
	subb	%al, %dl
	movzbl	%dl, %edx
	andl	$3, %edx
	.p2align	4, 0x90
LBB0_11:                                ## =>This Inner Loop Header: Depth=1
	movq	24(%r15), %rsi
	movq	$0, (%rsi,%rax,8)
	incq	%rax
	decq	%rdx
	jne	LBB0_11
LBB0_12:
	cmpq	$3, %rcx
	jb	LBB0_14
	.p2align	4, 0x90
LBB0_13:                                ## =>This Inner Loop Header: Depth=1
	movq	24(%r15), %rcx
	movq	$0, (%rcx,%rax,8)
	movq	24(%r15), %rcx
	movq	$0, 8(%rcx,%rax,8)
	movq	24(%r15), %rcx
	movq	$0, 16(%rcx,%rax,8)
	movq	24(%r15), %rcx
	movq	$0, 24(%rcx,%rax,8)
	addq	$4, %rax
	cmpq	%rax, %r14
	jne	LBB0_13
LBB0_14:
	movq	-80(%rbp), %rdi                 ## 8-byte Reload
	callq	_mtx_unlock
	movl	32(%r15), %edi
	movq	-48(%rbp), %rsi
	movl	%ebx, %edx
	callq	_vmem_free
	movq	_M_AL_MSIX@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	-64(%rbp), %rdi                 ## 8-byte Reload
	callq	_free
LBB0_19:
	movl	%r13d, %eax
	addq	$56, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_EINVAL,4,2                     ## @EINVAL
	.comm	_M_FIRSTFIT,4,2                 ## @M_FIRSTFIT
	.comm	_M_NOWAIT,4,2                   ## @M_NOWAIT
	.comm	_ENOMEM,4,2                     ## @ENOMEM
	.comm	_GIC_INTR_CELL_CNT,4,2          ## @GIC_INTR_CELL_CNT
	.comm	_M_AL_MSIX,4,2                  ## @M_AL_MSIX
	.comm	_M_WAITOK,4,2                   ## @M_WAITOK
	.comm	_INTR_MAP_DATA_FDT,4,2          ## @INTR_MAP_DATA_FDT
	.comm	_AL_SPI_INTR,8,3                ## @AL_SPI_INTR
	.comm	_AL_EDGE_HIGH,8,3               ## @AL_EDGE_HIGH
	.comm	_bootverbose,8,3                ## @bootverbose
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"MSI-X allocation: start SPI %d, count %d\n"

	.no_dead_strip	_al_msix_alloc_msi
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function al_msix_alloc_msi
_al_msix_alloc_msi:                     ; @al_msix_alloc_msi
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #112
	.cfi_def_cfa_offset 112
	stp	x28, x27, [sp, #16]             ; 16-byte Folded Spill
	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
	.cfi_offset w27, -88
	.cfi_offset w28, -96
	mov	x23, x5
	mov	x21, x4
	mov	x19, x2
	mov	x22, x0
	bl	_device_get_softc
	mov	x20, x0
	mov	x0, x19
	bl	_powerof2
	cmp	w19, #8
	b.gt	LBB0_4
; %bb.1:
	cbz	x0, LBB0_4
; %bb.2:
Lloh0:
	adrp	x8, _M_FIRSTFIT@GOTPAGE
Lloh1:
	ldr	x8, [x8, _M_FIRSTFIT@GOTPAGEOFF]
	ldr	w0, [x20, #32]
Lloh2:
	ldr	w8, [x8]
Lloh3:
	adrp	x9, _M_NOWAIT@GOTPAGE
Lloh4:
	ldr	x9, [x9, _M_NOWAIT@GOTPAGEOFF]
Lloh5:
	ldr	w9, [x9]
	orr	w2, w9, w8
	add	x3, sp, #8
	mov	x1, x19
	bl	_vmem_alloc
	cbz	x0, LBB0_5
; %bb.3:
Lloh6:
	adrp	x8, _ENOMEM@GOTPAGE
Lloh7:
	ldr	x8, [x8, _ENOMEM@GOTPAGEOFF]
Lloh8:
	ldr	w26, [x8]
	b	LBB0_14
LBB0_4:
Lloh9:
	adrp	x8, _EINVAL@GOTPAGE
Lloh10:
	ldr	x8, [x8, _EINVAL@GOTPAGEOFF]
Lloh11:
	ldr	w26, [x8]
	b	LBB0_14
LBB0_5:
Lloh12:
	adrp	x25, _GIC_INTR_CELL_CNT@GOTPAGE
Lloh13:
	ldr	x25, [x25, _GIC_INTR_CELL_CNT@GOTPAGEOFF]
	ldr	w8, [x25]
	lsl	w8, w8, #2
	add	w0, w8, #32
Lloh14:
	adrp	x8, _M_AL_MSIX@GOTPAGE
Lloh15:
	ldr	x8, [x8, _M_AL_MSIX@GOTPAGEOFF]
Lloh16:
	ldr	w1, [x8]
Lloh17:
	adrp	x8, _M_WAITOK@GOTPAGE
Lloh18:
	ldr	x8, [x8, _M_WAITOK@GOTPAGEOFF]
Lloh19:
	ldr	w2, [x8]
	bl	_malloc
	mov	x24, x0
Lloh20:
	adrp	x8, _INTR_MAP_DATA_FDT@GOTPAGE
Lloh21:
	ldr	x8, [x8, _INTR_MAP_DATA_FDT@GOTPAGEOFF]
Lloh22:
	ldr	w8, [x8]
	str	w8, [x0, #24]
	str	xzr, [x0, #16]
	ldr	w8, [x25]
	str	w8, [x0]
Lloh23:
	adrp	x8, _AL_SPI_INTR@GOTPAGE
Lloh24:
	ldr	x8, [x8, _AL_SPI_INTR@GOTPAGEOFF]
Lloh25:
	ldr	x8, [x8]
	ldr	x9, [x0, #8]
	stp	x8, xzr, [x9]
Lloh26:
	adrp	x8, _AL_EDGE_HIGH@GOTPAGE
Lloh27:
	ldr	x8, [x8, _AL_EDGE_HIGH@GOTPAGEOFF]
Lloh28:
	ldr	x8, [x8]
	str	x8, [x9, #16]
	add	x25, x20, #16
	mov	x0, x25
	bl	_mtx_lock
	ldr	x28, [sp, #8]
	sxtw	x27, w19
	add	x8, x28, x27
	cmp	x28, x8
	b.hs	LBB0_8
LBB0_6:                                 ; =>This Inner Loop Header: Depth=1
	ldr	x8, [x20, #8]
	add	x8, x28, x8
	ldr	x9, [x24, #8]
	str	x8, [x9, #8]
	ldr	w0, [x20]
	mov	x1, x24
	mov	x2, x23
	bl	_PIC_MAP_INTR
	cbnz	w0, LBB0_11
; %bb.7:                                ;   in Loop: Header=BB0_6 Depth=1
	ldr	x8, [x23], #8
	ldr	x9, [x20, #24]
	str	x8, [x9, x28, lsl #3]
	add	x28, x28, #1
	ldr	x8, [sp, #8]
	add	x8, x8, x27
	cmp	x28, x8
	b.lo	LBB0_6
LBB0_8:
	mov	x0, x25
	bl	_mtx_unlock
Lloh29:
	adrp	x8, _M_AL_MSIX@GOTPAGE
Lloh30:
	ldr	x8, [x8, _M_AL_MSIX@GOTPAGEOFF]
Lloh31:
	ldr	w1, [x8]
	mov	x0, x24
	bl	_free
Lloh32:
	adrp	x8, _bootverbose@GOTPAGE
Lloh33:
	ldr	x8, [x8, _bootverbose@GOTPAGEOFF]
Lloh34:
	ldr	x8, [x8]
	cbz	x8, LBB0_10
; %bb.9:
	ldrsw	x8, [sp, #8]
	ldr	x9, [x20, #8]
	add	x2, x8, x9
Lloh35:
	adrp	x1, l_.str@PAGE
Lloh36:
	add	x1, x1, l_.str@PAGEOFF
	mov	x0, x22
	mov	x3, x19
	bl	_device_printf
LBB0_10:
	mov	w26, #0
	ldr	w8, [x20]
	str	w8, [x21]
	b	LBB0_14
LBB0_11:
	mov	x26, x0
	ldr	x8, [sp, #8]
	cmp	x8, x28
	b.hs	LBB0_13
LBB0_12:                                ; =>This Inner Loop Header: Depth=1
	ldr	x9, [x20, #24]
	str	xzr, [x9, x8, lsl #3]
	add	x8, x8, #1
	cmp	x28, x8
	b.ne	LBB0_12
LBB0_13:
	mov	x0, x25
	bl	_mtx_unlock
	ldr	w0, [x20, #32]
	ldr	x1, [sp, #8]
	mov	x2, x19
	bl	_vmem_free
Lloh37:
	adrp	x8, _M_AL_MSIX@GOTPAGE
Lloh38:
	ldr	x8, [x8, _M_AL_MSIX@GOTPAGEOFF]
Lloh39:
	ldr	w1, [x8]
	mov	x0, x24
	bl	_free
LBB0_14:
	mov	x0, x26
	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
	ldp	x28, x27, [sp, #16]             ; 16-byte Folded Reload
	add	sp, sp, #112
	ret
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh6, Lloh7, Lloh8
	.loh AdrpLdrGotLdr	Lloh9, Lloh10, Lloh11
	.loh AdrpLdrGotLdr	Lloh26, Lloh27, Lloh28
	.loh AdrpLdrGotLdr	Lloh23, Lloh24, Lloh25
	.loh AdrpLdrGotLdr	Lloh20, Lloh21, Lloh22
	.loh AdrpLdrGotLdr	Lloh17, Lloh18, Lloh19
	.loh AdrpLdrGotLdr	Lloh14, Lloh15, Lloh16
	.loh AdrpLdrGot	Lloh12, Lloh13
	.loh AdrpLdrGotLdr	Lloh32, Lloh33, Lloh34
	.loh AdrpLdrGotLdr	Lloh29, Lloh30, Lloh31
	.loh AdrpAdd	Lloh35, Lloh36
	.loh AdrpLdrGotLdr	Lloh37, Lloh38, Lloh39
	.cfi_endproc
                                        ; -- End function
	.comm	_EINVAL,4,2                     ; @EINVAL
	.comm	_M_FIRSTFIT,4,2                 ; @M_FIRSTFIT
	.comm	_M_NOWAIT,4,2                   ; @M_NOWAIT
	.comm	_ENOMEM,4,2                     ; @ENOMEM
	.comm	_GIC_INTR_CELL_CNT,4,2          ; @GIC_INTR_CELL_CNT
	.comm	_M_AL_MSIX,4,2                  ; @M_AL_MSIX
	.comm	_M_WAITOK,4,2                   ; @M_WAITOK
	.comm	_INTR_MAP_DATA_FDT,4,2          ; @INTR_MAP_DATA_FDT
	.comm	_AL_SPI_INTR,8,3                ; @AL_SPI_INTR
	.comm	_AL_EDGE_HIGH,8,3               ; @AL_EDGE_HIGH
	.comm	_bootverbose,8,3                ; @bootverbose
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"MSI-X allocation: start SPI %d, count %d\n"

	.no_dead_strip	_al_msix_alloc_msi
.subsections_via_symbols
