// File: /workspace/github_cpp_makefile_star2_O2/estwings57[P]CasHMC/sources/LinkMaster.cpp
// Function: CasHMC::LinkMaster::StartRetry(CasHMC::Packet*)
void LinkMaster::StartRetry(Packet *packet)
{
	startRetryTimer = true;
	retryTimer = 0;
	for(int i=0; i<NUM_OF_IRTRY; i++) {
		if(currentState == LINK_RETRY) {
			readyStartRetry = true;
		}
		else {
			//packet, cmd, addr, cub, lng, *lat
			Packet *packetIRTRY = new Packet(FLOW, IRTRY, 0, 0, 1, NULL);
			packetIRTRY->TAG = packet->TAG;
			packetIRTRY->RRP = lastestRRP;
			packetIRTRY->FRP = 1;		//StartRetry flag is set with FRP[0] = 1
			if(downstream)	packetIRTRY->bufPopDelay = 0;
			linkRxTx.insert(linkRxTx.begin(), packetIRTRY);
			currentState = START_RETRY;
			header.erase(header.find(")"));
			header += ") ST_RT";
		}
	}
	if(currentState == LINK_RETRY) {
		DEBUG(ALI(18)<<header<<ALI(15)<<*packet<<(downstream ? "Down) " : "Up)   ")<<"START RETRY sequence is delayed until LINK RETRY");
	}
	else {
		DEBUG(ALI(18)<<header<<ALI(15)<<*packet<<(downstream ? "Down) " : "Up)   ")<<"START RETRY sequence is initiated");
	}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rsi, %r14
movq %rdi, %rbx
movb $0x1, 0x251(%rdi)
andl $0x0, 0x254(%rdi)
leaq 0x1e8(%rdi), %r12
leaq 0x20(%rdi), %r15
leaq 0x16a58(%rip), %rax     # 0x314d8
movl (%rax), %eax
xorl %ebp, %ebp
movl 0x200(%rbx), %ecx
cmpl %eax, %ebp
jge 0x1ab61
cmpl $0xb, %ecx
jne 0x1aaa3
movb $0x1, 0x250(%rbx)
jmp 0x1ab5a
movl $0x468, %edi            # imm = 0x468
callq 0x4310
movq %rax, %r13
andq $0x0, (%rsp)
movq %rax, %rdi
pushq $0x2
popq %rsi
pushq $0x3
popq %rdx
xorl %ecx, %ecx
xorl %r8d, %r8d
pushq $0x1
popq %r9
callq 0x1dd04
movq %r13, 0x10(%rsp)
movl 0x42c(%r14), %eax
movl %eax, 0x42c(%r13)
movl 0x20c(%rbx), %eax
movl %eax, 0x44c(%r13)
movl $0x1, 0x448(%r13)
cmpb $0x1, 0x1cc(%rbx)
jne 0x1ab05
andl $0x0, 0x14(%r13)
movq 0x1e8(%rbx), %rsi
movq %r12, %rdi
leaq 0x10(%rsp), %rdx
callq 0x132ba
movl $0xa, 0x200(%rbx)
movq %r15, %rdi
leaq 0xc9a4(%rip), %rsi      # 0x274d1
xorl %edx, %edx
callq 0x4580
movq %r15, %rdi
movq %rax, %rsi
pushq $-0x1
popq %rdx
callq 0x40b0
movq %r15, %rdi
leaq 0xbe42(%rip), %rsi      # 0x2698e
callq 0x4550
leaq 0x16980(%rip), %rax     # 0x314d8
movl (%rax), %eax
incl %ebp
jmp 0x1aa84
leaq 0x16920(%rip), %rax     # 0x31488
movb (%rax), %al
cmpl $0xb, %ecx
jne 0x1ab90
testb %al, %al
je 0x1ac34
leaq 0x1690b(%rip), %rax     # 0x31489
cmpb $0x0, (%rax)
jne 0x1ac34
leaq 0xbe08(%rip), %r12      # 0x26996
jmp 0x1abaf
testb %al, %al
je 0x1ac34
leaq 0x168ea(%rip), %rax     # 0x31489
cmpb $0x0, (%rax)
jne 0x1ac34
leaq 0xbe18(%rip), %r12      # 0x269c7
movq 0x1641a(%rip), %rdi     # 0x30fd0
movq (%rdi), %rax
movq -0x18(%rax), %rax
movq $0x12, 0x10(%rdi,%rax)
pushq $0x20
popq %rbp
movl %ebp, %esi
callq 0x4440
movq %rax, %rdi
movq %r15, %rsi
callq 0x42b0
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
movq $0xf, 0x10(%rax,%rcx)
movq %rax, %rdi
movl %ebp, %esi
callq 0x4440
movq %rax, %rdi
movq %r14, %rsi
callq 0x1e2c8
leaq 0xbb61(%rip), %rcx      # 0x26768
leaq 0xbb61(%rip), %rsi      # 0x2676f
cmpb $0x0, 0x1cc(%rbx)
cmovneq %rcx, %rsi
movq %rax, %rdi
callq 0x4300
movq %rax, %rdi
movq %r12, %rsi
callq 0x4300
movq %rax, %rdi
callq 0x4180
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
movl $0x468, %esi            # imm = 0x468
movq %r13, %rdi
callq 0x4320
movq %rbx, %rdi
callq 0x4520
nop