LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_cpp_makefile_star2_O1/williewillus[P]panda_scratchpad/src/results/FileSystemTestResult.cpp
// Function: operator<<(std::ostream&, FileSystemTestResult::ErrorType)
ostream& operator<<(ostream& os, FileSystemTestResult::ErrorType err) {
  switch (err) {
    case FileSystemTestResult::kCheckNotRun:
      os << "fsck_not_run";
      break;
    case FileSystemTestResult::kClean:
      os << "fsck_no_errors";
      break;
    case FileSystemTestResult::kUnmountable:
      os << "unmountable_file_system";
      break;
    case FileSystemTestResult::kCheck:
      os << "fsck_error";
      break;
    case FileSystemTestResult::kFixed:
      os << "file_system_fixed";
      break;
    case FileSystemTestResult::kSnapshotRestore:
      os << "restoring_snapshot";
      break;
    case FileSystemTestResult::kBioWrite:
      os << "writing_crash_state";
      break;
    case FileSystemTestResult::kOther:
      os << "other_error";
      break;
    case FileSystemTestResult::kKernelMount:
      os << "kernel_mount";
      break;
    case FileSystemTestResult::kCheckUnfixed:
      os << "unfixed_fsck_errors";
      break;
    default:
      os.setstate(std::ios_base::failbit);
  }
  return os;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
movq %rdi, %rbx
cmpl $0xf, %esi
jg 0x8ef6
cmpl $0x8, %esi
ja 0x8fb3
movl %esi, %eax
leaq 0xb86b(%rip), %rcx      # 0x1474c
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
leaq 0xb87f(%rip), %rsi      # 0x14770
jmp 0x8f9c
cmpl $0x3f, %esi
jle 0x8f25
cmpl $0x40, %esi
je 0x8f87
cmpl $0x80, %esi
je 0x8f95
cmpl $0x100, %esi            # imm = 0x100
jne 0x8fb3
leaq 0xb8d2(%rip), %rsi      # 0x147f5
jmp 0x8f3a
cmpl $0x10, %esi
je 0x8f79
cmpl $0x20, %esi
jne 0x8fb3
leaq 0xb89a(%rip), %rsi      # 0x147d4
movl $0x13, %edx
jmp 0x8fa1
leaq 0xb85c(%rip), %rsi      # 0x147a4
movl $0xa, %edx
jmp 0x8fa1
leaq 0xb827(%rip), %rsi      # 0x1477d
movl $0xe, %edx
jmp 0x8fa1
leaq 0xb84b(%rip), %rsi      # 0x147af
movl $0x11, %edx
jmp 0x8fa1
leaq 0xb81a(%rip), %rsi      # 0x1478c
movl $0x17, %edx
jmp 0x8fa1
leaq 0xb841(%rip), %rsi      # 0x147c1
movl $0x12, %edx
jmp 0x8fa1
leaq 0xb798(%rip), %rsi      # 0x14726
movl $0xb, %edx
jmp 0x8fa1
leaq 0xb84c(%rip), %rsi      # 0x147e8
movl $0xc, %edx
movq %rbx, %rdi
callq 0x54f0
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
movq (%rbx), %rax
movq -0x18(%rax), %rax
leaq (%rbx,%rax), %rdi
movl 0x20(%rbx,%rax), %esi
orl $0x4, %esi
callq 0x5770
jmp 0x8fa9
// File: /workspace/github_cpp_makefile_star2_O1/williewillus[P]panda_scratchpad/src/results/SingleTestInfo.cpp
// Function: SingleTestInfo::GetTestResult() const
SingleTestInfo::ResultType SingleTestInfo::GetTestResult() const {
  if ((fs_test.GetError() == FileSystemTestResult::kClean ||
        fs_test.GetError() == FileSystemTestResult::kCheckNotRun)
      && data_test.GetError() == DataTestResult::kClean) {
    return SingleTestInfo::kPassed;
  } else if (fs_test.GetError() == FileSystemTestResult::kFixed
      && data_test.GetError() == DataTestResult::kClean) {
    return SingleTestInfo::kFsckFixed;
  } else if (fs_test.GetError() == FileSystemTestResult::kKernelMount) {
    return SingleTestInfo::kFsckRequired;
  }
  return SingleTestInfo::kFailed;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
movq %rdi, %r14
leaq 0x30(%rdi), %rbx
movq %rbx, %rdi
callq 0x8e38
cmpl $0x1, %eax
je 0x905d
movq %rbx, %rdi
callq 0x8e38
testl %eax, %eax
jne 0x906a
leaq 0x8(%r14), %rdi
callq 0x8cd4
testl %eax, %eax
je 0x90a1
movq %rbx, %rdi
callq 0x8e38
cmpl $0x4, %eax
jne 0x9087
addq $0x8, %r14
movq %r14, %rdi
callq 0x8cd4
testl %eax, %eax
je 0x90a5
movq %rbx, %rdi
callq 0x8e38
movl %eax, %ecx
xorl %eax, %eax
cmpl $0x80, %ecx
sete %al
xorl $0x3, %eax
jmp 0x90aa
xorl %eax, %eax
jmp 0x90aa
movl $0x1, %eax
popq %rbx
popq %r14
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O1/williewillus[P]panda_scratchpad/src/results/SingleTestInfo.cpp
// Function: SingleTestInfo::PrintResults(std::ostream&) const
void SingleTestInfo::PrintResults(ostream& os) const {
  os << "Test #" << test_num << ": " << GetTestResult() << ": ";
  data_test.PrintErrors(os);
  if (GetTestResult() == SingleTestInfo::kFailed &&
      fs_test.GetError() == FileSystemTestResult::kCheck) {
    os << fs_test.error_description << endl;
  } else {
    os << data_test.error_description << endl;
  }
  os << "\tfsck result: ";
  fs_test.PrintErrors(os);
  os << endl;
  os << "\tfsck output:" << endl << fs_test.fsck_result << endl << endl;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %rsi, %r14
movq %rdi, %rbx
leaq 0xb754(%rip), %rsi      # 0x1481c
movl $0x6, %edx
movq %r14, %rdi
callq 0x54f0
movl (%rbx), %esi
movq %r14, %rdi
callq 0x52f0
movq %rax, %r15
leaq 0xc4f6(%rip), %r12      # 0x155df
movl $0x2, %edx
movq %rax, %rdi
movq %r12, %rsi
callq 0x54f0
movq %rbx, %rdi
callq 0x9036
movq %r15, %rdi
movl %eax, %esi
callq 0x927d
movl $0x2, %edx
movq %r15, %rdi
movq %r12, %rsi
callq 0x54f0
leaq 0x8(%rbx), %r15
movq %r15, %rdi
movq %r14, %rsi
callq 0x8cde
movq %rbx, %rdi
callq 0x9036
cmpl $0x3, %eax
jne 0x914d
leaq 0x30(%rbx), %r12
movq %r12, %rdi
callq 0x8e38
movl $0x38, %ecx
cmpl $0x8, %eax
je 0x9155
movl $0x10, %ecx
movq %r15, %r12
movq (%r12), %rsi
movq (%rbx,%rcx), %rdx
movq %r14, %rdi
callq 0x54f0
movq %rax, %r15
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r15, %rdi
movl $0xa, %esi
callq 0x5470
movsbl %al, %esi
movq %r15, %rdi
callq 0x5040
movq %rax, %rdi
callq 0x5300
leaq 0xb68d(%rip), %rsi      # 0x14823
movl $0xe, %edx
movq %r14, %rdi
callq 0x54f0
leaq 0x30(%rbx), %rdi
movq %r14, %rsi
callq 0x8e42
movq (%r14), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x5470
movsbl %al, %esi
movq %r14, %rdi
callq 0x5040
movq %rax, %rdi
callq 0x5300
leaq 0xb655(%rip), %rsi      # 0x14832
movl $0xd, %edx
movq %r14, %rdi
callq 0x54f0
movq (%r14), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x5470
movsbl %al, %esi
movq %r14, %rdi
callq 0x5040
movq %rax, %rdi
callq 0x5300
movq 0x50(%rbx), %rsi
movq 0x58(%rbx), %rdx
movq %rax, %rdi
callq 0x54f0
movq %rax, %rbx
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x5470
movsbl %al, %esi
movq %rbx, %rdi
callq 0x5040
movq %rax, %rdi
callq 0x5300
movq %rax, %rbx
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x5470
movsbl %al, %esi
movq %rbx, %rdi
callq 0x5040
movq %rax, %rdi
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
jmp 0x5300
// File: /workspace/github_cpp_makefile_star2_O1/williewillus[P]panda_scratchpad/src/results/SingleTestInfo.cpp
// Function: operator<<(std::ostream&, SingleTestInfo::ResultType)
ostream& operator<<(ostream& os, SingleTestInfo::ResultType rt) {
  switch (rt) {
    case SingleTestInfo::kPassed:
      os << "PASSED";
      break;
    case SingleTestInfo::kFsckFixed:
      os << "FSCK_FIXED";
      break;
    case SingleTestInfo::kFsckRequired:
      os << "FSCK_REQUIRED";
      break;
    case SingleTestInfo::kFailed:
      os << "FAILED";
      break;
    default:
      os.setstate(std::ios_base::failbit);
  }
  return os;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
movq %rdi, %rbx
cmpl $0x3, %esi
ja 0x92e0
movl %esi, %eax
leaq 0xb578(%rip), %rcx      # 0x1480c
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
leaq 0xb59c(%rip), %rsi      # 0x14840
jmp 0x92bb
leaq 0xb5a5(%rip), %rsi      # 0x14852
movl $0xd, %edx
jmp 0x92ce
leaq 0xb5a5(%rip), %rsi      # 0x14860
movl $0x6, %edx
jmp 0x92ce
leaq 0xb57e(%rip), %rsi      # 0x14847
movl $0xa, %edx
movq %rbx, %rdi
callq 0x54f0
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
movq (%rbx), %rax
movq -0x18(%rax), %rax
leaq (%rbx,%rax), %rdi
movl 0x20(%rbx,%rax), %esi
orl $0x4, %esi
callq 0x5770
jmp 0x92d6
nop
// File: /workspace/github_cpp_makefile_star2_O1/williewillus[P]panda_scratchpad/src/results/TestSuiteResult.cpp
// Function: TestSuiteResult::TallyResult(SingleTestInfo&, ResultSet&)
void TestSuiteResult::TallyResult(SingleTestInfo &done, ResultSet &set) {
  switch (done.GetTestResult()) {
    case SingleTestInfo::kPassed:
      ++set.num_passed;
      break;
    case SingleTestInfo::kFsckFixed:
      ++set.num_passed_fixed;
      break;
    case SingleTestInfo::kFsckRequired:
      ++set.fsck_required;
      break;
    case SingleTestInfo::kFailed:
      ++set.num_failed;

      switch (done.data_test.GetError()) {
        case DataTestResult::kOldFilePersisted:
          ++set.old_file_persisted;
          break;
        case DataTestResult::kFileMissing:
          ++set.file_missing;
          break;
        case DataTestResult::kFileDataCorrupted:
          ++set.file_data_corrupted;
          break;
        case DataTestResult::kFileMetadataCorrupted:
          ++set.file_metadata_corrupted;
          break;
        case DataTestResult::kIncorrectBlockCount:
          ++set.incorrect_block_count;
          break;    
        case DataTestResult::kOther:
          ++set.other;
          break;
        case DataTestResult::kAutoCheckFailed:
          ++set.auto_check_failed;
          break;
      }
      break;
  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
movq %rdx, %rbx
movq %rsi, %r14
movq %rsi, %rdi
callq 0x9036
cmpl $0x3, %eax
ja 0x93a3
movl %eax, %eax
leaq 0xb515(%rip), %rcx      # 0x14868
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movl $0x8, %eax
jmp 0x93a0
movl $0x10, %eax
jmp 0x93a0
incl (%rbx)
addq $0x8, %r14
movq %r14, %rdi
callq 0x8cd4
cmpl $0xf, %eax
jg 0x93a8
decl %eax
cmpl $0x7, %eax
ja 0x93a3
leaq 0xb4ed(%rip), %rcx      # 0x14878
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movl $0x14, %eax
jmp 0x93a0
movl $0x4, %eax
incl (%rbx,%rax)
popq %rbx
popq %r14
popq %rbp
retq
cmpl $0x10, %eax
je 0x93d3
cmpl $0x20, %eax
je 0x93da
cmpl $0x40, %eax
jne 0x93a3
movl $0x2c, %eax
jmp 0x93a0
movl $0x1c, %eax
jmp 0x93a0
movl $0x20, %eax
jmp 0x93a0
movl $0x18, %eax
jmp 0x93a0
movl $0x24, %eax
jmp 0x93a0
movl $0x28, %eax
jmp 0x93a0
nop
// File: /workspace/github_cpp_makefile_star2_O1/williewillus[P]panda_scratchpad/src/wrapper/DiskMod.cpp
// Function: wrapper::DiskMod::SerializeHeader(char*, unsigned int, wrapper::DiskMod&)
int DiskMod::SerializeHeader(char *buf, const unsigned int buf_offset,
    DiskMod &dm) {
  buf = buf + buf_offset;
  uint16_t mod_type = htobe16((uint16_t) dm.mod_type);
  uint16_t mod_opts = htobe16((uint16_t) dm.mod_opts);
  memcpy(buf, &mod_type, sizeof(uint16_t));
  buf += sizeof(uint16_t);
  memcpy(buf, &mod_opts, sizeof(uint16_t));

  return 2 * sizeof(uint16_t);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movzwl 0x20(%rdx), %eax
movzwl 0x24(%rdx), %ecx
rolw $0x8, %ax
rolw $0x8, %cx
movl %esi, %edx
movw %ax, (%rdi,%rdx)
movw %cx, 0x2(%rdi,%rdx)
movl $0x4, %eax
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O1/williewillus[P]panda_scratchpad/src/wrapper/DiskMod.cpp
// Function: wrapper::DiskMod::SerializeChangeHeader(char*, unsigned int, wrapper::DiskMod&)
int DiskMod::SerializeChangeHeader(char *buf,
    const unsigned int buf_offset, DiskMod &dm) {
  buf += buf_offset;
  unsigned int size = dm.path.size() + 1;
  // Add the path that was changed to the buffer.
  // size() doesn't include null-terminator.
  // TODO(ashmrtn): The below assumes 1 character per byte encoding.
  memcpy(buf, dm.path.c_str(), size);
  buf += size;

  // Add directory_mod to buffer.
  uint8_t mod_directory_mod = dm.directory_mod;
  memcpy(buf, &mod_directory_mod, sizeof(uint8_t));

  return size + sizeof(uint8_t);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %rdx, %rbx
movq %rdi, %r14
movl %esi, %eax
addq %rax, %r14
movl 0x8(%rdx), %r15d
leal 0x1(%r15), %r12d
movq (%rdx), %rsi
movq %r14, %rdi
movq %r12, %rdx
callq 0x53b0
movb 0xb8(%rbx), %al
movb %al, (%r12,%r14)
addl $0x2, %r15d
movl %r15d, %eax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O1/williewillus[P]panda_scratchpad/src/wrapper/DiskMod.cpp
// Function: wrapper::DiskMod::SerializeDataRange(char*, unsigned int, wrapper::DiskMod&)
int DiskMod::SerializeDataRange(char *buf, const unsigned int buf_offset,
    DiskMod &dm) {
  buf += buf_offset;
  // Add file_mod_location.
  uint64_t file_mod_location = htobe64(dm.file_mod_location);
  memcpy(buf, &file_mod_location, sizeof(uint64_t));
  buf += sizeof(uint64_t);

  // Add file_mod_len.
  uint64_t file_mod_len = htobe64(dm.file_mod_len);
  memcpy(buf, &file_mod_len, sizeof(uint64_t));
  buf += sizeof(uint64_t);

  if (dm.mod_type == DiskMod::kSyncFileRangeMod ||
      dm.mod_opts == DiskMod::kFallocateOpt ||
      dm.mod_opts == DiskMod::kFallocateKeepSizeOpt ||
      dm.mod_opts == DiskMod::kPunchHoleKeepSizeOpt ||
      dm.mod_opts == DiskMod::kCollapseRangeOpt ||
      dm.mod_opts == DiskMod::kZeroRangeOpt ||
      dm.mod_opts == DiskMod::kZeroRangeKeepSizeOpt ||
      dm.mod_opts == DiskMod::kInsertRangeOpt) {
    // kSyncFileRangeMod does not contain the data range, just the offset and
    // length.
    return 2 * sizeof(uint64_t);
  }

  // Add file_mod_data (non-null terminated).
  memcpy(buf, dm.file_mod_data.get(), dm.file_mod_len);

  return (2 * sizeof(uint64_t)) + dm.file_mod_len;
}

// Assembly:
movl %esi, %ecx
movq 0xd0(%rdx), %rax
bswapq %rax
movq %rax, (%rdi,%rcx)
movq 0xd8(%rdx), %rax
bswapq %rax
movq %rax, 0x8(%rdi,%rcx)
movl $0x10, %eax
cmpl $0x9, 0x20(%rdx)
je 0x9b99
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
movq %rdx, %rbx
movl 0x24(%rdx), %edx
addl $-0x2, %edx
cmpl $0x7, %edx
jb 0x9b93
addq %rcx, %rdi
addq $0x10, %rdi
movq 0xc0(%rbx), %rsi
movq 0xd8(%rbx), %rdx
callq 0x53b0
movl 0xd8(%rbx), %eax
addl $0x10, %eax
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O1/williewillus[P]panda_scratchpad/src/wrapper/DiskMod.cpp
// Function: wrapper::DiskMod::Reset()
void DiskMod::Reset() {
  path.clear();
  mod_type = kCreateMod;
  mod_opts = kNoneOpt;
  memset(&post_mod_stats, 0, sizeof(struct stat));
  directory_mod = false;
  file_mod_data.reset();
  file_mod_location = 0;
  file_mod_len = 0;
  directory_added_entry.clear();
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
movq %rdi, %rbx
xorl %r14d, %r14d
movq %r14, 0x8(%rdi)
movq (%rdi), %rax
movb $0x0, (%rax)
addq $0x20, %rdi
movq %r14, 0xc0(%rbx)
movl $0x99, %edx
xorl %esi, %esi
callq 0x5290
movq 0xc8(%rbx), %rdi
movq %r14, 0xc8(%rbx)
testq %rdi, %rdi
je 0x9df4
callq 0x8af0
movq $0x0, 0xe8(%rbx)
xorps %xmm0, %xmm0
movups %xmm0, 0xd0(%rbx)
movq 0xe0(%rbx), %rax
movb $0x0, (%rax)
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O1/williewillus[P]panda_scratchpad/src/wrapper/wrapper.cpp
// Function: wrapper::DefaultFsFns::FnPathExists(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&)
bool DefaultFsFns::FnPathExists(const std::string &pathname) {
  const int res = access(pathname.c_str(), F_OK);
  // TODO(ashmrtn): Should probably have some better way to handle errors.
  if (res != 0) {
    return false;
  }

  return true;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movq (%rsi), %rdi
xorl %esi, %esi
callq 0x5750
testl %eax, %eax
sete %al
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O1/williewillus[P]panda_scratchpad/src/wrapper/wrapper.cpp
// Function: wrapper::RecordCmFsOps::CmMkdir(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&, unsigned int)
int RecordCmFsOps::CmMkdir(const string &pathname, const mode_t mode) {
  const int res = fns_->FnMkdir(pathname.c_str(), mode);
  if (res < 0) {
    return res;
  }

  DiskMod mod;
  mod.directory_mod = true;
  mod.path = pathname;
  mod.mod_type = DiskMod::kCreateMod;
  mod.mod_opts = DiskMod::kNoneOpt;

  mods_.push_back(mod);

  return res;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x108, %rsp            # imm = 0x108
movl %edx, %ebx
movq %rsi, %r15
movq %rdi, %r14
movq 0x90(%rdi), %r12
movq (%rsi), %rsi
leaq -0x130(%rbp), %rdi
leaq -0x29(%rbp), %rdx
callq 0x51c0
movq (%r12), %rax
leaq -0x130(%rbp), %rsi
movq %r12, %rdi
movl %ebx, %edx
callq *0x18(%rax)
movl %eax, %ebx
leaq -0x120(%rbp), %r13
movq -0x10(%r13), %rdi
cmpq %r13, %rdi
je 0xa214
callq 0x5460
testl %ebx, %ebx
js 0xa287
leaq -0x130(%rbp), %r12
movq %r12, %rdi
callq 0x9e18
movb $0x1, 0xb8(%r12)
movq %r12, %rdi
movq %r15, %rsi
callq 0x5280
leaq -0x130(%rbp), %rsi
movq $0x0, 0x20(%rsi)
addq $0x78, %r14
movq %r14, %rdi
callq 0xbfa2
leaq -0x40(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0xa268
callq 0x5460
movq -0x68(%rbp), %rdi
testq %rdi, %rdi
je 0xa276
callq 0x8af0
movq -0x130(%rbp), %rdi
cmpq %r13, %rdi
je 0xa287
callq 0x5460
movl %ebx, %eax
addq $0x108, %rsp            # imm = 0x108
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
leaq -0x120(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0xa2c9
callq 0x5460
jmp 0xa2c9
movq %rax, %rbx
jmp 0xa2c9
movq %rax, %rbx
leaq -0x130(%rbp), %rdi
callq 0xbfde
movq %rbx, %rdi
callq 0x57c0
nop
// File: /workspace/github_cpp_makefile_star2_O1/williewillus[P]panda_scratchpad/src/wrapper/wrapper.cpp
// Function: wrapper::RecordCmFsOps::CmOpenCommon(int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&, bool, int)
void RecordCmFsOps::CmOpenCommon(const int fd, const string &pathname,
    const bool exists, const int flags) {
  fd_map_.insert({fd, pathname});

  if (!exists || (flags & O_TRUNC)) {
    // We only want to record this op if we changed something on the file
    // system.

    DiskMod mod;

    // Need something like stat() because umask could affect the file
    // permissions.
    const int post_stat_res = fns_->FnStat(pathname.c_str(),
        &mod.post_mod_stats);
    if (post_stat_res < 0) {
      // TODO(ashmrtn): Some sort of warning here?
      return;
    }

    mod.directory_mod = S_ISDIR(mod.post_mod_stats.st_mode);

    if (!exists) {
      mod.mod_type = DiskMod::kCreateMod;
      mod.mod_opts = DiskMod::kNoneOpt;
    } else {
      mod.mod_type = DiskMod::kDataMetadataMod;
      mod.mod_opts = DiskMod::kTruncateOpt;
    }

    mod.path = pathname;

    mods_.push_back(mod);
  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x138, %rsp            # imm = 0x138
movl %r8d, %r12d
movl %ecx, %ebx
movq %rdx, %r14
movq %rdi, -0x38(%rbp)
leaq 0x8(%rdi), %r13
leaq -0x150(%rbp), %rdi
movl %esi, -0x8(%rdi)
leaq -0x140(%rbp), %r15
movq %r15, -0x10(%r15)
movq (%rdx), %rsi
movq 0x8(%rdx), %rdx
addq %rsi, %rdx
callq 0x8052
leaq -0x158(%rbp), %rsi
movq %r13, %rdi
callq 0xc46a
movq -0x150(%rbp), %rdi
cmpq %r15, %rdi
je 0xa33a
callq 0x5460
btl $0x9, %r12d
setae %al
testb %bl, %al
jne 0xa41b
leaq -0x158(%rbp), %rdi
callq 0x9e18
movq -0x38(%rbp), %rax
movq 0x90(%rax), %r12
movq (%r14), %rsi
leaq -0x58(%rbp), %rdi
leaq -0x29(%rbp), %rdx
callq 0x51c0
leaq -0x130(%rbp), %rdx
movq (%r12), %rax
leaq -0x58(%rbp), %rsi
movq %r12, %rdi
callq *0x88(%rax)
movl %eax, %r12d
leaq -0x48(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0xa39e
callq 0x5460
testl %r12d, %r12d
js 0xa3e3
movl $0xf000, %eax           # imm = 0xF000
leaq -0x158(%rbp), %rdi
andl 0x40(%rdi), %eax
cmpl $0x4000, %eax           # imm = 0x4000
sete 0xb8(%rdi)
movzbl %bl, %eax
movl %eax, 0x20(%rdi)
movl %eax, 0x24(%rdi)
movq %r14, %rsi
callq 0x5280
movq -0x38(%rbp), %rdi
addq $0x78, %rdi
leaq -0x158(%rbp), %rsi
callq 0xbfa2
leaq -0x68(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0xa3f5
callq 0x5460
movq -0x90(%rbp), %rdi
testq %rdi, %rdi
je 0xa406
callq 0x8af0
leaq -0x148(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0xa41b
callq 0x5460
addq $0x138, %rsp            # imm = 0x138
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
leaq -0x48(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0xa449
callq 0x5460
jmp 0xa449
jmp 0xa446
movq %rax, %rbx
leaq -0x158(%rbp), %rdi
callq 0xbfde
jmp 0xa46b
movq %rax, %rbx
movq -0x150(%rbp), %rdi
cmpq %r15, %rdi
je 0xa46b
callq 0x5460
movq %rbx, %rdi
callq 0x57c0
nop
// File: /workspace/github_cpp_makefile_star2_O1/williewillus[P]panda_scratchpad/src/wrapper/wrapper.cpp
// Function: wrapper::RecordCmFsOps::CmOpen(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&, int)
int RecordCmFsOps::CmOpen(const string &pathname, const int flags) {
  // Will this make a new file or is this path a directory?
  const bool exists = fns_->FnPathExists(pathname.c_str());

  const int res = fns_->FnOpen(pathname.c_str(), flags);
  if (res < 0) {
    return res;
  }

  CmOpenCommon(res, pathname, exists, flags);

  return res;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movl %edx, %ebx
movq %rsi, %r14
movq %rdi, %r15
movq 0x90(%rdi), %r12
movq (%rsi), %rsi
leaq -0x50(%rbp), %rdi
leaq -0x2a(%rbp), %rdx
callq 0x51c0
movq (%r12), %rax
leaq -0x50(%rbp), %rsi
movq %r12, %rdi
callq *0x90(%rax)
movb %al, -0x29(%rbp)
leaq -0x40(%rbp), %r12
movq -0x10(%r12), %rdi
cmpq %r12, %rdi
je 0xa4cb
callq 0x5460
movq 0x90(%r15), %r13
movq (%r14), %rsi
leaq -0x50(%rbp), %rdi
leaq -0x2a(%rbp), %rdx
callq 0x51c0
movq (%r13), %rax
leaq -0x50(%rbp), %rsi
movq %r13, %rdi
movl %ebx, %edx
callq *0x20(%rax)
movl %eax, %r13d
movq -0x50(%rbp), %rdi
cmpq %r12, %rdi
je 0xa503
callq 0x5460
testl %r13d, %r13d
js 0xa51d
movzbl -0x29(%rbp), %ecx
movq %r15, %rdi
movl %r13d, %esi
movq %r14, %rdx
movl %ebx, %r8d
callq 0xa2d2
movl %r13d, %eax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
movq -0x50(%rbp), %rdi
cmpq %r12, %rdi
jne 0xa54f
jmp 0xa559
jmp 0xa556
movq %rax, %rbx
leaq -0x40(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0xa559
callq 0x5460
jmp 0xa559
movq %rax, %rbx
movq %rbx, %rdi
callq 0x57c0
nop
// File: /workspace/github_cpp_makefile_star2_O1/williewillus[P]panda_scratchpad/src/wrapper/wrapper.cpp
// Function: wrapper::RecordCmFsOps::CmOpen(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&, int, unsigned int)
int RecordCmFsOps::CmOpen(const string &pathname, const int flags,
    const mode_t mode) {
  // Will this make a new file or is this path a directory?
  const bool exists = fns_->FnPathExists(pathname.c_str());

  const int res = fns_->FnOpen2(pathname.c_str(), flags, mode);
  if (res < 0) {
    return res;
  }

  CmOpenCommon(res, pathname, exists, flags);

  return res;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movl %ecx, %r12d
movl %edx, -0x30(%rbp)
movq %rsi, %r14
movq %rdi, %r15
movq 0x90(%rdi), %r13
movq (%rsi), %rsi
leaq -0x50(%rbp), %rdi
leaq -0x2a(%rbp), %rdx
callq 0x51c0
movq (%r13), %rax
leaq -0x50(%rbp), %rsi
movq %r13, %rdi
callq *0x90(%rax)
movb %al, -0x29(%rbp)
leaq -0x40(%rbp), %rbx
movq -0x10(%rbx), %rdi
cmpq %rbx, %rdi
je 0xa5bc
callq 0x5460
movq 0x90(%r15), %r13
movq (%r14), %rsi
leaq -0x50(%rbp), %rdi
leaq -0x2a(%rbp), %rdx
callq 0x51c0
movq (%r13), %rax
leaq -0x50(%rbp), %rsi
movq %r13, %rdi
movl -0x30(%rbp), %r13d
movl %r13d, %edx
movl %r12d, %ecx
callq *0x28(%rax)
movl %eax, %r12d
movq -0x50(%rbp), %rdi
cmpq %rbx, %rdi
je 0xa5fc
callq 0x5460
testl %r12d, %r12d
js 0xa616
movzbl -0x29(%rbp), %ecx
movq %r15, %rdi
movl %r12d, %esi
movq %r14, %rdx
movl %r13d, %r8d
callq 0xa2d2
movl %r12d, %eax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %r14
movq -0x50(%rbp), %rdi
cmpq %rbx, %rdi
jne 0xa648
jmp 0xa652
jmp 0xa64f
movq %rax, %r14
leaq -0x40(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0xa652
callq 0x5460
jmp 0xa652
movq %rax, %r14
movq %r14, %rdi
callq 0x57c0
// File: /workspace/github_cpp_makefile_star2_O1/williewillus[P]panda_scratchpad/src/wrapper/wrapper.cpp
// Function: wrapper::RecordCmFsOps::CmMmap(void*, unsigned long, int, int, int, long)
void * RecordCmFsOps::CmMmap(void *addr, const size_t length, const int prot,
    const int flags, const int fd, const off_t offset) {
  void *res = fns_->FnMmap(addr, length, prot, flags, fd, offset);
  if (res == (void*) -1) {
    return res;
  }

  if (!(prot & PROT_WRITE) || flags & MAP_PRIVATE || flags & MAP_ANON ||
      flags & MAP_ANONYMOUS) {
    // In these cases, the user cannot write to the mmap-ed region, the region
    // is not backed by a file, or the changes the user makes are not reflected
    // in the file, so we can just act like this never happened.
    return res;
  }

  // All other cases we actually need to keep track of the fact that we mmap-ed
  // this region.
  mmap_map_.insert({(long long) res,
      tuple<string, unsigned int, unsigned int>(
          fd_map_.at(fd), offset, length)});
  return res;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x78, %rsp
movl %r8d, %r14d
movl %ecx, %r13d
movq %rdx, %r15
movq %rdi, %r12
movq 0x10(%rbp), %rcx
movl %r9d, -0x2c(%rbp)
movq 0x90(%rdi), %rdi
movq (%rdi), %rax
movq %rcx, (%rsp)
movl %r13d, %ecx
callq *0x48(%rax)
movq %rax, %rbx
cmpq $-0x1, %rax
je 0xac14
testb $0x2, %r13b
sete %al
testb $0x22, %r14b
setne %cl
orb %al, %cl
jne 0xac14
leaq 0x40(%r12), %r14
addq $0x8, %r12
leaq -0x2c(%rbp), %rsi
movq %r12, %rdi
callq 0xc802
leaq -0x50(%rbp), %rdi
movl %r15d, -0x8(%rdi)
movq 0x10(%rbp), %rcx
movl %ecx, -0x4(%rdi)
leaq -0x40(%rbp), %r15
movq %r15, -0x10(%r15)
movq (%rax), %rsi
movq 0x8(%rax), %rdx
addq %rsi, %rdx
callq 0x8052
leaq -0x68(%rbp), %r12
movq %rbx, -0x28(%r12)
movl -0x18(%r15), %eax
movl -0x14(%r15), %ecx
movq %rax, -0x20(%r12)
movq %rcx, -0x18(%r12)
movq %r12, -0x10(%r12)
movq -0x10(%r15), %rax
cmpq %r15, %rax
je 0xabc8
movq %rax, -0x78(%rbp)
movq -0x40(%rbp), %rax
movq %rax, -0x68(%rbp)
jmp 0xabd1
movups (%r15), %xmm0
movups %xmm0, (%r12)
movq -0x48(%rbp), %rax
leaq -0x90(%rbp), %rsi
movq %rax, 0x20(%rsi)
movq %r15, -0x50(%rbp)
movq $0x0, -0x48(%rbp)
movb $0x0, -0x40(%rbp)
movq %r14, %rdi
callq 0xc84e
movq -0x78(%rbp), %rdi
cmpq %r12, %rdi
je 0xac06
callq 0x5460
movq -0x50(%rbp), %rdi
cmpq %r15, %rdi
je 0xac14
callq 0x5460
movq %rbx, %rax
addq $0x78, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
movq -0x78(%rbp), %rdi
cmpq %r12, %rdi
je 0xac37
callq 0x5460
movq -0x50(%rbp), %rdi
cmpq %r15, %rdi
je 0xac45
callq 0x5460
movq %rbx, %rdi
callq 0x57c0
nop
// File: /workspace/github_cpp_makefile_star2_O1/williewillus[P]panda_scratchpad/src/wrapper/wrapper.cpp
// Function: wrapper::RecordCmFsOps::CmMunmap(void*, unsigned long)
int RecordCmFsOps::CmMunmap(void *addr, const size_t length) {
  const int res = fns_->FnMunmap(addr, length);
  if (res < 0) {
    return res;
  }

  // TODO(ashmrtn): Assume that we always munmap with the same pointer and
  // length that we mmap-ed with. May not actually remove anything if the
  // mapping was not something that caused writes to be reflected in the
  // underlying file (i.e. the key wasn't present to begin with).
  mmap_map_.erase((long long int) addr);

  return res;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %r14
movq %rdi, %rbx
movq 0x90(%rdi), %rdi
movq (%rdi), %rax
callq *0x58(%rax)
movl %eax, %r15d
testl %eax, %eax
js 0xaeab
addq $0x40, %rbx
leaq -0x20(%rbp), %rsi
movq %r14, (%rsi)
movq %rbx, %rdi
callq 0xcbde
movl %r15d, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O1/williewillus[P]panda_scratchpad/src/wrapper/wrapper.cpp
// Function: wrapper::RecordCmFsOps::CmClose(int)
int RecordCmFsOps::CmClose(const int fd) {
  const int res = fns_->FnClose(fd);

  if (res < 0) {
    return res;
  }

  fd_map_.erase(fd);

  return res;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
subq $0x10, %rsp
movq %rdi, %rbx
movl %esi, -0x14(%rbp)
movq 0x90(%rdi), %rdi
movq (%rdi), %rax
callq *0x68(%rax)
movl %eax, %r14d
testl %eax, %eax
js 0xb1b9
addq $0x8, %rbx
leaq -0x14(%rbp), %rsi
movq %rbx, %rdi
callq 0xcdbe
movl %r14d, %eax
addq $0x10, %rsp
popq %rbx
popq %r14
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O1/williewillus[P]panda_scratchpad/src/wrapper/wrapper.cpp
// Function: wrapper::RecordCmFsOps::CmRename(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&)
int RecordCmFsOps::CmRename(const string &old_path, const string &new_path) {
  // check if there are any open files with the old path
  // change the file descriptors to point to the new path
  for (auto it = fd_map_.begin(); it != fd_map_.end(); it++) {
    string& open_fd_old_path = it->second;
    if (open_fd_old_path.compare(old_path) == 0) {
      fd_map_[it->first] = new_path;
      continue;
    }
    // if we are renaming a directory that is open; we want to
    // change the mapping of the open files in that directory
    auto found = open_fd_old_path.find(old_path);
    if ( found != std::string::npos) {
      fd_map_[it->first].replace(found, old_path.length(), new_path);
    }
  }
  return fns_->FnRename(old_path, new_path);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rdx, %rbx
movq %rsi, %r14
movq %rdi, -0x30(%rbp)
movq 0x18(%rdi), %r12
testq %r12, %r12
je 0xb271
movq -0x30(%rbp), %rax
addq $0x8, %rax
movq %rax, -0x38(%rbp)
leaq 0x8(%r12), %r13
leaq 0x10(%r12), %r15
movq %r15, %rdi
movq %r14, %rsi
callq 0x5050
testl %eax, %eax
je 0xb251
movq (%r14), %rsi
movq 0x8(%r14), %rcx
movq %r15, %rdi
xorl %edx, %edx
callq 0x57b0
cmpq $-0x1, %rax
je 0xb268
movq %rax, %r15
movq -0x38(%rbp), %rdi
movq %r13, %rsi
callq 0xccf0
movq 0x8(%r14), %rdx
movq (%rbx), %rcx
movq 0x8(%rbx), %r8
movq %rax, %rdi
movq %r15, %rsi
callq 0x54e0
jmp 0xb268
movq -0x38(%rbp), %rdi
movq %r13, %rsi
callq 0xccf0
movq %rax, %rdi
movq %rbx, %rsi
callq 0x5280
movq (%r12), %r12
testq %r12, %r12
jne 0xb1fa
movq -0x30(%rbp), %rax
movq 0x90(%rax), %rdi
movq (%rdi), %rax
movq 0x70(%rax), %rax
movq %r14, %rsi
movq %rbx, %rdx
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmpq *%rax
nop
// File: /workspace/github_cpp_makefile_star2_O1/williewillus[P]panda_scratchpad/src/wrapper/wrapper.cpp
// Function: wrapper::RecordCmFsOps::CmUnlink(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&)
int RecordCmFsOps::CmUnlink(const string &pathname) {
  const int res = fns_->FnUnlink(pathname.c_str());
  if (res < 0) {
    return res;
  }

  DiskMod mod;
  mod.mod_type = DiskMod::kRemoveMod;
  mod.mod_opts = DiskMod::kNoneOpt;
  mod.path = pathname;
  mods_.push_back(mod);

  return res;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x108, %rsp            # imm = 0x108
movq %rsi, %r15
movq %rdi, %r14
movq 0x90(%rdi), %rbx
movq (%rsi), %rsi
leaq -0x130(%rbp), %rdi
leaq -0x29(%rbp), %rdx
callq 0x51c0
movq (%rbx), %rax
leaq -0x130(%rbp), %rsi
movq %rbx, %rdi
callq *0x78(%rax)
movl %eax, %ebx
leaq -0x120(%rbp), %r13
movq -0x10(%r13), %rdi
cmpq %r13, %rdi
je 0xb2f5
callq 0x5460
testl %ebx, %ebx
js 0xb360
leaq -0x130(%rbp), %r12
movq %r12, %rdi
callq 0x9e18
movq $0x5, 0x20(%r12)
movq %r12, %rdi
movq %r15, %rsi
callq 0x5280
addq $0x78, %r14
leaq -0x130(%rbp), %rsi
movq %r14, %rdi
callq 0xbfa2
leaq -0x40(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0xb341
callq 0x5460
movq -0x68(%rbp), %rdi
testq %rdi, %rdi
je 0xb34f
callq 0x8af0
movq -0x130(%rbp), %rdi
cmpq %r13, %rdi
je 0xb360
callq 0x5460
movl %ebx, %eax
addq $0x108, %rsp            # imm = 0x108
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
leaq -0x120(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0xb3a2
callq 0x5460
jmp 0xb3a2
movq %rax, %rbx
jmp 0xb3a2
movq %rax, %rbx
leaq -0x130(%rbp), %rdi
callq 0xbfde
movq %rbx, %rdi
callq 0x57c0
// File: /workspace/github_cpp_makefile_star2_O1/williewillus[P]panda_scratchpad/src/wrapper/wrapper.cpp
// Function: wrapper::RecordCmFsOps::CmRemove(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&)
int RecordCmFsOps::CmRemove(const string &pathname) {
  const int res = fns_->FnRemove(pathname.c_str());
  if (res < 0) {
    return res;
  }

  DiskMod mod;
  mod.mod_type = DiskMod::kRemoveMod;
  mod.mod_opts = DiskMod::kNoneOpt;
  mod.path = pathname;
  mods_.push_back(mod);

  return res;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x108, %rsp            # imm = 0x108
movq %rsi, %r15
movq %rdi, %r14
movq 0x90(%rdi), %rbx
movq (%rsi), %rsi
leaq -0x130(%rbp), %rdi
leaq -0x29(%rbp), %rdx
callq 0x51c0
movq (%rbx), %rax
leaq -0x130(%rbp), %rsi
movq %rbx, %rdi
callq *0x80(%rax)
movl %eax, %ebx
leaq -0x120(%rbp), %r13
movq -0x10(%r13), %rdi
cmpq %r13, %rdi
je 0xb408
callq 0x5460
testl %ebx, %ebx
js 0xb473
leaq -0x130(%rbp), %r12
movq %r12, %rdi
callq 0x9e18
movq $0x5, 0x20(%r12)
movq %r12, %rdi
movq %r15, %rsi
callq 0x5280
addq $0x78, %r14
leaq -0x130(%rbp), %rsi
movq %r14, %rdi
callq 0xbfa2
leaq -0x40(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0xb454
callq 0x5460
movq -0x68(%rbp), %rdi
testq %rdi, %rdi
je 0xb462
callq 0x8af0
movq -0x130(%rbp), %rdi
cmpq %r13, %rdi
je 0xb473
callq 0x5460
movl %ebx, %eax
addq $0x108, %rsp            # imm = 0x108
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
leaq -0x120(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0xb4b5
callq 0x5460
jmp 0xb4b5
movq %rax, %rbx
jmp 0xb4b5
movq %rax, %rbx
leaq -0x130(%rbp), %rdi
callq 0xbfde
movq %rbx, %rdi
callq 0x57c0
nop
// File: /workspace/github_cpp_makefile_star2_O1/williewillus[P]panda_scratchpad/src/wrapper/wrapper.cpp
// Function: wrapper::RecordCmFsOps::CmFsync(int)
int RecordCmFsOps::CmFsync(const int fd) {
  const int res = fns_->FnFsync(fd);
  if (res < 0) {
    return res;
  }

  DiskMod mod;
  mod.mod_type = DiskMod::kFsyncMod;
  mod.mod_opts = DiskMod::kNoneOpt;
  mod.path = fd_map_.at(fd);
  mods_.push_back(mod);

  return res;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x108, %rsp            # imm = 0x108
movq %rdi, %r14
movl %esi, -0x1c(%rbp)
movq 0x90(%rdi), %rdi
movq (%rdi), %rax
callq *0x98(%rax)
movl %eax, %ebx
testl %eax, %eax
js 0xb565
leaq -0x120(%rbp), %r15
movq %r15, %rdi
callq 0x9e18
movq $0x7, 0x20(%r15)
leaq 0x8(%r14), %rdi
leaq -0x1c(%rbp), %rsi
callq 0xc802
leaq -0x120(%rbp), %rdi
movq %rax, %rsi
callq 0x5280
addq $0x78, %r14
leaq -0x120(%rbp), %rsi
movq %r14, %rdi
callq 0xbfa2
leaq -0x30(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0xb542
callq 0x5460
movq -0x58(%rbp), %rdi
testq %rdi, %rdi
je 0xb550
callq 0x8af0
leaq -0x110(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0xb565
callq 0x5460
movl %ebx, %eax
addq $0x108, %rsp            # imm = 0x108
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
leaq -0x120(%rbp), %rdi
callq 0xbfde
movq %rbx, %rdi
callq 0x57c0
// File: /workspace/github_cpp_makefile_star2_O1/williewillus[P]panda_scratchpad/src/wrapper/wrapper.cpp
// Function: wrapper::RecordCmFsOps::CmFdatasync(int)
int RecordCmFsOps::CmFdatasync(const int fd) {
  const int res = fns_->FnFdatasync(fd);
  if (res < 0) {
    return res;
  }

  DiskMod mod;
  mod.mod_type = DiskMod::kFsyncMod;
  mod.mod_opts = DiskMod::kNoneOpt;
  mod.path = fd_map_.at(fd);
  mods_.push_back(mod);

  return res;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x108, %rsp            # imm = 0x108
movq %rdi, %r14
movl %esi, -0x1c(%rbp)
movq 0x90(%rdi), %rdi
movq (%rdi), %rax
callq *0xa0(%rax)
movl %eax, %ebx
testl %eax, %eax
js 0xb633
leaq -0x120(%rbp), %r15
movq %r15, %rdi
callq 0x9e18
movq $0x7, 0x20(%r15)
leaq 0x8(%r14), %rdi
leaq -0x1c(%rbp), %rsi
callq 0xc802
leaq -0x120(%rbp), %rdi
movq %rax, %rsi
callq 0x5280
addq $0x78, %r14
leaq -0x120(%rbp), %rsi
movq %r14, %rdi
callq 0xbfa2
leaq -0x30(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0xb610
callq 0x5460
movq -0x58(%rbp), %rdi
testq %rdi, %rdi
je 0xb61e
callq 0x8af0
leaq -0x110(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0xb633
callq 0x5460
movl %ebx, %eax
addq $0x108, %rsp            # imm = 0x108
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
leaq -0x120(%rbp), %rdi
callq 0xbfde
movq %rbx, %rdi
callq 0x57c0
// File: /workspace/github_cpp_makefile_star2_O1/williewillus[P]panda_scratchpad/src/wrapper/wrapper.cpp
// Function: wrapper::RecordCmFsOps::CmSync()
void RecordCmFsOps::CmSync() {
  fns_->FnSync();
  
  DiskMod mod;
  mod.mod_type = DiskMod::kSyncMod;
  mod.mod_opts = DiskMod::kNoneOpt;
  mods_.push_back(mod);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
subq $0x100, %rsp            # imm = 0x100
movq %rdi, %rbx
movq 0x90(%rdi), %rdi
movq (%rdi), %rax
callq *0xa8(%rax)
leaq -0x110(%rbp), %r14
movq %r14, %rdi
callq 0x9e18
movq $0x8, 0x20(%r14)
addq $0x78, %rbx
movq %rbx, %rdi
movq %r14, %rsi
callq 0xbfa2
leaq -0x20(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0xb6b3
callq 0x5460
movq -0x48(%rbp), %rdi
testq %rdi, %rdi
je 0xb6c1
callq 0x8af0
leaq -0x100(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0xb6d6
callq 0x5460
addq $0x100, %rsp            # imm = 0x100
popq %rbx
popq %r14
popq %rbp
retq
movq %rax, %rbx
leaq -0x110(%rbp), %rdi
callq 0xbfde
movq %rbx, %rdi
callq 0x57c0
nop
// File: /workspace/github_cpp_makefile_star2_O1/williewillus[P]panda_scratchpad/src/wrapper/wrapper.cpp
// Function: wrapper::RecordCmFsOps::CmSyncFileRange(int, unsigned long, unsigned long, unsigned int)
int RecordCmFsOps::CmSyncFileRange(const int fd, size_t offset, size_t nbytes,
    unsigned int flags) {
  const int res = fns_->FnSyncFileRange(fd, offset, nbytes, flags);
  if (res < 0) {
    return res;
  }

  DiskMod mod;
  mod.mod_type = DiskMod::kSyncFileRangeMod;
  mod.mod_opts = DiskMod::kNoneOpt;
  mod.path = fd_map_.at(fd);
  const int post_stat_res = fns_->FnStat(fd_map_.at(fd), &mod.post_mod_stats);
  if (post_stat_res < 0) {
    // TODO(ashmrtn): Some sort of warning here?
    return post_stat_res;
  }
  mod.file_mod_location = offset;
  mod.file_mod_len = nbytes;
  mods_.push_back(mod);
  return res;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x108, %rsp            # imm = 0x108
movq %rcx, %r15
movq %rdx, %r12
movq %rdi, %r14
movl %esi, -0x2c(%rbp)
movq 0x90(%rdi), %rdi
movq (%rdi), %rax
callq *0xb0(%rax)
movl %eax, %r13d
testl %eax, %eax
js 0xb7fb
movl %r13d, -0x30(%rbp)
leaq -0x130(%rbp), %rbx
movq %rbx, %rdi
callq 0x9e18
movq $0x9, 0x20(%rbx)
leaq 0x8(%r14), %r13
leaq -0x2c(%rbp), %rsi
movq %r13, %rdi
callq 0xc802
leaq -0x130(%rbp), %rdi
movq %rax, %rsi
callq 0x5280
movq 0x90(%r14), %rbx
leaq -0x2c(%rbp), %rsi
movq %r13, %rdi
callq 0xc802
movl -0x30(%rbp), %r13d
leaq -0x108(%rbp), %rdx
movq (%rbx), %rcx
movq %rbx, %rdi
movq %rax, %rsi
callq *0x88(%rcx)
testl %eax, %eax
js 0xb7c3
leaq -0x130(%rbp), %rsi
movq %r12, 0xd0(%rsi)
movq %r15, 0xd8(%rsi)
addq $0x78, %r14
movq %r14, %rdi
callq 0xbfa2
jmp 0xb7c6
movl %eax, %r13d
leaq -0x40(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0xb7d8
callq 0x5460
movq -0x68(%rbp), %rdi
testq %rdi, %rdi
je 0xb7e6
callq 0x8af0
leaq -0x120(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0xb7fb
callq 0x5460
movl %r13d, %eax
addq $0x108, %rsp            # imm = 0x108
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0xb812
movq %rax, %rbx
leaq -0x130(%rbp), %rdi
callq 0xbfde
movq %rbx, %rdi
callq 0x57c0
nop
// File: /workspace/github_cpp_makefile_star2_O1/williewillus[P]panda_scratchpad/src/wrapper/wrapper.cpp
// Function: wrapper::RecordCmFsOps::CmCheckpoint()
int RecordCmFsOps::CmCheckpoint() {
  const int res = fns_->CmCheckpoint();
  if (res < 0) {
    return res;
  }

  DiskMod mod;
  mod.mod_type = DiskMod::kCheckpointMod;
  mod.mod_opts = DiskMod::kNoneOpt;
  mods_.push_back(mod);

  return res;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x108, %rsp            # imm = 0x108
movq %rdi, %r14
movq 0x90(%rdi), %rdi
movq (%rdi), %rax
callq *0xb8(%rax)
movl %eax, %ebx
testl %eax, %eax
js 0xb8ae
leaq -0x118(%rbp), %r15
movq %r15, %rdi
callq 0x9e18
movq $0x6, 0x20(%r15)
addq $0x78, %r14
movq %r14, %rdi
movq %r15, %rsi
callq 0xbfa2
leaq -0x28(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0xb88b
callq 0x5460
movq -0x50(%rbp), %rdi
testq %rdi, %rdi
je 0xb899
callq 0x8af0
leaq -0x108(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0xb8ae
callq 0x5460
movl %ebx, %eax
addq $0x108, %rsp            # imm = 0x108
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
leaq -0x118(%rbp), %rdi
callq 0xbfde
movq %rbx, %rdi
callq 0x57c0
nop
// File: /workspace/github_cpp_makefile_star2_O1/williewillus[P]panda_scratchpad/src/wrapper/wrapper.cpp
// Function: wrapper::RecordCmFsOps::WriteWhole(int, unsigned long long, std::shared_ptr<char>)
int RecordCmFsOps::WriteWhole(const int fd, const unsigned long long size,
    shared_ptr<char> data) {
  unsigned long long written = 0;
  while (written < size) {
    const int res = write(fd, data.get() + written, size - written);
    if (res < 0) {
      return res;
    }
    written += res;
  }

  return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rcx, %rbx
movq %rdx, %r14
movl %esi, %r15d
xorl %r13d, %r13d
movq %r14, %rdx
subq %r13, %rdx
jbe 0xb926
movq (%rbx), %rsi
addq %r13, %rsi
movl %r15d, %edi
callq 0x51a0
movl %eax, %ecx
andl $0x7fffffff, %ecx       # imm = 0x7FFFFFFF
testl %eax, %eax
movl $0x0, %edx
cmovsq %rdx, %rcx
addq %rcx, %r13
testl %eax, %eax
cmovsl %eax, %r12d
jns 0xb8f0
jmp 0xb929
xorl %r12d, %r12d
movl %r12d, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O1/williewillus[P]panda_scratchpad/src/wrapper/wrapper.cpp
// Function: wrapper::RecordCmFsOps::Serialize(int)
int RecordCmFsOps::Serialize(const int fd) {
  for (auto &mod : mods_) {
    unsigned long long size;
    shared_ptr<char> serial_mod = DiskMod::Serialize(mod, &size);
    if (serial_mod == nullptr) {
      return -1;
    }

    const int res = WriteWhole(fd, size, serial_mod);
    if (res < 0) {
      return -1;
    }
  }

  return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movq 0x78(%rdi), %r14
movq 0x80(%rdi), %rax
movq %rax, -0x50(%rbp)
cmpq %rax, %r14
setne -0x29(%rbp)
je 0xba35
movl %esi, %ebx
leaq -0x48(%rbp), %rdi
movq %r14, %rsi
leaq -0x60(%rbp), %rdx
callq 0x98ce
movq -0x48(%rbp), %r13
testq %r13, %r13
je 0xba27
movq %r14, -0x58(%rbp)
movq -0x60(%rbp), %r14
movq -0x40(%rbp), %rcx
testq %rcx, %rcx
je 0xb9ae
movq 0x10620(%rip), %rax     # 0x1bfc0
cmpb $0x0, (%rax)
je 0xb9aa
incl 0x8(%rcx)
jmp 0xb9ae
lock
incl 0x8(%rcx)
movq %rcx, -0x38(%rbp)
xorl %r12d, %r12d
movq %r14, %rdx
subq %r12, %rdx
jbe 0xb9e8
leaq (%r12,%r13), %rsi
movl %ebx, %edi
callq 0x51a0
movl %eax, %ecx
andl $0x7fffffff, %ecx       # imm = 0x7FFFFFFF
testl %eax, %eax
movl $0x0, %edx
cmovsq %rdx, %rcx
addq %rcx, %r12
testl %eax, %eax
cmovsl %eax, %r15d
jns 0xb9b5
jmp 0xb9eb
xorl %r15d, %r15d
movq -0x38(%rbp), %rdi
testq %rdi, %rdi
je 0xb9f9
callq 0x8af0
movq -0x40(%rbp), %rdi
testq %rdi, %rdi
movq -0x58(%rbp), %r14
je 0xba0b
callq 0x8af0
testl %r15d, %r15d
js 0xba35
addq $0x100, %r14            # imm = 0x100
cmpq -0x50(%rbp), %r14
setne -0x29(%rbp)
jne 0xb96b
jmp 0xba35
movq -0x40(%rbp), %rdi
testq %rdi, %rdi
je 0xba35
callq 0x8af0
movzbl -0x29(%rbp), %eax
andl $0x1, %eax
negl %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 0xba5e
callq 0x8af0
movq -0x40(%rbp), %rdi
testq %rdi, %rdi
je 0xba6c
callq 0x8af0
movq %rbx, %rdi
callq 0x57c0
// File: /workspace/github_cpp_makefile_star2_O1/williewillus[P]panda_scratchpad/src/utils/FSCommands.cpp
// Function: GetFSCommands(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>&)
FSCommands* GetFSCommands(string &fs_name){
	if (fs_name.compare(DAXCommands::fsName) == 0 )
		return new DAXCommands(); 
	else if (fs_name.compare(NOVACommands::fsName) == 0 )
		return new NOVACommands();
	else if (fs_name.compare(PMFSCommands::fsName) == 0 )
		return new PMFSCommands();
	else
		return NULL;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
movq %rdi, %rbx
leaq 0x8014(%rip), %rsi      # 0x14ef8
callq 0x5130
testl %eax, %eax
je 0xcf17
leaq 0x8008(%rip), %rsi      # 0x14efc
movq %rbx, %rdi
callq 0x5130
testl %eax, %eax
je 0xcf20
leaq 0x7ffa(%rip), %rsi      # 0x14f01
movq %rbx, %rdi
callq 0x5130
testl %eax, %eax
je 0xcf29
xorl %eax, %eax
jmp 0xcf41
leaq 0xed3a(%rip), %rbx      # 0x1bc58
jmp 0xcf30
leaq 0xed81(%rip), %rbx      # 0x1bca8
jmp 0xcf30
leaq 0xedb8(%rip), %rbx      # 0x1bce8
addq $0x10, %rbx
movl $0x8, %edi
callq 0x54a0
movq %rbx, (%rax)
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O1/williewillus[P]panda_scratchpad/src/utils/Tester.cpp
// Function: Tester::mount_device(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>)
int Tester::mount_device(string device_path, string mount_point) {
	string command = fs_commands_->GetMountCommand(device_path, mount_point);
	if (system(command.c_str()) != 0) {
		return MNT_ERR;
	}
	return SUCCESS;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
subq $0x28, %rsp
movq %rdx, %rcx
movq %rsi, %rdx
movq 0x8(%rdi), %rsi
movq (%rsi), %rax
leaq -0x28(%rbp), %rbx
movq %rbx, %rdi
callq *0x10(%rax)
movq (%rbx), %rdi
callq 0x53e0
movl %eax, %ebx
leaq -0x18(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0xeb24
callq 0x5460
xorl %eax, %eax
testl %ebx, %ebx
sete %al
leal (%rax,%rax,2), %eax
addl $-0x3, %eax
addq $0x28, %rsp
popq %rbx
popq %rbp
retq
movq %rax, %rbx
leaq -0x18(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0xeb4d
callq 0x5460
movq %rbx, %rdi
callq 0x57c0
nop
// File: /workspace/github_cpp_makefile_star2_O1/williewillus[P]panda_scratchpad/src/utils/Tester.cpp
// Function: Tester::format_and_mount_device(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>)
int Tester::format_and_mount_device(string device_path, string mount_point) {
	string command = fs_commands_->GetMkfsCommand(device_path, mount_point);
	if (system(command.c_str()) != 0) {
		return FMT_ERR;
	}
	return SUCCESS;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
subq $0x28, %rsp
movq %rdx, %rcx
movq %rsi, %rdx
movq 0x8(%rdi), %rsi
movq (%rsi), %rax
leaq -0x28(%rbp), %rbx
movq %rbx, %rdi
callq *0x8(%rax)
movq (%rbx), %rdi
callq 0x53e0
movl %eax, %ebx
leaq -0x18(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0xeb92
callq 0x5460
xorl %eax, %eax
testl %ebx, %ebx
sete %al
leal -0x4(,%rax,4), %eax
addq $0x28, %rsp
popq %rbx
popq %rbp
retq
movq %rax, %rbx
leaq -0x18(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0xebbc
callq 0x5460
movq %rbx, %rdi
callq 0x57c0