// File: /workspace/github_cpp_makefile_star2_O3/Luthaf[P]zeopp/network.cc
// Function: extendUnitCell(ATOM_NETWORK*, ATOM_NETWORK*, int, int, int)
void extendUnitCell(ATOM_NETWORK *cell, ATOM_NETWORK *newCell, int xfactor, int yfactor, int zfactor){
  newCell->a = cell->a*xfactor;
  newCell->b = cell->b*yfactor;
  newCell->c = cell->c*zfactor;
  newCell->alpha = cell->alpha;
  newCell->beta = cell->beta;
  newCell->gamma = cell->gamma;
  newCell->initialize();

  int numAtoms = 0;
  newCell->atoms.clear();
  for(unsigned int i = 0; i<cell->atoms.size(); i++){
    ATOM oldAtom = cell->atoms.at(i);
    for(int j = 0; j < xfactor; j++){
      for(int k = 0; k < yfactor; k++){
	for(int m = 0; m < zfactor; m++){
	  ATOM newAtom;
	  newAtom.specialID = i;
	  newAtom.type = oldAtom.type;
	  newAtom.radius = oldAtom.radius;
	  newAtom.a_coord = oldAtom.a_coord/xfactor + j*1.0/xfactor;
	  newAtom.b_coord = oldAtom.b_coord/yfactor + k*1.0/yfactor;
	  newAtom.c_coord = oldAtom.c_coord/zfactor + m*1.0/zfactor;
	  Point newCoords = newCell->abc_to_xyz(newAtom.a_coord, newAtom.b_coord, newAtom.c_coord);
	  newAtom.x = newCoords[0];
	  newAtom.y = newCoords[1];
	  newAtom.z = newCoords[2];
	  newCell->atoms.push_back(newAtom);
	  numAtoms++;
	}
      }
    }
  }
  newCell->numAtoms = numAtoms;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x1c8, %rsp            # imm = 0x1C8
movl %r8d, %ebp
movl %ecx, %r12d
movq %rsi, %rbx
movq %rdi, %r14
movd %ecx, %xmm0
movl %edx, 0x8(%rsp)
movd %edx, %xmm1
punpckldq %xmm0, %xmm1    # xmm1 = xmm1[0],xmm0[0],xmm1[1],xmm0[1]
cvtdq2pd %xmm1, %xmm1
movupd 0x8(%rdi), %xmm0
movapd %xmm1, 0x40(%rsp)
mulpd %xmm1, %xmm0
xorps %xmm1, %xmm1
cvtsi2sd %r8d, %xmm1
movupd %xmm0, 0x8(%rsi)
movsd 0x18(%rdi), %xmm0
movapd %xmm1, 0x30(%rsp)
mulsd %xmm1, %xmm0
movsd %xmm0, 0x18(%rsi)
movups 0x20(%rdi), %xmm0
movups %xmm0, 0x20(%rsi)
movsd 0x30(%rdi), %xmm0
movsd %xmm0, 0x30(%rsi)
movq %rsi, %rdi
callq 0x51db4
leaq 0x2f0(%rbx), %r13
movq %rbx, 0x18(%rsp)
movq 0x2f0(%rbx), %rsi
movq %r13, %rdi
callq 0x12ea6
movq 0x2f0(%r14), %rdx
movq %r14, 0x58(%rsp)
cmpq %rdx, 0x2f8(%r14)
je 0x8107
xorl %r15d, %r15d
testl %ebp, %ebp
movl $0x0, %eax
movl %ebp, %r14d
cmovgl %ebp, %eax
movl %r12d, 0xc(%rsp)
imull %r12d, %eax
movl %eax, 0x10(%rsp)
movaps 0x40(%rsp), %xmm0
movhlps %xmm0, %xmm0            # xmm0 = xmm0[1,1]
movaps %xmm0, 0x190(%rsp)
movapd 0x30(%rsp), %xmm0
unpcklpd %xmm0, %xmm0            # xmm0 = xmm0[0,0]
movapd %xmm0, 0x30(%rsp)
leaq 0xf8(%rsp), %rbp
leaq 0x1b0(%rsp), %r12
movl $0x0, (%rsp)
imulq $0x98, %r15, %rbx
movupd (%rdx,%rbx), %xmm0
movupd 0x10(%rdx,%rbx), %xmm1
movupd 0x20(%rdx,%rbx), %xmm2
movups 0x30(%rdx,%rbx), %xmm3
movaps %xmm3, 0x90(%rsp)
movapd %xmm2, 0x80(%rsp)
movapd %xmm1, 0x70(%rsp)
movapd %xmm0, 0x60(%rsp)
leaq 0xb0(%rsp), %rax
movq %rax, 0xa0(%rsp)
movq 0x40(%rdx,%rbx), %rsi
movq %rdx, 0x20(%rsp)
movq 0x48(%rdx,%rbx), %rdx
addq %rsi, %rdx
leaq 0xa0(%rsp), %rdi
callq 0xf3ce
leaq 0xd0(%rsp), %rax
movq %rax, 0xc0(%rsp)
movq 0x20(%rsp), %rax
movq 0x60(%rax,%rbx), %rsi
movq 0x68(%rax,%rbx), %rdx
addq %rsi, %rdx
leaq 0xc0(%rsp), %rdi
callq 0xf3ce
movq 0x20(%rsp), %rcx
addq %rbx, %rcx
movb 0x90(%rcx), %al
leaq 0xa0(%rsp), %rdx
movb %al, 0x50(%rdx)
movupd 0x80(%rcx), %xmm0
movupd %xmm0, 0x40(%rdx)
cmpl $0x0, 0x8(%rsp)
jle 0x8087
xorl %eax, %eax
cmpl $0x0, 0xc(%rsp)
jle 0x807b
movl %eax, 0x14(%rsp)
xorps %xmm0, %xmm0
cvtsi2sd %eax, %xmm0
divsd 0x40(%rsp), %xmm0
movapd %xmm0, 0x1a0(%rsp)
movl (%rsp), %eax
addl 0x10(%rsp), %eax
movl %eax, (%rsp)
movl $0x0, 0x4(%rsp)
testl %r14d, %r14d
jle 0x8063
xorps %xmm0, %xmm0
cvtsi2sdl 0x4(%rsp), %xmm0
divsd 0x190(%rsp), %xmm0
movapd 0x1a0(%rsp), %xmm1
unpcklpd %xmm0, %xmm1            # xmm1 = xmm1[0],xmm0[0]
movapd %xmm1, 0x20(%rsp)
xorl %ebx, %ebx
movq %rbp, %rdi
callq 0x51264
movl %r15d, 0x178(%rsp)
leaq 0x138(%rsp), %rdi
leaq 0xa0(%rsp), %rsi
callq 0x4240
movsd 0x90(%rsp), %xmm0
movsd %xmm0, 0x128(%rsp)
movupd 0x78(%rsp), %xmm0
divpd 0x40(%rsp), %xmm0
addpd 0x20(%rsp), %xmm0
xorps %xmm1, %xmm1
cvtsi2sd %ebx, %xmm1
movhpd 0x88(%rsp), %xmm1       # xmm1 = xmm1[0],mem[0]
movupd %xmm0, 0x110(%rsp)
divpd 0x30(%rsp), %xmm1
movapd %xmm1, %xmm2
unpckhpd %xmm1, %xmm2            # xmm2 = xmm2[1],xmm1[1]
addsd %xmm1, %xmm2
movsd %xmm2, 0x120(%rsp)
movapd %xmm0, %xmm1
unpckhpd %xmm0, %xmm1            # xmm1 = xmm1[1],xmm0[1]
movq %r12, %rdi
movq 0x18(%rsp), %rsi
callq 0x52d94
movq %r12, %rdi
xorl %esi, %esi
callq 0x83f9a
movsd (%rax), %xmm0
movsd %xmm0, 0xf8(%rsp)
movq %r12, %rdi
movl $0x1, %esi
callq 0x83f9a
movsd (%rax), %xmm0
movsd %xmm0, 0x100(%rsp)
movq %r12, %rdi
movl $0x2, %esi
callq 0x83f9a
movsd (%rax), %xmm0
movsd %xmm0, 0x108(%rsp)
movq %r13, %rdi
movq %rbp, %rsi
callq 0xe9a8
movq 0x158(%rsp), %rdi
leaq 0x168(%rsp), %rax
cmpq %rax, %rdi
je 0x8033
movq 0x168(%rsp), %rsi
incq %rsi
callq 0x4470
movq 0x138(%rsp), %rdi
leaq 0x148(%rsp), %rax
cmpq %rax, %rdi
je 0x8058
movq 0x148(%rsp), %rsi
incq %rsi
callq 0x4470
incl %ebx
cmpl %ebx, %r14d
jne 0x7f26
movl 0x4(%rsp), %eax
incl %eax
movl %eax, 0x4(%rsp)
cmpl 0xc(%rsp), %eax
jne 0x7ef6
movl 0x14(%rsp), %eax
incl %eax
cmpl 0x8(%rsp), %eax
jne 0x7ebf
movq 0xc0(%rsp), %rdi
leaq 0xd0(%rsp), %rax
cmpq %rax, %rdi
je 0x80ac
movq 0xd0(%rsp), %rsi
incq %rsi
callq 0x4470
movq 0xa0(%rsp), %rdi
leaq 0xb0(%rsp), %rax
cmpq %rax, %rdi
je 0x80d1
movq 0xb0(%rsp), %rsi
incq %rsi
callq 0x4470
incl %r15d
movq 0x58(%rsp), %rax
movq 0x2f0(%rax), %rdx
movq 0x2f8(%rax), %rax
subq %rdx, %rax
sarq $0x3, %rax
movabsq $-0x79435e50d79435e5, %rcx # imm = 0x86BCA1AF286BCA1B
imulq %rcx, %rax
cmpq %r15, %rax
ja 0x7df4
jmp 0x810e
movl $0x0, (%rsp)
movq 0x18(%rsp), %rax
movl (%rsp), %ecx
movl %ecx, 0x110(%rax)
addq $0x1c8, %rsp            # imm = 0x1C8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
jmp 0x81ac
jmp 0x813a
movq %rax, %rbx
jmp 0x8187
movq %rax, %rbx
movq 0x158(%rsp), %rdi
leaq 0x168(%rsp), %rax
cmpq %rax, %rdi
je 0x8162
movq 0x168(%rsp), %rsi
incq %rsi
callq 0x4470
movq 0x138(%rsp), %rdi
leaq 0x148(%rsp), %rax
cmpq %rax, %rdi
je 0x8187
movq 0x148(%rsp), %rsi
incq %rsi
callq 0x4470
movq 0xc0(%rsp), %rdi
leaq 0xd0(%rsp), %rax
cmpq %rax, %rdi
je 0x81ac
movq 0xd0(%rsp), %rsi
incq %rsi
callq 0x4470
movq 0xa0(%rsp), %rdi
leaq 0xb0(%rsp), %rax
cmpq %rax, %rdi
je 0x81d1
movq 0xb0(%rsp), %rsi
incq %rsi
callq 0x4470
movq %rbx, %rdi
callq 0x4780