// File: estwings57[P]CasHMC/sources/VaultController.cpp
// Function: CasHMC::VaultController::Update()
void VaultController::Update()
{
	//Update DRAM state and various countdown
	UpdateCountdown();

	//Convert request packet into DRAM commands
	if(bufPopDelay == 0) {
		for(int i=0; i<downBuffers.size(); i++) {
			//Make sure that buffer[0] is not virtual tail packet.
			if(downBuffers[i] != NULL) {
				if(ConvPacketIntoCMDs(downBuffers[i])) {
					int tempLNG = downBuffers[i]->LNG;
					delete downBuffers[i];
					downBuffers.erase(downBuffers.begin()+i, downBuffers.begin()+i+tempLNG);
				}
			}
		}
	}
	
	//Send response packet to crossbar switch
	if(upBuffers.size() > 0) {
		//Make sure that buffer[0] is not virtual tail packet.
		if(upBuffers[0] == NULL) {
			ERROR(header<<"  == Error - Vault controller up buffer[0] is NULL (It could be one of virtual tail packet occupying packet length  (CurrentClock : "<<currentClockCycle<<")");
			exit(0);
		}
		else{
			if(upBufferDest->ReceiveUp(upBuffers[0])) {
				DEBUG(ALI(18)<<header<<ALI(15)<<*upBuffers[0]<<"Up)   SENDING packet to crossbar switch (CS)");
				upBuffers.erase(upBuffers.begin(), upBuffers.begin()+upBuffers[0]->LNG);
			}
			else {
				//DEBUG(ALI(18)<<header<<ALI(15)<<*upBuffers[0]<<"Up)   Crossbar switch buffer FULL");	
			}
		}
	}
	
	//Pop command from command queue
	if(commandQueue->CmdPop(&poppedCMD)) {
		//Write data command will be issued after countdown
		if(poppedCMD->commandType == WRITE || poppedCMD->commandType == WRITE_P) {
			DRAMCommand *writeData = new DRAMCommand(*poppedCMD);
			writeData->commandType = WRITE_DATA;
			writeDataToSend.push_back(writeData);
			writeDataCountdown.push_back(WL);
		}
		
		if(poppedCMD->lastCMD == true) {
			if(!poppedCMD->posted) {
				if(poppedCMD->commandType == WRITE || poppedCMD->commandType == WRITE_P) {
					if(!poppedCMD->atomic) {
						pendingDataSize += 1;
						//DEBUG(ALI(18)<<header<<ALI(15)<<*poppedCMD<<"Down) pendingDataSize 1 increased   (current pendingDataSize : "<<pendingDataSize<<")");
					}
				}
				else if(poppedCMD->commandType == READ || poppedCMD->commandType == READ_P) {
					if(!poppedCMD->atomic) {
						pendingDataSize += (poppedCMD->dataSize/16)+1;
						//DEBUG(ALI(18)<<header<<ALI(15)<<*poppedCMD<<"Down) pendingDataSize "<<(poppedCMD->dataSize/16)+1<<" increased   (current pendingDataSize : "<<pendingDataSize<<")");
					}
					else {
						if(poppedCMD->packetCMD == _2ADD8 || poppedCMD->packetCMD == ADD16 || poppedCMD->packetCMD == INC8
						|| poppedCMD->packetCMD == EQ8 || poppedCMD->packetCMD == EQ16 || poppedCMD->packetCMD == BWR) {
							pendingDataSize += 1;
						}
						else {
							pendingDataSize += 2;
						}
					}
				}
			}
		}
		
		//Check for collision on bus
		if(cmdBus != NULL) {
			ERROR(header<<"  == Error - Command bus collision  (cmdBus:"<<*cmdBus<<", poppedCMD:"<<*poppedCMD<<")  (CurrentClock : "<<currentClockCycle<<")");
			exit(0);
		}
		cmdBus = poppedCMD;
		cmdCyclesLeft = tCMD;
		poppedCMD = NULL;
	}
	
	//Atomic command operation (assume that all operations consume one clock cycle)
	if(atomicCMD != NULL) {
		if(atomicOperLeft == 0) {
			//The results are written back to DRAM, overwriting the original memory operands
			if(atomicCMD->packetCMD != EQ16 && atomicCMD->packetCMD != EQ8) {
				DRAMCommand *atmRstCMD = new DRAMCommand(*atomicCMD);
				atmRstCMD->commandType = (OPEN_PAGE ? WRITE : WRITE_P);
				atmRstCMD->dataSize = 16;
				atmRstCMD->lastCMD = true;
				if(!atmRstCMD->posted) {
					atmRstCMD->trace = NULL;
				}
				if(QUE_PER_BANK) {
					commandQueue->queue[atomicCMD->bank].insert(commandQueue->queue[atomicCMD->bank].begin(), atmRstCMD);
					classID.str( string() );	classID.clear();
					classID << atomicCMD->bank;
					DE_CR(ALI(18)<<(commandQueue->header+"-"+classID.str()+")")<<ALI(15)<<*atmRstCMD<<"Down) PUSHING atomic result command into command queue");
				}
				else {
					commandQueue->queue[0].insert(commandQueue->queue[0].begin(), atmRstCMD);
					DE_CR(ALI(18)<<(commandQueue->header+")")<<ALI(15)<<*atmRstCMD<<"Down) PUSHING atomic result command into command queue");
				}
			}
			
			if(!atomicCMD->posted) {
				MakeRespondPacket(atomicCMD);
			}
			delete atomicCMD;
			atomicCMD = NULL;
		}
		else {
			DEBUG(ALI(18)<<(commandQueue->header+")")<<ALI(15)<<*atomicCMD<<"Down) Atomic command is now operating ["<<atomicOperLeft<<" clk]");
			atomicOperLeft--;
		}
	}

	//Power-down mode setting
	EnablePowerdown();

	commandQueue->Update();
	Step();
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x370, %rsp            # imm = 0x370
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rdi
movq %rdi, -0x1f8(%rbp)
callq 0x4e110
movq -0x1f8(%rbp), %rax
cmpl $0x0, 0x200(%rax)
jne 0x4d089
movl $0x0, -0xc(%rbp)
movq -0x1f8(%rbp), %rdi
movslq -0xc(%rbp), %rax
movq %rax, -0x200(%rbp)
addq $0x1d0, %rdi            # imm = 0x1D0
callq 0x22d60
movq %rax, %rcx
movq -0x200(%rbp), %rax
cmpq %rcx, %rax
jae 0x4d087
movq -0x1f8(%rbp), %rdi
addq $0x1d0, %rdi            # imm = 0x1D0
movslq -0xc(%rbp), %rsi
callq 0x29940
cmpq $0x0, (%rax)
je 0x4d077
movq -0x1f8(%rbp), %rdi
addq $0x1d0, %rdi            # imm = 0x1D0
movslq -0xc(%rbp), %rsi
callq 0x29940
movq -0x1f8(%rbp), %rdi
movq (%rax), %rsi
callq 0x4e8d0
testb $0x1, %al
jne 0x4cf7b
jmp 0x4d075
movq -0x1f8(%rbp), %rdi
addq $0x1d0, %rdi            # imm = 0x1D0
movslq -0xc(%rbp), %rsi
callq 0x29940
movq -0x1f8(%rbp), %rdi
movq (%rax), %rax
movl 0x430(%rax), %eax
movl %eax, -0x10(%rbp)
addq $0x1d0, %rdi            # imm = 0x1D0
movslq -0xc(%rbp), %rsi
callq 0x29940
movq (%rax), %rax
movq %rax, -0x208(%rbp)
cmpq $0x0, %rax
je 0x4cfd2
movq -0x208(%rbp), %rdi
movq (%rdi), %rax
callq *0x8(%rax)
movq -0x1f8(%rbp), %rdi
movq %rdi, %rax
addq $0x1d0, %rax            # imm = 0x1D0
movq %rax, -0x210(%rbp)
addq $0x1d0, %rdi            # imm = 0x1D0
callq 0x299f0
movq %rax, -0x28(%rbp)
movslq -0xc(%rbp), %rsi
leaq -0x28(%rbp), %rdi
callq 0x29a20
movq %rax, -0x20(%rbp)
leaq -0x18(%rbp), %rdi
leaq -0x20(%rbp), %rsi
callq 0x29a60
movq -0x1f8(%rbp), %rdi
addq $0x1d0, %rdi            # imm = 0x1D0
callq 0x299f0
movq %rax, -0x48(%rbp)
movslq -0xc(%rbp), %rsi
leaq -0x48(%rbp), %rdi
callq 0x29a20
movq %rax, -0x40(%rbp)
movslq -0x10(%rbp), %rsi
leaq -0x40(%rbp), %rdi
callq 0x29a20
movq %rax, -0x38(%rbp)
leaq -0x30(%rbp), %rdi
leaq -0x38(%rbp), %rsi
callq 0x29a60
movq -0x210(%rbp), %rdi
movq -0x18(%rbp), %rsi
movq -0x30(%rbp), %rdx
callq 0x29960
movq %rax, -0x50(%rbp)
jmp 0x4d077
jmp 0x4d079
movl -0xc(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xc(%rbp)
jmp 0x4cefa
jmp 0x4d089
movq -0x1f8(%rbp), %rdi
addq $0x1e8, %rdi            # imm = 0x1E8
callq 0x22d60
cmpq $0x0, %rax
jbe 0x4d360
movq -0x1f8(%rbp), %rdi
addq $0x1e8, %rdi            # imm = 0x1E8
xorl %eax, %eax
movl %eax, %esi
callq 0x29940
cmpq $0x0, (%rax)
jne 0x4d16e
movq 0x18f22(%rip), %rdi     # 0x65ff0
leaq 0x3f65(%rip), %rsi      # 0x5103a
callq 0x4380
movq %rax, %rdi
leaq 0x79cc(%rip), %rsi      # 0x54ab0
callq 0x4380
movq %rax, %rdi
leaq 0x4742(%rip), %rsi      # 0x51835
callq 0x4380
movq %rax, %rdi
movl $0xbd, %esi
callq 0x4610
movq %rax, %rdi
leaq 0x3f4a(%rip), %rsi      # 0x51059
callq 0x4380
movq -0x1f8(%rbp), %rsi
movq %rax, %rdi
addq $0x20, %rsi
callq 0x4320
movq %rax, %rdi
leaq 0x7b14(%rip), %rsi      # 0x54c45
callq 0x4380
movq %rax, %rdi
movq -0x1f8(%rbp), %rax
movq 0x8(%rax), %rsi
callq 0x40f0
movq %rax, %rdi
leaq 0x7226(%rip), %rsi      # 0x54379
callq 0x4380
movq %rax, %rdi
movq 0x18e4e(%rip), %rsi     # 0x65fb0
callq 0x43c0
xorl %edi, %edi
callq 0x4460
movq -0x1f8(%rbp), %rdi
movq 0x250(%rdi), %rax
movq %rax, -0x218(%rbp)
addq $0x1e8, %rdi            # imm = 0x1E8
xorl %eax, %eax
movl %eax, %esi
callq 0x29940
movq -0x218(%rbp), %rdi
movq (%rax), %rsi
callq 0x4fc50
testb $0x1, %al
jne 0x4d1ab
jmp 0x4d35a
leaq 0x19376(%rip), %rax     # 0x66528
testb $0x1, (%rax)
je 0x4d2b0
leaq 0x19367(%rip), %rax     # 0x66529
testb $0x1, (%rax)
jne 0x4d2b0
movl $0x12, %edi
callq 0x177b0
movl %eax, -0x54(%rbp)
movl -0x54(%rbp), %esi
movq 0x18dee(%rip), %rdi     # 0x65fd0
callq 0x4440
movq %rax, -0x238(%rbp)
movl $0x20, %edi
callq 0x177d0
movq -0x238(%rbp), %rdi
movb %al, -0x55(%rbp)
movzbl -0x55(%rbp), %esi
callq 0x4550
movq -0x1f8(%rbp), %rsi
movq %rax, %rdi
addq $0x20, %rsi
callq 0x4320
movq %rax, -0x230(%rbp)
movl $0xf, %edi
callq 0x177b0
movq -0x230(%rbp), %rdi
movl %eax, -0x5c(%rbp)
movl -0x5c(%rbp), %esi
callq 0x4440
movq %rax, -0x228(%rbp)
movl $0x20, %edi
callq 0x177d0
movq -0x228(%rbp), %rdi
movb %al, -0x5d(%rbp)
movzbl -0x5d(%rbp), %esi
callq 0x4550
movq -0x1f8(%rbp), %rdi
movq %rax, -0x220(%rbp)
addq $0x1e8, %rdi            # imm = 0x1E8
xorl %eax, %eax
movl %eax, %esi
callq 0x29940
movq -0x220(%rbp), %rdi
movq (%rax), %rsi
callq 0x44960
movq %rax, %rdi
leaq 0x7a2e(%rip), %rsi      # 0x54cca
callq 0x4380
movq %rax, %rdi
movq 0x18d05(%rip), %rsi     # 0x65fb0
callq 0x43c0
movq -0x1f8(%rbp), %rdi
movq %rdi, %rax
addq $0x1e8, %rax            # imm = 0x1E8
movq %rax, -0x240(%rbp)
addq $0x1e8, %rdi            # imm = 0x1E8
callq 0x299f0
movq %rax, -0x70(%rbp)
leaq -0x68(%rbp), %rdi
leaq -0x70(%rbp), %rsi
callq 0x29a60
movq -0x1f8(%rbp), %rdi
addq $0x1e8, %rdi            # imm = 0x1E8
callq 0x299f0
movq -0x1f8(%rbp), %rdi
movq %rax, -0x88(%rbp)
addq $0x1e8, %rdi            # imm = 0x1E8
xorl %eax, %eax
movl %eax, %esi
callq 0x29940
movq (%rax), %rax
movl 0x430(%rax), %eax
movl %eax, %esi
leaq -0x88(%rbp), %rdi
callq 0x29a20
movq %rax, -0x80(%rbp)
leaq -0x78(%rbp), %rdi
leaq -0x80(%rbp), %rsi
callq 0x29a60
movq -0x240(%rbp), %rdi
movq -0x68(%rbp), %rsi
movq -0x78(%rbp), %rdx
callq 0x29960
movq %rax, -0x90(%rbp)
jmp 0x4d35c
jmp 0x4d35c
jmp 0x4d35e
jmp 0x4d360
movq -0x1f8(%rbp), %rsi
movq 0x218(%rsi), %rdi
addq $0x220, %rsi            # imm = 0x220
callq 0x1d610
testb $0x1, %al
jne 0x4d383
jmp 0x4d748
movq -0x1f8(%rbp), %rax
movq 0x220(%rax), %rax
cmpl $0x3, 0x10(%rax)
je 0x4d3af
movq -0x1f8(%rbp), %rax
movq 0x220(%rax), %rax
cmpl $0x4, 0x10(%rax)
jne 0x4d46d
movl $0x38, %edi
callq 0x4390
movq %rax, %rdi
movq -0x1f8(%rbp), %rax
movq %rdi, %rcx
movq %rcx, -0x248(%rbp)
movq 0x220(%rax), %rsi
callq 0x30e60
jmp 0x4d3db
movq -0x1f8(%rbp), %rdi
movq -0x248(%rbp), %rax
movq %rax, -0x98(%rbp)
movq -0x98(%rbp), %rax
movl $0x6, 0x10(%rax)
addq $0x278, %rdi            # imm = 0x278
leaq -0x98(%rbp), %rsi
callq 0x229c0
movq -0x1f8(%rbp), %rdi
addq $0x290, %rdi            # imm = 0x290
leaq 0x1922a(%rip), %rax     # 0x66650
movl (%rax), %eax
leaq 0x19219(%rip), %rcx     # 0x66648
addl (%rcx), %eax
movl %eax, -0xa8(%rbp)
leaq -0xa8(%rbp), %rsi
callq 0x18ef0
jmp 0x4d46d
movq -0x248(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xa0(%rbp)
movl %eax, -0xa4(%rbp)
movl $0x38, %esi
callq 0x43a0
jmp 0x4e0f5
movq -0x1f8(%rbp), %rax
movq 0x220(%rax), %rax
movb 0x29(%rax), %al
andb $0x1, %al
movzbl %al, %eax
cmpl $0x1, %eax
jne 0x4d613
movq -0x1f8(%rbp), %rax
movq 0x220(%rax), %rax
testb $0x1, 0x28(%rax)
jne 0x4d611
movq -0x1f8(%rbp), %rax
movq 0x220(%rax), %rax
cmpl $0x3, 0x10(%rax)
je 0x4d4cc
movq -0x1f8(%rbp), %rax
movq 0x220(%rax), %rax
cmpl $0x4, 0x10(%rax)
jne 0x4d4fb
movq -0x1f8(%rbp), %rax
movq 0x220(%rax), %rax
testb $0x1, 0x30(%rax)
jne 0x4d4f6
movq -0x1f8(%rbp), %rax
movl 0x234(%rax), %ecx
addl $0x1, %ecx
movl %ecx, 0x234(%rax)
jmp 0x4d60f
movq -0x1f8(%rbp), %rax
movq 0x220(%rax), %rax
cmpl $0x1, 0x10(%rax)
je 0x4d527
movq -0x1f8(%rbp), %rax
movq 0x220(%rax), %rax
cmpl $0x2, 0x10(%rax)
jne 0x4d60d
movq -0x1f8(%rbp), %rax
movq 0x220(%rax), %rax
testb $0x1, 0x30(%rax)
jne 0x4d563
movq -0x1f8(%rbp), %rax
movq 0x220(%rax), %rcx
movl 0x24(%rcx), %ecx
shrl $0x4, %ecx
addl $0x1, %ecx
addl 0x234(%rax), %ecx
movl %ecx, 0x234(%rax)
jmp 0x4d60b
movq -0x1f8(%rbp), %rax
movq 0x220(%rax), %rax
cmpl $0x12, 0x2c(%rax)
je 0x4d5db
movq -0x1f8(%rbp), %rax
movq 0x220(%rax), %rax
cmpl $0x13, 0x2c(%rax)
je 0x4d5db
movq -0x1f8(%rbp), %rax
movq 0x220(%rax), %rax
cmpl $0x50, 0x2c(%rax)
je 0x4d5db
movq -0x1f8(%rbp), %rax
movq 0x220(%rax), %rax
cmpl $0x69, 0x2c(%rax)
je 0x4d5db
movq -0x1f8(%rbp), %rax
movq 0x220(%rax), %rax
cmpl $0x68, 0x2c(%rax)
je 0x4d5db
movq -0x1f8(%rbp), %rax
movq 0x220(%rax), %rax
cmpl $0x11, 0x2c(%rax)
jne 0x4d5f3
movq -0x1f8(%rbp), %rax
movl 0x234(%rax), %ecx
addl $0x1, %ecx
movl %ecx, 0x234(%rax)
jmp 0x4d609
movq -0x1f8(%rbp), %rax
movl 0x234(%rax), %ecx
addl $0x2, %ecx
movl %ecx, 0x234(%rax)
jmp 0x4d60b
jmp 0x4d60d
jmp 0x4d60f
jmp 0x4d611
jmp 0x4d613
movq -0x1f8(%rbp), %rax
cmpq $0x0, 0x258(%rax)
je 0x4d719
movq 0x189c1(%rip), %rdi     # 0x65ff0
leaq 0x3a04(%rip), %rsi      # 0x5103a
callq 0x4380
movq %rax, %rdi
leaq 0x746b(%rip), %rsi      # 0x54ab0
callq 0x4380
movq %rax, %rdi
leaq 0x41e1(%rip), %rsi      # 0x51835
callq 0x4380
movq %rax, %rdi
movl $0xf1, %esi
callq 0x4610
movq %rax, %rdi
leaq 0x39e9(%rip), %rsi      # 0x51059
callq 0x4380
movq -0x1f8(%rbp), %rsi
movq %rax, %rdi
addq $0x20, %rsi
callq 0x4320
movq %rax, %rdi
leaq 0x7665(%rip), %rsi      # 0x54cf7
callq 0x4380
movq %rax, %rdi
movq -0x1f8(%rbp), %rax
movq 0x258(%rax), %rsi
callq 0x30f50
movq %rax, %rdi
leaq 0x766d(%rip), %rsi      # 0x54d24
callq 0x4380
movq %rax, %rdi
movq -0x1f8(%rbp), %rax
movq 0x220(%rax), %rsi
callq 0x30f50
movq %rax, %rdi
leaq 0x74ce(%rip), %rsi      # 0x54baa
callq 0x4380
movq %rax, %rdi
movq -0x1f8(%rbp), %rax
movq 0x8(%rax), %rsi
callq 0x40f0
movq %rax, %rdi
leaq 0x6c7b(%rip), %rsi      # 0x54379
callq 0x4380
movq %rax, %rdi
movq 0x188a3(%rip), %rsi     # 0x65fb0
callq 0x43c0
xorl %edi, %edi
callq 0x4460
movq -0x1f8(%rbp), %rax
movq 0x220(%rax), %rcx
movq %rcx, 0x258(%rax)
leaq 0x18f57(%rip), %rcx     # 0x6668c
movl (%rcx), %ecx
movl %ecx, 0x260(%rax)
movq $0x0, 0x220(%rax)
movq -0x1f8(%rbp), %rax
cmpq $0x0, 0x228(%rax)
je 0x4e0c0
movq -0x1f8(%rbp), %rax
cmpl $0x0, 0x230(%rax)
jne 0x4deb7
movq -0x1f8(%rbp), %rax
movq 0x228(%rax), %rax
cmpl $0x68, 0x2c(%rax)
je 0x4de51
movq -0x1f8(%rbp), %rax
movq 0x228(%rax), %rax
cmpl $0x69, 0x2c(%rax)
je 0x4de51
movl $0x38, %edi
callq 0x4390
movq %rax, %rdi
movq -0x1f8(%rbp), %rax
movq %rdi, %rcx
movq %rcx, -0x250(%rbp)
movq 0x228(%rax), %rsi
callq 0x30e60
jmp 0x4d7cd
movq -0x250(%rbp), %rax
movq %rax, -0xb0(%rbp)
leaq 0x18e4f(%rip), %rax     # 0x66631
movb (%rax), %dl
movl $0x4, %ecx
movl $0x3, %eax
testb $0x1, %dl
cmovnel %eax, %ecx
movq -0xb0(%rbp), %rax
movl %ecx, 0x10(%rax)
movq -0xb0(%rbp), %rax
movl $0x10, 0x24(%rax)
movq -0xb0(%rbp), %rax
movb $0x1, 0x29(%rax)
movq -0xb0(%rbp), %rax
testb $0x1, 0x28(%rax)
jne 0x4d85d
movq -0xb0(%rbp), %rax
movq $0x0, 0x8(%rax)
jmp 0x4d85d
movq -0x250(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xa0(%rbp)
movl %eax, -0xa4(%rbp)
movl $0x38, %esi
callq 0x43a0
jmp 0x4e0f5
leaq 0x18dcc(%rip), %rax     # 0x66630
testb $0x1, (%rax)
je 0x4dc25
movq -0x1f8(%rbp), %rax
movq 0x218(%rax), %rdi
movq 0x228(%rax), %rax
addq $0x238, %rdi            # imm = 0x238
movl 0x18(%rax), %eax
movl %eax, %esi
callq 0x22650
movq %rax, %rcx
movq -0x1f8(%rbp), %rax
movq %rcx, -0x268(%rbp)
movq 0x218(%rax), %rdi
movq 0x228(%rax), %rax
addq $0x238, %rdi            # imm = 0x238
movl 0x18(%rax), %eax
movl %eax, %esi
callq 0x22650
movq %rax, %rdi
callq 0x22bc0
movq %rax, -0xc0(%rbp)
leaq -0xb8(%rbp), %rdi
leaq -0xc0(%rbp), %rsi
callq 0x22bf0
movq -0x268(%rbp), %rdi
movq -0xb8(%rbp), %rsi
leaq -0xb0(%rbp), %rdx
callq 0x4fd20
movq %rax, %rcx
movq -0x1f8(%rbp), %rax
movq %rcx, -0xc8(%rbp)
addq $0x40, %rax
movq %rax, -0x260(%rbp)
leaq -0xe8(%rbp), %rdi
movq %rdi, -0x258(%rbp)
callq 0x44f0
movq -0x260(%rbp), %rdi
movq -0x258(%rbp), %rsi
callq 0x4430
jmp 0x4d943
leaq -0xe8(%rbp), %rdi
callq 0x46e8
movq -0x1f8(%rbp), %rax
movq %rax, %rdi
addq $0x40, %rdi
movq 0x40(%rax), %rax
addq -0x18(%rax), %rdi
xorl %esi, %esi
callq 0x45e0
movq -0x1f8(%rbp), %rax
movq %rax, %rdi
addq $0x40, %rdi
addq $0x10, %rdi
movq 0x228(%rax), %rax
movl 0x18(%rax), %esi
callq 0x44c0
leaq 0x18b94(%rip), %rax     # 0x66528
testb $0x1, (%rax)
je 0x4dc20
movl $0x12, %edi
callq 0x177b0
movl %eax, -0xec(%rbp)
movl -0xec(%rbp), %esi
movq 0x18616(%rip), %rdi     # 0x65fd0
callq 0x4440
movq %rax, -0x278(%rbp)
movl $0x20, %edi
callq 0x177d0
movq -0x278(%rbp), %rdi
movb %al, -0xed(%rbp)
movzbl -0xed(%rbp), %esi
callq 0x4550
movq %rax, %rcx
movq -0x1f8(%rbp), %rax
movq %rcx, -0x270(%rbp)
movq 0x218(%rax), %rsi
addq $0x20, %rsi
leaq 0x3f29(%rip), %rdx      # 0x51935
leaq -0x150(%rbp), %rdi
callq 0x17fa0
movq -0x1f8(%rbp), %rsi
addq $0x40, %rsi
leaq -0x170(%rbp), %rdi
callq 0x4370
jmp 0x4da31
leaq -0x130(%rbp), %rdi
leaq -0x150(%rbp), %rsi
leaq -0x170(%rbp), %rdx
callq 0x228d0
jmp 0x4da4d
leaq 0x6925(%rip), %rdx      # 0x54379
leaq -0x110(%rbp), %rdi
leaq -0x130(%rbp), %rsi
callq 0x18020
jmp 0x4da69
movq -0x270(%rbp), %rdi
leaq -0x110(%rbp), %rsi
callq 0x4320
movq %rax, -0x280(%rbp)
jmp 0x4da85
movl $0xf, %edi
callq 0x177b0
movl %eax, -0x284(%rbp)
jmp 0x4da97
movq -0x280(%rbp), %rdi
movl -0x284(%rbp), %eax
movl %eax, -0x174(%rbp)
movl -0x174(%rbp), %esi
callq 0x4440
movq %rax, -0x290(%rbp)
jmp 0x4dabe
movl $0x20, %edi
callq 0x177d0
movb %al, -0x291(%rbp)
jmp 0x4dad0
movq -0x290(%rbp), %rdi
movb -0x291(%rbp), %al
movb %al, -0x175(%rbp)
movzbl -0x175(%rbp), %esi
callq 0x4550
movq %rax, -0x2a0(%rbp)
jmp 0x4daf8
movq -0x2a0(%rbp), %rdi
movq -0xb0(%rbp), %rsi
callq 0x30f50
movq %rax, -0x2a8(%rbp)
jmp 0x4db14
movq -0x2a8(%rbp), %rdi
leaq 0x720f(%rip), %rsi      # 0x54d31
callq 0x4380
movq %rax, -0x2b0(%rbp)
jmp 0x4db30
movq -0x2b0(%rbp), %rdi
movq 0x18472(%rip), %rsi     # 0x65fb0
callq 0x43c0
jmp 0x4db45
leaq -0x110(%rbp), %rdi
callq 0x46e8
leaq -0x130(%rbp), %rdi
callq 0x46e8
leaq -0x170(%rbp), %rdi
callq 0x46e8
leaq -0x150(%rbp), %rdi
callq 0x46e8
jmp 0x4dc20
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xa0(%rbp)
movl %eax, -0xa4(%rbp)
leaq -0xe8(%rbp), %rdi
callq 0x46e8
jmp 0x4e0f5
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xa0(%rbp)
movl %eax, -0xa4(%rbp)
jmp 0x4dc0f
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xa0(%rbp)
movl %eax, -0xa4(%rbp)
jmp 0x4dc03
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xa0(%rbp)
movl %eax, -0xa4(%rbp)
jmp 0x4dbf7
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xa0(%rbp)
movl %eax, -0xa4(%rbp)
leaq -0x110(%rbp), %rdi
callq 0x46e8
leaq -0x130(%rbp), %rdi
callq 0x46e8
leaq -0x170(%rbp), %rdi
callq 0x46e8
leaq -0x150(%rbp), %rdi
callq 0x46e8
jmp 0x4e0f5
jmp 0x4de4f
movq -0x1f8(%rbp), %rax
movq 0x218(%rax), %rdi
addq $0x238, %rdi            # imm = 0x238
xorl %eax, %eax
movl %eax, %esi
callq 0x22650
movq %rax, %rcx
movq -0x1f8(%rbp), %rax
movq %rcx, -0x2b8(%rbp)
movq 0x218(%rax), %rdi
addq $0x238, %rdi            # imm = 0x238
xorl %eax, %eax
movl %eax, %esi
callq 0x22650
movq %rax, %rdi
callq 0x22bc0
movq %rax, -0x188(%rbp)
leaq -0x180(%rbp), %rdi
leaq -0x188(%rbp), %rsi
callq 0x22bf0
movq -0x2b8(%rbp), %rdi
movq -0x180(%rbp), %rsi
leaq -0xb0(%rbp), %rdx
callq 0x4fd20
movq %rax, -0x190(%rbp)
leaq 0x18873(%rip), %rax     # 0x66528
testb $0x1, (%rax)
je 0x4de4d
movl $0x12, %edi
callq 0x177b0
movl %eax, -0x194(%rbp)
movl -0x194(%rbp), %esi
movq 0x182f5(%rip), %rdi     # 0x65fd0
callq 0x4440
movq %rax, -0x2d8(%rbp)
movl $0x20, %edi
callq 0x177d0
movq -0x2d8(%rbp), %rdi
movb %al, -0x195(%rbp)
movzbl -0x195(%rbp), %esi
callq 0x4550
movq %rax, %rcx
movq -0x1f8(%rbp), %rax
movq %rcx, -0x2d0(%rbp)
movq 0x218(%rax), %rsi
addq $0x20, %rsi
leaq 0x664c(%rip), %rdx      # 0x54379
leaq -0x1b8(%rbp), %rdi
movq %rdi, -0x2c8(%rbp)
callq 0x17fa0
movq -0x2d0(%rbp), %rdi
movq -0x2c8(%rbp), %rsi
callq 0x4320
movq %rax, -0x2c0(%rbp)
jmp 0x4dd5c
movl $0xf, %edi
callq 0x177b0
movl %eax, -0x2dc(%rbp)
jmp 0x4dd6e
movq -0x2c0(%rbp), %rdi
movl -0x2dc(%rbp), %eax
movl %eax, -0x1bc(%rbp)
movl -0x1bc(%rbp), %esi
callq 0x4440
movq %rax, -0x2e8(%rbp)
jmp 0x4dd95
movl $0x20, %edi
callq 0x177d0
movb %al, -0x2e9(%rbp)
jmp 0x4dda7
movq -0x2e8(%rbp), %rdi
movb -0x2e9(%rbp), %al
movb %al, -0x1bd(%rbp)
movzbl -0x1bd(%rbp), %esi
callq 0x4550
movq %rax, -0x2f8(%rbp)
jmp 0x4ddcf
movq -0x2f8(%rbp), %rdi
movq -0xb0(%rbp), %rsi
callq 0x30f50
movq %rax, -0x300(%rbp)
jmp 0x4ddeb
movq -0x300(%rbp), %rdi
leaq 0x6f38(%rip), %rsi      # 0x54d31
callq 0x4380
movq %rax, -0x308(%rbp)
jmp 0x4de07
movq -0x308(%rbp), %rdi
movq 0x1819b(%rip), %rsi     # 0x65fb0
callq 0x43c0
jmp 0x4de1c
leaq -0x1b8(%rbp), %rdi
callq 0x46e8
jmp 0x4de4d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xa0(%rbp)
movl %eax, -0xa4(%rbp)
leaq -0x1b8(%rbp), %rdi
callq 0x46e8
jmp 0x4e0f5
jmp 0x4de4f
jmp 0x4de51
movq -0x1f8(%rbp), %rax
movq 0x228(%rax), %rax
testb $0x1, 0x28(%rax)
jne 0x4de78
movq -0x1f8(%rbp), %rdi
movq 0x228(%rdi), %rsi
callq 0x4ca00
movq -0x1f8(%rbp), %rax
movq 0x228(%rax), %rax
movq %rax, -0x310(%rbp)
cmpq $0x0, %rax
je 0x4dea0
movq -0x310(%rbp), %rdi
movq (%rdi), %rax
callq *0x8(%rax)
movq -0x1f8(%rbp), %rax
movq $0x0, 0x228(%rax)
jmp 0x4e0be
leaq 0x1866a(%rip), %rax     # 0x66528
testb $0x1, (%rax)
je 0x4e0a8
leaq 0x1865b(%rip), %rax     # 0x66529
testb $0x1, (%rax)
jne 0x4e0a8
movl $0x12, %edi
callq 0x177b0
movl %eax, -0x1c4(%rbp)
movl -0x1c4(%rbp), %esi
movq 0x180dc(%rip), %rdi     # 0x65fd0
callq 0x4440
movq %rax, -0x330(%rbp)
movl $0x20, %edi
callq 0x177d0
movq -0x330(%rbp), %rdi
movb %al, -0x1c5(%rbp)
movzbl -0x1c5(%rbp), %esi
callq 0x4550
movq %rax, %rcx
movq -0x1f8(%rbp), %rax
movq %rcx, -0x328(%rbp)
movq 0x218(%rax), %rsi
addq $0x20, %rsi
leaq 0x6433(%rip), %rdx      # 0x54379
leaq -0x1e8(%rbp), %rdi
movq %rdi, -0x320(%rbp)
callq 0x17fa0
movq -0x328(%rbp), %rdi
movq -0x320(%rbp), %rsi
callq 0x4320
movq %rax, -0x318(%rbp)
jmp 0x4df75
movl $0xf, %edi
callq 0x177b0
movl %eax, -0x334(%rbp)
jmp 0x4df87
movq -0x318(%rbp), %rdi
movl -0x334(%rbp), %eax
movl %eax, -0x1ec(%rbp)
movl -0x1ec(%rbp), %esi
callq 0x4440
movq %rax, -0x340(%rbp)
jmp 0x4dfae
movl $0x20, %edi
callq 0x177d0
movb %al, -0x341(%rbp)
jmp 0x4dfc0
movq -0x340(%rbp), %rdi
movb -0x341(%rbp), %al
movb %al, -0x1ed(%rbp)
movzbl -0x1ed(%rbp), %esi
callq 0x4550
movq %rax, -0x350(%rbp)
jmp 0x4dfe8
movq -0x350(%rbp), %rdi
movq -0x1f8(%rbp), %rax
movq 0x228(%rax), %rsi
callq 0x30f50
movq %rax, -0x358(%rbp)
jmp 0x4e00b
movq -0x358(%rbp), %rdi
leaq 0x6d4f(%rip), %rsi      # 0x54d68
callq 0x4380
movq %rax, -0x360(%rbp)
jmp 0x4e027
movq -0x360(%rbp), %rdi
movq -0x1f8(%rbp), %rax
movl 0x230(%rax), %esi
callq 0x44c0
movq %rax, -0x368(%rbp)
jmp 0x4e049
movq -0x368(%rbp), %rdi
leaq 0x4f7f(%rip), %rsi      # 0x52fd6
callq 0x4380
movq %rax, -0x370(%rbp)
jmp 0x4e065
movq -0x370(%rbp), %rdi
movq 0x17f3d(%rip), %rsi     # 0x65fb0
callq 0x43c0
jmp 0x4e07a
leaq -0x1e8(%rbp), %rdi
callq 0x46e8
jmp 0x4e0a8
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xa0(%rbp)
movl %eax, -0xa4(%rbp)
leaq -0x1e8(%rbp), %rdi
callq 0x46e8
jmp 0x4e0f5
movq -0x1f8(%rbp), %rax
movl 0x230(%rax), %ecx
addl $-0x1, %ecx
movl %ecx, 0x230(%rax)
jmp 0x4e0c0
movq -0x1f8(%rbp), %rdi
callq 0x4f660
movq -0x1f8(%rbp), %rax
movq 0x218(%rax), %rdi
movq (%rdi), %rax
callq *0x10(%rax)
movq -0x1f8(%rbp), %rdi
callq 0x2a030
addq $0x370, %rsp            # imm = 0x370
popq %rbp
retq
movq -0xa0(%rbp), %rdi
callq 0x4630
nopw %cs:(%rax,%rax)