decompiled_code:
__int64 __fastcall ringbuffer_write(__int64 a1, char *a2, unsigned int a3)
{
unsigned int v6; // eax
__int64 result; // rax
char *v8; // r14
char *v9; // rdi
unsigned int v10; // esi

v6 = ringbuffer_empty((_DWORD *)a1);
if ( v6 <= a3 )
a3 = v6;
result = 0LL;
if ( a3 )
{
v8 = *(char **)(a1 + 16);
v9 = &v8[*(unsigned int *)(a1 + 4)];
v10 = *(_DWORD *)a1 - *(_DWORD *)(a1 + 4);
if ( v10 <= a3 )
{
memcpy(v9, a2, v10);
memcpy(v8, &a2[v10], *(_DWORD *)(a1 + 4) + a3 - *(_DWORD *)a1);
*(_DWORD *)(a1 + 4) = *(_DWORD *)(a1 + 4) + a3 - *(_DWORD *)a1;
}
else
{
memcpy(v9, a2, a3);
*(_DWORD *)(a1 + 4) += a3;
}
result = a3;
}
return result;
}

canonical_decompiled_code:
__int64 __fastcall func5(__int64 a1, char *a2, unsigned int a3)
{
unsigned int v6; // eax
__int64 result; // rax
char *v8; // r14
char *v9; // rdi
unsigned int v10; // esi

v6 = func3((_DWORD *)a1);
if ( v6 <= a3 )
a3 = v6;
result = 0LL;
if ( a3 )
{
v8 = *(char **)(a1 + 16);
v9 = &v8[*(unsigned int *)(a1 + 4)];
v10 = *(_DWORD *)a1 - *(_DWORD *)(a1 + 4);
if ( v10 <= a3 )
{
memcpy(v9, a2, v10);
memcpy(v8, &a2[v10], *(_DWORD *)(a1 + 4) + a3 - *(_DWORD *)a1);
*(_DWORD *)(a1 + 4) = *(_DWORD *)(a1 + 4) + a3 - *(_DWORD *)a1;
}
else
{
memcpy(v9, a2, a3);
*(_DWORD *)(a1 + 4) += a3;
}
result = a3;
}
return result;
}

original_code:
int ringbuffer_write(ringbuffer_t *buf, const void *data, unsigned int size)
{
 char *b = (char *)buf->data;
 unsigned int left = ringbuffer_empty(buf);
 unsigned int wlen = (((size)<(left))?(size):(left));
 char *to = b + buf->in;
 if (wlen == 0) {
  return 0;
 } else if (wlen < (buf->size - buf->in)) {
  memcpy(to, data, wlen);
  buf->in += wlen;
 } else {
  const char *d2 = (const char *)data + (buf->size - buf->in);
  memcpy(to, data, buf->size - buf->in);
  memcpy(b, d2, wlen - (buf->size - buf->in));
  buf->in = wlen - (buf->size - buf->in);
 }
 return wlen;
}

canonical_original_code:
int ringbuffer_write(struct ringbuffer *buf, void *data, unsigned int size)
{
 char *b = (char *)buf->data;
 unsigned int left = ringbuffer_empty(buf);
 unsigned int wlen = (((size)<(left))?(size):(left));
 char *to = b + buf->in;
 if (wlen == 0) {
  return 0;
 } else if (wlen < (buf->size - buf->in)) {
  memcpy(to, data, wlen);
  buf->in += wlen;
 } else {
  char *d2 = (const char *)data + (buf->size - buf->in);
  memcpy(to, data, buf->size - buf->in);
  memcpy(b, d2, wlen - (buf->size - buf->in));
  buf->in = wlen - (buf->size - buf->in);
 }
 return wlen;
}

variable_types:
data
void *

variable_types:
b
char *

variable_types:
left
unsigned int

variable_types:
wlen
unsigned int

variable_types:
to
char *


repo: courtc/imager

decompiled_code:
__int64 __fastcall ringbuffer_read(__int64 a1, char *a2, unsigned int a3)
{
unsigned int v6; // eax
__int64 result; // rax
char *v8; // r14
char *v9; // rsi
unsigned int v10; // edi

v6 = ringbuffer_full((_DWORD *)a1);
if ( v6 <= a3 )
a3 = v6;
result = 0LL;
if ( a3 )
{
v8 = *(char **)(a1 + 16);
v9 = &v8[*(unsigned int *)(a1 + 8)];
v10 = *(_DWORD *)a1 - *(_DWORD *)(a1 + 8);
if ( v10 <= a3 )
{
memcpy(a2, v9, v10);
memcpy(&a2[v10], v8, *(_DWORD *)(a1 + 8) + a3 - *(_DWORD *)a1);
*(_DWORD *)(a1 + 8) = *(_DWORD *)(a1 + 8) + a3 - *(_DWORD *)a1;
}
else
{
memcpy(a2, v9, a3);
*(_DWORD *)(a1 + 8) += a3;
}
result = a3;
}
return result;
}

canonical_decompiled_code:
__int64 __fastcall func6(__int64 a1, char *a2, unsigned int a3)
{
unsigned int v6; // eax
__int64 result; // rax
char *v8; // r14
char *v9; // rsi
unsigned int v10; // edi

v6 = func4((_DWORD *)a1);
if ( v6 <= a3 )
a3 = v6;
result = 0LL;
if ( a3 )
{
v8 = *(char **)(a1 + 16);
v9 = &v8[*(unsigned int *)(a1 + 8)];
v10 = *(_DWORD *)a1 - *(_DWORD *)(a1 + 8);
if ( v10 <= a3 )
{
memcpy(a2, v9, v10);
memcpy(&a2[v10], v8, *(_DWORD *)(a1 + 8) + a3 - *(_DWORD *)a1);
*(_DWORD *)(a1 + 8) = *(_DWORD *)(a1 + 8) + a3 - *(_DWORD *)a1;
}
else
{
memcpy(a2, v9, a3);
*(_DWORD *)(a1 + 8) += a3;
}
result = a3;
}
return result;
}

original_code:
int ringbuffer_read(ringbuffer_t *buf, void *data, unsigned int size)
{
 const char *b = (const char *)buf->data;
 unsigned int left = ringbuffer_full(buf);
 unsigned int rlen = (((size)<(left))?(size):(left));
 const char *from = b + buf->out;
 if (rlen == 0) {
  return 0;
 } else if (rlen < (buf->size - buf->out)) {
  memcpy(data, from, rlen);
  buf->out += rlen;
 } else {
  char *d2 = (char *)data + (buf->size - buf->out);
  memcpy(data, from, buf->size - buf->out);
  memcpy(d2, b, rlen - (buf->size - buf->out));
  buf->out = rlen - (buf->size - buf->out);
 }
 return rlen;
}

canonical_original_code:
int ringbuffer_read(struct ringbuffer *buf, void *data, unsigned int size)
{
 char *b = (const char *)buf->data;
 unsigned int left = ringbuffer_full(buf);
 unsigned int rlen = (((size)<(left))?(size):(left));
 char *from = b + buf->out;
 if (rlen == 0) {
  return 0;
 } else if (rlen < (buf->size - buf->out)) {
  memcpy(data, from, rlen);
  buf->out += rlen;
 } else {
  char *d2 = (char *)data + (buf->size - buf->out);
  memcpy(data, from, buf->size - buf->out);
  memcpy(d2, b, rlen - (buf->size - buf->out));
  buf->out = rlen - (buf->size - buf->out);
 }
 return rlen;
}

variable_types: struct ringbuffer { unsigned int size; unsigned int in; unsigned int out; void *data; } *

variable_types:
size
unsigned int

variable_types:
rlen
unsigned int

variable_types:
from
char *

return_type: int


decompiled_code:
__int64 __fastcall mime_matches_magicx(__int64 a1, unsigned int a2, __int64 a3, int a4)
{
__int64 v4; // rbp
unsigned int v5; // er12
_BOOL4 v6; // eax
int v7; // edx
unsigned int v8; // ebx
__int64 v9; // rcx
__int64 i; // rax
__int64 v12; // [rsp+8h] [rbp-60h]
char s1[88]; // [rsp+10h] [rbp-58h] BYREF

if ( a4 <= 0 )
return a2;
v4 = a3;
v12 = a3 + 24LL * (unsigned int)(a4 - 1) + 24;
v5 = a2;
do
{
v8 = *(_DWORD *)(v4 + 16);
memcpy(s1, (const void *)(a1 + *(unsigned int *)(v4 + 20)), v8);
v9 = *(_QWORD *)(v4 + 8);
if ( v9 && v8 )
{
for ( i = 0LL; i != v8; ++i )
s1[i] &= *(_BYTE *)(v9 + i);
}
v6 = memcmp(s1, *(const void **)v4, v8) == 0;
v7 = v6 & v5;
v5 |= v6;
if ( a2 )
v5 = v7;
if ( v5 != a2 )
break;
v4 += 24LL;
}
while ( v4 != v12 );
return v5;
}

canonical_decompiled_code:
__int64 __fastcall func0(__int64 a1, unsigned int a2, __int64 a3, int a4)
{
__int64 v4; // rbp
unsigned int v5; // er12
_BOOL4 v6; // eax
int v7; // edx
unsigned int v8; // ebx
__int64 v9; // rcx
__int64 i; // rax
__int64 v12; // [rsp+8h] [rbp-60h]
char s1[88]; // [rsp+10h] [rbp-58h] BYREF

if ( a4 <= 0 )
return a2;
v4 = a3;
v12 = a3 + 24LL * (unsigned int)(a4 - 1) + 24;
v5 = a2;
do
{
v8 = *(_DWORD *)(v4 + 16);
memcpy(s1, (const void *)(a1 + *(unsigned int *)(v4 + 20)), v8);
v9 = *(_QWORD *)(v4 + 8);
if ( v9 && v8 )
{
for ( i = 0LL; i != v8; ++i )
s1[i] &= *(_BYTE *)(v9 + i);
}
v6 = memcmp(s1, *(const void **)v4, v8) == 0;
v7 = v6 & v5;
v5 |= v6;
if ( a2 )
v5 = v7;
if ( v5 != a2 )
break;
v4 += 24LL;
}
while ( v4 != v12 );
return v5;
}

original_code:
static int mime_matches_magicx(char *text, int or0_and1,
  const struct magic *m, int count)
{
 char buf[32];
 int match = or0_and1;
 int i;
 for (i = 0; i < count; ++i) {
  int res;
  memcpy(buf, text + m[i].off, m[i].len);
  if (m[i].mask != ((void *)0)) {
   unsigned int j;
   for (j = 0; j < m[i].len; ++j)
    buf[j] &= m[i].mask[j];
  }
  res = !memcmp(buf, m[i].magic, m[i].len);
  if (or0_and1)
   match &= res;
  else
   match |= res;
  if (match != or0_and1)
   break;
 }
 return match;
}

canonical_original_code:
static int mime_matches_magicx(char *text, int or0_and1, struct magic *m, int count)
{
 char buf[32];
 int match = or0_and1;
 int i;
 for (i = 0; i < count; ++i) {
  int res;
  memcpy(buf, text + m[i].off, m[i].len);
  if (m[i].mask != ((void *)0)) {
   unsigned int j;
   for (j = 0; j < m[i].len; ++j)
    buf[j] &= m[i].mask[j];
  }
  res = !memcmp(buf, m[i].magic, m[i].len);
  if (or0_and1)
   match &= res;
  else
   match |= res;
  if (match != or0_and1)
   break;
 }
 return match;
}

variable_types:
text
char *

variable_types: struct magic { char *magic; char *mask; unsigned int len; unsigned int off; } *

variable_types: count int

variable_types:
buf
char [32]

variable_types: match int

variable_types: i int

variable_types: res int

variable_types:
j
unsigned int


LoadJPEG

decompiled_code:
__int64 __fastcall LoadJPEG(__int64 a1, unsigned int a2, _DWORD *a3, _DWORD *a4, _QWORD *a5)
{
_DWORD *v8; // rax

v8 = jpeg_decode(a1, a2);
if ( !v8 )
return 0xFFFFFFFFLL;
*a3 = *v8;
*a4 = v8[1];
*a5 = *((_QWORD *)v8 + 1);
free(v8);
return 0LL;
}

canonical_decompiled_code:
__int64 __fastcall func6(__int64 a1, unsigned int a2, _DWORD *a3, _DWORD *a4, _QWORD *a5)
{
_DWORD *v8; // rax

v8 = jpeg_decode(a1, a2);
if ( !v8 )
return 0xFFFFFFFFLL;
*a3 = *v8;
*a4 = v8[1];
*a5 = *((_QWORD *)v8 + 1);
free(v8);
return 0LL;
}

original_code:
int LoadJPEG(void *pRaw, int rawlen, unsigned int *puWidth, unsigned int *puHeight, void **ppData) {
  decjpeg_t *pJPEG;
  pJPEG = jpeg_decode(pRaw,rawlen);
  if( pJPEG == ((void *)0) )
    return -1;
  *puWidth = pJPEG->width;
  *puHeight = pJPEG->height;
  *ppData = pJPEG->pData;
  free(pJPEG);
  return 0;
}

canonical_original_code:
int LoadJPEG(void *pRaw, int rawlen, unsigned int *puWidth, unsigned int *puHeight, void **ppData) {
  struct decjpeg_t *pJPEG;
  pJPEG = jpeg_decode(pRaw,rawlen);
  if( pJPEG == ((void *)0) )
    return -1;
  *puWidth = pJPEG->width;
  *puHeight = pJPEG->height;
  *ppData = pJPEG->pData;
  free(pJPEG);
  return 0;
}

variable_types:
pRaw
void *

variable_types: rawlen int

variable_types:
puWidth
unsigned int *

variable_types:
puHeight
unsigned int *

variable_types:
ppData
void **

variable_types: struct decjpeg_t { int width; void *pData; } *


repo: coverclock/com-diag-diminuto

decompiled_code:
void __fastcall diminuto_interrupter_handler(int a1)
{
if ( a1 == 2 && signaled != 0x7FFFFFFF )
++signaled;
}

canonical_decompiled_code:
void __fastcall func0(int a1)
{
if ( a1 == 2 && signaled != 0x7FFFFFFF )
++signaled;
}

original_code:
static void diminuto_interrupter_handler(int signum)
{
    int mysignaled = -1;
    static const int MAXIMUM = ~(((int)1) << ((sizeof(signaled) * 8) - 1));
    if (signum == 2) {
        mysignaled = signaled;
        if (mysignaled < MAXIMUM) {
            mysignaled += 1;
            signaled = mysignaled;
        }
    }
}

canonical_original_code:
static void diminuto_interrupter_handler(int signum)
{
    int mysignaled = -1;
    static int MAXIMUM = ~(((int)1) << ((sizeof(signaled) * 8) - 1));
    if (signum == 2) {
        mysignaled = signaled;
        if (mysignaled < MAXIMUM) {
            mysignaled += 1;
            signaled = mysignaled;
        }
    }
}

variable_types: signum int

variable_types: mysignaled int

variable_types: MAXIMUM int

return_type: void


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

if ( kill(a1, 2) < 0 )
{
diminuto_log_perror("src/diminuto_interrupter.c", 35LL, "diminuto_interrupter_signal: kill");
result = 0xFFFFFFFFLL;
}
else
{
result = diminuto_interrupter_debug[0];
if ( diminuto_interrupter_debug[0] )
{
result = diminuto_log_mask & 1;
if ( (diminuto_log_mask & 1) != 0 )
{
diminuto_log_log(7LL, "diminuto_interrupter_signal: SIGINT");
result = 0LL;
}
}
}
return result;
}

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

if ( kill(a1, 2) < 0 )
{
diminuto_log_perror("src/diminuto_interrupter.c", 35LL, "diminuto_interrupter_signal: kill");
result = 0xFFFFFFFFLL;
}
else
{
result = diminuto_interrupter_debug[0];
if ( diminuto_interrupter_debug[0] )
{
result = diminuto_log_mask & 1;
if ( (diminuto_log_mask & 1) != 0 )
{
diminuto_log_log(7LL, "diminuto_interrupter_signal: SIGINT");
result = 0LL;
}
}
}
return result;
}

