LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_c_makefile_star2_O3/canboat[P]canboat/analyzer/print.c
// Function: fieldPrintDate
extern bool fieldPrintDate(const Field   *field,
                           const char    *fieldName,
                           const uint8_t *data,
                           size_t         dataLen,
                           size_t         startBit,
                           size_t        *bits)
{
  char       buf[sizeof("2008.03.10") + 1];
  time_t     t;
  struct tm *tm;
  uint16_t   d;

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

  if (startBit != 0)
  {
    return unhandledStartOffset(fieldName, startBit);
  }
  if (*bits != 16)
  {
    return unhandledBitLength(fieldName, *bits);
  }
  if (dataLen < *bits / 8)
  {
    return true;
  }

  d = data[0] + (data[1] << 8);

  if (d >= 0xfffd)
  {
    printEmpty(fieldName, d - INT64_C(0xffff));
    return true;
  }

  t  = d * 86400;
  tm = gmtime(&t);
  if (!tm)
  {
    logAbort("Unable to convert %u to gmtime\n", (unsigned int) t);
  }
  strftime(buf, sizeof(buf), "%Y.%m.%d", tm);
  if (showJson)
  {
    if (showJsonValue)
    {
      mprintf("%" PRIu16 ",\"name\":\"%s\"}", d, buf);
    }
    else
    {
      mprintf("\"%s\"", buf);
    }
  }
  else
  {
    mprintf("%s", buf);
  }
  return true;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
subq $0x20, %rsp
movq %r8, %rdi
shrq $0x3, %rdi
subq %rdi, %rcx
jbe 0x1b860
andq $0x7, %r8
je 0x1b864
leaq 0x1250b(%rip), %rdi     # 0x2dd64
xorl %ebx, %ebx
movq %r8, %rdx
jmp 0x1b89c
xorl %ebx, %ebx
jmp 0x1b8a3
movq (%r9), %rax
cmpq $0x10, %rax
jne 0x1b890
movb $0x1, %bl
cmpq $0x2, %rcx
jb 0x1b8a3
movzwl (%rdx,%rdi), %ebp
cmpw $-0x3, %bp
jb 0x1b8ae
movzwl %bp, %esi
addq $-0xffff, %rsi          # imm = 0xFFFF0001
callq 0x1a52f
jmp 0x1b8a3
leaq 0x124f0(%rip), %rdi     # 0x2dd87
xorl %ebx, %ebx
movq %rax, %rdx
xorl %eax, %eax
callq 0x1cde8
movl %ebx, %eax
addq $0x20, %rsp
popq %rbx
popq %r14
popq %rbp
retq
imull $0x15180, %ebp, %eax    # imm = 0x15180
leaq 0x18(%rsp), %rdi
movq %rax, (%rdi)
callq 0xd280
movq %rax, %r14
testq %rax, %rax
jne 0x1b8db
movl 0x18(%rsp), %esi
leaq 0x1224b(%rip), %rdi     # 0x2db1f
xorl %eax, %eax
callq 0x1ce7b
leaq 0x1225d(%rip), %rdx     # 0x2db3f
leaq 0xc(%rsp), %rdi
movl $0xc, %esi
movq %r14, %rcx
callq 0xd260
leaq 0x72df7(%rip), %rax     # 0x8e6f2
cmpb $0x1, (%rax)
jne 0x1b923
leaq 0x72ded(%rip), %rax     # 0x8e6f4
cmpb $0x1, (%rax)
jne 0x1b92c
leaq 0x12235(%rip), %rdi     # 0x2db48
leaq 0xc(%rsp), %rdx
movl %ebp, %esi
xorl %eax, %eax
callq 0x1a07c
jmp 0x1b8a3
leaq 0x17294(%rip), %rdi     # 0x32bbe
jmp 0x1b933
leaq 0x1208a(%rip), %rdi     # 0x2d9bd
leaq 0xc(%rsp), %rsi
xorl %eax, %eax
callq 0x1a07c
jmp 0x1b8a3
// File: /workspace/github_c_makefile_star2_O3/canboat[P]canboat/analyzer/print.c
// Function: fieldPrintStringFix
extern bool fieldPrintStringFix(const Field   *field,
                                const char    *fieldName,
                                const uint8_t *data,
                                size_t         dataLen,
                                size_t         startBit,
                                size_t        *bits)
{
  size_t len = field->size / 8;

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

  logDebug("fieldPrintStringFix('%s',%zu) size=%zu\n", fieldName, dataLen, len);

  len   = CB_MIN(len, dataLen); // Cap length to remaining bytes in message
  *bits = BYTES(len);
  return printString(fieldName, data, len);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %r8, %rbx
movq %rcx, %r14
shrq $0x3, %rbx
movq %rcx, %rbp
subq %rbx, %rbp
jbe 0x1b9ae
movq %rdx, %r12
movq %rsi, %r13
movl 0x10(%rdi), %r15d
addq %rbx, %r12
shrl $0x3, %r15d
leaq 0x121df(%rip), %rdi     # 0x2db58
movq %rbp, %rdx
movq %r15, %rcx
xorl %eax, %eax
movq %r9, (%rsp)
callq 0x1cd55
cmpq %r15, %rbp
cmovbq %rbp, %r15
leal (,%r15,8), %eax
movq (%rsp), %rcx
movq %rax, (%rcx)
movq %r13, %rdi
movq %r12, %rsi
movq %r15, %rdx
callq 0x1b9c3
cmpq %rbx, %r14
seta %al
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/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 %r12
pushq %rbx
pushq %rax
testq %rdx, %rdx
je 0x1ba58
movq %rdx, %r14
movq %rsi, %rbx
leaq (%rsi,%rdx), %r12
decq %r12
cmpq %rsi, %r12
jbe 0x1ba01
leaq -0x1(%r14), %rax
xorl %r15d, %r15d
cmpb $0x0, (%rbx,%r15)
je 0x1ba06
incq %r15
cmpq %r15, %rax
jne 0x1b9ed
movq %r14, %r15
jmp 0x1ba24
movq %rbx, %r12
jmp 0x1ba29
leaq 0x1239a(%rip), %rdi     # 0x2dda7
movq %r14, %rsi
movq %r15, %rdx
xorl %eax, %eax
callq 0x1cd55
leaq (%rbx,%r15), %r12
decq %r12
movq %r15, %r14
testq %r15, %r15
je 0x1ba58
movzbl (%r12), %r15d
cmpq $0xff, %r15
je 0x1ba50
callq 0xd350
movq (%rax), %rax
movzwl (%rax,%r15,2), %eax
btl $0xd, %eax
jb 0x1ba50
testb $-0x41, %r15b
jne 0x1ba6a
decq %r12
decq %r14
jne 0x1ba29
xorl %esi, %esi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
jmp 0x1a52f
leaq 0x72c81(%rip), %rax     # 0x8e6f2
cmpb $0x1, (%rax)
jne 0x1baa7
leaq 0x12374(%rip), %r15     # 0x2ddf1
movq %r15, %rdi
xorl %eax, %eax
callq 0x1a07c
movq %rbx, %rdi
movl %r14d, %esi
callq 0x1bdca
movq %r15, %rdi
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
jmp 0x1a07c
movq %rbx, %rdi
movl %r14d, %esi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
jmp 0x1bdca
// File: /workspace/github_c_makefile_star2_O3/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 0x1bb03
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 0x1b9c3
cmpq %r14, %rbx
setb %al
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O3/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 0x74bac(%rip), %rdx     # 0x90858
testq %rdx, %rdx
je 0x1bcb7
shlq $0x3, %rdx
jmp 0x1bcbb
movl 0x10(%r13), %edx
movq %rdx, (%r14)
leaq 0x11faa(%rip), %rdi     # 0x2dc6f
xorl %ebp, %ebp
movq %rbx, %rsi
xorl %eax, %eax
callq 0x1cd55
movq (%r14), %rax
addq %r15, %rax
shrq $0x3, %rax
cmpq %r12, %rax
jbe 0x1bd07
movq 0x90(%r13), %rax
testq %rax, %rax
je 0x1bcef
movl 0x8(%rax), %ebp
leaq 0x11fd7(%rip), %rdi     # 0x2dccd
xorl %r14d, %r14d
movl %ebp, %esi
movq %rbx, %rdx
xorl %eax, %eax
callq 0x1cde8
jmp 0x1bd83
movq 0x74b42(%rip), %rbp     # 0x90850
testq %rbp, %rbp
je 0x1bd40
movq 0x88(%rbp), %rax
movq (%rax), %rdx
movl 0x10(%rbp), %ecx
leaq 0x11f6b(%rip), %rdi     # 0x2dc92
movq %rbx, %rsi
xorl %eax, %eax
callq 0x1cd55
cmpq $0x0, (%r14)
je 0x1bd57
movq 0x88(%rbp), %r13
jmp 0x1bd69
movq %r13, %rdi
movq (%rsp), %rdx
movq %r12, %rcx
movq %r15, %r8
movq %r14, %r9
callq 0x1b00b
jmp 0x1bd80
movl 0x10(%rbp), %eax
movq %rax, (%r14)
movq 0x88(%rbp), %r13
testq %rax, %rax
je 0x1bda5
movq %rbp, %rdi
movq %rbx, %rsi
movq (%rsp), %rdx
movq %r12, %rcx
movq %r15, %r8
movq %r14, %r9
callq *0x78(%r13)
movl %eax, %r14d
xorl %eax, %eax
movq %rax, 0x74ac4(%rip)     # 0x90850
movq %rax, 0x74ac5(%rip)     # 0x90858
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 0x1bd69
leaq 0xf5f5(%rip), %rsi      # 0x2b3aa
callq 0xd1a0
testl %eax, %eax
jne 0x1bd69
movq 0x80(%rbp), %rax
movq %rax, (%r14)
jmp 0x1bd69
// File: /workspace/github_c_makefile_star2_O3/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:
testl %esi, %esi
jle 0x1beb5
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
movl %esi, %r15d
leaq 0x11862(%rip), %r12     # 0x2d64c
leaq 0x16dcd(%rip), %r14     # 0x32bbe
leaq 0x11ffb(%rip), %rbp     # 0x2ddf3
xorl %r13d, %r13d
movzbl (%rbx,%r13), %esi
cmpl $0x21, %esi
jg 0x1be25
cmpl $0xd, %esi
ja 0x1be97
movl %esi, %eax
movslq (%r12,%rax,4), %rax
addq %r12, %rax
jmpq *%rax
movq %r14, %rdi
leaq 0x11fbe(%rip), %rsi     # 0x2dde1
jmp 0x1be82
cmpl $0x22, %esi
je 0x1be6c
cmpl $0x2f, %esi
je 0x1be78
cmpl $0x5c, %esi
jne 0x1be97
movq %r14, %rdi
movq %rbp, %rsi
jmp 0x1be82
movq %r14, %rdi
leaq 0x11fa7(%rip), %rsi     # 0x2dded
jmp 0x1be82
movq %r14, %rdi
leaq 0x11f98(%rip), %rsi     # 0x2ddea
jmp 0x1be82
movq %r14, %rdi
leaq 0x11f86(%rip), %rsi     # 0x2dde4
jmp 0x1be82
movq %r14, %rdi
leaq 0x11f7d(%rip), %rsi     # 0x2dde7
jmp 0x1be82
movq %r14, %rdi
leaq 0x11f7a(%rip), %rsi     # 0x2ddf0
jmp 0x1be82
movq %r14, %rdi
leaq 0x11f74(%rip), %rsi     # 0x2ddf6
xorl %eax, %eax
callq 0x1a07c
incq %r13
cmpq %r13, %r15
jne 0x1bdfb
jmp 0x1bea7
leaq 0x11bad(%rip), %rdi     # 0x2da4b
xorl %eax, %eax
callq 0x1a07c
jmp 0x1be89
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_c_makefile_star2_O3/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, %r14
xorl %r15d, %r15d
leaq 0x6c746(%rip), %rbx     # 0x88610
movq (%r15,%rbx), %rsi
movq %r14, %rdi
callq 0xd1a0
testl %eax, %eax
je 0x1beff
addq $0x90, %r15
cmpq $0x60c0, %r15           # imm = 0x60C0
jne 0x1beca
leaq 0x15541(%rip), %rdi     # 0x31432
xorl %ebx, %ebx
movq %r14, %rsi
xorl %eax, %eax
callq 0x1cde8
jmp 0x1bf02
addq %r15, %rbx
movq %rbx, %rax
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O3/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 0x1c93b
movq $-0x1, %r8
movl %edx, %ecx
shlq %cl, %r8
notq %r8
cvtsi2sd %r8, %xmm1
xorpd 0x11517(%rip), %xmm1    # 0x2de50
jmp 0x1c943
movslq %r9d, %r8
cvtsi2sd %r9d, %xmm1
subq $0x18, %rsp
mulsd %xmm0, %xmm1
movzbl %al, %ecx
leaq 0x15dec(%rip), %rdi     # 0x32741
movapd %xmm1, (%rsp)
movb $0x2, %al
callq 0x1cd55
movaps (%rsp), %xmm0
addq $0x18, %rsp
retq
// File: /workspace/github_c_makefile_star2_O3/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
movq $-0x3, %rdx
cmpl $0x7, %esi
ja 0x1c99f
movq $-0x2, %rdx
cmpl $0x3, %ebp
ja 0x1c99f
xorl %edx, %edx
cmpl $0x2, %ebp
adcq $-0x1, %rdx
testl %ebx, %ebx
sete %al
andb %r15b, %al
movzbl %al, %eax
subl %eax, %ebp
movq $-0x1, %rsi
movl %ebp, %ecx
shlq %cl, %rsi
notq %rsi
movslq %ebx, %rax
addq %rdx, %rax
addq %rsi, %rax
testq %r8, %r8
je 0x1c9f3
cmpl $0x1, 0x8(%r8)
jne 0x1c9f3
movq %rax, 0x73e89(%rip)     # 0x90860
leaq 0x13e(%rip), %rdi       # 0x1cb1c
movsd %xmm0, (%rsp)
callq *0x10(%r8)
movsd (%rsp), %xmm0
movq 0x73e6d(%rip), %rax     # 0x90860
movq %rax, %xmm1
punpckldq 0x10cc0(%rip), %xmm1 # xmm1 = xmm1[0],mem[0],xmm1[1],mem[1]
subpd 0x10cc8(%rip), %xmm1    # 0x2d6d0
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 0x15d59(%rip), %rdi     # 0x32785
movq %r14, %rsi
movl %ebp, %edx
movq %rax, %r8
movl %ebx, %r9d
movb $0x2, %al
callq 0x1cd55
movaps (%rsp), %xmm0
addq $0x18, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/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 0x1beb8
movq %rax, 0x88(%r13)
testq %rax, %rax
jne 0x1ca9b
leaq 0x14f16(%rip), %rdi     # 0x3199a
movq %r12, %rsi
movq %r15, %rdx
movq %rbx, %rcx
xorl %eax, %eax
callq 0x1ce7b
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 0x1cac6
movl 0x28(%rax), %ecx
movl %ecx, 0x10(%r13)
movq %r14, (%r13)
testq %rdx, %rdx
je 0x1cae1
movq %r13, %rdi
callq 0x1bf0b
movq 0x18(%r13), %rax
movl 0x10(%r13), %ecx
jmp 0x1cae3
xorl %eax, %eax
testq %rax, %rax
leaq 0x7618(%rip), %r9       # 0x24105
cmovneq %rax, %r9
movl %ecx, (%rsp)
leaq 0x14eda(%rip), %rdi     # 0x319d5
movq %r12, %rsi
movq %r15, %rdx
movq %r14, %rcx
movq %rbx, %r8
xorl %eax, %eax
callq 0x1cd55
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O3/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
movl $0x1, %r15d
movl $0x2c, %esi
movl $0x1, %edx
callq 0x1dff3
testq %rax, %rax
je 0x1dfe1
movq %rax, %r12
movl %ebp, 0x8(%rsp)
decq %r12
movq %r12, %r15
subq %r14, %r15
movq %rbx, %rdi
movq %r14, %rsi
movq %r15, %rdx
callq 0xd1e0
movb $0x0, (%rbx,%r15)
leaq 0x30(%rsp), %r11
leaq 0x34(%rsp), %r15
leaq 0x38(%rsp), %r13
leaq 0x3c(%rsp), %r10
leaq 0x44(%rsp), %rbp
leaq 0x14b3d(%rip), %rsi     # 0x32a3c
leaq 0x1c(%rsp), %rdx
leaq 0x18(%rsp), %rcx
leaq 0x10(%rsp), %r8
leaq 0x14(%rsp), %r9
movq %r12, %rdi
movl $0x0, %eax
pushq %rbp
pushq %r10
pushq %r13
pushq %r15
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 0x1df89
leaq 0x14b0b(%rip), %rdi     # 0x32a67
movl %eax, %esi
movq %r14, %rdx
xorl %eax, %eax
callq 0x1cde8
movl $0x2, %r15d
cmpb $0x0, 0x8(%rsp)
jne 0x1dfe1
movq 0x1b04c(%rip), %rax     # 0x38fc8
movq (%rax), %rsi
movq %r14, %rdi
callq 0xd170
jmp 0x1dfe1
movl 0xc(%rsp), %ecx
cmpq $0x9, %rcx
setae %dl
cmpl $0xe, %eax
setae %al
movl $0xffffffff, %r15d      # imm = 0xFFFFFFFF
orb %dl, %al
jne 0x1dfe1
testq %rcx, %rcx
je 0x1dfbb
xorl %eax, %eax
movb 0x20(%rsp,%rax,4), %dl
movb %dl, 0x47(%rbx,%rax)
incq %rax
cmpq %rax, %rcx
jne 0x1dfab
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 %r15d, %r15d
movl %r15d, %eax
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/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:
movzbl (%rdi), %ecx
xorl %eax, %eax
testl %ecx, %ecx
je 0x1e036
cmpl $0xa, %ecx
je 0x1e036
pushq %rbp
pushq %rbx
pushq %rax
movl %edx, %ebx
testl %edx, %edx
jle 0x1e029
movzbl %sil, %ebp
movq %rdi, %rax
movq %rax, %rdi
movl %ebp, %esi
callq 0xd100
testq %rax, %rax
je 0x1e02e
incq %rax
decl %ebx
jne 0x1e011
jmp 0x1e030
movq %rdi, %rax
jmp 0x1e030
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/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
movl $0x1, %r15d
testl %eax, %eax
je 0x1e5a8
cmpl $0xa, %eax
je 0x1e5a8
movl %edx, %ebp
movq %rsi, %r14
movq %rdi, %rbx
leaq 0x146dd(%rip), %rsi     # 0x32b47
leaq 0x14(%rsp), %rdx
leaq 0x4(%rsp), %rcx
leaq 0x10(%rsp), %r8
xorl %eax, %eax
callq 0xd220
cmpl $0x2, %eax
jg 0x1e49b
leaq 0x146cc(%rip), %rdi     # 0x32b58
movq %rbx, %rsi
xorl %eax, %eax
callq 0x1cde8
jmp 0x1e58b
movl 0x4(%rsp), %eax
imulq $0x10624dd3, %rax, %rax # imm = 0x10624DD3
shrq $0x26, %rax
leaq 0x18(%rsp), %rdi
movq %rax, (%rdi)
leaq 0x20(%rsp), %r15
movq %r15, %rsi
callq 0xd0a0
leaq 0x14342(%rip), %rdx     # 0x32808
movl $0x3c, %esi
movq %r14, %rdi
movq %r15, %rcx
callq 0xd260
movq %r14, %rdi
callq 0xd0f0
leaq (%rax,%r14), %rdi
movl 0x4(%rsp), %edx
imulq $0x10624dd3, %rdx, %rax # imm = 0x10624DD3
shrq $0x26, %rax
imull $0x3e8, %eax, %eax      # imm = 0x3E8
subl %eax, %edx
leaq 0x14679(%rip), %rsi     # 0x32b79
xorl %r15d, %r15d
xorl %eax, %eax
callq 0xd2c0
leaq 0x1a(%rbx), %rax
movq %rax, 0x8(%rsp)
movb $0x1, %al
cmpb $0x2a, 0x1a(%rbx)
je 0x1e549
leaq 0x47(%r14), %r13
leaq 0x8(%rsp), %r12
movl %r15d, %esi
addq %r13, %rsi
movq %r12, %rdi
callq 0x1db3f
testl %eax, %eax
jne 0x1e56c
incl %r15d
movq 0x8(%rsp), %rax
cmpb $0x2a, (%rax)
jne 0x1e524
incb %r15b
movl %r15d, %eax
movl 0x14(%rsp), %ecx
movb 0x10(%rsp), %dl
movb $0x0, 0x3c(%r14)
movl %ecx, 0x40(%r14)
movb $-0x1, 0x44(%r14)
movb %dl, 0x45(%r14)
movb %al, 0x46(%r14)
xorl %r15d, %r15d
jmp 0x1e5a8
movq 0x8(%rsp), %rcx
movq %rcx, %rsi
subq %rbx, %rsi
leaq 0x1455a(%rip), %rdi     # 0x32ad8
movq %rbx, %rdx
movl %r15d, %r8d
xorl %eax, %eax
callq 0x1cde8
movl $0x2, %r15d
testb %bpl, %bpl
jne 0x1e5a8
movq 0x1aa2b(%rip), %rax     # 0x38fc8
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_O3/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 %r12
pushq %rbx
subq $0x60, %rsp
movq %rsi, %rbx
leaq 0x4b23(%rip), %rsi      # 0x23409
leaq 0x8(%rsp), %rdx
callq 0xd190
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
testq %rax, %rax
je 0x1ea24
movq %rax, %r14
callq 0x1cb34
shrq $0x3, %rax
movabsq $0x20c49ba5e353f7cf, %rcx # imm = 0x20C49BA5E353F7CF
mulq %rcx
shrq $0x4, %rdx
leaq 0x20(%rsp), %rdi
movq %rdx, (%rdi)
leaq 0x28(%rsp), %r15
movq %r15, %rsi
callq 0xd0a0
leaq 0x142cb(%rip), %rdx     # 0x32c02
movl $0x3c, %esi
movq %rbx, %rdi
movq %r15, %rcx
callq 0xd260
movq %rbx, %rdi
callq 0xd0f0
leaq (%rax,%rbx), %rdi
movq %r14, %rsi
callq 0xd0b0
leaq 0x4aa7(%rip), %rsi      # 0x23409
leaq 0x8(%rsp), %rdx
xorl %edi, %edi
callq 0xd190
testq %rax, %rax
je 0x1ea24
leaq 0x4a8b(%rip), %rsi      # 0x23409
leaq 0x8(%rsp), %rdx
xorl %edi, %edi
callq 0xd190
testq %rax, %rax
je 0x1ea24
xorl %r12d, %r12d
movq %rax, %rdi
xorl %esi, %esi
movl $0x10, %edx
callq 0xd2a0
leaq 0x1c(%rsp), %rsi
leaq 0x18(%rsp), %rdx
leaq 0x14(%rsp), %rcx
leaq 0x10(%rsp), %r8
movl %eax, %edi
callq 0x1d8ea
leaq 0x4a42(%rip), %r14      # 0x23409
leaq 0x8(%rsp), %r15
xorl %edi, %edi
movq %r14, %rsi
movq %r15, %rdx
callq 0xd190
testq %rax, %rax
je 0x1ea00
movq %rax, %rdi
xorl %esi, %esi
movl $0x10, %edx
callq 0xd2a0
movb %al, 0x47(%rbx,%r12)
incq %r12
cmpq $0xe0, %r12
jne 0x1e9cc
jmp 0x1ea24
movb 0x1c(%rsp), %al
movl 0x18(%rsp), %ecx
movb 0x10(%rsp), %dl
movb 0x14(%rsp), %sil
movb %al, 0x3c(%rbx)
movl %ecx, 0x40(%rbx)
movb %dl, 0x44(%rbx)
movb %sil, 0x45(%rbx)
movb %r12b, 0x46(%rbx)
xorl %ebp, %ebp
movl %ebp, %eax
addq $0x60, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/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:
testq %rsi, %rsi
je 0x1f175
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
leaq -0x1(%rsi), %r8
xorl %r11d, %r11d
leaq 0x13d1d(%rip), %r9      # 0x32d46
movl $0x2, %r10d
xorl %ebx, %ebx
movzwl (%rdi,%rbx,2), %r14d
movl %r14d, %eax
andl $0xf800, %eax           # imm = 0xF800
cmpl $0xd800, %eax           # imm = 0xD800
jne 0x1f09b
movl %r14d, %eax
andl $0xdc00, %eax           # imm = 0xDC00
cmpl $0xd800, %eax           # imm = 0xD800
setne %al
cmpq %r8, %rbx
sete %bpl
orb %al, %bpl
jne 0x1f095
movzwl 0x2(%rdi,%rbx,2), %eax
movl %eax, %ebp
andl $0xfc00, %ebp           # imm = 0xFC00
cmpl $0xdc00, %ebp           # imm = 0xDC00
jne 0x1f095
incq %rbx
shll $0xa, %r14d
andl $0xffc00, %r14d         # imm = 0xFFC00
andl $0x3ff, %eax            # imm = 0x3FF
addl %eax, %r14d
addl $0x10000, %r14d         # imm = 0x10000
jmp 0x1f09b
movl $0xfffd, %r14d          # imm = 0xFFFD
testq %rdx, %rdx
je 0x1f0c3
cmpl $0x80, %r14d
jae 0x1f0f5
leaq 0x1(%r11), %rax
cmpq %rcx, %rax
ja 0x1f118
leaq (%rdx,%r11), %r15
movl $0x1, %eax
xorl %r12d, %r12d
jmp 0x1f146
movl $0x1, %eax
cmpl $0x80, %r14d
jb 0x1f158
movl $0x2, %eax
cmpl $0x800, %r14d           # imm = 0x800
jb 0x1f158
cmpl $0x10000, %r14d         # imm = 0x10000
movl $0x4, %eax
sbbq $0x0, %rax
jmp 0x1f158
cmpl $0x10000, %r14d         # imm = 0x10000
movl $0x4, %eax
sbbl $0x0, %eax
cmpl $0x800, %r14d           # imm = 0x800
cmovbl %r10d, %eax
leaq (%r11,%rax), %r15
cmpq %rcx, %r15
jbe 0x1f11c
xorl %eax, %eax
jmp 0x1f158
leal -0x1(%rax), %r12d
leaq (%rdx,%r11), %r15
leaq 0x1(%r12), %r13
movl %r14d, %ebp
andb $0x3f, %bpl
orb $-0x80, %bpl
movb %bpl, -0x1(%r15,%r13)
shrl $0x6, %r14d
decq %r13
cmpq $0x1, %r13
ja 0x1f129
movzbl (%r9,%r12,2), %ebp
notl %ebp
andl %r14d, %ebp
orb 0x1(%r9,%r12,2), %bpl
movb %bpl, (%r15)
addq %r11, %rax
incq %rbx
movq %rax, %r11
cmpq %rsi, %rbx
jb 0x1f031
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
xorl %eax, %eax
retq
// File: /workspace/github_c_makefile_star2_O3/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
movq %rcx, -0x8(%rsp)
testq %rsi, %rsi
je 0x1f33e
xorl %r11d, %r11d
leaq 0x13bac(%rip), %r8      # 0x32d46
xorl %ebx, %ebx
movzbl (%rdi,%rbx), %r12d
movl $0x2, %ebp
movq $-0x1, %r13
xorl %r14d, %r14d
movl %r14d, %r15d
movzbl 0x2(%r8,%r13,2), %r9d
movzbl 0x3(%r8,%r13,2), %r10d
incq %r13
movl %r9d, %eax
andl %r12d, %eax
decl %ebp
cmpq $0x2, %r13
ja 0x1f1d9
leal 0x1(%r15), %r14d
cmpl %r10d, %eax
jne 0x1f1b0
movl $0xfffd, %r14d          # imm = 0xFFFD
cmpl %r10d, %eax
jne 0x1f2bb
notl %r9d
andl %r12d, %r9d
testq %r13, %r13
je 0x1f251
movl %ebp, %eax
negl %eax
leaq 0x1(%rbx), %r12
cmpq %r12, %rsi
cmovaq %rsi, %r12
decq %r12
movl %eax, %eax
leaq (%rbx,%rax), %rcx
incq %rcx
leaq 0x1(%rbx), %rax
cmpq %rsi, %rax
jae 0x1f2b8
movzbl 0x1(%rdi,%rbx), %r13d
movl %r13d, %r10d
andl $-0x40, %r10d
cmpl $0x80, %r10d
jne 0x1f2bb
movl %r9d, %r10d
shll $0x6, %r10d
andl $0x3f, %r13d
movl %r13d, %r9d
orl %r10d, %r9d
movq %rax, %rbx
decl %r15d
jne 0x1f20e
movq %rcx, %rbx
movl $0x1, %eax
cmpl $0x80, %r9d
jb 0x1f27c
movl $0x2, %eax
cmpl $0x800, %r9d            # imm = 0x800
jb 0x1f27c
cmpl $0x10000, %r9d          # imm = 0x10000
movl $0x4, %eax
sbbl $0x0, %eax
addl %ebp, %eax
cmpl $0x2, %eax
jne 0x1f2bb
cmpl $0xffff, %r9d           # imm = 0xFFFF
setb %al
movl %r9d, %ecx
andl $0xf800, %ecx           # imm = 0xF800
cmpl $0xd800, %ecx           # imm = 0xD800
sete %cl
testb %cl, %al
jne 0x1f2bb
cmpl $0x110000, %r9d         # imm = 0x110000
movl $0xfffd, %eax           # imm = 0xFFFD
cmovael %eax, %r9d
movl %r9d, %r14d
jmp 0x1f2bb
movq %r12, %rbx
testq %rdx, %rdx
je 0x1f2da
cmpq -0x8(%rsp), %r11
jae 0x1f328
cmpl $0xffff, %r14d          # imm = 0xFFFF
ja 0x1f2ec
movl $0x1, %eax
movq %r11, %r15
jmp 0x1f321
cmpl $0x10000, %r14d         # imm = 0x10000
movl $0x2, %eax
sbbq $0x0, %rax
jmp 0x1f32a
leaq 0x1(%r11), %r15
cmpq -0x8(%rsp), %r15
jae 0x1f328
leal 0xf0000(%r14), %eax
movl $0x3ff, %ecx            # imm = 0x3FF
andl %ecx, %r14d
orl $0xdc00, %r14d          # imm = 0xDC00
shrl $0xa, %eax
andl %ecx, %eax
orl $0xd800, %eax           # imm = 0xD800
movw %ax, (%rdx,%r11,2)
movl $0x2, %eax
movw %r14w, (%rdx,%r15,2)
jmp 0x1f32a
xorl %eax, %eax
addq %r11, %rax
incq %rbx
movq %rax, %r11
cmpq %rsi, %rbx
jb 0x1f19c
jmp 0x1f340
xorl %eax, %eax
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/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
movups 0xe43(%rip), %xmm0      # 0x2004
movaps %xmm0, 0x20(%rsp)
cmpl $0x1, %edi
jg 0x11db
leaq 0xe42(%rip), %rdi       # 0x2014
xorl %eax, %eax
callq 0x12d4
jmp 0x124a
movq %rsi, %rbx
movl %edi, %r12d
movl $0x12, %ebp
movl $0x2, %r13d
movq %rsp, %r14
cmpq $0x2, %r13
je 0x1205
movq %r14, %rdi
callq 0x1060
movw $0x20, (%rsp,%rax)
decl %ebp
movq -0x8(%rbx,%r13,8), %r15
movq %r15, %rdi
callq 0x12fa
movl %eax, %ecx
movl %ebp, %eax
cmpl %ebp, %ecx
jg 0x1224
movq -0x8(%rbx,%r13,8), %rdi
callq 0x12fa
movslq %eax, %rdx
movq %r14, %rdi
movq %r15, %rsi
callq 0x1040
movq -0x8(%rbx,%r13,8), %rdi
callq 0x12fa
cmpq %r12, %r13
jae 0x124a
subl %eax, %ebp
incq %r13
testl %ebp, %ebp
jg 0x11ef
movb $0x0, 0x11(%rsp)
movl $0x1, %edi
movl $0x1, %esi
xorl %edx, %edx
callq 0x1080
movl %eax, %ebx
testl %eax, %eax
jns 0x1274
leaq 0xdcd(%rip), %rdi       # 0x203a
xorl %eax, %eax
callq 0x12d4
leaq 0x20(%rsp), %rsi
movl %ebx, %edi
movl $0x10, %edx
callq 0x1070
testl %eax, %eax
jns 0x1297
leaq 0xdc3(%rip), %rdi       # 0x2053
xorl %eax, %eax
callq 0x12d4
movq %rsp, %rsi
movl $0x12, %edx
movl %ebx, %edi
xorl %ecx, %ecx
callq 0x1090
testq %rax, %rax
jns 0x12bb
leaq 0xdbc(%rip), %rdi       # 0x2070
xorl %eax, %eax
callq 0x12d4
movl %ebx, %edi
callq 0x1030
xorl %eax, %eax
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_c_makefile_star2_O3/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, %rbx
movq %rdi, %r15
leaq 0xc82(%rip), %rdi       # 0x2006
leaq 0xc8b(%rip), %rsi       # 0x2016
callq 0x10d0
testq %rax, %rax
je 0x146e
movq %rax, %r14
xorl %eax, %eax
movq %rbx, -0x40(%rbp)
leaq -0x30(%rbp), %rbx
movq %rax, (%rbx)
leaq -0x38(%rbp), %rsi
movq %rax, (%rsi)
movq %rbx, %rdi
movq %r14, %rdx
callq 0x1100
movq (%rbx), %r12
movq -0x40(%rbp), %rbx
movq %rbx, %rdi
movq %r12, %rsi
callq 0x1030
movb (%r15), %al
cmpb (%r12), %al
je 0x140d
leaq -0x30(%rbp), %r13
leaq -0x38(%rbp), %rbx
movq %r13, %rdi
movq %rbx, %rsi
movq %r14, %rdx
callq 0x1100
movb (%r15), %cl
movq -0x30(%rbp), %r12
movb (%r12), %dl
cmpq $-0x1, %rax
je 0x1401
cmpb %dl, %cl
jne 0x13de
cmpb %dl, %cl
movq -0x40(%rbp), %rbx
jne 0x1491
movq %rbx, %rdi
movq %r12, %rsi
callq 0x1030
leaq -0x30(%rbp), %rdi
leaq -0x38(%rbp), %rsi
movq %r14, %rdx
callq 0x1100
cmpq $-0x1, %rax
je 0x14ac
callq 0x1150
movq %rax, %r15
leaq -0x30(%rbp), %r12
leaq -0x38(%rbp), %r13
movq (%r15), %rax
movq -0x30(%rbp), %rsi
movsbq (%rsi), %rcx
testb $0x4, 0x1(%rax,%rcx,2)
jne 0x14ac
movq %rbx, %rdi
callq 0x1110
movq %r12, %rdi
movq %r13, %rsi
movq %r14, %rdx
callq 0x1100
cmpq $-0x1, %rax
jne 0x143e
jmp 0x14ac
leaq 0xba3(%rip), %rdi       # 0x2018
leaq 0xb8a(%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(%rbx)
movabsq $0x20746f6e2070614d, %rax # imm = 0x20746F6E2070614D
movq %rax, (%rbx)
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/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 0x8dd4(%rip), %rcx      # 0xc5b8
movzbl 0x45(%rcx), %eax
movl %eax, %edx
shll $0x2, %edx
movl 0x48(%rcx,%rdx), %r8d
addl %edi, %r8d
leaq 0x3a94(%rip), %rsi      # 0x7290
movl (%rdx,%rsi), %r9d
cmpl %r9d, %r8d
ja 0x380c
movl %r8d, 0x48(%rcx,%rax,4)
popq %rbx
retq
movl %edi, %ebx
movq 0x77e3(%rip), %rcx      # 0xaff8
movq (%rcx), %rdi
leaq 0x7b51(%rip), %rcx      # 0xb370
movq (%rcx,%rax,8), %rdx
leaq 0x3a56(%rip), %rcx      # 0x7280
movl (%rcx,%rax,4), %ecx
leaq 0x3abd(%rip), %rsi      # 0x72f1
xorl %eax, %eax
callq 0x30d0
movq 0x8d76(%rip), %rcx      # 0xc5b8
movb $0x2, 0x44(%rcx)
movzbl 0x45(%rcx), %eax
addl 0x48(%rcx,%rax,4), %ebx
movl %ebx, %r8d
jmp 0x3805
// File: /workspace/github_c_makefile_star2_O3/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 0x387f
movl $0x1, %eax
movl %edi, %ecx
shll %cl, %eax
movq 0x8d50(%rip), %rcx      # 0xc5b8
movzbl 0x45(%rcx), %edx
movl 0x48(%rcx,%rdx,4), %esi
leal -0x1(%rax), %edi
andl %esi, %edi
je 0x387f
addl %eax, %esi
subl %edi, %esi
movl %esi, 0x48(%rcx,%rdx,4)
retq
// File: /workspace/github_c_makefile_star2_O3/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 0x8d29(%rip), %rax      # 0xc5b8
movzbl 0x45(%rax), %r15d
movl %r15d, %ecx
shll $0x2, %ecx
leaq 0x39df(%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 0x391d
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 0x3935
movq 0x8ccd(%rip), %rcx      # 0xc5b8
leal (,%r15,8), %edx
addq %r14, 0x78(%rcx,%rdx)
movq %rax, 0x20(%rcx,%rdx)
movq 0x8cb4(%rip), %rax      # 0xc5b8
addq 0x20(%rax,%rdx), %rbx
movq %rbx, %rdi
xorl %esi, %esi
movq %r14, %rdx
callq 0x3080
movq 0x8c9b(%rip), %rax      # 0xc5b8
cmpq %r12, 0x58(%rax,%r15,8)
jae 0x3929
movq %r12, 0x58(%rax,%r15,8)
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
callq 0x31b5
jmp 0x3929
// File: /workspace/github_c_makefile_star2_O3/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 0x8c67(%rip), %rax      # 0xc5b8
movzbl 0x45(%rax), %r12d
leal (,%r12,4), %ecx
movl 0x48(%rax,%rcx), %r15d
leaq 0x3916(%rip), %rax      # 0x7280
subl (%rcx,%rax), %r15d
movq %rsi, %rdi
callq 0x3880
movq 0x8c3b(%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_O3/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 %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
leaq 0x360c(%rip), %r14      # 0x7010
leaq 0x3875(%rip), %r15      # 0x7280
movzbl (%rbx), %ebp
cmpl $0x5c, %ebp
je 0x3a61
testl %ebp, %ebp
je 0x3af9
incq %rbx
movq 0x8b93(%rip), %rax      # 0xc5b8
movzbl 0x45(%rax), %r12d
leal (,%r12,4), %ecx
movl 0x48(%rax,%rcx), %r13d
subl (%rcx,%r15), %r13d
movl $0x1, %edi
callq 0x3880
movq 0x8b6c(%rip), %rax      # 0xc5b8
movq 0x20(%rax,%r12,8), %rax
movb %bpl, (%rax,%r13)
movl $0x1, %edi
callq 0x37dc
jmp 0x3a0b
movb 0x1(%rbx), %bpl
addq $0x2, %rbx
movzbl %bpl, %eax
cmpl $0x61, %eax
jg 0x3a8b
cmpl $0x2f, %eax
jle 0x3aa4
cmpl $0x30, %eax
je 0x3aca
cmpl $0x3f, %eax
je 0x3a1e
cmpl $0x61, %eax
jne 0x3ad1
movb $0x7, %bpl
jmp 0x3a1e
leal -0x6e(%rax), %ecx
cmpl $0x8, %ecx
ja 0x3ab8
movslq (%r14,%rcx,4), %rax
addq %r14, %rax
jmpq *%rax
movb $0xa, %bpl
jmp 0x3a1e
cmpl $0x22, %eax
je 0x3a1e
cmpl $0x27, %eax
je 0x3a1e
jmp 0x3ad1
cmpl $0x62, %eax
je 0x3af1
cmpl $0x66, %eax
jne 0x3ad1
movb $0xc, %bpl
jmp 0x3a1e
xorl %ebp, %ebp
jmp 0x3a1e
movb $0x5c, %bpl
jmp 0x3a1e
movb $0xb, %bpl
jmp 0x3a1e
movb $0xd, %bpl
jmp 0x3a1e
movb $0x9, %bpl
jmp 0x3a1e
movb $0x8, %bpl
jmp 0x3a1e
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq