// File: estwings57[P]CasHMC/sources/LinkMaster.cpp
// Function: CasHMC::LinkMaster::PrintState()
void LinkMaster::PrintState()
{
	if(Buffers.size()>0) {
		if(currentState == ACTIVE) {
			STATEN(ALI(11)<<header<<"tk:"<<ALI(3)<<tokenCount);
		//	STATEN(ALI(17)<<header);
		}
		else {
			STATEN(ALI(17)<<header);
		}
		STATEN((downstream ? "Down " : " Up  "));
		int realInd = 0;
		for(int i=0; i<bufferMax; i++) {
			if(i>0 && i%8==0) {
				STATEN(endl<<"                      ");
			}
			if(i < Buffers.size()) {
				if(Buffers[i] != NULL)	realInd = i;
				STATEN(*Buffers[realInd]);
			}
			else if(i == bufferMax-1) {
				STATEN("[ - ]");
			}
			else {
				STATEN("[ - ]...");
				break;
			}
		}
		STATEN(endl);
	}

	//Print linkTx buffer
	if(linkRxTx.size()>0) {
		STATEN(ALI(17)<<header);
		STATEN("LKTX ");
		int realInd = 0;
		for(int i=0; i<linkRxTx.size(); i++) {
			if(i>0 && i%8==0) {
				STATEN(endl<<"                      ");
			}
			if(linkRxTx[i] != NULL)	realInd = i;
			STATEN(*linkRxTx[realInd]);
		}
		STATEN(endl);
	}

	//If retry buffer has something, print it
	if(retBufWriteP != retBufReadP) {
	//	STATEN(ALI(11)<<header<<"tk:"<<ALI(3)<<tokenCount);
		STATEN(ALI(17)<<header);
		STATEN("RTRY ");
		int retryInd = retBufReadP;
		int realInd = retBufReadP, i=0;
		while(retryInd != retBufWriteP) {
			if(i>0 && i%8==0) {
				STATEN(endl<<"                      ");
			}
			if(retryBuffers[retryInd] != NULL) {
				realInd = retryInd;
				STATEN("("<<retryInd<<")");
			}
			STATEN(*retryBuffers[realInd]);
			retryInd++;
			retryInd = (retryInd < MAX_RETRY_BUF) ? retryInd : retryInd - MAX_RETRY_BUF;
			i++;
		}
		STATEN(endl);
	}

	//Print backup buffer during LinkRetry state
	if(backupBuffers.size()>0) {
		STATEN(ALI(17)<<header);
		STATEN("BACK ");
		int realInd = 0;
		for(int i=0; i<backupBuffers.size(); i++) {
			if(i>0 && i%8==0) {
				STATEN(endl<<"                      ");
			}
			if(backupBuffers[i] != NULL)	realInd = i;
			STATEN(*backupBuffers[realInd]);
		}
		STATEN(endl);
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xd0, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rdi
movq %rdi, -0x68(%rbp)
addq $0x1d0, %rdi            # imm = 0x1D0
callq 0x22d60
cmpq $0x0, %rax
jbe 0x3fd3b
movq -0x68(%rbp), %rax
cmpl $0x0, 0x200(%rax)
jne 0x3fb26
leaq 0x26ab5(%rip), %rax     # 0x6652a
testb $0x1, (%rax)
je 0x3fb24
movl $0xb, %edi
callq 0x177b0
movl %eax, -0xc(%rbp)
movl -0xc(%rbp), %esi
movq 0x2653b(%rip), %rdi     # 0x65fd0
callq 0x4440
movq %rax, -0x80(%rbp)
movl $0x20, %edi
callq 0x177d0
movq -0x80(%rbp), %rdi
movb %al, -0xd(%rbp)
movzbl -0xd(%rbp), %esi
callq 0x4550
movq -0x68(%rbp), %rsi
movq %rax, %rdi
addq $0x20, %rsi
callq 0x4320
movq %rax, %rdi
leaq 0x140b2(%rip), %rsi     # 0x53b84
callq 0x4380
movq %rax, -0x78(%rbp)
movl $0x3, %edi
callq 0x177b0
movq -0x78(%rbp), %rdi
movl %eax, -0x14(%rbp)
movl -0x14(%rbp), %esi
callq 0x4440
movq %rax, -0x70(%rbp)
movl $0x20, %edi
callq 0x177d0
movq -0x70(%rbp), %rdi
movb %al, -0x15(%rbp)
movzbl -0x15(%rbp), %esi
callq 0x4550
movq %rax, %rdi
movq -0x68(%rbp), %rax
movl 0x208(%rax), %esi
callq 0x44c0
jmp 0x3fb84
leaq 0x269fd(%rip), %rax     # 0x6652a
testb $0x1, (%rax)
je 0x3fb82
movl $0x11, %edi
callq 0x177b0
movl %eax, -0x1c(%rbp)
movl -0x1c(%rbp), %esi
movq 0x26487(%rip), %rdi     # 0x65fd0
callq 0x4440
movq %rax, -0x88(%rbp)
movl $0x20, %edi
callq 0x177d0
movq -0x88(%rbp), %rdi
movb %al, -0x1d(%rbp)
movzbl -0x1d(%rbp), %esi
callq 0x4550
movq -0x68(%rbp), %rsi
movq %rax, %rdi
addq $0x20, %rsi
callq 0x4320
jmp 0x3fb84
leaq 0x2699f(%rip), %rax     # 0x6652a
testb $0x1, (%rax)
je 0x3fbd0
movq -0x68(%rbp), %rax
testb $0x1, 0x1cc(%rax)
je 0x3fbad
leaq 0x13379(%rip), %rax     # 0x52f1d
movq %rax, -0x90(%rbp)
jmp 0x3fbbd
leaq 0x1336f(%rip), %rax     # 0x52f23
movq %rax, -0x90(%rbp)
jmp 0x3fbbd
movq -0x90(%rbp), %rsi
movq 0x26405(%rip), %rdi     # 0x65fd0
callq 0x4380
movl $0x0, -0x24(%rbp)
movl $0x0, -0x28(%rbp)
movq -0x68(%rbp), %rcx
movl -0x28(%rbp), %eax
cmpl 0x1c8(%rcx), %eax
jge 0x3fd1a
cmpl $0x0, -0x28(%rbp)
jle 0x3fc37
movl -0x28(%rbp), %eax
movl $0x8, %ecx
cltd
idivl %ecx
cmpl $0x0, %edx
jne 0x3fc37
leaq 0x2691c(%rip), %rax     # 0x6652a
testb $0x1, (%rax)
je 0x3fc35
movq 0x263b6(%rip), %rdi     # 0x65fd0
movq 0x2638f(%rip), %rsi     # 0x65fb0
callq 0x43c0
movq %rax, %rdi
leaq 0x12dcf(%rip), %rsi     # 0x529ff
callq 0x4380
jmp 0x3fc37
movq -0x68(%rbp), %rdi
movslq -0x28(%rbp), %rax
movq %rax, -0x98(%rbp)
addq $0x1d0, %rdi            # imm = 0x1D0
callq 0x22d60
movq %rax, %rcx
movq -0x98(%rbp), %rax
cmpq %rcx, %rax
jae 0x3fcb2
movq -0x68(%rbp), %rdi
addq $0x1d0, %rdi            # imm = 0x1D0
movslq -0x28(%rbp), %rsi
callq 0x29940
cmpq $0x0, (%rax)
je 0x3fc81
movl -0x28(%rbp), %eax
movl %eax, -0x24(%rbp)
leaq 0x268a2(%rip), %rax     # 0x6652a
testb $0x1, (%rax)
je 0x3fcb0
movq -0x68(%rbp), %rdi
addq $0x1d0, %rdi            # imm = 0x1D0
movslq -0x24(%rbp), %rsi
callq 0x29940
movq (%rax), %rsi
movq 0x26325(%rip), %rdi     # 0x65fd0
callq 0x44960
jmp 0x3fd0a
movq -0x68(%rbp), %rcx
movl -0x28(%rbp), %eax
movl 0x1c8(%rcx), %ecx
subl $0x1, %ecx
cmpl %ecx, %eax
jne 0x3fce7
leaq 0x2685d(%rip), %rax     # 0x6652a
testb $0x1, (%rax)
je 0x3fce5
movq 0x262f7(%rip), %rdi     # 0x65fd0
leaq 0x12d36(%rip), %rsi     # 0x52a16
callq 0x4380
jmp 0x3fd08
leaq 0x2683c(%rip), %rax     # 0x6652a
testb $0x1, (%rax)
je 0x3fd06
movq 0x262d6(%rip), %rdi     # 0x65fd0
leaq 0x12d1b(%rip), %rsi     # 0x52a1c
callq 0x4380
jmp 0x3fd1a
jmp 0x3fd0a
jmp 0x3fd0c
movl -0x28(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x28(%rbp)
jmp 0x3fbde
leaq 0x26809(%rip), %rax     # 0x6652a
testb $0x1, (%rax)
je 0x3fd39
movq 0x262a3(%rip), %rdi     # 0x65fd0
movq 0x2627c(%rip), %rsi     # 0x65fb0
callq 0x43c0
jmp 0x3fd3b
movq -0x68(%rbp), %rdi
addq $0x1e8, %rdi            # imm = 0x1E8
callq 0x22d60
cmpq $0x0, %rax
jbe 0x3fed2
leaq 0x267ce(%rip), %rax     # 0x6652a
testb $0x1, (%rax)
je 0x3fdb1
movl $0x11, %edi
callq 0x177b0
movl %eax, -0x2c(%rbp)
movl -0x2c(%rbp), %esi
movq 0x26258(%rip), %rdi     # 0x65fd0
callq 0x4440
movq %rax, -0xa0(%rbp)
movl $0x20, %edi
callq 0x177d0
movq -0xa0(%rbp), %rdi
movb %al, -0x2d(%rbp)
movzbl -0x2d(%rbp), %esi
callq 0x4550
movq -0x68(%rbp), %rsi
movq %rax, %rdi
addq $0x20, %rsi
callq 0x4320
leaq 0x26772(%rip), %rax     # 0x6652a
testb $0x1, (%rax)
je 0x3fdd0
movq 0x2620c(%rip), %rdi     # 0x65fd0
leaq 0x13dbd(%rip), %rsi     # 0x53b88
callq 0x4380
movl $0x0, -0x34(%rbp)
movl $0x0, -0x38(%rbp)
movq -0x68(%rbp), %rdi
movslq -0x38(%rbp), %rax
movq %rax, -0xa8(%rbp)
addq $0x1e8, %rdi            # imm = 0x1E8
callq 0x22d60
movq %rax, %rcx
movq -0xa8(%rbp), %rax
cmpq %rcx, %rax
jae 0x3feb1
cmpl $0x0, -0x38(%rbp)
jle 0x3fe52
movl -0x38(%rbp), %eax
movl $0x8, %ecx
cltd
idivl %ecx
cmpl $0x0, %edx
jne 0x3fe52
leaq 0x26701(%rip), %rax     # 0x6652a
testb $0x1, (%rax)
je 0x3fe50
movq 0x2619b(%rip), %rdi     # 0x65fd0
movq 0x26174(%rip), %rsi     # 0x65fb0
callq 0x43c0
movq %rax, %rdi
leaq 0x12bb4(%rip), %rsi     # 0x529ff
callq 0x4380
jmp 0x3fe52
movq -0x68(%rbp), %rdi
addq $0x1e8, %rdi            # imm = 0x1E8
movslq -0x38(%rbp), %rsi
callq 0x29940
cmpq $0x0, (%rax)
je 0x3fe72
movl -0x38(%rbp), %eax
movl %eax, -0x34(%rbp)
leaq 0x266b1(%rip), %rax     # 0x6652a
testb $0x1, (%rax)
je 0x3fea1
movq -0x68(%rbp), %rdi
addq $0x1e8, %rdi            # imm = 0x1E8
movslq -0x34(%rbp), %rsi
callq 0x29940
movq (%rax), %rsi
movq 0x26134(%rip), %rdi     # 0x65fd0
callq 0x44960
jmp 0x3fea3
movl -0x38(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x38(%rbp)
jmp 0x3fdde
leaq 0x26672(%rip), %rax     # 0x6652a
testb $0x1, (%rax)
je 0x3fed0
movq 0x2610c(%rip), %rdi     # 0x65fd0
movq 0x260e5(%rip), %rsi     # 0x65fb0
callq 0x43c0
jmp 0x3fed2
movq -0x68(%rbp), %rcx
movl 0x260(%rcx), %eax
cmpl 0x25c(%rcx), %eax
je 0x400cf
leaq 0x2663b(%rip), %rax     # 0x6652a
testb $0x1, (%rax)
je 0x3ff44
movl $0x11, %edi
callq 0x177b0
movl %eax, -0x3c(%rbp)
movl -0x3c(%rbp), %esi
movq 0x260c5(%rip), %rdi     # 0x65fd0
callq 0x4440
movq %rax, -0xb0(%rbp)
movl $0x20, %edi
callq 0x177d0
movq -0xb0(%rbp), %rdi
movb %al, -0x3d(%rbp)
movzbl -0x3d(%rbp), %esi
callq 0x4550
movq -0x68(%rbp), %rsi
movq %rax, %rdi
addq $0x20, %rsi
callq 0x4320
leaq 0x265df(%rip), %rax     # 0x6652a
testb $0x1, (%rax)
je 0x3ff63
movq 0x26079(%rip), %rdi     # 0x65fd0
leaq 0x13c30(%rip), %rsi     # 0x53b8e
callq 0x4380
movq -0x68(%rbp), %rax
movl 0x25c(%rax), %ecx
movl %ecx, -0x44(%rbp)
movl 0x25c(%rax), %eax
movl %eax, -0x48(%rbp)
movl $0x0, -0x4c(%rbp)
movq -0x68(%rbp), %rcx
movl -0x44(%rbp), %eax
cmpl 0x260(%rcx), %eax
je 0x400ae
cmpl $0x0, -0x4c(%rbp)
jle 0x3ffd9
movl -0x4c(%rbp), %eax
movl $0x8, %ecx
cltd
idivl %ecx
cmpl $0x0, %edx
jne 0x3ffd9
leaq 0x2657a(%rip), %rax     # 0x6652a
testb $0x1, (%rax)
je 0x3ffd7
movq 0x26014(%rip), %rdi     # 0x65fd0
movq 0x25fed(%rip), %rsi     # 0x65fb0
callq 0x43c0
movq %rax, %rdi
leaq 0x12a2d(%rip), %rsi     # 0x529ff
callq 0x4380
jmp 0x3ffd9
movq -0x68(%rbp), %rdi
addq $0x270, %rdi            # imm = 0x270
movslq -0x44(%rbp), %rsi
callq 0x29940
cmpq $0x0, (%rax)
je 0x40034
movl -0x44(%rbp), %eax
movl %eax, -0x48(%rbp)
leaq 0x2652a(%rip), %rax     # 0x6652a
testb $0x1, (%rax)
je 0x40032
movq 0x25fc4(%rip), %rdi     # 0x65fd0
leaq 0x13844(%rip), %rsi     # 0x53857
callq 0x4380
movq %rax, %rdi
movl -0x44(%rbp), %esi
callq 0x4610
movq %rax, %rdi
leaq 0x1434c(%rip), %rsi     # 0x54379
callq 0x4380
jmp 0x40034
leaq 0x264ef(%rip), %rax     # 0x6652a
testb $0x1, (%rax)
je 0x40063
movq -0x68(%rbp), %rdi
addq $0x270, %rdi            # imm = 0x270
movslq -0x48(%rbp), %rsi
callq 0x29940
movq (%rax), %rsi
movq 0x25f72(%rip), %rdi     # 0x65fd0
callq 0x44960
movl -0x44(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x44(%rbp)
movl -0x44(%rbp), %eax
leaq 0x264e6(%rip), %rcx     # 0x6655c
cmpl (%rcx), %eax
jge 0x40085
movl -0x44(%rbp), %eax
movl %eax, -0xb4(%rbp)
jmp 0x40097
movl -0x44(%rbp), %eax
leaq 0x264cd(%rip), %rcx     # 0x6655c
subl (%rcx), %eax
movl %eax, -0xb4(%rbp)
movl -0xb4(%rbp), %eax
movl %eax, -0x44(%rbp)
movl -0x4c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x4c(%rbp)
jmp 0x3ff80
leaq 0x26475(%rip), %rax     # 0x6652a
testb $0x1, (%rax)
je 0x400cd
movq 0x25f0f(%rip), %rdi     # 0x65fd0
movq 0x25ee8(%rip), %rsi     # 0x65fb0
callq 0x43c0
jmp 0x400cf
movq -0x68(%rbp), %rdi
addq $0x220, %rdi            # imm = 0x220
callq 0x22d60
cmpq $0x0, %rax
jbe 0x40266
leaq 0x2643a(%rip), %rax     # 0x6652a
testb $0x1, (%rax)
je 0x40145
movl $0x11, %edi
callq 0x177b0
movl %eax, -0x50(%rbp)
movl -0x50(%rbp), %esi
movq 0x25ec4(%rip), %rdi     # 0x65fd0
callq 0x4440
movq %rax, -0xc0(%rbp)
movl $0x20, %edi
callq 0x177d0
movq -0xc0(%rbp), %rdi
movb %al, -0x51(%rbp)
movzbl -0x51(%rbp), %esi
callq 0x4550
movq -0x68(%rbp), %rsi
movq %rax, %rdi
addq $0x20, %rsi
callq 0x4320
leaq 0x263de(%rip), %rax     # 0x6652a
testb $0x1, (%rax)
je 0x40164
movq 0x25e78(%rip), %rdi     # 0x65fd0
leaq 0x13a35(%rip), %rsi     # 0x53b94
callq 0x4380
movl $0x0, -0x58(%rbp)
movl $0x0, -0x5c(%rbp)
movq -0x68(%rbp), %rdi
movslq -0x5c(%rbp), %rax
movq %rax, -0xc8(%rbp)
addq $0x220, %rdi            # imm = 0x220
callq 0x22d60
movq %rax, %rcx
movq -0xc8(%rbp), %rax
cmpq %rcx, %rax
jae 0x40245
cmpl $0x0, -0x5c(%rbp)
jle 0x401e6
movl -0x5c(%rbp), %eax
movl $0x8, %ecx
cltd
idivl %ecx
cmpl $0x0, %edx
jne 0x401e6
leaq 0x2636d(%rip), %rax     # 0x6652a
testb $0x1, (%rax)
je 0x401e4
movq 0x25e07(%rip), %rdi     # 0x65fd0
movq 0x25de0(%rip), %rsi     # 0x65fb0
callq 0x43c0
movq %rax, %rdi
leaq 0x12820(%rip), %rsi     # 0x529ff
callq 0x4380
jmp 0x401e6
movq -0x68(%rbp), %rdi
addq $0x220, %rdi            # imm = 0x220
movslq -0x5c(%rbp), %rsi
callq 0x29940
cmpq $0x0, (%rax)
je 0x40206
movl -0x5c(%rbp), %eax
movl %eax, -0x58(%rbp)
leaq 0x2631d(%rip), %rax     # 0x6652a
testb $0x1, (%rax)
je 0x40235
movq -0x68(%rbp), %rdi
addq $0x220, %rdi            # imm = 0x220
movslq -0x58(%rbp), %rsi
callq 0x29940
movq (%rax), %rsi
movq 0x25da0(%rip), %rdi     # 0x65fd0
callq 0x44960
jmp 0x40237
movl -0x5c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x5c(%rbp)
jmp 0x40172
leaq 0x262de(%rip), %rax     # 0x6652a
testb $0x1, (%rax)
je 0x40264
movq 0x25d78(%rip), %rdi     # 0x65fd0
movq 0x25d51(%rip), %rsi     # 0x65fb0
callq 0x43c0
jmp 0x40266
addq $0xd0, %rsp
popq %rbp
retq
nop