LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_cpp_makefile_star2_O2/rocket323[P]fishdb/./pager.cpp
// Function: fishdb::Pager::WritePage(std::shared_ptr<fishdb::MemPage>)
void Pager::WritePage(std::shared_ptr<MemPage> mp)
{
    int64_t page_no = mp->header.page_no;
    auto header = &mp->header;
    int64_t offset = page_no * PG_SIZE;
    if (offset + PG_SIZE > m_file_size)
    {
        ftruncate(fileno(m_file), offset + PG_SIZE);
        m_file_size = offset + PG_SIZE;
    }

    assert(mp->data.size() <= PAGE_CAPA);
    fseek(m_file, offset, SEEK_SET);
    fwrite((void *)header, sizeof(PageHeader), 1, m_file);
    int len = std::min((int)PAGE_CAPA, (int)mp->data.size());
    fwrite((void *)mp->data.c_str(), len, 1, m_file);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %r14
movq %rdi, %rbx
movq (%rsi), %r15
movq (%r15), %r12
shlq $0x9, %r12
leaq 0x200(%r12), %r13
movq %r15, %rax
cmpq 0x40(%rdi), %r13
jle 0x61b3
movq 0x38(%rbx), %rdi
callq 0x2210
movl %eax, %edi
movq %r13, %rsi
callq 0x2290
movq %r13, 0x40(%rbx)
movq (%r14), %rax
cmpq $0x1d9, 0x30(%rax)      # imm = 0x1D9
jae 0x6212
movq 0x38(%rbx), %rdi
movq %r12, %rsi
xorl %edx, %edx
callq 0x2220
movq 0x38(%rbx), %rcx
pushq $0x28
popq %rsi
pushq $0x1
popq %r12
movq %r15, %rdi
movq %r12, %rdx
callq 0x2330
movq (%r14), %rax
movl 0x30(%rax), %ecx
movl $0x1d8, %edx            # imm = 0x1D8
cmpl %edx, %ecx
cmovll %ecx, %edx
movq 0x28(%rax), %rdi
movslq %edx, %rsi
movq 0x38(%rbx), %rcx
movq %r12, %rdx
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x2330
leaq 0x12a4(%rip), %rdi      # 0x74bd
leaq 0x114f(%rip), %rsi      # 0x736f
leaq 0x12b3(%rip), %rcx      # 0x74da
movl $0xdc, %edx
callq 0x2140
nop
// File: /workspace/github_cpp_makefile_star2_O2/rocket323[P]fishdb/./pager.cpp
// Function: fishdb::Pager::FreePage(std::shared_ptr<fishdb::MemPage>)
void Pager::FreePage(std::shared_ptr<MemPage> mp)
{
    while (mp)
    {
        auto header = mp->header;
        int64_t of_page_no = header.of_page_no;
        header.type = FREE_PAGE;
        header.of_page_no = -1;
        header.data_size = 0;
        header.page_cnt = 1;
        header.next_free = m_db_header->free_list;
        m_db_header->free_list = header.page_no;
        WritePage(mp);
        mp = ReadPage(of_page_no);
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rsi, %rbx
movq %rdi, %r14
leaq -0x48(%rbp), %r13
leaq -0x38(%rbp), %r15
movq (%rbx), %rax
testq %rax, %rax
je 0x62aa
movq (%rax), %rcx
movq 0x18(%rax), %r12
movq 0x30(%r14), %rax
movq %rcx, (%rax)
movq %r13, %rdi
movq %rbx, %rsi
callq 0x2ee6
movq %r14, %rdi
movq %r13, %rsi
callq 0x616a
leaq -0x40(%rbp), %rdi
callq 0x2688
movq %r15, %rdi
movq %r14, %rsi
movq %r12, %rdx
callq 0x5d7e
movq %rbx, %rdi
movq %r15, %rsi
callq 0x30d2
leaq -0x30(%rbp), %rdi
callq 0x2688
jmp 0x6251
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/rocket323[P]fishdb/./page.cpp
// Function: fishdb::MemPage::Serialize(char*, int&)
void MemPage::Serialize(char *buf, int &size)
{
    char *sp = buf;
    header.is_leaf = is_leaf;
    memcpy(buf, (char *)&header, sizeof(PageHeader));
    buf += sizeof(PageHeader);

    buf += EncodeInt32(buf, children.size());
    for (size_t i = 0; i < children.size(); ++i)
        buf += EncodeInt64(buf, children[i]);

    buf += EncodeInt32(buf, kvs.size());
    for (size_t i = 0; i < kvs.size(); ++i)
    {
        buf += EncodeString(buf, kvs[i].key);
        buf += EncodeString(buf, kvs[i].value);
    }
    size = buf - sp;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rdx, -0x38(%rbp)
movq %rsi, %rbx
movq %rdi, %r15
movb 0x79(%rdi), %al
movb %al, 0x26(%rdi)
movups (%rdi), %xmm0
movups 0x10(%rdi), %xmm1
movups %xmm1, 0x10(%rsi)
movups %xmm0, (%rsi)
movq 0x20(%rdi), %rax
movq %rax, 0x20(%rsi)
leaq 0x28(%rsi), %rdi
movq 0x50(%r15), %rsi
subq 0x48(%r15), %rsi
shrq $0x3, %rsi
callq 0x6d26
cltq
movq %rbx, -0x30(%rbp)
leaq (%rbx,%rax), %r13
addq $0x28, %r13
xorl %ebx, %ebx
movq 0x48(%r15), %rax
movq 0x50(%r15), %rcx
subq %rax, %rcx
sarq $0x3, %rcx
cmpq %rcx, %rbx
jae 0x6aca
movq (%rax,%rbx,8), %rsi
movq %r13, %rdi
callq 0x6d33
cltq
addq %rax, %r13
incq %rbx
jmp 0x6aa0
movq 0x68(%r15), %rsi
subq 0x60(%r15), %rsi
shrq $0x6, %rsi
movq %r13, %rdi
callq 0x6d26
movslq %eax, %r12
addq %r13, %r12
pushq $0x20
popq %rbx
xorl %r14d, %r14d
movq 0x60(%r15), %rax
movq 0x68(%r15), %rcx
subq %rax, %rcx
sarq $0x6, %rcx
cmpq %rcx, %r14
jae 0x6b32
leaq (%rax,%rbx), %rsi
addq $-0x20, %rsi
movq %r12, %rdi
callq 0x6d41
movslq %eax, %r13
addq %r12, %r13
movq 0x60(%r15), %rsi
addq %rbx, %rsi
movq %r13, %rdi
callq 0x6d41
movslq %eax, %r12
addq %r13, %r12
incq %r14
addq $0x40, %rbx
jmp 0x6aea
subl -0x30(%rbp), %r12d
movq -0x38(%rbp), %rax
movl %r12d, (%rax)
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/rocket323[P]fishdb/./page.cpp
// Function: fishdb::MemPage::Parse()
void MemPage::Parse()
{
    char *buf = sbuf;
    memcpy(sbuf, data.c_str(), data.size());
    is_leaf = header.is_leaf;
    int32_t num;

    buf += DecodeInt32(buf, num);
    for (int i = 0; i < num; ++i)
    {
        int64_t c;
        buf += DecodeInt64(buf, c);
        children.push_back(c);
    }

    buf += DecodeInt32(buf, num);
    for (int i = 0; i < num; ++i)
    {
        std::string k, v;
        buf += DecodeString(buf, k);
        buf += DecodeString(buf, v);
        kvs.push_back(KV(k, v));
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x98, %rsp
movq %rdi, %r14
movq 0x28(%rdi), %rsi
movq 0x30(%rdi), %rdx
leaq 0x569e(%rip), %rbx      # 0xc210
movq %rbx, %rdi
callq 0x2180
cmpb $0x0, 0x26(%r14)
setne 0x79(%r14)
leaq -0x2c(%rbp), %rsi
movq %rbx, %rdi
callq 0x6d98
movslq %eax, %r15
addq %rbx, %r15
movq %r14, -0x38(%rbp)
addq $0x48, %r14
xorl %ebx, %ebx
leaq -0xb8(%rbp), %r12
cmpl -0x2c(%rbp), %ebx
jge 0x6bcb
movq %r15, %rdi
movq %r12, %rsi
callq 0x6da7
cltq
addq %rax, %r15
movq %r14, %rdi
movq %r12, %rsi
callq 0x4774
incl %ebx
jmp 0x6ba7
leaq -0x2c(%rbp), %rsi
movq %r15, %rdi
callq 0x6d98
movslq %eax, %r14
addq %r15, %r14
addq $0x60, -0x38(%rbp)
leaq -0x78(%rbp), %r12
leaq -0xb8(%rbp), %r13
xorl %r15d, %r15d
cmpl -0x2c(%rbp), %r15d
jge 0x6c7c
leaq -0x48(%rbp), %rax
movq %rax, -0x58(%rbp)
andq $0x0, -0x50(%rbp)
xorl %ecx, %ecx
movb %cl, -0x48(%rbp)
leaq -0x68(%rbp), %rax
movq %rax, -0x78(%rbp)
andq $0x0, -0x70(%rbp)
movb %cl, -0x68(%rbp)
movq %r14, %rdi
leaq -0x58(%rbp), %rsi
callq 0x6db8
cltq
addq %rax, %r14
movq %r14, %rdi
movq %r12, %rsi
callq 0x6db8
movl %eax, %ebx
movq %r13, %rdi
leaq -0x58(%rbp), %rsi
movq %r12, %rdx
callq 0x454e
movq -0x38(%rbp), %rdi
movq %r13, %rsi
callq 0x6cbe
movslq %ebx, %rax
addq %rax, %r14
movq %r13, %rdi
callq 0x4584
movq %r12, %rdi
callq 0x20e0
leaq -0x58(%rbp), %rdi
callq 0x20e0
incl %r15d
jmp 0x6bf0
addq $0x98, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
leaq -0xb8(%rbp), %rdi
callq 0x4584
jmp 0x6ca4
jmp 0x6ca1
movq %rax, %rbx
leaq -0x78(%rbp), %rdi
callq 0x20e0
leaq -0x58(%rbp), %rdi
callq 0x20e0
movq %rbx, %rdi
callq 0x2310
// File: /workspace/github_cpp_makefile_star2_O2/rocket323[P]fishdb/./util.cpp
// Function: fishdb::DecodeString(char*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>&)
int DecodeString(char *buf, std::string &str)
{
    int32_t len = 0;
    DecodeInt32(buf, len);
    str = std::string(buf + 4, len);
    return 4 + len;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x28, %rsp
movq %rsi, %rbx
movslq (%rdi), %r15
leaq -0x28(%rbp), %rax
movq %rax, -0x10(%rax)
leaq 0x4(%rdi,%r15), %rdx
leaq 0x4(%rdi), %rsi
leaq -0x38(%rbp), %r14
movq %r14, %rdi
callq 0x6e0a
movq %rbx, %rdi
movq %r14, %rsi
callq 0x2250
movq %r14, %rdi
callq 0x20e0
leal 0x4(%r15), %eax
addq $0x28, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/cegme[P]vose/VoseTree.cc
// Function: VoseTree::add(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, long)
double VoseTree::add(std::string label, long weight) {

  struct marble m;
  m.weight = weight;
  m.label = label; // TODO update with a proper copy() method

  return VoseTree::add(m);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
subq $0x70, %rsp
leaq -0x60(%rbp), %rax
movq %rax, -0x10(%rax)
andq $0x0, -0x8(%rax)
movq %rdi, %r14
leaq -0x70(%rbp), %rbx
movb $0x0, (%rax)
movq %rdx, -0x18(%rax)
movq %rbx, %rdi
callq 0x2100
leaq -0x48(%rbp), %rdi
leaq -0x78(%rbp), %rsi
callq 0x3284
leaq -0x48(%rbp), %rsi
movq %r14, %rdi
callq 0x2508
movsd %xmm0, -0x18(%rbp)
leaq -0x40(%rbp), %rdi
callq 0x20d0
movq %rbx, %rdi
callq 0x20d0
movsd -0x18(%rbp), %xmm0
addq $0x70, %rsp
popq %rbx
popq %r14
popq %rbp
retq
movq %rax, %r14
leaq -0x40(%rbp), %rdi
callq 0x20d0
jmp 0x24f8
movq %rax, %r14
movq %rbx, %rdi
callq 0x20d0
movq %r14, %rdi
callq 0x22d0
// File: /workspace/github_cpp_makefile_star2_O2/cegme[P]vose/VoseTree.cc
// Function: VoseTree::merge_bags()
Vose VoseTree::merge_bags() {
  Vose v;
  size_t i = 0;
  for(; i != nodes.size(); ++i) {
    if (!nodes[i].isBag) break;
    v = v.merge(nodes[i].bag);
  }
  nodes.erase(nodes.begin(), nodes.begin()+i-1); // -1 because we have to replace it
  nodes[0] = vosetreenode(v);
  
  branches.erase(branches.begin(), branches.begin()+i-1);
  branches[0] = v.weight();
  v.init();
  return v;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x178, %rsp            # imm = 0x178
movq %rsi, %r14
xorl %ebx, %ebx
movl $0x90, %edx
movq %rdi, -0x30(%rbp)
xorl %esi, %esi
callq 0x2110
leaq 0x38(%r14), %rax
movq %rax, -0x40(%rbp)
pushq $0x8
popq %rax
movq %rax, -0x38(%rbp)
pushq $0x38
popq %r12
movl $0xc8, %r15d
movq %r14, -0x48(%rbp)
movq 0x38(%r14), %rcx
movq 0x40(%r14), %rax
subq %rcx, %rax
cqto
movl $0xc8, %esi
idivq %rsi
cmpq %rax, %rbx
je 0x296b
cmpb $0x1, -0x38(%rcx,%r12)
jne 0x296b
addq %r12, %rcx
leaq -0x1a0(%rbp), %r13
movq %r13, %rdi
movq -0x30(%rbp), %r14
movq %r14, %rsi
movq %rcx, %rdx
callq 0x6224
movq %r14, %rdi
movq %r13, %rsi
callq 0x3522
movq %r13, %rdi
callq 0x3436
incq %rbx
addq $-0x8, -0x38(%rbp)
addq $-0xc8, %r15
addq $0xc8, %r12
movq -0x48(%rbp), %r14
jmp 0x28fe
movq %rcx, %rdx
subq %r15, %rdx
movq -0x40(%rbp), %rdi
movq %rcx, %rsi
callq 0x364a
leaq -0xd8(%rbp), %rdi
movq -0x30(%rbp), %rbx
movq %rbx, %rsi
callq 0x3348
leaq -0x1a0(%rbp), %rdi
leaq -0xd8(%rbp), %rsi
callq 0x33f6
movq 0x38(%r14), %rdi
leaq -0x1a0(%rbp), %r15
movq %r15, %rsi
callq 0x357c
movq %r15, %rdi
callq 0x35b2
leaq -0xd8(%rbp), %rdi
callq 0x3436
movq 0x20(%r14), %rsi
addq $0x20, %r14
movq %rsi, %rdx
subq -0x38(%rbp), %rdx
movq %r14, %rdi
callq 0x3654
movq 0x58(%rbx), %rax
movq (%r14), %rcx
movq %rax, (%rcx)
movq %rbx, %rdi
callq 0x5d72
movq %rbx, %rax
addq $0x178, %rsp            # imm = 0x178
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x2a21
jmp 0x2a21
movq %rax, %r14
leaq -0xd8(%rbp), %rdi
callq 0x3436
jmp 0x2a24
jmp 0x2a21
jmp 0x2a21
movq %rax, %r14
movq -0x30(%rbp), %rdi
callq 0x3436
movq %r14, %rdi
callq 0x22d0
nop
// File: /workspace/github_cpp_makefile_star2_O2/cegme[P]vose/VoseTree.cc
// Function: VoseTree::rand_marble()
marble VoseTree::rand_marble() {

  // Select a random value in the range of [0, totalsize)
  double rand_sz = random_branch();

  // Binary search to find correct branch O(log n), n = branches.size()
  //std::vector<double>::iterator branch
  auto branch_idx
    = std::lower_bound (branches.begin(), branches.end(), rand_sz);

  size_t branch = branch_idx - branches.begin();
  if (nodes[branch].isBag) {
    // If a Vose class is at the node, we call rand() on the object.
    return nodes[branch].bag.rand_marble(); // O(1)
  }
  else {
    // If a marble is at the branch, return the marble
    return nodes[branch].ball; // O(1)
  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
subq $0x10, %rsp
movq %rsi, %r14
movq %rdi, %rbx
movq %rsi, %rdi
callq 0x3636
leaq -0x18(%rbp), %rdx
movsd %xmm0, (%rdx)
movq 0x20(%r14), %rdi
movq 0x28(%r14), %rsi
callq 0x4e13
subq 0x20(%r14), %rax
shrq $0x3, %rax
movq 0x38(%r14), %rcx
imulq $0xc8, %rax, %rax
leaq (%rcx,%rax), %rsi
cmpb $0x1, (%rcx,%rax)
jne 0x2a8f
addq $0x38, %rsi
movq %rbx, %rdi
callq 0x6078
jmp 0x2a9b
addq $0x8, %rsi
movq %rbx, %rdi
callq 0x3284
movq %rbx, %rax
addq $0x10, %rsp
popq %rbx
popq %r14
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/cegme[P]vose/VoseTree.cc
// Function: VoseTree::init()
void VoseTree::init() {
  // Init  all the Vose bags
  for (size_t i = 0; i != nodes.size(); ++i) {
    if (!nodes[i].isBag) break;
    nodes[i].bag.init();
  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %rdi, %rbx
pushq $0x38
popq %r14
xorl %r15d, %r15d
movl $0xc8, %r12d
movq 0x38(%rbx), %rdi
movq 0x40(%rbx), %rax
subq %rdi, %rax
cqto
idivq %r12
cmpq %rax, %r15
je 0x2af4
cmpb $0x1, -0x38(%rdi,%r14)
jne 0x2af4
addq %r14, %rdi
callq 0x5d72
incq %r15
addq $0xc8, %r14
jmp 0x2ac3
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/cegme[P]vose/VoseTree.cc
// Function: VoseTree::toString[abi:cxx11]()
std::string VoseTree::toString() {

  std::stringstream ss;
  ss << "[" << total_weight << "]\n";
  std::for_each (nodes.cbegin(), nodes.cend(), [this,&ss] (vosetreenode v) {
    ss << "----> " << v.toString() << "\n";
  });
  ss << "\n";
  return ss.str();

}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x278, %rsp            # imm = 0x278
movq %rsi, %rbx
movq %rdi, -0x30(%rbp)
leaq -0x1d8(%rbp), %rdi
callq 0x2150
leaq -0x1c8(%rbp), %rdi
leaq 0x751d(%rip), %rsi      # 0xa050
callq 0x21e0
movq 0x58(%rbx), %rsi
movq %rax, %rdi
callq 0x21d0
leaq 0x7507(%rip), %rsi      # 0xa052
movq %rax, %rdi
callq 0x21e0
movq 0x38(%rbx), %r15
movq 0x40(%rbx), %r14
leaq -0x2a0(%rbp), %r12
leaq -0x50(%rbp), %rbx
cmpq %r14, %r15
je 0x2bca
movq %r12, %rdi
movq %r15, %rsi
callq 0x48d2
leaq -0x1c8(%rbp), %rdi
leaq 0x7505(%rip), %rsi      # 0xa089
callq 0x21e0
movq %rax, %r13
movq %rbx, %rdi
movq %r12, %rsi
callq 0x4f54
movq %r13, %rdi
movq %rbx, %rsi
callq 0x21b0
movq %rax, %rdi
leaq 0x7980(%rip), %rsi      # 0xa52c
callq 0x21e0
movq %rbx, %rdi
callq 0x20d0
movq %r12, %rdi
callq 0x35b2
addq $0xc8, %r15
jmp 0x2b66
leaq 0x795b(%rip), %rsi      # 0xa52c
leaq -0x1c8(%rbp), %rdi
callq 0x21e0
leaq -0x1c0(%rbp), %rsi
movq -0x30(%rbp), %rdi
callq 0x2270
leaq -0x1d8(%rbp), %rdi
callq 0x2170
movq -0x30(%rbp), %rax
addq $0x278, %rsp            # imm = 0x278
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x2c11
movq %rax, %rbx
jmp 0x2c33
movq %rax, %rbx
leaq -0x50(%rbp), %rdi
callq 0x20d0
jmp 0x2c27
movq %rax, %rbx
leaq -0x2a0(%rbp), %rdi
callq 0x35b2
leaq -0x1d8(%rbp), %rdi
callq 0x2170
movq %rbx, %rdi
callq 0x22d0
nop
// File: /workspace/github_cpp_makefile_star2_O2/cegme[P]vose/VoseTree.cc
// Function: VoseTree::distribution[abi:cxx11]()
std::map<std::string, long> VoseTree::distribution() {

  std::map<std::string, long> map;
  std::for_each(nodes.cbegin(), nodes.cend(), [&map] (vosetreenode vtn) {
    if(vtn.isBag) {
      for (auto m : vtn.bag.get_scores()) {
        if(map.find(m.label) == map.end()) {
          map.insert(std::pair<std::string, long>(m.label, m.weight));
        }
        else {
          map[m.label] += m.weight;
        }
      }
    }
    else {
      if(map.find(vtn.ball.label) == map.end()) {
        map.insert(std::pair<std::string, long>(vtn.ball.label, vtn.ball.weight));
      }
      else {
        map[vtn.ball.label] += vtn.ball.weight;
      }
    }
  });
  return map;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x168, %rsp            # imm = 0x168
leaq 0x8(%rdi), %rax
andl $0x0, 0x8(%rdi)
andq $0x0, 0x10(%rdi)
movq %rax, 0x18(%rdi)
movq %rax, -0x38(%rbp)
movq %rax, 0x20(%rdi)
movq %rdi, -0x30(%rbp)
andq $0x0, 0x28(%rdi)
movq 0x38(%rsi), %rax
movq 0x40(%rsi), %rcx
movq %rcx, -0x40(%rbp)
leaq -0x90(%rbp), %r13
leaq -0x98(%rbp), %r12
leaq -0x188(%rbp), %rbx
cmpq -0x40(%rbp), %rax
je 0x2ddc
leaq -0x160(%rbp), %rdi
movq %rax, -0x48(%rbp)
movq %rax, %rsi
callq 0x48d2
cmpb $0x1, -0x160(%rbp)
jne 0x2d5a
leaq -0x68(%rbp), %rdi
leaq -0xe8(%rbp), %rsi
callq 0x375c
movq -0x68(%rbp), %r15
movq -0x60(%rbp), %rax
movq %rax, -0x50(%rbp)
cmpq -0x50(%rbp), %r15
je 0x2d8c
movq %r12, %rdi
movq %r15, %rsi
callq 0x3284
movq -0x30(%rbp), %rdi
movq %r13, %rsi
callq 0x50be
cmpq -0x38(%rbp), %rax
je 0x2d2a
movq %r13, %rsi
movq %r12, %r14
movq -0x98(%rbp), %r12
movq -0x30(%rbp), %rdi
callq 0x5054
addq %r12, (%rax)
movq %r14, %r12
jmp 0x2d4c
movq %rbx, %rdi
movq %r13, %rsi
movq %r12, %rdx
callq 0x5036
movq -0x30(%rbp), %rdi
movq %rbx, %rsi
callq 0x515e
movq %rbx, %rdi
callq 0x20d0
movq %r13, %rdi
callq 0x20d0
addq $0x30, %r15
jmp 0x2ce5
movq -0x30(%rbp), %rdi
leaq -0x150(%rbp), %rsi
callq 0x50be
cmpq -0x38(%rbp), %rax
je 0x2d97
movq -0x158(%rbp), %r15
movq -0x30(%rbp), %rdi
leaq -0x150(%rbp), %rsi
callq 0x5054
addq %r15, (%rax)
jmp 0x2dc1
leaq -0x68(%rbp), %rdi
callq 0x3866
jmp 0x2dc1
movq %r12, %rdi
leaq -0x150(%rbp), %rsi
leaq -0x158(%rbp), %rdx
callq 0x5036
movq -0x30(%rbp), %rdi
movq %r12, %rsi
callq 0x515e
movq %r12, %rdi
callq 0x20d0
leaq -0x160(%rbp), %rdi
callq 0x35b2
movq -0x48(%rbp), %rax
addq $0xc8, %rax
jmp 0x2c9f
movq -0x30(%rbp), %rax
addq $0x168, %rsp            # imm = 0x168
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %r15
leaq -0x98(%rbp), %rdi
callq 0x20d0
jmp 0x2e3b
movq %rax, %r15
jmp 0x2e47
movq %rax, %r15
jmp 0x2e3b
jmp 0x2e27
movq %rax, %r15
leaq -0x188(%rbp), %rdi
callq 0x20d0
jmp 0x2e2a
jmp 0x2e27
movq %rax, %r15
jmp 0x2e32
movq %rax, %r15
movq %r13, %rdi
callq 0x20d0
leaq -0x68(%rbp), %rdi
callq 0x3866
leaq -0x160(%rbp), %rdi
callq 0x35b2
movq -0x30(%rbp), %rdi
callq 0x4218
movq %r15, %rdi
callq 0x22d0
// File: /workspace/github_cpp_makefile_star2_O2/cegme[P]vose/VoseTree.cc
// Function: VoseTree::probabilities[abi:cxx11]()
std::map<std::string, double> VoseTree::probabilities() {

  auto h = distribution();
  std::map<std::string, double> prob;
  //map.resize(h.size());
  std::for_each(h.begin(), h.end(), [&] (std::pair<std::string, long> m) {
    //std::cerr << "p|" << m.first << "," << (double)m.second/total_weight << "\n";
    prob.insert(std::make_pair(m.first, (double)m.second/total_weight));
  });
  return prob;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x98, %rsp
movq %rdi, %rbx
leaq -0x68(%rbp), %r15
movq %r15, %rdi
movq %rsi, -0x38(%rbp)
callq 0x2c48
leaq 0x8(%rbx), %rax
andl $0x0, 0x8(%rbx)
andq $0x0, 0x10(%rbx)
movq %rax, 0x18(%rbx)
movq %rax, 0x20(%rbx)
movq %rbx, -0x30(%rbp)
andq $0x0, 0x28(%rbx)
movq 0x18(%r15), %r13
leaq -0x90(%rbp), %r15
leaq -0xb8(%rbp), %r12
leaq -0x60(%rbp), %rax
cmpq %rax, %r13
je 0x2f1a
leaq 0x20(%r13), %rsi
movq %r15, %rdi
callq 0x57e8
movq -0x70(%rbp), %rbx
movq -0x38(%rbp), %rax
movq 0x58(%rax), %r14
movq %r12, %rdi
movq %r15, %rsi
callq 0x2240
cvtsi2sd %rbx, %xmm0
cvtsi2sd %r14, %xmm1
divsd %xmm1, %xmm0
movsd %xmm0, -0x98(%rbp)
movq -0x30(%rbp), %rdi
movq %r12, %rsi
callq 0x55dc
movq %r12, %rdi
callq 0x20d0
movq %r15, %rdi
callq 0x20d0
movq %r13, %rdi
callq 0x2140
movq %rax, %r13
jmp 0x2eaf
leaq -0x68(%rbp), %rdi
callq 0x4218
movq -0x30(%rbp), %rax
addq $0x98, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %r14
jmp 0x2f5e
movq %rax, %r14
jmp 0x2f52
movq %rax, %r14
leaq -0xb8(%rbp), %rdi
callq 0x20d0
leaq -0x90(%rbp), %rdi
callq 0x20d0
movq -0x30(%rbp), %rdi
callq 0x4290
leaq -0x68(%rbp), %rdi
callq 0x4218
movq %r14, %rdi
callq 0x22d0
// File: /workspace/github_cpp_makefile_star2_O2/cegme[P]vose/VoseTree.cc
// Function: VoseTree::kl(std::map<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, double, std::less<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const, double>>> const&, std::map<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, double, std::less<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const, double>>> const&)
double VoseTree::kl(const std::map<std::string, double> &a, const std::map<std::string, double> &b) {

  /*std::cerr<< "a: ";
  std::for_each(a.begin(), a.end(), [] (std::pair<const std::string, double> z) { 
    std::cerr << "<" << z.first << "," << z.second << ">";
  });
  std::cerr << "\nb: ";
  std::for_each(b.begin(), b.end(), [] (std::pair<const std::string, double> z) { 
    std::cerr << "<" << z.first << "," << z.second << ">";
  });*/

  std::vector<double> v;
  v.resize(a.size());
  std::transform(a.cbegin(), a.cend(), b.cbegin(), v.begin(), [&v] (std::pair<const std::string, double> a, std::pair<const std::string, double> b) {
    //printf("a:%f, b:%f, log(a/b):%f\n", a.second, b.second, log(a.second/b.second));
    return (double)log(a.second/b.second)*a.second;
  });
  return std::accumulate(v.cbegin(), v.cend(), 0.0, std::plus<double>());
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x78, %rsp
movq %rsi, %r15
movq %rdi, %rbx
xorpd %xmm0, %xmm0
leaq -0x40(%rbp), %rdi
movapd %xmm0, (%rdi)
andq $0x0, 0x10(%rdi)
movq 0x28(%rbx), %rsi
callq 0x365e
movq 0x18(%rbx), %r14
addq $0x8, %rbx
movq 0x18(%r15), %r13
movq %rbx, %r15
movq -0x40(%rbp), %rbx
leaq -0x98(%rbp), %r12
cmpq %r15, %r14
je 0x3026
leaq 0x20(%r14), %rsi
leaq -0x70(%rbp), %rdi
callq 0x5992
leaq 0x20(%r13), %rsi
movq %r12, %rdi
callq 0x5992
movsd -0x50(%rbp), %xmm0
divsd -0x78(%rbp), %xmm0
callq 0x2190
mulsd -0x50(%rbp), %xmm0
movsd %xmm0, (%rbx)
movq %r12, %rdi
callq 0x20d0
leaq -0x70(%rbp), %rdi
callq 0x20d0
movq %r14, %rdi
callq 0x2210
movq %rax, %r14
movq %r13, %rdi
callq 0x2210
movq %rax, %r13
addq $0x8, %rbx
jmp 0x2fc3
movq -0x40(%rbp), %rax
movq -0x38(%rbp), %rcx
xorpd %xmm0, %xmm0
cmpq %rcx, %rax
je 0x3041
addsd (%rax), %xmm0
addq $0x8, %rax
jmp 0x3032
leaq -0x40(%rbp), %rdi
movsd %xmm0, -0x48(%rbp)
callq 0x3a5e
movsd -0x48(%rbp), %xmm0
addq $0x78, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x3065
movq %rax, %rbx
jmp 0x3076
movq %rax, %rbx
leaq -0x70(%rbp), %rdi
callq 0x20d0
leaq -0x40(%rbp), %rdi
callq 0x3a5e
movq %rbx, %rdi
callq 0x22d0
nop
// File: /workspace/github_cpp_makefile_star2_O2/cegme[P]vose/VoseTree.cc
// Function: VoseTree::histogram[abi:cxx11](VoseTree, long)
std::map<std::string, double> 
    VoseTree::histogram(VoseTree tree, long samples) {

    std::map<std::string,double> histogram;
    long hist_sum = 0L;
    for (int i = 0; i != samples; ++i) {
      auto idx = tree.rand_marble();

      if (histogram.find(idx.label) != histogram.end()) {
        histogram[idx.label] += 1.0;
        hist_sum += 1L;
      }
      else {
        histogram.insert(std::make_pair(idx.label, 1.0));
        hist_sum += 1L;
      }
    }
    
    std::map<std::string,double> new_hist;
    std::for_each(histogram.cbegin(), histogram.cend(),
      [&new_hist,hist_sum] (std::pair<const std::string, double> a) {
        //std::cerr << a.first << ", " << (double)a.second/hist_sum << "\n";
        new_hist.insert( std::make_pair(a.first,(double)a.second/hist_sum));
    });

    return new_hist;

  }

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xa8, %rsp
movq %rdx, %rbx
movq %rsi, %r12
leaq -0x90(%rbp), %rax
andl $0x0, (%rax)
andq $0x0, 0x8(%rax)
movq %rax, 0x10(%rax)
movq %rax, 0x18(%rax)
andq $0x0, 0x20(%rax)
movq %rdi, -0x30(%rbp)
leaq -0xc0(%rbp), %r14
leaq -0x98(%rbp), %r15
movq %rdx, -0x38(%rbp)
subq $0x1, %rbx
jb 0x315e
leaq -0xc8(%rbp), %rdi
movq %r12, %rsi
callq 0x2a36
movq %r15, %rdi
movq %r14, %rsi
callq 0x59b4
leaq -0x90(%rbp), %rcx
cmpq %rcx, %rax
je 0x3121
movq %r15, %rdi
movq %r14, %rsi
callq 0x3696
movsd (%rax), %xmm0
addsd 0x6eed(%rip), %xmm0     # 0xa008
movsd %xmm0, (%rax)
jmp 0x3151
leaq -0x68(%rbp), %r13
movq %r13, %rdi
movq %r14, %rsi
callq 0x2240
movabsq $0x3ff0000000000000, %rax # imm = 0x3FF0000000000000
movq %rax, -0x48(%rbp)
movq %r15, %rdi
movq %r13, %rsi
callq 0x55dc
movq %r13, %rdi
callq 0x20d0
movq %r14, %rdi
callq 0x20d0
jmp 0x30d4
movq -0x30(%rbp), %rcx
andl $0x0, 0x8(%rcx)
andq $0x0, 0x10(%rcx)
leaq 0x8(%rcx), %rax
movq %rax, 0x18(%rcx)
movq %rax, 0x20(%rcx)
andq $0x0, 0x28(%rcx)
movq -0x80(%rbp), %r12
cvtsi2sdq -0x38(%rbp), %xmm0
movsd %xmm0, -0x40(%rbp)
leaq -0x68(%rbp), %r14
leaq -0xc8(%rbp), %r15
leaq -0x90(%rbp), %rax
cmpq %rax, %r12
je 0x31ff
leaq 0x20(%r12), %rsi
movq %r14, %rdi
callq 0x5992
movsd -0x48(%rbp), %xmm0
movsd %xmm0, -0x38(%rbp)
movq %r15, %rdi
movq %r14, %rsi
callq 0x2240
movsd -0x38(%rbp), %xmm0
divsd -0x40(%rbp), %xmm0
movsd %xmm0, -0xa8(%rbp)
movq -0x30(%rbp), %rdi
movq %r15, %rsi
callq 0x55dc
movq %r15, %rdi
callq 0x20d0
movq %r14, %rdi
callq 0x20d0
movq %r12, %rdi
callq 0x2210
movq %rax, %r12
jmp 0x3196
leaq -0x98(%rbp), %rdi
callq 0x4290
movq -0x30(%rbp), %rax
addq $0xa8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x3265
movq %rax, %r15
leaq -0x68(%rbp), %rdi
callq 0x20d0
jmp 0x3268
jmp 0x3265
movq %rax, %r15
jmp 0x3255
movq %rax, %r15
jmp 0x324c
movq %rax, %r15
leaq -0xc8(%rbp), %rdi
callq 0x20d0
leaq -0x68(%rbp), %rdi
callq 0x20d0
movq -0x30(%rbp), %rdi
callq 0x4290
jmp 0x3270
movq %rax, %r15
jmp 0x3270
movq %rax, %r15
movq %r14, %rdi
callq 0x20d0
leaq -0x98(%rbp), %rdi
callq 0x4290
movq %r15, %rdi
callq 0x22d0
// File: /workspace/github_cpp_makefile_star2_O2/cegme[P]vose/./Vose.h
// Function: marble::toString[abi:cxx11]()
std::string toString() {
    std::stringstream ss;
    ss << "<" << label;
    ss << ",";
    ss << weight << ">"; 
    return ss.str();
  }

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x188, %rsp            # imm = 0x188
movq %rsi, %r14
movq %rdi, %rbx
leaq -0x1a0(%rbp), %rdi
callq 0x2150
leaq -0x190(%rbp), %r15
leaq 0x50da(%rip), %rsi      # 0xa090
movq %r15, %rdi
callq 0x21e0
leaq 0x8(%r14), %rsi
movq %rax, %rdi
callq 0x21b0
leaq 0x50c1(%rip), %rsi      # 0xa092
movq %r15, %rdi
callq 0x21e0
movq (%r14), %rsi
movq %r15, %rdi
callq 0x21d0
leaq 0x53ce(%rip), %rsi      # 0xa3b9
movq %rax, %rdi
callq 0x21e0
leaq -0x188(%rbp), %rsi
movq %rbx, %rdi
callq 0x2270
leaq -0x1a0(%rbp), %rdi
callq 0x2170
movq %rbx, %rax
addq $0x188, %rsp            # imm = 0x188
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
leaq -0x1a0(%rbp), %rdi
callq 0x2170
movq %rbx, %rdi
callq 0x22d0
// File: /workspace/github_cpp_makefile_star2_O2/cegme[P]vose/Vose.cc
// Function: Vose::add(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, long)
double Vose::add(std::string label, long weight) {
  // Create a new marble
  struct marble m;
  m.weight = weight;
  m.label = label; // TODO update with a proper copy() method

  return Vose::add(m);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
subq $0x70, %rsp
leaq -0x60(%rbp), %rax
movq %rax, -0x10(%rax)
andq $0x0, -0x8(%rax)
movq %rdi, %r14
leaq -0x70(%rbp), %rbx
movb $0x0, (%rax)
movq %rdx, -0x18(%rax)
movq %rbx, %rdi
callq 0x2100
leaq -0x48(%rbp), %rdi
leaq -0x78(%rbp), %rsi
callq 0x3284
leaq -0x48(%rbp), %rsi
movq %r14, %rdi
callq 0x5d40
movsd %xmm0, -0x18(%rbp)
leaq -0x40(%rbp), %rdi
callq 0x20d0
movq %rbx, %rdi
callq 0x20d0
movsd -0x18(%rbp), %xmm0
addq $0x70, %rsp
popq %rbx
popq %r14
popq %rbp
retq
movq %rax, %r14
leaq -0x40(%rbp), %rdi
callq 0x20d0
jmp 0x5d30
movq %rax, %r14
movq %rbx, %rdi
callq 0x20d0
movq %r14, %rdi
callq 0x22d0
// File: /workspace/github_cpp_makefile_star2_O2/cegme[P]vose/Vose.cc
// Function: Vose::add(marble)
double Vose::add(marble m) {
  
  // Update the total size of the Urn
  total_weight += m.weight;

  // Add the marble to the list
  scores.push_back(m);

  // TODO update streaming data structures

  return (double) m.weight / total_weight;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
movq %rsi, %rbx
movq %rdi, %r14
movq (%rsi), %rax
addq %rax, 0x58(%rdi)
addq $0x40, %rdi
callq 0x63b6
cvtsi2sdq (%rbx), %xmm0
cvtsi2sdq 0x58(%r14), %xmm1
divsd %xmm1, %xmm0
popq %rbx
popq %r14
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/cegme[P]vose/Vose.cc
// Function: Vose::rand()
size_t Vose::rand() {
  // Warning! init() must have been called. 
  // TODO update this method to a more numerically stable version

  double u = random_scores_double();
  //std::cerr << "rand(): u = " << u << "\n";
  // Grab a random column from the main scores list
  size_t col = floor(u);
  //std::cerr << "rand(): col = " << col << "\n";

  // Make a toss to choose either alias side or the probability side 
  return (u - col)<=prob[col]? col : alias[col];
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
movq %rdi, %rbx
callq 0x3636
movsd %xmm0, -0x10(%rbp)
callq 0x22c0
cvttsd2si %xmm0, %rcx
movq %rcx, %rdx
subsd 0x41e0(%rip), %xmm0     # 0xa200
cvttsd2si %xmm0, %rax
sarq $0x3f, %rdx
andq %rdx, %rax
orq %rcx, %rax
movq %rax, %xmm0
punpckldq 0x3fe4(%rip), %xmm0 # xmm0 = xmm0[0],mem[0],xmm0[1],mem[1]
subpd 0x3fec(%rip), %xmm0     # 0xa030
movapd %xmm0, %xmm1
unpckhpd %xmm0, %xmm1            # xmm1 = xmm1[1],xmm0[1]
addsd %xmm0, %xmm1
movsd -0x10(%rbp), %xmm2
subsd %xmm1, %xmm2
movq 0x78(%rbx), %rcx
movsd (%rcx,%rax,8), %xmm0
ucomisd %xmm2, %xmm0
jae 0x6070
movq 0x60(%rbx), %rcx
movq (%rcx,%rax,8), %rax
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/cegme[P]vose/Vose.cc
// Function: Vose::kl(std::vector<double, std::allocator<double>> const&, std::vector<double, std::allocator<double>> const&)
double Vose::kl(const std::vector<double> &a, const std::vector<double> &b) {

  std::vector<double> v;
  for(size_t i = 0; i != a.size(); ++i) {
    printf("a:%f, b:%f, log(a/b):%f\n", a[i], b[i], log(a[i]/b[i]));
    v.push_back(log(a[i]/b[i])*a[i]);
  }
  return std::accumulate(v.cbegin(), v.cend(), 0.0, std::plus<double>());
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movq %rsi, %rbx
movq %rdi, %r14
xorpd %xmm0, %xmm0
leaq -0x50(%rbp), %rax
andq $0x0, 0x10(%rax)
movapd %xmm0, (%rax)
xorl %r15d, %r15d
leaq 0x4130(%rip), %r12      # 0xa208
leaq -0x60(%rbp), %r13
movq (%r14), %rax
movq 0x8(%r14), %rcx
subq %rax, %rcx
sarq $0x3, %rcx
cmpq %rcx, %r15
je 0x6162
movsd (%rax,%r15,8), %xmm0
movsd %xmm0, -0x30(%rbp)
movq (%rbx), %rax
movsd (%rax,%r15,8), %xmm1
movsd %xmm1, -0x58(%rbp)
divsd %xmm1, %xmm0
callq 0x2190
movapd %xmm0, %xmm2
movq %r12, %rdi
movsd -0x30(%rbp), %xmm0
movsd -0x58(%rbp), %xmm1
movb $0x3, %al
callq 0x2040
movq (%r14), %rax
movsd (%rax,%r15,8), %xmm0
movq (%rbx), %rax
divsd (%rax,%r15,8), %xmm0
callq 0x2190
movq (%r14), %rax
mulsd (%rax,%r15,8), %xmm0
movsd %xmm0, -0x60(%rbp)
leaq -0x50(%rbp), %rdi
movq %r13, %rsi
callq 0x65b0
incq %r15
jmp 0x60dc
movq -0x50(%rbp), %rax
movq -0x48(%rbp), %rcx
xorpd %xmm0, %xmm0
cmpq %rcx, %rax
je 0x617d
addsd (%rax), %xmm0
addq $0x8, %rax
jmp 0x616e
leaq -0x50(%rbp), %rdi
movsd %xmm0, -0x30(%rbp)
callq 0x3a5e
movsd -0x30(%rbp), %xmm0
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
leaq -0x50(%rbp), %rdi
callq 0x3a5e
movq %rbx, %rdi
callq 0x22d0
nop
// File: /workspace/github_cpp_makefile_star2_O2/cegme[P]vose/Vose.cc
// Function: Vose::merge(Vose const&, Vose const&)
Vose Vose::merge(const Vose &v1, const Vose &v2) {

  Vose v;
  std::copy (v1.scores.begin(), v1.scores.end(), std::back_inserter(v.scores)); 
  std::copy (v2.scores.begin(), v2.scores.end(), std::back_inserter(v.scores)); 
  v.total_weight = v1.total_weight + v2.total_weight;

  return v;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %rcx, %r15
movq %rdx, %r14
movq %rdi, %rbx
movl $0x90, %edx
xorl %esi, %esi
callq 0x2110
movq 0x40(%r14), %rdi
movq 0x48(%r14), %rsi
leaq 0x40(%rbx), %r12
movq %r12, %rdx
callq 0x6da6
movq 0x40(%r15), %rdi
movq 0x48(%r15), %rsi
movq %r12, %rdx
callq 0x6da6
movq 0x58(%r15), %rax
addq 0x58(%r14), %rax
movq %rax, 0x58(%rbx)
movq %rbx, %rax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %r14
movq %rbx, %rdi
callq 0x3436
movq %r14, %rdi
callq 0x22d0
nop
// File: /workspace/github_cpp_makefile_star2_O2/cegme[P]vose/Vose.cc
// Function: Vose::merge(Vose const&)
Vose Vose::merge(const Vose& vose) {

  Vose v;

  // concatenate the two scores arrays
  std::copy (scores.begin(),scores.end(),std::back_inserter(v.scores)); 
  std::copy (vose.scores.begin(),vose.scores.end(),std::back_inserter(v.scores)); 

  // update the total_weight
  v.total_weight = total_weight + vose.total_weight;

  return v; // The person using this shoud call 'init' as soon as possible
  
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %rdx, %r15
movq %rsi, %r14
movq %rdi, %rbx
movl $0x90, %edx
xorl %esi, %esi
callq 0x2110
movq 0x40(%r14), %rdi
movq 0x48(%r14), %rsi
leaq 0x40(%rbx), %r12
movq %r12, %rdx
callq 0x6dee
movq 0x40(%r15), %rdi
movq 0x48(%r15), %rsi
movq %r12, %rdx
callq 0x6da6
movq 0x58(%r15), %rax
addq 0x58(%r14), %rax
movq %rax, 0x58(%rbx)
movq %rbx, %rax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %r14
movq %rbx, %rdi
callq 0x3436
movq %r14, %rdi
callq 0x22d0
nop
// File: /workspace/github_cpp_makefile_star2_O2/cegme[P]vose/Vose.cc
// Function: Vose::toString[abi:cxx11]()
std::string Vose::toString() {
  std::stringstream ss;
  ss << "[" << total_weight << "|";
  std::for_each(scores.cbegin(), scores.cend(),[&ss] (marble m) {
    ss << m.toString();
  });
  ss << "]";
  return ss.str();
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x1e8, %rsp            # imm = 0x1E8
movq %rsi, %rbx
movq %rdi, -0x30(%rbp)
leaq -0x208(%rbp), %rdi
callq 0x2150
leaq -0x1f8(%rbp), %rdi
leaq 0x3d87(%rip), %rsi      # 0xa050
callq 0x21e0
movq 0x58(%rbx), %rsi
movq %rax, %rdi
callq 0x21d0
leaq 0x3f40(%rip), %rsi      # 0xa221
movq %rax, %rdi
callq 0x21e0
movq 0x40(%rbx), %r12
movq 0x48(%rbx), %r14
leaq -0x78(%rbp), %r15
leaq -0x80(%rbp), %r13
leaq -0x50(%rbp), %rbx
cmpq %r14, %r12
je 0x633d
movq %r13, %rdi
movq %r12, %rsi
callq 0x3284
movq %rbx, %rdi
movq %r13, %rsi
callq 0x4f86
leaq -0x1f8(%rbp), %rdi
movq %rbx, %rsi
callq 0x21b0
movq %rbx, %rdi
callq 0x20d0
movq %r15, %rdi
callq 0x20d0
addq $0x30, %r12
jmp 0x62fd
leaq 0x3edf(%rip), %rsi      # 0xa223
leaq -0x1f8(%rbp), %rdi
callq 0x21e0
leaq -0x1f0(%rbp), %rsi
movq -0x30(%rbp), %rdi
callq 0x2270
leaq -0x208(%rbp), %rdi
callq 0x2170
movq -0x30(%rbp), %rax
addq $0x1e8, %rsp            # imm = 0x1E8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x6384
movq %rax, %rbx
jmp 0x63a2
movq %rax, %rbx
jmp 0x639a
movq %rax, %rbx
leaq -0x50(%rbp), %rdi
callq 0x20d0
movq %r15, %rdi
callq 0x20d0
leaq -0x208(%rbp), %rdi
callq 0x2170
movq %rbx, %rdi
callq 0x22d0
// File: /workspace/github_cpp_makefile_star2_O2/cegme[P]vose/./Vose.h
// Function: Vose::reset_random_double()
void reset_random_double() {
    // Update the random number generators
    std::default_random_engine generator(VoseUtil::RANDOM_SEED);
    std::uniform_real_distribution<double> uniform_distribution(0.0,1.0);

    random_prob_die = std::bind(uniform_distribution, generator);
  }

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
leaq -0x18(%rbp), %rsi
andq $0x0, (%rsi)
movabsq $0x3ff0000000000000, %rax # imm = 0x3FF0000000000000
movq %rax, 0x8(%rsi)
movq $0x2a, 0x10(%rsi)
addq $0x20, %rdi
callq 0x35d6
addq $0x20, %rsp
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/cegme[P]vose/test.cc
// Function: test::test1()
bool test::test1() {
  std::cerr << "\nAdd several marbles, return correct weight and size.\n";
  
  Vose vose;

  std::cerr << "\tAdd m('red',5): ";
  double red_score = vose.add("red", 5);
  std::cerr << red_score << "\n";
  assert(red_score == 1);

  std::cerr << "\tAdd m('blue',10): ";
  std::cerr << vose.add("blue", 10) << "\n";

  std::cerr << "\tAdd m('yellow',20): ";
  double yellow_score = vose.add("yellow", 20);
  std::cerr << yellow_score << "\n";
  assert(yellow_score == 20.0/(5+10+20));

  return true;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
subq $0x108, %rsp            # imm = 0x108
movq 0x91a5(%rip), %rbx      # 0xfff0
leaq 0x344e(%rip), %rsi      # 0xa2a0
movq %rbx, %rdi
callq 0x21e0
leaq -0x108(%rbp), %rdi
movl $0x90, %edx
xorl %esi, %esi
callq 0x2110
leaq 0x3463(%rip), %rsi      # 0xa2d7
movq %rbx, %rdi
callq 0x21e0
leaq 0x3466(%rip), %rsi      # 0xa2e9
leaq -0x78(%rbp), %rdi
leaq -0x9(%rbp), %rdx
callq 0x20b0
leaq -0x108(%rbp), %rdi
leaq -0x78(%rbp), %rsi
pushq $0x5
popq %rdx
callq 0x5cb4
movsd %xmm0, -0x18(%rbp)
leaq -0x78(%rbp), %rdi
callq 0x20d0
movq 0x9138(%rip), %rdi      # 0xfff0
movsd -0x18(%rbp), %xmm0
callq 0x2280
leaq 0x3663(%rip), %rsi      # 0xa52c
movq %rax, %rdi
callq 0x21e0
movsd -0x18(%rbp), %xmm0
ucomisd 0x312a(%rip), %xmm0     # 0xa008
jne 0x6fd9
jp 0x6fd9
movq 0x90ff(%rip), %rdi      # 0xfff0
leaq 0x341f(%rip), %rsi      # 0xa317
callq 0x21e0
leaq 0x35bc(%rip), %rsi      # 0xa4c0
leaq -0x58(%rbp), %rdi
leaq -0x9(%rbp), %rdx
callq 0x20b0
leaq -0x108(%rbp), %rdi
leaq -0x58(%rbp), %rsi
pushq $0xa
popq %rdx
callq 0x5cb4
movq 0x90c5(%rip), %rdi      # 0xfff0
callq 0x2280
leaq 0x35f5(%rip), %rsi      # 0xa52c
movq %rax, %rdi
callq 0x21e0
leaq -0x58(%rbp), %rdi
callq 0x20d0
movq 0x90a1(%rip), %rdi      # 0xfff0
leaq 0x33d5(%rip), %rsi      # 0xa32b
callq 0x21e0
leaq 0x33df(%rip), %rsi      # 0xa341
leaq -0x38(%rbp), %rdi
leaq -0x9(%rbp), %rdx
callq 0x20b0
leaq -0x108(%rbp), %rdi
leaq -0x38(%rbp), %rsi
pushq $0x14
popq %rdx
callq 0x5cb4
movsd %xmm0, -0x18(%rbp)
leaq -0x38(%rbp), %rdi
callq 0x20d0
movq 0x9059(%rip), %rdi      # 0xfff0
movsd -0x18(%rbp), %xmm0
callq 0x2280
leaq 0x3584(%rip), %rsi      # 0xa52c
movq %rax, %rdi
callq 0x21e0
movsd -0x18(%rbp), %xmm0
ucomisd 0x32b3(%rip), %xmm0     # 0xa270
jne 0x6ff2
jp 0x6ff2
leaq -0x108(%rbp), %rdi
callq 0x3436
movb $0x1, %al
addq $0x108, %rsp            # imm = 0x108
popq %rbx
popq %rbp
retq
leaq 0x330d(%rip), %rdi      # 0xa2ed
leaq 0x3315(%rip), %rsi      # 0xa2fc
leaq 0x3316(%rip), %rcx      # 0xa304
pushq $0x16
jmp 0x7009
leaq 0x334f(%rip), %rdi      # 0xa348
leaq 0x32fc(%rip), %rsi      # 0xa2fc
leaq 0x32fd(%rip), %rcx      # 0xa304
pushq $0x1e
popq %rdx
callq 0x2120
movq %rax, %rbx
leaq -0x38(%rbp), %rdi
jmp 0x7032
jmp 0x7039
jmp 0x7039
movq %rax, %rbx
leaq -0x78(%rbp), %rdi
jmp 0x7032
jmp 0x7039
jmp 0x7039
jmp 0x7039
movq %rax, %rbx
leaq -0x58(%rbp), %rdi
callq 0x20d0
jmp 0x703c
movq %rax, %rbx
leaq -0x108(%rbp), %rdi
callq 0x3436
movq %rbx, %rdi
callq 0x22d0
// File: /workspace/github_cpp_makefile_star2_O2/cegme[P]vose/test.cc
// Function: test::test4()
bool test::test4() {

  VoseTree tree;
  tree.set_max_marbles(4);
  tree.set_max_bags(5);

  std::cerr << tree.toString();
  for(size_t i = 0; i != 10; ++i) {
    tree.add("red", 5L);
    std::cerr << tree.toString();
    tree.add("blue", 10L);
    std::cerr << tree.toString();
    tree.add("yellow", 20L);
    std::cerr << tree.toString();
  }

  return true;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xf8, %rsp
xorps %xmm0, %xmm0
leaq -0x120(%rbp), %rsi
movaps %xmm0, 0x50(%rsi)
movaps %xmm0, 0x40(%rsi)
movaps %xmm0, 0x30(%rsi)
movaps %xmm0, 0x20(%rsi)
movaps %xmm0, 0x10(%rsi)
movaps %xmm0, (%rsi)
movq $0x4, 0x60(%rsi)
movq $0x5, 0x68(%rsi)
leaq -0x48(%rbp), %rdi
callq 0x2afe
movq 0x8433(%rip), %rdi      # 0xfff0
leaq -0x48(%rbp), %rsi
callq 0x21b0
leaq -0x48(%rbp), %rdi
callq 0x20d0
pushq $0xa
popq %r15
leaq -0x70(%rbp), %r14
leaq -0x120(%rbp), %r13
leaq -0x90(%rbp), %r12
movq %r15, -0x50(%rbp)
subq $0x1, -0x50(%rbp)
jb 0x7ce8
movq %r14, %rdi
leaq 0x26eb(%rip), %rsi      # 0xa2e9
leaq -0x48(%rbp), %rdx
callq 0x20b0
movq %r13, %rdi
movq %r14, %rsi
pushq $0x5
popq %rdx
callq 0x247c
movq %r14, %rdi
callq 0x20d0
leaq -0x48(%rbp), %rbx
movq %rbx, %rdi
movq %r13, %rsi
callq 0x2afe
movq %r12, %r15
movq 0x83ba(%rip), %r14      # 0xfff0
movq %r14, %rdi
movq %rbx, %rsi
callq 0x21b0
movq %rbx, %rdi
callq 0x20d0
leaq -0xb0(%rbp), %r12
movq %r12, %rdi
leaq 0x2866(%rip), %rsi      # 0xa4c0
movq %rbx, %rdx
callq 0x20b0
movq %r13, %rdi
movq %r12, %rsi
pushq $0xa
popq %rdx
callq 0x247c
movq %r12, %rdi
callq 0x20d0
movq %rbx, %rdi
movq %r13, %rsi
callq 0x2afe
movq %r14, %rdi
movq %rbx, %rsi
callq 0x21b0
movq %r15, %r12
movq %rbx, %rdi
callq 0x20d0
movq %r15, %rdi
leaq 0x269e(%rip), %rsi      # 0xa341
movq %rbx, %rdx
callq 0x20b0
movq %r13, %rdi
movq %r12, %rsi
pushq $0x14
popq %rdx
callq 0x247c
movq %r12, %rdi
callq 0x20d0
movq %rbx, %rdi
movq %r13, %rsi
callq 0x2afe
movq %r14, %rdi
movq %rbx, %rsi
callq 0x21b0
movq %rbx, %rdi
callq 0x20d0
leaq -0x70(%rbp), %r14
jmp 0x7be9
leaq -0x120(%rbp), %rdi
callq 0x8788
movb $0x1, %al
addq $0xf8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x7d40
jmp 0x7d3b
jmp 0x7d3b
jmp 0x7d3b
movq %rax, %rbx
leaq -0x90(%rbp), %rdi
jmp 0x7d47
movq %rax, %rbx
leaq -0x70(%rbp), %rdi
jmp 0x7d47
jmp 0x7d3b
jmp 0x7d3b
jmp 0x7d40
jmp 0x7d40
jmp 0x7d3b
movq %rax, %rbx
leaq -0xb0(%rbp), %rdi
jmp 0x7d47
movq %rax, %rbx
jmp 0x7d4c
movq %rax, %rbx
leaq -0x48(%rbp), %rdi
callq 0x20d0
leaq -0x120(%rbp), %rdi
callq 0x8788
movq %rbx, %rdi
callq 0x22d0
// File: /workspace/github_cpp_makefile_star2_O2/cegme[P]vose/test.cc
// Function: test::test7()
bool test::test7() {

  std::cerr << "Need to make sure each branch is being selected.\n";

  VoseTree tree;
  tree.set_max_marbles(0);
  tree.set_max_bags(4);

  tree.add("red", 5);
  tree.add("blue", 5);
  tree.add("yellow", 5);
  std::cerr << tree.toString();

  for( size_t i = 0; i != 6; ++i) {
    std::cerr << ">>> " << tree.rand_marble().label << "\n";
  }

  return true;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x108, %rsp            # imm = 0x108
movq 0x7be3(%rip), %rdi      # 0xfff0
leaq 0x20b1(%rip), %rsi      # 0xa4c5
callq 0x21e0
xorps %xmm0, %xmm0
movaps %xmm0, -0x80(%rbp)
movaps %xmm0, -0x90(%rbp)
movaps %xmm0, -0xa0(%rbp)
movaps %xmm0, -0xb0(%rbp)
movaps %xmm0, -0xc0(%rbp)
movaps %xmm0, -0xd0(%rbp)
andq $0x0, -0x70(%rbp)
movq $0x4, -0x68(%rbp)
leaq 0x1e92(%rip), %rsi      # 0xa2e9
leaq -0x130(%rbp), %rdi
leaq -0x58(%rbp), %rdx
callq 0x20b0
leaq -0xd0(%rbp), %rdi
leaq -0x130(%rbp), %rsi
pushq $0x5
popq %rdx
callq 0x247c
leaq -0x130(%rbp), %rdi
callq 0x20d0
leaq 0x2030(%rip), %rsi      # 0xa4c0
leaq -0x110(%rbp), %rdi
leaq -0x58(%rbp), %rdx
callq 0x20b0
leaq -0xd0(%rbp), %rdi
leaq -0x110(%rbp), %rsi
pushq $0x5
popq %rdx
callq 0x247c
leaq -0x110(%rbp), %rdi
callq 0x20d0
leaq 0x1e78(%rip), %rsi      # 0xa341
leaq -0xf0(%rbp), %rdi
leaq -0x58(%rbp), %rdx
callq 0x20b0
leaq -0xd0(%rbp), %rdi
leaq -0xf0(%rbp), %rsi
pushq $0x5
popq %rdx
callq 0x247c
leaq -0xf0(%rbp), %rdi
callq 0x20d0
leaq -0x58(%rbp), %rdi
leaq -0xd0(%rbp), %rsi
callq 0x2afe
movq 0x7ade(%rip), %rdi      # 0xfff0
leaq -0x58(%rbp), %rsi
callq 0x21b0
leaq -0x58(%rbp), %rdi
callq 0x20d0
pushq $0x6
popq %r12
leaq -0x50(%rbp), %r14
leaq -0xd0(%rbp), %r13
leaq 0x1ff2(%rip), %rbx      # 0xa52c
subq $0x1, %r12
jb 0x8582
movq 0x7aa9(%rip), %rdi      # 0xfff0
leaq 0x1fa9(%rip), %rsi      # 0xa4f7
callq 0x21e0
movq %rax, %r15
leaq -0x58(%rbp), %rdi
movq %r13, %rsi
callq 0x2a36
movq %r15, %rdi
movq %r14, %rsi
callq 0x21b0
movq %rax, %rdi
movq %rbx, %rsi
callq 0x21e0
movq %r14, %rdi
callq 0x20d0
jmp 0x853a
leaq -0xd0(%rbp), %rdi
callq 0x8788
movb $0x1, %al
addq $0x108, %rsp            # imm = 0x108
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
leaq -0x58(%rbp), %rdi
jmp 0x85e4
jmp 0x85d9
movq %rax, %rbx
leaq -0xf0(%rbp), %rdi
jmp 0x85e4
jmp 0x85d9
movq %rax, %rbx
leaq -0x110(%rbp), %rdi
jmp 0x85e4
jmp 0x85d9
movq %rax, %rbx
leaq -0x130(%rbp), %rdi
jmp 0x85e4
jmp 0x85d9
jmp 0x85d9
movq %rax, %rbx
jmp 0x85e9
movq %rax, %rbx
movq %r14, %rdi
callq 0x20d0
leaq -0xd0(%rbp), %rdi
callq 0x8788
movq %rbx, %rdi
callq 0x22d0
// File: /workspace/github_cpp_makefile_star2_O2/cegme[P]vose/test.cc
// Function: main
int main(int argc, char **argv) {
  
  test t;
  
  std::cout << "\nTest 1" << "----------------------------------------\n";
  t.test1();
  
  std::cout << "\nTest 2" << "----------------------------------------\n";
  t.test2();
  
  std::cout << "\nTest 3" << "----------------------------------------\n";
  t.test3();
  
  std::cout << "\nTest 4" << "----------------------------------------\n";
  t.test4();
  
  std::cout << "\nTest 5" << "----------------------------------------\n";
  t.test5();

  std::cout << "\nTest 6" << "----------------------------------------\n";
  t.test6();

  std::cout << "\nTest 7" << "----------------------------------------\n";
  t.test7();


 return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
movq 0x79c5(%rip), %rbx      # 0xffd0
leaq 0x1eea(%rip), %rsi      # 0xa4fc
movq %rbx, %rdi
callq 0x21e0
leaq 0x1ee3(%rip), %r14      # 0xa504
movq %rax, %rdi
movq %r14, %rsi
callq 0x21e0
callq 0x6e38
leaq 0x1ef6(%rip), %rsi      # 0xa52e
movq %rbx, %rdi
callq 0x21e0
movq %rax, %rdi
movq %r14, %rsi
callq 0x21e0
callq 0x7050
leaq 0x1edf(%rip), %rsi      # 0xa536
movq %rbx, %rdi
callq 0x21e0
movq %rax, %rdi
movq %r14, %rsi
callq 0x21e0
callq 0x757e
leaq 0x1ec8(%rip), %rsi      # 0xa53e
movq %rbx, %rdi
callq 0x21e0
movq %rax, %rdi
movq %r14, %rsi
callq 0x21e0
callq 0x7b68
leaq 0x1eb1(%rip), %rsi      # 0xa546
movq %rbx, %rdi
callq 0x21e0
movq %rax, %rdi
movq %r14, %rsi
callq 0x21e0
callq 0x7d60
leaq 0x1e9a(%rip), %rsi      # 0xa54e
movq %rbx, %rdi
callq 0x21e0
movq %rax, %rdi
movq %r14, %rsi
callq 0x21e0
callq 0x8158
leaq 0x1e83(%rip), %rsi      # 0xa556
movq %rbx, %rdi
callq 0x21e0
movq %rax, %rdi
movq %r14, %rsi
callq 0x21e0
callq 0x83f2
xorl %eax, %eax
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/cegme[P]vose/./Vose.h
// Function: Vose::probabilities()
inline std::vector<double> probabilities() {
    std::vector<double> v;
    std::for_each (scores.begin(), scores.end(), [&] (marble m) {
        v.push_back((double) m.weight/total_weight);
    });
    return v;
  }

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
movq %rsi, %rcx
movq %rdi, %rbx
andq $0x0, 0x10(%rdi)
xorps %xmm0, %xmm0
movups %xmm0, (%rdi)
movq 0x40(%rsi), %rdi
movq 0x48(%rsi), %rsi
movq %rbx, %rdx
callq 0x892b
movq %rbx, %rax
popq %rbx
popq %r14
popq %rbp
retq
movq %rax, %r14
movq %rbx, %rdi
callq 0x3a5e
movq %r14, %rdi
callq 0x22d0
nop