original_code:
void
pass1 ()
{
  ino_t number;
  ino_t i;
  int cg;
  struct dinode dino;
  struct dinode *dp = &dino;
  mode_t mode, type;
  int ndb;
  int holdallblocks;
  int lbn;
  int nblocks;
  int blkerror;
  int nblkrngerrors;
  int nblkduperrors;
  int
  checkblock (daddr_t bno, int nfrags, off_t offset)
    {
      int outofrange;
      struct dups *dlp, *new;
      int wasbad = 0;
      outofrange = check_range (bno, nfrags);
      if (outofrange)
 {
   blkerror = 1;
   wasbad = 1;
   if (nblkrngerrors == 0)
     warning (0, "I=%Ld HAS BAD BLOCKS", number);
   if (nblkrngerrors++ > 10)
     {
       problem (0, "EXCESSIVE BAD BLKS I=%Ld", number);
       if (preen || reply ("SKIP"))
  {
    pfail ("SKIPPING");
    return RET_STOP;
  }
     }
 }
      for (; nfrags > 0; bno++, nfrags--)
 {
   if (outofrange && check_range (bno, 1))
     warning (0, "BAD BLOCK %lu", bno);
   else
     {
       if (!((blockmap)[(bno)/8] & (1<<((bno)%8))))
  ((blockmap)[(bno)/8] |= 1<<((bno)%8));
       else
  {
    blkerror = 1;
    if (nblkduperrors == 0)
      warning (0, "I=%Ld HAS DUPLICATE BLOCKS", number);
    warning (0, "DUPLICATE BLOCK %ld", bno);
    wasbad = 1;
    if (nblkduperrors++ > 10)
      {
        problem (0, "EXCESSIVE DUP BLKS I=%Ld", number);
        if (preen || reply ("SKIP"))
   {
     pfail ("SKIPPING");
     return RET_STOP;
   }
      }
    new = malloc (sizeof (struct dups));
    new->dup = bno;
    if (muldup == 0)
      {
        duplist = muldup = new;
        new->next = 0;
      }
    else
      {
        new->next = muldup->next;
        muldup->next = new;
      }
    for (dlp = duplist; dlp != muldup; dlp = dlp->next)
      if (dlp->dup == bno)
        break;
    if (dlp == muldup && dlp->dup != bno)
      muldup = new;
  }
     }
   nblocks += sblock->fs_fsize / 512;
 }
      return wasbad ? RET_BAD : RET_GOOD;
    }
  for (cg = 0; cg < sblock->fs_ncg; cg++)
    {
      daddr_t firstdata, firstcgblock, bno;
      firstdata = ((((daddr_t)((sblock)->fs_fpg * (cg))) + (sblock)->fs_cgoffset * ((cg) & ~((sblock)->fs_cgmask))) + (sblock)->fs_dblkno);
      if (cg == 0)
 {
   firstcgblock = ((daddr_t)((sblock)->fs_fpg * (cg)));
   firstdata += (((sblock->fs_cssize)+((sblock->fs_fsize)-1))/(sblock->fs_fsize));
 }
      else
 firstcgblock = ((((daddr_t)((sblock)->fs_fpg * (cg))) + (sblock)->fs_cgoffset * ((cg) & ~((sblock)->fs_cgmask))) + (sblock)->fs_sblkno);
      for (bno = firstcgblock; bno < firstdata; bno++)
 ((blockmap)[(bno)/8] |= 1<<((bno)%8));
    }
  for (number = 0, cg = 0; cg < sblock->fs_ncg; cg++)
    for (i = 0; i < sblock->fs_ipg; i++, number++)
      {
 int dbwarn = 0, ibwarn = 0;
 if (number < ((ino_t)2))
   continue;
 getinode (number, dp);
 mode = (((dp)->di_modeh << 16) | (dp)->di_model);
 type = mode & 0170000;
 if (type == 0)
   {
     if (bcmp (dp->di_db, zino.di_db, 12 * sizeof (daddr_t))
  || bcmp (dp->di_ib, zino.di_ib, 3 * sizeof (daddr_t))
  || dp->di_trans
  || (((dp)->di_modeh << 16) | (dp)->di_model)
  || dp->di_size)
       {
  problem (0, "PARTIALLY ALLOCATED INODE I=%Ld", number);
  if (preen || reply ("CLEAR"))
    {
      clear_inode (number, dp);
      pfix ("CLEARED");
    }
       }
     inodestate[number] = 0;
   }
 else
   {
     holdallblocks = 0;
     if (dp->di_size + sblock->fs_bsize - 1 < dp->di_size)
       {
  problem (1, "OVERFLOW IN FILE SIZE I=%Ld (SIZE == %lld)", number,
   dp->di_size);
  if (reply ("CLEAR"))
    {
      clear_inode (number, dp);
      inodestate[number] = 0;
      continue;
    }
  inodestate[number] = 0;
  warning (0, "WILL TREAT ANY BLOCKS HELD BY I=%Ld AS ALLOCATED",
   number);
  holdallblocks = 1;
       }
     inodestate[number] = 1;
     switch (type)
       {
       case 0060000:
       case 0020000:
  ndb = 1;
  break;
       case 0010000:
       case 0140000:
  ndb = 0;
  break;
       case 0120000:
  if (sblock->fs_maxsymlinklen != -1)
    {
      if ((sblock->fs_maxsymlinklen
    && dp->di_size < sblock->fs_maxsymlinklen)
   || (!sblock->fs_maxsymlinklen && !dp->di_blocks))
        {
   ndb = (((dp->di_size)+((sizeof (daddr_t))-1))/(sizeof (daddr_t)));
   if (ndb > 12)
     {
       int j = ndb - 12;
       for (ndb = 1; j > 1; i--)
         ndb *= ((sblock)->fs_nindir);
       ndb += 12;
     }
        }
      else
        ndb = (((dp->di_size)+((sblock->fs_bsize)-1))/(sblock->fs_bsize));
    }
  else
    ndb = (((dp->di_size)+((sblock->fs_bsize)-1))/(sblock->fs_bsize));
  break;
       case 0040000:
  inodestate[number] = 2;
       case 0100000:
  ndb = (((dp->di_size)+((sblock->fs_bsize)-1))/(sblock->fs_bsize));
  break;
       default:
  problem (1, "UNKNOWN FILE TYPE I=%Ld (MODE=%ol)", number, mode);
  if (reply ("CLEAR"))
    {
      clear_inode (number, dp);
      inodestate[number] = 0;
      continue;
    }
  inodestate[number] = 0;
  holdallblocks = 1;
  warning (0, "WILL TREAT ANY BLOCKS HELD BY I=%Ld "
   "AS ALLOCATED", number);
  ndb = 0;
       }
     if (ndb < 0)
       {
  problem (1, "BAD FILE SIZE I= %Ld (SIZE == %lld)", number,
   dp->di_size);
  if (reply ("CLEAR"))
    {
      clear_inode (number, dp);
      inodestate[number] = 0;
      continue;
    }
  inodestate[number] = 0;
  warning (0, "WILL TREAT ANY BLOCKS HELD BY I=%Ld AS ALLOCATED",
    number);
  holdallblocks = 1;
       }
     if (!holdallblocks)
       {
  if (dp->di_size
      && (type == 0060000 || type == 0020000
   || type == 0140000 || type == 0010000))
    {
      problem (1, "SPECIAL NODE I=%Ld (MODE=%ol) HAS SIZE %lld",
       number, mode, dp->di_size);
      if (reply ("TRUNCATE"))
        {
   dp->di_size = 0;
   write_inode (number, dp);
        }
    }
  for (lbn = ndb; lbn < 12; lbn++)
    {
      if (dp->di_db[lbn])
        {
   if (!dbwarn)
     {
       dbwarn = 1;
       problem (0, "INODE I=%Ld HAS EXTRA DIRECT BLOCKS",
       number);
       if (preen || reply ("DEALLOCATE"))
         {
    dp->di_db[lbn] = 0;
    dbwarn = 2;
    pfix ("DEALLOCATED");
         }
     }
   else if (dbwarn == 2)
     dp->di_db[lbn] = 0;
        }
      if (dbwarn == 2)
        write_inode (number, dp);
    }
  for (lbn = 0, ndb -= 12; ndb > 0; lbn++)
    ndb /= ((sblock)->fs_nindir);
  for (; lbn < 3; lbn++)
    {
      if (dp->di_ib[lbn])
        {
   if (ibwarn)
     {
       ibwarn = 1;
       problem (0, "INODE I=%Ld HAS EXTRA INDIRECT BLOCKS",
       number);
       if (preen || reply ("DEALLOCATE"))
         {
    dp->di_ib[lbn] = 0;
    ibwarn = 2;
    pfix ("DEALLOCATED");
         }
     }
   else if (ibwarn == 2)
     dp->di_ib[lbn] = 0;
        }
      if (ibwarn == 2)
        write_inode (number, dp);
    }
       }
     if (inodestate[number] != 0)
       {
  linkcount[number] = dp->di_nlink;
  typemap[number] = (((mode) & 0170000) >> 12);
       }
     nblocks = 0;
     blkerror = 0;
     nblkduperrors = 0;
     nblkrngerrors = 0;
     allblock_iterate (dp, checkblock);
     if (blkerror)
       {
  if (preen)
    warning (1, "DUPLICATE or BAD BLOCKS");
  else
    {
      problem (0, "I=%Ld has ", number);
      if (nblkduperrors)
        {
   pextend ("%d DUPLICATE BLOCKS", nblkduperrors);
   if (nblkrngerrors)
     pextend (" and ");
        }
      if (nblkrngerrors)
        pextend ("%d BAD BLOCKS", nblkrngerrors);
      if (reply ("CLEAR"))
        {
   clear_inode (number, dp);
   inodestate[number] = 0;
   continue;
        }
      else if (inodestate[number] == 2)
        inodestate[number] = 3;
    }
       }
     else if (dp->di_blocks != nblocks)
       {
  problem (0, "INCORRECT BLOCK COUNT I=%Ld (%ld should be %d)",
    number, dp->di_blocks, nblocks);
  if (preen || reply ("CORRECT"))
    {
      dp->di_blocks = nblocks;
      write_inode (number, dp);
      pfix ("CORRECTED");
    }
       }
     num_files++;
     if (type == 0040000)
       record_directory (dp, number);
   }
      }
}

canonical_original_code:
void pass1()
{
  unsigned long number;
  unsigned long i;
  int cg;
  struct dinode dino;
  struct dinode *dp = &dino;
  unsigned int mode; unsigned int type;
  int ndb;
  int holdallblocks;
  int lbn;
  int nblocks;
  int blkerror;
  int nblkrngerrors;
  int nblkduperrors;
  int
  checkblock (daddr_t bno, int nfrags, off_t offset)
    {
      int outofrange;
      struct dups *dlp; struct dups *new;
      int wasbad = 0;
      outofrange = check_range (bno, nfrags);
      if (outofrange)
 {
   blkerror = 1;
   wasbad = 1;
   if (nblkrngerrors == 0)
     warning (0, "I=%Ld HAS BAD BLOCKS", number);
   if (nblkrngerrors++ > 10)
     {
       problem (0, "EXCESSIVE BAD BLKS I=%Ld", number);
       if (preen || reply ("SKIP"))
  {
    pfail ("SKIPPING");
    return RET_STOP;
  }
     }
 }
      for (; nfrags > 0; bno++, nfrags--)
 {
   if (outofrange && check_range (bno, 1))
     warning (0, "BAD BLOCK %lu", bno);
   else
     {
       if (!((blockmap)[(bno)/8] & (1<<((bno)%8))))
  ((blockmap)[(bno)/8] |= 1<<((bno)%8));
       else
  {
    blkerror = 1;
    if (nblkduperrors == 0)
      warning (0, "I=%Ld HAS DUPLICATE BLOCKS", number);
    warning (0, "DUPLICATE BLOCK %ld", bno);
    wasbad = 1;
    if (nblkduperrors++ > 10)
      {
        problem (0, "EXCESSIVE DUP BLKS I=%Ld", number);
        if (preen || reply ("SKIP"))
   {
     pfail ("SKIPPING");
     return RET_STOP;
   }
      }
    new = malloc (sizeof (struct dups));
    new->dup = bno;
    if (muldup == 0)
      {
        duplist = muldup = new;
        new->next = 0;
      }
    else
      {
        new->next = muldup->next;
        muldup->next = new;
      }
    for (dlp = duplist; dlp != muldup; dlp = dlp->next)
      if (dlp->dup == bno)
        break;
    if (dlp == muldup && dlp->dup != bno)
      muldup = new;
  }
     }
   nblocks += sblock->fs_fsize / 512;
 }
      return wasbad ? RET_BAD : RET_GOOD;
    }
  for (cg = 0; cg < sblock->fs_ncg; cg++)
    {
      int firstdata; int firstcgblock; int bno;
      firstdata = ((((daddr_t)((sblock)->fs_fpg * (cg))) + (sblock)->fs_cgoffset * ((cg) & ~((sblock)->fs_cgmask))) + (sblock)->fs_dblkno);
      if (cg == 0)
 {
   firstcgblock = ((daddr_t)((sblock)->fs_fpg * (cg)));
   firstdata += (((sblock->fs_cssize)+((sblock->fs_fsize)-1))/(sblock->fs_fsize));
 }
      else
 firstcgblock = ((((daddr_t)((sblock)->fs_fpg * (cg))) + (sblock)->fs_cgoffset * ((cg) & ~((sblock)->fs_cgmask))) + (sblock)->fs_sblkno);
      for (bno = firstcgblock; bno < firstdata; bno++)
 ((blockmap)[(bno)/8] |= 1<<((bno)%8));
    }
  for (number = 0, cg = 0; cg < sblock->fs_ncg; cg++)
    for (i = 0; i < sblock->fs_ipg; i++, number++)
      {
 int dbwarn = 0; int ibwarn = 0;
 if (number < ((unsigned long)2))
   continue;
 getinode (number, dp);
 mode = (((dp)->di_modeh << 16) | (dp)->di_model);
 type = mode & 0170000;
 if (type == 0)
   {
     if (bcmp (dp->di_db, zino.di_db, 12 * sizeof (daddr_t))
  || bcmp (dp->di_ib, zino.di_ib, 3 * sizeof (daddr_t))
  || dp->di_trans
  || (((dp)->di_modeh << 16) | (dp)->di_model)
  || dp->di_size)
       {
  problem (0, "PARTIALLY ALLOCATED INODE I=%Ld", number);
  if (preen || reply ("CLEAR"))
    {
      clear_inode (number, dp);
      pfix ("CLEARED");
    }
       }
     inodestate[number] = 0;
   }
 else
   {
     holdallblocks = 0;
     if (dp->di_size + sblock->fs_bsize - 1 < dp->di_size)
       {
  problem (1, "OVERFLOW IN FILE SIZE I=%Ld (SIZE == %lld)", number,
   dp->di_size);
  if (reply ("CLEAR"))
    {
      clear_inode (number, dp);
      inodestate[number] = 0;
      continue;
    }
  inodestate[number] = 0;
  warning (0, "WILL TREAT ANY BLOCKS HELD BY I=%Ld AS ALLOCATED",
   number);
  holdallblocks = 1;
       }
     inodestate[number] = 1;
     switch (type)
       {
       case 0060000:
       case 0020000:
  ndb = 1;
  break;
       case 0010000:
       case 0140000:
  ndb = 0;
  break;
       case 0120000:
  if (sblock->fs_maxsymlinklen != -1)
    {
      if ((sblock->fs_maxsymlinklen
    && dp->di_size < sblock->fs_maxsymlinklen)
   || (!sblock->fs_maxsymlinklen && !dp->di_blocks))
        {
   ndb = (((dp->di_size)+((sizeof (daddr_t))-1))/(sizeof (daddr_t)));
   if (ndb > 12)
     {
       int j = ndb - 12;
       for (ndb = 1; j > 1; i--)
         ndb *= ((sblock)->fs_nindir);
       ndb += 12;
     }
        }
      else
        ndb = (((dp->di_size)+((sblock->fs_bsize)-1))/(sblock->fs_bsize));
    }
  else
    ndb = (((dp->di_size)+((sblock->fs_bsize)-1))/(sblock->fs_bsize));
  break;
       case 0040000:
  inodestate[number] = 2;
       case 0100000:
  ndb = (((dp->di_size)+((sblock->fs_bsize)-1))/(sblock->fs_bsize));
  break;
       default:
  problem (1, "UNKNOWN FILE TYPE I=%Ld (MODE=%ol)", number, mode);
  if (reply ("CLEAR"))
    {
      clear_inode (number, dp);
      inodestate[number] = 0;
      continue;
    }
  inodestate[number] = 0;
  holdallblocks = 1;
  warning (0, "WILL TREAT ANY BLOCKS HELD BY I=%Ld "
   "AS ALLOCATED", number);
  ndb = 0;
       }
     if (ndb < 0)
       {
  problem (1, "BAD FILE SIZE I= %Ld (SIZE == %lld)", number,
   dp->di_size);
  if (reply ("CLEAR"))
    {
      clear_inode (number, dp);
      inodestate[number] = 0;
      continue;
    }
  inodestate[number] = 0;
  warning (0, "WILL TREAT ANY BLOCKS HELD BY I=%Ld AS ALLOCATED",
    number);
  holdallblocks = 1;
       }
     if (!holdallblocks)
       {
  if (dp->di_size
      && (type == 0060000 || type == 0020000
   || type == 0140000 || type == 0010000))
    {
      problem (1, "SPECIAL NODE I=%Ld (MODE=%ol) HAS SIZE %lld",
       number, mode, dp->di_size);
      if (reply ("TRUNCATE"))
        {
   dp->di_size = 0;
   write_inode (number, dp);
        }
    }
  for (lbn = ndb; lbn < 12; lbn++)
    {
      if (dp->di_db[lbn])
        {
   if (!dbwarn)
     {
       dbwarn = 1;
       problem (0, "INODE I=%Ld HAS EXTRA DIRECT BLOCKS",
       number);
       if (preen || reply ("DEALLOCATE"))
         {
    dp->di_db[lbn] = 0;
    dbwarn = 2;
    pfix ("DEALLOCATED");
         }
     }
   else if (dbwarn == 2)
     dp->di_db[lbn] = 0;
        }
      if (dbwarn == 2)
        write_inode (number, dp);
    }
  for (lbn = 0, ndb -= 12; ndb > 0; lbn++)
    ndb /= ((sblock)->fs_nindir);
  for (; lbn < 3; lbn++)
    {
      if (dp->di_ib[lbn])
        {
   if (ibwarn)
     {
       ibwarn = 1;
       problem (0, "INODE I=%Ld HAS EXTRA INDIRECT BLOCKS",
       number);
       if (preen || reply ("DEALLOCATE"))
         {
    dp->di_ib[lbn] = 0;
    ibwarn = 2;
    pfix ("DEALLOCATED");
         }
     }
   else if (ibwarn == 2)
     dp->di_ib[lbn] = 0;
        }
      if (ibwarn == 2)
        write_inode (number, dp);
    }
       }
     if (inodestate[number] != 0)
       {
  linkcount[number] = dp->di_nlink;
  typemap[number] = (((mode) & 0170000) >> 12);
       }
     nblocks = 0;
     blkerror = 0;
     nblkduperrors = 0;
     nblkrngerrors = 0;
     allblock_iterate (dp, checkblock);
     if (blkerror)
       {
  if (preen)
    warning (1, "DUPLICATE or BAD BLOCKS");
  else
    {
      problem (0, "I=%Ld has ", number);
      if (nblkduperrors)
        {
   pextend ("%d DUPLICATE BLOCKS", nblkduperrors);
   if (nblkrngerrors)
     pextend (" and ");
        }
      if (nblkrngerrors)
        pextend ("%d BAD BLOCKS", nblkrngerrors);
      if (reply ("CLEAR"))
        {
   clear_inode (number, dp);
   inodestate[number] = 0;
   continue;
        }
      else if (inodestate[number] == 2)
        inodestate[number] = 3;
    }
       }
     else if (dp->di_blocks != nblocks)
       {
  problem (0, "INCORRECT BLOCK COUNT I=%Ld (%ld should be %d)",
    number, dp->di_blocks, nblocks);
  if (preen || reply ("CORRECT"))
    {
      dp->di_blocks = nblocks;
      write_inode (number, dp);
      pfix ("CORRECTED");
    }
       }
     num_files++;
     if (type == 0040000)
       record_directory (dp, number);
   }
      }
}

