client

decompiled_code:
__int64 __fastcall client(int a1, __int64 a2)
{
int v2; // er12
__int64 v3; // rbx
_QWORD *v4; // r15
_QWORD *v5; // rbp
char *v6; // rbx
_QWORD *v7; // r13
int v8; // er14
unsigned int v9; // er12
__int64 v10; // rbx
unsigned int seconds; // [rsp+Ch] [rbp-4Ch] BYREF
int v13; // [rsp+10h] [rbp-48h] BYREF
unsigned int v14; // [rsp+14h] [rbp-44h] BYREF
char buf[5]; // [rsp+18h] [rbp-40h] BYREF
unsigned __int8 v16; // [rsp+1Dh] [rbp-3Bh] BYREF
unsigned __int16 v17; // [rsp+1Eh] [rbp-3Ah] BYREF

if ( a1 > 8 )
{
puts("Too many arguments");
usage();
v9 = -1;
}
else if ( a1 <= 7 )
{
puts("Not enough arguments");
usage();
v9 = -1;
}
else if ( inet_pton(2, *(const char **)(a2 + 16), buf) == 1 )
{
if ( (unsigned int)_isoc99_sscanf(*(_QWORD *)(a2 + 24), "%hu", &v17) == 1 )
{
if ( (unsigned int)_isoc99_sscanf(*(_QWORD *)(a2 + 32), "%hhu", &v16) == 1 )
{
if ( (unsigned int)_isoc99_sscanf(*(_QWORD *)(a2 + 40), "%u", &v14) == 1 )
{
if ( (unsigned int)_isoc99_sscanf(*(_QWORD *)(a2 + 48), "%u", &v13) == 1 )
{
if ( (unsigned int)_isoc99_sscanf(*(_QWORD *)(a2 + 56), "%u", &seconds) == 1 )
{
v2 = v13;
v3 = (unsigned int)v13;
v4 = malloc(8LL * (unsigned int)v13);
v5 = malloc(32 * v3);
v6 = (char *)malloc(16 * v3);
if ( v5 == 0LL || v4 == 0LL || !v6 )
{
puts("No memory");
v9 = -1;
}
else
{
v7 = v4;
v8 = 0;
if ( v2 <= 0 )
{
v9 = 0;
}
else
{
do
{
*(_QWORD *)v6 = v14;
v6[8] = 1;
v5[3] = v6;
v9 = run_client_thread(v17, buf, v16, &xen_shm_handler_sender, v5, v7);
if ( v9 )
{
perror("run client thread");
return v9;
}
sleep(seconds);
++v8;
v6 += 16;
v5 += 4;
++v7;
}
while ( v13 > v8 );
if ( v13 > 0 )
{
v10 = 0LL;
do
pthread_join(v4[v10++], 0LL);
while ( v13 > (int)v10 );
}
}
}
}
else
{
puts("Bad sleep interval");
usage();
v9 = -1;
}
}
else
{
puts("Bad client count");
usage();
v9 = -1;
}
}
else
{
puts("Bad buffer size");
usage();
v9 = -1;
}
}
else
{
puts("Bad page count");
usage();
v9 = -1;
}
}
else
{
puts("Bad port");
usage();
v9 = -1;
}
}
else
{
puts("Bad address");
usage();
v9 = -1;
}
return v9;
}

canonical_decompiled_code:
__int64 __fastcall func2(int a1, __int64 a2)
{
int v2; // er12
__int64 v3; // rbx
_QWORD *v4; // r15
_QWORD *v5; // rbp
char *v6; // rbx
_QWORD *v7; // r13
int v8; // er14
unsigned int v9; // er12
__int64 v10; // rbx
unsigned int seconds; // [rsp+Ch] [rbp-4Ch] BYREF
int v13; // [rsp+10h] [rbp-48h] BYREF
unsigned int v14; // [rsp+14h] [rbp-44h] BYREF
char buf[5]; // [rsp+18h] [rbp-40h] BYREF
unsigned __int8 v16; // [rsp+1Dh] [rbp-3Bh] BYREF
unsigned __int16 v17; // [rsp+1Eh] [rbp-3Ah] BYREF

if ( a1 > 8 )
{
puts("Too many arguments");
func0();
v9 = -1;
}
else if ( a1 <= 7 )
{
puts("Not enough arguments");
func0();
v9 = -1;
}
else if ( inet_pton(2, *(const char **)(a2 + 16), buf) == 1 )
{
if ( (unsigned int)_isoc99_sscanf(*(_QWORD *)(a2 + 24), "%hu", &v17) == 1 )
{
if ( (unsigned int)_isoc99_sscanf(*(_QWORD *)(a2 + 32), "%hhu", &v16) == 1 )
{
if ( (unsigned int)_isoc99_sscanf(*(_QWORD *)(a2 + 40), "%u", &v14) == 1 )
{
if ( (unsigned int)_isoc99_sscanf(*(_QWORD *)(a2 + 48), "%u", &v13) == 1 )
{
if ( (unsigned int)_isoc99_sscanf(*(_QWORD *)(a2 + 56), "%u", &seconds) == 1 )
{
v2 = v13;
v3 = (unsigned int)v13;
v4 = malloc(8LL * (unsigned int)v13);
v5 = malloc(32 * v3);
v6 = (char *)malloc(16 * v3);
if ( v5 == 0LL || v4 == 0LL || !v6 )
{
puts("No memory");
v9 = -1;
}
else
{
v7 = v4;
v8 = 0;
if ( v2 <= 0 )
{
v9 = 0;
}
else
{
do
{
*(_QWORD *)v6 = v14;
v6[8] = 1;
v5[3] = v6;
v9 = run_client_thread(v17, buf, v16, &xen_shm_handler_sender, v5, v7);
if ( v9 )
{
perror("run client thread");
return v9;
}
sleep(seconds);
++v8;
v6 += 16;
v5 += 4;
++v7;
}
while ( v13 > v8 );
if ( v13 > 0 )
{
v10 = 0LL;
do
pthread_join(v4[v10++], 0LL);
while ( v13 > (int)v10 );
}
}
}
}
else
{
puts("Bad sleep interval");
func0();
v9 = -1;
}
}
else
{
puts("Bad client count");
func0();
v9 = -1;
}
}
else
{
puts("Bad buffer size");
func0();
v9 = -1;
}
}
else
{
puts("Bad page count");
func0();
v9 = -1;
}
}
else
{
puts("Bad port");
func0();
v9 = -1;
}
}
else
{
puts("Bad address");
func0();
v9 = -1;
}
return v9;
}

original_code:
int client(int argc, char **argv) {
    int retval;
    int i;
    in_port_t port;
    uint8_t page_count;
    struct in_addr addr;
    uint32_t buffer_size;
    uint32_t client_count;
    uint32_t sleep_interval;
    pthread_t* thread_infos;
    struct xen_shm_handler_data* datas;
    struct xen_shm_handler_transfert* trs;
    if (argc > 8) {
        printf("Too many arguments\n");
        usage();
        return -1;
    }
    if (argc < 8) {
        printf("Not enough arguments\n");
        usage();
        return -1;
    }
    retval = inet_pton(2, argv[2], &addr);
    if (retval != 1) {
        printf("Bad address\n");
        usage();
        return -1;
    }
    if (sscanf(argv[3], "%""hu", &port) != 1) {
        printf("Bad port\n");
        usage();
        return -1;
    }
    if (sscanf(argv[4], "%""hhu", &page_count) != 1) {
        printf("Bad page count\n");
        usage();
        return -1;
    }
    if (sscanf(argv[5], "%""u", &buffer_size) != 1) {
        printf("Bad buffer size\n");
        usage();
        return -1;
    }
    if (sscanf(argv[6], "%""u", &client_count) != 1) {
        printf("Bad client count\n");
        usage();
        return -1;
    }
    if (sscanf(argv[7], "%""u", &sleep_interval) != 1) {
        printf("Bad sleep interval\n");
        usage();
        return -1;
    }
    thread_infos = malloc(sizeof(pthread_t)*client_count);
    datas = malloc(sizeof(struct xen_shm_handler_data)*client_count);
    trs = malloc(sizeof(struct xen_shm_handler_transfert)*client_count);
    if(thread_infos==((void *)0) || datas==((void *)0) || trs==((void *)0)) {
        printf("No memory\n");
        return -1;
    }
    for (i=0; i<(int) client_count; i++) {
        trs[i].buffer_len = (size_t) buffer_size;
        trs[i].print_info = 1;
        datas[i].private_data = &(trs[i]);
        retval = run_client_thread(port, &addr, page_count, xen_shm_handler_sender, &(datas[i]), &(thread_infos[i]));
        if(retval != 0) {
            perror("run client thread");
            return retval;
        }
        sleep(sleep_interval);
    }
    for (i=0; i<(int)client_count; i++) {
        pthread_join(thread_infos[i], ((void *)0));
    }
    return 0;
}

canonical_original_code:
int client(int argc, char **argv) {
    int retval;
    int i;
    unsigned short port;
    unsigned char page_count;
    struct in_addr addr;
    unsigned int buffer_size;
    unsigned int client_count;
    unsigned int sleep_interval;
    unsigned long *thread_infos;
    struct xen_shm_handler_data *datas;
    struct xen_shm_handler_transfert *trs;
    if (argc > 8) {
        printf("Too many arguments\n");
        usage();
        return -1;
    }
    if (argc < 8) {
        printf("Not enough arguments\n");
        usage();
        return -1;
    }
    retval = inet_pton(2, argv[2], &addr);
    if (retval != 1) {
        printf("Bad address\n");
        usage();
        return -1;
    }
    if (sscanf(argv[3], "%""hu", &port) != 1) {
        printf("Bad port\n");
        usage();
        return -1;
    }
    if (sscanf(argv[4], "%""hhu", &page_count) != 1) {
        printf("Bad page count\n");
        usage();
        return -1;
    }
    if (sscanf(argv[5], "%""u", &buffer_size) != 1) {
        printf("Bad buffer size\n");
        usage();
        return -1;
    }
    if (sscanf(argv[6], "%""u", &client_count) != 1) {
        printf("Bad client count\n");
        usage();
        return -1;
    }
    if (sscanf(argv[7], "%""u", &sleep_interval) != 1) {
        printf("Bad sleep interval\n");
        usage();
        return -1;
    }
    thread_infos = malloc(sizeof(pthread_t)*client_count);
    datas = malloc(sizeof(struct xen_shm_handler_data)*client_count);
    trs = malloc(sizeof(struct xen_shm_handler_transfert)*client_count);
    if(thread_infos==((void *)0) || datas==((void *)0) || trs==((void *)0)) {
        printf("No memory\n");
        return -1;
    }
    for (i=0; i<(int) client_count; i++) {
        trs[i].buffer_len = (unsigned long) buffer_size;
        trs[i].print_info = 1;
        datas[i].private_data = &(trs[i]);
        retval = run_client_thread(port, &addr, page_count, xen_shm_handler_sender, &(datas[i]), &(thread_infos[i]));
        if(retval != 0) {
            perror("run client thread");
            return retval;
        }
        sleep(sleep_interval);
    }
    for (i=0; i<(int)client_count; i++) {
        pthread_join(thread_infos[i], ((void *)0));
    }
    return 0;
}

variable_types: retval int

variable_types: i int

variable_types:
addr
struct in_addr { unsigned int s_addr; }

variable_types: struct xen_shm_handler_data { void *receive_fd; void *send_fd; int stop; void *private_data; } *

variable_types: struct xen_shm_handler_transfert { unsigned long buffer_len; unsigned char print_info; } *


usage

decompiled_code:
int usage()
{
puts("server <port> <pages_count> <buffer_size> ");
return puts("client <addr> <port> <pages_count> <buffer_size> <client_count> <sec_between_clients_start>");
}

canonical_decompiled_code:
int func0()
{
puts("server <port> <pages_count> <buffer_size> ");
return puts("client <addr> <port> <pages_count> <buffer_size> <client_count> <sec_between_clients_start>");
}

original_code:
void usage(void) {
    printf("server <port> <pages_count> <buffer_size> \n");
    printf("client <addr> <port> <pages_count> <buffer_size> <client_count> <sec_between_clients_start>\n");
}

canonical_original_code:
void usage() {
    printf("server <port> <pages_count> <buffer_size> \n");
    printf("client <addr> <port> <pages_count> <buffer_size> <client_count> <sec_between_clients_start>\n");
}

return_type: void


main

canonical_name: main

decompiled_code:
int __cdecl main(int argc, const char **argv, const char **envp)
{
if ( argc <= 1 )
usage();
if ( !strcmp(argv[1], "server") )
return server(argc, argv);
if ( !strcmp(argv[1], "client") )
return client(argc, (__int64)argv);
usage();
return -1;
}

canonical_decompiled_code:
int __cdecl main(int argc, const char **argv, const char **envp)
{
if ( argc <= 1 )
func0();
if ( !strcmp(argv[1], "server") )
return func1(argc, argv);
if ( !strcmp(argv[1], "client") )
return func2(argc, (__int64)argv);
func0();
return -1;
}

original_code:
int main(int argc, char **argv) {
    if(argc < 2) {
        usage();
    }
    if(strcmp(argv[1], "server") == 0) {
        return server(argc, argv);
    } else if(strcmp(argv[1], "client")==0) {
        return client(argc, argv);
    }
    usage();
    return -1;
}

variable_types: argc int

variable_types:
argv
char **

return_type: int


decompiled_code:
__int64 xen_shm_handler_get_id()
{
return (unsigned int)unique_handler_id++;
}

canonical_decompiled_code:
__int64 func0()
{
return (unsigned int)unique_handler_id++;
}

original_code:
uint32_t
xen_shm_handler_get_id(void) {
    return unique_handler_id++;
}

canonical_original_code:
unsigned int xen_shm_handler_get_id() {
    return unique_handler_id++;
}

return_type: unsigned int


decompiled_code:
__int64 __fastcall xen_shm_handler_ping_client(_QWORD *a1)
{
int v1; // ebp
char v3[10]; // [rsp+6h] [rbp-42h] BYREF
struct timespec tp; // [rsp+10h] [rbp-38h] BYREF
struct timespec v5; // [rsp+20h] [rbp-28h] BYREF

if ( !*((_DWORD *)a1 + 4) )
{
while ( 2 )
{
clock_gettime(0, &tp);
v1 = 500;
do
{
if ( xen_shm_pipe_write_all(a1[1], v3, 10LL) < 0 )
{
puts("Unable to send");
perror("xen_shm_pipe_write_all");
return 0LL;
}
xen_shm_pipe_flush(*a1);
if ( xen_shm_pipe_read_all(*a1, v3, 10LL) < 0 )
{
puts("Unable to receive");
perror("xen_shm_pipe_read_all");
return 0LL;
}
xen_shm_pipe_flush(*a1);
--v1;
}
while ( v1 );
clock_gettime(0, &v5);
printf("Sent at %ld.%09ld\n", tp.tv_sec, tp.tv_nsec);
printf("Received at %ld.%09ld\n", v5.tv_sec, v5.tv_nsec);
if ( !*((_DWORD *)a1 + 4) )
continue;
break;
}
}
return 0LL;
}

