// File: Luthaf[P]zeopp/networkstorage.cc
// Function: write_vertices(_IO_FILE*, ATOM_NETWORK*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, bool, bool)
void write_vertices(FILE *orig_v, ATOM_NETWORK *cell, string name, bool rename_vertices_by_connectivity, bool is_net) {
  //printf("DEBUG: called write_vertices()\n");
  //For each vertex in abc, get the coords in xyz
  vector<XYZ> vertices; XYZ p;
  //assign vertices names based on their connectivity, if desired
  if(rename_vertices_by_connectivity) {
    for(int i=0; i<cell->vertices.size(); i++) {
      char* temp_name = new char[100];
      sprintf(temp_name, "%d", cell->vertices.at(i).expected_edges);
//printf("renaming vertex: %s to %s\n", cell->vertices.at(i).name.c_str(), temp_name);
      cell->vertices.at(i).name = temp_name;
      delete[] temp_name;
    }
  }
  for(int i=0; i<cell->vertices.size(); i++) {
    p = cell->abc_to_xyz_returning_XYZ(cell->vertices.at(i).abc);
    vertices.push_back(p);
  }
  // Write header, and vertex coords
  int num_v = vertices.size();
  double radius = 1.0; //give particles a dummy radius
  fprintf(orig_v, "%d\n%s", num_v, name.c_str());
  if(is_net) fprintf(orig_v, " - xyz format representation of original vertices\n"); else fprintf(orig_v, " - xyz format representation of structure\n");
  for(int i=0; i<num_v; i++) fprintf(orig_v, "%s %.3f %.3f %.3f %.3f\n", cell->vertices.at(i).name.c_str(), vertices.at(i)[0], vertices.at(i)[1], vertices.at(i)[2], radius);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x160, %rsp            # imm = 0x160
movq %rdx, -0xa8(%rbp)
movb %r8b, %al
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
andb $0x1, %cl
movb %cl, -0x19(%rbp)
andb $0x1, %al
movb %al, -0x1a(%rbp)
leaq -0x38(%rbp), %rdi
callq 0xada60
leaq -0x50(%rbp), %rdi
xorps %xmm2, %xmm2
movaps %xmm2, %xmm0
movaps %xmm2, %xmm1
callq 0xea8e0
jmp 0xac749
testb $0x1, -0x19(%rbp)
je 0xac877
movl $0x0, -0x60(%rbp)
movslq -0x60(%rbp), %rax
movq %rax, -0xb0(%rbp)
movq -0x10(%rbp), %rdi
addq $0x3c0, %rdi            # imm = 0x3C0
callq 0xae470
movq %rax, %rcx
movq -0xb0(%rbp), %rax
cmpq %rcx, %rax
jae 0xac875
movl $0x64, %edi
callq 0x5030
movq %rax, -0xb8(%rbp)
jmp 0xac79b
movq -0xb8(%rbp), %rax
movq %rax, -0x68(%rbp)
movq -0x68(%rbp), %rax
movq %rax, -0xc8(%rbp)
movq -0x10(%rbp), %rdi
addq $0x3c0, %rdi            # imm = 0x3C0
movslq -0x60(%rbp), %rsi
callq 0xae4a0
movq %rax, -0xc0(%rbp)
jmp 0xac7ce
movq -0xc8(%rbp), %rdi
movq -0xc0(%rbp), %rax
movl 0x18(%rax), %edx
leaq 0x15dc01(%rip), %rsi    # 0x20a3e7
xorl %eax, %eax
callq 0x5100
movq -0x68(%rbp), %rax
movq %rax, -0xd8(%rbp)
movq -0x10(%rbp), %rdi
addq $0x3c0, %rdi            # imm = 0x3C0
movslq -0x60(%rbp), %rsi
callq 0xae4a0
movq %rax, -0xd0(%rbp)
jmp 0xac815
movq -0xd8(%rbp), %rsi
movq -0xd0(%rbp), %rdi
addq $0x50, %rdi
callq 0x5710
jmp 0xac82e
movq -0x68(%rbp), %rax
movq %rax, -0xe0(%rbp)
cmpq $0x0, %rax
je 0xac84b
movq -0xe0(%rbp), %rdi
callq 0x56c0
jmp 0xac84d
movl -0x60(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x60(%rbp)
jmp 0xac75a
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
leaq -0x38(%rbp), %rdi
callq 0x12210
jmp 0xacb25
jmp 0xac877
movl $0x0, -0x6c(%rbp)
movslq -0x6c(%rbp), %rax
movq %rax, -0xe8(%rbp)
movq -0x10(%rbp), %rdi
addq $0x3c0, %rdi            # imm = 0x3C0
callq 0xae470
movq %rax, %rcx
movq -0xe8(%rbp), %rax
cmpq %rcx, %rax
jae 0xac91a
movq -0x10(%rbp), %rdi
movq %rdi, -0xf8(%rbp)
addq $0x3c0, %rdi            # imm = 0x3C0
movslq -0x6c(%rbp), %rsi
callq 0xae4a0
movq %rax, -0xf0(%rbp)
jmp 0xac8cc
movq -0xf0(%rbp), %rdx
movq -0xf8(%rbp), %rsi
leaq -0x88(%rbp), %rdi
callq 0x97310
jmp 0xac8e8
movq -0x78(%rbp), %rax
movq %rax, -0x40(%rbp)
movups -0x88(%rbp), %xmm0
movaps %xmm0, -0x50(%rbp)
leaq -0x38(%rbp), %rdi
leaq -0x50(%rbp), %rsi
callq 0xafc20
jmp 0xac90a
jmp 0xac90c
movl -0x6c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x6c(%rbp)
jmp 0xac87e
leaq -0x38(%rbp), %rdi
callq 0xae590
movq -0xa8(%rbp), %rdi
movl %eax, -0x8c(%rbp)
movsd 0x145718(%rip), %xmm0   # 0x1f2050
movsd %xmm0, -0x98(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x108(%rbp)
movl -0x8c(%rbp), %eax
movl %eax, -0xfc(%rbp)
callq 0x5200
movq -0x108(%rbp), %rdi
movl -0xfc(%rbp), %edx
movq %rax, %rcx
leaq 0x14e3d2(%rip), %rsi    # 0x1fad45
movb $0x0, %al
callq 0x5750
testb $0x1, -0x1a(%rbp)
je 0xac994
movq -0x8(%rbp), %rdi
leaq 0x14e3c0(%rip), %rsi    # 0x1fad4b
movb $0x0, %al
callq 0x5750
jmp 0xac9a6
movq -0x8(%rbp), %rdi
leaq 0x14e3df(%rip), %rsi    # 0x1fad7e
movb $0x0, %al
callq 0x5750
movl $0x0, -0x9c(%rbp)
movl -0x9c(%rbp), %eax
cmpl -0x8c(%rbp), %eax
jge 0xacb13
movq -0x8(%rbp), %rax
movq %rax, -0x118(%rbp)
movq -0x10(%rbp), %rdi
addq $0x3c0, %rdi            # imm = 0x3C0
movslq -0x9c(%rbp), %rsi
callq 0xae4a0
movq %rax, -0x110(%rbp)
jmp 0xac9ed
movq -0x110(%rbp), %rdi
addq $0x50, %rdi
callq 0x5200
movq %rax, -0x128(%rbp)
movslq -0x9c(%rbp), %rsi
leaq -0x38(%rbp), %rdi
callq 0xae5c0
movq %rax, -0x120(%rbp)
jmp 0xaca1d
movq -0x120(%rbp), %rdi
xorl %esi, %esi
callq 0xead40
movq %rax, -0x130(%rbp)
jmp 0xaca34
movq -0x130(%rbp), %rax
movsd (%rax), %xmm0
movsd %xmm0, -0x140(%rbp)
movslq -0x9c(%rbp), %rsi
leaq -0x38(%rbp), %rdi
callq 0xae5c0
movq %rax, -0x138(%rbp)
jmp 0xaca60
movq -0x138(%rbp), %rdi
movl $0x1, %esi
callq 0xead40
movq %rax, -0x148(%rbp)
jmp 0xaca7a
movq -0x148(%rbp), %rax
movsd (%rax), %xmm0
movsd %xmm0, -0x158(%rbp)
movslq -0x9c(%rbp), %rsi
leaq -0x38(%rbp), %rdi
callq 0xae5c0
movq %rax, -0x150(%rbp)
jmp 0xacaa6
movq -0x150(%rbp), %rdi
movl $0x2, %esi
callq 0xead40
movq %rax, -0x160(%rbp)
jmp 0xacac0
movsd -0x158(%rbp), %xmm1
movsd -0x140(%rbp), %xmm0
movq -0x128(%rbp), %rdx
movq -0x118(%rbp), %rdi
movq -0x160(%rbp), %rax
movsd (%rax), %xmm2
movsd -0x98(%rbp), %xmm3
leaq 0x14e2b1(%rip), %rsi    # 0x1fada9
movb $0x4, %al
callq 0x5750
movl -0x9c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x9c(%rbp)
jmp 0xac9b0
leaq -0x38(%rbp), %rdi
callq 0x12210
addq $0x160, %rsp            # imm = 0x160
popq %rbp
retq
movq -0x58(%rbp), %rdi
callq 0x58f0
nop