// File: /workspace/github_cpp_makefile_star2_O3/estwings57[P]CasHMC/sources/LinkSlave.cpp
// Function: CasHMC::LinkSlave::Update()
void LinkSlave::Update()
{
	//Extracting flow control and checking CRC, SEQ from linkRxTx packet 
	if(linkRxTx.size() > 0) {
		//Make sure that linkRxTx[0] is not virtual tail packet.
		if(linkRxTx[0] == NULL) {
			ERROR(header<<"  == Error - linkRxTx[0] is NULL (It could be one of virtual tail packet  (CurrentClock : "<<currentClockCycle<<")");
			exit(0);
		}
		else {
			for(int i=0; i<linkRxTx.size(); i++) {
				if(linkRxTx[i]->bufPopDelay == 0) {
					//Link retraining sequence
					if(linkRxTx[i]->CMD == NULL_) {
						//[Responder descrambler initializing]
						//The responder descrambler sync should occur within tRESP1 of the PLL locking
						if(downstream && localLinkMaster->currentState == SLEEP) {
							localLinkMaster->firstNull = true;
							localLinkMaster->currentState = RETRAIN1;
							uint64_t tran = ceil((double)(tRESP1)/tCK);
							localLinkMaster->retrainTransit = currentClockCycle + tran;
						}
						//[Requester descrambler synchronization]
						else if(!downstream && localLinkMaster->currentState == RETRAIN1) {
							localLinkMaster->firstNull = true;
							localLinkMaster->currentState = RETRAIN2;
						}
						//[Responder FLIT synchrony]
						//Responder link lock should occur within tRESP2
						else if(downstream && localLinkMaster->currentState == RETRAIN1) {
							localLinkMaster->firstNull = true;
							localLinkMaster->currentState = RETRAIN2;
							uint64_t tran = ceil((double)(tRESP2)/tCK);
							localLinkMaster->retrainTransit = currentClockCycle + tran;
						}
						//[Requester FLIT synchrony and sending a minimum of 32 NULL FLITs before entering ACTIVE]
						else if(!downstream && localLinkMaster->currentState == RETRAIN2) {
							currentState = ACTIVE;
							localLinkMaster->FinishRetrain();
						}
						//[sending a minimum of 32 NULL FLITs before entering ACTIVE]
						else if(downstream && localLinkMaster->currentState == RETRAIN2) {
							currentState = ACTIVE;
							localLinkMaster->FinishRetrain();
						}
						delete linkRxTx[i];
						linkRxTx.erase(linkRxTx.begin()+i);
						continue;
					}
					
					//Retry control
					if(linkRxTx[i]->CMD == IRTRY) {
						if(linkRxTx[i]->bufPopDelay == 0) {
							linkRxTx[i]->chkRRP = true;
							localLinkMaster->UpdateRetryPointer(linkRxTx[i]);
							if(linkRxTx[i]->FRP == 1) {
								if(localLinkMaster->currentState != LINK_RETRY) {
									localLinkMaster->LinkRetry(linkRxTx[i]);
								}
							}
							else if(linkRxTx[i]->FRP == 2) {
								if(localLinkMaster->currentState == START_RETRY
								|| localLinkMaster->currentState == LINK_RETRY) {
									localLinkMaster->FinishRetry();
									currentState = ACTIVE;
									slaveSEQ = 0;
								}
							}
							delete linkRxTx[i];
							linkRxTx.erase(linkRxTx.begin()+i);
							break;
						}
					}
					else if(currentState == START_RETRY) {
						delete linkRxTx[i];
						linkRxTx.erase(linkRxTx.begin()+i);
						break;
					}
				
					//Flow control
					if(linkRxTx[i]->chkRRP == false) {
						linkRxTx[i]->chkRRP = true;
						localLinkMaster->UpdateRetryPointer(linkRxTx[i]);

						//PRET packet is not saved in the retry buffer (No need to check CRC)
						if(linkRxTx[i]->CMD == PRET) {
							delete linkRxTx[i];
							linkRxTx.erase(linkRxTx.begin()+i);
							break;
						}
					}
					
					//Link low power mode control
					if(linkRxTx[i]->CMD == QUIET) {
						//(upstream) all-way links are checked to enter sleep mode
						if(localLinkMaster->currentState == WAIT) {
							localLinkMaster->currentState = CONFIRM;
							DEBUG(ALI(18)<<header<<ALI(15)<<*linkRxTx[i]<<(downstream ? "Down) " : "Up)   ")
								<<"link is ready to enter LOW POWER mode");
						}
						//(downstream) link is checking the link state to enter sleep mode
						else {
							currentState = WAIT;
							DEBUG(ALI(18)<<header<<ALI(15)<<*linkRxTx[i]<<(downstream ? "Down) " : "Up)   ")
								<<"link is checking the link state to enter sleep mode");
						}
						delete linkRxTx[i];
						linkRxTx.erase(linkRxTx.begin()+i);
						break;
					}
					
					//Count CRC calculation time
					if(linkRxTx[i]->chkRRP == true && linkRxTx[i]->chkCRC == false) {
						if(CRC_CHECK && !startCRC) {
							startCRC = true;
							countdownCRC = ceil((double)CRC_CAL_CYCLE * linkRxTx[i]->LNG);
						}
							
						if(CRC_CHECK && countdownCRC > 0) {
							DEBUG(ALI(18)<<header<<ALI(15)<<*linkRxTx[i]<<(downstream ? "Down) " : "Up)   ")
									<<"WAITING CRC calculation ("<<countdownCRC<<"/"<<ceil((double)CRC_CAL_CYCLE*linkRxTx[i]->LNG)<<")");
						}
						else {
							//Error check
							linkRxTx[i]->chkCRC = true;
							if(CheckNoError(linkRxTx[i])) {
								localLinkMaster->ReturnRetryPointer(linkRxTx[i]);
								localLinkMaster->UpdateToken(linkRxTx[i]);
								if(linkRxTx[i]->CMD != TRET) {
									Receive(linkRxTx[i]);
								}
								else {
									delete linkRxTx[i];
								}
								linkRxTx.erase(linkRxTx.begin()+i);
								break;
							}
							//Error abort mode
							else {
								if(localLinkMaster->retryStartPacket == NULL) {
									localLinkMaster->retryStartPacket = new Packet(*linkRxTx[i]);
								}
								else {
									ERROR(header<<"  == Error - localLinkMaster->retryStartPacket is NOT NULL  (CurrentClock : "<<currentClockCycle<<")");
									exit(0);
								}
								localLinkMaster->StartRetry(linkRxTx[i]);
								localLinkMaster->linkP->statis->errorPerLink[linkSlaveID]++;
								for(int j=0; j<linkRxTx.size(); j++) {
									if(linkRxTx[j] != NULL) {
										delete linkRxTx[j];
									}
									linkRxTx.erase(linkRxTx.begin()+j);
									j--;
								}
								linkRxTx.clear();
								currentState = START_RETRY;
							}
							startCRC = false;
						}
						countdownCRC = (countdownCRC>0) ? countdownCRC-1 : 0;
					}
				}
			}
		}
	}
	
	//Checking the link state to enter sleep mode
	if(currentState == WAIT) {
		//Link is ready for low power mode
		if(localLinkMaster->Buffers.size() == 0
		&& localLinkMaster->retBufReadP == localLinkMaster->retBufWriteP
		&& localLinkMaster->tokenCount == MAX_LINK_BUF) {
			currentState = SLEEP;
			localLinkMaster->currentState = SLEEP;
			localLinkMaster->QuitePacket();
		}
	}

	//Sending packet
	if(Buffers.size() > 0) {
		bool chkRcv = (downstream ? downBufferDest->ReceiveDown(Buffers[0]) : upBufferDest->ReceiveUp(Buffers[0]));
		if(chkRcv) {
			localLinkMaster->ReturnTocken(Buffers[0]);
			DEBUG(ALI(18)<<header<<ALI(15)<<*Buffers[0]<<(downstream ? "Down) " : "Up)   ")
						<<"SENDING packet to "<<(downstream ? "crossbar switch (CS)" : "HMC controller (HC)"));
			Buffers.erase(Buffers.begin(), Buffers.begin()+Buffers[0]->LNG);
		}
		else {
			//DEBUG(ALI(18)<<header<<ALI(15)<<*Buffers[0]<<"(downstream ? "Down) Crossbar switch" : "Up)   HMC controller")<<" buffer FULL");	
		}
	}

	Step();
	for(int i=0; i<linkRxTx.size(); i++) {
		if(linkRxTx[i] != NULL) {
			linkRxTx[i]->bufPopDelay = (linkRxTx[i]->bufPopDelay>0) ? linkRxTx[i]->bufPopDelay-1 : 0;
		}
	}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq 0x1e8(%rdi), %rax
cmpq %rax, 0x1f0(%rdi)
je 0x26a66
cmpq $0x0, (%rax)
je 0x26d73
leaq 0x20(%rbx), %r15
leaq 0x1536b(%rip), %r14     # 0x3b5a0
leaq 0xc543(%rip), %r13      # 0x3277f
xorl %r12d, %r12d
movq (%rax,%r12,8), %rbp
cmpl $0x0, 0x14(%rbp)
jne 0x26404
movl 0x434(%rbp), %eax
testl %eax, %eax
je 0x262f5
cmpl $0x3, %eax
je 0x26751
cmpl $0xa, 0x200(%rbx)
je 0x2672c
cmpb $0x0, 0x421(%rbp)
jne 0x262aa
movb $0x1, 0x421(%rbp)
movq 0x218(%rbx), %rdi
movq %rbp, %rsi
callq 0x227d8
movq 0x1e8(%rbx), %rax
movq (%rax,%r12,8), %rbp
movl 0x434(%rbp), %eax
cmpl $0x1, %eax
je 0x2672c
cmpl $0x4, %eax
je 0x267a8
cmpb $0x1, 0x421(%rbp)
jne 0x26404
cmpb $0x0, 0x420(%rbp)
jne 0x26404
leaq 0x151f8(%rip), %rax     # 0x3b4cc
cmpb $0x1, (%rax)
jne 0x2660d
cmpb $0x1, 0x228(%rbx)
jne 0x2642a
movl 0x224(%rbx), %eax
jmp 0x26459
movq 0x218(%rbx), %rbp
movl 0x200(%rbp), %eax
cmpb $0x1, 0x1cc(%rbx)
jne 0x26338
cmpl $0x4, %eax
je 0x26355
cmpl $0x3, %eax
je 0x26369
cmpl $0x1, %eax
jne 0x263b5
movb $0x1, 0x268(%rbp)
movl $0x3, 0x200(%rbp)
leaq 0x1522a(%rip), %rax     # 0x3b560
jmp 0x26381
cmpl $0x4, %eax
je 0x26355
cmpl $0x3, %eax
jne 0x263b5
movb $0x1, 0x268(%rbp)
movl $0x4, 0x200(%rbp)
jmp 0x263b5
movl $0x0, 0x200(%rbx)
movq %rbp, %rdi
callq 0x25166
jmp 0x263b5
movb $0x1, 0x268(%rbp)
movl $0x4, 0x200(%rbp)
leaq 0x151e7(%rip), %rax     # 0x3b568
movsd (%rax), %xmm0
divsd (%r14), %xmm0
callq 0x4090
cvttsd2si %xmm0, %rax
movq %rax, %rcx
sarq $0x3f, %rcx
subsd 0xbeb5(%rip), %xmm0     # 0x32258
cvttsd2si %xmm0, %rdx
andl %ecx, %edx
orl %edx, %eax
addl 0x8(%rbx), %eax
movl %eax, 0x264(%rbp)
movq 0x1e8(%rbx), %rax
movq (%rax,%r12,8), %rdi
testq %rdi, %rdi
je 0x263d2
movq (%rdi), %rax
callq *0x8(%rax)
movq 0x1e8(%rbx), %rax
leaq (%rax,%r12,8), %rsi
addq $0x8, %rsi
movq 0x1f0(%rbx), %rdx
cmpq %rdx, %rsi
je 0x263f9
leaq (%rax,%r12,8), %rdi
subq %rsi, %rdx
callq 0x4480
movq 0x1f0(%rbx), %rdx
addq $-0x8, %rdx
movq %rdx, 0x1f0(%rbx)
incq %r12
movq 0x1e8(%rbx), %rax
movq 0x1f0(%rbx), %rcx
subq %rax, %rcx
sarq $0x3, %rcx
cmpq %r12, %rcx
ja 0x2623f
jmp 0x26a66
movb $0x1, 0x228(%rbx)
movl 0x430(%rbp), %eax
xorps %xmm0, %xmm0
cvtsi2sd %rax, %xmm0
leaq 0x1508a(%rip), %rax     # 0x3b4d0
mulsd (%rax), %xmm0
callq 0x4090
cvttsd2si %xmm0, %eax
movl %eax, 0x224(%rbx)
testl %eax, %eax
jle 0x2660d
leaq 0x15020(%rip), %rax     # 0x3b488
cmpb $0x1, (%rax)
jne 0x2670e
leaq 0x15011(%rip), %rax     # 0x3b489
cmpb $0x0, (%rax)
jne 0x2670e
movq 0x14b48(%rip), %rdx     # 0x3afd0
movq (%rdx), %rax
movq -0x18(%rax), %rcx
movq $0x12, 0x10(%rdx,%rcx)
movq -0x18(%rax), %rax
leaq (%rdx,%rax), %r13
cmpb $0x0, 0xe1(%rdx,%rax)
jne 0x264bf
movq %r13, %rdi
movl $0x20, %esi
callq 0x42d0
movb $0x1, 0xe1(%r13)
movb $0x20, 0xe0(%r13)
movq 0x20(%rbx), %rsi
movq 0x28(%rbx), %rdx
movq 0x14afa(%rip), %rdi     # 0x3afd0
callq 0x4340
movq %rax, %rbp
movq (%rax), %rax
movq -0x18(%rax), %rcx
movq $0xf, 0x10(%rbp,%rcx)
movq -0x18(%rax), %rax
leaq (%rax,%rbp), %r13
cmpb $0x0, 0xe1(%rbp,%rax)
jne 0x26515
movq %r13, %rdi
movl $0x20, %esi
callq 0x42d0
movb $0x1, 0xe1(%r13)
movb $0x20, 0xe0(%r13)
movq 0x1e8(%rbx), %rax
movq (%rax,%r12,8), %rsi
movq %rbp, %rdi
callq 0x28270
cmpb $0x0, 0x1cc(%rbx)
movq %rax, %r13
leaq 0xc23e(%rip), %rbp      # 0x3277f
movq %rbp, %rsi
leaq 0xc22d(%rip), %rax      # 0x32778
cmovneq %rax, %rsi
movl $0x6, %edx
movq %r13, %rdi
callq 0x4340
movl $0x19, %edx
movq %r13, %rdi
leaq 0xc67b(%rip), %rsi      # 0x32be6
callq 0x4340
movl 0x224(%rbx), %esi
movq %r13, %rdi
callq 0x4500
movq %rax, %r13
movl $0x1, %edx
movq %rax, %rdi
leaq 0x9d6a(%rip), %rsi      # 0x302fa
callq 0x4340
movq 0x1e8(%rbx), %rax
movq (%rax,%r12,8), %rax
movl 0x430(%rax), %eax
xorps %xmm0, %xmm0
cvtsi2sd %rax, %xmm0
leaq 0x14f1b(%rip), %rax     # 0x3b4d0
mulsd (%rax), %xmm0
callq 0x4090
movq %r13, %rdi
callq 0x4460
movq %rax, %r13
movl $0x1, %edx
movq %rax, %rdi
leaq 0xcf09(%rip), %rsi      # 0x334e1
callq 0x4340
movq (%r13), %rax
movq -0x18(%rax), %rdi
addq %r13, %rdi
movl $0xa, %esi
callq 0x42d0
movsbl %al, %esi
movq %r13, %rdi
movq %rbp, %r13
callq 0x4040
movq %rax, %rdi
callq 0x41f0
jmp 0x2670e
movb $0x1, 0x420(%rbp)
movq %rbx, %rdi
movq %rbp, %rsi
callq 0x26e7e
movq 0x218(%rbx), %rdi
testb %al, %al
jne 0x26d20
cmpq $0x0, 0x248(%rdi)
jne 0x26dd5
movl $0x468, %edi            # imm = 0x468
callq 0x42f0
movq %rax, %rbp
movq 0x1e8(%rbx), %rax
movq (%rax,%r12,8), %rsi
movq %rbp, %rdi
callq 0x27f1e
movq 0x218(%rbx), %rdi
movq %rbp, 0x248(%rdi)
movq 0x1e8(%rbx), %rax
movq (%rax,%r12,8), %rsi
callq 0x234fc
movq 0x218(%rbx), %rax
movq 0x210(%rax), %rax
movq 0x1e0(%rax), %rax
movl 0x204(%rbx), %ecx
movq 0xf8(%rax), %rax
incl (%rax,%rcx,4)
movq 0x1e8(%rbx), %rdi
movq 0x1f0(%rbx), %rdx
cmpq %rdi, %rdx
je 0x266fd
movq (%rdi), %rax
testq %rax, %rax
je 0x266d1
movq (%rax), %rcx
movq %rax, %rdi
callq *0x8(%rcx)
movq 0x1e8(%rbx), %rdi
movq 0x1f0(%rbx), %rdx
leaq 0x8(%rdi), %rsi
cmpq %rdx, %rsi
je 0x266f0
subq %rsi, %rdx
callq 0x4480
movq 0x1e8(%rbx), %rdi
movq 0x1f0(%rbx), %rdx
addq $-0x8, %rdx
movq %rdx, 0x1f0(%rbx)
jmp 0x266ad
movl $0xa, 0x200(%rbx)
movb $0x0, 0x228(%rbx)
movl 0x224(%rbx), %eax
leal -0x1(%rax), %ecx
testl %eax, %eax
movl $0x0, %eax
cmovlel %eax, %ecx
movl %ecx, 0x224(%rbx)
jmp 0x26404
movq (%rbp), %rax
movq %rbp, %rdi
callq *0x8(%rax)
movq 0x1e8(%rbx), %rax
movq 0x1f0(%rbx), %rdx
leaq (%rax,%r12,8), %rsi
addq $0x8, %rsi
jmp 0x26a43
movb $0x1, 0x421(%rbp)
movq 0x218(%rbx), %rdi
movq %rbp, %rsi
callq 0x227d8
movq 0x1e8(%rbx), %rax
movq (%rax,%r12,8), %rsi
movl 0x448(%rsi), %eax
cmpl $0x2, %eax
je 0x269ef
cmpl $0x1, %eax
jne 0x26a17
movq 0x218(%rbx), %rdi
cmpl $0xb, 0x200(%rdi)
je 0x26a17
callq 0x238b2
jmp 0x26a17
movq 0x218(%rbx), %rax
cmpl $0x5, 0x200(%rax)
jne 0x268cf
movl $0x6, 0x200(%rax)
leaq 0x14cbb(%rip), %rax     # 0x3b488
cmpb $0x1, (%rax)
jne 0x26a17
leaq 0x14cac(%rip), %rax     # 0x3b489
cmpb $0x0, (%rax)
jne 0x26a17
movq %r13, %r14
movq 0x147e0(%rip), %rdx     # 0x3afd0
movq (%rdx), %rax
movq -0x18(%rax), %rcx
movq $0x12, 0x10(%rdx,%rcx)
movq -0x18(%rax), %rax
leaq (%rdx,%rax), %r15
cmpb $0x0, 0xe1(%rdx,%rax)
jne 0x26827
movq %r15, %rdi
movl $0x20, %esi
callq 0x42d0
movb $0x1, 0xe1(%r15)
movb $0x20, 0xe0(%r15)
movq 0x20(%rbx), %rsi
movq 0x28(%rbx), %rdx
movq 0x14792(%rip), %rdi     # 0x3afd0
callq 0x4340
movq %rax, %r15
movq (%rax), %rax
movq -0x18(%rax), %rcx
movq $0xf, 0x10(%r15,%rcx)
movq -0x18(%rax), %rax
leaq (%r15,%rax), %r13
cmpb $0x0, 0xe1(%r15,%rax)
jne 0x2687e
movq %r13, %rdi
movl $0x20, %esi
callq 0x42d0
movb $0x1, 0xe1(%r13)
movb $0x20, 0xe0(%r13)
movq 0x1e8(%rbx), %rax
movq (%rax,%r12,8), %rsi
movq %r15, %rdi
callq 0x28270
movq %rax, %r15
cmpb $0x0, 0x1cc(%rbx)
movq %r14, %rsi
leaq 0xbecb(%rip), %rax      # 0x32778
cmovneq %rax, %rsi
movl $0x6, %edx
movq %r15, %rdi
callq 0x4340
leaq 0xc553(%rip), %rsi      # 0x32e18
movl $0x25, %edx
jmp 0x269dd
movl $0x5, 0x200(%rbx)
leaq 0x14ba8(%rip), %rax     # 0x3b488
cmpb $0x1, (%rax)
jne 0x26a17
leaq 0x14b99(%rip), %rax     # 0x3b489
cmpb $0x0, (%rax)
jne 0x26a17
movq %r13, %r14
movq 0x146cd(%rip), %rdx     # 0x3afd0
movq (%rdx), %rax
movq -0x18(%rax), %rcx
movq $0x12, 0x10(%rdx,%rcx)
movq -0x18(%rax), %rax
leaq (%rdx,%rax), %r15
cmpb $0x0, 0xe1(%rdx,%rax)
jne 0x2693a
movq %r15, %rdi
movl $0x20, %esi
callq 0x42d0
movb $0x1, 0xe1(%r15)
movb $0x20, 0xe0(%r15)
movq 0x20(%rbx), %rsi
movq 0x28(%rbx), %rdx
movq 0x1467f(%rip), %rdi     # 0x3afd0
callq 0x4340
movq %rax, %r15
movq (%rax), %rax
movq -0x18(%rax), %rcx
movq $0xf, 0x10(%r15,%rcx)
movq -0x18(%rax), %rax
leaq (%r15,%rax), %r13
cmpb $0x0, 0xe1(%r15,%rax)
jne 0x26991
movq %r13, %rdi
movl $0x20, %esi
callq 0x42d0
movb $0x1, 0xe1(%r13)
movb $0x20, 0xe0(%r13)
movq 0x1e8(%rbx), %rax
movq (%rax,%r12,8), %rsi
movq %r15, %rdi
callq 0x28270
movq %rax, %r15
cmpb $0x0, 0x1cc(%rbx)
movq %r14, %rsi
leaq 0xbdb8(%rip), %rax      # 0x32778
cmovneq %rax, %rsi
movl $0x6, %edx
movq %r15, %rdi
callq 0x4340
leaq 0xc466(%rip), %rsi      # 0x32e3e
movl $0x33, %edx
movq %r15, %rdi
callq 0x4340
movq %r15, %rdi
callq 0x4170
jmp 0x26a17
movq 0x218(%rbx), %rdi
movl 0x200(%rdi), %eax
andl $-0x2, %eax
cmpl $0xa, %eax
jne 0x26a17
callq 0x23ddc
xorl %eax, %eax
movl %eax, 0x200(%rbx)
movl %eax, 0x220(%rbx)
movq 0x1e8(%rbx), %rax
movq (%rax,%r12,8), %rdi
testq %rdi, %rdi
je 0x26a34
movq (%rdi), %rax
callq *0x8(%rax)
movq 0x1e8(%rbx), %rax
leaq (%rax,%r12,8), %rsi
addq $0x8, %rsi
movq 0x1f0(%rbx), %rdx
cmpq %rdx, %rsi
je 0x26a5b
leaq (%rax,%r12,8), %rdi
subq %rsi, %rdx
callq 0x4480
movq 0x1f0(%rbx), %rdx
addq $-0x8, %rdx
movq %rdx, 0x1f0(%rbx)
cmpl $0x5, 0x200(%rbx)
jne 0x26abb
movq 0x218(%rbx), %rdi
movq 0x1d8(%rdi), %rax
cmpq 0x1d0(%rdi), %rax
jne 0x26abb
movl 0x25c(%rdi), %eax
cmpl 0x260(%rdi), %eax
jne 0x26abb
movl 0x208(%rdi), %eax
leaq 0x14a17(%rip), %rcx     # 0x3b4b8
cmpl (%rcx), %eax
jne 0x26abb
movl $0x1, %eax
movl %eax, 0x200(%rbx)
movl %eax, 0x200(%rdi)
callq 0x24f90
movq 0x1d0(%rbx), %rax
cmpq %rax, 0x1d8(%rbx)
je 0x26cc2
movq (%rax), %rsi
cmpb $0x1, 0x1cc(%rbx)
jne 0x26ae9
movq 0x208(%rbx), %rdi
callq 0x1a12a
jmp 0x26af5
movq 0x210(%rbx), %rdi
callq 0x27b6c
testb %al, %al
je 0x26cc2
movq 0x1d0(%rbx), %rax
movq 0x218(%rbx), %rdi
movq (%rax), %rsi
callq 0x22f84
leaq 0x1496e(%rip), %rax     # 0x3b488
cmpb $0x1, (%rax)
jne 0x26c6e
leaq 0x1495f(%rip), %rax     # 0x3b489
cmpb $0x0, (%rax)
jne 0x26c6e
movq 0x14496(%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 0x26b71
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 0x14448(%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 0x26bc8
movq %r15, %rdi
movl $0x20, %esi
callq 0x42d0
movb $0x1, 0xe1(%r15)
movb $0x20, 0xe0(%r15)
movq 0x1d0(%rbx), %rax
movq (%rax), %rsi
movq %r14, %rdi
callq 0x28270
movq %rax, %r14
leaq 0xbb8c(%rip), %rax      # 0x32778
leaq 0xbb8c(%rip), %rsi      # 0x3277f
cmpb $0x0, 0x1cc(%rbx)
cmovneq %rax, %rsi
movl $0x6, %edx
movq %r14, %rdi
callq 0x4340
leaq 0xc2ad(%rip), %rsi      # 0x32ebf
movl $0x12, %edx
movq %r14, %rdi
callq 0x4340
movzbl 0x1cc(%rbx), %edx
leaq 0xd215(%rip), %rax      # 0x33e42
leaq 0x9ce8(%rip), %rsi      # 0x3091c
testq %rdx, %rdx
cmovneq %rax, %rsi
addq $0x13, %rdx
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
movq 0x1d0(%rbx), %r14
movq (%r14), %rax
movl 0x430(%rax), %eax
testq %rax, %rax
je 0x26cc2
leaq (%r14,%rax,8), %r15
movq 0x1d8(%rbx), %rdx
subq %r15, %rdx
je 0x26caa
movq %r14, %rdi
movq %r15, %rsi
callq 0x4480
movq 0x1d8(%rbx), %rax
movq %rax, %rcx
jmp 0x26cb0
movq %r15, %rax
movq %r15, %rcx
subq %r15, %rax
addq %rax, %r14
cmpq %r14, %rcx
je 0x26cc2
movq %r14, 0x1d8(%rbx)
movq %rbx, %rdi
callq 0x25df6
movq 0x1e8(%rbx), %rax
movq 0x1f0(%rbx), %rcx
subq %rax, %rcx
je 0x26d11
sarq $0x3, %rcx
cmpq $0x1, %rcx
adcq $0x0, %rcx
xorl %edx, %edx
xorl %esi, %esi
movq (%rax,%rsi,8), %rdi
testq %rdi, %rdi
je 0x26d09
movl 0x14(%rdi), %r8d
leal -0x1(%r8), %r9d
testl %r8d, %r8d
cmovlel %edx, %r9d
movl %r9d, 0x14(%rdi)
incq %rsi
cmpq %rsi, %rcx
jne 0x26ced
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x1e8(%rbx), %rax
movq (%rax,%r12,8), %rsi
callq 0x229a8
movq 0x1e8(%rbx), %rax
movq 0x218(%rbx), %rdi
movq (%rax,%r12,8), %rsi
callq 0x22d48
movq 0x1e8(%rbx), %rax
movq (%rax,%r12,8), %rsi
cmpl $0x2, 0x434(%rsi)
jne 0x26d66
movq (%rsi), %rax
movq %rsi, %rdi
jmp 0x26733
movq %rbx, %rdi
callq 0x1a222
jmp 0x26736
movq 0x14276(%rip), %rdi     # 0x3aff0
leaq 0x92a1(%rip), %rsi      # 0x30022
callq 0x42e0
leaq 0xbf93(%rip), %rsi      # 0x32d20
movq %rax, %rdi
callq 0x42e0
leaq 0x9afb(%rip), %rsi      # 0x30897
movq %rax, %rdi
callq 0x42e0
movq %rax, %rdi
movl $0x49, %esi
callq 0x4500
leaq 0x9289(%rip), %rsi      # 0x30041
movq %rax, %rdi
callq 0x42e0
leaq 0x20(%rbx), %rsi
movq %rax, %rdi
callq 0x4290
leaq 0xbfea(%rip), %rsi      # 0x32dbd
jmp 0x26e34
movq 0x14214(%rip), %rdi     # 0x3aff0
leaq 0x923f(%rip), %rsi      # 0x30022
callq 0x42e0
leaq 0xbf31(%rip), %rsi      # 0x32d20
movq %rax, %rdi
callq 0x42e0
leaq 0x9a99(%rip), %rsi      # 0x30897
movq %rax, %rdi
callq 0x42e0
movq %rax, %rdi
movl $0xd2, %esi
callq 0x4500
leaq 0x9227(%rip), %rsi      # 0x30041
movq %rax, %rdi
callq 0x42e0
movq %rax, %rdi
movq %r15, %rsi
callq 0x4290
leaq 0xc03e(%rip), %rsi      # 0x32e72
movq %rax, %rdi
callq 0x42e0
movq 0x8(%rbx), %rsi
movq %rax, %rdi
callq 0x40c0
leaq 0xc692(%rip), %rsi      # 0x334e1
movq %rax, %rdi
callq 0x42e0
movq %rax, %rdi
callq 0x4170
xorl %edi, %edi
callq 0x4360
movq %rax, %rbx
movl $0x468, %esi            # imm = 0x468
movq %rbp, %rdi
callq 0x4300
movq %rbx, %rdi
callq 0x4540