LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_cpp_makefile_star2_O2/aaronshim[P]SATurday/./parser.cpp
// Function: Parser::parse(_IO_FILE*)
Formula *Parser::parse(FILE *file) {
  int nClauses, nVars;
  fscanf(file, "p cnf %d %d", &nVars, &nClauses);

  Formula *formula = new Formula(nVars);

  for (int i = 0; i < nClauses; i ++) {
    Clause *clause = new Clause();
    formula->addClause(clause);

    // Get next literal.
    while (1) {
      int literal;
      int nScanned = fscanf(file, "%d", &literal);

      if (nScanned == 0 || literal == 0) break;

      clause->addLiteral(abs(literal) - 1, literal > 0);
    }
  }

  return formula;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rdi, %rbx
leaq 0x1405(%rip), %rsi      # 0x402b
leaq 0x14(%rsp), %r12
leaq 0x10(%rsp), %rcx
movq %r12, %rdx
xorl %eax, %eax
callq 0x21f0
pushq $0x20
popq %rdi
callq 0x2150
movq %rax, %r15
movl (%r12), %eax
andl $0x0, (%r15)
movl %eax, 0x4(%r15)
xorps %xmm0, %xmm0
andq $0x0, 0x18(%r15)
movups %xmm0, 0x8(%r15)
leaq 0x13cf(%rip), %r12      # 0x4034
leaq 0xc(%rsp), %r13
xorl %r14d, %r14d
cmpl 0x10(%rsp), %r14d
jge 0x2ccf
pushq $0x20
popq %rdi
callq 0x2150
movq %rax, %rbp
xorps %xmm0, %xmm0
movups %xmm0, (%rax)
movups %xmm0, 0x10(%rax)
movq %r15, %rdi
movq %rax, %rsi
callq 0x2a48
movq %rbx, %rdi
movq %r12, %rsi
movq %r13, %rdx
xorl %eax, %eax
callq 0x21f0
testl %eax, %eax
je 0x2cca
movl 0xc(%rsp), %eax
testl %eax, %eax
je 0x2cca
movl %eax, %esi
negl %esi
cmovsl %eax, %esi
decl %esi
xorl %edx, %edx
testl %eax, %eax
setg %dl
movq %rbp, %rdi
callq 0x2620
jmp 0x2c94
incl %r14d
jmp 0x2c6d
movq %r15, %rax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/aaronshim[P]SATurday/./solver.cpp
// Function: Solver::solve(Formula*)
Model *Solver::solve(Formula *formula) {
  Model *model = new Model(formula->getNVars());

  // // This is just testing code.
  // model->setVar(0);
  // model->setVar(1);
  // model->clearVar(2);
  // cout << model->toString() << endl;

  // Setup.
  srand(time(NULL));

  Model *solvedModel;

  // If nodes failed was surpassed, we restart.
  while (nodesFailed >= CUTOFF) {
    nodesFailed = 0;
    CUTOFF += GLOBAL_CUTOFF;
    solvedModel = solveR(formula, model, 0);
  }

  return solvedModel;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
pushq $0x10
popq %rdi
callq 0x2150
movq %rax, %r14
movl 0x4(%rbx), %esi
movq %rax, %rdi
callq 0x2384
xorl %edi, %edi
callq 0x2110
movl %eax, %edi
callq 0x2120
movl 0x43f1(%rip), %ecx      # 0x7110
cmpl %ecx, 0x4407(%rip)      # 0x712c
jl 0x2d49
andl $0x0, 0x43fe(%rip)      # 0x712c
addl $0xc8, %ecx
movl %ecx, 0x43d6(%rip)      # 0x7110
movq %rbx, %rdi
movq %r14, %rsi
xorl %edx, %edx
callq 0x2d68
jmp 0x2d19
addq $0x8, %rsp
popq %rbx
popq %r14
retq
movq %rax, %rbx
pushq $0x10
popq %rsi
movq %r14, %rdi
callq 0x2160
movq %rbx, %rdi
callq 0x21e0
nop
// File: /workspace/github_cpp_makefile_star2_O2/aaronshim[P]SATurday/./solver.cpp
// Function: Solver::solveR(Formula*, Model*, int)
Model *Solver::solveR(Formula *formula, Model *model, int backtrackDepth) {
  invariant(formula != NULL, 2331);

  // Restart solver if nodes failed is above cutoff.
  if (nodesFailed >= CUTOFF) {
    return NULL;
  }

  int state = formula->simplify(model);
  switch (state) {
    case -1: // If unsat, return null.
      if (DEBUG >= 5)
        cout << "Unsatisfied model: " << model->toString() << endl;
      return NULL;
    case 1: // If sat, return the model.
      model->complete();
      return model->clone();
  }

  int nextIndex = formula->nextVar();
  invariant(!model->isAssigned(nextIndex), 1940);

  // Should we try setting the literal or clearing the literal first?
  int firstSet = rand() % 2;
  //int firstSet = 0;

  if (DEBUG >= 5)
    cout << "firstSet = " << firstSet << endl;

  Model *retModel;

  if (DEBUG >= 5) {
    cout << "Trying a value for " << nextIndex + 1 << " at depth " <<
      backtrackDepth << "..." << endl;
  }
  if (DEBUG >= 2) {
    if (backtrackDepth > maxDepth) {
      maxDepth = backtrackDepth;
    }
    cout << "progress: " << backtrackDepth << "/" << formula->getNVars() <<
            "\tnodes failed: " << nodesFailed << endl;
  }

  if ((retModel = solveRClone(formula, model, nextIndex, firstSet, backtrackDepth))) {
    nodesFailed = 0;
    return retModel;
  }

  if (DEBUG >= 5) {
    cout << "Backtracking... depth=" << backtrackDepth << endl;
  }

  if ((retModel = solveRClone(formula, model, nextIndex, !firstSet, backtrackDepth))) {
    nodesFailed = 0;
    return retModel;
  }

  nodesFailed ++;

  return NULL;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movl %edx, %ebp
movq %rsi, %rbx
movq %rdi, %r14
xorl %edi, %edi
testq %r14, %r14
setne %dil
movl $0x91b, %esi            # imm = 0x91B
callq 0x233c
movl 0x439b(%rip), %eax      # 0x712c
cmpl 0x4379(%rip), %eax      # 0x7110
jge 0x2e48
movq %r14, %rdi
movq %rbx, %rsi
callq 0x29f8
cmpl $-0x1, %eax
je 0x2e48
cmpl $0x1, %eax
jne 0x2dce
movq %rbx, %rdi
callq 0x244c
movq %rbx, %rdi
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
jmp 0x250a
movq %r14, %rdi
callq 0x2a70
movl %eax, %r15d
movq 0x8(%rbx), %rax
movslq %r15d, %rcx
xorl %edi, %edi
cmpl $0x0, (%rax,%rcx,4)
sete %dil
movl $0x794, %esi            # imm = 0x794
callq 0x233c
callq 0x2050
pushq $0x2
popq %rcx
cltd
idivl %ecx
movl %edx, %r12d
movq %r14, %rdi
movq %rbx, %rsi
movl %r15d, %edx
movl %r12d, %ecx
movl %ebp, %r8d
callq 0x2e54
testq %rax, %rax
jne 0x2e39
xorl %ecx, %ecx
testl %r12d, %r12d
sete %cl
movq %r14, %rdi
movq %rbx, %rsi
movl %r15d, %edx
movl %ebp, %r8d
callq 0x2e54
testq %rax, %rax
je 0x2e42
andl $0x0, 0x42ec(%rip)      # 0x712c
jmp 0x2e4a
incl 0x42e4(%rip)            # 0x712c
xorl %eax, %eax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/aaronshim[P]SATurday/./solver.cpp
// Function: Solver::solveRClone(Formula*, Model*, int, int, int)
Model *Solver::solveRClone(Formula *formula, Model *model, int index, int setVar, int backtrackDepth) {
  Model *modelClone = model->clone();
  Formula *formulaClone = formula->clone();
  if (setVar) {
    modelClone->setVar(index);
  } else {
    modelClone->clearVar(index);
  }
  Model *retModel = solveR(formulaClone, modelClone, backtrackDepth + 1);
  delete formulaClone;
  delete modelClone;
  return retModel;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movl %r8d, %ebp
movl %ecx, %r14d
movl %edx, %r15d
movq %rdi, %r12
movq %rsi, %rdi
callq 0x250a
movq %rax, %rbx
movq %r12, %rdi
callq 0x2ab4
movq %rax, %r12
movq 0x8(%rbx), %rax
xorl %ecx, %ecx
cmpl $0x1, %r14d
sbbl %ecx, %ecx
movslq %r15d, %rdx
orl $0x1, %ecx
movl %ecx, (%rax,%rdx,4)
incl %ebp
movq %r12, %rdi
movq %rbx, %rsi
movl %ebp, %edx
callq 0x2d68
movq %rax, %r14
movq %r12, %rdi
callq 0x28b8
pushq $0x20
popq %rsi
movq %r12, %rdi
callq 0x2160
movq %rbx, %rdi
callq 0x23be
pushq $0x10
popq %rsi
movq %rbx, %rdi
callq 0x2160
movq %r14, %rax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/aaronshim[P]SATurday/main.cpp
// Function: main
int main(int argc, char **argv) {
  if (argc != 2) {
    cerr << "usage: saturday <filename>" << endl;
    return 1;
  }

  // Get file pointer for <filename>.
  char *fname = argv[1];
  FILE *file = Parser::open(fname);
  if (file == NULL) {
    cerr << "File '" << fname << "' failed to open!" << endl;
    return 1;
  }

  // Parse the file.
  Formula *formula = Parser::parse(file);
  fclose(file);

  if (DEBUG >= 5)
    cout << formula->toString();

  // // model testing code
  // Model *testModel = new Model(5);
  // testModel->setVar(1);
  // testModel->setVar(2);
  // testModel->clearVar(2);
  // cout << testModel->toString() << endl;

  Model *model = Solver::solve(formula);

  if (model == NULL) {
    cout << "s UNSATISFIABLE" << endl;
  } else {
    cout << "s SATISFIABLE" << endl;
    cout << "v " << model->toString() << endl;
  }

  return 0;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x20, %rsp
cmpl $0x2, %edi
jne 0x2f83
movq 0x8(%rsi), %rbx
movq %rbx, %rdi
callq 0x2ce2
testq %rax, %rax
je 0x2f93
movq %rax, %r14
movq %rax, %rdi
callq 0x2c0e
movq %rax, %rbx
movq %r14, %rdi
callq 0x2140
movq %rbx, %rdi
callq 0x2cee
testq %rax, %rax
je 0x2fcd
movq %rax, %rbx
movq 0x40a1(%rip), %r14      # 0x6fd0
leaq 0x1147(%rip), %rsi      # 0x407d
movq %r14, %rdi
callq 0x2130
movq %rax, %rdi
callq 0x20a0
leaq 0x113e(%rip), %rsi      # 0x408b
movq %r14, %rdi
callq 0x2130
movq %rax, %r14
movq %rsp, %r15
movq %r15, %rdi
movq %rbx, %rsi
callq 0x246e
movq %r14, %rdi
movq %r15, %rsi
callq 0x2100
movq %rax, %rdi
callq 0x20a0
movq %rsp, %rdi
callq 0x2090
jmp 0x2fe8
movq 0x4066(%rip), %rdi      # 0x6ff0
leaq 0x10a8(%rip), %rsi      # 0x4039
jmp 0x2fbb
movq 0x4056(%rip), %rdi      # 0x6ff0
leaq 0x10b3(%rip), %rsi      # 0x4054
callq 0x2130
movq %rax, %rdi
movq %rbx, %rsi
callq 0x2130
leaq 0x10a3(%rip), %rsi      # 0x405b
movq %rax, %rdi
callq 0x2130
movq %rax, %rdi
callq 0x20a0
pushq $0x1
popq %rax
jmp 0x2fea
movq 0x3ffc(%rip), %rdi      # 0x6fd0
leaq 0x1092(%rip), %rsi      # 0x406d
callq 0x2130
movq %rax, %rdi
callq 0x20a0
xorl %eax, %eax
addq $0x20, %rsp
popq %rbx
popq %r14
popq %r15
retq
movq %rax, %rbx
movq %rsp, %rdi
callq 0x2090
movq %rbx, %rdi
callq 0x21e0
nop
// File: /workspace/github_cpp_makefile_star2_O2/dacunni[P]stlloader/./stlloader.h
// Function: stlloader::print(stlloader::Facet const&)
void print(const Facet & facet)
{
    auto & n = facet.normal;
    printf("n %f %f %f\n", n.x, n.y, n.z);
    for(int i = 0; i < 3; ++i) {
        auto & v = facet.vertices[i];
        printf(" v%d %f %f %f\n", i, v.x, v.y, v.z);
    }
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rdi, %rbx
cvtss2sd 0x24(%rdi), %xmm0
cvtss2sd 0x28(%rdi), %xmm1
cvtss2sd 0x2c(%rdi), %xmm2
leaq 0x1af0(%rip), %rdi      # 0x4004
movb $0x3, %al
callq 0x2030
addq $0x8, %rbx
xorl %r14d, %r14d
leaq 0x1ae7(%rip), %r15      # 0x4010
cmpq $0x3, %r14
je 0x2553
cvtss2sd -0x8(%rbx), %xmm0
cvtss2sd -0x4(%rbx), %xmm1
cvtss2sd (%rbx), %xmm2
movq %r15, %rdi
movl %r14d, %esi
movb $0x3, %al
callq 0x2030
incq %r14
addq $0xc, %rbx
jmp 0x2529
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O2/dacunni[P]stlloader/./stlloader.h
// Function: stlloader::print(stlloader::Mesh const&)
void print(const Mesh & mesh)
{
    std::cout << "name: " << mesh.name << '\n';
    std::cout << "header: " << mesh.header << '\n';
    std::cout << "num facets: " << mesh.facets.size() << '\n';
    for(auto & facet : mesh.facets) {
        print(facet);
    }
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movq %rdi, %rbx
movq 0x4a61(%rip), %r14      # 0x6fc8
leaq 0x1ab1(%rip), %rsi      # 0x401f
movq %r14, %rdi
callq 0x21f0
leaq 0x18(%rbx), %rsi
movq %rax, %rdi
callq 0x21e0
pushq $0xa
popq %rbp
movq %rax, %rdi
movl %ebp, %esi
callq 0x2240
leaq 0x1a90(%rip), %rsi      # 0x4026
movq %r14, %rdi
callq 0x21f0
leaq 0x38(%rbx), %rsi
movq %rax, %rdi
callq 0x21e0
movq %rax, %rdi
movl %ebp, %esi
callq 0x2240
leaq 0x1a74(%rip), %rsi      # 0x402f
movq %r14, %rdi
callq 0x21f0
movq %rax, %rdi
movq 0x8(%rbx), %rax
subq (%rbx), %rax
pushq $0x30
popq %rcx
cqto
idivq %rcx
movq %rax, %rsi
callq 0x2170
movq %rax, %rdi
movl %ebp, %esi
callq 0x2240
movq (%rbx), %r14
movq 0x8(%rbx), %rbx
cmpq %rbx, %r14
je 0x2601
movq %r14, %rdi
callq 0x24f6
addq $0x30, %r14
jmp 0x25ee
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/dacunni[P]stlloader/./stlloader.h
// Function: stlloader::consume(std::istream&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&)
void consume(std::istream & is, const std::string & expected)
{
    std::string line, label;
    std::getline(is, line);
    std::istringstream ss(line);
    ss >> label;
    if(label != expected)
        throw;
}

// Assembly:
pushq %rbx
subq $0x1c0, %rsp            # imm = 0x1C0
movq %rsi, %rbx
leaq 0x30(%rsp), %rax
movq %rax, -0x10(%rax)
andq $0x0, -0x8(%rax)
xorl %ecx, %ecx
movb %cl, (%rax)
leaq 0x10(%rsp), %rax
movq %rax, -0x10(%rax)
andq $0x0, -0x8(%rax)
movb %cl, (%rax)
leaq 0x20(%rsp), %rsi
callq 0x2040
leaq 0x40(%rsp), %rdi
leaq 0x20(%rsp), %rsi
pushq $0x8
popq %rdx
callq 0x2310
leaq 0x40(%rsp), %rdi
movq %rsp, %rsi
callq 0x2260
movq %rsp, %rdi
movq %rbx, %rsi
callq 0x3505
testb %al, %al
jne 0x2690
leaq 0x40(%rsp), %rdi
callq 0x2110
movq %rsp, %rdi
callq 0x2100
leaq 0x20(%rsp), %rdi
callq 0x2100
addq $0x1c0, %rsp            # imm = 0x1C0
popq %rbx
retq
callq 0x22b0
jmp 0x2697
movq %rax, %rbx
jmp 0x26a9
movq %rax, %rbx
leaq 0x40(%rsp), %rdi
callq 0x2110
movq %rsp, %rdi
callq 0x2100
leaq 0x20(%rsp), %rdi
callq 0x2100
movq %rbx, %rdi
callq 0x2340
// File: /workspace/github_cpp_makefile_star2_O2/dacunni[P]stlloader/./stlloader.h
// Function: stlloader::parse_ascii_facet(std::istream&, stlloader::Facet&)
void parse_ascii_facet(std::istream & is, Facet & facet)
{
    std::string label, sub;
    auto ss = getlinestream(is);
    ss >> label >> sub;
    if(label == "outer" && sub == "loop") {
        int vi = 0;
        do {
            auto ss = getlinestream(is);
            ss >> label;
            if(label == "vertex") {
                if(vi < 3) {
                    ss >> facet.vertices[vi];
                }
                ++vi;
            }
        } while(label != "endloop");
        if(vi > 3)
            throw; // only support triangles
    }
    else { throw; }
    consume(is, "endfacet");
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x358, %rsp            # imm = 0x358
movq %rsi, 0x10(%rsp)
movq %rdi, %rbx
leaq 0x28(%rsp), %rax
movq %rax, -0x10(%rax)
andq $0x0, -0x8(%rax)
xorl %ecx, %ecx
movb %cl, (%rax)
leaq 0x48(%rsp), %rax
movq %rax, -0x10(%rax)
andq $0x0, -0x8(%rax)
movb %cl, (%rax)
leaq 0x1d8(%rsp), %rdi
movq %rbx, %rsi
callq 0x26c3
leaq 0x1d8(%rsp), %rdi
leaq 0x18(%rsp), %rsi
callq 0x2260
leaq 0x38(%rsp), %rsi
movq %rax, %rdi
callq 0x2260
leaq 0x18af(%rip), %rsi      # 0x403c
leaq 0x18(%rsp), %rdi
callq 0x350f
testb %al, %al
je 0x2892
leaq 0x18a6(%rip), %rsi      # 0x404c
leaq 0x38(%rsp), %rdi
callq 0x350f
testb %al, %al
je 0x2892
xorl %r14d, %r14d
leaq 0x58(%rsp), %r15
leaq 0x18(%rsp), %r12
leaq 0x1876(%rip), %r13      # 0x4042
leaq 0x1876(%rip), %rbp      # 0x4049
movq %r15, %rdi
movq %rbx, %rsi
callq 0x26c3
movq %r15, %rdi
movq %r12, %rsi
callq 0x2260
movq %r12, %rdi
movq %r13, %rsi
callq 0x350f
testb %al, %al
je 0x2815
cmpl $0x2, %r14d
jg 0x2812
movslq %r14d, %rax
imulq $0xc, %rax, %rsi
addq 0x10(%rsp), %rsi
movq %r15, %rdi
callq 0x24ac
incl %r14d
movq %r15, %rdi
callq 0x2110
movq %r12, %rdi
movq %rbp, %rsi
callq 0x351c
testb %al, %al
jne 0x27d3
cmpl $0x4, %r14d
jge 0x2899
leaq 0x1818(%rip), %rsi      # 0x4051
leaq 0x58(%rsp), %rdi
leaq 0xf(%rsp), %rdx
callq 0x3526
leaq 0x58(%rsp), %rsi
movq %rbx, %rdi
callq 0x2606
leaq 0x58(%rsp), %rdi
callq 0x2100
leaq 0x1d8(%rsp), %rdi
callq 0x2110
leaq 0x38(%rsp), %rdi
callq 0x2100
leaq 0x18(%rsp), %rdi
callq 0x2100
addq $0x358, %rsp            # imm = 0x358
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
callq 0x22b0
jmp 0x289e
callq 0x22b0
movq %rax, %rbx
leaq 0x58(%rsp), %rdi
callq 0x2100
jmp 0x28ca
jmp 0x28b8
jmp 0x28b8
movq %rax, %rbx
jmp 0x28d7
jmp 0x28b8
movq %rax, %rbx
jmp 0x28ca
movq %rax, %rbx
leaq 0x58(%rsp), %rdi
callq 0x2110
leaq 0x1d8(%rsp), %rdi
callq 0x2110
leaq 0x38(%rsp), %rdi
callq 0x2100
leaq 0x18(%rsp), %rdi
callq 0x2100
movq %rbx, %rdi
callq 0x2340
// File: /workspace/github_cpp_makefile_star2_O2/dacunni[P]stlloader/./stlloader.h
// Function: stlloader::parse_ascii_solid(std::istream&, stlloader::Mesh&)
void parse_ascii_solid(std::istream & is, Mesh & mesh)
{
    std::string line, kind, param;

    while(std::getline(is, line)) {
        std::istringstream ss(line);
        ss >> kind;
        if(kind == "endsolid") {
            break;
        }
        else if(kind == "facet") {
            Facet facet = {};
            ss >> param;
            if(param != "normal")
                throw;
            ss >> facet.normal;
            parse_ascii_facet(is, facet);
            mesh.facets.push_back(facet);
        }
        else { throw; }
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x228, %rsp            # imm = 0x228
movq %rsi, 0x8(%rsp)
movq %rdi, %r14
leaq 0x60(%rsp), %rax
movq %rax, -0x10(%rax)
andq $0x0, -0x8(%rax)
leaq 0x40(%rsp), %rcx
movq %rcx, -0x10(%rcx)
andq $0x0, -0x8(%rcx)
xorl %edx, %edx
movb %dl, (%rax)
movb %dl, (%rcx)
leaq 0x20(%rsp), %rax
movq %rax, -0x10(%rax)
andq $0x0, -0x8(%rax)
movb %dl, (%rax)
leaq 0x50(%rsp), %r12
leaq 0xa8(%rsp), %r13
leaq 0x30(%rsp), %r15
leaq 0x10(%rsp), %rbp
leaq 0x70(%rsp), %rbx
movq %r14, %rdi
movq %r12, %rsi
callq 0x2040
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
testb $0x5, 0x20(%rax,%rcx)
jne 0x2a36
movq %r13, %rdi
movq %r12, %rsi
pushq $0x8
popq %rdx
callq 0x2310
movq %r13, %rdi
movq %r15, %rsi
callq 0x2260
movq %r15, %rdi
leaq 0x16c0(%rip), %rsi      # 0x405a
callq 0x350f
testb %al, %al
jne 0x2a29
movq %r15, %rdi
leaq 0x16a3(%rip), %rsi      # 0x4054
callq 0x350f
testb %al, %al
je 0x2a6d
xorps %xmm0, %xmm0
movaps %xmm0, 0x90(%rsp)
movaps %xmm0, 0x80(%rsp)
movaps %xmm0, 0x70(%rsp)
movq %r13, %rdi
movq %rbp, %rsi
callq 0x2260
movq %rbp, %rdi
leaq 0x1678(%rip), %rsi      # 0x4063
callq 0x351c
testb %al, %al
jne 0x2a66
movq %r13, %rdi
leaq 0x94(%rsp), %rsi
callq 0x24d1
movq %r14, %rdi
movq %rbx, %rsi
callq 0x271c
movq 0x8(%rsp), %rdi
movq %rbx, %rsi
callq 0x3562
movq %r13, %rdi
callq 0x2110
jmp 0x295a
leaq 0xa8(%rsp), %rdi
callq 0x2110
leaq 0x10(%rsp), %rdi
callq 0x2100
leaq 0x30(%rsp), %rdi
callq 0x2100
leaq 0x50(%rsp), %rdi
callq 0x2100
addq $0x228, %rsp            # imm = 0x228
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
callq 0x22b0
jmp 0x2a72
callq 0x22b0
jmp 0x2a7f
jmp 0x2a7f
jmp 0x2a7a
jmp 0x2a7f
movq %rax, %rbx
jmp 0x2a8f
movq %rax, %rbx
leaq 0xa8(%rsp), %rdi
callq 0x2110
leaq 0x10(%rsp), %rdi
callq 0x2100
leaq 0x30(%rsp), %rdi
callq 0x2100
leaq 0x50(%rsp), %rdi
callq 0x2100
movq %rbx, %rdi
callq 0x2340
// File: /workspace/github_cpp_makefile_star2_O2/dacunni[P]stlloader/./stlloader.h
// Function: stlloader::parse_ascii_stream(std::istream&, stlloader::Mesh&)
void parse_ascii_stream(std::istream & is, Mesh & mesh)
{
    std::string line, kind;
    while(std::getline(is, line)) {
        std::istringstream ss(line);
        ss >> kind;
        if(kind == "solid") {
            ss.ignore(line.length(), ' ');
            std::getline(ss, mesh.name);
            parse_ascii_solid(is, mesh);
        }
        else { throw; }
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x1c8, %rsp            # imm = 0x1C8
movq %rsi, %rbx
leaq 0x18(%rsp), %rax
movq %rax, -0x10(%rax)
andq $0x0, -0x8(%rax)
movq %rdi, %r14
xorl %ecx, %ecx
movb %cl, (%rax)
leaq 0x38(%rsp), %rax
movq %rax, -0x10(%rax)
andq $0x0, -0x8(%rax)
movb %cl, (%rax)
leaq 0x18(%rsi), %r15
leaq 0x8(%rsp), %r12
leaq 0x48(%rsp), %r13
leaq 0x28(%rsp), %rbp
movq %r14, %rdi
movq %r12, %rsi
callq 0x2040
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
testb $0x5, 0x20(%rax,%rcx)
jne 0x2b76
movq %r13, %rdi
movq %r12, %rsi
pushq $0x8
popq %rdx
callq 0x2310
movq %r13, %rdi
movq %rbp, %rsi
callq 0x2260
movq %rbp, %rdi
leaq 0x1520(%rip), %rsi      # 0x405d
callq 0x350f
testb %al, %al
je 0x2b9c
movq 0x10(%rsp), %rsi
movq %r13, %rdi
pushq $0x20
popq %rdx
callq 0x2160
movq %r13, %rdi
movq %r15, %rsi
callq 0x2040
movq %r14, %rdi
movq %rbx, %rsi
callq 0x28f3
movq %r13, %rdi
callq 0x2110
jmp 0x2b01
leaq 0x28(%rsp), %rdi
callq 0x2100
leaq 0x8(%rsp), %rdi
callq 0x2100
addq $0x1c8, %rsp            # imm = 0x1C8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
callq 0x22b0
jmp 0x2baa
jmp 0x2ba5
movq %rax, %rbx
jmp 0x2bb7
movq %rax, %rbx
leaq 0x48(%rsp), %rdi
callq 0x2110
leaq 0x28(%rsp), %rdi
callq 0x2100
leaq 0x8(%rsp), %rdi
callq 0x2100
movq %rbx, %rdi
callq 0x2340
// File: /workspace/github_cpp_makefile_star2_O2/dacunni[P]stlloader/./stlloader.h
// Function: unsigned short stlloader::read_binary_value<unsigned short>(std::istream&)
uint16_t read_binary_value(std::istream & is) {
    uint16_t value;
    is.read((char*)&value, 2);
    value = little_endian_to_native(value);
    return value;
}

// Assembly:
pushq %rbx
subq $0x10, %rsp
leaq 0xe(%rsp), %rbx
pushq $0x2
popq %rdx
movq %rbx, %rsi
callq 0x2250
movzwl (%rbx), %eax
addq $0x10, %rsp
popq %rbx
retq
// File: /workspace/github_cpp_makefile_star2_O2/dacunni[P]stlloader/./stlloader.h
// Function: unsigned int stlloader::read_binary_value<unsigned int>(std::istream&)
uint32_t read_binary_value(std::istream & is) {
    uint32_t value;
    is.read((char*)&value, 4);
    value = little_endian_to_native(value);
    return value;
}

// Assembly:
pushq %rbx
subq $0x10, %rsp
leaq 0xc(%rsp), %rbx
pushq $0x4
popq %rdx
movq %rbx, %rsi
callq 0x2250
movl (%rbx), %edi
callq 0x358f
addq $0x10, %rsp
popq %rbx
retq
// File: /workspace/github_cpp_makefile_star2_O2/dacunni[P]stlloader/./stlloader.h
// Function: float stlloader::read_binary_value<float>(std::istream&)
float read_binary_value(std::istream & is) {
    float value;
    is.read((char*)&value, 4);
    value = little_endian_to_native(value);
    return value;
}

// Assembly:
pushq %rbx
subq $0x10, %rsp
leaq 0xc(%rsp), %rbx
pushq $0x4
popq %rdx
movq %rbx, %rsi
callq 0x2250
movl (%rbx), %edi
callq 0x358f
movd %eax, %xmm0
addq $0x10, %rsp
popq %rbx
retq
// File: /workspace/github_cpp_makefile_star2_O2/dacunni[P]stlloader/./stlloader.h
// Function: stlloader::Normal stlloader::read_binary_value<stlloader::Normal>(std::istream&)
Normal read_binary_value(std::istream & is) {
    Normal n;
    n.x = read_binary_value<float>(is);
    n.y = read_binary_value<float>(is);
    n.z = read_binary_value<float>(is);
    return n;
}

// Assembly:
pushq %rbx
subq $0x20, %rsp
movq %rdi, %rbx
callq 0x2c23
movaps %xmm0, 0x10(%rsp)
movq %rbx, %rdi
callq 0x2c23
movaps %xmm0, (%rsp)
movq %rbx, %rdi
callq 0x2c23
movaps %xmm0, %xmm1
movaps 0x10(%rsp), %xmm0
unpcklps (%rsp), %xmm0           # xmm0 = xmm0[0],mem[0],xmm0[1],mem[1]
addq $0x20, %rsp
popq %rbx
retq
// File: /workspace/github_cpp_makefile_star2_O2/dacunni[P]stlloader/./stlloader.h
// Function: stlloader::parse_binary_stream(std::istream&, stlloader::Mesh&)
void parse_binary_stream(std::istream & is, Mesh & mesh)
{
    char header[STL_BINARY_HDR_SIZE + 1]; // header plus null byte
    is.read(header, STL_BINARY_HDR_SIZE);
    header[STL_BINARY_HDR_SIZE] = '\0'; // null terminate just in case
    mesh.header = header;

    auto num_triangles = read_binary_value<uint32_t>(is);

    for(uint32_t ti = 0; ti < num_triangles; ++ti) {
        Facet facet = {};
        facet.normal = read_binary_value<Normal>(is);
        for(int vi = 0; vi < 3; ++vi) {
            facet.vertices[vi] = read_binary_value<Vertex>(is);
        }
        // This field is unused, but must be present
        //auto attrib_byte_count = read_binary_value<uint16_t>(is);
        read_binary_value<uint16_t>(is);
        mesh.facets.push_back(facet);
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x88, %rsp
movq %rsi, %rbx
movq %rdi, %r14
leaq 0x30(%rsp), %r15
pushq $0x50
popq %rdx
movq %r15, %rsi
callq 0x2250
movb $0x0, 0x50(%r15)
leaq 0x38(%rbx), %rdi
movq %r15, %rsi
callq 0x2360
movq %r14, %rdi
callq 0x2c01
movl %eax, %ebp
xorl %r12d, %r12d
movq %rsp, %r15
cmpl %ebp, %r12d
je 0x2d63
xorps %xmm0, %xmm0
movaps %xmm0, 0x20(%rsp)
movaps %xmm0, 0x10(%rsp)
movaps %xmm0, (%rsp)
movq %r14, %rdi
callq 0x2c49
movlps %xmm0, 0x24(%rsp)
movss %xmm1, 0x2c(%rsp)
pushq $0x8
popq %r13
movq %r14, %rdi
cmpq $0x2c, %r13
je 0x2d4e
callq 0x2c81
movlps %xmm0, -0x8(%rsp,%r13)
movss %xmm1, (%rsp,%r13)
addq $0xc, %r13
jmp 0x2d2e
callq 0x2be3
movq %rbx, %rdi
movq %r15, %rsi
callq 0x3562
incl %r12d
jmp 0x2d01
addq $0x88, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/dacunni[P]stlloader/./stlloader.h
// Function: stlloader::parse_stream(std::istream&, stlloader::Mesh&)
void parse_stream(std::istream & is, Mesh & mesh)
{
    // Read enough of file to determine its type.
    char header_start[6] = "";
    is.read(header_start, 5);
    header_start[5] = '\0';
    is.seekg(0, is.end);
    int file_size = is.tellg();

    // Rewind so parsers can start at the beginning.
    is.seekg(0, is.beg);

    // Ascii files start with "solid"
    bool is_ascii = (std::string(header_start) == "solid");

    // WAR: Some binary files appear to be ASCII, since they violate
    // the rule of not using "solid" in their metadata. Try to detect
    // this
    int geom_size = file_size - STL_BINARY_HDR_SIZE - STL_BINARY_META_SIZE;

    if(is_ascii &&
       geom_size > 0 &&
       geom_size % STL_BINARY_TRIANGLE_SIZE == 0) {
        //std::cout << "File looks suspiciously like a binary STL\n";
        is_ascii = false;
    }

    if(is_ascii) {
        parse_ascii_stream(is, mesh);
    }
    else {
        parse_binary_stream(is, mesh);
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movq %rsi, %rbx
leaq 0x10(%rsp), %r15
andw $0x0, 0x4(%r15)
movq %rdi, %r14
andl $0x0, (%r15)
pushq $0x5
popq %rdx
movq %r15, %rsi
callq 0x2250
movb $0x0, 0x5(%r15)
pushq $0x2
popq %rdx
movq %r14, %rdi
xorl %esi, %esi
callq 0x2290
movq %r14, %rdi
callq 0x2330
movq %rax, %r12
movq %r14, %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x2290
leaq 0x18(%rsp), %r13
leaq 0xf(%rsp), %rdx
movq %r13, %rdi
movq %r15, %rsi
callq 0x3526
leaq 0x1275(%rip), %rsi      # 0x405d
movq %r13, %rdi
callq 0x350f
movl %eax, %ebp
movq %r13, %rdi
callq 0x2100
addl $-0x54, %r12d
testl %r12d, %r12d
setle %cl
pushq $0x32
popq %rsi
movl %r12d, %eax
xorl %edx, %edx
divl %esi
testl %edx, %edx
setne %al
testb %bpl, %bpl
je 0x2e29
orb %al, %cl
je 0x2e29
movq %r14, %rdi
movq %rbx, %rsi
callq 0x2ab5
jmp 0x2e34
movq %r14, %rdi
movq %rbx, %rsi
callq 0x2cb9
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/dacunni[P]stlloader/./stlloader.h
// Function: stlloader::parse_file(char const*, stlloader::Mesh&)
void parse_file(const char * filename, Mesh & mesh)
{
    std::ifstream ifs;
    ifs.exceptions(std::ifstream::failbit | std::ifstream::badbit);
    try {
        ifs.open(filename, std::ifstream::binary);
    }
    catch(...) {
        throw std::runtime_error("File not found: " + std::string(filename));
    }
    parse_stream(ifs, mesh);
    ifs.close();
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x258, %rsp            # imm = 0x258
movq %rsi, %rbx
movq %rdi, %r14
leaq 0x50(%rsp), %r15
movq %r15, %rdi
callq 0x2230
movq (%r15), %rax
addq -0x18(%rax), %r15
pushq $0x5
popq %rsi
movq %r15, %rdi
callq 0x20a0
leaq 0x50(%rsp), %rdi
pushq $0x4
popq %rdx
movq %r14, %rsi
callq 0x2150
leaq 0x50(%rsp), %rdi
movq %rbx, %rsi
callq 0x2d75
leaq 0x50(%rsp), %rdi
callq 0x2050
leaq 0x50(%rsp), %rdi
callq 0x2070
addq $0x258, %rsp            # imm = 0x258
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rdi
callq 0x20d0
pushq $0x10
popq %rdi
callq 0x2120
movq %rax, %rbx
leaq 0x10(%rsp), %rdi
leaq 0xf(%rsp), %rdx
movq %r14, %rsi
callq 0x3526
leaq 0x118a(%rip), %rsi      # 0x406a
leaq 0x30(%rsp), %rdi
leaq 0x10(%rsp), %rdx
callq 0x35b1
movb $0x1, %bpl
leaq 0x30(%rsp), %rsi
movq %rbx, %rdi
callq 0x22e0
xorl %ebp, %ebp
movq 0x40e8(%rip), %rsi      # 0x6ff0
movq 0x40b1(%rip), %rdx      # 0x6fc0
movq %rbx, %rdi
callq 0x2320
movq %rax, %r14
leaq 0x30(%rsp), %rdi
callq 0x2100
jmp 0x2f2c
movq %rax, %r14
movb $0x1, %bpl
leaq 0x10(%rsp), %rdi
callq 0x2100
testb %bpl, %bpl
jne 0x2f40
jmp 0x2f48
movq %rax, %r14
movq %rbx, %rdi
callq 0x2190
callq 0x2300
jmp 0x2f5a
movq %rax, %rdi
callq 0x35d5
movq %rax, %r14
leaq 0x50(%rsp), %rdi
callq 0x2070
movq %r14, %rdi
callq 0x2340
// File: /workspace/github_cpp_makefile_star2_O2/dacunni[P]stlloader/stlcopy.cpp
// Function: main
int main(int argc, char ** argv)
{
    if(argc < 2) {
        std::cerr << "Please supply an input file\n";
        return EXIT_FAILURE;
    }
    if(argc < 3) {
        std::cerr << "Please supply an output file\n";
        return EXIT_FAILURE;
    }

    stlloader::Format format = stlloader::Format::ascii;
    if(argc > 3) {
        std::string format_arg(argv[3]);
        if(format_arg == "binary") format = stlloader::Format::binary;
        else if(format_arg == "ascii") format = stlloader::Format::ascii;
        else {
            std::cerr << "Unexpected output format: " << format_arg << '\n';
            return EXIT_FAILURE;
        }
    }

    stlloader::Mesh mesh;
    stlloader::parse_file(argv[1], mesh);
    stlloader::write_file(argv[2], mesh, format);

    return EXIT_SUCCESS;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x68, %rsp
cmpl $0x1, %edi
jg 0x33af
movq 0x3c42(%rip), %rdi      # 0x6fe8
leaq 0xd18(%rip), %rsi       # 0x40c5
jmp 0x33c2
cmpl $0x2, %edi
jne 0x33d9
movq 0x3c2d(%rip), %rdi      # 0x6fe8
leaq 0xd20(%rip), %rsi       # 0x40e2
callq 0x21f0
pushq $0x1
popq %r14
movl %r14d, %eax
addq $0x68, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
movq %rsi, %rbx
xorl %ebp, %ebp
cmpl $0x4, %edi
jb 0x347e
movq 0x18(%rbx), %rsi
leaq 0x10(%rsp), %rdi
leaq 0xf(%rsp), %rdx
callq 0x3526
leaq 0xcff(%rip), %rsi       # 0x4100
leaq 0x10(%rsp), %rdi
callq 0x350f
movb $0x1, %r15b
testb %al, %al
je 0x341a
xorl %r14d, %r14d
pushq $0x1
popq %rbp
jmp 0x346b
leaq 0xce6(%rip), %rsi       # 0x4107
leaq 0x10(%rsp), %rdi
callq 0x350f
xorl %ebp, %ebp
movl $0x0, %r14d
testb %al, %al
jne 0x346b
movq 0x3baa(%rip), %rdi      # 0x6fe8
leaq 0xcc8(%rip), %rsi       # 0x410d
callq 0x21f0
leaq 0x10(%rsp), %rsi
movq %rax, %rdi
callq 0x21e0
pushq $0xa
popq %rsi
movq %rax, %rdi
callq 0x2240
pushq $0x1
popq %r14
xorl %ebp, %ebp
xorl %r15d, %r15d
leaq 0x10(%rsp), %rdi
callq 0x2100
testb %r15b, %r15b
je 0x33cb
xorps %xmm0, %xmm0
leaq 0x38(%rsp), %rax
movaps %xmm0, -0x28(%rax)
andq $0x0, -0x18(%rax)
movq %rax, -0x10(%rax)
andq $0x0, -0x8(%rax)
xorl %ecx, %ecx
movb %cl, (%rax)
leaq 0x58(%rsp), %rax
movq %rax, -0x10(%rax)
andq $0x0, -0x8(%rax)
movb %cl, (%rax)
movq 0x8(%rbx), %rdi
leaq 0x10(%rsp), %rsi
callq 0x2e43
movq 0x10(%rbx), %rdi
leaq 0x10(%rsp), %rsi
movl %ebp, %edx
callq 0x3339
leaq 0x10(%rsp), %rdi
callq 0x3604
xorl %r14d, %r14d
jmp 0x33cb
movq %rax, %rbx
leaq 0x10(%rsp), %rdi
callq 0x2100
jmp 0x34fd
movq %rax, %rbx
jmp 0x34fd
movq %rax, %rbx
leaq 0x10(%rsp), %rdi
callq 0x3604
movq %rbx, %rdi
callq 0x2340
// File: /workspace/github_cpp_makefile_star2_O2/dacunni[P]stlloader/./stlloader.h
// Function: unsigned int stlloader::little_endian_to_native<unsigned int>(unsigned int)
T little_endian_to_native(T v) {
    T vn = 0;
    for(unsigned int i = 0; i < sizeof(T); ++i) {
        vn += (T)((uint8_t*)&v)[i] << (8 * i);
    }
    return vn;
}

// Assembly:
leaq -0x4(%rsp), %rdx
movl %edi, (%rdx)
xorl %ecx, %ecx
xorl %eax, %eax
cmpq $0x20, %rcx
je 0x35b0
movzbl (%rdx), %esi
shll %cl, %esi
addl %esi, %eax
addq $0x8, %rcx
incq %rdx
jmp 0x359a
retq
// File: /workspace/github_cpp_makefile_star2_O2/dacunni[P]stlloader/./stlloader.h
// Function: unsigned int stlloader::native_to_little_endian<unsigned int>(unsigned int)
T native_to_little_endian(T v) {
    T vn = 0;
    for(unsigned int i = 0; i < sizeof(T); ++i) {
        ((uint8_t*)&vn)[i] = (v >> (8 * i)) & 0xFF;
    }
    return vn;
}

// Assembly:
leaq -0x4(%rsp), %rax
andl $0x0, (%rax)
xorl %ecx, %ecx
cmpq $0x20, %rcx
je 0x35ff
movl %edi, %edx
shrl %cl, %edx
movb %dl, (%rax)
addq $0x8, %rcx
incq %rax
jmp 0x35ea
movl -0x4(%rsp), %eax
retq
// File: /workspace/github_cpp_makefile_star2_O2/reddragon[P]packed-memory-array/impl2.cpp
// Function: log2(int)
int log2(int n) {
    int lg2 = 0;
    while (n > 1) {
        n /= 2;
        ++lg2;
    }
    return lg2;
}

// Assembly:
xorl %eax, %eax
cmpl $0x2, %edi
jl 0x1289
shrl %edi
incl %eax
jmp 0x127e
retq
// File: /workspace/github_cpp_makefile_star2_O2/reddragon[P]packed-memory-array/impl2.cpp
// Function: test_inserts(PMA&)
void
test_inserts(PMA &p1) {
    p1.insert(80);
    p1.print();

    p1.insert(50);
    p1.print();

    p1.insert(70);
    p1.print();

    p1.insert(90);
    p1.print();

    // assert(is_sorted(p1.begin(), p1.end()));

    // return 0;
    p1.insert(65);
    p1.print();

    p1.insert(85);
    p1.print();

    p1.insert(10);
    p1.print();

    p1.insert(21);
    p1.print();

    p1.insert(22);
    p1.print();

    p1.insert(20);
    p1.print();

    p1.insert(24);
    p1.print();

    p1.insert(15);
    p1.print();

    p1.insert(17);
    p1.print();

    p1.insert(23);
    p1.print();
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
pushq $0x50
popq %rsi
callq 0x1434
movq %rbx, %rdi
callq 0x15ae
pushq $0x32
popq %rsi
movq %rbx, %rdi
callq 0x1434
movq %rbx, %rdi
callq 0x15ae
pushq $0x46
popq %rsi
movq %rbx, %rdi
callq 0x1434
movq %rbx, %rdi
callq 0x15ae
pushq $0x5a
popq %rsi
movq %rbx, %rdi
callq 0x1434
movq %rbx, %rdi
callq 0x15ae
pushq $0x41
popq %rsi
movq %rbx, %rdi
callq 0x1434
movq %rbx, %rdi
callq 0x15ae
pushq $0x55
popq %rsi
movq %rbx, %rdi
callq 0x1434
movq %rbx, %rdi
callq 0x15ae
pushq $0xa
popq %rsi
movq %rbx, %rdi
callq 0x1434
movq %rbx, %rdi
callq 0x15ae
pushq $0x15
popq %rsi
movq %rbx, %rdi
callq 0x1434
movq %rbx, %rdi
callq 0x15ae
pushq $0x16
popq %rsi
movq %rbx, %rdi
callq 0x1434
movq %rbx, %rdi
callq 0x15ae
pushq $0x14
popq %rsi
movq %rbx, %rdi
callq 0x1434
movq %rbx, %rdi
callq 0x15ae
pushq $0x18
popq %rsi
movq %rbx, %rdi
callq 0x1434
movq %rbx, %rdi
callq 0x15ae
pushq $0xf
popq %rsi
movq %rbx, %rdi
callq 0x1434
movq %rbx, %rdi
callq 0x15ae
pushq $0x11
popq %rsi
movq %rbx, %rdi
callq 0x1434
movq %rbx, %rdi
callq 0x15ae
pushq $0x17
popq %rsi
movq %rbx, %rdi
callq 0x1434
movq %rbx, %rdi
popq %rbx
jmp 0x15ae
// File: /workspace/github_cpp_makefile_star2_O2/reddragon[P]packed-memory-array/impl2.cpp
// Function: main
int
main() {
    dprintf("log2(%d) = %d\n", 6, log2(6));
    PMA p1;
    // PMA p2(4);
    // PMA p3(8);
    // PMA p10(1024);

    // p10.left_interval_boundary(54, 8);

    // test_inserts(p1);

    srand(0);
    vi_t v;
#define NINSERTS 10000000
    for (int i = 0; i < NINSERTS; ++i) {
        // p1.insert(rand() % 65536);
        p1.insert(NINSERTS - i);
        // v.insert(v.begin(), 100000 - i);
    }
    printf("%llu moves to insert %d elements\n", nmoves, p1.size());

    // assert(is_sorted(p1.begin(), p1.end()));

}

// Assembly:
pushq %rbp
pushq %rbx
subq $0x88, %rsp
leaq 0x18(%rsp), %rbx
pushq $0x2
popq %rsi
movq %rbx, %rdi
callq 0x1614
xorl %edi, %edi
callq 0x10c0
andq $0x0, 0x10(%rsp)
xorps %xmm0, %xmm0
movaps %xmm0, (%rsp)
movl $0x989680, %esi         # imm = 0x989680
movl $0x989680, %ebp         # imm = 0x989680
subl $0x1, %ebp
jb 0x13de
movq %rbx, %rdi
callq 0x1434
movl %ebp, %esi
jmp 0x13cd
movq 0x4ceb(%rip), %rsi      # 0x60d0
leaq 0x18(%rsp), %rbx
movl 0x18(%rbx), %edx
leaq 0x1c4c(%rip), %rdi      # 0x3040
xorl %eax, %eax
callq 0x1030
movq %rsp, %rdi
callq 0x22a6
movq %rbx, %rdi
callq 0x16f2
xorl %eax, %eax
addq $0x88, %rsp
popq %rbx
popq %rbp
retq
movq %rax, %rbx
movq %rsp, %rdi
callq 0x22a6
leaq 0x18(%rsp), %rdi
callq 0x16f2
movq %rbx, %rdi
callq 0x1140
// File: /workspace/github_cpp_makefile_star2_O2/reddragon[P]packed-memory-array/impl2.cpp
// Function: PMA::lower_bound(int)
int
    lower_bound(int v) {
        int i;
        if (this->nelems == 0) {
            i = this->impl.size();
        } else {
#if 0
            for (i = 0; i < this->impl.size(); ++i) {
                if (this->present[i] && !(this->impl[i] < v)) {
                    break;
                }
            }
#else
            int l = 0, r = this->nchunks;
            int m;
            while (l != r) {
                m = l + (r-l)/2;
                int sz;
                int left = left_interval_boundary(m * chunk_size, chunk_size);
                int pos = lb_in_chunk(left, v);

                // Why does this work? We assume that every chunk of
                // size this->chunk_size contains at least 1
                // element. Hence, if we reach the end of an interval
                // without finding a lower bound, we conclude that all
                // the elements in this chunk are < 'v'. Because every
                // chunk contains at least 1 element, we will never
                // reach the end of an interval because the interval
                // is empty.
                //
                // Note: This is why we need lower density thresholds!
                // 
                if (pos == left + chunk_size) {
                    // Move to right half
                    l = m + 1;
                } else {
                    r = m;
                }
            }
            i = l * chunk_size;
#endif
        }
        dprintf("lower_bound(%d) == %d\n", v, i);
        return i;
    }

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %esi, 0x4(%rsp)
movq %rdi, %r14
cmpl $0x0, 0x18(%rdi)
je 0x1783
movl 0x4c(%r14), %ebx
xorl %r13d, %r13d
movl %ebx, %eax
subl %r13d, %eax
je 0x177c
cltd
pushq $0x2
popq %rcx
idivl %ecx
movl %eax, %r15d
leal (%r15,%r13), %ebp
movl 0x48(%r14), %edx
movl %edx, %esi
imull %ebp, %esi
movq %r14, %rdi
callq 0x17a0
movl %eax, %r12d
movq %r14, %rdi
movl %eax, %esi
movl 0x4(%rsp), %edx
callq 0x1d46
addl 0x48(%r14), %r12d
cmpl %r12d, %eax
je 0x1774
movl %ebp, %ebx
jmp 0x1731
addl %r15d, %r13d
incl %r13d
jmp 0x1731
imull 0x48(%r14), %ebx
jmp 0x178e
movq 0x8(%r14), %rbx
subq (%r14), %rbx
shrq $0x2, %rbx
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/reddragon[P]packed-memory-array/impl2.cpp
// Function: PMA::left_interval_boundary(int, int)
int
    left_interval_boundary(int i, int interval_size) {
        assert(interval_size == (1 << log2(interval_size)));
        assert(i < (int)this->impl.size());

        int q = i / interval_size;
        int boundary = q * interval_size;
        dprintf("left_interval_boundary(%d, %d) = %d\n", i, interval_size, boundary);
        return boundary;
    }

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movl %edx, %ebp
movl %esi, %ebx
movq %rdi, %r14
movl %edx, %edi
callq 0x127c
pushq $0x1
popq %rdx
movl %eax, %ecx
shll %cl, %edx
cmpl %ebp, %edx
jne 0x17da
movq 0x8(%r14), %rax
subq (%r14), %rax
shrq $0x2, %rax
cmpl %ebx, %eax
jle 0x17f7
movl %ebx, %eax
cltd
idivl %ebp
subl %edx, %ebx
movl %ebx, %eax
popq %rbx
popq %r14
popq %rbp
retq
leaq 0x18be(%rip), %rdi      # 0x309f
leaq 0x1881(%rip), %rsi      # 0x3069
leaq 0x18dc(%rip), %rcx      # 0x30cb
pushq $0x7f
popq %rdx
callq 0x1090
leaq 0x18f7(%rip), %rdi      # 0x30f5
leaq 0x1864(%rip), %rsi      # 0x3069
leaq 0x18bf(%rip), %rcx      # 0x30cb
movl $0x80, %edx
callq 0x1090
// File: /workspace/github_cpp_makefile_star2_O2/reddragon[P]packed-memory-array/impl2.cpp
// Function: PMA::get_interval_stats(int, int, bool&, int&)
void
    get_interval_stats(int left, int level, bool &in_limit, int &sz) {
        double t = upper_threshold_at(level);
        int w = (1 << level) * this->chunk_size;
        sz = 0;
        for (int i = left; i < left + w; ++i) {
            sz += this->present[i] ? 1 : 0;
        }
        double q = (double)(sz+1) / double(w);
        dprintf("q: %f, t: %f\n", q, t);
        in_limit = q < t;
    }

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %r8, %r14
movq %rcx, %rbx
movl %edx, %ebp
movl %esi, %r12d
movq %rdi, %r15
movl %edx, %esi
callq 0x1e38
movsd %xmm0, (%rsp)
movl 0x48(%r15), %r13d
movl %ebp, %ecx
shll %cl, %r13d
andl $0x0, (%r14)
leal (%r12,%r13), %eax
addq $0x20, %r15
movslq %r12d, %r12
movslq %eax, %rbp
xorl %eax, %eax
cmpq %rbp, %r12
jge 0x189b
movq %r15, %rdi
movq %r12, %rsi
callq 0x1816
andq (%rax), %rdx
movl (%r14), %eax
cmpq $0x1, %rdx
sbbl $-0x1, %eax
movl %eax, (%r14)
incq %r12
jmp 0x1876
incl %eax
cvtsi2sd %eax, %xmm0
cvtsi2sd %r13d, %xmm1
divsd %xmm1, %xmm0
movsd (%rsp), %xmm1
ucomisd %xmm0, %xmm1
seta (%rbx)
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/reddragon[P]packed-memory-array/impl2.cpp
// Function: PMA::insert_merge(int, int)
void
    insert_merge(int l, int v) {
        dprintf("insert_merge(%d, %d)\n", l, v);
        // Insert by merging elements in a window of size 'chunk_size'
        tmp.clear();
        tmp.reserve(this->chunk_size);
        for (int i = l; i < l + this->chunk_size; ++i) {
            if (this->present[i]) {
                this->present[i] = false;
                tmp.push_back(this->impl[i]);
            }
        }
        vi_t::iterator iter = std::lower_bound(tmp.begin(), tmp.end(), v);
        tmp.insert(iter, v);

        dprintf("insert_merge::tmp.size(): %d\n", tmp.size());
        for (int i = 0; i < tmp.size(); ++i) {
            this->present[l + i] = true;
            this->impl[l + i] = tmp[i];
        }
        ++this->nelems;
        nmoves += chunk_size;
    }

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %esi, %ebp
movq %rdi, %rbx
movl %edx, 0x4(%rsp)
leaq 0x58(%rdi), %r15
movq 0x58(%rdi), %rax
cmpq %rax, 0x60(%rdi)
je 0x18ec
movq %rax, 0x60(%rbx)
movslq 0x48(%rbx), %rsi
movq %r15, %rdi
callq 0x1e7a
leaq 0x20(%rbx), %r14
movslq %ebp, %r13
leaq (,%r13,4), %rbp
movq %r13, %r12
movslq 0x48(%rbx), %rax
addq %r13, %rax
cmpq %rax, %r12
jge 0x194e
movq %r14, %rdi
movq %r12, %rsi
callq 0x1816
testq %rdx, (%rax)
je 0x1945
movq %r14, %rdi
movq %r12, %rsi
callq 0x1816
notq %rdx
andq %rdx, (%rax)
movq (%rbx), %rsi
addq %rbp, %rsi
movq %r15, %rdi
callq 0x1f2c
incq %r12
addq $0x4, %rbp
jmp 0x190a
movq 0x58(%rbx), %rdi
movq 0x60(%rbx), %rsi
leaq 0x4(%rsp), %r12
movq %r12, %rdx
callq 0x210b
movq %r15, %rdi
movq %rax, %rsi
movq %r12, %rdx
callq 0x1f4a
leaq (,%r13,4), %r15
xorl %r12d, %r12d
movq 0x60(%rbx), %rax
subq 0x58(%rbx), %rax
sarq $0x2, %rax
cmpq %r12, %rax
jbe 0x19b3
leaq (%r12,%r13), %rsi
movq %r14, %rdi
callq 0x1816
orq %rdx, (%rax)
movq 0x58(%rbx), %rax
movl (%rax,%r12,4), %eax
movq (%rbx), %rcx
addq %r15, %rcx
movl %eax, (%rcx,%r12,4)
incq %r12
jmp 0x197c
incl 0x18(%rbx)
movslq 0x48(%rbx), %rax
addq %rax, 0x470f(%rip)      # 0x60d0
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/reddragon[P]packed-memory-array/impl2.cpp
// Function: PMA::resize(int)
void
    resize(int capacity) {
        assert(capacity > this->impl.size());
        assert(1 << log2(capacity) == capacity);

        vi_t tmpi(capacity);
        vector<bool> tmpp(capacity);
        double d = (double)capacity / this->nelems;
        int ctr = 0;
        for (int i = 0; i < (int)this->impl.size(); ++i) {
            if (this->present[i]) {
                int idx = d*(ctr++);
                tmpp[idx] = true;
                tmpi[idx] = this->impl[i];
            }
        }
        this->impl.swap(tmpi);
        this->present.swap(tmpp);
        this->init_vars(capacity);
        nmoves += this->impl.size();
        // dprintf("After resize: ");
        // this->print();
    }

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x58, %rsp
movslq %esi, %r14
movq 0x8(%rdi), %rax
subq (%rdi), %rax
sarq $0x2, %rax
cmpq %r14, %rax
jae 0x1b28
movl %esi, %ebp
movq %rdi, %rbx
movl %esi, %edi
callq 0x127c
pushq $0x1
popq %rdx
movl %eax, %ecx
shll %cl, %edx
cmpl %ebp, %edx
jne 0x1b47
leaq 0x10(%rsp), %rdi
leaq 0x30(%rsp), %rdx
movq %r14, %rsi
callq 0x2184
leaq 0x30(%rsp), %rdi
leaq 0x3(%rsp), %rdx
movq %r14, %rsi
callq 0x21d6
movl %ebp, 0x4(%rsp)
cvtsi2sd %ebp, %xmm1
cvtsi2sdl 0x18(%rbx), %xmm0
divsd %xmm0, %xmm1
movsd %xmm1, 0x8(%rsp)
leaq 0x20(%rbx), %r14
xorl %r15d, %r15d
leaq 0x30(%rsp), %r12
xorl %ebp, %ebp
movq (%rbx), %rcx
movq 0x8(%rbx), %rax
movq %rax, %rdx
subq %rcx, %rdx
shrq $0x2, %rdx
movslq %edx, %rdx
cmpq %rdx, %r15
jge 0x1ab8
movq %r14, %rdi
movq %r15, %rsi
callq 0x1816
testq %rdx, (%rax)
je 0x1ab3
cvtsi2sd %ebp, %xmm0
mulsd 0x8(%rsp), %xmm0
cvttsd2si %xmm0, %eax
movslq %eax, %r13
movq %r12, %rdi
movq %r13, %rsi
callq 0x1816
incl %ebp
orq %rdx, (%rax)
movq (%rbx), %rax
movl (%rax,%r15,4), %eax
movq 0x10(%rsp), %rcx
movl %eax, (%rcx,%r13,4)
incq %r15
jmp 0x1a59
movq 0x10(%rbx), %rdx
leaq 0x10(%rsp), %r15
movaps (%r15), %xmm0
movups %xmm0, (%rbx)
movq 0x10(%r15), %rsi
movq %rsi, 0x10(%rbx)
movq %rcx, (%r15)
movq %rax, 0x8(%r15)
movq %rdx, 0x10(%r15)
leaq 0x30(%rsp), %r12
movq %r14, %rdi
movq %r12, %rsi
callq 0x2472
movq %rbx, %rdi
movl 0x4(%rsp), %esi
callq 0x21ea
movq 0x8(%rbx), %rax
subq (%rbx), %rax
sarq $0x2, %rax
addq %rax, 0x45c7(%rip)      # 0x60d0
movq %r12, %rdi
callq 0x226a
movq %r15, %rdi
callq 0x22a6
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x164c(%rip), %rdi      # 0x317b
leaq 0x1533(%rip), %rsi      # 0x3069
leaq 0x165b(%rip), %rcx      # 0x3198
movl $0x8a, %edx
callq 0x1090
leaq 0x1660(%rip), %rdi      # 0x31ae
leaq 0x1514(%rip), %rsi      # 0x3069
leaq 0x163c(%rip), %rcx      # 0x3198
movl $0x8b, %edx
callq 0x1090
movq %rax, %rbx
jmp 0x1b7a
jmp 0x1b6d
movq %rax, %rbx
leaq 0x30(%rsp), %rdi
callq 0x226a
leaq 0x10(%rsp), %rdi
callq 0x22a6
movq %rbx, %rdi
callq 0x1140
// File: /workspace/github_cpp_makefile_star2_O2/reddragon[P]packed-memory-array/impl2.cpp
// Function: PMA::lb_in_chunk(int, int)
int
    lb_in_chunk(int l, int v) {
        int i;
        for (i = l; i < l + chunk_size; ++i) {
            if (this->present[i]) {
                if (this->impl[i] >= v) {
                    return i;
                }
            }
        }
        return i;
    }

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movl %edx, %ebx
movq %rdi, %r14
leaq 0x20(%rdi), %r12
movslq %esi, %r13
movq %r13, %r15
movslq 0x48(%r14), %rax
addq %r13, %rax
cmpq %rax, %r15
jge 0x1d88
movq %r12, %rdi
movq %r15, %rsi
callq 0x1816
testq %rdx, (%rax)
je 0x1d83
movq (%r14), %rax
cmpl %ebx, (%rax,%r15,4)
jge 0x1d88
incq %r15
jmp 0x1d5e
movl %r15d, %eax
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/reddragon[P]packed-memory-array/impl2.cpp
// Function: PMA::init_vars(int)
void
    init_vars(int capacity) {
        this->chunk_size = 1 << log2(log2(capacity) * 2);
        assert(this->chunk_size == (1 << log2(this->chunk_size)));
        this->nchunks = capacity / this->chunk_size;
        this->nlevels = log2(this->nchunks);
        this->lgn = log2(capacity);
        dprintf("init_vars::capacity: %d, nelems: %d, chunk_size: %d, nchunks: %d\n", capacity, nelems, chunk_size, nchunks);
    }

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movl %esi, %ebp
movq %rdi, %rbx
movl %esi, %edi
callq 0x127c
movl %eax, %r14d
leal (%r14,%r14), %edi
callq 0x127c
pushq $0x1
popq %r12
movl %r12d, %r15d
movl %eax, %ecx
shll %cl, %r15d
movl %r15d, 0x48(%rbx)
movl %r15d, %edi
callq 0x127c
movl %eax, %ecx
shll %cl, %r12d
cmpl %r12d, %r15d
jne 0x224c
movl %ebp, %eax
cltd
idivl %r15d
movl %eax, 0x4c(%rbx)
movl %eax, %edi
callq 0x127c
movl %eax, 0x50(%rbx)
movl %r14d, 0x54(%rbx)
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
leaq 0xfac(%rip), %rdi       # 0x31ff
leaq 0xe0f(%rip), %rsi       # 0x3069
leaq 0xfd0(%rip), %rcx       # 0x3231
pushq $0x76
popq %rdx
callq 0x1090
nop
// File: /workspace/github_cpp_makefile_star2_O2/archit-p[P]bulletproofs-demo/src/num_theory.cpp
// Function: is_prime(long)
bool is_prime(long int n)
{
    if (n <= 1)  return false;
    if (n <= 3)  return true;

    if (n%2 == 0 || n%3 == 0) return false;
 
    for (int i=5; i*i<=n; i=i+6)
        if (n%i == 0 || n%(i+2) == 0)
           return false;
 
    return true;
}

// Assembly:
cmpq $0x2, %rdi
jge 0x1346
xorl %ecx, %ecx
jmp 0x134e
movb $0x1, %cl
cmpq $0x4, %rdi
jae 0x1351
movl %ecx, %eax
retq
xorl %ecx, %ecx
pushq $0x3
popq %rsi
movq %rdi, %rax
xorl %edx, %edx
divq %rsi
testb $0x1, %dil
je 0x134e
testq %rdx, %rdx
je 0x134e
pushq $0x5
popq %rsi
movq %rsi, %rax
imulq %rsi, %rax
cmpq %rdi, %rax
seta %cl
ja 0x134e
movq %rdi, %rax
xorl %edx, %edx
divq %rsi
testq %rdx, %rdx
je 0x134e
leaq 0x2(%rsi), %r8
movq %rdi, %rax
xorl %edx, %edx
divq %r8
addq $0x6, %rsi
testq %rdx, %rdx
jne 0x136c
jmp 0x134e