// File: /workspace/github_c_makefile_star2_O0/PoulinV[P]AxiCLASS/build/../external/RecfastCLASS/wrap_recfast.c
// Function: recfast_init
int recfast_init(struct precision* ppr,
                 struct background* pba,
                 struct thermodynamics* pth,
                 struct thermorecfast * pre,
                 enum recfast_photoion_modes recfast_photoion_mode,
                 double fHe) {

  /** Define local quantities */
  double Lalpha,Lalpha_He;

  /** - Import some thermodynamical quantities */
  pre->fHe = fHe;
  pre->photoion_mode = recfast_photoion_mode;

  /** - read a few precision/cosmological parameters */
  pre->AGauss1 = ppr->recfast_AGauss1;
  pre->AGauss2 = ppr->recfast_AGauss2;
  pre->zGauss1 = ppr->recfast_zGauss1;
  pre->zGauss2 = ppr->recfast_zGauss2;
  pre->wGauss1 = ppr->recfast_wGauss1;
  pre->wGauss2 = ppr->recfast_wGauss2;
  pre->Hswitch = ppr->recfast_Hswitch;
  pre->Heswitch = ppr->recfast_Heswitch;
  pre->x_H0_trigger2 = ppr->recfast_x_H0_trigger2;
  pre->x_He0_trigger2 = ppr->recfast_x_He0_trigger2;
  pre->fudge_H = ppr->recfast_fudge_H;
  pre->fudge_He = ppr->recfast_fudge_He;
  pre->x_H_limit_KHe = 0.9999999; /* threshold changed by Antony Lewis in 2008 to get smoother Helium */
  pre->x_H_limit_CfHe_t = 0.99999;
  pre->max_exp_boltz = 680.; /* The actual threshold is more around 709.8, but this leaves some wiggle-room */
  pre->x_He_trigger_small = 5.0e-9;

  pre->z_switch_late = ppr->recfast_z_switch_late;

  /** - Adjust fudging factors if needed */
  if (pre->Hswitch == _TRUE_){
    pre->fudge_H += ppr->recfast_delta_fudge_H;
  }


  /** - Assign quantities that have to be calculated first */
  /* These factors use inverse wavenumbers _L_ since they are most accurately measured */
  /* Lyman alpha wavelengths */
  Lalpha = 1./_L_H_alpha_;
  Lalpha_He = 1./_L_He_2p_;
  /* Ionization-lya temperature differences */
  pre->CDB = _h_P_*_c_*(_L_H_ion_-_L_H_alpha_)/_k_B_;
  pre->CDB_He = _h_P_*_c_*(_L_He1_ion_-_L_He_2s_)/_k_B_;
  /* Ionization temperatures */
  pre->CB1 = _h_P_*_c_*_L_H_ion_/_k_B_;           // equivalent to ptw->const_Tion_H
  pre->CB1_He1 = _h_P_*_c_*_L_He1_ion_/_k_B_;     // equivalent to ptw->const_Tion_HeI
  pre->CB1_He2 = _h_P_*_c_*_L_He2_ion_/_k_B_;     // equivalent to ptw->const_Tion_HeII
  /* Constants defined for the Peeble's factors  */
  pre->CR = 2.*_PI_*(_m_e_/_h_P_)*(_k_B_/_h_P_);  // equivalent to ptw->const_NR_numberdens
  pre->CK = pow(Lalpha,3)/(8.*_PI_);
  pre->CK_He = pow(Lalpha_He,3)/(8.*_PI_);
  /* Lyman alpha temperature */
  pre->CL = _c_*_h_P_/(_k_B_*Lalpha);
  pre->CL_He = _c_*_h_P_/(_k_B_/_L_He_2s_);
  pre->CL_Het = _h_P_*_c_*_L_He_2St_/_k_B_;
  /* Helium 2s->2p transition temperature*/
  pre->CDB_He2s2p = _h_P_*_c_*(_L_He_2p_-_L_He_2s_)/_k_B_;

  /** - Test schemes */
  /* He fudging */
  class_test((ppr->recfast_Heswitch < 0) || (ppr->recfast_Heswitch > 6),
             pre->error_message,
             "RECFAST error: unknown He fudging scheme");
  /* H fudging */
  class_test((ppr->recfast_Hswitch != _TRUE_) && (ppr->recfast_Hswitch != _FALSE_),
             pre->error_message,
             "RECFAST error: unknown H fudging scheme");

  return _SUCCESS_;

}

