// File: /workspace/github_cpp_makefile_star2_O1/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, 0x8(%rsp)
movq %rdi, %rbx
movb $0x1, 0x251(%rdi)
movl $0x0, 0x254(%rdi)
leaq 0x18834(%rip), %rbp     # 0x3c4d8
cmpl $0x0, (%rbp)
jle 0x23dac
leaq 0x1e8(%rbx), %r15
leaq 0x20(%rbx), %r12
xorl %r14d, %r14d
cmpl $0xb, 0x200(%rbx)
jne 0x23cd1
movb $0x1, 0x250(%rbx)
jmp 0x23d9f
movl $0x468, %edi            # imm = 0x468
callq 0x42f0
movq %rax, %r13
movq $0x0, (%rsp)
movq %rax, %rdi
movl $0x2, %esi
movl $0x3, %edx
xorl %ecx, %ecx
xorl %r8d, %r8d
movl $0x1, %r9d
callq 0x284bc
movq %r13, 0x10(%rsp)
movq 0x8(%rsp), %rax
movl 0x42c(%rax), %eax
movl %eax, 0x42c(%r13)
movl 0x20c(%rbx), %eax
movl %eax, 0x44c(%r13)
movl $0x1, 0x448(%r13)
cmpb $0x1, 0x1cc(%rbx)
jne 0x23d43
movl $0x0, 0x14(%r13)
movq 0x1e8(%rbx), %rsi
movq %r15, %rdi
leaq 0x10(%rsp), %rdx
callq 0x1a82e
movl $0xa, 0x200(%rbx)
movl $0x1, %ecx
movq %r12, %rdi
leaq 0x106f1(%rip), %rsi     # 0x34461
xorl %edx, %edx
callq 0x4510
movq 0x28(%rbx), %rcx
cmpq %rax, %rcx
jb 0x2400f
movq %rax, 0x28(%rbx)
movq 0x20(%rbx), %rcx
movb $0x0, (%rcx,%rax)
movq %r12, %rdi
leaq 0xfb88(%rip), %rsi      # 0x33922
callq 0x4580
incl %r14d
cmpl (%rbp), %r14d
jl 0x23cbc
cmpl $0xb, 0x200(%rbx)
leaq 0x186ce(%rip), %rax     # 0x3c488
movb (%rax), %al
jne 0x23ecc
testb %al, %al
je 0x24000
leaq 0x186b8(%rip), %rax     # 0x3c489
cmpb $0x0, (%rax)
jne 0x24000
movq 0x181ef(%rip), %rax     # 0x3bfd0
movq (%rax), %rcx
movq -0x18(%rcx), %rdx
movq $0x12, 0x10(%rax,%rdx)
movq -0x18(%rcx), %rcx
leaq (%rax,%rcx), %r14
cmpb $0x0, 0xe1(%rax,%rcx)
jne 0x23e1f
movq %r14, %rdi
movl $0x20, %esi
callq 0x42d0
movb %al, 0xe0(%r14)
movb $0x1, 0xe1(%r14)
movb $0x20, 0xe0(%r14)
movq 0x20(%rbx), %rsi
movq 0x28(%rbx), %rdx
movq 0x1819a(%rip), %rdi     # 0x3bfd0
callq 0x4340
movq %rax, %r14
movq (%rax), %rax
movq -0x18(%rax), %rcx
movq $0xf, 0x10(%r14,%rcx)
movq -0x18(%rax), %rax
leaq (%r14,%rax), %r15
cmpb $0x0, 0xe1(%r14,%rax)
jne 0x23e7d
movq %r15, %rdi
movl $0x20, %esi
callq 0x42d0
movb %al, 0xe0(%r15)
movb $0x1, 0xe1(%r15)
movb $0x20, 0xe0(%r15)
movq %r14, %rdi
movq 0x8(%rsp), %rsi
callq 0x28bbe
movq %rax, %r14
leaq 0xf854(%rip), %rax      # 0x336f0
leaq 0xf854(%rip), %rsi      # 0x336f7
cmpb $0x0, 0x1cc(%rbx)
cmovneq %rax, %rsi
movl $0x6, %edx
movq %r14, %rdi
callq 0x4340
leaq 0xfa68(%rip), %rsi      # 0x3392a
movl $0x30, %edx
jmp 0x23fd1
testb %al, %al
je 0x24000
leaq 0x185ae(%rip), %rax     # 0x3c489
cmpb $0x0, (%rax)
jne 0x24000
movq 0x180e5(%rip), %rax     # 0x3bfd0
movq (%rax), %rcx
movq -0x18(%rcx), %rdx
movq $0x12, 0x10(%rax,%rdx)
movq -0x18(%rcx), %rcx
leaq (%rax,%rcx), %r14
cmpb $0x0, 0xe1(%rax,%rcx)
jne 0x23f29
movq %r14, %rdi
movl $0x20, %esi
callq 0x42d0
movb %al, 0xe0(%r14)
movb $0x1, 0xe1(%r14)
movb $0x20, 0xe0(%r14)
movq 0x20(%rbx), %rsi
movq 0x28(%rbx), %rdx
movq 0x18090(%rip), %rdi     # 0x3bfd0
callq 0x4340
movq %rax, %r14
movq (%rax), %rax
movq -0x18(%rax), %rcx
movq $0xf, 0x10(%r14,%rcx)
movq -0x18(%rax), %rax
leaq (%r14,%rax), %r15
cmpb $0x0, 0xe1(%r14,%rax)
jne 0x23f87
movq %r15, %rdi
movl $0x20, %esi
callq 0x42d0
movb %al, 0xe0(%r15)
movb $0x1, 0xe1(%r15)
movb $0x20, 0xe0(%r15)
movq %r14, %rdi
movq 0x8(%rsp), %rsi
callq 0x28bbe
movq %rax, %r14
leaq 0xf74a(%rip), %rax      # 0x336f0
leaq 0xf74a(%rip), %rsi      # 0x336f7
cmpb $0x0, 0x1cc(%rbx)
cmovneq %rax, %rsi
movl $0x6, %edx
movq %r14, %rdi
callq 0x4340
leaq 0xf98f(%rip), %rsi      # 0x3395b
movl $0x21, %edx
movq %r14, %rdi
callq 0x4340
movq (%r14), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x42d0
movsbl %al, %esi
movq %r14, %rdi
callq 0x4040
movq %rax, %rdi
callq 0x41f0
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0xe8c9(%rip), %rdi      # 0x328df
leaq 0xe909(%rip), %rsi      # 0x32926
movq %rax, %rdx
xorl %eax, %eax
callq 0x4410
movq %rax, %rbx
movl $0x468, %esi            # imm = 0x468
movq %r13, %rdi
callq 0x4300
movq %rbx, %rdi
callq 0x4540
nop