decompiled_code:
char *__fastcall con_request_func(char *src)
{
char *v1; // rbx

v1 = (char *)malloc(0x18uLL);
*(_QWORD *)v1 = 24LL;
strncpy(v1 + 12, src, 3uLL);
v1[15] = 0;
*((_DWORD *)v1 + 2) = getpid();
return v1;
}

original_code:
request_t* con_request_func(const char* cmd) {
 request_t* req = malloc(sizeof(request_t));
 req->size = sizeof(request_t);
 strncpy(req->cmdname, cmd, 3);
 req->cmdname[3] = '\0';
 req->clientpid = getpid();
 return req;
}

canonical_original_code:
struct request_t *con_request_func(char *cmd) {
 struct request_t *req = malloc(sizeof(request_t));
 req->size = sizeof(request_t);
 strncpy(req->cmdname, cmd, 3);
 req->cmdname[3] = '\0';
 req->clientpid = getpid();
 return req;
}


repo: lesbeben/projetSE

decompiled_code:
__int64 __fastcall stream_set_add(__int64 a1, __int64 a2)
{
int v2; // eax
__int64 result; // rax

if ( a1 )
{
if ( a2 )
{
v2 = (*(__int64 (__fastcall **)(__int64))(a2 + 40))(a2 + 64);
if ( *(_DWORD *)(a1 + 128) < v2 )
*(_DWORD *)(a1 + 128) = v2;
*(_QWORD *)(a1 + 8LL * (v2 / 64)) |= 1LL << (v2 % 64);
result = 0LL;
}
else
{
fwrite("stream_set_add : stream == NULL\n", 1uLL, 0x20uLL, stderr);
result = 4294967294LL;
}
}
else
{
fwrite("stream_set_add : set == NULL\n", 1uLL, 0x1DuLL, stderr);
result = 4294967294LL;
}
return result;
}

canonical_decompiled_code:
__int64 __fastcall func0(__int64 a1, __int64 a2)
{
int v2; // eax
__int64 result; // rax

if ( a1 )
{
if ( a2 )
{
v2 = (*(__int64 (__fastcall **)(__int64))(a2 + 40))(a2 + 64);
if ( *(_DWORD *)(a1 + 128) < v2 )
*(_DWORD *)(a1 + 128) = v2;
*(_QWORD *)(a1 + 8LL * (v2 / 64)) |= 1LL << (v2 % 64);
result = 0LL;
}
else
{
fwrite("stream_set_add : stream == NULL\n", 1uLL, 0x20uLL, stderr);
result = 4294967294LL;
}
}
else
{
fwrite("stream_set_add : set == NULL\n", 1uLL, 0x1DuLL, stderr);
result = 4294967294LL;
}
return result;
}

original_code:
int stream_set_add(stream_set_t* set, stream_t* stream) {
 if (set == ((void *)0)) {
  fprintf(stderr, "stream_set_add : set == NULL\n");
  return -2;
 }
 if (stream == ((void *)0)) {
  fprintf(stderr, "stream_set_add : stream == NULL\n");
  return -2;
 }
 int fd = stream->op._getfd(&stream->sd);
 if (fd > set->_maxfd) {
  set->_maxfd = fd;
 }
 ((void) (((&set->_set)->fds_bits)[((fd) / (8 * (int) sizeof (__fd_mask)))] |= ((__fd_mask) (1UL << ((fd) % (8 * (int) sizeof (__fd_mask)))))));
 return 0;
}

canonical_original_code:
int stream_set_add(struct stream_set_t *set, struct stream_t *stream) {
 if (set == ((void *)0)) {
  fprintf(stderr, "stream_set_add : set == NULL\n");
  return -2;
 }
 if (stream == ((void *)0)) {
  fprintf(stderr, "stream_set_add : stream == NULL\n");
  return -2;
 }
 int fd = stream->op._getfd(&stream->sd);
 if (fd > set->_maxfd) {
  set->_maxfd = fd;
 }
 ((void) (((&set->_set)->fds_bits)[((fd) / (8 * (int) sizeof (__fd_mask)))] |= ((__fd_mask) (1UL << ((fd) % (8 * (int) sizeof (__fd_mask)))))));
 return 0;
}

variable_types: struct stream_set_t { struct fd_set { long fds_bits[-1]; } _set; int _maxfd; } *

variable_types: struct stream_t { struct operation_t { int (*_create)(struct streamd_t { void *data; } *, char *, unsigned long); int (*_open)(struct streamd_t *, char *, int); int (*_close)(struct streamd_t *); int (*_read)(struct streamd_t *, void *, unsigned long); int (*_write)(struct streamd_t *, void *, unsigned long); int (*_getfd)(struct streamd_t *); int (*_unlink)(char *); char name[4]; } op; struct streamd_t sd; } *

variable_types: fd int

return_type: int

user_defined_types: struct stream_set_t { struct fd_set _set; int _maxfd; }

user_defined_types: struct stream_t { struct operation_t op; struct streamd_t sd; }

user_defined_types: struct operation_t { int (*_create)(struct streamd_t *, char *, unsigned long); int (*_open)(struct streamd_t *, char *, int); int (*_close)(struct streamd_t *); int (*_read)(struct streamd_t *, void *, unsigned long); int (*_write)(struct streamd_t *, void *, unsigned long); int (*_getfd)(struct streamd_t *); int (*_unlink)(char *); char name[4]; }


decompiled_code:
__int64 __fastcall stream_set_clear(_DWORD *a1)
{
__int64 result; // rax

if ( a1 )
{
a1[32] = 0;
result = 0LL;
memset(a1, 0, 0x80uLL);
}
else
{
fwrite("stream_set_clear : set == NULL\n", 1uLL, 0x1FuLL, stderr);
result = 4294967294LL;
}
return result;
}

canonical_decompiled_code:
__int64 __fastcall func1(_DWORD *a1)
{
__int64 result; // rax

if ( a1 )
{
a1[32] = 0;
result = 0LL;
memset(a1, 0, 0x80uLL);
}
else
{
fwrite("stream_set_clear : set == NULL\n", 1uLL, 0x1FuLL, stderr);
result = 4294967294LL;
}
return result;
}

original_code:
int stream_set_clear(stream_set_t* set) {
 if (set == ((void *)0)) {
  fprintf(stderr, "stream_set_clear : set == NULL\n");
  return -2;
 }
 set->_maxfd = 0;
 do { int __d0, __d1; __asm__ __volatile__ ("cld; rep; " "stosq" : "=c" (__d0), "=D" (__d1) : "a" (0), "0" (sizeof (fd_set) / sizeof (__fd_mask)), "1" (&((&set->_set)->fds_bits)[0]) : "memory"); } while (0);
 return 0;
}

canonical_original_code:
int stream_set_clear(struct stream_set_t *set) {
 if (set == ((void *)0)) {
  fprintf(stderr, "stream_set_clear : set == NULL\n");
  return -2;
 }
 set->_maxfd = 0;
 do { int __d0; int __d1; __asm__ __volatile__ ("cld; rep; " "stosq" : "=c" (__d0), "=D" (__d1) : "a" (0), "0" (sizeof (fd_set) / sizeof (__fd_mask)), "1" (&((&set->_set)->fds_bits)[0]) : "memory"); } while (0);
 return 0;
}


decompiled_code:
__int64 __fastcall stream_set_isset(__int64 a1, __int64 a2)
{
__int64 v2; // rbx
__int64 result; // rax

if ( a1 )
{
if ( a2 )
{
v2 = *(_QWORD *)(a1 + 8LL * ((*(int (__fastcall **)(__int64))(a2 + 40))(a2 + 64) / 64));
result = (v2 & (1LL << ((*(int (__fastcall **)(__int64))(a2 + 40))(a2 + 64) % 64))) != 0;
}
else
{
fwrite("stream_set_isset : stream == NULL\n", 1uLL, 0x22uLL, stderr);
result = 4294967294LL;
}
}
else
{
fwrite("stream_set_isset : set == NULL\n", 1uLL, 0x1FuLL, stderr);
result = 4294967294LL;
}
return result;
}

canonical_decompiled_code:
__int64 __fastcall func2(__int64 a1, __int64 a2)
{
__int64 v2; // rbx
__int64 result; // rax

if ( a1 )
{
if ( a2 )
{
v2 = *(_QWORD *)(a1 + 8LL * ((*(int (__fastcall **)(__int64))(a2 + 40))(a2 + 64) / 64));
result = (v2 & (1LL << ((*(int (__fastcall **)(__int64))(a2 + 40))(a2 + 64) % 64))) != 0;
}
else
{
fwrite("stream_set_isset : stream == NULL\n", 1uLL, 0x22uLL, stderr);
result = 4294967294LL;
}
}
else
{
fwrite("stream_set_isset : set == NULL\n", 1uLL, 0x1FuLL, stderr);
result = 4294967294LL;
}
return result;
}

original_code:
int stream_set_isset(stream_set_t* set, stream_t* stream) {
 if (set == ((void *)0)) {
  fprintf(stderr, "stream_set_isset : set == NULL\n");
  return -2;
 }
 if (stream == ((void *)0)) {
  fprintf(stderr, "stream_set_isset : stream == NULL\n");
  return -2;
 }
 return ((((&set->_set)->fds_bits)[((stream->op._getfd(&stream->sd)) / (8 * (int) sizeof (__fd_mask)))] & ((__fd_mask) (1UL << ((stream->op._getfd(&stream->sd)) % (8 * (int) sizeof (__fd_mask)))))) != 0);
}

canonical_original_code:
int stream_set_isset(struct stream_set_t *set, struct stream_t *stream) {
 if (set == ((void *)0)) {
  fprintf(stderr, "stream_set_isset : set == NULL\n");
  return -2;
 }
 if (stream == ((void *)0)) {
  fprintf(stderr, "stream_set_isset : stream == NULL\n");
  return -2;
 }
 return ((((&set->_set)->fds_bits)[((stream->op._getfd(&stream->sd)) / (8 * (int) sizeof (__fd_mask)))] & ((__fd_mask) (1UL << ((stream->op._getfd(&stream->sd)) % (8 * (int) sizeof (__fd_mask)))))) != 0);
}


decompiled_code:
int __fastcall stream_set_select(fd_set *readfds, struct timeval *timeout)
{
if ( readfds )
return select(LODWORD(readfds[1].fds_bits[0]) + 1, readfds, 0LL, 0LL, timeout);
fwrite("stream_set_select : set == NULL\n", 1uLL, 0x20uLL, stderr);
return -2;
}

canonical_decompiled_code:
int __fastcall func3(fd_set *readfds, struct timeval *timeout)
{
if ( readfds )
return select(LODWORD(readfds[1].fds_bits[0]) + 1, readfds, 0LL, 0LL, timeout);
fwrite("stream_set_select : set == NULL\n", 1uLL, 0x20uLL, stderr);
return -2;
}

original_code:
int stream_set_select(stream_set_t* set, struct timeval* timeout) {
 if (set == ((void *)0)) {
  fprintf(stderr, "stream_set_select : set == NULL\n");
  return -2;
 }
 return select(set->_maxfd + 1, &set->_set, ((void *)0), ((void *)0), timeout);
}

