Error

decompiled_code:
int Error(const char *a1, unsigned int a2, unsigned int a3, const char *a4, const char *a5, ...)
{
gcc_va_list va; // [rsp+8h] [rbp-D0h] BYREF

if ( mPrintLimitsSet
&& (mMaxWarningsPlusErrors && mMaxWarningsPlusErrors < (unsigned int)(mErrorCount + mWarningCount)
|| mMaxErrors && mMaxErrors < (unsigned int)mErrorCount) )
{
return PrintLimitExceeded();
}
++mErrorCount;
va_start(va, a5);
return PrintMessage("ERROR", a1, a2, a3, a4, a5, va);
}

canonical_decompiled_code:
int func2(const char *a1, unsigned int a2, unsigned int a3, const char *a4, const char *a5, ...)
{
gcc_va_list va; // [rsp+8h] [rbp-D0h] BYREF

if ( mPrintLimitsSet
&& (mMaxWarningsPlusErrors && mMaxWarningsPlusErrors < (unsigned int)(mErrorCount + mWarningCount)
|| mMaxErrors && mMaxErrors < (unsigned int)mErrorCount) )
{
return func3();
}
++mErrorCount;
va_start(va, a5);
return func1("ERROR", a1, a2, a3, a4, a5, va);
}

original_code:
void
Error (
  CHAR8 *FileName,
  UINT32 LineNumber,
  UINT32 MessageCode,
  CHAR8 *Text,
  CHAR8 *MsgFmt,
  ...
  )
{
  va_list List;
  if (mPrintLimitsSet) {
    if (mMaxWarningsPlusErrors != 0) {
      if (mErrorCount + mWarningCount > mMaxWarningsPlusErrors) {
        PrintLimitExceeded ();
        return ;
      }
    }
    if (mMaxErrors != 0) {
      if (mErrorCount > mMaxErrors) {
        PrintLimitExceeded ();
        return ;
      }
    }
  }
  mErrorCount++;
  __builtin_va_start(List,MsgFmt);
  PrintMessage ("ERROR", FileName, LineNumber, MessageCode, Text, MsgFmt, List);
  __builtin_va_end(List);
}

canonical_original_code:
void Error(char *FileName, unsigned int LineNumber, unsigned int MessageCode, char *Text, char *MsgFmt, ...)
{
  __builtin_va_list List;
  if (mPrintLimitsSet) {
    if (mMaxWarningsPlusErrors != 0) {
      if (mErrorCount + mWarningCount > mMaxWarningsPlusErrors) {
        PrintLimitExceeded ();
        return ;
      }
    }
    if (mMaxErrors != 0) {
      if (mErrorCount > mMaxErrors) {
        PrintLimitExceeded ();
        return ;
      }
    }
  }
  mErrorCount++;
  __builtin_va_start(List,MsgFmt);
  PrintMessage ("ERROR", FileName, LineNumber, MessageCode, Text, MsgFmt, List);
  __builtin_va_end(List);
}


PrintLimitExceeded

repo: guobamantou/loongson-uefi

decompiled_code:
int PrintLimitExceeded()
{
int result; // eax

if ( !mPrintLimitExceeded_0 )
{
mPrintLimitExceeded_0 = 1;
++mMaxErrors;
++mMaxWarnings;
++mMaxWarningsPlusErrors;
result = Error(0LL, 0, 0, "error/warning print limit exceeded", 0LL);
--mMaxErrors;
--mMaxWarnings;
--mMaxWarningsPlusErrors;
}
return result;
}

canonical_decompiled_code:
int func3()
{
int result; // eax

if ( !mPrintLimitExceeded_0 )
{
mPrintLimitExceeded_0 = 1;
++mMaxErrors;
++mMaxWarnings;
++mMaxWarningsPlusErrors;
result = func2(0LL, 0, 0, "error/warning print limit exceeded", 0LL);
--mMaxErrors;
--mMaxWarnings;
--mMaxWarningsPlusErrors;
}
return result;
}

original_code:
static
void
PrintLimitExceeded (
  void
  )
{
  static INT8 mPrintLimitExceeded = 0;
  if (mPrintLimitExceeded == 0) {
    mPrintLimitExceeded++;
    mMaxErrors++;
    mMaxWarnings++;
    mMaxWarningsPlusErrors++;
    Error (((void *)0), 0, 0, "error/warning print limit exceeded", ((void *)0));
    mMaxErrors--;
    mMaxWarnings--;
    mMaxWarningsPlusErrors--;
  }
}

canonical_original_code:
static void PrintLimitExceeded()
{
  static char mPrintLimitExceeded = 0;
  if (mPrintLimitExceeded == 0) {
    mPrintLimitExceeded++;
    mMaxErrors++;
    mMaxWarnings++;
    mMaxWarningsPlusErrors++;
    Error (((void *)0), 0, 0, "error/warning print limit exceeded", ((void *)0));
    mMaxErrors--;
    mMaxWarnings--;
    mMaxWarningsPlusErrors--;
  }
}

variable_types: mPrintLimitExceeded char

return_type: void


ParserError

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

if ( mPrintLimitsSet
&& (mMaxWarningsPlusErrors && mMaxWarningsPlusErrors < (unsigned int)(mErrorCount + mWarningCount)
|| mMaxErrors && mMaxErrors < (unsigned int)mErrorCount) )
{
return PrintLimitExceeded();
}
++mErrorCount;
va_start(va, a3);
return PrintMessage("ERROR", (const char *)mSourceFileName, mSourceFileLineNum, a1, a2, a3, va);
}

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

if ( mPrintLimitsSet
&& (mMaxWarningsPlusErrors && mMaxWarningsPlusErrors < (unsigned int)(mErrorCount + mWarningCount)
|| mMaxErrors && mMaxErrors < (unsigned int)mErrorCount) )
{
return func3();
}
++mErrorCount;
va_start(va, a3);
return func1("ERROR", (const char *)mSourceFileName, mSourceFileLineNum, a1, a2, a3, va);
}

original_code:
void
ParserError (
  UINT32 MessageCode,
  CHAR8 *Text,
  CHAR8 *MsgFmt,
  ...
  )
{
  va_list List;
  if (mPrintLimitsSet) {
    if (mMaxWarningsPlusErrors != 0) {
      if (mErrorCount + mWarningCount > mMaxWarningsPlusErrors) {
        PrintLimitExceeded ();
        return ;
      }
    }
    if (mMaxErrors != 0) {
      if (mErrorCount > mMaxErrors) {
        PrintLimitExceeded ();
        return ;
      }
    }
  }
  mErrorCount++;
  __builtin_va_start(List,MsgFmt);
  PrintMessage ("ERROR", mSourceFileName, mSourceFileLineNum, MessageCode, Text, MsgFmt, List);
  __builtin_va_end(List);
}

canonical_original_code:
void ParserError(unsigned int MessageCode, char *Text, char *MsgFmt, ...)
{
  __builtin_va_list List;
  if (mPrintLimitsSet) {
    if (mMaxWarningsPlusErrors != 0) {
      if (mErrorCount + mWarningCount > mMaxWarningsPlusErrors) {
        PrintLimitExceeded ();
        return ;
      }
    }
    if (mMaxErrors != 0) {
      if (mErrorCount > mMaxErrors) {
        PrintLimitExceeded ();
        return ;
      }
    }
  }
  mErrorCount++;
  __builtin_va_start(List,MsgFmt);
  PrintMessage ("ERROR", mSourceFileName, mSourceFileLineNum, MessageCode, Text, MsgFmt, List);
  __builtin_va_end(List);
}

variable_types:
MessageCode
unsigned int

variable_types:
Text
char *

variable_types:
MsgFmt
char *


ParserWarning

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

if ( mPrintLimitsSet
&& (mMaxWarningsPlusErrors && mMaxWarningsPlusErrors < (unsigned int)(mErrorCount + mWarningCount)
|| mMaxWarnings && mMaxWarnings < (unsigned int)mWarningCount) )
{
return PrintLimitExceeded();
}
++mWarningCount;
va_start(va, a3);
return PrintMessage("WARNING", (const char *)mSourceFileName, mSourceFileLineNum, a1, a2, a3, va);
}

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

if ( mPrintLimitsSet
&& (mMaxWarningsPlusErrors && mMaxWarningsPlusErrors < (unsigned int)(mErrorCount + mWarningCount)
|| mMaxWarnings && mMaxWarnings < (unsigned int)mWarningCount) )
{
return func3();
}
++mWarningCount;
va_start(va, a3);
return func1("WARNING", (const char *)mSourceFileName, mSourceFileLineNum, a1, a2, a3, va);
}

original_code:
void
ParserWarning (
  UINT32 ErrorCode,
  CHAR8 *OffendingText,
  CHAR8 *MsgFmt,
  ...
  )
{
  va_list List;
  if (mPrintLimitsSet) {
    if (mMaxWarningsPlusErrors != 0) {
      if (mErrorCount + mWarningCount > mMaxWarningsPlusErrors) {
        PrintLimitExceeded ();
        return ;
      }
    }
    if (mMaxWarnings != 0) {
      if (mWarningCount > mMaxWarnings) {
        PrintLimitExceeded ();
        return ;
      }
    }
  }
  mWarningCount++;
  __builtin_va_start(List,MsgFmt);
  PrintMessage ("WARNING", mSourceFileName, mSourceFileLineNum, ErrorCode, OffendingText, MsgFmt, List);
  __builtin_va_end(List);
}

canonical_original_code:
void ParserWarning(unsigned int ErrorCode, char *OffendingText, char *MsgFmt, ...)
{
  __builtin_va_list List;
  if (mPrintLimitsSet) {
    if (mMaxWarningsPlusErrors != 0) {
      if (mErrorCount + mWarningCount > mMaxWarningsPlusErrors) {
        PrintLimitExceeded ();
        return ;
      }
    }
    if (mMaxWarnings != 0) {
      if (mWarningCount > mMaxWarnings) {
        PrintLimitExceeded ();
        return ;
      }
    }
  }
  mWarningCount++;
  __builtin_va_start(List,MsgFmt);
  PrintMessage ("WARNING", mSourceFileName, mSourceFileLineNum, ErrorCode, OffendingText, MsgFmt, List);
  __builtin_va_end(List);
}

variable_types:
ErrorCode
unsigned int

variable_types:
OffendingText
char *


Warning

decompiled_code:
void Warning(const char *a1, unsigned int a2, unsigned int a3, const char *a4, const char *a5, ...)
{
gcc_va_list va; // [rsp+8h] [rbp-D0h] BYREF

if ( (unsigned __int64)mPrintLogLevel <= 0xF )
{
if ( mPrintLimitsSet
&& (mMaxWarningsPlusErrors && mMaxWarningsPlusErrors < (unsigned int)(mErrorCount + mWarningCount)
|| mMaxWarnings && mMaxWarnings < (unsigned int)mWarningCount) )
{
PrintLimitExceeded();
}
else
{
++mWarningCount;
va_start(va, a5);
PrintMessage("WARNING", a1, a2, a3, a4, a5, va);
}
}
}

canonical_decompiled_code:
void func6(const char *a1, unsigned int a2, unsigned int a3, const char *a4, const char *a5, ...)
{
gcc_va_list va; // [rsp+8h] [rbp-D0h] BYREF

if ( (unsigned __int64)mPrintLogLevel <= 0xF )
{
if ( mPrintLimitsSet
&& (mMaxWarningsPlusErrors && mMaxWarningsPlusErrors < (unsigned int)(mErrorCount + mWarningCount)
|| mMaxWarnings && mMaxWarnings < (unsigned int)mWarningCount) )
{
func3();
}
else
{
++mWarningCount;
va_start(va, a5);
func1("WARNING", a1, a2, a3, a4, a5, va);
}
}
}

original_code:
void
Warning (
  CHAR8 *FileName,
  UINT32 LineNumber,
  UINT32 MessageCode,
  CHAR8 *Text,
  CHAR8 *MsgFmt,
  ...
  )
{
  va_list List;
  if (15 < mPrintLogLevel) {
    return;
  }
  if (mPrintLimitsSet) {
    if (mMaxWarningsPlusErrors != 0) {
      if (mErrorCount + mWarningCount > mMaxWarningsPlusErrors) {
        PrintLimitExceeded ();
        return ;
      }
    }
    if (mMaxWarnings != 0) {
      if (mWarningCount > mMaxWarnings) {
        PrintLimitExceeded ();
        return ;
      }
    }
  }
  mWarningCount++;
  __builtin_va_start(List,MsgFmt);
  PrintMessage ("WARNING", FileName, LineNumber, MessageCode, Text, MsgFmt, List);
  __builtin_va_end(List);
}

canonical_original_code:
void Warning(char *FileName, unsigned int LineNumber, unsigned int MessageCode, char *Text, char *MsgFmt, ...)
{
  __builtin_va_list List;
  if (15 < mPrintLogLevel) {
    return;
  }
  if (mPrintLimitsSet) {
    if (mMaxWarningsPlusErrors != 0) {
      if (mErrorCount + mWarningCount > mMaxWarningsPlusErrors) {
        PrintLimitExceeded ();
        return ;
      }
    }
    if (mMaxWarnings != 0) {
      if (mWarningCount > mMaxWarnings) {
        PrintLimitExceeded ();
        return ;
      }
    }
  }
  mWarningCount++;
  __builtin_va_start(List,MsgFmt);
  PrintMessage ("WARNING", FileName, LineNumber, MessageCode, Text, MsgFmt, List);
  __builtin_va_end(List);
}

variable_types:
FileName
char *

variable_types:
LineNumber
unsigned int


DebugMsg

decompiled_code:
int DebugMsg(const char *a1, unsigned int a2, unsigned __int64 a3, const char *a4, const char *a5, ...)
{
int result; // eax
gcc_va_list va; // [rsp+8h] [rbp-D0h] BYREF

if ( mPrintLogLevel <= a3 )
{
va_start(va, a5);
result = PrintMessage("DEBUG", a1, a2, 0, a4, a5, va);
}
return result;
}

canonical_decompiled_code:
int func7(const char *a1, unsigned int a2, unsigned __int64 a3, const char *a4, const char *a5, ...)
{
int result; // eax
gcc_va_list va; // [rsp+8h] [rbp-D0h] BYREF

if ( mPrintLogLevel <= a3 )
{
va_start(va, a5);
result = func1("DEBUG", a1, a2, 0, a4, a5, va);
}
return result;
}

