// File: /workspace/github_cpp_makefile_star2_O1/Luthaf[P]zeopp/networkstorage.cc
// Function: place_molecule(std::vector<MOLECULE, std::allocator<MOLECULE>>*, std::vector<CONNECTION, std::allocator<CONNECTION>>*, ATOM_NETWORK*, std::vector<bool, std::allocator<bool>>*, std::vector<bool, std::allocator<bool>>*, std::vector<MOLECULE, std::allocator<MOLECULE>>*, int, double*)
int place_molecule(vector<MOLECULE> *molecules, vector<CONNECTION> *two_way_connections, ATOM_NETWORK *cell, vector<bool> *placed, vector<bool> *connected, vector<MOLECULE> *framework, int num_placed, double *sum_edge_lengths) {
  bool verbose = false;
  //1) if no molecules have been placed yet, just fix the first one in position with its first edge at the origin
  if(num_placed==0) {
if(verbose) printf("DEBUG: detected that no molecules have yet been placed - positioning first molecule with first edge at the origin\n");
    int v_index = two_way_connections->at(0).v1;
    int e_index = two_way_connections->at(0).e1;
    MOLECULE placing = molecules->at(v_index);
    int site_index = placing.permutation.at(e_index);
    int atom_index = placing.sites.at(site_index);
    XYZ site = placing.atoms_xyz.at(atom_index);
    XYZ shift = site.scale(-1);
if(verbose) printf("DEBUG: v=%d, e=%d; site=%.3f %.3f %.3f; shift=%.3f %.3f %.3f\n", v_index, e_index, site.x, site.y, site.z, shift.x, shift.y, shift.z);
    framework->at(v_index) = (translate(placing, shift));
    placed->at(v_index) = true;
    return num_placed+1;
  }
  //2) otherwise, need to find a new molecule to place
if(verbose) printf("DEBUG: detected that %d molecules have already been placed\n", num_placed);
  int num_molecules = molecules->size();
  int num_connections = two_way_connections->size();
  int molecule_index = -1;
  for(int i=0; i<num_molecules && molecule_index==-1; i++) {
    if(!placed->at(i)) { //if this molecule has not yet been placed - it is a candidate for placement, but we must have an adjacent molecule already placed which we can attach it to
      int connection_index = -1;
      for(int j=0; j<num_connections && connection_index==-1; j++) { //is there any two way connection which connects this new molecule and any previously placed one?
        if(!connected->at(j)) { //if this connection was already made, we don't need to check it again
          CONNECTION c = two_way_connections->at(j);
          int placing_edge_index = -1, fixed_edge_index = -1;
          int placing_vertex_index = -1, fixed_vertex_index = -1;
          if(c.v1==i) { //vertex 1 in this connection is the molecule we are placing
            if(placed->at(c.v2)) { //vertex 2 in this connection is a molecule which has already been placed
              placing_edge_index = c.e1;
              fixed_edge_index = c.e2;
              placing_vertex_index = c.v1;
              fixed_vertex_index = c.v2;
            }
          } else if(c.v2==i) { //vertex 2 in this connection is the molecule we are placing
            if(placed->at(c.v1)) { //vertex 1 in this connection is a molecule which has already been placed
              placing_edge_index = c.e2;
              fixed_edge_index = c.e1;
              placing_vertex_index = c.v2;
              fixed_vertex_index = c.v1;
            }
          }
          if(fixed_edge_index!=-1 && placing_edge_index!=-1 && fixed_vertex_index!=-1 && placing_vertex_index!=-1) { //this connection connects this molecule and a fixed molecule, and we have stored the relevant edge and vertex indices - we can proceed to place this molecule!
if(verbose) printf("DEBUG: found that new vertex %d edge %d is connected to fixed vertex %d edge %d\n", placing_vertex_index, placing_edge_index, fixed_vertex_index, fixed_edge_index);
            MOLECULE placing = molecules->at(placing_vertex_index);
            int placing_site_index = placing.permutation.at(placing_edge_index);
            int placing_atom_index = placing.sites.at(placing_site_index);
            MOLECULE fixed = framework->at(fixed_vertex_index);
            int fixed_site_index = fixed.permutation.at(fixed_edge_index);
            int fixed_atom_index = fixed.sites.at(fixed_site_index);
if(verbose) printf("DEBUG: %s in placing connecting to %s in fixed\n", placing.atoms_type.at(placing_atom_index).c_str(), fixed.atoms_type.at(fixed_atom_index).c_str());
            if(placing.atoms_type.at(placing_atom_index)!=fixed.atoms_type.at(fixed_atom_index)) {//only make the connection if the sites are the same type!
if(verbose) printf("DEBUG: trying to connect conflicting connection sites - aborting construction attempt\n");
              return num_placed;
            }
//if(1) exit(1);
            XYZ placing_site = placing.atoms_xyz.at(placing_atom_index);
            XYZ fixed_site = fixed.atoms_xyz.at(fixed_atom_index);
            XYZ shift = fixed_site-placing_site;
if(verbose) printf("DEBUG: site index in fixed = %d, site_index in placing = %d\n", fixed_site_index, placing_site_index);
if(verbose) printf("DEBUG: fixed_site=%.3f %.3f %.3f; placing_site=%.3f %.3f %.3f; shift=%.3f %.3f %.3f\n", fixed_site.x, fixed_site.y, fixed_site.z, placing_site.x, placing_site.y, placing_site.z, shift.x, shift.y, shift.z);
            framework->at(placing_vertex_index) = (translate(placing, shift));
            placed->at(placing_vertex_index) = true; //record this new vertex as now being fixed in place
            connected->at(j) = true; //record that this connection was used
            double com_dist = (fixed.com - framework->at(placing_vertex_index).com).magnitude();
if(verbose) printf("DEBUG: made a connection indicating a topological edge length of %.3f\n", com_dist);
            XYZ start_abc = cell->vertices.at(fixed_vertex_index).abc;
            XYZ end_abc = cell->vertices.at(fixed_vertex_index).edges.at(fixed_edge_index);
if(verbose) printf("\tDEBUG: this edge in the underlying net goes from fractional %.3f %.3f %.3f to fractional %.3f %.3f %.3f\n", start_abc.x, start_abc.y, start_abc.z, end_abc.x, end_abc.y, end_abc.z);
            XYZ shift_abc = end_abc-start_abc;
            XYZ shift_xyz = framework->at(placing_vertex_index).com-fixed.com;
if(verbose) printf("\tDEBUG: this edge in the underlying net had a fractional shift %.3f %.3f %.3f; here we observe a cartesian shift %.3f %.3f %.3f\n", shift_abc.x, shift_abc.y, shift_abc.z, shift_xyz.x, shift_xyz.y, shift_xyz.z);
            XYZ unit_cell_parameter_suggestion(shift_xyz.x/shift_abc.x, shift_xyz.y/shift_abc.y, shift_xyz.z/shift_abc.z);
if(verbose) printf("\tDEBUG: suggests unit cell dimensions %.3f %.3f %.3f\n", unit_cell_parameter_suggestion.x, unit_cell_parameter_suggestion.y, unit_cell_parameter_suggestion.z);
            (*sum_edge_lengths)+=com_dist;
            return num_placed+1;
          }
        }
      }
      if(connection_index==-1) {
if(verbose) printf("DEBUG: could not find any connection between vertex %d and any fixed vertex\n", i);
      }
    }
  }
  printf("WARNING: could not find a molecule which has not been placed and which is adjacent to an already placed molecule - this may happen if the net is interpenetrated (not currently handled with the connection-based alignment method)\n");
  return num_placed;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x4d8, %rsp            # imm = 0x4D8
movq %r9, 0x60(%rsp)
movq %rcx, 0x68(%rsp)
movq %rdx, 0xc8(%rsp)
movq %rsi, %r15
movl 0x510(%rsp), %eax
testl %eax, %eax
je 0x5af31
movq 0x8(%rdi), %rbx
subq (%rdi), %rbx
sarq $0x3, %rbx
movabsq $-0x30c30c30c30c30c3, %rax # imm = 0xCF3CF3CF3CF3CF3D
imulq %rax, %rbx
testl %ebx, %ebx
setg 0x27(%rsp)
jle 0x5b38b
movq %r8, %r14
movq %rdi, 0xe8(%rsp)
movq 0x8(%r15), %rcx
subq (%r15), %rcx
sarq $0x2, %rcx
movabsq $0x6db6db6db6db6db7, %rax # imm = 0x6DB6DB6DB6DB6DB7
imulq %rax, %rcx
testl %ecx, %ecx
setg 0x26(%rsp)
movl $0x90, %edx
leaq 0x260(%rsp), %rax
addq %rdx, %rax
movq %rax, 0xb0(%rsp)
movl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
andq %rax, %rbx
movq %rcx, %r12
andq %rax, %r12
leaq 0x1b8(%rsp), %rax
addq %rax, %rdx
movq %rdx, 0x80(%rsp)
movl 0x510(%rsp), %eax
incl %eax
movl %eax, 0x7c(%rsp)
movq %rcx, 0xc0(%rsp)
movslq %ecx, %r13
xorl %esi, %esi
movq %r15, 0x108(%rsp)
movq %r12, 0x100(%rsp)
movq %r13, 0xf8(%rsp)
movq %rbx, 0xb8(%rsp)
movq %r8, 0xe0(%rsp)
movq 0x68(%rsp), %rdi
movq %rsi, 0x70(%rsp)
callq 0xedb6
testq %rdx, (%rax)
je 0x5a4ff
movq 0x70(%rsp), %rsi
jmp 0x5af1b
cmpl $0x0, 0xc0(%rsp)
jle 0x5aefb
movl $0xc, %ebp
xorl %ebx, %ebx
movb 0x26(%rsp), %al
movb %al, 0x38(%rsp)
movq %r14, %rdi
movq %rbx, %rsi
callq 0xedb6
testq %rdx, (%rax)
jne 0x5aee1
movq (%r15), %rax
movq 0x8(%r15), %rdx
subq %rax, %rdx
sarq $0x2, %rdx
movabsq $0x6db6db6db6db6db7, %rcx # imm = 0x6DB6DB6DB6DB6DB7
imulq %rcx, %rdx
cmpq %rbx, %rdx
jbe 0x5b3bb
movq %rbp, %rcx
movl -0xc(%rax,%rbp), %ebp
movl -0x8(%rax,%rcx), %r12d
movl -0x4(%rax,%rcx), %r13d
movq %rcx, 0x88(%rsp)
movl (%rax,%rcx), %ecx
movq 0x70(%rsp), %rax
cmpq %rbp, %rax
jne 0x5a59f
movl %ecx, 0x28(%rsp)
movslq %r12d, %rsi
movq 0x68(%rsp), %rdi
callq 0xedb6
testq %rdx, (%rax)
je 0x5a5e6
movl %r13d, %r15d
movl 0x28(%rsp), %esi
movl %ebp, %ecx
movl %r12d, %r13d
jmp 0x5a5fc
movl $0xffffffff, %r15d      # imm = 0xFFFFFFFF
cmpq %r12, %rax
jne 0x5a5ec
movl %ecx, 0x28(%rsp)
movl %r13d, 0x34(%rsp)
movslq %ebp, %rsi
movq 0x68(%rsp), %rdi
callq 0xedb6
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
movl $0xffffffff, %ecx       # imm = 0xFFFFFFFF
movl $0xffffffff, %r13d      # imm = 0xFFFFFFFF
testq %rdx, (%rax)
je 0x5a5fc
movl 0x28(%rsp), %r15d
movl 0x34(%rsp), %esi
movl %r12d, %ecx
movl %ebp, %r13d
jmp 0x5a5fc
movl $0xffffffff, %r15d      # imm = 0xFFFFFFFF
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
movl $0xffffffff, %ecx       # imm = 0xFFFFFFFF
movl $0xffffffff, %r13d      # imm = 0xFFFFFFFF
cmpl $-0x1, %esi
sete %al
cmpl $-0x1, %r15d
sete %dl
orb %al, %dl
cmpl $-0x1, %r13d
sete %al
cmpl $-0x1, %ecx
sete %r12b
orb %al, %r12b
orb %dl, %r12b
movq 0x88(%rsp), %rbp
jne 0x5aec4
movl %esi, %r14d
movslq %ecx, %rcx
movq 0xe8(%rsp), %rax
movq (%rax), %rsi
movq 0x8(%rax), %rdx
subq %rsi, %rdx
sarq $0x3, %rdx
movabsq $-0x30c30c30c30c30c3, %rax # imm = 0xCF3CF3CF3CF3CF3D
imulq %rax, %rdx
movq %rcx, %rax
cmpq %rcx, %rdx
jbe 0x5b3d5
movq %rax, 0x28(%rsp)
imulq $0xa8, %rax, %rcx
movq %rcx, 0x58(%rsp)
addq %rcx, %rsi
leaq 0x110(%rsp), %rdi
callq 0x67f48
movslq %r15d, %rsi
movq 0x188(%rsp), %rax
movq 0x190(%rsp), %rdx
subq %rax, %rdx
sarq $0x2, %rdx
cmpq %rsi, %rdx
jbe 0x5b3c7
movslq (%rax,%rsi,4), %rsi
movq 0x158(%rsp), %rcx
movq 0x160(%rsp), %rdx
subq %rcx, %rdx
sarq $0x2, %rdx
cmpq %rsi, %rdx
jbe 0x5b408
movslq %r13d, %r13
movq 0x60(%rsp), %rdx
movq (%rdx), %rax
movq 0x8(%rdx), %rdx
subq %rax, %rdx
sarq $0x3, %rdx
movabsq $-0x30c30c30c30c30c3, %rdi # imm = 0xCF3CF3CF3CF3CF3D
imulq %rdi, %rdx
cmpq %r13, %rdx
jbe 0x5b416
movslq (%rcx,%rsi,4), %r15
imulq $0xa8, %r13, %rcx
addq %rcx, %rax
leaq 0x1b8(%rsp), %rdi
movq %rax, %rsi
callq 0x67f48
movb %r12b, 0x34(%rsp)
movslq %r14d, %rsi
movq 0x230(%rsp), %rax
movq 0x238(%rsp), %rdx
subq %rax, %rdx
sarq $0x2, %rdx
cmpq %rsi, %rdx
jbe 0x5b3e6
movq %rsi, 0xf0(%rsp)
movslq (%rax,%rsi,4), %r12
movq 0x200(%rsp), %rcx
movq 0x208(%rsp), %rdx
subq %rcx, %rdx
sarq $0x2, %rdx
cmpq %r12, %rdx
movq 0xe0(%rsp), %r14
jbe 0x5b3f7
movq 0x128(%rsp), %rax
movq 0x130(%rsp), %rdx
subq %rax, %rdx
sarq $0x5, %rdx
cmpq %r15, %rdx
jbe 0x5b3f4
movslq (%rcx,%r12,4), %r12
movq 0x1d0(%rsp), %rcx
movq 0x1d8(%rsp), %rdx
subq %rcx, %rdx
sarq $0x5, %rdx
cmpq %r12, %rdx
jbe 0x5b3f7
movq %r15, %rdx
shlq $0x5, %rdx
addq %rdx, %rax
movq %r12, %rsi
shlq $0x5, %rsi
movq 0x8(%rax), %rdx
movl 0x510(%rsp), %edi
cmpq 0x8(%rcx,%rsi), %rdx
jne 0x5ad9f
testq %rdx, %rdx
je 0x5a801
addq %rsi, %rcx
movq (%rcx), %rsi
movq (%rax), %rdi
callq 0x4480
movl 0x510(%rsp), %ecx
movl %ecx, %edi
testl %eax, %eax
jne 0x5ad9f
movq 0x110(%rsp), %rax
movq 0x118(%rsp), %rdx
subq %rax, %rdx
sarq $0x3, %rdx
movabsq $-0x5555555555555555, %rsi # imm = 0xAAAAAAAAAAAAAAAB
imulq %rsi, %rdx
cmpq %r15, %rdx
jbe 0x5b45b
leaq (%r15,%r15,2), %rcx
movq 0x10(%rax,%rcx,8), %rdx
movq %rdx, 0xa0(%rsp)
movupd (%rax,%rcx,8), %xmm0
movapd %xmm0, 0x90(%rsp)
movq 0x1b8(%rsp), %rax
movq 0x1c0(%rsp), %rdx
subq %rax, %rdx
sarq $0x3, %rdx
imulq %rsi, %rdx
cmpq %r12, %rdx
jbe 0x5b46c
leaq (%r12,%r12,2), %rcx
movq 0x10(%rax,%rcx,8), %rdx
movq %rdx, 0x350(%rsp)
movupd (%rax,%rcx,8), %xmm0
movapd %xmm0, 0x340(%rsp)
leaq 0x358(%rsp), %rdi
leaq 0x340(%rsp), %rsi
leaq 0x90(%rsp), %rdx
callq 0x85da6
leaq 0x260(%rsp), %r15
leaq 0x370(%rsp), %r12
movq %r12, %rdi
leaq 0x110(%rsp), %rsi
callq 0x67f48
movq 0x368(%rsp), %rax
movq %rax, 0x10(%rsp)
movupd 0x358(%rsp), %xmm0
movupd %xmm0, (%rsp)
movq %r15, %rdi
movq %r12, %rsi
callq 0x9f6e4
movq %r13, 0xd8(%rsp)
movq 0x60(%rsp), %rax
movq (%rax), %r12
movq 0x8(%rax), %rdx
subq %r12, %rdx
sarq $0x3, %rdx
movabsq $-0x30c30c30c30c30c3, %rax # imm = 0xCF3CF3CF3CF3CF3D
imulq %rax, %rdx
cmpq 0x28(%rsp), %rdx
jbe 0x5b435
movq 0x58(%rsp), %r13
leaq (%r12,%r13), %rdi
movq %r15, %rsi
callq 0x6839c
xorl %eax, %eax
movq %rax, 0x50(%rsp)
xorpd %xmm0, %xmm0
movapd %xmm0, 0x40(%rsp)
leaq (%r12,%r13), %r15
addq $0x48, %r15
movq -0x30(%r15), %rax
movups -0x28(%r15), %xmm0
movq 0x278(%rsp), %rcx
movq %rcx, -0x30(%r15)
movq 0x280(%rsp), %rcx
movq %rcx, -0x28(%r15)
movq 0x288(%rsp), %rcx
movq %rcx, -0x20(%r15)
movq 0x40(%rsp), %rcx
movq 0x48(%rsp), %rdx
movq 0x50(%rsp), %rsi
movq %rax, 0x40(%rsp)
movups %xmm0, 0x48(%rsp)
movq %rcx, 0x278(%rsp)
movq %rdx, 0x280(%rsp)
movq %rsi, 0x288(%rsp)
leaq 0x40(%rsp), %rbp
movq %rbp, %rdi
callq 0x2f6f0
xorl %eax, %eax
movq %rax, 0x50(%rsp)
xorps %xmm0, %xmm0
movaps %xmm0, 0x40(%rsp)
movq -0x18(%r15), %rax
movups -0x10(%r15), %xmm0
movq 0x290(%rsp), %rcx
movq %rcx, -0x18(%r15)
movq 0x298(%rsp), %rcx
movq %rcx, -0x10(%r15)
movq 0x2a0(%rsp), %rcx
movq %rcx, -0x8(%r15)
movq 0x40(%rsp), %rcx
movq 0x48(%rsp), %rdx
movq 0x50(%rsp), %rsi
movq %rax, 0x40(%rsp)
movups %xmm0, 0x48(%rsp)
movq %rcx, 0x290(%rsp)
movq %rdx, 0x298(%rsp)
movq %rsi, 0x2a0(%rsp)
movq %rbp, %rdi
callq 0x2f6f0
movq %r15, %rdi
leaq 0x2a8(%rsp), %rsi
callq 0x12d52
leaq (%r12,%r13), %rdi
addq $0x60, %rdi
leaq 0x2c0(%rsp), %rsi
callq 0x12d52
leaq (%r12,%r13), %r15
addq $0x78, %r15
movq %r15, %rdi
leaq 0x2d8(%rsp), %rsi
callq 0x12d52
movq 0xb0(%rsp), %rcx
movq 0x10(%rcx), %rax
movq %rax, 0x28(%r15)
movupd (%rcx), %xmm0
movupd %xmm0, 0x18(%r15)
movq 0x2d8(%rsp), %rdi
testq %rdi, %rdi
je 0x5aaa6
movq 0x2e8(%rsp), %rsi
subq %rdi, %rsi
callq 0x4470
movq 0x2c0(%rsp), %rdi
testq %rdi, %rdi
movabsq $-0x5555555555555555, %r12 # imm = 0xAAAAAAAAAAAAAAAB
movq 0xd8(%rsp), %r13
je 0x5aad5
movq 0x2d0(%rsp), %rsi
subq %rdi, %rsi
callq 0x4470
movq 0x2a8(%rsp), %rdi
testq %rdi, %rdi
leaq 0x260(%rsp), %r15
movq 0x88(%rsp), %rbp
je 0x5ab02
movq 0x2b8(%rsp), %rsi
subq %rdi, %rsi
callq 0x4470
leaq 0x290(%rsp), %rdi
callq 0x2f6f0
leaq 0x278(%rsp), %rdi
callq 0x2f6f0
movq 0x260(%rsp), %rdi
testq %rdi, %rdi
je 0x5ab39
movq 0x270(%rsp), %rsi
subq %rdi, %rsi
callq 0x4470
movq 0x3e8(%rsp), %rdi
testq %rdi, %rdi
je 0x5ab56
movq 0x3f8(%rsp), %rsi
subq %rdi, %rsi
callq 0x4470
movq 0x3d0(%rsp), %rdi
testq %rdi, %rdi
je 0x5ab73
movq 0x3e0(%rsp), %rsi
subq %rdi, %rsi
callq 0x4470
movq 0x3b8(%rsp), %rdi
testq %rdi, %rdi
je 0x5ab90
movq 0x3c8(%rsp), %rsi
subq %rdi, %rsi
callq 0x4470
leaq 0x3a0(%rsp), %rdi
callq 0x2f6f0
leaq 0x388(%rsp), %rdi
callq 0x2f6f0
movq 0x370(%rsp), %rdi
testq %rdi, %rdi
je 0x5abc7
movq 0x380(%rsp), %rsi
subq %rdi, %rsi
callq 0x4470
movq 0x68(%rsp), %rdi
movq 0x28(%rsp), %rsi
callq 0xedb6
orq %rdx, (%rax)
movq %r14, %rdi
movq %rbx, %rsi
callq 0xedb6
orq %rdx, (%rax)
movq 0x60(%rsp), %rcx
movq (%rcx), %rax
movq 0x8(%rcx), %rdx
subq %rax, %rdx
sarq $0x3, %rdx
movabsq $-0x30c30c30c30c30c3, %rcx # imm = 0xCF3CF3CF3CF3CF3D
imulq %rcx, %rdx
cmpq 0x28(%rsp), %rdx
jbe 0x5b448
movq 0x58(%rsp), %rcx
leaq (%rax,%rcx), %rdx
addq $0x90, %rdx
movq %r15, %rdi
movq 0x80(%rsp), %rsi
callq 0x85da6
movq %r15, %rdi
callq 0x84e36
movq 0xc8(%rsp), %rcx
movq 0x3c0(%rcx), %rax
movq 0x3c8(%rcx), %rdx
subq %rax, %rdx
sarq $0x4, %rdx
movabsq $0x6db6db6db6db6db7, %rcx # imm = 0x6DB6DB6DB6DB6DB7
imulq %rcx, %rdx
cmpq %r13, %rdx
jbe 0x5b47d
movsd %xmm0, 0xd0(%rsp)
imulq $0x70, %r13, %rdx
movq 0x10(%rax,%rdx), %rcx
movq %rcx, 0x270(%rsp)
movupd (%rax,%rdx), %xmm0
movapd %xmm0, 0x260(%rsp)
movq 0x20(%rax,%rdx), %rcx
movq 0x28(%rax,%rdx), %rdx
subq %rcx, %rdx
sarq $0x3, %rdx
imulq %r12, %rdx
movq 0xf0(%rsp), %rsi
cmpq %rsi, %rdx
jbe 0x5b48e
leaq (%rsi,%rsi,2), %rax
movq 0x10(%rcx,%rax,8), %rdx
movq %rdx, 0x50(%rsp)
movupd (%rcx,%rax,8), %xmm0
movapd %xmm0, 0x40(%rsp)
leaq 0x328(%rsp), %rdi
leaq 0x40(%rsp), %rsi
movq %r15, %rdx
callq 0x85da6
movq 0x60(%rsp), %rcx
movq (%rcx), %rax
movq 0x8(%rcx), %rdx
subq %rax, %rdx
sarq $0x3, %rdx
movabsq $-0x30c30c30c30c30c3, %rcx # imm = 0xCF3CF3CF3CF3CF3D
imulq %rcx, %rdx
movq 0x28(%rsp), %rsi
cmpq %rsi, %rdx
jbe 0x5b427
movq 0x58(%rsp), %rcx
leaq (%rax,%rcx), %rsi
addq $0x90, %rsi
leaq 0x310(%rsp), %rdi
movq 0x80(%rsp), %rdx
callq 0x85da6
movsd 0x310(%rsp), %xmm0
movsd 0x318(%rsp), %xmm1
divsd 0x328(%rsp), %xmm0
divsd 0x330(%rsp), %xmm1
movsd 0x320(%rsp), %xmm2
divsd 0x338(%rsp), %xmm2
leaq 0x4c0(%rsp), %rdi
callq 0x85982
movq 0x518(%rsp), %rax
movsd 0xd0(%rsp), %xmm0
addsd (%rax), %xmm0
movsd %xmm0, (%rax)
movl 0x7c(%rsp), %edi
movl %edi, 0x58(%rsp)
movq 0x230(%rsp), %rdi
testq %rdi, %rdi
je 0x5adc0
movq 0x240(%rsp), %rsi
subq %rdi, %rsi
callq 0x4470
movq 0x218(%rsp), %rdi
testq %rdi, %rdi
movb 0x34(%rsp), %r12b
je 0x5ade2
movq 0x228(%rsp), %rsi
subq %rdi, %rsi
callq 0x4470
movq 0x200(%rsp), %rdi
testq %rdi, %rdi
je 0x5adff
movq 0x210(%rsp), %rsi
subq %rdi, %rsi
callq 0x4470
leaq 0x1e8(%rsp), %rdi
callq 0x2f6f0
leaq 0x1d0(%rsp), %rdi
callq 0x2f6f0
movq 0x1b8(%rsp), %rdi
testq %rdi, %rdi
je 0x5ae36
movq 0x1c8(%rsp), %rsi
subq %rdi, %rsi
callq 0x4470
movq 0x188(%rsp), %rdi
testq %rdi, %rdi
je 0x5ae53
movq 0x198(%rsp), %rsi
subq %rdi, %rsi
callq 0x4470
movq 0x170(%rsp), %rdi
testq %rdi, %rdi
je 0x5ae70
movq 0x180(%rsp), %rsi
subq %rdi, %rsi
callq 0x4470
movq 0x158(%rsp), %rdi
testq %rdi, %rdi
je 0x5ae8d
movq 0x168(%rsp), %rsi
subq %rdi, %rsi
callq 0x4470
leaq 0x140(%rsp), %rdi
callq 0x2f6f0
leaq 0x128(%rsp), %rdi
callq 0x2f6f0
movq 0x110(%rsp), %rdi
testq %rdi, %rdi
je 0x5aec4
movq 0x120(%rsp), %rsi
subq %rdi, %rsi
callq 0x4470
testb %r12b, %r12b
movq 0x108(%rsp), %r15
movq 0x100(%rsp), %r12
movq 0xf8(%rsp), %r13
je 0x5af03
incq %rbx
cmpq %r13, %rbx
setl 0x38(%rsp)
addq $0x1c, %rbp
cmpq %rbx, %r12
jne 0x5a51c
jmp 0x5af03
movb 0x26(%rsp), %al
movb %al, 0x38(%rsp)
testb $0x1, 0x38(%rsp)
movq 0xb8(%rsp), %rbx
movq 0x70(%rsp), %rsi
jne 0x5b38b
incq %rsi
cmpq %rbx, %rsi
setb 0x27(%rsp)
jne 0x5a4e1
jmp 0x5b38b
movq (%r15), %rax
movq 0x8(%r15), %rcx
subq %rax, %rcx
je 0x5b49c
movslq (%rax), %rbx
movq (%rdi), %rsi
movq 0x8(%rdi), %rdx
subq %rsi, %rdx
sarq $0x3, %rdx
movabsq $-0x30c30c30c30c30c3, %r12 # imm = 0xCF3CF3CF3CF3CF3D
imulq %r12, %rdx
cmpq %rbx, %rdx
jbe 0x5b3bb
movslq 0x8(%rax), %r14
imulq $0xa8, %rbx, %r13
addq %r13, %rsi
leaq 0x110(%rsp), %r15
movq %r15, %rdi
callq 0x67f48
movq 0x78(%r15), %rax
movq 0x80(%r15), %rdx
subq %rax, %rdx
sarq $0x2, %rdx
cmpq %r14, %rdx
jbe 0x5b4bc
movslq (%rax,%r14,4), %rsi
movq 0x158(%rsp), %rax
movq 0x160(%rsp), %rdx
subq %rax, %rdx
sarq $0x2, %rdx
cmpq %rsi, %rdx
jbe 0x5b4cd
movslq (%rax,%rsi,4), %rsi
movq 0x110(%rsp), %rax
movq 0x118(%rsp), %rcx
subq %rax, %rcx
sarq $0x3, %rcx
movabsq $-0x5555555555555555, %rdx # imm = 0xAAAAAAAAAAAAAAAB
imulq %rcx, %rdx
cmpq %rsi, %rdx
jbe 0x5b4db
leaq (%rsi,%rsi,2), %rcx
movq 0x10(%rax,%rcx,8), %rdx
leaq 0x40(%rsp), %rsi
movq %rdx, 0x10(%rsi)
movups (%rax,%rcx,8), %xmm0
movaps %xmm0, (%rsi)
leaq 0x90(%rsp), %rdi
movsd 0xf82af(%rip), %xmm0    # 0x1532d0
callq 0x85a34
leaq 0x418(%rsp), %rdi
leaq 0x110(%rsp), %rsi
callq 0x67f48
movq 0xa0(%rsp), %rax
movq %rax, 0x10(%rsp)
movupd 0x90(%rsp), %xmm0
movupd %xmm0, (%rsp)
leaq 0x1b8(%rsp), %rdi
leaq 0x418(%rsp), %rsi
callq 0x9f6e4
movq 0x60(%rsp), %rax
movq (%rax), %rbp
movq 0x8(%rax), %rdx
subq %rbp, %rdx
sarq $0x3, %rdx
imulq %r12, %rdx
movq %rbx, 0x38(%rsp)
cmpq %rbx, %rdx
jbe 0x5b4e9
movq %rbp, %rdi
addq %r13, %rdi
leaq 0x1b8(%rsp), %r14
movq %r14, %rsi
callq 0x6839c
xorl %ebx, %ebx
leaq 0x260(%rsp), %r12
movq %rbx, 0x10(%r12)
xorpd %xmm0, %xmm0
movapd %xmm0, (%r12)
leaq 0x48(%rbp,%r13), %r15
movq -0x30(%r15), %rax
movups -0x28(%r15), %xmm0
movq 0x18(%r14), %rcx
movq %rcx, -0x30(%r15)
movq 0x20(%r14), %rcx
movq %rcx, -0x28(%r15)
movq 0x28(%r14), %rcx
movq %rcx, -0x20(%r15)
movq (%r12), %rcx
movq 0x8(%r12), %rdx
movq 0x10(%r12), %rsi
movq %rax, (%r12)
movups %xmm0, 0x8(%r12)
movq %rcx, 0x18(%r14)
movq %rdx, 0x20(%r14)
movq %rsi, 0x28(%r14)
movq %r12, %rdi
callq 0x2f6f0
movq %rbx, 0x10(%r12)
xorps %xmm0, %xmm0
movaps %xmm0, (%r12)
movq -0x18(%r15), %rax
movups -0x10(%r15), %xmm0
movq 0x30(%r14), %rcx
movq %rcx, -0x18(%r15)
movq 0x38(%r14), %rcx
movq %rcx, -0x10(%r15)
movq 0x40(%r14), %rcx
movq %rcx, -0x8(%r15)
movq (%r12), %rcx
movq 0x8(%r12), %rdx
movq 0x10(%r12), %rsi
movq %rax, (%r12)
movups %xmm0, 0x8(%r12)
movq %rcx, 0x30(%r14)
movq %rdx, 0x38(%r14)
movq %rsi, 0x40(%r14)
leaq 0x260(%rsp), %rdi
callq 0x2f6f0
leaq 0x200(%rsp), %rsi
movq %r15, %rdi
callq 0x12d52
leaq 0x60(,%r13), %rdi
addq %rbp, %rdi
leaq 0x218(%rsp), %rsi
callq 0x12d52
leaq 0x78(,%r13), %r14
addq %rbp, %r14
leaq 0x230(%rsp), %r15
movq %r14, %rdi
movq %r15, %rsi
callq 0x12d52
movq 0x28(%r15), %rax
movq %rax, 0x28(%r14)
movupd 0x18(%r15), %xmm0
movupd %xmm0, 0x18(%r14)
movq (%r15), %rdi
testq %rdi, %rdi
je 0x5b1e2
movq 0x240(%rsp), %rsi
subq %rdi, %rsi
callq 0x4470
movq 0x218(%rsp), %rdi
testq %rdi, %rdi
je 0x5b1ff
movq 0x228(%rsp), %rsi
subq %rdi, %rsi
callq 0x4470
leaq 0x1d0(%rsp), %r14
leaq 0x1e8(%rsp), %r15
movq 0x18(%r15), %rdi
testq %rdi, %rdi
movq 0x38(%rsp), %rbx
je 0x5b22d
movq 0x210(%rsp), %rsi
subq %rdi, %rsi
callq 0x4470
movq %r15, %rdi
callq 0x2f6f0
movq %r14, %rdi
callq 0x2f6f0
movq 0x1b8(%rsp), %rdi
testq %rdi, %rdi
je 0x5b25a
movq 0x1c8(%rsp), %rsi
subq %rdi, %rsi
callq 0x4470
movq 0x490(%rsp), %rdi
testq %rdi, %rdi
je 0x5b277
movq 0x4a0(%rsp), %rsi
subq %rdi, %rsi
callq 0x4470
movq 0x478(%rsp), %rdi
testq %rdi, %rdi
je 0x5b294
movq 0x488(%rsp), %rsi
subq %rdi, %rsi
callq 0x4470
movq 0x460(%rsp), %rdi
testq %rdi, %rdi
je 0x5b2b1
movq 0x470(%rsp), %rsi
subq %rdi, %rsi
callq 0x4470
leaq 0x448(%rsp), %rdi
callq 0x2f6f0
leaq 0x430(%rsp), %r14
movq %r14, %rdi
callq 0x2f6f0
movq -0x18(%r14), %rdi
testq %rdi, %rdi
je 0x5b2e7
movq 0x428(%rsp), %rsi
subq %rdi, %rsi
callq 0x4470
movq 0x68(%rsp), %rdi
movq %rbx, %rsi
callq 0xedb6
orq %rdx, (%rax)
movq 0x188(%rsp), %rdi
testq %rdi, %rdi
je 0x5b314
movq 0x198(%rsp), %rsi
subq %rdi, %rsi
callq 0x4470
movq 0x170(%rsp), %rdi
testq %rdi, %rdi
je 0x5b331
movq 0x180(%rsp), %rsi
subq %rdi, %rsi
callq 0x4470
movq 0x158(%rsp), %rdi
testq %rdi, %rdi
je 0x5b34e
movq 0x168(%rsp), %rsi
subq %rdi, %rsi
callq 0x4470
leaq 0x140(%rsp), %rdi
callq 0x2f6f0
leaq 0x128(%rsp), %rbx
movq %rbx, %rdi
callq 0x2f6f0
movq -0x18(%rbx), %rdi
testq %rdi, %rdi
je 0x5b384
movq 0x120(%rsp), %rsi
subq %rdi, %rsi
callq 0x4470
movl $0x1, %eax
jmp 0x5b3a9
testb $0x1, 0x27(%rsp)
movl 0x58(%rsp), %eax
jne 0x5b3a9
leaq 0xfaaca(%rip), %rdi     # 0x155e67
callq 0x4660
movl 0x510(%rsp), %eax
addq $0x4d8, %rsp            # imm = 0x4D8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0xf42e3(%rip), %rdi     # 0x14f6a5
movq %rbx, %rsi
jmp 0x5b3df
leaq 0xf42d7(%rip), %rdi     # 0x14f6a5
xorl %eax, %eax
callq 0x4630
leaq 0xf42c9(%rip), %rdi     # 0x14f6a5
movq %rax, %rsi
xorl %eax, %eax
callq 0x4630
leaq 0xf42b8(%rip), %rdi     # 0x14f6a5
xorl %eax, %eax
callq 0x4630
movq %r15, %r12
leaq 0xf42a7(%rip), %rdi     # 0x14f6a5
movq %r12, %rsi
xorl %eax, %eax
callq 0x4630
leaq 0xf4296(%rip), %rdi     # 0x14f6a5
xorl %eax, %eax
callq 0x4630
leaq 0xf4288(%rip), %rdi     # 0x14f6a5
movq %r13, %rsi
xorl %eax, %eax
callq 0x4630
leaq 0xf4277(%rip), %rdi     # 0x14f6a5
xorl %eax, %eax
callq 0x4630
leaq 0xf4269(%rip), %rdi     # 0x14f6a5
movq 0x28(%rsp), %rsi
xorl %eax, %eax
callq 0x4630
leaq 0xf4256(%rip), %rdi     # 0x14f6a5
movq 0x28(%rsp), %rsi
xorl %eax, %eax
callq 0x4630
leaq 0xf4243(%rip), %rdi     # 0x14f6a5
movq %r15, %rsi
xorl %eax, %eax
callq 0x4630
leaq 0xf4232(%rip), %rdi     # 0x14f6a5
movq %r12, %rsi
xorl %eax, %eax
callq 0x4630
leaq 0xf4221(%rip), %rdi     # 0x14f6a5
movq %r13, %rsi
xorl %eax, %eax
callq 0x4630
leaq 0xf4210(%rip), %rdi     # 0x14f6a5
xorl %eax, %eax
callq 0x4630
sarq $0x2, %rcx
movabsq $0x6db6db6db6db6db7, %rdx # imm = 0x6DB6DB6DB6DB6DB7
imulq %rcx, %rdx
leaq 0xf41f0(%rip), %rdi     # 0x14f6a5
xorl %esi, %esi
jmp 0x5b3df
leaq 0xf41e2(%rip), %rdi     # 0x14f6a5
movq %r14, %rsi
xorl %eax, %eax
callq 0x4630
leaq 0xf41d1(%rip), %rdi     # 0x14f6a5
xorl %eax, %eax
callq 0x4630
leaq 0xf41c3(%rip), %rdi     # 0x14f6a5
xorl %eax, %eax
callq 0x4630
leaq 0xf41b5(%rip), %rdi     # 0x14f6a5
movq 0x38(%rsp), %rsi
xorl %eax, %eax
callq 0x4630
jmp 0x5b56f
movq %rax, %rbx
leaq 0x1b8(%rsp), %rdi
callq 0x6804c
jmp 0x5b513
movq %rax, %rbx
leaq 0x418(%rsp), %rdi
jmp 0x5b57f
jmp 0x5b56f
jmp 0x5b56f
jmp 0x5b56f
jmp 0x5b56f
jmp 0x5b56f
movq %rax, %rbx
jmp 0x5b554
jmp 0x5b574
jmp 0x5b574
jmp 0x5b574
jmp 0x5b574
jmp 0x5b574
jmp 0x5b574
jmp 0x5b574
jmp 0x5b574
jmp 0x5b574
jmp 0x5b574
jmp 0x5b574
jmp 0x5b574
movq %rax, %rbx
leaq 0x260(%rsp), %rdi
callq 0x6804c
leaq 0x370(%rsp), %rdi
callq 0x6804c
jmp 0x5b577
jmp 0x5b574
jmp 0x5b574
jmp 0x5b56f
jmp 0x5b56f
jmp 0x5b574
jmp 0x5b56f
movq %rax, %rbx
jmp 0x5b584
movq %rax, %rbx
leaq 0x1b8(%rsp), %rdi
callq 0x6804c
leaq 0x110(%rsp), %rdi
callq 0x6804c
movq %rbx, %rdi
callq 0x4780