urosUserUnpublishTopics

decompiled_code:
__int64 urosUserUnpublishTopics()
{
urosHandlersUnpublishTopics();
return 0LL;
}

canonical_decompiled_code:
__int64 func9()
{
urosHandlersUnpublishTopics();
return 0LL;
}

original_code:
uros_err_t urosUserUnpublishTopics(void) {
  urosHandlersUnpublishTopics();
  return UROS_OK;
}

canonical_original_code:
int urosUserUnpublishTopics() {
  urosHandlersUnpublishTopics();
  return UROS_OK;
}


urosUserSubscribeTopics

repo: openrobots-dev/uROSnode

decompiled_code:
__int64 urosUserSubscribeTopics()
{
urosHandlersSubscribeTopics();
return 0LL;
}

canonical_decompiled_code:
__int64 func10()
{
urosHandlersSubscribeTopics();
return 0LL;
}

original_code:
uros_err_t urosUserSubscribeTopics(void) {
  urosHandlersSubscribeTopics();
  return UROS_OK;
}

canonical_original_code:
int urosUserSubscribeTopics() {
  urosHandlersSubscribeTopics();
  return UROS_OK;
}

return_type: int


urosUserUnsubscribeTopics

decompiled_code:
__int64 urosUserUnsubscribeTopics()
{
urosHandlersUnsubscribeTopics();
return 0LL;
}

canonical_decompiled_code:
__int64 func11()
{
urosHandlersUnsubscribeTopics();
return 0LL;
}

original_code:
uros_err_t urosUserUnsubscribeTopics(void) {
  urosHandlersUnsubscribeTopics();
  return UROS_OK;
}

canonical_original_code:
int urosUserUnsubscribeTopics() {
  urosHandlersUnsubscribeTopics();
  return UROS_OK;
}


urosUserPublishServices

decompiled_code:
__int64 urosUserPublishServices()
{
urosHandlersPublishServices();
return 0LL;
}

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

original_code:
uros_err_t urosUserPublishServices(void) {
  urosHandlersPublishServices();
  return UROS_OK;
}

canonical_original_code:
int urosUserPublishServices() {
  urosHandlersPublishServices();
  return UROS_OK;
}


urosUserUnpublishServices

decompiled_code:
__int64 urosUserUnpublishServices()
{
urosHandlersUnpublishServices();
return 0LL;
}

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

original_code:
uros_err_t urosUserUnpublishServices(void) {
  urosHandlersUnpublishServices();
  return UROS_OK;
}

canonical_original_code:
int urosUserUnpublishServices() {
  urosHandlersUnpublishServices();
  return UROS_OK;
}


urosSemObjectInit

decompiled_code:
// attributes: thunk
__int64 urosSemObjectInit()
{
return uros_lld_sem_objectinit();
}

canonical_decompiled_code:
__int64 func0()
{
return uros_lld_sem_objectinit();
}

original_code:
void urosSemObjectInit(UrosSem *semp, uros_cnt_t n) {
  uros_lld_sem_objectinit(semp, n);
}

canonical_original_code:
void urosSemObjectInit(struct UrosSem *semp, unsigned int n) {
  uros_lld_sem_objectinit(semp, n);
}

variable_types: struct UrosSem { unsigned int counter; union pthread_mutex_t { struct __pthread_mutex_s { int __lock; unsigned int __count; int __owner; unsigned int __nusers; int __kind; short __spins; short __elision; struct __pthread_internal_list { struct __pthread_internal_list *__prev; struct __pthread_internal_list *__next; } __list; } __data; char __size[40]; long __align; } mutex; union pthread_cond_t { struct __pthread_cond_s { union { unsigned long long __wseq; struct { unsigned int __low; unsigned int __high; } __wseq32; }; union { unsigned long long __g1_start; struct { unsigned int __low; unsigned int __high; } __g1_start32; }; unsigned int __g_refs[2]; unsigned int __g_size[2]; unsigned int __g1_orig_size; unsigned int __wrefs; unsigned int __g_signals[2]; } __data; char __size[48]; long long __align; } cond; } *

variable_types:
n
unsigned int

return_type: void

user_defined_types: struct UrosSem { unsigned int counter; union pthread_mutex_t mutex; union pthread_cond_t cond; }

user_defined_types: union pthread_mutex_t { struct __pthread_mutex_s __data; char __size[40]; long __align; }

user_defined_types: union pthread_cond_t { struct __pthread_cond_s __data; char __size[48]; long long __align; }

user_defined_types: struct __pthread_mutex_s { int __lock; unsigned int __count; int __owner; unsigned int __nusers; int __kind; short __spins; short __elision; struct __pthread_internal_list __list; }


urosSemClean

decompiled_code:
// attributes: thunk
__int64 urosSemClean()
{
return uros_lld_sem_clean();
}

canonical_decompiled_code:
__int64 func1()
{
return uros_lld_sem_clean();
}

original_code:
void urosSemClean(UrosSem *semp) {
  uros_lld_sem_clean(semp);
}

canonical_original_code:
void urosSemClean(struct UrosSem *semp) {
  uros_lld_sem_clean(semp);
}

user_defined_types: struct __pthread_cond_s { union { unsigned long long __wseq; struct { unsigned int __low; unsigned int __high; } __wseq32; }; union { unsigned long long __g1_start; struct { unsigned int __low; unsigned int __high; } __g1_start32; }; unsigned int __g_refs[2]; unsigned int __g_size[2]; unsigned int __g1_orig_size; unsigned int __wrefs; unsigned int __g_signals[2]; }

user_defined_types: struct __pthread_internal_list { struct __pthread_internal_list *__prev; struct __pthread_internal_list *__next; }


urosSemWait

decompiled_code:
// attributes: thunk
__int64 urosSemWait()
{
return uros_lld_sem_wait();
}

canonical_decompiled_code:
__int64 func2()
{
return uros_lld_sem_wait();
}

original_code:
void urosSemWait(UrosSem *semp) {
  uros_lld_sem_wait(semp);
}

canonical_original_code:
void urosSemWait(struct UrosSem *semp) {
  uros_lld_sem_wait(semp);
}


urosSemSignal

decompiled_code:
// attributes: thunk
__int64 urosSemSignal()
{
return uros_lld_sem_signal();
}

canonical_decompiled_code:
__int64 func3()
{
return uros_lld_sem_signal();
}

original_code:
void urosSemSignal(UrosSem *semp) {
  uros_lld_sem_signal(semp);
}

canonical_original_code:
void urosSemSignal(struct UrosSem *semp) {
  uros_lld_sem_signal(semp);
}


urosSemValue

decompiled_code:
// attributes: thunk
__int64 urosSemValue()
{
return uros_lld_sem_value();
}

canonical_decompiled_code:
__int64 func4()
{
return uros_lld_sem_value();
}

original_code:
uros_cnt_t urosSemValue(UrosSem *semp) {
  return uros_lld_sem_value(semp);
}

canonical_original_code:
unsigned int urosSemValue(struct UrosSem *semp) {
  return uros_lld_sem_value(semp);
}

return_type: unsigned int


urosMutexObjectInit

decompiled_code:
// attributes: thunk
__int64 urosMutexObjectInit()
{
return uros_lld_mutex_objectinit();
}

canonical_decompiled_code:
__int64 func5()
{
return uros_lld_mutex_objectinit();
}

original_code:
void urosMutexObjectInit(UrosMutex *mtxp) {
  uros_lld_mutex_objectinit(mtxp);
}

canonical_original_code:
void urosMutexObjectInit(union pthread_mutex_t *mtxp) {
  uros_lld_mutex_objectinit(mtxp);
}

variable_types: union pthread_mutex_t { struct __pthread_mutex_s { int __lock; unsigned int __count; int __owner; unsigned int __nusers; int __kind; short __spins; short __elision; struct __pthread_internal_list { struct __pthread_internal_list *__prev; struct __pthread_internal_list *__next; } __list; } __data; char __size[40]; long __align; } *


urosMutexClean

decompiled_code:
// attributes: thunk
__int64 urosMutexClean()
{
return uros_lld_mutex_clean();
}

canonical_decompiled_code:
__int64 func6()
{
return uros_lld_mutex_clean();
}

original_code:
void urosMutexClean(UrosMutex *mtxp) {
  uros_lld_mutex_clean(mtxp);
}

canonical_original_code:
void urosMutexClean(union pthread_mutex_t *mtxp) {
  uros_lld_mutex_clean(mtxp);
}


urosMutexLock

decompiled_code:
// attributes: thunk
__int64 urosMutexLock()
{
return uros_lld_mutex_lock();
}

canonical_decompiled_code:
__int64 func7()
{
return uros_lld_mutex_lock();
}

original_code:
void urosMutexLock(UrosMutex *mtxp) {
  uros_lld_mutex_lock(mtxp);
}

canonical_original_code:
void urosMutexLock(union pthread_mutex_t *mtxp) {
  uros_lld_mutex_lock(mtxp);
}


urosMutexUnlock

decompiled_code:
// attributes: thunk
__int64 urosMutexUnlock()
{
return uros_lld_mutex_unlock();
}

canonical_decompiled_code:
__int64 func8()
{
return uros_lld_mutex_unlock();
}

original_code:
void urosMutexUnlock(UrosMutex *mtxp) {
  uros_lld_mutex_unlock(mtxp);
}

canonical_original_code:
void urosMutexUnlock(union pthread_mutex_t *mtxp) {
  uros_lld_mutex_unlock(mtxp);
}


urosCondVarObjectInit

decompiled_code:
// attributes: thunk
__int64 urosCondVarObjectInit()
{
return uros_lld_condvar_objectinit();
}

canonical_decompiled_code:
__int64 func9()
{
return uros_lld_condvar_objectinit();
}

original_code:
void urosCondVarObjectInit(UrosCondVar *cvp) {
  uros_lld_condvar_objectinit(cvp);
}

canonical_original_code:
void urosCondVarObjectInit(union pthread_cond_t *cvp) {
  uros_lld_condvar_objectinit(cvp);
}

variable_types: union pthread_cond_t { struct __pthread_cond_s { union { unsigned long long __wseq; struct { unsigned int __low; unsigned int __high; } __wseq32; }; union { unsigned long long __g1_start; struct { unsigned int __low; unsigned int __high; } __g1_start32; }; unsigned int __g_refs[2]; unsigned int __g_size[2]; unsigned int __g1_orig_size; unsigned int __wrefs; unsigned int __g_signals[2]; } __data; char __size[48]; long long __align; } *


urosCondVarClean

decompiled_code:
// attributes: thunk
__int64 urosCondVarClean()
{
return uros_lld_condvar_clean();
}

canonical_decompiled_code:
__int64 func10()
{
return uros_lld_condvar_clean();
}

original_code:
void urosCondVarClean(UrosCondVar *cvp) {
  uros_lld_condvar_clean(cvp);
}

canonical_original_code:
void urosCondVarClean(union pthread_cond_t *cvp) {
  uros_lld_condvar_clean(cvp);
}


urosCondVarWait

decompiled_code:
// attributes: thunk
__int64 urosCondVarWait()
{
return uros_lld_condvar_wait();
}

canonical_decompiled_code:
__int64 func11()
{
return uros_lld_condvar_wait();
}

original_code:
void urosCondVarWait(UrosCondVar *cvp, UrosMutex *mtxp) {
  uros_lld_condvar_wait(cvp, mtxp);
}

canonical_original_code:
void urosCondVarWait(union pthread_cond_t *cvp, union pthread_mutex_t *mtxp) {
  uros_lld_condvar_wait(cvp, mtxp);
}


urosCondVarSignal

decompiled_code:
// attributes: thunk
__int64 urosCondVarSignal()
{
return uros_lld_condvar_signal();
}

canonical_decompiled_code:
__int64 func12()
{
return uros_lld_condvar_signal();
}

original_code:
void urosCondVarSignal(UrosCondVar *cvp) {
  uros_lld_condvar_signal(cvp);
}

canonical_original_code:
void urosCondVarSignal(union pthread_cond_t *cvp) {
  uros_lld_condvar_signal(cvp);
}


urosCondVarBroadcast

decompiled_code:
// attributes: thunk
__int64 urosCondVarBroadcast()
{
return uros_lld_condvar_broadcast();
}

canonical_decompiled_code:
__int64 func14()
{
return uros_lld_condvar_broadcast();
}

original_code:
void urosCondVarBroadcast(UrosCondVar *cvp) {
  uros_lld_condvar_broadcast(cvp);
}

canonical_original_code:
void urosCondVarBroadcast(union pthread_cond_t *cvp) {
  uros_lld_condvar_broadcast(cvp);
}


urosThreadSelf

decompiled_code:
// attributes: thunk
__int64 urosThreadSelf()
{
return uros_lld_thread_self();
}

canonical_decompiled_code:
__int64 func18()
{
return uros_lld_thread_self();
}

original_code:
UrosThreadId urosThreadSelf(void) {
  return uros_lld_thread_self();
}

canonical_original_code:
unsigned long urosThreadSelf() {
  return uros_lld_thread_self();
}

return_type: unsigned long


urosThreadGetName

decompiled_code:
// attributes: thunk
__int64 urosThreadGetName()
{
return uros_lld_thread_getname();
}

canonical_decompiled_code:
__int64 func19()
{
return uros_lld_thread_getname();
}

original_code:
const char *urosThreadGetName(UrosThreadId id) {
  return uros_lld_thread_getname(id);
}

canonical_original_code:
char *urosThreadGetName(unsigned long id) {
  return uros_lld_thread_getname(id);
}

variable_types:
id
unsigned long

return_type: char *


urosThreadCreateStatic

decompiled_code:
__int64 __fastcall urosThreadCreateStatic(__int64 a1)
{
unsigned int v1; // eax
unsigned int v3; // ebp
const char *v4; // rax

v1 = uros_lld_thread_createstatic(a1);
if ( v1 )
{
v3 = v1;
printf(
"Error at %s:%d\n function: %s\n reason: %s\n message: ",
"../../src/urosThreading.c",
660LL,
"urosThreadCreateStatic",
"err != UROS_OK");
v4 = (const char *)urosErrorText(v3);
printf("Error %s while creating a new static thread\n", v4);
}
return 0LL;
}

canonical_decompiled_code:
__int64 __fastcall func20(__int64 a1)
{
unsigned int v1; // eax
unsigned int v3; // ebp
const char *v4; // rax

v1 = uros_lld_thread_createstatic(a1);
if ( v1 )
{
v3 = v1;
printf(
"Error at %s:%d\n function: %s\n reason: %s\n message: ",
"../../src/urosThreading.c",
660LL,
"urosThreadCreateStatic",
"err != UROS_OK");
v4 = (const char *)urosErrorText(v3);
printf("Error %s while creating a new static thread\n", v4);
}
return 0LL;
}

