// File: williewillus[P]panda_scratchpad/src/checker/DiskContents.cpp
// Function: DiskContents::compare_entries_at_path(DiskContents&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>&, std::basic_ofstream<char, std::char_traits<char>>&)
bool DiskContents::compare_entries_at_path(DiskContents &compare_disk,
  string &path, ofstream &diff_file) {
  bool retValue = true;

  if (disk_path.compare(compare_disk.disk_path) == 0) {
    return retValue;
  }

  string base_path = "/mnt/pmem0" + path;

  /*if (compare_disk.mount_disk() != 0) {
    cout << "Mounting " << compare_disk.disk_path << " failed" << endl;
  }*/

  string compare_disk_mount_point(compare_disk.get_mount_point());
  string compare_path = compare_disk_mount_point + path;

  fileAttributes base_fa, compare_fa;
  bool failed_stat = false;
  struct stat base_statbuf, compare_statbuf;
  if (stat(base_path.c_str(), &base_statbuf) == -1) {
    diff_file << "Failed stating the file " << base_path << endl;
    failed_stat = true;
  }
  if (stat(compare_path.c_str(), &compare_statbuf) == -1) {
    diff_file << "Failed stating the file " << compare_path << endl;
    failed_stat = true;
  }

  if (failed_stat) {
    //compare_disk.unmount_and_delete_mount_point();
    return false;
  }

  base_fa.set_stat_attr(base_path, false);
  compare_fa.set_stat_attr(compare_path, false);
  if (!(base_fa.compare_stat_attr(compare_fa.stat_attr))) {
    diff_file << "DIFF: Content Mismatch " << path << endl << endl;
    diff_file << base_path << ":" << endl;
    diff_file << base_fa << endl << endl;
    diff_file << compare_path << ":" << endl;
    diff_file << compare_fa << endl << endl;
    //compare_disk.unmount_and_delete_mount_point();
    return false;
  }

  if (base_fa.is_regular_file()) {
    base_fa.set_md5sum(base_path);
    compare_fa.set_md5sum(compare_path);
    if (base_fa.compare_md5sum(compare_fa.md5sum) != 0) {
      diff_file << "DIFF : Data Mismatch of " << path << endl;
      diff_file << base_path << " has md5sum " << base_fa.md5sum << endl;
      diff_file << compare_path << " has md5sum " << compare_fa.md5sum;
      diff_file << endl << endl;
      //compare_disk.unmount_and_delete_mount_point();
      return false;
    }
  }

  //compare_disk.unmount_and_delete_mount_point();
  return retValue;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x7f0, %rsp            # imm = 0x7F0
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movq %rcx, -0x28(%rbp)
movq -0x10(%rbp), %rdi
movb $0x1, -0x29(%rbp)
addq $0x8, %rdi
movq -0x18(%rbp), %rsi
addq $0x8, %rsi
callq 0x6050
cmpl $0x0, %eax
jne 0x20aa6
movb -0x29(%rbp), %al
andb $0x1, %al
movb %al, -0x1(%rbp)
jmp 0x21186
movq -0x20(%rbp), %rdx
leaq 0x48f2(%rip), %rsi      # 0x253a3
leaq -0x50(%rbp), %rdi
callq 0x18c40
movq -0x18(%rbp), %rsi
leaq -0x70(%rbp), %rdi
callq 0x1ff50
jmp 0x20ac9
movq -0x20(%rbp), %rdx
leaq -0xa0(%rbp), %rdi
leaq -0x70(%rbp), %rsi
callq 0x22a00
jmp 0x20adf
leaq -0x268(%rbp), %rdi
callq 0x1ed20
jmp 0x20aed
leaq -0x430(%rbp), %rdi
callq 0x1ed20
jmp 0x20afb
movb $0x0, -0x431(%rbp)
leaq -0x50(%rbp), %rdi
callq 0x6220
movq %rax, %rdi
leaq -0x4c8(%rbp), %rsi
callq 0x64b0
cmpl $-0x1, %eax
jne 0x20bc8
movq -0x28(%rbp), %rdi
leaq 0x4d93(%rip), %rsi      # 0x258c1
callq 0x6520
movq %rax, -0x698(%rbp)
jmp 0x20b3c
movq -0x698(%rbp), %rdi
leaq -0x50(%rbp), %rsi
callq 0x64a0
movq %rax, -0x6a0(%rbp)
jmp 0x20b55
movq -0x6a0(%rbp), %rdi
movq 0x14435(%rip), %rsi     # 0x34f98
callq 0x6580
jmp 0x20b6a
movb $0x1, -0x431(%rbp)
jmp 0x20bc8
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x78(%rbp)
movl %eax, -0x7c(%rbp)
jmp 0x2117b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x78(%rbp)
movl %eax, -0x7c(%rbp)
jmp 0x21172
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x78(%rbp)
movl %eax, -0x7c(%rbp)
jmp 0x21166
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x78(%rbp)
movl %eax, -0x7c(%rbp)
jmp 0x2115a
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x78(%rbp)
movl %eax, -0x7c(%rbp)
jmp 0x2114e
leaq -0xa0(%rbp), %rdi
callq 0x6220
movq %rax, %rdi
leaq -0x558(%rbp), %rsi
callq 0x64b0
cmpl $-0x1, %eax
jne 0x20c39
movq -0x28(%rbp), %rdi
leaq 0x4cce(%rip), %rsi      # 0x258c1
callq 0x6520
movq %rax, -0x6a8(%rbp)
jmp 0x20c01
movq -0x6a8(%rbp), %rdi
leaq -0xa0(%rbp), %rsi
callq 0x64a0
movq %rax, -0x6b0(%rbp)
jmp 0x20c1d
movq -0x6b0(%rbp), %rdi
movq 0x1436d(%rip), %rsi     # 0x34f98
callq 0x6580
jmp 0x20c32
movb $0x1, -0x431(%rbp)
testb $0x1, -0x431(%rbp)
je 0x20c55
movb $0x0, -0x1(%rbp)
movl $0x1, -0x55c(%rbp)
jmp 0x21116
leaq -0x580(%rbp), %rdi
leaq -0x50(%rbp), %rsi
callq 0x6240
jmp 0x20c67
leaq -0x268(%rbp), %rdi
leaq -0x580(%rbp), %rsi
movq %rsi, -0x6b8(%rbp)
xorl %edx, %edx
callq 0x1ee90
movq -0x6b8(%rbp), %rdi
callq 0x69d8
leaq -0x5a0(%rbp), %rdi
leaq -0xa0(%rbp), %rsi
callq 0x6240
jmp 0x20ca4
leaq -0x430(%rbp), %rdi
leaq -0x5a0(%rbp), %rsi
xorl %edx, %edx
callq 0x1ee90
leaq -0x5a0(%rbp), %rdi
callq 0x69d8
leaq -0x430(%rbp), %rsi
addq $0x118, %rsi            # imm = 0x118
leaq -0x630(%rbp), %rdi
movl $0x90, %edx
callq 0x6450
movq %rsp, %rdi
movl $0x12, %ecx
leaq -0x630(%rbp), %rsi
rep  movsq (%rsi), %es:(%rdi)
leaq -0x268(%rbp), %rdi
callq 0x1f0f0
testb $0x1, %al
jne 0x20ea5
movq -0x28(%rbp), %rdi
leaq 0x4b6e(%rip), %rsi      # 0x25883
callq 0x6520
movq %rax, -0x6c0(%rbp)
jmp 0x20d23
movq -0x6c0(%rbp), %rdi
movq -0x20(%rbp), %rsi
callq 0x64a0
movq %rax, -0x6c8(%rbp)
jmp 0x20d3c
movq -0x6c8(%rbp), %rdi
movq 0x1424e(%rip), %rsi     # 0x34f98
callq 0x6580
movq %rax, -0x6d0(%rbp)
jmp 0x20d58
movq -0x6d0(%rbp), %rdi
movq 0x14232(%rip), %rsi     # 0x34f98
callq 0x6580
jmp 0x20d6d
movq -0x28(%rbp), %rdi
leaq -0x50(%rbp), %rsi
callq 0x64a0
movq %rax, -0x6d8(%rbp)
jmp 0x20d83
movq -0x6d8(%rbp), %rdi
leaq 0x4ad1(%rip), %rsi      # 0x25862
callq 0x6520
movq %rax, -0x6e0(%rbp)
jmp 0x20d9f
movq -0x6e0(%rbp), %rdi
movq 0x141eb(%rip), %rsi     # 0x34f98
callq 0x6580
jmp 0x20db4
movq -0x28(%rbp), %rdi
leaq -0x268(%rbp), %rsi
callq 0x1f240
movq %rax, -0x6e8(%rbp)
jmp 0x20dcd
movq -0x6e8(%rbp), %rdi
movq 0x141bd(%rip), %rsi     # 0x34f98
callq 0x6580
movq %rax, -0x6f0(%rbp)
jmp 0x20de9
movq -0x6f0(%rbp), %rdi
movq 0x141a1(%rip), %rsi     # 0x34f98
callq 0x6580
jmp 0x20dfe
movq -0x28(%rbp), %rdi
leaq -0xa0(%rbp), %rsi
callq 0x64a0
movq %rax, -0x6f8(%rbp)
jmp 0x20e17
movq -0x6f8(%rbp), %rdi
leaq 0x4a3d(%rip), %rsi      # 0x25862
callq 0x6520
movq %rax, -0x700(%rbp)
jmp 0x20e33
movq -0x700(%rbp), %rdi
movq 0x14157(%rip), %rsi     # 0x34f98
callq 0x6580
jmp 0x20e48
movq -0x28(%rbp), %rdi
leaq -0x430(%rbp), %rsi
callq 0x1f240
movq %rax, -0x708(%rbp)
jmp 0x20e61
movq -0x708(%rbp), %rdi
movq 0x14129(%rip), %rsi     # 0x34f98
callq 0x6580
movq %rax, -0x710(%rbp)
jmp 0x20e7d
movq -0x710(%rbp), %rdi
movq 0x1410d(%rip), %rsi     # 0x34f98
callq 0x6580
jmp 0x20e92
movb $0x0, -0x1(%rbp)
movl $0x1, -0x55c(%rbp)
jmp 0x21116
leaq -0x268(%rbp), %rdi
callq 0x1f210
testb $0x1, %al
jne 0x20eba
jmp 0x21104
leaq -0x650(%rbp), %rdi
leaq -0x50(%rbp), %rsi
callq 0x6240
jmp 0x20ecc
leaq -0x268(%rbp), %rdi
leaq -0x650(%rbp), %rsi
callq 0x1ef00
jmp 0x20ee1
leaq -0x650(%rbp), %rdi
callq 0x69d8
leaq -0x670(%rbp), %rdi
leaq -0xa0(%rbp), %rsi
callq 0x6240
jmp 0x20f02
leaq -0x430(%rbp), %rdi
leaq -0x670(%rbp), %rsi
callq 0x1ef00
jmp 0x20f17
leaq -0x670(%rbp), %rdi
callq 0x69d8
leaq -0x288(%rbp), %rsi
leaq -0x690(%rbp), %rdi
callq 0x6240
jmp 0x20f38
leaq -0x268(%rbp), %rdi
leaq -0x690(%rbp), %rsi
callq 0x1f1e0
movb %al, -0x711(%rbp)
jmp 0x20f53
movb -0x711(%rbp), %al
andb $0x1, %al
movzbl %al, %eax
movl %eax, -0x718(%rbp)
leaq -0x690(%rbp), %rdi
callq 0x69d8
movl -0x718(%rbp), %eax
cmpl $0x0, %eax
je 0x21102
movq -0x28(%rbp), %rdi
leaq 0x4911(%rip), %rsi      # 0x2589b
callq 0x6520
movq %rax, -0x720(%rbp)
jmp 0x20f98
movq -0x720(%rbp), %rdi
movq -0x20(%rbp), %rsi
callq 0x64a0
movq %rax, -0x728(%rbp)
jmp 0x20fb1
movq -0x728(%rbp), %rdi
movq 0x13fd9(%rip), %rsi     # 0x34f98
callq 0x6580
jmp 0x20fc6
movq -0x28(%rbp), %rdi
leaq -0x50(%rbp), %rsi
callq 0x64a0
movq %rax, -0x730(%rbp)
jmp 0x20fdc
movq -0x730(%rbp), %rdi
leaq 0x48ca(%rip), %rsi      # 0x258b4
callq 0x6520
movq %rax, -0x738(%rbp)
jmp 0x20ff8
movq -0x738(%rbp), %rdi
leaq -0xc0(%rbp), %rsi
callq 0x64a0
movq %rax, -0x740(%rbp)
jmp 0x21014
movq -0x740(%rbp), %rdi
movq 0x13f76(%rip), %rsi     # 0x34f98
callq 0x6580
jmp 0x21029
movq -0x28(%rbp), %rdi
leaq -0xa0(%rbp), %rsi
callq 0x64a0
movq %rax, -0x748(%rbp)
jmp 0x21042
movq -0x748(%rbp), %rdi
leaq 0x4864(%rip), %rsi      # 0x258b4
callq 0x6520
movq %rax, -0x750(%rbp)
jmp 0x2105e
movq -0x750(%rbp), %rdi
leaq -0x288(%rbp), %rsi
callq 0x64a0
jmp 0x21073
movq -0x28(%rbp), %rdi
movq 0x13f1a(%rip), %rsi     # 0x34f98
callq 0x6580
movq %rax, -0x758(%rbp)
jmp 0x2108c
movq -0x758(%rbp), %rdi
movq 0x13efe(%rip), %rsi     # 0x34f98
callq 0x6580
jmp 0x210a1
movb $0x0, -0x1(%rbp)
movl $0x1, -0x55c(%rbp)
jmp 0x21116
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x78(%rbp)
movl %eax, -0x7c(%rbp)
leaq -0x650(%rbp), %rdi
callq 0x69d8
jmp 0x2114e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x78(%rbp)
movl %eax, -0x7c(%rbp)
leaq -0x670(%rbp), %rdi
callq 0x69d8
jmp 0x2114e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x78(%rbp)
movl %eax, -0x7c(%rbp)
leaq -0x690(%rbp), %rdi
callq 0x69d8
jmp 0x2114e
jmp 0x21104
movb -0x29(%rbp), %al
andb $0x1, %al
movb %al, -0x1(%rbp)
movl $0x1, -0x55c(%rbp)
leaq -0x430(%rbp), %rdi
callq 0x1edf0
leaq -0x268(%rbp), %rdi
callq 0x1edf0
leaq -0xa0(%rbp), %rdi
callq 0x69d8
leaq -0x70(%rbp), %rdi
callq 0x69d8
leaq -0x50(%rbp), %rdi
callq 0x69d8
jmp 0x21186
leaq -0x430(%rbp), %rdi
callq 0x1edf0
leaq -0x268(%rbp), %rdi
callq 0x1edf0
leaq -0xa0(%rbp), %rdi
callq 0x69d8
leaq -0x70(%rbp), %rdi
callq 0x69d8
leaq -0x50(%rbp), %rdi
callq 0x69d8
jmp 0x21194
movb -0x1(%rbp), %al
andb $0x1, %al
addq $0x7f0, %rsp            # imm = 0x7F0
popq %rbp
retq
movq -0x78(%rbp), %rdi
callq 0x68a0
nopl (%rax)