// File: /workspace/github_cpp_makefile_star2_O2/williewillus[P]panda_scratchpad/src/checker/DiskContents.cpp
// Function: DiskContents::get_contents(char const*)
void DiskContents::get_contents(const char* path) {
  DIR *directory;
  struct dirent *dir_entry;
  // open both the directories
  if (!(directory = opendir(path))) {
    return;
  }
  // get the contents in both the directories
  if (!(dir_entry = readdir(directory))) {
    closedir(directory);
    return;
  }
  do {
    string parent_path(path);
    string filename(dir_entry->d_name);
    string current_path = parent_path + "/" + filename;
    string relative_path = current_path;
    relative_path.erase(0, mount_point.length());
    struct stat statbuf;
    fileAttributes fa;
    if (stat(current_path.c_str(), &statbuf) == -1) {
      continue;
    }
    if (dir_entry->d_type == DT_DIR) {
      if ((strcmp(dir_entry->d_name, ".") == 0) || (strcmp(dir_entry->d_name, "..") == 0)) {
        continue;
      }
      fa.set_dir_attr(dir_entry);
      fa.set_stat_attr(current_path, false);
      contents[relative_path] = fa;
      // If the entry is a directory and not . or .. make a recursive call
      get_contents(current_path.c_str());
    } else if (dir_entry->d_type == DT_LNK) {
      // compare lstat outputs
      struct stat lstatbuf;
      if (lstat(current_path.c_str(), &lstatbuf) == -1) {
        continue;
      }
      fa.set_stat_attr(current_path, true);
      contents[relative_path] = fa;
    } else if (dir_entry->d_type == DT_REG) {
      fa.set_md5sum(current_path);
      fa.set_stat_attr(current_path, false);
      contents[relative_path] = fa;
    } else {
      fa.set_stat_attr(current_path, false);
      contents[relative_path] = fa;
    }
  } while (dir_entry = readdir(directory));
  closedir(directory);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x428, %rsp            # imm = 0x428
movq %rdi, -0x38(%rbp)
movq %rsi, -0x48(%rbp)
movq %rsi, %rdi
callq 0x5640
testq %rax, %rax
je 0xeb27
movq %rax, %rbx
movq %rax, %rdi
callq 0x5670
testq %rax, %rax
je 0xeb39
movq %rax, %r12
movq %rbx, -0x40(%rbp)
movq -0x38(%rbp), %rax
addq $0x68, %rax
movq %rax, -0x30(%rbp)
leaq -0x108(%rbp), %r15
leaq -0x330(%rbp), %r14
leaq -0xa8(%rbp), %r13
movq %r15, %rdi
movq -0x48(%rbp), %rsi
movq %r14, %rdx
callq 0x51c0
leaq 0x13(%r12), %rbx
movq %r13, %rdi
movq %rbx, %rsi
movq %r14, %rdx
callq 0x51c0
movq %r14, %r13
movq %r14, %rdi
movq %r15, %rsi
leaq 0x3d43(%rip), %rdx      # 0x1261a
callq 0x1014f
leaq -0x88(%rbp), %r14
movq %r14, %rdi
movq %r13, %rsi
leaq -0xa8(%rbp), %rdx
callq 0xbdfa
movq %r13, %rdi
callq 0x58a8
leaq -0x68(%rbp), %r15
movq %r15, %rdi
movq %r14, %rsi
callq 0x5580
movq -0x38(%rbp), %rax
movq 0x30(%rax), %rdx
movq %r15, %rdi
xorl %esi, %esi
callq 0x50b0
movq %r13, %rdi
callq 0xe0e0
movq -0x88(%rbp), %rdi
leaq -0x450(%rbp), %rsi
callq 0x5420
cmpl $-0x1, %eax
je 0xeacf
movzbl 0x12(%r12), %eax
cmpl $0xa, %eax
je 0xea2b
cmpl $0x8, %eax
je 0xe9ee
cmpl $0x4, %eax
jne 0xea8e
cmpb $0x2e, (%rbx)
jne 0xe988
cmpb $0x0, 0x14(%r12)
je 0xeacf
cmpb $0x2e, 0x14(%r12)
jne 0xe988
cmpb $0x0, 0x15(%r12)
je 0xeacf
movq %r13, %rdi
movq %r12, %rsi
callq 0xe176
leaq -0xe8(%rbp), %rdi
movq %r14, %rsi
callq 0x5580
movq -0xe8(%rbp), %rdi
leaq -0x218(%rbp), %rsi
callq 0x5420
leaq -0xe8(%rbp), %rdi
callq 0x58a8
movq -0x30(%rbp), %rdi
leaq -0x68(%rbp), %rsi
callq 0x10188
movq %rax, %rdi
movq %r13, %rsi
callq 0x101f2
movq -0x88(%rbp), %rsi
movq -0x38(%rbp), %rdi
callq 0xe83c
jmp 0xeacf
leaq -0xc8(%rbp), %rdi
movq %r14, %rsi
callq 0x5580
movq %r13, %rdi
leaq -0xc8(%rbp), %rbx
movq %rbx, %rsi
callq 0xe1e0
movq %rbx, %rdi
callq 0x58a8
leaq -0x168(%rbp), %rbx
movq %rbx, %rdi
movq %r14, %rsi
callq 0x5580
jmp 0xeaa0
movq -0x88(%rbp), %rdi
leaq -0x3c0(%rbp), %rsi
callq 0x5840
cmpl $-0x1, %eax
je 0xeacf
leaq -0x128(%rbp), %rbx
movq %rbx, %rdi
movq %r14, %rsi
callq 0x5580
movq -0x128(%rbp), %rdi
leaq -0x218(%rbp), %rsi
callq 0x5840
movq %rbx, %rdi
callq 0x58a8
movq -0x30(%rbp), %rdi
leaq -0x68(%rbp), %rsi
callq 0x10188
movq %rax, %rdi
movq %r13, %rsi
callq 0x101f2
jmp 0xeacf
leaq -0x148(%rbp), %rbx
movq %rbx, %rdi
movq %r14, %rsi
callq 0x5580
movq (%rbx), %rdi
leaq -0x218(%rbp), %rsi
callq 0x5420
movq %rbx, %rdi
callq 0x58a8
movq -0x30(%rbp), %rdi
leaq -0x68(%rbp), %rsi
callq 0x10188
movq %rax, %rdi
movq %r13, %rsi
callq 0x101f2
movq %r13, %rdi
callq 0xe164
leaq -0x68(%rbp), %rdi
callq 0x58a8
movq %r14, %rdi
callq 0x58a8
movq %r13, %r14
leaq -0xa8(%rbp), %r13
movq %r13, %rdi
callq 0x58a8
leaq -0x108(%rbp), %r15
movq %r15, %rdi
callq 0x58a8
movq -0x40(%rbp), %rdi
callq 0x5670
movq %rax, %r12
testq %rax, %rax
jne 0xe8a5
movq -0x40(%rbp), %rdi
callq 0x56d0
addq $0x428, %rsp            # imm = 0x428
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rbx, %rdi
addq $0x428, %rsp            # imm = 0x428
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x56d0
movq %rax, %rbx
leaq -0xc8(%rbp), %rdi
callq 0x58a8
jmp 0xeb8a
jmp 0xeb87
movq %rax, %rbx
jmp 0xebb7
movq %rax, %rbx
jmp 0xebab
movq %rax, %rbx
leaq -0x330(%rbp), %rdi
jmp 0xeba6
movq %rax, %rbx
jmp 0xeb9f
jmp 0xeb82
movq %rax, %rbx
jmp 0xeb96
movq %rax, %rbx
leaq -0x330(%rbp), %rdi
callq 0xe164
leaq -0x68(%rbp), %rdi
callq 0x58a8
leaq -0x88(%rbp), %rdi
callq 0x58a8
leaq -0xa8(%rbp), %rdi
callq 0x58a8
leaq -0x108(%rbp), %rdi
callq 0x58a8
movq %rbx, %rdi
callq 0x5780
nop