variable_types:
number
unsigned long

variable_types:
i
unsigned long

variable_types: cg int

variable_types: struct dinode { unsigned short di_model; short di_nlink; union { unsigned long diu_author; unsigned short diu_oldids[2]; } di_u; unsigned long di_size; struct timespec { long tv_sec; long tv_nsec; } di_atime; struct timespec di_mtime; struct timespec di_ctime; int di_db[12]; int di_ib[3]; unsigned long di_flags; long di_blocks; long di_gen; unsigned long di_uid; unsigned long di_gid; unsigned short di_modeh; unsigned short di_spare; long di_trans; } *

variable_types:
mode
unsigned int

variable_types:
type
unsigned int

variable_types: ndb int

variable_types: holdallblocks int

variable_types: lbn int

variable_types: nblocks int

variable_types: blkerror int

variable_types: nblkrngerrors int

variable_types: nblkduperrors int

variable_types: outofrange int

variable_types: struct dups { struct dups *next; int dup; } *

variable_types: wasbad int

variable_types: firstdata int

variable_types: firstcgblock int

variable_types: bno int

variable_types: dbwarn int

variable_types: ibwarn int

variable_types: j int


repo: jeremie-koenig/hurd

decompiled_code:
__int64 __fastcall pass1b(__int64 a1, __int64 a2, __int64 a3, __int64 a4, __int64 a5, __int64 a6, int a7)
{
__int64 v7; // r12
unsigned __int64 v8; // rbx
__int64 result; // rax
__int64 i; // rbp
__int64 v11; // [rsp+0h] [rbp-108h] BYREF
int v12; // [rsp+8h] [rbp-100h]
__int16 v13; // [rsp+Ch] [rbp-FCh] BYREF
int v14; // [rsp+Eh] [rbp-FAh]
__int16 v15; // [rsp+12h] [rbp-F6h]
__int64 *v16; // [rsp+14h] [rbp-F4h]
int v17; // [rsp+1Ch] [rbp-ECh]
int *v18; // [rsp+28h] [rbp-E0h]
char v19[216]; // [rsp+30h] [rbp-D8h] BYREF

v18 = &a7;
v13 = -17599;
v14 = (int)checkblock_0;
v15 = -17847;
v16 = &v11;
v17 = -1864106167;
v11 = duplist;
v7 = 0LL;
v8 = 0LL;
for ( result = sblock; *(_QWORD *)(sblock + 72LL) > v7; result = sblock )
{
for ( i = 0LL; *(_QWORD *)(sblock + 352LL) > i; ++i )
{
if ( v8 > 1 )
{
if ( *(_BYTE *)(inodestate + v8) )
{
getinode(v8, v19);
v12 = 0;
allblock_iterate(v19, &v13);
if ( v12 )
{
problem(1LL, "I=%Ld HAS %d DUPLICATE BLOCKS", v8);
if ( (unsigned int)reply("CLEAR") )
{
clear_inode(v8, v19);
*(_BYTE *)(inodestate + v8) = 0;
}
else if ( *(_BYTE *)(inodestate + v8) == 2 )
{
*(_BYTE *)(inodestate + v8) = 3;
}
}
}
}
++v8;
}
++v7;
}
return result;
}

canonical_decompiled_code:
__int64 __fastcall func1(__int64 a1, __int64 a2, __int64 a3, __int64 a4, __int64 a5, __int64 a6, int a7)
{
__int64 v7; // r12
unsigned __int64 v8; // rbx
__int64 result; // rax
__int64 i; // rbp
__int64 v11; // [rsp+0h] [rbp-108h] BYREF
int v12; // [rsp+8h] [rbp-100h]
__int16 v13; // [rsp+Ch] [rbp-FCh] BYREF
int v14; // [rsp+Eh] [rbp-FAh]
__int16 v15; // [rsp+12h] [rbp-F6h]
__int64 *v16; // [rsp+14h] [rbp-F4h]
int v17; // [rsp+1Ch] [rbp-ECh]
int *v18; // [rsp+28h] [rbp-E0h]
char v19[216]; // [rsp+30h] [rbp-D8h] BYREF

v18 = &a7;
v13 = -17599;
v14 = (int)checkblock_0;
v15 = -17847;
v16 = &v11;
v17 = -1864106167;
v11 = duplist;
v7 = 0LL;
v8 = 0LL;
for ( result = sblock; *(_QWORD *)(sblock + 72LL) > v7; result = sblock )
{
for ( i = 0LL; *(_QWORD *)(sblock + 352LL) > i; ++i )
{
if ( v8 > 1 )
{
if ( *(_BYTE *)(inodestate + v8) )
{
getinode(v8, v19);
v12 = 0;
allblock_iterate(v19, &v13);
if ( v12 )
{
problem(1LL, "I=%Ld HAS %d DUPLICATE BLOCKS", v8);
if ( (unsigned int)reply("CLEAR") )
{
clear_inode(v8, v19);
*(_BYTE *)(inodestate + v8) = 0;
}
else if ( *(_BYTE *)(inodestate + v8) == 2 )
{
*(_BYTE *)(inodestate + v8) = 3;
}
}
}
}
++v8;
}
++v7;
}
return result;
}

original_code:
void
pass1b ()
{
  struct dinode dino;
  struct dinode *dp = &dino;
  int cg, i;
  ino_t number = 0;
  int dupblk;
  struct dups *duphead = duplist;
  int
  checkblock (daddr_t bno, int nfrags, off_t offset)
    {
      struct dups *dlp;
      int hadbad = 0;
      for (; nfrags > 0; bno++, nfrags--)
 {
   if (check_range (bno, 1))
     return RET_BAD;
   for (dlp = duphead; dlp; dlp = dlp->next)
     {
       if (dlp->dup == bno)
  {
    dupblk++;
    warning (0, "DUPLICATE BLOCK %ld\n", bno);
    dlp->dup = duphead->dup;
    duphead->dup = bno;
    duphead = duphead->next;
    hadbad = 1;
  }
       if (dlp == muldup)
  break;
     }
 }
      return hadbad ? RET_BAD : RET_GOOD;
    }
  for (cg = 0; cg < sblock->fs_ncg; cg++)
    for (i = 0; i < sblock->fs_ipg; i++, number++)
      {
 if (number < ((ino_t)2))
   continue;
 if (inodestate[number] != 0)
   {
     getinode (number, dp);
     dupblk = 0;
     allblock_iterate (dp, checkblock);
     if (dupblk)
       {
  problem (1, "I=%Ld HAS %d DUPLICATE BLOCKS", number, dupblk);
  if (reply ("CLEAR"))
    {
      clear_inode (number, dp);
      inodestate[number] = 0;
    }
  else if (inodestate[number] == 2)
    inodestate[number] = 3;
       }
   }
      }
}

canonical_original_code:
void pass1b()
{
  struct dinode dino;
  struct dinode *dp = &dino;
  int cg; int i;
  unsigned long number = 0;
  int dupblk;
  struct dups *duphead = duplist;
  int
  checkblock (daddr_t bno, int nfrags, off_t offset)
    {
      struct dups *dlp;
      int hadbad = 0;
      for (; nfrags > 0; bno++, nfrags--)
 {
   if (check_range (bno, 1))
     return RET_BAD;
   for (dlp = duphead; dlp; dlp = dlp->next)
     {
       if (dlp->dup == bno)
  {
    dupblk++;
    warning (0, "DUPLICATE BLOCK %ld\n", bno);
    dlp->dup = duphead->dup;
    duphead->dup = bno;
    duphead = duphead->next;
    hadbad = 1;
  }
       if (dlp == muldup)
  break;
     }
 }
      return hadbad ? RET_BAD : RET_GOOD;
    }
  for (cg = 0; cg < sblock->fs_ncg; cg++)
    for (i = 0; i < sblock->fs_ipg; i++, number++)
      {
 if (number < ((unsigned long)2))
   continue;
 if (inodestate[number] != 0)
   {
     getinode (number, dp);
     dupblk = 0;
     allblock_iterate (dp, checkblock);
     if (dupblk)
       {
  problem (1, "I=%Ld HAS %d DUPLICATE BLOCKS", number, dupblk);
  if (reply ("CLEAR"))
    {
      clear_inode (number, dp);
      inodestate[number] = 0;
    }
  else if (inodestate[number] == 2)
    inodestate[number] = 3;
       }
   }
      }
}

variable_types: struct dinode { unsigned short di_model; short di_nlink; union { unsigned long diu_author; unsigned short diu_oldids[2]; } di_u; unsigned long di_size; struct timespec { long tv_sec; long tv_nsec; } di_atime; struct timespec di_mtime; struct timespec di_ctime; int di_db[12]; int di_ib[3]; unsigned long di_flags; long di_blocks; long di_gen; unsigned long di_uid; unsigned long di_gid; unsigned short di_modeh; unsigned short di_spare; long di_trans; } *

variable_types: cg int

variable_types: i int

variable_types:
number
unsigned long

variable_types: dupblk int

variable_types: hadbad int

return_type: void

user_defined_types: struct dinode { unsigned short di_model; short di_nlink; union { unsigned long diu_author; unsigned short diu_oldids[2]; } di_u; unsigned long di_size; struct timespec di_atime; struct timespec di_mtime; struct timespec di_ctime; int di_db[12]; int di_ib[3]; unsigned long di_flags; long di_blocks; long di_gen; unsigned long di_uid; unsigned long di_gid; unsigned short di_modeh; unsigned short di_spare; long di_trans; }

user_defined_types: struct dups { struct dups *next; int dup; }


variable_types:
i
unsigned long

variable_types: struct dinode { unsigned short di_model; short di_nlink; union { unsigned long diu_author; unsigned short diu_oldids[2]; } di_u; unsigned long di_size; struct timespec { long tv_sec; long tv_nsec; } di_atime; struct timespec di_mtime; struct timespec di_ctime; int di_db[12]; int di_ib[3]; unsigned long di_flags; long di_blocks; long di_gen; unsigned long di_uid; unsigned long di_gid; unsigned short di_modeh; unsigned short di_spare; long di_trans; }

variable_types:
mode
unsigned int

variable_types:
type
unsigned int

variable_types: ndb int

variable_types: holdallblocks int

variable_types: lbn int

variable_types: nblocks int

variable_types: blkerror int

variable_types: nblkrngerrors int


sqrtf

repo: jeremybarnes/cephes

variable_types: xx float

variable_types: f float

variable_types: x float

variable_types: y float

variable_types: e int

return_type: float


chdtrcf

decompiled_code:
double __fastcall chdtrcf(float a1, float a2)
{
double result; // xmm0_8

if ( a2 < 0.0 || a1 < 1.0 )
{
mtherr("chdtrcf", 1LL);
result = 0.0;
}
else
{
*(float *)&result = a1 * 0.5;
igamcf(*(float *)&result, a2 * 0.5);
}
return result;
}

canonical_decompiled_code:
double __fastcall func0(float a1, float a2)
{
double result; // xmm0_8

if ( a2 < 0.0 || a1 < 1.0 )
{
mtherr("chdtrcf", 1LL);
result = 0.0;
}
else
{
*(float *)&result = a1 * 0.5;
igamcf(*(float *)&result, a2 * 0.5);
}
return result;
}

original_code:
float chdtrcf(float dff, float xx)
{
float df, x;
df = dff;
x = xx;
if( (x < 0.0) || (df < 1.0) )
 {
 mtherr( "chdtrcf", 1 );
 return(0.0);
 }
return( igamcf( 0.5*df, 0.5*x ) );
}

canonical_original_code:
float chdtrcf(float dff, float xx)
{
float df; float x;
df = dff;
x = xx;
if( (x < 0.0) || (df < 1.0) )
 {
 mtherr( "chdtrcf", 1 );
 return(0.0);
 }
return( igamcf( 0.5*df, 0.5*x ) );
}

variable_types: dff float

variable_types: df float


chdtrf

decompiled_code:
double __fastcall chdtrf(float a1, float a2)
{
double result; // xmm0_8

if ( a2 < 0.0 || a1 < 1.0 )
{
mtherr("chdtrf", 1LL);
result = 0.0;
}
else
{
*(float *)&result = a1 * 0.5;
igamf(*(float *)&result, a2 * 0.5);
}
return result;
}

canonical_decompiled_code:
double __fastcall func1(float a1, float a2)
{
double result; // xmm0_8

if ( a2 < 0.0 || a1 < 1.0 )
{
mtherr("chdtrf", 1LL);
result = 0.0;
}
else
{
*(float *)&result = a1 * 0.5;
igamf(*(float *)&result, a2 * 0.5);
}
return result;
}

original_code:
float chdtrf(float dff, float xx)
{
float df, x;
df = dff;
x = xx;
if( (x < 0.0) || (df < 1.0) )
 {
 mtherr( "chdtrf", 1 );
 return(0.0);
 }
return( igamf( 0.5*df, 0.5*x ) );
}

canonical_original_code:
float chdtrf(float dff, float xx)
{
float df; float x;
df = dff;
x = xx;
if( (x < 0.0) || (df < 1.0) )
 {
 mtherr( "chdtrf", 1 );
 return(0.0);
 }
return( igamf( 0.5*df, 0.5*x ) );
}


chdtrif

decompiled_code:
double __fastcall chdtrif(float a1, float a2)
{
float v2; // xmm0_4
double result; // xmm0_8

if ( a2 < 0.0 || a2 > 1.0 || a1 < 1.0 )
{
mtherr("chdtrif", 1LL);
result = 0.0;
}
else
{
v2 = igamif(a1 * 0.5);
*(float *)&result = v2 + v2;
}
return result;
}

canonical_decompiled_code:
double __fastcall func2(float a1, float a2)
{
float v2; // xmm0_4
double result; // xmm0_8

if ( a2 < 0.0 || a2 > 1.0 || a1 < 1.0 )
{
mtherr("chdtrif", 1LL);
result = 0.0;
}
else
{
v2 = igamif(a1 * 0.5);
*(float *)&result = v2 + v2;
}
return result;
}

original_code:
float chdtrif( float dff, float yy )
{
float y, df, x;
y = yy;
df = dff;
if( (y < 0.0) || (y > 1.0) || (df < 1.0) )
 {
 mtherr( "chdtrif", 1 );
 return(0.0);
 }
x = igamif( 0.5 * df, y );
return( 2.0 * x );
}

canonical_original_code:
float chdtrif(float dff, float yy)
{
float y; float df; float x;
y = yy;
df = dff;
if( (y < 0.0) || (y > 1.0) || (df < 1.0) )
 {
 mtherr( "chdtrif", 1 );
 return(0.0);
 }
x = igamif( 0.5 * df, y );
return( 2.0 * x );
}

variable_types: yy float


dprec

decompiled_code:
__int64 dprec()
{
return 0LL;
}

canonical_decompiled_code:
__int64 func1()
{
return 0LL;
}

original_code: int dprec() {return 0;}

canonical_original_code: int dprec() {return 0;}

return_type: int


ldprec

decompiled_code:
__int64 ldprec()
{
return 0LL;
}

canonical_decompiled_code:
__int64 func2()
{
return 0LL;
}

original_code: int ldprec() {return 0;}

canonical_original_code: int ldprec() {return 0;}


sprec

decompiled_code:
__int64 sprec()
{
return 0LL;
}

canonical_decompiled_code:
__int64 func3()
{
return 0LL;
}

original_code: int sprec() {return 0;}

canonical_original_code: int sprec() {return 0;}


polinif

decompiled_code:
void *__fastcall polinif(int a1)
{
void *result; // rax

MAXPOLF = a1;
LODWORD(psize) = 4 * a1 + 4;
if ( pt3 )
free(pt3);
if ( pt2 )
free(pt2);
if ( pt1 )
free(pt1);
pt1 = malloc((unsigned int)psize);
pt2 = malloc((unsigned int)psize);
result = malloc((unsigned int)psize);
pt3 = result;
if ( !pt1 || !pt2 || !result )
{
mtherr("polinif", 34LL);
exit(1);
}
return result;
}

