// File: /workspace/github_cpp_makefile_star2_O2/Luthaf[P]zeopp/v_network.cc
// Function: voronoi_network::voronoi_network<voro::container_periodic>(voro::container_periodic&, double)
voronoi_network::voronoi_network(c_class &c,double net_tol_) :
	bx(c.bx), bxy(c.bxy), by(c.by), bxz(c.bxz), byz(c.byz), bz(c.bz),
	nx(c.nx), ny(c.ny), nz(c.nz), nxyz(nx*ny*nz),
	xsp(nx/bx), ysp(ny/by), zsp(nz/bz), net_tol(net_tol_) {
	int l;

	// Allocate memory for vertex structure
	pts=new double*[nxyz];
	idmem=new int*[nxyz];
	ptsc=new int[nxyz];
	ptsmem=new int[nxyz];
	for(l=0;l<nxyz;l++) {
		pts[l]=new double[4*init_network_vertex_memory];
		idmem[l]=new int[init_network_vertex_memory];
		ptsc[l]=0;ptsmem[l]=init_network_vertex_memory;
	}

	// Allocate memory for network edges and related statistics 
	edc=0;edmem=init_network_vertex_memory*nxyz;
	ed=new int*[edmem];
	ne=new int*[edmem];
	pered=new unsigned int*[edmem];
	raded=new block*[edmem];
	nu=new int[edmem];
	nec=new int[edmem];
	numem=new int[edmem];

	// Allocate memory for back pointers
	reg=new int[edmem];
	regp=new int[edmem];

	// Allocate edge memory
	for(l=0;l<edmem;l++) {
		ed[l]=new int[2*init_network_edge_memory];
		ne[l]=ed[l]+init_network_edge_memory;
	}
	for(l=0;l<edmem;l++) raded[l]=new block[init_network_edge_memory];
	for(l=0;l<edmem;l++) pered[l]=new unsigned int[init_network_edge_memory];
	for(l=0;l<edmem;l++) {nu[l]=nec[l]=0;numem[l]=init_network_edge_memory;}

	// vertices
	vmap=new int[4*init_vertices];
	map_mem=init_vertices;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
movupd (%rsi), %xmm1
movupd %xmm1, (%rdi)
movupd 0x10(%rsi), %xmm2
movupd %xmm2, 0x10(%rdi)
movupd 0x20(%rsi), %xmm3
movupd %xmm3, 0x20(%rdi)
movl 0x130(%rsi), %eax
movl %eax, 0x38(%rdi)
movq 0x128(%rsi), %r13
movq %r13, %xmm4
movq %r13, 0x30(%rdi)
pshufd $0x55, %xmm4, %xmm5     # xmm5 = xmm4[1,1,1,1]
movd %xmm5, %ecx
imull %eax, %r13d
imull %ecx, %r13d
cvtdq2pd %xmm4, %xmm4
movl %r13d, 0x3c(%rdi)
unpcklpd %xmm2, %xmm1            # xmm1 = xmm1[0],xmm2[0]
divpd %xmm1, %xmm4
movupd %xmm4, 0x40(%rdi)
cvtsi2sd %eax, %xmm1
unpckhpd %xmm3, %xmm3            # xmm3 = xmm3[1,1]
divsd %xmm3, %xmm1
movsd %xmm1, 0x50(%rdi)
movsd %xmm0, 0x58(%rdi)
movslq %r13d, %rax
leaq (,%rax,8), %r14
testl %eax, %eax
pushq $-0x1
popq %rcx
cmovsq %rcx, %r14
leaq (,%rax,4), %r15
cmovsq %rcx, %r15
movq %r14, %rdi
callq 0x4030
movq %rax, 0x60(%rbx)
movq %r14, %rdi
callq 0x4030
movq %rax, 0x68(%rbx)
movq %r15, %rdi
callq 0x4030
movq %rax, 0x70(%rbx)
movq %r15, %rdi
callq 0x4030
movq %rax, 0x78(%rbx)
xorl %r14d, %r14d
movslq %r13d, %rax
cmpq %rax, %r14
jge 0x61388
movl $0x800, %edi            # imm = 0x800
callq 0x4030
movq 0x60(%rbx), %rcx
movq %rax, (%rcx,%r14,8)
movl $0x100, %edi            # imm = 0x100
callq 0x4030
movq 0x68(%rbx), %rcx
movq %rax, (%rcx,%r14,8)
movq 0x70(%rbx), %rax
andl $0x0, (%rax,%r14,4)
movq 0x78(%rbx), %rax
movl $0x40, (%rax,%r14,4)
incq %r14
movl 0x3c(%rbx), %r13d
jmp 0x6133e
andl $0x0, 0xa0(%rbx)
movl %r13d, %ebp
shll $0x6, %ebp
movl %ebp, 0xa4(%rbx)
movslq %ebp, %r12
leaq (,%r12,8), %r15
testl %r13d, %r13d
pushq $-0x1
popq %rax
cmovsq %rax, %r15
leaq (,%r12,4), %r14
cmovsq %rax, %r14
movq %r15, %rdi
callq 0x4030
movq %rax, 0x80(%rbx)
movq %r15, %rdi
callq 0x4030
movq %rax, 0x88(%rbx)
movq %r15, %rdi
callq 0x4030
movq %rax, 0x98(%rbx)
movq %r15, %rdi
callq 0x4030
movq %rax, 0x90(%rbx)
movq %r14, %rdi
callq 0x4030
movq %rax, 0xa8(%rbx)
movq %r14, %rdi
callq 0x4030
movq %rax, 0xb0(%rbx)
movq %r14, %rdi
callq 0x4030
movq %rax, 0xb8(%rbx)
movq %r14, %rdi
callq 0x4030
movq %rax, 0xc0(%rbx)
movq %r14, %rdi
callq 0x4030
movq %rax, 0xc8(%rbx)
xorl %r15d, %r15d
testl %r12d, %r12d
cmovlel %r15d, %r12d
pushq $0x20
popq %r14
cmpq %r15, %r12
je 0x61488
movq %r14, %rdi
callq 0x4030
movq 0x80(%rbx), %rcx
movq %rax, (%rcx,%r15,8)
movq 0x80(%rbx), %rax
movq 0x88(%rbx), %rcx
movq (%rax,%r15,8), %rax
addq $0x10, %rax
movq %rax, (%rcx,%r15,8)
incq %r15
jmp 0x61451
xorl %r15d, %r15d
pushq $0x40
popq %r14
cmpq %r15, %r12
je 0x614ac
movq %r14, %rdi
callq 0x4030
movq 0x90(%rbx), %rcx
movq %rax, (%rcx,%r15,8)
incq %r15
jmp 0x6148f
xorl %r15d, %r15d
pushq $0x10
popq %r14
cmpq %r15, %r12
je 0x614d0
movq %r14, %rdi
callq 0x4030
movq 0x98(%rbx), %rcx
movq %rax, (%rcx,%r15,8)
incq %r15
jmp 0x614b3
movq 0xa8(%rbx), %rax
movq 0xb0(%rbx), %rcx
movq 0xb8(%rbx), %rdx
xorl %esi, %esi
movslq %ebp, %rdi
cmpq %rdi, %rsi
jge 0x61509
andl $0x0, (%rcx,%rsi,4)
andl $0x0, (%rax,%rsi,4)
movl $0x4, (%rdx,%rsi,4)
incq %rsi
movl 0xa4(%rbx), %ebp
jmp 0x614e7
movl $0x1000, %edi           # imm = 0x1000
callq 0x4030
movq %rax, 0xd0(%rbx)
movl $0x100, 0xd8(%rbx)      # imm = 0x100
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop