// File: /workspace/github_cpp_makefile_star2_O3/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 $0x48, %rsp
movq %rdi, %rbp
cmpl $0x0, 0x200(%rdi)
movq %rdi, 0x8(%rsp)
jne 0x18fdc
movq 0x1d0(%rbp), %rax
cmpq %rax, 0x1d8(%rbp)
je 0x18fdc
leaq 0x1d0(%rbp), %r14
leaq 0x240(%rbp), %rcx
movq %rcx, 0x30(%rsp)
xorl %r15d, %r15d
xorl %r12d, %r12d
movq (%rax,%r15,8), %r13
testq %r13, %r13
je 0x18fb8
movl 0x424(%r13), %eax
leaq 0x22b03(%rip), %rcx     # 0x3b58c
movl (%rcx), %ebx
cmpl %ebx, %eax
jbe 0x18c43
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, 0x18(%rsp)
movl %ebx, 0x424(%r13)
leaq 0x229c5(%rip), %rax     # 0x3b488
cmpb $0x1, (%rax)
jne 0x18bef
leaq 0x229b6(%rip), %rax     # 0x3b489
cmpb $0x0, (%rax)
jne 0x18bef
movq %r15, %rbx
movq 0x224ea(%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 0x18b1d
movq %r15, %rdi
movl $0x20, %esi
callq 0x42d0
movb $0x1, 0xe1(%r15)
movb $0x20, 0xe0(%r15)
movq 0x20(%rbp), %rsi
movq 0x28(%rbp), %rdx
movq 0x2249c(%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 0x18b74
movq %r13, %rdi
movl $0x20, %esi
callq 0x42d0
movb $0x1, 0xe1(%r13)
movb $0x20, 0xe0(%r13)
movq (%r14), %rax
movq (%rax,%rbx,8), %rsi
movq %r15, %rdi
callq 0x28270
movq %rax, %r15
movl $0x1d, %edx
movq %rax, %rdi
leaq 0x19298(%rip), %rsi     # 0x31e35
callq 0x4340
movq %r15, %rdi
movl 0x18(%rsp), %esi
callq 0x4500
movq %rax, %r15
movl $0x22, %edx
movq %rax, %rdi
leaq 0x19293(%rip), %rsi     # 0x31e53
callq 0x4340
movq (%r15), %rax
movq -0x18(%rax), %rdi
addq %r15, %rdi
movl $0xa, %esi
callq 0x42d0
movsbl %al, %esi
movq %r15, %rdi
movq %rbx, %r15
callq 0x4040
movq %rax, %rdi
callq 0x41f0
movq (%r14), %rax
movq (%rax,%r15,8), %rcx
movq %rcx, 0x10(%rsp)
movl 0x430(%rcx), %ecx
testq %rcx, %rcx
je 0x18e80
leaq (%rax,%r15,8), %r13
leaq (,%rcx,8), %rbx
addq %r13, %rbx
movq 0x1d8(%rbp), %rdx
subq %rbx, %rdx
je 0x18e39
movq %r13, %rdi
movq %rbx, %rsi
callq 0x4480
movq 0x1d8(%rbp), %rax
movq %rax, %rcx
jmp 0x18e3f
movq %r15, 0x28(%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 0x22903(%rip), %rax     # 0x3b57c
movl (%rax), %eax
decl %eax
andl %eax, %r15d
movq 0x208(%rbp), %rax
movq (%rax,%r15,8), %rdi
movq %r13, %rsi
callq 0x1a12a
testb %al, %al
je 0x18fb8
leaq 0x227e6(%rip), %rax     # 0x3b488
cmpb $0x1, (%rax)
jne 0x18dec
leaq 0x227d7(%rip), %rax     # 0x3b489
cmpb $0x0, (%rax)
jne 0x18dec
movq 0x2230e(%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 0x18cf9
movq %r13, %rdi
movl $0x20, %esi
callq 0x42d0
movb $0x1, 0xe1(%r13)
movb $0x20, 0xe0(%r13)
movq 0x20(%rbp), %rsi
movq 0x28(%rbp), %rdx
movq 0x222c0(%rip), %rdi     # 0x3afd0
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 0x18d4f
movq %rbx, %rdi
movl $0x20, %esi
callq 0x42d0
movb $0x1, 0xe1(%rbx)
movb $0x20, 0xe0(%rbx)
movq (%r14), %rax
movq 0x28(%rsp), %rcx
movq (%rax,%rcx,8), %rsi
movq %r13, %rdi
callq 0x28270
movq %rax, %r13
movl $0x29, %edx
movq %rax, %rdi
leaq 0x190fa(%rip), %rsi     # 0x31e76
callq 0x4340
movq %r13, %rdi
movq %r15, %rsi
callq 0x41e0
movq %rax, %r13
movl $0x5, %edx
movq %rax, %rdi
leaq 0x1ae1c(%rip), %rsi     # 0x33bba
callq 0x4340
movq %r13, %rdi
movq %r15, %rsi
callq 0x41e0
movq %rax, %r15
movl $0x1, %edx
movq %rax, %rdi
leaq 0x1a721(%rip), %rsi     # 0x334e1
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 0x28(%rsp), %rdx
movq (%rax,%rdx,8), %rcx
movl 0x430(%rcx), %ecx
testq %rcx, %rcx
je 0x18fb5
leaq (%rax,%rdx,8), %r15
leaq (%r15,%rcx,8), %r13
movq 0x1d8(%rbp), %rdx
subq %r13, %rdx
je 0x18f9d
movq %r15, %rdi
movq %r13, %rsi
callq 0x4480
movq 0x1d8(%rbp), %rax
movq %rax, %rcx
jmp 0x18fa3
movq %rbx, %rax
movq %rbx, %rcx
subq %rbx, %rax
addq %rax, %r13
cmpq %r13, %rcx
je 0x18e51
movq %r13, 0x1d8(%rbp)
movq 0x10(%rsp), %rax
cmpl $0x2, 0x430(%rax)
jb 0x18e80
leaq 0x22726(%rip), %rax     # 0x3b58c
movl (%rax), %eax
leal 0xf(%rax), %ecx
testl %eax, %eax
cmovnsl %eax, %ecx
sarl $0x4, %ecx
incl %ecx
movq 0x10(%rsp), %rax
movl %ecx, 0x430(%rax)
cmpl $0x0, 0x18(%rsp)
jle 0x18f90
xorl %ebx, %ebx
movl $0x468, %edi            # imm = 0x468
callq 0x42f0
movq %rax, %r13
movq %rax, %rdi
movq 0x10(%rsp), %rsi
callq 0x27f1e
movq %r13, 0x20(%rsp)
leaq 0x226d9(%rip), %rax     # 0x3b58c
movslq (%rax), %rax
movslq %ebx, %rcx
imulq %rcx, %rax
addq %rax, 0x450(%r13)
testl %ecx, %ecx
je 0x18ed0
movq $0x0, 0x8(%r13)
movl %r12d, 0x28(%rsp)
movslq %r12d, %r13
leaq (,%r13,8), %rsi
addq (%r14), %rsi
movq %r14, %rdi
leaq 0x20(%rsp), %rdx
callq 0x1a0a8
movq 0x20(%rsp), %rdx
movl 0x430(%rdx), %r15d
cmpl $0x2, %r15d
leaq 0x38(%rsp), %r12
jb 0x18f3e
movl $0x1, %ebp
movq (%r14), %rax
leaq (%rax,%r13,8), %rsi
addq $0x8, %rsi
movq $0x0, 0x38(%rsp)
movq %r14, %rdi
movq %r12, %rdx
callq 0x1a582
incl %ebp
movq 0x20(%rsp), %rdx
movl 0x430(%rdx), %r15d
cmpl %r15d, %ebp
jb 0x18f0c
movb $0x1, 0x422(%rdx)
addq $0x42c, %rdx            # imm = 0x42C
movq 0x8(%rsp), %rbp
movq 0x248(%rbp), %rsi
cmpq 0x250(%rbp), %rsi
je 0x18f72
movl (%rdx), %eax
movl %eax, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x248(%rbp)
jmp 0x18f7c
movq 0x30(%rsp), %rdi
callq 0x13de0
movl 0x28(%rsp), %r12d
addl %r15d, %r12d
incl %ebx
cmpl 0x18(%rsp), %ebx
jne 0x18e8d
movq 0x10(%rsp), %rdi
movq (%rdi), %rax
callq *0x8(%rax)
jmp 0x18fb8
movq %r13, %rax
movq %r13, %rcx
subq %r13, %rax
addq %rax, %r15
cmpq %r15, %rcx
je 0x18fb5
movq %r15, 0x1d8(%rbp)
decl %r12d
incl %r12d
movslq %r12d, %r15
movq 0x1d0(%rbp), %rax
movq 0x1d8(%rbp), %rcx
subq %rax, %rcx
sarq $0x3, %rcx
cmpq %r15, %rcx
ja 0x18a6e
movq 0x1e8(%rbp), %rax
cmpq %rax, 0x1f0(%rbp)
je 0x197f2
leaq 0x1e8(%rbp), %r12
leaq 0x238(%rbp), %rcx
movq %rcx, 0x28(%rsp)
leaq 0x220(%rbp), %r13
leaq 0x20(%rbp), %rcx
movq %rcx, 0x40(%rsp)
leaq 0x258(%rbp), %rcx
movq %rcx, 0x30(%rsp)
xorl %r15d, %r15d
xorl %r14d, %r14d
movq %r12, 0x10(%rsp)
movq (%rax,%r15,8), %rdi
testq %rdi, %rdi
je 0x197ce
cmpb $0x0, 0x422(%rdi)
je 0x1908d
movq 0x240(%rbp), %rax
movq 0x248(%rbp), %rcx
movq %rcx, %rdx
subq %rax, %rdx
je 0x1981b
movq %rdx, %rsi
sarq $0x2, %rsi
movl 0x42c(%rdi), %edi
cmpq $0x1, %rsi
adcq $0x0, %rsi
movl $0x4, %r8d
xorl %ebx, %ebx
cmpl (%rax,%rbx,4), %edi
je 0x190f7
incq %rbx
addq $0x4, %r8
cmpq %rbx, %rsi
jne 0x19077
jmp 0x1981b
leaq 0x22414(%rip), %rax     # 0x3b4a8
cmpl $0x0, (%rax)
jle 0x197ce
movslq %r14d, %rbp
xorl %ebx, %ebx
movq 0x28(%rsp), %rdi
movq %r13, %rsi
callq 0x25b4e
cmpl $-0x1, %eax
je 0x190e5
movl %eax, %r15d
cltq
movq (%r13), %rcx
movq (%rcx,%rax,8), %rdi
movl 0x200(%rdi), %eax
cmpl $0xb, %eax
je 0x190d0
testl %eax, %eax
jne 0x190e5
movq (%r12), %rax
movq (%rax,%rbp,8), %rsi
callq 0x1a222
testb %al, %al
jne 0x194ce
incl %ebx
leaq 0x223ba(%rip), %rax     # 0x3b4a8
cmpl (%rax), %ebx
jl 0x190a2
jmp 0x197c9
leaq (%rax,%r8), %rsi
cmpq %rcx, %rsi
je 0x19122
leaq (%rax,%rbx,4), %rdi
leaq (%rax,%rbx,4), %rsi
addq $0x4, %rsi
subq %r8, %rdx
callq 0x4480
movq 0x240(%rbp), %rax
movq 0x248(%rbp), %rcx
addq $-0x4, %rcx
movq %rcx, 0x248(%rbp)
subq %rax, %rcx
sarq $0x2, %rcx
movl %ebx, %edx
cmpq %rdx, %rcx
jbe 0x19156
movq (%r12), %rdx
movq (%rdx,%r15,8), %rdx
movl 0x42c(%rdx), %edx
cmpl (%rax,%rbx,4), %edx
je 0x19179
incq %rbx
cmpq %rbx, %rcx
ja 0x19149
leaq 0x2232b(%rip), %rax     # 0x3b488
cmpb $0x1, (%rax)
jne 0x19172
leaq 0x22320(%rip), %rax     # 0x3b489
cmpb $0x0, (%rax)
je 0x19266
xorl %ebx, %ebx
jmp 0x19359
movb $0x1, %bl
leaq 0x22306(%rip), %rax     # 0x3b488
cmpb $0x1, (%rax)
jne 0x19359
leaq 0x222f7(%rip), %rax     # 0x3b489
cmpb $0x0, (%rax)
jne 0x19359
movq 0x21e2e(%rip), %rdx     # 0x3afd0
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 0x191d8
movq %rbp, %rdi
movl $0x20, %esi
callq 0x42d0
movb $0x1, 0xe1(%rbp)
movb $0x20, 0xe0(%rbp)
movq 0x8(%rsp), %rax
movq 0x20(%rax), %rsi
movq 0x28(%rax), %rdx
movq 0x21ddd(%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), %rbx
cmpb $0x0, 0xe1(%rbp,%rax)
jne 0x19231
movq %rbx, %rdi
movl $0x20, %esi
callq 0x42d0
movb $0x1, 0xe1(%rbx)
movb $0x20, 0xe0(%rbx)
movq (%r12), %rax
movq (%rax,%r15,8), %rsi
movq %rbp, %rdi
callq 0x28270
movq %rax, %rbp
movl $0x2e, %edx
movq %rax, %rdi
leaq 0x18c46(%rip), %rsi     # 0x31ea0
callq 0x4340
movb $0x1, %bl
jmp 0x1932c
movq 0x21d63(%rip), %rdx     # 0x3afd0
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 0x192a3
movq %rbp, %rdi
movl $0x20, %esi
callq 0x42d0
movb $0x1, 0xe1(%rbp)
movb $0x20, 0xe0(%rbp)
movq 0x8(%rsp), %rax
movq 0x20(%rax), %rsi
movq 0x28(%rax), %rdx
movq 0x21d12(%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), %rbx
cmpb $0x0, 0xe1(%rbp,%rax)
jne 0x192fc
movq %rbx, %rdi
movl $0x20, %esi
callq 0x42d0
movb $0x1, 0xe1(%rbx)
movb $0x20, 0xe0(%rbx)
movq (%r12), %rax
movq (%rax,%r15,8), %rsi
movq %rbp, %rdi
callq 0x28270
movq %rax, %rbp
movl $0x28, %edx
movq %rax, %rdi
leaq 0x18baa(%rip), %rsi     # 0x31ecf
callq 0x4340
xorl %ebx, %ebx
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 0x8(%rsp), %rbp
movq 0x260(%rbp), %rsi
movq 0x1e8(%rbp), %rax
movq 0x258(%rbp), %rcx
movq %rsi, %rdx
subq %rcx, %rdx
je 0x193aa
sarq $0x3, %rdx
movq (%rax,%r15,8), %rdi
movl 0x42c(%rdi), %r9d
cmpq $0x1, %rdx
adcq $0x0, %rdx
movl $0x8, %r12d
movq -0x8(%rcx,%r12), %r8
cmpl 0x42c(%r8), %r9d
je 0x193d1
addq $0x8, %r12
decq %rdx
jne 0x19393
movslq %r14d, %rbx
leaq (%rax,%rbx,8), %rdx
cmpq 0x268(%rbp), %rsi
je 0x19473
movq (%rdx), %rax
movq %rax, (%rsi)
addq $0x8, 0x260(%rbp)
jmp 0x1947d
cmpl $0x2, 0x430(%rdi)
jb 0x193f5
leaq 0x221ab(%rip), %rdx     # 0x3b58c
movl (%rdx), %edx
leal 0xf(%rdx), %esi
testl %edx, %edx
cmovnsl %edx, %esi
sarl $0x4, %esi
addl %esi, 0x430(%r8)
movl %ebx, 0x18(%rsp)
movq 0x8(%rdi), %rdx
testq %rdx, %rdx
je 0x1941d
movq %rdx, 0x8(%r8)
movq (%rax,%r15,8), %rdi
movq 0x450(%rdi), %rax
movq -0x8(%rcx,%r12), %rcx
movq %rax, 0x450(%rcx)
movslq 0x430(%rdi), %rbx
movq (%rdi), %rax
callq *0x8(%rax)
testq %rbx, %rbx
je 0x196b9
shlq $0x3, %r15
movq 0x10(%rsp), %rax
addq (%rax), %r15
movq %rbp, %rax
leaq (%r15,%rbx,8), %rbp
movq 0x1f0(%rax), %rdx
subq %rbp, %rdx
je 0x1969c
movq %rax, %rbx
movq %r15, %rdi
movq %rbp, %rsi
callq 0x4480
movq 0x1f0(%rbx), %rax
movq %rax, %rcx
jmp 0x196a2
movq 0x30(%rsp), %rdi
callq 0x1a462
movq 0x10(%rsp), %r12
movq (%r12), %rax
movq (%rax,%rbx,8), %rcx
movl 0x430(%rcx), %ecx
testq %rcx, %rcx
je 0x19694
leaq (%rax,%rbx,8), %r15
movq %rbp, %rbx
leaq (%r15,%rcx,8), %rbp
movq 0x1f0(%rbx), %rdx
subq %rbp, %rdx
je 0x19677
movq %r15, %rdi
movq %rbp, %rsi
callq 0x4480
movq 0x1f0(%rbx), %rax
movq %rax, %rcx
jmp 0x1967d
leaq 0x21fb3(%rip), %rax     # 0x3b488
cmpb $0x1, (%rax)
jne 0x19629
leaq 0x21fa4(%rip), %rax     # 0x3b489
cmpb $0x0, (%rax)
jne 0x19629
movq 0x21adb(%rip), %rdx     # 0x3afd0
movq (%rdx), %rax
movq -0x18(%rax), %rcx
movq $0x12, 0x10(%rdx,%rcx)
movq -0x18(%rax), %rax
leaq (%rdx,%rax), %rbx
cmpb $0x0, 0xe1(%rdx,%rax)
jne 0x1952b
movq %rbx, %rdi
movl $0x20, %esi
callq 0x42d0
movb $0x1, 0xe1(%rbx)
movb $0x20, 0xe0(%rbx)
movq 0x8(%rsp), %rax
movq 0x20(%rax), %rsi
movq 0x28(%rax), %rdx
movq 0x21a8a(%rip), %rdi     # 0x3afd0
callq 0x4340
movq %rax, %rbx
movq (%rax), %rax
movq -0x18(%rax), %rcx
movq $0xf, 0x10(%rbx,%rcx)
movq -0x18(%rax), %rax
leaq (%rbx,%rax), %rcx
cmpb $0x0, 0xe1(%rbx,%rax)
jne 0x19590
movq %rcx, 0x18(%rsp)
movq 0x18(%rsp), %rdi
movl $0x20, %esi
callq 0x42d0
movq 0x18(%rsp), %rcx
movb $0x1, 0xe1(%rcx)
movb $0x20, 0xe0(%rcx)
movq (%r12), %rax
movq (%rax,%rbp,8), %rsi
movq %rbx, %rdi
callq 0x28270
movq %rax, %rbx
movl $0x24, %edx
movq %rax, %rdi
leaq 0x18997(%rip), %rsi     # 0x31f50
callq 0x4340
movq %rbx, %rdi
movl %r15d, %esi
callq 0x4500
movq %rax, %rbx
movl $0x6, %edx
movq %rax, %rdi
leaq 0x1899a(%rip), %rsi     # 0x31f75
callq 0x4340
movq %rbx, %rdi
movl %r15d, %esi
callq 0x4500
movq %rax, %r15
movl $0x1, %edx
movq %rax, %rdi
leaq 0x19ee4(%rip), %rsi     # 0x334e1
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 (%r12), %rax
movq (%rax,%rbp,8), %rcx
movl 0x430(%rcx), %ecx
testq %rcx, %rcx
je 0x197c6
leaq (%rax,%rbp,8), %r15
leaq (%r15,%rcx,8), %rbp
movq 0x8(%rsp), %rbx
movq 0x1f0(%rbx), %rdx
subq %rbp, %rdx
je 0x197a9
movq %r15, %rdi
movq %rbp, %rsi
callq 0x4480
movq 0x1f0(%rbx), %rax
movq %rax, %rcx
jmp 0x197af
movq %rbp, %rax
movq %rbp, %rcx
subq %rbp, %rax
addq %rax, %r15
cmpq %r15, %rcx
movq 0x8(%rsp), %rbp
je 0x19694
movq %r15, 0x1f0(%rbp)
decl %r14d
jmp 0x197ce
movq %rbp, %rax
movq %rbp, %rcx
subq %rbp, %rax
addq %rax, %r15
cmpq %r15, %rcx
movq 0x8(%rsp), %rbp
je 0x196b9
movq %r15, 0x1f0(%rbp)
cmpb $0x0, 0x18(%rsp)
je 0x196cd
decl %r14d
movq 0x10(%rsp), %r12
jmp 0x197ce
movl $0x468, %edi            # imm = 0x468
callq 0x42f0
movq %rax, %r15
movq 0x30(%rsp), %rbx
movq (%rbx), %rax
movq -0x8(%rax,%r12), %rsi
movq %r15, %rdi
callq 0x27f1e
movq %r15, 0x20(%rsp)
movq (%rbx), %rax
movq -0x8(%rax,%r12), %rdi
testq %rdi, %rdi
je 0x1970a
movq (%rdi), %rax
callq *0x8(%rax)
movq (%rbx), %rax
leaq (%rax,%r12), %rsi
movq 0x260(%rbp), %rdx
cmpq %rdx, %rsi
leaq 0x38(%rsp), %r15
je 0x19739
leaq (%rax,%r12), %rdi
addq $-0x8, %rdi
subq %rax, %rdx
subq %r12, %rdx
callq 0x4480
movq 0x260(%rbp), %rdx
addq $-0x8, %rdx
movq %rdx, 0x260(%rbp)
movq 0x20(%rsp), %rax
movb $0x0, 0x422(%rax)
movq 0x1e8(%rbp), %rsi
movq 0x10(%rsp), %r12
movq %r12, %rdi
leaq 0x20(%rsp), %rdx
callq 0x1a0a8
movq 0x20(%rsp), %rax
cmpl $0x2, 0x430(%rax)
jb 0x197ce
movl $0x1, %ebx
movq (%r12), %rsi
addq $0x8, %rsi
movq $0x0, 0x38(%rsp)
movq %r12, %rdi
movq %r15, %rdx
callq 0x1a582
incl %ebx
movq 0x20(%rsp), %rax
cmpl 0x430(%rax), %ebx
jb 0x1977c
jmp 0x197ce
movq %rbp, %rax
movq %rbp, %rcx
subq %rbp, %rax
addq %rax, %r15
cmpq %r15, %rcx
je 0x197c6
movq 0x8(%rsp), %rax
movq %r15, 0x1f0(%rax)
decl %r14d
movq 0x8(%rsp), %rbp
incl %r14d
movslq %r14d, %r15
movq 0x1e8(%rbp), %rax
movq 0x1f0(%rbp), %rcx
subq %rax, %rcx
sarq $0x3, %rcx
cmpq %r15, %rcx
ja 0x1902a
incq 0x8(%rbp)
movl 0x200(%rbp), %eax
leal -0x1(%rax), %ecx
xorl %edx, %edx
testl %eax, %eax
cmovgl %ecx, %edx
movl %edx, 0x200(%rbp)
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x217ce(%rip), %rdi     # 0x3aff0
leaq 0x167f9(%rip), %rsi     # 0x30022
callq 0x42e0
leaq 0x186c3(%rip), %rsi     # 0x31ef8
movq %rax, %rdi
callq 0x42e0
leaq 0x17053(%rip), %rsi     # 0x30897
movq %rax, %rdi
callq 0x42e0
movq %rax, %rdi
movl $0x85, %esi
callq 0x4500
leaq 0x167e1(%rip), %rsi     # 0x30041
movq %rax, %rdi
callq 0x42e0
movq %rax, %rdi
movq 0x40(%rsp), %rsi
callq 0x4290
leaq 0x18697(%rip), %rsi     # 0x31f13
movq %rax, %rdi
callq 0x42e0
movq (%r12), %rcx
movq (%rcx,%r15,8), %rsi
movq %rax, %rdi
callq 0x28270
leaq 0x18257(%rip), %rsi     # 0x31af2
movq %rax, %rdi
callq 0x42e0
movq %rax, %rdi
callq 0x4170
xorl %edi, %edi
callq 0x4360
movq %rax, %rbx
movl $0x468, %esi            # imm = 0x468
movq %r15, %rdi
jmp 0x198ca
movq %rax, %rbx
movl $0x468, %esi            # imm = 0x468
movq %r13, %rdi
callq 0x4300
movq %rbx, %rdi
callq 0x4540
nop