// File: /workspace/github_cpp_makefile_star2_O1/williewillus[P]panda_scratchpad/src/checker/DiskContents.cpp
// Function: DiskContents::deleteFiles(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::basic_ofstream<char, std::char_traits<char>>&)
bool DiskContents::deleteFiles(string path, ofstream &diff_file) {
  if (path.empty()) {
    return true;
  }

  if (isEmptyDirOrFile(path) == true) {
    if (path.compare("/mnt/pmem0") == 0) {
      return true;
    }
    if (isFile(path) == true) {
      return (unlink(path.c_str()) == 0);
    } else {
      return (rmdir(path.c_str()) == 0);
    }
  }

  DIR *directory = opendir(path.c_str());
  if (directory == NULL) {
    cout << "Couldn't open the directory " << path << endl;
    diff_file << "Couldn't open the directory " << path << endl;
    return false;
  }

  struct dirent *dir_entry;
  while (dir_entry = readdir(directory)) {
    if ((strcmp(dir_entry->d_name, ".") == 0) ||
        (strcmp(dir_entry->d_name, "..") == 0)) {
      continue;
    }

    string subpath = path + "/" + string(dir_entry->d_name);
    bool subpathIsFile = isFile(subpath);
    bool res = deleteFiles(subpath, diff_file);
    if (!res) {
      closedir(directory);
      diff_file << "Couldn't remove directory " << subpath << " " << strerror(errno) << endl;
      cout << "Couldn't remove directory " << subpath << " " << strerror(errno) << endl;
      return res;
    }

    if (!subpathIsFile) {
      if (rmdir(subpath.c_str()) < 0) {
        diff_file << "Couldn't remove directory " << subpath << " "  << strerror(errno) << endl;
        cout << "Couldn't remove directory " << subpath << " " << strerror(errno) << endl;
        return false;
      }
    }
  }
  closedir(directory);
  return true;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xf8, %rsp
movq %rdx, %r13
movq %rdi, -0x98(%rbp)
movq 0x8(%rsi), %rdx
movb $0x1, %r15b
testq %rdx, %rdx
je 0x131db
movq %rsi, %rbx
leaq -0x108(%rbp), %r12
movq %r12, -0x10(%r12)
movq (%rsi), %rsi
addq %rsi, %rdx
leaq -0x118(%rbp), %r14
movq %r14, %rdi
callq 0x8052
movq %r14, %rdi
callq 0x12cce
movl %eax, %r14d
movq -0x118(%rbp), %rdi
cmpq %r12, %rdi
je 0x12e3a
callq 0x5460
testb %r14b, %r14b
je 0x12eac
leaq 0x23ac(%rip), %rsi      # 0x151f2
movq %rbx, %rdi
callq 0x5130
testl %eax, %eax
je 0x131db
leaq -0xe8(%rbp), %r15
movq %r15, -0x10(%r15)
movq (%rbx), %rsi
movq 0x8(%rbx), %rdx
addq %rsi, %rdx
leaq -0xf8(%rbp), %r14
movq %r14, %rdi
callq 0x8052
movq %r14, %rdi
callq 0x12d1c
movl %eax, %r14d
movq -0xf8(%rbp), %rdi
cmpq %r15, %rdi
je 0x12e96
callq 0x5460
movq (%rbx), %rdi
testb %r14b, %r14b
je 0x131d0
callq 0x5210
jmp 0x131d5
movq %r13, -0x50(%rbp)
movq (%rbx), %rdi
callq 0x5660
testq %rax, %rax
je 0x13127
movq %rax, %r13
movq %rax, %rdi
callq 0x5690
testq %rax, %rax
je 0x13117
movq %rax, %r14
leaq -0xb8(%rbp), %r15
addq $0x13, %r14
movq %r14, %rdi
leaq 0x2753(%rip), %rsi      # 0x15640
callq 0x55c0
testl %eax, %eax
je 0x13103
movq %r14, %rdi
leaq 0x273b(%rip), %rsi      # 0x1563f
callq 0x55c0
testl %eax, %eax
je 0x13103
leaq -0x60(%rbp), %rax
movq %rax, -0x70(%rbp)
movq (%rbx), %rsi
movq 0x8(%rbx), %rdx
addq %rsi, %rdx
leaq -0x70(%rbp), %r12
movq %r12, %rdi
callq 0x8052
movq %r12, %rdi
leaq 0x26e1(%rip), %rsi      # 0x1561a
callq 0x5860
leaq -0x80(%rbp), %rax
movq %rax, -0x90(%rbp)
movq %r14, %rdi
callq 0x51f0
leaq (%rax,%r14), %rdx
leaq -0x90(%rbp), %rdi
movq %r14, %rsi
callq 0x80ec
movq -0x70(%rbp), %rcx
movl $0xf, %esi
leaq -0x60(%rbp), %rax
cmpq %rax, %rcx
leaq -0xd8(%rbp), %r14
movq %r15, %r12
je 0x12f84
movq -0x60(%rbp), %rsi
movq -0x68(%rbp), %r8
movq -0x88(%rbp), %rdx
leaq (%rdx,%r8), %rax
cmpq %rsi, %rax
jbe 0x12fb3
movl $0xf, %esi
leaq -0x80(%rbp), %rdi
cmpq %rdi, -0x90(%rbp)
je 0x12fae
movq -0x80(%rbp), %rsi
cmpq %rsi, %rax
jbe 0x12fc5
movq -0x90(%rbp), %rsi
leaq -0x70(%rbp), %rdi
callq 0x5160
jmp 0x12fd5
leaq -0x90(%rbp), %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x54e0
leaq -0x38(%rbp), %rsi
movq %rsi, -0x48(%rbp)
movq (%rax), %rdx
leaq 0x10(%rax), %rcx
cmpq %rcx, %rdx
je 0x12ff6
movq %rdx, -0x48(%rbp)
movq (%rcx), %rdx
movq %rdx, -0x38(%rbp)
jmp 0x12ffc
movups (%rcx), %xmm0
movups %xmm0, (%rsi)
movq %rax, %rdx
addq $0x8, %rdx
movq 0x8(%rax), %rsi
movq %rsi, -0x40(%rbp)
movq %rcx, (%rax)
movq $0x0, (%rdx)
movb $0x0, (%rcx)
movq -0x90(%rbp), %rdi
leaq -0x80(%rbp), %rax
cmpq %rax, %rdi
je 0x1302d
callq 0x5460
movq -0x70(%rbp), %rdi
leaq -0x60(%rbp), %rax
cmpq %rax, %rdi
je 0x1303f
callq 0x5460
leaq -0xc8(%rbp), %rax
movq %rax, -0xd8(%rbp)
movq -0x48(%rbp), %rsi
movq -0x40(%rbp), %rdx
addq %rsi, %rdx
movq %r14, %rdi
callq 0x8052
movq %r14, %rdi
callq 0x12d1c
movl %eax, %r14d
movq -0xd8(%rbp), %rdi
leaq -0xc8(%rbp), %rax
cmpq %rax, %rdi
je 0x13083
callq 0x5460
leaq -0xa8(%rbp), %rax
movq %rax, -0xb8(%rbp)
movq -0x48(%rbp), %rsi
movq -0x40(%rbp), %rdx
addq %rsi, %rdx
movq %r12, %rdi
callq 0x8052
movq -0x98(%rbp), %rdi
movq %r12, %rsi
movq -0x50(%rbp), %rdx
callq 0x12dcc
movl %eax, %r12d
movq -0xb8(%rbp), %rdi
leaq -0xa8(%rbp), %rax
cmpq %rax, %rdi
je 0x130d2
callq 0x5460
testb %r12b, %r12b
je 0x131f0
testb %r14b, %r14b
jne 0x130f1
movq -0x48(%rbp), %rdi
callq 0x51e0
testl %eax, %eax
js 0x13271
movq -0x48(%rbp), %rdi
leaq -0x38(%rbp), %rax
cmpq %rax, %rdi
je 0x13103
callq 0x5460
movq %r13, %rdi
callq 0x5690
movq %rax, %r14
testq %rax, %rax
jne 0x12edf
movq %r13, %rdi
callq 0x56f0
movb $0x1, %r15b
jmp 0x131db
movq 0x8e9a(%rip), %r15      # 0x1bfc8
leaq 0x263f(%rip), %r14      # 0x15774
movl $0x1c, %edx
movq %r15, %rdi
movq %r14, %rsi
callq 0x54f0
movq (%rbx), %rsi
movq 0x8(%rbx), %rdx
movq %r15, %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
movl $0x1c, %edx
movq -0x50(%rbp), %r15
movq %r15, %rdi
movq %r14, %rsi
callq 0x54f0
movq (%rbx), %rsi
movq 0x8(%rbx), %rdx
movq %r15, %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 %r15d, %r15d
jmp 0x131db
callq 0x51e0
testl %eax, %eax
sete %r15b
movl %r15d, %eax
addq $0xf8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %r13, %rdi
callq 0x56f0
leaq 0x2592(%rip), %rsi      # 0x15791
movl $0x1a, %edx
movq -0x50(%rbp), %rbx
movq %rbx, %rdi
leaq -0x38(%rbp), %r12
callq 0x54f0
movq -0x48(%rbp), %rsi
movq -0x40(%rbp), %rdx
movq %rbx, %rdi
callq 0x54f0
movq %rax, %r14
leaq 0x2439(%rip), %rsi      # 0x15667
movl $0x1, %edx
movq %rax, %rdi
callq 0x54f0
callq 0x5060
movq %rax, %rbx
movl (%rax), %edi
callq 0x5190
testq %rax, %rax
je 0x13338
movq %rax, %r15
movq %rax, %rdi
callq 0x51f0
movq %r14, %rdi
movq %r15, %rsi
movq %rax, %rdx
callq 0x54f0
jmp 0x13352
leaq 0x2519(%rip), %rsi      # 0x15791
movl $0x1a, %edx
movq -0x50(%rbp), %rbx
movq %rbx, %rdi
leaq -0x38(%rbp), %r12
callq 0x54f0
movq -0x48(%rbp), %rsi
movq -0x40(%rbp), %rdx
movq %rbx, %rdi
callq 0x54f0
movq %rax, %r14
leaq 0x23c0(%rip), %rsi      # 0x15667
movl $0x1, %edx
movq %rax, %rdi
callq 0x54f0
callq 0x5060
movq %rax, %rbx
movl (%rax), %edi
callq 0x5190
movq %r14, %rdi
movq %rax, %rsi
callq 0x5480
movq %rax, %rdi
callq 0x5220
movq 0x8ceb(%rip), %rdi      # 0x1bfc8
leaq 0x24ad(%rip), %rsi      # 0x15791
movl $0x1a, %edx
callq 0x54f0
movq -0x48(%rbp), %rsi
movq -0x40(%rbp), %rdx
movq 0x8ccb(%rip), %rdi      # 0x1bfc8
callq 0x54f0
movq %rax, %r14
leaq 0x235b(%rip), %rsi      # 0x15667
movl $0x1, %edx
movq %rax, %rdi
callq 0x54f0
movl (%rbx), %edi
callq 0x5190
movq %r14, %rdi
movq %rax, %rsi
callq 0x5480
movq %rax, %rdi
callq 0x5220
jmp 0x13424
movq (%r14), %rax
movq -0x18(%rax), %rax
movq %r14, %rdi
addq %rax, %rdi
movl 0x20(%r14,%rax), %esi
orl $0x1, %esi
callq 0x5770
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 0x8c48(%rip), %rdi      # 0x1bfc8
leaq 0x240a(%rip), %rsi      # 0x15791
movl $0x1a, %edx
callq 0x54f0
movq -0x48(%rbp), %rsi
movq -0x40(%rbp), %rdx
movq 0x8c28(%rip), %rdi      # 0x1bfc8
callq 0x54f0
movq %rax, %r14
leaq 0x22b8(%rip), %rsi      # 0x15667
movl $0x1, %edx
movq %rax, %rdi
callq 0x54f0
movl (%rbx), %edi
callq 0x5190
testq %rax, %rax
je 0x133e3
movq %rax, %rbx
movq %rax, %rdi
callq 0x51f0
movq %r14, %rdi
movq %rbx, %rsi
movq %rax, %rdx
callq 0x54f0
jmp 0x133fd
movq (%r14), %rax
movq -0x18(%rax), %rax
movq %r14, %rdi
addq %rax, %rdi
movl 0x20(%r14,%rax), %esi
orl $0x1, %esi
callq 0x5770
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 -0x48(%rbp), %rdi
cmpq %r12, %rdi
je 0x131cb
callq 0x5460
jmp 0x131cb
movq %rax, %rbx
movq -0xf8(%rbp), %rdi
cmpq %r15, %rdi
jne 0x134d1
jmp 0x134d6
jmp 0x1349a
movq %rax, %rbx
movq -0x118(%rbp), %rdi
cmpq %r12, %rdi
jne 0x134d1
jmp 0x134d6
jmp 0x134c1
movq %rax, %rbx
movq -0xb8(%rbp), %rdi
leaq -0xa8(%rbp), %rax
jmp 0x1348e
jmp 0x1349a
movq %rax, %rbx
movq -0xd8(%rbp), %rdi
leaq -0xc8(%rbp), %rax
cmpq %rax, %rdi
je 0x1349d
callq 0x5460
jmp 0x1349d
movq %rax, %rbx
movq -0x48(%rbp), %rdi
leaq -0x38(%rbp), %rax
jmp 0x134cc
movq %rax, %rbx
movq -0x90(%rbp), %rdi
leaq -0x80(%rbp), %rax
cmpq %rax, %rdi
je 0x134c4
callq 0x5460
jmp 0x134c4
movq %rax, %rbx
movq -0x70(%rbp), %rdi
leaq -0x60(%rbp), %rax
cmpq %rax, %rdi
je 0x134d6
callq 0x5460
movq %rbx, %rdi
callq 0x57c0