	.file	"extr_bhndb.c_bhndb_try_activate_resource.c"
	.intel_syntax noprefix
	.text
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"unsupported resource type %d\n"
	.section	.rodata.str1.8,"aMS",@progbits,1
	.align 8
.LC1:
	.string	"host resource not found for 0x%llx-0x%llx\n"
	.align 8
.LC2:
	.string	"static window allocation for 0x%llx-0x%llx failed\n"
	.text
	.p2align 4
	.type	bhndb_try_activate_resource, @function
bhndb_try_activate_resource:
.LFB0:
	.cfi_startproc
	endbr64
	push	r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	mov	r15, rdi
	push	r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	push	r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	mov	r13d, esi
	push	r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	mov	r12, r8
	push	rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	mov	rbp, r9
	push	rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	mov	ebx, edx
	sub	rsp, 24
	.cfi_def_cfa_offset 80
	mov	esi, DWORD PTR MA_NOTOWNED[rip]
	mov	DWORD PTR 4[rsp], ecx
	call	BHNDB_LOCK_ASSERT@PLT
	test	rbp, rbp
	je	.L2
	mov	DWORD PTR 0[rbp], 0
.L2:
	cmp	ebx, 128
	je	.L3
	cmp	ebx, 129
	je	.L33
	mov	edi, DWORD PTR 8[r15]
	movsx	rdx, ebx
	lea	rsi, .LC0[rip]
	xor	eax, eax
	call	device_printf@PLT
	mov	r13d, DWORD PTR ENXIO[rip]
.L1:
	add	rsp, 24
	.cfi_remember_state
	.cfi_def_cfa_offset 56
	mov	eax, r13d
	pop	rbx
	.cfi_def_cfa_offset 48
	pop	rbp
	.cfi_def_cfa_offset 40
	pop	r12
	.cfi_def_cfa_offset 32
	pop	r13
	.cfi_def_cfa_offset 24
	pop	r14
	.cfi_def_cfa_offset 16
	pop	r15
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L39:
	.cfi_restore_state
	mov	rax, QWORD PTR [r15]
	mov	rcx, r14
	mov	rdx, rbx
	mov	esi, 128
	mov	edi, DWORD PTR 8[rax]
	call	bhndb_host_resource_for_range@PLT
	mov	rbp, rax
	test	rax, rax
	je	.L38
	mov	rdi, rax
	call	rman_get_start@PLT
	mov	rcx, r14
	mov	rsi, rbp
	mov	rdi, r12
	sub	rbx, rax
	mov	rdx, rbx
	call	bhndb_init_child_resource@PLT
	mov	r13d, eax
	test	eax, eax
	jne	.L1
.L33:
	add	rsp, 24
	.cfi_remember_state
	.cfi_def_cfa_offset 56
	mov	rdi, r12
	pop	rbx
	.cfi_def_cfa_offset 48
	pop	rbp
	.cfi_def_cfa_offset 40
	pop	r12
	.cfi_def_cfa_offset 32
	pop	r13
	.cfi_def_cfa_offset 24
	pop	r14
	.cfi_def_cfa_offset 16
	pop	r15
	.cfi_def_cfa_offset 8
	jmp	rman_activate_resource@PLT
	.p2align 4,,10
	.p2align 3
.L3:
	.cfi_restore_state
	mov	esi, 128
	mov	edi, 1
	call	KASSERT@PLT
	mov	rdi, r12
	call	rman_get_start@PLT
	mov	rdi, r12
	mov	rbx, rax
	call	rman_get_size@PLT
	mov	esi, r13d
	mov	rdi, r15
	mov	r14, rax
	call	bhndb_get_addrspace@PLT
	cmp	rax, QWORD PTR BHNDB_ADDRSPACE_NATIVE[rip]
	je	.L39
	mov	rcx, QWORD PTR BHNDB_PRIORITY_LOW[rip]
	mov	rdi, QWORD PTR [r15]
	mov	rdx, r14
	mov	rsi, rbx
	mov	QWORD PTR 8[rsp], rcx
	call	bhndb_find_resource_region@PLT
	mov	rcx, QWORD PTR 8[rsp]
	test	rax, rax
	je	.L8
	cmp	QWORD PTR 8[rax], 0
	mov	rcx, QWORD PTR [rax]
	jne	.L40
