// File: /workspace/github_cpp_makefile_star2_O1/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 $0x728, %rsp            # imm = 0x728
movsd %xmm0, 0x1b0(%rsp)
movq %r9, 0x100(%rsp)
movq %r8, 0x1b8(%rsp)
movq %rcx, 0x108(%rsp)
movq %rdx, 0xf8(%rsp)
movq %rsi, %r15
movq %rdi, 0x240(%rsp)
leaq 0x2c8(%rsp), %rdi
callq 0x514f4
xorl %r14d, %r14d
movq %r14, 0x188(%rsp)
movl %r14d, 0x190(%rsp)
movq %r14, 0x198(%rsp)
movl %r14d, 0x1a0(%rsp)
movq %r14, 0x1a8(%rsp)
movq 0x8(%r15), %rax
subq (%r15), %rax
sarq $0x3, %rax
movabsq $-0x30c30c30c30c30c3, %r13 # imm = 0xCF3CF3CF3CF3CF3D
imulq %r13, %rax
movq %rax, 0xf0(%rsp)
testl %eax, %eax
jle 0x5ec6e
leaq 0x188(%rsp), %rbx
movq 0xf0(%rsp), %rax
movl %eax, %ebp
movq %rbx, %rdi
xorl %esi, %esi
callq 0xe9e6
decl %ebp
jne 0x5ec60
movq %r14, 0x160(%rsp)
movl %r14d, 0x168(%rsp)
movq %r14, 0x170(%rsp)
movl %r14d, 0x178(%rsp)
movq %r14, 0x180(%rsp)
movq 0x1b8(%rsp), %rcx
movq 0x8(%rcx), %rax
subq (%rcx), %rax
shrq $0x2, %rax
imull $0xb6db6db7, %eax, %r14d # imm = 0xB6DB6DB7
testl %r14d, %r14d
jle 0x5ecce
leaq 0x160(%rsp), %rbx
movl %r14d, %ebp
movq %rbx, %rdi
xorl %esi, %esi
callq 0xe9e6
decl %ebp
jne 0x5ecc0
cmpl $0x0, 0xf0(%rsp)
jle 0x5ed25
movq 0xf0(%rsp), %rbx
andl $0x7fffffff, %ebx       # imm = 0x7FFFFFFF
xorl %r12d, %r12d
xorl %ebp, %ebp
movq (%r15), %rsi
movq 0x8(%r15), %rdx
subq %rsi, %rdx
sarq $0x3, %rdx
imulq %r13, %rdx
cmpq %rbp, %rdx
jbe 0x5fb86
addq %r12, %rsi
movq 0x108(%rsp), %rdi
callq 0x68142
incq %rbp
addq $0xa8, %r12
cmpq %rbp, %rbx
jne 0x5eceb
movq $0x0, 0x248(%rsp)
cmpl $0x0, 0xf0(%rsp)
jle 0x5edb1
movb $0x1, %r12b
leaq 0x188(%rsp), %rbp
leaq 0x160(%rsp), %rbx
xorl %r13d, %r13d
leaq 0x248(%rsp), %rax
movq %rax, 0x8(%rsp)
movl %r13d, (%rsp)
movq %r15, %rdi
movq 0x1b8(%rsp), %rsi
movq 0xf8(%rsp), %rdx
movq %rbp, %rcx
movq %rbx, %r8
movq 0x108(%rsp), %r9
callq 0x5a3e0
leal 0x1(%r13), %ecx
cmpl %ecx, %eax
movzbl %r12b, %r12d
movl $0x0, %ecx
cmovnel %ecx, %r12d
cmovel %eax, %r13d
cmpl 0xf0(%rsp), %r13d
jge 0x5edb4
testb $0x1, %r12b
jne 0x5ed51
jmp 0x5edb4
xorl %r13d, %r13d
cmpl $0x2, %r13d
jl 0x5eddb
movsd 0x248(%rsp), %xmm0
leal -0x1(%r13), %eax
cvtsi2sd %eax, %xmm1
divsd %xmm1, %xmm0
movq 0x100(%rsp), %rax
movsd %xmm0, (%rax)
cmpl 0xf0(%rsp), %r13d
jne 0x5f1d6
xorl %r15d, %r15d
movq %r15, 0x138(%rsp)
movl %r15d, 0x140(%rsp)
movq %r15, 0x148(%rsp)
movl %r15d, 0x150(%rsp)
movq %r15, 0x158(%rsp)
testl %r14d, %r14d
jle 0x5ee30
leaq 0x138(%rsp), %rbx
movq %rbx, %rdi
xorl %esi, %esi
callq 0xe9e6
decl %r14d
jne 0x5ee21
xorpd %xmm0, %xmm0
movapd %xmm0, 0x2b0(%rsp)
movq %r15, 0x2c0(%rsp)
movq %r15, 0x2a0(%rsp)
movapd %xmm0, 0x290(%rsp)
movq %r15, 0x280(%rsp)
movapd %xmm0, 0x270(%rsp)
movq %r15, 0x260(%rsp)
movapd %xmm0, 0x250(%rsp)
movq %r15, 0xe0(%rsp)
movapd %xmm0, 0xd0(%rsp)
movq %r15, 0xc0(%rsp)
movapd %xmm0, 0xb0(%rsp)
movq %r15, 0x230(%rsp)
movapd %xmm0, 0x220(%rsp)
movq %r15, 0x210(%rsp)
movapd %xmm0, 0x200(%rsp)
movq %r15, 0x1f0(%rsp)
movapd %xmm0, 0x1e0(%rsp)
movq %r15, 0x1d0(%rsp)
movapd %xmm0, 0x1c0(%rsp)
movq %r15, 0x110(%rsp)
movl %r15d, 0x118(%rsp)
movq %r15, 0x120(%rsp)
movl %r15d, 0x128(%rsp)
movq %r15, 0x130(%rsp)
movq 0xf8(%rsp), %rcx
movq 0x3c8(%rcx), %rax
subq 0x3c0(%rcx), %rax
shrq $0x4, %rax
imull $0xb6db6db7, %eax, %ebx # imm = 0xB6DB6DB7
testl %ebx, %ebx
jle 0x5f064
leaq 0x110(%rsp), %r15
leaq 0x220(%rsp), %r14
leaq 0x90(%rsp), %rbp
leaq 0x200(%rsp), %r12
leaq 0x1e0(%rsp), %r13
movq %r15, %rdi
xorl %esi, %esi
callq 0xe9e6
movl $0x0, 0x90(%rsp)
movq 0x228(%rsp), %rsi
cmpq 0x230(%rsp), %rsi
je 0x5ef91
movl $0x0, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x228(%rsp)
jmp 0x5ef9c
movq %r14, %rdi
movq %rbp, %rdx
callq 0x1422c
movl $0x0, 0x90(%rsp)
movq 0x208(%rsp), %rsi
cmpq 0x210(%rsp), %rsi
je 0x5efcd
movl $0x0, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x208(%rsp)
jmp 0x5efd8
movq %r12, %rdi
movq %rbp, %rdx
callq 0x1422c
movl $0x0, 0x90(%rsp)
movq 0x1e8(%rsp), %rsi
cmpq 0x1f0(%rsp), %rsi
je 0x5f009
movl $0x0, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x1e8(%rsp)
jmp 0x5f014
movq %r13, %rdi
movq %rbp, %rdx
callq 0x1422c
movq 0x1c8(%rsp), %rsi
cmpq 0x1d0(%rsp), %rsi
je 0x5f048
movq 0x1386b3(%rip), %rax    # 0x1976e0
movq %rax, 0x10(%rsi)
movupd 0x138697(%rip), %xmm0   # 0x1976d0
movupd %xmm0, (%rsi)
addq $0x18, 0x1c8(%rsp)
jmp 0x5f05c
leaq 0x1c0(%rsp), %rdi
leaq 0x138679(%rip), %rdx    # 0x1976d0
callq 0x6a5be
decl %ebx
jne 0x5ef56
movl 0x760(%rsp), %ebx
movq 0x13866e(%rip), %rax    # 0x1976e0
movq %rax, 0x10(%rsp)
movupd 0x138651(%rip), %xmm0   # 0x1976d0
movupd %xmm0, (%rsp)
movl %ebx, 0x78(%rsp)
leaq 0xb0(%rsp), %rax
movq %rax, 0x70(%rsp)
leaq 0xd0(%rsp), %rax
movq %rax, 0x68(%rsp)
leaq 0x250(%rsp), %rax
movq %rax, 0x60(%rsp)
leaq 0x270(%rsp), %rax
movq %rax, 0x58(%rsp)
leaq 0x290(%rsp), %rax
movq %rax, 0x50(%rsp)
leaq 0x2b0(%rsp), %rax
movq %rax, 0x48(%rsp)
leaq 0x110(%rsp), %rax
movq %rax, 0x40(%rsp)
leaq 0x1c0(%rsp), %rax
movq %rax, 0x38(%rsp)
leaq 0x1e0(%rsp), %rax
movq %rax, 0x30(%rsp)
leaq 0x200(%rsp), %rax
movq %rax, 0x28(%rsp)
leaq 0x220(%rsp), %rax
movq %rax, 0x20(%rsp)
leaq 0x138(%rsp), %rax
movq %rax, 0x18(%rsp)
xorl %edi, %edi
xorl %esi, %esi
xorl %edx, %edx
xorl %ecx, %ecx
movq 0x1b8(%rsp), %r8
movq 0x108(%rsp), %r9
callq 0xa04ac
testb %al, %al
je 0x5fb97
cmpl $0x2, %ebx
jne 0x5f7aa
xorl %ebp, %ebp
cmpb $0x0, 0x768(%rsp)
jne 0x5f5f1
movq 0x100(%rsp), %rax
movsd (%rax), %xmm0
movq 0xf8(%rsp), %rax
mulsd 0x8(%rax), %xmm0
divsd 0x1b0(%rsp), %xmm0
leaq 0x90(%rsp), %rdi
xorpd %xmm1, %xmm1
xorpd %xmm2, %xmm2
callq 0x85982
movq 0xb8(%rsp), %rsi
cmpq 0xc0(%rsp), %rsi
je 0x5f591
movq 0xa0(%rsp), %rax
movq %rax, 0x10(%rsi)
movupd 0x90(%rsp), %xmm0
movupd %xmm0, (%rsi)
addq $0x18, 0xb8(%rsp)
jmp 0x5f5a6
movl $0x2ec, %edx            # imm = 0x2EC
movq 0x240(%rsp), %rbx
movq %rbx, %rdi
leaq 0x2c8(%rsp), %r14
movq %r14, %rsi
callq 0x4370
movq 0x5b8(%rsp), %rax
movq %rax, 0x2f0(%rbx)
movq 0x5c0(%rsp), %rax
movq %rax, 0x2f8(%rbx)
movq 0x5c8(%rsp), %rax
movq %rax, 0x300(%rbx)
xorl %eax, %eax
movq %rax, 0x5c8(%rsp)
xorpd %xmm0, %xmm0
movupd %xmm0, 0x5b8(%rsp)
movq 0x5d0(%rsp), %rcx
movq %rcx, 0x308(%rbx)
movq 0x5d8(%rsp), %rcx
movq %rcx, 0x310(%rbx)
movq 0x5e0(%rsp), %rcx
movq %rcx, 0x318(%rbx)
movq %rax, 0x5e0(%rsp)
movupd %xmm0, 0x5d0(%rsp)
movl $0x330, %eax            # imm = 0x330
leaq (%rbx,%rax), %rcx
movq %rcx, 0x320(%rbx)
movq 0x5e8(%rsp), %rdx
addq %r14, %rax
cmpq %rax, %rdx
je 0x5f2b0
movq %rdx, 0x320(%rbx)
movq 0x5f8(%rsp), %rcx
movq %rcx, 0x330(%rbx)
jmp 0x5f2b8
movupd (%rax), %xmm0
movupd %xmm0, (%rcx)
movq 0x5f0(%rsp), %rcx
movq %rcx, 0x328(%rbx)
movq %rax, 0x5e8(%rsp)
xorl %eax, %eax
movq %rax, 0x5f0(%rsp)
movb $0x0, 0x5f8(%rsp)
movq 0x608(%rsp), %rcx
movq %rcx, 0x340(%rbx)
movq 0x610(%rsp), %rcx
movq %rcx, 0x348(%rbx)
movq 0x618(%rsp), %rcx
movq %rcx, 0x350(%rbx)
movq %rax, 0x618(%rsp)
xorpd %xmm0, %xmm0
movupd %xmm0, 0x608(%rsp)
movq 0x620(%rsp), %rcx
movq %rcx, 0x358(%rbx)
movq 0x628(%rsp), %rcx
movq %rcx, 0x360(%rbx)
movq 0x630(%rsp), %rcx
movq %rcx, 0x368(%rbx)
movq %rax, 0x630(%rsp)
movupd %xmm0, 0x620(%rsp)
movq 0x638(%rsp), %rcx
movq %rcx, 0x370(%rbx)
movq 0x640(%rsp), %rcx
movq %rcx, 0x378(%rbx)
movq 0x648(%rsp), %rcx
movq %rcx, 0x380(%rbx)
movq %rax, 0x648(%rsp)
movupd %xmm0, 0x638(%rsp)
movupd 0x650(%rsp), %xmm1
movupd 0x660(%rsp), %xmm2
movups 0x670(%rsp), %xmm3
movups %xmm3, 0x3a8(%rbx)
movupd %xmm2, 0x398(%rbx)
movupd %xmm1, 0x388(%rbx)
movb 0x680(%rsp), %cl
movb %cl, 0x3b8(%rbx)
movq 0x688(%rsp), %rcx
movq %rcx, 0x3c0(%rbx)
movq 0x690(%rsp), %rcx
movq %rcx, 0x3c8(%rbx)
movq 0x698(%rsp), %rcx
movq %rcx, 0x3d0(%rbx)
movq %rax, 0x698(%rsp)
movupd %xmm0, 0x688(%rsp)
movq 0x6a0(%rsp), %rcx
movq %rcx, 0x3d8(%rbx)
movq 0x6a8(%rsp), %rcx
movq %rcx, 0x3e0(%rbx)
movq 0x6b0(%rsp), %rcx
movq %rcx, 0x3e8(%rbx)
movq %rax, 0x6b0(%rsp)
movupd %xmm0, 0x6a0(%rsp)
movq 0x6b8(%rsp), %rcx
movq %rcx, 0x3f0(%rbx)
movq 0x6c0(%rsp), %rcx
movq %rcx, 0x3f8(%rbx)
movq 0x6c8(%rsp), %rcx
movq %rcx, 0x400(%rbx)
movq %rax, 0x6c8(%rsp)
movupd %xmm0, 0x6b8(%rsp)
movq 0x6d0(%rsp), %rcx
movq %rcx, 0x408(%rbx)
movq 0x6d8(%rsp), %rcx
movq %rcx, 0x410(%rbx)
movq 0x6e0(%rsp), %rcx
movq %rcx, 0x418(%rbx)
movq %rax, 0x6e0(%rsp)
movupd %xmm0, 0x6d0(%rsp)
movq 0x6e8(%rsp), %rcx
movq %rcx, 0x420(%rbx)
movq 0x6f0(%rsp), %rcx
movq %rcx, 0x428(%rbx)
movq 0x6f8(%rsp), %rcx
movq %rcx, 0x430(%rbx)
movq %rax, 0x6f8(%rsp)
movupd %xmm0, 0x6e8(%rsp)
movl 0x700(%rsp), %eax
movl %eax, 0x438(%rbx)
movl $0x450, %edx            # imm = 0x450
leaq (%rbx,%rdx), %rax
movq %rax, 0x440(%rbx)
movq 0x708(%rsp), %rcx
addq %rdx, %r14
cmpq %r14, %rcx
je 0x5f558
movq %rcx, 0x440(%rbx)
movq 0x718(%rsp), %rax
movq %rax, 0x450(%rbx)
jmp 0x5f561
movupd (%r14), %xmm0
movupd %xmm0, (%rax)
movq 0x710(%rsp), %rax
movq %rax, 0x448(%rbx)
movq %r14, 0x708(%rsp)
movq $0x0, 0x710(%rsp)
movb $0x0, 0x718(%rsp)
jmp 0x5fac9
leaq 0xb0(%rsp), %rdi
leaq 0x90(%rsp), %rdx
callq 0x6a5be
movl $0x0, 0x8c(%rsp)
movq 0xd8(%rsp), %rsi
cmpq 0xe0(%rsp), %rsi
je 0x5f5d7
movl $0x0, (%rsi)
addq $0x4, %rsi
movq %rsi, 0xd8(%rsp)
jmp 0x5f5ec
leaq 0xd0(%rsp), %rdi
leaq 0x8c(%rsp), %rdx
callq 0x1422c
movl $0x1, %ebp
cmpb $0x0, 0x770(%rsp)
jne 0x5f6c9
movq 0x100(%rsp), %rax
movsd (%rax), %xmm1
movq 0xf8(%rsp), %rax
mulsd 0x10(%rax), %xmm1
divsd 0x1b0(%rsp), %xmm1
leaq 0x90(%rsp), %rdi
xorpd %xmm0, %xmm0
xorpd %xmm2, %xmm2
callq 0x85982
movq 0xb8(%rsp), %rsi
cmpq 0xc0(%rsp), %rsi
je 0x5f66c
movq 0xa0(%rsp), %rax
movq %rax, 0x10(%rsi)
movupd 0x90(%rsp), %xmm0
movupd %xmm0, (%rsi)
addq $0x18, 0xb8(%rsp)
jmp 0x5f681
leaq 0xb0(%rsp), %rdi
leaq 0x90(%rsp), %rdx
callq 0x6a5be
movl $0x1, 0x8c(%rsp)
movq 0xd8(%rsp), %rsi
cmpq 0xe0(%rsp), %rsi
je 0x5f6b2
movl $0x1, (%rsi)
addq $0x4, %rsi
movq %rsi, 0xd8(%rsp)
jmp 0x5f6c7
leaq 0xd0(%rsp), %rdi
leaq 0x8c(%rsp), %rdx
callq 0x1422c
incl %ebp
cmpb $0x0, 0x778(%rsp)
jne 0x5f7a1
movq 0x100(%rsp), %rax
movsd (%rax), %xmm2
movq 0xf8(%rsp), %rax
mulsd 0x18(%rax), %xmm2
divsd 0x1b0(%rsp), %xmm2
leaq 0x90(%rsp), %rdi
xorpd %xmm0, %xmm0
xorpd %xmm1, %xmm1
callq 0x85982
movq 0xb8(%rsp), %rsi
cmpq 0xc0(%rsp), %rsi
je 0x5f744
movq 0xa0(%rsp), %rax
movq %rax, 0x10(%rsi)
movupd 0x90(%rsp), %xmm0
movupd %xmm0, (%rsi)
addq $0x18, 0xb8(%rsp)
jmp 0x5f759
leaq 0xb0(%rsp), %rdi
leaq 0x90(%rsp), %rdx
callq 0x6a5be
movl $0x2, 0x8c(%rsp)
movq 0xd8(%rsp), %rsi
cmpq 0xe0(%rsp), %rsi
je 0x5f78a
movl $0x2, (%rsi)
addq $0x4, %rsi
movq %rsi, 0xd8(%rsp)
jmp 0x5f79f
leaq 0xd0(%rsp), %rdi
leaq 0x8c(%rsp), %rdx
callq 0x1422c
incl %ebp
cmpl $0x1, %ebp
jne 0x5fba5
xorpd %xmm0, %xmm0
leaq 0x90(%rsp), %r15
movapd %xmm0, (%r15)
movq $0x0, 0x10(%r15)
xorl %ebx, %ebx
movabsq $-0x5555555555555555, %r14 # imm = 0xAAAAAAAAAAAAAAAB
xorl %r13d, %r13d
xorl %r12d, %r12d
xorl %ebp, %ebp
movq 0xd0(%rsp), %rax
movq 0xd8(%rsp), %rdx
subq %rax, %rdx
sarq $0x2, %rdx
cmpq %r12, %rdx
jbe 0x5fb75
cmpl %ebx, (%rax,%r12,4)
jne 0x5f862
movq 0xb0(%rsp), %rax
movq 0xb8(%rsp), %rdx
subq %rax, %rdx
sarq $0x3, %rdx
imulq %r14, %rdx
cmpq %r12, %rdx
jbe 0x5fb75
addq %r13, %rax
movq 0x98(%rsp), %rsi
cmpq 0xa0(%rsp), %rsi
je 0x5f854
movq 0x10(%rax), %rcx
movq %rcx, 0x10(%rsi)
movupd (%rax), %xmm0
movupd %xmm0, (%rsi)
addq $0x18, 0x98(%rsp)
movb $0x1, %bpl
jmp 0x5f862
movb $0x1, %bpl
movq %r15, %rdi
movq %rax, %rdx
callq 0x6a5be
cmpq $0x1, %r12
ja 0x5f879
incq %r12
addq $0x18, %r13
testb $0x1, %bpl
je 0x5f7d7
incl %ebx
cmpl $0x3, %ebx
jne 0x5f7cf
leaq 0x90(%rsp), %rdi
leaq 0x2c8(%rsp), %rsi
callq 0x5b599
movq 0x240(%rsp), %rbx
leaq 0x2c8(%rsp), %rdi
movq 0x108(%rsp), %rsi
callq 0x5de56
movq %rbx, %rdi
callq 0x514f4
leaq 0x2c8(%rsp), %rdi
movq %rbx, %rsi
callq 0x528f4
movupd 0x2d0(%rsp), %xmm0
movupd 0x2e0(%rsp), %xmm1
movupd 0x2f0(%rsp), %xmm2
movupd %xmm0, 0x8(%rbx)
movupd %xmm1, 0x18(%rbx)
movupd %xmm2, 0x28(%rbx)
movq %rbx, %rdi
callq 0x521f4
movq 0x90(%rsp), %rdi
testq %rdi, %rdi
je 0x5f91d
movq 0xa0(%rsp), %rsi
subq %rdi, %rsi
callq 0x4470
movq 0x110(%rsp), %rdi
testq %rdi, %rdi
je 0x5f962
movq 0x130(%rsp), %rsi
subq %rdi, %rsi
callq 0x4470
xorl %eax, %eax
movq %rax, 0x110(%rsp)
movl %eax, 0x118(%rsp)
movq %rax, 0x120(%rsp)
movl %eax, 0x128(%rsp)
movq %rax, 0x130(%rsp)
movq 0x1c0(%rsp), %rdi
testq %rdi, %rdi
je 0x5f97f
movq 0x1d0(%rsp), %rsi
subq %rdi, %rsi
callq 0x4470
movq 0x1e0(%rsp), %rdi
testq %rdi, %rdi
je 0x5f99c
movq 0x1f0(%rsp), %rsi
subq %rdi, %rsi
callq 0x4470
movq 0x200(%rsp), %rdi
testq %rdi, %rdi
je 0x5f9b9
movq 0x210(%rsp), %rsi
subq %rdi, %rsi
callq 0x4470
movq 0x220(%rsp), %rdi
testq %rdi, %rdi
je 0x5f9d6
movq 0x230(%rsp), %rsi
subq %rdi, %rsi
callq 0x4470
movq 0xb0(%rsp), %rdi
testq %rdi, %rdi
je 0x5f9f3
movq 0xc0(%rsp), %rsi
subq %rdi, %rsi
callq 0x4470
movq 0xd0(%rsp), %rdi
testq %rdi, %rdi
je 0x5fa10
movq 0xe0(%rsp), %rsi
subq %rdi, %rsi
callq 0x4470
movq 0x250(%rsp), %rdi
testq %rdi, %rdi
je 0x5fa2d
movq 0x260(%rsp), %rsi
subq %rdi, %rsi
callq 0x4470
movq 0x270(%rsp), %rdi
testq %rdi, %rdi
je 0x5fa4a
movq 0x280(%rsp), %rsi
subq %rdi, %rsi
callq 0x4470
movq 0x290(%rsp), %rdi
testq %rdi, %rdi
je 0x5fa67
movq 0x2a0(%rsp), %rsi
subq %rdi, %rsi
callq 0x4470
movq 0x2b0(%rsp), %rdi
testq %rdi, %rdi
je 0x5fa84
movq 0x2c0(%rsp), %rsi
subq %rdi, %rsi
callq 0x4470
movq 0x138(%rsp), %rdi
testq %rdi, %rdi
je 0x5fac9
movq 0x158(%rsp), %rsi
subq %rdi, %rsi
callq 0x4470
xorl %eax, %eax
movq %rax, 0x138(%rsp)
movl %eax, 0x140(%rsp)
movq %rax, 0x148(%rsp)
movl %eax, 0x150(%rsp)
movq %rax, 0x158(%rsp)
movq 0x160(%rsp), %rdi
testq %rdi, %rdi
je 0x5fb0e
movq 0x180(%rsp), %rsi
subq %rdi, %rsi
callq 0x4470
xorl %eax, %eax
movq %rax, 0x160(%rsp)
movl %eax, 0x168(%rsp)
movq %rax, 0x170(%rsp)
movl %eax, 0x178(%rsp)
movq %rax, 0x180(%rsp)
movq 0x188(%rsp), %rdi
testq %rdi, %rdi
je 0x5fb53
movq 0x1a8(%rsp), %rsi
subq %rdi, %rsi
callq 0x4470
xorl %eax, %eax
movq %rax, 0x188(%rsp)
movl %eax, 0x190(%rsp)
movq %rax, 0x198(%rsp)
movl %eax, 0x1a0(%rsp)
movq %rax, 0x1a8(%rsp)
leaq 0x2c8(%rsp), %rdi
callq 0xec14
movq %rbx, %rax
addq $0x728, %rsp            # imm = 0x728
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0xefb29(%rip), %rdi     # 0x14f6a5
movq %r12, %rsi
xorl %eax, %eax
callq 0x4630
leaq 0xefb18(%rip), %rdi     # 0x14f6a5
movq %rbp, %rsi
xorl %eax, %eax
callq 0x4630
leaq 0xf6404(%rip), %rdi     # 0x155fa2
callq 0x4660
jmp 0x5fbb5
leaq 0xf5911(%rip), %rdi     # 0x1554bd
movl %ebp, %esi
xorl %eax, %eax
callq 0x4060
movl $0x1, %edi
callq 0x710c
jmp 0x5fbea
jmp 0x5fbea
jmp 0x5fbea
jmp 0x5fbea
jmp 0x5fbea
jmp 0x5fbea
jmp 0x5fbea
movq %rax, %r14
movq %rbx, %rdi
callq 0xec14
jmp 0x5fc0a
jmp 0x5fc07
jmp 0x5fbea
jmp 0x5fbea
jmp 0x5fbea
movq %rax, %r14
jmp 0x5fd8e
movq %rax, %r14
jmp 0x5fc27
jmp 0x5fbf5
jmp 0x5fbf5
jmp 0x5fbf5
movq %rax, %r14
jmp 0x5fdd3
movq %rax, %r14
jmp 0x5fe18
jmp 0x5fc07
movq %rax, %r14
movq 0x90(%rsp), %rdi
testq %rdi, %rdi
je 0x5fc27
movq 0xa0(%rsp), %rsi
subq %rdi, %rsi
callq 0x4470
movq 0x110(%rsp), %rdi
testq %rdi, %rdi
je 0x5fc6c
movq 0x130(%rsp), %rsi
subq %rdi, %rsi
callq 0x4470
xorl %eax, %eax
movq %rax, 0x110(%rsp)
movl %eax, 0x118(%rsp)
movq %rax, 0x120(%rsp)
movl %eax, 0x128(%rsp)
movq %rax, 0x130(%rsp)
movq 0x1c0(%rsp), %rdi
testq %rdi, %rdi
je 0x5fc89
movq 0x1d0(%rsp), %rsi
subq %rdi, %rsi
callq 0x4470
movq 0x1e0(%rsp), %rdi
testq %rdi, %rdi
je 0x5fca6
movq 0x1f0(%rsp), %rsi
subq %rdi, %rsi
callq 0x4470
movq 0x200(%rsp), %rdi
testq %rdi, %rdi
je 0x5fcc3
movq 0x210(%rsp), %rsi
subq %rdi, %rsi
callq 0x4470
movq 0x220(%rsp), %rdi
testq %rdi, %rdi
je 0x5fce0
movq 0x230(%rsp), %rsi
subq %rdi, %rsi
callq 0x4470
movq 0xb0(%rsp), %rdi
testq %rdi, %rdi
je 0x5fcfd
movq 0xc0(%rsp), %rsi
subq %rdi, %rsi
callq 0x4470
movq 0xd0(%rsp), %rdi
testq %rdi, %rdi
je 0x5fd1a
movq 0xe0(%rsp), %rsi
subq %rdi, %rsi
callq 0x4470
movq 0x250(%rsp), %rdi
testq %rdi, %rdi
je 0x5fd37
movq 0x260(%rsp), %rsi
subq %rdi, %rsi
callq 0x4470
movq 0x270(%rsp), %rdi
testq %rdi, %rdi
je 0x5fd54
movq 0x280(%rsp), %rsi
subq %rdi, %rsi
callq 0x4470
movq 0x290(%rsp), %rdi
testq %rdi, %rdi
je 0x5fd71
movq 0x2a0(%rsp), %rsi
subq %rdi, %rsi
callq 0x4470
movq 0x2b0(%rsp), %rdi
testq %rdi, %rdi
je 0x5fd8e
movq 0x2c0(%rsp), %rsi
subq %rdi, %rsi
callq 0x4470
movq 0x138(%rsp), %rdi
testq %rdi, %rdi
je 0x5fdd3
movq 0x158(%rsp), %rsi
subq %rdi, %rsi
callq 0x4470
xorl %eax, %eax
movq %rax, 0x138(%rsp)
movl %eax, 0x140(%rsp)
movq %rax, 0x148(%rsp)
movl %eax, 0x150(%rsp)
movq %rax, 0x158(%rsp)
movq 0x160(%rsp), %rdi
testq %rdi, %rdi
je 0x5fe18
movq 0x180(%rsp), %rsi
subq %rdi, %rsi
callq 0x4470
xorl %eax, %eax
movq %rax, 0x160(%rsp)
movl %eax, 0x168(%rsp)
movq %rax, 0x170(%rsp)
movl %eax, 0x178(%rsp)
movq %rax, 0x180(%rsp)
movq 0x188(%rsp), %rdi
testq %rdi, %rdi
je 0x5fe5d
movq 0x1a8(%rsp), %rsi
subq %rdi, %rsi
callq 0x4470
xorl %eax, %eax
movq %rax, 0x188(%rsp)
movl %eax, 0x190(%rsp)
movq %rax, 0x198(%rsp)
movl %eax, 0x1a0(%rsp)
movq %rax, 0x1a8(%rsp)
leaq 0x2c8(%rsp), %rdi
callq 0xec14
movq %r14, %rdi
callq 0x4780