// File: /workspace/github_cpp_makefile_star2_O3/Luthaf[P]zeopp/networkstorage.cc
// Function: connect_molecules(std::vector<MOLECULE, std::allocator<MOLECULE>>*, ATOM_NETWORK*, std::vector<MOLECULE, std::allocator<MOLECULE>>*, std::vector<CONNECTION, std::allocator<CONNECTION>>*, double*, int, bool, bool, bool, double)
ATOM_NETWORK connect_molecules(vector<MOLECULE> *molecules, ATOM_NETWORK *cell, vector<MOLECULE> *assembled_molecules, vector<CONNECTION> *two_way_connections, double *mean_edge_length, int dimensionality, bool a_periodicity, bool b_periodicity, bool c_periodicity, double unit_edge_length) {
  bool verbose = false;
  ATOM_NETWORK unit_cell_any_matrix;
  //1) keep track of which molecules have been fixed in place already, and which connections were made
  vector<bool> placed;
  int num_mols = molecules->size();
  for(int i=0; i<num_mols; i++) placed.push_back(false);
  vector<bool> connected;
  int num_cons = two_way_connections->size();
  for(int i=0; i<num_cons; i++) connected.push_back(false);
  //2) fix each molecule in place
  for(int i=0; i<num_mols; i++) assembled_molecules->push_back(molecules->at(i)); //this vector starts out the same as the molecules vector, but the molecules are then each shifted into their relative positions to form the assembled_molecules
  int num_placed = 0;
  bool placed_ok = true;
  double sum_edge_lengths = 0;
  if(verbose) printf("DEBUG: about to place molecules\n");
  while(num_placed<num_mols && placed_ok) {
    int new_num_placed = place_molecule(molecules, two_way_connections, cell, &placed, &connected, assembled_molecules, num_placed, &sum_edge_lengths);
    if(verbose) printf("DEBUG: after calling place_molecule, %d molecules have been placed\n", new_num_placed);
    if(new_num_placed==num_placed+1) {
      num_placed = new_num_placed;
    } else placed_ok = false;
  }
  if(num_placed>1) (*mean_edge_length) = ((double)(sum_edge_lengths))/((double)(num_placed-1));
  if(num_placed!=num_mols) {
//    printf("ERROR: only %d of %d molecules were fixed in place during connection-based assembly method - this method should have been automatically bypassed if a disconnected net was provided\n", num_placed, num_mols);
//    exit(EXIT_FAILURE);
if(verbose) printf("NOTICE: only %d of %d molecules were fixed in place during connection-based assembly method - returning empty framework\n", num_placed, num_mols);
    return unit_cell_any_matrix;
  } else {
    if(verbose) printf("DEBUG: all %d of %d molecules were fixed in place successfully!\n", num_placed, num_mols);
  }

  //3) new new idea - look for loops in the two-way connections, and calculate their shifts, using this information to determine the net?
  vector<bool> edge_traversed;
  for(int i=0; i<num_cons; i++) edge_traversed.push_back(false);
  vector<int> vertices_visited;
  vector<int> loops_a, loops_b, loops_c;
  vector<XYZ> loops_xyz;
  vector<int> unit_cell_vector_IDs;
  vector<XYZ> unit_cell_vectors;
  vector<int> vertex_visit_a, vertex_visit_b, vertex_visit_c;
  vector<XYZ> vertex_visit_xyz;
  vector<bool> vertex_visited;
  int num_v = cell->vertices.size();
  for(int i=0; i<num_v; i++) {vertex_visited.push_back(false); vertex_visit_a.push_back(0); vertex_visit_b.push_back(0); vertex_visit_c.push_back(0); vertex_visit_xyz.push_back(origin);}
  bool found_all_uc_vectors = recursive_find_loops(0, 0, 0, 0, origin, two_way_connections, assembled_molecules, &edge_traversed, &vertex_visit_a, &vertex_visit_b, &vertex_visit_c, &vertex_visit_xyz, &vertex_visited, &loops_a, &loops_b, &loops_c, &loops_xyz, &unit_cell_vector_IDs, &unit_cell_vectors, dimensionality);
if(verbose) {
  int num_loops = loops_xyz.size();
  for(int i=0; i<num_loops; i++) {
    XYZ l = loops_xyz.at(i);
    printf("DEBUG: unique loop was found with periodicity (%d %d %d) and Cartesian shift %.3f %.3f %.3f\n", loops_a.at(i), loops_b.at(i), loops_c.at(i), l.x, l.y, l.z);
  }
}
  if(found_all_uc_vectors) {
if(verbose) printf("DEBUG: found all uc vectors from loop analysis\n");
  } else {
    printf("ERROR: did not find all uc vectors from loop analysis\n");
    exit(EXIT_FAILURE);
  }

  //if we are dealing with a 2D net (a layer), then we need to introduce a periodic connection running in that direction
  if(dimensionality==2) {
if(verbose) printf("DEBUG: imposing a three dimensional structure on this two-dimensional framework in order to define a unit cell\n");
    int num_override = 0;
    if(!a_periodicity) {
      XYZ vec((*mean_edge_length)*cell->a/unit_edge_length,0,0);
      unit_cell_vectors.push_back(vec);
      unit_cell_vector_IDs.push_back(0);
      num_override++;
    }
    if(!b_periodicity) {
      XYZ vec(0,(*mean_edge_length)*cell->b/unit_edge_length,0);
      unit_cell_vectors.push_back(vec);
      unit_cell_vector_IDs.push_back(1);
      num_override++;
    }
    if(!c_periodicity) {
      XYZ vec(0,0,(*mean_edge_length)*cell->c/unit_edge_length);
      unit_cell_vectors.push_back(vec);
      unit_cell_vector_IDs.push_back(2);
      num_override++;
    }
    if(num_override!=1) {
      printf("ERROR: was expecting to override exactly 1 cell side length value, but %d were overwritten - this is a bug\n", num_override);
      exit(EXIT_FAILURE);
    }
  }
  vector<XYZ> sorted_unit_cell_vectors;
  for(int i=0; i<3; i++) {
    bool pushed = false;
    for(int j=0; j<3 && !pushed; j++) {
      if(unit_cell_vector_IDs.at(j)==i) {
        sorted_unit_cell_vectors.push_back(unit_cell_vectors.at(j));
        pushed = true;
      }
    }
  }
  create_unit_cell_from_vectors(&sorted_unit_cell_vectors, &unit_cell_any_matrix);

  //6) put atoms into the cell, converting to fractional coords
  put_atoms_in_atom_network(&unit_cell_any_matrix, assembled_molecules);
  //7) that ATOM_NETWORK was constructed with matrices based on periodic connections, that may not conform to the standard axes relations - build a new cell with a normal matrix, based on this one, and copy the atom fractional coords into this system
  ATOM_NETWORK unit_cell;
  unit_cell_any_matrix.copy(&unit_cell);
  unit_cell.make(unit_cell_any_matrix.a, unit_cell_any_matrix.b, unit_cell_any_matrix.c, unit_cell_any_matrix.alpha, unit_cell_any_matrix.beta, unit_cell_any_matrix.gamma);
  return unit_cell;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x718, %rsp            # imm = 0x718
movsd %xmm0, 0x108(%rsp)
movq %r9, 0xf8(%rsp)
movq %r8, 0x110(%rsp)
movq %rcx, 0x100(%rsp)
movq %rdx, 0xf0(%rsp)
movq %rsi, %r15
movq %rdi, %r14
leaq 0x2b8(%rsp), %rdi
callq 0x5112c
xorl %r13d, %r13d
movq %r13, 0x1c0(%rsp)
movl %r13d, 0x1c8(%rsp)
movq %r13, 0x1d0(%rsp)
movl %r13d, 0x1d8(%rsp)
movq %r13, 0x1e0(%rsp)
movq 0x8(%r15), %r12
subq (%r15), %r12
sarq $0x3, %r12
movabsq $-0x30c30c30c30c30c3, %rax # imm = 0xCF3CF3CF3CF3CF3D
imulq %rax, %r12
testl %r12d, %r12d
jle 0x5e61c
leaq 0x1c0(%rsp), %rbx
movl %r12d, %ebp
movq %rbx, %rdi
xorl %esi, %esi
callq 0xea58
decl %ebp
jne 0x5e60e
movq %r13, 0x198(%rsp)
movl %r13d, 0x1a0(%rsp)
movq %r13, 0x1a8(%rsp)
movl %r13d, 0x1b0(%rsp)
movq %r13, 0x1b8(%rsp)
movq 0x110(%rsp), %rcx
movq 0x8(%rcx), %rax
subq (%rcx), %rax
shrq $0x2, %rax
imull $0xb6db6db7, %eax, %r13d # imm = 0xB6DB6DB7
testl %r13d, %r13d
jle 0x5e67c
leaq 0x198(%rsp), %rbx
movl %r13d, %ebp
movq %rbx, %rdi
xorl %esi, %esi
callq 0xea58
decl %ebp
jne 0x5e66e
movq %r14, 0x1e8(%rsp)
testl %r12d, %r12d
jle 0x5e77a
movl %r12d, %ebx
andl $0x7fffffff, %ebx       # imm = 0x7FFFFFFF
xorl %r14d, %r14d
xorl %ebp, %ebp
movq (%r15), %rsi
movq 0x8(%r15), %rdx
subq %rsi, %rdx
sarq $0x3, %rdx
movabsq $-0x30c30c30c30c30c3, %rax # imm = 0xCF3CF3CF3CF3CF3D
imulq %rax, %rdx
cmpq %rbp, %rdx
jbe 0x5f428
addq %r14, %rsi
movq 0x100(%rsp), %rdi
callq 0x67810
incq %rbp
addq $0xa8, %r14
cmpq %rbp, %rbx
jne 0x5e69b
movq $0x0, 0x118(%rsp)
testl %r12d, %r12d
jle 0x5e786
xorl %r14d, %r14d
leaq 0x1c0(%rsp), %rbp
leaq 0x198(%rsp), %rbx
leaq 0x118(%rsp), %rax
movq %rax, 0x8(%rsp)
movl %r14d, (%rsp)
movq %r15, %rdi
movq 0x110(%rsp), %rsi
movq 0xf0(%rsp), %rdx
movq %rbp, %rcx
movq %rbx, %r8
movq 0x100(%rsp), %r9
callq 0x59f23
leal 0x1(%r14), %ecx
cmpl %ecx, %eax
cmovel %eax, %r14d
cmpl %r12d, %r14d
jge 0x5e751
cmpl %ecx, %eax
je 0x5e707
cmpl $0x2, %r14d
jl 0x5e789
movsd 0x118(%rsp), %xmm0
leal -0x1(%r14), %eax
cvtsi2sd %eax, %xmm1
divsd %xmm1, %xmm0
movq 0xf8(%rsp), %rax
movsd %xmm0, (%rax)
jmp 0x5e789
movq $0x0, 0x118(%rsp)
xorl %r14d, %r14d
cmpl %r12d, %r14d
jne 0x5eb7f
xorl %r14d, %r14d
movq %r14, 0x218(%rsp)
movl %r14d, 0x220(%rsp)
movq %r14, 0x228(%rsp)
movl %r14d, 0x230(%rsp)
movq %r14, 0x238(%rsp)
testl %r13d, %r13d
jle 0x5e7d9
leaq 0x218(%rsp), %rbx
movq %rbx, %rdi
xorl %esi, %esi
callq 0xea58
decl %r13d
jne 0x5e7ca
xorpd %xmm0, %xmm0
movapd %xmm0, 0x2a0(%rsp)
movq %r14, 0x2b0(%rsp)
movq %r14, 0x290(%rsp)
movapd %xmm0, 0x280(%rsp)
movq %r14, 0x270(%rsp)
movapd %xmm0, 0x260(%rsp)
movq %r14, 0x250(%rsp)
movapd %xmm0, 0x240(%rsp)
movq %r14, 0xe0(%rsp)
movapd %xmm0, 0xd0(%rsp)
movq %r14, 0xc0(%rsp)
movapd %xmm0, 0xb0(%rsp)
movq %r14, 0x190(%rsp)
movapd %xmm0, 0x180(%rsp)
movq %r14, 0x170(%rsp)
movapd %xmm0, 0x160(%rsp)
movq %r14, 0x150(%rsp)
movapd %xmm0, 0x140(%rsp)
movq %r14, 0x130(%rsp)
movapd %xmm0, 0x120(%rsp)
movq %r14, 0x1f0(%rsp)
movl %r14d, 0x1f8(%rsp)
movq %r14, 0x200(%rsp)
movl %r14d, 0x208(%rsp)
movq %r14, 0x210(%rsp)
movq 0xf0(%rsp), %rcx
movq 0x3c8(%rcx), %rax
subq 0x3c0(%rcx), %rax
shrq $0x4, %rax
imull $0xb6db6db7, %eax, %ebx # imm = 0xB6DB6DB7
testl %ebx, %ebx
jle 0x5ea0d
leaq 0x1f0(%rsp), %r15
leaq 0x180(%rsp), %r14
leaq 0x90(%rsp), %rbp
leaq 0x160(%rsp), %r12
leaq 0x140(%rsp), %r13
movq %r15, %rdi
xorl %esi, %esi
callq 0xea58
movl $0x0, 0x90(%rsp)
movq 0x188(%rsp), %rsi
cmpq 0x190(%rsp), %rsi
je 0x5e93a
movl $0x0, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x188(%rsp)
jmp 0x5e945
movq %r14, %rdi
movq %rbp, %rdx
callq 0x14198
movl $0x0, 0x90(%rsp)
movq 0x168(%rsp), %rsi
cmpq 0x170(%rsp), %rsi
je 0x5e976
movl $0x0, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x168(%rsp)
jmp 0x5e981
movq %r12, %rdi
movq %rbp, %rdx
callq 0x14198
movl $0x0, 0x90(%rsp)
movq 0x148(%rsp), %rsi
cmpq 0x150(%rsp), %rsi
je 0x5e9b2
movl $0x0, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x148(%rsp)
jmp 0x5e9bd
movq %r13, %rdi
movq %rbp, %rdx
callq 0x14198
movq 0x128(%rsp), %rsi
cmpq 0x130(%rsp), %rsi
je 0x5e9f1
movq 0x136d0a(%rip), %rax    # 0x1956e0
movq %rax, 0x10(%rsi)
movupd 0x136cee(%rip), %xmm0   # 0x1956d0
movupd %xmm0, (%rsi)
addq $0x18, 0x128(%rsp)
jmp 0x5ea05
leaq 0x120(%rsp), %rdi
leaq 0x136cd0(%rip), %rdx    # 0x1956d0
callq 0x69b82
decl %ebx
jne 0x5e8ff
movl 0x750(%rsp), %ebx
movq 0x136cc5(%rip), %rax    # 0x1956e0
movq %rax, 0x10(%rsp)
movupd 0x136ca8(%rip), %xmm0   # 0x1956d0
movupd %xmm0, (%rsp)
movl %ebx, 0x78(%rsp)
leaq 0xb0(%rsp), %rax
movq %rax, 0x70(%rsp)
leaq 0xd0(%rsp), %rax
movq %rax, 0x68(%rsp)
leaq 0x240(%rsp), %rax
movq %rax, 0x60(%rsp)
leaq 0x260(%rsp), %rax
movq %rax, 0x58(%rsp)
leaq 0x280(%rsp), %rax
movq %rax, 0x50(%rsp)
leaq 0x2a0(%rsp), %rax
movq %rax, 0x48(%rsp)
leaq 0x1f0(%rsp), %rax
movq %rax, 0x40(%rsp)
leaq 0x120(%rsp), %rax
movq %rax, 0x38(%rsp)
leaq 0x140(%rsp), %rax
movq %rax, 0x30(%rsp)
leaq 0x160(%rsp), %rax
movq %rax, 0x28(%rsp)
leaq 0x180(%rsp), %rax
movq %rax, 0x20(%rsp)
leaq 0x218(%rsp), %rax
movq %rax, 0x18(%rsp)
xorl %edi, %edi
xorl %esi, %esi
xorl %edx, %edx
xorl %ecx, %ecx
movq 0x110(%rsp), %r8
movq 0x100(%rsp), %r9
callq 0x9e86b
testb %al, %al
je 0x5f439
cmpl $0x2, %ebx
jne 0x5f0ba
xorl %ebp, %ebp
cmpb $0x0, 0x758(%rsp)
jne 0x5ef01
movq 0xf8(%rsp), %rax
movsd (%rax), %xmm0
movq 0xf0(%rsp), %rax
mulsd 0x8(%rax), %xmm0
divsd 0x108(%rsp), %xmm0
leaq 0x90(%rsp), %rdi
xorpd %xmm1, %xmm1
xorpd %xmm2, %xmm2
callq 0x84364
movq 0xb8(%rsp), %rsi
cmpq 0xc0(%rsp), %rsi
je 0x5eea1
movq 0xa0(%rsp), %rax
movq %rax, 0x10(%rsi)
movupd 0x90(%rsp), %xmm0
movupd %xmm0, (%rsi)
addq $0x18, 0xb8(%rsp)
jmp 0x5eeb6
movl $0x2ec, %edx            # imm = 0x2EC
movq 0x1e8(%rsp), %rbx
movq %rbx, %rdi
leaq 0x2b8(%rsp), %r14
movq %r14, %rsi
callq 0x4370
movups 0x5a8(%rsp), %xmm0
movups %xmm0, 0x2f0(%rbx)
movq 0x5b8(%rsp), %rax
movq %rax, 0x300(%rbx)
xorl %eax, %eax
movq %rax, 0x5b8(%rsp)
xorps %xmm0, %xmm0
movups %xmm0, 0x5a8(%rsp)
movups 0x5c0(%rsp), %xmm1
movups %xmm1, 0x308(%rbx)
movq 0x5d0(%rsp), %rcx
movq %rcx, 0x318(%rbx)
movq %rax, 0x5d0(%rsp)
movups %xmm0, 0x5c0(%rsp)
movl $0x330, %eax            # imm = 0x330
leaq (%rbx,%rax), %rcx
movq %rcx, 0x320(%rbx)
movq 0x5d8(%rsp), %rdx
addq %r14, %rax
cmpq %rax, %rdx
je 0x5ec38
movq %rdx, 0x320(%rbx)
movq 0x5e8(%rsp), %rcx
movq %rcx, 0x330(%rbx)
jmp 0x5ec3e
movups (%rax), %xmm0
movups %xmm0, (%rcx)
movq 0x5e0(%rsp), %rcx
movq %rcx, 0x328(%rbx)
movq %rax, 0x5d8(%rsp)
xorl %eax, %eax
movq %rax, 0x5e0(%rsp)
movb $0x0, 0x5e8(%rsp)
movupd 0x5f8(%rsp), %xmm0
movupd %xmm0, 0x340(%rbx)
movq 0x608(%rsp), %rcx
movq %rcx, 0x350(%rbx)
movq %rax, 0x608(%rsp)
xorpd %xmm0, %xmm0
movupd %xmm0, 0x5f8(%rsp)
movups 0x610(%rsp), %xmm1
movups %xmm1, 0x358(%rbx)
movq 0x620(%rsp), %rcx
movq %rcx, 0x368(%rbx)
movq %rax, 0x620(%rsp)
movupd %xmm0, 0x610(%rsp)
movups 0x628(%rsp), %xmm1
movups %xmm1, 0x370(%rbx)
movq 0x638(%rsp), %rcx
movq %rcx, 0x380(%rbx)
movq %rax, 0x638(%rsp)
movupd %xmm0, 0x628(%rsp)
movups 0x640(%rsp), %xmm1
movupd 0x650(%rsp), %xmm2
movups 0x660(%rsp), %xmm3
movups %xmm3, 0x3a8(%rbx)
movupd %xmm2, 0x398(%rbx)
movups %xmm1, 0x388(%rbx)
movb 0x670(%rsp), %cl
movb %cl, 0x3b8(%rbx)
movups 0x678(%rsp), %xmm1
movups %xmm1, 0x3c0(%rbx)
movq 0x688(%rsp), %rcx
movq %rcx, 0x3d0(%rbx)
movq %rax, 0x688(%rsp)
movupd %xmm0, 0x678(%rsp)
movups 0x690(%rsp), %xmm1
movups %xmm1, 0x3d8(%rbx)
movq 0x6a0(%rsp), %rcx
movq %rcx, 0x3e8(%rbx)
movq %rax, 0x6a0(%rsp)
movupd %xmm0, 0x690(%rsp)
movups 0x6a8(%rsp), %xmm1
movups %xmm1, 0x3f0(%rbx)
movq 0x6b8(%rsp), %rcx
movq %rcx, 0x400(%rbx)
movq %rax, 0x6b8(%rsp)
movupd %xmm0, 0x6a8(%rsp)
movups 0x6c0(%rsp), %xmm1
movups %xmm1, 0x408(%rbx)
movq 0x6d0(%rsp), %rcx
movq %rcx, 0x418(%rbx)
movq %rax, 0x6d0(%rsp)
movupd %xmm0, 0x6c0(%rsp)
movupd 0x6d8(%rsp), %xmm1
movupd %xmm1, 0x420(%rbx)
movq 0x6e8(%rsp), %rcx
movq %rcx, 0x430(%rbx)
movq %rax, 0x6e8(%rsp)
movupd %xmm0, 0x6d8(%rsp)
movl 0x6f0(%rsp), %eax
movl %eax, 0x438(%rbx)
movl $0x450, %edx            # imm = 0x450
leaq (%rbx,%rdx), %rax
movq %rax, 0x440(%rbx)
movq 0x6f8(%rsp), %rcx
addq %rdx, %r14
cmpq %r14, %rcx
je 0x5ee68
movq %rcx, 0x440(%rbx)
movq 0x708(%rsp), %rax
movq %rax, 0x450(%rbx)
jmp 0x5ee71
movupd (%r14), %xmm0
movupd %xmm0, (%rax)
movq 0x700(%rsp), %rax
movq %rax, 0x448(%rbx)
movq %r14, 0x6f8(%rsp)
movq $0x0, 0x700(%rsp)
movb $0x0, 0x708(%rsp)
jmp 0x5f384
leaq 0xb0(%rsp), %rdi
leaq 0x90(%rsp), %rdx
callq 0x69b82
movl $0x0, 0x8c(%rsp)
movq 0xd8(%rsp), %rsi
cmpq 0xe0(%rsp), %rsi
je 0x5eee7
movl $0x0, (%rsi)
addq $0x4, %rsi
movq %rsi, 0xd8(%rsp)
jmp 0x5eefc
leaq 0xd0(%rsp), %rdi
leaq 0x8c(%rsp), %rdx
callq 0x14198
movl $0x1, %ebp
cmpb $0x0, 0x760(%rsp)
jne 0x5efd9
movq 0xf8(%rsp), %rax
movsd (%rax), %xmm1
movq 0xf0(%rsp), %rax
mulsd 0x10(%rax), %xmm1
divsd 0x108(%rsp), %xmm1
leaq 0x90(%rsp), %rdi
xorpd %xmm0, %xmm0
xorpd %xmm2, %xmm2
callq 0x84364
movq 0xb8(%rsp), %rsi
cmpq 0xc0(%rsp), %rsi
je 0x5ef7c
movq 0xa0(%rsp), %rax
movq %rax, 0x10(%rsi)
movupd 0x90(%rsp), %xmm0
movupd %xmm0, (%rsi)
addq $0x18, 0xb8(%rsp)
jmp 0x5ef91
leaq 0xb0(%rsp), %rdi
leaq 0x90(%rsp), %rdx
callq 0x69b82
movl $0x1, 0x8c(%rsp)
movq 0xd8(%rsp), %rsi
cmpq 0xe0(%rsp), %rsi
je 0x5efc2
movl $0x1, (%rsi)
addq $0x4, %rsi
movq %rsi, 0xd8(%rsp)
jmp 0x5efd7
leaq 0xd0(%rsp), %rdi
leaq 0x8c(%rsp), %rdx
callq 0x14198
incl %ebp
cmpb $0x0, 0x768(%rsp)
jne 0x5f0b1
movq 0xf8(%rsp), %rax
movsd (%rax), %xmm2
movq 0xf0(%rsp), %rax
mulsd 0x18(%rax), %xmm2
divsd 0x108(%rsp), %xmm2
leaq 0x90(%rsp), %rdi
xorpd %xmm0, %xmm0
xorpd %xmm1, %xmm1
callq 0x84364
movq 0xb8(%rsp), %rsi
cmpq 0xc0(%rsp), %rsi
je 0x5f054
movq 0xa0(%rsp), %rax
movq %rax, 0x10(%rsi)
movupd 0x90(%rsp), %xmm0
movupd %xmm0, (%rsi)
addq $0x18, 0xb8(%rsp)
jmp 0x5f069
leaq 0xb0(%rsp), %rdi
leaq 0x90(%rsp), %rdx
callq 0x69b82
movl $0x2, 0x8c(%rsp)
movq 0xd8(%rsp), %rsi
cmpq 0xe0(%rsp), %rsi
je 0x5f09a
movl $0x2, (%rsi)
addq $0x4, %rsi
movq %rsi, 0xd8(%rsp)
jmp 0x5f0af
leaq 0xd0(%rsp), %rdi
leaq 0x8c(%rsp), %rdx
callq 0x14198
incl %ebp
cmpl $0x1, %ebp
jne 0x5f447
xorpd %xmm0, %xmm0
leaq 0x90(%rsp), %r15
movapd %xmm0, (%r15)
movq $0x0, 0x10(%r15)
xorl %ebx, %ebx
movabsq $-0x5555555555555555, %r14 # imm = 0xAAAAAAAAAAAAAAAB
movq 0xd0(%rsp), %rax
movq 0xd8(%rsp), %rdx
subq %rax, %rdx
sarq $0x2, %rdx
xorl %ecx, %ecx
xorl %esi, %esi
cmpq %rsi, %rdx
jbe 0x5f41a
movl (%rax,%rsi,4), %edi
cmpl %ebx, %edi
je 0x5f11d
cmpq $0x1, %rsi
ja 0x5f17c
incq %rsi
addq $0x18, %rcx
cmpl %ebx, %edi
jne 0x5f0fa
jmp 0x5f17c
movq 0xb0(%rsp), %rax
movq 0xb8(%rsp), %rdx
subq %rax, %rdx
sarq $0x3, %rdx
imulq %r14, %rdx
cmpq %rsi, %rdx
jbe 0x5f41a
addq %rcx, %rax
movq 0x98(%rsp), %rsi
cmpq 0xa0(%rsp), %rsi
je 0x5f171
movq 0x10(%rax), %rcx
movq %rcx, 0x10(%rsi)
movupd (%rax), %xmm0
movupd %xmm0, (%rsi)
addq $0x18, 0x98(%rsp)
jmp 0x5f17c
movq %r15, %rdi
movq %rax, %rdx
callq 0x69b82
incl %ebx
cmpl $0x3, %ebx
jne 0x5f0df
leaq 0x90(%rsp), %rdi
leaq 0x2b8(%rsp), %rsi
callq 0x5b079
movq 0x1e8(%rsp), %rbx
leaq 0x2b8(%rsp), %rdi
movq 0x100(%rsp), %rsi
callq 0x5d8c4
movq %rbx, %rdi
callq 0x5112c
leaq 0x2b8(%rsp), %rdi
movq %rbx, %rsi
callq 0x52620
movups 0x2c0(%rsp), %xmm0
movups %xmm0, 0x8(%rbx)
movups 0x2d0(%rsp), %xmm0
movups %xmm0, 0x18(%rbx)
movupd 0x2e0(%rsp), %xmm0
movupd %xmm0, 0x28(%rbx)
movq %rbx, %rdi
callq 0x51db4
movq 0x90(%rsp), %rdi
testq %rdi, %rdi
je 0x5f21c
movq 0xa0(%rsp), %rsi
subq %rdi, %rsi
callq 0x4470
movq 0x1f0(%rsp), %rdi
testq %rdi, %rdi
je 0x5f239
movq 0x210(%rsp), %rsi
subq %rdi, %rsi
callq 0x4470
movq 0x120(%rsp), %rdi
testq %rdi, %rdi
je 0x5f256
movq 0x130(%rsp), %rsi
subq %rdi, %rsi
callq 0x4470
movq 0x140(%rsp), %rdi
testq %rdi, %rdi
je 0x5f273
movq 0x150(%rsp), %rsi
subq %rdi, %rsi
callq 0x4470
movq 0x160(%rsp), %rdi
testq %rdi, %rdi
je 0x5f290
movq 0x170(%rsp), %rsi
subq %rdi, %rsi
callq 0x4470
movq 0x180(%rsp), %rdi
testq %rdi, %rdi
je 0x5f2ad
movq 0x190(%rsp), %rsi
subq %rdi, %rsi
callq 0x4470
movq 0xb0(%rsp), %rdi
testq %rdi, %rdi
je 0x5f2ca
movq 0xc0(%rsp), %rsi
subq %rdi, %rsi
callq 0x4470
movq 0xd0(%rsp), %rdi
testq %rdi, %rdi
je 0x5f2e7
movq 0xe0(%rsp), %rsi
subq %rdi, %rsi
callq 0x4470
movq 0x240(%rsp), %rdi
testq %rdi, %rdi
je 0x5f304
movq 0x250(%rsp), %rsi
subq %rdi, %rsi
callq 0x4470
movq 0x260(%rsp), %rdi
testq %rdi, %rdi
je 0x5f321
movq 0x270(%rsp), %rsi
subq %rdi, %rsi
callq 0x4470
movq 0x280(%rsp), %rdi
testq %rdi, %rdi
je 0x5f33e
movq 0x290(%rsp), %rsi
subq %rdi, %rsi
callq 0x4470
movq 0x2a0(%rsp), %rdi
testq %rdi, %rdi
je 0x5f35b
movq 0x2b0(%rsp), %rsi
subq %rdi, %rsi
callq 0x4470
movq 0x218(%rsp), %rdi
testq %rdi, %rdi
je 0x5f384
movq 0x238(%rsp), %rsi
subq %rdi, %rsi
callq 0x4470
movq $0x0, 0x218(%rsp)
movq 0x198(%rsp), %rdi
testq %rdi, %rdi
je 0x5f3be
movq 0x1b8(%rsp), %rsi
subq %rdi, %rsi
callq 0x4470
xorl %eax, %eax
movq %rax, 0x198(%rsp)
movl $0x0, 0x1a0(%rsp)
movq %rax, 0x1a8(%rsp)
movq 0x1c0(%rsp), %rdi
testq %rdi, %rdi
je 0x5f3f8
movq 0x1e0(%rsp), %rsi
subq %rdi, %rsi
callq 0x4470
xorl %eax, %eax
movq %rax, 0x1c0(%rsp)
movl $0x0, 0x1c8(%rsp)
movq %rax, 0x1d0(%rsp)
leaq 0x2b8(%rsp), %rdi
callq 0xec94
movq %rbx, %rax
addq $0x718, %rsp            # imm = 0x718
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0xee2d4(%rip), %rdi     # 0x14d6f5
xorl %eax, %eax
callq 0x4630
leaq 0xee2c6(%rip), %rdi     # 0x14d6f5
movq %rbp, %rsi
xorl %eax, %eax
callq 0x4630
leaq 0xf4c52(%rip), %rdi     # 0x154092
callq 0x4660
jmp 0x5f457
leaq 0xf415f(%rip), %rdi     # 0x1535ad
movl %ebp, %esi
xorl %eax, %eax
callq 0x4060
movl $0x1, %edi
callq 0x72bc
jmp 0x5f490
jmp 0x5f490
jmp 0x5f490
jmp 0x5f490
jmp 0x5f490
jmp 0x5f490
jmp 0x5f490
movq %rax, %r14
movq %rbx, %rdi
callq 0xec94
jmp 0x5f4ac
jmp 0x5f4a9
jmp 0x5f4a9
jmp 0x5f490
jmp 0x5f490
jmp 0x5f490
movq %rax, %r14
jmp 0x5f628
jmp 0x5f499
movq %rax, %r14
jmp 0x5f4c9
jmp 0x5f499
jmp 0x5f499
movq %rax, %r14
jmp 0x5f651
movq %rax, %r14
jmp 0x5f685
movq %rax, %r14
movq 0x90(%rsp), %rdi
testq %rdi, %rdi
je 0x5f4c9
movq 0xa0(%rsp), %rsi
subq %rdi, %rsi
callq 0x4470
movq 0x1f0(%rsp), %rdi
testq %rdi, %rdi
je 0x5f506
movq 0x210(%rsp), %rsi
subq %rdi, %rsi
callq 0x4470
xorl %eax, %eax
movq %rax, 0x1f0(%rsp)
movl %eax, 0x1f8(%rsp)
movq %rax, 0x200(%rsp)
movl %eax, 0x208(%rsp)
movq 0x120(%rsp), %rdi
testq %rdi, %rdi
je 0x5f523
movq 0x130(%rsp), %rsi
subq %rdi, %rsi
callq 0x4470
movq 0x140(%rsp), %rdi
testq %rdi, %rdi
je 0x5f540
movq 0x150(%rsp), %rsi
subq %rdi, %rsi
callq 0x4470
movq 0x160(%rsp), %rdi
testq %rdi, %rdi
je 0x5f55d
movq 0x170(%rsp), %rsi
subq %rdi, %rsi
callq 0x4470
movq 0x180(%rsp), %rdi
testq %rdi, %rdi
je 0x5f57a
movq 0x190(%rsp), %rsi
subq %rdi, %rsi
callq 0x4470
movq 0xb0(%rsp), %rdi
testq %rdi, %rdi
je 0x5f597
movq 0xc0(%rsp), %rsi
subq %rdi, %rsi
callq 0x4470
movq 0xd0(%rsp), %rdi
testq %rdi, %rdi
je 0x5f5b4
movq 0xe0(%rsp), %rsi
subq %rdi, %rsi
callq 0x4470
movq 0x240(%rsp), %rdi
testq %rdi, %rdi
je 0x5f5d1
movq 0x250(%rsp), %rsi
subq %rdi, %rsi
callq 0x4470
movq 0x260(%rsp), %rdi
testq %rdi, %rdi
je 0x5f5ee
movq 0x270(%rsp), %rsi
subq %rdi, %rsi
callq 0x4470
movq 0x280(%rsp), %rdi
testq %rdi, %rdi
je 0x5f60b
movq 0x290(%rsp), %rsi
subq %rdi, %rsi
callq 0x4470
movq 0x2a0(%rsp), %rdi
testq %rdi, %rdi
je 0x5f628
movq 0x2b0(%rsp), %rsi
subq %rdi, %rsi
callq 0x4470
movq 0x218(%rsp), %rdi
testq %rdi, %rdi
je 0x5f651
movq 0x238(%rsp), %rsi
subq %rdi, %rsi
callq 0x4470
movq $0x0, 0x218(%rsp)
movq 0x198(%rsp), %rdi
testq %rdi, %rdi
je 0x5f685
movq 0x1b8(%rsp), %rsi
subq %rdi, %rsi
callq 0x4470
movq $0x0, 0x198(%rsp)
movl $0x0, 0x1a0(%rsp)
movq 0x1c0(%rsp), %rdi
testq %rdi, %rdi
je 0x5f6b9
movq 0x1e0(%rsp), %rsi
subq %rdi, %rsi
callq 0x4470
movq $0x0, 0x1c0(%rsp)
movl $0x0, 0x1c8(%rsp)
leaq 0x2b8(%rsp), %rdi
callq 0xec94
movq %r14, %rdi
callq 0x4780