help

decompiled_code:
size_t __fastcall help(const char *a1)
{
fprintf(stderr, "The program %s reads planar graphs from standard in and\n", a1);
fwrite("subdivides each face with one vertex.\n\n", 1uLL, 0x27uLL, stderr);
fwrite("Usage\n=====\n", 1uLL, 0xCuLL, stderr);
fprintf(stderr, " %s [options]\n\n", a1);
fprintf(stderr, "\nThis program can handle graphs up to %d vertices. Recompile if you need larger\n", 64LL);
fwrite("graphs.\n\n", 1uLL, 9uLL, stderr);
fwrite("Valid options\n=============\n", 1uLL, 0x1CuLL, stderr);
fwrite(" -h, --help\n", 1uLL, 0xFuLL, stderr);
return fwrite(" Print this help and return.\n", 1uLL, 0x23uLL, stderr);
}

canonical_decompiled_code:
size_t __fastcall func14(const char *a1)
{
fprintf(stderr, "The program %s reads planar graphs from standard in and\n", a1);
fwrite("subdivides each face with one vertex.\n\n", 1uLL, 0x27uLL, stderr);
fwrite("Usage\n=====\n", 1uLL, 0xCuLL, stderr);
fprintf(stderr, " %s [options]\n\n", a1);
fprintf(stderr, "\nThis program can handle graphs up to %d vertices. Recompile if you need larger\n", 64LL);
fwrite("graphs.\n\n", 1uLL, 9uLL, stderr);
fwrite("Valid options\n=============\n", 1uLL, 0x1CuLL, stderr);
fwrite(" -h, --help\n", 1uLL, 0xFuLL, stderr);
return fwrite(" Print this help and return.\n", 1uLL, 0x23uLL, stderr);
}

original_code:
void help(char *name) {
    fprintf(stderr, "The program %s reads planar graphs from standard in and\n", name);
    fprintf(stderr, "subdivides each face with one vertex.\n\n");
    fprintf(stderr, "Usage\n=====\n");
    fprintf(stderr, " %s [options]\n\n", name);
    fprintf(stderr, "\nThis program can handle graphs up to %d vertices. Recompile if you need larger\n", 64);
    fprintf(stderr, "graphs.\n\n");
    fprintf(stderr, "Valid options\n=============\n");
    fprintf(stderr, "    -h, --help\n");
    fprintf(stderr, "       Print this help and return.\n");
}

variable_types:
name
char *


usage

repo: nvcleemp/graphtools

decompiled_code:
int __fastcall usage(const char *a1)
{
fprintf(stderr, "Usage: %s [options]\n", a1);
return fprintf(stderr, "For more information type: %s -h \n\n", a1);
}

canonical_decompiled_code:
int __fastcall func15(const char *a1)
{
fprintf(stderr, "Usage: %s [options]\n", a1);
return fprintf(stderr, "For more information type: %s -h \n\n", a1);
}

original_code:
void usage(char *name) {
    fprintf(stderr, "Usage: %s [options]\n", name);
    fprintf(stderr, "For more information type: %s -h \n\n", name);
}

return_type: void


main

canonical_name: main

decompiled_code:
int __cdecl main(int argc, const char **argv, const char **envp)
{
const char *v3; // r12
unsigned int v4; // eax
int v5; // ebx
const char *v7; // rcx
int v8; // [rsp+Ch] [rbp-39Ch] BYREF
unsigned __int16 ptr[446]; // [rsp+10h] [rbp-398h] BYREF
int longind[7]; // [rsp+38Ch] [rbp-1Ch] BYREF

v3 = *argv;
longind[0] = 0;
while ( 1 )
{
v4 = getopt_long(argc, (char *const *)argv, "h", &long_options_0, longind);
if ( v4 == -1 )
break;
if ( v4 == 63 )
{
usage(v3);
return 1;
}
if ( v4 == 104 )
{
help(v3);
return 0;
}
if ( v4 )
{
fprintf(stderr, "Illegal option %c.\n", v4);
usage(v3);
return 1;
}
}
while ( 1 )
{
v5 = readPlanarCode(ptr, &v8, (FILE *)stdin);
if ( !v5 )
break;
decodePlanarCode(ptr);
writeSubdividedPlanarCode();
++numberOfGraphs;
}
v7 = "graphs.\n\n" + 9;
if ( numberOfGraphs != 1 )
v7 = "s";
fprintf(stderr, "Output subdivision of %d graph%s.\n", (unsigned int)numberOfGraphs, v7);
return v5;
}

canonical_decompiled_code:
int __cdecl main(int argc, const char **argv, const char **envp)
{
const char *v3; // r12
unsigned int v4; // eax
int v5; // ebx
const char *v7; // rcx
int v8; // [rsp+Ch] [rbp-39Ch] BYREF
unsigned __int16 ptr[446]; // [rsp+10h] [rbp-398h] BYREF
int longind[7]; // [rsp+38Ch] [rbp-1Ch] BYREF

v3 = *argv;
longind[0] = 0;
while ( 1 )
{
v4 = getopt_long(argc, (char *const *)argv, "h", &long_options_0, longind);
if ( v4 == -1 )
break;
if ( v4 == 63 )
{
func15(v3);
return 1;
}
if ( v4 == 104 )
{
func14(v3);
return 0;
}
if ( v4 )
{
fprintf(stderr, "Illegal option %c.\n", v4);
func15(v3);
return 1;
}
}
while ( 1 )
{
v5 = func13(ptr, &v8, (FILE *)stdin);
if ( !v5 )
break;
func12(ptr);
func9();
++numberOfGraphs;
}
v7 = "graphs.\n\n" + 9;
if ( numberOfGraphs != 1 )
v7 = "s";
fprintf(stderr, "Output subdivision of %d graph%s.\n", (unsigned int)numberOfGraphs, v7);
return v5;
}

original_code:
int main(int argc, char *argv[]) {
    int c;
    char *name = argv[0];
    static struct option long_options[] = {
        {"help", 0, ((void *)0), 'h'}
    };
    int option_index = 0;
    while ((c = getopt_long(argc, argv, "h", long_options, &option_index)) != -1) {
        switch (c) {
            case 0:
                break;
            case 'h':
                help(name);
                return 0;
            case '?':
                usage(name);
                return 1;
            default:
                fprintf(stderr, "Illegal option %c.\n", c);
                usage(name);
                return 1;
        }
    }
    unsigned short code[(64 +(6*64 -12)+3)];
    int length;
    while (readPlanarCode(code, &length, stdin)) {
        decodePlanarCode(code);
        writeSubdividedPlanarCode();
        numberOfGraphs++;
    }
    fprintf(stderr, "Output subdivision of %d graph%s.\n", numberOfGraphs,
                numberOfGraphs==1 ? "" : "s");
}

canonical_original_code:
int main(int argc, char *argv[]) {
    int c;
    char *name = argv[0];
    static struct option long_options[] = {
        {"help", 0, ((void *)0), 'h'}
    };
    int option_index = 0;
    while ((c = getopt_long(argc, argv, "h", long_options, &option_index)) != -1) {
        switch (c) {
            case 0:
                break;
            case 'h':
                help(name);
                return 0;
            case '?':
                usage(name);
                return 1;
            default:
                fprintf(stderr, "Illegal option %c.\n", c);
                usage(name);
                return 1;
        }
    }
    unsigned short code[-1];
    int length;
    while (readPlanarCode(code, &length, stdin)) {
        decodePlanarCode(code);
        writeSubdividedPlanarCode();
        numberOfGraphs++;
    }
    fprintf(stderr, "Output subdivision of %d graph%s.\n", numberOfGraphs,
                numberOfGraphs==1 ? "" : "s");
}

variable_types: argc int

variable_types:
argv
char *[]

variable_types: c int

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

variable_types:
code
unsigned short [-1]

variable_types: length int

return_type: int


writeVertexDeletedPlanarCodeChar

decompiled_code:
int writeVertexDeletedPlanarCodeChar()
{
int result; // eax
__int64 v1; // rbp
__int64 v2; // rbx
int v3; // eax
__int64 v4; // r12

result = fputc(newNv, stdout);
if ( nv > 0 )
{
v1 = 0LL;
do
{
if ( !deleted[v1] )
{
v4 = firstedge[v1];
v2 = v4;
do
{
v3 = *(_DWORD *)(v2 + 4);
if ( !deleted[v3] )
fputc(newLabels[v3] + 1, stdout);
v2 = *(_QWORD *)(v2 + 24);
}
while ( v4 != v2 );
result = fputc(0, stdout);
}
++v1;
}
while ( nv > (int)v1 );
}
return result;
}

canonical_decompiled_code:
int func8()
{
int result; // eax
__int64 v1; // rbp
__int64 v2; // rbx
int v3; // eax
__int64 v4; // r12

result = fputc(newNv, stdout);
if ( nv > 0 )
{
v1 = 0LL;
do
{
if ( !deleted[v1] )
{
v4 = firstedge[v1];
v2 = v4;
do
{
v3 = *(_DWORD *)(v2 + 4);
if ( !deleted[v3] )
fputc(newLabels[v3] + 1, stdout);
v2 = *(_QWORD *)(v2 + 24);
}
while ( v4 != v2 );
result = fputc(0, stdout);
}
++v1;
}
while ( nv > (int)v1 );
}
return result;
}

original_code:
void writeVertexDeletedPlanarCodeChar(){
    int i;
    EDGE *e, *elast;
    fputc(newNv, stdout);
    for(i=0; i<nv; i++){
        if(!deleted[i]){
            e = elast = firstedge[i];
            do {
                if(!deleted[e->end]){
                    fputc(newLabels[e->end] + 1, stdout);
                }
                e = e->next;
            } while (e != elast);
            fputc(0, stdout);
        }
    }
}

canonical_original_code:
void writeVertexDeletedPlanarCodeChar(){
    int i;
    struct e *e; struct e *elast;
    fputc(newNv, stdout);
    for(i=0; i<nv; i++){
        if(!deleted[i]){
            e = elast = firstedge[i];
            do {
                if(!deleted[e->end]){
                    fputc(newLabels[e->end] + 1, stdout);
                }
                e = e->next;
            } while (e != elast);
            fputc(0, stdout);
        }
    }
}

variable_types: i int

variable_types: struct e { int start; int end; int rightface; struct e *prev; struct e *next; struct e *inverse; int mark; } *


writeShort

decompiled_code:
size_t __fastcall writeShort(__int16 a1)
{
size_t result; // rax
__int16 ptr[6]; // [rsp+Ch] [rbp-Ch] BYREF

ptr[0] = a1;
result = fwrite(ptr, 2uLL, 1uLL, stdout);
if ( result != 1 )
{
fwrite("fwrite() failed -- exiting!\n", 1uLL, 0x1CuLL, stderr);
exit(-1);
}
return result;
}

canonical_decompiled_code:
size_t __fastcall func9(__int16 a1)
{
size_t result; // rax
__int16 ptr[6]; // [rsp+Ch] [rbp-Ch] BYREF

ptr[0] = a1;
result = fwrite(ptr, 2uLL, 1uLL, stdout);
if ( result != 1 )
{
fwrite("fwrite() failed -- exiting!\n", 1uLL, 0x1CuLL, stderr);
exit(-1);
}
return result;
}

original_code:
void writeShort(unsigned short value){
    if (fwrite(&value, sizeof (unsigned short), 1, stdout) != 1) {
        fprintf(stderr, "fwrite() failed -- exiting!\n");
        exit(-1);
    }
}

variable_types:
value
unsigned short


writeVertexDeletedPlanarCodeShort

decompiled_code:
size_t writeVertexDeletedPlanarCodeShort()
{
size_t result; // rax
__int64 v1; // rbp
__int64 v2; // rbx
int v3; // eax
__int64 v4; // r12

fputc(0, stdout);
result = writeShort(newNv);
if ( nv > 0 )
{
v1 = 0LL;
do
{
if ( !deleted[v1] )
{
v4 = firstedge[v1];
v2 = v4;
do
{
v3 = *(_DWORD *)(v2 + 4);
if ( !deleted[v3] )
writeShort(newLabels[v3] + 1);
v2 = *(_QWORD *)(v2 + 24);
}
while ( v4 != v2 );
result = writeShort(0);
}
++v1;
}
while ( nv > (int)v1 );
}
return result;
}

canonical_decompiled_code:
size_t func10()
{
size_t result; // rax
__int64 v1; // rbp
__int64 v2; // rbx
int v3; // eax
__int64 v4; // r12

fputc(0, stdout);
result = func9(newNv);
if ( nv > 0 )
{
v1 = 0LL;
do
{
if ( !deleted[v1] )
{
v4 = firstedge[v1];
v2 = v4;
do
{
v3 = *(_DWORD *)(v2 + 4);
if ( !deleted[v3] )
func9(newLabels[v3] + 1);
v2 = *(_QWORD *)(v2 + 24);
}
while ( v4 != v2 );
result = func9(0);
}
++v1;
}
while ( nv > (int)v1 );
}
return result;
}

original_code:
void writeVertexDeletedPlanarCodeShort(){
    int i;
    EDGE *e, *elast;
    fputc(0, stdout);
    writeShort(newNv);
    for(i=0; i<nv; i++){
        if(!deleted[i]){
            e = elast = firstedge[i];
            do {
                if(!deleted[e->end]){
                    writeShort(newLabels[e->end] + 1);
                }
                e = e->next;
            } while (e != elast);
            writeShort(0);
        }
    }
}

canonical_original_code:
void writeVertexDeletedPlanarCodeShort(){
    int i;
    struct e *e; struct e *elast;
    fputc(0, stdout);
    writeShort(newNv);
    for(i=0; i<nv; i++){
        if(!deleted[i]){
            e = elast = firstedge[i];
            do {
                if(!deleted[e->end]){
                    writeShort(newLabels[e->end] + 1);
                }
                e = e->next;
            } while (e != elast);
            writeShort(0);
        }
    }
}

user_defined_types: struct e { int start; int end; int rightface; struct e *prev; struct e *next; struct e *inverse; int mark; }


writeVertexDeletedPlanarCode

decompiled_code:
int writeVertexDeletedPlanarCode()
{
if ( first_2 )
{
first_2 = 0;
fwrite(">>planar_code<<", 1uLL, 0xFuLL, stdout);
}
if ( newNv <= 254 )
return writeVertexDeletedPlanarCodeChar();
if ( newNv > 65534 )
{
fwrite("Graphs of that size are currently not supported -- exiting!\n", 1uLL, 0x3CuLL, stderr);
exit(-1);
}
return writeVertexDeletedPlanarCodeShort();
}

canonical_decompiled_code:
int func11()
{
if ( first_2 )
{
first_2 = 0;
fwrite(">>planar_code<<", 1uLL, 0xFuLL, stdout);
}
if ( newNv <= 254 )
return func8();
if ( newNv > 65534 )
{
fwrite("Graphs of that size are currently not supported -- exiting!\n", 1uLL, 0x3CuLL, stderr);
exit(-1);
}
return func10();
}

original_code:
void writeVertexDeletedPlanarCode(){
    static int first = 1;
    if(first){
        first = 0;
        fprintf(stdout, ">>planar_code<<");
    }
    if (newNv + 1 <= 255) {
        writeVertexDeletedPlanarCodeChar();
    } else if (newNv + 1 <= 65535) {
        writeVertexDeletedPlanarCodeShort();
    } else {
        fprintf(stderr, "Graphs of that size are currently not supported -- exiting!\n");
        exit(-1);
    }
}

variable_types: first int


validateGraph

decompiled_code:
void validateGraph()
{
__int64 v0; // rsi
__int64 v1; // rax

if ( nv > 0 )
{
v0 = 0LL;
do
{
if ( degree[v0] != 2 )
{
v1 = firstedge[v0];
do
{
if ( degree[*(int *)(v1 + 4)] == 2 )
{
fwrite("Neighbouring vertices of degree 2 are not supported -- exiting!\n", 1uLL, 0x40uLL, stderr);
exit(1);
}
v1 = *(_QWORD *)(v1 + 24);
}
while ( firstedge[v0] != v1 );
}
++v0;
}
while ( v0 != nv );
}
}

