// File: /workspace/github_cpp_makefile_star2_O1/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 $0x198, %rsp            # imm = 0x198
movl %r8d, %ebp
movl %ecx, %r12d
movq %rsi, %rbx
movl %edx, 0x8(%rsp)
cvtsi2sd %edx, %xmm1
movq %rdi, %r14
movsd 0x8(%rdi), %xmm0
movsd %xmm1, 0x28(%rsp)
mulsd %xmm1, %xmm0
movsd %xmm0, 0x8(%rsi)
xorps %xmm1, %xmm1
cvtsi2sd %ecx, %xmm1
movsd 0x10(%rdi), %xmm0
movsd %xmm1, 0x30(%rsp)
mulsd %xmm1, %xmm0
movsd %xmm0, 0x10(%rsi)
xorps %xmm1, %xmm1
cvtsi2sd %r8d, %xmm1
movsd 0x18(%rdi), %xmm0
movsd %xmm1, 0x40(%rsp)
mulsd %xmm1, %xmm0
movsd %xmm0, 0x18(%rsi)
movsd 0x20(%rdi), %xmm0
movsd %xmm0, 0x20(%rsi)
movsd 0x28(%rdi), %xmm0
movsd %xmm0, 0x28(%rsi)
movsd 0x30(%rdi), %xmm0
movsd %xmm0, 0x30(%rsi)
movq %rsi, %rdi
callq 0x521f4
leaq 0x2f0(%rbx), %r13
movq %rbx, 0x20(%rsp)
movq 0x2f0(%rbx), %rsi
movq %r13, %rdi
callq 0x12f02
movq 0x2f0(%r14), %rdx
movq %r14, 0x38(%rsp)
cmpq %rdx, 0x2f8(%r14)
je 0x7f85
xorl %r15d, %r15d
testl %ebp, %ebp
movl $0x0, %eax
movl %ebp, %r14d
cmovgl %ebp, %eax
movl %r12d, 0xc(%rsp)
imull %r12d, %eax
movl %eax, 0x18(%rsp)
leaq 0xe8(%rsp), %rbp
leaq 0x180(%rsp), %r12
movl $0x0, (%rsp)
imulq $0x98, %r15, %rbx
movupd (%rdx,%rbx), %xmm0
movupd 0x10(%rdx,%rbx), %xmm1
movupd 0x20(%rdx,%rbx), %xmm2
movupd 0x30(%rdx,%rbx), %xmm3
movapd %xmm3, 0x80(%rsp)
movapd %xmm2, 0x70(%rsp)
movapd %xmm1, 0x60(%rsp)
movapd %xmm0, 0x50(%rsp)
leaq 0xa0(%rsp), %rax
movq %rax, 0x90(%rsp)
movq 0x40(%rdx,%rbx), %rsi
movq %rdx, 0x10(%rsp)
movq 0x48(%rdx,%rbx), %rdx
addq %rsi, %rdx
leaq 0x90(%rsp), %rdi
callq 0xf32a
leaq 0xc0(%rsp), %rax
movq %rax, 0xb0(%rsp)
movq 0x10(%rsp), %rax
movq 0x60(%rax,%rbx), %rsi
movq 0x68(%rax,%rbx), %rdx
addq %rsi, %rdx
leaq 0xb0(%rsp), %rdi
callq 0xf32a
movq 0x10(%rsp), %rcx
addq %rbx, %rcx
movb 0x90(%rcx), %al
leaq 0x90(%rsp), %rdx
movb %al, 0x50(%rdx)
movupd 0x80(%rcx), %xmm0
movupd %xmm0, 0x40(%rdx)
cmpl $0x0, 0x8(%rsp)
jle 0x7f05
xorl %eax, %eax
cmpl $0x0, 0xc(%rsp)
jle 0x7ef9
movl %eax, 0x1c(%rsp)
xorps %xmm0, %xmm0
cvtsi2sd %eax, %xmm0
divsd 0x28(%rsp), %xmm0
movsd %xmm0, 0x48(%rsp)
movl (%rsp), %eax
addl 0x18(%rsp), %eax
movl %eax, (%rsp)
movl $0x0, 0x4(%rsp)
testl %r14d, %r14d
jle 0x7ee1
xorps %xmm0, %xmm0
cvtsi2sdl 0x4(%rsp), %xmm0
divsd 0x30(%rsp), %xmm0
movsd %xmm0, 0x10(%rsp)
xorl %ebx, %ebx
movq %rbp, %rdi
callq 0x5162c
movl %r15d, 0x168(%rsp)
leaq 0x128(%rsp), %rdi
leaq 0x90(%rsp), %rsi
callq 0x4240
movsd 0x80(%rsp), %xmm0
movsd %xmm0, 0x118(%rsp)
movsd 0x68(%rsp), %xmm0
movsd 0x70(%rsp), %xmm1
divsd 0x28(%rsp), %xmm0
addsd 0x48(%rsp), %xmm0
movsd %xmm0, 0x100(%rsp)
divsd 0x30(%rsp), %xmm1
addsd 0x10(%rsp), %xmm1
movsd %xmm1, 0x108(%rsp)
movsd 0x78(%rsp), %xmm3
cvtsi2sd %ebx, %xmm2
movsd 0x40(%rsp), %xmm4
divsd %xmm4, %xmm3
divsd %xmm4, %xmm2
addsd %xmm3, %xmm2
movsd %xmm2, 0x110(%rsp)
movq %r12, %rdi
movq 0x20(%rsp), %rsi
callq 0x53092
movq %r12, %rdi
xorl %esi, %esi
callq 0x85478
movsd (%rax), %xmm0
movsd %xmm0, 0xe8(%rsp)
movq %r12, %rdi
movl $0x1, %esi
callq 0x85478
movsd (%rax), %xmm0
movsd %xmm0, 0xf0(%rsp)
movq %r12, %rdi
movl $0x2, %esi
callq 0x85478
movsd (%rax), %xmm0
movsd %xmm0, 0xf8(%rsp)
movq %r13, %rdi
movq %rbp, %rsi
callq 0xe936
movq 0x148(%rsp), %rdi
leaq 0x158(%rsp), %rax
cmpq %rax, %rdi
je 0x7eb1
movq 0x158(%rsp), %rsi
incq %rsi
callq 0x4470
movq 0x128(%rsp), %rdi
leaq 0x138(%rsp), %rax
cmpq %rax, %rdi
je 0x7ed6
movq 0x138(%rsp), %rsi
incq %rsi
callq 0x4470
incl %ebx
cmpl %ebx, %r14d
jne 0x7d97
movl 0x4(%rsp), %eax
incl %eax
movl %eax, 0x4(%rsp)
cmpl 0xc(%rsp), %eax
jne 0x7d77
movl 0x1c(%rsp), %eax
incl %eax
cmpl 0x8(%rsp), %eax
jne 0x7d43
movq 0xb0(%rsp), %rdi
leaq 0xc0(%rsp), %rax
cmpq %rax, %rdi
je 0x7f2a
movq 0xc0(%rsp), %rsi
incq %rsi
callq 0x4470
movq 0x90(%rsp), %rdi
leaq 0xa0(%rsp), %rax
cmpq %rax, %rdi
je 0x7f4f
movq 0xa0(%rsp), %rsi
incq %rsi
callq 0x4470
incl %r15d
movq 0x38(%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 0x7c79
jmp 0x7f8c
movl $0x0, (%rsp)
movq 0x20(%rsp), %rax
movl (%rsp), %ecx
movl %ecx, 0x110(%rax)
addq $0x198, %rsp            # imm = 0x198
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
jmp 0x802a
jmp 0x7fb8
movq %rax, %rbx
jmp 0x8005
movq %rax, %rbx
movq 0x148(%rsp), %rdi
leaq 0x158(%rsp), %rax
cmpq %rax, %rdi
je 0x7fe0
movq 0x158(%rsp), %rsi
incq %rsi
callq 0x4470
movq 0x128(%rsp), %rdi
leaq 0x138(%rsp), %rax
cmpq %rax, %rdi
je 0x8005
movq 0x138(%rsp), %rsi
incq %rsi
callq 0x4470
movq 0xb0(%rsp), %rdi
leaq 0xc0(%rsp), %rax
cmpq %rax, %rdi
je 0x802a
movq 0xc0(%rsp), %rsi
incq %rsi
callq 0x4470
movq 0x90(%rsp), %rdi
leaq 0xa0(%rsp), %rax
cmpq %rax, %rdi
je 0x804f
movq 0xa0(%rsp), %rsi
incq %rsi
callq 0x4470
movq %rbx, %rdi
callq 0x4780