matchString

decompiled_code:
__int64 __fastcall matchString(__int64 a1, _QWORD *a2)
{
unsigned int v2; // ebp
__int64 v4; // [rsp+0h] [rbp-38h] BYREF
__int64 v5[4]; // [rsp+18h] [rbp-20h] BYREF

v5[0] = *a2;
while ( !(unsigned int)matchEOL((__int64)&v4, v5) )
++v5[0];
v2 = LODWORD(v5[0]) + ~(unsigned int)*a2;
tokenFill(a1, 30LL, 1LL, *a2, v2);
*a2 += (int)v2;
return 1LL;
}

canonical_decompiled_code:
__int64 __fastcall func4(__int64 a1, _QWORD *a2)
{
unsigned int v2; // ebp
__int64 v4; // [rsp+0h] [rbp-38h] BYREF
__int64 v5[4]; // [rsp+18h] [rbp-20h] BYREF

v5[0] = *a2;
while ( !(unsigned int)func0((__int64)&v4, v5) )
++v5[0];
v2 = LODWORD(v5[0]) + ~(unsigned int)*a2;
tokenFill(a1, 30LL, 1LL, *a2, v2);
*a2 += (int)v2;
return 1LL;
}

original_code:
int matchString(token *tok, char **s)
{
 char *t = *s;
 token testToken;
 int len = 0;
 while (!matchEOL(&testToken, &t)) ++t;
 len = t - *s - 1;
 tokenFill(tok, tokTypeString, tokValueTypeString, *s, len);
 *s += len;
 return 1;
}

canonical_original_code:
int matchString(struct token *tok, char **s)
{
 char *t = *s;
 struct token testToken;
 int len = 0;
 while (!matchEOL(&testToken, &t)) ++t;
 len = t - *s - 1;
 tokenFill(tok, tokTypeString, tokValueTypeString, *s, len);
 *s += len;
 return 1;
}

variable_types: len int


matchDoubleQuote

repo: PatrickHead/ucBasic

decompiled_code:
__int64 __fastcall matchDoubleQuote(__int64 a1, _QWORD *a2)
{
__int64 result; // rax

result = 0LL;
if ( *(_BYTE *)*a2 == 34 )
{
tokenFill(a1, 31LL, 0LL, 0LL, 0LL);
++*a2;
result = 1LL;
}
return result;
}

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

result = 0LL;
if ( *(_BYTE *)*a2 == 34 )
{
tokenFill(a1, 31LL, 0LL, 0LL, 0LL);
++*a2;
result = 1LL;
}
return result;
}

original_code:
int matchDoubleQuote(token *tok, char **s)
{
 if (**s == '"')
 {
  tokenFill(tok, tokTypeDoubleQuote, tokValueTypeNone, ((void *)0), 0);
  *s += 1;
  return 1;
 }
 return 0;
}

canonical_original_code:
int matchDoubleQuote(struct token *tok, char **s)
{
 if (**s == '"')
 {
  tokenFill(tok, tokTypeDoubleQuote, tokValueTypeNone, ((void *)0), 0);
  *s += 1;
  return 1;
 }
 return 0;
}

variable_types: struct token { enum tokenType { tokTypeComma=0, tokTypeNumber=1, tokTypeEOL=2, tokTypeCharacterString=3, tokTypeColon=4, tokTypeDividedBy=5, tokTypeEquals=6, tokTypeFree=7, tokTypeFunctionCall=8, tokTypeFunctionPeek=9, tokTypeGosub=10, tokTypeGoto=11, tokTypeGreaterThan=12, tokTypeGreaterThanOrEquals=13, tokTypeIf=14, tokTypeInput=15, tokTypeLeftParenthesis=16, tokTypeLessThan=17, tokTypeLessThanOrEquals=18, tokTypeLet=19, tokTypeMinus=20, tokTypeNotEquals=21, tokTypePlus=22, tokTypePoke=23, tokTypePrint=24, tokTypeRemark=25, tokTypeReturn=26, tokTypeRightParenthesis=27, tokTypeSemicolon=28, tokTypeSize=29, tokTypeString=30, tokTypeDoubleQuote=31, tokTypeThen=32, tokTypeTimes=33, tokTypeVariable=34, tokTypeWhiteSpace=35, tokTypeClear=36, tokTypeRun=37, tokTypeList=38 } type; enum tokenValueType { tokValueTypeNone=0, tokValueTypeString=1, tokValueTypeCharacter=2, tokValueTypeNumber=3 } valueType; union { char *s; char c; int n; }; } *

variable_types:
s
char **

return_type: int

user_defined_types: struct token { enum tokenType type; enum tokenValueType valueType; union { char *s; char c; int n; }; }


matchCharacterString

decompiled_code:
__int64 __fastcall matchCharacterString(__int64 a1, __int64 *a2)
{
__int64 v2; // rbp
int v3; // er12
__int64 v4; // rax
unsigned int v5; // ebx
char v7[96]; // [rsp+0h] [rbp-B8h] BYREF
char v8[24]; // [rsp+60h] [rbp-58h] BYREF
__int64 v9[8]; // [rsp+78h] [rbp-40h] BYREF

memset(v7, 0, 0x50uLL);
v7[80] = 0;
v9[0] = *a2;
v2 = 0LL;
v3 = 0;
while ( 1 )
{
v5 = matchDoubleQuote((__int64)v8, v9);
if ( v5 )
break;
if ( (unsigned int)matchEOL((__int64)v8, v9) )
return v5;
v4 = v9[0];
v7[v2] = *(_BYTE *)v9[0];
v9[0] = v4 + 1;
++v3;
LABEL_4:
++v2;
}
if ( (unsigned int)matchDoubleQuote((__int64)v8, v9) )
{
v7[v2] = 34;
v3 += 2;
goto LABEL_4;
}
--v9[0];
tokenFill(a1, 3LL, 1LL, v7, (unsigned int)v2);
*a2 += v3;
return 1;
}

original_code:
int matchCharacterString(token *tok, char **s)
{
 char *t;
 token testToken;
 int i, len;
 char string[81];
 memset(string, 0, 81);
 for (len = i = 0, t = *s;;)
 {
  while (!matchDoubleQuote(&testToken, &t))
  {
   if (matchEOL(&testToken, &t)) return 0;
   string[i] = *t;
   ++t;
   ++len;
   ++i;
  }
  if (!matchDoubleQuote(&testToken, &t))
  {
   --t;
   break;
  }
  string[i] = '"';
  len += 2;
  ++i;
 }
 tokenFill(tok, tokTypeCharacterString, tokValueTypeString, string, i);
 *s += len;
 return 1;
}

canonical_original_code:
int matchCharacterString(struct token *tok, char **s)
{
 char *t;
 struct token testToken;
 int i; int len;
 char string[81];
 memset(string, 0, 81);
 for (len = i = 0, t = *s;;)
 {
  while (!matchDoubleQuote(&testToken, &t))
  {
   if (matchEOL(&testToken, &t)) return 0;
   string[i] = *t;
   ++t;
   ++len;
   ++i;
  }
  if (!matchDoubleQuote(&testToken, &t))
  {
   --t;
   break;
  }
  string[i] = '"';
  len += 2;
  ++i;
 }
 tokenFill(tok, tokTypeCharacterString, tokValueTypeString, string, i);
 *s += len;
 return 1;
}

variable_types:
t
char *

variable_types: struct token { enum tokenType { tokTypeComma=0, tokTypeNumber=1, tokTypeEOL=2, tokTypeCharacterString=3, tokTypeColon=4, tokTypeDividedBy=5, tokTypeEquals=6, tokTypeFree=7, tokTypeFunctionCall=8, tokTypeFunctionPeek=9, tokTypeGosub=10, tokTypeGoto=11, tokTypeGreaterThan=12, tokTypeGreaterThanOrEquals=13, tokTypeIf=14, tokTypeInput=15, tokTypeLeftParenthesis=16, tokTypeLessThan=17, tokTypeLessThanOrEquals=18, tokTypeLet=19, tokTypeMinus=20, tokTypeNotEquals=21, tokTypePlus=22, tokTypePoke=23, tokTypePrint=24, tokTypeRemark=25, tokTypeReturn=26, tokTypeRightParenthesis=27, tokTypeSemicolon=28, tokTypeSize=29, tokTypeString=30, tokTypeDoubleQuote=31, tokTypeThen=32, tokTypeTimes=33, tokTypeVariable=34, tokTypeWhiteSpace=35, tokTypeClear=36, tokTypeRun=37, tokTypeList=38 } type; enum tokenValueType { tokValueTypeNone=0, tokValueTypeString=1, tokValueTypeCharacter=2, tokValueTypeNumber=3 } valueType; union { char *s; char c; int n; }; }

variable_types: i int

variable_types:
string
char [81]


matchPrint

decompiled_code:
__int64 __fastcall matchPrint(__int64 a1, const char **a2)
{
__int64 v2; // rdx
__int64 result; // rax

v2 = (unsigned int)strncasecmp(*a2, "print", 5uLL);
result = 0LL;
if ( !(_DWORD)v2 )
{
tokenFill(a1, 24LL, v2, 0LL, 0LL);
*a2 += 5;
result = 1LL;
}
return result;
}

canonical_decompiled_code:
__int64 __fastcall func7(__int64 a1, const char **a2)
{
__int64 v2; // rdx
__int64 result; // rax

v2 = (unsigned int)strncasecmp(*a2, "print", 5uLL);
result = 0LL;
if ( !(_DWORD)v2 )
{
tokenFill(a1, 24LL, v2, 0LL, 0LL);
*a2 += 5;
result = 1LL;
}
return result;
}

original_code:
int matchPrint(token *tok, char **s)
{
 if (!strncasecmp(*s, "print", 5))
 {
  tokenFill(tok, tokTypePrint, tokValueTypeNone, ((void *)0), 0);
  *s += 5;
  return 1;
 }
 return 0;
}

canonical_original_code:
int matchPrint(struct token *tok, char **s)
{
 if (!strncasecmp(*s, "print", 5))
 {
  tokenFill(tok, tokTypePrint, tokValueTypeNone, ((void *)0), 0);
  *s += 5;
  return 1;
 }
 return 0;
}

user_defined_types: enum tokenType { tokTypeComma=0, tokTypeNumber=1, tokTypeEOL=2, tokTypeCharacterString=3, tokTypeColon=4, tokTypeDividedBy=5, tokTypeEquals=6, tokTypeFree=7, tokTypeFunctionCall=8, tokTypeFunctionPeek=9, tokTypeGosub=10, tokTypeGoto=11, tokTypeGreaterThan=12, tokTypeGreaterThanOrEquals=13, tokTypeIf=14, tokTypeInput=15, tokTypeLeftParenthesis=16, tokTypeLessThan=17, tokTypeLessThanOrEquals=18, tokTypeLet=19, tokTypeMinus=20, tokTypeNotEquals=21, tokTypePlus=22, tokTypePoke=23, tokTypePrint=24, tokTypeRemark=25, tokTypeReturn=26, tokTypeRightParenthesis=27, tokTypeSemicolon=28, tokTypeSize=29, tokTypeString=30, tokTypeDoubleQuote=31, tokTypeThen=32, tokTypeTimes=33, tokTypeVariable=34, tokTypeWhiteSpace=35, tokTypeClear=36, tokTypeRun=37, tokTypeList=38 }

user_defined_types: enum tokenValueType { tokValueTypeNone=0, tokValueTypeString=1, tokValueTypeCharacter=2, tokValueTypeNumber=3 }


matchInput

decompiled_code:
__int64 __fastcall matchInput(__int64 a1, const char **a2)
{
__int64 v2; // rdx
__int64 result; // rax

v2 = (unsigned int)strncasecmp(*a2, "input", 5uLL);
result = 0LL;
if ( !(_DWORD)v2 )
{
tokenFill(a1, 15LL, v2, 0LL, 0LL);
*a2 += 5;
result = 1LL;
}
return result;
}

canonical_decompiled_code:
__int64 __fastcall func8(__int64 a1, const char **a2)
{
__int64 v2; // rdx
__int64 result; // rax

v2 = (unsigned int)strncasecmp(*a2, "input", 5uLL);
result = 0LL;
if ( !(_DWORD)v2 )
{
tokenFill(a1, 15LL, v2, 0LL, 0LL);
*a2 += 5;
result = 1LL;
}
return result;
}

original_code:
int matchInput(token *tok, char **s)
{
 if (!strncasecmp(*s, "input", 5))
 {
  tokenFill(tok, tokTypeInput, tokValueTypeNone, ((void *)0), 0);
  *s += 5;
  return 1;
 }
 return 0;
}

canonical_original_code:
int matchInput(struct token *tok, char **s)
{
 if (!strncasecmp(*s, "input", 5))
 {
  tokenFill(tok, tokTypeInput, tokValueTypeNone, ((void *)0), 0);
  *s += 5;
  return 1;
 }
 return 0;
}


matchLet

decompiled_code:
__int64 __fastcall matchLet(__int64 a1, const char **a2)
{
__int64 v2; // rdx
__int64 result; // rax

v2 = (unsigned int)strncasecmp(*a2, "let", 3uLL);
result = 0LL;
if ( !(_DWORD)v2 )
{
tokenFill(a1, 19LL, v2, 0LL, 0LL);
*a2 += 3;
result = 1LL;
}
return result;
}

canonical_decompiled_code:
__int64 __fastcall func9(__int64 a1, const char **a2)
{
__int64 v2; // rdx
__int64 result; // rax

v2 = (unsigned int)strncasecmp(*a2, "let", 3uLL);
result = 0LL;
if ( !(_DWORD)v2 )
{
tokenFill(a1, 19LL, v2, 0LL, 0LL);
*a2 += 3;
result = 1LL;
}
return result;
}

original_code:
int matchLet(token *tok, char **s)
{
 if (!strncasecmp(*s, "let", 3))
 {
  tokenFill(tok, tokTypeLet, tokValueTypeNone, ((void *)0), 0);
  *s += 3;
  return 1;
 }
 return 0;
}

canonical_original_code:
int matchLet(struct token *tok, char **s)
{
 if (!strncasecmp(*s, "let", 3))
 {
  tokenFill(tok, tokTypeLet, tokValueTypeNone, ((void *)0), 0);
  *s += 3;
  return 1;
 }
 return 0;
}


matchGoto

decompiled_code:
__int64 __fastcall matchGoto(__int64 a1, const char **a2)
{
__int64 v2; // rdx
__int64 result; // rax

v2 = (unsigned int)strncasecmp(*a2, "goto", 4uLL);
result = 0LL;
if ( !(_DWORD)v2 )
{
tokenFill(a1, 11LL, v2, 0LL, 0LL);
*a2 += 4;
result = 1LL;
}
return result;
}

canonical_decompiled_code:
__int64 __fastcall func10(__int64 a1, const char **a2)
{
__int64 v2; // rdx
__int64 result; // rax

v2 = (unsigned int)strncasecmp(*a2, "goto", 4uLL);
result = 0LL;
if ( !(_DWORD)v2 )
{
tokenFill(a1, 11LL, v2, 0LL, 0LL);
*a2 += 4;
result = 1LL;
}
return result;
}

original_code:
int matchGoto(token *tok, char **s)
{
 if (!strncasecmp(*s, "goto", 4))
 {
  tokenFill(tok, tokTypeGoto, tokValueTypeNone, ((void *)0), 0);
  *s += 4;
  return 1;
 }
 return 0;
}

canonical_original_code:
int matchGoto(struct token *tok, char **s)
{
 if (!strncasecmp(*s, "goto", 4))
 {
  tokenFill(tok, tokTypeGoto, tokValueTypeNone, ((void *)0), 0);
  *s += 4;
  return 1;
 }
 return 0;
}


matchGosub

decompiled_code:
__int64 __fastcall matchGosub(__int64 a1, const char **a2)
{
__int64 v2; // rdx
__int64 result; // rax

v2 = (unsigned int)strncasecmp(*a2, "gosub", 5uLL);
result = 0LL;
if ( !(_DWORD)v2 )
{
tokenFill(a1, 10LL, v2, 0LL, 0LL);
*a2 += 5;
result = 1LL;
}
return result;
}

canonical_decompiled_code:
__int64 __fastcall func11(__int64 a1, const char **a2)
{
__int64 v2; // rdx
__int64 result; // rax

v2 = (unsigned int)strncasecmp(*a2, "gosub", 5uLL);
result = 0LL;
if ( !(_DWORD)v2 )
{
tokenFill(a1, 10LL, v2, 0LL, 0LL);
*a2 += 5;
result = 1LL;
}
return result;
}

original_code:
int matchGosub(token *tok, char **s)
{
 if (!strncasecmp(*s, "gosub", 5))
 {
  tokenFill(tok, tokTypeGosub, tokValueTypeNone, ((void *)0), 0);
  *s += 5;
  return 1;
 }
 return 0;
}

canonical_original_code:
int matchGosub(struct token *tok, char **s)
{
 if (!strncasecmp(*s, "gosub", 5))
 {
  tokenFill(tok, tokTypeGosub, tokValueTypeNone, ((void *)0), 0);
  *s += 5;
  return 1;
 }
 return 0;
}