canonical_decompiled_code:
void *__fastcall func0(int a1)
{
void *result; // rax

MAXPOLF = a1;
LODWORD(psize) = 4 * a1 + 4;
if ( pt3 )
free(pt3);
if ( pt2 )
free(pt2);
if ( pt1 )
free(pt1);
pt1 = malloc((unsigned int)psize);
pt2 = malloc((unsigned int)psize);
result = malloc((unsigned int)psize);
pt3 = result;
if ( !pt1 || !pt2 || !result )
{
mtherr("polinif", 34LL);
exit(1);
}
return result;
}

original_code:
void polinif( int maxdeg )
{
MAXPOLF = maxdeg;
psize = (maxdeg + 1) * sizeof(float);
if( pt3 )
 free(pt3);
if( pt2 )
 free(pt2);
if( pt1 )
 free(pt1);
pt1 = (float * )malloc(psize);
pt2 = (float * )malloc(psize);
pt3 = (float * )malloc(psize);
if( (pt1 == 0) || (pt2 == 0) || (pt3 == 0) )
 {
 mtherr( "polinif", 34 );
 exit(1);
 }
}

canonical_original_code:
void polinif(int maxdeg)
{
MAXPOLF = maxdeg;
psize = (maxdeg + 1) * sizeof(float);
if( pt3 )
 free(pt3);
if( pt2 )
 free(pt2);
if( pt1 )
 free(pt1);
pt1 = (float * )malloc(psize);
pt2 = (float * )malloc(psize);
pt3 = (float * )malloc(psize);
if( (pt1 == 0) || (pt2 == 0) || (pt3 == 0) )
 {
 mtherr( "polinif", 34 );
 exit(1);
 }
}

variable_types: maxdeg int


polprtf

decompiled_code:
// write access to const memory has been detected, the output may be wrong!
int __fastcall polprtf(__int64 a1, int a2, int a3)
{
int v4; // ebx
bool v5; // cc
char *v6; // rbx
char *v7; // rax
int v8; // er12
__int64 v9; // rbx
int v10; // ebp

LC1 = 37;
v4 = a3 + 8;
sprintf("bcdefghijk", "%d ", (unsigned int)(a3 + 8));
v5 = v4 < 10;
v6 = (char *)"cdefghijk";
if ( !v5 )
v6 = (char *)"defghijk";
*v6 = 46;
sprintf(v6 + 1, "%d ", (unsigned int)a3);
v7 = &v6[(a3 > 9) + 2];
*v7 = 101;
v7[1] = 32;
v7[2] = 0;
v8 = a3 + 9;
if ( a2 >= 0 )
{
v9 = 0LL;
v10 = 0;
do
{
v10 += v8;
if ( v10 > 77 )
{
printf("\n");
v10 = v8;
}
printf(&LC1, *(float *)(a1 + 4 * v9++));
}
while ( a2 >= (int)v9 );
}
return printf("\n");
}

variable_types:
a
float *

variable_types: d int

variable_types: i int

variable_types: j int

variable_types:
p
char *


polmulf

original_code:
void polmulf( float a[], int na, float b[], int nb, float c[] )
{
int i, j, k, nc;
float x;
nc = na + nb;
polclrf( pt3, MAXPOLF );
for( i=0; i<=na; i++ )
 {
 x = a[i];
 for( j=0; j<=nb; j++ )
  {
  k = i + j;
  if( k > MAXPOLF )
   break;
  pt3[k] += x * b[j];
  }
 }
if( nc > MAXPOLF )
 nc = MAXPOLF;
for( i=0; i<=nc; i++ )
 c[i] = pt3[i];
}

canonical_original_code:
void polmulf(float a[], int na, float b[], int nb, float c[])
{
int i; int j; int k; int nc;
float x;
nc = na + nb;
polclrf( pt3, MAXPOLF );
for( i=0; i<=na; i++ )
 {
 x = a[i];
 for( j=0; j<=nb; j++ )
  {
  k = i + j;
  if( k > MAXPOLF )
   break;
  pt3[k] += x * b[j];
  }
 }
if( nc > MAXPOLF )
 nc = MAXPOLF;
for( i=0; i<=nc; i++ )
 c[i] = pt3[i];
}

variable_types:
a
float []

variable_types:
b
float []

variable_types: nb int

variable_types:
c
float []

variable_types: k int

variable_types: nc int


poladdf

decompiled_code:
__int64 __fastcall poladdf(__int64 a1, int a2, __int64 a3, int a4, __int64 a5)
{
__int64 result; // rax
__int64 v7; // rdi
float v8; // xmm0_4

result = (unsigned int)a4;
if ( a2 >= a4 )
result = (unsigned int)a2;
if ( MAXPOLF <= (int)result )
result = (unsigned int)MAXPOLF;
if ( (int)result >= 0 )
{
v7 = (unsigned int)(result + 1);
result = 0LL;
do
{
if ( a2 >= (int)result )
{
if ( a4 >= (int)result )
v8 = *(float *)(a3 + 4 * result) + *(float *)(a1 + 4 * result);
else
v8 = *(float *)(a1 + 4 * result);
*(float *)(a5 + 4 * result) = v8;
}
else
{
*(_DWORD *)(a5 + 4 * result) = *(_DWORD *)(a3 + 4 * result);
}
++result;
}
while ( result != v7 );
}
return result;
}

canonical_decompiled_code:
__int64 __fastcall func5(__int64 a1, int a2, __int64 a3, int a4, __int64 a5)
{
__int64 result; // rax
__int64 v7; // rdi
float v8; // xmm0_4

result = (unsigned int)a4;
if ( a2 >= a4 )
result = (unsigned int)a2;
if ( MAXPOLF <= (int)result )
result = (unsigned int)MAXPOLF;
if ( (int)result >= 0 )
{
v7 = (unsigned int)(result + 1);
result = 0LL;
do
{
if ( a2 >= (int)result )
{
if ( a4 >= (int)result )
v8 = *(float *)(a3 + 4 * result) + *(float *)(a1 + 4 * result);
else
v8 = *(float *)(a1 + 4 * result);
*(float *)(a5 + 4 * result) = v8;
}
else
{
*(_DWORD *)(a5 + 4 * result) = *(_DWORD *)(a3 + 4 * result);
}
++result;
}
while ( result != v7 );
}
return result;
}

original_code:
void poladdf( float a[], int na, float b[], int nb, float c[] )
{
int i, n;
if( na > nb )
 n = na;
else
 n = nb;
if( n > MAXPOLF )
 n = MAXPOLF;
for( i=0; i<=n; i++ )
 {
 if( i > na )
  c[i] = b[i];
 else if( i > nb )
  c[i] = a[i];
 else
  c[i] = b[i] + a[i];
 }
}

canonical_original_code:
void poladdf(float a[], int na, float b[], int nb, float c[])
{
int i; int n;
if( na > nb )
 n = na;
else
 n = nb;
if( n > MAXPOLF )
 n = MAXPOLF;
for( i=0; i<=n; i++ )
 {
 if( i > na )
  c[i] = b[i];
 else if( i > nb )
  c[i] = a[i];
 else
  c[i] = b[i] + a[i];
 }
}

variable_types: n int


polsubf

decompiled_code:
__int64 __fastcall polsubf(__int64 a1, int a2, __int64 a3, int a4, __int64 a5)
{
__int64 result; // rax
__int64 v7; // rdi
float v8; // xmm0_4

result = (unsigned int)a4;
if ( a2 >= a4 )
result = (unsigned int)a2;
if ( MAXPOLF <= (int)result )
result = (unsigned int)MAXPOLF;
if ( (int)result >= 0 )
{
v7 = (unsigned int)(result + 1);
result = 0LL;
do
{
if ( a2 >= (int)result )
{
if ( a4 >= (int)result )
v8 = *(float *)(a3 + 4 * result) - *(float *)(a1 + 4 * result);
else
LODWORD(v8) = *(_DWORD *)(a1 + 4 * result) ^ LC5;
*(float *)(a5 + 4 * result) = v8;
}
else
{
*(_DWORD *)(a5 + 4 * result) = *(_DWORD *)(a3 + 4 * result);
}
++result;
}
while ( result != v7 );
}
return result;
}

canonical_decompiled_code:
__int64 __fastcall func6(__int64 a1, int a2, __int64 a3, int a4, __int64 a5)
{
__int64 result; // rax
__int64 v7; // rdi
float v8; // xmm0_4

result = (unsigned int)a4;
if ( a2 >= a4 )
result = (unsigned int)a2;
if ( MAXPOLF <= (int)result )
result = (unsigned int)MAXPOLF;
if ( (int)result >= 0 )
{
v7 = (unsigned int)(result + 1);
result = 0LL;
do
{
if ( a2 >= (int)result )
{
if ( a4 >= (int)result )
v8 = *(float *)(a3 + 4 * result) - *(float *)(a1 + 4 * result);
else
LODWORD(v8) = *(_DWORD *)(a1 + 4 * result) ^ LC5;
*(float *)(a5 + 4 * result) = v8;
}
else
{
*(_DWORD *)(a5 + 4 * result) = *(_DWORD *)(a3 + 4 * result);
}
++result;
}
while ( result != v7 );
}
return result;
}

original_code:
void polsubf( float a[], int na, float b[], int nb, float c[] )
{
int i, n;
if( na > nb )
 n = na;
else
 n = nb;
if( n > MAXPOLF )
 n = MAXPOLF;
for( i=0; i<=n; i++ )
 {
 if( i > na )
  c[i] = b[i];
 else if( i > nb )
  c[i] = -a[i];
 else
  c[i] = b[i] - a[i];
 }
}

canonical_original_code:
void polsubf(float a[], int na, float b[], int nb, float c[])
{
int i; int n;
if( na > nb )
 n = na;
else
 n = nb;
if( n > MAXPOLF )
 n = MAXPOLF;
for( i=0; i<=n; i++ )
 {
 if( i > na )
  c[i] = b[i];
 else if( i > nb )
  c[i] = -a[i];
 else
  c[i] = b[i] - a[i];
 }
}


poldivf

decompiled_code:
__int64 __fastcall poldivf(float *a1, int a2, float *a3, int a4, __int64 a5)
{
int v6; // ebp
float *v7; // rbx
_DWORD *v8; // r13
float *v9; // rbp
__int64 v10; // rax
unsigned int v11; // er14
int v12; // esi
float *v13; // r9
__int64 i; // r8
float *v16; // rax
_DWORD *v17; // rax
int v18; // er14
float v19; // xmm2_4
int v20; // edx
__int64 v21; // rax

v6 = a4;
v7 = (float *)malloc((unsigned int)psize);
polclrf((__int64)v7, MAXPOLF);
polmovf((__int64)a1, a2, (__int64)v7);
v8 = malloc((unsigned int)psize);
polclrf((__int64)v8, MAXPOLF);
polmovf((__int64)a3, v6, (__int64)v8);
v9 = (float *)malloc((unsigned int)psize);
polclrf((__int64)v9, MAXPOLF);
if ( *a1 == 0.0 )
{
if ( a2 < 0 )
{
LABEL_6:
mtherr("poldivf", 2LL);
v11 = 0;
}
else
{
v10 = 0LL;
while ( v7[v10] == 0.0 )
{
if ( a2 < (int)++v10 )
goto LABEL_6;
}
if ( a2 > 0 )
{
v16 = v7;
do
{
*v16 = v16[1];
++v16;
}
while ( v16 != &v7[a2] );
}
v7[a2] = 0.0;
if ( *a3 == 0.0 )
{
if ( a4 > 0 )
{
v17 = v8;
do
{
*v17 = v17[1];
++v17;
}
while ( &v8[a4] != v17 );
}
v8[a4] = 0;
v18 = 0;
}
else
{
v18 = 1;
}
v11 = poldivf(v7, (unsigned int)a2, v8, (unsigned int)a4, a5) + v18;
}
}
else
{
v12 = MAXPOLF;
v13 = (float *)v8;
for ( i = 0LL; MAXPOLF >= (int)i; ++v13 )
{
v19 = *v13 / *v7;
v20 = MAXPOLF;
if ( MAXPOLF >= 0 )
{
v21 = 0LL;
do
{
if ( v20 < (int)i + (int)v21 )
break;
v13[v21] = v13[v21] - (float)(v19 * v7[v21]);
v20 = MAXPOLF;
++v21;
}
while ( MAXPOLF >= (int)v21 );
}
v9[i] = v19;
v12 = MAXPOLF;
++i;
}
polmovf((__int64)v9, v12, a5);
v11 = 0;
}
free(v9);
free(v8);
free(v7);
return v11;
}

original_code:
int poldivf( float a[], int na, float b[], int nb, float c[] )
{
float quot;
float *ta, *tb, *tq;
int i, j, k, sing;
sing = 0;
ta = (float * )malloc( psize );
polclrf( ta, MAXPOLF );
polmovf( a, na, ta );
tb = (float * )malloc( psize );
polclrf( tb, MAXPOLF );
polmovf( b, nb, tb );
tq = (float * )malloc( psize );
polclrf( tq, MAXPOLF );
if( a[0] == 0.0 )
 {
 for( i=0; i<=na; i++ )
  {
  if( ta[i] != 0.0 )
   goto nzero;
  }
 mtherr( "poldivf", 2 );
 goto done;
nzero:
 for( i=0; i<na; i++ )
  ta[i] = ta[i+1];
 ta[na] = 0.0;
 if( b[0] != 0.0 )
  {
  sing += 1;
  }
 else
  {
  for( i=0; i<nb; i++ )
   tb[i] = tb[i+1];
  tb[nb] = 0.0;
  }
 sing += poldivf( ta, na, tb, nb, c );
 goto done;
 }
for( i=0; i<=MAXPOLF; i++ )
 {
 quot = tb[i]/ta[0];
 for( j=0; j<=MAXPOLF; j++ )
  {
  k = j + i;
  if( k > MAXPOLF )
   break;
  tb[k] -= quot * ta[j];
  }
 tq[i] = quot;
 }
polmovf( tq, MAXPOLF, c );
done:
free(tq);
free(tb);
free(ta);
return( sing );
}

canonical_original_code:
int poldivf(float a[], int na, float b[], int nb, float c[])
{
float quot;
float *ta; float *tb; float *tq;
int i; int j; int k; int sing;
sing = 0;
ta = (float * )malloc( psize );
polclrf( ta, MAXPOLF );
polmovf( a, na, ta );
tb = (float * )malloc( psize );
polclrf( tb, MAXPOLF );
polmovf( b, nb, tb );
tq = (float * )malloc( psize );
polclrf( tq, MAXPOLF );
if( a[0] == 0.0 )
 {
 for( i=0; i<=na; i++ )
  {
  if( ta[i] != 0.0 )
   goto nzero;
  }
 mtherr( "poldivf", 2 );
 goto done;
nzero:
 for( i=0; i<na; i++ )
  ta[i] = ta[i+1];
 ta[na] = 0.0;
 if( b[0] != 0.0 )
  {
  sing += 1;
  }
 else
  {
  for( i=0; i<nb; i++ )
   tb[i] = tb[i+1];
  tb[nb] = 0.0;
  }
 sing += poldivf( ta, na, tb, nb, c );
 goto done;
 }
for( i=0; i<=MAXPOLF; i++ )
 {
 quot = tb[i]/ta[0];
 for( j=0; j<=MAXPOLF; j++ )
  {
  k = j + i;
  if( k > MAXPOLF )
   break;
  tb[k] -= quot * ta[j];
  }
 tq[i] = quot;
 }
polmovf( tq, MAXPOLF, c );
done:
free(tq);
free(tb);
free(ta);
return( sing );
}

variable_types: quot float

variable_types:
ta
float *

variable_types:
tb
float *

variable_types:
tq
float *

variable_types: sing int


polsbt

original_code:
void polsbt( float a[], int na, float b[], int nb, float c[] )
{
int i, j, k, n2;
float x;
polclrf( pt1, MAXPOLF );
pt1[0] = b[0];
polclrf( pt2, MAXPOLF );
pt2[0] = 1.0;
n2 = 0;
for( i=1; i<=nb; i++ )
 {
 polmulf( a, na, pt2, n2, pt2 );
 n2 += na;
 x = b[i];
 for( j=0; j<=n2; j++ )
  {
  if( j > MAXPOLF )
   break;
  pt1[j] += x * pt2[j];
  }
 }
k = n2 + nb;
if( k > MAXPOLF )
 k = MAXPOLF;
for( i=0; i<=k; i++ )
 c[i] = pt1[i];
}

canonical_original_code:
void polsbt(float a[], int na, float b[], int nb, float c[])
{
int i; int j; int k; int n2;
float x;
polclrf( pt1, MAXPOLF );
pt1[0] = b[0];
polclrf( pt2, MAXPOLF );
pt2[0] = 1.0;
n2 = 0;
for( i=1; i<=nb; i++ )
 {
 polmulf( a, na, pt2, n2, pt2 );
 n2 += na;
 x = b[i];
 for( j=0; j<=n2; j++ )
  {
  if( j > MAXPOLF )
   break;
  pt1[j] += x * pt2[j];
  }
 }
k = n2 + nb;
if( k > MAXPOLF )
 k = MAXPOLF;
for( i=0; i<=k; i++ )
 c[i] = pt1[i];
}

variable_types: x float


polevaf

decompiled_code:
__int64 __fastcall polevaf(__int64 a1, int a2, float a3)
{
float v4; // xmm0_4
__int64 result; // rax

v4 = *(float *)(a1 + 4LL * a2);
result = (unsigned int)(a2 - 1);
if ( a2 - 1 >= 0 )
{
result = (int)result;
do
v4 = (float)(v4 * a3) + *(float *)(a1 + 4 * result--);
while ( (int)result >= 0 );
}
return result;
}

canonical_decompiled_code:
__int64 __fastcall func9(__int64 a1, int a2, float a3)
{
float v4; // xmm0_4
__int64 result; // rax

v4 = *(float *)(a1 + 4LL * a2);
result = (unsigned int)(a2 - 1);
if ( a2 - 1 >= 0 )
{
result = (int)result;
do
v4 = (float)(v4 * a3) + *(float *)(a1 + 4 * result--);
while ( (int)result >= 0 );
}
return result;
}