canonical_original_code:
int stream_set_select(struct stream_set_t *set, struct timeval *timeout) {
 if (set == ((void *)0)) {
  fprintf(stderr, "stream_set_select : set == NULL\n");
  return -2;
 }
 return select(set->_maxfd + 1, &set->_set, ((void *)0), ((void *)0), timeout);
}

variable_types: struct timeval { long tv_sec; long tv_usec; } *


decompiled_code:
__int64 __fastcall uid_answer_func(__int64 a1, char *a2, size_t a3)
{
struct passwd *v4; // rax
__int64 result; // rax

v4 = getpwuid(*(_DWORD *)(a1 + 16));
if ( v4 )
{
snprintf(a2, a3, "%s", v4->pw_name);
result = 0LL;
}
else
{
snprintf(a2, a3, "Erreur lors de la lecture de l'UID : %d", *(unsigned int *)(a1 + 16));
fprintf(stderr, "%s\n", a2);
result = 0xFFFFFFFFLL;
}
return result;
}

canonical_decompiled_code:
__int64 __fastcall func6(__int64 a1, char *a2, size_t a3)
{
struct passwd *v4; // rax
__int64 result; // rax

v4 = getpwuid(*(_DWORD *)(a1 + 16));
if ( v4 )
{
snprintf(a2, a3, "%s", v4->pw_name);
result = 0LL;
}
else
{
snprintf(a2, a3, "Erreur lors de la lecture de l'UID : %d", *(unsigned int *)(a1 + 16));
fprintf(stderr, "%s\n", a2);
result = 0xFFFFFFFFLL;
}
return result;
}

original_code:
int uid_answer_func(request_t* req, char* buffer, size_t buffsize) {
 int res = 0;
 struct passwd* pw = getpwuid(*((int*) (req->data)));
 if (pw == ((void *)0)) {
  snprintf(buffer, buffsize
    , "Erreur lors de la lecture de l'UID : %d"
    , *((int*) (req->data)));
  fprintf(stderr, "%s\n", buffer);
  res = -1;
 } else {
  snprintf(buffer, buffsize, "%s", pw->pw_name);
 }
 return res;
}

canonical_original_code:
int uid_answer_func(struct request_t *req, char *buffer, unsigned long buffsize) {
 int res = 0;
 struct passwd *pw = getpwuid(*((int*) (req->data)));
 if (pw == ((void *)0)) {
  snprintf(buffer, buffsize
    , "Erreur lors de la lecture de l'UID : %d"
    , *((int *) (req->data)));
  fprintf(stderr, "%s\n", buffer);
  res = -1;
 } else {
  snprintf(buffer, buffsize, "%s", pw->pw_name);
 }
 return res;
}

variable_types: struct request_t { unsigned long size; int clientpid; char cmdname[4]; char data[1]; } *

variable_types:
buffer
char *

variable_types:
buffsize
unsigned long

variable_types: res int

variable_types: struct passwd { char *pw_name; char *pw_passwd; unsigned int pw_uid; unsigned int pw_gid; char *pw_gecos; char *pw_dir; char *pw_shell; } *


getCommand

decompiled_code:
__int64 getCommand()
{
return uid_answer_cmd;
}

canonical_decompiled_code:
__int64 func7()
{
return uid_answer_cmd;
}

canonical_original_code:
struct answer_cmd_t getCommand() {
 return uid_answer_cmd;
}

return_type: struct answer_cmd_t { char cmd_name[4]; int (*answer_cmd_func)(struct request_t { unsigned long size; int clientpid; char cmdname[4]; char data[1]; } *, char *, unsigned long); }

user_defined_types: struct answer_cmd_t { char cmd_name[4]; int (*answer_cmd_func)(struct request_t *, char *, unsigned long); }


decompiled_code:
__int64 __fastcall pid_answer_func(__int64 a1, char *a2, size_t a3)
{
unsigned int v4; // ebx

v4 = getpidname();
if ( v4 == -1 )
{
snprintf(a2, a3, "Erreur lors de la lecture du pid : %d", *(unsigned int *)(a1 + 16));
fprintf(stderr, "%s\n", a2);
}
return v4;
}

canonical_decompiled_code:
__int64 __fastcall func7(__int64 a1, char *a2, size_t a3)
{
unsigned int v4; // ebx

v4 = func6();
if ( v4 == -1 )
{
snprintf(a2, a3, "Erreur lors de la lecture du pid : %d", *(unsigned int *)(a1 + 16));
fprintf(stderr, "%s\n", a2);
}
return v4;
}

original_code:
int pid_answer_func(request_t* req, char* buffer, size_t buffsize) {
 int res = getpidname(*((int*) (req->data)), buffer, buffsize);
 if (res == -1) {
  snprintf(buffer, buffsize
    , "Erreur lors de la lecture du pid : %d"
    , *((int*) (req->data)));
  fprintf(stderr, "%s\n", buffer);
 }
 return res;
}

canonical_original_code:
int pid_answer_func(struct request_t *req, char *buffer, unsigned long buffsize) {
 int res = getpidname(*((int*) (req->data)), buffer, buffsize);
 if (res == -1) {
  snprintf(buffer, buffsize
    , "Erreur lors de la lecture du pid : %d"
    , *((int *) (req->data)));
  fprintf(stderr, "%s\n", buffer);
 }
 return res;
}

user_defined_types: struct request_t { unsigned long size; int clientpid; char cmdname[4]; char data[1]; }


decompiled_code:
__int64 getCommand()
{
return pid_answer_cmd;
}

canonical_decompiled_code:
__int64 func8()
{
return pid_answer_cmd;
}

canonical_original_code:
struct answer_cmd_t getCommand() {
 return pid_answer_cmd;
}


decompiled_code:
int class_protect_sprintf(char *a1, const char *a2, ...)
{
gcc_va_list arg; // [rsp+8h] [rbp-D0h] BYREF

va_start(arg, a2);
return vsnprintf(a1, 0x800uLL, a2, arg);
}

canonical_decompiled_code:
int func0(char *a1, const char *a2, ...)
{
gcc_va_list arg; // [rsp+8h] [rbp-D0h] BYREF

va_start(arg, a2);
return vsnprintf(a1, 0x800uLL, a2, arg);
}

original_code:
void class_protect_sprintf(char* dest, char* tpl,...) {
  va_list args;
  __builtin_va_start(args,tpl);
  vsnprintf(dest, 2048,tpl,args);
  __builtin_va_end(args);
}

canonical_original_code:
void class_protect_sprintf(char *dest, char *tpl, ...) {
  __builtin_va_list args;
  __builtin_va_start(args,tpl);
  vsnprintf(dest, 2048,tpl,args);
  __builtin_va_end(args);
}

variable_types:
dest
char *

variable_types:
tpl
char *

return_type: void


decompiled_code:
void *__fastcall class_protect_memcpy(void *a1, const void *a2, size_t a3)
{
return memcpy(a1, a2, a3);
}

canonical_decompiled_code:
void *__fastcall func2(void *a1, const void *a2, size_t a3)
{
return memcpy(a1, a2, a3);
}

original_code:
void* class_protect_memcpy(void* dest, void* from, size_t sz) {
  return memcpy(dest, from,sz);
}

canonical_original_code:
void *class_protect_memcpy(void *dest, void *from, unsigned long sz) {
  return memcpy(dest, from,sz);
}

variable_types:
dest
void *

variable_types:
from
void *

variable_types:
sz
unsigned long

return_type: void *


decompiled_code:
__int64 __fastcall get_number_of_titles(const char *a1)
{
size_t v2; // rdi
const char *v3; // rax
const char *v4; // rdi
unsigned int v5; // edx

v2 = strlen(a1);
v3 = a1;
v4 = &a1[v2];
v5 = 0;
while ( v3 != v4 )
v5 += *v3++ == 9;
return v5;
}

canonical_decompiled_code:
__int64 __fastcall func3(const char *a1)
{
size_t v2; // rdi
const char *v3; // rax
const char *v4; // rdi
unsigned int v5; // edx

v2 = strlen(a1);
v3 = a1;
v4 = &a1[v2];
v5 = 0;
while ( v3 != v4 )
v5 += *v3++ == 9;
return v5;
}

original_code:
int get_number_of_titles(char * titlestring){
  int i;
  int number_of_titles=0;
  for (i=0; i<strlen(titlestring); i++){
    if (titlestring[i] == '\t')
      number_of_titles++;
  }
  return number_of_titles;
}

canonical_original_code:
int get_number_of_titles(char *titlestring){
  int i;
  int number_of_titles = 0;
  for (i=0; i<strlen(titlestring); i++){
    if (titlestring[i] == '\t')
      number_of_titles++;
  }
  return number_of_titles;
}

variable_types:
titlestring
char *

variable_types: i int


decompiled_code:
__int64 __fastcall compare_doubles(double *a1, double *a2)
{
__int64 result; // rax

result = 0xFFFFFFFFLL;
if ( *a2 <= *a1 )
result = *a1 > *a2;
return result;
}

canonical_decompiled_code:
__int64 __fastcall func5(double *a1, double *a2)
{
__int64 result; // rax

result = 0xFFFFFFFFLL;
if ( *a2 <= *a1 )
result = *a1 > *a2;
return result;
}

original_code:
int compare_doubles(const void *a,
                    const void *b){
  double *x = (double *) a;
  double *y = (double *) b;
  if (*x < *y)
    return -1;
  else if
    (*x > *y) return 1;
  return 0;
}

canonical_original_code:
int compare_doubles(void *a, void *b){
  double *x = (double *) a;
  double *y = (double *) b;
  if (*x < *y)
    return -1;
  else if
    (*x > *y) return 1;
  return 0;
}

variable_types:
a
void *

variable_types:
b
void *

variable_types:
x
double *

variable_types:
y
double *


decompiled_code:
__int64 __fastcall string_begins_with(const char *a1, char a2)
{
int v3; // eax
int v4; // edx
const char *v5; // rax
__int64 v6; // rcx
unsigned int v7; // esi
char v8; // dl

v3 = strlen(a1);
if ( v3 > 0 )
{
v4 = v3;
v5 = a1;
v6 = (__int64)&a1[v4 - 1 + 1];
v7 = 0;
while ( 1 )
{
v8 = *v5;
if ( *v5 != 32 && v8 != 9 )
{
if ( v8 != a2 )
return v7;
v7 = 1;
}
if ( ++v5 == (const char *)v6 )
return v7;
}
}
return 0;
}

canonical_decompiled_code:
__int64 __fastcall func6(const char *a1, char a2)
{
int v3; // eax
int v4; // edx
const char *v5; // rax
__int64 v6; // rcx
unsigned int v7; // esi
char v8; // dl

v3 = strlen(a1);
if ( v3 > 0 )
{
v4 = v3;
v5 = a1;
v6 = (__int64)&a1[v4 - 1 + 1];
v7 = 0;
while ( 1 )
{
v8 = *v5;
if ( *v5 != 32 && v8 != 9 )
{
if ( v8 != a2 )
return v7;
v7 = 1;
}
if ( ++v5 == (const char *)v6 )
return v7;
}
}
return 0;
}

original_code:
int string_begins_with(char* thestring, char beginchar){
  int int_temp=0;
  int strlength = strlen((thestring));
  int result = 0;
  for(int_temp=0;int_temp<strlength;++int_temp){
    if(thestring[int_temp]==' ' || thestring[int_temp]=='\t'){continue;}
    else if(thestring[int_temp]==beginchar){result=1;}
    else{break;}
  }
  return result;
}

