tokenTagGetStr

decompiled_code:
const char *__fastcall tokenTagGetStr(__int64 a1)
{
const char *result; // rax
int v2; // eax
char *v3; // rbp

result = "<undefined>";
if ( (_DWORD)a1 )
{
result = "other";
if ( (_DWORD)a1 != 1 )
{
result = "end of file";
if ( (_DWORD)a1 != 2 )
{
result = "keyword";
if ( (_DWORD)a1 != 3 )
{
result = "identifier";
if ( (_DWORD)a1 != 5 )
{
result = "integer";
if ( (_DWORD)a1 != 6 )
{
result = "string";
if ( (_DWORD)a1 != 7 )
{
result = "character";
if ( (_DWORD)a1 != 8 )
{
v2 = logi(a1, 10LL);
v3 = (char *)malloc(v2 + 2);
sprintf(v3, "%d", (unsigned int)a1);
debugErrorUnhandled("tokenTagGetStr", "token tag", v3);
free(v3);
result = "<unhandled>";
}
}
}
}
}
}
}
}
return result;
}

canonical_decompiled_code:
const char *__fastcall func0(__int64 a1)
{
const char *result; // rax
int v2; // eax
char *v3; // rbp

result = "<undefined>";
if ( (_DWORD)a1 )
{
result = "other";
if ( (_DWORD)a1 != 1 )
{
result = "end of file";
if ( (_DWORD)a1 != 2 )
{
result = "keyword";
if ( (_DWORD)a1 != 3 )
{
result = "identifier";
if ( (_DWORD)a1 != 5 )
{
result = "integer";
if ( (_DWORD)a1 != 6 )
{
result = "string";
if ( (_DWORD)a1 != 7 )
{
result = "character";
if ( (_DWORD)a1 != 8 )
{
v2 = logi(a1, 10LL);
v3 = (char *)malloc(v2 + 2);
sprintf(v3, "%d", (unsigned int)a1);
debugErrorUnhandled("tokenTagGetStr", "token tag", v3);
free(v3);
result = "<unhandled>";
}
}
}
}
}
}
}
}
return result;
}

original_code:
static char* tokenTagGetStr (tokenTag tag) {
    if (tag == tokenUndefined) return "<undefined>";
    else if (tag == tokenOther) return "other";
    else if (tag == tokenEOF) return "end of file";
    else if (tag == tokenKeyword) return "keyword";
    else if (tag == tokenIdent) return "identifier";
    else if (tag == tokenInt) return "integer";
    else if (tag == tokenStr) return "string";
    else if (tag == tokenChar) return "character";
    else {
        char* str = malloc(logi(tag, 10)+2);
        sprintf(str, "%d", tag);
        debugErrorUnhandled("tokenTagGetStr", "token tag", str);
        free(str);
        return "<unhandled>";
    }
}

canonical_original_code:
static char *tokenTagGetStr(enum tokenTag tag) {
    if (tag == tokenUndefined) return "<undefined>";
    else if (tag == tokenOther) return "other";
    else if (tag == tokenEOF) return "end of file";
    else if (tag == tokenKeyword) return "keyword";
    else if (tag == tokenIdent) return "identifier";
    else if (tag == tokenInt) return "integer";
    else if (tag == tokenStr) return "string";
    else if (tag == tokenChar) return "character";
    else {
        char *str = malloc(logi(tag, 10)+2);
        sprintf(str, "%d", tag);
        debugErrorUnhandled("tokenTagGetStr", "token tag", str);
        free(str);
        return "<unhandled>";
    }
}

variable_types: enum tokenTag { tokenUndefined=0, tokenOther=1, tokenEOF=2, tokenKeyword=3, tokenPunct=4, tokenIdent=5, tokenInt=6, tokenStr=7, tokenChar=8 }

variable_types:
str
char *


parserFindFile

repo: Fedjmike/fcc

decompiled_code:
char *__fastcall parserFindFile(char *s, char *a2, _DWORD *a3)
{
int v4; // eax
__int64 v5; // r15
int v6; // ebx
size_t v7; // rax
char *v8; // rbp
const char *v10; // rax
const char *v11; // r12
int v13; // ebx
size_t v14; // rax
char *v15; // rbx

v4 = strlen(s);
v5 = v4;
if ( a2 && *a2 )
{
v13 = v4;
v14 = strlen(a2);
v15 = (char *)malloc(v13 + v14 + 2);
v8 = v15;
sprintf(v15, "%s/%s", a2, s);
if ( (unsigned int)fexists(v15) )
return v8;
free(v15);
}
v6 = *a3 - 1;
if ( v6 >= 0 )
{
do
{
v10 = (const char *)vectorGet(a3, (unsigned int)v6);
v11 = v10;
if ( *v10 )
{
v7 = strlen(v10);
v8 = (char *)malloc(v5 + v7 + 2);
sprintf(v8, "%s/%s", v11, s);
if ( (unsigned int)fexists(v8) )
return v8;
}
else
{
v8 = strdup(s);
if ( (unsigned int)fexists(v8) )
return v8;
}
free(v8);
}
while ( v6-- != 0 );
}
return 0LL;
}

canonical_decompiled_code:
char *__fastcall func0(char *s, char *a2, _DWORD *a3)
{
int v4; // eax
__int64 v5; // r15
int v6; // ebx
size_t v7; // rax
char *v8; // rbp
const char *v10; // rax
const char *v11; // r12
int v13; // ebx
size_t v14; // rax
char *v15; // rbx

v4 = strlen(s);
v5 = v4;
if ( a2 && *a2 )
{
v13 = v4;
v14 = strlen(a2);
v15 = (char *)malloc(v13 + v14 + 2);
v8 = v15;
sprintf(v15, "%s/%s", a2, s);
if ( (unsigned int)fexists(v15) )
return v8;
free(v15);
}
v6 = *a3 - 1;
if ( v6 >= 0 )
{
do
{
v10 = (const char *)vectorGet(a3, (unsigned int)v6);
v11 = v10;
if ( *v10 )
{
v7 = strlen(v10);
v8 = (char *)malloc(v5 + v7 + 2);
sprintf(v8, "%s/%s", v11, s);
if ( (unsigned int)fexists(v8) )
return v8;
}
else
{
v8 = strdup(s);
if ( (unsigned int)fexists(v8) )
return v8;
}
free(v8);
}
while ( v6-- != 0 );
}
return 0LL;
}

original_code:
static char* parserFindFile (const char* filename, const char* initialPath, const vector * searchPaths) {
    int filenameLength = strlen(filename);
    if (initialPath && initialPath[0]) {
        char* fullname = malloc(strlen(initialPath)+1+filenameLength+1);
        sprintf(fullname, "%s/%s", initialPath, filename);
        if (fexists(fullname))
            return fullname;
        else
            free(fullname);
    }
    for (int i = searchPaths->length-1; i >= 0; i--) {
        const char* path = vectorGet(searchPaths, i);
        char* fullname;
        if (path[0]) {
            fullname = malloc(strlen(path)+1+filenameLength+1);
            sprintf(fullname, "%s/%s", path, filename);
        } else
            fullname = strdup(filename);
        if (fexists(fullname))
            return fullname;
        else
            free(fullname);
    }
    return 0;
}

canonical_original_code:
static char *parserFindFile(char *filename, char *initialPath, struct vector *searchPaths) {
    int filenameLength = strlen(filename);
    if (initialPath && initialPath[0]) {
        char *fullname = malloc(strlen(initialPath)+1+filenameLength+1);
        sprintf(fullname, "%s/%s", initialPath, filename);
        if (fexists(fullname))
            return fullname;
        else
            free(fullname);
    }
    for (int i = searchPaths->length-1; i >= 0; i--) {
        char *path = vectorGet(searchPaths, i);
        char *fullname;
        if (path[0]) {
            fullname = malloc(strlen(path)+1+filenameLength+1);
            sprintf(fullname, "%s/%s", path, filename);
        } else
            fullname = strdup(filename);
        if (fexists(fullname))
            return fullname;
        else
            free(fullname);
    }
    return 0;
}

variable_types:
filename
char *

variable_types:
initialPath
char *

variable_types: struct vector { int length; void **buffer; } *

variable_types: filenameLength int

variable_types:
fullname
char *

variable_types: i int

variable_types:
path
char *

return_type: char *


main

canonical_name: main

repo: FelipeEcker/touch

decompiled_code:
int __cdecl main(int argc, const char **argv, const char **envp)
{
const char *v4; // rdi
const char **v5; // rbx
__time_t v6; // rax
const char *v7; // rdi
struct utimbuf v9; // [rsp+0h] [rbp-28h] BYREF

if ( argc <= 1 )
{
fwrite("\nTouch v0.3 - Felipe Ecker (Khun)\n", 1uLL, 0x22uLL, stderr);
fprintf(stderr, "Use: \n%s <file>\n%s *\n%s dir/*\n\n", *argv, *argv, *argv);
}
else
{
v4 = argv[1];
v5 = argv + 1;
if ( v4 )
{
do
{
++v5;
fopen(v4, "a+");
v6 = time(0LL);
v7 = *(v5 - 1);
v9.modtime = v6;
utime(v7, &v9);
v4 = *v5;
}
while ( *v5 );
}
}
return argc;
}

original_code:
int main (signed int index, char **__files) {
 if ((index | 0x00) < 0x02) {
  fprintf(stderr,"\nTouch v0.3 - Felipe Ecker (Khun)\n");
  fprintf(stderr,"Use: \n%s <file>\n%s *\n%s dir/*\n\n", *__files, *__files, *__files);
  goto __END;
 } else __files++;
 struct utimbuf _utbuff;
 while (*__files) {
  fopen(*__files, "a+");
  _utbuff.modtime = time(((void *)0));
  utime(*__files++, &_utbuff);
 }
__END:
 return index;
}

canonical_original_code:
int main(int index, char **__files) {
 if ((index | 0x00) < 0x02) {
  fprintf(stderr,"\nTouch v0.3 - Felipe Ecker (Khun)\n");
  fprintf(stderr,"Use: \n%s <file>\n%s *\n%s dir/*\n\n", *__files, *__files, *__files);
  goto __END;
 } else __files++;
 struct utimbuf _utbuff;
 while (*__files) {
  fopen(*__files, "a+");
  _utbuff.modtime = time(((void *)0));
  utime(*__files++, &_utbuff);
 }
__END:
 return index;
}

variable_types: index int

variable_types: struct utimbuf { long actime; long modtime; }

return_type: int


repo: Felttrip/Compilers

decompiled_code:
int __fastcall Stack_Push(__int64 a1, int a2)
{
__int64 v2; // rax

v2 = *(int *)(a1 + 400);
if ( (int)v2 > 99 )
{
LODWORD(v2) = puts("Error, stack is full");
}
else
{
*(_DWORD *)(a1 + 400) = v2 + 1;
*(_DWORD *)(a1 + 4 * v2) = a2;
}
return v2;
}

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

v2 = *(int *)(a1 + 400);
if ( (int)v2 > 99 )
{
LODWORD(v2) = puts("Error, stack is full");
}
else
{
*(_DWORD *)(a1 + 400) = v2 + 1;
*(_DWORD *)(a1 + 4 * v2) = a2;
}
return v2;
}

original_code:
void Stack_Push(Stack *s, int d)
{
      if(s->size < 100)
            s->data[s->size++] = d;
      else
            printf("Error, stack is full\n");
}

canonical_original_code:
void Stack_Push(struct _Stack *s, int d)
{
      if(s->size < 100)
            s->data[s->size++] = d;
      else
            printf("Error, stack is full\n");
}

variable_types: struct _Stack { int data[100]; int size; } *

variable_types: d int

return_type: void


decompiled_code:
__int64 __fastcall Stack_Pop(__int64 a1, int a2)
{
int v2; // eax
unsigned int v3; // er8
__int64 result; // rax
int v5; // eax

v2 = *(_DWORD *)(a1 + 400);
if ( v2 <= 0 )
{
puts("Error, attempting to pop an empty stack");
result = 0xFFFFFFFFLL;
}
else
{
if ( a2 == 267 )
{
v5 = v2 - 1;
v3 = 1;
if ( *(_DWORD *)(a1 + 4LL * v5) != 266 )
return v3;
goto LABEL_7;
}
if ( a2 != 269 )
{
v3 = -1;
if ( a2 != 265 )
return v3;
v5 = v2 - 1;
if ( *(_DWORD *)(a1 + 4LL * v5) != 264 )
return 1LL;
LABEL_7:
*(_DWORD *)(a1 + 400) = v5;
return 0LL;
}
v5 = v2 - 1;
if ( *(_DWORD *)(a1 + 4LL * v5) == 268 )
goto LABEL_7;
result = 1LL;
}
return result;
}

canonical_decompiled_code:
__int64 __fastcall func1(__int64 a1, int a2)
{
int v2; // eax
unsigned int v3; // er8
__int64 result; // rax
int v5; // eax

v2 = *(_DWORD *)(a1 + 400);
if ( v2 <= 0 )
{
puts("Error, attempting to pop an empty stack");
result = 0xFFFFFFFFLL;
}
else
{
if ( a2 == 267 )
{
v5 = v2 - 1;
v3 = 1;
if ( *(_DWORD *)(a1 + 4LL * v5) != 266 )
return v3;
goto LABEL_7;
}
if ( a2 != 269 )
{
v3 = -1;
if ( a2 != 265 )
return v3;
v5 = v2 - 1;
if ( *(_DWORD *)(a1 + 4LL * v5) != 264 )
return 1LL;
LABEL_7:
*(_DWORD *)(a1 + 400) = v5;
return 0LL;
}
v5 = v2 - 1;
if ( *(_DWORD *)(a1 + 4LL * v5) == 268 )
goto LABEL_7;
result = 1LL;
}
return result;
}

original_code:
int Stack_Pop(Stack *s, int d)
{
      if(s->size<=0)
      {
            printf("Error, attempting to pop an empty stack\n");
            return -1;
      }
      switch(d)
      {
            case RPAREN:
            {
                  if(s->data[s->size-1]==LPAREN)
                  {
                        s->size--;
                        return 0;
                  }
                  else
                        return 1;
            }
            case RCURLY:
            {
                  if(s->data[s->size-1]==LCURLY)
                  {
                        s->size--;
                        return 0;
                  }
                  else
                        return 1;
            }
            case RSQUARE:
            {
                  if(s->data[s->size-1]==LSQUARE)
                  {
                        s->size--;
                        return 0;
                  }
                  else
                        return 1;
            }
            default:
                  return -1;
      }
}

canonical_original_code:
int Stack_Pop(struct _Stack *s, int d)
{
      if(s->size<=0)
      {
            printf("Error, attempting to pop an empty stack\n");
            return -1;
      }
      switch(d)
      {
            case RPAREN:
            {
                  if(s->data[s->size-1]==LPAREN)
                  {
                        s->size--;
                        return 0;
                  }
                  else
                        return 1;
            }
            case RCURLY:
            {
                  if(s->data[s->size-1]==LCURLY)
                  {
                        s->size--;
                        return 0;
                  }
                  else
                        return 1;
            }
            case RSQUARE:
            {
                  if(s->data[s->size-1]==LSQUARE)
                  {
                        s->size--;
                        return 0;
                  }
                  else
                        return 1;
            }
            default:
                  return -1;
      }
}

user_defined_types: struct _Stack { int data[100]; int size; }