canonical_decompiled_code:
void func7()
{
__int64 v0; // rsi
__int64 v1; // rax

if ( nv > 0 )
{
v0 = 0LL;
do
{
if ( degree[v0] != 2 )
{
v1 = firstedge[v0];
do
{
if ( degree[*(int *)(v1 + 4)] == 2 )
{
fwrite("Neighbouring vertices of degree 2 are not supported -- exiting!\n", 1uLL, 0x40uLL, stderr);
exit(1);
}
v1 = *(_QWORD *)(v1 + 24);
}
while ( firstedge[v0] != v1 );
}
++v0;
}
while ( v0 != nv );
}
}

original_code:
void validateGraph(){
    int i;
    EDGE *e, *elast;
    for(i = 0; i < nv; i++){
        if(degree[i]!=2){
            e = elast = firstedge[i];
            do {
                if(degree[e->end]==2){
                    fprintf(stderr, "Neighbouring vertices of degree 2 are not supported -- exiting!\n");
                    exit(1);
                }
                e = e->next;
            } while (e != elast);
        }
    }
}

canonical_original_code:
void validateGraph(){
    int i;
    struct e *e; struct e *elast;
    for(i = 0; i < nv; i++){
        if(degree[i]!=2){
            e = elast = firstedge[i];
            do {
                if(degree[e->end]==2){
                    fprintf(stderr, "Neighbouring vertices of degree 2 are not supported -- exiting!\n");
                    exit(1);
                }
                e = e->next;
            } while (e != elast);
        }
    }
}


writeSuppressedPlanarCodeChar

decompiled_code:
int writeSuppressedPlanarCodeChar()
{
int result; // eax
__int64 v1; // r12
__int64 v2; // rbx
int v3; // eax
__int64 v4; // rbp

result = fputc(newNv, stdout);
if ( nv > 0 )
{
v1 = 0LL;
do
{
if ( degree[v1] != 2 )
{
v4 = firstedge[v1];
v2 = v4;
do
{
v3 = *(_DWORD *)(v2 + 4);
if ( degree[v3] == 2 )
fputc(newLabels[*(int *)(*(_QWORD *)(*(_QWORD *)(v2 + 32) + 24LL) + 4LL)] + 1, stdout);
else
fputc(newLabels[v3] + 1, stdout);
v2 = *(_QWORD *)(v2 + 24);
}
while ( v4 != v2 );
result = fputc(0, stdout);
}
++v1;
}
while ( nv > (int)v1 );
}
return result;
}

canonical_decompiled_code:
int func9()
{
int result; // eax
__int64 v1; // r12
__int64 v2; // rbx
int v3; // eax
__int64 v4; // rbp

result = fputc(newNv, stdout);
if ( nv > 0 )
{
v1 = 0LL;
do
{
if ( degree[v1] != 2 )
{
v4 = firstedge[v1];
v2 = v4;
do
{
v3 = *(_DWORD *)(v2 + 4);
if ( degree[v3] == 2 )
fputc(newLabels[*(int *)(*(_QWORD *)(*(_QWORD *)(v2 + 32) + 24LL) + 4LL)] + 1, stdout);
else
fputc(newLabels[v3] + 1, stdout);
v2 = *(_QWORD *)(v2 + 24);
}
while ( v4 != v2 );
result = fputc(0, stdout);
}
++v1;
}
while ( nv > (int)v1 );
}
return result;
}

original_code:
void writeSuppressedPlanarCodeChar(){
    int i;
    EDGE *e, *elast;
    fputc(newNv, stdout);
    for(i=0; i<nv; i++){
        if(degree[i]!=2){
            e = elast = firstedge[i];
            do {
                if(degree[e->end]==2){
                    fputc(newLabels[e->inverse->next->end] + 1, stdout);
                } else {
                    fputc(newLabels[e->end] + 1, stdout);
                }
                e = e->next;
            } while (e != elast);
            fputc(0, stdout);
        }
    }
}

canonical_original_code:
void writeSuppressedPlanarCodeChar(){
    int i;
    struct e *e; struct e *elast;
    fputc(newNv, stdout);
    for(i=0; i<nv; i++){
        if(degree[i]!=2){
            e = elast = firstedge[i];
            do {
                if(degree[e->end]==2){
                    fputc(newLabels[e->inverse->next->end] + 1, stdout);
                } else {
                    fputc(newLabels[e->end] + 1, stdout);
                }
                e = e->next;
            } while (e != elast);
            fputc(0, stdout);
        }
    }
}


writeShort

canonical_decompiled_code:
size_t __fastcall func10(__int16 a1)
{
size_t result; // rax
__int16 ptr[6]; // [rsp+Ch] [rbp-Ch] BYREF

ptr[0] = a1;
result = fwrite(ptr, 2uLL, 1uLL, stdout);
if ( result != 1 )
{
fwrite("fwrite() failed -- exiting!\n", 1uLL, 0x1CuLL, stderr);
exit(-1);
}
return result;
}

canonical_original_code:
void writeShort(unsigned short value){
    if (fwrite(&value, sizeof (unsigned short), 1, stdout) != 1) {
        fprintf(stderr, "fwrite() failed -- exiting!\n");
        exit(-1);
    }
}


writeSuppressedPlanarCodeShort

decompiled_code:
size_t writeSuppressedPlanarCodeShort()
{
size_t result; // rax
__int64 v1; // r12
__int64 v2; // rbx
int v3; // eax
__int64 v4; // rbp

fputc(0, stdout);
result = writeShort(newNv);
if ( nv > 0 )
{
v1 = 0LL;
do
{
if ( degree[v1] != 2 )
{
v4 = firstedge[v1];
v2 = v4;
do
{
v3 = *(_DWORD *)(v2 + 4);
if ( degree[v3] == 2 )
writeShort(newLabels[*(int *)(*(_QWORD *)(*(_QWORD *)(v2 + 32) + 24LL) + 4LL)] + 1);
else
writeShort(newLabels[v3] + 1);
v2 = *(_QWORD *)(v2 + 24);
}
while ( v4 != v2 );
result = writeShort(0);
}
++v1;
}
while ( nv > (int)v1 );
}
return result;
}

canonical_decompiled_code:
size_t func11()
{
size_t result; // rax
__int64 v1; // r12
__int64 v2; // rbx
int v3; // eax
__int64 v4; // rbp

fputc(0, stdout);
result = func10(newNv);
if ( nv > 0 )
{
v1 = 0LL;
do
{
if ( degree[v1] != 2 )
{
v4 = firstedge[v1];
v2 = v4;
do
{
v3 = *(_DWORD *)(v2 + 4);
if ( degree[v3] == 2 )
func10(newLabels[*(int *)(*(_QWORD *)(*(_QWORD *)(v2 + 32) + 24LL) + 4LL)] + 1);
else
func10(newLabels[v3] + 1);
v2 = *(_QWORD *)(v2 + 24);
}
while ( v4 != v2 );
result = func10(0);
}
++v1;
}
while ( nv > (int)v1 );
}
return result;
}

original_code:
void writeSuppressedPlanarCodeShort(){
    int i;
    EDGE *e, *elast;
    fputc(0, stdout);
    writeShort(newNv);
    for(i=0; i<nv; i++){
        if(degree[i]!=2){
            e = elast = firstedge[i];
            do {
                if(degree[e->end]==2){
                    writeShort(newLabels[e->inverse->next->end] + 1);
                } else {
                    writeShort(newLabels[e->end] + 1);
                }
                e = e->next;
            } while (e != elast);
            writeShort(0);
        }
    }
}

canonical_original_code:
void writeSuppressedPlanarCodeShort(){
    int i;
    struct e *e; struct e *elast;
    fputc(0, stdout);
    writeShort(newNv);
    for(i=0; i<nv; i++){
        if(degree[i]!=2){
            e = elast = firstedge[i];
            do {
                if(degree[e->end]==2){
                    writeShort(newLabels[e->inverse->next->end] + 1);
                } else {
                    writeShort(newLabels[e->end] + 1);
                }
                e = e->next;
            } while (e != elast);
            writeShort(0);
        }
    }
}


writeSuppressedPlanarCode

decompiled_code:
int writeSuppressedPlanarCode()
{
if ( first_2 )
{
first_2 = 0;
fwrite(">>planar_code<<", 1uLL, 0xFuLL, stdout);
}
if ( newNv <= 254 )
return writeSuppressedPlanarCodeChar();
if ( newNv > 65534 )
{
fwrite("Graphs of that size are currently not supported -- exiting!\n", 1uLL, 0x3CuLL, stderr);
exit(-1);
}
return writeSuppressedPlanarCodeShort();
}

canonical_decompiled_code:
int func12()
{
if ( first_2 )
{
first_2 = 0;
fwrite(">>planar_code<<", 1uLL, 0xFuLL, stdout);
}
if ( newNv <= 254 )
return func9();
if ( newNv > 65534 )
{
fwrite("Graphs of that size are currently not supported -- exiting!\n", 1uLL, 0x3CuLL, stderr);
exit(-1);
}
return func11();
}

original_code:
void writeSuppressedPlanarCode(){
    static int first = 1;
    if(first){
        first = 0;
        fprintf(stdout, ">>planar_code<<");
    }
    if (newNv + 1 <= 255) {
        writeSuppressedPlanarCodeChar();
    } else if (newNv + 1 <= 65535) {
        writeSuppressedPlanarCodeShort();
    } else {
        fprintf(stderr, "Graphs of that size are currently not supported -- exiting!\n");
        exit(-1);
    }
}


writePlanarCodeChar

decompiled_code:
int writePlanarCodeChar()
{
int result; // eax
__int64 v1; // r12
__int64 v2; // rbp
__int64 v3; // rbx

result = fputc(nv, stdout);
if ( nv > 0 )
{
v1 = 0LL;
do
{
v2 = firstedge[v1];
v3 = v2;
do
{
fputc(*(_DWORD *)(v3 + 4) + 1, stdout);
v3 = *(_QWORD *)(v3 + 24);
}
while ( v2 != v3 );
result = fputc(0, stdout);
++v1;
}
while ( nv > (int)v1 );
}
return result;
}

canonical_decompiled_code:
int func7()
{
int result; // eax
__int64 v1; // r12
__int64 v2; // rbp
__int64 v3; // rbx

result = fputc(nv, stdout);
if ( nv > 0 )
{
v1 = 0LL;
do
{
v2 = firstedge[v1];
v3 = v2;
do
{
fputc(*(_DWORD *)(v3 + 4) + 1, stdout);
v3 = *(_QWORD *)(v3 + 24);
}
while ( v2 != v3 );
result = fputc(0, stdout);
++v1;
}
while ( nv > (int)v1 );
}
return result;
}

original_code:
void writePlanarCodeChar(){
    int i;
    EDGE *e, *elast;
    fputc(nv, stdout);
    for(i=0; i<nv; i++){
        e = elast = firstedge[i];
        do {
            fputc(e->end + 1, stdout);
            e = e->next;
        } while (e != elast);
        fputc(0, stdout);
    }
}

canonical_original_code:
void writePlanarCodeChar(){
    int i;
    struct e *e; struct e *elast;
    fputc(nv, stdout);
    for(i=0; i<nv; i++){
        e = elast = firstedge[i];
        do {
            fputc(e->end + 1, stdout);
            e = e->next;
        } while (e != elast);
        fputc(0, stdout);
    }
}


writeShort

canonical_decompiled_code:
size_t __fastcall func8(__int16 a1)
{
size_t result; // rax
__int16 ptr[6]; // [rsp+Ch] [rbp-Ch] BYREF

ptr[0] = a1;
result = fwrite(ptr, 2uLL, 1uLL, stdout);
if ( result != 1 )
{
fwrite("fwrite() failed -- exiting!\n", 1uLL, 0x1CuLL, stderr);
exit(-1);
}
return result;
}


writePlanarCode

decompiled_code:
int writePlanarCode()
{
if ( first_2 )
{
first_2 = 0;
fwrite(">>planar_code<<", 1uLL, 0xFuLL, stdout);
}
if ( nv <= 254 )
return writePlanarCodeChar();
if ( nv > 65534 )
{
fwrite("Graphs of that size are currently not supported -- exiting!\n", 1uLL, 0x3CuLL, stderr);
exit(-1);
}
return writePlanarCodeShort();
}

canonical_decompiled_code:
int func10()
{
if ( first_2 )
{
first_2 = 0;
fwrite(">>planar_code<<", 1uLL, 0xFuLL, stdout);
}
if ( nv <= 254 )
return func7();
if ( nv > 65534 )
{
fwrite("Graphs of that size are currently not supported -- exiting!\n", 1uLL, 0x3CuLL, stderr);
exit(-1);
}
return func9();
}

original_code:
void writePlanarCode(){
    static int first = 1;
    if(first){
        first = 0;
        fprintf(stdout, ">>planar_code<<");
    }
    if (nv + 1 <= 255) {
        writePlanarCodeChar();
    } else if (nv + 1 <= 65535) {
        writePlanarCodeShort();
    } else {
        fprintf(stderr, "Graphs of that size are currently not supported -- exiting!\n");
        exit(-1);
    }
}


writeShort

decompiled_code:
size_t __fastcall writeShort(__int16 a1, FILE *a2)
{
size_t result; // rax
__int16 ptr[6]; // [rsp+Ch] [rbp-Ch] BYREF

ptr[0] = a1;
result = fwrite(ptr, 2uLL, 1uLL, a2);
if ( result != 1 )
{
fwrite("fwrite() failed -- exiting!\n", 1uLL, 0x1CuLL, stderr);
exit(-1);
}
return result;
}

canonical_decompiled_code:
size_t __fastcall func14(__int16 a1, FILE *a2)
{
size_t result; // rax
__int16 ptr[6]; // [rsp+Ch] [rbp-Ch] BYREF

ptr[0] = a1;
result = fwrite(ptr, 2uLL, 1uLL, a2);
if ( result != 1 )
{
fwrite("fwrite() failed -- exiting!\n", 1uLL, 0x1CuLL, stderr);
exit(-1);
}
return result;
}


original_code:
static void Arr_sort_dtlmaopao(int * piar, int len){
 int i, j, m;
 for (i=0; i< len; i++){
  for (j=i+1; j< len; j++){
   if (piar[i] > piar[j]){
    m =piar[i];
    piar[i] = piar[j];
    piar[j] = m;
   }
  }
 }
}

canonical_original_code:
static void Arr_sort_dtlmaopao(int *piar, int len){
 int i; int j; int m;
 for (i=0; i< len; i++){
  for (j=i+1; j< len; j++){
   if (piar[i] > piar[j]){
    m =piar[i];
    piar[i] = piar[j];
    piar[j] = m;
   }
  }
 }
}

variable_types:
piar
int *

variable_types: len int

variable_types: j int

variable_types: m int


decompiled_code:
void __fastcall __noreturn Arr_error(_BYTE *a1)
{
_BYTE *v1; // rbx
char v2; // di

v1 = a1;
v2 = *a1;
if ( v2 )
{
do
{
putchar(v2);
v2 = *++v1;
}
while ( *v1 );
}
putchar(10);
exit(-1);
}

canonical_decompiled_code:
void __fastcall __noreturn func1(_BYTE *a1)
{
_BYTE *v1; // rbx
char v2; // di

v1 = a1;
v2 = *a1;
if ( v2 )
{
do
{
putchar(v2);
v2 = *++v1;
}
while ( *v1 );
}
putchar(10);
exit(-1);
}

original_code:
static void Arr_error(char * pstr){
 while (*pstr != '\0'){
  printf("%c",*pstr);
  pstr++;
 }
 printf("\n");
 exit(-1);
}

