LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_cpp_makefile_star2_O1/jstaursky[P]hutch/src/Sleigh/semantics.cc
// Function: ConstructTpl::fillinBuild(std::vector<int, std::allocator<int>>&, AddrSpace*)
int4 ConstructTpl::fillinBuild(vector<int4> &check,AddrSpace *const_space)

{ // Make sure there is a build statement for all subtable params
  // Return 0 upon success, 1 if there is a duplicate BUILD, 2 if there is a build for a non-subtable
  vector<OpTpl *>::iterator iter;
  OpTpl *op;
  VarnodeTpl *indvn;

  for(iter=vec.begin();iter!=vec.end();++iter) {
    op = *iter;
    if (op->getOpcode() == BUILD) {
      int4 index = op->getIn(0)->getOffset().getReal();
      if (check[index] != 0)
	return check[index];	// Duplicate BUILD statement or non-subtable
      check[index] = 1;		// Mark to avoid future duplicate build
    }
  }
  for(int4 i=0;i<check.size();++i) {
    if (check[i] == 0) {	// Didn't see a BUILD statement
      op = new OpTpl(BUILD);
      indvn = new VarnodeTpl(ConstTpl(const_space),
			      ConstTpl(ConstTpl::real,i),
			      ConstTpl(ConstTpl::real,4));
      op->addInput(indvn);
      vec.insert(vec.begin(),op);
    }
  }
  return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x78, %rsp
movq %rdx, 0x10(%rsp)
movq %rsi, %r14
movq %rdi, %r15
movq 0x8(%rdi), %rcx
movq 0x10(%rdi), %rdx
cmpq %rdx, %rcx
je 0x5661a
movq (%r14), %rsi
movq (%rcx), %rax
movq %rax, 0x8(%rsp)
cmpl $0x3c, 0x8(%rax)
jne 0x56611
movq 0x10(%rax), %rax
movq (%rax), %rax
movslq 0x30(%rax), %r9
movl (%rsi,%r9,4), %r8d
movl %r8d, %eax
testl %r8d, %r8d
jne 0x56606
shlq $0x2, %r9
movl $0x1, (%rsi,%r9)
movl %edi, %eax
movl %eax, %edi
testl %r8d, %r8d
jne 0x566eb
addq $0x8, %rcx
cmpq %rdx, %rcx
jne 0x565d3
movq (%r14), %rax
cmpq %rax, 0x8(%r14)
je 0x566e9
addq $0x8, %r15
leaq 0x58(%rsp), %r13
leaq 0x38(%rsp), %rbp
xorl %ebx, %ebx
cmpl $0x0, (%rax,%rbx,4)
jne 0x566cf
movl $0x28, %edi
callq 0x40800
xorps %xmm0, %xmm0
movups %xmm0, 0x10(%rax)
xorl %ecx, %ecx
movq %rcx, 0x20(%rax)
movl $0x3c, 0x8(%rax)
movq %rcx, (%rax)
movq %rax, 0x8(%rsp)
movl $0x68, %edi
callq 0x40800
movq %rax, %r12
leaq 0x18(%rsp), %rdi
movq 0x10(%rsp), %rsi
callq 0x40390
movq %r13, %rdi
xorl %esi, %esi
movq %rbx, %rdx
callq 0x40b10
movl $0x4, %edx
movq %rbp, %rdi
xorl %esi, %esi
callq 0x40b10
movq %r12, %rdi
leaq 0x18(%rsp), %rsi
movq %r13, %rdx
movq %rbp, %rcx
callq 0x41aa0
movq 0x8(%rsp), %rdi
movq %r12, %rsi
callq 0x42010
movq (%r15), %rsi
movq %r15, %rdi
leaq 0x8(%rsp), %rdx
callq 0x3fc00
incq %rbx
movq (%r14), %rax
movq 0x8(%r14), %rcx
subq %rax, %rcx
sarq $0x2, %rcx
cmpq %rbx, %rcx
ja 0x56637
xorl %eax, %eax
addq $0x78, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x566fe
jmp 0x566fe
movq %rax, %rbx
movl $0x68, %esi
movq %r12, %rdi
callq 0x40870
movq %rbx, %rdi
callq 0x41f00
// File: /workspace/github_cpp_makefile_star2_O1/jstaursky[P]hutch/src/Sleigh/semantics.cc
// Function: ConstructTpl::changeHandleIndex(std::vector<int, std::allocator<int>> const&)
void ConstructTpl::changeHandleIndex(const vector<int4> &handmap)

{
  vector<OpTpl *>::const_iterator iter;
  OpTpl *op;

  for(iter=vec.begin();iter!=vec.end();++iter) {
    op = *iter;
    if (op->getOpcode() == BUILD) {
      int4 index = op->getIn(0)->getOffset().getReal();
      index = handmap[index];
      op->getIn(0)->setOffset(index);
    }
    else
      op->changeHandleIndex(handmap);
  }
  if (result != (HandleTpl *)0)
    result->changeHandleIndex(handmap);
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x20, %rsp
movq %rsi, %rbx
movq %rdi, %r14
movq 0x8(%rdi), %r12
cmpq 0x10(%rdi), %r12
je 0x567b7
movq %rsp, %r15
movq (%r12), %rdi
cmpl $0x3c, 0x8(%rdi)
jne 0x567a5
movq 0x10(%rdi), %rax
movq (%rax), %r13
movslq 0x30(%r13), %rax
movq (%rbx), %rcx
movslq (%rcx,%rax,4), %rdx
movq %r15, %rdi
xorl %esi, %esi
callq 0x40b10
movups (%rsp), %xmm0
movups 0xc(%rsp), %xmm1
movups %xmm1, 0x2c(%r13)
movups %xmm0, 0x20(%r13)
jmp 0x567ad
movq %rbx, %rsi
callq 0x40530
addq $0x8, %r12
cmpq 0x10(%r14), %r12
jne 0x5676a
movq 0x20(%r14), %rdi
testq %rdi, %rdi
je 0x567c8
movq %rbx, %rsi
callq 0x3fdf0
addq $0x20, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O1/jstaursky[P]hutch/src/Sleigh/semantics.cc
// Function: ConstructTpl::setInput(VarnodeTpl*, int, int)
void ConstructTpl::setInput(VarnodeTpl *vn,int4 index,int4 slot)

{ // set the VarnodeTpl input for a particular op
  // for use with optimization routines
  OpTpl *op = vec[index];
  VarnodeTpl *oldvn = op->getIn(slot);
  op->setInput(vn,slot);
  if (oldvn != (VarnodeTpl *)0)
    delete oldvn;
}

// Assembly:
movslq %edx, %rax
movq 0x8(%rdi), %rdx
movq (%rdx,%rax,8), %rax
movslq %ecx, %rcx
movq 0x10(%rax), %rax
movq (%rax,%rcx,8), %rdi
movq %rsi, (%rax,%rcx,8)
testq %rdi, %rdi
je 0x567ff
movl $0x68, %esi
jmp 0x40870
retq
// File: /workspace/github_cpp_makefile_star2_O1/jstaursky[P]hutch/src/Sleigh/semantics.cc
// Function: ConstructTpl::setOutput(VarnodeTpl*, int)
void ConstructTpl::setOutput(VarnodeTpl *vn,int4 index)

{ // set the VarnodeTpl output for a particular op
  // for use with optimization routines
  OpTpl *op = vec[index];
  VarnodeTpl *oldvn = op->getOut();
  op->setOutput(vn);
  if (oldvn != (VarnodeTpl *)0)
    delete oldvn;
}

// Assembly:
movslq %edx, %rax
movq 0x8(%rdi), %rcx
movq (%rcx,%rax,8), %rax
movq (%rax), %rdi
movq %rsi, (%rax)
testq %rdi, %rdi
je 0x56820
movl $0x68, %esi
jmp 0x40870
retq
nop
// File: /workspace/github_cpp_makefile_star2_O1/jstaursky[P]hutch/src/Sleigh/semantics.cc
// Function: ConstructTpl::deleteOps(std::vector<int, std::allocator<int>> const&)
void ConstructTpl::deleteOps(const vector<int4> &indices)

{ // delete a particular set of ops
  for(uint4 i=0;i<indices.size();++i) {
    delete vec[indices[i]];
    vec[indices[i]] = (OpTpl *)0;
  }
  uint4 poscur = 0;
  for(uint4 i=0;i<vec.size();++i) {
    OpTpl *op = vec[i];
    if (op != (OpTpl *)0) {
      vec[poscur] = op;
      poscur += 1;
    }
  }
  while(vec.size() > poscur)
    vec.pop_back();
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %rdi, %rbx
movq (%rsi), %rax
cmpq %rax, 0x8(%rsi)
je 0x56892
movq %rsi, %r14
movl $0x1, %ebp
xorl %r12d, %r12d
movslq (%rax,%r12,4), %rax
movq 0x8(%rbx), %rcx
movq (%rcx,%rax,8), %r15
testq %r15, %r15
je 0x56867
movq %r15, %rdi
callq 0x3f1f0
movl $0x28, %esi
movq %r15, %rdi
callq 0x40870
movq (%r14), %rax
movslq (%rax,%r12,4), %rax
movq 0x8(%rbx), %rcx
movq $0x0, (%rcx,%rax,8)
movl %ebp, %r12d
movq (%r14), %rax
movq 0x8(%r14), %rcx
subq %rax, %rcx
sarq $0x2, %rcx
incl %ebp
cmpq %r12, %rcx
ja 0x56841
movq 0x8(%rbx), %rcx
xorl %eax, %eax
cmpq %rcx, 0x10(%rbx)
je 0x568d0
movl $0x1, %edx
xorl %esi, %esi
movq (%rcx,%rsi,8), %rsi
testq %rsi, %rsi
je 0x568b6
movl %eax, %edi
movq %rsi, (%rcx,%rdi,8)
incl %eax
movl %edx, %esi
movq 0x8(%rbx), %rcx
movq 0x10(%rbx), %rdi
subq %rcx, %rdi
sarq $0x3, %rdi
incl %edx
cmpq %rsi, %rdi
ja 0x568a5
movl %eax, %eax
movq 0x10(%rbx), %rdx
movq %rdx, %rsi
subq %rcx, %rsi
movq %rsi, %rcx
sarq $0x3, %rcx
cmpq %rax, %rcx
jbe 0x56902
addq $-0x8, %rsi
addq $-0x8, %rdx
movq %rsi, %rcx
sarq $0x3, %rcx
addq $-0x8, %rsi
cmpq %rax, %rcx
ja 0x568ea
movq %rdx, 0x10(%rbx)
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O1/jstaursky[P]hutch/src/Sleigh/semantics.cc
// Function: ConstructTpl::saveXml(std::ostream&, int) const
void ConstructTpl::saveXml(ostream &s,int4 sectionid) const

{
  s << "<construct_tpl";
  if (sectionid >=0 )
    s << " section=\"" << dec << sectionid << "\"";
  if (delayslot != 0)
    s << " delay=\"" << dec << delayslot << "\"";
  if (numlabels != 0)
    s << " labels=\"" << dec << numlabels << "\"";
  s << ">\n";
  if (result != (HandleTpl *)0)
    result->saveXml(s);
  else
    s << "<null/>";
  for(int4 i=0;i<vec.size();++i)
    vec[i]->saveXml(s);
  s << "</construct_tpl>\n";
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movl %edx, %ebp
movq %rsi, %rbx
movq %rdi, %r14
leaq 0x29a87(%rip), %rsi     # 0x803a9
movl $0xe, %edx
movq %rbx, %rdi
callq 0x40b80
testl %ebp, %ebp
js 0x5697a
leaq 0x29a7e(%rip), %rsi     # 0x803b8
movl $0xa, %edx
movq %rbx, %rdi
callq 0x40b80
movq (%rbx), %rax
movq -0x18(%rax), %rax
movl 0x18(%rbx,%rax), %ecx
andl $-0x4b, %ecx
orl $0x2, %ecx
movl %ecx, 0x18(%rbx,%rax)
movq %rbx, %rdi
movl %ebp, %esi
callq 0x41da0
leaq 0x2ac7a(%rip), %rsi     # 0x815e7
movl $0x1, %edx
movq %rax, %rdi
callq 0x40b80
cmpl $0x0, (%r14)
je 0x569c8
leaq 0x29a3c(%rip), %rsi     # 0x803c3
movl $0x8, %edx
movq %rbx, %rdi
callq 0x40b80
movq (%rbx), %rax
movq -0x18(%rax), %rax
movl 0x18(%rbx,%rax), %ecx
andl $-0x4b, %ecx
orl $0x2, %ecx
movl %ecx, 0x18(%rbx,%rax)
movl (%r14), %esi
movq %rbx, %rdi
callq 0x3ffb0
leaq 0x2ac2c(%rip), %rsi     # 0x815e7
movl $0x1, %edx
movq %rax, %rdi
callq 0x40b80
cmpl $0x0, 0x4(%r14)
je 0x56a18
leaq 0x299f6(%rip), %rsi     # 0x803cc
movl $0x9, %edx
movq %rbx, %rdi
callq 0x40b80
movq (%rbx), %rax
movq -0x18(%rax), %rax
movl 0x18(%rbx,%rax), %ecx
andl $-0x4b, %ecx
orl $0x2, %ecx
movl %ecx, 0x18(%rbx,%rax)
movl 0x4(%r14), %esi
movq %rbx, %rdi
callq 0x3ffb0
leaq 0x2abdc(%rip), %rsi     # 0x815e7
movl $0x1, %edx
movq %rax, %rdi
callq 0x40b80
leaq 0x2adaa(%rip), %rsi     # 0x817c9
movl $0x2, %edx
movq %rbx, %rdi
callq 0x40b80
movq 0x20(%r14), %rdi
testq %rdi, %rdi
je 0x56a3f
movq %rbx, %rsi
callq 0x40ce0
jmp 0x56a53
leaq 0x29990(%rip), %rsi     # 0x803d6
movl $0x7, %edx
movq %rbx, %rdi
callq 0x40b80
movq 0x8(%r14), %rax
cmpq %rax, 0x10(%r14)
je 0x56a83
xorl %r15d, %r15d
movq (%rax,%r15,8), %rdi
movq %rbx, %rsi
callq 0x41c60
incq %r15
movq 0x8(%r14), %rax
movq 0x10(%r14), %rcx
subq %rax, %rcx
sarq $0x3, %rcx
cmpq %r15, %rcx
ja 0x56a60
leaq 0x29954(%rip), %rsi     # 0x803de
movl $0x11, %edx
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x40b80
nop
// File: /workspace/github_cpp_makefile_star2_O1/jstaursky[P]hutch/src/Sleigh/semantics.cc
// Function: PcodeBuilder::build(ConstructTpl*, int)
void PcodeBuilder::build(ConstructTpl *construct,int4 secnum)

{
  if (construct == (ConstructTpl *)0)
    throw UnimplError("",0);	// Pcode is not implemented for this constructor

  uint4 oldbase = labelbase;	// Recursively store old labelbase
  labelbase = labelcount;	// Set the newbase
  labelcount += construct->numLabels();	// Add labels from this template

  vector<OpTpl *>::const_iterator iter;
  OpTpl *op;
  const vector<OpTpl *> &ops(construct->getOpvec());

  for(iter=ops.begin();iter!=ops.end();++iter) {
    op = *iter;
    switch(op->getOpcode()) {
    case BUILD:
      appendBuild( op, secnum );
      break;
    case DELAY_SLOT:
      delaySlot( op );
      break;
    case LABELBUILD:
      setLabel( op );
      break;
    case CROSSBUILD:
      appendCrossBuild(op,secnum);
      break;
    default:
      dump( op );
      break;
    }
  }
  labelbase = oldbase;		// Restore old labelbase
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
testq %rsi, %rsi
je 0x56ddb
movq %rsi, %r15
movq %rdi, %r14
movl 0x8(%rdi), %ebp
movl 0xc(%rdi), %eax
movl %eax, 0x8(%rdi)
addl 0x4(%rsi), %eax
movl %eax, 0xc(%rdi)
movq 0x8(%rsi), %r12
cmpq 0x10(%rsi), %r12
je 0x56dc8
movl %edx, %ebx
leaq 0x2940f(%rip), %r13     # 0x80188
movq (%r12), %rsi
movl 0x8(%rsi), %ecx
movq (%r14), %rax
addl $-0x3c, %ecx
cmpl $0x6, %ecx
ja 0x56db9
movslq (%r13,%rcx,4), %rcx
addq %r13, %rcx
jmpq *%rcx
movq %r14, %rdi
movl %ebx, %edx
callq *0x18(%rax)
jmp 0x56dbe
movq %r14, %rdi
callq *0x28(%rax)
jmp 0x56dbe
movq %r14, %rdi
callq *0x20(%rax)
jmp 0x56dbe
movq %r14, %rdi
movl %ebx, %edx
callq *0x30(%rax)
jmp 0x56dbe
movq %r14, %rdi
callq *(%rax)
addq $0x8, %r12
cmpq 0x10(%r15), %r12
jne 0x56d79
movl %ebp, 0x8(%r14)
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl $0x28, %edi
callq 0x3fb00
movq %rax, %rbx
leaq 0x18(%rsp), %r15
movq %r15, -0x10(%r15)
leaq 0x2a3f8(%rip), %rdx     # 0x811f0
leaq 0x8(%rsp), %rdi
movq %rdx, %rsi
callq 0x3f8a0
movb $0x1, %bpl
leaq 0x8(%rsp), %rsi
movq %rbx, %rdi
callq 0x3f890
movl $0x0, 0x20(%rbx)
xorl %ebp, %ebp
movq 0x4c103(%rip), %rsi     # 0xa2f28
movq 0x4be0c(%rip), %rdx     # 0xa2c38
movq %rbx, %rdi
callq 0x41d60
movq %rax, %r14
movq 0x8(%rsp), %rdi
cmpq %r15, %rdi
je 0x56e56
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x40870
jmp 0x56e56
movq %rax, %r14
movb $0x1, %bpl
testb %bpl, %bpl
je 0x56e63
movq %rbx, %rdi
callq 0x40080
movq %r14, %rdi
callq 0x41f00
nop
// File: /workspace/github_cpp_makefile_star2_O1/jstaursky[P]hutch/src/Sleigh/sleigh.cc
// Function: PcodeCacher::PcodeCacher()
PcodeCacher::PcodeCacher (void)

{
    // We aim to allocate this array only once
    uint4 maxsize = 600;
    poolstart = new VarnodeData[maxsize];
    endpool = poolstart + maxsize;
    curpool = poolstart;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
leaq 0x18(%rdi), %r14
xorps %xmm0, %xmm0
movups %xmm0, 0x18(%rdi)
movq $0x0, 0x28(%rdi)
leaq 0x30(%rdi), %r15
movq %r15, 0x38(%rdi)
movq %r15, 0x30(%rdi)
movups %xmm0, 0x40(%rdi)
movups %xmm0, 0x50(%rdi)
movl $0x3840, %edi           # imm = 0x3840
callq 0x3f060
movq %rax, (%rbx)
movq %rax, %rcx
addq $0x3840, %rcx           # imm = 0x3840
movq %rcx, 0x10(%rbx)
movq %rax, 0x8(%rbx)
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
movq %rax, %r12
movq 0x48(%rbx), %rdi
testq %rdi, %rdi
je 0x56f65
movq 0x58(%rbx), %rsi
subq %rdi, %rsi
callq 0x40870
movq %r15, %rdi
movq %r14, %rsi
movq %rbx, %rdx
callq 0x425d8
movq %r12, %rdi
callq 0x41f00
nop
// File: /workspace/github_cpp_makefile_star2_O1/jstaursky[P]hutch/src/Sleigh/sleigh.cc
// Function: PcodeCacher::addLabelRef(VarnodeData*)
void PcodeCacher::addLabelRef (VarnodeData* ptr)

{ // Store off a reference to a label and the next instruction
    // address
    label_refs.push_back (RelativeRecord ());
    label_refs.back ().dataptr = ptr;
    label_refs.back ().calling_index = issued.size ();
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rsi, %rbx
movq %rdi, %r14
leaq 0x30(%rdi), %r15
movl $0x20, %edi
callq 0x40800
xorps %xmm0, %xmm0
movups %xmm0, 0x10(%rax)
movq %rax, %rdi
movq %r15, %rsi
callq 0x3f190
incq 0x40(%r14)
movq 0x38(%r14), %rax
movq %rbx, 0x10(%rax)
movq 0x20(%r14), %rcx
subq 0x18(%r14), %rcx
sarq $0x5, %rcx
movq %rcx, 0x18(%rax)
popq %rbx
popq %r14
popq %r15
retq
nop
// File: /workspace/github_cpp_makefile_star2_O1/jstaursky[P]hutch/src/Sleigh/sleigh.cc
// Function: PcodeCacher::addLabel(unsigned int)
void PcodeCacher::addLabel (uint4 id)

{ // Attach a label to the address of the next instruction
    while (labels.size () <= id)
        labels.push_back (0xbadbeef);
    labels[id] = issued.size ();
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
movl %esi, %r12d
movq 0x48(%rdi), %rax
movq 0x50(%rdi), %rsi
movq %rsi, %rcx
subq %rax, %rcx
sarq $0x3, %rcx
cmpq %r12, %rcx
ja 0x571f9
leaq 0x48(%rbx), %r14
movq %rsp, %r15
movq $0xbadbeef, (%rsp)      # imm = 0xBADBEEF
cmpq 0x58(%rbx), %rsi
je 0x571d7
movq $0xbadbeef, (%rsi)      # imm = 0xBADBEEF
addq $0x8, %rsi
movq %rsi, 0x50(%rbx)
jmp 0x571e2
movq %r14, %rdi
movq %r15, %rdx
callq 0x3fa20
movq 0x48(%rbx), %rax
movq 0x50(%rbx), %rsi
movq %rsi, %rcx
subq %rax, %rcx
sarq $0x3, %rcx
cmpq %r12, %rcx
jbe 0x571b8
movq 0x20(%rbx), %rcx
subq 0x18(%rbx), %rcx
sarq $0x5, %rcx
movq %rcx, (%rax,%r12,8)
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
nop
// File: /workspace/github_cpp_makefile_star2_O1/jstaursky[P]hutch/src/Sleigh/sleigh.cc
// Function: PcodeCacher::clear()
void PcodeCacher::clear (void)

{
    curpool = poolstart;
    issued.clear ();
    label_refs.clear ();
    labels.clear ();
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
movq (%rdi), %rcx
movq 0x18(%rdi), %rax
movq %rcx, 0x8(%rdi)
cmpq %rax, 0x20(%rdi)
je 0x5722f
movq %rax, 0x20(%rbx)
leaq 0x30(%rbx), %rdi
callq 0x41900
movq 0x48(%rbx), %rax
cmpq %rax, 0x50(%rbx)
je 0x57246
movq %rax, 0x50(%rbx)
popq %rbx
retq
// File: /workspace/github_cpp_makefile_star2_O1/jstaursky[P]hutch/src/Sleigh/sleigh.cc
// Function: PcodeCacher::resolveRelatives()
void PcodeCacher::resolveRelatives (void)

{ // Assuming all the PcodeData has been generated for an
    // instruction, go resolve any relative offsets and back
    // patch their value(s) into the PcodeData
    list<RelativeRecord>::const_iterator iter;
    for (iter = label_refs.begin (); iter != label_refs.end (); ++iter) {
        VarnodeData* ptr = (*iter).dataptr;
        uint4 id = ptr->offset;
        if ((id >= labels.size ()) || (labels[id] == 0xbadbeef))
            throw LowlevelError ("Reference to non-existant sleigh label");
        // Calculate the relative index given the two absolute indices
        uintb res = labels[id] - (*iter).calling_index;
        res &= calc_mask (ptr->size);
        ptr->offset = res;
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x28, %rsp
leaq 0x30(%rdi), %rax
movq 0x30(%rdi), %rcx
cmpq %rax, %rcx
je 0x572b7
movq 0x48(%rdi), %rdx
movq 0x50(%rdi), %rsi
subq %rdx, %rsi
sarq $0x3, %rsi
movl $0x8, %edi
movq 0x4b956(%rip), %r8      # 0xa2bd0
movq 0x10(%rcx), %r9
movl 0x8(%r9), %r10d
cmpq %rsi, %r10
jae 0x572c2
movq (%rdx,%r10,8), %r10
cmpq $0xbadbeef, %r10        # imm = 0xBADBEEF
je 0x572c2
subq 0x18(%rcx), %r10
movl 0x10(%r9), %r11d
cmpl $0x8, %r11d
cmovgel %edi, %r11d
movslq %r11d, %r11
andq (%r8,%r11,8), %r10
movq %r10, 0x8(%r9)
movq (%rcx), %rcx
cmpq %rax, %rcx
jne 0x5727a
addq $0x28, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
movl $0x20, %edi
callq 0x3fb00
movq %rax, %rbx
leaq 0x18(%rsp), %r15
movq %r15, -0x10(%r15)
leaq 0x29126(%rip), %rsi     # 0x80405
leaq 0x29145(%rip), %rdx     # 0x8042b
leaq 0x8(%rsp), %rdi
callq 0x3f8a0
movb $0x1, %bpl
leaq 0x8(%rsp), %rsi
movq %rbx, %rdi
callq 0x3f890
xorl %ebp, %ebp
movq 0x4bb9f(%rip), %rsi     # 0xa2ea8
movq 0x4b928(%rip), %rdx     # 0xa2c38
movq %rbx, %rdi
callq 0x41d60
movq %rax, %r14
movq 0x8(%rsp), %rdi
cmpq %r15, %rdi
je 0x5733a
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x40870
jmp 0x5733a
movq %rax, %r14
movb $0x1, %bpl
testb %bpl, %bpl
je 0x57347
movq %rbx, %rdi
callq 0x40080
movq %r14, %rdi
callq 0x41f00
nop
// File: /workspace/github_cpp_makefile_star2_O1/jstaursky[P]hutch/src/Sleigh/sleigh.cc
// Function: PcodeCacher::hutch_emitIR() const
vector<struct PcodeData> PcodeCacher::hutch_emitIR () const

{
    vector<PcodeData> result;
    struct PcodeData tmp;
    vector<PcodeData>::const_iterator iter;

    for (iter = issued.begin (); iter != issued.end (); ++iter) {
        tmp.outvar = (*iter).outvar;
        tmp.invar = (*iter).invar;
        tmp.isize = (*iter).isize;
        tmp.opc = (*iter).opc;

        result.push_back (tmp);
    }
    return result;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rdi, %rbx
xorps %xmm0, %xmm0
movups %xmm0, (%rdi)
movq $0x0, 0x10(%rdi)
movups %xmm0, 0x10(%rsp)
movq 0x18(%rsi), %r12
cmpq 0x20(%rsi), %r12
je 0x57404
movq %rsi, %r14
leaq 0x8(%rsp), %r15
movups 0x8(%r12), %xmm0
movups %xmm0, 0x10(%rsp)
movl 0x18(%r12), %eax
movl %eax, 0x20(%rsp)
movl (%r12), %eax
movl %eax, 0x8(%rsp)
movq %rbx, %rdi
movq %r15, %rsi
callq 0x41230
addq $0x20, %r12
cmpq 0x20(%r14), %r12
jne 0x573d3
movq %rbx, %rax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
movq %rax, %r14
movq (%rbx), %rdi
testq %rdi, %rdi
je 0x5742a
movq 0x10(%rbx), %rsi
subq %rdi, %rsi
callq 0x40870
movq %r14, %rdi
callq 0x41f00
// File: /workspace/github_cpp_makefile_star2_O1/jstaursky[P]hutch/src/Sleigh/sleigh.cc
// Function: SleighBuilder::generateLocation(VarnodeTpl const*, VarnodeData&)
void SleighBuilder::generateLocation (const VarnodeTpl* vntpl, VarnodeData& vn)

{ // Generate a concrete varnode -vn- from the template -vntpl-
    vn.space = vntpl->getSpace ().fixSpace (*walker);
    vn.size = vntpl->getSize ().fix (*walker);
    if (vn.space == const_space)
        vn.offset = vntpl->getOffset ().fix (*walker) & calc_mask (vn.size);
    else if (vn.space == uniq_space) {
        vn.offset = vntpl->getOffset ().fix (*walker);
        vn.offset |= uniqueoffset;
    } else
        vn.offset = vn.space->wrapOffset (vntpl->getOffset ().fix (*walker));
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movq %rdx, %rbx
movq %rsi, %r15
movq %rdi, %r14
movq 0x10(%rdi), %rsi
movq %r15, %rdi
callq 0x3ff90
movq %rax, (%rbx)
leaq 0x40(%r15), %rdi
movq 0x10(%r14), %rsi
callq 0x40020
movl %eax, 0x10(%rbx)
movq (%rbx), %r12
cmpq 0x18(%r14), %r12
je 0x574a6
movq 0x20(%r14), %r13
addq $0x20, %r15
movq 0x10(%r14), %rsi
movq %r15, %rdi
callq 0x40020
cmpq %r13, %r12
je 0x574d8
movq 0x28(%r12), %rcx
cmpq %rax, %rcx
jae 0x574d2
incq %rcx
cqto
idivq %rcx
movq %rdx, %rax
sarq $0x3f, %rax
andq %rcx, %rax
addq %rdx, %rax
jmp 0x574d2
addq $0x20, %r15
movq 0x10(%r14), %rsi
movq %r15, %rdi
callq 0x40020
movl 0x10(%rbx), %ecx
cmpl $0x8, %ecx
movl $0x8, %edx
cmovll %ecx, %edx
movslq %edx, %rcx
movq 0x4b702(%rip), %rdx     # 0xa2bd0
andq (%rdx,%rcx,8), %rax
movq %rax, 0x8(%rbx)
jmp 0x574e7
movq %rax, 0x8(%rbx)
movq 0x30(%r14), %rcx
orq %rax, %rcx
movq %rcx, 0x8(%rbx)
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
nop
// File: /workspace/github_cpp_makefile_star2_O1/jstaursky[P]hutch/src/Sleigh/sleigh.cc
// Function: SleighBuilder::generatePointer(VarnodeTpl const*, VarnodeData&)
AddrSpace* SleighBuilder::generatePointer (const VarnodeTpl* vntpl,
                                           VarnodeData& vn)

{ // Generate the pointer varnode -vn- from a dynamic template -vntpl-
    const FixedHandle& hand (
        walker->getFixedHandle (vntpl->getOffset ().getHandleIndex ()));
    vn.space = hand.offset_space;
    vn.size = hand.offset_size;
    if (vn.space == const_space)
        vn.offset = hand.offset_offset & calc_mask (vn.size);
    else if (vn.space == uniq_space)
        vn.offset = hand.offset_offset | uniqueoffset;
    else
        vn.offset = vn.space->wrapOffset (hand.offset_offset);
    return hand.space;
}

// Assembly:
movq %rdx, %rcx
movq 0x10(%rdi), %rax
movslq 0x28(%rsi), %rdx
movq 0x10(%rax), %rax
movq 0x40(%rax), %rax
movq (%rax,%rdx,8), %rsi
movq 0x18(%rsi), %rdx
movq %rdx, (%rcx)
movl 0x28(%rsi), %eax
movl %eax, 0x10(%rcx)
cmpq 0x18(%rdi), %rdx
je 0x57546
movq 0x20(%rsi), %rax
cmpq 0x20(%rdi), %rdx
je 0x57565
movq 0x28(%rdx), %rdi
cmpq %rax, %rdi
jae 0x57569
incq %rdi
cqto
idivq %rdi
movq %rdx, %rax
sarq $0x3f, %rax
andq %rdi, %rax
addq %rdx, %rax
jmp 0x57569
cmpl $0x8, %eax
movl $0x8, %edx
cmovll %eax, %edx
movslq %edx, %rax
movq 0x4b675(%rip), %rdx     # 0xa2bd0
movq (%rdx,%rax,8), %rax
andq 0x20(%rsi), %rax
jmp 0x57569
orq 0x30(%rdi), %rax
movq %rax, 0x8(%rcx)
movq 0x8(%rsi), %rax
retq
// File: /workspace/github_cpp_makefile_star2_O1/jstaursky[P]hutch/src/Sleigh/sleigh.cc
// Function: SleighBuilder::SleighBuilder(ParserWalker*, DisassemblyCache*, PcodeCacher*, AddrSpace*, AddrSpace*, unsigned int)
SleighBuilder::SleighBuilder (ParserWalker* w, DisassemblyCache* dcache,
                              PcodeCacher* pc, AddrSpace* cspc, AddrSpace* uspc,
                              uint4 umask) :
PcodeBuilder (0)
{
    walker = w;
    discache = dcache;
    cache = pc;
    const_space = cspc;
    uniq_space = uspc;
    uniquemask = umask;
    uniqueoffset = (walker->getAddr ().getOffset () & uniquemask) << 4;
}

// Assembly:
movl 0x8(%rsp), %eax
movq $0x0, 0x8(%rdi)
movq 0x4b491(%rip), %r10     # 0xa2da8
addq $0x10, %r10
movq %r10, (%rdi)
movq %rsi, 0x10(%rdi)
movq %rdx, 0x38(%rdi)
movq %rcx, 0x40(%rdi)
movq %r8, 0x18(%rdi)
movq %r9, 0x20(%rdi)
movq %rax, 0x28(%rdi)
movq 0x8(%rsi), %rcx
testq %rcx, %rcx
jne 0x57942
movq (%rsi), %rcx
movl 0x58(%rcx), %ecx
andl %eax, %ecx
shlq $0x4, %rcx
movq %rcx, 0x30(%rdi)
retq
// File: /workspace/github_cpp_makefile_star2_O1/jstaursky[P]hutch/src/Sleigh/sleigh.cc
// Function: SleighBuilder::appendBuild(OpTpl*, int)
void SleighBuilder::appendBuild (OpTpl* bld, int4 secnum)
// Append pcode for a particular build statement
{
    // Recover operand index from build statement
    int4 index = bld->getIn (0)->getOffset ().getReal ();
    // Check if operand is a subtable
    SubtableSymbol* sym = (SubtableSymbol*)walker->getConstructor ()
                              ->getOperand (index)
                              ->getDefiningSymbol ();
    if ((sym == (SubtableSymbol*)0) ||
        (sym->getType () != SleighSymbol::subtable_symbol))
        return;

    walker->pushOperand (index);
    Constructor* ct = walker->getConstructor ();
    if (secnum >= 0) {
        ConstructTpl* construct = ct->getNamedTempl (secnum);
        if (construct == (ConstructTpl*)0)
            buildEmpty (ct, secnum);
        else
            build (construct, secnum);
    } else {
        ConstructTpl* construct = ct->getTempl ();
        build (construct, -1);
    }
    walker->popOperand ();
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movq %rdi, %rbx
movq 0x10(%rsi), %rax
movq (%rax), %rax
movq 0x30(%rax), %rax
movq 0x10(%rdi), %rcx
movq 0x10(%rcx), %rcx
movq (%rcx), %rcx
movslq %eax, %r14
movq 0x18(%rcx), %rax
movq (%rax,%r14,8), %rax
movq 0x48(%rax), %rdi
testq %rdi, %rdi
je 0x57a18
movl %edx, %ebp
movq (%rdi), %rax
callq *0x10(%rax)
cmpl $0xb, %eax
jne 0x57a18
movq 0x10(%rbx), %rax
leal 0x1(%r14), %ecx
movslq 0x18(%rax), %rdx
leal 0x1(%rdx), %esi
movl %esi, 0x18(%rax)
movl %ecx, 0x1c(%rax,%rdx,4)
movq 0x10(%rax), %rcx
movq 0x40(%rcx), %rcx
movq (%rcx,%r14,8), %rcx
movq %rcx, 0x10(%rax)
movslq 0x18(%rax), %rdx
movl $0x0, 0x1c(%rax,%rdx,4)
movq (%rcx), %r14
testl %ebp, %ebp
js 0x579e8
movq %r14, %rdi
movl %ebp, %esi
callq 0x41f50
movq %rbx, %rdi
testq %rax, %rax
je 0x579fb
movq %rax, %rsi
movl %ebp, %edx
jmp 0x579f4
movq 0x60(%r14), %rsi
movq %rbx, %rdi
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
callq 0x3f5a0
jmp 0x57a05
movq %r14, %rsi
movl %ebp, %edx
callq 0x417d0
movq 0x10(%rbx), %rax
movq 0x10(%rax), %rcx
movq 0x58(%rcx), %rcx
movq %rcx, 0x10(%rax)
decl 0x18(%rax)
popq %rbx
popq %r14
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O1/jstaursky[P]hutch/src/Sleigh/sleigh.cc
// Function: DisassemblyCache::initialize(int, int)
void DisassemblyCache::initialize (int4 min, int4 hashsize)

{
    minimumreuse = min;
    mask = hashsize - 1;
    uintb masktest = coveringmask ((uintb)mask);
    if (masktest != (uintb)mask) // -hashsize- must be a power of 2
        throw LowlevelError ("Bad windowsize for disassembly cache");
    list = new ParserContext*[minimumreuse];
    nextfree = 0;
    hashtable = new ParserContext*[hashsize];
    for (int4 i = 0; i < minimumreuse; ++i) {
        ParserContext* pos = new ParserContext (contextcache);
        pos->initialize (75, 20, constspace);
        list[i] = pos;
    }
    // Make sure all hashtable positions point to a real ParserContext
    ParserContext* pos = list[0];
    for (int4 i = 0; i < hashsize; ++i)
        hashtable[i] = pos;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x20, %rsp
movl %edx, %r14d
movq %rdi, %rbx
movl %esi, 0x10(%rdi)
leal -0x1(%r14), %edi
movl %edi, 0x14(%rbx)
callq 0x3f6f0
movl 0x14(%rbx), %ecx
cmpq %rcx, %rax
jne 0x57f07
movslq 0x10(%rbx), %rax
leaq (,%rax,8), %rdi
testq %rax, %rax
movq $-0x1, %r15
cmovsq %r15, %rdi
callq 0x3f060
movq %rax, 0x18(%rbx)
movl $0x0, 0x20(%rbx)
movslq %r14d, %rdi
shlq $0x3, %rdi
testl %r14d, %r14d
cmovsq %r15, %rdi
callq 0x3f060
movq %rax, 0x28(%rbx)
cmpl $0x0, 0x10(%rbx)
jle 0x57ed9
xorl %r12d, %r12d
movl $0xa8, %edi
callq 0x40800
movq %rax, %r15
movq (%rbx), %rsi
movq %rax, %rdi
callq 0x41860
movq 0x8(%rbx), %rcx
movq %r15, %rdi
movl $0x4b, %esi
movl $0x14, %edx
callq 0x40a00
movq 0x18(%rbx), %rax
movq %r15, (%rax,%r12,8)
incq %r12
movslq 0x10(%rbx), %rax
cmpq %rax, %r12
jl 0x57e97
testl %r14d, %r14d
jle 0x57efa
movq 0x18(%rbx), %rax
movq (%rax), %rax
movl %r14d, %ecx
xorl %edx, %edx
movq 0x28(%rbx), %rsi
movq %rax, (%rsi,%rdx,8)
incq %rdx
cmpq %rdx, %rcx
jne 0x57eea
addq $0x20, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
movl $0x20, %edi
callq 0x3fb00
movq %rax, %rbx
leaq 0x10(%rsp), %r15
movq %r15, -0x10(%r15)
leaq 0x28592(%rip), %rsi     # 0x804b6
leaq 0x285af(%rip), %rdx     # 0x804da
movq %rsp, %rdi
callq 0x3f8a0
movb $0x1, %bpl
movq %rsp, %rsi
movq %rbx, %rdi
callq 0x3f890
xorl %ebp, %ebp
movq 0x4af5e(%rip), %rsi     # 0xa2ea8
movq 0x4ace7(%rip), %rdx     # 0xa2c38
movq %rbx, %rdi
callq 0x41d60
movq %rax, %r14
movq (%rsp), %rdi
cmpq %r15, %rdi
je 0x57f7a
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x40870
jmp 0x57f7a
movq %rax, %r14
movb $0x1, %bpl
testb %bpl, %bpl
je 0x57f99
movq %rbx, %rdi
callq 0x40080
jmp 0x57f99
movq %rax, %r14
movl $0xa8, %esi
movq %r15, %rdi
callq 0x40870
movq %r14, %rdi
callq 0x41f00
nop
// File: /workspace/github_cpp_makefile_star2_O1/jstaursky[P]hutch/src/Sleigh/sleigh.cc
// Function: DisassemblyCache::free()
void DisassemblyCache::free (void)

{
    for (int4 i = 0; i < minimumreuse; ++i)
        delete list[i];
    delete[] list;
    delete[] hashtable;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rdi, %rbx
cmpl $0x0, 0x10(%rdi)
jle 0x57fe1
xorl %r15d, %r15d
movq 0x18(%rbx), %rax
movq (%rax,%r15,8), %r14
testq %r14, %r14
je 0x57fd5
movq %r14, %rdi
callq 0x40ee0
movl $0xa8, %esi
movq %r14, %rdi
callq 0x40870
incq %r15
movslq 0x10(%rbx), %rax
cmpq %rax, %r15
jl 0x57fb3
movq 0x18(%rbx), %rdi
testq %rdi, %rdi
je 0x57fef
callq 0x40f00
movq 0x28(%rbx), %rdi
testq %rdi, %rdi
je 0x58002
popq %rbx
popq %r14
popq %r15
jmp 0x40f00
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O1/jstaursky[P]hutch/src/Sleigh/sleigh.cc
// Function: Sleigh::Sleigh(LoadImage*, ContextDatabase*)
Sleigh::Sleigh (LoadImage* ld, ContextDatabase* c_db) : SleighBase ()

{
    loader = ld;
    context_db = c_db;
    cache = new ContextCache (c_db);
    discache = (DisassemblyCache*)0;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rdx, %r15
movq %rsi, %r12
movq %rdi, %rbx
callq 0x40600
movq 0x4abc9(%rip), %rax     # 0xa2c00
addq $0x10, %rax
movq %rax, (%rbx)
leaq 0x200(%rbx), %r14
movq %r14, %rdi
callq 0x41190
movq %r12, 0x1e0(%rbx)
movq %r15, 0x1e8(%rbx)
movl $0x30, %edi
callq 0x40800
movq %rax, %r12
movq %rax, %rdi
movq %r15, %rsi
callq 0x40310
movq %r12, 0x1f0(%rbx)
movq $0x0, 0x1f8(%rbx)
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
movq %rax, %r15
movl $0x30, %esi
movq %r12, %rdi
callq 0x40870
jmp 0x580a6
movq %rax, %r15
movq %r14, %rdi
callq 0x41c10
jmp 0x580b3
movq %rax, %r15
movq %rbx, %rdi
callq 0x417e0
movq %r15, %rdi
callq 0x41f00
nop
// File: /workspace/github_cpp_makefile_star2_O1/jstaursky[P]hutch/src/Sleigh/sleigh.cc
// Function: Sleigh::reset(LoadImage*, ContextDatabase*)
void Sleigh::reset (LoadImage* ld, ContextDatabase* c_db)

{ // Completely clear everything except the base and reconstruct
    // with a new loader and context
    clearForDelete ();
    pcode_cache.clear ();
    loader = ld;
    context_db = c_db;
    cache = new ContextCache (c_db);
    discache = (DisassemblyCache*)0;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rdx, %r15
movq %rsi, %r14
movq %rdi, %rbx
callq 0x41920
leaq 0x200(%rbx), %rdi
callq 0x3f0d0
movq %r14, 0x1e0(%rbx)
movq %r15, 0x1e8(%rbx)
movl $0x30, %edi
callq 0x40800
movq %rax, %r14
movq %rax, %rdi
movq %r15, %rsi
callq 0x40310
movq %r14, 0x1f0(%rbx)
movq $0x0, 0x1f8(%rbx)
popq %rbx
popq %r14
popq %r15
retq
movq %rax, %rbx
movl $0x30, %esi
movq %r14, %rdi
callq 0x40870
movq %rbx, %rdi
callq 0x41f00
nop
// File: /workspace/github_cpp_makefile_star2_O1/jstaursky[P]hutch/src/Sleigh/sleigh.cc
// Function: Sleigh::initialize(DocumentStorage&)
void Sleigh::initialize (DocumentStorage& store)

{
    if (!isInitialized ()) { // Initialize the base if not already
        const Element* el = store.getTag ("sleigh");
        if (el == (const Element*)0)
            throw LowlevelError ("Could not find sleigh tag");
        restoreXml (el);
    } else
        reregisterContext ();
    uint4 parser_cachesize = 2;
    uint4 parser_windowsize = 32;
    if ((maxdelayslotbytes > 1) || (unique_allocatemask != 0)) {
        parser_cachesize = 8;
        parser_windowsize = 256;
    }
    discache = new DisassemblyCache (cache, getConstantSpace (),
                                     parser_cachesize, parser_windowsize);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x28, %rsp
movq %rdi, %rbx
cmpq $0x0, 0x190(%rdi)
je 0x581dd
movq %rbx, %rdi
callq 0x3f7a0
jmp 0x58238
movq %rsi, %r14
leaq 0x18(%rsp), %r15
movq %r15, -0x10(%r15)
leaq 0x283f0(%rip), %rsi     # 0x805e0
leaq 0x283ef(%rip), %rdx     # 0x805e6
leaq 0x8(%rsp), %rdi
callq 0x3f8a0
leaq 0x8(%rsp), %rsi
movq %r14, %rdi
callq 0x3ffe0
movq %rax, %r14
movq 0x8(%rsp), %rdi
cmpq %r15, %rdi
je 0x58228
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x40870
testq %r14, %r14
je 0x582a4
movq %rbx, %rdi
movq %r14, %rsi
callq 0x40ac0
cmpl $0x2, 0x1d0(%rbx)
setb %al
cmpl $0x0, 0x1d4(%rbx)
sete %cl
testb %cl, %al
movl $0x2, %eax
movl $0x8, %ebp
cmovnel %eax, %ebp
movl $0x20, %eax
movl $0x100, %r14d           # imm = 0x100
cmovnel %eax, %r14d
movl $0x30, %edi
callq 0x40800
movq %rax, %r15
movq 0x98(%rbx), %rdx
movq 0x1f0(%rbx), %rsi
movq %rax, %rdi
movl %ebp, %ecx
movl %r14d, %r8d
callq 0x3fd70
movq %r15, 0x1f8(%rbx)
addq $0x28, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
movl $0x20, %edi
callq 0x3fb00
movq %rax, %rbx
leaq 0x8(%rsp), %rdi
movq %r15, (%rdi)
leaq 0x2821b(%rip), %rsi     # 0x804db
leaq 0x2822d(%rip), %rdx     # 0x804f4
callq 0x3f8a0
movb $0x1, %bpl
leaq 0x8(%rsp), %rsi
movq %rbx, %rdi
callq 0x3f890
xorl %ebp, %ebp
movq 0x4abc3(%rip), %rsi     # 0xa2ea8
movq 0x4a94c(%rip), %rdx     # 0xa2c38
movq %rbx, %rdi
callq 0x41d60
movq %rax, %r14
movq 0x8(%rsp), %rdi
cmpq %r15, %rdi
je 0x58316
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x40870
jmp 0x58316
movq %rax, %r14
movb $0x1, %bpl
testb %bpl, %bpl
je 0x58351
movq %rbx, %rdi
callq 0x40080
jmp 0x58351
movq %rax, %r14
movq 0x8(%rsp), %rdi
cmpq %r15, %rdi
je 0x58351
movq 0x18(%rsp), %rsi
incq %rsi
jmp 0x5834c
movq %rax, %r14
jmp 0x58351
movq %rax, %r14
movl $0x30, %esi
movq %r15, %rdi
callq 0x40870
movq %r14, %rdi
callq 0x41f00
nop
// File: /workspace/github_cpp_makefile_star2_O1/jstaursky[P]hutch/src/Sleigh/sleigh.cc
// Function: Sleigh::obtainContext(Address const&, int) const
ParserContext* Sleigh::obtainContext (const Address& addr, int4 state) const
// Obtain a ParserContext for the instruction at the given -addr-. This may be
// cached.
{
    // Make sure parsing has proceeded to at least the given -state.
    ParserContext* pos = discache->getParserContext (addr);
    int4 curstate = pos->getParserState ();
    if (curstate >= state)
        return pos;
    if (curstate == ParserContext::uninitialized) {
        resolve (*pos);
        if (state == ParserContext::disassembly)
            return pos;
    }
    // If we reach here,  state must be ParserContext::pcode
    resolveHandles (*pos);
    return pos;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movl %edx, %ebp
movq %rdi, %r14
movq 0x1f8(%rdi), %rdi
callq 0x3fd60
movq %rax, %rbx
movl (%rax), %eax
cmpl %ebp, %eax
jge 0x58394
testl %eax, %eax
jne 0x5838c
movq %r14, %rdi
movq %rbx, %rsi
callq 0x41170
cmpl $0x1, %ebp
je 0x58394
movq %rbx, %rsi
callq 0x3fcd0
movq %rbx, %rax
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O1/jstaursky[P]hutch/src/Sleigh/sleigh.cc
// Function: Sleigh::getInstructionBytes(Address const&, unsigned char*) const
void Sleigh::getInstructionBytes (const Address& baseaddr, uint1* buf) const

{
    ParserContext* pos = obtainContext (baseaddr, ParserContext::disassembly);
    ParserWalker walker(pos);
    walker.baseState();

    auto len = pos->getLength();

    uintm tmp;
    int4 bytestart = 0;
    do {
        tmp = walker.getInstructionBytes(bytestart,sizeof(uint1));
        memcpy(&buf[bytestart], (uint1*)&tmp, sizeof(uint1));
    } while (bytestart += 1, bytestart != len);

    return;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movq %rdx, %rbx
movl $0x1, %edx
callq 0x3fde0
movq %rax, %r14
movq 0x98(%rax), %r12
movl 0x60(%r12), %r13d
xorl %r15d, %r15d
movl 0x64(%r12), %ecx
movq %r14, %rdi
movl %r15d, %esi
movl $0x1, %edx
callq 0x40ea0
movb %al, (%rbx,%r15)
incq %r15
cmpq %r15, %r13
jne 0x58816
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
nop
// File: /workspace/github_cpp_makefile_star2_O1/jstaursky[P]hutch/src/Sleigh/sleigh.cc
// Function: Sleigh::printAssembly(AssemblyEmit&, Address const&) const
int4 Sleigh::printAssembly (AssemblyEmit& emit, const Address& baseaddr) const

{
    int4 sz;

    ParserContext* pos = obtainContext (baseaddr, ParserContext::disassembly);
    ParserWalker walker (pos);
    walker.baseState ();

    Constructor* ct = walker.getConstructor ();
    ostringstream mons;
    ct->printMnemonic (mons, walker);
    ostringstream body;
    ct->printBody (body, walker);
    emit.dump (baseaddr, mons.str (), body.str ());
    sz = pos->getLength ();
    return sz;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x3d8, %rsp            # imm = 0x3D8
movq %rdx, %r14
movq %rsi, %r15
movq %rdx, %rsi
movl $0x1, %edx
callq 0x3fde0
movq %rax, %rbx
leaq 0x338(%rsp), %r13
movq %rax, (%r13)
xorl %eax, %eax
movq %rax, 0x8(%r13)
movq 0x98(%rbx), %rcx
movq %rcx, 0x10(%r13)
movq %rax, 0x18(%r13)
movq (%rcx), %r12
leaq 0x1c0(%rsp), %rbp
movq %rbp, %rdi
callq 0x41110
movq %r12, %rdi
movq %rbp, %rsi
movq %r13, %rdx
callq 0x3fbf0
leaq 0x48(%rsp), %rdi
callq 0x41110
leaq 0x48(%rsp), %rsi
leaq 0x338(%rsp), %rdx
movq %r12, %rdi
callq 0x40e40
leaq 0x1c8(%rsp), %rsi
leaq 0x28(%rsp), %rdi
callq 0x418b0
leaq 0x50(%rsp), %rsi
leaq 0x8(%rsp), %rdi
callq 0x418b0
movq (%r15), %rax
leaq 0x28(%rsp), %rdx
leaq 0x8(%rsp), %rcx
movq %r15, %rdi
movq %r14, %rsi
callq *0x10(%rax)
leaq 0x18(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x5891c
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x40870
leaq 0x38(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x58937
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x40870
movq 0x98(%rbx), %rax
movl 0x60(%rax), %ebx
movq 0x4a438(%rip), %r14     # 0xa2d80
leaq 0x48(%rsp), %rdi
movq %r14, %rsi
callq 0x3fc30
leaq 0xb8(%rsp), %rdi
callq 0x3f730
leaq 0x1c0(%rsp), %rdi
movq %r14, %rsi
callq 0x3fc30
leaq 0x230(%rsp), %rdi
callq 0x3f730
movl %ebx, %eax
addq $0x3d8, %rsp            # imm = 0x3D8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
leaq 0x18(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x589b6
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x40870
jmp 0x589b6
movq %rax, %rbx
leaq 0x38(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x589d8
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x40870
jmp 0x589d8
jmp 0x589d5
movq %rax, %rbx
movq 0x4a3a1(%rip), %rsi     # 0xa2d80
leaq 0x48(%rsp), %rdi
callq 0x3fc30
leaq 0xb8(%rsp), %rdi
callq 0x3f730
jmp 0x589fd
jmp 0x589fa
movq %rax, %rbx
movq 0x4a37c(%rip), %rsi     # 0xa2d80
leaq 0x1c0(%rsp), %rdi
callq 0x3fc30
leaq 0x230(%rsp), %rdi
callq 0x3f730
movq %rbx, %rdi
callq 0x41f00
// File: /workspace/github_cpp_makefile_star2_O1/jstaursky[P]hutch/src/Sleigh/include/address.hh
// Function: Address::printRaw(std::ostream&) const
inline void Address::printRaw(ostream &s) const {
  if (base == (AddrSpace *)0) {
    s << "invalid_addr";
    return;
  }
  base->printRaw(s,offset);
}

// Assembly:
movq %rdi, %rax
movq (%rdi), %rdi
testq %rdi, %rdi
je 0x58fbe
movq 0x8(%rax), %rdx
movq (%rdi), %rax
movq 0x50(%rax), %rax
jmpq *%rax
leaq 0x260b4(%rip), %rax     # 0x7f079
movl $0xc, %edx
movq %rsi, %rdi
movq %rax, %rsi
jmp 0x40b80
nop
// File: /workspace/github_cpp_makefile_star2_O1/jstaursky[P]hutch/src/Sleigh/include/sleigh.hh
// Function: PcodeData::store(VarnodeData*, VarnodeData*)
void store (VarnodeData* outv, VarnodeData* inv)
    {
        if (outv != nullptr) {
            this->outvar = new VarnodeData;
            *this->outvar = *outv;
        }
        invar = new VarnodeData[isize];
        for (auto i = 0; i != isize; ++i)
            this->invar[i] = inv[i];
    }

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rdx, %rbx
movq %rdi, %r14
testq %rsi, %rsi
je 0x59182
movq %rsi, %r15
movl $0x18, %edi
callq 0x40800
movq %rax, 0x8(%r14)
movups (%r15), %xmm0
movups %xmm0, (%rax)
movq 0x10(%r15), %rcx
movq %rcx, 0x10(%rax)
movslq 0x18(%r14), %rax
movl $0x18, %ecx
mulq %rcx
movq $-0x1, %rdi
cmovnoq %rax, %rdi
callq 0x3f060
movq %rax, 0x10(%r14)
cmpl $0x0, 0x18(%r14)
je 0x591d3
xorl %eax, %eax
xorl %ecx, %ecx
movq 0x10(%r14), %rdx
movq 0x10(%rbx,%rax), %rsi
movq %rsi, 0x10(%rdx,%rax)
movups (%rbx,%rax), %xmm0
movups %xmm0, (%rdx,%rax)
incq %rcx
movl 0x18(%r14), %edx
addq $0x18, %rax
cmpq %rdx, %rcx
jne 0x591ad
popq %rbx
popq %r14
popq %r15
retq
nop
// File: /workspace/github_cpp_makefile_star2_O1/jstaursky[P]hutch/src/Sleigh/sleighbase.cc
// Function: SleighBase::SleighBase()
SleighBase::SleighBase(void)

{
  root = (SubtableSymbol *)0;
  maxdelayslotbytes = 0;
  unique_allocatemask = 0;
  numSections = 0;
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
callq 0x41270
movq 0x495ac(%rip), %rax     # 0xa2b40
addq $0x10, %rax
movq %rax, (%rbx)
xorps %xmm0, %xmm0
movups %xmm0, 0x148(%rbx)
xorl %eax, %eax
movq %rax, 0x158(%rbx)
leaq 0x168(%rbx), %rcx
movl %eax, 0x168(%rbx)
movq %rax, 0x170(%rbx)
movq %rcx, 0x178(%rbx)
movq %rcx, 0x180(%rbx)
movups %xmm0, 0x188(%rbx)
movups %xmm0, 0x198(%rbx)
movups %xmm0, 0x1a8(%rbx)
movups %xmm0, 0x1b8(%rbx)
movups %xmm0, 0x1c8(%rbx)
movl %eax, 0x1d8(%rbx)
popq %rbx
retq
nop
// File: /workspace/github_cpp_makefile_star2_O1/jstaursky[P]hutch/src/Sleigh/sleighbase.cc
// Function: SleighBase::getRegister(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&) const
const VarnodeData &SleighBase::getRegister(const string &nm) const

{
  VarnodeSymbol *sym = (VarnodeSymbol *)findSymbol(nm);
  if (sym == (VarnodeSymbol *)0)
    throw SleighError("Unknown register name: "+nm);
  if (sym->getType() != SleighSymbol::varnode_symbol)
    throw SleighError("Symbol is not a register: "+nm);
  return sym->getFixedVarnode();
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
subq $0x20, %rsp
movq %rsi, %r14
movq 0x1c8(%rdi), %rsi
addq $0x198, %rdi            # imm = 0x198
movq %r14, %rdx
callq 0x3f220
testq %rax, %rax
je 0x59a69
movq %rax, %rbx
movq (%rax), %rax
movq %rbx, %rdi
callq *0x10(%rax)
cmpl $0x6, %eax
jne 0x59ab0
addq $0x38, %rbx
movq %rbx, %rax
addq $0x20, %rsp
popq %rbx
popq %r14
popq %rbp
retq
movl $0x20, %edi
callq 0x3fb00
movq %rax, %rbx
leaq 0x26b2f(%rip), %rsi     # 0x805ac
movq %rsp, %rdi
movq %r14, %rdx
callq 0x40500
movb $0x1, %bpl
movq %rsp, %rsi
movq %rbx, %rdi
callq 0x3f890
xorl %ebp, %ebp
movq 0x493f1(%rip), %rsi     # 0xa2e90
movq 0x49192(%rip), %rdx     # 0xa2c38
movq %rbx, %rdi
callq 0x41d60
jmp 0x59af5
movl $0x20, %edi
callq 0x3fb00
movq %rax, %rbx
leaq 0x26b00(%rip), %rsi     # 0x805c4
movq %rsp, %rdi
movq %r14, %rdx
callq 0x40500
movb $0x1, %bpl
movq %rsp, %rsi
movq %rbx, %rdi
callq 0x3f890
xorl %ebp, %ebp
movq 0x493aa(%rip), %rsi     # 0xa2e90
movq 0x4914b(%rip), %rdx     # 0xa2c38
movq %rbx, %rdi
callq 0x41d60
jmp 0x59af9
jmp 0x59b19
movq %rax, %r14
leaq 0x10(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x59b1f
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x40870
jmp 0x59b1f
movq %rax, %r14
movb $0x1, %bpl
testb %bpl, %bpl
je 0x59b2c
movq %rbx, %rdi
callq 0x40080
movq %r14, %rdi
callq 0x41f00
// File: /workspace/github_cpp_makefile_star2_O1/jstaursky[P]hutch/src/Sleigh/sleighbase.cc
// Function: SleighBase::getRegisterName[abi:cxx11](AddrSpace*, unsigned long, int) const
string SleighBase::getRegisterName(AddrSpace *base,uintb off,int4 size) const

{
  VarnodeData sym;
  sym.space = base;
  sym.offset = off;
  sym.size = size;
  map<VarnodeData,string>::const_iterator iter = varnode_xref.upper_bound(sym); // First point greater than offset
  if (iter == varnode_xref.begin()) return "";
  iter--;
  const VarnodeData &point((*iter).first);
  if (point.space != base) return "";
  uintb offbase = point.offset;
  if (point.offset+point.size >= off+size)
    return (*iter).second;
  
  while(iter != varnode_xref.begin()) {
    --iter;
    const VarnodeData &point((*iter).first);
    if ((point.space != base)||(point.offset != offbase)) return "";
    if (point.offset+point.size >= off+size)
      return (*iter).second;
  }
  return "";
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %r8d, %ebp
movq %rcx, %r15
movq %rdx, %r14
movq %rdi, %rbx
movq 0x170(%rsi), %rax
leaq 0x168(%rsi), %rdi
testq %rax, %rax
je 0x59b97
movq 0x20(%rax), %rcx
cmpq %r14, %rcx
je 0x59b73
movl 0x60(%r14), %edx
cmpl 0x60(%rcx), %edx
setl %cl
jmp 0x59b84
cmpq %r15, 0x28(%rax)
jne 0x59b81
cmpl %ebp, 0x30(%rax)
setb %cl
jmp 0x59b84
seta %cl
testb %cl, %cl
cmovneq %rax, %rdi
xorb $0x1, %cl
movzbl %cl, %ecx
movq 0x10(%rax,%rcx,8), %rax
jmp 0x59b59
movq 0x178(%rsi), %r12
cmpq %r12, %rdi
je 0x59bae
callq 0x3fe70
cmpq %r14, 0x20(%rax)
je 0x59bd9
leaq 0x10(%rbx), %rax
movq %rax, (%rbx)
leaq 0x27634(%rip), %rdx     # 0x811f0
movq %rbx, %rdi
movq %rdx, %rsi
callq 0x3f8a0
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x28(%rax), %r13
movl 0x30(%rax), %ecx
addq %r13, %rcx
movslq %ebp, %rbp
addq %r15, %rbp
cmpq %rbp, %rcx
jae 0x59c12
cmpq %r12, %rax
je 0x59bae
movq %rax, %rdi
callq 0x3fe70
cmpq %r14, 0x20(%rax)
jne 0x59bae
movq 0x28(%rax), %rcx
cmpq %r13, %rcx
jne 0x59bae
movl 0x30(%rax), %edx
addq %rdx, %rcx
jmp 0x59be9
leaq 0x10(%rbx), %rcx
movq %rcx, (%rbx)
movq 0x38(%rax), %rsi
movq 0x40(%rax), %rdx
addq %rsi, %rdx
movq %rbx, %rdi
callq 0x3f8e0
jmp 0x59bc7
// File: /workspace/github_cpp_makefile_star2_O1/jstaursky[P]hutch/src/Sleigh/slghpatexpress.cc
// Function: TokenPattern::buildSingle(int, int, unsigned int)
PatternBlock *TokenPattern::buildSingle(int4 startbit,int4 endbit,uintm byteval)

{				// Create a mask/value pattern within a single word
				// The field is given by the bitrange [startbit,endbit]
				// bit 0 is the MOST sig bit of the word
				// use the least sig bits of byteval to fill in
				// the field's value
  uintm mask;
  int4 offset = 0;
  int4 size = endbit-startbit+1;
  while(startbit >= 8) {
    offset += 1;
    startbit -= 8;
    endbit -= 8;
  }    
  mask = (~((uintm)0)) << (sizeof(uintm)*8-size);
  byteval = (byteval << (sizeof(uintm)*8-size))& mask;
  mask >>= startbit;
  byteval >>= startbit;
  return new PatternBlock(offset,mask,byteval);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movl %edx, %ebx
movl %edi, %ecx
subl %esi, %ecx
xorl %ebp, %ebp
cmpl $0x8, %edi
jl 0x5b8d7
cmpl $0xf, %edi
movl $0xf, %eax
cmovll %edi, %eax
negl %eax
addl %edi, %eax
addl $0x7, %eax
movl %eax, %ebp
shrl $0x3, %ebp
andl $-0x8, %eax
incl %ebp
negl %eax
addl %eax, %edi
addl $-0x8, %edi
addb $0x1f, %cl
movl $0xffffffff, %r15d      # imm = 0xFFFFFFFF
shll %cl, %r15d
shll %cl, %ebx
movl %edi, %ecx
shrl %cl, %r15d
shrl %cl, %ebx
movl $0x38, %edi
callq 0x40800
movq %rax, %r14
movq %rax, %rdi
movl %ebp, %esi
movl %r15d, %edx
movl %ebx, %ecx
callq 0x3f100
movq %r14, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
movl $0x38, %esi
movq %r14, %rdi
callq 0x40870
movq %rbx, %rdi
callq 0x41f00