original_code:
void
DebugMsg (
  CHAR8 *FileName,
  UINT32 LineNumber,
  UINT64 MsgLevel,
  CHAR8 *Text,
  CHAR8 *MsgFmt,
  ...
  )
{
  va_list List;
  if (MsgLevel < mPrintLogLevel) {
    return ;
  }
  __builtin_va_start(List,MsgFmt);
  PrintMessage ("DEBUG", FileName, LineNumber, 0, Text, MsgFmt, List);
  __builtin_va_end(List);
}

canonical_original_code:
void DebugMsg(char *FileName, unsigned int LineNumber, unsigned long MsgLevel, char *Text, char *MsgFmt, ...)
{
  __builtin_va_list List;
  if (MsgLevel < mPrintLogLevel) {
    return ;
  }
  __builtin_va_start(List,MsgFmt);
  PrintMessage ("DEBUG", FileName, LineNumber, 0, Text, MsgFmt, List);
  __builtin_va_end(List);
}

variable_types:
MsgLevel
unsigned long


ParserSetPosition

decompiled_code:
void __fastcall ParserSetPosition(__int64 a1, int a2)
{
mSourceFileName = a1;
mSourceFileLineNum = a2;
}

canonical_decompiled_code:
void __fastcall func8(__int64 a1, int a2)
{
mSourceFileName = a1;
mSourceFileLineNum = a2;
}

original_code:
void
ParserSetPosition (
  CHAR8 *SourceFileName,
  UINT32 LineNum
  )
{
  mSourceFileName = SourceFileName;
  mSourceFileLineNum = LineNum;
}

canonical_original_code:
void ParserSetPosition(char *SourceFileName, unsigned int LineNum)
{
  mSourceFileName = SourceFileName;
  mSourceFileLineNum = LineNum;
}

variable_types:
SourceFileName
char *

variable_types:
LineNum
unsigned int


SetUtilityName

decompiled_code:
int __fastcall SetUtilityName(char *src)
{
int result; // eax

if ( !src )
return Error(0LL, 0, 0, "application error", "SetUtilityName() called with NULL utility name");
if ( strlen(src) <= 0x31 )
return (unsigned int)strcpy(&mUtilityName, src);
Error(src, 0, 0, "application error", "utility name length exceeds internal buffer size");
result = (unsigned int)strncpy(&mUtilityName, src, 0x31uLL);
byte_AD1 = 0;
return result;
}

canonical_decompiled_code:
int __fastcall func9(char *src)
{
int result; // eax

if ( !src )
return func2(0LL, 0, 0, "application error", "SetUtilityName() called with NULL utility name");
if ( strlen(src) <= 0x31 )
return (unsigned int)strcpy(&mUtilityName, src);
func2(src, 0, 0, "application error", "utility name length exceeds internal buffer size");
result = (unsigned int)strncpy(&mUtilityName, src, 0x31uLL);
byte_AD1 = 0;
return result;
}

original_code:
void
SetUtilityName (
  CHAR8 *UtilityName
  )
{
  if (UtilityName != ((void *)0)) {
    if (strlen (UtilityName) >= sizeof (mUtilityName)) {
      Error (UtilityName, 0, 0, "application error", "utility name length exceeds internal buffer size");
      strncpy (mUtilityName, UtilityName, sizeof (mUtilityName) - 1);
      mUtilityName[sizeof (mUtilityName) - 1] = 0;
      return ;
    } else {
      strcpy (mUtilityName, UtilityName);
    }
  } else {
    Error (((void *)0), 0, 0, "application error", "SetUtilityName() called with NULL utility name");
  }
}

canonical_original_code:
void SetUtilityName(char *UtilityName)
{
  if (UtilityName != ((void *)0)) {
    if (strlen (UtilityName) >= sizeof (mUtilityName)) {
      Error (UtilityName, 0, 0, "application error", "utility name length exceeds internal buffer size");
      strncpy (mUtilityName, UtilityName, sizeof (mUtilityName) - 1);
      mUtilityName[sizeof (mUtilityName) - 1] = 0;
      return ;
    } else {
      strcpy (mUtilityName, UtilityName);
    }
  } else {
    Error (((void *)0), 0, 0, "application error", "SetUtilityName() called with NULL utility name");
  }
}

variable_types:
UtilityName
char *


GetUtilityStatus

decompiled_code:
__int64 GetUtilityStatus()
{
return (unsigned int)mStatus;
}

canonical_decompiled_code:
__int64 func10()
{
return (unsigned int)mStatus;
}

original_code:
STATUS
GetUtilityStatus (
  void
  )
{
  return mStatus;
}

canonical_original_code:
int GetUtilityStatus()
{
  return mStatus;
}

return_type: int


SetPrintLevel

decompiled_code:
void __fastcall SetPrintLevel(__int64 a1)
{
mPrintLogLevel = a1;
}

canonical_decompiled_code:
void __fastcall func11(__int64 a1)
{
mPrintLogLevel = a1;
}

original_code:
void
SetPrintLevel (
  UINT64 LogLevel
  )
{
  mPrintLogLevel = LogLevel;
}

canonical_original_code:
void SetPrintLevel(unsigned long LogLevel)
{
  mPrintLogLevel = LogLevel;
}

variable_types:
LogLevel
unsigned long


VerboseMsg

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

if ( (unsigned __int64)mPrintLogLevel <= 0xF )
{
va_start(arg, a1);
result = PrintSimpleMessage(a1, arg);
}
return result;
}

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

if ( (unsigned __int64)mPrintLogLevel <= 0xF )
{
va_start(arg, a1);
result = func0(a1, arg);
}
return result;
}

original_code:
void
VerboseMsg (
  CHAR8 *MsgFmt,
  ...
  )
{
  va_list List;
  if (15 < mPrintLogLevel) {
    return ;
  }
  __builtin_va_start(List,MsgFmt);
  PrintSimpleMessage (MsgFmt, List);
  __builtin_va_end(List);
}

canonical_original_code:
void VerboseMsg(char *MsgFmt, ...)
{
  __builtin_va_list List;
  if (15 < mPrintLogLevel) {
    return ;
  }
  __builtin_va_start(List,MsgFmt);
  PrintSimpleMessage (MsgFmt, List);
  __builtin_va_end(List);
}


NormalMsg

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

if ( (unsigned __int64)mPrintLogLevel <= 0x14 )
{
va_start(arg, a1);
result = PrintSimpleMessage(a1, arg);
}
return result;
}

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

if ( (unsigned __int64)mPrintLogLevel <= 0x14 )
{
va_start(arg, a1);
result = func0(a1, arg);
}
return result;
}

original_code:
void
NormalMsg (
  CHAR8 *MsgFmt,
  ...
  )
{
  va_list List;
  if (20 < mPrintLogLevel) {
    return ;
  }
  __builtin_va_start(List,MsgFmt);
  PrintSimpleMessage (MsgFmt, List);
  __builtin_va_end(List);
}

canonical_original_code:
void NormalMsg(char *MsgFmt, ...)
{
  __builtin_va_list List;
  if (20 < mPrintLogLevel) {
    return ;
  }
  __builtin_va_start(List,MsgFmt);
  PrintSimpleMessage (MsgFmt, List);
  __builtin_va_end(List);
}


KeyMsg

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

if ( (unsigned __int64)mPrintLogLevel <= 0x28 )
{
va_start(arg, a1);
result = PrintSimpleMessage(a1, arg);
}
return result;
}

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

if ( (unsigned __int64)mPrintLogLevel <= 0x28 )
{
va_start(arg, a1);
result = func0(a1, arg);
}
return result;
}

original_code:
void
KeyMsg (
  CHAR8 *MsgFmt,
  ...
  )
{
  va_list List;
  if (40 < mPrintLogLevel) {
    return ;
  }
  __builtin_va_start(List,MsgFmt);
  PrintSimpleMessage (MsgFmt, List);
  __builtin_va_end(List);
}

canonical_original_code:
void KeyMsg(char *MsgFmt, ...)
{
  __builtin_va_list List;
  if (40 < mPrintLogLevel) {
    return ;
  }
  __builtin_va_start(List,MsgFmt);
  PrintSimpleMessage (MsgFmt, List);
  __builtin_va_end(List);
}


SetPrintLimits

decompiled_code:
void __fastcall SetPrintLimits(int a1, int a2, int a3)
{
mMaxErrors = a1;
mMaxWarnings = a2;
mMaxWarningsPlusErrors = a3;
mPrintLimitsSet = 1;
}

canonical_decompiled_code:
void __fastcall func15(int a1, int a2, int a3)
{
mMaxErrors = a1;
mMaxWarnings = a2;
mMaxWarningsPlusErrors = a3;
mPrintLimitsSet = 1;
}

original_code:
void
SetPrintLimits (
  UINT32 MaxErrors,
  UINT32 MaxWarnings,
  UINT32 MaxWarningsPlusErrors
  )
{
  mMaxErrors = MaxErrors;
  mMaxWarnings = MaxWarnings;
  mMaxWarningsPlusErrors = MaxWarningsPlusErrors;
  mPrintLimitsSet = 1;
}

canonical_original_code:
void SetPrintLimits(unsigned int MaxErrors, unsigned int MaxWarnings, unsigned int MaxWarningsPlusErrors)
{
  mMaxErrors = MaxErrors;
  mMaxWarnings = MaxWarnings;
  mMaxWarningsPlusErrors = MaxWarningsPlusErrors;
  mPrintLimitsSet = 1;
}

variable_types:
MaxErrors
unsigned int

variable_types:
MaxWarnings
unsigned int

variable_types:
MaxWarningsPlusErrors
unsigned int


zzresynch

decompiled_code:
__int64 __fastcall zzresynch(__int64 a1, unsigned __int8 a2)
{
__int64 result; // rax

if ( consumed_2 )
{
result = zztoken;
if ( (a2 & *(_BYTE *)(a1 + zztoken)) != 0 || zztoken == 1 )
{
consumed_2 = 0;
}
else
{
do
{
zzgettok();
result = zztoken;
}
while ( (*(_BYTE *)(a1 + zztoken) & a2) == 0 && zztoken != 1 );
consumed_2 = 1;
}
}
else
{
result = zzgettok();
consumed_2 = 1;
}
return result;
}

canonical_decompiled_code:
__int64 __fastcall func0(__int64 a1, unsigned __int8 a2)
{
__int64 result; // rax

if ( consumed_2 )
{
result = zztoken;
if ( (a2 & *(_BYTE *)(a1 + zztoken)) != 0 || zztoken == 1 )
{
consumed_2 = 0;
}
else
{
do
{
zzgettok();
result = zztoken;
}
while ( (*(_BYTE *)(a1 + zztoken) & a2) == 0 && zztoken != 1 );
consumed_2 = 1;
}
}
else
{
result = zzgettok();
consumed_2 = 1;
}
return result;
}

original_code:
void
zzresynch(SetWordType *wd,SetWordType mask)
{
 static int consumed = 1;
 if ( !consumed ) {zzgettok();; consumed=1; return;}
 if ( wd[zztoken]&mask || zztoken == 1 ) {consumed=0; return;}
 while ( !(wd[zztoken]&mask) && zztoken != 1 ) {zzgettok();;}
 consumed=1;
}

canonical_original_code:
void zzresynch(unsigned char *wd, unsigned char mask)
{
 static int consumed = 1;
 if ( !consumed ) {zzgettok();; consumed=1; return;}
 if ( wd[zztoken]&mask || zztoken == 1 ) {consumed=0; return;}
 while ( !(wd[zztoken]&mask) && zztoken != 1 ) {zzgettok();;}
 consumed=1;
}

variable_types:
wd
unsigned char *

variable_types:
mask
unsigned char

variable_types: consumed int


zzconsumeUntilToken

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

for ( result = zztoken; zztoken != 1 && zztoken != a1; result = zztoken )
zzgettok();
return result;
}

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

for ( result = zztoken; zztoken != 1 && zztoken != a1; result = zztoken )
zzgettok();
return result;
}

original_code:
void
zzconsumeUntilToken(int t)
{
    int tmp;
 while ( (tmp=zztoken) !=t && tmp!=1 ) { zzgettok();; }
}

variable_types: t int

variable_types: tmp int


zzTraceGuessDone

decompiled_code:
void zzTraceGuessDone()
{
;
}

canonical_decompiled_code:
void func2()
{
;
}

original_code:
void zzTraceGuessDone(zzantlr_state *state)
{
}

canonical_original_code:
void zzTraceGuessDone(struct _zzantlr_state *state)
{
}

variable_types: struct _zzantlr_state { int asp; int ast_sp; int token; char text[65536]; } *


decompiled_code:
char *__fastcall zzsave_antlr_state(__int64 a1)
{
*(_DWORD *)a1 = zzasp;
*(_DWORD *)(a1 + 8) = zztoken;
return strcpy((char *)(a1 + 12), zzlextext);
}

canonical_decompiled_code:
char *__fastcall func3(__int64 a1)
{
*(_DWORD *)a1 = zzasp;
*(_DWORD *)(a1 + 8) = zztoken;
return strcpy((char *)(a1 + 12), zzlextext);
}

original_code:
void
zzsave_antlr_state(zzantlr_state *buf)
{
 buf->asp = zzasp;
 buf->token = zztoken;
 strcpy(buf->text, zzlextext);
}

canonical_original_code:
void zzsave_antlr_state(struct _zzantlr_state *buf)
{
 buf->asp = zzasp;
 buf->token = zztoken;
 strcpy(buf->text, zzlextext);
}

user_defined_types: struct _zzantlr_state { int asp; int ast_sp; int token; char text[65536]; }


decompiled_code:
char *__fastcall zzrestore_antlr_state(__int64 a1)
{
zzasp = *(_DWORD *)a1;
zztoken = *(_DWORD *)(a1 + 8);
return strcpy(zzlextext, (const char *)(a1 + 12));
}

canonical_decompiled_code:
char *__fastcall func4(__int64 a1)
{
zzasp = *(_DWORD *)a1;
zztoken = *(_DWORD *)(a1 + 8);
return strcpy(zzlextext, (const char *)(a1 + 12));
}

original_code:
void
zzrestore_antlr_state(zzantlr_state *buf)
{
 zzasp = buf->asp;
 zztoken = buf->token;
 strcpy(zzlextext, buf->text);
}