.L8:
	mov	rax, QWORD PTR [r15]
	cmp	QWORD PTR [rax], rcx
	jg	.L36
	mov	rdi, r15
	call	BHNDB_LOCK@PLT
	mov	rdi, r15
	mov	rsi, r12
	call	bhndb_retain_dynamic_window@PLT
	mov	rdi, r15
	mov	r14, rax
	call	BHNDB_UNLOCK@PLT
	test	r14, r14
	je	.L36
	mov	rax, QWORD PTR [r14]
	sub	rbx, QWORD PTR 16[r14]
	mov	rdi, r12
	mov	rsi, QWORD PTR 8[r14]
	mov	rdx, QWORD PTR 8[rax]
	mov	rcx, QWORD PTR [rax]
	add	rdx, rbx
	call	bhndb_init_child_resource@PLT
	mov	r13d, eax
	test	eax, eax
	je	.L41
.L13:
	mov	rdi, r15
	call	BHNDB_LOCK@PLT
	mov	rdi, QWORD PTR [r15]
	mov	rdx, r12
	mov	rsi, r14
	call	bhndb_dw_release@PLT
	mov	rdi, r15
	call	BHNDB_UNLOCK@PLT
	jmp	.L1
	.p2align 4,,10
	.p2align 3
.L36:
	test	rbp, rbp
	je	.L12
	mov	DWORD PTR 0[rbp], 1
.L12:
	mov	r13d, DWORD PTR ENOMEM[rip]
	jmp	.L1
	.p2align 4,,10
	.p2align 3
.L41:
	mov	rdi, r12
	call	rman_activate_resource@PLT
	mov	r13d, eax
	test	eax, eax
	je	.L1
	jmp	.L13
	.p2align 4,,10
	.p2align 3
.L40:
	mov	r8d, DWORD PTR 4[rsp]
	mov	edx, r13d
	mov	r9, r12
	mov	ecx, 128
	mov	rsi, rax
	mov	rdi, r15
	call	bhndb_activate_static_region@PLT
	mov	r13d, eax
	test	eax, eax
	je	.L1
	mov	edi, DWORD PTR 8[r15]
	lea	rcx, -1[rbx+r14]
	mov	rdx, rbx
	xor	eax, eax
	lea	rsi, .LC2[rip]
	call	device_printf@PLT
	jmp	.L1
	.p2align 4,,10
	.p2align 3
.L38:
	mov	edi, DWORD PTR 8[r15]
	lea	rcx, -1[rbx+r14]
	mov	rdx, rbx
	xor	eax, eax
	lea	rsi, .LC1[rip]
	call	device_printf@PLT
	mov	r13d, DWORD PTR ENOENT[rip]
	jmp	.L1
	.cfi_endproc
.LFE0:
	.size	bhndb_try_activate_resource, .-bhndb_try_activate_resource
	.comm	MA_NOTOWNED,4,4
	.comm	ENXIO,4,4
	.comm	ENOMEM,4,4
	.comm	ENOENT,4,4
	.comm	BHNDB_PRIORITY_LOW,8,8
	.comm	BHNDB_ADDRSPACE_NATIVE,8,8
	.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_bhndb.c_bhndb_try_activate_resource.c"
	.text
	.section	.rodata.str1.4,"aMS",%progbits,1
	.align	2
.LC0:
	.ascii	"unsupported resource type %d\012\000"
	.align	2
.LC1:
	.ascii	"host resource not found for 0x%llx-0x%llx\012\000"
	.align	2
.LC2:
	.ascii	"static window allocation for 0x%llx-0x%llx failed\012"
	.ascii	"\000"
	.text
	.align	2
	.syntax unified
	.arm
	.fpu softvfp
	.type	bhndb_try_activate_resource, %function
