// File: 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 %rbp
movq %rsp, %rbp
subq $0x300, %rsp            # imm = 0x300
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
leaq -0x230(%rbp), %rdi
movq %rdi, -0x248(%rbp)
callq 0x5660
movq -0x248(%rbp), %rdi
movq -0x8(%rbp), %rsi
movl $0x10, %edx
callq 0x54b0
jmp 0xbef55
leaq -0x230(%rbp), %rdi
callq 0x58b0
movb %al, -0x249(%rbp)
jmp 0xbef69
movb -0x249(%rbp), %al
testb $0x1, %al
jne 0xbf005
jmp 0xbef79
movq 0x1b4040(%rip), %rdi    # 0x272fc0
leaq 0x13c272(%rip), %rsi    # 0x1fb1f9
callq 0x5540
movq %rax, -0x258(%rbp)
jmp 0xbef95
movq -0x258(%rbp), %rdi
movq -0x8(%rbp), %rsi
callq 0x5540
jmp 0xbefa7
movq 0x1b4012(%rip), %rdi    # 0x272fc0
leaq 0x133c4e(%rip), %rsi    # 0x1f2c03
callq 0x5540
movq %rax, -0x260(%rbp)
jmp 0xbefc3
movq -0x260(%rbp), %rdi
leaq 0x13a654(%rip), %rsi    # 0x1f9625
callq 0x5540
jmp 0xbefd8
movl $0x1, %edi
callq 0x67c0
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x238(%rbp)
movl %eax, -0x23c(%rbp)
leaq -0x230(%rbp), %rdi
callq 0x5150
jmp 0xbf309
movq 0x1b3fb4(%rip), %rdi    # 0x272fc0
leaq 0x13c21c(%rip), %rsi    # 0x1fb22f
callq 0x5540
movq %rax, -0x268(%rbp)
jmp 0xbf021
movq -0x268(%rbp), %rdi
movq -0x8(%rbp), %rsi
callq 0x5540
movq %rax, -0x270(%rbp)
jmp 0xbf03a
movq -0x270(%rbp), %rdi
leaq 0x13a5dd(%rip), %rsi    # 0x1f9625
callq 0x5540
jmp 0xbf04f
movq -0x18(%rbp), %rsi
movq -0x20(%rbp), %rdx
leaq -0x230(%rbp), %rdi
callq 0xbec00
jmp 0xbf065
movq -0x18(%rbp), %rsi
movq -0x20(%rbp), %rdx
leaq -0x230(%rbp), %rdi
callq 0xbe550
jmp 0xbf07b
movq -0x18(%rbp), %rsi
movq -0x20(%rbp), %rdx
leaq -0x230(%rbp), %rdi
callq 0xbdee0
jmp 0xbf091
movq -0x18(%rbp), %rsi
leaq -0x230(%rbp), %rdi
callq 0xbd9a0
jmp 0xbf0a3
movl $0x0, -0x240(%rbp)
movl -0x240(%rbp), %eax
movq %rax, -0x278(%rbp)
movq -0x10(%rbp), %rdi
callq 0x18f70
movq %rax, %rcx
movq -0x278(%rbp), %rax
cmpq %rcx, %rax
jae 0xbf156
movq -0x10(%rbp), %rdi
movl -0x240(%rbp), %eax
movl %eax, %esi
callq 0xbff70
movq %rax, -0x280(%rbp)
jmp 0xbf0f0
movq -0x280(%rbp), %rdi
movl -0x240(%rbp), %edx
leaq -0x230(%rbp), %rsi
callq 0xbccc0
jmp 0xbf10b
movq -0x10(%rbp), %rdi
movl -0x240(%rbp), %eax
movl %eax, %esi
callq 0xbff70
movq %rax, -0x288(%rbp)
jmp 0xbf125
movq -0x288(%rbp), %rdi
movl -0x240(%rbp), %edx
leaq -0x230(%rbp), %rsi
callq 0xbcbb0
jmp 0xbf140
jmp 0xbf142
movl -0x240(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x240(%rbp)
jmp 0xbf0ad
leaq -0x220(%rbp), %rdi
leaq 0x13bfdf(%rip), %rsi    # 0x1fb143
callq 0x5540
movq %rax, -0x290(%rbp)
jmp 0xbf172
movq -0x10(%rbp), %rdi
callq 0x18f70
movq -0x290(%rbp), %rdi
movq %rax, %rsi
callq 0x5160
movq %rax, -0x298(%rbp)
jmp 0xbf193
movq -0x298(%rbp), %rdi
leaq 0x13a484(%rip), %rsi    # 0x1f9625
callq 0x5540
movq %rax, -0x2a0(%rbp)
jmp 0xbf1af
movq -0x2a0(%rbp), %rdi
leaq 0x13c091(%rip), %rsi    # 0x1fb24e
callq 0x5540
movq %rax, -0x2a8(%rbp)
jmp 0xbf1cb
movq -0x2a8(%rbp), %rdi
xorl %esi, %esi
callq 0x58d0
movq %rax, -0x2b0(%rbp)
jmp 0xbf1e2
movq -0x2b0(%rbp), %rdi
leaq 0x13a435(%rip), %rsi    # 0x1f9625
callq 0x5540
movq %rax, -0x2b8(%rbp)
jmp 0xbf1fe
movq -0x2b8(%rbp), %rdi
leaq 0x13c054(%rip), %rsi    # 0x1fb260
callq 0x5540
movq %rax, -0x2c0(%rbp)
jmp 0xbf21a
movq -0x2c0(%rbp), %rdi
xorl %esi, %esi
callq 0x58d0
movq %rax, -0x2c8(%rbp)
jmp 0xbf231
movq -0x2c8(%rbp), %rdi
leaq 0x13a3e6(%rip), %rsi    # 0x1f9625
callq 0x5540
movq %rax, -0x2d0(%rbp)
jmp 0xbf24d
movq -0x2d0(%rbp), %rdi
leaq 0x13c017(%rip), %rsi    # 0x1fb272
callq 0x5540
movq %rax, -0x2d8(%rbp)
jmp 0xbf269
movq -0x2d8(%rbp), %rdi
xorl %esi, %esi
callq 0x58d0
movq %rax, -0x2e0(%rbp)
jmp 0xbf280
movq -0x2e0(%rbp), %rdi
leaq 0x13a397(%rip), %rsi    # 0x1f9625
callq 0x5540
movq %rax, -0x2e8(%rbp)
jmp 0xbf29c
movq -0x2e8(%rbp), %rdi
leaq 0x137257(%rip), %rsi    # 0x1f6501
callq 0x5540
movq %rax, -0x2f0(%rbp)
jmp 0xbf2b8
movq -0x2f0(%rbp), %rdi
xorl %esi, %esi
callq 0x58d0
movq %rax, -0x2f8(%rbp)
jmp 0xbf2cf
movq -0x2f8(%rbp), %rdi
leaq 0x13a348(%rip), %rsi    # 0x1f9625
callq 0x5540
jmp 0xbf2e4
jmp 0xbf2e6
leaq -0x230(%rbp), %rdi
callq 0x50a0
jmp 0xbf2f4
leaq -0x230(%rbp), %rdi
callq 0x5150
addq $0x300, %rsp            # imm = 0x300
popq %rbp
retq
movq -0x238(%rbp), %rdi
callq 0x58f0
nopw %cs:(%rax,%rax)