// Assembly:
subq $0x2048, %rsp           # imm = 0x2048
movq %rdi, 0x2038(%rsp)
movq %rsi, 0x2030(%rsp)
movq %rdx, 0x2028(%rsp)
movq %rcx, 0x2020(%rsp)
movl %r8d, 0x201c(%rsp)
movsd %xmm0, 0x2010(%rsp)
movsd 0x2010(%rsp), %xmm0
movq 0x2020(%rsp), %rax
movsd %xmm0, 0x20(%rax)
movl 0x201c(%rsp), %ecx
movq 0x2020(%rsp), %rax
movl %ecx, 0x130(%rax)
movq 0x2038(%rsp), %rax
movsd 0x228(%rax), %xmm0
movq 0x2020(%rsp), %rax
movsd %xmm0, 0x90(%rax)
movq 0x2038(%rsp), %rax
movsd 0x230(%rax), %xmm0
movq 0x2020(%rsp), %rax
movsd %xmm0, 0x98(%rax)
movq 0x2038(%rsp), %rax
movsd 0x238(%rax), %xmm0
movq 0x2020(%rsp), %rax
movsd %xmm0, 0xa0(%rax)
movq 0x2038(%rsp), %rax
movsd 0x240(%rax), %xmm0
movq 0x2020(%rsp), %rax
movsd %xmm0, 0xa8(%rax)
movq 0x2038(%rsp), %rax
movsd 0x248(%rax), %xmm0
movq 0x2020(%rsp), %rax
movsd %xmm0, 0xb0(%rax)
movq 0x2038(%rsp), %rax
movsd 0x250(%rax), %xmm0
movq 0x2020(%rsp), %rax
movsd %xmm0, 0xb8(%rax)
movq 0x2038(%rsp), %rax
movl 0x210(%rax), %ecx
movq 0x2020(%rsp), %rax
movl %ecx, 0xc4(%rax)
movq 0x2038(%rsp), %rax
movl 0x200(%rax), %ecx
movq 0x2020(%rsp), %rax
movl %ecx, 0xc0(%rax)
movq 0x2038(%rsp), %rax
movsd 0x2d0(%rax), %xmm0
movq 0x2020(%rsp), %rax
movsd %xmm0, 0xc8(%rax)
movq 0x2038(%rsp), %rax
movsd 0x2b8(%rax), %xmm0
movq 0x2020(%rsp), %rax
movsd %xmm0, 0xd0(%rax)
movq 0x2038(%rsp), %rax
movsd 0x218(%rax), %xmm0
movq 0x2020(%rsp), %rax
movsd %xmm0, 0xf0(%rax)
movq 0x2038(%rsp), %rax
movsd 0x208(%rax), %xmm0
movq 0x2020(%rsp), %rax
movsd %xmm0, 0xe8(%rax)
movq 0x2020(%rsp), %rax
movsd 0x6538d(%rip), %xmm0    # 0x1ff608
movsd %xmm0, 0xf8(%rax)
movq 0x2020(%rsp), %rax
movsd 0x7264d(%rip), %xmm0    # 0x20c8e0
movsd %xmm0, 0x100(%rax)
movq 0x2020(%rsp), %rax
movsd 0x7262d(%rip), %xmm0    # 0x20c8d8
movsd %xmm0, 0x108(%rax)
movq 0x2020(%rsp), %rax
movsd 0x7260d(%rip), %xmm0    # 0x20c8d0
movsd %xmm0, 0xe0(%rax)
movq 0x2038(%rsp), %rax
movsd 0x2e0(%rax), %xmm0
movq 0x2020(%rsp), %rax
movsd %xmm0, 0xd8(%rax)
movq 0x2020(%rsp), %rax
cmpl $0x1, 0xc4(%rax)
jne 0x19a324
movq 0x2038(%rsp), %rax
movsd 0x220(%rax), %xmm0
movq 0x2020(%rsp), %rax
addsd 0xf0(%rax), %xmm0
movsd %xmm0, 0xf0(%rax)
movsd 0x725ec(%rip), %xmm0    # 0x20c918
movsd %xmm0, 0x2008(%rsp)
movsd 0x725d3(%rip), %xmm0    # 0x20c910
movsd %xmm0, 0x2000(%rsp)
movq 0x2020(%rsp), %rax
movsd 0x725b2(%rip), %xmm0    # 0x20c908
movsd %xmm0, (%rax)
movq 0x2020(%rsp), %rax
movsd 0x72596(%rip), %xmm0    # 0x20c900
movsd %xmm0, 0x30(%rax)
movq 0x2020(%rsp), %rax
movsd 0x571b1(%rip), %xmm0    # 0x1f1530
movsd %xmm0, 0x70(%rax)
movq 0x2020(%rsp), %rax
movsd 0x57194(%rip), %xmm0    # 0x1f1528
movsd %xmm0, 0x78(%rax)
movq 0x2020(%rsp), %rax
movsd 0x57177(%rip), %xmm0    # 0x1f1520
movsd %xmm0, 0x80(%rax)
movq 0x2020(%rsp), %rax
movsd 0x57177(%rip), %xmm0    # 0x1f1538
movsd %xmm0, 0x8(%rax)
movsd 0x2008(%rsp), %xmm0
movsd 0x392c1(%rip), %xmm1    # 0x1d3698
callq 0x8610
movsd 0x3c43c(%rip), %xmm1    # 0x1d6820
divsd %xmm1, %xmm0
movq 0x2020(%rsp), %rax
movsd %xmm0, 0x10(%rax)
movsd 0x2000(%rsp), %xmm0
movsd 0x39292(%rip), %xmm1    # 0x1d3698
callq 0x8610
movsd 0x3c40d(%rip), %xmm1    # 0x1d6820
divsd %xmm1, %xmm0
movq 0x2020(%rsp), %rax
movsd %xmm0, 0x38(%rax)
movsd 0x3c214(%rip), %xmm1    # 0x1d6640
mulsd 0x2008(%rsp), %xmm1
movsd 0x5be73(%rip), %xmm0    # 0x1f62b0
divsd %xmm1, %xmm0
movq 0x2020(%rsp), %rax
movsd %xmm0, 0x18(%rax)
movq 0x2020(%rsp), %rax
movsd 0x7249a(%rip), %xmm0    # 0x20c8f8
movsd %xmm0, 0x40(%rax)
movq 0x2020(%rsp), %rax
movsd 0x7247d(%rip), %xmm0    # 0x20c8f0
movsd %xmm0, 0x48(%rax)
movq 0x2020(%rsp), %rax
movsd 0x72460(%rip), %xmm0    # 0x20c8e8
movsd %xmm0, 0x68(%rax)
movq 0x2038(%rsp), %rax
cmpl $0x0, 0x200(%rax)
jl 0x19a4af
movq 0x2038(%rsp), %rax
cmpl $0x6, 0x200(%rax)
jle 0x19a52b
leaq 0x1800(%rsp), %rdi
leaq 0x72542(%rip), %rsi     # 0x20ca00
movb $0x0, %al
callq 0x5b9c0
leaq 0x1000(%rsp), %rdi
leaq 0x1800(%rsp), %rcx
leaq 0x37ba6(%rip), %rsi     # 0x1d2082
leaq 0x72546(%rip), %rdx     # 0x20ca29
movb $0x0, %al
callq 0x5b9c0
movq 0x2020(%rsp), %rdi
addq $0x134, %rdi            # imm = 0x134
leaq 0x1000(%rsp), %r8
leaq 0x37b2c(%rip), %rsi     # 0x1d2034
leaq 0x72555(%rip), %rdx     # 0x20ca64
movl $0x5f, %ecx
movb $0x0, %al
callq 0x5b9c0
movl $0x1, 0x2044(%rsp)
jmp 0x19a5cb
movq 0x2038(%rsp), %rax
cmpl $0x1, 0x210(%rax)
je 0x19a5c0
movq 0x2038(%rsp), %rax
cmpl $0x0, 0x210(%rax)
je 0x19a5c0
leaq 0x800(%rsp), %rdi
leaq 0x72511(%rip), %rsi     # 0x20ca71
movb $0x0, %al
callq 0x5b9c0
movq %rsp, %rdi
leaq 0x800(%rsp), %rcx
leaq 0x37b09(%rip), %rsi     # 0x1d2082
leaq 0x72519(%rip), %rdx     # 0x20ca99
movb $0x0, %al
callq 0x5b9c0
movq 0x2020(%rsp), %rdi
addq $0x134, %rdi            # imm = 0x134
movq %rsp, %r8
leaq 0x37a94(%rip), %rsi     # 0x1d2034
leaq 0x724bd(%rip), %rdx     # 0x20ca64
movl $0x63, %ecx
movb $0x0, %al
callq 0x5b9c0
movl $0x1, 0x2044(%rsp)
jmp 0x19a5cb
movl $0x0, 0x2044(%rsp)
movl 0x2044(%rsp), %eax
addq $0x2048, %rsp           # imm = 0x2048
retq
nopw (%rax,%rax)