matchReturn

decompiled_code:
__int64 __fastcall matchReturn(__int64 a1, const char **a2)
{
__int64 v2; // rdx
__int64 result; // rax

v2 = (unsigned int)strncasecmp(*a2, "return", 6uLL);
result = 0LL;
if ( !(_DWORD)v2 )
{
tokenFill(a1, 26LL, v2, 0LL, 0LL);
*a2 += 6;
result = 1LL;
}
return result;
}

canonical_decompiled_code:
__int64 __fastcall func12(__int64 a1, const char **a2)
{
__int64 v2; // rdx
__int64 result; // rax

v2 = (unsigned int)strncasecmp(*a2, "return", 6uLL);
result = 0LL;
if ( !(_DWORD)v2 )
{
tokenFill(a1, 26LL, v2, 0LL, 0LL);
*a2 += 6;
result = 1LL;
}
return result;
}

original_code:
int matchReturn(token *tok, char **s)
{
 if (!strncasecmp(*s, "return", 6))
 {
  tokenFill(tok, tokTypeReturn, tokValueTypeNone, ((void *)0), 0);
  *s += 6;
  return 1;
 }
 return 0;
}

canonical_original_code:
int matchReturn(struct token *tok, char **s)
{
 if (!strncasecmp(*s, "return", 6))
 {
  tokenFill(tok, tokTypeReturn, tokValueTypeNone, ((void *)0), 0);
  *s += 6;
  return 1;
 }
 return 0;
}


matchIf

decompiled_code:
__int64 __fastcall matchIf(__int64 a1, const char **a2)
{
__int64 v2; // rdx
__int64 result; // rax

v2 = (unsigned int)strncasecmp(*a2, "if", 2uLL);
result = 0LL;
if ( !(_DWORD)v2 )
{
tokenFill(a1, 14LL, v2, 0LL, 0LL);
*a2 += 2;
result = 1LL;
}
return result;
}

canonical_decompiled_code:
__int64 __fastcall func13(__int64 a1, const char **a2)
{
__int64 v2; // rdx
__int64 result; // rax

v2 = (unsigned int)strncasecmp(*a2, "if", 2uLL);
result = 0LL;
if ( !(_DWORD)v2 )
{
tokenFill(a1, 14LL, v2, 0LL, 0LL);
*a2 += 2;
result = 1LL;
}
return result;
}

original_code:
int matchIf(token *tok, char **s)
{
 if (!strncasecmp(*s, "if", 2))
 {
  tokenFill(tok, tokTypeIf, tokValueTypeNone, ((void *)0), 0);
  *s += 2;
  return 1;
 }
 return 0;
}

canonical_original_code:
int matchIf(struct token *tok, char **s)
{
 if (!strncasecmp(*s, "if", 2))
 {
  tokenFill(tok, tokTypeIf, tokValueTypeNone, ((void *)0), 0);
  *s += 2;
  return 1;
 }
 return 0;
}


matchThen

decompiled_code:
__int64 __fastcall matchThen(__int64 a1, const char **a2)
{
__int64 v2; // rdx
__int64 result; // rax

v2 = (unsigned int)strncasecmp(*a2, "then", 4uLL);
result = 0LL;
if ( !(_DWORD)v2 )
{
tokenFill(a1, 32LL, v2, 0LL, 0LL);
*a2 += 4;
result = 1LL;
}
return result;
}

canonical_decompiled_code:
__int64 __fastcall func14(__int64 a1, const char **a2)
{
__int64 v2; // rdx
__int64 result; // rax

v2 = (unsigned int)strncasecmp(*a2, "then", 4uLL);
result = 0LL;
if ( !(_DWORD)v2 )
{
tokenFill(a1, 32LL, v2, 0LL, 0LL);
*a2 += 4;
result = 1LL;
}
return result;
}

original_code:
int matchThen(token *tok, char **s)
{
 if (!strncasecmp(*s, "then", 4))
 {
  tokenFill(tok, tokTypeThen, tokValueTypeNone, ((void *)0), 0);
  *s += 4;
  return 1;
 }
 return 0;
}

canonical_original_code:
int matchThen(struct token *tok, char **s)
{
 if (!strncasecmp(*s, "then", 4))
 {
  tokenFill(tok, tokTypeThen, tokValueTypeNone, ((void *)0), 0);
  *s += 4;
  return 1;
 }
 return 0;
}


matchRemark

decompiled_code:
__int64 __fastcall matchRemark(__int64 a1, const char **a2)
{
__int64 v2; // rdx
__int64 result; // rax

v2 = (unsigned int)strncasecmp(*a2, "rem", 3uLL);
result = 0LL;
if ( !(_DWORD)v2 )
{
tokenFill(a1, 25LL, v2, 0LL, 0LL);
*a2 += 3;
result = 1LL;
}
return result;
}

canonical_decompiled_code:
__int64 __fastcall func15(__int64 a1, const char **a2)
{
__int64 v2; // rdx
__int64 result; // rax

v2 = (unsigned int)strncasecmp(*a2, "rem", 3uLL);
result = 0LL;
if ( !(_DWORD)v2 )
{
tokenFill(a1, 25LL, v2, 0LL, 0LL);
*a2 += 3;
result = 1LL;
}
return result;
}

original_code:
int matchRemark(token *tok, char **s)
{
 if (!strncasecmp(*s, "rem", 3))
 {
  tokenFill(tok, tokTypeRemark, tokValueTypeNone, ((void *)0), 0);
  *s += 3;
  return 1;
 }
 return 0;
}

canonical_original_code:
int matchRemark(struct token *tok, char **s)
{
 if (!strncasecmp(*s, "rem", 3))
 {
  tokenFill(tok, tokTypeRemark, tokValueTypeNone, ((void *)0), 0);
  *s += 3;
  return 1;
 }
 return 0;
}


matchFunctionCall

decompiled_code:
__int64 __fastcall matchFunctionCall(__int64 a1, const char **a2)
{
__int64 v2; // rdx
__int64 result; // rax

v2 = (unsigned int)strncasecmp(*a2, "call", 4uLL);
result = 0LL;
if ( !(_DWORD)v2 )
{
tokenFill(a1, 8LL, v2, 0LL, 0LL);
*a2 += 4;
result = 1LL;
}
return result;
}

canonical_decompiled_code:
__int64 __fastcall func16(__int64 a1, const char **a2)
{
__int64 v2; // rdx
__int64 result; // rax

v2 = (unsigned int)strncasecmp(*a2, "call", 4uLL);
result = 0LL;
if ( !(_DWORD)v2 )
{
tokenFill(a1, 8LL, v2, 0LL, 0LL);
*a2 += 4;
result = 1LL;
}
return result;
}

original_code:
int matchFunctionCall(token *tok, char **s)
{
 if (!strncasecmp(*s, "call", 4))
 {
  tokenFill(tok, tokTypeFunctionCall, tokValueTypeNone, ((void *)0), 0);
  *s += 4;
  return 1;
 }
 return 0;
}

canonical_original_code:
int matchFunctionCall(struct token *tok, char **s)
{
 if (!strncasecmp(*s, "call", 4))
 {
  tokenFill(tok, tokTypeFunctionCall, tokValueTypeNone, ((void *)0), 0);
  *s += 4;
  return 1;
 }
 return 0;
}


matchFunctionPeek

decompiled_code:
__int64 __fastcall matchFunctionPeek(__int64 a1, const char **a2)
{
__int64 v2; // rdx
__int64 result; // rax

v2 = (unsigned int)strncasecmp(*a2, "peek", 4uLL);
result = 0LL;
if ( !(_DWORD)v2 )
{
tokenFill(a1, 9LL, v2, 0LL, 0LL);
*a2 += 4;
result = 1LL;
}
return result;
}

canonical_decompiled_code:
__int64 __fastcall func17(__int64 a1, const char **a2)
{
__int64 v2; // rdx
__int64 result; // rax

v2 = (unsigned int)strncasecmp(*a2, "peek", 4uLL);
result = 0LL;
if ( !(_DWORD)v2 )
{
tokenFill(a1, 9LL, v2, 0LL, 0LL);
*a2 += 4;
result = 1LL;
}
return result;
}

original_code:
int matchFunctionPeek(token *tok, char **s)
{
 if (!strncasecmp(*s, "peek", 4))
 {
  tokenFill(tok, tokTypeFunctionPeek, tokValueTypeNone, ((void *)0), 0);
  *s += 4;
  return 1;
 }
 return 0;
}

canonical_original_code:
int matchFunctionPeek(struct token *tok, char **s)
{
 if (!strncasecmp(*s, "peek", 4))
 {
  tokenFill(tok, tokTypeFunctionPeek, tokValueTypeNone, ((void *)0), 0);
  *s += 4;
  return 1;
 }
 return 0;
}


matchFunction

decompiled_code:
_BOOL8 __fastcall matchFunction(__int64 a1, const char **a2)
{
int v2; // edx
_BOOL8 result; // rax

v2 = matchFunctionCall(a1, a2);
result = 1LL;
if ( !v2 )
result = (unsigned int)matchFunctionPeek(a1, a2) != 0;
return result;
}

canonical_decompiled_code:
_BOOL8 __fastcall func18(__int64 a1, const char **a2)
{
int v2; // edx
_BOOL8 result; // rax

v2 = func16(a1, a2);
result = 1LL;
if ( !v2 )
result = (unsigned int)func17(a1, a2) != 0;
return result;
}

original_code:
int matchFunction(token *tok, char **s)
{
 if (matchFunctionCall(tok, s)) return 1;
 if (matchFunctionPeek(tok, s)) return 1;
 return 0;
}

canonical_original_code:
int matchFunction(struct token *tok, char **s)
{
 if (matchFunctionCall(tok, s)) return 1;
 if (matchFunctionPeek(tok, s)) return 1;
 return 0;
}


matchLeftParenthesis

decompiled_code:
__int64 __fastcall matchLeftParenthesis(__int64 a1, _QWORD *a2)
{
__int64 result; // rax

result = 0LL;
if ( *(_BYTE *)*a2 == 40 )
{
tokenFill(a1, 16LL, 0LL, 0LL, 0LL);
++*a2;
result = 1LL;
}
return result;
}

canonical_decompiled_code:
__int64 __fastcall func19(__int64 a1, _QWORD *a2)
{
__int64 result; // rax

result = 0LL;
if ( *(_BYTE *)*a2 == 40 )
{
tokenFill(a1, 16LL, 0LL, 0LL, 0LL);
++*a2;
result = 1LL;
}
return result;
}

original_code:
int matchLeftParenthesis(token *tok, char **s)
{
 if (**s == '(')
 {
  tokenFill(tok, tokTypeLeftParenthesis, tokValueTypeNone, ((void *)0), 0);
  ++*s;
  return 1;
 }
 return 0;
}

canonical_original_code:
int matchLeftParenthesis(struct token *tok, char **s)
{
 if (**s == '(')
 {
  tokenFill(tok, tokTypeLeftParenthesis, tokValueTypeNone, ((void *)0), 0);
  ++*s;
  return 1;
 }
 return 0;
}


matchRightParenthesis

decompiled_code:
__int64 __fastcall matchRightParenthesis(__int64 a1, _QWORD *a2)
{
__int64 result; // rax

result = 0LL;
if ( *(_BYTE *)*a2 == 41 )
{
tokenFill(a1, 27LL, 0LL, 0LL, 0LL);
++*a2;
result = 1LL;
}
return result;
}

canonical_decompiled_code:
__int64 __fastcall func20(__int64 a1, _QWORD *a2)
{
__int64 result; // rax

result = 0LL;
if ( *(_BYTE *)*a2 == 41 )
{
tokenFill(a1, 27LL, 0LL, 0LL, 0LL);
++*a2;
result = 1LL;
}
return result;
}

original_code:
int matchRightParenthesis(token *tok, char **s)
{
 if (**s == ')')
 {
  tokenFill(tok, tokTypeRightParenthesis, tokValueTypeNone, ((void *)0), 0);
  ++*s;
  return 1;
 }
 return 0;
}

canonical_original_code:
int matchRightParenthesis(struct token *tok, char **s)
{
 if (**s == ')')
 {
  tokenFill(tok, tokTypeRightParenthesis, tokValueTypeNone, ((void *)0), 0);
  ++*s;
  return 1;
 }
 return 0;
}


matchSemicolon

decompiled_code:
__int64 __fastcall matchSemicolon(__int64 a1, _QWORD *a2)
{
__int64 result; // rax

result = 0LL;
if ( *(_BYTE *)*a2 == 59 )
{
tokenFill(a1, 28LL, 0LL, 0LL, 0LL);
++*a2;
result = 1LL;
}
return result;
}

canonical_decompiled_code:
__int64 __fastcall func21(__int64 a1, _QWORD *a2)
{
__int64 result; // rax

result = 0LL;
if ( *(_BYTE *)*a2 == 59 )
{
tokenFill(a1, 28LL, 0LL, 0LL, 0LL);
++*a2;
result = 1LL;
}
return result;
}

original_code:
int matchSemicolon(token *tok, char **s)
{
 if (**s == ';')
 {
  tokenFill(tok, tokTypeSemicolon, tokValueTypeNone, ((void *)0), 0);
  ++*s;
  return 1;
 }
 return 0;
}

canonical_original_code:
int matchSemicolon(struct token *tok, char **s)
{
 if (**s == ';')
 {
  tokenFill(tok, tokTypeSemicolon, tokValueTypeNone, ((void *)0), 0);
  ++*s;
  return 1;
 }
 return 0;
}


matchSeparator

decompiled_code:
_BOOL8 __fastcall matchSeparator(__int64 a1, _QWORD *a2)
{
int v2; // edx
_BOOL8 result; // rax

v2 = matchComma(a1, a2);
result = 1LL;
if ( !v2 )
result = (unsigned int)matchSemicolon(a1, a2) != 0;
return result;
}

canonical_decompiled_code:
_BOOL8 __fastcall func22(__int64 a1, _QWORD *a2)
{
int v2; // edx
_BOOL8 result; // rax

v2 = func1(a1, a2);
result = 1LL;
if ( !v2 )
result = (unsigned int)func21(a1, a2) != 0;
return result;
}

original_code:
int matchSeparator(token *tok, char **s)
{
 if (matchComma(tok, s)) return 1;
 else if (matchSemicolon(tok, s)) return 1;
 return 0;
}

canonical_original_code:
int matchSeparator(struct token *tok, char **s)
{
 if (matchComma(tok, s)) return 1;
 else if (matchSemicolon(tok, s)) return 1;
 return 0;
}


matchColon

decompiled_code:
__int64 __fastcall matchColon(__int64 a1, _QWORD *a2)
{
__int64 result; // rax

result = 0LL;
if ( *(_BYTE *)*a2 == 58 )
{
tokenFill(a1, 4LL, 0LL, 0LL, 0LL);
++*a2;
result = 1LL;
}
return result;
}

canonical_decompiled_code:
__int64 __fastcall func23(__int64 a1, _QWORD *a2)
{
__int64 result; // rax

result = 0LL;
if ( *(_BYTE *)*a2 == 58 )
{
tokenFill(a1, 4LL, 0LL, 0LL, 0LL);
++*a2;
result = 1LL;
}
return result;
}

original_code:
int matchColon(token *tok, char **s)
{
 if (**s == ':')
 {
  tokenFill(tok, tokTypeColon, tokValueTypeNone, ((void *)0), 0);
  ++*s;
  return 1;
 }
 return 0;
}

canonical_original_code:
int matchColon(struct token *tok, char **s)
{
 if (**s == ':')
 {
  tokenFill(tok, tokTypeColon, tokValueTypeNone, ((void *)0), 0);
  ++*s;
  return 1;
 }
 return 0;
}


matchVariable

decompiled_code:
__int64 __fastcall matchVariable(__int64 a1, char **a2)
{
const unsigned __int16 *v2; // rdx
__int64 result; // rax

v2 = *_ctype_b_loc();
result = 0LL;
if ( (v2[**a2] & 0x400) != 0 )
{
tokenFill(a1, 34LL, 2LL, *a2, 1LL);
++*a2;
result = 1LL;
}
return result;
}

canonical_decompiled_code:
__int64 __fastcall func24(__int64 a1, char **a2)
{
const unsigned __int16 *v2; // rdx
__int64 result; // rax

v2 = *_ctype_b_loc();
result = 0LL;
if ( (v2[**a2] & 0x400) != 0 )
{
tokenFill(a1, 34LL, 2LL, *a2, 1LL);
++*a2;
result = 1LL;
}
return result;
}

original_code:
int matchVariable(token *tok, char **s)
{
 if (((*__ctype_b_loc ())[(int) ((**s))] & (unsigned short int) _ISalpha))
 {
  tokenFill(tok, tokTypeVariable, tokValueTypeCharacter, *s, 1);
  ++*s;
  return 1;
 }
 return 0;
}

canonical_original_code:
int matchVariable(struct token *tok, char **s)
{
 if (((*__ctype_b_loc ())[(int) ((**s))] & (unsigned short) _ISalpha))
 {
  tokenFill(tok, tokTypeVariable, tokValueTypeCharacter, *s, 1);
  ++*s;
  return 1;
 }
 return 0;
}