original_code:
float polevaf( float *a, int na, float xx )
{
float x, s;
int i;
x = xx;
s = a[na];
for( i=na-1; i>=0; i-- )
 {
 s = s * x + a[i];
 }
return(s);
}

canonical_original_code:
float polevaf(float *a, int na, float xx)
{
float x; float s;
int i;
x = xx;
s = a[na];
for( i=na-1; i>=0; i-- )
 {
 s = s * x + a[i];
 }
return(s);
}

variable_types:
a
float *

variable_types: xx float

variable_types: s float


erff

decompiled_code:
float __fastcall erff(float a1)
{
double v2; // xmm0_8

if ( a1 < 0.0 )
{
if ( a1 >= -1.0 )
return polevlf(&T, 6LL, a1 * a1) * a1;
}
else if ( a1 <= 1.0 )
{
return polevlf(&T, 6LL, a1 * a1) * a1;
}
v2 = erfcf(a1);
return 1.0 - *(float *)&v2;
}

canonical_decompiled_code:
float __fastcall func0(float a1)
{
double v2; // xmm0_8

if ( a1 < 0.0 )
{
if ( a1 >= -1.0 )
return polevlf(&T, 6LL, a1 * a1) * a1;
}
else if ( a1 <= 1.0 )
{
return polevlf(&T, 6LL, a1 * a1) * a1;
}
v2 = erfcf(a1);
return 1.0 - *(float *)&v2;
}

original_code:
float erff(float xx)
{
float x, y, z;
x = xx;
if( ( (x) < 0 ? -(x) : (x) ) > 1.0 )
 return( 1.0 - erfcf(x) );
z = x * x;
y = x * polevlf( z, T, 6 );
return( y );
}

canonical_original_code:
float erff(float xx)
{
float x; float y; float z;
x = xx;
if( ( (x) < 0 ? -(x) : (x) ) > 1.0 )
 return( 1.0 - erfcf(x) );
z = x * x;
y = x * polevlf( z, T, 6 );
return( y );
}

variable_types: y float

variable_types: z float


ndtrf

original_code:
float ndtrf(float aa)
{
float x, y, z;
x = aa;
x *= SQRTHF;
z = ( (x) < 0 ? -(x) : (x) );
if( z < SQRTHF )
 y = 0.5 + 0.5 * erff(x);
else
 {
 y = 0.5 * erfcf(z);
 if( x > 0 )
  y = 1.0 - y;
 }
return(y);
}

canonical_original_code:
float ndtrf(float aa)
{
float x; float y; float z;
x = aa;
x *= SQRTHF;
z = ( (x) < 0 ? -(x) : (x) );
if( z < SQRTHF )
 y = 0.5 + 0.5 * erff(x);
else
 {
 y = 0.5 * erfcf(z);
 if( x > 0 )
  y = 1.0 - y;
 }
return(y);
}

variable_types: aa float


decompiled_code:
float __fastcall k0f(float a1)
{
float result; // xmm0_4
float v3; // [rsp+8h] [rbp-10h]
float v4; // [rsp+8h] [rbp-10h]
float v5; // [rsp+8h] [rbp-10h]
float v6; // [rsp+Ch] [rbp-Ch]

if ( a1 <= 0.0 )
{
mtherr(&unk_26D, 1LL);
result = MAXNUMF;
}
else if ( a1 <= 2.0 )
{
v5 = chbevlf(&A, 7LL, (float)(a1 * a1) - 2.0);
v6 = logf(a1 * 0.5);
result = v5 - (float)(v6 * i0f(a1));
}
else
{
v3 = expf(COERCE_FLOAT(LODWORD(a1) ^ LC4));
v4 = chbevlf(&B, 10LL, (float)(8.0 / a1) - 2.0) * v3;
result = v4 / sqrtf(a1);
}
return result;
}

canonical_decompiled_code:
float __fastcall func0(float a1)
{
float result; // xmm0_4
float v3; // [rsp+8h] [rbp-10h]
float v4; // [rsp+8h] [rbp-10h]
float v5; // [rsp+8h] [rbp-10h]
float v6; // [rsp+Ch] [rbp-Ch]

if ( a1 <= 0.0 )
{
mtherr(&unk_26D, 1LL);
result = MAXNUMF;
}
else if ( a1 <= 2.0 )
{
v5 = chbevlf(&A, 7LL, (float)(a1 * a1) - 2.0);
v6 = logf(a1 * 0.5);
result = v5 - (float)(v6 * i0f(a1));
}
else
{
v3 = expf(COERCE_FLOAT(LODWORD(a1) ^ LC4));
v4 = chbevlf(&B, 10LL, (float)(8.0 / a1) - 2.0) * v3;
result = v4 / sqrtf(a1);
}
return result;
}

original_code:
float k0f( float xx )
{
float x, y, z;
x = xx;
if( x <= 0.0f )
 {
 mtherr( "k0f", 1 );
 return( MAXNUMF );
 }
if( x <= 2.0f )
 {
 y = x * x - 2.0f;
 y = chbevlf( y, A, 7 ) - logf( 0.5f * x ) * i0f(x);
 return( y );
 }
z = 8.0f/x - 2.0f;
y = expf(-x) * chbevlf( z, B, 10 ) / sqrtf(x);
return(y);
}

canonical_original_code:
float k0f(float xx)
{
float x; float y; float z;
x = xx;
if( x <= 0.0f )
 {
 mtherr( "k0f", 1 );
 return( MAXNUMF );
 }
if( x <= 2.0f )
 {
 y = x * x - 2.0f;
 y = chbevlf( y, A, 7 ) - logf( 0.5f * x ) * i0f(x);
 return( y );
 }
z = 8.0f/x - 2.0f;
y = expf(-x) * chbevlf( z, B, 10 ) / sqrtf(x);
return(y);
}


decompiled_code:
float __fastcall k0ef(float a1)
{
float result; // xmm0_4
float v3; // [rsp+8h] [rbp-10h]
float v4; // [rsp+8h] [rbp-10h]
float v5; // [rsp+8h] [rbp-10h]
float v6; // [rsp+Ch] [rbp-Ch]

if ( a1 <= 0.0 )
{
mtherr("k0ef", 1LL);
result = MAXNUMF;
}
else if ( a1 <= 2.0 )
{
v4 = chbevlf(&A, 7LL, (float)(a1 * a1) - 2.0);
v6 = logf(a1 * 0.5);
v5 = v4 - (float)(i0f(a1) * v6);
result = expf(a1) * v5;
}
else
{
v3 = chbevlf(&B, 10LL, (float)(8.0 / a1) - 2.0);
result = v3 / sqrtf(a1);
}
return result;
}

canonical_decompiled_code:
float __fastcall func1(float a1)
{
float result; // xmm0_4
float v3; // [rsp+8h] [rbp-10h]
float v4; // [rsp+8h] [rbp-10h]
float v5; // [rsp+8h] [rbp-10h]
float v6; // [rsp+Ch] [rbp-Ch]

if ( a1 <= 0.0 )
{
mtherr("k0ef", 1LL);
result = MAXNUMF;
}
else if ( a1 <= 2.0 )
{
v4 = chbevlf(&A, 7LL, (float)(a1 * a1) - 2.0);
v6 = logf(a1 * 0.5);
v5 = v4 - (float)(i0f(a1) * v6);
result = expf(a1) * v5;
}
else
{
v3 = chbevlf(&B, 10LL, (float)(8.0 / a1) - 2.0);
result = v3 / sqrtf(a1);
}
return result;
}

original_code:
float k0ef( float xx )
{
float x, y;
x = xx;
if( x <= 0.0f )
 {
 mtherr( "k0ef", 1 );
 return( MAXNUMF );
 }
if( x <= 2.0f )
 {
 y = x * x - 2.0f;
 y = chbevlf( y, A, 7 ) - logf( 0.5f * x ) * i0f(x);
 return( y * expf(x) );
 }
y = chbevlf( 8.0f/x - 2.0f, B, 10 ) / sqrtf(x);
return(y);
}

canonical_original_code:
float k0ef(float xx)
{
float x; float y;
x = xx;
if( x <= 0.0f )
 {
 mtherr( "k0ef", 1 );
 return( MAXNUMF );
 }
if( x <= 2.0f )
 {
 y = x * x - 2.0f;
 y = chbevlf( y, A, 7 ) - logf( 0.5f * x ) * i0f(x);
 return( y * expf(x) );
 }
y = chbevlf( 8.0f/x - 2.0f, B, 10 ) / sqrtf(x);
return(y);
}


ynf

decompiled_code:
float __fastcall ynf(int a1, float a2)
{
int v2; // ebx
int v3; // ebp
float result; // xmm0_4
__int128 v5; // xmm0
__int128 v6; // xmm1
int v7; // eax
float v8; // xmm2_4
__int128 v9; // xmm0
float v10; // [rsp+8h] [rbp-20h]

v2 = a1;
if ( a1 < 0 )
{
v2 = -a1;
v3 = (-(char)a1 & 1) == 0 ? 1 : -1;
}
else
{
v3 = 1;
if ( !a1 )
return y0f(a2);
}
if ( v2 == 1 )
return (float)v3 * y1f(a2);
if ( a2 <= 0.0 )
{
mtherr(&unk_167, 2LL);
LODWORD(result) = MAXNUMF ^ LC3;
}
else if ( (a2 < 1.0 || v2 > 29) && (float)(logf((float)v2 / a2) * (float)v2) > MAXLOGF )
{
mtherr(&unk_167, 3LL);
LODWORD(result) = MAXNUMF ^ LC3;
}
else
{
v10 = y0f(a2);
v5 = LODWORD(a2);
*(float *)&v5 = y1f(a2);
v6 = v5;
v7 = 1;
v8 = *(float *)&LC0;
while ( 1 )
{
v9 = v6;
*(float *)&v9 = (float)((float)(*(float *)&v6 * v8) * (float)(1.0 / a2)) - v10;
v8 = v8 + 2.0;
++v7;
v10 = *(float *)&v6;
if ( v7 >= v2 )
break;
v6 = v9;
}
result = *(float *)&v9 * (float)v3;
}
return result;
}

canonical_decompiled_code:
float __fastcall func0(int a1, float a2)
{
int v2; // ebx
int v3; // ebp
float result; // xmm0_4
__int128 v5; // xmm0
__int128 v6; // xmm1
int v7; // eax
float v8; // xmm2_4
__int128 v9; // xmm0
float v10; // [rsp+8h] [rbp-20h]

v2 = a1;
if ( a1 < 0 )
{
v2 = -a1;
v3 = (-(char)a1 & 1) == 0 ? 1 : -1;
}
else
{
v3 = 1;
if ( !a1 )
return y0f(a2);
}
if ( v2 == 1 )
return (float)v3 * y1f(a2);
if ( a2 <= 0.0 )
{
mtherr(&unk_167, 2LL);
LODWORD(result) = MAXNUMF ^ LC3;
}
else if ( (a2 < 1.0 || v2 > 29) && (float)(logf((float)v2 / a2) * (float)v2) > MAXLOGF )
{
mtherr(&unk_167, 3LL);
LODWORD(result) = MAXNUMF ^ LC3;
}
else
{
v10 = y0f(a2);
v5 = LODWORD(a2);
*(float *)&v5 = y1f(a2);
v6 = v5;
v7 = 1;
v8 = *(float *)&LC0;
while ( 1 )
{
v9 = v6;
*(float *)&v9 = (float)((float)(*(float *)&v6 * v8) * (float)(1.0 / a2)) - v10;
v8 = v8 + 2.0;
++v7;
v10 = *(float *)&v6;
if ( v7 >= v2 )
break;
v6 = v9;
}
result = *(float *)&v9 * (float)v3;
}
return result;
}

original_code:
float ynf( int nn, float xx )
{
float x, an, anm1, anm2, r, xinv;
int k, n, sign;
x = xx;
n = nn;
if( n < 0 )
 {
 n = -n;
 if( (n & 1) == 0 )
  sign = 1;
 else
  sign = -1;
 }
else
 sign = 1;
if( n == 0 )
 return( sign * y0f(x) );
if( n == 1 )
 return( sign * y1f(x) );
if( x <= 0.0 )
 {
 mtherr( "ynf", 2 );
 return( -MAXNUMF );
 }
if( (x < 1.0) || (n > 29) )
 {
 an = (float )n;
 r = an * logf( an/x );
 if( r > MAXLOGF )
  {
  mtherr( "ynf", 3 );
  return( -MAXNUMF );
  }
 }
anm2 = y0f(x);
anm1 = y1f(x);
k = 1;
r = 2 * k;
xinv = 1.0/x;
do
 {
 an = r * anm1 * xinv - anm2;
 anm2 = anm1;
 anm1 = an;
 r += 2.0;
 ++k;
 }
while( k < n );
return( sign * an );
}

canonical_original_code:
float ynf(int nn, float xx)
{
float x; float an; float anm1; float anm2; float r; float xinv;
int k; int n; int sign;
x = xx;
n = nn;
if( n < 0 )
 {
 n = -n;
 if( (n & 1) == 0 )
  sign = 1;
 else
  sign = -1;
 }
else
 sign = 1;
if( n == 0 )
 return( sign * y0f(x) );
if( n == 1 )
 return( sign * y1f(x) );
if( x <= 0.0 )
 {
 mtherr( "ynf", 2 );
 return( -MAXNUMF );
 }
if( (x < 1.0) || (n > 29) )
 {
 an = (float )n;
 r = an * logf( an/x );
 if( r > MAXLOGF )
  {
  mtherr( "ynf", 3 );
  return( -MAXNUMF );
  }
 }
anm2 = y0f(x);
anm1 = y1f(x);
k = 1;
r = 2 * k;
xinv = 1.0/x;
do
 {
 an = r * anm1 * xinv - anm2;
 anm2 = anm1;
 anm1 = an;
 r += 2.0;
 ++k;
 }
while( k < n );
return( sign * an );
}

variable_types: nn int

variable_types: an float

variable_types: r float

variable_types: xinv float

variable_types: sign int


initqgam

decompiled_code:
__int64 initqgam()
{
char **v0; // rbp
char *v1; // rbx
_BYTE v3[64]; // [rsp+0h] [rbp-98h] BYREF
char v4[88]; // [rsp+40h] [rbp-58h] BYREF

v0 = gstrs;
v1 = (char *)&qgamcof;
do
{
asctoq(*v0, v1);
asctoq(v0[1], v4);
asctoq(v0[2], v3);
qmul(v4, v3);
asctoq(v0[3], v3);
qmul(v4, v3);
qdiv(v4, v1, v1);
v0 += 4;
v1 += 56;
}
while ( v1 != (char *)(unsigned int)((_DWORD)&qgamcof + 3080) );
qgamini = 1;
return 0LL;
}

canonical_decompiled_code:
__int64 func0()
{
char **v0; // rbp
char *v1; // rbx
_BYTE v3[64]; // [rsp+0h] [rbp-98h] BYREF
char v4[88]; // [rsp+40h] [rbp-58h] BYREF

v0 = gstrs;
v1 = (char *)&qgamcof;
do
{
asctoq(*v0, v1);
asctoq(v0[1], v4);
asctoq(v0[2], v3);
qmul(v4, v3);
asctoq(v0[3], v3);
qmul(v4, v3);
qdiv(v4, v1, v1);
v0 += 4;
v1 += 56;
}
while ( v1 != (char *)(unsigned int)((_DWORD)&qgamcof + 3080) );
qgamini = 1;
return 0LL;
}

original_code:
int initqgam()
{
QELT den[14], temp[14];
int i, k;
k = 0;
for( i=0; i<55; i++ )
  {
    asctoq( gstrs[k++], qgamcof[i] );
    asctoq( gstrs[k++], den );
    asctoq( gstrs[k++], temp );
    qmul( den, temp, den );
    asctoq( gstrs[k++], temp );
    qmul( den, temp, den );
    qdiv( den, qgamcof[i], qgamcof[i] );
  }
qgamini = 1;
return 0;
}

canonical_original_code:
int initqgam()
{
unsigned int den[14]; unsigned int temp[14];
int i; int k;
k = 0;
for( i=0; i<55; i++ )
  {
    asctoq( gstrs[k++], qgamcof[i] );
    asctoq( gstrs[k++], den );
    asctoq( gstrs[k++], temp );
    qmul( den, temp, den );
    asctoq( gstrs[k++], temp );
    qmul( den, temp, den );
    qdiv( den, qgamcof[i], qgamcof[i] );
  }
qgamini = 1;
return 0;
}

variable_types:
den
unsigned int [14]

variable_types:
temp
unsigned int [14]

variable_types: i int

variable_types: k int


zetaf

original_code:
float zetaf(float xx, float qq)
{
int i;
float x, q, a, b, k, s, w, t;
x = xx;
q = qq;
if( x == 1.0 )
 return( MAXNUMF );
if( x < 1.0 )
 {
 mtherr( "zetaf", 1 );
 return(0.0);
 }
w = 9.0;
s = powf( q, -x );
a = q;
for( i=0; i<9; i++ )
 {
 a += 1.0;
 b = powf( a, -x );
 s += b;
 if( b/s < MACHEPF )
  goto done;
 }
w = a;
s += b*w/(x-1.0);
s -= 0.5 * b;
a = 1.0;
k = 0.0;
for( i=0; i<12; i++ )
 {
 a *= x + k;
 b /= w;
 t = a*b/A[i];
 s = s + t;
 t = ( (t/s) < 0 ? -(t/s) : (t/s) );
 if( t < MACHEPF )
  goto done;
 k += 1.0;
 a *= x + k;
 b /= w;
 k += 1.0;
 }
done:
return(s);
}

canonical_original_code:
float zetaf(float xx, float qq)
{
int i;
float x; float q; float a; float b; float k; float s; float w; float t;
x = xx;
q = qq;
if( x == 1.0 )
 return( MAXNUMF );
if( x < 1.0 )
 {
 mtherr( "zetaf", 1 );
 return(0.0);
 }
w = 9.0;
s = powf( q, -x );
a = q;
for( i=0; i<9; i++ )
 {
 a += 1.0;
 b = powf( a, -x );
 s += b;
 if( b/s < MACHEPF )
  goto done;
 }
w = a;
s += b*w/(x-1.0);
s -= 0.5 * b;
a = 1.0;
k = 0.0;
for( i=0; i<12; i++ )
 {
 a *= x + k;
 b /= w;
 t = a*b/A[i];
 s = s + t;
 t = ( (t/s) < 0 ? -(t/s) : (t/s) );
 if( t < MACHEPF )
  goto done;
 k += 1.0;
 a *= x + k;
 b /= w;
 k += 1.0;
 }
done:
return(s);
}

