	.file	"extr_journal.c_reserve_space.c"
	.intel_syntax noprefix
	.text
	.section	.rodata.str1.8,"aMS",@progbits,1
	.align 8
.LC0:
	.string	"no free space in jhead %s, run GC"
	.align 8
.LC1:
	.string	"GC couldn't make a free LEB for jhead %s"
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC2:
	.string	"retry (%d)"
.LC3:
	.string	"return -ENOSPC"
.LC4:
	.string	"got LEB %d for jhead %s"
	.section	.rodata.str1.8
	.align 8
.LC5:
	.string	"return LEB %d back, already have LEB %d:%d"
	.text
	.p2align 4
	.type	reserve_space, @function
reserve_space:
.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	r13d, esi
	push	r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	push	rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	mov	rbp, rdi
	push	rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	mov	ebx, edx
	sub	rsp, 40
	.cfi_def_cfa_offset 96
	mov	rax, QWORD PTR fs:40
	mov	QWORD PTR 24[rsp], rax
	xor	eax, eax
	movsx	rax, esi
	lea	rdx, [rax+rax*2]
	mov	rax, QWORD PTR 16[rdi]
	lea	r12, [rax+rdx*8]
	xor	eax, eax
	cmp	DWORD PTR BASEHD[rip], esi
	sete	al
	lea	r15, 12[r12]
	xor	r14d, r14d
	mov	DWORD PTR 4[rsp], eax
	lea	rax, 20[rsp]
	mov	QWORD PTR 8[rsp], rax
.L2:
	mov	esi, DWORD PTR 20[r12]
	mov	rdi, r15
	call	mutex_lock_nested@PLT
	cmp	QWORD PTR 8[rbp], 0
	jne	.L36
	mov	eax, DWORD PTR 0[rbp]
	sub	eax, DWORD PTR [r12]
	sub	eax, DWORD PTR 4[r12]
	cmp	eax, ebx
	jl	.L5
	cmp	DWORD PTR 8[r12], -1
	jne	.L13
.L5:
	mov	ecx, DWORD PTR 4[rsp]
	mov	rdx, QWORD PTR 8[rsp]
	mov	esi, ebx
	mov	rdi, rbp
	call	ubifs_find_free_space@PLT
	mov	r8d, eax
	test	eax, eax
	jns	.L37
	add	eax, DWORD PTR ENOSPC[rip]
	jne	.L4
	mov	edi, r13d
	call	dbg_jhead@PLT
	lea	rdi, .LC0[rip]
	mov	esi, eax
	xor	eax, eax
	call	dbg_jnl@PLT
	mov	rdi, r15
	call	mutex_unlock@PLT
	xor	esi, esi
	mov	rdi, rbp
	call	ubifs_garbage_collect@PLT
	mov	r8d, eax
	test	eax, eax
	jns	.L10
	add	eax, DWORD PTR ENOSPC[rip]
	jne	.L1
	mov	edi, r13d
	mov	DWORD PTR [rsp], r8d
	call	dbg_jhead@PLT
	lea	rdi, .LC1[rip]
	mov	esi, eax
	xor	eax, eax
	call	dbg_jnl@PLT
	cmp	r14d, 2
	mov	r8d, DWORD PTR [rsp]
	je	.L11
	add	r14d, 1
	lea	rdi, .LC2[rip]
	xor	eax, eax
	mov	esi, r14d
	call	dbg_jnl@PLT
	jmp	.L2
	.p2align 4,,10
	.p2align 3
.L8:
	mov	edi, r13d
	mov	DWORD PTR [rsp], r8d
	shr	edi, 31
	call	ubifs_assert@PLT
	mov	r8d, DWORD PTR [rsp]
	mov	rdi, rbp
	mov	esi, r8d
	call	ubifs_return_leb@PLT
	test	eax, eax
	je	.L14
	mov	ecx, r13d
	add	ecx, DWORD PTR EAGAIN[rip]
	cmove	r13d, eax
.L14:
	mov	rdi, r15
	call	mutex_unlock@PLT
	mov	r8d, r13d
	.p2align 4,,10
	.p2align 3
.L1:
	mov	rax, QWORD PTR 24[rsp]
	xor	rax, QWORD PTR fs:40
	jne	.L38
	add	rsp, 40
	.cfi_remember_state
	.cfi_def_cfa_offset 56
	mov	eax, r8d
	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
.L11:
	.cfi_restore_state
	lea	rdi, .LC3[rip]
	xor	eax, eax
	mov	DWORD PTR [rsp], r8d
	call	dbg_jnl@PLT
	mov	r8d, DWORD PTR [rsp]
	jmp	.L1
	.p2align 4,,10
	.p2align 3
.L36:
	mov	r8d, DWORD PTR EROFS[rip]
	neg	r8d
.L4:
	mov	rdi, r15
	mov	DWORD PTR [rsp], r8d
	call	mutex_unlock@PLT
	mov	r8d, DWORD PTR [rsp]
	jmp	.L1
	.p2align 4,,10
	.p2align 3
