// File: /workspace/github_cpp_makefile_star2_O1/dramninjasUMD[P]BOBSim/BOB.cpp
// Function: BOBSim::BOB::ReportCallback(BOBSim::BusPacket*, unsigned int)
void BOB::ReportCallback(BusPacket *bp, unsigned i)
{
	if(bp->busPacketType==ACTIVATE)
	{
		for(unsigned p=0; p<pendingReads.size(); p++)
		{
			if(pendingReads[p]->transactionID==bp->transactionID)
			{
				pendingReads[p]->dramStartTime = currentClockCycle;
				pendingReads[p]->cyclesInWorkQueue=bp->queueWaitTime;
				break;
			}
		}
	}
	else if(bp->busPacketType==WRITE_P)
	{
		if (writeIssuedCB)
		{
			(*writeIssuedCB)(bp->port, bp->address);
		}
	}
	else if(bp->busPacketType==WRITE_DATA)
	{
		committedWrites++;
	}
	else if(bp->busPacketType==READ_DATA)
	{
		for(unsigned p=0; p<pendingReads.size(); p++)
		{
			if(pendingReads[p]->transactionID==bp->transactionID)
			{
				pendingReads[p]->dramTimeTotal = currentClockCycle - pendingReads[p]->dramStartTime;
				break;
			}
		}
	}
	else
	{
		ERROR("== Error - Wrong type of packet received in bob");
		ERROR(*bp);
		exit(0);
	}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %rbx
movl 0x4(%rsi), %eax
addl $-0x3, %eax
cmpl $0x5, %eax
ja 0x47a9
leaq 0xe986(%rip), %rcx      # 0x13060
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq 0x1d8(%rdi), %rdi
testq %rdi, %rdi
je 0x479a
movl 0x1c(%rbx), %esi
movq 0x30(%rbx), %rdx
movq (%rdi), %rax
movq 0x10(%rax), %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmpq *%rax
movq 0x70(%rdi), %rax
movq 0x78(%rdi), %rcx
subq %rax, %rcx
je 0x479a
sarq $0x3, %rcx
movl 0x18(%rbx), %edx
movl $0x1, %esi
xorl %r8d, %r8d
movq (%rax,%r8,8), %r8
cmpl %edx, 0x18(%r8)
je 0x477d
movl %esi, %r8d
incl %esi
cmpq %r8, %rcx
ja 0x472d
jmp 0x479a
incl 0x1d0(%rdi)
jmp 0x479a
movq 0x70(%rdi), %rax
movq 0x78(%rdi), %rcx
subq %rax, %rcx
je 0x479a
sarq $0x3, %rcx
movl 0x18(%rbx), %edx
movl $0x1, %esi
xorl %r8d, %r8d
movq (%rax,%r8,8), %r8
cmpl %edx, 0x18(%r8)
je 0x478b
movl %esi, %r8d
incl %esi
cmpq %r8, %rcx
ja 0x4767
jmp 0x479a
movq 0x8(%rdi), %rax
subq 0x70(%r8), %rax
movq %rax, 0x78(%r8)
jmp 0x479a
movq 0x8(%rdi), %rax
movq %rax, 0x70(%r8)
movl 0x20(%rbx), %eax
movl %eax, 0x5c(%r8)
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x14840(%rip), %r14     # 0x18ff0
leaq 0xe9c1(%rip), %r15      # 0x13178
movq %r14, %rdi
movq %r15, %rsi
callq 0x31c0
leaq 0xe9b8(%rip), %r12      # 0x13181
movq %rax, %rdi
movq %r12, %rsi
callq 0x31c0
leaq 0xe946(%rip), %r13      # 0x13121
movq %rax, %rdi
movq %r13, %rsi
callq 0x31c0
movq %rax, %rdi
movl $0x449, %esi            # imm = 0x449
callq 0x3330
leaq 0xe98f(%rip), %rbp      # 0x13189
movq %rax, %rdi
movq %rbp, %rsi
callq 0x31c0
leaq 0xef58(%rip), %rsi      # 0x13764
movq %rax, %rdi
callq 0x31c0
movq %rax, %rdi
callq 0x30d0
movq %r14, %rdi
movq %r15, %rsi
callq 0x31c0
movq %rax, %rdi
movq %r12, %rsi
callq 0x31c0
movq %rax, %rdi
movq %r13, %rsi
callq 0x31c0
movq %rax, %rdi
movl $0x44a, %esi            # imm = 0x44A
callq 0x3330
movq %rax, %rdi
movq %rbp, %rsi
callq 0x31c0
movq %rax, %rdi
movq %rbx, %rsi
callq 0xc9a7
movq %rax, %rdi
callq 0x30d0
xorl %edi, %edi
callq 0x3220
nop