	.file	"extr_packet.c_setup_buffers.c"
	.intel_syntax noprefix
	.text
	.section	.rodata.str1.8,"aMS",@progbits,1
	.align 8
.LC0:
	.string	"invalid param: %d is not a valid card id\n"
	.align 8
.LC1:
	.string	"%s: setting up channel buffer space in shared RAM\n"
	.align 8
.LC2:
	.string	"%s: calculating buffer space: %d buffers, %d big\n"
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC3:
	.string	"%s: not enough buffer space\n"
	.section	.rodata.str1.8
	.align 8
.LC4:
	.string	"%s: channel buffer offset from shared RAM: 0x%x\n"
	.align 8
.LC5:
	.string	"%s: send buffer setup complete: first=0x%lx n=%d f=%d, nxt=%d\n"
	.section	.rodata.str1.1
.LC6:
	.string	"%s: adding %d RecvBuffers:\n"
	.section	.rodata.str1.8
	.align 8
.LC7:
	.string	"%s: adding RcvBuffer #%d offset=0x%lx sz=%d bufsz:%d\n"
	.text
	.p2align 4
	.globl	setup_buffers
	.type	setup_buffers, @function
setup_buffers:
.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
	mov	r12d, edi
	push	rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	push	rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	sub	rsp, 56
	.cfi_def_cfa_offset 112
	mov	rax, QWORD PTR fs:40
	mov	QWORD PTR 40[rsp], rax
	xor	eax, eax
	call	IS_VALID_CARD@PLT
	test	eax, eax
	je	.L10
	movsx	r15, r12d
	lea	rdi, .LC1[rip]
	lea	rax, 0[0+r15*8]
	mov	QWORD PTR 8[rsp], rax
	mov	rax, QWORD PTR sc_adapter[rip]
	mov	rax, QWORD PTR [rax+r15*8]
	mov	esi, DWORD PTR 4[rax]
	xor	eax, eax
	call	pr_debug@PLT
	mov	rax, QWORD PTR sc_adapter[rip]
	xor	edx, edx
	mov	ebx, DWORD PTR BUFFER_SIZE[rip]
	lea	rdi, .LC2[rip]
	mov	rcx, QWORD PTR [rax+r15*8]
	mov	eax, DWORD PTR [rcx]
	sub	eax, DWORD PTR BUFFER_BASE[rip]
	div	ebx
	mov	esi, DWORD PTR 4[rcx]
	mov	ecx, ebx
	shr	eax
	cmp	DWORD PTR BUFFERS_MAX[rip], eax
	cmovbe	eax, DWORD PTR BUFFERS_MAX[rip]
	mov	ebp, eax
	mov	edx, eax
	xor	eax, eax
	call	pr_debug@PLT
	cmp	ebp, 1
	jbe	.L11
	lea	edx, -1[r13]
	mov	rax, QWORD PTR sc_adapter[rip]
	lea	rdi, .LC4[rip]
	movsx	r14, r13d
	imul	edx, ebx
	sal	r14, 4
	mov	rax, QWORD PTR [rax+r15*8]
	imul	edx, ebp
	mov	esi, DWORD PTR 4[rax]
	xor	eax, eax
	shr	ebp
	mov	DWORD PTR 24[rsp], edx
	call	pr_debug@PLT
	mov	edx, DWORD PTR 24[rsp]
	xor	r9d, r9d
	mov	r8d, ebp
	mov	rax, QWORD PTR sc_adapter[rip]
	add	edx, DWORD PTR BUFFER_BASE[rip]
	lea	rdi, .LC5[rip]
	mov	rcx, QWORD PTR [rax+r15*8]
	lea	rax, -16[r14]
	xor	r14d, r14d
	mov	QWORD PTR 16[rsp], rax
	add	rax, QWORD PTR 8[rcx]
	mov	esi, DWORD PTR 4[rcx]
	mov	ecx, ebp
	mov	DWORD PTR [rax], edx
	mov	DWORD PTR 4[rax], ebp
	mov	DWORD PTR 8[rax], ebp
	mov	DWORD PTR 12[rax], 0
	xor	eax, eax
	call	pr_debug@PLT
	mov	rax, QWORD PTR sc_adapter[rip]
	mov	edx, ebp
	lea	rdi, .LC6[rip]
	mov	rax, QWORD PTR [rax+r15*8]
	mov	r15d, ebp
	imul	r15d, ebx
	mov	esi, DWORD PTR 4[rax]
	xor	eax, eax
	call	pr_debug@PLT
	lea	rax, 32[rsp]
	mov	QWORD PTR 24[rsp], rax
	.p2align 4,,10
	.p2align 3
