// File: /workspace/github_cpp_makefile_star2_O3/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 0x17fae(%rip), %rax     # 0x3b4d8
movl (%rax), %eax
testl %eax, %eax
jle 0x2363a
leaq 0x1e8(%rbx), %r15
leaq 0x20(%rbx), %r12
xorl %ebp, %ebp
leaq 0xf456(%rip), %r14      # 0x3299e
cmpl $0xb, 0x200(%rbx)
jne 0x2355d
movb $0x1, 0x250(%rbx)
jmp 0x23630
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 0x27c44
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 0x235cf
movl $0x0, 0x14(%r13)
movq 0x1e8(%rbx), %rsi
movq %r15, %rdi
leaq 0x10(%rsp), %rdx
callq 0x1a0a8
movl $0xa, 0x200(%rbx)
movl $0x1, %ecx
movq %r12, %rdi
leaq 0xfee5(%rip), %rsi      # 0x334e1
xorl %edx, %edx
callq 0x4510
movq 0x28(%rbx), %rcx
cmpq %rax, %rcx
jb 0x23881
movq %rax, 0x28(%rbx)
movq 0x20(%rbx), %rcx
movb $0x0, (%rcx,%rax)
movq %r12, %rdi
movq %r14, %rsi
callq 0x4580
leaq 0x17eaa(%rip), %rax     # 0x3b4d8
movl (%rax), %eax
incl %ebp
cmpl %eax, %ebp
jl 0x23548
cmpl $0xb, 0x200(%rbx)
leaq 0x17e40(%rip), %rax     # 0x3b488
movb (%rax), %al
jne 0x2374c
testb %al, %al
je 0x23872
leaq 0x17e2a(%rip), %rax     # 0x3b489
cmpb $0x0, (%rax)
jne 0x23872
movq 0x17961(%rip), %rax     # 0x3afd0
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 0x236a6
movq %r14, %rdi
movl $0x20, %esi
callq 0x42d0
movb $0x1, 0xe1(%r14)
movb $0x20, 0xe0(%r14)
movq 0x20(%rbx), %rsi
movq 0x28(%rbx), %rdx
movq 0x17913(%rip), %rdi     # 0x3afd0
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 0x236fd
movq %r15, %rdi
movl $0x20, %esi
callq 0x42d0
movb $0x1, 0xe1(%r15)
movb $0x20, 0xe0(%r15)
movq %r14, %rdi
movq 0x8(%rsp), %rsi
callq 0x28270
movq %rax, %r14
leaq 0xf05c(%rip), %rax      # 0x32778
leaq 0xf05c(%rip), %rsi      # 0x3277f
cmpb $0x0, 0x1cc(%rbx)
cmovneq %rax, %rsi
movl $0x6, %edx
movq %r14, %rdi
callq 0x4340
leaq 0xf264(%rip), %rsi      # 0x329a6
movl $0x30, %edx
jmp 0x23843
testb %al, %al
je 0x23872
leaq 0x17d2e(%rip), %rax     # 0x3b489
cmpb $0x0, (%rax)
jne 0x23872
movq 0x17865(%rip), %rax     # 0x3afd0
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 0x237a2
movq %r14, %rdi
movl $0x20, %esi
callq 0x42d0
movb $0x1, 0xe1(%r14)
movb $0x20, 0xe0(%r14)
movq 0x20(%rbx), %rsi
movq 0x28(%rbx), %rdx
movq 0x17817(%rip), %rdi     # 0x3afd0
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 0x237f9
movq %r15, %rdi
movl $0x20, %esi
callq 0x42d0
movb $0x1, 0xe1(%r15)
movb $0x20, 0xe0(%r15)
movq %r14, %rdi
movq 0x8(%rsp), %rsi
callq 0x28270
movq %rax, %r14
leaq 0xef60(%rip), %rax      # 0x32778
leaq 0xef60(%rip), %rsi      # 0x3277f
cmpb $0x0, 0x1cc(%rbx)
cmovneq %rax, %rsi
movl $0x6, %edx
movq %r14, %rdi
callq 0x4340
leaq 0xf199(%rip), %rsi      # 0x329d7
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 0xe0b7(%rip), %rdi      # 0x3193f
leaq 0xe0f7(%rip), %rsi      # 0x31986
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