	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function mbi_irq_domain_alloc
_mbi_irq_domain_alloc:                  ## @mbi_irq_domain_alloc
	.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	%rcx, -56(%rbp)                 ## 8-byte Spill
	movl	%edx, -44(%rbp)                 ## 4-byte Spill
                                        ## kill: def $esi killed $esi def $rsi
	movq	%rsi, -72(%rbp)                 ## 8-byte Spill
	movq	%rdi, -64(%rbp)                 ## 8-byte Spill
	movq	_mbi_lock@GOTPCREL(%rip), %rdi
	callq	_mutex_lock
	movq	_mbi_range_nr@GOTPCREL(%rip), %rax
	cmpl	$0, (%rax)
	jle	LBB0_4
## %bb.1:
	xorl	%ebx, %ebx
	movq	_mbi_ranges@GOTPCREL(%rip), %r14
	xorl	%r13d, %r13d
	.p2align	4, 0x90
LBB0_2:                                 ## =>This Inner Loop Header: Depth=1
	movq	(%r14), %rax
	movl	4(%rax,%rbx), %r15d
	movl	8(%rax,%rbx), %r12d
	movl	-44(%rbp), %edi                 ## 4-byte Reload
	callq	_get_count_order
	movl	%r12d, %edi
	movl	%r15d, %esi
	movl	%eax, %edx
	callq	_bitmap_find_free_region
	testl	%eax, %eax
	jns	LBB0_5
## %bb.3:                               ##   in Loop: Header=BB0_2 Depth=1
	incq	%r13
	movq	_mbi_range_nr@GOTPCREL(%rip), %rax
	movslq	(%rax), %rax
	addq	$12, %rbx
	cmpq	%rax, %r13
	jl	LBB0_2
LBB0_4:
	movq	_mbi_lock@GOTPCREL(%rip), %rdi
	callq	_mutex_unlock
LBB0_6:
	movq	_ENOSPC@GOTPCREL(%rip), %rax
	xorl	%r14d, %r14d
	subl	(%rax), %r14d
LBB0_14:
	movl	%r14d, %eax
	addq	$40, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_5:
	movl	%eax, %r12d
	movq	(%r14), %r15
	movq	_mbi_lock@GOTPCREL(%rip), %rdi
	callq	_mutex_unlock
	testq	%r15, %r15
	je	LBB0_6
## %bb.7:
	addl	(%r15,%rbx), %r12d
	movq	-56(%rbp), %rax                 ## 8-byte Reload
	movl	(%rax), %edi
	movq	_mbi_phys_base@GOTPCREL(%rip), %rax
	movq	_GICD_SETSPI_NSR@GOTPCREL(%rip), %rcx
	movq	(%rcx), %rsi
	addq	(%rax), %rsi
	callq	_iommu_dma_prepare_msi
	movl	%eax, %r14d
	testl	%eax, %eax
	jne	LBB0_14
## %bb.8:
	cmpl	$0, -44(%rbp)                   ## 4-byte Folded Reload
	je	LBB0_9
## %bb.10:
	addq	%rbx, %r15
	xorl	%ebx, %ebx
	movq	%r15, -56(%rbp)                 ## 8-byte Spill
	.p2align	4, 0x90
LBB0_11:                                ## =>This Inner Loop Header: Depth=1
	movq	-72(%rbp), %rax                 ## 8-byte Reload
	leal	(%rax,%rbx), %r13d
	leal	(%r12,%rbx), %r15d
	movq	-64(%rbp), %rdi                 ## 8-byte Reload
	movl	%r13d, %esi
	movl	%r15d, %edx
	callq	_mbi_irq_gic_domain_alloc
	testl	%eax, %eax
	jne	LBB0_13