canonical_decompiled_code:
__int64 __fastcall func1(_QWORD *a1)
{
int v1; // ebp
char v3[10]; // [rsp+6h] [rbp-42h] BYREF
struct timespec tp; // [rsp+10h] [rbp-38h] BYREF
struct timespec v5; // [rsp+20h] [rbp-28h] BYREF

if ( !*((_DWORD *)a1 + 4) )
{
while ( 2 )
{
clock_gettime(0, &tp);
v1 = 500;
do
{
if ( xen_shm_pipe_write_all(a1[1], v3, 10LL) < 0 )
{
puts("Unable to send");
perror("xen_shm_pipe_write_all");
return 0LL;
}
xen_shm_pipe_flush(*a1);
if ( xen_shm_pipe_read_all(*a1, v3, 10LL) < 0 )
{
puts("Unable to receive");
perror("xen_shm_pipe_read_all");
return 0LL;
}
xen_shm_pipe_flush(*a1);
--v1;
}
while ( v1 );
clock_gettime(0, &v5);
printf("Sent at %ld.%09ld\n", tp.tv_sec, tp.tv_nsec);
printf("Received at %ld.%09ld\n", v5.tv_sec, v5.tv_nsec);
if ( !*((_DWORD *)a1 + 4) )
continue;
break;
}
}
return 0LL;
}

original_code:
void* xen_shm_handler_ping_client (struct xen_shm_handler_data* data) {
    struct timespec in_stamp;
    struct timespec out_stamp;
    int i;
    ssize_t len;
    uint8_t noise[10];
    while(!data->stop) {
        clock_gettime(0, &out_stamp);
        for (i = 0; i < 500; ++i) {
            len = xen_shm_pipe_write_all(data->send_fd, noise, 10);
            if (len < 0) {
                printf("Unable to send\n");
                perror("xen_shm_pipe_write_all");
                return ((void *)0);
            }
            xen_shm_pipe_flush(data->receive_fd);
            len = xen_shm_pipe_read_all(data->receive_fd, noise, 10);
            if (len < 0) {
                printf("Unable to receive\n");
                perror("xen_shm_pipe_read_all");
                return ((void *)0);
            }
            xen_shm_pipe_flush(data->receive_fd);
        }
        clock_gettime(0, &in_stamp);
        printf("Sent at %ld.%09ld\n", out_stamp.tv_sec, out_stamp.tv_nsec);
        printf("Received at %ld.%09ld\n", in_stamp.tv_sec, in_stamp.tv_nsec);
    }
    return ((void *)0);
}

canonical_original_code:
void *xen_shm_handler_ping_client(struct xen_shm_handler_data *data) {
    struct timespec in_stamp;
    struct timespec out_stamp;
    int i;
    long len;
    unsigned char noise[10];
    while(!data->stop) {
        clock_gettime(0, &out_stamp);
        for (i = 0; i < 500; ++i) {
            len = xen_shm_pipe_write_all(data->send_fd, noise, 10);
            if (len < 0) {
                printf("Unable to send\n");
                perror("xen_shm_pipe_write_all");
                return ((void *)0);
            }
            xen_shm_pipe_flush(data->receive_fd);
            len = xen_shm_pipe_read_all(data->receive_fd, noise, 10);
            if (len < 0) {
                printf("Unable to receive\n");
                perror("xen_shm_pipe_read_all");
                return ((void *)0);
            }
            xen_shm_pipe_flush(data->receive_fd);
        }
        clock_gettime(0, &in_stamp);
        printf("Sent at %ld.%09ld\n", out_stamp.tv_sec, out_stamp.tv_nsec);
        printf("Received at %ld.%09ld\n", in_stamp.tv_sec, in_stamp.tv_nsec);
    }
    return ((void *)0);
}

variable_types: struct timespec { long tv_sec; long tv_nsec; }

variable_types: len long

variable_types:
noise
unsigned char [10]

return_type: void *

user_defined_types: struct xen_shm_handler_data { void *receive_fd; void *send_fd; int stop; void *private_data; }


decompiled_code:
__int64 __fastcall xen_shm_handler_ping_server(_QWORD *a1)
{
char v2[18]; // [rsp+6h] [rbp-12h] BYREF

if ( !*((_DWORD *)a1 + 4) )
{
while ( 1 )
{
if ( xen_shm_pipe_read_all(*a1, v2, 10LL) < 0 )
{
puts("Unable to receive");
perror("xen_shm_pipe_read_all");
return 0LL;
}
xen_shm_pipe_flush(*a1);
if ( xen_shm_pipe_write_all(a1[1], v2, 10LL) < 0 )
break;
xen_shm_pipe_flush(a1[1]);
if ( *((_DWORD *)a1 + 4) )
return 0LL;
}
puts("Unable to send");
perror("xen_shm_pipe_write_all");
}
return 0LL;
}

canonical_decompiled_code:
__int64 __fastcall func2(_QWORD *a1)
{
char v2[18]; // [rsp+6h] [rbp-12h] BYREF

if ( !*((_DWORD *)a1 + 4) )
{
while ( 1 )
{
if ( xen_shm_pipe_read_all(*a1, v2, 10LL) < 0 )
{
puts("Unable to receive");
perror("xen_shm_pipe_read_all");
return 0LL;
}
xen_shm_pipe_flush(*a1);
if ( xen_shm_pipe_write_all(a1[1], v2, 10LL) < 0 )
break;
xen_shm_pipe_flush(a1[1]);
if ( *((_DWORD *)a1 + 4) )
return 0LL;
}
puts("Unable to send");
perror("xen_shm_pipe_write_all");
}
return 0LL;
}

original_code:
void* xen_shm_handler_ping_server (struct xen_shm_handler_data* data) {
    uint8_t noise[10];
    ssize_t len;
    while (!data->stop) {
        len = xen_shm_pipe_read_all(data->receive_fd, &noise, 10);
        if (len < 0) {
            printf("Unable to receive\n");
            perror("xen_shm_pipe_read_all");
            return ((void *)0);
        }
        xen_shm_pipe_flush(data->receive_fd);
        len = xen_shm_pipe_write_all(data->send_fd, &noise, 10);
        if (len < 0) {
            printf("Unable to send\n");
            perror("xen_shm_pipe_write_all");
            return ((void *)0);
        }
        xen_shm_pipe_flush(data->send_fd);
    }
    return ((void *)0);
}

canonical_original_code:
void *xen_shm_handler_ping_server(struct xen_shm_handler_data *data) {
    unsigned char noise[10];
    long len;
    while (!data->stop) {
        len = xen_shm_pipe_read_all(data->receive_fd, &noise, 10);
        if (len < 0) {
            printf("Unable to receive\n");
            perror("xen_shm_pipe_read_all");
            return ((void *)0);
        }
        xen_shm_pipe_flush(data->receive_fd);
        len = xen_shm_pipe_write_all(data->send_fd, &noise, 10);
        if (len < 0) {
            printf("Unable to send\n");
            perror("xen_shm_pipe_write_all");
            return ((void *)0);
        }
        xen_shm_pipe_flush(data->send_fd);
    }
    return ((void *)0);
}


decompiled_code:
__int64 __fastcall xen_shm_handler_sender(__int64 a1)
{
size_t *v1; // rbx
void *v2; // r13
unsigned __int64 v3; // r14
double v4; // xmm0_8
double v5; // xmm1_8
__int64 v6; // rbp
unsigned __int64 v7; // rax
double v8; // xmm0_8
__suseconds_t v9; // rdx
double v10; // xmm0_8
double v11; // xmm1_8
unsigned __int64 v13; // [rsp+0h] [rbp-68h]
unsigned int v14; // [rsp+Ch] [rbp-5Ch]
struct timeval v15; // [rsp+10h] [rbp-58h] BYREF
struct timeval tv; // [rsp+20h] [rbp-48h] BYREF

v1 = *(size_t **)(a1 + 24);
v2 = malloc(*v1);
v14 = xen_shm_handler_get_id();
gettimeofday(&tv, 0LL);
v13 = tv.tv_sec;
v3 = 500000000LL;
LABEL_9:
v6 = 0LL;
while ( !*(_DWORD *)(a1 + 16) )
{
if ( xen_shm_pipe_write_all(*(_QWORD *)(a1 + 8), v2, *v1) < 0 )
{
printf("transfert %u error - ", v14);
perror("pipe write all");
return 0LL;
}
v7 = *v1 + v6;
v6 = v7;
if ( *((_BYTE *)v1 + 8) && v3 < v7 )
{
gettimeofday(&v15, 0LL);
if ( v6 < 0 )
v4 = (double)(int)(v6 & 1 | ((unsigned __int64)v6 >> 1)) + (double)(int)(v6 & 1 | ((unsigned __int64)v6 >> 1));
else
v4 = (double)(int)v6;
v8 = v4 * 8.0;
v9 = v15.tv_usec - tv.tv_usec + 1000000 * (v15.tv_sec - tv.tv_sec);
if ( v9 < 0 )
v5 = (double)(int)(v9 & 1 | ((unsigned __int64)v9 >> 1)) + (double)(int)(v9 & 1 | ((unsigned __int64)v9 >> 1));
else
v5 = (double)(int)v9;
v10 = v8 / v5;
v11 = v10 * 1000000.0 * 0.25;
if ( v11 >= 9.223372036854776e18 )
v3 = (unsigned int)(int)(v11 - 9.223372036854776e18) ^ 0x8000000000000000LL;
else
v3 = (unsigned int)(int)v11;
if ( v15.tv_sec > v13 )
{
printf("%u, %lu, %lu, s, %f, Mbps\n", v14, v6, v15.tv_usec / 0x3E8uLL + 1000 * v15.tv_sec, v10);
v13 = v15.tv_sec;
}
tv = (struct timeval)_mm_loadu_si128((const __m128i *)&v15);
goto LABEL_9;
}
}
free(v2);
return 0LL;
}

canonical_decompiled_code:
__int64 __fastcall func3(__int64 a1)
{
size_t *v1; // rbx
void *v2; // r13
unsigned __int64 v3; // r14
double v4; // xmm0_8
double v5; // xmm1_8
__int64 v6; // rbp
unsigned __int64 v7; // rax
double v8; // xmm0_8
__suseconds_t v9; // rdx
double v10; // xmm0_8
double v11; // xmm1_8
unsigned __int64 v13; // [rsp+0h] [rbp-68h]
unsigned int v14; // [rsp+Ch] [rbp-5Ch]
struct timeval v15; // [rsp+10h] [rbp-58h] BYREF
struct timeval tv; // [rsp+20h] [rbp-48h] BYREF

v1 = *(size_t **)(a1 + 24);
v2 = malloc(*v1);
v14 = func0();
gettimeofday(&tv, 0LL);
v13 = tv.tv_sec;
v3 = 500000000LL;
LABEL_9:
v6 = 0LL;
while ( !*(_DWORD *)(a1 + 16) )
{
if ( xen_shm_pipe_write_all(*(_QWORD *)(a1 + 8), v2, *v1) < 0 )
{
printf("transfert %u error - ", v14);
perror("pipe write all");
return 0LL;
}
v7 = *v1 + v6;
v6 = v7;
if ( *((_BYTE *)v1 + 8) && v3 < v7 )
{
gettimeofday(&v15, 0LL);
if ( v6 < 0 )
v4 = (double)(int)(v6 & 1 | ((unsigned __int64)v6 >> 1)) + (double)(int)(v6 & 1 | ((unsigned __int64)v6 >> 1));
else
v4 = (double)(int)v6;
v8 = v4 * 8.0;
v9 = v15.tv_usec - tv.tv_usec + 1000000 * (v15.tv_sec - tv.tv_sec);
if ( v9 < 0 )
v5 = (double)(int)(v9 & 1 | ((unsigned __int64)v9 >> 1)) + (double)(int)(v9 & 1 | ((unsigned __int64)v9 >> 1));
else
v5 = (double)(int)v9;
v10 = v8 / v5;
v11 = v10 * 1000000.0 * 0.25;
if ( v11 >= 9.223372036854776e18 )
v3 = (unsigned int)(int)(v11 - 9.223372036854776e18) ^ 0x8000000000000000LL;
else
v3 = (unsigned int)(int)v11;
if ( v15.tv_sec > v13 )
{
printf("%u, %lu, %lu, s, %f, Mbps\n", v14, v6, v15.tv_usec / 0x3E8uLL + 1000 * v15.tv_sec, v10);
v13 = v15.tv_sec;
}
tv = (struct timeval)_mm_loadu_si128((const __m128i *)&v15);
goto LABEL_9;
}
}
free(v2);
return 0LL;
}

original_code:
void* xen_shm_handler_sender(struct xen_shm_handler_data* data) {
    struct xen_shm_handler_transfert* trans_data;
    ssize_t ret;
    struct timeval in_stamp;
    struct timeval out_stamp;
    uint64_t byte_counter;
    uint64_t print_threashold;
    uint64_t last_print_s;
    uint32_t transfert_id;
    uint64_t delay;
    uint8_t* buffer;
    double bandwidth;
    trans_data = (struct xen_shm_handler_transfert*) data->private_data;
    buffer = malloc(sizeof(uint8_t)*trans_data->buffer_len);
    transfert_id = xen_shm_handler_get_id();
    byte_counter = 0;
    bandwidth = 2000;
    print_threashold = (uint64_t) (bandwidth * 1000000)/4;
    gettimeofday(&in_stamp , ((void *)0));
    last_print_s = (uint64_t) in_stamp.tv_sec;
    while(!data->stop) {
        ret = xen_shm_pipe_write_all(data->send_fd, buffer, trans_data->buffer_len);
        if(ret < 0) {
            printf("transfert %""u"" error - ", transfert_id);
            perror("pipe write all");
            return ((void *)0);
        }
        byte_counter+=trans_data->buffer_len;
        if(trans_data->print_info && byte_counter>print_threashold) {
            gettimeofday(&out_stamp , ((void *)0));
            delay = ((uint64_t) (out_stamp.tv_sec - in_stamp.tv_sec))*1000000 + (uint64_t) (out_stamp.tv_usec - in_stamp.tv_usec);
            bandwidth = (((double) byte_counter)*8)/((double) delay);
            print_threashold =(uint64_t) ((bandwidth * 1000000)/4);
            if((uint64_t) out_stamp.tv_sec > last_print_s) {
                printf("%""u"", %""l" "u"", %""l" "u"", s, %f, Mbps\n",transfert_id,byte_counter ,((uint64_t) out_stamp.tv_sec)*1000 + ((uint64_t) out_stamp.tv_usec)/1000, bandwidth);
                last_print_s = (uint64_t) out_stamp.tv_sec;
            }
            byte_counter = 0;
            in_stamp = out_stamp;
        }
    }
    free(buffer);
    return ((void *)0);
}

canonical_original_code:
void *xen_shm_handler_sender(struct xen_shm_handler_data *data) {
    struct xen_shm_handler_transfert *trans_data;
    long ret;
    struct timeval in_stamp;
    struct timeval out_stamp;
    unsigned long byte_counter;
    unsigned long print_threashold;
    unsigned long last_print_s;
    unsigned int transfert_id;
    unsigned long delay;
    unsigned char *buffer;
    double bandwidth;
    trans_data = (struct xen_shm_handler_transfert *) data->private_data;
    buffer = malloc(sizeof(unsigned char)*trans_data->buffer_len);
    transfert_id = xen_shm_handler_get_id();
    byte_counter = 0;
    bandwidth = 2000;
    print_threashold = (unsigned long) (bandwidth * 1000000)/4;
    gettimeofday(&in_stamp , ((void *)0));
    last_print_s = (unsigned long) in_stamp.tv_sec;
    while(!data->stop) {
        ret = xen_shm_pipe_write_all(data->send_fd, buffer, trans_data->buffer_len);
        if(ret < 0) {
            printf("transfert %""u"" error - ", transfert_id);
            perror("pipe write all");
            return ((void *)0);
        }
        byte_counter+=trans_data->buffer_len;
        if(trans_data->print_info && byte_counter>print_threashold) {
            gettimeofday(&out_stamp , ((void *)0));
            delay = ((unsigned long) (out_stamp.tv_sec - in_stamp.tv_sec))*1000000 + (unsigned long) (out_stamp.tv_usec - in_stamp.tv_usec);
            bandwidth = (((double) byte_counter)*8)/((double) delay);
            print_threashold =(unsigned long) ((bandwidth * 1000000)/4);
            if((unsigned long) out_stamp.tv_sec > last_print_s) {
                printf("%""u"", %""l" "u"", %""l" "u"", s, %f, Mbps\n",transfert_id,byte_counter ,((unsigned long) out_stamp.tv_sec)*1000 + ((unsigned long) out_stamp.tv_usec)/1000, bandwidth);
                last_print_s = (unsigned long) out_stamp.tv_sec;
            }
            byte_counter = 0;
            in_stamp = out_stamp;
        }
    }
    free(buffer);
    return ((void *)0);
}

