original_code:
int recfast_dx_H_dz(struct thermodynamics* pth, struct thermorecfast * pre, double x_H, double x, double nH,
                    double z, double Hz, double Tmat, double Trad,
                    double* dxH_dz) {
  struct injection* pin = &(pth->in);
  double Rup,Rdown,K,C,C_nofudge;
  double ion_H,ion_He,ion_lya;
  double A2s1sH = 8.2245809;
  if (pth->has_varconst == 1) {
    Tmat /= pre->fsR*pre->fsR*pre->meR;
    Trad /= pre->fsR*pre->fsR*pre->meR;
  }
  Rdown = 1.e-19*4.309*pow((Tmat/1.e4),-0.6166)/(1.+0.6703*pow((Tmat/1.e4),0.5300));
  switch (pre->photoion_mode){
    case recfast_photoion_Tmat:
      Rup = Rdown * pow((pre->CR*Tmat),1.5)*exp(-pre->CDB/Tmat);
    break;
    default:
    case recfast_photoion_Trad:
      Rup = 1.e-19*4.309*pow((Trad/1.e4),-0.6166)/(1.+0.6703*pow((Trad/1.e4),0.5300)) * pow((pre->CR*Trad),1.5)*exp(-pre->CDB/Trad);
    break;
  }
  K = pre->CK/Hz;
  if (pre->Hswitch == 1 ){
    K *= 1.
      + pre->AGauss1*exp(-pow((log(1.+z)-pre->zGauss1)/pre->wGauss1,2))
      + pre->AGauss2*exp(-pow((log(1.+z)-pre->zGauss2)/pre->wGauss2,2));
  }
  if (pth->has_varconst == 1) {
    Rdown *= pre->fsR*pre->fsR/pre->meR/pre->meR;
    Rup *= pre->fsR*pre->fsR*pre->fsR*pre->fsR*pre->fsR*pre->meR;
    K *= 1./pow(pre->fsR*pre->fsR*pre->meR,3);
    A2s1sH *= pow(pre->fsR, 8)*pre->meR;
  }
  if (x_H < pre->x_H0_trigger2 || z < pre->z_switch_late) {
    C = (1. + K*A2s1sH*nH*(1.-x_H))/(1./pre->fudge_H+K*A2s1sH*nH*(1.-x_H)/pre->fudge_H +K*Rup*nH*(1.-x_H));
    C_nofudge = (1. + K*A2s1sH*nH*(1.-x_H))/(1.+K*A2s1sH*nH*(1.-x_H) + K*Rup*nH*(1.-x_H));
  }
  else {
    C = 1.;
    C_nofudge = 1.;
  }
  *dxH_dz = (x*x_H*nH*Rdown - Rup*(1.-x_H)*exp(-pre->CL/Tmat)) * C / (Hz*(1.+z));
  if (pth->has_exotic_injection == 1) {
    ion_H = pin->pvecdeposition[pin->index_dep_ionH];
    ion_He = pin->pvecdeposition[pin->index_dep_ionHe];
    ion_lya = pin->pvecdeposition[pin->index_dep_lya];
    *dxH_dz += -1./nH*((ion_H+ion_He)/(13.5984336478*1.602176487e-19)+ion_lya*(1.-C_nofudge)/(10.1988356821*1.602176487e-19))/(Hz*(1.+z));
  }
  return 0;
}

canonical_original_code:
int recfast_dx_H_dz(struct thermodynamics *pth, struct thermorecfast *pre, double x_H, double x, double nH, double z, double Hz, double Tmat, double Trad, double *dxH_dz) {
  struct injection *pin = &(pth->in);
  double Rup; double Rdown; double K; double C; double C_nofudge;
  double ion_H; double ion_He; double ion_lya;
  double A2s1sH = 8.2245809;
  if (pth->has_varconst == 1) {
    Tmat /= pre->fsR*pre->fsR*pre->meR;
    Trad /= pre->fsR*pre->fsR*pre->meR;
  }
  Rdown = 1.e-19*4.309*pow((Tmat/1.e4),-0.6166)/(1.+0.6703*pow((Tmat/1.e4),0.5300));
  switch (pre->photoion_mode){
    case recfast_photoion_Tmat:
      Rup = Rdown * pow((pre->CR*Tmat),1.5)*exp(-pre->CDB/Tmat);
    break;
    default:
    case recfast_photoion_Trad:
      Rup = 1.e-19*4.309*pow((Trad/1.e4),-0.6166)/(1.+0.6703*pow((Trad/1.e4),0.5300)) * pow((pre->CR*Trad),1.5)*exp(-pre->CDB/Trad);
    break;
  }
  K = pre->CK/Hz;
  if (pre->Hswitch == 1 ){
    K *= 1.
      + pre->AGauss1*exp(-pow((log(1.+z)-pre->zGauss1)/pre->wGauss1,2))
      + pre->AGauss2*exp(-pow((log(1.+z)-pre->zGauss2)/pre->wGauss2,2));
  }
  if (pth->has_varconst == 1) {
    Rdown *= pre->fsR*pre->fsR/pre->meR/pre->meR;
    Rup *= pre->fsR*pre->fsR*pre->fsR*pre->fsR*pre->fsR*pre->meR;
    K *= 1./pow(pre->fsR*pre->fsR*pre->meR,3);
    A2s1sH *= pow(pre->fsR, 8)*pre->meR;
  }
  if (x_H < pre->x_H0_trigger2 || z < pre->z_switch_late) {
    C = (1. + K*A2s1sH*nH*(1.-x_H))/(1./pre->fudge_H+K*A2s1sH*nH*(1.-x_H)/pre->fudge_H +K*Rup*nH*(1.-x_H));
    C_nofudge = (1. + K*A2s1sH*nH*(1.-x_H))/(1.+K*A2s1sH*nH*(1.-x_H) + K*Rup*nH*(1.-x_H));
  }
  else {
    C = 1.;
    C_nofudge = 1.;
  }
  *dxH_dz = (x*x_H*nH*Rdown - Rup*(1.-x_H)*exp(-pre->CL/Tmat)) * C / (Hz*(1.+z));
  if (pth->has_exotic_injection == 1) {
    ion_H = pin->pvecdeposition[pin->index_dep_ionH];
    ion_He = pin->pvecdeposition[pin->index_dep_ionHe];
    ion_lya = pin->pvecdeposition[pin->index_dep_lya];
    *dxH_dz += -1./nH*((ion_H+ion_He)/(13.5984336478*1.602176487e-19)+ion_lya*(1.-C_nofudge)/(10.1988356821*1.602176487e-19))/(Hz*(1.+z));
  }
  return 0;
}

variable_types: struct thermodynamics { double YHe; double bbn_alpha_sensitivity; enum recombination_algorithm { recfast=0, hyrec=1 } recombination; enum recfast_photoion_modes { recfast_photoion_Tmat=0, recfast_photoion_Trad=1 } recfast_photoion_mode; enum reionization_parametrization { reio_none=0, reio_camb=1, reio_bins_tanh=2, reio_half_tanh=3, reio_many_tanh=4, reio_inter=5 } reio_parametrization; enum reionization_z_or_tau { reio_z=0, reio_tau=1 } reio_z_or_tau; double tau_reio; double z_reio; short compute_cb2_derivatives; short compute_damping_scale; short has_idm_b; short has_idm_g; short has_idm_dr; double reionization_width; double reionization_exponent; double helium_fullreio_redshift; double helium_fullreio_width; int binned_reio_num; double *binned_reio_z; double *binned_reio_xe; double binned_reio_step_sharpness; int many_tanh_num; double *many_tanh_z; double *many_tanh_xe; double many_tanh_width; int reio_inter_num; double *reio_inter_z; double *reio_inter_xe; short has_exotic_injection; struct injection { double DM_annihilation_efficiency; double DM_annihilation_cross_section; double DM_annihilation_mass; double DM_annihilation_fraction; double DM_annihilation_variation; double DM_annihilation_z; double DM_annihilation_zmax; double DM_annihilation_zmin; double DM_annihilation_f_halo; double DM_annihilation_z_halo; double DM_decay_fraction; double DM_decay_Gamma; double PBH_evaporation_fraction; double PBH_evaporation_mass; double PBH_accretion_fraction; double PBH_accretion_mass; enum PBH_accretion_approx { spherical_accretion=0, disk_accretion=1 } PBH_accretion_recipe; double PBH_accretion_relative_velocities; double PBH_accretion_ADAF_delta; double PBH_accretion_eigenvalue; int f_eff_type; char f_eff_file[256]; int chi_type; char chi_z_file[256]; char chi_x_file[256]; int Nz_size; double z_initial; double z_start_chi_approx; double H0; double T_g0; double Omega0_b; double Omega0_cdm; double rho0_cdm; double H; double a; double t; double rho_g; double rho_b; double rho_cdm; double fHe; double N_e0; double heat_capacity; double T_b; double x_e; double nH; double *z_table; int z_size; double tol_z_table; int filled_until_index_z; double filled_until_z; int last_index_z_feff; int last_index_z_chi; int last_index_z_inj; int last_index_z; int index_z_store; int last_index_x_chi; double PBH_z_evaporation; double PBH_QCD_activation; double *PBH_table_z; double *PBH_table_mass; double *PBH_table_mass_dd; double *PBH_table_F; double *PBH_table_F_dd; int Nz_PBH; double **injection_table; int index_inj_cool; int index_inj_diss; int index_inj_DM_ann; int index_inj_DM_dec; int index_inj_PBH_eva; int index_inj_PBH_acc; int index_inj_tot; int inj_size; double f_eff; int feff_z_size; double *feff_table; double *chiz_table; int chiz_size; double *chix_table; int chix_size; double **deposition_table; double *chi; int index_dep_heat; int index_dep_ionH; int index_dep_ionHe; int index_dep_lya; int index_dep_lowE; int dep_size; double *pvecdeposition; int has_exotic_injection; int has_DM_ann; int has_DM_dec; int has_PBH_eva; int has_PBH_acc; int to_store; char error_message[2048]; } in; double annihilation; short has_on_the_spot; double decay; double annihilation_variation; double annihilation_z; double annihilation_zmax; double annihilation_zmin; double annihilation_f_halo; double annihilation_z_halo; short has_varconst; int index_th_xe; int index_th_dkappa; int index_th_tau_d; int index_th_ddkappa; int index_th_dddkappa; int index_th_exp_m_kappa; int index_th_g; int index_th_dg; int index_th_ddg; int index_th_T_idm; int index_th_c2_idm; int index_th_T_idr; int index_th_dmu_idm_dr; int index_th_ddmu_idm_dr; int index_th_dddmu_idm_dr; int index_th_dmu_idr; int index_th_tau_idm_dr; int index_th_tau_idr; int index_th_g_idm_dr; int index_th_dmu_idm_g; int index_th_ddmu_idm_g; int index_th_dddmu_idm_g; int index_th_exp_mu_idm_g; int index_th_R_idm_b; int index_th_dR_idm_b; int index_th_ddR_idm_b; int index_th_Tb; int index_th_dTb; int index_th_wb; int index_th_cb2; int index_th_dcb2; int index_th_ddcb2; int index_th_rate; int index_th_r_d; int th_size; int tt_size; double *z_table; double *tau_table; double *thermodynamics_table; double *d2thermodynamics_dz2_table; double z_rec; double tau_rec; double rs_rec; double ds_rec; double ra_rec; double da_rec; double rd_rec; double z_star; double tau_star; double rs_star; double ds_star; double ra_star; double da_star; double rd_star; double z_d; double tau_d; double ds_d; double rs_d; double tau_cut; double angular_rescaling; double tau_free_streaming; double tau_idr_free_streaming; double tau_idr; double tau_idm_dr; double tau_ini; double fHe; double n_e; double m_idm; double a_idm_dr; double b_idr; double n_index_idm_dr; double cross_idm_b; int n_index_idm_b; double n_coeff_idm_b; double cross_idm_g; double u_idm_g; int n_index_idm_g; short inter_normal; short inter_closeby; short thermodynamics_verbose; short hyrec_verbose; char error_message[2048]; } *

variable_types: struct thermorecfast { double CDB; double CR; double CK; double CL; double fHe; double YHe; double CDB_He; double CK_He; double CL_He; double CL_Het; double H_frac; double Tnow; double Nnow; double CDB_He2s2p; double CB1; double CB1_He1; double CB1_He2; double H0; double AGauss1; double AGauss2; double zGauss1; double zGauss2; double wGauss1; double wGauss2; int Heswitch; int Hswitch; double x_H0_trigger2; double x_He0_trigger2; double z_switch_late; double x_He_trigger_small; double fudge_He; double fudge_H; double x_H_limit_KHe; double x_H_limit_CfHe_t; double max_exp_boltz; double Bfact; double CT; double fsR; enum recfast_photoion_modes { recfast_photoion_Tmat=0, recfast_photoion_Trad=1 } photoion_mode; char error_message[2048]; } *

variable_types: x double

variable_types: nH double

variable_types: z double

variable_types: Hz double

variable_types: Tmat double

variable_types: Trad double

variable_types: struct injection { double DM_annihilation_efficiency; double DM_annihilation_cross_section; double DM_annihilation_mass; double DM_annihilation_fraction; double DM_annihilation_variation; double DM_annihilation_z; double DM_annihilation_zmax; double DM_annihilation_zmin; double DM_annihilation_f_halo; double DM_annihilation_z_halo; double DM_decay_fraction; double DM_decay_Gamma; double PBH_evaporation_fraction; double PBH_evaporation_mass; double PBH_accretion_fraction; double PBH_accretion_mass; enum PBH_accretion_approx { spherical_accretion=0, disk_accretion=1 } PBH_accretion_recipe; double PBH_accretion_relative_velocities; double PBH_accretion_ADAF_delta; double PBH_accretion_eigenvalue; int f_eff_type; char f_eff_file[256]; int chi_type; char chi_z_file[256]; char chi_x_file[256]; int Nz_size; double z_initial; double z_start_chi_approx; double H0; double T_g0; double Omega0_b; double Omega0_cdm; double rho0_cdm; double H; double a; double t; double rho_g; double rho_b; double rho_cdm; double fHe; double N_e0; double heat_capacity; double T_b; double x_e; double nH; double *z_table; int z_size; double tol_z_table; int filled_until_index_z; double filled_until_z; int last_index_z_feff; int last_index_z_chi; int last_index_z_inj; int last_index_z; int index_z_store; int last_index_x_chi; double PBH_z_evaporation; double PBH_QCD_activation; double *PBH_table_z; double *PBH_table_mass; double *PBH_table_mass_dd; double *PBH_table_F; double *PBH_table_F_dd; int Nz_PBH; double **injection_table; int index_inj_cool; int index_inj_diss; int index_inj_DM_ann; int index_inj_DM_dec; int index_inj_PBH_eva; int index_inj_PBH_acc; int index_inj_tot; int inj_size; double f_eff; int feff_z_size; double *feff_table; double *chiz_table; int chiz_size; double *chix_table; int chix_size; double **deposition_table; double *chi; int index_dep_heat; int index_dep_ionH; int index_dep_ionHe; int index_dep_lya; int index_dep_lowE; int dep_size; double *pvecdeposition; int has_exotic_injection; int has_DM_ann; int has_DM_dec; int has_PBH_eva; int has_PBH_acc; int to_store; char error_message[2048]; } *

variable_types: Rup double

variable_types: Rdown double

variable_types: K double

variable_types: C double

user_defined_types: struct thermodynamics { double YHe; double bbn_alpha_sensitivity; enum recombination_algorithm recombination; enum recfast_photoion_modes recfast_photoion_mode; enum reionization_parametrization reio_parametrization; enum reionization_z_or_tau reio_z_or_tau; double tau_reio; double z_reio; short compute_cb2_derivatives; short compute_damping_scale; short has_idm_b; short has_idm_g; short has_idm_dr; double reionization_width; double reionization_exponent; double helium_fullreio_redshift; double helium_fullreio_width; int binned_reio_num; double *binned_reio_z; double *binned_reio_xe; double binned_reio_step_sharpness; int many_tanh_num; double *many_tanh_z; double *many_tanh_xe; double many_tanh_width; int reio_inter_num; double *reio_inter_z; double *reio_inter_xe; short has_exotic_injection; struct injection in; double annihilation; short has_on_the_spot; double decay; double annihilation_variation; double annihilation_z; double annihilation_zmax; double annihilation_zmin; double annihilation_f_halo; double annihilation_z_halo; short has_varconst; int index_th_xe; int index_th_dkappa; int index_th_tau_d; int index_th_ddkappa; int index_th_dddkappa; int index_th_exp_m_kappa; int index_th_g; int index_th_dg; int index_th_ddg; int index_th_T_idm; int index_th_c2_idm; int index_th_T_idr; int index_th_dmu_idm_dr; int index_th_ddmu_idm_dr; int index_th_dddmu_idm_dr; int index_th_dmu_idr; int index_th_tau_idm_dr; int index_th_tau_idr; int index_th_g_idm_dr; int index_th_dmu_idm_g; int index_th_ddmu_idm_g; int index_th_dddmu_idm_g; int index_th_exp_mu_idm_g; int index_th_R_idm_b; int index_th_dR_idm_b; int index_th_ddR_idm_b; int index_th_Tb; int index_th_dTb; int index_th_wb; int index_th_cb2; int index_th_dcb2; int index_th_ddcb2; int index_th_rate; int index_th_r_d; int th_size; int tt_size; double *z_table; double *tau_table; double *thermodynamics_table; double *d2thermodynamics_dz2_table; double z_rec; double tau_rec; double rs_rec; double ds_rec; double ra_rec; double da_rec; double rd_rec; double z_star; double tau_star; double rs_star; double ds_star; double ra_star; double da_star; double rd_star; double z_d; double tau_d; double ds_d; double rs_d; double tau_cut; double angular_rescaling; double tau_free_streaming; double tau_idr_free_streaming; double tau_idr; double tau_idm_dr; double tau_ini; double fHe; double n_e; double m_idm; double a_idm_dr; double b_idr; double n_index_idm_dr; double cross_idm_b; int n_index_idm_b; double n_coeff_idm_b; double cross_idm_g; double u_idm_g; int n_index_idm_g; short inter_normal; short inter_closeby; short thermodynamics_verbose; short hyrec_verbose; char error_message[2048]; }