canonical_original_code:
static void Arr_error(char *pstr){
 while (*pstr != '\0'){
  printf("%c",*pstr);
  pstr++;
 }
 printf("\n");
 exit(-1);
}

variable_types:
pstr
char *


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

v2 = realloc(*(void **)a1, 4LL * (*(_DWORD *)(a1 + 12) + a2));
*(_QWORD *)a1 = v2;
if ( !v2 )
return 48LL;
*(_DWORD *)(a1 + 8) += a2;
return 49LL;
}

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

v2 = realloc(*(void **)a1, 4LL * (*(_DWORD *)(a1 + 12) + a2));
*(_QWORD *)a1 = v2;
if ( !v2 )
return 48LL;
*(_DWORD *)(a1 + 8) += a2;
return 49LL;
}

original_code:
static char Arr_extend(struct Arrlist * pArr, int increment){
 pArr->paddr = (int *)realloc(pArr->paddr, sizeof(int) * (pArr->cur_len + increment));
 if (((void *)0) == pArr->paddr){
  return '0';
 }
 pArr->len += increment;
 return '1';
}

canonical_original_code:
static char Arr_extend(struct Arrlist *pArr, int increment){
 pArr->paddr = (int *)realloc(pArr->paddr, sizeof(int) * (pArr->cur_len + increment));
 if (((void *)0) == pArr->paddr){
  return '0';
 }
 pArr->len += increment;
 return '1';
}

variable_types: struct Arrlist { int *paddr; int len; int cur_len; int increment; char is_inited; } *

variable_types: increment int

return_type: char


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

result = malloc(4LL * a2);
*(_QWORD *)a1 = result;
if ( !result )
Arr_error("fail to assign memory!!");
*(_DWORD *)(a1 + 8) = a2;
*(_DWORD *)(a1 + 12) = 0;
*(_DWORD *)(a1 + 16) = 10;
*(_BYTE *)(a1 + 20) = 49;
return result;
}

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

result = malloc(4LL * a2);
*(_QWORD *)a1 = result;
if ( !result )
func1("fail to assign memory!!");
*(_DWORD *)(a1 + 8) = a2;
*(_DWORD *)(a1 + 12) = 0;
*(_DWORD *)(a1 + 16) = 10;
*(_BYTE *)(a1 + 20) = 49;
return result;
}

original_code:
void Arr_init(struct Arrlist * pArr, int length){
 pArr->paddr = (int *)malloc(sizeof(int) * length);
 if (((void *)0) == pArr->paddr){
  Arr_error("fail to assign memory!!");
 }
 pArr->len = length;
 pArr->cur_len = 0;
 pArr->increment = 10;
 pArr->is_inited = '1';
 return;
}

canonical_original_code:
void Arr_init(struct Arrlist *pArr, int length){
 pArr->paddr = (int *)malloc(sizeof(int) * length);
 if (((void *)0) == pArr->paddr){
  Arr_error("fail to assign memory!!");
 }
 pArr->len = length;
 pArr->cur_len = 0;
 pArr->increment = 10;
 pArr->is_inited = '1';
 return;
}

user_defined_types: struct Arrlist { int *paddr; int len; int cur_len; int increment; char is_inited; }


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

result = *(unsigned __int8 *)(a1 + 20);
if ( (_BYTE)result != 49 )
Arr_error("Array is not inited yet!!");
if ( *(_DWORD *)(a1 + 12) )
result = 48LL;
return result;
}

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

result = *(unsigned __int8 *)(a1 + 20);
if ( (_BYTE)result != 49 )
func1("Array is not inited yet!!");
if ( *(_DWORD *)(a1 + 12) )
result = 48LL;
return result;
}

original_code:
char Arr_is_empty(struct Arrlist * pArr){
 if ('1' != pArr->is_inited){
  Arr_error("Array is not inited yet!!");
 }
 if (0 == pArr->cur_len){
  return '1';
 }
 return '0';
}

canonical_original_code:
char Arr_is_empty(struct Arrlist *pArr){
 if ('1' != pArr->is_inited){
  Arr_error("Array is not inited yet!!");
 }
 if (0 == pArr->cur_len){
  return '1';
 }
 return '0';
}


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

result = *(unsigned __int8 *)(a1 + 20);
if ( (_BYTE)result != 49 )
Arr_error("Array is not inited yet!!");
if ( *(_DWORD *)(a1 + 8) != *(_DWORD *)(a1 + 12) )
result = 48LL;
return result;
}

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

result = *(unsigned __int8 *)(a1 + 20);
if ( (_BYTE)result != 49 )
func1("Array is not inited yet!!");
if ( *(_DWORD *)(a1 + 8) != *(_DWORD *)(a1 + 12) )
result = 48LL;
return result;
}

original_code:
char Arr_is_full(struct Arrlist * pArr){
 if ('1' != pArr->is_inited){
  Arr_error("Array is not inited yet!!");
 }
 if (pArr->len == pArr->cur_len){
  return '1';
 }
 return '0';
}

canonical_original_code:
char Arr_is_full(struct Arrlist *pArr){
 if ('1' != pArr->is_inited){
  Arr_error("Array is not inited yet!!");
 }
 if (pArr->len == pArr->cur_len){
  return '1';
 }
 return '0';
}


decompiled_code:
int __fastcall Arr_show(__int64 a1)
{
int v1; // eax
__int64 v2; // rbx

if ( *(_BYTE *)(a1 + 20) != 49 )
Arr_error("Array is not inited yet!!");
if ( (unsigned __int8)Arr_is_empty(a1) == 49 )
return puts("It's an empty Arrlist");
v1 = *(_DWORD *)(a1 + 12);
v2 = 0LL;
if ( v1 > 1 )
{
do
{
printf("%d, ", *(unsigned int *)(*(_QWORD *)a1 + 4 * v2));
v1 = *(_DWORD *)(a1 + 12);
++v2;
}
while ( v1 - 1 > (int)v2 );
}
return printf("%d\n", *(unsigned int *)(*(_QWORD *)a1 + 4LL * v1 - 4));
}

canonical_decompiled_code:
int __fastcall func6(__int64 a1)
{
int v1; // eax
__int64 v2; // rbx

if ( *(_BYTE *)(a1 + 20) != 49 )
func1("Array is not inited yet!!");
if ( (unsigned __int8)func4(a1) == 49 )
return puts("It's an empty Arrlist");
v1 = *(_DWORD *)(a1 + 12);
v2 = 0LL;
if ( v1 > 1 )
{
do
{
printf("%d, ", *(unsigned int *)(*(_QWORD *)a1 + 4 * v2));
v1 = *(_DWORD *)(a1 + 12);
++v2;
}
while ( v1 - 1 > (int)v2 );
}
return printf("%d\n", *(unsigned int *)(*(_QWORD *)a1 + 4LL * v1 - 4));
}

original_code:
void Arr_show(struct Arrlist * pArr){
 if ('1' != pArr->is_inited){
  Arr_error("Array is not inited yet!!");
 }
 if ('1' == Arr_is_empty(pArr)){
  printf("It's an empty Arrlist\n");
  return;
 }
 int i;
 for (i=0; i < (pArr->cur_len - 1); i++){
   printf("%d, ", pArr->paddr[i]);
 }
 printf("%d\n", pArr->paddr[pArr->cur_len -1]);
 return;
}

canonical_original_code:
void Arr_show(struct Arrlist *pArr){
 if ('1' != pArr->is_inited){
  Arr_error("Array is not inited yet!!");
 }
 if ('1' == Arr_is_empty(pArr)){
  printf("It's an empty Arrlist\n");
  return;
 }
 int i;
 for (i=0; i < (pArr->cur_len - 1); i++){
   printf("%d, ", pArr->paddr[i]);
 }
 printf("%d\n", pArr->paddr[pArr->cur_len -1]);
 return;
}


decompiled_code:
__int64 __fastcall Arr_add(__int64 a1, int a2)
{
unsigned int v2; // ebp
unsigned int v4; // eax

v2 = *(unsigned __int8 *)(a1 + 20);
if ( (_BYTE)v2 != 49 )
Arr_error("Array is not inited yet!!");
if ( (unsigned __int8)Arr_is_full(a1) == 49 )
{
v4 = Arr_extend(a1, *(_DWORD *)(a1 + 16));
if ( (_BYTE)v4 == 48 )
return v4;
}
*(_DWORD *)(*(_QWORD *)a1 + 4LL * (int)(*(_DWORD *)(a1 + 12))++) = a2;
return v2;
}

canonical_decompiled_code:
__int64 __fastcall func7(__int64 a1, int a2)
{
unsigned int v2; // ebp
unsigned int v4; // eax

v2 = *(unsigned __int8 *)(a1 + 20);
if ( (_BYTE)v2 != 49 )
func1("Array is not inited yet!!");
if ( (unsigned __int8)func5(a1) == 49 )
{
v4 = func2(a1, *(_DWORD *)(a1 + 16));
if ( (_BYTE)v4 == 48 )
return v4;
}
*(_DWORD *)(*(_QWORD *)a1 + 4LL * (int)(*(_DWORD *)(a1 + 12))++) = a2;
return v2;
}

original_code:
char Arr_add(struct Arrlist * pArr, int val){
 if ('1' != pArr->is_inited){
  Arr_error("Array is not inited yet!!");
 }
 if ('1' == Arr_is_full(pArr)){
  if ('0' == Arr_extend(pArr, pArr->increment)){
   return '0';
  }
 }
 pArr->paddr[pArr->cur_len] = val;
 pArr->cur_len++;
 return '1';
}

canonical_original_code:
char Arr_add(struct Arrlist *pArr, int val){
 if ('1' != pArr->is_inited){
  Arr_error("Array is not inited yet!!");
 }
 if ('1' == Arr_is_full(pArr)){
  if ('0' == Arr_extend(pArr, pArr->increment)){
   return '0';
  }
 }
 pArr->paddr[pArr->cur_len] = val;
 pArr->cur_len++;
 return '1';
}

variable_types: val int


decompiled_code:
__int64 __fastcall Arr_set(__int64 a1, int a2, int a3)
{
__int64 result; // rax

result = *(unsigned __int8 *)(a1 + 20);
if ( (_BYTE)result != 49 )
Arr_error("Array is not inited yet!!");
if ( a2 < 0 || *(_DWORD *)(a1 + 12) <= a2 )
{
puts("the element is not existed yet");
result = 48LL;
}
else
{
*(_DWORD *)(*(_QWORD *)a1 + 4LL * a2) = a3;
}
return result;
}

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

result = *(unsigned __int8 *)(a1 + 20);
if ( (_BYTE)result != 49 )
func1("Array is not inited yet!!");
if ( a2 < 0 || *(_DWORD *)(a1 + 12) <= a2 )
{
puts("the element is not existed yet");
result = 48LL;
}
else
{
*(_DWORD *)(*(_QWORD *)a1 + 4LL * a2) = a3;
}
return result;
}

original_code:
char Arr_set(struct Arrlist * pArr, int index, int val){
 if ('1' != pArr->is_inited){
  Arr_error("Array is not inited yet!!");
 }
 if((index < 0) || (index >= pArr->cur_len)){
  printf("the element is not existed yet\n");
  return '0';
 }
 pArr->paddr[index] = val;
 return '1';
}

canonical_original_code:
char Arr_set(struct Arrlist *pArr, int index, int val){
 if ('1' != pArr->is_inited){
  Arr_error("Array is not inited yet!!");
 }
 if((index < 0) || (index >= pArr->cur_len)){
  printf("the element is not existed yet\n");
  return '0';
 }
 pArr->paddr[index] = val;
 return '1';
}

variable_types: index int


decompiled_code:
__int64 __fastcall Arr_get(__int64 a1, int a2)
{
if ( *(_BYTE *)(a1 + 20) != 49 )
Arr_error("Array is not inited yet!!");
if ( a2 >= 0 && *(_DWORD *)(a1 + 12) > a2 )
return *(unsigned int *)(*(_QWORD *)a1 + 4LL * a2);
puts("the element is not existed yet");
return 0LL;
}

canonical_decompiled_code:
__int64 __fastcall func9(__int64 a1, int a2)
{
if ( *(_BYTE *)(a1 + 20) != 49 )
func1("Array is not inited yet!!");
if ( a2 >= 0 && *(_DWORD *)(a1 + 12) > a2 )
return *(unsigned int *)(*(_QWORD *)a1 + 4LL * a2);
puts("the element is not existed yet");
return 0LL;
}

original_code:
int Arr_get(struct Arrlist * pArr, int index){
 if ('1' != pArr->is_inited){
  Arr_error("Array is not inited yet!!");
 }
 if((index < 0) || (index >= pArr->cur_len)){
  printf("the element is not existed yet\n");
  return 0;
 }
 return pArr->paddr[index];
}

canonical_original_code:
int Arr_get(struct Arrlist *pArr, int index){
 if ('1' != pArr->is_inited){
  Arr_error("Array is not inited yet!!");
 }
 if((index < 0) || (index >= pArr->cur_len)){
  printf("the element is not existed yet\n");
  return 0;
 }
 return pArr->paddr[index];
}


decompiled_code:
__int64 __fastcall Arr_insert(__int64 a1, int a2, int a3)
{
unsigned int v3; // er12
int v7; // edx
__int64 v8; // rax
unsigned __int64 v9; // rsi
unsigned int v10; // eax

v3 = *(unsigned __int8 *)(a1 + 20);
if ( (_BYTE)v3 != 49 )
Arr_error("Array is not inited yet!!");
if ( a2 >= 0 && *(_DWORD *)(a1 + 12) > a2 )
{
if ( (unsigned __int8)Arr_is_full(a1) == 49 && (v10 = Arr_extend(a1, *(_DWORD *)(a1 + 16)), (_BYTE)v10 == 48) )
{
v3 = v10;
}
else
{
v7 = *(_DWORD *)(a1 + 12);
if ( a2 <= v7 - 1 )
{
v8 = 4LL * (v7 - 1);
v9 = 4 * (v7 - (unsigned __int64)(unsigned int)(v7 + ~a2)) - 8;
do
{
*(_DWORD *)(*(_QWORD *)a1 + v8 + 4) = *(_DWORD *)(*(_QWORD *)a1 + v8);
v8 -= 4LL;
}
while ( v8 != v9 );
}
*(_DWORD *)(*(_QWORD *)a1 + 4LL * a2) = a3;
++*(_DWORD *)(a1 + 12);
}
}
else
{
puts("the position is over the length of array, please use Arr_add instead");
v3 = 48;
}
return v3;
}

canonical_decompiled_code:
__int64 __fastcall func10(__int64 a1, int a2, int a3)
{
unsigned int v3; // er12
int v7; // edx
__int64 v8; // rax
unsigned __int64 v9; // rsi
unsigned int v10; // eax

v3 = *(unsigned __int8 *)(a1 + 20);
if ( (_BYTE)v3 != 49 )
func1("Array is not inited yet!!");
if ( a2 >= 0 && *(_DWORD *)(a1 + 12) > a2 )
{
if ( (unsigned __int8)func5(a1) == 49 && (v10 = func2(a1, *(_DWORD *)(a1 + 16)), (_BYTE)v10 == 48) )
{
v3 = v10;
}
else
{
v7 = *(_DWORD *)(a1 + 12);
if ( a2 <= v7 - 1 )
{
v8 = 4LL * (v7 - 1);
v9 = 4 * (v7 - (unsigned __int64)(unsigned int)(v7 + ~a2)) - 8;
do
{
*(_DWORD *)(*(_QWORD *)a1 + v8 + 4) = *(_DWORD *)(*(_QWORD *)a1 + v8);
v8 -= 4LL;
}
while ( v8 != v9 );
}
*(_DWORD *)(*(_QWORD *)a1 + 4LL * a2) = a3;
++*(_DWORD *)(a1 + 12);
}
}
else
{
puts("the position is over the length of array, please use Arr_add instead");
v3 = 48;
}
return v3;
}

