LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_cpp_makefile_star2_O3/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 0xa524
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 0xa564
callq 0x5460
testl %r12d, %r12d
js 0xa57e
movzbl -0x29(%rbp), %ecx
movq %r15, %rdi
movl %r12d, %esi
movq %r14, %rdx
movl %r13d, %r8d
callq 0xa23a
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 0xa5b0
jmp 0xa5ba
jmp 0xa5b7
movq %rax, %r14
leaq -0x40(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0xa5ba
callq 0x5460
jmp 0xa5ba
movq %rax, %r14
movq %r14, %rdi
callq 0x57c0
// File: /workspace/github_cpp_makefile_star2_O3/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, %r12d
movl %ecx, %r13d
movq %rdx, %r15
movq %rdi, %r14
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 0xac06
testb $0x2, %r13b
sete %al
testb $0x22, %r12b
setne %cl
orb %al, %cl
jne 0xac06
leaq 0x8(%r14), %rdi
leaq -0x2c(%rbp), %rsi
callq 0xc7c2
testq %rax, %rax
je 0xac18
addq $0x40, %r14
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 0x10(%rax), %rsi
movq 0x18(%rax), %rdx
addq %rsi, %rdx
callq 0x7fc8
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 0xabba
movq %rax, -0x78(%rbp)
movq -0x40(%rbp), %rax
movq %rax, -0x68(%rbp)
jmp 0xabc3
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 0xc824
movq -0x78(%rbp), %rdi
cmpq %r12, %rdi
je 0xabf8
callq 0x5460
movq -0x50(%rbp), %rdi
cmpq %r15, %rdi
je 0xac06
callq 0x5460
movq %rbx, %rax
addq $0x78, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0xa07e(%rip), %rdi      # 0x14c9d
callq 0x5630
movq %rax, %rbx
movq -0x78(%rbp), %rdi
cmpq %r12, %rdi
je 0xac35
callq 0x5460
movq -0x50(%rbp), %rdi
cmpq %r15, %rdi
je 0xac43
callq 0x5460
movq %rbx, %rdi
callq 0x57c0
nop
// File: /workspace/github_cpp_makefile_star2_O3/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 0xaea7
addq $0x40, %rbx
leaq -0x20(%rbp), %rsi
movq %r14, (%rsi)
movq %rbx, %rdi
callq 0xcb6c
movl %r15d, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O3/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 0xb26d
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 0xb24d
movq (%r14), %rsi
movq 0x8(%r14), %rcx
movq %r15, %rdi
xorl %edx, %edx
callq 0x57b0
cmpq $-0x1, %rax
je 0xb264
movq %rax, %r15
movq -0x38(%rbp), %rdi
movq %r13, %rsi
callq 0xcc7e
movq 0x8(%r14), %rdx
movq (%rbx), %rcx
movq 0x8(%rbx), %r8
movq %rax, %rdi
movq %r15, %rsi
callq 0x54e0
jmp 0xb264
movq -0x38(%rbp), %rdi
movq %r13, %rsi
callq 0xcc7e
movq %rax, %rdi
movq %rbx, %rsi
callq 0x5280
movq (%r12), %r12
testq %r12, %r12
jne 0xb1f6
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_O3/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 0xb2f1
callq 0x5460
testl %ebx, %ebx
js 0xb35c
leaq -0x130(%rbp), %r12
movq %r12, %rdi
callq 0x9da2
movq $0x5, 0x20(%r12)
movq %r12, %rdi
movq %r15, %rsi
callq 0x5280
addq $0x78, %r14
leaq -0x130(%rbp), %rsi
movq %r14, %rdi
callq 0xbfac
leaq -0x40(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0xb33d
callq 0x5460
movq -0x68(%rbp), %rdi
testq %rdi, %rdi
je 0xb34b
callq 0x8a78
movq -0x130(%rbp), %rdi
cmpq %r13, %rdi
je 0xb35c
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 0xb39e
callq 0x5460
jmp 0xb39e
movq %rax, %rbx
jmp 0xb39e
movq %rax, %rbx
leaq -0x130(%rbp), %rdi
callq 0xbfe8
movq %rbx, %rdi
callq 0x57c0
// File: /workspace/github_cpp_makefile_star2_O3/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 0xb404
callq 0x5460
testl %ebx, %ebx
js 0xb46f
leaq -0x130(%rbp), %r12
movq %r12, %rdi
callq 0x9da2
movq $0x5, 0x20(%r12)
movq %r12, %rdi
movq %r15, %rsi
callq 0x5280
addq $0x78, %r14
leaq -0x130(%rbp), %rsi
movq %r14, %rdi
callq 0xbfac
leaq -0x40(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0xb450
callq 0x5460
movq -0x68(%rbp), %rdi
testq %rdi, %rdi
je 0xb45e
callq 0x8a78
movq -0x130(%rbp), %rdi
cmpq %r13, %rdi
je 0xb46f
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 0xb4b1
callq 0x5460
jmp 0xb4b1
movq %rax, %rbx
jmp 0xb4b1
movq %rax, %rbx
leaq -0x130(%rbp), %rdi
callq 0xbfe8
movq %rbx, %rdi
callq 0x57c0
nop
// File: /workspace/github_cpp_makefile_star2_O3/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 0xb56e
leaq -0x120(%rbp), %r15
movq %r15, %rdi
callq 0x9da2
movq $0x7, 0x20(%r15)
leaq 0x8(%r14), %rdi
leaq -0x1c(%rbp), %rsi
callq 0xc7c2
testq %rax, %rax
je 0xb57e
addq $0x10, %rax
leaq -0x120(%rbp), %rdi
movq %rax, %rsi
callq 0x5280
addq $0x78, %r14
leaq -0x120(%rbp), %rsi
movq %r14, %rdi
callq 0xbfac
leaq -0x30(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0xb54b
callq 0x5460
movq -0x58(%rbp), %rdi
testq %rdi, %rdi
je 0xb559
callq 0x8a78
leaq -0x110(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0xb56e
callq 0x5460
movl %ebx, %eax
addq $0x108, %rsp            # imm = 0x108
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
leaq 0x9718(%rip), %rdi      # 0x14c9d
callq 0x5630
movq %rax, %rbx
leaq -0x120(%rbp), %rdi
callq 0xbfe8
movq %rbx, %rdi
callq 0x57c0
nop
// File: /workspace/github_cpp_makefile_star2_O3/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 0xb656
leaq -0x120(%rbp), %r15
movq %r15, %rdi
callq 0x9da2
movq $0x7, 0x20(%r15)
leaq 0x8(%r14), %rdi
leaq -0x1c(%rbp), %rsi
callq 0xc7c2
testq %rax, %rax
je 0xb666
addq $0x10, %rax
leaq -0x120(%rbp), %rdi
movq %rax, %rsi
callq 0x5280
addq $0x78, %r14
leaq -0x120(%rbp), %rsi
movq %r14, %rdi
callq 0xbfac
leaq -0x30(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0xb633
callq 0x5460
movq -0x58(%rbp), %rdi
testq %rdi, %rdi
je 0xb641
callq 0x8a78
leaq -0x110(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0xb656
callq 0x5460
movl %ebx, %eax
addq $0x108, %rsp            # imm = 0x108
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
leaq 0x9630(%rip), %rdi      # 0x14c9d
callq 0x5630
movq %rax, %rbx
leaq -0x120(%rbp), %rdi
callq 0xbfe8
movq %rbx, %rdi
callq 0x57c0
nop
// File: /workspace/github_cpp_makefile_star2_O3/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 0x9da2
movq $0x8, 0x20(%r14)
addq $0x78, %rbx
movq %rbx, %rdi
movq %r14, %rsi
callq 0xbfac
leaq -0x20(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0xb6e3
callq 0x5460
movq -0x48(%rbp), %rdi
testq %rdi, %rdi
je 0xb6f1
callq 0x8a78
leaq -0x100(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0xb706
callq 0x5460
addq $0x100, %rsp            # imm = 0x100
popq %rbx
popq %r14
popq %rbp
retq
movq %rax, %rbx
leaq -0x110(%rbp), %rdi
callq 0xbfe8
movq %rbx, %rdi
callq 0x57c0
nop
// File: /workspace/github_cpp_makefile_star2_O3/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 $0x118, %rsp            # imm = 0x118
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, %ebx
testl %eax, %eax
js 0xb843
movq %r15, -0x38(%rbp)
leaq -0x138(%rbp), %r15
movq %r15, %rdi
callq 0x9da2
movq $0x9, 0x20(%r15)
leaq 0x8(%r14), %r13
leaq -0x2c(%rbp), %rsi
movq %r13, %rdi
callq 0xc7c2
testq %rax, %rax
je 0xb857
addq $0x10, %rax
leaq -0x138(%rbp), %rdi
movq %rax, %rsi
callq 0x5280
movq 0x90(%r14), %r15
leaq -0x2c(%rbp), %rsi
movq %r13, %rdi
callq 0xc7c2
testq %rax, %rax
je 0xb863
addq $0x10, %rax
leaq -0x110(%rbp), %rdx
movq (%r15), %rcx
movq %r15, %rdi
movq %rax, %rsi
callq *0x88(%rcx)
testl %eax, %eax
js 0xb80c
leaq -0x138(%rbp), %rsi
movq %r12, 0xd0(%rsi)
movq -0x38(%rbp), %rax
movq %rax, 0xd8(%rsi)
addq $0x78, %r14
movq %r14, %rdi
callq 0xbfac
jmp 0xb80e
movl %eax, %ebx
leaq -0x48(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0xb820
callq 0x5460
movq -0x70(%rbp), %rdi
testq %rdi, %rdi
je 0xb82e
callq 0x8a78
leaq -0x128(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0xb843
callq 0x5460
movl %ebx, %eax
addq $0x118, %rsp            # imm = 0x118
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x943f(%rip), %rdi      # 0x14c9d
callq 0x5630
leaq 0x9433(%rip), %rdi      # 0x14c9d
callq 0x5630
jmp 0xb871
movq %rax, %rbx
leaq -0x138(%rbp), %rdi
callq 0xbfe8
movq %rbx, %rdi
callq 0x57c0
// File: /workspace/github_cpp_makefile_star2_O3/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 0xb90c
leaq -0x118(%rbp), %r15
movq %r15, %rdi
callq 0x9da2
movq $0x6, 0x20(%r15)
addq $0x78, %r14
movq %r14, %rdi
movq %r15, %rsi
callq 0xbfac
leaq -0x28(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0xb8e9
callq 0x5460
movq -0x50(%rbp), %rdi
testq %rdi, %rdi
je 0xb8f7
callq 0x8a78
leaq -0x108(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0xb90c
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 0xbfe8
movq %rbx, %rdi
callq 0x57c0
nop
// File: /workspace/github_cpp_makefile_star2_O3/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 %r12
pushq %rbx
movq %rcx, %rbx
movq %rdx, %r14
movl %esi, %r15d
xorl %r12d, %r12d
movq %r14, %rdx
subq %r12, %rdx
jbe 0xb972
movq (%rbx), %rsi
addq %r12, %rsi
movl %r15d, %edi
callq 0x51a0
movl %eax, %ecx
andl $0x7fffffff, %ecx       # imm = 0x7FFFFFFF
addq %rcx, %r12
testl %eax, %eax
jns 0xb94b
jmp 0xb974
xorl %eax, %eax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O3/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 $0x28, %rsp
movq 0x78(%rdi), %r14
movq 0x80(%rdi), %rax
movq %rax, -0x48(%rbp)
cmpq %rax, %r14
je 0xba4e
movl %esi, %ebx
leaq -0x40(%rbp), %rdi
movq %r14, %rsi
leaq -0x50(%rbp), %rdx
callq 0x9856
movq -0x40(%rbp), %r13
testq %r13, %r13
je 0xba52
movq -0x50(%rbp), %r12
movq -0x38(%rbp), %rcx
testq %rcx, %rcx
je 0xb9e8
movq 0x105e6(%rip), %rax     # 0x1bfc0
cmpb $0x0, (%rax)
je 0xb9e4
incl 0x8(%rcx)
jmp 0xb9e8
lock
incl 0x8(%rcx)
movq %rcx, -0x30(%rbp)
xorl %ecx, %ecx
movq %rcx, %r15
movq %r12, %rdx
subq %rcx, %rdx
jbe 0xba13
leaq (%r15,%r13), %rsi
movl %ebx, %edi
callq 0x51a0
movl %eax, %ecx
andl $0x7fffffff, %ecx       # imm = 0x7FFFFFFF
addq %r15, %rcx
testl %eax, %eax
jns 0xb9ee
movq -0x30(%rbp), %rdi
testq %rdi, %rdi
je 0xba21
callq 0x8a78
movq -0x38(%rbp), %rdi
testq %rdi, %rdi
je 0xba2f
callq 0x8a78
cmpq %r15, %r12
ja 0xba45
addq $0x100, %r14            # imm = 0x100
cmpq -0x48(%rbp), %r14
jne 0xb9a9
xorl %eax, %eax
cmpq %r12, %r15
sbbl %eax, %eax
jmp 0xba65
xorl %eax, %eax
jmp 0xba65
movq -0x38(%rbp), %rdi
testq %rdi, %rdi
je 0xba60
callq 0x8a78
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
movq -0x30(%rbp), %rdi
testq %rdi, %rdi
je 0xba85
callq 0x8a78
movq -0x38(%rbp), %rdi
testq %rdi, %rdi
je 0xba93
callq 0x8a78
movq %rbx, %rdi
callq 0x57c0
nop
// File: /workspace/github_cpp_makefile_star2_O3/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 0x8058(%rip), %rsi      # 0x14ee8
callq 0x5130
testl %eax, %eax
je 0xcec3
leaq 0x804c(%rip), %rsi      # 0x14eec
movq %rbx, %rdi
callq 0x5130
testl %eax, %eax
je 0xcecc
leaq 0x803e(%rip), %rsi      # 0x14ef1
movq %rbx, %rdi
callq 0x5130
testl %eax, %eax
je 0xced5
xorl %eax, %eax
jmp 0xceed
leaq 0xed8e(%rip), %rbx      # 0x1bc58
jmp 0xcedc
leaq 0xedd5(%rip), %rbx      # 0x1bca8
jmp 0xcedc
leaq 0xee0c(%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_O3/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 0xeacc
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 0xeaf5
callq 0x5460
movq %rbx, %rdi
callq 0x57c0
nop
// File: /workspace/github_cpp_makefile_star2_O3/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 0xeb3a
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 0xeb64
callq 0x5460
movq %rbx, %rdi
callq 0x57c0
// File: /workspace/github_cpp_makefile_star2_O3/williewillus[P]panda_scratchpad/src/utils/Tester.cpp
// Function: Tester::cleanup_harness()
void Tester::cleanup_harness() {
	int umount_res;
	int err;
	do {
		umount_res = umount_device();
		if (umount_res < 0) {
			err = errno;
			usleep(500);
		}
	}while (umount_res < 0 && err == EBUSY);

	if (umount_res < 0) {
		cerr << "Unable to unmount device" << endl;
		test_unload_class();
		return; 
	}

	test_unload_class();
	if (fs_commands_ != NULL) {
		delete fs_commands_;
		fs_commands_ = NULL;
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
leaq 0x54a4(%rip), %r14      # 0x151e2
movq %r14, %rdi
callq 0x5600
movl %eax, %ecx
shrl $0x1f, %ecx
movb %cl, 0xf0(%rbx)
testl %eax, %eax
jns 0xfdc5
callq 0x5060
movl (%rax), %r15d
movl $0x1f4, %edi            # imm = 0x1F4
callq 0x55f0
cmpl $0x10, %r15d
je 0xfd3e
movq 0xc27c(%rip), %r14      # 0x1bff0
leaq 0x55e1(%rip), %rsi      # 0x1535c
movl $0x18, %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
addq $0x10, %rbx
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x10226
leaq 0x10(%rbx), %rdi
callq 0x10226
movq 0x8(%rbx), %rdi
testq %rdi, %rdi
je 0xfde4
callq 0x5460
movq $0x0, 0x8(%rbx)
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O3/williewillus[P]panda_scratchpad/src/utils/Tester.cpp
// Function: operator<<(std::ostream&, Tester::time_stats)
std::ostream& operator<<(std::ostream& os, Tester::time_stats time) {
	switch (time) {
		case Tester::SNAPSHOT_TIME:
			os << "snapshot restore time";
			break;
		case Tester::TEST_CASE_TIME:
			os << "test case time";
			break;
		case Tester::MOUNT_TIME:
			os << "mount/umount time";
			break;
		case Tester::TOTAL_TIME:
			os << "total time";
			break;
		default:
			os.setstate(std::ios_base::failbit);
	}
	return os;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
movq %rdi, %rbx
decl %esi
cmpl $0x5, %esi
ja 0xfea8
leaq 0x5135(%rip), %rax      # 0x14f8c
movslq (%rax,%rsi,4), %rcx
addq %rax, %rcx
jmpq *%rcx
leaq 0x550e(%rip), %rsi      # 0x15375
movl $0x15, %edx
jmp 0xfe96
leaq 0x5525(%rip), %rsi      # 0x1539a
movl $0x11, %edx
jmp 0xfe96
leaq 0x5508(%rip), %rsi      # 0x1538b
movl $0xe, %edx
jmp 0xfe96
leaq 0x551b(%rip), %rsi      # 0x153ac
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 0xfe9e
nop
// File: /workspace/github_cpp_makefile_star2_O3/williewillus[P]panda_scratchpad/src/utils/ClassLoader.h
// Function: void utils::ClassLoader<tests::BaseTestCase>::unload_class<void (*)(tests::BaseTestCase*)>()
void unload_class() {
    if (loader_handle != NULL && instance != NULL) {
      ((DF)(defactory))(instance);
      dlclose(loader_handle);
      factory = NULL;
      defactory = NULL;
      loader_handle = NULL;
      instance = NULL;
    }
  }

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
cmpq $0x0, (%rdi)
je 0x10253
movq %rdi, %rbx
movq 0x18(%rdi), %rdi
testq %rdi, %rdi
je 0x10253
callq *0x10(%rbx)
movq (%rbx), %rdi
callq 0x5390
xorps %xmm0, %xmm0
movups %xmm0, (%rbx)
movups %xmm0, 0x10(%rbx)
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/williewillus[P]panda_scratchpad/src/checker/DiskContents.cpp
// Function: fileAttributes::fileAttributes()
fileAttributes::fileAttributes() {
  md5sum = "";
  // Initialize dir_attr entries
  dir_attr.d_ino = -1;
  dir_attr.d_off = -1;
  dir_attr.d_reclen = -1;
  dir_attr.d_type = -1;
  dir_attr.d_name[0] = '\0';
  // Initialize stat_attr entried
  stat_attr.st_ino == -1;
  stat_attr.st_mode = -1;
  stat_attr.st_nlink = -1;
  stat_attr.st_uid = -1;
  stat_attr.st_gid = -1;
  stat_attr.st_size = -1;
  stat_attr.st_blksize = -1;
  stat_attr.st_blocks = -1;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
leaq 0x1a8(%rdi), %r14
leaq 0x1b8(%rdi), %r15
movq %r15, 0x1a8(%rdi)
movq $0x0, 0x1b0(%rdi)
movb $0x0, 0x1b8(%rdi)
leaq 0x3a2d(%rip), %rcx      # 0x1410c
movq %r14, %rdi
xorl %esi, %esi
xorl %edx, %edx
xorl %r8d, %r8d
callq 0x56b0
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
movl %eax, 0xf(%rbx)
pcmpeqd %xmm0, %xmm0
movdqu %xmm0, (%rbx)
movb $0x0, 0x13(%rbx)
movdqu %xmm0, 0x128(%rbx)
movl %eax, 0x138(%rbx)
movdqu %xmm0, 0x148(%rbx)
movq $-0x1, 0x158(%rbx)
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
movq (%r14), %rdi
cmpq %r15, %rdi
je 0x1073e
callq 0x5460
movq %rbx, %rdi
callq 0x57c0
// File: /workspace/github_cpp_makefile_star2_O3/williewillus[P]panda_scratchpad/src/checker/DiskContents.cpp
// Function: fileAttributes::set_stat_attr(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, bool)
void fileAttributes::set_stat_attr(string path, bool islstat) {
  if (islstat) {
    lstat(path.c_str(), &stat_attr);
  } else {
    stat(path.c_str(), &stat_attr);
  }
  return;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movq %rdi, %rax
movq (%rsi), %rdi
addq $0x118, %rax            # imm = 0x118
movq %rax, %rsi
testl %edx, %edx
je 0x107cb
popq %rbp
jmp 0x5880
popq %rbp
jmp 0x5410
nop
// File: /workspace/github_cpp_makefile_star2_O3/williewillus[P]panda_scratchpad/src/checker/DiskContents.cpp
// Function: fileAttributes::set_md5sum(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>)
void fileAttributes::set_md5sum(string file_path) {
  FILE *fp;
  string command = "md5sum " + file_path;
  char md5[100];
  fp = popen(command.c_str(), "r");
  fscanf(fp, "%s", md5);
  fclose(fp);
  md5sum = string(md5);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0xa8, %rsp
movq %rsi, %rdx
movq %rdi, %rbx
leaq 0x4ec7(%rip), %rsi      # 0x156b6
leaq -0x58(%rbp), %r14
movq %r14, %rdi
callq 0xd1df
movq (%r14), %rdi
leaq 0x3c6f(%rip), %rsi      # 0x14474
callq 0x5150
movq %rax, %r14
leaq 0x4d05(%rip), %rsi      # 0x15519
leaq -0xc0(%rbp), %rdx
movq %rax, %rdi
xorl %eax, %eax
callq 0x5810
movq %r14, %rdi
callq 0x5490
leaq -0x28(%rbp), %r15
movq %r15, -0x10(%r15)
leaq -0xc0(%rbp), %r14
movq %r14, %rdi
callq 0x51f0
leaq (%rax,%rbp), %rdx
addq $-0xc0, %rdx
leaq -0x38(%rbp), %rdi
movq %r14, %rsi
callq 0x8066
addq $0x1a8, %rbx            # imm = 0x1A8
leaq -0x38(%rbp), %r14
movq %rbx, %rdi
movq %r14, %rsi
callq 0x5520
movq (%r14), %rdi
cmpq %r15, %rdi
je 0x1087e
callq 0x5460
leaq -0x48(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x10890
callq 0x5460
addq $0xa8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
jmp 0x108a0
movq %rax, %rbx
leaq -0x48(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x108b5
callq 0x5460
movq %rbx, %rdi
callq 0x57c0
nop
// File: /workspace/github_cpp_makefile_star2_O3/williewillus[P]panda_scratchpad/src/checker/DiskContents.cpp
// Function: fileAttributes::compare_dir_attr(dirent)
bool fileAttributes::compare_dir_attr(struct dirent a) {

  return ((dir_attr.d_ino == a.d_ino) &&
    (dir_attr.d_off == a.d_off) &&
    (dir_attr.d_reclen == a.d_reclen) &&
    (dir_attr.d_type == a.d_type) &&
    (strcmp(dir_attr.d_name, a.d_name) == 0));
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movq (%rdi), %rax
cmpq 0x10(%rbp), %rax
jne 0x108ff
leaq 0x10(%rbp), %rsi
movq 0x8(%rdi), %rax
cmpq 0x8(%rsi), %rax
jne 0x108ff
movzwl 0x10(%rdi), %eax
cmpw 0x10(%rsi), %ax
jne 0x108ff
movb 0x12(%rdi), %al
cmpb 0x12(%rsi), %al
jne 0x108ff
addq $0x13, %rdi
addq $0x13, %rsi
callq 0x55c0
testl %eax, %eax
sete %al
jmp 0x10901
xorl %eax, %eax
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O3/williewillus[P]panda_scratchpad/src/checker/DiskContents.cpp
// Function: DiskContents::mount_disk()
int DiskContents::mount_disk() {
  // Construct and set mount_point
  mount_point = "/mnt/";
  mount_point += disk_path.substr(5);
  // Create the mount directory with read/write/search permissions for owner and group, 
  // and with read/search permissions for others.
  int ret = mkdir(mount_point.c_str(), S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH);
  if (ret == -1 && errno != EEXIST) {
    cout << "creating mountpoint failed" << endl;
    return -1;
  }
  // Mount the disk
  if (mount(disk_path.c_str(), mount_point.c_str(), fs_type.c_str(), MS_RDONLY, NULL) < 0) {
    return -1;
  }
  // sleep after mount
  unsigned int to_sleep = 0;
  do {
    to_sleep = sleep(to_sleep);
  } while (to_sleep > 0);

  device_mounted = true;
  return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x28, %rsp
movq %rdi, %rbx
leaq 0x28(%rdi), %r14
movq 0x30(%rdi), %rdx
leaq 0x48a3(%rip), %rcx      # 0x15606
movl $0x5, %r8d
movq %r14, %rdi
xorl %esi, %esi
callq 0x56b0
leaq 0x8(%rbx), %rsi
leaq -0x38(%rbp), %r15
movl $0x5, %edx
movq %r15, %rdi
movq $-0x1, %rcx
callq 0x54c0
movq (%r15), %rsi
movq 0x8(%r15), %rdx
movq %r14, %rdi
callq 0x5160
leaq -0x28(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x10db0
callq 0x5460
movq (%r14), %rdi
movl $0x1fd, %esi            # imm = 0x1FD
callq 0x5200
cmpl $-0x1, %eax
jne 0x10dcc
callq 0x5060
cmpl $0x11, (%rax)
jne 0x10e02
movq 0x8(%rbx), %rdi
movq 0x28(%rbx), %rsi
movq 0x48(%rbx), %rdx
xorl %r14d, %r14d
movl $0x1, %ecx
xorl %r8d, %r8d
callq 0x5840
testl %eax, %eax
js 0x10e44
movl %r14d, %edi
callq 0x5350
movl %eax, %r14d
testl %eax, %eax
jne 0x10dec
movb $0x1, (%rbx)
xorl %eax, %eax
jmp 0x10e49
movq 0xb1bf(%rip), %rbx      # 0x1bfc8
leaq 0x47fc(%rip), %rsi      # 0x1560c
movl $0x1a, %edx
movq %rbx, %rdi
callq 0x54f0
movq (%rbx), %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
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
addq $0x28, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
leaq -0x28(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x10e69
callq 0x5460
movq %rbx, %rdi
callq 0x57c0
nop
// File: /workspace/github_cpp_makefile_star2_O3/williewillus[P]panda_scratchpad/src/checker/DiskContents.cpp
// Function: DiskContents::unmount_and_delete_mount_point()
int DiskContents::unmount_and_delete_mount_point() {
  // umount till successful
  int umount_res;
  int err;
  string command = "umount ";
  command += mount_point;
  do {
    umount_res = system(command.c_str());
    if (umount_res < 0) {
      err = errno;
      usleep(500);
    }
  } while (umount_res < 0 && err == EBUSY);

  // Delete the mount directory
  if (unlink(mount_point.c_str()) != 0) {
    return -1;
  }
  device_mounted = false;
  return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x28, %rsp
movq %rdi, %rbx
leaq -0x28(%rbp), %r15
movq %r15, -0x10(%r15)
leaq 0x4796(%rip), %rsi      # 0x15627
leaq 0x4796(%rip), %rdx      # 0x1562e
leaq -0x38(%rbp), %r14
movq %r14, %rdi
callq 0x8066
movq 0x28(%rbx), %rsi
movq 0x30(%rbx), %rdx
movq %r14, %rdi
callq 0x5160
movq -0x38(%rbp), %rdi
callq 0x53e0
testl %eax, %eax
jns 0x10ed9
callq 0x5060
movl (%rax), %r14d
movl $0x1f4, %edi            # imm = 0x1F4
callq 0x55f0
cmpl $0x10, %r14d
je 0x10eb4
movq 0x28(%rbx), %rdi
callq 0x5210
movl $0xffffffff, %r14d      # imm = 0xFFFFFFFF
testl %eax, %eax
jne 0x10ef2
movb $0x0, (%rbx)
xorl %r14d, %r14d
movq -0x38(%rbp), %rdi
cmpq %r15, %rdi
je 0x10f00
callq 0x5460
movl %r14d, %eax
addq $0x28, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
jmp 0x10f10
movq %rax, %rbx
movq -0x38(%rbp), %rdi
cmpq %r15, %rdi
je 0x10f21
callq 0x5460
movq %rbx, %rdi
callq 0x57c0
nop
// File: /workspace/github_cpp_makefile_star2_O3/williewillus[P]panda_scratchpad/src/checker/DiskContents.cpp
// Function: isEmptyDirOrFile(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>)
bool isEmptyDirOrFile(string path) {
  DIR *directory = opendir(path.c_str());
  if (directory == NULL) {
    return true;
  }

  struct dirent *dir_entry;
  int num_dir_entries = 0;
  while (dir_entry = readdir(directory)) {
    if (++num_dir_entries > 2) {
      break;
    }
  }
  closedir(directory);
  if (num_dir_entries <= 2) {
    return true;
  }
  return false;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
movq (%rdi), %rdi
callq 0x5660
testq %rax, %rax
je 0x12c2d
movq %rax, %rbx
xorl %r14d, %r14d
movq %rbx, %rdi
callq 0x5690
testq %rax, %rax
je 0x12c1c
incl %r14d
cmpl $0x3, %r14d
jne 0x12c00
movl $0x3, %r14d
movq %rbx, %rdi
callq 0x56f0
cmpl $0x3, %r14d
setb %al
jmp 0x12c2f
movb $0x1, %al
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/williewillus[P]panda_scratchpad/src/checker/DiskContents.cpp
// Function: isFile(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>)
bool isFile(string path) {
  struct stat sb;
  if (stat(path.c_str(), &sb) < 0) {
    cout << __func__ << ": Failed stating " << path << endl;
    return false;
  }
  if (S_ISDIR(sb.st_mode)) {
    return false;
  }
  return true;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
subq $0x90, %rsp
movq %rdi, %rbx
movq (%rdi), %rdi
leaq -0xa0(%rbp), %rsi
callq 0x5410
testl %eax, %eax
js 0x12c6d
movl $0xf000, %eax           # imm = 0xF000
andl -0x88(%rbp), %eax
cmpl $0x4000, %eax           # imm = 0x4000
setne %al
jmp 0x12cd7
movq 0x9354(%rip), %r14      # 0x1bfc8
leaq 0x2acd(%rip), %rsi      # 0x15748
movl $0x6, %edx
movq %r14, %rdi
callq 0x54f0
leaq 0x2ac0(%rip), %rsi      # 0x1574f
movl $0x11, %edx
movq %r14, %rdi
callq 0x54f0
movq (%rbx), %rsi
movq 0x8(%rbx), %rdx
movq %r14, %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
xorl %eax, %eax
addq $0x90, %rsp
popq %rbx
popq %r14
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O3/ch4rli3kop[P]ch4rli3-fuzzer/main.cc
// Function: is_newPath()
bool is_newPath(){
	uint8_t *digest = sha256((unsigned char*)shmAddr, 0x1000);

	for (int i = 0; i < path.size(); i++){
		if (!memcmp(digest, path[i], 32)) return false;
	}

	path.push_back(digest);
	totalpath++;
	
	// debug
	// cout << "Path : " << totalpath << endl;
	// char buf[2*SHA256::DIGEST_SIZE+1];
    // buf[2*SHA256::DIGEST_SIZE] = 0;
    // for (int i = 0; i < SHA256::DIGEST_SIZE; i++)
    //     sprintf(buf+i*2, "%02x", digest[i]);
	// cout << buf << endl;

	return true;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
movq 0x4be7(%rip), %rdi      # 0x71e0
movl $0x1000, %esi           # imm = 0x1000
callq 0x3d72
movq 0x4c66(%rip), %rsi      # 0x7270
movq 0x4c57(%rip), %rdx      # 0x7268
movq %rsi, %rcx
movq %rax, -0x10(%rbp)
subq %rdx, %rcx
je 0x26ad
sarq $0x3, %rcx
cmpq $0x1, %rcx
movq %rcx, %rdi
adcq $0x0, %rdi
movq (%rdx), %r8
movdqu (%rax), %xmm0
movdqu 0x10(%rax), %xmm1
movdqu (%r8), %xmm2
pcmpeqb %xmm0, %xmm2
movdqu 0x10(%r8), %xmm0
pcmpeqb %xmm1, %xmm0
pand %xmm2, %xmm0
pmovmskb %xmm0, %r8d
cmpl $0xffff, %r8d           # imm = 0xFFFF
je 0x26b1
movl $0x1, %r9d
movq %r9, %r8
cmpq %r9, %rdi
je 0x26b5
movq (%rdx,%r8,8), %r9
movdqu (%rax), %xmm0
movdqu 0x10(%rax), %xmm1
movdqu (%r9), %xmm2
pcmpeqb %xmm0, %xmm2
movdqu 0x10(%r9), %xmm0
pcmpeqb %xmm1, %xmm0
pand %xmm2, %xmm0
pmovmskb %xmm0, %r10d
leaq 0x1(%r8), %r9
cmpl $0xffff, %r10d          # imm = 0xFFFF
jne 0x2667
cmpq %r8, %rcx
setbe %bl
jmp 0x26e7
movb $0x1, %bl
jmp 0x26bb
xorl %ebx, %ebx
jmp 0x26e7
cmpq %r8, %rcx
setbe %bl
cmpq 0x4bb6(%rip), %rsi      # 0x7278
je 0x26d1
movq %rax, (%rsi)
addq $0x8, 0x4ba1(%rip)      # 0x7270
jmp 0x26e1
leaq 0x4b90(%rip), %rdi      # 0x7268
leaq -0x10(%rbp), %rdx
callq 0x34f2
incl 0x4b09(%rip)            # 0x71f0
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/ch4rli3kop[P]ch4rli3-fuzzer/main.cc
// Function: Add_state(int)
void Add_state(int state){
	ofstream out("out/crash_log", ios::app);
	out << "======================================" << endl;
	out << "crash " << crash << endl;
	out << "  signal : " << (int)WTERMSIG(state) << endl;
	out.close();
	crash++;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
subq $0x200, %rsp            # imm = 0x200
movl %edi, %ebx
leaq 0x1675(%rip), %rsi      # 0x4048
leaq -0x210(%rbp), %r14
movq %r14, %rdi
movl $0x1, %edx
callq 0x21d0
leaq 0x1668(%rip), %rsi      # 0x4056
movl $0x26, %edx
movq %r14, %rdi
callq 0x21f0
movq -0x210(%rbp), %rax
addq -0x18(%rax), %r14
movq %r14, %rdi
movl $0xa, %esi
callq 0x21a0
movsbl %al, %esi
leaq -0x210(%rbp), %rdi
callq 0x2040
movq %rax, %rdi
callq 0x2110
leaq 0x164c(%rip), %rsi      # 0x407d
leaq -0x210(%rbp), %rdi
movl $0x6, %edx
callq 0x21f0
movl 0x47b0(%rip), %esi      # 0x71f8
leaq -0x210(%rbp), %rdi
callq 0x2300
movq %rax, %r14
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x21a0
movsbl %al, %esi
movq %r14, %rdi
callq 0x2040
movq %rax, %rdi
callq 0x2110
leaq 0x15ff(%rip), %rsi      # 0x4084
leaq -0x210(%rbp), %rdi
movl $0xb, %edx
callq 0x21f0
andl $0x7f, %ebx
leaq -0x210(%rbp), %rdi
movl %ebx, %esi
callq 0x2300
movq %rax, %rbx
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x21a0
movsbl %al, %esi
movq %rbx, %rdi
callq 0x2040
movq %rax, %rdi
callq 0x2110
leaq -0x210(%rbp), %rdi
callq 0x2270
incl 0x4715(%rip)            # 0x71f8
movq 0x44e6(%rip), %rax      # 0x6fd0
movq (%rax), %rcx
movq 0x18(%rax), %rax
leaq -0x208(%rbp), %rdi
movq %rcx, -0x8(%rdi)
movq -0x18(%rcx), %rcx
movq %rax, -0x210(%rbp,%rcx)
callq 0x2160
leaq -0x118(%rbp), %rdi
callq 0x20a0
addq $0x200, %rsp            # imm = 0x200
popq %rbx
popq %r14
popq %rbp
retq
movq %rax, %rbx
leaq -0x210(%rbp), %rdi
callq 0x2290
movq %rbx, %rdi
callq 0x2320
// File: /workspace/github_cpp_makefile_star2_O3/ch4rli3kop[P]ch4rli3-fuzzer/main.cc
// Function: Add_to_corpus()
void Add_to_corpus(){
	ifstream in("out/cur_input.j2k", ios::ate);
	if (in.fail()){
        perror("open cur_input error!\n");
        exit(-1);
    }
	uint32_t length = in.tellg();
	in.seekg(0, ios::beg);

	uint8_t* buf = new uint8_t[length+1+4];
    memcpy(buf, &length, 4);
	in.read((char*)buf+4, length);
	corpus.insert(corpus.begin(), buf);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
subq $0x218, %rsp            # imm = 0x218
leaq 0x15af(%rip), %rsi      # 0x4118
leaq -0x218(%rbp), %rbx
movq %rbx, %rdi
movl $0x2, %edx
callq 0x2340
movq (%rbx), %rax
movq -0x18(%rax), %rax
testb $0x5, -0x1f8(%rbp,%rax)
jne 0x2bfd
leaq -0x218(%rbp), %rdi
callq 0x2310
movq %rax, %rbx
leaq -0x218(%rbp), %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x2250
leal 0x5(%rbx), %edi
callq 0x2030
movq %rax, -0x10(%rbp)
movl %ebx, (%rax)
addq $0x4, %rax
movl %ebx, %edx
leaq -0x218(%rbp), %rdi
movq %rax, %rsi
callq 0x2230
movq 0x4679(%rip), %rsi      # 0x7250
leaq 0x4672(%rip), %rdi      # 0x7250
leaq -0x10(%rbp), %rdx
callq 0x3180
leaq -0x218(%rbp), %rdi
callq 0x2060
addq $0x218, %rsp            # imm = 0x218
popq %rbx
popq %rbp
retq
callq 0x2388
jmp 0x2c08
jmp 0x2c08
jmp 0x2c08
movq %rax, %rbx
leaq -0x218(%rbp), %rdi
callq 0x2060
movq %rbx, %rdi
callq 0x2320
// File: /workspace/github_cpp_makefile_star2_O3/ch4rli3kop[P]ch4rli3-fuzzer/main.cc
// Function: run_target(char*, char**)
void run_target(char* target, char* argvs[]){

	pid_t pid = fork();
	int state;

	if (pid < 0){
		perror("fork() error!\n");
		exit(-1);
	}
	else if (pid == 0){
		execv(target, argvs);
		totalexec++;
		exit(0);
	}
	else {
		wait(&state);

		// Check if the testcase causes crash.
		if (is_crashed(state)){
			Add_to_report(state);
		}


		// Check if the testcase hits new code path.
		if (is_newPath()){
			// If it hits new code path, Add to corpus.
			Add_to_corpus();	
		}

		//printf("status : %d\n", state);
		//printf("child exited!\n");
	}	
	
	
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
subq $0x10, %rsp
movq %rsi, %rbx
movq %rdi, %r14
callq 0x2070
testl %eax, %eax
js 0x2c80
je 0x2c85
leaq -0x14(%rbp), %rbx
movq %rbx, %rdi
callq 0x2220
movl (%rbx), %ebx
movl %ebx, %eax
andl $0x7f, %eax
shll $0x18, %eax
addl $0x1000000, %eax        # imm = 0x1000000
cmpl $0x2000000, %eax        # imm = 0x2000000
jl 0x2c69
callq 0x270b
movl %ebx, %edi
callq 0x29bc
callq 0x25ec
testb %al, %al
je 0x2c77
callq 0x2b56
addq $0x10, %rsp
popq %rbx
popq %r14
popq %rbp
retq
callq 0x23a0
movq %r14, %rdi
movq %rbx, %rsi
callq 0x2190
incl 0x455e(%rip)            # 0x71f4
xorl %edi, %edi
callq 0x2210
// File: /workspace/github_cpp_makefile_star2_O3/ch4rli3kop[P]ch4rli3-fuzzer/main.cc
// Function: shared_memory_init()
void shared_memory_init(){
	int shmID;
	
	if ((shmID = shmget((key_t)1337, 0x1000, IPC_CREAT | 0666)) < 0 ){
		perror("shmget() error!\n");
		exit(-1);
	}
	
	if ((shmAddr = shmat(shmID, (void*)0, 0)) == (void*)-1){
		perror("shmat() error!\n");
		exit(-1);
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movl $0x1000, %esi           # imm = 0x1000
movl $0x539, %edi            # imm = 0x539
movl $0x3b6, %edx            # imm = 0x3B6
callq 0x2100
testl %eax, %eax
js 0x2cd3
movl %eax, %edi
xorl %esi, %esi
xorl %edx, %edx
callq 0x2260
movq %rax, 0x4515(%rip)      # 0x71e0
cmpq $-0x1, %rax
je 0x2cd8
popq %rbp
retq
callq 0x23d0
callq 0x23b8
// File: /workspace/github_cpp_makefile_star2_O3/ch4rli3kop[P]ch4rli3-fuzzer/main.cc
// Function: create_input()
void create_input(){
	// make cur_input file by <vector>input
	uint8_t* data = input.front();
	uint32_t length;

	memcpy((char*)&length, data, 4);

	ofstream out("out/cur_input.j2k", ios::binary);
	out.write((char*)data + 4, length);
	out.close();
	input.pop();
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x208, %rsp            # imm = 0x208
movq 0x4260(%rip), %rax      # 0x7210
movq (%rax), %rbx
movl (%rbx), %r14d
leaq 0x115b(%rip), %rsi      # 0x4118
leaq -0x218(%rbp), %r15
movq %r15, %rdi
movl $0x4, %edx
callq 0x21d0
addq $0x4, %rbx
movq %r15, %rdi
movq %rbx, %rsi
movq %r14, %rdx
callq 0x2240
leaq -0x218(%rbp), %rdi
callq 0x2270
leaq 0x420a(%rip), %rdi      # 0x7200
callq 0x3962
movq 0x3fce(%rip), %rax      # 0x6fd0
movq (%rax), %rcx
movq 0x18(%rax), %rax
leaq -0x210(%rbp), %rdi
movq %rcx, -0x8(%rdi)
movq -0x18(%rcx), %rcx
movq %rax, -0x218(%rbp,%rcx)
callq 0x2160
leaq -0x120(%rbp), %rdi
callq 0x20a0
addq $0x208, %rsp            # imm = 0x208
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
leaq -0x218(%rbp), %rdi
callq 0x2290
movq %rbx, %rdi
callq 0x2320