original_code:
uros_err_t urosThreadCreateStatic(UrosThreadId *idp, const char *namep,
                                  uros_prio_t priority,
                                  uros_proc_f routine, void *argp,
                                  void *stackp, size_t stacksize) {
  uros_err_t err;
  err = uros_lld_thread_createstatic(idp, namep, priority,
                                     routine, argp,
                                     stackp, stacksize);
  { if (err != UROS_OK) { printf("Error at %s:%d\n" "  function: %s\n" "  reason:   %s\n" "  message:  ", "../../src/urosThreading.c", 660, __PRETTY_FUNCTION__, "err != UROS_OK"); printf ("Error %s while creating a new static thread\n", urosErrorText(err)) ; { (void)(0); } } };
  return UROS_OK;
}

canonical_original_code:
int urosThreadCreateStatic(unsigned long *idp, char *namep, int priority, int (*routine)(void *data), void *argp, void *stackp, unsigned long stacksize) {
  int err;
  err = uros_lld_thread_createstatic(idp, namep, priority,
                                     routine, argp,
                                     stackp, stacksize);
  { if (err != UROS_OK) { printf("Error at %s:%d\n" "  function: %s\n" "  reason:   %s\n" "  message:  ", "../../src/urosThreading.c", 660, __PRETTY_FUNCTION__, "err != UROS_OK"); printf ("Error %s while creating a new static thread\n", urosErrorText(err)) ; { (void)(0); } } };
  return UROS_OK;
}

variable_types:
idp
unsigned long *

variable_types:
namep
char *

variable_types: priority int

variable_types:
routine
int (*)(void *data)

variable_types:
argp
void *

variable_types:
stackp
void *

variable_types:
stacksize
unsigned long

variable_types: err int


urosThreadCreateFromMemPool

decompiled_code:
__int64 urosThreadCreateFromMemPool()
{
unsigned int v0; // eax
unsigned int v2; // ebp
const char *v3; // rax

v0 = uros_lld_thread_createfrommempool();
if ( v0 )
{
v2 = v0;
printf(
"Error at %s:%d\n function: %s\n reason: %s\n message: ",
"../../src/urosThreading.c",
701LL,
"urosThreadCreateFromMemPool",
"err != UROS_OK");
v3 = (const char *)urosErrorText(v2);
printf("Error %s while creating a new static thread\n", v3);
}
return 0LL;
}

canonical_decompiled_code:
__int64 func21()
{
unsigned int v0; // eax
unsigned int v2; // ebp
const char *v3; // rax

v0 = uros_lld_thread_createfrommempool();
if ( v0 )
{
v2 = v0;
printf(
"Error at %s:%d\n function: %s\n reason: %s\n message: ",
"../../src/urosThreading.c",
701LL,
"urosThreadCreateFromMemPool",
"err != UROS_OK");
v3 = (const char *)urosErrorText(v2);
printf("Error %s while creating a new static thread\n", v3);
}
return 0LL;
}

original_code:
uros_err_t urosThreadCreateFromMemPool(UrosThreadId *idp, const char *namep,
                                       uros_prio_t priority,
                                       uros_proc_f routine, void *argp,
                                       UrosMemPool *mempoolp) {
  uros_err_t err;
  err = uros_lld_thread_createfrommempool(idp, namep, priority,
                                           routine, argp,
                                           mempoolp);
  { if (err != UROS_OK) { printf("Error at %s:%d\n" "  function: %s\n" "  reason:   %s\n" "  message:  ", "../../src/urosThreading.c", 701, __PRETTY_FUNCTION__, "err != UROS_OK"); printf ("Error %s while creating a new static thread\n", urosErrorText(err)) ; { (void)(0); } } };
  return UROS_OK;
}

canonical_original_code:
int urosThreadCreateFromMemPool(unsigned long *idp, char *namep, int priority, int (*routine)(void *data), void *argp, struct UrosMemPool *mempoolp) {
  int err;
  err = uros_lld_thread_createfrommempool(idp, namep, priority,
                                           routine, argp,
                                           mempoolp);
  { if (err != UROS_OK) { printf("Error at %s:%d\n" "  function: %s\n" "  reason:   %s\n" "  message:  ", "../../src/urosThreading.c", 701, __PRETTY_FUNCTION__, "err != UROS_OK"); printf ("Error %s while creating a new static thread\n", urosErrorText(err)) ; { (void)(0); } } };
  return UROS_OK;
}

variable_types: struct UrosMemPool { void *headp; unsigned long blockSize; void *(*allocator)(unsigned long size); unsigned int free; union pthread_mutex_t { struct __pthread_mutex_s { int __lock; unsigned int __count; int __owner; unsigned int __nusers; int __kind; short __spins; short __elision; struct __pthread_internal_list { struct __pthread_internal_list *__prev; struct __pthread_internal_list *__next; } __list; } __data; char __size[40]; long __align; } lock; } *

user_defined_types: struct UrosMemPool { void *headp; unsigned long blockSize; void *(*allocator)(unsigned long size); unsigned int free; union pthread_mutex_t lock; }


urosThreadCreateFromHeap

decompiled_code:
__int64 urosThreadCreateFromHeap()
{
unsigned int v0; // eax
unsigned int v2; // ebp
const char *v3; // rax

v0 = uros_lld_thread_createfromheap();
if ( v0 )
{
v2 = v0;
printf(
"Error at %s:%d\n function: %s\n reason: %s\n message: ",
"../../src/urosThreading.c",
738LL,
"urosThreadCreateFromHeap",
"err != UROS_OK");
v3 = (const char *)urosErrorText(v2);
printf("Error %s while creating a new thread from the heap\n", v3);
}
return 0LL;
}

canonical_decompiled_code:
__int64 func23()
{
unsigned int v0; // eax
unsigned int v2; // ebp
const char *v3; // rax

v0 = uros_lld_thread_createfromheap();
if ( v0 )
{
v2 = v0;
printf(
"Error at %s:%d\n function: %s\n reason: %s\n message: ",
"../../src/urosThreading.c",
738LL,
"urosThreadCreateFromHeap",
"err != UROS_OK");
v3 = (const char *)urosErrorText(v2);
printf("Error %s while creating a new thread from the heap\n", v3);
}
return 0LL;
}

original_code:
uros_err_t urosThreadCreateFromHeap(UrosThreadId *idp, const char *namep,
                                    uros_prio_t priority,
                                    uros_proc_f routine, void *argp,
                                    size_t stacksize) {
  uros_err_t err;
  err = uros_lld_thread_createfromheap(idp, namep, priority,
                                        routine, argp,
                                        stacksize);
  { if (err != UROS_OK) { printf("Error at %s:%d\n" "  function: %s\n" "  reason:   %s\n" "  message:  ", "../../src/urosThreading.c", 738, __PRETTY_FUNCTION__, "err != UROS_OK"); printf ("Error %s while creating a new thread from the heap\n", urosErrorText(err)) ; { (void)(0); } } };
  return UROS_OK;
}

canonical_original_code:
int urosThreadCreateFromHeap(unsigned long *idp, char *namep, int priority, int (*routine)(void *data), void *argp, unsigned long stacksize) {
  int err;
  err = uros_lld_thread_createfromheap(idp, namep, priority,
                                        routine, argp,
                                        stacksize);
  { if (err != UROS_OK) { printf("Error at %s:%d\n" "  function: %s\n" "  reason:   %s\n" "  message:  ", "../../src/urosThreading.c", 738, __PRETTY_FUNCTION__, "err != UROS_OK"); printf ("Error %s while creating a new thread from the heap\n", urosErrorText(err)) ; { (void)(0); } } };
  return UROS_OK;
}


urosThreadJoin

decompiled_code:
__int64 __fastcall urosThreadJoin(unsigned int a1)
{
unsigned int v1; // eax
unsigned int v3; // ebp
const char *v4; // rax

v1 = uros_lld_thread_join();
if ( v1 )
{
v3 = v1;
printf(
"Error at %s:%d\n function: %s\n reason: %s\n message: ",
"../../src/urosThreading.c",
762LL,
"urosThreadJoin",
"err != UROS_OK");
v4 = (const char *)urosErrorText(v3);
printf("Error %s while joining the thread %u\n", v4, a1);
}
return 0LL;
}

canonical_decompiled_code:
__int64 __fastcall func24(unsigned int a1)
{
unsigned int v1; // eax
unsigned int v3; // ebp
const char *v4; // rax

v1 = uros_lld_thread_join();
if ( v1 )
{
v3 = v1;
printf(
"Error at %s:%d\n function: %s\n reason: %s\n message: ",
"../../src/urosThreading.c",
762LL,
"urosThreadJoin",
"err != UROS_OK");
v4 = (const char *)urosErrorText(v3);
printf("Error %s while joining the thread %u\n", v4, a1);
}
return 0LL;
}

original_code:
uros_err_t urosThreadJoin(UrosThreadId id) {
  uros_err_t err;
  err = uros_lld_thread_join(id);
  { if (err != UROS_OK) { printf("Error at %s:%d\n" "  function: %s\n" "  reason:   %s\n" "  message:  ", "../../src/urosThreading.c", 762, __PRETTY_FUNCTION__, "err != UROS_OK"); printf ("Error %s while joining the thread %u\n", urosErrorText(err), (unsigned)id) ; { (void)(0); } } };
  return UROS_OK;
}

canonical_original_code:
int urosThreadJoin(unsigned long id) {
  int err;
  err = uros_lld_thread_join(id);
  { if (err != UROS_OK) { printf("Error at %s:%d\n" "  function: %s\n" "  reason:   %s\n" "  message:  ", "../../src/urosThreading.c", 762, __PRETTY_FUNCTION__, "err != UROS_OK"); printf ("Error %s while joining the thread %u\n", urosErrorText(err), (unsigned int)id) ; { (void)(0); } } };
  return UROS_OK;
}


urosThreadSleepSec

decompiled_code:
// attributes: thunk
__int64 urosThreadSleepSec()
{
return uros_lld_thread_sleepsec();
}

canonical_decompiled_code:
__int64 func26()
{
return uros_lld_thread_sleepsec();
}

original_code:
void urosThreadSleepSec(uint32_t sec) {
  uros_lld_thread_sleepsec(sec);
}

canonical_original_code:
void urosThreadSleepSec(unsigned int sec) {
  uros_lld_thread_sleepsec(sec);
}

variable_types:
sec
unsigned int


urosThreadSleepMsec

decompiled_code:
// attributes: thunk
__int64 urosThreadSleepMsec()
{
return uros_lld_thread_sleepmsec();
}

canonical_decompiled_code:
__int64 func27()
{
return uros_lld_thread_sleepmsec();
}

original_code:
void urosThreadSleepMsec(uint32_t msec) {
  uros_lld_thread_sleepmsec(msec);
}

canonical_original_code:
void urosThreadSleepMsec(unsigned int msec) {
  uros_lld_thread_sleepmsec(msec);
}

variable_types:
msec
unsigned int


urosThreadSleepUsec

decompiled_code:
// attributes: thunk
__int64 urosThreadSleepUsec()
{
return uros_lld_thread_sleepusec();
}

canonical_decompiled_code:
__int64 func28()
{
return uros_lld_thread_sleepusec();
}

original_code:
void urosThreadSleepUsec(uint32_t usec) {
  uros_lld_thread_sleepusec(usec);
}

canonical_original_code:
void urosThreadSleepUsec(unsigned int usec) {
  uros_lld_thread_sleepusec(usec);
}

variable_types:
usec
unsigned int


urosGetTimestampMsec

decompiled_code:
// attributes: thunk
__int64 urosGetTimestampMsec()
{
return uros_lld_threading_gettimestampmsec();
}

canonical_decompiled_code:
__int64 func29()
{
return uros_lld_threading_gettimestampmsec();
}

original_code:
uint32_t urosGetTimestampMsec(void) {
  return uros_lld_threading_gettimestampmsec();
}

canonical_original_code:
unsigned int urosGetTimestampMsec() {
  return uros_lld_threading_gettimestampmsec();
}


decompiled_code:
__int64 __fastcall length_msg__std_msgs__String(_QWORD *a1)
{
return *a1 + 4LL;
}

canonical_decompiled_code:
__int64 __fastcall func0(_QWORD *a1)
{
return *a1 + 4LL;
}

original_code:
size_t length_msg__std_msgs__String(
  struct msg__std_msgs__String *objp
) {
  size_t length = 0;
  (void)(0);
  length += sizeof(uint32_t) + objp->data.length;
  return length;
}

canonical_original_code:
unsigned long length_msg__std_msgs__String(struct msg__std_msgs__String *objp) {
  unsigned long length = 0;
  (void)(0);
  length += sizeof(unsigned int) + objp->data.length;
  return length;
}

variable_types: struct msg__std_msgs__String { struct UrosString { unsigned long length; char *datap; } data; } *

variable_types:
length
unsigned long

user_defined_types: struct msg__std_msgs__String { struct UrosString data; }


decompiled_code:
// attributes: thunk
__int64 init_msg__std_msgs__String()
{
return urosStringObjectInit();
}

canonical_decompiled_code:
__int64 func1()
{
return urosStringObjectInit();
}

original_code:
void init_msg__std_msgs__String(
  struct msg__std_msgs__String *objp
) {
  (void)(0);
  urosStringObjectInit(&objp->data);
}

canonical_original_code:
void init_msg__std_msgs__String(struct msg__std_msgs__String *objp) {
  (void)(0);
  urosStringObjectInit(&objp->data);
}

user_defined_types: struct UrosString { unsigned long length; char *datap; }


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

if ( a1 )
result = urosStringClean();
return result;
}

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

if ( a1 )
result = urosStringClean();
return result;
}

original_code:
void clean_msg__std_msgs__String(
  struct msg__std_msgs__String *objp
) {
  if (objp == ((void *)0)) { return; }
  urosStringClean(&objp->data);
}

canonical_original_code:
void clean_msg__std_msgs__String(struct msg__std_msgs__String *objp) {
  if (objp == ((void *)0)) { return; }
  urosStringClean(&objp->data);
}


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

urosTcpRosRecvString();
result = *a1;
if ( (_DWORD)result )
{
clean_msg__std_msgs__String(a2);
result = *a1;
}
return result;
}

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

urosTcpRosRecvString();
result = *a1;
if ( (_DWORD)result )
{
func2(a2);
result = *a1;
}
return result;
}

