	.file	"extr_intel_gas.c_dmar_gas_alloc_region.c"
	.intel_syntax noprefix
	.text
	.p2align 4
	.type	dmar_gas_alloc_region, @function
dmar_gas_alloc_region:
.LFB0:
	.cfi_startproc
	endbr64
	push	r14
	.cfi_def_cfa_offset 16
	.cfi_offset 14, -16
	push	r13
	.cfi_def_cfa_offset 24
	.cfi_offset 13, -24
	push	r12
	.cfi_def_cfa_offset 32
	.cfi_offset 12, -32
	push	rbp
	.cfi_def_cfa_offset 40
	.cfi_offset 6, -40
	mov	rbp, rdi
	push	rbx
	.cfi_def_cfa_offset 48
	.cfi_offset 3, -48
	mov	rbx, rsi
	call	DMAR_DOMAIN_ASSERT_LOCKED@PLT
	mov	ecx, DWORD PTR [rbx]
	mov	eax, DWORD PTR DMAR_PAGE_MASK[rip]
	test	ecx, eax
	jne	.L2
	mov	edx, DWORD PTR 4[rbx]
	and	eax, edx
	mov	r12d, eax
	jne	.L2
	cmp	ecx, edx
	jge	.L2
	cmp	edx, DWORD PTR 0[rbp]
	jl	.L20
	.p2align 4,,10
	.p2align 3
.L2:
	mov	r12d, DWORD PTR EINVAL[rip]
.L1:
	pop	rbx
	.cfi_remember_state
	.cfi_def_cfa_offset 40
	mov	eax, r12d
	pop	rbp
	.cfi_def_cfa_offset 32
	pop	r12
	.cfi_def_cfa_offset 24
	pop	r13
	.cfi_def_cfa_offset 16
	pop	r14
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L20:
	.cfi_restore_state
	mov	edi, DWORD PTR dmar_gas_entries_tree[rip]
	lea	r14, 4[rbp]
	mov	rdx, rbx
	mov	rsi, r14
	call	RB_NFIND@PLT
	movsx	rsi, DWORD PTR [rbx]
	xor	edi, edi
	test	rax, rax
	mov	r13, rax
	setne	dil
	call	KASSERT@PLT
	mov	edi, DWORD PTR dmar_gas_entries_tree[rip]
	mov	rsi, r14
	mov	rdx, r13
	call	RB_PREV@PLT
	mov	rsi, rax
	test	rax, rax
	je	.L5
	mov	eax, DWORD PTR 4[rax]
	cmp	eax, DWORD PTR [rbx]
	jle	.L5
	mov	edx, DWORD PTR 8[rsi]
	test	DWORD PTR DMAR_MAP_ENTRY_PLACE[rip], edx
	jne	.L5
	test	DWORD PTR DMAR_MAP_ENTRY_RMRR[rip], edx
	je	.L18
	mov	DWORD PTR [rbx], eax
	.p2align 4,,10
	.p2align 3
.L5:
	mov	edx, DWORD PTR 0[r13]
	mov	eax, DWORD PTR 4[rbx]
	cmp	edx, eax
	jge	.L7
	mov	ecx, DWORD PTR 8[r13]
	test	DWORD PTR DMAR_MAP_ENTRY_PLACE[rip], ecx
	je	.L21
.L7:
	mov	ecx, DWORD PTR [rbx]
	cmp	ecx, eax
	je	.L1
	test	rsi, rsi
	je	.L9
	cmp	ecx, DWORD PTR 4[rsi]
	jl	.L22
.L9:
	cmp	eax, edx
	jg	.L23
.L10:
	mov	rsi, rbx
	mov	rdi, rbp
	call	dmar_gas_rb_insert@PLT
	movsx	rsi, DWORD PTR 4[rbx]
	mov	edi, eax
	call	KASSERT@PLT
	mov	eax, DWORD PTR DMAR_MAP_ENTRY_RMRR[rip]
	mov	DWORD PTR 8[rbx], eax
	jmp	.L1
	.p2align 4,,10
	.p2align 3
.L21:
	test	DWORD PTR DMAR_MAP_ENTRY_RMRR[rip], ecx
	je	.L18
	mov	DWORD PTR 4[rbx], edx
	mov	eax, edx
	jmp	.L7
	.p2align 4,,10
	.p2align 3
.L22:
	mov	rdi, rbp
	call	dmar_gas_rb_remove@PLT
	mov	edx, DWORD PTR 0[r13]
	mov	eax, DWORD PTR 4[rbx]
	jmp	.L9
	.p2align 4,,10
	.p2align 3
.L23:
	mov	rsi, r13
	mov	rdi, rbp
	call	dmar_gas_rb_remove@PLT
	jmp	.L10
	.p2align 4,,10
	.p2align 3
.L18:
	mov	r12d, DWORD PTR EBUSY[rip]
	jmp	.L1
	.cfi_endproc