matchLessThan

decompiled_code:
__int64 __fastcall matchLessThan(__int64 a1, _QWORD *a2)
{
__int64 result; // rax

result = 0LL;
if ( *(_BYTE *)*a2 == 60 )
{
tokenFill(a1, 17LL, 0LL, 0LL, 0LL);
++*a2;
result = 1LL;
}
return result;
}

canonical_decompiled_code:
__int64 __fastcall func25(__int64 a1, _QWORD *a2)
{
__int64 result; // rax

result = 0LL;
if ( *(_BYTE *)*a2 == 60 )
{
tokenFill(a1, 17LL, 0LL, 0LL, 0LL);
++*a2;
result = 1LL;
}
return result;
}

original_code:
int matchLessThan(token *tok, char **s)
{
 if (**s == '<')
 {
  tokenFill(tok, tokTypeLessThan, tokValueTypeNone, ((void *)0), 0);
  ++*s;
  return 1;
 }
 return 0;
}

canonical_original_code:
int matchLessThan(struct token *tok, char **s)
{
 if (**s == '<')
 {
  tokenFill(tok, tokTypeLessThan, tokValueTypeNone, ((void *)0), 0);
  ++*s;
  return 1;
 }
 return 0;
}


matchGreaterThan

decompiled_code:
__int64 __fastcall matchGreaterThan(__int64 a1, _QWORD *a2)
{
__int64 result; // rax

result = 0LL;
if ( *(_BYTE *)*a2 == 62 )
{
tokenFill(a1, 12LL, 0LL, 0LL, 0LL);
++*a2;
result = 1LL;
}
return result;
}

canonical_decompiled_code:
__int64 __fastcall func26(__int64 a1, _QWORD *a2)
{
__int64 result; // rax

result = 0LL;
if ( *(_BYTE *)*a2 == 62 )
{
tokenFill(a1, 12LL, 0LL, 0LL, 0LL);
++*a2;
result = 1LL;
}
return result;
}

original_code:
int matchGreaterThan(token *tok, char **s)
{
 if (**s == '>')
 {
  tokenFill(tok, tokTypeGreaterThan, tokValueTypeNone, ((void *)0), 0);
  ++*s;
  return 1;
 }
 return 0;
}

canonical_original_code:
int matchGreaterThan(struct token *tok, char **s)
{
 if (**s == '>')
 {
  tokenFill(tok, tokTypeGreaterThan, tokValueTypeNone, ((void *)0), 0);
  ++*s;
  return 1;
 }
 return 0;
}


matchEquals

decompiled_code:
__int64 __fastcall matchEquals(__int64 a1, _QWORD *a2)
{
__int64 result; // rax

result = 0LL;
if ( *(_BYTE *)*a2 == 61 )
{
tokenFill(a1, 6LL, 0LL, 0LL, 0LL);
++*a2;
result = 1LL;
}
return result;
}

canonical_decompiled_code:
__int64 __fastcall func27(__int64 a1, _QWORD *a2)
{
__int64 result; // rax

result = 0LL;
if ( *(_BYTE *)*a2 == 61 )
{
tokenFill(a1, 6LL, 0LL, 0LL, 0LL);
++*a2;
result = 1LL;
}
return result;
}

original_code:
int matchEquals(token *tok, char **s)
{
 if (**s == '=')
 {
  tokenFill(tok, tokTypeEquals, tokValueTypeNone, ((void *)0), 0);
  ++*s;
  return 1;
 }
 return 0;
}

canonical_original_code:
int matchEquals(struct token *tok, char **s)
{
 if (**s == '=')
 {
  tokenFill(tok, tokTypeEquals, tokValueTypeNone, ((void *)0), 0);
  ++*s;
  return 1;
 }
 return 0;
}


matchLessThanOrEquals

decompiled_code:
__int64 __fastcall matchLessThanOrEquals(__int64 a1, const char **a2)
{
__int64 v2; // rdx
__int64 result; // rax

v2 = (unsigned int)strncasecmp(*a2, "<=", 2uLL);
result = 0LL;
if ( !(_DWORD)v2 )
{
tokenFill(a1, 18LL, v2, 0LL, 0LL);
*a2 += 2;
result = 1LL;
}
return result;
}

canonical_decompiled_code:
__int64 __fastcall func28(__int64 a1, const char **a2)
{
__int64 v2; // rdx
__int64 result; // rax

v2 = (unsigned int)strncasecmp(*a2, "<=", 2uLL);
result = 0LL;
if ( !(_DWORD)v2 )
{
tokenFill(a1, 18LL, v2, 0LL, 0LL);
*a2 += 2;
result = 1LL;
}
return result;
}

original_code:
int matchLessThanOrEquals(token *tok, char **s)
{
 if (!strncasecmp(*s, "<=", 2))
 {
  tokenFill(tok, tokTypeLessThanOrEquals, tokValueTypeNone, ((void *)0), 0);
  *s += 2;
  return 1;
 }
 return 0;
}

canonical_original_code:
int matchLessThanOrEquals(struct token *tok, char **s)
{
 if (!strncasecmp(*s, "<=", 2))
 {
  tokenFill(tok, tokTypeLessThanOrEquals, tokValueTypeNone, ((void *)0), 0);
  *s += 2;
  return 1;
 }
 return 0;
}


matchGreaterThanOrEquals

decompiled_code:
__int64 __fastcall matchGreaterThanOrEquals(__int64 a1, const char **a2)
{
__int64 v2; // rdx
__int64 result; // rax

v2 = (unsigned int)strncasecmp(*a2, ">=", 2uLL);
result = 0LL;
if ( !(_DWORD)v2 )
{
tokenFill(a1, 13LL, v2, 0LL, 0LL);
*a2 += 2;
result = 1LL;
}
return result;
}

canonical_decompiled_code:
__int64 __fastcall func29(__int64 a1, const char **a2)
{
__int64 v2; // rdx
__int64 result; // rax

v2 = (unsigned int)strncasecmp(*a2, ">=", 2uLL);
result = 0LL;
if ( !(_DWORD)v2 )
{
tokenFill(a1, 13LL, v2, 0LL, 0LL);
*a2 += 2;
result = 1LL;
}
return result;
}

original_code:
int matchGreaterThanOrEquals(token *tok, char **s)
{
 if (!strncasecmp(*s, ">=", 2))
 {
  tokenFill(tok, tokTypeGreaterThanOrEquals, tokValueTypeNone, ((void *)0), 0);
  *s += 2;
  return 1;
 }
 return 0;
}

canonical_original_code:
int matchGreaterThanOrEquals(struct token *tok, char **s)
{
 if (!strncasecmp(*s, ">=", 2))
 {
  tokenFill(tok, tokTypeGreaterThanOrEquals, tokValueTypeNone, ((void *)0), 0);
  *s += 2;
  return 1;
 }
 return 0;
}


matchNotEquals

decompiled_code:
__int64 __fastcall matchNotEquals(__int64 a1, const char **a2)
{
const char *v2; // rbp
int v3; // edx
__int64 result; // rax

v2 = *a2;
if ( !strncasecmp(*a2, "<>", 2uLL) || (v3 = strncasecmp(v2, "><", 2uLL), result = 0LL, !v3) )
{
tokenFill(a1, 21LL, 0LL, 0LL, 0LL);
*a2 += 2;
result = 1LL;
}
return result;
}

canonical_decompiled_code:
__int64 __fastcall func30(__int64 a1, const char **a2)
{
const char *v2; // rbp
int v3; // edx
__int64 result; // rax

v2 = *a2;
if ( !strncasecmp(*a2, "<>", 2uLL) || (v3 = strncasecmp(v2, "><", 2uLL), result = 0LL, !v3) )
{
tokenFill(a1, 21LL, 0LL, 0LL, 0LL);
*a2 += 2;
result = 1LL;
}
return result;
}

original_code:
int matchNotEquals(token *tok, char **s)
{
 if (!strncasecmp(*s, "<>", 2) || !strncasecmp(*s, "><", 2))
 {
  tokenFill(tok, tokTypeNotEquals, tokValueTypeNone, ((void *)0), 0);
  *s += 2;
  return 1;
 }
 return 0;
}

canonical_original_code:
int matchNotEquals(struct token *tok, char **s)
{
 if (!strncasecmp(*s, "<>", 2) || !strncasecmp(*s, "><", 2))
 {
  tokenFill(tok, tokTypeNotEquals, tokValueTypeNone, ((void *)0), 0);
  *s += 2;
  return 1;
 }
 return 0;
}


matchRelationalOperator

decompiled_code:
_BOOL8 __fastcall matchRelationalOperator(__int64 a1, const char **a2)
{
int v2; // edx
_BOOL8 result; // rax
int v4; // edx
int v5; // edx
int v6; // edx
int v7; // edx

v2 = matchLessThanOrEquals(a1, a2);
result = 1LL;
if ( !v2 )
{
v4 = matchGreaterThanOrEquals(a1, a2);
result = 1LL;
if ( !v4 )
{
v5 = matchNotEquals(a1, a2);
result = 1LL;
if ( !v5 )
{
v6 = matchLessThan(a1, a2);
result = 1LL;
if ( !v6 )
{
v7 = matchGreaterThan(a1, a2);
result = 1LL;
if ( !v7 )
result = (unsigned int)matchEquals(a1, a2) != 0;
}
}
}
}
return result;
}

canonical_decompiled_code:
_BOOL8 __fastcall func31(__int64 a1, const char **a2)
{
int v2; // edx
_BOOL8 result; // rax
int v4; // edx
int v5; // edx
int v6; // edx
int v7; // edx

v2 = func28(a1, a2);
result = 1LL;
if ( !v2 )
{
v4 = func29(a1, a2);
result = 1LL;
if ( !v4 )
{
v5 = func30(a1, a2);
result = 1LL;
if ( !v5 )
{
v6 = func25(a1, a2);
result = 1LL;
if ( !v6 )
{
v7 = func26(a1, a2);
result = 1LL;
if ( !v7 )
result = (unsigned int)func27(a1, a2) != 0;
}
}
}
}
return result;
}

original_code:
int matchRelationalOperator(token *tok, char **s)
{
 if (matchLessThanOrEquals(tok, s)) return 1;
 if (matchGreaterThanOrEquals(tok, s)) return 1;
 if (matchNotEquals(tok, s)) return 1;
 if (matchLessThan(tok, s)) return 1;
 if (matchGreaterThan(tok, s)) return 1;
 if (matchEquals(tok, s)) return 1;
 return 0;
}

canonical_original_code:
int matchRelationalOperator(struct token *tok, char **s)
{
 if (matchLessThanOrEquals(tok, s)) return 1;
 if (matchGreaterThanOrEquals(tok, s)) return 1;
 if (matchNotEquals(tok, s)) return 1;
 if (matchLessThan(tok, s)) return 1;
 if (matchGreaterThan(tok, s)) return 1;
 if (matchEquals(tok, s)) return 1;
 return 0;
}


matchPlus

decompiled_code:
__int64 __fastcall matchPlus(__int64 a1, _QWORD *a2)
{
__int64 result; // rax

result = 0LL;
if ( *(_BYTE *)*a2 == 43 )
{
tokenFill(a1, 22LL, 0LL, 0LL, 0LL);
++*a2;
result = 1LL;
}
return result;
}

canonical_decompiled_code:
__int64 __fastcall func32(__int64 a1, _QWORD *a2)
{
__int64 result; // rax

result = 0LL;
if ( *(_BYTE *)*a2 == 43 )
{
tokenFill(a1, 22LL, 0LL, 0LL, 0LL);
++*a2;
result = 1LL;
}
return result;
}

original_code:
int matchPlus(token *tok, char **s)
{
 if (**s == '+')
 {
  tokenFill(tok, tokTypePlus, tokValueTypeNone, ((void *)0), 0);
  ++*s;
  return 1;
 }
 return 0;
}

canonical_original_code:
int matchPlus(struct token *tok, char **s)
{
 if (**s == '+')
 {
  tokenFill(tok, tokTypePlus, tokValueTypeNone, ((void *)0), 0);
  ++*s;
  return 1;
 }
 return 0;
}


matchMinus

decompiled_code:
__int64 __fastcall matchMinus(__int64 a1, _QWORD *a2)
{
__int64 result; // rax

result = 0LL;
if ( *(_BYTE *)*a2 == 45 )
{
tokenFill(a1, 20LL, 0LL, 0LL, 0LL);
++*a2;
result = 1LL;
}
return result;
}

canonical_decompiled_code:
__int64 __fastcall func33(__int64 a1, _QWORD *a2)
{
__int64 result; // rax

result = 0LL;
if ( *(_BYTE *)*a2 == 45 )
{
tokenFill(a1, 20LL, 0LL, 0LL, 0LL);
++*a2;
result = 1LL;
}
return result;
}

original_code:
int matchMinus(token *tok, char **s)
{
 if (**s == '-')
 {
  tokenFill(tok, tokTypeMinus, tokValueTypeNone, ((void *)0), 0);
  ++*s;
  return 1;
 }
 return 0;
}

canonical_original_code:
int matchMinus(struct token *tok, char **s)
{
 if (**s == '-')
 {
  tokenFill(tok, tokTypeMinus, tokValueTypeNone, ((void *)0), 0);
  ++*s;
  return 1;
 }
 return 0;
}


matchTimes

decompiled_code:
__int64 __fastcall matchTimes(__int64 a1, _QWORD *a2)
{
__int64 result; // rax

result = 0LL;
if ( *(_BYTE *)*a2 == 42 )
{
tokenFill(a1, 33LL, 0LL, 0LL, 0LL);
++*a2;
result = 1LL;
}
return result;
}

canonical_decompiled_code:
__int64 __fastcall func34(__int64 a1, _QWORD *a2)
{
__int64 result; // rax

result = 0LL;
if ( *(_BYTE *)*a2 == 42 )
{
tokenFill(a1, 33LL, 0LL, 0LL, 0LL);
++*a2;
result = 1LL;
}
return result;
}

original_code:
int matchTimes(token *tok, char **s)
{
 if (**s == '*')
 {
  tokenFill(tok, tokTypeTimes, tokValueTypeNone, ((void *)0), 0);
  ++*s;
  return 1;
 }
 return 0;
}

canonical_original_code:
int matchTimes(struct token *tok, char **s)
{
 if (**s == '*')
 {
  tokenFill(tok, tokTypeTimes, tokValueTypeNone, ((void *)0), 0);
  ++*s;
  return 1;
 }
 return 0;
}


matchDividedBy

decompiled_code:
__int64 __fastcall matchDividedBy(__int64 a1, _QWORD *a2)
{
__int64 result; // rax

result = 0LL;
if ( *(_BYTE *)*a2 == 47 )
{
tokenFill(a1, 5LL, 0LL, 0LL, 0LL);
++*a2;
result = 1LL;
}
return result;
}

canonical_decompiled_code:
__int64 __fastcall func35(__int64 a1, _QWORD *a2)
{
__int64 result; // rax

result = 0LL;
if ( *(_BYTE *)*a2 == 47 )
{
tokenFill(a1, 5LL, 0LL, 0LL, 0LL);
++*a2;
result = 1LL;
}
return result;
}

original_code:
int matchDividedBy(token *tok, char **s)
{
 if (**s == '/')
 {
  tokenFill(tok, tokTypeDividedBy, tokValueTypeNone, ((void *)0), 0);
  ++*s;
  return 1;
 }
 return 0;
}

canonical_original_code:
int matchDividedBy(struct token *tok, char **s)
{
 if (**s == '/')
 {
  tokenFill(tok, tokTypeDividedBy, tokValueTypeNone, ((void *)0), 0);
  ++*s;
  return 1;
 }
 return 0;
}


matchPoke

decompiled_code:
__int64 __fastcall matchPoke(__int64 a1, const char **a2)
{
__int64 v2; // rdx
__int64 result; // rax

v2 = (unsigned int)strncasecmp(*a2, "poke", 4uLL);
result = 0LL;
if ( !(_DWORD)v2 )
{
tokenFill(a1, 9LL, v2, 0LL, 0LL);
*a2 += 4;
result = 1LL;
}
return result;
}

canonical_decompiled_code:
__int64 __fastcall func36(__int64 a1, const char **a2)
{
__int64 v2; // rdx
__int64 result; // rax

v2 = (unsigned int)strncasecmp(*a2, "poke", 4uLL);
result = 0LL;
if ( !(_DWORD)v2 )
{
tokenFill(a1, 9LL, v2, 0LL, 0LL);
*a2 += 4;
result = 1LL;
}
return result;
}

original_code:
int matchPoke(token *tok, char **s)
{
 if (!strncasecmp(*s, "poke", 4))
 {
  tokenFill(tok, tokTypeFunctionPeek, tokValueTypeNone, ((void *)0), 0);
  *s += 4;
  return 1;
 }
 return 0;
}

canonical_original_code:
int matchPoke(struct token *tok, char **s)
{
 if (!strncasecmp(*s, "poke", 4))
 {
  tokenFill(tok, tokTypeFunctionPeek, tokValueTypeNone, ((void *)0), 0);
  *s += 4;
  return 1;
 }
 return 0;
}