decompiled_code:
int __cdecl main(int argc, const char **argv, const char **envp)
{
_DWORD *v3; // rax
__int64 v5; // r12
int v6; // er13
int v7; // er14
unsigned int v8; // ebp
unsigned int v9; // ebx
int i; // eax
unsigned int v11; // er15
int v12; // eax
const char *v13; // rsi
const char *v14; // rsi
const char *v15; // rsi
const char *v16; // rsi
int v17; // [rsp+4h] [rbp-44h]

v3 = malloc(0x194uLL);
v3[100] = 0;
if ( argc == 2 )
{
v5 = (__int64)v3;
yyin = fopen(argv[1], "r");
if ( yyin )
{
v6 = 0;
v7 = 0;
v8 = 0;
v17 = -1;
v9 = 1;
for ( i = yylex(); i; i = yylex() )
{
v11 = v8 + 1;
switch ( i )
{
case 256:
v16 = yytext;
if ( strlen(yytext) > 0x20 )
{
v11 = v8;
printf("ID %s too long, ID not counted\n", v16);
}
break;
case 257:
if ( atoi(yytext) < 0 )
{
v11 = v8;
puts("Error invalid number");
}
break;
case 258:
v15 = yytext;
if ( strlen(yytext) > 0xFF )
{
v11 = v8;
printf("String Literal %s too long, String Literal not counted\n", v15);
}
break;
case 264:
Stack_Push(v5, 264);
break;
case 265:
if ( !v6 )
v6 = Stack_Pop(v5, 265);
break;
case 266:
Stack_Push(v5, 266);
break;
case 267:
if ( !v6 )
v6 = Stack_Pop(v5, 267);
break;
case 268:
Stack_Push(v5, 268);
break;
case 269:
if ( !v6 )
v6 = Stack_Pop(v5, 269);
break;
case 287:
while ( 1 )
{
v12 = yylex();
if ( v12 == 288 )
break;
v9 += v12 == 302;
}
goto LABEL_9;
case 299:
if ( v8 == v17 )
v7 = 1;
break;
case 300:
v17 = v8 + 1;
break;
case 302:
++v9;
LABEL_9:
v11 = v8;
break;
case 303:
v11 = v8;
printf(" on line %d\n", v9);
break;
default:
break;
}
v8 = v11;
}
printf("Total tokens: %d\n", v8);
v13 = "no";
if ( v7 )
v13 = "yes";
printf("Main declared: %s\n", v13);
v14 = "yes";
if ( v6 )
v14 = "no";
printf("All brackets match: %s\n", v14);
}
else
{
printf("file unreadable");
}
}
else
{
puts("Error, incorrect usage, pa1 <FILE.lig>");
}
return 0;
}

canonical_decompiled_code:
int __cdecl main(int argc, const char **argv, const char **envp)
{
_DWORD *v3; // rax
__int64 v5; // r12
int v6; // er13
int v7; // er14
unsigned int v8; // ebp
unsigned int v9; // ebx
int i; // eax
unsigned int v11; // er15
int v12; // eax
const char *v13; // rsi
const char *v14; // rsi
const char *v15; // rsi
const char *v16; // rsi
int v17; // [rsp+4h] [rbp-44h]

v3 = malloc(0x194uLL);
v3[100] = 0;
if ( argc == 2 )
{
v5 = (__int64)v3;
yyin = fopen(argv[1], "r");
if ( yyin )
{
v6 = 0;
v7 = 0;
v8 = 0;
v17 = -1;
v9 = 1;
for ( i = yylex(); i; i = yylex() )
{
v11 = v8 + 1;
switch ( i )
{
case 256:
v16 = yytext;
if ( strlen(yytext) > 0x20 )
{
v11 = v8;
printf("ID %s too long, ID not counted\n", v16);
}
break;
case 257:
if ( atoi(yytext) < 0 )
{
v11 = v8;
puts("Error invalid number");
}
break;
case 258:
v15 = yytext;
if ( strlen(yytext) > 0xFF )
{
v11 = v8;
printf("String Literal %s too long, String Literal not counted\n", v15);
}
break;
case 264:
func0(v5, 264);
break;
case 265:
if ( !v6 )
v6 = func1(v5, 265);
break;
case 266:
func0(v5, 266);
break;
case 267:
if ( !v6 )
v6 = func1(v5, 267);
break;
case 268:
func0(v5, 268);
break;
case 269:
if ( !v6 )
v6 = func1(v5, 269);
break;
case 287:
while ( 1 )
{
v12 = yylex();
if ( v12 == 288 )
break;
v9 += v12 == 302;
}
goto LABEL_9;
case 299:
if ( v8 == v17 )
v7 = 1;
break;
case 300:
v17 = v8 + 1;
break;
case 302:
++v9;
LABEL_9:
v11 = v8;
break;
case 303:
v11 = v8;
printf(" on line %d\n", v9);
break;
default:
break;
}
v8 = v11;
}
printf("Total tokens: %d\n", v8);
v13 = "no";
if ( v7 )
v13 = "yes";
printf("Main declared: %s\n", v13);
v14 = "yes";
if ( v6 )
v14 = "no";
printf("All brackets match: %s\n", v14);
}
else
{
printf("file unreadable");
}
}
else
{
puts("Error, incorrect usage, pa1 <FILE.lig>");
}
return 0;
}

original_code:
int main(int argc, char** argv)
{
      char *fname;
      int tok;
      int numTok = 0;
      int mainFlag = 0;
      int brackFlag = 0;
      int lineNum = 1;
      int lastTok = -1;
      Stack *bracketStack = malloc(sizeof(Stack));
      bracketStack->size = 0;
      if(argc != 2)
      {
       printf("Error, incorrect usage, pa1 <FILE.lig>\n");
       return 0;
      }
      fname = argv[1];
      yyin = fopen(fname,"r");
      if(yyin == ((void *)0))
      {
       printf("file unreadable");
       return 0;
      }
      for(;;)
      {
            tok = yylex();
            if(tok==0)
                  break;
            numTok++;
            switch(tok)
            {
                  case FUNCTION:
                  {
                        lastTok = numTok;
                        break;
                  }
                  case MAIN:
                  {
                        if(lastTok == (numTok-1))
                        {
                              mainFlag = 1;
                        }
                        break;
                  }
                  case LPAREN:
                  {
                        Stack_Push(bracketStack,LPAREN);
                        break;
                  }
                  case RPAREN:
                  {
                        if(!brackFlag)
                              brackFlag = Stack_Pop(bracketStack,RPAREN);
                        break;
                  }
                  case LCURLY:
                  {
                        Stack_Push(bracketStack,LCURLY);
                        break;
                  }
                  case RCURLY:
                  {
                        if(!brackFlag)
                              brackFlag = Stack_Pop(bracketStack,RCURLY);
                        break;
                  }
                  case LSQUARE:
                  {
                        Stack_Push(bracketStack,LSQUARE);
                        break;
                  }
                  case RSQUARE:
                  {
                        if(!brackFlag)
                              brackFlag = Stack_Pop(bracketStack,RSQUARE);
                        break;
                  }
                  case LMULTICOMMENT:
                  {
                        numTok--;
                        while(RMULTICOMMENT != (tok = yylex()))
                        {
                              if(tok==NEWLINE)
                                    lineNum++;
                        }
                        break;
                  }
                  case NEWLINE:
                  {
                        numTok--;
                        lineNum++;
                        break;
                  }
                  case BADTOKEN:
                  {
                        numTok--;
                        printf(" on line %d\n",lineNum);
                        break;
                  }
                  case ID:
                  {
                        if(strlen(yytext)>32)
                        {
                              numTok--;
                              printf("ID %s too long, ID not counted\n",yytext);
                        }
                        break;
                  }
                  case STR:
                  {
                        if(strlen(yytext)>255)
                        {
                              numTok--;
                              printf("String Literal %s too long, String Literal not counted\n",yytext);
                        }
                        break;
                  }
                  case NUM:
                  {
                        if((atoi(yytext)<0)||(atoi(yytext)>(pow(2,32)-1)))
                        {
                              numTok--;
                              printf("Error invalid number\n");
                        }
                  }
            }
      }
      printf("Total tokens: %d\n",numTok);
      printf("Main declared: %s\n",mainFlag?"yes":"no");
      printf("All brackets match: %s\n",brackFlag?"no":"yes");
      return 0;
}

canonical_original_code:
int main(int argc, char **argv)
{
      char *fname;
      int tok;
      int numTok = 0;
      int mainFlag = 0;
      int brackFlag = 0;
      int lineNum = 1;
      int lastTok = -1;
      struct _Stack *bracketStack = malloc(sizeof(Stack));
      bracketStack->size = 0;
      if(argc != 2)
      {
       printf("Error, incorrect usage, pa1 <FILE.lig>\n");
       return 0;
      }
      fname = argv[1];
      yyin = fopen(fname,"r");
      if(yyin == ((void *)0))
      {
       printf("file unreadable");
       return 0;
      }
      for(;;)
      {
            tok = yylex();
            if(tok==0)
                  break;
            numTok++;
            switch(tok)
            {
                  case FUNCTION:
                  {
                        lastTok = numTok;
                        break;
                  }
                  case MAIN:
                  {
                        if(lastTok == (numTok-1))
                        {
                              mainFlag = 1;
                        }
                        break;
                  }
                  case LPAREN:
                  {
                        Stack_Push(bracketStack,LPAREN);
                        break;
                  }
                  case RPAREN:
                  {
                        if(!brackFlag)
                              brackFlag = Stack_Pop(bracketStack,RPAREN);
                        break;
                  }
                  case LCURLY:
                  {
                        Stack_Push(bracketStack,LCURLY);
                        break;
                  }
                  case RCURLY:
                  {
                        if(!brackFlag)
                              brackFlag = Stack_Pop(bracketStack,RCURLY);
                        break;
                  }
                  case LSQUARE:
                  {
                        Stack_Push(bracketStack,LSQUARE);
                        break;
                  }
                  case RSQUARE:
                  {
                        if(!brackFlag)
                              brackFlag = Stack_Pop(bracketStack,RSQUARE);
                        break;
                  }
                  case LMULTICOMMENT:
                  {
                        numTok--;
                        while(RMULTICOMMENT != (tok = yylex()))
                        {
                              if(tok==NEWLINE)
                                    lineNum++;
                        }
                        break;
                  }
                  case NEWLINE:
                  {
                        numTok--;
                        lineNum++;
                        break;
                  }
                  case BADTOKEN:
                  {
                        numTok--;
                        printf(" on line %d\n",lineNum);
                        break;
                  }
                  case ID:
                  {
                        if(strlen(yytext)>32)
                        {
                              numTok--;
                              printf("ID %s too long, ID not counted\n",yytext);
                        }
                        break;
                  }
                  case STR:
                  {
                        if(strlen(yytext)>255)
                        {
                              numTok--;
                              printf("String Literal %s too long, String Literal not counted\n",yytext);
                        }
                        break;
                  }
                  case NUM:
                  {
                        if((atoi(yytext)<0)||(atoi(yytext)>(pow(2,32)-1)))
                        {
                              numTok--;
                              printf("Error invalid number\n");
                        }
                  }
            }
      }
      printf("Total tokens: %d\n",numTok);
      printf("Main declared: %s\n",mainFlag?"yes":"no");
      printf("All brackets match: %s\n",brackFlag?"no":"yes");
      return 0;
}

variable_types: argc int

variable_types:
argv
char **

variable_types:
fname
char *

variable_types: tok int

variable_types: numTok int

variable_types: mainFlag int

variable_types: brackFlag int

variable_types: lineNum int

variable_types: lastTok int


yyerror

decompiled_code:
int __fastcall yyerror(const char *a1)
{
return fprintf(stderr, "%s\n", a1);
}

canonical_decompiled_code:
int __fastcall func0(const char *a1)
{
return fprintf(stderr, "%s\n", a1);
}

original_code:
void yyerror(const char* p) {
      fprintf(stderr, "%s\n", p);
}

canonical_original_code:
void yyerror(char *p) {
      fprintf(stderr, "%s\n", p);
}

variable_types:
p
char *


yyparse

decompiled_code:
__int64 yyparse()
{
__int64 v0; // r13
unsigned __int64 v1; // rbp
char *v2; // rdx
__int16 *v3; // rbx
__int16 *v4; // r15
unsigned int v5; // er12
unsigned int v6; // er14
int v7; // eax
int v8; // eax
__int16 *v9; // rsi
char *v10; // rdi
int v11; // eax
__int64 v12; // rcx
__int64 v13; // rax
int v14; // ecx
int v15; // er9
unsigned int v16; // ecx
unsigned __int64 v17; // rax
__int64 v18; // rbx
__int64 v19; // r12
__int16 *v20; // rax
__int16 *v21; // r14
void *v22; // rax
size_t v23; // rdx
size_t v24; // r10
unsigned int v25; // er12
__int64 v26; // rax
unsigned int v27; // er12
char *v29; // [rsp+8h] [rbp-500h]
void *v30; // [rsp+8h] [rbp-500h]
int v31; // [rsp+10h] [rbp-4F8h]
char *v32; // [rsp+10h] [rbp-4F8h]
size_t v33; // [rsp+18h] [rbp-4F0h]
__int16 src[200]; // [rsp+20h] [rbp-4E8h] BYREF
char v35[856]; // [rsp+1B0h] [rbp-358h] BYREF

v0 = 0LL;
v1 = 200LL;
yynerrs = 0;
v2 = v35;
src[0] = 0;
v3 = src;
yychar = -2;
v4 = src;
v31 = 0;
v29 = v35;
while ( 1 )
{
v5 = yypact[v0];
v6 = v5;
if ( v5 != -26 )
{
v7 = yychar;
if ( yychar == -2 )
{
v33 = (size_t)v2;
v7 = yylex();
v2 = (char *)v33;
yychar = v7;
}
if ( v7 <= 0 )
{
yychar = 0;
v8 = 0;
}
else if ( v7 <= 280 )
{
v8 = (unsigned __int8)yytranslate[v7];
v6 = v5 + v8;
}
else
{
v6 = v5 + 2;
v8 = 2;
}
if ( v6 <= 5 && yycheck[v6] == v8 )
{
v0 = (unsigned __int8)yytable[v6];
if ( yytable[v6] )
{
v9 = v3;
yychar = -2;
v2 += 4;
v31 = (v31 == 0) + v31 - 1;
*(_DWORD *)v2 = yylval;
goto LABEL_17;
}
v9 = v3;
v10 = v2;
v11 = -29;
v12 = 4LL;
goto LABEL_14;
}
}
if ( !yydefact[v0] )
{
if ( !v31 )
{
v32 = v2;
++yynerrs;
yyerror("syntax error");
v2 = v32;
goto LABEL_36;
}
if ( v31 == 3 )
{
if ( yychar > 0 )
{
yychar = -2;
goto LABEL_36;
}
if ( !yychar )
{
v3 = v4;
v25 = 1;
goto LABEL_41;
}
}
while ( 1 )
{
LABEL_36:
if ( v5 == -26 )
goto LABEL_34;
v27 = v5 + 1;
if ( v27 > 5 )
goto LABEL_34;
if ( yycheck[v27] == 1 )
break;
if ( v3 == v4 )
{
LABEL_40:
v25 = 1;
goto LABEL_41;
}
LABEL_35:
v26 = *--v3;
v2 -= 4;
v5 = yypact[v26];
}
v0 = (unsigned __int8)yytable[v27];
if ( yytable[v27] )
{
v31 = 3;
v2 += 4;
v9 = v3;
*(_DWORD *)v2 = yylval;
goto LABEL_17;
}
LABEL_34:
if ( v3 == v4 )
goto LABEL_40;
goto LABEL_35;
}
v13 = (unsigned __int8)yyr2[(unsigned __int8)yydefact[v0]];
v10 = &v2[-4 * v13];
v9 = &v3[-v13];
v12 = 4LL * (1 - (int)v13);
v11 = (unsigned __int8)yyr1[(unsigned __int8)yydefact[v0]] - 29;
LABEL_14:
v14 = *(_DWORD *)&v2[v12];
v15 = *v9;
v2 = v10 + 4;
*((_DWORD *)v10 + 1) = v14;
v16 = v15 + yypgoto[v11];
if ( v16 <= 5 && (_WORD)v15 == yycheck[v16] )
v0 = (unsigned __int8)yytable[v16];
else
v0 = yydefgoto[v11];
LABEL_17:
v17 = 2 * v1;
v9[1] = v0;
v3 = v9 + 1;
if ( v9 + 1 < &v4[v1 - 1] )
goto LABEL_26;
v18 = (char *)v3 - (char *)v4;
v33 = (v18 >> 1) + 1;
if ( v1 > 0x270F )
break;
v1 = 10000LL;
if ( v17 <= 0x2710 )
v1 = v17;
v19 = v1;
v20 = (__int16 *)malloc(6 * v1 + 3);
v21 = v20;
if ( !v20 )
break;
memcpy(v20, v4, v18 + 2);
v33 *= 4LL;
v22 = memcpy((char *)v21 + ((v19 * 2 + 3) & 0xFFFFFFFFFFFFFFFCLL), v29, v33);
v23 = v33;
v24 = (size_t)v22;
if ( v4 != src )
{
v33 = (size_t)v22;
v30 = (void *)v23;
free(v4);
v24 = v33;
v23 = (size_t)v30;
}
v3 = (__int16 *)((char *)v21 + v18);
v2 = (char *)(v24 + v23 - 4);
if ( v3 >= &v21[v19 - 1] )
{
v3 = v21;
v25 = 1;
goto LABEL_42;
}
v29 = (char *)v24;
v4 = v21;
LABEL_26:
if ( (_DWORD)v0 == 5 )
{
v3 = v4;
v25 = 0;
goto LABEL_41;
}
}
v3 = v4;
v25 = 2;
yyerror("memory exhausted");
LABEL_41:
if ( v3 != src )
LABEL_42:
free(v3);
return v25;
}