original_code:
char Arr_insert(struct Arrlist * pArr, int position, int val){
 if ('1' != pArr->is_inited){
  Arr_error("Array is not inited yet!!");
 }
 if((position < 0) || (position >= pArr->cur_len)){
  printf("the position is over the length of array, please use Arr_add instead\n");
  return '0';
 }
 if('1' == Arr_is_full(pArr)){
  if ('0' == Arr_extend(pArr, pArr->increment)){
   return '0';
  }
 }
 int i;
 for (i=(pArr->cur_len -1); i>= position; i--){
  pArr->paddr[i+1] = pArr->paddr[i];
 }
 pArr->paddr[position] = val;
 pArr->cur_len++;
        return '1';
}

canonical_original_code:
char Arr_insert(struct Arrlist *pArr, int position, int val){
 if ('1' != pArr->is_inited){
  Arr_error("Array is not inited yet!!");
 }
 if((position < 0) || (position >= pArr->cur_len)){
  printf("the position is over the length of array, please use Arr_add instead\n");
  return '0';
 }
 if('1' == Arr_is_full(pArr)){
  if ('0' == Arr_extend(pArr, pArr->increment)){
   return '0';
  }
 }
 int i;
 for (i=(pArr->cur_len -1); i>= position; i--){
  pArr->paddr[i+1] = pArr->paddr[i];
 }
 pArr->paddr[position] = val;
 pArr->cur_len++;
        return '1';
}

variable_types: position int


decompiled_code:
__int64 __fastcall Arr_delete(__int64 a1, int a2)
{
unsigned int v2; // er8
int v3; // edx
int v4; // esi
__int64 v5; // rax

v2 = *(unsigned __int8 *)(a1 + 20);
if ( (_BYTE)v2 != 49 )
Arr_error("Array is not inited yet!!");
if ( a2 < 0 || (v3 = *(_DWORD *)(a1 + 12), v3 <= a2) )
{
puts("the element is not existed yet");
v2 = 48;
}
else
{
v4 = a2 + 1;
if ( v3 > v4 )
{
v5 = 4LL * v4;
do
{
*(_DWORD *)(*(_QWORD *)a1 + v5 - 4) = *(_DWORD *)(*(_QWORD *)a1 + v5);
++v4;
v3 = *(_DWORD *)(a1 + 12);
v5 += 4LL;
}
while ( v3 > v4 );
}
*(_DWORD *)(*(_QWORD *)a1 + 4LL * v3 - 4) = 0;
--*(_DWORD *)(a1 + 12);
}
return v2;
}

original_code:
char Arr_delete(struct Arrlist * pArr, int index){
 if ('1' != pArr->is_inited){
  Arr_error("Array is not inited yet!!");
 }
 if((index < 0) || (index >= pArr->cur_len)) {
  printf("the element is not existed yet\n");
  return '0';
 }
 int i;
 for(i = (index + 1); i <= (pArr->cur_len -1); i++){
  pArr->paddr[i-1]=pArr->paddr[i];
 }
 pArr->paddr[pArr->cur_len-1]=0;
 pArr->cur_len--;
 return '1';
}

canonical_original_code:
char Arr_delete(struct Arrlist *pArr, int index){
 if ('1' != pArr->is_inited){
  Arr_error("Array is not inited yet!!");
 }
 if((index < 0) || (index >= pArr->cur_len)) {
  printf("the element is not existed yet\n");
  return '0';
 }
 int i;
 for(i = (index + 1); i <= (pArr->cur_len -1); i++){
  pArr->paddr[i-1]=pArr->paddr[i];
 }
 pArr->paddr[pArr->cur_len-1]=0;
 pArr->cur_len--;
 return '1';
}


decompiled_code:
__int64 __fastcall Arr_invert(__int64 a1)
{
__int64 result; // rax
int v3; // er8
__int64 v4; // rdx
int v5; // er8
int *v6; // rcx
int v7; // edi

if ( *(_BYTE *)(a1 + 20) != 49 )
Arr_error("Array is not inited yet!!");
result = Arr_is_empty(a1);
if ( (_BYTE)result != 49 )
{
v3 = *(_DWORD *)(a1 + 12);
if ( v3 - 1 > 0 )
{
v4 = 4LL * (v3 - 1);
result = 0LL;
v5 = v3 - 1;
do
{
v6 = (int *)(*(_QWORD *)a1 + 4 * result);
v7 = *v6;
*v6 = *(_DWORD *)(*(_QWORD *)a1 + v4);
*(_DWORD *)(*(_QWORD *)a1 + v4) = v7;
++result;
v4 -= 4LL;
}
while ( v5 - (int)result > (int)result );
}
}
return result;
}

canonical_decompiled_code:
__int64 __fastcall func12(__int64 a1)
{
__int64 result; // rax
int v3; // er8
__int64 v4; // rdx
int v5; // er8
int *v6; // rcx
int v7; // edi

if ( *(_BYTE *)(a1 + 20) != 49 )
func1("Array is not inited yet!!");
result = func4(a1);
if ( (_BYTE)result != 49 )
{
v3 = *(_DWORD *)(a1 + 12);
if ( v3 - 1 > 0 )
{
v4 = 4LL * (v3 - 1);
result = 0LL;
v5 = v3 - 1;
do
{
v6 = (int *)(*(_QWORD *)a1 + 4 * result);
v7 = *v6;
*v6 = *(_DWORD *)(*(_QWORD *)a1 + v4);
*(_DWORD *)(*(_QWORD *)a1 + v4) = v7;
++result;
v4 -= 4LL;
}
while ( v5 - (int)result > (int)result );
}
}
return result;
}

original_code:
void Arr_invert(struct Arrlist * pArr){
 if ('1' != pArr->is_inited){
  Arr_error("Array is not inited yet!!");
 }
 if ('1' == Arr_is_empty(pArr)){
  return;
 }
 int i = 0;
 int j = pArr->cur_len -1;
 int m;
 while(i<j){
  m = pArr->paddr[i];
  pArr->paddr[i] = pArr->paddr[j];
  pArr->paddr[j] = m;
  i++;
  j--;
 }
}

canonical_original_code:
void Arr_invert(struct Arrlist *pArr){
 if ('1' != pArr->is_inited){
  Arr_error("Array is not inited yet!!");
 }
 if ('1' == Arr_is_empty(pArr)){
  return;
 }
 int i = 0;
 int j = pArr->cur_len -1;
 int m;
 while(i<j){
  m = pArr->paddr[i];
  pArr->paddr[i] = pArr->paddr[j];
  pArr->paddr[j] = m;
  i++;
  j--;
 }
}


decompiled_code:
void __fastcall Arr_sort(__int64 a1)
{
if ( *(_BYTE *)(a1 + 20) != 49 )
Arr_error("Array is not inited yet!!");
if ( (unsigned __int8)Arr_is_empty(a1) != 49 )
Arr_sort_dtlmaopao(*(_QWORD *)a1, *(_DWORD *)(a1 + 12));
}

canonical_decompiled_code:
void __fastcall func13(__int64 a1)
{
if ( *(_BYTE *)(a1 + 20) != 49 )
func1("Array is not inited yet!!");
if ( (unsigned __int8)func4(a1) != 49 )
func0(*(_QWORD *)a1, *(_DWORD *)(a1 + 12));
}

original_code:
void Arr_sort(struct Arrlist * pArr){
 if ('1' != pArr->is_inited){
  Arr_error("Array is not inited yet!!");
 }
 if ('1' == Arr_is_empty(pArr)){
  return;
 }
 Arr_sort_dtlmaopao(pArr->paddr, pArr->cur_len);
}

canonical_original_code:
void Arr_sort(struct Arrlist *pArr){
 if ('1' != pArr->is_inited){
  Arr_error("Array is not inited yet!!");
 }
 if ('1' == Arr_is_empty(pArr)){
  return;
 }
 Arr_sort_dtlmaopao(pArr->paddr, pArr->cur_len);
}


decompiled_code:
__int64 __fastcall malloc_41(void **a1, int a2)
{
*a1 = realloc(*a1, 4LL * a2);
return 0LL;
}

canonical_decompiled_code:
__int64 __fastcall func0(void **a1, int a2)
{
*a1 = realloc(*a1, 4LL * a2);
return 0LL;
}

original_code:
int malloc_41(int ** pa, int len){
 *pa = (int *)realloc(*pa, sizeof(int)* (len));
 return 0;
}

canonical_original_code:
int malloc_41(int **pa, int len){
 *pa = (int *)realloc(*pa, sizeof(int)* (len));
 return 0;
}

variable_types:
pa
int **


decompiled_code:
__int64 array1_1()
{
char v0; // bl
signed int i; // ebx
unsigned int v2; // eax
unsigned int j; // ebx
__int64 v5; // [rsp+0h] [rbp-28h] BYREF
unsigned int v6; // [rsp+8h] [rbp-20h]
unsigned int v7; // [rsp+Ch] [rbp-1Ch]

Arr_init(&v5, 10LL);
v0 = Arr_is_empty(&v5);
printf("len is %d\n", v6);
printf("is empty is %c\n", (unsigned int)v0);
putchar(10);
if ( (int)v6 > 0 )
{
for ( i = 0; i < (int)v6; Arr_add(&v5, (unsigned int)(3 * i)) )
++i;
}
printf("cur_len is %d\n", v7);
putchar(10);
v2 = Arr_get(&v5, 8LL);
Arr_set(&v5, 9LL, v2);
Arr_set(&v5, 10LL, 100LL);
Arr_insert(&v5, 10LL, 11111LL);
Arr_insert(&v5, 3LL, 11111LL);
Arr_insert(&v5, 3LL, 22222LL);
Arr_delete(&v5, 4LL);
Arr_show(&v5);
for ( j = 4; j != 84; j += 4 )
Arr_add(&v5, j);
printf("cur_len is %d\n", v7);
printf("len is %d\n", v6);
putchar(10);
Arr_show(&v5);
putchar(10);
Arr_invert(&v5);
Arr_show(&v5);
putchar(10);
Arr_sort(&v5);
Arr_show(&v5);
putchar(10);
return 0LL;
}

canonical_decompiled_code:
__int64 func1()
{
char v0; // bl
signed int i; // ebx
unsigned int v2; // eax
unsigned int j; // ebx
__int64 v5; // [rsp+0h] [rbp-28h] BYREF
unsigned int v6; // [rsp+8h] [rbp-20h]
unsigned int v7; // [rsp+Ch] [rbp-1Ch]

Arr_init(&v5, 10LL);
v0 = Arr_is_empty(&v5);
printf("len is %d\n", v6);
printf("is empty is %c\n", (unsigned int)v0);
putchar(10);
if ( (int)v6 > 0 )
{
for ( i = 0; i < (int)v6; Arr_add(&v5, (unsigned int)(3 * i)) )
++i;
}
printf("cur_len is %d\n", v7);
putchar(10);
v2 = Arr_get(&v5, 8LL);
Arr_set(&v5, 9LL, v2);
Arr_set(&v5, 10LL, 100LL);
Arr_insert(&v5, 10LL, 11111LL);
Arr_insert(&v5, 3LL, 11111LL);
Arr_insert(&v5, 3LL, 22222LL);
Arr_delete(&v5, 4LL);
Arr_show(&v5);
for ( j = 4; j != 84; j += 4 )
Arr_add(&v5, j);
printf("cur_len is %d\n", v7);
printf("len is %d\n", v6);
putchar(10);
Arr_show(&v5);
putchar(10);
Arr_invert(&v5);
Arr_show(&v5);
putchar(10);
Arr_sort(&v5);
Arr_show(&v5);
putchar(10);
return 0LL;
}

original_code:
int array1_1(){
 struct Arrlist arr1;
 struct Arrlist * parr1;
 parr1 = &arr1;
 Arr_init(parr1,10);
 char empty =Arr_is_empty(parr1);
 printf("len is %d\n",parr1->len);
 printf("is empty is %c\n",empty);
 printf("\n");
 int i;
 for (i=0;i<parr1->len;i++){
  Arr_add(parr1,(i+1) * 3);
 }
 printf("cur_len is %d\n",parr1->cur_len);
 printf("\n");
 Arr_set(parr1, 9,Arr_get(parr1,8));
 Arr_set(parr1, 10,100);
 Arr_insert(parr1, 10,11111);
 Arr_insert(parr1, 3,11111);
 Arr_insert(parr1, 3,22222);
 Arr_delete(parr1, 4);
 Arr_show(parr1);
 for (i=0; i<20; i++){
  Arr_add(parr1,(i+1)*4);
 }
     printf("cur_len is %d\n",parr1->cur_len);
 printf("len is %d\n",parr1->len);
 printf("\n");
 Arr_show(parr1);
 printf("\n");
 Arr_invert(parr1);
 Arr_show(parr1);
 printf("\n");
 Arr_sort(parr1);
 Arr_show(parr1);
 printf("\n");
 return 0;
}

canonical_original_code:
int array1_1(){
 struct Arrlist arr1;
 struct Arrlist *parr1;
 parr1 = &arr1;
 Arr_init(parr1,10);
 char empty = Arr_is_empty(parr1);
 printf("len is %d\n",parr1->len);
 printf("is empty is %c\n",empty);
 printf("\n");
 int i;
 for (i=0;i<parr1->len;i++){
  Arr_add(parr1,(i+1) * 3);
 }
 printf("cur_len is %d\n",parr1->cur_len);
 printf("\n");
 Arr_set(parr1, 9,Arr_get(parr1,8));
 Arr_set(parr1, 10,100);
 Arr_insert(parr1, 10,11111);
 Arr_insert(parr1, 3,11111);
 Arr_insert(parr1, 3,22222);
 Arr_delete(parr1, 4);
 Arr_show(parr1);
 for (i=0; i<20; i++){
  Arr_add(parr1,(i+1)*4);
 }
     printf("cur_len is %d\n",parr1->cur_len);
 printf("len is %d\n",parr1->len);
 printf("\n");
 Arr_show(parr1);
 printf("\n");
 Arr_invert(parr1);
 Arr_show(parr1);
 printf("\n");
 Arr_sort(parr1);
 Arr_show(parr1);
 printf("\n");
 return 0;
}

variable_types: struct Arrlist { int *paddr; int len; int cur_len; int increment; char is_inited; }

variable_types: empty char


decompiled_code:
__int64 array1_2()
{
_BYTE v1[40]; // [rsp+0h] [rbp-28h] BYREF

Arr_init(v1, 10LL);
Arr_add(v1, 3LL);
Arr_add(v1, 2LL);
Arr_add(v1, 1LL);
Arr_add(v1, 6LL);
Arr_add(v1, 5LL);
Arr_add(v1, 0LL);
Arr_add(v1, 1LL);
Arr_add(v1, 7LL);
Arr_add(v1, 0LL);
Arr_add(v1, 4LL);
Arr_show(v1);
putchar(10);
Arr_sort(v1);
putchar(10);
return 0LL;
}

canonical_decompiled_code:
__int64 func2()
{
_BYTE v1[40]; // [rsp+0h] [rbp-28h] BYREF

Arr_init(v1, 10LL);
Arr_add(v1, 3LL);
Arr_add(v1, 2LL);
Arr_add(v1, 1LL);
Arr_add(v1, 6LL);
Arr_add(v1, 5LL);
Arr_add(v1, 0LL);
Arr_add(v1, 1LL);
Arr_add(v1, 7LL);
Arr_add(v1, 0LL);
Arr_add(v1, 4LL);
Arr_show(v1);
putchar(10);
Arr_sort(v1);
putchar(10);
return 0LL;
}

original_code:
int array1_2(){
 struct Arrlist arr1;
 struct Arrlist * parr1;
 parr1 = &arr1;
 Arr_init(parr1,10);
 Arr_add(parr1,3);
 Arr_add(parr1,2);
 Arr_add(parr1,1);
 Arr_add(parr1,6);
 Arr_add(parr1,5);
 Arr_add(parr1,0);
 Arr_add(parr1,1);
 Arr_add(parr1,7);
 Arr_add(parr1,0);
 Arr_add(parr1,4);
 Arr_show(parr1);
 printf("\n");
 Arr_sort(parr1);
 printf("\n");
 return 0;
}

