	.file	"extr_khrn_client_cache.c_heap_alloc.c"
	.intel_syntax noprefix
	.text
	.p2align 4
	.type	heap_alloc, @function
heap_alloc:
.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
	mov	r13d, esi
	push	r12
	.cfi_def_cfa_offset 32
	.cfi_offset 12, -32
	mov	r12, rdi
	push	rbp
	.cfi_def_cfa_offset 40
	.cfi_offset 6, -40
	push	rbx
	.cfi_def_cfa_offset 48
	.cfi_offset 3, -48
	call	heap_avail@PLT
	mov	edi, eax
	call	assert@PLT
	mov	edi, DWORD PTR [r12]
	mov	rcx, QWORD PTR 8[r12]
	sub	edi, r13d
	test	edi, edi
	jle	.L2
	xor	eax, eax
	mov	ebp, 1
	.p2align 4,,10
	.p2align 3
.L5:
	add	ebp, ebp
	movsx	rdx, ebp
	add	rdx, 1
	lea	rsi, 0[0+rdx*4]
	mov	edx, DWORD PTR [rcx+rdx*4]
	cmp	edx, r13d
	jl	.L3
	mov	esi, DWORD PTR -4[rcx+rsi]
	cmp	edx, esi
	jl	.L9
	cmp	esi, r13d
	jge	.L3
.L9:
	add	ebp, 1
.L3:
	add	eax, 1
	cmp	eax, edi
	jne	.L5
	mov	edx, ebp
	mov	ebx, ebp
	movsx	rax, ebp
	sar	ebx
	xor	edx, 1
	sal	rax, 2
	movsx	rdx, edx
	movsx	rsi, ebx
	lea	rdx, [rcx+rdx*4]
	lea	r14, [rcx+rsi*4]
.L6:
	mov	DWORD PTR [rcx+rax], 0
	mov	esi, DWORD PTR [rdx]
	cmp	esi, DWORD PTR [r14]
	jge	.L7
	xor	edi, edi
	jmp	.L8
	.p2align 4,,10
	.p2align 3
.L16:
	movsx	rbx, ebx
	mov	edi, DWORD PTR [rdx+rbx*4]
	mov	ebx, eax
.L8:
	call	_max@PLT
	mov	rdx, QWORD PTR 8[r12]
	mov	DWORD PTR [r14], eax
	mov	eax, ebx
	xor	eax, 1
	cdqe
	mov	esi, DWORD PTR [rdx+rax*4]
	mov	eax, ebx
	sar	eax
	movsx	rcx, eax
	lea	r14, [rdx+rcx*4]
	cmp	esi, DWORD PTR [r14]
	jl	.L16
.L7:
	lea	ecx, -1[r13]
	mov	eax, 1
	pop	rbx
	.cfi_remember_state
	.cfi_def_cfa_offset 40
	sal	ebp, cl
	mov	ecx, DWORD PTR [r12]
	sub	ecx, 1
	sal	eax, cl
	sub	ebp, eax
	mov	eax, ebp
	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
.L2:
	.cfi_restore_state
	mov	r14, rcx
	mov	rdx, rcx
	xor	ebx, ebx
	mov	eax, 4
	mov	ebp, 1
	jmp	.L6
	.cfi_endproc
.LFE0:
	.size	heap_alloc, .-heap_alloc
	.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_khrn_client_cache.c_heap_alloc.c"
	.text
	.align	2
	.syntax unified
	.arm
	.fpu softvfp
	.type	heap_alloc, %function
heap_alloc:
	@ args = 0, pretend = 0, frame = 0
	@ frame_needed = 0, uses_anonymous_args = 0
	push	{r4, r5, r6, r7, r8, lr}
	mov	r7, r0
	mov	r6, r1
	bl	heap_avail
	bl	assert
	ldr	lr, [r7]
	sub	lr, lr, r6
	cmp	lr, #0
	ble	.L2
	mov	r1, #0
	mov	r4, #1
	ldr	ip, [r7, #4]
.L4:
	lsl	r4, r4, #1
	add	r3, r4, #1
	ldr	r0, [ip, r3, lsl #2]
	lsl	r2, r3, #2
	cmp	r0, r6
	add	r1, r1, #1
	add	r2, ip, r2
	blt	.L3
	ldr	r2, [r2, #-4]
	cmp	r2, r6
	cmpge	r0, r2
	movlt	r4, r3
.L3:
	cmp	r1, lr
	bne	.L4
	eor	r3, r4, #1
	asr	r5, r4, #1
	add	r3, ip, r3, lsl #2
	add	r8, ip, r5, lsl #2
	lsl	r2, r4, #2
.L5:
	mov	r0, #0
	str	r0, [ip, r2]
	ldr	r1, [r3]
	ldr	r3, [r8]
	cmp	r1, r3
	blt	.L7
	b	.L6
.L13:
	ldr	r0, [r3, r5, lsl #2]
	mov	r5, ip
.L7:
	bl	_max
	ldr	r3, [r7, #4]
	eor	r2, r5, #1
	str	r0, [r8]
	asr	ip, r5, #1
	ldr	r1, [r3, r2, lsl #2]
	ldr	r2, [r3, ip, lsl #2]
	add	r8, r3, ip, lsl #2
	cmp	r1, r2
	blt	.L13
.L6:
	mov	r0, #1
	ldr	r3, [r7]
	sub	r6, r6, #1
	sub	r3, r3, #1
	lsl	r0, r0, r3
	rsb	r0, r0, r4, lsl r6
	pop	{r4, r5, r6, r7, r8, pc}
.L2:
	ldr	ip, [r7, #4]
	mov	r5, #0
	mov	r8, ip
	mov	r3, ip
	mov	r2, #4
	mov	r4, #1
	b	.L5
	.size	heap_alloc, .-heap_alloc
	.ident	"GCC: (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0"
	.section	.note.GNU-stack,"",%progbits
