// File: /workspace/github_cpp_makefile_star2_O3/Luthaf[P]zeopp/networkio.cc
// Function: writeToXYZ(char*, ATOM_NETWORK*, bool, bool)
bool writeToXYZ(char *filename, ATOM_NETWORK *cell, bool is_supercell, bool is_duplicate_perimeter_atoms){
  int num_cells = SUPERCELL_SIZE; //defined in networkio.h
  if(!is_supercell) num_cells = 1;
  fstream output;
  output.open(filename, fstream::out);
  if(!output.is_open()){
    cerr << "Error: Failed to open .xyz output file " << filename << endl;
    //cerr << "Exiting ..." << "\n";
    //exit(1);
    return false;
  }
  else{
    cout << "Writing atom network information to " << filename << "\n";

    //1) construct a new vector of atoms, which contains any supercell projections and duplicates
    vector<ATOM> new_atoms;
    for(int i=0; i<cell->numAtoms; i++) {
      ATOM atom = cell->atoms.at(i);
      Point orig_abc(atom.a_coord, atom.b_coord, atom.c_coord);
      Point uc_abc = cell->shiftABCInUC(orig_abc);
      //first, determine all the supercell images of this atom as required
      for(int a=0; a<num_cells; a++) {
        for(int b=0; b<num_cells; b++) {
          for(int c=0; c<num_cells; c++) {
            atom.a_coord=uc_abc[0]+a;
            atom.b_coord=uc_abc[1]+b;
            atom.c_coord=uc_abc[2]+c;
            // Do xyz conversion later, when needed for output
            new_atoms.push_back(atom);
            //now we have this atom, be it the original or a supercell projection, find the duplicates
            if(is_duplicate_perimeter_atoms) {
              double dupe_thresh = 0.001;
              if(atom.a_coord<dupe_thresh) {
                ATOM dupe = atom;
                dupe.a_coord = atom.a_coord+num_cells;
                new_atoms.push_back(dupe);
              }
              if(atom.b_coord<dupe_thresh) {
                ATOM dupe = atom;
                dupe.b_coord = atom.b_coord+num_cells;
                new_atoms.push_back(dupe);
              }
              if(atom.c_coord<dupe_thresh) {
                ATOM dupe = atom;
                dupe.c_coord = atom.c_coord+num_cells;
                new_atoms.push_back(dupe);
              }
              if(atom.a_coord<dupe_thresh && atom.b_coord<dupe_thresh) {
                ATOM dupe = atom;
                dupe.a_coord = atom.a_coord+num_cells;
                dupe.b_coord = atom.b_coord+num_cells;
                new_atoms.push_back(dupe);
              }
              if(atom.a_coord<dupe_thresh && atom.c_coord<dupe_thresh) {
                ATOM dupe = atom;
                dupe.a_coord = atom.a_coord+num_cells;
                dupe.c_coord = atom.c_coord+num_cells;
                new_atoms.push_back(dupe);
              }
              if(atom.b_coord<dupe_thresh && atom.c_coord<dupe_thresh) {
                ATOM dupe = atom;
                dupe.b_coord = atom.b_coord+num_cells;
                dupe.c_coord = atom.c_coord+num_cells;
                new_atoms.push_back(dupe);
              }
              if(atom.a_coord<dupe_thresh && atom.b_coord<dupe_thresh && atom.c_coord<dupe_thresh) {
                ATOM dupe = atom;
                dupe.a_coord = atom.a_coord+num_cells;
                dupe.b_coord = atom.b_coord+num_cells;
                dupe.c_coord = atom.c_coord+num_cells;
                new_atoms.push_back(dupe);
              }
              if(atom.a_coord>((double)(num_cells))-dupe_thresh) {
                ATOM dupe = atom;
                dupe.a_coord = atom.a_coord-num_cells;
                new_atoms.push_back(dupe);
              }
              if(atom.b_coord>((double)(num_cells))-dupe_thresh) {
                ATOM dupe = atom;
                dupe.b_coord = atom.b_coord-num_cells;
                new_atoms.push_back(dupe);
              }
              if(atom.c_coord>((double)(num_cells))-dupe_thresh) {
                ATOM dupe = atom;
                dupe.c_coord = atom.c_coord-num_cells;
                new_atoms.push_back(dupe);
              }
              if(atom.a_coord>((double)(num_cells))-dupe_thresh && atom.b_coord>((double)(num_cells))-dupe_thresh) {
                ATOM dupe = atom;
                dupe.a_coord = atom.a_coord-num_cells;
                dupe.b_coord = atom.b_coord-num_cells;
                new_atoms.push_back(dupe);
              }
              if(atom.a_coord>((double)(num_cells))-dupe_thresh && atom.c_coord>((double)(num_cells))-dupe_thresh) {
                ATOM dupe = atom;
                dupe.a_coord = atom.a_coord-num_cells;
                dupe.c_coord = atom.c_coord-num_cells;
                new_atoms.push_back(dupe);
              }
              if(atom.b_coord>((double)(num_cells))-dupe_thresh && atom.c_coord>((double)(num_cells))-dupe_thresh) {
                ATOM dupe = atom;
                dupe.b_coord = atom.b_coord-num_cells;
                dupe.c_coord = atom.c_coord-num_cells;
                new_atoms.push_back(dupe);
              }
              if(atom.a_coord>((double)(num_cells))-dupe_thresh && atom.b_coord>((double)(num_cells))-dupe_thresh && atom.c_coord>((double)(num_cells))-dupe_thresh) {
                ATOM dupe = atom;
                dupe.a_coord = atom.a_coord-num_cells;
                dupe.b_coord = atom.b_coord-num_cells;
                dupe.c_coord = atom.c_coord-num_cells;
                new_atoms.push_back(dupe);
              }
            }
          }
        }
      }
    }

    //2) write atom data
    output << new_atoms.size() << "\n" << "\n";
    for(int i=0; i<new_atoms.size(); i++) {
      Point p = cell->abc_to_xyz(new_atoms.at(i).a_coord, new_atoms.at(i).b_coord, new_atoms.at(i).c_coord);
      output << new_atoms.at(i).type << " " << p[0] << " " << p[1] << " " << p[2] << "\n";
    }
  }
  output.close();
  return true;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x418, %rsp            # imm = 0x418
movl %ecx, 0x1ac(%rsp)
movl %edx, %r15d
movq %rsi, 0x178(%rsp)
movq %rdi, %rbx
leaq 0x208(%rsp), %r14
movq %r14, %rdi
callq 0x4520
movq %r14, %rdi
movq %rbx, %rsi
movl $0x10, %edx
callq 0x43d0
leaq 0x288(%rsp), %rdi
callq 0x4120
movl %eax, %ebp
testb %al, %al
je 0x2ce84
movq 0x168171(%rip), %r14    # 0x194fc0
leaq 0x121574(%rip), %rsi    # 0x14e3ca
movl $0x24, %edx
movq %r14, %rdi
callq 0x44e0
testq %rbx, %rbx
je 0x2cec7
movq %rbx, %rdi
callq 0x41e0
movq 0x168149(%rip), %rdi    # 0x194fc0
movq %rbx, %rsi
movq %rax, %rdx
callq 0x44e0
jmp 0x2cedf
movq 0x168165(%rip), %r14    # 0x194ff0
leaq 0x12185b(%rip), %rsi    # 0x14e6ed
movl $0x27, %edx
movq %r14, %rdi
callq 0x44e0
testq %rbx, %rbx
je 0x2e20f
movq %rbx, %rdi
callq 0x41e0
movq 0x168139(%rip), %rdi    # 0x194ff0
movq %rbx, %rsi
movq %rax, %rdx
callq 0x44e0
jmp 0x2e227
movq (%r14), %rax
movq -0x18(%rax), %rax
leaq (%r14,%rax), %rdi
movl 0x20(%r14,%rax), %esi
orl $0x1, %esi
callq 0x4710
movq 0x1680da(%rip), %rdi    # 0x194fc0
leaq 0x126731(%rip), %rsi    # 0x15361e
movl $0x1, %edx
callq 0x44e0
xorpd %xmm0, %xmm0
movapd %xmm0, 0x180(%rsp)
movq $0x0, 0x190(%rsp)
movq 0x178(%rsp), %rcx
cmpl $0x0, 0x110(%rcx)
movb %bpl, 0x1f(%rsp)
jle 0x2e257
movl %r15d, %eax
incl %eax
movl $0x80, %ebp
leaq 0xc0(%rsp), %rdx
leaq (%rdx,%rbp), %r15
leaq 0x70(%rsp), %r12
leaq 0x90(%rsp), %r13
leaq 0x20(%rsp), %rdx
addq %rdx, %rbp
movl %eax, 0x15c(%rsp)
xorps %xmm0, %xmm0
cvtsi2sd %eax, %xmm0
movsd 0x120bbd(%rip), %xmm1   # 0x14db28
addsd %xmm0, %xmm1
movsd %xmm1, 0xb8(%rsp)
movapd %xmm0, 0x160(%rsp)
unpcklpd %xmm0, %xmm0            # xmm0 = xmm0[0,0]
movapd %xmm0, 0x1b0(%rsp)
xorl %esi, %esi
leaq 0x180(%rsp), %rbx
movq 0x2f0(%rcx), %r14
movq 0x2f8(%rcx), %rdx
subq %r14, %rdx
sarq $0x3, %rdx
movabsq $-0x79435e50d79435e5, %rax # imm = 0x86BCA1AF286BCA1B
imulq %rax, %rdx
cmpq %rsi, %rdx
jbe 0x2e436
movq %rsi, 0x1c8(%rsp)
imulq $0x98, %rsi, %rcx
movupd (%r14,%rcx), %xmm0
movupd 0x10(%r14,%rcx), %xmm1
movupd 0x20(%r14,%rcx), %xmm2
movupd 0x30(%r14,%rcx), %xmm3
movapd %xmm3, 0xf0(%rsp)
movapd %xmm2, 0xe0(%rsp)
movapd %xmm1, 0xd0(%rsp)
movapd %xmm0, 0xc0(%rsp)
leaq 0x110(%rsp), %rax
movq %rax, 0x100(%rsp)
movq 0x40(%r14,%rcx), %rsi
movq %rcx, 0x198(%rsp)
movq 0x48(%r14,%rcx), %rdx
addq %rsi, %rdx
leaq 0x100(%rsp), %rdi
callq 0xf3ce
addq 0x198(%rsp), %r14
leaq 0x130(%rsp), %rax
movq %rax, 0x120(%rsp)
movq 0x60(%r14), %rsi
movq 0x68(%r14), %rdx
addq %rsi, %rdx
leaq 0x120(%rsp), %rdi
callq 0xf3ce
movb 0x90(%r14), %al
movb %al, 0x10(%r15)
movups 0x80(%r14), %xmm0
movups %xmm0, (%r15)
movsd 0xd8(%rsp), %xmm0
movsd 0xe0(%rsp), %xmm1
movsd 0xe8(%rsp), %xmm2
leaq 0x1f0(%rsp), %rdi
callq 0x83f68
movq 0x200(%rsp), %rax
movq %rax, 0x10(%rsp)
movupd 0x1f0(%rsp), %xmm0
movupd %xmm0, (%rsp)
leaq 0x1d8(%rsp), %rdi
movq 0x178(%rsp), %rsi
callq 0x53a92
xorl %eax, %eax
movl %eax, 0x1a4(%rsp)
xorps %xmm0, %xmm0
cvtsi2sd %eax, %xmm0
movsd %xmm0, 0x1d0(%rsp)
xorl %eax, %eax
movl %eax, 0x1a8(%rsp)
xorps %xmm0, %xmm0
cvtsi2sd %eax, %xmm0
movsd %xmm0, 0x198(%rsp)
xorl %r14d, %r14d
leaq 0x1d8(%rsp), %rdi
xorl %esi, %esi
callq 0x83f9a
movsd (%rax), %xmm0
addsd 0x1d0(%rsp), %xmm0
movsd %xmm0, 0xd8(%rsp)
leaq 0x1d8(%rsp), %rdi
movl $0x1, %esi
callq 0x83f9a
movsd (%rax), %xmm0
addsd 0x198(%rsp), %xmm0
movsd %xmm0, 0xe0(%rsp)
leaq 0x1d8(%rsp), %rdi
movl $0x2, %esi
callq 0x83f9a
xorps %xmm0, %xmm0
cvtsi2sd %r14d, %xmm0
addsd (%rax), %xmm0
movsd %xmm0, 0xe8(%rsp)
movq %rbx, %rdi
leaq 0xc0(%rsp), %rsi
callq 0xe9a8
cmpb $0x0, 0x1ac(%rsp)
je 0x2e141
movsd 0x11fe96(%rip), %xmm1   # 0x14d048
ucomisd 0xd8(%rsp), %xmm1
jbe 0x2d2b7
movapd 0xc0(%rsp), %xmm0
movapd 0xd0(%rsp), %xmm1
movapd 0xe0(%rsp), %xmm2
movapd 0xf0(%rsp), %xmm3
movapd %xmm3, 0x50(%rsp)
movapd %xmm2, 0x40(%rsp)
movapd %xmm1, 0x30(%rsp)
movapd %xmm0, 0x20(%rsp)
movq %r12, 0x60(%rsp)
movq 0x100(%rsp), %rsi
movq 0x108(%rsp), %rdx
addq %rsi, %rdx
leaq 0x60(%rsp), %rdi
callq 0xf3ce
movq %r13, 0x80(%rsp)
movq 0x120(%rsp), %rsi
movq 0x128(%rsp), %rdx
addq %rsi, %rdx
leaq 0x80(%rsp), %rdi
callq 0xf3ce
movb 0x10(%r15), %al
movb %al, 0x10(%rbp)
movups (%r15), %xmm0
movups %xmm0, (%rbp)
movsd 0xd8(%rsp), %xmm0
addsd 0x160(%rsp), %xmm0
movsd %xmm0, 0x38(%rsp)
movq %rbx, %rdi
leaq 0x20(%rsp), %rsi
callq 0xe9a8
movq 0x80(%rsp), %rdi
cmpq %r13, %rdi
je 0x2d298
movq 0x90(%rsp), %rsi
incq %rsi
callq 0x4470
movq 0x60(%rsp), %rdi
cmpq %r12, %rdi
je 0x2d2af
movq 0x70(%rsp), %rsi
incq %rsi
callq 0x4470
movsd 0x11fd91(%rip), %xmm1   # 0x14d048
ucomisd 0xe0(%rsp), %xmm1
jbe 0x2d3bc
movapd 0xc0(%rsp), %xmm0
movapd 0xd0(%rsp), %xmm1
movapd 0xe0(%rsp), %xmm2
movapd 0xf0(%rsp), %xmm3
movapd %xmm3, 0x50(%rsp)
movapd %xmm2, 0x40(%rsp)
movapd %xmm1, 0x30(%rsp)
movapd %xmm0, 0x20(%rsp)
movq %r12, 0x60(%rsp)
movq 0x100(%rsp), %rsi
movq 0x108(%rsp), %rdx
addq %rsi, %rdx
leaq 0x60(%rsp), %rdi
callq 0xf3ce
movq %r13, 0x80(%rsp)
movq 0x120(%rsp), %rsi
movq 0x128(%rsp), %rdx
addq %rsi, %rdx
leaq 0x80(%rsp), %rdi
callq 0xf3ce
movb 0x10(%r15), %al
movb %al, 0x10(%rbp)
movups (%r15), %xmm0
movups %xmm0, (%rbp)
movsd 0xe0(%rsp), %xmm0
addsd 0x160(%rsp), %xmm0
movsd %xmm0, 0x40(%rsp)
movq %rbx, %rdi
leaq 0x20(%rsp), %rsi
callq 0xe9a8
movq 0x80(%rsp), %rdi
cmpq %r13, %rdi
je 0x2d39d
movq 0x90(%rsp), %rsi
incq %rsi
callq 0x4470
movq 0x60(%rsp), %rdi
cmpq %r12, %rdi
je 0x2d3b4
movq 0x70(%rsp), %rsi
incq %rsi
callq 0x4470
movsd 0x11fc8c(%rip), %xmm1   # 0x14d048
ucomisd 0xe8(%rsp), %xmm1
jbe 0x2d4c1
movapd 0xc0(%rsp), %xmm0
movapd 0xd0(%rsp), %xmm1
movapd 0xe0(%rsp), %xmm2
movapd 0xf0(%rsp), %xmm3
movapd %xmm3, 0x50(%rsp)
movapd %xmm2, 0x40(%rsp)
movapd %xmm1, 0x30(%rsp)
movapd %xmm0, 0x20(%rsp)
movq %r12, 0x60(%rsp)
movq 0x100(%rsp), %rsi
movq 0x108(%rsp), %rdx
addq %rsi, %rdx
leaq 0x60(%rsp), %rdi
callq 0xf3ce
movq %r13, 0x80(%rsp)
movq 0x120(%rsp), %rsi
movq 0x128(%rsp), %rdx
addq %rsi, %rdx
leaq 0x80(%rsp), %rdi
callq 0xf3ce
movb 0x10(%r15), %al
movb %al, 0x10(%rbp)
movups (%r15), %xmm0
movups %xmm0, (%rbp)
movsd 0xe8(%rsp), %xmm0
addsd 0x160(%rsp), %xmm0
movsd %xmm0, 0x48(%rsp)
movq %rbx, %rdi
leaq 0x20(%rsp), %rsi
callq 0xe9a8
movq 0x80(%rsp), %rdi
cmpq %r13, %rdi
je 0x2d4a2
movq 0x90(%rsp), %rsi
incq %rsi
callq 0x4470
movq 0x60(%rsp), %rdi
cmpq %r12, %rdi
je 0x2d4b9
movq 0x70(%rsp), %rsi
incq %rsi
callq 0x4470
movsd 0x11fb87(%rip), %xmm1   # 0x14d048
movsd 0xd8(%rsp), %xmm0
ucomisd %xmm0, %xmm1
jbe 0x2d5da
ucomisd 0xe0(%rsp), %xmm1
jbe 0x2d5da
movapd 0xc0(%rsp), %xmm0
movapd 0xd0(%rsp), %xmm1
movapd 0xe0(%rsp), %xmm2
movapd 0xf0(%rsp), %xmm3
movapd %xmm3, 0x50(%rsp)
movapd %xmm2, 0x40(%rsp)
movapd %xmm1, 0x30(%rsp)
movapd %xmm0, 0x20(%rsp)
movq %r12, 0x60(%rsp)
movq 0x100(%rsp), %rsi
movq 0x108(%rsp), %rdx
addq %rsi, %rdx
leaq 0x60(%rsp), %rdi
callq 0xf3ce
movq %r13, 0x80(%rsp)
movq 0x120(%rsp), %rsi
movq 0x128(%rsp), %rdx
addq %rsi, %rdx
leaq 0x80(%rsp), %rdi
callq 0xf3ce
movb 0x10(%r15), %al
movb %al, 0x10(%rbp)
movups (%r15), %xmm0
movups %xmm0, (%rbp)
movupd 0xd8(%rsp), %xmm0
addpd 0x1b0(%rsp), %xmm0
movupd %xmm0, 0x38(%rsp)
movq %rbx, %rdi
leaq 0x20(%rsp), %rsi
callq 0xe9a8
movq 0x80(%rsp), %rdi
cmpq %r13, %rdi
je 0x2d5ba
movq 0x90(%rsp), %rsi
incq %rsi
callq 0x4470
movq 0x60(%rsp), %rdi
cmpq %r12, %rdi
je 0x2d5d1
movq 0x70(%rsp), %rsi
incq %rsi
callq 0x4470
movsd 0xd8(%rsp), %xmm0
movsd 0x11fa66(%rip), %xmm1   # 0x14d048
ucomisd %xmm0, %xmm1
movsd 0xe8(%rsp), %xmm0
jbe 0x2d70d
ucomisd %xmm0, %xmm1
jbe 0x2d70d
movapd 0xc0(%rsp), %xmm0
movapd 0xd0(%rsp), %xmm1
movapd 0xe0(%rsp), %xmm2
movapd 0xf0(%rsp), %xmm3
movapd %xmm3, 0x50(%rsp)
movapd %xmm2, 0x40(%rsp)
movapd %xmm1, 0x30(%rsp)
movapd %xmm0, 0x20(%rsp)
movq %r12, 0x60(%rsp)
movq 0x100(%rsp), %rsi
movq 0x108(%rsp), %rdx
addq %rsi, %rdx
leaq 0x60(%rsp), %rdi
callq 0xf3ce
movq %r13, 0x80(%rsp)
movq 0x120(%rsp), %rsi
movq 0x128(%rsp), %rdx
addq %rsi, %rdx
leaq 0x80(%rsp), %rdi
callq 0xf3ce
movb 0x10(%r15), %al
movb %al, 0x10(%rbp)
movups (%r15), %xmm0
movups %xmm0, (%rbp)
movsd 0xd8(%rsp), %xmm0
movapd 0x160(%rsp), %xmm1
addsd %xmm1, %xmm0
movsd %xmm0, 0x38(%rsp)
movsd 0xe8(%rsp), %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, 0x48(%rsp)
movq %rbx, %rdi
leaq 0x20(%rsp), %rsi
callq 0xe9a8
movq 0x80(%rsp), %rdi
cmpq %r13, %rdi
je 0x2d6ed
movq 0x90(%rsp), %rsi
incq %rsi
callq 0x4470
movq 0x60(%rsp), %rdi
cmpq %r12, %rdi
je 0x2d704
movq 0x70(%rsp), %rsi
incq %rsi
callq 0x4470
movsd 0xe8(%rsp), %xmm0
movsd 0xe0(%rsp), %xmm1
movsd 0x11f92a(%rip), %xmm2   # 0x14d048
ucomisd %xmm1, %xmm2
jbe 0x2d832
ucomisd %xmm0, %xmm2
jbe 0x2d832
movapd 0xc0(%rsp), %xmm0
movapd 0xd0(%rsp), %xmm1
movapd 0xe0(%rsp), %xmm2
movapd 0xf0(%rsp), %xmm3
movapd %xmm3, 0x50(%rsp)
movapd %xmm2, 0x40(%rsp)
movapd %xmm1, 0x30(%rsp)
movapd %xmm0, 0x20(%rsp)
movq %r12, 0x60(%rsp)
movq 0x100(%rsp), %rsi
movq 0x108(%rsp), %rdx
addq %rsi, %rdx
leaq 0x60(%rsp), %rdi
callq 0xf3ce
movq %r13, 0x80(%rsp)
movq 0x120(%rsp), %rsi
movq 0x128(%rsp), %rdx
addq %rsi, %rdx
leaq 0x80(%rsp), %rdi
callq 0xf3ce
movb 0x10(%r15), %al
movb %al, 0x10(%rbp)
movups (%r15), %xmm0
movups %xmm0, (%rbp)
movapd 0xe0(%rsp), %xmm0
addpd 0x1b0(%rsp), %xmm0
movapd %xmm0, 0x40(%rsp)
movq %rbx, %rdi
leaq 0x20(%rsp), %rsi
callq 0xe9a8
movq 0x80(%rsp), %rdi
cmpq %r13, %rdi
je 0x2d809
movq 0x90(%rsp), %rsi
incq %rsi
callq 0x4470
movq 0x60(%rsp), %rdi
cmpq %r12, %rdi
je 0x2d820
movq 0x70(%rsp), %rsi
incq %rsi
callq 0x4470
movsd 0xe0(%rsp), %xmm1
movsd 0xe8(%rsp), %xmm0
movsd 0xd8(%rsp), %xmm2
movsd 0x11f805(%rip), %xmm3   # 0x14d048
ucomisd %xmm2, %xmm3
jbe 0x2d970
ucomisd %xmm1, %xmm3
jbe 0x2d970
ucomisd %xmm0, %xmm3
jbe 0x2d970
movapd 0xc0(%rsp), %xmm0
movapd 0xd0(%rsp), %xmm1
movapd 0xe0(%rsp), %xmm2
movapd 0xf0(%rsp), %xmm3
movapd %xmm3, 0x50(%rsp)
movapd %xmm2, 0x40(%rsp)
movapd %xmm1, 0x30(%rsp)
movapd %xmm0, 0x20(%rsp)
movq %r12, 0x60(%rsp)
movq 0x100(%rsp), %rsi
movq 0x108(%rsp), %rdx
addq %rsi, %rdx
leaq 0x60(%rsp), %rdi
callq 0xf3ce
movq %r13, 0x80(%rsp)
movq 0x120(%rsp), %rsi
movq 0x128(%rsp), %rdx
addq %rsi, %rdx
leaq 0x80(%rsp), %rdi
callq 0xf3ce
movb 0x10(%r15), %al
movb %al, 0x10(%rbp)
movups (%r15), %xmm0
movups %xmm0, (%rbp)
movupd 0xd8(%rsp), %xmm0
addpd 0x1b0(%rsp), %xmm0
movupd %xmm0, 0x38(%rsp)
movsd 0xe8(%rsp), %xmm0
addsd 0x160(%rsp), %xmm0
movsd %xmm0, 0x48(%rsp)
movq %rbx, %rdi
leaq 0x20(%rsp), %rsi
callq 0xe9a8
movq 0x80(%rsp), %rdi
cmpq %r13, %rdi
je 0x2d950
movq 0x90(%rsp), %rsi
incq %rsi
callq 0x4470
movq 0x60(%rsp), %rdi
cmpq %r12, %rdi
je 0x2d967
movq 0x70(%rsp), %rsi
incq %rsi
callq 0x4470
movsd 0xd8(%rsp), %xmm2
movsd 0xb8(%rsp), %xmm3
ucomisd %xmm3, %xmm2
jbe 0x2da7a
movapd 0xc0(%rsp), %xmm0
movapd 0xd0(%rsp), %xmm1
movapd 0xe0(%rsp), %xmm2
movapd 0xf0(%rsp), %xmm3
movapd %xmm3, 0x50(%rsp)
movapd %xmm2, 0x40(%rsp)
movapd %xmm1, 0x30(%rsp)
movapd %xmm0, 0x20(%rsp)
movq %r12, 0x60(%rsp)
movq 0x100(%rsp), %rsi
movq 0x108(%rsp), %rdx
addq %rsi, %rdx
leaq 0x60(%rsp), %rdi
callq 0xf3ce
movq %r13, 0x80(%rsp)
movq 0x120(%rsp), %rsi
movq 0x128(%rsp), %rdx
addq %rsi, %rdx
leaq 0x80(%rsp), %rdi
callq 0xf3ce
movb 0x10(%r15), %al
movb %al, 0x10(%rbp)
movups (%r15), %xmm0
movups %xmm0, (%rbp)
movsd 0xd8(%rsp), %xmm0
subsd 0x160(%rsp), %xmm0
movsd %xmm0, 0x38(%rsp)
movq %rbx, %rdi
leaq 0x20(%rsp), %rsi
callq 0xe9a8
movq 0x80(%rsp), %rdi
cmpq %r13, %rdi
je 0x2da5a
movq 0x90(%rsp), %rsi
incq %rsi
callq 0x4470
movq 0x60(%rsp), %rdi
cmpq %r12, %rdi
je 0x2da71
movq 0x70(%rsp), %rsi
incq %rsi
callq 0x4470
movsd 0xb8(%rsp), %xmm3
movsd 0xe0(%rsp), %xmm0
ucomisd %xmm3, %xmm0
jbe 0x2db84
movapd 0xc0(%rsp), %xmm0
movapd 0xd0(%rsp), %xmm1
movapd 0xe0(%rsp), %xmm2
movapd 0xf0(%rsp), %xmm3
movapd %xmm3, 0x50(%rsp)
movapd %xmm2, 0x40(%rsp)
movapd %xmm1, 0x30(%rsp)
movapd %xmm0, 0x20(%rsp)
movq %r12, 0x60(%rsp)
movq 0x100(%rsp), %rsi
movq 0x108(%rsp), %rdx
addq %rsi, %rdx
leaq 0x60(%rsp), %rdi
callq 0xf3ce
movq %r13, 0x80(%rsp)
movq 0x120(%rsp), %rsi
movq 0x128(%rsp), %rdx
addq %rsi, %rdx
leaq 0x80(%rsp), %rdi
callq 0xf3ce
movb 0x10(%r15), %al
movb %al, 0x10(%rbp)
movups (%r15), %xmm0
movups %xmm0, (%rbp)
movsd 0xe0(%rsp), %xmm0
subsd 0x160(%rsp), %xmm0
movsd %xmm0, 0x40(%rsp)
movq %rbx, %rdi
leaq 0x20(%rsp), %rsi
callq 0xe9a8
movq 0x80(%rsp), %rdi
cmpq %r13, %rdi
je 0x2db64
movq 0x90(%rsp), %rsi
incq %rsi
callq 0x4470
movq 0x60(%rsp), %rdi
cmpq %r12, %rdi
je 0x2db7b
movq 0x70(%rsp), %rsi
incq %rsi
callq 0x4470
movsd 0xb8(%rsp), %xmm3
movsd 0xe8(%rsp), %xmm0
ucomisd %xmm3, %xmm0
jbe 0x2dc8e
movapd 0xc0(%rsp), %xmm0
movapd 0xd0(%rsp), %xmm1
movapd 0xe0(%rsp), %xmm2
movapd 0xf0(%rsp), %xmm3
movapd %xmm3, 0x50(%rsp)
movapd %xmm2, 0x40(%rsp)
movapd %xmm1, 0x30(%rsp)
movapd %xmm0, 0x20(%rsp)
movq %r12, 0x60(%rsp)
movq 0x100(%rsp), %rsi
movq 0x108(%rsp), %rdx
addq %rsi, %rdx
leaq 0x60(%rsp), %rdi
callq 0xf3ce
movq %r13, 0x80(%rsp)
movq 0x120(%rsp), %rsi
movq 0x128(%rsp), %rdx
addq %rsi, %rdx
leaq 0x80(%rsp), %rdi
callq 0xf3ce
movb 0x10(%r15), %al
movb %al, 0x10(%rbp)
movups (%r15), %xmm0
movups %xmm0, (%rbp)
movsd 0xe8(%rsp), %xmm0
subsd 0x160(%rsp), %xmm0
movsd %xmm0, 0x48(%rsp)
movq %rbx, %rdi
leaq 0x20(%rsp), %rsi
callq 0xe9a8
movq 0x80(%rsp), %rdi
cmpq %r13, %rdi
je 0x2dc6e
movq 0x90(%rsp), %rsi
incq %rsi
callq 0x4470
movq 0x60(%rsp), %rdi
cmpq %r12, %rdi
je 0x2dc85
movq 0x70(%rsp), %rsi
incq %rsi
callq 0x4470
movsd 0xb8(%rsp), %xmm3
movsd 0xd8(%rsp), %xmm0
ucomisd %xmm3, %xmm0
jbe 0x2ddab
movsd 0xe0(%rsp), %xmm1
ucomisd %xmm3, %xmm1
jbe 0x2ddab
movapd 0xc0(%rsp), %xmm0
movapd 0xd0(%rsp), %xmm1
movapd 0xe0(%rsp), %xmm2
movapd 0xf0(%rsp), %xmm3
movapd %xmm3, 0x50(%rsp)
movapd %xmm2, 0x40(%rsp)
movapd %xmm1, 0x30(%rsp)
movapd %xmm0, 0x20(%rsp)
movq %r12, 0x60(%rsp)
movq 0x100(%rsp), %rsi
movq 0x108(%rsp), %rdx
addq %rsi, %rdx
leaq 0x60(%rsp), %rdi
callq 0xf3ce
movq %r13, 0x80(%rsp)
movq 0x120(%rsp), %rsi
movq 0x128(%rsp), %rdx
addq %rsi, %rdx
leaq 0x80(%rsp), %rdi
callq 0xf3ce
movb 0x10(%r15), %al
movb %al, 0x10(%rbp)
movups (%r15), %xmm0
movups %xmm0, (%rbp)
movupd 0xd8(%rsp), %xmm0
subpd 0x1b0(%rsp), %xmm0
movupd %xmm0, 0x38(%rsp)
movq %rbx, %rdi
leaq 0x20(%rsp), %rsi
callq 0xe9a8
movq 0x80(%rsp), %rdi
cmpq %r13, %rdi
je 0x2dd8b
movq 0x90(%rsp), %rsi
incq %rsi
callq 0x4470
movq 0x60(%rsp), %rdi
cmpq %r12, %rdi
je 0x2dda2
movq 0x70(%rsp), %rsi
incq %rsi
callq 0x4470
movsd 0xd8(%rsp), %xmm0
movsd 0xb8(%rsp), %xmm1
ucomisd %xmm1, %xmm0
movsd 0xe8(%rsp), %xmm0
jbe 0x2dedf
ucomisd %xmm1, %xmm0
jbe 0x2dedf
movapd 0xc0(%rsp), %xmm0
movapd 0xd0(%rsp), %xmm1
movapd 0xe0(%rsp), %xmm2
movapd 0xf0(%rsp), %xmm3
movapd %xmm3, 0x50(%rsp)
movapd %xmm2, 0x40(%rsp)
movapd %xmm1, 0x30(%rsp)
movapd %xmm0, 0x20(%rsp)
movq %r12, 0x60(%rsp)
movq 0x100(%rsp), %rsi
movq 0x108(%rsp), %rdx
addq %rsi, %rdx
leaq 0x60(%rsp), %rdi
callq 0xf3ce
movq %r13, 0x80(%rsp)
movq 0x120(%rsp), %rsi
movq 0x128(%rsp), %rdx
addq %rsi, %rdx
leaq 0x80(%rsp), %rdi
callq 0xf3ce
movb 0x10(%r15), %al
movb %al, 0x10(%rbp)
movups (%r15), %xmm0
movups %xmm0, (%rbp)
movsd 0xd8(%rsp), %xmm0
movsd 0xe8(%rsp), %xmm1
movapd 0x160(%rsp), %xmm2
subsd %xmm2, %xmm0
movsd %xmm0, 0x38(%rsp)
subsd %xmm2, %xmm1
movsd %xmm1, 0x48(%rsp)
movq %rbx, %rdi
leaq 0x20(%rsp), %rsi
callq 0xe9a8
movq 0x80(%rsp), %rdi
cmpq %r13, %rdi
je 0x2debf
movq 0x90(%rsp), %rsi
incq %rsi
callq 0x4470
movq 0x60(%rsp), %rdi
cmpq %r12, %rdi
je 0x2ded6
movq 0x70(%rsp), %rsi
incq %rsi
callq 0x4470
movsd 0xe8(%rsp), %xmm0
movsd 0xe0(%rsp), %xmm1
movsd 0xb8(%rsp), %xmm2
ucomisd %xmm2, %xmm1
jbe 0x2e005
ucomisd %xmm2, %xmm0
jbe 0x2e005
movapd 0xc0(%rsp), %xmm0
movapd 0xd0(%rsp), %xmm1
movapd 0xe0(%rsp), %xmm2
movapd 0xf0(%rsp), %xmm3
movapd %xmm3, 0x50(%rsp)
movapd %xmm2, 0x40(%rsp)
movapd %xmm1, 0x30(%rsp)
movapd %xmm0, 0x20(%rsp)
movq %r12, 0x60(%rsp)
movq 0x100(%rsp), %rsi
movq 0x108(%rsp), %rdx
addq %rsi, %rdx
leaq 0x60(%rsp), %rdi
callq 0xf3ce
movq %r13, 0x80(%rsp)
movq 0x120(%rsp), %rsi
movq 0x128(%rsp), %rdx
addq %rsi, %rdx
leaq 0x80(%rsp), %rdi
callq 0xf3ce
movb 0x10(%r15), %al
movb %al, 0x10(%rbp)
movups (%r15), %xmm0
movups %xmm0, (%rbp)
movapd 0xe0(%rsp), %xmm0
subpd 0x1b0(%rsp), %xmm0
movapd %xmm0, 0x40(%rsp)
movq %rbx, %rdi
leaq 0x20(%rsp), %rsi
callq 0xe9a8
movq 0x80(%rsp), %rdi
cmpq %r13, %rdi
je 0x2dfdc
movq 0x90(%rsp), %rsi
incq %rsi
callq 0x4470
movq 0x60(%rsp), %rdi
cmpq %r12, %rdi
je 0x2dff3
movq 0x70(%rsp), %rsi
incq %rsi
callq 0x4470
movsd 0xe0(%rsp), %xmm1
movsd 0xe8(%rsp), %xmm0
movsd 0xd8(%rsp), %xmm2
ucomisd 0xb8(%rsp), %xmm2
jbe 0x2e141
ucomisd 0xb8(%rsp), %xmm1
jbe 0x2e141
ucomisd 0xb8(%rsp), %xmm0
jbe 0x2e141
movapd 0xc0(%rsp), %xmm0
movapd 0xd0(%rsp), %xmm1
movapd 0xe0(%rsp), %xmm2
movapd 0xf0(%rsp), %xmm3
movapd %xmm3, 0x50(%rsp)
movapd %xmm2, 0x40(%rsp)
movapd %xmm1, 0x30(%rsp)
movapd %xmm0, 0x20(%rsp)
movq %r12, 0x60(%rsp)
movq 0x100(%rsp), %rsi
movq 0x108(%rsp), %rdx
addq %rsi, %rdx
leaq 0x60(%rsp), %rdi
callq 0xf3ce
movq %r13, 0x80(%rsp)
movq 0x120(%rsp), %rsi
movq 0x128(%rsp), %rdx
addq %rsi, %rdx
leaq 0x80(%rsp), %rdi
callq 0xf3ce
movb 0x10(%r15), %al
movb %al, 0x10(%rbp)
movups (%r15), %xmm0
movups %xmm0, (%rbp)
movupd 0xd8(%rsp), %xmm0
subpd 0x1b0(%rsp), %xmm0
movupd %xmm0, 0x38(%rsp)
movsd 0xe8(%rsp), %xmm0
subsd 0x160(%rsp), %xmm0
movsd %xmm0, 0x48(%rsp)
movq %rbx, %rdi
leaq 0x20(%rsp), %rsi
callq 0xe9a8
movq 0x80(%rsp), %rdi
cmpq %r13, %rdi
je 0x2e12a
movq 0x90(%rsp), %rsi
incq %rsi
callq 0x4470
movq 0x60(%rsp), %rdi
cmpq %r12, %rdi
je 0x2e141
movq 0x70(%rsp), %rsi
incq %rsi
callq 0x4470
incl %r14d
cmpl %r14d, 0x15c(%rsp)
jne 0x2d118
movl 0x1a8(%rsp), %eax
incl %eax
cmpl 0x15c(%rsp), %eax
jne 0x2d0fe
movl 0x1a4(%rsp), %eax
incl %eax
cmpl 0x15c(%rsp), %eax
jne 0x2d0e5
movq 0x120(%rsp), %rdi
leaq 0x130(%rsp), %rax
cmpq %rax, %rdi
je 0x2e1a3
movq 0x130(%rsp), %rsi
incq %rsi
callq 0x4470
movq 0x100(%rsp), %rdi
leaq 0x110(%rsp), %rax
cmpq %rax, %rdi
je 0x2e1c8
movq 0x110(%rsp), %rsi
incq %rsi
callq 0x4470
movq 0x1c8(%rsp), %rsi
incq %rsi
movq 0x178(%rsp), %rcx
movslq 0x110(%rcx), %rax
cmpq %rax, %rsi
jl 0x2cf98
movq 0x188(%rsp), %rsi
subq 0x180(%rsp), %rsi
sarq $0x3, %rsi
movabsq $-0x79435e50d79435e5, %rax # imm = 0x86BCA1AF286BCA1B
imulq %rax, %rsi
jmp 0x2e259
movq (%r14), %rax
movq -0x18(%rax), %rax
leaq (%r14,%rax), %rdi
movl 0x20(%r14,%rax), %esi
orl $0x1, %esi
callq 0x4710
movq (%r14), %rax
addq -0x18(%rax), %r14
movq %r14, %rdi
movl $0xa, %esi
callq 0x4420
movsbl %al, %esi
movq 0x166dab(%rip), %rdi    # 0x194ff0
callq 0x4040
movq %rax, %rdi
callq 0x42c0
jmp 0x2e404
xorl %esi, %esi
leaq 0x218(%rsp), %rdi
callq 0x42b0
movq %rax, %r14
leaq 0x1253ae(%rip), %rsi    # 0x15361e
movl $0x1, %edx
movq %rax, %rdi
callq 0x44e0
leaq 0x12539a(%rip), %rsi    # 0x15361e
movl $0x1, %edx
movq %r14, %rdi
callq 0x44e0
movq 0x180(%rsp), %rax
cmpq %rax, 0x188(%rsp)
je 0x2e3e5
xorl %ebx, %ebx
leaq 0xc0(%rsp), %r14
movabsq $-0x79435e50d79435e5, %r13 # imm = 0x86BCA1AF286BCA1B
leaq 0x127314(%rip), %r12    # 0x1555d6
xorl %r15d, %r15d
movsd 0x18(%rax,%rbx), %xmm0
movsd 0x20(%rax,%rbx), %xmm1
movsd 0x28(%rax,%rbx), %xmm2
movq %r14, %rdi
movq 0x178(%rsp), %rsi
callq 0x52d94
movq 0x180(%rsp), %rax
movq 0x188(%rsp), %rdx
subq %rax, %rdx
sarq $0x3, %rdx
imulq %r13, %rdx
cmpq %r15, %rdx
jbe 0x2e425
movq 0x40(%rax,%rbx), %rsi
movq 0x48(%rax,%rbx), %rdx
leaq 0x218(%rsp), %rdi
callq 0x44e0
movq %rax, %rbp
movl $0x1, %edx
movq %rax, %rdi
movq %r12, %rsi
callq 0x44e0
movq %r14, %rdi
xorl %esi, %esi
callq 0x83f9a
movsd (%rax), %xmm0
movq %rbp, %rdi
callq 0x46b0
movq %rax, %rbp
movl $0x1, %edx
movq %rax, %rdi
movq %r12, %rsi
callq 0x44e0
movq %r14, %rdi
movl $0x1, %esi
callq 0x83f9a
movsd (%rax), %xmm0
movq %rbp, %rdi
callq 0x46b0
movq %rax, %rbp
movl $0x1, %edx
movq %rax, %rdi
movq %r12, %rsi
callq 0x44e0
movq %r14, %rdi
movl $0x2, %esi
callq 0x83f9a
movsd (%rax), %xmm0
movq %rbp, %rdi
callq 0x46b0
movl $0x1, %edx
movq %rax, %rdi
leaq 0x12526c(%rip), %rsi    # 0x15361e
callq 0x44e0
incq %r15
movq 0x180(%rsp), %rax
movq 0x188(%rsp), %rcx
subq %rax, %rcx
sarq $0x3, %rcx
imulq %r13, %rcx
addq $0x98, %rbx
cmpq %r15, %rcx
ja 0x2e2c5
leaq 0x180(%rsp), %rdi
callq 0xf2da
leaq 0x208(%rsp), %rdi
callq 0x4090
movb 0x1f(%rsp), %bpl
leaq 0x208(%rsp), %rdi
callq 0x4110
movl %ebp, %eax
addq $0x418, %rsp            # imm = 0x418
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x11f2c9(%rip), %rdi    # 0x14d6f5
movq %r15, %rsi
xorl %eax, %eax
callq 0x4630
leaq 0x11f2b8(%rip), %rdi    # 0x14d6f5
xorl %eax, %eax
callq 0x4630
jmp 0x2e466
jmp 0x2e4e9
jmp 0x2e4e9
movq %rax, %rbx
jmp 0x2e511
jmp 0x2e466
jmp 0x2e466
jmp 0x2e466
movq %rax, %rbx
jmp 0x2e543
movq %rax, %rbx
jmp 0x2e536
jmp 0x2e4cd
jmp 0x2e4e9
jmp 0x2e4bc
jmp 0x2e4e9
jmp 0x2e4cd
jmp 0x2e4bc
jmp 0x2e4cd
jmp 0x2e4e9
jmp 0x2e4e9
jmp 0x2e4bc
jmp 0x2e4bc
jmp 0x2e4cd
jmp 0x2e4bc
jmp 0x2e4e9
jmp 0x2e4cd
jmp 0x2e4e9
jmp 0x2e4bc
jmp 0x2e4bc
jmp 0x2e4cd
jmp 0x2e4cd
jmp 0x2e4e9
jmp 0x2e4e9
jmp 0x2e4cd
jmp 0x2e4bc
jmp 0x2e4e9
jmp 0x2e4cd
jmp 0x2e4bc
jmp 0x2e4e9
jmp 0x2e4e9
jmp 0x2e4bc
jmp 0x2e4cd
jmp 0x2e4cd
jmp 0x2e4bc
jmp 0x2e4e9
jmp 0x2e4cd
jmp 0x2e4bc
jmp 0x2e4e9
jmp 0x2e4e9
jmp 0x2e4bc
movq %rax, %rbx
leaq 0x20(%rsp), %rdi
callq 0x2f5e8
jmp 0x2e4ec
jmp 0x2e4cd
movq %rax, %rbx
movq 0x60(%rsp), %rdi
cmpq %r12, %rdi
je 0x2e4ec
movq 0x70(%rsp), %rsi
incq %rsi
callq 0x4470
jmp 0x2e4ec
movq %rax, %rbx
movq 0x120(%rsp), %rdi
leaq 0x130(%rsp), %rax
cmpq %rax, %rdi
je 0x2e511
movq 0x130(%rsp), %rsi
incq %rsi
callq 0x4470
movq 0x100(%rsp), %rdi
leaq 0x110(%rsp), %rax
cmpq %rax, %rdi
je 0x2e536
movq 0x110(%rsp), %rsi
incq %rsi
callq 0x4470
leaq 0x180(%rsp), %rdi
callq 0xf2da
leaq 0x208(%rsp), %rdi
callq 0x4110
movq %rbx, %rdi
callq 0x4780