// File: Luthaf[P]zeopp/voro++/src/container.cc
// Function: voro::container_base::add_particle_memory(int)
void container_base::add_particle_memory(int i) {
	int l,nmem=mem[i]<<1;

	// Carry out a check on the memory allocation size, and
	// print a status message if requested
	if(nmem>max_particle_memory)
		voro_fatal_error("Absolute maximum memory allocation exceeded",VOROPP_MEMORY_ERROR);
#if VOROPP_VERBOSE >=3
	fprintf(stderr,"Particle memory in region %d scaled up to %d\n",i,nmem);
#endif

	// Allocate new memory and copy in the contents of the old arrays
	int *idp=new int[nmem];
	for(l=0;l<co[i];l++) idp[l]=id[i][l];
	double *pp=new double[ps*nmem];
	for(l=0;l<ps*co[i];l++) pp[l]=p[i][l];

	// Update pointers and delete old arrays
	mem[i]=nmem;
	delete [] id[i];id[i]=idp;
	delete [] p[i];p[i]=pp;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x30(%rbp)
movq 0xc8(%rax), %rax
movslq -0xc(%rbp), %rcx
movl (%rax,%rcx,4), %eax
shll %eax
movl %eax, -0x14(%rbp)
cmpl $0x1000000, -0x14(%rbp) # imm = 0x1000000
jle 0x1cf24
leaq 0x3af3d(%rip), %rdi     # 0x57e57
movl $0x2, %esi
callq 0x1b690
movslq -0x14(%rbp), %rax
movl $0x4, %ecx
mulq %rcx
movq %rax, %rdi
seto %cl
movq $-0x1, %rax
testb $0x1, %cl
cmovneq %rax, %rdi
callq 0x2030
movq %rax, -0x20(%rbp)
movl $0x0, -0x10(%rbp)
movq -0x30(%rbp), %rcx
movl -0x10(%rbp), %eax
movq 0xc0(%rcx), %rcx
movslq -0xc(%rbp), %rdx
cmpl (%rcx,%rdx,4), %eax
jge 0x1cf9b
movq -0x30(%rbp), %rax
movq 0xb0(%rax), %rax
movslq -0xc(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movslq -0x10(%rbp), %rcx
movl (%rax,%rcx,4), %edx
movq -0x20(%rbp), %rax
movslq -0x10(%rbp), %rcx
movl %edx, (%rax,%rcx,4)
movl -0x10(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x10(%rbp)
jmp 0x1cf54
movq -0x30(%rbp), %rax
movl 0xd0(%rax), %eax
imull -0x14(%rbp), %eax
cltq
movl $0x8, %ecx
mulq %rcx
movq %rax, %rdi
seto %cl
movq $-0x1, %rax
testb $0x1, %cl
cmovneq %rax, %rdi
callq 0x2030
movq %rax, -0x28(%rbp)
movl $0x0, -0x10(%rbp)
movq -0x30(%rbp), %rdx
movl -0x10(%rbp), %eax
movl 0xd0(%rdx), %ecx
movq 0xc0(%rdx), %rdx
movslq -0xc(%rbp), %rsi
imull (%rdx,%rsi,4), %ecx
cmpl %ecx, %eax
jge 0x1d02b
movq -0x30(%rbp), %rax
movq 0xb8(%rax), %rax
movslq -0xc(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movslq -0x10(%rbp), %rcx
movsd (%rax,%rcx,8), %xmm0
movq -0x28(%rbp), %rax
movslq -0x10(%rbp), %rcx
movsd %xmm0, (%rax,%rcx,8)
movl -0x10(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x10(%rbp)
jmp 0x1cfd7
movq -0x30(%rbp), %rax
movl -0x14(%rbp), %esi
movq 0xc8(%rax), %rcx
movslq -0xc(%rbp), %rdx
movl %esi, (%rcx,%rdx,4)
movq 0xb0(%rax), %rax
movslq -0xc(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq %rax, -0x38(%rbp)
cmpq $0x0, %rax
je 0x1d062
movq -0x38(%rbp), %rdi
callq 0x2180
movq -0x30(%rbp), %rax
movq -0x20(%rbp), %rsi
movq 0xb0(%rax), %rcx
movslq -0xc(%rbp), %rdx
movq %rsi, (%rcx,%rdx,8)
movq 0xb8(%rax), %rax
movslq -0xc(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq %rax, -0x40(%rbp)
cmpq $0x0, %rax
je 0x1d09b
movq -0x40(%rbp), %rdi
callq 0x2180
movq -0x30(%rbp), %rax
movq -0x28(%rbp), %rdx
movq 0xb8(%rax), %rax
movslq -0xc(%rbp), %rcx
movq %rdx, (%rax,%rcx,8)
addq $0x40, %rsp
popq %rbp
retq
nopl (%rax,%rax)