canonical_decompiled_code:
__int64 func1()
{
__int64 v0; // r13
unsigned __int64 v1; // rbp
char *v2; // rdx
__int16 *v3; // rbx
__int16 *v4; // r15
unsigned int v5; // er12
unsigned int v6; // er14
int v7; // eax
int v8; // eax
__int16 *v9; // rsi
char *v10; // rdi
int v11; // eax
__int64 v12; // rcx
__int64 v13; // rax
int v14; // ecx
int v15; // er9
unsigned int v16; // ecx
unsigned __int64 v17; // rax
__int64 v18; // rbx
__int64 v19; // r12
__int16 *v20; // rax
__int16 *v21; // r14
void *v22; // rax
size_t v23; // rdx
size_t v24; // r10
unsigned int v25; // er12
__int64 v26; // rax
unsigned int v27; // er12
char *v29; // [rsp+8h] [rbp-500h]
void *v30; // [rsp+8h] [rbp-500h]
int v31; // [rsp+10h] [rbp-4F8h]
char *v32; // [rsp+10h] [rbp-4F8h]
size_t v33; // [rsp+18h] [rbp-4F0h]
__int16 src[200]; // [rsp+20h] [rbp-4E8h] BYREF
char v35[856]; // [rsp+1B0h] [rbp-358h] BYREF

v0 = 0LL;
v1 = 200LL;
yynerrs = 0;
v2 = v35;
src[0] = 0;
v3 = src;
yychar = -2;
v4 = src;
v31 = 0;
v29 = v35;
while ( 1 )
{
v5 = yypact[v0];
v6 = v5;
if ( v5 != -26 )
{
v7 = yychar;
if ( yychar == -2 )
{
v33 = (size_t)v2;
v7 = yylex();
v2 = (char *)v33;
yychar = v7;
}
if ( v7 <= 0 )
{
yychar = 0;
v8 = 0;
}
else if ( v7 <= 280 )
{
v8 = (unsigned __int8)yytranslate[v7];
v6 = v5 + v8;
}
else
{
v6 = v5 + 2;
v8 = 2;
}
if ( v6 <= 5 && yycheck[v6] == v8 )
{
v0 = (unsigned __int8)yytable[v6];
if ( yytable[v6] )
{
v9 = v3;
yychar = -2;
v2 += 4;
v31 = (v31 == 0) + v31 - 1;
*(_DWORD *)v2 = yylval;
goto LABEL_17;
}
v9 = v3;
v10 = v2;
v11 = -29;
v12 = 4LL;
goto LABEL_14;
}
}
if ( !yydefact[v0] )
{
if ( !v31 )
{
v32 = v2;
++yynerrs;
func0("syntax error");
v2 = v32;
goto LABEL_36;
}
if ( v31 == 3 )
{
if ( yychar > 0 )
{
yychar = -2;
goto LABEL_36;
}
if ( !yychar )
{
v3 = v4;
v25 = 1;
goto LABEL_41;
}
}
while ( 1 )
{
LABEL_36:
if ( v5 == -26 )
goto LABEL_34;
v27 = v5 + 1;
if ( v27 > 5 )
goto LABEL_34;
if ( yycheck[v27] == 1 )
break;
if ( v3 == v4 )
{
LABEL_40:
v25 = 1;
goto LABEL_41;
}
LABEL_35:
v26 = *--v3;
v2 -= 4;
v5 = yypact[v26];
}
v0 = (unsigned __int8)yytable[v27];
if ( yytable[v27] )
{
v31 = 3;
v2 += 4;
v9 = v3;
*(_DWORD *)v2 = yylval;
goto LABEL_17;
}
LABEL_34:
if ( v3 == v4 )
goto LABEL_40;
goto LABEL_35;
}
v13 = (unsigned __int8)yyr2[(unsigned __int8)yydefact[v0]];
v10 = &v2[-4 * v13];
v9 = &v3[-v13];
v12 = 4LL * (1 - (int)v13);
v11 = (unsigned __int8)yyr1[(unsigned __int8)yydefact[v0]] - 29;
LABEL_14:
v14 = *(_DWORD *)&v2[v12];
v15 = *v9;
v2 = v10 + 4;
*((_DWORD *)v10 + 1) = v14;
v16 = v15 + yypgoto[v11];
if ( v16 <= 5 && (_WORD)v15 == yycheck[v16] )
v0 = (unsigned __int8)yytable[v16];
else
v0 = yydefgoto[v11];
LABEL_17:
v17 = 2 * v1;
v9[1] = v0;
v3 = v9 + 1;
if ( v9 + 1 < &v4[v1 - 1] )
goto LABEL_26;
v18 = (char *)v3 - (char *)v4;
v33 = (v18 >> 1) + 1;
if ( v1 > 0x270F )
break;
v1 = 10000LL;
if ( v17 <= 0x2710 )
v1 = v17;
v19 = v1;
v20 = (__int16 *)malloc(6 * v1 + 3);
v21 = v20;
if ( !v20 )
break;
memcpy(v20, v4, v18 + 2);
v33 *= 4LL;
v22 = memcpy((char *)v21 + ((v19 * 2 + 3) & 0xFFFFFFFFFFFFFFFCLL), v29, v33);
v23 = v33;
v24 = (size_t)v22;
if ( v4 != src )
{
v33 = (size_t)v22;
v30 = (void *)v23;
free(v4);
v24 = v33;
v23 = (size_t)v30;
}
v3 = (__int16 *)((char *)v21 + v18);
v2 = (char *)(v24 + v23 - 4);
if ( v3 >= &v21[v19 - 1] )
{
v3 = v21;
v25 = 1;
goto LABEL_42;
}
v29 = (char *)v24;
v4 = v21;
LABEL_26:
if ( (_DWORD)v0 == 5 )
{
v3 = v4;
v25 = 0;
goto LABEL_41;
}
}
v3 = v4;
v25 = 2;
func0("memory exhausted");
LABEL_41:
if ( v3 != src )
LABEL_42:
free(v3);
return v25;
}

original_code:
int
yyparse (void)
{
    int yystate;
    int yyerrstatus;
    yytype_int16 yyssa[200];
    yytype_int16 *yyss;
    yytype_int16 *yyssp;
    YYSTYPE yyvsa[200];
    YYSTYPE *yyvs;
    YYSTYPE *yyvsp;
    long unsigned int yystacksize;
  int yyn;
  int yyresult;
  int yytoken = 0;
  YYSTYPE yyval;
  int yylen = 0;
  yyssp = yyss = yyssa;
  yyvsp = yyvs = yyvsa;
  yystacksize = 200;
  ;
  yystate = 0;
  yyerrstatus = 0;
  yynerrs = 0;
  yychar = (-2);
  goto yysetstate;
yynewstate:
  yyssp++;
yysetstate:
  *yyssp = (yytype_int16) yystate;
  if (yyss + yystacksize - 1 <= yyssp)
    {
      long unsigned int yysize = (long unsigned int) (yyssp - yyss + 1);
      if (10000 <= yystacksize)
        goto yyexhaustedlab;
      yystacksize *= 2;
      if (10000 < yystacksize)
        yystacksize = 10000;
      {
        yytype_int16 *yyss1 = yyss;
        union yyalloc *yyptr =
          (union yyalloc *) malloc (((yystacksize) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) + (sizeof (union yyalloc) - 1)));
        if (! yyptr)
          goto yyexhaustedlab;
        do { long unsigned int yynewbytes; __builtin_memcpy (&yyptr->yyss_alloc, yyss, (yysize) * sizeof (*(yyss))); yyss = &yyptr->yyss_alloc; yynewbytes = yystacksize * sizeof (*yyss) + (sizeof (union yyalloc) - 1); yyptr += yynewbytes / sizeof (*yyptr); } while (0);
        do { long unsigned int yynewbytes; __builtin_memcpy (&yyptr->yyvs_alloc, yyvs, (yysize) * sizeof (*(yyvs))); yyvs = &yyptr->yyvs_alloc; yynewbytes = yystacksize * sizeof (*yyvs) + (sizeof (union yyalloc) - 1); yyptr += yynewbytes / sizeof (*yyptr); } while (0);
        if (yyss1 != yyssa)
          free (yyss1);
      }
      yyssp = yyss + yysize - 1;
      yyvsp = yyvs + yysize - 1;
      ;
      if (yyss + yystacksize - 1 <= yyssp)
        goto yyabortlab;
    }
  ;
  if (yystate == 5)
    goto yyacceptlab;
  goto yybackup;
yybackup:
  yyn = yypact[yystate];
  if ((!!((yyn) == (-26))))
    goto yydefault;
  if (yychar == (-2))
    {
      ;
      yychar = yylex ();
    }
  if (yychar <= 0)
    {
      yychar = yytoken = 0;
      ;
    }
  else
    {
      yytoken = ((unsigned) (yychar) <= 280 ? yytranslate[yychar] : 2);
      ;
    }
  yyn += yytoken;
  if (yyn < 0 || 5 < yyn || yycheck[yyn] != yytoken)
    goto yydefault;
  yyn = yytable[yyn];
  if (yyn <= 0)
    {
      if (0)
        goto yyerrlab;
      yyn = -yyn;
      goto yyreduce;
    }
  if (yyerrstatus)
    yyerrstatus--;
  ;
  yychar = (-2);
  yystate = yyn;

#pragma GCC diagnostic push

#pragma GCC diagnostic ignored "-Wuninitialized"

#pragma GCC diagnostic ignored "-Wmaybe-uninitialized"

  *++yyvsp = yylval;

#pragma GCC diagnostic pop

  goto yynewstate;
yydefault:
  yyn = yydefact[yystate];
  if (yyn == 0)
    goto yyerrlab;
  goto yyreduce;
yyreduce:
  yylen = yyr2[yyn];
  yyval = yyvsp[1-yylen];
  ;
  switch (yyn)
    {
      default: break;
    }
  ;
  (yyvsp -= (yylen), yyssp -= (yylen));
  yylen = 0;
  ;
  *++yyvsp = yyval;
  {
    const int yylhs = yyr1[yyn] - 29;
    const int yyi = yypgoto[yylhs] + *yyssp;
    yystate = (0 <= yyi && yyi <= 5 && yycheck[yyi] == *yyssp
               ? yytable[yyi]
               : yydefgoto[yylhs]);
  }
  goto yynewstate;
yyerrlab:
  yytoken = yychar == (-2) ? (-2) : ((unsigned) (yychar) <= 280 ? yytranslate[yychar] : 2);
  if (!yyerrstatus)
    {
      ++yynerrs;
      yyerror ("syntax error");
    }
  if (yyerrstatus == 3)
    {
      if (yychar <= 0)
        {
          if (yychar == 0)
            goto yyabortlab;
        }
      else
        {
          yydestruct ("Error: discarding",
                      yytoken, &yylval);
          yychar = (-2);
        }
    }
  goto yyerrlab1;
yyerrorlab:
  if (0)
    goto yyerrorlab;
  (yyvsp -= (yylen), yyssp -= (yylen));
  yylen = 0;
  ;
  yystate = *yyssp;
  goto yyerrlab1;
yyerrlab1:
  yyerrstatus = 3;
  for (;;)
    {
      yyn = yypact[yystate];
      if (!(!!((yyn) == (-26))))
        {
          yyn += 1;
          if (0 <= yyn && yyn <= 5 && yycheck[yyn] == 1)
            {
              yyn = yytable[yyn];
              if (0 < yyn)
                break;
            }
        }
      if (yyssp == yyss)
        goto yyabortlab;
      yydestruct ("Error: popping",
                  yystos[yystate], yyvsp);
      (yyvsp -= (1), yyssp -= (1));
      yystate = *yyssp;
      ;
    }

#pragma GCC diagnostic push

#pragma GCC diagnostic ignored "-Wuninitialized"

#pragma GCC diagnostic ignored "-Wmaybe-uninitialized"

  *++yyvsp = yylval;

#pragma GCC diagnostic pop

  ;
  yystate = yyn;
  goto yynewstate;
yyacceptlab:
  yyresult = 0;
  goto yyreturn;
yyabortlab:
  yyresult = 1;
  goto yyreturn;
yyexhaustedlab:
  yyerror ("memory exhausted");
  yyresult = 2;
yyreturn:
  if (yychar != (-2))
    {
      yytoken = ((unsigned) (yychar) <= 280 ? yytranslate[yychar] : 2);
      yydestruct ("Cleanup: discarding lookahead",
                  yytoken, &yylval);
    }
  (yyvsp -= (yylen), yyssp -= (yylen));
  ;
  while (yyssp != yyss)
    {
      yydestruct ("Cleanup: popping",
                  yystos[*yyssp], yyvsp);
      (yyvsp -= (1), yyssp -= (1));
    }
  if (yyss != yyssa)
    free (yyss);
  return yyresult;
}

