LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_c_makefile_star2_O2/canboat[P]canboat/nmea0183/../common/common.c
// Function: sbAppendDecodeHex
void sbAppendDecodeHex(StringBuffer *sb, const char *data, size_t len)
{
  uint8_t  nibble1;
  uint8_t  nibble2;
  uint8_t *d;

  sbEnsureCapacity(sb, len / 2 + 1 + sbGetLength(sb));
  d = (uint8_t *) sbGet(sb) + sbGetLength(sb);

  while (len >= 2)
  {
    nibble1 = (*data >= 'a') ? (*data - 'a' + 10) : (*data >= 'A' ? (*data - 'A' + 10) : (*data - '0'));
    data++;
    nibble2 = (*data >= 'a') ? (*data - 'a' + 10) : (*data >= 'A' ? (*data - 'A' + 10) : (*data - '0'));
    data++;
    *d++ = nibble1 << 4 | nibble2;
    len -= 2;
  }

  sb->len = d - (uint8_t *) sbGet(sb);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rdx, %r14
movq %rsi, %r15
movq %rdi, %rbx
movq %rdx, %rax
shrq %rax
movq 0x8(%rdi), %rcx
leaq (%rax,%rcx), %rsi
incq %rsi
callq 0x2ac3
movq (%rbx), %rcx
testq %rcx, %rcx
leaq 0x162c(%rip), %rax      # 0x438d
cmoveq %rax, %rcx
addq 0x8(%rbx), %rcx
movq %rcx, %rdx
negq %rdx
pushq $0x9
popq %rsi
pushq $0x40
popq %rdi
movl $0xa9, %r8d
cmpq $0x2, %r14
jb 0x2dcc
movb (%r15), %r9b
movl %esi, %ebp
cmpb $0x41, %r9b
jge 0x2d8e
movl %edi, %ebp
movb 0x1(%r15), %r11b
movl $0xc9, %r10d
cmpb $0x41, %r11b
jge 0x2da4
movl $0xd0, %r10d
addb %bpl, %r9b
cmpb $0x61, %r11b
cmovgel %r8d, %r10d
addb %r11b, %r10b
shlb $0x4, %r9b
orb %r10b, %r9b
movb %r9b, (%rcx)
incq %rcx
addq $-0x2, %r14
decq %rdx
addq $0x2, %r15
jmp 0x2d7b
movq (%rbx), %rcx
testq %rcx, %rcx
cmovneq %rcx, %rax
addq %rdx, %rax
negq %rax
movq %rax, 0x8(%rbx)
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/canboat[P]canboat/nmea0183/../common/common.c
// Function: sbAppendFormatV
void sbAppendFormatV(StringBuffer *const sb, const char *const format, va_list ap)
{
  int     n;
  size_t  len;
  va_list ap2;

  len = 128;

  while (len < 4 * 1024 * 1024)
  {
    sbEnsureCapacity(sb, sb->len + len);

    va_copy(ap2, ap);
    n = vsnprintf(sb->data + sb->len, len, format, ap2);
    va_end(ap2);
    /*
     * Platform returned not an error, and the number of bytes was less
     * than the size of the buffer -> we're done
     * Note that some implementations (tru64) nicely guarantee zero terminated strings,
     * so we test for len - 1, not len.
     */
    if (n > -1 && (size_t) n < len - 1)
    {
      sb->len += n;
      sbTerminate(sb);
      break;
    }

    /*
     * Otherwise, increase the buffer smartly
     */

    if (n == -1)
    {
      len *= 2;
    }
    else
    {
      len = n + 2;
    }
  }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rdx, %r14
movq %rsi, %r15
movq %rdi, %rbx
movl $0x80, %r12d
movq %rsp, %r13
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
cmpq $0x3fffff, %r12         # imm = 0x3FFFFF
ja 0x2eca
movq 0x8(%rbx), %rsi
addq %r12, %rsi
movq %rbx, %rdi
callq 0x2ac3
movq 0x10(%r14), %rax
movq %rax, 0x10(%rsp)
movups (%r14), %xmm0
movaps %xmm0, (%rsp)
movq (%rbx), %rdi
addq 0x8(%rbx), %rdi
movq %r12, %rsi
movq %r15, %rdx
movq %r13, %rcx
callq 0x2090
testl %eax, %eax
setns %cl
movl %eax, %eax
leaq -0x1(%r12), %rdx
cmpq %rax, %rdx
seta %dl
andb %cl, %dl
cmpb $0x1, %dl
je 0x2eb6
addq %r12, %r12
leal 0x2(%rax), %ecx
cmpq %rbp, %rax
movslq %ecx, %rax
cmovneq %rax, %r12
jmp 0x2e4d
addq 0x8(%rbx), %rax
movq %rax, 0x8(%rbx)
movq (%rbx), %rcx
testq %rcx, %rcx
je 0x2eca
movb $0x0, (%rcx,%rax)
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/canboat[P]canboat/nmea0183/../common/common.c
// Function: getJSONLookupList
static bool getJSONLookupList(const char *message, const char *fieldName, char *value, size_t len)
{
  const char *loc      = message + 1;
  size_t      fieldLen = strlen(fieldName);
  const char *end;

  for (;;)
  {
    loc = strstr(loc, fieldName);
    if (!loc)
    {
      return false;
    }
    if (loc[-1] == '"' && loc[fieldLen] == '"' && loc[fieldLen + 1] == ':')
    {
      break;
    }
    loc += fieldLen;
  }

  /* field has been found */
  loc += fieldLen + 2;

  while (isspace((unsigned char) *loc))
  {
    loc++;
  }

  if (strncmp(loc, "null", 4) == 0)
  {
    return false;
  }

  end = strchr(loc, '}');

  if (*loc != '{' || end == NULL)
  {
    logError("Cannot extract lookup for field '%s': it is not a -nv style lookup\n%s\n", fieldName, loc);
    return false;
  }
  end++;
  len--;
  if (end - loc < len)
  {
    len = end - loc;
  }
  memcpy(value, loc, len);
  value[len] = '\0';

  return true;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rcx, %r14
movq %rdx, %rbx
movq %rsi, %r15
movq %rdi, %rbp
incq %rbp
movq %rsi, %rdi
callq 0x20b0
movq %rax, %r12
movq %rbp, %rdi
movq %r15, %rsi
callq 0x2280
testq %rax, %rax
je 0x3287
movq %rax, %rbp
cmpb $0x22, -0x1(%rax)
jne 0x320b
cmpb $0x22, (%rbp,%r12)
jne 0x320b
cmpb $0x3a, 0x1(%rbp,%r12)
je 0x3210
addq %r12, %rbp
jmp 0x31de
movq %rbx, (%rsp)
callq 0x2290
movq (%rax), %rax
leaq (%r12,%rbp), %r13
incq %r13
addq %rbp, %r12
movzbl 0x1(%r13), %ebx
incq %r13
incq %r12
testb $0x20, 0x1(%rax,%rbx,2)
jne 0x3226
leaq 0x1289(%rip), %rsi      # 0x44c8
pushq $0x4
popq %rdx
movq %r13, %rdi
callq 0x2070
testl %eax, %eax
je 0x3287
pushq $0x7d
popq %rsi
movq %r13, %rdi
callq 0x20d0
movq %rax, %rbp
cmpb $0x7b, %bl
setne %al
testq %rbp, %rbp
sete %cl
orb %al, %cl
cmpb $0x1, %cl
jne 0x329a
leaq 0x13e1(%rip), %rdi      # 0x4657
xorl %ebx, %ebx
movq %r15, %rsi
movq %r13, %rdx
xorl %eax, %eax
callq 0x28cd
jmp 0x3289
xorl %ebx, %ebx
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
decq %r14
subq %r12, %rbp
cmpq %r14, %rbp
cmovaeq %r14, %rbp
movq (%rsp), %rbx
movq %rbx, %rdi
movq %r13, %rsi
movq %rbp, %rdx
callq 0x2170
movb $0x0, (%rbx,%rbp)
movb $0x1, %bl
jmp 0x3289
// File: /workspace/github_c_makefile_star2_O2/canboat[P]canboat/nmea0183/../common/common.c
// Function: sbSearchChar
char *sbSearchChar(const StringBuffer *const in, char c)
{
  char  *p = sbGet(in);
  size_t i;

  for (i = 0; i < in->len; i++)
  {
    if (p[i] == c)
    {
      return p + i;
    }
  }
  return 0;
}

// Assembly:
movq (%rdi), %rdx
movq 0x8(%rdi), %rcx
testq %rdx, %rdx
leaq 0x1080(%rip), %rax      # 0x438d
cmovneq %rdx, %rax
subq $0x1, %rcx
jb 0x3321
cmpb %sil, (%rax)
je 0x3323
incq %rax
jmp 0x3311
xorl %eax, %eax
retq
// File: /workspace/github_c_makefile_star2_O2/canboat[P]canboat/nmea0183/../common/common.c
// Function: getISO11783BitsFromCanId
void getISO11783BitsFromCanId(unsigned int id, unsigned int *prio, unsigned int *pgn, unsigned int *src, unsigned int *dst)
{
  unsigned char PF  = (unsigned char) (id >> 16);
  unsigned char PS  = (unsigned char) (id >> 8);
  unsigned char RDP = (unsigned char) (id >> 24) & 3; // Use R + DP bits

  if (src)
  {
    *src = (unsigned char) id >> 0;
  }
  if (prio)
  {
    *prio = (unsigned char) ((id >> 26) & 0x7);
  }

  if (PF < 240)
  {
    /* PDU1 format, the PS contains the destination address */
    if (dst)
    {
      *dst = PS;
    }
    if (pgn)
    {
      *pgn = (RDP << 16) + (PF << 8);
    }
  }
  else
  {
    /* PDU2 format, the destination is implied global and the PGN is extended */
    if (dst)
    {
      *dst = 0xff;
    }
    if (pgn)
    {
      *pgn = (RDP << 16) + (PF << 8) + PS;
    }
  }
}

// Assembly:
testq %rcx, %rcx
je 0x332f
movzbl %dil, %eax
movl %eax, (%rcx)
movl %edi, %eax
shrl $0x10, %eax
testq %rsi, %rsi
je 0x3343
movl %edi, %ecx
shrl $0x1a, %ecx
andl $0x7, %ecx
movl %ecx, (%rsi)
movl %edi, %ecx
shrl $0x8, %ecx
shrl $0x18, %edi
movzbl %al, %eax
cmpl $0xef, %eax
ja 0x3372
testq %r8, %r8
je 0x3360
movzbl %cl, %ecx
movl %ecx, (%r8)
testq %rdx, %rdx
je 0x3395
andl $0x3, %edi
shll $0x10, %edi
shll $0x8, %eax
orl %edi, %eax
jmp 0x3393
testq %r8, %r8
je 0x337e
movl $0xff, (%r8)
testq %rdx, %rdx
je 0x3395
andl $0x3, %edi
shll $0x10, %edi
shll $0x8, %eax
orl %edi, %eax
movzbl %cl, %ecx
orl %ecx, %eax
movl %eax, (%rdx)
retq
// File: /workspace/github_c_makefile_star2_O2/canboat[P]canboat/nmea0183/../common/common.c
// Function: open_socket_stream
SOCKET open_socket_stream(const char *url)
{
  SOCKET          sockfd = INVALID_SOCKET;
  int             n;
  struct addrinfo hints, *res, *addr;
  char           *host;
  const char     *service;

  resolve_address(url, &host, &service);

  memset(&hints, 0, sizeof(hints));
  hints.ai_family   = AF_UNSPEC;
  hints.ai_socktype = SOCK_STREAM;

  n = getaddrinfo(host, service, &hints, &res);
  if (n != 0)
  {
    logError("Unable to open connection to %s:%s: %s\n", host, service, gai_strerror(n));
  }
  else
  {
    for (addr = res; addr; addr = addr->ai_next)
    {
      sockfd = socket(addr->ai_family, addr->ai_socktype, addr->ai_protocol);
      if (sockfd == INVALID_SOCKET)
      {
        continue;
      }

      if (!connect(sockfd, res->ai_addr, res->ai_addrlen))
      {
        break;
      }
      close(sockfd);
      sockfd = INVALID_SOCKET;
    }
    if (!addr)
    {
      logError("Unable to open connection to %s:%s: %s\n", host, service, strerror(errno));
    }
  }

  freeaddrinfo(res);
  free(host);

  return sockfd;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x40, %rsp
movq %rdi, %rbx
leaq 0x12c3(%rip), %rsi      # 0x469e
pushq $0x4
popq %rdx
callq 0x2070
xorl %ecx, %ecx
testl %eax, %eax
sete %cl
leaq (%rbx,%rcx,4), %rbx
decq %rbx
movq %rbx, %r14
incq %rbx
cmpb $0x2f, 0x1(%r14)
leaq 0x1(%r14), %r14
je 0x33f4
pushq $0x3a
popq %rsi
movq %r14, %rdi
callq 0x20d0
testq %rax, %rax
je 0x3420
movq %rax, %r15
movq %rax, %r12
subq %rbx, %r12
incq %r15
jmp 0x342e
movq %r14, %rdi
callq 0x20b0
movq %rax, %r12
xorl %r15d, %r15d
leaq 0x1(%r12), %rdi
callq 0x2190
testq %rax, %rax
je 0x3528
movq %rax, %rbx
movq %rax, %rdi
movq %r14, %rsi
movq %r12, %rdx
callq 0x2170
movb $0x0, (%rbx,%r12)
testq %r15, %r15
leaq 0x1250(%rip), %r14      # 0x46b1
cmovneq %r15, %r14
xorps %xmm0, %xmm0
leaq 0x10(%rsp), %rdx
movaps %xmm0, (%rdx)
movaps %xmm0, 0x10(%rdx)
movaps %xmm0, 0x20(%rdx)
movl $0x1, 0x8(%rdx)
leaq 0x8(%rsp), %r15
movq %rbx, %rdi
movq %r14, %rsi
movq %r15, %rcx
callq 0x2250
testl %eax, %eax
je 0x34d9
movl %eax, %edi
callq 0x20f0
jmp 0x34ed
movl 0x4(%r15), %edi
movl 0x8(%r15), %esi
movl 0xc(%r15), %edx
callq 0x22c0
cmpl $-0x1, %eax
je 0x34d5
movl %eax, %ebp
movq 0x8(%rsp), %rax
movq 0x18(%rax), %rsi
movl 0x10(%rax), %edx
movl %ebp, %edi
callq 0x2230
testl %eax, %eax
je 0x3507
movl %ebp, %edi
callq 0x2130
addq $0x28, %r15
movq (%r15), %r15
testq %r15, %r15
jne 0x349f
callq 0x2050
movl (%rax), %edi
callq 0x2260
leaq 0x1099(%rip), %rdi      # 0x458d
movq %rbx, %rsi
movq %r14, %rdx
movq %rax, %rcx
xorl %eax, %eax
callq 0x28cd
pushq $-0x1
popq %rbp
movq 0x8(%rsp), %rdi
callq 0x22b0
movq %rbx, %rdi
callq 0x2030
movl %ebp, %eax
addq $0x40, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
leaq 0x1174(%rip), %rdi      # 0x46a3
callq 0x2a0c
// File: /workspace/github_c_makefile_star2_O2/canboat[P]canboat/nmea0183/../common/common.c
// Function: scanNibble
uint8_t scanNibble(char c)
{
  if (isdigit((unsigned char) c))
  {
    return c - '0';
  }
  if (c >= 'A' && c <= 'F')
  {
    return c - 'A' + 10;
  }
  if (c >= 'a' && c <= 'f')
  {
    return c - 'a' + 10;
  }
  return 16;
}

// Assembly:
pushq %rbx
movl %edi, %ebx
callq 0x2290
movq (%rax), %rax
movzbl %bl, %ecx
testb $0x8, 0x1(%rax,%rcx,2)
jne 0x3555
leal -0x41(%rbx), %eax
cmpb $0x5, %al
ja 0x355a
addb $-0x37, %bl
jmp 0x356b
addb $-0x30, %bl
jmp 0x356b
leal -0x61(%rbx), %eax
addb $-0x57, %bl
cmpb $0x6, %al
movzbl %bl, %eax
pushq $0x10
popq %rbx
cmovbl %eax, %ebx
movl %ebx, %eax
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O2/canboat[P]canboat/nmea0183/../common/common.c
// Function: scanHex
int scanHex(char **p, uint8_t *m)
{
  uint8_t hi, lo;

  if (!(*p)[0] || !(*p)[1])
  {
    return 1;
  }

  hi = scanNibble((*p)[0]);
  if (hi > 15)
  {
    return 1;
  }
  lo = scanNibble((*p)[1]);
  if (lo > 15)
  {
    return 1;
  }
  (*p) += 2;
  *m = hi << 4 | lo;
  /* printf("(b=%02X,p=%p) ", *m, *p); */
  return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq (%rdi), %r12
movb (%r12), %al
pushq $0x1
popq %rbx
testb %al, %al
je 0x35c6
movb 0x1(%r12), %r13b
testb %r13b, %r13b
je 0x35c6
movq %rsi, %r14
movq %rdi, %r15
movsbl %al, %edi
callq 0x3534
cmpb $0xf, %al
ja 0x35c6
movl %eax, %ebp
movsbl %r13b, %edi
callq 0x3534
cmpb $0xf, %al
ja 0x35c6
addq $0x2, %r12
movq %r12, (%r15)
shlb $0x4, %bpl
orb %bpl, %al
movb %al, (%r14)
xorl %ebx, %ebx
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/canboat[P]canboat/nmea0183/../common/common.c
// Function: isReady
int isReady(SOCKET fd1, SOCKET fd2, SOCKET fd3, int timeout)
{
  fd_set         fds;
  fd_set         fdw;
  struct timeval waitfor;
  int            setsize;
  int            r;
  int            ret = 0;

  FD_ZERO(&fds);
  FD_ZERO(&fdw);
  if (fd1 > INVALID_SOCKET)
  {
    FD_SET(fd1, &fds);
  }
  if (fd2 > INVALID_SOCKET)
  {
    FD_SET(fd2, &fds);
  }
  if (fd3 > INVALID_SOCKET)
  {
    FD_SET(fd3, &fdw);
  }
  waitfor.tv_sec  = timeout ? timeout : 10;
  waitfor.tv_usec = 0;
  setsize         = CB_MAX(CB_MAX(fd1, fd2), fd3) + 1;
  r               = select(setsize, &fds, &fdw, 0, &waitfor);
  if (r < 0)
  {
    logAbort("I/O error; restart by quit\n");
  }
  if (r > 0)
  {
    if (fd1 > INVALID_SOCKET && FD_ISSET(fd1, &fds))
    {
      ret |= FD1_ReadReady;
    }
    if (fd2 > INVALID_SOCKET && FD_ISSET(fd2, &fds))
    {
      ret |= FD2_ReadReady;
    }
    if (fd3 > INVALID_SOCKET && FD_ISSET(fd3, &fdw))
    {
      ret |= FD3_WriteReady;
    }
  }
  if (!ret && timeout)
  {
    logAbort("Timeout %ld seconds; restart by quit\n", timeout);
  }
  return ret;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x110, %rsp            # imm = 0x110
movl %ecx, %ebx
movl %edx, %r14d
movl %esi, %r15d
movl %edi, %r12d
xorl %eax, %eax
cmpq $0x10, %rax
je 0x3605
andq $0x0, 0x10(%rsp,%rax,8)
incq %rax
jmp 0x35f4
xorl %eax, %eax
cmpq $0x10, %rax
je 0x361b
andq $0x0, 0x90(%rsp,%rax,8)
incq %rax
jmp 0x3607
pushq $0x1
popq %rax
testl %r12d, %r12d
js 0x3637
movq %rax, %rdx
movl %r12d, %ecx
shlq %cl, %rdx
movl %r12d, %ecx
shrl $0x6, %ecx
orq %rdx, 0x10(%rsp,%rcx,8)
testl %r15d, %r15d
js 0x3650
movq %rax, %rdx
movl %r15d, %ecx
shlq %cl, %rdx
movl %r15d, %ecx
shrl $0x6, %ecx
orq %rdx, 0x10(%rsp,%rcx,8)
testl %r14d, %r14d
js 0x3669
movl %r14d, %ecx
shlq %cl, %rax
movl %r14d, %ecx
shrl $0x6, %ecx
orq %rax, 0x90(%rsp,%rcx,8)
testl %ebx, %ebx
pushq $0xa
popq %rax
cmovnel %ebx, %eax
cltq
movq %rsp, %r8
movq %rax, (%r8)
andq $0x0, 0x8(%r8)
cmpl %r15d, %r12d
movl %r15d, %edi
cmovgl %r12d, %edi
cmpl %r14d, %edi
cmovlel %r14d, %edi
incl %edi
xorl %r13d, %r13d
leaq 0x10(%rsp), %rsi
leaq 0x90(%rsp), %rdx
xorl %ecx, %ecx
callq 0x2180
testl %eax, %eax
js 0x3730
je 0x3713
testl %r12d, %r12d
js 0x36cf
movl %r12d, %eax
shrl $0x6, %eax
movq 0x10(%rsp,%rax,8), %rax
xorl %r13d, %r13d
btq %r12, %rax
setb %r13b
jmp 0x36d2
xorl %r13d, %r13d
testl %r15d, %r15d
js 0x36f1
movl %r15d, %eax
shrl $0x6, %eax
movq 0x10(%rsp,%rax,8), %rax
leal 0x2(%r13), %ecx
btq %r15, %rax
cmovael %r13d, %ecx
movl %ecx, %r13d
testl %r14d, %r14d
js 0x3713
movl %r14d, %eax
shrl $0x6, %eax
movq 0x90(%rsp,%rax,8), %rax
leal 0x4(%r13), %ecx
btq %r14, %rax
cmovael %r13d, %ecx
movl %ecx, %r13d
testl %ebx, %ebx
je 0x371c
testl %r13d, %r13d
je 0x373e
movl %r13d, %eax
addq $0x110, %rsp            # imm = 0x110
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
leaq 0xe7e(%rip), %rdi       # 0x45b5
xorl %eax, %eax
callq 0x295e
leaq 0xe8c(%rip), %rdi       # 0x45d1
movl %ebx, %esi
xorl %eax, %eax
callq 0x295e
// File: /workspace/github_c_makefile_star2_O2/canboat[P]canboat/nmea0183/../common/common.c
// Function: writeSerial
int writeSerial(SOCKET handle, const uint8_t *data, size_t len)
{
  int     retryCount = 5;
  ssize_t written;

  do
  {
    written = write(handle, data, len);
    if (written != -1)
    {
      data += written;
      len -= written;
    }
    else if (errno == EAGAIN)
    {
      retryCount--;
      usleep(25000);
    }
    else
    {
      break;
    }
  } while (len > 0 && retryCount >= 0);

  if (written == -1)
  {
    logError("Write failed: %s\n", strerror(errno));
    return -1;
  }
  else if (len > 0)
  {
    logError("Write timeout: %s\n", strerror(errno));
    return -1;
  }
  return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %rdx, %rbx
movq %rsi, %r14
movl %edi, %ebp
pushq $0x5
popq %r12
movl %ebp, %edi
movq %r14, %rsi
movq %rbx, %rdx
callq 0x20a0
cmpq $-0x1, %rax
jne 0x37a2
callq 0x2050
movl (%rax), %edi
cmpl $0xb, %edi
jne 0x37b1
movq %rax, %r15
movl $0x61a8, %edi           # imm = 0x61A8
callq 0x22a0
testq %rbx, %rbx
je 0x37ae
leal -0x1(%r12), %eax
testl %r12d, %r12d
movl %eax, %r12d
jg 0x3762
jmp 0x37ae
addq %rax, %r14
subq %rax, %rbx
jne 0x3762
xorl %eax, %eax
jmp 0x37ca
movl (%r15), %edi
callq 0x2260
leaq 0xe3a(%rip), %rdi       # 0x45f7
movq %rax, %rsi
xorl %eax, %eax
callq 0x28cd
pushq $-0x1
popq %rax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/canboat[P]canboat/nmea0183/../common/common.c
// Function: parseInt
bool parseInt(const char **msg, int *value, int defValue)
{
  char *end;

  *value = strtol(*msg, &end, 10);
  if (end == *msg)
  {
    *value = defValue;
  }
  *msg = end;
  if (*end == ',')
  {
    *msg = end + 1;
  }
  else if (*end != '\0')
  {
    return false;
  }
  return true;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movl %edx, %ebp
movq %rsi, %r14
movq %rdi, %rbx
movq (%rdi), %rdi
movq %rsp, %r15
pushq $0xa
popq %rdx
movq %r15, %rsi
callq 0x2160
movq (%r15), %rcx
cmpq (%rbx), %rcx
cmovel %ebp, %eax
movl %eax, (%r14)
movq %rcx, (%rbx)
movzbl (%rcx), %eax
testl %eax, %eax
je 0x3814
cmpl $0x2c, %eax
jne 0x3818
incq %rcx
movq %rcx, (%rbx)
movb $0x1, %al
jmp 0x381a
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/eric-lo[P]3150/9-File/read_part.c
// Function: main
int main(int argc, char **argv) {
	FILE *fp;
	unsigned char buf[1000];
	struct ptable *ptr;
	int i;

	if(argc != 2) {
		fprintf(stderr, "Usage: %s [disk image]\n", argv[0]);
		exit(1);
	}

	if( (fp = fopen(argv[1], "r")) == NULL ) {
		perror(argv[1]);
		exit(1);
	}

	fseek(fp, PTABLE_START, SEEK_SET);	// skip boot code
	fread(buf, sizeof(struct ptable), 4, fp);

	ptr = (struct ptable *) buf;

	for(i = 0; i < 4; i++) {
		printf("Partition table #%d\n", i + 1);
		printf("------------------\n");

		printf("Bootable\t");
		if(ptr[i].flag == 0x80)
			printf("Yes\n");
		else
			printf("No\n");

		printf("LBA start addr\t%u\n", ptr[i].lba_start_addr);
		printf("type\t\t0x%02x\n", ptr[i].type);
		printf("size\t\t%u\n", ptr[i].size_in_sector);
		printf("\n");
	}
	return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x3e8, %rsp            # imm = 0x3E8
movq %rsi, %rbx
cmpl $0x2, %edi
jne 0x12da
movq 0x8(%rbx), %rdi
leaq 0xe38(%rip), %rsi       # 0x201c
callq 0x1080
testq %rax, %rax
je 0x12f7
movq %rax, %r14
movl $0x1be, %esi            # imm = 0x1BE
movq %rax, %rdi
xorl %edx, %edx
callq 0x1090
movq %rsp, %rdi
pushq $0x10
popq %rsi
pushq $0x4
popq %rdx
movq %r14, %rcx
callq 0x1050
pushq $0xc
popq %r12
pushq $0x1
popq %rbx
leaq 0xe1a(%rip), %r13       # 0x203d
leaq 0xe26(%rip), %rbp       # 0x2050
leaq 0xe2d(%rip), %r14       # 0x205e
pushq $0xa
popq %r15
cmpq $0x4c, %r12
je 0x12c6
leaq 0xdd8(%rip), %rdi       # 0x201e
movl %ebx, %esi
xorl %eax, %eax
callq 0x1060
leaq 0xe12(%rip), %rdi       # 0x2068
callq 0x1040
leaq 0xdd1(%rip), %rdi       # 0x2033
xorl %eax, %eax
callq 0x1060
cmpb $-0x80, -0xc(%rsp,%r12)
leaq 0xe05(%rip), %rdi       # 0x207b
leaq 0xe01(%rip), %rax       # 0x207e
cmoveq %rax, %rdi
callq 0x1040
movl -0x4(%rsp,%r12), %esi
movq %r13, %rdi
xorl %eax, %eax
callq 0x1060
movzbl -0x8(%rsp,%r12), %esi
movq %rbp, %rdi
xorl %eax, %eax
callq 0x1060
movl (%rsp,%r12), %esi
movq %r14, %rdi
xorl %eax, %eax
callq 0x1060
movl %r15d, %edi
callq 0x1030
addq $0x10, %r12
incl %ebx
jmp 0x1235
xorl %eax, %eax
addq $0x3e8, %rsp            # imm = 0x3E8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x2d17(%rip), %rax      # 0x3ff8
movq (%rax), %rdi
movq (%rbx), %rdx
leaq 0xd16(%rip), %rsi       # 0x2004
xorl %eax, %eax
callq 0x1070
jmp 0x1300
movq 0x8(%rbx), %rdi
callq 0x10a0
pushq $0x1
popq %rdi
callq 0x10b0
// File: /workspace/github_c_makefile_star2_O2/FastFilter[P]BlockBloomSimulator/src/randomutil.h
// Function: pcg32_random_r
static inline uint32_t pcg32_random_r(pcg32_random_t *rng) {
  uint64_t oldstate = rng->state;
  rng->state = oldstate * 6364136223846793005ULL + rng->inc;
  uint32_t xorshifted = ((oldstate >> 18u) ^ oldstate) >> 27u;
  uint32_t rot = oldstate >> 59u;
  return (xorshifted >> rot) | (xorshifted << ((-rot) & 31));
}

// Assembly:
movq 0x5e8c(%rip), %rcx      # 0x7088
movabsq $0x5851f42d4c957f2d, %rax # imm = 0x5851F42D4C957F2D
imulq %rcx, %rax
addq 0x5e7f(%rip), %rax      # 0x7090
movq %rax, 0x5e70(%rip)      # 0x7088
movq %rcx, %rax
shrq $0x2d, %rax
movq %rcx, %rdx
shrq $0x1b, %rdx
xorl %edx, %eax
shrq $0x3b, %rcx
rorl %cl, %eax
retq
// File: /workspace/github_c_makefile_star2_O2/FastFilter[P]BlockBloomSimulator/src/blockmodel.h
// Function: simulate
sim_stats_t simulate(size_t HowManyKeys, model_t model, size_t howmanytests,
                bitset_t *b) {
  bitset_resize(b, model.BlockSizeInBits * model.NumberOfBlocks, true);
  bitset_clear(b);

  for (size_t i = 0; i < HowManyKeys; i++) {
    size_t blockindex = random_integer(model.NumberOfBlocks);
    for (size_t j = 0; j < model.BitsPerKeyPerBlock; j++) {
      size_t bi = random_integer(model.BlockSizeInBits);
      bitset_set(b, blockindex * model.BlockSizeInBits + bi);
    }
  }
  size_t matches = 0;
  for (size_t i = 0; i < howmanytests; i++) {
    size_t blockindex = random_integer(model.NumberOfBlocks);
    bool is_matched = true;
    for (size_t j = 0; j < model.BitsPerKeyPerBlock; j++) {
      size_t bi = random_integer(model.BlockSizeInBits);
      is_matched =
          is_matched && bitset_get(b, blockindex * model.BlockSizeInBits + bi);
    }
    if (is_matched)
      matches++;
  }
  sim_stats_t answer;
  answer.collision_rate = matches * 1.0 / howmanytests;
  answer.density = bitset_count(b) * 1.0 /  (model.BlockSizeInBits * model.NumberOfBlocks) ;
  return answer;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movq %rdx, %rbx
movq %rsi, (%rsp)
movq %rdi, %rbp
movq 0x78(%rsp), %r15
movq 0x80(%rsp), %rsi
movq %rsi, 0x10(%rsp)
imulq %r15, %rsi
pushq $0x1
popq %rdx
movq %rbx, %rdi
movq %rsi, 0x28(%rsp)
callq 0x2645
movq %rbx, %rdi
callq 0x2540
xorl %r14d, %r14d
movq 0x70(%rsp), %rax
movq %rax, 0x8(%rsp)
cmpq %rbp, %r14
je 0x12e1
movq 0x10(%rsp), %rdi
callq 0x122f
movq %rax, %r12
imulq %r15, %r12
movq 0x8(%rsp), %r13
subq $0x1, %r13
jb 0x12dc
movq %r15, %rdi
callq 0x122f
leaq (%rax,%r12), %rsi
movq %rbx, %rdi
callq 0x13ed
jmp 0x12c0
incq %r14
jmp 0x12a5
xorl %r12d, %r12d
xorl %r14d, %r14d
cmpq (%rsp), %r14
je 0x134b
movq %r12, 0x30(%rsp)
movq 0x10(%rsp), %rdi
callq 0x122f
movq %rax, %rbp
imulq %r15, %rbp
movb $0x1, %r12b
movq 0x8(%rsp), %r13
subq $0x1, %r13
jb 0x1337
movq %r15, %rdi
callq 0x122f
testb $0x1, %r12b
je 0x1332
addq %rbp, %rax
movq %rbx, %rdi
movq %rax, %rsi
callq 0x1483
movl %eax, %r12d
jmp 0x130b
xorl %r12d, %r12d
jmp 0x130b
movzbl %r12b, %eax
andl $0x1, %eax
movq 0x30(%rsp), %r12
addq %rax, %r12
incq %r14
jmp 0x12e7
movq 0x28(%rsp), %xmm0
movq (%rsp), %xmm1
punpcklqdq %xmm0, %xmm1    # xmm1 = xmm1[0],xmm0[0]
movdqa %xmm1, %xmm0
pand 0x2caa(%rip), %xmm0     # 0x4010
por 0x2cb2(%rip), %xmm0     # 0x4020
psrlq $0x20, %xmm1
por 0x2cb5(%rip), %xmm1     # 0x4030
subpd 0x2cbd(%rip), %xmm1     # 0x4040
addpd %xmm0, %xmm1
movapd %xmm1, 0x10(%rsp)
movq %rbx, %rdi
callq 0x2772
movq %r12, %xmm0
movq %rax, %xmm1
punpcklqdq %xmm1, %xmm0    # xmm0 = xmm0[0],xmm1[0]
movdqa 0x2c65(%rip), %xmm1     # 0x4010
pand %xmm0, %xmm1
por 0x2c69(%rip), %xmm1     # 0x4020
psrlq $0x20, %xmm0
por 0x2c6c(%rip), %xmm0     # 0x4030
subpd 0x2c74(%rip), %xmm0     # 0x4040
addpd %xmm1, %xmm0
divpd 0x10(%rsp), %xmm0
movapd %xmm0, %xmm1
unpckhpd %xmm0, %xmm1            # xmm1 = xmm1[1],xmm0[1]
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/FastFilter[P]BlockBloomSimulator/src/bitset.h
// Function: bitset_set
static inline void bitset_set(bitset_t *bitset,  size_t i ) {
  size_t shiftedi = i >> 6;
  if (shiftedi >= bitset->arraysize) {
    if( ! bitset_grow(bitset,  shiftedi + 1) ) {
        return;
    }
  }
  bitset->array[shiftedi] |= ((uint64_t)1) << (i % 64);
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %r14
movq %rdi, %rbx
movq %rsi, %r15
shrq $0x6, %r15
movq 0x8(%rdi), %rcx
cmpq %rcx, %r15
jb 0x1454
leaq 0x1(%r15), %r12
movq (%rbx), %rax
cmpq %r15, 0x10(%rbx)
ja 0x143b
leaq (%r12,%r12), %rcx
movq %rcx, 0x10(%rbx)
movq %r12, %rsi
shlq $0x4, %rsi
movq %rax, %rdi
callq 0x10e0
testq %rax, %rax
je 0x1470
movq %rax, (%rbx)
movq 0x8(%rbx), %rcx
leaq (%rax,%rcx,8), %rdi
movq %r12, %rdx
subq %rcx, %rdx
shlq $0x3, %rdx
xorl %esi, %esi
callq 0x1090
movq %r12, 0x8(%rbx)
pushq $0x1
popq %rax
movl %r14d, %ecx
shlq %cl, %rax
movq (%rbx), %rcx
orq %rax, (%rcx,%r15,8)
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
movq (%rbx), %rdi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
jmp 0x1040
// File: /workspace/github_c_makefile_star2_O2/FastFilter[P]BlockBloomSimulator/src/blockmodel.h
// Function: findBestBitsPerKeyPerBlock
size_t findBestBitsPerKeyPerBlock(size_t HowManyKeys, size_t bitbudget,
                                  size_t BlockSizeInBits,
                                  sim_stats_t *beststats, bool verbose) {
  model_t m;
  m.NumberOfBlocks = bitbudget / BlockSizeInBits;
  m.BlockSizeInBits = BlockSizeInBits;
  size_t howmanytests = 100000;
  bitset_t *b = bitset_create_with_capacity(bitbudget);
  beststats->collision_rate = 1.0;
  size_t BestBitsPerKeyPerBlock = 0;
  for (size_t BitsPerKeyPerBlock = 1;
       (BitsPerKeyPerBlock <= 16) ||
       (BestBitsPerKeyPerBlock == BitsPerKeyPerBlock);
       BitsPerKeyPerBlock++) {
    m.BitsPerKeyPerBlock = BitsPerKeyPerBlock;
    // we take the average of several attempts
    //double collisionrate = 0;
    sim_stats_t s;
    s.collision_rate = 0;
    s.density = 0;
    size_t attempts = HowManyKeys < 10000000 ? 5 : 1;
    for (int i = 0; i < attempts; i++) {
      sim_stats_t ts = simulate(HowManyKeys, m, howmanytests, b);
      s.density += ts.density;
      s.collision_rate += ts.collision_rate;
    }
    s.collision_rate /= attempts;
    s.density /= attempts;

    if (s.collision_rate * 1.01 <
        beststats->collision_rate) { // has to be at least one percent better
      beststats->collision_rate = s.collision_rate;
      beststats->density = s.density; 
      BestBitsPerKeyPerBlock = BitsPerKeyPerBlock;
    }
  }
  bitset_free(b);
  return BestBitsPerKeyPerBlock;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x58, %rsp
movq %rcx, %rbx
movq %rdx, %rcx
movq %rdi, %r14
xorl %r15d, %r15d
movq %rsi, %rax
xorl %edx, %edx
divq %rcx
movq %rax, 0x50(%rsp)
movq %rcx, 0x48(%rsp)
movq %rsi, %rdi
callq 0x2483
movq %rax, %r12
movabsq $0x3ff0000000000000, %rax # imm = 0x3FF0000000000000
movq %rax, (%rbx)
xorl %eax, %eax
cmpq $0x989680, %r14         # imm = 0x989680
setb %al
leaq 0x1(,%rax,4), %rax
movq %rax, 0x30(%rsp)
cvtsi2sd %eax, %xmm0
movsd %xmm0, 0x28(%rsp)
pushq $0x1
popq %rbp
cmpq $0x11, %rbp
setb %al
cmpq %rbp, %r15
sete %cl
orb %al, %cl
je 0x15c2
movq %rbp, 0x40(%rsp)
xorpd %xmm0, %xmm0
movsd %xmm0, 0x20(%rsp)
movq 0x30(%rsp), %r13
xorpd %xmm2, %xmm2
subq $0x1, %r13
jb 0x1586
movq 0x50(%rsp), %rax
movq %rax, 0x10(%rsp)
movupd 0x40(%rsp), %xmm0
movupd %xmm0, (%rsp)
movl $0x186a0, %esi          # imm = 0x186A0
movq %r14, %rdi
movq %r12, %rdx
movsd %xmm2, 0x38(%rsp)
callq 0x1252
movsd 0x20(%rsp), %xmm2
addsd %xmm1, %xmm2
movsd %xmm2, 0x20(%rsp)
movsd 0x38(%rsp), %xmm2
addsd %xmm0, %xmm2
jmp 0x1539
divsd 0x28(%rsp), %xmm2
movapd %xmm2, %xmm0
mulsd 0x2ae8(%rip), %xmm0     # 0x4080
movsd (%rbx), %xmm1
ucomisd %xmm0, %xmm1
jbe 0x15ba
movsd 0x20(%rsp), %xmm0
divsd 0x28(%rsp), %xmm0
movsd %xmm2, (%rbx)
movsd %xmm0, 0x8(%rbx)
movq %rbp, %r15
incq %rbp
jmp 0x150c
movq %r12, %rdi
callq 0x275d
movq %r15, %rax
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/FastFilter[P]BlockBloomSimulator/src/blockmodel.h
// Function: assessBlockSize
void assessBlockSize(size_t HowManyKeys, size_t BlockSizeInBits, bool verbose) {
  for (size_t bitsperkey = 8; bitsperkey <= 16; bitsperkey += 4) {
    size_t bitbudget = bitsperkey * HowManyKeys;
    sim_stats_t beststats;
    size_t bestbitsperbucket = findBestBitsPerKeyPerBlock(
        HowManyKeys, bitbudget, BlockSizeInBits, &beststats, verbose);
    double density = bestbitsperbucket * 1.0 / bitsperkey;

    double theoretical_best_bits = log(1.0/beststats.collision_rate) / log(2.0);
    double inefficiency = (bitsperkey/theoretical_best_bits - 1.0) * 100.0;
    

    printf("bits per key %3zu best bits per bucket = %zu, max density = %0.0f %%, density = %0.0f %%, collision rate = "
           "%0.3f %%, inefficiency = %0.1f %% \n",
           bitsperkey, bestbitsperbucket,density * 100,   beststats.density * 100, beststats.collision_rate * 100, inefficiency);
  }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movq %rsi, %rbx
movq %rdi, %r14
leaq (,%rdi,8), %r15
leaq (,%rdi,4), %rbp
pushq $0x8
popq %r12
cmpq $0x11, %r12
jae 0x16dc
movq %r14, %rdi
movq %r15, %rsi
movq %rbx, %rdx
leaq 0x10(%rsp), %rcx
xorl %r8d, %r8d
callq 0x14a2
movq %rax, %r13
movq %rax, %xmm0
punpckldq 0x2a1c(%rip), %xmm0 # xmm0 = xmm0[0],mem[0],xmm0[1],mem[1]
subpd 0x2a24(%rip), %xmm0     # 0x4060
movapd %xmm0, %xmm1
unpckhpd %xmm0, %xmm1            # xmm1 = xmm1[1],xmm0[1]
addsd %xmm0, %xmm1
cvtsi2sd %r12, %xmm0
movsd %xmm0, (%rsp)
divsd %xmm0, %xmm1
movapd %xmm1, 0x20(%rsp)
movsd 0x10(%rsp), %xmm1
movsd %xmm1, 0x8(%rsp)
movsd 0x2a18(%rip), %xmm0     # 0x4088
divsd %xmm1, %xmm0
callq 0x10a0
divsd 0x2a0f(%rip), %xmm0     # 0x4090
movsd (%rsp), %xmm3
divsd %xmm0, %xmm3
addsd 0x2a06(%rip), %xmm3     # 0x4098
movsd 0x2a06(%rip), %xmm4     # 0x40a0
mulsd %xmm4, %xmm3
movapd 0x20(%rsp), %xmm0
mulsd %xmm4, %xmm0
movsd 0x18(%rsp), %xmm1
mulsd %xmm4, %xmm1
movsd 0x8(%rsp), %xmm2
mulsd %xmm4, %xmm2
leaq 0x29ed(%rip), %rdi      # 0x40b0
movq %r12, %rsi
movq %r13, %rdx
movb $0x4, %al
callq 0x1080
addq $0x4, %r12
addq %rbp, %r15
jmp 0x1604
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/FastFilter[P]BlockBloomSimulator/src/bloommodel.h
// Function: describeBloom
void describeBloom(size_t bitsperkey) {
  double bestbitsperbucket = bitsperkey * log(2);
  double density = bestbitsperbucket * 1.0 / bitsperkey;

  double bestcollisionrate = pow(2, -bestbitsperbucket);
  printf("bits per key %3zu best bits per bucket = %4.1f, best density = %0.0f %%, collision rate = "
         "%0.3f %% [theory]\n",
         bitsperkey, bestbitsperbucket, density * 100, bestcollisionrate * 100);
}

// Assembly:
pushq %rbx
subq $0x20, %rsp
movq %rdi, %rbx
movq %rdi, %xmm0
punpckldq 0x2950(%rip), %xmm0 # xmm0 = xmm0[0],mem[0],xmm0[1],mem[1]
subpd 0x2958(%rip), %xmm0     # 0x4060
movapd %xmm0, %xmm1
unpckhpd %xmm0, %xmm1            # xmm1 = xmm1[1],xmm0[1]
addsd %xmm0, %xmm1
movsd 0x2974(%rip), %xmm2     # 0x4090
mulsd %xmm1, %xmm2
movapd %xmm2, 0x10(%rsp)
movapd %xmm2, %xmm0
divsd %xmm1, %xmm0
movapd %xmm0, (%rsp)
movapd 0x2935(%rip), %xmm0     # 0x4070
xorpd %xmm2, %xmm0
callq 0x1030
movsd 0x2954(%rip), %xmm2     # 0x40a0
movapd (%rsp), %xmm1
mulsd %xmm2, %xmm1
mulsd %xmm0, %xmm2
leaq 0x29df(%rip), %rdi      # 0x413f
movq %rbx, %rsi
movaps 0x10(%rsp), %xmm0
movb $0x3, %al
addq $0x20, %rsp
popq %rbx
jmp 0x1080
// File: /workspace/github_c_makefile_star2_O2/FastFilter[P]BlockBloomSimulator/src/bloommodel.h
// Function: assessBloomCase
void assessBloomCase(size_t HowManyKeys, bool verbose) {
  for (size_t bitsperkey = 8; bitsperkey <= 16; bitsperkey += 1) {
    size_t bitbudget = bitsperkey * HowManyKeys;
    sim_stats_t beststats;
    size_t bestbitsperbucket = findBestBitsPerKeyPerBlock(
        HowManyKeys, bitbudget, bitbudget, &beststats, verbose);
    double density = bestbitsperbucket * 1.0 / bitsperkey;

    printf("bits per key %3zu best bits per bucket = %4.1f, max density = %0.0f %%, density = %0.0f %%, collision rate = "
           "%0.3f %% [measured]\n",
           bitsperkey, (float)bestbitsperbucket, density * 100, beststats.density * 100, beststats.collision_rate * 100);
    describeBloom(bitsperkey);
  }
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x10, %rsp
movq %rdi, %rbx
leaq (,%rdi,8), %r14
pushq $0x8
popq %r15
movq %rsp, %r12
leaq 0x2a12(%rip), %r13      # 0x41ac
cmpq $0x11, %r15
je 0x1846
movq %rbx, %rdi
movq %r14, %rsi
movq %r14, %rdx
movq %r12, %rcx
xorl %r8d, %r8d
callq 0x14a2
movq %rax, %xmm0
punpckldq 0x288b(%rip), %xmm0 # xmm0 = xmm0[0],mem[0],xmm0[1],mem[1]
subpd 0x2893(%rip), %xmm0     # 0x4060
testq %rax, %rax
js 0x17d9
cvtsi2ss %rax, %xmm2
jmp 0x17ee
movq %rax, %rcx
shrq %rcx
andl $0x1, %eax
orq %rcx, %rax
cvtsi2ss %rax, %xmm2
addss %xmm2, %xmm2
movapd %xmm0, %xmm1
unpckhpd %xmm0, %xmm1            # xmm1 = xmm1[1],xmm0[1]
cvtsi2sd %r15, %xmm3
addsd %xmm0, %xmm1
divsd %xmm3, %xmm1
cvtss2sd %xmm2, %xmm0
movsd 0x2891(%rip), %xmm4     # 0x40a0
mulsd %xmm4, %xmm1
movsd 0x8(%rsp), %xmm2
mulsd %xmm4, %xmm2
movsd (%rsp), %xmm3
mulsd %xmm4, %xmm3
movq %r13, %rdi
movq %r15, %rsi
movb $0x4, %al
callq 0x1080
movq %r15, %rdi
callq 0x16eb
incq %r15
addq %rbx, %r14
jmp 0x179a
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O2/FastFilter[P]BlockBloomSimulator/src/laneblockmodel.h
// Function: findLaneCollisionRateAndDensity
sim_stats_t findLaneCollisionRateAndDensity(size_t HowManyKeys, size_t bitbudget,
                             size_t BlockSizeInBits, size_t lanesize,
                             bool verbose) {
  model_t m;
  m.NumberOfBlocks = bitbudget / BlockSizeInBits;
  m.BlockSizeInBits = BlockSizeInBits;
  size_t howmanytests = 100000;
  bitset_t *b = bitset_create_with_capacity(bitbudget);
  m.BitsPerKeyPerBlock = m.BlockSizeInBits / lanesize;
  // we take the averge of several attempts
  sim_stats_t s; 
  s.collision_rate = 0;
  s.density = 0;
  size_t attempts = HowManyKeys < 10000000 ? 5 : 1;
  for (int i = 0; i < attempts; i++) {
    sim_stats_t ts = simulate_lane(HowManyKeys, m, howmanytests, b);
    s.density += ts.density;
    s.collision_rate += ts.collision_rate;
  }
  s.collision_rate /= attempts;
  s.density /= attempts;
  bitset_free(b);
  return s;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x48, %rsp
movq %rcx, %r15
movq %rdx, %r12
movq %rdi, %rbx
movq %rsi, %rax
xorl %edx, %edx
divq %r12
movq %rax, 0x40(%rsp)
movq %r12, 0x38(%rsp)
movq %rsi, %rdi
callq 0x2483
movq %rax, %r14
movq %r12, %rax
xorl %edx, %edx
divq %r15
movq %rax, 0x30(%rsp)
xorl %eax, %eax
cmpq $0x989680, %rbx         # imm = 0x989680
setb %al
leaq 0x1(,%rax,4), %r15
xorpd %xmm1, %xmm1
movq %r15, %r12
subq $0x1, %r12
jb 0x1c33
movq 0x40(%rsp), %rax
movq %rax, 0x10(%rsp)
movupd 0x30(%rsp), %xmm0
movupd %xmm0, (%rsp)
movl $0x186a0, %esi          # imm = 0x186A0
movq %rbx, %rdi
movq %r14, %rdx
movapd %xmm1, 0x20(%rsp)
callq 0x1854
unpcklpd %xmm1, %xmm0            # xmm0 = xmm0[0],xmm1[0]
movapd 0x20(%rsp), %xmm1
addpd %xmm0, %xmm1
jmp 0x1bf2
cvtsi2sd %r15d, %xmm0
unpcklpd %xmm0, %xmm0            # xmm0 = xmm0[0,0]
divpd %xmm0, %xmm1
movapd %xmm1, 0x20(%rsp)
movq %r14, %rdi
callq 0x275d
movaps 0x20(%rsp), %xmm0
movaps %xmm0, %xmm1
unpckhpd %xmm0, %xmm1            # xmm1 = xmm1[1],xmm0[1]
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O2/FastFilter[P]BlockBloomSimulator/src/softblockmodel.h
// Function: findBestFold
size_t findBestFold(size_t HowManyKeys, size_t bitbudget,
                                  size_t BlockSizeInBits,
                                  sim_stats_t *beststats, bool verbose) {
  softmodel_t m;
  m.NumberOfBlocks = bitbudget / BlockSizeInBits;
  m.BlockSizeInBits = BlockSizeInBits;
  size_t howmanytests = 100000;
  bitset_t *b = bitset_create_with_capacity(bitbudget);
  beststats->collision_rate = 1.0;
  size_t BestFold = 0;
  for (size_t fold = 0; fold <= 16; fold++) {
    m.FoldCount = fold;
    // we take the average of several attempts
    //double collisionrate = 0;
    sim_stats_t s;
    s.collision_rate = 0;
    s.density = 0;
    size_t attempts = HowManyKeys < 10000000 ? 5 : 1;
    for (int i = 0; i < attempts; i++) {
      sim_stats_t ts = simulate_soft(HowManyKeys, m, howmanytests, b);
      s.density += ts.density;
      s.collision_rate += ts.collision_rate;
    }
    s.collision_rate /= attempts;
    s.density /= attempts;

    if (s.collision_rate * 1.01 <
        beststats->collision_rate) { // has to be at least one percent better
      beststats->collision_rate = s.collision_rate;
      beststats->density = s.density; 
      BestFold = fold;
    }
  }
  bitset_free(b);
  return BestFold;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x58, %rsp
movq %rcx, %rbx
movq %rdx, %rcx
movq %rdi, %r14
xorl %r13d, %r13d
movq %rsi, %rax
xorl %edx, %edx
divq %rcx
movq %rax, 0x50(%rsp)
movq %rcx, 0x48(%rsp)
movq %rsi, %rdi
callq 0x2483
movq %rax, %r15
movabsq $0x3ff0000000000000, %rax # imm = 0x3FF0000000000000
movq %rax, (%rbx)
xorl %eax, %eax
cmpq $0x989680, %r14         # imm = 0x989680
setb %al
leaq 0x1(,%rax,4), %r12
cvtsi2sd %r12d, %xmm0
movsd %xmm0, 0x28(%rsp)
movq $0x0, 0x20(%rsp)
cmpq $0x11, %r13
je 0x20f5
movq %r13, 0x40(%rsp)
xorpd %xmm1, %xmm1
movq %r12, %rbp
xorpd %xmm2, %xmm2
movsd %xmm1, 0x30(%rsp)
subq $0x1, %rbp
jb 0x20b7
movq 0x50(%rsp), %rax
movq %rax, 0x10(%rsp)
movupd 0x40(%rsp), %xmm0
movupd %xmm0, (%rsp)
movl $0x186a0, %esi          # imm = 0x186A0
movq %r14, %rdi
movq %r15, %rdx
movsd %xmm2, 0x38(%rsp)
callq 0x1dc0
movsd 0x30(%rsp), %xmm2
addsd %xmm1, %xmm2
movapd %xmm2, %xmm1
movsd 0x38(%rsp), %xmm2
addsd %xmm0, %xmm2
jmp 0x2066
divsd 0x28(%rsp), %xmm2
movapd %xmm2, %xmm0
mulsd 0x1fb7(%rip), %xmm0     # 0x4080
movsd (%rbx), %xmm1
ucomisd %xmm0, %xmm1
jbe 0x20ed
movsd 0x30(%rsp), %xmm0
divsd 0x28(%rsp), %xmm0
movsd %xmm2, (%rbx)
movsd %xmm0, 0x8(%rbx)
movq %r13, 0x20(%rsp)
incq %r13
jmp 0x204c
movq %r15, %rdi
callq 0x275d
movq 0x20(%rsp), %rax
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/FastFilter[P]BlockBloomSimulator/src/softblockmodel.h
// Function: findSoftCollisionRateAndDensity
sim_stats_t findSoftCollisionRateAndDensity(size_t HowManyKeys, size_t bitbudget,
                             size_t BlockSizeInBits, size_t fold,
                             bool verbose) {
  softmodel_t m;
  m.NumberOfBlocks = bitbudget / BlockSizeInBits;
  m.BlockSizeInBits = BlockSizeInBits;
  size_t howmanytests = 100000;
  bitset_t *b = bitset_create_with_capacity(bitbudget);
  m.FoldCount = fold;
  // we take the averge of several attempts
  sim_stats_t s; 
  s.collision_rate = 0;
  s.density = 0;
  size_t attempts = HowManyKeys < 10000000 ? 5 : 1;
  for (int i = 0; i < attempts; i++) {
    sim_stats_t ts = simulate_soft(HowManyKeys, m, howmanytests, b);
    s.density += ts.density;
    s.collision_rate += ts.collision_rate;
  }
  s.collision_rate /= attempts;
  s.density /= attempts;
  bitset_free(b);
  return s;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x48, %rsp
movq %rcx, %r15
movq %rdx, %rcx
movq %rdi, %rbx
movq %rsi, %rax
xorl %edx, %edx
divq %rcx
movq %rax, 0x40(%rsp)
movq %rcx, 0x38(%rsp)
movq %rsi, %rdi
callq 0x2483
movq %rax, %r14
movq %r15, 0x30(%rsp)
xorl %eax, %eax
cmpq $0x989680, %rbx         # imm = 0x989680
setb %al
leaq 0x1(,%rax,4), %r15
xorpd %xmm1, %xmm1
movq %r15, %r12
subq $0x1, %r12
jb 0x21a3
movq 0x40(%rsp), %rax
movq %rax, 0x10(%rsp)
movupd 0x30(%rsp), %xmm0
movupd %xmm0, (%rsp)
movl $0x186a0, %esi          # imm = 0x186A0
movq %rbx, %rdi
movq %r14, %rdx
movapd %xmm1, 0x20(%rsp)
callq 0x1dc0
unpcklpd %xmm1, %xmm0            # xmm0 = xmm0[0],xmm1[0]
movapd 0x20(%rsp), %xmm1
addpd %xmm0, %xmm1
jmp 0x2162
cvtsi2sd %r15d, %xmm0
unpcklpd %xmm0, %xmm0            # xmm0 = xmm0[0,0]
divpd %xmm0, %xmm1
movapd %xmm1, 0x20(%rsp)
movq %r14, %rdi
callq 0x275d
movaps 0x20(%rsp), %xmm0
movaps %xmm0, %xmm1
unpckhpd %xmm0, %xmm1            # xmm1 = xmm1[1],xmm0[1]
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O2/FastFilter[P]BlockBloomSimulator/src/softblockmodel.h
// Function: assessFold
void assessFold(size_t HowManyKeys, size_t BlockSizeInBits,
                          bool verbose) {
  for (size_t bitsperkey = 8; bitsperkey <= 10; bitsperkey += 1) {
    size_t bitbudget = bitsperkey * HowManyKeys;
    sim_stats_t beststats;
    size_t bestfold = findBestFold(HowManyKeys, bitbudget, BlockSizeInBits,
                                       &beststats, verbose);
    printf("bits per key %3zu best fold = %zu,  density = %0.0f %%, collision rate = "
           "%0.3f %% \n",
           bitsperkey, bestfold, beststats.density * 100, beststats.collision_rate * 100);
  }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rsi, %rbx
movq %rdi, %r14
leaq (,%rdi,8), %r15
pushq $0x8
popq %r12
leaq 0x8(%rsp), %r13
leaq 0x2127(%rip), %rbp      # 0x4329
cmpq $0xb, %r12
je 0x2250
movq %r14, %rdi
movq %r15, %rsi
movq %rbx, %rdx
movq %r13, %rcx
xorl %r8d, %r8d
callq 0x1fe0
movsd 0x10(%rsp), %xmm0
movsd 0x1e76(%rip), %xmm2     # 0x40a0
mulsd %xmm2, %xmm0
movsd 0x8(%rsp), %xmm1
mulsd %xmm2, %xmm1
movq %rbp, %rdi
movq %r12, %rsi
movq %rax, %rdx
movb $0x2, %al
callq 0x1080
incq %r12
addq %r14, %r15
jmp 0x2202
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/FastFilter[P]BlockBloomSimulator/src/blockmodel.c
// Function: main
int main() {
  printf("bits per key indicates storage (bits used per key): smaller is "
         "better\n");
  printf("best bits per bucket indicates the number of bits to check per key: "
         "smaller is better\n");
  printf("collision rate is the false negative rate: smaller is better\n");
  printf("In the 'lane' model you have one bit set per lane.\n");
  printf("\n");

  compute(1000);
  printf("==========\n\n");

  compute(1000000);
  printf("==========\n\n");

  compute(10000000);
  printf("==========\n\n");

  return EXIT_SUCCESS;
}

// Assembly:
pushq %rbx
leaq 0x2049(%rip), %rdi      # 0x444f
callq 0x1070
leaq 0x2083(%rip), %rdi      # 0x4495
callq 0x1070
leaq 0x20cd(%rip), %rdi      # 0x44eb
callq 0x1070
leaq 0x20fe(%rip), %rdi      # 0x4528
callq 0x1070
pushq $0xa
popq %rdi
callq 0x1050
movl $0x3e8, %edi            # imm = 0x3E8
callq 0x225f
leaq 0x2113(%rip), %rbx      # 0x455b
movq %rbx, %rdi
callq 0x1070
movl $0xf4240, %edi          # imm = 0xF4240
callq 0x225f
movq %rbx, %rdi
callq 0x1070
movl $0x989680, %edi         # imm = 0x989680
callq 0x225f
movq %rbx, %rdi
callq 0x1070
xorl %eax, %eax
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O2/FastFilter[P]BlockBloomSimulator/src/bitset.c
// Function: bitset_create_with_capacity
bitset_t *bitset_create_with_capacity( size_t size ) {
  bitset_t *bitset = NULL;
  /* Allocate the bitset itself. */
  if( ( bitset = (bitset_t*) malloc( sizeof( bitset_t ) ) ) == NULL ) {
      return NULL;
  }
  bitset->arraysize = (size + sizeof(uint64_t) * 8 - 1) / (sizeof(uint64_t) * 8);
  bitset->capacity = bitset->arraysize;
  if ((bitset->array = (uint64_t *) malloc(sizeof(uint64_t) * bitset->arraysize)) == NULL) {
    free( bitset);
    return NULL;
  }
  memset(bitset->array,0,sizeof(uint64_t) * bitset->arraysize);
  return bitset;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %r14
pushq $0x18
popq %rdi
callq 0x10d0
testq %rax, %rax
je 0x24c9
movq %rax, %rbx
addq $0x3f, %r14
shrq $0x6, %r14
movq %r14, 0x8(%rax)
movq %r14, 0x10(%rax)
shlq $0x3, %r14
pushq $0x1
popq %rdi
movq %r14, %rsi
callq 0x10b0
movq %rax, (%rbx)
testq %rax, %rax
jne 0x24cb
movq %rbx, %rdi
callq 0x1040
xorl %ebx, %ebx
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O2/FastFilter[P]BlockBloomSimulator/src/bitset.c
// Function: bitset_copy
bitset_t *bitset_copy( const bitset_t * bitset ) {
  bitset_t *copy = NULL;
  /* Allocate the bitset itself. */
  if( ( copy = (bitset_t*) malloc( sizeof( bitset_t ) ) ) == NULL ) {
      return NULL;
  }
  memcpy(copy,bitset,sizeof(bitset_t));
  copy->capacity = copy->arraysize;
  if ((copy->array = (uint64_t *) malloc(sizeof(uint64_t) * bitset->arraysize)) == NULL) {
    free(copy);
    return NULL;
  }
  memcpy(copy->array,bitset->array,sizeof(uint64_t) * bitset->arraysize);
  return copy;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rdi, %r14
pushq $0x18
popq %rdi
callq 0x10d0
testq %rax, %rax
je 0x2535
movq %rax, %rbx
movups (%r14), %xmm0
movups %xmm0, (%rax)
movq 0x10(%r14), %rax
movq %rax, 0x10(%rbx)
movq 0x8(%rbx), %rax
movq %rax, 0x10(%rbx)
movq 0x8(%r14), %r15
shlq $0x3, %r15
movq %r15, %rdi
callq 0x10d0
movq %rax, (%rbx)
testq %rax, %rax
je 0x252d
movq (%r14), %rsi
movq %rax, %rdi
movq %r15, %rdx
callq 0x10c0
jmp 0x2537
movq %rbx, %rdi
callq 0x1040
xorl %ebx, %ebx
movq %rbx, %rax
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O2/FastFilter[P]BlockBloomSimulator/src/bitset.c
// Function: bitset_shift_left
void bitset_shift_left(bitset_t *bitset, size_t s) {
  size_t extra_words = s / 64;
  int inword_shift = s % 64;
  size_t as = bitset->arraysize;
  if(inword_shift == 0) {
    bitset_resize(bitset,as + extra_words, false);
    // could be done with a memmove
    for(size_t i = as + extra_words ; i > extra_words; i--) {
      bitset->array[i - 1] = bitset->array[i - 1 - extra_words];
    }
  } else {
    bitset_resize(bitset,as + extra_words + 1, true);
    bitset->array[as + extra_words] =
     bitset->array[as - 1] >> (64 - inword_shift);
    for(size_t i = as + extra_words ; i >= extra_words + 2; i--) {
      bitset->array[i - 1] = (bitset->array[i - 1 - extra_words] << inword_shift)
      | (bitset->array[i - 2 - extra_words]>>(64 - inword_shift));
    }
    bitset->array[extra_words] = bitset->array[0] <<  inword_shift;
  }
  for(size_t i = 0; i < extra_words; i++) {
    bitset->array[i] = 0;
  }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %r14
movq %rdi, %rbx
movq %rsi, %r12
shrq $0x6, %r12
movq 0x8(%rdi), %r13
leaq (%r12,%r13), %r15
movl %r14d, %ebp
andl $0x3f, %ebp
je 0x2611
leaq 0x1(%r15), %rsi
pushq $0x1
popq %rdx
movq %rbx, %rdi
callq 0x2645
movq (%rbx), %rdx
movq -0x8(%rdx,%r13,8), %rsi
pushq $0x40
popq %rax
subl %ebp, %eax
negl %ebp
movl %ebp, %ecx
shrq %cl, %rsi
movq %rsi, (%rdx,%r15,8)
leaq 0x2(%r12), %rsi
andl $0x3f, %r14d
leaq -0x8(%rdx), %rdi
movq %r15, %r8
cmpq %rsi, %r8
jb 0x25e1
movq -0x8(%rdi,%r13,8), %r9
movq (%rdi,%r13,8), %r10
movl %r14d, %ecx
shlq %cl, %r10
movl %eax, %ecx
shrq %cl, %r9
decq %r8
orq %r10, %r9
movq %r9, (%rdi,%r15,8)
addq $-0x8, %rdi
jmp 0x25b8
movq (%rdx), %rax
movl %r14d, %ecx
shlq %cl, %rax
movq %rax, (%rdx,%r12,8)
xorl %eax, %eax
cmpq %rax, %r12
je 0x2602
movq (%rbx), %rcx
andq $0x0, (%rcx,%rax,8)
incq %rax
jmp 0x25f0
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rbx, %rdi
movq %r15, %rsi
xorl %edx, %edx
callq 0x2645
leaq (,%r12,8), %rax
leaq (%r12,%r13), %rcx
cmpq %r12, %rcx
jbe 0x25ee
movq (%rbx), %rcx
leaq (%rcx,%r13,8), %rdx
movq -0x8(%rcx,%r13,8), %rcx
movq %rcx, -0x8(%rax,%rdx)
decq %r13
jmp 0x2626