// File: /workspace/github_c_makefile_star2_O2/PoulinV[P]AxiCLASS/build/../source/perturbations.c
// Function: perturbations_find_approximation_switches
int perturbations_find_approximation_switches(
                                              struct precision * ppr,
                                              struct background * pba,
                                              struct thermodynamics * pth,
                                              struct perturbations * ppt,
                                              int index_md,
                                              double k,
                                              struct perturbations_workspace * ppw,
                                              double tau_ini,
                                              double tau_end,
                                              double precision,
                                              int interval_number,
                                              int * interval_number_of,
                                              double * interval_limit, /* interval_limit[index_interval] (already allocated) */
                                              int ** interval_approx   /* interval_approx[index_interval][index_ap] (already allocated) */
                                              ){

  /** Summary: */

  int index_ap;
  int index_switch;
  int index_switch_tot;
  int num_switch;
  double tau_min,lower_bound,upper_bound;
  double mid=0;
  double * unsorted_tau_switch;
  double next_tau_switch;
  int flag_ini;
  int num_switching_at_given_time;

  /** - write in output arrays the initial time and approximation */

  interval_limit[0]=tau_ini;

  class_call(perturbations_approximations(ppr,
                                          pba,
                                          pth,
                                          ppt,
                                          index_md,
                                          k,
                                          tau_ini,
                                          ppw),
             ppt->error_message,
             ppt->error_message);

  for (index_ap=0; index_ap<ppw->ap_size; index_ap++)
    interval_approx[0][index_ap]=ppw->approx[index_ap];

  /** - if there are no approximation switches, just write final time and return */

  if (interval_number == 1) {

    interval_limit[1]=tau_end;

  }

  /** - if there are switches, consider approximations one after each
      other.  Find switching time by bisection. Store all switches in
      arbitrary order in array unsorted_tau_switch[ ] */

  else {

    class_alloc(unsorted_tau_switch,(interval_number-1)*sizeof(double),ppt->error_message);

    index_switch_tot=0;

    for (index_ap=0; index_ap<ppw->ap_size; index_ap++) {

      if (interval_number_of[index_ap] > 1) {

        num_switch = interval_number_of[index_ap]-1;

        tau_min = tau_ini;

        flag_ini = interval_approx[0][index_ap];

        for (index_switch=0; index_switch<num_switch; index_switch++) {

          lower_bound=tau_min;
          upper_bound=tau_end;
          mid = 0.5*(lower_bound+upper_bound);

          while (upper_bound - lower_bound > precision) {

            class_call(perturbations_approximations(ppr,
                                                    pba,
                                                    pth,
                                                    ppt,
                                                    index_md,
                                                    k,
                                                    mid,
                                                    ppw),
                       ppt->error_message,
                       ppt->error_message);

            if (ppw->approx[index_ap] > flag_ini+index_switch) {
              upper_bound=mid;
            }
            else {
              lower_bound=mid;
            }

            mid = 0.5*(lower_bound+upper_bound);

          }

          unsorted_tau_switch[index_switch_tot]=mid;
          index_switch_tot++;

          tau_min=mid;

        }
      }
    }

    class_test(index_switch_tot != (interval_number-1),
               ppt->error_message,
               "bug in approximation switch search routine: should have %d = %d",
               index_switch_tot,interval_number-1);

    /** - now sort interval limits in correct order */

    index_switch_tot=1;

    while (index_switch_tot < interval_number) {

      next_tau_switch=tau_end;
      for (index_switch=0; index_switch<interval_number-1; index_switch++) {
        if ((unsorted_tau_switch[index_switch] > interval_limit[index_switch_tot-1]) &&
            (unsorted_tau_switch[index_switch] < next_tau_switch)) {
          next_tau_switch=unsorted_tau_switch[index_switch];
        }
      }
      interval_limit[index_switch_tot]=next_tau_switch;
      index_switch_tot++;
    }

    interval_limit[index_switch_tot]=tau_end;

    class_test(index_switch_tot != interval_number,
               ppt->error_message,
               "most probably two approximation switching time were found to be equal, which cannot be handled\n");

    /** - store each approximation in chronological order */

    for (index_switch=1; index_switch<interval_number; index_switch++) {

      class_call(perturbations_approximations(ppr,
                                              pba,
                                              pth,
                                              ppt,
                                              index_md,
                                              k,
                                              0.5*(interval_limit[index_switch]+interval_limit[index_switch+1]),
                                              ppw),

                 ppt->error_message,
                 ppt->error_message);

      for (index_ap=0; index_ap<ppw->ap_size; index_ap++) {
        interval_approx[index_switch][index_ap]=ppw->approx[index_ap];

        /* check here that approximation does not go backward (remember
           that by definition the value of an approximation can only
           increase) */
        class_test(interval_approx[index_switch][index_ap] < interval_approx[index_switch-1][index_ap],
                   ppt->error_message,
                   "The approximation with label %d is not defined correctly: it goes backward (from %d to %d) for k=%e and between tau=%e and %e; this cannot be handled\n",
                   index_ap,
                   interval_approx[index_switch-1][index_ap],
                   interval_approx[index_switch][index_ap],
                   k,
                   0.5*(interval_limit[index_switch-1]+interval_limit[index_switch]),
                   0.5*(interval_limit[index_switch]+interval_limit[index_switch+1])
                   );
      }

      /* check here that more than one approximation is not switched on at a given time */
      num_switching_at_given_time=0;
      for (index_ap=0; index_ap<ppw->ap_size; index_ap++) {
        if (interval_approx[index_switch][index_ap] != interval_approx[index_switch-1][index_ap])
          num_switching_at_given_time++;
      }
      class_test(num_switching_at_given_time != 1,
                 ppt->error_message,
                 "for k=%e, at tau=%g, you switch %d approximations at the same time, this cannot be handled. Usually happens in two cases: triggers for different approximations coincide, or one approx is reversible\n",
                 k,
                 interval_limit[index_switch],
                 num_switching_at_given_time);

      if (ppt->perturbations_verbose>2) {

        if (_scalars_) {

          if ((interval_approx[index_switch-1][ppw->index_ap_tca]==(int)tca_on) &&
              (interval_approx[index_switch][ppw->index_ap_tca]==(int)tca_off))
            fprintf(stdout,"Mode k=%e: will switch off tight-coupling approximation at tau=%e\n",k,interval_limit[index_switch]);
          //fprintf(stderr,"Mode k=%e: will switch off tight-coupling approximation at tau=%e\n",k,interval_limit[index_switch]);  //TBC

          if ((interval_approx[index_switch-1][ppw->index_ap_rsa]==(int)rsa_off) &&
              (interval_approx[index_switch][ppw->index_ap_rsa]==(int)rsa_on))
            fprintf(stdout,"Mode k=%e: will switch on radiation streaming approximation at tau=%e\n",k,interval_limit[index_switch]);

          if (pba->has_idr == _TRUE_){
            if ((interval_approx[index_switch-1][ppw->index_ap_rsa_idr]==(int)rsa_idr_off) &&
                (interval_approx[index_switch][ppw->index_ap_rsa_idr]==(int)rsa_idr_on))
              fprintf(stdout,"Mode k=%e: will switch on dark radiation streaming approximation at tau=%e\n",k,interval_limit[index_switch]);
          }

          if (pth->has_idm_dr == _TRUE_){
            if ((interval_approx[index_switch-1][ppw->index_ap_tca_idm_dr]==(int)tca_idm_dr_on) &&
                (interval_approx[index_switch][ppw->index_ap_tca_idm_dr]==(int)tca_idm_dr_off))
              fprintf(stdout,"Mode k=%e: will switch off dark tight-coupling approximation at tau=%e\n",k,interval_limit[index_switch]);
          }

          if (pba->has_ur == _TRUE_) {
            if ((interval_approx[index_switch-1][ppw->index_ap_ufa]==(int)ufa_off) &&
                (interval_approx[index_switch][ppw->index_ap_ufa]==(int)ufa_on)) {
              fprintf(stdout,"Mode k=%e: will switch on ur fluid approximation at tau=%e\n",k,interval_limit[index_switch]);
            }
          }
          if (pba->has_ncdm == _TRUE_) {
            if ((interval_approx[index_switch-1][ppw->index_ap_ncdmfa]==(int)ncdmfa_off) &&
                (interval_approx[index_switch][ppw->index_ap_ncdmfa]==(int)ncdmfa_on)) {
              fprintf(stdout,"Mode k=%e: will switch on ncdm fluid approximation at tau=%e\n",k,interval_limit[index_switch]);
            }
          }
        }

        if (_tensors_) {

          if ((interval_approx[index_switch-1][ppw->index_ap_tca]==(int)tca_on) &&
              (interval_approx[index_switch][ppw->index_ap_tca]==(int)tca_off))
            fprintf(stdout,"Mode k=%e: will switch off tight-coupling approximation for tensors at tau=%e\n",k,interval_limit[index_switch]);

          if ((interval_approx[index_switch-1][ppw->index_ap_rsa]==(int)rsa_off) &&
              (interval_approx[index_switch][ppw->index_ap_rsa]==(int)rsa_on))
            fprintf(stdout,"Mode k=%e: will switch on radiation streaming approximation for tensors at tau=%e\n",k,interval_limit[index_switch]);

        }
      }
    }

    free(unsorted_tau_switch);

    class_call(perturbations_approximations(ppr,
                                            pba,
                                            pth,
                                            ppt,
                                            index_md,
                                            k,
                                            tau_end,
                                            ppw),

               ppt->error_message,
               ppt->error_message);
  }

  return _SUCCESS_;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x1098, %rsp           # imm = 0x1098
movsd %xmm3, 0x50(%rsp)
movsd %xmm2, 0x30(%rsp)
movq %r9, %r14
movl %r8d, %ebx
movq %rcx, %r12
movq %rdx, %rbp
movq %rsi, %r15
movq %rdi, %r13
movq 0x10e0(%rsp), %rax
movsd %xmm1, (%rax)
movsd %xmm0, 0x10(%rsp)
movsd %xmm1, 0x68(%rsp)
callq 0x85c21
testl %eax, %eax
je 0x76b2d
addq $0x6c8a, %r12           # imm = 0x6C8A
leaq 0x6e914(%rip), %rsi     # 0xe53f0
leaq 0x961cf(%rip), %rdx     # 0x10ccb2
leaq 0x90(%rsp), %r14
movq %r14, %rdi
movq %r12, %rcx
xorl %eax, %eax
callq 0x2e014
leaq 0x6e535(%rip), %rsi     # 0xe5034
leaq 0x9635f(%rip), %rdx     # 0x10ce65
movq %r12, %rdi
movl $0xe54, %ecx            # imm = 0xE54
movq %r14, %r8
xorl %eax, %eax
callq 0x2e014
pushq $0x1
popq %rax
addq $0x1098, %rsp           # imm = 0x1098
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %r13, 0x40(%rsp)
movq %r15, 0x18(%rsp)
movq 0x10e8(%rsp), %r15
xorl %eax, %eax
movsd 0x30(%rsp), %xmm0
movslq 0x178(%r14), %r13
cmpq %r13, %rax
jge 0x76b68
movq 0x180(%r14), %rcx
movl (%rcx,%rax,4), %ecx
movq (%r15), %rdx
movl %ecx, (%rdx,%rax,4)
incq %rax
jmp 0x76b47
movl 0x10d0(%rsp), %eax
cmpl $0x1, %eax
jne 0x76b85
movq 0x10e0(%rsp), %rax
movsd %xmm0, 0x8(%rax)
xorl %eax, %eax
jmp 0x76b1b
movq %rbp, 0x38(%rsp)
cltq
movq %rax, 0x60(%rsp)
leaq -0x8(,%rax,8), %rbp
movq %rbp, %rdi
callq 0x8490
movq %rax, 0x48(%rsp)
testq %rax, %rax
je 0x76d82
movq %r12, 0x8(%rsp)
movl 0x10d0(%rsp), %eax
leal -0x1(%rax), %ebp
xorl %r12d, %r12d
movq $0x0, 0x28(%rsp)
movsd 0x10(%rsp), %xmm0
movsd 0x50(%rsp), %xmm2
movsd 0x68(%rsp), %xmm1
movslq %r13d, %rax
cmpq %rax, %r12
jge 0x76dc6
movq 0x10d8(%rsp), %rax
movl (%rax,%r12,4), %ecx
cmpl $0x2, %ecx
jl 0x76d30
decl %ecx
movq (%r15), %rax
movl (%rax,%r12,4), %edx
movq 0x28(%rsp), %rax
cltq
movq %rax, 0x28(%rsp)
xorl %eax, %eax
movapd %xmm1, %xmm3
movl %ecx, 0x5c(%rsp)
movq %rdx, 0x70(%rsp)
cmpl %ecx, %eax
je 0x76d29
movapd %xmm3, %xmm1
movsd 0x30(%rsp), %xmm4
addsd %xmm4, %xmm1
movq %rax, 0x78(%rsp)
leal (%rax,%rdx), %r13d
movapd %xmm4, %xmm5
mulsd 0x6f064(%rip), %xmm1    # 0xe5cb0
movapd %xmm5, %xmm4
subsd %xmm3, %xmm4
ucomisd %xmm2, %xmm4
jbe 0x76cf3
movsd %xmm5, 0x80(%rsp)
movsd %xmm3, 0x88(%rsp)
movq 0x40(%rsp), %rdi
movq 0x18(%rsp), %rsi
movq 0x38(%rsp), %rdx
movq 0x8(%rsp), %rcx
movl %ebx, %r8d
movsd %xmm1, 0x20(%rsp)
movq %r14, %r9
callq 0x85c21
testl %eax, %eax
jne 0x76d38
movq 0x180(%r14), %rax
cmpl %r13d, (%rax,%r12,4)
jg 0x76ccb
movsd 0x20(%rsp), %xmm1
movapd %xmm1, %xmm3
movsd 0x10(%rsp), %xmm0
movsd 0x50(%rsp), %xmm2
movsd 0x80(%rsp), %xmm5
jmp 0x76cea
movsd 0x20(%rsp), %xmm5
movsd 0x88(%rsp), %xmm3
movapd %xmm3, %xmm1
movsd 0x10(%rsp), %xmm0
movsd 0x50(%rsp), %xmm2
addsd %xmm5, %xmm1
jmp 0x76c44
movq 0x48(%rsp), %rax
movq 0x28(%rsp), %rcx
movsd %xmm1, (%rax,%rcx,8)
incq %rcx
movq %rcx, 0x28(%rsp)
movq 0x78(%rsp), %rax
incl %eax
movapd %xmm1, %xmm3
movsd 0x68(%rsp), %xmm1
movl 0x5c(%rsp), %ecx
movq 0x70(%rsp), %rdx
jmp 0x76c21
movl 0x178(%r14), %r13d
incq %r12
jmp 0x76bdc
movq 0x8(%rsp), %rbx
addq $0x6c8a, %rbx           # imm = 0x6C8A
leaq 0x6e6a5(%rip), %rsi     # 0xe53f0
leaq 0x96151(%rip), %rdx     # 0x10cea3
leaq 0x90(%rsp), %r14
movq %r14, %rdi
movq %rbx, %rcx
xorl %eax, %eax
callq 0x2e014
leaq 0x6e2c6(%rip), %rsi     # 0xe5034
leaq 0x960f0(%rip), %rdx     # 0x10ce65
movq %rbx, %rdi
movl $0xe86, %ecx            # imm = 0xE86
jmp 0x76b0e
leaq 0x6e27b(%rip), %rsi     # 0xe5004
leaq 0x960ff(%rip), %rdx     # 0x10ce8f
leaq 0x90(%rsp), %r14
movq %r14, %rdi
movl %ebp, %ecx
xorl %eax, %eax
callq 0x2e014
addq $0x6c8a, %r12           # imm = 0x6C8A
leaq 0x6e282(%rip), %rsi     # 0xe5034
leaq 0x960ac(%rip), %rdx     # 0x10ce65
movq %r12, %rdi
movl $0xe67, %ecx            # imm = 0xE67
jmp 0x76b0e
movq 0x28(%rsp), %rdx
cmpl %ebp, %edx
jne 0x76e44
xorl %eax, %eax
testl %ebp, %ebp
cmovlel %eax, %ebp
pushq $0x1
popq %rax
movl %ebx, %r12d
movq 0x10e0(%rsp), %r13
movq 0x60(%rsp), %rbx
cmpq %rbx, %rax
jge 0x76ea6
xorl %ecx, %ecx
movsd 0x30(%rsp), %xmm4
cmpq %rcx, %rbp
je 0x76e38
movq 0x48(%rsp), %rdx
movsd (%rdx,%rcx,8), %xmm1
movsd -0x8(%r13,%rax,8), %xmm2
cmpltpd %xmm1, %xmm2
movapd %xmm1, %xmm3
cmpltpd %xmm4, %xmm3
andpd %xmm2, %xmm3
movd %xmm3, %edx
testb $0x1, %dl
jne 0x76e2f
movapd %xmm4, %xmm1
incq %rcx
movapd %xmm1, %xmm4
jmp 0x76dfa
movsd %xmm4, (%r13,%rax,8)
incq %rax
jmp 0x76de9
leaq 0x960a0(%rip), %rsi     # 0x10ceeb
leaq 0x90(%rsp), %r14
movq %r14, %rdi
movl %ebp, %ecx
xorl %eax, %eax
callq 0x2e014
leaq 0x6e21c(%rip), %rsi     # 0xe5082
leaq 0x960be(%rip), %rdx     # 0x10cf2b
leaq 0x890(%rsp), %r15
movq %r15, %rdi
movq %r14, %rcx
xorl %eax, %eax
callq 0x2e014
movq 0x8(%rsp), %rdi
addq $0x6c8a, %rdi           # imm = 0x6C8A
leaq 0x6e19f(%rip), %rsi     # 0xe5034
leaq 0x95fc9(%rip), %rdx     # 0x10ce65
movl $0xe9f, %ecx            # imm = 0xE9F
jmp 0x77348
movl %eax, %ecx
movsd 0x30(%rsp), %xmm1
movsd %xmm1, (%r13,%rcx,8)
movl 0x10d0(%rsp), %ecx
cmpl %ecx, %eax
jne 0x77264
pushq $0x1
popq %r9
cmpq %rbx, %r9
jge 0x77350
movq %r9, %rbp
movsd (%r13,%r9,8), %xmm1
addsd 0x8(%r13,%r9,8), %xmm1
mulsd 0x6edc6(%rip), %xmm1    # 0xe5cb0
movq 0x40(%rsp), %rdi
movq 0x18(%rsp), %rsi
movq 0x38(%rsp), %rdx
movq 0x8(%rsp), %rcx
movl %r12d, %r8d
movq %r14, %r9
callq 0x85c21
testl %eax, %eax
jne 0x773d5
leaq 0x1(%rbp), %r9
xorl %edx, %edx
movsd 0x10(%rsp), %xmm0
movslq 0x178(%r14), %rax
cmpq %rax, %rdx
jge 0x76f52
movq 0x180(%r14), %rax
movl (%rax,%rdx,4), %r8d
movq (%r15,%rbp,8), %rax
movl %r8d, (%rax,%rdx,4)
movq -0x8(%r15,%rbp,8), %rax
movl (%rax,%rdx,4), %ecx
cmpl %ecx, %r8d
jl 0x772c4
incq %rdx
jmp 0x76f1d
xorl %ecx, %ecx
testl %eax, %eax
cmovlel %ecx, %eax
xorl %edx, %edx
cmpq %rcx, %rax
je 0x76f7e
movq -0x8(%r15,%rbp,8), %rsi
movq (%r15,%rbp,8), %rdi
movl (%rdi,%rcx,4), %edi
xorl %r8d, %r8d
cmpl (%rsi,%rcx,4), %edi
setne %r8b
addl %r8d, %edx
incq %rcx
jmp 0x76f5b
cmpl $0x1, %edx
jne 0x7741f
movq 0x8(%rsp), %rax
cmpw $0x3, 0x6c88(%rax)
jl 0x76ec8
movq 0x8(%rsp), %rbx
cmpw $0x1, 0xe(%rbx)
jne 0x771a3
cmpl %r12d, 0x848(%rbx)
jne 0x771a3
movq -0x8(%r15,%rbp,8), %rax
movslq 0x160(%r14), %rcx
cmpl $0x0, (%rax,%rcx,4)
jne 0x77003
movq (%r15,%rbp,8), %rdx
cmpl $0x1, (%rdx,%rcx,4)
jne 0x77003
movq 0xcbf76(%rip), %rax     # 0x142f50
movq (%rax), %rdi
movsd (%r13,%rbp,8), %xmm1
leaq 0x96245(%rip), %rsi     # 0x10d230
movb $0x2, %al
movq %r9, %rbx
callq 0x8510
movq %rbx, %r9
movsd 0x10(%rsp), %xmm0
movq -0x8(%r15,%rbp,8), %rax
movslq 0x164(%r14), %rcx
cmpl $0x0, (%rax,%rcx,4)
jne 0x77045
movq (%r15,%rbp,8), %rax
cmpl $0x1, (%rax,%rcx,4)
jne 0x77045
movq 0xcbf2f(%rip), %rax     # 0x142f50
movq (%rax), %rdi
movsd (%r13,%rbp,8), %xmm1
leaq 0x96241(%rip), %rsi     # 0x10d273
movb $0x2, %al
movq %r9, %rbx
callq 0x8510
movq %rbx, %r9
movsd 0x10(%rsp), %xmm0
movq 0x18(%rsp), %rax
cmpw $0x1, 0x4c6(%rax)
jne 0x7709b
movq -0x8(%r15,%rbp,8), %rcx
movslq 0x16c(%r14), %rax
cmpl $0x0, (%rcx,%rax,4)
jne 0x7709b
movq (%r15,%rbp,8), %rcx
cmpl $0x1, (%rcx,%rax,4)
jne 0x7709b
movq 0xcbed9(%rip), %rax     # 0x142f50
movq (%rax), %rdi
movsd (%r13,%rbp,8), %xmm1
leaq 0x96232(%rip), %rsi     # 0x10d2ba
movb $0x2, %al
movq %r9, %rbx
callq 0x8510
movq %rbx, %r9
movsd 0x10(%rsp), %xmm0
movq 0x38(%rsp), %rax
cmpw $0x1, 0x38(%rax)
jne 0x770ee
movq -0x8(%r15,%rbp,8), %rcx
movslq 0x168(%r14), %rax
cmpl $0x0, (%rcx,%rax,4)
jne 0x770ee
movq (%r15,%rbp,8), %rcx
cmpl $0x1, (%rcx,%rax,4)
jne 0x770ee
movq 0xcbe86(%rip), %rax     # 0x142f50
movq (%rax), %rdi
movsd (%r13,%rbp,8), %xmm1
leaq 0x9622b(%rip), %rsi     # 0x10d306
movb $0x2, %al
movq %r9, %rbx
callq 0x8510
movq %rbx, %r9
movsd 0x10(%rsp), %xmm0
movq 0x18(%rsp), %rax
cmpw $0x1, 0x4c4(%rax)
jne 0x77144
movq -0x8(%r15,%rbp,8), %rcx
movslq 0x170(%r14), %rax
cmpl $0x0, (%rcx,%rax,4)
jne 0x77144
movq (%r15,%rbp,8), %rcx
cmpl $0x1, (%rcx,%rax,4)
jne 0x77144
movq 0xcbe30(%rip), %rax     # 0x142f50
movq (%rax), %rdi
movsd (%r13,%rbp,8), %xmm1
leaq 0x9621d(%rip), %rsi     # 0x10d34e
movb $0x2, %al
movq %r9, %rbx
callq 0x8510
movq %rbx, %r9
movsd 0x10(%rsp), %xmm0
movq 0x18(%rsp), %rax
cmpw $0x1, 0x4be(%rax)
movq 0x8(%rsp), %rbx
jne 0x771a3
movq -0x8(%r15,%rbp,8), %rcx
movslq 0x174(%r14), %rax
cmpl $0x0, (%rcx,%rax,4)
jne 0x771a3
movq (%r15,%rbp,8), %rcx
cmpl $0x1, (%rcx,%rax,4)
jne 0x771a3
movq 0xcbdd5(%rip), %rax     # 0x142f50
movq (%rax), %rdi
movsd (%r13,%rbp,8), %xmm1
leaq 0x961fe(%rip), %rsi     # 0x10d38a
movb $0x2, %al
movq %r9, 0x20(%rsp)
callq 0x8510
movq 0x20(%rsp), %r9
movsd 0x10(%rsp), %xmm0
cmpw $0x1, 0x12(%rbx)
movq 0x60(%rsp), %rbx
jne 0x76ec8
movq 0x8(%rsp), %rax
cmpl %r12d, 0x84c(%rax)
jne 0x76ec8
movq -0x8(%r15,%rbp,8), %rax
movslq 0x160(%r14), %rcx
cmpl $0x0, (%rax,%rcx,4)
jne 0x77215
movq (%r15,%rbp,8), %rdx
cmpl $0x1, (%rdx,%rcx,4)
jne 0x77215
movq 0xcbd68(%rip), %rax     # 0x142f50
movq (%rax), %rdi
movsd (%r13,%rbp,8), %xmm1
leaq 0x961cf(%rip), %rsi     # 0x10d3c8
movb $0x2, %al
movq %r9, 0x20(%rsp)
callq 0x8510
movq 0x20(%rsp), %r9
movsd 0x10(%rsp), %xmm0
movq -0x8(%r15,%rbp,8), %rax
movslq 0x164(%r14), %rcx
cmpl $0x0, (%rax,%rcx,4)
jne 0x76ec8
movq (%r15,%rbp,8), %rax
cmpl $0x1, (%rax,%rcx,4)
jne 0x76ec8
movq 0xcbd15(%rip), %rax     # 0x142f50
movq (%rax), %rdi
movsd (%r13,%rbp,8), %xmm1
leaq 0x961cb(%rip), %rsi     # 0x10d417
movb $0x2, %al
movq %r9, %rbp
callq 0x8510
movq %rbp, %r9
movsd 0x10(%rsp), %xmm0
jmp 0x76ec8
leaq 0x95ce8(%rip), %rsi     # 0x10cf53
leaq 0x90(%rsp), %r14
movq %r14, %rdi
xorl %eax, %eax
callq 0x2e014
leaq 0x6ddfe(%rip), %rsi     # 0xe5082
leaq 0x95d28(%rip), %rdx     # 0x10cfb3
leaq 0x890(%rsp), %r15
movq %r15, %rdi
movq %r14, %rcx
xorl %eax, %eax
callq 0x2e014
movq 0x8(%rsp), %rdi
addq $0x6c8a, %rdi           # imm = 0x6C8A
leaq 0x6dd81(%rip), %rsi     # 0xe5034
leaq 0x95bab(%rip), %rdx     # 0x10ce65
movl $0xeb6, %ecx            # imm = 0xEB6
jmp 0x77348
movsd (%r13,%rbp,8), %xmm2
movsd -0x8(%r13,%rbp,8), %xmm1
addsd %xmm2, %xmm1
movsd 0x6e9d2(%rip), %xmm3    # 0xe5cb0
mulsd %xmm3, %xmm1
addsd 0x8(%r13,%rbp,8), %xmm2
mulsd %xmm3, %xmm2
leaq 0x95d69(%rip), %rsi     # 0x10d05d
leaq 0x90(%rsp), %r14
movq %r14, %rdi
movb $0x3, %al
callq 0x2e014
leaq 0x6dd75(%rip), %rsi     # 0xe5082
leaq 0x95de0(%rip), %rdx     # 0x10d0f4
leaq 0x890(%rsp), %r15
movq %r15, %rdi
movq %r14, %rcx
xorl %eax, %eax
callq 0x2e014
movq 0x8(%rsp), %rdi
addq $0x6c8a, %rdi           # imm = 0x6C8A
leaq 0x6dcf8(%rip), %rsi     # 0xe5034
leaq 0x95b22(%rip), %rdx     # 0x10ce65
movl $0xed7, %ecx            # imm = 0xED7
movq %r15, %r8
jmp 0x76b11
movq 0x48(%rsp), %rdi
callq 0x8430
movq 0x40(%rsp), %rdi
movq 0x18(%rsp), %rsi
movq 0x38(%rsp), %rdx
movq 0x8(%rsp), %rbx
movq %rbx, %rcx
movl %r12d, %r8d
movsd 0x10(%rsp), %xmm0
movsd 0x30(%rsp), %xmm1
movq %r14, %r9
callq 0x85c21
testl %eax, %eax
je 0x76b81
addq $0x6c8a, %rbx           # imm = 0x6C8A
leaq 0x6e052(%rip), %rsi     # 0xe53f0
leaq 0x95981(%rip), %rdx     # 0x10cd26
leaq 0x90(%rsp), %r14
movq %r14, %rdi
movq %rbx, %rcx
xorl %eax, %eax
callq 0x2e014
leaq 0x6dc73(%rip), %rsi     # 0xe5034
leaq 0x95a9d(%rip), %rdx     # 0x10ce65
movq %rbx, %rdi
movl $0xf28, %ecx            # imm = 0xF28
jmp 0x76b0e
movq 0x8(%rsp), %rbx
addq $0x6c8a, %rbx           # imm = 0x6C8A
leaq 0x6e008(%rip), %rsi     # 0xe53f0
leaq 0x95be8(%rip), %rdx     # 0x10cfd7
leaq 0x90(%rsp), %r14
movq %r14, %rdi
movq %rbx, %rcx
xorl %eax, %eax
callq 0x2e014
leaq 0x6dc29(%rip), %rsi     # 0xe5034
leaq 0x95a53(%rip), %rdx     # 0x10ce65
movq %rbx, %rdi
movl $0xec6, %ecx            # imm = 0xEC6
jmp 0x76b0e
movsd (%r13,%rbp,8), %xmm1
leaq 0x95d1b(%rip), %rsi     # 0x10d148
leaq 0x90(%rsp), %r14
movq %r14, %rdi
movb $0x2, %al
callq 0x2e014
leaq 0x6dc3c(%rip), %rsi     # 0xe5082
leaq 0x95dc2(%rip), %rdx     # 0x10d20f
leaq 0x890(%rsp), %r15
movq %r15, %rdi
movq %r14, %rcx
xorl %eax, %eax
callq 0x2e014
movq 0x8(%rsp), %rdi
addq $0x6c8a, %rdi           # imm = 0x6C8A
leaq 0x6dbbf(%rip), %rsi     # 0xe5034
leaq 0x959e9(%rip), %rdx     # 0x10ce65
movl $0xee5, %ecx            # imm = 0xEE5
jmp 0x77348