variable_types: qq float

variable_types: q float

variable_types: a float

variable_types: b float

variable_types: k float

variable_types: w float

variable_types: t float


cbrtf

variable_types: xx float

variable_types: e int

variable_types: rem int

variable_types: x float

variable_types: z float


ivf

decompiled_code:
float __fastcall ivf(float a1, float a2)
{
float v2; // xmm0_4
float v4; // xmm0_4
int v5; // ebx
float v6; // xmm0_4
float v7; // xmm0_4
double v8; // xmm5_8
float v9; // [rsp+4h] [rbp-14h]
float v10; // [rsp+Ch] [rbp-Ch]
float v11; // [rsp+Ch] [rbp-Ch]

v9 = a1;
v2 = floorf(a1);
if ( v9 == v2 && v9 < 0.0 )
{
LODWORD(v9) ^= LC2;
LODWORD(v2) ^= LC2;
}
if ( a2 < 0.0 )
{
if ( v9 != v2 )
{
mtherr(&unk_1F5, 1LL);
return 0.0;
}
v4 = floorf(v9 * 0.5);
v5 = 1;
if ( v9 != v4 + v4 )
v5 = -1;
goto LABEL_12;
}
if ( a2 != 0.0 )
{
if ( a2 >= 0.0 )
{
v6 = a2;
v5 = 1;
goto LABEL_19;
}
v5 = 1;
LABEL_12:
LODWORD(v6) = LODWORD(a2) ^ LC2;
LABEL_19:
v7 = logf(v6 * 0.5);
v10 = (float)v5 * expf((float)(v7 * v9) - a2);
v11 = v10 / gammaf(v9 + 1.0);
*(_QWORD *)&v8 = (unsigned int)LC4;
*(float *)&v8 = v9 + 0.5;
return hypergf(v8, *(float *)&v8 + *(float *)&v8, a2 + a2) * v11;
}
if ( v9 == 0.0 )
return *(float *)&LC1;
if ( v9 >= 0.0 )
return 0.0;
mtherr(&unk_1F5, 3LL);
return MAXNUMF;
}

canonical_decompiled_code:
float __fastcall func0(float a1, float a2)
{
float v2; // xmm0_4
float v4; // xmm0_4
int v5; // ebx
float v6; // xmm0_4
float v7; // xmm0_4
double v8; // xmm5_8
float v9; // [rsp+4h] [rbp-14h]
float v10; // [rsp+Ch] [rbp-Ch]
float v11; // [rsp+Ch] [rbp-Ch]

v9 = a1;
v2 = floorf(a1);
if ( v9 == v2 && v9 < 0.0 )
{
LODWORD(v9) ^= LC2;
LODWORD(v2) ^= LC2;
}
if ( a2 < 0.0 )
{
if ( v9 != v2 )
{
mtherr(&unk_1F5, 1LL);
return 0.0;
}
v4 = floorf(v9 * 0.5);
v5 = 1;
if ( v9 != v4 + v4 )
v5 = -1;
goto LABEL_12;
}
if ( a2 != 0.0 )
{
if ( a2 >= 0.0 )
{
v6 = a2;
v5 = 1;
goto LABEL_19;
}
v5 = 1;
LABEL_12:
LODWORD(v6) = LODWORD(a2) ^ LC2;
LABEL_19:
v7 = logf(v6 * 0.5);
v10 = (float)v5 * expf((float)(v7 * v9) - a2);
v11 = v10 / gammaf(v9 + 1.0);
*(_QWORD *)&v8 = (unsigned int)LC4;
*(float *)&v8 = v9 + 0.5;
return hypergf(v8, *(float *)&v8 + *(float *)&v8, a2 + a2) * v11;
}
if ( v9 == 0.0 )
return *(float *)&LC1;
if ( v9 >= 0.0 )
return 0.0;
mtherr(&unk_1F5, 3LL);
return MAXNUMF;
}

original_code:
float ivf( float v, float x )
{
int sign;
float t, ax;
t = floorf(v);
if( v < 0.0 )
 {
 if( t == v )
  {
  v = -v;
  t = -t;
  }
 }
sign = 1;
if( x < 0.0 )
 {
 if( t != v )
  {
  mtherr( "ivf", 1 );
  return( 0.0 );
  }
 if( v != 2.0 * floorf(v/2.0) )
  sign = -1;
 }
if( x == 0.0 )
 {
 if( v == 0.0 )
  return( 1.0 );
 if( v < 0.0 )
  {
  mtherr( "ivf", 3 );
  return( MAXNUMF );
  }
 else
  return( 0.0 );
 }
ax = ( (x) < 0 ? -(x) : (x) );
t = v * logf( 0.5 * ax ) - x;
t = sign * expf(t) / gammaf( v + 1.0 );
ax = v + 0.5;
return( t * hypergf( ax, 2.0 * ax, 2.0 * x ) );
}

canonical_original_code:
float ivf(float v, float x)
{
int sign;
float t; float ax;
t = floorf(v);
if( v < 0.0 )
 {
 if( t == v )
  {
  v = -v;
  t = -t;
  }
 }
sign = 1;
if( x < 0.0 )
 {
 if( t != v )
  {
  mtherr( "ivf", 1 );
  return( 0.0 );
  }
 if( v != 2.0 * floorf(v/2.0) )
  sign = -1;
 }
if( x == 0.0 )
 {
 if( v == 0.0 )
  return( 1.0 );
 if( v < 0.0 )
  {
  mtherr( "ivf", 3 );
  return( MAXNUMF );
  }
 else
  return( 0.0 );
 }
ax = ( (x) < 0 ? -(x) : (x) );
t = v * logf( 0.5 * ax ) - x;
t = sign * expf(t) / gammaf( v + 1.0 );
ax = v + 0.5;
return( t * hypergf( ax, 2.0 * ax, 2.0 * x ) );
}

variable_types: v float

variable_types: sign int

variable_types: ax float


gammaf

original_code:
float gammaf( float xx )
{
float p, q, x, z, nz;
int i, direction, negative;
x = xx;
sgngamf = 1;
negative = 0;
nz = 0.0;
if( x < 0.0 )
 {
 negative = 1;
 q = -x;
 p = floorf(q);
 if( p == q )
  goto goverf;
 i = p;
 if( (i & 1) == 0 )
  sgngamf = -1;
 nz = q - p;
 if( nz > 0.5 )
  {
  p += 1.0;
  nz = q - p;
  }
 nz = q * sinf( PIF * nz );
 if( nz == 0.0 )
  {
goverf:
  mtherr( "gamma", 3 );
  return( sgngamf * MAXNUMF);
  }
 if( nz < 0 )
  nz = -nz;
 x = q;
 }
if( x >= 10.0 )
 {
 z = stirf(x);
 }
if( x < 2.0 )
 direction = 1;
else
 direction = 0;
z = 1.0;
while( x >= 3.0 )
 {
 x -= 1.0;
 z *= x;
 }
while( x < 2.0 )
 {
 if( x < 1.e-4 )
  goto small;
 z *=x;
 x += 1.0;
 }
if( direction )
 z = 1.0/z;
if( x == 2.0 )
 return(z);
x -= 2.0;
p = z * polevlf( x, P, 7 );
gdone:
if( negative )
 {
 p = sgngamf * PIF/(nz * p );
 }
return(p);
small:
if( x == 0.0 )
 {
 mtherr( "gamma", 2 );
 return( MAXNUMF );
 }
else
 {
 p = z / ((1.0 + 0.5772156649015329 * x) * x);
 goto gdone;
 }
}

canonical_original_code:
float gammaf(float xx)
{
float p; float q; float x; float z; float nz;
int i; int direction; int negative;
x = xx;
sgngamf = 1;
negative = 0;
nz = 0.0;
if( x < 0.0 )
 {
 negative = 1;
 q = -x;
 p = floorf(q);
 if( p == q )
  goto goverf;
 i = p;
 if( (i & 1) == 0 )
  sgngamf = -1;
 nz = q - p;
 if( nz > 0.5 )
  {
  p += 1.0;
  nz = q - p;
  }
 nz = q * sinf( PIF * nz );
 if( nz == 0.0 )
  {
goverf:
  mtherr( "gamma", 3 );
  return( sgngamf * MAXNUMF);
  }
 if( nz < 0 )
  nz = -nz;
 x = q;
 }
if( x >= 10.0 )
 {
 z = stirf(x);
 }
if( x < 2.0 )
 direction = 1;
else
 direction = 0;
z = 1.0;
while( x >= 3.0 )
 {
 x -= 1.0;
 z *= x;
 }
while( x < 2.0 )
 {
 if( x < 1.e-4 )
  goto small;
 z *=x;
 x += 1.0;
 }
if( direction )
 z = 1.0/z;
if( x == 2.0 )
 return(z);
x -= 2.0;
p = z * polevlf( x, P, 7 );
gdone:
if( negative )
 {
 p = sgngamf * PIF/(nz * p );
 }
return(p);
small:
if( x == 0.0 )
 {
 mtherr( "gamma", 2 );
 return( MAXNUMF );
 }
else
 {
 p = z / ((1.0 + 0.5772156649015329 * x) * x);
 goto gdone;
 }
}

variable_types: p float

variable_types: nz float

variable_types: i int

variable_types: direction int

variable_types: negative int


lgamf

original_code:
float lgamf( float xx )
{
float p, q, w, z, x;
float nx, tx;
int i, direction;
sgngamf = 1;
x = xx;
if( x < 0.0 )
 {
 q = -x;
 w = lgamf(q);
 p = floorf(q);
 if( p == q )
  goto loverf;
 i = p;
 if( (i & 1) == 0 )
  sgngamf = -1;
 else
  sgngamf = 1;
 z = q - p;
 if( z > 0.5 )
  {
  p += 1.0;
  z = p - q;
  }
 z = q * sinf( PIF * z );
 if( z == 0.0 )
  goto loverf;
 z = -logf( PIINV*z ) - w;
 return( z );
 }
if( x < 6.5 )
 {
 direction = 0;
 z = 1.0;
 tx = x;
 nx = 0.0;
 if( x >= 1.5 )
  {
  while( tx > 2.5 )
   {
   nx -= 1.0;
   tx = x + nx;
   z *=tx;
   }
  x += nx - 2.0;
iv1r5:
  p = x * polevlf( x, B, 7 );
  goto cont;
  }
 if( x >= 1.25 )
  {
  z *= x;
  x -= 1.0;
  direction = 1;
  goto iv1r5;
  }
 if( x >= 0.75 )
  {
  x -= 1.0;
  p = x * polevlf( x, C, 7 );
  q = 0.0;
  goto contz;
  }
 while( tx < 1.5 )
  {
  if( tx == 0.0 )
   goto loverf;
  z *=tx;
  nx += 1.0;
  tx = x + nx;
  }
 direction = 1;
 x += nx - 2.0;
 p = x * polevlf( x, B, 7 );
cont:
 if( z < 0.0 )
  {
  sgngamf = -1;
  z = -z;
  }
 else
  {
  sgngamf = 1;
  }
 q = logf(z);
 if( direction )
  q = -q;
contz:
 return( p + q );
 }
if( x > 2.035093e36 )
 {
loverf:
 mtherr( "lgamf", 3 );
 return( sgngamf * MAXNUMF );
 }
q = LS2PI - x;
q += ( x - 0.5 ) * logf(x);
if( x <= 1.0e4 )
 {
 z = 1.0/x;
 p = z * z;
 q += (( 6.789774945028216E-004 * p
   - 2.769887652139868E-003 ) * p
  + 8.333316229807355E-002 ) * z;
 }
return( q );
}

canonical_original_code:
float lgamf(float xx)
{
float p; float q; float w; float z; float x;
float nx; float tx;
int i; int direction;
sgngamf = 1;
x = xx;
if( x < 0.0 )
 {
 q = -x;
 w = lgamf(q);
 p = floorf(q);
 if( p == q )
  goto loverf;
 i = p;
 if( (i & 1) == 0 )
  sgngamf = -1;
 else
  sgngamf = 1;
 z = q - p;
 if( z > 0.5 )
  {
  p += 1.0;
  z = p - q;
  }
 z = q * sinf( PIF * z );
 if( z == 0.0 )
  goto loverf;
 z = -logf( PIINV*z ) - w;
 return( z );
 }
if( x < 6.5 )
 {
 direction = 0;
 z = 1.0;
 tx = x;
 nx = 0.0;
 if( x >= 1.5 )
  {
  while( tx > 2.5 )
   {
   nx -= 1.0;
   tx = x + nx;
   z *=tx;
   }
  x += nx - 2.0;
iv1r5:
  p = x * polevlf( x, B, 7 );
  goto cont;
  }
 if( x >= 1.25 )
  {
  z *= x;
  x -= 1.0;
  direction = 1;
  goto iv1r5;
  }
 if( x >= 0.75 )
  {
  x -= 1.0;
  p = x * polevlf( x, C, 7 );
  q = 0.0;
  goto contz;
  }
 while( tx < 1.5 )
  {
  if( tx == 0.0 )
   goto loverf;
  z *=tx;
  nx += 1.0;
  tx = x + nx;
  }
 direction = 1;
 x += nx - 2.0;
 p = x * polevlf( x, B, 7 );
cont:
 if( z < 0.0 )
  {
  sgngamf = -1;
  z = -z;
  }
 else
  {
  sgngamf = 1;
  }
 q = logf(z);
 if( direction )
  q = -q;
contz:
 return( p + q );
 }
if( x > 2.035093e36 )
 {
loverf:
 mtherr( "lgamf", 3 );
 return( sgngamf * MAXNUMF );
 }
q = LS2PI - x;
q += ( x - 0.5 ) * logf(x);
if( x <= 1.0e4 )
 {
 z = 1.0/x;
 p = z * z;
 q += (( 6.789774945028216E-004 * p
   - 2.769887652139868E-003 ) * p
  + 8.333316229807355E-002 ) * z;
 }
return( q );
}

variable_types: q float

variable_types: nx float

variable_types: tx float


yvf

decompiled_code:
float __fastcall yvf(float a1, float a2)
{
__m128i v2; // xmm2
double v3; // xmm0_8
double v4; // xmm0_8
float v7; // [rsp+Ch] [rbp-Ch]
float v8; // [rsp+Ch] [rbp-Ch]

if ( a1 == floorf(a1) )
return ynf((int)a1, a2);
v2 = (__m128i)LODWORD(a1);
*(float *)v2.m128i_i32 = a1 * PIF;
v7 = cosf(a1 * PIF);
v3 = jvf(a1, a2);
v8 = *(float *)&v3 * v7;
v4 = jvf(COERCE_FLOAT(LODWORD(a1) ^ LC4), a2);
return (float)(v8 - *(float *)&v4) / sinf(COERCE_FLOAT(_mm_cvtsi128_si32(v2)));
}

canonical_decompiled_code:
float __fastcall func0(float a1, float a2)
{
__m128i v2; // xmm2
double v3; // xmm0_8
double v4; // xmm0_8
float v7; // [rsp+Ch] [rbp-Ch]
float v8; // [rsp+Ch] [rbp-Ch]

if ( a1 == floorf(a1) )
return ynf((int)a1, a2);
v2 = (__m128i)LODWORD(a1);
*(float *)v2.m128i_i32 = a1 * PIF;
v7 = cosf(a1 * PIF);
v3 = jvf(a1, a2);
v8 = *(float *)&v3 * v7;
v4 = jvf(COERCE_FLOAT(LODWORD(a1) ^ LC4), a2);
return (float)(v8 - *(float *)&v4) / sinf(COERCE_FLOAT(_mm_cvtsi128_si32(v2)));
}

original_code:
float yvf( float vv, float xx )
{
float v, x, y, t;
int n;
v = vv;
x = xx;
y = floorf( v );
if( y == v )
 {
 n = v;
 y = ynf( n, x );
 return( y );
 }
t = PIF * v;
y = (cosf(t) * jvf( v, x ) - jvf( -v, x ))/sinf(t);
return( y );
}

canonical_original_code:
float yvf(float vv, float xx)
{
float v; float x; float y; float t;
int n;
v = vv;
x = xx;
y = floorf( v );
if( y == v )
 {
 n = v;
 y = ynf( n, x );
 return( y );
 }
t = PIF * v;
y = (cosf(t) * jvf( v, x ) - jvf( -v, x ))/sinf(t);
return( y );
}

variable_types: vv float

variable_types: y float

variable_types: t float

variable_types: n int


struvef

original_code:
float struvef( float vv, float xx )
{
float v, x, y, ya, f, g, h, t;
float onef2err, threef0err;
v = vv;
x = xx;
f = floorf(v);
if( (v < 0) && ( v-f == 0.5 ) )
 {
 y = jvf( -v, x );
 f = 1.0 - f;
 g = 2.0 * floorf(0.5*f);
 if( g != f )
  y = -y;
 return(y);
 }
t = 0.25*x*x;
f = ( (x) < 0 ? -(x) : (x) );
g = 1.5 * ( (v) < 0 ? -(v) : (v) );
if( (f > 30.0) && (f > g) )
 {
 onef2err = MAXNUMF;
 y = 0.0;
 }
else
 {
 y = onef2f( 1.0, 1.5, 1.5+v, -t, &onef2err );
 }
if( (f < 18.0) || (x < 0.0) )
 {
 threef0err = MAXNUMF;
 ya = 0.0;
 }
else
 {
 ya = threef0f( 1.0, 0.5, 0.5-v, -1.0/t, &threef0err );
 }
f = sqrtf( PIF );
h = powf( 0.5*x, v-1.0 );
if( onef2err <= threef0err )
 {
 g = gammaf( v + 1.5 );
 y = y * h * t / ( 0.5 * f * g );
 return(y);
 }
else
 {
 g = gammaf( v + 0.5 );
 ya = ya * h / ( f * g );
 ya = ya + yvf( v, x );
 return(ya);
 }
}