original_code:
uros_err_t recv_msg__std_msgs__String(
  UrosTcpRosStatus *tcpstp,
  struct msg__std_msgs__String *objp
) {
  (void)(0);
  (void)(0);
  (void)(0);
  urosTcpRosRecvString(tcpstp, &objp->data); { if (tcpstp->err != UROS_OK) { goto _error; } }
  return tcpstp->err = UROS_OK;
_error:
  clean_msg__std_msgs__String(objp);
  return tcpstp->err;
}

canonical_original_code:
int recv_msg__std_msgs__String(struct UrosTcpRosStatus *tcpstp, struct msg__std_msgs__String *objp) {
  (void)(0);
  (void)(0);
  (void)(0);
  urosTcpRosRecvString(tcpstp, &objp->data); { if (tcpstp->err != UROS_OK) { goto _error; } }
  return tcpstp->err = UROS_OK;
_error:
  clean_msg__std_msgs__String(objp);
  return tcpstp->err;
}

variable_types: struct UrosTcpRosStatus { int err; struct UrosConn { struct UrosAddr { union UrosIp { unsigned int dword; struct { unsigned char field4; unsigned char field3; unsigned char field2; unsigned char field1; } fields; unsigned char bytes[4]; } ip; unsigned short port; } locaddr; struct UrosAddr remaddr; enum uros_connproto_t { UROS_PROTO_TCP=0, UROS_PROTO_UDP=1, UROS_PROTO__LENGTH=2 } protocol; unsigned long recvlen; unsigned long sentlen; int socket; unsigned int recvtimeout; unsigned int sendtimeout; void *recvbufp; unsigned long recvbuflen; } *csp; struct UrosString { unsigned long length; char *datap; } callerId; struct UrosTopic { struct UrosString name; struct UrosMsgType { struct UrosString name; struct UrosString desc; struct UrosString md5str; } *typep; int (*procf)(void *data); struct uros_topicflags_t { unsigned int service; unsigned int probe; unsigned int persistent; unsigned int latching; unsigned int noDelay; unsigned int deleted; } flags; unsigned int refcnt; } *topicp; struct uros_topicflags_t remoteFlags; unsigned char threadExit; union pthread_mutex_t { struct __pthread_mutex_s { int __lock; unsigned int __count; int __owner; unsigned int __nusers; int __kind; short __spins; short __elision; struct __pthread_internal_list { struct __pthread_internal_list *__prev; struct __pthread_internal_list *__next; } __list; } __data; char __size[40]; long __align; } threadExitMtx; struct UrosString errstr; } *

variable_types: struct msg__std_msgs__String { struct UrosString data; } *

user_defined_types: struct UrosTcpRosStatus { int err; struct UrosConn *csp; struct UrosString callerId; struct UrosTopic *topicp; struct uros_topicflags_t remoteFlags; unsigned char threadExit; union pthread_mutex_t threadExitMtx; struct UrosString errstr; }

user_defined_types: struct UrosConn { struct UrosAddr locaddr; struct UrosAddr remaddr; enum uros_connproto_t protocol; unsigned long recvlen; unsigned long sentlen; int socket; unsigned int recvtimeout; unsigned int sendtimeout; void *recvbufp; unsigned long recvbuflen; }

user_defined_types: struct UrosTopic { struct UrosString name; struct UrosMsgType *typep; int (*procf)(void *data); struct uros_topicflags_t flags; unsigned int refcnt; }

user_defined_types: struct UrosAddr { union UrosIp ip; unsigned short port; }


decompiled_code:
__int64 __fastcall send_msg__std_msgs__String(unsigned int *a1)
{
urosTcpRosSendString();
return *a1;
}

canonical_decompiled_code:
__int64 __fastcall func4(unsigned int *a1)
{
urosTcpRosSendString();
return *a1;
}

original_code:
uros_err_t send_msg__std_msgs__String(
  UrosTcpRosStatus *tcpstp,
  struct msg__std_msgs__String *objp
) {
  (void)(0);
  (void)(0);
  (void)(0);
  urosTcpRosSendString(tcpstp, &objp->data); { if (tcpstp->err != UROS_OK) { return tcpstp->err; } }
  return tcpstp->err = UROS_OK;
}

canonical_original_code:
int send_msg__std_msgs__String(struct UrosTcpRosStatus *tcpstp, struct msg__std_msgs__String *objp) {
  (void)(0);
  (void)(0);
  (void)(0);
  urosTcpRosSendString(tcpstp, &objp->data); { if (tcpstp->err != UROS_OK) { return tcpstp->err; } }
  return tcpstp->err = UROS_OK;
}

user_defined_types: enum uros_connproto_t { UROS_PROTO_TCP=0, UROS_PROTO_UDP=1, UROS_PROTO__LENGTH=2 }

user_defined_types: struct uros_topicflags_t { unsigned int service; unsigned int probe; unsigned int persistent; unsigned int latching; unsigned int noDelay; unsigned int deleted; }

user_defined_types: union UrosIp { unsigned int dword; struct { unsigned char field4; unsigned char field3; unsigned char field2; unsigned char field1; } fields; unsigned char bytes[4]; }

user_defined_types: struct UrosMsgType { struct UrosString name; struct UrosString desc; struct UrosString md5str; }


urosMsgTypesRegStaticTypes

decompiled_code:
__int64 urosMsgTypesRegStaticTypes()
{
return urosRegisterStaticMsgTypeSZ("std_msgs/String", 0LL, "992ce8a1687cec8c8bd883ec73ca41d1");
}

canonical_decompiled_code:
__int64 func5()
{
return urosRegisterStaticMsgTypeSZ("std_msgs/String", 0LL, "992ce8a1687cec8c8bd883ec73ca41d1");
}

original_code:
void urosMsgTypesRegStaticTypes(void) {
  urosRegisterStaticMsgTypeSZ("std_msgs/String",
                              ((void *)0), "992ce8a1687cec8c8bd883ec73ca41d1");
}

canonical_original_code:
void urosMsgTypesRegStaticTypes() {
  urosRegisterStaticMsgTypeSZ("std_msgs/String",
                              ((void *)0), "992ce8a1687cec8c8bd883ec73ca41d1");
}


decompiled_code:
// attributes: thunk
pthread_t uros_lld_thread_self(void)
{
return pthread_self();
}

canonical_decompiled_code:
pthread_t func14(void)
{
return pthread_self();
}

original_code:
UrosThreadId uros_lld_thread_self(void) {
  return pthread_self();
}

canonical_original_code:
unsigned long uros_lld_thread_self() {
  return pthread_self();
}


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

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

original_code:
const char *uros_lld_thread_getname(UrosThreadId id) {
  (void)id;
  return ((void *)0);
}

canonical_original_code:
char *uros_lld_thread_getname(unsigned long id) {
  (void)id;
  return ((void *)0);
}

variable_types:
id
unsigned long


decompiled_code:
__int64 __fastcall uros_lld_thread_join(pthread_t a1)
{
int v1; // eax
int v3; // ebp
char *v4; // rax
void *thread_return; // [rsp+Ch] [rbp-1Ch] BYREF

v1 = pthread_join(a1, &thread_return);
if ( !v1 )
return (unsigned int)thread_return;
v3 = v1;
printf(
"Error at %s:%d\n function: %s\n reason: %s\n message: ",
"../../src/lld/posix/uros_lld_threading.c",
584LL,
"uros_lld_thread_join",
"err != 0");
v4 = strerror(v3);
printf("Error [%s] while joining thread id %u\n", v4, (unsigned int)a1);
return 4294967192LL;
}

canonical_decompiled_code:
__int64 __fastcall func19(pthread_t a1)
{
int v1; // eax
int v3; // ebp
char *v4; // rax
void *thread_return; // [rsp+Ch] [rbp-1Ch] BYREF

v1 = pthread_join(a1, &thread_return);
if ( !v1 )
return (unsigned int)thread_return;
v3 = v1;
printf(
"Error at %s:%d\n function: %s\n reason: %s\n message: ",
"../../src/lld/posix/uros_lld_threading.c",
584LL,
"uros_lld_thread_join",
"err != 0");
v4 = strerror(v3);
printf("Error [%s] while joining thread id %u\n", v4, (unsigned int)a1);
return 4294967192LL;
}

original_code:
uros_err_t uros_lld_thread_join(UrosThreadId id) {
  uros_err_t msg;
  int err;
  (void)err;
  err = pthread_join(id, (void**)&msg);
  { if (err != 0) { printf("Error at %s:%d\n" "  function: %s\n" "  reason:   %s\n" "  message:  ", "../../src/lld/posix/uros_lld_threading.c", 584, __PRETTY_FUNCTION__, "err != 0"); printf ("Error [%s] while joining thread id %u\n", strerror(err), (unsigned)id) ; { return UROS_ERR_BADPARAM; } } };
  return msg;
}

canonical_original_code:
int uros_lld_thread_join(unsigned long id) {
  int msg;
  int err;
  (void)err;
  err = pthread_join(id, (void **)&msg);
  { if (err != 0) { printf("Error at %s:%d\n" "  function: %s\n" "  reason:   %s\n" "  message:  ", "../../src/lld/posix/uros_lld_threading.c", 584, __PRETTY_FUNCTION__, "err != 0"); printf ("Error [%s] while joining thread id %u\n", strerror(err), (unsigned int)id) ; { return UROS_ERR_BADPARAM; } } };
  return msg;
}

variable_types: msg int


decompiled_code:
int __fastcall uros_lld_thread_sleepsec(unsigned int a1)
{
struct timespec *v1; // rbx
int *v2; // rax
struct timespec vars0; // [rsp+0h] [rbp+0h] BYREF
struct timespec remaining; // [rsp+10h] [rbp+10h] BYREF

vars0.tv_sec = a1;
v1 = &remaining;
remaining.tv_sec = 0LL;
remaining.tv_nsec = 0LL;
vars0.tv_nsec = 0LL;
do
{
LODWORD(v2) = nanosleep(&vars0, v1);
if ( (_DWORD)v2 != -1 )
break;
v2 = _errno_location();
v1 = &vars0;
}
while ( *v2 == 4 );
return (int)v2;
}

canonical_decompiled_code:
int __fastcall func20(unsigned int a1)
{
struct timespec *v1; // rbx
int *v2; // rax
struct timespec vars0; // [rsp+0h] [rbp+0h] BYREF
struct timespec remaining; // [rsp+10h] [rbp+10h] BYREF

vars0.tv_sec = a1;
v1 = &remaining;
remaining.tv_sec = 0LL;
remaining.tv_nsec = 0LL;
vars0.tv_nsec = 0LL;
do
{
LODWORD(v2) = nanosleep(&vars0, v1);
if ( (_DWORD)v2 != -1 )
break;
v2 = _errno_location();
v1 = &vars0;
}
while ( *v2 == 4 );
return (int)v2;
}

original_code:
void uros_lld_thread_sleepsec(uint32_t sec) {
  struct timespec to1, to2 = { 0, 0 };
  struct timespec *to1p = &to1, *to2p = &to2, *tmp;
  to1.tv_sec = sec;
  to1.tv_nsec = 0;
  while (nanosleep(to1p, to2p) == -1) {
    if ((*__errno_location ()) != 4) { return; }
    tmp = to1p;
    to1p = to2p;
    to2p = tmp;
  }
}

canonical_original_code:
void uros_lld_thread_sleepsec(unsigned int sec) {
  struct timespec to1; struct timespec to2 = { 0, 0 };
  struct timespec *to1p = &to1; struct timespec *to2p = &to2; struct timespec *tmp;
  to1.tv_sec = sec;
  to1.tv_nsec = 0;
  while (nanosleep(to1p, to2p) == -1) {
    if ((*__errno_location ()) != 4) { return; }
    tmp = to1p;
    to1p = to2p;
    to2p = tmp;
  }
}

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


decompiled_code:
int __fastcall uros_lld_thread_sleepmsec(unsigned int a1)
{
struct timespec *v1; // rbx
int *v2; // rax
struct timespec vars0; // [rsp+0h] [rbp+0h] BYREF
struct timespec remaining; // [rsp+10h] [rbp+10h] BYREF

v1 = &remaining;
remaining.tv_sec = 0LL;
remaining.tv_nsec = 0LL;
vars0.tv_sec = a1 / 0x3E8;
vars0.tv_nsec = 1000000 * (a1 % 0x3E8);
do
{
LODWORD(v2) = nanosleep(&vars0, v1);
if ( (_DWORD)v2 != -1 )
break;
v2 = _errno_location();
v1 = &vars0;
}
while ( *v2 == 4 );
return (int)v2;
}

canonical_decompiled_code:
int __fastcall func21(unsigned int a1)
{
struct timespec *v1; // rbx
int *v2; // rax
struct timespec vars0; // [rsp+0h] [rbp+0h] BYREF
struct timespec remaining; // [rsp+10h] [rbp+10h] BYREF

v1 = &remaining;
remaining.tv_sec = 0LL;
remaining.tv_nsec = 0LL;
vars0.tv_sec = a1 / 0x3E8;
vars0.tv_nsec = 1000000 * (a1 % 0x3E8);
do
{
LODWORD(v2) = nanosleep(&vars0, v1);
if ( (_DWORD)v2 != -1 )
break;
v2 = _errno_location();
v1 = &vars0;
}
while ( *v2 == 4 );
return (int)v2;
}

original_code:
void uros_lld_thread_sleepmsec(uint32_t msec) {
  struct timespec to1, to2 = { 0, 0 };
  struct timespec *to1p = &to1, *to2p = &to2, *tmp;
  to1.tv_sec = msec / 1000;
  to1.tv_nsec = (msec % 1000) * 1000000;
  while (nanosleep(to1p, to2p) == -1) {
    if ((*__errno_location ()) != 4) { return; }
    tmp = to1p;
    to1p = to2p;
    to2p = tmp;
  }
}

canonical_original_code:
void uros_lld_thread_sleepmsec(unsigned int msec) {
  struct timespec to1; struct timespec to2 = { 0, 0 };
  struct timespec *to1p = &to1; struct timespec *to2p = &to2; struct timespec *tmp;
  to1.tv_sec = msec / 1000;
  to1.tv_nsec = (msec % 1000) * 1000000;
  while (nanosleep(to1p, to2p) == -1) {
    if ((*__errno_location ()) != 4) { return; }
    tmp = to1p;
    to1p = to2p;
    to2p = tmp;
  }
}

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


