// File: /workspace/github_cpp_makefile_star2_O2/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
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x5b8, %rsp            # imm = 0x5B8
movq %rcx, %rbx
movq %rdx, %r14
movq %rsi, %r15
addq $0x8, %rdi
addq $0x8, %rsi
callq 0x5040
testl %eax, %eax
je 0xf45a
leaq 0x302d(%rip), %rsi      # 0x121b2
leaq -0x48(%rbp), %rdi
movq %r14, %rdx
callq 0xbd84
addq $0x28, %r15
leaq -0xe8(%rbp), %rdi
movq %r15, %rsi
callq 0x5580
leaq -0x68(%rbp), %rdi
leaq -0xe8(%rbp), %rsi
movq %r14, %rdx
callq 0x1026b
leaq -0x2f0(%rbp), %rdi
callq 0xe0e0
leaq -0x4b8(%rbp), %rdi
callq 0xe0e0
movq -0x48(%rbp), %rdi
leaq -0x5d8(%rbp), %rsi
callq 0x5420
movl %eax, %r15d
cmpl $-0x1, %eax
jne 0xf20a
leaq 0x34e0(%rip), %rsi      # 0x126ce
movq %rbx, %rdi
callq 0x5480
leaq -0x48(%rbp), %rsi
movq %rax, %rdi
callq 0x5410
movq %rax, %rdi
callq 0x5240
movq -0x68(%rbp), %rdi
leaq -0x548(%rbp), %rsi
callq 0x5420
cmpl $-0x1, %eax
je 0xf45f
cmpl $-0x1, %r15d
je 0xf482
leaq -0x128(%rbp), %rdi
leaq -0x48(%rbp), %rsi
callq 0x5580
leaq -0x128(%rbp), %r15
movq (%r15), %rdi
leaq -0x1d8(%rbp), %rsi
callq 0x5420
movq %r15, %rdi
callq 0x58a8
leaq -0x108(%rbp), %rdi
leaq -0x68(%rbp), %rsi
callq 0x5580
leaq -0x108(%rbp), %r15
movq (%r15), %rdi
leaq -0x3a0(%rbp), %r12
movq %r12, %rsi
callq 0x5420
movq %r15, %rdi
callq 0x58a8
movq -0x1d0(%rbp), %rax
cmpq 0x8(%r12), %rax
jne 0xf4d0
movl -0x388(%rbp), %eax
cmpl %eax, -0x1c0(%rbp)
jne 0xf4d0
movq -0x390(%rbp), %rcx
cmpq %rcx, -0x1c8(%rbp)
jne 0xf4d0
movl -0x384(%rbp), %ecx
cmpl %ecx, -0x1bc(%rbp)
jne 0xf4d0
movl -0x380(%rbp), %ecx
cmpl %ecx, -0x1b8(%rbp)
jne 0xf4d0
movq -0x370(%rbp), %rcx
cmpq %rcx, -0x1a8(%rbp)
jne 0xf4d0
movq -0x368(%rbp), %rcx
cmpq %rcx, -0x1a0(%rbp)
jne 0xf4d0
movq -0x360(%rbp), %rcx
cmpq %rcx, -0x198(%rbp)
jne 0xf4d0
andl $0xf000, %eax           # imm = 0xF000
movb $0x1, %r12b
cmpl $0x8000, %eax           # imm = 0x8000
jne 0xf485
leaq -0xc8(%rbp), %rdi
leaq -0x48(%rbp), %rsi
callq 0x5580
leaq -0x2f0(%rbp), %rdi
leaq -0xc8(%rbp), %rsi
callq 0xe1e0
leaq -0xc8(%rbp), %rdi
callq 0x58a8
leaq -0xa8(%rbp), %rdi
leaq -0x68(%rbp), %rsi
callq 0x5580
leaq -0x4b8(%rbp), %rdi
leaq -0xa8(%rbp), %rsi
callq 0xe1e0
leaq -0xa8(%rbp), %rdi
callq 0x58a8
leaq -0x310(%rbp), %r15
leaq -0x88(%rbp), %rdi
movq %r15, %rsi
callq 0x5580
leaq -0x2f0(%rbp), %rdi
leaq -0x88(%rbp), %rsi
callq 0xe326
movl %eax, %r13d
leaq -0x88(%rbp), %rdi
callq 0x58a8
testb %r13b, %r13b
je 0xf485
leaq 0x32cb(%rip), %rsi      # 0x126a8
movq %rbx, %rdi
callq 0x5480
movq %rax, %rdi
movq %r14, %rsi
callq 0x5410
movq %rax, %rdi
callq 0x5240
leaq -0x48(%rbp), %rsi
movq %rbx, %rdi
callq 0x5410
leaq 0x32b6(%rip), %rsi      # 0x126c1
movq %rax, %rdi
callq 0x5480
leaq -0x148(%rbp), %rsi
movq %rax, %rdi
callq 0x5410
movq %rax, %rdi
callq 0x5240
leaq -0x68(%rbp), %rsi
movq %rbx, %rdi
callq 0x5410
leaq 0x3284(%rip), %rsi      # 0x126c1
movq %rax, %rdi
callq 0x5480
movq %rax, %rdi
movq %r15, %rsi
callq 0x5410
movq %rbx, %rdi
callq 0x5240
jmp 0xf47a
movb $0x1, %r12b
jmp 0xf4bb
leaq 0x3268(%rip), %rsi      # 0x126ce
movq %rbx, %rdi
callq 0x5480
leaq -0x68(%rbp), %rsi
movq %rax, %rdi
callq 0x5410
movq %rax, %rdi
callq 0x5240
xorl %r12d, %r12d
leaq -0x4b8(%rbp), %rdi
callq 0xe164
leaq -0x2f0(%rbp), %rdi
callq 0xe164
leaq -0x68(%rbp), %rdi
callq 0x58a8
leaq -0xe8(%rbp), %rdi
callq 0x58a8
leaq -0x48(%rbp), %rdi
callq 0x58a8
movl %r12d, %eax
addq $0x5b8, %rsp            # imm = 0x5B8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x31b9(%rip), %rsi      # 0x12690
movq %rbx, %rdi
callq 0x5480
movq %rax, %rdi
movq %r14, %rsi
callq 0x5410
movq %rax, %rdi
callq 0x5240
movq %rax, %rdi
callq 0x5240
leaq -0x48(%rbp), %rsi
movq %rbx, %rdi
callq 0x5410
leaq 0x3162(%rip), %rsi      # 0x1266f
movq %rax, %rdi
callq 0x5480
movq %rax, %rdi
callq 0x5240
leaq -0x2f0(%rbp), %rsi
movq %rbx, %rdi
callq 0xe357
movq %rax, %rbx
leaq -0x88(%rbp), %rdi
jmp 0xf54e
movq %rax, %rbx
leaq -0xa8(%rbp), %rdi
jmp 0xf54e
movq %rax, %rbx
leaq -0xc8(%rbp), %rdi
callq 0x58a8
jmp 0xf56c
movq %rax, %rbx
jmp 0xf578
movq %rax, %rbx
jmp 0xf584
movq %rax, %rbx
jmp 0xf58d
movq %rax, %rbx
jmp 0xf599
movq %rax, %rbx
leaq -0x4b8(%rbp), %rdi
callq 0xe164
leaq -0x2f0(%rbp), %rdi
callq 0xe164
leaq -0x68(%rbp), %rdi
callq 0x58a8
leaq -0xe8(%rbp), %rdi
callq 0x58a8
leaq -0x48(%rbp), %rdi
callq 0x58a8
movq %rbx, %rdi
callq 0x5780