canonical_original_code:
float struvef(float vv, float xx)
{
float v; float x; float y; float ya; float f; float g; float h; float t;
float onef2err; float threef0err;
v = vv;
x = xx;
f = floorf(v);
if( (v < 0) && ( v-f == 0.5 ) )
 {
 y = jvf( -v, x );
 f = 1.0 - f;
 g = 2.0 * floorf(0.5*f);
 if( g != f )
  y = -y;
 return(y);
 }
t = 0.25*x*x;
f = ( (x) < 0 ? -(x) : (x) );
g = 1.5 * ( (v) < 0 ? -(v) : (v) );
if( (f > 30.0) && (f > g) )
 {
 onef2err = MAXNUMF;
 y = 0.0;
 }
else
 {
 y = onef2f( 1.0, 1.5, 1.5+v, -t, &onef2err );
 }
if( (f < 18.0) || (x < 0.0) )
 {
 threef0err = MAXNUMF;
 ya = 0.0;
 }
else
 {
 ya = threef0f( 1.0, 0.5, 0.5-v, -1.0/t, &threef0err );
 }
f = sqrtf( PIF );
h = powf( 0.5*x, v-1.0 );
if( onef2err <= threef0err )
 {
 g = gammaf( v + 1.5 );
 y = y * h * t / ( 0.5 * f * g );
 return(y);
 }
else
 {
 g = gammaf( v + 0.5 );
 ya = ya * h / ( f * g );
 ya = ya + yvf( v, x );
 return(ya);
 }
}

variable_types: xx float

variable_types: x float

variable_types: ya float

variable_types: f float

variable_types: g float

variable_types: h float


igamif

decompiled_code:
float __fastcall igamif(float a1, double a2)
{
double v2; // r14
float v3; // xmm6_4
float v4; // xmm0_4
int v5; // ebx
float v7; // xmm0_4
float v8; // xmm0_4
float v9; // xmm0_4
float v10; // xmm3_4
float v11; // xmm0_4
float x; // [rsp+Ch] [rbp-2Ch]
float v13; // [rsp+10h] [rbp-28h]
float v14; // [rsp+10h] [rbp-28h]
float v16; // [rsp+18h] [rbp-20h]

v2 = a1;
v3 = 1.0 / (a1 * 9.0);
v13 = ndtrif(a2);
v4 = 1.0 - v3 - (float)(sqrtf(v3) * v13);
x = (float)((float)(a1 * v4) * v4) * v4;
v16 = lgamf(a1);
v5 = 0;
while ( 1 )
{
if ( x <= 0.0 )
{
mtherr("igamif", 4LL);
return 0.0;
}
v14 = igamcf(a1, x);
v7 = (v2 - 1.0) * logf(x) - x - v16;
if ( COERCE_FLOAT(MAXLOGF ^ LC4) > v7 )
break;
v8 = expf(v7);
if ( v8 != 0.0 )
{
v9 = COERCE_FLOAT(COERCE_UNSIGNED_INT(v14 - *(float *)&a2) ^ LC4) / v8;
v10 = x - v9;
x = x - v9;
if ( v5 <= 2 )
goto LABEL_17;
v11 = v9 / v10;
if ( v11 < 0.0 )
LODWORD(v11) ^= LC4;
if ( MACHEPF + MACHEPF <= v11 )
{
LABEL_17:
if ( ++v5 != 10 )
continue;
}
}
return x;
}
mtherr("igamif", 4LL);
return x;
}

canonical_decompiled_code:
float __fastcall func0(float a1, double a2)
{
double v2; // r14
float v3; // xmm6_4
float v4; // xmm0_4
int v5; // ebx
float v7; // xmm0_4
float v8; // xmm0_4
float v9; // xmm0_4
float v10; // xmm3_4
float v11; // xmm0_4
float x; // [rsp+Ch] [rbp-2Ch]
float v13; // [rsp+10h] [rbp-28h]
float v14; // [rsp+10h] [rbp-28h]
float v16; // [rsp+18h] [rbp-20h]

v2 = a1;
v3 = 1.0 / (a1 * 9.0);
v13 = ndtrif(a2);
v4 = 1.0 - v3 - (float)(sqrtf(v3) * v13);
x = (float)((float)(a1 * v4) * v4) * v4;
v16 = lgamf(a1);
v5 = 0;
while ( 1 )
{
if ( x <= 0.0 )
{
mtherr("igamif", 4LL);
return 0.0;
}
v14 = igamcf(a1, x);
v7 = (v2 - 1.0) * logf(x) - x - v16;
if ( COERCE_FLOAT(MAXLOGF ^ LC4) > v7 )
break;
v8 = expf(v7);
if ( v8 != 0.0 )
{
v9 = COERCE_FLOAT(COERCE_UNSIGNED_INT(v14 - *(float *)&a2) ^ LC4) / v8;
v10 = x - v9;
x = x - v9;
if ( v5 <= 2 )
goto LABEL_17;
v11 = v9 / v10;
if ( v11 < 0.0 )
LODWORD(v11) ^= LC4;
if ( MACHEPF + MACHEPF <= v11 )
{
LABEL_17:
if ( ++v5 != 10 )
continue;
}
}
return x;
}
mtherr("igamif", 4LL);
return x;
}

original_code:
float igamif( float aa, float yy0 )
{
float a, y0, d, y, x0, lgm;
int i;
a = aa;
y0 = yy0;
d = 1.0/(9.0*a);
y = ( 1.0 - d - ndtrif(y0) * sqrtf(d) );
x0 = a * y * y * y;
lgm = lgamf(a);
for( i=0; i<10; i++ )
 {
 if( x0 <= 0.0 )
  {
  mtherr( "igamif", 4 );
  return(0.0);
  }
 y = igamcf(a,x0);
 d = (a - 1.0) * logf(x0) - x0 - lgm;
 if( d < -MAXLOGF )
  {
  mtherr( "igamif", 4 );
  goto done;
  }
 d = -expf(d);
 if( d == 0.0 )
  goto done;
 d = (y - y0)/d;
 x0 = x0 - d;
 if( i < 3 )
  continue;
 if( ( (d/x0) < 0 ? -(d/x0) : (d/x0) ) < (2.0 * MACHEPF) )
  goto done;
 }
done:
return( x0 );
}

canonical_original_code:
float igamif(float aa, float yy0)
{
float a; float y0; float d; float y; float x0; float lgm;
int i;
a = aa;
y0 = yy0;
d = 1.0/(9.0*a);
y = ( 1.0 - d - ndtrif(y0) * sqrtf(d) );
x0 = a * y * y * y;
lgm = lgamf(a);
for( i=0; i<10; i++ )
 {
 if( x0 <= 0.0 )
  {
  mtherr( "igamif", 4 );
  return(0.0);
  }
 y = igamcf(a,x0);
 d = (a - 1.0) * logf(x0) - x0 - lgm;
 if( d < -MAXLOGF )
  {
  mtherr( "igamif", 4 );
  goto done;
  }
 d = -expf(d);
 if( d == 0.0 )
  goto done;
 d = (y - y0)/d;
 x0 = x0 - d;
 if( i < 3 )
  continue;
 if( ( (d/x0) < 0 ? -(d/x0) : (d/x0) ) < (2.0 * MACHEPF) )
  goto done;
 }
done:
return( x0 );
}

variable_types: aa float

variable_types: a float

variable_types: d float

variable_types: lgm float


gdtrf

decompiled_code:
double __fastcall gdtrf(double a1, double a2, double a3)
{
double result; // xmm0_8

result = a2;
if ( *(float *)&a3 < 0.0 )
{
mtherr("gdtrf", 1LL, a2, 0.0, a3, a1);
result = 0.0;
}
else
{
*(float *)&a1 = *(float *)&a1 * *(float *)&a3;
igamf(a2, a1);
}
return result;
}

canonical_decompiled_code:
double __fastcall func0(double a1, double a2, double a3)
{
double result; // xmm0_8

result = a2;
if ( *(float *)&a3 < 0.0 )
{
mtherr("gdtrf", 1LL, a2, 0.0, a3, a1);
result = 0.0;
}
else
{
*(float *)&a1 = *(float *)&a1 * *(float *)&a3;
igamf(a2, a1);
}
return result;
}

original_code:
float gdtrf( float aa, float bb, float xx )
{
float a, b, x;
a = aa;
b = bb;
x = xx;
if( x < 0.0 )
 {
 mtherr( "gdtrf", 1 );
 return( 0.0 );
 }
return( igamf( b, a * x ) );
}

canonical_original_code:
float gdtrf(float aa, float bb, float xx)
{
float a; float b; float x;
a = aa;
b = bb;
x = xx;
if( x < 0.0 )
 {
 mtherr( "gdtrf", 1 );
 return( 0.0 );
 }
return( igamf( b, a * x ) );
}

variable_types: bb float

variable_types: b float


gdtrcf

decompiled_code:
double __fastcall gdtrcf(double a1, double a2, double a3)
{
double result; // xmm0_8

result = a2;
if ( *(float *)&a3 < 0.0 )
{
mtherr("gdtrcf", 1LL, a2, 0.0, a3, a1);
result = 0.0;
}
else
{
*(float *)&a1 = *(float *)&a1 * *(float *)&a3;
igamcf(a2, a1);
}
return result;
}

canonical_decompiled_code:
double __fastcall func1(double a1, double a2, double a3)
{
double result; // xmm0_8

result = a2;
if ( *(float *)&a3 < 0.0 )
{
mtherr("gdtrcf", 1LL, a2, 0.0, a3, a1);
result = 0.0;
}
else
{
*(float *)&a1 = *(float *)&a1 * *(float *)&a3;
igamcf(a2, a1);
}
return result;
}

original_code:
float gdtrcf( float aa, float bb, float xx )
{
float a, b, x;
a = aa;
b = bb;
x = xx;
if( x < 0.0 )
 {
 mtherr( "gdtrcf", 1 );
 return( 0.0 );
 }
return( igamcf( b, a * x ) );
}

canonical_original_code:
float gdtrcf(float aa, float bb, float xx)
{
float a; float b; float x;
a = aa;
b = bb;
x = xx;
if( x < 0.0 )
 {
 mtherr( "gdtrcf", 1 );
 return( 0.0 );
 }
return( igamcf( b, a * x ) );
}


pdtrcf

decompiled_code:
__m64 __fastcall pdtrcf(int a1, float a2)
{
__m64 result; // xmm0_8

if ( a1 < 0 || a2 <= 0.0 )
{
mtherr("pdtrcf", 1LL);
result = 0LL;
}
else
{
*((_DWORD *)&result + 1) = 0;
*(float *)&result.m64_u64 = (float)(a1 + 1);
igamf(result.m64_f32[0]);
}
return result;
}

canonical_decompiled_code:
__m64 __fastcall func0(int a1, float a2)
{
__m64 result; // xmm0_8

if ( a1 < 0 || a2 <= 0.0 )
{
mtherr("pdtrcf", 1LL);
result = 0LL;
}
else
{
*((_DWORD *)&result + 1) = 0;
*(float *)&result.m64_u64 = (float)(a1 + 1);
igamf(result.m64_f32[0]);
}
return result;
}

original_code:
float pdtrcf( int k, float mm )
{
float v, m;
m = mm;
if( (k < 0) || (m <= 0.0) )
 {
 mtherr( "pdtrcf", 1 );
 return( 0.0 );
 }
v = k+1;
return( igamf( v, m ) );
}

canonical_original_code:
float pdtrcf(int k, float mm)
{
float v; float m;
m = mm;
if( (k < 0) || (m <= 0.0) )
 {
 mtherr( "pdtrcf", 1 );
 return( 0.0 );
 }
v = k+1;
return( igamf( v, m ) );
}

variable_types: k int

variable_types: mm float

variable_types: v float

variable_types: m float


pdtrf

decompiled_code:
__m64 __fastcall pdtrf(int a1, float a2)
{
__m64 result; // xmm0_8

if ( a1 < 0 || a2 <= 0.0 )
{
mtherr("pdtr", 1LL);
result = 0LL;
}
else
{
*((_DWORD *)&result + 1) = 0;
*(float *)&result.m64_u64 = (float)(a1 + 1);
igamcf(result.m64_f32[0]);
}
return result;
}

canonical_decompiled_code:
__m64 __fastcall func1(int a1, float a2)
{
__m64 result; // xmm0_8

if ( a1 < 0 || a2 <= 0.0 )
{
mtherr("pdtr", 1LL);
result = 0LL;
}
else
{
*((_DWORD *)&result + 1) = 0;
*(float *)&result.m64_u64 = (float)(a1 + 1);
igamcf(result.m64_f32[0]);
}
return result;
}

original_code:
float pdtrf( int k, float mm )
{
float v, m;
m = mm;
if( (k < 0) || (m <= 0.0) )
 {
 mtherr( "pdtr", 1 );
 return( 0.0 );
 }
v = k+1;
return( igamcf( v, m ) );
}

canonical_original_code:
float pdtrf(int k, float mm)
{
float v; float m;
m = mm;
if( (k < 0) || (m <= 0.0) )
 {
 mtherr( "pdtr", 1 );
 return( 0.0 );
 }
v = k+1;
return( igamcf( v, m ) );
}


pdtrif

decompiled_code:
__int64 __fastcall pdtrif(int a1, float a2)
{
__int64 result; // rax

if ( a1 >= 0 && a2 >= 0.0 && a2 < 1.0 )
result = igamif((float)(a1 + 1));
else
result = mtherr("pdtrif", 1LL);
return result;
}

canonical_decompiled_code:
__int64 __fastcall func2(int a1, float a2)
{
__int64 result; // rax

if ( a1 >= 0 && a2 >= 0.0 && a2 < 1.0 )
result = igamif((float)(a1 + 1));
else
result = mtherr("pdtrif", 1LL);
return result;
}

original_code:
float pdtrif( int k, float yy )
{
float v, y;
y = yy;
if( (k < 0) || (y < 0.0) || (y >= 1.0) )
 {
 mtherr( "pdtrif", 1 );
 return( 0.0 );
 }
v = k+1;
v = igamif( v, y );
return( v );
}

canonical_original_code:
float pdtrif(int k, float yy)
{
float v; float y;
y = yy;
if( (k < 0) || (y < 0.0) || (y >= 1.0) )
 {
 mtherr( "pdtrif", 1 );
 return( 0.0 );
 }
v = k+1;
v = igamif( v, y );
return( v );
}

variable_types: yy float

variable_types: y float


tanf

decompiled_code:
__m128 __fastcall tanf(__m128 a1)
{
return tancotf(0, a1);
}

canonical_decompiled_code:
__m128 __fastcall func1(__m128 a1)
{
return func0(0, a1);
}

original_code:
float tanf( float x )
{
return( tancotf(x,0) );
}

canonical_original_code:
float tanf(float x)
{
return( tancotf(x,0) );
}

variable_types: x float


cotf

decompiled_code:
float __fastcall cotf(__m128 a1, __int64 a2, __int64 a3, __int64 a4)
{
float result; // xmm0_4

if ( a1.m128_f32[0] == 0.0 )
{
mtherr("cotf", 2LL, a4);
result = MAXNUMF;
}
else
{
LODWORD(result) = tancotf(1, a1).m128_u32[0];
}
return result;
}

canonical_decompiled_code:
float __fastcall func2(__m128 a1, __int64 a2, __int64 a3, __int64 a4)
{
float result; // xmm0_4

if ( a1.m128_f32[0] == 0.0 )
{
mtherr("cotf", 2LL, a4);
result = MAXNUMF;
}
else
{
LODWORD(result) = func0(1, a1).m128_u32[0];
}
return result;
}

original_code:
float cotf( float x )
{
if( x == 0.0 )
 {
 mtherr( "cotf", 2 );
 return( MAXNUMF );
 }
return( tancotf(x,1) );
}

canonical_original_code:
float cotf(float x)
{
if( x == 0.0 )
 {
 mtherr( "cotf", 2 );
 return( MAXNUMF );
 }
return( tancotf(x,1) );
}


tancotf

variable_types: xx float

variable_types: cotflg int

variable_types: z float

variable_types: zz float

variable_types: j long

variable_types: sign int


asinf

variable_types: a float

variable_types: flag int


acosf

original_code:
float acosf( float x )
{
if( x < -1.0 )
 goto domerr;
if( x < -0.5)
 return( PIF - 2.0 * asinf( sqrtf(0.5*(1.0+x)) ) );
if( x > 1.0 )
 {
domerr: mtherr( "acosf", 1 );
 return( 0.0 );
 }
if( x > 0.5 )
 return( 2.0 * asinf( sqrtf(0.5*(1.0-x) ) ) );
return( PIO2F - asinf(x) );
}

canonical_original_code:
float acosf(float x)
{
if( x < -1.0 )
 goto domerr;
if( x < -0.5)
 return( PIF - 2.0 * asinf( sqrtf(0.5*(1.0+x)) ) );
if( x > 1.0 )
 {
domerr: mtherr( "acosf", 1 );
 return( 0.0 );
 }
if( x > 0.5 )
 return( 2.0 * asinf( sqrtf(0.5*(1.0-x) ) ) );
return( PIO2F - asinf(x) );
}


sinf

original_code:
float sinf( float xx )
{
float *p;
float x, y, z;
register unsigned long j;
register int sign;
sign = 1;
x = xx;
if( xx < 0 )
 {
 sign = -1;
 x = -xx;
 }
if( x > T24M1 )
 {
 mtherr( "sinf", 5 );
 return(0.0);
 }
j = FOPI * x;
y = j;
if( j & 1 )
 {
 j += 1;
 y += 1.0;
 }
j &= 7;
if( j > 3)
 {
 sign = -sign;
 j -= 4;
 }
if( x > lossth )
 {
 mtherr( "sinf", 6 );
 x = x - y * PIO4F;
 }
else
 {
 x = ((x - y * DP1) - y * DP2) - y * DP3;
 }
z = x * x;
if( (j==1) || (j==2) )
 {
 p = coscof;
 y = *p++;
 y = y * z + *p++;
 y = y * z + *p++;
 y *= z * z;
 y -= 0.5 * z;
 y += 1.0;
 }
else
 {
 p = sincof;
 y = *p++;
 y = y * z + *p++;
 y = y * z + *p++;
 y *= z * x;
 y += x;
 }
if(sign < 0)
 y = -y;
return( y);
}