decompiled_code:
int __fastcall uros_lld_thread_sleepusec(unsigned int a1)
{
struct timespec *v1; // rbx
int *v2; // rax
struct timespec vars0; // [rsp+0h] [rbp+0h] BYREF
struct timespec remaining; // [rsp+10h] [rbp+10h] BYREF

v1 = &remaining;
remaining.tv_sec = 0LL;
remaining.tv_nsec = 0LL;
vars0.tv_sec = a1 / 0xF4240;
vars0.tv_nsec = 1000 * (a1 % 0xF4240);
do
{
LODWORD(v2) = nanosleep(&vars0, v1);
if ( (_DWORD)v2 != -1 )
break;
v2 = _errno_location();
v1 = &vars0;
}
while ( *v2 == 4 );
return (int)v2;
}

canonical_decompiled_code:
int __fastcall func22(unsigned int a1)
{
struct timespec *v1; // rbx
int *v2; // rax
struct timespec vars0; // [rsp+0h] [rbp+0h] BYREF
struct timespec remaining; // [rsp+10h] [rbp+10h] BYREF

v1 = &remaining;
remaining.tv_sec = 0LL;
remaining.tv_nsec = 0LL;
vars0.tv_sec = a1 / 0xF4240;
vars0.tv_nsec = 1000 * (a1 % 0xF4240);
do
{
LODWORD(v2) = nanosleep(&vars0, v1);
if ( (_DWORD)v2 != -1 )
break;
v2 = _errno_location();
v1 = &vars0;
}
while ( *v2 == 4 );
return (int)v2;
}

original_code:
void uros_lld_thread_sleepusec(uint32_t usec) {
  struct timespec to1, to2 = { 0, 0 };
  struct timespec *to1p = &to1, *to2p = &to2, *tmp;
  to1.tv_sec = usec / 1000000;
  to1.tv_nsec = (usec % 1000000) * 1000;
  while (nanosleep(to1p, to2p) == -1) {
    if ((*__errno_location ()) != 4) { return; }
    tmp = to1p;
    to1p = to2p;
    to2p = tmp;
  }
}

canonical_original_code:
void uros_lld_thread_sleepusec(unsigned int usec) {
  struct timespec to1; struct timespec to2 = { 0, 0 };
  struct timespec *to1p = &to1; struct timespec *to2p = &to2; struct timespec *tmp;
  to1.tv_sec = usec / 1000000;
  to1.tv_nsec = (usec % 1000000) * 1000;
  while (nanosleep(to1p, to2p) == -1) {
    if ((*__errno_location ()) != 4) { return; }
    tmp = to1p;
    to1p = to2p;
    to2p = tmp;
  }
}

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


repo: opensource-apple/cctools

canonical_original_code:
int read_comp_unit(unsigned char *debug_info, unsigned long debug_info_size, unsigned char *debug_abbrev, unsigned long debug_abbrev_size, int little_endian, char **name, char **comp_dir, unsigned long *stmt_list)
{
  unsigned char *di = debug_info;
  unsigned char *da;
  unsigned char *end;
  unsigned char *enda;
  unsigned long sz;
  unsigned short vers;
  unsigned long abbrev_base;
  unsigned long abbrev;
  unsigned char address_size;
  _Bool dwarf64;
  *name = ((void *)0);
  *comp_dir = ((void *)0);
  *stmt_list = (unsigned long) -1;
  if (debug_info_size < 12)
    return 0;
  sz = (little_endian ? ((di)[3] << 24 | (di)[2] << 16 | (di)[1] << 8 | (di)[0]) : ((di)[0] << 24 | (di)[1] << 16 | (di)[2] << 8 | (di)[3]));
  di += 4;
  dwarf64 = sz == 0xffffffff;
  if (dwarf64)
    sz = (little_endian ? ((unsigned long) (di)[7] << 56 | (unsigned long) (di)[6] << 48 | (unsigned long) (di)[5] << 40 | (unsigned long) (di)[4] << 32 | (unsigned long) (di)[3] << 24 | (unsigned long) (di)[2] << 16u | (unsigned long) (di)[1] << 8 | (unsigned long) (di)[0]) : ((unsigned long) (di)[0] << 56 | (unsigned long) (di)[1] << 48 | (unsigned long) (di)[2] << 40 | (unsigned long) (di)[3] << 32 | (unsigned long) (di)[4] << 24 | (unsigned long) (di)[5] << 16u | (unsigned long) (di)[6] << 8 | (unsigned long) (di)[7])), di += 8;
  else if (sz > 0xffffff00)
    return 0;
  if (sz + (di - debug_info) > debug_info_size || sz <= (dwarf64 ? 23 : 11))
    return 0;
  vers = (little_endian ? ((di)[1] << 8 | (di)[0]) : ((di)[0] << 8 | (di)[1]));
  if (vers < 2 || vers > 3)
    return 0;
  di += 2;
  abbrev_base = dwarf64 ? (little_endian ? ((unsigned long) (di)[7] << 56 | (unsigned long) (di)[6] << 48 | (unsigned long) (di)[5] << 40 | (unsigned long) (di)[4] << 32 | (unsigned long) (di)[3] << 24 | (unsigned long) (di)[2] << 16u | (unsigned long) (di)[1] << 8 | (unsigned long) (di)[0]) : ((unsigned long) (di)[0] << 56 | (unsigned long) (di)[1] << 48 | (unsigned long) (di)[2] << 40 | (unsigned long) (di)[3] << 32 | (unsigned long) (di)[4] << 24 | (unsigned long) (di)[5] << 16u | (unsigned long) (di)[6] << 8 | (unsigned long) (di)[7])) : (little_endian ? ((di)[3] << 24 | (di)[2] << 16 | (di)[1] << 8 | (di)[0]) : ((di)[0] << 24 | (di)[1] << 16 | (di)[2] << 8 | (di)[3]));
  di += dwarf64 ? 8 : 4;
  if (abbrev_base > debug_abbrev_size)
    return 0;
  da = debug_abbrev + abbrev_base;
  enda = debug_abbrev + debug_abbrev_size;
  address_size = *di++;
  end = di + sz;
  abbrev = read_uleb128 (&di, end);
  if (abbrev == (unsigned long) -1)
    return 0;
  for (;;)
    {
      unsigned long this_abbrev = read_uleb128 (&da, enda);
      unsigned long attr;
      if (this_abbrev == abbrev)
 break;
      skip_leb128 (&da, enda);
      if (da == enda)
 return 0;
      da++;
      do {
 attr = read_uleb128 (&da, enda);
 skip_leb128 (&da, enda);
      } while (attr != 0 && attr != (unsigned long) -1);
      if (attr != 0)
 return 0;
    }
  if (read_uleb128 (&da, enda) != DW_TAG_compile_unit)
    return 0;
  if (da == enda)
    return 0;
  da++;
  for (;;)
    {
      unsigned long attr = read_uleb128 (&da, enda);
      unsigned long form = read_uleb128 (&da, enda);
      if (attr == (unsigned long) -1)
 return 0;
      else if (attr == 0)
 return 1;
      if (form == DW_FORM_indirect)
 form = read_uleb128 (&di, end);
      if (attr == DW_AT_name && form == DW_FORM_string)
 *name = (char *) di;
      else if (attr == DW_AT_comp_dir && form == DW_FORM_string)
 *comp_dir = (char *) di;
      else if (attr == DW_AT_stmt_list && form == DW_FORM_data4)
 *stmt_list = (little_endian ? ((di)[3] << 24 | (di)[2] << 16 | (di)[1] << 8 | (di)[0]) : ((di)[0] << 24 | (di)[1] << 16 | (di)[2] << 8 | (di)[3]));
      else if (attr == DW_AT_stmt_list && form == DW_FORM_data8)
 *stmt_list = (little_endian ? ((unsigned long) (di)[7] << 56 | (unsigned long) (di)[6] << 48 | (unsigned long) (di)[5] << 40 | (unsigned long) (di)[4] << 32 | (unsigned long) (di)[3] << 24 | (unsigned long) (di)[2] << 16u | (unsigned long) (di)[1] << 8 | (unsigned long) (di)[0]) : ((unsigned long) (di)[0] << 56 | (unsigned long) (di)[1] << 48 | (unsigned long) (di)[2] << 40 | (unsigned long) (di)[3] << 32 | (unsigned long) (di)[4] << 24 | (unsigned long) (di)[5] << 16u | (unsigned long) (di)[6] << 8 | (unsigned long) (di)[7]));
      if (! skip_form (&di, end, form, address_size, dwarf64, little_endian))
 return 0;
    }
}

variable_types:
name
char **

variable_types:
di
unsigned char *

variable_types:
da
unsigned char *

variable_types:
end
unsigned char *

variable_types:
enda
unsigned char *

variable_types:
sz
unsigned long

variable_types:
vers
unsigned short

variable_types:
abbrev
unsigned long

variable_types:
attr
unsigned long

variable_types:
form
unsigned long


decompiled_code:
char *__fastcall skip_leb128(char **a1, char *a2)
{
char *result; // rax
char v3; // dl

result = *a1;
if ( a2 != *a1 )
{
do
{
v3 = *result++;
*a1 = result;
}
while ( v3 < 0 && a2 != result );
}
return result;
}

canonical_decompiled_code:
char *__fastcall func0(char **a1, char *a2)
{
char *result; // rax
char v3; // dl

result = *a1;
if ( a2 != *a1 )
{
do
{
v3 = *result++;
*a1 = result;
}
while ( v3 < 0 && a2 != result );
}
return result;
}

original_code:
static void
skip_leb128 (const uint8_t ** offset, const uint8_t * end)
{
  while (*offset != end && **offset >= 0x80)
    (*offset)++;
  if (*offset != end)
    (*offset)++;
}

canonical_original_code:
static void skip_leb128(unsigned char **offset, unsigned char *end)
{
  while (*offset != end && **offset >= 0x80)
    (*offset)++;
  if (*offset != end)
    (*offset)++;
}

variable_types:
offset
unsigned char **


original_code:
static uint64_t
read_uleb128 (const uint8_t ** offset, const uint8_t * end)
{
  uint64_t result = 0;
  int bit = 0;
  do {
    uint64_t b;
    if (*offset == end)
      return (uint64_t) -1;
    b = **offset & 0x7f;
    if (bit >= 64 || b << bit >> bit != b)
      result = (uint64_t) -1;
    else
      result |= b << bit, bit += 7;
  } while (*(*offset)++ >= 0x80);
  return result;
}

canonical_original_code:
static unsigned long read_uleb128(unsigned char **offset, unsigned char *end)
{
  unsigned long result = 0;
  int bit = 0;
  do {
    unsigned long b;
    if (*offset == end)
      return (unsigned long) -1;
    b = **offset & 0x7f;
    if (bit >= 64 || b << bit >> bit != b)
      result = (unsigned long) -1;
    else
      result |= b << bit, bit += 7;
  } while (*(*offset)++ >= 0x80);
  return result;
}

variable_types:
result
unsigned long

variable_types: bit int

variable_types:
b
unsigned long


nllookup

decompiled_code:
char *__fastcall nllookup(unsigned __int64 a1)
{
int v1; // ecx
unsigned int v2; // er9
int v3; // esi
int v4; // eax
__int64 v5; // rbx
char *v6; // r8

if ( !nname )
{
LABEL_7:
fprintf(stderr, "[nllookup] binary search fails for address 0x%x\n", a1);
return 0LL;
}
v1 = nname;
v2 = 0;
v3 = 0;
while ( 1 )
{
while ( 1 )
{
++v2;
v4 = (v3 + v1) >> 1;
v5 = (__int64)v4 << 7;
v6 = (char *)nl + v5;
if ( *(_QWORD *)((char *)nl + v5 + 8) <= a1 )
break;
v1 = (v3 + v1) >> 1;
if ( v4 == v3 )
goto LABEL_7;
}
v3 = v4 + 1;
if ( *(_QWORD *)((char *)nl + v5 + 136) > a1 )
break;
if ( v1 == v3 )
goto LABEL_7;
}
if ( (debug[1] & 1) == 0 )
return v6;
printf("[nllookup] %d (%u) probes\n", v2, (unsigned int)(nname - 1));
return (char *)nl + v5;
}

canonical_decompiled_code:
char *__fastcall func0(unsigned __int64 a1)
{
int v1; // ecx
unsigned int v2; // er9
int v3; // esi
int v4; // eax
__int64 v5; // rbx
char *v6; // r8

if ( !nname )
{
LABEL_7:
fprintf(stderr, "[nllookup] binary search fails for address 0x%x\n", a1);
return 0LL;
}
v1 = nname;
v2 = 0;
v3 = 0;
while ( 1 )
{
while ( 1 )
{
++v2;
v4 = (v3 + v1) >> 1;
v5 = (__int64)v4 << 7;
v6 = (char *)nl + v5;
if ( *(_QWORD *)((char *)nl + v5 + 8) <= a1 )
break;
v1 = (v3 + v1) >> 1;
if ( v4 == v3 )
goto LABEL_7;
}
v3 = v4 + 1;
if ( *(_QWORD *)((char *)nl + v5 + 136) > a1 )
break;
if ( v1 == v3 )
goto LABEL_7;
}
if ( (debug[1] & 1) == 0 )
return v6;
printf("[nllookup] %d (%u) probes\n", v2, (unsigned int)(nname - 1));
return (char *)nl + v5;
}

original_code:
nltype *
nllookup(
uint64_t address)
{
    int32_t low;
    int32_t middle;
    int32_t high;
    int probes;
 probes = 0;
 for(low = 0, high = nname; low != high ; ){
     probes += 1;
     middle = (high + low) >> 1;
     if(nl[middle].value <= address && nl[middle+1].value > address){
  if(debug & 256){
      printf("[nllookup] %d (%u) probes\n", probes, nname-1);
  }
  return(&nl[middle]);
     }
     if(nl[middle].value > address){
  high = middle;
     }
     else{
  low = middle + 1;
     }
 }
 fprintf(stderr, "[nllookup] binary search fails for address 0x%x\n",
  (unsigned int)address );
 return(((void *)0));
}

canonical_original_code:
struct nl *nllookup(unsigned long address)
{
    int low;
    int middle;
    int high;
    int probes;
 probes = 0;
 for(low = 0, high = nname; low != high ; ){
     probes += 1;
     middle = (high + low) >> 1;
     if(nl[middle].value <= address && nl[middle+1].value > address){
  if(debug & 256){
      printf("[nllookup] %d (%u) probes\n", probes, nname-1);
  }
  return(&nl[middle]);
     }
     if(nl[middle].value > address){
  high = middle;
     }
     else{
  low = middle + 1;
     }
 }
 fprintf(stderr, "[nllookup] binary search fails for address 0x%x\n",
  (unsigned int)address );
 return(((void *)0));
}

variable_types:
address
unsigned long

variable_types: low int

variable_types: middle int

variable_types: high int