variable_types: ret long

variable_types: struct timeval { long tv_sec; long tv_usec; }

variable_types:
delay
unsigned long

variable_types:
buffer
unsigned char *

variable_types: bandwidth double

user_defined_types: struct xen_shm_handler_transfert { unsigned long buffer_len; unsigned char print_info; }


decompiled_code:
__int64 __fastcall xen_shm_handler_receiver(__int64 a1)
{
size_t *v1; // rbx
void *v2; // r13
unsigned __int64 v3; // r14
double v4; // xmm0_8
double v5; // xmm1_8
__int64 v6; // rbp
unsigned __int64 v7; // rax
double v8; // xmm0_8
__suseconds_t v9; // rdx
double v10; // xmm0_8
double v11; // xmm1_8
unsigned __int64 v13; // [rsp+0h] [rbp-68h]
unsigned int v14; // [rsp+Ch] [rbp-5Ch]
struct timeval v15; // [rsp+10h] [rbp-58h] BYREF
struct timeval tv; // [rsp+20h] [rbp-48h] BYREF

v1 = *(size_t **)(a1 + 24);
v2 = malloc(*v1);
v14 = xen_shm_handler_get_id();
gettimeofday(&tv, 0LL);
v13 = tv.tv_sec;
v3 = 500000000LL;
LABEL_9:
v6 = 0LL;
while ( !*(_DWORD *)(a1 + 16) )
{
if ( xen_shm_pipe_read_all(*(_QWORD *)a1, v2, *v1) < 0 )
{
printf("transfert %u error - ", v14);
perror("pipe read all");
return 0LL;
}
v7 = *v1 + v6;
v6 = v7;
if ( *((_BYTE *)v1 + 8) && v3 < v7 )
{
gettimeofday(&v15, 0LL);
if ( v6 < 0 )
v4 = (double)(int)(v6 & 1 | ((unsigned __int64)v6 >> 1)) + (double)(int)(v6 & 1 | ((unsigned __int64)v6 >> 1));
else
v4 = (double)(int)v6;
v8 = v4 * 8.0;
v9 = v15.tv_usec - tv.tv_usec + 1000000 * (v15.tv_sec - tv.tv_sec);
if ( v9 < 0 )
v5 = (double)(int)(v9 & 1 | ((unsigned __int64)v9 >> 1)) + (double)(int)(v9 & 1 | ((unsigned __int64)v9 >> 1));
else
v5 = (double)(int)v9;
v10 = v8 / v5;
v11 = v10 * 1000000.0 * 0.25;
if ( v11 >= 9.223372036854776e18 )
v3 = (unsigned int)(int)(v11 - 9.223372036854776e18) ^ 0x8000000000000000LL;
else
v3 = (unsigned int)(int)v11;
if ( v15.tv_sec > v13 )
{
printf("%u, %lu, %lu, r, %f, Mbps\n", v14, v6, v15.tv_usec / 0x3E8uLL + 1000 * v15.tv_sec, v10);
v13 = v15.tv_sec;
}
tv = (struct timeval)_mm_loadu_si128((const __m128i *)&v15);
goto LABEL_9;
}
}
free(v2);
return 0LL;
}

canonical_decompiled_code:
__int64 __fastcall func4(__int64 a1)
{
size_t *v1; // rbx
void *v2; // r13
unsigned __int64 v3; // r14
double v4; // xmm0_8
double v5; // xmm1_8
__int64 v6; // rbp
unsigned __int64 v7; // rax
double v8; // xmm0_8
__suseconds_t v9; // rdx
double v10; // xmm0_8
double v11; // xmm1_8
unsigned __int64 v13; // [rsp+0h] [rbp-68h]
unsigned int v14; // [rsp+Ch] [rbp-5Ch]
struct timeval v15; // [rsp+10h] [rbp-58h] BYREF
struct timeval tv; // [rsp+20h] [rbp-48h] BYREF

v1 = *(size_t **)(a1 + 24);
v2 = malloc(*v1);
v14 = func0();
gettimeofday(&tv, 0LL);
v13 = tv.tv_sec;
v3 = 500000000LL;
LABEL_9:
v6 = 0LL;
while ( !*(_DWORD *)(a1 + 16) )
{
if ( xen_shm_pipe_read_all(*(_QWORD *)a1, v2, *v1) < 0 )
{
printf("transfert %u error - ", v14);
perror("pipe read all");
return 0LL;
}
v7 = *v1 + v6;
v6 = v7;
if ( *((_BYTE *)v1 + 8) && v3 < v7 )
{
gettimeofday(&v15, 0LL);
if ( v6 < 0 )
v4 = (double)(int)(v6 & 1 | ((unsigned __int64)v6 >> 1)) + (double)(int)(v6 & 1 | ((unsigned __int64)v6 >> 1));
else
v4 = (double)(int)v6;
v8 = v4 * 8.0;
v9 = v15.tv_usec - tv.tv_usec + 1000000 * (v15.tv_sec - tv.tv_sec);
if ( v9 < 0 )
v5 = (double)(int)(v9 & 1 | ((unsigned __int64)v9 >> 1)) + (double)(int)(v9 & 1 | ((unsigned __int64)v9 >> 1));
else
v5 = (double)(int)v9;
v10 = v8 / v5;
v11 = v10 * 1000000.0 * 0.25;
if ( v11 >= 9.223372036854776e18 )
v3 = (unsigned int)(int)(v11 - 9.223372036854776e18) ^ 0x8000000000000000LL;
else
v3 = (unsigned int)(int)v11;
if ( v15.tv_sec > v13 )
{
printf("%u, %lu, %lu, r, %f, Mbps\n", v14, v6, v15.tv_usec / 0x3E8uLL + 1000 * v15.tv_sec, v10);
v13 = v15.tv_sec;
}
tv = (struct timeval)_mm_loadu_si128((const __m128i *)&v15);
goto LABEL_9;
}
}
free(v2);
return 0LL;
}

original_code:
void* xen_shm_handler_receiver(struct xen_shm_handler_data* data) {
    struct xen_shm_handler_transfert* trans_data;
    ssize_t ret;
    struct timeval in_stamp;
    struct timeval out_stamp;
    uint64_t byte_counter;
    uint64_t print_threashold;
    uint64_t last_print_s;
    uint32_t transfert_id;
    uint64_t delay;
    uint8_t* buffer;
    double bandwidth;
    trans_data = (struct xen_shm_handler_transfert*) data->private_data;
    buffer = malloc(sizeof(uint8_t)*trans_data->buffer_len);
    transfert_id = xen_shm_handler_get_id();
    byte_counter = 0;
    bandwidth = 2000;
    print_threashold = (uint64_t) (bandwidth * 1000000)/4;
    gettimeofday(&in_stamp , ((void *)0));
    last_print_s = (uint64_t) in_stamp.tv_sec;
    while(!data->stop) {
        ret = xen_shm_pipe_read_all(data->receive_fd, buffer, trans_data->buffer_len);
        if(ret < 0) {
            printf("transfert %""u"" error - ", transfert_id);
            perror("pipe read all");
            return ((void *)0);
        }
        byte_counter+=trans_data->buffer_len;
        if(trans_data->print_info && byte_counter>print_threashold) {
            gettimeofday(&out_stamp , ((void *)0));
            delay = ((uint64_t) (out_stamp.tv_sec - in_stamp.tv_sec))*1000000 + (uint64_t) (out_stamp.tv_usec - in_stamp.tv_usec);
            bandwidth = (((double) byte_counter)*8)/((double) delay);
            print_threashold =(uint64_t) ((bandwidth * 1000000)/4);
            if((uint64_t) out_stamp.tv_sec > last_print_s) {
                printf("%""u"", %""l" "u"", %""l" "u"", r, %f, Mbps\n",transfert_id,byte_counter ,((uint64_t) out_stamp.tv_sec)*1000 + ((uint64_t) out_stamp.tv_usec)/1000, bandwidth);
                last_print_s = (uint64_t) out_stamp.tv_sec;
            }
            byte_counter = 0;
            in_stamp = out_stamp;
        }
    }
    free(buffer);
    return ((void *)0);
}

canonical_original_code:
void *xen_shm_handler_receiver(struct xen_shm_handler_data *data) {
    struct xen_shm_handler_transfert *trans_data;
    long ret;
    struct timeval in_stamp;
    struct timeval out_stamp;
    unsigned long byte_counter;
    unsigned long print_threashold;
    unsigned long last_print_s;
    unsigned int transfert_id;
    unsigned long delay;
    unsigned char *buffer;
    double bandwidth;
    trans_data = (struct xen_shm_handler_transfert *) data->private_data;
    buffer = malloc(sizeof(unsigned char)*trans_data->buffer_len);
    transfert_id = xen_shm_handler_get_id();
    byte_counter = 0;
    bandwidth = 2000;
    print_threashold = (unsigned long) (bandwidth * 1000000)/4;
    gettimeofday(&in_stamp , ((void *)0));
    last_print_s = (unsigned long) in_stamp.tv_sec;
    while(!data->stop) {
        ret = xen_shm_pipe_read_all(data->receive_fd, buffer, trans_data->buffer_len);
        if(ret < 0) {
            printf("transfert %""u"" error - ", transfert_id);
            perror("pipe read all");
            return ((void *)0);
        }
        byte_counter+=trans_data->buffer_len;
        if(trans_data->print_info && byte_counter>print_threashold) {
            gettimeofday(&out_stamp , ((void *)0));
            delay = ((unsigned long) (out_stamp.tv_sec - in_stamp.tv_sec))*1000000 + (unsigned long) (out_stamp.tv_usec - in_stamp.tv_usec);
            bandwidth = (((double) byte_counter)*8)/((double) delay);
            print_threashold =(unsigned long) ((bandwidth * 1000000)/4);
            if((unsigned long) out_stamp.tv_sec > last_print_s) {
                printf("%""u"", %""l" "u"", %""l" "u"", r, %f, Mbps\n",transfert_id,byte_counter ,((unsigned long) out_stamp.tv_sec)*1000 + ((unsigned long) out_stamp.tv_usec)/1000, bandwidth);
                last_print_s = (unsigned long) out_stamp.tv_sec;
            }
            byte_counter = 0;
            in_stamp = out_stamp;
        }
    }
    free(buffer);
    return ((void *)0);
}

user_defined_types: struct timeval { long tv_sec; long tv_usec; }


Convertir

repo: OscarGarzon/FISICA-COMPUTACIONAL

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

masa = 0x39A464BFFC71A73BLL;
MASA_SOLAR = 0x46391B20F4D88BBDLL;
KPARSEC = 0x435B68C06A713000LL;
result = 0x3BF3B29C6612458CLL;
G = 0x3BF3B29C6612458CLL;
return result;
}

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

masa = 0x39A464BFFC71A73BLL;
MASA_SOLAR = 0x46391B20F4D88BBDLL;
KPARSEC = 0x435B68C06A713000LL;
result = 0x3BF3B29C6612458CLL;
G = 0x3BF3B29C6612458CLL;
return result;
}

variable_types: a double

variable_types: b double

variable_types: d double

variable_types: l double

return_type: double


asignarCondiciones

decompiled_code:
double __fastcall asignarCondiciones(int a1, double a2)
{
double v2; // r12
double v3; // rbp
double v5; // [rsp+0h] [rbp-28h] BYREF
double sinx[4]; // [rsp+8h] [rbp-20h] BYREF

sincos(a2, sinx, &v5);
v2 = v5;
v3 = sinx[0];
vel = pow(*(double *)&G * *(double *)&MASA_SOLAR * 1.0e12 / ((double)a1 * 3.086e16 * 10.0), 0.5);
*(double *)&a_x = v2 * (double)(10 * a1) + *(double *)&x_centro;
*(double *)&a_y = (double)(10 * a1) * v3 + *(double *)&y_centro;
*(double *)&vx = *(double *)&vx_centro - v3 * *(double *)&vel;
*(double *)&vy = *(double *)&vel * v2 + *(double *)&vy_centro;
return 0.0;
}

canonical_decompiled_code:
double __fastcall func8(int a1, double a2)
{
double v2; // r12
double v3; // rbp
double v5; // [rsp+0h] [rbp-28h] BYREF
double sinx[4]; // [rsp+8h] [rbp-20h] BYREF

sincos(a2, sinx, &v5);
v2 = v5;
v3 = sinx[0];
vel = pow(*(double *)&G * *(double *)&MASA_SOLAR * 1.0e12 / ((double)a1 * 3.086e16 * 10.0), 0.5);
*(double *)&a_x = v2 * (double)(10 * a1) + *(double *)&x_centro;
*(double *)&a_y = (double)(10 * a1) * v3 + *(double *)&y_centro;
*(double *)&vx = *(double *)&vx_centro - v3 * *(double *)&vel;
*(double *)&vy = *(double *)&vel * v2 + *(double *)&vy_centro;
return 0.0;
}

original_code:
double asignarCondiciones(int orbita, double thetaa){
 double a=pow(10,12);
 double t=pow(10,16);
 vel=pow(((G*MASA_SOLAR*a)/(3.086*t*orbita*10)),0.5);
 a_x=(orbita*10*cos(thetaa))+x_centro;
 a_y=(orbita*10*sin(thetaa))+y_centro;
 vx=vx_centro-vel*sin(thetaa);
 vy=vy_centro+vel*cos(thetaa);
return 0.0;
}

canonical_original_code:
double asignarCondiciones(int orbita, double thetaa){
 double a = pow(10,12);
 double t = pow(10,16);
 vel=pow(((G*MASA_SOLAR*a)/(3.086*t*orbita*10)),0.5);
 a_x=(orbita*10*cos(thetaa))+x_centro;
 a_y=(orbita*10*sin(thetaa))+y_centro;
 vx=vx_centro-vel*sin(thetaa);
 vy=vy_centro+vel*cos(thetaa);
return 0.0;
}

variable_types: orbita int

variable_types: thetaa double

variable_types: t double


main