canonical_original_code:
void zzrestore_antlr_state(struct _zzantlr_state *buf)
{
 zzasp = buf->asp;
 zztoken = buf->token;
 strcpy(zzlextext, buf->text);
}


decompiled_code:
__int64 __fastcall zzset_el(unsigned int a1, __int64 a2)
{
return (unsigned __int8)(bitmask[a1 & 7] & *(_BYTE *)(a2 + (a1 >> 3)));
}

canonical_decompiled_code:
__int64 __fastcall func5(unsigned int a1, __int64 a2)
{
return (unsigned __int8)(bitmask[a1 & 7] & *(_BYTE *)(a2 + (a1 >> 3)));
}

original_code:
int
zzset_el(unsigned b, SetWordType *p)
{
 return( p[((b) >> 3)] & bitmask[((b) & (8 -1))] );
}

canonical_original_code:
int zzset_el(unsigned int b, unsigned char *p)
{
 return( p[((b) >> 3)] & bitmask[((b) & (8 -1))] );
}

variable_types:
b
unsigned int

variable_types:
p
unsigned char *


zzconsumeUntil

decompiled_code:
__int64 __fastcall zzconsumeUntil(__int64 a1)
{
int v1; // ebx
__int64 result; // rax

while ( 1 )
{
v1 = zztoken;
result = zzset_el(zztoken, a1);
if ( v1 == 1 || (_DWORD)result )
break;
zzgettok();
}
return result;
}

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

while ( 1 )
{
v1 = zztoken;
result = func5(zztoken, a1);
if ( v1 == 1 || (_DWORD)result )
break;
zzgettok();
}
return result;
}

original_code:
void
zzconsumeUntil(SetWordType *st)
{
    int tmp;
 while ( !zzset_el( (tmp=zztoken), st) && tmp!=1 ) {
                                                      zzgettok();; }
}

canonical_original_code:
void zzconsumeUntil(unsigned char *st)
{
    int tmp;
 while ( !zzset_el( (tmp=zztoken), st) && tmp!=1 ) {
                                                      zzgettok();; }
}

variable_types:
st
unsigned char *


zzTraceReset

decompiled_code:
void zzTraceReset()
{
;
}

canonical_decompiled_code:
void func16()
{
;
}

original_code:
void zzTraceReset(void)
{
}

canonical_original_code:
void zzTraceReset()
{
}


zzTraceGuessFail

decompiled_code:
void zzTraceGuessFail()
{
;
}

canonical_decompiled_code:
void func17()
{
;
}

original_code:
void zzTraceGuessFail(void)
{
}

canonical_original_code:
void zzTraceGuessFail()
{
}


zzTraceIn

decompiled_code:
void zzTraceIn()
{
;
}

canonical_decompiled_code:
void func18()
{
;
}

original_code:
void zzTraceIn(char * rule)
{
  return;
}

canonical_original_code:
void zzTraceIn(char *rule)
{
  return;
}

variable_types:
rule
char *


zzTraceOut

decompiled_code:
void zzTraceOut()
{
;
}

canonical_decompiled_code:
void func19()
{
;
}

original_code:
void zzTraceOut(char * rule)
{
}

canonical_original_code:
void zzTraceOut(char *rule)
{
}


zzTraceOption

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

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

original_code:
int zzTraceOption(int delta)
{
    return 0;
}

variable_types: delta int


zzTraceGuessOption

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

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

original_code:
int zzTraceGuessOption(int delta)
{
    return 0;
}


ReadLine

decompiled_code:
char *__fastcall ReadLine(__int64 a1, char *a2, int a3)
{
char *v3; // r12
unsigned __int64 v5; // rbx
const void *v6; // r14
char *v7; // rax
unsigned int v8; // ecx
bool v9; // cc
unsigned int v10; // ebx
unsigned int v11; // ebp
char *v12; // rax
char *v13; // rax

if ( !a2 )
_assert_fail("InputBuffer", "ParseInf.c", 0x42u, "ReadLine");
v3 = a2;
if ( !*(_QWORD *)a1 )
_assert_fail("InputFile->FileImage", "ParseInf.c", 0x43u, "ReadLine");
v5 = *(_QWORD *)(a1 + 8);
if ( !v5 )
_assert_fail("InputFile->Eof", "ParseInf.c", 0x44u, "ReadLine");
v6 = *(const void **)(a1 + 16);
if ( !v6 )
_assert_fail("InputFile->CurrentFilePointer", "ParseInf.c", 0x45u, "ReadLine");
if ( v5 <= (unsigned __int64)v6 )
return 0LL;
v7 = strchr(*(const char **)(a1 + 16), 10);
if ( v7 )
{
v8 = v5 - (_DWORD)v6;
v9 = v5 <= (unsigned __int64)v7;
v10 = (_DWORD)v7 - (_DWORD)v6;
if ( v9 )
v10 = v8;
}
else
{
v10 = v5 - (_DWORD)v6;
}
v11 = a3 - 1;
if ( v11 <= v10 )
v10 = v11;
memcpy(a2, v6, v10);
v12 = &a2[v10 - 1];
if ( *v12 == 13 )
*v12 = 0;
else
a2[v10] = 0;
*(_QWORD *)(a1 + 16) += v10 + 1;
v13 = strstr(a2, "//");
if ( v13 )
*v13 = 0;
return v3;
}

canonical_decompiled_code:
char *__fastcall func0(__int64 a1, char *a2, int a3)
{
char *v3; // r12
unsigned __int64 v5; // rbx
const void *v6; // r14
char *v7; // rax
unsigned int v8; // ecx
bool v9; // cc
unsigned int v10; // ebx
unsigned int v11; // ebp
char *v12; // rax
char *v13; // rax

if ( !a2 )
_assert_fail("InputBuffer", "ParseInf.c", 0x42u, "ReadLine");
v3 = a2;
if ( !*(_QWORD *)a1 )
_assert_fail("InputFile->FileImage", "ParseInf.c", 0x43u, "ReadLine");
v5 = *(_QWORD *)(a1 + 8);
if ( !v5 )
_assert_fail("InputFile->Eof", "ParseInf.c", 0x44u, "ReadLine");
v6 = *(const void **)(a1 + 16);
if ( !v6 )
_assert_fail("InputFile->CurrentFilePointer", "ParseInf.c", 0x45u, "ReadLine");
if ( v5 <= (unsigned __int64)v6 )
return 0LL;
v7 = strchr(*(const char **)(a1 + 16), 10);
if ( v7 )
{
v8 = v5 - (_DWORD)v6;
v9 = v5 <= (unsigned __int64)v7;
v10 = (_DWORD)v7 - (_DWORD)v6;
if ( v9 )
v10 = v8;
}
else
{
v10 = v5 - (_DWORD)v6;
}
v11 = a3 - 1;
if ( v11 <= v10 )
v10 = v11;
memcpy(a2, v6, v10);
v12 = &a2[v10 - 1];
if ( *v12 == 13 )
*v12 = 0;
else
a2[v10] = 0;
*(_QWORD *)(a1 + 16) += v10 + 1;
v13 = strstr(a2, "//");
if ( v13 )
*v13 = 0;
return v3;
}

original_code:
CHAR8 *
ReadLine (
  MEMORY_FILE *InputFile,
  CHAR8 *InputBuffer,
  UINTN MaxLength
  )
{
  CHAR8 *CharPtr;
  CHAR8 *EndOfLine;
  UINTN CharsToCopy;
  ((void) sizeof ((InputBuffer) ? 1 : 0), __extension__ ({ if (InputBuffer) ; else __assert_fail ("InputBuffer", "ParseInf.c", 66, __extension__ __PRETTY_FUNCTION__); }));
  ((void) sizeof ((InputFile->FileImage) ? 1 : 0), __extension__ ({ if (InputFile->FileImage) ; else __assert_fail ("InputFile->FileImage", "ParseInf.c", 67, __extension__ __PRETTY_FUNCTION__); }));
  ((void) sizeof ((InputFile->Eof) ? 1 : 0), __extension__ ({ if (InputFile->Eof) ; else __assert_fail ("InputFile->Eof", "ParseInf.c", 68, __extension__ __PRETTY_FUNCTION__); }));
  ((void) sizeof ((InputFile->CurrentFilePointer) ? 1 : 0), __extension__ ({ if (InputFile->CurrentFilePointer) ; else __assert_fail ("InputFile->CurrentFilePointer", "ParseInf.c", 69, __extension__ __PRETTY_FUNCTION__); }));
  if (InputFile->CurrentFilePointer >= InputFile->Eof) {
    return ((void *)0);
  }
  EndOfLine = strchr (InputFile->CurrentFilePointer, '\n');
  if (EndOfLine == 0) {
    CharsToCopy = InputFile->Eof - InputFile->CurrentFilePointer;
  } else if (EndOfLine >= InputFile->Eof) {
    CharsToCopy = InputFile->Eof - InputFile->CurrentFilePointer;
  } else {
    CharsToCopy = EndOfLine - InputFile->CurrentFilePointer;
  }
  if (CharsToCopy > MaxLength - 1) {
    CharsToCopy = MaxLength - 1;
  }
  memcpy (InputBuffer, InputFile->CurrentFilePointer, CharsToCopy);
  if (InputBuffer[CharsToCopy - 1] == '\r') {
    InputBuffer[CharsToCopy - 1] = '\0';
  } else {
    InputBuffer[CharsToCopy] = '\0';
  }
  InputFile->CurrentFilePointer += CharsToCopy + 1;
  CharPtr = strstr (InputBuffer, "//");
  if (CharPtr != 0) {
    CharPtr[0] = 0;
  }
  return InputBuffer;
}

canonical_original_code:
char *ReadLine(struct MEMORY_FILE *InputFile, char *InputBuffer, unsigned long MaxLength)
{
  char *CharPtr;
  char *EndOfLine;
  unsigned long CharsToCopy;
  ((void) sizeof ((InputBuffer) ? 1 : 0), __extension__ ({ if (InputBuffer) ; else __assert_fail ("InputBuffer", "ParseInf.c", 66, __extension__ __PRETTY_FUNCTION__); }));
  ((void) sizeof ((InputFile->FileImage) ? 1 : 0), __extension__ ({ if (InputFile->FileImage) ; else __assert_fail ("InputFile->FileImage", "ParseInf.c", 67, __extension__ __PRETTY_FUNCTION__); }));
  ((void) sizeof ((InputFile->Eof) ? 1 : 0), __extension__ ({ if (InputFile->Eof) ; else __assert_fail ("InputFile->Eof", "ParseInf.c", 68, __extension__ __PRETTY_FUNCTION__); }));
  ((void) sizeof ((InputFile->CurrentFilePointer) ? 1 : 0), __extension__ ({ if (InputFile->CurrentFilePointer) ; else __assert_fail ("InputFile->CurrentFilePointer", "ParseInf.c", 69, __extension__ __PRETTY_FUNCTION__); }));
  if (InputFile->CurrentFilePointer >= InputFile->Eof) {
    return ((void *)0);
  }
  EndOfLine = strchr (InputFile->CurrentFilePointer, '\n');
  if (EndOfLine == 0) {
    CharsToCopy = InputFile->Eof - InputFile->CurrentFilePointer;
  } else if (EndOfLine >= InputFile->Eof) {
    CharsToCopy = InputFile->Eof - InputFile->CurrentFilePointer;
  } else {
    CharsToCopy = EndOfLine - InputFile->CurrentFilePointer;
  }
  if (CharsToCopy > MaxLength - 1) {
    CharsToCopy = MaxLength - 1;
  }
  memcpy (InputBuffer, InputFile->CurrentFilePointer, CharsToCopy);
  if (InputBuffer[CharsToCopy - 1] == '\r') {
    InputBuffer[CharsToCopy - 1] = '\0';
  } else {
    InputBuffer[CharsToCopy] = '\0';
  }
  InputFile->CurrentFilePointer += CharsToCopy + 1;
  CharPtr = strstr (InputBuffer, "//");
  if (CharPtr != 0) {
    CharPtr[0] = 0;
  }
  return InputBuffer;
}

variable_types: struct MEMORY_FILE { char *FileImage; char *Eof; char *CurrentFilePointer; } *

variable_types:
InputBuffer
char *

variable_types:
MaxLength
unsigned long

variable_types:
CharPtr
char *

variable_types:
EndOfLine
char *

variable_types:
CharsToCopy
unsigned long

return_type: char *


FindSection

decompiled_code:
__int64 __fastcall FindSection(_QWORD *a1, const char *a2)
{
char v3[536]; // [rsp+0h] [rbp-218h] BYREF

if ( !*a1 )
_assert_fail("InputFile->FileImage", "ParseInf.c", 0xAEu, "FindSection");
if ( !a1[1] )
_assert_fail("InputFile->Eof", "ParseInf.c", 0xAFu, "FindSection");
if ( !a1[2] )
_assert_fail("InputFile->CurrentFilePointer", "ParseInf.c", 0xB0u, "FindSection");
if ( !a2 )
_assert_fail("Section", "ParseInf.c", 0xB1u, "FindSection");
a1[2] = *a1;
while ( a1[2] < a1[1] )
{
ReadLine((__int64)a1, v3, 500);
if ( strstr(v3, a2) )
return 1LL;
}
return 0LL;
}

canonical_decompiled_code:
__int64 __fastcall func1(_QWORD *a1, const char *a2)
{
char v3[536]; // [rsp+0h] [rbp-218h] BYREF

if ( !*a1 )
_assert_fail("InputFile->FileImage", "ParseInf.c", 0xAEu, "FindSection");
if ( !a1[1] )
_assert_fail("InputFile->Eof", "ParseInf.c", 0xAFu, "FindSection");
if ( !a1[2] )
_assert_fail("InputFile->CurrentFilePointer", "ParseInf.c", 0xB0u, "FindSection");
if ( !a2 )
_assert_fail("Section", "ParseInf.c", 0xB1u, "FindSection");
a1[2] = *a1;
while ( a1[2] < a1[1] )
{
func0((__int64)a1, v3, 500);
if ( strstr(v3, a2) )
return 1LL;
}
return 0LL;
}