canonical_original_code:
int string_begins_with(char *thestring, char beginchar){
  int int_temp = 0;
  int strlength = strlen((thestring));
  int result = 0;
  for(int_temp=0;int_temp<strlength;++int_temp){
    if(thestring[int_temp]==' ' || thestring[int_temp]=='\t'){continue;}
    else if(thestring[int_temp]==beginchar){result=1;}
    else{break;}
  }
  return result;
}

variable_types:
thestring
char *

variable_types: beginchar char

variable_types: strlength int

variable_types: result int


decompiled_code:
__int64 __fastcall class_version(char *a1)
{
strcpy(a1, "v3.2.0");
return 0LL;
}

canonical_decompiled_code:
__int64 __fastcall func7(char *a1)
{
strcpy(a1, "v3.2.0");
return 0LL;
}

original_code:
int class_version(
                  char * version
                  ) {
  sprintf(version,"%s","v3.2.0");
  return 0;
}

canonical_original_code:
int class_version(char *version) {
  sprintf(version,"%s","v3.2.0");
  return 0;
}

variable_types:
version
char *


original_code:
double dEdtdV_DM_ann(double z, INJ_PARAMS *params){
  double pann_tot, u_min, erfc;
  double zp1, zp1_ann, zp1_max, zp1_min, var, zp1_halo;
  var = params->ann_var;
  zp1 = z + 1.;
  zp1_ann = params->ann_z + 1.;
  zp1_max = params->ann_zmax + 1.;
  zp1_halo = params->ann_z_halo + 1.;
  zp1_min = params->ann_zmin + 1.;
  pann_tot = 0.;
  if (params->pann > 0.) {
    if (zp1 > zp1_max) pann_tot = params->pann *exp(-var *square(log(zp1_ann/zp1_max)));
    else if (zp1 > zp1_min) {
      pann_tot = params->pann *exp(var*(-square(log(zp1_ann/zp1_max))
    +square(log(zp1/zp1_max))));
    }
    else {
      pann_tot = params->pann *exp(var*(-square(log(zp1_ann/zp1_max))
    +square(log(zp1_min/zp1_max))));
    }
 pann_tot = pann_tot*pow(zp1,3.);
  }
  if (params->pann_halo > 0.) {
    u_min = zp1/zp1_halo;
    erfc = pow(1.+0.278393*u_min+0.230389*u_min*u_min+0.000972*u_min*u_min*u_min+0.078108*u_min*u_min*u_min*u_min,-4);
    pann_tot += params->pann_halo *erfc;
  }
  return square(10537.4*params->odmh2) * zp1*zp1*zp1*1e-9* pann_tot
        +10537.4*params->odmh2*pow((1+z),3)*params->decay;
}

canonical_original_code:
double dEdtdV_DM_ann(double z, struct INJ_PARAMS *params){
  double pann_tot; double u_min; double erfc;
  double zp1; double zp1_ann; double zp1_max; double zp1_min; double var; double zp1_halo;
  var = params->ann_var;
  zp1 = z + 1.;
  zp1_ann = params->ann_z + 1.;
  zp1_max = params->ann_zmax + 1.;
  zp1_halo = params->ann_z_halo + 1.;
  zp1_min = params->ann_zmin + 1.;
  pann_tot = 0.;
  if (params->pann > 0.) {
    if (zp1 > zp1_max) pann_tot = params->pann *exp(-var *square(log(zp1_ann/zp1_max)));
    else if (zp1 > zp1_min) {
      pann_tot = params->pann *exp(var*(-square(log(zp1_ann/zp1_max))
    +square(log(zp1/zp1_max))));
    }
    else {
      pann_tot = params->pann *exp(var*(-square(log(zp1_ann/zp1_max))
    +square(log(zp1_min/zp1_max))));
    }
 pann_tot = pann_tot*pow(zp1,3.);
  }
  if (params->pann_halo > 0.) {
    u_min = zp1/zp1_halo;
    erfc = pow(1.+0.278393*u_min+0.230389*u_min*u_min+0.000972*u_min*u_min*u_min+0.078108*u_min*u_min*u_min*u_min,-4);
    pann_tot += params->pann_halo *erfc;
  }
  return square(10537.4*params->odmh2) * zp1*zp1*zp1*1e-9* pann_tot
        +10537.4*params->odmh2*pow((1+z),3)*params->decay;
}

variable_types: z double

variable_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; } *

variable_types: erfc double

variable_types: var double

return_type: double


original_code:
double beta_pbh(double Mpbh, double z, double xe, double Teff) {
  double a, vB, tB;
  a = 1./(1.+z);
  vB = 9.09e3 * sqrt((1.+xe)*Teff);
  tB = 1.33e26 *Mpbh/vB/vB/vB;
  return 5.60e-24 *xe/a/a/a/a *tB;
}

canonical_original_code:
double beta_pbh(double Mpbh, double z, double xe, double Teff) {
  double a; double vB; double tB;
  a = 1./(1.+z);
  vB = 9.09e3 * sqrt((1.+xe)*Teff);
  tB = 1.33e26 *Mpbh/vB/vB/vB;
  return 5.60e-24 *xe/a/a/a/a *tB;
}

variable_types: Mpbh double

variable_types: xe double

variable_types: Teff double

variable_types: a double

variable_types: vB double

variable_types: tB double


decompiled_code:
double __fastcall gamma_pbh(double a1, double a2, double a3, double a4)
{
return 3672.0 / (a3 + 1.0) * beta_pbh(a1, a2, a3, a4);
}

canonical_decompiled_code:
double __fastcall func2(double a1, double a2, double a3, double a4)
{
return 3672.0 / (a3 + 1.0) * func1(a1, a2, a3, a4);
}

original_code:
double gamma_pbh(double Mpbh, double z, double xe, double Teff) {
  return 2.*1836./(1.+xe) *beta_pbh(Mpbh, z, xe, Teff);
}


original_code:
double lambda_pbh(double Mpbh, double z, double xe, double Teff) {
  double beta, gamma, lam_ricotti, lam_ad, lam_iso, lam_nodrag;
  beta = beta_pbh(Mpbh, z, xe, Teff);
  gamma = gamma_pbh(Mpbh, z, xe, Teff);
  lam_ricotti = exp(4.5/(3.+pow(beta, 0.75)))/square(sqrt(1.+beta)+1.);
  lam_ad = pow(0.6, 1.5)/4.;
  lam_iso = exp(1.5)/4.;
  lam_nodrag = lam_ad + (lam_iso - lam_ad) * pow(gamma*gamma/(88. + gamma*gamma), 0.22);
  return lam_ricotti *lam_nodrag /lam_iso;
}

canonical_original_code:
double lambda_pbh(double Mpbh, double z, double xe, double Teff) {
  double beta; double gamma; double lam_ricotti; double lam_ad; double lam_iso; double lam_nodrag;
  beta = beta_pbh(Mpbh, z, xe, Teff);
  gamma = gamma_pbh(Mpbh, z, xe, Teff);
  lam_ricotti = exp(4.5/(3.+pow(beta, 0.75)))/square(sqrt(1.+beta)+1.);
  lam_ad = pow(0.6, 1.5)/4.;
  lam_iso = exp(1.5)/4.;
  lam_nodrag = lam_ad + (lam_iso - lam_ad) * pow(gamma*gamma/(88. + gamma*gamma), 0.22);
  return lam_ricotti *lam_nodrag /lam_iso;
}

variable_types: beta double

variable_types: gamma double


decompiled_code:
double __fastcall Mdot_pbh(double a1, double a2, double a3, double a4)
{
double v4; // xmm0_8
double v5; // xmm0_8
double v8; // [rsp+8h] [rbp-20h]

v4 = (a3 + 1.0) * a4;
if ( v4 < 0.0 )
v5 = sqrt(v4);
else
v5 = sqrt(v4);
v8 = cube((a2 + 1.0) / (v5 * 9090.0)) * (a1 * 8.81e22 * a1);
return lambda_pbh(a1, a2, a3, a4) * v8;
}

canonical_decompiled_code:
double __fastcall func4(double a1, double a2, double a3, double a4)
{
double v4; // xmm0_8
double v5; // xmm0_8
double v8; // [rsp+8h] [rbp-20h]

v4 = (a3 + 1.0) * a4;
if ( v4 < 0.0 )
v5 = sqrt(v4);
else
v5 = sqrt(v4);
v8 = cube((a2 + 1.0) / (v5 * 9090.0)) * (a1 * 8.81e22 * a1);
return func3(a1, a2, a3, a4) * v8;
}

original_code:
double Mdot_pbh(double Mpbh, double z, double xe, double Teff) {
  double vB = 9.09e3 * sqrt((1.+xe)*Teff);
  return 8.81e22 * Mpbh*Mpbh*cube((1.+z)/vB) *lambda_pbh(Mpbh, z, xe, Teff);
}


variable_types: X double

variable_types: G double


decompiled_code:
double __fastcall L_pbh(double a1, double a2, double a3, double a4)
{
double v6; // [rsp+0h] [rbp-38h]

v6 = Mdot_pbh(a1, a2, a3, a4);
return eps_over_mdot_pbh(a1, a2, a3, a4) * (v6 / (a1 * 1.4e17)) * v6 * 9.0e20;
}

canonical_decompiled_code:
double __fastcall func7(double a1, double a2, double a3, double a4)
{
double v6; // [rsp+0h] [rbp-38h]

v6 = func4(a1, a2, a3, a4);
return func6(a1, a2, a3, a4) * (v6 / (a1 * 1.4e17)) * v6 * 9.0e20;
}

original_code:
double L_pbh(double Mpbh, double z, double xe, double Teff) {
  double Mdot, mdot, eff;
  Mdot = Mdot_pbh(Mpbh, z, xe, Teff);
  mdot = Mdot / (1.4e17 * Mpbh);
  eff = mdot *eps_over_mdot_pbh(Mpbh, z, xe, Teff);
  return eff * Mdot * 9e20;
}

canonical_original_code:
double L_pbh(double Mpbh, double z, double xe, double Teff) {
  double Mdot; double mdot; double eff;
  Mdot = Mdot_pbh(Mpbh, z, xe, Teff);
  mdot = Mdot / (1.4e17 * Mpbh);
  eff = mdot *eps_over_mdot_pbh(Mpbh, z, xe, Teff);
  return eff * Mdot * 9e20;
}

variable_types: Mdot double

variable_types: mdot double

variable_types: eff double


decompiled_code:
double __fastcall vbc_rms_func(double a1)
{
double result; // xmm0_8

if ( a1 >= 1000.0 )
result = *(double *)&LC44;
else
result = (a1 + 1.0) * 3000000.0 / 1000.0;
return result;
}

canonical_decompiled_code:
double __fastcall func8(double a1)
{
double result; // xmm0_8

if ( a1 >= 1000.0 )
result = *(double *)&LC44;
else
result = (a1 + 1.0) * 3000000.0 / 1000.0;
return result;
}

original_code:
double vbc_rms_func(double z) {
  if (z < 1e3) return 30e5 * (1.+z)/1e3;
  else return 30e5;
}

variable_types: z double


