	.file	"extr_be_main.c_beiscsi_alloc_mem.c"
	.intel_syntax noprefix
	.text
	.p2align 4
	.type	beiscsi_alloc_mem, @function
beiscsi_alloc_mem:
.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
	push	r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	push	rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	push	rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	mov	rbx, rdi
	sub	rsp, 72
	.cfi_def_cfa_offset 128
	mov	edi, DWORD PTR 36[rdi]
	mov	esi, DWORD PTR GFP_KERNEL[rip]
	mov	rax, QWORD PTR fs:40
	mov	QWORD PTR 56[rsp], rax
	xor	eax, eax
	call	kzalloc@PLT
	mov	QWORD PTR 8[rbx], rax
	test	rax, rax
	je	.L33
	mov	edi, DWORD PTR 32[rbx]
	mov	edx, DWORD PTR GFP_KERNEL[rip]
	mov	esi, 4
	mov	rbp, rax
	call	kcalloc@PLT
	mov	QWORD PTR 16[rbp], rax
	test	rax, rax
	je	.L34
	mov	edx, DWORD PTR GFP_KERNEL[rip]
	mov	edi, DWORD PTR SE_MEM_MAX[rip]
	mov	esi, 48
	call	kcalloc@PLT
	mov	QWORD PTR 16[rbx], rax
	test	rax, rax
	je	.L35
	mov	edx, DWORD PTR GFP_KERNEL[rip]
	mov	edi, DWORD PTR BEISCSI_MAX_FRAGS_INIT[rip]
	mov	esi, 48
	call	kmalloc_array@PLT
	mov	QWORD PTR 40[rsp], rax
	test	rax, rax
	je	.L37
	mov	edx, DWORD PTR SE_MEM_MAX[rip]
	mov	rax, QWORD PTR 16[rbx]
	test	edx, edx
	je	.L7
	mov	QWORD PTR 24[rsp], rax
	lea	rax, 48[rsp]
	xor	r12d, r12d
	mov	QWORD PTR 16[rsp], rax
	jmp	.L15
	.p2align 4,,10
	.p2align 3
.L38:
	mov	QWORD PTR 24[rcx], 0
.L9:
	add	QWORD PTR 24[rsp], 48
	add	r12d, 1
	cmp	DWORD PTR SE_MEM_MAX[rip], r12d
	jbe	.L7
.L15:
	mov	eax, r12d
	mov	rcx, QWORD PTR 24[rsp]
	mov	rsi, rax
	mov	QWORD PTR 32[rsp], rax
	mov	rax, QWORD PTR [rbx]
	mov	rbp, rcx
	mov	r15d, DWORD PTR [rax+rsi*4]
	test	r15d, r15d
	je	.L38
	mov	eax, DWORD PTR BEISCSI_MAX_FRAGS_INIT[rip]
	mov	r13, QWORD PTR 40[rsp]
	xor	esi, esi
	lea	edx, [rax+rax*2]
	mov	rdi, r13
	sal	edx, 4
	call	memset@PLT
	mov	eax, DWORD PTR be_max_phys_size[rip]
	mov	esi, r15d
	sal	eax, 10
	mov	edi, eax
	call	min@PLT
	mov	DWORD PTR 12[rsp], 0
	mov	r14d, eax
	.p2align 4,,10
	.p2align 3
.L10:
	mov	rdi, QWORD PTR 24[rbx]
	mov	ecx, DWORD PTR GFP_KERNEL[rip]
	mov	esi, r14d
	mov	rdx, QWORD PTR 16[rsp]
	call	dma_alloc_coherent@PLT
	mov	DWORD PTR 40[r13], eax
	test	eax, eax
	jne	.L11
	cmp	DWORD PTR BE_MIN_MEM_SIZE[rip], r14d
	jnb	.L12
	mov	edi, r14d
	call	rounddown_pow_of_two@PLT
	cmp	eax, r14d
	je	.L13
	mov	edi, r14d
	call	rounddown_pow_of_two@PLT
	mov	r14d, eax
	jmp	.L10