canonical_original_code:
int array1_2(){
 struct Arrlist arr1;
 struct Arrlist *parr1;
 parr1 = &arr1;
 Arr_init(parr1,10);
 Arr_add(parr1,3);
 Arr_add(parr1,2);
 Arr_add(parr1,1);
 Arr_add(parr1,6);
 Arr_add(parr1,5);
 Arr_add(parr1,0);
 Arr_add(parr1,1);
 Arr_add(parr1,7);
 Arr_add(parr1,0);
 Arr_add(parr1,4);
 Arr_show(parr1);
 printf("\n");
 Arr_sort(parr1);
 printf("\n");
 return 0;
}


decompiled_code:
__int64 array1_main()
{
array1_1();
puts("array1_main done");
return 0LL;
}

canonical_decompiled_code:
__int64 func3()
{
func1();
puts("array1_main done");
return 0LL;
}

original_code:
int array1_main(){
 int i=0;
 i=array1_1();
 printf("array1_main done\n");
 return 0;
}

canonical_original_code:
int array1_main(){
 int i = 0;
 i=array1_1();
 printf("array1_main done\n");
 return 0;
}

variable_types: i int


decompiled_code:
__int64 char_array1()
{
char *v0; // rbx
int v2; // [rsp+Ch] [rbp-1Ch] BYREF
char v3; // [rsp+10h] [rbp-18h] BYREF

printf("char a is %c\n", 97LL);
v2 = 6512994;
printf("char b is %s\n", (const char *)&v2);
printf("sizeof(b) is %ld\n", 4LL);
v0 = (char *)&v2;
do
printf("%c\n", (unsigned int)*v0++);
while ( v0 != &v3 );
puts("char_array1");
return 0LL;
}

canonical_decompiled_code:
__int64 func0()
{
char *v0; // rbx
int v2; // [rsp+Ch] [rbp-1Ch] BYREF
char v3; // [rsp+10h] [rbp-18h] BYREF

printf("char a is %c\n", 97LL);
v2 = 6512994;
printf("char b is %s\n", (const char *)&v2);
printf("sizeof(b) is %ld\n", 4LL);
v0 = (char *)&v2;
do
printf("%c\n", (unsigned int)*v0++);
while ( v0 != &v3 );
puts("char_array1");
return 0LL;
}

original_code:
int char_array1(){
char a;
a='a';
printf("char a is %c\n",a);
char b[]="bac";
printf("char b is %s\n",b);
printf("sizeof(b) is %ld\n",sizeof(b));
char *p;
p=b;
int i;
for (i=0;i<=3;i++){
 printf("%c\n",*(p+i));
}
printf("char_array1\n");
return 0;
}

canonical_original_code:
int char_array1(){
char a;
a='a';
printf("char a is %c\n",a);
char b[] = "bac";
printf("char b is %s\n",b);
printf("sizeof(b) is %ld\n",sizeof(b));
char *p;
p=b;
int i;
for (i=0;i<=3;i++){
 printf("%c\n",*(p+i));
}
printf("char_array1\n");
return 0;
}

variable_types: a char

variable_types:
b
char []

variable_types:
p
char *


decompiled_code:
__int64 char_array2()
{
char v1[13]; // [rsp+Bh] [rbp-Dh] BYREF

qmemcpy(v1, "abcde", 5);
printf("char c is %s\n", v1);
printf("sizeof(c) is %ld\n", 5LL);
puts("char_array2");
return 0LL;
}

canonical_decompiled_code:
__int64 func1()
{
char v1[13]; // [rsp+Bh] [rbp-Dh] BYREF

qmemcpy(v1, "abcde", 5);
printf("char c is %s\n", v1);
printf("sizeof(c) is %ld\n", 5LL);
puts("char_array2");
return 0LL;
}

original_code:
int char_array2(){
 char c[5];
 c[0]='a';c[1]='b';c[2]='c';c[3]='d';c[4]='e';
 printf("char c is %s\n",c);
 printf("sizeof(c) is %ld\n",sizeof(c));
 int d[3][4];
 printf("char_array2\n");
 return 0;
}

variable_types:
c
char [5]


decompiled_code:
__int64 char_array3()
{
__int64 i; // rbx
__int64 j; // rbx
char v3[10]; // [rsp+5h] [rbp-13h] BYREF

qmemcpy(&v3[6], "cdefd", 5);
for ( i = 0LL; i != 5; ++i )
printf("c[%d] is %c\n", (unsigned int)i, (unsigned int)v3[i + 6]);
printf("char c is %s\n", &v3[6]);
printf("sizeof(c) is %ld\n\n", 5LL);
strcpy(v3, "cdefd");
for ( j = 0LL; j != 6; ++j )
printf("d[%d] is %c\n", (unsigned int)j, (unsigned int)v3[j]);
printf("char d is %s\n", v3);
printf("sizeof(d) is %ld\n\n", 6LL);
puts("char_array3");
return 0LL;
}

canonical_decompiled_code:
__int64 func2()
{
__int64 i; // rbx
__int64 j; // rbx
char v3[10]; // [rsp+5h] [rbp-13h] BYREF

qmemcpy(&v3[6], "cdefd", 5);
for ( i = 0LL; i != 5; ++i )
printf("c[%d] is %c\n", (unsigned int)i, (unsigned int)v3[i + 6]);
printf("char c is %s\n", &v3[6]);
printf("sizeof(c) is %ld\n\n", 5LL);
strcpy(v3, "cdefd");
for ( j = 0LL; j != 6; ++j )
printf("d[%d] is %c\n", (unsigned int)j, (unsigned int)v3[j]);
printf("char d is %s\n", v3);
printf("sizeof(d) is %ld\n\n", 6LL);
puts("char_array3");
return 0LL;
}

original_code:
int char_array3(){
 char c[]={'c','d','e','f','d'};
 int i;
 for (i=0;i<=(sizeof(c) -1);i++){
  printf("c[%d] is %c\n",i,c[i]);
 }
 printf("char c is %s\n",c);
 printf("sizeof(c) is %ld\n\n",sizeof(c));
 char d[6]={'c','d','e','f','d'};
 char *p;
 p=d;
 for (i=0;i<=(sizeof(d) -1);i++){
  printf("d[%d] is %c\n",i,*(p+i));
 }
 printf("char d is %s\n",d);
 printf("sizeof(d) is %ld\n\n",sizeof(d));
 printf("char_array3\n");
 return 0;
}

canonical_original_code:
int char_array3(){
 char c[] = {'c','d','e','f','d'};
 int i;
 for (i=0;i<=(sizeof(c) -1);i++){
  printf("c[%d] is %c\n",i,c[i]);
 }
 printf("char c is %s\n",c);
 printf("sizeof(c) is %ld\n\n",sizeof(c));
 char d[6] = {'c','d','e','f','d'};
 char *p;
 p=d;
 for (i=0;i<=(sizeof(d) -1);i++){
  printf("d[%d] is %c\n",i,*(p+i));
 }
 printf("char d is %s\n",d);
 printf("sizeof(d) is %ld\n\n",sizeof(d));
 printf("char_array3\n");
 return 0;
}

variable_types:
c
char []

variable_types:
d
char [6]


decompiled_code:
__int64 char_array4()
{
size_t v0; // rax
size_t v1; // rax
size_t v2; // rax
char v4[14]; // [rsp+Bh] [rbp-1Dh] BYREF
char v5[4]; // [rsp+19h] [rbp-Fh] BYREF
char v6[8]; // [rsp+1Dh] [rbp-Bh] BYREF

strcpy(v5, "cde");
strcpy(v6, "dg");
printf("char c is %s\n", v5);
printf("sizeof(c) is %ld\n", 7LL);
v0 = strlen(v5);
printf("strlen(c) is %ld\n\n", v0);
strcpy(&v4[7], "cdefdg");
printf("char d is %s\n", &v4[7]);
printf("sizeof(d) is %ld\n", 7LL);
v1 = strlen(&v4[7]);
printf("strlen(d) is %ld\n\n", v1);
strcpy(v4, "cdefdg");
printf("char e is %s\n", v4);
printf("sizeof(e) is %ld\n", 7LL);
v2 = strlen(v4);
printf("strlen(e) is %ld\n\n", v2);
puts("char_array4");
return 0LL;
}

canonical_decompiled_code:
__int64 func3()
{
size_t v0; // rax
size_t v1; // rax
size_t v2; // rax
char v4[14]; // [rsp+Bh] [rbp-1Dh] BYREF
char v5[4]; // [rsp+19h] [rbp-Fh] BYREF
char v6[8]; // [rsp+1Dh] [rbp-Bh] BYREF

strcpy(v5, "cde");
strcpy(v6, "dg");
printf("char c is %s\n", v5);
printf("sizeof(c) is %ld\n", 7LL);
v0 = strlen(v5);
printf("strlen(c) is %ld\n\n", v0);
strcpy(&v4[7], "cdefdg");
printf("char d is %s\n", &v4[7]);
printf("sizeof(d) is %ld\n", 7LL);
v1 = strlen(&v4[7]);
printf("strlen(d) is %ld\n\n", v1);
strcpy(v4, "cdefdg");
printf("char e is %s\n", v4);
printf("sizeof(e) is %ld\n", 7LL);
v2 = strlen(v4);
printf("strlen(e) is %ld\n\n", v2);
puts("char_array4");
return 0LL;
}

original_code:
int char_array4(){
 char c[]={'c','d','e','\000','d','g','\000'};
 printf("char c is %s\n",c);
 printf("sizeof(c) is %ld\n",sizeof(c));
        printf("strlen(c) is %ld\n\n",strlen(c));
 char d[]="cdefdg";
 printf("char d is %s\n",d);
 printf("sizeof(d) is %ld\n",sizeof(d));
        printf("strlen(d) is %ld\n\n",strlen(d));
 char e[7]="cdefdg";
 printf("char e is %s\n",e);
 printf("sizeof(e) is %ld\n",sizeof(e));
        printf("strlen(e) is %ld\n\n",strlen(e));
 printf("char_array4\n");
 return 0;
}

canonical_original_code:
int char_array4(){
 char c[] = {'c','d','e','\000','d','g','\000'};
 printf("char c is %s\n",c);
 printf("sizeof(c) is %ld\n",sizeof(c));
        printf("strlen(c) is %ld\n\n",strlen(c));
 char d[] = "cdefdg";
 printf("char d is %s\n",d);
 printf("sizeof(d) is %ld\n",sizeof(d));
        printf("strlen(d) is %ld\n\n",strlen(d));
 char e[7] = "cdefdg";
 printf("char e is %s\n",e);
 printf("sizeof(e) is %ld\n",sizeof(e));
        printf("strlen(e) is %ld\n\n",strlen(e));
 printf("char_array4\n");
 return 0;
}

variable_types:
d
char []

variable_types:
e
char [7]


decompiled_code:
__int64 char_array5()
{
size_t v0; // rax
size_t v1; // rax
char s[15]; // [rsp+9h] [rbp-Fh] BYREF

strcpy(s, "abcdef");
printf("sizeof(c) is %ld\n", 7LL);
v0 = strlen(s);
printf("strlen(c) is %ld\n", v0);
printf("c[0] is %c\n", (unsigned int)s[0]);
printf("c[1] is %c\n", (unsigned int)s[1]);
printf("c[2] is %c\n\n", (unsigned int)s[2]);
s[3] = 107;
printf("char c is %s\n", s);
printf("sizeof(p) is %ld\n", 8LL);
v1 = strlen(s);
printf("strlen(p) is %ld\n", v1);
printf("p[0] is %c\n", (unsigned int)s[0]);
printf("p[1] is %c\n", (unsigned int)s[1]);
printf("p[2] is %c\n\n", (unsigned int)s[2]);
printf("char q is %s\n", "abcdef");
printf("sizeof(q) is %ld\n", 8LL);
printf("strlen(q) is %ld\n\n", 6LL);
printf("q[0] is %c\n", 97LL);
printf("q[1] is %c\n", 98LL);
printf("q[2] is %c\n\n", 99LL);
puts("char_array5");
return 0LL;
}

canonical_decompiled_code:
__int64 func4()
{
size_t v0; // rax
size_t v1; // rax
char s[15]; // [rsp+9h] [rbp-Fh] BYREF

strcpy(s, "abcdef");
printf("sizeof(c) is %ld\n", 7LL);
v0 = strlen(s);
printf("strlen(c) is %ld\n", v0);
printf("c[0] is %c\n", (unsigned int)s[0]);
printf("c[1] is %c\n", (unsigned int)s[1]);
printf("c[2] is %c\n\n", (unsigned int)s[2]);
s[3] = 107;
printf("char c is %s\n", s);
printf("sizeof(p) is %ld\n", 8LL);
v1 = strlen(s);
printf("strlen(p) is %ld\n", v1);
printf("p[0] is %c\n", (unsigned int)s[0]);
printf("p[1] is %c\n", (unsigned int)s[1]);
printf("p[2] is %c\n\n", (unsigned int)s[2]);
printf("char q is %s\n", "abcdef");
printf("sizeof(q) is %ld\n", 8LL);
printf("strlen(q) is %ld\n\n", 6LL);
printf("q[0] is %c\n", 97LL);
printf("q[1] is %c\n", 98LL);
printf("q[2] is %c\n\n", 99LL);
puts("char_array5");
return 0LL;
}

original_code:
int char_array5(){
 char c[]="abcdef";
 printf("sizeof(c) is %ld\n",sizeof(c));
        printf("strlen(c) is %ld\n",strlen(c));
 printf("c[0] is %c\n",*c );
 printf("c[1] is %c\n",c[1]); printf("c[2] is %c\n\n",*(c+2));
 char *p;
 p=c;
        p[3]='k';
 printf("char c is %s\n",p);
 printf("sizeof(p) is %ld\n",sizeof(p));
        printf("strlen(p) is %ld\n",strlen(p));
 printf("p[0] is %c\n",*p );
 printf("p[1] is %c\n",p[1]);
 printf("p[2] is %c\n\n",*(p+2));
        char *q="abcdef";
 printf("char q is %s\n",q);
 printf("sizeof(q) is %ld\n",sizeof(q));
        printf("strlen(q) is %ld\n\n",strlen(q));
 printf("q[0] is %c\n",*q );
 printf("q[1] is %c\n",q[1]);
 printf("q[2] is %c\n\n",*(q+2));
 printf("char_array5\n");
 return 0;
}

canonical_original_code:
int char_array5(){
 char c[] = "abcdef";
 printf("sizeof(c) is %ld\n",sizeof(c));
        printf("strlen(c) is %ld\n",strlen(c));
 printf("c[0] is %c\n",*c );
 printf("c[1] is %c\n",c[1]); printf("c[2] is %c\n\n",*(c+2));
 char *p;
 p=c;
        p[3]='k';
 printf("char c is %s\n",p);
 printf("sizeof(p) is %ld\n",sizeof(p));
        printf("strlen(p) is %ld\n",strlen(p));
 printf("p[0] is %c\n",*p );
 printf("p[1] is %c\n",p[1]);
 printf("p[2] is %c\n\n",*(p+2));
        char *q = "abcdef";
 printf("char q is %s\n",q);
 printf("sizeof(q) is %ld\n",sizeof(q));
        printf("strlen(q) is %ld\n\n",strlen(q));
 printf("q[0] is %c\n",*q );
 printf("q[1] is %c\n",q[1]);
 printf("q[2] is %c\n\n",*(q+2));
 printf("char_array5\n");
 return 0;
}

variable_types:
q
char *


getlen

decompiled_code:
__int64 getlen()
{
return 8LL;
}

canonical_decompiled_code:
__int64 func5()
{
return 8LL;
}

original_code:
long int getlen(char* a){
 return sizeof(a);
}

canonical_original_code:
long getlen(char *a){
 return sizeof(a);
}