original_code:
BOOLEAN
FindSection (
  MEMORY_FILE *InputFile,
  CHAR8 *Section
  )
{
  CHAR8 InputBuffer[500];
  CHAR8 *CurrentToken;
  ((void) sizeof ((InputFile->FileImage) ? 1 : 0), __extension__ ({ if (InputFile->FileImage) ; else __assert_fail ("InputFile->FileImage", "ParseInf.c", 174, __extension__ __PRETTY_FUNCTION__); }));
  ((void) sizeof ((InputFile->Eof) ? 1 : 0), __extension__ ({ if (InputFile->Eof) ; else __assert_fail ("InputFile->Eof", "ParseInf.c", 175, __extension__ __PRETTY_FUNCTION__); }));
  ((void) sizeof ((InputFile->CurrentFilePointer) ? 1 : 0), __extension__ ({ if (InputFile->CurrentFilePointer) ; else __assert_fail ("InputFile->CurrentFilePointer", "ParseInf.c", 176, __extension__ __PRETTY_FUNCTION__); }));
  ((void) sizeof ((Section) ? 1 : 0), __extension__ ({ if (Section) ; else __assert_fail ("Section", "ParseInf.c", 177, __extension__ __PRETTY_FUNCTION__); }));
  InputFile->CurrentFilePointer = InputFile->FileImage;
  while (InputFile->CurrentFilePointer < InputFile->Eof) {
    ReadLine (InputFile, InputBuffer, 500);
    CurrentToken = strstr (InputBuffer, Section);
    if (CurrentToken != ((void *)0)) {
      return ((BOOLEAN)(1==1));
    }
  }
  return ((BOOLEAN)(0==1));
}

canonical_original_code:
unsigned char FindSection(struct MEMORY_FILE *InputFile, char *Section)
{
  char InputBuffer[500];
  char *CurrentToken;
  ((void) sizeof ((InputFile->FileImage) ? 1 : 0), __extension__ ({ if (InputFile->FileImage) ; else __assert_fail ("InputFile->FileImage", "ParseInf.c", 174, __extension__ __PRETTY_FUNCTION__); }));
  ((void) sizeof ((InputFile->Eof) ? 1 : 0), __extension__ ({ if (InputFile->Eof) ; else __assert_fail ("InputFile->Eof", "ParseInf.c", 175, __extension__ __PRETTY_FUNCTION__); }));
  ((void) sizeof ((InputFile->CurrentFilePointer) ? 1 : 0), __extension__ ({ if (InputFile->CurrentFilePointer) ; else __assert_fail ("InputFile->CurrentFilePointer", "ParseInf.c", 176, __extension__ __PRETTY_FUNCTION__); }));
  ((void) sizeof ((Section) ? 1 : 0), __extension__ ({ if (Section) ; else __assert_fail ("Section", "ParseInf.c", 177, __extension__ __PRETTY_FUNCTION__); }));
  InputFile->CurrentFilePointer = InputFile->FileImage;
  while (InputFile->CurrentFilePointer < InputFile->Eof) {
    ReadLine (InputFile, InputBuffer, 500);
    CurrentToken = strstr (InputBuffer, Section);
    if (CurrentToken != ((void *)0)) {
      return ((BOOLEAN)(1==1));
    }
  }
  return ((BOOLEAN)(0==1));
}

variable_types:
Section
char *

variable_types:
InputBuffer
char [500]

variable_types:
CurrentToken
char *

return_type: unsigned char

user_defined_types: struct MEMORY_FILE { char *FileImage; char *Eof; char *CurrentFilePointer; }


decompiled_code:
const char **__fastcall dumpFcache1(const char *a1)
{
__int64 *v1; // r14
__int64 v2; // r15
const char **v3; // r12
__int64 v4; // rbx
const char *v5; // rbp
int v7; // [rsp+4h] [rbp-44h]
__int64 v8; // [rsp+8h] [rbp-40h]

v1 = (__int64 *)Fcache;
v8 = Fcache;
v2 = Fcache + 4424LL;
v3 = 0LL;
v7 = 0;
do
{
v4 = *v1;
if ( !*v1 || v7 )
{
if ( !v4 )
goto LABEL_10;
}
else
{
v7 = ((__int64)v1 - v8) >> 3;
}
do
{
v5 = *(const char **)v4;
if ( strcmp(*(const char **)v4, a1) > 0 )
{
if ( v3 )
{
if ( strcmp(v5, *v3) < 0 )
v3 = (const char **)v4;
}
else
{
v3 = (const char **)v4;
}
}
v4 = *(_QWORD *)(v4 + 8);
}
while ( v4 );
LABEL_10:
++v1;
}
while ( v1 != (__int64 *)v2 );
return v3;
}

canonical_decompiled_code:
const char **__fastcall func0(const char *a1)
{
__int64 *v1; // r14
__int64 v2; // r15
const char **v3; // r12
__int64 v4; // rbx
const char *v5; // rbp
int v7; // [rsp+4h] [rbp-44h]
__int64 v8; // [rsp+8h] [rbp-40h]

v1 = (__int64 *)Fcache;
v8 = Fcache;
v2 = Fcache + 4424LL;
v3 = 0LL;
v7 = 0;
do
{
v4 = *v1;
if ( !*v1 || v7 )
{
if ( !v4 )
goto LABEL_10;
}
else
{
v7 = ((__int64)v1 - v8) >> 3;
}
do
{
v5 = *(const char **)v4;
if ( strcmp(*(const char **)v4, a1) > 0 )
{
if ( v3 )
{
if ( strcmp(v5, *v3) < 0 )
v3 = (const char **)v4;
}
else
{
v3 = (const char **)v4;
}
}
v4 = *(_QWORD *)(v4 + 8);
}
while ( v4 );
LABEL_10:
++v1;
}
while ( v1 != (__int64 *)v2 );
return v3;
}

original_code:
CacheEntry *dumpFcache1(char *prev)
{
    Entry **table=Fcache;
    int low=0;
    int hi=0;
    CacheEntry *least=((void *)0);
 Entry **p;
 for (p=table; p<&(table[553]); p++) {
  CacheEntry *q =(CacheEntry *) *p;
  if ( q != ((void *)0) && low==0 ) low = p-table;
  while ( q != ((void *)0) ) {
            if (strcmp(q->str,prev) > 0) {
              if (least == ((void *)0)) {
                least=q;
              } else {
                if (strcmp(q->str,least->str) < 0) {
                  least=q;
                };
              };
            };
   q = q->next;
  };
  if ( *p != ((void *)0) ) hi = p-table;
 }
    return least;
}

canonical_original_code:
struct _f *dumpFcache1(char *prev)
{
    struct _entry **table = Fcache;
    int low = 0;
    int hi = 0;
    struct _f *least = ((void *)0);
 struct _entry **p;
 for (p=table; p<&(table[553]); p++) {
  struct _f *q = (CacheEntry *) *p;
  if ( q != ((void *)0) && low==0 ) low = p-table;
  while ( q != ((void *)0) ) {
            if (strcmp(q->str,prev) > 0) {
              if (least == ((void *)0)) {
                least=q;
              } else {
                if (strcmp(q->str,least->str) < 0) {
                  least=q;
                };
              };
            };
   q = q->next;
  };
  if ( *p != ((void *)0) ) hi = p-table;
 }
    return least;
}

variable_types:
prev
char *

variable_types: struct _entry { char *str; struct _entry *next; } **

variable_types: low int

variable_types: hi int

variable_types: struct _f { char *str; struct _f *next; struct _set { unsigned int n; unsigned int *setword; } fset; struct _set rk; int incomplete; } *

user_defined_types: struct _f { char *str; struct _f *next; struct _set fset; struct _set rk; int incomplete; }


reportFcache

decompiled_code:
__int64 __fastcall reportFcache(char **a1)
{
char *v2; // rbx
char v3; // di

fwrite("\nrule ", 1uLL, 6uLL, stdout);
v2 = *a1;
v3 = **a1;
if ( v3 != 42 )
{
do
{
fputc(v3, stdout);
v3 = *++v2;
}
while ( *v2 != 42 );
}
if ( v2[1] == 105 )
fwrite(" First[", 1uLL, 7uLL, stdout);
if ( v2[1] == 111 )
fwrite(" Follow[", 1uLL, 8uLL, stdout);
fprintf(stdout, "%s]", v2 + 2);
if ( *((_DWORD *)a1 + 12) )
fwrite(" *** incomplete ***", 1uLL, 0x13uLL, stdout);
fputc(10, stdout);
return MR_dumpTokenSet(stdout, 1LL, *((unsigned int *)a1 + 4), a1[3]);
}

canonical_decompiled_code:
__int64 __fastcall func1(char **a1)
{
char *v2; // rbx
char v3; // di

fwrite("\nrule ", 1uLL, 6uLL, stdout);
v2 = *a1;
v3 = **a1;
if ( v3 != 42 )
{
do
{
fputc(v3, stdout);
v3 = *++v2;
}
while ( *v2 != 42 );
}
if ( v2[1] == 105 )
fwrite(" First[", 1uLL, 7uLL, stdout);
if ( v2[1] == 111 )
fwrite(" Follow[", 1uLL, 8uLL, stdout);
fprintf(stdout, "%s]", v2 + 2);
if ( *((_DWORD *)a1 + 12) )
fwrite(" *** incomplete ***", 1uLL, 0x13uLL, stdout);
fputc(10, stdout);
return MR_dumpTokenSet(stdout, 1LL, *((unsigned int *)a1 + 4), a1[3]);
}

original_code:
void reportFcache(CacheEntry *q)
{
    char *qstr;
    fprintf(stdout,"\nrule ");
    for (qstr=q->str; *qstr != '*' ; qstr++) {
      fprintf(stdout,"%c",*qstr);
    };
    qstr++;
    if (*qstr == 'i') fprintf(stdout," First[");
    if (*qstr == 'o') fprintf(stdout," Follow[");
    qstr++;
    fprintf(stdout,"%s]",qstr);
    if (q->incomplete) fprintf(stdout," *** incomplete ***");
    fprintf(stdout,"\n");
    MR_dumpTokenSet(stdout,1,q->fset);
}

canonical_original_code:
void reportFcache(struct _f *q)
{
    char *qstr;
    fprintf(stdout,"\nrule ");
    for (qstr=q->str; *qstr != '*' ; qstr++) {
      fprintf(stdout,"%c",*qstr);
    };
    qstr++;
    if (*qstr == 'i') fprintf(stdout," First[");
    if (*qstr == 'o') fprintf(stdout," Follow[");
    qstr++;
    fprintf(stdout,"%s]",qstr);
    if (q->incomplete) fprintf(stdout," *** incomplete ***");
    fprintf(stdout,"\n");
    MR_dumpTokenSet(stdout,1,q->fset);
}

variable_types:
qstr
char *

user_defined_types: struct _set { unsigned int n; unsigned int *setword; }


DumpFcache

decompiled_code:
size_t DumpFcache()
{
const char *i; // rdi
char **v1; // rax
const char **v2; // rbx

fwrite("\n\nDump of First/Follow Cache\n", 1uLL, 0x1DuLL, stdout);
for ( i = (const char *)&unk_23D; ; i = *v2 )
{
v1 = (char **)dumpFcache1(i);
v2 = (const char **)v1;
if ( !v1 )
break;
reportFcache(v1);
}
return fwrite("\nEnd dump of First/Follow Cache\n", 1uLL, 0x20uLL, stdout);
}

canonical_decompiled_code:
size_t func2()
{
const char *i; // rdi
char **v1; // rax
const char **v2; // rbx

fwrite("\n\nDump of First/Follow Cache\n", 1uLL, 0x1DuLL, stdout);
for ( i = (const char *)&unk_23D; ; i = *v2 )
{
v1 = (char **)func0(i);
v2 = (const char **)v1;
if ( !v1 )
break;
func1(v1);
}
return fwrite("\nEnd dump of First/Follow Cache\n", 1uLL, 0x20uLL, stdout);
}

original_code:
void
DumpFcache(void)
{
    char *prev="";
    int n=0;
    CacheEntry *next;
    fprintf(stdout,"\n\nDump of First/Follow Cache\n");
    for(;;) {
      next=dumpFcache1(prev);
      if (next == ((void *)0)) break;
      reportFcache(next);
      ++n;
      prev=next->str;
    };
    fprintf(stdout,"\nEnd dump of First/Follow Cache\n");
}

canonical_original_code:
void DumpFcache()
{
    char *prev = "";
    int n = 0;
    struct _f *next;
    fprintf(stdout,"\n\nDump of First/Follow Cache\n");
    for(;;) {
      next=dumpFcache1(prev);
      if (next == ((void *)0)) break;
      reportFcache(next);
      ++n;
      prev=next->str;
    };
    fprintf(stdout,"\nEnd dump of First/Follow Cache\n");
}

variable_types: n int


SzFree

decompiled_code:
__int64 __fastcall SzFree(__int64 a1, __int64 a2)
{
return MyFree(a2);
}

canonical_decompiled_code:
__int64 __fastcall func1(__int64 a1, __int64 a2)
{
return MyFree(a2);
}

original_code: static void SzFree(void *p, void *address) { p = p; MyFree(address); }

variable_types:
p
void *

variable_types:
address
void *


SzAlloc

decompiled_code:
__int64 __fastcall SzAlloc(__int64 a1, __int64 a2)
{
return MyAlloc(a2);
}

canonical_decompiled_code:
__int64 __fastcall func2(__int64 a1, __int64 a2)
{
return MyAlloc(a2);
}

original_code: static void *SzAlloc(void *p, size_t size) { p = p; return MyAlloc(size); }

canonical_original_code: static void *SzAlloc(void *p, unsigned long size) { p = p; return MyAlloc(size); }

variable_types:
size
unsigned long

return_type: void *


original_code:
static SRes Decode2(CLzmaDec *state, ISeqOutStream *outStream, ISeqInStream *inStream,
    UInt64 unpackSize)
{
  int thereIsSize = (unpackSize != (UInt64)(Int64)-1);
  Byte inBuf[(1 << 16)];
  Byte outBuf[(1 << 16)];
  size_t inPos = 0, inSize = 0, outPos = 0;
  LzmaDec_Init(state);
  for (;;)
  {
    if (inPos == inSize)
    {
      inSize = (1 << 16);
      { int __result__ = (inStream->Read(inStream, inBuf, &inSize)); if (__result__ != 0) return __result__; };
      inPos = 0;
    }
    {
      SRes res;
      SizeT inProcessed = inSize - inPos;
      SizeT outProcessed = (1 << 16) - outPos;
      ELzmaFinishMode finishMode = LZMA_FINISH_ANY;
      ELzmaStatus status;
      if (thereIsSize && outProcessed > unpackSize)
      {
        outProcessed = (SizeT)unpackSize;
        finishMode = LZMA_FINISH_END;
      }
      res = LzmaDec_DecodeToBuf(state, outBuf + outPos, &outProcessed,
        inBuf + inPos, &inProcessed, finishMode, &status);
      inPos += inProcessed;
      outPos += outProcessed;
      unpackSize -= outProcessed;
      if (outStream)
        if (outStream->Write(outStream, outBuf, outPos) != outPos)
          return 9;
      outPos = 0;
      if (res != 0 || (thereIsSize && unpackSize == 0))
        return res;
      if (inProcessed == 0 && outProcessed == 0)
      {
        if (thereIsSize || status != LZMA_STATUS_FINISHED_WITH_MARK)
          return 1;
        return res;
      }
    }
  }
}

