// File: /workspace/github_cpp_makefile_star2_O2/Luthaf[P]zeopp/area_and_volume.cc
// Function: visVoro(char*, double, int, int, int, VORONOI_NETWORK*, ATOM_NETWORK*)
void visVoro(char* name, double probeRad, int skel_a, int skel_b, int skel_c, VORONOI_NETWORK* vornet, ATOM_NETWORK* atmnet) {
  string filename_xyz = string(name).append("_voro.xyz");
  string filename2_xyz = string(name).append("_voro_accessible.xyz");
  string filename3_xyz = string(name).append("_voro_nonaccessible.xyz");
  vector<bool> accessInfo;
  vector<bool> nonaccessInfo;
  vector<CHANNEL> channels;
  CHANNEL::findChannels(vornet, probeRad, &accessInfo, &channels);
  int num_accessible = 0;
  for(unsigned int i = 0; i < accessInfo.size(); i++) if(accessInfo.at(i)==1) num_accessible++;

  int num_nonaccessible = 0;
  nonaccessInfo.resize(accessInfo.size(),false);
  for(unsigned int i = 0; i < accessInfo.size(); i++) 
    if(vornet->nodes.at(i).rad_stat_sphere>probeRad&&accessInfo.at(i)==0) 
       {
       num_nonaccessible++;
       nonaccessInfo[i]=true;
       };

  //write Voronoi nodes as .xyz
  FILE *output_xyz; output_xyz = fopen(filename_xyz.c_str(), "w");
  FILE *output2_xyz; output2_xyz = fopen(filename2_xyz.c_str(), "w");
  FILE *output3_xyz; output3_xyz = fopen(filename3_xyz.c_str(), "w");
  fprintf(output_xyz, "%d\nVoronoi diagram for %s with probe radius %.3f\n", (int)(accessInfo.size()), name, probeRad);
  fprintf(output2_xyz, "%d\nVoronoi accessible diagram for %s with probe radius %.3f\n", num_accessible, name, probeRad);
  fprintf(output3_xyz, "%d\nVoronoi non-accessible diagram for %s with probe radius %.3f\n", num_nonaccessible, name, probeRad);
  for(unsigned int i = 0; i < accessInfo.size(); i++) {
    fprintf(output_xyz, "Al %.3f %.3f %.3f %.3f\n", vornet->nodes.at(i).x, vornet->nodes.at(i).y, vornet->nodes.at(i).z, vornet->nodes.at(i).rad_stat_sphere); //"Al" for 'all' Voronoi nodes, shown in main unit cell
    if(accessInfo.at(i)==1) {
      Point abc = atmnet->xyz_to_abc(vornet->nodes.at(i).x, vornet->nodes.at(i).y, vornet->nodes.at(i).z);
      float new_a = abc.vals[0] + skel_a;
      float new_b = abc.vals[1] + skel_b;
      float new_c = abc.vals[2] + skel_c;
      Point new_xyz = atmnet->abc_to_xyz(new_a, new_b, new_c);
      fprintf(output2_xyz, "Ac %.3f %.3f %.3f %.3f\n", new_xyz.vals[0], new_xyz.vals[1], new_xyz.vals[2], vornet->nodes.at(i).rad_stat_sphere); //"Ac" for 'accessible' Voronoi nodes, shown in adjacent cell
    } else {
    if(vornet->nodes.at(i).rad_stat_sphere>probeRad) {
      Point abc = atmnet->xyz_to_abc(vornet->nodes.at(i).x, vornet->nodes.at(i).y, vornet->nodes.at(i).z);
      float new_a = abc.vals[0] + skel_a;
      float new_b = abc.vals[1] + skel_b;
      float new_c = abc.vals[2] + skel_c;
      Point new_xyz = atmnet->abc_to_xyz(new_a, new_b, new_c);
      fprintf(output3_xyz, "In %.3f %.3f %.3f %.3f\n", new_xyz.vals[0], new_xyz.vals[1], new_xyz.vals[2], vornet->nodes.at(i).rad_stat_sphere); //"In" for 'nonaccessible' Voronoi nodes, shown in adjacent cell

     }; // ends if for nodes larger than probeRad

    };
  }
  fclose(output_xyz);
  fclose(output2_xyz);
  fclose(output3_xyz);


  // VTK saving function
  // Note: to avoid issues with reindexing of nodes in .vtk file
  //       when printing (non)accesible network, all nodes are printed first

  //write Voronoi edges as .vtk
  string filename_vtk = string(name).append("_voro.vtk");
  string filename2_vtk = string(name).append("_voro_accessible.vtk");
  string filename3_vtk = string(name).append("_voro_nonaccessible.vtk");
  //start saving the addresses of (non)accessible nodes
  int *accessIndex;
  accessIndex = new int[accessInfo.size()];
  int *nonaccessIndex;
  nonaccessIndex = new int[nonaccessInfo.size()];
  int count = accessInfo.size(); //start counter at total number of nodes - because accessible nodes are added on after
  int countNonacc = nonaccessInfo.size(); //start counter at total number of nodes - because nonaccessible nodes are added on after
  for(unsigned int i = 0; i < accessInfo.size(); i++) {
    if(accessInfo.at(i)==1) {
      accessIndex[i] = count;
      count++;
    } else accessIndex[i] = -1;
    if(nonaccessInfo.at(i)==1) {
      nonaccessIndex[i] = countNonacc;
      countNonacc++;
    } else nonaccessIndex[i] = -1;
  }
  //refer to those addresses in edge storage
  vector <int> to_vector, from_vector;
  vector <int> to2_vector, from2_vector;
  vector <int> to3_vector, from3_vector;
  for(unsigned int i=0; i<vornet->edges.size(); i++) {
		if(accessInfo.at(vornet->edges.at(i).from)>0 && accessInfo.at(vornet->edges.at(i).to)>0 && vornet->edges.at(i).rad_moving_sphere>probeRad) {
      //this edge is accessible - save it for accessible part of the image
      if(vornet->edges.at(i).delta_uc_x==0 && vornet->edges.at(i).delta_uc_y==0 && vornet->edges.at(i).delta_uc_z==0) { //just edges within the unit cell
        from2_vector.push_back(accessIndex[vornet->edges.at(i).from]);
        to2_vector.push_back(accessIndex[vornet->edges.at(i).to]);
      } else if(vornet->edges.at(i).delta_uc_x==skel_a && vornet->edges.at(i).delta_uc_y==skel_b && vornet->edges.at(i).delta_uc_z==skel_c) { //just edges from overall section to accessible section
        from2_vector.push_back(vornet->edges.at(i).from);
        to2_vector.push_back(accessIndex[vornet->edges.at(i).to]);
      }
    } // ends if for accessible

      if(nonaccessInfo.at(vornet->edges.at(i).from)>0 && nonaccessInfo.at(vornet->edges.at(i).to)>0 && vornet->edges.at(i).rad_moving_sphere>probeRad) {
      //this edge is within nonaccessible pocket - save it for nonaccessible part of the image
      if(vornet->edges.at(i).delta_uc_x==0 && vornet->edges.at(i).delta_uc_y==0 && vornet->edges.at(i).delta_uc_z==0) { //just edges within the unit cell
        from3_vector.push_back(nonaccessIndex[vornet->edges.at(i).from]);
        to3_vector.push_back(nonaccessIndex[vornet->edges.at(i).to]);
      } else if(vornet->edges.at(i).delta_uc_x==skel_a && vornet->edges.at(i).delta_uc_y==skel_b && vornet->edges.at(i).delta_uc_z==skel_c) { //just edges from overall section to accessible section
        from3_vector.push_back(nonaccessIndex[vornet->edges.at(i).from]);
        to3_vector.push_back(nonaccessIndex[vornet->edges.at(i).to]);
      }
    } // ends if for nonaccessible

    if(vornet->edges.at(i).delta_uc_x==0 && vornet->edges.at(i).delta_uc_y==0 && vornet->edges.at(i).delta_uc_z==0) { //just edges within the unit cell
      //regardless of accessibility, want to save the within-cell edges for overall part of the image
      from_vector.push_back(vornet->edges.at(i).from);
      to_vector.push_back(vornet->edges.at(i).to);
    }
  }; // end loop over all edges


  // VTK file write
  FILE *output_vtk; output_vtk = fopen(filename_vtk.c_str(), "w");
  FILE *output2_vtk; output2_vtk = fopen(filename2_vtk.c_str(), "w");
  FILE *output3_vtk; output3_vtk = fopen(filename3_vtk.c_str(), "w");
  fprintf(output_vtk, "# vtk DataFile Version 2.0\nvtk data for file %s\nASCII\nDATASET POLYDATA\nPOINTS %d double\n", name, (int)(accessInfo.size()));
  fprintf(output2_vtk, "# vtk DataFile Version 2.0\nvtk data for file %s\nASCII\nDATASET POLYDATA\nPOINTS %d double\n", name, (int)(accessInfo.size())+num_accessible);
  fprintf(output3_vtk, "# vtk DataFile Version 2.0\nvtk data for file %s\nASCII\nDATASET POLYDATA\nPOINTS %d double\n", name, (int)(accessInfo.size())+num_nonaccessible);
  //write nodes to file
  for(unsigned int i = 0; i < accessInfo.size(); i++) {
    fprintf(output_vtk, "%.3f %.3f %.3f\n", vornet->nodes.at(i).x, vornet->nodes.at(i).y, vornet->nodes.at(i).z);
    fprintf(output2_vtk, "%.3f %.3f %.3f\n", vornet->nodes.at(i).x, vornet->nodes.at(i).y, vornet->nodes.at(i).z);
    fprintf(output3_vtk, "%.3f %.3f %.3f\n", vornet->nodes.at(i).x, vornet->nodes.at(i).y, vornet->nodes.at(i).z);
  }
  for(unsigned int i = 0; i < accessInfo.size(); i++) {
    if(accessInfo.at(i)==1) {
      Point abc = atmnet->xyz_to_abc(vornet->nodes.at(i).x, vornet->nodes.at(i).y, vornet->nodes.at(i).z);
      float new_a = abc.vals[0] + skel_a;
      float new_b = abc.vals[1] + skel_b;
      float new_c = abc.vals[2] + skel_c;
      Point new_xyz = atmnet->abc_to_xyz(new_a, new_b, new_c);
      fprintf(output2_vtk, "%.3f %.3f %.3f\n", new_xyz.vals[0], new_xyz.vals[1], new_xyz.vals[2]);
    };
    if(nonaccessInfo.at(i)==1) {
      Point abc = atmnet->xyz_to_abc(vornet->nodes.at(i).x, vornet->nodes.at(i).y, vornet->nodes.at(i).z);
      float new_a = abc.vals[0] + skel_a;
      float new_b = abc.vals[1] + skel_b;
      float new_c = abc.vals[2] + skel_c;
      Point new_xyz = atmnet->abc_to_xyz(new_a, new_b, new_c);
      fprintf(output3_vtk, "%.3f %.3f %.3f\n", new_xyz.vals[0], new_xyz.vals[1], new_xyz.vals[2]);
    };
  }
  //write edges to file
  fprintf(output_vtk, "LINES %d %d\n", (int)(to_vector.size()), ((int)(to_vector.size()))*3);
  for(unsigned int i = 0; i < to_vector.size(); i++) {
    fprintf(output_vtk, "2 %d %d\n", to_vector.at(i), from_vector.at(i));
  }
  fprintf(output2_vtk, "LINES %d %d\n", (int)(to2_vector.size()), ((int)(to2_vector.size()))*3);
  for(unsigned int i = 0; i < to2_vector.size(); i++) {
    fprintf(output2_vtk, "2 %d %d\n", to2_vector.at(i), from2_vector.at(i));
  }
  fprintf(output3_vtk, "LINES %d %d\n", (int)(to3_vector.size()), ((int)(to3_vector.size()))*3);
  for(unsigned int i = 0; i < to3_vector.size(); i++) {
    fprintf(output3_vtk, "2 %d %d\n", to3_vector.at(i), from3_vector.at(i));
  }
  fclose(output_vtk);
  fclose(output2_vtk);
  fclose(output3_vtk);
  //FREE MEMORY
  delete[] accessIndex;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x298, %rsp            # imm = 0x298
movq %r9, %r15
movq %r8, 0x78(%rsp)
movl %ecx, 0x64(%rsp)
movl %edx, 0x68(%rsp)
movl %esi, 0x6c(%rsp)
movsd %xmm0, 0x28(%rsp)
movq %rdi, %r12
leaq 0x30(%rsp), %rdi
leaq 0xc0(%rsp), %rdx
movq %r12, %rsi
callq 0x1b80e
leaq 0xce86c(%rip), %rsi     # 0x100b7d
leaq 0x30(%rsp), %rdi
callq 0x4800
leaq 0x278(%rsp), %rdi
movq %rax, %rsi
callq 0x45d0
leaq 0x30(%rsp), %rdi
callq 0x4210
leaq 0x30(%rsp), %rdi
leaq 0xc0(%rsp), %rdx
movq %r12, %rsi
callq 0x1b80e
leaq 0xce836(%rip), %rsi     # 0x100b87
leaq 0x30(%rsp), %rdi
callq 0x4800
leaq 0x258(%rsp), %rdi
movq %rax, %rsi
callq 0x45d0
leaq 0x30(%rsp), %rdi
callq 0x4210
leaq 0x30(%rsp), %rdi
leaq 0xc0(%rsp), %rdx
movq %r12, %rsi
callq 0x1b80e
leaq 0xce80b(%rip), %rsi     # 0x100b9c
leaq 0x30(%rsp), %rdi
callq 0x4800
leaq 0x238(%rsp), %rdi
movq %rax, %rsi
callq 0x45d0
leaq 0x30(%rsp), %rbx
movq %rbx, %rdi
callq 0x4210
andq $0x0, (%rbx)
andl $0x0, 0x8(%rbx)
andq $0x0, 0x10(%rbx)
andl $0x0, 0x18(%rbx)
andq $0x0, 0x20(%rbx)
andq $0x0, 0xc0(%rsp)
andl $0x0, 0xc8(%rsp)
andq $0x0, 0xd0(%rsp)
andl $0x0, 0xd8(%rsp)
andq $0x0, 0xe0(%rsp)
xorpd %xmm0, %xmm0
leaq 0x220(%rsp), %rdx
movapd %xmm0, (%rdx)
andq $0x0, 0x10(%rdx)
leaq 0x30(%rsp), %rsi
movq 0x78(%rsp), %rdi
movsd 0x28(%rsp), %xmm0
callq 0x55b76
xorl %ebx, %ebx
leaq 0x30(%rsp), %r14
movq $0x0, 0x20(%rsp)
movl %ebx, %ebx
movq 0x40(%rsp), %rax
movl 0x48(%rsp), %ecx
subq 0x30(%rsp), %rax
leaq (%rcx,%rax,8), %rsi
cmpq %rbx, %rsi
jbe 0x3246f
movq %r14, %rdi
movq %rbx, %rsi
callq 0xaba4
andq (%rax), %rdx
cmpq $0x1, %rdx
movq 0x20(%rsp), %rax
sbbl $-0x1, %eax
movq %rax, 0x20(%rsp)
incl %ebx
jmp 0x32433
movq %r12, 0x98(%rsp)
movq %r15, 0x70(%rsp)
leaq 0xc0(%rsp), %rdi
xorl %ebx, %ebx
xorl %edx, %edx
callq 0xab36
movq 0x78(%rsp), %rax
addq $0x48, %rax
movq %rax, 0x10(%rsp)
leaq 0x30(%rsp), %r15
leaq 0xc0(%rsp), %r12
xorl %r14d, %r14d
movl %ebx, %ebx
movq 0x40(%rsp), %rax
movl 0x48(%rsp), %ecx
subq 0x30(%rsp), %rax
leaq (%rcx,%rax,8), %rax
cmpq %rbx, %rax
jbe 0x32503
movq 0x10(%rsp), %rdi
movq %rbx, %rsi
callq 0xa848
movsd 0x18(%rax), %xmm0
ucomisd 0x28(%rsp), %xmm0
jbe 0x324ff
movq %r15, %rdi
movq %rbx, %rsi
callq 0xaba4
testq %rdx, (%rax)
jne 0x324ff
movq %r12, %rdi
movq %rbx, %rsi
callq 0x1043e
incl %r14d
orq %rdx, (%rax)
incl %ebx
jmp 0x324ab
movq 0x278(%rsp), %rdi
leaq 0xce6a2(%rip), %rbx     # 0x100bb4
movq %rbx, %rsi
callq 0x4530
movq %rax, %r15
movq 0x258(%rsp), %rdi
movq %rbx, %rsi
callq 0x4530
movq %rax, %r12
movq 0x238(%rsp), %rdi
movq %rbx, %rsi
callq 0x4530
leaq 0x30(%rsp), %rcx
movl 0x10(%rcx), %edx
subl (%rcx), %edx
movq %rax, %rbp
shll $0x3, %edx
movq %rcx, %r13
addl 0x18(%rcx), %edx
leaq 0xce659(%rip), %rsi     # 0x100bb6
movq %r15, %rdi
movq 0x98(%rsp), %rbx
movq %rbx, %rcx
movsd 0x28(%rsp), %xmm0
movb $0x1, %al
callq 0x4610
leaq 0xce669(%rip), %rsi     # 0x100be8
movq %r12, %rdi
movq 0x20(%rsp), %rdx
movq %rbx, %rcx
movsd 0x28(%rsp), %xmm0
movb $0x1, %al
callq 0x4610
leaq 0xce687(%rip), %rsi     # 0x100c25
movq %rbp, 0xe8(%rsp)
movq %rbp, %rdi
movl %r14d, %edx
movq %rbx, %rcx
movsd 0x28(%rsp), %xmm0
movb $0x1, %al
callq 0x4610
cvtsi2sdl 0x6c(%rsp), %xmm0
movsd %xmm0, 0x90(%rsp)
cvtsi2sdl 0x68(%rsp), %xmm0
movsd %xmm0, 0x88(%rsp)
cvtsi2sdl 0x64(%rsp), %xmm0
movsd %xmm0, 0x80(%rsp)
xorl %ebp, %ebp
movq 0x10(%rsp), %rbx
movl %ebp, %ebp
movq 0x40(%rsp), %rax
movl 0x48(%rsp), %ecx
subq 0x30(%rsp), %rax
leaq (%rcx,%rax,8), %rax
cmpq %rbp, %rax
jbe 0x328ed
movq %rbx, %rdi
movq %rbp, %rsi
callq 0xa848
movsd (%rax), %xmm0
movsd %xmm0, 0x8(%rsp)
movq %rbx, %rdi
movq %rbp, %rsi
callq 0xa848
movsd 0x8(%rax), %xmm0
movsd %xmm0, 0x18(%rsp)
movq %rbx, %rdi
movq %rbp, %rsi
callq 0xa848
movsd 0x10(%rax), %xmm0
movsd %xmm0, 0x58(%rsp)
movq %rbx, %rdi
movq %rbp, %rsi
callq 0xa848
movsd 0x18(%rax), %xmm3
movq %r15, %rdi
leaq 0xce5fe(%rip), %rsi     # 0x100c66
movsd 0x8(%rsp), %xmm0
movsd 0x18(%rsp), %xmm1
movsd 0x58(%rsp), %xmm2
movb $0x4, %al
callq 0x4610
movq %r13, %rdi
movq %rbp, %rsi
callq 0xaba4
testq %rdx, (%rax)
je 0x327a2
movq 0x10(%rsp), %rdi
movq %rbp, %rsi
callq 0xa848
movsd (%rax), %xmm0
movsd %xmm0, 0x8(%rsp)
movq 0x10(%rsp), %rdi
movq %rbp, %rsi
callq 0xa848
movsd 0x8(%rax), %xmm0
movsd %xmm0, 0x18(%rsp)
movq 0x10(%rsp), %rdi
movq %rbp, %rsi
callq 0xa848
movsd 0x10(%rax), %xmm2
leaq 0xf0(%rsp), %rdi
movq 0x70(%rsp), %rsi
movsd 0x8(%rsp), %xmm0
movsd 0x18(%rsp), %xmm1
callq 0x3f1ce
movsd 0xf0(%rsp), %xmm0
addsd 0x90(%rsp), %xmm0
cvtsd2ss %xmm0, %xmm0
movsd 0xf8(%rsp), %xmm1
addsd 0x88(%rsp), %xmm1
cvtsd2ss %xmm1, %xmm1
movsd 0x100(%rsp), %xmm2
addsd 0x80(%rsp), %xmm2
cvtsd2ss %xmm2, %xmm2
cvtss2sd %xmm0, %xmm0
cvtss2sd %xmm1, %xmm1
cvtss2sd %xmm2, %xmm2
leaq 0xa0(%rsp), %rdi
movq 0x70(%rsp), %rsi
callq 0x3f0e6
movsd 0xa0(%rsp), %xmm0
movsd %xmm0, 0x8(%rsp)
movsd 0xa8(%rsp), %xmm0
movsd %xmm0, 0x18(%rsp)
movsd 0xb0(%rsp), %xmm0
movsd %xmm0, 0x58(%rsp)
movq 0x10(%rsp), %rdi
movq %rbp, %rsi
callq 0xa848
movsd 0x18(%rax), %xmm3
movq %r12, %rdi
leaq 0xce4e1(%rip), %rsi     # 0x100c7e
jmp 0x328cd
movq 0x10(%rsp), %rdi
movq %rbp, %rsi
callq 0xa848
movsd 0x18(%rax), %xmm0
ucomisd 0x28(%rsp), %xmm0
jbe 0x328e6
movq 0x10(%rsp), %rdi
movq %rbp, %rsi
callq 0xa848
movsd (%rax), %xmm0
movsd %xmm0, 0x8(%rsp)
movq 0x10(%rsp), %rdi
movq %rbp, %rsi
callq 0xa848
movsd 0x8(%rax), %xmm0
movsd %xmm0, 0x18(%rsp)
movq 0x10(%rsp), %rdi
movq %rbp, %rsi
callq 0xa848
movsd 0x10(%rax), %xmm2
leaq 0xf0(%rsp), %rdi
movq 0x70(%rsp), %rsi
movsd 0x8(%rsp), %xmm0
movsd 0x18(%rsp), %xmm1
callq 0x3f1ce
movsd 0xf0(%rsp), %xmm0
addsd 0x90(%rsp), %xmm0
cvtsd2ss %xmm0, %xmm0
movsd 0xf8(%rsp), %xmm1
addsd 0x88(%rsp), %xmm1
cvtsd2ss %xmm1, %xmm1
movsd 0x100(%rsp), %xmm2
addsd 0x80(%rsp), %xmm2
cvtsd2ss %xmm2, %xmm2
cvtss2sd %xmm0, %xmm0
cvtss2sd %xmm1, %xmm1
cvtss2sd %xmm2, %xmm2
leaq 0xa0(%rsp), %rdi
movq 0x70(%rsp), %rsi
callq 0x3f0e6
movsd 0xa0(%rsp), %xmm0
movsd %xmm0, 0x8(%rsp)
movsd 0xa8(%rsp), %xmm0
movsd %xmm0, 0x18(%rsp)
movsd 0xb0(%rsp), %xmm0
movsd %xmm0, 0x58(%rsp)
movq 0x10(%rsp), %rdi
movq %rbp, %rsi
callq 0xa848
movsd 0x18(%rax), %xmm3
movq 0xe8(%rsp), %rdi
leaq 0xce3c9(%rip), %rsi     # 0x100c96
movsd 0x8(%rsp), %xmm0
movsd 0x18(%rsp), %xmm1
movsd 0x58(%rsp), %xmm2
movb $0x4, %al
callq 0x4610
incl %ebp
jmp 0x325f0
movq %r15, %rdi
callq 0x4490
movq %r12, %rdi
callq 0x4490
movq 0xe8(%rsp), %rdi
callq 0x4490
leaq 0xa0(%rsp), %rdi
leaq 0x180(%rsp), %rdx
movq 0x98(%rsp), %rbx
movq %rbx, %rsi
callq 0x1b80e
leaq 0xce37d(%rip), %rsi     # 0x100cae
leaq 0xa0(%rsp), %rdi
callq 0x4800
leaq 0xf0(%rsp), %rdi
movq %rax, %rsi
callq 0x45d0
leaq 0xa0(%rsp), %rdi
callq 0x4210
leaq 0x180(%rsp), %rdi
leaq 0x110(%rsp), %rdx
movq %rbx, %rsi
callq 0x1b80e
leaq 0xce33e(%rip), %rsi     # 0x100cb8
leaq 0x180(%rsp), %rdi
callq 0x4800
leaq 0xa0(%rsp), %rdi
movq %rax, %rsi
callq 0x45d0
leaq 0x180(%rsp), %rdi
callq 0x4210
leaq 0x110(%rsp), %rdi
leaq 0x200(%rsp), %rdx
movq %rbx, %rsi
callq 0x1b80e
movq %r14, 0x58(%rsp)
leaq 0xce305(%rip), %rsi     # 0x100ccd
leaq 0x110(%rsp), %rdi
callq 0x4800
leaq 0x180(%rsp), %rdi
movq %rax, %rsi
callq 0x45d0
leaq 0x110(%rsp), %rdi
callq 0x4210
movq 0x30(%rsp), %r12
movq 0x40(%rsp), %r13
movl 0x48(%rsp), %r14d
movq %r13, %rax
subq %r12, %rax
leaq (%r14,%rax,8), %r15
movq %r15, %rax
shrq $0x3e, %rax
leaq (,%r15,4), %rcx
xorl %edi, %edi
negq %rax
sbbq %rdi, %rdi
orq %rcx, %rdi
callq 0x4030
movq %rax, 0x18(%rsp)
movabsq $0x3fffffffffffffff, %rax # imm = 0x3FFFFFFFFFFFFFFF
movq 0xd0(%rsp), %rcx
subq 0xc0(%rsp), %rcx
movl 0xd8(%rsp), %edx
leaq (%rdx,%rcx,8), %rbx
leaq (,%rbx,4), %rcx
cmpq %rax, %rbx
pushq $-0x1
popq %rdi
cmovbeq %rcx, %rdi
callq 0x4030
movq %rax, 0x8(%rsp)
xorl %eax, %eax
movl %eax, %ebp
subq %r12, %r13
movl %r14d, %eax
leaq (%rax,%r13,8), %rax
cmpq %rbp, %rax
jbe 0x32af7
leaq 0x30(%rsp), %rdi
movq %rbp, %rsi
callq 0xaba4
movq %rdx, %r13
andq (%rax), %r13
pushq $-0x1
popq %rax
cmovnel %r15d, %eax
movq 0x18(%rsp), %rcx
movl %eax, (%rcx,%rbp,4)
leaq 0xc0(%rsp), %rdi
movq %rbp, %rsi
callq 0xaba4
andq (%rax), %rdx
cmpq $0x1, %rdx
movl $0x0, %eax
sbbl %eax, %eax
cmpq $0x1, %rdx
movl %ebx, %ecx
sbbl $-0x1, %ecx
cmpq $0x1, %r13
sbbl $-0x1, %r15d
orl %ebx, %eax
movq 0x8(%rsp), %rdx
movl %eax, (%rdx,%rbp,4)
leal 0x1(%rbp), %eax
movq 0x30(%rsp), %r12
movq 0x40(%rsp), %r13
movl 0x48(%rsp), %r14d
movl %ecx, %ebx
jmp 0x32a72
leaq 0x110(%rsp), %r14
andq $0x0, 0x10(%r14)
xorpd %xmm0, %xmm0
movapd %xmm0, (%r14)
leaq 0x200(%rsp), %r15
movapd %xmm0, (%r15)
andq $0x0, 0x10(%r15)
leaq 0x1a0(%rsp), %r13
movapd %xmm0, (%r13)
andq $0x0, 0x10(%r13)
leaq 0x1e0(%rsp), %rax
andq $0x0, 0x10(%rax)
leaq 0x160(%rsp), %rcx
andq $0x0, 0x10(%rcx)
movapd %xmm0, (%rax)
movapd %xmm0, (%rcx)
leaq 0x1c0(%rsp), %rax
movapd %xmm0, (%rax)
andq $0x0, 0x10(%rax)
movq 0x78(%rsp), %rax
leaq 0x60(%rax), %rbp
xorl %r12d, %r12d
pushq $0x28
popq %rbx
movl %r12d, %r12d
movq 0x78(%rsp), %rcx
movq 0x68(%rcx), %rax
subq 0x60(%rcx), %rax
cqto
idivq %rbx
cmpq %r12, %rax
jbe 0x32e3c
movq %rbp, %rdi
movq %r12, %rsi
callq 0xa822
movslq (%rax), %rsi
leaq 0x30(%rsp), %rdi
callq 0xaba4
testq %rdx, (%rax)
je 0x32cb4
movq %rbp, %rdi
movq %r12, %rsi
callq 0xa822
movslq 0x4(%rax), %rsi
leaq 0x30(%rsp), %rdi
callq 0xaba4
testq %rdx, (%rax)
je 0x32cb4
movq %rbp, %rdi
movq %r12, %rsi
callq 0xa822
movsd 0x8(%rax), %xmm0
ucomisd 0x28(%rsp), %xmm0
jbe 0x32cb4
movq %rbp, %rdi
movq %r12, %rsi
callq 0xa822
cmpl $0x0, 0x10(%rax)
jne 0x32c24
movq %rbp, %rdi
movq %r12, %rsi
callq 0xa822
cmpl $0x0, 0x14(%rax)
jne 0x32c24
movq %rbp, %rdi
movq %r12, %rsi
callq 0xa822
cmpl $0x0, 0x18(%rax)
je 0x32c6d
movq %rbp, %rdi
movq %r12, %rsi
callq 0xa822
movl 0x6c(%rsp), %ecx
cmpl %ecx, 0x10(%rax)
jne 0x32cb4
movq %rbp, %rdi
movq %r12, %rsi
callq 0xa822
movl 0x68(%rsp), %ecx
cmpl %ecx, 0x14(%rax)
jne 0x32cb4
movq %rbp, %rdi
movq %r12, %rsi
callq 0xa822
movl 0x64(%rsp), %ecx
cmpl %ecx, 0x18(%rax)
jne 0x32cb4
movq %rbp, %rdi
movq %r12, %rsi
callq 0xa822
jmp 0x32c84
movq %rbp, %rdi
movq %r12, %rsi
callq 0xa822
movslq (%rax), %rax
movq 0x18(%rsp), %rcx
leaq (%rcx,%rax,4), %rax
leaq 0x1e0(%rsp), %rdi
movq %rax, %rsi
callq 0x9434
movq %rbp, %rdi
movq %r12, %rsi
callq 0xa822
movslq 0x4(%rax), %rax
movq 0x18(%rsp), %rcx
leaq (%rcx,%rax,4), %rsi
movq %r13, %rdi
callq 0x9434
movq %rbp, %rdi
movq %r12, %rsi
callq 0xa822
movslq (%rax), %rsi
leaq 0xc0(%rsp), %rdi
callq 0xaba4
testq %rdx, (%rax)
je 0x32dd1
movq %rbp, %rdi
movq %r12, %rsi
callq 0xa822
movslq 0x4(%rax), %rsi
leaq 0xc0(%rsp), %rdi
callq 0xaba4
testq %rdx, (%rax)
je 0x32dd1
movq %rbp, %rdi
movq %r12, %rsi
callq 0xa822
movsd 0x8(%rax), %xmm0
ucomisd 0x28(%rsp), %xmm0
jbe 0x32dd1
movq %rbp, %rdi
movq %r12, %rsi
callq 0xa822
cmpl $0x0, 0x10(%rax)
jne 0x32d4c
movq %rbp, %rdi
movq %r12, %rsi
callq 0xa822
cmpl $0x0, 0x14(%rax)
jne 0x32d4c
movq %rbp, %rdi
movq %r12, %rsi
callq 0xa822
cmpl $0x0, 0x18(%rax)
je 0x32d88
movq %rbp, %rdi
movq %r12, %rsi
callq 0xa822
movl 0x6c(%rsp), %ecx
cmpl %ecx, 0x10(%rax)
jne 0x32dd1
movq %rbp, %rdi
movq %r12, %rsi
callq 0xa822
movl 0x68(%rsp), %ecx
cmpl %ecx, 0x14(%rax)
jne 0x32dd1
movq %rbp, %rdi
movq %r12, %rsi
callq 0xa822
movl 0x64(%rsp), %ecx
cmpl %ecx, 0x18(%rax)
jne 0x32dd1
movq %rbp, %rdi
movq %r12, %rsi
callq 0xa822
movslq (%rax), %rax
movq 0x8(%rsp), %rcx
leaq (%rcx,%rax,4), %rsi
leaq 0x1c0(%rsp), %rdi
callq 0x9434
movq %rbp, %rdi
movq %r12, %rsi
callq 0xa822
movslq 0x4(%rax), %rax
movq 0x8(%rsp), %rcx
leaq (%rcx,%rax,4), %rsi
leaq 0x160(%rsp), %rdi
callq 0x9434
movq %rbp, %rdi
movq %r12, %rsi
callq 0xa822
cmpl $0x0, 0x10(%rax)
jne 0x32e34
movq %rbp, %rdi
movq %r12, %rsi
callq 0xa822
cmpl $0x0, 0x14(%rax)
jne 0x32e34
movq %rbp, %rdi
movq %r12, %rsi
callq 0xa822
cmpl $0x0, 0x18(%rax)
jne 0x32e34
movq %rbp, %rdi
movq %r12, %rsi
callq 0xa822
movq %r15, %rdi
movq %rax, %rsi
callq 0x9434
movq %rbp, %rdi
movq %r12, %rsi
callq 0xa822
addq $0x4, %rax
movq %r14, %rdi
movq %rax, %rsi
callq 0x9434
incl %r12d
jmp 0x32b74
movq 0xf0(%rsp), %rdi
leaq 0xcdd69(%rip), %rbx     # 0x100bb4
movq %rbx, %rsi
callq 0x4530
movq %rax, %rbp
movq 0xa0(%rsp), %rdi
movq %rbx, %rsi
callq 0x4530
movq %rax, %r15
movq 0x180(%rsp), %rdi
movq %rbx, %rsi
callq 0x4530
movl 0x40(%rsp), %ecx
subl 0x30(%rsp), %ecx
movq %rax, %r13
shll $0x3, %ecx
addl 0x48(%rsp), %ecx
leaq 0xcde53(%rip), %r12     # 0x100ce5
xorl %ebx, %ebx
movq %rbp, %rdi
movq %r12, %rsi
movq 0x98(%rsp), %r14
movq %r14, %rdx
xorl %eax, %eax
callq 0x4610
movl 0x40(%rsp), %eax
subl 0x30(%rsp), %eax
movq 0x20(%rsp), %rcx
addl 0x48(%rsp), %ecx
leal (%rcx,%rax,8), %ecx
movq %r15, %rdi
movq %r12, %rsi
movq %r14, %rdx
xorl %eax, %eax
callq 0x4610
movl 0x40(%rsp), %eax
subl 0x30(%rsp), %eax
movq 0x58(%rsp), %rcx
addl 0x48(%rsp), %ecx
leal (%rcx,%rax,8), %ecx
movq %r13, 0x28(%rsp)
movq %r13, %rdi
movq %r12, %rsi
movq %r14, %rdx
xorl %eax, %eax
callq 0x4610
leaq 0xce04d(%rip), %r13     # 0x100f4d
movq 0x70(%rsp), %r14
movq 0x10(%rsp), %r12
movl %ebx, %ebx
movq 0x30(%rsp), %rcx
movq 0x40(%rsp), %rax
movl 0x48(%rsp), %edx
movq %rax, %rsi
subq %rcx, %rsi
leaq (%rdx,%rsi,8), %rsi
cmpq %rbx, %rsi
jbe 0x33032
movq %r12, %rdi
movq %rbx, %rsi
callq 0xa848
movsd (%rax), %xmm0
movsd %xmm0, 0x20(%rsp)
movq %r12, %rdi
movq %rbx, %rsi
callq 0xa848
movsd 0x8(%rax), %xmm0
movsd %xmm0, 0x8(%rsp)
movq %r12, %rdi
movq %rbx, %rsi
callq 0xa848
movsd 0x10(%rax), %xmm2
movq %rbp, %rdi
movq %r13, %rsi
movsd 0x20(%rsp), %xmm0
movsd 0x8(%rsp), %xmm1
movb $0x3, %al
callq 0x4610
movq %r12, %rdi
movq %rbx, %rsi
callq 0xa848
movsd (%rax), %xmm0
movsd %xmm0, 0x20(%rsp)
movq %r12, %rdi
movq %rbx, %rsi
callq 0xa848
movsd 0x8(%rax), %xmm0
movsd %xmm0, 0x8(%rsp)
movq %r12, %rdi
movq %rbx, %rsi
callq 0xa848
movsd 0x10(%rax), %xmm2
movq %r15, %rdi
movq %r13, %rsi
movsd 0x20(%rsp), %xmm0
movsd 0x8(%rsp), %xmm1
movb $0x3, %al
callq 0x4610
movq %r12, %rdi
movq %rbx, %rsi
callq 0xa848
movsd (%rax), %xmm0
movsd %xmm0, 0x20(%rsp)
movq %r12, %rdi
movq %rbx, %rsi
callq 0xa848
movsd 0x8(%rax), %xmm0
movsd %xmm0, 0x8(%rsp)
movq %r12, %rdi
movq %rbx, %rsi
callq 0xa848
movsd 0x10(%rax), %xmm2
movq 0x28(%rsp), %rdi
movq %r13, %rsi
movsd 0x20(%rsp), %xmm0
movsd 0x8(%rsp), %xmm1
movb $0x3, %al
callq 0x4610
incl %ebx
jmp 0x32f0a
xorl %r13d, %r13d
leaq 0xcdf11(%rip), %rbx     # 0x100f4d
movl %r13d, %r13d
subq %rcx, %rax
movl %edx, %ecx
leaq (%rcx,%rax,8), %rax
cmpq %r13, %rax
jbe 0x33252
leaq 0x30(%rsp), %rdi
movq %r13, %rsi
callq 0xaba4
testq %rdx, (%rax)
je 0x33144
movq %r12, %rdi
movq %r13, %rsi
callq 0xa848
movsd (%rax), %xmm0
movsd %xmm0, 0x20(%rsp)
movq %r12, %rdi
movq %r13, %rsi
callq 0xa848
movsd 0x8(%rax), %xmm0
movsd %xmm0, 0x8(%rsp)
movq %r12, %rdi
movq %r13, %rsi
callq 0xa848
movsd 0x10(%rax), %xmm2
leaq 0x148(%rsp), %rdi
movq %r14, %rsi
movsd 0x20(%rsp), %xmm0
movsd 0x8(%rsp), %xmm1
callq 0x3f1ce
movsd 0x148(%rsp), %xmm0
addsd 0x90(%rsp), %xmm0
cvtsd2ss %xmm0, %xmm0
movsd 0x150(%rsp), %xmm1
addsd 0x88(%rsp), %xmm1
cvtsd2ss %xmm1, %xmm1
movsd 0x158(%rsp), %xmm2
addsd 0x80(%rsp), %xmm2
cvtsd2ss %xmm2, %xmm2
cvtss2sd %xmm0, %xmm0
cvtss2sd %xmm1, %xmm1
cvtss2sd %xmm2, %xmm2
leaq 0x130(%rsp), %rdi
movq %r14, %rsi
callq 0x3f0e6
movsd 0x130(%rsp), %xmm0
movsd 0x138(%rsp), %xmm1
movsd 0x140(%rsp), %xmm2
movq %r15, %rdi
movq %rbx, %rsi
movb $0x3, %al
callq 0x4610
leaq 0xc0(%rsp), %rdi
movq %r13, %rsi
callq 0xaba4
testq %rdx, (%rax)
je 0x3323c
movq %r12, %rdi
movq %r13, %rsi
callq 0xa848
movsd (%rax), %xmm0
movsd %xmm0, 0x20(%rsp)
movq %r12, %rdi
movq %r13, %rsi
callq 0xa848
movsd 0x8(%rax), %xmm0
movsd %xmm0, 0x8(%rsp)
movq %r12, %rdi
movq %r13, %rsi
callq 0xa848
movsd 0x10(%rax), %xmm2
leaq 0x148(%rsp), %rdi
movq %r14, %rsi
movsd 0x20(%rsp), %xmm0
movsd 0x8(%rsp), %xmm1
callq 0x3f1ce
movsd 0x148(%rsp), %xmm0
addsd 0x90(%rsp), %xmm0
cvtsd2ss %xmm0, %xmm0
movsd 0x150(%rsp), %xmm1
addsd 0x88(%rsp), %xmm1
cvtsd2ss %xmm1, %xmm1
movsd 0x158(%rsp), %xmm2
addsd 0x80(%rsp), %xmm2
cvtsd2ss %xmm2, %xmm2
cvtss2sd %xmm0, %xmm0
cvtss2sd %xmm1, %xmm1
cvtss2sd %xmm2, %xmm2
leaq 0x130(%rsp), %rdi
movq %r14, %rsi
callq 0x3f0e6
movsd 0x130(%rsp), %xmm0
movsd 0x138(%rsp), %xmm1
movsd 0x140(%rsp), %xmm2
movq 0x28(%rsp), %rdi
movq %rbx, %rsi
movb $0x3, %al
callq 0x4610
incl %r13d
movq 0x30(%rsp), %rcx
movq 0x40(%rsp), %rax
movl 0x48(%rsp), %edx
jmp 0x3303c
movq %r15, 0x10(%rsp)
leaq 0x110(%rsp), %rbx
movq 0x8(%rbx), %rdx
subq (%rbx), %rdx
shrq $0x2, %rdx
leal (%rdx,%rdx,2), %ecx
leaq 0xcdaca(%rip), %rsi     # 0x100d3e
movq %rbp, %r15
movq %rbp, %rdi
xorl %eax, %eax
callq 0x4610
leaq 0x200(%rsp), %r14
leaq 0xcdabb(%rip), %r13     # 0x100d4b
xorl %r12d, %r12d
movl %r12d, %r12d
movq 0x118(%rsp), %rax
subq 0x110(%rsp), %rax
sarq $0x2, %rax
cmpq %r12, %rax
jbe 0x332dd
movq %rbx, %rdi
movq %r12, %rsi
callq 0xac00
movl (%rax), %ebp
movq %r14, %rdi
movq %r12, %rsi
callq 0xac00
movl (%rax), %ecx
movq %r15, %rdi
movq %r13, %rsi
movl %ebp, %edx
xorl %eax, %eax
callq 0x4610
incl %r12d
jmp 0x33293
leaq 0x1a0(%rsp), %rbx
movq 0x8(%rbx), %rdx
subq (%rbx), %rdx
shrq $0x2, %rdx
leal (%rdx,%rdx,2), %ecx
leaq 0xcda44(%rip), %rsi     # 0x100d3e
movq 0x10(%rsp), %rdi
xorl %eax, %eax
callq 0x4610
leaq 0x1e0(%rsp), %r14
leaq 0xcda36(%rip), %r13     # 0x100d4b
xorl %r12d, %r12d
movl %r12d, %r12d
movq 0x1a8(%rsp), %rax
subq 0x1a0(%rsp), %rax
sarq $0x2, %rax
cmpq %r12, %rax
jbe 0x33364
movq %rbx, %rdi
movq %r12, %rsi
callq 0xac00
movl (%rax), %ebp
movq %r14, %rdi
movq %r12, %rsi
callq 0xac00
movl (%rax), %ecx
movq 0x10(%rsp), %rdi
movq %r13, %rsi
movl %ebp, %edx
xorl %eax, %eax
callq 0x4610
incl %r12d
jmp 0x33318
leaq 0x160(%rsp), %rbx
movq 0x8(%rbx), %rdx
subq (%rbx), %rdx
shrq $0x2, %rdx
leal (%rdx,%rdx,2), %ecx
leaq 0xcd9bd(%rip), %rsi     # 0x100d3e
movq 0x28(%rsp), %rdi
xorl %eax, %eax
callq 0x4610
leaq 0x1c0(%rsp), %r14
leaq 0xcd9af(%rip), %r13     # 0x100d4b
xorl %r12d, %r12d
movl %r12d, %r12d
movq 0x168(%rsp), %rax
subq 0x160(%rsp), %rax
sarq $0x2, %rax
cmpq %r12, %rax
jbe 0x333eb
movq %rbx, %rdi
movq %r12, %rsi
callq 0xac00
movl (%rax), %ebp
movq %r14, %rdi
movq %r12, %rsi
callq 0xac00
movl (%rax), %ecx
movq 0x28(%rsp), %rdi
movq %r13, %rsi
movl %ebp, %edx
xorl %eax, %eax
callq 0x4610
incl %r12d
jmp 0x3339f
movq %r15, %rdi
callq 0x4490
movq 0x10(%rsp), %rdi
callq 0x4490
movq 0x28(%rsp), %rdi
callq 0x4490
movq 0x18(%rsp), %rdi
callq 0x4590
leaq 0x1c0(%rsp), %rdi
callq 0xb290
leaq 0x160(%rsp), %rdi
callq 0xb290
leaq 0x1e0(%rsp), %rdi
callq 0xb290
leaq 0x1a0(%rsp), %rdi
callq 0xb290
leaq 0x200(%rsp), %rdi
callq 0xb290
leaq 0x110(%rsp), %rdi
callq 0xb290
leaq 0x180(%rsp), %rdi
callq 0x4210
leaq 0xa0(%rsp), %rdi
callq 0x4210
leaq 0xf0(%rsp), %rdi
callq 0x4210
leaq 0x220(%rsp), %rdi
callq 0x37062
leaq 0xc0(%rsp), %rdi
callq 0xa976
leaq 0x30(%rsp), %rdi
callq 0xa976
leaq 0x238(%rsp), %rdi
callq 0x4210
leaq 0x258(%rsp), %rdi
callq 0x4210
leaq 0x278(%rsp), %rdi
callq 0x4210
addq $0x298, %rsp            # imm = 0x298
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x3358d
jmp 0x3358d
movq %rax, %rbx
jmp 0x33613
movq %rax, %rbx
jmp 0x33620
jmp 0x335b0
jmp 0x335b0
jmp 0x335b0
movq %rax, %rbx
jmp 0x3365e
movq %rax, %rbx
jmp 0x3366b
movq %rax, %rbx
jmp 0x33678
movq %rax, %rbx
leaq 0x110(%rsp), %rdi
jmp 0x3360e
movq %rax, %rbx
leaq 0x180(%rsp), %rdi
jmp 0x3361b
movq %rax, %rbx
leaq 0xa0(%rsp), %rdi
jmp 0x33628
movq %rax, %rbx
leaq 0x30(%rsp), %rdi
jmp 0x33659
movq %rax, %rbx
leaq 0x30(%rsp), %rdi
jmp 0x33666
movq %rax, %rbx
leaq 0x30(%rsp), %rdi
jmp 0x33673
jmp 0x335b0
jmp 0x335b0
jmp 0x335b0
jmp 0x335b5
jmp 0x335b5
jmp 0x335b0
jmp 0x335b5
jmp 0x335b5
jmp 0x3358d
movq %rax, %rbx
jmp 0x33606
jmp 0x335b0
jmp 0x335b0
jmp 0x335b0
jmp 0x335b0
jmp 0x335b5
jmp 0x335b5
jmp 0x335b5
jmp 0x335b5
jmp 0x335b5
jmp 0x335b5
jmp 0x335b5
jmp 0x335b5
jmp 0x335b5
jmp 0x335b0
jmp 0x335b5
movq %rax, %rbx
jmp 0x3362d
movq %rax, %rbx
leaq 0x1c0(%rsp), %rdi
callq 0xb290
leaq 0x160(%rsp), %rdi
callq 0xb290
leaq 0x1e0(%rsp), %rdi
callq 0xb290
leaq 0x1a0(%rsp), %rdi
callq 0xb290
leaq 0x200(%rsp), %rdi
callq 0xb290
leaq 0x110(%rsp), %rdi
callq 0xb290
leaq 0x180(%rsp), %rdi
callq 0x4210
leaq 0xa0(%rsp), %rdi
callq 0x4210
leaq 0xf0(%rsp), %rdi
callq 0x4210
leaq 0x220(%rsp), %rdi
callq 0x37062
leaq 0xc0(%rsp), %rdi
callq 0xa976
leaq 0x30(%rsp), %rdi
callq 0xa976
leaq 0x238(%rsp), %rdi
callq 0x4210
leaq 0x258(%rsp), %rdi
callq 0x4210
leaq 0x278(%rsp), %rdi
callq 0x4210
movq %rbx, %rdi
callq 0x4780