user_defined_types: struct thermorecfast { double CDB; double CR; double CK; double CL; double fHe; double YHe; double CDB_He; double CK_He; double CL_He; double CL_Het; double H_frac; double Tnow; double Nnow; double CDB_He2s2p; double CB1; double CB1_He1; double CB1_He2; double H0; double AGauss1; double AGauss2; double zGauss1; double zGauss2; double wGauss1; double wGauss2; int Heswitch; int Hswitch; double x_H0_trigger2; double x_He0_trigger2; double z_switch_late; double x_He_trigger_small; double fudge_He; double fudge_H; double x_H_limit_KHe; double x_H_limit_CfHe_t; double max_exp_boltz; double Bfact; double CT; double fsR; enum recfast_photoion_modes photoion_mode; char error_message[2048]; }

user_defined_types: struct injection { double DM_annihilation_efficiency; double DM_annihilation_cross_section; double DM_annihilation_mass; double DM_annihilation_fraction; double DM_annihilation_variation; double DM_annihilation_z; double DM_annihilation_zmax; double DM_annihilation_zmin; double DM_annihilation_f_halo; double DM_annihilation_z_halo; double DM_decay_fraction; double DM_decay_Gamma; double PBH_evaporation_fraction; double PBH_evaporation_mass; double PBH_accretion_fraction; double PBH_accretion_mass; enum PBH_accretion_approx PBH_accretion_recipe; double PBH_accretion_relative_velocities; double PBH_accretion_ADAF_delta; double PBH_accretion_eigenvalue; int f_eff_type; char f_eff_file[256]; int chi_type; char chi_z_file[256]; char chi_x_file[256]; int Nz_size; double z_initial; double z_start_chi_approx; double H0; double T_g0; double Omega0_b; double Omega0_cdm; double rho0_cdm; double H; double a; double t; double rho_g; double rho_b; double rho_cdm; double fHe; double N_e0; double heat_capacity; double T_b; double x_e; double nH; double *z_table; int z_size; double tol_z_table; int filled_until_index_z; double filled_until_z; int last_index_z_feff; int last_index_z_chi; int last_index_z_inj; int last_index_z; int index_z_store; int last_index_x_chi; double PBH_z_evaporation; double PBH_QCD_activation; double *PBH_table_z; double *PBH_table_mass; double *PBH_table_mass_dd; double *PBH_table_F; double *PBH_table_F_dd; int Nz_PBH; double **injection_table; int index_inj_cool; int index_inj_diss; int index_inj_DM_ann; int index_inj_DM_dec; int index_inj_PBH_eva; int index_inj_PBH_acc; int index_inj_tot; int inj_size; double f_eff; int feff_z_size; double *feff_table; double *chiz_table; int chiz_size; double *chix_table; int chix_size; double **deposition_table; double *chi; int index_dep_heat; int index_dep_ionH; int index_dep_ionHe; int index_dep_lya; int index_dep_lowE; int dep_size; double *pvecdeposition; int has_exotic_injection; int has_DM_ann; int has_DM_dec; int has_PBH_eva; int has_PBH_acc; int to_store; char error_message[2048]; }


decompiled_code:
__int64 __fastcall recfast_dx_He_dz(__int64 a1, __int64 a2, double *a3, double a4, double a5, double a6, double a7, double a8, double a9, double a10, double a11)
{
double v12; // xmm0_8
double v13; // xmm0_8
double v14; // xmm0_8
double v15; // r13
double v16; // r12
double v17; // xmm2_8
double v18; // xmm2_8
int v19; // er12
double v20; // xmm1_8
double v21; // xmm3_8
double v23; // xmm1_8
double v24; // xmm1_8
double v25; // xmm0_8
double v26; // xmm0_8
double v27; // xmm0_8
double v28; // xmm0_8
double v29; // xmm3_8
double v30; // xmm7_8
bool v31; // r13
double v32; // xmm3_8
double v33; // r13
double v34; // xmm1_8
double v35; // xmm2_8
double v36; // xmm0_8
double v37; // xmm1_8
double v38; // xmm1_8
double v39; // xmm0_8
double v40; // xmm0_8
double v41; // xmm0_8
double v42; // xmm1_8
double v43; // xmm0_8
double v44; // xmm1_8
double v45; // xmm2_8
double v46; // [rsp+0h] [rbp-D8h]
double y; // [rsp+8h] [rbp-D0h]
double ya; // [rsp+8h] [rbp-D0h]
double v50; // [rsp+10h] [rbp-C8h]
double v51; // [rsp+18h] [rbp-C0h]
double v52; // [rsp+18h] [rbp-C0h]
double v53; // [rsp+20h] [rbp-B8h]
double v56; // [rsp+38h] [rbp-A0h]
double v57; // [rsp+38h] [rbp-A0h]
double v58; // [rsp+38h] [rbp-A0h]
double v59; // [rsp+38h] [rbp-A0h]
__int64 v60; // [rsp+40h] [rbp-98h]
double v61; // [rsp+50h] [rbp-88h]
double v63; // [rsp+60h] [rbp-78h]
double v64; // [rsp+60h] [rbp-78h]
double v65; // [rsp+60h] [rbp-78h]
double v68; // [rsp+70h] [rbp-68h]
double v69; // [rsp+70h] [rbp-68h]
double v70; // [rsp+70h] [rbp-68h]
double x; // [rsp+78h] [rbp-60h]
double xa; // [rsp+78h] [rbp-60h]
double xb; // [rsp+78h] [rbp-60h]
double xc; // [rsp+78h] [rbp-60h]
double v75; // [rsp+80h] [rbp-58h]
double v76; // [rsp+80h] [rbp-58h]
double v77; // [rsp+88h] [rbp-50h]
double v78; // [rsp+88h] [rbp-50h]
double v79; // [rsp+90h] [rbp-48h]

v46 = a10;
y = a11;
if ( *(_WORD *)(a1 + 3704) == 1 )
{
v12 = *(double *)(a2 + 288) * *(double *)(a2 + 288) * *(double *)(a2 + 296);
v46 = a10 / v12;
y = a11 / v12;
}
v13 = v46 / 2.999998240459423;
v61 = a7 * *(double *)(a2 + 32);
if ( v46 / 2.999998240459423 < 0.0 )
v51 = sqrt(v13);
else
v51 = sqrt(v13);
v14 = v46 / 130016.957803329;
if ( v46 / 130016.957803329 < 0.0 )
v15 = sqrt(v14);
else
v15 = sqrt(v14);
v16 = pow(v51 + 1.0, 0.289);
x = v15 + 1.0;
v53 = 1.80301774085957e-17 / (v16 * v51 * pow(v15 + 1.0, 1.711));
if ( *(_DWORD *)(a2 + 304) )
{
v23 = y / 2.999998240459423;
if ( y / 2.999998240459423 < 0.0 )
{
v58 = sqrt(v23);
v24 = sqrt(y / 2.999998240459423);
}
else
{
v24 = sqrt(v23);
v58 = v24;
}
v59 = pow(v24 + 1.0, 0.289) * v58;
v25 = y / 130016.957803329;
if ( y / 130016.957803329 < 0.0 )
v26 = sqrt(v25);
else
v26 = sqrt(v25);
v64 = pow(v26 + 1.0, 1.711);
v75 = pow(y * *(double *)(a2 + 8), 1.5);
v60 = LC30;
v17 = LC29;
v57 = 7.21207096343828e-17 / (v59 * v64) * v75 * exp(COERCE_DOUBLE(*(_QWORD *)(a2 + 48) ^ LC30) / y);
}
else
{
v56 = pow(v46 * *(double *)(a2 + 8), 1.5);
v60 = LC30;
v17 = LC29;
v57 = v56 * (v53 * 4.0) * exp(COERCE_DOUBLE(*(_QWORD *)(a2 + 48) ^ LC30) / v46);
}
if ( *(double *)(a2 + 224) > a4 || a4 > *(double *)(a2 + 208) )
goto LABEL_11;
if ( *(double *)(a2 + 216) > a8 )
{
v31 = 1;
v19 = 2;
}
else
{
v19 = *(_DWORD *)(a2 + 192);
if ( !v19 )
{
LABEL_11:
v18 = 0.0;
v19 = 0;
ya = 0.0;
v63 = *(double *)(a2 + 56) / a9;
v52 = 0.0;
goto LABEL_12;
}
v31 = v19 > 4 || v19 == 2;
}
v76 = 1.0 - a4;
v65 = 1798287000.0 * *(double *)(a2 + 56) * 3.0 * v61 * (1.0 - a4) / a9;
v32 = (1.0
- exp(COERCE_DOUBLE(v60 ^ COERCE_UNSIGNED_INT64(1798287000.0 * *(double *)(a2 + 56) * 3.0 * v61 * (1.0 - a4) / a9))))
/ v65
* 1798287000.0;
v63 = 1.0 / (3.0 * v32 * v61 * (1.0 - a4));
if ( v31 && *(double *)(a2 + 248) > a6 )
{
v41 = v46 * 2.7613008e-23 / 5.973668968367626e-10;
if ( v41 < 0.0 )
v42 = sqrt(v41);
else
v42 = sqrt(v41);
v63 = 1.0
/ ((v32
+ 1798287000.0
/ (0.36
* pow(
5394861000.0
* *(double *)(a2 + 32)
* v76
* 299792458.0
* 299792458.0
/ (v42
* 5.130494962245208e15
* 6.398182600193133e-21
* (1.0 - a6))
/ 2.632197855762346e31,
*(double *)(a2 + 232))
+ 1.0))
* 3.0
* v61
* v76);
}
if ( v19 > 2 )
{
v77 = pow(v51 + 1.0, 0.239);
v52 = 4.943106869868343e-17 / (v77 * v51 * pow(x, 1.761));
if ( *(_DWORD *)(a2 + 304) )
{
v37 = y / 2.999998240459423;
if ( y / 2.999998240459423 < 0.0 )
{
xb = sqrt(v37);
v38 = sqrt(y / 2.999998240459423);
}
else
{
v38 = sqrt(v37);
xb = v38;
}
xc = pow(v38 + 1.0, 0.239) * xb;
v39 = y / 130016.957803329;
if ( y / 130016.957803329 < 0.0 )
v40 = sqrt(v39);
else
v40 = sqrt(v39);
v78 = pow(v40 + 1.0, 1.761);
v79 = exp(-7.638815355750231e-19 / (y * 1.3806504e-23));
ya = v79 * (4.943106869868343e-17 / (xc * v78)) * pow(y * *(double *)(a2 + 8), v17) * 4.0 / 3.0;
}
else
{
v33 = exp(-7.638815355750231e-19 / (v46 * 1.3806504e-23));
ya = v33 * v52 * pow(v46 * *(double *)(a2 + 8), v17) * 4.0 / 3.0;
}
if ( *(_WORD *)(a1 + 3704) == 1 )
{
v34 = *(double *)(a2 + 288);
v35 = *(double *)(a2 + 296);
ya = v34 * v34 * v34 * v34 * v34 * v35 * ya;
v52 = v34 * v34 / v35 / v35 * v52;
}
xa = (1.0
- exp(COERCE_DOUBLE(v60 ^ COERCE_UNSIGNED_INT64(177.58 * v61 * v76 * 3.0 / (a9
* 25.13274122871834
* 4.834279833216292e21)))))
/ (177.58
* v61
* v76
* 3.0
/ (a9
* 25.13274122871834
* 4.834279833216292e21));
if ( ((v19 - 3) & 0xFFFFFFFD) != 0 && a6 < *(double *)(a2 + 256) )
{
v43 = v46 * 2.7613008e-23 / 5.973668968367626e-10;
if ( v43 < 0.0 )
v44 = sqrt(v43);
else
v44 = sqrt(v43);
v70 = pow(
532.74
* *(double *)(a2 + 32)
* v76
* 299792458.0
* 299792458.0
/ (v44
* 5.069105129542034e15
* 6.614603463449192e-21
* (1.0 - a6))
/ 2.569582681434936e31,
0.9);
v45 = (177.58 / (v70 * 0.66 + 1.0) / 3.0 + 177.58 * xa) * exp(-13281.58002324601 / v46);
v18 = v45 / (ya + v45);
}
else
{
v36 = exp(-13281.58002324601 / v46);
v18 = 177.58 * xa * v36 / (ya + 177.58 * xa * v36);
}
}
else
{
v18 = 0.0;
ya = 0.0;
v52 = 0.0;
}
LABEL_12:
if ( *(_WORD *)(a1 + 3704) == 1 )
{
v20 = *(double *)(a2 + 288);
v21 = *(double *)(a2 + 296);
v57 = v20 * v20 * v20 * v20 * v20 * v21 * v57;
v53 = v20 * v20 / v21 / v21 * v53;
}
if ( a4 >= 1.0e-15 )
{
v27 = *(double *)(a2 + 104) / v46;
if ( *(double *)(a2 + 264) <= v27 )
v27 = *(double *)(a2 + 264);
v28 = exp(v27);
v29 = *(double *)&LC37;
v30 = v28;
if ( *(_WORD *)(a1 + 3704) == 1 )
{
v69 = v28;
v63 = v63 / pow(*(double *)(a2 + 288) * *(double *)(a2 + 288) * *(double *)(a2 + 296), 3.0);
v30 = v69;
v29 = 51.3 * (pow(*(double *)(a2 + 288), 8.0) * *(double *)(a2 + 296));
}
v68 = 1.0 - a4;
v50 = a7 * (a4 * a5);
*a3 = (v63 * v29 * v61 * v68 * v30 + 1.0)
/ (v63 * (v29 + v57) * v61 * v68 * v30 + 1.0)
* (v53 * v50 - v57 * v68 * exp(COERCE_DOUBLE(*(_QWORD *)(a2 + 64) ^ v60) / v46))
/ ((a8 + 1.0)
* a9);
if ( v19 > 2 )
*a3 = (v50 * v52 - v68 * 3.0 * ya * exp(COERCE_DOUBLE(*(_QWORD *)(a2 + 72) ^ v60) / v46))
* v18
/ ((a8 + 1.0)
* a9)
+ *a3;
}
else
{
*a3 = 0.0;
}
return 0LL;
}

