// File: /workspace/github_cpp_makefile_star2_O3/Luthaf[P]zeopp/networkstorage.cc
// Function: write_edges(_IO_FILE*, ATOM_NETWORK*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>)
void write_edges(FILE *orig_e, ATOM_NETWORK *cell, string name) {
  bool verbose = false;
  //printf("DEBUG: called write_edges_dir()\n");
  //For each vertex in abc, get the coords in xyz, and find all edge end points
  vector<XYZ> vertices;
  XYZ v;
  vector< vector<XYZ> > edges;
  int total_num_e = 0;
  for(int i=0; i<cell->vertices.size(); i++) {
    XYZ vabc = cell->vertices.at(i).abc;
    v = cell->abc_to_xyz_returning_XYZ(vabc);
    vertices.push_back(v);
    int num_e = cell->vertices.at(i).edges.size();
    int num_dummy_e = cell->vertices.at(i).dummy_edges.size();
if(verbose) printf("DEBUG: this vertex has %d edges and %d dummy_edges\n", num_e, num_dummy_e);
    vector<XYZ> these_edges;
    for(int j=0; j<num_e; j++) {
      XYZ e;
      XYZ eabc = cell->vertices.at(i).edges.at(j);
      e = cell->abc_to_xyz_returning_XYZ(eabc); //treat the edge coords as positions
      these_edges.push_back(e);
      total_num_e++;
    }
    for(int j=0; j<num_dummy_e; j++) {
      XYZ e;
      XYZ eabc = cell->vertices.at(i).dummy_edges.at(j);
      e = cell->abc_to_xyz_returning_XYZ(eabc); //treat the edge coords as positions
      these_edges.push_back(e);
      total_num_e++;
    }
    edges.push_back(these_edges);
  }
  // Write header, information about the cell, and footer
  int num_v = vertices.size();
  fprintf(orig_e, "# vtk DataFile Version 2.0\n%s - vtk format representation of original edges\nASCII\nDATASET POLYDATA\nPOINTS %d double\n", name.c_str(), total_num_e+num_v);
  for(int i=0; i<num_v; i++) { //for each vertex ...
    fprintf(orig_e, "%.3f %.3f %.3f\n", vertices.at(i)[0], vertices.at(i)[1], vertices.at(i)[2]); //...print the vertex coords ...
    int num_e = edges.at(i).size();
    for(int j=0; j<num_e; j++) fprintf(orig_e, "%.3f %.3f %.3f\n", edges.at(i).at(j)[0], edges.at(i).at(j)[1], edges.at(i).at(j)[2]); //...and print the edge coords
  }
  //now this is trickier - print the edge connectivity with respect to vtk points
  fprintf(orig_e, "LINES %d %d\n", total_num_e, total_num_e*3);
  int v_index = 0;
  for(int i=0; i<num_v; i++) { //for each vertex ...
    int num_e = edges.at(i).size();
    for(int j=0; j<num_e; j++) { //...for each edge of this vertex ...
      fprintf(orig_e, "2 %d %d\n", v_index, v_index+j+1); //...print that this vertex is connected to each of its edges
    }
    v_index+=num_e+1;
  }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xd8, %rsp
movq %rdx, %rbx
movq %rsi, %r13
movq %rdi, %rbp
xorps %xmm0, %xmm0
movaps %xmm0, 0x30(%rsp)
xorl %r12d, %r12d
movq %r12, 0x40(%rsp)
leaq 0xa0(%rsp), %rdi
xorps %xmm0, %xmm0
xorps %xmm1, %xmm1
xorps %xmm2, %xmm2
callq 0x84364
movq %r12, 0x70(%rsp)
xorps %xmm0, %xmm0
movaps %xmm0, 0x60(%rsp)
movq 0x3c0(%r13), %rax
movabsq $-0x5555555555555555, %r15 # imm = 0xAAAAAAAAAAAAAAAB
movl $0x0, %ecx
cmpq %rax, 0x3c8(%r13)
movq %rbp, 0x98(%rsp)
je 0x6652b
movq %rbx, 0x50(%rsp)
xorl %ebx, %ebx
movq $0x0, (%rsp)
imulq $0x70, %rbx, %r14
movsd (%rax,%r14), %xmm0
movsd 0x8(%rax,%r14), %xmm1
movsd 0x10(%rax,%r14), %xmm2
leaq 0x10(%rsp), %rdi
movq %r13, %rsi
callq 0x52dd8
movq 0x20(%rsp), %rax
movq %rax, 0xb0(%rsp)
movups 0x10(%rsp), %xmm0
movaps %xmm0, 0xa0(%rsp)
movq 0x38(%rsp), %rsi
cmpq 0x40(%rsp), %rsi
je 0x661bc
movq 0xb0(%rsp), %rax
movq %rax, 0x10(%rsi)
movaps 0xa0(%rsp), %xmm0
movups %xmm0, (%rsi)
addq $0x18, 0x38(%rsp)
jmp 0x661ce
leaq 0x30(%rsp), %rdi
leaq 0xa0(%rsp), %rdx
callq 0x69b82
movq 0x3c0(%r13), %rax
movq 0x3c8(%r13), %rdx
subq %rax, %rdx
sarq $0x4, %rdx
movabsq $0x6db6db6db6db6db7, %rcx # imm = 0x6DB6DB6DB6DB6DB7
imulq %rcx, %rdx
cmpq %rbx, %rdx
jbe 0x66919
movq 0x28(%rax,%r14), %rdx
movq 0x40(%rax,%r14), %rcx
subq 0x20(%rax,%r14), %rdx
sarq $0x3, %rdx
imulq %r15, %rdx
subq 0x38(%rax,%r14), %rcx
movq %rcx, 0x78(%rsp)
xorps %xmm0, %xmm0
movaps %xmm0, 0x10(%rsp)
movq $0x0, 0x20(%rsp)
movq (%rsp), %r12
movq %rdx, 0x8(%rsp)
testl %edx, %edx
jle 0x66364
movq (%rsp), %rax
movq 0x8(%rsp), %r15
addl %r15d, %eax
movq %rax, 0x58(%rsp)
andl $0x7fffffff, %r15d      # imm = 0x7FFFFFFF
movl $0x10, %ebp
xorl %r12d, %r12d
xorps %xmm0, %xmm0
xorps %xmm1, %xmm1
xorps %xmm2, %xmm2
leaq 0x80(%rsp), %rdi
callq 0x84364
movq 0x3c0(%r13), %rcx
movq 0x3c8(%r13), %rdx
subq %rcx, %rdx
sarq $0x4, %rdx
movabsq $0x6db6db6db6db6db7, %rax # imm = 0x6DB6DB6DB6DB6DB7
imulq %rax, %rdx
cmpq %rbx, %rdx
jbe 0x668e3
movq 0x20(%rcx,%r14), %rax
movq 0x28(%rcx,%r14), %rdx
subq %rax, %rdx
sarq $0x3, %rdx
movabsq $-0x5555555555555555, %rcx # imm = 0xAAAAAAAAAAAAAAAB
imulq %rcx, %rdx
cmpq %r12, %rdx
jbe 0x668e0
movsd -0x10(%rax,%rbp), %xmm0
movsd -0x8(%rax,%rbp), %xmm1
movsd (%rax,%rbp), %xmm2
leaq 0xc0(%rsp), %rdi
movq %r13, %rsi
callq 0x52dd8
movq 0xd0(%rsp), %rax
movq %rax, 0x90(%rsp)
movups 0xc0(%rsp), %xmm0
movaps %xmm0, 0x80(%rsp)
movq 0x18(%rsp), %rsi
cmpq 0x20(%rsp), %rsi
je 0x66333
movq 0x90(%rsp), %rax
movq %rax, 0x10(%rsi)
movaps 0x80(%rsp), %xmm0
movups %xmm0, (%rsi)
addq $0x18, 0x18(%rsp)
jmp 0x66345
leaq 0x10(%rsp), %rdi
leaq 0x80(%rsp), %rdx
callq 0x69b82
incq %r12
addq $0x18, %rbp
cmpq %r12, %r15
jne 0x6625d
movabsq $-0x5555555555555555, %r15 # imm = 0xAAAAAAAAAAAAAAAB
movq 0x58(%rsp), %r12
movq 0x78(%rsp), %rbp
sarq $0x3, %rbp
imulq %r15, %rbp
testl %ebp, %ebp
jle 0x664ae
movq 0x8(%rsp), %rcx
testl %ecx, %ecx
movl $0x0, %eax
cmovgl %ecx, %eax
movq (%rsp), %rcx
addl %ebp, %ecx
addl %eax, %ecx
movq %rcx, 0x58(%rsp)
andl $0x7fffffff, %ebp       # imm = 0x7FFFFFFF
movl $0x10, %r15d
xorl %r12d, %r12d
xorps %xmm0, %xmm0
xorps %xmm1, %xmm1
xorps %xmm2, %xmm2
leaq 0x80(%rsp), %rdi
callq 0x84364
movq 0x3c0(%r13), %rcx
movq 0x3c8(%r13), %rdx
subq %rcx, %rdx
sarq $0x4, %rdx
movabsq $0x6db6db6db6db6db7, %rax # imm = 0x6DB6DB6DB6DB6DB7
imulq %rax, %rdx
cmpq %rbx, %rdx
jbe 0x668f7
movq 0x38(%rcx,%r14), %rax
movq 0x40(%rcx,%r14), %rdx
subq %rax, %rdx
sarq $0x3, %rdx
movabsq $-0x5555555555555555, %rcx # imm = 0xAAAAAAAAAAAAAAAB
imulq %rcx, %rdx
cmpq %r12, %rdx
jbe 0x668f4
movsd -0x10(%rax,%r15), %xmm0
movsd -0x8(%rax,%r15), %xmm1
movsd (%rax,%r15), %xmm2
leaq 0xc0(%rsp), %rdi
movq %r13, %rsi
callq 0x52dd8
movq 0xd0(%rsp), %rax
movq %rax, 0x90(%rsp)
movups 0xc0(%rsp), %xmm0
movaps %xmm0, 0x80(%rsp)
movq 0x18(%rsp), %rsi
cmpq 0x20(%rsp), %rsi
je 0x6647d
movq 0x90(%rsp), %rax
movq %rax, 0x10(%rsi)
movaps 0x80(%rsp), %xmm0
movups %xmm0, (%rsi)
addq $0x18, 0x18(%rsp)
jmp 0x6648f
leaq 0x10(%rsp), %rdi
leaq 0x80(%rsp), %rdx
callq 0x69b82
incq %r12
addq $0x18, %r15
cmpq %r12, %rbp
jne 0x663a4
movabsq $-0x5555555555555555, %r15 # imm = 0xAAAAAAAAAAAAAAAB
movq 0x58(%rsp), %r12
leaq 0x60(%rsp), %rdi
leaq 0x10(%rsp), %rsi
callq 0x6793a
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
movq 0x98(%rsp), %rbp
je 0x664dc
movq 0x20(%rsp), %rsi
subq %rdi, %rsi
callq 0x4470
incq %rbx
movq 0x3c0(%r13), %rax
movq 0x3c8(%r13), %rcx
subq %rax, %rcx
sarq $0x4, %rcx
movabsq $0x6db6db6db6db6db7, %rdx # imm = 0x6DB6DB6DB6DB6DB7
imulq %rdx, %rcx
movl %r12d, %edx
movq %rdx, (%rsp)
cmpq %rbx, %rcx
ja 0x66152
movq 0x38(%rsp), %rax
subq 0x30(%rsp), %rax
shrq $0x3, %rax
imull $0xaaaaaaab, %eax, %ecx # imm = 0xAAAAAAAB
movq 0x50(%rsp), %rbx
movq %rcx, 0x50(%rsp)
movq (%rbx), %rdx
movq 0x50(%rsp), %rax
leal (%r12,%rax), %ecx
leaq 0xed8bf(%rip), %rsi     # 0x153e02
movq %rbp, %rdi
xorl %eax, %eax
callq 0x45f0
movq 0x50(%rsp), %rax
testl %eax, %eax
jle 0x66881
movq %r12, 0x58(%rsp)
movl %eax, %eax
movq %rax, 0x78(%rsp)
xorl %r13d, %r13d
movq 0x30(%rsp), %rax
movq 0x38(%rsp), %rdx
subq %rax, %rdx
sarq $0x3, %rdx
imulq %r15, %rdx
cmpq %r13, %rdx
jbe 0x66908
leaq (,%r13,2), %r12
addq %r13, %r12
leaq (%rax,%r12,8), %rdi
xorl %esi, %esi
callq 0x845b8
movq 0x30(%rsp), %rcx
movq 0x38(%rsp), %rdx
subq %rcx, %rdx
sarq $0x3, %rdx
imulq %r15, %rdx
cmpq %r13, %rdx
jbe 0x66908
movsd (%rax), %xmm0
movsd %xmm0, (%rsp)
leaq (%rcx,%r12,8), %rdi
movl $0x1, %esi
callq 0x845b8
movq 0x30(%rsp), %rcx
movq 0x38(%rsp), %rdx
subq %rcx, %rdx
sarq $0x3, %rdx
imulq %r15, %rdx
cmpq %r13, %rdx
jbe 0x66908
movsd (%rax), %xmm0
movsd %xmm0, 0x8(%rsp)
leaq (%rcx,%r12,8), %rdi
movl $0x2, %esi
callq 0x845b8
movsd (%rax), %xmm2
movq %rbp, %rdi
leaq 0xeb9c7(%rip), %rsi     # 0x151fdd
movsd (%rsp), %xmm0
movsd 0x8(%rsp), %xmm1
movb $0x3, %al
callq 0x45f0
movq 0x60(%rsp), %rax
movq 0x68(%rsp), %rdx
subq %rax, %rdx
sarq $0x3, %rdx
imulq %r15, %rdx
cmpq %r13, %rdx
jbe 0x6692a
movq 0x8(%rax,%r12,8), %rbx
subq (%rax,%r12,8), %rbx
sarq $0x3, %rbx
imulq %r15, %rbx
testl %ebx, %ebx
jle 0x667a1
andl $0x7fffffff, %ebx       # imm = 0x7FFFFFFF
xorl %r15d, %r15d
xorl %r14d, %r14d
movq 0x60(%rsp), %rax
movq 0x68(%rsp), %rdx
subq %rax, %rdx
sarq $0x3, %rdx
movabsq $-0x5555555555555555, %rcx # imm = 0xAAAAAAAAAAAAAAAB
imulq %rcx, %rdx
cmpq %r13, %rdx
jbe 0x668cf
movq (%rax,%r12,8), %rdi
movq 0x8(%rax,%r12,8), %rdx
subq %rdi, %rdx
sarq $0x3, %rdx
imulq %rcx, %rdx
cmpq %r14, %rdx
jbe 0x668cc
addq %r15, %rdi
xorl %esi, %esi
callq 0x845b8
movq 0x60(%rsp), %rcx
movq 0x68(%rsp), %rdx
subq %rcx, %rdx
sarq $0x3, %rdx
movabsq $-0x5555555555555555, %rsi # imm = 0xAAAAAAAAAAAAAAAB
imulq %rsi, %rdx
cmpq %r13, %rdx
jbe 0x668cf
movq (%rcx,%r12,8), %rdi
movq 0x8(%rcx,%r12,8), %rdx
subq %rdi, %rdx
sarq $0x3, %rdx
imulq %rsi, %rdx
cmpq %r14, %rdx
jbe 0x668cc
movsd (%rax), %xmm0
movsd %xmm0, (%rsp)
addq %r15, %rdi
movl $0x1, %esi
callq 0x845b8
movq 0x60(%rsp), %rcx
movq 0x68(%rsp), %rdx
subq %rcx, %rdx
sarq $0x3, %rdx
movabsq $-0x5555555555555555, %rsi # imm = 0xAAAAAAAAAAAAAAAB
imulq %rsi, %rdx
cmpq %r13, %rdx
jbe 0x668cf
movq (%rcx,%r12,8), %rdi
movq 0x8(%rcx,%r12,8), %rdx
subq %rdi, %rdx
sarq $0x3, %rdx
imulq %rsi, %rdx
cmpq %r14, %rdx
jbe 0x668cc
movsd (%rax), %xmm0
movsd %xmm0, 0x8(%rsp)
addq %r15, %rdi
movl $0x2, %esi
callq 0x845b8
movsd (%rax), %xmm2
movq %rbp, %rdi
leaq 0xeb85e(%rip), %rsi     # 0x151fdd
movsd (%rsp), %xmm0
movsd 0x8(%rsp), %xmm1
movb $0x3, %al
callq 0x45f0
incq %r14
addq $0x18, %r15
cmpq %r14, %rbx
jne 0x6666b
incq %r13
cmpq 0x78(%rsp), %r13
movabsq $-0x5555555555555555, %r15 # imm = 0xAAAAAAAAAAAAAAAB
jne 0x66569
movq 0x58(%rsp), %rdx
leal (%rdx,%rdx,2), %ecx
leaq 0xeb606(%rip), %rsi     # 0x151dce
movq %rbp, %rdi
xorl %eax, %eax
callq 0x45f0
cmpl $0x0, 0x50(%rsp)
jle 0x66899
leaq 0xeb5f7(%rip), %r15     # 0x151ddb
xorl %r14d, %r14d
xorl %r12d, %r12d
movq 0x98(%rsp), %rbx
movq 0x60(%rsp), %rax
movq 0x68(%rsp), %rdx
subq %rax, %rdx
sarq $0x3, %rdx
movabsq $-0x5555555555555555, %rcx # imm = 0xAAAAAAAAAAAAAAAB
imulq %rcx, %rdx
cmpq %r14, %rdx
jbe 0x6693b
leaq (%r14,%r14,2), %rcx
movq 0x8(%rax,%rcx,8), %rdx
subq (%rax,%rcx,8), %rdx
shrq $0x3, %rdx
imull $0xaaaaaaab, %edx, %eax # imm = 0xAAAAAAAB
movl %eax, (%rsp)
testl %eax, %eax
jle 0x6686a
movl (%rsp), %eax
movl %eax, %r13d
negl %r13d
movl $0x1, %ebp
leal (%r12,%rbp), %ecx
movq %rbx, %rdi
movq %r15, %rsi
movl %r12d, %edx
xorl %eax, %eax
callq 0x45f0
leal 0x1(%r13,%rbp), %eax
movl %ebp, %ecx
incl %ecx
movl %ecx, %ebp
cmpl $0x1, %eax
jne 0x66846
incl %r12d
addl (%rsp), %r12d
incq %r14
cmpq 0x78(%rsp), %r14
jne 0x667f2
jmp 0x66899
leal (%r12,%r12,2), %ecx
leaq 0xeb542(%rip), %rsi     # 0x151dce
movq %rbp, %rdi
movl %r12d, %edx
xorl %eax, %eax
callq 0x45f0
leaq 0x60(%rsp), %rdi
callq 0x67966
movq 0x30(%rsp), %rdi
testq %rdi, %rdi
je 0x668ba
movq 0x40(%rsp), %rsi
subq %rdi, %rsi
callq 0x4470
addq $0xd8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %r14, %r13
leaq 0xe6e1f(%rip), %rdi     # 0x14d6f5
movq %r13, %rsi
xorl %eax, %eax
callq 0x4630
movq %r12, %rbx
leaq 0xe6e0b(%rip), %rdi     # 0x14d6f5
movq %rbx, %rsi
xorl %eax, %eax
callq 0x4630
movq %r12, %rbx
leaq 0xe6df7(%rip), %rdi     # 0x14d6f5
movq %rbx, %rsi
xorl %eax, %eax
callq 0x4630
leaq 0xe6de6(%rip), %rdi     # 0x14d6f5
movq %r13, %rsi
xorl %eax, %eax
callq 0x4630
leaq 0xe6dd5(%rip), %rdi     # 0x14d6f5
movq %rbx, %rsi
xorl %eax, %eax
callq 0x4630
leaq 0xe6dc4(%rip), %rdi     # 0x14d6f5
movq %r13, %rsi
xorl %eax, %eax
callq 0x4630
leaq 0xe6db3(%rip), %rdi     # 0x14d6f5
movq %r14, %rsi
xorl %eax, %eax
callq 0x4630
jmp 0x66988
jmp 0x66988
jmp 0x66988
jmp 0x6696a
jmp 0x66988
jmp 0x66988
jmp 0x66988
jmp 0x66988
jmp 0x6696a
jmp 0x6696a
jmp 0x6696a
jmp 0x6696a
jmp 0x6696a
jmp 0x6696a
jmp 0x6696a
movq %rax, %rbx
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x6698b
movq 0x20(%rsp), %rsi
subq %rdi, %rsi
callq 0x4470
jmp 0x6698b
jmp 0x66988
movq %rax, %rbx
leaq 0x60(%rsp), %rdi
callq 0x67966
movq 0x30(%rsp), %rdi
testq %rdi, %rdi
je 0x669ac
movq 0x40(%rsp), %rsi
subq %rdi, %rsi
callq 0x4470
movq %rbx, %rdi
callq 0x4780