variable_types: probes int

return_type: struct nl { char *name; unsigned long value; unsigned long svalue; double time; double childtime; unsigned int order; int ncall; int selfcalls; double propfraction; double propself; double propchild; enum bool { FALSE=0, TRUE=1 } printflag; int index; int toporder; int cycleno; struct nl *cyclehead; struct nl *cnext; struct arcstruct { struct nl *arc_parentp; struct nl *arc_childp; unsigned int arc_count; unsigned int arc_order; double arc_time; double arc_childtime; struct arcstruct *arc_parentlist; struct arcstruct *arc_childlist; } *parents; struct arcstruct *children; } *

user_defined_types: struct nl { char *name; unsigned long value; unsigned long svalue; double time; double childtime; unsigned int order; int ncall; int selfcalls; double propfraction; double propself; double propchild; enum bool printflag; int index; int toporder; int cycleno; struct nl *cyclehead; struct nl *cnext; struct arcstruct *parents; struct arcstruct *children; }


arclookup

decompiled_code:
__int64 __fastcall arclookup(__int64 a1, const char **a2)
{
__int64 i; // r12
__int64 result; // rax

if ( a1 && a2 )
{
if ( (debug[1] & 1) != 0 )
printf("[arclookup] parent %s child %s\n", *(const char **)a1, *a2);
for ( i = *(_QWORD *)(a1 + 120); i; i = *(_QWORD *)(i + 48) )
{
if ( (debug[1] & 1) != 0 )
{
printf("[arclookup]\t arc_parent %s arc_child %s\n", **(const char ***)i, **(const char ***)(i + 8));
if ( *(const char ***)(i + 8) == a2 )
goto LABEL_11;
}
else if ( *(const char ***)(i + 8) == a2 )
{
goto LABEL_11;
}
}
result = 0LL;
}
else
{
i = 0LL;
puts("[arclookup] parentp == 0 || childp == 0");
LABEL_11:
result = i;
}
return result;
}

canonical_decompiled_code:
__int64 __fastcall func1(__int64 a1, const char **a2)
{
__int64 i; // r12
__int64 result; // rax

if ( a1 && a2 )
{
if ( (debug[1] & 1) != 0 )
printf("[arclookup] parent %s child %s\n", *(const char **)a1, *a2);
for ( i = *(_QWORD *)(a1 + 120); i; i = *(_QWORD *)(i + 48) )
{
if ( (debug[1] & 1) != 0 )
{
printf("[arclookup]\t arc_parent %s arc_child %s\n", **(const char ***)i, **(const char ***)(i + 8));
if ( *(const char ***)(i + 8) == a2 )
goto LABEL_11;
}
else if ( *(const char ***)(i + 8) == a2 )
{
goto LABEL_11;
}
}
result = 0LL;
}
else
{
i = 0LL;
puts("[arclookup] parentp == 0 || childp == 0");
LABEL_11:
result = i;
}
return result;
}

original_code:
arctype *
arclookup(
nltype *parentp,
nltype *childp)
{
    arctype *arcp;
 if(parentp == 0 || childp == 0){
     printf("[arclookup] parentp == 0 || childp == 0\n");
     return(((void *)0));
 }
 if(debug & 256){
     printf("[arclookup] parent %s child %s\n",
     parentp->name, childp->name);
 }
 for(arcp = parentp->children; arcp ; arcp = arcp->arc_childlist){
     if(debug & 256){
  printf("[arclookup]\t arc_parent %s arc_child %s\n",
         arcp->arc_parentp->name,
         arcp->arc_childp->name);
     }
     if(arcp->arc_childp == childp){
  return(arcp);
     }
 }
 return(((void *)0));
}

canonical_original_code:
struct arcstruct *arclookup(struct nl *parentp, struct nl *childp)
{
    struct arcstruct *arcp;
 if(parentp == 0 || childp == 0){
     printf("[arclookup] parentp == 0 || childp == 0\n");
     return(((void *)0));
 }
 if(debug & 256){
     printf("[arclookup] parent %s child %s\n",
     parentp->name, childp->name);
 }
 for(arcp = parentp->children; arcp ; arcp = arcp->arc_childlist){
     if(debug & 256){
  printf("[arclookup]\t arc_parent %s arc_child %s\n",
         arcp->arc_parentp->name,
         arcp->arc_childp->name);
     }
     if(arcp->arc_childp == childp){
  return(arcp);
     }
 }
 return(((void *)0));
}

variable_types:
parentp
struct nl *

variable_types:
childp
struct nl *

variable_types: struct arcstruct { struct nl { char *name; unsigned long value; unsigned long svalue; double time; double childtime; unsigned int order; int ncall; int selfcalls; double propfraction; double propself; double propchild; enum bool { FALSE=0, TRUE=1 } printflag; int index; int toporder; int cycleno; struct nl *cyclehead; struct nl *cnext; struct arcstruct *parents; struct arcstruct *children; } *arc_parentp; struct nl *arc_childp; unsigned int arc_count; unsigned int arc_order; double arc_time; double arc_childtime; struct arcstruct *arc_parentlist; struct arcstruct *arc_childlist; } *

user_defined_types: struct arcstruct { struct nl *arc_parentp; struct nl *arc_childp; unsigned int arc_count; unsigned int arc_order; double arc_time; double arc_childtime; struct arcstruct *arc_parentlist; struct arcstruct *arc_childlist; }


decompiled_code:
void __fastcall obstack_free(__int64 a1, unsigned __int64 a2)
{
unsigned __int64 *v3; // rdi
unsigned __int64 v4; // rax
unsigned __int64 *v5; // rbx

v3 = *(unsigned __int64 **)(a1 + 8);
if ( v3 )
{
while ( 1 )
{
if ( (unsigned __int64)v3 < a2 )
{
v4 = *v3;
if ( *v3 >= a2 )
break;
}
v5 = (unsigned __int64 *)v3[1];
(*(void (**)(void))(a1 + 56))();
if ( !v5 )
goto LABEL_7;
v3 = v5;
}
*(_QWORD *)(a1 + 24) = a2;
*(_QWORD *)(a1 + 16) = a2;
*(_QWORD *)(a1 + 32) = v4;
*(_QWORD *)(a1 + 8) = v3;
}
else
{
LABEL_7:
if ( a2 )
obstack_free_cold();
}
}

original_code:
void
obstack_free(
struct obstack *h,
void * obj)
{
  register struct _obstack_chunk* lp;
  register struct _obstack_chunk* plp;
  lp = (h)->chunk;
  while (lp != 0 && ((void *)lp >= obj || (void *)(lp)->limit < obj))
    {
      plp = lp -> prev;
      (*h->freefun) (lp);
      lp = plp;
    }
  if (lp)
    {
      (h)->object_base = (h)->next_free = (char *)(obj);
      (h)->chunk_limit = lp->limit;
      (h)->chunk = lp;
    }
  else if (obj != 0)
    abort ();
}

canonical_original_code:
void obstack_free(struct obstack *h, void *obj)
{
  register struct _obstack_chunk *lp;
  register struct _obstack_chunk *plp;
  lp = (h)->chunk;
  while (lp != 0 && ((void *)lp >= obj || (void *)(lp)->limit < obj))
    {
      plp = lp -> prev;
      (*h->freefun) (lp);
      lp = plp;
    }
  if (lp)
    {
      (h)->object_base = (h)->next_free = (char *)(obj);
      (h)->chunk_limit = lp->limit;
      (h)->chunk = lp;
    }
  else if (obj != 0)
    abort ();
}

variable_types: struct obstack { unsigned long chunk_size; struct _obstack_chunk { char *limit; struct _obstack_chunk *prev; char contents[4]; } *chunk; char *object_base; char *next_free; char *chunk_limit; int temp; int alignment_mask; struct _obstack_chunk *(*chunkfun)(); void (*freefun)(); } *

variable_types:
obj
void *

user_defined_types: struct obstack { unsigned long chunk_size; struct _obstack_chunk *chunk; char *object_base; char *next_free; char *chunk_limit; int temp; int alignment_mask; struct _obstack_chunk *(*chunkfun)(); void (*freefun)(); }


original_code:
void
flonum_multip(
const_FLONUM_TYPE *a,
FLONUM_TYPE *b,
FLONUM_TYPE *product)
{
  int size_of_a;
  int size_of_b;
  int size_of_product;
  int size_of_sum;
  int extra_product_positions;
  uint32_t work;
  uint32_t carry;
  int32_t exponent;
  LITTLENUM_TYPE * q;
  int32_t significant;
  int P;
  int N;
  int A;
  int B;
  if((a->sign!='-' && a->sign!='+') || (b->sign!='-' && b->sign!='+')) {
    product->sign=0;
    return;
  }
  product -> sign = (a->sign == b->sign) ? '+' : '-';
  size_of_a = a -> leader - a -> low;
  size_of_b = b -> leader - b -> low;
  exponent = a -> exponent + b -> exponent;
  size_of_product = product -> high - product -> low;
  size_of_sum = size_of_a + size_of_b;
  extra_product_positions = size_of_product - size_of_sum;
  if (extra_product_positions < 0)
    {
      P = extra_product_positions;
      exponent -= extra_product_positions;
    }
  else
    {
      P = 0;
    }
  carry = 0;
  significant = 0;
  for (N = 0;
       N <= size_of_sum;
       N++)
    {
      work = carry;
      carry = 0;
      for (A = 0;
    A <= N;
    A ++)
 {
   B = N - A;
   if (A <= size_of_a && B <= size_of_b && B >= 0)
     {
       work += a -> low [A] * b -> low [B];
       carry += work >> (16);
       work &= (0xFFFF);
     }
 }
      significant |= work;
      if (significant || P<0)
 {
   if (P >= 0)
     {
       product -> low [P] = work;
     }
   P ++;
 }
      else
 {
   extra_product_positions ++;
   exponent ++;
 }
    }
  if (carry)
    {
      if (extra_product_positions > 0)
 {
   product -> low [P] = carry;
 }
      else
 {
   exponent ++;
   P --;
   for (q = product -> low + P;
        q >= product -> low;
        q --)
     {
       work = * q;
       * q = carry;
       carry = work;
     }
 }
    }
  else
    {
      P --;
    }
  product -> leader = product -> low + P;
  product -> exponent = exponent;
}

canonical_original_code:
void flonum_multip(struct const_FLONUM_STRUCT *a, struct FLONUM_STRUCT *b, struct FLONUM_STRUCT *product)
{
  int size_of_a;
  int size_of_b;
  int size_of_product;
  int size_of_sum;
  int extra_product_positions;
  unsigned int work;
  unsigned int carry;
  int exponent;
  unsigned short *q;
  int significant;
  int P;
  int N;
  int A;
  int B;
  if((a->sign!='-' && a->sign!='+') || (b->sign!='-' && b->sign!='+')) {
    product->sign=0;
    return;
  }
  product -> sign = (a->sign == b->sign) ? '+' : '-';
  size_of_a = a -> leader - a -> low;
  size_of_b = b -> leader - b -> low;
  exponent = a -> exponent + b -> exponent;
  size_of_product = product -> high - product -> low;
  size_of_sum = size_of_a + size_of_b;
  extra_product_positions = size_of_product - size_of_sum;
  if (extra_product_positions < 0)
    {
      P = extra_product_positions;
      exponent -= extra_product_positions;
    }
  else
    {
      P = 0;
    }
  carry = 0;
  significant = 0;
  for (N = 0;
       N <= size_of_sum;
       N++)
    {
      work = carry;
      carry = 0;
      for (A = 0;
    A <= N;
    A ++)
 {
   B = N - A;
   if (A <= size_of_a && B <= size_of_b && B >= 0)
     {
       work += a -> low [A] * b -> low [B];
       carry += work >> (16);
       work &= (0xFFFF);
     }
 }
      significant |= work;
      if (significant || P<0)
 {
   if (P >= 0)
     {
       product -> low [P] = work;
     }
   P ++;
 }
      else
 {
   extra_product_positions ++;
   exponent ++;
 }
    }
  if (carry)
    {
      if (extra_product_positions > 0)
 {
   product -> low [P] = carry;
 }
      else
 {
   exponent ++;
   P --;
   for (q = product -> low + P;
        q >= product -> low;
        q --)
     {
       work = * q;
       * q = carry;
       carry = work;
     }
 }
    }
  else
    {
      P --;
    }
  product -> leader = product -> low + P;
  product -> exponent = exponent;
}

variable_types: struct const_FLONUM_STRUCT { unsigned short *low; unsigned short *high; unsigned short *leader; int exponent; char sign; } *

variable_types: struct FLONUM_STRUCT { unsigned short *low; unsigned short *high; unsigned short *leader; int exponent; char sign; } *

variable_types:
product
struct FLONUM_STRUCT *

variable_types:
work
unsigned int

variable_types:
carry
unsigned int

variable_types: exponent int

variable_types:
q
unsigned short *

variable_types: significant int

variable_types: P int

variable_types: N int

variable_types: A int

variable_types: B int