canonical_decompiled_code:
__int64 __fastcall func2(__int64 a1, __int64 a2, double *a3, double a4, double a5, double a6, double a7, double a8, double a9, double a10, double a11)
{
double v12; // xmm0_8
double v13; // xmm0_8
double v14; // xmm0_8
double v15; // r13
double v16; // r12
double v17; // xmm2_8
double v18; // xmm2_8
int v19; // er12
double v20; // xmm1_8
double v21; // xmm3_8
double v23; // xmm1_8
double v24; // xmm1_8
double v25; // xmm0_8
double v26; // xmm0_8
double v27; // xmm0_8
double v28; // xmm0_8
double v29; // xmm3_8
double v30; // xmm7_8
bool v31; // r13
double v32; // xmm3_8
double v33; // r13
double v34; // xmm1_8
double v35; // xmm2_8
double v36; // xmm0_8
double v37; // xmm1_8
double v38; // xmm1_8
double v39; // xmm0_8
double v40; // xmm0_8
double v41; // xmm0_8
double v42; // xmm1_8
double v43; // xmm0_8
double v44; // xmm1_8
double v45; // xmm2_8
double v46; // [rsp+0h] [rbp-D8h]
double y; // [rsp+8h] [rbp-D0h]
double ya; // [rsp+8h] [rbp-D0h]
double v50; // [rsp+10h] [rbp-C8h]
double v51; // [rsp+18h] [rbp-C0h]
double v52; // [rsp+18h] [rbp-C0h]
double v53; // [rsp+20h] [rbp-B8h]
double v56; // [rsp+38h] [rbp-A0h]
double v57; // [rsp+38h] [rbp-A0h]
double v58; // [rsp+38h] [rbp-A0h]
double v59; // [rsp+38h] [rbp-A0h]
__int64 v60; // [rsp+40h] [rbp-98h]
double v61; // [rsp+50h] [rbp-88h]
double v63; // [rsp+60h] [rbp-78h]
double v64; // [rsp+60h] [rbp-78h]
double v65; // [rsp+60h] [rbp-78h]
double v68; // [rsp+70h] [rbp-68h]
double v69; // [rsp+70h] [rbp-68h]
double v70; // [rsp+70h] [rbp-68h]
double x; // [rsp+78h] [rbp-60h]
double xa; // [rsp+78h] [rbp-60h]
double xb; // [rsp+78h] [rbp-60h]
double xc; // [rsp+78h] [rbp-60h]
double v75; // [rsp+80h] [rbp-58h]
double v76; // [rsp+80h] [rbp-58h]
double v77; // [rsp+88h] [rbp-50h]
double v78; // [rsp+88h] [rbp-50h]
double v79; // [rsp+90h] [rbp-48h]

v46 = a10;
y = a11;
if ( *(_WORD *)(a1 + 3704) == 1 )
{
v12 = *(double *)(a2 + 288) * *(double *)(a2 + 288) * *(double *)(a2 + 296);
v46 = a10 / v12;
y = a11 / v12;
}
v13 = v46 / 2.999998240459423;
v61 = a7 * *(double *)(a2 + 32);
if ( v46 / 2.999998240459423 < 0.0 )
v51 = sqrt(v13);
else
v51 = sqrt(v13);
v14 = v46 / 130016.957803329;
if ( v46 / 130016.957803329 < 0.0 )
v15 = sqrt(v14);
else
v15 = sqrt(v14);
v16 = pow(v51 + 1.0, 0.289);
x = v15 + 1.0;
v53 = 1.80301774085957e-17 / (v16 * v51 * pow(v15 + 1.0, 1.711));
if ( *(_DWORD *)(a2 + 304) )
{
v23 = y / 2.999998240459423;
if ( y / 2.999998240459423 < 0.0 )
{
v58 = sqrt(v23);
v24 = sqrt(y / 2.999998240459423);
}
else
{
v24 = sqrt(v23);
v58 = v24;
}
v59 = pow(v24 + 1.0, 0.289) * v58;
v25 = y / 130016.957803329;
if ( y / 130016.957803329 < 0.0 )
v26 = sqrt(v25);
else
v26 = sqrt(v25);
v64 = pow(v26 + 1.0, 1.711);
v75 = pow(y * *(double *)(a2 + 8), 1.5);
v60 = LC30;
v17 = LC29;
v57 = 7.21207096343828e-17 / (v59 * v64) * v75 * exp(COERCE_DOUBLE(*(_QWORD *)(a2 + 48) ^ LC30) / y);
}
else
{
v56 = pow(v46 * *(double *)(a2 + 8), 1.5);
v60 = LC30;
v17 = LC29;
v57 = v56 * (v53 * 4.0) * exp(COERCE_DOUBLE(*(_QWORD *)(a2 + 48) ^ LC30) / v46);
}
if ( *(double *)(a2 + 224) > a4 || a4 > *(double *)(a2 + 208) )
goto LABEL_11;
if ( *(double *)(a2 + 216) > a8 )
{
v31 = 1;
v19 = 2;
}
else
{
v19 = *(_DWORD *)(a2 + 192);
if ( !v19 )
{
LABEL_11:
v18 = 0.0;
v19 = 0;
ya = 0.0;
v63 = *(double *)(a2 + 56) / a9;
v52 = 0.0;
goto LABEL_12;
}
v31 = v19 > 4 || v19 == 2;
}
v76 = 1.0 - a4;
v65 = 1798287000.0 * *(double *)(a2 + 56) * 3.0 * v61 * (1.0 - a4) / a9;
v32 = (1.0
- exp(COERCE_DOUBLE(v60 ^ COERCE_UNSIGNED_INT64(1798287000.0 * *(double *)(a2 + 56) * 3.0 * v61 * (1.0 - a4) / a9))))
/ v65
* 1798287000.0;
v63 = 1.0 / (3.0 * v32 * v61 * (1.0 - a4));
if ( v31 && *(double *)(a2 + 248) > a6 )
{
v41 = v46 * 2.7613008e-23 / 5.973668968367626e-10;
if ( v41 < 0.0 )
v42 = sqrt(v41);
else
v42 = sqrt(v41);
v63 = 1.0
/ ((v32
+ 1798287000.0
/ (0.36
* pow(
5394861000.0
* *(double *)(a2 + 32)
* v76
* 299792458.0
* 299792458.0
/ (v42
* 5.130494962245208e15
* 6.398182600193133e-21
* (1.0 - a6))
/ 2.632197855762346e31,
*(double *)(a2 + 232))
+ 1.0))
* 3.0
* v61
* v76);
}
if ( v19 > 2 )
{
v77 = pow(v51 + 1.0, 0.239);
v52 = 4.943106869868343e-17 / (v77 * v51 * pow(x, 1.761));
if ( *(_DWORD *)(a2 + 304) )
{
v37 = y / 2.999998240459423;
if ( y / 2.999998240459423 < 0.0 )
{
xb = sqrt(v37);
v38 = sqrt(y / 2.999998240459423);
}
else
{
v38 = sqrt(v37);
xb = v38;
}
xc = pow(v38 + 1.0, 0.239) * xb;
v39 = y / 130016.957803329;
if ( y / 130016.957803329 < 0.0 )
v40 = sqrt(v39);
else
v40 = sqrt(v39);
v78 = pow(v40 + 1.0, 1.761);
v79 = exp(-7.638815355750231e-19 / (y * 1.3806504e-23));
ya = v79 * (4.943106869868343e-17 / (xc * v78)) * pow(y * *(double *)(a2 + 8), v17) * 4.0 / 3.0;
}
else
{
v33 = exp(-7.638815355750231e-19 / (v46 * 1.3806504e-23));
ya = v33 * v52 * pow(v46 * *(double *)(a2 + 8), v17) * 4.0 / 3.0;
}
if ( *(_WORD *)(a1 + 3704) == 1 )
{
v34 = *(double *)(a2 + 288);
v35 = *(double *)(a2 + 296);
ya = v34 * v34 * v34 * v34 * v34 * v35 * ya;
v52 = v34 * v34 / v35 / v35 * v52;
}
xa = (1.0
- exp(COERCE_DOUBLE(v60 ^ COERCE_UNSIGNED_INT64(177.58 * v61 * v76 * 3.0 / (a9
* 25.13274122871834
* 4.834279833216292e21)))))
/ (177.58
* v61
* v76
* 3.0
/ (a9
* 25.13274122871834
* 4.834279833216292e21));
if ( ((v19 - 3) & 0xFFFFFFFD) != 0 && a6 < *(double *)(a2 + 256) )
{
v43 = v46 * 2.7613008e-23 / 5.973668968367626e-10;
if ( v43 < 0.0 )
v44 = sqrt(v43);
else
v44 = sqrt(v43);
v70 = pow(
532.74
* *(double *)(a2 + 32)
* v76
* 299792458.0
* 299792458.0
/ (v44
* 5.069105129542034e15
* 6.614603463449192e-21
* (1.0 - a6))
/ 2.569582681434936e31,
0.9);
v45 = (177.58 / (v70 * 0.66 + 1.0) / 3.0 + 177.58 * xa) * exp(-13281.58002324601 / v46);
v18 = v45 / (ya + v45);
}
else
{
v36 = exp(-13281.58002324601 / v46);
v18 = 177.58 * xa * v36 / (ya + 177.58 * xa * v36);
}
}
else
{
v18 = 0.0;
ya = 0.0;
v52 = 0.0;
}
LABEL_12:
if ( *(_WORD *)(a1 + 3704) == 1 )
{
v20 = *(double *)(a2 + 288);
v21 = *(double *)(a2 + 296);
v57 = v20 * v20 * v20 * v20 * v20 * v21 * v57;
v53 = v20 * v20 / v21 / v21 * v53;
}
if ( a4 >= 1.0e-15 )
{
v27 = *(double *)(a2 + 104) / v46;
if ( *(double *)(a2 + 264) <= v27 )
v27 = *(double *)(a2 + 264);
v28 = exp(v27);
v29 = *(double *)&LC37;
v30 = v28;
if ( *(_WORD *)(a1 + 3704) == 1 )
{
v69 = v28;
v63 = v63 / pow(*(double *)(a2 + 288) * *(double *)(a2 + 288) * *(double *)(a2 + 296), 3.0);
v30 = v69;
v29 = 51.3 * (pow(*(double *)(a2 + 288), 8.0) * *(double *)(a2 + 296));
}
v68 = 1.0 - a4;
v50 = a7 * (a4 * a5);
*a3 = (v63 * v29 * v61 * v68 * v30 + 1.0)
/ (v63 * (v29 + v57) * v61 * v68 * v30 + 1.0)
* (v53 * v50 - v57 * v68 * exp(COERCE_DOUBLE(*(_QWORD *)(a2 + 64) ^ v60) / v46))
/ ((a8 + 1.0)
* a9);
if ( v19 > 2 )
*a3 = (v50 * v52 - v68 * 3.0 * ya * exp(COERCE_DOUBLE(*(_QWORD *)(a2 + 72) ^ v60) / v46))
* v18
/ ((a8 + 1.0)
* a9)
+ *a3;
}
else
{
*a3 = 0.0;
}
return 0LL;
}

original_code:
int recfast_dx_He_dz(struct thermodynamics* pth, struct thermorecfast * pre, double x_He, double x, double x_H, double nH,
                     double z, double Hz, double Tmat, double Trad,
                     double* dxHe_dz) {
  double Rdown_trip,Rup_trip,tauHe_s,pHe_s,tauHe_t,pHe_t,CL_PSt;
  double Doppler,gamma_2Ps,gamma_2Pt,pb,qb,AHcon;
  double sq_0,sq_1;
  double K_He,Rup_He,Rdown_He,He_Boltz;
  double CfHe_t=0.;
  double C_He;
  double n_He;
  int Heflag;
  double A2s1sHe = 51.3;
  Rdown_trip = 0.; Rup_trip = 0.;
  if (pth->has_varconst == 1) {
    Tmat /= pre->fsR*pre->fsR*pre->meR;
    Trad /= pre->fsR*pre->fsR*pre->meR;
  }
  n_He = pre->fHe * nH;
  sq_0 = sqrt(Tmat/pow(10.,0.477121));
  sq_1 = sqrt(Tmat/pow(10.,5.114));
  Rdown_He = pow(10.,-16.744)/(sq_0 * pow((1.+sq_0),(1.-0.711)) * pow((1. + sq_1),(1. + 0.711)));
  switch (pre->photoion_mode){
    case recfast_photoion_Tmat:
      Rup_He = 4.*Rdown_He*pow((pre->CR*Tmat),1.5)*exp(-pre->CDB_He/Tmat);
      break;
    case recfast_photoion_Trad:
    default:
      Rup_He = 4.*pow(10.,-16.744)/(sqrt(Trad/pow(10.,0.477121)) * pow((1.+sqrt(Trad/pow(10.,0.477121))),(1.-0.711)) * pow((1. + sqrt(Trad/pow(10.,5.114))),(1. + 0.711))) * pow((pre->CR*Trad),1.5)*exp(-pre->CDB_He/Trad);
      break;
  }
  if ((x_He < pre->x_He_trigger_small) || (x_He > pre->x_He0_trigger2)){
    Heflag = 0;
  }
  else if(z<pre->z_switch_late){
    Heflag = 2;
  }
  else{
    Heflag = pre->Heswitch;
  }
  if (Heflag == 0){
    K_He = pre->CK_He/Hz;
  }
  else {
    tauHe_s = 1.798287e9*pre->CK_He*3.*n_He*(1.-x_He)/Hz;
    pHe_s = (1.-exp(-tauHe_s))/tauHe_s;
    K_He = 1./(1.798287e9*pHe_s*3.*n_He*(1.-x_He));
    if (((Heflag == 2) || (Heflag >= 5)) && (x_H < pre->x_H_limit_KHe)) {
      Doppler = 2.*1.3806504e-23*Tmat/(1.673575e-27*3.9715*2.99792458e8*2.99792458e8);
      Doppler = 2.99792458e8*1.71134891e7*sqrt(Doppler);
      gamma_2Ps = 3.*1.798287e9*pre->fHe*(1.-x_He)*2.99792458e8*2.99792458e8
          /(sqrt(3.1415926535897932384626433832795e0)*1.436289e-22*8.*3.1415926535897932384626433832795e0*Doppler*(1.-x_H))
          /pow(2.99792458e8*1.71134891e7,2);
      pb = 0.36;
      qb = pre->fudge_He;
      AHcon = 1.798287e9/(1.+pb*pow(gamma_2Ps,qb));
      K_He=1./((1.798287e9*pHe_s+AHcon)*3.*n_He*(1.-x_He));
    }
    if (Heflag >= 3) {
      Rdown_trip = pow(10.,-16.306)/(sq_0*pow((1.+sq_0),(1.-0.761)) * pow((1.+sq_1),(1.+0.761)));
      switch (pre->photoion_mode){
        case recfast_photoion_Tmat:
          Rup_trip = Rdown_trip*exp(-6.62606896e-34*2.99792458e8*3.8454693845e6/(1.3806504e-23*Tmat))*pow(pre->CR*Tmat,1.5)*4./3.;
          break;
        case recfast_photoion_Trad:
        default:
          Rup_trip = pow(10.,-16.306)/(sqrt(Trad/pow(10.,0.477121))*pow((1.+sqrt(Trad/pow(10.,0.477121))),(1.-0.761)) * pow((1.+sqrt(Trad/pow(10.,5.114))),(1.+0.761))) *exp(-6.62606896e-34*2.99792458e8*3.8454693845e6/(1.3806504e-23*Trad))*pow(pre->CR*Trad,1.5)*4./3.;
          break;
      }
      if (pth->has_varconst == 1) {
        Rdown_trip *= pre->fsR*pre->fsR/pre->meR/pre->meR;
        Rup_trip *= pre->fsR*pre->fsR*pre->fsR*pre->fsR*pre->fsR*pre->meR;
      }
      tauHe_t = 177.58e0*n_He*(1.-x_He)*3./(8.*3.1415926535897932384626433832795e0*Hz*pow(1.690871466e7,3));
      pHe_t = (1. - exp(-tauHe_t))/tauHe_t;
      CL_PSt = 6.62606896e-34*2.99792458e8*(1.690871466e7 - 1.5985597526e7)/1.3806504e-23;
      if ((Heflag == 3) || (Heflag == 5) || (x_H >= pre->x_H_limit_CfHe_t)) {
        CfHe_t = 177.58e0*pHe_t*exp(-CL_PSt/Tmat);
        CfHe_t = CfHe_t/(Rup_trip+CfHe_t);
      }
      else {
        Doppler = 2.*1.3806504e-23*Tmat/(1.673575e-27*3.9715*2.99792458e8*2.99792458e8);
        Doppler = 2.99792458e8*1.690871466e7*sqrt(Doppler);
        gamma_2Pt = 3.*177.58e0*pre->fHe*(1.-x_He)*2.99792458e8*2.99792458e8
          /(sqrt(3.1415926535897932384626433832795e0)*1.484872e-22*8.*3.1415926535897932384626433832795e0*Doppler*(1.-x_H))
          /pow(2.99792458e8*1.690871466e7,2);
        pb = 0.66;
        qb = 0.9;
        AHcon = 177.58e0/(1.+pb*pow(gamma_2Pt,qb))/3.;
        CfHe_t = (177.58e0*pHe_t+AHcon)*exp(-CL_PSt/Tmat);
        CfHe_t = CfHe_t/(Rup_trip+CfHe_t);
      }
    }
  }
  if (pth->has_varconst == 1) {
    Rdown_He *= pre->fsR*pre->fsR/pre->meR/pre->meR;
    Rup_He *= pre->fsR*pre->fsR*pre->fsR*pre->fsR*pre->fsR*pre->meR;
  }
  if (x_He < 1.e-15){
    *dxHe_dz=0.;
  }
  else {
    if (pre->CDB_He2s2p/Tmat < pre->max_exp_boltz){
      He_Boltz=exp(pre->CDB_He2s2p/Tmat);
    }
    else{
      He_Boltz=exp(pre->max_exp_boltz);
    }
    if (pth->has_varconst == 1) {
      K_He /= pow(pre->fsR*pre->fsR*pre->meR,3);
      A2s1sHe *= pow(pre->fsR, 8)*pre->meR;
    }
    C_He = (1. + K_He*A2s1sHe*n_He*(1.-x_He)*He_Boltz)/(1. + K_He*(A2s1sHe+Rup_He)*n_He*(1.-x_He)*He_Boltz);
    *dxHe_dz = (x*x_He*nH*Rdown_He - Rup_He*(1.-x_He)*exp(-pre->CL_He/Tmat)) * C_He / (Hz*(1+z));
    if (Heflag >= 3){
      *dxHe_dz += (x*x_He*nH*Rdown_trip - (1.-x_He)*3.*Rup_trip*exp(-pre->CL_Het/Tmat)) *CfHe_t/(Hz*(1.+z));
    }
  }
  return 0;
}

