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

	if(!gzread(m_compressedTrace, mybuffer_dummy, TRACE_BUFFER_SIZE))
		return false;
	

	readNext_addr = string(strtok(mybuffer_dummy, " "));

	
	if(readNext_addr[0] != '#' || readNext_addr[1] != '!')
	{
		cout << "Line passed - Wrong Format" << endl;
		return true;
	}
	readNext_addr.erase( readNext_addr.begin(), readNext_addr.begin()+2);
	
	element.m_address = hexToInt1(readNext_addr.c_str());
	readNext_operation = atoi(strtok(NULL, " ") );		
	element.m_size = atoi(strtok(NULL, " ")); 		
	element.m_idthread = atoi( strtok(NULL, " ") );
	element.m_pc = hexToInt1(strtok(NULL, " "));

	switch(readNext_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 %r15
pushq %r14
pushq %rbx
subq $0x30, %rsp
cmpb $0x0, 0x28(%rdi)
je 0x1efdf
movq %rsi, %r14
movq 0x30(%rdi), %rdi
leaq 0x26c89(%rip), %rsi     # 0x45ad0
movl $0x32, %edx
callq 0x55e0
movl %eax, %ebx
testl %eax, %eax
je 0x1ef12
leaq 0x26c6e(%rip), %rdi     # 0x45ad0
leaq 0x15929(%rip), %rsi     # 0x34792
callq 0x54d0
leaq 0x10(%rsp), %r15
leaq 0xf(%rsp), %rdx
movq %r15, %rdi
movq %rax, %rsi
callq 0x5140
leaq 0x26c1e(%rip), %rdi     # 0x45aa8
movq %r15, %rsi
callq 0x53f0
movq (%r15), %rdi
leaq 0x20(%rsp), %rax
cmpq %rax, %rdi
je 0x1eea4
callq 0x52b0
movq 0x26bfd(%rip), %rax     # 0x45aa8
cmpb $0x23, (%rax)
jne 0x1eed0
cmpb $0x21, 0x1(%rax)
jne 0x1eed0
cmpq $0x2, 0x26bf2(%rip)     # 0x45ab0
jne 0x1ef21
movq $0x0, 0x26be5(%rip) # 0x45ab0
movb $0x0, (%rax)
jmp 0x1ef34
movq 0x260f9(%rip), %r14     # 0x44fd0
leaq 0x17105(%rip), %rsi     # 0x35fe3
movl $0x1a, %edx
movq %r14, %rdi
callq 0x5360
movq (%r14), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x52c0
movsbl %al, %esi
movq %r14, %rdi
callq 0x5030
movq %rax, %rdi
callq 0x5200
testl %ebx, %ebx
setne %al
addq $0x30, %rsp
popq %rbx
popq %r14
popq %r15
retq
leaq 0x26b80(%rip), %rdi     # 0x45aa8
movl $0x2, %edx
xorl %esi, %esi
callq 0x53b0
movq 0x26b6d(%rip), %rdi     # 0x45aa8
callq 0x2e458
movq %rax, (%r14)
leaq 0x15848(%rip), %r15     # 0x34792
xorl %edi, %edi
movq %r15, %rsi
callq 0x54d0
movq %rax, %rdi
callq 0x54c0
movl %eax, 0x26ba2(%rip)     # 0x45b04
xorl %edi, %edi
movq %r15, %rsi
callq 0x54d0
movq %rax, %rdi
callq 0x54c0
movl %eax, 0x8(%r14)
xorl %edi, %edi
movq %r15, %rsi
callq 0x54d0
movq %rax, %rdi
callq 0x54c0
movl %eax, 0x20(%r14)
xorl %edi, %edi
movq %r15, %rsi
callq 0x54d0
movq %rax, %rdi
callq 0x2e458
movq %rax, 0x10(%r14)
movl 0x26b5a(%rip), %eax     # 0x45b04
cmpl $0x2, %eax
je 0x1efd2
cmpl $0x1, %eax
je 0x1efc5
testl %eax, %eax
jne 0x1effe
movl $0x0, 0x1c(%r14)
jmp 0x1ef12
movl $0x2, 0x1c(%r14)
jmp 0x1ef12
movl $0x3, 0x1c(%r14)
jmp 0x1ef12
leaq 0x16fb0(%rip), %rdi     # 0x35f96
leaq 0x16fb2(%rip), %rsi     # 0x35f9f
leaq 0x16fbe(%rip), %rcx     # 0x35fb2
movl $0x33, %edx
callq 0x51d0
leaq 0x16ff9(%rip), %rdi     # 0x35ffe
leaq 0x16f93(%rip), %rsi     # 0x35f9f
leaq 0x16f9f(%rip), %rcx     # 0x35fb2
movl $0x4d, %edx
callq 0x51d0
nop