// File: /workspace/github_cpp_makefile_star2_O1/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 0x1f117
movq %rsi, %r14
movq 0x30(%rdi), %rdi
leaq 0x26b51(%rip), %rsi     # 0x45ad0
movl $0x32, %edx
callq 0x55e0
movl %eax, %ebx
testl %eax, %eax
je 0x1f04a
leaq 0x26b36(%rip), %rdi     # 0x45ad0
leaq 0x1581d(%rip), %rsi     # 0x347be
callq 0x54d0
leaq 0x10(%rsp), %r15
leaq 0xf(%rsp), %rdx
movq %r15, %rdi
movq %rax, %rsi
callq 0x5140
leaq 0x26ae6(%rip), %rdi     # 0x45aa8
movq %r15, %rsi
callq 0x53e0
movq (%r15), %rdi
leaq 0x20(%rsp), %rax
cmpq %rax, %rdi
je 0x1efdc
callq 0x52a0
movq 0x26ac5(%rip), %rax     # 0x45aa8
cmpb $0x23, (%rax)
jne 0x1f008
cmpb $0x21, 0x1(%rax)
jne 0x1f008
cmpq $0x2, 0x26aba(%rip)     # 0x45ab0
jne 0x1f059
movq $0x0, 0x26aad(%rip) # 0x45ab0
movb $0x0, (%rax)
jmp 0x1f06c
movq 0x25fc1(%rip), %r14     # 0x44fd0
leaq 0x16fd5(%rip), %rsi     # 0x35feb
movl $0x1a, %edx
movq %r14, %rdi
callq 0x5350
movq (%r14), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x52b0
movsbl %al, %esi
movq %r14, %rdi
callq 0x5030
movq %rax, %rdi
callq 0x51f0
testl %ebx, %ebx
setne %al
addq $0x30, %rsp
popq %rbx
popq %r14
popq %r15
retq
leaq 0x26a48(%rip), %rdi     # 0x45aa8
movl $0x2, %edx
xorl %esi, %esi
callq 0x53a0
movq 0x26a35(%rip), %rdi     # 0x45aa8
callq 0x2e7d4
movq %rax, (%r14)
leaq 0x1573c(%rip), %r15     # 0x347be
xorl %edi, %edi
movq %r15, %rsi
callq 0x54d0
movq %rax, %rdi
callq 0x54c0
movl %eax, 0x26a6a(%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 0x2e7d4
movq %rax, 0x10(%r14)
movl 0x26a22(%rip), %eax     # 0x45b04
cmpl $0x2, %eax
je 0x1f10a
cmpl $0x1, %eax
je 0x1f0fd
testl %eax, %eax
jne 0x1f136
movl $0x0, 0x1c(%r14)
jmp 0x1f04a
movl $0x2, 0x1c(%r14)
jmp 0x1f04a
movl $0x3, 0x1c(%r14)
jmp 0x1f04a
leaq 0x16e80(%rip), %rdi     # 0x35f9e
leaq 0x16e82(%rip), %rsi     # 0x35fa7
leaq 0x16e8e(%rip), %rcx     # 0x35fba
movl $0x33, %edx
callq 0x51d0
leaq 0x16ec9(%rip), %rdi     # 0x36006
leaq 0x16e63(%rip), %rsi     # 0x35fa7
leaq 0x16e6f(%rip), %rcx     # 0x35fba
movl $0x4d, %edx
callq 0x51d0
nop