canonical_original_code:
int recfast_dx_He_dz(struct thermodynamics *pth, struct thermorecfast *pre, double x_He, double x, double x_H, double nH, double z, double Hz, double Tmat, double Trad, double *dxHe_dz) {
  double Rdown_trip; double Rup_trip; double tauHe_s; double pHe_s; double tauHe_t; double pHe_t; double CL_PSt;
  double Doppler; double gamma_2Ps; double gamma_2Pt; double pb; double qb; double AHcon;
  double sq_0; double sq_1;
  double K_He; double Rup_He; double Rdown_He; double He_Boltz;
  double CfHe_t = 0.;
  double C_He;
  double n_He;
  int Heflag;
  double A2s1sHe = 51.3;
  Rdown_trip = 0.; Rup_trip = 0.;
  if (pth->has_varconst == 1) {
    Tmat /= pre->fsR*pre->fsR*pre->meR;
    Trad /= pre->fsR*pre->fsR*pre->meR;
  }
  n_He = pre->fHe * nH;
  sq_0 = sqrt(Tmat/pow(10.,0.477121));
  sq_1 = sqrt(Tmat/pow(10.,5.114));
  Rdown_He = pow(10.,-16.744)/(sq_0 * pow((1.+sq_0),(1.-0.711)) * pow((1. + sq_1),(1. + 0.711)));
  switch (pre->photoion_mode){
    case recfast_photoion_Tmat:
      Rup_He = 4.*Rdown_He*pow((pre->CR*Tmat),1.5)*exp(-pre->CDB_He/Tmat);
      break;
    case recfast_photoion_Trad:
    default:
      Rup_He = 4.*pow(10.,-16.744)/(sqrt(Trad/pow(10.,0.477121)) * pow((1.+sqrt(Trad/pow(10.,0.477121))),(1.-0.711)) * pow((1. + sqrt(Trad/pow(10.,5.114))),(1. + 0.711))) * pow((pre->CR*Trad),1.5)*exp(-pre->CDB_He/Trad);
      break;
  }
  if ((x_He < pre->x_He_trigger_small) || (x_He > pre->x_He0_trigger2)){
    Heflag = 0;
  }
  else if(z<pre->z_switch_late){
    Heflag = 2;
  }
  else{
    Heflag = pre->Heswitch;
  }
  if (Heflag == 0){
    K_He = pre->CK_He/Hz;
  }
  else {
    tauHe_s = 1.798287e9*pre->CK_He*3.*n_He*(1.-x_He)/Hz;
    pHe_s = (1.-exp(-tauHe_s))/tauHe_s;
    K_He = 1./(1.798287e9*pHe_s*3.*n_He*(1.-x_He));
    if (((Heflag == 2) || (Heflag >= 5)) && (x_H < pre->x_H_limit_KHe)) {
      Doppler = 2.*1.3806504e-23*Tmat/(1.673575e-27*3.9715*2.99792458e8*2.99792458e8);
      Doppler = 2.99792458e8*1.71134891e7*sqrt(Doppler);
      gamma_2Ps = 3.*1.798287e9*pre->fHe*(1.-x_He)*2.99792458e8*2.99792458e8
          /(sqrt(3.1415926535897932384626433832795e0)*1.436289e-22*8.*3.1415926535897932384626433832795e0*Doppler*(1.-x_H))
          /pow(2.99792458e8*1.71134891e7,2);
      pb = 0.36;
      qb = pre->fudge_He;
      AHcon = 1.798287e9/(1.+pb*pow(gamma_2Ps,qb));
      K_He=1./((1.798287e9*pHe_s+AHcon)*3.*n_He*(1.-x_He));
    }
    if (Heflag >= 3) {
      Rdown_trip = pow(10.,-16.306)/(sq_0*pow((1.+sq_0),(1.-0.761)) * pow((1.+sq_1),(1.+0.761)));
      switch (pre->photoion_mode){
        case recfast_photoion_Tmat:
          Rup_trip = Rdown_trip*exp(-6.62606896e-34*2.99792458e8*3.8454693845e6/(1.3806504e-23*Tmat))*pow(pre->CR*Tmat,1.5)*4./3.;
          break;
        case recfast_photoion_Trad:
        default:
          Rup_trip = pow(10.,-16.306)/(sqrt(Trad/pow(10.,0.477121))*pow((1.+sqrt(Trad/pow(10.,0.477121))),(1.-0.761)) * pow((1.+sqrt(Trad/pow(10.,5.114))),(1.+0.761))) *exp(-6.62606896e-34*2.99792458e8*3.8454693845e6/(1.3806504e-23*Trad))*pow(pre->CR*Trad,1.5)*4./3.;
          break;
      }
      if (pth->has_varconst == 1) {
        Rdown_trip *= pre->fsR*pre->fsR/pre->meR/pre->meR;
        Rup_trip *= pre->fsR*pre->fsR*pre->fsR*pre->fsR*pre->fsR*pre->meR;
      }
      tauHe_t = 177.58e0*n_He*(1.-x_He)*3./(8.*3.1415926535897932384626433832795e0*Hz*pow(1.690871466e7,3));
      pHe_t = (1. - exp(-tauHe_t))/tauHe_t;
      CL_PSt = 6.62606896e-34*2.99792458e8*(1.690871466e7 - 1.5985597526e7)/1.3806504e-23;
      if ((Heflag == 3) || (Heflag == 5) || (x_H >= pre->x_H_limit_CfHe_t)) {
        CfHe_t = 177.58e0*pHe_t*exp(-CL_PSt/Tmat);
        CfHe_t = CfHe_t/(Rup_trip+CfHe_t);
      }
      else {
        Doppler = 2.*1.3806504e-23*Tmat/(1.673575e-27*3.9715*2.99792458e8*2.99792458e8);
        Doppler = 2.99792458e8*1.690871466e7*sqrt(Doppler);
        gamma_2Pt = 3.*177.58e0*pre->fHe*(1.-x_He)*2.99792458e8*2.99792458e8
          /(sqrt(3.1415926535897932384626433832795e0)*1.484872e-22*8.*3.1415926535897932384626433832795e0*Doppler*(1.-x_H))
          /pow(2.99792458e8*1.690871466e7,2);
        pb = 0.66;
        qb = 0.9;
        AHcon = 177.58e0/(1.+pb*pow(gamma_2Pt,qb))/3.;
        CfHe_t = (177.58e0*pHe_t+AHcon)*exp(-CL_PSt/Tmat);
        CfHe_t = CfHe_t/(Rup_trip+CfHe_t);
      }
    }
  }
  if (pth->has_varconst == 1) {
    Rdown_He *= pre->fsR*pre->fsR/pre->meR/pre->meR;
    Rup_He *= pre->fsR*pre->fsR*pre->fsR*pre->fsR*pre->fsR*pre->meR;
  }
  if (x_He < 1.e-15){
    *dxHe_dz=0.;
  }
  else {
    if (pre->CDB_He2s2p/Tmat < pre->max_exp_boltz){
      He_Boltz=exp(pre->CDB_He2s2p/Tmat);
    }
    else{
      He_Boltz=exp(pre->max_exp_boltz);
    }
    if (pth->has_varconst == 1) {
      K_He /= pow(pre->fsR*pre->fsR*pre->meR,3);
      A2s1sHe *= pow(pre->fsR, 8)*pre->meR;
    }
    C_He = (1. + K_He*A2s1sHe*n_He*(1.-x_He)*He_Boltz)/(1. + K_He*(A2s1sHe+Rup_He)*n_He*(1.-x_He)*He_Boltz);
    *dxHe_dz = (x*x_He*nH*Rdown_He - Rup_He*(1.-x_He)*exp(-pre->CL_He/Tmat)) * C_He / (Hz*(1+z));
    if (Heflag >= 3){
      *dxHe_dz += (x*x_He*nH*Rdown_trip - (1.-x_He)*3.*Rup_trip*exp(-pre->CL_Het/Tmat)) *CfHe_t/(Hz*(1.+z));
    }
  }
  return 0;
}

variable_types: Doppler double

variable_types: pb double

variable_types: qb double

variable_types: AHcon double

variable_types: Heflag int

return_type: int

user_defined_types: enum recombination_algorithm { recfast=0, hyrec=1 }

user_defined_types: enum recfast_photoion_modes { recfast_photoion_Tmat=0, recfast_photoion_Trad=1 }

user_defined_types: enum reionization_parametrization { reio_none=0, reio_camb=1, reio_bins_tanh=2, reio_half_tanh=3, reio_many_tanh=4, reio_inter=5 }

user_defined_types: enum reionization_z_or_tau { reio_z=0, reio_tau=1 }

user_defined_types: enum PBH_accretion_approx { spherical_accretion=0, disk_accretion=1 }


decompiled_code:
__int64 __fastcall thermodynamics_hyrec_free(void **a1)
{
hyrec_free(*a1);
free(*a1);
return 0LL;
}

canonical_decompiled_code:
__int64 __fastcall func1(void **a1)
{
hyrec_free(*a1);
free(*a1);
return 0LL;
}

original_code:
int thermodynamics_hyrec_free(struct thermohyrec* phy){
  hyrec_free(phy->data);
  free(phy->data);
  return 0;
}

canonical_original_code:
int thermodynamics_hyrec_free(struct thermohyrec *phy){
  hyrec_free(phy->data);
  free(phy->data);
  return 0;
}

variable_types: struct thermohyrec { struct HYREC_DATA { struct HYREC_ATOMIC { double logTR_tab[100]; double T_RATIO_tab[40]; double **logAlpha_tab[4]; double logR2p2s_tab[100]; double DlogTR; double Eb_tab[311]; double A1s_tab[311]; double A2s_tab[311]; double A3s3d_tab[311]; double A4s4d_tab[311]; } *atomic; struct REC_COSMOPARAMS { double h; double T0; double obh2; double w0; double Neff; double Nur; double Nmnu; double mnu[3]; double fHe; double nH0; double YHe; double fsR; double dlna; struct INJ_PARAMS { double odmh2; double pann; double ann_z; double ann_z_halo; double decay; double Mpbh; int on_the_spot; double ion; } *inj_params; } *cosmo; double zmax; double zmin; long Nz; double *xe_output; double *Tm_output; int error; int quasi_eq; int loop_after_quasi; int Tm_evolve_implicit; char *error_message; char *path_to_hyrec; struct RADIATION { double z0; long iz_rad_0; double **Dfminus_hist; double **Dfnu_hist; double **Dfminus_Ly_hist; } *rad; struct FIT_FUNC { double *swift_func[5]; } *fit; } *data; double zstart; double zend; double xHeII_limit; char error_message[2048]; int thermohyrec_verbose; } *

user_defined_types: struct thermohyrec { struct HYREC_DATA *data; double zstart; double zend; double xHeII_limit; char error_message[2048]; int thermohyrec_verbose; }

user_defined_types: struct HYREC_DATA { struct HYREC_ATOMIC *atomic; struct REC_COSMOPARAMS *cosmo; double zmax; double zmin; long Nz; double *xe_output; double *Tm_output; int error; int quasi_eq; int loop_after_quasi; int Tm_evolve_implicit; char *error_message; char *path_to_hyrec; struct RADIATION *rad; struct FIT_FUNC *fit; }

user_defined_types: struct REC_COSMOPARAMS { double h; double T0; double obh2; double w0; double Neff; double Nur; double Nmnu; double mnu[3]; double fHe; double nH0; double YHe; double fsR; double dlna; struct INJ_PARAMS *inj_params; }


original_code:
int hyrec_dx_H_dz(struct thermodynamics* pth, struct thermohyrec* phy, double x_H, double x_He, double xe, double nH, double z, double Hz, double Tmat, double Trad, double alpha, double me, double *dx_H_dz) {
  struct injection* pin = &(pth->in);
  long iz = 0;
  int model;
  double Trad_phys;
  { if (4 == 3) { { ErrorMsg Optional_arguments; class_protect_sprintf(Optional_arguments,"FULL mode is currently not allowed for HyRec-2"); { ErrorMsg FMsg; class_protect_sprintf(FMsg,"condition (%s) is true; %s","MODEL == FULL",Optional_arguments); class_protect_sprintf(phy->error_message,"%s(L:%d) :%s",__func__,114,FMsg); }; }; return 1; } };
  if (pth->has_exotic_injection == 1) {
    phy->data->cosmo->inj_params->ion = pin->pvecdeposition[pin->index_dep_ionH]/nH/(13.5984336478*1.602176487e-19);
    phy->data->cosmo->inj_params->exclya = pin->pvecdeposition[pin->index_dep_lya]/nH/(10.1988356821*1.602176487e-19);
  }
  else{
    phy->data->cosmo->inj_params->ion = 0.;
    phy->data->cosmo->inj_params->exclya = 0.;
  }
  if (pth->has_varconst == 1) {
    phy->data->cosmo->fsR = alpha;
    phy->data->cosmo->meR = me;
  }
  Trad_phys = Trad*8.617343e-5;
  if (pth->has_varconst == 1) {
    Trad_phys /= phy->data->cosmo->fsR*phy->data->cosmo->fsR*phy->data->cosmo->meR;
  }
  if (Trad_phys <= 0.004 || Tmat/Trad <= 0.1) { model = 0; }
  else { model = 4; }
  *dx_H_dz = -1./(1.+z)* rec_dxHIIdlna(phy->data, model, xe, x_H, nH*1e-6, Hz, Tmat*8.617343e-5, Trad*8.617343e-5, iz, z);
  if(phy->data->error != 0){
    { ErrorMsg FMsg; class_protect_sprintf(FMsg,"error in %s;\n=>%s","rec_dxHIIdlna",phy->data->error_message); class_protect_sprintf(phy->error_message,"%s(L:%d) :%s",__func__,143,FMsg); };;
    return 1;
  }
  return 0;
}

canonical_original_code:
int hyrec_dx_H_dz(struct thermodynamics *pth, struct thermohyrec *phy, double x_H, double x_He, double xe, double nH, double z, double Hz, double Tmat, double Trad, double alpha, double me, double *dx_H_dz) {
  struct injection *pin = &(pth->in);
  long iz = 0;
  int model;
  double Trad_phys;
  { if (4 == 3) { { char Optional_arguments[2048]; class_protect_sprintf(Optional_arguments,"FULL mode is currently not allowed for HyRec-2"); { char FMsg[2048]; class_protect_sprintf(FMsg,"condition (%s) is true; %s","MODEL == FULL",Optional_arguments); class_protect_sprintf(phy->error_message,"%s(L:%d) :%s",__func__,114,FMsg); }; }; return 1; } };
  if (pth->has_exotic_injection == 1) {
    phy->data->cosmo->inj_params->ion = pin->pvecdeposition[pin->index_dep_ionH]/nH/(13.5984336478*1.602176487e-19);
    phy->data->cosmo->inj_params->exclya = pin->pvecdeposition[pin->index_dep_lya]/nH/(10.1988356821*1.602176487e-19);
  }
  else{
    phy->data->cosmo->inj_params->ion = 0.;
    phy->data->cosmo->inj_params->exclya = 0.;
  }
  if (pth->has_varconst == 1) {
    phy->data->cosmo->fsR = alpha;
    phy->data->cosmo->meR = me;
  }
  Trad_phys = Trad*8.617343e-5;
  if (pth->has_varconst == 1) {
    Trad_phys /= phy->data->cosmo->fsR*phy->data->cosmo->fsR*phy->data->cosmo->meR;
  }
  if (Trad_phys <= 0.004 || Tmat/Trad <= 0.1) { model = 0; }
  else { model = 4; }
  *dx_H_dz = -1./(1.+z)* rec_dxHIIdlna(phy->data, model, xe, x_H, nH*1e-6, Hz, Tmat*8.617343e-5, Trad*8.617343e-5, iz, z);
  if(phy->data->error != 0){
    { char FMsg[2048]; class_protect_sprintf(FMsg,"error in %s;\n=>%s","rec_dxHIIdlna",phy->data->error_message); class_protect_sprintf(phy->error_message,"%s(L:%d) :%s",__func__,143,FMsg); };;
    return 1;
  }
  return 0;
}

