// File: /workspace/github_cpp_makefile_star2_O3/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 0x6d8f4
movq 0x127922(%rip), %r13    # 0x194fc0
leaq 0xe6f0d(%rip), %rsi     # 0x1545b2
movl $0x1e, %edx
movq %r13, %rdi
callq 0x44e0
testq %r12, %r12
je 0x6d6d3
movq %r12, %rdi
callq 0x41e0
movq 0x1278fa(%rip), %rdi    # 0x194fc0
movq %r12, %rsi
movq %rax, %rdx
callq 0x44e0
jmp 0x6d6ec
movq (%r13), %rax
movq -0x18(%rax), %rax
leaq (%rax,%r13), %rdi
movl 0x20(%r13,%rax), %esi
orl $0x1, %esi
callq 0x4710
movq 0x1278cd(%rip), %rdi    # 0x194fc0
leaq 0xe5f24(%rip), %rsi     # 0x15361e
movl $0x1, %edx
callq 0x44e0
movq %rsp, %rdi
movq %r14, %rsi
movq %r15, %rdx
callq 0x6d318
movq %rsp, %rdi
movq %r14, %rsi
movq %r15, %rdx
callq 0x6cd38
movq %rsp, %rdi
movq %r14, %rsi
movq %r15, %rdx
callq 0x6c767
movq %rsp, %rdi
movq %r14, %rsi
callq 0x6c1ef
movq (%rbx), %rdi
movabsq $-0x1084210842108421, %r12 # imm = 0xEF7BDEF7BDEF7BDF
cmpq %rdi, 0x8(%rbx)
je 0x6d7aa
xorl %r14d, %r14d
movq %rsp, %r15
imulq $0xf8, %r14, %r13
addq %r13, %rdi
movq %r15, %rsi
movl %r14d, %edx
callq 0x6b52a
movq (%rbx), %rdi
movq 0x8(%rbx), %rdx
subq %rdi, %rdx
sarq $0x3, %rdx
imulq %r12, %rdx
cmpq %r14, %rdx
jbe 0x6d8e3
addq %r13, %rdi
movq %r15, %rsi
movl %r14d, %edx
callq 0x6b404
incl %r14d
movq (%rbx), %rdi
movq 0x8(%rbx), %rax
subq %rdi, %rax
sarq $0x3, %rax
imulq %r12, %rax
cmpq %r14, %rax
ja 0x6d752
leaq 0x10(%rsp), %r14
leaq 0xe6d10(%rip), %rsi     # 0x1544c6
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 0xe5e3a(%rip), %rsi     # 0x15361e
movl $0x1, %edx
movq %rax, %rdi
callq 0x44e0
leaq 0xe6dd9(%rip), %rsi     # 0x1545d1
movl $0x11, %edx
movq %rbx, %rdi
callq 0x44e0
movq %rbx, %rdi
xorl %esi, %esi
callq 0x4750
movq %rax, %rbx
leaq 0xe5e05(%rip), %rsi     # 0x15361e
movl $0x1, %edx
movq %rax, %rdi
callq 0x44e0
leaq 0xe6db6(%rip), %rsi     # 0x1545e3
movl $0x11, %edx
movq %rbx, %rdi
callq 0x44e0
movq %rbx, %rdi
xorl %esi, %esi
callq 0x4750
movq %rax, %rbx
leaq 0xe5dd0(%rip), %rsi     # 0x15361e
movl $0x1, %edx
movq %rax, %rdi
callq 0x44e0
leaq 0xe6d93(%rip), %rsi     # 0x1545f5
movl $0x11, %edx
movq %rbx, %rdi
callq 0x44e0
movq %rbx, %rdi
xorl %esi, %esi
callq 0x4750
movq %rax, %rbx
leaq 0xe5d9b(%rip), %rsi     # 0x15361e
movl $0x1, %edx
movq %rax, %rdi
callq 0x44e0
leaq 0xe3c52(%rip), %rsi     # 0x1514e9
movl $0xe, %edx
movq %rbx, %rdi
callq 0x44e0
movq %rbx, %rdi
xorl %esi, %esi
callq 0x4750
leaq 0xe5d69(%rip), %rsi     # 0x15361e
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 0xdfe0b(%rip), %rdi     # 0x14d6f5
movq %r14, %rsi
xorl %eax, %eax
callq 0x4630
movq 0x1276c5(%rip), %rdi    # 0x194fc0
leaq 0xe6c7a(%rip), %rsi     # 0x15457c
movl $0x35, %edx
callq 0x44e0
movq 0x1276ad(%rip), %rdi    # 0x194fc0
movq %r12, %rsi
callq 0x4440
movq 0x12769e(%rip), %rdi    # 0x194fc0
leaq 0xe028a(%rip), %rsi     # 0x14dbb3
movl $0xb, %edx
callq 0x44e0
movq 0x127686(%rip), %rdi    # 0x194fc0
leaq 0xe5cdd(%rip), %rsi     # 0x15361e
callq 0x4440
movl $0x1, %edi
callq 0x72bc
jmp 0x6d954
jmp 0x6d954
movq %rax, %rbx
movq %rsp, %rdi
callq 0x4110
movq %rbx, %rdi
callq 0x4780