canonical_original_code:
static int Decode2(struct CLzmaDec *state, struct ISeqOutStream *outStream, struct ISeqInStream *inStream, unsigned long long unpackSize)
{
  int thereIsSize = (unpackSize != (UInt64)(Int64)-1);
  unsigned char inBuf[-1];
  unsigned char outBuf[-1];
  unsigned long inPos = 0; unsigned long inSize = 0; unsigned long outPos = 0;
  LzmaDec_Init(state);
  for (;;)
  {
    if (inPos == inSize)
    {
      inSize = (1 << 16);
      { int __result__ = (inStream->Read(inStream, inBuf, &inSize)); if (__result__ != 0) return __result__; };
      inPos = 0;
    }
    {
      int res;
      unsigned long inProcessed = inSize - inPos;
      unsigned long outProcessed = (1 << 16) - outPos;
      enum ELzmaFinishMode finishMode = LZMA_FINISH_ANY;
      enum ELzmaStatus status;
      if (thereIsSize && outProcessed > unpackSize)
      {
        outProcessed = (unsigned long)unpackSize;
        finishMode = LZMA_FINISH_END;
      }
      res = LzmaDec_DecodeToBuf(state, outBuf + outPos, &outProcessed,
        inBuf + inPos, &inProcessed, finishMode, &status);
      inPos += inProcessed;
      outPos += outProcessed;
      unpackSize -= outProcessed;
      if (outStream)
        if (outStream->Write(outStream, outBuf, outPos) != outPos)
          return 9;
      outPos = 0;
      if (res != 0 || (thereIsSize && unpackSize == 0))
        return res;
      if (inProcessed == 0 && outProcessed == 0)
      {
        if (thereIsSize || status != LZMA_STATUS_FINISHED_WITH_MARK)
          return 1;
        return res;
      }
    }
  }
}

variable_types: struct CLzmaDec { struct _CLzmaProps { unsigned int lc; unsigned int dicSize; } prop; unsigned short *probs; unsigned char *dic; unsigned char *buf; unsigned int range; unsigned long dicPos; unsigned long dicBufSize; unsigned int processedPos; unsigned int checkDicSize; unsigned int state; unsigned int reps[4]; unsigned int remainLen; int needFlush; int needInitState; unsigned int numProbs; unsigned int tempBufSize; unsigned char tempBuf[20]; } *

variable_types: struct ISeqOutStream { unsigned long (*Write)(void *p, void *buf, unsigned long size); } *

variable_types: struct ISeqInStream { int (*Read)(void *p, void *buf, unsigned long *size); } *

variable_types:
unpackSize
unsigned long long

variable_types: thereIsSize int

variable_types:
inBuf
unsigned char [-1]

variable_types:
outBuf
unsigned char [-1]

variable_types:
inPos
unsigned long

variable_types:
inSize
unsigned long

variable_types:
outPos
unsigned long

variable_types: res int

variable_types:
inProcessed
unsigned long

variable_types:
outProcessed
unsigned long

variable_types: enum ELzmaFinishMode { LZMA_FINISH_ANY=0, LZMA_FINISH_END=1 }

variable_types: enum ELzmaStatus { LZMA_STATUS_NOT_SPECIFIED=0, LZMA_STATUS_FINISHED_WITH_MARK=1, LZMA_STATUS_NOT_FINISHED=2, LZMA_STATUS_NEEDS_MORE_INPUT=3, LZMA_STATUS_MAYBE_FINISHED_WITHOUT_MARK=4 }

user_defined_types: struct CLzmaDec { struct _CLzmaProps prop; unsigned short *probs; unsigned char *dic; unsigned char *buf; unsigned int range; unsigned long dicPos; unsigned long dicBufSize; unsigned int processedPos; unsigned int checkDicSize; unsigned int state; unsigned int reps[4]; unsigned int remainLen; int needFlush; int needInitState; unsigned int numProbs; unsigned int tempBufSize; unsigned char tempBuf[20]; }


PrintHelp

decompiled_code:
__int64 __fastcall PrintHelp(const char *a1)
{
char *v1; // rax
_BYTE *v2; // rdi
signed __int64 v3; // rax
char *v4; // rsi
__int64 result; // rax

v1 = (char *)&a1[strlen(a1)];
*(_QWORD *)v1 = 0x6D6F43616D7A4C0ALL;
*(_QWORD *)(v1 + 487) = 0xA747865742070LL;
v2 = (_BYTE *)((unsigned __int64)(v1 + 8) & 0xFFFFFFFFFFFFFFF8LL);
v3 = v1 - v2;
v4 = (char *)&qword_8E8 - v3;
result = (unsigned int)(v3 + 495) >> 3;
qmemcpy(v2, v4, 8LL * (unsigned int)result);
return result;
}

canonical_decompiled_code:
__int64 __fastcall func5(const char *a1)
{
char *v1; // rax
_BYTE *v2; // rdi
signed __int64 v3; // rax
char *v4; // rsi
__int64 result; // rax

v1 = (char *)&a1[strlen(a1)];
*(_QWORD *)v1 = 0x6D6F43616D7A4C0ALL;
*(_QWORD *)(v1 + 487) = 0xA747865742070LL;
v2 = (_BYTE *)((unsigned __int64)(v1 + 8) & 0xFFFFFFFFFFFFFFF8LL);
v3 = v1 - v2;
v4 = (char *)&qword_8E8 - v3;
result = (unsigned int)(v3 + 495) >> 3;
qmemcpy(v2, v4, 8LL * (unsigned int)result);
return result;
}

original_code:
void PrintHelp(char *buffer)
{
  strcat(buffer,
      "\n" "LzmaCompress" " - " "Copyright (c) 2009, Intel Corporation. All rights reserved." "\n"
      "Based on LZMA Utility " "4.65" " " ": Igor Pavlov : Public domain" " : " "2009-02-03" "\n"
      "\nUsage:  LzmaCompress -e|-d [options] <inputFile>\n"
             "  -e: encode file\n"
             "  -d: decode file\n"
             "  -o FileName, --output FileName: specify the output filename\n"
             "  -v, --verbose: increase output messages\n"
             "  -q, --quiet: reduce output messages\n"
             "  --debug [0-9]: set debug level\n"
             "  --version: display the program version and exit\n"
             "  -h, --help: display this help text\n"
             );
}

variable_types:
buffer
char *


PrintError

decompiled_code:
__int64 __fastcall PrintError(char *dest, char *src)
{
strcat(dest, "\nError: ");
strcat(dest, src);
*(_WORD *)&dest[strlen(dest)] = 10;
return 1LL;
}

canonical_decompiled_code:
__int64 __fastcall func6(char *dest, char *src)
{
strcat(dest, "\nError: ");
strcat(dest, src);
*(_WORD *)&dest[strlen(dest)] = 10;
return 1LL;
}

original_code:
int PrintError(char *buffer, const char *message)
{
  strcat(buffer, "\nError: ");
  strcat(buffer, message);
  strcat(buffer, "\n");
  return 1;
}

canonical_original_code:
int PrintError(char *buffer, char *message)
{
  strcat(buffer, "\nError: ");
  strcat(buffer, message);
  strcat(buffer, "\n");
  return 1;
}

variable_types:
message
char *


PrintErrorNumber

decompiled_code:
__int64 __fastcall PrintErrorNumber(const char *a1, unsigned int a2)
{
size_t v2; // rax

v2 = strlen(a1);
sprintf((char *)&a1[v2], "\nError code: %x\n", a2);
return 1LL;
}

canonical_decompiled_code:
__int64 __fastcall func7(const char *a1, unsigned int a2)
{
size_t v2; // rax

v2 = strlen(a1);
sprintf((char *)&a1[v2], "\nError code: %x\n", a2);
return 1LL;
}

original_code:
int PrintErrorNumber(char *buffer, SRes val)
{
  sprintf(buffer + strlen(buffer), "\nError code: %x\n", (unsigned)val);
  return 1;
}

canonical_original_code:
int PrintErrorNumber(char *buffer, int val)
{
  sprintf(buffer + strlen(buffer), "\nError code: %x\n", (unsigned int)val);
  return 1;
}

variable_types: val int


PrintUserError

decompiled_code:
__int64 __fastcall PrintUserError(char *a1)
{
return PrintError(a1, "Incorrect command");
}

canonical_decompiled_code:
__int64 __fastcall func8(char *a1)
{
return func6(a1, "Incorrect command");
}

original_code:
int PrintUserError(char *buffer)
{
  return PrintError(buffer, "Incorrect command");
}


PrintVersion

decompiled_code:
int __fastcall PrintVersion(char *a1)
{
return sprintf(a1, "%s Version %d.%d", "LzmaCompress", 0LL, 1LL);
}

canonical_decompiled_code:
int __fastcall func9(char *a1)
{
return sprintf(a1, "%s Version %d.%d", "LzmaCompress", 0LL, 1LL);
}

original_code:
void PrintVersion(char *buffer)
{
  sprintf (buffer, "%s Version %d.%d", "LzmaCompress", 0, 1);
}


Decode

decompiled_code:
__int64 __fastcall Decode(__int64 (__fastcall **a1)(_QWORD, char *, _QWORD), __int64 (__fastcall **a2)(_QWORD, char *, __int64 *))
{
unsigned int v2; // er13
__int64 v3; // rax
unsigned __int64 v4; // rbx
char v6[13]; // [rsp+3h] [rbp-C5h] BYREF
char v7[16]; // [rsp+10h] [rbp-B8h] BYREF
__int64 v8; // [rsp+20h] [rbp-A8h]
__int64 v9; // [rsp+28h] [rbp-A0h]

v2 = SeqInStream_Read(a2, v6, 13LL);
if ( !v2 )
{
v3 = 0LL;
v4 = 0LL;
do
{
v4 += (unsigned __int64)(unsigned __int8)v6[v3 + 5] << (8 * (unsigned __int8)v3);
++v3;
}
while ( v3 != 8 );
v9 = 0LL;
v8 = 0LL;
v2 = LzmaDec_Allocate(v7, v6, 5LL, g_Alloc);
if ( !v2 )
{
v2 = Decode2((__int64)v7, a1, a2, v4);
LzmaDec_Free(v7, g_Alloc);
}
}
return v2;
}

canonical_decompiled_code:
__int64 __fastcall func4(__int64 (__fastcall **a1)(_QWORD, char *, _QWORD), __int64 (__fastcall **a2)(_QWORD, char *, __int64 *))
{
unsigned int v2; // er13
__int64 v3; // rax
unsigned __int64 v4; // rbx
char v6[13]; // [rsp+3h] [rbp-C5h] BYREF
char v7[16]; // [rsp+10h] [rbp-B8h] BYREF
__int64 v8; // [rsp+20h] [rbp-A8h]
__int64 v9; // [rsp+28h] [rbp-A0h]

v2 = SeqInStream_Read(a2, v6, 13LL);
if ( !v2 )
{
v3 = 0LL;
v4 = 0LL;
do
{
v4 += (unsigned __int64)(unsigned __int8)v6[v3 + 5] << (8 * (unsigned __int8)v3);
++v3;
}
while ( v3 != 8 );
v9 = 0LL;
v8 = 0LL;
v2 = LzmaDec_Allocate(v7, v6, 5LL, g_Alloc);
if ( !v2 )
{
v2 = func3((__int64)v7, a1, a2, v4);
LzmaDec_Free(v7, g_Alloc);
}
}
return v2;
}

original_code:
static SRes Decode(ISeqOutStream *outStream, ISeqInStream *inStream)
{
  UInt64 unpackSize;
  int i;
  SRes res = 0;
  CLzmaDec state;
  unsigned char header[5 + 8];
  { int __result__ = (SeqInStream_Read(inStream, header, sizeof(header))); if (__result__ != 0) return __result__; };
  unpackSize = 0;
  for (i = 0; i < 8; i++)
    unpackSize += (UInt64)header[5 + i] << (i * 8);
  { (&state)->dic = 0; (&state)->probs = 0; };
  { int __result__ = (LzmaDec_Allocate(&state, header, 5, &g_Alloc)); if (__result__ != 0) return __result__; };
  res = Decode2(&state, outStream, inStream, unpackSize);
  LzmaDec_Free(&state, &g_Alloc);
  return res;
}

canonical_original_code:
static int Decode(struct ISeqOutStream *outStream, struct ISeqInStream *inStream)
{
  unsigned long long unpackSize;
  int i;
  int res = 0;
  struct CLzmaDec state;
  unsigned char header[-1];
  { int __result__ = (SeqInStream_Read(inStream, header, sizeof(header))); if (__result__ != 0) return __result__; };
  unpackSize = 0;
  for (i = 0; i < 8; i++)
    unpackSize += (unsigned long long)header[5 + i] << (i * 8);
  { (&state)->dic = 0; (&state)->probs = 0; };
  { int __result__ = (LzmaDec_Allocate(&state, header, 5, &g_Alloc)); if (__result__ != 0) return __result__; };
  res = Decode2(&state, outStream, inStream, unpackSize);
  LzmaDec_Free(&state, &g_Alloc);
  return res;
}

variable_types: struct ISeqOutStream { unsigned long (*Write)(void *p, void *buf, unsigned long size); } *

variable_types: i int

variable_types: struct CLzmaDec { struct _CLzmaProps { unsigned int lc; unsigned int dicSize; } prop; unsigned short *probs; unsigned char *dic; unsigned char *buf; unsigned int range; unsigned long dicPos; unsigned long dicBufSize; unsigned int processedPos; unsigned int checkDicSize; unsigned int state; unsigned int reps[4]; unsigned int remainLen; int needFlush; int needInitState; unsigned int numProbs; unsigned int tempBufSize; unsigned char tempBuf[20]; }

