// File: Luthaf[P]zeopp/net.cc
// Function: try_unit_cell_vector_assign(int, int, int, XYZ, std::vector<int, std::allocator<int>>*, std::vector<int, std::allocator<int>>*, std::vector<int, std::allocator<int>>*, std::vector<XYZ, std::allocator<XYZ>>*, std::vector<int, std::allocator<int>>*, std::vector<XYZ, std::allocator<XYZ>>*, int)
bool try_unit_cell_vector_assign(int a, int b, int c, XYZ xyz, vector<int> *loops_a, vector<int> *loops_b, vector<int> *loops_c, vector<XYZ> *loops_xyz, vector<int> *unit_cell_vector_IDs, vector<XYZ> *unit_cell_vectors, int num_uc_vectors_required) {
  bool verbose = false;
  int num_uc_vectors_assigned = unit_cell_vectors->size();
  for(int uc=0; uc<3 && num_uc_vectors_assigned<num_uc_vectors_required; uc++) {
    //is this unit cell vector assigned already?
    bool this_uc_assigned = false;
    for(int i=0; i<num_uc_vectors_assigned && !this_uc_assigned; i++) {
      if(unit_cell_vector_IDs->at(i)==uc) this_uc_assigned = true;
    }
    if(!this_uc_assigned) {
      //if not assigned already, can we assign it based on this loop alone?
      if(
(uc==0 && a!=0 && b==0 && c==0) ||
(uc==1 && a==0 && b!=0 && c==0) ||
(uc==2 && a==0 && b==0 && c!=0)
      ) {
        XYZ vec(0,0,0);
        if(uc==0) vec=xyz.scale(1.0/a); else if(uc==1) vec=xyz.scale(1.0/b); else vec=xyz.scale(1.0/c);
if(verbose) printf("DEBUG: we can assign unit cell vector %c as %.3f %.3f %.3f\n", 'a'+uc, vec.x, vec.y, vec.z);
        unit_cell_vector_IDs->push_back(uc);
        unit_cell_vectors->push_back(vec);
        this_uc_assigned = true;
        num_uc_vectors_assigned++;
      } else {
        //we could not assign it based on this loop alone - but we might be able to based on other loops ...
        int num_loops = loops_xyz->size();
        for(int i=0; i<num_loops && !this_uc_assigned; i++) {
          XYZ other_xyz = loops_xyz->at(i);
          int other_a = loops_a->at(i);
          int other_b = loops_b->at(i);
          int other_c = loops_c->at(i);
if(verbose) printf("DEBUG: comparing to previous loop (%d %d %d) %.3f %.3f %.3f to try and isolate vector %c\n", other_a, other_b, other_c, other_xyz.x, other_xyz.y, other_xyz.z, 'a'+uc);
          //can we isolate this unit cell vector with a linear combination of these two loops?
          //bool can_isolate = true;
          if(
(uc!=0 && a!=0 && other_a==0) ||
(uc!=1 && b!=0 && other_b==0) ||
(uc!=2 && c!=0 && other_c==0)
          ) {
if(verbose) printf("DEBUG: cannot isolate vector %c because some other unit cell vector cannot be reduced to zero\n", 'a'+uc);
          } else if(
(uc==0 && a==0 && other_a==0) ||
(uc==1 && b==0 && other_b==0) ||
(uc==2 && c==0 && other_c==0)
          ) {
if(verbose) printf("DEBUG: cannot isolate vector %c because both coefficients of this vector are zero\n", 'a'+uc);
          } else { //there is another way it might not be possible - if the ratios of the two other unit cell vector coefficients are not equal
if(verbose) printf("DEBUG: may be able to isolate vector %c\n", 'a'+uc);
            vector<double> amounts_of_other_loop_to_subtract;
            vector<double> amount_of_other_loop_that_would_reduce_uc_to_zero;
            if(!(a==0 && other_a==0)) {double r = ((double)(a))/other_a; if(uc!=0) amounts_of_other_loop_to_subtract.push_back(r); else amount_of_other_loop_that_would_reduce_uc_to_zero.push_back(r);}
            if(!(b==0 && other_b==0)) {double r = ((double)(b))/other_b; if(uc!=1) amounts_of_other_loop_to_subtract.push_back(r); else amount_of_other_loop_that_would_reduce_uc_to_zero.push_back(r);}
            if(!(c==0 && other_c==0)) {double r = ((double)(c))/other_c; if(uc!=2) amounts_of_other_loop_to_subtract.push_back(r); else amount_of_other_loop_that_would_reduce_uc_to_zero.push_back(r);}
            int num_amounts = amounts_of_other_loop_to_subtract.size();
            if(num_amounts==0) {
              printf("ERROR: detected that unit cell vector has already been determined in determination routine\n");
              exit(EXIT_FAILURE);
            } else if(num_amounts>2) {
              printf("ERROR: pushed too many solutions to unit cell vector determination routine\n");
              exit(EXIT_FAILURE);
            } else {
              bool can_isolate = true;
              if(num_amounts==2) {
                if(fabs(amounts_of_other_loop_to_subtract.at(0)-amounts_of_other_loop_to_subtract.at(1))>DISTANCE_TOLERANCE) {
                  can_isolate = false;
if(verbose) printf("DEBUG: cannot isolate vector %c because no linear combination will isolate this vector\n", 'a'+uc);
                }
              }
              if(can_isolate) { //we should be able to isolate it - but are we reducing to zero?
                double ratio = amounts_of_other_loop_to_subtract.at(0);
                bool can_isolate_nonzero = true;
                if(amount_of_other_loop_that_would_reduce_uc_to_zero.size()!=0) {
                  if(fabs(ratio-amount_of_other_loop_that_would_reduce_uc_to_zero.at(0))<DISTANCE_TOLERANCE) {
                    can_isolate_nonzero = false;
if(verbose) printf("DEBUG: cannot isolate vector %c because this linear combination reveals that the two vectors are multiples of each other\n", 'a'+uc);
                  }
                }
                if(can_isolate_nonzero) {
                  XYZ pre_scale_vector = xyz-(other_xyz.scale(ratio));
if(verbose) printf("DEBUG: this loop %.3f %.3f %.3f, minus %.3f times other loop %.3f %.3f %.3f, gives isolated %c loop %.3f %.3f %.3f\n", xyz.x, xyz.y, xyz.z, ratio, other_xyz.x, other_xyz.y, other_xyz.z, 'a'+uc, pre_scale_vector.x, pre_scale_vector.y, pre_scale_vector.z);
                  XYZ vec(0,0,0);
                  if(uc==0) vec=pre_scale_vector.scale(1.0/(a-(other_a*ratio))); else if(uc==1) vec=pre_scale_vector.scale(1.0/(b-(other_b*ratio))); else vec=pre_scale_vector.scale(1.0/(c-(other_c*ratio)));
if(verbose) printf("DEBUG: we can assign unit cell vector %c as %.3f %.3f %.3f based on a linear combination with a previous loop\n", 'a'+uc, vec.x, vec.y, vec.z);
                  unit_cell_vector_IDs->push_back(uc);
                  unit_cell_vectors->push_back(vec);
                  this_uc_assigned = true;
                  num_uc_vectors_assigned++;
                  //also push this new loop so we can refer to it for subsequent linear combinations - only if it is unique!
                  int new_a=0, new_b=0, new_c=0;
                  if(uc==0) new_a=1; else if(uc==1) new_b=1; else new_c=1;
                  if(loop_is_unique(new_a, new_b, new_c, loops_a, loops_b, loops_c)) {
if(verbose) printf("DEBUG: pushing the newly defined, unique loop\n");
                    loops_a->push_back(new_a);
                    loops_b->push_back(new_b);
                    loops_c->push_back(new_c);
                    loops_xyz->push_back(vec);
                    num_loops++;
                  }
                }
              }
            }
          } 
        }
      }
    }
  }
  return (num_uc_vectors_assigned==num_uc_vectors_required);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x240, %rsp            # imm = 0x240
movl 0x40(%rbp), %eax
movq 0x38(%rbp), %rax
movq 0x30(%rbp), %rax
movq 0x28(%rbp), %rax
leaq 0x10(%rbp), %rax
movq %rax, -0x1e8(%rbp)
movl %edi, -0x4(%rbp)
movl %esi, -0x8(%rbp)
movl %edx, -0xc(%rbp)
movq %rcx, -0x18(%rbp)
movq %r8, -0x20(%rbp)
movq %r9, -0x28(%rbp)
movb $0x0, -0x29(%rbp)
movq 0x38(%rbp), %rdi
callq 0xae590
movl %eax, -0x30(%rbp)
movl $0x0, -0x34(%rbp)
xorl %eax, %eax
cmpl $0x3, -0x34(%rbp)
movb %al, -0x1e9(%rbp)
jge 0x11320e
movl -0x30(%rbp), %eax
cmpl 0x40(%rbp), %eax
setl %al
movb %al, -0x1e9(%rbp)
movb -0x1e9(%rbp), %al
testb $0x1, %al
jne 0x11321d
jmp 0x113ced
movb $0x0, -0x35(%rbp)
movl $0x0, -0x3c(%rbp)
movl -0x3c(%rbp), %ecx
xorl %eax, %eax
cmpl -0x30(%rbp), %ecx
movb %al, -0x1ea(%rbp)
jge 0x113243
movb -0x35(%rbp), %al
xorb $-0x1, %al
movb %al, -0x1ea(%rbp)
movb -0x1ea(%rbp), %al
testb $0x1, %al
jne 0x11324f
jmp 0x113274
movq 0x30(%rbp), %rdi
movslq -0x3c(%rbp), %rsi
callq 0x101d0
movl (%rax), %eax
cmpl -0x34(%rbp), %eax
jne 0x113267
movb $0x1, -0x35(%rbp)
jmp 0x113269
movl -0x3c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x3c(%rbp)
jmp 0x113228
testb $0x1, -0x35(%rbp)
jne 0x113cdd
cmpl $0x0, -0x34(%rbp)
jne 0x113296
cmpl $0x0, -0x4(%rbp)
je 0x113296
cmpl $0x0, -0x8(%rbp)
jne 0x113296
cmpl $0x0, -0xc(%rbp)
je 0x1132d6
cmpl $0x1, -0x34(%rbp)
jne 0x1132ae
cmpl $0x0, -0x4(%rbp)
jne 0x1132ae
cmpl $0x0, -0x8(%rbp)
je 0x1132ae
cmpl $0x0, -0xc(%rbp)
je 0x1132d6
cmpl $0x2, -0x34(%rbp)
jne 0x11340f
cmpl $0x0, -0x4(%rbp)
jne 0x11340f
cmpl $0x0, -0x8(%rbp)
jne 0x11340f
cmpl $0x0, -0xc(%rbp)
je 0x11340f
leaq -0x58(%rbp), %rdi
xorps %xmm2, %xmm2
movaps %xmm2, %xmm0
movaps %xmm2, %xmm1
callq 0xea8e0
cmpl $0x0, -0x34(%rbp)
jne 0x11332c
movq -0x1e8(%rbp), %rsi
cvtsi2sdl -0x4(%rbp), %xmm1
movsd 0xded4e(%rip), %xmm0    # 0x1f2050
divsd %xmm1, %xmm0
leaq -0x70(%rbp), %rdi
callq 0xea9f0
movq -0x70(%rbp), %rax
movq %rax, -0x58(%rbp)
movq -0x68(%rbp), %rax
movq %rax, -0x50(%rbp)
movq -0x60(%rbp), %rax
movq %rax, -0x48(%rbp)
jmp 0x1133ba
cmpl $0x1, -0x34(%rbp)
jne 0x113373
movq -0x1e8(%rbp), %rsi
cvtsi2sdl -0x8(%rbp), %xmm1
movsd 0xded0a(%rip), %xmm0    # 0x1f2050
divsd %xmm1, %xmm0
leaq -0x88(%rbp), %rdi
callq 0xea9f0
movq -0x88(%rbp), %rax
movq %rax, -0x58(%rbp)
movq -0x80(%rbp), %rax
movq %rax, -0x50(%rbp)
movq -0x78(%rbp), %rax
movq %rax, -0x48(%rbp)
jmp 0x1133b8
movq -0x1e8(%rbp), %rsi
cvtsi2sdl -0xc(%rbp), %xmm1
movsd 0xdecc9(%rip), %xmm0    # 0x1f2050
divsd %xmm1, %xmm0
leaq -0xa0(%rbp), %rdi
callq 0xea9f0
movq -0xa0(%rbp), %rax
movq %rax, -0x58(%rbp)
movq -0x98(%rbp), %rax
movq %rax, -0x50(%rbp)
movq -0x90(%rbp), %rax
movq %rax, -0x48(%rbp)
jmp 0x1133ba
testb $0x1, -0x29(%rbp)
je 0x1133e3
movl -0x34(%rbp), %esi
addl $0x61, %esi
movsd -0x58(%rbp), %xmm0
movsd -0x50(%rbp), %xmm1
movsd -0x48(%rbp), %xmm2
leaq 0xea271(%rip), %rdi     # 0x1fd64d
movb $0x3, %al
callq 0x5070
movq 0x30(%rbp), %rdi
leaq -0x34(%rbp), %rsi
callq 0xd1b0
movq 0x38(%rbp), %rdi
leaq -0x58(%rbp), %rsi
callq 0xafc20
movb $0x1, -0x35(%rbp)
movl -0x30(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x30(%rbp)
jmp 0x113cdb
movq 0x28(%rbp), %rdi
callq 0xae590
movl %eax, -0xa4(%rbp)
movl $0x0, -0xa8(%rbp)
movl -0xa8(%rbp), %ecx
xorl %eax, %eax
cmpl -0xa4(%rbp), %ecx
movb %al, -0x1eb(%rbp)
jge 0x113449
movb -0x35(%rbp), %al
xorb $-0x1, %al
movb %al, -0x1eb(%rbp)
movb -0x1eb(%rbp), %al
testb $0x1, %al
jne 0x113458
jmp 0x113cd9
movq 0x28(%rbp), %rdi
movslq -0xa8(%rbp), %rsi
callq 0xae5c0
movq (%rax), %rcx
movq %rcx, -0xc0(%rbp)
movq 0x8(%rax), %rcx
movq %rcx, -0xb8(%rbp)
movq 0x10(%rax), %rax
movq %rax, -0xb0(%rbp)
movq -0x18(%rbp), %rdi
movslq -0xa8(%rbp), %rsi
callq 0x101d0
movl (%rax), %eax
movl %eax, -0xc4(%rbp)
movq -0x20(%rbp), %rdi
movslq -0xa8(%rbp), %rsi
callq 0x101d0
movl (%rax), %eax
movl %eax, -0xc8(%rbp)
movq -0x28(%rbp), %rdi
movslq -0xa8(%rbp), %rsi
callq 0x101d0
movl (%rax), %eax
movl %eax, -0xcc(%rbp)
testb $0x1, -0x29(%rbp)
je 0x113516
movl -0xc4(%rbp), %esi
movl -0xc8(%rbp), %edx
movl -0xcc(%rbp), %ecx
movsd -0xc0(%rbp), %xmm0
movsd -0xb8(%rbp), %xmm1
movsd -0xb0(%rbp), %xmm2
movl -0x34(%rbp), %r8d
addl $0x61, %r8d
leaq 0xea17a(%rip), %rdi     # 0x1fd689
movb $0x3, %al
callq 0x5070
cmpl $0x0, -0x34(%rbp)
je 0x11352b
cmpl $0x0, -0x4(%rbp)
je 0x11352b
cmpl $0x0, -0xc4(%rbp)
je 0x113555
cmpl $0x1, -0x34(%rbp)
je 0x113540
cmpl $0x0, -0x8(%rbp)
je 0x113540
cmpl $0x0, -0xc8(%rbp)
je 0x113555
cmpl $0x2, -0x34(%rbp)
je 0x113574
cmpl $0x0, -0xc(%rbp)
je 0x113574
cmpl $0x0, -0xcc(%rbp)
jne 0x113574
testb $0x1, -0x29(%rbp)
je 0x11356f
movl -0x34(%rbp), %esi
addl $0x61, %esi
leaq 0xea17b(%rip), %rdi     # 0x1fd6e3
movb $0x0, %al
callq 0x5070
jmp 0x113cc3
cmpl $0x0, -0x34(%rbp)
jne 0x113589
cmpl $0x0, -0x4(%rbp)
jne 0x113589
cmpl $0x0, -0xc4(%rbp)
je 0x1135b3
cmpl $0x1, -0x34(%rbp)
jne 0x11359e
cmpl $0x0, -0x8(%rbp)
jne 0x11359e
cmpl $0x0, -0xc8(%rbp)
je 0x1135b3
cmpl $0x2, -0x34(%rbp)
jne 0x1135d2
cmpl $0x0, -0xc(%rbp)
jne 0x1135d2
cmpl $0x0, -0xcc(%rbp)
jne 0x1135d2
testb $0x1, -0x29(%rbp)
je 0x1135cd
movl -0x34(%rbp), %esi
addl $0x61, %esi
leaq 0xea17c(%rip), %rdi     # 0x1fd742
movb $0x0, %al
callq 0x5070
jmp 0x113cc1
testb $0x1, -0x29(%rbp)
je 0x1135ec
movl -0x34(%rbp), %esi
addl $0x61, %esi
leaq 0xea1b0(%rip), %rdi     # 0x1fd795
movb $0x0, %al
callq 0x5070
leaq -0xe8(%rbp), %rdi
callq 0xf650
leaq -0x100(%rbp), %rdi
callq 0xf650
cmpl $0x0, -0x4(%rbp)
jne 0x113613
cmpl $0x0, -0xc4(%rbp)
je 0x113691
cvtsi2sdl -0x4(%rbp), %xmm0
cvtsi2sdl -0xc4(%rbp), %xmm1
divsd %xmm1, %xmm0
movsd %xmm0, -0x108(%rbp)
cmpl $0x0, -0x34(%rbp)
je 0x113678
leaq -0xe8(%rbp), %rdi
leaq -0x108(%rbp), %rsi
callq 0x105c0
jmp 0x113647
jmp 0x11368f
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x110(%rbp)
movl %eax, -0x114(%rbp)
leaq -0x100(%rbp), %rdi
callq 0xf9d0
leaq -0xe8(%rbp), %rdi
callq 0xf9d0
jmp 0x113d01
leaq -0x100(%rbp), %rdi
leaq -0x108(%rbp), %rsi
callq 0x105c0
jmp 0x11368d
jmp 0x11368f
jmp 0x113691
cmpl $0x0, -0x8(%rbp)
jne 0x1136a0
cmpl $0x0, -0xc8(%rbp)
je 0x1136ef
cvtsi2sdl -0x8(%rbp), %xmm0
cvtsi2sdl -0xc8(%rbp), %xmm1
divsd %xmm1, %xmm0
movsd %xmm0, -0x120(%rbp)
cmpl $0x1, -0x34(%rbp)
je 0x1136d6
leaq -0xe8(%rbp), %rdi
leaq -0x120(%rbp), %rsi
callq 0x105c0
jmp 0x1136d4
jmp 0x1136ed
leaq -0x100(%rbp), %rdi
leaq -0x120(%rbp), %rsi
callq 0x105c0
jmp 0x1136eb
jmp 0x1136ed
jmp 0x1136ef
cmpl $0x0, -0xc(%rbp)
jne 0x1136fe
cmpl $0x0, -0xcc(%rbp)
je 0x11374d
cvtsi2sdl -0xc(%rbp), %xmm0
cvtsi2sdl -0xcc(%rbp), %xmm1
divsd %xmm1, %xmm0
movsd %xmm0, -0x128(%rbp)
cmpl $0x2, -0x34(%rbp)
je 0x113734
leaq -0xe8(%rbp), %rdi
leaq -0x128(%rbp), %rsi
callq 0x105c0
jmp 0x113732
jmp 0x11374b
leaq -0x100(%rbp), %rdi
leaq -0x128(%rbp), %rsi
callq 0x105c0
jmp 0x113749
jmp 0x11374b
jmp 0x11374d
leaq -0xe8(%rbp), %rdi
callq 0xf990
movl %eax, -0x12c(%rbp)
cmpl $0x0, -0x12c(%rbp)
jne 0x113782
leaq 0xea04f(%rip), %rdi     # 0x1fd7be
xorl %eax, %eax
callq 0x5070
jmp 0x113778
movl $0x1, %edi
callq 0x67c0
cmpl $0x2, -0x12c(%rbp)
jle 0x1137a5
leaq 0xea088(%rip), %rdi     # 0x1fd81a
xorl %eax, %eax
callq 0x5070
jmp 0x11379b
movl $0x1, %edi
callq 0x67c0
movb $0x1, -0x12d(%rbp)
cmpl $0x2, -0x12c(%rbp)
jne 0x113854
xorl %eax, %eax
movl %eax, %esi
leaq -0xe8(%rbp), %rdi
callq 0xfc80
movq %rax, -0x1f8(%rbp)
jmp 0x1137d2
movq -0x1f8(%rbp), %rax
movsd (%rax), %xmm0
movsd %xmm0, -0x208(%rbp)
leaq -0xe8(%rbp), %rdi
movl $0x1, %esi
callq 0xfc80
movq %rax, -0x200(%rbp)
jmp 0x1137ff
movq -0x200(%rbp), %rax
movsd -0x208(%rbp), %xmm0
subsd (%rax), %xmm0
movaps 0xde867(%rip), %xmm1    # 0x1f2080
pand %xmm1, %xmm0
movsd 0xe4043(%rip), %xmm1    # 0x1f7868
ucomisd %xmm1, %xmm0
jbe 0x113852
movb $0x0, -0x12d(%rbp)
testb $0x1, -0x29(%rbp)
je 0x113850
movl -0x34(%rbp), %esi
addl $0x61, %esi
leaq 0xea021(%rip), %rdi     # 0x1fd866
xorl %eax, %eax
callq 0x5070
jmp 0x11384e
jmp 0x113850
jmp 0x113852
jmp 0x113854
testb $0x1, -0x12d(%rbp)
je 0x113ca5
xorl %eax, %eax
movl %eax, %esi
leaq -0xe8(%rbp), %rdi
callq 0xfc80
movq %rax, -0x210(%rbp)
jmp 0x11387a
movq -0x210(%rbp), %rax
movsd (%rax), %xmm0
movsd %xmm0, -0x138(%rbp)
movb $0x1, -0x139(%rbp)
leaq -0x100(%rbp), %rdi
callq 0xf990
cmpq $0x0, %rax
je 0x113924
movsd -0x138(%rbp), %xmm0
movsd %xmm0, -0x220(%rbp)
xorl %eax, %eax
movl %eax, %esi
leaq -0x100(%rbp), %rdi
callq 0xfc80
movq %rax, -0x218(%rbp)
jmp 0x1138cf
movq -0x218(%rbp), %rax
movsd -0x220(%rbp), %xmm1
subsd (%rax), %xmm1
movaps 0xde797(%rip), %xmm0    # 0x1f2080
pand %xmm0, %xmm1
movsd 0xe3f73(%rip), %xmm0    # 0x1f7868
ucomisd %xmm1, %xmm0
jbe 0x113922
movb $0x0, -0x139(%rbp)
testb $0x1, -0x29(%rbp)
je 0x113920
movl -0x34(%rbp), %esi
addl $0x61, %esi
leaq 0xe9fa9(%rip), %rdi     # 0x1fd8be
xorl %eax, %eax
callq 0x5070
jmp 0x11391e
jmp 0x113920
jmp 0x113922
jmp 0x113924
testb $0x1, -0x139(%rbp)
je 0x113ca3
movsd -0x138(%rbp), %xmm0
leaq -0x170(%rbp), %rdi
leaq -0xc0(%rbp), %rsi
callq 0xea9f0
jmp 0x11394e
movq -0x1e8(%rbp), %rsi
leaq -0x158(%rbp), %rdi
leaq -0x170(%rbp), %rdx
callq 0xeadf0
jmp 0x11396a
testb $0x1, -0x29(%rbp)
je 0x1139e5
movq -0x1e8(%rbp), %rax
movsd (%rax), %xmm0
movsd 0x8(%rax), %xmm1
movsd 0x10(%rax), %xmm2
movsd -0x138(%rbp), %xmm3
movsd -0xc0(%rbp), %xmm4
movsd -0xb8(%rbp), %xmm5
movsd -0xb0(%rbp), %xmm6
movl -0x34(%rbp), %esi
addl $0x61, %esi
movsd -0x158(%rbp), %xmm7
movsd -0x150(%rbp), %xmm8
movsd -0x148(%rbp), %xmm9
movq %rsp, %rax
movsd %xmm9, 0x8(%rax)
movsd %xmm8, (%rax)
leaq 0xe9f5e(%rip), %rdi     # 0x1fd938
movb $0x8, %al
callq 0x5070
jmp 0x1139e3
jmp 0x1139e5
leaq -0x188(%rbp), %rdi
xorps %xmm2, %xmm2
movaps %xmm2, %xmm0
movaps %xmm2, %xmm1
callq 0xea8e0
jmp 0x1139fc
cmpl $0x0, -0x34(%rbp)
jne 0x113a6f
cvtsi2sdl -0x4(%rbp), %xmm1
cvtsi2sdl -0xc4(%rbp), %xmm0
movsd -0x138(%rbp), %xmm2
mulsd %xmm2, %xmm0
subsd %xmm0, %xmm1
movsd 0xde629(%rip), %xmm0    # 0x1f2050
divsd %xmm1, %xmm0
leaq -0x1a0(%rbp), %rdi
leaq -0x158(%rbp), %rsi
callq 0xea9f0
jmp 0x113a40
movq -0x1a0(%rbp), %rax
movq %rax, -0x188(%rbp)
movq -0x198(%rbp), %rax
movq %rax, -0x180(%rbp)
movq -0x190(%rbp), %rax
movq %rax, -0x178(%rbp)
jmp 0x113b49
cmpl $0x1, -0x34(%rbp)
jne 0x113adf
cvtsi2sdl -0x8(%rbp), %xmm1
cvtsi2sdl -0xc8(%rbp), %xmm0
movsd -0x138(%rbp), %xmm2
mulsd %xmm2, %xmm0
subsd %xmm0, %xmm1
movsd 0xde5b6(%rip), %xmm0    # 0x1f2050
divsd %xmm1, %xmm0
leaq -0x1b8(%rbp), %rdi
leaq -0x158(%rbp), %rsi
callq 0xea9f0
jmp 0x113ab3
movq -0x1b8(%rbp), %rax
movq %rax, -0x188(%rbp)
movq -0x1b0(%rbp), %rax
movq %rax, -0x180(%rbp)
movq -0x1a8(%rbp), %rax
movq %rax, -0x178(%rbp)
jmp 0x113b47
cvtsi2sdl -0xc(%rbp), %xmm1
cvtsi2sdl -0xcc(%rbp), %xmm0
movsd -0x138(%rbp), %xmm2
mulsd %xmm2, %xmm0
subsd %xmm0, %xmm1
movsd 0xde54c(%rip), %xmm0    # 0x1f2050
divsd %xmm1, %xmm0
leaq -0x1d0(%rbp), %rdi
leaq -0x158(%rbp), %rsi
callq 0xea9f0
jmp 0x113b1d
movq -0x1d0(%rbp), %rax
movq %rax, -0x188(%rbp)
movq -0x1c8(%rbp), %rax
movq %rax, -0x180(%rbp)
movq -0x1c0(%rbp), %rax
movq %rax, -0x178(%rbp)
jmp 0x113b49
testb $0x1, -0x29(%rbp)
je 0x113b7f
movl -0x34(%rbp), %esi
addl $0x61, %esi
movsd -0x188(%rbp), %xmm0
movsd -0x180(%rbp), %xmm1
movsd -0x178(%rbp), %xmm2
leaq 0xe9e38(%rip), %rdi     # 0x1fd9ac
movb $0x3, %al
callq 0x5070
jmp 0x113b7d
jmp 0x113b7f
movq 0x30(%rbp), %rdi
leaq -0x34(%rbp), %rsi
callq 0xd1b0
jmp 0x113b8e
movq 0x38(%rbp), %rdi
leaq -0x188(%rbp), %rsi
callq 0xafc20
jmp 0x113ba0
movb $0x1, -0x35(%rbp)
movl -0x30(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x30(%rbp)
movl $0x0, -0x1d4(%rbp)
movl $0x0, -0x1d8(%rbp)
movl $0x0, -0x1dc(%rbp)
cmpl $0x0, -0x34(%rbp)
jne 0x113bdd
movl $0x1, -0x1d4(%rbp)
jmp 0x113bfb
cmpl $0x1, -0x34(%rbp)
jne 0x113bef
movl $0x1, -0x1d8(%rbp)
jmp 0x113bf9
movl $0x1, -0x1dc(%rbp)
jmp 0x113bfb
movl -0x1d4(%rbp), %edi
movl -0x1d8(%rbp), %esi
movl -0x1dc(%rbp), %edx
movq -0x18(%rbp), %rcx
movq -0x20(%rbp), %r8
movq -0x28(%rbp), %r9
callq 0x112c40
movb %al, -0x221(%rbp)
jmp 0x113c26
movb -0x221(%rbp), %al
testb $0x1, %al
jne 0x113c32
jmp 0x113ca1
testb $0x1, -0x29(%rbp)
je 0x113c4a
leaq 0xe9ddc(%rip), %rdi     # 0x1fda1b
xorl %eax, %eax
callq 0x5070
jmp 0x113c48
jmp 0x113c4a
movq -0x18(%rbp), %rdi
leaq -0x1d4(%rbp), %rsi
callq 0xd1b0
jmp 0x113c5c
movq -0x20(%rbp), %rdi
leaq -0x1d8(%rbp), %rsi
callq 0xd1b0
jmp 0x113c6e
movq -0x28(%rbp), %rdi
leaq -0x1dc(%rbp), %rsi
callq 0xd1b0
jmp 0x113c80
movq 0x28(%rbp), %rdi
leaq -0x188(%rbp), %rsi
callq 0xafc20
jmp 0x113c92
movl -0xa4(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xa4(%rbp)
jmp 0x113ca3
jmp 0x113ca5
jmp 0x113ca7
jmp 0x113ca9
leaq -0x100(%rbp), %rdi
callq 0xf9d0
leaq -0xe8(%rbp), %rdi
callq 0xf9d0
jmp 0x113cc3
jmp 0x113cc5
movl -0xa8(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xa8(%rbp)
jmp 0x113428
jmp 0x113cdb
jmp 0x113cdd
jmp 0x113cdf
movl -0x34(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x34(%rbp)
jmp 0x1131f1
movl -0x30(%rbp), %eax
cmpl 0x40(%rbp), %eax
sete %al
andb $0x1, %al
addq $0x240, %rsp            # imm = 0x240
popq %rbp
retq
movq -0x110(%rbp), %rdi
callq 0x58f0
nopl (%rax)