original_code:
int
atof_generic (
char **address_of_string_pointer,
const char *string_of_decimal_marks,
const char *string_of_decimal_exponent_marks,
FLONUM_TYPE *address_of_generic_floating_point_number)
{
  int return_value;
  char * first_digit;
  int number_of_digits_before_decimal;
  int number_of_digits_after_decimal;
  int32_t decimal_exponent;
  int number_of_digits_available;
  char digits_sign_char;
  {
    char * p;
    char c;
    int seen_significant_digit;
    first_digit = * address_of_string_pointer;
    c= *first_digit;
    if (c=='-' || c=='+')
      {
 digits_sign_char = c;
        first_digit ++;
      }
    else
 digits_sign_char = '+';
    if( (first_digit[0]=='n' || first_digit[0]=='N')
       && (first_digit[1]=='a' || first_digit[1]=='A')
       && (first_digit[2]=='n' || first_digit[2]=='N')) {
      address_of_generic_floating_point_number->sign=0;
      address_of_generic_floating_point_number->exponent=0;
      address_of_generic_floating_point_number->leader=address_of_generic_floating_point_number->low;
      (*address_of_string_pointer)=first_digit+3;
      return 0;
    }
    if( (first_digit[0]=='i' || first_digit[0]=='I')
       && (first_digit[1]=='n' || first_digit[1]=='N')
       && (first_digit[2]=='f' || first_digit[2]=='F')) {
      address_of_generic_floating_point_number->sign= digits_sign_char=='+' ? 'P' : 'N';
      address_of_generic_floating_point_number->exponent=0;
      address_of_generic_floating_point_number->leader=address_of_generic_floating_point_number->low;
      if( (first_digit[3]=='i' || first_digit[3]=='I')
         && (first_digit[4]=='n' || first_digit[4]=='N')
  && (first_digit[5]=='i' || first_digit[5]=='I')
  && (first_digit[6]=='t' || first_digit[6]=='T')
  && (first_digit[7]=='y' || first_digit[7]=='Y'))
   (*address_of_string_pointer)=first_digit+8;
      else
   (*address_of_string_pointer)=first_digit+3;
      return 0;
    }
    number_of_digits_before_decimal = 0;
    number_of_digits_after_decimal = 0;
    decimal_exponent = 0;
    seen_significant_digit = (0);
    for (p = first_digit;
  (c = * p)
  && (!c || ! strchr(string_of_decimal_marks, c) )
  && (!c || ! strchr(string_of_decimal_exponent_marks, c) );
  p ++)
      {
 if (((*__ctype_b_loc ())[(int) ((c))] & (unsigned short int) _ISdigit))
   {
     if (seen_significant_digit || c > '0')
       {
  number_of_digits_before_decimal ++;
  seen_significant_digit = (1);
       }
     else
       {
         first_digit++;
       }
   }
 else
   {
     break;
   }
      }
    if (c && strchr(string_of_decimal_marks, c))
      {
 for (p ++;
      (c = * p)
      && (!c || ! strchr(string_of_decimal_exponent_marks, c) );
      p ++)
   {
     if (((*__ctype_b_loc ())[(int) ((c))] & (unsigned short int) _ISdigit))
       {
  number_of_digits_after_decimal ++;
  if ( c > '0')
    {
      seen_significant_digit = (1);
    }
       }
     else
       {
  if ( ! seen_significant_digit)
    {
      number_of_digits_after_decimal = 0;
    }
  break;
       }
   }
      }
      while(number_of_digits_after_decimal && first_digit[number_of_digits_before_decimal+number_of_digits_after_decimal]=='0')
 --number_of_digits_after_decimal;
    if (c && strchr(string_of_decimal_exponent_marks, c) )
      {
 char digits_exponent_sign_char;
 c = * ++ p;
 if (c && strchr("+-",c))
   {
     digits_exponent_sign_char = c;
     c = * ++ p;
   }
 else
   {
     digits_exponent_sign_char = '+';
   }
 for (;
      (c);
      c = * ++ p)
   {
     if (((*__ctype_b_loc ())[(int) ((c))] & (unsigned short int) _ISdigit))
       {
  decimal_exponent = decimal_exponent * 10 + c - '0';
       }
     else
       {
  break;
       }
   }
 if (digits_exponent_sign_char == '-')
   {
     decimal_exponent = - decimal_exponent;
   }
      }
    * address_of_string_pointer = p;
  }
  number_of_digits_available =
    number_of_digits_before_decimal
      + number_of_digits_after_decimal;
  return_value = 0;
  if (number_of_digits_available == 0)
    {
      address_of_generic_floating_point_number -> exponent = 0;
      address_of_generic_floating_point_number -> leader
 = -1 + address_of_generic_floating_point_number -> low;
      address_of_generic_floating_point_number -> sign = digits_sign_char;
    }
  else
    {
      LITTLENUM_TYPE * digits_binary_low;
      int precision;
      int maximum_useful_digits;
      int number_of_digits_to_use;
      int more_than_enough_bits_for_digits;
      int more_than_enough_littlenums_for_digits;
      int size_of_digits_in_littlenums;
      int size_of_digits_in_chars;
      FLONUM_TYPE power_of_10_flonum;
      FLONUM_TYPE digits_flonum;
      precision = (address_of_generic_floating_point_number -> high
     - address_of_generic_floating_point_number -> low
     + 1
     );
      maximum_useful_digits = ( ((double) (precision - 2))
          * ((double) ((16)))
          / ((3.3219280948873623478703194294893901758651))
          )
 + 2;
      if (number_of_digits_available > maximum_useful_digits)
 {
   number_of_digits_to_use = maximum_useful_digits;
 }
      else
 {
   number_of_digits_to_use = number_of_digits_available;
 }
      decimal_exponent += number_of_digits_before_decimal - number_of_digits_to_use;
      more_than_enough_bits_for_digits
 = ((((double)number_of_digits_to_use) * (3.3219280948873623478703194294893901758651)) + 1);
      more_than_enough_littlenums_for_digits
 = ( more_than_enough_bits_for_digits
    / (16)
    )
   + 2;
      size_of_digits_in_littlenums = more_than_enough_littlenums_for_digits;
      size_of_digits_in_chars = size_of_digits_in_littlenums
 * sizeof( LITTLENUM_TYPE );
      digits_binary_low = (LITTLENUM_TYPE *)
 __builtin_alloca (size_of_digits_in_chars);
      memset((char *)digits_binary_low, '\0', size_of_digits_in_chars);
      {
 char * p;
 char c;
 int count;
 for (p = first_digit, count = number_of_digits_to_use;
      count;
      p ++, -- count)
   {
     c = * p;
     if (((*__ctype_b_loc ())[(int) ((c))] & (unsigned short int) _ISdigit))
       {
  int32_t carry;
  LITTLENUM_TYPE * littlenum_pointer;
  LITTLENUM_TYPE * littlenum_limit;
  littlenum_limit
    = digits_binary_low
      + more_than_enough_littlenums_for_digits
        - 1;
  carry = c - '0';
  for (littlenum_pointer = digits_binary_low;
       littlenum_pointer <= littlenum_limit;
       littlenum_pointer ++)
    {
      int32_t work;
      work = carry + 10 * (int32_t)(*littlenum_pointer);
      * littlenum_pointer = work & (0xFFFF);
      carry = work >> (16);
    }
  if (carry != 0)
    {
      abort();
    }
       }
     else
       {
  ++ count;
       }
   }
      }
      while (digits_binary_low [size_of_digits_in_littlenums - 1] == 0
      && size_of_digits_in_littlenums >= 2)
   size_of_digits_in_littlenums --;
      digits_flonum . low = digits_binary_low;
      digits_flonum . high = digits_binary_low + size_of_digits_in_littlenums - 1;
      digits_flonum . leader = digits_flonum . high;
      digits_flonum . exponent = 0;
      digits_flonum . sign = '+';
      {
 LITTLENUM_TYPE *power_binary_low;
 int decimal_exponent_is_negative;
 FLONUM_TYPE temporary_flonum;
 LITTLENUM_TYPE *temporary_binary_low;
 int size_of_power_in_littlenums;
 int size_of_power_in_chars;
 size_of_power_in_littlenums = precision;
 decimal_exponent_is_negative = decimal_exponent < 0;
 if (decimal_exponent_is_negative)
   {
     decimal_exponent = - decimal_exponent;
   }
 size_of_power_in_chars
   = size_of_power_in_littlenums
     * sizeof( LITTLENUM_TYPE ) + 2;
 power_binary_low = (LITTLENUM_TYPE *) __builtin_alloca (size_of_power_in_chars);
 temporary_binary_low = (LITTLENUM_TYPE *) __builtin_alloca (size_of_power_in_chars);
 memset((char *)power_binary_low, '\0', size_of_power_in_chars);
 * power_binary_low = 1;
 power_of_10_flonum . exponent = 0;
 power_of_10_flonum . low = power_binary_low;
 power_of_10_flonum . leader = power_binary_low;
 power_of_10_flonum . high = power_binary_low + size_of_power_in_littlenums - 1;
 power_of_10_flonum . sign = '+';
 temporary_flonum . low = temporary_binary_low;
 temporary_flonum . high = temporary_binary_low + size_of_power_in_littlenums - 1;
 {
   int place_number_limit;
   int place_number;
   const const_FLONUM_TYPE * multiplicand;
   place_number_limit = table_size_of_flonum_powers_of_ten;
   multiplicand
     = ( decimal_exponent_is_negative
        ? flonum_negative_powers_of_ten
        : flonum_positive_powers_of_ten);
   for (place_number = 1;
        decimal_exponent;
        decimal_exponent >>= 1
        , place_number ++)
     {
       if (decimal_exponent & 1)
  {
    if (place_number > place_number_limit)
      {
        return_value = (2);
        decimal_exponent = 0;
      }
    else
      {
        flonum_multip ((const_FLONUM_TYPE *)multiplicand + place_number, & power_of_10_flonum, & temporary_flonum);
        flonum_copy (& temporary_flonum, & power_of_10_flonum);
      }
  }
     }
 }
      }
      flonum_multip ((const_FLONUM_TYPE *)&power_of_10_flonum, & digits_flonum, address_of_generic_floating_point_number);
      address_of_generic_floating_point_number -> sign = digits_sign_char;
    }
  return (return_value);
}

canonical_original_code:
int atof_generic(char **address_of_string_pointer, char *string_of_decimal_marks, char *string_of_decimal_exponent_marks, struct FLONUM_STRUCT *address_of_generic_floating_point_number)
{
  int return_value;
  char *first_digit;
  int number_of_digits_before_decimal;
  int number_of_digits_after_decimal;
  int decimal_exponent;
  int number_of_digits_available;
  char digits_sign_char;
  {
    char *p;
    char c;
    int seen_significant_digit;
    first_digit = * address_of_string_pointer;
    c= *first_digit;
    if (c=='-' || c=='+')
      {
 digits_sign_char = c;
        first_digit ++;
      }
    else
 digits_sign_char = '+';
    if( (first_digit[0]=='n' || first_digit[0]=='N')
       && (first_digit[1]=='a' || first_digit[1]=='A')
       && (first_digit[2]=='n' || first_digit[2]=='N')) {
      address_of_generic_floating_point_number->sign=0;
      address_of_generic_floating_point_number->exponent=0;
      address_of_generic_floating_point_number->leader=address_of_generic_floating_point_number->low;
      (*address_of_string_pointer)=first_digit+3;
      return 0;
    }
    if( (first_digit[0]=='i' || first_digit[0]=='I')
       && (first_digit[1]=='n' || first_digit[1]=='N')
       && (first_digit[2]=='f' || first_digit[2]=='F')) {
      address_of_generic_floating_point_number->sign= digits_sign_char=='+' ? 'P' : 'N';
      address_of_generic_floating_point_number->exponent=0;
      address_of_generic_floating_point_number->leader=address_of_generic_floating_point_number->low;
      if( (first_digit[3]=='i' || first_digit[3]=='I')
         && (first_digit[4]=='n' || first_digit[4]=='N')
  && (first_digit[5]=='i' || first_digit[5]=='I')
  && (first_digit[6]=='t' || first_digit[6]=='T')
  && (first_digit[7]=='y' || first_digit[7]=='Y'))
   (*address_of_string_pointer)=first_digit+8;
      else
   (*address_of_string_pointer)=first_digit+3;
      return 0;
    }
    number_of_digits_before_decimal = 0;
    number_of_digits_after_decimal = 0;
    decimal_exponent = 0;
    seen_significant_digit = (0);
    for (p = first_digit;
  (c = * p)
  && (!c || ! strchr(string_of_decimal_marks, c) )
  && (!c || ! strchr(string_of_decimal_exponent_marks, c) );
  p ++)
      {
 if (((*__ctype_b_loc ())[(int) ((c))] & (unsigned short) _ISdigit))
   {
     if (seen_significant_digit || c > '0')
       {
  number_of_digits_before_decimal ++;
  seen_significant_digit = (1);
       }
     else
       {
         first_digit++;
       }
   }
 else
   {
     break;
   }
      }
    if (c && strchr(string_of_decimal_marks, c))
      {
 for (p ++;
      (c = * p)
      && (!c || ! strchr(string_of_decimal_exponent_marks, c) );
      p ++)
   {
     if (((*__ctype_b_loc ())[(int) ((c))] & (unsigned short) _ISdigit))
       {
  number_of_digits_after_decimal ++;
  if ( c > '0')
    {
      seen_significant_digit = (1);
    }
       }
     else
       {
  if ( ! seen_significant_digit)
    {
      number_of_digits_after_decimal = 0;
    }
  break;
       }
   }
      }
      while(number_of_digits_after_decimal && first_digit[number_of_digits_before_decimal+number_of_digits_after_decimal]=='0')
 --number_of_digits_after_decimal;
    if (c && strchr(string_of_decimal_exponent_marks, c) )
      {
 char digits_exponent_sign_char;
 c = * ++ p;
 if (c && strchr("+-",c))
   {
     digits_exponent_sign_char = c;
     c = * ++ p;
   }
 else
   {
     digits_exponent_sign_char = '+';
   }
 for (;
      (c);
      c = * ++ p)
   {
     if (((*__ctype_b_loc ())[(int) ((c))] & (unsigned short) _ISdigit))
       {
  decimal_exponent = decimal_exponent * 10 + c - '0';
       }
     else
       {
  break;
       }
   }
 if (digits_exponent_sign_char == '-')
   {
     decimal_exponent = - decimal_exponent;
   }
      }
    * address_of_string_pointer = p;
  }
  number_of_digits_available =
    number_of_digits_before_decimal
      + number_of_digits_after_decimal;
  return_value = 0;
  if (number_of_digits_available == 0)
    {
      address_of_generic_floating_point_number -> exponent = 0;
      address_of_generic_floating_point_number -> leader
 = -1 + address_of_generic_floating_point_number -> low;
      address_of_generic_floating_point_number -> sign = digits_sign_char;
    }
  else
    {
      unsigned short *digits_binary_low;
      int precision;
      int maximum_useful_digits;
      int number_of_digits_to_use;
      int more_than_enough_bits_for_digits;
      int more_than_enough_littlenums_for_digits;
      int size_of_digits_in_littlenums;
      int size_of_digits_in_chars;
      struct FLONUM_STRUCT power_of_10_flonum;
      struct FLONUM_STRUCT digits_flonum;
      precision = (address_of_generic_floating_point_number -> high
     - address_of_generic_floating_point_number -> low
     + 1
     );
      maximum_useful_digits = ( ((double) (precision - 2))
          * ((double) ((16)))
          / ((3.3219280948873623478703194294893901758651))
          )
 + 2;
      if (number_of_digits_available > maximum_useful_digits)
 {
   number_of_digits_to_use = maximum_useful_digits;
 }
      else
 {
   number_of_digits_to_use = number_of_digits_available;
 }
      decimal_exponent += number_of_digits_before_decimal - number_of_digits_to_use;
      more_than_enough_bits_for_digits
 = ((((double)number_of_digits_to_use) * (3.3219280948873623478703194294893901758651)) + 1);
      more_than_enough_littlenums_for_digits
 = ( more_than_enough_bits_for_digits
    / (16)
    )
   + 2;
      size_of_digits_in_littlenums = more_than_enough_littlenums_for_digits;
      size_of_digits_in_chars = size_of_digits_in_littlenums
 * sizeof( LITTLENUM_TYPE );
      digits_binary_low = (unsigned short *)
 __builtin_alloca (size_of_digits_in_chars);
      memset((char *)digits_binary_low, '\0', size_of_digits_in_chars);
      {
 char *p;
 char c;
 int count;
 for (p = first_digit, count = number_of_digits_to_use;
      count;
      p ++, -- count)
   {
     c = * p;
     if (((*__ctype_b_loc ())[(int) ((c))] & (unsigned short) _ISdigit))
       {
  int carry;
  unsigned short *littlenum_pointer;
  unsigned short *littlenum_limit;
  littlenum_limit
    = digits_binary_low
      + more_than_enough_littlenums_for_digits
        - 1;
  carry = c - '0';
  for (littlenum_pointer = digits_binary_low;
       littlenum_pointer <= littlenum_limit;
       littlenum_pointer ++)
    {
      int work;
      work = carry + 10 * (int)(*littlenum_pointer);
      * littlenum_pointer = work & (0xFFFF);
      carry = work >> (16);
    }
  if (carry != 0)
    {
      abort();
    }
       }
     else
       {
  ++ count;
       }
   }
      }
      while (digits_binary_low [size_of_digits_in_littlenums - 1] == 0
      && size_of_digits_in_littlenums >= 2)
   size_of_digits_in_littlenums --;
      digits_flonum . low = digits_binary_low;
      digits_flonum . high = digits_binary_low + size_of_digits_in_littlenums - 1;
      digits_flonum . leader = digits_flonum . high;
      digits_flonum . exponent = 0;
      digits_flonum . sign = '+';
      {
 unsigned short *power_binary_low;
 int decimal_exponent_is_negative;
 struct FLONUM_STRUCT temporary_flonum;
 unsigned short *temporary_binary_low;
 int size_of_power_in_littlenums;
 int size_of_power_in_chars;
 size_of_power_in_littlenums = precision;
 decimal_exponent_is_negative = decimal_exponent < 0;
 if (decimal_exponent_is_negative)
   {
     decimal_exponent = - decimal_exponent;
   }
 size_of_power_in_chars
   = size_of_power_in_littlenums
     * sizeof( LITTLENUM_TYPE ) + 2;
 power_binary_low = (unsigned short *) __builtin_alloca (size_of_power_in_chars);
 temporary_binary_low = (unsigned short *) __builtin_alloca (size_of_power_in_chars);
 memset((char *)power_binary_low, '\0', size_of_power_in_chars);
 * power_binary_low = 1;
 power_of_10_flonum . exponent = 0;
 power_of_10_flonum . low = power_binary_low;
 power_of_10_flonum . leader = power_binary_low;
 power_of_10_flonum . high = power_binary_low + size_of_power_in_littlenums - 1;
 power_of_10_flonum . sign = '+';
 temporary_flonum . low = temporary_binary_low;
 temporary_flonum . high = temporary_binary_low + size_of_power_in_littlenums - 1;
 {
   int place_number_limit;
   int place_number;
   struct const_FLONUM_STRUCT *multiplicand;
   place_number_limit = table_size_of_flonum_powers_of_ten;
   multiplicand
     = ( decimal_exponent_is_negative
        ? flonum_negative_powers_of_ten
        : flonum_positive_powers_of_ten);
   for (place_number = 1;
        decimal_exponent;
        decimal_exponent >>= 1
        , place_number ++)
     {
       if (decimal_exponent & 1)
  {
    if (place_number > place_number_limit)
      {
        return_value = (2);
        decimal_exponent = 0;
      }
    else
      {
        flonum_multip ((struct const_FLONUM_STRUCT *)multiplicand + place_number, & power_of_10_flonum, & temporary_flonum);
        flonum_copy (& temporary_flonum, & power_of_10_flonum);
      }
  }
     }
 }
      }
      flonum_multip ((struct const_FLONUM_STRUCT *)&power_of_10_flonum, & digits_flonum, address_of_generic_floating_point_number);
      address_of_generic_floating_point_number -> sign = digits_sign_char;
    }
  return (return_value);
}