variable_types:
header
unsigned char [-1]

user_defined_types: struct ISeqInStream { int (*Read)(void *p, void *buf, unsigned long *size); }


main

canonical_name: main

decompiled_code:
int __cdecl main(int argc, const char **argv, const char **envp)
{
int v3; // ebx
__int64 v5[2]; // [rsp+0h] [rbp-7D8h] BYREF
char v6[1984]; // [rsp+10h] [rbp-7C8h] BYREF

v5[0] = 0LL;
v5[1] = 0LL;
memset(v6, 0, sizeof(v6));
v3 = main2(argc, (__int64)argv, (char *)v5);
if ( LOBYTE(v5[0]) )
puts((const char *)v5);
return v3;
}

canonical_decompiled_code:
int __cdecl main(int argc, const char **argv, const char **envp)
{
int v3; // ebx
__int64 v5[2]; // [rsp+0h] [rbp-7D8h] BYREF
char v6[1984]; // [rsp+10h] [rbp-7C8h] BYREF

v5[0] = 0LL;
v5[1] = 0LL;
memset(v6, 0, sizeof(v6));
v3 = func10(argc, (__int64)argv, (char *)v5);
if ( LOBYTE(v5[0]) )
puts((const char *)v5);
return v3;
}

original_code:
int main(int numArgs, const char *args[])
{
  char rs[2000] = { 0 };
  int res = main2(numArgs, args, rs);
  if (strlen(rs) > 0) {
    puts(rs);
  }
  return res;
}

canonical_original_code:
int main(int numArgs, char *args[])
{
  char rs[2000] = { 0 };
  int res = main2(numArgs, args, rs);
  if (strlen(rs) > 0) {
    puts(rs);
  }
  return res;
}

variable_types: numArgs int

variable_types:
args
char *[]

variable_types:
rs
char [2000]


arrayCheck

decompiled_code:
void arrayCheck()
{
int v0; // er14
int v1; // ebx
_QWORD *v2; // rbp
_QWORD *v3; // r12
_QWORD *v4; // r13
_QWORD *v5; // r8
_QWORD *v6; // rdi
_QWORD *v7; // rsi
__int64 v8; // rax
__int64 v9; // rdx
void *v10; // rdi

if ( BlkLevel > highWater )
highWater = BlkLevel;
v0 = arraySize;
if ( BlkLevel >= arraySize )
{
v1 = BlkLevel + 5;
v2 = calloc(BlkLevel + 5, 8uLL);
v3 = calloc(v1, 8uLL);
v4 = calloc(v1, 8uLL);
if ( v0 <= 0 )
{
arraySize = v1;
v10 = egArray;
if ( !egArray )
goto LABEL_9;
}
else
{
v5 = egArray;
v6 = leArray;
v7 = altArray;
v8 = 0LL;
do
{
v2[v8] = v5[v8];
v3[v8] = v6[v8];
v4[v8] = v7[v8];
v9 = v8++;
}
while ( v9 != v0 - 1 );
arraySize = v1;
v10 = egArray;
}
free(v10);
LABEL_9:
if ( leArray )
free(leArray);
if ( altArray )
free(altArray);
egArray = v2;
leArray = v3;
altArray = v4;
}
}

canonical_decompiled_code:
void func0()
{
int v0; // er14
int v1; // ebx
_QWORD *v2; // rbp
_QWORD *v3; // r12
_QWORD *v4; // r13
_QWORD *v5; // r8
_QWORD *v6; // rdi
_QWORD *v7; // rsi
__int64 v8; // rax
__int64 v9; // rdx
void *v10; // rdi

if ( BlkLevel > highWater )
highWater = BlkLevel;
v0 = arraySize;
if ( BlkLevel >= arraySize )
{
v1 = BlkLevel + 5;
v2 = calloc(BlkLevel + 5, 8uLL);
v3 = calloc(v1, 8uLL);
v4 = calloc(v1, 8uLL);
if ( v0 <= 0 )
{
arraySize = v1;
v10 = egArray;
if ( !egArray )
goto LABEL_9;
}
else
{
v5 = egArray;
v6 = leArray;
v7 = altArray;
v8 = 0LL;
do
{
v2[v8] = v5[v8];
v3[v8] = v6[v8];
v4[v8] = v7[v8];
v9 = v8++;
}
while ( v9 != v0 - 1 );
arraySize = v1;
v10 = egArray;
}
free(v10);
LABEL_9:
if ( leArray )
free(leArray);
if ( altArray )
free(altArray);
egArray = v2;
leArray = v3;
altArray = v4;
}
}

original_code:
static void
arrayCheck(void)
{
  ExceptionGroup **egArrayNew;
  LabelEntry **leArrayNew;
  Junction **altArrayNew;
  int arraySizeNew;
  int i;
  if (BlkLevel > highWater) highWater=BlkLevel;
  if (BlkLevel >= arraySize) {
    arraySizeNew=BlkLevel+5;
    egArrayNew=(ExceptionGroup **)
        calloc(arraySizeNew,sizeof(ExceptionGroup *));
    leArrayNew=(LabelEntry **)
        calloc(arraySizeNew,sizeof(LabelEntry *));
    altArrayNew=(Junction **)
        calloc(arraySizeNew,sizeof(Junction *));
    for (i=0; i<arraySize ; i++) {
      egArrayNew[i]=egArray[i];
      leArrayNew[i]=leArray[i];
      altArrayNew[i]=altArray[i];
    };
    arraySize=arraySizeNew;
    if (egArray != ((void *)0)) free( (char *) egArray);
    if (leArray != ((void *)0)) free( (char *) leArray);
    if (altArray != ((void *)0)) free( (char *) altArray);
    egArray=egArrayNew;
    leArray=leArrayNew;
    altArray=altArrayNew;
  };
}

canonical_original_code:
static void arrayCheck()
{
  struct _ExceptionGroup **egArrayNew;
  struct _LabelEntry **leArrayNew;
  struct _junct **altArrayNew;
  int arraySizeNew;
  int i;
  if (BlkLevel > highWater) highWater=BlkLevel;
  if (BlkLevel >= arraySize) {
    arraySizeNew=BlkLevel+5;
    egArrayNew=(struct _ExceptionGroup **)
        calloc(arraySizeNew,sizeof(struct _ExceptionGroup *));
    leArrayNew=(struct _LabelEntry **)
        calloc(arraySizeNew,sizeof(struct _LabelEntry *));
    altArrayNew=(struct _junct **)
        calloc(arraySizeNew,sizeof(struct _junct *));
    for (i=0; i<arraySize ; i++) {
      egArrayNew[i]=egArray[i];
      leArrayNew[i]=leArray[i];
      altArrayNew[i]=altArray[i];
    };
    arraySize=arraySizeNew;
    if (egArray != ((void *)0)) free( (char *) egArray);
    if (leArray != ((void *)0)) free( (char *) leArray);
    if (altArray != ((void *)0)) free( (char *) altArray);
    egArray=egArrayNew;
    leArray=leArrayNew;
    altArray=altArrayNew;
  };
}

variable_types: struct _ExceptionGroup { struct _ListNode { void *elem; struct _ListNode *next; } *handlers; char *label; char *altID; struct _ExceptionGroup *pendingLink; struct _ExceptionGroup *outerEG; struct _LabelEntry { char *str; struct _f { char *str; struct _f *next; struct _set { unsigned int n; unsigned int *setword; } fset; struct _set rk; int incomplete; } *next; struct _node { int ntype; char *rname; int file; int line; } *elem; struct _ExceptionGroup *ex_group; struct _ExceptionGroup *outerEG; struct _LabelEntry *pendingLink; int curAltNum; } *labelEntry; int forRule; int used; } **

variable_types: struct _LabelEntry { char *str; struct _f { char *str; struct _f *next; struct _set { unsigned int n; unsigned int *setword; } fset; struct _set rk; int incomplete; } *next; struct _node { int ntype; char *rname; int file; int line; } *elem; struct _ExceptionGroup { struct _ListNode { void *elem; struct _ListNode *next; } *handlers; char *label; char *altID; struct _ExceptionGroup *pendingLink; struct _ExceptionGroup *outerEG; struct _LabelEntry *labelEntry; int forRule; int used; } *ex_group; struct _ExceptionGroup *outerEG; struct _LabelEntry *pendingLink; int curAltNum; } **

variable_types: struct _junct { int ntype; char *rname; int file; int line; int seq; char ignore; char visited; char pvisited; char fvisited; char *lock; char *pred_lock; int altnum; int jtype; struct _junct *end; struct _node { int ntype; char *rname; int file; int line; } *p1; char halt; char *pdecl; char *parm; char predparm; char *ret; char *erraction; int blockid; char *exception_label; struct _set { unsigned int n; unsigned int *setword; } *fset; struct _tree { struct _tree *down; int token; union { int rk; struct _tree *tref; struct _set sref; } v; } *ftree; struct _Predicate { struct _Predicate *down; struct _Predicate *up; char *expr; struct _tree *tcontext; int k; struct _set scontext[2]; struct _set completionTree; struct _set completionSet; struct _PredEntry { char *str; struct _PredEntry *next; int file; int line; struct _Predicate *pred; char *predLiteral; } *predEntry; struct _anode { int ntype; char *rname; int file; int line; struct _node *next; char *action; int is_predicate; int done; int init_action; char *pred_fail; struct _Predicate *guardpred; unsigned char frmwarned; unsigned char ctxwarned; unsigned char predTooLong; unsigned char noHoist; struct _Predicate *ampersandPred; struct _junct *guardNodes; struct _PredEntry *predEntry; int inverted; } *source; char cloned; char redundant; char ampersandStyle; char inverted; char isConst; char constValue; char conflictReported; struct _set plainSet; } *predicate; char guess; char alpha_beta_guess_end; struct _node *guess_analysis_point; char approx; struct _set tokrefs; struct _set rulerefs; struct _ListNode { void *elem; struct _ListNode *next; } *exceptions; struct _ListNode *el_labels; struct _ExceptionGroup { struct _ListNode *handlers; char *label; char *altID; struct _ExceptionGroup *pendingLink; struct _ExceptionGroup *outerEG; struct _LabelEntry { char *str; struct _f { char *str; struct _f *next; struct _set fset; struct _set rk; int incomplete; } *next; struct _node *elem; struct _ExceptionGroup *ex_group; struct _ExceptionGroup *outerEG; struct _LabelEntry *pendingLink; int curAltNum; } *labelEntry; int forRule; int used; } *outerEG; int curAltNum; char *pFirstSetSymbol; struct _junct *pendingLink; char overlap_warning; } **

variable_types: arraySizeNew int

user_defined_types: struct _ExceptionGroup { struct _ListNode *handlers; char *label; char *altID; struct _ExceptionGroup *pendingLink; struct _ExceptionGroup *outerEG; struct _LabelEntry *labelEntry; int forRule; int used; }

user_defined_types: struct _LabelEntry { char *str; struct _f *next; struct _node *elem; struct _ExceptionGroup *ex_group; struct _ExceptionGroup *outerEG; struct _LabelEntry *pendingLink; int curAltNum; }

user_defined_types: struct _junct { int ntype; char *rname; int file; int line; int seq; char ignore; char visited; char pvisited; char fvisited; char *lock; char *pred_lock; int altnum; int jtype; struct _junct *end; struct _node *p1; char halt; char *pdecl; char *parm; char predparm; char *ret; char *erraction; int blockid; char *exception_label; struct _set *fset; struct _tree *ftree; struct _Predicate *predicate; char guess; char alpha_beta_guess_end; struct _node *guess_analysis_point; char approx; struct _set tokrefs; struct _set rulerefs; struct _ListNode *exceptions; struct _ListNode *el_labels; struct _ExceptionGroup *outerEG; int curAltNum; char *pFirstSetSymbol; struct _junct *pendingLink; char overlap_warning; }

user_defined_types: struct _Predicate { struct _Predicate *down; struct _Predicate *up; char *expr; struct _tree *tcontext; int k; struct _set scontext[2]; struct _set completionTree; struct _set completionSet; struct _PredEntry *predEntry; struct _anode *source; char cloned; char redundant; char ampersandStyle; char inverted; char isConst; char constValue; char conflictReported; struct _set plainSet; }


egFixup

decompiled_code:
__int64 egFixup()
{
__int64 result; // rax
__int64 *v1; // rcx
char *v2; // rdi
__int64 v3; // rdx

result = (unsigned int)highWater;
if ( highWater > 0 )
{
v1 = (__int64 *)((char *)egArray + 8);
v2 = (char *)egArray + 8 * (unsigned int)(highWater - 1) + 16;
do
{
for ( result = *v1; result; *(_QWORD *)(v3 + 24) = 0LL )
{
v3 = result;
result = *(_QWORD *)(result + 24);
}
*v1++ = 0LL;
}
while ( v1 != (__int64 *)v2 );
}
lastEG = 0LL;
lastBlkLevel = 0;
return result;
}

canonical_decompiled_code:
__int64 func1()
{
__int64 result; // rax
__int64 *v1; // rcx
char *v2; // rdi
__int64 v3; // rdx

result = (unsigned int)highWater;
if ( highWater > 0 )
{
v1 = (__int64 *)((char *)egArray + 8);
v2 = (char *)egArray + 8 * (unsigned int)(highWater - 1) + 16;
do
{
for ( result = *v1; result; *(_QWORD *)(v3 + 24) = 0LL )
{
v3 = result;
result = *(_QWORD *)(result + 24);
}
*v1++ = 0LL;
}
while ( v1 != (__int64 *)v2 );
}
lastEG = 0LL;
lastBlkLevel = 0;
return result;
}

original_code:
void
egFixup(void)
{
  int i;
  ExceptionGroup *nextEG;
  ExceptionGroup *innerEG;
  for (i=1; i<=highWater ; i++) {
    for (innerEG=egArray[i]; innerEG != ((void *)0) ; innerEG=nextEG) {
      nextEG=innerEG->pendingLink;
      innerEG->pendingLink=((void *)0);
    };
    egArray[i]=((void *)0);
  };
  lastEG=((void *)0);
  lastBlkLevel=0;
}

canonical_original_code:
void egFixup()
{
  int i;
  struct _ExceptionGroup *nextEG;
  struct _ExceptionGroup *innerEG;
  for (i=1; i<=highWater ; i++) {
    for (innerEG=egArray[i]; innerEG != ((void *)0) ; innerEG=nextEG) {
      nextEG=innerEG->pendingLink;
      innerEG->pendingLink=((void *)0);
    };
    egArray[i]=((void *)0);
  };
  lastEG=((void *)0);
  lastBlkLevel=0;
}

