// File: /workspace/github_cpp_makefile_star2_O3/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 0x45ed
leaq 0xeb92(%rip), %rcx      # 0x130b0
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq 0x1d8(%rdi), %rdi
testq %rdi, %rdi
je 0x45de
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 0x45de
sarq $0x3, %rcx
movl 0x18(%rbx), %edx
movl $0x1, %esi
xorl %r8d, %r8d
movq (%rax,%r8,8), %r8
cmpl %edx, 0x18(%r8)
je 0x45c1
movl %esi, %r8d
incl %esi
cmpq %r8, %rcx
ja 0x4571
jmp 0x45de
incl 0x1d0(%rdi)
jmp 0x45de
movq 0x70(%rdi), %rax
movq 0x78(%rdi), %rcx
subq %rax, %rcx
je 0x45de
sarq $0x3, %rcx
movl 0x18(%rbx), %edx
movl $0x1, %esi
xorl %r8d, %r8d
movq (%rax,%r8,8), %r8
cmpl %edx, 0x18(%r8)
je 0x45cf
movl %esi, %r8d
incl %esi
cmpq %r8, %rcx
ja 0x45ab
jmp 0x45de
movq 0x8(%rdi), %rax
subq 0x70(%r8), %rax
movq %rax, 0x78(%r8)
jmp 0x45de
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 0x149fc(%rip), %r14     # 0x18ff0
leaq 0xebcd(%rip), %r15      # 0x131c8
movq %r14, %rdi
movq %r15, %rsi
callq 0x31c0
leaq 0xebc4(%rip), %r12      # 0x131d1
movq %rax, %rdi
movq %r12, %rsi
callq 0x31c0
leaq 0xeb52(%rip), %r13      # 0x13171
movq %rax, %rdi
movq %r13, %rsi
callq 0x31c0
movq %rax, %rdi
movl $0x449, %esi            # imm = 0x449
callq 0x3330
leaq 0xeb9b(%rip), %rbp      # 0x131d9
movq %rax, %rdi
movq %rbp, %rsi
callq 0x31c0
leaq 0xf164(%rip), %rsi      # 0x137b4
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 0xc7bb
movq %rax, %rdi
callq 0x30d0
xorl %edi, %edi
callq 0x3220
nop