canonical_original_code:
int yyparse()
{
    int yystate;
    int yyerrstatus;
    short yyssa[200];
    short *yyss;
    short *yyssp;
    union YYSTYPE yyvsa[200];
    union YYSTYPE *yyvs;
    union YYSTYPE *yyvsp;
    unsigned long yystacksize;
  int yyn;
  int yyresult;
  int yytoken = 0;
  union YYSTYPE yyval;
  int yylen = 0;
  yyssp = yyss = yyssa;
  yyvsp = yyvs = yyvsa;
  yystacksize = 200;
  ;
  yystate = 0;
  yyerrstatus = 0;
  yynerrs = 0;
  yychar = (-2);
  goto yysetstate;
yynewstate:
  yyssp++;
yysetstate:
  *yyssp = (short) yystate;
  if (yyss + yystacksize - 1 <= yyssp)
    {
      unsigned long yysize = (long unsigned int) (yyssp - yyss + 1);
      if (10000 <= yystacksize)
        goto yyexhaustedlab;
      yystacksize *= 2;
      if (10000 < yystacksize)
        yystacksize = 10000;
      {
        short *yyss1 = yyss;
        union yyalloc *yyptr = (union yyalloc *) malloc (((yystacksize) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) + (sizeof (union yyalloc) - 1)));
        if (! yyptr)
          goto yyexhaustedlab;
        do { unsigned long yynewbytes; __builtin_memcpy (&yyptr->yyss_alloc, yyss, (yysize) * sizeof (*(yyss))); yyss = &yyptr->yyss_alloc; yynewbytes = yystacksize * sizeof (*yyss) + (sizeof (union yyalloc) - 1); yyptr += yynewbytes / sizeof (*yyptr); } while (0);
        do { unsigned long yynewbytes; __builtin_memcpy (&yyptr->yyvs_alloc, yyvs, (yysize) * sizeof (*(yyvs))); yyvs = &yyptr->yyvs_alloc; yynewbytes = yystacksize * sizeof (*yyvs) + (sizeof (union yyalloc) - 1); yyptr += yynewbytes / sizeof (*yyptr); } while (0);
        if (yyss1 != yyssa)
          free (yyss1);
      }
      yyssp = yyss + yysize - 1;
      yyvsp = yyvs + yysize - 1;
      ;
      if (yyss + yystacksize - 1 <= yyssp)
        goto yyabortlab;
    }
  ;
  if (yystate == 5)
    goto yyacceptlab;
  goto yybackup;
yybackup:
  yyn = yypact[yystate];
  if ((!!((yyn) == (-26))))
    goto yydefault;
  if (yychar == (-2))
    {
      ;
      yychar = yylex ();
    }
  if (yychar <= 0)
    {
      yychar = yytoken = 0;
      ;
    }
  else
    {
      yytoken = ((unsigned int) (yychar) <= 280 ? yytranslate[yychar] : 2);
      ;
    }
  yyn += yytoken;
  if (yyn < 0 || 5 < yyn || yycheck[yyn] != yytoken)
    goto yydefault;
  yyn = yytable[yyn];
  if (yyn <= 0)
    {
      if (0)
        goto yyerrlab;
      yyn = -yyn;
      goto yyreduce;
    }
  if (yyerrstatus)
    yyerrstatus--;
  ;
  yychar = (-2);
  yystate = yyn;

#pragma GCC diagnostic push

#pragma GCC diagnostic ignored "-Wuninitialized"

#pragma GCC diagnostic ignored "-Wmaybe-uninitialized"

  *++yyvsp = yylval;

#pragma GCC diagnostic pop

  goto yynewstate;
yydefault:
  yyn = yydefact[yystate];
  if (yyn == 0)
    goto yyerrlab;
  goto yyreduce;
yyreduce:
  yylen = yyr2[yyn];
  yyval = yyvsp[1-yylen];
  ;
  switch (yyn)
    {
      default: break;
    }
  ;
  (yyvsp -= (yylen), yyssp -= (yylen));
  yylen = 0;
  ;
  *++yyvsp = yyval;
  {
    int yylhs = yyr1[yyn] - 29;
    int yyi = yypgoto[yylhs] + *yyssp;
    yystate = (0 <= yyi && yyi <= 5 && yycheck[yyi] == *yyssp
               ? yytable[yyi]
               : yydefgoto[yylhs]);
  }
  goto yynewstate;
yyerrlab:
  yytoken = yychar == (-2) ? (-2) : ((unsigned int) (yychar) <= 280 ? yytranslate[yychar] : 2);
  if (!yyerrstatus)
    {
      ++yynerrs;
      yyerror ("syntax error");
    }
  if (yyerrstatus == 3)
    {
      if (yychar <= 0)
        {
          if (yychar == 0)
            goto yyabortlab;
        }
      else
        {
          yydestruct ("Error: discarding",
                      yytoken, &yylval);
          yychar = (-2);
        }
    }
  goto yyerrlab1;
yyerrorlab:
  if (0)
    goto yyerrorlab;
  (yyvsp -= (yylen), yyssp -= (yylen));
  yylen = 0;
  ;
  yystate = *yyssp;
  goto yyerrlab1;
yyerrlab1:
  yyerrstatus = 3;
  for (;;)
    {
      yyn = yypact[yystate];
      if (!(!!((yyn) == (-26))))
        {
          yyn += 1;
          if (0 <= yyn && yyn <= 5 && yycheck[yyn] == 1)
            {
              yyn = yytable[yyn];
              if (0 < yyn)
                break;
            }
        }
      if (yyssp == yyss)
        goto yyabortlab;
      yydestruct ("Error: popping",
                  yystos[yystate], yyvsp);
      (yyvsp -= (1), yyssp -= (1));
      yystate = *yyssp;
      ;
    }

#pragma GCC diagnostic push

#pragma GCC diagnostic ignored "-Wuninitialized"

#pragma GCC diagnostic ignored "-Wmaybe-uninitialized"

  *++yyvsp = yylval;

#pragma GCC diagnostic pop

  ;
  yystate = yyn;
  goto yynewstate;
yyacceptlab:
  yyresult = 0;
  goto yyreturn;
yyabortlab:
  yyresult = 1;
  goto yyreturn;
yyexhaustedlab:
  yyerror ("memory exhausted");
  yyresult = 2;
yyreturn:
  if (yychar != (-2))
    {
      yytoken = ((unsigned int) (yychar) <= 280 ? yytranslate[yychar] : 2);
      yydestruct ("Cleanup: discarding lookahead",
                  yytoken, &yylval);
    }
  (yyvsp -= (yylen), yyssp -= (yylen));
  ;
  while (yyssp != yyss)
    {
      yydestruct ("Cleanup: popping",
                  yystos[*yyssp], yyvsp);
      (yyvsp -= (1), yyssp -= (1));
    }
  if (yyss != yyssa)
    free (yyss);
  return yyresult;
}

variable_types: yystate int

variable_types: yyerrstatus int

variable_types:
yyssa
short [200]

variable_types:
yyss
short *

variable_types:
yyssp
short *

variable_types:
yyvsa
union YYSTYPE { int val; } [200]

variable_types:
yyvs
union YYSTYPE { int val; } *

variable_types:
yyvsp
union YYSTYPE { int val; } *

variable_types:
yystacksize
unsigned long

variable_types: yyn int

variable_types: yyresult int

variable_types: yytoken int

variable_types:
yyval
union YYSTYPE { int val; }

variable_types: yylen int

variable_types:
yysize
unsigned long

variable_types: union yyalloc { short yyss_alloc; union YYSTYPE { int val; } yyvs_alloc; } *

variable_types:
yynewbytes
unsigned long

variable_types: yylhs int

variable_types: yyi int

user_defined_types: union yyalloc { short yyss_alloc; union YYSTYPE yyvs_alloc; }


repo: Femaref/emerald

decompiled_code:
void *malloc_matrix()
{
return calloc(0x40uLL, 1uLL);
}

canonical_decompiled_code:
void *func0()
{
return calloc(0x40uLL, 1uLL);
}

original_code:
matrix4* malloc_matrix() {
  matrix4 *output = malloc(16*sizeof(float));
  memset(output, 0, 16*sizeof(float));
  return output;
}

canonical_original_code:
struct matrix4 *malloc_matrix() {
  struct matrix4 *output = malloc(16*sizeof(float));
  memset(output, 0, 16*sizeof(float));
  return output;
}

variable_types:
output
struct matrix4 { float data[16]; } *

return_type: struct matrix4 { float data[16]; } *


decompiled_code:
void *malloc_vector()
{
return calloc(0x10uLL, 1uLL);
}

canonical_decompiled_code:
void *func1()
{
return calloc(0x10uLL, 1uLL);
}

original_code:
vector* malloc_vector() {
  vector *output = malloc(4*sizeof(float));
  memset(output, 0, 4*sizeof(float));
  return output;
}

canonical_original_code:
struct vector *malloc_vector() {
  struct vector *output = malloc(4*sizeof(float));
  memset(output, 0, 4*sizeof(float));
  return output;
}

variable_types:
output
struct vector { float data[4]; } *

return_type: struct vector { float data[4]; } *


original_code:
void copy_matrix(matrix4 *dst, matrix4 *src) {
  memcpy(dst, src, 16*sizeof(float));
}

canonical_original_code:
void copy_matrix(struct matrix4 *dst, struct matrix4 *src) {
  memcpy(dst, src, 16*sizeof(float));
}

variable_types:
dst
struct matrix4 { float data[16]; } *

variable_types:
src
struct matrix4 *


decompiled_code:
void __fastcall copy_vector(__m128i *a1, const __m128i *a2)
{
*a1 = _mm_loadu_si128(a2);
}

canonical_decompiled_code:
void __fastcall func3(__m128i *a1, const __m128i *a2)
{
*a1 = _mm_loadu_si128(a2);
}

original_code:
void copy_vector(vector *dst, vector *src) {
  memcpy(dst, src, 4*sizeof(float));
}

canonical_original_code:
void copy_vector(struct vector *dst, struct vector *src) {
  memcpy(dst, src, 4*sizeof(float));
}

variable_types:
dst
struct vector { float data[4]; } *

variable_types:
src
struct vector *


decompiled_code:
void __fastcall translate4(float *a1, float a2, float a3, float a4)
{
float v4; // xmm1_4
float v5; // xmm2_4

v4 = a3 + a1[7];
v5 = a4 + a1[11];
a1[3] = a2 + a1[3];
a1[7] = v4;
a1[11] = v5;
}

original_code:
void translate4(matrix4 *matrix, float x, float y, float z) {
  matrix->data[3] += x;
  matrix->data[7] += y;
  matrix->data[11] += z;
}

canonical_original_code:
void translate4(struct matrix4 *matrix, float x, float y, float z) {
  matrix->data[3] += x;
  matrix->data[7] += y;
  matrix->data[11] += z;
}

variable_types:
matrix
struct matrix4 { float data[16]; } *

variable_types: x float

variable_types: y float

variable_types: z float


normalize

decompiled_code:
void __fastcall normalize(__int64 a1)
{
float v1; // xmm2_4
float v2; // xmm0_4
float v3; // xmm3_4

v1 = *(float *)(a1 + 8);
v2 = COERCE_FLOAT(*(_DWORD *)a1 & LC1) + COERCE_FLOAT(*(_DWORD *)(a1 + 4) & LC1) + COERCE_FLOAT(LC1 & LODWORD(v1));
v3 = *(float *)(a1 + 4) / v2;
*(float *)a1 = *(float *)a1 / v2;
*(float *)(a1 + 4) = v3;
*(float *)(a1 + 8) = v1 / v2;
}

canonical_decompiled_code:
void __fastcall func6(__int64 a1)
{
float v1; // xmm2_4
float v2; // xmm0_4
float v3; // xmm3_4

v1 = *(float *)(a1 + 8);
v2 = COERCE_FLOAT(*(_DWORD *)a1 & LC1) + COERCE_FLOAT(*(_DWORD *)(a1 + 4) & LC1) + COERCE_FLOAT(LC1 & LODWORD(v1));
v3 = *(float *)(a1 + 4) / v2;
*(float *)a1 = *(float *)a1 / v2;
*(float *)(a1 + 4) = v3;
*(float *)(a1 + 8) = v1 / v2;
}

original_code:
void normalize(vector *vec) {
  float total = fabs(vec->data[0]) + fabs(vec->data[1]) + fabs(vec->data[2]);
  vec->data[0] /= total;
  vec->data[1] /= total;
  vec->data[2] /= total;
}

canonical_original_code:
void normalize(struct vector *vec) {
  float total = fabs(vec->data[0]) + fabs(vec->data[1]) + fabs(vec->data[2]);
  vec->data[0] /= total;
  vec->data[1] /= total;
  vec->data[2] /= total;
}

variable_types:
vec
struct vector { float data[4]; } *

variable_types: total float


scale

original_code:
void scale(vector *vec, float scalar) {
  vec->data[0] *= scalar;
  vec->data[1] *= scalar;
  vec->data[2] *= scalar;
}

canonical_original_code:
void scale(struct vector *vec, float scalar) {
  vec->data[0] *= scalar;
  vec->data[1] *= scalar;
  vec->data[2] *= scalar;
}

variable_types: scalar float


decompiled_code:
// attributes: thunk
void free4(void *ptr)
{
free(ptr);
}

canonical_decompiled_code:
void func8(void *ptr)
{
free(ptr);
}

original_code:
void free4(matrix4 *matrix) {
  free(matrix);
}

canonical_original_code:
void free4(struct matrix4 *matrix) {
  free(matrix);
}


multiply

decompiled_code:
void *__fastcall multiply(void *a1)
{
free4(a1);
return malloc_matrix();
}

canonical_decompiled_code:
void *__fastcall func9(void *a1)
{
func8(a1);
return func0();
}

original_code:
void multiply(matrix4 *output, matrix4 *a, matrix4 *b) {
  free4(output);
  output = malloc_matrix();
  for(int i = 0; i < 4; i++) {
    for(int j = 0; j < 4; j++) {
      for(int k = 0; k < 4; k++) {
        output->data[i*4 + j] += a->data[i*4 + k]*b->data[k*4 + j];
      }
    }
  }
}

canonical_original_code:
void multiply(struct matrix4 *output, struct matrix4 *a, struct matrix4 *b) {
  free4(output);
  output = malloc_matrix();
  for(int i = 0; i < 4; i++) {
    for(int j = 0; j < 4; j++) {
      for(int k = 0; k < 4; k++) {
        output->data[i*4 + j] += a->data[i*4 + k]*b->data[k*4 + j];
      }
    }
  }
}

variable_types:
a
struct matrix4 *

variable_types:
b
struct matrix4 *

variable_types: i int

variable_types: j int

variable_types: k int


original_code:
void rotate4x(matrix4 *matrix, float degree) {
  float rad = degree*(3.14125/180);
  matrix4 rot = {{
    1.0, 0.0, 0.0, 0.0,
    0.0, cos(rad), -sin(rad), 0.0,
    0.0, sin(rad), cos(rad), 0.0,
    0.0, 0.0, 0.0, 1.0
  }};
  matrix4 *temp = malloc_matrix();
  memcpy(temp, matrix, 16*sizeof(float));
  multiply(matrix, &rot, temp);
  free4(temp);
}

canonical_original_code:
void rotate4x(struct matrix4 *matrix, float degree) {
  float rad = degree*(3.14125/180);
  struct matrix4 rot = {{
    1.0, 0.0, 0.0, 0.0,
    0.0, cos(rad), -sin(rad), 0.0,
    0.0, sin(rad), cos(rad), 0.0,
    0.0, 0.0, 0.0, 1.0
  }};
  struct matrix4 *temp = malloc_matrix();
  memcpy(temp, matrix, 16*sizeof(float));
  multiply(matrix, &rot, temp);
  free4(temp);
}

variable_types: degree float

variable_types: rad float

variable_types:
rot
struct matrix4 { float data[16]; }

variable_types:
temp
struct matrix4 { float data[16]; } *


original_code:
void rotate4y(matrix4 *matrix, float degree) {
  float rad = degree*(3.14125/180);
  matrix4 rot = {{
    cos(rad), 0.0, sin(rad), 0.0,
    0.0, 1.0, 0.0, 0.0,
    -sin(rad), 0.0, cos(rad), 0.0,
    0.0, 0.0, 0.0, 1.0
  }};
  matrix4 *temp = malloc_matrix();
  memcpy(temp, matrix, 16*sizeof(float));
  multiply(matrix, &rot, temp);
  free4(temp);
}