.L37:
	mov	ecx, DWORD PTR 20[rsp]
	mov	esi, r13d
	mov	edx, eax
	mov	rdi, rbp
	mov	DWORD PTR [rsp], eax
	call	ubifs_add_bud_to_log@PLT
	mov	r8d, DWORD PTR [rsp]
	test	eax, eax
	mov	r13d, eax
	jne	.L8
	mov	r13d, DWORD PTR 20[rsp]
.L9:
	mov	ecx, DWORD PTR 16[r12]
	mov	esi, r8d
	mov	edx, r13d
	mov	rdi, r12
	call	ubifs_wbuf_seek_nolock@PLT
	mov	r8d, eax
	test	eax, eax
	jne	.L4
.L13:
	xor	r8d, r8d
	jmp	.L1
	.p2align 4,,10
	.p2align 3
.L10:
	mov	esi, DWORD PTR 20[r12]
	mov	rdi, r15
	mov	DWORD PTR [rsp], eax
	call	mutex_lock_nested@PLT
	mov	edi, r13d
	call	dbg_jhead@PLT
	mov	r8d, DWORD PTR [rsp]
	lea	rdi, .LC4[rip]
	mov	edx, eax
	xor	eax, eax
	mov	esi, r8d
	call	dbg_jnl@PLT
	mov	edx, DWORD PTR [r12]
	mov	eax, DWORD PTR 0[rbp]
	mov	ecx, DWORD PTR 4[r12]
	mov	r9d, DWORD PTR 8[r12]
	sub	eax, edx
	mov	r8d, DWORD PTR [rsp]
	sub	eax, ecx
	cmp	ebx, eax
	jg	.L12
	cmp	r9d, -1
	jne	.L39
.L12:
	xor	ecx, ecx
	mov	edx, r8d
	mov	esi, r13d
	mov	rdi, rbp
	mov	DWORD PTR [rsp], r8d
	call	ubifs_add_bud_to_log@PLT
	mov	r8d, DWORD PTR [rsp]
	test	eax, eax
	mov	r13d, eax
	jne	.L8
	mov	DWORD PTR 20[rsp], 0
	jmp	.L9
.L39:
	add	ecx, edx
	mov	esi, r8d
	mov	edx, r9d
	xor	eax, eax
	lea	rdi, .LC5[rip]
	call	dbg_jnl@PLT
	mov	r8d, DWORD PTR [rsp]
	mov	rdi, rbp
	mov	esi, r8d
	call	ubifs_return_leb@PLT
	mov	r8d, eax
	test	eax, eax
	jne	.L4
	jmp	.L13
.L38:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE0:
	.size	reserve_space, .-reserve_space
	.comm	EROFS,4,4
	.comm	ENOSPC,4,4
	.comm	EAGAIN,4,4
	.comm	BASEHD,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_journal.c_reserve_space.c"
	.text
	.section	.rodata.str1.4,"aMS",%progbits,1
	.align	2
.LC0:
	.ascii	"no free space in jhead %s, run GC\000"
	.align	2
.LC1:
	.ascii	"GC couldn't make a free LEB for jhead %s\000"
	.align	2
.LC2:
	.ascii	"retry (%d)\000"
	.align	2
.LC3:
	.ascii	"return -ENOSPC\000"
	.align	2
.LC4:
	.ascii	"got LEB %d for jhead %s\000"
	.align	2
.LC5:
	.ascii	"return LEB %d back, already have LEB %d:%d\000"
	.section	.rodata.cst4,"aM",%progbits,4
	.align	2
.LC6:
	.word	__stack_chk_guard
	.text
	.align	2
	.syntax unified
	.arm
	.fpu softvfp
	.type	reserve_space, %function
reserve_space:
	@ args = 0, pretend = 0, frame = 32
	@ frame_needed = 0, uses_anonymous_args = 0
	push	{r4, r5, r6, r7, r8, r9, r10, fp, lr}
	mov	r8, r1
	ldr	r1, .L30
	sub	sp, sp, #36
	ldr	r3, [r1]
	ldr	r1, .L30+4
	sub	r3, r3, r8
	clz	r3, r3
	str	r2, [sp, #12]
	lsr	r3, r3, #5
	ldr	r1, [r1]
	str	r1, [sp, #28]
	mov	r1,#0
	str	r3, [sp, #8]
	ldr	r3, [r0, #8]
	mov	r6, r0
	mov	r1, r3
	mov	r9, #0
	mov	r4, r2
	str	r3, [sp, #20]
	add	r3, r8, r8, lsl #1
	add	r7, r1, r3, lsl #3
	ldr	fp, .L30+8
	lsl	r3, r3, #3
	str	r3, [sp, #16]
	add	r10, r7, #12
.L2:
	mov	r0, r10
	ldr	r1, [r7, #20]
	bl	mutex_lock_nested
	ldr	r3, [r6, #4]
	cmp	r3, #0
	bne	.L26
	ldr	r3, [r7]
	ldr	r5, [r6]
	ldr	r2, [r7, #4]
	sub	r5, r5, r3
	sub	r5, r5, r2
	ldr	r3, [r7, #8]
	cmp	r5, r4
	movlt	r5, #0
	movge	r5, #1
	cmn	r3, #1
	moveq	r5, #0
	cmp	r5, #0
	bne	.L13
	ldr	r3, [sp, #8]
	mov	r1, r4
	mov	r0, r6
	add	r2, sp, #24
	bl	ubifs_find_free_space
	subs	r3, r0, #0
	bge	.L27
	ldr	r2, [fp]
	cmn	r3, r2
	bne	.L22
	mov	r0, r8
	bl	dbg_jhead
	mov	r1, r0
	ldr	r0, .L30+12
	bl	dbg_jnl
	mov	r0, r10
	bl	mutex_unlock
	mov	r1, r5
	mov	r0, r6
	bl	ubifs_garbage_collect
	subs	r3, r0, #0
	bge	.L10
	ldr	r2, [fp]
	cmn	r3, r2
	bne	.L23
	mov	r0, r8
	str	r3, [sp, #4]
	bl	dbg_jhead
	mov	r1, r0
	ldr	r0, .L30+16
	bl	dbg_jnl
	cmp	r9, #2
	ldr	r3, [sp, #4]
	beq	.L11
	add	r9, r9, #1
	mov	r1, r9
	ldr	r0, .L30+20
	bl	dbg_jnl
	b	.L2
.L11:
	ldr	r0, .L30+24
	mov	r4, r3
	bl	dbg_jnl
.L1:
	ldr	r3, .L30+4
	ldr	r2, [r3]
	ldr	r3, [sp, #28]
	eors	r2, r3, r2
	mov	r3, #0
	bne	.L28
	mov	r0, r4
	add	sp, sp, #36
	@ sp needed
	pop	{r4, r5, r6, r7, r8, r9, r10, fp, pc}
.L27:
	mov	r4, r3
	mov	r1, r8
	mov	r2, r4
	mov	r0, r6
	ldr	r3, [sp, #24]
	bl	ubifs_add_bud_to_log
	subs	r5, r0, #0
	bne	.L8
	ldr	r5, [sp, #24]
.L9:
	mov	r1, r4
	mov	r2, r5
	mov	r0, r7
	ldr	r3, [r7, #16]
	bl	ubifs_wbuf_seek_nolock
	subs	r4, r0, #0
	bne	.L4
.L13:
	mov	r4, #0
	b	.L1
.L26:
	ldr	r3, .L30+28
	ldr	r4, [r3]
	rsb	r4, r4, #0
.L4:
	mov	r0, r10
	bl	mutex_unlock
	b	.L1
.L22:
	mov	r4, r3
	b	.L4
.L10:
	ldr	r1, [r7, #20]
	mov	r0, r10
	mov	r4, r3
	bl	mutex_lock_nested
	mov	r0, r8
	bl	dbg_jhead
	mov	r1, r4
	mov	r2, r0
	ldr	r0, .L30+32
	bl	dbg_jnl
	ldr	r3, [sp, #20]
	ldr	r2, [sp, #16]
	ldr	r1, [r7, #4]
	ldr	r0, [r3, r2]
	ldr	r3, [r6]
	ldr	ip, [sp, #12]
	sub	r3, r3, r0
	sub	r3, r3, r1
	ldr	r2, [r7, #8]
	cmp	ip, r3
	movgt	ip, #0
	movle	ip, #1
	cmn	r2, #1
	moveq	ip, #0
	cmp	ip, #0
	mov	r3, ip
	bne	.L29
	mov	r1, r8
	mov	r2, r4
	mov	r0, r6
	bl	ubifs_add_bud_to_log
	subs	r5, r0, #0
	bne	.L8
	str	r5, [sp, #24]
	b	.L9
.L23:
	mov	r4, r3
	b	.L1
.L8:
	lsr	r0, r5, #31
	bl	ubifs_assert
	mov	r1, r4
	mov	r0, r6
	bl	ubifs_return_leb
	cmp	r0, #0
	beq	.L14
	ldr	r3, .L30+36
	ldr	r3, [r3]
	cmn	r5, r3
	moveq	r5, r0
.L14:
	mov	r0, r10
	bl	mutex_unlock
	mov	r4, r5
	b	.L1
.L29:
	add	r3, r0, r1
	mov	r1, r4
	ldr	r0, .L30+40
	bl	dbg_jnl
	mov	r1, r4
	mov	r0, r6
	bl	ubifs_return_leb
	subs	r4, r0, #0
	bne	.L4
	b	.L13
.L28:
	bl	__stack_chk_fail
.L31:
	.align	2
.L30:
	.word	BASEHD
	.word	.LC6
	.word	ENOSPC
	.word	.LC0
	.word	.LC1
	.word	.LC2
	.word	.LC3
	.word	EROFS
	.word	.LC4
	.word	EAGAIN
	.word	.LC5
	.size	reserve_space, .-reserve_space
	.comm	EROFS,4,4
	.comm	ENOSPC,4,4
	.comm	EAGAIN,4,4
	.comm	BASEHD,4,4
	.ident	"GCC: (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0"
	.section	.note.GNU-stack,"",%progbits
