// File: /workspace/github_cpp_makefile_star2_O1/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 0x231da
movq %rbx, %rdi
movq %rax, %rsi
callq 0x1f82e
movl 0x150(%rbx), %eax
cmpl 0x50(%rbx), %eax
jae 0x23446
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 0x233b5
movq %r14, %rdi
callq 0x70b0
leaq 0x478(%rbx), %rsi
movq %r14, %rdi
movl $0x8, %edx
callq 0x7330
incl 0x6a4(%rbx)
callq 0x281b4
movq %rax, %rdi
callq 0x285a6
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 0x232c3
decq %rsi
leaq 0x8(%rsp), %rdi
movl $0x1, %edx
callq 0x70d0
leaq 0x6b0(%rbx), %r14
movq %r14, %rdi
callq 0x23d70
leaq 0x8(%rsp), %rdi
movl $0x20, %esi
movq %r14, %rdx
callq 0x23db6
movq 0x4bca5(%rip), %rdi     # 0x6ef90
leaq 0x34bdc(%rip), %rsi     # 0x57ece
movl $0xf, %edx
callq 0x7400
movl 0x6a4(%rbx), %esi
movq 0x4bc87(%rip), %rdi     # 0x6ef90
callq 0x7280
movq %rax, %r14
leaq 0x32170(%rip), %rsi     # 0x55488
movl $0x3, %edx
movq %rax, %rdi
callq 0x7400
movl 0x6a0(%rbx), %esi
movq %r14, %rdi
callq 0x7280
movq %rax, %r14
leaq 0x34ba1(%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 0xb036
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 0x233f9
callq 0x7370
jmp 0x233f9
movq 0x8(%rsp), %rax
movq 0x10(%rsp), %rsi
cmpb $0xd, -0x1(%rax,%rsi)
jne 0x233d8
decq %rsi
leaq 0x8(%rsp), %rdi
movl $0x1, %edx
callq 0x70d0
leaq 0x6b0(%rbx), %r14
movq %r14, %rdi
callq 0x23d70
leaq 0x8(%rsp), %rdi
movl $0x20, %esi
movq %r14, %rdx
callq 0x23db6
callq 0x281b4
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 0x285aa
movq 0x8(%rsp), %rdi
cmpq %r12, %rdi
je 0x23446
callq 0x7370
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
jmp 0x2346a
jmp 0x2346a
movq %rax, %rbx
movq 0x28(%rsp), %rdi
cmpq %r15, %rdi
je 0x2346d
callq 0x7370
jmp 0x2346d
movq %rax, %rbx
movq 0x8(%rsp), %rdi
cmpq %r12, %rdi
je 0x2347c
callq 0x7370
movq %rbx, %rdi
callq 0x7620