canonical_original_code:
void rotate4y(struct matrix4 *matrix, float degree) {
  float rad = degree*(3.14125/180);
  struct matrix4 rot = {{
    cos(rad), 0.0, sin(rad), 0.0,
    0.0, 1.0, 0.0, 0.0,
    -sin(rad), 0.0, cos(rad), 0.0,
    0.0, 0.0, 0.0, 1.0
  }};
  struct matrix4 *temp = malloc_matrix();
  memcpy(temp, matrix, 16*sizeof(float));
  multiply(matrix, &rot, temp);
  free4(temp);
}


original_code:
void rotate4z(matrix4 *matrix, float degree) {
  float rad = degree*(3.14125/180);
  matrix4 rot = {{
    cos(rad), -sin(rad), 0.0, 0.0,
    sin(rad), cos(rad), 0.0, 0.0,
    0.0, 0.0, 1.0, 0.0,
    0.0, 0.0, 0.0, 1.0
  }};
  matrix4 *temp = malloc_matrix();
  memcpy(temp, matrix, 16*sizeof(float));
  multiply(matrix, &rot, temp);
  free4(temp);
}

canonical_original_code:
void rotate4z(struct matrix4 *matrix, float degree) {
  float rad = degree*(3.14125/180);
  struct matrix4 rot = {{
    cos(rad), -sin(rad), 0.0, 0.0,
    sin(rad), cos(rad), 0.0, 0.0,
    0.0, 0.0, 1.0, 0.0,
    0.0, 0.0, 0.0, 1.0
  }};
  struct matrix4 *temp = malloc_matrix();
  memcpy(temp, matrix, 16*sizeof(float));
  multiply(matrix, &rot, temp);
  free4(temp);
}


apply

original_code:
void apply(vector *vec, matrix4 *matrix) {
  vector *output = malloc_vector();
  for(int i = 0; i < 4; i++) {
    for(int j = 0; j < 1; j++) {
      for(int k = 0; k < 4; k++) {
        output->data[i] += (matrix->data[i*4 + k])*(vec->data[k]);
      }
    }
  }
  copy_vector(vec, output);
  free_vector(output);
}

canonical_original_code:
void apply(struct vector *vec, struct matrix4 *matrix) {
  struct vector *output = malloc_vector();
  for(int i = 0; i < 4; i++) {
    for(int j = 0; j < 1; j++) {
      for(int k = 0; k < 4; k++) {
        output->data[i] += (matrix->data[i*4 + k])*(vec->data[k]);
      }
    }
  }
  copy_vector(vec, output);
  free_vector(output);
}

variable_types:
output
struct vector { float data[4]; } *

user_defined_types:
struct vector { float data[4]; }
struct matrix4 { float data[16]; }


rotate

decompiled_code:
void __fastcall rotate(__m128i *a1, float a2, float a3, float a4)
{
__m128i *v4; // rbp

v4 = (__m128i *)malloc_matrix();
identity4(v4);
rotate4z(v4, a4);
rotate4y(v4, a3);
rotate4x(v4, a2);
apply(a1, (__int64)v4);
normalize((__int64)a1);
free4(v4);
}

original_code:
void rotate(vector *vector, float pitch, float yaw, float roll) {
  matrix4 *matrix = malloc_matrix();
  identity4(matrix);
  rotate4z(matrix, roll);
  rotate4y(matrix, yaw);
  rotate4x(matrix, pitch);
  apply(vector, matrix);
  normalize(vector);
  free4(matrix);
}

canonical_original_code:
void rotate(struct vector *vector, float pitch, float yaw, float roll) {
  struct matrix4 *matrix = malloc_matrix();
  identity4(matrix);
  rotate4z(matrix, roll);
  rotate4y(matrix, yaw);
  rotate4x(matrix, pitch);
  apply(vector, matrix);
  normalize(vector);
  free4(matrix);
}

variable_types:
vector
struct vector { float data[4]; } *

variable_types: pitch float

variable_types: yaw float

variable_types: roll float

variable_types:
matrix
struct matrix4 { float data[16]; } *


decompiled_code:
// attributes: thunk
void free_vector(void *ptr)
{
free4(ptr);
}

canonical_decompiled_code:
void func15(void *ptr)
{
func8(ptr);
}

original_code:
void free_vector(vector *vec) {
  free(vec);
}

canonical_original_code:
void free_vector(struct vector *vec) {
  free(vec);
}

variable_types:
vec
struct vector { float data[4]; } *


decompiled_code:
int __fastcall print_matrix(__int64 a1)
{
unsigned int v1; // ebx
__int64 v2; // rsi
__int64 v3; // rbp
unsigned int v4; // er12
__int64 v5; // rbx
int result; // eax

v1 = 0;
printf(" |");
do
{
v2 = v1++;
printf(" %d|", v2);
}
while ( v1 != 4 );
v3 = a1 + 16;
v4 = 0;
putchar(10);
do
{
v5 = v3 - 16;
printf("%d|", v4);
do
{
v5 += 4LL;
printf("%+3.8f|", *(float *)(v5 - 4));
}
while ( v5 != v3 );
++v4;
v3 = v5 + 16;
result = putchar(10);
}
while ( v4 != 4 );
return result;
}

canonical_decompiled_code:
int __fastcall func16(__int64 a1)
{
unsigned int v1; // ebx
__int64 v2; // rsi
__int64 v3; // rbp
unsigned int v4; // er12
__int64 v5; // rbx
int result; // eax

v1 = 0;
printf(" |");
do
{
v2 = v1++;
printf(" %d|", v2);
}
while ( v1 != 4 );
v3 = a1 + 16;
v4 = 0;
putchar(10);
do
{
v5 = v3 - 16;
printf("%d|", v4);
do
{
v5 += 4LL;
printf("%+3.8f|", *(float *)(v5 - 4));
}
while ( v5 != v3 );
++v4;
v3 = v5 + 16;
result = putchar(10);
}
while ( v4 != 4 );
return result;
}

original_code:
void print_matrix(matrix4 *matrix) {
  printf(" |");
  for(int i = 0; i < 4; i++) {
    printf("          %d|", i);
  }
  printf("\n");
  for(int i = 0; i < 4; i++) {
    printf("%d|", i);
    for(int j = 0; j < 4; j++) {
      printf("%+3.8f|", matrix->data[i*4 + j]);
    }
    printf("\n");
  }
}

canonical_original_code:
void print_matrix(struct matrix4 *matrix) {
  printf(" |");
  for(int i = 0; i < 4; i++) {
    printf("          %d|", i);
  }
  printf("\n");
  for(int i = 0; i < 4; i++) {
    printf("%d|", i);
    for(int j = 0; j < 4; j++) {
      printf("%+3.8f|", matrix->data[i*4 + j]);
    }
    printf("\n");
  }
}


decompiled_code:
int __fastcall print_vector(__int64 a1)
{
__int64 v1; // rbx
int result; // eax

v1 = 0LL;
printf(" |");
putchar(10);
do
{
printf("%d|", (unsigned int)v1);
printf("%+3.8f|", *(float *)(a1 + 4 * v1++));
result = putchar(10);
}
while ( v1 != 4 );
return result;
}

canonical_decompiled_code:
int __fastcall func17(__int64 a1)
{
__int64 v1; // rbx
int result; // eax

v1 = 0LL;
printf(" |");
putchar(10);
do
{
printf("%d|", (unsigned int)v1);
printf("%+3.8f|", *(float *)(a1 + 4 * v1++));
result = putchar(10);
}
while ( v1 != 4 );
return result;
}

original_code:
void print_vector(vector *vec) {
  printf(" |");
  printf("\n");
  for(int i = 0; i < 4; i++) {
    printf("%d|", i);
    printf("%+3.8f|", vec->data[i]);
    printf("\n");
  }
}

canonical_original_code:
void print_vector(struct vector *vec) {
  printf(" |");
  printf("\n");
  for(int i = 0; i < 4; i++) {
    printf("%d|", i);
    printf("%+3.8f|", vec->data[i]);
    printf("\n");
  }
}


variable_types: struct model_type { struct vertex_type { float x; } vertex[2000]; struct polygon_type { int a; } polygon[2000]; }

variable_types: struct camera_type { float pitch; float x; }

user_defined_types: struct model_type { struct vertex_type vertex[2000]; struct polygon_type polygon[2000]; }


decompiled_code:
size_t __fastcall elog_get_time(char *s)
{
struct tm *v1; // rax
time_t timer; // [rsp+8h] [rbp-10h] BYREF

timer = time(0LL);
v1 = localtime(&timer);
return strftime(s, 0x1EuLL, "[%Y-%m-%d %H:%M:%S %z]", v1);
}

canonical_decompiled_code:
size_t __fastcall func0(char *s)
{
struct tm *v1; // rax
time_t timer; // [rsp+8h] [rbp-10h] BYREF

timer = time(0LL);
v1 = localtime(&timer);
return strftime(s, 0x1EuLL, "[%Y-%m-%d %H:%M:%S %z]", v1);
}

original_code:
void elog_get_time(char *s) {
    time_t t;
    struct tm *tm;
    t = time(((void *)0));
    tm = localtime(&t);
    strftime(s, 30, "[%Y-%m-%d %H:%M:%S %z]", tm);
}

canonical_original_code:
void elog_get_time(char *s) {
    long t;
    struct tm *tm;
    t = time(((void *)0));
    tm = localtime(&t);
    strftime(s, 30, "[%Y-%m-%d %H:%M:%S %z]", tm);
}

variable_types:
s
char *

variable_types: t long

variable_types: struct tm { int tm_sec; int tm_min; int tm_hour; int tm_mday; int tm_mon; int tm_year; int tm_wday; int tm_yday; int tm_isdst; long tm_gmtoff; char *tm_zone; } *


decompiled_code:
__int64 __fastcall dataframe_neptr(__int64 a1)
{
return *(unsigned int *)(*(_QWORD *)(a1 - 8) + 8LL);
}

canonical_decompiled_code:
__int64 __fastcall func0(__int64 a1)
{
return *(unsigned int *)(*(_QWORD *)(a1 - 8) + 8LL);
}

original_code:
static int dataframe_neptr(int **df)
{
    return df[-1][2];
}

variable_types:
df
int **


decompiled_code:
__int64 __fastcall dataframe_elmcnt(__int64 a1)
{
return *(unsigned int *)(*(_QWORD *)(a1 - 8) + 12LL);
}

canonical_decompiled_code:
__int64 __fastcall func1(__int64 a1)
{
return *(unsigned int *)(*(_QWORD *)(a1 - 8) + 12LL);
}

original_code:
static int dataframe_elmcnt(int **df)
{
    return df[-1][3];
}


decompiled_code:
int __fastcall array_print(__int64 a1)
{
__int64 v1; // rbx
__int64 v2; // rsi

putchar(91);
if ( *(int *)(a1 - 4) > 0 )
{
v1 = 0LL;
do
{
v2 = *(unsigned int *)(a1 + 4 * v1++);
printf("%d ", v2);
}
while ( *(_DWORD *)(a1 - 4) > (int)v1 );
}
return puts("\b]");
}

original_code:
static void array_print(int *arr)
{
    int i;
    printf("[");
    for (i = 0; i < arr[-1]; i++) printf("%d ", arr[i]);
    printf("\b]\n");
}

variable_types:
arr
int *

variable_types: i int


decompiled_code:
void __fastcall array_free(__int64 a1)
{
free((void *)(a1 - 8));
}

canonical_decompiled_code:
void __fastcall func4(__int64 a1)
{
free((void *)(a1 - 8));
}

original_code:
static void array_free(int *arr)
{
    free(arr-2);
    return;
}


original_code:
static void dataframe_free(int **df)
{
    int i, dim_one = df[-1][0];
    free(df[-1]);
    for (i = 0; i < dim_one; i++) {
        free(df[i]-2);
    }
    free(df-1);
    return;
}

canonical_original_code:
static void dataframe_free(int **df)
{
    int i; int dim_one = df[-1][0];
    free(df[-1]);
    for (i = 0; i < dim_one; i++) {
        free(df[i]-2);
    }
    free(df-1);
    return;
}


original_code:
static void dataframe_copy(int **dest, int **src)
{
    int i;
    if (dest[-1][0] < src[-1][1]) {
       dest = (int **)realloc(dest-1, (src[-1][1]+1)*sizeof(int *)) + 1;
       ((void) sizeof ((dest) ? 1 : 0), __extension__ ({ if (dest) ; else __assert_fail ("dest", "arrlib.c", 251, __extension__ __PRETTY_FUNCTION__); }));
       dest[-1][0] = src[-1][1];
    }
    memmove(dest[-1]+1, src[-1]+1, 3*sizeof(int));
    for (i = 0; i < src[-1][1]; i++) {
        if (dest[i][-2] < src[i][-1]) {
            dest[i] = (int *)realloc(dest[i]-2, (src[i][-1]+2)) + 2;
            ((void) sizeof ((dest[i]) ? 1 : 0), __extension__ ({ if (dest[i]) ; else __assert_fail ("dest[i]", "arrlib.c", 258, __extension__ __PRETTY_FUNCTION__); }));
            dest[i][-2] = src[i][-1];
        }
        memmove(dest[i]-1, src[i]-1, (src[i][-1]+1)*sizeof(int));
    }
}

variable_types:
dest
int **

variable_types:
src
int **


original_code:
static void dataframe_remove(int **df, char *arg, ...)
{
    va_list arg_ptr;
    size_t nrow, ncol, start, end;
    __builtin_va_start(arg_ptr,arg);
    if (0 == strcmp(arg, "arr")) {
        nrow = __builtin_va_arg(arg_ptr,size_t);
        start = __builtin_va_arg(arg_ptr,size_t);
        end = __builtin_va_arg(arg_ptr,size_t);
        ((void) sizeof ((nrow < df[-1][1]) ? 1 : 0), __extension__ ({ if (nrow < df[-1][1]) ; else __assert_fail ("nrow < df[-1][1]", "arrlib.c", 221, __extension__ __PRETTY_FUNCTION__); }));
        ((void) sizeof ((start >= 0 && start < df[nrow][-1]) ? 1 : 0), __extension__ ({ if (start >= 0 && start < df[nrow][-1]) ; else __assert_fail ("start >= 0 && start < df[nrow][-1]", "arrlib.c", 222, __extension__ __PRETTY_FUNCTION__); }));
        ((void) sizeof ((start <= end && end < df[nrow][-1]) ? 1 : 0), __extension__ ({ if (start <= end && end < df[nrow][-1]) ; else __assert_fail ("start <= end && end < df[nrow][-1]", "arrlib.c", 223, __extension__ __PRETTY_FUNCTION__); }));
        if (end < df[nrow][-1]-1) {
            memmove(df[nrow]+start, df[nrow]+end+1, (df[nrow][-1]-end)*sizeof(int));
        }
        df[nrow][-1] -= end - start + 1;
        df[-1][3] -= end - start + 1;
        if (df[nrow][-1] == 0) df[-1][2] += 1;
    }else if (0 == strcmp(arg, "elm")) {
        nrow = __builtin_va_arg(arg_ptr,size_t);
        ncol = __builtin_va_arg(arg_ptr,size_t);
        ((void) sizeof ((nrow < df[-1][1]) ? 1 : 0), __extension__ ({ if (nrow < df[-1][1]) ; else __assert_fail ("nrow < df[-1][1]", "arrlib.c", 234, __extension__ __PRETTY_FUNCTION__); }));
        ((void) sizeof ((ncol < df[nrow][-1]) ? 1 : 0), __extension__ ({ if (ncol < df[nrow][-1]) ; else __assert_fail ("ncol < df[nrow][-1]", "arrlib.c", 235, __extension__ __PRETTY_FUNCTION__); }));
        if (ncol < df[nrow][-1]-1) {
            memmove(df[nrow]+ncol, df[nrow]+ncol+1, (df[nrow][-1]-ncol-1)*sizeof(int));
        }
        df[nrow][-1] -= 1;
        df[-1][3] -=1;
        if (df[nrow][-1] == 0 ) df[-1][2] += 1;
    }
}