parseVariableList

decompiled_code:
__int64 __fastcall parseVariableList(__int64 a1, __int64 a2)
{
__int64 result; // rax
char v3; // r13
int v4; // eax
int *v5; // rbx
unsigned int v6; // eax
int v7; // edx
char nptr[8]; // [rsp+4h] [rbp-34h] BYREF
int v9; // [rsp+Ch] [rbp-2Ch] BYREF

result = matchVariable();
if ( (_DWORD)result )
{
v3 = *(_BYTE *)(a1 + 8);
*(_QWORD *)nptr = 0LL;
v9 = 0;
do
{
do
v4 = getchar();
while ( v4 == 32 );
}
while ( v4 == 9 );
if ( (unsigned int)(v4 - 48) <= 9 )
{
nptr[0] = v4;
v4 = getchar();
v5 = (int *)&nptr[1];
do
{
if ( (unsigned int)(v4 - 48) > 9 )
break;
*(_BYTE *)v5 = v4;
v4 = getchar();
v5 = (int *)((char *)v5 + 1);
}
while ( v5 != (int *)((char *)&v9 + 3) );
}
ungetc(v4, stdin);
v6 = atoi(nptr);
variableSet((unsigned int)v3, v6);
matchWhiteSpace(&testToken, a2);
if ( !(unsigned int)matchComma(a1, a2)
|| (matchWhiteSpace(&testToken, a2), v7 = parseVariableList(a1, a2), result = 1LL, !v7) )
{
while ( fgetc(stdin) != 10 )
;
result = 1LL;
}
}
return result;
}

canonical_decompiled_code:
__int64 __fastcall func0(__int64 a1, __int64 a2)
{
__int64 result; // rax
char v3; // r13
int v4; // eax
int *v5; // rbx
unsigned int v6; // eax
int v7; // edx
char nptr[8]; // [rsp+4h] [rbp-34h] BYREF
int v9; // [rsp+Ch] [rbp-2Ch] BYREF

result = matchVariable();
if ( (_DWORD)result )
{
v3 = *(_BYTE *)(a1 + 8);
*(_QWORD *)nptr = 0LL;
v9 = 0;
do
{
do
v4 = getchar();
while ( v4 == 32 );
}
while ( v4 == 9 );
if ( (unsigned int)(v4 - 48) <= 9 )
{
nptr[0] = v4;
v4 = getchar();
v5 = (int *)&nptr[1];
do
{
if ( (unsigned int)(v4 - 48) > 9 )
break;
*(_BYTE *)v5 = v4;
v4 = getchar();
v5 = (int *)((char *)v5 + 1);
}
while ( v5 != (int *)((char *)&v9 + 3) );
}
ungetc(v4, stdin);
v6 = atoi(nptr);
variableSet((unsigned int)v3, v6);
matchWhiteSpace(&testToken, a2);
if ( !(unsigned int)matchComma(a1, a2)
|| (matchWhiteSpace(&testToken, a2), v7 = func0(a1, a2), result = 1LL, !v7) )
{
while ( fgetc(stdin) != 10 )
;
result = 1LL;
}
}
return result;
}

original_code:
int parseVariableList(token *tok, char **s)
{
 char var;
 int i;
 char input[12];
 int c;
  if (matchVariable(tok, s))
  {
  var = tok->c;
  memset(input, 0, 12);
  do
  {
   c = getchar();
  } while ((c == ' ') || (c == '\t'));
  for (i = 0; i < 11; i++)
  {
   if ((c < '0') || (c > '9')) break;
   input[i] = (char)c;
   c = getchar();
  }
  ungetc(c, stdin);
  variableSet(var, atoi(input));
  matchWhiteSpace(&testToken, s);
    if (matchComma(tok, s))
  {
   matchWhiteSpace(&testToken, s);
      if (parseVariableList(tok, s))
        return 1;
  }
  while ((fgetc(stdin)) != '\n') ;
    return 1;
  }
  return 0;
}

canonical_original_code:
int parseVariableList(struct token *tok, char **s)
{
 char var;
 int i;
 char input[12];
 int c;
  if (matchVariable(tok, s))
  {
  var = tok->c;
  memset(input, 0, 12);
  do
  {
   c = getchar();
  } while ((c == ' ') || (c == '\t'));
  for (i = 0; i < 11; i++)
  {
   if ((c < '0') || (c > '9')) break;
   input[i] = (char)c;
   c = getchar();
  }
  ungetc(c, stdin);
  variableSet(var, atoi(input));
  matchWhiteSpace(&testToken, s);
    if (matchComma(tok, s))
  {
   matchWhiteSpace(&testToken, s);
      if (parseVariableList(tok, s))
        return 1;
  }
  while ((fgetc(stdin)) != '\n') ;
    return 1;
  }
  return 0;
}

variable_types: var char

variable_types:
input
char [12]

variable_types: c int


parseFunction

decompiled_code:
__int64 __fastcall parseFunction(int *a1, __int64 a2)
{
__int64 result; // rax
int v3; // er12
unsigned int v4; // er13

result = matchFunction();
if ( (_DWORD)result )
{
v3 = *a1;
matchWhiteSpace(&testToken, a2);
result = matchLeftParenthesis(a1, a2);
if ( (_DWORD)result )
{
matchWhiteSpace(&testToken, a2);
result = parseExpression(a1, a2);
if ( (_DWORD)result )
{
v4 = a1[2];
matchWhiteSpace(&testToken, a2);
result = matchRightParenthesis(a1, a2);
if ( (_DWORD)result )
{
result = 1LL;
if ( v3 != 8 )
{
if ( v3 == 9 )
{
*a1 = 1;
a1[1] = 3;
a1[2] = functionPeek(v4);
result = 1LL;
}
else
{
errorSet(10LL);
result = 0LL;
}
}
}
}
}
}
return result;
}

canonical_decompiled_code:
__int64 __fastcall func1(int *a1, __int64 a2)
{
__int64 result; // rax
int v3; // er12
unsigned int v4; // er13

result = matchFunction();
if ( (_DWORD)result )
{
v3 = *a1;
matchWhiteSpace(&testToken, a2);
result = matchLeftParenthesis(a1, a2);
if ( (_DWORD)result )
{
matchWhiteSpace(&testToken, a2);
result = func5(a1, a2);
if ( (_DWORD)result )
{
v4 = a1[2];
matchWhiteSpace(&testToken, a2);
result = matchRightParenthesis(a1, a2);
if ( (_DWORD)result )
{
result = 1LL;
if ( v3 != 8 )
{
if ( v3 == 9 )
{
*a1 = 1;
a1[1] = 3;
a1[2] = functionPeek(v4);
result = 1LL;
}
else
{
errorSet(10LL);
result = 0LL;
}
}
}
}
}
}
return result;
}

original_code:
int parseFunction(token *tok, char **s)
{
 tokenType func;
 int value;
  if (matchFunction(tok, s))
  {
    func = tok->type;
  matchWhiteSpace(&testToken, s);
    if (matchLeftParenthesis(tok, s))
  {
   matchWhiteSpace(&testToken, s);
   if (parseExpression(tok, s))
   {
    value = tok->n;
    matchWhiteSpace(&testToken, s);
    if (matchRightParenthesis(tok, s))
    {
     switch (func)
     {
      case tokTypeFunctionCall:
       break;
      case tokTypeFunctionPeek:
       tok->type = tokTypeNumber;
       tok->valueType = tokValueTypeNumber;
       tok->n = functionPeek(value);
       break;
      default:
       errorSet(10);
       return 0;
     }
     return 1;
    }
   }
  }
  }
  return 0;
}

canonical_original_code:
int parseFunction(struct token *tok, char **s)
{
 enum tokenType func;
 int value;
  if (matchFunction(tok, s))
  {
    func = tok->type;
  matchWhiteSpace(&testToken, s);
    if (matchLeftParenthesis(tok, s))
  {
   matchWhiteSpace(&testToken, s);
   if (parseExpression(tok, s))
   {
    value = tok->n;
    matchWhiteSpace(&testToken, s);
    if (matchRightParenthesis(tok, s))
    {
     switch (func)
     {
      case tokTypeFunctionCall:
       break;
      case tokTypeFunctionPeek:
       tok->type = tokTypeNumber;
       tok->valueType = tokValueTypeNumber;
       tok->n = functionPeek(value);
       break;
      default:
       errorSet(10);
       return 0;
     }
     return 1;
    }
   }
  }
  }
  return 0;
}

variable_types: enum tokenType { tokTypeComma=0, tokTypeNumber=1, tokTypeEOL=2, tokTypeCharacterString=3, tokTypeColon=4, tokTypeDividedBy=5, tokTypeEquals=6, tokTypeFree=7, tokTypeFunctionCall=8, tokTypeFunctionPeek=9, tokTypeGosub=10, tokTypeGoto=11, tokTypeGreaterThan=12, tokTypeGreaterThanOrEquals=13, tokTypeIf=14, tokTypeInput=15, tokTypeLeftParenthesis=16, tokTypeLessThan=17, tokTypeLessThanOrEquals=18, tokTypeLet=19, tokTypeMinus=20, tokTypeNotEquals=21, tokTypePlus=22, tokTypePoke=23, tokTypePrint=24, tokTypeRemark=25, tokTypeReturn=26, tokTypeRightParenthesis=27, tokTypeSemicolon=28, tokTypeSize=29, tokTypeString=30, tokTypeDoubleQuote=31, tokTypeThen=32, tokTypeTimes=33, tokTypeVariable=34, tokTypeWhiteSpace=35, tokTypeClear=36, tokTypeRun=37, tokTypeList=38 }

variable_types: value int


parseFactor

decompiled_code:
__int64 __fastcall parseFactor(int *a1, __int64 a2)
{
unsigned int v2; // ebp

v2 = 1;
if ( !(unsigned int)parseFunction(a1, a2) )
{
if ( (unsigned int)matchLeftParenthesis(a1, a2) )
{
matchWhiteSpace(&testToken, a2);
v2 = parseExpression(a1, a2);
if ( v2 )
{
matchWhiteSpace(&testToken, a2);
v2 = matchRightParenthesis(&testToken, a2);
if ( v2 )
v2 = 1;
else
errorSet(21LL);
}
}
else if ( (unsigned int)matchVariable(a1, a2) )
{
a1[1] = 3;
a1[2] = variableGet((unsigned int)*((char *)a1 + 8));
v2 = 1;
}
else
{
v2 = matchNumber(a1, a2) != 0;
}
}
return v2;
}

canonical_decompiled_code:
__int64 __fastcall func2(int *a1, __int64 a2)
{
unsigned int v2; // ebp

v2 = 1;
if ( !(unsigned int)func1(a1, a2) )
{
if ( (unsigned int)matchLeftParenthesis(a1, a2) )
{
matchWhiteSpace(&testToken, a2);
v2 = func5(a1, a2);
if ( v2 )
{
matchWhiteSpace(&testToken, a2);
v2 = matchRightParenthesis(&testToken, a2);
if ( v2 )
v2 = 1;
else
errorSet(21LL);
}
}
else if ( (unsigned int)matchVariable(a1, a2) )
{
a1[1] = 3;
a1[2] = variableGet((unsigned int)*((char *)a1 + 8));
v2 = 1;
}
else
{
v2 = matchNumber(a1, a2) != 0;
}
}
return v2;
}

original_code:
int parseFactor(token *tok, char **s)
{
  if (parseFunction(tok, s))
  return 1;
  if (matchLeftParenthesis(tok, s))
 {
  matchWhiteSpace(&testToken, s);
    if (parseExpression(tok, s))
  {
   matchWhiteSpace(&testToken, s);
      if (matchRightParenthesis(&testToken, s)) return 1;
   else errorSet(21);
  }
  return 0;
 }
  if (matchVariable(tok, s))
 {
  tok->valueType = tokValueTypeNumber;
  tok->n = variableGet(tok->c);
    return 1;
 }
  if (matchNumber(tok, s))
    return 1;
  return 0;
}

canonical_original_code:
int parseFactor(struct token *tok, char **s)
{
  if (parseFunction(tok, s))
  return 1;
  if (matchLeftParenthesis(tok, s))
 {
  matchWhiteSpace(&testToken, s);
    if (parseExpression(tok, s))
  {
   matchWhiteSpace(&testToken, s);
      if (matchRightParenthesis(&testToken, s)) return 1;
   else errorSet(21);
  }
  return 0;
 }
  if (matchVariable(tok, s))
 {
  tok->valueType = tokValueTypeNumber;
  tok->n = variableGet(tok->c);
    return 1;
 }
  if (matchNumber(tok, s))
    return 1;
  return 0;
}


parseTerm

decompiled_code:
__int64 __fastcall parseTerm(int *a1, __int64 a2)
{
int v2; // ebx
int v4; // er13

v2 = parseFactor(a1, a2);
if ( v2 )
{
v4 = a1[2];
matchWhiteSpace(&testToken, a2);
if ( (unsigned int)matchTimes(a1, a2) )
{
matchWhiteSpace(&testToken, a2);
v2 = parseTerm(a1, a2);
if ( v2 )
{
a1[2] *= v4;
v2 = 1;
}
}
else
{
v2 = 1;
if ( (unsigned int)matchDividedBy(a1, a2) )
{
matchWhiteSpace(&testToken, a2);
v2 = parseTerm(a1, a2);
if ( v2 )
{
v2 = a1[2];
if ( v2 )
{
a1[2] = v4 / v2;
v2 = 1;
}
else
{
errorSet(28LL);
}
}
}
}
}
return (unsigned int)v2;
}

canonical_decompiled_code:
__int64 __fastcall func3(int *a1, __int64 a2)
{
int v2; // ebx
int v4; // er13

v2 = func2(a1, a2);
if ( v2 )
{
v4 = a1[2];
matchWhiteSpace(&testToken, a2);
if ( (unsigned int)matchTimes(a1, a2) )
{
matchWhiteSpace(&testToken, a2);
v2 = func3(a1, a2);
if ( v2 )
{
a1[2] *= v4;
v2 = 1;
}
}
else
{
v2 = 1;
if ( (unsigned int)matchDividedBy(a1, a2) )
{
matchWhiteSpace(&testToken, a2);
v2 = func3(a1, a2);
if ( v2 )
{
v2 = a1[2];
if ( v2 )
{
a1[2] = v4 / v2;
v2 = 1;
}
else
{
errorSet(28LL);
}
}
}
}
}
return (unsigned int)v2;
}

original_code:
int parseTerm(token *tok, char **s)
{
 int firstFactor = 0;
  if (parseFactor(tok, s))
  {
  firstFactor = tok->n;
  matchWhiteSpace(&testToken, s);
    if (matchTimes(tok, s))
  {
   matchWhiteSpace(&testToken, s);
      if (parseTerm(tok, s))
   {
    tok->n = firstFactor * tok->n;
        return 1;
   }
   return 0;
  }
    if (matchDividedBy(tok, s))
  {
   matchWhiteSpace(&testToken, s);
      if (parseTerm(tok, s))
   {
    if (!tok->n)
    {
     errorSet(28);
     return 0;
    }
    tok->n = firstFactor / tok->n;
        return 1;
   }
   return 0;
  }
    return 1;
  }
  return 0;
}

canonical_original_code:
int parseTerm(struct token *tok, char **s)
{
 int firstFactor = 0;
  if (parseFactor(tok, s))
  {
  firstFactor = tok->n;
  matchWhiteSpace(&testToken, s);
    if (matchTimes(tok, s))
  {
   matchWhiteSpace(&testToken, s);
      if (parseTerm(tok, s))
   {
    tok->n = firstFactor * tok->n;
        return 1;
   }
   return 0;
  }
    if (matchDividedBy(tok, s))
  {
   matchWhiteSpace(&testToken, s);
      if (parseTerm(tok, s))
   {
    if (!tok->n)
    {
     errorSet(28);
     return 0;
    }
    tok->n = firstFactor / tok->n;
        return 1;
   }
   return 0;
  }
    return 1;
  }
  return 0;
}

variable_types: firstFactor int


parseUnsignedExpression

decompiled_code:
__int64 __fastcall parseUnsignedExpression(int *a1, __int64 a2)
{
__int64 result; // rax
int v3; // er12
int v4; // edx

result = parseTerm(a1, a2);
if ( (_DWORD)result )
{
v3 = a1[2];
matchWhiteSpace(&testToken, a2);
if ( (unsigned int)matchPlus(a1, a2) )
{
matchWhiteSpace(&testToken, a2);
result = parseUnsignedExpression(a1, a2);
if ( (_DWORD)result )
{
a1[2] += v3;
result = 1LL;
}
}
else
{
v4 = matchMinus(a1, a2);
result = 1LL;
if ( v4 )
{
matchWhiteSpace(&testToken, a2);
result = parseUnsignedExpression(a1, a2);
if ( (_DWORD)result )
{
a1[2] = v3 - a1[2];
result = 1LL;
}
}
}
}
return result;
}