variable_types:
a
char *

return_type: long


decompiled_code:
__int64 char_array6()
{
__int64 v0; // rbx
char v2[23]; // [rsp+1h] [rbp-17h] BYREF

strcpy(v2, "abcdefghikjlmn");
printf("sizeof(c) is %ld\n", 15LL);
printf("sizeof(p) is %ld\n\n", 8LL);
printf("sizeof(q) is %ld\n", 8LL);
printf("sizeof(r) is %ld\n\n", 8LL);
printf("sizeof(int) is %ld\n\n", 4LL);
printf("sizeof(long) is %ld\n\n", 8LL);
printf("sizeof(char) is %ld\n\n", 1LL);
v0 = getlen(v2);
printf("getlen(c) is %ld\n", v0);
printf("getlen(p) is %ld\n\n", v0);
puts("char_array6");
return 0LL;
}

canonical_decompiled_code:
__int64 func6()
{
__int64 v0; // rbx
char v2[23]; // [rsp+1h] [rbp-17h] BYREF

strcpy(v2, "abcdefghikjlmn");
printf("sizeof(c) is %ld\n", 15LL);
printf("sizeof(p) is %ld\n\n", 8LL);
printf("sizeof(q) is %ld\n", 8LL);
printf("sizeof(r) is %ld\n\n", 8LL);
printf("sizeof(int) is %ld\n\n", 4LL);
printf("sizeof(long) is %ld\n\n", 8LL);
printf("sizeof(char) is %ld\n\n", 1LL);
v0 = func5(v2);
printf("getlen(c) is %ld\n", v0);
printf("getlen(p) is %ld\n\n", v0);
puts("char_array6");
return 0LL;
}

original_code:
int char_array6(){
 char c[]="abcdefghikjlmn";
 char *p;
 p=c;
 printf("sizeof(c) is %ld\n",sizeof(c));
 printf("sizeof(p) is %ld\n\n",sizeof(p));
 char *q;
 int *r;
 printf("sizeof(q) is %ld\n",sizeof(q));
 printf("sizeof(r) is %ld\n\n",sizeof(r));
 printf("sizeof(int) is %ld\n\n",sizeof(int));
 printf("sizeof(long) is %ld\n\n",sizeof(long));
 printf("sizeof(char) is %ld\n\n",sizeof(char));
 printf("getlen(c) is %ld\n",getlen(c));
 printf("getlen(p) is %ld\n\n",getlen(p));
 printf("char_array6\n");
 return 0;
}

canonical_original_code:
int char_array6(){
 char c[] = "abcdefghikjlmn";
 char *p;
 p=c;
 printf("sizeof(c) is %ld\n",sizeof(c));
 printf("sizeof(p) is %ld\n\n",sizeof(p));
 char *q;
 int *r;
 printf("sizeof(q) is %ld\n",sizeof(q));
 printf("sizeof(r) is %ld\n\n",sizeof(r));
 printf("sizeof(int) is %ld\n\n",sizeof(int));
 printf("sizeof(long) is %ld\n\n",sizeof(long));
 printf("sizeof(char) is %ld\n\n",sizeof(char));
 printf("getlen(c) is %ld\n",getlen(c));
 printf("getlen(p) is %ld\n\n",getlen(p));
 printf("char_array6\n");
 return 0;
}

variable_types:
r
int *


f

decompiled_code:
void f()
{
;
}

canonical_decompiled_code:
void func0()
{
;
}

original_code:
void f(int i){
 i = 100;
}

canonical_original_code:
void f(int i){
 i = 100;
}


decompiled_code:
__int64 para1()
{
unsigned int v1[3]; // [rsp+Ch] [rbp-Ch] BYREF

v1[0] = 9;
printf("i=%d \n", 9LL);
printf("i=%d \n", 9LL);
f2(v1);
printf("i=%d \n", v1[0]);
puts("para done");
return 0LL;
}

canonical_decompiled_code:
__int64 func2()
{
unsigned int v1[3]; // [rsp+Ch] [rbp-Ch] BYREF

v1[0] = 9;
printf("i=%d \n", 9LL);
printf("i=%d \n", 9LL);
func1(v1);
printf("i=%d \n", v1[0]);
puts("para done");
return 0LL;
}

original_code:
int para1(void){
 int i = 9;
 printf("i=%d \n",i);
 f(i);
 printf("i=%d \n",i);
 f2(&i);
 printf("i=%d \n",i); printf("para done\n");
 return 0;
}

canonical_original_code:
int para1(){
 int i = 9;
 printf("i=%d \n",i);
 f(i);
 printf("i=%d \n",i);
 f2(&i);
 printf("i=%d \n",i); printf("para done\n");
 return 0;
}


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

*a1 = -1;
printf(" a is ");
if ( a2 > 0 )
{
v2 = a1;
do
printf("%d ", *v2++);
while ( v2 != &a1[a2 - 1 + 1] );
}
return printf("\n ");
}

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

*a1 = -1;
printf(" a is ");
if ( a2 > 0 )
{
v2 = a1;
do
printf("%d ", *v2++);
while ( v2 != &a1[a2 - 1 + 1] );
}
return printf("\n ");
}

original_code:
void show_array_1(int *p, int len){
 p[0]=-1;
 int i;
 printf(" a is ");
 for (i=0;i<len;i++){
  printf("%d ",p[i]);
 }
 printf("\n ");
}

variable_types:
p
int *

variable_types: len int


original_code:
int array_point_1(){
 int a[5] = {1,2,3,4,5};
 show_array_1(a,5);
 printf("array_point done\n");
 return 0;
}

variable_types:
a
int [5]


decompiled_code:
__int64 pointer1()
{
printf("char p is %s\n", "ab");
printf("p is %p\n", "ab");
printf("p2 is %p\n", "b");
printf("p is %p\n", (const void *)0x75686C7);
printf("p2 is %p\n", (const void *)0x75686CB);
puts("pointer1 done");
putchar(10);
return 0LL;
}

canonical_decompiled_code:
__int64 func5()
{
printf("char p is %s\n", "ab");
printf("p is %p\n", "ab");
printf("p2 is %p\n", "b");
printf("p is %p\n", (const void *)0x75686C7);
printf("p2 is %p\n", (const void *)0x75686CB);
puts("pointer1 done");
putchar(10);
return 0LL;
}

original_code:
int pointer1(){
 char * p= "ab";
 char * p2 = p+1;
 printf ("char p is %s\n",p);
 printf ("p is %p\n",p);
 printf ("p2 is %p\n",p2);
 int * p3= (int *)123111111;
 int * p4 = p3+1;
 printf ("p is %p\n",p3);
 printf ("p2 is %p\n",p4);
 printf("pointer1 done\n");
 printf("\n");
 return 0;
}

canonical_original_code:
int pointer1(){
 char *p = "ab";
 char *p2 = p+1;
 printf ("char p is %s\n",p);
 printf ("p is %p\n",p);
 printf ("p2 is %p\n",p2);
 int *p3 = (int *)123111111;
 int *p4 = p3+1;
 printf ("p is %p\n",p3);
 printf ("p2 is %p\n",p4);
 printf("pointer1 done\n");
 printf("\n");
 return 0;
}


decompiled_code:
__int64 __fastcall pointer2(__int64 a1, __int64 a2, __int64 a3, __int64 a4, __int64 a5, __int64 a6, int a7, int a8, int a9, int a10, int a11, char a12)
{
char v13[8]; // [rsp+10h] [rbp-8h] BYREF

printf("last is %p\n", "sd");
printf("ap is %p\n", "is %p\n");
printf("ap2 is %p\n", v13);
printf("ap3 is %p\n", &a12);
printf("ap4 is %p\n", &a12);
printf("bp is %p\n", "is %p\n");
printf("cp is %p\n", "is %p\n");
putchar(10);
return 0LL;
}

canonical_decompiled_code:
__int64 __fastcall func6(__int64 a1, __int64 a2, __int64 a3, __int64 a4, __int64 a5, __int64 a6, int a7, int a8, int a9, int a10, int a11, char a12)
{
char v13[8]; // [rsp+10h] [rbp-8h] BYREF

printf("last is %p\n", "sd");
printf("ap is %p\n", "is %p\n");
printf("ap2 is %p\n", v13);
printf("ap3 is %p\n", &a12);
printf("ap4 is %p\n", &a12);
printf("bp is %p\n", "is %p\n");
printf("cp is %p\n", "is %p\n");
putchar(10);
return 0LL;
}

original_code:
int pointer2(){
 char *last = "sd";
 char *ap = (char *)last + sizeof(last);
 char *ap2 = (char *)&last + sizeof(last);
 char **ap3 = (char **)&last + sizeof(last);
 char **ap4 = &last + sizeof(last);
 char *bp = last + sizeof(last);
 char *cp = (char *)(last + sizeof(last));
 printf ("last is %p\n",last);
 printf ("ap is %p\n",ap);
 printf ("ap2 is %p\n",ap2);
 printf ("ap3 is %p\n",ap3);
 printf ("ap4 is %p\n",ap3);
 printf ("bp is %p\n",bp);
 printf ("cp is %p\n",cp);
 printf("\n");
 return 0;
}

variable_types:
last
char *

variable_types:
ap
char *

variable_types:
bp
char *

variable_types:
cp
char *


decompiled_code:
__int64 pointer3()
{
int v1; // [rsp+Ch] [rbp-Ch] BYREF
char v2[4]; // [rsp+14h] [rbp-4h] BYREF

v1 = 123;
printf("last is %p\n", &v1);
printf("ap is %p\n", v2);
printf("bp is %p\n", v2);
printf("cp is %p\n", v2);
putchar(10);
return 0LL;
}

canonical_decompiled_code:
__int64 func7()
{
int v1; // [rsp+Ch] [rbp-Ch] BYREF
char v2[4]; // [rsp+14h] [rbp-4h] BYREF

v1 = 123;
printf("last is %p\n", &v1);
printf("ap is %p\n", v2);
printf("bp is %p\n", v2);
printf("cp is %p\n", v2);
putchar(10);
return 0LL;
}

original_code:
int pointer3(){
 int abc =123;
 int *last = &abc;
 int *ap = (int *)last + 2;
 int *bp = last + 2;
 int *cp = (int *)(last + 2);
 printf ("last is %p\n",last);
 printf ("ap is %p\n",ap);
 printf ("bp is %p\n",bp);
 printf ("cp is %p\n",cp);
 printf("\n");
 return 0;
}

canonical_original_code:
int pointer3(){
 int abc = 123;
 int *last = &abc;
 int *ap = (int *)last + 2;
 int *bp = last + 2;
 int *cp = (int *)(last + 2);
 printf ("last is %p\n",last);
 printf ("ap is %p\n",ap);
 printf ("bp is %p\n",bp);
 printf ("cp is %p\n",cp);
 printf("\n");
 return 0;
}

variable_types: abc int

variable_types:
last
int *

variable_types:
ap
int *

variable_types:
bp
int *

variable_types:
cp
int *


decompiled_code:
__int64 pointer4()
{
int v1[3]; // [rsp+Ch] [rbp-Ch] BYREF

v1[0] = 97;
printf("ap is %p\n", v1);
printf("*ap is %c\n", (unsigned int)SLOBYTE(v1[0]));
v1[0] = -143;
printf("*ap is %c\n", 113LL);
v1[0] = 831;
printf("*ap is %c\n", 63LL);
v1[0] = 0x7FFFFFFF;
printf("*ap is %c\n", 0xFFFFFFFFLL);
v1[0] = 0x80000000;
printf("*ap is %c\n", 0LL);
putchar(10);
return 0LL;
}

canonical_decompiled_code:
__int64 func8()
{
int v1[3]; // [rsp+Ch] [rbp-Ch] BYREF

v1[0] = 97;
printf("ap is %p\n", v1);
printf("*ap is %c\n", (unsigned int)SLOBYTE(v1[0]));
v1[0] = -143;
printf("*ap is %c\n", 113LL);
v1[0] = 831;
printf("*ap is %c\n", 63LL);
v1[0] = 0x7FFFFFFF;
printf("*ap is %c\n", 0xFFFFFFFFLL);
v1[0] = 0x80000000;
printf("*ap is %c\n", 0LL);
putchar(10);
return 0LL;
}

original_code:
int pointer4(){
 int abc =97;
 char *ap = (char *) &abc;
 printf ("ap is %p\n",ap);
 printf ("*ap is %c\n",*ap);
 abc=-143;
 printf ("*ap is %c\n",*ap);
 abc=831;
 printf ("*ap is %c\n",*ap);
 abc=2147483647;
 printf ("*ap is %c\n",*ap);
 abc=2147483648;
 printf ("*ap is %c\n",*ap);
 printf("\n");
 return 0;
}

canonical_original_code:
int pointer4(){
 int abc = 97;
 char *ap = (char *) &abc;
 printf ("ap is %p\n",ap);
 printf ("*ap is %c\n",*ap);
 abc=-143;
 printf ("*ap is %c\n",*ap);
 abc=831;
 printf ("*ap is %c\n",*ap);
 abc=2147483647;
 printf ("*ap is %c\n",*ap);
 abc=2147483648;
 printf ("*ap is %c\n",*ap);
 printf("\n");
 return 0;
}


decompiled_code:
__int64 pointer5()
{
printf("*p is %d\n", 97LL);
printf("*q is %d\n", 97LL);
printf("*q is %c\n", 97LL);
putchar(10);
return 0LL;
}

canonical_decompiled_code:
__int64 func9()
{
printf("*p is %d\n", 97LL);
printf("*q is %d\n", 97LL);
printf("*q is %c\n", 97LL);
putchar(10);
return 0LL;
}

original_code:
int pointer5(){
 int i =97;
 int * p = &i;
 char * q = (char *)&i;
 printf ("*p is %d\n",*p);
 printf ("*q is %d\n",*q);
 printf ("*q is %c\n",*q);
 printf("\n");
 return 0;
}

canonical_original_code:
int pointer5(){
 int i = 97;
 int *p = &i;
 char *q = (char *)&i;
 printf ("*p is %d\n",*p);
 printf ("*q is %d\n",*q);
 printf ("*q is %c\n",*q);
 printf("\n");
 return 0;
}

variable_types: i int


decompiled_code:
__int64 pointer6()
{
printf("*p is %d\n", 24930LL);
printf("*q is %c\n", 98LL);
printf("*(q+1) is %c\n", 97LL);
putchar(10);
return 0LL;
}

canonical_decompiled_code:
__int64 func10()
{
printf("*p is %d\n", 24930LL);
printf("*q is %c\n", 98LL);
printf("*(q+1) is %c\n", 97LL);
putchar(10);
return 0LL;
}

original_code:
int pointer6(){
 int i = 24930;
 int * p = &i;
 char * q = (char *)&i;
 printf ("*p is %d\n",*p);
 printf ("*q is %c\n",*q);
 printf ("*(q+1) is %c\n",*(q+1));
 printf("\n");
 return 0;
}

canonical_original_code:
int pointer6(){
 int i = 24930;
 int *p = &i;
 char *q = (char *)&i;
 printf ("*p is %d\n",*p);
 printf ("*q is %c\n",*q);
 printf ("*(q+1) is %c\n",*(q+1));
 printf("\n");
 return 0;
}


original_code:
int pointer7(){
 int i = -24930;
 int * p = &i;
 char * q = (char *)&i;
 printf ("*p is %d\n",*p);
 printf ("*q is %c\n",*q);
 printf ("*(q+1) is %c\n",*(q+1));
 printf("\n");
 return 0;
}

canonical_original_code:
int pointer7(){
 int i = -24930;
 int *p = &i;
 char *q = (char *)&i;
 printf ("*p is %d\n",*p);
 printf ("*q is %c\n",*q);
 printf ("*(q+1) is %c\n",*(q+1));
 printf("\n");
 return 0;
}


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

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

original_code:
int mem1(){
 int i = 2;
 int ii = -3;
 int aii = -2147483648;
        int iii = i + ii;
        return 0;
}

