	.file	"extr_metaslab.c_find_valid_metaslab.c"
	.intel_syntax noprefix
	.text
	.p2align 4
	.type	find_valid_metaslab, @function
find_valid_metaslab:
.LFB0:
	.cfi_startproc
	endbr64
	push	r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	push	r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	push	r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	mov	r13, r9
	push	r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	mov	r12, rdi
	push	rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	mov	ebp, r8d
	push	rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	mov	ebx, ecx
	sub	rsp, 88
	.cfi_def_cfa_offset 144
	mov	rax, QWORD PTR 160[rsp]
	mov	QWORD PTR 16[rsp], rsi
	mov	rsi, QWORD PTR 168[rsp]
	mov	QWORD PTR 32[rsp], rdx
	lea	rdx, 68[rsp]
	mov	QWORD PTR 8[rsp], rax
	mov	rax, QWORD PTR 176[rsp]
	mov	QWORD PTR 56[rsp], rsi
	mov	r14d, DWORD PTR 152[rsp]
	mov	QWORD PTR 24[rsp], rax
	mov	rax, QWORD PTR fs:40
	mov	QWORD PTR 72[rsp], rax
	xor	eax, eax
	call	avl_find@PLT
	mov	r15, rax
	test	rax, rax
	jne	.L13
	jmp	.L33
	.p2align 4,,10
	.p2align 3
.L4:
	cmp	QWORD PTR 32[r15], 0
	jne	.L5
	cmp	QWORD PTR [r15], 0
	jle	.L34
.L5:
	mov	rsi, r15
	mov	rdi, r12
	call	AVL_NEXT@PLT
	mov	r15, rax
	test	rax, rax
	je	.L3
.L13:
	mov	edx, r14d
	mov	rsi, r13
	mov	rdi, r15
	call	metaslab_should_allocate@PLT
	test	eax, eax
	jne	.L4
	sub	rsp, 8
	.cfi_def_cfa_offset 152
	mov	rdx, r15
	mov	r8d, ebx
	mov	rcx, r13
	mov	eax, DWORD PTR 152[rsp]
	mov	r9d, DWORD PTR TRACE_TOO_SMALL[rip]
	mov	rsi, r12
	push	rax
	.cfi_def_cfa_offset 160
	mov	rdi, QWORD PTR 24[rsp]
	call	metaslab_trace_add@PLT
	pop	rax
	.cfi_def_cfa_offset 152
	pop	rdx
	.cfi_def_cfa_offset 144
	jmp	.L5
	.p2align 4,,10
	.p2align 3
.L34:
	cmp	DWORD PTR 8[r15], -1
	mov	rcx, QWORD PTR 24[rsp]
	setne	al
	setne	dl
	movzx	eax, al
	mov	DWORD PTR [rcx], eax
	mov	rax, QWORD PTR 16[rsp]
	cmp	QWORD PTR METASLAB_WEIGHT_PRIMARY[rip], rax
	je	.L8
	test	dl, dl
	jne	.L8
	test	ebx, ebx
	jle	.L9
	mov	rcx, QWORD PTR 32[rsp]
	xor	edx, edx
	mov	QWORD PTR 40[rsp], r12
	mov	r12d, ebp
	mov	QWORD PTR 48[rsp], r13
	mov	r13, r15
	mov	r15d, r14d
	mov	r14d, ebx
	mov	rbp, rcx
	mov	ebx, edx
	jmp	.L11
	.p2align 4,,10
	.p2align 3
.L12:
	add	ebx, 1
	add	rbp, 4
	cmp	r14d, ebx
	je	.L35
.L11:
	test	r12d, r12d
	je	.L12
	mov	rsi, rbp
	mov	rdi, r13
	call	metaslab_is_unique@PLT
	test	eax, eax
	jne	.L12
	mov	ebx, r14d
	mov	ebp, r12d
	mov	r14d, r15d
	mov	r12, QWORD PTR 40[rsp]
	mov	r15, r13
	mov	r13, QWORD PTR 48[rsp]
	jmp	.L5
.L9:
	jne	.L5
	jmp	.L8
	.p2align 4,,10
	.p2align 3
.L35:
	mov	r15, r13
.L8:
	mov	eax, DWORD PTR 24[r15]
	mov	rcx, QWORD PTR 56[rsp]
	mov	DWORD PTR 24[rcx], eax
	mov	rax, QWORD PTR 16[r15]
	add	rax, 1
	mov	QWORD PTR 16[rcx], rax
	mov	eax, DWORD PTR 8[r15]
	mov	DWORD PTR 8[rcx], eax
	mov	eax, DWORD PTR 12[r15]
	mov	DWORD PTR 12[rcx], eax
.L1:
	mov	rax, QWORD PTR 72[rsp]
	xor	rax, QWORD PTR fs:40
	jne	.L36
	add	rsp, 88
	.cfi_remember_state
	.cfi_def_cfa_offset 56
	mov	rax, r15
	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
.L33:
	.cfi_restore_state
	mov	edx, DWORD PTR AVL_AFTER[rip]
	mov	esi, DWORD PTR 68[rsp]
	mov	rdi, r12
	call	avl_nearest@PLT
	mov	r15, rax
	test	rax, rax
	jne	.L13
	.p2align 4,,10
	.p2align 3
