// File: /workspace/github_cpp_makefile_star2_O3/CMU-SAFARI[P]MQSim/src/host/IO_Flow_Trace_Based.cpp
// Function: Host_Components::IO_Flow_Trace_Based::Execute_simulator_event(MQSimEngine::Sim_Event*)
void IO_Flow_Trace_Based::Execute_simulator_event(MQSimEngine::Sim_Event *)
{
	Host_IO_Request *request = Generate_next_request();
	if (request != NULL)
	{
		Submit_io_request(request);
	}

	if (STAT_generated_request_count < total_requests_to_be_generated)
	{
		std::string trace_line;
		if (std::getline(trace_file, trace_line))
		{
			Utils::Helper_Functions::Remove_cr(trace_line);
			current_trace_line.clear();
			Utils::Helper_Functions::Tokenize(trace_line, ASCIILineDelimiter, current_trace_line);
		}
		else
		{
			trace_file.close();
			trace_file.open(trace_file_path);
			replay_counter++;
			time_offset = Simulator->Time();
			std::getline(trace_file, trace_line);
			Utils::Helper_Functions::Remove_cr(trace_line);
			current_trace_line.clear();
			Utils::Helper_Functions::Tokenize(trace_line, ASCIILineDelimiter, current_trace_line);
			PRINT_MESSAGE("* Replay round " << replay_counter << "of " << total_replay_no << " started  for" << ID())
		}
		char *pEnd;
		Simulator->Register_sim_event(time_offset + std::strtoll(current_trace_line[ASCIITraceTimeColumn].c_str(), &pEnd, 10), this);
	}
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x48, %rsp
movq %rdi, %rbx
movq (%rdi), %rax
callq *0x20(%rax)
testq %rax, %rax
je 0x230ba
movq %rbx, %rdi
movq %rax, %rsi
callq 0x1f77a
movl 0x150(%rbx), %eax
cmpl 0x50(%rbx), %eax
jae 0x23326
leaq 0x18(%rsp), %r12
movq %r12, -0x10(%r12)
movq $0x0, -0x8(%r12)
movb $0x0, (%r12)
leaq 0x498(%rbx), %r14
movq 0x498(%rbx), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x7380
movsbl %al, %edx
leaq 0x8(%rsp), %rsi
movq %r14, %rdi
callq 0x7660
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
testb $0x5, 0x20(%rax,%rcx)
je 0x23295
movq %r14, %rdi
callq 0x70b0
leaq 0x478(%rbx), %rsi
movq %r14, %rdi
movl $0x8, %edx
callq 0x7330
incl 0x6a4(%rbx)
callq 0x28018
movq %rax, %rdi
callq 0x2841a
movq %rax, 0x6c8(%rbx)
movq 0x498(%rbx), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x7380
movsbl %al, %edx
leaq 0x8(%rsp), %rsi
movq %r14, %rdi
callq 0x7660
movq 0x8(%rsp), %rax
movq 0x10(%rsp), %rsi
cmpb $0xd, -0x1(%rax,%rsi)
jne 0x231a3
decq %rsi
leaq 0x8(%rsp), %rdi
movl $0x1, %edx
callq 0x70d0
leaq 0x6b0(%rbx), %r14
movq %r14, %rdi
callq 0x23bd2
leaq 0x8(%rsp), %rdi
movl $0x20, %esi
movq %r14, %rdx
callq 0x23c18
movq 0x4bdbd(%rip), %rdi     # 0x6ef88
leaq 0x34cfc(%rip), %rsi     # 0x57ece
movl $0xf, %edx
callq 0x7400
movl 0x6a4(%rbx), %esi
movq 0x4bd9f(%rip), %rdi     # 0x6ef88
callq 0x7280
movq %rax, %r14
leaq 0x32290(%rip), %rsi     # 0x55488
movl $0x3, %edx
movq %rax, %rdi
callq 0x7400
movl 0x6a0(%rbx), %esi
movq %r14, %rdi
callq 0x7280
movq %rax, %r14
leaq 0x34cc1(%rip), %rsi     # 0x57ede
movl $0xd, %edx
movq %rax, %rdi
callq 0x7400
leaq 0x38(%rsp), %r15
movq %r15, -0x10(%r15)
movq 0x8(%rbx), %rsi
movq 0x10(%rbx), %rdx
addq %rsi, %rdx
leaq 0x28(%rsp), %rdi
callq 0xaf32
movq 0x28(%rsp), %rsi
movq 0x30(%rsp), %rdx
movq %r14, %rdi
callq 0x7400
movq %rax, %r14
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x7380
movsbl %al, %esi
movq %r14, %rdi
callq 0x7040
movq %rax, %rdi
callq 0x7290
movq 0x28(%rsp), %rdi
cmpq %r15, %rdi
je 0x232d9
callq 0x7370
jmp 0x232d9
movq 0x8(%rsp), %rax
movq 0x10(%rsp), %rsi
cmpb $0xd, -0x1(%rax,%rsi)
jne 0x232b8
decq %rsi
leaq 0x8(%rsp), %rdi
movl $0x1, %edx
callq 0x70d0
leaq 0x6b0(%rbx), %r14
movq %r14, %rdi
callq 0x23bd2
leaq 0x8(%rsp), %rdi
movl $0x20, %esi
movq %r14, %rdx
callq 0x23c18
callq 0x28018
movq %rax, %r14
movq 0x6b0(%rbx), %rax
movq 0x6c8(%rbx), %r15
movq (%rax), %rdi
leaq 0x28(%rsp), %rsi
movl $0xa, %edx
callq 0x7070
addq %rax, %r15
movq %r14, %rdi
movq %r15, %rsi
movq %rbx, %rdx
xorl %ecx, %ecx
xorl %r8d, %r8d
callq 0x2841e
movq 0x8(%rsp), %rdi
cmpq %r12, %rdi
je 0x23326
callq 0x7370
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
jmp 0x2334a
jmp 0x2334a
movq %rax, %rbx
movq 0x28(%rsp), %rdi
cmpq %r15, %rdi
je 0x2334d
callq 0x7370
jmp 0x2334d
movq %rax, %rbx
movq 0x8(%rsp), %rdi
cmpq %r12, %rdi
je 0x2335c
callq 0x7370
movq %rbx, %rdi
callq 0x7620