original_code:
int diminuto_interrupter_signal(pid_t pid)
{
    int rc = 0;
    if (kill(pid, 2) < 0) {
        diminuto_log_perror("src/diminuto_interrupter.c", 35, "diminuto_interrupter_signal: kill");
        rc = -1;
    } else if (diminuto_interrupter_debug) {
        ((((diminuto_log_mask) & (DIMINUTO_LOG_MASK_DEBUG)) != 0) ? diminuto_log_log(DIMINUTO_LOG_PRIORITY_DEBUG, "diminuto_interrupter_signal: SIGINT") : ((void)0));
    } else {
    }
    return rc;
}

canonical_original_code:
int diminuto_interrupter_signal(int pid)
{
    int rc = 0;
    if (kill(pid, 2) < 0) {
        diminuto_log_perror("src/diminuto_interrupter.c", 35, "diminuto_interrupter_signal: kill");
        rc = -1;
    } else if (diminuto_interrupter_debug) {
        ((((diminuto_log_mask) & (DIMINUTO_LOG_MASK_DEBUG)) != 0) ? diminuto_log_log(DIMINUTO_LOG_PRIORITY_DEBUG, "diminuto_interrupter_signal: SIGINT") : ((void)0));
    } else {
    }
    return rc;
}

variable_types: pid int

variable_types: rc int


decompiled_code:
__int64 diminuto_interrupter_check()
{
unsigned int v1; // [rsp+Ch] [rbp-17Ch]
int v2; // [rsp+1Ch] [rbp-16Ch] BYREF
struct __jmp_buf_tag env; // [rsp+20h] [rbp-168h] BYREF
char v4[136]; // [rsp+100h] [rbp-88h] BYREF

v1 = -1;
if ( (unsigned int)diminuto_criticalsection_lock(&mutex) )
{
v1 = -1;
LABEL_11:
if ( diminuto_interrupter_debug[0] && (diminuto_log_mask & 1) != 0 )
diminuto_log_log(7LL, "diminuto_interrupter_check: SIGINT");
return v1;
}
if ( _sigsetjmp(&env, 0) )
{
diminuto_criticalsection_cleanup(&mutex);
_pthread_unwind_next((__pthread_unwind_buf_t *)&env);
}
_pthread_register_cancel((__pthread_unwind_buf_t *)&env);
v2 = 2;
if ( !(unsigned int)diminuto_uninterruptiblesection_block(&v2, 1LL, v4) )
{
if ( _sigsetjmp((struct __jmp_buf_tag *)&env.__saved_mask.__val[5], 0) )
{
diminuto_uninterruptiblesection_cleanup(v4);
_pthread_unwind_next((__pthread_unwind_buf_t *)&env.__saved_mask.__val[5]);
}
_pthread_register_cancel((__pthread_unwind_buf_t *)&env.__saved_mask.__val[5]);
v1 = signaled;
signaled = 0;
_pthread_unregister_cancel((__pthread_unwind_buf_t *)&env.__saved_mask.__val[5]);
diminuto_uninterruptiblesection_cleanup(v4);
}
_pthread_unregister_cancel((__pthread_unwind_buf_t *)&env);
diminuto_criticalsection_cleanup(&mutex);
if ( v1 )
goto LABEL_11;
return v1;
}

canonical_decompiled_code:
__int64 func2()
{
unsigned int v1; // [rsp+Ch] [rbp-17Ch]
int v2; // [rsp+1Ch] [rbp-16Ch] BYREF
struct __jmp_buf_tag env; // [rsp+20h] [rbp-168h] BYREF
char v4[136]; // [rsp+100h] [rbp-88h] BYREF

v1 = -1;
if ( (unsigned int)diminuto_criticalsection_lock(&mutex) )
{
v1 = -1;
LABEL_11:
if ( diminuto_interrupter_debug[0] && (diminuto_log_mask & 1) != 0 )
diminuto_log_log(7LL, "diminuto_interrupter_check: SIGINT");
return v1;
}
if ( _sigsetjmp(&env, 0) )
{
diminuto_criticalsection_cleanup(&mutex);
_pthread_unwind_next((__pthread_unwind_buf_t *)&env);
}
_pthread_register_cancel((__pthread_unwind_buf_t *)&env);
v2 = 2;
if ( !(unsigned int)diminuto_uninterruptiblesection_block(&v2, 1LL, v4) )
{
if ( _sigsetjmp((struct __jmp_buf_tag *)&env.__saved_mask.__val[5], 0) )
{
diminuto_uninterruptiblesection_cleanup(v4);
_pthread_unwind_next((__pthread_unwind_buf_t *)&env.__saved_mask.__val[5]);
}
_pthread_register_cancel((__pthread_unwind_buf_t *)&env.__saved_mask.__val[5]);
v1 = signaled;
signaled = 0;
_pthread_unregister_cancel((__pthread_unwind_buf_t *)&env.__saved_mask.__val[5]);
diminuto_uninterruptiblesection_cleanup(v4);
}
_pthread_unregister_cancel((__pthread_unwind_buf_t *)&env);
diminuto_criticalsection_cleanup(&mutex);
if ( v1 )
goto LABEL_11;
return v1;
}

original_code:
int diminuto_interrupter_check(void)
{
    int mysignaled = -1;
    do { pthread_mutex_t * _diminuto_criticalsection_mp; _diminuto_criticalsection_mp = (&mutex); if (diminuto_criticalsection_lock(_diminuto_criticalsection_mp) == 0) { do { __pthread_unwind_buf_t __cancel_buf; void (*__cancel_routine) (void *) = (diminuto_criticalsection_cleanup); void *__cancel_arg = (_diminuto_criticalsection_mp); int __not_first_call = __sigsetjmp ((struct __jmp_buf_tag *) (void *) __cancel_buf.__cancel_jmp_buf, 0); if (__builtin_expect ((__not_first_call), 0)) { __cancel_routine (__cancel_arg); __pthread_unwind_next (&__cancel_buf); } __pthread_register_cancel (&__cancel_buf); do {; do { ((void)0);
        do { const int _diminuto_uninterrutiblesection_signals[] = { 2 }; sigset_t _diminuto_uninterruptiblesection_set; if (diminuto_uninterruptiblesection_block(_diminuto_uninterrutiblesection_signals, (sizeof(_diminuto_uninterrutiblesection_signals) / sizeof(_diminuto_uninterrutiblesection_signals[0])), &_diminuto_uninterruptiblesection_set) == 0) { do { __pthread_unwind_buf_t __cancel_buf; void (*__cancel_routine) (void *) = (diminuto_uninterruptiblesection_cleanup); void *__cancel_arg = (&_diminuto_uninterruptiblesection_set); int __not_first_call = __sigsetjmp ((struct __jmp_buf_tag *) (void *) __cancel_buf.__cancel_jmp_buf, 0); if (__builtin_expect ((__not_first_call), 0)) { __cancel_routine (__cancel_arg); __pthread_unwind_next (&__cancel_buf); } __pthread_register_cancel (&__cancel_buf); do {; do { ((void)0);
            mysignaled = signaled;
            signaled = 0;
        } while (0); do { } while (0); } while (0); __pthread_unregister_cancel (&__cancel_buf); if (!0) __cancel_routine (__cancel_arg); } while (0); } } while (0);
    } while (0); do { } while (0); } while (0); __pthread_unregister_cancel (&__cancel_buf); if (!0) __cancel_routine (__cancel_arg); } while (0); } } while (0);
    if (!mysignaled) {
    } else if (diminuto_interrupter_debug) {
        ((((diminuto_log_mask) & (DIMINUTO_LOG_MASK_DEBUG)) != 0) ? diminuto_log_log(DIMINUTO_LOG_PRIORITY_DEBUG, "diminuto_interrupter_check: SIGINT") : ((void)0));
    } else {
    }
    return mysignaled;
}

canonical_original_code:
int diminuto_interrupter_check()
{
    int mysignaled = -1;
    do { union pthread_mutex_t *_diminuto_criticalsection_mp; _diminuto_criticalsection_mp = (&mutex); if (diminuto_criticalsection_lock(_diminuto_criticalsection_mp) == 0) { do { struct __pthread_unwind_buf_t __cancel_buf; void (*__cancel_routine)(void *) = (diminuto_criticalsection_cleanup); void *__cancel_arg = (_diminuto_criticalsection_mp); int __not_first_call = __sigsetjmp ((struct __jmp_buf_tag *) (void *) __cancel_buf.__cancel_jmp_buf, 0); if (__builtin_expect ((__not_first_call), 0)) { __cancel_routine (__cancel_arg); __pthread_unwind_next (&__cancel_buf); } __pthread_register_cancel (&__cancel_buf); do {; do { ((void)0);
        do { int _diminuto_uninterrutiblesection_signals[] = { 2 }; struct __sigset_t _diminuto_uninterruptiblesection_set; if (diminuto_uninterruptiblesection_block(_diminuto_uninterrutiblesection_signals, (sizeof(_diminuto_uninterrutiblesection_signals) / sizeof(_diminuto_uninterrutiblesection_signals[0])), &_diminuto_uninterruptiblesection_set) == 0) { do { struct __pthread_unwind_buf_t __cancel_buf; void (*__cancel_routine)(void *) = (diminuto_uninterruptiblesection_cleanup); void *__cancel_arg = (&_diminuto_uninterruptiblesection_set); int __not_first_call = __sigsetjmp ((struct __jmp_buf_tag *) (void *) __cancel_buf.__cancel_jmp_buf, 0); if (__builtin_expect ((__not_first_call), 0)) { __cancel_routine (__cancel_arg); __pthread_unwind_next (&__cancel_buf); } __pthread_register_cancel (&__cancel_buf); do {; do { ((void)0);
            mysignaled = signaled;
            signaled = 0;
        } while (0); do { } while (0); } while (0); __pthread_unregister_cancel (&__cancel_buf); if (!0) __cancel_routine (__cancel_arg); } while (0); } } while (0);
    } while (0); do { } while (0); } while (0); __pthread_unregister_cancel (&__cancel_buf); if (!0) __cancel_routine (__cancel_arg); } while (0); } } while (0);
    if (!mysignaled) {
    } else if (diminuto_interrupter_debug) {
        ((((diminuto_log_mask) & (DIMINUTO_LOG_MASK_DEBUG)) != 0) ? diminuto_log_log(DIMINUTO_LOG_PRIORITY_DEBUG, "diminuto_interrupter_check: SIGINT") : ((void)0));
    } else {
    }
    return mysignaled;
}

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; } *

variable_types: struct __pthread_unwind_buf_t { struct { long __cancel_jmp_buf[8]; int __mask_was_saved; } __cancel_jmp_buf[1]; void *__pad[4]; }

variable_types: struct __sigset_t { unsigned long __val[-1]; }

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:
__int64 __fastcall diminuto_interrupter_install(int a1)
{
int v1; // edx
__int64 result; // rax
struct sigaction v3; // [rsp+0h] [rbp-A8h] BYREF

v1 = a1;
memset(&v3.sa_mask, 0, 0x90uLL);
v3.sa_handler = diminuto_interrupter_handler;
if ( a1 )
v1 = 0x10000000;
v3.sa_flags = v1;
if ( sigaction(2, &v3, 0LL) < 0 )
{
diminuto_log_perror("src/diminuto_interrupter.c", 95LL, "diminuto_interrupter_install: sigaction");
result = 0xFFFFFFFFLL;
}
else
{
result = diminuto_interrupter_debug[0];
if ( diminuto_interrupter_debug[0] )
{
result = diminuto_log_mask & 1;
if ( (diminuto_log_mask & 1) != 0 )
{
diminuto_log_log(7LL, "diminuto_interrupter_install: SIGINT");
result = 0LL;
}
}
}
signaled = 0;
return result;
}

canonical_decompiled_code:
__int64 __fastcall func3(int a1)
{
int v1; // edx
__int64 result; // rax
struct sigaction v3; // [rsp+0h] [rbp-A8h] BYREF

v1 = a1;
memset(&v3.sa_mask, 0, 0x90uLL);
v3.sa_handler = diminuto_interrupter_handler;
if ( a1 )
v1 = 0x10000000;
v3.sa_flags = v1;
if ( sigaction(2, &v3, 0LL) < 0 )
{
diminuto_log_perror("src/diminuto_interrupter.c", 95LL, "diminuto_interrupter_install: sigaction");
result = 0xFFFFFFFFLL;
}
else
{
result = diminuto_interrupter_debug[0];
if ( diminuto_interrupter_debug[0] )
{
result = diminuto_log_mask & 1;
if ( (diminuto_log_mask & 1) != 0 )
{
diminuto_log_log(7LL, "diminuto_interrupter_install: SIGINT");
result = 0LL;
}
}
}
signaled = 0;
return result;
}

original_code:
int diminuto_interrupter_install(int restart)
{
    int rc = 0;
    struct sigaction interrupter = { 0 };
    interrupter.__sigaction_handler.sa_handler = diminuto_interrupter_handler;
    interrupter.sa_flags = restart ? 0x10000000 : 0;
    if (sigaction(2, &interrupter, (struct sigaction *)0) < 0) {
        diminuto_log_perror("src/diminuto_interrupter.c", 95, "diminuto_interrupter_install: sigaction");
        rc = -1;
    } else if (diminuto_interrupter_debug) {
        ((((diminuto_log_mask) & (DIMINUTO_LOG_MASK_DEBUG)) != 0) ? diminuto_log_log(DIMINUTO_LOG_PRIORITY_DEBUG, "diminuto_interrupter_install: SIGINT") : ((void)0));
    } else {
    }
    signaled = 0;
    return rc;
}

variable_types: restart int

variable_types: struct sigaction { union { void (*sa_handler)(int); void (*sa_sigaction)(int, struct siginfo_t { int si_signo; int si_errno; int si_code; int __pad0; union { int _pad[-1]; struct { int si_pid; unsigned int si_uid; } _kill; struct { int si_tid; int si_overrun; union sigval { int sival_int; void *sival_ptr; } si_sigval; } _timer; struct { int si_pid; unsigned int si_uid; union sigval si_sigval; } _rt; struct { int si_pid; unsigned int si_uid; int si_status; long si_utime; long si_stime; } _sigchld; struct { void *si_addr; short si_addr_lsb; union { struct { void *_lower; void *_upper; } _addr_bnd; unsigned int _pkey; } _bounds; } _sigfault; struct { long si_band; int si_fd; } _sigpoll; struct { void *_call_addr; int _syscall; unsigned int _arch; } _sigsys; } _sifields; } *, void *); } __sigaction_handler; struct __sigset_t { unsigned long __val[-1]; } sa_mask; int sa_flags; void (*sa_restorer)(); }

user_defined_types: struct sigaction { union { void (*sa_handler)(int); void (*sa_sigaction)(int, struct siginfo_t *, void *); } __sigaction_handler; struct __sigset_t sa_mask; int sa_flags; void (*sa_restorer)(); }

user_defined_types: struct siginfo_t { int si_signo; int si_errno; int si_code; int __pad0; union { int _pad[-1]; struct { int si_pid; unsigned int si_uid; } _kill; struct { int si_tid; int si_overrun; union sigval si_sigval; } _timer; struct { int si_pid; unsigned int si_uid; union sigval si_sigval; } _rt; struct { int si_pid; unsigned int si_uid; int si_status; long si_utime; long si_stime; } _sigchld; struct { void *si_addr; short si_addr_lsb; union { struct { void *_lower; void *_upper; } _addr_bnd; unsigned int _pkey; } _bounds; } _sigfault; struct { long si_band; int si_fd; } _sigpoll; struct { void *_call_addr; int _syscall; unsigned int _arch; } _sigsys; } _sifields; }


decompiled_code:
__int64 f9()
{
unsigned int v0; // ebx

if ( (diminuto_log_mask & 2) != 0 )
diminuto_log_log();
v0 = diminuto_stacktrace();
if ( (diminuto_log_mask & 2) != 0 )
diminuto_log_log();
return v0;
}

canonical_decompiled_code:
__int64 func7()
{
unsigned int v0; // ebx

if ( (diminuto_log_mask & 2) != 0 )
diminuto_log_log();
v0 = diminuto_stacktrace();
if ( (diminuto_log_mask & 2) != 0 )
diminuto_log_log();
return v0;
}

