LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_c_makefile_star2_O1/canboat[P]canboat/n2kd/main.c
// Function: tcpServer
static void tcpServer(uint16_t port, StreamType st)
{
  struct sockaddr_in serverAddr;
  int                sockAddrSize = sizeof(serverAddr);
  int                r;
  int                on = 1;
  SOCKET             s;
  bool               udp = (st == SERVER_NMEA0183_DATAGRAM);

  s = socket(PF_INET, udp ? SOCK_DGRAM : SOCK_STREAM, 0);
  if (s == INVALID_SOCKET)
  {
    die("Unable to open server socket");
  }
  memset((char *) &serverAddr, 0, sockAddrSize);
  serverAddr.sin_family      = AF_INET;
  serverAddr.sin_port        = htons(port);
  serverAddr.sin_addr.s_addr = htonl(INADDR_ANY);

  setsockopt(s, SOL_SOCKET, SO_REUSEADDR, (char *) &on, (socklen_t) sizeof(on));

  r = bind(s, (struct sockaddr *) &serverAddr, sockAddrSize);
  if (r == INVALID_SOCKET)
  {
    die("Unable to bind server socket");
  }

  if (!udp)
  {
    r = listen(s, 10);
    if (r == INVALID_SOCKET)
    {
      die("Unable to listen to server socket");
    }
  }
  else
  {
    setsockopt(s, SOL_SOCKET, SO_BROADCAST, (char *) &on, (socklen_t) sizeof(on));
  }

  setFdUsed(s, st);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x28, %rsp
movl %esi, %ebx
movl %edi, %r14d
movl $0x1, 0xc(%rsp)
xorl %esi, %esi
cmpl $0xc, %ebx
sete %sil
incl %esi
movl $0x2, %edi
xorl %edx, %edx
callq 0x23b0
movl %eax, %ebp
cmpl $-0x1, %eax
jne 0x430d
leaq 0x5b40(%rip), %rdi      # 0x9e48
callq 0x771f
xorps %xmm0, %xmm0
leaq 0x10(%rsp), %r15
movaps %xmm0, (%r15)
movw $0x2, (%r15)
rolw $0x8, %r14w
movw %r14w, 0x2(%r15)
movl $0x0, 0x4(%r15)
leaq 0xc(%rsp), %rcx
movl %ebp, %edi
movl $0x1, %esi
movl $0x2, %edx
movl $0x4, %r8d
callq 0x20c0
movl %ebp, %edi
movq %r15, %rsi
movl $0x10, %edx
callq 0x2270
cmpl $-0x1, %eax
jne 0x436d
leaq 0x5afd(%rip), %rdi      # 0x9e65
callq 0x771f
cmpl $0xc, %ebx
jne 0x4390
leaq 0xc(%rsp), %rcx
movl %ebp, %edi
movl $0x1, %esi
movl $0x6, %edx
movl $0x4, %r8d
callq 0x20c0
jmp 0x43ad
movl %ebp, %edi
movl $0xa, %esi
callq 0x2250
cmpl $-0x1, %eax
jne 0x43ad
leaq 0x5ada(%rip), %rdi      # 0x9e82
callq 0x771f
movl %ebp, %edi
movl %ebx, %esi
callq 0x3211
addq $0x28, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/canboat[P]canboat/n2kd/main.c
// Function: writeAndClose
static void writeAndClose(int idx, char *data, size_t len)
{
  int r;

#ifdef O_NONBLOCK
  int flags = fcntl(stream[idx].fd, F_GETFL, 0);
  fcntl(stream[idx].fd, F_SETFL, flags & ~O_NONBLOCK);
#else
  int ioctlOptionValue = 0;
  ioctl(stream[idx].fd, FIONBIO, &ioctlOptionValue);
#endif

  while (len > 0)
  {
    r = write(stream[idx].fd, data, len);
    if (r <= 0)
    {
      break;
    }
    len -= r;
    data += r;
  }
  closeStream(idx);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %rdx, %rbx
movq %rsi, %r14
movl %edi, %ebp
movslq %edi, %rax
imulq $0x8038, %rax, %r12     # imm = 0x8038
leaq 0x9ea2(%rip), %r15      # 0xe520
movl (%r12,%r15), %edi
movl $0x3, %esi
xorl %edx, %edx
xorl %eax, %eax
callq 0x20d0
movl (%r12,%r15), %edi
andl $0xfffff7ff, %eax       # imm = 0xFFFFF7FF
movl $0x4, %esi
movl %eax, %edx
xorl %eax, %eax
callq 0x20d0
testq %rbx, %rbx
je 0x46ce
addq %r12, %r15
movl (%r15), %edi
movq %r14, %rsi
movq %rbx, %rdx
callq 0x20e0
testl %eax, %eax
jle 0x46ce
andl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
addq %rax, %r14
subq %rax, %rbx
jne 0x46af
movl %ebp, %edi
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
jmp 0x4062
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O1/canboat[P]canboat/n2kd/gps_ais.c
// Function: nmea0183VTG
extern void nmea0183VTG(StringBuffer *msg183, int src, const char *msg)
{
  double sog;
  double cog;

  if (getJSONNumber(msg, "SOG", &sog, U_VELOCITY) && getJSONNumber(msg, "COG", &cog, U_ANGLE))
  {
    nmea0183CreateMessage(msg183, src, "VTG,%.1f,T,,M,%.2f,N,%.2f,K", cog, SPEED_M_S_TO_KNOTS(sog), SPEED_M_S_TO_KMH(sog));
    g_sog        = sog;
    g_cog        = cog;
    g_sog_cog_ts = getNow();
  }
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x10, %rsp
movq %rdx, %r15
movl %esi, %ebx
movq %rdi, %r14
leaq 0x5a44(%rip), %rsi      # 0xa13c
leaq 0x8(%rsp), %rdx
movq %r15, %rdi
movl $0x2, %ecx
callq 0x72ad
testb %al, %al
je 0x477f
leaq 0x5a2b(%rip), %rsi      # 0xa140
movq %rsp, %rdx
movq %r15, %rdi
xorl %ecx, %ecx
callq 0x72ad
testb %al, %al
je 0x477f
movsd (%rsp), %xmm0
movsd 0x8(%rsp), %xmm2
movsd 0x591f(%rip), %xmm1     # 0xa058
mulsd %xmm2, %xmm1
mulsd 0x591b(%rip), %xmm2     # 0xa060
leaq 0x59f8(%rip), %rdx      # 0xa144
movq %r14, %rdi
movl %ebx, %esi
movb $0x3, %al
callq 0x6798
movsd 0x8(%rsp), %xmm0
movsd %xmm0, 0x20a5bfa(%rip)  # 0x20aa360
movsd (%rsp), %xmm0
movsd %xmm0, 0x20a5bf5(%rip)  # 0x20aa368
callq 0x7328
movq %rax, 0x20a5bf1(%rip)   # 0x20aa370
addq $0x10, %rsp
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O1/canboat[P]canboat/n2kd/gps_ais.c
// Function: nmea0183GSA
extern void nmea0183GSA(StringBuffer *msg183, int src, const char *msg)
{
  char modeString[OTHER_LENGTH] = "";
  char pdopString[OTHER_LENGTH] = "";
  char hdopString[OTHER_LENGTH] = "";
  char vdopString[OTHER_LENGTH] = "";

  getJSONValue(msg, "Actual Mode", modeString, sizeof(modeString));
  getJSONValue(msg, "PDOP", pdopString, sizeof(pdopString));
  getJSONValue(msg, "HDOP", hdopString, sizeof(hdopString));
  getJSONValue(msg, "VDOP", vdopString, sizeof(vdopString));

  modeString[1] = 0; // Abbreviate string, or still empty if not in N2K PGN

  nmea0183CreateMessage(msg183, src, "GSA,M,%s,,,,,,,,,,,,,%s,%s,%s", modeString, pdopString, hdopString, vdopString);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x88, %rsp
movq %rdx, %rbp
movl %esi, 0xc(%rsp)
movq %rdi, %r15
xorl %eax, %eax
leaq 0x70(%rsp), %r14
movl %eax, 0x10(%r14)
xorps %xmm0, %xmm0
movaps %xmm0, (%r14)
leaq 0x50(%rsp), %r12
movl %eax, 0x10(%r12)
movaps %xmm0, (%r12)
leaq 0x30(%rsp), %r13
movl %eax, 0x10(%r13)
movaps %xmm0, (%r13)
leaq 0x10(%rsp), %rbx
movl %eax, 0x10(%rbx)
movaps %xmm0, (%rbx)
leaq 0x597b(%rip), %rsi      # 0xa160
movl $0x14, %ecx
movq %rdx, %rdi
movq %r14, %rdx
callq 0x7c81
leaq 0x5970(%rip), %rsi      # 0xa16c
movl $0x14, %ecx
movq %rbp, %rdi
movq %r12, %rdx
callq 0x7c81
leaq 0x595e(%rip), %rsi      # 0xa171
movl $0x14, %ecx
movq %rbp, %rdi
movq %r13, %rdx
callq 0x7c81
leaq 0x594c(%rip), %rsi      # 0xa176
movl $0x14, %ecx
movq %rbp, %rdi
movq %rbx, %rdx
callq 0x7c81
movb $0x0, 0x1(%r14)
movq %rbx, (%rsp)
leaq 0x5931(%rip), %rdx      # 0xa17b
movq %r15, %rdi
movl 0xc(%rsp), %esi
movq %r14, %rcx
movq %r12, %r8
movq %r13, %r9
xorl %eax, %eax
callq 0x6798
addq $0x88, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/canboat[P]canboat/n2kd/gps_ais.c
// Function: aisETA
long int aisETA(const char *msg)
{
  char         jstr[11];
  unsigned int month = 0, day = 0, hour = 24, minute = 60;

  // Get ais values from json (sscanf not used as it fails for som values)
  if (getJSONValue(msg, "ETA Date", jstr, sizeof(jstr)))
  {
    month = 10 * ((unsigned char) jstr[5] - '0') + ((unsigned char) jstr[6] - '0');
    day   = 10 * ((unsigned char) jstr[8] - '0') + ((unsigned char) jstr[9] - '0');
    if (month > 12)
      month = 0;
    if (day > 31)
      day = 0;
  }

  if (getJSONValue(msg, "ETA Time", jstr, sizeof(jstr)))
  {
    hour   = 10 * ((unsigned char) jstr[0] - '0') + ((unsigned char) jstr[1] - '0');
    minute = 10 * ((unsigned char) jstr[3] - '0') + ((unsigned char) jstr[4] - '0');
    if (hour > 24)
      hour = 24;
    if (minute > 60)
      minute = 60;
  }

  // Pack into ais integer
  return (month << 16) + (day << 11) + (hour << 6) + minute;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
subq $0x10, %rsp
movq %rdi, %r14
leaq 0x5605(%rip), %rsi      # 0xa22d
leaq 0x5(%rsp), %rdx
movl $0xb, %ecx
callq 0x7c81
xorl %ebp, %ebp
movl $0x0, %ebx
testb %al, %al
je 0x4c83
movzbl 0xa(%rsp), %eax
leal (%rax,%rax,4), %eax
movzbl 0xb(%rsp), %ecx
leal (%rcx,%rax,2), %eax
movl $0xfffffdf0, %ecx       # imm = 0xFFFFFDF0
addl %ecx, %eax
movzbl 0xd(%rsp), %edx
leal (%rdx,%rdx,4), %edx
movzbl 0xe(%rsp), %esi
leal (%rsi,%rdx,2), %edx
addl %ecx, %edx
movl %eax, %ebp
shll $0x10, %ebp
movl %edx, %ebx
shll $0xb, %ebx
xorl %ecx, %ecx
cmpl $0xd, %eax
cmovael %ecx, %ebp
cmpl $0x20, %edx
cmovael %ecx, %ebx
leaq 0x55ac(%rip), %rsi      # 0xa236
leaq 0x5(%rsp), %rdx
movl $0xb, %ecx
movq %r14, %rdi
callq 0x7c81
testb %al, %al
je 0x4ce4
movzbl 0x5(%rsp), %eax
leal (%rax,%rax,4), %eax
movzbl 0x6(%rsp), %ecx
leal (%rcx,%rax,2), %ecx
movl $0xfffffdf0, %eax       # imm = 0xFFFFFDF0
addl %eax, %ecx
movzbl 0x8(%rsp), %edx
leal (%rdx,%rdx,4), %edx
movzbl 0x9(%rsp), %esi
leal (%rsi,%rdx,2), %edx
addl %eax, %edx
cmpl $0x18, %ecx
movl $0x18, %eax
cmovbl %ecx, %eax
cmpl $0x3c, %edx
movl $0x3c, %ecx
cmovbl %edx, %ecx
shll $0x6, %eax
jmp 0x4cee
movl $0x3c, %ecx
movl $0x600, %eax            # imm = 0x600
addl %ecx, %eax
addl %ebp, %ebx
addl %eax, %ebx
movq %rbx, %rax
addq $0x10, %rsp
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/canboat[P]canboat/n2kd/gps_ais.c
// Function: aisAtoNName
char *aisAtoNName(const char *msg, bool extended, int *len)
{
  // The name splits in two parts, name and name extension.
  static char jsonString[35];
  int         i;

  // The extended name part is of variable length. Since the len byte has
  // been dropped, we have to rely on NULL termination of the string in
  // the extended part. First 20 chars ordinary name
  for (i = 20; i < 35; i++)
  {
    jsonString[i] = '\0';
  }

  if (!getJSONValue(msg, "AtoN Name", jsonString, sizeof(jsonString)))
    jsonString[0] = '\0';
  jsonString[34] = '\0';

  if (extended)
  {
    char *eName = (char *) jsonString + 20;
    for (i = 0; i <= 14; i++)
    {
      if (*(eName + i) == '\0')
        break;
    }
    // Each ais char is 6 bit. The length shall be padded to a multiple of 8 bits
    i *= 6;
    if (i % 8)
      i += 8 - i % 8;
    *len = i;
    return eName;
  }
  else
  {
    jsonString[20] = '\0';
  }
  return jsonString;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movq %rdx, %rbx
movl %esi, %ebp
xorl %eax, %eax
movq %rax, 0x20a5689(%rip)   # 0x20aa39b
movq %rax, 0x20a567b(%rip)   # 0x20aa394
leaq 0x20a5660(%rip), %r14   # 0x20aa380
leaq 0x5518(%rip), %rsi      # 0xa23f
movl $0x23, %ecx
movq %r14, %rdx
callq 0x7c81
testb %al, %al
jne 0x4d3f
movb $0x0, 0x20a5641(%rip)   # 0x20aa380
movb $0x0, 0x20a565c(%rip)   # 0x20aa3a2
testb %bpl, %bpl
je 0x4d89
xorl %eax, %eax
leaq 0x20a562c(%rip), %rcx   # 0x20aa380
cmpb $0x0, 0x14(%rax,%rcx)
je 0x4d69
incq %rax
cmpq $0xf, %rax
jne 0x4d54
movl $0xf, %eax
addl %eax, %eax
leal (%rax,%rax,2), %eax
movl %eax, %ecx
andl $0x7ffffff8, %ecx       # imm = 0x7FFFFFF8
addl $0x8, %ecx
testb $0x6, %al
cmovel %eax, %ecx
movl %ecx, (%rbx)
leaq 0x20a560d(%rip), %r14   # 0x20aa394
jmp 0x4d90
movb $0x0, 0x20a5604(%rip)   # 0x20aa394
movq %r14, %rax
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/canboat[P]canboat/n2kd/gps_ais.c
// Function: aisEnum
static int aisEnum(const char *msg, const char *fieldName)
{
  int64_t n;

  if (getJSONInt64(msg, fieldName, &n))
  {
    logDebug("getJSONInt64(msg, '%s') = %" PRId64 "\n", fieldName, n);
    return (int) n;
  }
  logDebug("getJSONInt64(msg, '%s') = no result -> -1\n", fieldName);
  return -1;
}

// Assembly:
pushq %rbx
subq $0x10, %rsp
movq %rsi, %rbx
leaq 0x8(%rsp), %rdx
callq 0x807c
testb %al, %al
je 0x61a1
movq 0x8(%rsp), %rdx
leaq 0x42d7(%rip), %rdi      # 0xa468
movq %rbx, %rsi
xorl %eax, %eax
callq 0x7549
movl 0x8(%rsp), %eax
jmp 0x61b7
leaq 0x42df(%rip), %rdi      # 0xa487
movq %rbx, %rsi
xorl %eax, %eax
callq 0x7549
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
addq $0x10, %rsp
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O1/canboat[P]canboat/n2kd/gps_ais.c
// Function: addAisInt
static int addAisInt(long int value, int len, aisVector *payload)
{
  int           i, k;
  unsigned char nibble;

  // Break if overflow, does not treat signed positive value properly
  if (value >= (long int) (1 << len) || value < -(long int) (1 << (len - 1)))
  {
    return 0;
  }

  // AIS uses big endian. Thus most significant bits shall be stored first.
  while (len > 0)
  {
    i = payload->pos / 8;
    k = 8 - payload->pos % 8;
    payload->bitVector[i] &= ~(unsigned char) ((1 << k) - 1);
    if (len >= k)
    {
      nibble = ((1 << k) - 1) & (value >> (len - k));
      payload->pos += k;
    }
    else
    {
      nibble = ((1 << k) - 1) & (value << (k - len));
      payload->pos += len;
    }
    payload->bitVector[i] |= nibble;
    len -= k;
  }
  return 1;
}

// Assembly:
movl $0x1, %eax
movl $0x1, %r8d
movl %esi, %ecx
shll %cl, %r8d
cmpq %rdi, %r8
jle 0x625e
leal -0x1(%rsi), %ecx
shll %cl, %eax
negq %rax
cmpq %rdi, %rax
setg %al
testl %esi, %esi
setle %cl
orb %al, %cl
jne 0x625e
pushq %rbx
movl 0xe4(%rdx), %ecx
leal 0x7(%rcx), %r9d
testl %ecx, %ecx
cmovnsl %ecx, %r9d
movl %r9d, %eax
andl $-0x8, %eax
subl %ecx, %eax
addl $0x8, %eax
movl %esi, %r8d
subl %eax, %r8d
movl %r8d, %ecx
negl %ecx
movq %rdi, %r10
shlq %cl, %r10
movq %rdi, %r11
movl %r8d, %ecx
sarq %cl, %r11
movl %esi, %r8d
subl %eax, %r8d
movl %eax, %ebx
cmovll %esi, %ebx
cmovgel %r11d, %r10d
sarl $0x3, %r9d
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
movl %eax, %ecx
shll %cl, %esi
movslq %r9d, %rax
andb %sil, (%rdx,%rax)
notl %esi
addl %ebx, 0xe4(%rdx)
andl %r10d, %esi
orb %sil, (%rdx,%rax)
movl %r8d, %esi
testl %r8d, %r8d
jg 0x61ee
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O1/canboat[P]canboat/n2kd/gps_ais.c
// Function: addAisString
static int addAisString(char *string, int len, aisVector *payload)
{
  int           i, k;
  unsigned char nextchar;

  if (string == NULL)
  {
    return 0;
  }

  while (len >= 6)
  {
    // Encode current char to 6-bit ascii
    // 32 -> 63 => 32 -> 63, 64 -> 95 => 0 -> 31
    nextchar = *string;
    if (nextchar == '\0')
    {
      nextchar = 0;
    }
    else if (nextchar < 32 || nextchar > 95)
    {
      nextchar = 32;
    }
    else if (nextchar >= 64)
    {
      nextchar -= 64;
    }
    // Add 6-bit ascii char to payload
    i = payload->pos / 8;
    k = 8 - payload->pos % 8;
    payload->bitVector[i] &= ~(unsigned char) ((1 << k) - 1);
    if (k >= 6)
    {
      payload->bitVector[i] |= ((1 << k) - 1) & (nextchar << (k - 6));
    }
    else
    {
      payload->bitVector[i] |= ((1 << k) - 1) & (nextchar >> (6 - k));
      payload->bitVector[i + 1] = nextchar << (2 + k);
    }
    payload->pos += 6;
    len -= 6;
    if (*string != '\0')
    {
      string++;
    }
  }
  // A string can be padded with extra bits. These should reasonably be cleared
  payload->bitVector[(payload->pos / 8) + 1] = 0;
  payload->pos += len;
  return 1;
}

// Assembly:
testq %rdi, %rdi
je 0x65c4
cmpl $0x6, %esi
jl 0x65a3
pushq %rbx
movb (%rdi), %cl
testb %cl, %cl
je 0x650d
leal -0x60(%rcx), %r8d
movl $0x20, %eax
cmpb $-0x40, %r8b
jb 0x650f
leal -0x40(%rcx), %eax
cmpb $0x40, %cl
movzbl %cl, %ecx
movzbl %al, %eax
cmovbl %ecx, %eax
movzbl %al, %eax
jmp 0x650f
xorl %eax, %eax
movl 0xe4(%rdx), %r8d
leal 0x7(%r8), %ecx
testl %r8d, %r8d
cmovnsl %r8d, %ecx
movl %ecx, %r9d
andl $-0x8, %ecx
subl %ecx, %r8d
movb $0x8, %cl
subb %r8b, %cl
movl $0xffffffff, %r10d      # imm = 0xFFFFFFFF
shll %cl, %r10d
sarl $0x3, %r9d
movl %r10d, %r11d
notl %r11d
movslq %r9d, %r9
andb (%rdx,%r9), %r10b
movb %r10b, (%rdx,%r9)
cmpl $0x2, %r8d
jg 0x6566
movb $0x2, %cl
subb %r8b, %cl
shll %cl, %eax
andl %r11d, %eax
orb %al, %r10b
movb %r10b, (%rdx,%r9)
jmp 0x6584
leal -0x2(%r8), %ecx
movl %eax, %ebx
shrl %cl, %ebx
andl %r11d, %ebx
orb %bl, %r10b
movb %r10b, (%rdx,%r9)
movb $0xa, %cl
subb %r8b, %cl
shll %cl, %eax
movb %al, 0x1(%rdx,%r9)
addl $0x6, 0xe4(%rdx)
leal -0x6(%rsi), %eax
cmpb $0x1, (%rdi)
sbbq $-0x1, %rdi
cmpl $0xb, %esi
movl %eax, %esi
jg 0x64e4
popq %rbx
jmp 0x65a5
movl %esi, %eax
movl 0xe4(%rdx), %ecx
leal 0x7(%rcx), %esi
testl %ecx, %ecx
cmovnsl %ecx, %esi
sarl $0x3, %esi
movslq %esi, %rcx
movb $0x0, 0x1(%rcx,%rdx)
addl %eax, 0xe4(%rdx)
retq
// File: /workspace/github_c_makefile_star2_O1/canboat[P]canboat/n2kd/gps_ais.c
// Function: aisShipDimensions
static long int aisShipDimensions(const char *msg, bool ship)
{
  long int length, beam, refBow, refStarboard, toStern, toPort;

  // Fetch pgn values
  if (ship)
  {
    length       = aisFloat(msg, "Length");
    beam         = aisFloat(msg, "Beam");
    refBow       = aisFloat(msg, "Position reference from Bow");
    refStarboard = aisFloat(msg, "Position reference from Starboard");
  }
  else
  {
    length       = aisFloat(msg, "Length/Diameter");
    beam         = aisFloat(msg, "Beam/Diameter");
    refBow       = aisFloat(msg, "Position Reference from True North Facing Edge");
    refStarboard = aisFloat(msg, "Position Reference from Starboard Edge");
  }

  // Calculate sentence values
  toStern = (length - refBow < 5110) ? length - refBow : 5110;
  toPort  = (beam - refStarboard < 630) ? beam - refStarboard : 630;

  // Pack values into 30 bits of the long integer
  return (((refBow + 5) / 10) << 21) + (((toStern + 5) / 10) << 12) + (((toPort + 5) / 10) << 6) + ((refStarboard + 5) / 10);
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movq %rdi, %r15
leaq 0x3eda(%rip), %rcx      # 0xa4b2
leaq 0x3f1d(%rip), %rax      # 0xa4fc
testl %esi, %esi
cmovneq %rcx, %rax
leaq 0x3ecd(%rip), %rcx      # 0xa4b9
leaq 0x3f19(%rip), %rbx      # 0xa50c
cmovneq %rcx, %rbx
leaq 0x3ee2(%rip), %rcx      # 0xa4e0
leaq 0x3f3c(%rip), %r12      # 0xa541
cmovneq %rcx, %r12
leaq 0x3eae(%rip), %rcx      # 0xa4be
leaq 0x3f03(%rip), %r13      # 0xa51a
cmovneq %rcx, %r13
movq %rax, %rsi
callq 0x632c
movq %rax, %r14
movq %r15, %rdi
movq %rbx, %rsi
callq 0x632c
movq %rax, %rbx
movq %r15, %rdi
movq %r12, %rsi
callq 0x632c
movq %rax, %r12
movq %r15, %rdi
movq %r13, %rsi
callq 0x632c
movq %rax, %rcx
subq %r12, %r14
movl $0x13f6, %eax           # imm = 0x13F6
cmpq %rax, %r14
cmovgeq %rax, %r14
subq %rcx, %rbx
movl $0x276, %eax            # imm = 0x276
cmpq %rax, %rbx
cmovgeq %rax, %rbx
addq $0x5, %r12
movabsq $0x6666666666666667, %rdi # imm = 0x6666666666666667
movq %r12, %rax
imulq %rdi
movq %rdx, %rsi
shrq $0x3f, %rsi
shrq $0x2, %rdx
addq %rdx, %rsi
shlq $0x15, %rsi
addq $0x5, %r14
movq %r14, %rax
imulq %rdi
movq %rdx, %r8
shrq $0x3f, %r8
shrq $0x2, %rdx
addq %rdx, %r8
addq $0x5, %rbx
movq %rbx, %rax
imulq %rdi
shlq $0xc, %r8
movq %rdx, %r9
shrq $0x3f, %r9
shrq $0x2, %rdx
addq %rdx, %r9
shlq $0x6, %r9
addq $0x5, %rcx
movq %rcx, %rax
imulq %rdi
movq %rdx, %rax
shrq $0x3f, %rax
sarq $0x2, %rdx
addq %rdx, %rax
addq %rsi, %rax
addq %r9, %rax
addq %r8, %rax
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O1/canboat[P]canboat/n2kd/gps_ais.c
// Function: addAisLongString
static int addAisLongString(const char *msg, const char *fieldName, int maxSize, bool padd, aisVector *payload)
{
  char *jsonString;
  int   len;

  jsonString = (char *) calloc(maxSize + 1, sizeof(char));
  if (jsonString == NULL)
  {
    return 0;
  }

  if (!getJSONValue(msg, fieldName, jsonString, maxSize))
  {
    free(jsonString);
    return 0;
  }

  for (len = 0; len <= maxSize; len++)
  {
    if (*(jsonString + len) == '\0')
    {
      break;
    }
  }

  len *= 6;
  if (padd)
  {
    if (len % 8)
    {
      len += 8 - (len % 8); // Add padd bits
    }
  }

  addAisString(jsonString, len, payload);
  free(jsonString);
  return len;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movq %rdx, %rbx
movl %esi, %r12d
movq %rdi, %r13
leal 0x1(%r12), %r15d
movl $0x1, %esi
movq %r15, %rdi
callq 0x21c0
testq %rax, %rax
je 0x6754
movq %rax, %r14
movl %r12d, %ecx
leaq 0x3c7f(%rip), %rsi      # 0xa3ac
movq %r13, %rdi
movq %rax, %rdx
callq 0x7c81
testb %al, %al
je 0x6787
testl %r12d, %r12d
js 0x675e
xorl %eax, %eax
cmpb $0x0, (%r14,%rax)
je 0x6762
incq %rax
cmpq %rax, %r15
jne 0x6743
jmp 0x6765
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
xorl %eax, %eax
jmp 0x676c
movl %eax, %r15d
addl %r15d, %r15d
leal (%r15,%r15,2), %eax
movl %eax, %esi
andl $0x7ffffff8, %esi       # imm = 0x7FFFFFF8
addl $0x8, %esi
testb $0x6, %al
cmovel %eax, %esi
movq %r14, %rdi
movq %rbx, %rdx
callq 0x64d1
movq %r14, %rdi
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
jmp 0x2030
// File: /workspace/github_c_makefile_star2_O1/canboat[P]canboat/n2kd/nmea0183.c
// Function: nmea0183CreateMessage
extern void nmea0183CreateMessage(StringBuffer *msg183, int src, const char *format, ...)
{
  uint8_t chk;
  size_t  i;
  char    first, second;
  va_list ap;

  va_start(ap, format);

  // Convert the 8 bit value 'n' into a valid NMEA0183 style sender.
  // The first implementation sent out a 2 digit hexadecimal number,
  // but that throws some implementations of receivers off as they
  // cannot handle numeric senders. So now we produce a 2 character
  // code with the src value 0-255 translated into
  // A..Q A..P with A representing 0, B representing 1, etc.
  // P is skipped for the initial letter, as that represents 'proprietary'
  // and OpenCPN does not allow this.

  first  = 'A' + ((src >> 4) & 0xf);
  second = 'A' + ((src) & 0xf);
  if (first >= 'P')
  {
    first++;
  }

  // Prepare for calculation of checksum
  i = msg183->len;

  if (src > 255)
    sbAppendFormat(msg183, "!%c%c", first, second);
  else
    sbAppendFormat(msg183, "$%c%c", first, second);
  sbAppendFormatV(msg183, format, ap);

  va_end(ap);

  chk = 0;
  for (i++; i < msg183->len; i++)
  {
    chk ^= (uint8_t) msg183->data[i];
  }
  sbAppendFormat(msg183, "*%02X\r\n", chk);
  logDebug("nmea0183 = %s", sbGet(msg183));
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0xd0, %rsp
movq %rdx, %r14
movq %rdi, %rbx
leaq 0x20(%rsp), %rdx
movq %rcx, 0x18(%rdx)
movq %r8, 0x20(%rdx)
movq %r9, 0x28(%rdx)
testb %al, %al
je 0x67f9
movaps %xmm0, 0x50(%rsp)
movaps %xmm1, 0x60(%rsp)
movaps %xmm2, 0x70(%rsp)
movaps %xmm3, 0x80(%rsp)
movaps %xmm4, 0x90(%rsp)
movaps %xmm5, 0xa0(%rsp)
movaps %xmm6, 0xb0(%rsp)
movaps %xmm7, 0xc0(%rsp)
movq %rsp, %r15
movq %rdx, 0x10(%r15)
leaq 0x100(%rsp), %rax
movq %rax, 0x8(%r15)
movabsq $0x3000000018, %rax     # imm = 0x3000000018
movl %esi, %edx
shrb $0x4, %dl
leal 0x41(%rdx), %edi
movl %esi, %ecx
andl $0xf, %ecx
addl $0x41, %ecx
cmpb $0xf, %dl
movzbl %dil, %edx
movl $0x51, %edi
cmovnel %edx, %edi
movq %rax, (%r15)
movq 0x8(%rbx), %r12
cmpl $0x100, %esi            # imm = 0x100
movzbl %dil, %edx
leaq 0x3e0b(%rip), %rax      # 0xa658
leaq 0x3e0a(%rip), %rsi      # 0xa65e
cmovgeq %rax, %rsi
xorl %ebp, %ebp
movq %rbx, %rdi
xorl %eax, %eax
callq 0x7a17
movq %rbx, %rdi
movq %r14, %rsi
movq %r15, %rdx
callq 0x7bd0
movq 0x8(%rbx), %rax
incq %r12
cmpq %rax, %r12
jae 0x6892
movq (%rbx), %rdx
xorl %ecx, %ecx
xorb (%rdx,%r12), %cl
incq %r12
cmpq %r12, %rax
jne 0x6883
movzbl %cl, %ebp
leaq 0x3dcb(%rip), %rsi      # 0xa664
movq %rbx, %rdi
movl %ebp, %edx
xorl %eax, %eax
callq 0x7a17
movq (%rbx), %rax
testq %rax, %rax
leaq 0x2f9d(%rip), %rsi      # 0x984f
cmovneq %rax, %rsi
leaq 0x3daf(%rip), %rdi      # 0xa66c
xorl %eax, %eax
callq 0x7549
addq $0xd0, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/canboat[P]canboat/n2kd/nmea0183.c
// Function: nmea0183VesselHeading
static void nmea0183VesselHeading(StringBuffer *msg183, int src, const char *msg)
{
  double  heading;
  double  deviation;
  double  variation;
  int64_t reference;

  if (getJSONNumber(msg, "Heading", &heading, U_ANGLE) && getJSONInt64(msg, "Reference", &reference))
  {
    if (getJSONNumber(msg, "Deviation", &deviation, U_ANGLE) && getJSONNumber(msg, "Variation", &variation, U_ANGLE)
        && reference == 1)
    {
      /* Enough info for HDG message */

      nmea0183CreateMessage(msg183,
                            src,
                            "HDG,%.1f,%.1f,%c,%.1f,%c",
                            heading,
                            fabs(deviation),
                            ((deviation < 0.0) ? 'W' : 'E'),
                            fabs(variation),
                            ((variation < 0.0) ? 'W' : 'E'));
    }
    else if (reference == 0)
    {
      nmea0183CreateMessage(msg183, src, "HDT,%.1f,T", heading);
    }
    else if (reference == 1)
    {
      nmea0183CreateMessage(msg183, src, "HDM,%.1f,M", heading);
    }
  }
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x20, %rsp
movq %rdx, %r15
movl %esi, %ebx
movq %rdi, %r14
leaq 0x3666(%rip), %rsi      # 0xa3fd
movq %rsp, %rdx
movq %r15, %rdi
xorl %ecx, %ecx
callq 0x72ad
testb %al, %al
je 0x6e93
leaq 0x3968(%rip), %rsi      # 0xa71b
leaq 0x8(%rsp), %rdx
movq %r15, %rdi
callq 0x807c
testb %al, %al
je 0x6e93
leaq 0x3956(%rip), %rsi      # 0xa725
leaq 0x18(%rsp), %rdx
movq %r15, %rdi
xorl %ecx, %ecx
callq 0x72ad
testb %al, %al
je 0x6e5d
leaq 0x3946(%rip), %rsi      # 0xa72f
leaq 0x10(%rsp), %rdx
movq %r15, %rdi
xorl %ecx, %ecx
callq 0x72ad
testb %al, %al
je 0x6e5d
cmpq $0x1, 0x8(%rsp)
jne 0x6e5d
movsd (%rsp), %xmm0
movsd 0x18(%rsp), %xmm1
movapd 0x3819(%rip), %xmm2     # 0xa630
xorpd %xmm3, %xmm3
ucomisd %xmm1, %xmm3
andpd %xmm2, %xmm1
movl $0x57, %eax
movl $0x45, %ecx
cmoval %eax, %ecx
movl $0x45, %r8d
movsd 0x10(%rsp), %xmm4
ucomisd %xmm4, %xmm3
andpd %xmm4, %xmm2
cmoval %eax, %r8d
leaq 0x38ea(%rip), %rdx      # 0xa739
movq %r14, %rdi
movl %ebx, %esi
movb $0x3, %al
callq 0x6798
jmp 0x6e93
movq 0x8(%rsp), %rax
cmpq $0x1, %rax
je 0x6e7b
testq %rax, %rax
jne 0x6e93
movsd (%rsp), %xmm0
leaq 0x38d9(%rip), %rdx      # 0xa752
jmp 0x6e87
movsd (%rsp), %xmm0
leaq 0x38d6(%rip), %rdx      # 0xa75d
movq %r14, %rdi
movl %ebx, %esi
movb $0x1, %al
callq 0x6798
addq $0x20, %rsp
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O1/canboat[P]canboat/n2kd/nmea0183.c
// Function: nmea0183WindData
static void nmea0183WindData(StringBuffer *msg183, int src, const char *msg)
{
  double  speed;
  double  angle;
  int64_t reference;

  if (getJSONNumber(msg, "Wind Speed", &speed, U_VELOCITY) && getJSONNumber(msg, "Wind Angle", &angle, U_ANGLE)
      && getJSONInt64(msg, "Reference", &reference))
  {
    if (reference == 3)
    {
      nmea0183CreateMessage(msg183, src, "MWV,%.1f,T,%.1f,K,A", angle, SPEED_M_S_TO_KMH(speed));
    }
    else if (reference == 2)
    {
      nmea0183CreateMessage(msg183, src, "MWV,%.1f,R,%.1f,K,A", angle, SPEED_M_S_TO_KMH(speed));
    }
  }
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x20, %rsp
movq %rdx, %r15
movl %esi, %ebx
movq %rdi, %r14
leaq 0x38b3(%rip), %rsi      # 0xa768
leaq 0x10(%rsp), %rdx
movq %r15, %rdi
movl $0x2, %ecx
callq 0x72ad
testb %al, %al
je 0x6f56
leaq 0x389d(%rip), %rsi      # 0xa773
leaq 0x8(%rsp), %rdx
movq %r15, %rdi
xorl %ecx, %ecx
callq 0x72ad
testb %al, %al
je 0x6f56
leaq 0x382b(%rip), %rsi      # 0xa71b
leaq 0x18(%rsp), %rdx
movq %r15, %rdi
callq 0x807c
testb %al, %al
je 0x6f56
movq 0x18(%rsp), %rax
cmpq $0x2, %rax
je 0x6f2f
cmpq $0x3, %rax
jne 0x6f56
movsd 0x8(%rsp), %xmm0
movsd 0x10(%rsp), %xmm1
mulsd 0x313a(%rip), %xmm1     # 0xa060
leaq 0x3851(%rip), %rdx      # 0xa77e
jmp 0x6f4a
movsd 0x8(%rsp), %xmm0
movsd 0x10(%rsp), %xmm1
mulsd 0x311d(%rip), %xmm1     # 0xa060
leaq 0x3848(%rip), %rdx      # 0xa792
movq %r14, %rdi
movl %ebx, %esi
movb $0x2, %al
callq 0x6798
addq $0x20, %rsp
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O1/canboat[P]canboat/n2kd/nmea0183.c
// Function: nmea0183WaterDepth
static void nmea0183WaterDepth(StringBuffer *msg183, int src, const char *msg)
{
  double depth;
  double offset;

  if (getJSONNumber(msg, "Depth", &depth, U_DISTANCE))
  {
    if (getJSONNumber(msg, "Offset", &offset, U_DISTANCE))
    {
      nmea0183CreateMessage(msg183, src, "DPT,%.1f,%.1f", depth, offset);
    }
    else
    {
      nmea0183CreateMessage(msg183, src, "DPT,%.1f,", depth);
    }
  }
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x10, %rsp
movq %rdx, %r15
movl %esi, %ebx
movq %rdi, %r14
leaq 0x382e(%rip), %rsi      # 0xa7a6
leaq 0x8(%rsp), %rdx
movq %r15, %rdi
movl $0x3, %ecx
callq 0x72ad
testb %al, %al
je 0x6fd0
leaq 0x3817(%rip), %rsi      # 0xa7ac
movq %rsp, %rdx
movq %r15, %rdi
movl $0x3, %ecx
callq 0x72ad
movsd 0x8(%rsp), %xmm0
testb %al, %al
je 0x6fda
movsd (%rsp), %xmm1
leaq 0x37f8(%rip), %rdx      # 0xa7b3
movq %r14, %rdi
movl %ebx, %esi
movb $0x2, %al
addq $0x10, %rsp
popq %rbx
popq %r14
popq %r15
jmp 0x6798
addq $0x10, %rsp
popq %rbx
popq %r14
popq %r15
retq
leaq 0x37e0(%rip), %rdx      # 0xa7c1
movq %r14, %rdi
movl %ebx, %esi
movb $0x1, %al
addq $0x10, %rsp
popq %rbx
popq %r14
popq %r15
jmp 0x6798
// File: /workspace/github_c_makefile_star2_O1/canboat[P]canboat/n2kd/nmea0183.c
// Function: nmea0183SystemTime
static void nmea0183SystemTime(StringBuffer *msg183, int src, const char *msg)
{
  char         dateString[20];
  char         timeString[20];
  char         second[10];
  unsigned int year, month, day, hour, minute;

  if (getJSONValue(msg, "Date", dateString, sizeof(dateString)) && getJSONValue(msg, "Time", timeString, sizeof(timeString))
      && sscanf(dateString, "%u.%u.%u", &year, &month, &day) == 3 && sscanf(timeString, "%u:%u:%9s", &hour, &minute, second) == 3)
  {
    nmea0183CreateMessage(msg183, src, "ZDA,%02u%02u%s,%u,%u,%04u,,", hour, minute, second, day, month, year);
  }
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x60, %rsp
movq %rdx, %r15
movl %esi, %ebx
movq %rdi, %r14
leaq 0x3052(%rip), %rsi      # 0xa231
leaq 0x40(%rsp), %rdx
movl $0x14, %ecx
movq %r15, %rdi
callq 0x7c81
testb %al, %al
je 0x72a3
leaq 0x303a(%rip), %rsi      # 0xa23a
leaq 0x20(%rsp), %rdx
movl $0x14, %ecx
movq %r15, %rdi
callq 0x7c81
testb %al, %al
je 0x72a3
leaq 0x3634(%rip), %rsi      # 0xa855
leaq 0x40(%rsp), %rdi
leaq 0x10(%rsp), %rdx
leaq 0xc(%rsp), %rcx
leaq 0x8(%rsp), %r8
xorl %eax, %eax
callq 0x2240
cmpl $0x3, %eax
jne 0x72a3
leaq 0x3616(%rip), %rsi      # 0xa85e
leaq 0x20(%rsp), %rdi
leaq 0x4(%rsp), %rdx
movq %rsp, %rcx
leaq 0x16(%rsp), %r8
xorl %eax, %eax
callq 0x2240
cmpl $0x3, %eax
jne 0x72a3
movl 0x4(%rsp), %ecx
movl (%rsp), %r8d
movl 0x8(%rsp), %r10d
movl 0xc(%rsp), %r11d
movl 0x10(%rsp), %r15d
subq $0x8, %rsp
leaq 0x35e0(%rip), %rdx      # 0xa868
leaq 0x1e(%rsp), %r9
movq %r14, %rdi
movl %ebx, %esi
xorl %eax, %eax
pushq %r15
pushq %r11
pushq %r10
callq 0x6798
addq $0x20, %rsp
addq $0x60, %rsp
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O1/canboat[P]canboat/n2kd/nmea0183.c
// Function: getJSONNumber
bool getJSONNumber(const char *message, const char *fieldName, double *value, Unit unit)
{
  char valueStr[16];

  // List of conversion values for each unit. When analyser produces SI convert it to 'human standard'.
  static const double UNIT_CONVERSION[U_MAX][2] = {{1, RadianToDegree}, {1, RadianToDegree}, {1, 1}, {1, 1}, {1, 1}, {1, 1}};
  static const double UNIT_OFFSET[U_MAX][2]     = {{0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, -273.15}, {0, 0}};

  if (getJSONValue(message, fieldName, valueStr, sizeof valueStr))
  {
    *value = strtod(valueStr, 0) * UNIT_CONVERSION[unit][unitSI] + UNIT_OFFSET[unit][unitSI];
    return true;
  }
  *value = nan("");
  return false;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
subq $0x10, %rsp
movl %ecx, %r14d
movq %rdx, %rbx
movq %rsp, %rdx
movl $0x10, %ecx
callq 0x7c81
movl %eax, %ebp
testb %al, %al
je 0x730c
movq %rsp, %rdi
xorl %esi, %esi
callq 0x20a0
movl %r14d, %eax
leaq 0x7086(%rip), %rcx      # 0xe368
movzbl (%rcx), %ecx
shlq $0x4, %rax
leaq 0x35a0(%rip), %rdx      # 0xa890
addq %rax, %rdx
shll $0x3, %ecx
leaq 0x35f3(%rip), %rsi      # 0xa8f0
addq %rax, %rsi
mulsd (%rcx,%rdx), %xmm0
addsd (%rcx,%rsi), %xmm0
jmp 0x7318
leaq 0x253c(%rip), %rdi      # 0x984f
callq 0x2330
movsd %xmm0, (%rbx)
movl %ebp, %eax
addq $0x10, %rsp
popq %rbx
popq %r14
popq %rbp
retq
nop
// File: /workspace/github_c_makefile_star2_O1/openshmem-org[P]openshmem-examples/c/bcast2.c
// Function: main
int
main(void)
{
    int i;
    long *target;
    static long source[8] = { 1, 2, 3, 4, 5, 6, 7, 8 };
    int nlong = 8;
    int me, npes;

    shmem_init();
    me = shmem_my_pe();
    npes = shmem_n_pes();

    target = (long *) shmem_malloc(8 * sizeof(*target));

    for (i = 0; i < SHMEM_BCAST_SYNC_SIZE; i += 1) {
        pSync[i] = SHMEM_SYNC_VALUE;
    }
    shmem_barrier_all();

    shmem_broadcast64(target, source, nlong, 0, 0, 0, npes, pSync);

    if (me != 0) {
        int i;
        for (i = 0; i < 8; i++) {
            printf("%d: target[%d] = %ld\n", me, i, target[i]);
        }
    }

    shmem_free(target);

    shmem_finalize();

    return 0;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
callq 0x1090
callq 0x1060
movl %eax, %ebx
callq 0x1040
movl %eax, %r15d
movl $0x40, %edi
callq 0x1070
movq %rax, %r14
pcmpeqd %xmm0, %xmm0
movdqa %xmm0, 0x2ecf(%rip)     # 0x40c0
leaq 0x2ec8(%rip), %r12      # 0x40c0
callq 0x1080
leaq 0x2e6c(%rip), %rsi      # 0x4070
movl $0x8, %edx
movq %r14, %rdi
xorl %ecx, %ecx
xorl %r8d, %r8d
xorl %r9d, %r9d
pushq %r12
pushq %r15
callq 0x10b0
addq $0x10, %rsp
testl %ebx, %ebx
je 0x124b
leaq 0xdd8(%rip), %r15       # 0x2004
xorl %r12d, %r12d
movq (%r14,%r12,8), %rcx
movq %r15, %rdi
movl %ebx, %esi
movl %r12d, %edx
xorl %eax, %eax
callq 0x1030
incq %r12
cmpq $0x8, %r12
jne 0x122f
movq %r14, %rdi
callq 0x10a0
callq 0x1050
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O1/dasJ[P]sd-zfs/src/mount.initrd_zfs.c
// Function: handleBootfs
int handleBootfs(char **pool) {
	char *rpool = NULL;
	int ret = 1;

	// Handle rpool
	if (strncmp(*pool, "ZFS=AUTO:", strlen("ZFS=AUTO:")) == 0) {
		rpool = malloc((strlen(*pool) - strlen("ZFS=AUTO:") + 1) * sizeof(char));
		strcpy(rpool, &((*pool)[strlen("ZFS=AUTO:")]));
	}

	ret = zfs_get_bootfs(rpool, pool);
	free(rpool);
	return ret;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq (%rdi), %r14
leaq 0xa1755(%rip), %rsi     # 0x4a3004
movl $0x9, %edx
movq %r14, %rdi
callq 0x401080
testl %eax, %eax
je 0x4018c5
xorl %r15d, %r15d
jmp 0x4018e8
movq %r14, %rdi
callq 0x4010e0
leaq -0x8(%rax), %rdi
callq 0x420f00
movq %rax, %r15
addq $0x9, %r14
movq %rax, %rdi
movq %r14, %rsi
callq 0x401020
movq %r15, %rdi
movq %rbx, %rsi
callq 0x4023b1
movl %eax, %ebx
movq %r15, %rdi
callq 0x421240
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/dasJ[P]sd-zfs/src/zfs-util.c
// Function: zfs_destroy_recursively
int zfs_destroy_recursively(char *dataset) {
	char *lines = NULL;
	char *token;

	// Execute command
	char *cmdline[] = { ZFS_CMD, "list", "-tfilesystem", "-Hro", "name", "-Sname", dataset, NULL };
	executeZfs(1, &lines, cmdline);
	if (lines == NULL) {
		return 0;
	}
	// Destoy all datasets
	token = strtok(lines, "\n");
	do {
		if (zfs_destroy(token) != 0) {
			fprintf(stderr, "Not destroying any more datasets\n");
			free(lines);
			return -2;
		}
	} while ((token = strtok(NULL, "\n")) != NULL);

	free(lines);
	return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x48, %rsp
xorl %ebx, %ebx
leaq -0x20(%rbp), %r14
movq %rbx, (%r14)
leaq 0xa1095(%rip), %rax     # 0x4a3208
leaq -0x60(%rbp), %rcx
movq %rax, (%rcx)
leaq 0xa3c18(%rip), %rax     # 0x4a5d99
movq %rax, 0x8(%rcx)
leaq 0xa109e(%rip), %rax     # 0x4a322a
movq %rax, 0x10(%rcx)
leaq 0xa10a0(%rip), %rax     # 0x4a3237
movq %rax, 0x18(%rcx)
leaq 0xa109c(%rip), %rax     # 0x4a323e
movq %rax, 0x20(%rcx)
leaq 0xa108f(%rip), %rax     # 0x4a323c
movq %rax, 0x28(%rcx)
movq %rdi, 0x30(%rcx)
movq %rbx, 0x38(%rcx)
leaq 0xa103f(%rip), %rdi     # 0x4a31ff
movl $0x1, %esi
movq %r14, %rdx
callq 0x401f40
movq (%r14), %r14
testq %r14, %r14
je 0x40220c
leaq 0xa16ce(%rip), %r15     # 0x4a38aa
movq %r14, %rdi
movq %r15, %rsi
callq 0x424120
movq %rax, %rdi
callq 0x402225
testl %eax, %eax
jne 0x402219
xorl %ebx, %ebx
xorl %edi, %edi
movq %r15, %rsi
callq 0x424120
testq %rax, %rax
jne 0x4021e7
movq %r14, %rdi
callq 0x421240
movl %ebx, %eax
addq $0x48, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
callq 0x4012ee
movl $0xfffffffe, %ebx       # imm = 0xFFFFFFFE
jmp 0x402204
// File: /workspace/github_c_makefile_star2_O1/dasJ[P]sd-zfs/src/zfs-util.c
// Function: zfs_destroy
int zfs_destroy(char *dataset) {
	int status;
	char *cmdline[] = { ZFS_CMD, "destroy", dataset, NULL };

	status = executeZfs(0, NULL, cmdline);
	if (status != 0) {
		fprintf(stderr, "ZFS returned error %d\n", status);
	}
	return status;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
subq $0x28, %rsp
leaq 0xa0fd3(%rip), %rax     # 0x4a3208
leaq -0x30(%rbp), %rcx
movq %rax, (%rcx)
leaq 0xa1022(%rip), %rax     # 0x4a3265
movq %rax, 0x8(%rcx)
movq %rdi, 0x10(%rcx)
movq $0x0, 0x18(%rcx)
leaq 0xa0fa5(%rip), %rdi     # 0x4a31ff
xorl %esi, %esi
xorl %edx, %edx
callq 0x401f40
movl %eax, %ebx
testl %eax, %eax
jne 0x402272
movl %ebx, %eax
addq $0x28, %rsp
popq %rbx
popq %rbp
retq
movq $0x4d3708, %rax         # imm = 0x4D3708
movq (%rax), %rdi
leaq 0xa0fea(%rip), %rsi     # 0x4a326d
movl %ebx, %edx
xorl %eax, %eax
callq 0x40c8b0
jmp 0x402269
// File: /workspace/github_c_makefile_star2_O1/dasJ[P]sd-zfs/src/zfs-util.c
// Function: zfs_snapshot_exists
int zfs_snapshot_exists(char *dataset, char *snapshot) {
	int status;
	char *toCheck;

	toCheck = malloc((strlen(dataset) + strlen(snapshot) + 2) * sizeof(char));
	strcpy(toCheck, dataset);
	strcat(toCheck, "@");
	strcat(toCheck, snapshot);
	
	status = zfs_ds_exists(toCheck);
	free(toCheck);
	return status;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x38, %rsp
movq %rsi, %r14
movq %rdi, %r15
callq 0x4010e0
movq %rax, %rbx
movq %r14, %rdi
callq 0x4010e0
leaq (%rbx,%rax), %rdi
addq $0x2, %rdi
callq 0x420f00
movq %rax, %rbx
movq %rax, %rdi
movq %r15, %rsi
callq 0x401020
movq %rbx, %rdi
callq 0x4010e0
movw $0x40, (%rbx,%rax)
movq %rbx, %rdi
movq %r14, %rsi
callq 0x401058
leaq 0xa0f1c(%rip), %rax     # 0x4a3208
leaq -0x50(%rbp), %rcx
movq %rax, (%rcx)
leaq 0xa0f8a(%rip), %rax     # 0x4a3284
movq %rax, 0x8(%rcx)
leaq 0xa0f83(%rip), %rax     # 0x4a3288
movq %rax, 0x10(%rcx)
leaq 0xa2430(%rip), %rax     # 0x4a4740
movq %rax, 0x18(%rcx)
movq %rbx, 0x20(%rcx)
movq $0x0, 0x28(%rcx)
leaq 0xa0ed8(%rip), %rdi     # 0x4a31ff
xorl %esi, %esi
xorl %edx, %edx
callq 0x401f40
xorl %r14d, %r14d
testl %eax, %eax
setne %r14b
movq %rbx, %rdi
callq 0x421240
movl %r14d, %eax
addq $0x38, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/dasJ[P]sd-zfs/src/zfs-util.c
// Function: zfs_ds_exists
int zfs_ds_exists(char *dataset) {
	int status;
	char *cmdline[] = { ZFS_CMD, "get", "-H", "type", dataset, NULL };

	status = executeZfs(0, NULL, cmdline);

	if (status == 0) {
		return 0;
	} else {
		return 1;
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
leaq 0xa0eaa(%rip), %rax     # 0x4a3208
leaq -0x30(%rbp), %rcx
movq %rax, (%rcx)
leaq 0xa0f18(%rip), %rax     # 0x4a3284
movq %rax, 0x8(%rcx)
leaq 0xa0f11(%rip), %rax     # 0x4a3288
movq %rax, 0x10(%rcx)
leaq 0xa23be(%rip), %rax     # 0x4a4740
movq %rax, 0x18(%rcx)
movq %rdi, 0x20(%rcx)
movq $0x0, 0x28(%rcx)
leaq 0xa0e66(%rip), %rdi     # 0x4a31ff
xorl %esi, %esi
xorl %edx, %edx
callq 0x401f40
xorl %ecx, %ecx
testl %eax, %eax
setne %cl
movl %ecx, %eax
addq $0x30, %rsp
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/dasJ[P]sd-zfs/src/zfs-util.c
// Function: zfs_get_bootfs
int zfs_get_bootfs(char *rpool, char **bootfs) {
	int status;
	char **cmdline;
	char *tok;
	char *line = NULL;

	if (rpool == NULL) {
		cmdline = (char*[]) { ZPOOL_CMD, "list", "-Ho", "bootfs", NULL };
	} else {
		cmdline = (char*[]) { ZPOOL_CMD, "list", "-Ho", "bootfs", rpool, NULL };
	}

	*bootfs = NULL;

	status = executeZpool(1, &line, cmdline);

	if (status != 0) {
		fprintf(stderr, "zpool get returned %d\n", status);
		return status;
	}
	status = 1;

	tok = strtok(line, "\n");
	while (tok != NULL) {
		if (strcmp(tok, "-") != 0) {
			*bootfs = malloc((strlen(tok) + 1) * sizeof(char));
			strcpy(*bootfs, tok);
			status = 0;
			break;
		}
		tok = strtok(NULL, "\n");
	}
	free(line);
	return status;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x68, %rsp
movq %rsi, %r13
movq $0x0, -0x30(%rbp)
testq %rdi, %rdi
je 0x402412
leaq 0xa0e3c(%rip), %rax     # 0x4a3215
leaq -0x90(%rbp), %rcx
movq %rax, (%rcx)
leaq 0xa39af(%rip), %rax     # 0x4a5d99
movq %rax, 0x8(%rcx)
leaq 0xa0e96(%rip), %rax     # 0x4a328b
movq %rax, 0x10(%rcx)
leaq 0xa0e8f(%rip), %rax     # 0x4a328f
movq %rax, 0x18(%rcx)
movq %rdi, 0x20(%rcx)
movq $0x0, 0x28(%rcx)
jmp 0x402436
movq 0xcf59f(%rip), %rax     # 0x4d19b8
leaq -0x60(%rbp), %rcx
movq %rax, 0x20(%rcx)
movups 0xcf580(%rip), %xmm0    # 0x4d19a8
movaps %xmm0, 0x10(%rcx)
movups 0xcf565(%rip), %xmm0    # 0x4d1998
movaps %xmm0, (%rcx)
movq $0x0, (%r13)
leaq 0xa0dc7(%rip), %rdi     # 0x4a320c
movl $0x1, %r14d
leaq -0x30(%rbp), %rdx
movl $0x1, %esi
callq 0x401f40
testl %eax, %eax
jne 0x4024f1
movq -0x30(%rbp), %r15
leaq 0xa143e(%rip), %rsi     # 0x4a38aa
movq %r15, %rdi
callq 0x424120
testq %rax, %rax
je 0x4024d7
movq %rax, %r12
movq %r13, -0x38(%rbp)
leaq 0xa6843(%rip), %r13     # 0x4a8cca
leaq 0xa141c(%rip), %rbx     # 0x4a38aa
movq %r12, %rdi
movq %r13, %rsi
callq 0x4010b8
testl %eax, %eax
jne 0x4024b1
xorl %edi, %edi
movq %rbx, %rsi
callq 0x424120
movq %rax, %r12
testq %rax, %rax
jne 0x40248e
jmp 0x4024d7
movq %r12, %rdi
callq 0x4010e0
leaq 0x1(%rax), %rdi
callq 0x420f00
movq -0x38(%rbp), %rcx
movq %rax, (%rcx)
movq %rax, %rdi
movq %r12, %rsi
callq 0x401020
xorl %r14d, %r14d
movq %r15, %rdi
callq 0x421240
movl %r14d, %eax
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl %eax, %ebx
movq $0x4d3708, %rax         # imm = 0x4D3708
movq (%rax), %rdi
leaq 0xa0d92(%rip), %rsi     # 0x4a3296
movl %ebx, %edx
xorl %eax, %eax
callq 0x40c8b0
movl %ebx, %r14d
jmp 0x4024df
// File: /workspace/github_c_makefile_star2_O1/dasJ[P]sd-zfs/src/zfs-util.c
// Function: zfs_list_datasets_with_mp
int zfs_list_datasets_with_mp(char *dataset, char **datasets) {
	int status;
	char *cmdline[] = { ZFS_CMD, "list", "-r", dataset, "-t", "filesystem", "-Ho", "name,mountpoint", NULL };

	*datasets = NULL;

	status = executeZfs(1, datasets, cmdline);

	if (status != 0) {
		fprintf(stderr, "zfs returned %d\n", status);
	}
	return status;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
subq $0x48, %rsp
movq %rsi, %rdx
leaq 0xa0ce3(%rip), %rax     # 0x4a3208
leaq -0x50(%rbp), %rcx
movq %rax, (%rcx)
leaq 0xa3866(%rip), %rax     # 0x4a5d99
movq %rax, 0x8(%rcx)
leaq 0xa0d6f(%rip), %rax     # 0x4a32ad
movq %rax, 0x10(%rcx)
movq %rdi, 0x18(%rcx)
leaq 0xa0d63(%rip), %rax     # 0x4a32b0
movq %rax, 0x20(%rcx)
leaq 0xa0cd4(%rip), %rax     # 0x4a322c
movq %rax, 0x28(%rcx)
leaq 0xa0d28(%rip), %rax     # 0x4a328b
movq %rax, 0x30(%rcx)
leaq 0xa0d45(%rip), %rax     # 0x4a32b3
movq %rax, 0x38(%rcx)
xorl %eax, %eax
movq %rax, 0x40(%rcx)
movq %rax, (%rsi)
leaq 0xa0c7d(%rip), %rdi     # 0x4a31ff
movl $0x1, %esi
callq 0x401f40
movl %eax, %ebx
testl %eax, %eax
jne 0x40259b
movl %ebx, %eax
addq $0x48, %rsp
popq %rbx
popq %rbp
retq
movq $0x4d3708, %rax         # imm = 0x4D3708
movq (%rax), %rdi
leaq 0xa0d17(%rip), %rsi     # 0x4a32c3
movl %ebx, %edx
xorl %eax, %eax
callq 0x40c8b0
jmp 0x402592
// File: /workspace/github_c_makefile_star2_O1/dasJ[P]sd-zfs/src/zfs-util.c
// Function: zfs_list_snapshots
int zfs_list_snapshots(char *dataset, char *snapshot, char **output) {
	int status;
	char *snaps = NULL;
	char *cmdline[] = { ZFS_CMD, "list", "-Ho", "name", "-tsnapshot", "-r", dataset, NULL };
	char *suffix;
	char *tok;

	status = executeZfs(1, &snaps, cmdline);
	if (status != 0) {
		fprintf(stderr, "zfs returned %d\n", status);
		return status;
	}
	// Filter
	suffix = malloc((strlen(snapshot) + 2) * sizeof(char));
	strcpy(suffix, "@");
	strcat(suffix, snapshot);

	*output = malloc(sizeof(char));
	strcpy(*output, "");

	tok = strtok(snaps, "\n");
	while (tok != NULL) {
		if (strlen(tok) < strlen(suffix)) {
			continue;
		}
		if (strncmp(tok + strlen(tok) - strlen(suffix), suffix, strlen(suffix)) == 0) {
			*output = realloc(*output, strlen(*output) + strlen(tok) + 2);
			strcat(*output, tok);
			strcat(*output, "\n");
		}
		tok = strtok(NULL, "\n");
	}
	free(suffix);
	free(snaps);
	return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x68, %rsp
movq %rdx, %rbx
movq %rsi, %r15
xorl %eax, %eax
leaq -0x48(%rbp), %rdx
movq %rax, (%rdx)
leaq 0xa0c2a(%rip), %rsi     # 0x4a3208
leaq -0x90(%rbp), %rcx
movq %rsi, (%rcx)
leaq 0xa37aa(%rip), %rsi     # 0x4a5d99
movq %rsi, 0x8(%rcx)
leaq 0xa0c91(%rip), %rsi     # 0x4a328b
movq %rsi, 0x10(%rcx)
leaq 0xa0c39(%rip), %rsi     # 0x4a323e
movq %rsi, 0x18(%rcx)
leaq 0xa0cc4(%rip), %rsi     # 0x4a32d4
movq %rsi, 0x20(%rcx)
leaq 0xa0c92(%rip), %rsi     # 0x4a32ad
movq %rsi, 0x28(%rcx)
movq %rdi, 0x30(%rcx)
movq %rax, 0x38(%rcx)
leaq 0xa0bd1(%rip), %rdi     # 0x4a31ff
movl $0x1, %esi
callq 0x401f40
testl %eax, %eax
jne 0x402756
movq %r15, %rdi
callq 0x4010e0
leaq 0x2(%rax), %rdi
callq 0x420f00
movq %rax, %r14
movw $0x40, (%rax)
movq %rax, %rdi
movq %r15, %rsi
callq 0x401058
movl $0x1, %edi
callq 0x420f00
movq %rbx, -0x40(%rbp)
movq %rax, (%rbx)
movb $0x0, (%rax)
movq -0x48(%rbp), %rdi
leaq 0xa1227(%rip), %rsi     # 0x4a38aa
movq %rdi, -0x30(%rbp)
callq 0x424120
testq %rax, %rax
je 0x40272e
movq %rax, %r13
leaq 0xa120b(%rip), %rbx     # 0x4a38aa
movq %r14, -0x38(%rbp)
movq %r13, %rdi
callq 0x4010e0
movq %rax, %r15
movq %r14, %rdi
callq 0x4010e0
cmpq %rax, %r15
jb 0x402754
leaq (%r15,%r13), %rdi
subq %rax, %rdi
movq %r14, %rsi
movq %rax, %rdx
callq 0x401080
testl %eax, %eax
jne 0x402718
movq -0x40(%rbp), %r14
movq (%r14), %r12
movq %r12, %rdi
callq 0x4010e0
leaq (%r15,%rax), %rsi
addq $0x2, %rsi
movq %r12, %rdi
callq 0x421590
movq %rax, %r15
movq %rax, (%r14)
movq -0x38(%rbp), %r14
movq %rax, %rdi
movq %r13, %rsi
callq 0x401058
movq %r15, %rdi
callq 0x4010e0
movw $0xa, (%r15,%rax)
xorl %edi, %edi
movq %rbx, %rsi
callq 0x424120
movq %rax, %r13
testq %rax, %rax
jne 0x4026a3
movq %r14, %rdi
callq 0x421240
movq -0x30(%rbp), %rdi
callq 0x421240
xorl %r14d, %r14d
movl %r14d, %eax
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x402754
movl %eax, %r14d
movq $0x4d3708, %rax         # imm = 0x4D3708
movq (%rax), %rdi
leaq 0xa0b59(%rip), %rsi     # 0x4a32c3
movl %r14d, %edx
xorl %eax, %eax
callq 0x40c8b0
jmp 0x402742
// File: /workspace/github_c_makefile_star2_O1/dasJ[P]sd-zfs/src/zfs-util.c
// Function: zfs_mount
int zfs_mount(char *what, char *where, char *options) {
	char **cmdline;

	if (options == NULL) {
		cmdline = (char*[]) { MOUNT_CMD, "-t", "zfs", what, where, NULL };
	} else {
		cmdline = (char*[]) { MOUNT_CMD, "-t", "zfs", "-o", options, what, where, NULL };
	}

	return executeMount(0, NULL, cmdline);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x70, %rsp
leaq 0xa0a9f(%rip), %rax     # 0x4a3224
testq %rdx, %rdx
je 0x4027c4
leaq -0x70(%rbp), %rcx
movq %rax, (%rcx)
leaq 0xa0b18(%rip), %rax     # 0x4a32b0
movq %rax, 0x8(%rcx)
leaq 0xa0a65(%rip), %rax     # 0x4a3208
movq %rax, 0x10(%rcx)
leaq 0xa0899(%rip), %rax     # 0x4a3047
movq %rax, 0x18(%rcx)
movq %rdx, 0x20(%rcx)
movq %rdi, 0x28(%rcx)
movq %rsi, 0x30(%rcx)
leaq -0x38(%rbp), %rax
jmp 0x4027ed
leaq -0x30(%rbp), %rcx
movq %rax, (%rcx)
leaq 0xa0ade(%rip), %rax     # 0x4a32b0
movq %rax, 0x8(%rcx)
leaq 0xa0a2b(%rip), %rax     # 0x4a3208
movq %rax, 0x10(%rcx)
movq %rdi, 0x18(%rcx)
movq %rsi, 0x20(%rcx)
leaq -0x8(%rbp), %rax
movq $0x0, (%rax)
leaq 0xa0a20(%rip), %rdi     # 0x4a321b
xorl %esi, %esi
xorl %edx, %edx
callq 0x401f40
addq $0x70, %rsp
popq %rbp
retq