// File: /workspace/github_cpp_makefile_star2_O1/Luthaf[P]zeopp/voronoicell.cc
// Function: writeZeoVisFile(char*, std::vector<VOR_CELL, std::allocator<VOR_CELL>>*, ATOM_NETWORK*, VORONOI_NETWORK*)
void writeZeoVisFile(char *filename, vector<VOR_CELL> *cells,
  ATOM_NETWORK *atmnet, VORONOI_NETWORK *vornet)
{
  fstream output;
  output.open(filename, fstream::out);
  if(!output.is_open()){
    cout << "Error: Failed to open output file for ZeoVis settings" << filename;
    cout << "Exiting ..." << "\n";
    exit(1);
  }
  else{
    cout << "Writing ZeoVis information to " << filename << "\n";
    
    writeVMDEnvVars(output, atmnet, vornet);
    writeVMDAtomsAndNodes(output, atmnet, vornet);
    writeVornet(output, atmnet, vornet);
    writeVMDUC(output, atmnet);

    for(unsigned int i = 0; i < cells->size(); i++){
      cells->at(i).writeVMDOutlined(output, i);
      cells->at(i).writeVMDFilled(output, i);
    }
    output << "set num_faces " << cells->size() << "\n"
	   << "set num_channels " << 0 << "\n"
	   << "set num_features " << 0 << "\n"
	   << "set num_segments " << 0 << "\n"
	   << "set num_cages "    << 0 << "\n";
  }
  output.close();
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x210, %rsp            # imm = 0x210
movq %rcx, %r15
movq %rdx, %r14
movq %rsi, %rbx
movq %rdi, %r12
movq %rsp, %r13
movq %r13, %rdi
callq 0x4520
movq %r13, %rdi
movq %r12, %rsi
movl $0x10, %edx
callq 0x43d0
leaq 0x80(%rsp), %rdi
callq 0x4120
testb %al, %al
je 0x6e4e0
movq 0x128d36(%rip), %r13    # 0x196fc0
leaq 0xe8231(%rip), %rsi     # 0x1564c2
movl $0x1e, %edx
movq %r13, %rdi
callq 0x44e0
testq %r12, %r12
je 0x6e2bf
movq %r12, %rdi
callq 0x41e0
movq 0x128d0e(%rip), %rdi    # 0x196fc0
movq %r12, %rsi
movq %rax, %rdx
callq 0x44e0
jmp 0x6e2d8
movq (%r13), %rax
movq -0x18(%rax), %rax
leaq (%rax,%r13), %rdi
movl 0x20(%r13,%rax), %esi
orl $0x1, %esi
callq 0x4710
movq 0x128ce1(%rip), %rdi    # 0x196fc0
leaq 0xe7248(%rip), %rsi     # 0x15552e
movl $0x1, %edx
callq 0x44e0
movq %rsp, %rdi
movq %r14, %rsi
movq %r15, %rdx
callq 0x6df04
movq %rsp, %rdi
movq %r14, %rsi
movq %r15, %rdx
callq 0x6d924
movq %rsp, %rdi
movq %r14, %rsi
movq %r15, %rdx
callq 0x6d353
movq %rsp, %rdi
movq %r14, %rsi
callq 0x6cdaf
movq (%rbx), %rdi
movabsq $-0x1084210842108421, %r12 # imm = 0xEF7BDEF7BDEF7BDF
cmpq %rdi, 0x8(%rbx)
je 0x6e396
xorl %r14d, %r14d
movq %rsp, %r15
imulq $0xf8, %r14, %r13
addq %r13, %rdi
movq %r15, %rsi
movl %r14d, %edx
callq 0x6c07a
movq (%rbx), %rdi
movq 0x8(%rbx), %rdx
subq %rdi, %rdx
sarq $0x3, %rdx
imulq %r12, %rdx
cmpq %r14, %rdx
jbe 0x6e4cf
addq %r13, %rdi
movq %r15, %rsi
movl %r14d, %edx
callq 0x6bf54
incl %r14d
movq (%rbx), %rdi
movq 0x8(%rbx), %rax
subq %rdi, %rax
sarq $0x3, %rax
imulq %r12, %rax
cmpq %r14, %rax
ja 0x6e33e
leaq 0x10(%rsp), %r14
leaq 0xe8034(%rip), %rsi     # 0x1563d6
movl $0xe, %edx
movq %r14, %rdi
callq 0x44e0
movq 0x8(%rbx), %rsi
subq (%rbx), %rsi
sarq $0x3, %rsi
imulq %r12, %rsi
movq %r14, %rdi
callq 0x42b0
movq %rax, %rbx
leaq 0xe715e(%rip), %rsi     # 0x15552e
movl $0x1, %edx
movq %rax, %rdi
callq 0x44e0
leaq 0xe80fd(%rip), %rsi     # 0x1564e1
movl $0x11, %edx
movq %rbx, %rdi
callq 0x44e0
movq %rbx, %rdi
xorl %esi, %esi
callq 0x4750
movq %rax, %rbx
leaq 0xe7129(%rip), %rsi     # 0x15552e
movl $0x1, %edx
movq %rax, %rdi
callq 0x44e0
leaq 0xe80da(%rip), %rsi     # 0x1564f3
movl $0x11, %edx
movq %rbx, %rdi
callq 0x44e0
movq %rbx, %rdi
xorl %esi, %esi
callq 0x4750
movq %rax, %rbx
leaq 0xe70f4(%rip), %rsi     # 0x15552e
movl $0x1, %edx
movq %rax, %rdi
callq 0x44e0
leaq 0xe80b7(%rip), %rsi     # 0x156505
movl $0x11, %edx
movq %rbx, %rdi
callq 0x44e0
movq %rbx, %rdi
xorl %esi, %esi
callq 0x4750
movq %rax, %rbx
leaq 0xe70bf(%rip), %rsi     # 0x15552e
movl $0x1, %edx
movq %rax, %rdi
callq 0x44e0
leaq 0xe4fd6(%rip), %rsi     # 0x153459
movl $0xe, %edx
movq %rbx, %rdi
callq 0x44e0
movq %rbx, %rdi
xorl %esi, %esi
callq 0x4750
leaq 0xe708d(%rip), %rsi     # 0x15552e
movl $0x1, %edx
movq %rax, %rdi
callq 0x44e0
movq %rsp, %rdi
callq 0x4090
movq %rsp, %rdi
callq 0x4110
addq $0x210, %rsp            # imm = 0x210
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
leaq 0xe11cf(%rip), %rdi     # 0x14f6a5
movq %r14, %rsi
xorl %eax, %eax
callq 0x4630
movq 0x128ad9(%rip), %rdi    # 0x196fc0
leaq 0xe7f9e(%rip), %rsi     # 0x15648c
movl $0x35, %edx
callq 0x44e0
movq 0x128ac1(%rip), %rdi    # 0x196fc0
movq %r12, %rsi
callq 0x4440
movq 0x128ab2(%rip), %rdi    # 0x196fc0
leaq 0xe162e(%rip), %rsi     # 0x14fb43
movl $0xb, %edx
callq 0x44e0
movq 0x128a9a(%rip), %rdi    # 0x196fc0
leaq 0xe7001(%rip), %rsi     # 0x15552e
callq 0x4440
movl $0x1, %edi
callq 0x710c
jmp 0x6e540
jmp 0x6e540
movq %rax, %rbx
movq %rsp, %rdi
callq 0x4110
movq %rbx, %rdi
callq 0x4780