bhndb_try_activate_resource:
	@ args = 8, pretend = 0, frame = 8
	@ frame_needed = 0, uses_anonymous_args = 0
	push	{r4, r5, r6, r7, r8, r9, r10, fp, lr}
	mov	r6, r1
	sub	sp, sp, #20
	ldr	r1, .L45
	ldr	r9, [sp, #60]
	ldr	r1, [r1]
	mov	r4, r2
	mov	r8, r3
	mov	r5, r0
	ldr	r7, [sp, #56]
	bl	BHNDB_LOCK_ASSERT
	cmp	r9, #0
	movne	r3, #0
	strne	r3, [r9]
	cmp	r4, #128
	beq	.L3
	cmp	r4, #129
	beq	.L36
	asr	r3, r4, #31
	mov	r2, r4
	ldr	r0, [r5, #4]
	ldr	r1, .L45+4
	bl	device_printf
	ldr	r3, .L45+8
	ldr	r4, [r3]
.L1:
	mov	r0, r4
	add	sp, sp, #20
	@ sp needed
	pop	{r4, r5, r6, r7, r8, r9, r10, fp, pc}
.L42:
	ldr	r3, [r5]
	mov	r1, r4
	ldr	r0, [r3, #4]
	mov	r2, r10
	mov	r3, fp
	bl	bhndb_host_resource_for_range
	subs	r4, r0, #0
	beq	.L41
	bl	rman_get_start
	mov	r1, r4
	sub	r2, r10, r0
	mov	r3, fp
	mov	r0, r7
	bl	bhndb_init_child_resource
	subs	r4, r0, #0
	bne	.L1
.L36:
	mov	r0, r7
	add	sp, sp, #20
	@ sp needed
	pop	{r4, r5, r6, r7, r8, r9, r10, fp, lr}
	b	rman_activate_resource
.L3:
	mov	r1, r4
	mov	r0, #1
	bl	KASSERT
	mov	r0, r7
	bl	rman_get_start
	mov	r10, r0
	mov	r0, r7
	bl	rman_get_size
	mov	r1, r6
	mov	fp, r0
	mov	r0, r5
	bl	bhndb_get_addrspace
	ldr	r3, .L45+12
	ldr	r3, [r3]
	cmp	r0, r3
	beq	.L42
	ldr	r3, .L45+16
	mov	r1, r10
	ldr	r3, [r3]
	mov	r2, fp
	ldr	r0, [r5]
	str	r3, [sp, #12]
	bl	bhndb_find_resource_region
	subs	r1, r0, #0
	ldr	r3, [sp, #12]
	beq	.L8
	ldr	r2, [r1, #4]
	ldr	r3, [r1]
	cmp	r2, #0
	bne	.L43
.L8:
	ldr	r2, [r5]
	ldr	r2, [r2]
	cmp	r2, r3
	bgt	.L39
	mov	r0, r5
	bl	BHNDB_LOCK
	mov	r1, r7
	mov	r0, r5
	bl	bhndb_retain_dynamic_window
	mov	r6, r0
	mov	r0, r5
	bl	BHNDB_UNLOCK
	cmp	r6, #0
	beq	.L39
	ldr	r3, [r6]
	ldr	r1, [r6, #8]
	ldr	r2, [r3, #4]
	sub	r10, r10, r1
	mov	r0, r7
	ldr	r3, [r3]
	ldr	r1, [r6, #4]
	add	r2, r10, r2
	bl	bhndb_init_child_resource
	subs	r4, r0, #0
	beq	.L44
.L13:
	mov	r0, r5
	bl	BHNDB_LOCK
	mov	r2, r7
	mov	r1, r6
	ldr	r0, [r5]
	bl	bhndb_dw_release
	mov	r0, r5
	bl	BHNDB_UNLOCK
	b	.L1
.L39:
	cmp	r9, #0
	movne	r3, #1
	strne	r3, [r9]
	ldr	r3, .L45+20
	ldr	r4, [r3]
	mov	r0, r4
	add	sp, sp, #20
	@ sp needed
	pop	{r4, r5, r6, r7, r8, r9, r10, fp, pc}
.L44:
	mov	r0, r7
	bl	rman_activate_resource
	subs	r4, r0, #0
	beq	.L1
	b	.L13
.L43:
	mov	r3, r4
	mov	r2, r6
	mov	r0, r5
	str	r7, [sp, #4]
	str	r8, [sp]
	bl	bhndb_activate_static_region
	subs	r4, r0, #0
	beq	.L1
	adds	r2, fp, r10
	asr	r3, fp, #31
	adc	r3, r3, r10, asr #31
	subs	r2, r2, #1
	sbc	r3, r3, #0
	ldr	r0, [r5, #4]
	ldr	r1, .L45+24
	stm	sp, {r2, r3}
	mov	r2, r10
	asr	r3, r10, #31
	bl	device_printf
	b	.L1
.L41:
	adds	r2, fp, r10
	asr	r3, fp, #31
	adc	r3, r3, r10, asr #31
	subs	r2, r2, #1
	sbc	r3, r3, #0
	ldr	r0, [r5, #4]
	ldr	r1, .L45+28
	stm	sp, {r2, r3}
	asr	r3, r10, #31
	mov	r2, r10
	bl	device_printf
	ldr	r3, .L45+32
	ldr	r4, [r3]
	b	.L1
.L46:
	.align	2
.L45:
	.word	MA_NOTOWNED
	.word	.LC0
	.word	ENXIO
	.word	BHNDB_ADDRSPACE_NATIVE
	.word	BHNDB_PRIORITY_LOW
	.word	ENOMEM
	.word	.LC2
	.word	.LC1
	.word	ENOENT
	.size	bhndb_try_activate_resource, .-bhndb_try_activate_resource
	.comm	MA_NOTOWNED,4,4
	.comm	ENXIO,4,4
	.comm	ENOMEM,4,4
	.comm	ENOENT,4,4
	.comm	BHNDB_PRIORITY_LOW,4,4
	.comm	BHNDB_ADDRSPACE_NATIVE,4,4
	.ident	"GCC: (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0"
	.section	.note.GNU-stack,"",%progbits
