// File: /workspace/github_cpp_makefile_star2_O1/williewillus[P]panda_scratchpad/src/utils/Tester.cpp
// Function: Tester::test_check(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::basic_ofstream<char, std::char_traits<char>>&)
vector<milliseconds> Tester::test_check(const string device_path, ofstream &log) {
	assert(current_test_suite_ != NULL);
	vector<milliseconds> res(3, duration<int, std::milli>(-1));
	SingleTestInfo test_info;
	unsigned int test_num = 1;
	test_info.test_num = test_num++;

	// This funstion will be called after the replay i.e. 
	// the replay_device is in an unmounted state.
	//
	// So first check if the filesystem is mountable
	
	time_point<steady_clock> mount_start_time = steady_clock::now();
	if (mount_device(device_path, MNT_POINT_REPLAY) != SUCCESS) {
		test_info.fs_test.SetError(FileSystemTestResult::kKernelMount);
		return res;
	}

	if (mount_device(record_device_path, MNT_POINT_RECORD) != SUCCESS) {
		test_info.fs_test.SetError(FileSystemTestResult::kKernelMount);
		return res;
	}

	cout << "Mounted both record and replay device for checks" << endl;
	system("mount | grep pmem");
	system("ls /mnt/pmem0");
	system("ls /mnt/pmem1");
	cout << "Checking using system diff command" << endl;
	system("diff -qr /mnt/pmem0 /mnt/pmem1");


	time_point<steady_clock> mount_end_time = steady_clock::now();
	res.at(2) = duration_cast<milliseconds>(mount_end_time - mount_start_time);	

	// Once mounted, begin testing
	time_point<steady_clock> test_case_start_time = steady_clock::now();
	bool retVal = check_disk_and_snapshot_contents();
	if (!retVal) {
		test_info.data_test.SetError(tests::DataTestResult::kAutoCheckFailed);
	} 
	time_point<steady_clock> test_case_end_time = steady_clock::now();
	res.at(1) = duration_cast<milliseconds>(test_case_end_time - test_case_start_time);

	test_info.PrintResults(log);
	current_test_suite_->TallyTimingResult(test_info);
	return res;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x118, %rsp            # imm = 0x118
movq %rsi, -0x30(%rbp)
cmpq $0x0, 0x98(%rsi)
je 0xefd7
movq %rdx, %r15
movq %rdi, %rbx
movq %rcx, -0x40(%rbp)
pxor %xmm0, %xmm0
movdqu %xmm0, (%rdi)
movq $0x0, 0x10(%rdi)
movl $0x18, %edi
callq 0x54a0
movq %rax, %r12
movq %rax, (%rbx)
movq %rax, 0x8(%rbx)
addq $0x18, %rax
movq %rax, 0x10(%rbx)
pcmpeqd %xmm0, %xmm0
movdqu %xmm0, (%r12)
movq $-0x1, 0x10(%r12)
movq %rax, 0x8(%rbx)
leaq -0x138(%rbp), %rdi
callq 0x8fcc
movl $0x1, -0x138(%rbp)
callq 0x5560
movq %rax, -0x38(%rbp)
leaq -0xb0(%rbp), %r13
movq %r13, -0x10(%r13)
movq (%r15), %rsi
movq 0x8(%r15), %rdx
addq %rsi, %rdx
leaq -0xc0(%rbp), %rdi
callq 0x8052
leaq -0x90(%rbp), %r14
movq %r14, -0x10(%r14)
leaq 0x64ed(%rip), %rsi      # 0x15242
leaq 0x64f0(%rip), %rdx      # 0x1524c
leaq -0xa0(%rbp), %rdi
callq 0x80ec
leaq -0xc0(%rbp), %rsi
leaq -0xa0(%rbp), %rdx
movq -0x30(%rbp), %rdi
callq 0xeae8
movl %eax, %r15d
movq -0xa0(%rbp), %rdi
cmpq %r14, %rdi
je 0xed93
callq 0x5460
movq -0xc0(%rbp), %rdi
cmpq %r13, %rdi
je 0xeda4
callq 0x5460
testl %r15d, %r15d
jne 0xee1d
leaq -0x70(%rbp), %r13
movq %r13, -0x10(%r13)
movq -0x30(%rbp), %rax
movq 0x50(%rax), %rsi
movq 0x58(%rax), %rdx
addq %rsi, %rdx
leaq -0x80(%rbp), %rdi
callq 0x8052
leaq -0x50(%rbp), %r14
movq %r14, -0x10(%r14)
leaq 0x641a(%rip), %rsi      # 0x151f2
leaq 0x641d(%rip), %rdx      # 0x151fc
leaq -0x60(%rbp), %rdi
callq 0x80ec
leaq -0x80(%rbp), %rsi
leaq -0x60(%rbp), %rdx
movq -0x30(%rbp), %rdi
callq 0xeae8
movl %eax, %r15d
movq -0x60(%rbp), %rdi
cmpq %r14, %rdi
je 0xee0a
callq 0x5460
movq -0x80(%rbp), %rdi
cmpq %r13, %rdi
je 0xee18
callq 0x5460
testl %r15d, %r15d
je 0xee82
leaq -0x108(%rbp), %rdi
movl $0x80, %esi
callq 0x8e2e
leaq -0xd8(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0xee43
callq 0x5460
leaq -0xf8(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0xee58
callq 0x5460
leaq -0x120(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0xee6d
callq 0x5460
movq %rbx, %rax
addq $0x118, %rsp            # imm = 0x118
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0xd13f(%rip), %r15      # 0x1bfc8
leaq 0x632e(%rip), %rsi      # 0x151be
movl $0x30, %edx
movq %r15, %rdi
callq 0x54f0
movq (%r15), %rax
addq -0x18(%rax), %r15
movq %r15, %rdi
movl $0xa, %esi
callq 0x5470
movsbl %al, %esi
movq 0xd10d(%rip), %rdi      # 0x1bfc8
callq 0x5040
movq %rax, %rdi
callq 0x5300
leaq 0x545e(%rip), %rdi      # 0x1432d
callq 0x53e0
leaq 0x6314(%rip), %rdi      # 0x151ef
callq 0x53e0
leaq 0x6316(%rip), %rdi      # 0x151fd
callq 0x53e0
movq 0xd0d5(%rip), %r15      # 0x1bfc8
leaq 0x6311(%rip), %rsi      # 0x1520b
movl $0x22, %edx
movq %r15, %rdi
callq 0x54f0
movq (%r15), %rax
addq -0x18(%rax), %r15
movq %r15, %rdi
movl $0xa, %esi
callq 0x5470
movsbl %al, %esi
movq 0xd0a3(%rip), %rdi      # 0x1bfc8
callq 0x5040
movq %rax, %rdi
callq 0x5300
leaq 0x62f5(%rip), %rdi      # 0x1522e
callq 0x53e0
callq 0x5560
subq -0x38(%rbp), %rax
movabsq $0x431bde82d7b634db, %r13 # imm = 0x431BDE82D7B634DB
imulq %r13
movq %rdx, %rax
shrq $0x3f, %rax
sarq $0x12, %rdx
addq %rax, %rdx
movq %rdx, 0x10(%r12)
callq 0x5560
movq %rax, %r15
movq -0x30(%rbp), %rdi
callq 0xf06c
testb %al, %al
jne 0xef8d
leaq -0x130(%rbp), %rdi
movl $0x40, %esi
callq 0x8cca
callq 0x5560
subq %r15, %rax
imulq %r13
movq %rdx, %rax
shrq $0x3f, %rax
sarq $0x12, %rdx
addq %rax, %rdx
movq %rdx, 0x8(%r12)
leaq -0x138(%rbp), %rdi
movq -0x40(%rbp), %rsi
callq 0x90b0
movq -0x30(%rbp), %rax
movq 0x98(%rax), %rdi
leaq -0x138(%rbp), %rsi
callq 0x93f0
jmp 0xee2e
leaq 0x6182(%rip), %rdi      # 0x15160
leaq 0x6080(%rip), %rsi      # 0x15065
leaq 0x6190(%rip), %rcx      # 0x1517c
movl $0xa4, %edx
callq 0x52e0
jmp 0xf047
jmp 0xf047
movq %rax, %r15
movq -0x60(%rbp), %rdi
cmpq %r14, %rdi
je 0xf010
callq 0x5460
jmp 0xf010
movq %rax, %r15
movq -0x80(%rbp), %rdi
jmp 0xf036
movq %rax, %r15
movq -0xa0(%rbp), %rdi
cmpq %r14, %rdi
je 0xf02f
callq 0x5460
jmp 0xf02f
movq %rax, %r15
movq -0xc0(%rbp), %rdi
cmpq %r13, %rdi
je 0xf04a
callq 0x5460
jmp 0xf04a
movq %rax, %r15
jmp 0xf056
movq %rax, %r15
leaq -0x138(%rbp), %rdi
callq 0x10048
movq (%rbx), %rdi
testq %rdi, %rdi
je 0xf063
callq 0x5460
movq %r15, %rdi
callq 0x57c0
nop