// File: /workspace/github_cpp_makefile_star2_O1/estwings57[P]CasHMC/sources/CrossbarSwitch.cpp
// Function: CasHMC::CrossbarSwitch::Update()
void CrossbarSwitch::Update()
{	
	//Downstream buffer state
	if(bufPopDelay == 0) {
		for(int i=0; i<downBuffers.size(); i++) {
			if(downBuffers[i] != NULL) {
				//Check request size and the maximum block size
				if(downBuffers[i]->reqDataSize > ADDRESS_MAPPING) {
					int segPacket = ceil((double)downBuffers[i]->reqDataSize/ADDRESS_MAPPING);
					downBuffers[i]->reqDataSize = ADDRESS_MAPPING;
					DEBUG(ALI(18)<<header<<ALI(15)<<*downBuffers[i]<<"Down) Packet is DIVIDED into "<<segPacket<<" segment packets by max block size");
					
					//the packet is divided into segment packets.
					Packet *tempPacket = downBuffers[i];
					downBuffers.erase(downBuffers.begin()+i, downBuffers.begin()+i+downBuffers[i]->LNG);
					if(tempPacket->LNG > 1)	tempPacket->LNG = 1 + ADDRESS_MAPPING/16;	//one flit is 16 bytes
					for(int j=0; j<segPacket; j++) {
						Packet *vaultPacket = new Packet(*tempPacket);
						vaultPacket->ADRS += j*ADDRESS_MAPPING;
						if(j>0)	vaultPacket->trace = NULL;
						downBuffers.insert(downBuffers.begin()+i, vaultPacket);
						for(int k=1; k<vaultPacket->LNG; k++) {		//Virtual tail packet
							downBuffers.insert(downBuffers.begin()+i+1, NULL);
						}
						i += vaultPacket->LNG;
						vaultPacket->segment = true;
						pendingSegTag.push_back(vaultPacket->TAG);
					}
					delete tempPacket;
				}
				else {
					unsigned vaultMap = (downBuffers[i]->ADRS >> _log2(ADDRESS_MAPPING)) & (NUM_VAULTS-1);
					if(downBufferDest[vaultMap]->ReceiveDown(downBuffers[i])) {
						DEBUG(ALI(18)<<header<<ALI(15)<<*downBuffers[i]<<"Down) SENDING packet to vault controller "<<vaultMap<<" (VC_"<<vaultMap<<")");
						downBuffers.erase(downBuffers.begin()+i, downBuffers.begin()+i+downBuffers[i]->LNG);
						i--;
					}
					else {
						//DEBUG(ALI(18)<<header<<ALI(15)<<*downBuffers[i]<<"Down) Vault controller buffer FULL");	
					}
				}
			}
		}
	}
	
	//Upstream buffer state
	for(int i=0; i<upBuffers.size(); i++) {
		if(upBuffers[i] != NULL) {
			//If the segment packet is arrived
			if(upBuffers[i]->segment) {
				//Check a stored segment packet tag
				bool foundSeg = false;
				bool foundLastSeg = true;
				for(int j=0; j<pendingSegTag.size(); j++) {
					if(upBuffers[i]->TAG == pendingSegTag[j]) {
						pendingSegTag.erase(pendingSegTag.begin()+j);
						foundSeg = true;
						//Check whether upBuffers[i] packet is the last segment packet or not 
						for(int k=j; k<pendingSegTag.size(); k++) {
							if(upBuffers[i]->TAG == pendingSegTag[k]) {
								DEBUG(ALI(18)<<header<<ALI(15)<<*upBuffers[i]<<"Up)   Segment packet is WAITING for the others");
								foundLastSeg = false;
								break;
							}
						}
						if(foundLastSeg) {
							DEBUG(ALI(18)<<header<<ALI(15)<<*upBuffers[i]<<"Up)   The LAST segment packet is arrived");
						}
						break;
					}
				}
				if(!foundSeg) {
					ERROR(header<<"  == Error - pendingSegTag doesn't have segment packet tag ["<<*upBuffers[i]<<"]");
					exit(0);
				}
				
				//Segment packets are combined together
				foundSeg = false;
				for(int j=0; j<pendingSegPacket.size(); j++) {
					if(upBuffers[i]->TAG == pendingSegPacket[j]->TAG) {
						if(upBuffers[i]->LNG > 1)	pendingSegPacket[j]->LNG += ADDRESS_MAPPING/16;
						if(upBuffers[i]->trace != NULL) { //It is the first segment packet
							pendingSegPacket[j]->trace = upBuffers[i]->trace;
							pendingSegPacket[j]->ADRS = upBuffers[i]->ADRS;
						}
						//Delete a segment packet
						int packetLNG = upBuffers[i]->LNG;
						delete upBuffers[i];
						upBuffers.erase(upBuffers.begin()+i, upBuffers.begin()+i+packetLNG);
						foundSeg = true;
						//All segment packets are combined
						if(foundLastSeg) {
							Packet *combPacket = new Packet(*pendingSegPacket[j]);
							delete pendingSegPacket[j];
							pendingSegPacket.erase(pendingSegPacket.begin()+j);
							combPacket->segment = false;
							upBuffers.insert(upBuffers.begin(), combPacket);
							for(int k=1; k<combPacket->LNG; k++) {	//Virtual tail packet
								upBuffers.insert(upBuffers.begin()+1, NULL);
							}
						}
						else {
							i--;
						}
						break;
					}
				}
				//Thr first arrived segment packet
				if(!foundSeg) {
					pendingSegPacket.push_back(upBuffers[i]);
					upBuffers.erase(upBuffers.begin()+i, upBuffers.begin()+i+upBuffers[i]->LNG);
					i--;
				}
			}
			else {
				for(int l=0; l<NUM_LINKS; l++) {
					int link = FindAvailableLink(inServiceLink, upBufferDest);
					if(link == -1) {
						//DEBUG(ALI(18)<<header<<ALI(15)<<*upBuffers[i]<<"Up)   all packet buffer FULL");
					}
					else if(upBufferDest[link]->currentState != ACTIVE
					&& upBufferDest[link]->currentState != LINK_RETRY) {
						continue;
						//DEBUG(ALI(18)<<header<<ALI(15)<<*downBuffers[0]<<"Down) link "<<l<<" is not ACTIVE mode ["<<downLinkMasters[link]->powerMode<<"]");
					}
					else {
						if(upBufferDest[link]->Receive(upBuffers[i])) {
							DEBUG(ALI(18)<<header<<ALI(15)<<*upBuffers[i]<<"Up)   SENDING packet to link master "<<link<<" (LM_U"<<link<<")");
							upBuffers.erase(upBuffers.begin()+i, upBuffers.begin()+i+upBuffers[i]->LNG);
							i--;
							break;
						}
						else {
							//DEBUG(ALI(18)<<header<<ALI(15)<<*upBuffers[i]<<"Up)   Link master buffer FULL");
						}
					}
				}
			}
		}
	}
	
	Step();
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x58, %rsp
movq %rdi, %r12
cmpl $0x0, 0x200(%rdi)
movq %rdi, 0x10(%rsp)
jne 0x1979f
movq 0x1d0(%r12), %rax
cmpq %rax, 0x1d8(%r12)
je 0x1979f
leaq 0x1d0(%r12), %r14
leaq 0x240(%r12), %rcx
movq %rcx, 0x28(%rsp)
xorl %ebp, %ebp
xorl %r15d, %r15d
movq (%rax,%rbp,8), %r13
testq %r13, %r13
je 0x19547
movl 0x424(%r13), %eax
leaq 0x23360(%rip), %rcx     # 0x3c58c
movl (%rcx), %ebx
cmpl %ebx, %eax
jbe 0x1954f
movl %eax, %eax
xorps %xmm0, %xmm0
cvtsi2sd %rax, %xmm0
xorps %xmm1, %xmm1
cvtsi2sd %ebx, %xmm1
divsd %xmm1, %xmm0
callq 0x4090
cvttsd2si %xmm0, %eax
movl %eax, 0x20(%rsp)
movl %ebx, 0x424(%r13)
leaq 0x23222(%rip), %rax     # 0x3c488
cmpb $0x1, (%rax)
jne 0x193a2
leaq 0x23213(%rip), %rax     # 0x3c489
cmpb $0x0, (%rax)
jne 0x193a2
movl %r15d, %ebx
movq 0x22d47(%rip), %rdx     # 0x3bfd0
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 0x192c7
movq %r15, %rdi
movl $0x20, %esi
callq 0x42d0
movb %al, 0xe0(%r15)
movb $0x1, 0xe1(%r15)
movb $0x20, 0xe0(%r15)
movq 0x20(%r12), %rsi
movq 0x28(%r12), %rdx
movq 0x22cf0(%rip), %rdi     # 0x3bfd0
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 0x19327
movq %r13, %rdi
movl $0x20, %esi
callq 0x42d0
movb %al, 0xe0(%r13)
movb $0x1, 0xe1(%r13)
movb $0x20, 0xe0(%r13)
movq (%r14), %rax
movq (%rax,%rbp,8), %rsi
movq %r15, %rdi
callq 0x28bbe
movq %rax, %r15
movl $0x1d, %edx
movq %rax, %rdi
leaq 0x19a75(%rip), %rsi     # 0x32dc5
callq 0x4340
movq %r15, %rdi
movl 0x20(%rsp), %esi
callq 0x4500
movq %rax, %r15
movl $0x22, %edx
movq %rax, %rdi
leaq 0x19a70(%rip), %rsi     # 0x32de3
callq 0x4340
movq (%r15), %rax
movq -0x18(%rax), %rdi
addq %r15, %rdi
movl $0xa, %esi
callq 0x42d0
movsbl %al, %esi
movq %r15, %rdi
callq 0x4040
movq %rax, %rdi
callq 0x41f0
movl %ebx, %r15d
movq (%r14), %rax
movq (%rax,%rbp,8), %rcx
movq %rcx, 0x18(%rsp)
movl 0x430(%rcx), %ecx
testq %rcx, %rcx
je 0x193fe
leaq (%rax,%rbp,8), %r13
leaq (,%rcx,8), %rbx
addq %r13, %rbx
movq 0x1d8(%r12), %rdx
subq %rbx, %rdx
je 0x193e0
movq %r13, %rdi
movq %rbx, %rsi
callq 0x4480
movq 0x1d8(%r12), %rax
movq %rax, %rcx
subq %rbx, %rcx
addq %rcx, %r13
cmpq %r13, %rax
je 0x193fe
movq %r13, 0x1d8(%r12)
movq 0x18(%rsp), %rbp
cmpl $0x2, 0x430(%rbp)
jb 0x19428
leaq 0x23179(%rip), %rax     # 0x3c58c
movl (%rax), %eax
leal 0xf(%rax), %ecx
testl %eax, %eax
cmovnsl %eax, %ecx
sarl $0x4, %ecx
incl %ecx
movl %ecx, 0x430(%rbp)
cmpl $0x0, 0x20(%rsp)
jle 0x19764
xorl %ebx, %ebx
movl $0x468, %edi            # imm = 0x468
callq 0x42f0
movq %rax, %r13
movq %rax, %rdi
movq %rbp, %rsi
callq 0x2879e
movq %r13, 0x30(%rsp)
leaq 0x23133(%rip), %rax     # 0x3c58c
movslq (%rax), %rax
movslq %ebx, %rcx
imulq %rcx, %rax
addq %rax, 0x450(%r13)
testl %ecx, %ecx
je 0x19476
movq $0x0, 0x8(%r13)
movl %r15d, 0x8(%rsp)
movslq %r15d, %r15
leaq (,%r15,8), %rsi
addq (%r14), %rsi
movq %r14, %rdi
leaq 0x30(%rsp), %rdx
callq 0x1a82e
movq 0x30(%rsp), %rdx
movl 0x430(%rdx), %r13d
cmpl $0x2, %r13d
leaq 0x40(%rsp), %rbp
jb 0x194e6
movl $0x1, %r12d
movq (%r14), %rax
leaq (%rax,%r15,8), %rsi
addq $0x8, %rsi
movq $0x0, 0x40(%rsp)
movq %r14, %rdi
movq %rbp, %rdx
callq 0x1ad7a
incl %r12d
movq 0x30(%rsp), %rdx
movl 0x430(%rdx), %r13d
cmpl %r13d, %r12d
jb 0x194b3
movb $0x1, 0x422(%rdx)
addq $0x42c, %rdx            # imm = 0x42C
movq 0x10(%rsp), %r12
movq 0x248(%r12), %rsi
cmpq 0x250(%r12), %rsi
je 0x1951d
movl (%rdx), %eax
movl %eax, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x248(%r12)
jmp 0x19527
movq 0x28(%rsp), %rdi
callq 0x14232
movl 0x8(%rsp), %ebp
addl %ebp, %r13d
incl %ebx
movl %r13d, %r15d
cmpl 0x20(%rsp), %ebx
movq 0x18(%rsp), %rbp
jne 0x19435
jmp 0x19767
movl %r15d, %r13d
jmp 0x19776
movl %r15d, 0x8(%rsp)
movq 0x450(%r13), %r15
bsrl %ebx, %ecx
cmpl $0x2, %ebx
movl $0x0, %eax
cmovbl %eax, %ecx
movl $0x1, %edx
shll %cl, %edx
xorl %eax, %eax
cmpl %ebx, %edx
setb %al
addl %ecx, %eax
movl %eax, %ecx
shrq %cl, %r15
leaq 0x22ff7(%rip), %rax     # 0x3c57c
movl (%rax), %eax
decl %eax
andl %eax, %r15d
movq 0x208(%r12), %rax
movq (%rax,%r15,8), %rdi
movq %r13, %rsi
callq 0x1a8b0
testb %al, %al
je 0x1975d
leaq 0x22ed9(%rip), %rax     # 0x3c488
cmpb $0x1, (%rax)
jne 0x19703
leaq 0x22eca(%rip), %rax     # 0x3c489
cmpb $0x0, (%rax)
jne 0x19703
movq 0x22a01(%rip), %rdx     # 0x3bfd0
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 0x1960d
movq %r13, %rdi
movl $0x20, %esi
callq 0x42d0
movb %al, 0xe0(%r13)
movb $0x1, 0xe1(%r13)
movb $0x20, 0xe0(%r13)
movq 0x20(%r12), %rsi
movq 0x28(%r12), %rdx
movq 0x229aa(%rip), %rdi     # 0x3bfd0
callq 0x4340
movq %rax, %r13
movq (%rax), %rax
movq -0x18(%rax), %rcx
movq $0xf, 0x10(%r13,%rcx)
movq -0x18(%rax), %rax
leaq (%rax,%r13), %rbx
cmpb $0x0, 0xe1(%r13,%rax)
jne 0x1966b
movq %rbx, %rdi
movl $0x20, %esi
callq 0x42d0
movb %al, 0xe0(%rbx)
movb $0x1, 0xe1(%rbx)
movb $0x20, 0xe0(%rbx)
movq (%r14), %rax
movq (%rax,%rbp,8), %rsi
movq %r13, %rdi
callq 0x28bbe
movq %rax, %r13
movl $0x29, %edx
movq %rax, %rdi
leaq 0x19773(%rip), %rsi     # 0x32e06
callq 0x4340
movq %r13, %rdi
movq %r15, %rsi
callq 0x41e0
movq %rax, %r13
movl $0x5, %edx
movq %rax, %rdi
leaq 0x1b485(%rip), %rsi     # 0x34b3a
callq 0x4340
movq %r13, %rdi
movq %r15, %rsi
callq 0x41e0
movq %rax, %r15
movl $0x1, %edx
movq %rax, %rdi
leaq 0x1ad8a(%rip), %rsi     # 0x34461
callq 0x4340
movq (%r15), %rax
movq -0x18(%rax), %rdi
addq %r15, %rdi
movl $0xa, %esi
callq 0x42d0
movsbl %al, %esi
movq %r15, %rdi
callq 0x4040
movq %rax, %rdi
callq 0x41f0
movq (%r14), %rax
movq (%rax,%rbp,8), %rcx
movl 0x430(%rcx), %ecx
testq %rcx, %rcx
je 0x19753
leaq (%rax,%rbp,8), %r15
leaq (%r15,%rcx,8), %r13
movq 0x1d8(%r12), %rdx
subq %r13, %rdx
je 0x19735
movq %r15, %rdi
movq %r13, %rsi
callq 0x4480
movq 0x1d8(%r12), %rax
movq %rax, %rcx
subq %r13, %rcx
addq %rcx, %r15
cmpq %r15, %rax
je 0x19753
movq %r15, 0x1d8(%r12)
movl 0x8(%rsp), %r13d
decl %r13d
jmp 0x19776
movl 0x8(%rsp), %r13d
jmp 0x19776
movl %r15d, %r13d
testq %rbp, %rbp
je 0x19776
movq (%rbp), %rax
movq %rbp, %rdi
callq *0x8(%rax)
incl %r13d
movslq %r13d, %rbp
movq 0x1d0(%r12), %rax
movq 0x1d8(%r12), %rcx
subq %rax, %rcx
sarq $0x3, %rcx
movl %r13d, %r15d
cmpq %rbp, %rcx
ja 0x19211
movq 0x1e8(%r12), %rax
cmpq %rax, 0x1f0(%r12)
je 0x1a0cf
leaq 0x1e8(%r12), %rbp
leaq 0x238(%r12), %r15
leaq 0x220(%r12), %rbx
leaq 0x258(%r12), %rcx
movq %rcx, 0x50(%rsp)
leaq 0x260(%r12), %rcx
movq %rcx, 0x38(%rsp)
xorl %r13d, %r13d
xorl %r14d, %r14d
movq %rbp, 0x18(%rsp)
movq %r15, 0x20(%rsp)
movq %rbx, 0x8(%rsp)
movq (%rax,%r13,8), %rsi
testq %rsi, %rsi
je 0x1a0a4
cmpb $0x0, 0x422(%rsi)
je 0x19859
movq 0x240(%r12), %rax
movq 0x248(%r12), %rdx
movq %rdx, %rcx
movb $0x1, %r15b
subq %rax, %rcx
setne %r8b
je 0x19db5
sarq $0x2, %rcx
movl 0x42c(%rsi), %esi
cmpq $0x1, %rcx
movq %rcx, %rdi
adcq $0x0, %rdi
cmpl (%rax), %esi
jne 0x19ac7
xorl %ebx, %ebx
jmp 0x19aed
leaq 0x22c48(%rip), %rax     # 0x3c4a8
cmpl $0x0, (%rax)
jle 0x1a0a4
xorl %r12d, %r12d
movq %r15, %rdi
movq %rbx, %rsi
callq 0x26342
cmpl $-0x1, %eax
je 0x19a97
movl %eax, %r13d
cltq
movq (%rbx), %rcx
movq (%rcx,%rax,8), %rdi
movl 0x200(%rdi), %ecx
cmpl $0xb, %ecx
je 0x198a4
movl $0x1c, %eax
testl %ecx, %ecx
jne 0x19aa2
movslq %r14d, %rbx
movq (%rbp), %rax
movq (%rax,%rbx,8), %rsi
callq 0x1a9a6
testb %al, %al
je 0x19a9b
leaq 0x22bc5(%rip), %rax     # 0x3c488
cmpb $0x1, (%rax)
jne 0x19a24
leaq 0x22bb6(%rip), %rax     # 0x3c489
cmpb $0x0, (%rax)
jne 0x19a24
movq 0x226ed(%rip), %rdx     # 0x3bfd0
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 0x19921
movq %r15, %rdi
movl $0x20, %esi
callq 0x42d0
movb %al, 0xe0(%r15)
movb $0x1, 0xe1(%r15)
movb $0x20, 0xe0(%r15)
movq 0x10(%rsp), %rax
movq 0x20(%rax), %rsi
movq 0x28(%rax), %rdx
movq 0x22693(%rip), %rdi     # 0x3bfd0
callq 0x4340
movq %rax, %rbp
movq (%rax), %rax
movq -0x18(%rax), %rcx
movq $0xf, 0x10(%rbp,%rcx)
movq -0x18(%rax), %rax
leaq (%rax,%rbp), %r15
cmpb $0x0, 0xe1(%rbp,%rax)
jne 0x19983
movq %r15, %rdi
movl $0x20, %esi
callq 0x42d0
movb %al, 0xe0(%r15)
movb $0x1, 0xe1(%r15)
movb $0x20, 0xe0(%r15)
movq 0x18(%rsp), %rcx
movq (%rcx), %rax
movq (%rax,%rbx,8), %rsi
movq %rbp, %rdi
movq %rcx, %rbp
callq 0x28bbe
movq %rax, %r15
movl $0x24, %edx
movq %rax, %rdi
leaq 0x1952c(%rip), %rsi     # 0x32ee0
callq 0x4340
movq %r15, %rdi
movl %r13d, %esi
callq 0x4500
movq %rax, %r15
movl $0x6, %edx
movq %rax, %rdi
leaq 0x1952f(%rip), %rsi     # 0x32f05
callq 0x4340
movq %r15, %rdi
movl %r13d, %esi
callq 0x4500
movq %rax, %r15
movl $0x1, %edx
movq %rax, %rdi
leaq 0x1aa69(%rip), %rsi     # 0x34461
callq 0x4340
movq (%r15), %rax
movq -0x18(%rax), %rdi
addq %r15, %rdi
movl $0xa, %esi
callq 0x42d0
movsbl %al, %esi
movq %r15, %rdi
callq 0x4040
movq %rax, %rdi
callq 0x41f0
movq (%rbp), %rax
movq (%rax,%rbx,8), %rcx
movl 0x430(%rcx), %ecx
testq %rcx, %rcx
je 0x19a88
leaq (%rax,%rbx,8), %r13
leaq (,%rcx,8), %r15
addq %r13, %r15
movq 0x10(%rsp), %rax
movq 0x1f0(%rax), %rdx
subq %r15, %rdx
je 0x19a62
movq %r13, %rdi
movq %r15, %rsi
callq 0x4480
movq 0x10(%rsp), %rax
movq 0x1f0(%rax), %rax
movq %rax, %rcx
subq %r15, %rcx
addq %rcx, %r13
cmpq %r13, %rax
je 0x19a88
movq 0x10(%rsp), %rax
movq %r13, 0x1f0(%rax)
decl %r14d
movl $0x1a, %eax
movq 0x20(%rsp), %r15
jmp 0x19a9d
xorl %eax, %eax
jmp 0x19aa2
xorl %eax, %eax
movq 0x8(%rsp), %rbx
cmpl $0x1c, %eax
je 0x19aaf
testl %eax, %eax
jne 0x1a0a4
incl %r12d
leaq 0x229ef(%rip), %rax     # 0x3c4a8
cmpl (%rax), %r12d
jl 0x1986c
jmp 0x1a0a4
movl $0x1, %r8d
cmpq %r8, %rdi
je 0x19c69
leaq 0x1(%r8), %rbx
cmpl (%rax,%r8,4), %esi
movq %rbx, %r8
jne 0x19acd
decq %rbx
cmpq %rbx, %rcx
seta %r8b
leaq (%rax,%rbx,4), %rsi
addq $0x4, %rsi
cmpq %rdx, %rsi
je 0x19b0c
leaq (%rax,%rbx,4), %rdi
subq %rsi, %rdx
movl %r8d, %r15d
callq 0x4480
movl %r15d, %r8d
movq 0x240(%r12), %rax
movq 0x248(%r12), %rcx
addq $-0x4, %rcx
movq %rcx, 0x248(%r12)
subq %rax, %rcx
sarq $0x2, %rcx
movl %ebx, %edx
cmpq %rdx, %rcx
setbe %r15b
jbe 0x19b5d
movq (%rbp), %rdx
movq (%rdx,%r13,8), %rdx
movl 0x42c(%rdx), %edx
cmpl (%rax,%rbx,4), %edx
je 0x19c72
incq %rbx
cmpq %rbx, %rcx
setbe %r15b
ja 0x19b48
leaq 0x22924(%rip), %rax     # 0x3c488
cmpb $0x1, (%rax)
jne 0x19c9a
leaq 0x22915(%rip), %rax     # 0x3c489
cmpb $0x0, (%rax)
movq 0x8(%rsp), %rbx
jne 0x19db5
movb %r8b, 0x28(%rsp)
movq 0x22442(%rip), %rdx     # 0x3bfd0
movq (%rdx), %rax
movq -0x18(%rax), %rcx
movq $0x12, 0x10(%rdx,%rcx)
movq -0x18(%rax), %rax
leaq (%rdx,%rax), %rbp
cmpb $0x0, 0xe1(%rdx,%rax)
jne 0x19bca
movq %rbp, %rdi
movl $0x20, %esi
callq 0x42d0
movb %al, 0xe0(%rbp)
movb $0x1, 0xe1(%rbp)
movb $0x20, 0xe0(%rbp)
movq 0x20(%r12), %rsi
movq 0x28(%r12), %rdx
movq 0x223ee(%rip), %rdi     # 0x3bfd0
callq 0x4340
movq %rax, %rbp
movq (%rax), %rax
movq -0x18(%rax), %rcx
movq $0xf, 0x10(%rbp,%rcx)
movq -0x18(%rax), %rax
leaq (%rax,%rbp), %rcx
cmpb $0x0, 0xe1(%rbp,%rax)
jne 0x19c32
movq %rcx, 0x48(%rsp)
movq 0x48(%rsp), %rdi
movl $0x20, %esi
callq 0x42d0
movq 0x48(%rsp), %rcx
movb %al, 0xe0(%rcx)
movb $0x1, 0xe1(%rcx)
movb $0x20, 0xe0(%rcx)
movq 0x18(%rsp), %rax
movq (%rax), %rax
movq (%rax,%r13,8), %rsi
movq %rbp, %rdi
callq 0x28bbe
movq %rax, %rbp
movl $0x28, %edx
movq %rax, %rdi
leaq 0x19200(%rip), %rsi     # 0x32e5f
callq 0x4340
jmp 0x19d83
cmpq %r8, %rcx
seta %r8b
jmp 0x19c9a
leaq 0x2280f(%rip), %rax     # 0x3c488
cmpb $0x1, (%rax)
jne 0x19c97
leaq 0x22804(%rip), %rax     # 0x3c489
cmpb $0x0, (%rax)
movq 0x8(%rsp), %rbx
je 0x19ca4
xorl %r15d, %r15d
jmp 0x19db5
xorl %r15d, %r15d
movq 0x8(%rsp), %rbx
jmp 0x19db5
movb %r8b, 0x28(%rsp)
movq 0x22320(%rip), %rdx     # 0x3bfd0
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 0x19cee
movq %r15, %rdi
movl $0x20, %esi
callq 0x42d0
movb %al, 0xe0(%r15)
movb $0x1, 0xe1(%r15)
movb $0x20, 0xe0(%r15)
movq 0x20(%r12), %rsi
movq 0x28(%r12), %rdx
movq 0x222c9(%rip), %rdi     # 0x3bfd0
callq 0x4340
movq %rax, %rbp
movq (%rax), %rax
movq -0x18(%rax), %rcx
movq $0xf, 0x10(%rbp,%rcx)
movq -0x18(%rax), %rax
leaq (%rax,%rbp), %r15
cmpb $0x0, 0xe1(%rbp,%rax)
jne 0x19d4d
movq %r15, %rdi
movl $0x20, %esi
callq 0x42d0
movb %al, 0xe0(%r15)
movb $0x1, 0xe1(%r15)
movb $0x20, 0xe0(%r15)
movq 0x18(%rsp), %rax
movq (%rax), %rax
movq (%rax,%r13,8), %rsi
movq %rbp, %rdi
callq 0x28bbe
movq %rax, %rbp
movl $0x2e, %edx
movq %rax, %rdi
leaq 0x190b5(%rip), %rsi     # 0x32e30
callq 0x4340
xorl %r15d, %r15d
movq (%rbp), %rax
movq -0x18(%rax), %rdi
addq %rbp, %rdi
movl $0xa, %esi
callq 0x42d0
movsbl %al, %esi
movq %rbp, %rdi
callq 0x4040
movq %rax, %rdi
callq 0x41f0
movq 0x18(%rsp), %rbp
movb 0x28(%rsp), %r8b
testb %r8b, %r8b
je 0x1a0fd
movq 0x258(%r12), %rax
movq 0x260(%r12), %rdi
subq %rax, %rdi
setne %cl
je 0x19ff2
movb %cl, 0x28(%rsp)
sarq $0x3, %rdi
movq (%rbp), %rcx
movq (%rcx,%r13,8), %rdx
cmpq $0x1, %rdi
movq %rdi, %r8
adcq $0x0, %r8
movl 0x42c(%rdx), %r9d
movq (%rax), %rsi
cmpl 0x42c(%rsi), %r9d
jne 0x19e0d
xorl %r12d, %r12d
jmp 0x19e37
movl $0x1, %r12d
cmpq %r12, %r8
je 0x19fe7
movq (%rax,%r12,8), %rsi
incq %r12
cmpl 0x42c(%rsi), %r9d
jne 0x19e13
decq %r12
cmpq %r12, %rdi
seta 0x28(%rsp)
cmpl $0x2, 0x430(%rdx)
jb 0x19e5e
leaq 0x22745(%rip), %rdi     # 0x3c58c
movl (%rdi), %edi
leal 0xf(%rdi), %r8d
testl %edi, %edi
cmovnsl %edi, %r8d
sarl $0x4, %r8d
addl %r8d, 0x430(%rsi)
movq 0x8(%rdx), %rdx
testq %rdx, %rdx
je 0x19e81
movq %rdx, 0x8(%rsi)
movq (%rcx,%r13,8), %rdx
movq 0x450(%rdx), %rdx
movq (%rax,%r12,8), %rax
movq %rdx, 0x450(%rax)
movq (%rcx,%r13,8), %rdi
movslq 0x430(%rdi), %rbx
testq %rdi, %rdi
je 0x19e97
movq (%rdi), %rax
callq *0x8(%rax)
testl %ebx, %ebx
je 0x19ef5
shlq $0x3, %r13
addq (%rbp), %r13
leaq (,%rbx,8), %rbp
addq %r13, %rbp
movq 0x10(%rsp), %rax
movq 0x1f0(%rax), %rdx
subq %rbp, %rdx
je 0x19eca
movq %r13, %rdi
movq %rbp, %rsi
callq 0x4480
movq 0x10(%rsp), %rax
movq 0x1f0(%rax), %rax
movq %rax, %rcx
subq %rbp, %rcx
addq %rcx, %r13
cmpq %r13, %rax
movq 0x18(%rsp), %rbp
je 0x19ef5
movq 0x10(%rsp), %rax
movq %r13, 0x1f0(%rax)
testb %r15b, %r15b
je 0x19fcf
movl $0x468, %edi            # imm = 0x468
callq 0x42f0
movq %rax, %r13
movq 0x50(%rsp), %rbx
movq (%rbx), %rax
movq (%rax,%r12,8), %rsi
movq %r13, %rdi
callq 0x2879e
movq 0x20(%rsp), %r15
movq %r13, 0x30(%rsp)
movq (%rbx), %rax
movq (%rax,%r12,8), %rdi
testq %rdi, %rdi
je 0x19f3b
movq (%rdi), %rax
callq *0x8(%rax)
movq (%rbx), %rax
leaq (%rax,%r12,8), %rsi
addq $0x8, %rsi
movq 0x38(%rsp), %rcx
movq (%rcx), %rdx
cmpq %rdx, %rsi
je 0x19f5f
leaq (%rax,%r12,8), %rdi
subq %rsi, %rdx
callq 0x4480
movq 0x38(%rsp), %rax
addq $-0x8, (%rax)
movq 0x30(%rsp), %rax
movb $0x0, 0x422(%rax)
movq (%rbp), %rsi
movq %rbp, %rdi
leaq 0x30(%rsp), %rdx
callq 0x1a82e
movq 0x30(%rsp), %rax
cmpl $0x2, 0x430(%rax)
leaq 0x40(%rsp), %r12
jb 0x19fc8
movl $0x1, %ebx
movq (%rbp), %rsi
addq $0x8, %rsi
movq $0x0, 0x40(%rsp)
movq %rbp, %rdi
movq %r12, %rdx
callq 0x1ad7a
incl %ebx
movq 0x30(%rsp), %rax
cmpl 0x430(%rax), %ebx
jb 0x19f9d
movq 0x10(%rsp), %r12
jmp 0x19fdc
decl %r14d
movq 0x10(%rsp), %r12
movq 0x20(%rsp), %r15
movq 0x8(%rsp), %rbx
movb 0x28(%rsp), %cl
jmp 0x19ff7
cmpq %r12, %rdi
seta %cl
movq 0x10(%rsp), %r12
movq 0x20(%rsp), %r15
testb %cl, %cl
jne 0x1a0a4
movslq %r14d, %rbx
leaq (,%rbx,8), %rdx
addq 0x1e8(%r12), %rdx
movq 0x260(%r12), %rsi
cmpq 0x268(%r12), %rsi
je 0x1a035
movq (%rdx), %rax
movq %rax, (%rsi)
movq 0x38(%rsp), %rax
addq $0x8, (%rax)
jmp 0x1a03f
movq 0x50(%rsp), %rdi
callq 0x1ac5a
movq (%rbp), %rax
movq (%rax,%rbx,8), %rcx
movl 0x430(%rcx), %ecx
testq %rcx, %rcx
je 0x1a09c
leaq (%rax,%rbx,8), %r13
leaq (,%rcx,8), %rbp
addq %r13, %rbp
movq 0x1f0(%r12), %rdx
subq %rbp, %rdx
je 0x1a079
movq %r13, %rdi
movq %rbp, %rsi
callq 0x4480
movq 0x1f0(%r12), %rax
movq %rax, %rcx
subq %rbp, %rcx
addq %rcx, %r13
cmpq %r13, %rax
movq 0x18(%rsp), %rbp
je 0x1a09c
movq %r13, 0x1f0(%r12)
decl %r14d
movq 0x8(%rsp), %rbx
incl %r14d
movslq %r14d, %r13
movq 0x10(%rsp), %r12
movq 0x1e8(%r12), %rax
movq 0x1f0(%r12), %rcx
subq %rax, %rcx
sarq $0x3, %rcx
cmpq %r13, %rcx
ja 0x197fc
incq 0x8(%r12)
movl 0x200(%r12), %eax
leal -0x1(%rax), %ecx
xorl %edx, %edx
testl %eax, %eax
cmovgl %ecx, %edx
movl %edx, 0x200(%r12)
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x21eec(%rip), %rdi     # 0x3bff0
leaq 0x16f17(%rip), %rsi     # 0x31022
callq 0x42e0
leaq 0x18d71(%rip), %rsi     # 0x32e88
movq %rax, %rdi
callq 0x42e0
leaq 0x17711(%rip), %rsi     # 0x31837
movq %rax, %rdi
callq 0x42e0
movq %rax, %rdi
movl $0x85, %esi
callq 0x4500
leaq 0x16eff(%rip), %rsi     # 0x31041
movq %rax, %rdi
callq 0x42e0
leaq 0x20(%r12), %rsi
movq %rax, %rdi
callq 0x4290
leaq 0x18d45(%rip), %rsi     # 0x32ea3
movq %rax, %rdi
callq 0x42e0
movq 0x1e8(%r12), %rcx
movq (%rcx,%r13,8), %rsi
movq %rax, %rdi
callq 0x28bbe
leaq 0x18901(%rip), %rsi     # 0x32a82
movq %rax, %rdi
callq 0x42e0
movq %rax, %rdi
callq 0x4170
xorl %edi, %edi
callq 0x4360
jmp 0x1a19a
movq %rax, %rbx
movl $0x468, %esi            # imm = 0x468
movq %r13, %rdi
callq 0x4300
movq %rbx, %rdi
callq 0x4540