// File: estwings57[P]CasHMC/sources/LinkMaster.cpp
// Function: CasHMC::LinkMaster::ReturnRetryPointer(CasHMC::Packet*)
void LinkMaster::ReturnRetryPointer(Packet *packet)
{
	lastestRRP = packet->FRP;
	if(Buffers.size() != 0) {
		Buffers[0]->RRP = lastestRRP;
		DEBUG(ALI(18)<<header<<ALI(15)<<*Buffers[0]<<(downstream ? "Down) " : "Up)   ")<<"RRP ("<<lastestRRP<<") is embedded in this packet");
	}
	else {
		//packet, cmd, addr, cub, lng, *lat
		Packet *packetPRET = new Packet(FLOW, PRET, 0, 0, 1, NULL);
		packetPRET->TAG = packet->TAG;
		packetPRET->RRP = lastestRRP;
		if(downstream)	packetPRET->bufPopDelay = 0;
		linkRxTx.push_back(packetPRET);
		DEBUG(ALI(18)<<header<<ALI(15)<<*packetPRET<<(downstream ? "Down) " : "Up)   ")<<"MAKING PRET packet to be embedded RRP ("<<lastestRRP<<")");
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xc0, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x8(%rbp), %rdi
movq %rdi, -0x50(%rbp)
movq -0x10(%rbp), %rax
movl 0x448(%rax), %eax
movl %eax, 0x20c(%rdi)
addq $0x1d0, %rdi            # imm = 0x1D0
callq 0x22d60
cmpq $0x0, %rax
je 0x3ca5b
movq -0x50(%rbp), %rdi
movl 0x20c(%rdi), %eax
movl %eax, -0x54(%rbp)
addq $0x1d0, %rdi            # imm = 0x1D0
xorl %eax, %eax
movl %eax, %esi
callq 0x29940
movl -0x54(%rbp), %ecx
movq (%rax), %rax
movl %ecx, 0x44c(%rax)
leaq 0x29c17(%rip), %rax     # 0x66528
testb $0x1, (%rax)
je 0x3ca56
leaq 0x29c08(%rip), %rax     # 0x66529
testb $0x1, (%rax)
jne 0x3ca56
movl $0x12, %edi
callq 0x177b0
movl %eax, -0x14(%rbp)
movl -0x14(%rbp), %esi
movq 0x2968f(%rip), %rdi     # 0x65fd0
callq 0x4440
movq %rax, -0x80(%rbp)
movl $0x20, %edi
callq 0x177d0
movq -0x80(%rbp), %rdi
movb %al, -0x15(%rbp)
movzbl -0x15(%rbp), %esi
callq 0x4550
movq -0x50(%rbp), %rsi
movq %rax, %rdi
addq $0x20, %rsi
callq 0x4320
movq %rax, -0x78(%rbp)
movl $0xf, %edi
callq 0x177b0
movq -0x78(%rbp), %rdi
movl %eax, -0x1c(%rbp)
movl -0x1c(%rbp), %esi
callq 0x4440
movq %rax, -0x70(%rbp)
movl $0x20, %edi
callq 0x177d0
movq -0x70(%rbp), %rdi
movb %al, -0x1d(%rbp)
movzbl -0x1d(%rbp), %esi
callq 0x4550
movq -0x50(%rbp), %rdi
movq %rax, -0x68(%rbp)
addq $0x1d0, %rdi            # imm = 0x1D0
xorl %eax, %eax
movl %eax, %esi
callq 0x29940
movq -0x68(%rbp), %rdi
movq (%rax), %rsi
callq 0x44960
movq %rax, %rcx
movq -0x50(%rbp), %rax
movq %rcx, -0x60(%rbp)
testb $0x1, 0x1cc(%rax)
je 0x3c9f7
leaq 0x16c5a(%rip), %rax     # 0x53648
movq %rax, -0x88(%rbp)
jmp 0x3ca07
leaq 0x16c51(%rip), %rax     # 0x5364f
movq %rax, -0x88(%rbp)
jmp 0x3ca07
movq -0x60(%rbp), %rdi
movq -0x88(%rbp), %rsi
callq 0x4380
movq %rax, %rdi
leaq 0x16d58(%rip), %rsi     # 0x53779
callq 0x4380
movq %rax, %rdi
movq -0x50(%rbp), %rax
movl 0x20c(%rax), %esi
callq 0x44c0
movq %rax, %rdi
leaq 0x16cf8(%rip), %rsi     # 0x5373a
callq 0x4380
movq %rax, %rdi
movq 0x2955f(%rip), %rsi     # 0x65fb0
callq 0x43c0
jmp 0x3cc64
movl $0x468, %edi            # imm = 0x468
callq 0x4390
movq %rax, %rdi
movq %rdi, %rax
movq %rax, -0x90(%rbp)
movq %rsp, %rax
movq $0x0, (%rax)
xorl %r8d, %r8d
movl %r8d, %ecx
movl $0x2, %esi
movl $0x1, %r9d
movl %r9d, %edx
callq 0x43a90
jmp 0x3ca97
movq -0x50(%rbp), %rax
movq -0x90(%rbp), %rcx
movq %rcx, -0x28(%rbp)
movq -0x10(%rbp), %rcx
movl 0x42c(%rcx), %edx
movq -0x28(%rbp), %rcx
movl %edx, 0x42c(%rcx)
movl 0x20c(%rax), %edx
movq -0x28(%rbp), %rcx
movl %edx, 0x44c(%rcx)
testb $0x1, 0x1cc(%rax)
je 0x3cb02
movq -0x28(%rbp), %rax
movl $0x0, 0x14(%rax)
jmp 0x3cb02
movq -0x90(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x30(%rbp)
movl %eax, -0x34(%rbp)
movl $0x468, %esi            # imm = 0x468
callq 0x43a0
jmp 0x3cc6d
movq -0x50(%rbp), %rdi
addq $0x1e8, %rdi            # imm = 0x1E8
leaq -0x28(%rbp), %rsi
callq 0x29ef0
leaq 0x29a0b(%rip), %rax     # 0x66528
testb $0x1, (%rax)
je 0x3cc62
leaq 0x299fc(%rip), %rax     # 0x66529
testb $0x1, (%rax)
jne 0x3cc62
movl $0x12, %edi
callq 0x177b0
movl %eax, -0x38(%rbp)
movl -0x38(%rbp), %esi
movq 0x29483(%rip), %rdi     # 0x65fd0
callq 0x4440
movq %rax, -0xb0(%rbp)
movl $0x20, %edi
callq 0x177d0
movq -0xb0(%rbp), %rdi
movb %al, -0x39(%rbp)
movzbl -0x39(%rbp), %esi
callq 0x4550
movq -0x50(%rbp), %rsi
movq %rax, %rdi
addq $0x20, %rsi
callq 0x4320
movq %rax, -0xa8(%rbp)
movl $0xf, %edi
callq 0x177b0
movq -0xa8(%rbp), %rdi
movl %eax, -0x40(%rbp)
movl -0x40(%rbp), %esi
callq 0x4440
movq %rax, -0xa0(%rbp)
movl $0x20, %edi
callq 0x177d0
movq -0xa0(%rbp), %rdi
movb %al, -0x41(%rbp)
movzbl -0x41(%rbp), %esi
callq 0x4550
movq %rax, %rdi
movq -0x28(%rbp), %rsi
callq 0x44960
movq %rax, %rcx
movq -0x50(%rbp), %rax
movq %rcx, -0x98(%rbp)
testb $0x1, 0x1cc(%rax)
je 0x3cc00
leaq 0x16a51(%rip), %rax     # 0x53648
movq %rax, -0xb8(%rbp)
jmp 0x3cc10
leaq 0x16a48(%rip), %rax     # 0x5364f
movq %rax, -0xb8(%rbp)
jmp 0x3cc10
movq -0x98(%rbp), %rdi
movq -0xb8(%rbp), %rsi
callq 0x4380
movq %rax, %rdi
leaq 0x16b2a(%rip), %rsi     # 0x53757
callq 0x4380
movq %rax, %rdi
movq -0x50(%rbp), %rax
movl 0x20c(%rax), %esi
callq 0x44c0
movq %rax, %rdi
leaq 0x1772b(%rip), %rsi     # 0x54379
callq 0x4380
movq %rax, %rdi
movq 0x29353(%rip), %rsi     # 0x65fb0
callq 0x43c0
jmp 0x3cc64
addq $0xc0, %rsp
popq %rbp
retq
movq -0x30(%rbp), %rdi
callq 0x4630
nopw %cs:(%rax,%rax)