// File: Luthaf[P]zeopp/v_network.cc
// Function: voronoi_network::add_network_memory(int)
void voronoi_network::add_network_memory(int l) {
	ptsmem[l]<<=1;
	
	// Check to see that an absolute maximum in memory allocation
	// has not been reached, to prevent runaway allocation
	if(ptsmem[l]>max_network_vertex_memory)
		voro_fatal_error("Container vertex maximum memory allocation exceeded",VOROPP_MEMORY_ERROR);
	
	// Allocate new arrays
	double *npts(new double[4*ptsmem[l]]);
	int *nidmem(new int[ptsmem[l]]);

	// Copy the contents of the old arrays into the new ones
	for(int i=0;i<4*ptsc[l];i++) npts[i]=pts[l][i];
	for(int i=0;i<ptsc[l];i++) nidmem[i]=idmem[l][i];

	// Delete old arrays and update pointers to the new ones
	delete [] pts[l];delete [] idmem[l];
	pts[l]=npts;idmem[l]=nidmem;
}

// 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 0x78(%rax), %rcx
movslq -0xc(%rbp), %rdx
movl (%rcx,%rdx,4), %esi
shll %esi
movl %esi, (%rcx,%rdx,4)
movq 0x78(%rax), %rax
movslq -0xc(%rbp), %rcx
cmpl $0x10000, (%rax,%rcx,4) # imm = 0x10000
jle 0xe3019
leaq 0x118bf4(%rip), %rdi    # 0x1fbc03
movl $0x2, %esi
callq 0x1bd150
movq -0x30(%rbp), %rax
movq 0x78(%rax), %rax
movslq -0xc(%rbp), %rcx
movl (%rax,%rcx,4), %eax
shll $0x2, %eax
cltq
movl $0x8, %ecx
mulq %rcx
movq %rax, %rdi
seto %cl
movq $-0x1, %rax
testb $0x1, %cl
cmovneq %rax, %rdi
callq 0x5030
movq %rax, %rcx
movq -0x30(%rbp), %rax
movq %rcx, -0x18(%rbp)
movq 0x78(%rax), %rax
movslq -0xc(%rbp), %rcx
movslq (%rax,%rcx,4), %rax
movl $0x4, %ecx
mulq %rcx
movq %rax, %rdi
seto %cl
movq $-0x1, %rax
testb $0x1, %cl
cmovneq %rax, %rdi
callq 0x5030
movq %rax, -0x20(%rbp)
movl $0x0, -0x24(%rbp)
movq -0x30(%rbp), %rcx
movl -0x24(%rbp), %eax
movq 0x70(%rcx), %rcx
movslq -0xc(%rbp), %rdx
movl (%rcx,%rdx,4), %ecx
shll $0x2, %ecx
cmpl %ecx, %eax
jge 0xe30db
movq -0x30(%rbp), %rax
movq 0x60(%rax), %rax
movslq -0xc(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movslq -0x24(%rbp), %rcx
movsd (%rax,%rcx,8), %xmm0
movq -0x18(%rbp), %rax
movslq -0x24(%rbp), %rcx
movsd %xmm0, (%rax,%rcx,8)
movl -0x24(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x24(%rbp)
jmp 0xe3091
movl $0x0, -0x28(%rbp)
movq -0x30(%rbp), %rcx
movl -0x28(%rbp), %eax
movq 0x70(%rcx), %rcx
movslq -0xc(%rbp), %rdx
cmpl (%rcx,%rdx,4), %eax
jge 0xe3123
movq -0x30(%rbp), %rax
movq 0x68(%rax), %rax
movslq -0xc(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movslq -0x28(%rbp), %rcx
movl (%rax,%rcx,4), %edx
movq -0x20(%rbp), %rax
movslq -0x28(%rbp), %rcx
movl %edx, (%rax,%rcx,4)
movl -0x28(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x28(%rbp)
jmp 0xe30e2
movq -0x30(%rbp), %rax
movq 0x60(%rax), %rax
movslq -0xc(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq %rax, -0x38(%rbp)
cmpq $0x0, %rax
je 0xe3146
movq -0x38(%rbp), %rdi
callq 0x56c0
movq -0x30(%rbp), %rax
movq 0x68(%rax), %rax
movslq -0xc(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq %rax, -0x40(%rbp)
cmpq $0x0, %rax
je 0xe3169
movq -0x40(%rbp), %rdi
callq 0x56c0
movq -0x30(%rbp), %rax
movq -0x18(%rbp), %rsi
movq 0x60(%rax), %rcx
movslq -0xc(%rbp), %rdx
movq %rsi, (%rcx,%rdx,8)
movq -0x20(%rbp), %rdx
movq 0x68(%rax), %rax
movslq -0xc(%rbp), %rcx
movq %rdx, (%rax,%rcx,8)
addq $0x40, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)