	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function alloc_irte
_alloc_irte:                            ## @alloc_irte
	.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	$-1, %r14d
	testq	%rsi, %rsi
	je	LBB0_10
## %bb.1:
	testl	%edx, %edx
	je	LBB0_10
## %bb.2:
	movq	%rsi, %rbx
	movq	%rdi, %r15
	movq	8(%rdi), %r13
	cmpl	$1, %edx
	jle	LBB0_3
## %bb.6:
	movl	%edx, %edi
	callq	___roundup_pow_of_two
	movl	%eax, %edi
	callq	_ilog2
	movl	%eax, %r12d
	movl	4(%r15), %edi
	callq	_ecap_max_handle_mask
	cmpl	%eax, %r12d
	jbe	LBB0_4
## %bb.7:
	movl	4(%r15), %edi
	callq	_ecap_max_handle_mask
	leaq	L_.str(%rip), %rdi
	movl	%r12d, %esi
	movl	%eax, %edx
	callq	_pr_err
	jmp	LBB0_10
LBB0_3:
	movl	4(%r15), %edi
	callq	_ecap_max_handle_mask
	xorl	%r12d, %r12d
LBB0_4:
	movq	_irq_2_ir_lock@GOTPCREL(%rip), %rdi
	callq	_raw_spin_lock_irqsave
	movl	(%r13), %edi
	movq	_INTR_REMAP_TABLE_ENTRIES@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movl	%r12d, %edx
	callq	_bitmap_find_free_region
	movl	%eax, %r14d
	testl	%eax, %eax
	js	LBB0_5
## %bb.8:
	movq	%r15, 24(%rbx)
	movl	%r14d, (%rbx)
	movq	$0, 16(%rbx)
	movl	%r12d, 4(%rbx)
	movq	_IRQ_REMAPPING@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movl	%eax, 8(%rbx)
	jmp	LBB0_9
LBB0_5:
	movl	(%r15), %esi
	leaq	L_.str.1(%rip), %rdi
	callq	_pr_warn
LBB0_9:
	movq	_irq_2_ir_lock@GOTPCREL(%rip), %rdi
	callq	_raw_spin_unlock_irqrestore
LBB0_10:
	movl	%r14d, %eax
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"Requested mask %x exceeds the max invalidation handle mask value %Lx\n"

	.comm	_irq_2_ir_lock,4,2              ## @irq_2_ir_lock
	.comm	_INTR_REMAP_TABLE_ENTRIES,4,2   ## @INTR_REMAP_TABLE_ENTRIES
L_.str.1:                               ## @.str.1
	.asciz	"IR%d: can't allocate an IRTE\n"

	.comm	_IRQ_REMAPPING,4,2              ## @IRQ_REMAPPING
	.no_dead_strip	_alloc_irte
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function alloc_irte
_alloc_irte:                            ; @alloc_irte
	.cfi_startproc
; %bb.0:
	stp	x22, x21, [sp, #-48]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 48
	stp	x20, x19, [sp, #16]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #32]             ; 16-byte Folded Spill
	add	x29, sp, #32
	.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	w22, #-1
	cbz	x1, LBB0_10
; %bb.1:
	cbz	w2, LBB0_10
; %bb.2:
	mov	x19, x1
	mov	x20, x0
	ldr	x22, [x0, #8]
	cmp	w2, #1
	b.le	LBB0_5
; %bb.3:
	mov	x0, x2
	bl	___roundup_pow_of_two
	bl	_ilog2
	mov	x21, x0
	ldr	w0, [x20, #4]
	bl	_ecap_max_handle_mask
	cmp	w21, w0
	b.ls	LBB0_6
; %bb.4:
	ldr	w0, [x20, #4]
	bl	_ecap_max_handle_mask
	mov	x2, x0
Lloh0:
	adrp	x0, l_.str@PAGE
Lloh1:
	add	x0, x0, l_.str@PAGEOFF
	mov	x1, x21
	bl	_pr_err
	mov	w22, #-1
	b	LBB0_10
LBB0_5:
	ldr	w0, [x20, #4]
	bl	_ecap_max_handle_mask
	mov	w21, #0
LBB0_6:
Lloh2:
	adrp	x0, _irq_2_ir_lock@GOTPAGE
Lloh3:
	ldr	x0, [x0, _irq_2_ir_lock@GOTPAGEOFF]
	bl	_raw_spin_lock_irqsave
	ldr	w0, [x22]
Lloh4:
	adrp	x8, _INTR_REMAP_TABLE_ENTRIES@GOTPAGE
Lloh5:
	ldr	x8, [x8, _INTR_REMAP_TABLE_ENTRIES@GOTPAGEOFF]
Lloh6:
	ldr	w1, [x8]
	mov	x2, x21
	bl	_bitmap_find_free_region
	mov	x22, x0
	tbnz	w0, #31, LBB0_8
; %bb.7:
	stp	xzr, x20, [x19, #16]
	stp	w22, w21, [x19]
Lloh7:
	adrp	x8, _IRQ_REMAPPING@GOTPAGE
Lloh8:
	ldr	x8, [x8, _IRQ_REMAPPING@GOTPAGEOFF]
Lloh9:
	ldr	w8, [x8]
	str	w8, [x19, #8]
	b	LBB0_9
LBB0_8:
	ldr	w1, [x20]
Lloh10:
	adrp	x0, l_.str.1@PAGE
Lloh11:
	add	x0, x0, l_.str.1@PAGEOFF
	bl	_pr_warn
LBB0_9:
Lloh12:
	adrp	x0, _irq_2_ir_lock@GOTPAGE
Lloh13:
	ldr	x0, [x0, _irq_2_ir_lock@GOTPAGEOFF]
	bl	_raw_spin_unlock_irqrestore
LBB0_10:
	mov	x0, x22
	ldp	x29, x30, [sp, #32]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #16]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp], #48             ; 16-byte Folded Reload
	ret
	.loh AdrpAdd	Lloh0, Lloh1
	.loh AdrpLdrGotLdr	Lloh4, Lloh5, Lloh6
	.loh AdrpLdrGot	Lloh2, Lloh3
	.loh AdrpLdrGotLdr	Lloh7, Lloh8, Lloh9
	.loh AdrpAdd	Lloh10, Lloh11
	.loh AdrpLdrGot	Lloh12, Lloh13
	.cfi_endproc
                                        ; -- End function
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"Requested mask %x exceeds the max invalidation handle mask value %Lx\n"

	.comm	_irq_2_ir_lock,4,2              ; @irq_2_ir_lock
	.comm	_INTR_REMAP_TABLE_ENTRIES,4,2   ; @INTR_REMAP_TABLE_ENTRIES
l_.str.1:                               ; @.str.1
	.asciz	"IR%d: can't allocate an IRTE\n"

	.comm	_IRQ_REMAPPING,4,2              ; @IRQ_REMAPPING
	.no_dead_strip	_alloc_irte
.subsections_via_symbols