original_code:
double L_pbh_av(double Mpbh, double z, double xe, double Tgas) {
  double vbc_rms, vbc_max, vbc, P_vbc, num, denom, x, Teff;
  int i, Nvbc;
  Nvbc = 50;
  vbc_rms = vbc_rms_func(z);
  vbc_max = 5.*vbc_rms;
  num = denom = 0.;
  for (i = 0; i < Nvbc; i++) {
    vbc = i*vbc_max/(Nvbc-1.);
    x = vbc/vbc_rms;
    denom += P_vbc = x*x* exp(-1.5*x*x);
    Teff = Tgas + 121e-10 *vbc*vbc/(1.+xe);
    num += L_pbh(Mpbh, z, xe, Teff) * P_vbc;
  }
  return num/denom;
}

canonical_original_code:
double L_pbh_av(double Mpbh, double z, double xe, double Tgas) {
  double vbc_rms; double vbc_max; double vbc; double P_vbc; double num; double denom; double x; double Teff;
  int i; int Nvbc;
  Nvbc = 50;
  vbc_rms = vbc_rms_func(z);
  vbc_max = 5.*vbc_rms;
  num = denom = 0.;
  for (i = 0; i < Nvbc; i++) {
    vbc = i*vbc_max/(Nvbc-1.);
    x = vbc/vbc_rms;
    denom += P_vbc = x*x* exp(-1.5*x*x);
    Teff = Tgas + 121e-10 *vbc*vbc/(1.+xe);
    num += L_pbh(Mpbh, z, xe, Teff) * P_vbc;
  }
  return num/denom;
}

variable_types: Tgas double

variable_types: vbc double

variable_types: num double

variable_types: denom double

variable_types: x double

variable_types: i int

variable_types: Nvbc int


decompiled_code:
double __fastcall dEdtdV_pbh(double a1, double a2, double a3, double a4, double a5)
{
double v6; // rbp
double result; // xmm0_8
double v9; // [rsp+8h] [rbp-30h]

v6 = a4;
if ( a4 >= 1.0 )
v6 = *(double *)&LC1;
result = 0.0;
if ( a1 > 0.0 )
{
v9 = a1 * (6.12e-52 / a2 * cube(a3 + 1.0));
result = L_pbh_av(a2, a3, v6, a5) * v9;
}
return result;
}

canonical_decompiled_code:
double __fastcall func10(double a1, double a2, double a3, double a4, double a5)
{
double v6; // rbp
double result; // xmm0_8
double v9; // [rsp+8h] [rbp-30h]

v6 = a4;
if ( a4 >= 1.0 )
v6 = *(double *)&LC1;
result = 0.0;
if ( a1 > 0.0 )
{
v9 = a1 * (6.12e-52 / a2 * cube(a3 + 1.0));
result = func9(a2, a3, v6, a5) * v9;
}
return result;
}

original_code:
double dEdtdV_pbh(double fpbh, double Mpbh, double z, double xe, double Tgas) {
  double xe_used = (xe < 1.? xe : 1.);
  if (fpbh > 0.) {
    return 6.12e-52/Mpbh * cube(1.+z) * fpbh *L_pbh_av(Mpbh, z, xe_used, Tgas);
  }
  else return 0.;
}

variable_types: fpbh double

variable_types: Mpbh double

variable_types: xe double


decompiled_code:
double __fastcall dEdtdV_inj(double *a1, double a2, double a3, double a4)
{
double v5; // r14

v5 = dEdtdV_DM_ann(a1, a2);
return dEdtdV_pbh(a1[10], a1[9], a2, a3, a4) + v5;
}

canonical_decompiled_code:
double __fastcall func11(double *a1, double a2, double a3, double a4)
{
double v5; // r14

v5 = func0(a1, a2);
return func10(a1[10], a1[9], a2, a3, a4) + v5;
}

original_code:
double dEdtdV_inj(double z, double xe, double Tgas, INJ_PARAMS *params){
  return dEdtdV_DM_ann(z, params)
         + dEdtdV_pbh(params->fpbh, params->Mpbh, z, xe, Tgas);
}

canonical_original_code:
double dEdtdV_inj(double z, double xe, double Tgas, struct INJ_PARAMS *params){
  return dEdtdV_DM_ann(z, params)
         + dEdtdV_pbh(params->fpbh, params->Mpbh, z, xe, Tgas);
}

variable_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; } *


decompiled_code:
void __fastcall update_dEdtdV_dep(__int64 a1, double *a2, double a3, double a4, double a5, double a6, double a7, double a8)
{
double v10; // xmm0_8
double v11; // r13

v10 = dEdtdV_inj((double *)a1, a3, a5, a6);
if ( *(_DWORD *)(a1 + 88) == 1 )
{
*a2 = v10;
}
else
{
v11 = *a2;
*a2 = (v11 * exp(a4 * -7.0) + v10 * (a4 * 2.0e-15 * a7 / a8)) / (a4 * 2.0e-15 * a7 / a8 + 1.0);
}
}

original_code:
void update_dEdtdV_dep(double z_out, double dlna, double xe, double Tgas,
         double nH, double H, INJ_PARAMS *params, double *dEdtdV_dep) {
  double inj = dEdtdV_inj(z_out, xe, Tgas, params);
  if (params->on_the_spot == 1) *dEdtdV_dep = inj;
  else {
    *dEdtdV_dep = (*dEdtdV_dep *exp(-7.*dlna) + 2e-15* dlna*nH/H *inj)
                 /(1.+ 2e-15 *dlna*nH/H);
  }
}

canonical_original_code:
void update_dEdtdV_dep(double z_out, double dlna, double xe, double Tgas, double nH, double H, struct INJ_PARAMS *params, double *dEdtdV_dep) {
  double inj = dEdtdV_inj(z_out, xe, Tgas, params);
  if (params->on_the_spot == 1) *dEdtdV_dep = inj;
  else {
    *dEdtdV_dep = (*dEdtdV_dep *exp(-7.*dlna) + 2e-15* dlna*nH/H *inj)
                 /(1.+ 2e-15 *dlna*nH/H);
  }
}

variable_types: dlna double

variable_types: nH double

variable_types: H double

variable_types: inj double

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; }


decompiled_code:
double __fastcall chi_heat(double a1)
{
return (a1 + a1 + 1.0) / 3.0;
}

canonical_decompiled_code:
double __fastcall func13(double a1)
{
return (a1 + a1 + 1.0) / 3.0;
}

original_code:
double chi_heat(double xe) {
  return (1.+2.*xe)/3.;
}


decompiled_code:
double __fastcall chi_ion(double a1)
{
return (1.0 - a1) / 3.0;
}

canonical_decompiled_code:
double __fastcall func14(double a1)
{
return (1.0 - a1) / 3.0;
}

original_code:
double chi_ion(double xe) {
  return (1.-xe)/3.;
}


decompiled_code:
double __fastcall chi_exc(double a1)
{
double v2; // r14

v2 = chi_ion(a1);
return 1.0 - v2 - chi_heat(a1);
}

canonical_decompiled_code:
double __fastcall func15(double a1)
{
double v2; // r14

v2 = func14(a1);
return 1.0 - v2 - func13(a1);
}

original_code:
double chi_exc(double xe) {
  return 1. - chi_ion(xe) - chi_heat(xe);
}


square

decompiled_code:
double __fastcall square(double a1)
{
return a1 * a1;
}

canonical_decompiled_code:
double __fastcall func0(double a1)
{
return a1 * a1;
}

original_code:
double square(double x) {
  return x*x;
}

canonical_original_code:
double square(double x) {
  return x*x;
}


cube

decompiled_code:
double __fastcall cube(double a1)
{
return a1 * a1 * a1;
}

canonical_decompiled_code:
double __fastcall func1(double a1)
{
return a1 * a1 * a1;
}

original_code:
double cube(double x) {
  return x*x*x;
}

canonical_original_code:
double cube(double x) {
  return x*x*x;
}


decompiled_code:
void *__fastcall create_1D_array(size_t nmemb, _DWORD *a2, char *a3)
{
void *v4; // rax
void *v5; // rbx
char v7[152]; // [rsp+0h] [rbp-98h] BYREF

v4 = calloc((unsigned int)nmemb, 8uLL);
v5 = v4;
if ( *a2 != 1 && !v4 )
{
strcpy(v7, "unable to allocate memory in create_1D_array \n");
strcat(a3, v7);
*a2 = 1;
}
return v5;
}

canonical_decompiled_code:
void *__fastcall func2(size_t nmemb, _DWORD *a2, char *a3)
{
void *v4; // rax
void *v5; // rbx
char v7[152]; // [rsp+0h] [rbp-98h] BYREF

v4 = calloc((unsigned int)nmemb, 8uLL);
v5 = v4;
if ( *a2 != 1 && !v4 )
{
strcpy(v7, "unable to allocate memory in create_1D_array \n");
strcat(a3, v7);
*a2 = 1;
}
return v5;
}

original_code:
double *create_1D_array(unsigned n1, int *error, char error_message[2048]){
  double *matrix = (double *) calloc(n1, sizeof(double));
  char sub_message[128];
  if (*error == 1) return matrix;
  if (matrix == ((void *)0)) {
    sprintf(sub_message, "unable to allocate memory in create_1D_array \n");
    strcat(error_message, sub_message);
    *error = 1;
  }
  return matrix;
}

canonical_original_code:
double *create_1D_array(unsigned int n1, int *error, char error_message[2048]){
  double *matrix = (double *) calloc(n1, sizeof(double));
  char sub_message[128];
  if (*error == 1) return matrix;
  if (matrix == ((void *)0)) {
    sprintf(sub_message, "unable to allocate memory in create_1D_array \n");
    strcat(error_message, sub_message);
    *error = 1;
  }
  return matrix;
}

variable_types:
error
int *

variable_types:
matrix
double *

return_type: double *


decompiled_code:
void **__fastcall create_2D_array(size_t nmemb, unsigned int a2, _DWORD *a3, char *a4)
{
void **v6; // rax
void **v7; // r15
void **v8; // rbx
char v10[184]; // [rsp+0h] [rbp-B8h] BYREF

v6 = (void **)calloc((unsigned int)nmemb, 8uLL);
v7 = v6;
if ( *a3 != 1 )
{
if ( !v6 )
{
strcpy(v10, "unable to allocate memory in create_2D_array \n");
strcat(a4, v10);
*a3 = 1;
}
if ( (_DWORD)nmemb )
{
v8 = v7;
do
*v8++ = create_1D_array(a2, a3, a4);
while ( v8 != &v7[(unsigned int)nmemb] );
}
}
return v7;
}

canonical_decompiled_code:
void **__fastcall func3(size_t nmemb, unsigned int a2, _DWORD *a3, char *a4)
{
void **v6; // rax
void **v7; // r15
void **v8; // rbx
char v10[184]; // [rsp+0h] [rbp-B8h] BYREF

v6 = (void **)calloc((unsigned int)nmemb, 8uLL);
v7 = v6;
if ( *a3 != 1 )
{
if ( !v6 )
{
strcpy(v10, "unable to allocate memory in create_2D_array \n");
strcat(a4, v10);
*a3 = 1;
}
if ( (_DWORD)nmemb )
{
v8 = v7;
do
*v8++ = func2(a2, a3, a4);
while ( v8 != &v7[(unsigned int)nmemb] );
}
}
return v7;
}