canonical_original_code:
float sinf(float xx)
{
float *p;
float x; float y; float z;
register unsigned long j;
register int sign;
sign = 1;
x = xx;
if( xx < 0 )
 {
 sign = -1;
 x = -xx;
 }
if( x > T24M1 )
 {
 mtherr( "sinf", 5 );
 return(0.0);
 }
j = FOPI * x;
y = j;
if( j & 1 )
 {
 j += 1;
 y += 1.0;
 }
j &= 7;
if( j > 3)
 {
 sign = -sign;
 j -= 4;
 }
if( x > lossth )
 {
 mtherr( "sinf", 6 );
 x = x - y * PIO4F;
 }
else
 {
 x = ((x - y * DP1) - y * DP2) - y * DP3;
 }
z = x * x;
if( (j==1) || (j==2) )
 {
 p = coscof;
 y = *p++;
 y = y * z + *p++;
 y = y * z + *p++;
 y *= z * z;
 y -= 0.5 * z;
 y += 1.0;
 }
else
 {
 p = sincof;
 y = *p++;
 y = y * z + *p++;
 y = y * z + *p++;
 y *= z * x;
 y += x;
 }
if(sign < 0)
 y = -y;
return( y);
}

variable_types:
p
float *

variable_types:
j
unsigned long


cosf

variable_types: j int


ceilf

decompiled_code:
float __fastcall ceilf(__m128i a1)
{
float result; // xmm0_4
float v2; // [rsp+4h] [rbp-4h]

v2 = *(float *)a1.m128i_i32;
result = COERCE_FLOAT(floorf(a1));
if ( v2 > result )
result = result + 1.0;
return result;
}

canonical_decompiled_code:
float __fastcall func1(__m128i a1)
{
float result; // xmm0_4
float v2; // [rsp+4h] [rbp-4h]

v2 = *(float *)a1.m128i_i32;
result = COERCE_FLOAT(floorf(a1));
if ( v2 > result )
result = result + 1.0;
return result;
}

original_code:
float ceilf( float x )
{
float y;
y = floorf( (float )x );
if( y < x )
 y += 1.0;
return(y);
}

canonical_original_code:
float ceilf(float x)
{
float y;
y = floorf( (float )x );
if( y < x )
 y += 1.0;
return(y);
}


frexpf

variable_types:
u
union { float y; unsigned short i[2]; }

variable_types: i int

variable_types: k int

variable_types:
q
short *


ldexpf

decompiled_code:
double __fastcall ldexpf(int a1, __m128i a2)
{
signed int v2; // edx
double result; // xmm0_8
int v4; // ecx
__m128i v5; // xmm0
int v6; // eax

v2 = _mm_cvtsi128_si32(a2);
while ( 1 )
{
v4 = v2 >> 16;
if ( (unsigned __int8)(SHIWORD(v2) >> 7) )
break;
v5 = _mm_cvtsi32_si128(v2);
if ( *(float *)v5.m128i_i32 == 0.0 )
return 0.0;
if ( a1 <= 0 )
{
if ( a1 < 0 )
{
if ( a1 < -24 )
return 0.0;
*(float *)v5.m128i_i32 = *(float *)v5.m128i_i32 * 0.5;
v2 = _mm_cvtsi128_si32(v5);
++a1;
}
}
else
{
*(float *)v5.m128i_i32 = *(float *)v5.m128i_i32 + *(float *)v5.m128i_i32;
v2 = _mm_cvtsi128_si32(v5);
--a1;
}
if ( !a1 )
{
*(_QWORD *)&result = _mm_cvtsi32_si128(v2).m128i_u64[0];
return result;
}
}
v6 = a1 + (unsigned __int8)(SHIWORD(v2) >> 7);
if ( v6 > 255 )
{
*(_QWORD *)&result = MAXNUMF;
}
else
{
LOWORD(v4) = HIWORD(v2) & 0x807F;
if ( v6 <= 0 )
{
result = 0.0;
if ( v6 >= -24 )
{
LOBYTE(v4) = v4 | 0x80;
*(_QWORD *)&result = (unsigned int)LC2;
*(float *)&result = ldexpf((unsigned int)(v6 - 1), 1.0, 0.0, COERCE_DOUBLE((unsigned __int64)LC3))
* COERCE_FLOAT((v4 << 16) | (unsigned __int16)v2);
}
}
else
{
*(_QWORD *)&result = _mm_cvtsi32_si128((((v6 << 7) | v4) << 16) | (unsigned int)(unsigned __int16)v2).m128i_u64[0];
}
}
return result;
}

canonical_decompiled_code:
double __fastcall func3(int a1, __m128i a2)
{
signed int v2; // edx
double result; // xmm0_8
int v4; // ecx
__m128i v5; // xmm0
int v6; // eax

v2 = _mm_cvtsi128_si32(a2);
while ( 1 )
{
v4 = v2 >> 16;
if ( (unsigned __int8)(SHIWORD(v2) >> 7) )
break;
v5 = _mm_cvtsi32_si128(v2);
if ( *(float *)v5.m128i_i32 == 0.0 )
return 0.0;
if ( a1 <= 0 )
{
if ( a1 < 0 )
{
if ( a1 < -24 )
return 0.0;
*(float *)v5.m128i_i32 = *(float *)v5.m128i_i32 * 0.5;
v2 = _mm_cvtsi128_si32(v5);
++a1;
}
}
else
{
*(float *)v5.m128i_i32 = *(float *)v5.m128i_i32 + *(float *)v5.m128i_i32;
v2 = _mm_cvtsi128_si32(v5);
--a1;
}
if ( !a1 )
{
*(_QWORD *)&result = _mm_cvtsi32_si128(v2).m128i_u64[0];
return result;
}
}
v6 = a1 + (unsigned __int8)(SHIWORD(v2) >> 7);
if ( v6 > 255 )
{
*(_QWORD *)&result = MAXNUMF;
}
else
{
LOWORD(v4) = HIWORD(v2) & 0x807F;
if ( v6 <= 0 )
{
result = 0.0;
if ( v6 >= -24 )
{
LOBYTE(v4) = v4 | 0x80;
*(_QWORD *)&result = (unsigned int)LC2;
*(float *)&result = func3((unsigned int)(v6 - 1), 1.0, 0.0, COERCE_DOUBLE((unsigned __int64)LC3))
* COERCE_FLOAT((v4 << 16) | (unsigned __int16)v2);
}
}
else
{
*(_QWORD *)&result = _mm_cvtsi32_si128((((v6 << 7) | v4) << 16) | (unsigned int)(unsigned __int16)v2).m128i_u64[0];
}
}
return result;
}

variable_types: e int


powif

canonical_original_code:
float powif(float x, int nn)
{
int n; int e; int sign; int asign; int lx;
float w; float y; float s;
if( x == 0.0 )
 {
 if( nn == 0 )
  return( 1.0 );
 else if( nn < 0 )
  return( MAXNUMF );
 else
  return( 0.0 );
 }
if( nn == 0 )
 return( 1.0 );
if( x < 0.0 )
 {
 asign = -1;
 x = -x;
 }
else
 asign = 0;
if( nn < 0 )
 {
 sign = -1;
 n = -nn;
 }
else
 {
 sign = 0;
 n = nn;
 }
s = frexpf( x, &lx );
e = (lx - 1)*n;
if( (e == 0) || (e > 64) || (e < -64) )
 {
 s = (s - 7.0710678118654752e-1) / (s + 7.0710678118654752e-1);
 s = (2.9142135623730950 * s - 0.5 + lx) * nn * LOGE2F;
 }
else
 {
 s = LOGE2F * e;
 }
if( s > MAXLOGF )
 {
 mtherr( "powi", 3 );
 y = MAXNUMF;
 goto done;
 }
if( s < MINLOGF )
 return(0.0);
if( s < (-MAXLOGF+2.0) )
 {
 x = 1.0/x;
 sign = 0;
 }
if( n & 1 )
 y = x;
else
 {
 y = 1.0;
 asign = 0;
 }
w = x;
n >>= 1;
while( n )
 {
 w = w * w;
 if( n & 1 )
  y *= w;
 n >>= 1;
 }
done:
if( asign )
 y = -y;
if( sign )
 y = 1.0/y;
return(y);
}

variable_types: x float

variable_types: nn int

variable_types: n int

variable_types: asign int

variable_types: lx int

variable_types: w float

variable_types: y float

variable_types: s float


ndtrif

decompiled_code:
float __fastcall ndtrif(double a1)
{
int v1; // ebx
double v2; // xmm1_8
float v3; // xmm0_4
float v4; // xmm2_4
__m128i v5; // xmm3
float v6; // er14
double v7; // xmm6_8
double v8; // xmm0_8
float v9; // xmm1_4
float result; // xmm0_4
double v11; // xmm4_8
double v12; // xmm0_8
double v13; // xmm0_8
float v14; // [rsp+8h] [rbp-20h]
float v15; // [rsp+Ch] [rbp-1Ch]

if ( *(float *)&a1 <= 0.0 )
{
mtherr("ndtrif", 1LL);
LODWORD(result) = MAXNUMF ^ LC2;
}
else if ( *(float *)&a1 >= 1.0 )
{
mtherr("ndtrif", 1LL);
result = MAXNUMF;
}
else
{
v1 = 1;
if ( *(float *)&a1 > 0.8646647167633873 )
{
*(_QWORD *)&v2 = (unsigned int)LC3;
*(float *)&v2 = 1.0 - *(float *)&a1;
a1 = v2;
v1 = 0;
}
if ( *(float *)&a1 > 0.1353352832366127 )
{
HIDWORD(v11) = HIDWORD(a1);
v15 = *(float *)&a1 - 0.5;
*(float *)&v11 = v15 * v15;
v12 = polevlf(&P0, 4LL, v11);
result = (float)((float)((float)((float)(*(float *)&v12 * (float)(v15 * v15)) / p1evlf(&Q0, 8LL, v15 * v15)) * v15)
+ v15)
* 2.5066283;
}
else
{
v3 = logf(*(float *)&a1);
v4 = sqrtf(v3 * -2.0);
v5 = (__m128i)LODWORD(v4);
*(float *)v5.m128i_i32 = v4 - (float)(logf(v4) / v4);
v6 = COERCE_FLOAT(_mm_cvtsi128_si32(v5));
*(_QWORD *)&v7 = (unsigned int)LC3;
v14 = 1.0 / v4;
if ( v4 >= 8.0 )
{
v13 = polevlf(&P2, 8LL, COERCE_DOUBLE((unsigned __int64)LODWORD(v14)));
v9 = (float)(*(float *)&v13 * v14) / p1evlf(&Q2, 8LL, v14);
}
else
{
*(float *)&v7 = 1.0 / v4;
v8 = polevlf(&P1, 8LL, v7);
v9 = (float)(*(float *)&v8 * v14) / p1evlf(&Q1, 8LL, v14);
}
result = v6 - v9;
if ( v1 )
LODWORD(result) ^= LC2;
}
}
return result;
}

canonical_decompiled_code:
float __fastcall func0(double a1)
{
int v1; // ebx
double v2; // xmm1_8
float v3; // xmm0_4
float v4; // xmm2_4
__m128i v5; // xmm3
float v6; // er14
double v7; // xmm6_8
double v8; // xmm0_8
float v9; // xmm1_4
float result; // xmm0_4
double v11; // xmm4_8
double v12; // xmm0_8
double v13; // xmm0_8
float v14; // [rsp+8h] [rbp-20h]
float v15; // [rsp+Ch] [rbp-1Ch]

if ( *(float *)&a1 <= 0.0 )
{
mtherr("ndtrif", 1LL);
LODWORD(result) = MAXNUMF ^ LC2;
}
else if ( *(float *)&a1 >= 1.0 )
{
mtherr("ndtrif", 1LL);
result = MAXNUMF;
}
else
{
v1 = 1;
if ( *(float *)&a1 > 0.8646647167633873 )
{
*(_QWORD *)&v2 = (unsigned int)LC3;
*(float *)&v2 = 1.0 - *(float *)&a1;
a1 = v2;
v1 = 0;
}
if ( *(float *)&a1 > 0.1353352832366127 )
{
HIDWORD(v11) = HIDWORD(a1);
v15 = *(float *)&a1 - 0.5;
*(float *)&v11 = v15 * v15;
v12 = polevlf(&P0, 4LL, v11);
result = (float)((float)((float)((float)(*(float *)&v12 * (float)(v15 * v15)) / p1evlf(&Q0, 8LL, v15 * v15)) * v15)
+ v15)
* 2.5066283;
}
else
{
v3 = logf(*(float *)&a1);
v4 = sqrtf(v3 * -2.0);
v5 = (__m128i)LODWORD(v4);
*(float *)v5.m128i_i32 = v4 - (float)(logf(v4) / v4);
v6 = COERCE_FLOAT(_mm_cvtsi128_si32(v5));
*(_QWORD *)&v7 = (unsigned int)LC3;
v14 = 1.0 / v4;
if ( v4 >= 8.0 )
{
v13 = polevlf(&P2, 8LL, COERCE_DOUBLE((unsigned __int64)LODWORD(v14)));
v9 = (float)(*(float *)&v13 * v14) / p1evlf(&Q2, 8LL, v14);
}
else
{
*(float *)&v7 = 1.0 / v4;
v8 = polevlf(&P1, 8LL, v7);
v9 = (float)(*(float *)&v8 * v14) / p1evlf(&Q1, 8LL, v14);
}
result = v6 - v9;
if ( v1 )
LODWORD(result) ^= LC2;
}
}
return result;
}

canonical_original_code:
float ndtrif(float yy0)
{
float y0; float x; float y; float z; float y2; float x0; float x1;
int code;
y0 = yy0;
if( y0 <= 0.0 )
 {
 mtherr( "ndtrif", 1 );
 return( -MAXNUMF );
 }
if( y0 >= 1.0 )
 {
 mtherr( "ndtrif", 1 );
 return( MAXNUMF );
 }
code = 1;
y = y0;
if( y > (1.0 - 0.13533528323661269189) )
 {
 y = 1.0 - y;
 code = 0;
 }
if( y > 0.13533528323661269189 )
 {
 y = y - 0.5;
 y2 = y * y;
 x = y + y * (y2 * polevlf( y2, P0, 4)/p1evlf( y2, Q0, 8 ));
 x = x * s2pi;
 return(x);
 }
x = sqrtf( -2.0 * logf(y) );
x0 = x - logf(x)/x;
z = 1.0/x;
if( x < 8.0 )
 x1 = z * polevlf( z, P1, 8 )/p1evlf( z, Q1, 8 );
else
 x1 = z * polevlf( z, P2, 8 )/p1evlf( z, Q2, 8 );
x = x0 - x1;
if( code != 0 )
 x = -x;
return( x );
}

variable_types: z float

variable_types: code int


decompiled_code:
float __fastcall expx2f(float a1)
{
float v1; // xmm0_4
float v2; // xmm2_4
float v3; // xmm1_4
float result; // xmm0_4
float x; // [rsp+8h] [rbp-10h]
float xa; // [rsp+8h] [rbp-10h]
float v7; // [rsp+Ch] [rbp-Ch]

x = a1;
if ( a1 < 0.0 )
LODWORD(x) = LODWORD(a1) ^ LC1;
v1 = floorf((float)(x * 32.0) + 0.5) * 0.03125;
v2 = v1 * v1;
xa = (float)((float)(v1 + v1) * (float)(x - v1)) + (float)((float)(x - v1) * (float)(x - v1));
v3 = xa + (float)(v1 * v1);
result = MAXNUMF;
if ( v3 <= MAXLOGF )
{
v7 = expf(v2);
result = expf(xa) * v7;
}
return result;
}

canonical_decompiled_code:
float __fastcall func0(float a1)
{
float v1; // xmm0_4
float v2; // xmm2_4
float v3; // xmm1_4
float result; // xmm0_4
float x; // [rsp+8h] [rbp-10h]
float xa; // [rsp+8h] [rbp-10h]
float v7; // [rsp+Ch] [rbp-Ch]

x = a1;
if ( a1 < 0.0 )
LODWORD(x) = LODWORD(a1) ^ LC1;
v1 = floorf((float)(x * 32.0) + 0.5) * 0.03125;
v2 = v1 * v1;
xa = (float)((float)(v1 + v1) * (float)(x - v1)) + (float)((float)(x - v1) * (float)(x - v1));
v3 = xa + (float)(v1 * v1);
result = MAXNUMF;
if ( v3 <= MAXLOGF )
{
v7 = expf(v2);
result = expf(xa) * v7;
}
return result;
}

original_code:
float expx2f (float x)
{
  float u, u1, m;
  if (x < 0)
    x = -x;
  m = .03125f * floorf(32.0f * x + 0.5f);
  x -= m;
  u = m * m;
  u1 = 2 * m * x + x * x;
  if ((u+u1) > MAXLOGF)
    return (MAXNUMF);
  u = expf(u) * expf(u1);
  return(u);
}

canonical_original_code:
float expx2f(float x)
{
  float u; float u1; float m;
  if (x < 0)
    x = -x;
  m = .03125f * floorf(32.0f * x + 0.5f);
  x -= m;
  u = m * m;
  u1 = 2 * m * x + x * x;
  if ((u+u1) > MAXLOGF)
    return (MAXNUMF);
  u = expf(u) * expf(u1);
  return(u);
}

variable_types: u float

variable_types: m float


incbif

variable_types: aaa float

variable_types: bbb float

variable_types: aa float

variable_types: bb float

variable_types: a float

variable_types: b float

variable_types: d float

variable_types: lgm float

variable_types: yp float

variable_types: di float

variable_types: rflg int


zetacf

