	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function dmar_gas_alloc_region
_dmar_gas_alloc_region:                 ## @dmar_gas_alloc_region
	.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
	movq	%rsi, %r12
	movq	%rdi, %r14
	callq	_DMAR_DOMAIN_ASSERT_LOCKED
	movl	(%r12), %eax
	movq	_DMAR_PAGE_MASK@GOTPCREL(%rip), %rcx
	movl	(%rcx), %edx
	testl	%eax, %edx
	jne	LBB0_20
## %bb.1:
	movl	4(%r12), %ecx
	testl	%edx, %ecx
	jne	LBB0_20
## %bb.2:
	cmpl	%ecx, %eax
	jge	LBB0_20
## %bb.3:
	cmpl	(%r14), %ecx
	jge	LBB0_20
## %bb.4:
	movq	_dmar_gas_entries_tree@GOTPCREL(%rip), %r13
	movl	(%r13), %edi
	leaq	4(%r14), %rbx
	movq	%rbx, %rsi
	movq	%r12, %rdx
	callq	_RB_NFIND
	movq	%rax, %r15
	xorl	%edi, %edi
	testq	%rax, %rax
	setne	%dil
	movslq	(%r12), %rsi
	callq	_KASSERT
	movl	(%r13), %edi
	movq	%rbx, %rsi
	movq	%r15, %rdx
	callq	_RB_PREV
	testq	%rax, %rax
	je	LBB0_9
## %bb.5:
	movl	4(%rax), %ecx
	cmpl	(%r12), %ecx
	jle	LBB0_9
## %bb.6:
	movl	8(%rax), %edx
	movq	_DMAR_MAP_ENTRY_PLACE@GOTPCREL(%rip), %rsi
	testl	%edx, (%rsi)
	jne	LBB0_9
## %bb.7:
	movq	_DMAR_MAP_ENTRY_RMRR@GOTPCREL(%rip), %rsi
	testl	%edx, (%rsi)
	je	LBB0_23
## %bb.8:
	movl	%ecx, (%r12)
LBB0_9:
	movl	(%r15), %ecx
	movl	4(%r12), %edx
	cmpl	%edx, %ecx
	jge	LBB0_13
## %bb.10:
	movl	8(%r15), %esi
	movq	_DMAR_MAP_ENTRY_PLACE@GOTPCREL(%rip), %rdi
	testl	%esi, (%rdi)
	jne	LBB0_13
## %bb.11:
	movq	_DMAR_MAP_ENTRY_RMRR@GOTPCREL(%rip), %rdx
	testl	%esi, (%rdx)
	je	LBB0_23
## %bb.12:
	movl	%ecx, 4(%r12)
	movl	%ecx, %edx
LBB0_13:
	movl	(%r12), %esi
	xorl	%ebx, %ebx
	cmpl	%esi, %edx
	je	LBB0_22
## %bb.14:
	testq	%rax, %rax
	je	LBB0_17
## %bb.15:
	cmpl	%esi, 4(%rax)
	jle	LBB0_17
## %bb.16:
	movq	%r14, %rdi
	movq	%rax, %rsi
	callq	_dmar_gas_rb_remove
	movl	(%r15), %ecx
	movl	4(%r12), %edx
LBB0_17:
	cmpl	%edx, %ecx
	jge	LBB0_19
## %bb.18:
	movq	%r14, %rdi
	movq	%r15, %rsi
	callq	_dmar_gas_rb_remove
LBB0_19:
	movq	%r14, %rdi
	movq	%r12, %rsi
	callq	_dmar_gas_rb_insert
	movslq	4(%r12), %rsi
	movl	%eax, %edi
	callq	_KASSERT
	movq	_DMAR_MAP_ENTRY_RMRR@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movl	%eax, 8(%r12)
	jmp	LBB0_22
LBB0_20:
	movq	_EINVAL@GOTPCREL(%rip), %rax
LBB0_21:
	movl	(%rax), %ebx