variable_types: ii int

variable_types: aii int

variable_types: iii int


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

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

original_code:
int pointer_main(){
 int i;
        i = mem1();
 return 0;
}


decompiled_code:
__int64 array_main()
{
malloc_main();
puts("array_mian done!");
return 0LL;
}

canonical_decompiled_code:
__int64 func0()
{
malloc_main();
puts("array_mian done!");
return 0LL;
}

original_code:
int array_main(){
 int i;
 i=malloc_main();
 printf("array_mian done!\n");
 return 0;
}


decompiled_code:
__int64 array2()
{
printf("B[0][0] is %d\n", 0LL);
printf("B[0][0] is %d\n", 99LL);
printf("B[0][1] is %d\n", 1LL);
printf("B[2][2] is %d\n", 12LL);
puts("array2 done");
return 0LL;
}

canonical_decompiled_code:
__int64 func2()
{
printf("B[0][0] is %d\n", 0LL);
printf("B[0][0] is %d\n", 99LL);
printf("B[0][1] is %d\n", 1LL);
printf("B[2][2] is %d\n", 12LL);
puts("array2 done");
return 0LL;
}


decompiled_code:
__int64 array3()
{
printf("B[1][2] is %d\n", 12LL);
printf("B[2][1] is %d\n", 21LL);
puts("array3 done");
return 0LL;
}

canonical_decompiled_code:
__int64 func3()
{
printf("B[1][2] is %d\n", 12LL);
printf("B[2][1] is %d\n", 21LL);
puts("array3 done");
return 0LL;
}


decompiled_code:
__int64 array4()
{
printf("B[1][2] is %d\n", 12LL);
printf("B[2][1] is %d\n", 21LL);
puts("array4 done");
return 0LL;
}

canonical_decompiled_code:
__int64 func4()
{
printf("B[1][2] is %d\n", 12LL);
printf("B[2][1] is %d\n", 21LL);
puts("array4 done");
return 0LL;
}


decompiled_code:
__int64 array5()
{
printf("B[1][2] is %d\n", 12LL);
printf("B[2][1] is %d\n", 21LL);
puts("array5 done");
return 0LL;
}

canonical_decompiled_code:
__int64 func5()
{
printf("B[1][2] is %d\n", 12LL);
printf("B[2][1] is %d\n", 21LL);
puts("array5 done");
return 0LL;
}


decompiled_code:
__int64 array6()
{
printf("A[3] is %d\n", 4LL);
return 0LL;
}

canonical_decompiled_code:
__int64 func6()
{
printf("A[3] is %d\n", 4LL);
return 0LL;
}

variable_types:
A
int []


decompiled_code:
__int64 struct1()
{
__int64 v1; // [rsp+4h] [rbp-24h] BYREF
__int16 v2; // [rsp+Ch] [rbp-1Ch]
int v3; // [rsp+10h] [rbp-18h]

v1 = 0x6E6F73614ALL;
v2 = 0;
v3 = 20;
printf("%d %s %d\n", 1000LL, (const char *)&v1, 20LL);
strcpy((char *)&v1, "Cindy");
v3 = 38;
printf("%d %s %d\n", 99LL, (const char *)&v1, 38LL);
puts("struct done");
return 0LL;
}

canonical_decompiled_code:
__int64 func0()
{
__int64 v1; // [rsp+4h] [rbp-24h] BYREF
__int16 v2; // [rsp+Ch] [rbp-1Ch]
int v3; // [rsp+10h] [rbp-18h]

v1 = 0x6E6F73614ALL;
v2 = 0;
v3 = 20;
printf("%d %s %d\n", 1000LL, (const char *)&v1, 20LL);
strcpy((char *)&v1, "Cindy");
v3 = 38;
printf("%d %s %d\n", 99LL, (const char *)&v1, 38LL);
puts("struct done");
return 0LL;
}

original_code:
int struct1(void) {
 struct Student st = {1000, "Jason", 20};
 printf("%d %s %d\n",st.sid, st.name, st.age);
 st.sid = 99;
 strcpy(st.name, "Cindy");
        st.age = 38;
 printf("%d %s %d\n",st.sid, st.name, st.age);
 printf("struct done\n");
 return 0;
}

canonical_original_code:
int struct1() {
 struct Student st = {1000, "Jason", 20};
 printf("%d %s %d\n",st.sid, st.name, st.age);
 st.sid = 99;
 strcpy(st.name, "Cindy");
        st.age = 38;
 printf("%d %s %d\n",st.sid, st.name, st.age);
 printf("struct done\n");
 return 0;
}

variable_types: struct Student { int sid; char name[10]; int age; }


decompiled_code:
__int64 struct2()
{
char v1[12]; // [rsp+4h] [rbp-24h] BYREF
int v2; // [rsp+10h] [rbp-18h]

strcpy(v1, "Moon");
v2 = 28;
printf("%d %s %d\n", 101LL, v1, 28LL);
return 0LL;
}

canonical_decompiled_code:
__int64 func1()
{
char v1[12]; // [rsp+4h] [rbp-24h] BYREF
int v2; // [rsp+10h] [rbp-18h]

strcpy(v1, "Moon");
v2 = 28;
printf("%d %s %d\n", 101LL, v1, 28LL);
return 0LL;
}

original_code:
int struct2(void) {
 struct Student st;
 struct Student *pst;
 pst=&st;
        pst->sid = 101;
 strcpy(pst->name,"Moon");
        pst->age =28;
 printf("%d %s %d\n",pst->sid, pst->name, pst->age);
 return 0;
}

canonical_original_code:
int struct2() {
 struct Student st;
 struct Student *pst;
 pst=&st;
        pst->sid = 101;
 strcpy(pst->name,"Moon");
        pst->age =28;
 printf("%d %s %d\n",pst->sid, pst->name, pst->age);
 return 0;
}

variable_types: struct Student { int sid; char name[10]; int age; } *


sv

original_code:
void sv(struct Student * pst){
 pst->sid = 102;
 strcpy(pst->name, "Crystal");
 pst->age=24;
}

canonical_original_code:
void sv(struct Student *pst){
 pst->sid = 102;
 strcpy(pst->name, "Crystal");
 pst->age=24;
}

user_defined_types: struct Student { int sid; char name[10]; int age; }


pv

decompiled_code:
int __fastcall pv(const char *a1)
{
return printf("%d %s %d\n", *(unsigned int *)a1, a1 + 4, *((unsigned int *)a1 + 4));
}

canonical_decompiled_code:
int __fastcall func3(const char *a1)
{
return printf("%d %s %d\n", *(unsigned int *)a1, a1 + 4, *((unsigned int *)a1 + 4));
}

original_code:
void pv(struct Student * pst){
 printf("%d %s %d\n",pst->sid, pst->name, pst->age);
}

canonical_original_code:
void pv(struct Student *pst){
 printf("%d %s %d\n",pst->sid, pst->name, pst->age);
}


decompiled_code:
__int64 struct3()
{
char v1[40]; // [rsp+0h] [rbp-28h] BYREF

sv((__int64)v1);
pv(v1);
return 0LL;
}

canonical_decompiled_code:
__int64 func4()
{
char v1[40]; // [rsp+0h] [rbp-28h] BYREF

func2((__int64)v1);
func3(v1);
return 0LL;
}

original_code:
int struct3(void) {
 struct Student st;
 sv(&st);
 pv(&st);
 return 0;
}

canonical_original_code:
int struct3() {
 struct Student st;
 sv(&st);
 pv(&st);
 return 0;
}


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

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

original_code:
int malloc_2(){
 return 0;
}

canonical_original_code:
int malloc_2(){
 return 0;
}


decompiled_code:
__int64 __fastcall malloc_4(void **a1, int a2)
{
*a1 = realloc(*a1, 4LL * a2);
return 0LL;
}

canonical_decompiled_code:
__int64 __fastcall func2(void **a1, int a2)
{
*a1 = realloc(*a1, 4LL * a2);
return 0LL;
}

original_code:
int malloc_4(int ** pa, int len){
 *pa = (int *)realloc(*pa, sizeof(int)* (len));
 return 0;
}

canonical_original_code:
int malloc_4(int **pa, int len){
 *pa = (int *)realloc(*pa, sizeof(int)* (len));
 return 0;
}

variable_types:
pa
int **

variable_types: len int


decompiled_code:
__int64 malloc_3()
{
int v0; // eax
__int64 v1; // rdx
void *v2; // rdi
void *ptr; // [rsp+8h] [rbp-10h] BYREF

ptr = malloc(0x1CuLL);
v0 = 2;
v1 = 0LL;
do
{
*(_DWORD *)((char *)ptr + v1) = v0;
v1 += 4LL;
v0 += 2;
}
while ( v0 != 16 );
p_array_int_1(ptr, 7LL);
printf("address is %p\n", ptr);
malloc_4(&ptr, 8);
v2 = ptr;
*((_DWORD *)ptr + 7) = 40;
p_array_int_1(v2, 8LL);
printf("address is %p\n", ptr);
free(ptr);
return 0LL;
}

canonical_decompiled_code:
__int64 func3()
{
int v0; // eax
__int64 v1; // rdx
void *v2; // rdi
void *ptr; // [rsp+8h] [rbp-10h] BYREF

ptr = malloc(0x1CuLL);
v0 = 2;
v1 = 0LL;
do
{
*(_DWORD *)((char *)ptr + v1) = v0;
v1 += 4LL;
v0 += 2;
}
while ( v0 != 16 );
p_array_int_1(ptr, 7LL);
printf("address is %p\n", ptr);
func2(&ptr, 8);
v2 = ptr;
*((_DWORD *)ptr + 7) = 40;
p_array_int_1(v2, 8LL);
printf("address is %p\n", ptr);
free(ptr);
return 0LL;
}

original_code:
int malloc_3(){
 int len = 7;
 int * a = (int *)malloc(sizeof(int) * len);
 int i;
 for (i=0; i <len ; i++){
  a[i] = (i+1)*2;
 }
 i = p_array_int_1(a,len);
 printf("address is %p\n", a);
 len++;
 i = malloc_4(&a, len);
 a[len-1]= 40;
 i = p_array_int_1(a,len);
 printf("address is %p\n", a);
 free(a);
 return 0;
}

canonical_original_code:
int malloc_3(){
 int len = 7;
 int *a = (int *)malloc(sizeof(int) * len);
 int i;
 for (i=0; i <len ; i++){
  a[i] = (i+1)*2;
 }
 i = p_array_int_1(a,len);
 printf("address is %p\n", a);
 len++;
 i = malloc_4(&a, len);
 a[len-1]= 40;
 i = p_array_int_1(a,len);
 printf("address is %p\n", a);
 free(a);
 return 0;
}

variable_types:
a
int *


decompiled_code:
__int64 malloc_main()
{
malloc_3();
puts("malloc main done");
return 0LL;
}

canonical_decompiled_code:
__int64 func4()
{
func3();
puts("malloc main done");
return 0LL;
}

original_code:
int malloc_main(){
 int i;
 i = malloc_3();
 printf("malloc main done\n");
 return 0;
}


bsget

decompiled_code:
__int64 __fastcall bsget(int a1, __int64 a2, int a3)
{
int v4; // ebp
__int64 v5; // rsi
int v6; // edx
int v7; // ebx
int v8; // eax

v4 = a3 - 1;
if ( a3 - 1 > 0 )
{
LODWORD(v5) = 0;
v6 = 0;
while ( 1 )
{
v5 = (unsigned int)(v5 + 1);
v7 = (v4 + v6) / 2;
v8 = *(_DWORD *)(a2 + 4LL * v7);
if ( a1 > v8 )
{
v6 = v7 + 1;
}
else
{
if ( a1 == v8 )
{
printf("done the while %d times\n", v5);
return (unsigned int)v7;
}
v4 = v7 - 1;
}
if ( v6 >= v4 )
goto LABEL_10;
}
}
v5 = 0LL;
LABEL_10:
if ( *(_DWORD *)(a2 + 4LL * v4) == a1 )
{
printf("done the while %d times\n", v5);
}
else
{
printf("done the while %d times\n", v5);
v4 = -1;
}
return (unsigned int)v4;
}

canonical_decompiled_code:
__int64 __fastcall func0(int a1, __int64 a2, int a3)
{
int v4; // ebp
__int64 v5; // rsi
int v6; // edx
int v7; // ebx
int v8; // eax

v4 = a3 - 1;
if ( a3 - 1 > 0 )
{
LODWORD(v5) = 0;
v6 = 0;
while ( 1 )
{
v5 = (unsigned int)(v5 + 1);
v7 = (v4 + v6) / 2;
v8 = *(_DWORD *)(a2 + 4LL * v7);
if ( a1 > v8 )
{
v6 = v7 + 1;
}
else
{
if ( a1 == v8 )
{
printf("done the while %d times\n", v5);
return (unsigned int)v7;
}
v4 = v7 - 1;
}
if ( v6 >= v4 )
goto LABEL_10;
}
}
v5 = 0LL;
LABEL_10:
if ( *(_DWORD *)(a2 + 4LL * v4) == a1 )
{
printf("done the while %d times\n", v5);
}
else
{
printf("done the while %d times\n", v5);
v4 = -1;
}
return (unsigned int)v4;
}

original_code:
int bsget(int value, int* array , int count){
 int curid;
 int endid = count - 1;
 int startid = 0;
 int curval;
 int i=0;
 while(endid > startid){
  i++;
  curid= (startid + endid)/2;
  curval = array[curid];
  if (curval >= value){
   if (curval == value){
    printf("done the while %d times\n",i);
    return curid;
   }
   endid = --curid;
  }
  else{
   startid = ++curid;
  }
 }
 if (array[endid] == value){
  printf("done the while %d times\n",i);
  return endid;
 }
 printf("done the while %d times\n",i);
 return -1;
}

canonical_original_code:
int bsget(int value, int *array, int count){
 int curid;
 int endid = count - 1;
 int startid = 0;
 int curval;
 int i = 0;
 while(endid > startid){
  i++;
  curid= (startid + endid)/2;
  curval = array[curid];
  if (curval >= value){
   if (curval == value){
    printf("done the while %d times\n",i);
    return curid;
   }
   endid = --curid;
  }
  else{
   startid = ++curid;
  }
 }
 if (array[endid] == value){
  printf("done the while %d times\n",i);
  return endid;
 }
 printf("done the while %d times\n",i);
 return -1;
}

variable_types: value int

variable_types:
array
int *

variable_types: count int

variable_types: curid int

variable_types: endid int

variable_types: startid int

variable_types: curval int


decompiled_code:
__int64 bisearch1()
{
int *v0; // rdx
int i; // eax
unsigned int v2; // eax
unsigned int v3; // ebx
int v5[1002]; // [rsp+0h] [rbp-FA8h] BYREF

v0 = v5;
for ( i = 4; i != 2006; i += 2 )
*v0++ = i;
v2 = bsget(1604, (__int64)v5, 1000);
v3 = v2;
if ( v2 == -1 )
{
printf("%d is not in the array\n", 1604LL);
}
else
{
printf("sortid of %d is %d\n", 1604LL, v2);
printf("array[%d] is %d\n\n", v3, (unsigned int)v5[v3]);
}
puts("bisearch1 done");
return 0LL;
}

canonical_decompiled_code:
__int64 func1()
{
int *v0; // rdx
int i; // eax
unsigned int v2; // eax
unsigned int v3; // ebx
int v5[1002]; // [rsp+0h] [rbp-FA8h] BYREF

v0 = v5;
for ( i = 4; i != 2006; i += 2 )
*v0++ = i;
v2 = func0(1604, (__int64)v5, 1000);
v3 = v2;
if ( v2 == -1 )
{
printf("%d is not in the array\n", 1604LL);
}
else
{
printf("sortid of %d is %d\n", 1604LL, v2);
printf("array[%d] is %d\n\n", v3, (unsigned int)v5[v3]);
}
puts("bisearch1 done");
return 0LL;
}