canonical_original_code:
static void dataframe_remove(int **df, char *arg, ...)
{
    __builtin_va_list arg_ptr;
    unsigned long nrow; unsigned long ncol; unsigned long start; unsigned long end;
    __builtin_va_start(arg_ptr,arg);
    if (0 == strcmp(arg, "arr")) {
        nrow = __builtin_va_arg(arg_ptr,size_t);
        start = __builtin_va_arg(arg_ptr,size_t);
        end = __builtin_va_arg(arg_ptr,size_t);
        ((void) sizeof ((nrow < df[-1][1]) ? 1 : 0), __extension__ ({ if (nrow < df[-1][1]) ; else __assert_fail ("nrow < df[-1][1]", "arrlib.c", 221, __extension__ __PRETTY_FUNCTION__); }));
        ((void) sizeof ((start >= 0 && start < df[nrow][-1]) ? 1 : 0), __extension__ ({ if (start >= 0 && start < df[nrow][-1]) ; else __assert_fail ("start >= 0 && start < df[nrow][-1]", "arrlib.c", 222, __extension__ __PRETTY_FUNCTION__); }));
        ((void) sizeof ((start <= end && end < df[nrow][-1]) ? 1 : 0), __extension__ ({ if (start <= end && end < df[nrow][-1]) ; else __assert_fail ("start <= end && end < df[nrow][-1]", "arrlib.c", 223, __extension__ __PRETTY_FUNCTION__); }));
        if (end < df[nrow][-1]-1) {
            memmove(df[nrow]+start, df[nrow]+end+1, (df[nrow][-1]-end)*sizeof(int));
        }
        df[nrow][-1] -= end - start + 1;
        df[-1][3] -= end - start + 1;
        if (df[nrow][-1] == 0) df[-1][2] += 1;
    }else if (0 == strcmp(arg, "elm")) {
        nrow = __builtin_va_arg(arg_ptr,size_t);
        ncol = __builtin_va_arg(arg_ptr,size_t);
        ((void) sizeof ((nrow < df[-1][1]) ? 1 : 0), __extension__ ({ if (nrow < df[-1][1]) ; else __assert_fail ("nrow < df[-1][1]", "arrlib.c", 234, __extension__ __PRETTY_FUNCTION__); }));
        ((void) sizeof ((ncol < df[nrow][-1]) ? 1 : 0), __extension__ ({ if (ncol < df[nrow][-1]) ; else __assert_fail ("ncol < df[nrow][-1]", "arrlib.c", 235, __extension__ __PRETTY_FUNCTION__); }));
        if (ncol < df[nrow][-1]-1) {
            memmove(df[nrow]+ncol, df[nrow]+ncol+1, (df[nrow][-1]-ncol-1)*sizeof(int));
        }
        df[nrow][-1] -= 1;
        df[-1][3] -=1;
        if (df[nrow][-1] == 0 ) df[-1][2] += 1;
    }
}

variable_types:
arg
char *

variable_types:
nrow
unsigned long

variable_types:
ncol
unsigned long

variable_types:
start
unsigned long

variable_types:
end
unsigned long


kargerMinCut

original_code:
int kargerMinCut(int **origin_graph)
{
    const DATAFRAME_METHOD df = Dataframe;
    int **graph;
    int node1=0, node2=0, i, j, k, m, nrow, min_cut;
    size_t nonempty_row;
    graph = df.init("copy", origin_graph);
    min_cut = graph[-1][1]-1;
    nonempty_row = df.neptr(graph);
    for (m = 0; m < 220000; m++) {
        srand((unsigned int)(m*time(0)));
        while(nonempty_row > 2) {
            k = rand()%(df.elmcnt(graph)-graph[-1][1]);
            k += 1;
            node1 = 0;
            while (1) {
                nrow = graph[node1][-1]-1;
                if (k > nrow) {
                    k -= nrow;
                    node1 += 1;
                }else break;
            }
            node2 = graph[node1][k]-1;
            for (i = 0; i < graph[-1][1]; i++) {
                for (j = 1; j < graph[i][-1]; j++) {
                    if (graph[i][j] == node2+1) {
                        graph[i][j] = node1+1;
                    }
                }
            }
            df.append(graph, "arr", node1, graph[node2][-1]-1, graph[node2]+1);
            df.remove(graph, "arr", node2, 1, graph[node2][-1]-1);
            nonempty_row -= 1;
            for(j = 1; j < graph[node1][-1]; ) {
                if(graph[node1][j] == node1+1) {
                    df.remove(graph, "elm", node1, j);
                }else j++;
            }
        }
        if (graph[node1][-1]-1 < min_cut) {
            min_cut = graph[node1][-1]-1;
        }
        df.copy(graph, origin_graph);
        nonempty_row = df.neptr(graph);
    }
    df.free(graph);
    return min_cut;
}

canonical_original_code:
int kargerMinCut(int **origin_graph)
{
    struct DATAFRAME_METHOD df = Dataframe;
    int **graph;
    int node1 = 0; int node2 = 0; int i; int j; int k; int m; int nrow; int min_cut;
    unsigned long nonempty_row;
    graph = df.init("copy", origin_graph);
    min_cut = graph[-1][1]-1;
    nonempty_row = df.neptr(graph);
    for (m = 0; m < 220000; m++) {
        srand((unsigned int)(m*time(0)));
        while(nonempty_row > 2) {
            k = rand()%(df.elmcnt(graph)-graph[-1][1]);
            k += 1;
            node1 = 0;
            while (1) {
                nrow = graph[node1][-1]-1;
                if (k > nrow) {
                    k -= nrow;
                    node1 += 1;
                }else break;
            }
            node2 = graph[node1][k]-1;
            for (i = 0; i < graph[-1][1]; i++) {
                for (j = 1; j < graph[i][-1]; j++) {
                    if (graph[i][j] == node2+1) {
                        graph[i][j] = node1+1;
                    }
                }
            }
            df.append(graph, "arr", node1, graph[node2][-1]-1, graph[node2]+1);
            df.remove(graph, "arr", node2, 1, graph[node2][-1]-1);
            nonempty_row -= 1;
            for(j = 1; j < graph[node1][-1]; ) {
                if(graph[node1][j] == node1+1) {
                    df.remove(graph, "elm", node1, j);
                }else j++;
            }
        }
        if (graph[node1][-1]-1 < min_cut) {
            min_cut = graph[node1][-1]-1;
        }
        df.copy(graph, origin_graph);
        nonempty_row = df.neptr(graph);
    }
    df.free(graph);
    return min_cut;
}

variable_types: struct DATAFRAME_METHOD { int **(*init)(char *arg, ...); void (*free)(int **df); void (*print)(int **df); int (*neptr)(int **df); int (*elmcnt)(int **df); void (*remove)(int **df, char *arg, ...); void (*append)(int **df, char *arg, ...); void (*copy)(int **dest, int **src); }

variable_types:
graph
int **

variable_types: j int

variable_types: k int

variable_types: m int

variable_types: nrow int


addToEdgeList

repo: FireArrow/traveling-salesman

decompiled_code:
__int64 __fastcall addToEdgeList(char *a1, __int64 a2)
{
int v2; // eax
__int64 result; // rax
int v4; // ecx
__int64 v5; // rax
__int64 v6; // rdx

v2 = *((_DWORD *)a1 + 1);
if ( v2 )
{
v4 = *((_DWORD *)a1 + 1);
if ( verbosity > 2 )
{
fprintf(stdout, "Adding another edge to node %c\n", (unsigned int)*a1);
v4 = *((_DWORD *)a1 + 1);
}
v5 = *((_QWORD *)a1 + 1);
do
{
v6 = v5;
v5 = *(_QWORD *)(v5 + 16);
}
while ( v5 );
*(_QWORD *)(v6 + 16) = a2;
result = (unsigned int)(v4 + 1);
*((_DWORD *)a1 + 1) = result;
}
else
{
if ( verbosity > 2 )
{
fprintf(stdout, "Setting first edge on %c\n", (unsigned int)*a1);
v2 = *((_DWORD *)a1 + 1);
}
result = (unsigned int)(v2 + 1);
*((_QWORD *)a1 + 1) = a2;
*((_DWORD *)a1 + 1) = result;
}
return result;
}

canonical_decompiled_code:
__int64 __fastcall func1(char *a1, __int64 a2)
{
int v2; // eax
__int64 result; // rax
int v4; // ecx
__int64 v5; // rax
__int64 v6; // rdx

v2 = *((_DWORD *)a1 + 1);
if ( v2 )
{
v4 = *((_DWORD *)a1 + 1);
if ( verbosity > 2 )
{
fprintf(stdout, "Adding another edge to node %c\n", (unsigned int)*a1);
v4 = *((_DWORD *)a1 + 1);
}
v5 = *((_QWORD *)a1 + 1);
do
{
v6 = v5;
v5 = *(_QWORD *)(v5 + 16);
}
while ( v5 );
*(_QWORD *)(v6 + 16) = a2;
result = (unsigned int)(v4 + 1);
*((_DWORD *)a1 + 1) = result;
}
else
{
if ( verbosity > 2 )
{
fprintf(stdout, "Setting first edge on %c\n", (unsigned int)*a1);
v2 = *((_DWORD *)a1 + 1);
}
result = (unsigned int)(v2 + 1);
*((_QWORD *)a1 + 1) = a2;
*((_DWORD *)a1 + 1) = result;
}
return result;
}

original_code:
void addToEdgeList(node * n, edge * e) {
 if(n->noEdges==0) {
  if(verbosity >= 3) fprintf(stdout,"Setting first edge on %c\n", n->id);
  n->edges = e;
 }
 else {
  if(verbosity >= 3) fprintf(stdout,"Adding another edge to node %c\n",n->id);
  edge * edgeptr = n->edges;
  while(edgeptr->next) edgeptr = edgeptr->next;
  edgeptr->next = e;
 }
 n->noEdges++;
}

canonical_original_code:
void addToEdgeList(struct struct_node *n, struct struct_edge *e) {
 if(n->noEdges==0) {
  if(verbosity >= 3) fprintf(stdout,"Setting first edge on %c\n", n->id);
  n->edges = e;
 }
 else {
  if(verbosity >= 3) fprintf(stdout,"Adding another edge to node %c\n",n->id);
  struct struct_edge *edgeptr = n->edges;
  while(edgeptr->next) edgeptr = edgeptr->next;
  edgeptr->next = e;
 }
 n->noEdges++;
}

variable_types: struct struct_node { char id; int noEdges; struct struct_edge { int id; int weight; struct struct_node *endpoint; struct struct_edge *next; } *edges; struct struct_node *next; } *

variable_types:
e
struct struct_edge *

variable_types: struct struct_edge { int id; int weight; struct struct_node { char id; int noEdges; struct struct_edge *edges; struct struct_node *next; } *endpoint; struct struct_edge *next; } *


addEdges

decompiled_code:
__int64 __fastcall addEdges(char *a1, char *a2, int a3)
{
_DWORD *v5; // rsi
int v6; // eax
_DWORD *v7; // rsi
int v8; // eax

v5 = malloc(0x18uLL);
v6 = edgeid;
v5[1] = a3;
*((_QWORD *)v5 + 1) = a2;
*v5 = v6;
*((_QWORD *)v5 + 2) = 0LL;
edgeid = v6 + 1;
addToEdgeList(a1, (__int64)v5);
v7 = malloc(0x18uLL);
v8 = edgeid;
v7[1] = a3;
*v7 = v8;
*((_QWORD *)v7 + 1) = a1;
*((_QWORD *)v7 + 2) = 0LL;
edgeid = v8 + 1;
return addToEdgeList(a2, (__int64)v7);
}

canonical_decompiled_code:
__int64 __fastcall func2(char *a1, char *a2, int a3)
{
_DWORD *v5; // rsi
int v6; // eax
_DWORD *v7; // rsi
int v8; // eax

v5 = malloc(0x18uLL);
v6 = edgeid;
v5[1] = a3;
*((_QWORD *)v5 + 1) = a2;
*v5 = v6;
*((_QWORD *)v5 + 2) = 0LL;
edgeid = v6 + 1;
func1(a1, (__int64)v5);
v7 = malloc(0x18uLL);
v8 = edgeid;
v7[1] = a3;
*v7 = v8;
*((_QWORD *)v7 + 1) = a1;
*((_QWORD *)v7 + 2) = 0LL;
edgeid = v8 + 1;
return func1(a2, (__int64)v7);
}

original_code:
void addEdges(node * endpoint1, node * endpoint2, int weight) {
 edge * e;
 e=(edge *)malloc(sizeof(edge));
 e->id = edgeid++;
 e->weight = weight;
 e->endpoint = endpoint2;
 e->next = ((void *)0);
 addToEdgeList(endpoint1, e);
 e=(edge *)malloc(sizeof(edge));
 e->id = edgeid++;
 e->weight = weight;
 e->endpoint = endpoint1;
 e->next = ((void *)0);
 addToEdgeList(endpoint2, e);
}

canonical_original_code:
void addEdges(struct struct_node *endpoint1, struct struct_node *endpoint2, int weight) {
 struct struct_edge *e;
 e=(struct struct_edge *)malloc(sizeof(edge));
 e->id = edgeid++;
 e->weight = weight;
 e->endpoint = endpoint2;
 e->next = ((void *)0);
 addToEdgeList(endpoint1, e);
 e=(struct struct_edge *)malloc(sizeof(edge));
 e->id = edgeid++;
 e->weight = weight;
 e->endpoint = endpoint1;
 e->next = ((void *)0);
 addToEdgeList(endpoint2, e);
}

variable_types: weight int

user_defined_types: struct struct_node { char id; int noEdges; struct struct_edge *edges; struct struct_node *next; }

user_defined_types: struct struct_edge { int id; int weight; struct struct_node *endpoint; struct struct_edge *next; }


listEdges

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

v1 = getNode(a1);
v2 = *((_QWORD *)v1 + 1);
printf("Node %c:", (unsigned int)*v1);
for ( ; v2; v2 = *(_QWORD *)(v2 + 16) )
printf(" %c-%d", (unsigned int)**(char **)(v2 + 8), *(unsigned int *)(v2 + 4));
return putchar(10);
}

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

v1 = func0(a1);
v2 = *((_QWORD *)v1 + 1);
printf("Node %c:", (unsigned int)*v1);
for ( ; v2; v2 = *(_QWORD *)(v2 + 16) )
printf(" %c-%d", (unsigned int)**(char **)(v2 + 8), *(unsigned int *)(v2 + 4));
return putchar(10);
}

original_code:
void listEdges(char cNode) {
 node * n = getNode(cNode);
 edge * curr = n->edges;
 printf("Node %c:",n->id);
 while(curr != ((void *)0)) {
  printf(" %c-%d",curr->endpoint->id,curr->weight);
  curr = curr->next;
 }
 printf("\n");
}

canonical_original_code:
void listEdges(char cNode) {
 struct struct_node *n = getNode(cNode);
 struct struct_edge *curr = n->edges;
 printf("Node %c:",n->id);
 while(curr != ((void *)0)) {
  printf(" %c-%d",curr->endpoint->id,curr->weight);
  curr = curr->next;
 }
 printf("\n");
}

variable_types: cNode char


removeNode

decompiled_code:
void __fastcall removeNode(void *ptr)
{
removeEdges(*((void **)ptr + 1));
free(ptr);
}

canonical_decompiled_code:
void __fastcall func5(void *ptr)
{
func4(*((void **)ptr + 1));
free(ptr);
}