.LFE0:
	.size	dmar_gas_alloc_region, .-dmar_gas_alloc_region
	.comm	dmar_gas_entries_tree,4,4
	.comm	EINVAL,4,4
	.comm	EBUSY,4,4
	.comm	DMAR_PAGE_MASK,4,4
	.comm	DMAR_MAP_ENTRY_RMRR,4,4
	.comm	DMAR_MAP_ENTRY_PLACE,4,4
	.ident	"GCC: (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0"
	.section	.note.GNU-stack,"",@progbits
	.section	.note.gnu.property,"a"
	.align 8
	.long	 1f - 0f
	.long	 4f - 1f
	.long	 5
0:
	.string	 "GNU"
1:
	.align 8
	.long	 0xc0000002
	.long	 3f - 2f
2:
	.long	 0x3
3:
	.align 8
4:

	.arch armv5t
	.eabi_attribute 20, 1
	.eabi_attribute 21, 1
	.eabi_attribute 23, 3
	.eabi_attribute 24, 1
	.eabi_attribute 25, 1
	.eabi_attribute 26, 2
	.eabi_attribute 30, 2
	.eabi_attribute 34, 0
	.eabi_attribute 18, 4
	.file	"extr_intel_gas.c_dmar_gas_alloc_region.c"
	.text
	.align	2
	.syntax unified
	.arm
	.fpu softvfp
	.type	dmar_gas_alloc_region, %function
dmar_gas_alloc_region:
	@ args = 0, pretend = 0, frame = 0
	@ frame_needed = 0, uses_anonymous_args = 0
	push	{r4, r5, r6, r7, r8, r9, r10, lr}
	mov	r5, r1
	mov	r6, r0
	bl	DMAR_DOMAIN_ASSERT_LOCKED
	ldr	r3, .L24
	ldr	r1, [r5]
	ldr	r3, [r3]
	tst	r1, r3
	bne	.L2
	ldr	r2, [r5, #4]
	ands	r4, r3, r2
	bne	.L2
	cmp	r1, r2
	bge	.L2
	ldr	r3, [r6]
	cmp	r2, r3
	blt	.L20
.L2:
	ldr	r3, .L24+4
	ldr	r4, [r3]
.L1:
	mov	r0, r4
	pop	{r4, r5, r6, r7, r8, r9, r10, pc}
.L20:
	ldr	r9, .L24+8
	add	r8, r6, #4
	mov	r2, r5
	mov	r1, r8
	ldr	r0, [r9]
	bl	RB_NFIND
	mov	r7, r0
	subs	r0, r0, #0
	movne	r0, #1
	ldr	r1, [r5]
	bl	KASSERT
	mov	r1, r8
	mov	r2, r7
	ldr	r0, [r9]
	bl	RB_PREV
	subs	r1, r0, #0
	beq	.L5
	ldr	r3, [r1, #4]
	ldr	r2, [r5]
	cmp	r3, r2
	ble	.L5
	ldr	r0, .L24+12
	ldr	r2, [r1, #8]
	ldr	r0, [r0]
	tst	r2, r0
	bne	.L5
	ldr	r0, .L24+16
	ldr	r0, [r0]
	tst	r2, r0
	strne	r3, [r5]
	bne	.L5
.L18:
	ldr	r3, .L24+20
	ldr	r4, [r3]
	b	.L1
.L5:
	ldr	r2, [r7]
	ldr	r3, [r5, #4]
	cmp	r2, r3
	bge	.L7
	ldr	ip, .L24+12
	ldr	r0, [r7, #8]
	ldr	ip, [ip]
	tst	r0, ip
	beq	.L21
.L7:
	ldr	r0, [r5]
	cmp	r0, r3
	beq	.L1
	cmp	r1, #0
	beq	.L9
	ldr	ip, [r1, #4]
	cmp	r0, ip
	blt	.L22
.L9:
	cmp	r3, r2
	bgt	.L23
.L10:
	mov	r1, r5
	mov	r0, r6
	bl	dmar_gas_rb_insert
	ldr	r1, [r5, #4]
	bl	KASSERT
	ldr	r3, .L24+16
	ldr	r3, [r3]
	str	r3, [r5, #8]
	b	.L1
.L21:
	ldr	r3, .L24+16
	ldr	r3, [r3]
	tst	r0, r3
	movne	r3, r2
	strne	r2, [r5, #4]
	bne	.L7
	b	.L18
.L22:
	mov	r0, r6
	bl	dmar_gas_rb_remove
	ldr	r2, [r7]
	ldr	r3, [r5, #4]
	b	.L9
.L23:
	mov	r1, r7
	mov	r0, r6
	bl	dmar_gas_rb_remove
	b	.L10
.L25:
	.align	2
.L24:
	.word	DMAR_PAGE_MASK
	.word	EINVAL
	.word	dmar_gas_entries_tree
	.word	DMAR_MAP_ENTRY_PLACE
	.word	DMAR_MAP_ENTRY_RMRR
	.word	EBUSY
	.size	dmar_gas_alloc_region, .-dmar_gas_alloc_region
	.comm	dmar_gas_entries_tree,4,4
	.comm	EINVAL,4,4
	.comm	EBUSY,4,4
	.comm	DMAR_PAGE_MASK,4,4
	.comm	DMAR_MAP_ENTRY_RMRR,4,4
	.comm	DMAR_MAP_ENTRY_PLACE,4,4
	.ident	"GCC: (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0"
	.section	.note.GNU-stack,"",%progbits