variable_types: struct thermodynamics { double YHe; double bbn_alpha_sensitivity; enum recombination_algorithm { recfast=0, hyrec=1 } recombination; enum recfast_photoion_modes { recfast_photoion_Tmat=0, recfast_photoion_Trad=1 } recfast_photoion_mode; enum reionization_parametrization { reio_none=0, reio_camb=1, reio_bins_tanh=2, reio_half_tanh=3, reio_many_tanh=4, reio_inter=5 } reio_parametrization; enum reionization_z_or_tau { reio_z=0, reio_tau=1 } reio_z_or_tau; double tau_reio; double z_reio; short compute_cb2_derivatives; short compute_damping_scale; short has_idm_b; short has_idm_g; short has_idm_dr; double reionization_width; double reionization_exponent; double helium_fullreio_redshift; double helium_fullreio_width; int binned_reio_num; double *binned_reio_z; double *binned_reio_xe; double binned_reio_step_sharpness; int many_tanh_num; double *many_tanh_z; double *many_tanh_xe; double many_tanh_width; int reio_inter_num; double *reio_inter_z; double *reio_inter_xe; short has_exotic_injection; struct injection { double DM_annihilation_efficiency; double DM_annihilation_cross_section; double DM_annihilation_mass; double DM_annihilation_fraction; double DM_annihilation_variation; double DM_annihilation_z; double DM_annihilation_zmax; double DM_annihilation_zmin; double DM_annihilation_f_halo; double DM_annihilation_z_halo; double DM_decay_fraction; double DM_decay_Gamma; double PBH_evaporation_fraction; double PBH_evaporation_mass; double PBH_accretion_fraction; double PBH_accretion_mass; enum PBH_accretion_approx { spherical_accretion=0, disk_accretion=1 } PBH_accretion_recipe; double PBH_accretion_relative_velocities; double PBH_accretion_ADAF_delta; double PBH_accretion_eigenvalue; int f_eff_type; char f_eff_file[256]; int chi_type; char chi_z_file[256]; char chi_x_file[256]; int Nz_size; double z_initial; double z_start_chi_approx; double H0; double T_g0; double Omega0_b; double Omega0_cdm; double rho0_cdm; double H; double a; double t; double rho_g; double rho_b; double rho_cdm; double fHe; double N_e0; double heat_capacity; double T_b; double x_e; double nH; double *z_table; int z_size; double tol_z_table; int filled_until_index_z; double filled_until_z; int last_index_z_feff; int last_index_z_chi; int last_index_z_inj; int last_index_z; int index_z_store; int last_index_x_chi; double PBH_z_evaporation; double PBH_QCD_activation; double *PBH_table_z; double *PBH_table_mass; double *PBH_table_mass_dd; double *PBH_table_F; double *PBH_table_F_dd; int Nz_PBH; double **injection_table; int index_inj_cool; int index_inj_diss; int index_inj_DM_ann; int index_inj_DM_dec; int index_inj_PBH_eva; int index_inj_PBH_acc; int index_inj_tot; int inj_size; double f_eff; int feff_z_size; double *feff_table; double *chiz_table; int chiz_size; double *chix_table; int chix_size; double **deposition_table; double *chi; int index_dep_heat; int index_dep_ionH; int index_dep_ionHe; int index_dep_lya; int index_dep_lowE; int dep_size; double *pvecdeposition; int has_exotic_injection; int has_DM_ann; int has_DM_dec; int has_PBH_eva; int has_PBH_acc; int to_store; char error_message[2048]; } in; double annihilation; short has_on_the_spot; double decay; double annihilation_variation; double annihilation_z; double annihilation_zmax; double annihilation_zmin; double annihilation_f_halo; double annihilation_z_halo; short has_varconst; int index_th_xe; int index_th_dkappa; int index_th_tau_d; int index_th_ddkappa; int index_th_dddkappa; int index_th_exp_m_kappa; int index_th_g; int index_th_dg; int index_th_ddg; int index_th_T_idm; int index_th_c2_idm; int index_th_T_idr; int index_th_dmu_idm_dr; int index_th_ddmu_idm_dr; int index_th_dddmu_idm_dr; int index_th_dmu_idr; int index_th_tau_idm_dr; int index_th_tau_idr; int index_th_g_idm_dr; int index_th_dmu_idm_g; int index_th_ddmu_idm_g; int index_th_dddmu_idm_g; int index_th_exp_mu_idm_g; int index_th_R_idm_b; int index_th_dR_idm_b; int index_th_ddR_idm_b; int index_th_Tb; int index_th_dTb; int index_th_wb; int index_th_cb2; int index_th_dcb2; int index_th_ddcb2; int index_th_rate; int index_th_r_d; int th_size; int tt_size; double *z_table; double *tau_table; double *thermodynamics_table; double *d2thermodynamics_dz2_table; double z_rec; double tau_rec; double rs_rec; double ds_rec; double ra_rec; double da_rec; double rd_rec; double z_star; double tau_star; double rs_star; double ds_star; double ra_star; double da_star; double rd_star; double z_d; double tau_d; double ds_d; double rs_d; double tau_cut; double angular_rescaling; double tau_free_streaming; double tau_idr_free_streaming; double tau_idr; double tau_idm_dr; double tau_ini; double fHe; double n_e; double m_idm; double a_idm_dr; double b_idr; double n_index_idm_dr; double cross_idm_b; int n_index_idm_b; double n_coeff_idm_b; double cross_idm_g; double u_idm_g; int n_index_idm_g; short inter_normal; short inter_closeby; short thermodynamics_verbose; short hyrec_verbose; char error_message[2048]; } *

variable_types: xe double

variable_types: alpha double

variable_types: me double

variable_types: iz long

variable_types: model int

variable_types:
FMsg
char [2048]

user_defined_types: struct HYREC_ATOMIC { double logTR_tab[100]; double T_RATIO_tab[40]; double **logAlpha_tab[4]; double logR2p2s_tab[100]; double DlogTR; double Eb_tab[311]; double A1s_tab[311]; double A2s_tab[311]; double A3s3d_tab[311]; double A4s4d_tab[311]; }

user_defined_types: struct RADIATION { double z0; long iz_rad_0; double **Dfminus_hist; double **Dfnu_hist; double **Dfminus_Ly_hist; }

user_defined_types: struct FIT_FUNC { double *swift_func[5]; }

user_defined_types: struct INJ_PARAMS { double odmh2; double pann; double ann_z; double ann_z_halo; double decay; double Mpbh; int on_the_spot; double ion; }


original_code:
int hyrec_dx_He_dz(struct thermodynamics* pth, struct thermohyrec* phy, double x_H, double x_He, double xe, double nH, double z, double Hz, double Tmat, double Trad, double alpha, double me, double *dx_He_dz) {
  struct injection* pin = &(pth->in);
  double xHeII = x_He*phy->data->cosmo->fHe;
  { if (4 == 3) { { ErrorMsg Optional_arguments; class_protect_sprintf(Optional_arguments,"FULL mode is currently not allowed for HyRec-2"); { ErrorMsg FMsg; class_protect_sprintf(FMsg,"condition (%s) is true; %s","MODEL == FULL",Optional_arguments); class_protect_sprintf(phy->error_message,"%s(L:%d) :%s",__func__,177,FMsg); }; }; return 1; } };
  if (pth->has_exotic_injection == 1) {
    phy->data->cosmo->inj_params->ion = pin->pvecdeposition[pin->index_dep_ionHe]/nH/(13.5984336478*1.602176487e-19);
    phy->data->cosmo->inj_params->exclya = pin->pvecdeposition[pin->index_dep_lya]/nH/(10.1988356821*1.602176487e-19);
  }
  else{
    phy->data->cosmo->inj_params->ion = 0.;
    phy->data->cosmo->inj_params->exclya = 0.;
  }
  if (pth->has_varconst == 1) {
    phy->data->cosmo->fsR = alpha;
    phy->data->cosmo->meR = me;
  }
  if (xHeII<phy->xHeII_limit) {
    *dx_He_dz=0;
  }
  else {
    *dx_He_dz = -1./(1.+z)* rec_helium_dxHeIIdlna(phy->data, z, 1.-x_H, xHeII, Hz) / phy->data->cosmo->fHe;
    if(phy->data->error != 0){
      { ErrorMsg FMsg; class_protect_sprintf(FMsg,"error in %s;\n=>%s","rec_helium_dxHeIIdlna",phy->data->error_message); class_protect_sprintf(phy->error_message,"%s(L:%d) :%s",__func__,204,FMsg); };;
      return 1;
    }
  }
  return 0;
}

canonical_original_code:
int hyrec_dx_He_dz(struct thermodynamics *pth, struct thermohyrec *phy, double x_H, double x_He, double xe, double nH, double z, double Hz, double Tmat, double Trad, double alpha, double me, double *dx_He_dz) {
  struct injection *pin = &(pth->in);
  double xHeII = x_He*phy->data->cosmo->fHe;
  { if (4 == 3) { { char Optional_arguments[2048]; class_protect_sprintf(Optional_arguments,"FULL mode is currently not allowed for HyRec-2"); { char FMsg[2048]; class_protect_sprintf(FMsg,"condition (%s) is true; %s","MODEL == FULL",Optional_arguments); class_protect_sprintf(phy->error_message,"%s(L:%d) :%s",__func__,177,FMsg); }; }; return 1; } };
  if (pth->has_exotic_injection == 1) {
    phy->data->cosmo->inj_params->ion = pin->pvecdeposition[pin->index_dep_ionHe]/nH/(13.5984336478*1.602176487e-19);
    phy->data->cosmo->inj_params->exclya = pin->pvecdeposition[pin->index_dep_lya]/nH/(10.1988356821*1.602176487e-19);
  }
  else{
    phy->data->cosmo->inj_params->ion = 0.;
    phy->data->cosmo->inj_params->exclya = 0.;
  }
  if (pth->has_varconst == 1) {
    phy->data->cosmo->fsR = alpha;
    phy->data->cosmo->meR = me;
  }
  if (xHeII<phy->xHeII_limit) {
    *dx_He_dz=0;
  }
  else {
    *dx_He_dz = -1./(1.+z)* rec_helium_dxHeIIdlna(phy->data, z, 1.-x_H, xHeII, Hz) / phy->data->cosmo->fHe;
    if(phy->data->error != 0){
      { char FMsg[2048]; class_protect_sprintf(FMsg,"error in %s;\n=>%s","rec_helium_dxHeIIdlna",phy->data->error_message); class_protect_sprintf(phy->error_message,"%s(L:%d) :%s",__func__,204,FMsg); };;
      return 1;
    }
  }
  return 0;
}

variable_types: nH double

variable_types: z double

variable_types: Hz double

variable_types: Tmat double

variable_types: Trad double

variable_types: struct injection { double DM_annihilation_efficiency; double DM_annihilation_cross_section; double DM_annihilation_mass; double DM_annihilation_fraction; double DM_annihilation_variation; double DM_annihilation_z; double DM_annihilation_zmax; double DM_annihilation_zmin; double DM_annihilation_f_halo; double DM_annihilation_z_halo; double DM_decay_fraction; double DM_decay_Gamma; double PBH_evaporation_fraction; double PBH_evaporation_mass; double PBH_accretion_fraction; double PBH_accretion_mass; enum PBH_accretion_approx { spherical_accretion=0, disk_accretion=1 } PBH_accretion_recipe; double PBH_accretion_relative_velocities; double PBH_accretion_ADAF_delta; double PBH_accretion_eigenvalue; int f_eff_type; char f_eff_file[256]; int chi_type; char chi_z_file[256]; char chi_x_file[256]; int Nz_size; double z_initial; double z_start_chi_approx; double H0; double T_g0; double Omega0_b; double Omega0_cdm; double rho0_cdm; double H; double a; double t; double rho_g; double rho_b; double rho_cdm; double fHe; double N_e0; double heat_capacity; double T_b; double x_e; double nH; double *z_table; int z_size; double tol_z_table; int filled_until_index_z; double filled_until_z; int last_index_z_feff; int last_index_z_chi; int last_index_z_inj; int last_index_z; int index_z_store; int last_index_x_chi; double PBH_z_evaporation; double PBH_QCD_activation; double *PBH_table_z; double *PBH_table_mass; double *PBH_table_mass_dd; double *PBH_table_F; double *PBH_table_F_dd; int Nz_PBH; double **injection_table; int index_inj_cool; int index_inj_diss; int index_inj_DM_ann; int index_inj_DM_dec; int index_inj_PBH_eva; int index_inj_PBH_acc; int index_inj_tot; int inj_size; double f_eff; int feff_z_size; double *feff_table; double *chiz_table; int chiz_size; double *chix_table; int chix_size; double **deposition_table; double *chi; int index_dep_heat; int index_dep_ionH; int index_dep_ionHe; int index_dep_lya; int index_dep_lowE; int dep_size; double *pvecdeposition; int has_exotic_injection; int has_DM_ann; int has_DM_dec; int has_PBH_eva; int has_PBH_acc; int to_store; char error_message[2048]; } *

variable_types: xHeII double


decompiled_code:
__int64 __fastcall gt_init(__int64 a1)
{
void *v1; // rax
__int64 result; // rax
char v3[2072]; // [rsp+0h] [rbp-818h] BYREF

v1 = malloc(0x1000uLL);
*(_QWORD *)a1 = v1;
if ( v1 )
{
*(_QWORD *)(a1 + 8) = 4096LL;
result = 0LL;
*(_QWORD *)(a1 + 16) = 0LL;
*(_DWORD *)(a1 + 24) = 0;
}
else
{
class_protect_sprintf(v3, "could not allocate %s with size %d", "self->buffer", 4096LL);
class_protect_sprintf(a1 + 28, "%s(L:%d) :%s", "gt_init", 17LL, v3);
result = 1LL;
}
return result;
}

canonical_decompiled_code:
__int64 __fastcall func0(__int64 a1)
{
void *v1; // rax
__int64 result; // rax
char v3[2072]; // [rsp+0h] [rbp-818h] BYREF

v1 = malloc(0x1000uLL);
*(_QWORD *)a1 = v1;
if ( v1 )
{
*(_QWORD *)(a1 + 8) = 4096LL;
result = 0LL;
*(_QWORD *)(a1 + 16) = 0LL;
*(_DWORD *)(a1 + 24) = 0;
}
else
{
class_protect_sprintf(v3, "could not allocate %s with size %d", "self->buffer", 4096LL);
class_protect_sprintf(a1 + 28, "%s(L:%d) :%s", "gt_init", 17LL, v3);
result = 1LL;
}
return result;
}

original_code:
int gt_init(
  growTable* self
  ) {
  { self->buffer=malloc(4096); if (self->buffer == ((void *)0)) { int size_int; size_int = 4096; { ErrorMsg FMsg; class_protect_sprintf(FMsg,"could not allocate %s with size %d","self->buffer",size_int); class_protect_sprintf(self->error_message,"%s(L:%d) :%s",__func__,17,FMsg); };; return 1; } };
  self->sz=4096;
  self->csz=0;
  self->freeze=0;
  return 0;
}

canonical_original_code:
int gt_init(struct growTable *self) {
  { self->buffer=malloc(4096); if (self->buffer == ((void *)0)) { int size_int; size_int = 4096; { char FMsg[2048]; class_protect_sprintf(FMsg,"could not allocate %s with size %d","self->buffer",size_int); class_protect_sprintf(self->error_message,"%s(L:%d) :%s",__func__,17,FMsg); };; return 1; } };
  self->sz=4096;
  self->csz=0;
  self->freeze=0;
  return 0;
}

variable_types: struct growTable { void *buffer; long sz; long csz; int freeze; char error_message[2048]; } *


decompiled_code:
__int64 __fastcall gt_add(char **a1, __int64 a2, const void *a3, size_t a4)
{
unsigned int v5; // er14
__int64 v6; // r12
signed __int64 v9; // rsi
size_t v10; // rbp
char *v11; // rdi
char *v12; // rax
__int64 v14; // rdi
__int64 v15; // rcx
char v16[2048]; // [rsp+0h] [rbp-1038h] BYREF
char v17[2104]; // [rsp+800h] [rbp-838h] BYREF

v5 = *((_DWORD *)a1 + 6);
if ( v5 == 1 )
{
class_protect_sprintf(v16, "cannot add any more data in the growTable (freeze is on)");
class_protect_sprintf(v17, "condition (%s) is true; %s", "self->freeze == _TRUE_", v16);
class_protect_sprintf((char *)a1 + 28, "%s(L:%d) :%s", "gt_add", 41LL, v17);
return v5;
}
v6 = a2;
if ( a2 == -1 )
v6 = (__int64)a1[2];
if ( v6 < 0 )
{
class_protect_sprintf(v16, "Don't know what to do with idx=%ld", v6);
class_protect_sprintf(v17, "condition (%s) is true; %s", "ridx<0", v16);
v14 = (__int64)a1 + 28;
v15 = 51LL;
goto LABEL_12;
}
v9 = (signed __int64)a1[1];
v10 = v6 + a4;
v11 = *a1;
if ( (__int64)(v6 + a4) > v9 )
{
v12 = (char *)realloc(v11, 2 * v9);
v11 = v12;
if ( !v12 )
{
class_protect_sprintf(v16, "Cannot grow growTable");
class_protect_sprintf(v17, "condition (%s) is true; %s", "nbuffer==NULL", v16);
v14 = (__int64)a1 + 28;
v15 = 58LL;
goto LABEL_12;
}
*a1 = v12;
a1[1] = (char *)(2LL * (_QWORD)a1[1]);
}
if ( memcpy(&v11[v6], a3, a4) != &(*a1)[v6] )
{
class_protect_sprintf(v16, "Cannot add data to growTable");
class_protect_sprintf(v17, "condition (%s) is true; %s", "res!=self->buffer+ridx", v16);
v14 = (__int64)a1 + 28;
v15 = 66LL;
LABEL_12:
v5 = 1;
class_protect_sprintf(v14, "%s(L:%d) :%s", "gt_add", v15, v17);
return v5;
}
a1[2] = (char *)v10;
return 0;
}