## %bb.12:                              ##   in Loop: Header=BB0_11 Depth=1
	movq	-64(%rbp), %rdi                 ## 8-byte Reload
	movl	%r13d, %esi
	movl	%r15d, %edx
	movq	_mbi_irq_chip@GOTPCREL(%rip), %rcx
	movq	-56(%rbp), %r8                  ## 8-byte Reload
	callq	_irq_domain_set_hwirq_and_chip
	incl	%ebx
	xorl	%r14d, %r14d
	cmpl	%ebx, -44(%rbp)                 ## 4-byte Folded Reload
	jne	LBB0_11
	jmp	LBB0_14
LBB0_9:
	xorl	%r14d, %r14d
	jmp	LBB0_14
LBB0_13:
	movl	%eax, %r14d
	movq	-64(%rbp), %rdi                 ## 8-byte Reload
	movq	-72(%rbp), %rsi                 ## 8-byte Reload
                                        ## kill: def $esi killed $esi killed $rsi
	movl	-44(%rbp), %ebx                 ## 4-byte Reload
	movl	%ebx, %edx
	callq	_irq_domain_free_irqs_parent
	movq	-56(%rbp), %rdi                 ## 8-byte Reload
	movl	%r12d, %esi
	movl	%ebx, %edx
	callq	_mbi_free_msi
	jmp	LBB0_14
	.cfi_endproc
                                        ## -- End function
	.comm	_mbi_lock,4,2                   ## @mbi_lock
	.comm	_mbi_range_nr,4,2               ## @mbi_range_nr
	.comm	_mbi_ranges,8,3                 ## @mbi_ranges
	.comm	_ENOSPC,4,2                     ## @ENOSPC
	.comm	_mbi_phys_base,8,3              ## @mbi_phys_base
	.comm	_GICD_SETSPI_NSR,8,3            ## @GICD_SETSPI_NSR
	.comm	_mbi_irq_chip,4,2               ## @mbi_irq_chip
	.no_dead_strip	_mbi_irq_domain_alloc
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function mbi_irq_domain_alloc
_mbi_irq_domain_alloc:                  ; @mbi_irq_domain_alloc
	.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	x22, x3
	mov	x19, x2
	mov	x20, x1
	mov	x21, x0
Lloh0:
	adrp	x0, _mbi_lock@GOTPAGE
Lloh1:
	ldr	x0, [x0, _mbi_lock@GOTPAGEOFF]
	bl	_mutex_lock
Lloh2:
	adrp	x26, _mbi_range_nr@GOTPAGE
Lloh3:
	ldr	x26, [x26, _mbi_range_nr@GOTPAGEOFF]
	ldr	w8, [x26]
	cmp	w8, #1
	b.lt	LBB0_4
; %bb.1:
	mov	x25, #0
	mov	x27, #0
Lloh4:
	adrp	x28, _mbi_ranges@GOTPAGE
Lloh5:
	ldr	x28, [x28, _mbi_ranges@GOTPAGEOFF]