decompiled_code:
int __cdecl main(int argc, const char **argv, const char **envp)
{
int v3; // er15
__int64 v4; // r13
size_t v5; // r14
double *v6; // r12
double *v7; // r14
_DWORD *v8; // rax
int v9; // eax
int i; // eax
int v11; // eax
double v13; // [rsp+0h] [rbp-68h]
double v14; // [rsp+8h] [rbp-60h]
double v15; // [rsp+10h] [rbp-58h]
double v16; // [rsp+18h] [rbp-50h]
double *v17; // [rsp+20h] [rbp-48h]
double *v18; // [rsp+28h] [rbp-40h]

Convertir(argc, argv, envp);
v13 = atof(argv[1]);
x_centro = *(_QWORD *)&v13;
v14 = atof(argv[2]);
y_centro = *(_QWORD *)&v14;
v15 = atof(argv[3]);
vx_centro = *(_QWORD *)&v15;
v16 = atof(argv[4]);
vy_centro = *(_QWORD *)&v16;
v3 = num_estrellas;
v4 = num_estrellas;
v5 = 8LL * num_estrellas;
v6 = (double *)malloc(v5);
x = (__int64)v6;
v17 = (double *)malloc(v5);
y = (__int64)v17;
v18 = (double *)malloc(v5);
v_x = (__int64)v18;
v7 = (double *)malloc(v5);
v_y = (__int64)v7;
ID = (__int64)malloc(4 * v4);
v8 = malloc(0x18uLL);
orbitas = (__int64)v8;
*v8 = 12;
v8[1] = 18;
v8[2] = 24;
v8[3] = 30;
v8[4] = 36;
*v6 = v13;
*v17 = v14;
*v18 = v15;
*v7 = v16;
::i = 0;
if ( v3 > 0 )
{
v9 = 0;
do
{
*(_DWORD *)(ID + 4LL * v9) = v9 - 1;
v9 = ::i + 1;
::i = v9;
}
while ( v9 < num_estrellas );
}
printf("Este programa se esta ejecutando con %d argumento(s):\n", (unsigned int)(argc - 1));
::i = 1;
if ( argc > 1 )
{
for ( i = 1; i < argc; ::i = i )
{
puts(argv[i]);
i = ::i + 1;
}
}
if ( argc != 5 )
{
puts("Se necesitan 4 parametros para determinar las condiciones iniciales\n EXIT!");
exit(1);
}
puts("Check_point 1 ");
::i = 1;
do
{
asignarCondiciones(1, *(double *)&theta);
*(_QWORD *)(x + 8LL * ::i) = a_x;
*(_QWORD *)(y + 8LL * ::i) = a_y;
*(_QWORD *)(v_x + 8LL * ::i) = vx;
*(_QWORD *)(v_y + 8LL * ::i) = vy;
*(double *)&theta = *(double *)&theta + 0.5235987750000001;
++::i;
}
while ( ::i <= 12 );
::i = 13;
do
{
asignarCondiciones(2, *(double *)&theta);
*(_QWORD *)(x + 8LL * ::i) = a_x;
*(_QWORD *)(y + 8LL * ::i) = a_y;
*(_QWORD *)(v_x + 8LL * ::i) = vx;
*(_QWORD *)(v_y + 8LL * ::i) = vy;
*(double *)&theta = *(double *)&theta + 0.34906585;
++::i;
}
while ( ::i <= 30 );
::i = 31;
do
{
asignarCondiciones(3, *(double *)&theta);
*(_QWORD *)(x + 8LL * ::i) = a_x;
*(_QWORD *)(y + 8LL * ::i) = a_y;
*(_QWORD *)(v_x + 8LL * ::i) = vx;
*(_QWORD *)(v_y + 8LL * ::i) = vy;
*(double *)&theta = *(double *)&theta + 0.2617993875;
++::i;
}
while ( ::i <= 54 );
::i = 55;
do
{
asignarCondiciones(4, *(double *)&theta);
*(_QWORD *)(x + 8LL * ::i) = a_x;
*(_QWORD *)(y + 8LL * ::i) = a_y;
*(_QWORD *)(v_x + 8LL * ::i) = vx;
*(_QWORD *)(v_y + 8LL * ::i) = vy;
*(double *)&theta = *(double *)&theta + 0.20943951;
++::i;
}
while ( ::i <= 84 );
for ( ::i = 85; ::i < num_estrellas; ++::i )
{
asignarCondiciones(5, *(double *)&theta);
*(_QWORD *)(x + 8LL * ::i) = a_x;
*(_QWORD *)(y + 8LL * ::i) = a_y;
*(_QWORD *)(v_x + 8LL * ::i) = vx;
*(_QWORD *)(v_y + 8LL * ::i) = vy;
*(double *)&theta = *(double *)&theta + 0.174532925;
}
puts("Check_point 2 ");
input = fopen("Condiciones_iniciales.dat", "w");
::i = 0;
if ( num_estrellas > 0 )
{
v11 = 0;
do
{
fprintf(
input,
"%i %f %f %f %f \n",
*(unsigned int *)(ID + 4LL * v11),
*(double *)(x + 8LL * v11),
*(double *)(y + 8LL * v11),
*(double *)(v_x + 8LL * v11),
*(double *)(v_y + 8LL * v11));
v11 = ::i + 1;
::i = v11;
}
while ( v11 < num_estrellas );
}
fclose(input);
return 0;
}

canonical_decompiled_code:
int __cdecl main(int argc, const char **argv, const char **envp)
{
int v3; // er15
__int64 v4; // r13
size_t v5; // r14
double *v6; // r12
double *v7; // r14
_DWORD *v8; // rax
int v9; // eax
int i; // eax
int v11; // eax
double v13; // [rsp+0h] [rbp-68h]
double v14; // [rsp+8h] [rbp-60h]
double v15; // [rsp+10h] [rbp-58h]
double v16; // [rsp+18h] [rbp-50h]
double *v17; // [rsp+20h] [rbp-48h]
double *v18; // [rsp+28h] [rbp-40h]

func7(argc, argv, envp);
v13 = atof(argv[1]);
x_centro = *(_QWORD *)&v13;
v14 = atof(argv[2]);
y_centro = *(_QWORD *)&v14;
v15 = atof(argv[3]);
vx_centro = *(_QWORD *)&v15;
v16 = atof(argv[4]);
vy_centro = *(_QWORD *)&v16;
v3 = num_estrellas;
v4 = num_estrellas;
v5 = 8LL * num_estrellas;
v6 = (double *)malloc(v5);
x = (__int64)v6;
v17 = (double *)malloc(v5);
y = (__int64)v17;
v18 = (double *)malloc(v5);
v_x = (__int64)v18;
v7 = (double *)malloc(v5);
v_y = (__int64)v7;
ID = (__int64)malloc(4 * v4);
v8 = malloc(0x18uLL);
orbitas = (__int64)v8;
*v8 = 12;
v8[1] = 18;
v8[2] = 24;
v8[3] = 30;
v8[4] = 36;
*v6 = v13;
*v17 = v14;
*v18 = v15;
*v7 = v16;
::i = 0;
if ( v3 > 0 )
{
v9 = 0;
do
{
*(_DWORD *)(ID + 4LL * v9) = v9 - 1;
v9 = ::i + 1;
::i = v9;
}
while ( v9 < num_estrellas );
}
printf("Este programa se esta ejecutando con %d argumento(s):\n", (unsigned int)(argc - 1));
::i = 1;
if ( argc > 1 )
{
for ( i = 1; i < argc; ::i = i )
{
puts(argv[i]);
i = ::i + 1;
}
}
if ( argc != 5 )
{
puts("Se necesitan 4 parametros para determinar las condiciones iniciales\n EXIT!");
exit(1);
}
puts("Check_point 1 ");
::i = 1;
do
{
func8(1, *(double *)&theta);
*(_QWORD *)(x + 8LL * ::i) = a_x;
*(_QWORD *)(y + 8LL * ::i) = a_y;
*(_QWORD *)(v_x + 8LL * ::i) = vx;
*(_QWORD *)(v_y + 8LL * ::i) = vy;
*(double *)&theta = *(double *)&theta + 0.5235987750000001;
++::i;
}
while ( ::i <= 12 );
::i = 13;
do
{
func8(2, *(double *)&theta);
*(_QWORD *)(x + 8LL * ::i) = a_x;
*(_QWORD *)(y + 8LL * ::i) = a_y;
*(_QWORD *)(v_x + 8LL * ::i) = vx;
*(_QWORD *)(v_y + 8LL * ::i) = vy;
*(double *)&theta = *(double *)&theta + 0.34906585;
++::i;
}
while ( ::i <= 30 );
::i = 31;
do
{
func8(3, *(double *)&theta);
*(_QWORD *)(x + 8LL * ::i) = a_x;
*(_QWORD *)(y + 8LL * ::i) = a_y;
*(_QWORD *)(v_x + 8LL * ::i) = vx;
*(_QWORD *)(v_y + 8LL * ::i) = vy;
*(double *)&theta = *(double *)&theta + 0.2617993875;
++::i;
}
while ( ::i <= 54 );
::i = 55;
do
{
func8(4, *(double *)&theta);
*(_QWORD *)(x + 8LL * ::i) = a_x;
*(_QWORD *)(y + 8LL * ::i) = a_y;
*(_QWORD *)(v_x + 8LL * ::i) = vx;
*(_QWORD *)(v_y + 8LL * ::i) = vy;
*(double *)&theta = *(double *)&theta + 0.20943951;
++::i;
}
while ( ::i <= 84 );
for ( ::i = 85; ::i < num_estrellas; ++::i )
{
func8(5, *(double *)&theta);
*(_QWORD *)(x + 8LL * ::i) = a_x;
*(_QWORD *)(y + 8LL * ::i) = a_y;
*(_QWORD *)(v_x + 8LL * ::i) = vx;
*(_QWORD *)(v_y + 8LL * ::i) = vy;
*(double *)&theta = *(double *)&theta + 0.174532925;
}
puts("Check_point 2 ");
input = fopen("Condiciones_iniciales.dat", "w");
::i = 0;
if ( num_estrellas > 0 )
{
v11 = 0;
do
{
fprintf(
input,
"%i %f %f %f %f \n",
*(unsigned int *)(ID + 4LL * v11),
*(double *)(x + 8LL * v11),
*(double *)(y + 8LL * v11),
*(double *)(v_x + 8LL * v11),
*(double *)(v_y + 8LL * v11));
v11 = ::i + 1;
::i = v11;
}
while ( v11 < num_estrellas );
}
fclose(input);
return 0;
}

original_code:
int main(int argc, char **argv){
 Convertir();
 x_centro=atof(argv[1]);
 y_centro=atof(argv[2]);
 vx_centro=atof(argv[3]);
 vy_centro=atof(argv[4]);
 x = malloc( num_estrellas* sizeof(double));
 y = malloc(num_estrellas * sizeof(double));
  v_x = malloc(num_estrellas * sizeof(double));
  v_y = malloc(num_estrellas * sizeof(double));
 ID=malloc(num_estrellas * sizeof(int));
 orbitas=malloc(6 * sizeof(int));
 orbitas[0]=12;
 orbitas[1]=18;
 orbitas[2]=24;
 orbitas[3]=30;
 orbitas[4]=36;
 x[0]=x_centro;
 y[0]=y_centro;
 v_x[0]=vx_centro;
 v_y[0]=vy_centro;
 for(i=0;i<num_estrellas;i++){
  ID[i]=i-1;
 }
 printf("Este programa se esta ejecutando con %d argumento(s):\n",argc-1);
 for(i=1;i<argc;i++){
     printf("%s\n", argv[i]);
   }
   if(argc-1!=4){
    printf("Se necesitan 4 parametros para determinar las condiciones iniciales\n EXIT!\n");
     exit(1);
     }
printf("Check_point 1 \n");
 for (i=1;i<=12;i++){
   asignarCondiciones(1, theta);
   x[i]=a_x;
   y[i]=a_y;
   v_x[i]=vx;
   v_y[i]=vy;
   theta=theta+(2*3.14159265/12);
 }
 for (i=13;i<=12+18;i++){
   asignarCondiciones(2, theta);
   x[i]=a_x;
   y[i]=a_y;
   v_x[i]=vx;
   v_y[i]=vy;
   theta=theta+(2*3.14159265/18);
 }
 for (i=31;i<=54;i++){
   asignarCondiciones(3, theta);
   x[i]=a_x;
   y[i]=a_y;
   v_x[i]=vx;
   v_y[i]=vy;
   theta=theta+(2*3.14159265/24);
 }
 for (i=55;i<=84;i++){
   asignarCondiciones(4, theta);
   x[i]=a_x;
   y[i]=a_y;
   v_x[i]=vx;
   v_y[i]=vy;
   theta=theta+(2*3.14159265/30);
 }
 for (i=85;i<num_estrellas;i++){
   asignarCondiciones(5, theta);
   x[i]=a_x;
   y[i]=a_y;
   v_x[i]=vx;
   v_y[i]=vy;
   theta=theta+(2*3.14159265/36);
 }
printf("Check_point 2 \n");
 input=fopen("Condiciones_iniciales.dat","w");
 for (i=0;i<num_estrellas;i++){
  fprintf(input,"%i %f %f %f %f \n", ID[i],x[i],y[i],v_x[i],v_y[i]);
 }
  fclose(input);
}

variable_types: argc int


decompiled_code:
int __cdecl main(int argc, const char **argv, const char **envp)
{
int v3; // ebx
int v5[103]; // [rsp+0h] [rbp-1A8h] BYREF
int v6; // [rsp+19Ch] [rbp-Ch]

v6 = 0;
puts("Enter a list of grades, and a negative number when done.");
v3 = 0;
while ( v6 >= 0 && v3 <= 99 )
{
printf("Enter grade: ");
__isoc99_scanf();
if ( v6 >= 0 )
{
if ( v6 > 100 )
puts("Grades can't be over 100.");
else
v5[v3++] = v6;
}
}
gradeStats(v5, (unsigned int)v3);
return 0;
}

canonical_decompiled_code:
int __cdecl main(int argc, const char **argv, const char **envp)
{
int v3; // ebx
int v5[103]; // [rsp+0h] [rbp-1A8h] BYREF
int v6; // [rsp+19Ch] [rbp-Ch]

v6 = 0;
puts("Enter a list of grades, and a negative number when done.");
v3 = 0;
while ( v6 >= 0 && v3 <= 99 )
{
printf("Enter grade: ");
__isoc99_scanf();
if ( v6 >= 0 )
{
if ( v6 > 100 )
puts("Grades can't be over 100.");
else
v5[v3++] = v6;
}
}
func7(v5, (unsigned int)v3);
return 0;
}

original_code:
int main( void )
{
   int counter;
   int grade;
   int grades[100];
   counter = 0;
   grade = 0;
   printf("Enter a list of grades, and a negative number when done.\n");
   while (grade >= 0 && counter < 100) {
      printf( "Enter grade: " );
      scanf( "%d", &grade );
      if (grade >= 0) {
          if (grade <= 100) {
            grades[counter] = grade;
            counter = counter + 1;
          }
          else printf("Grades can't be over 100.\n");
       }
   }
   gradeStats(grades, counter);
   return 0;
}

canonical_original_code:
int main()
{
   int counter;
   int grade;
   int grades[100];
   counter = 0;
   grade = 0;
   printf("Enter a list of grades, and a negative number when done.\n");
   while (grade >= 0 && counter < 100) {
      printf( "Enter grade: " );
      scanf( "%d", &grade );
      if (grade >= 0) {
          if (grade <= 100) {
            grades[counter] = grade;
            counter = counter + 1;
          }
          else printf("Grades can't be over 100.\n");
       }
   }
   gradeStats(grades, counter);
   return 0;
}

variable_types: counter int

variable_types: grade int

variable_types:
grades
int [100]


gradeStats

decompiled_code:
int __fastcall gradeStats(int *a1, int a2)
{
int *v3; // rsi
__int64 v4; // rcx
int v5; // eax
int v6; // edi
int v7; // er8

if ( a2 <= 0 )
{
v5 = 0;
v6 = 100;
v7 = 0;
}
else
{
v3 = a1;
v4 = (__int64)&a1[a2 - 1 + 1];
v5 = 0;
v6 = 100;
v7 = 0;
do
{
v5 += *v3;
if ( v7 < *v3 )
v7 = *v3;
if ( v6 > *v3 )
v6 = *v3;
++v3;
}
while ( v3 != (int *)v4 );
}
return printf("Minimum: %d, Maximum: %d, Average: %d\n", (unsigned int)v6, (unsigned int)v7, (unsigned int)(v5 / a2));
}