original_code:
int f9(void) {
    int rc;
    ((((diminuto_log_mask) & (DIMINUTO_LOG_MASK_INFORMATION)) != 0) ? diminuto_log_log(DIMINUTO_LOG_PRIORITY_INFORMATION, "tst/unittest-stacktrace.c" "@" "19" ": " "CHECKPOINT: " "f%d\n", 9) : ((void)0));;
    rc = diminuto_stacktrace();
    ((((diminuto_log_mask) & (DIMINUTO_LOG_MASK_INFORMATION)) != 0) ? diminuto_log_log(DIMINUTO_LOG_PRIORITY_INFORMATION, "tst/unittest-stacktrace.c" "@" "21" ": " "CHECKPOINT: " "f%d %d\n", 9, rc) : ((void)0));;
    return rc;
}

canonical_original_code:
int f9() {
    int rc;
    ((((diminuto_log_mask) & (DIMINUTO_LOG_MASK_INFORMATION)) != 0) ? diminuto_log_log(DIMINUTO_LOG_PRIORITY_INFORMATION, "tst/unittest-stacktrace.c" "@" "19" ": " "CHECKPOINT: " "f%d\n", 9) : ((void)0));;
    rc = diminuto_stacktrace();
    ((((diminuto_log_mask) & (DIMINUTO_LOG_MASK_INFORMATION)) != 0) ? diminuto_log_log(DIMINUTO_LOG_PRIORITY_INFORMATION, "tst/unittest-stacktrace.c" "@" "21" ": " "CHECKPOINT: " "f%d %d\n", 9, rc) : ((void)0));;
    return rc;
}


decompiled_code:
__int64 f8()
{
unsigned int v0; // ebx

if ( (diminuto_log_mask & 2) != 0 )
diminuto_log_log();
v0 = f9();
if ( (diminuto_log_mask & 2) != 0 )
diminuto_log_log();
return v0;
}

canonical_decompiled_code:
__int64 func8()
{
unsigned int v0; // ebx

if ( (diminuto_log_mask & 2) != 0 )
diminuto_log_log();
v0 = func7();
if ( (diminuto_log_mask & 2) != 0 )
diminuto_log_log();
return v0;
}

original_code:
int f8(void) {
    int rc;
    ((((diminuto_log_mask) & (DIMINUTO_LOG_MASK_INFORMATION)) != 0) ? diminuto_log_log(DIMINUTO_LOG_PRIORITY_INFORMATION, "tst/unittest-stacktrace.c" "@" "27" ": " "CHECKPOINT: " "f%d\n", 8) : ((void)0));;
    rc = f9();
    ((((diminuto_log_mask) & (DIMINUTO_LOG_MASK_INFORMATION)) != 0) ? diminuto_log_log(DIMINUTO_LOG_PRIORITY_INFORMATION, "tst/unittest-stacktrace.c" "@" "29" ": " "CHECKPOINT: " "f%d %d\n", 8, rc) : ((void)0));;
    return rc;
}

canonical_original_code:
int f8() {
    int rc;
    ((((diminuto_log_mask) & (DIMINUTO_LOG_MASK_INFORMATION)) != 0) ? diminuto_log_log(DIMINUTO_LOG_PRIORITY_INFORMATION, "tst/unittest-stacktrace.c" "@" "27" ": " "CHECKPOINT: " "f%d\n", 8) : ((void)0));;
    rc = f9();
    ((((diminuto_log_mask) & (DIMINUTO_LOG_MASK_INFORMATION)) != 0) ? diminuto_log_log(DIMINUTO_LOG_PRIORITY_INFORMATION, "tst/unittest-stacktrace.c" "@" "29" ": " "CHECKPOINT: " "f%d %d\n", 8, rc) : ((void)0));;
    return rc;
}


decompiled_code:
__int64 f7()
{
unsigned int v0; // ebx

if ( (diminuto_log_mask & 2) != 0 )
diminuto_log_log();
v0 = f8();
if ( (diminuto_log_mask & 2) != 0 )
diminuto_log_log();
return v0;
}

canonical_decompiled_code:
__int64 func9()
{
unsigned int v0; // ebx

if ( (diminuto_log_mask & 2) != 0 )
diminuto_log_log();
v0 = func8();
if ( (diminuto_log_mask & 2) != 0 )
diminuto_log_log();
return v0;
}

original_code:
int f7(void) {
    int rc;
    ((((diminuto_log_mask) & (DIMINUTO_LOG_MASK_INFORMATION)) != 0) ? diminuto_log_log(DIMINUTO_LOG_PRIORITY_INFORMATION, "tst/unittest-stacktrace.c" "@" "35" ": " "CHECKPOINT: " "f%d\n", 7) : ((void)0));;
    rc = f8();
    ((((diminuto_log_mask) & (DIMINUTO_LOG_MASK_INFORMATION)) != 0) ? diminuto_log_log(DIMINUTO_LOG_PRIORITY_INFORMATION, "tst/unittest-stacktrace.c" "@" "37" ": " "CHECKPOINT: " "f%d %d\n", 7, rc) : ((void)0));;
    return rc;
}

canonical_original_code:
int f7() {
    int rc;
    ((((diminuto_log_mask) & (DIMINUTO_LOG_MASK_INFORMATION)) != 0) ? diminuto_log_log(DIMINUTO_LOG_PRIORITY_INFORMATION, "tst/unittest-stacktrace.c" "@" "35" ": " "CHECKPOINT: " "f%d\n", 7) : ((void)0));;
    rc = f8();
    ((((diminuto_log_mask) & (DIMINUTO_LOG_MASK_INFORMATION)) != 0) ? diminuto_log_log(DIMINUTO_LOG_PRIORITY_INFORMATION, "tst/unittest-stacktrace.c" "@" "37" ": " "CHECKPOINT: " "f%d %d\n", 7, rc) : ((void)0));;
    return rc;
}


decompiled_code:
__int64 f6()
{
unsigned int v0; // ebx

if ( (diminuto_log_mask & 2) != 0 )
diminuto_log_log();
v0 = f7();
if ( (diminuto_log_mask & 2) != 0 )
diminuto_log_log();
return v0;
}

canonical_decompiled_code:
__int64 func10()
{
unsigned int v0; // ebx

if ( (diminuto_log_mask & 2) != 0 )
diminuto_log_log();
v0 = func9();
if ( (diminuto_log_mask & 2) != 0 )
diminuto_log_log();
return v0;
}

original_code:
int f6(void) {
    int rc;
    ((((diminuto_log_mask) & (DIMINUTO_LOG_MASK_INFORMATION)) != 0) ? diminuto_log_log(DIMINUTO_LOG_PRIORITY_INFORMATION, "tst/unittest-stacktrace.c" "@" "43" ": " "CHECKPOINT: " "f%d\n", 6) : ((void)0));;
    rc = f7();
    ((((diminuto_log_mask) & (DIMINUTO_LOG_MASK_INFORMATION)) != 0) ? diminuto_log_log(DIMINUTO_LOG_PRIORITY_INFORMATION, "tst/unittest-stacktrace.c" "@" "45" ": " "CHECKPOINT: " "f%d %d\n", 6, rc) : ((void)0));;
    return rc;
}

canonical_original_code:
int f6() {
    int rc;
    ((((diminuto_log_mask) & (DIMINUTO_LOG_MASK_INFORMATION)) != 0) ? diminuto_log_log(DIMINUTO_LOG_PRIORITY_INFORMATION, "tst/unittest-stacktrace.c" "@" "43" ": " "CHECKPOINT: " "f%d\n", 6) : ((void)0));;
    rc = f7();
    ((((diminuto_log_mask) & (DIMINUTO_LOG_MASK_INFORMATION)) != 0) ? diminuto_log_log(DIMINUTO_LOG_PRIORITY_INFORMATION, "tst/unittest-stacktrace.c" "@" "45" ": " "CHECKPOINT: " "f%d %d\n", 6, rc) : ((void)0));;
    return rc;
}


decompiled_code:
__int64 f0()
{
unsigned int v0; // ebx

if ( (diminuto_log_mask & 2) != 0 )
diminuto_log_log();
v0 = f1();
if ( (diminuto_log_mask & 2) != 0 )
diminuto_log_log();
return v0;
}

canonical_decompiled_code:
__int64 func16()
{
unsigned int v0; // ebx

if ( (diminuto_log_mask & 2) != 0 )
diminuto_log_log();
v0 = func15();
if ( (diminuto_log_mask & 2) != 0 )
diminuto_log_log();
return v0;
}

original_code:
int f0(void)
{
    int rc;
    ((((diminuto_log_mask) & (DIMINUTO_LOG_MASK_INFORMATION)) != 0) ? diminuto_log_log(DIMINUTO_LOG_PRIORITY_INFORMATION, "tst/unittest-stacktrace.c" "@" "97" ": " "CHECKPOINT: " "f%d\n", 0) : ((void)0));;
    rc = f1();
    ((((diminuto_log_mask) & (DIMINUTO_LOG_MASK_INFORMATION)) != 0) ? diminuto_log_log(DIMINUTO_LOG_PRIORITY_INFORMATION, "tst/unittest-stacktrace.c" "@" "99" ": " "CHECKPOINT: " "f%d %d\n", 0, rc) : ((void)0));;
    return rc;
}

canonical_original_code:
int f0()
{
    int rc;
    ((((diminuto_log_mask) & (DIMINUTO_LOG_MASK_INFORMATION)) != 0) ? diminuto_log_log(DIMINUTO_LOG_PRIORITY_INFORMATION, "tst/unittest-stacktrace.c" "@" "97" ": " "CHECKPOINT: " "f%d\n", 0) : ((void)0));;
    rc = f1();
    ((((diminuto_log_mask) & (DIMINUTO_LOG_MASK_INFORMATION)) != 0) ? diminuto_log_log(DIMINUTO_LOG_PRIORITY_INFORMATION, "tst/unittest-stacktrace.c" "@" "99" ": " "CHECKPOINT: " "f%d %d\n", 0, rc) : ((void)0));;
    return rc;
}


decompiled_code:
__int64 f5()
{
unsigned int v0; // ebx

if ( (diminuto_log_mask & 2) != 0 )
diminuto_log_log();
v0 = f6();
if ( (diminuto_log_mask & 2) != 0 )
diminuto_log_log();
return v0;
}

canonical_decompiled_code:
__int64 func11()
{
unsigned int v0; // ebx

if ( (diminuto_log_mask & 2) != 0 )
diminuto_log_log();
v0 = func10();
if ( (diminuto_log_mask & 2) != 0 )
diminuto_log_log();
return v0;
}

original_code:
int f5(void)
{
    int rc;
    ((((diminuto_log_mask) & (DIMINUTO_LOG_MASK_INFORMATION)) != 0) ? diminuto_log_log(DIMINUTO_LOG_PRIORITY_INFORMATION, "tst/unittest-stacktrace.c" "@" "52" ": " "CHECKPOINT: " "f%d\n", 5) : ((void)0));;
    rc = f6();
    ((((diminuto_log_mask) & (DIMINUTO_LOG_MASK_INFORMATION)) != 0) ? diminuto_log_log(DIMINUTO_LOG_PRIORITY_INFORMATION, "tst/unittest-stacktrace.c" "@" "54" ": " "CHECKPOINT: " "f%d %d\n", 5, rc) : ((void)0));;
    return rc;
}

canonical_original_code:
int f5()
{
    int rc;
    ((((diminuto_log_mask) & (DIMINUTO_LOG_MASK_INFORMATION)) != 0) ? diminuto_log_log(DIMINUTO_LOG_PRIORITY_INFORMATION, "tst/unittest-stacktrace.c" "@" "52" ": " "CHECKPOINT: " "f%d\n", 5) : ((void)0));;
    rc = f6();
    ((((diminuto_log_mask) & (DIMINUTO_LOG_MASK_INFORMATION)) != 0) ? diminuto_log_log(DIMINUTO_LOG_PRIORITY_INFORMATION, "tst/unittest-stacktrace.c" "@" "54" ": " "CHECKPOINT: " "f%d %d\n", 5, rc) : ((void)0));;
    return rc;
}


decompiled_code:
__int64 f4()
{
unsigned int v0; // ebx

if ( (diminuto_log_mask & 2) != 0 )
diminuto_log_log();
v0 = f5();
if ( (diminuto_log_mask & 2) != 0 )
diminuto_log_log();
return v0;
}

canonical_decompiled_code:
__int64 func12()
{
unsigned int v0; // ebx

if ( (diminuto_log_mask & 2) != 0 )
diminuto_log_log();
v0 = func11();
if ( (diminuto_log_mask & 2) != 0 )
diminuto_log_log();
return v0;
}

original_code:
int f4(void)
{
    int rc;
    ((((diminuto_log_mask) & (DIMINUTO_LOG_MASK_INFORMATION)) != 0) ? diminuto_log_log(DIMINUTO_LOG_PRIORITY_INFORMATION, "tst/unittest-stacktrace.c" "@" "61" ": " "CHECKPOINT: " "f%d\n", 4) : ((void)0));;
    rc = f5();
    ((((diminuto_log_mask) & (DIMINUTO_LOG_MASK_INFORMATION)) != 0) ? diminuto_log_log(DIMINUTO_LOG_PRIORITY_INFORMATION, "tst/unittest-stacktrace.c" "@" "63" ": " "CHECKPOINT: " "f%d %d\n", 4, rc) : ((void)0));;
    return rc;
}

canonical_original_code:
int f4()
{
    int rc;
    ((((diminuto_log_mask) & (DIMINUTO_LOG_MASK_INFORMATION)) != 0) ? diminuto_log_log(DIMINUTO_LOG_PRIORITY_INFORMATION, "tst/unittest-stacktrace.c" "@" "61" ": " "CHECKPOINT: " "f%d\n", 4) : ((void)0));;
    rc = f5();
    ((((diminuto_log_mask) & (DIMINUTO_LOG_MASK_INFORMATION)) != 0) ? diminuto_log_log(DIMINUTO_LOG_PRIORITY_INFORMATION, "tst/unittest-stacktrace.c" "@" "63" ": " "CHECKPOINT: " "f%d %d\n", 4, rc) : ((void)0));;
    return rc;
}


decompiled_code:
__int64 f3()
{
unsigned int v0; // ebx

if ( (diminuto_log_mask & 2) != 0 )
diminuto_log_log();
v0 = f4();
if ( (diminuto_log_mask & 2) != 0 )
diminuto_log_log();
return v0;
}

canonical_decompiled_code:
__int64 func13()
{
unsigned int v0; // ebx

if ( (diminuto_log_mask & 2) != 0 )
diminuto_log_log();
v0 = func12();
if ( (diminuto_log_mask & 2) != 0 )
diminuto_log_log();
return v0;
}

original_code:
int f3(void)
{
    int rc;
    ((((diminuto_log_mask) & (DIMINUTO_LOG_MASK_INFORMATION)) != 0) ? diminuto_log_log(DIMINUTO_LOG_PRIORITY_INFORMATION, "tst/unittest-stacktrace.c" "@" "70" ": " "CHECKPOINT: " "f%d\n", 3) : ((void)0));;
    rc = f4();
    ((((diminuto_log_mask) & (DIMINUTO_LOG_MASK_INFORMATION)) != 0) ? diminuto_log_log(DIMINUTO_LOG_PRIORITY_INFORMATION, "tst/unittest-stacktrace.c" "@" "72" ": " "CHECKPOINT: " "f%d %d\n", 3, rc) : ((void)0));;
    return rc;
}

canonical_original_code:
int f3()
{
    int rc;
    ((((diminuto_log_mask) & (DIMINUTO_LOG_MASK_INFORMATION)) != 0) ? diminuto_log_log(DIMINUTO_LOG_PRIORITY_INFORMATION, "tst/unittest-stacktrace.c" "@" "70" ": " "CHECKPOINT: " "f%d\n", 3) : ((void)0));;
    rc = f4();
    ((((diminuto_log_mask) & (DIMINUTO_LOG_MASK_INFORMATION)) != 0) ? diminuto_log_log(DIMINUTO_LOG_PRIORITY_INFORMATION, "tst/unittest-stacktrace.c" "@" "72" ": " "CHECKPOINT: " "f%d %d\n", 3, rc) : ((void)0));;
    return rc;
}


decompiled_code:
__int64 f2()
{
unsigned int v0; // ebx

if ( (diminuto_log_mask & 2) != 0 )
diminuto_log_log();
v0 = f3();
if ( (diminuto_log_mask & 2) != 0 )
diminuto_log_log();
return v0;
}