canonical_decompiled_code:
__int64 __fastcall func4(int *a1, __int64 a2)
{
__int64 result; // rax
int v3; // er12
int v4; // edx

result = func3(a1, a2);
if ( (_DWORD)result )
{
v3 = a1[2];
matchWhiteSpace(&testToken, a2);
if ( (unsigned int)matchPlus(a1, a2) )
{
matchWhiteSpace(&testToken, a2);
result = func4(a1, a2);
if ( (_DWORD)result )
{
a1[2] += v3;
result = 1LL;
}
}
else
{
v4 = matchMinus(a1, a2);
result = 1LL;
if ( v4 )
{
matchWhiteSpace(&testToken, a2);
result = func4(a1, a2);
if ( (_DWORD)result )
{
a1[2] = v3 - a1[2];
result = 1LL;
}
}
}
}
return result;
}

original_code:
int parseUnsignedExpression(token *tok, char **s)
{
 int firstTerm = 0;
  if (parseTerm(tok, s))
  {
  firstTerm = tok->n;
  matchWhiteSpace(&testToken, s);
    if (matchPlus(tok, s))
  {
   matchWhiteSpace(&testToken, s);
      if (parseUnsignedExpression(tok, s))
   {
    tok->n = firstTerm + tok->n;
        return 1;
   }
   return 0;
  }
    if (matchMinus(tok, s))
  {
   matchWhiteSpace(&testToken, s);
      if (parseUnsignedExpression(tok, s))
   {
    tok->n = firstTerm - tok->n;
        return 1;
   }
   return 0;
  }
    return 1;
  }
  return 0;
}

canonical_original_code:
int parseUnsignedExpression(struct token *tok, char **s)
{
 int firstTerm = 0;
  if (parseTerm(tok, s))
  {
  firstTerm = tok->n;
  matchWhiteSpace(&testToken, s);
    if (matchPlus(tok, s))
  {
   matchWhiteSpace(&testToken, s);
      if (parseUnsignedExpression(tok, s))
   {
    tok->n = firstTerm + tok->n;
        return 1;
   }
   return 0;
  }
    if (matchMinus(tok, s))
  {
   matchWhiteSpace(&testToken, s);
      if (parseUnsignedExpression(tok, s))
   {
    tok->n = firstTerm - tok->n;
        return 1;
   }
   return 0;
  }
    return 1;
  }
  return 0;
}

variable_types: firstTerm int


parseExpression

decompiled_code:
__int64 __fastcall parseExpression(int *a1, __int64 a2)
{
unsigned int v2; // ebx

v2 = 1;
if ( !(unsigned int)parseUnsignedExpression(a1, a2) )
{
v2 = 0;
if ( !(unsigned __int8)errorGet() )
{
if ( (unsigned int)matchPlus(a1, a2) )
{
matchWhiteSpace(&testToken, a2);
v2 = parseUnsignedExpression(a1, a2);
if ( v2 )
return 1;
}
else
{
v2 = matchMinus(a1, a2);
if ( v2 )
{
matchWhiteSpace(&testToken, a2);
v2 = parseUnsignedExpression(a1, a2);
if ( v2 )
{
a1[2] = -a1[2];
return 1;
}
}
}
errorSet(20LL);
return v2;
}
}
return v2;
}

canonical_decompiled_code:
__int64 __fastcall func5(int *a1, __int64 a2)
{
unsigned int v2; // ebx

v2 = 1;
if ( !(unsigned int)func4(a1, a2) )
{
v2 = 0;
if ( !(unsigned __int8)errorGet() )
{
if ( (unsigned int)matchPlus(a1, a2) )
{
matchWhiteSpace(&testToken, a2);
v2 = func4(a1, a2);
if ( v2 )
return 1;
}
else
{
v2 = matchMinus(a1, a2);
if ( v2 )
{
matchWhiteSpace(&testToken, a2);
v2 = func4(a1, a2);
if ( v2 )
{
a1[2] = -a1[2];
return 1;
}
}
}
errorSet(20LL);
return v2;
}
}
return v2;
}

original_code:
int parseExpression(token *tok, char **s)
{
  if (parseUnsignedExpression(tok, s)) return 1;
 else if (errorGet()) return 0;
  if (matchPlus(tok, s))
 {
  matchWhiteSpace(&testToken, s);
    if (parseUnsignedExpression(tok, s)) return 1;
  else errorSet(20);
  return 0;
 }
  if (matchMinus(tok, s))
 {
  matchWhiteSpace(&testToken, s);
    if (parseUnsignedExpression(tok, s))
  {
   tok->n *= -1;
      return 1;
  }
  else errorSet(20);
  return 0;
 }
 errorSet(20);
  return 0;
}

canonical_original_code:
int parseExpression(struct token *tok, char **s)
{
  if (parseUnsignedExpression(tok, s)) return 1;
 else if (errorGet()) return 0;
  if (matchPlus(tok, s))
 {
  matchWhiteSpace(&testToken, s);
    if (parseUnsignedExpression(tok, s)) return 1;
  else errorSet(20);
  return 0;
 }
  if (matchMinus(tok, s))
 {
  matchWhiteSpace(&testToken, s);
    if (parseUnsignedExpression(tok, s))
  {
   tok->n *= -1;
      return 1;
  }
  else errorSet(20);
  return 0;
 }
 errorSet(20);
  return 0;
}


parsePrintItem

decompiled_code:
__int64 __fastcall parsePrintItem(__int64 a1, __int64 a2)
{
__int64 result; // rax
FILE *v3; // rbp
const char *v4; // rax

if ( (unsigned int)parseExpression((int *)a1, a2) )
{
v3 = stdout;
v4 = (const char *)itos(*(unsigned int *)(a1 + 8));
fputs(v4, v3);
result = 1LL;
}
else
{
result = matchDoubleQuote(a1, a2);
if ( (_DWORD)result )
{
result = matchCharacterString(a1, a2);
if ( (_DWORD)result )
{
fputs(*(const char **)(a1 + 8), stdout);
result = (unsigned int)matchDoubleQuote(a1, a2) != 0;
}
}
}
return result;
}

canonical_decompiled_code:
__int64 __fastcall func6(__int64 a1, __int64 a2)
{
__int64 result; // rax
FILE *v3; // rbp
const char *v4; // rax

if ( (unsigned int)func5((int *)a1, a2) )
{
v3 = stdout;
v4 = (const char *)itos(*(unsigned int *)(a1 + 8));
fputs(v4, v3);
result = 1LL;
}
else
{
result = matchDoubleQuote(a1, a2);
if ( (_DWORD)result )
{
result = matchCharacterString(a1, a2);
if ( (_DWORD)result )
{
fputs(*(const char **)(a1 + 8), stdout);
result = (unsigned int)matchDoubleQuote(a1, a2) != 0;
}
}
}
return result;
}

original_code:
int parsePrintItem(token *tok, char **s)
{
  if (parseExpression(tok, s))
 {
  fputs(itos(tok->n), stdout);
  return 1;
 }
  if (matchDoubleQuote(tok, s))
    if (matchCharacterString(tok, s))
  {
   fputs(tok->s, stdout);
      if (matchDoubleQuote(tok, s))
        return 1;
  }
  return 0;
}

canonical_original_code:
int parsePrintItem(struct token *tok, char **s)
{
  if (parseExpression(tok, s))
 {
  fputs(itos(tok->n), stdout);
  return 1;
 }
  if (matchDoubleQuote(tok, s))
    if (matchCharacterString(tok, s))
  {
   fputs(tok->s, stdout);
      if (matchDoubleQuote(tok, s))
        return 1;
  }
  return 0;
}


parsePrintList

decompiled_code:
__int64 __fastcall parsePrintList(__int64 a1, __int64 a2)
{
__int64 result; // rax
int v3; // edx

result = parsePrintItem(a1, a2);
if ( (_DWORD)result )
{
matchWhiteSpace(&testToken, a2);
if ( (unsigned int)matchColon(a1, a2) )
{
fflush(stdout);
result = 1LL;
}
else if ( !(unsigned int)matchSeparator(a1, a2)
|| (matchWhiteSpace(&testToken, a2), v3 = parsePrintList(a1, a2), result = 1LL, !v3) )
{
putchar(10);
result = 1LL;
}
}
return result;
}

canonical_decompiled_code:
__int64 __fastcall func7(__int64 a1, __int64 a2)
{
__int64 result; // rax
int v3; // edx

result = func6(a1, a2);
if ( (_DWORD)result )
{
matchWhiteSpace(&testToken, a2);
if ( (unsigned int)matchColon(a1, a2) )
{
fflush(stdout);
result = 1LL;
}
else if ( !(unsigned int)matchSeparator(a1, a2)
|| (matchWhiteSpace(&testToken, a2), v3 = func7(a1, a2), result = 1LL, !v3) )
{
putchar(10);
result = 1LL;
}
}
return result;
}

original_code:
int parsePrintList(token *tok, char **s)
{
  if (parsePrintItem(tok, s))
  {
  matchWhiteSpace(&testToken, s);
    if (matchColon(tok, s))
  {
   fflush(stdout);
      return 1;
  }
    if (matchSeparator(tok, s))
  {
   matchWhiteSpace(&testToken, s);
      if (parsePrintList(tok, s))
        return 1;
  }
  putchar('\n');
  return 1;
  }
 return 0;
}

canonical_original_code:
int parsePrintList(struct token *tok, char **s)
{
  if (parsePrintItem(tok, s))
  {
  matchWhiteSpace(&testToken, s);
    if (matchColon(tok, s))
  {
   fflush(stdout);
      return 1;
  }
    if (matchSeparator(tok, s))
  {
   matchWhiteSpace(&testToken, s);
      if (parsePrintList(tok, s))
        return 1;
  }
  putchar('\n');
  return 1;
  }
 return 0;
}


parseStatement

decompiled_code:
__int64 __fastcall parseStatement(__int64 a1, __int64 *a2)
{
unsigned int v2; // ebx
char v4; // r13
unsigned int v5; // er13
__int64 v6; // rax
unsigned int v7; // er14
__int64 v8; // rax
__int64 v9; // rax
int v10; // er13
int v11; // er14
unsigned int v12; // er14
unsigned int v13; // ebx

if ( (unsigned int)matchPrint() )
{
v2 = matchWhiteSpace(&testToken, a2);
if ( v2 )
return (unsigned int)parsePrintList(a1, (__int64)a2) != 0;
LABEL_22:
errorSet(23LL);
return v2;
}
v2 = 0;
if ( (unsigned int)matchInput(a1, a2) )
{
if ( (unsigned int)matchWhiteSpace(&testToken, a2) && (unsigned int)parseVariableList(a1, (__int64)a2) )
return 1;
goto LABEL_22;
}
v2 = matchLet(a1, a2);
if ( v2 )
{
v2 = matchWhiteSpace(&testToken, a2);
if ( !v2 )
goto LABEL_22;
v2 = matchVariable(a1, a2);
if ( v2 )
{
v4 = *(_BYTE *)(a1 + 8);
matchWhiteSpace(&testToken, a2);
v2 = matchEquals(a1, a2);
if ( v2 )
{
matchWhiteSpace(&testToken, a2);
v2 = parseExpression((int *)a1, (__int64)a2);
if ( v2 )
{
variableSet((unsigned int)v4, *(unsigned int *)(a1 + 8));
v2 = 1;
}
}
else
{
errorSet(24LL);
}
}
else
{
errorSet(25LL);
}
}
else
{
v5 = matchGoto(a1, a2);
if ( !v5 )
{
v7 = matchGosub(a1, a2);
if ( v7 )
{
if ( (unsigned int)matchWhiteSpace(&testToken, a2) && (unsigned int)parseExpression((int *)a1, (__int64)a2) )
{
v8 = programGosub(*(unsigned int *)(a1 + 8));
if ( v8 )
{
*a2 = v8;
v2 = 1;
}
else
{
errorSet(40LL);
v2 = v5;
}
return v2;
}
}
else
{
v2 = matchReturn(a1, a2);
if ( v2 )
{
v9 = programReturn();
if ( v9 )
{
*a2 = v9;
v2 = 1;
}
else
{
errorSet(40LL);
v2 = v7;
}
return v2;
}
v5 = matchIf(a1, a2);
if ( v5 )
{
if ( !(unsigned int)matchWhiteSpace(&testToken, a2) )
goto LABEL_22;
if ( !(unsigned int)parseExpression((int *)a1, (__int64)a2) )
goto LABEL_22;
v10 = *(_DWORD *)(a1 + 8);
matchWhiteSpace(&testToken, a2);
if ( !(unsigned int)matchRelationalOperator(a1, a2) )
goto LABEL_22;
v11 = *(_DWORD *)a1;
matchWhiteSpace(&testToken, a2);
if ( !(unsigned int)parseExpression((int *)a1, (__int64)a2) )
goto LABEL_22;
switch ( v11 )
{
case 6:
if ( *(_DWORD *)(a1 + 8) == v10 )
goto LABEL_55;
goto LABEL_49;
case 12:
if ( *(_DWORD *)(a1 + 8) >= v10 )
goto LABEL_49;
goto LABEL_55;
case 13:
if ( *(_DWORD *)(a1 + 8) > v10 )
goto LABEL_49;
goto LABEL_55;
case 17:
if ( *(_DWORD *)(a1 + 8) <= v10 )
goto LABEL_49;
goto LABEL_55;
case 18:
if ( *(_DWORD *)(a1 + 8) < v10 )
goto LABEL_49;
goto LABEL_55;
case 21:
if ( *(_DWORD *)(a1 + 8) == v10 )
{
LABEL_49:
matchString(a1, a2);
return 1;
}
LABEL_55:
matchWhiteSpace(&testToken, a2);
if ( !(unsigned int)matchThen(a1, a2) )
goto LABEL_22;
matchWhiteSpace(&testToken, a2);
if ( !(unsigned int)parseStatement(a1, a2) )
goto LABEL_22;
v2 = 1;
break;
default:
errorSet(11LL);
return v2;
}
return v2;
}
v12 = matchRemark(a1, a2);
if ( !v12 )
{
v2 = matchPoke(a1, a2);
if ( v2 )
{
if ( (unsigned int)matchWhiteSpace(&testToken, a2)
&& (unsigned int)parseExpression((int *)a1, (__int64)a2)
&& (v13 = *(_DWORD *)(a1 + 8), matchWhiteSpace(&testToken, a2), (unsigned int)matchComma(a1, a2))
&& (matchWhiteSpace(&testToken, a2), (unsigned int)parseExpression((int *)a1, (__int64)a2)) )
{
programPoke(v13, *(unsigned __int8 *)(a1 + 8));
v2 = 1;
}
else
{
errorSet(23LL);
v2 = v12;
}
}
return v2;
}
if ( (unsigned int)matchWhiteSpace(&testToken, a2) )
{
v2 = 1;
if ( (unsigned int)matchString(a1, a2) )
return v2;
}
}
errorSet(23LL);
return v5;
}
if ( !(unsigned int)matchWhiteSpace(&testToken, a2) || !(unsigned int)parseExpression((int *)a1, (__int64)a2) )
goto LABEL_22;
v6 = programGotoLineNumber(*(unsigned int *)(a1 + 8));
if ( v6 )
{
*a2 = v6;
v2 = 1;
}
else
{
errorSet(40LL);
}
}
return v2;
}