variable_types:
p
char *

variable_types: c char

variable_types: precision int

variable_types: struct FLONUM_STRUCT { unsigned short *low; unsigned short *high; unsigned short *leader; int exponent; char sign; }

variable_types: count int

variable_types: carry int

variable_types: work int

user_defined_types: struct const_FLONUM_STRUCT { unsigned short *low; unsigned short *high; unsigned short *leader; int exponent; char sign; }


hertz

decompiled_code:
__suseconds_t hertz()
{
__suseconds_t result; // rax
struct itimerval v1; // [rsp+0h] [rbp-28h] BYREF

v1.it_interval.tv_sec = 0LL;
v1.it_interval.tv_usec = 1LL;
v1.it_value.tv_sec = 0LL;
v1.it_value.tv_usec = 0LL;
setitimer(ITIMER_REAL, &v1, 0LL);
setitimer(ITIMER_REAL, 0LL, &v1);
result = 0LL;
if ( v1.it_interval.tv_usec > 1 )
result = 1000000 / v1.it_interval.tv_usec;
return result;
}

canonical_decompiled_code:
__suseconds_t func0()
{
__suseconds_t result; // rax
struct itimerval v1; // [rsp+0h] [rbp-28h] BYREF

v1.it_interval.tv_sec = 0LL;
v1.it_interval.tv_usec = 1LL;
v1.it_value.tv_sec = 0LL;
v1.it_value.tv_usec = 0LL;
setitimer(ITIMER_REAL, &v1, 0LL);
setitimer(ITIMER_REAL, 0LL, &v1);
result = 0LL;
if ( v1.it_interval.tv_usec > 1 )
result = 1000000 / v1.it_interval.tv_usec;
return result;
}

original_code:
uint32_t
hertz(
void)
{
 struct itimerval tim;
 tim.it_interval.tv_sec = 0;
 tim.it_interval.tv_usec = 1;
 tim.it_value.tv_sec = 0;
 tim.it_value.tv_usec = 0;
 setitimer(ITIMER_REAL, &tim, 0);
 setitimer(ITIMER_REAL, 0, &tim);
 if (tim.it_interval.tv_usec < 2)
  return(0);
 return (1000000 / tim.it_interval.tv_usec);
}

canonical_original_code:
unsigned int hertz()
{
 struct itimerval tim;
 tim.it_interval.tv_sec = 0;
 tim.it_interval.tv_usec = 1;
 tim.it_value.tv_sec = 0;
 tim.it_value.tv_usec = 0;
 setitimer(ITIMER_REAL, &tim, 0);
 setitimer(ITIMER_REAL, 0, &tim);
 if (tim.it_interval.tv_usec < 2)
  return(0);
 return (1000000 / tim.it_interval.tv_usec);
}

variable_types: struct itimerval { struct timeval { long tv_sec; long tv_usec; } it_interval; struct timeval it_value; }

user_defined_types: struct itimerval { struct timeval it_interval; struct timeval it_value; }


original_code:
void
flonum_copy(
FLONUM_TYPE *in,
FLONUM_TYPE *out)
{
  int in_length;
  int out_length;
  out -> sign = in -> sign;
  in_length = in -> leader - in -> low;
  if (in_length < 0)
    {
      out -> leader = out -> low - 1;
    }
  else
    {
      out_length = out -> high - out -> low;
      if (in_length <= out_length)
 {
   {
     if (in_length < out_length)
       {
  memset((char *)(out->low + in_length + 1), '\0',
         out_length - in_length);
       }
   }
   memcpy((char *)(out->low), (char *)(in->low),
   (int)((in_length + 1) * sizeof(LITTLENUM_TYPE)));
   out -> exponent = in -> exponent;
   out -> leader = in -> leader - in -> low + out -> low;
 }
      else
 {
   int shorten;
   shorten = in_length - out_length;
   memcpy((char *)(out->low), (char *)(in->low + shorten),
   (int)((out_length + 1) * sizeof(LITTLENUM_TYPE)));
   out -> leader = out -> high;
   out -> exponent = in -> exponent + shorten;
 }
    }
}

canonical_original_code:
void flonum_copy(struct FLONUM_STRUCT *in, struct FLONUM_STRUCT *out)
{
  int in_length;
  int out_length;
  out -> sign = in -> sign;
  in_length = in -> leader - in -> low;
  if (in_length < 0)
    {
      out -> leader = out -> low - 1;
    }
  else
    {
      out_length = out -> high - out -> low;
      if (in_length <= out_length)
 {
   {
     if (in_length < out_length)
       {
  memset((char *)(out->low + in_length + 1), '\0',
         out_length - in_length);
       }
   }
   memcpy((char *)(out->low), (char *)(in->low),
   (int)((in_length + 1) * sizeof(LITTLENUM_TYPE)));
   out -> exponent = in -> exponent;
   out -> leader = in -> leader - in -> low + out -> low;
 }
      else
 {
   int shorten;
   shorten = in_length - out_length;
   memcpy((char *)(out->low), (char *)(in->low + shorten),
   (int)((out_length + 1) * sizeof(LITTLENUM_TYPE)));
   out -> leader = out -> high;
   out -> exponent = in -> exponent + shorten;
 }
    }
}

variable_types: struct FLONUM_STRUCT { unsigned short *low; unsigned short *high; unsigned short *leader; int exponent; char sign; } *

variable_types:
out
struct FLONUM_STRUCT *

variable_types: shorten int


main

canonical_name: main

repo: orbekk/musicfs

decompiled_code:
int __cdecl main(int argc, const char **argv, const char **envp)
{
puts("Starting up musicfs");
mfs_run((unsigned int)argc, argv);
puts("Shutting down musicfs");
return 0;
}

original_code:
int
main(int argc, char **argv)
{
 printf("Starting up musicfs\n");
 mfs_run(argc, argv);
 printf("Shutting down musicfs\n");
}

variable_types: argc int

variable_types:
argv
char **


decompiled_code:
__int64 __fastcall second_pass(_DWORD *a1, __int64 a2, __int64 a3, __int64 a4)
{
_DWORD *v5; // rbx
__int64 v6; // rbp

if ( a4 == 0 || a3 == 0 )
return 0xFFFFFFFFLL;
v5 = a1;
if ( !a1 )
return 0xFFFFFFFFLL;
v6 = 0LL;
if ( !a2 )
return 0LL;
while ( *v5 != 2 || v5[4] != 2 || !(unsigned int)directive_compile_entry(v5, a3) )
{
++v6;
v5 += 30;
if ( a2 == v6 )
return 0LL;
}
return 4294967294LL;
}

canonical_decompiled_code:
__int64 __fastcall func1(_DWORD *a1, __int64 a2, __int64 a3, __int64 a4)
{
_DWORD *v5; // rbx
__int64 v6; // rbp

if ( a4 == 0 || a3 == 0 )
return 0xFFFFFFFFLL;
v5 = a1;
if ( !a1 )
return 0xFFFFFFFFLL;
v6 = 0LL;
if ( !a2 )
return 0LL;
while ( *v5 != 2 || v5[4] != 2 || !(unsigned int)directive_compile_entry(v5, a3) )
{
++v6;
v5 += 30;
if ( a2 == v6 )
return 0LL;
}
return 4294967294LL;
}

original_code:
int second_pass(const statement_t *arrStatements,
    size_t nNumOfStatements,
    symbol_table_arr_t io_arrSymbols,
    code_section_t *io_pCode)
{
 size_t nCurrLine = 0;
 int nErrorCode = 0;
 const statement_t* pCurrStatement = ((void *)0);
 if (arrStatements == ((void *)0) ||
  io_arrSymbols == ((void *)0) ||
  io_pCode == ((void *)0))
  return -1;
 for (nCurrLine = 0; nCurrLine < nNumOfStatements; ++nCurrLine)
 {
  pCurrStatement = &arrStatements[nCurrLine];
  if (pCurrStatement->type == STATEMENT_TYPE_DIRECTIVE)
  {
   switch(pCurrStatement->info.directive.name)
   {
    case (DIRECTIVE_ENTRY):
    {
     if (directive_compile_entry(pCurrStatement,
            io_arrSymbols) != 0)
      return -2;
     break;
    }
    case (DIRECTIVE_DATA):
    case (DIRECTIVE_STRING):
    default:
     break;
   }
  }
  else if (pCurrStatement->type == STATEMENT_TYPE_INSTRUCTION)
  {
  }
  else
  {
  }
 }
 return nErrorCode;
}

canonical_original_code:
int second_pass(struct statement_t *arrStatements, unsigned long nNumOfStatements, struct symbol_t io_arrSymbols[1000], struct code_section_t *io_pCode)
{
 unsigned long nCurrLine = 0;
 int nErrorCode = 0;
 struct statement_t *pCurrStatement = ((void *)0);
 if (arrStatements == ((void *)0) ||
  io_arrSymbols == ((void *)0) ||
  io_pCode == ((void *)0))
  return -1;
 for (nCurrLine = 0; nCurrLine < nNumOfStatements; ++nCurrLine)
 {
  pCurrStatement = &arrStatements[nCurrLine];
  if (pCurrStatement->type == STATEMENT_TYPE_DIRECTIVE)
  {
   switch(pCurrStatement->info.directive.name)
   {
    case (DIRECTIVE_ENTRY):
    {
     if (directive_compile_entry(pCurrStatement,
            io_arrSymbols) != 0)
      return -2;
     break;
    }
    case (DIRECTIVE_DATA):
    case (DIRECTIVE_STRING):
    default:
     break;
   }
  }
  else if (pCurrStatement->type == STATEMENT_TYPE_INSTRUCTION)
  {
  }
  else
  {
  }
 }
 return nErrorCode;
}

variable_types: struct statement_t { enum statement_type_t { STATEMENT_TYPE_EMPTY=0, STATEMENT_TYPE_COMMENT=1, STATEMENT_TYPE_DIRECTIVE=2, STATEMENT_TYPE_INSTRUCTION=3, STATEMENT_TYPE_ERROR=4 } type; char *szLabel; union { struct directive_statement_t { int name; } directive; struct instruction_statement_t { int name; char *modifiers; } instruction; } info; char *szOperationData; char szContent[80]; } *

variable_types:
nNumOfStatements
unsigned long

variable_types: struct symbol_t { enum address_locality_t { ADDR_INVALID=0, ADDR_ABSOLUTE=1, ADDR_RELOCATABLE=2, ADDR_EXTERNAL=3, ADDR_ENTRY=4 } locality; char name[-1]; unsigned long address; } [1000]

