// File: /workspace/github_cpp_makefile_star2_O1/gvaumour[P]cache-simulator/src/MemoryTrace.cc
// Function: TextTrace::readNext(Access&)
bool
TextTrace::readNext(Access& element)
{	
	assert(m_isOpen);

	string line;
	vector<string> split_line;
			
	if(!getline(m_textTrace , line)){
		return false;
	}
	if(line.empty())
		return false;
	
	split_line = split(line , ' ');

	string addr = split_line[0];

	if(addr[0] != '#' || addr[1] != '!')
	{
		cout << "Line passed - Wrong Format" << endl;
		return false;
	}

	addr.erase( remove(addr.begin(), addr.end(), '#'), addr.end());
	addr.erase( remove(addr.begin(), addr.end(), '!'), addr.end());

	element.m_address = hexToInt(addr);
	int operation = atoi(split_line[1].c_str());		
	element.m_size = atoi(split_line[2].c_str());		
	element.m_idthread = atoi(split_line[3].c_str());
	element.m_pc = hexToInt(split_line[4]);


	switch(operation){
		case 0 : element.m_type = MemCmd::INST_READ;break;
		case 1 : element.m_type = MemCmd::DATA_READ;break;
		case 2 : element.m_type = MemCmd::DATA_WRITE;break;
		default: assert(false && "operation not recognized \n");
	}

	return true;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xd8, %rsp
cmpb $0x0, 0x28(%rdi)
je 0x1f500
movq %rsi, %rbx
movq %rdi, %r14
leaq 0x50(%rsp), %r15
movq %r15, -0x10(%r15)
xorl %eax, %eax
movq %rax, -0x8(%r15)
movb $0x0, (%r15)
movq %rax, 0x30(%rsp)
xorps %xmm0, %xmm0
movaps %xmm0, 0x20(%rsp)
movq 0x30(%rdi), %rax
addq $0x30, %r14
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x52b0
movsbl %al, %edx
leaq 0x40(%rsp), %rsi
movq %r14, %rdi
callq 0x55d0
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
testb $0x5, 0x20(%rax,%rcx)
je 0x1f2ab
xorl %ebx, %ebx
leaq 0x20(%rsp), %rdi
callq 0xc830
movq 0x40(%rsp), %rdi
cmpq %r15, %rdi
je 0x1f297
callq 0x52a0
movl %ebx, %eax
addq $0xd8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x48(%rsp), %rdx
testq %rdx, %rdx
je 0x1f27c
leaq 0xc8(%rsp), %r12
movq %r12, -0x10(%r12)
movq 0x40(%rsp), %rsi
addq %rsi, %rdx
leaq 0xb8(%rsp), %rdi
callq 0xcc1c
leaq 0x60(%rsp), %rdi
leaq 0xb8(%rsp), %rsi
movl $0x20, %edx
callq 0x2e5ac
xorps %xmm0, %xmm0
movq %rsp, %rdi
movaps %xmm0, (%rdi)
movaps 0x20(%rsp), %xmm0
movq 0x30(%rsp), %rax
leaq 0x60(%rsp), %r14
movaps (%r14), %xmm1
movaps %xmm1, 0x20(%rsp)
movq 0x10(%r14), %rcx
movq %rcx, 0x30(%rsp)
movq %rax, 0x10(%rdi)
movaps (%rdi), %xmm1
movaps %xmm0, (%rdi)
movaps %xmm1, (%r14)
movq $0x0, 0x10(%r14)
callq 0xc830
movq %r14, %rdi
callq 0xc830
movq 0xb8(%rsp), %rdi
cmpq %r12, %rdi
je 0x1f34d
callq 0x52a0
movq 0x20(%rsp), %rax
leaq 0x10(%rsp), %r14
movq %r14, -0x10(%r14)
movq (%rax), %rsi
movq 0x8(%rax), %rdx
addq %rsi, %rdx
movq %rsp, %rdi
callq 0xcc1c
movq (%rsp), %rdi
cmpb $0x23, (%rdi)
jne 0x1f4a1
cmpb $0x21, 0x1(%rdi)
jne 0x1f4a1
movq 0x8(%rsp), %rsi
addq %rdi, %rsi
leaq 0x60(%rsp), %rdx
movb $0x23, (%rdx)
callq 0x1f9b8
movq %rax, %rcx
subq (%rsp), %rcx
movq %rcx, 0x8(%rsp)
movb $0x0, (%rax)
movq (%rsp), %rdi
movq 0x8(%rsp), %rsi
addq %rdi, %rsi
leaq 0x60(%rsp), %rdx
movb $0x21, (%rdx)
callq 0x1f9b8
movq %rax, %rcx
subq (%rsp), %rcx
movq %rcx, 0x8(%rsp)
movb $0x0, (%rax)
movq (%rsp), %rsi
leaq 0xa8(%rsp), %r12
movq %r12, -0x10(%r12)
movq 0x8(%rsp), %rdx
addq %rsi, %rdx
leaq 0x98(%rsp), %rdi
callq 0xcc1c
leaq 0x98(%rsp), %rdi
callq 0x2e768
movq %rax, (%rbx)
movq 0x98(%rsp), %rdi
cmpq %r12, %rdi
je 0x1f418
callq 0x52a0
movq 0x20(%rsp), %r13
movq 0x20(%r13), %rdi
callq 0x54c0
movl %eax, %ebp
movq 0x40(%r13), %rdi
callq 0x54c0
movl %eax, 0x8(%rbx)
movq 0x60(%r13), %rdi
callq 0x54c0
movl %eax, 0x20(%rbx)
leaq 0x88(%rsp), %r12
movq %r12, -0x10(%r12)
movq 0x80(%r13), %rsi
movq 0x88(%r13), %rdx
addq %rsi, %rdx
leaq 0x78(%rsp), %rdi
callq 0xcc1c
leaq 0x78(%rsp), %rdi
callq 0x2e768
movq %rax, 0x10(%rbx)
movq 0x78(%rsp), %rdi
cmpq %r12, %rdi
je 0x1f485
callq 0x52a0
cmpl $0x3, %ebp
jae 0x1f51f
movl %ebp, %eax
leaq 0x16c05(%rip), %rcx     # 0x3609c
movl (%rcx,%rax,4), %eax
movl %eax, 0x1c(%rbx)
movb $0x1, %bl
jmp 0x1f4e9
movq 0x25b28(%rip), %rbx     # 0x44fd0
leaq 0x16b3c(%rip), %rsi     # 0x35feb
movl $0x1a, %edx
movq %rbx, %rdi
callq 0x5350
movq (%rbx), %rax
addq -0x18(%rax), %rbx
movq %rbx, %rdi
movl $0xa, %esi
callq 0x52b0
movsbl %al, %esi
movq 0x25af6(%rip), %rdi     # 0x44fd0
callq 0x5030
movq %rax, %rdi
callq 0x51f0
xorl %ebx, %ebx
movq (%rsp), %rdi
cmpq %r14, %rdi
je 0x1f27e
callq 0x52a0
jmp 0x1f27e
leaq 0x16a97(%rip), %rdi     # 0x35f9e
leaq 0x16a99(%rip), %rsi     # 0x35fa7
leaq 0x16b39(%rip), %rcx     # 0x3604e
movl $0x6b, %edx
callq 0x51d0
leaq 0x16ae0(%rip), %rdi     # 0x36006
leaq 0x16a7a(%rip), %rsi     # 0x35fa7
leaq 0x16b1a(%rip), %rcx     # 0x3604e
movl $0x8e, %edx
callq 0x51d0
movq %rax, %rbx
movq 0x78(%rsp), %rdi
jmp 0x1f555
jmp 0x1f57b
movq %rax, %rbx
movq 0x98(%rsp), %rdi
cmpq %r12, %rdi
je 0x1f57e
callq 0x52a0
jmp 0x1f57e
jmp 0x1f57b
jmp 0x1f57b
jmp 0x1f58e
movq %rax, %rbx
movq 0xb8(%rsp), %rdi
cmpq %r12, %rdi
jne 0x1f587
jmp 0x1f591
jmp 0x1f58e
movq %rax, %rbx
movq (%rsp), %rdi
cmpq %r14, %rdi
je 0x1f591
callq 0x52a0
jmp 0x1f591
movq %rax, %rbx
leaq 0x20(%rsp), %rdi
callq 0xc830
movq 0x40(%rsp), %rdi
cmpq %r15, %rdi
je 0x1f5aa
callq 0x52a0
movq %rbx, %rdi
callq 0x55a0