canonical_decompiled_code:
__int64 __fastcall func1(char **a1, __int64 a2, const void *a3, size_t a4)
{
unsigned int v5; // er14
__int64 v6; // r12
signed __int64 v9; // rsi
size_t v10; // rbp
char *v11; // rdi
char *v12; // rax
__int64 v14; // rdi
__int64 v15; // rcx
char v16[2048]; // [rsp+0h] [rbp-1038h] BYREF
char v17[2104]; // [rsp+800h] [rbp-838h] BYREF

v5 = *((_DWORD *)a1 + 6);
if ( v5 == 1 )
{
class_protect_sprintf(v16, "cannot add any more data in the growTable (freeze is on)");
class_protect_sprintf(v17, "condition (%s) is true; %s", "self->freeze == _TRUE_", v16);
class_protect_sprintf((char *)a1 + 28, "%s(L:%d) :%s", "gt_add", 41LL, v17);
return v5;
}
v6 = a2;
if ( a2 == -1 )
v6 = (__int64)a1[2];
if ( v6 < 0 )
{
class_protect_sprintf(v16, "Don't know what to do with idx=%ld", v6);
class_protect_sprintf(v17, "condition (%s) is true; %s", "ridx<0", v16);
v14 = (__int64)a1 + 28;
v15 = 51LL;
goto LABEL_12;
}
v9 = (signed __int64)a1[1];
v10 = v6 + a4;
v11 = *a1;
if ( (__int64)(v6 + a4) > v9 )
{
v12 = (char *)realloc(v11, 2 * v9);
v11 = v12;
if ( !v12 )
{
class_protect_sprintf(v16, "Cannot grow growTable");
class_protect_sprintf(v17, "condition (%s) is true; %s", "nbuffer==NULL", v16);
v14 = (__int64)a1 + 28;
v15 = 58LL;
goto LABEL_12;
}
*a1 = v12;
a1[1] = (char *)(2LL * (_QWORD)a1[1]);
}
if ( memcpy(&v11[v6], a3, a4) != &(*a1)[v6] )
{
class_protect_sprintf(v16, "Cannot add data to growTable");
class_protect_sprintf(v17, "condition (%s) is true; %s", "res!=self->buffer+ridx", v16);
v14 = (__int64)a1 + 28;
v15 = 66LL;
LABEL_12:
v5 = 1;
class_protect_sprintf(v14, "%s(L:%d) :%s", "gt_add", v15, v17);
return v5;
}
a1[2] = (char *)v10;
return 0;
}

original_code:
int gt_add(
  growTable* self,
  long idx,
  void* data,
  long sz
  ) {
  long ridx;
  void *res;
  void *nbuffer;
  { if (self->freeze == 1) { { ErrorMsg Optional_arguments; class_protect_sprintf(Optional_arguments,"cannot add any more data in the growTable (freeze is on)"); { ErrorMsg FMsg; class_protect_sprintf(FMsg,"condition (%s) is true; %s","self->freeze == _TRUE_",Optional_arguments); class_protect_sprintf(self->error_message,"%s(L:%d) :%s",__func__,41,FMsg); }; }; return 1; } };
  if (idx==-1) {
    ridx=self->csz;
  }
  else {
    ridx=idx;
  }
  { if (ridx<0) { { ErrorMsg Optional_arguments; class_protect_sprintf(Optional_arguments,"Don't know what to do with idx=%ld",ridx); { ErrorMsg FMsg; class_protect_sprintf(FMsg,"condition (%s) is true; %s","ridx<0",Optional_arguments); class_protect_sprintf(self->error_message,"%s(L:%d) :%s",__func__,51,FMsg); }; }; return 1; } };
  if (ridx+sz>self->sz) {
    nbuffer=realloc(self->buffer,self->sz*2);
    { if (nbuffer==((void *)0)) { { ErrorMsg Optional_arguments; class_protect_sprintf(Optional_arguments,"Cannot grow growTable"); { ErrorMsg FMsg; class_protect_sprintf(FMsg,"condition (%s) is true; %s","nbuffer==NULL",Optional_arguments); class_protect_sprintf(self->error_message,"%s(L:%d) :%s",__func__,58,FMsg); }; }; return 1; } };
    self->buffer=nbuffer;
    self->sz=self->sz*2;
  }
  res=memcpy((void*) (self->buffer+ridx),(void*) data,(size_t) sz);
  { if (res!=self->buffer+ridx) { { ErrorMsg Optional_arguments; class_protect_sprintf(Optional_arguments,"Cannot add data to growTable"); { ErrorMsg FMsg; class_protect_sprintf(FMsg,"condition (%s) is true; %s","res!=self->buffer+ridx",Optional_arguments); class_protect_sprintf(self->error_message,"%s(L:%d) :%s",__func__,66,FMsg); }; }; return 1; } };
  self->csz=ridx+sz;
  return 0;
}

canonical_original_code:
int gt_add(struct growTable *self, long idx, void *data, long sz) {
  long ridx;
  void *res;
  void *nbuffer;
  { if (self->freeze == 1) { { char Optional_arguments[2048]; class_protect_sprintf(Optional_arguments,"cannot add any more data in the growTable (freeze is on)"); { char FMsg[2048]; class_protect_sprintf(FMsg,"condition (%s) is true; %s","self->freeze == _TRUE_",Optional_arguments); class_protect_sprintf(self->error_message,"%s(L:%d) :%s",__func__,41,FMsg); }; }; return 1; } };
  if (idx==-1) {
    ridx=self->csz;
  }
  else {
    ridx=idx;
  }
  { if (ridx<0) { { char Optional_arguments[2048]; class_protect_sprintf(Optional_arguments,"Don't know what to do with idx=%ld",ridx); { char FMsg[2048]; class_protect_sprintf(FMsg,"condition (%s) is true; %s","ridx<0",Optional_arguments); class_protect_sprintf(self->error_message,"%s(L:%d) :%s",__func__,51,FMsg); }; }; return 1; } };
  if (ridx+sz>self->sz) {
    nbuffer=realloc(self->buffer,self->sz*2);
    { if (nbuffer==((void *)0)) { { char Optional_arguments[2048]; class_protect_sprintf(Optional_arguments,"Cannot grow growTable"); { char FMsg[2048]; class_protect_sprintf(FMsg,"condition (%s) is true; %s","nbuffer==NULL",Optional_arguments); class_protect_sprintf(self->error_message,"%s(L:%d) :%s",__func__,58,FMsg); }; }; return 1; } };
    self->buffer=nbuffer;
    self->sz=self->sz*2;
  }
  res=memcpy((void *) (self->buffer+ridx),(void *) data,(unsigned long) sz);
  { if (res!=self->buffer+ridx) { { char Optional_arguments[2048]; class_protect_sprintf(Optional_arguments,"Cannot add data to growTable"); { char FMsg[2048]; class_protect_sprintf(FMsg,"condition (%s) is true; %s","res!=self->buffer+ridx",Optional_arguments); class_protect_sprintf(self->error_message,"%s(L:%d) :%s",__func__,66,FMsg); }; }; return 1; } };
  self->csz=ridx+sz;
  return 0;
}

variable_types: idx long

variable_types:
data
void *

variable_types: sz long

variable_types: ridx long

variable_types:
res
void *

variable_types:
nbuffer
void *

user_defined_types: struct growTable { void *buffer; long sz; long csz; int freeze; char error_message[2048]; }


decompiled_code:
__int64 __fastcall gt_retrieve(_QWORD *a1, __int64 a2, size_t a3, void *a4)
{
__int64 v4; // rax
char *v5; // rdi
__int64 v6; // rcx
__int64 result; // rax
void *v8; // r8
char v9[2048]; // [rsp+0h] [rbp-1018h] BYREF
char v10[2072]; // [rsp+800h] [rbp-818h] BYREF

if ( a2 < 0 )
{
class_protect_sprintf(v9, "don't know what to do with idx=%ld", a2);
class_protect_sprintf(v10, "condition (%s) is true; %s", "idx<0", v9);
v5 = (char *)a1 + 28;
v6 = 87LL;
goto LABEL_5;
}
v4 = a1[2];
if ( v4 < a2 || v4 < (__int64)(a3 + a2) )
{
class_protect_sprintf(v9, "not enough data in growTable");
class_protect_sprintf(v10, "condition (%s) is true; %s", "(idx>self->csz) || (idx+sz>self->csz)", v9);
v5 = (char *)a1 + 28;
v6 = 91LL;
LABEL_5:
class_protect_sprintf(v5, "%s(L:%d) :%s", "gt_retrieve", v6, v10);
return 1LL;
}
v8 = memcpy(a4, (const void *)(a2 + *a1), a3);
result = 0LL;
if ( v8 != (void *)(*a1 + a2) )
{
class_protect_sprintf(v9, "cannot retrieve data from the growTable");
class_protect_sprintf(v10, "condition (%s) is true; %s", "res!=self->buffer+idx", v9);
v5 = (char *)a1 + 28;
v6 = 96LL;
goto LABEL_5;
}
return result;
}

canonical_decompiled_code:
__int64 __fastcall func2(_QWORD *a1, __int64 a2, size_t a3, void *a4)
{
__int64 v4; // rax
char *v5; // rdi
__int64 v6; // rcx
__int64 result; // rax
void *v8; // r8
char v9[2048]; // [rsp+0h] [rbp-1018h] BYREF
char v10[2072]; // [rsp+800h] [rbp-818h] BYREF

if ( a2 < 0 )
{
class_protect_sprintf(v9, "don't know what to do with idx=%ld", a2);
class_protect_sprintf(v10, "condition (%s) is true; %s", "idx<0", v9);
v5 = (char *)a1 + 28;
v6 = 87LL;
goto LABEL_5;
}
v4 = a1[2];
if ( v4 < a2 || v4 < (__int64)(a3 + a2) )
{
class_protect_sprintf(v9, "not enough data in growTable");
class_protect_sprintf(v10, "condition (%s) is true; %s", "(idx>self->csz) || (idx+sz>self->csz)", v9);
v5 = (char *)a1 + 28;
v6 = 91LL;
LABEL_5:
class_protect_sprintf(v5, "%s(L:%d) :%s", "gt_retrieve", v6, v10);
return 1LL;
}
v8 = memcpy(a4, (const void *)(a2 + *a1), a3);
result = 0LL;
if ( v8 != (void *)(*a1 + a2) )
{
class_protect_sprintf(v9, "cannot retrieve data from the growTable");
class_protect_sprintf(v10, "condition (%s) is true; %s", "res!=self->buffer+idx", v9);
v5 = (char *)a1 + 28;
v6 = 96LL;
goto LABEL_5;
}
return result;
}

original_code:
int gt_retrieve(
  growTable *self,
  long idx,
  long sz,
  void* data
  ) {
  void *res;
  { if (idx<0) { { ErrorMsg Optional_arguments; class_protect_sprintf(Optional_arguments,"don't know what to do with idx=%ld",idx); { ErrorMsg FMsg; class_protect_sprintf(FMsg,"condition (%s) is true; %s","idx<0",Optional_arguments); class_protect_sprintf(self->error_message,"%s(L:%d) :%s",__func__,87,FMsg); }; }; return 1; } };
  { if ((idx>self->csz) || (idx+sz>self->csz)) { { ErrorMsg Optional_arguments; class_protect_sprintf(Optional_arguments,"not enough data in growTable"); { ErrorMsg FMsg; class_protect_sprintf(FMsg,"condition (%s) is true; %s","(idx>self->csz) || (idx+sz>self->csz)",Optional_arguments); class_protect_sprintf(self->error_message,"%s(L:%d) :%s",__func__,91,FMsg); }; }; return 1; } };
  res=memcpy(data,self->buffer+idx,sz);
  { if (res!=self->buffer+idx) { { ErrorMsg Optional_arguments; class_protect_sprintf(Optional_arguments,"cannot retrieve data from the growTable"); { ErrorMsg FMsg; class_protect_sprintf(FMsg,"condition (%s) is true; %s","res!=self->buffer+idx",Optional_arguments); class_protect_sprintf(self->error_message,"%s(L:%d) :%s",__func__,96,FMsg); }; }; return 1; } };
  return 0;
}

canonical_original_code:
int gt_retrieve(struct growTable *self, long idx, long sz, void *data) {
  void *res;
  { if (idx<0) { { char Optional_arguments[2048]; class_protect_sprintf(Optional_arguments,"don't know what to do with idx=%ld",idx); { char FMsg[2048]; class_protect_sprintf(FMsg,"condition (%s) is true; %s","idx<0",Optional_arguments); class_protect_sprintf(self->error_message,"%s(L:%d) :%s",__func__,87,FMsg); }; }; return 1; } };
  { if ((idx>self->csz) || (idx+sz>self->csz)) { { char Optional_arguments[2048]; class_protect_sprintf(Optional_arguments,"not enough data in growTable"); { char FMsg[2048]; class_protect_sprintf(FMsg,"condition (%s) is true; %s","(idx>self->csz) || (idx+sz>self->csz)",Optional_arguments); class_protect_sprintf(self->error_message,"%s(L:%d) :%s",__func__,91,FMsg); }; }; return 1; } };
  res=memcpy(data,self->buffer+idx,sz);
  { if (res!=self->buffer+idx) { { char Optional_arguments[2048]; class_protect_sprintf(Optional_arguments,"cannot retrieve data from the growTable"); { char FMsg[2048]; class_protect_sprintf(FMsg,"condition (%s) is true; %s","res!=self->buffer+idx",Optional_arguments); class_protect_sprintf(self->error_message,"%s(L:%d) :%s",__func__,96,FMsg); }; }; return 1; } };
  return 0;
}


decompiled_code:
__int64 __fastcall gt_retrieveAll(_QWORD *a1, void *a2)
{
return gt_retrieve(a1, 0LL, a1[2], a2);
}

canonical_decompiled_code:
__int64 __fastcall func3(_QWORD *a1, void *a2)
{
return func2(a1, 0LL, a1[2], a2);
}

original_code:
int gt_retrieveAll(
  growTable *self,
  void* data
  ) {
  return gt_retrieve(self,0,self->csz,data);
}

canonical_original_code:
int gt_retrieveAll(struct growTable *self, void *data) {
  return gt_retrieve(self,0,self->csz,data);
}


decompiled_code:
__int64 __fastcall gt_getSize(__int64 a1, __int64 *a2)
{
__int64 v2; // rax
__int64 result; // rax
char v4[2048]; // [rsp-800h] [rbp-1018h] BYREF
char v5[2072]; // [rsp+0h] [rbp-818h] BYREF

v2 = *(_QWORD *)(a1 + 16);
if ( v2 < 0 )
{
class_protect_sprintf(v4, "growTable does not make sense");
class_protect_sprintf(v5, "condition (%s) is true; %s", "self->csz<0", v4);
class_protect_sprintf(a1 + 28, "%s(L:%d) :%s", "gt_getSize", 124LL, v5);
result = 1LL;
}
else
{
*a2 = v2;
result = 0LL;
}
return result;
}

canonical_decompiled_code:
__int64 __fastcall func4(__int64 a1, __int64 *a2)
{
__int64 v2; // rax
__int64 result; // rax
char v4[2048]; // [rsp-800h] [rbp-1018h] BYREF
char v5[2072]; // [rsp+0h] [rbp-818h] BYREF

v2 = *(_QWORD *)(a1 + 16);
if ( v2 < 0 )
{
class_protect_sprintf(v4, "growTable does not make sense");
class_protect_sprintf(v5, "condition (%s) is true; %s", "self->csz<0", v4);
class_protect_sprintf(a1 + 28, "%s(L:%d) :%s", "gt_getSize", 124LL, v5);
result = 1LL;
}
else
{
*a2 = v2;
result = 0LL;
}
return result;
}

original_code:
int gt_getSize(
  growTable* self,
  long *idx
  ) {
  { if (self->csz<0) { { ErrorMsg Optional_arguments; class_protect_sprintf(Optional_arguments,"growTable does not make sense"); { ErrorMsg FMsg; class_protect_sprintf(FMsg,"condition (%s) is true; %s","self->csz<0",Optional_arguments); class_protect_sprintf(self->error_message,"%s(L:%d) :%s",__func__,124,FMsg); }; }; return 1; } };
  *idx=self->csz;
  return 0;
}

canonical_original_code:
int gt_getSize(struct growTable *self, long *idx) {
  { if (self->csz<0) { { char Optional_arguments[2048]; class_protect_sprintf(Optional_arguments,"growTable does not make sense"); { char FMsg[2048]; class_protect_sprintf(FMsg,"condition (%s) is true; %s","self->csz<0",Optional_arguments); class_protect_sprintf(self->error_message,"%s(L:%d) :%s",__func__,124,FMsg); }; }; return 1; } };
  *idx=self->csz;
  return 0;
}