original_code:
double **create_2D_array(unsigned n1, unsigned n2, int *error, char error_message[2048]){
  unsigned i;
  double **matrix = (double **) calloc(n1, sizeof(double *));
  char sub_message[128];
  if (*error == 1) return matrix;
  if (matrix == ((void *)0)){
    sprintf(sub_message, "unable to allocate memory in create_2D_array \n");
    strcat(error_message, sub_message);
    *error = 1;
  }
  for (i = 0; i < n1; i++) matrix[i] = create_1D_array(n2, error, error_message);
  return matrix;
}

canonical_original_code:
double **create_2D_array(unsigned int n1, unsigned int n2, int *error, char error_message[2048]){
  unsigned int i;
  double **matrix = (double **) calloc(n1, sizeof(double *));
  char sub_message[128];
  if (*error == 1) return matrix;
  if (matrix == ((void *)0)){
    sprintf(sub_message, "unable to allocate memory in create_2D_array \n");
    strcat(error_message, sub_message);
    *error = 1;
  }
  for (i = 0; i < n1; i++) matrix[i] = create_1D_array(n2, error, error_message);
  return matrix;
}

variable_types:
i
unsigned int

variable_types:
matrix
double **

return_type: double **


decompiled_code:
void __fastcall free_2D_array(void *ptr, int a2)
{
void **v2; // rbx

if ( a2 )
{
v2 = (void **)ptr;
do
free(*v2++);
while ( v2 != (void **)((char *)ptr + 8 * (unsigned int)(a2 - 1) + 8) );
}
free(ptr);
}

canonical_decompiled_code:
void __fastcall func4(void *ptr, int a2)
{
void **v2; // rbx

if ( a2 )
{
v2 = (void **)ptr;
do
free(*v2++);
while ( v2 != (void **)((char *)ptr + 8 * (unsigned int)(a2 - 1) + 8) );
}
free(ptr);
}

original_code:
void free_2D_array(double **matrix, unsigned n1){
  unsigned i;
  for (i = 0; i < n1; i++) free(matrix[i]);
  free(matrix);
}

canonical_original_code:
void free_2D_array(double **matrix, unsigned int n1){
  unsigned int i;
  for (i = 0; i < n1; i++) free(matrix[i]);
  free(matrix);
}


decompiled_code:
void ***__fastcall create_3D_array(size_t nmemb, unsigned int a2, unsigned int a3, _DWORD *a4, char *a5)
{
void ***v8; // rax
void ***v9; // rbx
void ***v11; // [rsp+8h] [rbp-C0h]
char src[184]; // [rsp+10h] [rbp-B8h] BYREF

v8 = (void ***)calloc((unsigned int)nmemb, 8uLL);
v11 = v8;
if ( *a4 != 1 )
{
if ( !v8 )
{
strcpy(src, "unable to allocate memory in create_3D_array \n");
strcat(a5, src);
*a4 = 1;
}
if ( (_DWORD)nmemb )
{
v9 = v11;
do
*v9++ = create_2D_array(a2, a3, a4, a5);
while ( v9 != &v11[(unsigned int)nmemb] );
}
}
return v11;
}

canonical_decompiled_code:
void ***__fastcall func5(size_t nmemb, unsigned int a2, unsigned int a3, _DWORD *a4, char *a5)
{
void ***v8; // rax
void ***v9; // rbx
void ***v11; // [rsp+8h] [rbp-C0h]
char src[184]; // [rsp+10h] [rbp-B8h] BYREF

v8 = (void ***)calloc((unsigned int)nmemb, 8uLL);
v11 = v8;
if ( *a4 != 1 )
{
if ( !v8 )
{
strcpy(src, "unable to allocate memory in create_3D_array \n");
strcat(a5, src);
*a4 = 1;
}
if ( (_DWORD)nmemb )
{
v9 = v11;
do
*v9++ = func3(a2, a3, a4, a5);
while ( v9 != &v11[(unsigned int)nmemb] );
}
}
return v11;
}

original_code:
double ***create_3D_array(unsigned n1, unsigned n2, unsigned n3, int *error, char error_message[2048]){
  unsigned i;
  double ***matrix = (double ***) calloc(n1, sizeof(double **));
  char sub_message[128];
  if (*error == 1) return matrix;
  if (matrix == ((void *)0)) {
    sprintf(sub_message, "unable to allocate memory in create_3D_array \n");
    strcat(error_message, sub_message);
    *error = 1;
  }
  for (i = 0; i < n1; i++) matrix[i] = create_2D_array(n2, n3, error, error_message);
  return matrix;
}

canonical_original_code:
double ***create_3D_array(unsigned int n1, unsigned int n2, unsigned int n3, int *error, char error_message[2048]){
  unsigned int i;
  double ***matrix = (double ***) calloc(n1, sizeof(double **));
  char sub_message[128];
  if (*error == 1) return matrix;
  if (matrix == ((void *)0)) {
    sprintf(sub_message, "unable to allocate memory in create_3D_array \n");
    strcat(error_message, sub_message);
    *error = 1;
  }
  for (i = 0; i < n1; i++) matrix[i] = create_2D_array(n2, n3, error, error_message);
  return matrix;
}

variable_types:
matrix
double ***

return_type: double ***


decompiled_code:
void __fastcall free_3D_array(void *ptr, int a2, int a3)
{
void **v4; // rbx

if ( a2 )
{
v4 = (void **)ptr;
do
free_2D_array(*v4++, a3);
while ( v4 != (void **)((char *)ptr + 8 * (unsigned int)(a2 - 1) + 8) );
}
free(ptr);
}

canonical_decompiled_code:
void __fastcall func6(void *ptr, int a2, int a3)
{
void **v4; // rbx

if ( a2 )
{
v4 = (void **)ptr;
do
func4(*v4++, a3);
while ( v4 != (void **)((char *)ptr + 8 * (unsigned int)(a2 - 1) + 8) );
}
free(ptr);
}

original_code:
void free_3D_array(double ***matrix, unsigned n1, unsigned n2) {
  unsigned i;
  for (i = 0; i < n1; i++) free_2D_array(matrix[i], n2);
  free(matrix);
}

canonical_original_code:
void free_3D_array(double ***matrix, unsigned int n1, unsigned int n2) {
  unsigned int i;
  for (i = 0; i < n1; i++) free_2D_array(matrix[i], n2);
  free(matrix);
}


maketab

decompiled_code:
__int64 __fastcall maketab(int a1, __int64 a2, double a3, double a4)
{
__int64 result; // rax
double v5; // xmm1_8

result = (unsigned int)a1;
v5 = (a4 - a3) / ((double)a1 - 1.0);
if ( a1 )
{
for ( result = 0LL; result != a1; ++result )
*(double *)(a2 + 8 * result) = (double)(int)result * v5 + a3;
}
return result;
}

canonical_decompiled_code:
__int64 __fastcall func7(int a1, __int64 a2, double a3, double a4)
{
__int64 result; // rax
double v5; // xmm1_8

result = (unsigned int)a1;
v5 = (a4 - a3) / ((double)a1 - 1.0);
if ( a1 )
{
for ( result = 0LL; result != a1; ++result )
*(double *)(a2 + 8 * result) = (double)(int)result * v5 + a3;
}
return result;
}

original_code:
void maketab(double xmin, double xmax, unsigned Nx, double *xtab){
  unsigned i;
  double h = (xmax - xmin)/(Nx - 1.0);
  for (i = 0; i < Nx; i++) xtab[i] = xmin + i * h;
}

canonical_original_code:
void maketab(double xmin, double xmax, unsigned int Nx, double *xtab){
  unsigned int i;
  double h = (xmax - xmin)/(Nx - 1.0);
  for (i = 0; i < Nx; i++) xtab[i] = xmin + i * h;
}

variable_types: xmin double

variable_types: xmax double

variable_types:
Nx
unsigned int

variable_types:
xtab
double *

variable_types: h double


original_code:
double rec_interp1d(double x0, double dx, double *ytab, unsigned int Nx, double x, int *error, char error_message[2048]) {
  long ix;
  double frac;
  char sub_message[128];
  if (*error == 1) return 0.;
  if (dx > 0 && (x<x0 || x>x0+dx*(Nx-1))) {
    sprintf(sub_message,"x-value out of range in interpolation in rec_interp1d.\n");
    strcat(error_message, sub_message);
    *error = 1;
    return 0.;
  }
  if (dx < 0 && (x>x0 || x<x0+dx*(Nx-1))) {
    sprintf(sub_message,"x-value out of range in interpolation in rec_interp1d.\n");
    strcat(error_message, sub_message);
    *error = 1;
    return 0.;
  }
  ix = (long)floor((x-x0)/dx);
  if (ix<1) ix=1;
  if (ix>Nx-3) ix=Nx-3;
  frac = (x-x0)/dx-ix;
  ytab += ix-1;
  return(
    -ytab[0]*frac*(1.-frac)*(2.-frac)/6.
    +ytab[1]*(1.+frac)*(1.-frac)*(2.-frac)/2.
    +ytab[2]*(1.+frac)*frac*(2.-frac)/2.
    -ytab[3]*(1.+frac)*frac*(1.-frac)/6.
  );
}

variable_types: dx double

variable_types:
ytab
double *

variable_types: x double

variable_types: ix long

variable_types: frac double


original_code:
double rec_interp2d(double x10, double dx1, double x20, double dx2, double **ytab,
  unsigned int Nx1, unsigned int Nx2, double x1, double x2, int *error, char error_message[2048]) {
  int j;
  long ix1;
  double frac1;
  double temp[4];
  char sub_message[128];
  if (*error == 1) return 0.;
  if (x1<x10 || x1>x10+dx1*(Nx1-1)) {
    sprintf(sub_message,"x-value out of range in interpolation in rec_interp2d.\n");
    strcat(error_message, sub_message);
    *error = 1;
    return 0.;
  }
  ix1 = (long)floor((x1-x10)/dx1);
  if (ix1<1) ix1=1;
  if (ix1>Nx1-3) ix1=Nx1-3;
  frac1 = (x1-x10)/dx1-ix1;
  ytab += ix1-1;
  for(j=0;j<4;j++) temp[j] = rec_interp1d(x20,dx2,ytab[j],Nx2,x2, error, error_message);
  return(
    -temp[0]*frac1*(1.-frac1)*(2.-frac1)/6.
    +temp[1]*(1.+frac1)*(1.-frac1)*(2.-frac1)/2.
    +temp[2]*(1.+frac1)*frac1*(2.-frac1)/2.
    +temp[3]*(1.+frac1)*frac1*(frac1-1.)/6.
  );
}

variable_types:
ytab
double **

variable_types: j int

variable_types:
temp
double [4]


