// File: /workspace/github_cpp_makefile_star2_O2/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 %rbx
subq $0x40, %rsp
movq %rdi, %rbx
movq (%rdi), %rax
callq *0x20(%rax)
testq %rax, %rax
je 0x1b42a
movq %rbx, %rdi
movq %rax, %rsi
callq 0x18602
movl 0x150(%rbx), %eax
cmpl 0x50(%rbx), %eax
jae 0x1b5ba
leaq 0x10(%rsp), %rax
movq %rax, -0x10(%rax)
andq $0x0, -0x8(%rax)
movb $0x0, (%rax)
leaq 0x498(%rbx), %r14
movq %rsp, %rsi
movq %r14, %rdi
callq 0x7080
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
testb $0x5, 0x20(%rax,%rcx)
je 0x1b551
movq %r14, %rdi
callq 0x70a0
leaq 0x478(%rbx), %rsi
pushq $0x8
popq %rdx
movq %r14, %rdi
callq 0x72f0
incl 0x6a4(%rbx)
callq 0x1f784
movq %rax, %rdi
callq 0x1fafc
movq %rax, 0x6c8(%rbx)
movq %rsp, %rsi
movq %r14, %rdi
callq 0x7080
movq %rsp, %rdi
callq 0x1bc76
leaq 0x6b0(%rbx), %r14
movq %r14, %rdi
callq 0x1bc90
movq %rsp, %rdi
pushq $0x20
popq %rsi
movq %r14, %rdx
callq 0x1bc98
movq 0x46a9f(%rip), %rdi     # 0x61f78
leaq 0x2a8fe(%rip), %rsi     # 0x45dde
callq 0x7360
movl 0x6a4(%rbx), %esi
movq %rax, %rdi
callq 0x7270
leaq 0x27f8e(%rip), %rsi     # 0x43488
movq %rax, %rdi
callq 0x7360
movl 0x6a0(%rbx), %esi
movq %rax, %rdi
callq 0x7270
leaq 0x2a8d7(%rip), %rsi     # 0x45dee
movq %rax, %rdi
callq 0x7360
movq %rax, %r14
leaq 0x8(%rbx), %rsi
leaq 0x20(%rsp), %rdi
callq 0x7480
leaq 0x20(%rsp), %rsi
movq %r14, %rdi
callq 0x7310
movq %rax, %rdi
callq 0x71a0
leaq 0x20(%rsp), %rdi
callq 0x7678
jmp 0x1b576
movq %rsp, %rdi
callq 0x1bc76
leaq 0x6b0(%rbx), %r14
movq %r14, %rdi
callq 0x1bc90
movq %rsp, %rdi
pushq $0x20
popq %rsi
movq %r14, %rdx
callq 0x1bc98
callq 0x1f784
movq %rax, %r14
movq 0x6b0(%rbx), %rax
movq 0x6c8(%rbx), %r15
movq (%rax), %rdi
leaq 0x20(%rsp), %rsi
pushq $0xa
popq %rdx
callq 0x7660
addq %rax, %r15
movq %r14, %rdi
movq %r15, %rsi
movq %rbx, %rdx
xorl %ecx, %ecx
xorl %r8d, %r8d
callq 0x1fb00
movq %rsp, %rdi
callq 0x7678
addq $0x40, %rsp
popq %rbx
popq %r14
popq %r15
retq
jmp 0x1b5d7
movq %rax, %rbx
leaq 0x20(%rsp), %rdi
callq 0x7678
jmp 0x1b5da
jmp 0x1b5d7
movq %rax, %rbx
movq %rsp, %rdi
callq 0x7678
movq %rbx, %rdi
callq 0x75d0