canonical_decompiled_code:
__int64 func14()
{
unsigned int v0; // ebx

if ( (diminuto_log_mask & 2) != 0 )
diminuto_log_log();
v0 = func13();
if ( (diminuto_log_mask & 2) != 0 )
diminuto_log_log();
return v0;
}

original_code:
int f2(void)
{
    int rc;
    ((((diminuto_log_mask) & (DIMINUTO_LOG_MASK_INFORMATION)) != 0) ? diminuto_log_log(DIMINUTO_LOG_PRIORITY_INFORMATION, "tst/unittest-stacktrace.c" "@" "79" ": " "CHECKPOINT: " "f%d\n", 2) : ((void)0));;
    rc = f3();
    ((((diminuto_log_mask) & (DIMINUTO_LOG_MASK_INFORMATION)) != 0) ? diminuto_log_log(DIMINUTO_LOG_PRIORITY_INFORMATION, "tst/unittest-stacktrace.c" "@" "81" ": " "CHECKPOINT: " "f%d %d\n", 2, rc) : ((void)0));;
    return rc;
}

canonical_original_code:
int f2()
{
    int rc;
    ((((diminuto_log_mask) & (DIMINUTO_LOG_MASK_INFORMATION)) != 0) ? diminuto_log_log(DIMINUTO_LOG_PRIORITY_INFORMATION, "tst/unittest-stacktrace.c" "@" "79" ": " "CHECKPOINT: " "f%d\n", 2) : ((void)0));;
    rc = f3();
    ((((diminuto_log_mask) & (DIMINUTO_LOG_MASK_INFORMATION)) != 0) ? diminuto_log_log(DIMINUTO_LOG_PRIORITY_INFORMATION, "tst/unittest-stacktrace.c" "@" "81" ": " "CHECKPOINT: " "f%d %d\n", 2, rc) : ((void)0));;
    return rc;
}


decompiled_code:
__int64 f1()
{
unsigned int v0; // ebx

if ( (diminuto_log_mask & 2) != 0 )
diminuto_log_log();
v0 = f2();
if ( (diminuto_log_mask & 2) != 0 )
diminuto_log_log();
return v0;
}

canonical_decompiled_code:
__int64 func15()
{
unsigned int v0; // ebx

if ( (diminuto_log_mask & 2) != 0 )
diminuto_log_log();
v0 = func14();
if ( (diminuto_log_mask & 2) != 0 )
diminuto_log_log();
return v0;
}

original_code:
int f1(void)
{
    int rc;
    ((((diminuto_log_mask) & (DIMINUTO_LOG_MASK_INFORMATION)) != 0) ? diminuto_log_log(DIMINUTO_LOG_PRIORITY_INFORMATION, "tst/unittest-stacktrace.c" "@" "88" ": " "CHECKPOINT: " "f%d\n", 1) : ((void)0));;
    rc = f2();
    ((((diminuto_log_mask) & (DIMINUTO_LOG_MASK_INFORMATION)) != 0) ? diminuto_log_log(DIMINUTO_LOG_PRIORITY_INFORMATION, "tst/unittest-stacktrace.c" "@" "90" ": " "CHECKPOINT: " "f%d %d\n", 1, rc) : ((void)0));;
    return rc;
}

canonical_original_code:
int f1()
{
    int rc;
    ((((diminuto_log_mask) & (DIMINUTO_LOG_MASK_INFORMATION)) != 0) ? diminuto_log_log(DIMINUTO_LOG_PRIORITY_INFORMATION, "tst/unittest-stacktrace.c" "@" "88" ": " "CHECKPOINT: " "f%d\n", 1) : ((void)0));;
    rc = f2();
    ((((diminuto_log_mask) & (DIMINUTO_LOG_MASK_INFORMATION)) != 0) ? diminuto_log_log(DIMINUTO_LOG_PRIORITY_INFORMATION, "tst/unittest-stacktrace.c" "@" "90" ": " "CHECKPOINT: " "f%d %d\n", 1, rc) : ((void)0));;
    return rc;
}


main

canonical_name: main

decompiled_code:
// local variable allocation has failed, the output may be wrong!
int __cdecl __noreturn main(int argc, const char **argv, const char **envp)
{
int v3; // ebx
int v4; // ebx
int v5; // edi

diminuto_unittest_setlogmask();
if ( (diminuto_log_mask & 4) != 0 )
{
argv = (const char **)"tst/unittest-stacktrace.c@107: SETLOGMASK: logmask=0x%x\n";
*(_QWORD *)&argc = 5LL;
diminuto_log_log();
}
if ( (diminuto_log_mask & 2) != 0 )
{
argv = (const char **)"tst/unittest-stacktrace.c@109: CHECKPOINT: main\n";
*(_QWORD *)&argc = 6LL;
diminuto_log_log();
}
v3 = f0(*(_QWORD *)&argc, argv);
if ( (diminuto_log_mask & 2) != 0 )
diminuto_log_log();
if ( v3 < 0 )
{
__errno_location();
diminuto_unittest_error();
if ( (diminuto_log_mask & 0x10) != 0 )
diminuto_log_log();
diminuto_stacktrace();
diminuto_unittest_flush();
diminuto_core_fatal();
}
v4 = diminuto_unittest_errors;
if ( (diminuto_log_mask & 4) != 0 )
diminuto_log_log();
diminuto_unittest_flush();
v5 = 255;
if ( v4 <= 255 )
v5 = v4;
exit(v5);
}

canonical_decompiled_code:
int __cdecl __noreturn main(int argc, const char **argv, const char **envp)
{
int v3; // ebx
int v4; // ebx
int v5; // edi

diminuto_unittest_setlogmask();
if ( (diminuto_log_mask & 4) != 0 )
{
argv = (const char **)"tst/unittest-stacktrace.c@107: SETLOGMASK: logmask=0x%x\n";
*(_QWORD *)&argc = 5LL;
diminuto_log_log();
}
if ( (diminuto_log_mask & 2) != 0 )
{
argv = (const char **)"tst/unittest-stacktrace.c@109: CHECKPOINT: main\n";
*(_QWORD *)&argc = 6LL;
diminuto_log_log();
}
v3 = func16(*(_QWORD *)&argc, argv);
if ( (diminuto_log_mask & 2) != 0 )
diminuto_log_log();
if ( v3 < 0 )
{
__errno_location();
diminuto_unittest_error();
if ( (diminuto_log_mask & 0x10) != 0 )
diminuto_log_log();
diminuto_stacktrace();
diminuto_unittest_flush();
diminuto_core_fatal();
}
v4 = diminuto_unittest_errors;
if ( (diminuto_log_mask & 4) != 0 )
diminuto_log_log();
diminuto_unittest_flush();
v5 = 255;
if ( v4 <= 255 )
v5 = v4;
exit(v5);
}

original_code:
int main(int argc, char ** argv)
{
    int count;
    do { diminuto_unittest_setlogmask(); ((((diminuto_log_mask) & (DIMINUTO_LOG_MASK_NOTICE)) != 0) ? diminuto_log_log(DIMINUTO_LOG_PRIORITY_NOTICE, "tst/unittest-stacktrace.c" "@" "107" ": " "SETLOGMASK: logmask=0x%x\n", diminuto_log_mask) : ((void)0)); } while (0);
    ((((diminuto_log_mask) & (DIMINUTO_LOG_MASK_INFORMATION)) != 0) ? diminuto_log_log(DIMINUTO_LOG_PRIORITY_INFORMATION, "tst/unittest-stacktrace.c" "@" "109" ": " "CHECKPOINT: " "main\n") : ((void)0));;
    count = f0();
    ((((diminuto_log_mask) & (DIMINUTO_LOG_MASK_INFORMATION)) != 0) ? diminuto_log_log(DIMINUTO_LOG_PRIORITY_INFORMATION, "tst/unittest-stacktrace.c" "@" "113" ": " "CHECKPOINT: " "main %d\n", count) : ((void)0));;
    do { int diminuto_unittest_condition; diminuto_unittest_condition = !!(count >= 0); if (!diminuto_unittest_condition) { int diminuto_unittest_errno; int diminuto_unittest_number; int diminuto_unittest_count; diminuto_unittest_errno = (*__errno_location ()); diminuto_unittest_number = diminuto_unittest_tests; diminuto_unittest_count = diminuto_unittest_error(); ((((diminuto_log_mask) & (DIMINUTO_LOG_MASK_ERROR)) != 0) ? diminuto_log_log(DIMINUTO_LOG_PRIORITY_ERROR, "tst/unittest-stacktrace.c" "@" "115" ": " "ASSERT: tests=%d errors=%d errno=%d !(%s)!\n", diminuto_unittest_number, diminuto_unittest_count, diminuto_unittest_errno, "count >= 0") : ((void)0)); diminuto_stacktrace(); diminuto_unittest_flush(); diminuto_core_fatal(); } } while (0);
    do { int diminuto_unittest_number; int diminuto_unittest_count; diminuto_unittest_number = diminuto_unittest_tests; diminuto_unittest_count = diminuto_unittest_errors; ((((diminuto_log_mask) & (DIMINUTO_LOG_MASK_NOTICE)) != 0) ? diminuto_log_log(DIMINUTO_LOG_PRIORITY_NOTICE, "tst/unittest-stacktrace.c" "@" "117" ": " "EXIT: tests=%d errors=%d %s " "\n", diminuto_unittest_number, diminuto_unittest_count, (diminuto_unittest_count == 0) ? "SUCCESS." : "FAILURE!") : ((void)0)); diminuto_unittest_flush(); exit(diminuto_unittest_count > DIMINUTO_UNITTEST_MAXIMUM ? DIMINUTO_UNITTEST_MAXIMUM : diminuto_unittest_count); } while (0);
}

canonical_original_code:
int main(int argc, char **argv)
{
    int count;
    do { diminuto_unittest_setlogmask(); ((((diminuto_log_mask) & (DIMINUTO_LOG_MASK_NOTICE)) != 0) ? diminuto_log_log(DIMINUTO_LOG_PRIORITY_NOTICE, "tst/unittest-stacktrace.c" "@" "107" ": " "SETLOGMASK: logmask=0x%x\n", diminuto_log_mask) : ((void)0)); } while (0);
    ((((diminuto_log_mask) & (DIMINUTO_LOG_MASK_INFORMATION)) != 0) ? diminuto_log_log(DIMINUTO_LOG_PRIORITY_INFORMATION, "tst/unittest-stacktrace.c" "@" "109" ": " "CHECKPOINT: " "main\n") : ((void)0));;
    count = f0();
    ((((diminuto_log_mask) & (DIMINUTO_LOG_MASK_INFORMATION)) != 0) ? diminuto_log_log(DIMINUTO_LOG_PRIORITY_INFORMATION, "tst/unittest-stacktrace.c" "@" "113" ": " "CHECKPOINT: " "main %d\n", count) : ((void)0));;
    do { int diminuto_unittest_condition; diminuto_unittest_condition = !!(count >= 0); if (!diminuto_unittest_condition) { int diminuto_unittest_errno; int diminuto_unittest_number; int diminuto_unittest_count; diminuto_unittest_errno = (*__errno_location ()); diminuto_unittest_number = diminuto_unittest_tests; diminuto_unittest_count = diminuto_unittest_error(); ((((diminuto_log_mask) & (DIMINUTO_LOG_MASK_ERROR)) != 0) ? diminuto_log_log(DIMINUTO_LOG_PRIORITY_ERROR, "tst/unittest-stacktrace.c" "@" "115" ": " "ASSERT: tests=%d errors=%d errno=%d !(%s)!\n", diminuto_unittest_number, diminuto_unittest_count, diminuto_unittest_errno, "count >= 0") : ((void)0)); diminuto_stacktrace(); diminuto_unittest_flush(); diminuto_core_fatal(); } } while (0);
    do { int diminuto_unittest_number; int diminuto_unittest_count; diminuto_unittest_number = diminuto_unittest_tests; diminuto_unittest_count = diminuto_unittest_errors; ((((diminuto_log_mask) & (DIMINUTO_LOG_MASK_NOTICE)) != 0) ? diminuto_log_log(DIMINUTO_LOG_PRIORITY_NOTICE, "tst/unittest-stacktrace.c" "@" "117" ": " "EXIT: tests=%d errors=%d %s " "\n", diminuto_unittest_number, diminuto_unittest_count, (diminuto_unittest_count == 0) ? "SUCCESS." : "FAILURE!") : ((void)0)); diminuto_unittest_flush(); exit(diminuto_unittest_count > DIMINUTO_UNITTEST_MAXIMUM ? DIMINUTO_UNITTEST_MAXIMUM : diminuto_unittest_count); } while (0);
}

variable_types: argc int

variable_types:
argv
char **

variable_types: count int


decompiled_code:
__int64 diminuto_frequency()
{
return 1000000000LL;
}

original_code:
static inline diminuto_sticks_t diminuto_frequency(void)
{
    return (1000000000LL);
}

canonical_original_code:
static inline long diminuto_frequency()
{
    return (1000000000LL);
}

return_type: long


decompiled_code:
__int16 __fastcall diminuto_ipc_port(_BYTE *a1, const char *a2)
{
const char *v2; // rbx
struct servent *v3; // rax
__int16 result; // ax
_BYTE *v5; // rdx
unsigned __int64 v6; // [rsp+8h] [rbp-10h] BYREF

v6 = 0LL;
v2 = &a1[*a1 == 58];
v3 = getservbyname(v2, a2);
if ( v3 )
return _bswap_16(v3->s_port);
v5 = (_BYTE *)diminuto_number_unsigned(v2, &v6);
result = 0;
if ( !*v5 )
{
result = v6;
if ( v6 > 0xFFFF )
{
*_errno_location() = 22;
diminuto_log_perror("src/diminuto_ipc.c", 61LL, "diminuto_ipc_port: magnitude");
result = 0;
}
}
return result;
}

canonical_decompiled_code:
__int16 __fastcall func4(_BYTE *a1, const char *a2)
{
const char *v2; // rbx
struct servent *v3; // rax
__int16 result; // ax
_BYTE *v5; // rdx
unsigned __int64 v6; // [rsp+8h] [rbp-10h] BYREF

v6 = 0LL;
v2 = &a1[*a1 == 58];
v3 = getservbyname(v2, a2);
if ( v3 )
return func3(v3->s_port);
v5 = (_BYTE *)diminuto_number_unsigned(v2, &v6);
result = 0;
if ( !*v5 )
{
result = v6;
if ( v6 > 0xFFFF )
{
*_errno_location() = 22;
diminuto_log_perror("src/diminuto_ipc.c", 61LL, "diminuto_ipc_port: magnitude");
result = 0;
}
}
return result;
}

original_code:
diminuto_port_t diminuto_ipc_port(const char * service, const char * protocol)
{
    diminuto_port_t port = 0;
    const char * sp = (const char *)0;
    struct servent * portp = (struct servent *)0;
    diminuto_unsigned_t temp = 0;
    const char * end = (const char *)0;
    if (*(sp = service) == ':') { sp += 1; }
    if ((portp = getservbyname(sp, protocol)) != (struct servent *)0) {
        port = ntohs(portp->s_port);
    } else if (*(end = diminuto_number_unsigned(sp, &temp)) != '\0') {
    } else if (temp > (diminuto_port_t)~0) {
        (*__errno_location ()) = 22;
        diminuto_log_perror("src/diminuto_ipc.c", 61, "diminuto_ipc_port: magnitude");
        port = 0;
    } else {
        port = temp;
    }
    return port;
}

canonical_original_code:
unsigned short diminuto_ipc_port(char *service, char *protocol)
{
    unsigned short port = 0;
    char *sp = (const char *)0;
    struct servent *portp = (struct servent *)0;
    unsigned long temp = 0;
    char *end = (const char *)0;
    if (*(sp = service) == ':') { sp += 1; }
    if ((portp = getservbyname(sp, protocol)) != (struct servent *)0) {
        port = ntohs(portp->s_port);
    } else if (*(end = diminuto_number_unsigned(sp, &temp)) != '\0') {
    } else if (temp > (unsigned short)~0) {
        (*__errno_location ()) = 22;
        diminuto_log_perror("src/diminuto_ipc.c", 61, "diminuto_ipc_port: magnitude");
        port = 0;
    } else {
        port = temp;
    }
    return port;
}

variable_types:
service
char *

