// File: /workspace/github_c_makefile_star2_O3/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, 0x18(%rsp)
movq 0x1148(%rsp), %rax
movl $0xfffffff8, %ecx       # imm = 0xFFFFFFF8
xorl %ebx, %ebx
movl %ebx, 0x28(%rsp)
movl %ebx, (%rax)
movl %ebx, 0x7c(%rsp)
leaq 0xbee43(%rip), %r14     # 0xf83b0
leaq 0xf915c(%rip), %r15     # 0x1326d0
leaq 0x30(%rsp), %r13
leaq 0xc(%rsp), %r12
leaq 0x3(%rcx), %rbp
movq $0x0, 0x10(%rsp)
movq %rdi, 0x20(%rsp)
movq (%r15), %rsi
movq %r13, %rdx
movq %r12, %rcx
movq 0x1150(%rsp), %r8
callq 0x1e8ed
cmpl $0x1, %eax
je 0x39686
cmpl $0x1, 0xc(%rsp)
jne 0x395fa
movl $0xfffffff8, %eax       # imm = 0xFFFFFFF8
addq %rbx, %rax
cmpq %rbp, %rax
jb 0x395d5
movsd 0x30(%rsp), %xmm0
ucomisd 0xa5c87(%rip), %xmm0    # 0xdf258
jne 0x395d5
jnp 0x395fa
movl 0x7c(%rsp), %eax
movl (%r14), %ecx
cmpl %ecx, %eax
cmoval %eax, %ecx
movq 0x10(%rsp), %rax
cltq
movl %ebx, 0xb0(%rsp,%rax,4)
movl %ecx, 0x7c(%rsp)
incl %eax
movq %rax, 0x10(%rsp)
incq %rbx
addq $0x4, %r14
addq $0x8, %r15
cmpq $0x8, %rbx
movq 0x20(%rsp), %rdi
jne 0x39590
movq 0x10(%rsp), %r15
testl %r15d, %r15d
movq 0x1150(%rsp), %rbx
jle 0x39e22
movq 0x1148(%rsp), %rax
movl $0x1, (%rax)
movl %r15d, %esi
movq %rbx, %rdx
movq %rdi, %r14
callq 0x1fc88
cmpl $0x1, %eax
jne 0x396ec
leaq 0xa5d9e(%rip), %rsi     # 0xdf3f0
leaq 0xaade3(%rip), %rdx     # 0xe443c
leaq 0xd0(%rsp), %r14
movq %r14, %rdi
movq %rbx, %rcx
xorl %eax, %eax
callq 0x30af0
leaq 0xa59bf(%rip), %rsi     # 0xdf034
leaq 0xaadb1(%rip), %rdx     # 0xe442d
movq %rbx, %rdi
movl $0x259, %ecx            # imm = 0x259
jmp 0x396c7
leaq 0xa5d63(%rip), %rsi     # 0xdf3f0
leaq 0xaad4a(%rip), %rdx     # 0xe43de
leaq 0xd0(%rsp), %r14
movq %r14, %rdi
movq 0x1150(%rsp), %rbx
movq %rbx, %rcx
xorl %eax, %eax
callq 0x30af0
leaq 0xa597c(%rip), %rsi     # 0xdf034
leaq 0xaad6e(%rip), %rdx     # 0xe442d
movq %rbx, %rdi
movl $0x23c, %ecx            # imm = 0x23C
movq %r14, %r8
xorl %eax, %eax
callq 0x30af0
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 0x40(%rsp), %rsi
movq %r14, %rdi
movq %rbx, %rdx
callq 0x1fe91
cmpl $0x1, %eax
jne 0x3973c
leaq 0xa5ce8(%rip), %rsi     # 0xdf3f0
leaq 0xaad61(%rip), %rdx     # 0xe4470
leaq 0xd0(%rsp), %r14
movq %r14, %rdi
movq %rbx, %rcx
xorl %eax, %eax
callq 0x30af0
leaq 0xa5909(%rip), %rsi     # 0xdf034
leaq 0xaacfb(%rip), %rdx     # 0xe442d
movq %rbx, %rdi
movl $0x25c, %ecx            # imm = 0x25C
jmp 0x396c7
movl %r15d, %eax
movq %rax, 0x80(%rsp)
leaq (,%rax,4), %r12
movq %r12, %rdi
callq 0x8460
movq %rax, 0x38(%rsp)
testq %rax, %rax
je 0x39932
movl %r15d, 0x78(%rsp)
movq %r12, %rdi
callq 0x8460
movq %rax, 0x68(%rsp)
testq %rax, %rax
je 0x39970
movq 0x80(%rsp), %rax
leaq (,%rax,8), %r14
movq %r14, %rdi
callq 0x8460
movq %rax, 0x70(%rsp)
testq %rax, %rax
je 0x399b2
movq %r14, 0x88(%rsp)
movl %r15d, %r14d
negl %r14d
xorl %r15d, %r15d
leaq 0xc(%rsp), %r13
leaq 0xaa4cd(%rip), %rbp     # 0xe3c90
movq 0x20(%rsp), %r12
movl 0xb0(%rsp,%r15,4), %eax
movslq %eax, %rbx
leaq 0xf8ef6(%rip), %rax     # 0x1326d0
movq (%rax,%rbx,8), %rsi
movq %r12, %rdi
leaq 0x30(%rsp), %rdx
movq %r13, %rcx
movq 0x1150(%rsp), %r8
callq 0x1e8ed
cmpl $0x1, %eax
je 0x399f4
movq 0x68(%rsp), %rax
movl %ebx, (%rax,%r15,4)
movsd 0x30(%rsp), %xmm0
movq 0x70(%rsp), %rax
movsd %xmm0, (%rax,%r15,8)
leal (%r14,%r15), %eax
addl 0x8(%r12), %eax
movq 0x38(%rsp), %rcx
movl %eax, (%rcx,%r15,4)
movslq %eax, %rdi
shlq $0xa, %rdi
addq 0x50(%rsp), %rdi
movslq (%rbp,%rbx,4), %rsi
addq %rbp, %rsi
callq 0x8350
incq %r15
cmpq %r15, 0x80(%rsp)
jne 0x397c8
movq 0x10(%rsp), %r15
movl 0x1140(%rsp), %r14d
cmpl $0x1, %r15d
jne 0x39a3a
testl %r14d, %r14d
movq 0x1150(%rsp), %rbx
jle 0x398aa
movq 0x38(%rsp), %rax
movq 0x68(%rsp), %rcx
movslq (%rax), %rsi
shlq $0xa, %rsi
addq 0x50(%rsp), %rsi
movl (%rcx), %eax
leaq 0xf8e38(%rip), %rcx     # 0x1326d0
movq (%rcx,%rax,8), %rdx
leaq 0xaac8b(%rip), %rdi     # 0xe452e
xorl %eax, %eax
callq 0x8030
movq 0x18(%rsp), %rax
movsd 0x78(%rax), %xmm0
leaq 0xa8(%rsp), %rdi
leaq 0x28(%rsp), %rsi
leaq 0x38(%rsp), %rdx
movq %rbx, %rcx
callq 0x3b95f
movl %eax, %ebp
testl %eax, %eax
je 0x39adc
leaq 0xa5b11(%rip), %rsi     # 0xdf3f0
leaq 0xaac8b(%rip), %rdx     # 0xe4571
leaq 0xd0(%rsp), %r12
movq %r12, %rdi
movq %rbx, %rcx
xorl %eax, %eax
callq 0x30af0
movq 0x90(%rsp), %rax
leaq 0x382(%rax), %rdi
leaq 0xa5723(%rip), %rsi     # 0xdf034
leaq 0xaab15(%rip), %rdx     # 0xe442d
movl $0x294, %ecx            # imm = 0x294
movq %r12, %r8
xorl %eax, %eax
callq 0x30af0
movl $0x1, %r13d
jmp 0x39adf
leaq 0xa56cb(%rip), %rsi     # 0xdf004
leaq 0xaab5d(%rip), %rdx     # 0xe449d
leaq 0xd0(%rsp), %r14
movq %r14, %rdi
movl %r12d, %ecx
xorl %eax, %eax
callq 0x30af0
leaq 0xa56d8(%rip), %rsi     # 0xdf034
leaq 0xaaaca(%rip), %rdx     # 0xe442d
movq %rbx, %rdi
movl $0x263, %ecx            # imm = 0x263
jmp 0x396c7
shll $0x2, %r15d
leaq 0xa5689(%rip), %rsi     # 0xdf004
leaq 0xaab38(%rip), %rdx     # 0xe44ba
leaq 0xd0(%rsp), %r14
movq %r14, %rdi
movl %r15d, %ecx
xorl %eax, %eax
callq 0x30af0
leaq 0xa5696(%rip), %rsi     # 0xdf034
leaq 0xaaa88(%rip), %rdx     # 0xe442d
movq %rbx, %rdi
movl $0x268, %ecx            # imm = 0x268
jmp 0x396c7
shll $0x3, %r15d
leaq 0xa5647(%rip), %rsi     # 0xdf004
leaq 0xaab06(%rip), %rdx     # 0xe44ca
leaq 0xd0(%rsp), %r14
movq %r14, %rdi
movl %r15d, %ecx
xorl %eax, %eax
callq 0x30af0
leaq 0xa5654(%rip), %rsi     # 0xdf034
leaq 0xaaa46(%rip), %rdx     # 0xe442d
movq %rbx, %rdi
movl $0x26b, %ecx            # imm = 0x26B
jmp 0x396c7
leaq 0xa59f5(%rip), %rsi     # 0xdf3f0
leaq 0xaaad9(%rip), %rdx     # 0xe44db
leaq 0xd0(%rsp), %r14
movq %r14, %rdi
movq 0x1150(%rsp), %rbx
movq %rbx, %rcx
xorl %eax, %eax
callq 0x30af0
leaq 0xa560e(%rip), %rsi     # 0xdf034
leaq 0xaaa00(%rip), %rdx     # 0xe442d
movq %rbx, %rdi
movl $0x276, %ecx            # imm = 0x276
jmp 0x396c7
testl %r14d, %r14d
movq 0x1150(%rsp), %rbx
jle 0x39a53
leaq 0xbe7cf(%rip), %rdi     # 0xf821d
callq 0x8510
movq 0x88(%rsp), %r13
movq %r13, %rdi
callq 0x8460
testq %rax, %rax
je 0x39b51
movq %rax, %r12
movq %r13, %rdi
callq 0x8460
testq %rax, %rax
je 0x39b8f
movq %rax, %rbp
leaq 0x38(%rsp), %rdx
movq %r12, %rdi
movq %rax, %rsi
movq %rbx, %rcx
callq 0x3bc25
testl %eax, %eax
je 0x39bfc
leaq 0xa594b(%rip), %rsi     # 0xdf3f0
leaq 0xaab34(%rip), %rdx     # 0xe45e0
leaq 0xd0(%rsp), %r14
movq %r14, %rdi
movq %rbx, %rcx
xorl %eax, %eax
callq 0x30af0
leaq 0xa556c(%rip), %rsi     # 0xdf034
leaq 0xaa95e(%rip), %rdx     # 0xe442d
movq %rbx, %rdi
movl $0x2b9, %ecx            # imm = 0x2B9
jmp 0x396c7
xorl %r13d, %r13d
movsd 0xa8(%rsp), %xmm0
movsd %xmm0, 0x18(%rsp)
leaq 0xa78bf(%rip), %r12     # 0xe13b4
xorl %edi, %edi
xorl %esi, %esi
movq %r12, %rdx
movb $0x1, %al
callq 0x8550
movq 0x38(%rsp), %rcx
movslq (%rcx), %rdi
shlq $0xa, %rdi
addq 0x58(%rsp), %rdi
incl %eax
movslq %eax, %rsi
movq %r12, %rdx
movsd 0x18(%rsp), %xmm0
movb $0x1, %al
callq 0x8550
testl %r14d, %r14d
jle 0x39d8a
testl %ebp, %ebp
je 0x39bcd
leaq 0xbe6ff(%rip), %rdi     # 0xf8240
callq 0x8510
movl $0x1, %r13d
jmp 0x39d8a
leaq 0xa54ac(%rip), %rsi     # 0xdf004
leaq 0xaaa74(%rip), %rdx     # 0xe45d3
leaq 0xd0(%rsp), %r14
movq %r14, %rdi
movl %r13d, %ecx
xorl %eax, %eax
callq 0x30af0
leaq 0xa54b9(%rip), %rsi     # 0xdf034
leaq 0xaa8ab(%rip), %rdx     # 0xe442d
movq %rbx, %rdi
movl $0x2b1, %ecx            # imm = 0x2B1
jmp 0x396c7
leaq 0xa546e(%rip), %rsi     # 0xdf004
leaq 0xaaa3e(%rip), %rdx     # 0xe45db
leaq 0xd0(%rsp), %r14
movq %r14, %rdi
movl %r13d, %ecx
xorl %eax, %eax
callq 0x30af0
leaq 0xa547b(%rip), %rsi     # 0xdf034
leaq 0xaa86d(%rip), %rdx     # 0xe442d
movq %rbx, %rdi
movl $0x2b4, %ecx            # imm = 0x2B4
jmp 0x396c7
movq 0x38(%rsp), %rax
movslq (%rax), %rdx
shlq $0xa, %rdx
movq 0x50(%rsp), %rsi
addq %rdx, %rsi
addq 0x58(%rsp), %rdx
leaq 0xaa9d1(%rip), %rdi     # 0xe45be
xorl %r13d, %r13d
xorl %eax, %eax
callq 0x8030
jmp 0x39d67
movq %r15, 0x10(%rsp)
movq 0x18(%rsp), %rax
movsd 0x68(%rax), %xmm0
movsd 0x70(%rax), %xmm1
movq %rbx, (%rsp)
leaq 0x2646(%rip), %rdi      # 0x3c261
leaq 0x38(%rsp), %r8
leaq 0x28(%rsp), %r9
movq %r12, %r13
movq %r12, %rsi
movq %rbp, 0x88(%rsp)
movq %rbp, %rdx
movq 0x80(%rsp), %rcx
callq 0x1214b
movl %eax, %ebp
movl $0x0, 0x18(%rsp)
cmpl $0x1, %eax
jne 0x39ca9
leaq 0xa5797(%rip), %rsi     # 0xdf3f0
leaq 0xaa9ad(%rip), %rdx     # 0xe460d
leaq 0xd0(%rsp), %r12
movq %r12, %rdi
movq %rbx, %rcx
xorl %eax, %eax
callq 0x30af0
movq 0x90(%rsp), %rax
leaq 0x382(%rax), %rdi
leaq 0xa53a9(%rip), %rsi     # 0xdf034
leaq 0xaa79b(%rip), %rdx     # 0xe442d
movl $0x2c7, %ecx            # imm = 0x2C7
movq %r12, %r8
xorl %eax, %eax
callq 0x30af0
movl $0x1, 0x18(%rsp)
leaq 0xa7704(%rip), %r12     # 0xe13b4
xorl %ebx, %ebx
movsd (%r13,%rbx,8), %xmm0
xorl %edi, %edi
xorl %esi, %esi
movq %r12, %rdx
movb $0x1, %al
callq 0x8550
movq 0x38(%rsp), %rcx
movslq (%rcx,%rbx,4), %rdi
shlq $0xa, %rdi
addq 0x58(%rsp), %rdi
incl %eax
movslq %eax, %rsi
movsd (%r13,%rbx,8), %xmm0
movq %r12, %rdx
movb $0x1, %al
callq 0x8550
testl %r14d, %r14d
jle 0x39d2f
cmpl $0x1, %ebp
jne 0x39d07
leaq 0xbe540(%rip), %rdi     # 0xf8240
callq 0x8510
jmp 0x39d2f
movq 0x38(%rsp), %rax
movslq (%rax,%rbx,4), %rdx
shlq $0xa, %rdx
movq 0x50(%rsp), %rsi
addq %rdx, %rsi
addq 0x58(%rsp), %rdx
leaq 0xaa896(%rip), %rdi     # 0xe45be
xorl %eax, %eax
callq 0x8030
incq %rbx
cmpq %rbx, 0x80(%rsp)
jne 0x39cb2
movq %r13, %rdi
callq 0x8410
movq 0x88(%rsp), %rdi
callq 0x8410
movq 0x1150(%rsp), %rbx
movq 0x10(%rsp), %r15
movl 0x18(%rsp), %r13d
cmpl $0x2, %r14d
setl %al
movl %r13d, %ecx
orb %al, %cl
jne 0x39d8a
movl 0x28(%rsp), %esi
leaq 0xaa92b(%rip), %rdi     # 0xe46ab
xorl %r13d, %r13d
xorl %eax, %eax
callq 0x8030
movq 0x90(%rsp), %rax
movw %r13w, 0x380(%rax)
movq 0x20(%rsp), %rsi
movl 0x8(%rsi), %ecx
movl %ecx, %edx
subl %r15d, %edx
leaq 0x40(%rsp), %r14
movq %r14, %rdi
callq 0x1fe11
movq %r14, %rdi
callq 0x1e705
cmpl $0x1, %eax
jne 0x39dff
leaq 0xa5628(%rip), %rsi     # 0xdf3f0
leaq 0xaa90e(%rip), %rdx     # 0xe46dd
leaq 0xd0(%rsp), %r14
movq %r14, %rdi
movq %rbx, %rcx
xorl %eax, %eax
callq 0x30af0
leaq 0xa5249(%rip), %rsi     # 0xdf034
leaq 0xaa63b(%rip), %rdx     # 0xe442d
movq %rbx, %rdi
movl $0x2eb, %ecx            # imm = 0x2EB
jmp 0x396c7
movq 0x38(%rsp), %rdi
callq 0x8410
movq 0x68(%rsp), %rdi
callq 0x8410
movq 0x70(%rsp), %rdi
callq 0x8410
movq 0x20(%rsp), %rdi
leaq 0xd0825(%rip), %r12     # 0x10a64e
leaq 0x30(%rsp), %rbp
leaq 0xc(%rsp), %rcx
movq %r12, %rsi
movq %rbp, %rdx
movq %rbx, %r8
movq %rdi, %r14
callq 0x1e8ed
cmpl $0x1, %eax
jne 0x39e87
leaq 0xa55a0(%rip), %rsi     # 0xdf3f0
leaq 0xaa89d(%rip), %rdx     # 0xe46f4
leaq 0xd0(%rsp), %r14
movq %r14, %rdi
movq %rbx, %rcx
xorl %eax, %eax
callq 0x30af0
leaq 0xa51c1(%rip), %rsi     # 0xdf034
leaq 0xaa5b3(%rip), %rdx     # 0xe442d
movq %rbx, %rdi
movl $0x2f6, %ecx            # imm = 0x2F6
jmp 0x396c7
leaq 0xaa89d(%rip), %r13     # 0xe472b
leaq 0x98(%rsp), %rdx
leaq 0x2c(%rsp), %rcx
movq %r14, %rdi
movq %r13, %rsi
movq %rbx, %r8
callq 0x1e8ed
cmpl $0x1, %eax
jne 0x39eec
leaq 0xa553b(%rip), %rsi     # 0xdf3f0
leaq 0xaa872(%rip), %rdx     # 0xe472e
leaq 0xd0(%rsp), %r14
movq %r14, %rdi
movq %rbx, %rcx
xorl %eax, %eax
callq 0x30af0
leaq 0xa515c(%rip), %rsi     # 0xdf034
leaq 0xaa54e(%rip), %rdx     # 0xe442d
movq %rbx, %rdi
movl $0x2f9, %ecx            # imm = 0x2F9
jmp 0x396c7
movl 0xc(%rsp), %eax
movl %eax, %edx
xorl $0x1, %edx
movl 0x2c(%rsp), %ecx
movl %ecx, %esi
xorl $0x1, %esi
orl %edx, %esi
jne 0x39f5c
leaq 0xaa858(%rip), %rsi     # 0xe4761
leaq 0xd0(%rsp), %r14
movq %r14, %rdi
xorl %eax, %eax
callq 0x30af0
leaq 0xa5160(%rip), %rsi     # 0xdf082
leaq 0xaa864(%rip), %rdx     # 0xe478d
leaq 0x8d0(%rsp), %r15
movq %r15, %rdi
movq %r14, %rcx
xorl %eax, %eax
callq 0x30af0
leaq 0xa50ef(%rip), %rsi     # 0xdf034
leaq 0xaa4e1(%rip), %rdx     # 0xe442d
movq %rbx, %rdi
movl $0x2fc, %ecx            # imm = 0x2FC
movq %r15, %r8
jmp 0x396ca
cmpl $0x1, %ecx
sete %cl
cmpl $0x1, %eax
sete %al
orb %cl, %al
xorl %r15d, %r15d
cmpb $0x1, %al
jne 0x396d7
movq 0x1148(%rsp), %rax
movl $0x1, (%rax)
movl $0x1, %r15d
movq 0x20(%rsp), %r14
movq %r14, %rdi
movl $0x1, %esi
movq %rbx, %rdx
callq 0x1fc88
cmpl $0x1, %eax
jne 0x39feb
leaq 0xa5446(%rip), %rsi     # 0xdf3f0
leaq 0xaa803(%rip), %rdx     # 0xe47b4
leaq 0xd0(%rsp), %r14
movq %r14, %rdi
movq %rbx, %rcx
xorl %eax, %eax
callq 0x30af0
leaq 0xa5067(%rip), %rsi     # 0xdf034
leaq 0xaa459(%rip), %rdx     # 0xe442d
movq %rbx, %rdi
movl $0x303, %ecx            # imm = 0x303
movq %r14, %r8
xorl %eax, %eax
callq 0x30af0
jmp 0x396d7
leaq 0x40(%rsp), %rsi
movq %r14, %rdi
movq %rbx, %rdx
callq 0x1fe91
cmpl $0x1, %eax
jne 0x3a03e
leaq 0xa53e9(%rip), %rsi     # 0xdf3f0
leaq 0xaa462(%rip), %rdx     # 0xe4470
leaq 0xd0(%rsp), %r14
movq %r14, %rdi
movq %rbx, %rcx
xorl %eax, %eax
callq 0x30af0
leaq 0xa500a(%rip), %rsi     # 0xdf034
leaq 0xaa3fc(%rip), %rdx     # 0xe442d
movq %rbx, %rdi
movl $0x306, %ecx            # imm = 0x306
jmp 0x396c7
movl $0x1, 0x78(%rsp)
movl $0x4, %edi
callq 0x8460
movq %rax, 0x38(%rsp)
testq %rax, %rax
je 0x3a13d
movq %rax, %r15
movl $0x4, %edi
callq 0x8460
movq %rax, 0x68(%rsp)
testq %rax, %rax
je 0x3a17d
movq %rax, %r14
movl $0x8, %edi
callq 0x8460
movq %rax, 0x70(%rsp)
testq %rax, %rax
je 0x3a1bd
movl $0x8, %ecx
cmpl $0x1, 0xc(%rsp)
je 0x3a0b4
movl $0x9, %ecx
cmpl $0x1, 0x2c(%rsp)
leaq 0x98(%rsp), %rbp
jne 0x3a0c0
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, 0x7c(%rsp)
movq 0x50(%rsp), %rcx
shlq $0xa, %rax
movl $0x735f41, -0x400(%rcx,%rax) # imm = 0x735F41
movl 0x1140(%rsp), %ebp
testl %ebp, %ebp
jle 0x3a117
cmpl $0x1, 0xc(%rsp)
cmoveq %r12, %r13
leaq 0xaa428(%rip), %rdi     # 0xe452e
leaq 0xb7b38(%rip), %rdx     # 0xf1c45
movq %r13, %rsi
xorl %eax, %eax
callq 0x8030
cmpl $0x1, 0xc(%rsp)
jne 0x3a1fd
movsd 0x30(%rsp), %xmm0
mulsd 0xa9970(%rip), %xmm0    # 0xe3aa0
divsd 0xa9978(%rip), %xmm0    # 0xe3ab0
jmp 0x3a21d
leaq 0xa4ec0(%rip), %rsi     # 0xdf004
leaq 0xaa352(%rip), %rdx     # 0xe449d
leaq 0xd0(%rsp), %r14
movq %r14, %rdi
movl $0x4, %ecx
xorl %eax, %eax
callq 0x30af0
leaq 0xa4ecb(%rip), %rsi     # 0xdf034
leaq 0xaa2bd(%rip), %rdx     # 0xe442d
movq %rbx, %rdi
movl $0x30b, %ecx            # imm = 0x30B
jmp 0x396c7
leaq 0xa4e80(%rip), %rsi     # 0xdf004
leaq 0xaa32f(%rip), %rdx     # 0xe44ba
leaq 0xd0(%rsp), %r14
movq %r14, %rdi
movl $0x4, %ecx
xorl %eax, %eax
callq 0x30af0
leaq 0xa4e8b(%rip), %rsi     # 0xdf034
leaq 0xaa27d(%rip), %rdx     # 0xe442d
movq %rbx, %rdi
movl $0x30e, %ecx            # imm = 0x30E
jmp 0x396c7
leaq 0xa4e40(%rip), %rsi     # 0xdf004
leaq 0xaa2ff(%rip), %rdx     # 0xe44ca
leaq 0xd0(%rsp), %r14
movq %r14, %rdi
movl $0x8, %ecx
xorl %eax, %eax
callq 0x30af0
leaq 0xa4e4b(%rip), %rsi     # 0xdf034
leaq 0xaa23d(%rip), %rdx     # 0xe442d
movq %rbx, %rdi
movl $0x311, %ecx            # imm = 0x311
jmp 0x396c7
cmpl $0x1, 0x2c(%rsp)
jne 0x3a22c
movsd 0x98(%rsp), %xmm0
mulsd 0xa988b(%rip), %xmm0    # 0xe3aa0
divsd 0xa988b(%rip), %xmm0    # 0xe3aa8
movsd %xmm0, 0x10(%rsp)
movsd %xmm0, 0x8d0(%rsp)
leaq 0x8d0(%rsp), %rdi
leaq 0x38(%rsp), %rdx
leaq 0xa0(%rsp), %rcx
movl $0x1, %esi
movq %rbx, %r8
callq 0x3c261
testl %eax, %eax
je 0x3a290
leaq 0xa5197(%rip), %rsi     # 0xdf3f0
leaq 0xaa572(%rip), %rdx     # 0xe47d2
leaq 0xd0(%rsp), %r14
movq %r14, %rdi
movq %rbx, %rcx
xorl %eax, %eax
callq 0x30af0
leaq 0xa4db8(%rip), %rsi     # 0xdf034
leaq 0xaa1aa(%rip), %rdx     # 0xe442d
movq %rbx, %rdi
movl $0x33b, %ecx            # imm = 0x33B
jmp 0x396c7
movq 0x70(%rsp), %rax
movsd (%rax), %xmm1
divsd 0xa0(%rsp), %xmm1
mulsd %xmm1, %xmm1
movsd 0x10(%rsp), %xmm0
mulsd %xmm1, %xmm0
movsd %xmm0, 0x10(%rsp)
leaq 0xa70f7(%rip), %r15     # 0xe13b4
xorl %edi, %edi
xorl %esi, %esi
movq %r15, %rdx
movb $0x1, %al
callq 0x8550
movq 0x58(%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 0x10(%rsp), %xmm0
movb $0x1, %al
callq 0x8550
testl %ebp, %ebp
jle 0x3a32b
movslq 0x8(%r14), %rdx
shlq $0xa, %rdx
addq $-0x400, %rdx           # imm = 0xFC00
movq 0x50(%rsp), %rsi
addq %rdx, %rsi
addq 0x58(%rsp), %rdx
leaq 0xaa29a(%rip), %rdi     # 0xe45be
xorl %eax, %eax
callq 0x8030
movl 0x8(%r14), %ecx
leal -0x1(%rcx), %edx
leaq 0x40(%rsp), %r15
movq %r15, %rdi
movq %r14, %rsi
callq 0x1fe11
movq %r15, %rdi
callq 0x1e705
cmpl $0x1, %eax
jne 0x3a38d
leaq 0xa509a(%rip), %rsi     # 0xdf3f0
leaq 0xaa380(%rip), %rdx     # 0xe46dd
leaq 0xd0(%rsp), %r14
movq %r14, %rdi
movq %rbx, %rcx
xorl %eax, %eax
callq 0x30af0
leaq 0xa4cbb(%rip), %rsi     # 0xdf034
leaq 0xaa0ad(%rip), %rdx     # 0xe442d
movq %rbx, %rdi
movl $0x34b, %ecx            # imm = 0x34B
jmp 0x396c7
movq 0x38(%rsp), %rdi
callq 0x8410
movq 0x68(%rsp), %rdi
callq 0x8410
movq 0x70(%rsp), %rdi
callq 0x8410
xorl %r15d, %r15d
jmp 0x396d7