// File: /workspace/github_cpp_makefile_star2_O3/williewillus[P]panda_scratchpad/src/utils/Tester.cpp
// Function: Tester::check_disk_and_snapshot_contents()
bool Tester::check_disk_and_snapshot_contents() {
	
	// we will check only the last checkpoint
	// so the oracle is the record device, and the replay device
	// will be tested against it
	ofstream diff_file;
	diff_file.open("diff", std::fstream::out | std::fstream::app);
	DiskContents disk1(record_device_path, fs), disk2(replay_device_path, fs);
	disk1.set_mount_point(MNT_POINT_RECORD);
	disk2.set_mount_point(MNT_POINT_REPLAY);

	int num_mods = mods_.size() - 1;
	cout << "Num mods " << num_mods << endl;
	// get the file/dir corresponding to the last checkpoint operation
	for (auto last_mod : mods_.at(num_mods-1)) {
		cout << "last mod" << last_mod.mod_type << endl;
		if (last_mod.mod_type == DiskMod::kFsyncMod) {
			string path(last_mod.path);
			cout << "Last checkpoint was fsync to " << path << endl;
			path.erase(0, 10);
			std::cout << "File path : " << path << std::endl;
			bool ret = disk1.compare_entries_at_path(disk2, path, diff_file);
			cout << "Compare entries returned " << ret << endl;
			if (ret) {
				if (disk1.sanity_checks(diff_file) == false) {
					std::cout << "Failed: Sanity checks on " << replay_device_path << endl;
					return false;
				}
			}
			return ret;
		}
		else if (last_mod.mod_type == DiskMod::kSyncMod) {
			cout << "Last checkpoint was sync" << endl;
			bool ret = disk1.compare_disk_contents(disk2, diff_file);
			if (ret) {
				if (disk1.sanity_checks(diff_file) == false) {
					std::cout << "Failed: Sanity checks on " << replay_device_path << endl;
					return false;
				}
			}
			return ret;
		}
		else if (last_mod.mod_type == DiskMod::kDataMod || last_mod.mod_type == DiskMod::kSyncFileRangeMod) {
			string path(last_mod.path);
			cout << "Last checkpoint was fdatasync to " << path << endl;
			path.erase(0, 10);
			bool ret = disk1.compare_file_contents(disk2, path, last_mod.file_mod_location, 
				last_mod.file_mod_len, diff_file);
			if (ret) {
				if (disk1.sanity_checks(diff_file) == false) {
					std::cout << "Failed: Sanity checks on " << replay_device_path << endl;
					return false;
				}
			}
			return ret;
		}
	}
	cout << "ERROR: " << __func__ << endl;	
	return false;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x548, %rsp            # imm = 0x548
movq %rdi, %r12
leaq -0x568(%rbp), %r14
movq %r14, %rdi
callq 0x5790
leaq 0x6218(%rip), %rsi      # 0x1523d
movq %r14, %rdi
movl $0x11, %edx
callq 0x5070
leaq -0x128(%rbp), %r14
movq %r14, -0x10(%r14)
movq 0x50(%r12), %rsi
movq 0x58(%r12), %rdx
addq %rsi, %rdx
leaq -0x138(%rbp), %rdi
callq 0x7fc8
leaq -0x108(%rbp), %r15
movq %r15, -0x10(%r15)
movq 0x30(%r12), %rsi
movq 0x38(%r12), %rdx
addq %rsi, %rdx
leaq -0x118(%rbp), %rdi
callq 0x7fc8
leaq -0x2d0(%rbp), %rdi
leaq -0x138(%rbp), %rsi
leaq -0x118(%rbp), %rdx
callq 0x10c06
movq -0x118(%rbp), %rdi
cmpq %r15, %rdi
je 0xf0a5
callq 0x5460
movq -0x138(%rbp), %rdi
cmpq %r14, %rdi
je 0xf0b6
callq 0x5460
leaq -0xe8(%rbp), %r14
movq %r14, -0x10(%r14)
movq 0x70(%r12), %rsi
movq 0x78(%r12), %rdx
addq %rsi, %rdx
leaq -0xf8(%rbp), %rdi
callq 0x7fc8
leaq -0xc8(%rbp), %r15
movq %r15, -0x10(%r15)
movq 0x30(%r12), %rsi
movq 0x38(%r12), %rdx
addq %rsi, %rdx
leaq -0xd8(%rbp), %rdi
callq 0x7fc8
leaq -0x368(%rbp), %rdi
leaq -0xf8(%rbp), %rsi
leaq -0xd8(%rbp), %rdx
callq 0x10c06
movq -0xd8(%rbp), %rdi
cmpq %r15, %rdi
je 0xf129
callq 0x5460
movq -0xf8(%rbp), %rdi
cmpq %r14, %rdi
je 0xf13a
callq 0x5460
leaq -0xa8(%rbp), %r14
movq %r14, -0x10(%r14)
leaq 0x6096(%rip), %rsi      # 0x151e2
leaq 0x6099(%rip), %rdx      # 0x151ec
leaq -0xb8(%rbp), %rdi
callq 0x8066
leaq -0x2d0(%rbp), %rdi
leaq -0xb8(%rbp), %rsi
callq 0x10f2a
movq -0xb8(%rbp), %rdi
cmpq %r14, %rdi
je 0xf183
callq 0x5460
leaq -0x88(%rbp), %r14
movq %r14, -0x10(%r14)
leaq 0x609d(%rip), %rsi      # 0x15232
leaq 0x60a0(%rip), %rdx      # 0x1523c
leaq -0x98(%rbp), %rdi
callq 0x8066
leaq -0x368(%rbp), %rdi
leaq -0x98(%rbp), %rsi
callq 0x10f2a
movq -0x98(%rbp), %rdi
cmpq %r14, %rdi
je 0xf1cc
callq 0x5460
movq 0x100(%r12), %rbx
movq %r12, -0x50(%rbp)
subq 0xf8(%r12), %rbx
movq 0xcde1(%rip), %rdi      # 0x1bfc8
leaq 0x6054(%rip), %rsi      # 0x15242
movl $0x9, %edx
callq 0x54f0
sarq $0x3, %rbx
movabsq $-0x5555555555555555, %r12 # imm = 0xAAAAAAAAAAAAAAAB
imulq %r12, %rbx
leal -0x1(%rbx), %esi
movq 0xcdb4(%rip), %r14      # 0x1bfc8
movq %r14, %rdi
callq 0x57a0
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
addl $-0x2, %ebx
movslq %ebx, %rsi
movq -0x50(%rbp), %rcx
movq 0xf8(%rcx), %rax
movq 0x100(%rcx), %rdx
subq %rax, %rdx
sarq $0x3, %rdx
imulq %r12, %rdx
cmpq %rsi, %rdx
jbe 0xf8be
leaq (%rsi,%rsi,2), %rcx
movq (%rax,%rcx,8), %rbx
movq 0x8(%rax,%rcx,8), %rax
movq %rax, -0x58(%rbp)
cmpq %rax, %rbx
je 0xf7f6
leaq -0x228(%rbp), %r12
movq %r12, -0x238(%rbp)
movq (%rbx), %rsi
movq 0x8(%rbx), %rdx
addq %rsi, %rdx
leaq -0x238(%rbp), %rdi
callq 0x7fc8
leaq 0x20(%rbx), %rsi
movl $0x99, %edx
leaq -0x218(%rbp), %rdi
callq 0x53b0
movq 0xc0(%rbx), %rax
movq %rax, -0x178(%rbp)
movq 0xc8(%rbx), %rax
movq %rax, -0x170(%rbp)
testq %rax, %rax
je 0xf2fb
movq 0xccd3(%rip), %rcx      # 0x1bfc0
cmpb $0x0, (%rcx)
je 0xf2f7
incl 0x8(%rax)
jmp 0xf2fb
lock
incl 0x8(%rax)
movups 0xd0(%rbx), %xmm0
movups %xmm0, 0xc0(%r12)
leaq -0x148(%rbp), %rax
movq %rax, -0x158(%rbp)
movq 0xe0(%rbx), %rsi
movq 0xe8(%rbx), %rdx
addq %rsi, %rdx
leaq -0x158(%rbp), %rdi
callq 0x7fc8
movl $0x8, %edx
movq %r14, %rdi
leaq 0x5f07(%rip), %rsi      # 0x1524c
callq 0x54f0
movl -0x218(%rbp), %esi
movq %r14, %rdi
callq 0x57a0
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
movb $0x1, %r15b
movl -0x218(%rbp), %eax
addl $-0x3, %eax
cmpl $0x6, %eax
ja 0xf743
leaq 0x5bd2(%rip), %rcx      # 0x14f70
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
leaq -0x38(%rbp), %rax
movq %rax, -0x48(%rbp)
movq -0x238(%rbp), %rsi
movq -0x230(%rbp), %rdx
addq %rsi, %rdx
leaq -0x48(%rbp), %rdi
callq 0x7fc8
movl $0x21, %edx
movq %r14, %rdi
leaq 0x5ef5(%rip), %rsi      # 0x152cd
callq 0x54f0
movq -0x48(%rbp), %rsi
movq -0x40(%rbp), %rdx
movq %r14, %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 $0xa, %edx
leaq -0x48(%rbp), %rdi
xorl %esi, %esi
callq 0x50c0
leaq -0x68(%rbp), %rax
movq %rax, -0x78(%rbp)
movq -0x48(%rbp), %rsi
movq -0x40(%rbp), %rdx
addq %rsi, %rdx
leaq -0x78(%rbp), %rdi
callq 0x7fc8
movl -0x168(%rbp), %ecx
movl -0x160(%rbp), %r8d
leaq -0x2d0(%rbp), %rdi
leaq -0x368(%rbp), %rsi
leaq -0x78(%rbp), %rdx
leaq -0x568(%rbp), %r9
callq 0x12600
movl %eax, %r15d
movq -0x78(%rbp), %rdi
leaq -0x68(%rbp), %rax
cmpq %rax, %rdi
je 0xf483
callq 0x5460
testb %r15b, %r15b
je 0xf72b
leaq -0x2d0(%rbp), %rdi
leaq -0x568(%rbp), %rsi
callq 0x1365a
movb $0x1, %r13b
testb %al, %al
jne 0xf72e
movl $0x19, %edx
movq %r14, %rdi
leaq 0x5de1(%rip), %rsi      # 0x1529a
callq 0x54f0
movq -0x50(%rbp), %rax
movq 0x70(%rax), %rsi
movq 0x78(%rax), %rdx
movq %r14, %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
jmp 0xf72b
movl $0x18, %edx
movq %r14, %rdi
leaq 0x5da4(%rip), %rsi      # 0x152b4
callq 0x54f0
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
leaq -0x2d0(%rbp), %rdi
leaq -0x368(%rbp), %rsi
leaq -0x568(%rbp), %rdx
callq 0x11522
testb %al, %al
je 0xf7eb
leaq -0x2d0(%rbp), %rdi
leaq -0x568(%rbp), %rsi
callq 0x1365a
testb %al, %al
je 0xf799
movb $0x1, %r13b
jmp 0xf740
leaq -0x38(%rbp), %rax
movq %rax, -0x48(%rbp)
movq -0x238(%rbp), %rsi
movq -0x230(%rbp), %rdx
addq %rsi, %rdx
leaq -0x48(%rbp), %rdi
callq 0x7fc8
movl $0x1d, %edx
movq %r14, %rdi
leaq 0x5ca3(%rip), %rsi      # 0x15255
callq 0x54f0
movq -0x48(%rbp), %rsi
movq -0x40(%rbp), %rdx
movq %r14, %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 $0xa, %edx
leaq -0x48(%rbp), %rdi
xorl %esi, %esi
callq 0x50c0
movl $0xc, %edx
movq %r14, %rdi
leaq 0x5c63(%rip), %rsi      # 0x15273
callq 0x54f0
movq -0x48(%rbp), %rsi
movq -0x40(%rbp), %rdx
movq %r14, %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
leaq -0x2d0(%rbp), %rdi
leaq -0x368(%rbp), %rsi
leaq -0x48(%rbp), %rdx
leaq -0x568(%rbp), %rcx
callq 0x11f24
movl %eax, %r13d
movl $0x19, %edx
movq %r14, %rdi
leaq 0x5c01(%rip), %rsi      # 0x15280
callq 0x54f0
movzbl %r13b, %esi
movq %r14, %rdi
callq 0x5730
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
testb %r13b, %r13b
je 0xf72b
leaq -0x2d0(%rbp), %rdi
leaq -0x568(%rbp), %rsi
callq 0x1365a
movb $0x1, %r13b
testb %al, %al
jne 0xf72e
movl $0x19, %edx
movq %r14, %rdi
leaq 0x5bb2(%rip), %rsi      # 0x1529a
callq 0x54f0
movq -0x50(%rbp), %rax
movq 0x70(%rax), %rsi
movq 0x78(%rax), %rdx
movq %r14, %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
xorl %r13d, %r13d
movq -0x48(%rbp), %rdi
leaq -0x38(%rbp), %rax
cmpq %rax, %rdi
je 0xf740
callq 0x5460
xorl %r15d, %r15d
movq -0x158(%rbp), %rdi
leaq -0x148(%rbp), %rax
cmpq %rax, %rdi
je 0xf75b
callq 0x5460
movq -0x170(%rbp), %rdi
testq %rdi, %rdi
je 0xf76c
callq 0x8a78
movq -0x238(%rbp), %rdi
cmpq %r12, %rdi
je 0xf77d
callq 0x5460
testb %r15b, %r15b
je 0xf857
addq $0x100, %rbx            # imm = 0x100
cmpq -0x58(%rbp), %rbx
jne 0xf293
jmp 0xf7f6
movl $0x19, %edx
movq %r14, %rdi
leaq 0x5af2(%rip), %rsi      # 0x1529a
callq 0x54f0
movq -0x50(%rbp), %rax
movq 0x70(%rax), %rsi
movq 0x78(%rax), %rdx
movq %r14, %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
xorl %r15d, %r15d
xorl %r13d, %r13d
jmp 0xf743
movq 0xc7cb(%rip), %rdi      # 0x1bfc8
leaq 0x5aeb(%rip), %rsi      # 0x152ef
movl $0x7, %edx
callq 0x54f0
movq 0xc7b3(%rip), %rbx      # 0x1bfc8
leaq 0x5adb(%rip), %rsi      # 0x152f7
movl $0x20, %edx
movq %rbx, %rdi
callq 0x54f0
movq (%rbx), %rax
addq -0x18(%rax), %rbx
movq %rbx, %rdi
movl $0xa, %esi
callq 0x5470
movsbl %al, %esi
movq 0xc781(%rip), %rdi      # 0x1bfc8
callq 0x5040
movq %rax, %rdi
callq 0x5300
xorl %r13d, %r13d
leaq -0x368(%rbp), %rdi
callq 0x10cf2
leaq -0x2d0(%rbp), %rdi
callq 0x10cf2
movq 0xc73a(%rip), %rax      # 0x1bfb0
movq (%rax), %rcx
movq 0x18(%rax), %rax
leaq -0x560(%rbp), %rdi
movq %rcx, -0x8(%rdi)
movq -0x18(%rcx), %rcx
movq %rax, -0x568(%rbp,%rcx)
callq 0x53d0
leaq -0x470(%rbp), %rdi
callq 0x5180
andb $0x1, %r13b
movl %r13d, %eax
addq $0x548, %rsp            # imm = 0x548
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x5af2(%rip), %rdi      # 0x153b7
xorl %eax, %eax
callq 0x5670
jmp 0xf996
movq %rax, %rbx
movq -0x98(%rbp), %rdi
jmp 0xf8ec
jmp 0xf996
movq %rax, %rbx
movq -0xb8(%rbp), %rdi
cmpq %r14, %rdi
jne 0xf9bb
jmp 0xf9ee
jmp 0xf996
movq %rax, %rbx
movq -0xd8(%rbp), %rdi
cmpq %r15, %rdi
je 0xf918
callq 0x5460
jmp 0xf918
movq %rax, %rbx
movq -0xf8(%rbp), %rdi
cmpq %r14, %rdi
je 0xf9fa
callq 0x5460
jmp 0xf9fa
movq %rax, %rbx
jmp 0xf9fa
movq %rax, %rbx
movq -0x118(%rbp), %rdi
cmpq %r15, %rdi
je 0xf953
callq 0x5460
jmp 0xf953
movq %rax, %rbx
movq -0x138(%rbp), %rdi
cmpq %r14, %rdi
je 0xfa06
callq 0x5460
jmp 0xfa06
jmp 0xf96f
movq %rax, %rbx
jmp 0xfa06
jmp 0xf9df
jmp 0xf9df
movq %rax, %rbx
movq -0x78(%rbp), %rdi
leaq -0x68(%rbp), %rax
cmpq %rax, %rdi
je 0xf9cb
callq 0x5460
jmp 0xf9cb
jmp 0xf9df
jmp 0xf996
movq %rax, %rbx
jmp 0xf9ee
movq %rax, %rbx
movq -0x170(%rbp), %rdi
testq %rdi, %rdi
je 0xf9af
callq 0x8a78
movq -0x238(%rbp), %rdi
cmpq %r12, %rdi
je 0xf9ee
callq 0x5460
jmp 0xf9ee
jmp 0xf9c8
jmp 0xf9c8
jmp 0xf9c8
movq %rax, %rbx
movq -0x48(%rbp), %rdi
leaq -0x38(%rbp), %rax
cmpq %rax, %rdi
je 0xf9e2
callq 0x5460
jmp 0xf9e2
movq %rax, %rbx
leaq -0x238(%rbp), %rdi
callq 0xbfe8
leaq -0x368(%rbp), %rdi
callq 0x10cf2
leaq -0x2d0(%rbp), %rdi
callq 0x10cf2
leaq -0x568(%rbp), %rdi
callq 0x5650
movq %rbx, %rdi
callq 0x57c0