variable_types:
protocol
char *

variable_types:
port
unsigned short

variable_types:
sp
char *

variable_types: struct servent { char *s_name; char **s_aliases; int s_port; char *s_proto; } *

variable_types:
temp
unsigned long

variable_types:
end
char *

return_type: unsigned short


decompiled_code:
char *__fastcall diminuto_ipc_port2string(unsigned __int16 a1, char *a2, size_t a3)
{
if ( a3 )
{
*a2 = 0;
snprintf(a2, a3, "%u", a1);
a2[a3 - 1] = 0;
}
return a2;
}

canonical_decompiled_code:
char *__fastcall func5(unsigned __int16 a1, char *a2, size_t a3)
{
if ( a3 )
{
*a2 = 0;
snprintf(a2, a3, "%u", a1);
a2[a3 - 1] = 0;
}
return a2;
}

original_code:
char * diminuto_ipc_port2string(diminuto_port_t port, void * buffer, size_t length) {
    char * string = (char *)buffer;
    if (length > 0) {
        string[0] = '\0';
        (void)snprintf(string, length, "%u", port);
        string[length - 1] = '\0';
    }
    return string;
}

canonical_original_code:
char *diminuto_ipc_port2string(unsigned short port, void *buffer, unsigned long length) {
    char *string = (char *)buffer;
    if (length > 0) {
        string[0] = '\0';
        (void)snprintf(string, length, "%u", port);
        string[length - 1] = '\0';
    }
    return string;
}

variable_types:
buffer
void *

variable_types:
length
unsigned long

variable_types:
string
char *

return_type: char *


decompiled_code:
__int64 __fastcall diminuto_ipc_close(int a1)
{
unsigned int v1; // ebx

v1 = a1;
if ( close(a1) < 0 )
{
diminuto_log_perror("src/diminuto_ipc.c", 89LL, "diminuto_ipc_close: close");
v1 = -2;
}
return v1;
}

canonical_decompiled_code:
__int64 __fastcall func6(int a1)
{
unsigned int v1; // ebx

v1 = a1;
if ( close(a1) < 0 )
{
diminuto_log_perror("src/diminuto_ipc.c", 89LL, "diminuto_ipc_close: close");
v1 = -2;
}
return v1;
}

original_code:
int diminuto_ipc_close(int fd)
{
    if (close(fd) < 0) {
        diminuto_log_perror("src/diminuto_ipc.c", 89, "diminuto_ipc_close: close");
        fd = -2;
    }
    return fd;
}

variable_types: fd int


decompiled_code:
__int64 __fastcall diminuto_ipc_shutdown(int a1)
{
unsigned int v1; // ebx

v1 = a1;
if ( shutdown(a1, 2) < 0 )
{
diminuto_log_perror("src/diminuto_ipc.c", 99LL, "diminuto_ipc_shutdown: shutdown");
v1 = -3;
}
return v1;
}

canonical_decompiled_code:
__int64 __fastcall func7(int a1)
{
unsigned int v1; // ebx

v1 = a1;
if ( shutdown(a1, 2) < 0 )
{
diminuto_log_perror("src/diminuto_ipc.c", 99LL, "diminuto_ipc_shutdown: shutdown");
v1 = -3;
}
return v1;
}

original_code:
int diminuto_ipc_shutdown(int fd)
{
    if (shutdown(fd, SHUT_RDWR) < 0) {
        diminuto_log_perror("src/diminuto_ipc.c", 99, "diminuto_ipc_shutdown: shutdown");
        fd = -3;
    }
    return fd;
}


decompiled_code:
__int64 __fastcall diminuto_ipc_type(int a1)
{
socklen_t len; // [rsp+Ch] [rbp-1Ch] BYREF
struct sockaddr addr; // [rsp+10h] [rbp-18h] BYREF

*(_QWORD *)&addr.sa_family = 0LL;
*(_QWORD *)&addr.sa_data[6] = 0LL;
len = 16;
if ( getsockname(a1, &addr, &len) >= 0 )
return addr.sa_family;
diminuto_log_perror("src/diminuto_ipc.c", 117LL, "diminuto_ipc_type: getsockname");
return 0LL;
}

canonical_decompiled_code:
__int64 __fastcall func8(int a1)
{
socklen_t len; // [rsp+Ch] [rbp-1Ch] BYREF
struct sockaddr addr; // [rsp+10h] [rbp-18h] BYREF

*(_QWORD *)&addr.sa_family = 0LL;
*(_QWORD *)&addr.sa_data[6] = 0LL;
len = 16;
if ( getsockname(a1, &addr, &len) >= 0 )
return addr.sa_family;
diminuto_log_perror("src/diminuto_ipc.c", 117LL, "diminuto_ipc_type: getsockname");
return 0LL;
}

original_code:
int diminuto_ipc_type(int fd)
{
    int rc = 0;
    struct sockaddr sa = { 0, };
    socklen_t length = sizeof(sa);
    if (getsockname(fd, (struct sockaddr *)&sa, &length) < 0) {
        diminuto_log_perror("src/diminuto_ipc.c", 117, "diminuto_ipc_type: getsockname");
    } else {
        rc = sa.sa_family;
    }
    return rc;
}

canonical_original_code:
int diminuto_ipc_type(int fd)
{
    int rc = 0;
    struct sockaddr sa = { 0, };
    unsigned int length = sizeof(sa);
    if (getsockname(fd, (struct sockaddr *)&sa, &length) < 0) {
        diminuto_log_perror("src/diminuto_ipc.c", 117, "diminuto_ipc_type: getsockname");
    } else {
        rc = sa.sa_family;
    }
    return rc;
}

variable_types: rc int

variable_types: struct sockaddr { unsigned short sa_family; char sa_data[14]; }

variable_types:
length
unsigned int


decompiled_code:
__int64 __fastcall diminuto_ipc_set_status(int fd, int a2, __int64 a3)
{
unsigned int v3; // ebp
int v5; // eax
__int64 v6; // rdx
__int64 v7; // rax
__int64 v8; // rbx

v3 = fd;
v5 = fcntl(fd, 3, 0LL);
if ( v5 == -1 )
{
diminuto_log_perror("src/diminuto_ipc.c", 134LL, "diminuto_ipc_set_status: fcntl(F_GETFL)");
v3 = -6;
}
else
{
v6 = v5;
v7 = a3 | v5;
v8 = v6 & ~a3;
if ( !a2 )
v7 = v8;
if ( fcntl(fd, 4, v7) < 0 )
{
diminuto_log_perror("src/diminuto_ipc.c", 137LL, "diminuto_ipc_set_status: fcntl(F_SETFL)");
v3 = -7;
}
}
return v3;
}

canonical_decompiled_code:
__int64 __fastcall func9(int fd, int a2, __int64 a3)
{
unsigned int v3; // ebp
int v5; // eax
__int64 v6; // rdx
__int64 v7; // rax
__int64 v8; // rbx

v3 = fd;
v5 = fcntl(fd, 3, 0LL);
if ( v5 == -1 )
{
diminuto_log_perror("src/diminuto_ipc.c", 134LL, "diminuto_ipc_set_status: fcntl(F_GETFL)");
v3 = -6;
}
else
{
v6 = v5;
v7 = a3 | v5;
v8 = v6 & ~a3;
if ( !a2 )
v7 = v8;
if ( fcntl(fd, 4, v7) < 0 )
{
diminuto_log_perror("src/diminuto_ipc.c", 137LL, "diminuto_ipc_set_status: fcntl(F_SETFL)");
v3 = -7;
}
}
return v3;
}

original_code:
int diminuto_ipc_set_status(int fd, int enable, long mask)
{
    long flags = 0;
    if ((flags = fcntl(fd, 3, 0)) == -1) {
        diminuto_log_perror("src/diminuto_ipc.c", 134, "diminuto_ipc_set_status: fcntl(F_GETFL)");
        fd = -6;
    } else if (fcntl(fd, 4, enable ? (flags|mask) : (flags&(~mask))) <0) {
        diminuto_log_perror("src/diminuto_ipc.c", 137, "diminuto_ipc_set_status: fcntl(F_SETFL)");
        fd = -7;
    } else {
    }
    return fd;
}

variable_types: enable int

variable_types: mask long

variable_types: flags long


decompiled_code:
__int64 __fastcall diminuto_ipc_set_socket(int a1, int a2, int a3, int a4)
{
unsigned int v4; // ebx
int optval[3]; // [rsp+Ch] [rbp-Ch] BYREF

v4 = a1;
optval[0] = a4;
if ( setsockopt(a1, a2, a3, optval, 4u) < 0 )
{
if ( *_errno_location() == 1 )
{
diminuto_log_perror("src/diminuto_ipc.c", 151LL, "diminuto_ipc_set_socket: setsockopt: must be root");
v4 = -8;
}
else
{
diminuto_log_perror("src/diminuto_ipc.c", 154LL, "diminuto_ipc_set_socket: setsockopt");
v4 = -9;
}
}
return v4;
}

canonical_decompiled_code:
__int64 __fastcall func10(int a1, int a2, int a3, int a4)
{
unsigned int v4; // ebx
int optval[3]; // [rsp+Ch] [rbp-Ch] BYREF

v4 = a1;
optval[0] = a4;
if ( setsockopt(a1, a2, a3, optval, 4u) < 0 )
{
if ( *_errno_location() == 1 )
{
diminuto_log_perror("src/diminuto_ipc.c", 151LL, "diminuto_ipc_set_socket: setsockopt: must be root");
v4 = -8;
}
else
{
diminuto_log_perror("src/diminuto_ipc.c", 154LL, "diminuto_ipc_set_socket: setsockopt");
v4 = -9;
}
}
return v4;
}

original_code:
int diminuto_ipc_set_socket(int fd, int level, int option, int value)
{
    if (setsockopt(fd, level, option, &value, sizeof(value)) >= 0) {
    } else if ((*__errno_location ()) == 1) {
        diminuto_log_perror("src/diminuto_ipc.c", 151, "diminuto_ipc_set_socket: setsockopt: must be root");
        fd = -8;
    } else {
        diminuto_log_perror("src/diminuto_ipc.c", 154, "diminuto_ipc_set_socket: setsockopt");
        fd = -9;
    }
    return fd;
}

variable_types: level int

variable_types: option int

variable_types: value int


decompiled_code:
__int64 __fastcall diminuto_ipc_get_control(int a1, int a2)
{
unsigned int v3[3]; // [rsp+Ch] [rbp-Ch] BYREF

v3[0] = 0;
if ( ioctl(a1, a2, v3) < 0 )
{
diminuto_log_perror("src/diminuto_ipc.c", 166LL, "diminuto_ipc_get_control: ioctl");
v3[0] = -1;
}
return v3[0];
}

canonical_decompiled_code:
__int64 __fastcall func12(int a1, int a2)
{
unsigned int v3[3]; // [rsp+Ch] [rbp-Ch] BYREF

v3[0] = 0;
if ( ioctl(a1, a2, v3) < 0 )
{
diminuto_log_perror("src/diminuto_ipc.c", 166LL, "diminuto_ipc_get_control: ioctl");
v3[0] = -1;
}
return v3[0];
}

original_code:
int diminuto_ipc_get_control(int fd, int option)
{
    int value = 0;
    if (ioctl(fd, option, &value) < 0) {
        diminuto_log_perror("src/diminuto_ipc.c", 166, "diminuto_ipc_get_control: ioctl");
        value = -1;
    }
    return value;
}


decompiled_code:
__int64 __fastcall diminuto_ipc_get_timestamp(int a1)
{
__int64 v2; // [rsp+0h] [rbp-18h] BYREF
__int64 v3; // [rsp+8h] [rbp-10h]

v2 = 0LL;
v3 = 0LL;
if ( ioctl(a1, 0x8906uLL, &v2) >= 0 )
return diminuto_frequency_seconds2ticks(v2, v3, 1000000LL);
diminuto_log_perror("src/diminuto_ipc.c", 179LL, "diminuto_ipc_get_timestamp: ioctl");
return -1LL;
}

canonical_decompiled_code:
__int64 __fastcall func13(int a1)
{
__int64 v2; // [rsp+0h] [rbp-18h] BYREF
__int64 v3; // [rsp+8h] [rbp-10h]

v2 = 0LL;
v3 = 0LL;
if ( ioctl(a1, 0x8906uLL, &v2) >= 0 )
return func2(v2, v3, 1000000LL);
diminuto_log_perror("src/diminuto_ipc.c", 179LL, "diminuto_ipc_get_timestamp: ioctl");
return -1LL;
}

original_code:
diminuto_sticks_t diminuto_ipc_get_timestamp(int fd)
{
    struct timeval value = { 0, };
    diminuto_sticks_t ticks = -1;
    if (ioctl(fd, 0x8906, &value) < 0) {
        diminuto_log_perror("src/diminuto_ipc.c", 179, "diminuto_ipc_get_timestamp: ioctl");
    } else {
        ticks = diminuto_frequency_seconds2ticks(value.tv_sec, value.tv_usec, 1000000LL);
    }
    return ticks;
}

canonical_original_code:
long diminuto_ipc_get_timestamp(int fd)
{
    struct timeval value = { 0, };
    long ticks = -1;
    if (ioctl(fd, 0x8906, &value) < 0) {
        diminuto_log_perror("src/diminuto_ipc.c", 179, "diminuto_ipc_get_timestamp: ioctl");
    } else {
        ticks = diminuto_frequency_seconds2ticks(value.tv_sec, value.tv_usec, 1000000LL);
    }
    return ticks;
}

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

variable_types: ticks long


decompiled_code:
__int64 __fastcall diminuto_ipc_set_interface(int fd, const char *a2)
{
unsigned int v2; // ebx
socklen_t v3; // er8
__int64 v5[7]; // [rsp+0h] [rbp-38h] BYREF

v2 = fd;
v5[0] = 0LL;
v5[1] = 0LL;
v5[2] = 0LL;
v5[3] = 0LL;
v5[4] = 0LL;
if ( a2 )
{
v3 = 0;
if ( *a2 )
{
strncpy((char *)v5, a2, 0xFuLL);
v3 = 40;
}
if ( setsockopt(fd, (int)diminuto_frequency + 1, 25, v5, v3) < 0 )
{
if ( *_errno_location() == 1 )
{
diminuto_log_perror("src/diminuto_ipc.c", 205LL, "diminuto_ipc_set_interface: setsockopt: must be root");
v2 = -4;
}
else
{
diminuto_log_perror("src/diminuto_ipc.c", 208LL, "diminuto_ipc_set_interface: setsockopt");
v2 = -5;
}
}
}
return v2;
}

canonical_decompiled_code:
__int64 __fastcall func14(int fd, const char *a2)
{
unsigned int v2; // ebx
socklen_t v3; // er8
__int64 v5[7]; // [rsp+0h] [rbp-38h] BYREF

v2 = fd;
v5[0] = 0LL;
v5[1] = 0LL;
v5[2] = 0LL;
v5[3] = 0LL;
v5[4] = 0LL;
if ( a2 )
{
v3 = 0;
if ( *a2 )
{
strncpy((char *)v5, a2, 0xFuLL);
v3 = 40;
}
if ( setsockopt(fd, (int)diminuto_frequency + 1, 25, v5, v3) < 0 )
{
if ( *_errno_location() == 1 )
{
diminuto_log_perror("src/diminuto_ipc.c", 205LL, "diminuto_ipc_set_interface: setsockopt: must be root");
v2 = -4;
}
else
{
diminuto_log_perror("src/diminuto_ipc.c", 208LL, "diminuto_ipc_set_interface: setsockopt");
v2 = -5;
}
}
}
return v2;
}

original_code:
int diminuto_ipc_set_interface(int fd, const char * interface)
{
    struct ifreq intf = { 0 };
    socklen_t length = 0;
    if (interface != (const char *)0) {
        if (interface[0] != '\0') {
            strncpy(intf.ifr_ifrn.ifrn_name, interface, sizeof(intf.ifr_ifrn.ifrn_name));
            intf.ifr_ifrn.ifrn_name[sizeof(intf.ifr_ifrn.ifrn_name) - 1] = '\0';
            length = sizeof(intf);
        }
        if (setsockopt(fd, 1, 25, (void *)&intf, length) >= 0) {
        } else if ((*__errno_location ()) == 1) {
            diminuto_log_perror("src/diminuto_ipc.c", 205, "diminuto_ipc_set_interface: setsockopt: must be root");
            fd = -4;
        } else {
            diminuto_log_perror("src/diminuto_ipc.c", 208, "diminuto_ipc_set_interface: setsockopt");
            fd = -5;
        }
    }
    return fd;
}