.L40:
	mov	rdi, QWORD PTR 40[rsp]
	call	kfree@PLT
	mov	rdi, QWORD PTR 16[rbx]
	call	kfree@PLT
	mov	rax, QWORD PTR 8[rbx]
	mov	rdi, QWORD PTR 16[rax]
.L32:
	call	kfree@PLT
.L34:
	mov	rdi, QWORD PTR 8[rbx]
	call	kfree@PLT
.L33:
	mov	eax, DWORD PTR ENOMEM[rip]
	neg	eax
.L1:
	mov	rbx, QWORD PTR 56[rsp]
	xor	rbx, QWORD PTR fs:40
	jne	.L39
	add	rsp, 72
	.cfi_remember_state
	.cfi_def_cfa_offset 56
	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
	mov	rax, QWORD PTR 48[rsp]
	mov	DWORD PTR 0[r13], r14d
	sub	r15d, r14d
	add	r13, 48
	mov	edi, DWORD PTR be_max_phys_size[rip]
	mov	esi, r15d
	mov	QWORD PTR -16[r13], rax
	sal	edi, 10
	call	min@PLT
	add	DWORD PTR 12[rsp], 1
	mov	r14d, eax
	test	r15d, r15d
	jne	.L10
	mov	r15, QWORD PTR 24[rsp]
	mov	r14d, DWORD PTR 12[rsp]
	mov	esi, 48
	mov	rax, QWORD PTR [rbx]
	mov	rdx, QWORD PTR 32[rsp]
	mov	DWORD PTR 4[r15], r14d
	mov	edi, r14d
	mov	eax, DWORD PTR [rax+rdx*4]
	mov	DWORD PTR 8[r15], eax
	mov	edx, DWORD PTR GFP_KERNEL[rip]
	call	kmalloc_array@PLT
	mov	QWORD PTR 24[r15], rax
	mov	rdi, rax
	test	rax, rax
	je	.L12
	lea	edx, [r14+r14*2]
	mov	rsi, QWORD PTR 40[rsp]
	sal	edx, 4
	call	memcpy@PLT
	jmp	.L9
	.p2align 4,,10
	.p2align 3
.L13:
	shr	r14d
	jmp	.L10
.L12:
	mov	rax, QWORD PTR 24[rsp]
	mov	esi, DWORD PTR 12[rsp]
	mov	DWORD PTR 4[rax], esi
	.p2align 4,,10
	.p2align 3
.L19:
	mov	eax, DWORD PTR 12[rsp]
	or	eax, r12d
	je	.L40
	mov	eax, DWORD PTR 4[rbp]
	test	eax, eax
	je	.L17
	sub	eax, 1
	lea	r13, [rax+rax*2]
	sal	r13, 4
	.p2align 4,,10
	.p2align 3
.L18:
	mov	rax, QWORD PTR 24[rbp]
	mov	rdi, QWORD PTR 24[rbx]
	add	rax, r13
	sub	r13, 48
	mov	rcx, QWORD PTR 32[rax]
	mov	edx, DWORD PTR 40[rax]
	mov	esi, DWORD PTR [rax]
	call	dma_free_coherent@PLT
	cmp	r13, -48
	jne	.L18
.L17:
	mov	DWORD PTR 12[rsp], 0
	test	r12d, r12d
	je	.L19
	mov	rdi, QWORD PTR 24[rbp]
	sub	r12d, 1
	sub	rbp, 48
	call	kfree@PLT
	mov	DWORD PTR 12[rsp], 0
	jmp	.L19
.L37:
	mov	rdi, QWORD PTR 16[rbx]
	call	kfree@PLT
.L35:
	mov	rdi, QWORD PTR 16[rbp]
	jmp	.L32