canonical_decompiled_code:
int __fastcall func7(int *a1, int a2)
{
int *v3; // rsi
__int64 v4; // rcx
int v5; // eax
int v6; // edi
int v7; // er8

if ( a2 <= 0 )
{
v5 = 0;
v6 = 100;
v7 = 0;
}
else
{
v3 = a1;
v4 = (__int64)&a1[a2 - 1 + 1];
v5 = 0;
v6 = 100;
v7 = 0;
do
{
v5 += *v3;
if ( v7 < *v3 )
v7 = *v3;
if ( v6 > *v3 )
v6 = *v3;
++v3;
}
while ( v3 != (int *)v4 );
}
return printf("Minimum: %d, Maximum: %d, Average: %d\n", (unsigned int)v6, (unsigned int)v7, (unsigned int)(v5 / a2));
}

original_code:
void gradeStats(int list[100], int number) {
 int max = 0;
 int min = 100;
 int total = 0;
 int avg = 0;
 int i;
 for(i = 0; i < number; i++) {
  total += list[i];
  if(list[i] > max) max = list[i];
  if(list[i] < min) min = list[i];
 }
 avg = total / number;
 printf("Minimum: %d, Maximum: %d, Average: %d\n", min, max, avg);
}

variable_types:
list
int [100]

variable_types: number int

variable_types: max int

variable_types: min int

variable_types: total int

variable_types: avg int

variable_types: i int


decompiled_code:
void __noreturn exit_signal()
{
puts("Exit signal");
if ( pcap_handle )
{
pcap_breakloop();
pcap_close();
}
exit(0);
}

canonical_decompiled_code:
void __noreturn func7()
{
puts("Exit signal");
if ( pcap_handle )
{
pcap_breakloop();
pcap_close();
}
exit(0);
}

original_code:
void exit_signal(int id)
{
    printf("Exit signal\n");
    if (pcap_handle != ((void *)0)) {
 pcap_breakloop(pcap_handle);
 pcap_close(pcap_handle);
    }
    exit(0);
}

variable_types: id int


decompiled_code:
int __fastcall bssid_found(unsigned __int8 *a1, char a2, const char *a3)
{
int result; // eax

result = strncmp((const char *)a1, &broadcastaddr, 6uLL);
if ( result )
{
result = match_mac;
if ( !match_mac
|| *(_BYTE *)match_mac == *a1
&& *(_BYTE *)(match_mac + 1) == a1[1]
&& *(_BYTE *)(match_mac + 2) == a1[2]
&& *(_BYTE *)(match_mac + 3) == a1[3]
&& *(_BYTE *)(match_mac + 4) == a1[4]
&& *(_BYTE *)(match_mac + 5) == a1[5] )
{
if ( power_only )
{
if ( a2 != -127 )
result = printf("%d\n", (unsigned int)a2);
}
else
{
printf("%02hhx:%02hhx:%02hhx:%02hhx:%02hhx:%02hhx Type:%s", *a1, a1[1], a1[2], a1[3], a1[4], a1[5], a3);
if ( a2 != -127 )
printf(" Power:%d", (unsigned int)a2);
result = putchar(10);
}
}
}
return result;
}

canonical_decompiled_code:
int __fastcall func8(unsigned __int8 *a1, char a2, const char *a3)
{
int result; // eax

result = strncmp((const char *)a1, &broadcastaddr, 6uLL);
if ( result )
{
result = match_mac;
if ( !match_mac
|| *(_BYTE *)match_mac == *a1
&& *(_BYTE *)(match_mac + 1) == a1[1]
&& *(_BYTE *)(match_mac + 2) == a1[2]
&& *(_BYTE *)(match_mac + 3) == a1[3]
&& *(_BYTE *)(match_mac + 4) == a1[4]
&& *(_BYTE *)(match_mac + 5) == a1[5] )
{
if ( power_only )
{
if ( a2 != -127 )
result = printf("%d\n", (unsigned int)a2);
}
else
{
printf("%02hhx:%02hhx:%02hhx:%02hhx:%02hhx:%02hhx Type:%s", *a1, a1[1], a1[2], a1[3], a1[4], a1[5], a3);
if ( a2 != -127 )
printf(" Power:%d", (unsigned int)a2);
result = putchar(10);
}
}
}
return result;
}

original_code:
void bssid_found(const u_char * bssid, int8_t power, char *type)
{
    if (strncmp(bssid, broadcastaddr, 6) != 0){
        if (match_mac != ((void *)0)){
            if (match_mac[0] != bssid[0]) return;
            if (match_mac[1] != bssid[1]) return;
            if (match_mac[2] != bssid[2]) return;
            if (match_mac[3] != bssid[3]) return;
            if (match_mac[4] != bssid[4]) return;
            if (match_mac[5] != bssid[5]) return;
        }
        if (!power_only){
            printf("%02hhx:%02hhx:%02hhx:%02hhx:%02hhx:%02hhx Type:%s",
            bssid[0], bssid[1], bssid[2], bssid[3], bssid[4], bssid[5], type);
            if (power!=-127){
                printf(" Power:%d", power);
     }
            printf("\n");
        }
        else if (power!=-127)
            printf("%d\n", power);
    }
}

canonical_original_code:
void bssid_found(unsigned char *bssid, char power, char *type)
{
    if (strncmp(bssid, broadcastaddr, 6) != 0){
        if (match_mac != ((void *)0)){
            if (match_mac[0] != bssid[0]) return;
            if (match_mac[1] != bssid[1]) return;
            if (match_mac[2] != bssid[2]) return;
            if (match_mac[3] != bssid[3]) return;
            if (match_mac[4] != bssid[4]) return;
            if (match_mac[5] != bssid[5]) return;
        }
        if (!power_only){
            printf("%02hhx:%02hhx:%02hhx:%02hhx:%02hhx:%02hhx Type:%s",
            bssid[0], bssid[1], bssid[2], bssid[3], bssid[4], bssid[5], type);
            if (power!=-127){
                printf(" Power:%d", power);
     }
            printf("\n");
        }
        else if (power!=-127)
            printf("%d\n", power);
    }
}

variable_types:
bssid
unsigned char *

variable_types: power char

variable_types:
type
char *


decompiled_code:
void __fastcall process_packet(__int64 a1, __int64 a2, _BYTE *a3)
{
unsigned __int8 v4; // r12
char v5; // r14
unsigned __int8 v6; // r13
unsigned __int8 v7; // al
bool v8; // zf
char v9; // r13
const char *v10; // [rsp+0h] [rbp-48h]

if ( *(_DWORD *)(a2 + 20) > 0x17u )
{
v4 = a3[2];
v5 = -127;
if ( (a3[4] & 0x20) != 0 )
v5 = a3[14];
v6 = a3[v4 + 1] & 3;
v7 = a3[v4];
switch ( v7 )
{
case 0u:
v10 = "Association request";
break;
case 8u:
v10 = "Data";
break;
case 0x10u:
v10 = "Association response";
break;
case 0x18u:
v10 = "Data+CF-Ack";
break;
case 0x20u:
v10 = "Reassociation request";
break;
case 0x28u:
v10 = "Data+CF-Poll";
break;
case 0x30u:
v10 = "Reassociation response";
break;
case 0x38u:
v10 = "Data+CF-AC";
break;
case 0x40u:
v10 = "Probe request";
break;
case 0x48u:
v10 = "Null function";
break;
case 0x50u:
v10 = "Probe response";
break;
case 0x58u:
v10 = "CF-ACK";
break;
case 0x60u:
v10 = "Timing advertisement";
break;
case 0x68u:
v10 = "CF-Poll";
break;
case 0x74u:
v10 = "Control Wrapper";
break;
case 0x78u:
v10 = "CF-Ack+CF-Poll";
break;
case 0x80u:
v10 = "Beacon";
break;
case 0x84u:
v10 = "Block Ack Request";
break;
case 0x88u:
v10 = "QoS";
break;
case 0x90u:
v10 = "ATIM";
break;
case 0x94u:
v10 = "Block Ack";
break;
case 0x98u:
v10 = (const char *)&unk_402165;
break;
case 0xA0u:
v10 = "Disassociation";
break;
case 0xA4u:
v10 = "PS Poll";
break;
case 0xA8u:
v10 = (const char *)&unk_402175;
break;
case 0xB0u:
v10 = "Authentication";
break;
case 0xB4u:
v10 = "RTS";
break;
case 0xB8u:
v10 = "QoS Data+CF-Ack+CF-Poll";
break;
case 0xC0u:
v10 = "Deauthentication";
break;
case 0xC4u:
v10 = "Clear to send";
break;
case 0xC8u:
v10 = "QoS Null";
break;
case 0xD0u:
v10 = "Action";
break;
case 0xD4u:
v10 = "ACK";
break;
case 0xE0u:
v10 = "Action No Ack";
break;
case 0xE4u:
v10 = "CF-End";
break;
case 0xE8u:
v10 = (const char *)&unk_4021A7;
break;
case 0xF4u:
v10 = "CF-End+CF-Ack";
break;
case 0xF8u:
v10 = (const char *)&unk_4021B3;
break;
default:
printf(" Unknown packet: %02hhx \n", v7);
break;
}
if ( v6 == 2 )
{
v9 = v5;
v5 = -127;
}
else if ( v6 > 2u )
{
v9 = -127;
v5 = -127;
}
else
{
v8 = v6 == 2;
v9 = 0;
if ( !v8 )
v9 = -127;
}
if ( *(_DWORD *)(a2 + 20) >= (unsigned int)(unsigned __int8)(v4 + 10) )
{
bssid_found(&a3[(unsigned __int8)(v4 + 4)], -127, v10);
if ( *(_DWORD *)(a2 + 20) >= (unsigned int)(unsigned __int8)(v4 + 16) )
{
bssid_found(&a3[(unsigned __int8)(v4 + 10)], v5, v10);
if ( *(_DWORD *)(a2 + 20) >= (unsigned int)(unsigned __int8)(v4 + 22) )
bssid_found(&a3[(unsigned __int8)(v4 + 16)], v9, v10);
}
}
}
}

canonical_decompiled_code:
void __fastcall func9(__int64 a1, __int64 a2, _BYTE *a3)
{
unsigned __int8 v4; // r12
char v5; // r14
unsigned __int8 v6; // r13
unsigned __int8 v7; // al
bool v8; // zf
char v9; // r13
const char *v10; // [rsp+0h] [rbp-48h]

if ( *(_DWORD *)(a2 + 20) > 0x17u )
{
v4 = a3[2];
v5 = -127;
if ( (a3[4] & 0x20) != 0 )
v5 = a3[14];
v6 = a3[v4 + 1] & 3;
v7 = a3[v4];
switch ( v7 )
{
case 0u:
v10 = "Association request";
break;
case 8u:
v10 = "Data";
break;
case 0x10u:
v10 = "Association response";
break;
case 0x18u:
v10 = "Data+CF-Ack";
break;
case 0x20u:
v10 = "Reassociation request";
break;
case 0x28u:
v10 = "Data+CF-Poll";
break;
case 0x30u:
v10 = "Reassociation response";
break;
case 0x38u:
v10 = "Data+CF-AC";
break;
case 0x40u:
v10 = "Probe request";
break;
case 0x48u:
v10 = "Null function";
break;
case 0x50u:
v10 = "Probe response";
break;
case 0x58u:
v10 = "CF-ACK";
break;
case 0x60u:
v10 = "Timing advertisement";
break;
case 0x68u:
v10 = "CF-Poll";
break;
case 0x74u:
v10 = "Control Wrapper";
break;
case 0x78u:
v10 = "CF-Ack+CF-Poll";
break;
case 0x80u:
v10 = "Beacon";
break;
case 0x84u:
v10 = "Block Ack Request";
break;
case 0x88u:
v10 = "QoS";
break;
case 0x90u:
v10 = "ATIM";
break;
case 0x94u:
v10 = "Block Ack";
break;
case 0x98u:
v10 = (const char *)&unk_402165;
break;
case 0xA0u:
v10 = "Disassociation";
break;
case 0xA4u:
v10 = "PS Poll";
break;
case 0xA8u:
v10 = (const char *)&unk_402175;
break;
case 0xB0u:
v10 = "Authentication";
break;
case 0xB4u:
v10 = "RTS";
break;
case 0xB8u:
v10 = "QoS Data+CF-Ack+CF-Poll";
break;
case 0xC0u:
v10 = "Deauthentication";
break;
case 0xC4u:
v10 = "Clear to send";
break;
case 0xC8u:
v10 = "QoS Null";
break;
case 0xD0u:
v10 = "Action";
break;
case 0xD4u:
v10 = "ACK";
break;
case 0xE0u:
v10 = "Action No Ack";
break;
case 0xE4u:
v10 = "CF-End";
break;
case 0xE8u:
v10 = (const char *)&unk_4021A7;
break;
case 0xF4u:
v10 = "CF-End+CF-Ack";
break;
case 0xF8u:
v10 = (const char *)&unk_4021B3;
break;
default:
printf(" Unknown packet: %02hhx \n", v7);
break;
}
if ( v6 == 2 )
{
v9 = v5;
v5 = -127;
}
else if ( v6 > 2u )
{
v9 = -127;
v5 = -127;
}
else
{
v8 = v6 == 2;
v9 = 0;
if ( !v8 )
v9 = -127;
}
if ( *(_DWORD *)(a2 + 20) >= (unsigned int)(unsigned __int8)(v4 + 10) )
{
func8(&a3[(unsigned __int8)(v4 + 4)], -127, v10);
if ( *(_DWORD *)(a2 + 20) >= (unsigned int)(unsigned __int8)(v4 + 16) )
{
func8(&a3[(unsigned __int8)(v4 + 10)], v5, v10);
if ( *(_DWORD *)(a2 + 20) >= (unsigned int)(unsigned __int8)(v4 + 22) )
func8(&a3[(unsigned __int8)(v4 + 16)], v9, v10);
}
}
}
}

original_code:
void process_packet(u_char * useless, const struct pcap_pkthdr *header,
      const u_char * packet)
{
    int8_t power;
    int8_t power_mac1, power_mac2, power_mac3;
    u_int8_t flags;
    u_int8_t hlen, pos1, pos2, pos3, pos4;
    char *type;
    if (header->len >= 24) {
        hlen = packet[2]+(packet[3]<<8);
        pos1 = hlen + 4;
        pos2 = hlen + 10;
        pos3 = hlen + 16;
        pos4 = hlen + 22;
        if ((packet[4] & 0x20) == 0x20)
     power = packet[14];
        else
            power = -127;
        flags = packet[hlen+1] & 0x03;
 switch (packet[hlen]) {
        case 0x00:
            type = "Association request";
            break;
        case 0x10:
            type = "Association response";
            break;
        case 0x20:
            type = "Reassociation request";
            break;
        case 0x30:
            type = "Reassociation response";
            break;
 case 0x40:
            type = "Probe request";
            break;
 case 0x50:
            type = "Probe response";
            break;
        case 0x60:
            type = "Timing advertisement";
            break;
 case 0x80:
            type = "Beacon";
            break;
        case 0x90:
            type = "ATIM";
            break;
        case 0xA0:
            type = "Disassociation";
            break;
        case 0xB0:
            type = "Authentication";
            break;
        case 0xC0:
            type = "Deauthentication";
            break;
        case 0xD0:
            type = "Action";
            break;
        case 0xE0:
            type = "Action No Ack";
            break;
        case 0x74:
            type = "Control Wrapper";
            break;
        case 0x84:
            type = "Block Ack Request";
            break;
        case 0x94:
            type = "Block Ack";
            break;
        case 0xA4:
            type = "PS Poll";
            break;
        case 0xB4:
            type = "RTS";
            break;
        case 0xC4:
            type = "Clear to send";
            break;
        case 0xD4:
            type = "ACK";
            break;
        case 0xE4:
            type = "CF-End";
            break;
        case 0xF4:
            type = "CF-End+CF-Ack";
            break;
        case 0x08:
            type = "Data";
            break;
        case 0x18:
            type = "Data+CF-Ack";
            break;
        case 0x28:
            type = "Data+CF-Poll";
            break;
        case 0x38:
            type = "Data+CF-AC";
            break;
        case 0x48:
            type = "Null function";
            break;
        case 0x58:
            type = "CF-ACK";
            break;
        case 0x68:
            type = "CF-Poll";
            break;
        case 0x78:
            type = "CF-Ack+CF-Poll";
            break;
        case 0x88:
            type = "QoS";
            break;
        case 0x98:
            type = "QoS Data+CF-Ack";
            break;
        case 0xA8:
            type = "QoS Data+CF-Poll";
            break;
        case 0xB8:
            type = "QoS Data+CF-Ack+CF-Poll";
            break;
        case 0xC8:
            type = "QoS Null";
            break;
        case 0xE8:
            type = "QoS CF-Poll";
            break;
        case 0xF8:
            type = "QoS CF-Ack+CF-Poll";
            break;
 default:
            printf(" Unknown packet: %02hhx \n",packet[hlen]);
     break;
        }
        switch(flags){
        case 0:
            power_mac1 = -127;
            power_mac2 = power;
            power_mac3 = -127;
            break;
        case 1:
            power_mac1 = -127;
            power_mac2 = power;
            power_mac3 = -127;
            break;
        case 2:
            power_mac1 = -127;
            power_mac2 = -127;
            power_mac3 = power;
            break;
        case 3:
            power_mac1 = -127;
            power_mac2 = -127;
            power_mac3 = -127;
            break;
        }
        if (header->len >= pos2){
            bssid_found(packet + pos1, power_mac1, type);
            if (header->len >= pos3){
                bssid_found(packet + pos2, power_mac2, type);
                if (header->len >= pos4){
                    bssid_found(packet + pos3, power_mac3, type);
                }
            }
        }
    }
}