canonical_original_code:
int diminuto_ipc_set_interface(int fd, char *interface)
{
    struct ifreq intf = { 0 };
    unsigned int length = 0;
    if (interface != (char *)0) {
        if (interface[0] != '\0') {
            strncpy(intf.ifr_ifrn.ifrn_name, interface, sizeof(intf.ifr_ifrn.ifrn_name));
            intf.ifr_ifrn.ifrn_name[sizeof(intf.ifr_ifrn.ifrn_name) - 1] = '\0';
            length = sizeof(intf);
        }
        if (setsockopt(fd, 1, 25, (void *)&intf, length) >= 0) {
        } else if ((*__errno_location ()) == 1) {
            diminuto_log_perror("src/diminuto_ipc.c", 205, "diminuto_ipc_set_interface: setsockopt: must be root");
            fd = -4;
        } else {
            diminuto_log_perror("src/diminuto_ipc.c", 208, "diminuto_ipc_set_interface: setsockopt");
            fd = -5;
        }
    }
    return fd;
}

variable_types:
interface
char *

variable_types: struct ifreq { union { char ifrn_name[16]; } ifr_ifrn; union { struct sockaddr { unsigned short sa_family; char sa_data[14]; } ifru_addr; struct sockaddr ifru_dstaddr; struct sockaddr ifru_broadaddr; struct sockaddr ifru_netmask; struct sockaddr ifru_hwaddr; short ifru_flags; int ifru_ivalue; int ifru_mtu; struct ifmap { unsigned long mem_start; unsigned long mem_end; unsigned short base_addr; unsigned char irq; unsigned char dma; unsigned char port; } ifru_map; char ifru_slave[16]; char ifru_newname[16]; char *ifru_data; } ifr_ifru; }

user_defined_types: struct ifreq { union { char ifrn_name[16]; } ifr_ifrn; union { struct sockaddr ifru_addr; struct sockaddr ifru_dstaddr; struct sockaddr ifru_broadaddr; struct sockaddr ifru_netmask; struct sockaddr ifru_hwaddr; short ifru_flags; int ifru_ivalue; int ifru_mtu; struct ifmap ifru_map; char ifru_slave[16]; char ifru_newname[16]; char *ifru_data; } ifr_ifru; }


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

result = a1;
if ( a2 >= 0 )
{
if ( a2 <= 0x7FFFFFFF )
result = diminuto_ipc_set_socket(a1, 1, 7, a2);
else
result = diminuto_ipc_set_socket(a1, 1, 7, 0x7FFFFFFF);
}
return result;
}

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

result = a1;
if ( a2 >= 0 )
{
if ( a2 <= 0x7FFFFFFF )
result = func10(a1, 1, 7, a2);
else
result = func10(a1, 1, 7, 0x7FFFFFFF);
}
return result;
}

original_code:
int diminuto_ipc_set_send(int fd, ssize_t size)
{
    static const int MAXIMUM = ((((int)(~(int)0)) < 0) ? ((int)(~(((int)1)<<((sizeof(int) * 8)-1)))) : ((int)(~((int)0))));
    if (size < 0) {
    } else if (size > MAXIMUM) {
        fd = diminuto_ipc_set_socket(fd, 1, 7, MAXIMUM);
    } else {
        int value;
        fd = diminuto_ipc_set_socket(fd, 1, 7, value = size);
    }
    return fd;
}

canonical_original_code:
int diminuto_ipc_set_send(int fd, long size)
{
    static int MAXIMUM = ((((int)(~(int)0)) < 0) ? ((int)(~(((int)1)<<((sizeof(int) * 8)-1)))) : ((int)(~((int)0))));
    if (size < 0) {
    } else if (size > MAXIMUM) {
        fd = diminuto_ipc_set_socket(fd, 1, 7, MAXIMUM);
    } else {
        int value;
        fd = diminuto_ipc_set_socket(fd, 1, 7, value = size);
    }
    return fd;
}

variable_types: size long

variable_types: MAXIMUM int


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

result = a1;
if ( a2 >= 0 )
{
if ( a2 <= 0x7FFFFFFF )
result = diminuto_ipc_set_socket(a1, 1, 8, a2);
else
result = diminuto_ipc_set_socket(a1, 1, 8, 0x7FFFFFFF);
}
return result;
}

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

result = a1;
if ( a2 >= 0 )
{
if ( a2 <= 0x7FFFFFFF )
result = func10(a1, 1, 8, a2);
else
result = func10(a1, 1, 8, 0x7FFFFFFF);
}
return result;
}

original_code:
int diminuto_ipc_set_receive(int fd, ssize_t size)
{
    static const int MAXIMUM = ((((int)(~(int)0)) < 0) ? ((int)(~(((int)1)<<((sizeof(int) * 8)-1)))) : ((int)(~((int)0))));
    if (size < 0) {
    } else if (size > MAXIMUM) {
        fd = diminuto_ipc_set_socket(fd, 1, 8, MAXIMUM);
    } else {
        int value;
        fd = diminuto_ipc_set_socket(fd, 1, 8, value = size);
    }
    return fd;
}

canonical_original_code:
int diminuto_ipc_set_receive(int fd, long size)
{
    static int MAXIMUM = ((((int)(~(int)0)) < 0) ? ((int)(~(((int)1)<<((sizeof(int) * 8)-1)))) : ((int)(~((int)0))));
    if (size < 0) {
    } else if (size > MAXIMUM) {
        fd = diminuto_ipc_set_socket(fd, 1, 8, MAXIMUM);
    } else {
        int value;
        fd = diminuto_ipc_set_socket(fd, 1, 8, value = size);
    }
    return fd;
}


decompiled_code:
__int64 __fastcall diminuto_ipc_set_linger(int fd, unsigned __int64 a2)
{
unsigned int v2; // ebx
unsigned __int64 v4; // rcx
unsigned __int64 v5; // rax
__int64 optval; // [rsp+8h] [rbp-20h] BYREF

v2 = fd;
optval = 0LL;
if ( diminuto_ipc_debug )
diminuto_log_emit("diminuto_ipc_set_linger: fd=%d ticks=0x%llx\n", (unsigned int)fd, a2);
if ( a2 )
{
v4 = diminuto_frequency();
if ( ~v4 < a2 )
{
optval = 0x7FFFFFFF00000001LL;
}
else
{
LODWORD(optval) = 1;
v5 = (v4 + a2 - 1) / v4;
if ( v5 > 0x7FFFFFFF )
LODWORD(v5) = 0x7FFFFFFF;
HIDWORD(optval) = v5;
}
}
else
{
optval = 0LL;
}
if ( diminuto_ipc_debug )
diminuto_log_emit("diminuto_ipc_set_linger: l_onoff=%d l_linger=%d\n", (unsigned int)optval, HIDWORD(optval));
if ( setsockopt(fd, 1, 13, &optval, 8u) < 0 )
{
diminuto_log_perror("src/diminuto_ipc.c", 276LL, "diminuto_ipc_set_linger: setsockopt");
v2 = -10;
}
return v2;
}

canonical_decompiled_code:
__int64 __fastcall func17(int fd, unsigned __int64 a2)
{
unsigned int v2; // ebx
unsigned __int64 v4; // rcx
unsigned __int64 v5; // rax
__int64 optval; // [rsp+8h] [rbp-20h] BYREF

v2 = fd;
optval = 0LL;
if ( diminuto_ipc_debug )
diminuto_log_emit("diminuto_ipc_set_linger: fd=%d ticks=0x%llx\n", (unsigned int)fd, a2);
if ( a2 )
{
v4 = func0();
if ( ~v4 < a2 )
{
optval = 0x7FFFFFFF00000001LL;
}
else
{
LODWORD(optval) = 1;
v5 = (v4 + a2 - 1) / v4;
if ( v5 > 0x7FFFFFFF )
LODWORD(v5) = 0x7FFFFFFF;
HIDWORD(optval) = v5;
}
}
else
{
optval = 0LL;
}
if ( diminuto_ipc_debug )
diminuto_log_emit("diminuto_ipc_set_linger: l_onoff=%d l_linger=%d\n", (unsigned int)optval, HIDWORD(optval));
if ( setsockopt(fd, 1, 13, &optval, 8u) < 0 )
{
diminuto_log_perror("src/diminuto_ipc.c", 276LL, "diminuto_ipc_set_linger: setsockopt");
v2 = -10;
}
return v2;
}

original_code:
int diminuto_ipc_set_linger(int fd, diminuto_ticks_t ticks)
{
    struct linger opt = { 0, };
    static const int MAXIMUM = ((((int)(~(int)0)) < 0) ? ((int)(~(((int)1)<<((sizeof(int) * 8)-1)))) : ((int)(~((int)0))));
    if (diminuto_ipc_debug) {
        diminuto_log_emit("diminuto_ipc_set_linger: fd=%d ticks=0x%llx\n", fd, (unsigned long long)ticks);
    }
    if (ticks == 0) {
        opt.l_onoff = 0;
        opt.l_linger = 0;
    } else if (ticks <= (((((diminuto_ticks_t)(~(diminuto_ticks_t)0)) < 0) ? ((diminuto_ticks_t)(~(((diminuto_ticks_t)1)<<((sizeof(diminuto_ticks_t) * 8)-1)))) : ((diminuto_ticks_t)(~((diminuto_ticks_t)0)))) - diminuto_frequency())) {
        opt.l_onoff = !0;
        ticks += diminuto_frequency();
        ticks -= 1;
        ticks /= diminuto_frequency();
        opt.l_linger = (ticks <= MAXIMUM) ? ticks : MAXIMUM;
    } else {
        opt.l_onoff = !0;
        opt.l_linger = MAXIMUM;
    }
    if (diminuto_ipc_debug) {
        diminuto_log_emit("diminuto_ipc_set_linger: l_onoff=%d l_linger=%d\n", opt.l_onoff, opt.l_linger);
    }
    if (setsockopt(fd, 1, 13, &opt, sizeof(opt)) < 0) {
        diminuto_log_perror("src/diminuto_ipc.c", 276, "diminuto_ipc_set_linger: setsockopt");
        fd = -10;
    }
    return fd;
}

canonical_original_code:
int diminuto_ipc_set_linger(int fd, unsigned long ticks)
{
    struct linger opt = { 0, };
    static int MAXIMUM = ((((int)(~(int)0)) < 0) ? ((int)(~(((int)1)<<((sizeof(int) * 8)-1)))) : ((int)(~((int)0))));
    if (diminuto_ipc_debug) {
        diminuto_log_emit("diminuto_ipc_set_linger: fd=%d ticks=0x%llx\n", fd, (unsigned long long)ticks);
    }
    if (ticks == 0) {
        opt.l_onoff = 0;
        opt.l_linger = 0;
    } else if (ticks <= (((((diminuto_ticks_t)(~(unsigned long)0)) < 0) ? ((diminuto_ticks_t)(~(((unsigned long)1)<<((sizeof(diminuto_ticks_t) * 8)-1)))) : ((diminuto_ticks_t)(~((unsigned long)0)))) - diminuto_frequency())) {
        opt.l_onoff = !0;
        ticks += diminuto_frequency();
        ticks -= 1;
        ticks /= diminuto_frequency();
        opt.l_linger = (ticks <= MAXIMUM) ? ticks : MAXIMUM;
    } else {
        opt.l_onoff = !0;
        opt.l_linger = MAXIMUM;
    }
    if (diminuto_ipc_debug) {
        diminuto_log_emit("diminuto_ipc_set_linger: l_onoff=%d l_linger=%d\n", opt.l_onoff, opt.l_linger);
    }
    if (setsockopt(fd, 1, 13, &opt, sizeof(opt)) < 0) {
        diminuto_log_perror("src/diminuto_ipc.c", 276, "diminuto_ipc_set_linger: setsockopt");
        fd = -10;
    }
    return fd;
}

variable_types:
ticks
unsigned long

variable_types: struct linger { int l_onoff; int l_linger; }


decompiled_code:
__int64 __fastcall diminuto_ipc_inject_defaults(int a1)
{
return diminuto_ipc_set_reuseaddress(a1, 1);
}

canonical_decompiled_code:
__int64 __fastcall func18(int a1)
{
return func11(a1, 1);
}

original_code:
int diminuto_ipc_inject_defaults(int fd, void * datap)
{
    return diminuto_ipc_set_reuseaddress(fd, !0);
}

canonical_original_code:
int diminuto_ipc_inject_defaults(int fd, void *datap)
{
    return diminuto_ipc_set_reuseaddress(fd, !0);
}

variable_types: fd int

variable_types:
datap
void *


decompiled_code:
const char **diminuto_ipc_interfaces()
{
struct ifaddrs *v0; // r13
struct ifaddrs *v1; // rbx
__int64 v2; // rbp
__int64 v3; // r14
const char **v4; // r15
const char *v5; // rdi
const char *v6; // rbp
const char **v7; // rbx
const char **v8; // rbp
const char *v9; // r12
size_t v10; // rbx
char *v11; // rbx
char *v12; // r14
const char **v13; // r12
struct ifaddrs *ifap; // [rsp+8h] [rbp-40h] BYREF

ifap = 0LL;
if ( getifaddrs(&ifap) < 0 )
{
diminuto_log_perror("src/diminuto_ipc.c", 311LL, "diminuto_ipc_interfaces: getifaddrs");
v4 = 0LL;
}
else
{
v0 = ifap;
if ( ifap )
{
v1 = ifap;
v2 = 0LL;
v3 = 1LL;
do
{
v5 = v1->ifa_name;
if ( v5 )
{
++v3;
v2 += strnlen(v5, 0xFFuLL) + 1;
}
v1 = v1->ifa_next;
}
while ( v1 );
v4 = (const char **)malloc(v3 * 8 + v2);
v12 = (char *)&v4[v3];
v13 = v4;
do
{
v6 = v0->ifa_name;
if ( v6 )
{
if ( v4 >= v13 )
goto LABEL_15;
v7 = v4;
while ( strncmp(v6, *v7, 0xFFuLL) )
{
if ( ++v7 >= v13 )
goto LABEL_15;
}
if ( v13 <= v7 )
{
LABEL_15:
v8 = v13 + 1;
*v13 = v12;
v9 = v0->ifa_name;
v10 = strnlen(v9, 0xFFuLL);
strncpy(v12, v9, v10);
v11 = &v12[v10];
v12 = v11 + 1;
*v11 = 0;
v13 = v8;
}
}
v0 = v0->ifa_next;
}
while ( v0 );
}
else
{
v13 = (const char **)malloc(8uLL);
v4 = v13;
}
*v13 = 0LL;
}
if ( ifap )
freeifaddrs(ifap);
return v4;
}

canonical_decompiled_code:
const char **func19()
{
struct ifaddrs *v0; // r13
struct ifaddrs *v1; // rbx
__int64 v2; // rbp
__int64 v3; // r14
const char **v4; // r15
const char *v5; // rdi
const char *v6; // rbp
const char **v7; // rbx
const char **v8; // rbp
const char *v9; // r12
size_t v10; // rbx
char *v11; // rbx
char *v12; // r14
const char **v13; // r12
struct ifaddrs *ifap; // [rsp+8h] [rbp-40h] BYREF

ifap = 0LL;
if ( getifaddrs(&ifap) < 0 )
{
diminuto_log_perror("src/diminuto_ipc.c", 311LL, "diminuto_ipc_interfaces: getifaddrs");
v4 = 0LL;
}
else
{
v0 = ifap;
if ( ifap )
{
v1 = ifap;
v2 = 0LL;
v3 = 1LL;
do
{
v5 = v1->ifa_name;
if ( v5 )
{
++v3;
v2 += strnlen(v5, 0xFFuLL) + 1;
}
v1 = v1->ifa_next;
}
while ( v1 );
v4 = (const char **)malloc(v3 * 8 + v2);
v12 = (char *)&v4[v3];
v13 = v4;
do
{
v6 = v0->ifa_name;
if ( v6 )
{
if ( v4 >= v13 )
goto LABEL_15;
v7 = v4;
while ( strncmp(v6, *v7, 0xFFuLL) )
{
if ( ++v7 >= v13 )
goto LABEL_15;
}
if ( v13 <= v7 )
{
LABEL_15:
v8 = v13 + 1;
*v13 = v12;
v9 = v0->ifa_name;
v10 = strnlen(v9, 0xFFuLL);
strncpy(v12, v9, v10);
v11 = &v12[v10];
v12 = v11 + 1;
*v11 = 0;
v13 = v8;
}
}
v0 = v0->ifa_next;
}
while ( v0 );
}
else
{
v13 = (const char **)malloc(8uLL);
v4 = v13;
}
*v13 = 0LL;
}
if ( ifap )
freeifaddrs(ifap);
return v4;
}

