// File: /workspace/github_cpp_makefile_star2_O1/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 0x61b4(%rip), %rsi      # 0x1524d
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 0x8052
leaq -0x108(%rbp), %r15
movq %r15, -0x10(%r15)
movq 0x30(%r12), %rsi
movq 0x38(%r12), %rdx
addq %rsi, %rdx
leaq -0x118(%rbp), %rdi
callq 0x8052
leaq -0x2d0(%rbp), %rdi
leaq -0x138(%rbp), %rsi
leaq -0x118(%rbp), %rdx
callq 0x10cd2
movq -0x118(%rbp), %rdi
cmpq %r15, %rdi
je 0xf119
callq 0x5460
movq -0x138(%rbp), %rdi
cmpq %r14, %rdi
je 0xf12a
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 0x8052
leaq -0xc8(%rbp), %r15
movq %r15, -0x10(%r15)
movq 0x30(%r12), %rsi
movq 0x38(%r12), %rdx
addq %rsi, %rdx
leaq -0xd8(%rbp), %rdi
callq 0x8052
leaq -0x368(%rbp), %rdi
leaq -0xf8(%rbp), %rsi
leaq -0xd8(%rbp), %rdx
callq 0x10cd2
movq -0xd8(%rbp), %rdi
cmpq %r15, %rdi
je 0xf19d
callq 0x5460
movq -0xf8(%rbp), %rdi
cmpq %r14, %rdi
je 0xf1ae
callq 0x5460
leaq -0xa8(%rbp), %r14
movq %r14, -0x10(%r14)
leaq 0x6032(%rip), %rsi      # 0x151f2
leaq 0x6035(%rip), %rdx      # 0x151fc
leaq -0xb8(%rbp), %rdi
callq 0x80ec
leaq -0x2d0(%rbp), %rdi
leaq -0xb8(%rbp), %rsi
callq 0x11008
movq -0xb8(%rbp), %rdi
cmpq %r14, %rdi
je 0xf1f7
callq 0x5460
leaq -0x88(%rbp), %r14
movq %r14, -0x10(%r14)
leaq 0x6039(%rip), %rsi      # 0x15242
leaq 0x603c(%rip), %rdx      # 0x1524c
leaq -0x98(%rbp), %rdi
callq 0x80ec
leaq -0x368(%rbp), %rdi
leaq -0x98(%rbp), %rsi
callq 0x11008
movq -0x98(%rbp), %rdi
cmpq %r14, %rdi
je 0xf240
callq 0x5460
movq 0x100(%r12), %rbx
movq %r12, -0x50(%rbp)
subq 0xf8(%r12), %rbx
movq 0xcd6d(%rip), %rdi      # 0x1bfc8
leaq 0x5ff0(%rip), %rsi      # 0x15252
movl $0x9, %edx
callq 0x54f0
sarq $0x3, %rbx
movabsq $-0x5555555555555555, %r12 # imm = 0xAAAAAAAAAAAAAAAB
imulq %r12, %rbx
leal -0x1(%rbx), %esi
movq 0xcd40(%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 0xf941
leaq (%rsi,%rsi,2), %rcx
movq (%rax,%rcx,8), %r12
movq 0x8(%rax,%rcx,8), %rax
movq %rax, -0x58(%rbp)
cmpq %rax, %r12
sete %bl
je 0xf874
leaq -0x228(%rbp), %rax
movq %rax, -0x238(%rbp)
movq (%r12), %rsi
movq 0x8(%r12), %rdx
addq %rsi, %rdx
leaq -0x238(%rbp), %rdi
callq 0x8052
leaq 0x20(%r12), %rsi
movl $0x99, %edx
leaq -0x218(%rbp), %rdi
callq 0x53b0
movq 0xc0(%r12), %rax
movq %rax, -0x178(%rbp)
movq 0xc8(%r12), %rax
movq %rax, -0x170(%rbp)
testq %rax, %rax
je 0xf377
movq 0xcc57(%rip), %rcx      # 0x1bfc0
cmpb $0x0, (%rcx)
je 0xf373
incl 0x8(%rax)
jmp 0xf377
lock
incl 0x8(%rax)
movups 0xd0(%r12), %xmm0
leaq -0x228(%rbp), %rax
movups %xmm0, 0xc0(%rax)
leaq -0x148(%rbp), %rax
movq %rax, -0x158(%rbp)
movq 0xe0(%r12), %rsi
movq 0xe8(%r12), %rdx
addq %rsi, %rdx
leaq -0x158(%rbp), %rdi
callq 0x8052
movl $0x8, %edx
movq %r14, %rdi
leaq 0x5e92(%rip), %rsi      # 0x1525c
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 0xf81a
leaq 0x5b5d(%rip), %rcx      # 0x14f80
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 0x8052
movl $0x21, %edx
movq %r14, %rdi
leaq 0x5e80(%rip), %rsi      # 0x152dd
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 0x8052
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 0x126f4
movl %eax, %r13d
movq -0x78(%rbp), %rdi
leaq -0x68(%rbp), %rax
cmpq %rax, %rdi
je 0xf508
callq 0x5460
testb %r13b, %r13b
je 0xf805
leaq -0x2d0(%rbp), %rdi
leaq -0x568(%rbp), %rsi
callq 0x1376c
testb %al, %al
jne 0xf805
movl $0x19, %edx
movq %r14, %rdi
leaq 0x5d6f(%rip), %rsi      # 0x152aa
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 0xf802
movl $0x18, %edx
movq %r14, %rdi
leaq 0x5d32(%rip), %rsi      # 0x152c4
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 0x11612
movl %eax, %r13d
testb %al, %al
je 0xf817
leaq -0x2d0(%rbp), %rdi
leaq -0x568(%rbp), %rsi
callq 0x1376c
testb %al, %al
jne 0xf817
movl $0x19, %edx
movq %r14, %rdi
leaq 0x5c9d(%rip), %rsi      # 0x152aa
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 0xf81a
leaq -0x38(%rbp), %rax
movq %rax, -0x48(%rbp)
movq -0x238(%rbp), %rsi
movq -0x230(%rbp), %rdx
addq %rsi, %rdx
leaq -0x48(%rbp), %rdi
callq 0x8052
movl $0x1d, %edx
movq %r14, %rdi
leaq 0x5bd9(%rip), %rsi      # 0x15265
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 0x5b99(%rip), %rsi      # 0x15283
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 0x12034
movl %eax, %r13d
movl $0x19, %edx
movq %r14, %rdi
leaq 0x5b37(%rip), %rsi      # 0x15290
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 0xf805
leaq -0x2d0(%rbp), %rdi
leaq -0x568(%rbp), %rsi
callq 0x1376c
testb %al, %al
jne 0xf805
movl $0x19, %edx
movq %r14, %rdi
leaq 0x5aeb(%rip), %rsi      # 0x152aa
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 0xf817
callq 0x5460
xorl %r15d, %r15d
movq -0x158(%rbp), %rdi
leaq -0x148(%rbp), %rax
cmpq %rax, %rdi
je 0xf832
callq 0x5460
movq -0x170(%rbp), %rdi
testq %rdi, %rdi
je 0xf843
callq 0x8af0
movq -0x238(%rbp), %rdi
leaq -0x228(%rbp), %rax
cmpq %rax, %rdi
je 0xf85b
callq 0x5460
testb %r15b, %r15b
je 0xf874
addq $0x100, %r12            # imm = 0x100
cmpq -0x58(%rbp), %r12
sete %bl
jne 0xf303
testb $0x1, %bl
je 0xf8da
movq 0xc748(%rip), %rdi      # 0x1bfc8
leaq 0x5a78(%rip), %rsi      # 0x152ff
movl $0x7, %edx
callq 0x54f0
movq 0xc730(%rip), %rbx      # 0x1bfc8
leaq 0x5a68(%rip), %rsi      # 0x15307
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 0xc6fe(%rip), %rdi      # 0x1bfc8
callq 0x5040
movq %rax, %rdi
callq 0x5300
xorl %r13d, %r13d
leaq -0x368(%rbp), %rdi
callq 0x10dbe
leaq -0x2d0(%rbp), %rdi
callq 0x10dbe
movq 0xc6b7(%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 0x5a7f(%rip), %rdi      # 0x153c7
xorl %eax, %eax
callq 0x5670
jmp 0xfa19
movq %rax, %rbx
movq -0x98(%rbp), %rdi
jmp 0xf96f
jmp 0xfa19
movq %rax, %rbx
movq -0xb8(%rbp), %rdi
cmpq %r14, %rdi
jne 0xfa45
jmp 0xfa78
jmp 0xfa19
movq %rax, %rbx
movq -0xd8(%rbp), %rdi
cmpq %r15, %rdi
je 0xf99b
callq 0x5460
jmp 0xf99b
movq %rax, %rbx
movq -0xf8(%rbp), %rdi
cmpq %r14, %rdi
je 0xfa84
callq 0x5460
jmp 0xfa84
movq %rax, %rbx
jmp 0xfa84
movq %rax, %rbx
movq -0x118(%rbp), %rdi
cmpq %r15, %rdi
je 0xf9d6
callq 0x5460
jmp 0xf9d6
movq %rax, %rbx
movq -0x138(%rbp), %rdi
cmpq %r14, %rdi
je 0xfa90
callq 0x5460
jmp 0xfa90
jmp 0xf9f2
movq %rax, %rbx
jmp 0xfa90
jmp 0xfa69
jmp 0xfa69
movq %rax, %rbx
movq -0x78(%rbp), %rdi
leaq -0x68(%rbp), %rax
cmpq %rax, %rdi
je 0xfa55
callq 0x5460
jmp 0xfa55
jmp 0xfa69
jmp 0xfa19
movq %rax, %rbx
jmp 0xfa78
movq %rax, %rbx
movq -0x170(%rbp), %rdi
testq %rdi, %rdi
je 0xfa32
callq 0x8af0
movq -0x238(%rbp), %rdi
leaq -0x228(%rbp), %rax
cmpq %rax, %rdi
je 0xfa78
callq 0x5460
jmp 0xfa78
jmp 0xfa52
jmp 0xfa52
jmp 0xfa52
movq %rax, %rbx
movq -0x48(%rbp), %rdi
leaq -0x38(%rbp), %rax
cmpq %rax, %rdi
je 0xfa6c
callq 0x5460
jmp 0xfa6c
movq %rax, %rbx
leaq -0x238(%rbp), %rdi
callq 0xbfde
leaq -0x368(%rbp), %rdi
callq 0x10dbe
leaq -0x2d0(%rbp), %rdi
callq 0x10dbe
leaq -0x568(%rbp), %rdi
callq 0x5650
movq %rbx, %rdi
callq 0x57c0