canonical_original_code:
void process_packet(unsigned char *useless, struct pcap_pkthdr *header, unsigned char *packet)
{
    char power;
    char power_mac1; char power_mac2; char power_mac3;
    unsigned int flags;
    unsigned int hlen; unsigned int pos1; unsigned int pos2; unsigned int pos3; unsigned int pos4;
    char *type;
    if (header->len >= 24) {
        hlen = packet[2]+(packet[3]<<8);
        pos1 = hlen + 4;
        pos2 = hlen + 10;
        pos3 = hlen + 16;
        pos4 = hlen + 22;
        if ((packet[4] & 0x20) == 0x20)
     power = packet[14];
        else
            power = -127;
        flags = packet[hlen+1] & 0x03;
 switch (packet[hlen]) {
        case 0x00:
            type = "Association request";
            break;
        case 0x10:
            type = "Association response";
            break;
        case 0x20:
            type = "Reassociation request";
            break;
        case 0x30:
            type = "Reassociation response";
            break;
 case 0x40:
            type = "Probe request";
            break;
 case 0x50:
            type = "Probe response";
            break;
        case 0x60:
            type = "Timing advertisement";
            break;
 case 0x80:
            type = "Beacon";
            break;
        case 0x90:
            type = "ATIM";
            break;
        case 0xA0:
            type = "Disassociation";
            break;
        case 0xB0:
            type = "Authentication";
            break;
        case 0xC0:
            type = "Deauthentication";
            break;
        case 0xD0:
            type = "Action";
            break;
        case 0xE0:
            type = "Action No Ack";
            break;
        case 0x74:
            type = "Control Wrapper";
            break;
        case 0x84:
            type = "Block Ack Request";
            break;
        case 0x94:
            type = "Block Ack";
            break;
        case 0xA4:
            type = "PS Poll";
            break;
        case 0xB4:
            type = "RTS";
            break;
        case 0xC4:
            type = "Clear to send";
            break;
        case 0xD4:
            type = "ACK";
            break;
        case 0xE4:
            type = "CF-End";
            break;
        case 0xF4:
            type = "CF-End+CF-Ack";
            break;
        case 0x08:
            type = "Data";
            break;
        case 0x18:
            type = "Data+CF-Ack";
            break;
        case 0x28:
            type = "Data+CF-Poll";
            break;
        case 0x38:
            type = "Data+CF-AC";
            break;
        case 0x48:
            type = "Null function";
            break;
        case 0x58:
            type = "CF-ACK";
            break;
        case 0x68:
            type = "CF-Poll";
            break;
        case 0x78:
            type = "CF-Ack+CF-Poll";
            break;
        case 0x88:
            type = "QoS";
            break;
        case 0x98:
            type = "QoS Data+CF-Ack";
            break;
        case 0xA8:
            type = "QoS Data+CF-Poll";
            break;
        case 0xB8:
            type = "QoS Data+CF-Ack+CF-Poll";
            break;
        case 0xC8:
            type = "QoS Null";
            break;
        case 0xE8:
            type = "QoS CF-Poll";
            break;
        case 0xF8:
            type = "QoS CF-Ack+CF-Poll";
            break;
 default:
            printf(" Unknown packet: %02hhx \n",packet[hlen]);
     break;
        }
        switch(flags){
        case 0:
            power_mac1 = -127;
            power_mac2 = power;
            power_mac3 = -127;
            break;
        case 1:
            power_mac1 = -127;
            power_mac2 = power;
            power_mac3 = -127;
            break;
        case 2:
            power_mac1 = -127;
            power_mac2 = -127;
            power_mac3 = power;
            break;
        case 3:
            power_mac1 = -127;
            power_mac2 = -127;
            power_mac3 = -127;
            break;
        }
        if (header->len >= pos2){
            bssid_found(packet + pos1, power_mac1, type);
            if (header->len >= pos3){
                bssid_found(packet + pos2, power_mac2, type);
                if (header->len >= pos4){
                    bssid_found(packet + pos3, power_mac3, type);
                }
            }
        }
    }
}

variable_types:
useless
unsigned char *

variable_types: struct pcap_pkthdr { struct timeval { long tv_sec; long tv_usec; } ts; unsigned int caplen; unsigned int len; } *

variable_types:
packet
unsigned char *

variable_types:
flags
unsigned int

variable_types:
hlen
unsigned int

user_defined_types: struct pcap_pkthdr { struct timeval ts; unsigned int caplen; unsigned int len; }


decompiled_code:
int print_menu()
{
printf("WifiTests - Version %s\nUsage: witest [-options]\n\n", "1.0");
puts("Options:");
puts("\t--help or -h\t\t\t\t: Shows this help");
puts("\t--verbose or -v\t\t\t\t: Verbose mode");
puts("\t--interface [name] or -i [name]\t\t: Required: Sniff on specified wlan interface");
puts("\t--mac-filter [XX:XX:XX...] or -m [XX:XX:XX...]\t: Filter on specified MAC address");
return puts("\t--power-only or -p\t: It shows just the received power");
}

canonical_decompiled_code:
int func11()
{
printf("WifiTests - Version %s\nUsage: witest [-options]\n\n", "1.0");
puts("Options:");
puts("\t--help or -h\t\t\t\t: Shows this help");
puts("\t--verbose or -v\t\t\t\t: Verbose mode");
puts("\t--interface [name] or -i [name]\t\t: Required: Sniff on specified wlan interface");
puts("\t--mac-filter [XX:XX:XX...] or -m [XX:XX:XX...]\t: Filter on specified MAC address");
return puts("\t--power-only or -p\t: It shows just the received power");
}

original_code:
void print_menu(){
    printf("WifiTests - Version %s\nUsage: witest [-options]\n\n", "1.0");
    printf("Options:\n");
    printf("\t--help or -h\t\t\t\t: Shows this help\n");
    printf("\t--verbose or -v\t\t\t\t: Verbose mode\n");
    printf("\t--interface [name] or -i [name]\t\t: Required: Sniff on specified wlan interface\n");
    printf("\t--mac-filter [XX:XX:XX...] or -m [XX:XX:XX...]\t: Filter on specified MAC address\n");
    printf("\t--power-only or -p\t: It shows just the received power\n");
}


main

decompiled_code:
int __cdecl main(int argc, const char **argv, const char **envp)
{
__int64 v3; // r12
char v5; // [rsp+6h] [rbp-132h] BYREF
int longind; // [rsp+Ch] [rbp-12Ch] BYREF

longind = 0;
signal(2, (__sighandler_t)exit_signal);
signal(3, (__sighandler_t)exit_signal);
v3 = 0LL;
while ( 2 )
{
longind = getopt_long(argc, (char *const *)argv, "hvi:m:p", &long_options_0, &longind);
switch ( longind )
{
case 'h':
print_menu();
exit(0);
case 'i':
v3 = optarg;
continue;
case 'm':
__isoc99_sscanf();
match_mac = (__int64)&v5;
goto LABEL_6;
case 'p':
power_only = 1;
continue;
case 'v':
++verbose;
continue;
default:
LABEL_6:
if ( longind != -1 )
continue;
if ( !v3 )
{
puts("Missing interface! Add it using -i [interface]");
exit(1);
}
pcap_handle = pcap_create();
if ( !pcap_handle )
fprintf(stderr, "Error while creating handle on interface %s\n", argv[argc - 1]);
if ( (unsigned int)pcap_set_promisc() )
dump_pcap_error();
if ( (unsigned int)pcap_set_timeout() )
dump_pcap_error();
if ( (unsigned int)pcap_activate() )
dump_pcap_error();
pcap_loop();
pcap_close();
return 0;
}
}
}

canonical_decompiled_code:
int __cdecl main(int argc, const char **argv, const char **envp)
{
__int64 v3; // r12
char v5; // [rsp+6h] [rbp-132h] BYREF
int longind; // [rsp+Ch] [rbp-12Ch] BYREF

longind = 0;
signal(2, (__sighandler_t)exit_signal);
signal(3, (__sighandler_t)exit_signal);
v3 = 0LL;
while ( 2 )
{
longind = getopt_long(argc, (char *const *)argv, "hvi:m:p", &long_options_0, &longind);
switch ( longind )
{
case 'h':
func11();
exit(0);
case 'i':
v3 = optarg;
continue;
case 'm':
__isoc99_sscanf();
match_mac = (__int64)&v5;
goto LABEL_6;
case 'p':
power_only = 1;
continue;
case 'v':
++verbose;
continue;
default:
LABEL_6:
if ( longind != -1 )
continue;
if ( !v3 )
{
puts("Missing interface! Add it using -i [interface]");
exit(1);
}
pcap_handle = pcap_create();
if ( !pcap_handle )
fprintf(stderr, "Error while creating handle on interface %s\n", argv[argc - 1]);
if ( (unsigned int)pcap_set_promisc() )
func10();
if ( (unsigned int)pcap_set_timeout() )
func10();
if ( (unsigned int)pcap_activate() )
func10();
pcap_loop();
pcap_close();
return 0;
}
}
}

original_code:
int main(int argc, char **argv)
{
    char error_buffer[256];
    int status = 0;
    int option_index = 0;
    char *interface = ((void *)0);
    unsigned char mmac[6];
    static const struct option long_options[] = {
        { "help", 0, ((void *)0), 'h' },
        { "verbose", 0, ((void *)0), 'v' },
        { "interface", 1, ((void *)0), 'i' },
        { "mac-filter", 1, ((void *)0), 'm' },
        { "power-only", 0, ((void *)0), 'p' },
        { 0, 0, 0, 0 }
    };
    signal(2, exit_signal);
    signal(3, exit_signal);
    do {
        option_index = getopt_long(argc, argv, "hvi:m:p", long_options, &option_index);
        switch (option_index)
        {
        case 'h':
            print_menu();
            exit(0);
            break;
        case 'v':
            verbose++;
            break;
        case 'i':
            interface = optarg;
            break;
        case 'm':
            sscanf(optarg, "%02hhx:%02hhx:%02hhx:%02hhx:%02hhx:%02hhx", &mmac[0],
            &mmac[1], &mmac[2], &mmac[3], &mmac[4], &mmac[5]);
            match_mac = mmac;
            break;
        case 'p':
            power_only = 1;
            break;
        default:
        break;
        }
    } while (option_index != -1);
    if (interface != ((void *)0)){
        pcap_handle = pcap_create(interface, error_buffer);
    }
    else {
        printf("Missing interface! Add it using -i [interface]\n");
        exit(1);
    }
    if (pcap_handle == ((void *)0)) {
 fprintf(stderr, "Error while creating handle on interface %s\n",
  argv[argc - 1]);
    }
    status = pcap_set_promisc(pcap_handle, 0);
    if (status != 0) {
 dump_pcap_error(pcap_handle) ;
    }
    status = pcap_set_timeout(pcap_handle, 0);
    if (status != 0) {
 dump_pcap_error(pcap_handle) ;
    }
    status = pcap_activate(pcap_handle);
    if (status != 0) {
 dump_pcap_error(pcap_handle) ;
    }
    pcap_loop(pcap_handle, -1, process_packet, ((void *)0));
    pcap_close(pcap_handle);
    return 0;
}

canonical_original_code:
int main(int argc, char **argv)
{
    char error_buffer[256];
    int status = 0;
    int option_index = 0;
    char *interface = ((void *)0);
    unsigned char mmac[6];
    static struct option long_options[] = {
        { "help", 0, ((void *)0), 'h' },
        { "verbose", 0, ((void *)0), 'v' },
        { "interface", 1, ((void *)0), 'i' },
        { "mac-filter", 1, ((void *)0), 'm' },
        { "power-only", 0, ((void *)0), 'p' },
        { 0, 0, 0, 0 }
    };
    signal(2, exit_signal);
    signal(3, exit_signal);
    do {
        option_index = getopt_long(argc, argv, "hvi:m:p", long_options, &option_index);
        switch (option_index)
        {
        case 'h':
            print_menu();
            exit(0);
            break;
        case 'v':
            verbose++;
            break;
        case 'i':
            interface = optarg;
            break;
        case 'm':
            sscanf(optarg, "%02hhx:%02hhx:%02hhx:%02hhx:%02hhx:%02hhx", &mmac[0],
            &mmac[1], &mmac[2], &mmac[3], &mmac[4], &mmac[5]);
            match_mac = mmac;
            break;
        case 'p':
            power_only = 1;
            break;
        default:
        break;
        }
    } while (option_index != -1);
    if (interface != ((void *)0)){
        pcap_handle = pcap_create(interface, error_buffer);
    }
    else {
        printf("Missing interface! Add it using -i [interface]\n");
        exit(1);
    }
    if (pcap_handle == ((void *)0)) {
 fprintf(stderr, "Error while creating handle on interface %s\n",
  argv[argc - 1]);
    }
    status = pcap_set_promisc(pcap_handle, 0);
    if (status != 0) {
 dump_pcap_error(pcap_handle) ;
    }
    status = pcap_set_timeout(pcap_handle, 0);
    if (status != 0) {
 dump_pcap_error(pcap_handle) ;
    }
    status = pcap_activate(pcap_handle);
    if (status != 0) {
 dump_pcap_error(pcap_handle) ;
    }
    pcap_loop(pcap_handle, -1, process_packet, ((void *)0));
    pcap_close(pcap_handle);
    return 0;
}

variable_types: argc int

variable_types:
argv
char **

variable_types: status int

variable_types:
interface
char *

variable_types:
mmac
unsigned char [6]

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