original_code:
int bisearch1(){
 int a[1000];
 int sortid;
 int v;
 int i;
 int count = sizeof(a)/sizeof(*a);
 for (i=0;i<=count;i++){
  *(a+i)=2*i+4;
 }
 v=1604;
 sortid=bsget(v,a,count);
 if (sortid !=-1){
  printf("sortid of %d is %d\n",v,sortid);
  printf("array[%d] is %d\n\n",sortid, a[sortid]);
 }
 else{
  printf("%d is not in the array\n",v);
 }
 printf("bisearch1 done\n");
 return 0;
}

variable_types: sortid int

variable_types: v int

variable_types: i int


decompiled_code:
__int64 bit32_64()
{
char v1[14]; // [rsp+Ah] [rbp-Eh] BYREF

strcpy(v1, "abcde");
printf("addr of a is %p\n", v1);
printf("addr of b is %p\n", &v1[1]);
printf("addr of c is %p\n", &v1[2]);
printf("addr of d is %p\n", &v1[3]);
puts(" \nbit done");
return 0LL;
}

canonical_decompiled_code:
__int64 func0()
{
char v1[14]; // [rsp+Ah] [rbp-Eh] BYREF

strcpy(v1, "abcde");
printf("addr of a is %p\n", v1);
printf("addr of b is %p\n", &v1[1]);
printf("addr of c is %p\n", &v1[2]);
printf("addr of d is %p\n", &v1[3]);
puts(" \nbit done");
return 0LL;
}

original_code:
int bit32_64(){
char a[]="abcde";
char *p;
p=a;
printf("addr of a is %p\n",p);
printf("addr of b is %p\n",p+1);
printf("addr of c is %p\n",p+2);
printf("addr of d is %p\n",p+3);
printf(" \nbit done\n");
return 0;
}

canonical_original_code:
int bit32_64(){
char a[] = "abcde";
char *p;
p=a;
printf("addr of a is %p\n",p);
printf("addr of b is %p\n",p+1);
printf("addr of c is %p\n",p+2);
printf("addr of d is %p\n",p+3);
printf(" \nbit done\n");
return 0;
}

variable_types:
a
char []

variable_types:
p
char *


showsize

decompiled_code:
__int64 showsize()
{
printf("sizeof(int) is %ld\n", 4LL);
printf("sizeof(long int) is %ld\n", 8LL);
printf("sizeof(char) is %ld\n", 1LL);
printf("sizeof(unsigned int) is %ld\n", 4LL);
return 0LL;
}

canonical_decompiled_code:
__int64 func1()
{
printf("sizeof(int) is %ld\n", 4LL);
printf("sizeof(long int) is %ld\n", 8LL);
printf("sizeof(char) is %ld\n", 1LL);
printf("sizeof(unsigned int) is %ld\n", 4LL);
return 0LL;
}

original_code:
int showsize(){
int i;
i=68888;
printf("sizeof(int) is %ld\n",sizeof(int));
printf("sizeof(long int) is %ld\n",sizeof(long int));
printf("sizeof(char) is %ld\n",sizeof(char));
printf("sizeof(unsigned int) is %ld\n",sizeof(unsigned int));
return 0;
}

canonical_original_code:
int showsize(){
int i;
i=68888;
printf("sizeof(int) is %ld\n",sizeof(int));
printf("sizeof(long int) is %ld\n",sizeof(long));
printf("sizeof(char) is %ld\n",sizeof(char));
printf("sizeof(unsigned int) is %ld\n",sizeof(unsigned int));
return 0;
}


decompiled_code:
__int64 input_array_int()
{
printf("abc");
return 0LL;
}

canonical_decompiled_code:
__int64 func0()
{
printf("abc");
return 0LL;
}

original_code:
int input_array_int(){
 printf("abc");
 return 0;
}


decompiled_code:
__int64 __fastcall p_array_int_1(__int64 a1, int a2)
{
__int64 i; // rbx

if ( a2 <= 0 )
return 0LL;
for ( i = 0LL; i != a2; ++i )
{
if ( a2 - 1 <= (int)i )
printf("%d\n", *(unsigned int *)(a1 + 4 * i));
else
printf("%d, ", *(unsigned int *)(a1 + 4 * i));
}
return 0LL;
}

canonical_decompiled_code:
__int64 __fastcall func1(__int64 a1, int a2)
{
__int64 i; // rbx

if ( a2 <= 0 )
return 0LL;
for ( i = 0LL; i != a2; ++i )
{
if ( a2 - 1 <= (int)i )
printf("%d\n", *(unsigned int *)(a1 + 4 * i));
else
printf("%d, ", *(unsigned int *)(a1 + 4 * i));
}
return 0LL;
}

original_code:
int p_array_int_1(int * p, int len){
 int i;
 for (i=0; i<len; i++){
  if (i < (len -1)) {
   printf("%d, ",*p);
  }
  else{
   printf("%d\n",*p);
  }
  p++;
 }
 return 0;
}

canonical_original_code:
int p_array_int_1(int *p, int len){
 int i;
 for (i=0; i<len; i++){
  if (i < (len -1)) {
   printf("%d, ",*p);
  }
  else{
   printf("%d\n",*p);
  }
  p++;
 }
 return 0;
}

variable_types:
p
int *


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

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

original_code:
int p_array_int(int * p, int len){
 return 0;
}

canonical_original_code:
int p_array_int(int *p, int len){
 return 0;
}


decompiled_code:
int File2Print()
{
return puts("Print file2**********");
}

canonical_decompiled_code:
int func0()
{
return puts("Print file2**********");
}

original_code:
void File2Print(){
 printf("Print file2**********\n");
}


decompiled_code:
void *Create_list()
{
return malloc(0x6CuLL);
}

canonical_decompiled_code:
void *func0()
{
return malloc(0x6CuLL);
}

original_code:
struct Student * Create_list(){
 struct Student * pst;
 pst = (struct Student *)malloc(sizeof(struct Student)*1);
 return pst;
}

canonical_original_code:
struct Student *Create_list(){
 struct Student *pst;
 pst = (struct Student *)malloc(sizeof(struct Student)*1);
 return pst;
}

variable_types: struct Student { int sid; int age; char name[100]; } *


decompiled_code:
int __fastcall Show_list(const char *a1)
{
return printf("sid is %d, name is %s, age is %d\n", *(unsigned int *)a1, a1 + 8, *((unsigned int *)a1 + 1));
}

canonical_decompiled_code:
int __fastcall func1(const char *a1)
{
return printf("sid is %d, name is %s, age is %d\n", *(unsigned int *)a1, a1 + 8, *((unsigned int *)a1 + 1));
}

original_code:
void Show_list(struct Student * pst){
 printf("sid is %d, name is %s, age is %d\n",pst->sid, pst->name, pst->age);
}

canonical_original_code:
void Show_list(struct Student *pst){
 printf("sid is %d, name is %s, age is %d\n",pst->sid, pst->name, pst->age);
}

user_defined_types: struct Student { int sid; int age; char name[100]; }


decompiled_code:
int memory_1()
{
void *v0; // rax

v0 = Create_list();
*(_DWORD *)v0 = 11;
*((_DWORD *)v0 + 1) = 24;
strcpy((char *)v0 + 8, "JasonPoon");
return Show_list((const char *)v0);
}

canonical_decompiled_code:
int func2()
{
void *v0; // rax

v0 = func0();
*(_DWORD *)v0 = 11;
*((_DWORD *)v0 + 1) = 24;
strcpy((char *)v0 + 8, "JasonPoon");
return func1((const char *)v0);
}

original_code:
void memory_1(){
 struct Student * p = Create_list();
 p->sid = 11;
 p->age = 24;
 strcpy(p->name,"JasonPoon");
 Show_list(p);
}

canonical_original_code:
void memory_1(){
 struct Student *p = Create_list();
 p->sid = 11;
 p->age = 24;
 strcpy(p->name,"JasonPoon");
 Show_list(p);
}


decompiled_code:
__int64 memory_main()
{
memory_1();
puts("memory main done");
return 0LL;
}

canonical_decompiled_code:
__int64 func3()
{
func2();
puts("memory main done");
return 0LL;
}

original_code:
int memory_main(){
 memory_1();
 printf("memory main done\n");
 return 0;
}


sort

decompiled_code:
__int64 sort()
{
puts("it's sort");
return 0LL;
}

canonical_decompiled_code:
__int64 func0()
{
puts("it's sort");
return 0LL;
}

original_code:
int sort(){
 printf("it's sort\n");
 return 0;
}


audiocb

repo: nwf/hyperbola-chiptunes

decompiled_code:
void __fastcall audiocb(__int64 a1, _BYTE *a2, int a3)
{
_BYTE *v3; // rbx
__int64 v4; // rbp

if ( a3 > 0 )
{
v3 = a2;
v4 = (__int64)&a2[a3 - 1 + 1];
do
*v3++ = interrupthandler();
while ( v3 != (_BYTE *)v4 );
}
}

canonical_decompiled_code:
void __fastcall func0(__int64 a1, _BYTE *a2, int a3)
{
_BYTE *v3; // rbx
__int64 v4; // rbp

if ( a3 > 0 )
{
v3 = a2;
v4 = (__int64)&a2[a3 - 1 + 1];
do
*v3++ = interrupthandler();
while ( v3 != (_BYTE *)v4 );
}
}

original_code:
void audiocb(void *userdata, Uint8 *buf, int len) {
    (void) userdata;
 int i;
 for(i = 0; i < len; i++) {
  buf[i] = interrupthandler();
 }
}

canonical_original_code:
void audiocb(void *userdata, unsigned char *buf, int len) {
    (void) userdata;
 int i;
 for(i = 0; i < len; i++) {
  buf[i] = interrupthandler();
 }
}

variable_types:
userdata
void *

variable_types:
buf
unsigned char *


silence

original_code:
void silence() {
 u8 i;
 for(i = 0; i < 4; i++) {
  osc[i].volume = 0;
 }
 playsong = 0;
 playtrack = 0;
}

canonical_original_code:
void silence() {
 unsigned char i;
 for(i = 0; i < 4; i++) {
  osc[i].volume = 0;
 }
 playsong = 0;
 playtrack = 0;
}

variable_types:
i
unsigned char


runcmd

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

if ( (_BYTE)a2 )
return (unsigned int)(a2 - 43);
result = 3LL * a1;
LOBYTE(channel[12 * a1 + 2]) = 0;
return result;
}

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

if ( (_BYTE)a2 )
return (unsigned int)(a2 - 43);
result = 3LL * a1;
LOBYTE(channel[12 * a1 + 2]) = 0;
return result;
}

original_code:
void runcmd(u8 ch, u8 cmd, u8 param) {
 switch(cmd) {
  case 0:
   channel[ch].inum = 0;
   break;
  case 'd':
   osc[ch].duty = param << 8;
   break;
  case 'f':
   channel[ch].volumed = param;
   break;
  case 'i':
   channel[ch].inertia = param << 1;
   break;
  case 'j':
   channel[ch].iptr = param;
   break;
  case 'l':
   channel[ch].bendd = param;
   break;
  case 'm':
   channel[ch].dutyd = param << 6;
   break;
  case 't':
   channel[ch].iwait = param;
   break;
  case 'v':
   osc[ch].volume = param;
   break;
  case 'w':
   osc[ch].waveform = param;
   break;
  case '+':
   channel[ch].inote = param + channel[ch].tnote - 12 * 4;
   break;
  case '=':
   channel[ch].inote = param;
   break;
  case '~':
   if(channel[ch].vdepth != (param >> 4)) {
    channel[ch].vpos = 0;
   }
   channel[ch].vdepth = param >> 4;
   channel[ch].vrate = param & 15;
   break;
  case 'S':
   osc[ch].phase += param;
   break;
 }
}

canonical_original_code:
void runcmd(unsigned char ch, unsigned char cmd, unsigned char param) {
 switch(cmd) {
  case 0:
   channel[ch].inum = 0;
   break;
  case 'd':
   osc[ch].duty = param << 8;
   break;
  case 'f':
   channel[ch].volumed = param;
   break;
  case 'i':
   channel[ch].inertia = param << 1;
   break;
  case 'j':
   channel[ch].iptr = param;
   break;
  case 'l':
   channel[ch].bendd = param;
   break;
  case 'm':
   channel[ch].dutyd = param << 6;
   break;
  case 't':
   channel[ch].iwait = param;
   break;
  case 'v':
   osc[ch].volume = param;
   break;
  case 'w':
   osc[ch].waveform = param;
   break;
  case '+':
   channel[ch].inote = param + channel[ch].tnote - 12 * 4;
   break;
  case '=':
   channel[ch].inote = param;
   break;
  case '~':
   if(channel[ch].vdepth != (param >> 4)) {
    channel[ch].vpos = 0;
   }
   channel[ch].vdepth = param >> 4;
   channel[ch].vrate = param & 15;
   break;
  case 'S':
   osc[ch].phase += param;
   break;
 }
}

variable_types:
ch
unsigned char

variable_types:
cmd
unsigned char

variable_types:
param
unsigned char


iedplonk

decompiled_code:
void __fastcall iedplonk(char a1, char a2)
{
LOBYTE(channel[1]) = a1;
LOBYTE(channel[2]) = a2;
HIBYTE(channel[2]) = 0;
LOBYTE(channel[3]) = 0;
channel[5] = 0;
LOBYTE(channel[4]) = 0;
LOBYTE(channel[6]) = 0;
channel[7] = 0;
LOBYTE(channel[8]) = 0;
}

canonical_decompiled_code:
void __fastcall func2(char a1, char a2)
{
LOBYTE(channel[1]) = a1;
LOBYTE(channel[2]) = a2;
HIBYTE(channel[2]) = 0;
LOBYTE(channel[3]) = 0;
channel[5] = 0;
LOBYTE(channel[4]) = 0;
LOBYTE(channel[6]) = 0;
channel[7] = 0;
LOBYTE(channel[8]) = 0;
}

original_code:
void iedplonk(int note, int instr) {
 channel[0].tnote = note;
 channel[0].inum = instr;
 channel[0].iptr = 0;
 channel[0].iwait = 0;
 channel[0].bend = 0;
 channel[0].bendd = 0;
 channel[0].volumed = 0;
 channel[0].dutyd = 0;
 channel[0].vdepth = 0;
}

variable_types: note int

variable_types: instr int


startplaytrack

decompiled_code:
void __fastcall startplaytrack(char a1)
{
LOBYTE(channel[0]) = a1;
LOBYTE(channel[12]) = 0;
LOBYTE(channel[24]) = 0;
LOBYTE(channel[36]) = 0;
trackpos = 0;
trackwait = 0;
playtrack = 1;
playsong = 0;
}

canonical_decompiled_code:
void __fastcall func3(char a1)
{
LOBYTE(channel[0]) = a1;
LOBYTE(channel[12]) = 0;
LOBYTE(channel[24]) = 0;
LOBYTE(channel[36]) = 0;
trackpos = 0;
trackwait = 0;
playtrack = 1;
playsong = 0;
}

original_code:
void startplaytrack(int t) {
 channel[0].tnum = t;
 channel[1].tnum = 0;
 channel[2].tnum = 0;
 channel[3].tnum = 0;
 trackpos = 0;
 trackwait = 0;
 playtrack = 1;
 playsong = 0;
}

variable_types: t int


startplaysong

decompiled_code:
void __fastcall startplaysong(char a1)
{
songpos = a1;
trackpos = 0;
trackwait = 0;
playtrack = 0;
playsong = 1;
}

canonical_decompiled_code:
void __fastcall func4(char a1)
{
songpos = a1;
trackpos = 0;
trackwait = 0;
playtrack = 0;
playsong = 1;
}

original_code:
void startplaysong(int p) {
 songpos = p;
 trackpos = 0;
 trackwait = 0;
 playtrack = 0;
 playsong = 1;
}

variable_types: p int