decompiled_code:
float __fastcall zetacf(float a1, double a2, double a3, double a4)
{
float result; // xmm0_4
__m128i v5; // xmm5
float v6; // ebx
float v7; // xmm0_4
double v8; // xmm4_8
double v9; // xmm5_8
unsigned int v10; // ebx
float v11; // er14
__m128i v12; // xmm5
float v13; // xmm0_4
float v14; // xmm1_4
__m128i v15; // xmm2
double v16; // xmm4_8
double v17; // xmm5_8
float v18; // xmm1_4
double v19; // xmm1_8
double v20; // xmm4_8
double v21; // xmm5_8
float v22; // xmm7_4
float ya; // [rsp+4h] [rbp-24h]
float v25; // [rsp+8h] [rbp-20h]
float v26; // [rsp+8h] [rbp-20h]
float v27; // [rsp+8h] [rbp-20h]
float v28; // [rsp+8h] [rbp-20h]
float v29; // [rsp+8h] [rbp-20h]
float v30; // [rsp+Ch] [rbp-1Ch]
float v31; // [rsp+Ch] [rbp-1Ch]
float v32; // [rsp+Ch] [rbp-1Ch]

if ( a1 < 0.0 )
{
if ( a1 >= -30.8148 )
{
v5 = (__m128i)(unsigned int)LC1;
*(float *)v5.m128i_i32 = 1.0 - a1;
v6 = COERCE_FLOAT(_mm_cvtsi128_si32(v5));
v30 = zetacf(*(double *)v5.m128i_i64);
v25 = sinf(a1 * PIO2F);
ya = powf(PIF + PIF, a1) * v25;
v7 = (v30 + 1.0) * (float)(gammaf(v6) * ya) / PIF;
result = v7 - 1.0;
}
else
{
mtherr("zetacf", 3LL);
result = 0.0;
}
}
else
{
result = 0.0;
if ( a1 < 127.0 )
{
if ( a1 == floorf(a1) && (int)a1 <= 30 )
{
result = azetacf[a1];
}
else if ( a1 < 1.0 )
{
v27 = polevlf(&R, 5LL, a1, a2, a3, a4, v8, v9, COERCE_DOUBLE((unsigned __int64)LODWORD(a1)));
result = v27 / (float)((float)(1.0 - a1) * p1evlf(&S, 5LL, a1));
}
else if ( a1 == 1.0 )
{
mtherr("zetacf", 2LL);
result = MAXNUMF;
}
else if ( a1 <= 10.0 )
{
v28 = powf(2.0, a1);
v15 = (__m128i)(unsigned int)LC1;
*(float *)v15.m128i_i32 = 1.0 / a1;
v31 = polevlf(
&P,
8LL,
1.0 / a1,
COERCE_DOUBLE((unsigned __int64)LODWORD(a1)),
*(double *)v15.m128i_i64,
a4,
v16,
v17,
COERCE_DOUBLE((unsigned __int64)LODWORD(a1)))
* a1;
v18 = (a1 - 1.0) * v28;
result = v31 / (float)(v18 * p1evlf(&Q, 8LL, COERCE_FLOAT(_mm_cvtsi128_si32(v15))));
}
else if ( a1 <= 50.0 )
{
*(_QWORD *)&v19 = LODWORD(a1) ^ (unsigned __int64)LC9;
v32 = powf(2.0, *(float *)&v19);
v29 = polevlf(&A, 10LL, a1, v19, a3, a4, v20, v21, COERCE_DOUBLE((unsigned __int64)LODWORD(a1)));
v22 = v29 / p1evlf(&B, 10LL, a1);
result = expf(v22) + v32;
}
else
{
v26 = 0.0;
v10 = LC1;
v11 = COERCE_FLOAT(_mm_cvtsi128_si32((__m128i)_mm_xor_ps((__m128)LODWORD(a1), (__m128)LC9)));
do
{
v12 = _mm_cvtsi32_si128(v10);
*(float *)v12.m128i_i32 = *(float *)v12.m128i_i32 + 2.0;
v10 = _mm_cvtsi128_si32(v12);
v13 = powf(*(float *)v12.m128i_i32, v11);
v26 = v26 + v13;
}
while ( (float)(v13 / v26) > MACHEPF );
v14 = powf(2.0, v11);
result = (float)(v26 + v14) / (1.0 - v14);
}
}
}
return result;
}

canonical_decompiled_code:
float __fastcall func0(float a1, double a2, double a3, double a4)
{
float result; // xmm0_4
__m128i v5; // xmm5
float v6; // ebx
float v7; // xmm0_4
double v8; // xmm4_8
double v9; // xmm5_8
unsigned int v10; // ebx
float v11; // er14
__m128i v12; // xmm5
float v13; // xmm0_4
float v14; // xmm1_4
__m128i v15; // xmm2
double v16; // xmm4_8
double v17; // xmm5_8
float v18; // xmm1_4
double v19; // xmm1_8
double v20; // xmm4_8
double v21; // xmm5_8
float v22; // xmm7_4
float ya; // [rsp+4h] [rbp-24h]
float v25; // [rsp+8h] [rbp-20h]
float v26; // [rsp+8h] [rbp-20h]
float v27; // [rsp+8h] [rbp-20h]
float v28; // [rsp+8h] [rbp-20h]
float v29; // [rsp+8h] [rbp-20h]
float v30; // [rsp+Ch] [rbp-1Ch]
float v31; // [rsp+Ch] [rbp-1Ch]
float v32; // [rsp+Ch] [rbp-1Ch]

if ( a1 < 0.0 )
{
if ( a1 >= -30.8148 )
{
v5 = (__m128i)(unsigned int)LC1;
*(float *)v5.m128i_i32 = 1.0 - a1;
v6 = COERCE_FLOAT(_mm_cvtsi128_si32(v5));
v30 = func0(*(double *)v5.m128i_i64);
v25 = sinf(a1 * PIO2F);
ya = powf(PIF + PIF, a1) * v25;
v7 = (v30 + 1.0) * (float)(gammaf(v6) * ya) / PIF;
result = v7 - 1.0;
}
else
{
mtherr("zetacf", 3LL);
result = 0.0;
}
}
else
{
result = 0.0;
if ( a1 < 127.0 )
{
if ( a1 == floorf(a1) && (int)a1 <= 30 )
{
result = azetacf[a1];
}
else if ( a1 < 1.0 )
{
v27 = polevlf(&R, 5LL, a1, a2, a3, a4, v8, v9, COERCE_DOUBLE((unsigned __int64)LODWORD(a1)));
result = v27 / (float)((float)(1.0 - a1) * p1evlf(&S, 5LL, a1));
}
else if ( a1 == 1.0 )
{
mtherr("zetacf", 2LL);
result = MAXNUMF;
}
else if ( a1 <= 10.0 )
{
v28 = powf(2.0, a1);
v15 = (__m128i)(unsigned int)LC1;
*(float *)v15.m128i_i32 = 1.0 / a1;
v31 = polevlf(
&P,
8LL,
1.0 / a1,
COERCE_DOUBLE((unsigned __int64)LODWORD(a1)),
*(double *)v15.m128i_i64,
a4,
v16,
v17,
COERCE_DOUBLE((unsigned __int64)LODWORD(a1)))
* a1;
v18 = (a1 - 1.0) * v28;
result = v31 / (float)(v18 * p1evlf(&Q, 8LL, COERCE_FLOAT(_mm_cvtsi128_si32(v15))));
}
else if ( a1 <= 50.0 )
{
*(_QWORD *)&v19 = LODWORD(a1) ^ (unsigned __int64)LC9;
v32 = powf(2.0, *(float *)&v19);
v29 = polevlf(&A, 10LL, a1, v19, a3, a4, v20, v21, COERCE_DOUBLE((unsigned __int64)LODWORD(a1)));
v22 = v29 / p1evlf(&B, 10LL, a1);
result = expf(v22) + v32;
}
else
{
v26 = 0.0;
v10 = LC1;
v11 = COERCE_FLOAT(_mm_cvtsi128_si32((__m128i)_mm_xor_ps((__m128)LODWORD(a1), (__m128)LC9)));
do
{
v12 = _mm_cvtsi32_si128(v10);
*(float *)v12.m128i_i32 = *(float *)v12.m128i_i32 + 2.0;
v10 = _mm_cvtsi128_si32(v12);
v13 = powf(*(float *)v12.m128i_i32, v11);
v26 = v26 + v13;
}
while ( (float)(v13 / v26) > MACHEPF );
v14 = powf(2.0, v11);
result = (float)(v26 + v14) / (1.0 - v14);
}
}
}
return result;
}

canonical_original_code:
float zetacf(float xx)
{
int i;
float x; float a; float b; float s; float w;
x = xx;
if( x < 0.0 )
 {
 if( x < -30.8148 )
  {
  mtherr( "zetacf", 3 );
  return(0.0);
  }
 s = 1.0 - x;
 w = zetacf( s );
 b = sinf(PIO2F*x) * powf(2.0*PIF, x) * gammaf(s) * (1.0 + w) / PIF;
 return(b - 1.0);
 }
if( x >= 127 )
 return(0.0);
w = floorf(x);
if( w == x )
 {
 i = x;
 if( i < 31 )
  {
  return( azetacf[i] );
  }
 }
if( x < 1.0 )
 {
 w = 1.0 - x;
 a = polevlf( x, R, 5 ) / ( w * p1evlf( x, S, 5 ));
 return( a );
 }
if( x == 1.0 )
 {
 mtherr( "zetacf", 2 );
 return( MAXNUMF );
 }
if( x <= 10.0 )
 {
 b = powf( 2.0, x ) * (x - 1.0);
 w = 1.0/x;
 s = (x * polevlf( w, P, 8 )) / (b * p1evlf( w, Q, 8 ));
 return( s );
 }
if( x <= 50.0 )
 {
 b = powf( 2.0, -x );
 w = polevlf( x, A, 10 ) / p1evlf( x, B, 10 );
 w = expf(w) + b;
 return(w);
 }
s = 0.0;
a = 1.0;
do
 {
 a += 2.0;
 b = powf( a, -x );
 s += b;
 }
while( b/s > MACHEPF );
b = powf( 2.0, -x );
s = (s + b)/(1.0-b);
return(s);
}

variable_types: xx float

variable_types: i int

variable_types: x float

variable_types: w float


expf

variable_types: z float

variable_types: n int


betaf

decompiled_code:
float __fastcall betaf(float a1, float a2)
{
__m128 v2; // xmm1
__m128 v3; // xmm2
__m128 v4; // xmm2
int v5; // ebx
float v6; // xmm0_4
int v7; // ebx
float v8; // xmm0_4
int v9; // ebx
float result; // xmm0_4
float v11; // xmm0_4
float xa; // [rsp+4h] [rbp-14h]
float v15; // [rsp+8h] [rbp-10h]
float v16; // [rsp+Ch] [rbp-Ch]

if ( a1 <= 0.0 )
{
v9 = 1;
if ( floorf(a1) == a1 )
goto LABEL_5;
}
if ( a2 <= 0.0 )
{
v9 = 1;
if ( floorf(a2) == a2 )
goto LABEL_5;
}
v2 = (__m128)LODWORD(a1);
v2.m128_f32[0] = a1 + a2;
v3.m128_f32[0] = a1 + a2;
v4 = _mm_cmplt_ss(v3, (__m128)0LL);
if ( COERCE_FLOAT((COERCE_UNSIGNED_INT(a1 + a2) ^ LC1) & v4.m128_i32[0] | _mm_andnot_ps(v4, v2).m128_u32[0]) <= 34.84425627277176 )
{
v11 = gammaf(v2.m128_f32[0]);
v9 = 1;
if ( v11 == 0.0 )
goto LABEL_5;
if ( a1 <= a2 )
{
xa = gammaf(a2) / v11;
result = gammaf(a1) * xa;
}
else
{
v15 = gammaf(a1) / v11;
result = gammaf(a2) * v15;
}
}
else
{
v16 = lgamf(*(double *)v2.m128_u64);
v5 = sgngamf;
v6 = lgamf(COERCE_DOUBLE((unsigned __int64)LODWORD(a2)));
v7 = sgngamf * v5;
v8 = lgamf(COERCE_DOUBLE((unsigned __int64)LODWORD(a1))) + (float)(v6 - v16);
v9 = sgngamf * v7;
if ( v8 > MAXLOGF )
{
LABEL_5:
mtherr("betaf", 3LL);
return (float)v9 * MAXNUMF;
}
result = (float)v9 * expf(v8);
}
return result;
}

canonical_decompiled_code:
float __fastcall func0(float a1, float a2)
{
__m128 v2; // xmm1
__m128 v3; // xmm2
__m128 v4; // xmm2
int v5; // ebx
float v6; // xmm0_4
int v7; // ebx
float v8; // xmm0_4
int v9; // ebx
float result; // xmm0_4
float v11; // xmm0_4
float xa; // [rsp+4h] [rbp-14h]
float v15; // [rsp+8h] [rbp-10h]
float v16; // [rsp+Ch] [rbp-Ch]

if ( a1 <= 0.0 )
{
v9 = 1;
if ( floorf(a1) == a1 )
goto LABEL_5;
}
if ( a2 <= 0.0 )
{
v9 = 1;
if ( floorf(a2) == a2 )
goto LABEL_5;
}
v2 = (__m128)LODWORD(a1);
v2.m128_f32[0] = a1 + a2;
v3.m128_f32[0] = a1 + a2;
v4 = _mm_cmplt_ss(v3, (__m128)0LL);
if ( COERCE_FLOAT((COERCE_UNSIGNED_INT(a1 + a2) ^ LC1) & v4.m128_i32[0] | _mm_andnot_ps(v4, v2).m128_u32[0]) <= 34.84425627277176 )
{
v11 = gammaf(v2.m128_f32[0]);
v9 = 1;
if ( v11 == 0.0 )
goto LABEL_5;
if ( a1 <= a2 )
{
xa = gammaf(a2) / v11;
result = gammaf(a1) * xa;
}
else
{
v15 = gammaf(a1) / v11;
result = gammaf(a2) * v15;
}
}
else
{
v16 = lgamf(*(double *)v2.m128_u64);
v5 = sgngamf;
v6 = lgamf(COERCE_DOUBLE((unsigned __int64)LODWORD(a2)));
v7 = sgngamf * v5;
v8 = lgamf(COERCE_DOUBLE((unsigned __int64)LODWORD(a1))) + (float)(v6 - v16);
v9 = sgngamf * v7;
if ( v8 > MAXLOGF )
{
LABEL_5:
mtherr("betaf", 3LL);
return (float)v9 * MAXNUMF;
}
result = (float)v9 * expf(v8);
}
return result;
}

original_code:
float betaf( float aa, float bb )
{
float a, b, y;
int sign;
sign = 1;
a = aa;
b = bb;
if( a <= 0.0 )
 {
 if( a == floorf(a) )
  goto over;
 }
if( b <= 0.0 )
 {
 if( b == floorf(b) )
  goto over;
 }
y = a + b;
if( ( (y) < 0 ? -(y) : (y) ) > 34.84425627277176174 )
 {
 y = lgamf(y);
 sign *= sgngamf;
 y = lgamf(b) - y;
 sign *= sgngamf;
 y = lgamf(a) + y;
 sign *= sgngamf;
 if( y > MAXLOGF )
  {
over:
  mtherr( "betaf", 3 );
  return( sign * MAXNUMF );
  }
 return( sign * expf(y) );
 }
y = gammaf(y);
if( y == 0.0 )
 goto over;
if( a > b )
 {
 y = gammaf(a)/y;
 y *= gammaf(b);
 }
else
 {
 y = gammaf(b)/y;
 y *= gammaf(a);
 }
return(y);
}

canonical_original_code:
float betaf(float aa, float bb)
{
float a; float b; float y;
int sign;
sign = 1;
a = aa;
b = bb;
if( a <= 0.0 )
 {
 if( a == floorf(a) )
  goto over;
 }
if( b <= 0.0 )
 {
 if( b == floorf(b) )
  goto over;
 }
y = a + b;
if( ( (y) < 0 ? -(y) : (y) ) > 34.84425627277176174 )
 {
 y = lgamf(y);
 sign *= sgngamf;
 y = lgamf(b) - y;
 sign *= sgngamf;
 y = lgamf(a) + y;
 sign *= sgngamf;
 if( y > MAXLOGF )
  {
over:
  mtherr( "betaf", 3 );
  return( sign * MAXNUMF );
  }
 return( sign * expf(y) );
 }
y = gammaf(y);
if( y == 0.0 )
 goto over;
if( a > b )
 {
 y = gammaf(a)/y;
 y *= gammaf(b);
 }
else
 {
 y = gammaf(b)/y;
 y *= gammaf(a);
 }
return(y);
}

variable_types: y float

variable_types: sign int


fdtrcf

decompiled_code:
double __fastcall fdtrcf(int a1, int a2, float a3)
{
double v3; // xmm4_8
float v4; // xmm2_4
double result; // xmm0_8

if ( a1 <= 0 || a2 <= 0 || a3 < 0.0 )
{
mtherr("fdtrcf", 1LL);
result = 0.0;
}
else
{
HIDWORD(v3) = 0;
*(float *)&v3 = (float)a2 * 0.5;
v4 = (float)a2 / (float)((float)(a3 * (float)a1) + (float)a2);
result = v3;
incbetf(v3, 0.5 * (float)a1, v4);
}
return result;
}

canonical_decompiled_code:
double __fastcall func0(int a1, int a2, float a3)
{
double v3; // xmm4_8
float v4; // xmm2_4
double result; // xmm0_8

if ( a1 <= 0 || a2 <= 0 || a3 < 0.0 )
{
mtherr("fdtrcf", 1LL);
result = 0.0;
}
else
{
HIDWORD(v3) = 0;
*(float *)&v3 = (float)a2 * 0.5;
v4 = (float)a2 / (float)((float)(a3 * (float)a1) + (float)a2);
result = v3;
incbetf(v3, 0.5 * (float)a1, v4);
}
return result;
}

original_code:
float fdtrcf( int ia, int ib, float xx )
{
float x, a, b, w;
x = xx;
if( (ia < 1) || (ib < 1) || (x < 0.0) )
 {
 mtherr( "fdtrcf", 1 );
 return( 0.0 );
 }
a = ia;
b = ib;
w = b / (b + a * x);
return( incbetf( 0.5*b, 0.5*a, w ) );
}

canonical_original_code:
float fdtrcf(int ia, int ib, float xx)
{
float x; float a; float b; float w;
x = xx;
if( (ia < 1) || (ib < 1) || (x < 0.0) )
 {
 mtherr( "fdtrcf", 1 );
 return( 0.0 );
 }
a = ia;
b = ib;
w = b / (b + a * x);
return( incbetf( 0.5*b, 0.5*a, w ) );
}

variable_types: ia int

variable_types: ib int