LBB0_2:                                 ; =>This Inner Loop Header: Depth=1
	ldr	x8, [x28]
	add	x8, x8, x25
	ldp	w24, w23, [x8, #4]
	mov	x0, x19
	bl	_get_count_order
	mov	x2, x0
	mov	x0, x23
	mov	x1, x24
	bl	_bitmap_find_free_region
	tbz	w0, #31, LBB0_7
; %bb.3:                                ;   in Loop: Header=BB0_2 Depth=1
	add	x27, x27, #1
	ldrsw	x8, [x26]
	add	x25, x25, #12
	cmp	x27, x8
	b.lt	LBB0_2
LBB0_4:
Lloh6:
	adrp	x0, _mbi_lock@GOTPAGE
Lloh7:
	ldr	x0, [x0, _mbi_lock@GOTPAGEOFF]
	bl	_mutex_unlock
LBB0_5:
Lloh8:
	adrp	x8, _ENOSPC@GOTPAGE
Lloh9:
	ldr	x8, [x8, _ENOSPC@GOTPAGEOFF]
Lloh10:
	ldr	w8, [x8]
	neg	w24, w8
LBB0_6:
	mov	x0, x24
	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
LBB0_7:
	mov	x23, x0
	ldr	x26, [x28]
Lloh11:
	adrp	x0, _mbi_lock@GOTPAGE
Lloh12:
	ldr	x0, [x0, _mbi_lock@GOTPAGEOFF]
	bl	_mutex_unlock
	cbz	x26, LBB0_5
; %bb.8:
	ldr	w27, [x26, x25]
Lloh13:
	adrp	x8, _mbi_phys_base@GOTPAGE
Lloh14:
	ldr	x8, [x8, _mbi_phys_base@GOTPAGEOFF]
	ldr	w0, [x22]
Lloh15:
	ldr	x8, [x8]
Lloh16:
	adrp	x9, _GICD_SETSPI_NSR@GOTPAGE
Lloh17:
	ldr	x9, [x9, _GICD_SETSPI_NSR@GOTPAGEOFF]
Lloh18:
	ldr	x9, [x9]
	add	x1, x9, x8
	bl	_iommu_dma_prepare_msi
	mov	x24, x0
	cbnz	w0, LBB0_6
; %bb.9:
	cbz	w19, LBB0_13
; %bb.10:
	mov	w28, #0
	add	x22, x26, x25
	add	w23, w27, w23
Lloh19:
	adrp	x25, _mbi_irq_chip@GOTPAGE
Lloh20:
	ldr	x25, [x25, _mbi_irq_chip@GOTPAGEOFF]
LBB0_11:                                ; =>This Inner Loop Header: Depth=1
	add	w26, w20, w28
	add	w27, w23, w28
	mov	x0, x21
	mov	x1, x26
	mov	x2, x27
	bl	_mbi_irq_gic_domain_alloc
	mov	x24, x0
	cbnz	w0, LBB0_14
; %bb.12:                               ;   in Loop: Header=BB0_11 Depth=1
	mov	x0, x21
	mov	x1, x26
	mov	x2, x27
	mov	x3, x25
	mov	x4, x22
	bl	_irq_domain_set_hwirq_and_chip
	add	w28, w28, #1
	cmp	w19, w28
	b.ne	LBB0_11
	b	LBB0_6
LBB0_13:
	mov	w24, #0
	b	LBB0_6
LBB0_14:
	mov	x0, x21
	mov	x1, x20
	mov	x2, x19
	bl	_irq_domain_free_irqs_parent
	mov	x0, x22
	mov	x1, x23
	mov	x2, x19
	bl	_mbi_free_msi
	b	LBB0_6
	.loh AdrpLdrGot	Lloh2, Lloh3
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpLdrGot	Lloh4, Lloh5
	.loh AdrpLdrGot	Lloh6, Lloh7
	.loh AdrpLdrGotLdr	Lloh8, Lloh9, Lloh10
	.loh AdrpLdrGot	Lloh11, Lloh12
	.loh AdrpLdrGotLdr	Lloh16, Lloh17, Lloh18
	.loh AdrpLdrGotLdr	Lloh13, Lloh14, Lloh15
	.loh AdrpLdrGot	Lloh19, Lloh20
	.cfi_endproc
                                        ; -- End function
	.comm	_mbi_lock,4,2                   ; @mbi_lock
	.comm	_mbi_range_nr,4,2               ; @mbi_range_nr
	.comm	_mbi_ranges,8,3                 ; @mbi_ranges
	.comm	_ENOSPC,4,2                     ; @ENOSPC
	.comm	_mbi_phys_base,8,3              ; @mbi_phys_base
	.comm	_GICD_SETSPI_NSR,8,3            ; @GICD_SETSPI_NSR
	.comm	_mbi_irq_chip,4,2               ; @mbi_irq_chip
	.no_dead_strip	_mbi_irq_domain_alloc
.subsections_via_symbols