LBB0_22:
	movl	%ebx, %eax
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_23:
	movq	_EBUSY@GOTPCREL(%rip), %rax
	jmp	LBB0_21
	.cfi_endproc
                                        ## -- End function
	.comm	_DMAR_PAGE_MASK,4,2             ## @DMAR_PAGE_MASK
	.comm	_EINVAL,4,2                     ## @EINVAL
	.comm	_dmar_gas_entries_tree,4,2      ## @dmar_gas_entries_tree
	.comm	_DMAR_MAP_ENTRY_PLACE,4,2       ## @DMAR_MAP_ENTRY_PLACE
	.comm	_DMAR_MAP_ENTRY_RMRR,4,2        ## @DMAR_MAP_ENTRY_RMRR
	.comm	_EBUSY,4,2                      ## @EBUSY
	.no_dead_strip	_dmar_gas_alloc_region
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function dmar_gas_alloc_region
_dmar_gas_alloc_region:                 ; @dmar_gas_alloc_region
	.cfi_startproc
; %bb.0:
	stp	x24, x23, [sp, #-64]!           ; 16-byte Folded Spill
	.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
	.cfi_offset w23, -56
	.cfi_offset w24, -64
	mov	x19, x1
	mov	x20, x0
	bl	_DMAR_DOMAIN_ASSERT_LOCKED
	ldr	w8, [x19]
Lloh0:
	adrp	x9, _DMAR_PAGE_MASK@GOTPAGE
Lloh1:
	ldr	x9, [x9, _DMAR_PAGE_MASK@GOTPAGEOFF]
Lloh2:
	ldr	w10, [x9]
	tst	w10, w8
	b.ne	LBB0_15
; %bb.1:
	ldr	w9, [x19, #4]
	tst	w9, w10
	b.ne	LBB0_15
; %bb.2:
	cmp	w8, w9
	b.ge	LBB0_15
; %bb.3:
	ldr	w8, [x20]
	cmp	w9, w8
	b.ge	LBB0_15
; %bb.4:
Lloh3:
	adrp	x23, _dmar_gas_entries_tree@GOTPAGE
Lloh4:
	ldr	x23, [x23, _dmar_gas_entries_tree@GOTPAGEOFF]
	ldr	w0, [x23]
	add	x22, x20, #4
	mov	x1, x22
	mov	x2, x19
	bl	_RB_NFIND
	mov	x21, x0
	cmp	x0, #0
	cset	w0, ne
	ldrsw	x1, [x19]
	bl	_KASSERT
	ldr	w0, [x23]
	mov	x1, x22
	mov	x2, x21
	bl	_RB_PREV
	mov	x1, x0
	cbz	x0, LBB0_9
; %bb.5:
	ldr	w8, [x1, #4]
	ldr	w9, [x19]
	cmp	w8, w9
	b.le	LBB0_9
; %bb.6:
	ldr	w9, [x1, #8]
Lloh5:
	adrp	x10, _DMAR_MAP_ENTRY_PLACE@GOTPAGE
Lloh6:
	ldr	x10, [x10, _DMAR_MAP_ENTRY_PLACE@GOTPAGEOFF]
Lloh7:
	ldr	w10, [x10]
	tst	w10, w9
	b.ne	LBB0_9
; %bb.7:
Lloh8:
	adrp	x10, _DMAR_MAP_ENTRY_RMRR@GOTPAGE
Lloh9:
	ldr	x10, [x10, _DMAR_MAP_ENTRY_RMRR@GOTPAGEOFF]
Lloh10:
	ldr	w10, [x10]
	tst	w10, w9
	b.eq	LBB0_24
; %bb.8:
	str	w8, [x19]
LBB0_9:
	ldr	w8, [x21]
	ldr	w9, [x19, #4]
	cmp	w8, w9
	b.ge	LBB0_13
; %bb.10:
	ldr	w10, [x21, #8]
Lloh11:
	adrp	x11, _DMAR_MAP_ENTRY_PLACE@GOTPAGE
Lloh12:
	ldr	x11, [x11, _DMAR_MAP_ENTRY_PLACE@GOTPAGEOFF]
Lloh13:
	ldr	w11, [x11]
	tst	w11, w10
	b.ne	LBB0_13
; %bb.11:
Lloh14:
	adrp	x9, _DMAR_MAP_ENTRY_RMRR@GOTPAGE
Lloh15:
	ldr	x9, [x9, _DMAR_MAP_ENTRY_RMRR@GOTPAGEOFF]
Lloh16:
	ldr	w9, [x9]
	tst	w9, w10
	b.eq	LBB0_24
; %bb.12:
	str	w8, [x19, #4]
	mov	x9, x8
LBB0_13:
	ldr	w10, [x19]
	cmp	w9, w10
	b.ne	LBB0_18
; %bb.14:
	mov	w0, #0
	b	LBB0_17
LBB0_15:
Lloh17:
	adrp	x8, _EINVAL@GOTPAGE
Lloh18:
	ldr	x8, [x8, _EINVAL@GOTPAGEOFF]
LBB0_16:
	ldr	w0, [x8]
LBB0_17:
	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
	ldp	x24, x23, [sp], #64             ; 16-byte Folded Reload
	ret
LBB0_18:
	cbz	x1, LBB0_21
; %bb.19:
	ldr	w11, [x1, #4]
	cmp	w11, w10
	b.le	LBB0_21
; %bb.20:
	mov	x0, x20
	bl	_dmar_gas_rb_remove
	ldr	w8, [x21]
	ldr	w9, [x19, #4]
LBB0_21:
	cmp	w8, w9
	b.ge	LBB0_23
; %bb.22:
	mov	x0, x20
	mov	x1, x21
	bl	_dmar_gas_rb_remove
LBB0_23:
	mov	x0, x20
	mov	x1, x19
	bl	_dmar_gas_rb_insert
	ldrsw	x1, [x19, #4]
	bl	_KASSERT
	mov	w0, #0
Lloh19:
	adrp	x8, _DMAR_MAP_ENTRY_RMRR@GOTPAGE
Lloh20:
	ldr	x8, [x8, _DMAR_MAP_ENTRY_RMRR@GOTPAGEOFF]
Lloh21:
	ldr	w8, [x8]
	str	w8, [x19, #8]
	b	LBB0_17
LBB0_24:
Lloh22:
	adrp	x8, _EBUSY@GOTPAGE
Lloh23:
	ldr	x8, [x8, _EBUSY@GOTPAGEOFF]
	b	LBB0_16
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGot	Lloh3, Lloh4
	.loh AdrpLdrGotLdr	Lloh5, Lloh6, Lloh7
	.loh AdrpLdrGotLdr	Lloh8, Lloh9, Lloh10
	.loh AdrpLdrGotLdr	Lloh11, Lloh12, Lloh13
	.loh AdrpLdrGotLdr	Lloh14, Lloh15, Lloh16
	.loh AdrpLdrGot	Lloh17, Lloh18
	.loh AdrpLdrGotLdr	Lloh19, Lloh20, Lloh21
	.loh AdrpLdrGot	Lloh22, Lloh23
	.cfi_endproc
                                        ; -- End function
	.comm	_DMAR_PAGE_MASK,4,2             ; @DMAR_PAGE_MASK
	.comm	_EINVAL,4,2                     ; @EINVAL
	.comm	_dmar_gas_entries_tree,4,2      ; @dmar_gas_entries_tree
	.comm	_DMAR_MAP_ENTRY_PLACE,4,2       ; @DMAR_MAP_ENTRY_PLACE
	.comm	_DMAR_MAP_ENTRY_RMRR,4,2        ; @DMAR_MAP_ENTRY_RMRR
	.comm	_EBUSY,4,2                      ; @EBUSY
	.no_dead_strip	_dmar_gas_alloc_region
.subsections_via_symbols
