// File: /workspace/github_c_makefile_star2_O3/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 0x5a874(%rip), %xmm1    # 0x1282c0
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 0xcda9a
addsd 0x220(%rdi), %xmm0
movsd %xmm0, 0xf0(%rbx)
movaps 0x3fccf(%rip), %xmm0    # 0x10d770
movups %xmm0, 0x78(%rbx)
movaps 0x5a824(%rip), %xmm0    # 0x1282d0
movups %xmm0, (%rbx)
movaps 0x5a82a(%rip), %xmm0    # 0x1282e0
movups %xmm0, 0x30(%rbx)
movaps 0x5a82f(%rip), %xmm0    # 0x1282f0
movups %xmm0, 0x10(%rbx)
movaps 0x5a834(%rip), %xmm0    # 0x128300
movups %xmm0, 0x40(%rbx)
movaps 0x5a839(%rip), %xmm0    # 0x128310
movups %xmm0, 0x68(%rbx)
cmpl $0x7, %eax
jb 0xcdb36
leaq 0x5a961(%rip), %rsi     # 0x128448
leaq 0x800(%rsp), %r14
movq %r14, %rdi
xorl %eax, %eax
callq 0x30af0
leaq 0x20582(%rip), %rsi     # 0xee082
leaq 0x5a96a(%rip), %rdx     # 0x128471
movq %rsp, %r15
movq %r15, %rdi
movq %r14, %rcx
xorl %eax, %eax
callq 0x30af0
addq $0x134, %rbx            # imm = 0x134
leaq 0x2050f(%rip), %rsi     # 0xee034
leaq 0x5a980(%rip), %rdx     # 0x1284ac
movq %rbx, %rdi
movl $0x5f, %ecx
jmp 0xcdb91
xorl %eax, %eax
cmpl $0x2, %ecx
jb 0xcdba0
leaq 0x5a975(%rip), %rsi     # 0x1284b9
leaq 0x800(%rsp), %r14
movq %r14, %rdi
xorl %eax, %eax
callq 0x30af0
leaq 0x20525(%rip), %rsi     # 0xee082
leaq 0x5a97d(%rip), %rdx     # 0x1284e1
movq %rsp, %r15
movq %r15, %rdi
movq %r14, %rcx
xorl %eax, %eax
callq 0x30af0
addq $0x134, %rbx            # imm = 0x134
leaq 0x204b2(%rip), %rsi     # 0xee034
leaq 0x5a923(%rip), %rdx     # 0x1284ac
movq %rbx, %rdi
movl $0x63, %ecx
movq %r15, %r8
xorl %eax, %eax
callq 0x30af0
movl $0x1, %eax
addq $0x1000, %rsp           # imm = 0x1000
popq %rbx
popq %r14
popq %r15
retq