decompiled_code:
void startup_check()
{
__int64 (__fastcall *v0)(char *, __int64, __int64); // rbx
char *v1; // rdi
int v2; // eax

if ( startup != 1 )
{
startup = 1;
v0 = (__int64 (__fastcall *)(char *, __int64, __int64))dlsym((void *)0xFFFFFFFFFFFFFFFFLL, "open");
real_open = (__int64)v0;
real_open64 = (__int64)dlsym((void *)0xFFFFFFFFFFFFFFFFLL, "open64");
real_fopen = (__int64)dlsym((void *)0xFFFFFFFFFFFFFFFFLL, "fopen");
real_fopen64 = (__int64)dlsym((void *)0xFFFFFFFFFFFFFFFFLL, "fopen64");
real_stat = (__int64)dlsym((void *)0xFFFFFFFFFFFFFFFFLL, "stat");
real_stat64 = (__int64)dlsym((void *)0xFFFFFFFFFFFFFFFFLL, "stat64");
v1 = getenv("FILE_MONITOR_LOG");
if ( v1 )
{
v2 = v0(v1, 577LL, 384LL);
logFP = fdopen(v2, "w");
}
else
{
logFP = stderr;
}
}
}

canonical_decompiled_code:
void func6()
{
__int64 (__fastcall *v0)(char *, __int64, __int64); // rbx
char *v1; // rdi
int v2; // eax

if ( startup != 1 )
{
startup = 1;
v0 = (__int64 (__fastcall *)(char *, __int64, __int64))dlsym((void *)0xFFFFFFFFFFFFFFFFLL, "open");
real_open = (__int64)v0;
real_open64 = (__int64)dlsym((void *)0xFFFFFFFFFFFFFFFFLL, "open64");
real_fopen = (__int64)dlsym((void *)0xFFFFFFFFFFFFFFFFLL, "fopen");
real_fopen64 = (__int64)dlsym((void *)0xFFFFFFFFFFFFFFFFLL, "fopen64");
real_stat = (__int64)dlsym((void *)0xFFFFFFFFFFFFFFFFLL, "stat");
real_stat64 = (__int64)dlsym((void *)0xFFFFFFFFFFFFFFFFLL, "stat64");
v1 = getenv("FILE_MONITOR_LOG");
if ( v1 )
{
v2 = v0(v1, 577LL, 384LL);
logFP = fdopen(v2, "w");
}
else
{
logFP = stderr;
}
}
}

original_code:
void startup_check()
{
    if (startup == 1) {
        return;
    }
    startup = 1;
    real_open = dlsym(((void *) -1l), "open");
    real_open64 = dlsym(((void *) -1l), "open64");
    real_fopen = dlsym(((void *) -1l), "fopen");
    real_fopen64 = dlsym(((void *) -1l), "fopen64");
    real_stat = dlsym(((void *) -1l), "stat");
    real_stat64 = dlsym(((void *) -1l), "stat64");
    char *logfile = getenv("FILE_MONITOR_LOG");
    if (logfile) {
        int logFD = real_open(logfile, 01 | 01000 | 0100, 0400 | 0200);
        logFP = fdopen(logFD, "w");
    } else {
        logFP = stderr;
    }
}

variable_types:
logfile
char *

variable_types: logFD int


decompiled_code:
int __fastcall log_open(const char *a1, const char *a2, const char *a3, int a4)
{
const char *v4; // r9

v4 = "NO FILE";
if ( a4 )
v4 = "OK";
return fprintf(logFP, "opened file %s('%s','%s') == %s\n", a1, a2, a3, v4);
}

canonical_decompiled_code:
int __fastcall func7(const char *a1, const char *a2, const char *a3, int a4)
{
const char *v4; // r9

v4 = "NO FILE";
if ( a4 )
v4 = "OK";
return fprintf(logFP, "opened file %s('%s','%s') == %s\n", a1, a2, a3, v4);
}

original_code:
void log_open(const char* func, const char* fn, const char* mode, int ret)
{
    fprintf(logFP, "opened file %s('%s','%s') == %s\n", func, fn, mode, ret == 0 ? "NO FILE" : "OK");
}

canonical_original_code:
void log_open(char *func, char *fn, char *mode, int ret)
{
    fprintf(logFP, "opened file %s('%s','%s') == %s\n", func, fn, mode, ret == 0 ? "NO FILE" : "OK");
}

variable_types:
func
char *

variable_types:
fn
char *

variable_types:
mode
char *

variable_types: ret int


decompiled_code:
int __fastcall log_other(const char *a1, const char *a2, const char *a3)
{
return fprintf(logFP, "called %s('%s') == '%s'", a1, a2, a3);
}

canonical_decompiled_code:
int __fastcall func8(const char *a1, const char *a2, const char *a3)
{
return fprintf(logFP, "called %s('%s') == '%s'", a1, a2, a3);
}

original_code:
void log_other(const char* func, const char* fn, const char* extra)
{
    fprintf(logFP, "called %s('%s') == '%s'", func, fn, extra);
}

canonical_original_code:
void log_other(char *func, char *fn, char *extra)
{
    fprintf(logFP, "called %s('%s') == '%s'", func, fn, extra);
}

variable_types:
extra
char *


open

original_code:
int open(const char *fn, int flags, ...)
{
    startup_check();
    char m[6];
    m[0] = (flags & 00) > 0 ? 'r' : '_';
    m[1] = (flags & 01) > 0 ? 'w' : '_';
    m[2] = (flags & 02) > 0 ? '+' : '_';
    m[3] = (flags & 0100) > 0 ? 'c' : '_';
    m[4] = (flags & 02000) > 0 ? 'a' : '_';
    m[5] = '\0';
    int ret = -1;
    if (flags & 0100) {
        va_list ap;
        __builtin_va_start(ap,flags);
        mode_t mode = __builtin_va_arg(ap,mode_t);
        __builtin_va_end(ap);
        ret = real_open(fn, flags, mode);
    } else {
        ret = real_open(fn, flags);
    }
    log_open("open", fn, m, ret == -1 ? 0 : 1);
    return ret;
}

canonical_original_code:
int open(char *fn, int flags, ...)
{
    startup_check();
    char m[6];
    m[0] = (flags & 00) > 0 ? 'r' : '_';
    m[1] = (flags & 01) > 0 ? 'w' : '_';
    m[2] = (flags & 02) > 0 ? '+' : '_';
    m[3] = (flags & 0100) > 0 ? 'c' : '_';
    m[4] = (flags & 02000) > 0 ? 'a' : '_';
    m[5] = '\0';
    int ret = -1;
    if (flags & 0100) {
        __builtin_va_list ap;
        __builtin_va_start(ap,flags);
        unsigned int mode = __builtin_va_arg(ap,mode_t);
        __builtin_va_end(ap);
        ret = real_open(fn, flags, mode);
    } else {
        ret = real_open(fn, flags);
    }
    log_open("open", fn, m, ret == -1 ? 0 : 1);
    return ret;
}

variable_types: flags int

variable_types:
m
char [6]

variable_types:
mode
unsigned int


original_code:
int open64(const char *fn, int flags, ...)
{
    startup_check();
    char m[6];
    m[0] = (flags & 00) > 0 ? 'r' : '_';
    m[1] = (flags & 01) > 0 ? 'w' : '_';
    m[2] = (flags & 02) > 0 ? '+' : '_';
    m[3] = (flags & 0100) > 0 ? 'c' : '_';
    m[4] = (flags & 02000) > 0 ? 'a' : '_';
    m[5] = '\0';
    int ret = -1;
    if (flags & 0100) {
        va_list ap;
        __builtin_va_start(ap,flags);
        mode_t mode = __builtin_va_arg(ap,mode_t);
        __builtin_va_end(ap);
        ret = real_open64(fn, flags, mode);
    } else {
        ret = real_open64(fn, flags);
    }
    log_open("open64", fn, m, ret == -1 ? 0 : 1);
    return ret;
}

canonical_original_code:
int open64(char *fn, int flags, ...)
{
    startup_check();
    char m[6];
    m[0] = (flags & 00) > 0 ? 'r' : '_';
    m[1] = (flags & 01) > 0 ? 'w' : '_';
    m[2] = (flags & 02) > 0 ? '+' : '_';
    m[3] = (flags & 0100) > 0 ? 'c' : '_';
    m[4] = (flags & 02000) > 0 ? 'a' : '_';
    m[5] = '\0';
    int ret = -1;
    if (flags & 0100) {
        __builtin_va_list ap;
        __builtin_va_start(ap,flags);
        unsigned int mode = __builtin_va_arg(ap,mode_t);
        __builtin_va_end(ap);
        ret = real_open64(fn, flags, mode);
    } else {
        ret = real_open64(fn, flags);
    }
    log_open("open64", fn, m, ret == -1 ? 0 : 1);
    return ret;
}


stat

decompiled_code:
__int64 __fastcall stat(__int64 a1, __int64 a2)
{
unsigned int v2; // ebx
const char *v3; // rdx

startup_check();
v2 = real_stat(a1, a2);
v3 = "OK";
if ( v2 )
v3 = "!found";
log_other("stat", a1, v3);
return v2;
}

canonical_decompiled_code:
__int64 __fastcall func13(__int64 a1, __int64 a2)
{
unsigned int v2; // ebx
const char *v3; // rdx

func6();
v2 = real_stat(a1, a2);
v3 = "OK";
if ( v2 )
v3 = "!found";
func8("stat", a1, v3);
return v2;
}

original_code:
int stat(const char* path, struct stat* buf)
{
    startup_check();
    int ret = real_stat(path, buf);
    log_other("stat", path, ret == 0 ? "OK" : "!found");
    return ret;
}

canonical_original_code:
int stat(char *path, struct stat *buf)
{
    startup_check();
    int ret = real_stat(path, buf);
    log_other("stat", path, ret == 0 ? "OK" : "!found");
    return ret;
}

variable_types:
path
char *

variable_types: struct stat { unsigned long st_dev; unsigned long st_ino; unsigned long st_nlink; unsigned int st_mode; unsigned int st_uid; unsigned int st_gid; int __pad0; unsigned long st_rdev; long st_size; long st_blksize; long st_blocks; struct timespec { long tv_sec; long tv_nsec; } st_atim; struct timespec st_mtim; struct timespec st_ctim; long __glibc_reserved[3]; } *

user_defined_types: struct stat { unsigned long st_dev; unsigned long st_ino; unsigned long st_nlink; unsigned int st_mode; unsigned int st_uid; unsigned int st_gid; int __pad0; unsigned long st_rdev; long st_size; long st_blksize; long st_blocks; struct timespec st_atim; struct timespec st_mtim; struct timespec st_ctim; long __glibc_reserved[3]; }


decompiled_code:
__int64 __fastcall stat64(__int64 a1, __int64 a2)
{
unsigned int v2; // ebx
const char *v3; // rdx

startup_check();
v2 = real_stat64(a1, a2);
v3 = "OK";
if ( v2 )
v3 = "!found";
log_other("stat", a1, v3);
return v2;
}

canonical_decompiled_code:
__int64 __fastcall func14(__int64 a1, __int64 a2)
{
unsigned int v2; // ebx
const char *v3; // rdx

func6();
v2 = real_stat64(a1, a2);
v3 = "OK";
if ( v2 )
v3 = "!found";
func8("stat", a1, v3);
return v2;
}

original_code:
int stat64(const char* path, struct stat64* buf)
{
    startup_check();
    int ret = real_stat64(path, buf);
    log_other("stat", path, ret == 0 ? "OK" : "!found");
    return ret;
}

canonical_original_code:
int stat64(char *path, struct stat64 *buf)
{
    startup_check();
    int ret = real_stat64(path, buf);
    log_other("stat", path, ret == 0 ? "OK" : "!found");
    return ret;
}

variable_types: struct stat64 { unsigned long st_dev; unsigned long st_ino; unsigned long st_nlink; unsigned int st_mode; unsigned int st_uid; unsigned int st_gid; int __pad0; unsigned long st_rdev; long st_size; long st_blksize; long st_blocks; struct timespec { long tv_sec; long tv_nsec; } st_atim; struct timespec st_mtim; struct timespec st_ctim; long __glibc_reserved[3]; } *

user_defined_types: struct stat64 { unsigned long st_dev; unsigned long st_ino; unsigned long st_nlink; unsigned int st_mode; unsigned int st_uid; unsigned int st_gid; int __pad0; unsigned long st_rdev; long st_size; long st_blksize; long st_blocks; struct timespec st_atim; struct timespec st_mtim; struct timespec st_ctim; long __glibc_reserved[3]; }


identifyInst

decompiled_code:
__int64 __fastcall identifyInst(char *s1)
{
const char *v1; // rbp
unsigned int i; // ebx

v1 = s2;
for ( i = 21; i != -1; --i )
{
if ( !strcmp(s1, v1) )
break;
v1 -= 20;
}
return i;
}

canonical_decompiled_code:
__int64 __fastcall func10(char *s1)
{
const char *v1; // rbp
unsigned int i; // ebx

v1 = s2;
for ( i = 21; i != -1; --i )
{
if ( !strcmp(s1, v1) )
break;
v1 -= 20;
}
return i;
}

original_code:
int identifyInst(char *inst){
    int i = 22 -1;
    while((i > -1) && (strcmp(inst, &instructions[i][0]) != 0)){
        i = i - 1;
    }
    return i;
}

variable_types:
inst
char *

variable_types: i int


isNoParamInst

decompiled_code:
__int64 __fastcall isNoParamInst(unsigned int a1)
{
char v1; // al

v1 = 1;
if ( a1 <= 0x15 )
v1 = ((0x260001uLL >> a1) ^ 1) & 1;
return (unsigned __int8)v1 ^ 1u;
}

canonical_decompiled_code:
__int64 __fastcall func11(unsigned int a1)
{
char v1; // al

v1 = 1;
if ( a1 <= 0x15 )
v1 = ((0x260001uLL >> a1) ^ 1) & 1;
return (unsigned __int8)v1 ^ 1u;
}


getNextNotTagString

decompiled_code:
_BOOL8 __fastcall getNextNotTagString(char *dest)
{
int v1; // edx
_BOOL8 result; // rax

v1 = getNextString(pIASFile, dest);
result = 0LL;
if ( !v1 )
result = *dest != 46;
return result;
}

canonical_decompiled_code:
_BOOL8 __fastcall func12(char *dest)
{
int v1; // edx
_BOOL8 result; // rax

v1 = func9(pIASFile, dest);
result = 0LL;
if ( !v1 )
result = *dest != 46;
return result;
}

original_code:
int getNextNotTagString(char *str){
    return (!getNextString(pIASFile,str) && str[0] != '.');
}

variable_types:
str
char *


getNextOp

decompiled_code:
_BOOL8 __fastcall getNextOp(char *a1)
{
return getNextNotTagString(a1);
}

canonical_decompiled_code:
_BOOL8 __fastcall func13(char *a1)
{
return func12(a1);
}

original_code:
int getNextOp(char *op){
    return getNextNotTagString(op);
}

variable_types:
op
char *


fprintfHexNumber

decompiled_code:
int __fastcall fprintfHexNumber(const char *a1)
{
__int64 v1; // rax
__int64 v2; // rdx

v1 = strtoll(a1, 0LL, 10);
v2 = v1;
if ( v1 < 0 )
v2 = -v1 | 0x8000000000LL;
return fprintf(pHexFile, "%010lx\n", v2);
}

canonical_decompiled_code:
int __fastcall func14(const char *a1)
{
__int64 v1; // rax
__int64 v2; // rdx

v1 = strtoll(a1, 0LL, 10);
v2 = v1;
if ( v1 < 0 )
v2 = -v1 | 0x8000000000LL;
return fprintf(pHexFile, "%010lx\n", v2);
}

original_code:
void fprintfHexNumber(char *text){
    int64_t hexWord = strtoll (text, ((void *)0), 10);
    int64_t x = 1;
    x = x << 39;
    if(hexWord<0){
        hexWord = hexWord * -1;
        hexWord = x | hexWord;
    }
    fprintf(pHexFile, "%010""l" "x""\n",hexWord);
}