original_code:
char ** diminuto_ipc_interfaces(void)
{
    char ** rp = (char **)0;
    struct ifaddrs * ifa = (struct ifaddrs *)0;
    struct ifaddrs * ip = (struct ifaddrs *)0;
    char ** vp = (char **)0;
    char * np = (char *)0;
    size_t vs = sizeof(char *);
    size_t ns = 0;
    size_t rs = 0;
    char ** cp = (char **)0;
    do {
        if (getifaddrs(&ifa) < 0) {
            diminuto_log_perror("src/diminuto_ipc.c", 311, "diminuto_ipc_interfaces: getifaddrs");
            break;
        }
        for (ip = ifa; ip != (struct ifaddrs *)0; ip = ip->ifa_next) {
            if (ip->ifa_name != (char *)0) {
                vs += sizeof(char *);
                ns += strnlen(ip->ifa_name, 255) + 1;
            }
        }
        rs = vs + ns;
        rp = (char **)malloc(rs);
        vp = rp;
        np = (char *)vp + vs;
        for (ip = ifa; ip != (struct ifaddrs *)0; ip = ip->ifa_next) {
            if (ip->ifa_name != (char *)0) {
                for (cp = rp; cp < vp; ++cp) {
                    if (strncmp(ip->ifa_name, *cp, 255) == 0) {
                        break;
                    }
                }
                if (cp >= vp) {
                    *(vp++) = np;
                    ns = strnlen(ip->ifa_name, 255);
                    strncpy(np, ip->ifa_name, ns);
                    np += ns;
                    *(np++) = '\0';
                }
            }
        }
        *vp = (char *)0;
    } while (0);
    if (ifa != (struct ifaddrs *)0) {
        freeifaddrs(ifa);
    }
    return rp;
}

canonical_original_code:
char **diminuto_ipc_interfaces()
{
    char **rp = (char **)0;
    struct ifaddrs *ifa = (struct ifaddrs *)0;
    struct ifaddrs *ip = (struct ifaddrs *)0;
    char **vp = (char **)0;
    char *np = (char *)0;
    unsigned long vs = sizeof(char *);
    unsigned long ns = 0;
    unsigned long rs = 0;
    char **cp = (char **)0;
    do {
        if (getifaddrs(&ifa) < 0) {
            diminuto_log_perror("src/diminuto_ipc.c", 311, "diminuto_ipc_interfaces: getifaddrs");
            break;
        }
        for (ip = ifa; ip != (struct ifaddrs *)0; ip = ip->ifa_next) {
            if (ip->ifa_name != (char *)0) {
                vs += sizeof(char *);
                ns += strnlen(ip->ifa_name, 255) + 1;
            }
        }
        rs = vs + ns;
        rp = (char **)malloc(rs);
        vp = rp;
        np = (char *)vp + vs;
        for (ip = ifa; ip != (struct ifaddrs *)0; ip = ip->ifa_next) {
            if (ip->ifa_name != (char *)0) {
                for (cp = rp; cp < vp; ++cp) {
                    if (strncmp(ip->ifa_name, *cp, 255) == 0) {
                        break;
                    }
                }
                if (cp >= vp) {
                    *(vp++) = np;
                    ns = strnlen(ip->ifa_name, 255);
                    strncpy(np, ip->ifa_name, ns);
                    np += ns;
                    *(np++) = '\0';
                }
            }
        }
        *vp = (char *)0;
    } while (0);
    if (ifa != (struct ifaddrs *)0) {
        freeifaddrs(ifa);
    }
    return rp;
}

variable_types:
rp
char **

variable_types: struct ifaddrs { struct ifaddrs *ifa_next; char *ifa_name; unsigned int ifa_flags; struct sockaddr { unsigned short sa_family; char sa_data[14]; } *ifa_addr; struct sockaddr *ifa_netmask; union { struct sockaddr *ifu_broadaddr; struct sockaddr *ifu_dstaddr; } ifa_ifu; void *ifa_data; } *

variable_types:
vp
char **

variable_types:
np
char *

variable_types:
vs
unsigned long

variable_types:
ns
unsigned long

variable_types:
rs
unsigned long

variable_types:
cp
char **

return_type: char **

user_defined_types: struct ifaddrs { struct ifaddrs *ifa_next; char *ifa_name; unsigned int ifa_flags; struct sockaddr *ifa_addr; struct sockaddr *ifa_netmask; union { struct sockaddr *ifu_broadaddr; struct sockaddr *ifu_dstaddr; } ifa_ifu; void *ifa_data; }


decompiled_code:
ssize_t __fastcall diminuto_ipc_message_receive_generic(int a1, struct msghdr *a2, int a3)
{
ssize_t v3; // rbx
int v5; // eax

v3 = recvmsg(a1, a2, a3);
if ( v3 < 0 )
{
v5 = *_errno_location();
if ( v5 != 11 && v5 != 4 )
diminuto_log_perror("src/diminuto_ipc.c", 378LL, "diminuto_ipc_receive: recvmsg");
}
return v3;
}

canonical_decompiled_code:
ssize_t __fastcall func20(int a1, struct msghdr *a2, int a3)
{
ssize_t v3; // rbx
int v5; // eax

v3 = recvmsg(a1, a2, a3);
if ( v3 < 0 )
{
v5 = *_errno_location();
if ( v5 != 11 && v5 != 4 )
diminuto_log_perror("src/diminuto_ipc.c", 378LL, "diminuto_ipc_receive: recvmsg");
}
return v3;
}

original_code:
ssize_t diminuto_ipc_message_receive_generic(int fd, struct msghdr * message, int flags)
{
    ssize_t total = -1;
    if ((total = recvmsg(fd, message, flags)) > 0) {
    } else if (total == 0) {
    } else if ((*__errno_location ()) == 4) {
    } else if ((*__errno_location ()) == 11) {
    } else if ((*__errno_location ()) == 11) {
    } else {
        diminuto_log_perror("src/diminuto_ipc.c", 378, "diminuto_ipc_receive: recvmsg");
    }
    return total;
}

canonical_original_code:
long diminuto_ipc_message_receive_generic(int fd, struct msghdr *message, int flags)
{
    long total = -1;
    if ((total = recvmsg(fd, message, flags)) > 0) {
    } else if (total == 0) {
    } else if ((*__errno_location ()) == 4) {
    } else if ((*__errno_location ()) == 11) {
    } else if ((*__errno_location ()) == 11) {
    } else {
        diminuto_log_perror("src/diminuto_ipc.c", 378, "diminuto_ipc_receive: recvmsg");
    }
    return total;
}

variable_types: struct msghdr { void *msg_name; unsigned int msg_namelen; struct iovec { void *iov_base; unsigned long iov_len; } *msg_iov; unsigned long msg_iovlen; void *msg_control; unsigned long msg_controllen; int msg_flags; } *

variable_types: flags int

variable_types: total long

user_defined_types: struct msghdr { void *msg_name; unsigned int msg_namelen; struct iovec *msg_iov; unsigned long msg_iovlen; void *msg_control; unsigned long msg_controllen; int msg_flags; }


decompiled_code:
ssize_t __fastcall diminuto_ipc_message_send_generic(int a1, const struct msghdr *a2, int a3)
{
ssize_t v3; // rbx
int v5; // eax

v3 = sendmsg(a1, a2, a3);
if ( v3 < 0 )
{
v5 = *_errno_location();
if ( v5 != 11 && v5 != 4 )
diminuto_log_perror("src/diminuto_ipc.c", 399LL, "diminuto_ipc_send: sendmsg");
}
return v3;
}

canonical_decompiled_code:
ssize_t __fastcall func21(int a1, const struct msghdr *a2, int a3)
{
ssize_t v3; // rbx
int v5; // eax

v3 = sendmsg(a1, a2, a3);
if ( v3 < 0 )
{
v5 = *_errno_location();
if ( v5 != 11 && v5 != 4 )
diminuto_log_perror("src/diminuto_ipc.c", 399LL, "diminuto_ipc_send: sendmsg");
}
return v3;
}

original_code:
ssize_t diminuto_ipc_message_send_generic(int fd, const struct msghdr * message, int flags)
{
    ssize_t total = -1;
    if ((total = sendmsg(fd, message, flags)) > 0) {
    } else if (total == 0) {
    } else if ((*__errno_location ()) == 4) {
    } else if ((*__errno_location ()) == 11) {
    } else if ((*__errno_location ()) == 11) {
    } else {
        diminuto_log_perror("src/diminuto_ipc.c", 399, "diminuto_ipc_send: sendmsg");
    }
    return total;
}

canonical_original_code:
long diminuto_ipc_message_send_generic(int fd, struct msghdr *message, int flags)
{
    long total = -1;
    if ((total = sendmsg(fd, message, flags)) > 0) {
    } else if (total == 0) {
    } else if ((*__errno_location ()) == 4) {
    } else if ((*__errno_location ()) == 11) {
    } else if ((*__errno_location ()) == 11) {
    } else {
        diminuto_log_perror("src/diminuto_ipc.c", 399, "diminuto_ipc_send: sendmsg");
    }
    return total;
}

user_defined_types: struct iovec { void *iov_base; unsigned long iov_len; }


decompiled_code:
__int64 diminuto_frequency()
{
return 1000000000LL;
}

original_code:
static inline diminuto_sticks_t diminuto_frequency(void)
{
    return (1000000000LL);
}


original_code:
int diminuto_meter_events(diminuto_meter_t * meterp, diminuto_ticks_t now, size_t events)
{
    int result = 0;
    if (now < meterp->last) {
        (*__errno_location ()) = 34;
        result = -1;
    } else if (events == 0) {
        meterp->last = now;
    } else if (meterp->count == 0) {
        meterp->last = now;
        meterp->events = events;
        meterp->burst = events;
        meterp->count = 1;
    } else if ((DIMINUTO_METER_OVERFLOW - meterp->count) < 1) {
        meterp->last = now;
        meterp->count = DIMINUTO_METER_OVERFLOW;
        (*__errno_location ()) = 75;
        result = -1;
    } else if ((DIMINUTO_METER_OVERFLOW - meterp->events) < events) {
        meterp->last = now;
        meterp->events = DIMINUTO_METER_OVERFLOW;
        (*__errno_location ()) = 75;
        result = -1;
    } else if (now == meterp->last) {
        meterp->peak = DIMINUTO_METER_ERROR;
        meterp->last = now;
        meterp->events += events;
        if (events > meterp->burst) {
            meterp->burst = events;
        }
        meterp->count += 1;
    } else {
        diminuto_ticks_t interarrival = 0;
        double rate = 0.0;
        interarrival = now - meterp->last;
        rate = events;
        rate *= diminuto_frequency();
        rate /= interarrival;
        if (rate > meterp->peak) {
            meterp->peak = rate;
        }
        meterp->last = now;
        meterp->events += events;
        if (events > meterp->burst) {
            meterp->burst = events;
        }
        meterp->count += 1;
    }
    return result;
}

canonical_original_code:
int diminuto_meter_events(struct DiminutoMeter *meterp, unsigned long now, unsigned long events)
{
    int result = 0;
    if (now < meterp->last) {
        (*__errno_location ()) = 34;
        result = -1;
    } else if (events == 0) {
        meterp->last = now;
    } else if (meterp->count == 0) {
        meterp->last = now;
        meterp->events = events;
        meterp->burst = events;
        meterp->count = 1;
    } else if ((DIMINUTO_METER_OVERFLOW - meterp->count) < 1) {
        meterp->last = now;
        meterp->count = DIMINUTO_METER_OVERFLOW;
        (*__errno_location ()) = 75;
        result = -1;
    } else if ((DIMINUTO_METER_OVERFLOW - meterp->events) < events) {
        meterp->last = now;
        meterp->events = DIMINUTO_METER_OVERFLOW;
        (*__errno_location ()) = 75;
        result = -1;
    } else if (now == meterp->last) {
        meterp->peak = DIMINUTO_METER_ERROR;
        meterp->last = now;
        meterp->events += events;
        if (events > meterp->burst) {
            meterp->burst = events;
        }
        meterp->count += 1;
    } else {
        unsigned long interarrival = 0;
        double rate = 0.0;
        interarrival = now - meterp->last;
        rate = events;
        rate *= diminuto_frequency();
        rate /= interarrival;
        if (rate > meterp->peak) {
            meterp->peak = rate;
        }
        meterp->last = now;
        meterp->events += events;
        if (events > meterp->burst) {
            meterp->burst = events;
        }
        meterp->count += 1;
    }
    return result;
}

variable_types: struct DiminutoMeter { unsigned long start; unsigned long last; double peak; unsigned long events; unsigned long burst; unsigned long count; } *

variable_types:
now
unsigned long

variable_types:
events
unsigned long

variable_types: result int

variable_types:
interarrival
unsigned long

variable_types: rate double


decompiled_code:
__int64 __fastcall diminuto_meter_sustained(unsigned __int64 *a1)
{
__int64 result; // rax
unsigned __int64 v2; // rbx
unsigned __int64 v3; // rbp
double v4; // xmm0_8
__int64 v5; // rbx

result = a1[3];
if ( result )
{
v2 = a1[1];
v3 = *a1;
v4 = *(double *)&LC1;
if ( v2 > *a1 )
{
if ( result < 0 )
v4 = (double)(int)(result & 1 | ((unsigned __int64)result >> 1))
+ (double)(int)(result & 1 | ((unsigned __int64)result >> 1));
result = diminuto_frequency(v4);
v5 = v2 - v3;
if ( v5 < 0 )
result = v5 & 1 | ((unsigned __int64)v5 >> 1);
}
}
return result;
}

canonical_decompiled_code:
__int64 __fastcall func2(unsigned __int64 *a1)
{
__int64 result; // rax
unsigned __int64 v2; // rbx
unsigned __int64 v3; // rbp
double v4; // xmm0_8
__int64 v5; // rbx

result = a1[3];
if ( result )
{
v2 = a1[1];
v3 = *a1;
v4 = *(double *)&LC1;
if ( v2 > *a1 )
{
if ( result < 0 )
v4 = (double)(int)(result & 1 | ((unsigned __int64)result >> 1))
+ (double)(int)(result & 1 | ((unsigned __int64)result >> 1));
result = func0(v4);
v5 = v2 - v3;
if ( v5 < 0 )
result = v5 & 1 | ((unsigned __int64)v5 >> 1);
}
}
return result;
}

original_code:
double diminuto_meter_sustained(const diminuto_meter_t * meterp)
{
    double result = 0.0;
    if (meterp->events == 0) {
    } else if (meterp->last <= meterp->start) {
        result = DIMINUTO_METER_ERROR;
    } else {
        result = meterp->events;
        result *= diminuto_frequency();
        result /= (meterp->last - meterp->start);
    }
    return result;
}

canonical_original_code:
double diminuto_meter_sustained(struct DiminutoMeter *meterp)
{
    double result = 0.0;
    if (meterp->events == 0) {
    } else if (meterp->last <= meterp->start) {
        result = DIMINUTO_METER_ERROR;
    } else {
        result = meterp->events;
        result *= diminuto_frequency();
        result /= (meterp->last - meterp->start);
    }
    return result;
}

variable_types: result double

return_type: double

user_defined_types: struct DiminutoMeter { unsigned long start; unsigned long last; double peak; unsigned long events; unsigned long burst; unsigned long count; }


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

if ( a1 )
result = diminuto_log_emit(
"diminuto_meter_t@%p[%zu]: { dt=%llu p=%lf e=%zu b=%zu n=%zu }\n",
a1,
48LL,
*(_QWORD *)(a1 + 8) - *(_QWORD *)a1,
*(_QWORD *)(a1 + 24),
*(_QWORD *)(a1 + 32),
*(double *)(a1 + 16),
*(_QWORD *)(a1 + 40));
else
result = diminuto_log_emit("diminuto_meter_t@%p[%zu]\n", 0LL, 0x30uLL);
return result;
}

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