original_code:
double rec_interpol_G(double x, double *xtab, double *ytab, unsigned int Nx, int *error, char error_message[2048]) {
  char sub_message[128];
  if (*error == 1) return 0.;
  if (Nx < 4) {
    sprintf(sub_message, "Table needs to be of dimension 4 at least in rec_interpol_G.\n");
    strcat(error_message, sub_message);
    *error = 1;
    return 0.;
  }
  if (xtab[0] > xtab[1]) {
    sprintf(sub_message, "Array does not seem to be increasing in rec_interpol_G.\n");
    strcat(error_message, sub_message);
    *error = 1;
    return 0.;
  }
  if (x < xtab[0] || x >= xtab[Nx-1]) {
    sprintf(sub_message, "x-value out of range in rec_interpol_G.\n");
    strcat(error_message, sub_message);
    *error = 1;
    return 0.;
  }
  long int ix;
  long int ilo = 0;
  long int ihi = Nx-1;
  long int imid;
  while (ihi - ilo > 1) {
    imid = (ihi + ilo)/2;
    if (x >= xtab[imid]) ilo = imid;
    if (x < xtab[imid]) ihi = imid;
  }
  ix = ilo;
  if (ix<1) ix = 1;
  if (ix>Nx-3) ix = Nx-3;
  xtab += ix-1;
  ytab += ix-1;
  return(
     ytab[0] *(x-xtab[1])*(x-xtab[2])*(x-xtab[3])
             /(xtab[0]-xtab[1])/(xtab[0]-xtab[2])/(xtab[0]-xtab[3])
           + ytab[1] *(x-xtab[0])*(x-xtab[2])*(x-xtab[3])
             /(xtab[1]-xtab[0])/(xtab[1]-xtab[2])/(xtab[1]-xtab[3])
           + ytab[2] *(x-xtab[0])*(x-xtab[1])*(x-xtab[3])
             /(xtab[2]-xtab[0])/(xtab[2]-xtab[1])/(xtab[2]-xtab[3])
           + ytab[3] *(x-xtab[0])*(x-xtab[1])*(x-xtab[2])
             /(xtab[3]-xtab[0])/(xtab[3]-xtab[1])/(xtab[3]-xtab[2])
  );
}

canonical_original_code:
double rec_interpol_G(double x, double *xtab, double *ytab, unsigned int Nx, int *error, char error_message[2048]) {
  char sub_message[128];
  if (*error == 1) return 0.;
  if (Nx < 4) {
    sprintf(sub_message, "Table needs to be of dimension 4 at least in rec_interpol_G.\n");
    strcat(error_message, sub_message);
    *error = 1;
    return 0.;
  }
  if (xtab[0] > xtab[1]) {
    sprintf(sub_message, "Array does not seem to be increasing in rec_interpol_G.\n");
    strcat(error_message, sub_message);
    *error = 1;
    return 0.;
  }
  if (x < xtab[0] || x >= xtab[Nx-1]) {
    sprintf(sub_message, "x-value out of range in rec_interpol_G.\n");
    strcat(error_message, sub_message);
    *error = 1;
    return 0.;
  }
  long ix;
  long ilo = 0;
  long ihi = Nx-1;
  long imid;
  while (ihi - ilo > 1) {
    imid = (ihi + ilo)/2;
    if (x >= xtab[imid]) ilo = imid;
    if (x < xtab[imid]) ihi = imid;
  }
  ix = ilo;
  if (ix<1) ix = 1;
  if (ix>Nx-3) ix = Nx-3;
  xtab += ix-1;
  ytab += ix-1;
  return(
     ytab[0] *(x-xtab[1])*(x-xtab[2])*(x-xtab[3])
             /(xtab[0]-xtab[1])/(xtab[0]-xtab[2])/(xtab[0]-xtab[3])
           + ytab[1] *(x-xtab[0])*(x-xtab[2])*(x-xtab[3])
             /(xtab[1]-xtab[0])/(xtab[1]-xtab[2])/(xtab[1]-xtab[3])
           + ytab[2] *(x-xtab[0])*(x-xtab[1])*(x-xtab[3])
             /(xtab[2]-xtab[0])/(xtab[2]-xtab[1])/(xtab[2]-xtab[3])
           + ytab[3] *(x-xtab[0])*(x-xtab[1])*(x-xtab[2])
             /(xtab[3]-xtab[0])/(xtab[3]-xtab[1])/(xtab[3]-xtab[2])
  );
}

variable_types:
error
int *

variable_types: ilo long

variable_types: ihi long

variable_types: imid long


decompiled_code:
__int64 __fastcall evolver_rk(unsigned int (__fastcall *a1)(__int64, void *, __int64, const char *, double), __int64 a2, double a3, double a4, double a5, double a6, double a7, __int64 a8, unsigned int a9, __int64 a10, unsigned int (__fastcall *a11)(__int64, double *, const char *, double), double *a12, int a13, unsigned int (__fastcall *a14)(__int64, void *, _QWORD, __int64, const char *, double), unsigned int (__fastcall *a15)(__int64, void *, __int64, const char *, double), const char *a16)
{
__int64 v17; // rax
signed int v18; // er12
unsigned int v19; // ebx
void *v20; // r15
double v22; // xmm0_8
double v23; // xmm1_8
double v25; // [rsp+0h] [rbp-18F8h]
double v26; // [rsp+8h] [rbp-18F0h]
__int16 v27; // [rsp+16h] [rbp-18E2h]
double v29; // [rsp+30h] [rbp-18C8h]
char v32[2048]; // [rsp+50h] [rbp-18A8h] BYREF
char v33[2048]; // [rsp+850h] [rbp-10A8h] BYREF
char v34[104]; // [rsp+1050h] [rbp-8A8h] BYREF
char v35[2048]; // [rsp+10B8h] [rbp-840h] BYREF
double v36[8]; // [rsp+18B8h] [rbp-40h] BYREF

v29 = a3;
if ( a3 > a12[a13 - 1] )
{
class_protect_sprintf(v32, "called with x=%e, last x_sampling=%e", a3);
class_protect_sprintf(v33, "condition (%s) is true; %s", a3);
class_protect_sprintf(a16, "%s(L:%d) :%s", a3);
v19 = 1;
}
else
{
v17 = 1LL;
v18 = 0;
if ( a3 > *a12 )
{
do
v18 = v17++;
while ( a3 > a12[v17 - 1] );
}
v19 = initialize_generic_integrator(a9, v34);
if ( v19 == 1 )
{
class_protect_sprintf(v33, "error in %s;\n=>%s", a3);
class_protect_sprintf(a16, "%s(L:%d) :%s", a3);
}
else
{
v20 = malloc(8LL * (int)a9);
if ( v20 )
{
if ( a13 > v18 )
{
v25 = a3;
if ( a4 > a3 )
{
while ( 1 )
{
if ( a11(a10, v36, a16, v25) == 1 )
{
v19 = 1;
class_protect_sprintf(v33, "error in %s;\n=>%s", v25);
class_protect_sprintf(a16, "%s(L:%d) :%s", v25);
return v19;
}
v22 = a7 * v36[0];
*(_QWORD *)&v23 = COERCE_UNSIGNED_INT64(a7 * v36[0] / v25) & LC9;
if ( a6 > v23 )
{
class_protect_sprintf(
v32,
"integration step =%e < machine precision : leads either to numerical error or infinite loop",
v23);
class_protect_sprintf(v33, "condition (%s) is true; %s", "fabs(timestep/x1) < minimum_variation", v32);
class_protect_sprintf(a16, "%s(L:%d) :%s", "evolver_rk", 71LL, v33);
return 1;
}
v26 = a12[v18];
if ( v26 <= v22 + v22 + v25 )
{
v27 = 1;
}
else
{
v26 = v22 + v25;
v27 = 0;
}
if ( v26 > a4 )
{
v26 = a4;
v27 = 0;
}
if ( a15 )
{
if ( v29 == v25 && a1(a2, v20, a10, a16, v25) == 1 )
{
v19 = 1;
class_protect_sprintf(
v33,
"error in %s;\n=>%s",
"(*derivs)(x1, y, dy, parameters_and_workspace_for_derivs, error_message)",
a16);
class_protect_sprintf(a16, "%s(L:%d) :%s", "evolver_rk", 92LL, v33);
return v19;
}
if ( a15(a2, v20, a10, a16, v25) == 1 )
{
v19 = 1;
class_protect_sprintf(
v33,
"error in %s;\n=>%s",
"(*print_variables)(x1, y, dy, parameters_and_workspace_for_derivs, error_message)",
a16);
class_protect_sprintf(a16, "%s(L:%d) :%s", "evolver_rk", 101LL, v33);
return v19;
}
}
if ( (unsigned int)generic_integrator(a1, a2, a10, v34, v25, v26, a5, a6 * v25) == 1 )
{
v19 = 1;
class_protect_sprintf(
v33,
"error in %s;\n=>%s",
"generic_integrator(derivs, x1, x2, y, parameters_and_workspace_for_derivs, tolerance, x1*minimum_variation, &gi)",
v35);
class_protect_sprintf(a16, "%s(L:%d) :%s", "evolver_rk", 110LL, v33);
return v19;
}
if ( v27 == 1 )
{
if ( a1(a2, v20, a10, a16, v26) == 1 )
{
v19 = 1;
class_protect_sprintf(
v33,
"error in %s;\n=>%s",
"(*derivs)(x2, y, dy, parameters_and_workspace_for_derivs, error_message)",
a16);
class_protect_sprintf(a16, "%s(L:%d) :%s", "evolver_rk", 123LL, v33);
return v19;
}
if ( a14(a2, v20, (unsigned int)v18, a10, a16, v26) == 1 )
{
v19 = 1;
class_protect_sprintf(
v33,
"error in %s;\n=>%s",
"(*output)(x2, y, dy, next_index_x, parameters_and_workspace_for_derivs, error_message)",
a16);
class_protect_sprintf(a16, "%s(L:%d) :%s", "evolver_rk", 131LL, v33);
return v19;
}
++v18;
}
if ( v18 >= a13 || a4 <= v26 )
goto LABEL_13;
v25 = v26;
}
}
}
v26 = a3;
LABEL_13:
v19 = a1(a2, v20, a10, a16, v26);
if ( v19 == 1 )
{
class_protect_sprintf(
v33,
"error in %s;\n=>%s",
"(*derivs)(x1, y, dy, parameters_and_workspace_for_derivs, error_message)",
a16);
class_protect_sprintf(a16, "%s(L:%d) :%s", "evolver_rk", 153LL, v33);
}
else if ( a15 && (v19 = a15(a2, v20, a10, a16, v26), v19 == 1) )
{
class_protect_sprintf(
v33,
"error in %s;\n=>%s",
"(*print_variables)(x1, y, dy, parameters_and_workspace_for_derivs, error_message)",
a16);
class_protect_sprintf(a16, "%s(L:%d) :%s", "evolver_rk", 162LL, v33);
}
else
{
v19 = cleanup_generic_integrator(v34);
if ( v19 == 1 )
{
class_protect_sprintf(v33, "error in %s;\n=>%s", "cleanup_generic_integrator(&gi)", v35);
class_protect_sprintf(a16, "%s(L:%d) :%s", "evolver_rk", 170LL, v33);
}
else
{
free(v20);
v19 = 0;
}
}
}
else
{
class_protect_sprintf(v33, "could not allocate %s with size %d", a3);
class_protect_sprintf(a16, "%s(L:%d) :%s", a3);
v19 = 1;
}
}
}
return v19;
}

