// File: /workspace/github_cpp_makefile_star2_O1/Luthaf[P]zeopp/networkstorage.cc
// Function: check_for_collision(ATOM_NETWORK*, std::vector<MOLECULE, std::allocator<MOLECULE>>*, std::vector<CONNECTION, std::allocator<CONNECTION>>*)
bool check_for_collision(ATOM_NETWORK *framework, vector<MOLECULE> *assembled_molecules, vector<CONNECTION> *two_way_connections) {
  bool verbose = false;
if(verbose) printf("DEBUG: checking for collisions...\n");
  XYZ centre_abc(0.5,0.5,0.5);
  XYZ centre_xyz = framework->abc_to_xyz_returning_XYZ(centre_abc);
  bool collision = false;
  int num_assembled_molecules = assembled_molecules->size();
  int num_c = two_way_connections->size();
  //is it possible to have more than one periodic bond between atoms? depends on unit cell - we need to check all x,y,z in the range -1 to 1, except for redundant combinations, handled below
  bool multiple_periodic_connections_possible = false;
  for(int z=-1; z<2 && !multiple_periodic_connections_possible; z++) {
    for(int y=-1; y<2 && !multiple_periodic_connections_possible; y++) {
      for(int x=0; x<2 && !multiple_periodic_connections_possible; x++) { //x cannot be -1
        if((x==0 && y==0 && z==1) || (x==0 && y==1) || (x==1)) {
          XYZ image_abc(x,y,z);
          double self_distance = framework->abc_to_xyz_returning_XYZ(image_abc).magnitude();
          if(self_distance<=GENERAL_BOND_DISTANCE*2.0) multiple_periodic_connections_possible = true;
        }
      }
    }
  }

  //new and much faster system - build a set of vectors storing the info we need and just query it according to the basic collision rules - and don't include sites or H atoms
  vector <int> atom_molecule_id_vector;
  vector <int> atom_position_id_vector;
  vector <XYZ> atom_abc_vector;
  vector <bool> atom_is_close_to_site_vector;
/*
int debug1=198, debug2=730;
*/
  for(int i=0; i<num_assembled_molecules; i++) { //for each molecule
    int num_at_i = assembled_molecules->at(i).atoms_xyz.size();
    int num_sites_i = assembled_molecules->at(i).sites.size();
    int num_dummy_sites_i = assembled_molecules->at(i).dummy_sites.size();
    vector <XYZ> local_atom_abc_vector;
    vector <XYZ> local_site_abc_vector;
    for(int j=0; j<num_at_i; j++) { //for each atom
      if(assembled_molecules->at(i).atoms_type.at(j)!="H") { //if not H
        XYZ xyz_j = assembled_molecules->at(i).atoms_xyz.at(j);
        XYZ abc_j = framework->xyz_to_abc_returning_XYZ(xyz_j);
        bool is_site_j = false;
        bool is_dummy_site_j = false;
        for(int s=0; s<num_sites_i && !is_site_j; s++) { //find if site
          is_site_j = (j == assembled_molecules->at(i).sites.at(s));
        }
        for(int s=0; s<num_dummy_sites_i && !is_dummy_site_j && !is_site_j; s++) { //find if dummy site
          is_dummy_site_j = (j == assembled_molecules->at(i).dummy_sites.at(s));
        }
        if(is_site_j) {
          local_site_abc_vector.push_back(abc_j);
        } else if(is_dummy_site_j) { //do nothing - don't want to write this one out, and don't want to bypass collision detection near to dummy sites
        } else {
          local_atom_abc_vector.push_back(abc_j);
          atom_abc_vector.push_back(abc_j);
          atom_molecule_id_vector.push_back(i);
          atom_position_id_vector.push_back(j);
        }
      }
    }
    int num_actual_at_i = local_atom_abc_vector.size();
    for(int j=0; j<num_actual_at_i; j++) {
      bool is_close_to_site = false;
      for(int k=0; k<num_sites_i && !is_close_to_site; k++) {
        is_close_to_site = is_part_of_site_abc(local_atom_abc_vector.at(j), local_site_abc_vector.at(k), framework);
/*
if(atom_is_close_to_site_vector.size()==debug1 || atom_is_close_to_site_vector.size()==debug2) {
  if(is_close_to_site) printf("DEBYG: overall atom index %d (fractional %.3f/%.3f/%.3f) is close to site index %d (fractional %.3f/%.3f/%.3f) in molecule index %d\n", (int)(atom_is_close_to_site_vector.size()), local_atom_abc_vector.at(j).x, local_atom_abc_vector.at(j).y, local_atom_abc_vector.at(j).z, k, local_site_abc_vector.at(k).x, local_site_abc_vector.at(k).y, local_site_abc_vector.at(k).z, i);
  else printf("DEBYG: overall atom index %d (fractional %.3f/%.3f/%.3f) is NOT close to site index %d (fractional %.3f/%.3f/%.3f) in molecule index %d (distance = %.3f)\n", (int)(atom_is_close_to_site_vector.size()), local_atom_abc_vector.at(j).x, local_atom_abc_vector.at(j).y, local_atom_abc_vector.at(j).z, k, local_site_abc_vector.at(k).x, local_site_abc_vector.at(k).y, local_site_abc_vector.at(k).z, i, framework->getDistCalc().minimum_periodic_distance(local_atom_abc_vector.at(j).x, local_atom_abc_vector.at(j).y, local_atom_abc_vector.at(j).z, local_site_abc_vector.at(k).x, local_site_abc_vector.at(k).y, local_site_abc_vector.at(k).z));
}
*/
      }
      atom_is_close_to_site_vector.push_back(is_close_to_site);
    }
  }
  int num_total_atoms = atom_abc_vector.size();
  for(int i=0; i<num_total_atoms && !collision; i++) {
    for(int j=i+1; j<num_total_atoms && !collision; j++) {
      if(atom_molecule_id_vector.at(i)==atom_molecule_id_vector.at(j)) { //atoms are in the same molecule
        if(!bonded_xyz(assembled_molecules->at(atom_molecule_id_vector.at(i)).atoms_xyz.at(atom_position_id_vector.at(i)), assembled_molecules->at(atom_molecule_id_vector.at(j)).atoms_xyz.at(atom_position_id_vector.at(j)))) { //if they are not supposed to be bonded
          if(bonded_abc(atom_abc_vector.at(i), atom_abc_vector.at(j), framework)) {
            if(verbose) printf("NOTICE: non-bonded atoms in building block %d are bonded periodically, constituting a collision\n", atom_molecule_id_vector.at(i));
            collision = true; //collision if they are bonded
          }
        } else if(multiple_periodic_connections_possible) { //else they are supposed to be bonded - so we need to make sure that they are not bonded more than once periodically, if that is a possibility given the unit cell parameters
          XYZ shift_i_to_centre = centre_abc - trans_to_origuc(atom_abc_vector.at(i));
          XYZ uc_j = trans_to_origuc(atom_abc_vector.at(j)+shift_i_to_centre);
          int num_periodic_bonds = 0;
          for(int da=-1; da<2 && num_periodic_bonds<2; da++) {
            for(int db=-1; db<2 && num_periodic_bonds<2; db++) {
              for(int dc=-1; dc<2 && num_periodic_bonds<2; dc++) {
                XYZ image(da,db,dc);
                XYZ image_j_xyz = framework->abc_to_xyz_returning_XYZ(uc_j+image);
                if(bonded_xyz(image_j_xyz, centre_xyz)) num_periodic_bonds++;
              }
            }
          }
          if(num_periodic_bonds>1) {
            if(verbose) printf("NOTICE: more than one (%d) bonds were detected between atoms in building block %d, constituting a collision\n", num_periodic_bonds, atom_molecule_id_vector.at(i));
            collision = true;
          }
        }
      } else if(bonded_abc(atom_abc_vector.at(i), atom_abc_vector.at(j), framework)) { //atoms are in different molecules, and they are bonded
        if(!atom_is_close_to_site_vector.at(i) || !atom_is_close_to_site_vector.at(j)) {
          if(verbose) printf("NOTICE: a bond was detected between atoms that are not both part of a site: %s (fractional %.3f/%.3f/%.3f) and %s (fractional %.3f/%.3f/%.3f) in building blocks %d and %d respectively (overall indices %d and %d), constituting a collision (distance = %.3f)\n", assembled_molecules->at(atom_molecule_id_vector.at(i)).atoms_type.at(atom_position_id_vector.at(i)).c_str(), atom_abc_vector.at(i).x, atom_abc_vector.at(i).y, atom_abc_vector.at(i).z, assembled_molecules->at(atom_molecule_id_vector.at(j)).atoms_type.at(atom_position_id_vector.at(j)).c_str(), atom_abc_vector.at(j).x, atom_abc_vector.at(j).y, atom_abc_vector.at(j).z, atom_molecule_id_vector.at(i), atom_molecule_id_vector.at(j), i, j, framework->getDistCalc().minimum_periodic_distance(atom_abc_vector.at(i).x, atom_abc_vector.at(i).y, atom_abc_vector.at(i).z, atom_abc_vector.at(j).x, atom_abc_vector.at(j).y, atom_abc_vector.at(j).z));

          collision = true; //if either atom is not part of a site, this is a collision
        } else { //else they are both part of sites - so we need to check whether these molecules are supposed to be connected
          bool mols_connected = false;
          for(int k=0; k<num_c && !mols_connected; k++) {
            CONNECTION c = two_way_connections->at(k);
            int v1 = c.v1;
            int v2 = c.v2;
            if((v1==atom_molecule_id_vector.at(i) && v2==atom_molecule_id_vector.at(j)) || (v2==atom_molecule_id_vector.at(i) && v1==atom_molecule_id_vector.at(j))) {
              mols_connected = true;
            }
          }
          if(!mols_connected) {
            if(verbose) printf("NOTICE: a bond was detected between disconnected building blocks %d and %d, constituting a collision\n", atom_molecule_id_vector.at(i), atom_molecule_id_vector.at(j));
            collision = true;
          }
        }
      }
    }
  }
  return collision;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x1e8, %rsp            # imm = 0x1E8
movq %rdx, %r14
movq %rsi, %r15
movq %rdi, %r12
leaq 0x1d0(%rsp), %rbx
movsd 0xef19c(%rip), %xmm0    # 0x14f038
movq %rbx, %rdi
movaps %xmm0, %xmm1
movaps %xmm0, %xmm2
callq 0x85982
movsd (%rbx), %xmm0
movsd 0x8(%rbx), %xmm1
movsd 0x10(%rbx), %xmm2
leaq 0x1b8(%rsp), %rdi
movq %r12, 0x48(%rsp)
movq %r12, %rsi
callq 0x530d6
movq 0x8(%r15), %rcx
movq %r15, 0xc8(%rsp)
subq (%r15), %rcx
sarq $0x3, %rcx
movabsq $-0x30c30c30c30c30c3, %rax # imm = 0xCF3CF3CF3CF3CF3D
imulq %rax, %rcx
movq %rcx, 0x38(%rsp)
movq 0x8(%r14), %rax
movq %r14, 0x178(%rsp)
subq (%r14), %rax
sarq $0x2, %rax
movabsq $0x6db6db6db6db6db7, %rcx # imm = 0x6DB6DB6DB6DB6DB7
imulq %rcx, %rax
movq %rax, 0x168(%rsp)
movl $0xffffffff, %r13d      # imm = 0xFFFFFFFF
xorl %r15d, %r15d
leaq 0xb0(%rsp), %r12
testb $0x1, %r15b
movl %r13d, 0x44(%rsp)
jne 0x60039
xorps %xmm0, %xmm0
cvtsi2sd %r13d, %xmm0
movsd %xmm0, 0x108(%rsp)
movl $0xffffffff, %r14d      # imm = 0xFFFFFFFF
xorl $0x1, %r13d
movl %r15d, %ebp
testb $0x1, %r15b
jne 0x6001f
xorps %xmm0, %xmm0
cvtsi2sd %r14d, %xmm0
movsd %xmm0, 0x110(%rsp)
xorl %r15d, %r15d
movl %r14d, %ebx
xorl $0x1, %ebx
movl %r15d, %eax
orl %r14d, %eax
orl %r13d, %eax
jne 0x5fff5
xorps %xmm0, %xmm0
cvtsi2sd %r15d, %xmm0
leaq 0x88(%rsp), %rdi
movsd 0x110(%rsp), %xmm1
movsd 0x108(%rsp), %xmm2
callq 0x85982
movsd 0x88(%rsp), %xmm0
movsd 0x90(%rsp), %xmm1
movsd 0x98(%rsp), %xmm2
movq %r12, %rdi
movq 0x48(%rsp), %rsi
callq 0x530d6
movq %r12, %rdi
callq 0x84e36
movsd 0xf4708(%rip), %xmm1    # 0x1546f0
ucomisd %xmm0, %xmm1
jb 0x60009
movl $0x1, %ebp
jmp 0x6000d
movl %ebx, %eax
orl %r15d, %eax
sete %al
cmpl $0x1, %r15d
je 0x5ff89
testb %al, %al
je 0x6000d
jmp 0x5ff89
movzbl %bpl, %ebp
testl %r15d, %r15d
jne 0x6001f
incl %r15d
testb $0x1, %bpl
je 0x5ff7e
testl %r14d, %r14d
jg 0x60036
incl %r14d
movl %ebp, %r15d
testb $0x1, %r15b
je 0x5ff57
jmp 0x60039
movl %ebp, %r15d
movl 0x44(%rsp), %r13d
testl %r13d, %r13d
jg 0x60050
incl %r13d
testb $0x1, %r15b
je 0x5ff2d
xorpd %xmm0, %xmm0
movapd %xmm0, 0xb0(%rsp)
xorl %eax, %eax
movq %rax, 0xc0(%rsp)
movq %rax, 0x100(%rsp)
movapd %xmm0, 0xf0(%rsp)
movq %rax, 0x60(%rsp)
movapd %xmm0, 0x50(%rsp)
movq %rax, 0x88(%rsp)
movl %eax, 0x90(%rsp)
movq %rax, 0x98(%rsp)
movl %eax, 0xa0(%rsp)
movq %rax, 0xa8(%rsp)
movl %eax, 0x130(%rsp)
cmpl $0x0, 0x38(%rsp)
movq 0xc8(%rsp), %r14
jle 0x6065a
xorl %eax, %eax
movl %r15d, 0x40(%rsp)
movslq %eax, %rsi
movq (%r14), %rax
movq 0x8(%r14), %rdx
subq %rax, %rdx
sarq $0x3, %rdx
movabsq $-0x30c30c30c30c30c3, %rcx # imm = 0xCF3CF3CF3CF3CF3D
imulq %rcx, %rdx
cmpq %rsi, %rdx
jbe 0x60e1c
imulq $0xa8, %rsi, %rcx
movq 0x8(%rax,%rcx), %rdx
movq 0x50(%rax,%rcx), %r12
subq (%rax,%rcx), %rdx
shrq $0x3, %rdx
imull $0xaaaaaaab, %edx, %r13d # imm = 0xAAAAAAAB
subq 0x48(%rax,%rcx), %r12
shrq $0x2, %r12
movq 0x68(%rax,%rcx), %rdx
movq 0x60(%rax,%rcx), %rax
xorl %ecx, %ecx
movq %rcx, 0x80(%rsp)
xorpd %xmm0, %xmm0
movapd %xmm0, 0x70(%rsp)
movq %rcx, 0xe0(%rsp)
movapd %xmm0, 0xd0(%rsp)
movl $0x0, 0x118(%rsp)
testl %r13d, %r13d
jle 0x604ff
subq %rax, %rdx
shrq $0x2, %rdx
movslq %r12d, %rbp
movq %rdx, %r15
movslq %edx, %rbx
xorl %eax, %eax
movslq 0x130(%rsp), %rsi
movq (%r14), %rcx
movq 0x8(%r14), %rdx
subq %rcx, %rdx
sarq $0x3, %rdx
movabsq $-0x30c30c30c30c30c3, %rdi # imm = 0xCF3CF3CF3CF3CF3D
imulq %rdi, %rdx
cmpq %rsi, %rdx
jbe 0x60dd1
imulq $0xa8, %rsi, %rdx
movslq %eax, %rsi
movq 0x18(%rcx,%rdx), %rdi
movq 0x20(%rcx,%rdx), %rdx
subq %rdi, %rdx
sarq $0x5, %rdx
cmpq %rsi, %rdx
jbe 0x60dd1
shlq $0x5, %rsi
addq %rsi, %rdi
leaq 0xf8eb5(%rip), %rsi     # 0x159084
callq 0x4170
testl %eax, %eax
je 0x604e6
movslq 0x130(%rsp), %rsi
movq (%r14), %rax
movq 0x8(%r14), %rdx
subq %rax, %rdx
sarq $0x3, %rdx
movabsq $-0x30c30c30c30c30c3, %rcx # imm = 0xCF3CF3CF3CF3CF3D
imulq %rcx, %rdx
cmpq %rsi, %rdx
jbe 0x60ddf
imulq $0xa8, %rsi, %rdx
movslq 0x118(%rsp), %rsi
movq (%rax,%rdx), %rcx
movq 0x8(%rax,%rdx), %rdx
subq %rcx, %rdx
sarq $0x3, %rdx
movabsq $-0x5555555555555555, %rax # imm = 0xAAAAAAAAAAAAAAAB
imulq %rax, %rdx
cmpq %rsi, %rdx
jbe 0x60ddf
leaq (%rsi,%rsi,2), %rax
movsd (%rcx,%rax,8), %xmm0
movsd 0x8(%rcx,%rax,8), %xmm1
movsd 0x10(%rcx,%rax,8), %xmm2
leaq 0x148(%rsp), %rdi
movq 0x48(%rsp), %rsi
callq 0x53240
testl %r12d, %r12d
jle 0x602ef
movslq 0x130(%rsp), %rsi
movq (%r14), %rax
movq 0x8(%r14), %rdx
subq %rax, %rdx
sarq $0x3, %rdx
movabsq $-0x30c30c30c30c30c3, %rcx # imm = 0xCF3CF3CF3CF3CF3D
imulq %rcx, %rdx
cmpq %rsi, %rdx
jbe 0x60db2
movl 0x118(%rsp), %ecx
imulq $0xa8, %rsi, %rsi
movq 0x48(%rax,%rsi), %rdx
movq 0x50(%rax,%rsi), %rsi
subq %rdx, %rsi
sarq $0x2, %rsi
movq %rsi, %rdi
negq %rdi
movl $0x1, %r8d
leaq (%rdi,%r8), %rax
cmpq $0x1, %rax
je 0x60daf
movl -0x4(%rdx,%r8,4), %r9d
cmpl %r9d, %ecx
sete %al
cmpq %rbp, %r8
jge 0x602f1
incq %r8
cmpl %r9d, %ecx
jne 0x602c7
jmp 0x602f1
xorl %eax, %eax
xorl %edi, %edi
testl %r15d, %r15d
jle 0x60389
testb %al, %al
jne 0x60389
movslq 0x130(%rsp), %rsi
movq (%r14), %rdi
movq 0x8(%r14), %rdx
subq %rdi, %rdx
sarq $0x3, %rdx
movabsq $-0x30c30c30c30c30c3, %rcx # imm = 0xCF3CF3CF3CF3CF3D
imulq %rcx, %rdx
cmpq %rsi, %rdx
jbe 0x60dc3
movl 0x118(%rsp), %ecx
imulq $0xa8, %rsi, %rsi
movq 0x60(%rdi,%rsi), %rdx
movq 0x68(%rdi,%rsi), %rsi
subq %rdx, %rsi
sarq $0x2, %rsi
movq %rsi, %r8
negq %r8
movl $0x1, %r9d
leaq (%r8,%r9), %rdi
cmpq $0x1, %rdi
je 0x60dc0
cmpl -0x4(%rdx,%r9,4), %ecx
sete %dil
cmpq %rbx, %r9
setge %r10b
orb %al, %r10b
orb %dil, %r10b
incq %r9
testb $0x1, %r10b
je 0x6035c
testb %al, %al
je 0x603c6
movq 0xd8(%rsp), %rsi
cmpq 0xe0(%rsp), %rsi
je 0x603ff
movq 0x158(%rsp), %rax
movq %rax, 0x10(%rsi)
movupd 0x148(%rsp), %xmm0
movupd %xmm0, (%rsi)
addq $0x18, 0xd8(%rsp)
jmp 0x604e6
testb %dil, %dil
jne 0x604e6
movq 0x78(%rsp), %rsi
cmpq 0x80(%rsp), %rsi
je 0x60419
movq 0x158(%rsp), %rax
movq %rax, 0x10(%rsi)
movupd 0x148(%rsp), %xmm0
movupd %xmm0, (%rsi)
addq $0x18, 0x78(%rsp)
jmp 0x6042b
leaq 0xd0(%rsp), %rdi
leaq 0x148(%rsp), %rdx
callq 0x6a5be
jmp 0x604e6
leaq 0x70(%rsp), %rdi
leaq 0x148(%rsp), %rdx
callq 0x6a5be
movq 0x58(%rsp), %rsi
cmpq 0x60(%rsp), %rsi
je 0x60458
movq 0x158(%rsp), %rax
movq %rax, 0x10(%rsi)
movupd 0x148(%rsp), %xmm0
movupd %xmm0, (%rsi)
addq $0x18, 0x58(%rsp)
jmp 0x6046a
leaq 0x50(%rsp), %rdi
leaq 0x148(%rsp), %rdx
callq 0x6a5be
movq 0xb8(%rsp), %rsi
cmpq 0xc0(%rsp), %rsi
je 0x60493
movl 0x130(%rsp), %eax
movl %eax, (%rsi)
addq $0x4, %rsi
movq %rsi, 0xb8(%rsp)
jmp 0x604a8
leaq 0xb0(%rsp), %rdi
leaq 0x130(%rsp), %rdx
callq 0xf7b4
movq 0xf8(%rsp), %rsi
cmpq 0x100(%rsp), %rsi
je 0x604d1
movl 0x118(%rsp), %eax
movl %eax, (%rsi)
addq $0x4, %rsi
movq %rsi, 0xf8(%rsp)
jmp 0x604e6
leaq 0xf0(%rsp), %rdi
leaq 0x118(%rsp), %rdx
callq 0xf7b4
movl 0x118(%rsp), %eax
incl %eax
movl %eax, 0x118(%rsp)
cmpl %r13d, %eax
jl 0x60170
movq 0x78(%rsp), %rbx
subq 0x70(%rsp), %rbx
sarq $0x3, %rbx
movabsq $-0x5555555555555555, %rax # imm = 0xAAAAAAAAAAAAAAAB
imulq %rax, %rbx
testl %ebx, %ebx
jle 0x605fc
movslq %r12d, %r14
andl $0x7fffffff, %ebx       # imm = 0x7FFFFFFF
xorl %r13d, %r13d
testl %r12d, %r12d
jle 0x605de
xorl %ebp, %ebp
xorl %r15d, %r15d
movq 0x70(%rsp), %rax
movq 0x78(%rsp), %rdx
subq %rax, %rdx
sarq $0x3, %rdx
movabsq $-0x5555555555555555, %rsi # imm = 0xAAAAAAAAAAAAAAAB
imulq %rsi, %rdx
cmpq %r13, %rdx
jbe 0x60d9e
movq 0xd0(%rsp), %rcx
movq 0xd8(%rsp), %rdx
subq %rcx, %rdx
sarq $0x3, %rdx
imulq %rsi, %rdx
cmpq %r15, %rdx
jbe 0x60d9b
leaq (,%r13,2), %rdx
addq %r13, %rdx
movq 0x10(%rcx,%rbp), %rsi
movq %rsi, 0x28(%rsp)
movups (%rcx,%rbp), %xmm0
movups %xmm0, 0x18(%rsp)
movq 0x10(%rax,%rdx,8), %rcx
movq %rcx, 0x10(%rsp)
movupd (%rax,%rdx,8), %xmm0
movupd %xmm0, (%rsp)
movq 0x48(%rsp), %rdi
callq 0x5a312
incq %r15
cmpq %r14, %r15
setge %cl
orb %al, %cl
addq $0x18, %rbp
testb %cl, %cl
je 0x6053d
jmp 0x605e0
xorl %eax, %eax
movzbl %al, %esi
leaq 0x88(%rsp), %rdi
callq 0xe9e6
incq %r13
cmpq %rbx, %r13
jne 0x6052f
movq 0xd0(%rsp), %rdi
testq %rdi, %rdi
je 0x60619
movq 0xe0(%rsp), %rsi
subq %rdi, %rsi
callq 0x4470
movq 0x70(%rsp), %rdi
testq %rdi, %rdi
movq 0xc8(%rsp), %r14
movl 0x40(%rsp), %r15d
je 0x60640
movq 0x80(%rsp), %rsi
subq %rdi, %rsi
callq 0x4470
movl 0x130(%rsp), %eax
incl %eax
movl %eax, 0x130(%rsp)
cmpl 0x38(%rsp), %eax
jl 0x600c5
movq 0x58(%rsp), %rcx
subq 0x50(%rsp), %rcx
sarq $0x3, %rcx
movabsq $-0x5555555555555555, %rax # imm = 0xAAAAAAAAAAAAAAAB
imulq %rax, %rcx
testl %ecx, %ecx
jle 0x60ce9
movl %r15d, 0x40(%rsp)
movslq 0x168(%rsp), %rax
movq %rax, 0x198(%rsp)
movq %rcx, 0x190(%rsp)
andl $0x7fffffff, %ecx       # imm = 0x7FFFFFFF
movq %rcx, 0x170(%rsp)
movl $0x1, %eax
movq %rax, 0x160(%rsp)
xorl %r13d, %r13d
leaq 0x148(%rsp), %rbx
leaq 0x118(%rsp), %rbp
leaq 0x130(%rsp), %r12
xorl %r15d, %r15d
leaq 0x1(%r13), %rax
movq %rax, 0x188(%rsp)
cmpq 0x170(%rsp), %rax
jae 0x60cc3
testb $0x1, %r15b
jne 0x60cc3
movq 0x160(%rsp), %rax
movq %rax, 0x38(%rsp)
movb %r15b, 0x37(%rsp)
movq %r13, 0x180(%rsp)
movq 0xb0(%rsp), %rax
movq 0xb8(%rsp), %rdx
subq %rax, %rdx
sarq $0x2, %rdx
cmpq %r13, %rdx
jbe 0x60e42
movq 0x38(%rsp), %rcx
cmpq %rcx, %rdx
jbe 0x60e03
movslq (%rax,%r13,4), %rsi
cmpl (%rax,%rcx,4), %esi
jne 0x60a66
movq (%r14), %rcx
movq 0x8(%r14), %rdx
subq %rcx, %rdx
sarq $0x3, %rdx
movabsq $-0x30c30c30c30c30c3, %rdi # imm = 0xCF3CF3CF3CF3CF3D
imulq %rdi, %rdx
cmpq %rsi, %rdx
jbe 0x60dfe
movq 0xf0(%rsp), %r9
movq 0xf8(%rsp), %r8
subq %r9, %r8
sarq $0x2, %r8
cmpq %r13, %r8
jbe 0x60e2d
imulq $0xa8, %rsi, %r10
movslq (%r9,%r13,4), %rsi
movq (%rcx,%r10), %rdi
movq 0x8(%rcx,%r10), %r10
subq %rdi, %r10
sarq $0x3, %r10
movabsq $-0x5555555555555555, %r11 # imm = 0xAAAAAAAAAAAAAAAB
imulq %r11, %r10
cmpq %rsi, %r10
jbe 0x60e37
movq 0x38(%rsp), %r10
movslq (%rax,%r10,4), %rax
cmpq %rax, %rdx
jbe 0x60e32
cmpq %r10, %r8
jbe 0x60e2a
imulq $0xa8, %rax, %rdx
movslq (%r9,%r10,4), %r8
movq (%rcx,%rdx), %rax
movq 0x8(%rcx,%rdx), %rdx
subq %rax, %rdx
sarq $0x3, %rdx
movabsq $-0x5555555555555555, %rcx # imm = 0xAAAAAAAAAAAAAAAB
imulq %rcx, %rdx
cmpq %r8, %rdx
jbe 0x60e3f
leaq (%rsi,%rsi,2), %rcx
leaq (%rdi,%rcx,8), %rcx
leaq (%r8,%r8,2), %rdx
movq 0x10(%rax,%rdx,8), %rsi
movq %rsi, 0x28(%rsp)
movups (%rax,%rdx,8), %xmm0
movups %xmm0, 0x18(%rsp)
movq 0x10(%rcx), %rax
movq %rax, 0x10(%rsp)
movupd (%rcx), %xmm0
movupd %xmm0, (%rsp)
callq 0x9f612
testb %al, %al
je 0x60c17
testb $0x1, 0x40(%rsp)
je 0x60c0b
movq 0x50(%rsp), %rax
movq 0x58(%rsp), %rdx
subq %rax, %rdx
sarq $0x3, %rdx
movabsq $-0x5555555555555555, %rcx # imm = 0xAAAAAAAAAAAAAAAB
imulq %rcx, %rdx
cmpq %r13, %rdx
jbe 0x60e61
leaq (,%r13,2), %rcx
addq %r13, %rcx
movq 0x10(%rax,%rcx,8), %rdx
movq %rdx, 0x10(%rsp)
movupd (%rax,%rcx,8), %xmm0
movupd %xmm0, (%rsp)
leaq 0xd0(%rsp), %r14
movq %r14, %rdi
callq 0x84ece
leaq 0x70(%rsp), %rdi
leaq 0x1d0(%rsp), %rsi
movq %r14, %rdx
callq 0x85da6
movq 0x50(%rsp), %rax
movq 0x58(%rsp), %rdx
subq %rax, %rdx
sarq $0x3, %rdx
movabsq $-0x5555555555555555, %rcx # imm = 0xAAAAAAAAAAAAAAAB
imulq %rcx, %rdx
movq 0x38(%rsp), %rsi
cmpq %rsi, %rdx
jbe 0x60e53
leaq (%rsi,%rsi,2), %rcx
leaq (%rax,%rcx,8), %rsi
leaq 0x1a0(%rsp), %rdi
leaq 0x70(%rsp), %rdx
callq 0x85dd4
movq 0x1b0(%rsp), %rax
movq %rax, 0x10(%rsp)
movupd 0x1a0(%rsp), %xmm0
movupd %xmm0, (%rsp)
movq %r14, %rdi
callq 0x84ece
xorl %r14d, %r14d
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
movl %eax, 0x44(%rsp)
xorps %xmm0, %xmm0
cvtsi2sd %eax, %xmm0
movsd %xmm0, 0x108(%rsp)
movl $0xffffffff, %r15d      # imm = 0xFFFFFFFF
xorps %xmm0, %xmm0
cvtsi2sd %r15d, %xmm0
movsd %xmm0, 0x110(%rsp)
movl $0xffffffff, %r13d      # imm = 0xFFFFFFFF
xorps %xmm2, %xmm2
cvtsi2sd %r13d, %xmm2
movq %rbx, %rdi
movsd 0x108(%rsp), %xmm0
movsd 0x110(%rsp), %xmm1
callq 0x85982
movq %rbp, %rdi
leaq 0xd0(%rsp), %rsi
movq %rbx, %rdx
callq 0x85dd4
movsd 0x118(%rsp), %xmm0
movsd 0x120(%rsp), %xmm1
movsd 0x128(%rsp), %xmm2
movq %r12, %rdi
movq 0x48(%rsp), %rsi
callq 0x530d6
movq 0x1c8(%rsp), %rax
movq %rax, 0x28(%rsp)
movups 0x1b8(%rsp), %xmm0
movups %xmm0, 0x18(%rsp)
movq 0x140(%rsp), %rax
movq %rax, 0x10(%rsp)
movupd 0x130(%rsp), %xmm0
movupd %xmm0, (%rsp)
callq 0x9f612
movzbl %al, %eax
addl %eax, %r14d
testl %r13d, %r13d
jg 0x60a18
incl %r13d
cmpl $0x2, %r14d
jl 0x60969
testl %r15d, %r15d
jg 0x60a2a
incl %r15d
cmpl $0x2, %r14d
jl 0x60952
movl 0x44(%rsp), %eax
testl %eax, %eax
jg 0x60a3e
incl %eax
cmpl $0x2, %r14d
jl 0x60938
cmpl $0x2, %r14d
movzbl 0x37(%rsp), %r15d
movl $0x1, %eax
cmovgel %eax, %r15d
movq 0xc8(%rsp), %r14
movq 0x180(%rsp), %r13
jmp 0x60c9e
movq 0x50(%rsp), %rax
movq 0x58(%rsp), %rdx
subq %rax, %rdx
sarq $0x3, %rdx
movabsq $-0x5555555555555555, %rcx # imm = 0xAAAAAAAAAAAAAAAB
imulq %rcx, %rdx
cmpq %r13, %rdx
jbe 0x60e42
movq 0x38(%rsp), %rsi
cmpq %rsi, %rdx
jbe 0x60dfe
leaq (,%r13,2), %rcx
addq %r13, %rcx
leaq (%rsi,%rsi,2), %rdx
movq 0x10(%rax,%rdx,8), %rsi
movq %rsi, 0x28(%rsp)
movups (%rax,%rdx,8), %xmm0
movups %xmm0, 0x18(%rsp)
movq 0x10(%rax,%rcx,8), %rdx
movq %rdx, 0x10(%rsp)
movupd (%rax,%rcx,8), %xmm0
movupd %xmm0, (%rsp)
movq 0x48(%rsp), %rdi
callq 0x5a176
testb %al, %al
je 0x60c0b
leaq 0x88(%rsp), %rdi
movq %r13, %rsi
callq 0xedb6
movb $0x1, %r15b
testq %rdx, (%rax)
je 0x60c9e
leaq 0x88(%rsp), %rdi
movq 0x38(%rsp), %rsi
callq 0xedb6
testq %rdx, (%rax)
je 0x60c9e
cmpl $0x0, 0x168(%rsp)
jle 0x60c9e
movq 0x178(%rsp), %rcx
movq (%rcx), %rax
movq 0x8(%rcx), %rsi
subq %rax, %rsi
sarq $0x2, %rsi
movabsq $0x6db6db6db6db6db7, %rcx # imm = 0x6DB6DB6DB6DB6DB7
imulq %rcx, %rsi
movq 0xb0(%rsp), %rcx
movq 0xb8(%rsp), %rdx
subq %rcx, %rdx
sarq $0x2, %rdx
movq %rsi, %rdi
negq %rdi
addq $0x4, %rax
movl $0x1, %r8d
xorl %r9d, %r9d
leaq (%rdi,%r8), %r10
cmpq $0x1, %r10
je 0x60ded
cmpq %r13, %rdx
jbe 0x60e0b
movl -0x4(%rax), %r10d
movl (%rax), %r11d
movl (%rcx,%r13,4), %r14d
cmpl %r14d, %r10d
jne 0x60bb8
movq %r13, %r15
movq 0x38(%rsp), %r13
cmpq %r13, %rdx
jbe 0x60e0b
cmpl (%rcx,%r13,4), %r11d
movq %r15, %r13
je 0x60bd1
cmpl %r14d, %r11d
jne 0x60bd4
movq 0x38(%rsp), %r11
cmpq %r11, %rdx
jbe 0x60e08
cmpl (%rcx,%r11,4), %r10d
jne 0x60bd4
movb $0x1, %r9b
cmpq 0x198(%rsp), %r8
movq 0xc8(%rsp), %r14
jge 0x60bf3
incq %r8
addq $0x1c, %rax
testb $0x1, %r9b
je 0x60b77
movzbl 0x37(%rsp), %r15d
testb $0x1, %r9b
movl $0x1, %eax
cmovel %eax, %r15d
jmp 0x60c9e
movb 0x37(%rsp), %al
movl %eax, %r15d
jmp 0x60c9e
movq 0x50(%rsp), %rax
movq 0x58(%rsp), %rdx
subq %rax, %rdx
sarq $0x3, %rdx
movabsq $-0x5555555555555555, %rcx # imm = 0xAAAAAAAAAAAAAAAB
imulq %rcx, %rdx
cmpq %r13, %rdx
jbe 0x60e42
movq 0x38(%rsp), %rsi
cmpq %rsi, %rdx
jbe 0x60dfe
leaq (,%r13,2), %rcx
addq %r13, %rcx
leaq (%rsi,%rsi,2), %rdx
movq 0x10(%rax,%rdx,8), %rsi
movq %rsi, 0x28(%rsp)
movups (%rax,%rdx,8), %xmm0
movups %xmm0, 0x18(%rsp)
movq 0x10(%rax,%rcx,8), %rdx
movq %rdx, 0x10(%rsp)
movupd (%rax,%rcx,8), %xmm0
movupd %xmm0, (%rsp)
movq 0x48(%rsp), %rdi
callq 0x5a176
movzbl 0x37(%rsp), %r15d
testb %al, %al
movl $0x1, %eax
cmovnel %eax, %r15d
movq 0x38(%rsp), %rax
incq %rax
movq %rax, 0x38(%rsp)
cmpl 0x190(%rsp), %eax
jge 0x60cc3
movb %r15b, 0x37(%rsp)
testb $0x1, %r15b
je 0x60712
movq 0x188(%rsp), %r13
cmpq 0x170(%rsp), %r13
jae 0x60cec
incq 0x160(%rsp)
testb $0x1, %r15b
je 0x606d4
jmp 0x60cec
xorl %r15d, %r15d
movq 0x88(%rsp), %rdi
testq %rdi, %rdi
je 0x60d31
movq 0xa8(%rsp), %rsi
subq %rdi, %rsi
callq 0x4470
xorl %eax, %eax
movq %rax, 0x88(%rsp)
movl %eax, 0x90(%rsp)
movq %rax, 0x98(%rsp)
movl %eax, 0xa0(%rsp)
movq %rax, 0xa8(%rsp)
movq 0x50(%rsp), %rdi
testq %rdi, %rdi
je 0x60d48
movq 0x60(%rsp), %rsi
subq %rdi, %rsi
callq 0x4470
movq 0xf0(%rsp), %rdi
testq %rdi, %rdi
je 0x60d65
movq 0x100(%rsp), %rsi
subq %rdi, %rsi
callq 0x4470
movq 0xb0(%rsp), %rdi
testq %rdi, %rdi
je 0x60d82
movq 0xc0(%rsp), %rsi
subq %rdi, %rsi
callq 0x4470
andb $0x1, %r15b
movl %r15d, %eax
addq $0x1e8, %rsp            # imm = 0x1E8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %r15, %r13
leaq 0xee900(%rip), %rdi     # 0x14f6a5
movq %r13, %rsi
xorl %eax, %eax
callq 0x4630
movq %rsi, %rdx
leaq 0xee8ec(%rip), %rdi     # 0x14f6a5
xorl %eax, %eax
callq 0x4630
movq %rsi, %rdx
leaq 0xee8db(%rip), %rdi     # 0x14f6a5
xorl %eax, %eax
callq 0x4630
leaq 0xee8cd(%rip), %rdi     # 0x14f6a5
xorl %eax, %eax
callq 0x4630
leaq 0xee8bf(%rip), %rdi     # 0x14f6a5
xorl %eax, %eax
callq 0x4630
leaq 0xee8b1(%rip), %rdi     # 0x14f6a5
movq %rsi, %rdx
xorl %eax, %eax
callq 0x4630
movq %rsi, %r13
jmp 0x60e42
movq %rcx, %r13
jmp 0x60e42
movq %r11, %r13
leaq 0xee893(%rip), %rdi     # 0x14f6a5
movq %r13, %rsi
xorl %eax, %eax
callq 0x4630
leaq 0xee882(%rip), %rdi     # 0x14f6a5
xorl %eax, %eax
callq 0x4630
movq %r10, %r13
movq %r8, %rdx
jmp 0x60e42
movq %rax, %r13
jmp 0x60e42
movq %rsi, %r13
movq %r10, %rdx
jmp 0x60e42
movq %r8, %r13
leaq 0xee85c(%rip), %rdi     # 0x14f6a5
movq %r13, %rsi
xorl %eax, %eax
callq 0x4630
leaq 0xee84b(%rip), %rdi     # 0x14f6a5
xorl %eax, %eax
callq 0x4630
leaq 0xee83d(%rip), %rdi     # 0x14f6a5
movq %r13, %rsi
xorl %eax, %eax
callq 0x4630
jmp 0x60ed8
jmp 0x60ed8
jmp 0x60ed8
jmp 0x60ed8
jmp 0x60ed8
jmp 0x60ed8
jmp 0x60ed8
jmp 0x60ed8
jmp 0x60ed8
jmp 0x60e98
jmp 0x60ed8
jmp 0x60e98
jmp 0x60ed8
jmp 0x60e98
jmp 0x60e98
jmp 0x60e98
jmp 0x60e98
jmp 0x60e98
jmp 0x60e98
movq %rax, %rbx
movq 0xd0(%rsp), %rdi
testq %rdi, %rdi
je 0x60eb8
movq 0xe0(%rsp), %rsi
subq %rdi, %rsi
callq 0x4470
movq 0x70(%rsp), %rdi
testq %rdi, %rdi
je 0x60edb
movq 0x80(%rsp), %rsi
subq %rdi, %rsi
callq 0x4470
jmp 0x60edb
jmp 0x60ed8
jmp 0x60ed8
movq %rax, %rbx
movq 0x88(%rsp), %rdi
testq %rdi, %rdi
je 0x60f20
movq 0xa8(%rsp), %rsi
subq %rdi, %rsi
callq 0x4470
xorl %eax, %eax
movq %rax, 0x88(%rsp)
movl %eax, 0x90(%rsp)
movq %rax, 0x98(%rsp)
movl %eax, 0xa0(%rsp)
movq %rax, 0xa8(%rsp)
movq 0x50(%rsp), %rdi
testq %rdi, %rdi
je 0x60f37
movq 0x60(%rsp), %rsi
subq %rdi, %rsi
callq 0x4470
movq 0xf0(%rsp), %rdi
testq %rdi, %rdi
je 0x60f54
movq 0x100(%rsp), %rsi
subq %rdi, %rsi
callq 0x4470
movq 0xb0(%rsp), %rdi
testq %rdi, %rdi
je 0x60f71
movq 0xc0(%rsp), %rsi
subq %rdi, %rsi
callq 0x4470
movq %rbx, %rdi
callq 0x4780