// File: /workspace/github_c_makefile_star2_O1/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:
pushq %r15
pushq %r14
pushq %rbx
subq $0x1000, %rsp           # imm = 0x1000
movq %rcx, %rbx
movsd %xmm0, 0x20(%rcx)
movl %r8d, 0x130(%rcx)
movups 0x228(%rdi), %xmm0
movups %xmm0, 0x90(%rcx)
movups 0x238(%rdi), %xmm0
movups %xmm0, 0xa0(%rcx)
movups 0x248(%rdi), %xmm0
movups %xmm0, 0xb0(%rcx)
movl 0x210(%rdi), %ecx
movl %ecx, 0xc4(%rbx)
movl 0x200(%rdi), %eax
movl %eax, 0xc0(%rbx)
movsd 0x2d0(%rdi), %xmm0
movsd %xmm0, 0xc8(%rbx)
movsd 0x2b8(%rdi), %xmm0
movsd %xmm0, 0xd0(%rbx)
movsd 0x218(%rdi), %xmm0
movsd %xmm0, 0xf0(%rbx)
movsd 0x208(%rdi), %xmm1
movsd %xmm1, 0xe8(%rbx)
movaps 0x59fa8(%rip), %xmm1    # 0x12b290
movups %xmm1, 0xf8(%rbx)
movabsq $0x4085400000000000, %rdx # imm = 0x4085400000000000
movq %rdx, 0x108(%rbx)
movabsq $0x3e35798ee2308c3a, %rdx # imm = 0x3E35798EE2308C3A
movq %rdx, 0xe0(%rbx)
movsd 0x2e0(%rdi), %xmm1
movsd %xmm1, 0xd8(%rbx)
cmpl $0x1, %ecx
jne 0xd1336
addsd 0x220(%rdi), %xmm0
movsd %xmm0, 0xf0(%rbx)
movaps 0x3f413(%rip), %xmm0    # 0x110750
movups %xmm0, 0x78(%rbx)
movaps 0x59f58(%rip), %xmm0    # 0x12b2a0
movups %xmm0, (%rbx)
movaps 0x59f5e(%rip), %xmm0    # 0x12b2b0
movups %xmm0, 0x30(%rbx)
movaps 0x59f63(%rip), %xmm0    # 0x12b2c0
movups %xmm0, 0x10(%rbx)
movaps 0x59f68(%rip), %xmm0    # 0x12b2d0
movups %xmm0, 0x40(%rbx)
movaps 0x59f6d(%rip), %xmm0    # 0x12b2e0
movups %xmm0, 0x68(%rbx)
cmpl $0x7, %eax
jb 0xd13d2
leaq 0x5a095(%rip), %rsi     # 0x12b418
leaq 0x800(%rsp), %r14
movq %r14, %rdi
xorl %eax, %eax
callq 0x30c2c
leaq 0x1fce6(%rip), %rsi     # 0xf1082
leaq 0x5a09e(%rip), %rdx     # 0x12b441
movq %rsp, %r15
movq %r15, %rdi
movq %r14, %rcx
xorl %eax, %eax
callq 0x30c2c
addq $0x134, %rbx            # imm = 0x134
leaq 0x1fc73(%rip), %rsi     # 0xf1034
leaq 0x5a0b4(%rip), %rdx     # 0x12b47c
movq %rbx, %rdi
movl $0x5f, %ecx
jmp 0xd142d
xorl %eax, %eax
cmpl $0x2, %ecx
jb 0xd143c
leaq 0x5a0a9(%rip), %rsi     # 0x12b489
leaq 0x800(%rsp), %r14
movq %r14, %rdi
xorl %eax, %eax
callq 0x30c2c
leaq 0x1fc89(%rip), %rsi     # 0xf1082
leaq 0x5a0b1(%rip), %rdx     # 0x12b4b1
movq %rsp, %r15
movq %r15, %rdi
movq %r14, %rcx
xorl %eax, %eax
callq 0x30c2c
addq $0x134, %rbx            # imm = 0x134
leaq 0x1fc16(%rip), %rsi     # 0xf1034
leaq 0x5a057(%rip), %rdx     # 0x12b47c
movq %rbx, %rdi
movl $0x63, %ecx
movq %r15, %r8
xorl %eax, %eax
callq 0x30c2c
movl $0x1, %eax
addq $0x1000, %rsp           # imm = 0x1000
popq %rbx
popq %r14
popq %r15
retq