canonical_decompiled_code:
__int64 __fastcall func0(unsigned int (__fastcall *a1)(__int64, void *, __int64, const char *, double), __int64 a2, double a3, double a4, double a5, double a6, double a7, __int64 a8, unsigned int a9, __int64 a10, unsigned int (__fastcall *a11)(__int64, double *, const char *, double), double *a12, int a13, unsigned int (__fastcall *a14)(__int64, void *, _QWORD, __int64, const char *, double), unsigned int (__fastcall *a15)(__int64, void *, __int64, const char *, double), const char *a16)
{
__int64 v17; // rax
signed int v18; // er12
unsigned int v19; // ebx
void *v20; // r15
double v22; // xmm0_8
double v23; // xmm1_8
double v25; // [rsp+0h] [rbp-18F8h]
double v26; // [rsp+8h] [rbp-18F0h]
__int16 v27; // [rsp+16h] [rbp-18E2h]
double v29; // [rsp+30h] [rbp-18C8h]
char v32[2048]; // [rsp+50h] [rbp-18A8h] BYREF
char v33[2048]; // [rsp+850h] [rbp-10A8h] BYREF
char v34[104]; // [rsp+1050h] [rbp-8A8h] BYREF
char v35[2048]; // [rsp+10B8h] [rbp-840h] BYREF
double v36[8]; // [rsp+18B8h] [rbp-40h] BYREF

v29 = a3;
if ( a3 > a12[a13 - 1] )
{
class_protect_sprintf(v32, "called with x=%e, last x_sampling=%e", a3);
class_protect_sprintf(v33, "condition (%s) is true; %s", a3);
class_protect_sprintf(a16, "%s(L:%d) :%s", a3);
v19 = 1;
}
else
{
v17 = 1LL;
v18 = 0;
if ( a3 > *a12 )
{
do
v18 = v17++;
while ( a3 > a12[v17 - 1] );
}
v19 = initialize_generic_integrator(a9, v34);
if ( v19 == 1 )
{
class_protect_sprintf(v33, "error in %s;\n=>%s", a3);
class_protect_sprintf(a16, "%s(L:%d) :%s", a3);
}
else
{
v20 = malloc(8LL * (int)a9);
if ( v20 )
{
if ( a13 > v18 )
{
v25 = a3;
if ( a4 > a3 )
{
while ( 1 )
{
if ( a11(a10, v36, a16, v25) == 1 )
{
v19 = 1;
class_protect_sprintf(v33, "error in %s;\n=>%s", v25);
class_protect_sprintf(a16, "%s(L:%d) :%s", v25);
return v19;
}
v22 = a7 * v36[0];
*(_QWORD *)&v23 = COERCE_UNSIGNED_INT64(a7 * v36[0] / v25) & LC9;
if ( a6 > v23 )
{
class_protect_sprintf(
v32,
"integration step =%e < machine precision : leads either to numerical error or infinite loop",
v23);
class_protect_sprintf(v33, "condition (%s) is true; %s", "fabs(timestep/x1) < minimum_variation", v32);
class_protect_sprintf(a16, "%s(L:%d) :%s", "evolver_rk", 71LL, v33);
return 1;
}
v26 = a12[v18];
if ( v26 <= v22 + v22 + v25 )
{
v27 = 1;
}
else
{
v26 = v22 + v25;
v27 = 0;
}
if ( v26 > a4 )
{
v26 = a4;
v27 = 0;
}
if ( a15 )
{
if ( v29 == v25 && a1(a2, v20, a10, a16, v25) == 1 )
{
v19 = 1;
class_protect_sprintf(
v33,
"error in %s;\n=>%s",
"(*derivs)(x1, y, dy, parameters_and_workspace_for_derivs, error_message)",
a16);
class_protect_sprintf(a16, "%s(L:%d) :%s", "evolver_rk", 92LL, v33);
return v19;
}
if ( a15(a2, v20, a10, a16, v25) == 1 )
{
v19 = 1;
class_protect_sprintf(
v33,
"error in %s;\n=>%s",
"(*print_variables)(x1, y, dy, parameters_and_workspace_for_derivs, error_message)",
a16);
class_protect_sprintf(a16, "%s(L:%d) :%s", "evolver_rk", 101LL, v33);
return v19;
}
}
if ( (unsigned int)generic_integrator(a1, a2, a10, v34, v25, v26, a5, a6 * v25) == 1 )
{
v19 = 1;
class_protect_sprintf(
v33,
"error in %s;\n=>%s",
"generic_integrator(derivs, x1, x2, y, parameters_and_workspace_for_derivs, tolerance, x1*minimum_variation, &gi)",
v35);
class_protect_sprintf(a16, "%s(L:%d) :%s", "evolver_rk", 110LL, v33);
return v19;
}
if ( v27 == 1 )
{
if ( a1(a2, v20, a10, a16, v26) == 1 )
{
v19 = 1;
class_protect_sprintf(
v33,
"error in %s;\n=>%s",
"(*derivs)(x2, y, dy, parameters_and_workspace_for_derivs, error_message)",
a16);
class_protect_sprintf(a16, "%s(L:%d) :%s", "evolver_rk", 123LL, v33);
return v19;
}
if ( a14(a2, v20, (unsigned int)v18, a10, a16, v26) == 1 )
{
v19 = 1;
class_protect_sprintf(
v33,
"error in %s;\n=>%s",
"(*output)(x2, y, dy, next_index_x, parameters_and_workspace_for_derivs, error_message)",
a16);
class_protect_sprintf(a16, "%s(L:%d) :%s", "evolver_rk", 131LL, v33);
return v19;
}
++v18;
}
if ( v18 >= a13 || a4 <= v26 )
goto LABEL_13;
v25 = v26;
}
}
}
v26 = a3;
LABEL_13:
v19 = a1(a2, v20, a10, a16, v26);
if ( v19 == 1 )
{
class_protect_sprintf(
v33,
"error in %s;\n=>%s",
"(*derivs)(x1, y, dy, parameters_and_workspace_for_derivs, error_message)",
a16);
class_protect_sprintf(a16, "%s(L:%d) :%s", "evolver_rk", 153LL, v33);
}
else if ( a15 && (v19 = a15(a2, v20, a10, a16, v26), v19 == 1) )
{
class_protect_sprintf(
v33,
"error in %s;\n=>%s",
"(*print_variables)(x1, y, dy, parameters_and_workspace_for_derivs, error_message)",
a16);
class_protect_sprintf(a16, "%s(L:%d) :%s", "evolver_rk", 162LL, v33);
}
else
{
v19 = cleanup_generic_integrator(v34);
if ( v19 == 1 )
{
class_protect_sprintf(v33, "error in %s;\n=>%s", "cleanup_generic_integrator(&gi)", v35);
class_protect_sprintf(a16, "%s(L:%d) :%s", "evolver_rk", 170LL, v33);
}
else
{
free(v20);
v19 = 0;
}
}
}
else
{
class_protect_sprintf(v33, "could not allocate %s with size %d", a3);
class_protect_sprintf(a16, "%s(L:%d) :%s", a3);
v19 = 1;
}
}
}
return v19;
}

original_code:
int evolver_rk(int (*derivs)(double x,
      double * y,
      double * dy,
      void * parameters_and_workspace,
      ErrorMsg error_message),
      double x_ini,
      double x_end,
      double * y,
      int * used_in_output,
      int y_size,
      void * parameters_and_workspace_for_derivs,
      double tolerance,
      double minimum_variation,
      int (*evaluate_timescale)(double x,
           void * parameters_and_workspace,
           double * timescale,
           ErrorMsg error_message),
      double timestep_over_timescale,
      double * x_sampling,
      int x_size,
      int (*output)(double x,
      double y[],
      double dy[],
      int index_x,
      void * parameters_and_workspace,
      ErrorMsg error_message),
      int (*print_variables)(double x,
        double y[],
        double dy[],
        void * parameters_and_workspace,
        ErrorMsg error_message),
      ErrorMsg error_message) {
  int next_index_x;
  double x1,x2=0.,timestep,timescale;
  struct generic_integrator_workspace gi;
  double * dy;
  short call_output;
  { if (x_ini > x_sampling[x_size-1]) { { ErrorMsg Optional_arguments; class_protect_sprintf(Optional_arguments,"called with x=%e, last x_sampling=%e",x_ini,x_sampling[x_size-1]); { ErrorMsg FMsg; class_protect_sprintf(FMsg,"condition (%s) is true; %s","x_ini > x_sampling[x_size-1]",Optional_arguments); class_protect_sprintf(error_message,"%s(L:%d) :%s",__func__,42,FMsg); }; }; return 1; } };
  next_index_x=0;
  while (x_sampling[next_index_x] < x_ini) next_index_x++;
  { if (initialize_generic_integrator(y_size, &gi) == 1) { { ErrorMsg FMsg; class_protect_sprintf(FMsg,"error in %s;\n=>%s","initialize_generic_integrator(y_size, &gi)",gi.error_message); class_protect_sprintf(error_message,"%s(L:%d) :%s",__func__,50,FMsg); };; ; return 1; } };
  { dy=malloc(y_size*sizeof(double)); if (dy == ((void *)0)) { int size_int; size_int = y_size*sizeof(double); { ErrorMsg FMsg; class_protect_sprintf(FMsg,"could not allocate %s with size %d","dy",size_int); class_protect_sprintf(error_message,"%s(L:%d) :%s",__func__,54,FMsg); };; return 1; } };
  x1=x_ini;
  call_output = 0;
  while ((x1 < x_end) && (next_index_x<x_size)) {
    { if ((*evaluate_timescale)(x1, parameters_and_workspace_for_derivs, &timescale, error_message) == 1) { { ErrorMsg FMsg; class_protect_sprintf(FMsg,"error in %s;\n=>%s","(*evaluate_timescale)(x1, parameters_and_workspace_for_derivs, &timescale, error_message)",error_message); class_protect_sprintf(error_message,"%s(L:%d) :%s",__func__,62,FMsg); };; ; return 1; } };
    timestep = timestep_over_timescale * timescale;
    { if (fabs(timestep/x1) < minimum_variation) { { ErrorMsg Optional_arguments; class_protect_sprintf(Optional_arguments,"integration step =%e < machine precision : leads either to numerical error or infinite loop",fabs(timestep/x1)); { ErrorMsg FMsg; class_protect_sprintf(FMsg,"condition (%s) is true; %s","fabs(timestep/x1) < minimum_variation",Optional_arguments); class_protect_sprintf(error_message,"%s(L:%d) :%s",__func__,71,FMsg); }; }; return 1; } };
    if (x1 + 2.* timestep < x_sampling[next_index_x]) {
      x2 = x1 + timestep;
    }
    else {
      x2 = x_sampling[next_index_x];
      call_output = 1;
    }
    if (x2 > x_end) {
      x2 = x_end;
      call_output = 0;
    }
    if (print_variables != ((void *)0)) {
      if (x1 == x_ini) {
 { if ((*derivs)(x1, y, dy, parameters_and_workspace_for_derivs, error_message) == 1) { { ErrorMsg FMsg; class_protect_sprintf(FMsg,"error in %s;\n=>%s","(*derivs)(x1, y, dy, parameters_and_workspace_for_derivs, error_message)",error_message); class_protect_sprintf(error_message,"%s(L:%d) :%s",__func__,92,FMsg); };; ; return 1; } };
      }
      { if ((*print_variables)(x1, y, dy, parameters_and_workspace_for_derivs, error_message) == 1) { { ErrorMsg FMsg; class_protect_sprintf(FMsg,"error in %s;\n=>%s","(*print_variables)(x1, y, dy, parameters_and_workspace_for_derivs, error_message)",error_message); class_protect_sprintf(error_message,"%s(L:%d) :%s",__func__,101,FMsg); };; ; return 1; } };
    }
    { if (generic_integrator(derivs, x1, x2, y, parameters_and_workspace_for_derivs, tolerance, x1*minimum_variation, &gi) == 1) { { ErrorMsg FMsg; class_protect_sprintf(FMsg,"error in %s;\n=>%s","generic_integrator(derivs, x1, x2, y, parameters_and_workspace_for_derivs, tolerance, x1*minimum_variation, &gi)",gi.error_message); class_protect_sprintf(error_message,"%s(L:%d) :%s",__func__,110,FMsg); };; ; return 1; } };
    if (call_output == 1) {
      { if ((*derivs)(x2, y, dy, parameters_and_workspace_for_derivs, error_message) == 1) { { ErrorMsg FMsg; class_protect_sprintf(FMsg,"error in %s;\n=>%s","(*derivs)(x2, y, dy, parameters_and_workspace_for_derivs, error_message)",error_message); class_protect_sprintf(error_message,"%s(L:%d) :%s",__func__,123,FMsg); };; ; return 1; } };
      { if ((*output)(x2, y, dy, next_index_x, parameters_and_workspace_for_derivs, error_message) == 1) { { ErrorMsg FMsg; class_protect_sprintf(FMsg,"error in %s;\n=>%s","(*output)(x2, y, dy, next_index_x, parameters_and_workspace_for_derivs, error_message)",error_message); class_protect_sprintf(error_message,"%s(L:%d) :%s",__func__,131,FMsg); };; ; return 1; } };
      call_output = 0;
      next_index_x++;
    }
    x1 = x2;
  }
  { if ((*derivs)(x1, y, dy, parameters_and_workspace_for_derivs, error_message) == 1) { { ErrorMsg FMsg; class_protect_sprintf(FMsg,"error in %s;\n=>%s","(*derivs)(x1, y, dy, parameters_and_workspace_for_derivs, error_message)",error_message); class_protect_sprintf(error_message,"%s(L:%d) :%s",__func__,153,FMsg); };; ; return 1; } };
  if (print_variables != ((void *)0))
    { if ((*print_variables)(x1, y, dy, parameters_and_workspace_for_derivs, error_message) == 1) { { ErrorMsg FMsg; class_protect_sprintf(FMsg,"error in %s;\n=>%s","(*print_variables)(x1, y, dy, parameters_and_workspace_for_derivs, error_message)",error_message); class_protect_sprintf(error_message,"%s(L:%d) :%s",__func__,162,FMsg); };; ; return 1; } };
  { if (cleanup_generic_integrator(&gi) == 1) { { ErrorMsg FMsg; class_protect_sprintf(FMsg,"error in %s;\n=>%s","cleanup_generic_integrator(&gi)",gi.error_message); class_protect_sprintf(error_message,"%s(L:%d) :%s",__func__,170,FMsg); };; ; return 1; } };
  free(dy);
  return 0;
}