variable_types:
idx
long *


decompiled_code:
__int64 __fastcall gt_getPtr(__int64 *a1, _QWORD *a2)
{
__int64 v2; // rax

v2 = *a1;
*((_DWORD *)a1 + 6) = 1;
*a2 = v2;
return 0LL;
}

original_code:
int gt_getPtr(
  growTable* self,
  void** ptr
  ) {
  self->freeze=1;
  *ptr=self->buffer;
  return 0;
}

canonical_original_code:
int gt_getPtr(struct growTable *self, void **ptr) {
  self->freeze=1;
  *ptr=self->buffer;
  return 0;
}

variable_types:
ptr
void **


decompiled_code:
__int64 __fastcall gt_free(__int64 a1)
{
__int64 result; // rax

free(*(void **)a1);
*(_QWORD *)(a1 + 16) = -1LL;
result = 0LL;
*(_QWORD *)(a1 + 8) = -1LL;
*(_DWORD *)(a1 + 24) = 0;
return result;
}

canonical_decompiled_code:
__int64 __fastcall func6(__int64 a1)
{
__int64 result; // rax

free(*(void **)a1);
*(_QWORD *)(a1 + 16) = -1LL;
result = 0LL;
*(_QWORD *)(a1 + 8) = -1LL;
*(_DWORD *)(a1 + 24) = 0;
return result;
}

original_code:
int gt_free(growTable* self) {
  free(self->buffer);
  self->csz=-1;
  self->sz=-1;
  self->freeze=0;
  return 0;
}

canonical_original_code:
int gt_free(struct growTable *self) {
  free(self->buffer);
  self->csz=-1;
  self->sz=-1;
  self->freeze=0;
  return 0;
}


variable_types: x double

variable_types:
Ci
double *

variable_types: y double

variable_types: f double

variable_types: g double


variable_types:
Si
double *


original_code:
double rec_saha_xH1s(REC_COSMOPARAMS *cosmo, double z, double xHeII) {
  double s, Tr, nH, ainv;
  double nH0 = cosmo->nH0, T0 = cosmo->T0;
  double fsR = cosmo->fsR, meR = cosmo->meR;
  Tr = T0 * (ainv=1.+z) /fsR/fsR/meR;
  nH = nH0*ainv*ainv*ainv;
  s = fsR*fsR*fsR*meR*meR*meR *2.4127161187130e15*Tr*sqrt(Tr)*exp(-157801.37882/Tr)/nH;
  if (s == 0.) return 1.;
  else if (s > 1e5) return (1.+xHeII)/s - (xHeII*xHeII + 3.*xHeII + 2.)/s/s;
  else return 1.-2./(1.+ xHeII/s + sqrt((1.+ xHeII/s)*(1.+ xHeII/s) +4./s));
}

canonical_original_code:
double rec_saha_xH1s(struct REC_COSMOPARAMS *cosmo, double z, double xHeII) {
  double s; double Tr; double nH; double ainv;
  double nH0 = cosmo->nH0; double T0 = cosmo->T0;
  double fsR = cosmo->fsR; double meR = cosmo->meR;
  Tr = T0 * (ainv=1.+z) /fsR/fsR/meR;
  nH = nH0*ainv*ainv*ainv;
  s = fsR*fsR*fsR*meR*meR*meR *2.4127161187130e15*Tr*sqrt(Tr)*exp(-157801.37882/Tr)/nH;
  if (s == 0.) return 1.;
  else if (s > 1e5) return (1.+xHeII)/s - (xHeII*xHeII + 3.*xHeII + 2.)/s/s;
  else return 1.-2./(1.+ xHeII/s + sqrt((1.+ xHeII/s)*(1.+ xHeII/s) +4./s));
}

variable_types: struct REC_COSMOPARAMS { double h; double T0; double obh2; double w0; double Neff; double Nur; double Nmnu; double mnu[3]; double fHe; double nH0; double YHe; double fsR; double dlna; struct INJ_PARAMS { double odmh2; double pann; double ann_z; double ann_z_halo; double decay; double Mpbh; int on_the_spot; double ion; } *inj_params; } *

variable_types: z double

variable_types: s double

variable_types: Tr double

variable_types: nH double

variable_types: ainv double

variable_types: fsR double

variable_types: meR double

return_type: double


decompiled_code:
double __fastcall rec_helium_dxHeIIdlna(__int64 a1, double a2, double a3, double a4, double a5)
{
double v8; // xmm2_8
double *v9; // rax
double v10; // xmm7_8
double v11; // xmm6_8
double v12; // xmm3_8
double v13; // xmm4_8
double v14; // xmm0_8
double v15; // xmm5_8
double v16; // xmm6_8
double v17; // xmm5_8
double v18; // xmm12_8
double v19; // xmm6_8
double v20; // xmm7_8
double v21; // xmm0_8
double v22; // xmm0_8
double v23; // xmm2_8
double v24; // xmm4_8
double v25; // xmm5_8
double v26; // xmm6_8
double v27; // xmm7_8
double v28; // xmm1_8
double v29; // xmm0_8
double v30; // xmm0_8
double x; // [rsp+8h] [rbp-1B0h]
double v34; // [rsp+18h] [rbp-1A0h]
double v35; // [rsp+18h] [rbp-1A0h]
double v36; // [rsp+20h] [rbp-198h]
double v37; // [rsp+20h] [rbp-198h]
double v38; // [rsp+28h] [rbp-190h]
double v39; // [rsp+30h] [rbp-188h]
double v40; // [rsp+38h] [rbp-180h]
double v41; // [rsp+38h] [rbp-180h]
double v42; // [rsp+38h] [rbp-180h]
double v43; // [rsp+40h] [rbp-178h]
double v44; // [rsp+48h] [rbp-170h]
double v45; // [rsp+48h] [rbp-170h]
double v46; // [rsp+50h] [rbp-168h]
double v47; // [rsp+58h] [rbp-160h]
double v48; // [rsp+58h] [rbp-160h]
double v49; // [rsp+60h] [rbp-158h]
double v50; // [rsp+68h] [rbp-150h]
double v51; // [rsp+68h] [rbp-150h]
double v52; // [rsp+70h] [rbp-148h]
double v53; // [rsp+78h] [rbp-140h]
double v54; // [rsp+78h] [rbp-140h]
double v55; // [rsp+80h] [rbp-138h]
double v56; // [rsp+80h] [rbp-138h]
double v57; // [rsp+88h] [rbp-130h]
double v58; // [rsp+90h] [rbp-128h]
double v59; // [rsp+98h] [rbp-120h]
char s[280]; // [rsp+A0h] [rbp-118h] BYREF

v39 = a4;
if ( *(_DWORD *)(a1 + 56) == 1 )
return 0.0;
v8 = *(double *)&LC0;
v9 = *(double **)(a1 + 8);
v10 = v9[17];
v11 = v9[1];
v12 = v9[19];
v13 = v9[20];
v43 = 1.0 - a3 + a4;
v14 = v9[16] - a4;
v38 = v14;
if ( v14 < 0.0 )
{
v45 = v9[20];
x = a2;
sprintf(
s,
"xHeI = %E < 0 at z = %f in rec_helium_dxHeIIdlna.\n"
"You should try and extend the hydrogen post-saha phase by increasing DXHII_MAX in history.h\n",
v14,
a2);
strcat(*(char **)(a1 + 72), s);
*(_DWORD *)(a1 + 56) = 1;
v13 = v45;
v8 = *(double *)&LC0;
a2 = x;
}
v15 = a2 + v8;
v16 = v11 * v15 / v12;
v34 = v10 * v15 * v15 * v15;
v17 = v12 * v12 * v12;
v18 = v16 / v12 / v13;
v19 = v17 * v13 * v13 * v13;
v20 = 2.414194e15 * v19 * v18;
if ( v18 < 0.0 )
{
v48 = v13;
v42 = v17 * v13 * v13 * v13;
v21 = sqrt(v18);
v13 = v48;
v20 = 2.414194e15 * v19 * v18;
v19 = v42;
v17 = v12 * v12 * v12;
}
else
{
v21 = sqrt(v18);
}
v59 = v13;
v57 = v17;
v36 = v20 * v21 / v34 * 4.0;
v44 = exp(-285325.0 / v18) * v36;
v46 = exp(46090.0 / v18) / v36;
v47 = exp(39101.0 / v18) / v36 * 3.0;
v37 = v19 * 9.157759999999999e22 * a5 / v34 / a3;
v40 = exp(-6989.0 / v18);
v55 = exp(19754.0 / v18);
v53 = exp(21539.0 / v18);
v52 = exp(28496.0 / v18);
v50 = exp(29224.0 / v18);
v49 = exp(32414.0 / v18);
v22 = exp(32781.0 / v18);
v23 = *(double *)&LC0;
v24 = v59;
v25 = v57 * v12 * v12;
v26 = v25 * v59;
v27 = v34 * 0.00000004277 / a5 * v38 / (v12 * v59 * v59);
v28 = (1976000.0 / (1.0 - v40)
+ 6030000.0 / (v55 - 1.0)
+ 106000000.0 / (v53 - 1.0)
+ 2180000.0 / (v52 - 1.0)
+ 33700000.0 / (v50 - 1.0)
+ 1040000.0 / (v49 - 1.0)
+ 15100000.0 / (v22 - 1.0))
* (v25
* v59)
* v27
/ 39.47841760435743
/ v37;
v29 = 9.869604401089358 * v28 + 1.0;
if ( v29 < 0.0 )
{
v41 = v25 * v59;
v30 = sqrt(v29);
v27 = v34 * 0.00000004277 / a5 * v38 / (v12 * v59 * v59);
v24 = v59;
v26 = v41;
v23 = *(double *)&LC0;
v25 = v57 * v12 * v12;
}
else
{
v30 = sqrt(v29);
}
v56 = v25;
v58 = v24;
v54 = 7.74 * v28 / (v28 * 70.0 + v23) + v30;
v35 = exp(v27 * -0.0000001023);
v51 = exp(2947.0 / v18);
return (v38 * v44 - v39 * v43)
* (v58 * (v12 * (v56 * v12 * v12)) * 50.94 * v46
+ ((v51 * 0.964525 - v54 * exp(-6.14e13 * v12 * v12 * v58 / v37)) * (1.0 - v35) / v27 + v54 / v27)
* (v26
* 1798900000.0
* v47))
/ a5;
}

canonical_decompiled_code:
double __fastcall func1(__int64 a1, double a2, double a3, double a4, double a5)
{
double v8; // xmm2_8
double *v9; // rax
double v10; // xmm7_8
double v11; // xmm6_8
double v12; // xmm3_8
double v13; // xmm4_8
double v14; // xmm0_8
double v15; // xmm5_8
double v16; // xmm6_8
double v17; // xmm5_8
double v18; // xmm12_8
double v19; // xmm6_8
double v20; // xmm7_8
double v21; // xmm0_8
double v22; // xmm0_8
double v23; // xmm2_8
double v24; // xmm4_8
double v25; // xmm5_8
double v26; // xmm6_8
double v27; // xmm7_8
double v28; // xmm1_8
double v29; // xmm0_8
double v30; // xmm0_8
double x; // [rsp+8h] [rbp-1B0h]
double v34; // [rsp+18h] [rbp-1A0h]
double v35; // [rsp+18h] [rbp-1A0h]
double v36; // [rsp+20h] [rbp-198h]
double v37; // [rsp+20h] [rbp-198h]
double v38; // [rsp+28h] [rbp-190h]
double v39; // [rsp+30h] [rbp-188h]
double v40; // [rsp+38h] [rbp-180h]
double v41; // [rsp+38h] [rbp-180h]
double v42; // [rsp+38h] [rbp-180h]
double v43; // [rsp+40h] [rbp-178h]
double v44; // [rsp+48h] [rbp-170h]
double v45; // [rsp+48h] [rbp-170h]
double v46; // [rsp+50h] [rbp-168h]
double v47; // [rsp+58h] [rbp-160h]
double v48; // [rsp+58h] [rbp-160h]
double v49; // [rsp+60h] [rbp-158h]
double v50; // [rsp+68h] [rbp-150h]
double v51; // [rsp+68h] [rbp-150h]
double v52; // [rsp+70h] [rbp-148h]
double v53; // [rsp+78h] [rbp-140h]
double v54; // [rsp+78h] [rbp-140h]
double v55; // [rsp+80h] [rbp-138h]
double v56; // [rsp+80h] [rbp-138h]
double v57; // [rsp+88h] [rbp-130h]
double v58; // [rsp+90h] [rbp-128h]
double v59; // [rsp+98h] [rbp-120h]
char s[280]; // [rsp+A0h] [rbp-118h] BYREF

v39 = a4;
if ( *(_DWORD *)(a1 + 56) == 1 )
return 0.0;
v8 = *(double *)&LC0;
v9 = *(double **)(a1 + 8);
v10 = v9[17];
v11 = v9[1];
v12 = v9[19];
v13 = v9[20];
v43 = 1.0 - a3 + a4;
v14 = v9[16] - a4;
v38 = v14;
if ( v14 < 0.0 )
{
v45 = v9[20];
x = a2;
sprintf(
s,
"xHeI = %E < 0 at z = %f in rec_helium_dxHeIIdlna.\n"
"You should try and extend the hydrogen post-saha phase by increasing DXHII_MAX in history.h\n",
v14,
a2);
strcat(*(char **)(a1 + 72), s);
*(_DWORD *)(a1 + 56) = 1;
v13 = v45;
v8 = *(double *)&LC0;
a2 = x;
}
v15 = a2 + v8;
v16 = v11 * v15 / v12;
v34 = v10 * v15 * v15 * v15;
v17 = v12 * v12 * v12;
v18 = v16 / v12 / v13;
v19 = v17 * v13 * v13 * v13;
v20 = 2.414194e15 * v19 * v18;
if ( v18 < 0.0 )
{
v48 = v13;
v42 = v17 * v13 * v13 * v13;
v21 = sqrt(v18);
v13 = v48;
v20 = 2.414194e15 * v19 * v18;
v19 = v42;
v17 = v12 * v12 * v12;
}
else
{
v21 = sqrt(v18);
}
v59 = v13;
v57 = v17;
v36 = v20 * v21 / v34 * 4.0;
v44 = exp(-285325.0 / v18) * v36;
v46 = exp(46090.0 / v18) / v36;
v47 = exp(39101.0 / v18) / v36 * 3.0;
v37 = v19 * 9.157759999999999e22 * a5 / v34 / a3;
v40 = exp(-6989.0 / v18);
v55 = exp(19754.0 / v18);
v53 = exp(21539.0 / v18);
v52 = exp(28496.0 / v18);
v50 = exp(29224.0 / v18);
v49 = exp(32414.0 / v18);
v22 = exp(32781.0 / v18);
v23 = *(double *)&LC0;
v24 = v59;
v25 = v57 * v12 * v12;
v26 = v25 * v59;
v27 = v34 * 0.00000004277 / a5 * v38 / (v12 * v59 * v59);
v28 = (1976000.0 / (1.0 - v40)
+ 6030000.0 / (v55 - 1.0)
+ 106000000.0 / (v53 - 1.0)
+ 2180000.0 / (v52 - 1.0)
+ 33700000.0 / (v50 - 1.0)
+ 1040000.0 / (v49 - 1.0)
+ 15100000.0 / (v22 - 1.0))
* (v25
* v59)
* v27
/ 39.47841760435743
/ v37;
v29 = 9.869604401089358 * v28 + 1.0;
if ( v29 < 0.0 )
{
v41 = v25 * v59;
v30 = sqrt(v29);
v27 = v34 * 0.00000004277 / a5 * v38 / (v12 * v59 * v59);
v24 = v59;
v26 = v41;
v23 = *(double *)&LC0;
v25 = v57 * v12 * v12;
}
else
{
v30 = sqrt(v29);
}
v56 = v25;
v58 = v24;
v54 = 7.74 * v28 / (v28 * 70.0 + v23) + v30;
v35 = exp(v27 * -0.0000001023);
v51 = exp(2947.0 / v18);
return (v38 * v44 - v39 * v43)
* (v58 * (v12 * (v56 * v12 * v12)) * 50.94 * v46
+ ((v51 * 0.964525 - v54 * exp(-6.14e13 * v12 * v12 * v58 / v37)) * (1.0 - v35) / v27 + v54 / v27)
* (v26
* 1798900000.0
* v47))
/ a5;
}

