decompiled_code:
__int64 __fastcall go_controller_undo(int *a1)
{
char v2[136]; // [rsp+0h] [rbp-88h] BYREF

return get_response("undo", v2, 0x80uLL, a1);
}

canonical_decompiled_code:
__int64 __fastcall func17(int *a1)
{
char v2[136]; // [rsp+0h] [rbp-88h] BYREF

return func14("undo", v2, 0x80uLL, a1);
}

original_code:
int go_controller_undo(go_controller_context* context) {
  const size_t buf_size = 128;
  char response_buf[buf_size];
  int err;
  err = get_response("undo", response_buf, buf_size, context);
  return err;
}

canonical_original_code:
int go_controller_undo(struct go_controller_context *context) {
  unsigned long buf_size = 128;
  char response_buf[-1];
  int err;
  err = get_response("undo", response_buf, buf_size, context);
  return err;
}


main

canonical_name: main

decompiled_code:
int __cdecl main(int argc, const char **argv, const char **envp)
{
unsigned int v3; // eax
__int64 v4; // r13
int v5; // er15
int v6; // er14
int i; // er12
unsigned __int64 v8; // rdx
__int64 v9; // rbx
unsigned __int64 v10; // rbp
_BYTE *v11; // rbp
char v12; // si
std::ostream *v13; // rax
__int64 (__fastcall *v15)(); // rax
int v16; // eax
__int64 v17[11]; // [rsp+10h] [rbp-58h] BYREF

v3 = time(0LL);
srand(v3);
`anonymous namespace'::read_text((_anonymous_namespace_ *)v17, argv[1]);
if ( argc > 2 )
{
v16 = strtol(argv[2], 0LL, 10);
v5 = v16;
if ( argc == 3 )
{
v4 = v16;
v6 = 100;
}
else
{
v4 = v16;
v6 = strtol(argv[3], 0LL, 10);
if ( v6 <= 0 )
goto LABEL_11;
}
}
else
{
v4 = 5LL;
v5 = 5;
v6 = 100;
}
for ( i = 0; i < v6; ++i )
{
v8 = rand() % (unsigned __int64)(v17[1] - v4);
if ( (int)v8 < v5 + (int)v8 )
{
v9 = (int)v8;
v10 = (int)v8 + (unsigned __int64)(unsigned int)(~(_DWORD)v8 + v5 + v8) + 1;
do
{
std::__ostream_insert<char,std::char_traits<char>>();
++v9;
}
while ( v10 != v9 );
}
v11 = *(_BYTE **)((char *)&qword_4041F0 + *(_QWORD *)(std::cout[0] - 24LL));
if ( !v11 )
std::__throw_bad_cast();
if ( v11[56] )
{
v12 = v11[67];
}
else
{
std::ctype<char>::_M_widen_init();
v12 = 10;
v15 = *(__int64 (__fastcall **)())(*(_QWORD *)v11 + 48LL);
if ( v15 != std::ctype<char>::do_widen )
v12 = ((__int64 (__fastcall *)(_BYTE *, __int64))v15)(v11, 10LL);
}
v13 = (std::ostream *)std::ostream::put((std::ostream *)std::cout, v12);
std::ostream::flush(v13);
}
LABEL_11:
std::__cxx11::basic_string<char,std::char_traits<char>,std::allocator<char>>::_M_dispose();
return 0;
}

original_code:
int main( int argc, char *argv[])
{
 int opt;
 double ps_bb[4];
 int got_bb;
 myname = argv[0];
 while ((opt = getopt( argc, argv, "vfi:c:w:m:p:s:o:")) != (-1))
 { switch( opt)
  { case 'v': verbose++; break;
    case 'f': manualfeed = 1; break;
    case 'i': imagespec = optarg; break;
    case 'c': cutmarginspec = optarg; break;
    case 'w': whitemarginspec = optarg; break;
    case 'm': mediaspec = optarg; break;
    case 'p': posterspec = optarg; break;
    case 's': scalespec = optarg; break;
    case 'o': filespec = optarg; break;
    default: usage(); break;
  }
 }
 if (scalespec && posterspec)
 { fprintf( stderr, "Please don't specify both -s and -o, ignoring -s!\n");
  scalespec = ((void *)0);
 }
 if (optind < argc)
  infile = argv[ optind];
 else
 { fprintf( stderr, "Filename argument missing!\n");
  usage();
 }
 if (!mediaspec)
 { mediaspec = "A4";
  if (verbose)
   fprintf( stderr,
    "Using default media of %s\n",
    mediaspec);
 }
 box_convert( mediaspec, mediasize);
 if (mediasize[3] < mediasize[2])
 { fprintf( stderr, "Media should always be specified in portrait format!\n");
  exit(1);
 }
 if (mediasize[2]-mediasize[0] <= 10.0 || mediasize[3]-mediasize[1] <= 10.0)
 { fprintf( stderr, "Media size is ridiculous!\n");
  exit(1);
 }
 if (!scalespec && !posterspec)
 {
  posterspec = mediaspec;
  if (verbose)
   fprintf( stderr,
    "Defaulting poster size to media size of %s\n",
    mediaspec);
 }
 if (!cutmarginspec)
 {
          cutmarginspec = "5%";
  if (verbose)
   fprintf( stderr,
    "Using default cutmargin of %s\n",
    cutmarginspec);
 }
 margin_convert( cutmarginspec, cutmargin);
 if (!whitemarginspec)
 { whitemarginspec = "0";
  if (verbose)
   fprintf( stderr,
    "Using default whitemargin of %s\n",
    whitemarginspec);
 }
 margin_convert( whitemarginspec, whitemargin);
 if (filespec)
 { if (!freopen( filespec, "w", stdout))
  { fprintf( stderr, "Cannot open '%s' for writing!\n",
     filespec);
   exit(1);
  } else if (verbose)
   fprintf( stderr, "Opened '%s' for writing\n",
     filespec);
 }
 dsc_head1();
 got_bb = dsc_infile( ps_bb);
 if (!got_bb && !imagespec)
 { imagespec = "A4";
  if (verbose)
   fprintf( stderr,
    "Using default input image of %s\n",
    imagespec);
 }
 if (imagespec)
  box_convert( imagespec, imagebb);
 else
 { int i;
  for (i=0; i<4; i++)
   imagebb[i] = ps_bb[i];
 }
 if (verbose > 1)
  fprintf( stderr, "   Input image is: [%g,%g,%g,%g]\n",
   imagebb[0], imagebb[1], imagebb[2], imagebb[3]);
 if (imagebb[2]-imagebb[0] <= 0.0 || imagebb[3]-imagebb[1] <= 0.0)
 { fprintf( stderr, "Input image should have positive size!\n");
  exit(1);
 }
 postersize( scalespec, posterspec);
 if (verbose > 1)
  fprintf( stderr, "   Output image is: [%g,%g,%g,%g]\n",
   posterbb[0], posterbb[1], posterbb[2], posterbb[3]);
 dsc_head2();
 printposter();
 exit (0);
}

canonical_original_code:
int main(int argc, char *argv[])
{
 int opt;
 double ps_bb[4];
 int got_bb;
 myname = argv[0];
 while ((opt = getopt( argc, argv, "vfi:c:w:m:p:s:o:")) != (-1))
 { switch( opt)
  { case 'v': verbose++; break;
    case 'f': manualfeed = 1; break;
    case 'i': imagespec = optarg; break;
    case 'c': cutmarginspec = optarg; break;
    case 'w': whitemarginspec = optarg; break;
    case 'm': mediaspec = optarg; break;
    case 'p': posterspec = optarg; break;
    case 's': scalespec = optarg; break;
    case 'o': filespec = optarg; break;
    default: usage(); break;
  }
 }
 if (scalespec && posterspec)
 { fprintf( stderr, "Please don't specify both -s and -o, ignoring -s!\n");
  scalespec = ((void *)0);
 }
 if (optind < argc)
  infile = argv[ optind];
 else
 { fprintf( stderr, "Filename argument missing!\n");
  usage();
 }
 if (!mediaspec)
 { mediaspec = "A4";
  if (verbose)
   fprintf( stderr,
    "Using default media of %s\n",
    mediaspec);
 }
 box_convert( mediaspec, mediasize);
 if (mediasize[3] < mediasize[2])
 { fprintf( stderr, "Media should always be specified in portrait format!\n");
  exit(1);
 }
 if (mediasize[2]-mediasize[0] <= 10.0 || mediasize[3]-mediasize[1] <= 10.0)
 { fprintf( stderr, "Media size is ridiculous!\n");
  exit(1);
 }
 if (!scalespec && !posterspec)
 {
  posterspec = mediaspec;
  if (verbose)
   fprintf( stderr,
    "Defaulting poster size to media size of %s\n",
    mediaspec);
 }
 if (!cutmarginspec)
 {
          cutmarginspec = "5%";
  if (verbose)
   fprintf( stderr,
    "Using default cutmargin of %s\n",
    cutmarginspec);
 }
 margin_convert( cutmarginspec, cutmargin);
 if (!whitemarginspec)
 { whitemarginspec = "0";
  if (verbose)
   fprintf( stderr,
    "Using default whitemargin of %s\n",
    whitemarginspec);
 }
 margin_convert( whitemarginspec, whitemargin);
 if (filespec)
 { if (!freopen( filespec, "w", stdout))
  { fprintf( stderr, "Cannot open '%s' for writing!\n",
     filespec);
   exit(1);
  } else if (verbose)
   fprintf( stderr, "Opened '%s' for writing\n",
     filespec);
 }
 dsc_head1();
 got_bb = dsc_infile( ps_bb);
 if (!got_bb && !imagespec)
 { imagespec = "A4";
  if (verbose)
   fprintf( stderr,
    "Using default input image of %s\n",
    imagespec);
 }
 if (imagespec)
  box_convert( imagespec, imagebb);
 else
 { int i;
  for (i=0; i<4; i++)
   imagebb[i] = ps_bb[i];
 }
 if (verbose > 1)
  fprintf( stderr, "   Input image is: [%g,%g,%g,%g]\n",
   imagebb[0], imagebb[1], imagebb[2], imagebb[3]);
 if (imagebb[2]-imagebb[0] <= 0.0 || imagebb[3]-imagebb[1] <= 0.0)
 { fprintf( stderr, "Input image should have positive size!\n");
  exit(1);
 }
 postersize( scalespec, posterspec);
 if (verbose > 1)
  fprintf( stderr, "   Output image is: [%g,%g,%g,%g]\n",
   posterbb[0], posterbb[1], posterbb[2], posterbb[3]);
 dsc_head2();
 printposter();
 exit (0);
}

variable_types: argc int

variable_types:
argv
char *[]

variable_types: opt int

variable_types: i int

return_type: int


cbFree

repo: ahmedlogic/vipcw-spectrogram

decompiled_code:
void __fastcall cbFree(__int64 a1)
{
free(*(void **)(a1 + 16));
}

canonical_decompiled_code:
void __fastcall func7(__int64 a1)
{
free(*(void **)(a1 + 16));
}

original_code:
void cbFree(CircularBuffer *cb) {
    free(cb->fbuffer); }

canonical_original_code:
void cbFree(struct CircularBuffer *cb) {
    free(cb->fbuffer); }

variable_types: struct CircularBuffer { int size; int start; int count; float *fbuffer; } *

return_type: void


cbInit

decompiled_code:
void *__fastcall cbInit(__int64 a1, int a2)
{
void *result; // rax

*(_DWORD *)a1 = a2;
*(_DWORD *)(a1 + 4) = 0;
*(_DWORD *)(a1 + 8) = 0;
result = calloc(a2, 4uLL);
*(_QWORD *)(a1 + 16) = result;
return result;
}

canonical_decompiled_code:
void *__fastcall func8(__int64 a1, int a2)
{
void *result; // rax

*(_DWORD *)a1 = a2;
*(_DWORD *)(a1 + 4) = 0;
*(_DWORD *)(a1 + 8) = 0;
result = calloc(a2, 4uLL);
*(_QWORD *)(a1 + 16) = result;
return result;
}

original_code:
void cbInit(CircularBuffer *cb, int size) {
    cb->size = size;
    cb->start = 0;
    cb->count = 0;
    cb->fbuffer = (float*) calloc(cb->size, sizeof(float));
}

canonical_original_code:
void cbInit(struct CircularBuffer *cb, int size) {
    cb->size = size;
    cb->start = 0;
    cb->count = 0;
    cb->fbuffer = (float *) calloc(cb->size, sizeof(float));
}

variable_types: size int

user_defined_types: struct CircularBuffer { int size; int start; int count; float *fbuffer; }


cbIsFull

decompiled_code:
_BOOL8 __fastcall cbIsFull(_DWORD *a1)
{
return a1[2] == *a1;
}

canonical_decompiled_code:
_BOOL8 __fastcall func9(_DWORD *a1)
{
return a1[2] == *a1;
}

original_code:
int cbIsFull(CircularBuffer *cb) {
    return cb->count == cb->size; }

canonical_original_code:
int cbIsFull(struct CircularBuffer *cb) {
    return cb->count == cb->size; }


cbIsEmpty

decompiled_code:
_BOOL8 __fastcall cbIsEmpty(__int64 a1)
{
return *(_DWORD *)(a1 + 8) == 0;
}

canonical_decompiled_code:
_BOOL8 __fastcall func10(__int64 a1)
{
return *(_DWORD *)(a1 + 8) == 0;
}

original_code:
int cbIsEmpty(CircularBuffer *cb) {
    return cb->count == 0; }

canonical_original_code:
int cbIsEmpty(struct CircularBuffer *cb) {
    return cb->count == 0; }


cbWrite

decompiled_code:
__int64 __fastcall cbWrite(int *a1, _DWORD *a2)
{
int v2; // eax
int v3; // ecx
__int64 result; // rax

*(_DWORD *)(*((_QWORD *)a1 + 2) + 4LL * ((a1[1] + a1[2]) % *a1)) = *a2;
v2 = a1[2];
v3 = *a1;
if ( v2 == *a1 )
{
result = (unsigned int)((a1[1] + 1) / v3);
a1[1] = (a1[1] + 1) % v3;
}
else
{
result = (unsigned int)(v2 + 1);
a1[2] = result;
}
return result;
}

original_code:
void cbWrite(CircularBuffer *cb, float *elem) {
    int end = (cb->start + cb->count) % cb->size;
    cb->fbuffer[end] = *elem;
    if (cb->count == cb->size)
        cb->start = (cb->start + 1) % cb->size;
    else
        ++cb->count;
}

canonical_original_code:
void cbWrite(struct CircularBuffer *cb, float *elem) {
    int end = (cb->start + cb->count) % cb->size;
    cb->fbuffer[end] = *elem;
    if (cb->count == cb->size)
        cb->start = (cb->start + 1) % cb->size;
    else
        ++cb->count;
}

variable_types:
elem
float *

variable_types: end int


cbRead

original_code:
void cbRead(CircularBuffer *cb, float *elem) {
    *elem = cb->fbuffer[cb->start];
    cb->start = (cb->start + 1) % cb->size;
    --cb->count;
}

canonical_original_code:
void cbRead(struct CircularBuffer *cb, float *elem) {
    *elem = cb->fbuffer[cb->start];
    cb->start = (cb->start + 1) % cb->size;
    --cb->count;
}


decompiled_code:
__int64 empty_stdin()
{
__isoc99_scanf();
return __isoc99_scanf();
}

canonical_decompiled_code:
__int64 func13()
{
__isoc99_scanf();
return __isoc99_scanf();
}

original_code:
void empty_stdin(){
    char c;
    scanf("%c%*[^\n]", &c);
    scanf("%*c");
}

variable_types: c char


main

decompiled_code:
int __cdecl __noreturn main(int argc, const char **argv, const char **envp)
{
size_t v3; // rbx
int v4; // eax
ssize_t v5; // rax
char *v6; // rbp
int i; // ebx
float v8; // [rsp+Ch] [rbp-10Ch] BYREF
char buf[208]; // [rsp+10h] [rbp-108h] BYREF
int v10; // [rsp+E0h] [rbp-38h] BYREF
int v11; // [rsp+E8h] [rbp-30h]

cbInit((__int64)&v10, 20);
while ( 1 )
{
empty_stdin();
sleep(1u);
v3 = v10;
v4 = fileno(stdin);
v5 = read(v4, buf, v3);
printf("No. of bytes read: %d\n", v5);
if ( v10 > 0 )
{
v6 = buf;
for ( i = 0; i < v10; ++i )
{
cbWrite(&v10, v6);
v6 += 4;
}
}
while ( !cbIsEmpty((__int64)&v10) )
{
cbRead((__int64)&v10, &v8);
printf("%f\t", v8);
if ( v11 == 5 * (v11 / 5) )
putchar(10);
}
}
}

canonical_decompiled_code:
int __cdecl __noreturn main(int argc, const char **argv, const char **envp)
{
size_t v3; // rbx
int v4; // eax
ssize_t v5; // rax
char *v6; // rbp
int i; // ebx
float v8; // [rsp+Ch] [rbp-10Ch] BYREF
char buf[208]; // [rsp+10h] [rbp-108h] BYREF
int v10; // [rsp+E0h] [rbp-38h] BYREF
int v11; // [rsp+E8h] [rbp-30h]

func8((__int64)&v10, 20);
while ( 1 )
{
func13();
sleep(1u);
v3 = v10;
v4 = fileno(stdin);
v5 = read(v4, buf, v3);
printf("No. of bytes read: %d\n", v5);
if ( v10 > 0 )
{
v6 = buf;
for ( i = 0; i < v10; ++i )
{
func11(&v10, v6);
v6 += 4;
}
}
while ( !func10((__int64)&v10) )
{
func12((__int64)&v10, &v8);
printf("%f\t", v8);
if ( v11 == 5 * (v11 / 5) )
putchar(10);
}
}
}

original_code:
int main(){
    CircularBuffer cb;
    cbInit(&cb, 20);
    while(1){
        float buff[50];
        empty_stdin();
        sleep(1.5);
        int n = read(fileno(stdin), buff, cb.size);
        printf("No. of bytes read: %d\n", n);
        int i = 0;
        while(i < cb.size){
            cbWrite(&cb, &buff[i]);
            i++;
        }
        while(!cbIsEmpty(&cb)){
            float c;
            cbRead(&cb, &c);
            printf("%f\t", c);
            if(!(cb.count%5)) printf("\n");
        }
    }
}

canonical_original_code:
int main(){
    struct CircularBuffer cb;
    cbInit(&cb, 20);
    while(1){
        float buff[50];
        empty_stdin();
        sleep(1.5);
        int n = read(fileno(stdin), buff, cb.size);
        printf("No. of bytes read: %d\n", n);
        int i = 0;
        while(i < cb.size){
            cbWrite(&cb, &buff[i]);
            i++;
        }
        while(!cbIsEmpty(&cb)){
            float c;
            cbRead(&cb, &c);
            printf("%f\t", c);
            if(!(cb.count%5)) printf("\n");
        }
    }
}

variable_types: struct CircularBuffer { int size; int start; int count; float *fbuffer; }

variable_types:
buff
float [50]

variable_types: n int

variable_types: c float


decompiled_code:
void __fastcall __noreturn error1(const char *a1)
{
int *v1; // rax
char *v2; // rax

v1 = __errno_location();
v2 = strerror(*v1);
fprintf(stderr, "%s: %s \n", a1, v2);
exit(1);
}

canonical_decompiled_code:
void __fastcall __noreturn func8(const char *a1)
{
int *v1; // rax
char *v2; // rax

v1 = __errno_location();
v2 = strerror(*v1);
fprintf(stderr, "%s: %s \n", a1, v2);
exit(1);
}

original_code:
void error1(const char *msg)
{
    fprintf(stderr, "%s: %s \n", msg, strerror((*__errno_location ())));
    exit(1);
}

canonical_original_code:
void error1(char *msg)
{
    fprintf(stderr, "%s: %s \n", msg, strerror((*__errno_location ())));
    exit(1);
}

variable_types:
msg
char *


writeToClients

decompiled_code:
ssize_t writeToClients()
{
__int64 v0; // rbx
const char *v1; // rsi
ssize_t result; // rax
__int64 i; // rbx
const char *v4; // rsi

v0 = *(_QWORD *)list;
v1 = tempBuf;
result = write(**(_DWORD **)list, tempBuf, length);
n = result;
if ( (int)result < 0 )
err((int)"ERROR writing to socket", v1);
for ( i = *(_QWORD *)(v0 + 8); i; i = *(_QWORD *)(i + 8) )
{
v4 = tempBuf;
result = write(*(_DWORD *)i, tempBuf, length);
n = result;
if ( (int)result < 0 )
err((int)"ERROR writing to socket", v4);
}
return result;
}

canonical_decompiled_code:
ssize_t func9()
{
__int64 v0; // rbx
const char *v1; // rsi
ssize_t result; // rax
__int64 i; // rbx
const char *v4; // rsi

v0 = *(_QWORD *)list;
v1 = tempBuf;
result = write(**(_DWORD **)list, tempBuf, length);
n = result;
if ( (int)result < 0 )
err((int)"ERROR writing to socket", v1);
for ( i = *(_QWORD *)(v0 + 8); i; i = *(_QWORD *)(i + 8) )
{
v4 = tempBuf;
result = write(*(_DWORD *)i, tempBuf, length);
n = result;
if ( (int)result < 0 )
err((int)"ERROR writing to socket", v4);
}
return result;
}

original_code:
int writeToClients(){
 Node *ln = list->head;
 int x = ln->data;
 n = write(x, tempBuf, length);
 if (n < 0)
             err("ERROR writing to socket");
 while(ln->next != ((void *)0)){
  ln = ln->next;
  int x = ln->data;
  n = write(x, tempBuf, length);
  if (n < 0)
             err("ERROR writing to socket");
 }
}

canonical_original_code:
int writeToClients(){
 struct node *ln = list->head;
 int x = ln->data;
 n = write(x, tempBuf, length);
 if (n < 0)
             err("ERROR writing to socket");
 while(ln->next != ((void *)0)){
  ln = ln->next;
  int x = ln->data;
  n = write(x, tempBuf, length);
  if (n < 0)
             err("ERROR writing to socket");
 }
}

variable_types: struct node { int data; struct node *next; } *

variable_types: x int


emptylist

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

result = malloc(8uLL);
*result = 0LL;
return result;
}

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

result = malloc(8uLL);
*result = 0LL;
return result;
}

original_code:
List * emptylist(){
  List * list = malloc(sizeof(List));
  list->head = ((void *)0);
  return list;
}

canonical_original_code:
struct list *emptylist(){
  struct list *list = malloc(sizeof(List));
  list->head = ((void *)0);
  return list;
}

variable_types: struct list { struct node { int data; struct node *next; } *head; } *


display

decompiled_code:
int __fastcall display(unsigned int **a1)
{
unsigned int *v1; // rbx
int result; // eax

v1 = *a1;
if ( *a1 )
{
for ( ; *((_QWORD *)v1 + 1); v1 = (unsigned int *)*((_QWORD *)v1 + 1) )
printf("%d,", *v1);
result = printf("%d\n", *v1);
}
return result;
}

canonical_decompiled_code:
int __fastcall func12(unsigned int **a1)
{
unsigned int *v1; // rbx
int result; // eax

v1 = *a1;
if ( *a1 )
{
for ( ; *((_QWORD *)v1 + 1); v1 = (unsigned int *)*((_QWORD *)v1 + 1) )
printf("%d,", *v1);
result = printf("%d\n", *v1);
}
return result;
}

original_code:
void display(List * list) {
  Node * current = list->head;
  if(list->head == ((void *)0))
    return;
  while(current->next != ((void *)0)){
    printf("%d,", current->data);
    current = current->next;
  }
  printf("%d\n", current->data);
}

canonical_original_code:
void display(struct list *list) {
  struct node *current = list->head;
  if(list->head == ((void *)0))
    return;
  while(current->next != ((void *)0)){
    printf("%d,", current->data);
    current = current->next;
  }
  printf("%d\n", current->data);
}

user_defined_types: struct node { int data; struct node *next; }


delete

original_code:
void delete(int data, List * list){
  Node * current = list->head;
  Node * previous = current;
  while(current != ((void *)0)){
    if(current->data == data){
      previous->next = current->next;
      if(current == list->head)
        list->head = current->next;
      free(current);
      return;
    }
    previous = current;
    current = current->next;
  }
}

canonical_original_code:
void delete(int data, struct list *list){
  struct node *current = list->head;
  struct node *previous = current;
  while(current != ((void *)0)){
    if(current->data == data){
      previous->next = current->next;
      if(current == list->head)
        list->head = current->next;
      free(current);
      return;
    }
    previous = current;
    current = current->next;
  }
}

variable_types: data int


destroy

decompiled_code:
void __fastcall destroy(void *ptr)
{
_QWORD *v2; // rbx
void *v3; // rdi

v2 = *(_QWORD **)ptr;
if ( *(_QWORD *)ptr )
{
do
{
v3 = v2;
v2 = (_QWORD *)v2[1];
free(v3);
}
while ( v2 );
}
free(ptr);
}

canonical_decompiled_code:
void __fastcall func15(void *ptr)
{
_QWORD *v2; // rbx
void *v3; // rdi

v2 = *(_QWORD **)ptr;
if ( *(_QWORD *)ptr )
{
do
{
v3 = v2;
v2 = (_QWORD *)v2[1];
free(v3);
}
while ( v2 );
}
free(ptr);
}

original_code:
void destroy(List * list){
  Node * current = list->head;
  Node * next = current;
  while(current != ((void *)0)){
    next = current->next;
    free(current);
    current = next;
  }
  free(list);
}

canonical_original_code:
void destroy(struct list *list){
  struct node *current = list->head;
  struct node *next = current;
  while(current != ((void *)0)){
    next = current->next;
    free(current);
    current = next;
  }
  free(list);
}


mystrdup

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

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

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

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

original_code:
char *mystrdup(const char *s)
{
 char *ds;
 if(!(ds=(char *)malloc(strlen(s)+1))) return ((void *)0);
 strcpy(ds, s);
 return ds;
}

canonical_original_code:
char *mystrdup(char *s)
{
 char *ds;
 if(!(ds=(char *)malloc(strlen(s)+1))) return ((void *)0);
 strcpy(ds, s);
 return ds;
}

variable_types:
s
char *

variable_types:
ds
char *

return_type: char *


usage

decompiled_code:
void __fastcall __noreturn usage(const char *a1, int a2)
{
fprintf(stderr, "Usage: %s <file-name> <output-file-name>", a1);
exit(a2);
}

canonical_decompiled_code:
void __fastcall __noreturn func8(const char *a1, int a2)
{
fprintf(stderr, "Usage: %s <file-name> <output-file-name>", a1);
exit(a2);
}

original_code:
void usage(const char *cmd, int st)
{
 fprintf(stderr, "Usage: %s <file-name> <output-file-name>", cmd);
 exit(st);
}

canonical_original_code:
void usage(char *cmd, int st)
{
 fprintf(stderr, "Usage: %s <file-name> <output-file-name>", cmd);
 exit(st);
}

variable_types:
cmd
char *

variable_types: st int


main

decompiled_code:
int __cdecl main(int argc, const char **argv, const char **envp)
{
char *v4; // r12
char *v5; // rsi

if ( argc <= 1 )
{
v4 = "-";
}
else
{
v4 = (char *)argv[1];
if ( !strcmp(v4, "-h") || !strcmp(v4, "--help") )
usage(*argv, 0);
}
v5 = "-";
if ( argc > 2 )
v5 = (char *)argv[2];
if ( argc > 3 )
usage(*argv, 1);
mkcfile(v4, v5);
return 0;
}

canonical_decompiled_code:
int __cdecl main(int argc, const char **argv, const char **envp)
{
char *v4; // r12
char *v5; // rsi

if ( argc <= 1 )
{
v4 = "-";
}
else
{
v4 = (char *)argv[1];
if ( !strcmp(v4, "-h") || !strcmp(v4, "--help") )
func8(*argv, 0);
}
v5 = "-";
if ( argc > 2 )
v5 = (char *)argv[2];
if ( argc > 3 )
func8(*argv, 1);
func10(v4, v5);
return 0;
}

original_code:
int main(int argc, char *argv[])
{
 const char *fname="-", *outfname="-";
 if(argc>1) {
  if(!strcmp(argv[1], "-h") || !strcmp(argv[1], "--help")) usage(argv[0], 0);
  fname=argv[1];
 }
 if(argc>2) outfname=argv[2];
 if(argc>3) usage(argv[0], 1);
 mkcfile(fname, outfname);
 return 0;
}

canonical_original_code:
int main(int argc, char *argv[])
{
 char *fname = "-"; char *outfname = "-";
 if(argc>1) {
  if(!strcmp(argv[1], "-h") || !strcmp(argv[1], "--help")) usage(argv[0], 0);
  fname=argv[1];
 }
 if(argc>2) outfname=argv[2];
 if(argc>3) usage(argv[0], 1);
 mkcfile(fname, outfname);
 return 0;
}

variable_types: argc int

variable_types:
argv
char *[]

variable_types:
fname
char *

variable_types:
outfname
char *


decompiled_code:
int __cdecl main(int argc, const char **argv, const char **envp)
{
int result; // eax
int v4; // eax
unsigned int v5; // eax
unsigned int v6; // eax
unsigned int v7; // eax
const char *v8; // rax
int v9; // eax
const char *v10; // rax
const char *v11; // rax
float v12; // [rsp+0h] [rbp-20h] BYREF
unsigned int v13; // [rsp+4h] [rbp-1Ch] BYREF
__int64 v14[3]; // [rsp+8h] [rbp-18h] BYREF

v13 = 0;
if ( argc == 1 )
goto LABEL_2;
v4 = litOpt(argc, argv, v14, &v13);
if ( v4 )
{
if ( v4 == 100 )
{
LABEL_2:
afficheHelp(*argv, 0LL);
return 0;
}
afficheHelp(*argv, argv[v13]);
result = 2;
}
else
{
v5 = tokenize(v14[0]);
if ( v5 )
{
v8 = (const char *)errorToStr(v5);
printf("\nErreur lors de l'analyse syntaxique : %s\n", v8);
v9 = lastToken();
showRef(v14[0], (unsigned int)tabOfToken[6 * v9 + 5]);
result = 1;
}
else
{
v6 = analyseGrammaire(&v13);
if ( v6 )
{
v10 = (const char *)errorToStr(v6);
printf("\nErreur lors de l'analyse grammaticale : %s\n", v10);
showRef(v14[0], (unsigned int)tabOfToken[6 * v13 + 5]);
result = 2;
}
else
{
v7 = calcul(&v12, &v13);
if ( v7 )
{
v11 = (const char *)errorToStr(v7);
printf("\nErreur lors du calcul : %s\n", v11);
showRef(v14[0], v13);
result = 3;
}
else
{
if ( !silent )
printf("Resultat : ");
printf("%.6G\n", v12);
result = 0;
}
}
}
}
return result;
}

original_code:
int main(int argc, char **argv) {
 errorHandler error;
 char *equ;
 int offset=0;
 float result;
 if (argc==1)
  error=100;
 else
  error=litOpt(argc,argv,&equ,&offset);
 if (error) {
  if (error==100) {
   afficheHelp(argv[0],((void *)0));
   return 0;
  }
  afficheHelp(argv[0],argv[offset]);
  return 2;
 }
 error=tokenize(equ);
 if (error!=0)
 {
  printf("\nErreur lors de l'analyse syntaxique : %s\n",errorToStr(error));
  showRef(equ,tabOfToken[lastToken()].offset);
  return 1;
 }
 error=analyseGrammaire(&offset);
 if (error)
 {
  printf("\nErreur lors de l'analyse grammaticale : %s\n",errorToStr(error));
  showRef(equ,tabOfToken[offset].offset);
  return 2;
 }
 error=calcul(&result,&offset);
 if (error)
 {
  printf("\nErreur lors du calcul : %s\n",errorToStr(error));
  showRef(equ,offset);
  return 3;
 }
 if (!silent)
  printf("Resultat : ");
 printf("%.6G\n",result);
 return 0;
}

canonical_original_code:
int main(int argc, char **argv) {
 unsigned int error;
 char *equ;
 int offset = 0;
 float result;
 if (argc==1)
  error=100;
 else
  error=litOpt(argc,argv,&equ,&offset);
 if (error) {
  if (error==100) {
   afficheHelp(argv[0],((void *)0));
   return 0;
  }
  afficheHelp(argv[0],argv[offset]);
  return 2;
 }
 error=tokenize(equ);
 if (error!=0)
 {
  printf("\nErreur lors de l'analyse syntaxique : %s\n",errorToStr(error));
  showRef(equ,tabOfToken[lastToken()].offset);
  return 1;
 }
 error=analyseGrammaire(&offset);
 if (error)
 {
  printf("\nErreur lors de l'analyse grammaticale : %s\n",errorToStr(error));
  showRef(equ,tabOfToken[offset].offset);
  return 2;
 }
 error=calcul(&result,&offset);
 if (error)
 {
  printf("\nErreur lors du calcul : %s\n",errorToStr(error));
  showRef(equ,offset);
  return 3;
 }
 if (!silent)
  printf("Resultat : ");
 printf("%.6G\n",result);
 return 0;
}

variable_types:
argv
char **

variable_types:
error
unsigned int

variable_types:
equ
char *

variable_types: offset int

variable_types: result float


lastToken

decompiled_code:
__int64 lastToken()
{
_WORD *v0; // rcx
unsigned int i; // edx

v0 = &tabOfToken;
for ( i = 0; i != 150; ++i )
{
if ( *v0 == 10 )
break;
if ( !*v0 )
break;
v0 += 12;
}
return i;
}

canonical_decompiled_code:
__int64 func0()
{
_WORD *v0; // rcx
unsigned int i; // edx

v0 = &tabOfToken;
for ( i = 0; i != 150; ++i )
{
if ( *v0 == 10 )
break;
if ( !*v0 )
break;
v0 += 12;
}
return i;
}

original_code:
int lastToken() {
 int i=0;
 while ((i<150) && (tabOfToken[i].type!=0) && (tabOfToken[i].type!=10))
  i++;
 return i;
}

canonical_original_code:
int lastToken() {
 int i = 0;
 while ((i<150) && (tabOfToken[i].type!=0) && (tabOfToken[i].type!=10))
  i++;
 return i;
}

variable_types: i int


caractereType

decompiled_code:
__int64 __fastcall caractereType(char a1)
{
__int64 result; // rax

result = 1LL;
if ( (unsigned __int8)(a1 - 65) > 0x39u )
{
result = 2LL;
if ( (unsigned __int8)(a1 - 42) > 1u && (a1 & 0xFD) != 45 )
{
if ( (unsigned __int8)(a1 - 48) <= 9u || a1 == 46 )
{
result = 3LL;
}
else if ( a1 == 40 )
{
result = 4LL;
}
else
{
result = 255LL;
if ( a1 == 41 )
result = 5LL;
}
}
}
return result;
}

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

result = 1LL;
if ( (unsigned __int8)(a1 - 65) > 0x39u )
{
result = 2LL;
if ( (unsigned __int8)(a1 - 42) > 1u && (a1 & 0xFD) != 45 )
{
if ( (unsigned __int8)(a1 - 48) <= 9u || a1 == 46 )
{
result = 3LL;
}
else if ( a1 == 40 )
{
result = 4LL;
}
else
{
result = 255LL;
if ( a1 == 41 )
result = 5LL;
}
}
}
return result;
}

original_code:
errorHandler caractereType(char cara) {
 if (cara<='z' && cara>='A')
  return 1;
 if (cara=='*' || cara=='/' || cara=='+' || cara=='-')
  return 2;
 if ((cara>='0' && cara <='9') || (cara=='.'))
  return 3;
 if (cara=='(')
  return 4;
 if (cara==')')
  return 5;
 return 255;
}

canonical_original_code:
unsigned int caractereType(char cara) {
 if (cara<='z' && cara>='A')
  return 1;
 if (cara=='*' || cara=='/' || cara=='+' || cara=='-')
  return 2;
 if ((cara>='0' && cara <='9') || (cara=='.'))
  return 3;
 if (cara=='(')
  return 4;
 if (cara==')')
  return 5;
 return 255;
}

variable_types: cara char

return_type: unsigned int


getOperator

original_code:
errorHandler getOperator(char *chaine, int *offset, token *newToken) {
 newToken->type=2;
 switch (chaine[*offset]) {
  case '*' : newToken->op=0;break;
  case '/' : newToken->op=1;break;
  case '+' : newToken->op=2;break;
  case '-' : newToken->op=3;break;
  default : newToken->op=255;
 }
 if (debug)
  printf("\t\tOPERATOR : %i\n",newToken->op);
 (*offset)++;
 return 0;
}

canonical_original_code:
unsigned int getOperator(char *chaine, int *offset, struct token *newToken) {
 newToken->type=2;
 switch (chaine[*offset]) {
  case '*' : newToken->op=0;break;
  case '/' : newToken->op=1;break;
  case '+' : newToken->op=2;break;
  case '-' : newToken->op=3;break;
  default : newToken->op=255;
 }
 if (debug)
  printf("\t\tOPERATOR : %i\n",newToken->op);
 (*offset)++;
 return 0;
}

variable_types:
chaine
char *

variable_types:
offset
int *

variable_types: struct token { unsigned short type; double valueReal; unsigned short function; unsigned short op; int offset; } *


getFunction

decompiled_code:
__int64 __fastcall getFunction(char *s, int *a2, _WORD *a3)
{
__int64 i; // r12
int v4; // er13
size_t v5; // rax
char *v6; // rbx
const char *v7; // rsi
__int64 v8; // rbx
__int64 result; // rax
char s1[80]; // [rsp+10h] [rbp-50h] BYREF

for ( i = 0LL; ; ++i )
{
v4 = *a2;
v5 = strlen(s);
if ( (int)i > 19 )
break;
if ( v4 >= v5 )
break;
v6 = &s[v4];
if ( (unsigned int)caractereType(*v6) != 1 )
break;
*a2 = v4 + 1;
s1[i] = *v6;
}
s1[(int)i] = 0;
v7 = functionRef;
v8 = 0LL;
result = 1LL;
if ( functionRef )
{
while ( strcasecmp(s1, v7) )
{
v7 = (&functionRef)[++v8];
if ( !v7 )
return 1LL;
}
*a3 = 1;
a3[8] = v8;
if ( debug )
printf("\t\tFonction:%i\n", (unsigned __int16)v8);
result = 0LL;
}
return result;
}

canonical_decompiled_code:
__int64 __fastcall func3(char *s, int *a2, _WORD *a3)
{
__int64 i; // r12
int v4; // er13
size_t v5; // rax
char *v6; // rbx
const char *v7; // rsi
__int64 v8; // rbx
__int64 result; // rax
char s1[80]; // [rsp+10h] [rbp-50h] BYREF

for ( i = 0LL; ; ++i )
{
v4 = *a2;
v5 = strlen(s);
if ( (int)i > 19 )
break;
if ( v4 >= v5 )
break;
v6 = &s[v4];
if ( (unsigned int)func1(*v6) != 1 )
break;
*a2 = v4 + 1;
s1[i] = *v6;
}
s1[(int)i] = 0;
v7 = functionRef;
v8 = 0LL;
result = 1LL;
if ( functionRef )
{
while ( strcasecmp(s1, v7) )
{
v7 = (&functionRef)[++v8];
if ( !v7 )
return 1LL;
}
*a3 = 1;
a3[8] = v8;
if ( debug )
printf("\t\tFonction:%i\n", (unsigned __int16)v8);
result = 0LL;
}
return result;
}

original_code:
errorHandler getFunction(char *chaine,int *offset, token *newToken) {
 char buffer[20 +1];
 int i=0;
 while ((*offset<strlen(chaine)) && (i<20) && (caractereType(chaine[*offset])==1))
  buffer[i++]=chaine[(*offset)++];
 buffer[i]='\0';
 i=0;
 while ((functionRef[i]!=((void *)0)) && (strcasecmp(buffer,functionRef[i])!=0))
  i++;
 if(functionRef[i]==((void *)0))
  return 1;
 newToken->type=1;
 newToken->function=i;
 if(debug)
  printf("\t\tFonction:%i\n",newToken->function);
 return 0;
}

canonical_original_code:
unsigned int getFunction(char *chaine, int *offset, struct token *newToken) {
 char buffer[-1];
 int i = 0;
 while ((*offset<strlen(chaine)) && (i<20) && (caractereType(chaine[*offset])==1))
  buffer[i++]=chaine[(*offset)++];
 buffer[i]='\0';
 i=0;
 while ((functionRef[i]!=((void *)0)) && (strcasecmp(buffer,functionRef[i])!=0))
  i++;
 if(functionRef[i]==((void *)0))
  return 1;
 newToken->type=1;
 newToken->function=i;
 if(debug)
  printf("\t\tFonction:%i\n",newToken->function);
 return 0;
}

variable_types:
buffer
char [-1]

user_defined_types: struct token { unsigned short type; double valueReal; unsigned short function; unsigned short op; int offset; }


getNumber

decompiled_code:
__int64 __fastcall getNumber(char *s, int *a2, __int64 a3)
{
__int64 i; // r12
int v4; // er13
size_t v5; // rax
char *v6; // rbx
double v7; // xmm0_8
char *endptr; // [rsp+18h] [rbp-58h] BYREF
char nptr[80]; // [rsp+20h] [rbp-50h] BYREF

for ( i = 0LL; ; ++i )
{
v4 = *a2;
v5 = strlen(s);
if ( (int)i > 19 )
break;
if ( v4 >= v5 )
break;
v6 = &s[v4];
if ( (unsigned int)caractereType(*v6) != 3 )
break;
*a2 = v4 + 1;
nptr[i] = *v6;
}
nptr[(int)i] = 0;
v7 = strtod(nptr, &endptr);
*(double *)(a3 + 8) = v7;
*(_WORD *)a3 = 3;
if ( debug )
printf("\t\tReal = %f \n", v7);
return 0LL;
}

canonical_decompiled_code:
__int64 __fastcall func4(char *s, int *a2, __int64 a3)
{
__int64 i; // r12
int v4; // er13
size_t v5; // rax
char *v6; // rbx
double v7; // xmm0_8
char *endptr; // [rsp+18h] [rbp-58h] BYREF
char nptr[80]; // [rsp+20h] [rbp-50h] BYREF

for ( i = 0LL; ; ++i )
{
v4 = *a2;
v5 = strlen(s);
if ( (int)i > 19 )
break;
if ( v4 >= v5 )
break;
v6 = &s[v4];
if ( (unsigned int)func1(*v6) != 3 )
break;
*a2 = v4 + 1;
nptr[i] = *v6;
}
nptr[(int)i] = 0;
v7 = strtod(nptr, &endptr);
*(double *)(a3 + 8) = v7;
*(_WORD *)a3 = 3;
if ( debug )
printf("\t\tReal = %f \n", v7);
return 0LL;
}

original_code:
errorHandler getNumber(char *chaine,int *offset, token *newToken) {
 char buffer[20 +1];
 char *errorBuff;
 int i=0;
 while ((*offset<strlen(chaine)) && (i<20) && (caractereType(chaine[*offset])==3))
  buffer[i++]=chaine[(*offset)++];
 buffer[i]='\0';
 *offset++;
 newToken->valueReal=strtod(buffer,&errorBuff);
 newToken->type=3;
 if (debug)
  printf("\t\tReal = %f \n",newToken->valueReal);
 return 0;
}

canonical_original_code:
unsigned int getNumber(char *chaine, int *offset, struct token *newToken) {
 char buffer[-1];
 char *errorBuff;
 int i = 0;
 while ((*offset<strlen(chaine)) && (i<20) && (caractereType(chaine[*offset])==3))
  buffer[i++]=chaine[(*offset)++];
 buffer[i]='\0';
 *offset++;
 newToken->valueReal=strtod(buffer,&errorBuff);
 newToken->type=3;
 if (debug)
  printf("\t\tReal = %f \n",newToken->valueReal);
 return 0;
}

variable_types:
errorBuff
char *


nextToken

decompiled_code:
__int64 __fastcall nextToken(char *s, int *a2, __int64 a3)
{
int v5; // esi
int v6; // edx
__int64 v7; // rax
unsigned int v8; // eax
unsigned int v9; // er14
__int64 result; // rax

v5 = strlen(s);
v6 = *a2;
if ( v5 > *a2 )
{
v7 = v6;
do
{
v6 = v7;
if ( s[v7] != 32 )
break;
v6 = v7 + 1;
*a2 = ++v7;
}
while ( v5 > (int)v7 );
}
if ( v5 == v6 )
{
*(_WORD *)a3 = 0;
result = 9LL;
}
else
{
*(_DWORD *)(a3 + 20) = v6;
v8 = caractereType(s[v6]);
v9 = v8;
if ( debug )
printf("\t\tTYPE : %i\n", v8);
switch ( v9 )
{
case 1u:
result = getFunction(s, a2, (_WORD *)a3);
break;
case 2u:
result = getOperator((__int64)s, a2, (_WORD *)a3);
break;
case 3u:
result = getNumber(s, a2, a3);
break;
case 4u:
*(_WORD *)a3 = 5;
++*a2;
result = 0LL;
break;
case 5u:
*(_WORD *)a3 = 6;
++*a2;
result = 0LL;
break;
default:
*(_WORD *)a3 = 10;
result = 10LL;
break;
}
}
return result;
}

canonical_decompiled_code:
__int64 __fastcall func5(char *s, int *a2, __int64 a3)
{
int v5; // esi
int v6; // edx
__int64 v7; // rax
unsigned int v8; // eax
unsigned int v9; // er14
__int64 result; // rax

v5 = strlen(s);
v6 = *a2;
if ( v5 > *a2 )
{
v7 = v6;
do
{
v6 = v7;
if ( s[v7] != 32 )
break;
v6 = v7 + 1;
*a2 = ++v7;
}
while ( v5 > (int)v7 );
}
if ( v5 == v6 )
{
*(_WORD *)a3 = 0;
result = 9LL;
}
else
{
*(_DWORD *)(a3 + 20) = v6;
v8 = func1(s[v6]);
v9 = v8;
if ( debug )
printf("\t\tTYPE : %i\n", v8);
switch ( v9 )
{
case 1u:
result = func3(s, a2, (_WORD *)a3);
break;
case 2u:
result = func2((__int64)s, a2, (_WORD *)a3);
break;
case 3u:
result = func4(s, a2, a3);
break;
case 4u:
*(_WORD *)a3 = 5;
++*a2;
result = 0LL;
break;
case 5u:
*(_WORD *)a3 = 6;
++*a2;
result = 0LL;
break;
default:
*(_WORD *)a3 = 10;
result = 10LL;
break;
}
}
return result;
}

original_code:
errorHandler nextToken(char *chaine, int *offset,token *newToken){
 int lengthChaine;
 int type;
 lengthChaine=strlen(chaine);
 while((*offset<lengthChaine) && (chaine[*offset]==' '))
  (*offset)++;
 if (*offset==lengthChaine) {
  newToken->type=0;
  return 9;
 }
 newToken->offset=*offset;
 type=caractereType(chaine[*offset]);
 if (debug)
  printf("\t\tTYPE : %i\n",type);
 switch(type) {
  case 1 : return getFunction(chaine,offset,newToken);
  case 2 : return getOperator(chaine,offset,newToken);
  case 3 : return getNumber(chaine,offset,newToken);
  case 4 : newToken->type=5; (*offset)++;return 0;
  case 5 : newToken->type=6; (*offset)++;return 0;
  default : newToken->type=10;return 10;
 }
 return 10;
}

canonical_original_code:
unsigned int nextToken(char *chaine, int *offset, struct token *newToken){
 int lengthChaine;
 int type;
 lengthChaine=strlen(chaine);
 while((*offset<lengthChaine) && (chaine[*offset]==' '))
  (*offset)++;
 if (*offset==lengthChaine) {
  newToken->type=0;
  return 9;
 }
 newToken->offset=*offset;
 type=caractereType(chaine[*offset]);
 if (debug)
  printf("\t\tTYPE : %i\n",type);
 switch(type) {
  case 1 : return getFunction(chaine,offset,newToken);
  case 2 : return getOperator(chaine,offset,newToken);
  case 3 : return getNumber(chaine,offset,newToken);
  case 4 : newToken->type=5; (*offset)++;return 0;
  case 5 : newToken->type=6; (*offset)++;return 0;
  default : newToken->type=10;return 10;
 }
 return 10;
}

variable_types: lengthChaine int

variable_types: type int


pCos

decompiled_code:
__int64 __fastcall pCos(double *a1)
{
*a1 = cos(*a1);
return 0LL;
}

canonical_decompiled_code:
__int64 __fastcall func0(double *a1)
{
*a1 = cos(*a1);
return 0LL;
}

original_code:
errorHandler pCos(double *real) {
 if (trigoDeg)
  ((*real)*0.0174532925);
 *real=cos(*real);
 return 0;
}

canonical_original_code:
unsigned int pCos(double *real) {
 if (trigoDeg)
  ((*real)*0.0174532925);
 *real=cos(*real);
 return 0;
}

variable_types:
real
double *


pSin

decompiled_code:
__int64 __fastcall pSin(double *a1)
{
*a1 = sin(*a1);
return 0LL;
}

canonical_decompiled_code:
__int64 __fastcall func1(double *a1)
{
*a1 = sin(*a1);
return 0LL;
}

original_code:
errorHandler pSin(double *real) {
 if (trigoDeg)
  ((*real)*0.0174532925);
 *real=sin(*real);
 return 0;
}

canonical_original_code:
unsigned int pSin(double *real) {
 if (trigoDeg)
  ((*real)*0.0174532925);
 *real=sin(*real);
 return 0;
}


pTan

decompiled_code:
__int64 __fastcall pTan(double *a1)
{
float v1; // xmm2_4
double v2; // xmm0_8
__int64 result; // rax

v1 = *a1;
v2 = sin(*a1);
if ( v2 == 0.0 )
{
*a1 = v2;
result = 16LL;
}
else
{
*a1 = v1 / v2;
result = 0LL;
}
return result;
}

canonical_decompiled_code:
__int64 __fastcall func2(double *a1)
{
float v1; // xmm2_4
double v2; // xmm0_8
__int64 result; // rax

v1 = *a1;
v2 = sin(*a1);
if ( v2 == 0.0 )
{
*a1 = v2;
result = 16LL;
}
else
{
*a1 = v1 / v2;
result = 0LL;
}
return result;
}

original_code:
errorHandler pTan(double *real) {
 float tmp;
 tmp=*real;
 if (trigoDeg)
  ((*real)*0.0174532925);
 *real=sin(*real);
 if (*real==0)
  return 16;
 *real=tmp/(*real);
 return 0;
}

canonical_original_code:
unsigned int pTan(double *real) {
 float tmp;
 tmp=*real;
 if (trigoDeg)
  ((*real)*0.0174532925);
 *real=sin(*real);
 if (*real==0)
  return 16;
 *real=tmp/(*real);
 return 0;
}

variable_types: tmp float


doOperation

original_code:
errorHandler doOperation(int op) {
 token *tok1,*tok2;
 pop2(&tok1);
 pop2(&tok2);
 if ((tok1->type!=3) || (tok2->type!=3))
  return 11;
 switch (op) {
  case 0 : tok1->valueReal=tok2->valueReal*tok1->valueReal;
          push2(tok1);return 0;
  case 1 : if (tok1->valueReal==0)
     return 14;
    tok1->valueReal=tok2->valueReal/tok1->valueReal;
    push2(tok1);return 0;
  case 3 : tok1->valueReal=tok2->valueReal-tok1->valueReal;
        push2(tok1);return 0;
  case 2 : tok1->valueReal=tok2->valueReal+tok1->valueReal;
    push2(tok1);return 0;
 }
}

canonical_original_code:
unsigned int doOperation(int op) {
 struct token *tok1; struct token *tok2;
 pop2(&tok1);
 pop2(&tok2);
 if ((tok1->type!=3) || (tok2->type!=3))
  return 11;
 switch (op) {
  case 0 : tok1->valueReal=tok2->valueReal*tok1->valueReal;
          push2(tok1);return 0;
  case 1 : if (tok1->valueReal==0)
     return 14;
    tok1->valueReal=tok2->valueReal/tok1->valueReal;
    push2(tok1);return 0;
  case 3 : tok1->valueReal=tok2->valueReal-tok1->valueReal;
        push2(tok1);return 0;
  case 2 : tok1->valueReal=tok2->valueReal+tok1->valueReal;
    push2(tok1);return 0;
 }
}

variable_types: op int


doFunction

original_code:
errorHandler doFunction(int funct) {
 token *tok1;
 pop2(&tok1);
 errorHandler err;
 if (tok1->type!=3)
  return 11;
 switch(funct) {
  case 0 : tok1->valueReal*=tok1->valueReal;push2(tok1);return 0;
  case 1 : if (tok1->valueReal<0)
        return 15;
       tok1->valueReal=sqrt(tok1->valueReal);
       push2(tok1);
       return 0;
  case 2 : err=pCos(&tok1->valueReal);
      push2(tok1);
      return err;
  case 3 : err=pSin(&tok1->valueReal);
      push2(tok1);
      return err;
  case 4 : err=pTan(&tok1->valueReal);
      push2(tok1);
      return err;
  case 6 : tok1->valueReal=floor(tok1->valueReal);
      push2(tok1);
      return 0;
 }
 return 0;
}

canonical_original_code:
unsigned int doFunction(int funct) {
 struct token *tok1;
 pop2(&tok1);
 unsigned int err;
 if (tok1->type!=3)
  return 11;
 switch(funct) {
  case 0 : tok1->valueReal*=tok1->valueReal;push2(tok1);return 0;
  case 1 : if (tok1->valueReal<0)
        return 15;
       tok1->valueReal=sqrt(tok1->valueReal);
       push2(tok1);
       return 0;
  case 2 : err=pCos(&tok1->valueReal);
      push2(tok1);
      return err;
  case 3 : err=pSin(&tok1->valueReal);
      push2(tok1);
      return err;
  case 4 : err=pTan(&tok1->valueReal);
      push2(tok1);
      return err;
  case 6 : tok1->valueReal=floor(tok1->valueReal);
      push2(tok1);
      return 0;
 }
 return 0;
}

variable_types: funct int

variable_types:
err
unsigned int


calcul

decompiled_code:
__int64 __fastcall calcul(float *a1, _DWORD *a2)
{
float v2; // xmm0_4
__int64 result; // rax
__int16 v4; // ax
__int64 v5[3]; // [rsp+8h] [rbp-18h] BYREF

resetStack1();
if ( (unsigned int)pop1(v5) )
{
LABEL_2:
pop2(v5);
v2 = *(double *)(v5[0] + 8);
*a1 = v2;
return 0LL;
}
while ( 1 )
{
v4 = *(_WORD *)v5[0];
if ( *(_WORD *)v5[0] == 2 )
break;
if ( v4 == 3 )
{
push2(v5[0]);
}
else if ( v4 == 1 )
{
result = doFunction(*(unsigned __int16 *)(v5[0] + 16));
goto LABEL_10;
}
LABEL_4:
if ( (unsigned int)pop1(v5) )
goto LABEL_2;
}
result = doOperation(*(unsigned __int16 *)(v5[0] + 18));
LABEL_10:
if ( !(_DWORD)result )
goto LABEL_4;
*a2 = *(_DWORD *)(v5[0] + 20);
return result;
}

canonical_decompiled_code:
__int64 __fastcall func5(float *a1, _DWORD *a2)
{
float v2; // xmm0_4
__int64 result; // rax
__int16 v4; // ax
__int64 v5[3]; // [rsp+8h] [rbp-18h] BYREF

resetStack1();
if ( (unsigned int)pop1(v5) )
{
LABEL_2:
pop2(v5);
v2 = *(double *)(v5[0] + 8);
*a1 = v2;
return 0LL;
}
while ( 1 )
{
v4 = *(_WORD *)v5[0];
if ( *(_WORD *)v5[0] == 2 )
break;
if ( v4 == 3 )
{
push2(v5[0]);
}
else if ( v4 == 1 )
{
result = func4(*(unsigned __int16 *)(v5[0] + 16));
goto LABEL_10;
}
LABEL_4:
if ( (unsigned int)pop1(v5) )
goto LABEL_2;
}
result = func3(*(unsigned __int16 *)(v5[0] + 18));
LABEL_10:
if ( !(_DWORD)result )
goto LABEL_4;
*a2 = *(_DWORD *)(v5[0] + 20);
return result;
}

original_code:
errorHandler calcul(float *result,int *offset) {
 errorHandler err=0,error=0;
 token *tok;
 resetStack1();
 err=pop1(&tok);
 while (!err)
 {
  switch (tok->type) {
   case 3 : push2(tok);break;
   case 2 :
           error=doOperation(tok->op);
          break;
   case 1 :
          error=doFunction(tok->function);
          break;
  }
  if (error) {
   *offset= tok->offset;
   return error;
  }
  err=pop1(&tok);
 }
 pop2(&tok);
 *result=tok->valueReal;
 return 0;
}

canonical_original_code:
unsigned int calcul(float *result, int *offset) {
 unsigned int err = 0; unsigned int error = 0;
 struct token *tok;
 resetStack1();
 err=pop1(&tok);
 while (!err)
 {
  switch (tok->type) {
   case 3 : push2(tok);break;
   case 2 :
           error=doOperation(tok->op);
          break;
   case 1 :
          error=doFunction(tok->function);
          break;
  }
  if (error) {
   *offset= tok->offset;
   return error;
  }
  err=pop1(&tok);
 }
 pop2(&tok);
 *result=tok->valueReal;
 return 0;
}

variable_types:
result
float *

variable_types:
error
unsigned int


decompiled_code:
__int64 __fastcall push1(__int64 a1)
{
int v1; // eax
unsigned int v2; // edx

v1 = sp1;
v2 = 4;
if ( sp1 <= 149 )
{
stack1[sp1] = a1;
sp1 = v1 + 1;
++bp1;
v2 = 0;
}
return v2;
}

canonical_decompiled_code:
__int64 __fastcall func0(__int64 a1)
{
int v1; // eax
unsigned int v2; // edx

v1 = sp1;
v2 = 4;
if ( sp1 <= 149 )
{
stack1[sp1] = a1;
sp1 = v1 + 1;
++bp1;
v2 = 0;
}
return v2;
}

original_code:
errorHandler push1(token *tok) {
 if (sp1<150)
 {
  stack1[sp1]=tok;
  sp1++;bp1++;
  return 0;
 }
 return 4;
}

canonical_original_code:
unsigned int push1(struct token *tok) {
 if (sp1<150)
 {
  stack1[sp1]=tok;
  sp1++;bp1++;
  return 0;
 }
 return 4;
}


decompiled_code:
__int64 __fastcall push2(__int64 a1)
{
int v1; // eax
unsigned int v2; // edx

v1 = sp2;
v2 = 4;
if ( sp2 <= 149 )
{
stack2[sp2] = a1;
sp2 = v1 + 1;
v2 = 0;
}
return v2;
}

canonical_decompiled_code:
__int64 __fastcall func1(__int64 a1)
{
int v1; // eax
unsigned int v2; // edx

v1 = sp2;
v2 = 4;
if ( sp2 <= 149 )
{
stack2[sp2] = a1;
sp2 = v1 + 1;
v2 = 0;
}
return v2;
}

original_code:
errorHandler push2(token *tok){
 if (sp2<150){
  stack2[sp2]=tok;
  sp2++;
  return 0;
 }
 return 4;
}

canonical_original_code:
unsigned int push2(struct token *tok){
 if (sp2<150){
  stack2[sp2]=tok;
  sp2++;
  return 0;
 }
 return 4;
}


decompiled_code:
__int64 __fastcall pop2(_QWORD *a1)
{
int v1; // eax
unsigned int v2; // edx

v1 = sp2;
v2 = 5;
if ( sp2 > 0 )
{
--sp2;
*a1 = stack2[v1 - 1];
v2 = 0;
}
return v2;
}

canonical_decompiled_code:
__int64 __fastcall func2(_QWORD *a1)
{
int v1; // eax
unsigned int v2; // edx

v1 = sp2;
v2 = 5;
if ( sp2 > 0 )
{
--sp2;
*a1 = stack2[v1 - 1];
v2 = 0;
}
return v2;
}

original_code:
errorHandler pop2(token **tok) {
 if(sp2>0)
 {
  sp2--;
  (*tok)=stack2[sp2];
  return 0;
 }
 return 5;
}

canonical_original_code:
unsigned int pop2(struct token **tok) {
 if(sp2>0)
 {
  sp2--;
  (*tok)=stack2[sp2];
  return 0;
 }
 return 5;
}

variable_types: struct token { unsigned short type; double valueReal; unsigned short function; unsigned short op; int offset; } **


decompiled_code:
__int64 __fastcall pop1(_QWORD *a1)
{
unsigned int v1; // edx

v1 = 5;
if ( sp1 < bp1 )
{
*a1 = stack1[sp1++];
v1 = 0;
}
return v1;
}

canonical_decompiled_code:
__int64 __fastcall func3(_QWORD *a1)
{
unsigned int v1; // edx

v1 = 5;
if ( sp1 < bp1 )
{
*a1 = stack1[sp1++];
v1 = 0;
}
return v1;
}

original_code:
errorHandler pop1(token **tok) {
 if(sp1<bp1)
 {
  (*tok)=stack1[sp1];
  sp1++;
  return 0;
 }
 return 5;
}

canonical_original_code:
unsigned int pop1(struct token **tok) {
 if(sp1<bp1)
 {
  (*tok)=stack1[sp1];
  sp1++;
  return 0;
 }
 return 5;
}


decompiled_code:
void resetStack1()
{
sp1 = 0;
}

canonical_decompiled_code:
void func4()
{
sp1 = 0;
}

original_code:
void resetStack1() {
 sp1=0;
}

canonical_original_code:
void resetStack1() {
 sp1=0;
}


decompiled_code:
void resetStack2()
{
sp2 = 0;
}

canonical_decompiled_code:
void func5()
{
sp2 = 0;
}

original_code:
void resetStack2() {
 sp2=0;
}

canonical_original_code:
void resetStack2() {
 sp2=0;
}


estPrioritaire

decompiled_code:
_BOOL8 __fastcall estPrioritaire(unsigned int a1)
{
return a1 <= 1;
}

canonical_decompiled_code:
_BOOL8 __fastcall func0(unsigned int a1)
{
return a1 <= 1;
}

original_code:
int estPrioritaire(int op) {
 if ((op==0) || (op==1))
  return 1;
 return 0;
}


analyseOperation

decompiled_code:
__int64 __fastcall analyseOperation(int *a1, unsigned int a2, int a3)
{
unsigned int v5; // eax
unsigned int v6; // eax
int v7; // ebx
__int16 v8; // ax
unsigned int v9; // [rsp+Ch] [rbp-34h]

v9 = ((__int64 (*)(void))analyseExpression)();
if ( !v9 )
{
while ( 1 )
{
v7 = *a1;
if ( *a1 >= (int)a2 )
break;
v8 = tabOfToken[3 * v7];
if ( v8 == 6 )
break;
if ( v8 != 2 )
return 12;
if ( estPrioritaire(WORD1(tabOfToken[3 * v7 + 2])) )
{
*a1 = v7 + 1;
v5 = analyseExpression(a1, a2);
if ( v5 )
return v5;
}
else
{
if ( a3 )
return v9;
*a1 = v7 + 1;
v5 = analyseOperation(a1, a2, 1LL);
if ( v5 )
return v5;
}
v6 = push1(&tabOfToken[3 * v7]);
if ( v6 )
return v6;
}
}
return v9;
}

canonical_decompiled_code:
__int64 __fastcall func1(int *a1, unsigned int a2, int a3)
{
unsigned int v5; // eax
unsigned int v6; // eax
int v7; // ebx
__int16 v8; // ax
unsigned int v9; // [rsp+Ch] [rbp-34h]

v9 = ((__int64 (*)(void))analyseExpression)();
if ( !v9 )
{
while ( 1 )
{
v7 = *a1;
if ( *a1 >= (int)a2 )
break;
v8 = tabOfToken[3 * v7];
if ( v8 == 6 )
break;
if ( v8 != 2 )
return 12;
if ( func0(WORD1(tabOfToken[3 * v7 + 2])) )
{
*a1 = v7 + 1;
v5 = func2(a1, a2);
if ( v5 )
return v5;
}
else
{
if ( a3 )
return v9;
*a1 = v7 + 1;
v5 = func1(a1, a2, 1LL);
if ( v5 )
return v5;
}
v6 = push1(&tabOfToken[3 * v7]);
if ( v6 )
return v6;
}
}
return v9;
}

original_code:
errorHandler analyseOperation(int *offset,const int numberOfToken,int recursif) {
 token *tok;
 errorHandler error;
 error=analyseExpression(offset,numberOfToken);
 if (error)
  return error;
 while (*offset<numberOfToken) {
  tok=&tabOfToken[*offset];
  if (tok->type == 6) {
   return 0;
  }
  if(tok->type != 2)
   return 12;
  if(estPrioritaire(tok->op))
  {
   (*offset)++;
   error=analyseExpression(offset,numberOfToken);
   if (!error)
    error=push1(tok);
  } else {
   if(recursif)
    return 0;
   (*offset)++;
   error=analyseOperation(offset,numberOfToken,1);
   if (!error)
    error=push1(tok);
  }
  if(error)
   return error;
 }
 return 0;
}

canonical_original_code:
unsigned int analyseOperation(int *offset, int numberOfToken, int recursif) {
 struct token *tok;
 unsigned int error;
 error=analyseExpression(offset,numberOfToken);
 if (error)
  return error;
 while (*offset<numberOfToken) {
  tok=&tabOfToken[*offset];
  if (tok->type == 6) {
   return 0;
  }
  if(tok->type != 2)
   return 12;
  if(estPrioritaire(tok->op))
  {
   (*offset)++;
   error=analyseExpression(offset,numberOfToken);
   if (!error)
    error=push1(tok);
  } else {
   if(recursif)
    return 0;
   (*offset)++;
   error=analyseOperation(offset,numberOfToken,1);
   if (!error)
    error=push1(tok);
  }
  if(error)
   return error;
 }
 return 0;
}

variable_types: numberOfToken int

variable_types: recursif int


analyseExpression

decompiled_code:
__int64 __fastcall analyseExpression(int *a1, __int64 a2)
{
int v2; // er12
unsigned __int16 v3; // ax
unsigned int v4; // edx

v2 = *a1;
v3 = tabOfToken[3 * *a1];
if ( v3 == 3 )
{
*a1 = v2 + 1;
push1(&tabOfToken[3 * v2]);
v4 = 0;
}
else if ( v3 > 3u )
{
v4 = 11;
if ( v3 == 5 )
{
*a1 = v2 + 1;
v4 = analyseOperation(a1, a2, 0);
++*a1;
}
}
else if ( v3 == 1 )
{
*a1 = v2 + 1;
v4 = analyseExpression(a1, a2);
if ( !v4 )
v4 = push1(&tabOfToken[3 * v2]);
}
else if ( v3 == 2 )
{
v4 = 11;
if ( LOWORD(tabOfToken[3 * v2 + 3]) == 3 && WORD1(tabOfToken[3 * v2 + 2]) == 3 )
{
tabOfToken[3 * v2 + 4] ^= LC0;
push1(&tabOfToken[3 * *a1 + 3]);
*a1 += 2;
v4 = 0;
}
}
else
{
v4 = 11;
}
return v4;
}

original_code:
errorHandler analyseExpression(int *offset,int numberOfToken) {
 int error=0;
 token *tok;
 switch (tabOfToken[(*offset)].type) {
  case 5 : (*offset)++;error=analyseOperation(offset,numberOfToken,0);(*offset)++;return error;
  case 3 : push1(&tabOfToken[(*offset)++]);return 0;
  case 1 : tok=&tabOfToken[(*offset)++];
    error=analyseExpression(offset,numberOfToken);
    if (error)
     return error;
    error=push1(tok);
    return error;
  case 2 : if ((tabOfToken[*offset+1].type==3) && (tabOfToken[*offset].op==3)) {
     tabOfToken[*offset+1].valueReal=-tabOfToken[*offset+1].valueReal;
     push1(&tabOfToken[*offset+1]);
     *offset+=2;
     return 0;
     }
 }
 return 11;
}

canonical_original_code:
unsigned int analyseExpression(int *offset, int numberOfToken) {
 int error = 0;
 struct token *tok;
 switch (tabOfToken[(*offset)].type) {
  case 5 : (*offset)++;error=analyseOperation(offset,numberOfToken,0);(*offset)++;return error;
  case 3 : push1(&tabOfToken[(*offset)++]);return 0;
  case 1 : tok=&tabOfToken[(*offset)++];
    error=analyseExpression(offset,numberOfToken);
    if (error)
     return error;
    error=push1(tok);
    return error;
  case 2 : if ((tabOfToken[*offset+1].type==3) && (tabOfToken[*offset].op==3)) {
     tabOfToken[*offset+1].valueReal=-tabOfToken[*offset+1].valueReal;
     push1(&tabOfToken[*offset+1]);
     *offset+=2;
     return 0;
     }
 }
 return 11;
}

variable_types: error int


printStack

decompiled_code:
__int64 printStack()
{
__int64 result; // rax
unsigned __int16 v1; // ax
__int16 v2; // ax
double *v3; // [rsp+8h] [rbp-8h] BYREF

resetStack1();
puts("\n\tEtat de la Pile");
for ( result = pop1(&v3); !(_DWORD)result; result = pop1(&v3) )
{
v2 = *(_WORD *)v3;
if ( *(_WORD *)v3 == 2 )
{
printf("\t\tOPERATEUR : ");
v1 = *((_WORD *)v3 + 9);
if ( v1 == 2 )
{
puts("+");
}
else if ( v1 > 2u )
{
if ( v1 == 3 )
puts("-");
}
else if ( v1 )
{
puts("/");
}
else
{
puts("*");
}
}
else if ( v2 == 3 )
{
printf("\t\tREAL : %f\n", v3[1]);
}
else if ( v2 == 1 )
{
printf("\t\tFunction : %i\n", *((unsigned __int16 *)v3 + 8));
}
}
return result;
}

canonical_decompiled_code:
__int64 func3()
{
__int64 result; // rax
unsigned __int16 v1; // ax
__int16 v2; // ax
double *v3; // [rsp+8h] [rbp-8h] BYREF

resetStack1();
puts("\n\tEtat de la Pile");
for ( result = pop1(&v3); !(_DWORD)result; result = pop1(&v3) )
{
v2 = *(_WORD *)v3;
if ( *(_WORD *)v3 == 2 )
{
printf("\t\tOPERATEUR : ");
v1 = *((_WORD *)v3 + 9);
if ( v1 == 2 )
{
puts("+");
}
else if ( v1 > 2u )
{
if ( v1 == 3 )
puts("-");
}
else if ( v1 )
{
puts("/");
}
else
{
puts("*");
}
}
else if ( v2 == 3 )
{
printf("\t\tREAL : %f\n", v3[1]);
}
else if ( v2 == 1 )
{
printf("\t\tFunction : %i\n", *((unsigned __int16 *)v3 + 8));
}
}
return result;
}

original_code:
void printStack() {
 int i=0;
 token *tok;
 resetStack1();
 printf("\n\tEtat de la Pile\n");
 i=pop1(&tok);
 while (i==0) {
  switch (tok->type) {
   case 2 : printf("\t\tOPERATEUR : ");
     switch (tok->op) {
      case 0 : printf("*\n");break;
      case 1 : printf("/\n");break;
      case 2 : printf("+\n");break;
      case 3 : printf("-\n");break;
     }
     break;
   case 3 : printf("\t\tREAL : %f\n",tok->valueReal);break;
   case 1 : printf("\t\tFunction : %i\n",tok->function);break;
  }
  i=pop1(&tok);
 }
}

canonical_original_code:
void printStack() {
 int i = 0;
 struct token *tok;
 resetStack1();
 printf("\n\tEtat de la Pile\n");
 i=pop1(&tok);
 while (i==0) {
  switch (tok->type) {
   case 2 : printf("\t\tOPERATEUR : ");
     switch (tok->op) {
      case 0 : printf("*\n");break;
      case 1 : printf("/\n");break;
      case 2 : printf("+\n");break;
      case 3 : printf("-\n");break;
     }
     break;
   case 3 : printf("\t\tREAL : %f\n",tok->valueReal);break;
   case 1 : printf("\t\tFunction : %i\n",tok->function);break;
  }
  i=pop1(&tok);
 }
}

variable_types: i int


analyseGrammaire

decompiled_code:
__int64 __fastcall analyseGrammaire(int *a1)
{
unsigned int v1; // eax
unsigned int v2; // ebx
int v3; // er12
int v4; // eax

if ( debug )
puts("\n############# Debut de l'analyse Grammaticale ##############");
*a1 = 0;
v1 = lastToken();
v2 = analyseOperation(a1, v1, 0);
v3 = *a1;
v4 = lastToken();
if ( !v2 && v3 < v4 )
v2 = 13;
if ( debug )
printStack();
return v2;
}

canonical_decompiled_code:
__int64 __fastcall func4(int *a1)
{
unsigned int v1; // eax
unsigned int v2; // ebx
int v3; // er12
int v4; // eax

if ( debug )
puts("\n############# Debut de l'analyse Grammaticale ##############");
*a1 = 0;
v1 = lastToken();
v2 = func1(a1, v1, 0);
v3 = *a1;
v4 = lastToken();
if ( !v2 && v3 < v4 )
v2 = 13;
if ( debug )
func3();
return v2;
}

original_code:
errorHandler analyseGrammaire(int *offset){
 int error=0;
 if (debug)
  printf("\n############# Debut de l'analyse Grammaticale ##############\n");
 *offset=0;
 error=analyseOperation(offset,lastToken(),0);
 if (*offset<lastToken() && (!error))
  error=13;
 if (debug)
  printStack();
 return error;
}

canonical_original_code:
unsigned int analyseGrammaire(int *offset){
 int error = 0;
 if (debug)
  printf("\n############# Debut de l'analyse Grammaticale ##############\n");
 *offset=0;
 error=analyseOperation(offset,lastToken(),0);
 if (*offset<lastToken() && (!error))
  error=13;
 if (debug)
  printStack();
 return error;
}

variable_types:
offset
int *


litOpt

decompiled_code:
__int64 __fastcall litOpt(int argc, char **argv, _QWORD *a3, _DWORD *a4)
{
int v6; // ebx
int v7; // eax
__int64 result; // rax
int longind[13]; // [rsp+Ch] [rbp-34h] BYREF

longind[0] = 0;
silent = 0;
debug = 0;
*a4 = 0;
trigoDeg = 0;
v6 = 0;
while ( 1 )
{
while ( 1 )
{
v7 = getopt_long(argc, argv, "dsht", &long_options_0, longind);
++v6;
if ( v7 == 104 )
return 100LL;
if ( v7 <= 104 )
break;
if ( v7 == 115 )
{
silent = 1;
}
else
{
if ( v7 != 116 )
return 51LL;
trigoDeg = 1;
}
}
if ( v7 == -1 )
break;
if ( v7 != 100 )
return 51LL;
debug = 1;
}
if ( argc - 1 == v6 )
{
*a3 = argv[v6];
result = 0LL;
}
else
{
*a4 = v6 + 1;
result = 101LL;
}
return result;
}

canonical_decompiled_code:
__int64 __fastcall func0(int argc, char **argv, _QWORD *a3, _DWORD *a4)
{
int v6; // ebx
int v7; // eax
__int64 result; // rax
int longind[13]; // [rsp+Ch] [rbp-34h] BYREF

longind[0] = 0;
silent = 0;
debug = 0;
*a4 = 0;
trigoDeg = 0;
v6 = 0;
while ( 1 )
{
while ( 1 )
{
v7 = getopt_long(argc, argv, "dsht", &long_options_0, longind);
++v6;
if ( v7 == 104 )
return 100LL;
if ( v7 <= 104 )
break;
if ( v7 == 115 )
{
silent = 1;
}
else
{
if ( v7 != 116 )
return 51LL;
trigoDeg = 1;
}
}
if ( v7 == -1 )
break;
if ( v7 != 100 )
return 51LL;
debug = 1;
}
if ( argc - 1 == v6 )
{
*a3 = argv[v6];
result = 0LL;
}
else
{
*a4 = v6 + 1;
result = 101LL;
}
return result;
}

original_code:
errorHandler litOpt(int argc, char **argv,char **equ,int *ind) {
static struct option long_options[] =
{
 {"debug",0,0,'d'},
 {"silent",0,0,'s'},
 {"help",0,0,'h'},
 {"trigo-deg",0,0,'t'},
 {0,0,0,0}
};
 int opt,opt_index=0,option=0;
 debug=silent=0;
 *ind=0;
 option=0;
 trigoDeg=0;
 while (opt!=(-1))
 {
  opt = getopt_long(argc,argv,"dsht",long_options,&opt_index);
  option++;
  switch(opt) {
   case 'd' : debug=1;break;
   case 's' : silent=1;break;
   case 'h' : return 100;
   case 't' : trigoDeg=1; break;
   case (-1) : break;
   default : return 51;
  }
 }
 if((option==(argc-1)))
 {
  *equ=argv[option++];
  return 0;
 }
 *ind=option+1;
 return 101;
}

canonical_original_code:
unsigned int litOpt(int argc, char **argv, char **equ, int *ind) {
static struct option long_options[] = {
 {"debug",0,0,'d'},
 {"silent",0,0,'s'},
 {"help",0,0,'h'},
 {"trigo-deg",0,0,'t'},
 {0,0,0,0}
};
 int opt; int opt_index = 0; int option = 0;
 debug=silent=0;
 *ind=0;
 option=0;
 trigoDeg=0;
 while (opt!=(-1))
 {
  opt = getopt_long(argc,argv,"dsht",long_options,&opt_index);
  option++;
  switch(opt) {
   case 'd' : debug=1;break;
   case 's' : silent=1;break;
   case 'h' : return 100;
   case 't' : trigoDeg=1; break;
   case (-1) : break;
   default : return 51;
  }
 }
 if((option==(argc-1)))
 {
  *equ=argv[option++];
  return 0;
 }
 *ind=option+1;
 return 101;
}

variable_types: argc int

variable_types:
argv
char **

variable_types:
equ
char **

variable_types:
ind
int *

variable_types: struct option { char *name; int has_arg; int *flag; int val; } []

variable_types: opt int

variable_types: option int


errorToStr

decompiled_code:
char *__fastcall errorToStr(unsigned int a1)
{
char *result; // rax

result = messDefault;
if ( a1 <= 0x10 )
result = (char *)*(&messErreur + a1);
return result;
}

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

result = messDefault;
if ( a1 <= 0x10 )
result = (char *)*(&messErreur + a1);
return result;
}

original_code:
char *errorToStr(errorHandler error) {
 if ((error>=0) && (error<=16))
  return messErreur[error];
 return messDefault;
}

canonical_original_code:
char *errorToStr(unsigned int error) {
 if ((error>=0) && (error<=16))
  return messErreur[error];
 return messDefault;
}


showRef

decompiled_code:
int __fastcall showRef(const char *a1, int a2)
{
int v2; // ebx

puts(a1);
if ( a2 > 0 )
{
v2 = 1;
do
{
putchar(32);
++v2;
}
while ( v2 != a2 + 1 );
}
return puts("^");
}

canonical_decompiled_code:
int __fastcall func1(const char *a1, int a2)
{
int v2; // ebx

puts(a1);
if ( a2 > 0 )
{
v2 = 1;
do
{
putchar(32);
++v2;
}
while ( v2 != a2 + 1 );
}
return puts("^");
}

original_code:
char *showRef(char *chaine, int offset) {
 int i=0;
 printf("%s\n",chaine);
 while (i++ < offset)
  printf(" ");
 printf("^\n");
}

canonical_original_code:
char *showRef(char *chaine, int offset) {
 int i = 0;
 printf("%s\n",chaine);
 while (i++ < offset)
  printf(" ");
 printf("^\n");
}

variable_types:
chaine
char *

variable_types: offset int


FatalError

decompiled_code:
void __fastcall __noreturn FatalError(const char *a1)
{
printf("Fatal Error: %s\n", a1);
exit(1);
}

canonical_decompiled_code:
void __fastcall __noreturn func0(const char *a1)
{
printf("Fatal Error: %s\n", a1);
exit(1);
}

original_code:
void FatalError(char *sb)
{
    int cc;
    cc = printf("Fatal Error: %s\n", sb);
    exit(1);
}

variable_types:
sb
char *

variable_types: cc int


decompiled_code:
int __fastcall yy_stack_print(__int16 *a1, unsigned __int64 a2)
{
__int16 *v2; // rbx

v2 = a1;
fwrite("Stack now", 1uLL, 9uLL, stderr);
if ( (unsigned __int64)a1 <= a2 )
{
do
fprintf(stderr, " %d", (unsigned int)*v2++);
while ( a2 >= (unsigned __int64)v2 );
}
return fputc(10, stderr);
}

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

v2 = a1;
fwrite("Stack now", 1uLL, 9uLL, stderr);
if ( (unsigned __int64)a1 <= a2 )
{
do
fprintf(stderr, " %d", (unsigned int)*v2++);
while ( a2 >= (unsigned __int64)v2 );
}
return fputc(10, stderr);
}

original_code:
static void
yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop)
{
  fprintf (stderr, "Stack now");
  for (; yybottom <= yytop; yybottom++)
    {
      int yybot = *yybottom;
      fprintf (stderr, " %d", yybot);
    }
  fprintf (stderr, "\n");
}

canonical_original_code:
static void yy_stack_print(short *yybottom, short *yytop)
{
  fprintf (stderr, "Stack now");
  for (; yybottom <= yytop; yybottom++)
    {
      int yybot = *yybottom;
      fprintf (stderr, " %d", yybot);
    }
  fprintf (stderr, "\n");
}

variable_types:
yybottom
short *

variable_types:
yytop
short *

variable_types: yybot int


yyparse

decompiled_code:
__int64 yyparse()
{
unsigned __int64 v0; // r15
char *v1; // rbp
char *v2; // rbx
__int16 *v3; // r13
unsigned int v4; // er12
unsigned __int64 v5; // rax
signed __int64 v6; // r14
__int16 *v7; // rax
__int16 *v8; // rbx
size_t v9; // rbp
int v10; // er14
int v11; // er14
unsigned int v12; // er14
int v13; // eax
int v14; // esi
unsigned int v15; // er12
int v16; // esi
unsigned __int8 v17; // r12
__int64 v18; // rax
char *v19; // r12
int v20; // eax
int v21; // ecx
unsigned int v22; // edx
__int64 v23; // rax
int v24; // eax
unsigned int v25; // eax
char *v26; // rbp
__int16 *v27; // rbx
__int16 *ptr; // [rsp+8h] [rbp-840h]
int ptra; // [rsp+8h] [rbp-840h]
unsigned int ptrb; // [rsp+8h] [rbp-840h]
char *v32; // [rsp+10h] [rbp-838h]
__int64 v33; // [rsp+18h] [rbp-830h]
char *v34; // [rsp+18h] [rbp-830h]
int v35; // [rsp+24h] [rbp-824h]
__int64 v36; // [rsp+28h] [rbp-820h]
__int64 v37; // [rsp+38h] [rbp-810h]
char v38[1600]; // [rsp+40h] [rbp-808h] BYREF
char src[456]; // [rsp+680h] [rbp-1C8h] BYREF

if ( yydebug )
fwrite("Starting parse\n", 1uLL, 0xFuLL, stderr);
yynerrs = 0;
yychar = -2;
v0 = 200LL;
v1 = v38;
v32 = v38;
v2 = src;
v3 = (__int16 *)src;
v35 = 0;
v4 = 0;
while ( 1 )
{
*(_WORD *)v2 = v4;
v5 = 2 * v0;
if ( v2 >= (char *)&v3[v0 - 1] )
break;
LABEL_16:
if ( yydebug )
fprintf(stderr, "Entering state %d\n", v4);
LABEL_18:
if ( v4 == 13 )
{
v10 = 0;
v15 = 0;
goto LABEL_104;
}
v11 = yypact[v4];
if ( v11 != -18 )
{
if ( yychar == -2 )
{
if ( yydebug )
fwrite("Reading a token: ", 1uLL, 0x11uLL, stderr);
yychar = yylex();
}
if ( yychar <= 0 )
{
yychar = 0;
ptra = yydebug;
if ( yydebug )
{
fwrite("Now at end of input.\n", 1uLL, 0x15uLL, stderr);
ptra = 0;
}
}
else
{
ptra = 2;
if ( (unsigned int)yychar <= 0x11A )
ptra = (unsigned __int8)yytranslate[yychar];
if ( yydebug )
{
fprintf(stderr, "%s ", "Next token is");
yy_symbol_print(stderr, ptra);
fputc(10, stderr);
}
}
v12 = ptra + v11;
if ( v12 <= 0x34 && (unsigned __int8)yycheck[v12] == ptra )
{
v4 = (unsigned __int8)yytable[v12];
if ( yytable[v12] )
{
v35 = (v35 == 0) + v35 - 1;
if ( yydebug )
{
fprintf(stderr, "%s ", "Shifting");
yy_symbol_print(stderr, ptra);
fputc(10, stderr);
}
yychar = -2;
*((_QWORD *)v1 + 1) = yylval;
v1 += 8;
goto LABEL_67;
}
v10 = 0;
LABEL_48:
v17 = yyr2[v10];
v37 = *(_QWORD *)&v1[8 * (1 - v17)];
if ( !yydebug )
{
switch ( v10 )
{
case 2:
goto LABEL_51;
case 3:
goto LABEL_52;
case 4:
goto LABEL_53;
case 5:
goto LABEL_54;
case 6:
goto LABEL_55;
case 7:
goto LABEL_56;
case 8:
goto LABEL_57;
case 9:
goto LABEL_58;
case 10:
goto LABEL_59;
case 11:
goto LABEL_60;
case 12:
case 26:
goto LABEL_61;
case 13:
goto LABEL_68;
case 14:
goto LABEL_69;
case 15:
goto LABEL_70;
case 16:
goto LABEL_71;
case 17:
goto LABEL_72;
case 18:
goto LABEL_73;
case 19:
goto LABEL_74;
case 20:
goto LABEL_75;
case 21:
goto LABEL_76;
case 22:
goto LABEL_77;
case 23:
goto LABEL_78;
case 24:
goto LABEL_79;
case 25:
goto LABEL_80;
case 27:
goto LABEL_81;
case 28:
goto LABEL_82;
case 29:
goto LABEL_83;
case 30:
goto LABEL_84;
default:
goto LABEL_63;
}
}
yy_reduce_print((__int64)v2, (__int64)v1, v10);
switch ( v10 )
{
case 2:
LABEL_51:
YaccDebug("command2 EOL");
v10 = v17;
v15 = 0;
goto LABEL_104;
case 3:
LABEL_52:
YaccDebug("command2 pipe_list EOL");
v10 = v17;
v15 = 0;
goto LABEL_104;
case 4:
LABEL_53:
YaccDebug("command2 input EOL");
v10 = v17;
v15 = 0;
goto LABEL_104;
case 5:
LABEL_54:
YaccDebug("command2 output EOL");
v10 = v17;
v15 = 0;
goto LABEL_104;
case 6:
LABEL_55:
YaccDebug("command2 pipe_list input EOL");
v10 = v17;
v15 = 0;
goto LABEL_104;
case 7:
LABEL_56:
YaccDebug("command2 pipe_list output EOL");
v10 = v17;
v15 = 0;
goto LABEL_104;
case 8:
LABEL_57:
YaccDebug("command2 input output EOL");
v10 = v17;
v15 = 0;
goto LABEL_104;
case 9:
LABEL_58:
YaccDebug("command2 pipe_list input output EOL");
v10 = v17;
v15 = 0;
goto LABEL_104;
case 10:
LABEL_59:
YaccDebug("error EOL");
v10 = v17;
v15 = 1;
goto LABEL_104;
case 11:
LABEL_60:
YaccDebug("EOL");
v10 = v17;
v15 = 0;
goto LABEL_104;
case 12:
case 26:
LABEL_61:
YaccDebug("WORD");
goto LABEL_62;
case 13:
LABEL_68:
YaccDebug("WORD arg_list");
goto LABEL_62;
case 14:
LABEL_69:
YaccDebug("PIPE command2");
goto LABEL_62;
case 15:
LABEL_70:
YaccDebug("pipe");
goto LABEL_62;
case 16:
LABEL_71:
YaccDebug("pipe pipe_list");
goto LABEL_62;
case 17:
LABEL_72:
YaccDebug("LESS WORD");
goto LABEL_62;
case 18:
LABEL_73:
YaccDebug("output2");
goto LABEL_62;
case 19:
LABEL_74:
YaccDebug("output2 error_redir");
goto LABEL_62;
case 20:
LABEL_75:
YaccDebug("error_redir");
goto LABEL_62;
case 21:
LABEL_76:
YaccDebug("GREATER WORD");
goto LABEL_62;
case 22:
LABEL_77:
YaccDebug("GTGT WORD");
goto LABEL_62;
case 23:
LABEL_78:
YaccDebug("TWOGT WORD");
goto LABEL_62;
case 24:
LABEL_79:
YaccDebug("GTAMP");
goto LABEL_62;
case 25:
LABEL_80:
YaccDebug("INTEGER");
goto LABEL_62;
case 27:
LABEL_81:
YaccDebug("STRING");
goto LABEL_62;
case 28:
LABEL_82:
YaccDebug("MINUS arg");
goto LABEL_62;
case 29:
LABEL_83:
YaccDebug("arg");
goto LABEL_62;
case 30:
LABEL_84:
YaccDebug("arg_list");
goto LABEL_62;
default:
LABEL_62:
if ( yydebug )
{
fprintf(stderr, "%s ", "-> $$ =");
yy_symbol_print(stderr, (unsigned __int8)yyr1[v10]);
fputc(10, stderr);
v23 = v17;
v19 = &v1[-8 * v17];
v2 -= 2 * v23;
if ( yydebug )
yy_stack_print(v3, (unsigned __int64)v2);
}
else
{
LABEL_63:
v18 = v17;
v19 = &v1[-8 * v17];
v2 -= 2 * v18;
}
v1 = v19 + 8;
*((_QWORD *)v19 + 1) = v37;
v20 = (unsigned __int8)yyr1[v10] - 28;
v21 = *(__int16 *)v2;
v22 = v21 + yypgoto[v20];
if ( v22 <= 0x34 && v21 == (unsigned __int8)yycheck[v22] )
v4 = (unsigned __int8)yytable[v22];
else
v4 = yydefgoto[v20];
break;
}
goto LABEL_67;
}
}
v10 = (unsigned __int8)yydefact[v4];
if ( yydefact[v4] )
goto LABEL_48;
v13 = yychar;
v14 = yychar;
if ( yychar != -2 )
{
v14 = 2;
if ( (unsigned int)yychar <= 0x11A )
v14 = (unsigned __int8)yytranslate[yychar];
}
if ( !v35 )
{
++yynerrs;
yyerror("syntax error");
goto LABEL_93;
}
if ( v35 == 3 )
{
if ( yychar > 0 )
{
yydestruct("Error: discarding", v14);
yychar = -2;
goto LABEL_93;
}
if ( !yychar )
{
v10 = 0;
v15 = 1;
LABEL_46:
v16 = (unsigned __int8)yytranslate[v13];
goto LABEL_106;
}
}
LABEL_93:
while ( 1 )
{
v24 = yypact[v4];
if ( v24 != -18 )
{
v25 = v24 + 1;
if ( v25 <= 0x34 && yycheck[v25] == 1 )
{
ptrb = (unsigned __int8)yytable[v25];
if ( yytable[v25] )
break;
}
}
if ( v2 == (char *)v3 )
{
v2 = (char *)v3;
v15 = 1;
goto LABEL_104;
}
yydestruct("Error: popping", (unsigned __int8)yystos[v4]);
v1 -= 8;
v2 -= 2;
v4 = *(__int16 *)v2;
if ( yydebug )
yy_stack_print(v3, (unsigned __int64)v2);
}
*((_QWORD *)v1 + 1) = yylval;
if ( yydebug )
{
fprintf(stderr, "%s ", "Shifting");
yy_symbol_print(stderr, (unsigned __int8)yystos[ptrb]);
fputc(10, stderr);
}
v1 += 8;
v4 = ptrb;
v35 = 3;
LABEL_67:
v2 += 2;
}
v6 = v2 - (char *)v3;
v33 = ((v2 - (char *)v3) >> 1) + 1;
if ( v0 > 0x270F )
goto LABEL_100;
v0 = 10000LL;
if ( v5 <= 0x2710 )
v0 = v5;
v7 = (__int16 *)malloc(10 * v0 + 7);
ptr = v7;
if ( !v7 )
{
LABEL_100:
yyerror("memory exhausted");
v10 = 0;
v15 = 2;
goto LABEL_104;
}
v8 = v7;
memcpy(v7, v3, v6 + 2);
v9 = 8 * v33;
v36 = v0;
v34 = (char *)&v8[v0];
memcpy(v34, v32, v9);
if ( v3 != (__int16 *)src )
free(v3);
v2 = (char *)ptr + v6;
v1 = &v34[v9 - 8];
v10 = yydebug;
if ( yydebug )
{
fprintf(stderr, "Stack size increased to %lu\n", v0);
v3 = ptr;
if ( v2 >= (char *)&ptr[v36 - 1] )
{
v3 = ptr;
v10 = 0;
v15 = 1;
goto LABEL_104;
}
v32 = v34;
goto LABEL_16;
}
v3 = ptr;
if ( v2 < (char *)&ptr[v36 - 1] )
{
v32 = v34;
goto LABEL_18;
}
v3 = ptr;
v15 = 1;
LABEL_104:
v13 = yychar;
if ( yychar == -2 )
goto LABEL_107;
v16 = 2;
if ( (unsigned int)yychar <= 0x11A )
goto LABEL_46;
LABEL_106:
yydestruct("Cleanup: discarding lookahead", v16);
LABEL_107:
v26 = &v1[-8 * v10];
v27 = (__int16 *)&v2[-2 * v10];
if ( yydebug )
yy_stack_print(v3, (unsigned __int64)v27);
for ( ; v27 != v3; --v27 )
{
yydestruct("Cleanup: popping", (unsigned __int8)yystos[*v27]);
v26 -= 8;
}
if ( v3 != (__int16 *)src )
free(v3);
return v15;
}

canonical_decompiled_code:
__int64 func6()
{
unsigned __int64 v0; // r15
char *v1; // rbp
char *v2; // rbx
__int16 *v3; // r13
unsigned int v4; // er12
unsigned __int64 v5; // rax
signed __int64 v6; // r14
__int16 *v7; // rax
__int16 *v8; // rbx
size_t v9; // rbp
int v10; // er14
int v11; // er14
unsigned int v12; // er14
int v13; // eax
int v14; // esi
unsigned int v15; // er12
int v16; // esi
unsigned __int8 v17; // r12
__int64 v18; // rax
char *v19; // r12
int v20; // eax
int v21; // ecx
unsigned int v22; // edx
__int64 v23; // rax
int v24; // eax
unsigned int v25; // eax
char *v26; // rbp
__int16 *v27; // rbx
__int16 *ptr; // [rsp+8h] [rbp-840h]
int ptra; // [rsp+8h] [rbp-840h]
unsigned int ptrb; // [rsp+8h] [rbp-840h]
char *v32; // [rsp+10h] [rbp-838h]
__int64 v33; // [rsp+18h] [rbp-830h]
char *v34; // [rsp+18h] [rbp-830h]
int v35; // [rsp+24h] [rbp-824h]
__int64 v36; // [rsp+28h] [rbp-820h]
__int64 v37; // [rsp+38h] [rbp-810h]
char v38[1600]; // [rsp+40h] [rbp-808h] BYREF
char src[456]; // [rsp+680h] [rbp-1C8h] BYREF

if ( yydebug )
fwrite("Starting parse\n", 1uLL, 0xFuLL, stderr);
yynerrs = 0;
yychar = -2;
v0 = 200LL;
v1 = v38;
v32 = v38;
v2 = src;
v3 = (__int16 *)src;
v35 = 0;
v4 = 0;
while ( 1 )
{
*(_WORD *)v2 = v4;
v5 = 2 * v0;
if ( v2 >= (char *)&v3[v0 - 1] )
break;
LABEL_16:
if ( yydebug )
fprintf(stderr, "Entering state %d\n", v4);
LABEL_18:
if ( v4 == 13 )
{
v10 = 0;
v15 = 0;
goto LABEL_104;
}
v11 = yypact[v4];
if ( v11 != -18 )
{
if ( yychar == -2 )
{
if ( yydebug )
fwrite("Reading a token: ", 1uLL, 0x11uLL, stderr);
yychar = yylex();
}
if ( yychar <= 0 )
{
yychar = 0;
ptra = yydebug;
if ( yydebug )
{
fwrite("Now at end of input.\n", 1uLL, 0x15uLL, stderr);
ptra = 0;
}
}
else
{
ptra = 2;
if ( (unsigned int)yychar <= 0x11A )
ptra = (unsigned __int8)yytranslate[yychar];
if ( yydebug )
{
fprintf(stderr, "%s ", "Next token is");
func0(stderr, ptra);
fputc(10, stderr);
}
}
v12 = ptra + v11;
if ( v12 <= 0x34 && (unsigned __int8)yycheck[v12] == ptra )
{
v4 = (unsigned __int8)yytable[v12];
if ( yytable[v12] )
{
v35 = (v35 == 0) + v35 - 1;
if ( yydebug )
{
fprintf(stderr, "%s ", "Shifting");
func0(stderr, ptra);
fputc(10, stderr);
}
yychar = -2;
*((_QWORD *)v1 + 1) = yylval;
v1 += 8;
goto LABEL_67;
}
v10 = 0;
LABEL_48:
v17 = yyr2[v10];
v37 = *(_QWORD *)&v1[8 * (1 - v17)];
if ( !yydebug )
{
switch ( v10 )
{
case 2:
goto LABEL_51;
case 3:
goto LABEL_52;
case 4:
goto LABEL_53;
case 5:
goto LABEL_54;
case 6:
goto LABEL_55;
case 7:
goto LABEL_56;
case 8:
goto LABEL_57;
case 9:
goto LABEL_58;
case 10:
goto LABEL_59;
case 11:
goto LABEL_60;
case 12:
case 26:
goto LABEL_61;
case 13:
goto LABEL_68;
case 14:
goto LABEL_69;
case 15:
goto LABEL_70;
case 16:
goto LABEL_71;
case 17:
goto LABEL_72;
case 18:
goto LABEL_73;
case 19:
goto LABEL_74;
case 20:
goto LABEL_75;
case 21:
goto LABEL_76;
case 22:
goto LABEL_77;
case 23:
goto LABEL_78;
case 24:
goto LABEL_79;
case 25:
goto LABEL_80;
case 27:
goto LABEL_81;
case 28:
goto LABEL_82;
case 29:
goto LABEL_83;
case 30:
goto LABEL_84;
default:
goto LABEL_63;
}
}
func1((__int64)v2, (__int64)v1, v10);
switch ( v10 )
{
case 2:
LABEL_51:
func5("command2 EOL");
v10 = v17;
v15 = 0;
goto LABEL_104;
case 3:
LABEL_52:
func5("command2 pipe_list EOL");
v10 = v17;
v15 = 0;
goto LABEL_104;
case 4:
LABEL_53:
func5("command2 input EOL");
v10 = v17;
v15 = 0;
goto LABEL_104;
case 5:
LABEL_54:
func5("command2 output EOL");
v10 = v17;
v15 = 0;
goto LABEL_104;
case 6:
LABEL_55:
func5("command2 pipe_list input EOL");
v10 = v17;
v15 = 0;
goto LABEL_104;
case 7:
LABEL_56:
func5("command2 pipe_list output EOL");
v10 = v17;
v15 = 0;
goto LABEL_104;
case 8:
LABEL_57:
func5("command2 input output EOL");
v10 = v17;
v15 = 0;
goto LABEL_104;
case 9:
LABEL_58:
func5("command2 pipe_list input output EOL");
v10 = v17;
v15 = 0;
goto LABEL_104;
case 10:
LABEL_59:
func5("error EOL");
v10 = v17;
v15 = 1;
goto LABEL_104;
case 11:
LABEL_60:
func5("EOL");
v10 = v17;
v15 = 0;
goto LABEL_104;
case 12:
case 26:
LABEL_61:
func5("WORD");
goto LABEL_62;
case 13:
LABEL_68:
func5("WORD arg_list");
goto LABEL_62;
case 14:
LABEL_69:
func5("PIPE command2");
goto LABEL_62;
case 15:
LABEL_70:
func5("pipe");
goto LABEL_62;
case 16:
LABEL_71:
func5("pipe pipe_list");
goto LABEL_62;
case 17:
LABEL_72:
func5("LESS WORD");
goto LABEL_62;
case 18:
LABEL_73:
func5("output2");
goto LABEL_62;
case 19:
LABEL_74:
func5("output2 error_redir");
goto LABEL_62;
case 20:
LABEL_75:
func5("error_redir");
goto LABEL_62;
case 21:
LABEL_76:
func5("GREATER WORD");
goto LABEL_62;
case 22:
LABEL_77:
func5("GTGT WORD");
goto LABEL_62;
case 23:
LABEL_78:
func5("TWOGT WORD");
goto LABEL_62;
case 24:
LABEL_79:
func5("GTAMP");
goto LABEL_62;
case 25:
LABEL_80:
func5("INTEGER");
goto LABEL_62;
case 27:
LABEL_81:
func5("STRING");
goto LABEL_62;
case 28:
LABEL_82:
func5("MINUS arg");
goto LABEL_62;
case 29:
LABEL_83:
func5("arg");
goto LABEL_62;
case 30:
LABEL_84:
func5("arg_list");
goto LABEL_62;
default:
LABEL_62:
if ( yydebug )
{
fprintf(stderr, "%s ", "-> $$ =");
func0(stderr, (unsigned __int8)yyr1[v10]);
fputc(10, stderr);
v23 = v17;
v19 = &v1[-8 * v17];
v2 -= 2 * v23;
if ( yydebug )
func2(v3, (unsigned __int64)v2);
}
else
{
LABEL_63:
v18 = v17;
v19 = &v1[-8 * v17];
v2 -= 2 * v18;
}
v1 = v19 + 8;
*((_QWORD *)v19 + 1) = v37;
v20 = (unsigned __int8)yyr1[v10] - 28;
v21 = *(__int16 *)v2;
v22 = v21 + yypgoto[v20];
if ( v22 <= 0x34 && v21 == (unsigned __int8)yycheck[v22] )
v4 = (unsigned __int8)yytable[v22];
else
v4 = yydefgoto[v20];
break;
}
goto LABEL_67;
}
}
v10 = (unsigned __int8)yydefact[v4];
if ( yydefact[v4] )
goto LABEL_48;
v13 = yychar;
v14 = yychar;
if ( yychar != -2 )
{
v14 = 2;
if ( (unsigned int)yychar <= 0x11A )
v14 = (unsigned __int8)yytranslate[yychar];
}
if ( !v35 )
{
++yynerrs;
func4("syntax error");
goto LABEL_93;
}
if ( v35 == 3 )
{
if ( yychar > 0 )
{
func3("Error: discarding", v14);
yychar = -2;
goto LABEL_93;
}
if ( !yychar )
{
v10 = 0;
v15 = 1;
LABEL_46:
v16 = (unsigned __int8)yytranslate[v13];
goto LABEL_106;
}
}
LABEL_93:
while ( 1 )
{
v24 = yypact[v4];
if ( v24 != -18 )
{
v25 = v24 + 1;
if ( v25 <= 0x34 && yycheck[v25] == 1 )
{
ptrb = (unsigned __int8)yytable[v25];
if ( yytable[v25] )
break;
}
}
if ( v2 == (char *)v3 )
{
v2 = (char *)v3;
v15 = 1;
goto LABEL_104;
}
func3("Error: popping", (unsigned __int8)yystos[v4]);
v1 -= 8;
v2 -= 2;
v4 = *(__int16 *)v2;
if ( yydebug )
func2(v3, (unsigned __int64)v2);
}
*((_QWORD *)v1 + 1) = yylval;
if ( yydebug )
{
fprintf(stderr, "%s ", "Shifting");
func0(stderr, (unsigned __int8)yystos[ptrb]);
fputc(10, stderr);
}
v1 += 8;
v4 = ptrb;
v35 = 3;
LABEL_67:
v2 += 2;
}
v6 = v2 - (char *)v3;
v33 = ((v2 - (char *)v3) >> 1) + 1;
if ( v0 > 0x270F )
goto LABEL_100;
v0 = 10000LL;
if ( v5 <= 0x2710 )
v0 = v5;
v7 = (__int16 *)malloc(10 * v0 + 7);
ptr = v7;
if ( !v7 )
{
LABEL_100:
func4("memory exhausted");
v10 = 0;
v15 = 2;
goto LABEL_104;
}
v8 = v7;
memcpy(v7, v3, v6 + 2);
v9 = 8 * v33;
v36 = v0;
v34 = (char *)&v8[v0];
memcpy(v34, v32, v9);
if ( v3 != (__int16 *)src )
free(v3);
v2 = (char *)ptr + v6;
v1 = &v34[v9 - 8];
v10 = yydebug;
if ( yydebug )
{
fprintf(stderr, "Stack size increased to %lu\n", v0);
v3 = ptr;
if ( v2 >= (char *)&ptr[v36 - 1] )
{
v3 = ptr;
v10 = 0;
v15 = 1;
goto LABEL_104;
}
v32 = v34;
goto LABEL_16;
}
v3 = ptr;
if ( v2 < (char *)&ptr[v36 - 1] )
{
v32 = v34;
goto LABEL_18;
}
v3 = ptr;
v15 = 1;
LABEL_104:
v13 = yychar;
if ( yychar == -2 )
goto LABEL_107;
v16 = 2;
if ( (unsigned int)yychar <= 0x11A )
goto LABEL_46;
LABEL_106:
func3("Cleanup: discarding lookahead", v16);
LABEL_107:
v26 = &v1[-8 * v10];
v27 = (__int16 *)&v2[-2 * v10];
if ( yydebug )
func2(v3, (unsigned __int64)v27);
for ( ; v27 != v3; --v27 )
{
func3("Cleanup: popping", (unsigned __int8)yystos[*v27]);
v26 -= 8;
}
if ( v3 != (__int16 *)src )
free(v3);
return v15;
}

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;
  do { if (yydebug) fprintf (stderr, "Starting parse\n"); } while (0);
  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;
      do { if (yydebug) fprintf (stderr, "Stack size increased to %lu\n", (unsigned long) yystacksize); } while (0);
      if (yyss + yystacksize - 1 <= yyssp)
        goto yyabortlab;
    }
  do { if (yydebug) fprintf (stderr, "Entering state %d\n", yystate); } while (0);
  if (yystate == 13)
    goto yyacceptlab;
  goto yybackup;
yybackup:
  yyn = yypact[yystate];
  if ((!!((yyn) == (-18))))
    goto yydefault;
  if (yychar == (-2))
    {
      do { if (yydebug) fprintf (stderr, "Reading a token: "); } while (0);
      yychar = yylex ();
    }
  if (yychar <= 0)
    {
      yychar = yytoken = 0;
      do { if (yydebug) fprintf (stderr, "Now at end of input.\n"); } while (0);
    }
  else
    {
      yytoken = ((unsigned) (yychar) <= 282 ? yytranslate[yychar] : 2);
      do { if (yydebug) { fprintf (stderr, "%s ", "Next token is"); yy_symbol_print (stderr, yytoken, &yylval); fprintf (stderr, "\n"); } } while (0);
    }
  yyn += yytoken;
  if (yyn < 0 || 52 < yyn || yycheck[yyn] != yytoken)
    goto yydefault;
  yyn = yytable[yyn];
  if (yyn <= 0)
    {
      if (0)
        goto yyerrlab;
      yyn = -yyn;
      goto yyreduce;
    }
  if (yyerrstatus)
    yyerrstatus--;
  do { if (yydebug) { fprintf (stderr, "%s ", "Shifting"); yy_symbol_print (stderr, yytoken, &yylval); fprintf (stderr, "\n"); } } while (0);
  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];
  do { if (yydebug) yy_reduce_print (yyssp, yyvsp, yyn); } while (0);
  switch (yyn)
    {
        case 2:
    {
       YaccDebug("command2 EOL");
       goto yyacceptlab;
   }
    break;
  case 3:
    {
       YaccDebug("command2 pipe_list EOL");
       goto yyacceptlab;
   }
    break;
  case 4:
    {
       YaccDebug("command2 input EOL");
       goto yyacceptlab;
   }
    break;
  case 5:
    {
       YaccDebug("command2 output EOL");
       goto yyacceptlab;
   }
    break;
  case 6:
    {
       YaccDebug("command2 pipe_list input EOL");
       goto yyacceptlab;
   }
    break;
  case 7:
    {
       YaccDebug("command2 pipe_list output EOL");
       goto yyacceptlab;
   }
    break;
  case 8:
    {
       YaccDebug("command2 input output EOL");
       goto yyacceptlab;
   }
    break;
  case 9:
    {
       YaccDebug("command2 pipe_list input output EOL");
       goto yyacceptlab;
   }
    break;
  case 10:
    {
       YaccDebug("error EOL");
       goto yyabortlab;
   }
    break;
  case 11:
    {
       YaccDebug("EOL");
       goto yyacceptlab;
   }
    break;
  case 12:
    {
       YaccDebug("WORD");
   }
    break;
  case 13:
    {
       YaccDebug("WORD arg_list");
   }
    break;
  case 14:
    {
       YaccDebug("PIPE command2");
   }
    break;
  case 15:
    {
       YaccDebug("pipe");
   }
    break;
  case 16:
    {
       YaccDebug("pipe pipe_list");
   }
    break;
  case 17:
    {
       YaccDebug("LESS WORD");
   }
    break;
  case 18:
    {
       YaccDebug("output2");
   }
    break;
  case 19:
    {
       YaccDebug("output2 error_redir");
   }
    break;
  case 20:
    {
       YaccDebug("error_redir");
   }
    break;
  case 21:
    {
       YaccDebug("GREATER WORD");
   }
    break;
  case 22:
    {
       YaccDebug("GTGT WORD");
       }
    break;
  case 23:
    {
       YaccDebug("TWOGT WORD");
   }
    break;
  case 24:
    {
       YaccDebug("GTAMP");
   }
    break;
  case 25:
    {
       YaccDebug("INTEGER");
   }
    break;
  case 26:
    {
       YaccDebug("WORD");
   }
    break;
  case 27:
    {
       YaccDebug("STRING");
   }
    break;
  case 28:
    {
       YaccDebug("MINUS arg");
   }
    break;
  case 29:
    {
       YaccDebug("arg");
   }
    break;
  case 30:
    {
       YaccDebug("arg_list");
   }
    break;
      default: break;
    }
  do { if (yydebug) { fprintf (stderr, "%s ", "-> $$ ="); yy_symbol_print (stderr, yyr1[yyn], &yyval); fprintf (stderr, "\n"); } } while (0);
  (yyvsp -= (yylen), yyssp -= (yylen));
  yylen = 0;
  do { if (yydebug) yy_stack_print ((yyss), (yyssp)); } while (0);
  *++yyvsp = yyval;
  {
    const int yylhs = yyr1[yyn] - 28;
    const int yyi = yypgoto[yylhs] + *yyssp;
    yystate = (0 <= yyi && yyi <= 52 && yycheck[yyi] == *yyssp
               ? yytable[yyi]
               : yydefgoto[yylhs]);
  }
  goto yynewstate;
yyerrlab:
  yytoken = yychar == (-2) ? (-2) : ((unsigned) (yychar) <= 282 ? 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;
  do { if (yydebug) yy_stack_print ((yyss), (yyssp)); } while (0);
  yystate = *yyssp;
  goto yyerrlab1;
yyerrlab1:
  yyerrstatus = 3;
  for (;;)
    {
      yyn = yypact[yystate];
      if (!(!!((yyn) == (-18))))
        {
          yyn += 1;
          if (0 <= yyn && yyn <= 52 && 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;
      do { if (yydebug) yy_stack_print ((yyss), (yyssp)); } while (0);
    }

#pragma GCC diagnostic push

#pragma GCC diagnostic ignored "-Wuninitialized"

#pragma GCC diagnostic ignored "-Wmaybe-uninitialized"

  *++yyvsp = yylval;

#pragma GCC diagnostic pop

  do { if (yydebug) { fprintf (stderr, "%s ", "Shifting"); yy_symbol_print (stderr, yystos[yyn], yyvsp); fprintf (stderr, "\n"); } } while (0);
  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) <= 282 ? yytranslate[yychar] : 2);
      yydestruct ("Cleanup: discarding lookahead",
                  yytoken, &yylval);
    }
  (yyvsp -= (yylen), yyssp -= (yylen));
  do { if (yydebug) yy_stack_print ((yyss), (yyssp)); } while (0);
  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;
  do { if (yydebug) fprintf (stderr, "Starting parse\n"); } while (0);
  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;
      do { if (yydebug) fprintf (stderr, "Stack size increased to %lu\n", (unsigned long) yystacksize); } while (0);
      if (yyss + yystacksize - 1 <= yyssp)
        goto yyabortlab;
    }
  do { if (yydebug) fprintf (stderr, "Entering state %d\n", yystate); } while (0);
  if (yystate == 13)
    goto yyacceptlab;
  goto yybackup;
yybackup:
  yyn = yypact[yystate];
  if ((!!((yyn) == (-18))))
    goto yydefault;
  if (yychar == (-2))
    {
      do { if (yydebug) fprintf (stderr, "Reading a token: "); } while (0);
      yychar = yylex ();
    }
  if (yychar <= 0)
    {
      yychar = yytoken = 0;
      do { if (yydebug) fprintf (stderr, "Now at end of input.\n"); } while (0);
    }
  else
    {
      yytoken = ((unsigned int) (yychar) <= 282 ? yytranslate[yychar] : 2);
      do { if (yydebug) { fprintf (stderr, "%s ", "Next token is"); yy_symbol_print (stderr, yytoken, &yylval); fprintf (stderr, "\n"); } } while (0);
    }
  yyn += yytoken;
  if (yyn < 0 || 52 < yyn || yycheck[yyn] != yytoken)
    goto yydefault;
  yyn = yytable[yyn];
  if (yyn <= 0)
    {
      if (0)
        goto yyerrlab;
      yyn = -yyn;
      goto yyreduce;
    }
  if (yyerrstatus)
    yyerrstatus--;
  do { if (yydebug) { fprintf (stderr, "%s ", "Shifting"); yy_symbol_print (stderr, yytoken, &yylval); fprintf (stderr, "\n"); } } while (0);
  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];
  do { if (yydebug) yy_reduce_print (yyssp, yyvsp, yyn); } while (0);
  switch (yyn)
    {
        case 2:
    {
       YaccDebug("command2 EOL");
       goto yyacceptlab;
   }
    break;
  case 3:
    {
       YaccDebug("command2 pipe_list EOL");
       goto yyacceptlab;
   }
    break;
  case 4:
    {
       YaccDebug("command2 input EOL");
       goto yyacceptlab;
   }
    break;
  case 5:
    {
       YaccDebug("command2 output EOL");
       goto yyacceptlab;
   }
    break;
  case 6:
    {
       YaccDebug("command2 pipe_list input EOL");
       goto yyacceptlab;
   }
    break;
  case 7:
    {
       YaccDebug("command2 pipe_list output EOL");
       goto yyacceptlab;
   }
    break;
  case 8:
    {
       YaccDebug("command2 input output EOL");
       goto yyacceptlab;
   }
    break;
  case 9:
    {
       YaccDebug("command2 pipe_list input output EOL");
       goto yyacceptlab;
   }
    break;
  case 10:
    {
       YaccDebug("error EOL");
       goto yyabortlab;
   }
    break;
  case 11:
    {
       YaccDebug("EOL");
       goto yyacceptlab;
   }
    break;
  case 12:
    {
       YaccDebug("WORD");
   }
    break;
  case 13:
    {
       YaccDebug("WORD arg_list");
   }
    break;
  case 14:
    {
       YaccDebug("PIPE command2");
   }
    break;
  case 15:
    {
       YaccDebug("pipe");
   }
    break;
  case 16:
    {
       YaccDebug("pipe pipe_list");
   }
    break;
  case 17:
    {
       YaccDebug("LESS WORD");
   }
    break;
  case 18:
    {
       YaccDebug("output2");
   }
    break;
  case 19:
    {
       YaccDebug("output2 error_redir");
   }
    break;
  case 20:
    {
       YaccDebug("error_redir");
   }
    break;
  case 21:
    {
       YaccDebug("GREATER WORD");
   }
    break;
  case 22:
    {
       YaccDebug("GTGT WORD");
       }
    break;
  case 23:
    {
       YaccDebug("TWOGT WORD");
   }
    break;
  case 24:
    {
       YaccDebug("GTAMP");
   }
    break;
  case 25:
    {
       YaccDebug("INTEGER");
   }
    break;
  case 26:
    {
       YaccDebug("WORD");
   }
    break;
  case 27:
    {
       YaccDebug("STRING");
   }
    break;
  case 28:
    {
       YaccDebug("MINUS arg");
   }
    break;
  case 29:
    {
       YaccDebug("arg");
   }
    break;
  case 30:
    {
       YaccDebug("arg_list");
   }
    break;
      default: break;
    }
  do { if (yydebug) { fprintf (stderr, "%s ", "-> $$ ="); yy_symbol_print (stderr, yyr1[yyn], &yyval); fprintf (stderr, "\n"); } } while (0);
  (yyvsp -= (yylen), yyssp -= (yylen));
  yylen = 0;
  do { if (yydebug) yy_stack_print ((yyss), (yyssp)); } while (0);
  *++yyvsp = yyval;
  {
    int yylhs = yyr1[yyn] - 28;
    int yyi = yypgoto[yylhs] + *yyssp;
    yystate = (0 <= yyi && yyi <= 52 && yycheck[yyi] == *yyssp
               ? yytable[yyi]
               : yydefgoto[yylhs]);
  }
  goto yynewstate;
yyerrlab:
  yytoken = yychar == (-2) ? (-2) : ((unsigned int) (yychar) <= 282 ? 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;
  do { if (yydebug) yy_stack_print ((yyss), (yyssp)); } while (0);
  yystate = *yyssp;
  goto yyerrlab1;
yyerrlab1:
  yyerrstatus = 3;
  for (;;)
    {
      yyn = yypact[yystate];
      if (!(!!((yyn) == (-18))))
        {
          yyn += 1;
          if (0 <= yyn && yyn <= 52 && 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;
      do { if (yydebug) yy_stack_print ((yyss), (yyssp)); } while (0);
    }

#pragma GCC diagnostic push

#pragma GCC diagnostic ignored "-Wuninitialized"

#pragma GCC diagnostic ignored "-Wmaybe-uninitialized"

  *++yyvsp = yylval;

#pragma GCC diagnostic pop

  do { if (yydebug) { fprintf (stderr, "%s ", "Shifting"); yy_symbol_print (stderr, yystos[yyn], yyvsp); fprintf (stderr, "\n"); } } while (0);
  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) <= 282 ? yytranslate[yychar] : 2);
      yydestruct ("Cleanup: discarding lookahead",
                  yytoken, &yylval);
    }
  (yyvsp -= (yylen), yyssp -= (yylen));
  do { if (yydebug) yy_stack_print ((yyss), (yyssp)); } while (0);
  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: union YYSTYPE { char ***plist; char **args; char *sb; int i; } [200]

variable_types: union YYSTYPE { char ***plist; char **args; char *sb; int i; } *

variable_types:
yystacksize
unsigned long

variable_types: yyn int

variable_types: yyresult int

variable_types: yytoken int

variable_types: yylen int

variable_types:
yysize
unsigned long

variable_types: union yyalloc { short yyss_alloc; union YYSTYPE { char ***plist; char **args; char *sb; int i; } 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; }


YaccDebug

decompiled_code:
int __fastcall YaccDebug(const char *a1)
{
int result; // eax

if ( YaccDebugFlag )
result = fprintf(stderr, "-- %s --\n", a1);
return result;
}

canonical_decompiled_code:
int __fastcall func5(const char *a1)
{
int result; // eax

if ( YaccDebugFlag )
result = fprintf(stderr, "-- %s --\n", a1);
return result;
}

original_code:
void YaccDebug(char *sb)
{
    if (YaccDebugFlag) {
 fprintf(stderr, "-- %s --\n", sb);
    }
}

variable_types:
sb
char *


repo: ajbonkoski/lcm-spy-lite

decompiled_code:
_QWORD *string_create()
{
_QWORD *v0; // rbx
_BYTE *v1; // rax

v0 = calloc(1uLL, 0x18uLL);
v0[1] = 8LL;
v1 = malloc(8uLL);
*v0 = v1;
*v1 = 0;
v0[2] = 0LL;
return v0;
}

canonical_decompiled_code:
_QWORD *func0()
{
_QWORD *v0; // rbx
_BYTE *v1; // rax

v0 = calloc(1uLL, 0x18uLL);
v0[1] = 8LL;
v1 = malloc(8uLL);
*v0 = v1;
*v1 = 0;
v0[2] = 0LL;
return v0;
}

original_code:
static inline string_t *string_create(void)
{
    string_t *this = calloc(1, sizeof(string_t));
    this->datasz = 8;
    this->data = malloc(this->datasz * sizeof(char));
    this->data[0] = '\0';
    this->len = 0;
    return this;
}

canonical_original_code:
static inline struct string_t *string_create()
{
    struct string_t *this = calloc(1, sizeof(string_t));
    this->datasz = 8;
    this->data = malloc(this->datasz * sizeof(char));
    this->data[0] = '\0';
    this->len = 0;
    return this;
}

variable_types: struct string_t { char *data; unsigned long datasz; unsigned long len; } *


decompiled_code:
void __fastcall string_destroy(void *ptr)
{
free(*(void **)ptr);
free(ptr);
}

canonical_decompiled_code:
void __fastcall func1(void *ptr)
{
free(*(void **)ptr);
free(ptr);
}

original_code:
static inline void string_destroy(string_t *this)
{
    free(this->data);
    free(this);
}

canonical_original_code:
static inline void string_destroy(struct string_t *this)
{
    free(this->data);
    free(this);
}

user_defined_types: struct string_t { char *data; unsigned long datasz; unsigned long len; }