original_code:
void removeNode(node * n) {
 removeEdges(n->edges);
 free(n);
}

canonical_original_code:
void removeNode(struct struct_node *n) {
 removeEdges(n->edges);
 free(n);
}


freeAllNodes

decompiled_code:
void __fastcall freeAllNodes(void *ptr)
{
char *v1; // rbx
char *v2; // rbp

if ( ptr )
{
v1 = (char *)ptr;
do
{
while ( 1 )
{
v2 = v1;
v1 = (char *)*((_QWORD *)v1 + 2);
if ( verbosity > 2 )
break;
removeNode(v2);
if ( !v1 )
return;
}
fprintf(stdout, "Freeing node %c - 0x%08x\n", (unsigned int)*v2, v2);
removeNode(v2);
}
while ( v1 );
}
}

canonical_decompiled_code:
void __fastcall func6(void *ptr)
{
char *v1; // rbx
char *v2; // rbp

if ( ptr )
{
v1 = (char *)ptr;
do
{
while ( 1 )
{
v2 = v1;
v1 = (char *)*((_QWORD *)v1 + 2);
if ( verbosity > 2 )
break;
func5(v2);
if ( !v1 )
return;
}
fprintf(stdout, "Freeing node %c - 0x%08x\n", (unsigned int)*v2, v2);
func5(v2);
}
while ( v1 );
}
}

original_code:
void freeAllNodes(node * start) {
 node * curr = start;
 node * next;
 while(curr != ((void *)0)) {
  next = curr->next;
  if(verbosity >= 3) fprintf(stdout,"Freeing node %c - 0x%08x\n",curr->id, curr);
  removeNode(curr);
  curr = next;
 }
}

canonical_original_code:
void freeAllNodes(struct struct_node *start) {
 struct struct_node *curr = start;
 struct struct_node *next;
 while(curr != ((void *)0)) {
  next = curr->next;
  if(verbosity >= 3) fprintf(stdout,"Freeing node %c - 0x%08x\n",curr->id, curr);
  removeNode(curr);
  curr = next;
 }
}


visit

decompiled_code:
__int64 __fastcall visit(char *a1, __int64 a2, unsigned int *a3)
{
int v4; // eax
__int64 v5; // rbx
int v6; // eax
unsigned int v7; // er12

if ( verbosity > 2 )
fprintf(stdout, "Visit: currNode: %c, noVisited: %d, noNodes: %d\n", (unsigned int)*a1, *a3, (unsigned int)noNodes);
v4 = *a3;
if ( (int)*a3 > noNodes )
return 0;
if ( v4 == noNodes )
{
if ( verbosity > 2 )
{
fwrite("Last node... ", 1uLL, 0xDuLL, stdout);
if ( (char *)entrypoint != a1 )
{
if ( verbosity <= 2 )
return 0;
v7 = 0;
fprintf(stdout, "%c isn't the goal. Failing\n", (unsigned int)*a1);
return v7;
}
if ( verbosity > 2 )
fprintf(stdout, "%c is the goal. Ok\n", (unsigned int)*a1);
}
else if ( (char *)entrypoint != a1 )
{
return 0;
}
++*a3;
return 1;
}
v5 = 0LL;
if ( v4 > 0 )
{
while ( 1 )
{
v6 = verbosity;
if ( verbosity <= 2 )
{
if ( *(char **)(a2 + 8 * v5) == a1 )
goto LABEL_12;
}
else
{
fprintf(stdout, "Comparing %c to %c... ", (unsigned int)*a1, (unsigned int)**(char **)(a2 + 8 * v5));
v6 = verbosity;
if ( *(char **)(a2 + 8 * v5) == a1 )
{
LABEL_12:
if ( v6 > 2 )
fwrite("match, can't visit again\n", 1uLL, 0x19uLL, stdout);
return 0;
}
}
if ( v6 > 2 )
{
++v5;
fwrite("no match\n", 1uLL, 9uLL, stdout);
v4 = *a3;
if ( (int)*a3 <= (int)v5 )
break;
}
else
{
v4 = *a3;
if ( (int)*a3 <= (int)++v5 )
break;
}
}
}
*(_QWORD *)(a2 + 8LL * v4) = a1;
v7 = 1;
*a3 = v4 + 1;
if ( verbosity > 2 )
fprintf(stdout, "%c haven't been visited yet\n", (unsigned int)*a1);
return v7;
}

canonical_decompiled_code:
__int64 __fastcall func7(char *a1, __int64 a2, unsigned int *a3)
{
int v4; // eax
__int64 v5; // rbx
int v6; // eax
unsigned int v7; // er12

if ( verbosity > 2 )
fprintf(stdout, "Visit: currNode: %c, noVisited: %d, noNodes: %d\n", (unsigned int)*a1, *a3, (unsigned int)noNodes);
v4 = *a3;
if ( (int)*a3 > noNodes )
return 0;
if ( v4 == noNodes )
{
if ( verbosity > 2 )
{
fwrite("Last node... ", 1uLL, 0xDuLL, stdout);
if ( (char *)entrypoint != a1 )
{
if ( verbosity <= 2 )
return 0;
v7 = 0;
fprintf(stdout, "%c isn't the goal. Failing\n", (unsigned int)*a1);
return v7;
}
if ( verbosity > 2 )
fprintf(stdout, "%c is the goal. Ok\n", (unsigned int)*a1);
}
else if ( (char *)entrypoint != a1 )
{
return 0;
}
++*a3;
return 1;
}
v5 = 0LL;
if ( v4 > 0 )
{
while ( 1 )
{
v6 = verbosity;
if ( verbosity <= 2 )
{
if ( *(char **)(a2 + 8 * v5) == a1 )
goto LABEL_12;
}
else
{
fprintf(stdout, "Comparing %c to %c... ", (unsigned int)*a1, (unsigned int)**(char **)(a2 + 8 * v5));
v6 = verbosity;
if ( *(char **)(a2 + 8 * v5) == a1 )
{
LABEL_12:
if ( v6 > 2 )
fwrite("match, can't visit again\n", 1uLL, 0x19uLL, stdout);
return 0;
}
}
if ( v6 > 2 )
{
++v5;
fwrite("no match\n", 1uLL, 9uLL, stdout);
v4 = *a3;
if ( (int)*a3 <= (int)v5 )
break;
}
else
{
v4 = *a3;
if ( (int)*a3 <= (int)++v5 )
break;
}
}
}
*(_QWORD *)(a2 + 8LL * v4) = a1;
v7 = 1;
*a3 = v4 + 1;
if ( verbosity > 2 )
fprintf(stdout, "%c haven't been visited yet\n", (unsigned int)*a1);
return v7;
}

original_code:
bool visit(node * currNode, node * visitedNodes[], int * noVisited) {
 if(verbosity >= 3) fprintf(stdout,"Visit: currNode: %c, noVisited: %d, noNodes: %d\n",currNode->id, *noVisited, noNodes);
 if(*noVisited > noNodes) {
  return 0;
 }
 if(*noVisited == noNodes) {
  if(verbosity >= 3) fprintf(stdout,"Last node... ");
  if(currNode == entrypoint) {
   if(verbosity >= 3) fprintf(stdout,"%c is the goal. Ok\n", currNode->id);
   (*noVisited)++;
   return 1;
  }
  else {
   if(verbosity >= 3) fprintf(stdout,"%c isn't the goal. Failing\n", currNode->id);
   return 0;
  }
 }
 else {
  for(int i=0;i<*noVisited;i++) {
   if(verbosity >= 3) fprintf(stdout,"Comparing %c to %c... ", currNode->id, visitedNodes[i]->id);
   if(currNode == visitedNodes[i]) {
    if(verbosity >= 3) fprintf(stdout,"match, can't visit again\n");
    return 0;
   }
   if(verbosity >= 3) fprintf(stdout,"no match\n");
  }
  visitedNodes[*noVisited] = currNode;
  (*noVisited)++;
  if(verbosity >= 3) fprintf(stdout,"%c haven't been visited yet\n",currNode->id);
  return 1;
 }
 if(verbosity >= 0) fprintf(stdout,"Reached end of visit(). This shouldn't be possible!\n");
 return 0;
}

canonical_original_code:
char visit(struct struct_node *currNode, struct struct_node *visitedNodes[], int *noVisited) {
 if(verbosity >= 3) fprintf(stdout,"Visit: currNode: %c, noVisited: %d, noNodes: %d\n",currNode->id, *noVisited, noNodes);
 if(*noVisited > noNodes) {
  return 0;
 }
 if(*noVisited == noNodes) {
  if(verbosity >= 3) fprintf(stdout,"Last node... ");
  if(currNode == entrypoint) {
   if(verbosity >= 3) fprintf(stdout,"%c is the goal. Ok\n", currNode->id);
   (*noVisited)++;
   return 1;
  }
  else {
   if(verbosity >= 3) fprintf(stdout,"%c isn't the goal. Failing\n", currNode->id);
   return 0;
  }
 }
 else {
  for(int i = 0;i<*noVisited;i++) {
   if(verbosity >= 3) fprintf(stdout,"Comparing %c to %c... ", currNode->id, visitedNodes[i]->id);
   if(currNode == visitedNodes[i]) {
    if(verbosity >= 3) fprintf(stdout,"match, can't visit again\n");
    return 0;
   }
   if(verbosity >= 3) fprintf(stdout,"no match\n");
  }
  visitedNodes[*noVisited] = currNode;
  (*noVisited)++;
  if(verbosity >= 3) fprintf(stdout,"%c haven't been visited yet\n",currNode->id);
  return 1;
 }
 if(verbosity >= 0) fprintf(stdout,"Reached end of visit(). This shouldn't be possible!\n");
 return 0;
}

variable_types:
visitedNodes
struct struct_node *[]

variable_types:
noVisited
int *

variable_types: i int

return_type: char


insideTravelGraph

original_code:
int insideTravelGraph(node * visitedNodes[], int noVisited, int costSoFar, node * currNode, node * solution[]) {
 if(visit(currNode, visitedNodes, &noVisited)) {
  if(noVisited > noNodes) {
   return costSoFar;
  }
  else {
   edge * bestPath = ((void *)0);
   edge * e = currNode->edges;
   edge * edges[currNode->noEdges];
   for(int i=0;i<currNode->noEdges;i++) {
    edges[i] = e;
    e=e->next;
   }
   for(int i=0;i<currNode->noEdges;i++) {
    int thisPathCost = insideTravelGraph(visitedNodes, noVisited, costSoFar+edges[i]->weight, edges[i]->endpoint, solution);
    if(thisPathCost >= 0) {
     if(bestPathCost < 0 || thisPathCost <= bestPathCost) {
      bestPathCost = thisPathCost;
      bestPath = edges[i];
     }
    }
   }
   if(bestPath != ((void *)0)) {
    solution[noVisited] = bestPath->endpoint;
    return bestPathCost;
   }
  }
 }
 return -1;
}

canonical_original_code:
int insideTravelGraph(struct struct_node *visitedNodes[], int noVisited, int costSoFar, struct struct_node *currNode, struct struct_node *solution[]) {
 if(visit(currNode, visitedNodes, &noVisited)) {
  if(noVisited > noNodes) {
   return costSoFar;
  }
  else {
   struct struct_edge *bestPath = ((void *)0);
   struct struct_edge *e = currNode->edges;
   struct struct_edge *edges[-1];
   for(int i = 0;i<currNode->noEdges;i++) {
    edges[i] = e;
    e=e->next;
   }
   for(int i = 0;i<currNode->noEdges;i++) {
    int thisPathCost = insideTravelGraph(visitedNodes, noVisited, costSoFar+edges[i]->weight, edges[i]->endpoint, solution);
    if(thisPathCost >= 0) {
     if(bestPathCost < 0 || thisPathCost <= bestPathCost) {
      bestPathCost = thisPathCost;
      bestPath = edges[i];
     }
    }
   }
   if(bestPath != ((void *)0)) {
    solution[noVisited] = bestPath->endpoint;
    return bestPathCost;
   }
  }
 }
 return -1;
}

variable_types: struct struct_node { char id; int noEdges; struct struct_edge { int id; int weight; struct struct_node *endpoint; struct struct_edge *next; } *edges; struct struct_node *next; } *[]

variable_types: noVisited int

variable_types: costSoFar int

variable_types:
currNode
struct struct_node *

variable_types:
solution
struct struct_node *[]

variable_types: struct struct_edge { int id; int weight; struct struct_node { char id; int noEdges; struct struct_edge *edges; struct struct_node *next; } *endpoint; struct struct_edge *next; } *[-1]

variable_types: thisPathCost int


travelGraph

decompiled_code:
__int64 travelGraph()
{
signed __int64 v0; // rax
void *v1; // rsp
void *v2; // rsp
_BYTE *v3; // rdi
unsigned int v4; // er13
int v5; // edx
int v6; // eax
__int64 v7; // rbx
__int64 result; // rax
_BYTE v9[7]; // [rsp+0h] [rbp-20h] BYREF
char v10; // [rsp+7h] [rbp-19h] BYREF

v0 = 8LL * (noNodes + 1);
v1 = alloca(v0);
v2 = alloca(v0 & 0xFFFFFFFFFFFFFFF0LL);
v3 = v9;
if ( noNodes > 0 )
v3 = memset(v9, 0, 8LL * noNodes);
v4 = insideTravelGraph((__int64)v3, 0, 0, entrypoint, (__int64)v9);
if ( (v4 & 0x80000000) != 0 )
{
if ( verbosity < 0 )
return v4;
fwrite("Graph unsolvable :(\n", 1uLL, 0x14uLL, stdout);
result = v4;
}
else
{
v5 = noNodes;
*(_QWORD *)(8 * ((unsigned __int64)&v10 >> 3)) = entrypoint;
v6 = verbosity;
if ( v5 >= 0 )
{
v7 = 0LL;
do
{
if ( v6 >= 0 )
{
fprintf(stdout, " %c", (unsigned int)**(char **)&v9[8 * v7]);
v6 = verbosity;
}
++v7;
}
while ( noNodes >= (int)v7 );
}
if ( v6 < 0 )
return v4;
fprintf(stdout, ": %d\n", v4);
result = v4;
}
return result;
}

canonical_decompiled_code:
__int64 func9()
{
signed __int64 v0; // rax
void *v1; // rsp
void *v2; // rsp
_BYTE *v3; // rdi
unsigned int v4; // er13
int v5; // edx
int v6; // eax
__int64 v7; // rbx
__int64 result; // rax
_BYTE v9[7]; // [rsp+0h] [rbp-20h] BYREF
char v10; // [rsp+7h] [rbp-19h] BYREF

v0 = 8LL * (noNodes + 1);
v1 = alloca(v0);
v2 = alloca(v0 & 0xFFFFFFFFFFFFFFF0LL);
v3 = v9;
if ( noNodes > 0 )
v3 = memset(v9, 0, 8LL * noNodes);
v4 = func8((__int64)v3, 0, 0, entrypoint, (__int64)v9);
if ( (v4 & 0x80000000) != 0 )
{
if ( verbosity < 0 )
return v4;
fwrite("Graph unsolvable :(\n", 1uLL, 0x14uLL, stdout);
result = v4;
}
else
{
v5 = noNodes;
*(_QWORD *)(8 * ((unsigned __int64)&v10 >> 3)) = entrypoint;
v6 = verbosity;
if ( v5 >= 0 )
{
v7 = 0LL;
do
{
if ( v6 >= 0 )
{
fprintf(stdout, " %c", (unsigned int)**(char **)&v9[8 * v7]);
v6 = verbosity;
}
++v7;
}
while ( noNodes >= (int)v7 );
}
if ( v6 < 0 )
return v4;
fprintf(stdout, ": %d\n", v4);
result = v4;
}
return result;
}

