LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_cpp_makefile_star2_O1/RegulusImpact[P]sadboy/include/jsoncpp.cpp
// Function: Json::ValueIteratorBase::memberName(char const**) const
char const* ValueIteratorBase::memberName(char const** end) const {
  const char* cname = (*current_).first.data();
  if (!cname) {
    *end = NULL;
    return NULL;
  }
  *end = cname + (*current_).first.length();
  return cname;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movq (%rdi), %rcx
movq 0x20(%rcx), %rax
testq %rax, %rax
je 0xd277
movl 0x28(%rcx), %ecx
shrl $0x2, %ecx
addq %rax, %rcx
jmp 0xd27b
xorl %ecx, %ecx
xorl %eax, %eax
movq %rcx, (%rsi)
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O1/RegulusImpact[P]sadboy/include/jsoncpp.cpp
// Function: Json::Value::CZString::CZString(Json::Value::CZString const&)
Value::CZString::CZString(const CZString& other) {
  cstr_ = (other.storage_.policy_ != noDuplication && other.cstr_ != 0
				 ? duplicateStringValue(other.cstr_, other.storage_.length_)
				 : other.cstr_);
  storage_.policy_ = static_cast<unsigned>(other.cstr_
                 ? (static_cast<DuplicationPolicy>(other.storage_.policy_) == noDuplication
                     ? noDuplication : duplicate)
                 : static_cast<DuplicationPolicy>(other.storage_.policy_)) & 3U;
  storage_.length_ = other.storage_.length_;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rsi, %r14
movq %rdi, %rbx
movl 0x8(%rsi), %r15d
testb $0x3, %r15b
je 0xd6f6
movq (%r14), %r12
testq %r12, %r12
je 0xd6f6
shrl $0x2, %r15d
leaq 0x1(%r15), %rdi
callq 0x44b0
testq %rax, %rax
je 0xd735
movq %rax, %r13
movq %rax, %rdi
movq %r12, %rsi
movq %r15, %rdx
callq 0x42f0
movb $0x0, (%r13,%r15)
jmp 0xd6f9
movq (%r14), %r13
movq %r13, (%rbx)
movl 0x8(%r14), %eax
xorl %ecx, %ecx
andl $0x3, %eax
setne %cl
cmpq $0x0, (%r14)
cmovel %eax, %ecx
movl 0x8(%rbx), %eax
andl $-0x4, %eax
orl %ecx, %eax
movl %eax, 0x8(%rbx)
movl 0x8(%r14), %eax
andl $-0x4, %eax
orl %ecx, %eax
movl %eax, 0x8(%rbx)
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq -0x38(%rbp), %r14
movq %r14, -0x10(%r14)
leaq 0x11c63(%rip), %rsi     # 0x1f3a7
leaq 0x11caa(%rip), %rdx     # 0x1f3f5
leaq -0x48(%rbp), %rbx
movq %rbx, %rdi
callq 0x173f0
movq %rbx, %rdi
callq 0x544e
movq %rax, %rbx
movq -0x48(%rbp), %rdi
cmpq %r14, %rdi
je 0xd770
callq 0x4320
movq %rbx, %rdi
callq 0x45d0
// File: /workspace/github_cpp_makefile_star2_O1/RegulusImpact[P]sadboy/include/jsoncpp.cpp
// Function: Json::Value::CZString::operator<(Json::Value::CZString const&) const
bool Value::CZString::operator<(const CZString& other) const {
  if (!cstr_) return index_ < other.index_;
  //return strcmp(cstr_, other.cstr_) < 0;
  // Assume both are strings.
  unsigned this_len = this->storage_.length_;
  unsigned other_len = other.storage_.length_;
  unsigned min_len = std::min<unsigned>(this_len, other_len);
  JSON_ASSERT(this->cstr_ && other.cstr_);
  int comp = memcmp(this->cstr_, other.cstr_, min_len);
  if (comp < 0) return true;
  if (comp > 0) return false;
  return (this_len < other_len);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
subq $0x20, %rsp
movq %rdi, %rax
movq (%rdi), %rdi
movl 0x8(%rax), %ebx
testq %rdi, %rdi
je 0xd856
movq (%rsi), %rax
testq %rax, %rax
je 0xd865
shrl $0x2, %ebx
movl 0x8(%rsi), %r14d
shrl $0x2, %r14d
cmpl %ebx, %r14d
movl %ebx, %edx
cmovbl %r14d, %edx
movq %rax, %rsi
callq 0x4180
movl %eax, %ecx
movb $0x1, %al
testl %ecx, %ecx
js 0xd85c
sete %cl
cmpl %r14d, %ebx
setb %al
andb %cl, %al
jmp 0xd85c
cmpl 0x8(%rsi), %ebx
setb %al
addq $0x20, %rsp
popq %rbx
popq %r14
popq %rbp
retq
leaq -0x20(%rbp), %r14
movq %r14, -0x10(%r14)
leaq 0x11185(%rip), %rsi     # 0x1e9f9
leaq 0x11190(%rip), %rdx     # 0x1ea0b
leaq -0x30(%rbp), %rbx
movq %rbx, %rdi
callq 0x173f0
movq %rbx, %rdi
callq 0xd457
movq %rax, %rbx
movq -0x30(%rbp), %rdi
cmpq %r14, %rdi
je 0xd8a0
callq 0x4320
movq %rbx, %rdi
callq 0x45d0
// File: /workspace/github_cpp_makefile_star2_O1/RegulusImpact[P]sadboy/include/jsoncpp.cpp
// Function: Json::Value::Value(Json::ValueType)
Value::Value(ValueType vtype) {
  static char const emptyString[] = "";
  initBasic(vtype);
  switch (vtype) {
  case nullValue:
    break;
  case intValue:
  case uintValue:
    value_.int_ = 0;
    break;
  case realValue:
    value_.real_ = 0.0;
    break;
  case stringValue:
    // allocated_ == false, so this is safe.
    value_.string_ = const_cast<char*>(static_cast<char const*>(emptyString));
    break;
  case arrayValue:
  case objectValue:
    value_.map_ = new ObjectValues();
    break;
  case booleanValue:
    value_.bool_ = false;
    break;
  default:
    JSON_ASSERT_UNREACHABLE;
  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
movzbl %sil, %eax
movl $0xfffffe00, %ecx       # imm = 0xFFFFFE00
andl 0x8(%rdi), %ecx
orl %eax, %ecx
movw %cx, 0x8(%rdi)
xorps %xmm0, %xmm0
movups %xmm0, 0x10(%rdi)
movq $0x0, 0x20(%rdi)
cmpl $0x7, %esi
ja 0xd9c4
movq %rdi, %rbx
movl %esi, %eax
leaq 0x10896(%rip), %rcx     # 0x1e204
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq $0x0, (%rbx)
jmp 0xd9bd
movl $0x30, %edi
callq 0x4390
leaq 0x8(%rax), %rcx
xorps %xmm0, %xmm0
movaps %xmm0, 0x10(%rax)
movaps %xmm0, 0x20(%rax)
movaps %xmm0, (%rax)
movq %rcx, 0x18(%rax)
movq %rcx, 0x20(%rax)
movq $0x0, 0x28(%rax)
jmp 0xd9b5
leaq 0x109ff(%rip), %rax     # 0x1e3b4
movq %rax, (%rbx)
jmp 0xd9bd
movb $0x0, (%rbx)
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
leaq 0x1107a(%rip), %rdi     # 0x1ea45
leaq 0x10c10(%rip), %rsi     # 0x1e5e2
leaq 0x11072(%rip), %rcx     # 0x1ea4b
movl $0xb31, %edx            # imm = 0xB31
callq 0x4280
nop
// File: /workspace/github_cpp_makefile_star2_O1/RegulusImpact[P]sadboy/include/jsoncpp.cpp
// Function: Json::Value::dupMeta(Json::Value const&)
void Value::dupMeta(const Value& other) {
  if (other.comments_) {
    comments_ = new CommentInfo[numberOfCommentPlacement];
    for (int comment = 0; comment < numberOfCommentPlacement; ++comment) {
      const CommentInfo& otherComment = other.comments_[comment];
      if (otherComment.comment_)
        comments_[comment].setComment(
            otherComment.comment_, strlen(otherComment.comment_));
    }
  } else {
    comments_ = 0;
  }
  start_ = other.start_;
  limit_ = other.limit_;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %r14
movq %rdi, %rbx
cmpq $0x0, 0x10(%rsi)
je 0xdf14
movl $0x20, %edi
callq 0x4040
movq $0x3, (%rax)
leaq 0x8(%rax), %rcx
xorps %xmm0, %xmm0
movups %xmm0, 0x8(%rax)
movq $0x0, 0x18(%rax)
movq %rcx, 0x10(%rbx)
xorl %r13d, %r13d
movq 0x10(%r14), %rax
movq (%rax,%r13), %r15
testq %r15, %r15
je 0xdf08
movq 0x10(%rbx), %r12
addq %r13, %r12
movq %r15, %rdi
callq 0x4170
movq %r12, %rdi
movq %r15, %rsi
movq %rax, %rdx
callq 0xd4f8
addq $0x8, %r13
cmpq $0x18, %r13
jne 0xdede
jmp 0xdf1c
movq $0x0, 0x10(%rbx)
movq 0x18(%r14), %rax
movq %rax, 0x18(%rbx)
movq 0x20(%r14), %rax
movq %rax, 0x20(%rbx)
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O1/RegulusImpact[P]sadboy/include/jsoncpp.cpp
// Function: Json::Value::releasePayload()
void Value::releasePayload() {
  switch (type_) {
  case nullValue:
  case intValue:
  case uintValue:
  case realValue:
  case booleanValue:
    break;
  case stringValue:
    if (allocated_)
      releasePrefixedStringValue(value_.string_);
    break;
  case arrayValue:
  case objectValue:
    delete value_.map_;
    break;
  default:
    JSON_ASSERT_UNREACHABLE;
  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
movzwl 0x8(%rdi), %eax
cmpb $0x7, %al
ja 0xe0a0
movzbl %al, %ecx
movl $0x2f, %edx
btl %ecx, %edx
jae 0xe064
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
movl $0xc0, %edx
btl %ecx, %edx
jae 0xe08c
movq (%rdi), %rbx
testq %rbx, %rbx
je 0xe05d
movq %rbx, %rdi
callq 0x16df8
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %rbp
jmp 0x4320
btl $0x8, %eax
jae 0xe05d
movq (%rdi), %rdi
addq $0x8, %rsp
popq %rbx
popq %rbp
jmp 0x4450
leaq 0x1099e(%rip), %rdi     # 0x1ea45
leaq 0x10534(%rip), %rsi     # 0x1e5e2
leaq 0x10e87(%rip), %rcx     # 0x1ef3c
movl $0xdc8, %edx            # imm = 0xDC8
callq 0x4280
nop
// File: /workspace/github_cpp_makefile_star2_O1/RegulusImpact[P]sadboy/include/jsoncpp.cpp
// Function: Json::Value::isInt() const
bool Value::isInt() const {
  switch (type_) {
  case intValue:
#if defined(JSON_HAS_INT64)
    return value_.int_ >= minInt && value_.int_ <= maxInt;
#else
    return true;
#endif
  case uintValue:
    return value_.uint_ <= UInt(maxInt);
  case realValue:
    return value_.real_ >= minInt && value_.real_ <= maxInt &&
           IsIntegral(value_.real_);
  default:
    break;
  }
  return false;
}

// Assembly:
movzbl 0x8(%rdi), %eax
cmpl $0x3, %eax
je 0xe745
cmpl $0x2, %eax
je 0xe73a
cmpl $0x1, %eax
jne 0xe78b
movq (%rdi), %rax
movslq %eax, %rcx
cmpq %rax, %rcx
jmp 0xe741
movq (%rdi), %rax
shrq $0x1f, %rax
sete %al
retq
movsd (%rdi), %xmm0
xorl %eax, %eax
ucomisd 0xfdad(%rip), %xmm0     # 0x1e500
jb 0xe744
movsd 0xfdab(%rip), %xmm1     # 0x1e508
ucomisd %xmm0, %xmm1
jb 0xe744
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
leaq -0x8(%rbp), %rdi
callq 0x45e0
xorpd %xmm1, %xmm1
cmpeqsd %xmm0, %xmm1
movq %xmm1, %rax
andl $0x1, %eax
addq $0x10, %rsp
popq %rbp
retq
xorl %eax, %eax
retq
// File: /workspace/github_cpp_makefile_star2_O1/RegulusImpact[P]sadboy/include/jsoncpp.cpp
// Function: Json::Value::isUInt() const
bool Value::isUInt() const {
  switch (type_) {
  case intValue:
#if defined(JSON_HAS_INT64)
    return value_.int_ >= 0 && LargestUInt(value_.int_) <= LargestUInt(maxUInt);
#else
    return value_.int_ >= 0;
#endif
  case uintValue:
#if defined(JSON_HAS_INT64)
    return value_.uint_ <= maxUInt;
#else
    return true;
#endif
  case realValue:
    return value_.real_ >= 0 && value_.real_ <= maxUInt &&
           IsIntegral(value_.real_);
  default:
    break;
  }
  return false;
}

// Assembly:
movzbl 0x8(%rdi), %eax
cmpl $0x3, %eax
je 0xe967
cmpl $0x2, %eax
je 0xe95f
cmpl $0x1, %eax
jne 0xe9ad
cmpl $0x0, 0x4(%rdi)
sete %al
retq
movsd (%rdi), %xmm0
xorl %eax, %eax
xorpd %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jb 0xe966
movsd 0xfb91(%rip), %xmm1     # 0x1e510
ucomisd %xmm0, %xmm1
jb 0xe966
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
leaq -0x8(%rbp), %rdi
callq 0x45e0
xorpd %xmm1, %xmm1
cmpeqsd %xmm0, %xmm1
movq %xmm1, %rax
andl $0x1, %eax
addq $0x10, %rsp
popq %rbp
retq
xorl %eax, %eax
retq
// File: /workspace/github_cpp_makefile_star2_O1/RegulusImpact[P]sadboy/include/jsoncpp.cpp
// Function: Json::Value::removeMember(char const*, char const*, Json::Value*)
bool Value::removeMember(const char* key, const char* cend, Value* removed)
{
  if (type_ != objectValue) {
    return false;
  }
  CZString actualKey(key, static_cast<unsigned>(cend-key), CZString::noDuplication);
  ObjectValues::iterator it = value_.map_->find(actualKey);
  if (it == value_.map_->end())
    return false;
  if (removed)
#if JSON_HAS_RVALUE_REFERENCES
    *removed = std::move(it->second);
#else
    *removed = it->second;
#endif
  value_.map_->erase(it);
  return true;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
cmpb $0x7, 0x8(%rdi)
jne 0x10479
movq %rcx, %r15
movq %rdi, %r14
subl %esi, %edx
leaq -0x38(%rbp), %rax
movq %rsi, (%rax)
shll $0x2, %edx
movl %edx, 0x8(%rax)
movq (%rdi), %rdi
movq %rax, %rsi
callq 0x18aaa
movq %rax, %r12
movq (%r14), %rax
addq $0x8, %rax
cmpq %rax, %r12
setne %bl
je 0x1045e
testq %r15, %r15
je 0x10453
movq %r12, %rsi
addq $0x30, %rsi
leaq -0x60(%rbp), %r13
movq %r13, %rdi
callq 0xdf3c
movzwl 0x8(%r15), %eax
movl $0xff, %edx
movl %eax, %esi
andl %edx, %esi
movzwl 0x8(%r13), %edi
andl %edi, %edx
movl $0xff00, %ecx           # imm = 0xFF00
movl %eax, %r8d
andl %ecx, %r8d
orl %edx, %r8d
movw %r8w, 0x8(%r15)
andl %edi, %ecx
orl %esi, %ecx
movw %cx, 0x8(%r13)
movq (%r15), %rdx
movq (%r13), %rsi
movq %rsi, (%r15)
movq %rdx, (%r13)
movl $0x100, %edx            # imm = 0x100
andl %edx, %edi
andl $0xfeff, %r8d           # imm = 0xFEFF
orl %edi, %r8d
movw %r8w, 0x8(%r15)
andl %edx, %eax
andl $0xfffffeff, %ecx       # imm = 0xFFFFFEFF
orl %eax, %ecx
movw %cx, 0x8(%r13)
movq 0x10(%r15), %rax
movq 0x10(%r13), %rcx
movq %rcx, 0x10(%r15)
movq %rax, 0x10(%r13)
movq 0x18(%r15), %rax
movq 0x18(%r13), %rcx
movq %rcx, 0x18(%r15)
movq %rax, 0x18(%r13)
movq 0x20(%r15), %rax
movq 0x20(%r13), %rcx
movq %rcx, 0x20(%r15)
movq %rax, 0x20(%r13)
movq %r13, %rdi
callq 0xdfe0
movq (%r14), %rdi
movq %r12, %rsi
callq 0x1878e
movq -0x38(%rbp), %rdi
testq %rdi, %rdi
je 0x1047b
movl -0x30(%rbp), %eax
andl $0x3, %eax
cmpl $0x1, %eax
jne 0x1047b
callq 0x4450
jmp 0x1047b
xorl %ebx, %ebx
movl %ebx, %eax
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
movq -0x38(%rbp), %rdi
testq %rdi, %rdi
je 0x104a8
movl -0x30(%rbp), %eax
andl $0x3, %eax
cmpl $0x1, %eax
jne 0x104a8
callq 0x4450
movq %rbx, %rdi
callq 0x45d0
// File: /workspace/github_cpp_makefile_star2_O1/RegulusImpact[P]sadboy/include/jsoncpp.cpp
// Function: Json::writeString[abi:cxx11](Json::StreamWriter::Factory const&, Json::Value const&)
JSONCPP_STRING writeString(StreamWriter::Factory const& builder, Value const& root) {
  JSONCPP_OSTRINGSTREAM sout;
  StreamWriterPtr const writer(builder.newStreamWriter());
  writer->write(root, &sout);
  return sout.str();
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x178, %rsp            # imm = 0x178
movq %rdx, %r15
movq %rsi, %r14
movq %rdi, %rbx
leaq -0x190(%rbp), %rdi
callq 0x44c0
movq (%r14), %rax
movq %r14, %rdi
callq *0x10(%rax)
movq %rax, %r14
movq (%rax), %rax
leaq -0x190(%rbp), %rdx
movq %r14, %rdi
movq %r15, %rsi
callq *0x10(%rax)
leaq -0x188(%rbp), %rsi
movq %rbx, %rdi
callq 0x4570
movq (%r14), %rax
movq %r14, %rdi
callq *0x8(%rax)
movq 0x1933a(%rip), %rsi     # 0x29fc0
leaq -0x190(%rbp), %rdi
callq 0x41d0
leaq -0x120(%rbp), %rdi
callq 0x4110
movq %rbx, %rax
addq $0x178, %rsp            # imm = 0x178
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
jmp 0x10cc0
movq %rax, %rbx
movq (%r14), %rax
movq %r14, %rdi
callq *0x8(%rax)
movq 0x192f9(%rip), %rsi     # 0x29fc0
leaq -0x190(%rbp), %rdi
callq 0x41d0
leaq -0x120(%rbp), %rdi
callq 0x4110
movq %rbx, %rdi
callq 0x45d0
nop
// File: /workspace/github_cpp_makefile_star2_O1/RegulusImpact[P]sadboy/include/jsoncpp.cpp
// Function: Json::StyledStreamWriter::write(std::ostream&, Json::Value const&)
void StyledStreamWriter::write(JSONCPP_OSTREAM& out, const Value& root) {
  document_ = &out;
  addChildValues_ = false;
  indentString_.clear();
  indented_ = true;
  writeCommentBeforeValue(root);
  if (!indented_) writeIndent();
  indented_ = true;
  writeValue(root);
  writeCommentAfterValueOnSameLine(root);
  *document_ << "\n";
  document_ = NULL; // Forget the stream, for safety.
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
movq %rdi, %rbx
movq %rsi, 0x18(%rdi)
andb $-0x2, 0x68(%rdi)
movq %rdx, %r14
movq $0x0, 0x28(%rdi)
movq 0x20(%rdi), %rax
movb $0x0, (%rax)
orb $0x2, 0x68(%rdi)
movq %rdx, %rsi
callq 0x12d7a
testb $0x2, 0x68(%rbx)
jne 0x12d3e
movq %rbx, %rdi
callq 0x12e6e
orb $0x2, 0x68(%rbx)
movq %rbx, %rdi
movq %r14, %rsi
callq 0x12ea4
movq %rbx, %rdi
movq %r14, %rsi
callq 0x132e4
movq 0x18(%rbx), %rdi
leaq 0xd978(%rip), %rsi      # 0x206db
movl $0x1, %edx
callq 0x4410
movq $0x0, 0x18(%rbx)
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O1/RegulusImpact[P]sadboy/include/jsoncpp.cpp
// Function: Json::BuiltStyledStreamWriter::write(Json::Value const&, std::ostream*)
int BuiltStyledStreamWriter::write(Value const& root, JSONCPP_OSTREAM* sout)
{
  sout_ = sout;
  addChildValues_ = false;
  indented_ = true;
  indentString_.clear();
  writeCommentBeforeValue(root);
  if (!indented_) writeIndent();
  indented_ = true;
  writeValue(root);
  writeCommentAfterValueOnSameLine(root);
  *sout_ << endingLineFeedSymbol_;
  sout_ = NULL;
  return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
movq %rsi, %r14
movq %rdi, %rbx
movq %rdx, 0x8(%rdi)
movb 0xd8(%rdi), %al
andb $-0x4, %al
orb $0x2, %al
movb %al, 0xd8(%rdi)
movq $0x0, 0x30(%rdi)
movq 0x28(%rdi), %rax
movb $0x0, (%rax)
callq 0x13af2
testb $0x2, 0xd8(%rbx)
jne 0x13aae
movq %rbx, %rdi
callq 0x13bf6
orb $0x2, 0xd8(%rbx)
movq %rbx, %rdi
movq %r14, %rsi
callq 0x13c32
movq %rbx, %rdi
movq %r14, %rsi
callq 0x14056
movq 0x8(%rbx), %rdi
movq 0xb8(%rbx), %rsi
movq 0xc0(%rbx), %rdx
callq 0x4410
movq $0x0, 0x8(%rbx)
xorl %eax, %eax
popq %rbx
popq %r14
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O1/RegulusImpact[P]sadboy/include/jsoncpp.cpp
// Function: Json::BuiltStyledStreamWriter::writeCommentBeforeValue(Json::Value const&)
void BuiltStyledStreamWriter::writeCommentBeforeValue(Value const& root) {
  if (cs_ == CommentStyle::None) return;
  if (!root.hasComment(commentBefore))
    return;

  if (!indented_) writeIndent();
  const JSONCPP_STRING& comment = root.getComment(commentBefore);
  JSONCPP_STRING::const_iterator iter = comment.begin();
  while (iter != comment.end()) {
    *sout_ << *iter;
    if (*iter == '\n' &&
       ((iter+1) != comment.end() && *(iter + 1) == '/'))
      // writeIndent();  // would write extra newline
      *sout_ << indentString_;
    ++iter;
  }
  indented_ = false;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x30, %rsp
cmpl $0x0, 0x70(%rdi)
je 0x13bcc
movq %rsi, %r14
movq 0x10(%rsi), %rax
testq %rax, %rax
je 0x13bcc
cmpq $0x0, (%rax)
je 0x13bcc
movq %rdi, %rbx
testb $0x2, 0xd8(%rdi)
jne 0x13b39
movq %rbx, %rdi
callq 0x13bf6
leaq -0x48(%rbp), %r15
movq %r15, %rdi
movq %r14, %rsi
xorl %edx, %edx
callq 0x10ac0
movq (%r15), %r12
cmpq $0x0, 0x8(%r15)
je 0x13bb4
leaq -0x21(%rbp), %r14
movq 0x8(%rbx), %rdi
movb (%r12), %al
movb %al, -0x21(%rbp)
movl $0x1, %edx
movq %r14, %rsi
callq 0x4410
cmpb $0xa, (%r12)
jne 0x13b9f
leaq 0x1(%r12), %rax
movq -0x48(%rbp), %rcx
addq -0x40(%rbp), %rcx
cmpq %rcx, %rax
je 0x13b9f
cmpb $0x2f, (%rax)
jne 0x13b9f
movq 0x8(%rbx), %rdi
movq 0x28(%rbx), %rsi
movq 0x30(%rbx), %rdx
callq 0x4410
incq %r12
movq -0x48(%rbp), %rdi
movq -0x40(%rbp), %rax
addq %rdi, %rax
cmpq %rax, %r12
jne 0x13b58
jmp 0x13bb7
movq %r12, %rdi
andb $-0x3, 0xd8(%rbx)
leaq -0x38(%rbp), %rax
cmpq %rax, %rdi
je 0x13bcc
callq 0x4320
addq $0x30, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
leaq -0x38(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x13bee
callq 0x4320
movq %rbx, %rdi
callq 0x45d0
// File: /workspace/github_cpp_makefile_star2_O1/RegulusImpact[P]sadboy/include/jsoncpp.cpp
// Function: Json::OurCharReader::parse(char const*, char const*, Json::Value*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>*)
bool parse(
      char const* beginDoc, char const* endDoc,
      Value* root, JSONCPP_STRING* errs) JSONCPP_OVERRIDE {
    bool ok = reader_.parse(beginDoc, endDoc, *root, collectComments_);
    if (errs) {
      *errs = reader_.getFormattedErrorMessages();
    }
    return ok;
  }

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x20, %rsp
movq %r8, %r14
movq %rdi, %r15
movzbl 0x8(%rdi), %r8d
addq $0x10, %r15
movq %r15, %rdi
callq 0x7f14
movl %eax, %ebx
testq %r14, %r14
je 0x1670d
leaq -0x40(%rbp), %r12
movq %r12, %rdi
movq %r15, %rsi
callq 0xab1a
movq %r14, %rdi
movq %r12, %rsi
callq 0x4470
movq (%r12), %rdi
leaq -0x30(%rbp), %rax
cmpq %rax, %rdi
je 0x1670d
callq 0x4320
movl %ebx, %eax
addq $0x20, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O1/RegulusImpact[P]sadboy/src/CPU.cpp
// Function: CPU::Get(FULL_REGISTERS)
std::uint16_t CPU::Get(FULL_REGISTERS r) {
    std::uint16_t value = 0;
    switch (r) {
        case FULL_REGISTERS::AF:
            value = regs[REGISTERS::A] << 8 | regs[REGISTERS::F];
            break;
        case FULL_REGISTERS::BC:
            value = regs[REGISTERS::B] << 8 | regs[REGISTERS::C];
            break;
        case FULL_REGISTERS::DE:
            value = regs[REGISTERS::D] << 8 | regs[REGISTERS::E];
            break;
        case FULL_REGISTERS::HL:
            value = regs[REGISTERS::H] << 8 | regs[REGISTERS::L];
            break;
    }

    return value;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
cmpl $0x3, %esi
ja 0x19a34
movl %esi, %eax
leaq 0x5ea4(%rip), %rcx      # 0x1f8b4
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movzwl (%rdi), %eax
jmp 0x19a2e
movzwl 0x4(%rdi), %eax
jmp 0x19a2e
movzwl 0x6(%rdi), %eax
jmp 0x19a36
movzwl 0x2(%rdi), %eax
rolw $0x8, %ax
jmp 0x19a36
xorl %eax, %eax
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O1/RegulusImpact[P]sadboy/src/CPU.cpp
// Function: CPU::Set(FULL_REGISTERS, unsigned short)
void CPU::Set(FULL_REGISTERS r, std::uint16_t value) {
    uint8_t hi = (uint8_t)(value >> 8);
    uint8_t lo = (uint8_t)(value);
    switch (r) {
        case FULL_REGISTERS::AF:
            regs[REGISTERS::A] = hi;
            regs[REGISTERS::F] = lo;
            break;
        case FULL_REGISTERS::BC:
            regs[REGISTERS::B] = hi;
            regs[REGISTERS::C] = lo;
            break;
        case FULL_REGISTERS::DE:
            regs[REGISTERS::D] = hi;
            regs[REGISTERS::E] = lo;
            break;
        case FULL_REGISTERS::HL:
            regs[REGISTERS::H] = hi;
            regs[REGISTERS::L] = lo;
            break;
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
cmpl $0x3, %esi
ja 0x19a81
movl %edx, %eax
shrl $0x8, %eax
movl %esi, %ecx
leaq 0x5e69(%rip), %rsi      # 0x1f8c4
movslq (%rsi,%rcx,4), %rcx
addq %rsi, %rcx
jmpq *%rcx
movb %al, (%rdi)
movb %dl, 0x1(%rdi)
jmp 0x19a81
movb %al, 0x4(%rdi)
movb %dl, 0x5(%rdi)
jmp 0x19a81
movb %al, 0x7(%rdi)
movb %dl, 0x6(%rdi)
jmp 0x19a81
movb %al, 0x2(%rdi)
movb %dl, 0x3(%rdi)
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O1/RegulusImpact[P]sadboy/src/CPU.cpp
// Function: CPU::ReadPC16()
std::uint16_t CPU::ReadPC16() {
    std::uint8_t lo = ReadPC();
    std::uint8_t hi = ReadPC();
    std::uint16_t addr = (((uint16_t)hi) << 8) | lo;

    return addr;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
movq %rdi, %rbx
movq 0x10(%rdi), %rdi
movzwl 0x18(%rbx), %esi
leal 0x1(%rsi), %eax
movw %ax, 0x18(%rbx)
callq 0x1b710
movl %eax, %r14d
movq 0x10(%rbx), %rdi
movzwl 0x18(%rbx), %esi
leal 0x1(%rsi), %eax
movw %ax, 0x18(%rbx)
callq 0x1b710
movzbl %al, %ecx
shll $0x8, %ecx
movzbl %r14b, %eax
orl %ecx, %eax
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O1/RegulusImpact[P]sadboy/src/CPU.cpp
// Function: CPU::PopSP16()
uint16_t CPU::PopSP16() {
    uint16_t addr = stackPointer++;
    stackPointer++;
    uint16_t n = mmu->Read16Bit(addr);
    //mmu->Write(addr, (uint16_t)0x00);
    return n;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movzwl 0x1a(%rdi), %esi
leal 0x2(%rsi), %eax
movw %ax, 0x1a(%rdi)
movq 0x10(%rdi), %rdi
popq %rbp
jmp 0x1b810
nop
// File: /workspace/github_cpp_makefile_star2_O1/RegulusImpact[P]sadboy/src/CPU.cpp
// Function: CPU::PushSP(unsigned short)
void CPU::PushSP(uint16_t value) {
    uint8_t hi = (uint8_t)((value >> 8) & 0xFF);
    uint8_t lo = (uint8_t)((value) & 0xFF);
    PushSP(hi);
    PushSP(lo);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movl %esi, %ebx
movq %rdi, %r14
movl %esi, %edx
shrl $0x8, %edx
movzwl 0x1a(%rdi), %esi
decl %esi
movw %si, 0x1a(%rdi)
movq 0x10(%rdi), %rdi
movl $0xffff, %r15d          # imm = 0xFFFF
andl %r15d, %esi
callq 0x1b430
movzwl 0x1a(%r14), %esi
decl %esi
movw %si, 0x1a(%r14)
movq 0x10(%r14), %rdi
andl %r15d, %esi
movzbl %bl, %edx
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x1b430
nop
// File: /workspace/github_cpp_makefile_star2_O1/RegulusImpact[P]sadboy/src/CPU.cpp
// Function: CPU::Read()
void CPU::Read() {
    if (!halt) {
        // uint16_t pc = programCounter;
        uint8_t opcode = ReadPC();

        // if (pc == 0xC04F) {
        //     loopCounter++;
        // }

        // if (mmu->enableDebugger && loopCounter > 5) {
        //     std::fprintf(stderr, "%.4X: %.2X\n", pc, opcode);
        // }
        CheckOpcode(opcode);
    } else {
        cycles = 4;
    }

    if (imeNext) {
        imeNext = false;
        IME = 0xFF;
    }

    if (haltNext) {
        haltNext = false;
        halt = true;
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
movq %rdi, %rbx
cmpb $0x0, 0x1d(%rdi)
je 0x19d0f
movb $0x4, 0x8(%rbx)
jmp 0x19d2e
movq 0x10(%rbx), %rdi
movzwl 0x18(%rbx), %esi
leal 0x1(%rsi), %eax
movw %ax, 0x18(%rbx)
callq 0x1b710
movzbl %al, %esi
movq %rbx, %rdi
callq 0x19d50
cmpb $0x1, 0x1f(%rbx)
jne 0x19d3c
movb $0x0, 0x1f(%rbx)
movb $-0x1, 0x9(%rbx)
cmpb $0x1, 0x1e(%rbx)
jne 0x19d48
movw $0x1, 0x1d(%rbx)
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O1/RegulusImpact[P]sadboy/src/CPU.cpp
// Function: CPU::FullRegisterParse(unsigned char)
FULL_REGISTERS CPU::FullRegisterParse(uint8_t opcode) {
    uint8_t shft = opcode >> 4;
    uint8_t and3 = shft & 3;
    FULL_REGISTERS r = (FULL_REGISTERS)and3;

    return r; // 4 max full registers
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
shrb $0x4, %sil
andb $0x3, %sil
movzbl %sil, %eax
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O1/RegulusImpact[P]sadboy/src/CPU.cpp
// Function: CPU::CheckRegisters()
void CPU::CheckRegisters() {
    if(Get(REGISTERS::A) != 0x01) { std::cout << "Failed on register a" << std::endl; exit(1); }
    if(Get(REGISTERS::B) != 0x00) { std::cout << "Failed on register b" << std::endl; exit(1); }
    if(Get(REGISTERS::C) != 0x13) { std::cout << "Failed on register c" << std::endl; exit(1); }
    if(Get(REGISTERS::D) != 0x00) { std::cout << "Failed on register d" << std::endl; exit(1); }
    if(Get(REGISTERS::E) != 0xD8) { std::cout << "Failed on register e" << std::endl; exit(1); }
    if(Get(REGISTERS::H) != 0x01) { std::cout << "Failed on register h" << std::endl; exit(1); }
    if(Get(REGISTERS::L) != 0x4D) { std::cout << "Failed on register l" << std::endl; exit(1); }
    if(stackPointer != 0xFFFE) { std::cout << "Failed on registers sp" << std::endl; exit(1); }
    if(programCounter != 0x0100) { std::cout << "Failed on registers pc" << std::endl; exit(1); }

    if (GetZ() != 0x1) { std::cout << "Failed on flag Z" << std::endl; exit(1); }
    if (GetN() != 0x0) { std::cout << "Failed on flag N" << std::endl; exit(1); }
    if (GetH() != 0x1) { std::cout << "Failed on flag H" << std::endl; exit(1); }
    if (GetCY() != 0x1) { std::cout << "Failed on flag CY" << std::endl; exit(1); }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
cmpb $0x1, 0x7(%rdi)
jne 0x1b2b3
cmpb $0x0, (%rdi)
jne 0x1b2c6
cmpb $0x13, 0x1(%rdi)
jne 0x1b2d9
cmpb $0x0, 0x2(%rdi)
jne 0x1b2ec
cmpb $-0x28, 0x3(%rdi)
jne 0x1b2ff
cmpb $0x1, 0x4(%rdi)
jne 0x1b30f
cmpb $0x4d, 0x5(%rdi)
jne 0x1b31f
cmpw $-0x2, 0x1a(%rdi)
jne 0x1b32f
cmpw $0x100, 0x18(%rdi)      # imm = 0x100
jne 0x1b33f
movb 0x6(%rdi), %al
testb %al, %al
jns 0x1b34f
testb $0x40, %al
jne 0x1b35f
testb $0x20, %al
je 0x1b36f
testb $0x10, %al
je 0x1b37f
popq %rbp
retq
movq 0xed0e(%rip), %rdi      # 0x29fc8
leaq 0x4e63(%rip), %rsi      # 0x20124
jmp 0x1b38d
movq 0xecfb(%rip), %rdi      # 0x29fc8
leaq 0x4e65(%rip), %rsi      # 0x20139
jmp 0x1b38d
movq 0xece8(%rip), %rdi      # 0x29fc8
leaq 0x4e67(%rip), %rsi      # 0x2014e
jmp 0x1b38d
movq 0xecd5(%rip), %rdi      # 0x29fc8
leaq 0x4e69(%rip), %rsi      # 0x20163
jmp 0x1b38d
movq 0xecc2(%rip), %rdi      # 0x29fc8
leaq 0x4e6b(%rip), %rsi      # 0x20178
jmp 0x1b38d
movq 0xecb2(%rip), %rdi      # 0x29fc8
leaq 0x4e70(%rip), %rsi      # 0x2018d
jmp 0x1b38d
movq 0xeca2(%rip), %rdi      # 0x29fc8
leaq 0x4e75(%rip), %rsi      # 0x201a2
jmp 0x1b38d
movq 0xec92(%rip), %rdi      # 0x29fc8
leaq 0x4e7a(%rip), %rsi      # 0x201b7
jmp 0x1b38d
movq 0xec82(%rip), %rdi      # 0x29fc8
leaq 0x4e81(%rip), %rsi      # 0x201ce
jmp 0x1b38d
movq 0xec72(%rip), %rdi      # 0x29fc8
leaq 0x4e88(%rip), %rsi      # 0x201e5
jmp 0x1b38d
movq 0xec62(%rip), %rdi      # 0x29fc8
leaq 0x4e89(%rip), %rsi      # 0x201f6
jmp 0x1b38d
movq 0xec52(%rip), %rdi      # 0x29fc8
leaq 0x4e8a(%rip), %rsi      # 0x20207
jmp 0x1b38d
movq 0xec42(%rip), %rdi      # 0x29fc8
leaq 0x4e8b(%rip), %rsi      # 0x20218
callq 0x4360
movq %rax, %rdi
callq 0x4190
movl $0x1, %edi
callq 0x4460
// File: /workspace/github_cpp_makefile_star2_O1/RegulusImpact[P]sadboy/src/MMU.cpp
// Function: MMU::MMU(Cartridge*)
MMU::MMU(Cartridge* crt) {
    for (uint32_t ii = 0; ii < 0x8000; ii++) {
        cart[ii] = crt->Read(ii);
    }

    palette[0] = 0;
    palette[1] = 1;
    palette[2] = 2;
    palette[3] = 3;

    readBios = true;
    enableDebugger = false;

    Write(0xFF00, (uint8_t)0x1);
    Write(0xFF41, (uint8_t)3);

    loadBootrom();
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %r14
movq %rdi, %rbx
leaq 0x4edd(%rip), %rax      # 0x20298
movq %rax, 0xe380(%rdi)
leaq 0x50d0(%rip), %rax      # 0x20499
movq %rax, 0xe388(%rdi)
leaq 0x5123(%rip), %rax      # 0x204fa
movq %rax, 0xe390(%rdi)
xorl %r15d, %r15d
movq %r14, %rdi
movl %r15d, %esi
callq 0x1bbf6
movb %al, (%rbx,%r15)
incq %r15
cmpq $0x8000, %r15           # imm = 0x8000
jne 0x1b3e1
movl $0x3020100, 0xe39a(%rbx) # imm = 0x3020100
movw $0x1, 0xe398(%rbx)
movb $0x1, 0xa000(%rbx)
movb $0x3, 0xa041(%rbx)
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x1baaa
nop
// File: /workspace/github_cpp_makefile_star2_O1/RegulusImpact[P]sadboy/src/MMU.cpp
// Function: MMU::Read(unsigned short)
std::uint8_t MMU::Read(uint16_t addr) {
    // cartridge / bios
    if (addr <= 0x7FFF) {
        if (readBios && addr < 0xFF)
            return bios[addr];

        return cart[addr];
    }
    // sram
    else if (addr >= 0xA000 && addr <= 0xBFFF)
        return sram[addr - 0xA000];
    // video ram
    else if (addr >= 0x8000 && addr <= 0x9FFF) {
        return vram[addr - 0x8000];
    }

    // writable ram
    else if (addr >= 0xC000 && addr <= 0xDFFF)
        return wram[addr - 0xC000];

    // more writable ram
    else if (addr >= 0xE000 && addr <= 0xFDFF)
        return wram[addr - 0xE000];

    // oam
    else if (addr >= 0xFE00 && addr <= 0xFEFF)
        return oam[addr - 0xFE00];

    // io
    // this includes FFOO - user input joypad
    // timers
    // gpu

    else if (addr >= 0xFF80 && addr <= 0xFFFE)
        return hram[addr - 0xFF80];
    else if (addr >= 0xFF00 && addr <= 0xFF7F) {
        if (addr == 0xff00) return 1;
        return io[(uint8_t)(addr - 0xFF00)];
    }
    else if (addr == 0xFFFF)
        return interrupt;

    return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
testw %si, %si
js 0x1b735
movzwl %si, %eax
cmpl $0xfe, %eax
ja 0x1b752
cmpb $0x0, 0xe398(%rdi)
je 0x1b752
movb 0xe281(%rdi,%rax), %al
jmp 0x1b7a0
movl %esi, %eax
andl $0xe000, %eax           # imm = 0xE000
cmpl $0xa000, %eax           # imm = 0xA000
jne 0x1b757
addl $0xffff6000, %esi       # imm = 0xFFFF6000
movb 0x8000(%rdi,%rsi), %al
jmp 0x1b7a0
movb (%rdi,%rax), %al
jmp 0x1b7a0
movzwl %si, %ecx
cmpl $0x9fff, %ecx           # imm = 0x9FFF
ja 0x1b771
addl $0xffff8000, %esi       # imm = 0xFFFF8000
movb 0xa100(%rdi,%rsi), %al
jmp 0x1b7a0
movzwl %ax, %eax
cmpl $0xc000, %eax           # imm = 0xC000
jne 0x1b783
addl $0xffff4000, %esi       # imm = 0xFFFF4000
jmp 0x1b799
leal 0x2000(%rsi), %eax
movzwl %ax, %eax
cmpl $0x1dff, %eax           # imm = 0x1DFF
ja 0x1b7a2
addl $0xffff2000, %esi       # imm = 0xFFFF2000
movb 0xc200(%rdi,%rsi), %al
popq %rbp
retq
movl %esi, %eax
andl $0xff00, %eax           # imm = 0xFF00
cmpl $0xfe00, %eax           # imm = 0xFE00
jne 0x1b7bf
addl $0xffff0200, %esi       # imm = 0xFFFF0200
movb 0xc100(%rdi,%rsi), %al
jmp 0x1b7a0
leal 0x80(%rsi), %eax
cmpw $0x7e, %ax
ja 0x1b7da
addl $0xffff0080, %esi       # imm = 0xFFFF0080
movb 0xe200(%rdi,%rsi), %al
jmp 0x1b7a0
movl %esi, %eax
andl $0xff80, %eax           # imm = 0xFF80
cmpl $0xff00, %eax           # imm = 0xFF00
jne 0x1b7fe
movb $0x1, %al
cmpl $0xff00, %ecx           # imm = 0xFF00
je 0x1b7a0
andl $0x7f, %ecx
movb 0xa000(%rdi,%rcx), %al
jmp 0x1b7a0
cmpw $-0x1, %si
je 0x1b808
xorl %eax, %eax
jmp 0x1b7a0
movb 0xe280(%rdi), %al
jmp 0x1b7a0
// File: /workspace/github_cpp_makefile_star2_O1/RegulusImpact[P]sadboy/src/MMU.cpp
// Function: MMU::Read16Bit(unsigned short)
std::uint16_t MMU::Read16Bit(uint16_t addr) {
    uint16_t value = 0;

    uint16_t lo = (uint16_t)Read(addr);
    uint16_t hi = (uint16_t)Read(addr+1);
    value = (hi << 8) | lo;
    return value;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movl %esi, %ebx
movq %rdi, %r14
callq 0x1b710
movl %eax, %r15d
incl %ebx
movzwl %bx, %esi
movq %r14, %rdi
callq 0x1b710
movzbl %al, %ecx
shll $0x8, %ecx
movzbl %r15b, %eax
orl %ecx, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O1/RegulusImpact[P]sadboy/src/MMU.cpp
// Function: MMU::UpdateTile(unsigned short)
void MMU::UpdateTile(uint16_t address) {
	address &= 0x1FFE;

	uint16_t tile = (address >> 4) & 511;
	uint16_t y = (address >> 1) & 7;

	uint8_t x, bitIndex;
	for(x = 0; x < 8; x++) {
		bitIndex = 1 << (7 - x);

		//((unsigned char (*)[8][8])tiles)[tile][y][x] = ((vram[address] & bitIndex) ? 1 : 0) + ((vram[address + 1] & bitIndex) ? 2 : 0);
		tiles[tile][y][x] = ((vram[address] & bitIndex)     != 0 ? 1 : 0) +
                            ((vram[address + 1] & bitIndex) != 0 ? 2 : 0);
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movl %esi, %ecx
andl $0x1ffe, %ecx           # imm = 0x1FFE
movl %esi, %r8d
shrl %r8d
andl $0x7, %r8d
movb 0xa100(%rdi,%rcx), %al
movb 0xa101(%rdi,%rcx), %dl
andl $0x1ff0, %esi           # imm = 0x1FF0
shll $0x3, %r8d
leal (%r8,%rsi,4), %ecx
leaq (%rcx,%rdi), %rsi
addq $0xe3aa, %rsi           # imm = 0xE3AA
xorl %ecx, %ecx
movb $-0x80, %dil
shrb %cl, %dil
testb %dil, %al
setne %r8b
testb %dil, %dl
setne %dil
addb %dil, %dil
orb %r8b, %dil
movb %dil, (%rsi,%rcx)
incq %rcx
cmpq $0x8, %rcx
jne 0x1b88b
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O1/RegulusImpact[P]sadboy/src/MMU.h
// Function: MMU::loadBootrom()
void loadBootrom() {
        uint16_t x = 0x0000;
        for(unsigned int i = 0; i < strlen(bootrom); i += 2) {
            uint8_t out = Utils::ParseCharsToHex(bootrom[i], bootrom[i + 1]);

            bios[x] = out;
            x++;
        }

        //loadDebugLogo();
    }

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq 0xe380(%rdi), %r14
cmpb $0x0, (%r14)
je 0x1bb2f
movq %rdi, %rbx
movl $0x2, %r15d
xorl %r13d, %r13d
xorl %r12d, %r12d
movb (%r14,%r13), %cl
movl $0x39, %eax
cmpb $0x3a, %cl
jge 0x1bae4
xorl %eax, %eax
leal -0x1(%r15), %edx
movb (%r14,%rdx), %sil
movl $0xc9, %edx
cmpb $0x3a, %sil
jge 0x1bafc
movl $0xd0, %edx
addb %cl, %al
addb %sil, %dl
shlb $0x4, %al
orb %dl, %al
movzwl %r12w, %ecx
movb %al, 0xe281(%rbx,%rcx)
incl %r12d
movl %r15d, %r13d
movq 0xe380(%rbx), %r14
movq %r14, %rdi
callq 0x4170
addl $0x2, %r15d
cmpq %r13, %rax
ja 0x1bad4
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O1/RegulusImpact[P]sadboy/src/Cartridge.cpp
// Function: Cartridge::Cartridge(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>)
Cartridge::Cartridge(std::string fileName) {
    std::FILE* file;
    file = fopen (fileName.c_str() , "rb");
    if (file==NULL) {fputs ("File error",stderr); exit (1);}

    // obtain file size:
    fseek (file , 0 , SEEK_END);
    fileSize = ftell (file);
    rewind (file);

    // allocate memory to contain the whole file:
    rom = new uint8_t[fileSize];
    if (rom == NULL) {fputs ("Memory error",stderr); exit (2);}

    // copy the file into the buffer:
    uint32_t result = fread (rom,1,fileSize,file);
    if (result != fileSize) {fputs ("Reading error",stderr); exit (3);}
    fclose (file);

    printf("File loaded: %s\n", fileName.c_str());

    fileLoaded = true;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %rsi, %r14
movq %rdi, %rbx
movq (%rsi), %rdi
leaq 0x4a4c(%rip), %rsi      # 0x205a7
callq 0x4440
testq %rax, %rax
je 0x1bbd7
movq %rax, %r15
movq %rax, %rdi
xorl %esi, %esi
movl $0x2, %edx
callq 0x43d0
movq %r15, %rdi
callq 0x4030
movl %eax, 0xc(%rbx)
movq %r15, %rdi
callq 0x4090
movl 0xc(%rbx), %r12d
movq %r12, %rdi
callq 0x4040
movq %rax, (%rbx)
movl $0x1, %esi
movq %rax, %rdi
movq %r12, %rdx
movq %r15, %rcx
callq 0x4510
cmpl %eax, 0xc(%rbx)
jne 0x1bbdc
movq %r15, %rdi
callq 0x4370
movq (%r14), %rsi
leaq 0x4a00(%rip), %rdi      # 0x205c3
xorl %eax, %eax
callq 0x4070
movb $0x1, 0x8(%rbx)
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
callq 0x47b5
callq 0x4793
nop
// File: /workspace/github_cpp_makefile_star2_O1/RegulusImpact[P]sadboy/src/InterruptService.cpp
// Function: InterruptService::DisableHalt()
void InterruptService::DisableHalt() {
    uint8_t ie = mmu->Read(IE);
    uint8_t flags = mmu->Read(IFLAGS);

    // if any interrupt enable bit and corresponding flags are set
    // regardless of the IME, disable HALT
    if (((ie & flags & vBlankBit)  > 0) ||
        ((ie & flags & lcdStatBit) > 0) ||
        ((ie & flags & timerBit)   > 0) ||
        ((ie & flags & serialBit)  > 0) ||
        ((ie & flags & joyPadBit)  > 0))
    {
        if (cpu->halt) {
            cpu->AddCycles(4);
        }

        cpu->halt = false;
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
movq %rdi, %rbx
movq (%rdi), %rdi
movl $0xffff, %esi           # imm = 0xFFFF
callq 0x1b710
movl %eax, %r14d
movq (%rbx), %rdi
movl $0xff0f, %esi           # imm = 0xFF0F
callq 0x1b710
andb %r14b, %al
testb $0x1f, %al
je 0x1bcaa
movq 0x8(%rbx), %rdi
cmpb $0x1, 0x1d(%rdi)
jne 0x1bca2
movl $0x4, %esi
callq 0x19b52
movq 0x8(%rbx), %rax
movb $0x0, 0x1d(%rax)
popq %rbx
popq %r14
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O1/RegulusImpact[P]sadboy/src/InterruptService.cpp
// Function: InterruptService::CheckInterrupts()
bool InterruptService::CheckInterrupts() {
    DisableHalt();
    if (cpu->GetIME() != 0x00) {
        uint8_t ie = mmu->Read(IE);
        uint8_t flags = mmu->Read(IFLAGS);

        // if bit0 (vBlankBit) is enable on IE and 0xFF0F
        if ((ie & flags & vBlankBit) > 0) {
            dispatch = vBlankBit;
            return true;
        }

        // if bit1 (lcdStatBit) is enable on IE and 0xFF0F
        if ((ie & flags & lcdStatBit) > 0) {
            dispatch = lcdStatBit;
            return true;
        }

        // if bit2 (timerBit) is enable on IE and 0xFF0F
        if ((ie & flags & timerBit) > 0) {
            dispatch = timerBit;
            return true;
        }

        // if bit3 (serialBit) is enable on IE and 0xFF0F
        if ((ie & flags & serialBit) > 0) {
            dispatch = serialBit;
            return true;
        }

        // if bit4 (joyPadBit) is enable on IE and 0xFF0F
        if ((ie & flags & joyPadBit) > 0) {
            dispatch = joyPadBit;
            return true;
        }
    }

    dispatch = 0xFF;
    return false;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
movq %rdi, %rbx
callq 0x1bc60
movq 0x8(%rbx), %rdi
callq 0x19b2a
testb %al, %al
je 0x1bd11
movq (%rbx), %rdi
movl $0xffff, %esi           # imm = 0xFFFF
callq 0x1b710
movl %eax, %r14d
movq (%rbx), %rdi
movl $0xff0f, %esi           # imm = 0xFF0F
callq 0x1b710
movl %eax, %ecx
andb %r14b, %cl
movb $0x1, %al
testb $0x1, %cl
jne 0x1bd17
movb $0x2, %dl
testb $0x2, %cl
jne 0x1bd19
movb $0x4, %dl
testb $0x4, %cl
jne 0x1bd19
movb $0x8, %dl
testb $0x8, %cl
jne 0x1bd19
movb $0x10, %dl
testb $0x10, %cl
jne 0x1bd19
movb $-0x1, %dl
xorl %eax, %eax
jmp 0x1bd19
movb $0x1, %dl
movb %dl, 0x10(%rbx)
popq %rbx
popq %r14
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O1/RegulusImpact[P]sadboy/src/InterruptService.cpp
// Function: InterruptService::Dispatch()
void InterruptService::Dispatch() {
    if ((cpu->GetIME() != 0x00)) {
        switch (dispatch) {
            case vBlankBit: {
                VBlankInterrupt();
            }
                break;
            case lcdStatBit: {
                LCDStatInterrupt();
            }
                break;
            case timerBit: {
                TimerInterrupt();
            }
                break;
            case serialBit: {
                SerialInterrupt();
            }
                break;
            case joyPadBit: {
                JoyPadInterrupt();
            }
                break;
            default:
                break;
        }
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq 0x8(%rdi), %rdi
callq 0x19b2a
testb %al, %al
je 0x1bd75
movzbl 0x10(%rbx), %ecx
leal -0x1(%rcx), %eax
cmpl $0x7, %eax
ja 0x1bd62
leaq 0x4889(%rip), %rcx      # 0x205d4
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %rbp
jmp 0x1bda6
cmpl $0x10, %ecx
jne 0x1bd75
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %rbp
jmp 0x1bf36
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %rbp
jmp 0x1be6e
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %rbp
jmp 0x1bed2
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %rbp
jmp 0x1be0a
// File: /workspace/github_cpp_makefile_star2_O1/RegulusImpact[P]sadboy/src/InterruptService.cpp
// Function: InterruptService::VBlankInterrupt()
void InterruptService::VBlankInterrupt() {
    uint8_t flags = mmu->Read(IFLAGS);
    flags &= ~vBlankBit;
    cpu->SetIME(0x00);
    cpu->PushSP(cpu->programCounter);
    cpu->AddCycles(20);
    cpu->programCounter = vBlankISR;
    mmu->Write(IFLAGS, flags);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
movq %rdi, %rbx
movq (%rdi), %rdi
movl $0xff0f, %esi           # imm = 0xFF0F
callq 0x1b710
movl %eax, %r14d
andb $-0x2, %r14b
movq 0x8(%rbx), %rdi
xorl %esi, %esi
callq 0x19b34
movq 0x8(%rbx), %rdi
movzwl 0x18(%rdi), %esi
callq 0x19ca4
movq 0x8(%rbx), %rdi
movl $0x14, %esi
callq 0x19b52
movq 0x8(%rbx), %rax
movw $0x40, 0x18(%rax)
movq (%rbx), %rdi
movzbl %r14b, %edx
movl $0xff0f, %esi           # imm = 0xFF0F
popq %rbx
popq %r14
popq %rbp
jmp 0x1b430
nop
// File: /workspace/github_cpp_makefile_star2_O1/RegulusImpact[P]sadboy/src/InterruptService.cpp
// Function: InterruptService::LCDStatInterrupt()
void InterruptService::LCDStatInterrupt() {
    uint8_t flags = mmu->Read(IFLAGS);
    flags &= ~lcdStatBit;
    cpu->SetIME(0x00);
    cpu->PushSP(cpu->programCounter);
    cpu->AddCycles(20);
    cpu->programCounter = lcdStatISR;
    mmu->Write(IFLAGS, flags);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
movq %rdi, %rbx
movq (%rdi), %rdi
movl $0xff0f, %esi           # imm = 0xFF0F
callq 0x1b710
movl %eax, %r14d
andb $-0x3, %r14b
movq 0x8(%rbx), %rdi
xorl %esi, %esi
callq 0x19b34
movq 0x8(%rbx), %rdi
movzwl 0x18(%rdi), %esi
callq 0x19ca4
movq 0x8(%rbx), %rdi
movl $0x14, %esi
callq 0x19b52
movq 0x8(%rbx), %rax
movw $0x48, 0x18(%rax)
movq (%rbx), %rdi
movzbl %r14b, %edx
movl $0xff0f, %esi           # imm = 0xFF0F
popq %rbx
popq %r14
popq %rbp
jmp 0x1b430
nop
// File: /workspace/github_cpp_makefile_star2_O1/RegulusImpact[P]sadboy/src/InterruptService.cpp
// Function: InterruptService::JoyPadInterrupt()
void InterruptService::JoyPadInterrupt() {
    uint8_t flags = mmu->Read(IFLAGS);
    flags &= ~joyPadBit;
    cpu->SetIME(0x00);
    cpu->PushSP(cpu->programCounter);
    cpu->AddCycles(20);
    cpu->programCounter = joyPadISR;
    mmu->Write(IFLAGS, flags);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
movq %rdi, %rbx
movq (%rdi), %rdi
movl $0xff0f, %esi           # imm = 0xFF0F
callq 0x1b710
movl %eax, %r14d
andb $-0x11, %r14b
movq 0x8(%rbx), %rdi
xorl %esi, %esi
callq 0x19b34
movq 0x8(%rbx), %rdi
movzwl 0x18(%rdi), %esi
callq 0x19ca4
movq 0x8(%rbx), %rdi
movl $0x14, %esi
callq 0x19b52
movq 0x8(%rbx), %rax
movw $0x60, 0x18(%rax)
movq (%rbx), %rdi
movzbl %r14b, %edx
movl $0xff0f, %esi           # imm = 0xFF0F
popq %rbx
popq %r14
popq %rbp
jmp 0x1b430
nopl (%rax)
// File: /workspace/github_cpp_makefile_star2_O1/RegulusImpact[P]sadboy/src/TimerService.cpp
// Function: TimerService::Increment()
void TimerService::Increment() {
    uint16_t cycles = cpu->GetCycles();

    // counter mess
    timaClock += cycles;
    CheckTima();

    // divider clock
    divClock += cycles;
    CheckDiv();
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
movq %rdi, %rbx
movq 0x18(%rdi), %rdi
callq 0x19b3e
movzbl %al, %r14d
addl %r14d, 0x10(%rbx)
movq %rbx, %rdi
callq 0x1c064
addl %r14d, 0xc(%rbx)
movq %rbx, %rdi
popq %rbx
popq %r14
popq %rbp
jmp 0x1c0da
nop
// File: /workspace/github_cpp_makefile_star2_O1/RegulusImpact[P]sadboy/src/TimerService.cpp
// Function: TimerService::CheckTima()
void TimerService::CheckTima() {
    uint8_t control = mmu->Read(controlAddr);
    uint32_t clockSpeed;

    if (control & runningBit) {
         // divide the operation speed of the cpu clock by the speed set in the control to get the "clockSpeed" variable value
        switch (control & speedBits) {
            case 0: // 4096hz
                clockSpeed = 1024;
                break;
            case 1: // 262144hz
                clockSpeed = 16;
                break;
            case 2: // 65536hz
                clockSpeed = 64;
                break;
            case 3: // 16384hz
                clockSpeed = 256;
                break;
        }

        bool trig = false;
        while (timaClock >= clockSpeed) {
            timaClock -= clockSpeed;
            StepTima();
            trig = true;
        }

        if (trig) {
            timaClock = 0;
        }
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq 0x20(%rdi), %rdi
movzwl 0x6(%rbx), %esi
callq 0x1b710
testb %al, 0x9(%rbx)
je 0x1c0ce
andb 0x8(%rbx), %al
decb %al
movl $0x400, %r14d           # imm = 0x400
cmpb $0x2, %al
ja 0x1c0a0
movzbl %al, %eax
leaq 0x4558(%rip), %rcx      # 0x205f4
movl (%rcx,%rax,4), %r14d
movl 0x10(%rbx), %r15d
cmpl %r14d, %r15d
jb 0x1c0ce
movl %r15d, %eax
subl %r14d, %eax
movl %eax, 0x10(%rbx)
movq %rbx, %rdi
callq 0x1c118
movl 0x10(%rbx), %eax
cmpl %r14d, %eax
jae 0x1c0ac
cmpl %r14d, %r15d
jb 0x1c0ce
movl $0x0, 0x10(%rbx)
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O1/RegulusImpact[P]sadboy/src/TimerService.cpp
// Function: TimerService::CheckDiv()
void TimerService::CheckDiv() {
    if (divClock >= 0xFF) {
        uint8_t div = mmu->Read(divAddr);
        div++;
        mmu->WriteTimers(divAddr, div);
        divClock %= 256; // we want to keep ALL OF THE CLOCKS
    }
}

// Assembly:
cmpl $0xff, 0xc(%rdi)
jb 0x1c116
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq 0x20(%rdi), %rdi
movzwl (%rbx), %esi
callq 0x1b710
incb %al
movq 0x20(%rbx), %rdi
movzwl (%rbx), %esi
movzbl %al, %edx
callq 0x1b938
movzbl 0xc(%rbx), %eax
movl %eax, 0xc(%rbx)
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O1/RegulusImpact[P]sadboy/src/TimerService.cpp
// Function: TimerService::StepTima()
void TimerService::StepTima() {
    uint16_t tima = mmu->Read(timaAddr);
    tima++;

    if (tima > 255) {
        tima = mmu->Read(moduloAddr);
        cpu->AddCycles(4);
        TimaInterrupt();
    }

    mmu->Write(timaAddr, (uint8_t)(tima & 0xFF));
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
movq %rdi, %rbx
movq 0x20(%rdi), %rdi
movzwl 0x2(%rbx), %esi
callq 0x1b710
movl %eax, %r14d
incb %r14b
jne 0x1c15d
movq 0x20(%rbx), %rdi
movzwl 0x4(%rbx), %esi
callq 0x1b710
movl %eax, %r14d
movq 0x18(%rbx), %rdi
movl $0x4, %esi
callq 0x19b52
movq %rbx, %rdi
callq 0x1c172
movq 0x20(%rbx), %rdi
movzwl 0x2(%rbx), %esi
movzbl %r14b, %edx
popq %rbx
popq %r14
popq %rbp
jmp 0x1b430