LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_c_makefile_star2_O2/canboat[P]canboat/analyzer/print.c
// Function: printString
static bool printString(const char *fieldName, const uint8_t *data, size_t len)
{
  const uint8_t *p;

  if (len > 0)
  {
    // find the first zero byte (Raymarine does this, followed by junk)
    for (p = data; p < data + len - 1; p++)
    {
      if (*p == '\0')
      {
        logDebug("printString: shorten len from %zu to %zu (C string seen)\n", len, p - data);
        len = p - data;
        p--;
        break;
        // still do the next part, maybe they have @ or spaces at the end still?
      }
    }
    // rtrim funny stuff from end, we see all sorts. 0xff is believed to be the correct
    // content according to NMEA 2000. '@' originates from badly converted NMEA AIS data.
    // Space is just to avoid funny strings, 0 looks like incorrect C data.
    while (len > 0 && (*p == 0xff || isspace((unsigned char) *p) || *p == 0 || *p == '@'))
    {
      len--;
      p--;
    }
  }

  if (len == 0)
  {
    printEmpty(fieldName, DATAFIELD_UNKNOWN);
    return true;
  }

  if (showJson)
  {
    mprintf("\"");
    print_ascii_json_escaped(data, len);
    mprintf("\"");
  }
  else
  {
    print_ascii_json_escaped(data, len);
  }

  return true;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
testq %rdx, %rdx
je 0x1aad4
movq %rsi, %rbx
leaq (%rsi,%rdx), %rax
decq %rax
xorl %r14d, %r14d
movq %rsi, %r15
cmpq %rax, %r15
jae 0x1aa81
cmpb $0x0, (%r15)
je 0x1aa86
incq %r15
incq %r14
jmp 0x1aa6e
movq %rdx, %r14
jmp 0x1aa9d
leaq 0x1231a(%rip), %rdi     # 0x2cda7
movq %rdx, %rsi
movq %r14, %rdx
xorl %eax, %eax
callq 0x1bd48
decq %r15
movq %r14, %r12
subq $0x1, %r12
jb 0x1aad4
movzbl (%r15), %r13d
cmpq $0xff, %r13
je 0x1aacc
callq 0xd350
movq (%rax), %rax
movzwl (%rax,%r13,2), %eax
btl $0xd, %eax
jb 0x1aacc
testb $-0x41, %r13b
jne 0x1aae4
decq %r15
movq %r12, %r14
jmp 0x1aaa0
xorl %esi, %esi
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
jmp 0x19614
leaq 0x74c07(%rip), %rax     # 0x8f6f2
cmpb $0x1, (%rax)
jne 0x1ab1f
leaq 0x122fa(%rip), %r15     # 0x2cdf1
movq %r15, %rdi
xorl %eax, %eax
callq 0x19194
movq %rbx, %rdi
movl %r14d, %esi
callq 0x1ae0f
movq %r15, %rdi
xorl %eax, %eax
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
jmp 0x19194
movq %rbx, %rdi
movl %r14d, %esi
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
jmp 0x1ae0f
// File: /workspace/github_c_makefile_star2_O2/canboat[P]canboat/analyzer/print.c
// Function: fieldPrintStringLZ
extern bool fieldPrintStringLZ(const Field   *field,
                               const char    *fieldName,
                               const uint8_t *data,
                               size_t         dataLen,
                               size_t         startBit,
                               size_t        *bits)
{
  // STRINGLZ format is <len> [ <data> ... ] <zero>
  size_t len;

  if (!adjustDataLenStart(&data, &dataLen, &startBit))
  {
    return false;
  }

  // Cap to dataLen
  len   = *data++;
  len   = CB_MIN(len, dataLen - 1);
  *bits = BYTES(len + 2);

  return printString(fieldName, data, len);
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %r8, %rbx
movq %rcx, %r14
shrq $0x3, %rbx
cmpq %rcx, %rbx
jae 0x1ab79
leaq (%rdx,%rbx), %rax
incq %rax
movzbl -0x1(%rax), %ecx
movq %rbx, %rdx
notq %rdx
addq %r14, %rdx
cmpq %rcx, %rdx
cmovaeq %rcx, %rdx
movl %edx, %ecx
leaq 0x10(,%rcx,8), %rcx
movq %rcx, (%r9)
movq %rsi, %rdi
movq %rax, %rsi
callq 0x1aa50
cmpq %r14, %rbx
setb %al
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O2/canboat[P]canboat/analyzer/print.c
// Function: fieldPrintKeyValue
extern bool fieldPrintKeyValue(const Field   *field,
                               const char    *fieldName,
                               const uint8_t *data,
                               size_t         dataLen,
                               size_t         startBit,
                               size_t        *bits)
{
  bool r = false;

  if (g_length != 0)
  {
    *bits = ((size_t) g_length) * 8;
  }
  else
  {
    *bits = field->size;
  }
  logDebug("fieldPrintKeyValue('%s') bits=%zu\n", fieldName, *bits);

  if (dataLen >= ((startBit + *bits) >> 3))
  {
    if (g_ftf != NULL)
    {
      const Field *f = g_ftf;

      logDebug("fieldPrintKeyValue('%s') is actually a '%s' field bits=%u\n", fieldName, f->ft->name, f->size);

      if (*bits == 0)
      {
        *bits = f->size;
      }
      if (*bits == 0 && f->ft && f->ft->name && strcmp(f->ft->name, "LOOKUP") == 0)
      {
        *bits = f->lookup.size;
      }

      r = (f->ft->pf)(f, fieldName, data, dataLen, startBit, bits);
    }
    else
    {
      r = fieldPrintBinary(field, fieldName, data, dataLen, startBit, bits);
    }
  }
  else
  {
    logError("PGN %u key-value has insufficient bytes for field %s\n", field->pgn ? field->pgn->pgn : 0, fieldName);
  }

  g_ftf    = NULL;
  g_length = 0;

  return r;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %r9, %r14
movq %r8, %r15
movq %rcx, %r12
movq %rdx, (%rsp)
movq %rsi, %rbx
movq %rdi, %r13
movq 0x76b67(%rip), %rdx     # 0x91858
testq %rdx, %rdx
je 0x1acfc
shlq $0x3, %rdx
jmp 0x1ad00
movl 0x10(%r13), %edx
movq %rdx, (%r14)
leaq 0x11f65(%rip), %rdi     # 0x2cc6f
xorl %ebp, %ebp
movq %rbx, %rsi
xorl %eax, %eax
callq 0x1bd48
movq (%r14), %rax
addq %r15, %rax
shrq $0x3, %rax
cmpq %r12, %rax
jbe 0x1ad4c
movq 0x90(%r13), %rax
testq %rax, %rax
je 0x1ad34
movl 0x8(%rax), %ebp
leaq 0x11f92(%rip), %rdi     # 0x2cccd
xorl %r14d, %r14d
movl %ebp, %esi
movq %rbx, %rdx
xorl %eax, %eax
callq 0x1bdd9
jmp 0x1adc8
movq 0x76afd(%rip), %rbp     # 0x91850
testq %rbp, %rbp
je 0x1ad85
movq 0x88(%rbp), %rax
movq (%rax), %rdx
movl 0x10(%rbp), %ecx
leaq 0x11f26(%rip), %rdi     # 0x2cc92
movq %rbx, %rsi
xorl %eax, %eax
callq 0x1bd48
cmpq $0x0, (%r14)
je 0x1ad9c
movq 0x88(%rbp), %r13
jmp 0x1adae
movq %r13, %rdi
movq (%rsp), %rdx
movq %r12, %rcx
movq %r15, %r8
movq %r14, %r9
callq 0x1a0bb
jmp 0x1adc5
movl 0x10(%rbp), %eax
movq %rax, (%r14)
movq 0x88(%rbp), %r13
testq %rax, %rax
je 0x1adea
movq %rbp, %rdi
movq %rbx, %rsi
movq (%rsp), %rdx
movq %r12, %rcx
movq %r15, %r8
movq %r14, %r9
callq *0x78(%r13)
movl %eax, %r14d
andq $0x0, 0x76a80(%rip)     # 0x91850
andq $0x0, 0x76a80(%rip)     # 0x91858
movl %r14d, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq (%r13), %rdi
testq %rdi, %rdi
je 0x1adae
leaq 0xf5b0(%rip), %rsi      # 0x2a3aa
callq 0xd1a0
testl %eax, %eax
jne 0x1adae
movq 0x80(%rbp), %rax
movq %rax, (%r14)
jmp 0x1adae
// File: /workspace/github_c_makefile_star2_O2/canboat[P]canboat/analyzer/print.c
// Function: print_ascii_json_escaped
static void print_ascii_json_escaped(const uint8_t *data, int len)
{
  int c;
  int k;

  for (k = 0; k < len; k++)
  {
    c = data[k];
    switch (c)
    {
      case '\b':
        mprintf("%s", "\\b");
        break;

      case '\n':
        mprintf("%s", "\\n");
        break;

      case '\r':
        mprintf("%s", "\\r");
        break;

      case '\t':
        mprintf("%s", "\\t");
        break;

      case '\f':
        mprintf("%s", "\\f");
        break;

      case '"':
        mprintf("%s", "\\\"");
        break;

      case '\\':
        mprintf("%s", "\\\\");
        break;

      case '/':
        mprintf("%s", "\\/");
        break;

      case '\377':
        // 0xff has been seen on recent Simrad VHF systems, and it seems to indicate
        // end-of-field, with noise following. Assume this does not break other systems.
        return;

      default:
        if (c > 0x00)
        {
          mprintf("%c", c);
        }
    }
  }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %esi, %ebx
movq %rdi, %r14
xorl %eax, %eax
testl %esi, %esi
cmovlel %eax, %ebx
leaq 0x16d91(%rip), %r15     # 0x31bbe
leaq 0x11c17(%rip), %r12     # 0x2ca4b
leaq 0x11811(%rip), %rbp     # 0x2c64c
xorl %r13d, %r13d
cmpq %r13, %rbx
je 0x1aee4
movzbl (%r14,%r13), %esi
cmpq $0xd, %rsi
ja 0x1ae68
movslq (%rbp,%rsi,4), %rax
addq %rbp, %rax
jmpq *%rax
movq %r15, %rdi
leaq 0x11f7b(%rip), %rsi     # 0x2cde1
jmp 0x1aed5
cmpl $0x22, %esi
je 0x1aecb
cmpl $0x2f, %esi
je 0x1aebf
cmpl $0x5c, %esi
jne 0x1ae83
movq %r15, %rdi
leaq 0x11f72(%rip), %rsi     # 0x2cdf3
jmp 0x1aed5
movq %r12, %rdi
xorl %eax, %eax
callq 0x19194
jmp 0x1aedc
movq %r15, %rdi
leaq 0x11f54(%rip), %rsi     # 0x2cded
jmp 0x1aed5
movq %r15, %rdi
leaq 0x11f3f(%rip), %rsi     # 0x2cde4
jmp 0x1aed5
movq %r15, %rdi
leaq 0x11f39(%rip), %rsi     # 0x2cdea
jmp 0x1aed5
movq %r15, %rdi
leaq 0x11f2a(%rip), %rsi     # 0x2cde7
jmp 0x1aed5
movq %r15, %rdi
leaq 0x11f2d(%rip), %rsi     # 0x2cdf6
jmp 0x1aed5
movq %r15, %rdi
leaq 0x11f1b(%rip), %rsi     # 0x2cdf0
xorl %eax, %eax
callq 0x19194
incq %r13
jmp 0x1ae3e
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_c_makefile_star2_O2/canboat[P]canboat/analyzer/fieldtype.c
// Function: getFieldType
extern FieldType *getFieldType(const char *name)
{
  for (size_t i = 0; i < fieldTypeCount; i++)
  {
    if (strcmp(name, fieldTypeList[i].name) == 0)
    {
      return &fieldTypeList[i];
    }
  }
  logError("fieldType '%s' not found\n", name);
  return NULL;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rdi, %rbx
xorl %ecx, %ecx
leaq 0x6e70b(%rip), %r14     # 0x89610
leaq 0x90(%rcx), %r15
cmpq $0x6150, %r15           # imm = 0x6150
je 0x1af34
movq (%rcx,%r14), %rsi
movq %rbx, %rdi
callq 0xd1a0
movq %r15, %rcx
testl %eax, %eax
jne 0x1af05
addq %r15, %r14
addq $-0x90, %r14
jmp 0x1af48
leaq 0x154f7(%rip), %rdi     # 0x30432
xorl %r14d, %r14d
movq %rbx, %rsi
xorl %eax, %eax
callq 0x1bdd9
movq %r14, %rax
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O2/canboat[P]canboat/analyzer/fieldtype.c
// Function: getMinRange
static double getMinRange(const char *name, uint32_t size, double resolution, bool sign, int32_t offset)
{
  uint32_t highbit = (sign && offset == 0) ? (size - 1) : size;
  int64_t  minValue;
  double   r;

  if (!sign || offset != 0)
  {
    minValue = INT64_C(0) + offset;
    r        = minValue * resolution;
  }
  else
  {
    minValue = (UINT64_C(1) << highbit) - 1;
    r        = minValue * resolution * -1.0;
  }
  logDebug(
      "%s bits=%llu sign=%u minValue=%lld res=%g offset=%d -> rangeMin %g\n", name, highbit, sign, minValue, resolution, offset, r);
  return r;
}

// Assembly:
movl %ecx, %r9d
movl %edx, %eax
movl %esi, %edx
movq %rdi, %rsi
testl %ecx, %ecx
sete %cl
andb %al, %cl
movzbl %cl, %ecx
subl %ecx, %edx
testb %cl, %cl
je 0x1b963
pushq $-0x1
popq %r8
movl %edx, %ecx
shlq %cl, %r8
notq %r8
cvtsi2sd %r8, %xmm1
xorpd 0x114ef(%rip), %xmm1    # 0x2ce50
jmp 0x1b96b
movslq %r9d, %r8
cvtsi2sd %r9d, %xmm1
subq $0x18, %rsp
mulsd %xmm0, %xmm1
movzbl %al, %ecx
leaq 0x15dc4(%rip), %rdi     # 0x31741
movapd %xmm1, (%rsp)
movb $0x2, %al
callq 0x1bd48
movaps (%rsp), %xmm0
addq $0x18, %rsp
retq
// File: /workspace/github_c_makefile_star2_O2/canboat[P]canboat/analyzer/fieldtype.c
// Function: getMaxRange
static double getMaxRange(const char *name, uint32_t size, double resolution, bool sign, int32_t offset, LookupInfo *lookup)
{
  uint64_t specialvalues = (size >= 8) ? 3 : (size >= 4) ? 2 : (size >= 2) ? 1 : 0;
  uint32_t highbit       = (sign && offset == 0) ? (size - 1) : size;
  uint64_t maxValue;
  double   r;

  maxValue = (UINT64_C(1) << highbit) - 1 - specialvalues;
  if (offset != 0)
  {
    maxValue += offset;
  }

#ifdef EXPLAIN
  if (lookup != NULL && lookup->type == LOOKUP_TYPE_PAIR)
  {
    // maybe the specialValues are actually lookups, correct these.
    // Remember, when EXPLAIN is set the lookup function is like:
    // void lookupYES_NO(EnumPairCallback cb)
    // {
    //   (cb)(0, "No");
    //   (cb)(1, "Yes");
    // }
    g_max = maxValue;
    (*lookup->function.pairEnumerator)(fillMaxRangeLookup);
    maxValue = g_max;
  }
#endif

  r = maxValue * resolution;
  logDebug(
      "%s bits=%llu sign=%u maxValue=%lld res=%g offset=%d -> rangeMax %g\n", name, highbit, sign, maxValue, resolution, offset, r);
  return r;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x18, %rsp
movl %ecx, %ebx
movl %edx, %r15d
movl %esi, %ebp
movq %rdi, %r14
cmpl $0x7, %esi
jbe 0x1b9af
pushq $-0x3
jmp 0x1b9b6
cmpl $0x3, %ebp
jbe 0x1b9b9
pushq $-0x2
popq %rdx
jmp 0x1b9c2
xorl %edx, %edx
cmpl $0x2, %ebp
adcq $-0x1, %rdx
testl %ebx, %ebx
sete %al
andb %r15b, %al
movzbl %al, %eax
subl %eax, %ebp
pushq $-0x1
popq %rsi
movl %ebp, %ecx
shlq %cl, %rsi
notq %rsi
movslq %ebx, %rax
addq %rdx, %rax
addq %rsi, %rax
testq %r8, %r8
je 0x1ba12
cmpl $0x1, 0x8(%r8)
jne 0x1ba12
movq %rax, 0x75e6a(%rip)     # 0x91860
leaq 0x13e(%rip), %rdi       # 0x1bb3b
movsd %xmm0, (%rsp)
callq *0x10(%r8)
movsd (%rsp), %xmm0
movq 0x75e4e(%rip), %rax     # 0x91860
movq %rax, %xmm1
punpckldq 0x10ca1(%rip), %xmm1 # xmm1 = xmm1[0],mem[0],xmm1[1],mem[1]
subpd 0x10ca9(%rip), %xmm1    # 0x2c6d0
movapd %xmm1, %xmm2
unpckhpd %xmm1, %xmm2            # xmm2 = xmm2[1],xmm1[1]
addsd %xmm1, %xmm2
mulsd %xmm0, %xmm2
movapd %xmm2, %xmm1
movapd %xmm2, (%rsp)
movzbl %r15b, %ecx
leaq 0x15d3a(%rip), %rdi     # 0x31785
movq %r14, %rsi
movl %ebp, %edx
movq %rax, %r8
movl %ebx, %r9d
movb $0x2, %al
callq 0x1bd48
movaps (%rsp), %xmm0
addq $0x18, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/canboat[P]canboat/analyzer/fieldtype.c
// Function: fillFieldTypeLookupField
extern void fillFieldTypeLookupField(Field *f, const char *lookup, const size_t key, const char *str, const char *ft)
{
  f->ft = getFieldType(ft);
  if (f->ft == NULL)
  {
    logAbort("LookupFieldType %s(%d) contains an invalid fieldtype '%s'\n", lookup, key, ft);
  }
  f->unit       = f->ft->unit;
  f->resolution = f->ft->resolution;
  f->hasSign    = f->ft->hasSign == True;
  if (f->size == 0)
  {
    f->size = f->ft->size;
  }
  f->name = str;
  if (f->unit != NULL)
  {
    fixupUnit(f);
  }

  logDebug("fillFieldTypeLookupField(Field, lookup='%s', key=%zu, str='%s', ft='%s' unit='%s' bits=%u\n",
           lookup,
           key,
           str,
           ft,
           STRNULL(f->unit),
           f->size);
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x10, %rsp
movq %r8, %rbx
movq %rcx, %r14
movq %rdx, %r15
movq %rsi, %r12
movq %rdi, %r13
movq %r8, %rdi
callq 0x1aef4
movq %rax, 0x88(%r13)
testq %rax, %rax
jne 0x1baba
leaq 0x14ef7(%rip), %rdi     # 0x3099a
movq %r12, %rsi
movq %r15, %rdx
movq %rbx, %rcx
xorl %eax, %eax
callq 0x1be6a
movq 0x88(%r13), %rax
movq 0x48(%rax), %rdx
movq %rdx, 0x18(%r13)
movsd 0x58(%rax), %xmm0
movsd %xmm0, 0x30(%r13)
cmpl $0x2, 0x60(%rax)
sete 0x49(%r13)
movl 0x10(%r13), %ecx
testl %ecx, %ecx
jne 0x1bae5
movl 0x28(%rax), %ecx
movl %ecx, 0x10(%r13)
movq %r14, (%r13)
testq %rdx, %rdx
je 0x1bb00
movq %r13, %rdi
callq 0x1af51
movq 0x18(%r13), %rax
movl 0x10(%r13), %ecx
jmp 0x1bb02
xorl %eax, %eax
testq %rax, %rax
leaq 0x75f9(%rip), %r9       # 0x23105
cmovneq %rax, %r9
movl %ecx, (%rsp)
leaq 0x14ebb(%rip), %rdi     # 0x309d5
movq %r12, %rsi
movq %r15, %rdx
movq %r14, %rcx
movq %rbx, %r8
xorl %eax, %eax
callq 0x1bd48
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O2/canboat[P]canboat/analyzer/../common/parse.c
// Function: parseRawFormatPlain
int parseRawFormatPlain(char *msg, RawMessage *m, bool showJson)
{
  unsigned int prio, pgn, dst, src, len, junk, r, i;
  char        *p;
  unsigned int data[8];

  p = findOccurrence(msg, ',', 1);
  if (!p)
  {
    return 1;
  }
  p--; // Back to comma

  memcpy(m->timestamp, msg, p - msg);
  m->timestamp[p - msg] = 0;

  /* Moronic Windows does not support %hh<type> so we use intermediate variables */
  r = sscanf(p,
             ",%u,%u,%u,%u,%u"
             ",%x,%x,%x,%x,%x,%x,%x,%x,%x",
             &prio,
             &pgn,
             &src,
             &dst,
             &len,
             &data[0],
             &data[1],
             &data[2],
             &data[3],
             &data[4],
             &data[5],
             &data[6],
             &data[7],
             &junk);
  if (r < 5)
  {
    logError("Error reading message, scanned %zu from %s", r, msg);
    if (!showJson)
      fprintf(stdout, "%s", msg);
    return 2;
  }

  if (len > 8)
  {
    // This is not PLAIN format but FAST format */
    return -1;
  }

  if (r <= 5 + 8)
  {
    for (i = 0; i < len; i++)
    {
      m->data[i] = data[i];
    }
  }
  else
  {
    return -1;
  }

  return setParsedValues(m, prio, pgn, dst, src, len);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movl %edx, %ebp
movq %rsi, %rbx
movq %rdi, %r14
pushq $0x2c
popq %rsi
pushq $0x1
popq %r12
movl %r12d, %edx
callq 0x1ced8
testq %rax, %rax
je 0x1cec6
movq %rax, %r15
movl %ebp, 0x8(%rsp)
decq %r15
movq %r15, %r12
subq %r14, %r12
movq %rbx, %rdi
movq %r14, %rsi
movq %r12, %rdx
callq 0xd1e0
movb $0x0, (%rbx,%r12)
leaq 0x30(%rsp), %r11
leaq 0x34(%rsp), %r12
leaq 0x38(%rsp), %r13
leaq 0x3c(%rsp), %r10
leaq 0x44(%rsp), %rbp
leaq 0x14c53(%rip), %rsi     # 0x31a3c
leaq 0x1c(%rsp), %rdx
leaq 0x18(%rsp), %rcx
leaq 0x10(%rsp), %r8
leaq 0x14(%rsp), %r9
movq %r15, %rdi
movl $0x0, %eax
pushq %rbp
pushq %r10
pushq %r13
pushq %r12
pushq %r11
leaq 0x54(%rsp), %r10
pushq %r10
leaq 0x58(%rsp), %r10
pushq %r10
leaq 0x5c(%rsp), %r10
pushq %r10
leaq 0x60(%rsp), %r10
pushq %r10
leaq 0x54(%rsp), %r10
pushq %r10
callq 0xd220
addq $0x50, %rsp
cmpl $0x4, %eax
ja 0x1ce71
leaq 0x14c21(%rip), %rdi     # 0x31a67
movl %eax, %esi
movq %r14, %rdx
xorl %eax, %eax
callq 0x1bdd9
pushq $0x2
popq %r12
cmpb $0x0, 0x8(%rsp)
jne 0x1cec6
movq 0x1d164(%rip), %rax     # 0x39fc8
movq (%rax), %rsi
movq %r14, %rdi
callq 0xd170
jmp 0x1cec6
movl 0xc(%rsp), %ecx
cmpq $0x9, %rcx
setae %dl
cmpl $0xe, %eax
setae %al
orb %dl, %al
jne 0x1ce9a
xorl %eax, %eax
cmpq %rax, %rcx
je 0x1cea0
movb 0x20(%rsp,%rax,4), %dl
movb %dl, 0x47(%rbx,%rax)
incq %rax
jmp 0x1ce88
pushq $-0x1
popq %r12
jmp 0x1cec6
movb 0x1c(%rsp), %al
movl 0x18(%rsp), %edx
movb 0x14(%rsp), %sil
movb 0x10(%rsp), %dil
movb %al, 0x3c(%rbx)
movl %edx, 0x40(%rbx)
movb %sil, 0x44(%rbx)
movb %dil, 0x45(%rbx)
movb %cl, 0x46(%rbx)
xorl %r12d, %r12d
movl %r12d, %eax
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/canboat[P]canboat/analyzer/../common/parse.c
// Function: findOccurrence
static char *findOccurrence(char *msg, char c, int count)
{
  int   i;
  char *p;

  if (*msg == 0 || *msg == '\n')
  {
    return 0;
  }
  for (i = 0, p = msg; p && i < count; i++, p++)
  {
    p = strchr(p, c);
    if (!p)
    {
      return 0;
    }
  }
  return p;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movzbl (%rdi), %ecx
xorl %ebx, %ebx
testl %ecx, %ecx
je 0x1cf17
cmpl $0xa, %ecx
je 0x1cf17
movl %edx, %ebp
movq %rdi, %rax
movzbl %sil, %r14d
xorl %ebx, %ebx
testl %edx, %edx
cmovlel %ebx, %ebp
subl $0x1, %ebp
jb 0x1cf14
movq %rax, %rdi
movl %r14d, %esi
callq 0xd100
testq %rax, %rax
je 0x1cf17
incq %rax
jmp 0x1cefa
movq %rax, %rbx
movq %rbx, %rax
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/canboat[P]canboat/analyzer/../common/parse.c
// Function: parseRawFormatChetco
int parseRawFormatChetco(char *msg, RawMessage *m, bool showJson)
{
  unsigned int pgn, src, i;
  unsigned int tstamp;
  time_t       t;
  struct tm    tm;
  char        *p;

  if (*msg == 0 || *msg == '\n')
  {
    return 1;
  }

  if (sscanf(msg, "$PCDIN,%x,%x,%x,", &pgn, &tstamp, &src) < 3)
  {
    logError("Error reading Chetco message: %s", msg);
    if (!showJson)
      fprintf(stdout, "%s", msg);
    return 2;
  }

  t = (time_t) tstamp / 1000;
  localtime_r(&t, &tm);
  strftime(m->timestamp, sizeof(m->timestamp), "%Y-%m-%dT%H:%M:%S", &tm);
  sprintf(m->timestamp + strlen(m->timestamp), ",%3.3u", tstamp % 1000);

  p = msg + STRSIZE("$PCDIN,01FD07,089C77D!,03,"); // Fixed length where data bytes start;

  for (i = 0; *p != '*'; i++)
  {
    if (scanHex(&p, &m->data[i]))
    {
      logError("Error reading message, scanned %zu bytes from %s/%s, index %u", p - msg, msg, p, i);
      if (!showJson)
        fprintf(stdout, "%s", msg);
      return 2;
    }
  }

  return setParsedValues(m, 0, pgn, 255, src, i + 1);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x58, %rsp
movzbl (%rdi), %eax
pushq $0x1
popq %r15
testl %eax, %eax
je 0x1d43a
cmpl $0xa, %eax
je 0x1d43a
movl %edx, %ebp
movq %rsi, %r14
movq %rdi, %rbx
leaq 0x1482f(%rip), %rsi     # 0x31b47
xorl %r15d, %r15d
leaq 0xc(%rsp), %rdx
leaq 0x4(%rsp), %rcx
leaq 0x8(%rsp), %r8
xorl %eax, %eax
callq 0xd220
cmpl $0x2, %eax
jg 0x1d34c
leaq 0x1481b(%rip), %rdi     # 0x31b58
movq %rbx, %rsi
xorl %eax, %eax
callq 0x1bdd9
jmp 0x1d41f
movl 0x4(%rsp), %eax
movl $0x3e8, %r13d           # imm = 0x3E8
xorl %edx, %edx
divl %r13d
leaq 0x18(%rsp), %rdi
movq %rax, (%rdi)
leaq 0x20(%rsp), %r12
movq %r12, %rsi
callq 0xd0a0
leaq 0x14491(%rip), %rdx     # 0x31808
pushq $0x3c
popq %rsi
movq %r14, %rdi
movq %r12, %rcx
callq 0xd260
movq %r14, %rdi
callq 0xd0f0
leaq (%rax,%r14), %rdi
movl 0x4(%rsp), %eax
xorl %edx, %edx
divl %r13d
leaq 0x147d8(%rip), %rsi     # 0x31b79
xorl %eax, %eax
callq 0xd2c0
leaq 0x1a(%rbx), %rax
leaq 0x10(%rsp), %r12
movq %rax, (%r12)
leaq 0x47(%r14), %r13
cmpb $0x2a, (%rax)
je 0x1d3da
movl %r15d, %esi
addq %r13, %rsi
movq %r12, %rdi
callq 0x1ca7b
testl %eax, %eax
jne 0x1d400
incl %r15d
movq 0x10(%rsp), %rax
jmp 0x1d3b9
movl 0xc(%rsp), %eax
movb 0x8(%rsp), %cl
movb $0x0, 0x3c(%r14)
movl %eax, 0x40(%r14)
movb $-0x1, 0x44(%r14)
movb %cl, 0x45(%r14)
incb %r15b
movb %r15b, 0x46(%r14)
xorl %r15d, %r15d
jmp 0x1d43a
movq 0x10(%rsp), %rcx
movq %rcx, %rsi
subq %rbx, %rsi
leaq 0x146c6(%rip), %rdi     # 0x31ad8
movq %rbx, %rdx
movl %r15d, %r8d
xorl %eax, %eax
callq 0x1bdd9
pushq $0x2
popq %r15
testb %bpl, %bpl
jne 0x1d43a
movq 0x1cb99(%rip), %rax     # 0x39fc8
movq (%rax), %rsi
movq %rbx, %rdi
callq 0xd170
movl %r15d, %eax
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/canboat[P]canboat/analyzer/../common/parse.c
// Function: parseRawFormatYDWG02
int parseRawFormatYDWG02(char *msg, RawMessage *m, bool showJson)
{
  char        *token;
  char        *nexttoken;
  time_t       tiden;
  struct tm    tm;
  unsigned int msgid;
  unsigned int prio, pgn, src, dst;
  int          i;

  // parse timestamp. YDWG doesn't give us date so let's figure it out ourself
  token = strtok_r(msg, " ", &nexttoken);
  if (!token)
  {
    return -1;
  }
  tiden = (time_t) (getNow() / UINT64_C(1000));
  localtime_r(&tiden, &tm);
  strftime(m->timestamp, sizeof(m->timestamp), "%Y-%m-%dT", &tm);
  sprintf(m->timestamp + strlen(m->timestamp), "%s", token);

  // parse direction, not really used in analyzer
  token = strtok_r(NULL, " ", &nexttoken);
  if (!token)
  {
    return -1;
  }

  // parse msgid
  token = strtok_r(NULL, " ", &nexttoken);
  if (!token)
  {
    return -1;
  }
  msgid = strtoul(token, NULL, 16);
  getISO11783BitsFromCanId(msgid, &prio, &pgn, &src, &dst);

  // parse data
  i = 0;
  while ((token = strtok_r(NULL, " ", &nexttoken)) != 0)
  {
    m->data[i] = strtoul(token, NULL, 16);
    i++;
    if (i > FASTPACKET_MAX_SIZE)
    {
      return -1;
    }
  }

  return setParsedValues(m, prio, pgn, dst, src, i);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x58, %rsp
movq %rsi, %rbx
leaq 0x4cbb(%rip), %rsi      # 0x22409
movq %rsp, %rdx
callq 0xd190
pushq $-0x1
popq %rbp
testq %rax, %rax
je 0x1d875
movq %rax, %r14
callq 0x1bb54
movl $0x3e8, %ecx            # imm = 0x3E8
xorl %edx, %edx
divq %rcx
leaq 0x18(%rsp), %rdi
movq %rax, (%rdi)
leaq 0x20(%rsp), %r15
movq %r15, %rsi
callq 0xd0a0
leaq 0x14472(%rip), %rdx     # 0x31c02
pushq $0x3c
popq %rsi
movq %rbx, %rdi
movq %r15, %rcx
callq 0xd260
movq %rbx, %rdi
callq 0xd0f0
leaq (%rax,%rbx), %rdi
movq %r14, %rsi
callq 0xd0b0
leaq 0x4c50(%rip), %rsi      # 0x22409
movq %rsp, %rdx
xorl %edi, %edi
callq 0xd190
testq %rax, %rax
je 0x1d875
leaq 0x4c36(%rip), %rsi      # 0x22409
movq %rsp, %rdx
xorl %edi, %edi
callq 0xd190
testq %rax, %rax
je 0x1d875
xorl %r13d, %r13d
pushq $0x10
popq %r14
movq %rax, %rdi
xorl %esi, %esi
movl %r14d, %edx
callq 0xd2a0
leaq 0x14(%rsp), %rsi
leaq 0x10(%rsp), %rdx
leaq 0xc(%rsp), %rcx
leaq 0x8(%rsp), %r8
movl %eax, %edi
callq 0x1c830
leaq 0x4bed(%rip), %r15      # 0x22409
movq %rsp, %r12
xorl %edi, %edi
movq %r15, %rsi
movq %r12, %rdx
callq 0xd190
testq %rax, %rax
je 0x1d851
movq %rax, %rdi
xorl %esi, %esi
movl %r14d, %edx
callq 0xd2a0
movb %al, 0x47(%rbx,%r13)
incq %r13
cmpq $0xe0, %r13
jne 0x1d81f
jmp 0x1d875
movb 0x14(%rsp), %al
movl 0x10(%rsp), %ecx
movb 0x8(%rsp), %dl
movb 0xc(%rsp), %sil
movb %al, 0x3c(%rbx)
movl %ecx, 0x40(%rbx)
movb %dl, 0x44(%rbx)
movb %sil, 0x45(%rbx)
movb %r13b, 0x46(%rbx)
xorl %ebp, %ebp
movl %ebp, %eax
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/canboat[P]canboat/analyzer/../common/utf.c
// Function: utf16_to_utf8
size_t utf16_to_utf8(utf16_t const *utf16, size_t utf16_len, utf8_t *utf8, size_t utf8_len)
{
  // The next codepoint that will be written in the UTF-8 string
  // or the size of the required buffer if utf8 is NULL
  size_t utf8_index = 0;

  for (size_t utf16_index = 0; utf16_index < utf16_len; utf16_index++)
  {
    codepoint_t codepoint = decode_utf16(utf16, utf16_len, &utf16_index);

    if (utf8 == NULL)
      utf8_index += calculate_utf8_len(codepoint);
    else
      utf8_index += encode_utf8(codepoint, utf8, utf8_len, utf8_index);
  }

  return utf8_index;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
leaq -0x1(%rsi), %r8
xorl %r9d, %r9d
movl $0x1, %ebp
leaq 0x13ee9(%rip), %r14     # 0x31d46
xorl %eax, %eax
cmpq %rsi, %r9
jae 0x1dfa5
movzwl (%rdi,%r9,2), %r13d
movl %r13d, %r10d
andl $0xf800, %r10d          # imm = 0xF800
cmpl $0xd800, %r10d          # imm = 0xD800
jne 0x1dee1
movl %r13d, %r10d
andl $0xdc00, %r10d          # imm = 0xDC00
cmpl $0xd800, %r10d          # imm = 0xD800
setne %r10b
cmpq %r8, %r9
sete %r11b
orb %r10b, %r11b
jne 0x1dedb
movzwl 0x2(%rdi,%r9,2), %r10d
movl %r10d, %r11d
andl $0xfc00, %r11d          # imm = 0xFC00
cmpl $0xdc00, %r11d          # imm = 0xDC00
jne 0x1dedb
incq %r9
shll $0xa, %r13d
andl $0xffc00, %r13d         # imm = 0xFFC00
andl $0x3ff, %r10d           # imm = 0x3FF
addl %r10d, %r13d
addl $0x10000, %r13d         # imm = 0x10000
jmp 0x1dee1
movl $0xfffd, %r13d          # imm = 0xFFFD
testq %rdx, %rdx
je 0x1df23
movl %ebp, %r10d
cmpl $0x80, %r13d
jb 0x1df12
movl $0x2, %r10d
cmpl $0x800, %r13d           # imm = 0x800
jb 0x1df12
cmpl $0x10000, %r13d         # imm = 0x10000
movl $0x4, %r10d
sbbl $0x0, %r10d
movl %r10d, %r10d
leaq (%rax,%r10), %r11
cmpq %rcx, %r11
jbe 0x1df60
xorl %r10d, %r10d
jmp 0x1df9a
movabsq $0x1, %r10
cmpl $0x80, %r13d
jb 0x1df9a
movabsq $0x2, %r10
cmpl $0x800, %r13d           # imm = 0x800
jb 0x1df9a
cmpl $0x10000, %r13d         # imm = 0x10000
movabsq $0x4, %r10
sbbq $0x0, %r10
jmp 0x1df9a
leal -0x1(%r10), %r15d
leaq (%rdx,%rax), %r12
movq %r15, %r11
testl %r11d, %r11d
jle 0x1df86
movl %r13d, %ebx
andb $0x3f, %bl
orb $-0x80, %bl
movb %bl, (%r12,%r11)
shrl $0x6, %r13d
decq %r11
jmp 0x1df6b
movzbl (%r14,%r15,2), %r11d
notl %r11d
andl %r11d, %r13d
orb 0x1(%r14,%r15,2), %r13b
movb %r13b, (%r12)
addq %r10, %rax
incq %r9
jmp 0x1de5f
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/canboat[P]canboat/analyzer/../common/utf.c
// Function: utf8_to_utf16
size_t utf8_to_utf16(utf8_t const *utf8, size_t utf8_len, utf16_t *utf16, size_t utf16_len)
{
  // The next codepoint that will be written in the UTF-16 string
  // or the size of the required buffer if utf16 is NULL
  size_t utf16_index = 0;

  for (size_t utf8_index = 0; utf8_index < utf8_len; utf8_index++)
  {
    codepoint_t codepoint = decode_utf8(utf8, utf8_len, &utf8_index);

    if (utf16 == NULL)
      utf16_index += calculate_utf16_len(codepoint);
    else
      utf16_index += encode_utf16(codepoint, utf16, utf16_len, utf16_index);
  }

  return utf16_index;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
leaq -0x1(%rsi), %rax
movq %rax, -0x8(%rsp)
xorl %r13d, %r13d
leaq 0x13d79(%rip), %r10     # 0x31d46
xorl %eax, %eax
cmpq %rsi, %r13
jae 0x1e164
movzbl (%rdi,%r13), %r15d
movabsq $0x1, %r9
xorl %ebp, %ebp
movq %rbp, %rbx
incq %rbp
movzbl (%r10,%rbx,2), %r11d
movzbl 0x1(%r10,%rbx,2), %r8d
movl %r11d, %r12d
andl %r15d, %r12d
decq %r9
cmpq $0x2, %rbx
ja 0x1e00e
cmpl %r8d, %r12d
jne 0x1dfe9
movl $0xfffd, %r14d          # imm = 0xFFFD
cmpl %r8d, %r12d
je 0x1e021
movq %r13, %r8
jmp 0x1e0d6
movq %r13, %r8
subq %r9, %r8
notl %r11d
andl %r15d, %r11d
subl $0x1, %ebx
jb 0x1e065
leaq 0x1(%r13), %r9
cmpq %rsi, %r9
jae 0x1e0d1
movzbl 0x1(%rdi,%r13), %r15d
movl %r15d, %r12d
andl $-0x40, %r12d
cmpl $0x80, %r12d
jne 0x1e019
shll $0x6, %r11d
andl $0x3f, %r15d
orl %r15d, %r11d
movq %r9, %r13
jmp 0x1e02d
movl $0x1, %r9d
cmpl $0x80, %r11d
jb 0x1e094
movl $0x2, %r9d
cmpl $0x800, %r11d           # imm = 0x800
jb 0x1e094
cmpl $0x10000, %r11d         # imm = 0x10000
movl $0x4, %r9d
sbbl $0x0, %r9d
cmpl %ebp, %r9d
jne 0x1e0d6
cmpl $0xffff, %r11d          # imm = 0xFFFF
setb %r9b
movl %r11d, %ebx
andl $0xf800, %ebx           # imm = 0xF800
cmpl $0xd800, %ebx           # imm = 0xD800
sete %bl
testb %bl, %r9b
jne 0x1e0d6
cmpl $0x110000, %r11d        # imm = 0x110000
movl $0xfffd, %r9d           # imm = 0xFFFD
cmovael %r9d, %r11d
movl %r11d, %r14d
jmp 0x1e0d6
movq -0x8(%rsp), %r8
testq %rdx, %rdx
je 0x1e0f8
cmpq %rcx, %rax
jae 0x1e153
cmpl $0xffff, %r14d          # imm = 0xFFFF
ja 0x1e10f
movq %rax, %rbx
movabsq $0x1, %r9
jmp 0x1e14c
cmpl $0x10000, %r14d         # imm = 0x10000
movabsq $0x2, %r9
sbbq $0x0, %r9
jmp 0x1e156
leaq 0x1(%rax), %rbx
cmpq %rcx, %rbx
jae 0x1e153
leal 0xf0000(%r14), %r9d
movl $0x3ff, %r11d           # imm = 0x3FF
andl %r11d, %r14d
orl $0xdc00, %r14d          # imm = 0xDC00
shrl $0xa, %r9d
andl %r11d, %r9d
orl $0xd800, %r9d           # imm = 0xD800
movw %r9w, (%rdx,%rax,2)
movabsq $0x2, %r9
movw %r14w, (%rdx,%rbx,2)
jmp 0x1e156
xorl %r9d, %r9d
addq %r9, %rax
incq %r8
movq %r8, %r13
jmp 0x1dfcf
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/gitluin[P]sara/src/sarasock.c
// Function: main
int
main(int argc, char* argv[]){
	int i, sfd, left = MAXBUFF;
	char msg[MAXBUFF];
	struct sockaddr saddress = {AF_UNIX, INPUTSOCK};

	if (argc < 2)
		die("please provide at least one argument!");

	for (i=1;i < argc && left > 0;i++){
		if (i != 1){
			strncat(msg, " ", 2);
			left--;
		}

		strncat(msg, argv[i], slen(argv[i]) > left ? left : slen(argv[i]) );
		left -= slen(argv[i]);
	}

	msg[MAXBUFF-1] = '\0';

	if ( (sfd = socket(AF_UNIX, SOCK_STREAM, 0)) < 0)
		die("failed to create socket!");
	if (connect(sfd, &saddress, sizeof(saddress)) < 0)
		die("failed to connect to socket!");
	if (send(sfd, msg, MAXBUFF, 0) < 0)
		die("failed to send to socket!");

	close(sfd);

	return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movq %rsi, %rbx
movl %edi, %ebp
movups 0xe3e(%rip), %xmm0      # 0x2004
movaps %xmm0, 0x20(%rsp)
cmpl $0x1, %edi
jg 0x11de
leaq 0xe3d(%rip), %rdi       # 0x2014
xorl %eax, %eax
callq 0x12c8
movslq %ebp, %r12
pushq $0x12
popq %rbp
pushq $0x1
popq %r13
movq %rsp, %r14
cmpq %r12, %r13
jge 0x1245
testl %ebp, %ebp
jle 0x1245
cmpq $0x1, %r13
je 0x120a
movq %r14, %rdi
callq 0x1060
movw $0x20, (%rsp,%rax)
decl %ebp
movq (%rbx,%r13,8), %r15
movq %r15, %rdi
callq 0x12ec
movl %eax, %ecx
movl %ebp, %eax
cmpl %ebp, %ecx
jg 0x1227
movq (%rbx,%r13,8), %rdi
callq 0x12ec
movslq %eax, %rdx
movq %r14, %rdi
movq %r15, %rsi
callq 0x1040
movq (%rbx,%r13,8), %rdi
callq 0x12ec
subl %eax, %ebp
incq %r13
jmp 0x11eb
movb $0x0, 0x11(%rsp)
pushq $0x1
popq %rdi
movl %edi, %esi
xorl %edx, %edx
callq 0x1080
movl %eax, %ebx
testl %eax, %eax
jns 0x126a
leaq 0xdd7(%rip), %rdi       # 0x203a
xorl %eax, %eax
callq 0x12c8
leaq 0x20(%rsp), %rsi
pushq $0x10
popq %rdx
movl %ebx, %edi
callq 0x1070
testl %eax, %eax
jns 0x128b
leaq 0xdcf(%rip), %rdi       # 0x2053
xorl %eax, %eax
callq 0x12c8
movq %rsp, %rsi
pushq $0x12
popq %rdx
movl %ebx, %edi
xorl %ecx, %ecx
callq 0x1090
testq %rax, %rax
jns 0x12ad
leaq 0xdca(%rip), %rdi       # 0x2070
xorl %eax, %eax
callq 0x12c8
movl %ebx, %edi
callq 0x1030
xorl %eax, %eax
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O2/MAGI003769[P]EE450-Socket-Project/serverA.c
// Function: split_args2
void split_args2(char *args[], char *message) {
    char *p = strtok (message, " ");
    int i = 0;
    while (p != NULL)
    {
        args[i++] = p;
        p = strtok (NULL, " ");
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
movq %rdi, %rbx
leaq 0xd50(%rip), %r14       # 0x2004
movq %rsi, %rdi
movq %r14, %rsi
callq 0x1100
testq %rax, %rax
je 0x12cf
movq %rax, (%rbx)
addq $0x8, %rbx
xorl %esi, %esi
jmp 0x12b4
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/MAGI003769[P]EE450-Socket-Project/serverA.c
// Function: search_map
void search_map(char *map_id, char *map_data) {
    // open corresponding txt file
    FILE *file = fopen(MAPDIR, "r");
    if(file == NULL) {
        printf("File %s not found", MAPDIR);
        return;
    }

    char* line = NULL;
    size_t len = 0;
    ssize_t read;

    read = getline(&line, &len, file);
    strcpy(map_data, line);
    //strcat(data, "\n");
    
    if(map_id[0] != line[0]) {
        while ((read = getline(&line, &len, file)) != -1) {
            //printf("Retrieved line of length %zu:\n", read);
            if(map_id[0] == line[0]) {
                break;
            }
        }
    }

    if(map_id[0] != line[0]) {
        strcpy(map_data, MAPNOTFOUND);
        return;
    } else {
        strcpy(map_data, line);
        while ((read = getline(&line, &len, file)) != -1) {
            if(isalpha(line[0]) != 0) {
                break;
            }
            strcat(map_data, line);
        }
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rsi, %r13
movq %rdi, %r15
leaq 0xd14(%rip), %rdi       # 0x2006
leaq 0xd1d(%rip), %rsi       # 0x2016
callq 0x10e0
testq %rax, %rax
je 0x13bb
movq %rax, %r14
leaq -0x30(%rbp), %rbx
andq $0x0, (%rbx)
leaq -0x38(%rbp), %rsi
andq $0x0, (%rsi)
movq %rbx, %rdi
movq %rax, %rdx
callq 0x1110
movq (%rbx), %r12
movq %r13, %rdi
movq %r12, %rsi
callq 0x1030
movb (%r15), %al
cmpb (%r12), %al
je 0x1373
movq %r13, -0x40(%rbp)
leaq -0x30(%rbp), %r13
leaq -0x38(%rbp), %rbx
movq %r13, %rdi
movq %rbx, %rsi
movq %r14, %rdx
callq 0x1110
movb (%r15), %cl
movq -0x30(%rbp), %r12
movb (%r12), %dl
cmpq $-0x1, %rax
je 0x136b
cmpb %dl, %cl
jne 0x1348
cmpb %dl, %cl
movq -0x40(%rbp), %r13
jne 0x13de
movq %r13, %rdi
movq %r12, %rsi
callq 0x1030
leaq -0x30(%rbp), %r15
leaq -0x38(%rbp), %r12
movq %r15, %rdi
movq %r12, %rsi
movq %r14, %rdx
callq 0x1110
cmpq $-0x1, %rax
je 0x13fa
callq 0x1160
movq (%rax), %rax
movq -0x30(%rbp), %rsi
movsbq (%rsi), %rcx
testb $0x4, 0x1(%rax,%rcx,2)
jne 0x13fa
movq %r13, %rdi
callq 0x1120
jmp 0x1386
leaq 0xc56(%rip), %rdi       # 0x2018
leaq 0xc3d(%rip), %rsi       # 0x2006
xorl %eax, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x1060
movabsq $0x646e756f662074, %rax # imm = 0x646E756F662074
movq %rax, 0x6(%r13)
movabsq $0x20746f6e2070614d, %rax # imm = 0x20746F6E2070614D
movq %rax, (%r13)
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/openshmem-org[P]openshmem-examples/c/amo-set.c
// Function: main
int
main()
{
    int me;

    shmem_init();
    me = shmem_my_pe();

    dst = 123;
    shmem_barrier_all();

    if (me == 0) {
        shmem_int_atomic_set(&dst, 999, 1);
    }
    else if (me != 1) {
        dst++;
    }

    shmem_barrier_all();

    printf("%d: dst = %d\n", me, dst);

    shmem_finalize();

    return 0;
}

// Assembly:
pushq %rbx
callq 0x1070
callq 0x1050
movl %eax, %ebx
movl $0x7b, 0x2eb9(%rip)     # 0x405c
callq 0x1060
cmpl $0x1, %ebx
je 0x11cd
testl %ebx, %ebx
jne 0x11c7
leaq 0x2ea4(%rip), %rdi      # 0x405c
pushq $0x1
popq %rdx
movl $0x3e7, %esi            # imm = 0x3E7
callq 0x1080
jmp 0x11cd
incl 0x2e8f(%rip)            # 0x405c
callq 0x1060
movl 0x2e84(%rip), %edx      # 0x405c
leaq 0xe25(%rip), %rdi       # 0x2004
movl %ebx, %esi
xorl %eax, %eax
callq 0x1030
callq 0x1040
xorl %eax, %eax
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O2/tstword[P]MIPSAssemblerC/src/assembler.c
// Function: incr_segment_offset
void incr_segment_offset(offset_t offset) {
    offset_t next_offset = cfg_assembler->segment_offset[cfg_assembler->segment] + offset;
    
    if(next_offset > SEGMENT_OFFSET_LIMIT[cfg_assembler->segment]) {
        fprintf(stderr, "Memory Error: Segment '%s' exceeded limit. Base: 0x%08X, Offset: 0x%08X, Limit: 0x%08X\n", 
                segment_string[cfg_assembler->segment], SEGMENT_OFFSET_BASE[cfg_assembler->segment], 
                next_offset, SEGMENT_OFFSET_LIMIT[cfg_assembler->segment]);
        
        cfg_assembler->status = ASSEMBLER_STATUS_FAIL;
    }
    
    cfg_assembler->segment_offset[cfg_assembler->segment] += offset;
}

// Assembly:
pushq %rbx
movq 0x919f(%rip), %rcx      # 0xc5b8
movzbl 0x45(%rcx), %eax
movl %eax, %edx
shll $0x2, %edx
movl 0x48(%rcx,%rdx), %r8d
addl %edi, %r8d
leaq 0x3e5f(%rip), %rsi      # 0x7290
movl (%rdx,%rsi), %r9d
cmpl %r9d, %r8d
ja 0x3441
movl %r8d, 0x48(%rcx,%rax,4)
popq %rbx
retq
movl %edi, %ebx
movq 0x7bae(%rip), %rcx      # 0xaff8
movq (%rcx), %rdi
leaq 0x7f1c(%rip), %rcx      # 0xb370
movq (%rcx,%rax,8), %rdx
leaq 0x3e21(%rip), %rcx      # 0x7280
movl (%rcx,%rax,4), %ecx
leaq 0x3e88(%rip), %rsi      # 0x72f1
xorl %eax, %eax
callq 0x30d0
movq 0x9141(%rip), %rcx      # 0xc5b8
movb $0x2, 0x44(%rcx)
movzbl 0x45(%rcx), %eax
addl 0x48(%rcx,%rax,4), %ebx
movl %ebx, %r8d
jmp 0x343a
// File: /workspace/github_c_makefile_star2_O2/tstword[P]MIPSAssemblerC/src/assembler.c
// Function: align_segment_offset
void align_segment_offset(uint32_t n) {
    /* Check bounds for sll */
    if(n >= 31) return;

    uint32_t dividend = 1 << n;
    uint32_t remainder = cfg_assembler->segment_offset[cfg_assembler->segment] & (dividend - 1);

    if(remainder != 0) {
        cfg_assembler->segment_offset[cfg_assembler->segment] += dividend - remainder;
    }
}

// Assembly:
cmpl $0x1e, %edi
ja 0x34b2
pushq $0x1
popq %rax
movl %edi, %ecx
shll %cl, %eax
movq 0x911d(%rip), %rcx      # 0xc5b8
movzbl 0x45(%rcx), %edx
movl 0x48(%rcx,%rdx,4), %esi
leal -0x1(%rax), %edi
andl %esi, %edi
je 0x34b2
addl %eax, %esi
subl %edi, %esi
movl %esi, 0x48(%rcx,%rdx,4)
retq
// File: /workspace/github_c_makefile_star2_O2/tstword[P]MIPSAssemblerC/src/assembler.c
// Function: alloc_segment_memory
void alloc_segment_memory(size_t size) {
    segment_t segment = cfg_assembler->segment;
    offset_t next_offset = cfg_assembler->segment_offset[segment] - SEGMENT_OFFSET_BASE[segment] + size;

    if(next_offset > cfg_assembler->segment_memory_size[segment]) {
        /* Align to the nearest 1024 */
        uint32_t remainder = (uint32_t)size & 0x03FF;
        if(remainder != 0) size += 0x0400 - remainder;

        /* Reallocate memory */
        size_t mem_size = cfg_assembler->segment_memory_size[segment];
        void *realloc_ptr = (void *)realloc(cfg_assembler->segment_memory[segment], 
                                    cfg_assembler->segment_memory_size[segment] + size);

        if(realloc_ptr == NULL) {
            perror("CRITICAL ERROR: Failed to reallocate memory for segment: ");
            cfg_assembler->status = ASSEMBLER_STATUS_FAIL;
            return;
        }

        cfg_assembler->segment_memory_size[segment] += size;
        cfg_assembler->segment_memory[segment] = realloc_ptr;

        memset((char *)cfg_assembler->segment_memory[segment] + mem_size, 0, size);
    }

    if(next_offset > cfg_assembler->segment_memory_offset[segment]) {
        cfg_assembler->segment_memory_offset[segment] = next_offset;
    }
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq 0x90f6(%rip), %rax      # 0xc5b8
movzbl 0x45(%rax), %r15d
movl %r15d, %ecx
shll $0x2, %ecx
leaq 0x3dac(%rip), %rdx      # 0x7280
movl 0x48(%rax,%rcx), %r12d
addl %edi, %r12d
subl (%rcx,%rdx), %r12d
movq 0x78(%rax,%r15,8), %rbx
cmpq %r12, %rbx
jae 0x3550
movl %edi, %ecx
andl $0x3ff, %ecx            # imm = 0x3FF
movl $0x400, %r14d           # imm = 0x400
subl %ecx, %r14d
testl %ecx, %ecx
cmovel %ecx, %r14d
addq %rdi, %r14
movq 0x20(%rax,%r15,8), %rdi
leaq (%rbx,%r14), %rsi
callq 0x3110
testq %rax, %rax
je 0x3568
movq 0x909a(%rip), %rcx      # 0xc5b8
leal (,%r15,8), %edx
addq %r14, 0x78(%rcx,%rdx)
movq %rax, 0x20(%rcx,%rdx)
movq 0x9081(%rip), %rax      # 0xc5b8
addq 0x20(%rax,%rdx), %rbx
movq %rbx, %rdi
xorl %esi, %esi
movq %r14, %rdx
callq 0x3080
movq 0x9068(%rip), %rax      # 0xc5b8
cmpq %r12, 0x58(%rax,%r15,8)
jae 0x355c
movq %r12, 0x58(%rax,%r15,8)
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
leaq 0x3dda(%rip), %rdi      # 0x7349
callq 0x3130
movq 0x903d(%rip), %rax      # 0xc5b8
movb $0x2, 0x44(%rax)
jmp 0x355c
// File: /workspace/github_c_makefile_star2_O2/tstword[P]MIPSAssemblerC/src/assembler.c
// Function: write_segment_memory
void write_segment_memory(void *buf, size_t size) {
    segment_t segment = cfg_assembler->segment;
    offset_t buf_offset = cfg_assembler->segment_offset[segment] - SEGMENT_OFFSET_BASE[segment];
    
    alloc_segment_memory(size);
    memcpy((char *)cfg_assembler->segment_memory[segment] + buf_offset, buf, size);
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, %r14
movq 0x9022(%rip), %rax      # 0xc5b8
movzbl 0x45(%rax), %r12d
leal (,%r12,4), %ecx
movl 0x48(%rax,%rcx), %r15d
leaq 0x3cd1(%rip), %rax      # 0x7280
subl (%rcx,%rax), %r15d
movq %rsi, %rdi
callq 0x34b3
movq 0x8ff6(%rip), %rax      # 0xc5b8
addq 0x20(%rax,%r12,8), %r15
movq %r15, %rdi
movq %r14, %rsi
movq %rbx, %rdx
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
jmp 0x30e0
// File: /workspace/github_c_makefile_star2_O2/tstword[P]MIPSAssemblerC/src/assembler.c
// Function: write_escaped_string
void write_escaped_string(char *string) {
    char ch;
    while((ch = *string++) != '\0') {
        if(ch == '\\') {
            switch(*string++) {
                case 'a':
                    ch = '\a';
                    break;
                case 'b':
                    ch = '\b';
                    break;
                case 'f':
                    ch = '\f';
                    break;
                case 'n':
                    ch = '\n';
                    break;
                case 'r':
                    ch = '\r';
                    break;
                case 't':
                    ch = '\t';
                    break;
                case 'v':
                    ch = '\v';
                    break;
                case '\\':
                    ch = '\\';
                    break;
                case '\'':
                    ch = '\'';
                    break;
                case '"':
                    ch = '\"';
                    break;
                case '?':
                    ch = '\?';
                    break;
                case '0':
                    ch = '\0';
                    break;  
            }
        }
        write_segment_memory((void *)&ch, 0x1);
        incr_segment_offset(0x1);
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x10, %rsp
movq %rdi, %rbx
leaq 0x39fe(%rip), %r12      # 0x7010
leaq 0xf(%rsp), %r14
pushq $0x1
popq %r15
pushq $0x1
popq %rbp
movzbl (%rbx), %eax
movb %al, 0xf(%rsp)
cmpl $0x5c, %eax
je 0x3649
testl %eax, %eax
je 0x36f7
incq %rbx
movq %r14, %rdi
movq %r15, %rsi
callq 0x3581
movl %ebp, %edi
callq 0x3411
jmp 0x361e
movzbl 0x1(%rbx), %eax
addq $0x2, %rbx
leal -0x6e(%rax), %ecx
cmpl $0x8, %ecx
jbe 0x368c
cmpl $0x22, %eax
je 0x36b1
cmpl $0x27, %eax
je 0x36ed
cmpl $0x30, %eax
je 0x36c5
cmpl $0x3f, %eax
je 0x36e3
cmpl $0x5c, %eax
je 0x36bb
cmpl $0x66, %eax
je 0x36cf
cmpl $0x62, %eax
je 0x36d9
cmpl $0x61, %eax
jne 0x3635
movb $0x7, 0xf(%rsp)
jmp 0x3635
movslq (%r12,%rcx,4), %rax
addq %r12, %rax
jmpq *%rax
movb $0xa, 0xf(%rsp)
jmp 0x3635
movb $0xd, 0xf(%rsp)
jmp 0x3635
movb $0xb, 0xf(%rsp)
jmp 0x3635
movb $0x9, 0xf(%rsp)
jmp 0x3635
movb $0x22, 0xf(%rsp)
jmp 0x3635
movb $0x5c, 0xf(%rsp)
jmp 0x3635
movb $0x0, 0xf(%rsp)
jmp 0x3635
movb $0xc, 0xf(%rsp)
jmp 0x3635
movb $0x8, 0xf(%rsp)
jmp 0x3635
movb $0x3f, 0xf(%rsp)
jmp 0x3635
movb $0x27, 0xf(%rsp)
jmp 0x3635
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/tstword[P]MIPSAssemblerC/src/assembler.c
// Function: match_cfg
int match_cfg(token_t token) {
    if(cfg_assembler->lookahead == token) {
        cfg_assembler->lineno = cfg_assembler->tokenizer->lineno;
        cfg_assembler->colno = cfg_assembler->tokenizer->colno;
        cfg_assembler->lookahead = get_next_token(cfg_assembler->tokenizer);
    } 
    else {
        report_cfg("Expected %s on line %ld, col %ld", get_token_str(token), cfg_assembler->lineno, cfg_assembler->colno);
        return 0;
    }
    return 1;
}

// Assembly:
pushq %rbx
movq 0x8e93(%rip), %rax      # 0xc5b8
cmpl %edi, 0x40(%rax)
jne 0x374c
movq (%rax), %rdi
movups 0x38(%rdi), %xmm0
movups %xmm0, 0x98(%rax)
callq 0x654d
movq 0x8e74(%rip), %rcx      # 0xc5b8
movl %eax, 0x40(%rcx)
pushq $0x1
popq %rbx
jmp 0x3779
callq 0x6666
movq 0x8e60(%rip), %rcx      # 0xc5b8
movq 0x98(%rcx), %rdx
movq 0xa0(%rcx), %rcx
leaq 0x3c16(%rip), %rdi      # 0x7383
xorl %ebx, %ebx
movq %rax, %rsi
xorl %eax, %eax
callq 0x328c
movl %ebx, %eax
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O2/tstword[P]MIPSAssemblerC/src/assembler.c
// Function: end_line_cfg
void end_line_cfg() {
    switch(cfg_assembler->lookahead) {
        case TOK_EOL:
            match_cfg(TOK_EOL);
            break;
        case TOK_NULL:
            cfg_assembler->lineno++;
            break;
        default:
            report_cfg("Unexpected %s on line %ld, col %ld", get_token_str(cfg_assembler->lookahead), cfg_assembler->lineno, cfg_assembler->colno);
    }
}

// Assembly:
movq 0x8e34(%rip), %rax      # 0xc5b8
movl 0x40(%rax), %edi
testl %edi, %edi
je 0x3798
cmpl $0x7, %edi
jne 0x37a0
pushq $0x7
popq %rdi
jmp 0x371d
incq 0x98(%rax)
retq
pushq %rax
callq 0x6666
movq 0x8e0b(%rip), %rcx      # 0xc5b8
movq 0x98(%rcx), %rdx
movq 0xa0(%rcx), %rcx
leaq 0x3be2(%rip), %rdi      # 0x73a4
movq %rax, %rsi
xorl %eax, %eax
popq %r8
jmp 0x328c