canonical_original_code:
void fprintfHexNumber(char *text){
    long hexWord = strtoll (text, ((void *)0), 10);
    long x = 1;
    x = x << 39;
    if(hexWord<0){
        hexWord = hexWord * -1;
        hexWord = x | hexWord;
    }
    fprintf(pHexFile, "%010""l" "x""\n",hexWord);
}

variable_types:
text
char *

variable_types: hexWord long

variable_types: x long


fprintfHexWord

decompiled_code:
int __fastcall fprintfHexWord(__int64 a1)
{
return fprintf(pHexFile, "%010lx\n", a1);
}

canonical_decompiled_code:
int __fastcall func15(__int64 a1)
{
return fprintf(pHexFile, "%010lx\n", a1);
}

original_code:
void fprintfHexWord(int64_t hexWord){
    fprintf(pHexFile, "%010""l" "x""\n", hexWord);
}

canonical_original_code:
void fprintfHexWord(long hexWord){
    fprintf(pHexFile, "%010""l" "x""\n", hexWord);
}


fprintfHexChar

decompiled_code:
int __fastcall fprintfHexChar(char a1)
{
return fprintf(pHexFile, "%010x\n", (unsigned int)a1);
}

canonical_decompiled_code:
int __fastcall func16(char a1)
{
return fprintf(pHexFile, "%010x\n", (unsigned int)a1);
}

original_code:
void fprintfHexChar(char hexChar){
    fprintf(pHexFile, "%010x\n", hexChar);
}

variable_types: hexChar char


isChar

decompiled_code:
_BOOL8 __fastcall isChar(_BYTE *a1)
{
_BOOL8 result; // rax

result = 0LL;
if ( *a1 == 39 )
result = a1[2] == 39;
return result;
}

canonical_decompiled_code:
_BOOL8 __fastcall func17(_BYTE *a1)
{
_BOOL8 result; // rax

result = 0LL;
if ( *a1 == 39 )
result = a1[2] == 39;
return result;
}

original_code:
int isChar(char *data){
    return (data[0]== 39)&&(data[2]== 39);
}

variable_types:
data
char *


isString

decompiled_code:
_BOOL8 __fastcall isString(_BYTE *a1)
{
return *a1 == 34;
}

canonical_decompiled_code:
_BOOL8 __fastcall func18(_BYTE *a1)
{
return *a1 == 34;
}

original_code:
int isString(char *data){
    return (data[0] == 34);
}


fprintfHexString

decompiled_code:
int __fastcall fprintfHexString(const char *a1)
{
int result; // eax
char *v2; // rbx
__int64 v3; // rbp
char v4; // bl
char *v5; // rbx
__int64 v6; // rbp

result = strlen(a1);
if ( a1[result - 1] == 34 )
{
if ( result > 2 )
{
v5 = (char *)(a1 + 1);
v6 = (__int64)&a1[result - 3 + 2];
do
result = fprintfHexChar(*v5++);
while ( v5 != (char *)v6 );
}
}
else
{
if ( result > 1 )
{
v2 = (char *)(a1 + 1);
v3 = (__int64)&a1[result - 2 + 2];
do
fprintfHexChar(*v2++);
while ( v2 != (char *)v3 );
}
fprintfHexChar(32);
do
{
v4 = fgetc(pIASFile);
result = fprintfHexChar(v4);
}
while ( v4 != 34 && v4 != -1 );
}
return result;
}

canonical_decompiled_code:
int __fastcall func19(const char *a1)
{
int result; // eax
char *v2; // rbx
__int64 v3; // rbp
char v4; // bl
char *v5; // rbx
__int64 v6; // rbp

result = strlen(a1);
if ( a1[result - 1] == 34 )
{
if ( result > 2 )
{
v5 = (char *)(a1 + 1);
v6 = (__int64)&a1[result - 3 + 2];
do
result = func16(*v5++);
while ( v5 != (char *)v6 );
}
}
else
{
if ( result > 1 )
{
v2 = (char *)(a1 + 1);
v3 = (__int64)&a1[result - 2 + 2];
do
func16(*v2++);
while ( v2 != (char *)v3 );
}
func16(32);
do
{
v4 = fgetc(pIASFile);
result = func16(v4);
}
while ( v4 != 34 && v4 != -1 );
}
return result;
}

original_code:
void fprintfHexString(char * data){
    int i;
    int len = strlen(data);
    char c;
    if(data[len-1] == 34){
        len = len - 1;
        for(i = 1; i<len; i++){
            fprintfHexChar(data[i]);
        }
    }else{
        for(i = 1; i<len; i++){
            fprintfHexChar(data[i]);
        }
        fprintfHexChar(' ');
        do{
            c = fgetc(pIASFile);
            fprintfHexChar(c);
        }while((c!=34) && (c!=(-1)));
    }
}

canonical_original_code:
void fprintfHexString(char *data){
    int i;
    int len = strlen(data);
    char c;
    if(data[len-1] == 34){
        len = len - 1;
        for(i = 1; i<len; i++){
            fprintfHexChar(data[i]);
        }
    }else{
        for(i = 1; i<len; i++){
            fprintfHexChar(data[i]);
        }
        fprintfHexChar(' ');
        do{
            c = fgetc(pIASFile);
            fprintfHexChar(c);
        }while((c!=34) && (c!=(-1)));
    }
}

variable_types: len int

variable_types: c char


readData

decompiled_code:
char *__fastcall readData(char *dest)
{
char v2[72]; // [rsp+0h] [rbp-48h] BYREF

while ( getNextNotTagString(v2) )
{
if ( isChar(v2) )
{
fprintfHexChar(v2[1]);
}
else if ( isString(v2) )
{
fprintfHexString(v2);
}
else
{
fprintfHexNumber(v2);
}
}
*dest = 0;
return strcpy(dest, v2);
}

canonical_decompiled_code:
char *__fastcall func20(char *dest)
{
char v2[72]; // [rsp+0h] [rbp-48h] BYREF

while ( func12(v2) )
{
if ( func17(v2) )
{
func16(v2[1]);
}
else if ( func18(v2) )
{
func19(v2);
}
else
{
func14(v2);
}
}
*dest = 0;
return strcpy(dest, v2);
}

original_code:
void readData(char *next){
    char data[50];
    int out, len, i, is = 0;
    while(getNextNotTagString(&data[0])){
        if(isChar(&data[0])){
            fprintfHexChar(data[1]);
        }else if(isString(&data[0]) ){
            fprintfHexString(&data[0]);
        }else{
            fprintfHexNumber(&data[0]);
        }
    }
    next[0] = '\0';
    strcpy(next, data);
}

canonical_original_code:
void readData(char *next){
    char data[50];
    int out; int len; int i; int is = 0;
    while(getNextNotTagString(&data[0])){
        if(isChar(&data[0])){
            fprintfHexChar(data[1]);
        }else if(isString(&data[0]) ){
            fprintfHexString(&data[0]);
        }else{
            fprintfHexNumber(&data[0]);
        }
    }
    next[0] = '\0';
    strcpy(next, data);
}

variable_types:
next
char *

variable_types:
data
char [50]

variable_types: out int

variable_types: is int


buildInst

decompiled_code:
__int64 __fastcall buildInst(char *dest, _QWORD *a2, _QWORD *a3, char a4, char a5)
{
__int64 result; // rax

result = identifyInst(dest);
if ( (int)result >= 0 )
{
*a2 = opcodes[(int)result] << a4;
result = isNoParamInst(result);
if ( (_DWORD)result )
{
*a3 = 0LL;
}
else
{
getNextString(pIASFile, dest);
result = atoi(dest) << a5;
*a3 = (int)result;
}
}
return result;
}

canonical_decompiled_code:
__int64 __fastcall func21(char *dest, _QWORD *a2, _QWORD *a3, char a4, char a5)
{
__int64 result; // rax

result = func10(dest);
if ( (int)result >= 0 )
{
*a2 = opcodes[(int)result] << a4;
result = func11(result);
if ( (_DWORD)result )
{
*a3 = 0LL;
}
else
{
func9(pIASFile, dest);
result = atoi(dest) << a5;
*a3 = (int)result;
}
}
return result;
}

original_code:
void buildInst(char *str, int64_t *inst, int64_t *op, int si, int so){
    int i = identifyInst(str);
    if(i>-1){
        *inst = opcodes[i] << si;
        if(isNoParamInst(i)){
            *op = 0;
        }else{
            getNextString(pIASFile, str);
            *op = atoi(str) << so;
        }
    }
}

canonical_original_code:
void buildInst(char *str, long *inst, long *op, int si, int so){
    int i = identifyInst(str);
    if(i>-1){
        *inst = opcodes[i] << si;
        if(isNoParamInst(i)){
            *op = 0;
        }else{
            getNextString(pIASFile, str);
            *op = atoi(str) << so;
        }
    }
}

variable_types:
inst
long *

variable_types:
op
long *

variable_types: si int

variable_types: so int


buildLeftInst

decompiled_code:
__int64 __fastcall buildLeftInst(char *a1, _QWORD *a2, _QWORD *a3)
{
return buildInst(a1, a2, a3, 32, 20);
}

canonical_decompiled_code:
__int64 __fastcall func22(char *a1, _QWORD *a2, _QWORD *a3)
{
return func21(a1, a2, a3, 32, 20);
}

original_code:
void buildLeftInst(char *str, int64_t *inst, int64_t *op){
    buildInst(str, inst, op, 32, 20);
}

canonical_original_code:
void buildLeftInst(char *str, long *inst, long *op){
    buildInst(str, inst, op, 32, 20);
}

variable_types:
str
char *


buildRightInst

decompiled_code:
__int64 __fastcall buildRightInst(char *a1, _QWORD *a2, _QWORD *a3)
{
return buildInst(a1, a2, a3, 12, 0);
}

canonical_decompiled_code:
__int64 __fastcall func23(char *a1, _QWORD *a2, _QWORD *a3)
{
return func21(a1, a2, a3, 12, 0);
}

original_code:
void buildRightInst(char *str, int64_t *inst, int64_t *op){
    buildInst(str, inst, op, 12, 0);
}

canonical_original_code:
void buildRightInst(char *str, long *inst, long *op){
    buildInst(str, inst, op, 12, 0);
}


readText

decompiled_code:
char *__fastcall readText(char *dest)
{
char v2[64]; // [rsp+0h] [rbp-68h] BYREF
__int64 v3; // [rsp+40h] [rbp-28h] BYREF
__int64 v4; // [rsp+48h] [rbp-20h] BYREF
__int128 v5; // [rsp+50h] [rbp-18h] BYREF

while ( getNextOp(v2) )
{
buildLeftInst(v2, (_QWORD *)&v5 + 1, &v5);
if ( !getNextOp(v2) )
{
v4 = 0LL;
v3 = 0LL;
fprintfHexWord(*((_QWORD *)&v5 + 1) | v5);
break;
}
buildRightInst(v2, &v4, &v3);
fprintfHexWord(v3 | v4 | v5 | *((_QWORD *)&v5 + 1));
}
*dest = 0;
return strcpy(dest, v2);
}

original_code:
void readText(char *next){
    int i;
    int64_t instl, opl, instr, opr, word;
    char inst[50];
    word = 0;
    int flag = 1;
    while(flag && getNextOp(&inst[0])){
        buildLeftInst(&inst[0], &instl, &opl);
        if(getNextOp(&inst[0])){
            buildRightInst(&inst[0], &instr, &opr);
        }else{
            instr = 0;
            opr = 0;
            flag = 0;
        }
        word = instl | opl | instr| opr;
        fprintfHexWord(word);
    }
    next[0] = '\0';
    strcpy(next, inst);
}

canonical_original_code:
void readText(char *next){
    int i;
    long instl; long opl; long instr; long opr; long word;
    char inst[50];
    word = 0;
    int flag = 1;
    while(flag && getNextOp(&inst[0])){
        buildLeftInst(&inst[0], &instl, &opl);
        if(getNextOp(&inst[0])){
            buildRightInst(&inst[0], &instr, &opr);
        }else{
            instr = 0;
            opr = 0;
            flag = 0;
        }
        word = instl | opl | instr| opr;
        fprintfHexWord(word);
    }
    next[0] = '\0';
    strcpy(next, inst);
}

variable_types: i int

variable_types: instl long

variable_types: opl long

variable_types: instr long

variable_types: opr long

variable_types: word long

variable_types:
inst
char [50]

variable_types: flag int


readTags

decompiled_code:
__int64 __fastcall readTags(char *dest)
{
bool v1; // zf
unsigned int v2; // ebp

if ( strcmp(dest, ".text") )
return (unsigned int)-1;
readText(dest);
v1 = strcmp(dest, ".data") == 0;
v2 = !v1;
if ( !v1 )
return (unsigned int)-1;
readData(dest);
return v2;
}

canonical_decompiled_code:
__int64 __fastcall func25(char *dest)
{
bool v1; // zf
unsigned int v2; // ebp

if ( strcmp(dest, ".text") )
return (unsigned int)-1;
func24(dest);
v1 = strcmp(dest, ".data") == 0;
v2 = !v1;
if ( !v1 )
return (unsigned int)-1;
func20(dest);
return v2;
}

original_code:
int readTags(char * tag){
    if(!strcmp(tag, ".text") ){
        readText(tag);
    }else{
        return -1;
    }
    if(!strcmp(tag, ".data")){
        readData(tag);
    }else{
        return -1;
    }
    return 0;
}

canonical_original_code:
int readTags(char *tag){
    if(!strcmp(tag, ".text") ){
        readText(tag);
    }else{
        return -1;
    }
    if(!strcmp(tag, ".data")){
        readData(tag);
    }else{
        return -1;
    }
    return 0;
}

variable_types:
tag
char *


printfMsg

decompiled_code:
int __fastcall printfMsg(int a1)
{
int result; // eax

if ( a1 )
result = puts("err-msg: Can't read IAS file.");
else
result = puts("Hex File Successful Created!");
return result;
}

canonical_decompiled_code:
int __fastcall func26(int a1)
{
int result; // eax

if ( a1 )
result = puts("err-msg: Can't read IAS file.");
else
result = puts("Hex File Successful Created!");
return result;
}

original_code:
void printfMsg(int msg){
    if(msg == 0){
        printf("Hex File Successful Created!\n");
    }else{
        printf("err-msg: Can't read IAS file.\n");
    }
}

variable_types: msg int


buildHexFile

decompiled_code:
int __fastcall buildHexFile(char *filename)
{
int v1; // ebp
char v3[88]; // [rsp+0h] [rbp-58h] BYREF

pHexFile = fopen(filename, "w");
if ( !(unsigned int)getNextString(pIASFile, v3) )
v1 = readTags(v3);
pclose(pHexFile);
if ( v1 < 0 )
remove(filename);
return printfMsg(v1);
}

canonical_decompiled_code:
int __fastcall func27(char *filename)
{
int v1; // ebp
char v3[88]; // [rsp+0h] [rbp-58h] BYREF

pHexFile = fopen(filename, "w");
if ( !(unsigned int)func9(pIASFile, v3) )
v1 = func25(v3);
pclose(pHexFile);
if ( v1 < 0 )
remove(filename);
return func26(v1);
}

original_code:
void buildHexFile(char *nameHexFile){
    char tag[50];
    int msg;
    pHexFile = fopen(nameHexFile, "w");
    if(!getNextString(pIASFile,&tag[0])){
        msg = readTags(&tag[0]);
    }
    pclose(pHexFile);
    if(msg < 0){
        remove(nameHexFile);
    }
    printfMsg(msg);
}

variable_types:
nameHexFile
char *

variable_types:
tag
char [50]