variable_types: struct code_section_t { struct machine_cell_t { unsigned int val; } content[2000]; enum address_locality_t { ADDR_INVALID=0, ADDR_ABSOLUTE=1, ADDR_RELOCATABLE=2, ADDR_EXTERNAL=3, ADDR_ENTRY=4 } localities[2000]; unsigned int IC; } *

variable_types:
nCurrLine
unsigned long

variable_types: nErrorCode int

user_defined_types: struct statement_t { enum statement_type_t type; char *szLabel; union { struct directive_statement_t directive; struct instruction_statement_t instruction; } info; char *szOperationData; char szContent[80]; }

user_defined_types: struct symbol_t { enum address_locality_t locality; char name[-1]; unsigned long address; }

user_defined_types: struct code_section_t { struct machine_cell_t content[2000]; enum address_locality_t localities[2000]; unsigned int IC; }


decompiled_code:
int __cdecl main(int argc, const char **argv, const char **envp)
{
return 0;
}

original_code:
int main(int argc, char** argv)
{
 return 0;
}

canonical_original_code:
int main(int argc, char **argv)
{
 return 0;
}


rshift

repo: Caltoopia/caltoopia-calvin

decompiled_code:
__int64 __fastcall rshift(int a1, char a2)
{
return (unsigned int)(a1 >> a2);
}

canonical_decompiled_code:
__int64 __fastcall func6(int a1, char a2)
{
return (unsigned int)(a1 >> a2);
}

original_code: static inline int32_t rshift(int32_t x, int32_t n) { return x >> n; }

canonical_original_code: static inline int rshift(int x, int n) { return x >> n; }

variable_types: x int

variable_types: n int


decompiled_code:
__int64 __fastcall RVC_decoder__motion_U__interpolationcompensate(__int64 a1, unsigned int a2, int a3, int a4, int a5)
{
__int64 result; // rax
int v6; // esi
int v7; // er9
int v8; // eax

result = a2;
v6 = *(_DWORD *)(a1 + 84);
if ( v6 )
{
v7 = *(_DWORD *)(a1 + 128);
if ( v6 == 1 )
{
result = rshift((int)result + a4 + 1 - v7, 1);
}
else
{
v8 = a3 + result;
if ( v6 == 2 )
result = rshift(v8 + 1 - v7, 1);
else
result = rshift(a5 + a4 + v8 + 2 - v7, 2);
}
}
return result;
}

canonical_decompiled_code:
__int64 __fastcall func7(__int64 a1, unsigned int a2, int a3, int a4, int a5)
{
__int64 result; // rax
int v6; // esi
int v7; // er9
int v8; // eax

result = a2;
v6 = *(_DWORD *)(a1 + 84);
if ( v6 )
{
v7 = *(_DWORD *)(a1 + 128);
if ( v6 == 1 )
{
result = func6((int)result + a4 + 1 - v7, 1);
}
else
{
v8 = a3 + result;
if ( v6 == 2 )
result = func6(v8 + 1 - v7, 1);
else
result = func6(a5 + a4 + v8 + 2 - v7, 2);
}
}
return result;
}

original_code:
static inline int32_t RVC_decoder__motion_U__interpolationcompensate(ActorInstance_RVC_decoder__motion_U__interpolation* thisActor, int32_t p00, int32_t p10, int32_t p01, int32_t p11){
  return (((thisActor->flags == 0)) ? (p00):((((thisActor->flags == 1)) ? (rshift((((p00 + p01) + 1) - thisActor->round), 1)):((((thisActor->flags == 2)) ? (rshift((((p00 + p10) + 1) - thisActor->round), 1)):(rshift((((((p00 + p10) + p01) + p11) + 2) - thisActor->round), 2)))))));
}

canonical_original_code:
static inline int RVC_decoder__motion_U__interpolationcompensate(struct ActorInstance_RVC_decoder__motion_U__interpolation *thisActor, int p00, int p10, int p01, int p11){
  return (((thisActor->flags == 0)) ? (p00):((((thisActor->flags == 1)) ? (rshift((((p00 + p01) + 1) - thisActor->round), 1)):((((thisActor->flags == 2)) ? (rshift((((p00 + p10) + 1) - thisActor->round), 1)):(rshift((((((p00 + p10) + p01) + p11) + 2) - thisActor->round), 2)))))));
}

variable_types: struct ActorInstance_RVC_decoder__motion_U__interpolation { struct AbstractActorInstance { struct dllist_link_tag { struct dllist_link_tag *suc; } listEntry; struct ActorClass { unsigned int majorVersion; unsigned int minorVersion; char *name; int sizeActorInstance; int numInputPorts; struct PortDescription { int dummy; char *name; int tokenSize; struct tokenFn { char *(*serialize)(void *, char *); char *(*deserialize)(void **, char *); long (*size)(void *); int (*free)(void *, int); } *functions; } *inputPortDescriptions; int numOutputPorts; struct PortDescription *outputPortDescriptions; int numActions; struct ActionDescription { char *name; int *consumption; int *production; } *actionDescriptions; int *(*action_scheduler)(struct AbstractActorInstance *); void (*constructor)(struct AbstractActorInstance *); void (*destructor)(struct AbstractActorInstance *); void (*set_param)(struct AbstractActorInstance *, char *, char *); } *actorClass; char *instanceName; int numInputPorts; struct InputPort { struct dllist_link_tag asConsumer; struct OutputPort { struct LocalOutputPort { void *bufferStart; void *bufferEnd; void *writePtr; unsigned int spaceLeft; } localOutputPort; unsigned int capacity; unsigned int tokensProduced; unsigned int fullAt; struct tokenFn functions; struct dllist_head_t { struct dllist_link_tag head_element; union pthread_mutex_t { struct __pthread_mutex_s { int __lock; unsigned int __count; int __owner; unsigned int __nusers; int __kind; short __spins; short __elision; struct __pthread_internal_list { struct __pthread_internal_list *__prev; struct __pthread_internal_list *__next; } __list; } __data; char __size[40]; long __align; } mutex; } consumers; } *producer; struct LocalInputPort { void *bufferStart; void *bufferEnd; void *readPtr; unsigned int available; } localInputPort; unsigned int tokensConsumed; unsigned int drainedAt; unsigned int capacity; struct tokenFn functions; } *inputPort; int numOutputPorts; struct OutputPort *outputPort; int *(*action_scheduler)(struct AbstractActorInstance *); } base; int _fsmState; int x; int d5; int flags; int d9; int d1; int d0; int d4; int d6; int d7; int d3; int d2; int y; int d8; int round; } *

user_defined_types: struct ActorInstance_RVC_decoder__motion_U__interpolation { struct AbstractActorInstance base; int _fsmState; int x; int d5; int flags; int d9; int d1; int d0; int d4; int d6; int d7; int d3; int d2; int y; int d8; int round; }

user_defined_types: struct AbstractActorInstance { struct dllist_link_tag listEntry; struct ActorClass *actorClass; char *instanceName; int numInputPorts; struct InputPort *inputPort; int numOutputPorts; struct OutputPort *outputPort; int *(*action_scheduler)(struct AbstractActorInstance *); }

user_defined_types: struct ActorClass { unsigned int majorVersion; unsigned int minorVersion; char *name; int sizeActorInstance; int numInputPorts; struct PortDescription *inputPortDescriptions; int numOutputPorts; struct PortDescription *outputPortDescriptions; int numActions; struct ActionDescription *actionDescriptions; int *(*action_scheduler)(struct AbstractActorInstance *); void (*constructor)(struct AbstractActorInstance *); void (*destructor)(struct AbstractActorInstance *); void (*set_param)(struct AbstractActorInstance *, char *, char *); }

user_defined_types: struct InputPort { struct dllist_link_tag asConsumer; struct OutputPort *producer; struct LocalInputPort localInputPort; unsigned int tokensConsumed; unsigned int drainedAt; unsigned int capacity; struct tokenFn functions; }

user_defined_types: struct PortDescription { int dummy; char *name; int tokenSize; struct tokenFn *functions; }

user_defined_types: struct OutputPort { struct LocalOutputPort localOutputPort; unsigned int capacity; unsigned int tokensProduced; unsigned int fullAt; struct tokenFn functions; struct dllist_head_t consumers; }

user_defined_types: struct dllist_head_t { struct dllist_link_tag head_element; union pthread_mutex_t mutex; }

user_defined_types: union pthread_mutex_t { struct __pthread_mutex_s __data; char __size[40]; long __align; }

user_defined_types: struct __pthread_mutex_s { int __lock; unsigned int __count; int __owner; unsigned int __nusers; int __kind; short __spins; short __elision; struct __pthread_internal_list __list; }


decompiled_code:
void __fastcall ActorInstance_RVC_decoder__motion_U__interpolation_constructor(__int64 a1)
{
*(_DWORD *)(a1 + 72) = 0;
}

canonical_decompiled_code:
void __fastcall func8(__int64 a1)
{
*(_DWORD *)(a1 + 72) = 0;
}

original_code:
static void ActorInstance_RVC_decoder__motion_U__interpolation_constructor(AbstractActorInstance *pBase) {
  ActorInstance_RVC_decoder__motion_U__interpolation *thisActor=(ActorInstance_RVC_decoder__motion_U__interpolation*) pBase;
  thisActor->_fsmState = 0;
  {
  }
}

canonical_original_code:
static void ActorInstance_RVC_decoder__motion_U__interpolation_constructor(struct AbstractActorInstance *pBase) {
  struct ActorInstance_RVC_decoder__motion_U__interpolation *thisActor = (ActorInstance_RVC_decoder__motion_U__interpolation*) pBase;
  thisActor->_fsmState = 0;
  {
  }
}

variable_types: struct AbstractActorInstance { struct dllist_link_tag { struct dllist_link_tag *suc; } listEntry; struct ActorClass { unsigned int majorVersion; unsigned int minorVersion; char *name; int sizeActorInstance; int numInputPorts; struct PortDescription { int dummy; char *name; int tokenSize; struct tokenFn { char *(*serialize)(void *, char *); char *(*deserialize)(void **, char *); long (*size)(void *); int (*free)(void *, int); } *functions; } *inputPortDescriptions; int numOutputPorts; struct PortDescription *outputPortDescriptions; int numActions; struct ActionDescription { char *name; int *consumption; int *production; } *actionDescriptions; int *(*action_scheduler)(struct AbstractActorInstance *); void (*constructor)(struct AbstractActorInstance *); void (*destructor)(struct AbstractActorInstance *); void (*set_param)(struct AbstractActorInstance *, char *, char *); } *actorClass; char *instanceName; int numInputPorts; struct InputPort { struct dllist_link_tag asConsumer; struct OutputPort { struct LocalOutputPort { void *bufferStart; void *bufferEnd; void *writePtr; unsigned int spaceLeft; } localOutputPort; unsigned int capacity; unsigned int tokensProduced; unsigned int fullAt; struct tokenFn functions; struct dllist_head_t { struct dllist_link_tag head_element; union pthread_mutex_t { struct __pthread_mutex_s { int __lock; unsigned int __count; int __owner; unsigned int __nusers; int __kind; short __spins; short __elision; struct __pthread_internal_list { struct __pthread_internal_list *__prev; struct __pthread_internal_list *__next; } __list; } __data; char __size[40]; long __align; } mutex; } consumers; } *producer; struct LocalInputPort { void *bufferStart; void *bufferEnd; void *readPtr; unsigned int available; } localInputPort; unsigned int tokensConsumed; unsigned int drainedAt; unsigned int capacity; struct tokenFn functions; } *inputPort; int numOutputPorts; struct OutputPort *outputPort; int *(*action_scheduler)(struct AbstractActorInstance *); } *


decompiled_code:
__int64 __fastcall pinRead_int32_t(__int64 a1)
{
int v1; // eax
unsigned int *v2; // rcx
unsigned int v3; // er8
_DWORD *v4; // rdx

v1 = *(_DWORD *)(a1 + 24);
v2 = *(unsigned int **)(a1 + 16);
if ( !v1 )
__assert_fail("p->available > 0", "../../actors-fifo.h", 0x6Bu, "pinRead_int32_t");
v3 = *v2;
v4 = v2 + 1;
if ( *(_QWORD *)(a1 + 8) <= (unsigned __int64)(v2 + 1) )
v4 = *(_DWORD **)a1;
*(_QWORD *)(a1 + 16) = v4;
*(_DWORD *)(a1 + 24) = v1 - 1;
return v3;
}

canonical_decompiled_code:
__int64 __fastcall func9(__int64 a1)
{
int v1; // eax
unsigned int *v2; // rcx
unsigned int v3; // er8
_DWORD *v4; // rdx

v1 = *(_DWORD *)(a1 + 24);
v2 = *(unsigned int **)(a1 + 16);
if ( !v1 )
__assert_fail("p->available > 0", "../../actors-fifo.h", 0x6Bu, "pinRead_int32_t");
v3 = *v2;
v4 = v2 + 1;
if ( *(_QWORD *)(a1 + 8) <= (unsigned __int64)(v2 + 1) )
v4 = *(_DWORD **)a1;
*(_QWORD *)(a1 + 16) = v4;
*(_DWORD *)(a1 + 24) = v1 - 1;
return v3;
}

original_code:
static inline int32_t pinRead_int32_t(LocalInputPort *p)
{
  const int32_t *readPtr=(const int32_t *) p->readPtr;
  int32_t result;
  ((void) sizeof ((p->available > 0) ? 1 : 0), __extension__ ({ if (p->available > 0) ; else __assert_fail ("p->available > 0", "../../actors-fifo.h", 107, __extension__ __PRETTY_FUNCTION__); }));
  result = (int32_t) *readPtr++;
  if (readPtr >= (const int32_t*) p->bufferEnd)
    readPtr = (const int32_t*)p->bufferStart;
  p->readPtr=readPtr;
  p->available--;
  return result;
}

canonical_original_code:
static inline int pinRead_int32_t(struct LocalInputPort *p)
{
  int *readPtr = (const int32_t *) p->readPtr;
  int result;
  ((void) sizeof ((p->available > 0) ? 1 : 0), __extension__ ({ if (p->available > 0) ; else __assert_fail ("p->available > 0", "../../actors-fifo.h", 107, __extension__ __PRETTY_FUNCTION__); }));
  result = (int) *readPtr++;
  if (readPtr >= (int *) p->bufferEnd)
    readPtr = (int *)p->bufferStart;
  p->readPtr=readPtr;
  p->available--;
  return result;
}

variable_types: struct LocalInputPort { void *bufferStart; void *bufferEnd; void *readPtr; unsigned int available; } *

variable_types:
readPtr
int *

variable_types: result int