canonical_decompiled_code:
__int64 __fastcall func8(__int64 a1, __int64 *a2)
{
unsigned int v2; // ebx
char v4; // r13
unsigned int v5; // er13
__int64 v6; // rax
unsigned int v7; // er14
__int64 v8; // rax
__int64 v9; // rax
int v10; // er13
int v11; // er14
unsigned int v12; // er14
unsigned int v13; // ebx

if ( (unsigned int)matchPrint() )
{
v2 = matchWhiteSpace(&testToken, a2);
if ( v2 )
return (unsigned int)func7(a1, (__int64)a2) != 0;
LABEL_22:
errorSet(23LL);
return v2;
}
v2 = 0;
if ( (unsigned int)matchInput(a1, a2) )
{
if ( (unsigned int)matchWhiteSpace(&testToken, a2) && (unsigned int)func0(a1, (__int64)a2) )
return 1;
goto LABEL_22;
}
v2 = matchLet(a1, a2);
if ( v2 )
{
v2 = matchWhiteSpace(&testToken, a2);
if ( !v2 )
goto LABEL_22;
v2 = matchVariable(a1, a2);
if ( v2 )
{
v4 = *(_BYTE *)(a1 + 8);
matchWhiteSpace(&testToken, a2);
v2 = matchEquals(a1, a2);
if ( v2 )
{
matchWhiteSpace(&testToken, a2);
v2 = func5((int *)a1, (__int64)a2);
if ( v2 )
{
variableSet((unsigned int)v4, *(unsigned int *)(a1 + 8));
v2 = 1;
}
}
else
{
errorSet(24LL);
}
}
else
{
errorSet(25LL);
}
}
else
{
v5 = matchGoto(a1, a2);
if ( !v5 )
{
v7 = matchGosub(a1, a2);
if ( v7 )
{
if ( (unsigned int)matchWhiteSpace(&testToken, a2) && (unsigned int)func5((int *)a1, (__int64)a2) )
{
v8 = programGosub(*(unsigned int *)(a1 + 8));
if ( v8 )
{
*a2 = v8;
v2 = 1;
}
else
{
errorSet(40LL);
v2 = v5;
}
return v2;
}
}
else
{
v2 = matchReturn(a1, a2);
if ( v2 )
{
v9 = programReturn();
if ( v9 )
{
*a2 = v9;
v2 = 1;
}
else
{
errorSet(40LL);
v2 = v7;
}
return v2;
}
v5 = matchIf(a1, a2);
if ( v5 )
{
if ( !(unsigned int)matchWhiteSpace(&testToken, a2) )
goto LABEL_22;
if ( !(unsigned int)func5((int *)a1, (__int64)a2) )
goto LABEL_22;
v10 = *(_DWORD *)(a1 + 8);
matchWhiteSpace(&testToken, a2);
if ( !(unsigned int)matchRelationalOperator(a1, a2) )
goto LABEL_22;
v11 = *(_DWORD *)a1;
matchWhiteSpace(&testToken, a2);
if ( !(unsigned int)func5((int *)a1, (__int64)a2) )
goto LABEL_22;
switch ( v11 )
{
case 6:
if ( *(_DWORD *)(a1 + 8) == v10 )
goto LABEL_55;
goto LABEL_49;
case 12:
if ( *(_DWORD *)(a1 + 8) >= v10 )
goto LABEL_49;
goto LABEL_55;
case 13:
if ( *(_DWORD *)(a1 + 8) > v10 )
goto LABEL_49;
goto LABEL_55;
case 17:
if ( *(_DWORD *)(a1 + 8) <= v10 )
goto LABEL_49;
goto LABEL_55;
case 18:
if ( *(_DWORD *)(a1 + 8) < v10 )
goto LABEL_49;
goto LABEL_55;
case 21:
if ( *(_DWORD *)(a1 + 8) == v10 )
{
LABEL_49:
matchString(a1, a2);
return 1;
}
LABEL_55:
matchWhiteSpace(&testToken, a2);
if ( !(unsigned int)matchThen(a1, a2) )
goto LABEL_22;
matchWhiteSpace(&testToken, a2);
if ( !(unsigned int)func8(a1, a2) )
goto LABEL_22;
v2 = 1;
break;
default:
errorSet(11LL);
return v2;
}
return v2;
}
v12 = matchRemark(a1, a2);
if ( !v12 )
{
v2 = matchPoke(a1, a2);
if ( v2 )
{
if ( (unsigned int)matchWhiteSpace(&testToken, a2)
&& (unsigned int)func5((int *)a1, (__int64)a2)
&& (v13 = *(_DWORD *)(a1 + 8), matchWhiteSpace(&testToken, a2), (unsigned int)matchComma(a1, a2))
&& (matchWhiteSpace(&testToken, a2), (unsigned int)func5((int *)a1, (__int64)a2)) )
{
programPoke(v13, *(unsigned __int8 *)(a1 + 8));
v2 = 1;
}
else
{
errorSet(23LL);
v2 = v12;
}
}
return v2;
}
if ( (unsigned int)matchWhiteSpace(&testToken, a2) )
{
v2 = 1;
if ( (unsigned int)matchString(a1, a2) )
return v2;
}
}
errorSet(23LL);
return v5;
}
if ( !(unsigned int)matchWhiteSpace(&testToken, a2) || !(unsigned int)func5((int *)a1, (__int64)a2) )
goto LABEL_22;
v6 = programGotoLineNumber(*(unsigned int *)(a1 + 8));
if ( v6 )
{
*a2 = v6;
v2 = 1;
}
else
{
errorSet(40LL);
}
}
return v2;
}

original_code:
int parseStatement(token *tok, char **s)
{
 char var = 0;
 int value = 0;
 char *newLocation = ((void *)0);
 tokenType op;
 int shortCircuit = 0;
  if (matchPrint(tok, s))
 {
  if (matchWhiteSpace(&testToken, s))
  {
   if (parsePrintList(tok, s))
    return 1;
  }
  else errorSet(23);
  return 0;
 }
  if (matchInput(tok, s))
 {
  if (matchWhiteSpace(&testToken, s))
  {
   if (parseVariableList(tok, s))
    return 1;
  }
  errorSet(23);
  return 0;
 }
  if (matchLet(tok, s))
 {
  if (matchWhiteSpace(&testToken, s))
  {
   if (matchVariable(tok, s))
   {
    var = tok->c;
    matchWhiteSpace(&testToken, s);
    if (matchEquals(tok, s))
    {
     matchWhiteSpace(&testToken, s);
     if (parseExpression(tok, s))
     {
      variableSet(var, tok->n);
      return 1;
     }
    }
    else errorSet(24);
   }
   else errorSet(25);
  }
  else errorSet(23);
  return 0;
 }
  if (matchGoto(tok, s))
 {
  if (matchWhiteSpace(&testToken, s))
  {
   if (parseExpression(tok, s))
   {
    if (!(newLocation = programGotoLineNumber(tok->n)))
    {
     errorSet(40);
     return 0;
    }
    *s = newLocation;
    return 1;
   }
  }
  errorSet(23);
  return 0;
 }
  if (matchGosub(tok, s))
 {
  if (matchWhiteSpace(&testToken, s))
  {
   if (parseExpression(tok, s))
   {
    if (!(newLocation = programGosub(tok->n)))
    {
     errorSet(40);
     return 0;
    }
    *s = newLocation;
    return 1;
   }
  }
  errorSet(23);
  return 0;
 }
  if (matchReturn(tok, s))
 {
  if (!(newLocation = programReturn()))
  {
   errorSet(40);
   return 0;
  }
  *s = newLocation;
    return 1;
 }
  if (matchIf(tok, s))
 {
  if (matchWhiteSpace(&testToken, s))
  {
   if (parseExpression(tok, s))
   {
    value = tok->n;
    matchWhiteSpace(&testToken, s);
    if (matchRelationalOperator(tok, s))
    {
     op = tok->type;
     matchWhiteSpace(&testToken, s);
     if (parseExpression(tok, s))
     {
      shortCircuit = 0;
      switch (op)
      {
       case tokTypeLessThan:
        if (value < tok->n) break;
        shortCircuit = 1;
        break;
       case tokTypeGreaterThan:
        if (value > tok->n) break;
        shortCircuit = 1;
        break;
       case tokTypeEquals:
        if (value == tok->n) break;
        shortCircuit = 1;
        break;
       case tokTypeLessThanOrEquals:
        if (value <= tok->n) break;
        shortCircuit = 1;
        break;
       case tokTypeGreaterThanOrEquals:
        if (value >= tok->n) break;
        shortCircuit = 1;
        break;
       case tokTypeNotEquals:
        if (value != tok->n) break;
        shortCircuit = 1;
        break;
       default:
        errorSet(11);
        return 0;
      }
      if (shortCircuit)
      {
       matchString(tok, s);
       return 1;
      }
      matchWhiteSpace(&testToken, s);
      if (matchThen(tok, s))
      {
       matchWhiteSpace(&testToken, s);
       if (parseStatement(tok, s))
        return 1;
      }
     }
    }
   }
  }
  errorSet(23);
  return 0;
 }
  if (matchRemark(tok, s))
 {
  if (matchWhiteSpace(&testToken, s))
  {
   if (matchString(tok, s))
    return 1;
  }
  errorSet(23);
  return 0;
 }
  if (matchPoke(tok, s))
 {
  if (matchWhiteSpace(&testToken, s))
  {
   if (parseExpression(tok, s))
   {
    value = tok->n;
    matchWhiteSpace(&testToken, s);
    if (matchComma(tok, s))
    {
     matchWhiteSpace(&testToken, s);
     if (parseExpression(tok, s))
     {
      programPoke(value, (char)tok->n);
      return 1;
     }
    }
   }
  }
  errorSet(23);
  return 0;
 }
  return 0;
}

canonical_original_code:
int parseStatement(struct token *tok, char **s)
{
 char var = 0;
 int value = 0;
 char *newLocation = ((void *)0);
 enum tokenType op;
 int shortCircuit = 0;
  if (matchPrint(tok, s))
 {
  if (matchWhiteSpace(&testToken, s))
  {
   if (parsePrintList(tok, s))
    return 1;
  }
  else errorSet(23);
  return 0;
 }
  if (matchInput(tok, s))
 {
  if (matchWhiteSpace(&testToken, s))
  {
   if (parseVariableList(tok, s))
    return 1;
  }
  errorSet(23);
  return 0;
 }
  if (matchLet(tok, s))
 {
  if (matchWhiteSpace(&testToken, s))
  {
   if (matchVariable(tok, s))
   {
    var = tok->c;
    matchWhiteSpace(&testToken, s);
    if (matchEquals(tok, s))
    {
     matchWhiteSpace(&testToken, s);
     if (parseExpression(tok, s))
     {
      variableSet(var, tok->n);
      return 1;
     }
    }
    else errorSet(24);
   }
   else errorSet(25);
  }
  else errorSet(23);
  return 0;
 }
  if (matchGoto(tok, s))
 {
  if (matchWhiteSpace(&testToken, s))
  {
   if (parseExpression(tok, s))
   {
    if (!(newLocation = programGotoLineNumber(tok->n)))
    {
     errorSet(40);
     return 0;
    }
    *s = newLocation;
    return 1;
   }
  }
  errorSet(23);
  return 0;
 }
  if (matchGosub(tok, s))
 {
  if (matchWhiteSpace(&testToken, s))
  {
   if (parseExpression(tok, s))
   {
    if (!(newLocation = programGosub(tok->n)))
    {
     errorSet(40);
     return 0;
    }
    *s = newLocation;
    return 1;
   }
  }
  errorSet(23);
  return 0;
 }
  if (matchReturn(tok, s))
 {
  if (!(newLocation = programReturn()))
  {
   errorSet(40);
   return 0;
  }
  *s = newLocation;
    return 1;
 }
  if (matchIf(tok, s))
 {
  if (matchWhiteSpace(&testToken, s))
  {
   if (parseExpression(tok, s))
   {
    value = tok->n;
    matchWhiteSpace(&testToken, s);
    if (matchRelationalOperator(tok, s))
    {
     op = tok->type;
     matchWhiteSpace(&testToken, s);
     if (parseExpression(tok, s))
     {
      shortCircuit = 0;
      switch (op)
      {
       case tokTypeLessThan:
        if (value < tok->n) break;
        shortCircuit = 1;
        break;
       case tokTypeGreaterThan:
        if (value > tok->n) break;
        shortCircuit = 1;
        break;
       case tokTypeEquals:
        if (value == tok->n) break;
        shortCircuit = 1;
        break;
       case tokTypeLessThanOrEquals:
        if (value <= tok->n) break;
        shortCircuit = 1;
        break;
       case tokTypeGreaterThanOrEquals:
        if (value >= tok->n) break;
        shortCircuit = 1;
        break;
       case tokTypeNotEquals:
        if (value != tok->n) break;
        shortCircuit = 1;
        break;
       default:
        errorSet(11);
        return 0;
      }
      if (shortCircuit)
      {
       matchString(tok, s);
       return 1;
      }
      matchWhiteSpace(&testToken, s);
      if (matchThen(tok, s))
      {
       matchWhiteSpace(&testToken, s);
       if (parseStatement(tok, s))
        return 1;
      }
     }
    }
   }
  }
  errorSet(23);
  return 0;
 }
  if (matchRemark(tok, s))
 {
  if (matchWhiteSpace(&testToken, s))
  {
   if (matchString(tok, s))
    return 1;
  }
  errorSet(23);
  return 0;
 }
  if (matchPoke(tok, s))
 {
  if (matchWhiteSpace(&testToken, s))
  {
   if (parseExpression(tok, s))
   {
    value = tok->n;
    matchWhiteSpace(&testToken, s);
    if (matchComma(tok, s))
    {
     matchWhiteSpace(&testToken, s);
     if (parseExpression(tok, s))
     {
      programPoke(value, (char)tok->n);
      return 1;
     }
    }
   }
  }
  errorSet(23);
  return 0;
 }
  return 0;
}

variable_types:
newLocation
char *

variable_types: shortCircuit int


parseLine

decompiled_code:
__int64 __fastcall parseLine(__int64 a1, __int64 *a2)
{
unsigned int v2; // ebp
unsigned int v4; // er13

if ( (unsigned int)programGetMode() == 1 )
{
v2 = matchNumber(a1, a2);
if ( !v2 )
{
LABEL_12:
errorSet(22LL);
return v2;
}
v4 = *(_DWORD *)(a1 + 8);
programSetLineNumber(v4);
v2 = matchWhiteSpace(&testToken, a2);
if ( !v2 )
{
errorSet(23LL);
return v2;
}
matchWhiteSpace(&testToken, a2);
if ( !(unsigned int)parseStatement(a1, a2) )
goto LABEL_3;
matchWhiteSpace(&testToken, a2);
errorSet(0LL);
if ( v4 )
{
v2 = 1;
if ( (unsigned int)programGetLineNumber() != v4 )
return v2;
}
LABEL_16:
v2 = matchEOL(a1, a2);
if ( v2 )
return 1;
goto LABEL_12;
}
matchWhiteSpace(&testToken, a2);
if ( (unsigned int)parseStatement(a1, a2) )
{
matchWhiteSpace(&testToken, a2);
errorSet(0LL);
goto LABEL_16;
}
LABEL_3:
v2 = 0;
if ( !(unsigned __int8)errorGet() )
errorSet(29LL);
return v2;
}

canonical_decompiled_code:
__int64 __fastcall func9(__int64 a1, __int64 *a2)
{
unsigned int v2; // ebp
unsigned int v4; // er13

if ( (unsigned int)programGetMode() == 1 )
{
v2 = matchNumber(a1, a2);
if ( !v2 )
{
LABEL_12:
errorSet(22LL);
return v2;
}
v4 = *(_DWORD *)(a1 + 8);
programSetLineNumber(v4);
v2 = matchWhiteSpace(&testToken, a2);
if ( !v2 )
{
errorSet(23LL);
return v2;
}
matchWhiteSpace(&testToken, a2);
if ( !(unsigned int)func8(a1, a2) )
goto LABEL_3;
matchWhiteSpace(&testToken, a2);
errorSet(0LL);
if ( v4 )
{
v2 = 1;
if ( (unsigned int)programGetLineNumber() != v4 )
return v2;
}
LABEL_16:
v2 = matchEOL(a1, a2);
if ( v2 )
return 1;
goto LABEL_12;
}
matchWhiteSpace(&testToken, a2);
if ( (unsigned int)func8(a1, a2) )
{
matchWhiteSpace(&testToken, a2);
errorSet(0LL);
goto LABEL_16;
}
LABEL_3:
v2 = 0;
if ( !(unsigned __int8)errorGet() )
errorSet(29LL);
return v2;
}

original_code:
int parseLine(token *tok, char **s)
{
 int currentLineNumber = 0;
 programMode mode = programGetMode();
 switch (mode)
 {
  case progModeStored:
   if (!matchNumber(tok, s))
   {
    errorSet(22);
    return 0;
   }
   currentLineNumber = tok->n;
   programSetLineNumber(currentLineNumber);
   if (!matchWhiteSpace(&testToken, s))
   {
    errorSet(23);
    return 0;
   }
   break;
  case progModeImmediate:
   break;
 }
 matchWhiteSpace(&testToken, s);
 if (parseStatement(tok, s))
 {
  matchWhiteSpace(&testToken, s);
  errorSet(00);
  if (currentLineNumber && (currentLineNumber != programGetLineNumber()))
   return 1;
  if (matchEOL(tok, s))
   return 1;
  else
  {
   errorSet(22);
   return 0;
  }
 }
 if (errorGet() == 00)
  errorSet(29);
  return 0;
}

canonical_original_code:
int parseLine(struct token *tok, char **s)
{
 int currentLineNumber = 0;
 enum programMode mode = programGetMode();
 switch (mode)
 {
  case progModeStored:
   if (!matchNumber(tok, s))
   {
    errorSet(22);
    return 0;
   }
   currentLineNumber = tok->n;
   programSetLineNumber(currentLineNumber);
   if (!matchWhiteSpace(&testToken, s))
   {
    errorSet(23);
    return 0;
   }
   break;
  case progModeImmediate:
   break;
 }
 matchWhiteSpace(&testToken, s);
 if (parseStatement(tok, s))
 {
  matchWhiteSpace(&testToken, s);
  errorSet(00);
  if (currentLineNumber && (currentLineNumber != programGetLineNumber()))
   return 1;
  if (matchEOL(tok, s))
   return 1;
  else
  {
   errorSet(22);
   return 0;
  }
 }
 if (errorGet() == 00)
  errorSet(29);
  return 0;
}

variable_types: currentLineNumber int

variable_types: enum programMode { progModeImmediate=0, progModeStored=1 }


parseExpressionList

decompiled_code:
__int64 __fastcall parseExpressionList(int *a1, __int64 a2)
{
__int64 result; // rax
int v3; // edx

result = parseExpression(a1, a2);
if ( (_DWORD)result )
{
matchWhiteSpace(&testToken, a2);
v3 = matchComma(a1, a2);
result = 1LL;
if ( v3 )
{
matchWhiteSpace(&testToken, a2);
result = (unsigned int)parseExpression(a1, a2) != 0;
}
}
return result;
}

canonical_decompiled_code:
__int64 __fastcall func10(int *a1, __int64 a2)
{
__int64 result; // rax
int v3; // edx

result = func5(a1, a2);
if ( (_DWORD)result )
{
matchWhiteSpace(&testToken, a2);
v3 = matchComma(a1, a2);
result = 1LL;
if ( v3 )
{
matchWhiteSpace(&testToken, a2);
result = (unsigned int)func5(a1, a2) != 0;
}
}
return result;
}

original_code:
int parseExpressionList(token *tok, char **s)
{
  if (parseExpression(tok, s))
  {
  matchWhiteSpace(&testToken, s);
    if (matchComma(tok, s))
  {
   matchWhiteSpace(&testToken, s);
      if (parseExpression(tok, s))
        return 1;
   return 0;
  }
    return 1;
  }
  return 0;
}

canonical_original_code:
int parseExpressionList(struct token *tok, char **s)
{
  if (parseExpression(tok, s))
  {
  matchWhiteSpace(&testToken, s);
    if (matchComma(tok, s))
  {
   matchWhiteSpace(&testToken, s);
      if (parseExpression(tok, s))
        return 1;
   return 0;
  }
    return 1;
  }
  return 0;
}

variable_types: struct token { enum tokenType { tokTypeComma=0, tokTypeNumber=1, tokTypeEOL=2, tokTypeCharacterString=3, tokTypeColon=4, tokTypeDividedBy=5, tokTypeEquals=6, tokTypeFree=7, tokTypeFunctionCall=8, tokTypeFunctionPeek=9, tokTypeGosub=10, tokTypeGoto=11, tokTypeGreaterThan=12, tokTypeGreaterThanOrEquals=13, tokTypeIf=14, tokTypeInput=15, tokTypeLeftParenthesis=16, tokTypeLessThan=17, tokTypeLessThanOrEquals=18, tokTypeLet=19, tokTypeMinus=20, tokTypeNotEquals=21, tokTypePlus=22, tokTypePoke=23, tokTypePrint=24, tokTypeRemark=25, tokTypeReturn=26, tokTypeRightParenthesis=27, tokTypeSemicolon=28, tokTypeSize=29, tokTypeString=30, tokTypeDoubleQuote=31, tokTypeThen=32, tokTypeTimes=33, tokTypeVariable=34, tokTypeWhiteSpace=35, tokTypeClear=36, tokTypeRun=37, tokTypeList=38 } type; enum tokenValueType { tokValueTypeNone=0, tokValueTypeString=1, tokValueTypeCharacter=2, tokValueTypeNumber=3 } valueType; union { char *s; char c; int n; }; } *


deleteLine

decompiled_code:
__int64 __fastcall deleteLine(unsigned int a1, __int64 a2)
{
_BYTE *v2; // rax
_BYTE *v3; // rbx
_BYTE *v4; // rdx
char v5; // al
int v6; // eax
__int64 result; // rax

if ( programGetProgram() )
{
v2 = (_BYTE *)programFindLineNumber(a1);
v3 = v2;
if ( v2 )
{
for ( ; *v2 != 10; ++v2 )
;
v4 = v2 + 1;
v5 = v2[1];
if ( v5 )
{
do
{
*v3++ = v5;
v5 = *++v4;
}
while ( *v4 );
}
*v3 = 0;
v6 = programGetSize(a1, a2, v4);
memset(v3, 0, 2048 - v6);
result = 1LL;
}
else
{
errorSet(40LL);
result = 0LL;
}
}
else
{
errorSet(30LL);
result = 0LL;
}
return result;
}

canonical_decompiled_code:
__int64 __fastcall func0(unsigned int a1, __int64 a2)
{
_BYTE *v2; // rax
_BYTE *v3; // rbx
_BYTE *v4; // rdx
char v5; // al
int v6; // eax
__int64 result; // rax

if ( programGetProgram() )
{
v2 = (_BYTE *)programFindLineNumber(a1);
v3 = v2;
if ( v2 )
{
for ( ; *v2 != 10; ++v2 )
;
v4 = v2 + 1;
v5 = v2[1];
if ( v5 )
{
do
{
*v3++ = v5;
v5 = *++v4;
}
while ( *v4 );
}
*v3 = 0;
v6 = programGetSize(a1, a2, v4);
memset(v3, 0, 2048 - v6);
result = 1LL;
}
else
{
errorSet(40LL);
result = 0LL;
}
}
else
{
errorSet(30LL);
result = 0LL;
}
return result;
}

original_code:
static int deleteLine(int line)
{
 char *this, *next;
 char *prog;
 int size;
 prog = programGetProgram();
 if (!prog)
 {
  errorSet(30);
  return 0;
 }
 this = programFindLineNumber(line);
 if (!this)
 {
  errorSet(40);
  return 0;
 }
 for (next = this; *next != '\n'; next++) ;
 ++next;
 while (*next)
 {
  *this = *next;
  ++this;
  ++next;
 }
 *this = 0;
 size = programGetSize();
 memset(this, 0, 2048 - size);
 return 1;
}

canonical_original_code:
static int deleteLine(int line)
{
 char *this; char *next;
 char *prog;
 int size;
 prog = programGetProgram();
 if (!prog)
 {
  errorSet(30);
  return 0;
 }
 this = programFindLineNumber(line);
 if (!this)
 {
  errorSet(40);
  return 0;
 }
 for (next = this; *next != '\n'; next++) ;
 ++next;
 while (*next)
 {
  *this = *next;
  ++this;
  ++next;
 }
 *this = 0;
 size = programGetSize();
 memset(this, 0, 2048 - size);
 return 1;
}

variable_types: line int

variable_types:
this
char *

variable_types:
next
char *

variable_types:
prog
char *

variable_types: size int


insertLine

decompiled_code:
__int64 __fastcall insertLine(unsigned int a1, const char *a2)
{
__int64 v3; // rax
const char *v4; // r14
const char *v5; // r12
int v6; // ebx
int v7; // ebx
unsigned __int64 v8; // r13
size_t v9; // rax
unsigned __int64 v10; // rsi
__int64 v11; // rax
size_t i; // rbx
__int64 result; // rax
__int64 v14; // r12
size_t j; // rbx

v3 = programGetProgram();
if ( !v3 )
goto LABEL_7;
v4 = (const char *)v3;
deleteLine(a1, (__int64)a2);
errorSet(0LL);
v5 = (const char *)itos(a1);
v6 = strlen(a2);
v7 = v6 + strlen(v5) + 2;
v8 = programFindNextLineNumber(a1);
if ( !v8 )
goto LABEL_7;
v9 = strlen(v4);
v10 = (unsigned __int64)&v4[v9 - 1];
if ( (__int64)(v9 - 1 + v7) <= 2048 )
{
v11 = 0LL;
if ( v8 <= v10 )
{
do
{
*(_BYTE *)(v10 + v7 + v11) = *(_BYTE *)(v10 + v11);
--v11;
}
while ( v11 != v8 - 1 - v10 );
}
for ( i = 0LL; strlen(v5) > i; ++i )
*(_BYTE *)(v8 + i) = v5[i];
*(_BYTE *)(v8 + i) = 32;
v14 = v8 + i + 1;
for ( j = 0LL; strlen(a2) > j; ++j )
*(_BYTE *)(v14 + j) = a2[j];
*(_BYTE *)(v14 + j) = 10;
result = 1LL;
}
else
{
LABEL_7:
errorSet(30LL);
result = 0LL;
}
return result;
}

canonical_decompiled_code:
__int64 __fastcall func1(unsigned int a1, const char *a2)
{
__int64 v3; // rax
const char *v4; // r14
const char *v5; // r12
int v6; // ebx
int v7; // ebx
unsigned __int64 v8; // r13
size_t v9; // rax
unsigned __int64 v10; // rsi
__int64 v11; // rax
size_t i; // rbx
__int64 result; // rax
__int64 v14; // r12
size_t j; // rbx

v3 = programGetProgram();
if ( !v3 )
goto LABEL_7;
v4 = (const char *)v3;
func0(a1, (__int64)a2);
errorSet(0LL);
v5 = (const char *)itos(a1);
v6 = strlen(a2);
v7 = v6 + strlen(v5) + 2;
v8 = programFindNextLineNumber(a1);
if ( !v8 )
goto LABEL_7;
v9 = strlen(v4);
v10 = (unsigned __int64)&v4[v9 - 1];
if ( (__int64)(v9 - 1 + v7) <= 2048 )
{
v11 = 0LL;
if ( v8 <= v10 )
{
do
{
*(_BYTE *)(v10 + v7 + v11) = *(_BYTE *)(v10 + v11);
--v11;
}
while ( v11 != v8 - 1 - v10 );
}
for ( i = 0LL; strlen(v5) > i; ++i )
*(_BYTE *)(v8 + i) = v5[i];
*(_BYTE *)(v8 + i) = 32;
v14 = v8 + i + 1;
for ( j = 0LL; strlen(a2) > j; ++j )
*(_BYTE *)(v14 + j) = a2[j];
*(_BYTE *)(v14 + j) = 10;
result = 1LL;
}
else
{
LABEL_7:
errorSet(30LL);
result = 0LL;
}
return result;
}

original_code:
static int insertLine(int line, char *text)
{
 char *lineStr;
 int lineLen = 0;
 int i;
 char *insertPoint = ((void *)0);
 char *end = ((void *)0);
 char *newEnd = ((void *)0);
 char *prog = ((void *)0);
 prog = programGetProgram();
 if (!prog)
 {
  errorSet(30);
  return 0;
 }
 deleteLine(line);
 errorSet(00);
 lineStr = itos(line);
 lineLen = strlen(text) + strlen(lineStr) + 2;
 insertPoint = programFindNextLineNumber(line);
 if (!insertPoint)
 {
  errorSet(30);
  return 0;
 }
 end = prog + strlen(prog) - 1;
 newEnd = end + lineLen;
 if ((newEnd - prog) > 2048)
 {
  errorSet(30);
  return 0;
 }
 for (; end >= insertPoint; --end, --newEnd)
  *newEnd = *end;
 for (i = 0; i < strlen(lineStr); i++)
  insertPoint[i] = lineStr[i];
 insertPoint[i] = ' ';
 insertPoint += i + 1;
 for (i = 0; i < strlen(text); i++)
  insertPoint[i] = text[i];
 insertPoint[i] = '\n';
 return 1;
}

variable_types:
text
char *

variable_types:
lineStr
char *

variable_types: lineLen int

variable_types: i int

variable_types:
insertPoint
char *

variable_types:
end
char *

variable_types:
newEnd
char *


parseRun

decompiled_code:
__int64 __fastcall parseRun(__int64 a1, __int64 a2)
{
__int64 result; // rax
unsigned int v4; // eax
__int64 v5; // rdi

result = matchRun();
if ( (_DWORD)result )
{
v4 = matchWhiteSpace(a1, a2);
v5 = v4;
if ( v4 )
{
result = matchNumber(a1, a2);
if ( !(_DWORD)result )
return result;
v5 = *(unsigned int *)(a1 + 8);
}
result = programRun(v5);
}
return result;
}

canonical_decompiled_code:
__int64 __fastcall func2(__int64 a1, __int64 a2)
{
__int64 result; // rax
unsigned int v4; // eax
__int64 v5; // rdi

result = matchRun();
if ( (_DWORD)result )
{
v4 = matchWhiteSpace(a1, a2);
v5 = v4;
if ( v4 )
{
result = matchNumber(a1, a2);
if ( !(_DWORD)result )
return result;
v5 = *(unsigned int *)(a1 + 8);
}
result = programRun(v5);
}
return result;
}

original_code:
int parseRun(token *tok, char **s)
{
 int line = 0;
 if (matchRun(tok, s))
 {
  if (matchWhiteSpace(tok, s))
  {
   if (matchNumber(tok, s))
    line = tok->n;
   else
    return 0;
  }
  return programRun(line);
 }
  return 0;
}

canonical_original_code:
int parseRun(struct token *tok, char **s)
{
 int line = 0;
 if (matchRun(tok, s))
 {
  if (matchWhiteSpace(tok, s))
  {
   if (matchNumber(tok, s))
    line = tok->n;
   else
    return 0;
  }
  return programRun(line);
 }
  return 0;
}

variable_types:
s
char **


parseList

decompiled_code:
__int64 __fastcall parseList(__int64 a1, __int64 a2)
{
__int64 result; // rax
int v3; // er12
int v4; // er13
const char *v5; // r15
int v6; // ebp
const char *i; // rbx
int v8; // eax

result = matchList();
if ( (_DWORD)result )
{
matchWhiteSpace(a1, a2);
v3 = matchNumber(a1, a2);
if ( v3 )
{
v3 = *(_DWORD *)(a1 + 8);
matchWhiteSpace(a1, a2);
v4 = v3;
if ( (unsigned int)matchComma(&testToken, a2) )
{
matchWhiteSpace(a1, a2);
result = matchNumber(a1, a2);
if ( !(_DWORD)result )
return result;
v4 = *(_DWORD *)(a1 + 8);
}
}
else
{
v4 = 0;
}
v5 = (const char *)programGetProgram();
if ( v5 )
{
v6 = 0;
result = 1LL;
if ( *v5 )
{
while ( 1 )
{
v8 = atoi(v5);
if ( v4 )
{
if ( v4 < v8 )
break;
}
if ( v3 <= v8 )
v6 = 1;
for ( i = v5; ; ++i )
{
if ( v6 )
putchar(*i);
if ( i[1] == 10 )
break;
}
if ( v6 )
putchar(10);
v5 = i + 2;
if ( !i[2] )
return 1LL;
}
result = 1LL;
}
}
else
{
errorSet(30LL);
result = 0LL;
}
}
return result;
}

canonical_decompiled_code:
__int64 __fastcall func3(__int64 a1, __int64 a2)
{
__int64 result; // rax
int v3; // er12
int v4; // er13
const char *v5; // r15
int v6; // ebp
const char *i; // rbx
int v8; // eax

result = matchList();
if ( (_DWORD)result )
{
matchWhiteSpace(a1, a2);
v3 = matchNumber(a1, a2);
if ( v3 )
{
v3 = *(_DWORD *)(a1 + 8);
matchWhiteSpace(a1, a2);
v4 = v3;
if ( (unsigned int)matchComma(&testToken, a2) )
{
matchWhiteSpace(a1, a2);
result = matchNumber(a1, a2);
if ( !(_DWORD)result )
return result;
v4 = *(_DWORD *)(a1 + 8);
}
}
else
{
v4 = 0;
}
v5 = (const char *)programGetProgram();
if ( v5 )
{
v6 = 0;
result = 1LL;
if ( *v5 )
{
while ( 1 )
{
v8 = atoi(v5);
if ( v4 )
{
if ( v4 < v8 )
break;
}
if ( v3 <= v8 )
v6 = 1;
for ( i = v5; ; ++i )
{
if ( v6 )
putchar(*i);
if ( i[1] == 10 )
break;
}
if ( v6 )
putchar(10);
v5 = i + 2;
if ( !i[2] )
return 1LL;
}
result = 1LL;
}
}
else
{
errorSet(30LL);
result = 0LL;
}
}
return result;
}

original_code:
int parseList(token *tok, char **s)
{
 int firstLine, lastLine;
 int line;
 int print = 0;
 char *prog;
 firstLine = lastLine = 0;
 if (matchList(tok, s))
 {
  matchWhiteSpace(tok, s);
  if (matchNumber(tok, s))
  {
   firstLine = lastLine = tok->n;
   matchWhiteSpace(tok, s);
   if (matchComma(&testToken, s))
   {
    matchWhiteSpace(tok, s);
    if (matchNumber(tok, s))
     lastLine = tok->n;
    else return 0;
   }
  }
  prog = programGetProgram();
  if (!prog)
  {
   errorSet(30);
   return 0;
  }
  while (*prog)
  {
   line = atoi(prog);
   if (lastLine && (line > lastLine)) break;
   if (line >= firstLine) print = 1;
   do
   {
    if (print) putchar(*prog);
    ++prog;
   } while (*prog != '\n');
   if (print) putchar(*prog);
   ++prog;
  }
  return 1;
 }
 return 0;
}

canonical_original_code:
int parseList(struct token *tok, char **s)
{
 int firstLine; int lastLine;
 int line;
 int print = 0;
 char *prog;
 firstLine = lastLine = 0;
 if (matchList(tok, s))
 {
  matchWhiteSpace(tok, s);
  if (matchNumber(tok, s))
  {
   firstLine = lastLine = tok->n;
   matchWhiteSpace(tok, s);
   if (matchComma(&testToken, s))
   {
    matchWhiteSpace(tok, s);
    if (matchNumber(tok, s))
     lastLine = tok->n;
    else return 0;
   }
  }
  prog = programGetProgram();
  if (!prog)
  {
   errorSet(30);
   return 0;
  }
  while (*prog)
  {
   line = atoi(prog);
   if (lastLine && (line > lastLine)) break;
   if (line >= firstLine) print = 1;
   do
   {
    if (print) putchar(*prog);
    ++prog;
   } while (*prog != '\n');
   if (print) putchar(*prog);
   ++prog;
  }
  return 1;
 }
 return 0;
}

