// File: /workspace/github_c_makefile_star2_O1/lesgourg[P]class_public/build/../source/input.c
// Function: input_shooting
int input_shooting(struct file_content * pfc,
                   struct precision * ppr,
                   struct background *pba,
                   struct thermodynamics *pth,
                   struct perturbations *ppt,
                   struct transfer *ptr,
                   struct primordial *ppm,
                   struct harmonic *phr,
                   struct fourier * pfo,
                   struct lensing *ple,
                   struct distortions *psd,
                   struct output *pop,
                   int input_verbose,
                   int * has_shooting,
                   ErrorMsg errmsg){

  /** Summary: */

  /** Define local variables */
  int flag1, flag2;
  double param1, param2;
  double * unknown_parameter;
  int unknown_parameters_size;
  int counter, index_target;
  int fevals=0;
  double xzero;
  double *dxdF, *x_inout;
  int target_indices[_NUM_TARGETS_];
  int needs_shooting;
  int shooting_failed=_FALSE_;

  /* array of parameters passed by the user for which we need shooting (= target parameters) */
  char * const target_namestrings[] = {"100*theta_s",
                                       "theta_s_100",
                                       "Neff",
                                       "Omega_dcdmdr",
                                       "omega_dcdmdr",
                                       "Omega_scf",
                                       "Omega_ini_dcdm",
                                       "omega_ini_dcdm"};

  /* array of corresponding parameters that must be adjusted in order to meet the target (= unknown parameters) */
  char * const unknown_namestrings[] = {"h",                        /* unknown param for target '100*theta_s' */
                                        "h",                        /* unknown param for target 'theta_s_100' */
                                        "N_ur",                     /* unknown param for target 'Neff' */
                                        "Omega_ini_dcdm",           /* unknown param for target 'Omega_dcdmd' */
                                        "omega_ini_dcdm",           /* unknown param for target 'omega_dcdmdr' */
                                        "scf_shooting_parameter",   /* unknown param for target 'Omega_scf' */
                                        "Omega_dcdmdr",             /* unknown param for target 'Omega_ini_dcdm' */
                                        "omega_dcdmdr"};             /* unknown param for target 'omega_ini_dcdm' */

  /* for each target, module up to which we need to run CLASS in order
     to compute the targetted quantities (not running the whole code
     each time to saves a lot of time) */
  enum computation_stage target_cs[] = {cs_thermodynamics, /* computation stage for target '100*theta_s' */
                                        cs_thermodynamics, /* computation stage for target 'theta_s_100' */
                                        cs_background,     /* computation stage for target 'Neff' */
                                        cs_background,     /* computation stage for target 'Omega_dcdmdr' */
                                        cs_background,     /* computation stage for target 'omega_dcdmdr' */
                                        cs_background,     /* computation stage for target 'Omega_scf' */
                                        cs_background,     /* computation stage for target 'Omega_ini_dcdm' */
                                        cs_background};     /* computation stage for target 'omega_ini_dcdm' */

  struct fzerofun_workspace fzw;

  *has_shooting=_FALSE_;

  /** Do we need to fix unknown parameters? */
  unknown_parameters_size = 0;
  fzw.required_computation_stage = 0;
  for (index_target = 0; index_target < _NUM_TARGETS_; index_target++){
    class_call(parser_read_double(pfc,target_namestrings[index_target],&param1,&flag1,errmsg),
               errmsg,
               errmsg);
    if (flag1 == _TRUE_){
      /* input_needs_shoting_for_target takes care of the case where, for
         instance, Omega_dcdmdr is set to 0.0, and we don't need shooting */
      class_call(input_needs_shooting_for_target(pfc,
                                                 index_target,
                                                 param1,
                                                 &needs_shooting,
                                                 errmsg),
                 errmsg,
                 errmsg);

      if (needs_shooting == _TRUE_){
        target_indices[unknown_parameters_size] = index_target;
        fzw.required_computation_stage = MAX(fzw.required_computation_stage,target_cs[index_target]);
        unknown_parameters_size++;
      }

    }
  }

  /** In the case of unknown parameters, start shooting... */
  if (unknown_parameters_size > 0) {

    /* We need to remember that we shot so we can clean up properly */
    *has_shooting=_TRUE_;

    /* Create file content structure with additional entries */
    class_call(parser_extend(pfc, unknown_parameters_size, errmsg),
               errmsg,errmsg);

    class_call(parser_init_from_pfc(pfc, &(fzw.fc), errmsg),
               errmsg,errmsg);

    class_alloc(unknown_parameter,
                unknown_parameters_size*sizeof(double),
                errmsg);
    class_alloc(fzw.unknown_parameters_index,
                unknown_parameters_size*sizeof(int),
                errmsg);

    fzw.target_size = unknown_parameters_size;
    class_alloc(fzw.target_name,
                fzw.target_size*sizeof(enum target_names),
                errmsg);
    class_alloc(fzw.target_value,
                fzw.target_size*sizeof(double),
                errmsg);

    /** Go through all cases with unknown parameters */
    for (counter = 0; counter < unknown_parameters_size; counter++){
      index_target = target_indices[counter];
      class_call(parser_read_double(pfc,
                                    target_namestrings[index_target],
                                    &param1,
                                    &flag1,
                                    errmsg),
                 errmsg,
                 errmsg);

      /* store name of target parameter */
      fzw.target_name[counter] = index_target;
      /* store target value of target parameter */
      fzw.target_value[counter] = param1;
      fzw.unknown_parameters_index[counter]=pfc->size+counter-unknown_parameters_size;
      /* substitute the name of the target parameter with the name of the
         corresponding unknown parameter */
      strcpy(fzw.fc.name[fzw.unknown_parameters_index[counter]],unknown_namestrings[index_target]);
    }

    /** If there is only one parameter, we use a more efficient Newton method for 1D cases */
    if (unknown_parameters_size == 1){

      /* We can do 1 dimensional root finding */
      if (input_verbose > 0) {
        printf("Computing unknown input parameter '%s' using input parameter '%s'\n",
               fzw.fc.name[fzw.unknown_parameters_index[0]],
               target_namestrings[fzw.target_name[0]]);
      }

      /* If shooting fails, postpone error to background module to play nice with MontePython. */
      class_call_try(input_find_root(&xzero,
                                     &fevals,
                                     ppr->tol_shooting_deltax_rel,
                                     &fzw,
                                     errmsg),
                     errmsg,
                     pba->shooting_error,
                     shooting_failed=_TRUE_);

      /* Store xzero */
      // This needs to be done with enough accuracy. A standard double has a relative
      // precision of around 1e-16, so 1e-20 should be good enough for the shooting
      class_sprintf(fzw.fc.value[fzw.unknown_parameters_index[0]],"%.20e",xzero);
      if (input_verbose > 0) {
        if (shooting_failed == _FALSE_){
          printf(" -> found '%s = %s'\n",
                  fzw.fc.name[fzw.unknown_parameters_index[0]],
                  fzw.fc.value[fzw.unknown_parameters_index[0]]);
        }
        else{
          printf("Shooting failed! Aborting...\n");
        }
      }

    }
    /** Otherwise we do multidimensional shooting */
    else{

      /* We need to do multidimensional root finding */
      if (input_verbose > 0) {
        printf("Computing unknown input parameters\n");
      }

      /* Allocate local variables */
      class_alloc(x_inout,
                  sizeof(double)*unknown_parameters_size,
                  errmsg);
      class_alloc(dxdF,
                  sizeof(double)*unknown_parameters_size,
                  errmsg);

      /* Get the guess for the initial variables */
      class_call(input_get_guess(x_inout, dxdF, &fzw, errmsg),
                 errmsg,
                 errmsg);

      /* Use multi-dimensional Newton method */
      class_call_try(fzero_Newton(input_try_unknown_parameters,
                                  x_inout,
                                  dxdF,
                                  unknown_parameters_size,
                                  ppr->tol_shooting_deltax,
                                  ppr->tol_shooting_deltaF,
                                  &fzw,
                                  &fevals,
                                  errmsg),
                     errmsg,
                     pba->shooting_error,
                     shooting_failed=_TRUE_);

      /* Store xzero */
      // This needs to be done with enough accuracy. A standard double has a relative
      // precision of around 1e-16, so 1e-20 should be good enough for the shooting
      for (counter = 0; counter < unknown_parameters_size; counter++){
        class_sprintf(fzw.fc.value[fzw.unknown_parameters_index[counter]],
                "%.20e",x_inout[counter]);
        if (input_verbose > 0) {
          if (shooting_failed == _FALSE_){
            printf(" -> found '%s = %s'\n",
                    fzw.fc.name[fzw.unknown_parameters_index[counter]],
                    fzw.fc.value[fzw.unknown_parameters_index[counter]]);
          }
          else{
            printf("Shooting failed! Aborting...\n");
          }
        }
      }

      /* Free local variables */
      free(x_inout);
      free(dxdF);
    }

    if (input_verbose > 1 && shooting_failed == _FALSE_) {
      printf("Shooting completed using %d function evaluations\n",fevals);
    }

    /** Set status of shooting */
    pba->shooting_failed = shooting_failed;

    parser_copy(&(fzw.fc), pfc, pfc->size - unknown_parameters_size, pfc->size);

    /** Free arrays allocated */
    class_call(parser_free(&(fzw.fc)),
               errmsg, errmsg);
    free(unknown_parameter);
    free(fzw.unknown_parameters_index);
    free(fzw.target_name);
    free(fzw.target_value);
  }


  /** After the 'normal' shooting is done, do special shooting just for sigma8 if needed*/
  class_call(parser_read_double(pfc,"sigma8",&param1,&flag1,errmsg),
             errmsg,
             errmsg);
  class_call(parser_read_double(pfc,"S8",&param2,&flag2,errmsg),
             errmsg,
             errmsg);
  class_test((flag1 == _TRUE_) && (flag2 == _TRUE_),
             errmsg,
             "You can only enter one of 'sigma8' or 'S8'.");
  if (flag1 == _TRUE_ || flag2 == _TRUE_) {
    /* Tell the main function that shooting indeed has occured */
    *has_shooting=_TRUE_;

    /* Create file content structure with additional entries */
    class_call(parser_extend(pfc, 1, errmsg),
               errmsg,errmsg);

    class_call(parser_init_from_pfc(pfc, &(fzw.fc), errmsg),
               errmsg,errmsg);

    fzw.target_size = 1;
    class_alloc(fzw.unknown_parameters_index,
                1*sizeof(int),
                errmsg);
    class_alloc(fzw.target_name,
                1*sizeof(enum target_names),
                errmsg);
    class_alloc(fzw.target_value,
                1*sizeof(double),
                errmsg);

    /* store name of target parameter */
    if (flag1 == _TRUE_) {
      fzw.target_name[0] = sigma8;
      fzw.target_value[0] = param1;
    }
    else if (flag2 == _TRUE_) {
      fzw.target_name[0] = S8;
      fzw.target_value[0] = param2;
    }
    /* store target value of target parameter */
    fzw.unknown_parameters_index[0]=pfc->size - 1;
    fzw.required_computation_stage = cs_nonlinear;
    /* substitute the name of the target parameter with the name of the
       corresponding unknown parameter */
    strcpy(fzw.fc.name[pfc->size - 1],"A_s");

    /* Print to the user */
    if (input_verbose > 0) {
      printf("Computing unknown input parameter '%s' using input parameter '%s'\n",
             (flag1 ==_TRUE_?"sigma8":"S8"),
             "A_s");
    }

    /* Set a guess for A_s from LCDM (doesn't need to be super accurate) */
    double A_s;
    if (flag1 == _TRUE_) {
      A_s = param1 * 2.43e-9/0.87659;
    }
    else if (flag2 == _TRUE_) {
      A_s = param2 *2.43e-9/0.891;
    }
    double sigma8_or_S8;

    /* Now run for a single time, get the value of sigma8 (or S8) for the guess*/
    class_call(input_try_unknown_parameters(&A_s,
                                            1,
                                            &fzw,
                                            &sigma8_or_S8,
                                            errmsg),
               errmsg,
               errmsg);

    A_s = (fzw.target_value[0]/sigma8_or_S8) *(fzw.target_value[0]/sigma8_or_S8) * A_s; //(truesigma/sigma_for_guess)^2 *A_s_for_guess

    /* Store the derived value with high enough accuracy */
    class_sprintf(fzw.fc.value[pfc->size - 1],"%.20e",A_s);
    if (input_verbose > 0) {
      printf(" -> found '%s = %s'\n",
             fzw.fc.name[pfc->size - 1],
             fzw.fc.value[pfc->size - 1]);
    }

    parser_copy(&(fzw.fc), pfc, pfc->size - 1, pfc->size);

    /** Free arrays allocated */
    class_call(parser_free(&(fzw.fc)),
               errmsg, errmsg);
    free(fzw.unknown_parameters_index);
    free(fzw.target_name);
    free(fzw.target_value);
  }

  return _SUCCESS_;

}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x10d8, %rsp           # imm = 0x10D8
movq %rdx, 0x90(%rsp)
movq %rsi, 0x30(%rsp)
movq 0x1148(%rsp), %rax
movl $0xfffffff8, %ecx       # imm = 0xFFFFFFF8
xorl %ebx, %ebx
movl %ebx, 0x28(%rsp)
movl %ebx, (%rax)
movl %ebx, 0x84(%rsp)
leaq 0xbfa2e(%rip), %r14     # 0xfa380
leaq 0xfad47(%rip), %r15     # 0x1356a0
leaq 0x38(%rsp), %r13
leaq 0x14(%rsp), %r12
leaq 0x3(%rcx), %rbp
movq $0x0, 0x18(%rsp)
movq %rdi, 0x20(%rsp)
movq (%r15), %rsi
movq %r13, %rdx
movq %r12, %rcx
movq 0x1150(%rsp), %r8
callq 0x1e87c
cmpl $0x1, %eax
je 0x3aa75
cmpl $0x1, 0x14(%rsp)
jne 0x3a9e5
movl $0xfffffff8, %eax       # imm = 0xFFFFFFF8
addq %rbx, %rax
cmpq %rbp, %rax
jb 0x3a9ba
movsd 0x38(%rsp), %xmm0
ucomisd 0xa68a2(%rip), %xmm0    # 0xe1258
jne 0x3a9ba
jnp 0x3a9e5
movl 0x84(%rsp), %eax
movl (%r14), %ecx
cmpl %ecx, %eax
cmoval %eax, %ecx
movq 0x18(%rsp), %rax
cltq
movl %ebx, 0xb0(%rsp,%rax,4)
movl %ecx, 0x84(%rsp)
incl %eax
movq %rax, 0x18(%rsp)
incq %rbx
addq $0x4, %r14
addq $0x8, %r15
cmpq $0x8, %rbx
movq 0x20(%rsp), %rdi
jne 0x3a975
movq 0x18(%rsp), %r15
testl %r15d, %r15d
movq 0x1150(%rsp), %rbx
jle 0x3b20e
movq 0x1148(%rsp), %rax
movl $0x1, (%rax)
movl %r15d, %esi
movq %rbx, %rdx
movq %rdi, %r14
callq 0x1fbdd
cmpl $0x1, %eax
jne 0x3aadb
leaq 0xa69af(%rip), %rsi     # 0xe13f0
leaq 0xab9c4(%rip), %rdx     # 0xe640c
leaq 0xd0(%rsp), %r14
movq %r14, %rdi
movq %rbx, %rcx
xorl %eax, %eax
callq 0x30c2c
leaq 0xa65d0(%rip), %rsi     # 0xe1034
leaq 0xab992(%rip), %rdx     # 0xe63fd
movq %rbx, %rdi
movl $0x259, %ecx            # imm = 0x259
jmp 0x3aab6
leaq 0xa6974(%rip), %rsi     # 0xe13f0
leaq 0xab92b(%rip), %rdx     # 0xe63ae
leaq 0xd0(%rsp), %r14
movq %r14, %rdi
movq 0x1150(%rsp), %rbx
movq %rbx, %rcx
xorl %eax, %eax
callq 0x30c2c
leaq 0xa658d(%rip), %rsi     # 0xe1034
leaq 0xab94f(%rip), %rdx     # 0xe63fd
movq %rbx, %rdi
movl $0x23c, %ecx            # imm = 0x23C
movq %r14, %r8
xorl %eax, %eax
callq 0x30c2c
movl $0x1, %r15d
movl %r15d, %eax
addq $0x10d8, %rsp           # imm = 0x10D8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x48(%rsp), %rsi
movq %r14, %rdi
movq %rbx, %rdx
callq 0x1fde6
cmpl $0x1, %eax
jne 0x3ab2b
leaq 0xa68f9(%rip), %rsi     # 0xe13f0
leaq 0xab942(%rip), %rdx     # 0xe6440
leaq 0xd0(%rsp), %r14
movq %r14, %rdi
movq %rbx, %rcx
xorl %eax, %eax
callq 0x30c2c
leaq 0xa651a(%rip), %rsi     # 0xe1034
leaq 0xab8dc(%rip), %rdx     # 0xe63fd
movq %rbx, %rdi
movl $0x25c, %ecx            # imm = 0x25C
jmp 0x3aab6
movl %r15d, %r13d
leaq (,%r13,4), %r12
movq %r12, %rdi
callq 0x8460
movq %rax, 0x40(%rsp)
testq %rax, %rax
je 0x3ad0e
movl %r15d, 0x80(%rsp)
movq %r12, %rdi
callq 0x8460
movq %rax, 0x70(%rsp)
testq %rax, %rax
je 0x3ad4c
leaq (,%r13,8), %rdi
callq 0x8460
movq %rax, 0x78(%rsp)
testq %rax, %rax
je 0x3ad8e
leaq (,%r13,8), %rax
movq %rax, 0x88(%rsp)
movl %r15d, %r14d
negl %r14d
xorl %r15d, %r15d
leaq 0xab0bb(%rip), %rbp     # 0xe5c60
movq 0x20(%rsp), %r12
movl 0xb0(%rsp,%r15,4), %eax
movslq %eax, %rbx
leaq 0xfaae4(%rip), %rax     # 0x1356a0
movq (%rax,%rbx,8), %rsi
movq %r12, %rdi
leaq 0x38(%rsp), %rdx
leaq 0x14(%rsp), %rcx
movq 0x1150(%rsp), %r8
callq 0x1e87c
cmpl $0x1, %eax
je 0x3add0
movq 0x70(%rsp), %rax
movl %ebx, (%rax,%r15,4)
movsd 0x38(%rsp), %xmm0
movq 0x78(%rsp), %rax
movsd %xmm0, (%rax,%r15,8)
leal (%r14,%r15), %eax
addl 0x8(%r12), %eax
movq 0x40(%rsp), %rcx
movl %eax, (%rcx,%r15,4)
movslq %eax, %rdi
shlq $0xa, %rdi
addq 0x58(%rsp), %rdi
movslq (%rbp,%rbx,4), %rsi
addq %rbp, %rsi
callq 0x8350
incq %r15
cmpq %r15, %r13
jne 0x3abaa
movq 0x18(%rsp), %r15
cmpl $0x1, %r15d
jne 0x3ae16
cmpl $0x0, 0x1140(%rsp)
movq 0x1150(%rsp), %rbx
jle 0x3ac86
movq 0x40(%rsp), %rax
movq 0x70(%rsp), %rcx
movslq (%rax), %rsi
shlq $0xa, %rsi
addq 0x58(%rsp), %rsi
movl (%rcx), %eax
leaq 0xfaa2c(%rip), %rcx     # 0x1356a0
movq (%rcx,%rax,8), %rdx
leaq 0xab87f(%rip), %rdi     # 0xe64fe
xorl %eax, %eax
callq 0x8030
movq 0x30(%rsp), %rax
movsd 0x78(%rax), %xmm0
leaq 0xa8(%rsp), %rdi
leaq 0x28(%rsp), %rsi
leaq 0x40(%rsp), %rdx
movq %rbx, %rcx
callq 0x3cd7e
movl %eax, %ebp
testl %eax, %eax
je 0x3aebd
leaq 0xa6735(%rip), %rsi     # 0xe13f0
leaq 0xab87f(%rip), %rdx     # 0xe6541
leaq 0xd0(%rsp), %r12
movq %r12, %rdi
movq %rbx, %rcx
xorl %eax, %eax
callq 0x30c2c
movq 0x90(%rsp), %rax
leaq 0x382(%rax), %rdi
leaq 0xa6347(%rip), %rsi     # 0xe1034
leaq 0xab709(%rip), %rdx     # 0xe63fd
movl $0x294, %ecx            # imm = 0x294
movq %r12, %r8
xorl %eax, %eax
callq 0x30c2c
movl $0x1, %r14d
jmp 0x3aec0
leaq 0xa62ef(%rip), %rsi     # 0xe1004
leaq 0xab751(%rip), %rdx     # 0xe646d
leaq 0xd0(%rsp), %r14
movq %r14, %rdi
movl %r12d, %ecx
xorl %eax, %eax
callq 0x30c2c
leaq 0xa62fc(%rip), %rsi     # 0xe1034
leaq 0xab6be(%rip), %rdx     # 0xe63fd
movq %rbx, %rdi
movl $0x263, %ecx            # imm = 0x263
jmp 0x3aab6
shll $0x2, %r15d
leaq 0xa62ad(%rip), %rsi     # 0xe1004
leaq 0xab72c(%rip), %rdx     # 0xe648a
leaq 0xd0(%rsp), %r14
movq %r14, %rdi
movl %r15d, %ecx
xorl %eax, %eax
callq 0x30c2c
leaq 0xa62ba(%rip), %rsi     # 0xe1034
leaq 0xab67c(%rip), %rdx     # 0xe63fd
movq %rbx, %rdi
movl $0x268, %ecx            # imm = 0x268
jmp 0x3aab6
shll $0x3, %r15d
leaq 0xa626b(%rip), %rsi     # 0xe1004
leaq 0xab6fa(%rip), %rdx     # 0xe649a
leaq 0xd0(%rsp), %r14
movq %r14, %rdi
movl %r15d, %ecx
xorl %eax, %eax
callq 0x30c2c
leaq 0xa6278(%rip), %rsi     # 0xe1034
leaq 0xab63a(%rip), %rdx     # 0xe63fd
movq %rbx, %rdi
movl $0x26b, %ecx            # imm = 0x26B
jmp 0x3aab6
leaq 0xa6619(%rip), %rsi     # 0xe13f0
leaq 0xab6cd(%rip), %rdx     # 0xe64ab
leaq 0xd0(%rsp), %r14
movq %r14, %rdi
movq 0x1150(%rsp), %rbx
movq %rbx, %rcx
xorl %eax, %eax
callq 0x30c2c
leaq 0xa6232(%rip), %rsi     # 0xe1034
leaq 0xab5f4(%rip), %rdx     # 0xe63fd
movq %rbx, %rdi
movl $0x276, %ecx            # imm = 0x276
jmp 0x3aab6
cmpl $0x0, 0x1140(%rsp)
movq 0x1150(%rsp), %rbx
jle 0x3ae34
leaq 0xbf3be(%rip), %rdi     # 0xfa1ed
callq 0x8510
movq 0x88(%rsp), %rbp
movq %rbp, %rdi
callq 0x8460
testq %rax, %rax
je 0x3af37
movq %rax, %r14
movq %rbp, %rdi
callq 0x8460
testq %rax, %rax
je 0x3af74
movq %rax, %r12
leaq 0x40(%rsp), %rdx
movq %r14, %rdi
movq %rax, %rsi
movq %rbx, %rcx
callq 0x3d035
testl %eax, %eax
je 0x3afe0
leaq 0xa656a(%rip), %rsi     # 0xe13f0
leaq 0xab723(%rip), %rdx     # 0xe65b0
leaq 0xd0(%rsp), %r14
movq %r14, %rdi
movq %rbx, %rcx
xorl %eax, %eax
callq 0x30c2c
leaq 0xa618b(%rip), %rsi     # 0xe1034
leaq 0xab54d(%rip), %rdx     # 0xe63fd
movq %rbx, %rdi
movl $0x2b9, %ecx            # imm = 0x2B9
jmp 0x3aab6
xorl %r14d, %r14d
movsd 0xa8(%rsp), %xmm0
movsd %xmm0, 0x30(%rsp)
leaq 0xa84ce(%rip), %r12     # 0xe33a4
xorl %edi, %edi
xorl %esi, %esi
movq %r12, %rdx
movb $0x1, %al
callq 0x8550
movq 0x40(%rsp), %rcx
movslq (%rcx), %rdi
shlq $0xa, %rdi
addq 0x60(%rsp), %rdi
incl %eax
movslq %eax, %rsi
movq %r12, %rdx
movsd 0x30(%rsp), %xmm0
movb $0x1, %al
callq 0x8550
cmpl $0x0, 0x1140(%rsp)
jle 0x3b152
testl %ebp, %ebp
je 0x3afb1
leaq 0xbf2e9(%rip), %rdi     # 0xfa210
callq 0x8510
movl $0x1, %r14d
jmp 0x3b152
leaq 0xa60c6(%rip), %rsi     # 0xe1004
leaq 0xab65e(%rip), %rdx     # 0xe65a3
leaq 0xd0(%rsp), %r14
movq %r14, %rdi
movl %ebp, %ecx
xorl %eax, %eax
callq 0x30c2c
leaq 0xa60d4(%rip), %rsi     # 0xe1034
leaq 0xab496(%rip), %rdx     # 0xe63fd
movq %rbx, %rdi
movl $0x2b1, %ecx            # imm = 0x2B1
jmp 0x3aab6
leaq 0xa6089(%rip), %rsi     # 0xe1004
leaq 0xab629(%rip), %rdx     # 0xe65ab
leaq 0xd0(%rsp), %r14
movq %r14, %rdi
movl %ebp, %ecx
xorl %eax, %eax
callq 0x30c2c
leaq 0xa6097(%rip), %rsi     # 0xe1034
leaq 0xab459(%rip), %rdx     # 0xe63fd
movq %rbx, %rdi
movl $0x2b4, %ecx            # imm = 0x2B4
jmp 0x3aab6
movq 0x40(%rsp), %rax
movslq (%rax), %rdx
shlq $0xa, %rdx
movq 0x58(%rsp), %rsi
addq %rdx, %rsi
addq 0x60(%rsp), %rdx
leaq 0xab5bd(%rip), %rdi     # 0xe658e
xorl %r14d, %r14d
xorl %eax, %eax
callq 0x8030
jmp 0x3b152
movq 0x30(%rsp), %rax
movsd 0x68(%rax), %xmm0
movsd 0x70(%rax), %xmm1
movq %rbx, (%rsp)
leaq 0x266b(%rip), %rdi      # 0x3d665
leaq 0x40(%rsp), %r8
leaq 0x28(%rsp), %r9
movq %r14, %rbp
movq %r14, %rsi
movq %r12, 0x88(%rsp)
movq %r12, %rdx
movl %r13d, %ecx
callq 0x12015
movl %eax, %r13d
xorl %eax, %eax
cmpl $0x1, %r13d
jne 0x3b07c
leaq 0xa63c1(%rip), %rsi     # 0xe13f0
leaq 0xab5a7(%rip), %rdx     # 0xe65dd
leaq 0xd0(%rsp), %r12
movq %r12, %rdi
movq %rbx, %rcx
xorl %eax, %eax
callq 0x30c2c
movq 0x90(%rsp), %rax
leaq 0x382(%rax), %rdi
leaq 0xa5fd3(%rip), %rsi     # 0xe1034
leaq 0xab395(%rip), %rdx     # 0xe63fd
movl $0x2c7, %ecx            # imm = 0x2C7
movq %r12, %r8
xorl %eax, %eax
callq 0x30c2c
movl $0x1, %eax
movl %eax, 0x30(%rsp)
cmpl $0x2, %r15d
movl $0x1, %ebx
movq %r15, 0x18(%rsp)
cmovgel %r15d, %ebx
leaq 0xa830b(%rip), %r12     # 0xe33a4
xorl %r14d, %r14d
movsd (%rbp,%r14,8), %xmm0
xorl %edi, %edi
xorl %esi, %esi
movq %r12, %rdx
movb $0x1, %al
callq 0x8550
movq 0x40(%rsp), %rcx
movslq (%rcx,%r14,4), %rdi
shlq $0xa, %rdi
addq 0x60(%rsp), %rdi
incl %eax
movslq %eax, %rsi
movsd (%rbp,%r14,8), %xmm0
movq %r12, %rdx
movb $0x1, %al
callq 0x8550
cmpl $0x0, 0x1140(%rsp)
jle 0x3b11f
cmpl $0x1, %r13d
jne 0x3b0f7
leaq 0xbf120(%rip), %rdi     # 0xfa210
callq 0x8510
jmp 0x3b11f
movq 0x40(%rsp), %rax
movslq (%rax,%r14,4), %rdx
shlq $0xa, %rdx
movq 0x58(%rsp), %rsi
addq %rdx, %rsi
addq 0x60(%rsp), %rdx
leaq 0xab476(%rip), %rdi     # 0xe658e
xorl %eax, %eax
callq 0x8030
incq %r14
cmpq %r14, %rbx
jne 0x3b09c
movq %rbp, %rdi
callq 0x8410
movq 0x88(%rsp), %rdi
callq 0x8410
movq 0x1150(%rsp), %rbx
movq 0x18(%rsp), %r15
movl 0x30(%rsp), %r14d
cmpl $0x2, 0x1140(%rsp)
setl %al
movl %r14d, %ecx
orb %al, %cl
jne 0x3b176
movl 0x28(%rsp), %esi
leaq 0xab50c(%rip), %rdi     # 0xe667b
xorl %eax, %eax
callq 0x8030
movq 0x90(%rsp), %rax
movw %r14w, 0x380(%rax)
movq 0x20(%rsp), %rsi
movl 0x8(%rsi), %ecx
movl %ecx, %edx
subl %r15d, %edx
leaq 0x48(%rsp), %r14
movq %r14, %rdi
callq 0x1fd66
movq %r14, %rdi
callq 0x1e68f
cmpl $0x1, %eax
jne 0x3b1eb
leaq 0xa623c(%rip), %rsi     # 0xe13f0
leaq 0xab4f2(%rip), %rdx     # 0xe66ad
leaq 0xd0(%rsp), %r14
movq %r14, %rdi
movq %rbx, %rcx
xorl %eax, %eax
callq 0x30c2c
leaq 0xa5e5d(%rip), %rsi     # 0xe1034
leaq 0xab21f(%rip), %rdx     # 0xe63fd
movq %rbx, %rdi
movl $0x2eb, %ecx            # imm = 0x2EB
jmp 0x3aab6
movq 0x40(%rsp), %rdi
callq 0x8410
movq 0x70(%rsp), %rdi
callq 0x8410
movq 0x78(%rsp), %rdi
callq 0x8410
movq 0x20(%rsp), %rdi
leaq 0xd13f9(%rip), %r12     # 0x10c60e
leaq 0x38(%rsp), %rbp
leaq 0x14(%rsp), %rcx
movq %r12, %rsi
movq %rbp, %rdx
movq %rbx, %r8
movq %rdi, %r14
callq 0x1e87c
cmpl $0x1, %eax
jne 0x3b273
leaq 0xa61b4(%rip), %rsi     # 0xe13f0
leaq 0xab481(%rip), %rdx     # 0xe66c4
leaq 0xd0(%rsp), %r14
movq %r14, %rdi
movq %rbx, %rcx
xorl %eax, %eax
callq 0x30c2c
leaq 0xa5dd5(%rip), %rsi     # 0xe1034
leaq 0xab197(%rip), %rdx     # 0xe63fd
movq %rbx, %rdi
movl $0x2f6, %ecx            # imm = 0x2F6
jmp 0x3aab6
leaq 0xab481(%rip), %r13     # 0xe66fb
leaq 0x98(%rsp), %rdx
leaq 0x2c(%rsp), %rcx
movq %r14, %rdi
movq %r13, %rsi
movq %rbx, %r8
callq 0x1e87c
cmpl $0x1, %eax
jne 0x3b2d8
leaq 0xa614f(%rip), %rsi     # 0xe13f0
leaq 0xab456(%rip), %rdx     # 0xe66fe
leaq 0xd0(%rsp), %r14
movq %r14, %rdi
movq %rbx, %rcx
xorl %eax, %eax
callq 0x30c2c
leaq 0xa5d70(%rip), %rsi     # 0xe1034
leaq 0xab132(%rip), %rdx     # 0xe63fd
movq %rbx, %rdi
movl $0x2f9, %ecx            # imm = 0x2F9
jmp 0x3aab6
movl 0x14(%rsp), %eax
movl %eax, %edx
xorl $0x1, %edx
movl 0x2c(%rsp), %ecx
movl %ecx, %esi
xorl $0x1, %esi
orl %edx, %esi
jne 0x3b348
leaq 0xab43c(%rip), %rsi     # 0xe6731
leaq 0xd0(%rsp), %r14
movq %r14, %rdi
xorl %eax, %eax
callq 0x30c2c
leaq 0xa5d74(%rip), %rsi     # 0xe1082
leaq 0xab448(%rip), %rdx     # 0xe675d
leaq 0x8d0(%rsp), %r15
movq %r15, %rdi
movq %r14, %rcx
xorl %eax, %eax
callq 0x30c2c
leaq 0xa5d03(%rip), %rsi     # 0xe1034
leaq 0xab0c5(%rip), %rdx     # 0xe63fd
movq %rbx, %rdi
movl $0x2fc, %ecx            # imm = 0x2FC
movq %r15, %r8
jmp 0x3aab9
cmpl $0x1, %ecx
sete %cl
cmpl $0x1, %eax
sete %al
orb %cl, %al
xorl %r15d, %r15d
cmpb $0x1, %al
jne 0x3aac6
movq 0x1148(%rsp), %rax
movl $0x1, (%rax)
movl $0x1, %r15d
movq 0x20(%rsp), %r14
movq %r14, %rdi
movl $0x1, %esi
movq %rbx, %rdx
callq 0x1fbdd
cmpl $0x1, %eax
jne 0x3b3d7
leaq 0xa605a(%rip), %rsi     # 0xe13f0
leaq 0xab3e7(%rip), %rdx     # 0xe6784
leaq 0xd0(%rsp), %r14
movq %r14, %rdi
movq %rbx, %rcx
xorl %eax, %eax
callq 0x30c2c
leaq 0xa5c7b(%rip), %rsi     # 0xe1034
leaq 0xab03d(%rip), %rdx     # 0xe63fd
movq %rbx, %rdi
movl $0x303, %ecx            # imm = 0x303
movq %r14, %r8
xorl %eax, %eax
callq 0x30c2c
jmp 0x3aac6
leaq 0x48(%rsp), %rsi
movq %r14, %rdi
movq %rbx, %rdx
callq 0x1fde6
cmpl $0x1, %eax
jne 0x3b42a
leaq 0xa5ffd(%rip), %rsi     # 0xe13f0
leaq 0xab046(%rip), %rdx     # 0xe6440
leaq 0xd0(%rsp), %r14
movq %r14, %rdi
movq %rbx, %rcx
xorl %eax, %eax
callq 0x30c2c
leaq 0xa5c1e(%rip), %rsi     # 0xe1034
leaq 0xaafe0(%rip), %rdx     # 0xe63fd
movq %rbx, %rdi
movl $0x306, %ecx            # imm = 0x306
jmp 0x3aab6
movl $0x1, 0x80(%rsp)
movl $0x4, %edi
callq 0x8460
movq %rax, 0x40(%rsp)
testq %rax, %rax
je 0x3b52e
movq %rax, %r15
movl $0x4, %edi
callq 0x8460
movq %rax, 0x70(%rsp)
testq %rax, %rax
je 0x3b56e
movq %rax, %r14
movl $0x8, %edi
callq 0x8460
movq %rax, 0x78(%rsp)
testq %rax, %rax
je 0x3b5ae
movl $0x8, %ecx
cmpl $0x1, 0x14(%rsp)
je 0x3b4a3
movl $0x9, %ecx
cmpl $0x1, 0x2c(%rsp)
leaq 0x98(%rsp), %rbp
jne 0x3b4af
movl %ecx, (%r14)
movsd (%rbp), %xmm0
movsd %xmm0, (%rax)
movq 0x20(%rsp), %rax
movslq 0x8(%rax), %rax
leal -0x1(%rax), %ecx
movl %ecx, (%r15)
movl $0x4, 0x84(%rsp)
movq 0x58(%rsp), %rcx
shlq $0xa, %rax
movl $0x735f41, -0x400(%rcx,%rax) # imm = 0x735F41
cmpl $0x0, 0x1140(%rsp)
jle 0x3b508
cmpl $0x1, 0x14(%rsp)
cmoveq %r12, %r13
leaq 0xab007(%rip), %rdi     # 0xe64fe
leaq 0xb8717(%rip), %rdx     # 0xf3c15
movq %r13, %rsi
xorl %eax, %eax
callq 0x8030
cmpl $0x1, 0x14(%rsp)
jne 0x3b5ee
movsd 0x38(%rsp), %xmm0
mulsd 0xaa54f(%rip), %xmm0    # 0xe5a70
divsd 0xaa557(%rip), %xmm0    # 0xe5a80
jmp 0x3b60e
leaq 0xa5acf(%rip), %rsi     # 0xe1004
leaq 0xaaf31(%rip), %rdx     # 0xe646d
leaq 0xd0(%rsp), %r14
movq %r14, %rdi
movl $0x4, %ecx
xorl %eax, %eax
callq 0x30c2c
leaq 0xa5ada(%rip), %rsi     # 0xe1034
leaq 0xaae9c(%rip), %rdx     # 0xe63fd
movq %rbx, %rdi
movl $0x30b, %ecx            # imm = 0x30B
jmp 0x3aab6
leaq 0xa5a8f(%rip), %rsi     # 0xe1004
leaq 0xaaf0e(%rip), %rdx     # 0xe648a
leaq 0xd0(%rsp), %r14
movq %r14, %rdi
movl $0x4, %ecx
xorl %eax, %eax
callq 0x30c2c
leaq 0xa5a9a(%rip), %rsi     # 0xe1034
leaq 0xaae5c(%rip), %rdx     # 0xe63fd
movq %rbx, %rdi
movl $0x30e, %ecx            # imm = 0x30E
jmp 0x3aab6
leaq 0xa5a4f(%rip), %rsi     # 0xe1004
leaq 0xaaede(%rip), %rdx     # 0xe649a
leaq 0xd0(%rsp), %r14
movq %r14, %rdi
movl $0x8, %ecx
xorl %eax, %eax
callq 0x30c2c
leaq 0xa5a5a(%rip), %rsi     # 0xe1034
leaq 0xaae1c(%rip), %rdx     # 0xe63fd
movq %rbx, %rdi
movl $0x311, %ecx            # imm = 0x311
jmp 0x3aab6
cmpl $0x1, 0x2c(%rsp)
jne 0x3b617
movsd 0x98(%rsp), %xmm0
mulsd 0xaa46a(%rip), %xmm0    # 0xe5a70
divsd 0xaa46a(%rip), %xmm0    # 0xe5a78
movsd %xmm0, 0x8d0(%rsp)
leaq 0x8d0(%rsp), %rdi
leaq 0x40(%rsp), %rdx
leaq 0xa0(%rsp), %rcx
movl $0x1, %esi
movq %rbx, %r8
callq 0x3d665
testl %eax, %eax
je 0x3b67b
leaq 0xa5dac(%rip), %rsi     # 0xe13f0
leaq 0xab157(%rip), %rdx     # 0xe67a2
leaq 0xd0(%rsp), %r14
movq %r14, %rdi
movq %rbx, %rcx
xorl %eax, %eax
callq 0x30c2c
leaq 0xa59cd(%rip), %rsi     # 0xe1034
leaq 0xaad8f(%rip), %rdx     # 0xe63fd
movq %rbx, %rdi
movl $0x33b, %ecx            # imm = 0x33B
jmp 0x3aab6
movq 0x78(%rsp), %rax
movsd (%rax), %xmm0
divsd 0xa0(%rsp), %xmm0
mulsd %xmm0, %xmm0
mulsd 0x8d0(%rsp), %xmm0
movsd %xmm0, 0x8d0(%rsp)
movsd %xmm0, 0x18(%rsp)
leaq 0xa7cf4(%rip), %r15     # 0xe33a4
xorl %edi, %edi
xorl %esi, %esi
movq %r15, %rdx
movb $0x1, %al
callq 0x8550
movq 0x60(%rsp), %rcx
movq 0x20(%rsp), %r14
movslq 0x8(%r14), %rdx
shlq $0xa, %rdx
leaq (%rcx,%rdx), %rdi
addq $-0x400, %rdi           # imm = 0xFC00
incl %eax
movslq %eax, %rsi
movq %r15, %rdx
movsd 0x18(%rsp), %xmm0
movb $0x1, %al
callq 0x8550
cmpl $0x0, 0x1140(%rsp)
jle 0x3b724
movslq 0x8(%r14), %rdx
shlq $0xa, %rdx
addq $-0x400, %rdx           # imm = 0xFC00
movq 0x58(%rsp), %rsi
addq %rdx, %rsi
addq 0x60(%rsp), %rdx
leaq 0xaae71(%rip), %rdi     # 0xe658e
xorl %eax, %eax
callq 0x8030
movl 0x8(%r14), %ecx
leal -0x1(%rcx), %edx
leaq 0x48(%rsp), %r15
movq %r15, %rdi
movq %r14, %rsi
callq 0x1fd66
movq %r15, %rdi
callq 0x1e68f
cmpl $0x1, %eax
jne 0x3b786
leaq 0xa5ca1(%rip), %rsi     # 0xe13f0
leaq 0xaaf57(%rip), %rdx     # 0xe66ad
leaq 0xd0(%rsp), %r14
movq %r14, %rdi
movq %rbx, %rcx
xorl %eax, %eax
callq 0x30c2c
leaq 0xa58c2(%rip), %rsi     # 0xe1034
leaq 0xaac84(%rip), %rdx     # 0xe63fd
movq %rbx, %rdi
movl $0x34b, %ecx            # imm = 0x34B
jmp 0x3aab6
movq 0x40(%rsp), %rdi
callq 0x8410
movq 0x70(%rsp), %rdi
callq 0x8410
movq 0x78(%rsp), %rdi
callq 0x8410
xorl %r15d, %r15d
jmp 0x3aac6