// File: 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
subq $0x4e0, %rsp            # imm = 0x4E0
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x478(%rbp)
movq -0x10(%rbp), %rdi
callq 0x6750
movq %rax, -0x18(%rbp)
cmpq $0x0, %rax
jne 0x1f9a6
jmp 0x1ff08
movq -0x18(%rbp), %rdi
callq 0x6780
movq %rax, -0x20(%rbp)
cmpq $0x0, %rax
jne 0x1f9c7
movq -0x18(%rbp), %rdi
callq 0x67e0
jmp 0x1ff08
jmp 0x1f9c9
movq -0x10(%rbp), %rax
movq %rax, -0x488(%rbp)
leaq -0x41(%rbp), %rdi
movq %rdi, -0x480(%rbp)
callq 0x68b0
movq -0x488(%rbp), %rsi
movq -0x480(%rbp), %rdx
leaq -0x40(%rbp), %rdi
callq 0x6670
jmp 0x1f9fd
leaq -0x41(%rbp), %rdi
callq 0x6590
movq -0x20(%rbp), %rax
addq $0x13, %rax
movq %rax, -0x498(%rbp)
leaq -0x79(%rbp), %rdi
movq %rdi, -0x490(%rbp)
callq 0x68b0
movq -0x498(%rbp), %rsi
movq -0x490(%rbp), %rdx
leaq -0x78(%rbp), %rdi
callq 0x6670
jmp 0x1fa3e
leaq -0x79(%rbp), %rdi
callq 0x6590
leaq 0x5dbc(%rip), %rdx      # 0x2580a
leaq -0xc0(%rbp), %rdi
leaq -0x40(%rbp), %rsi
callq 0x226a0
jmp 0x1fa60
leaq -0xa0(%rbp), %rdi
leaq -0xc0(%rbp), %rsi
leaq -0x78(%rbp), %rdx
callq 0x18db0
jmp 0x1fa79
leaq -0xc0(%rbp), %rdi
callq 0x69d8
leaq -0xe0(%rbp), %rdi
leaq -0xa0(%rbp), %rsi
callq 0x6240
jmp 0x1fa9a
movq -0x478(%rbp), %rdi
addq $0x28, %rdi
callq 0x6740
movq %rax, %rdx
xorl %eax, %eax
movl %eax, %esi
leaq -0xe0(%rbp), %rdi
callq 0x60e0
jmp 0x1fabf
leaq -0x338(%rbp), %rdi
callq 0x1ed20
jmp 0x1facd
leaq -0xa0(%rbp), %rdi
callq 0x6220
movq %rax, %rdi
leaq -0x170(%rbp), %rsi
callq 0x64b0
cmpl $-0x1, %eax
jne 0x1fb84
movl $0x3, -0x33c(%rbp)
jmp 0x1fea2
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
leaq -0x41(%rbp), %rdi
callq 0x6590
jmp 0x1ff47
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
leaq -0x79(%rbp), %rdi
callq 0x6590
jmp 0x1ff3e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
jmp 0x1ff35
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
leaq -0xc0(%rbp), %rdi
callq 0x69d8
jmp 0x1ff35
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
jmp 0x1ff29
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
jmp 0x1ff1d
movq -0x20(%rbp), %rax
movzbl 0x12(%rax), %eax
cmpl $0x4, %eax
jne 0x1fc8b
movq -0x20(%rbp), %rdi
addq $0x13, %rdi
leaq 0x5c8c(%rip), %rsi      # 0x25830
callq 0x66b0
cmpl $0x0, %eax
je 0x1fbc7
movq -0x20(%rbp), %rdi
addq $0x13, %rdi
leaq 0x5c72(%rip), %rsi      # 0x2582f
callq 0x66b0
cmpl $0x0, %eax
jne 0x1fbd6
movl $0x3, -0x33c(%rbp)
jmp 0x1fea2
movq -0x20(%rbp), %rsi
leaq -0x338(%rbp), %rdi
callq 0x1ee20
leaq -0x360(%rbp), %rdi
leaq -0xa0(%rbp), %rsi
callq 0x6240
jmp 0x1fbfb
leaq -0x338(%rbp), %rdi
leaq -0x360(%rbp), %rsi
movq %rsi, -0x4a8(%rbp)
xorl %edx, %edx
callq 0x1ee90
movq -0x4a8(%rbp), %rdi
callq 0x69d8
movq -0x478(%rbp), %rdi
addq $0x68, %rdi
leaq -0xe0(%rbp), %rsi
callq 0x22720
movq %rax, -0x4a0(%rbp)
jmp 0x1fc43
movq -0x4a0(%rbp), %rdi
leaq -0x338(%rbp), %rsi
callq 0x22800
jmp 0x1fc58
leaq -0xa0(%rbp), %rdi
callq 0x6220
movq -0x478(%rbp), %rdi
movq %rax, %rsi
callq 0x1f970
jmp 0x1fc75
jmp 0x1fe98
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
jmp 0x1ff11
movq -0x20(%rbp), %rax
movzbl 0x12(%rax), %eax
cmpl $0xa, %eax
jne 0x1fd45
leaq -0xa0(%rbp), %rdi
callq 0x6220
movq %rax, %rdi
leaq -0x3f0(%rbp), %rsi
callq 0x6960
cmpl $-0x1, %eax
jne 0x1fccb
movl $0x3, -0x33c(%rbp)
jmp 0x1fea2
leaq -0x410(%rbp), %rdi
leaq -0xa0(%rbp), %rsi
callq 0x6240
jmp 0x1fce0
leaq -0x338(%rbp), %rdi
leaq -0x410(%rbp), %rsi
movq %rsi, -0x4b8(%rbp)
movl $0x1, %edx
callq 0x1ee90
movq -0x4b8(%rbp), %rdi
callq 0x69d8
movq -0x478(%rbp), %rdi
addq $0x68, %rdi
leaq -0xe0(%rbp), %rsi
callq 0x22720
movq %rax, -0x4b0(%rbp)
jmp 0x1fd2b
movq -0x4b0(%rbp), %rdi
leaq -0x338(%rbp), %rsi
callq 0x22800
jmp 0x1fd40
jmp 0x1fe96
movq -0x20(%rbp), %rax
movzbl 0x12(%rax), %eax
cmpl $0x8, %eax
jne 0x1fe20
leaq -0x430(%rbp), %rdi
leaq -0xa0(%rbp), %rsi
callq 0x6240
jmp 0x1fd6b
leaq -0x338(%rbp), %rdi
leaq -0x430(%rbp), %rsi
callq 0x1ef00
jmp 0x1fd80
leaq -0x430(%rbp), %rdi
callq 0x69d8
leaq -0x450(%rbp), %rdi
leaq -0xa0(%rbp), %rsi
callq 0x6240
jmp 0x1fda1
leaq -0x338(%rbp), %rdi
leaq -0x450(%rbp), %rsi
movq %rsi, -0x4c8(%rbp)
xorl %edx, %edx
callq 0x1ee90
movq -0x4c8(%rbp), %rdi
callq 0x69d8
movq -0x478(%rbp), %rdi
addq $0x68, %rdi
leaq -0xe0(%rbp), %rsi
callq 0x22720
movq %rax, -0x4c0(%rbp)
jmp 0x1fde9
movq -0x4c0(%rbp), %rdi
leaq -0x338(%rbp), %rsi
callq 0x22800
jmp 0x1fdfe
jmp 0x1fe94
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
leaq -0x430(%rbp), %rdi
callq 0x69d8
jmp 0x1ff11
leaq -0x470(%rbp), %rdi
leaq -0xa0(%rbp), %rsi
callq 0x6240
jmp 0x1fe35
leaq -0x338(%rbp), %rdi
leaq -0x470(%rbp), %rsi
movq %rsi, -0x4d8(%rbp)
xorl %edx, %edx
callq 0x1ee90
movq -0x4d8(%rbp), %rdi
callq 0x69d8
movq -0x478(%rbp), %rdi
addq $0x68, %rdi
leaq -0xe0(%rbp), %rsi
callq 0x22720
movq %rax, -0x4d0(%rbp)
jmp 0x1fe7d
movq -0x4d0(%rbp), %rdi
leaq -0x338(%rbp), %rsi
callq 0x22800
jmp 0x1fe92
jmp 0x1fe94
jmp 0x1fe96
jmp 0x1fe98
movl $0x0, -0x33c(%rbp)
leaq -0x338(%rbp), %rdi
callq 0x1edf0
leaq -0xe0(%rbp), %rdi
callq 0x69d8
leaq -0xa0(%rbp), %rdi
callq 0x69d8
leaq -0x78(%rbp), %rdi
callq 0x69d8
leaq -0x40(%rbp), %rdi
callq 0x69d8
movl -0x33c(%rbp), %eax
testl %eax, %eax
je 0x1fee6
jmp 0x1fee4
jmp 0x1fee8
jmp 0x1fee8
movq -0x18(%rbp), %rdi
callq 0x6780
movq %rax, -0x20(%rbp)
cmpq $0x0, %rax
jne 0x1f9c9
movq -0x18(%rbp), %rdi
callq 0x67e0
addq $0x4e0, %rsp            # imm = 0x4E0
popq %rbp
retq
leaq -0x338(%rbp), %rdi
callq 0x1edf0
leaq -0xe0(%rbp), %rdi
callq 0x69d8
leaq -0xa0(%rbp), %rdi
callq 0x69d8
leaq -0x78(%rbp), %rdi
callq 0x69d8
leaq -0x40(%rbp), %rdi
callq 0x69d8
movq -0x50(%rbp), %rdi
callq 0x68a0