.L5:
	mov	rdi, QWORD PTR 8[rsp]
	add	r14d, 1
	mov	r9d, ebx
	mov	r8d, ebx
	mov	rax, QWORD PTR sc_adapter[rip]
	mov	rax, QWORD PTR [rax+rdi]
	mov	rdi, QWORD PTR 16[rsp]
	mov	rdx, QWORD PTR 8[rax]
	mov	esi, DWORD PTR 4[rax]
	xor	eax, eax
	mov	ecx, DWORD PTR [rdx+rdi]
	mov	edx, r14d
	lea	rdi, .LC7[rip]
	mov	DWORD PTR 36[rsp], ebx
	add	ecx, r15d
	add	r15d, ebx
	mov	DWORD PTR 32[rsp], ecx
	call	pr_debug@PLT
	push	QWORD PTR 24[rsp]
	.cfi_def_cfa_offset 120
	mov	r9d, r13d
	mov	edx, DWORD PTR ceReqTypeLnk[rip]
	mov	r8d, DWORD PTR ceReqLnkRead[rip]
	push	8
	.cfi_def_cfa_offset 128
	mov	edi, r12d
	mov	ecx, DWORD PTR ceReqClass1[rip]
	mov	esi, DWORD PTR CEPID[rip]
	call	sendmessage@PLT
	pop	rax
	.cfi_def_cfa_offset 120
	pop	rdx
	.cfi_def_cfa_offset 112
	cmp	ebp, r14d
	jne	.L5
	xor	eax, eax
.L1:
	mov	rbx, QWORD PTR 40[rsp]
	xor	rbx, QWORD PTR fs:40
	jne	.L12
	add	rsp, 56
	.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
.L10:
	.cfi_restore_state
	mov	esi, r12d
	lea	rdi, .LC0[rip]
	call	pr_debug@PLT
	mov	eax, DWORD PTR ENODEV[rip]
	neg	eax
	jmp	.L1
.L11:
	mov	rax, QWORD PTR sc_adapter[rip]
	lea	rdi, .LC3[rip]
	mov	rax, QWORD PTR [rax+r15*8]
	mov	esi, DWORD PTR 4[rax]
	xor	eax, eax
	call	pr_debug@PLT
	mov	eax, -1
	jmp	.L1
.L12:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE0:
	.size	setup_buffers, .-setup_buffers
	.comm	sc_adapter,8,8
	.comm	ceReqTypeLnk,4,4
	.comm	ceReqLnkRead,4,4
	.comm	ceReqClass1,4,4
	.comm	ENODEV,4,4
	.comm	CEPID,4,4
	.comm	BUFFER_SIZE,4,4
	.comm	BUFFER_BASE,4,4
	.comm	BUFFERS_MAX,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_packet.c_setup_buffers.c"
	.text
	.section	.rodata.str1.4,"aMS",%progbits,1
	.align	2
.LC0:
	.ascii	"invalid param: %d is not a valid card id\012\000"
	.align	2
.LC1:
	.ascii	"%s: setting up channel buffer space in shared RAM\012"
	.ascii	"\000"
	.global	__aeabi_uidiv
	.align	2
.LC2:
	.ascii	"%s: calculating buffer space: %d buffers, %d big\012"
	.ascii	"\000"
	.align	2
.LC3:
	.ascii	"%s: not enough buffer space\012\000"
	.align	2
.LC4:
	.ascii	"%s: channel buffer offset from shared RAM: 0x%x\012"
	.ascii	"\000"
	.align	2
.LC5:
	.ascii	"%s: send buffer setup complete: first=0x%lx n=%d f="
	.ascii	"%d, nxt=%d\012\000"
	.align	2
.LC6:
	.ascii	"%s: adding %d RecvBuffers:\012\000"
	.align	2
.LC7:
	.ascii	"%s: adding RcvBuffer #%d offset=0x%lx sz=%d bufsz:%"
	.ascii	"d\012\000"
	.section	.rodata.cst4,"aM",%progbits,4
	.align	2
.LC8:
	.word	__stack_chk_guard
	.text
	.align	2
	.global	setup_buffers
	.syntax unified
	.arm
	.fpu softvfp
	.type	setup_buffers, %function
setup_buffers:
	@ args = 0, pretend = 0, frame = 32
	@ frame_needed = 0, uses_anonymous_args = 0
	push	{r4, r5, r6, r7, r8, r9, r10, fp, lr}
	ldr	r3, .L13
	sub	sp, sp, #52
	str	r1, [sp, #20]
	ldr	r3, [r3]
	str	r3, [sp, #44]
	mov	r3,#0
	mov	r8, r0
	bl	IS_VALID_CARD
	cmp	r0, #0
	beq	.L10
	ldr	r9, .L13+4
	lsl	r2, r8, #2
	ldr	r3, [r9]
	ldr	r0, .L13+8
	ldr	r3, [r3, r8, lsl #2]
	str	r2, [sp, #24]
	ldr	r1, [r3, #4]
	bl	pr_debug
	ldr	r3, [r9]
	ldr	r2, .L13+12
	ldr	r5, [r3, r8, lsl #2]
	ldr	r6, .L13+16
	ldr	r4, [r2]
	ldr	r3, [r6]
	ldr	r0, [r5]
	mov	r1, r4
	sub	r0, r0, r3
	bl	__aeabi_uidiv
	ldr	r3, .L13+20
	lsr	r7, r0, #1
	ldr	r0, [r3]
	ldr	r1, [r5, #4]
	cmp	r7, r0
	movcs	r7, r0
	mov	r3, r4
	mov	r2, r7
	ldr	r0, .L13+24
	bl	pr_debug
	cmp	r7, #1
	bls	.L11
	mov	r5, #0
	ldr	fp, [sp, #20]
	ldr	r3, [r9]
	sub	r10, fp, #1
	mul	r10, r4, r10
	mul	r10, r7, r10
	ldr	r3, [r3, r8, lsl #2]
	mov	r2, r10
	ldr	r1, [r3, #4]
	ldr	r0, .L13+28
	bl	pr_debug
	ldr	r3, [r9]
	ldr	r2, [r6]
	ldr	r3, [r3, r8, lsl #2]
	sub	ip, fp, #-268435455
	ldr	r0, [r3, #8]
	ldr	r1, [r3, #4]
	lsr	r7, r7, #1
	add	r3, r0, ip, lsl #4
	add	r2, r10, r2
	str	r2, [r0, ip, lsl #4]
	str	r7, [r3, #4]
	str	r7, [r3, #8]
	str	r5, [r3, #12]
	lsl	ip, ip, #4
	mov	r3, r7
	ldr	r0, .L13+32
	str	r5, [sp, #4]
	str	r7, [sp]
	str	ip, [sp, #28]
	bl	pr_debug
	ldr	r3, [r9]
	mov	r2, r7
	ldr	r3, [r3, r8, lsl #2]
	ldr	r0, .L13+36
	ldr	r1, [r3, #4]
	bl	pr_debug
	mul	r6, r4, r7
	ldr	fp, .L13+40
	ldr	r10, .L13+44
.L5:
	ldr	r2, [sp, #24]
	ldr	r3, [r9]
	add	r5, r5, #1
	ldr	r3, [r3, r2]
	mov	r2, r5
	ldr	r0, [r3, #8]
	ldr	r1, [r3, #4]
	ldr	r3, [sp, #28]
	ldr	r3, [r0, r3]
	mov	r0, r10
	add	r3, r6, r3
	str	r4, [sp, #4]
	str	r4, [sp]
	str	r3, [sp, #36]
	str	r4, [sp, #40]
	bl	pr_debug
	add	r2, sp, #36
	ldr	r3, [fp]
	str	r2, [sp, #12]
	mov	r2, #8
	str	r2, [sp, #8]
	ldr	r2, [sp, #20]
	str	r3, [sp]
	str	r2, [sp, #4]
	ldr	r3, .L13+48
	ldr	r2, .L13+52
	ldr	r1, .L13+56
	mov	r0, r8
	ldr	r3, [r3]
	ldr	r2, [r2]
	ldr	r1, [r1]
	bl	sendmessage
	cmp	r7, r5
	add	r6, r6, r4
	bne	.L5
	mov	r0, #0
.L1:
	ldr	r3, .L13
	ldr	r2, [r3]
	ldr	r3, [sp, #44]
	eors	r2, r3, r2
	mov	r3, #0
	bne	.L12
	add	sp, sp, #52
	@ sp needed
	pop	{r4, r5, r6, r7, r8, r9, r10, fp, pc}
.L10:
	mov	r1, r8
	ldr	r0, .L13+60
	bl	pr_debug
	ldr	r3, .L13+64
	ldr	r0, [r3]
	rsb	r0, r0, #0
	b	.L1
.L11:
	ldr	r3, [r9]
	ldr	r0, .L13+68
	ldr	r3, [r3, r8, lsl #2]
	ldr	r1, [r3, #4]
	bl	pr_debug
	mvn	r0, #0
	b	.L1
.L12:
	bl	__stack_chk_fail
.L14:
	.align	2
.L13:
	.word	.LC8
	.word	sc_adapter
	.word	.LC1
	.word	BUFFER_SIZE
	.word	BUFFER_BASE
	.word	BUFFERS_MAX
	.word	.LC2
	.word	.LC4
	.word	.LC5
	.word	.LC6
	.word	ceReqLnkRead
	.word	.LC7
	.word	ceReqClass1
	.word	ceReqTypeLnk
	.word	CEPID
	.word	.LC0
	.word	ENODEV
	.word	.LC3
	.size	setup_buffers, .-setup_buffers
	.comm	sc_adapter,4,4
	.comm	ceReqTypeLnk,4,4
	.comm	ceReqLnkRead,4,4
	.comm	ceReqClass1,4,4
	.comm	ENODEV,4,4
	.comm	CEPID,4,4
	.comm	BUFFER_SIZE,4,4
	.comm	BUFFER_BASE,4,4
	.comm	BUFFERS_MAX,4,4
	.ident	"GCC: (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0"
	.section	.note.GNU-stack,"",%progbits
