LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_cpp_makefile_star2_O1/aaronshim[P]SATurday/./clause.cpp
// Function: Clause::clone()
Clause *Clause::clone() {
  Clause *newClause = new Clause();

  for (int i = 0; i < nLiterals; i ++) {
    newClause->addLiteral(literals[i]->clone());
  }

  return newClause;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
movl $0x20, %edi
callq 0x2160
movq %rax, %r14
xorps %xmm0, %xmm0
movups %xmm0, (%rax)
movups %xmm0, 0x10(%rax)
cmpl $0x0, (%rbx)
jle 0x295e
xorl %r15d, %r15d
movq 0x8(%rbx), %rax
movq (%rax,%r15,8), %r12
movl $0x8, %edi
callq 0x2160
movl (%r12), %ecx
movb 0x4(%r12), %dl
movl %ecx, (%rax)
movb %dl, 0x4(%rax)
movq %r14, %rdi
movq %rax, %rsi
callq 0x276c
incq %r15
movslq (%rbx), %rax
cmpq %rax, %r15
jl 0x2928
movq %r14, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
nop
// File: /workspace/github_cpp_makefile_star2_O1/aaronshim[P]SATurday/./clause.cpp
// Function: Clause::toString[abi:cxx11]()
string Clause::toString() {
  ostringstream os;

  for (int i = 0; i < nLiterals; i ++) {
    os << literals[i]->toString() << " ";
  }

  return os.str();
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x1a8, %rsp            # imm = 0x1A8
movq %rsi, %r14
movq %rdi, 0x8(%rsp)
leaq 0x30(%rsp), %rdi
callq 0x21a0
cmpl $0x0, (%r14)
jle 0x2a03
leaq 0x20(%rsp), %rbp
xorl %ebx, %ebx
leaq 0x10(%rsp), %r15
leaq 0x30(%rsp), %r12
leaq 0x1672(%rip), %r13      # 0x4021
movq 0x8(%r14), %rax
movq (%rax,%rbx,8), %rsi
movq %r15, %rdi
callq 0x2648
movq 0x10(%rsp), %rsi
movq 0x18(%rsp), %rdx
movq %r12, %rdi
callq 0x2180
movl $0x1, %edx
movq %rax, %rdi
movq %r13, %rsi
callq 0x2180
movq 0x10(%rsp), %rdi
cmpq %rbp, %rdi
je 0x29f8
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x2170
incq %rbx
movslq (%r14), %rax
cmpq %rax, %rbx
jl 0x29af
leaq 0x38(%rsp), %rsi
movq 0x8(%rsp), %rbx
movq %rbx, %rdi
callq 0x21c0
movq 0x35ac(%rip), %rsi      # 0x5fc8
leaq 0x30(%rsp), %rdi
callq 0x20c0
leaq 0xa0(%rsp), %rdi
callq 0x2060
movq %rbx, %rax
addq $0x1a8, %rsp            # imm = 0x1A8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x2a4a
movq %rax, %rbx
jmp 0x2a69
movq %rax, %rbx
movq 0x10(%rsp), %rdi
cmpq %rbp, %rdi
je 0x2a69
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x2170
movq 0x3558(%rip), %rsi      # 0x5fc8
leaq 0x30(%rsp), %rdi
callq 0x20c0
leaq 0xa0(%rsp), %rdi
callq 0x2060
movq %rbx, %rdi
callq 0x2210
nop
// File: /workspace/github_cpp_makefile_star2_O1/aaronshim[P]SATurday/./formula.cpp
// Function: Formula::deleteSatisfied(Model*)
bool Formula::deleteSatisfied(Model *model) {
  for (int i = 0; i < nClauses; i ++) {
    if (clauses[i]->checkSat(model)) {
      delete clauses[i];
      clauses.erase(clauses.begin() + i);

      i --;
      nClauses --;
    } else {
      if (clauses[i]->deleteOffendingLiterals(model)) {
        return true;
      }
    }
  }

  return false;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
cmpl $0x0, (%rdi)
setg %bpl
jle 0x2c1b
movq %rsi, %rbx
movq %rdi, %r14
xorl %r12d, %r12d
movslq %r12d, %r13
movq 0x8(%r14), %rax
movq (%rax,%r13,8), %rdi
movq %rbx, %rsi
callq 0x27f8
movq 0x8(%r14), %rcx
movq (%rcx,%r13,8), %r15
testb %al, %al
je 0x2bfc
testq %r15, %r15
je 0x2bce
movq %r15, %rdi
callq 0x26e0
movl $0x20, %esi
movq %r15, %rdi
callq 0x2170
movq 0x8(%r14), %rax
movq 0x10(%r14), %rdx
leaq (%rax,%r13,8), %rsi
addq $0x8, %rsi
cmpq %rdx, %rsi
je 0x2bef
leaq (%rax,%r13,8), %rdi
subq %rsi, %rdx
callq 0x21d0
addq $-0x8, 0x10(%r14)
decl %r12d
decl (%r14)
jmp 0x2c0b
movq %r15, %rdi
movq %rbx, %rsi
callq 0x2864
testb %al, %al
jne 0x2c1b
incl %r12d
cmpl (%r14), %r12d
setl %bpl
jl 0x2b95
andb $0x1, %bpl
movl %ebp, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O1/aaronshim[P]SATurday/./formula.cpp
// Function: Formula::simplify(Model*)
int Formula::simplify(Model *model) {
  bool changed = true;

  while (changed) {
    changed = unitPropagate(model);
    if (deleteSatisfied(model)) return -1;
  }

  if (checkSat(model)) return 1;

  return 0;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movq %rsi, %r14
movq %rdi, %rbx
movq %rbx, %rdi
movq %r14, %rsi
callq 0x2afe
movl %eax, %ebp
movq %rbx, %rdi
movq %r14, %rsi
callq 0x2b74
testb %al, %al
jne 0x2c65
testb %bpl, %bpl
jne 0x2c3a
xorl %eax, %eax
cmpl $0x0, (%rbx)
sete %al
jmp 0x2c6a
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
popq %rbx
popq %r14
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O1/aaronshim[P]SATurday/./formula.cpp
// Function: Formula::clone()
Formula *Formula::clone() {
  Formula *newFormula = new Formula(nVars);

  for (int i = 0; i < nClauses; i ++) {
    newFormula->addClause(clauses[i]->clone());
  }

  return newFormula;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rdi, %rbx
movl $0x20, %edi
callq 0x2160
movq %rax, %r14
movl 0x4(%rbx), %eax
movl $0x0, (%r14)
movl %eax, 0x4(%r14)
xorps %xmm0, %xmm0
movups %xmm0, 0x8(%r14)
movq $0x0, 0x18(%r14)
cmpl $0x0, (%rbx)
jle 0x2d72
xorl %r15d, %r15d
movq 0x8(%rbx), %rax
movq (%rax,%r15,8), %rdi
callq 0x28fe
movq %r14, %rdi
movq %rax, %rsi
callq 0x2c78
incq %r15
movslq (%rbx), %rax
cmpq %rax, %r15
jl 0x2d4f
movq %r14, %rax
popq %rbx
popq %r14
popq %r15
retq
nop
// File: /workspace/github_cpp_makefile_star2_O1/aaronshim[P]SATurday/./formula.cpp
// Function: Formula::toString[abi:cxx11]()
string Formula::toString() {
  ostringstream os;

  os << "nClauses: " << nClauses << endl
     << "nVars: " << nVars << endl;

  for (int i = 0; i < nClauses; i ++) {
    os << clauses[i]->toString() << endl;
  }

  return os.str();
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x1a8, %rsp            # imm = 0x1A8
movq %rsi, %r14
movq %rdi, %rbx
leaq 0x30(%rsp), %r15
movq %r15, %rdi
callq 0x21a0
leaq 0x1271(%rip), %rsi      # 0x4018
movl $0xa, %edx
movq %r15, %rdi
callq 0x2180
movl (%r14), %esi
leaq 0x30(%rsp), %rdi
callq 0x2200
movq %rax, %r15
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r15, %rdi
movl $0xa, %esi
callq 0x2130
movsbl %al, %esi
movq %r15, %rdi
callq 0x2040
movq %rax, %rdi
callq 0x20e0
movq %rax, %r15
leaq 0x122e(%rip), %rsi      # 0x4023
movl $0x7, %edx
movq %rax, %rdi
callq 0x2180
movl 0x4(%r14), %esi
movq %r15, %rdi
callq 0x2200
movq %rax, %r15
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r15, %rdi
movl $0xa, %esi
callq 0x2130
movsbl %al, %esi
movq %r15, %rdi
callq 0x2040
movq %rax, %rdi
callq 0x20e0
movq %rbx, 0x8(%rsp)
cmpl $0x0, (%r14)
jle 0x2ec2
leaq 0x20(%rsp), %rbp
xorl %ebx, %ebx
leaq 0x10(%rsp), %r15
leaq 0x30(%rsp), %r12
movq 0x8(%r14), %rax
movq (%rax,%rbx,8), %rsi
movq %r15, %rdi
callq 0x296e
movq 0x10(%rsp), %rsi
movq 0x18(%rsp), %rdx
movq %r12, %rdi
callq 0x2180
movq %rax, %r13
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r13, %rdi
movl $0xa, %esi
callq 0x2130
movsbl %al, %esi
movq %r13, %rdi
callq 0x2040
movq %rax, %rdi
callq 0x20e0
movq 0x10(%rsp), %rdi
cmpq %rbp, %rdi
je 0x2eb7
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x2170
incq %rbx
movslq (%r14), %rax
cmpq %rax, %rbx
jl 0x2e54
leaq 0x38(%rsp), %rsi
movq 0x8(%rsp), %rbx
movq %rbx, %rdi
callq 0x21c0
movq 0x30ed(%rip), %rsi      # 0x5fc8
leaq 0x30(%rsp), %rdi
callq 0x20c0
leaq 0xa0(%rsp), %rdi
callq 0x2060
movq %rbx, %rax
addq $0x1a8, %rsp            # imm = 0x1A8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x2f09
movq %rax, %rbx
jmp 0x2f28
movq %rax, %rbx
movq 0x10(%rsp), %rdi
cmpq %rbp, %rdi
je 0x2f28
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x2170
movq 0x3099(%rip), %rsi      # 0x5fc8
leaq 0x30(%rsp), %rdi
callq 0x20c0
leaq 0xa0(%rsp), %rdi
callq 0x2060
movq %rbx, %rdi
callq 0x2210
// File: /workspace/github_cpp_makefile_star2_O1/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 $0x28, %rsp
movq %rdi, %rbx
leaq 0x10c5(%rip), %rsi      # 0x402b
leaq 0x24(%rsp), %r14
leaq 0xc(%rsp), %r15
movq %r14, %rdx
movq %r15, %rcx
xorl %eax, %eax
callq 0x2220
movl $0x20, %edi
callq 0x2160
movl (%r14), %ecx
movl $0x0, (%rax)
movl %ecx, 0x4(%rax)
xorps %xmm0, %xmm0
movups %xmm0, 0x8(%rax)
movq %rax, 0x10(%rsp)
movq $0x0, 0x18(%rax)
cmpl $0x0, (%r15)
jle 0x307a
leaq 0x4(%rsp), %r12
xorl %eax, %eax
movl %eax, 0x8(%rsp)
movl $0x20, %edi
callq 0x2160
movq %rax, %r14
xorps %xmm0, %xmm0
movups %xmm0, (%rax)
movups %xmm0, 0x10(%rax)
movq 0x10(%rsp), %rdi
movq %rax, %rsi
callq 0x2c78
movq %rbx, %rdi
leaq 0x104a(%rip), %rsi      # 0x4034
movq %r12, %rdx
xorl %eax, %eax
callq 0x2220
testl %eax, %eax
setne %al
movl 0x4(%rsp), %r15d
testl %r15d, %r15d
setne %cl
andb %al, %cl
cmpb $0x1, %cl
jne 0x306a
movq %r14, %rbp
addq $0x8, %rbp
movl %r15d, %r13d
negl %r13d
cmovsl %r15d, %r13d
decl %r13d
movl $0x8, %edi
callq 0x2160
testl %r15d, %r15d
movl %r13d, (%rax)
setg 0x4(%rax)
movq %rax, 0x18(%rsp)
movq %rbp, %rdi
leaq 0x18(%rsp), %rsi
callq 0x3520
incl (%r14)
movq %rbx, %rdi
leaq 0xfe2(%rip), %rsi       # 0x4034
movq %r12, %rdx
xorl %eax, %eax
callq 0x2220
testl %eax, %eax
je 0x306a
movl 0x4(%rsp), %r15d
testl %r15d, %r15d
jne 0x3012
movl 0x8(%rsp), %eax
incl %eax
cmpl 0xc(%rsp), %eax
jl 0x2fb8
movq 0x10(%rsp), %rax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O1/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 %r15
pushq %r14
pushq %rbx
movq %rdi, %r14
movl $0x10, %edi
callq 0x2160
movq %rax, %rbx
movslq 0x4(%r14), %rax
leaq (,%rax,4), %r15
testq %rax, %rax
movl %eax, (%rbx)
movq $-0x1, %rdi
cmovnsq %r15, %rdi
callq 0x2030
movq %rax, 0x8(%rbx)
movq %rax, %rdi
xorl %esi, %esi
movq %r15, %rdx
callq 0x20d0
xorl %edi, %edi
callq 0x2110
movl %eax, %edi
callq 0x2120
movl 0x3033(%rip), %ecx      # 0x6128
movl $0x0, 0x3045(%rip)      # 0x6144
addl $0xc8, %ecx
movl %ecx, 0x301d(%rip)      # 0x6128
movq %r14, %rdi
movq %rbx, %rsi
xorl %edx, %edx
callq 0x3144
movl 0x300a(%rip), %ecx      # 0x6128
cmpl %ecx, 0x3020(%rip)      # 0x6144
jge 0x30f5
popq %rbx
popq %r14
popq %r15
retq
movq %rax, %r14
movl $0x10, %esi
movq %rbx, %rdi
callq 0x2170
movq %r14, %rdi
callq 0x2210
// File: /workspace/github_cpp_makefile_star2_O1/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 0x238c
movl 0x2fd7(%rip), %eax      # 0x6144
cmpl 0x2fb5(%rip), %eax      # 0x6128
jge 0x3248
movq %r14, %rdi
movq %rbx, %rsi
callq 0x2c30
cmpl $-0x1, %eax
je 0x3248
cmpl $0x1, %eax
jne 0x31c5
cmpl $0x0, (%rbx)
jle 0x31b5
movq 0x8(%rbx), %rax
xorl %ecx, %ecx
cmpl $0x0, (%rax,%rcx,4)
jne 0x31aa
movl $0xffffffff, (%rax,%rcx,4) # imm = 0xFFFFFFFF
incq %rcx
movslq (%rbx), %rdx
cmpq %rdx, %rcx
jl 0x319d
movq %rbx, %rdi
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
jmp 0x25a0
movq %r14, %rdi
callq 0x2cb6
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 0x238c
callq 0x2050
movl %eax, %r12d
shrl $0x1f, %eax
addl %r12d, %eax
andl $-0x2, %eax
subl %eax, %r12d
movq %r14, %rdi
movq %rbx, %rsi
movl %r15d, %edx
movl %r12d, %ecx
movl %ebp, %r8d
callq 0x3254
testq %rax, %rax
jne 0x3236
xorl %ecx, %ecx
testl %r12d, %r12d
sete %cl
movq %r14, %rdi
movq %rbx, %rsi
movl %r15d, %edx
movl %ebp, %r8d
callq 0x3254
testq %rax, %rax
je 0x3242
movl $0x0, 0x2f04(%rip)      # 0x6144
jmp 0x324a
incl 0x2efc(%rip)            # 0x6144
xorl %eax, %eax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O1/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 0x25a0
movq %rax, %rbx
movq %r12, %rdi
callq 0x2d14
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 0x3144
movq %rax, %r14
movq %r12, %rdi
callq 0x2a90
movl $0x20, %esi
movq %r12, %rdi
callq 0x2170
movq 0x8(%rbx), %rdi
testq %rdi, %rdi
je 0x32cd
movl $0x4, %esi
callq 0x2170
movl $0x10, %esi
movq %rbx, %rdi
callq 0x2170
movq %r14, %rax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O1/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
xorps %xmm0, %xmm0
cvtss2sd -0x8(%rbx), %xmm0
xorps %xmm1, %xmm1
cvtss2sd -0x4(%rbx), %xmm1
xorps %xmm2, %xmm2
cvtss2sd (%rbx), %xmm2
movq %r15, %rdi
movl %r14d, %esi
movb $0x3, %al
callq 0x2030
incq %r14
addq $0xc, %rbx
cmpq $0x3, %r14
jne 0x2529
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O1/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
subq $0x10, %rsp
movq %rdi, %rbx
movq 0x3a56(%rip), %r14      # 0x5fc8
leaq 0x1aa6(%rip), %rsi      # 0x401f
movl $0x6, %edx
movq %r14, %rdi
callq 0x2200
movq 0x18(%rbx), %rsi
movq 0x20(%rbx), %rdx
movq %r14, %rdi
callq 0x2200
movb $0xa, %bpl
leaq 0xd(%rsp), %rsi
movb %bpl, (%rsi)
movl $0x1, %edx
movq %rax, %rdi
callq 0x2200
leaq 0x1a71(%rip), %rsi      # 0x4026
movl $0x8, %edx
movq %r14, %rdi
callq 0x2200
movq 0x38(%rbx), %rsi
movq 0x40(%rbx), %rdx
movq %r14, %rdi
callq 0x2200
leaq 0xe(%rsp), %rsi
movb %bpl, (%rsi)
movl $0x1, %edx
movq %rax, %rdi
callq 0x2200
leaq 0x1a41(%rip), %rsi      # 0x402f
movl $0xc, %edx
movq %r14, %rdi
callq 0x2200
movq 0x8(%rbx), %rax
subq (%rbx), %rax
sarq $0x4, %rax
movabsq $-0x5555555555555555, %rsi # imm = 0xAAAAAAAAAAAAAAAB
imulq %rax, %rsi
movq %r14, %rdi
callq 0x2120
leaq 0xf(%rsp), %rsi
movb %bpl, (%rsi)
movl $0x1, %edx
movq %rax, %rdi
callq 0x2200
movq (%rbx), %r14
movq 0x8(%rbx), %rbx
cmpq %rbx, %r14
je 0x264b
movq %r14, %rdi
callq 0x24f6
addq $0x30, %r14
jmp 0x2638
addq $0x10, %rsp
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O1/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 %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x1c8, %rsp            # imm = 0x1C8
movq %rsi, %rbx
movq %rdi, %r14
leaq 0x38(%rsp), %r15
movq %r15, -0x10(%r15)
xorl %eax, %eax
movq %rax, -0x8(%r15)
movb %al, (%r15)
leaq 0x18(%rsp), %r12
movq %r12, -0x10(%r12)
movq %rax, -0x8(%r12)
movb %al, (%r12)
movq (%rdi), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x2190
movsbl %al, %edx
leaq 0x28(%rsp), %rsi
movq %r14, %rdi
callq 0x2340
leaq 0x48(%rsp), %rdi
leaq 0x28(%rsp), %rsi
movl $0x8, %edx
callq 0x22e0
leaq 0x48(%rsp), %rdi
leaq 0x8(%rsp), %rsi
callq 0x2220
movq 0x10(%rsp), %rdx
cmpq 0x8(%rbx), %rdx
jne 0x2750
testq %rdx, %rdx
je 0x26f5
movq (%rbx), %rsi
movq 0x8(%rsp), %rdi
callq 0x21c0
testl %eax, %eax
jne 0x2750
movq 0x38bc(%rip), %rsi      # 0x5fb8
leaq 0x48(%rsp), %rdi
callq 0x2250
leaq 0xc0(%rsp), %rdi
callq 0x2090
movq 0x8(%rsp), %rdi
cmpq %r12, %rdi
je 0x272a
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x21b0
movq 0x28(%rsp), %rdi
cmpq %r15, %rdi
je 0x2741
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x21b0
addq $0x1c8, %rsp            # imm = 0x1C8
popq %rbx
popq %r12
popq %r14
popq %r15
retq
callq 0x2260
jmp 0x2757
movq %rax, %rbx
jmp 0x277d
movq %rax, %rbx
movq 0x3852(%rip), %rsi      # 0x5fb8
leaq 0x48(%rsp), %rdi
callq 0x2250
leaq 0xc0(%rsp), %rdi
callq 0x2090
movq 0x8(%rsp), %rdi
cmpq %r12, %rdi
je 0x2794
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x21b0
movq 0x28(%rsp), %rdi
cmpq %r15, %rdi
je 0x27ab
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x21b0
movq %rbx, %rdi
callq 0x2320
// File: /workspace/github_cpp_makefile_star2_O1/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
movq %rdi, %r14
leaq 0x18(%rsp), %rcx
movq %rcx, -0x10(%rcx)
xorl %eax, %eax
movq %rax, -0x8(%rcx)
movb %al, (%rcx)
leaq 0x38(%rsp), %rcx
movq %rcx, -0x10(%rcx)
movq %rax, -0x8(%rcx)
movb %al, (%rcx)
leaq 0x18(%rsi), %r15
leaq 0x8(%rsp), %r13
leaq 0x48(%rsp), %rbp
leaq 0x28(%rsp), %r12
movq (%r14), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x2190
movsbl %al, %edx
movq %r14, %rdi
movq %r13, %rsi
callq 0x2340
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
testb $0x5, 0x20(%rax,%rcx)
jne 0x2e99
movq %rbp, %rdi
movq %r13, %rsi
movl $0x8, %edx
callq 0x22e0
movq %rbp, %rdi
movq %r12, %rsi
callq 0x2220
movq %r12, %rdi
leaq 0x1233(%rip), %rsi      # 0x405d
callq 0x2070
testl %eax, %eax
jne 0x2ee3
movq 0x10(%rsp), %rsi
movq %rbp, %rdi
movl $0x20, %edx
callq 0x2110
movq 0x48(%rsp), %rax
movq -0x18(%rax), %rdi
addq %rbp, %rdi
movl $0xa, %esi
callq 0x2190
movsbl %al, %edx
movq %rbp, %rdi
movq %r15, %rsi
callq 0x2340
movq %r14, %rdi
movq %rbx, %rsi
callq 0x2adb
movq %rbp, %rdi
movq 0x3136(%rip), %rsi      # 0x5fb8
callq 0x2250
leaq 0xc0(%rsp), %rdi
callq 0x2090
jmp 0x2dd1
movq 0x28(%rsp), %rdi
leaq 0x38(%rsp), %rax
cmpq %rax, %rdi
je 0x2eb5
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x21b0
movq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
cmpq %rax, %rdi
je 0x2ed1
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x21b0
addq $0x1c8, %rsp            # imm = 0x1C8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
callq 0x2260
jmp 0x2eec
jmp 0x2ef1
movq %rax, %rbx
jmp 0x2f12
movq %rax, %rbx
movq 0x30bd(%rip), %rsi      # 0x5fb8
leaq 0x48(%rsp), %rdi
callq 0x2250
leaq 0xc0(%rsp), %rdi
callq 0x2090
movq 0x28(%rsp), %rdi
leaq 0x38(%rsp), %rax
cmpq %rax, %rdi
je 0x2f2e
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x21b0
movq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
cmpq %rax, %rdi
je 0x2f4a
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x21b0
movq %rbx, %rdi
callq 0x2320
// File: /workspace/github_cpp_makefile_star2_O1/dacunni[P]stlloader/./stlloader.h
// Function: float stlloader::little_endian_to_native<float>(float)
float little_endian_to_native(float v) {
    uint32_t vntemp;
    std::memcpy(&vntemp, &v, sizeof(vntemp));
    vntemp = little_endian_to_native(vntemp);
    float result;
    std::memcpy(&result, &vntemp, sizeof(vntemp)); 
    return result;
}

// Assembly:
leaq -0x4(%rsp), %rax
movss %xmm0, (%rax)
xorl %ecx, %ecx
xorl %edx, %edx
movzbl (%rax), %esi
shll %cl, %esi
addl %esi, %edx
addq $0x8, %rcx
incq %rax
cmpq $0x20, %rcx
jne 0x2f5f
movd %edx, %xmm0
retq
// File: /workspace/github_cpp_makefile_star2_O1/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 0xc(%rsp), %rbx
movl $0x2, %edx
movq %rbx, %rsi
callq 0x2210
movzwl (%rbx), %eax
leaq 0xe(%rsp), %rdx
movw %ax, (%rdx)
xorl %ecx, %ecx
xorl %eax, %eax
movzbl (%rdx), %esi
shll %cl, %esi
addl %esi, %eax
addq $0x8, %rcx
incq %rdx
cmpq $0x8, %rcx
je 0x2f9e
addq $0x10, %rsp
popq %rbx
retq
// File: /workspace/github_cpp_makefile_star2_O1/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 0x8(%rsp), %rbx
movl $0x4, %edx
movq %rbx, %rsi
callq 0x2210
movl (%rbx), %eax
leaq 0xc(%rsp), %rdx
movl %eax, (%rdx)
xorl %ecx, %ecx
xorl %eax, %eax
movzbl (%rdx), %esi
shll %cl, %esi
addl %esi, %eax
addq $0x8, %rcx
incq %rdx
cmpq $0x20, %rcx
jne 0x2fdc
addq $0x10, %rsp
popq %rbx
retq
// File: /workspace/github_cpp_makefile_star2_O1/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 0x8(%rsp), %rbx
movl $0x4, %edx
movq %rbx, %rsi
callq 0x2210
movss (%rbx), %xmm0
leaq 0xc(%rsp), %rax
movss %xmm0, (%rax)
xorl %ecx, %ecx
xorl %edx, %edx
movzbl (%rax), %esi
shll %cl, %esi
addl %esi, %edx
addq $0x8, %rcx
incq %rax
cmpq $0x20, %rcx
jne 0x301e
movd %edx, %xmm0
addq $0x10, %rsp
popq %rbx
retq
// File: /workspace/github_cpp_makefile_star2_O1/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 0x2ff6
movaps %xmm0, 0x10(%rsp)
movq %rbx, %rdi
callq 0x2ff6
movaps %xmm0, (%rsp)
movq %rbx, %rdi
callq 0x2ff6
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_O1/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 $0x98, %rsp
movq %rsi, %rbx
movq %rdi, %r14
leaq 0x40(%rsp), %rbp
movl $0x50, %edx
movq %rbp, %rsi
callq 0x2210
movb $0x0, 0x50(%rbp)
leaq 0x38(%rbx), %r12
movq 0x40(%rbx), %r13
movq %rbp, %rdi
callq 0x20c0
xorl %r15d, %r15d
movq %r12, %rdi
xorl %esi, %esi
movq %r13, %rdx
movq %rbp, %rcx
movq %rax, %r8
callq 0x2290
movq %r14, %rdi
callq 0x2fb8
testl %eax, %eax
je 0x31f0
movl %eax, %ebp
leaq 0x10(%rsp), %r12
xorps %xmm0, %xmm0
movaps %xmm0, 0x30(%rsp)
movaps %xmm0, 0x20(%rsp)
movaps %xmm0, 0x10(%rsp)
movq %r14, %rdi
callq 0x2ff6
movaps %xmm0, (%rsp)
movq %r14, %rdi
callq 0x2ff6
movaps (%rsp), %xmm1
unpcklps %xmm0, %xmm1            # xmm1 = xmm1[0],xmm0[0],xmm1[1],xmm0[1]
movaps %xmm1, (%rsp)
movq %r14, %rdi
callq 0x2ff6
movaps (%rsp), %xmm1
movlps %xmm1, 0x34(%rsp)
movss %xmm0, 0x3c(%rsp)
movl $0x8, %r13d
movq %r14, %rdi
callq 0x2ff6
movaps %xmm0, (%rsp)
movq %r14, %rdi
callq 0x2ff6
movaps (%rsp), %xmm1
unpcklps %xmm0, %xmm1            # xmm1 = xmm1[0],xmm0[0],xmm1[1],xmm0[1]
movaps %xmm1, (%rsp)
movq %r14, %rdi
callq 0x2ff6
movaps (%rsp), %xmm1
movlps %xmm1, 0x8(%rsp,%r13)
movss %xmm0, 0x10(%rsp,%r13)
addq $0xc, %r13
cmpq $0x2c, %r13
jne 0x3164
movq %r14, %rdi
callq 0x2f78
movq 0x8(%rbx), %rsi
cmpq 0x10(%rbx), %rsi
je 0x31d9
movaps 0x10(%rsp), %xmm0
movaps 0x20(%rsp), %xmm1
movaps 0x30(%rsp), %xmm2
movups %xmm2, 0x20(%rsi)
movups %xmm1, 0x10(%rsi)
movups %xmm0, (%rsi)
addq $0x30, 0x8(%rbx)
jmp 0x31e4
movq %rbx, %rdi
movq %r12, %rdx
callq 0x3e5a
incl %r15d
cmpl %ebp, %r15d
jne 0x3116
addq $0x98, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O1/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, 0x8(%rsp)
movq %rdi, %r14
leaq 0x10(%rsp), %r12
movw $0x0, 0x4(%r12)
movl $0x0, (%r12)
movl $0x5, %edx
movq %r12, %rsi
callq 0x2210
movb $0x0, 0x5(%r12)
movq %r14, %rdi
xorl %esi, %esi
movl $0x2, %edx
callq 0x2240
movq %r14, %rdi
callq 0x2310
movq %rax, %r15
movq %r14, %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x2240
leaq 0x28(%rsp), %rbx
movq %rbx, -0x10(%rbx)
movq %r12, %rdi
callq 0x20c0
leaq (%rsp,%rax), %rdx
addq $0x10, %rdx
leaq 0x18(%rsp), %r13
movq %r13, %rdi
movq %r12, %rsi
callq 0x3dca
leaq 0xdc7(%rip), %rsi       # 0x405d
movq %r13, %rdi
callq 0x2070
movl %eax, %ebp
movq (%r13), %rdi
cmpq %rbx, %rdi
je 0x32b6
movq 0x28(%rsp), %rsi
incq %rsi
callq 0x21b0
addl $-0x54, %r15d
testl %r15d, %r15d
setg %al
imulq $0x51eb851f, %r15, %rcx # imm = 0x51EB851F
shrq $0x24, %rcx
imull $0x32, %ecx, %ecx
subl %ecx, %r15d
orl %ebp, %r15d
sete %cl
testl %ebp, %ebp
jne 0x32ee
andb %cl, %al
jne 0x32ee
movq %r14, %rdi
movq 0x8(%rsp), %rsi
callq 0x2d87
jmp 0x32fb
movq %r14, %rdi
movq 0x8(%rsp), %rsi
callq 0x30ac
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O1/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 0x21f0
movq (%r15), %rax
movq -0x18(%rax), %rax
leaq (%rsp,%rax), %rdi
addq $0x50, %rdi
movl $0x5, 0x1c(%rdi)
movl 0x20(%rdi), %esi
callq 0x22f0
leaq 0x50(%rsp), %rdi
movq %r14, %rsi
movl $0x4, %edx
callq 0x2100
leaq 0x50(%rsp), %rdi
movq %rbx, %rsi
callq 0x3202
leaq 0x50(%rsp), %rdi
callq 0x2040
leaq 0x50(%rsp), %rdi
callq 0x2050
addq $0x258, %rsp            # imm = 0x258
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rdi
callq 0x20b0
movl $0x10, %edi
callq 0x20d0
movq %rax, %rbx
leaq 0x10(%rsp), %rdi
leaq 0xf(%rsp), %rdx
movq %r14, %rsi
callq 0x3c36
leaq 0xcb3(%rip), %rsi       # 0x406a
leaq 0x30(%rsp), %rdi
leaq 0x10(%rsp), %rdx
callq 0x3c73
movb $0x1, %bpl
leaq 0x30(%rsp), %rsi
movq %rbx, %rdi
callq 0x22b0
xorl %ebp, %ebp
movq 0x2c11(%rip), %rsi      # 0x5ff0
movq 0x2bda(%rip), %rdx      # 0x5fc0
movq %rbx, %rdi
callq 0x2300
movq %rax, %r14
leaq 0x40(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x3414
movq 0x40(%rsp), %rsi
incq %rsi
callq 0x21b0
jmp 0x3414
movq %rax, %r14
movb $0x1, %bpl
leaq 0x20(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x3437
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x21b0
jmp 0x3437
movq %rax, %r14
movb $0x1, %bpl
testb %bpl, %bpl
je 0x3444
movq %rbx, %rdi
callq 0x2140
callq 0x22d0
jmp 0x3456
movq %rax, %rdi
callq 0x3ce3
movq %rax, %r14
leaq 0x50(%rsp), %rdi
callq 0x2050
movq %r14, %rdi
callq 0x2320
// File: /workspace/github_cpp_makefile_star2_O1/dacunni[P]stlloader/./stlloader.h
// Function: float stlloader::native_to_little_endian<float>(float)
float native_to_little_endian(float v) {
    uint32_t vntemp;
    std::memcpy(&vntemp, &v, sizeof(vntemp));
    vntemp = native_to_little_endian(vntemp);
    float result;
    std::memcpy(&result, &vntemp, sizeof(vntemp)); 
    return result;
}

// Assembly:
movd %xmm0, %eax
leaq -0x4(%rsp), %rdx
movl $0x0, (%rdx)
xorl %ecx, %ecx
movl %eax, %esi
shrl %cl, %esi
movb %sil, (%rdx)
addq $0x8, %rcx
incq %rdx
cmpq $0x20, %rcx
jne 0x353f
movss -0x4(%rsp), %xmm0
retq
// File: /workspace/github_cpp_makefile_star2_O1/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 0x12b2
xorl %eax, %eax
movl %edi, %ecx
shrl %ecx
incl %eax
cmpl $0x3, %edi
movl %ecx, %edi
ja 0x12a7
retq
// File: /workspace/github_cpp_makefile_star2_O1/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
movl $0x50, %esi
callq 0x14a2
movq %rbx, %rdi
callq 0x163e
movq %rbx, %rdi
movl $0x32, %esi
callq 0x14a2
movq %rbx, %rdi
callq 0x163e
movq %rbx, %rdi
movl $0x46, %esi
callq 0x14a2
movq %rbx, %rdi
callq 0x163e
movq %rbx, %rdi
movl $0x5a, %esi
callq 0x14a2
movq %rbx, %rdi
callq 0x163e
movq %rbx, %rdi
movl $0x41, %esi
callq 0x14a2
movq %rbx, %rdi
callq 0x163e
movq %rbx, %rdi
movl $0x55, %esi
callq 0x14a2
movq %rbx, %rdi
callq 0x163e
movq %rbx, %rdi
movl $0xa, %esi
callq 0x14a2
movq %rbx, %rdi
callq 0x163e
movq %rbx, %rdi
movl $0x15, %esi
callq 0x14a2
movq %rbx, %rdi
callq 0x163e
movq %rbx, %rdi
movl $0x16, %esi
callq 0x14a2
movq %rbx, %rdi
callq 0x163e
movq %rbx, %rdi
movl $0x14, %esi
callq 0x14a2
movq %rbx, %rdi
callq 0x163e
movq %rbx, %rdi
movl $0x18, %esi
callq 0x14a2
movq %rbx, %rdi
callq 0x163e
movq %rbx, %rdi
movl $0xf, %esi
callq 0x14a2
movq %rbx, %rdi
callq 0x163e
movq %rbx, %rdi
movl $0x11, %esi
callq 0x14a2
movq %rbx, %rdi
callq 0x163e
movq %rbx, %rdi
movl $0x17, %esi
callq 0x14a2
movq %rbx, %rdi
popq %rbx
jmp 0x163e
// File: /workspace/github_cpp_makefile_star2_O1/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 $0x78, %rsp
leaq 0x8(%rsp), %rbx
movq %rbx, %rdi
movl $0x2, %esi
callq 0x16b4
xorl %edi, %edi
callq 0x10c0
movl $0x989680, %ebp         # imm = 0x989680
movq %rbx, %rdi
movl %ebp, %esi
callq 0x14a2
decl %ebp
jne 0x13ff
movq 0x3cac(%rip), %rsi      # 0x50c0
movl 0x20(%rsp), %edx
leaq 0x1c21(%rip), %rdi      # 0x3040
xorl %eax, %eax
callq 0x1030
movq 0x60(%rsp), %rdi
testq %rdi, %rdi
je 0x143d
movq 0x70(%rsp), %rsi
subq %rdi, %rsi
callq 0x10e0
movq 0x28(%rsp), %rdi
testq %rdi, %rdi
je 0x146d
movq 0x48(%rsp), %rsi
subq %rdi, %rsi
callq 0x10e0
xorl %eax, %eax
movq %rax, 0x28(%rsp)
movl %eax, 0x30(%rsp)
movq %rax, 0x38(%rsp)
movl %eax, 0x40(%rsp)
movq %rax, 0x48(%rsp)
movq 0x8(%rsp), %rdi
testq %rdi, %rdi
je 0x1484
movq 0x18(%rsp), %rsi
subq %rdi, %rsi
callq 0x10e0
xorl %eax, %eax
addq $0x78, %rsp
popq %rbx
popq %rbp
retq
movq %rax, %rbx
leaq 0x8(%rsp), %rdi
callq 0x17b8
movq %rbx, %rdi
callq 0x1120
// File: /workspace/github_cpp_makefile_star2_O1/reddragon[P]packed-memory-array/impl2.cpp
// Function: PMA::PMA(int)
PMA(int capacity = 2)
        : nelems(0) {
        assert(capacity > 1);
        assert(1 << log2(capacity) == capacity);

        this->init_vars(capacity);
        this->impl.resize(capacity);
        this->present.resize(capacity);
    }

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
xorl %eax, %eax
movq %rax, 0x20(%rdi)
movl %eax, 0x28(%rdi)
movq %rax, 0x30(%rdi)
movl %eax, 0x38(%rdi)
movq %rax, 0x40(%rdi)
xorps %xmm0, %xmm0
movups %xmm0, 0x58(%rdi)
movq %rax, 0x68(%rdi)
movups %xmm0, (%rdi)
movups %xmm0, 0xc(%rdi)
cmpl $0x2, %esi
jl 0x1741
movl %esi, %ebp
movq %rdi, %rbx
leaq 0x20(%rdi), %r14
leaq 0x58(%rdi), %r12
movl $0xffffffff, %ecx       # imm = 0xFFFFFFFF
movl %esi, %edx
movl %ebp, %eax
shrl %eax
incl %ecx
cmpl $0x3, %edx
movl %eax, %edx
ja 0x16fd
movl $0x2, %eax
shll %cl, %eax
cmpl %ebp, %eax
jne 0x1760
movq %rbx, %rdi
movl %ebp, %esi
callq 0x2440
movl %ebp, %r15d
movq %rbx, %rdi
movq %r15, %rsi
callq 0x2644
movq %r14, %rdi
movq %r15, %rsi
xorl %edx, %edx
callq 0x2676
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
leaq 0x1b44(%rip), %rdi      # 0x328c
leaq 0x191a(%rip), %rsi      # 0x3069
leaq 0x1b43(%rip), %rcx      # 0x3299
movl $0x63, %edx
callq 0x1090
leaq 0x1a47(%rip), %rdi      # 0x31ae
leaq 0x18fb(%rip), %rsi      # 0x3069
leaq 0x1b24(%rip), %rcx      # 0x3299
movl $0x64, %edx
callq 0x1090
movq %rax, %r15
movq (%r12), %rdi
testq %rdi, %rdi
je 0x1797
movq 0x68(%rbx), %rsi
subq %rdi, %rsi
callq 0x10e0
movq %r14, %rdi
callq 0x2616
movq %rbx, %rdi
callq 0x1140
movq %r15, %rdi
callq 0x1120
movq %rax, %rdi
callq 0x211a
nop
// File: /workspace/github_cpp_makefile_star2_O1/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, %rbx
cmpl $0x0, 0x18(%rdi)
je 0x1874
movl 0x4c(%rbx), %ebp
xorl %r14d, %r14d
testl %ebp, %ebp
je 0x186d
movl %ebp, %eax
subl %r14d, %eax
movl %eax, %r13d
shrl $0x1f, %r13d
addl %eax, %r13d
sarl %r13d
leal (%r14,%r13), %r12d
movl 0x48(%rbx), %edx
movl %edx, %esi
imull %r12d, %esi
movq %rbx, %rdi
callq 0x1892
movl %eax, %r15d
movq %rbx, %rdi
movl %eax, %esi
movl 0x4(%rsp), %edx
callq 0x20a0
addl 0x48(%rbx), %r15d
cmpl %r15d, %eax
je 0x1862
movl %r12d, %ebp
jmp 0x1868
addl %r13d, %r14d
incl %r14d
cmpl %ebp, %r14d
jne 0x181c
imull 0x48(%rbx), %r14d
jmp 0x187f
movq 0x8(%rbx), %r14
subq (%rbx), %r14
shrq $0x2, %r14
movl %r14d, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O1/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 %rax
movl %edx, %r8d
xorl %ecx, %ecx
cmpl $0x2, %edx
jl 0x18b0
xorl %ecx, %ecx
movl %r8d, %edx
movl %r8d, %eax
shrl %eax
incl %ecx
cmpl $0x3, %edx
movl %eax, %edx
ja 0x18a5
movl $0x1, %eax
shll %cl, %eax
cmpl %r8d, %eax
jne 0x18d7
movq 0x8(%rdi), %rax
subq (%rdi), %rax
shrq $0x2, %rax
cmpl %esi, %eax
jle 0x18f6
movl %esi, %eax
cltd
idivl %r8d
subl %edx, %esi
movl %esi, %eax
popq %rcx
retq
leaq 0x17c1(%rip), %rdi      # 0x309f
leaq 0x1784(%rip), %rsi      # 0x3069
leaq 0x17df(%rip), %rcx      # 0x30cb
movl $0x7f, %edx
callq 0x1090
leaq 0x17f8(%rip), %rdi      # 0x30f5
leaq 0x1765(%rip), %rsi      # 0x3069
leaq 0x17c0(%rip), %rcx      # 0x30cb
movl $0x80, %edx
callq 0x1090
nop
// File: /workspace/github_cpp_makefile_star2_O1/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 %r12
pushq %rbx
movq %r8, %r14
movq %rcx, %rbx
movl %edx, %ebp
movl %esi, %r15d
movq %rdi, %r12
movl %edx, %esi
callq 0x2126
movl 0x48(%r12), %eax
movl %ebp, %ecx
shll %cl, %eax
movl $0x0, (%r14)
testl %eax, %eax
jle 0x19a1
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
leal (%rax,%r15), %r8d
movl (%r14), %edx
movq 0x20(%r12), %rsi
movslq %r15d, %rdi
movslq %r8d, %r8
leaq 0x3f(%rcx), %r9
leaq 0x3f(%rdi), %r10
testq %rdi, %rdi
cmovnsq %rdi, %r10
sarq $0x6, %r10
leaq (%rsi,%r10,8), %r10
movq %rdi, %r11
andq %r9, %r11
xorl %r15d, %r15d
cmpq %rcx, %r11
setbe %r15b
movq -0x8(%r10,%r15,8), %r10
btq %rdi, %r10
adcl $0x0, %edx
incq %rdi
cmpq %r8, %rdi
jl 0x1967
movl %edx, (%r14)
movl (%r14), %ecx
incl %ecx
cvtsi2sd %ecx, %xmm1
cvtsi2sd %eax, %xmm2
divsd %xmm2, %xmm1
ucomisd %xmm1, %xmm0
seta (%rbx)
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O1/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
subq $0x18, %rsp
movl %esi, %ebp
movq %rdi, %rbx
movl %edx, 0xc(%rsp)
leaq 0x58(%rdi), %rax
movq %rax, 0x10(%rsp)
movq 0x58(%rdi), %rax
cmpq %rax, 0x60(%rdi)
je 0x19f0
movq %rax, 0x60(%rbx)
movabsq $-0x8000000000000000, %r12 # imm = 0x8000000000000000
movslq 0x48(%rbx), %rsi
movq 0x10(%rsp), %rdi
callq 0x216a
cmpl $0x0, 0x48(%rbx)
movslq %ebp, %r13
jle 0x1ab1
leaq (,%r13,4), %rbp
leaq 0x3f(%r12), %r14
movq %r13, %r15
leaq 0x3f(%r15), %rax
testq %r15, %r15
cmovnsq %r15, %rax
sarq $0x6, %rax
shlq $0x3, %rax
addq 0x20(%rbx), %rax
movq %r15, %rcx
andq %r14, %rcx
xorl %edx, %edx
cmpq %r12, %rcx
setbe %dl
movl $0x1, %esi
movl %r15d, %ecx
shlq %cl, %rsi
movq -0x8(%rax,%rdx,8), %rcx
btq %r15, %rcx
jae 0x1a9a
leaq -0x8(,%rdx,8), %rdx
notq %rsi
andq %rsi, %rcx
movq %rcx, (%rax,%rdx)
movq (%rbx), %rdx
addq %rbp, %rdx
movq 0x60(%rbx), %rsi
cmpq 0x68(%rbx), %rsi
je 0x1a90
movl (%rdx), %eax
movl %eax, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x60(%rbx)
jmp 0x1a9a
movq 0x10(%rsp), %rdi
callq 0x2296
incq %r15
movslq 0x48(%rbx), %rax
addq %r13, %rax
addq $0x4, %rbp
cmpq %rax, %r15
jl 0x1a25
movq 0x58(%rbx), %rsi
movq 0x60(%rbx), %rcx
subq %rsi, %rcx
sarq $0x2, %rcx
testq %rcx, %rcx
jle 0x1af3
movl 0xc(%rsp), %eax
movq %rcx, %rdx
shrq %rdx
movq %rdx, %rdi
notq %rdi
addq %rcx, %rdi
leaq (%rsi,%rdx,4), %rcx
addq $0x4, %rcx
cmpl %eax, -0x4(%rcx)
cmovlq %rcx, %rsi
cmovgeq %rdx, %rdi
movq %rdi, %rcx
testq %rdi, %rdi
jg 0x1ac9
leaq 0xc(%rsp), %rdx
movq 0x10(%rsp), %rdi
callq 0x2200
movq 0x58(%rbx), %rax
movq 0x60(%rbx), %rdx
subq %rax, %rdx
je 0x1b77
sarq $0x2, %rdx
movq 0x20(%rbx), %rsi
cmpq $0x1, %rdx
adcq $0x0, %rdx
leaq (,%r13,4), %rdi
addq (%rbx), %rdi
xorl %r8d, %r8d
leaq 0x3f(%r12), %r9
movq %r13, %rcx
addq %r8, %rcx
leaq 0x3f(%r13,%r8), %r10
cmovnsq %rcx, %r10
sarq $0x6, %r10
movq %rcx, %r11
andq %r9, %r11
xorl %r14d, %r14d
cmpq %r12, %r11
setbe %r14b
movl $0x1, %r11d
shlq %cl, %r11
leaq (%rsi,%r10,8), %rcx
orq %r11, -0x8(%rcx,%r14,8)
movl (%rax,%r8,4), %ecx
movl %ecx, (%rdi,%r8,4)
incq %r8
cmpq %r8, %rdx
jne 0x1b32
incl 0x18(%rbx)
movslq 0x48(%rbx), %rax
addq %rax, 0x353b(%rip)      # 0x50c0
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O1/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:
movl %esi, %eax
movl 0x48(%rdi), %r9d
testl %r9d, %r9d
jle 0x2119
pushq %r14
pushq %rbx
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
addl %eax, %r9d
movq (%rdi), %r8
movq 0x20(%rdi), %rdi
movslq %eax, %rsi
movslq %r9d, %r9
leal 0x1(%rsi), %eax
cmpl %eax, %r9d
cmovgl %r9d, %eax
leaq 0x3f(%rcx), %r10
leaq 0x3f(%rsi), %r11
testq %rsi, %rsi
cmovnsq %rsi, %r11
sarq $0x6, %r11
leaq (%rdi,%r11,8), %r11
movq %rsi, %rbx
andq %r10, %rbx
xorl %r14d, %r14d
cmpq %rcx, %rbx
setbe %r14b
movq -0x8(%r11,%r14,8), %r11
btq %rsi, %r11
jae 0x210a
cmpl %edx, (%r8,%rsi,4)
jge 0x2114
incq %rsi
cmpq %r9, %rsi
jl 0x20d6
jmp 0x2116
movl %esi, %eax
popq %rbx
popq %r14
retq