original_code:
double rec_helium_dxHeIIdlna(HYREC_DATA *data, double z, double xH1, double xHeII, double H) {
  double nH0 = data->cosmo->nH0, Tr0 = data->cosmo->T0, fHe = data->cosmo->fHe;
  double fsR = data->cosmo->fsR, meR = data->cosmo->meR;
  int *error = &data->error;
  double Tr, nH, ainv, s, s0;
  double xe, xHeI, y2s, y2p, ydown;
  double etacinv, g2pinc, dnuline, tau2p, pesc, tauc, enh;
  char sub_message[256];
  if (*error == 1) return 0.;
  xe = xHeII + (1.-xH1);
  xHeI = fHe - xHeII;
  if (xHeI < 0.){
    sprintf(sub_message, "xHeI = %E < 0 at z = %f in rec_helium_dxHeIIdlna.\nYou should try and extend the hydrogen post-saha phase by increasing DXHII_MAX in history.h\n", xHeI, z);
    strcat(data->error_message, sub_message);
    *error = 1;
  }
  Tr = Tr0*(ainv=1+z) /fsR/fsR/meR;
  nH = nH0*ainv*ainv*ainv;
  s0 = fsR*fsR*fsR*meR*meR*meR *2.414194e15*Tr*sqrt(Tr)/nH * 4.;
  s = s0 * exp(-285325./Tr);
  y2s = exp(46090./Tr)/s0;
  y2p = exp(39101./Tr)/s0 * 3.;
  etacinv = fsR*fsR*fsR *meR*meR*meR* 9.15776e22 * H/nH/xH1;
  g2pinc = 1.976e6 / (1.-exp(-6989./Tr))
          + 6.03e6 / (exp(19754./Tr)-1.)
          + 1.06e8 / (exp(21539./Tr)-1.)
          + 2.18e6 / (exp(28496./Tr)-1.)
          + 3.37e7 / (exp(29224./Tr)-1.)
          + 1.04e6 / (exp(32414./Tr)-1.)
          + 1.51e7 / (exp(32781./Tr)-1.);
  g2pinc *= fsR*fsR*fsR*fsR*fsR*meR ;
  tau2p = 4.277e-8 * nH/H * xHeI /(fsR*meR*meR);
  dnuline = g2pinc * tau2p / (4.*3.14159265358979323846*3.14159265358979323846);
  tauc = dnuline/etacinv;
  enh = sqrt(1.+3.14159265358979323846*3.14159265358979323846*tauc) + 7.74*tauc/(1.+70.*tauc);
  pesc = enh / tau2p;
  pesc = pesc + (1.-exp(-1.023e-7*tau2p))*(0.964525*exp(2947./Tr)-enh*exp(-6.14e13*fsR*fsR*meR/etacinv))/tau2p;
  ydown = fsR*fsR*fsR*fsR*fsR*fsR*fsR*fsR*meR *50.94*y2s
        + fsR*fsR*fsR*fsR*fsR*meR* 1.7989e9*y2p*pesc;
  return ydown*(xHeI*s - xHeII*xe)/H;
}

canonical_original_code:
double rec_helium_dxHeIIdlna(struct HYREC_DATA *data, double z, double xH1, double xHeII, double H) {
  double nH0 = data->cosmo->nH0; double Tr0 = data->cosmo->T0; double fHe = data->cosmo->fHe;
  double fsR = data->cosmo->fsR; double meR = data->cosmo->meR;
  int *error = &data->error;
  double Tr; double nH; double ainv; double s; double s0;
  double xe; double xHeI; double y2s; double y2p; double ydown;
  double etacinv; double g2pinc; double dnuline; double tau2p; double pesc; double tauc; double enh;
  char sub_message[256];
  if (*error == 1) return 0.;
  xe = xHeII + (1.-xH1);
  xHeI = fHe - xHeII;
  if (xHeI < 0.){
    sprintf(sub_message, "xHeI = %E < 0 at z = %f in rec_helium_dxHeIIdlna.\nYou should try and extend the hydrogen post-saha phase by increasing DXHII_MAX in history.h\n", xHeI, z);
    strcat(data->error_message, sub_message);
    *error = 1;
  }
  Tr = Tr0*(ainv=1+z) /fsR/fsR/meR;
  nH = nH0*ainv*ainv*ainv;
  s0 = fsR*fsR*fsR*meR*meR*meR *2.414194e15*Tr*sqrt(Tr)/nH * 4.;
  s = s0 * exp(-285325./Tr);
  y2s = exp(46090./Tr)/s0;
  y2p = exp(39101./Tr)/s0 * 3.;
  etacinv = fsR*fsR*fsR *meR*meR*meR* 9.15776e22 * H/nH/xH1;
  g2pinc = 1.976e6 / (1.-exp(-6989./Tr))
          + 6.03e6 / (exp(19754./Tr)-1.)
          + 1.06e8 / (exp(21539./Tr)-1.)
          + 2.18e6 / (exp(28496./Tr)-1.)
          + 3.37e7 / (exp(29224./Tr)-1.)
          + 1.04e6 / (exp(32414./Tr)-1.)
          + 1.51e7 / (exp(32781./Tr)-1.);
  g2pinc *= fsR*fsR*fsR*fsR*fsR*meR ;
  tau2p = 4.277e-8 * nH/H * xHeI /(fsR*meR*meR);
  dnuline = g2pinc * tau2p / (4.*3.14159265358979323846*3.14159265358979323846);
  tauc = dnuline/etacinv;
  enh = sqrt(1.+3.14159265358979323846*3.14159265358979323846*tauc) + 7.74*tauc/(1.+70.*tauc);
  pesc = enh / tau2p;
  pesc = pesc + (1.-exp(-1.023e-7*tau2p))*(0.964525*exp(2947./Tr)-enh*exp(-6.14e13*fsR*fsR*meR/etacinv))/tau2p;
  ydown = fsR*fsR*fsR*fsR*fsR*fsR*fsR*fsR*meR *50.94*y2s
        + fsR*fsR*fsR*fsR*fsR*meR* 1.7989e9*y2p*pesc;
  return ydown*(xHeI*s - xHeII*xe)/H;
}

variable_types: struct HYREC_DATA { struct HYREC_ATOMIC { double logTR_tab[100]; double T_RATIO_tab[40]; double **logAlpha_tab[4]; double logR2p2s_tab[100]; double DlogTR; double Eb_tab[311]; double A1s_tab[311]; double A2s_tab[311]; double A3s3d_tab[311]; double A4s4d_tab[311]; } *atomic; struct REC_COSMOPARAMS { double h; double T0; double obh2; double w0; double Neff; double Nur; double Nmnu; double mnu[3]; double fHe; double nH0; double YHe; double fsR; double dlna; struct INJ_PARAMS { double odmh2; double pann; double ann_z; double ann_z_halo; double decay; double Mpbh; int on_the_spot; double ion; } *inj_params; } *cosmo; double zmax; double zmin; long Nz; double *xe_output; double *Tm_output; int error; int quasi_eq; int loop_after_quasi; int Tm_evolve_implicit; char *error_message; char *path_to_hyrec; struct RADIATION { double z0; long iz_rad_0; double **Dfminus_hist; double **Dfnu_hist; double **Dfminus_Ly_hist; } *rad; struct FIT_FUNC { double *swift_func[5]; } *fit; } *

variable_types: xHeII double

variable_types: H double

variable_types: fHe double

variable_types:
error
int *

variable_types: xe double

variable_types: xHeI double

variable_types: ydown double

variable_types: etacinv double

variable_types: dnuline double

variable_types: pesc double

variable_types: tauc double

variable_types: enh double


repo: lessandro/redismq

decompiled_code:
void __fastcall rmq_message_free(void *ptr)
{
free(*(void **)ptr);
free(ptr);
}

canonical_decompiled_code:
void __fastcall func17(void *ptr)
{
free(*(void **)ptr);
free(ptr);
}

original_code:
void rmq_message_free(struct rmq_message *msg)
{
    free(msg->message);
    free(msg);
}

variable_types: struct rmq_message { char *message; struct { struct rmq_message *stqe_next; } entries; } *

return_type: void


decompiled_code:
__int64 __fastcall rmq_blpop(__int64 a1, __int64 a2)
{
if ( *(_DWORD *)a1 )
_assert_fail("ctx->type == RMQ_NONE", "redismq.c", 0xC4u, "rmq_blpop");
*(_DWORD *)a1 = 1;
*(_QWORD *)(a1 + 48) = a2;
return rmq_connect(a1);
}

canonical_decompiled_code:
__int64 __fastcall func19(__int64 a1, __int64 a2)
{
if ( *(_DWORD *)a1 )
_assert_fail("ctx->type == RMQ_NONE", "redismq.c", 0xC4u, "rmq_blpop");
*(_DWORD *)a1 = 1;
*(_QWORD *)(a1 + 48) = a2;
return func14(a1);
}

original_code:
void rmq_blpop(struct rmq_context *ctx, rmq_callback *blpop_cb)
{
    ((ctx->type == 0) ? (void) (0) : __assert_fail ("ctx->type == RMQ_NONE", "redismq.c", 196, __extension__ __PRETTY_FUNCTION__));
    ctx->type = 1;
    ctx->blpop_cb = blpop_cb;
    rmq_connect(ctx);
}

canonical_original_code:
void rmq_blpop(struct rmq_context *ctx, void (*blpop_cb)(char *message))
{
    ((ctx->type == 0) ? (void) (0) : __assert_fail ("ctx->type == RMQ_NONE", "redismq.c", 196, __extension__ __PRETTY_FUNCTION__));
    ctx->type = 1;
    ctx->blpop_cb = blpop_cb;
    rmq_connect(ctx);
}

variable_types: struct rmq_context { int type; char *redis_host; int redis_port; int redis_db; char *key; void *redis_ctx; int connected; void (*blpop_cb)(char *message); struct rmq_message_head { struct rmq_message { char *message; struct { struct rmq_message *stqe_next; } entries; } *stqh_first; struct rmq_message **stqh_last; } head; } *

user_defined_types: struct rmq_context { int type; char *redis_host; int redis_port; int redis_db; char *key; void *redis_ctx; int connected; void (*blpop_cb)(char *message); struct rmq_message_head head; }

user_defined_types: struct rmq_message_head { struct rmq_message *stqh_first; struct rmq_message **stqh_last; }


decompiled_code:
__int64 __fastcall rmq_rpush(__int64 a1, char *a2)
{
int v2; // eax
const char **v3; // rdx
__int64 result; // rax

v2 = *(_DWORD *)a1;
if ( !*(_DWORD *)a1 )
{
*(_DWORD *)a1 = 2;
*(_QWORD *)(a1 + 64) = a1 + 56;
*(_QWORD *)(a1 + 56) = 0LL;
rmq_connect(a1);
v2 = *(_DWORD *)a1;
}
if ( v2 != 2 )
_assert_fail("ctx->type == RMQ_RPUSH", "redismq.c", 0xD5u, "rmq_rpush");
v3 = (const char **)rmq_message_new(a2);
v3[1] = 0LL;
**(_QWORD **)(a1 + 64) = v3;
*(_QWORD *)(a1 + 64) = v3 + 1;
result = *(unsigned int *)(a1 + 40);
if ( (_DWORD)result )
result = rmq_rpush_message_isra_0(*(char **)(a1 + 24), *(_QWORD *)(a1 + 32), v3);
return result;
}

canonical_decompiled_code:
__int64 __fastcall func20(__int64 a1, char *a2)
{
int v2; // eax
const char **v3; // rdx
__int64 result; // rax

v2 = *(_DWORD *)a1;
if ( !*(_DWORD *)a1 )
{
*(_DWORD *)a1 = 2;
*(_QWORD *)(a1 + 64) = a1 + 56;
*(_QWORD *)(a1 + 56) = 0LL;
func14(a1);
v2 = *(_DWORD *)a1;
}
if ( v2 != 2 )
_assert_fail("ctx->type == RMQ_RPUSH", "redismq.c", 0xD5u, "rmq_rpush");
v3 = (const char **)rmq_message_new(a2);
v3[1] = 0LL;
**(_QWORD **)(a1 + 64) = v3;
*(_QWORD *)(a1 + 64) = v3 + 1;
result = *(unsigned int *)(a1 + 40);
if ( (_DWORD)result )
result = func8(*(char **)(a1 + 24), *(_QWORD *)(a1 + 32), v3);
return result;
}

original_code:
void rmq_rpush(struct rmq_context *ctx, const char *message)
{
    if (ctx->type == 0) {
        ctx->type = 2;
        do { (&ctx->head)->stqh_first = ((void *)0); (&ctx->head)->stqh_last = &(&ctx->head)->stqh_first; } while ( 0);
        rmq_connect(ctx);
    }
    ((ctx->type == 2) ? (void) (0) : __assert_fail ("ctx->type == RMQ_RPUSH", "redismq.c", 213, __extension__ __PRETTY_FUNCTION__));
    struct rmq_message *msg = rmq_message_new(message);
    do { (msg)->entries.stqe_next = ((void *)0); *(&ctx->head)->stqh_last = (msg); (&ctx->head)->stqh_last = &(msg)->entries.stqe_next; } while ( 0);
    if (ctx->connected)
        rmq_rpush_message(ctx, msg);
}

canonical_original_code:
void rmq_rpush(struct rmq_context *ctx, char *message)
{
    if (ctx->type == 0) {
        ctx->type = 2;
        do { (&ctx->head)->stqh_first = ((void *)0); (&ctx->head)->stqh_last = &(&ctx->head)->stqh_first; } while ( 0);
        rmq_connect(ctx);
    }
    ((ctx->type == 2) ? (void) (0) : __assert_fail ("ctx->type == RMQ_RPUSH", "redismq.c", 213, __extension__ __PRETTY_FUNCTION__));
    struct rmq_message *msg = rmq_message_new(message);
    do { (msg)->entries.stqe_next = ((void *)0); *(&ctx->head)->stqh_last = (msg); (&ctx->head)->stqh_last = &(msg)->entries.stqe_next; } while ( 0);
    if (ctx->connected)
        rmq_rpush_message(ctx, msg);
}

variable_types:
message
char *

user_defined_types: struct rmq_message { char *message; struct { struct rmq_message *stqe_next; } entries; }


decompiled_code:
void rmq_rpushf(__int64 a1, const char *a2, ...)
{
void *ptr; // [rsp+0h] [rbp-D8h] BYREF
gcc_va_list arg; // [rsp+8h] [rbp-D0h] BYREF

va_start(arg, a2);
vasprintf((char **)&ptr, a2, arg);
rmq_rpush(a1, (char *)ptr);
free(ptr);
}

canonical_decompiled_code:
void func21(__int64 a1, const char *a2, ...)
{
void *ptr; // [rsp+0h] [rbp-D8h] BYREF
gcc_va_list arg; // [rsp+8h] [rbp-D0h] BYREF

va_start(arg, a2);
vasprintf((char **)&ptr, a2, arg);
func20(a1, (char *)ptr);
free(ptr);
}

original_code:
void rmq_rpushf(struct rmq_context *ctx, const char *format, ...)
{
    va_list args;
    __builtin_va_start(args,format);
    char *buf;
    vasprintf(&buf, format, args);
    rmq_rpush(ctx, buf);
    free(buf);
    __builtin_va_end(args);
}

canonical_original_code:
void rmq_rpushf(struct rmq_context *ctx, char *format, ...)
{
    __builtin_va_list args;
    __builtin_va_start(args,format);
    char *buf;
    vasprintf(&buf, format, args);
    rmq_rpush(ctx, buf);
    free(buf);
    __builtin_va_end(args);
}

variable_types:
format
char *

variable_types:
buf
char *


decompiled_code:
char *__fastcall rmq_init(__int64 a1, const char *a2, int a3, int a4, const char *a5)
{
char *v8; // rax
char *result; // rax

*(_DWORD *)a1 = 0;
v8 = strdup(a2);
*(_DWORD *)(a1 + 16) = a3;
*(_DWORD *)(a1 + 20) = a4;
*(_QWORD *)(a1 + 8) = v8;
result = strdup(a5);
*(_QWORD *)(a1 + 32) = 0LL;
*(_QWORD *)(a1 + 24) = result;
*(_DWORD *)(a1 + 40) = 0;
return result;
}

canonical_decompiled_code:
char *__fastcall func22(__int64 a1, const char *a2, int a3, int a4, const char *a5)
{
char *v8; // rax
char *result; // rax

*(_DWORD *)a1 = 0;
v8 = strdup(a2);
*(_DWORD *)(a1 + 16) = a3;
*(_DWORD *)(a1 + 20) = a4;
*(_QWORD *)(a1 + 8) = v8;
result = strdup(a5);
*(_QWORD *)(a1 + 32) = 0LL;
*(_QWORD *)(a1 + 24) = result;
*(_DWORD *)(a1 + 40) = 0;
return result;
}

original_code:
void rmq_init(struct rmq_context *ctx, const char *redis_host, int redis_port,
    int redis_db, const char *key)
{
    ctx->type = 0;
    ctx->redis_host = strdup(redis_host);
    ctx->redis_port = redis_port;
    ctx->redis_db = redis_db;
    ctx->key = strdup(key);
    ctx->redis_ctx = ((void *)0);
    ctx->connected = 0;
}

canonical_original_code:
void rmq_init(struct rmq_context *ctx, char *redis_host, int redis_port, int redis_db, char *key)
{
    ctx->type = 0;
    ctx->redis_host = strdup(redis_host);
    ctx->redis_port = redis_port;
    ctx->redis_db = redis_db;
    ctx->key = strdup(key);
    ctx->redis_ctx = ((void *)0);
    ctx->connected = 0;
}

variable_types:
key
char *