if ( a1 )
result = diminuto_log_emit(
"diminuto_meter_t@%p[%zu]: { dt=%llu p=%lf e=%zu b=%zu n=%zu }\n",
a1,
48LL,
*(_QWORD *)(a1 + 8) - *(_QWORD *)a1,
*(_QWORD *)(a1 + 24),
*(_QWORD *)(a1 + 32),
*(double *)(a1 + 16),
*(_QWORD *)(a1 + 40));
else
result = diminuto_log_emit("diminuto_meter_t@%p[%zu]\n", 0LL, 0x30uLL);
return result;
}

original_code:
void diminuto_meter_log(const diminuto_meter_t * meterp)
{
    if (meterp != (diminuto_meter_t *)0) {
        diminuto_log_emit("diminuto_meter_t@%p[%zu]: { dt=%llu p=%lf e=%zu b=%zu n=%zu }\n", meterp, sizeof(*meterp), (diminuto_llu_t)(meterp->last - meterp->start), meterp->peak, meterp->events, meterp->burst, meterp->count);
    } else {
        diminuto_log_emit("diminuto_meter_t@%p[%zu]\n", meterp, sizeof(*meterp));
    }
}

canonical_original_code:
void diminuto_meter_log(struct DiminutoMeter *meterp)
{
    if (meterp != (struct DiminutoMeter *)0) {
        diminuto_log_emit("diminuto_meter_t@%p[%zu]: { dt=%llu p=%lf e=%zu b=%zu n=%zu }\n", meterp, sizeof(*meterp), (diminuto_llu_t)(meterp->last - meterp->start), meterp->peak, meterp->events, meterp->burst, meterp->count);
    } else {
        diminuto_log_emit("diminuto_meter_t@%p[%zu]\n", meterp, sizeof(*meterp));
    }
}


decompiled_code:
__int64 __fastcall diminuto_list_dataset(__int64 a1, __int64 a2)
{
__int64 result; // rax

result = a1;
*(_QWORD *)(a1 + 24) = a2;
return result;
}

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

result = a1;
*(_QWORD *)(a1 + 24) = a2;
return result;
}

original_code:
static inline diminuto_list_t * diminuto_list_dataset(diminuto_list_t * nodep, void * datap) {
    nodep->data = datap;
    return nodep;
}

canonical_original_code:
static inline struct DiminutoList *diminuto_list_dataset(struct DiminutoList *nodep, void *datap) {
    nodep->data = datap;
    return nodep;
}

variable_types:
nodep
struct DiminutoList *

variable_types:
datap
void *

return_type: struct DiminutoList { struct DiminutoList *next; struct DiminutoList *prev; struct DiminutoList *root; void *data; } *


decompiled_code:
__int64 __fastcall diminuto_list_datainit(_QWORD *a1, __int64 a2)
{
_QWORD *v2; // rax

v2 = diminuto_list_init(a1);
return diminuto_list_dataset((__int64)v2, a2);
}

canonical_decompiled_code:
__int64 __fastcall func5(_QWORD *a1, __int64 a2)
{
_QWORD *v2; // rax

v2 = diminuto_list_init(a1);
return func4((__int64)v2, a2);
}

original_code:
static inline diminuto_list_t * diminuto_list_datainit(diminuto_list_t * nodep, void * datap) {
    return diminuto_list_dataset(diminuto_list_init(nodep), datap);
}

canonical_original_code:
static inline struct DiminutoList *diminuto_list_datainit(struct DiminutoList *nodep, void *datap) {
    return diminuto_list_dataset(diminuto_list_init(nodep), datap);
}

user_defined_types: struct DiminutoList { struct DiminutoList *next; struct DiminutoList *prev; struct DiminutoList *root; void *data; }


decompiled_code:
_BOOL8 __fastcall diminuto_list_isempty(_QWORD *a1)
{
return *a1 == (_QWORD)a1;
}

canonical_decompiled_code:
_BOOL8 __fastcall func6(_QWORD *a1)
{
return *a1 == (_QWORD)a1;
}

original_code:
static inline int diminuto_list_isempty(const diminuto_list_t * nodep) {
    return (nodep == nodep->next);
}

canonical_original_code:
static inline int diminuto_list_isempty(struct DiminutoList *nodep) {
    return (nodep == nodep->next);
}

variable_types: struct DiminutoList { struct DiminutoList *next; struct DiminutoList *prev; struct DiminutoList *root; void *data; } *


decompiled_code:
__int64 __fastcall diminuto_memory_alignment(__int64 a1, __int64 a2)
{
return -a2 & (a2 + a1 - 1);
}

original_code:
static inline size_t diminuto_memory_alignment(size_t size, size_t alignment)
{
    --alignment;
    return (size + alignment) & (~alignment);
}

canonical_original_code:
static inline unsigned long diminuto_memory_alignment(unsigned long size, unsigned long alignment)
{
    --alignment;
    return (size + alignment) & (~alignment);
}

variable_types:
size
unsigned long

variable_types:
alignment
unsigned long

return_type: unsigned long


decompiled_code:
void __fastcall diminuto_well_fini(__int64 a1)
{
void *v1; // rax
void *v2; // rax

v1 = (void *)diminuto_list_data(a1 + 32);
free(v1);
v2 = (void *)diminuto_list_data(a1);
free(v2);
}

canonical_decompiled_code:
void __fastcall func8(__int64 a1)
{
void *v1; // rax
void *v2; // rax

v1 = (void *)func3(a1 + 32);
free(v1);
v2 = (void *)func3(a1);
free(v2);
}

original_code:
void diminuto_well_fini(diminuto_well_t * wellp)
{
    free(diminuto_list_data(&wellp[DIMINUTO_WELL_USED]));
    free(diminuto_list_data(&wellp[DIMINUTO_WELL_FREE]));
}

canonical_original_code:
void diminuto_well_fini(struct DiminutoList *wellp)
{
    free(diminuto_list_data(&wellp[DIMINUTO_WELL_USED]));
    free(diminuto_list_data(&wellp[DIMINUTO_WELL_FREE]));
}


decompiled_code:
__int64 __fastcall diminuto_well_alloc(__int64 a1)
{
_QWORD *v1; // rbx
__int64 v2; // rax
__int64 v3; // rax
__int64 v4; // rbp
__int64 v5; // r12
__int64 v6; // rax

v1 = (_QWORD *)diminuto_list_root(a1);
if ( diminuto_list_isempty(v1) )
{
*_errno_location() = 12;
v5 = 0LL;
}
else
{
v2 = diminuto_list_next((__int64)v1);
v3 = diminuto_list_remove(v2);
v4 = v3;
if ( v3 )
{
v5 = diminuto_list_data(v3);
v6 = diminuto_list_prev((__int64)(v1 + 4));
diminuto_list_insert(v6, v4);
}
else
{
*_errno_location() = 14;
v5 = 0LL;
}
}
return v5;
}

canonical_decompiled_code:
__int64 __fastcall func9(__int64 a1)
{
_QWORD *v1; // rbx
__int64 v2; // rax
__int64 v3; // rax
__int64 v4; // rbp
__int64 v5; // r12
__int64 v6; // rax

v1 = (_QWORD *)func2(a1);
if ( func6(v1) )
{
*_errno_location() = 12;
v5 = 0LL;
}
else
{
v2 = func0((__int64)v1);
v3 = diminuto_list_remove(v2);
v4 = v3;
if ( v3 )
{
v5 = func3(v3);
v6 = func1((__int64)(v1 + 4));
diminuto_list_insert(v6, v4);
}
else
{
*_errno_location() = 14;
v5 = 0LL;
}
}
return v5;
}

original_code:
void * diminuto_well_alloc(diminuto_well_t * wellp)
{
    void * pointer = (void *)0;
    diminuto_list_t * nodep;
    wellp = diminuto_list_root(wellp);
    if (!diminuto_list_isempty(&wellp[DIMINUTO_WELL_FREE])) {
        nodep = diminuto_list_remove(diminuto_list_next(&wellp[DIMINUTO_WELL_FREE]));
        if (nodep != (diminuto_well_t *)0) {
            pointer = diminuto_list_data(nodep);
            diminuto_list_insert(diminuto_list_prev(&wellp[DIMINUTO_WELL_USED]), nodep);
        } else {
            (*__errno_location ()) = 14;
        }
    } else {
        (*__errno_location ()) = 12;
    }
    return pointer;
}

canonical_original_code:
void *diminuto_well_alloc(struct DiminutoList *wellp)
{
    void *pointer = (void *)0;
    struct DiminutoList *nodep;
    wellp = diminuto_list_root(wellp);
    if (!diminuto_list_isempty(&wellp[DIMINUTO_WELL_FREE])) {
        nodep = diminuto_list_remove(diminuto_list_next(&wellp[DIMINUTO_WELL_FREE]));
        if (nodep != (struct DiminutoList *)0) {
            pointer = diminuto_list_data(nodep);
            diminuto_list_insert(diminuto_list_prev(&wellp[DIMINUTO_WELL_USED]), nodep);
        } else {
            (*__errno_location ()) = 14;
        }
    } else {
        (*__errno_location ()) = 12;
    }
    return pointer;
}

variable_types:
pointer
void *

return_type: void *


decompiled_code:
__int64 __fastcall diminuto_well_free(__int64 a1, __int64 a2)
{
__int64 v2; // rbp
unsigned int v3; // ebx
__int64 v4; // rax
_QWORD *v5; // rdi
__int64 v6; // r12
__int64 v7; // rax

v2 = diminuto_list_root(a1);
if ( diminuto_list_isempty((_QWORD *)(v2 + 32)) )
{
*_errno_location() = 12;
v3 = -1;
}
else
{
v3 = 0;
v4 = diminuto_list_next(v2 + 32);
v5 = (_QWORD *)diminuto_list_remove(v4);
if ( v5 )
{
v6 = diminuto_list_datainit(v5, a2);
v7 = diminuto_list_prev(v2);
diminuto_list_insert(v7, v6);
}
else
{
*_errno_location() = 14;
v3 = -1;
}
}
return v3;
}

canonical_decompiled_code:
__int64 __fastcall func10(__int64 a1, __int64 a2)
{
__int64 v2; // rbp
unsigned int v3; // ebx
__int64 v4; // rax
_QWORD *v5; // rdi
__int64 v6; // r12
__int64 v7; // rax

v2 = func2(a1);
if ( func6((_QWORD *)(v2 + 32)) )
{
*_errno_location() = 12;
v3 = -1;
}
else
{
v3 = 0;
v4 = func0(v2 + 32);
v5 = (_QWORD *)diminuto_list_remove(v4);
if ( v5 )
{
v6 = func5(v5, a2);
v7 = func1(v2);
diminuto_list_insert(v7, v6);
}
else
{
*_errno_location() = 14;
v3 = -1;
}
}
return v3;
}

original_code:
int diminuto_well_free(diminuto_well_t * wellp, void * pointer)
{
    int rc = -1;
    diminuto_list_t * nodep;
    wellp = diminuto_list_root(wellp);
    if (!diminuto_list_isempty(&wellp[DIMINUTO_WELL_USED])) {
        nodep = diminuto_list_remove(diminuto_list_next(&wellp[DIMINUTO_WELL_USED]));
        if (nodep != (diminuto_well_t *)0) {
            diminuto_list_insert(diminuto_list_prev(&wellp[DIMINUTO_WELL_FREE]), diminuto_list_datainit(nodep, pointer));
            rc = 0;
        } else {
            (*__errno_location ()) = 14;
        }
    } else {
        (*__errno_location ()) = 12;
    }
    return rc;
}

canonical_original_code:
int diminuto_well_free(struct DiminutoList *wellp, void *pointer)
{
    int rc = -1;
    struct DiminutoList *nodep;
    wellp = diminuto_list_root(wellp);
    if (!diminuto_list_isempty(&wellp[DIMINUTO_WELL_USED])) {
        nodep = diminuto_list_remove(diminuto_list_next(&wellp[DIMINUTO_WELL_USED]));
        if (nodep != (struct DiminutoList *)0) {
            diminuto_list_insert(diminuto_list_prev(&wellp[DIMINUTO_WELL_FREE]), diminuto_list_datainit(nodep, pointer));
            rc = 0;
        } else {
            (*__errno_location ()) = 14;
        }
    } else {
        (*__errno_location ()) = 12;
    }
    return rc;
}

variable_types: rc int


input

decompiled_code:
__int64 __fastcall input(char *s, size_t n)
{
int v2; // edx
__int64 result; // rax
int v4; // eax

if ( io == 1 )
{
v4 = fgetc(stdin);
if ( v4 != -1 )
{
*s = v4;
return 1LL;
}
goto LABEL_4;
}
if ( io != 2 )
{
if ( io )
goto LABEL_4;
result = fread(s, 1uLL, n, stdin);
LABEL_7:
if ( result > 0 )
return result;
goto LABEL_4;
}
if ( fgets(s, n, stdin) )
{
s[n - 1] = 0;
result = strlen(s);
goto LABEL_7;
}
LABEL_4:
v2 = feof(stdin);
result = 0LL;
if ( !v2 )
{
if ( ferror(stdin) )
*_errno_location() = 5;
else
*_errno_location() = 22;
perror("fread");
result = -1LL;
}
return result;
}

canonical_decompiled_code:
__int64 __fastcall func3(char *s, size_t n)
{
int v2; // edx
__int64 result; // rax
int v4; // eax

if ( io == 1 )
{
v4 = fgetc(stdin);
if ( v4 != -1 )
{
*s = v4;
return 1LL;
}
goto LABEL_4;
}
if ( io != 2 )
{
if ( io )
goto LABEL_4;
result = fread(s, 1uLL, n, stdin);
LABEL_7:
if ( result > 0 )
return result;
goto LABEL_4;
}
if ( fgets(s, n, stdin) )
{
s[n - 1] = 0;
result = strlen(s);
goto LABEL_7;
}
LABEL_4:
v2 = feof(stdin);
result = 0LL;
if ( !v2 )
{
if ( ferror(stdin) )
*_errno_location() = 5;
else
*_errno_location() = 22;
perror("fread");
result = -1LL;
}
return result;
}

original_code:
static ssize_t input(uint8_t * buffer, size_t size)
{
    ssize_t rc = 0;
    int ch = '\0';
    switch (io) {
    case BLOCK:
        rc = fread(buffer, 1, size, stdin);
        break;
    case CHARACTER:
        if ((ch = fgetc(stdin)) != (-1)) {
            *buffer = ch;
            rc = 1;
        }
        break;
    case LINE:
        if (fgets((char *)buffer, (int)size, stdin) != ((void *)0)) {
            buffer[size - 1] = '\0';
            rc = (ssize_t)strlen((char *)buffer);
        }
        break;
    default:
        break;
    }
    if (rc > 0) {
    } else if (feof(stdin)) {
        rc = 0;
    } else if (ferror(stdin)) {
        (*__errno_location ()) = 5;
        perror("fread");
        rc = -1;
    } else {
        (*__errno_location ()) = 22;
        perror("fread");
        rc = -1;
    }
    return rc;
}

canonical_original_code:
static long input(unsigned char *buffer, unsigned long size)
{
    long rc = 0;
    int ch = '\0';
    switch (io) {
    case BLOCK:
        rc = fread(buffer, 1, size, stdin);
        break;
    case CHARACTER:
        if ((ch = fgetc(stdin)) != (-1)) {
            *buffer = ch;
            rc = 1;
        }
        break;
    case LINE:
        if (fgets((char *)buffer, (int)size, stdin) != ((void *)0)) {
            buffer[size - 1] = '\0';
            rc = (long)strlen((char *)buffer);
        }
        break;
    default:
        break;
    }
    if (rc > 0) {
    } else if (feof(stdin)) {
        rc = 0;
    } else if (ferror(stdin)) {
        (*__errno_location ()) = 5;
        perror("fread");
        rc = -1;
    } else {
        (*__errno_location ()) = 22;
        perror("fread");
        rc = -1;
    }
    return rc;
}

variable_types:
buffer
unsigned char *

variable_types: rc long

variable_types: ch int