.L3:
	xor	r15d, r15d
	jmp	.L1
.L36:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE0:
	.size	find_valid_metaslab, .-find_valid_metaslab
	.comm	TRACE_TOO_SMALL,4,4
	.comm	METASLAB_WEIGHT_PRIMARY,8,8
	.comm	AVL_AFTER,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_metaslab.c_find_valid_metaslab.c"
	.text
	.section	.rodata.cst4,"aM",%progbits,4
	.align	2
.LC0:
	.word	__stack_chk_guard
	.text
	.align	2
	.syntax unified
	.arm
	.fpu softvfp
	.type	find_valid_metaslab, %function
find_valid_metaslab:
	@ args = 28, pretend = 0, frame = 24
	@ frame_needed = 0, uses_anonymous_args = 0
	mov	ip, r1
	push	{r4, r5, r6, r7, r8, r9, r10, fp, lr}
	sub	sp, sp, #44
	mov	r10, r2
	ldr	r2, [sp, #100]
	mov	r5, r3
	ldr	r3, .L33
	str	r2, [sp, #28]
	str	ip, [sp, #20]
	ldr	r3, [r3]
	str	r3, [sp, #36]
	mov	r3,#0
	ldr	r3, [sp, #96]
	mov	r1, r2
	str	r3, [sp, #16]
	ldr	r3, [sp, #104]
	add	r2, sp, #32
	mov	r7, r0
	ldr	r6, [sp, #80]
	ldr	r8, [sp, #84]
	ldr	r9, [sp, #92]
	str	r3, [sp, #24]
	bl	avl_find
	subs	r4, r0, #0
	bne	.L13
	b	.L29
.L4:
	ldr	fp, [r4, #20]
	cmp	fp, #0
	bne	.L5
	ldr	r2, [r4]
	cmp	r2, #0
	ble	.L30
.L5:
	mov	r1, r4
	mov	r0, r7
	bl	AVL_NEXT
	subs	r4, r0, #0
	beq	.L3
.L13:
	mov	r2, r9
	mov	r1, r8
	mov	r0, r4
	bl	metaslab_should_allocate
	cmp	r0, #0
	bne	.L4
	ldr	r3, .L33+4
	ldr	r2, [sp, #88]
	ldr	r3, [r3]
	mov	r1, r7
	str	r2, [sp, #8]
	str	r3, [sp, #4]
	mov	r2, r4
	mov	r3, r8
	ldr	r0, [sp, #16]
	str	r5, [sp]
	bl	metaslab_trace_add
	b	.L5
.L30:
	ldr	r2, [r4, #4]
	ldr	r3, .L33+8
	adds	r2, r2, #1
	movne	r2, #1
	ldr	r1, [r3]
	ldr	r3, [sp, #20]
	cmp	r1, r3
	movne	r1, r2
	orreq	r1, r2, #1
	ldr	r3, [sp, #24]
	cmp	r1, #0
	str	r2, [r3]
	bne	.L8
	cmp	r5, #0
	bgt	.L11
	b	.L9
.L31:
	add	fp, fp, #1
	cmp	r5, fp
	beq	.L8
.L11:
	cmp	r6, #0
	beq	.L31
	mov	r0, r4
	add	r1, r10, fp, lsl #2
	bl	metaslab_is_unique
	cmp	r0, #0
	beq	.L5
	add	fp, fp, #1
	cmp	r5, fp
	bne	.L11
.L8:
	ldr	ip, [sp, #28]
	ldr	r3, [r4, #12]
	ldr	r0, [r4, #16]
	ldmib	r4, {r1, r2}
	stmib	ip, {r1, r2}
	add	r3, r3, #1
	str	r3, [ip, #12]
	str	r0, [ip, #16]
.L1:
	ldr	r3, .L33
	ldr	r2, [r3]
	ldr	r3, [sp, #36]
	eors	r2, r3, r2
	mov	r3, #0
	bne	.L32
	mov	r0, r4
	add	sp, sp, #44
	@ sp needed
	pop	{r4, r5, r6, r7, r8, r9, r10, fp, pc}
.L9:
	bne	.L5
	b	.L8
.L29:
	ldr	r3, .L33+12
	mov	r0, r7
	ldr	r1, [sp, #32]
	ldr	r2, [r3]
	bl	avl_nearest
	subs	r4, r0, #0
	bne	.L13
.L3:
	mov	r4, #0
	b	.L1
.L32:
	bl	__stack_chk_fail
.L34:
	.align	2
.L33:
	.word	.LC0
	.word	TRACE_TOO_SMALL
	.word	METASLAB_WEIGHT_PRIMARY
	.word	AVL_AFTER
	.size	find_valid_metaslab, .-find_valid_metaslab
	.comm	TRACE_TOO_SMALL,4,4
	.comm	METASLAB_WEIGHT_PRIMARY,4,4
	.comm	AVL_AFTER,4,4
	.ident	"GCC: (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0"
	.section	.note.GNU-stack,"",%progbits