variable_types: struct _ExceptionGroup { struct _ListNode { void *elem; struct _ListNode *next; } *handlers; char *label; char *altID; struct _ExceptionGroup *pendingLink; struct _ExceptionGroup *outerEG; struct _LabelEntry { char *str; struct _f { char *str; struct _f *next; struct _set { unsigned int n; unsigned int *setword; } fset; struct _set rk; int incomplete; } *next; struct _node { int ntype; char *rname; int file; int line; } *elem; struct _ExceptionGroup *ex_group; struct _ExceptionGroup *outerEG; struct _LabelEntry *pendingLink; int curAltNum; } *labelEntry; int forRule; int used; } *


leFixup

decompiled_code:
__int64 leFixup()
{
__int64 result; // rax
__int64 *v1; // rcx
char *v2; // rdi
__int64 v3; // rdx

result = (unsigned int)highWater;
if ( BlkLevel <= highWater )
{
v1 = (__int64 *)((char *)leArray + 8 * BlkLevel);
v2 = (char *)leArray + 8 * BlkLevel + 8 * (unsigned __int64)(unsigned int)(highWater - BlkLevel) + 8;
do
{
for ( result = *v1; result; *(_QWORD *)(v3 + 40) = 0LL )
{
v3 = result;
result = *(_QWORD *)(result + 40);
}
*v1++ = 0LL;
}
while ( v1 != (__int64 *)v2 );
}
return result;
}

canonical_decompiled_code:
__int64 func2()
{
__int64 result; // rax
__int64 *v1; // rcx
char *v2; // rdi
__int64 v3; // rdx

result = (unsigned int)highWater;
if ( BlkLevel <= highWater )
{
v1 = (__int64 *)((char *)leArray + 8 * BlkLevel);
v2 = (char *)leArray + 8 * BlkLevel + 8 * (unsigned __int64)(unsigned int)(highWater - BlkLevel) + 8;
do
{
for ( result = *v1; result; *(_QWORD *)(v3 + 40) = 0LL )
{
v3 = result;
result = *(_QWORD *)(result + 40);
}
*v1++ = 0LL;
}
while ( v1 != (__int64 *)v2 );
}
return result;
}

original_code:
void leFixup(void)
{
  int i;
  LabelEntry *nextLE;
  LabelEntry *innerLE;
  for (i=BlkLevel; i<=highWater ; i++) {
    for (innerLE=leArray[i]; innerLE != ((void *)0) ; innerLE=nextLE) {
      nextLE=innerLE->pendingLink;
      innerLE->pendingLink=((void *)0);
    };
    leArray[i]=((void *)0);
  };
}

canonical_original_code:
void leFixup()
{
  int i;
  struct _LabelEntry *nextLE;
  struct _LabelEntry *innerLE;
  for (i=BlkLevel; i<=highWater ; i++) {
    for (innerLE=leArray[i]; innerLE != ((void *)0) ; innerLE=nextLE) {
      nextLE=innerLE->pendingLink;
      innerLE->pendingLink=((void *)0);
    };
    leArray[i]=((void *)0);
  };
}

variable_types: struct _LabelEntry { char *str; struct _f { char *str; struct _f *next; struct _set { unsigned int n; unsigned int *setword; } fset; struct _set rk; int incomplete; } *next; struct _node { int ntype; char *rname; int file; int line; } *elem; struct _ExceptionGroup { struct _ListNode { void *elem; struct _ListNode *next; } *handlers; char *label; char *altID; struct _ExceptionGroup *pendingLink; struct _ExceptionGroup *outerEG; struct _LabelEntry *labelEntry; int forRule; int used; } *ex_group; struct _ExceptionGroup *outerEG; struct _LabelEntry *pendingLink; int curAltNum; } *


altFixup

decompiled_code:
void altFixup()
{
int v0; // er9
_QWORD *v1; // rdi
int v2; // esi
__int64 v3; // r8
__int64 v4; // rcx
__int64 v5; // rdx
__int64 v6; // rax

v0 = highWater;
if ( BlkLevel <= highWater )
{
v1 = altArray;
v2 = lastBlkLevel;
v3 = lastEG;
v4 = BlkLevel;
do
{
v6 = v1[v4];
if ( v6 )
{
while ( 1 )
{
if ( v2 <= (int)v4 && !*(_QWORD *)(v6 + 240) )
*(_QWORD *)(v6 + 240) = v3;
v5 = *(_QWORD *)(v6 + 264);
*(_QWORD *)(v6 + 264) = 0LL;
if ( !v5 )
break;
v6 = v5;
}
}
v1[v4++] = 0LL;
}
while ( v0 >= (int)v4 );
}
}

canonical_decompiled_code:
void func3()
{
int v0; // er9
_QWORD *v1; // rdi
int v2; // esi
__int64 v3; // r8
__int64 v4; // rcx
__int64 v5; // rdx
__int64 v6; // rax

v0 = highWater;
if ( BlkLevel <= highWater )
{
v1 = altArray;
v2 = lastBlkLevel;
v3 = lastEG;
v4 = BlkLevel;
do
{
v6 = v1[v4];
if ( v6 )
{
while ( 1 )
{
if ( v2 <= (int)v4 && !*(_QWORD *)(v6 + 240) )
*(_QWORD *)(v6 + 240) = v3;
v5 = *(_QWORD *)(v6 + 264);
*(_QWORD *)(v6 + 264) = 0LL;
if ( !v5 )
break;
v6 = v5;
}
}
v1[v4++] = 0LL;
}
while ( v0 >= (int)v4 );
}
}

original_code:
void altFixup(void)
{
  int i;
  Junction *nextAlt;
  Junction *innerAlt;
  for (i=BlkLevel; i<=highWater ; i++) {
    for (innerAlt=altArray[i]; innerAlt != ((void *)0) ; innerAlt=nextAlt) {
      if (lastBlkLevel <= i) {
        if (innerAlt->outerEG == ((void *)0)) {
          innerAlt->outerEG=lastEG;
        };
      };
      nextAlt=innerAlt->pendingLink;
      innerAlt->pendingLink=((void *)0);
    };
    altArray[i]=((void *)0);
  };
}

canonical_original_code:
void altFixup()
{
  int i;
  struct _junct *nextAlt;
  struct _junct *innerAlt;
  for (i=BlkLevel; i<=highWater ; i++) {
    for (innerAlt=altArray[i]; innerAlt != ((void *)0) ; innerAlt=nextAlt) {
      if (lastBlkLevel <= i) {
        if (innerAlt->outerEG == ((void *)0)) {
          innerAlt->outerEG=lastEG;
        };
      };
      nextAlt=innerAlt->pendingLink;
      innerAlt->pendingLink=((void *)0);
    };
    altArray[i]=((void *)0);
  };
}

variable_types: struct _junct { int ntype; char *rname; int file; int line; int seq; char ignore; char visited; char pvisited; char fvisited; char *lock; char *pred_lock; int altnum; int jtype; struct _junct *end; struct _node { int ntype; char *rname; int file; int line; } *p1; char halt; char *pdecl; char *parm; char predparm; char *ret; char *erraction; int blockid; char *exception_label; struct _set { unsigned int n; unsigned int *setword; } *fset; struct _tree { struct _tree *down; int token; union { int rk; struct _tree *tref; struct _set sref; } v; } *ftree; struct _Predicate { struct _Predicate *down; struct _Predicate *up; char *expr; struct _tree *tcontext; int k; struct _set scontext[2]; struct _set completionTree; struct _set completionSet; struct _PredEntry { char *str; struct _PredEntry *next; int file; int line; struct _Predicate *pred; char *predLiteral; } *predEntry; struct _anode { int ntype; char *rname; int file; int line; struct _node *next; char *action; int is_predicate; int done; int init_action; char *pred_fail; struct _Predicate *guardpred; unsigned char frmwarned; unsigned char ctxwarned; unsigned char predTooLong; unsigned char noHoist; struct _Predicate *ampersandPred; struct _junct *guardNodes; struct _PredEntry *predEntry; int inverted; } *source; char cloned; char redundant; char ampersandStyle; char inverted; char isConst; char constValue; char conflictReported; struct _set plainSet; } *predicate; char guess; char alpha_beta_guess_end; struct _node *guess_analysis_point; char approx; struct _set tokrefs; struct _set rulerefs; struct _ListNode { void *elem; struct _ListNode *next; } *exceptions; struct _ListNode *el_labels; struct _ExceptionGroup { struct _ListNode *handlers; char *label; char *altID; struct _ExceptionGroup *pendingLink; struct _ExceptionGroup *outerEG; struct _LabelEntry { char *str; struct _f { char *str; struct _f *next; struct _set fset; struct _set rk; int incomplete; } *next; struct _node *elem; struct _ExceptionGroup *ex_group; struct _ExceptionGroup *outerEG; struct _LabelEntry *pendingLink; int curAltNum; } *labelEntry; int forRule; int used; } *outerEG; int curAltNum; char *pFirstSetSymbol; struct _junct *pendingLink; char overlap_warning; } *


CreateIdentityMappingPageTables

original_code:
void *
CreateIdentityMappingPageTables (
  void
  )
{
  UINT64 PageAddress;
  UINT8 *PageTable;
  UINT8 *PageTablePtr;
  int PML4Index;
  int PDPTEIndex;
  int PDEIndex;
  X64_PAGE_MAP_AND_DIRECTORY_POINTER_2MB_4K *PageMapLevel4Entry;
  X64_PAGE_MAP_AND_DIRECTORY_POINTER_2MB_4K *PageDirectoryPointerEntry;
  X64_PAGE_TABLE_ENTRY_2M *PageDirectoryEntry2MB;
  PageTable = (void *)malloc ((1 + 1 + (1 * 4)) * 0x1000);
  memset (PageTable, 0, ((1 + 1 + (1 * 4)) * 0x1000));
  PageTablePtr = PageTable;
  PageAddress = 0;
  PageMapLevel4Entry = (X64_PAGE_MAP_AND_DIRECTORY_POINTER_2MB_4K *)PageTablePtr;
  for (PML4Index = 0; PML4Index < 1; PML4Index++, PageMapLevel4Entry++) {
    PageTablePtr += 0x1000;
    PageDirectoryPointerEntry = (X64_PAGE_MAP_AND_DIRECTORY_POINTER_2MB_4K *)PageTablePtr;
    PageMapLevel4Entry->Uint64 = (UINT64)(UINT32)(((UINT8 *) PageDirectoryPointerEntry - PageTable + gPageTableBaseAddress));
    PageMapLevel4Entry->Bits.ReadWrite = 1;
    PageMapLevel4Entry->Bits.Present = 1;
    for (PDPTEIndex = 0; PDPTEIndex < 4; PDPTEIndex++, PageDirectoryPointerEntry++) {
      PageTablePtr += 0x1000;
      PageDirectoryEntry2MB = (X64_PAGE_TABLE_ENTRY_2M *)PageTablePtr;
      PageDirectoryPointerEntry->Uint64 = (UINT64)(UINT32)(((UINT8 *) PageDirectoryEntry2MB - PageTable + gPageTableBaseAddress));
      PageDirectoryPointerEntry->Bits.ReadWrite = 1;
      PageDirectoryPointerEntry->Bits.Present = 1;
      for (PDEIndex = 0; PDEIndex < 512; PDEIndex++, PageDirectoryEntry2MB++) {
        PageDirectoryEntry2MB->Uint64 = (UINT64)PageAddress;
        PageDirectoryEntry2MB->Bits.ReadWrite = 1;
        PageDirectoryEntry2MB->Bits.Present = 1;
        PageDirectoryEntry2MB->Bits.MustBe1 = 1;
        PageAddress += 0x200000;
      }
    }
  }
  return PageTable;
}

canonical_original_code:
void *CreateIdentityMappingPageTables()
{
  unsigned long PageAddress;
  unsigned char *PageTable;
  unsigned char *PageTablePtr;
  int PML4Index;
  int PDPTEIndex;
  int PDEIndex;
  union X64_PAGE_MAP_AND_DIRECTORY_POINTER_2MB_4K *PageMapLevel4Entry;
  union X64_PAGE_MAP_AND_DIRECTORY_POINTER_2MB_4K *PageDirectoryPointerEntry;
  union X64_PAGE_TABLE_ENTRY_2M *PageDirectoryEntry2MB;
  PageTable = (void *)malloc ((1 + 1 + (1 * 4)) * 0x1000);
  memset (PageTable, 0, ((1 + 1 + (1 * 4)) * 0x1000));
  PageTablePtr = PageTable;
  PageAddress = 0;
  PageMapLevel4Entry = (union X64_PAGE_MAP_AND_DIRECTORY_POINTER_2MB_4K *)PageTablePtr;
  for (PML4Index = 0; PML4Index < 1; PML4Index++, PageMapLevel4Entry++) {
    PageTablePtr += 0x1000;
    PageDirectoryPointerEntry = (union X64_PAGE_MAP_AND_DIRECTORY_POINTER_2MB_4K *)PageTablePtr;
    PageMapLevel4Entry->Uint64 = (UINT64)(UINT32)(((unsigned char *) PageDirectoryPointerEntry - PageTable + gPageTableBaseAddress));
    PageMapLevel4Entry->Bits.ReadWrite = 1;
    PageMapLevel4Entry->Bits.Present = 1;
    for (PDPTEIndex = 0; PDPTEIndex < 4; PDPTEIndex++, PageDirectoryPointerEntry++) {
      PageTablePtr += 0x1000;
      PageDirectoryEntry2MB = (union X64_PAGE_TABLE_ENTRY_2M *)PageTablePtr;
      PageDirectoryPointerEntry->Uint64 = (UINT64)(UINT32)(((unsigned char *) PageDirectoryEntry2MB - PageTable + gPageTableBaseAddress));
      PageDirectoryPointerEntry->Bits.ReadWrite = 1;
      PageDirectoryPointerEntry->Bits.Present = 1;
      for (PDEIndex = 0; PDEIndex < 512; PDEIndex++, PageDirectoryEntry2MB++) {
        PageDirectoryEntry2MB->Uint64 = (unsigned long)PageAddress;
        PageDirectoryEntry2MB->Bits.ReadWrite = 1;
        PageDirectoryEntry2MB->Bits.Present = 1;
        PageDirectoryEntry2MB->Bits.MustBe1 = 1;
        PageAddress += 0x200000;
      }
    }
  }
  return PageTable;
}

