LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_c_makefile_star2_O3/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, %r13
incq %r13
movq %rsi, %rdi
callq 0x20b0
movq %rax, %r12
movq %r13, %rdi
movq %r15, %rsi
callq 0x2280
testq %rax, %rax
je 0x3304
movq %rax, %rbp
cmpb $0x22, -0x1(%rbp)
jne 0x32ee
cmpb $0x22, (%rbp,%r12)
jne 0x32ee
cmpb $0x3a, 0x1(%rbp,%r12)
je 0x3317
addq %r12, %rbp
movq %rbp, %rdi
movq %r15, %rsi
callq 0x2280
movq %rax, %rbp
testq %rax, %rax
jne 0x32d8
xorl %ebx, %ebx
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
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 0x332d
leaq 0x1182(%rip), %rsi      # 0x44c8
movl $0x4, %edx
movq %r13, %rdi
callq 0x2070
testl %eax, %eax
je 0x3304
movq %r13, %rdi
movl $0x7d, %esi
callq 0x20d0
movq %rax, %rbp
cmpb $0x7b, %bl
setne %al
testq %rbp, %rbp
sete %cl
orb %al, %cl
cmpb $0x1, %cl
jne 0x3395
leaq 0x12d6(%rip), %rdi      # 0x4657
xorl %ebx, %ebx
movq %r15, %rsi
movq %r13, %rdx
xorl %eax, %eax
callq 0x2924
jmp 0x3306
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 0x3306
// File: /workspace/github_c_makefile_star2_O3/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 0xf80(%rip), %rax       # 0x438d
cmovneq %rdx, %rax
testq %rcx, %rcx
je 0x3423
cmpb %sil, (%rax)
je 0x3425
incq %rax
decq %rcx
jne 0x3416
xorl %eax, %eax
retq
// File: /workspace/github_c_makefile_star2_O3/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 0x3431
movzbl %dil, %eax
movl %eax, (%rcx)
movl %edi, %eax
shrl $0x10, %eax
testq %rsi, %rsi
je 0x3445
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 0x3474
testq %r8, %r8
je 0x3462
movzbl %cl, %ecx
movl %ecx, (%r8)
testq %rdx, %rdx
je 0x3497
andl $0x3, %edi
shll $0x10, %edi
shll $0x8, %eax
orl %edi, %eax
jmp 0x3495
testq %r8, %r8
je 0x3480
movl $0xff, (%r8)
testq %rdx, %rdx
je 0x3497
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_O3/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 0x11c0(%rip), %rsi      # 0x469e
movl $0x4, %edx
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 0x34f9
movq %r14, %rdi
movl $0x3a, %esi
callq 0x20d0
testq %rax, %rax
je 0x3527
movq %rax, %r15
movq %rax, %r12
subq %rbx, %r12
incq %r15
jmp 0x3535
movq %r14, %rdi
callq 0x20b0
movq %rax, %r12
xorl %r15d, %r15d
leaq 0x1(%r12), %rdi
callq 0x2190
testq %rax, %rax
je 0x3632
movq %rax, %rbx
movq %rax, %rdi
movq %r14, %rsi
movq %r12, %rdx
callq 0x2170
movb $0x0, (%rbx,%r12)
testq %r15, %r15
leaq 0x1149(%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), %rcx
movq %rbx, %rdi
movq %r14, %rsi
callq 0x2250
testl %eax, %eax
je 0x35a3
movl %eax, %edi
callq 0x20f0
jmp 0x35f5
movq 0x8(%rsp), %r15
testq %r15, %r15
je 0x35e9
movl 0x4(%r15), %edi
movl 0x8(%r15), %esi
movl 0xc(%r15), %edx
callq 0x22c0
cmpl $-0x1, %eax
je 0x35e3
movl %eax, %ebp
movq 0x8(%rsp), %rax
movq 0x18(%rax), %rsi
movl 0x10(%rax), %edx
movl %ebp, %edi
callq 0x2230
testl %eax, %eax
je 0x3611
movl %ebp, %edi
callq 0x2130
movq 0x28(%r15), %r15
jmp 0x35a8
callq 0x2050
movl (%rax), %edi
callq 0x2260
leaq 0xf91(%rip), %rdi       # 0x458d
movq %rbx, %rsi
movq %r14, %rdx
movq %rax, %rcx
xorl %eax, %eax
callq 0x2924
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
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 0x106a(%rip), %rdi      # 0x46a3
callq 0x2a67
// File: /workspace/github_c_makefile_star2_O3/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 0x365f
leal -0x41(%rbx), %eax
cmpb $0x5, %al
ja 0x3664
addb $-0x37, %bl
jmp 0x3677
addb $-0x30, %bl
jmp 0x3677
leal -0x61(%rbx), %eax
addb $-0x57, %bl
cmpb $0x6, %al
movzbl %bl, %eax
movl $0x10, %ebx
cmovbl %eax, %ebx
movl %ebx, %eax
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O3/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
movl $0x1, %ebx
testb %al, %al
je 0x36d4
movb 0x1(%r12), %r13b
testb %r13b, %r13b
je 0x36d4
movq %rsi, %r14
movq %rdi, %r15
movsbl %al, %edi
callq 0x363e
cmpb $0xf, %al
ja 0x36d4
movl %eax, %ebp
movsbl %r13b, %edi
callq 0x363e
cmpb $0xf, %al
ja 0x36d4
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_O3/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
movl $0x5, %r12d
movl %ebp, %edi
movq %r14, %rsi
movq %rbx, %rdx
callq 0x20a0
cmpq $-0x1, %rax
jne 0x38f8
callq 0x2050
movl (%rax), %edi
cmpl $0xb, %edi
jne 0x3907
movq %rax, %r15
movl $0x61a8, %edi           # imm = 0x61A8
callq 0x22a0
testq %rbx, %rbx
je 0x3904
leal -0x1(%r12), %eax
testl %r12d, %r12d
movl %eax, %r12d
jg 0x38b8
jmp 0x3904
addq %rax, %r14
subq %rax, %rbx
jne 0x38b8
xorl %eax, %eax
jmp 0x3922
movl (%r15), %edi
callq 0x2260
leaq 0xce4(%rip), %rdi       # 0x45f7
movq %rax, %rsi
xorl %eax, %eax
callq 0x2924
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/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
movq %r15, %rsi
movl $0xa, %edx
callq 0x2160
movq (%r15), %rcx
cmpq (%rbx), %rcx
cmovel %ebp, %eax
movl %eax, (%r14)
movq %rcx, (%rbx)
movzbl (%rcx), %eax
testl %eax, %eax
je 0x396e
cmpl $0x2c, %eax
jne 0x3972
incq %rcx
movq %rcx, (%rbx)
movb $0x1, %al
jmp 0x3974
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/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 0x2793
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, 0x28(%rsp)
cvtsi2sd %eax, %xmm0
movsd %xmm0, 0x20(%rsp)
movl $0x1, %ebp
movq %rbp, 0x40(%rsp)
xorps %xmm2, %xmm2
movq 0x28(%rsp), %r13
xorps %xmm3, %xmm3
movsd %xmm3, 0x30(%rsp)
movsd %xmm2, 0x38(%rsp)
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
callq 0x1281
movsd 0x30(%rsp), %xmm3
movsd 0x38(%rsp), %xmm2
addsd %xmm1, %xmm3
addsd %xmm0, %xmm2
decq %r13
jne 0x1586
divsd 0x20(%rsp), %xmm2
movapd %xmm2, %xmm0
mulsd 0x2a9e(%rip), %xmm0     # 0x4080
movsd (%rbx), %xmm1
ucomisd %xmm0, %xmm1
jbe 0x15fe
divsd 0x20(%rsp), %xmm3
movsd %xmm2, (%rbx)
movsd %xmm3, 0x8(%rbx)
movq %rbp, %r15
incq %rbp
cmpq $0x11, %rbp
setb %al
cmpq %rbp, %r15
sete %cl
orb %al, %cl
jne 0x1576
movq %r12, %rdi
callq 0x2a95
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_O3/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
movl $0x4, %r12d
addq $0x4, %r12
movq %r14, %rdi
movq %r15, %rsi
movq %rbx, %rdx
leaq 0x10(%rsp), %rcx
xorl %r8d, %r8d
callq 0x150a
movq %rax, %r13
movq %rax, %xmm0
punpckldq 0x298c(%rip), %xmm0 # xmm0 = xmm0[0],mem[0],xmm0[1],mem[1]
subpd 0x2994(%rip), %xmm0     # 0x4020
movapd %xmm0, %xmm1
unpckhpd %xmm0, %xmm1            # xmm1 = xmm1[1],xmm0[1]
addsd %xmm0, %xmm1
xorps %xmm0, %xmm0
cvtsi2sd %r12, %xmm0
movsd %xmm0, (%rsp)
divsd %xmm0, %xmm1
movapd %xmm1, 0x20(%rsp)
movsd 0x10(%rsp), %xmm1
movsd %xmm1, 0x8(%rsp)
movsd 0x29c5(%rip), %xmm0     # 0x4088
divsd %xmm1, %xmm0
callq 0x10a0
divsd 0x29bc(%rip), %xmm0     # 0x4090
movsd (%rsp), %xmm3
divsd %xmm0, %xmm3
addsd 0x29b3(%rip), %xmm3     # 0x4098
movsd 0x29b3(%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 0x299a(%rip), %rdi      # 0x40b0
movq %r12, %rsi
movq %r13, %rdx
movb $0x4, %al
callq 0x1080
addq %rbp, %r15
cmpq $0xd, %r12
jb 0x165a
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/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 0x28bc(%rip), %xmm0 # xmm0 = xmm0[0],mem[0],xmm0[1],mem[1]
subpd 0x28c4(%rip), %xmm0     # 0x4020
movapd %xmm0, %xmm1
unpckhpd %xmm0, %xmm1            # xmm1 = xmm1[1],xmm0[1]
addsd %xmm0, %xmm1
movsd 0x2920(%rip), %xmm2     # 0x4090
mulsd %xmm1, %xmm2
movapd %xmm2, 0x10(%rsp)
movapd %xmm2, %xmm0
divsd %xmm1, %xmm0
movapd %xmm0, (%rsp)
movapd 0x28e1(%rip), %xmm0     # 0x4070
xorpd %xmm2, %xmm0
callq 0x1030
movsd 0x2900(%rip), %xmm2     # 0x40a0
movapd (%rsp), %xmm1
mulsd %xmm2, %xmm1
mulsd %xmm0, %xmm2
leaq 0x298b(%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_O3/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 %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movq %rdi, %rbx
leaq (,%rdi,8), %r14
movl $0x8, %r15d
leaq 0x10(%rsp), %r12
leaq 0x29b9(%rip), %r13      # 0x41ac
leaq 0x2945(%rip), %rbp      # 0x413f
movq %rbx, %rdi
movq %r14, %rsi
movq %r14, %rdx
movq %r12, %rcx
xorl %r8d, %r8d
callq 0x150a
movq %rax, %xmm0
punpckldq 0x27f5(%rip), %xmm0 # xmm0 = xmm0[0],mem[0],xmm0[1],mem[1]
subpd 0x27fd(%rip), %xmm0     # 0x4020
testq %rax, %rax
js 0x1832
xorps %xmm2, %xmm2
cvtsi2ss %rax, %xmm2
jmp 0x184a
movq %rax, %rcx
shrq %rcx
andl $0x1, %eax
orq %rcx, %rax
xorps %xmm2, %xmm2
cvtsi2ss %rax, %xmm2
addss %xmm2, %xmm2
movapd %xmm0, %xmm1
unpckhpd %xmm0, %xmm1            # xmm1 = xmm1[1],xmm0[1]
xorps %xmm3, %xmm3
cvtsi2sd %r15, %xmm3
movsd %xmm3, (%rsp)
addsd %xmm0, %xmm1
divsd %xmm3, %xmm1
xorps %xmm0, %xmm0
cvtss2sd %xmm2, %xmm0
movsd 0x282a(%rip), %xmm4     # 0x40a0
mulsd %xmm4, %xmm1
movsd 0x18(%rsp), %xmm2
mulsd %xmm4, %xmm2
movsd 0x10(%rsp), %xmm3
mulsd %xmm4, %xmm3
movq %r13, %rdi
movq %r15, %rsi
movb $0x4, %al
callq 0x1080
movsd (%rsp), %xmm0
movapd %xmm0, %xmm1
mulsd 0x27e4(%rip), %xmm1     # 0x4090
movapd %xmm1, 0x20(%rsp)
movapd %xmm1, %xmm2
divsd %xmm0, %xmm2
movapd %xmm2, (%rsp)
movapd %xmm1, %xmm0
xorpd 0x27a5(%rip), %xmm0     # 0x4070
callq 0x1030
movapd %xmm0, %xmm2
movsd 0x27c4(%rip), %xmm0     # 0x40a0
movapd (%rsp), %xmm1
mulsd %xmm0, %xmm1
mulsd %xmm0, %xmm2
movq %rbp, %rdi
movq %r15, %rsi
movaps 0x20(%rsp), %xmm0
movb $0x3, %al
callq 0x1080
incq %r15
addq %rbx, %r14
cmpq $0x11, %r15
jne 0x17fa
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/FastFilter[P]BlockBloomSimulator/src/laneblockmodel.h
// Function: findBestLaneSize
size_t findBestLaneSize(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 BestLanes = 0;
  size_t valid_lanes[] = {8, 16, 32, 64};
  for (size_t laneindex = 0;
       laneindex < sizeof(valid_lanes) / sizeof(valid_lanes[0]); laneindex++) {
    size_t lanesize = valid_lanes[laneindex];
    if (lanesize > m.BlockSizeInBits)
      continue;
    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;
    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;
      BestLanes = lanesize;
    }
  }
  bitset_free(b);
  return BestLanes;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x68, %rsp
movq %rcx, %rbx
movq %rdx, %r14
movq %rdi, %r15
movq $0x0, 0x18(%rsp)
movq %rsi, %rax
xorl %edx, %edx
divq %r14
movq %rax, 0x60(%rsp)
movq %r14, 0x58(%rsp)
movq %rsi, %rdi
callq 0x2793
movq %r14, %rdx
movq %rax, %r13
movabsq $0x3ff0000000000000, %rax # imm = 0x3FF0000000000000
xorl %ecx, %ecx
cmpq $0x989680, %r15         # imm = 0x989680
setb %cl
leaq 0x1(,%rcx,4), %rcx
movq %rcx, 0x38(%rsp)
cvtsi2sd %ecx, %xmm0
movsd %xmm0, 0x20(%rsp)
movq %rbx, 0x28(%rsp)
movq %rax, (%rbx)
leaq 0x28f6(%rip), %r14      # 0x4570
xorl %r12d, %r12d
movq %rdx, 0x30(%rsp)
movq (%r14,%r12,8), %rbp
cmpq %rdx, %rbp
ja 0x1d30
movq %rdx, %rax
xorl %edx, %edx
divq %rbp
movq %rax, 0x50(%rsp)
xorps %xmm2, %xmm2
movq 0x38(%rsp), %rbx
xorps %xmm3, %xmm3
movsd %xmm3, 0x40(%rsp)
movsd %xmm2, 0x48(%rsp)
movq 0x60(%rsp), %rax
movq %rax, 0x10(%rsp)
movupd 0x50(%rsp), %xmm0
movupd %xmm0, (%rsp)
movl $0x186a0, %esi          # imm = 0x186A0
movq %r15, %rdi
movq %r13, %rdx
callq 0x191a
movsd 0x40(%rsp), %xmm3
movsd 0x48(%rsp), %xmm2
addsd %xmm1, %xmm3
addsd %xmm0, %xmm2
decq %rbx
jne 0x1ca7
divsd 0x20(%rsp), %xmm2
movapd %xmm2, %xmm0
mulsd 0x237d(%rip), %xmm0     # 0x4080
movq 0x28(%rsp), %rax
movsd (%rax), %xmm1
ucomisd %xmm0, %xmm1
movq 0x30(%rsp), %rdx
jbe 0x1d30
divsd 0x20(%rsp), %xmm3
movq 0x28(%rsp), %rax
movsd %xmm2, (%rax)
movsd %xmm3, 0x8(%rax)
movq %rbp, 0x18(%rsp)
incq %r12
cmpq $0x4, %r12
jne 0x1c82
movq %r13, %rdi
callq 0x2a95
movq 0x18(%rsp), %rax
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/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 0x2793
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
movapd %xmm1, 0x20(%rsp)
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
callq 0x191a
unpcklpd %xmm1, %xmm0            # xmm0 = xmm0[0],xmm1[0]
movapd 0x20(%rsp), %xmm1
addpd %xmm0, %xmm1
decq %r12
jne 0x1db2
xorps %xmm0, %xmm0
cvtsi2sd %r15d, %xmm0
unpcklpd %xmm0, %xmm0            # xmm0 = xmm0[0,0]
divpd %xmm0, %xmm1
movapd %xmm1, 0x20(%rsp)
movq %r14, %rdi
callq 0x2a95
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_O3/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
movq $0x0, 0x20(%rsp)
movq %rsi, %rax
xorl %edx, %edx
divq %rcx
movq %rax, 0x50(%rsp)
movq %rcx, 0x48(%rsp)
movq %rsi, %rdi
callq 0x2793
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), %r15
cvtsi2sd %r15d, %xmm0
movsd %xmm0, 0x28(%rsp)
xorl %ebp, %ebp
movq %rbp, 0x40(%rsp)
xorps %xmm2, %xmm2
movq %r15, %r13
xorps %xmm3, %xmm3
movsd %xmm3, 0x30(%rsp)
movsd %xmm2, 0x38(%rsp)
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
callq 0x1f82
movsd 0x30(%rsp), %xmm3
movsd 0x38(%rsp), %xmm2
addsd %xmm1, %xmm3
addsd %xmm0, %xmm2
decq %r13
jne 0x236e
divsd 0x28(%rsp), %xmm2
movapd %xmm2, %xmm0
mulsd 0x1cb6(%rip), %xmm0     # 0x4080
movsd (%rbx), %xmm1
ucomisd %xmm0, %xmm1
jbe 0x23e8
divsd 0x28(%rsp), %xmm3
movsd %xmm2, (%rbx)
movsd %xmm3, 0x8(%rbx)
movq %rbp, 0x20(%rsp)
incq %rbp
cmpq $0x11, %rbp
jne 0x2360
movq %r12, %rdi
callq 0x2a95
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_O3/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 0x2793
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
movapd %xmm1, 0x20(%rsp)
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
callq 0x1f82
unpcklpd %xmm1, %xmm0            # xmm0 = xmm0[0],xmm1[0]
movapd 0x20(%rsp), %xmm1
addpd %xmm0, %xmm1
decq %r12
jne 0x2462
xorps %xmm0, %xmm0
cvtsi2sd %r15d, %xmm0
unpcklpd %xmm0, %xmm0            # xmm0 = xmm0[0,0]
divpd %xmm0, %xmm1
movapd %xmm1, 0x20(%rsp)
movq %r14, %rdi
callq 0x2a95
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_O3/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
movl $0x8, %r12d
leaq 0x8(%rsp), %r13
leaq 0x1e25(%rip), %rbp      # 0x4329
movq %r14, %rdi
movq %r15, %rsi
movq %rbx, %rdx
movq %r13, %rcx
xorl %r8d, %r8d
callq 0x22f5
movsd 0x10(%rsp), %xmm0
movsd 0x1b7a(%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
cmpq $0xb, %r12
jne 0x2504
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/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 0x1d40(%rip), %rdi      # 0x444f
callq 0x1070
leaq 0x1d7a(%rip), %rdi      # 0x4495
callq 0x1070
leaq 0x1dc4(%rip), %rdi      # 0x44eb
callq 0x1070
leaq 0x1df5(%rip), %rdi      # 0x4528
callq 0x1070
movl $0xa, %edi
callq 0x1050
movl $0x3e8, %edi            # imm = 0x3E8
callq 0x255f
leaq 0x1e08(%rip), %rbx      # 0x455b
movq %rbx, %rdi
callq 0x1070
movl $0xf4240, %edi          # imm = 0xF4240
callq 0x255f
movq %rbx, %rdi
callq 0x1070
movl $0x989680, %edi         # imm = 0x989680
callq 0x255f
movq %rbx, %rdi
callq 0x1070
xorl %eax, %eax
popq %rbx
retq
nop
// File: /workspace/github_c_makefile_star2_O3/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
movl $0x18, %edi
callq 0x10d0
testq %rax, %rax
je 0x27dd
movq %rax, %rbx
addq $0x3f, %r14
shrq $0x6, %r14
movq %r14, 0x8(%rax)
movq %r14, 0x10(%rax)
shlq $0x3, %r14
movl $0x1, %edi
movq %r14, %rsi
callq 0x10b0
movq %rax, (%rbx)
testq %rax, %rax
jne 0x27df
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_O3/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
movl $0x18, %edi
callq 0x10d0
testq %rax, %rax
je 0x284b
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 0x2843
movq (%r14), %rsi
movq %rax, %rdi
movq %r15, %rdx
callq 0x10c0
jmp 0x284d
movq %rbx, %rdi
callq 0x1040
xorl %ebx, %ebx
movq %rbx, %rax
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O3/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, %r15
movq %rdi, %r14
movq %rsi, %rbx
shrq $0x6, %rbx
movq 0x8(%rdi), %r13
leaq (%rbx,%r13), %r12
movl %r15d, %ebp
andl $0x3f, %ebp
je 0x2909
leaq 0x1(%r12), %rsi
movq %r14, %rdi
movl $0x1, %edx
callq 0x296e
movq (%r14), %rsi
movq -0x8(%rsi,%r13,8), %rax
movl %ebp, %ecx
negl %ecx
shrq %cl, %rax
movq %rax, (%rsi,%r12,8)
leaq 0x2(%rbx), %rdi
movl %r15d, %eax
andl $0x3f, %eax
cmpq %rdi, %r12
jb 0x28fb
movl $0x40, %edx
subl %ebp, %edx
leaq (%rsi,%r13,8), %r8
addq $-0x8, %r8
movq -0x8(%r8), %r9
movq (%r8), %r10
movl %eax, %ecx
shlq %cl, %r10
addq $-0x8, %r8
movl %edx, %ecx
shrq %cl, %r9
orq %r10, %r9
movq %r9, -0x8(%rsi,%r12,8)
decq %r12
cmpq %rdi, %r12
jae 0x28d6
movq (%rsi), %rdx
movl %eax, %ecx
shlq %cl, %rdx
movq %rdx, (%rsi,%rbx,8)
jmp 0x293a
movq %r14, %rdi
movq %r12, %rsi
xorl %edx, %edx
callq 0x296e
cmpq %rbx, %r12
jbe 0x293a
movq (%r14), %rax
leaq (%rax,%r13,8), %rcx
addq $-0x8, %rcx
movq (%rcx), %rdx
movq %rdx, -0x8(%rax,%r12,8)
decq %r12
addq $-0x8, %rcx
cmpq %rbx, %r12
ja 0x2926
cmpq $0x40, %r15
jae 0x294f
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq (%r14), %rdi
shlq $0x3, %rbx
xorl %esi, %esi
movq %rbx, %rdx
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x1090
// File: /workspace/github_c_makefile_star2_O3/FastFilter[P]BlockBloomSimulator/src/bitset.c
// Function: bitset_resize
bool bitset_resize( bitset_t *bitset,  size_t newarraysize, bool padwithzeroes ) {
  size_t smallest = newarraysize < bitset->arraysize ? newarraysize : bitset->arraysize;
  if (bitset->capacity < newarraysize) {
    uint64_t *newarray;
    bitset->capacity = newarraysize * 2;
    if ((newarray = (uint64_t *) realloc(bitset->array, sizeof(uint64_t) * bitset->capacity)) == NULL) {
      free(bitset->array);
      return false;
    }
    bitset->array = newarray;
  }
  if (padwithzeroes && (newarraysize > smallest))
    memset(bitset->array + smallest,0,sizeof(uint64_t) * (newarraysize - smallest));
  bitset->arraysize = newarraysize;
  return true; // success!
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movl %edx, %ebp
movq %rsi, %r14
movq %rdi, %rbx
movq 0x8(%rdi), %r12
cmpq %rsi, %r12
movq %rsi, %r15
cmovbq %r12, %r15
cmpq %rsi, 0x10(%rdi)
jae 0x29b1
leaq (%r14,%r14), %rax
movq %rax, 0x10(%rbx)
movq (%rbx), %rdi
movq %r14, %rsi
shlq $0x4, %rsi
callq 0x10e0
testq %rax, %rax
je 0x29e9
movq %rax, (%rbx)
cmpq %r14, %r12
setb %al
andb %bpl, %al
cmpb $0x1, %al
jne 0x29da
leaq (,%r15,8), %rdi
addq (%rbx), %rdi
movq %r14, %rdx
subq %r15, %rdx
shlq $0x3, %rdx
xorl %esi, %esi
callq 0x1090
movq %r14, 0x8(%rbx)
movb $0x1, %al
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
movq (%rbx), %rdi
callq 0x1040
xorl %eax, %eax
jmp 0x29e0
// File: /workspace/github_c_makefile_star2_O3/FastFilter[P]BlockBloomSimulator/src/bitset.c
// Function: bitset_shift_right
void bitset_shift_right(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) {
    // could be done with a memmove
    for(size_t i = 0 ; i < as - extra_words; i++) {
      bitset->array[i] = bitset->array[i + extra_words];
    }
    bitset_resize(bitset,as - extra_words, false);

  } else {
    for(size_t i = 0 ; i + extra_words + 1 < as ; i++) {
      bitset->array[i] = (bitset->array[i + extra_words] >> inword_shift)
      | (bitset->array[i + extra_words + 1] << (64 - inword_shift));
    }
    bitset->array[as - extra_words - 1] = (bitset->array[as - 1] >> inword_shift);
    bitset_resize(bitset,as - extra_words , false);
  }
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rsi, %rax
movq %rsi, %r8
shrq $0x6, %r8
movl %eax, %ecx
movq 0x8(%rdi), %rsi
andl $0x3f, %ecx
je 0x2a6e
leaq 0x1(%r8), %rdx
andl $0x3f, %eax
movq (%rdi), %r9
cmpq %rsi, %rdx
jae 0x2a5a
movl $0x40, %edx
subl %ecx, %edx
movq %r8, %r10
notq %r10
addq %rsi, %r10
leaq (%r9,%r8,8), %r11
addq $0x8, %r11
xorl %ebx, %ebx
movq -0x8(%r11,%rbx,8), %r14
movq (%r11,%rbx,8), %r15
movl %eax, %ecx
shrq %cl, %r14
movl %edx, %ecx
shlq %cl, %r15
orq %r14, %r15
movq %r15, (%r9,%rbx,8)
incq %rbx
cmpq %rbx, %r10
jne 0x2a38
movq -0x8(%r9,%rsi,8), %rdx
movl %eax, %ecx
shrq %cl, %rdx
subq %r8, %rsi
movq %rdx, -0x8(%r9,%rsi,8)
jmp 0x2a89
subq %r8, %rsi
je 0x2a89
movq (%rdi), %rax
movq %rsi, %rcx
movq (%rax,%r8,8), %rdx
movq %rdx, (%rax)
addq $0x8, %rax
decq %rcx
jne 0x2a79
xorl %edx, %edx
popq %rbx
popq %r14
popq %r15
jmp 0x296e
// File: /workspace/github_c_makefile_star2_O3/FastFilter[P]BlockBloomSimulator/src/bitset.c
// Function: bitset_inplace_union
bool bitset_inplace_union(bitset_t * restrict b1, const bitset_t * restrict b2) {
  size_t minlength = b1->arraysize < b2->arraysize ? b1->arraysize : b2->arraysize;
  for(size_t k = 0 ; k < minlength; ++k) {
    b1->array[k] |= b2->array[k];
  }
  if(b2->arraysize > b1->arraysize) {
     size_t oldsize = b1->arraysize;
     if(!bitset_resize( b1, b2->arraysize, false)) return false;
     memcpy(b1->array + oldsize, b2->array + oldsize, (b2->arraysize - oldsize) * sizeof(uint64_t));
  }
  return true;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %rsi, %r14
movq %rdi, %r15
movq 0x8(%rdi), %rbx
movq 0x8(%rsi), %rsi
cmpq %rsi, %rbx
movq %rsi, %rax
cmovbq %rbx, %rax
testq %rax, %rax
je 0x2da2
movq (%r14), %rcx
movq (%r15), %rdx
xorl %edi, %edi
movq (%rcx,%rdi,8), %r8
orq %r8, (%rdx,%rdi,8)
incq %rdi
cmpq %rdi, %rax
jne 0x2d92
movb $0x1, %bpl
movq %rsi, %r12
subq %rbx, %r12
jbe 0x2ddc
xorl %ebp, %ebp
movq %r15, %rdi
xorl %edx, %edx
callq 0x296e
testb %al, %al
je 0x2ddc
shlq $0x3, %rbx
movq (%r15), %rdi
addq %rbx, %rdi
addq (%r14), %rbx
shlq $0x3, %r12
movq %rbx, %rsi
movq %r12, %rdx
callq 0x10c0
movb $0x1, %bpl
movl %ebp, %eax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/FastFilter[P]BlockBloomSimulator/src/bitset.c
// Function: bitset_minimum
size_t bitset_minimum(const bitset_t *bitset) {
  for(size_t k = 0; k < bitset->arraysize; k++) {
    uint64_t w = bitset->array[k];
    if ( w != 0 ) {
      return __builtin_ctzll(w) + k * 64;
    }
  }
  return 0;
}

// Assembly:
movq 0x8(%rdi), %rcx
testq %rcx, %rcx
je 0x2e0f
movq (%rdi), %rsi
xorl %eax, %eax
xorl %edx, %edx
xorl %edi, %edi
movq (%rsi,%rdi,8), %r8
testq %r8, %r8
jne 0x2e12
incq %rdi
addq $-0x40, %rdx
cmpq %rdi, %rcx
jne 0x2df9
retq
xorl %eax, %eax
retq
bsfq %r8, %rax
subq %rdx, %rax
retq
// File: /workspace/github_c_makefile_star2_O3/FastFilter[P]BlockBloomSimulator/src/bitset.c
// Function: bitset_inplace_intersection
void bitset_inplace_intersection(bitset_t * restrict b1, const bitset_t * restrict b2) {
  size_t minlength = b1->arraysize < b2->arraysize ? b1->arraysize : b2->arraysize;
  size_t k = 0;
  for( ; k < minlength; ++k) {
    b1->array[k] &= b2->array[k];
  }
  for(; k < b1->arraysize; ++k) {
    b1->array[k] = 0; // memset could, maybe, be a tiny bit faster
  }
}

// Assembly:
movq 0x8(%rdi), %rdx
movq 0x8(%rsi), %rax
cmpq %rax, %rdx
movq %rax, %rcx
cmovbq %rdx, %rcx
testq %rcx, %rcx
je 0x32b5
movq (%rsi), %rsi
movq (%rdi), %r8
xorl %r9d, %r9d
movq (%rsi,%r9,8), %r10
andq %r10, (%r8,%r9,8)
incq %r9
cmpq %r9, %rcx
jne 0x32a5
cmpq %rdx, %rax
jae 0x32d6
leaq (,%rcx,8), %rax
addq (%rdi), %rax
subq %rcx, %rdx
shlq $0x3, %rdx
movq %rax, %rdi
xorl %esi, %esi
jmp 0x1090
retq
// File: /workspace/github_c_makefile_star2_O3/FastFilter[P]BlockBloomSimulator/src/bitset.c
// Function: bitset_inplace_difference
void bitset_inplace_difference(bitset_t *restrict b1, const bitset_t * restrict b2) {
  size_t minlength = b1->arraysize < b2->arraysize ? b1->arraysize : b2->arraysize;
  size_t k = 0;
  for( ; k < minlength; ++k) {
    b1->array[k] &= ~ (b2->array[k]);
  }
}

// Assembly:
movq 0x8(%rdi), %rcx
movq 0x8(%rsi), %rax
cmpq %rax, %rcx
cmovbq %rcx, %rax
testq %rax, %rax
je 0x339a
movq (%rsi), %rcx
movq (%rdi), %rdx
xorl %esi, %esi
movq (%rcx,%rsi,8), %rdi
notq %rdi
andq %rdi, (%rdx,%rsi,8)
incq %rsi
cmpq %rsi, %rax
jne 0x3387
retq
// File: /workspace/github_c_makefile_star2_O3/FastFilter[P]BlockBloomSimulator/src/bitset.c
// Function: bitset_difference_count
size_t  bitset_difference_count(const bitset_t *restrict b1, const bitset_t * restrict b2) {
  size_t minlength = b1->arraysize < b2->arraysize ? b1->arraysize : b2->arraysize;
  size_t k = 0;
  size_t answer = 0;
  for( ; k < minlength; ++k) {
    answer += __builtin_popcountll (b1->array[k] & ~ (b2->array[k]));
  }
  for( ; k < b1->arraysize ; ++k) {
    answer += __builtin_popcountll (b1->array[k]);
  }
  return answer;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movq 0x8(%rdi), %rcx
movq 0x8(%rsi), %rbx
cmpq %rbx, %rcx
movq %rbx, %rdx
cmovbq %rcx, %rdx
movabsq $0x5555555555555555, %r8 # imm = 0x5555555555555555
movabsq $0x3333333333333333, %r9 # imm = 0x3333333333333333
movabsq $0xf0f0f0f0f0f0f0f, %r10 # imm = 0xF0F0F0F0F0F0F0F
movabsq $0x101010101010101, %r11 # imm = 0x101010101010101
testq %rdx, %rdx
je 0x3437
movq (%rdi), %r14
movq (%rsi), %rsi
xorl %eax, %eax
xorl %r15d, %r15d
movq (%rsi,%r15,8), %r12
notq %r12
andq (%r14,%r15,8), %r12
movq %r12, %r13
shrq %r13
andq %r8, %r13
subq %r13, %r12
movq %r12, %r13
andq %r9, %r13
shrq $0x2, %r12
andq %r9, %r12
addq %r13, %r12
movq %r12, %r13
shrq $0x4, %r13
addq %r12, %r13
andq %r10, %r13
imulq %r11, %r13
shrq $0x38, %r13
addq %r13, %rax
incq %r15
cmpq %r15, %rdx
jne 0x33ee
jmp 0x3439
xorl %eax, %eax
cmpq %rcx, %rbx
jae 0x3481
movq (%rdi), %rsi
movq (%rsi,%rdx,8), %rdi
movq %rdi, %rbx
shrq %rbx
andq %r8, %rbx
subq %rbx, %rdi
movq %rdi, %rbx
andq %r9, %rbx
shrq $0x2, %rdi
andq %r9, %rdi
addq %rbx, %rdi
movq %rdi, %rbx
shrq $0x4, %rbx
addq %rdi, %rbx
andq %r10, %rbx
imulq %r11, %rbx
shrq $0x38, %rbx
addq %rbx, %rax
incq %rdx
cmpq %rdx, %rcx
jne 0x3441
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O3/FastFilter[P]BlockBloomSimulator/src/bitset.c
// Function: bitset_inplace_symmetric_difference
bool bitset_inplace_symmetric_difference(bitset_t *restrict b1, const bitset_t * restrict b2) {
  size_t minlength = b1->arraysize < b2->arraysize ? b1->arraysize : b2->arraysize;
  size_t k = 0;
  for( ; k < minlength; ++k) {
    b1->array[k] ^= b2->array[k];
  }
  if(b2->arraysize > b1->arraysize) {
     size_t oldsize = b1->arraysize;
     if(!bitset_resize( b1, b2->arraysize, false)) return false;
     memcpy(b1->array + oldsize, b2->array + oldsize, (b2->arraysize - oldsize) * sizeof(uint64_t));
  }
  return true;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %rsi, %r14
movq %rdi, %r15
movq 0x8(%rdi), %rbx
movq 0x8(%rsi), %rsi
cmpq %rsi, %rbx
movq %rsi, %rax
cmovbq %rbx, %rax
testq %rax, %rax
je 0x34c8
movq (%r14), %rcx
movq (%r15), %rdx
xorl %edi, %edi
movq (%rcx,%rdi,8), %r8
xorq %r8, (%rdx,%rdi,8)
incq %rdi
cmpq %rdi, %rax
jne 0x34b8
movb $0x1, %bpl
movq %rsi, %r12
subq %rbx, %r12
jbe 0x3502
xorl %ebp, %ebp
movq %r15, %rdi
xorl %edx, %edx
callq 0x296e
testb %al, %al
je 0x3502
shlq $0x3, %rbx
movq (%r15), %rdi
addq %rbx, %rdi
addq (%r14), %rbx
shlq $0x3, %r12
movq %rbx, %rsi
movq %r12, %rdx
callq 0x10c0
movb $0x1, %bpl
movl %ebp, %eax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq