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, char a7)
{
__int64 v7; // r12
unsigned __int64 v8; // rbx
__int64 result; // rax
__int64 j; // 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 i; // [rsp+1Ch] [rbp-ECh]
char *v18; // [rsp+28h] [rbp-E0h]
char v19[216]; // [rsp+30h] [rbp-D8h] BYREF

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

canonical_decompiled_code:
__int64 __fastcall func1(__int64 a1, __int64 a2, __int64 a3, __int64 a4, __int64 a5, __int64 a6, char a7)
{
__int64 v7; // r12
unsigned __int64 v8; // rbx
__int64 result; // rax
__int64 j; // 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 i; // [rsp+1Ch] [rbp-ECh]
char *v18; // [rsp+28h] [rbp-E0h]
char v19[216]; // [rsp+30h] [rbp-D8h] BYREF

v7 = 0LL;
v8 = 0LL;
v15 = -17847;
v18 = &a7;
v13 = -17599;
v14 = (int)checkblock_0;
v16 = &v11;
v11 = duplist;
result = sblock;
for ( i = -1864106167; *(_QWORD *)(result + 72) > v7; ++v7 )
{
for ( j = 0LL; *(_QWORD *)(result + 352) > j; ++j )
{
if ( v8 > 1 )
{
if ( *(_BYTE *)(inodestate + v8) )
{
getinode(v8, v19);
v12 = 0;
allblock_iterate(v19, &v13);
result = sblock;
if ( v12 )
{
problem(1LL, "I=%Ld HAS %d DUPLICATE BLOCKS", v8);
if ( (unsigned int)reply("CLEAR") )
{
clear_inode(v8, v19);
*(_BYTE *)(inodestate + v8) = 0;
result = sblock;
}
else
{
result = sblock;
if ( *(_BYTE *)(v8 + inodestate) == 2 )
{
*(_BYTE *)(v8 + inodestate) = 3;
result = sblock;
}
}
}
}
}
++v8;
}
}
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(double a1, double a2)
{
double v2; // xmm2_8
double result; // xmm0_8

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

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

HIDWORD(v2) = HIDWORD(a1);
if ( *(float *)&a2 < 0.0 || *(float *)&a1 < 1.0 )
{
mtherr("chdtrcf", 1LL, 0.0, a2, a1);
result = 0.0;
}
else
{
*(float *)&v2 = *(float *)&a1 * 0.5;
result = v2;
igamcf(v2, *(float *)&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(double a1, double a2)
{
double v2; // xmm2_8
double result; // xmm0_8

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

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

HIDWORD(v2) = HIDWORD(a1);
if ( *(float *)&a2 < 0.0 || *(float *)&a1 < 1.0 )
{
mtherr("chdtrf", 1LL, 0.0, a2, a1);
result = 0.0;
}
else
{
*(float *)&v2 = *(float *)&a1 * 0.5;
result = v2;
igamf(v2, *(float *)&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(double result, double a2, double a3)
{
float v3; // xmm0_4

if ( *(float *)&a2 < 0.0 || (*(_QWORD *)&a3 = (unsigned int)LC1, *(float *)&a2 > 1.0) || *(float *)&result < 1.0 )
{
mtherr("chdtrif", 1LL, result, a2, a3);
result = 0.0;
}
else
{
v3 = igamif(*(float *)&result * 0.5);
*(float *)&result = v3 + v3;
}
return result;
}

canonical_decompiled_code:
double __fastcall func2(double result, double a2, double a3)
{
float v3; // xmm0_4

if ( *(float *)&a2 < 0.0 || (*(_QWORD *)&a3 = (unsigned int)LC1, *(float *)&a2 > 1.0) || *(float *)&result < 1.0 )
{
mtherr("chdtrif", 1LL, result, a2, a3);
result = 0.0;
}
else
{
v3 = igamif(*(float *)&result * 0.5);
*(float *)&result = v3 + v3;
}
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


sprec

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

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

original_code: int sprec() {return 0;}

canonical_original_code: int sprec() {return 0;}

return_type: int


dprec

decompiled_code:
// attributes: thunk
__int64 dprec()
{
return sprec();
}

canonical_decompiled_code:
__int64 func2()
{
return func1();
}

original_code: int dprec() {return 0;}

canonical_original_code: int dprec() {return 0;}


ldprec

decompiled_code:
// attributes: thunk
__int64 ldprec()
{
return sprec();
}

canonical_decompiled_code:
__int64 func3()
{
return func1();
}

original_code: int ldprec() {return 0;}

canonical_original_code: int ldprec() {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
_BOOL8 v7; // rax
int v8; // er12
__int64 v9; // rbx
int v10; // ebp

v4 = a3 + 8;
LC1 = 37;
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 = a3 > 9;
v8 = a3 + 9;
strcpy(&v6[v7 + 2], "e ");
if ( a2 >= 0 )
{
v9 = 0LL;
v10 = 0;
do
{
v10 += v8;
if ( v10 > 77 )
{
v10 = v8;
printf("\n");
}
printf(&LC1, *(float *)(a1 + 4 * v9++));
}
while ( a2 >= (int)v9 );
}
return printf("\n");
}

canonical_decompiled_code:
int __fastcall func1(__int64 a1, int a2, int a3)
{
int v4; // ebx
bool v5; // cc
char *v6; // rbx
_BOOL8 v7; // rax
int v8; // er12
__int64 v9; // rbx
int v10; // ebp

v4 = a3 + 8;
LC1 = 37;
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 = a3 > 9;
v8 = a3 + 9;
strcpy(&v6[v7 + 2], "e ");
if ( a2 >= 0 )
{
v9 = 0LL;
v10 = 0;
do
{
v10 += v8;
if ( v10 > 77 )
{
v10 = v8;
printf("\n");
}
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)
{
int v7; // edx
__int64 result; // rax
__int64 v10; // rcx
__int64 v11; // rdx
float v12; // xmm0_4

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

canonical_decompiled_code:
__int64 __fastcall func5(__int64 a1, int a2, __int64 a3, int a4, __int64 a5)
{
int v7; // edx
__int64 result; // rax
__int64 v10; // rcx
__int64 v11; // rdx
float v12; // xmm0_4

v7 = a4;
if ( a2 >= a4 )
v7 = a2;
if ( MAXPOLF <= v7 )
v7 = MAXPOLF;
result = 0LL;
v10 = v7;
if ( v7 >= 0 )
{
while ( 1 )
{
if ( (int)result > a2 )
{
v11 = result + 1;
*(_DWORD *)(a5 + 4 * result) = *(_DWORD *)(a3 + 4 * result);
if ( result == v10 )
return result;
}
else
{
v12 = *(float *)(a1 + 4 * result);
if ( (int)result <= a4 )
v12 = v12 + *(float *)(a3 + 4 * result);
*(float *)(a5 + 4 * result) = v12;
v11 = result + 1;
if ( result == v10 )
return result;
}
result = v11;
}
}
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)
{
int v7; // edx
__int64 result; // rax
__int64 v10; // rcx
__int64 v11; // rdx
float v12; // xmm0_4

v7 = a4;
if ( a2 >= a4 )
v7 = a2;
if ( MAXPOLF <= v7 )
v7 = MAXPOLF;
result = 0LL;
v10 = v7;
if ( v7 >= 0 )
{
while ( (int)result <= a2 )
{
v12 = *(float *)(a1 + 4 * result);
if ( (int)result <= a4 )
{
*(float *)(a5 + 4 * result) = *(float *)(a3 + 4 * result) - v12;
LABEL_8:
v11 = result + 1;
if ( result == v10 )
return result;
goto LABEL_9;
}
v11 = result + 1;
*(_DWORD *)(a5 + 4 * result) = LODWORD(v12) ^ LC5;
if ( result == v10 )
return result;
LABEL_9:
result = v11;
}
*(_DWORD *)(a5 + 4 * result) = *(_DWORD *)(a3 + 4 * result);
goto LABEL_8;
}
return result;
}

canonical_decompiled_code:
__int64 __fastcall func6(__int64 a1, int a2, __int64 a3, int a4, __int64 a5)
{
int v7; // edx
__int64 result; // rax
__int64 v10; // rcx
__int64 v11; // rdx
float v12; // xmm0_4

v7 = a4;
if ( a2 >= a4 )
v7 = a2;
if ( MAXPOLF <= v7 )
v7 = MAXPOLF;
result = 0LL;
v10 = v7;
if ( v7 >= 0 )
{
while ( (int)result <= a2 )
{
v12 = *(float *)(a1 + 4 * result);
if ( (int)result <= a4 )
{
*(float *)(a5 + 4 * result) = *(float *)(a3 + 4 * result) - v12;
LABEL_8:
v11 = result + 1;
if ( result == v10 )
return result;
goto LABEL_9;
}
v11 = result + 1;
*(_DWORD *)(a5 + 4 * result) = LODWORD(v12) ^ LC5;
if ( result == v10 )
return result;
LABEL_9:
result = v11;
}
*(_DWORD *)(a5 + 4 * result) = *(_DWORD *)(a3 + 4 * result);
goto LABEL_8;
}
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

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:
__m128 __fastcall erff(__m128 result)
{
__int128 v1; // xmm2

if ( result.m128_f32[0] < 0.0 )
{
LODWORD(v1) = LC2;
if ( result.m128_f32[0] >= -1.0 )
goto LABEL_3;
}
else
{
LODWORD(v1) = LC2;
if ( result.m128_f32[0] <= 1.0 )
{
LABEL_3:
result.m128_f32[0] = polevlf(&T, 6LL, result.m128_f32[0] * result.m128_f32[0]) * result.m128_f32[0];
return result;
}
}
v1 = (unsigned int)v1;
*(float *)&v1 = *(float *)&v1 - erfcf(*(double *)result.m128_u64);
return (__m128)v1;
}

canonical_decompiled_code:
__m128 __fastcall func0(__m128 result)
{
__int128 v1; // xmm2

if ( result.m128_f32[0] < 0.0 )
{
LODWORD(v1) = LC2;
if ( result.m128_f32[0] >= -1.0 )
goto LABEL_3;
}
else
{
LODWORD(v1) = LC2;
if ( result.m128_f32[0] <= 1.0 )
{
LABEL_3:
result.m128_f32[0] = polevlf(&T, 6LL, result.m128_f32[0] * result.m128_f32[0]) * result.m128_f32[0];
return result;
}
}
v1 = (unsigned int)v1;
*(float *)&v1 = *(float *)&v1 - func1(*(double *)result.m128_u64);
return (__m128)v1;
}

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 v2; // xmm2_4
float result; // xmm0_4
float v4; // [rsp+0h] [rbp-14h]
float v5; // [rsp+0h] [rbp-14h]
float v6; // [rsp+0h] [rbp-14h]
float v7; // [rsp+8h] [rbp-Ch]

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

canonical_decompiled_code:
float __fastcall func0(float a1)
{
float v2; // xmm2_4
float result; // xmm0_4
float v4; // [rsp+0h] [rbp-14h]
float v5; // [rsp+0h] [rbp-14h]
float v6; // [rsp+0h] [rbp-14h]
float v7; // [rsp+8h] [rbp-Ch]

if ( a1 <= 0.0 )
{
mtherr(&unk_2AD, 1LL);
result = MAXNUMF;
}
else
{
if ( a1 <= 2.0 )
{
v7 = chbevlf(&A, 7LL, (float)(a1 * a1) - 2.0);
v6 = logf(a1 * 0.5);
v2 = v7 - (float)(v6 * i0f(COERCE_DOUBLE((unsigned __int64)LODWORD(a1))));
}
else
{
v4 = expf(COERCE_FLOAT(LODWORD(a1) ^ LC4));
v5 = v4 * chbevlf(&B, 10LL, (float)(8.0 / a1) - 2.0);
v2 = v5 / sqrtf(a1);
}
result = v2;
}
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; // xmm2_4
float v4; // [rsp+0h] [rbp-14h]
float v5; // [rsp+0h] [rbp-14h]
float v6; // [rsp+8h] [rbp-Ch]

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

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

if ( a1 <= 0.0 )
{
mtherr("k0ef", 1LL);
result = MAXNUMF;
}
else if ( a1 <= 2.0 )
{
v6 = chbevlf(&A, 7LL, (float)(a1 * a1) - 2.0);
v5 = logf(a1 * 0.5);
v3 = v6 - (float)(i0f(COERCE_DOUBLE((unsigned __int64)LODWORD(a1))) * v5);
result = expf(a1) * v3;
}
else
{
v4 = chbevlf(&B, 10LL, (float)(8.0 / a1) - 2.0);
result = v4 / 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

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
char *v2; // rdi
_BYTE v4[64]; // [rsp+0h] [rbp-98h] BYREF
char v5[88]; // [rsp+40h] [rbp-58h] BYREF

v0 = gstrs;
v1 = (char *)&qgamcof;
do
{
v2 = *v0;
v0 += 4;
asctoq(v2, v1);
asctoq(*(v0 - 3), v4);
asctoq(*(v0 - 2), v5);
qmul(v4, v5, v4);
asctoq(*(v0 - 1), v5);
qmul(v4, v5, v4);
qdiv(v4, v1, v1);
v1 += 56;
}
while ( v1 != (char *)&qgamcof + 3080 );
qgamini = 1;
return 0LL;
}

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

v0 = gstrs;
v1 = (char *)&qgamcof;
do
{
v2 = *v0;
v0 += 4;
asctoq(v2, v1);
asctoq(*(v0 - 3), v4);
asctoq(*(v0 - 2), v5);
qmul(v4, v5, v4);
asctoq(*(v0 - 1), v5);
qmul(v4, v5, v4);
qdiv(v4, v1, v1);
v1 += 56;
}
while ( v1 != (char *)&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)
{
double v2; // xmm3_8
float v3; // xmm2_4
float v4; // xmm1_4
float result; // xmm0_4
float v6; // xmm1_4
float v7; // xmm0_4
int v8; // ebx
float v9; // xmm0_4
float v10; // xmm4_4
float v11; // xmm0_4
float v13; // [rsp+0h] [rbp-18h]
float v14; // [rsp+4h] [rbp-14h]

v14 = a2;
*(float *)&v2 = a1;
v3 = a2;
v4 = floorf(a1);
result = 0.0;
if ( *(float *)&v2 != v4 || a1 >= 0.0 )
{
if ( v3 >= 0.0 )
goto LABEL_4;
LABEL_11:
if ( *(float *)&v2 != v4 )
{
mtherr(&unk_232, 1LL);
return 0.0;
}
v11 = floorf(*(float *)&v2 * 0.5);
v6 = *(float *)&LC4;
v3 = v14;
v8 = 1;
if ( *(float *)&v2 != v11 + v11 )
v8 = -1;
LODWORD(v7) = LODWORD(v14) ^ LC2;
LABEL_9:
v9 = logf(v7 * v6);
v13 = expf((float)(v9 * *(float *)&v2) - v3) * (float)v8;
*(_QWORD *)&v2 = LODWORD(v2);
v10 = v13 / gammaf(*(float *)&v2 + 1.0);
*(float *)&v2 = *(float *)&v2 + v6;
return hypergf(v2, *(float *)&v2 + *(float *)&v2, v3 + v3) * v10;
}
LODWORD(v2) = LODWORD(a1) ^ LC2;
LODWORD(v4) ^= LC2;
if ( v3 < 0.0 )
goto LABEL_11;
LABEL_4:
if ( v3 != 0.0 )
{
v6 = *(float *)&LC4;
v7 = v14;
v8 = 1;
goto LABEL_9;
}
if ( *(float *)&v2 == 0.0 )
return *(float *)&LC1;
if ( *(float *)&v2 < 0.0 )
{
mtherr(&unk_232, 3LL);
result = MAXNUMF;
}
return result;
}

canonical_decompiled_code:
float __fastcall func0(float a1, float a2)
{
double v2; // xmm3_8
float v3; // xmm2_4
float v4; // xmm1_4
float result; // xmm0_4
float v6; // xmm1_4
float v7; // xmm0_4
int v8; // ebx
float v9; // xmm0_4
float v10; // xmm4_4
float v11; // xmm0_4
float v13; // [rsp+0h] [rbp-18h]
float v14; // [rsp+4h] [rbp-14h]

v14 = a2;
*(float *)&v2 = a1;
v3 = a2;
v4 = floorf(a1);
result = 0.0;
if ( *(float *)&v2 != v4 || a1 >= 0.0 )
{
if ( v3 >= 0.0 )
goto LABEL_4;
LABEL_11:
if ( *(float *)&v2 != v4 )
{
mtherr(&unk_232, 1LL);
return 0.0;
}
v11 = floorf(*(float *)&v2 * 0.5);
v6 = *(float *)&LC4;
v3 = v14;
v8 = 1;
if ( *(float *)&v2 != v11 + v11 )
v8 = -1;
LODWORD(v7) = LODWORD(v14) ^ LC2;
LABEL_9:
v9 = logf(v7 * v6);
v13 = expf((float)(v9 * *(float *)&v2) - v3) * (float)v8;
*(_QWORD *)&v2 = LODWORD(v2);
v10 = v13 / gammaf(*(float *)&v2 + 1.0);
*(float *)&v2 = *(float *)&v2 + v6;
return hypergf(v2, *(float *)&v2 + *(float *)&v2, v3 + v3) * v10;
}
LODWORD(v2) = LODWORD(a1) ^ LC2;
LODWORD(v4) ^= LC2;
if ( v3 < 0.0 )
goto LABEL_11;
LABEL_4:
if ( v3 != 0.0 )
{
v6 = *(float *)&LC4;
v7 = v14;
v8 = 1;
goto LABEL_9;
}
if ( *(float *)&v2 == 0.0 )
return *(float *)&LC1;
if ( *(float *)&v2 < 0.0 )
{
mtherr(&unk_232, 3LL);
result = MAXNUMF;
}
return result;
}

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


acoshf

decompiled_code:
void __fastcall acoshf(float a1)
{
float v2; // xmm0_4
float v3; // xmm0_4

if ( a1 < 1.0 )
{
mtherr("acoshf", 1LL);
}
else if ( a1 > 1500.0 )
{
logf(a1);
}
else if ( (float)(a1 - 1.0) >= 0.5 )
{
v2 = (a1 + 1.0) * (float)(a1 - 1.0);
v3 = sqrtf(v2);
logf(v3 + a1);
}
else
{
sqrtf(a1 - 1.0);
}
}


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

decompiled_code:
float __fastcall lgamf(double a1, double a2, double a3, double a4, double a5, double a6, double a7)
{
double v7; // xmm5_8
double v8; // xmm1_8
double v9; // xmm0_8
double v10; // xmm2_8
float result; // xmm0_4
double v12; // xmm0_8
int v13; // eax
float v14; // xmm2_4
float v15; // xmm0_4
float v16; // xmm2_4
float v17; // xmm0_4
float v18; // xmm3_4
float v19; // xmm0_4
float v20; // xmm2_4
float v21; // xmm0_4
float v22; // xmm0_4
double v23; // xmm0_8
float v24; // xmm2_4
double v25; // xmm0_8
float v26; // [rsp+0h] [rbp-28h]
float v27; // [rsp+0h] [rbp-28h]
float v28; // [rsp+0h] [rbp-28h]
float x; // [rsp+14h] [rbp-14h]
float v30; // [rsp+18h] [rbp-10h]
float v31; // [rsp+1Ch] [rbp-Ch]

v7 = 0.0;
v8 = a1;
sgngamf = 1;
if ( *(float *)&a1 < 0.0 )
{
v30 = *(float *)&a1;
*(_QWORD *)&v12 = (unsigned int)LC1 ^ *(_QWORD *)&a1;
x = *(float *)&v12;
v31 = lgamf(v12);
*(_QWORD *)&v9 = LODWORD(x);
*(float *)&v9 = floorf(x);
*(_QWORD *)&v10 = LODWORD(x);
*(_QWORD *)&v8 = LODWORD(v30);
if ( x != *(float *)&v9 )
{
HIDWORD(a4) = 0;
*(float *)&a4 = x - *(float *)&v9;
v13 = (int)*(float *)&v9 & 1;
if ( !v13 )
v13 = -1;
sgngamf = v13;
if ( *(float *)&a4 > 0.5 )
{
HIDWORD(a4) = HIDWORD(v9);
*(float *)&a4 = (float)(*(float *)&v9 + 1.0) + v30;
}
*(float *)&a4 = *(float *)&a4 * PIF;
HIDWORD(v9) = HIDWORD(a4);
*(float *)&v9 = sinf(*(float *)&a4);
*(_QWORD *)&v10 = LODWORD(x);
v7 = 0.0;
*(float *)&v9 = *(float *)&v9 * x;
if ( *(float *)&v9 != 0.0 )
return COERCE_FLOAT(COERCE_UNSIGNED_INT(logf(*(float *)&v9 * 0.31830987)) ^ LC1) - v31;
}
goto LABEL_10;
}
*(_QWORD *)&v9 = (unsigned int)LC16;
if ( *(float *)&v8 < 6.5 )
{
if ( *(float *)&v8 >= 1.5 )
{
v18 = *(float *)&LC0;
v19 = 0.0;
if ( *(float *)&v8 <= 2.5 )
{
v25 = polevlf(&B, 7LL, *(float *)&v8 - 2.0);
v18 = *(float *)&LC0;
v16 = (float)(*(float *)&v8 - 2.0) * *(float *)&v25;
}
else
{
do
{
v19 = v19 - 1.0;
v18 = v18 * (float)(*(float *)&v8 + v19);
}
while ( (float)(*(float *)&v8 + v19) > 2.5 );
v20 = v19 - 2.0 + *(float *)&v8;
v21 = v20;
v27 = v20;
polevlf(&B, 7LL, v20);
v16 = v20 * v20;
if ( v18 < 0.0 )
{
v28 = v27 * v21;
sgngamf = -1;
v17 = logf(COERCE_FLOAT(LODWORD(v18) ^ LC1));
v16 = v28;
return v17 + v16;
}
}
sgngamf = 1;
v17 = logf(v18);
}
else if ( *(float *)&v8 >= 1.25 )
{
polevlf(&B, 7LL, *(float *)&v8 - 1.0);
if ( *(float *)&v8 < 0.0 )
{
sgngamf = -1;
v22 = logf(COERCE_FLOAT(LODWORD(v8) ^ LC1));
}
else
{
sgngamf = 1;
v22 = logf(*(float *)&v8);
}
v16 = (float)(*(float *)&v8 - 1.0) * (float)(*(float *)&v8 - 1.0);
LODWORD(v17) = LODWORD(v22) ^ LC1;
}
else if ( *(float *)&v8 >= 0.75 )
{
v23 = polevlf(&C, 7LL, *(float *)&v8 - 1.0);
v24 = *(float *)&v23;
v17 = 0.0;
v16 = v24 * (float)(*(float *)&v8 - 1.0);
}
else
{
*(_QWORD *)&a7 = (unsigned int)LC17;
if ( *(float *)&v8 < 1.5 )
{
*(_QWORD *)&a5 = (unsigned int)LC0;
v9 = v8;
v10 = 0.0;
*(_QWORD *)&a4 = (unsigned int)LC0;
while ( *(float *)&v9 != 0.0 )
{
*(float *)&v10 = *(float *)&v10 + 1.0;
*(float *)&a4 = *(float *)&a4 * *(float *)&v9;
HIDWORD(v9) = HIDWORD(v8);
*(float *)&v9 = *(float *)&v8 + *(float *)&v10;
if ( (float)(*(float *)&v8 + *(float *)&v10) >= 1.5 )
{
v14 = *(float *)&v10 - 2.0 + *(float *)&v8;
v15 = v14;
v26 = v14;
polevlf(&B, 7LL, v14);
v16 = v14 * v14;
if ( *(float *)&a4 >= 0.0 )
goto LABEL_25;
sgngamf = -1;
v16 = v26 * v15;
LODWORD(v17) = COERCE_UNSIGNED_INT(logf(COERCE_FLOAT(LODWORD(a4) ^ LC1))) ^ LC1;
return v17 + v16;
}
}
goto LABEL_10;
}
polevlf(&B, 7LL, *(float *)&v8 - 2.0);
LODWORD(a4) = LC0;
v16 = (float)(*(float *)&v8 - 2.0) * (float)(*(float *)&v8 - 2.0);
LABEL_25:
sgngamf = 1;
logf(*(float *)&a4);
LODWORD(v17) = LODWORD(a4) ^ LC1;
}
return v17 + v16;
}
v10 = *(float *)&v8;
if ( *(float *)&v8 > 2.035093e36 )
{
LABEL_10:
mtherr("lgamf", 3LL, v9, v8, v10, a4, a5, v7, a7);
return (float)sgngamf * MAXNUMF;
}
result = (float)(0.91893852 - *(float *)&v8) + (*(float *)&v8 - 0.5) * logf(*(float *)&v8);
if ( *(float *)&v8 <= 10000.0 )
result = result
+ ((0.0006789774945028216 * (float)((float)(1.0 / *(float *)&v8) * (float)(1.0 / *(float *)&v8))
- 0.002769887652139868)
* (float)((float)(1.0 / *(float *)&v8) * (float)(1.0 / *(float *)&v8))
+ 0.08333316229807355)
* (float)(1.0 / *(float *)&v8);
return result;
}

canonical_decompiled_code:
float __fastcall func2(double a1, double a2, double a3, double a4, double a5, double a6, double a7)
{
double v7; // xmm5_8
double v8; // xmm1_8
double v9; // xmm0_8
double v10; // xmm2_8
float result; // xmm0_4
double v12; // xmm0_8
int v13; // eax
float v14; // xmm2_4
float v15; // xmm0_4
float v16; // xmm2_4
float v17; // xmm0_4
float v18; // xmm3_4
float v19; // xmm0_4
float v20; // xmm2_4
float v21; // xmm0_4
float v22; // xmm0_4
double v23; // xmm0_8
float v24; // xmm2_4
double v25; // xmm0_8
float v26; // [rsp+0h] [rbp-28h]
float v27; // [rsp+0h] [rbp-28h]
float v28; // [rsp+0h] [rbp-28h]
float x; // [rsp+14h] [rbp-14h]
float v30; // [rsp+18h] [rbp-10h]
float v31; // [rsp+1Ch] [rbp-Ch]

v7 = 0.0;
v8 = a1;
sgngamf = 1;
if ( *(float *)&a1 < 0.0 )
{
v30 = *(float *)&a1;
*(_QWORD *)&v12 = (unsigned int)LC1 ^ *(_QWORD *)&a1;
x = *(float *)&v12;
v31 = func2(v12);
*(_QWORD *)&v9 = LODWORD(x);
*(float *)&v9 = floorf(x);
*(_QWORD *)&v10 = LODWORD(x);
*(_QWORD *)&v8 = LODWORD(v30);
if ( x != *(float *)&v9 )
{
HIDWORD(a4) = 0;
*(float *)&a4 = x - *(float *)&v9;
v13 = (int)*(float *)&v9 & 1;
if ( !v13 )
v13 = -1;
sgngamf = v13;
if ( *(float *)&a4 > 0.5 )
{
HIDWORD(a4) = HIDWORD(v9);
*(float *)&a4 = (float)(*(float *)&v9 + 1.0) + v30;
}
*(float *)&a4 = *(float *)&a4 * PIF;
HIDWORD(v9) = HIDWORD(a4);
*(float *)&v9 = sinf(*(float *)&a4);
*(_QWORD *)&v10 = LODWORD(x);
v7 = 0.0;
*(float *)&v9 = *(float *)&v9 * x;
if ( *(float *)&v9 != 0.0 )
return COERCE_FLOAT(COERCE_UNSIGNED_INT(logf(*(float *)&v9 * 0.31830987)) ^ LC1) - v31;
}
goto LABEL_10;
}
*(_QWORD *)&v9 = (unsigned int)LC16;
if ( *(float *)&v8 < 6.5 )
{
if ( *(float *)&v8 >= 1.5 )
{
v18 = *(float *)&LC0;
v19 = 0.0;
if ( *(float *)&v8 <= 2.5 )
{
v25 = polevlf(&B, 7LL, *(float *)&v8 - 2.0);
v18 = *(float *)&LC0;
v16 = (float)(*(float *)&v8 - 2.0) * *(float *)&v25;
}
else
{
do
{
v19 = v19 - 1.0;
v18 = v18 * (float)(*(float *)&v8 + v19);
}
while ( (float)(*(float *)&v8 + v19) > 2.5 );
v20 = v19 - 2.0 + *(float *)&v8;
v21 = v20;
v27 = v20;
polevlf(&B, 7LL, v20);
v16 = v20 * v20;
if ( v18 < 0.0 )
{
v28 = v27 * v21;
sgngamf = -1;
v17 = logf(COERCE_FLOAT(LODWORD(v18) ^ LC1));
v16 = v28;
return v17 + v16;
}
}
sgngamf = 1;
v17 = logf(v18);
}
else if ( *(float *)&v8 >= 1.25 )
{
polevlf(&B, 7LL, *(float *)&v8 - 1.0);
if ( *(float *)&v8 < 0.0 )
{
sgngamf = -1;
v22 = logf(COERCE_FLOAT(LODWORD(v8) ^ LC1));
}
else
{
sgngamf = 1;
v22 = logf(*(float *)&v8);
}
v16 = (float)(*(float *)&v8 - 1.0) * (float)(*(float *)&v8 - 1.0);
LODWORD(v17) = LODWORD(v22) ^ LC1;
}
else if ( *(float *)&v8 >= 0.75 )
{
v23 = polevlf(&C, 7LL, *(float *)&v8 - 1.0);
v24 = *(float *)&v23;
v17 = 0.0;
v16 = v24 * (float)(*(float *)&v8 - 1.0);
}
else
{
*(_QWORD *)&a7 = (unsigned int)LC17;
if ( *(float *)&v8 < 1.5 )
{
*(_QWORD *)&a5 = (unsigned int)LC0;
v9 = v8;
v10 = 0.0;
*(_QWORD *)&a4 = (unsigned int)LC0;
while ( *(float *)&v9 != 0.0 )
{
*(float *)&v10 = *(float *)&v10 + 1.0;
*(float *)&a4 = *(float *)&a4 * *(float *)&v9;
HIDWORD(v9) = HIDWORD(v8);
*(float *)&v9 = *(float *)&v8 + *(float *)&v10;
if ( (float)(*(float *)&v8 + *(float *)&v10) >= 1.5 )
{
v14 = *(float *)&v10 - 2.0 + *(float *)&v8;
v15 = v14;
v26 = v14;
polevlf(&B, 7LL, v14);
v16 = v14 * v14;
if ( *(float *)&a4 >= 0.0 )
goto LABEL_25;
sgngamf = -1;
v16 = v26 * v15;
LODWORD(v17) = COERCE_UNSIGNED_INT(logf(COERCE_FLOAT(LODWORD(a4) ^ LC1))) ^ LC1;
return v17 + v16;
}
}
goto LABEL_10;
}
polevlf(&B, 7LL, *(float *)&v8 - 2.0);
LODWORD(a4) = LC0;
v16 = (float)(*(float *)&v8 - 2.0) * (float)(*(float *)&v8 - 2.0);
LABEL_25:
sgngamf = 1;
logf(*(float *)&a4);
LODWORD(v17) = LODWORD(a4) ^ LC1;
}
return v17 + v16;
}
v10 = *(float *)&v8;
if ( *(float *)&v8 > 2.035093e36 )
{
LABEL_10:
mtherr("lgamf", 3LL, v9, v8, v10, a4, a5, v7, a7);
return (float)sgngamf * MAXNUMF;
}
result = (float)(0.91893852 - *(float *)&v8) + (*(float *)&v8 - 0.5) * logf(*(float *)&v8);
if ( *(float *)&v8 <= 10000.0 )
result = result
+ ((0.0006789774945028216 * (float)((float)(1.0 / *(float *)&v8) * (float)(1.0 / *(float *)&v8))
- 0.002769887652139868)
* (float)((float)(1.0 / *(float *)&v8) * (float)(1.0 / *(float *)&v8))
+ 0.08333316229807355)
* (float)(1.0 / *(float *)&v8);
return result;
}

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:
void __fastcall yvf(float a1, float a2)
{
float x; // [rsp+Ch] [rbp-Ch]

if ( a1 == floorf(a1) )
{
ynf((int)a1, a2);
}
else
{
x = a1 * PIF;
cosf(a1 * PIF);
jvf(a1, a2);
jvf(COERCE_FLOAT(LODWORD(a1) ^ LC3), a2);
sinf(x);
}
}

canonical_decompiled_code:
void __fastcall func1(float a1, float a2)
{
float x; // [rsp+Ch] [rbp-Ch]

if ( a1 == floorf(a1) )
{
ynf((int)a1, a2);
}
else
{
x = a1 * PIF;
cosf(a1 * PIF);
jvf(a1, a2);
jvf(COERCE_FLOAT(LODWORD(a1) ^ LC3), a2);
sinf(x);
}
}

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:
void __fastcall igamif(float a1, double a2)
{
__m128i v2; // xmm3
double v3; // r15
float v4; // ebx
float v5; // xmm0_4
int v6; // ebx
float v7; // xmm0_4
float v8; // xmm1_4
__m128i v9; // xmm0
float v10; // ebp
__m128i v11; // xmm0
float v12; // er14
float v13; // xmm0_4
float v14; // xmm0_4
float v15; // xmm0_4
float v16; // xmm0_4
float x; // [rsp+0h] [rbp-34h]
float v19; // [rsp+8h] [rbp-2Ch]

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

canonical_decompiled_code:
void __fastcall func0(float a1, double a2)
{
__m128i v2; // xmm3
double v3; // r15
float v4; // ebx
float v5; // xmm0_4
int v6; // ebx
float v7; // xmm0_4
float v8; // xmm1_4
__m128i v9; // xmm0
float v10; // ebp
__m128i v11; // xmm0
float v12; // er14
float v13; // xmm0_4
float v14; // xmm0_4
float v15; // xmm0_4
float v16; // xmm0_4
float x; // [rsp+0h] [rbp-34h]
float v19; // [rsp+8h] [rbp-2Ch]

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

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, float a3)
{
double result; // xmm0_8

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

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

if ( a3 < 0.0 )
{
mtherr("gdtrf", 1LL);
result = 0.0;
}
else
{
result = a2;
*(float *)&a1 = *(float *)&a1 * 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, float a3)
{
double result; // xmm0_8

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

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

if ( a3 < 0.0 )
{
mtherr("gdtrcf", 1LL);
result = 0.0;
}
else
{
result = a2;
*(float *)&a1 = *(float *)&a1 * 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:
float __fastcall pdtrcf(int a1, float a2)
{
float result; // xmm0_4

if ( a1 < 0 )
{
result = 0.0;
}
else
{
result = 0.0;
if ( a2 > 0.0 )
{
result = (float)(a1 + 1);
igamf(result);
return result;
}
}
mtherr("pdtrcf", 1LL);
return result;
}

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

if ( a1 < 0 )
{
result = 0.0;
}
else
{
result = 0.0;
if ( a2 > 0.0 )
{
result = (float)(a1 + 1);
igamf(result);
return result;
}
}
mtherr("pdtrcf", 1LL);
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:
float __fastcall pdtrf(int a1, float a2)
{
float result; // xmm0_4

if ( a1 < 0 || a2 <= 0.0 )
{
mtherr("pdtr", 1LL);
result = 0.0;
}
else
{
result = (float)(a1 + 1);
igamcf(result);
}
return result;
}

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

if ( a1 < 0 || a2 <= 0.0 )
{
mtherr("pdtr", 1LL);
result = 0.0;
}
else
{
result = (float)(a1 + 1);
igamcf(result);
}
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:
__m64 __fastcall tanf(double a1)
{
return tancotf(0, a1);
}

canonical_decompiled_code:
__m64 __fastcall func1(double 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(double a1, __int64 a2, __int64 a3, __int64 a4)
{
float result; // xmm0_4

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

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

if ( *(float *)&a1 == 0.0 )
{
mtherr("cotf", 2LL, a4);
result = MAXNUMF;
}
else
{
LODWORD(result) = func0(1, a1).m64_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

decompiled_code:
float __fastcall acosf(double a1)
{
double v1; // xmm0_8
float result; // xmm0_4
double v3; // xmm0_8
double v4; // xmm0_8
double v5; // xmm0_8
float v6; // [rsp+8h] [rbp-10h]
double v7; // [rsp+8h] [rbp-10h]

if ( *(float *)&a1 < -1.0 )
goto LABEL_6;
if ( *(float *)&a1 < -0.5 )
{
v3 = (*(float *)&a1 + 1.0) * 0.5;
v7 = PIF;
*(float *)&v3 = v3;
*(float *)&v3 = sqrtf(*(float *)&v3);
v4 = asinf(v3);
return v7 - (*(float *)&v4 + *(float *)&v4);
}
if ( *(float *)&a1 > 1.0 )
{
LABEL_6:
mtherr("acosf", 1LL);
return 0.0;
}
if ( *(float *)&a1 > 0.5 )
{
HIDWORD(a1) = 0;
*(float *)&a1 = (1.0 - *(float *)&a1) * 0.5;
*(float *)&a1 = sqrtf(*(float *)&a1);
v5 = asinf(a1);
result = *(float *)&v5 + *(float *)&v5;
}
else
{
v6 = PIO2F;
v1 = asinf(a1);
result = v6 - *(float *)&v1;
}
return result;
}

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

if ( *(float *)&a1 < -1.0 )
goto LABEL_6;
if ( *(float *)&a1 < -0.5 )
{
v3 = (*(float *)&a1 + 1.0) * 0.5;
v7 = PIF;
*(float *)&v3 = v3;
*(float *)&v3 = sqrtf(*(float *)&v3);
v4 = func0(v3);
return v7 - (*(float *)&v4 + *(float *)&v4);
}
if ( *(float *)&a1 > 1.0 )
{
LABEL_6:
mtherr("acosf", 1LL);
return 0.0;
}
if ( *(float *)&a1 > 0.5 )
{
HIDWORD(a1) = 0;
*(float *)&a1 = (1.0 - *(float *)&a1) * 0.5;
*(float *)&a1 = sqrtf(*(float *)&a1);
v5 = func0(a1);
result = *(float *)&v5 + *(float *)&v5;
}
else
{
v6 = PIO2F;
v1 = func0(a1);
result = v6 - *(float *)&v1;
}
return result;
}

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

decompiled_code:
unsigned __int64 __fastcall sinf(float a1)
{
float v1; // xmm1_4
unsigned __int64 result; // rax

if ( a1 < 0.0 )
LODWORD(a1) ^= LC1;
if ( a1 > 16777215.0 )
return mtherr("sinf", 5LL);
v1 = 1.2732395 * a1;
if ( (float)(1.2732395 * a1) >= 9.223372e18 )
result = (unsigned int)(int)(float)(v1 - 9.223372e18) ^ 0x8000000000000000LL;
else
result = (unsigned int)(int)v1;
if ( (result & 1) != 0 )
++result;
if ( a1 > 8192.0 )
result = mtherr("sinf", 6LL);
return result;
}

canonical_decompiled_code:
unsigned __int64 __fastcall func0(float a1)
{
float v1; // xmm1_4
unsigned __int64 result; // rax

if ( a1 < 0.0 )
LODWORD(a1) ^= LC1;
if ( a1 > 16777215.0 )
return mtherr("sinf", 5LL);
v1 = 1.2732395 * a1;
if ( (float)(1.2732395 * a1) >= 9.223372e18 )
result = (unsigned int)(int)(float)(v1 - 9.223372e18) ^ 0x8000000000000000LL;
else
result = (unsigned int)(int)v1;
if ( (result & 1) != 0 )
++result;
if ( a1 > 8192.0 )
result = mtherr("sinf", 6LL);
return result;
}

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

decompiled_code:
__int64 __fastcall cosf(float a1)
{
int v1; // eax
int v2; // ebx
__int64 result; // rax

if ( a1 < 0.0 )
LODWORD(a1) ^= LC1;
if ( a1 > 16777215.0 )
return mtherr("cosf", 5LL);
v1 = (int)(float)(1.2732395 * a1);
if ( (v1 & 1) != 0 )
LOBYTE(v1) = v1 + 1;
v2 = 1;
if ( (v1 & 4) != 0 )
v2 = -1;
result = (unsigned int)-v2;
if ( a1 > 8192.0 )
result = mtherr("cosf", 6LL);
return result;
}

canonical_decompiled_code:
__int64 __fastcall func1(float a1)
{
int v1; // eax
int v2; // ebx
__int64 result; // rax

if ( a1 < 0.0 )
LODWORD(a1) ^= LC1;
if ( a1 > 16777215.0 )
return mtherr("cosf", 5LL);
v1 = (int)(float)(1.2732395 * a1);
if ( (v1 & 1) != 0 )
LOBYTE(v1) = v1 + 1;
v2 = 1;
if ( (v1 & 4) != 0 )
v2 = -1;
result = (unsigned int)-v2;
if ( a1 > 8192.0 )
result = mtherr("cosf", 6LL);
return result;
}

variable_types: j int


ceilf

decompiled_code:
float __fastcall ceilf(__m128i a1)
{
float v1; // xmm3_4
float result; // xmm0_4

v1 = *(float *)a1.m128i_i32;
result = floorf(a1).m128_f32[0];
if ( v1 > result )
result = result + 1.0;
return result;
}

canonical_decompiled_code:
float __fastcall func1(__m128i a1)
{
float v1; // xmm3_4
float result; // xmm0_4

v1 = *(float *)a1.m128i_i32;
result = func0(a1).m128_f32[0];
if ( v1 > 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

decompiled_code:
double __fastcall frexpf(_DWORD *a1, __m128i a2)
{
unsigned __int16 v2; // dx
__int16 v3; // cx
int v4; // eax
int v5; // esi
int v6; // ecx
double result; // xmm0_8

v2 = _mm_cvtsi128_si32(a2);
v3 = (unsigned int)_mm_cvtsi128_si32(a2) >> 16;
v4 = (unsigned __int8)(v3 >> 7);
if ( (unsigned __int8)(v3 >> 7) )
goto LABEL_6;
if ( *(float *)a2.m128i_i32 != 0.0 )
{
v5 = 0;
do
{
*(float *)a2.m128i_i32 = *(float *)a2.m128i_i32 + *(float *)a2.m128i_i32;
--v5;
v2 = _mm_cvtsi128_si32(a2);
v3 = (unsigned int)_mm_cvtsi128_si32(a2) >> 16;
}
while ( !(unsigned __int8)(v3 >> 7) );
v4 = v5 + (unsigned __int8)(v3 >> 7);
LABEL_6:
v6 = v3 & 0x807F;
BYTE1(v6) |= 0x3Fu;
*a1 = v4 - 126;
*(_QWORD *)&result = _mm_cvtsi32_si128((v6 << 16) | (unsigned int)v2).m128i_u64[0];
return result;
}
*a1 = 0;
return 0.0;
}

canonical_decompiled_code:
double __fastcall func2(_DWORD *a1, __m128i a2)
{
unsigned __int16 v2; // dx
__int16 v3; // cx
int v4; // eax
int v5; // esi
int v6; // ecx
double result; // xmm0_8

v2 = _mm_cvtsi128_si32(a2);
v3 = (unsigned int)_mm_cvtsi128_si32(a2) >> 16;
v4 = (unsigned __int8)(v3 >> 7);
if ( (unsigned __int8)(v3 >> 7) )
goto LABEL_6;
if ( *(float *)a2.m128i_i32 != 0.0 )
{
v5 = 0;
do
{
*(float *)a2.m128i_i32 = *(float *)a2.m128i_i32 + *(float *)a2.m128i_i32;
--v5;
v2 = _mm_cvtsi128_si32(a2);
v3 = (unsigned int)_mm_cvtsi128_si32(a2) >> 16;
}
while ( !(unsigned __int8)(v3 >> 7) );
v4 = v5 + (unsigned __int8)(v3 >> 7);
LABEL_6:
v6 = v3 & 0x807F;
BYTE1(v6) |= 0x3Fu;
*a1 = v4 - 126;
*(_QWORD *)&result = _mm_cvtsi32_si128((v6 << 16) | (unsigned int)v2).m128i_u64[0];
return result;
}
*a1 = 0;
return 0.0;
}

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:
float __fastcall ldexpf(int a1, __m128i a2)
{
signed int v2; // edx
int v3; // ecx
__m128i v4; // xmm0
float result; // xmm0_4
int v6; // eax

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

canonical_decompiled_code:
float __fastcall func3(int a1, __m128i a2)
{
signed int v2; // edx
int v3; // ecx
__m128i v4; // xmm0
float result; // xmm0_4
int v6; // eax

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

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; // xmm1_4
float v2; // xmm0_4
float v3; // xmm2_4
float v4; // xmm1_4
float result; // xmm0_4
float v6; // [rsp+4h] [rbp-Ch]

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

canonical_decompiled_code:
float __fastcall func0(float a1)
{
float v1; // xmm1_4
float v2; // xmm0_4
float v3; // xmm2_4
float v4; // xmm1_4
float result; // xmm0_4
float v6; // [rsp+4h] [rbp-Ch]

v1 = a1;
if ( a1 < 0.0 )
LODWORD(v1) = LODWORD(a1) ^ LC1;
v2 = floorf((float)(v1 * 32.0) + 0.5) * 0.03125;
v3 = v2 * v2;
v4 = (float)((float)(v1 - v2) * (float)(v1 - v2)) + (float)((float)(v2 + v2) * (float)(v1 - v2));
result = MAXNUMF;
if ( (float)(v3 + v4) <= MAXLOGF )
{
v6 = expf(v3);
result = expf(v4) * v6;
}
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