original_code:
int travelGraph() {
 node * solution[noNodes+1];
 node * visitedNodes[noNodes];
 int shortestPath = -1;
 for(int i=0;i<noNodes;i++) {
  visitedNodes[i] = 0;
 }
 shortestPath = insideTravelGraph(visitedNodes, 0, 0, entrypoint, solution);
 if(shortestPath >= 0) {
  solution[0] = entrypoint;
  for(int i=0;i<=noNodes;i++) {
   if(verbosity >= 0) fprintf(stdout," %c", solution[i]->id);
  }
  if(verbosity >= 0) fprintf(stdout,": %d\n",shortestPath);
 }
 else {
  if(verbosity >= 0) fprintf(stdout,"Graph unsolvable :(\n");
 }
 return shortestPath;
}

canonical_original_code:
int travelGraph() {
 struct struct_node *solution[-1];
 struct struct_node *visitedNodes[-1];
 int shortestPath = -1;
 for(int i = 0;i<noNodes;i++) {
  visitedNodes[i] = 0;
 }
 shortestPath = insideTravelGraph(visitedNodes, 0, 0, entrypoint, solution);
 if(shortestPath >= 0) {
  solution[0] = entrypoint;
  for(int i = 0;i<=noNodes;i++) {
   if(verbosity >= 0) fprintf(stdout," %c", solution[i]->id);
  }
  if(verbosity >= 0) fprintf(stdout,": %d\n",shortestPath);
 }
 else {
  if(verbosity >= 0) fprintf(stdout,"Graph unsolvable :(\n");
 }
 return shortestPath;
}

variable_types: struct struct_node { char id; int noEdges; struct struct_edge { int id; int weight; struct struct_node *endpoint; struct struct_edge *next; } *edges; struct struct_node *next; } *[-1]

variable_types: shortestPath int


printHelp

decompiled_code:
void __fastcall __noreturn printHelp(int status)
{
puts("Here be help some day, maybe");
exit(status);
}

canonical_decompiled_code:
void __fastcall __noreturn func11(int status)
{
puts("Here be help some day, maybe");
exit(status);
}

original_code:
void printHelp(int status) {
 printf("Here be help some day, maybe\n");
 exit(status);
}

variable_types: status int


setVerbosity

decompiled_code:
size_t __fastcall setVerbosity(int a1)
{
size_t result; // rax

result = (unsigned int)verbosity;
if ( verbosity == 1 )
{
verbosity = a1;
}
else if ( verbosity > 0 )
{
result = fwrite("Verbosity already set. Ignoring\n", 1uLL, 0x20uLL, stdout);
}
return result;
}

canonical_decompiled_code:
size_t __fastcall func12(int a1)
{
size_t result; // rax

result = (unsigned int)verbosity;
if ( verbosity == 1 )
{
verbosity = a1;
}
else if ( verbosity > 0 )
{
result = fwrite("Verbosity already set. Ignoring\n", 1uLL, 0x20uLL, stdout);
}
return result;
}

original_code:
void setVerbosity(int level) {
 if(verbosity == 1)
  verbosity=level;
 else
  if(verbosity >= 1) fprintf(stdout,"Verbosity already set. Ignoring\n");
}

variable_types: level int


main

decompiled_code:
// local variable allocation has failed, the output may be wrong!
int __cdecl main(int argc, const char **argv, const char **envp)
{
const char **v3; // rbp
const char **v4; // r12
const char *v5; // rdx
FILE *v6; // rdi
char v8; // al
__int64 v9; // rbx
char v10; // r13
int *v11; // rax
int *v12; // rbx
char *v13; // rax

if ( argc > 1 )
{
v3 = argv + 1;
v4 = &argv[(unsigned int)(argc - 2) + 2];
do
{
while ( 1 )
{
v5 = *v3;
*(_QWORD *)&argc = *v3;
if ( **v3 == 45 )
break;
if ( first )
{
if ( verbosity > 0 )
{
*(_QWORD *)&argc = stdout;
argv = (const char **)"Only one file can be supplied per run.\n Ignoring %s\n";
fprintf(stdout, "Only one file can be supplied per run.\n Ignoring %s\n", v5);
}
goto LABEL_5;
}
if ( verbosity > 1 )
{
fprintf(stdout, "Trying to read file %s... ", v5);
*(_QWORD *)&argc = *v3;
}
argv = (const char **)"r";
graphFile = fopen(*(const char **)&argc, "r");
v6 = graphFile;
if ( !graphFile )
{
if ( verbosity > 1 )
fwrite("failed\n", 1uLL, 7uLL, stdout);
v11 = _errno_location();
v12 = v11;
if ( verbosity >= 0 )
{
v13 = strerror(*v11);
fprintf(stdout, "Failed to open %s: %s\n", *v3, v13);
}
exit(*v12);
}
if ( verbosity > 1 )
{
argv = (const char **)(newNode + 1);
fwrite("done\n", 1uLL, 5uLL, stdout);
v6 = graphFile;
}
parseGraphFile(v6);
if ( verbosity > 2 )
{
argv = (const char **)(newNode + 1);
fwrite("Done parsing graph\n", 1uLL, 0x13uLL, stdout);
}
*(_QWORD *)&argc = graphFile;
++v3;
fclose(graphFile);
if ( v4 == v3 )
goto LABEL_16;
}
v8 = v5[1];
if ( !v8 )
goto LABEL_5;
v9 = 2LL;
v10 = 1;
while ( 1 )
{
if ( v8 == 115 )
{
*(_QWORD *)&argc = 0LL;
setVerbosity(0);
goto LABEL_25;
}
if ( v8 > 115 )
break;
if ( v8 == 100 )
{
*(_QWORD *)&argc = 3LL;
setVerbosity(3);
if ( verbosity > 2 )
{
argv = (const char **)(newNode + 1);
*(_QWORD *)&argc = "Setting verbosity to debug\n";
fwrite("Setting verbosity to debug\n", 1uLL, 0x1BuLL, stdout);
}
LABEL_25:
v5 = *v3;
v8 = (*v3)[v9];
if ( !v8 )
goto LABEL_31;
goto LABEL_26;
}
if ( v8 == 104 )
printHelp(0);
LABEL_34:
if ( verbosity >= 0 )
{
argv = (const char **)"Unknown parameter -%c\n";
fprintf(stdout, "Unknown parameter -%c\n", (unsigned int)v5[v9]);
v5 = *v3;
}
v8 = v5[v9];
if ( !v8 )
goto LABEL_32;
v10 = 0;
LABEL_26:
++v9;
}
if ( v8 != 118 )
goto LABEL_34;
*(_QWORD *)&argc = 2LL;
setVerbosity(2);
v5 = *v3;
v8 = (*v3)[v9];
if ( v8 )
goto LABEL_26;
LABEL_31:
if ( !v10 )
LABEL_32:
printHelp(1);
LABEL_5:
++v3;
}
while ( v4 != v3 );
}
LABEL_16:
if ( !entrypoint )
{
if ( verbosity >= 0 )
fwrite("No graph file found (or reading it failed)\n", 1uLL, 0x2BuLL, stdout);
printHelp(2);
}
if ( verbosity > 1 )
{
*(_QWORD *)&argc = stdout;
argv = (const char **)"Traveling graph from %c:\n";
fprintf(stdout, "Traveling graph from %c:\n", (unsigned int)*(char *)entrypoint);
}
travelGraph(*(_QWORD *)&argc, argv);
freeAllNodes(first);
return 0;
}

canonical_decompiled_code:
int __cdecl main(int argc, const char **argv, const char **envp)
{
const char **v3; // rbp
const char **v4; // r12
const char *v5; // rdx
FILE *v6; // rdi
char v8; // al
__int64 v9; // rbx
char v10; // r13
int *v11; // rax
int *v12; // rbx
char *v13; // rax

if ( argc > 1 )
{
v3 = argv + 1;
v4 = &argv[(unsigned int)(argc - 2) + 2];
do
{
while ( 1 )
{
v5 = *v3;
*(_QWORD *)&argc = *v3;
if ( **v3 == 45 )
break;
if ( first )
{
if ( verbosity > 0 )
{
*(_QWORD *)&argc = stdout;
argv = (const char **)"Only one file can be supplied per run.\n Ignoring %s\n";
fprintf(stdout, "Only one file can be supplied per run.\n Ignoring %s\n", v5);
}
goto LABEL_5;
}
if ( verbosity > 1 )
{
fprintf(stdout, "Trying to read file %s... ", v5);
*(_QWORD *)&argc = *v3;
}
argv = (const char **)"r";
graphFile = fopen(*(const char **)&argc, "r");
v6 = graphFile;
if ( !graphFile )
{
if ( verbosity > 1 )
fwrite("failed\n", 1uLL, 7uLL, stdout);
v11 = _errno_location();
v12 = v11;
if ( verbosity >= 0 )
{
v13 = strerror(*v11);
fprintf(stdout, "Failed to open %s: %s\n", *v3, v13);
}
exit(*v12);
}
if ( verbosity > 1 )
{
argv = (const char **)(newNode + 1);
fwrite("done\n", 1uLL, 5uLL, stdout);
v6 = graphFile;
}
func10(v6);
if ( verbosity > 2 )
{
argv = (const char **)(newNode + 1);
fwrite("Done parsing graph\n", 1uLL, 0x13uLL, stdout);
}
*(_QWORD *)&argc = graphFile;
++v3;
fclose(graphFile);
if ( v4 == v3 )
goto LABEL_16;
}
v8 = v5[1];
if ( !v8 )
goto LABEL_5;
v9 = 2LL;
v10 = 1;
while ( 1 )
{
if ( v8 == 115 )
{
*(_QWORD *)&argc = 0LL;
func12(0);
goto LABEL_25;
}
if ( v8 > 115 )
break;
if ( v8 == 100 )
{
*(_QWORD *)&argc = 3LL;
func12(3);
if ( verbosity > 2 )
{
argv = (const char **)(newNode + 1);
*(_QWORD *)&argc = "Setting verbosity to debug\n";
fwrite("Setting verbosity to debug\n", 1uLL, 0x1BuLL, stdout);
}
LABEL_25:
v5 = *v3;
v8 = (*v3)[v9];
if ( !v8 )
goto LABEL_31;
goto LABEL_26;
}
if ( v8 == 104 )
func11(0);
LABEL_34:
if ( verbosity >= 0 )
{
argv = (const char **)"Unknown parameter -%c\n";
fprintf(stdout, "Unknown parameter -%c\n", (unsigned int)v5[v9]);
v5 = *v3;
}
v8 = v5[v9];
if ( !v8 )
goto LABEL_32;
v10 = 0;
LABEL_26:
++v9;
}
if ( v8 != 118 )
goto LABEL_34;
*(_QWORD *)&argc = 2LL;
func12(2);
v5 = *v3;
v8 = (*v3)[v9];
if ( v8 )
goto LABEL_26;
LABEL_31:
if ( !v10 )
LABEL_32:
func11(1);
LABEL_5:
++v3;
}
while ( v4 != v3 );
}
LABEL_16:
if ( !entrypoint )
{
if ( verbosity >= 0 )
fwrite("No graph file found (or reading it failed)\n", 1uLL, 0x2BuLL, stdout);
func11(2);
}
if ( verbosity > 1 )
{
*(_QWORD *)&argc = stdout;
argv = (const char **)"Traveling graph from %c:\n";
fprintf(stdout, "Traveling graph from %c:\n", (unsigned int)*(char *)entrypoint);
}
func9(*(_QWORD *)&argc, argv);
func6(first);
return 0;
}

original_code:
int main(int argc, char* argv[]) {
 bool correctInput=1;
 for(int i=1;i<argc;++i) {
  if(argv[i][0] == '-') {
   int j=1;
   while(argv[i][j] != '\0') {
    switch(argv[i][j++]) {
     case 'h': printHelp(0);
         break;
     case 'v': setVerbosity(2);
         break;
     case 'd': setVerbosity(3);
         if(verbosity >= 3) fprintf(stdout,"Setting verbosity to debug\n");
         break;
     case 's': setVerbosity(0);
         break;
     default: correctInput = 0;
         if(verbosity >= 0) fprintf(stdout,"Unknown parameter -%c\n",argv[i][j]);
         break;
    }
   }
  }
  else {
   if(first == ((void *)0)) {
    if(verbosity >= 2) fprintf(stdout,"Trying to read file %s... ",argv[i]);
    graphFile = fopen(argv[i], "r");
    if(graphFile == ((void *)0)) {
     if(verbosity >= 2) fprintf(stdout,"failed\n");
     if(verbosity >= 0) fprintf(stdout,"Failed to open %s: %s\n",argv[i], strerror((*__errno_location ())));
     exit((*__errno_location ()));
    }
    else {
     if(verbosity >= 2) fprintf(stdout,"done\n");
     parseGraphFile(graphFile);
     if(verbosity >= 3) fprintf(stdout,"Done parsing graph\n");
     fclose(graphFile);
    }
   }
   else {
    if(verbosity >= 1) fprintf(stdout,"Only one file can be supplied per run.\n Ignoring %s\n",argv[i]);
   }
  }
  if(!correctInput) {
   printHelp(1);
  }
 }
 if(entrypoint != ((void *)0)) {
  if(verbosity >= 2) fprintf(stdout,"Traveling graph from %c:\n", entrypoint->id);
  travelGraph();
 }
 else {
  if(verbosity >= 0) fprintf(stdout,"No graph file found (or reading it failed)\n");
  printHelp(2);
 }
 freeAllNodes(first);
 return 0;
}

canonical_original_code:
int main(int argc, char *argv[]) {
 char correctInput = 1;
 for(int i = 1;i<argc;++i) {
  if(argv[i][0] == '-') {
   int j = 1;
   while(argv[i][j] != '\0') {
    switch(argv[i][j++]) {
     case 'h': printHelp(0);
         break;
     case 'v': setVerbosity(2);
         break;
     case 'd': setVerbosity(3);
         if(verbosity >= 3) fprintf(stdout,"Setting verbosity to debug\n");
         break;
     case 's': setVerbosity(0);
         break;
     default: correctInput = 0;
         if(verbosity >= 0) fprintf(stdout,"Unknown parameter -%c\n",argv[i][j]);
         break;
    }
   }
  }
  else {
   if(first == ((void *)0)) {
    if(verbosity >= 2) fprintf(stdout,"Trying to read file %s... ",argv[i]);
    graphFile = fopen(argv[i], "r");
    if(graphFile == ((void *)0)) {
     if(verbosity >= 2) fprintf(stdout,"failed\n");
     if(verbosity >= 0) fprintf(stdout,"Failed to open %s: %s\n",argv[i], strerror((*__errno_location ())));
     exit((*__errno_location ()));
    }
    else {
     if(verbosity >= 2) fprintf(stdout,"done\n");
     parseGraphFile(graphFile);
     if(verbosity >= 3) fprintf(stdout,"Done parsing graph\n");
     fclose(graphFile);
    }
   }
   else {
    if(verbosity >= 1) fprintf(stdout,"Only one file can be supplied per run.\n Ignoring %s\n",argv[i]);
   }
  }
  if(!correctInput) {
   printHelp(1);
  }
 }
 if(entrypoint != ((void *)0)) {
  if(verbosity >= 2) fprintf(stdout,"Traveling graph from %c:\n", entrypoint->id);
  travelGraph();
 }
 else {
  if(verbosity >= 0) fprintf(stdout,"No graph file found (or reading it failed)\n");
  printHelp(2);
 }
 freeAllNodes(first);
 return 0;
}

variable_types: argc int

variable_types:
argv
char *[]

variable_types: correctInput char

variable_types: j int