.L7:
	mov	rdi, QWORD PTR 40[rsp]
	call	kfree@PLT
	xor	eax, eax
	jmp	.L1
.L39:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE0:
	.size	beiscsi_alloc_mem, .-beiscsi_alloc_mem
	.comm	be_max_phys_size,4,4
	.comm	SE_MEM_MAX,4,4
	.comm	GFP_KERNEL,4,4
	.comm	ENOMEM,4,4
	.comm	BE_MIN_MEM_SIZE,4,4
	.comm	BEISCSI_MAX_FRAGS_INIT,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_be_main.c_beiscsi_alloc_mem.c"
	.text
	.section	.rodata.cst4,"aM",%progbits,4
	.align	2
.LC0:
	.word	__stack_chk_guard
	.text
	.align	2
	.syntax unified
	.arm
	.fpu softvfp
	.type	beiscsi_alloc_mem, %function
beiscsi_alloc_mem:
	@ args = 0, pretend = 0, frame = 24
	@ frame_needed = 0, uses_anonymous_args = 0
	push	{r4, r5, r6, r7, r8, r9, r10, fp, lr}
	ldr	r10, .L45
	ldr	r3, .L45+4
	mov	r4, r0
	sub	sp, sp, #28
	ldr	r0, [r0, #20]
	ldr	r1, [r10]
	ldr	r3, [r3]
	str	r3, [sp, #20]
	mov	r3,#0
	bl	kzalloc
	cmp	r0, #0
	str	r0, [r4, #4]
	beq	.L38
	mov	r5, r0
	mov	r1, #4
	ldr	r2, [r10]
	ldr	r0, [r4, #16]
	bl	kcalloc
	cmp	r0, #0
	str	r0, [r5, #12]
	beq	.L39
	ldr	r3, .L45+8
	mov	r1, #28
	ldr	r2, [r10]
	ldr	r0, [r3]
	bl	kcalloc
	cmp	r0, #0
	str	r0, [r4, #8]
	beq	.L40
	ldr	r3, .L45+12
	mov	r1, #28
	ldr	r0, [r3]
	ldr	r2, [r10]
	bl	kmalloc_array
	subs	r3, r0, #0
	str	r3, [sp, #12]
	beq	.L42
	ldr	r3, .L45+8
	ldr	r2, [r3]
	ldr	r3, [r4, #8]
	cmp	r2, #0
	beq	.L7
	mov	r6, #0
	mov	r9, r3
	b	.L15
.L9:
	ldr	r3, .L45+8
	add	r6, r6, #1
	ldr	r3, [r3]
	add	r9, r9, #28
	cmp	r3, r6
	bls	.L7
.L15:
	ldr	r3, [r4]
	str	r9, [sp, #8]
	ldr	r5, [r3, r6, lsl #2]
	lsl	r3, r6, #2
	cmp	r5, #0
	str	r3, [sp, #4]
	streq	r5, [r9, #16]
	beq	.L9
	ldr	r3, .L45+12
	ldr	r8, [sp, #12]
	ldr	r2, [r3]
	mov	r1, #0
	rsb	r2, r2, r2, lsl #3
	lsl	r2, r2, #2
	mov	r0, r8
	bl	memset
	ldr	r3, .L45+16
	mov	r1, r5
	ldr	r0, [r3]
	mov	r7, #0
	lsl	r0, r0, #10
	bl	min
	mov	fp, r0
.L10:
	mov	r1, fp
	ldr	r3, [r10]
	ldr	r0, [r4, #12]
	add	r2, sp, #16
	bl	dma_alloc_coherent
	cmp	r0, #0
	str	r0, [r8, #24]
	bne	.L11
	ldr	r3, .L45+20
	ldr	r3, [r3]
	cmp	r3, fp
	bcs	.L35
	mov	r0, fp
	bl	rounddown_pow_of_two
	cmp	r0, fp
	lsreq	fp, fp, #1
	beq	.L10
	mov	r0, fp
	bl	rounddown_pow_of_two
	mov	fp, r0
	b	.L10
.L44:
	ldr	r0, [sp, #12]
	bl	kfree
	ldr	r0, [r4, #8]
	bl	kfree
	ldr	r3, [r4, #4]
	ldr	r0, [r3, #12]
.L37:
	bl	kfree
.L39:
	ldr	r0, [r4, #4]
	bl	kfree
.L38:
	ldr	r3, .L45+24
	ldr	r0, [r3]
	rsb	r0, r0, #0
.L1:
	ldr	r3, .L45+4
	ldr	r2, [r3]
	ldr	r3, [sp, #20]
	eors	r2, r3, r2
	mov	r3, #0
	bne	.L43
	add	sp, sp, #28
	@ sp needed
	pop	{r4, r5, r6, r7, r8, r9, r10, fp, pc}
.L11:
	ldr	r2, .L45+16
	ldr	r3, [sp, #16]
	ldr	r0, [r2]
	sub	r5, r5, fp
	str	r3, [r8, #20]
	mov	r1, r5
	str	fp, [r8], #28
	lsl	r0, r0, #10
	bl	min
	cmp	r5, #0
	mov	fp, r0
	add	r7, r7, #1
	bne	.L10
	ldr	r3, [r4]
	ldr	r2, [sp, #4]
	str	r7, [r9, #4]
	ldr	r3, [r3, r2]
	mov	r1, #28
	str	r3, [r9, #8]
	mov	r0, r7
	ldr	r2, [r10]
	bl	kmalloc_array
	cmp	r0, #0
	str	r0, [r9, #16]
	beq	.L35
	rsb	r7, r7, r7, lsl #3
	ldr	r1, [sp, #12]
	lsl	r2, r7, #2
	bl	memcpy
	b	.L9
.L35:
.L12:
	ldr	r5, [sp, #8]
	str	r7, [r9, #4]
.L19:
	orrs	r3, r7, r6
	beq	.L44
	ldr	r8, [r5, #4]
	cmp	r8, #0
	beq	.L17
	rsb	r7, r8, r8, lsl #3
	lsl	r7, r7, #2
	sub	r7, r7, #28
.L18:
	ldr	r3, [r5, #16]
	ldr	r0, [r4, #12]
	add	r2, r3, r7
	ldr	r1, [r3, r7]
	ldr	r3, [r2, #20]
	ldr	r2, [r2, #24]
	bl	dma_free_coherent
	subs	r8, r8, #1
	sub	r7, r7, #28
	bne	.L18
.L17:
	cmp	r6, #0
	moveq	r7, r6
	beq	.L19
	ldr	r0, [r5, #16]
	bl	kfree
	mov	r7, #0
	sub	r6, r6, #1
	sub	r5, r5, #28
	b	.L19
.L42:
	ldr	r0, [r4, #8]
	bl	kfree
.L40:
	ldr	r0, [r5, #12]
	b	.L37
.L7:
	ldr	r0, [sp, #12]
	bl	kfree
	mov	r0, #0
	b	.L1
.L43:
	bl	__stack_chk_fail
.L46:
	.align	2
.L45:
	.word	GFP_KERNEL
	.word	.LC0
	.word	SE_MEM_MAX
	.word	BEISCSI_MAX_FRAGS_INIT
	.word	be_max_phys_size
	.word	BE_MIN_MEM_SIZE
	.word	ENOMEM
	.size	beiscsi_alloc_mem, .-beiscsi_alloc_mem
	.comm	be_max_phys_size,4,4
	.comm	SE_MEM_MAX,4,4
	.comm	GFP_KERNEL,4,4
	.comm	ENOMEM,4,4
	.comm	BE_MIN_MEM_SIZE,4,4
	.comm	BEISCSI_MAX_FRAGS_INIT,4,4
	.ident	"GCC: (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0"
	.section	.note.GNU-stack,"",%progbits
