// File: /workspace/github_cpp_makefile_star2_O2/Luthaf[P]zeopp/voronoicell.cc
// Function: writeVMDUC(std::basic_fstream<char, std::char_traits<char>>&, ATOM_NETWORK*)
void writeVMDUC(fstream &output, ATOM_NETWORK *atmnet){
  XYZ v_a = atmnet->v_a;
  XYZ v_b = atmnet->v_b;
  XYZ v_c = atmnet->v_c;
  
  output << "set unitcells(0) {" << "\n"
	 << "{color $unitcellColors(0)}" << "\n";
  DELTA_POS directions [3] = {DELTA_POS(1,0,0), DELTA_POS(0,1,0), DELTA_POS(0,0,1)};
  DELTA_POS limits [3] = {DELTA_POS(0,1,1), DELTA_POS(1,0,1), DELTA_POS(1,1,0)};
  for(unsigned int i = 0; i < 3; i++){
    DELTA_POS direction = directions[i];
    DELTA_POS limit = limits[i];
    for(int a = 0; a < 2; a++){
      for(int b = 0; b < 2; b++){
	for(int c = 0; c < 2; c++){
	  if((limit.x < a) || (limit.y < b) || (limit.z < c))
	    continue;
	  
	  // Calculate starting coordinate
	  double x1 = v_a.x *a + v_b.x*b + v_c.x*c;
	  double y1 = v_a.y *a + v_b.y*b + v_c.y*c;
	  double z1 = v_a.z *a + v_b.z*b + v_c.z*c;
	  
	  // Calculate ending coordinate
	  double x2 = x1 + v_a.x*direction.x + v_b.x*direction.y + v_c.x*direction.z;
	  double y2 = y1 + v_a.y*direction.x + v_b.y*direction.y + v_c.y*direction.z;
	  double z2 = z1 + v_a.z*direction.x + v_b.z*direction.y + v_c.z*direction.z;

	  output << "{line "
		 << "{" << x1 << " " << y1 << " " << z1 << "} "
		 << "{" << x2 << " " << y2 << " " << z2 << "} }" << "\n";
	}
      }
    }
  }
  output << "}" << "\n";
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x138, %rsp            # imm = 0x138
movq %rdi, %rbx
movsd 0x38(%rsi), %xmm0
movsd %xmm0, 0x48(%rsp)
movsd 0x40(%rsi), %xmm0
movsd %xmm0, 0x40(%rsp)
movsd 0x48(%rsi), %xmm0
movsd %xmm0, 0x38(%rsp)
movsd 0x50(%rsi), %xmm0
movsd %xmm0, 0x30(%rsp)
movsd 0x58(%rsi), %xmm0
movsd %xmm0, 0x28(%rsp)
movsd 0x60(%rsi), %xmm0
movsd %xmm0, 0x20(%rsp)
movsd 0x68(%rsi), %xmm0
movsd %xmm0, 0x70(%rsp)
movsd 0x70(%rsi), %xmm0
movsd %xmm0, 0x68(%rsp)
movsd 0x78(%rsi), %xmm0
movsd %xmm0, 0x60(%rsp)
addq $0x10, %rbx
leaq 0xb35d7(%rip), %rsi     # 0x103369
movq %rbx, %rdi
callq 0x4480
leaq 0xb27dd(%rip), %r14     # 0x10257e
movq %rax, %rdi
movq %r14, %rsi
callq 0x4480
leaq 0xb35c9(%rip), %rsi     # 0x10337c
movq %rax, %rdi
callq 0x4480
movq %rax, %rdi
movq %r14, %rsi
callq 0x4480
leaq 0x110(%rsp), %rdi
pushq $0x1
popq %rbp
xorl %r14d, %r14d
movl %ebp, %esi
xorl %edx, %edx
xorl %ecx, %ecx
callq 0x3d328
leaq 0x11c(%rsp), %rdi
xorl %esi, %esi
movl %ebp, %edx
xorl %ecx, %ecx
callq 0x3d328
leaq 0x128(%rsp), %rdi
xorl %esi, %esi
xorl %edx, %edx
movl %ebp, %ecx
callq 0x3d328
leaq 0xe0(%rsp), %rdi
xorl %esi, %esi
movl %ebp, %edx
movl %ebp, %ecx
callq 0x3d328
leaq 0xec(%rsp), %rdi
movl %ebp, %esi
xorl %edx, %edx
movl %ebp, %ecx
callq 0x3d328
leaq 0xf8(%rsp), %rdi
movl %ebp, %esi
movl %ebp, %edx
xorl %ecx, %ecx
callq 0x3d328
movsd 0xac212(%rip), %xmm1    # 0xfc058
leaq 0xb352d(%rip), %r12     # 0x10337a
leaq 0xb46be(%rip), %r13     # 0x104512
cmpq $0x3, %r14
je 0x501e1
movq %r14, 0x50(%rsp)
imulq $0xc, %r14, %rax
movl 0xe0(%rsp,%rax), %ecx
movl %ecx, 0x14(%rsp)
movl 0xe4(%rsp,%rax), %ecx
movl %ecx, 0x10(%rsp)
movl 0xe8(%rsp,%rax), %r15d
cvtsi2sdl 0x110(%rsp,%rax), %xmm0
movsd %xmm0, 0x88(%rsp)
cvtsi2sdl 0x114(%rsp,%rax), %xmm0
movsd %xmm0, 0x80(%rsp)
cvtsi2sdl 0x118(%rsp,%rax), %xmm0
movsd %xmm0, 0x78(%rsp)
xorl %eax, %eax
xorpd %xmm0, %xmm0
movsd %xmm0, 0x8(%rsp)
cmpl $0x2, %eax
je 0x501d4
xorl %ecx, %ecx
xorpd %xmm2, %xmm2
movl %eax, 0x18(%rsp)
cmpl $0x2, %ecx
je 0x501bd
cmpl %eax, 0x14(%rsp)
setl %al
movl %ecx, 0x1c(%rsp)
cmpl %ecx, 0x10(%rsp)
setl %bpl
orb %al, %bpl
movsd 0x30(%rsp), %xmm0
mulsd %xmm2, %xmm0
movsd 0x48(%rsp), %xmm4
movapd %xmm2, %xmm3
movsd 0x8(%rsp), %xmm2
mulsd %xmm2, %xmm4
addsd %xmm0, %xmm4
movsd %xmm4, 0xa0(%rsp)
movsd 0x28(%rsp), %xmm0
mulsd %xmm3, %xmm0
movsd 0x40(%rsp), %xmm4
mulsd %xmm2, %xmm4
addsd %xmm0, %xmm4
movsd %xmm4, 0x98(%rsp)
movsd 0x20(%rsp), %xmm0
movsd %xmm3, 0x58(%rsp)
mulsd %xmm3, %xmm0
movsd 0x38(%rsp), %xmm3
mulsd %xmm2, %xmm3
addsd %xmm0, %xmm3
movsd %xmm3, 0x90(%rsp)
xorl %r14d, %r14d
xorpd %xmm0, %xmm0
cmpl $0x2, %r14d
je 0x501a4
cmpl %r14d, %r15d
setl %al
orb %bpl, %al
jne 0x50198
movsd 0x70(%rsp), %xmm2
movapd %xmm2, %xmm1
mulsd %xmm0, %xmm1
addsd 0xa0(%rsp), %xmm1
movapd %xmm1, %xmm6
movsd %xmm1, 0xb8(%rsp)
movsd 0x68(%rsp), %xmm3
movapd %xmm3, %xmm1
mulsd %xmm0, %xmm1
addsd 0x98(%rsp), %xmm1
movapd %xmm1, %xmm8
movsd %xmm1, 0xa8(%rsp)
movsd 0x60(%rsp), %xmm4
movapd %xmm4, %xmm1
mulsd %xmm0, %xmm1
addsd 0x90(%rsp), %xmm1
movapd %xmm1, %xmm7
movsd %xmm1, 0xb0(%rsp)
movsd %xmm0, 0xd8(%rsp)
movsd 0x48(%rsp), %xmm0
movsd 0x88(%rsp), %xmm5
mulsd %xmm5, %xmm0
addsd %xmm6, %xmm0
movsd 0x30(%rsp), %xmm1
movsd 0x80(%rsp), %xmm6
mulsd %xmm6, %xmm1
addsd %xmm0, %xmm1
movapd %xmm2, %xmm0
movsd 0x78(%rsp), %xmm2
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, 0xd0(%rsp)
movsd 0x40(%rsp), %xmm0
mulsd %xmm5, %xmm0
addsd %xmm8, %xmm0
movsd 0x28(%rsp), %xmm1
mulsd %xmm6, %xmm1
addsd %xmm0, %xmm1
mulsd %xmm2, %xmm3
addsd %xmm1, %xmm3
movsd %xmm3, 0xc8(%rsp)
movsd 0x38(%rsp), %xmm0
mulsd %xmm5, %xmm0
addsd %xmm7, %xmm0
movsd 0x20(%rsp), %xmm1
mulsd %xmm6, %xmm1
addsd %xmm0, %xmm1
mulsd %xmm2, %xmm4
addsd %xmm1, %xmm4
movsd %xmm4, 0xc0(%rsp)
movq %rbx, %rdi
leaq 0xb32ea(%rip), %rsi     # 0x103397
callq 0x4480
movq %rax, %rdi
movq %r12, %rsi
callq 0x4480
movq %rax, %rdi
movsd 0xb8(%rsp), %xmm0
callq 0x46c0
movq %rax, %rdi
movq %r13, %rsi
callq 0x4480
movq %rax, %rdi
movsd 0xa8(%rsp), %xmm0
callq 0x46c0
movq %rax, %rdi
movq %r13, %rsi
callq 0x4480
movq %rax, %rdi
movsd 0xb0(%rsp), %xmm0
callq 0x46c0
movq %rax, %rdi
leaq 0xb0418(%rip), %rsi     # 0x100528
callq 0x4480
movq %rax, %rdi
movq %r12, %rsi
callq 0x4480
movq %rax, %rdi
movsd 0xd0(%rsp), %xmm0
callq 0x46c0
movq %rax, %rdi
movq %r13, %rsi
callq 0x4480
movq %rax, %rdi
movsd 0xc8(%rsp), %xmm0
callq 0x46c0
movq %rax, %rdi
movq %r13, %rsi
callq 0x4480
movq %rax, %rdi
movsd 0xc0(%rsp), %xmm0
callq 0x46c0
movq %rax, %rdi
leaq 0xb03c5(%rip), %rsi     # 0x100538
callq 0x4480
movq %rax, %rdi
leaq 0xb23fc(%rip), %rsi     # 0x10257e
callq 0x4480
movsd 0xd8(%rsp), %xmm0
movsd 0xabec0(%rip), %xmm1    # 0xfc058
addsd %xmm1, %xmm0
incl %r14d
jmp 0x4ff70
movsd 0x58(%rsp), %xmm2
addsd %xmm1, %xmm2
movl 0x1c(%rsp), %ecx
incl %ecx
movl 0x18(%rsp), %eax
jmp 0x4fed7
movsd 0x8(%rsp), %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, 0x8(%rsp)
incl %eax
jmp 0x4fec4
movq 0x50(%rsp), %r14
incq %r14
jmp 0x4fe54
leaq 0xb30f6(%rip), %rsi     # 0x1032de
movq %rbx, %rdi
callq 0x4480
leaq 0xb2387(%rip), %rsi     # 0x10257e
movq %rax, %rdi
callq 0x4480
addq $0x138, %rsp            # imm = 0x138
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq