// File: /workspace/github_cpp_makefile_star2_O2/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 0x4540
pushq $0x10
popq %rdx
movq %r13, %rdi
movq %r12, %rsi
callq 0x4410
leaq 0x80(%rsp), %rdi
callq 0x4130
testb %al, %al
je 0x50e30
movq 0xff33f(%rip), %rdi     # 0x14ffc0
leaq 0xb288a(%rip), %rsi     # 0x103512
callq 0x4480
movq %rax, %rdi
movq %r12, %rsi
callq 0x4480
leaq 0xb18df(%rip), %rsi     # 0x10257e
movq %rax, %rdi
callq 0x4480
movq %rsp, %rdi
movq %r14, %rsi
movq %r15, %rdx
callq 0x509ba
movq %rsp, %rdi
movq %r14, %rsi
movq %r15, %rdx
callq 0x50614
movq %rsp, %rdi
movq %r14, %rsi
movq %r15, %rdx
callq 0x50211
movq %rsp, %rdi
movq %r14, %rsi
callq 0x4fd10
xorl %r14d, %r14d
movl $0xf8, %r12d
movq %rsp, %r15
movl %r14d, %r14d
movq 0x8(%rbx), %rax
subq (%rbx), %rax
cqto
idivq %r12
cmpq %r14, %rax
jbe 0x50d33
movq %rbx, %rdi
movq %r14, %rsi
callq 0x51172
movq %rax, %rdi
movq %r15, %rsi
movl %r14d, %edx
callq 0x4f3f4
movq %rbx, %rdi
movq %r14, %rsi
callq 0x51172
movq %rax, %rdi
movq %r15, %rsi
movl %r14d, %edx
callq 0x4f312
incl %r14d
jmp 0x50ce8
leaq 0x10(%rsp), %rdi
leaq 0xb26e7(%rip), %rsi     # 0x103426
callq 0x4480
movq %rax, %rdi
movq 0x8(%rbx), %rax
subq (%rbx), %rax
movl $0xf8, %ecx
cqto
idivq %rcx
movq %rax, %rsi
callq 0x42e0
leaq 0xb1817(%rip), %rsi     # 0x10257e
movq %rax, %rdi
callq 0x4480
leaq 0xb27bb(%rip), %rsi     # 0x103531
movq %rax, %rdi
callq 0x4480
movq %rax, %rdi
xorl %esi, %esi
callq 0x4760
leaq 0xb17ef(%rip), %rsi     # 0x10257e
movq %rax, %rdi
callq 0x4480
leaq 0xb27a5(%rip), %rsi     # 0x103543
movq %rax, %rdi
callq 0x4480
movq %rax, %rdi
xorl %esi, %esi
callq 0x4760
leaq 0xb17c7(%rip), %rsi     # 0x10257e
movq %rax, %rdi
callq 0x4480
leaq 0xb278f(%rip), %rsi     # 0x103555
movq %rax, %rdi
callq 0x4480
movq %rax, %rdi
xorl %esi, %esi
callq 0x4760
leaq 0xb179f(%rip), %rsi     # 0x10257e
movq %rax, %rdi
callq 0x4480
leaq 0xaf68b(%rip), %rsi     # 0x100479
movq %rax, %rdi
callq 0x4480
movq %rax, %rdi
xorl %esi, %esi
callq 0x4760
leaq 0xb1777(%rip), %rsi     # 0x10257e
movq %rax, %rdi
callq 0x4480
movq %rsp, %rdi
callq 0x4080
movq %rsp, %rdi
callq 0x4120
addq $0x210, %rsp            # imm = 0x210
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
movq 0xff189(%rip), %rdi     # 0x14ffc0
leaq 0xb269e(%rip), %rsi     # 0x1034dc
callq 0x4480
movq %rax, %rdi
movq %r12, %rsi
callq 0x4480
movq 0xff16b(%rip), %rdi     # 0x14ffc0
leaq 0xabd57(%rip), %rsi     # 0xfcbb3
callq 0x4480
leaq 0xb1716(%rip), %rsi     # 0x10257e
movq %rax, %rdi
callq 0x4480
pushq $0x1
popq %rdi
callq 0x524c
jmp 0x50e7a
movq %rax, %rbx
movq %rsp, %rdi
callq 0x4120
movq %rbx, %rdi
callq 0x4780