variable_types: firstLine int

variable_types: lastLine int

variable_types: print int


parseCommand

decompiled_code:
__int64 __fastcall parseCommand(__int64 a1, __int64 a2)
{
unsigned int v2; // er12
unsigned int v3; // er12
__int64 v5; // rdx
unsigned int v6; // eax
const char *v7; // rax
unsigned int v8; // eax
const char *v9; // rax

if ( (unsigned int)matchNumber(a1, a2) )
{
v2 = *(_DWORD *)(a1 + 8);
if ( (unsigned int)matchWhiteSpace(a1, a2) )
{
matchString(a1, a2);
v3 = insertLine(v2, *(const char **)(a1 + 8));
}
else
{
v3 = deleteLine(v2, a2);
}
}
else if ( (unsigned int)matchSize(a1, a2) )
{
v6 = programGetSize(a1, a2, v5);
v7 = (const char *)itos(v6);
puts(v7);
v3 = 1;
}
else if ( (unsigned int)matchFree(a1, a2) )
{
v8 = programGetFree();
v9 = (const char *)itos(v8);
puts(v9);
v3 = 1;
}
else if ( (unsigned int)matchClear(a1, a2) )
{
programInit();
v3 = 1;
}
else
{
if ( (unsigned int)matchBye(a1, a2) )
exit(0);
v3 = parseRun(a1, a2);
if ( v3 )
{
v3 = 1;
}
else if ( !(unsigned __int8)errorGet() )
{
v3 = parseList(a1, a2);
if ( v3 )
{
v3 = 1;
}
else if ( !(unsigned __int8)errorGet() )
{
programSetMode(0LL);
v3 = parseLine(a1, a2);
programSetMode(1LL);
}
}
}
return v3;
}

canonical_decompiled_code:
__int64 __fastcall func4(__int64 a1, __int64 a2)
{
unsigned int v2; // er12
unsigned int v3; // er12
__int64 v5; // rdx
unsigned int v6; // eax
const char *v7; // rax
unsigned int v8; // eax
const char *v9; // rax

if ( (unsigned int)matchNumber(a1, a2) )
{
v2 = *(_DWORD *)(a1 + 8);
if ( (unsigned int)matchWhiteSpace(a1, a2) )
{
matchString(a1, a2);
v3 = func1(v2, *(const char **)(a1 + 8));
}
else
{
v3 = func0(v2, a2);
}
}
else if ( (unsigned int)matchSize(a1, a2) )
{
v6 = programGetSize(a1, a2, v5);
v7 = (const char *)itos(v6);
puts(v7);
v3 = 1;
}
else if ( (unsigned int)matchFree(a1, a2) )
{
v8 = programGetFree();
v9 = (const char *)itos(v8);
puts(v9);
v3 = 1;
}
else if ( (unsigned int)matchClear(a1, a2) )
{
programInit();
v3 = 1;
}
else
{
if ( (unsigned int)matchBye(a1, a2) )
exit(0);
v3 = func2(a1, a2);
if ( v3 )
{
v3 = 1;
}
else if ( !(unsigned __int8)errorGet() )
{
v3 = func3(a1, a2);
if ( v3 )
{
v3 = 1;
}
else if ( !(unsigned __int8)errorGet() )
{
programSetMode(0LL);
v3 = parseLine(a1, a2);
programSetMode(1LL);
}
}
}
return v3;
}

original_code:
int parseCommand(token *tok, char **s)
{
 int line;
 int r;
 if (matchNumber(tok, s))
 {
  line = tok->n;
  if (!matchWhiteSpace(tok, s))
   return deleteLine(line);
  else
  {
   matchString(tok, s);
   return insertLine(line, tok->s);
  }
 }
 if (matchSize(tok, s))
 {
  puts(itos(programGetSize()));
  return 1;
 }
 if (matchFree(tok, s))
 {
  puts(itos(programGetFree()));
  return 1;
 }
  if (matchClear(tok, s))
 {
  programInit();
  return 1;
 }
 if (matchBye(tok, s))
 {
  exit(0);
 }
 if (parseRun(tok, s))
  return 1;
 else if (errorGet() != 00) return 0;
 if (parseList(tok, s))
  return 1;
 else if (errorGet() != 00) return 0;
 programSetMode(progModeImmediate);
 r = parseLine(tok, s);
 programSetMode(progModeStored);
 return r;
}

canonical_original_code:
int parseCommand(struct token *tok, char **s)
{
 int line;
 int r;
 if (matchNumber(tok, s))
 {
  line = tok->n;
  if (!matchWhiteSpace(tok, s))
   return deleteLine(line);
  else
  {
   matchString(tok, s);
   return insertLine(line, tok->s);
  }
 }
 if (matchSize(tok, s))
 {
  puts(itos(programGetSize()));
  return 1;
 }
 if (matchFree(tok, s))
 {
  puts(itos(programGetFree()));
  return 1;
 }
  if (matchClear(tok, s))
 {
  programInit();
  return 1;
 }
 if (matchBye(tok, s))
 {
  exit(0);
 }
 if (parseRun(tok, s))
  return 1;
 else if (errorGet() != 00) return 0;
 if (parseList(tok, s))
  return 1;
 else if (errorGet() != 00) return 0;
 programSetMode(progModeImmediate);
 r = parseLine(tok, s);
 programSetMode(progModeStored);
 return r;
}

variable_types: struct token { enum tokenType { tokTypeComma=0, tokTypeNumber=1, tokTypeEOL=2, tokTypeCharacterString=3, tokTypeColon=4, tokTypeDividedBy=5, tokTypeEquals=6, tokTypeFree=7, tokTypeFunctionCall=8, tokTypeFunctionPeek=9, tokTypeGosub=10, tokTypeGoto=11, tokTypeGreaterThan=12, tokTypeGreaterThanOrEquals=13, tokTypeIf=14, tokTypeInput=15, tokTypeLeftParenthesis=16, tokTypeLessThan=17, tokTypeLessThanOrEquals=18, tokTypeLet=19, tokTypeMinus=20, tokTypeNotEquals=21, tokTypePlus=22, tokTypePoke=23, tokTypePrint=24, tokTypeRemark=25, tokTypeReturn=26, tokTypeRightParenthesis=27, tokTypeSemicolon=28, tokTypeSize=29, tokTypeString=30, tokTypeDoubleQuote=31, tokTypeThen=32, tokTypeTimes=33, tokTypeVariable=34, tokTypeWhiteSpace=35, tokTypeClear=36, tokTypeRun=37, tokTypeList=38 } type; enum tokenValueType { tokValueTypeNone=0, tokValueTypeString=1, tokValueTypeCharacter=2, tokValueTypeNumber=3 } valueType; union { char *s; char c; int n; }; } *

variable_types: r int


variableNameToIndex

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

result = a1 - 97;
if ( (unsigned __int8)(a1 - 97) > 0x19u )
{
result = a1 - 65;
if ( (unsigned __int8)(a1 - 65) > 0x19u )
{
result = 0xFFFFFFFFLL;
if ( (unsigned __int8)a1 < 0x1Bu )
result = a1;
}
}
return result;
}

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

result = a1 - 97;
if ( (unsigned __int8)(a1 - 97) > 0x19u )
{
result = a1 - 65;
if ( (unsigned __int8)(a1 - 65) > 0x19u )
{
result = 0xFFFFFFFFLL;
if ( (unsigned __int8)a1 < 0x1Bu )
result = a1;
}
}
return result;
}

original_code:
static char variableNameToIndex(char v)
{
 if ((v >= 'a') && (v <= 'z')) v -= 32;
 if ((v >= 'A') && (v <= 'Z')) v -= 'A';
 if ((v < 0) || (v > 26)) return -1;
 return v;
}

variable_types: v char

return_type: char


variableInit

decompiled_code:
__int64 variableInit()
{
__int64 result; // rax

result = 0LL;
memset(&variables, 0, 0x68uLL);
return result;
}

canonical_decompiled_code:
__int64 func1()
{
__int64 result; // rax

result = 0LL;
memset(&variables, 0, 0x68uLL);
return result;
}

original_code:
void variableInit(void)
{
 memset(_variables, 0, sizeof(int) * 26);
 return;
}

canonical_original_code:
void variableInit()
{
 memset(_variables, 0, sizeof(int) * 26);
 return;
}

return_type: void


variableSet

decompiled_code:
__int64 __fastcall variableSet(char a1, int a2)
{
__int64 result; // rax

result = variableNameToIndex(a1);
if ( (result & 0x80u) == 0LL )
{
result = (char)result;
variables[(char)result] = a2;
}
return result;
}

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

result = func0(a1);
if ( (result & 0x80u) == 0LL )
{
result = (char)result;
variables[(char)result] = a2;
}
return result;
}

original_code:
void variableSet(char v, int n)
{
 v = variableNameToIndex(v);
 if (v < 0) return;
 _variables[(int)v] = n;
 return;
}

variable_types: n int


variableGet

decompiled_code:
__int64 __fastcall variableGet(char a1)
{
char v1; // al
__int64 result; // rax

v1 = variableNameToIndex(a1);
if ( v1 < 0 )
result = 0xFFFFFFFFLL;
else
result = (unsigned int)variables[v1];
return result;
}

canonical_decompiled_code:
__int64 __fastcall func3(char a1)
{
char v1; // al
__int64 result; // rax

v1 = func0(a1);
if ( v1 < 0 )
result = 0xFFFFFFFFLL;
else
result = (unsigned int)variables[v1];
return result;
}

original_code:
int variableGet(char v)
{
 v = variableNameToIndex(v);
 if (v < 0) return -1;
 return _variables[(int)v];
}


tokenClear

original_code:
void tokenClear(token *tok)
{
 if (!tok) return;
 switch (tok->valueType)
 {
  case tokValueTypeString:
   if (tok->s) free(tok->s);
   break;
  case tokValueTypeNone:
  case tokValueTypeNumber:
  case tokValueTypeCharacter:
   break;
 }
 memset(tok, 0, sizeof(token));
 return;
}

canonical_original_code:
void tokenClear(struct token *tok)
{
 if (!tok) return;
 switch (tok->valueType)
 {
  case tokValueTypeString:
   if (tok->s) free(tok->s);
   break;
  case tokValueTypeNone:
  case tokValueTypeNumber:
  case tokValueTypeCharacter:
   break;
 }
 memset(tok, 0, sizeof(token));
 return;
}


tokenFill

decompiled_code:
void __fastcall tokenFill(__int64 a1, int a2, int a3, const char *a4, int a5)
{
void *v8; // rbp
int v9; // edx
char dest[8]; // [rsp+0h] [rbp-34h] BYREF
int v11; // [rsp+8h] [rbp-2Ch]

if ( a1 )
{
*(_QWORD *)dest = 0LL;
v11 = 0;
tokenClear(a1);
*(_DWORD *)a1 = a2;
*(_DWORD *)(a1 + 4) = a3;
switch ( a3 )
{
case 2:
*(_BYTE *)(a1 + 8) = *a4;
break;
case 3:
v9 = 11;
if ( a5 <= 11 )
v9 = a5;
strncpy(dest, a4, v9);
*(_DWORD *)(a1 + 8) = atoi(dest);
break;
case 1:
v8 = malloc(a5 + 1);
*(_QWORD *)(a1 + 8) = v8;
memset(v8, 0, a5 + 1);
strncpy((char *)v8, a4, a5);
break;
}
}
}

canonical_decompiled_code:
void __fastcall func1(__int64 a1, int a2, int a3, const char *a4, int a5)
{
void *v8; // rbp
int v9; // edx
char dest[8]; // [rsp+0h] [rbp-34h] BYREF
int v11; // [rsp+8h] [rbp-2Ch]

if ( a1 )
{
*(_QWORD *)dest = 0LL;
v11 = 0;
func0(a1);
*(_DWORD *)a1 = a2;
*(_DWORD *)(a1 + 4) = a3;
switch ( a3 )
{
case 2:
*(_BYTE *)(a1 + 8) = *a4;
break;
case 3:
v9 = 11;
if ( a5 <= 11 )
v9 = a5;
strncpy(dest, a4, v9);
*(_DWORD *)(a1 + 8) = atoi(dest);
break;
case 1:
v8 = malloc(a5 + 1);
*(_QWORD *)(a1 + 8) = v8;
memset(v8, 0, a5 + 1);
strncpy((char *)v8, a4, a5);
break;
}
}
}

original_code:
void tokenFill(token *tok,
        tokenType type,
        tokenValueType valueType,
        char *value,
        int valueLength)
{
 char numberString[12];
 if (!tok) return;
 memset(numberString, 0, 12);
 tokenClear(tok);
 tok->type = type;
 tok->valueType = valueType;
 switch (valueType)
 {
  case tokValueTypeNone:
   break;
  case tokValueTypeString:
   tok->s = (char *)malloc(valueLength + 1);
   memset(tok->s, 0, valueLength + 1);
   strncpy(tok->s, value, valueLength);
   break;
  case tokValueTypeCharacter:
   tok->c = *value;
   break;
  case tokValueTypeNumber:
   strncpy(numberString, value, (valueLength > 11) ? 11 : valueLength);
   tok->n = atoi(numberString);
   break;
 }
 return;
}

canonical_original_code:
void tokenFill(struct token *tok, enum tokenType type, enum tokenValueType valueType, char *value, int valueLength)
{
 char numberString[12];
 if (!tok) return;
 memset(numberString, 0, 12);
 tokenClear(tok);
 tok->type = type;
 tok->valueType = valueType;
 switch (valueType)
 {
  case tokValueTypeNone:
   break;
  case tokValueTypeString:
   tok->s = (char *)malloc(valueLength + 1);
   memset(tok->s, 0, valueLength + 1);
   strncpy(tok->s, value, valueLength);
   break;
  case tokValueTypeCharacter:
   tok->c = *value;
   break;
  case tokValueTypeNumber:
   strncpy(numberString, value, (valueLength > 11) ? 11 : valueLength);
   tok->n = atoi(numberString);
   break;
 }
 return;
}

variable_types: enum tokenType { tokTypeComma=0, tokTypeNumber=1, tokTypeEOL=2, tokTypeCharacterString=3, tokTypeColon=4, tokTypeDividedBy=5, tokTypeEquals=6, tokTypeFree=7, tokTypeFunctionCall=8, tokTypeFunctionPeek=9, tokTypeGosub=10, tokTypeGoto=11, tokTypeGreaterThan=12, tokTypeGreaterThanOrEquals=13, tokTypeIf=14, tokTypeInput=15, tokTypeLeftParenthesis=16, tokTypeLessThan=17, tokTypeLessThanOrEquals=18, tokTypeLet=19, tokTypeMinus=20, tokTypeNotEquals=21, tokTypePlus=22, tokTypePoke=23, tokTypePrint=24, tokTypeRemark=25, tokTypeReturn=26, tokTypeRightParenthesis=27, tokTypeSemicolon=28, tokTypeSize=29, tokTypeString=30, tokTypeDoubleQuote=31, tokTypeThen=32, tokTypeTimes=33, tokTypeVariable=34, tokTypeWhiteSpace=35, tokTypeClear=36, tokTypeRun=37, tokTypeList=38 }

variable_types: enum tokenValueType { tokValueTypeNone=0, tokValueTypeString=1, tokValueTypeCharacter=2, tokValueTypeNumber=3 }

variable_types:
value
char *

variable_types: valueLength int

variable_types:
numberString
char [12]


matchBye

decompiled_code:
__int64 __fastcall matchBye(__int64 a1, const char **a2)
{
__int64 v2; // rdx
__int64 result; // rax

v2 = (unsigned int)strncasecmp(*a2, "bye", 3uLL);
result = 0LL;
if ( !(_DWORD)v2 )
{
tokenFill(a1, 36LL, v2, 0LL, 0LL);
*a2 += 3;
result = 1LL;
}
return result;
}

canonical_decompiled_code:
__int64 __fastcall func0(__int64 a1, const char **a2)
{
__int64 v2; // rdx
__int64 result; // rax

v2 = (unsigned int)strncasecmp(*a2, "bye", 3uLL);
result = 0LL;
if ( !(_DWORD)v2 )
{
tokenFill(a1, 36LL, v2, 0LL, 0LL);
*a2 += 3;
result = 1LL;
}
return result;
}

original_code:
int matchBye(token *tok, char **s)
{
 if (!strncasecmp(*s, "bye", 3))
 {
  tokenFill(tok, tokTypeClear, tokValueTypeNone, ((void *)0), 0);
  *s += 3;
  return 1;
 }
 return 0;
}

canonical_original_code:
int matchBye(struct token *tok, char **s)
{
 if (!strncasecmp(*s, "bye", 3))
 {
  tokenFill(tok, tokTypeClear, tokValueTypeNone, ((void *)0), 0);
  *s += 3;
  return 1;
 }
 return 0;
}