canonical_original_code:
int evolver_rk(int (*derivs)(double x, double *y, double *dy, void *parameters_and_workspace, char error_message[2048]), double x_ini, double x_end, double *y, int *used_in_output, int y_size, void *parameters_and_workspace_for_derivs, double tolerance, double minimum_variation, int (*evaluate_timescale)(double x, void *parameters_and_workspace, double *timescale, char error_message[2048]), double timestep_over_timescale, double *x_sampling, int x_size, int (*output)(double x, double y[], double dy[], int index_x, void *parameters_and_workspace, char error_message[2048]), int (*print_variables)(double x, double y[], double dy[], void *parameters_and_workspace, char error_message[2048]), char error_message[2048]) {
  int next_index_x;
  double x1; double x2 = 0.; double timestep; double timescale;
  struct generic_integrator_workspace gi;
  double *dy;
  short call_output;
  { if (x_ini > x_sampling[x_size-1]) { { char Optional_arguments[2048]; class_protect_sprintf(Optional_arguments,"called with x=%e, last x_sampling=%e",x_ini,x_sampling[x_size-1]); { char FMsg[2048]; class_protect_sprintf(FMsg,"condition (%s) is true; %s","x_ini > x_sampling[x_size-1]",Optional_arguments); class_protect_sprintf(error_message,"%s(L:%d) :%s",__func__,42,FMsg); }; }; return 1; } };
  next_index_x=0;
  while (x_sampling[next_index_x] < x_ini) next_index_x++;
  { if (initialize_generic_integrator(y_size, &gi) == 1) { { char FMsg[2048]; class_protect_sprintf(FMsg,"error in %s;\n=>%s","initialize_generic_integrator(y_size, &gi)",gi.error_message); class_protect_sprintf(error_message,"%s(L:%d) :%s",__func__,50,FMsg); };; ; return 1; } };
  { dy=malloc(y_size*sizeof(double)); if (dy == ((void *)0)) { int size_int; size_int = y_size*sizeof(double); { char FMsg[2048]; class_protect_sprintf(FMsg,"could not allocate %s with size %d","dy",size_int); class_protect_sprintf(error_message,"%s(L:%d) :%s",__func__,54,FMsg); };; return 1; } };
  x1=x_ini;
  call_output = 0;
  while ((x1 < x_end) && (next_index_x<x_size)) {
    { if ((*evaluate_timescale)(x1, parameters_and_workspace_for_derivs, &timescale, error_message) == 1) { { char FMsg[2048]; class_protect_sprintf(FMsg,"error in %s;\n=>%s","(*evaluate_timescale)(x1, parameters_and_workspace_for_derivs, &timescale, error_message)",error_message); class_protect_sprintf(error_message,"%s(L:%d) :%s",__func__,62,FMsg); };; ; return 1; } };
    timestep = timestep_over_timescale * timescale;
    { if (fabs(timestep/x1) < minimum_variation) { { char Optional_arguments[2048]; class_protect_sprintf(Optional_arguments,"integration step =%e < machine precision : leads either to numerical error or infinite loop",fabs(timestep/x1)); { char FMsg[2048]; class_protect_sprintf(FMsg,"condition (%s) is true; %s","fabs(timestep/x1) < minimum_variation",Optional_arguments); class_protect_sprintf(error_message,"%s(L:%d) :%s",__func__,71,FMsg); }; }; return 1; } };
    if (x1 + 2.* timestep < x_sampling[next_index_x]) {
      x2 = x1 + timestep;
    }
    else {
      x2 = x_sampling[next_index_x];
      call_output = 1;
    }
    if (x2 > x_end) {
      x2 = x_end;
      call_output = 0;
    }
    if (print_variables != ((void *)0)) {
      if (x1 == x_ini) {
 { if ((*derivs)(x1, y, dy, parameters_and_workspace_for_derivs, error_message) == 1) { { char FMsg[2048]; class_protect_sprintf(FMsg,"error in %s;\n=>%s","(*derivs)(x1, y, dy, parameters_and_workspace_for_derivs, error_message)",error_message); class_protect_sprintf(error_message,"%s(L:%d) :%s",__func__,92,FMsg); };; ; return 1; } };
      }
      { if ((*print_variables)(x1, y, dy, parameters_and_workspace_for_derivs, error_message) == 1) { { char FMsg[2048]; class_protect_sprintf(FMsg,"error in %s;\n=>%s","(*print_variables)(x1, y, dy, parameters_and_workspace_for_derivs, error_message)",error_message); class_protect_sprintf(error_message,"%s(L:%d) :%s",__func__,101,FMsg); };; ; return 1; } };
    }
    { if (generic_integrator(derivs, x1, x2, y, parameters_and_workspace_for_derivs, tolerance, x1*minimum_variation, &gi) == 1) { { char FMsg[2048]; class_protect_sprintf(FMsg,"error in %s;\n=>%s","generic_integrator(derivs, x1, x2, y, parameters_and_workspace_for_derivs, tolerance, x1*minimum_variation, &gi)",gi.error_message); class_protect_sprintf(error_message,"%s(L:%d) :%s",__func__,110,FMsg); };; ; return 1; } };
    if (call_output == 1) {
      { if ((*derivs)(x2, y, dy, parameters_and_workspace_for_derivs, error_message) == 1) { { char FMsg[2048]; class_protect_sprintf(FMsg,"error in %s;\n=>%s","(*derivs)(x2, y, dy, parameters_and_workspace_for_derivs, error_message)",error_message); class_protect_sprintf(error_message,"%s(L:%d) :%s",__func__,123,FMsg); };; ; return 1; } };
      { if ((*output)(x2, y, dy, next_index_x, parameters_and_workspace_for_derivs, error_message) == 1) { { char FMsg[2048]; class_protect_sprintf(FMsg,"error in %s;\n=>%s","(*output)(x2, y, dy, next_index_x, parameters_and_workspace_for_derivs, error_message)",error_message); class_protect_sprintf(error_message,"%s(L:%d) :%s",__func__,131,FMsg); };; ; return 1; } };
      call_output = 0;
      next_index_x++;
    }
    x1 = x2;
  }
  { if ((*derivs)(x1, y, dy, parameters_and_workspace_for_derivs, error_message) == 1) { { char FMsg[2048]; class_protect_sprintf(FMsg,"error in %s;\n=>%s","(*derivs)(x1, y, dy, parameters_and_workspace_for_derivs, error_message)",error_message); class_protect_sprintf(error_message,"%s(L:%d) :%s",__func__,153,FMsg); };; ; return 1; } };
  if (print_variables != ((void *)0))
    { if ((*print_variables)(x1, y, dy, parameters_and_workspace_for_derivs, error_message) == 1) { { char FMsg[2048]; class_protect_sprintf(FMsg,"error in %s;\n=>%s","(*print_variables)(x1, y, dy, parameters_and_workspace_for_derivs, error_message)",error_message); class_protect_sprintf(error_message,"%s(L:%d) :%s",__func__,162,FMsg); };; ; return 1; } };
  { if (cleanup_generic_integrator(&gi) == 1) { { char FMsg[2048]; class_protect_sprintf(FMsg,"error in %s;\n=>%s","cleanup_generic_integrator(&gi)",gi.error_message); class_protect_sprintf(error_message,"%s(L:%d) :%s",__func__,170,FMsg); };; ; return 1; } };
  free(dy);
  return 0;
}

variable_types: int (*)(double x, double *y, double *dy, void *parameters_and_workspace, char error_message[2048])

variable_types:
y
double *

variable_types: tolerance double

variable_types: int (*)(double x, void *parameters_and_workspace, double *timescale, char error_message[2048])

variable_types: int (*)(double x, double y[], double dy[], int index_x, void *parameters_and_workspace, char error_message[2048])

variable_types: int (*)(double x, double y[], double dy[], void *parameters_and_workspace, char error_message[2048])

variable_types: timestep double

variable_types: timescale double

variable_types: struct generic_integrator_workspace { int n; double *yscal; double *y; double *dydx; double *yerr; double *ytempo; double *ak2; double *ak3; double *ak4; double *ak5; double *ak6; double *ytemp; double stepmin; char error_message[2048]; }

variable_types:
dy
double *

variable_types:
FMsg
char [2048]


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]; }