variable_types:
PageAddress
unsigned long

variable_types:
PageTable
unsigned char *

variable_types:
PageTablePtr
unsigned char *

variable_types: PDPTEIndex int

variable_types: PDEIndex int

variable_types: union X64_PAGE_MAP_AND_DIRECTORY_POINTER_2MB_4K { struct { unsigned long Present; unsigned long ReadWrite; unsigned long UserSupervisor; unsigned long WriteThrough; unsigned long CacheDisabled; unsigned long Accessed; unsigned long Reserved; unsigned long MustBeZero; unsigned long Available; unsigned long PageTableBaseAddress; unsigned long AvabilableHigh; unsigned long Nx; } Bits; unsigned long Uint64; } *

variable_types: union X64_PAGE_TABLE_ENTRY_2M { struct { unsigned long Present; unsigned long ReadWrite; unsigned long UserSupervisor; unsigned long WriteThrough; unsigned long CacheDisabled; unsigned long Accessed; unsigned long Dirty; unsigned long MustBe1; unsigned long Global; unsigned long Available; unsigned long PAT; unsigned long MustBeZero; unsigned long PageTableBaseAddress; unsigned long AvabilableHigh; unsigned long Nx; } Bits; unsigned long Uint64; } *


CloneString

decompiled_code:
char *__fastcall CloneString(char *src)
{
size_t v1; // rax
char *v2; // rax
char *v3; // rbx

v1 = strlen(src);
v2 = (char *)malloc(v1 + 1);
v3 = v2;
if ( v2 )
strcpy(v2, src);
return v3;
}

canonical_decompiled_code:
char *__fastcall func0(char *src)
{
size_t v1; // rax
char *v2; // rax
char *v3; // rbx

v1 = strlen(src);
v2 = (char *)malloc(v1 + 1);
v3 = v2;
if ( v2 )
strcpy(v2, src);
return v3;
}

original_code:
CHAR8*
CloneString (
  CHAR8 *String
  )
{
  CHAR8* NewString;
  NewString = malloc (strlen (String) + 1);
  if (NewString != ((void *)0)) {
    strcpy (NewString, String);
  }
  return NewString;
}

canonical_original_code:
char *CloneString(char *String)
{
  char *NewString;
  NewString = malloc (strlen (String) + 1);
  if (NewString != ((void *)0)) {
    strcpy (NewString, String);
  }
  return NewString;
}

variable_types:
String
char *

variable_types:
NewString
char *


AllocateStringListStruct

decompiled_code:
void *__fastcall AllocateStringListStruct(__int64 a1)
{
return malloc(8 * a1 + 16);
}

canonical_decompiled_code:
void *__fastcall func3(__int64 a1)
{
return malloc(8 * a1 + 16);
}

original_code:
STRING_LIST*
AllocateStringListStruct (
  UINTN StringCount
  )
{
  return malloc (((UINTN) &(((STRING_LIST *)0)->Strings[StringCount + 1])));
}

canonical_original_code:
struct STRING_LIST *AllocateStringListStruct(unsigned int StringCount)
{
  return malloc (((UINTN) &(((struct STRING_LIST *)0)->Strings[StringCount + 1])));
}

variable_types:
StringCount
unsigned int

return_type: struct STRING_LIST { unsigned int Count; char *Strings[1]; } *


NewStringList

decompiled_code:
_QWORD *NewStringList()
{
_QWORD *result; // rax

result = AllocateStringListStruct(0LL);
if ( result )
*result = 0LL;
return result;
}

canonical_decompiled_code:
_QWORD *func4()
{
_QWORD *result; // rax

result = func3(0LL);
if ( result )
*result = 0LL;
return result;
}

original_code:
STRING_LIST*
NewStringList (
  )
{
  STRING_LIST *NewList;
  NewList = AllocateStringListStruct (0);
  if (NewList != ((void *)0)) {
    NewList->Count = 0;
  }
  return NewList;
}

canonical_original_code:
struct STRING_LIST *NewStringList()
{
  struct STRING_LIST *NewList;
  NewList = AllocateStringListStruct (0);
  if (NewList != ((void *)0)) {
    NewList->Count = 0;
  }
  return NewList;
}

variable_types: struct STRING_LIST { unsigned int Count; char *Strings[1]; } *


FreeStringList

decompiled_code:
void __fastcall FreeStringList(void *ptr)
{
while ( *(_QWORD *)ptr )
RemoveLastStringFromList(ptr);
free(ptr);
}

canonical_decompiled_code:
void __fastcall func7(void *ptr)
{
while ( *(_QWORD *)ptr )
func2(ptr);
free(ptr);
}

original_code:
void
FreeStringList (
  STRING_LIST *StringList
  )
{
  while (StringList->Count > 0) {
    RemoveLastStringFromList (StringList);
  }
  free (StringList);
}

canonical_original_code:
void FreeStringList(struct STRING_LIST *StringList)
{
  while (StringList->Count > 0) {
    RemoveLastStringFromList (StringList);
  }
  free (StringList);
}

user_defined_types: struct STRING_LIST { unsigned int Count; char *Strings[1]; }


StringListToString

decompiled_code:
char *__fastcall StringListToString(__int64 *a1)
{
__int64 v1; // r13
__int64 v2; // rbp
__int64 v3; // rbx
const char *v4; // rax
char *v5; // rbx
const char *v7; // rax
__int64 v8; // rbp

v1 = *a1;
v2 = 0LL;
v3 = 2LL;
if ( *a1 )
{
while ( 1 )
{
v3 += strlen((const char *)a1[++v2]) + 2;
if ( v2 == v1 )
break;
if ( v2 )
v3 += 2LL;
}
v7 = (const char *)malloc(v3 + 1);
v5 = (char *)v7;
if ( v7 )
{
*v7 = 0;
*(_WORD *)&v7[strlen(v7)] = 91;
v8 = 0LL;
while ( 1 )
{
*(_WORD *)&v5[strlen(v5)] = 34;
strcat(v5, (const char *)a1[v8 + 1]);
*(_WORD *)&v5[strlen(v5)] = 34;
if ( ++v8 == v1 )
break;
if ( v8 )
strcat(v5, ", ");
}
goto LABEL_4;
}
}
else
{
v4 = (const char *)malloc(3uLL);
v5 = (char *)v4;
if ( v4 )
{
*v4 = 0;
*(_WORD *)&v4[strlen(v4)] = 91;
LABEL_4:
*(_WORD *)&v5[strlen(v5)] = 93;
return v5;
}
}
return v5;
}

canonical_decompiled_code:
char *__fastcall func8(__int64 *a1)
{
__int64 v1; // r13
__int64 v2; // rbp
__int64 v3; // rbx
const char *v4; // rax
char *v5; // rbx
const char *v7; // rax
__int64 v8; // rbp

v1 = *a1;
v2 = 0LL;
v3 = 2LL;
if ( *a1 )
{
while ( 1 )
{
v3 += strlen((const char *)a1[++v2]) + 2;
if ( v2 == v1 )
break;
if ( v2 )
v3 += 2LL;
}
v7 = (const char *)malloc(v3 + 1);
v5 = (char *)v7;
if ( v7 )
{
*v7 = 0;
*(_WORD *)&v7[strlen(v7)] = 91;
v8 = 0LL;
while ( 1 )
{
*(_WORD *)&v5[strlen(v5)] = 34;
strcat(v5, (const char *)a1[v8 + 1]);
*(_WORD *)&v5[strlen(v5)] = 34;
if ( ++v8 == v1 )
break;
if ( v8 )
strcat(v5, ", ");
}
goto LABEL_4;
}
}
else
{
v4 = (const char *)malloc(3uLL);
v5 = (char *)v4;
if ( v4 )
{
*v4 = 0;
*(_WORD *)&v4[strlen(v4)] = 91;
LABEL_4:
*(_WORD *)&v5[strlen(v5)] = 93;
return v5;
}
}
return v5;
}

original_code:
CHAR8*
StringListToString (
  STRING_LIST *StringList
  )
{
  UINTN Count;
  UINTN Length;
  CHAR8 *NewString;
  Length = 2;
  for (Count = 0; Count < StringList->Count; Count++) {
    if (Count > 0) {
      Length += 2;
    }
    Length += strlen (StringList->Strings[Count]) + 2;
  }
  NewString = malloc (Length + 1);
  if (NewString == ((void *)0)) {
    return NewString;
  }
  NewString[0] = '\0';
  strcat (NewString, "[");
  for (Count = 0; Count < StringList->Count; Count++) {
    if (Count > 0) {
      strcat (NewString, ", ");
    }
    strcat (NewString, "\"");
    strcat (NewString, StringList->Strings[Count]);
    strcat (NewString, "\"");
  }
  strcat (NewString, "]");
  return NewString;
}

canonical_original_code:
char *StringListToString(struct STRING_LIST *StringList)
{
  unsigned int Count;
  unsigned int Length;
  char *NewString;
  Length = 2;
  for (Count = 0; Count < StringList->Count; Count++) {
    if (Count > 0) {
      Length += 2;
    }
    Length += strlen (StringList->Strings[Count]) + 2;
  }
  NewString = malloc (Length + 1);
  if (NewString == ((void *)0)) {
    return NewString;
  }
  NewString[0] = '\0';
  strcat (NewString, "[");
  for (Count = 0; Count < StringList->Count; Count++) {
    if (Count > 0) {
      strcat (NewString, ", ");
    }
    strcat (NewString, "\"");
    strcat (NewString, StringList->Strings[Count]);
    strcat (NewString, "\"");
  }
  strcat (NewString, "]");
  return NewString;
}

variable_types:
Count
unsigned int

variable_types:
Length
unsigned int


PrintStringList

decompiled_code:
void __fastcall PrintStringList(__int64 *a1)
{
char *v1; // rax
char *v2; // rbx

v1 = StringListToString(a1);
if ( v1 )
{
v2 = v1;
printf("%s", v1);
free(v2);
}
}

canonical_decompiled_code:
void __fastcall func9(__int64 *a1)
{
char *v1; // rax
char *v2; // rbx

v1 = func8(a1);
if ( v1 )
{
v2 = v1;
printf("%s", v1);
free(v2);
}
}

original_code:
void
PrintStringList (
  STRING_LIST *StringList
  )
{
  CHAR8* String;
  String = StringListToString (StringList);
  if (String != ((void *)0)) {
    printf ("%s", String);
    free (String);
  }
}

canonical_original_code:
void PrintStringList(struct STRING_LIST *StringList)
{
  char *String;
  String = StringListToString (StringList);
  if (String != ((void *)0)) {
    printf ("%s", String);
    free (String);
  }
}


GetLogicalDrives

decompiled_code:
__int64 GetLogicalDrives()
{
return 1LL;
}

canonical_decompiled_code:
__int64 func0()
{
return 1LL;
}

original_code: UINTN GetLogicalDrives(void) { return 1; }

canonical_original_code: unsigned long GetLogicalDrives() { return 1; }

return_type: unsigned long


ListDrive

decompiled_code:
int ListDrive()
{
return puts("-l or -list not supported!");
}

canonical_decompiled_code:
int func2()
{
return puts("-l or -list not supported!");
}

original_code:
void
ListDrive (
  void
  )
{
  printf("-l or -list not supported!\n");
}

canonical_original_code:
void ListDrive()
{
  printf("-l or -list not supported!\n");
}


Version

decompiled_code:
int Version()
{
printf("%s v%d.%d -Utility to retrieve and update the boot sector or MBR.\n", "GnuGenBootSector", 0LL, 1LL);
return puts("Copyright (c) 2007-2010 Intel Corporation. All rights reserved.");
}

canonical_decompiled_code:
int func4()
{
printf("%s v%d.%d -Utility to retrieve and update the boot sector or MBR.\n", "GnuGenBootSector", 0LL, 1LL);
return puts("Copyright (c) 2007-2010 Intel Corporation. All rights reserved.");
}

original_code:
void
Version (
  void
  )
{
  printf ("%s v%d.%d -Utility to retrieve and update the boot sector or MBR.\n", "GnuGenBootSector", 0, 1);
  printf ("Copyright (c) 2007-2010 Intel Corporation. All rights reserved.\n");
}

canonical_original_code:
void Version()
{
  printf ("%s v%d.%d -Utility to retrieve and update the boot sector or MBR.\n", "GnuGenBootSector", 0, 1);
  printf ("Copyright (c) 2007-2010 Intel Corporation. All rights reserved.\n");
}


PrintUsage

decompiled_code:
int PrintUsage()
{
Version();
return puts(
"\n"
"Usage: \n"
" GenBootSector\n"
" [-l, --list list disks]\n"
" [-i, --input Filename]\n"
" [-o, --output Filename]\n"
" [-m, --mbr process the MBR also]\n"
" [-v, --verbose]\n"
" [--version]\n"
" [-q, --quiet disable all messages except fatal errors]\n"
" [-d, --debug[#]\n"
" [-h, --help]");
}

canonical_decompiled_code:
int func5()
{
func4();
return puts(
"\n"
"Usage: \n"
" GenBootSector\n"
" [-l, --list list disks]\n"
" [-i, --input Filename]\n"
" [-o, --output Filename]\n"
" [-m, --mbr process the MBR also]\n"
" [-v, --verbose]\n"
" [--version]\n"
" [-q, --quiet disable all messages except fatal errors]\n"
" [-d, --debug[#]\n"
" [-h, --help]");
}

original_code:
void
PrintUsage (
  void
    )
{
  Version();
  printf ("\nUsage: \n   GenBootSector\n     [-l, --list list disks]\n     [-i, --input Filename]\n     [-o, --output Filename]\n     [-m, --mbr process the MBR also]\n     [-v, --verbose]\n     [--version]\n     [-q, --quiet disable all messages except fatal errors]\n     [-d, --debug[#]\n     [-h, --help]\n");
}

canonical_original_code:
void PrintUsage()
{
  Version();
  printf ("\nUsage: \n   GenBootSector\n     [-l, --list list disks]\n     [-i, --input Filename]\n     [-o, --output Filename]\n     [-m, --mbr process the MBR also]\n     [-v, --verbose]\n     [--version]\n     [-q, --quiet disable all messages except fatal errors]\n     [-d, --debug[#]\n     [-h, --help]\n");
}