// File: dramninjasUMD[P]BOBSim/Rank.cpp
// Function: BOBSim::Rank::ReceiveFromBus(BOBSim::BusPacket*)
void Rank::ReceiveFromBus(BusPacket *busPacket)
{
	if(DEBUG_CHANNEL) DEBUG("     == Rank "<<id<<" received : " << *busPacket);

	if(VERIFICATION_OUTPUT && busPacket->channel==0)
	{
		busPacket->PrintVerification(currentClockCycle);
	}

	switch(busPacket->busPacketType)
	{
	case REFRESH:
		for(unsigned i=0; i<NUM_BANKS; i++)
		{
			if(bankStates[i].currentBankState != IDLE ||
			        bankStates[i].nextActivate > currentClockCycle)
			{
				ERROR("== Error - Refresh when not allowed in bank "<<i);
				ERROR("           NextAct : "<<bankStates[i].nextActivate);
				ERROR("           State : "<<bankStates[i].currentBankState);
				exit(0);
			}

			bankStates[i].lastCommand = REFRESH;
			bankStates[i].currentBankState = REFRESHING;
			bankStates[i].stateChangeCountdown = tRFC;
			bankStates[i].nextActivate = currentClockCycle + tRFC;
		}
		delete busPacket;
		break;
	case READ_P:
		if(bankStates[busPacket->bank].currentBankState != ROW_ACTIVE ||
		        bankStates[busPacket->bank].openRowAddress != busPacket->row ||
		        currentClockCycle < bankStates[busPacket->bank].nextRead)
		{
			ERROR("== Error - Rank receiving READ_P when not allowed");
			ERROR("           Current Clock Cycle : "<<currentClockCycle);
			ERROR(bankStates[busPacket->bank]);
			exit(0);
		}

		//
		//update bankstates
		//
		busPacket->busPacketType = READ_DATA;
		readReturnQueue.push_back(busPacket);
		readReturnCountdown.push_back(tCL);

		for(unsigned i=0; i<NUM_BANKS; i++)
		{
			bankStates[i].nextRead = max(bankStates[i].nextRead, currentClockCycle + tCCD);
			bankStates[i].nextWrite = max(bankStates[i].nextWrite, currentClockCycle + tCCD);
		}

		bankStates[busPacket->bank].lastCommand = READ_P;
		bankStates[busPacket->bank].stateChangeCountdown = tRTP;
		bankStates[busPacket->bank].nextActivate = currentClockCycle + tRTP + tRP;
		bankStates[busPacket->bank].nextRead = bankStates[busPacket->bank].nextActivate;
		bankStates[busPacket->bank].nextWrite = bankStates[busPacket->bank].nextActivate;
		break;
	case WRITE_P:
		if(bankStates[busPacket->bank].currentBankState != ROW_ACTIVE ||
		        bankStates[busPacket->bank].openRowAddress != busPacket->row ||
		        currentClockCycle < bankStates[busPacket->bank].nextWrite)
		{
			ERROR("== Error - Rank "<<id<<" receiving WRITE_P when not allowed");
			ERROR(bankStates[busPacket->bank]);
			ERROR("           currentClockCycle : "<<currentClockCycle);
			exit(0);
		}

		//
		//update bank states
		//

		for(unsigned i=0; i<NUM_BANKS; i++)
		{
			bankStates[i].nextRead = max(bankStates[i].nextRead, currentClockCycle + tCCD);
			bankStates[i].nextWrite = max(bankStates[i].nextWrite, currentClockCycle + tCCD);
		}
		bankStates[busPacket->bank].lastCommand = WRITE_P;
		bankStates[busPacket->bank].stateChangeCountdown = tCWL + TRANSACTION_SIZE/DRAM_BUS_WIDTH + tWR;
		bankStates[busPacket->bank].nextActivate = currentClockCycle + tCWL + busPacket->burstLength + tWR + tRP;
		bankStates[busPacket->bank].nextRead = bankStates[busPacket->bank].nextActivate;
		bankStates[busPacket->bank].nextWrite = bankStates[busPacket->bank].nextActivate;

		delete busPacket;
		break;
	case ACTIVATE:
		if(bankStates[busPacket->bank].currentBankState != IDLE ||
		        currentClockCycle < bankStates[busPacket->bank].nextActivate)
		{
			ERROR("== Error - Rank receiving ACT when not allowed");
			exit(0);
		}

		//
		//update bank states
		//
		bankStates[busPacket->bank].currentBankState = ROW_ACTIVE;
		bankStates[busPacket->bank].openRowAddress = busPacket->row;
		bankStates[busPacket->bank].nextRead = currentClockCycle + tRCD;
		bankStates[busPacket->bank].nextWrite = currentClockCycle + tRCD;
		bankStates[busPacket->bank].nextActivate = currentClockCycle + tRC;

		for(unsigned i=0; i<NUM_BANKS; i++)
		{
			if(i!=busPacket->bank)
			{
				bankStates[i].nextActivate = max(bankStates[i].nextActivate, currentClockCycle + tRRD);
			}
		}

		delete busPacket;
		break;
	case WRITE_DATA:
		if(bankStates[busPacket->bank].currentBankState != ROW_ACTIVE ||
		        bankStates[busPacket->bank].openRowAddress != busPacket->row)
		{
			ERROR("== Error - Clock Cycle : "<<currentClockCycle);
			ERROR("== Error - Rank receiving WRITE_DATA when not allowed: " << *busPacket <<endl << bankStates[busPacket->bank]);
			exit(0);
		}

		bankStates[busPacket->bank].stateChangeCountdown = tWR;
		bankStates[busPacket->bank].nextActivate = currentClockCycle + tWR + tRP;

		delete busPacket;
		break;
	default:
		ERROR("== Error - Rank receiving incorrect type of bus packet");
		break;
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x90, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x58(%rbp)
testb $0x1, 0x16621(%rip)     # 0x38843
je 0x2227e
leaq 0x16149(%rip), %rax     # 0x38374
cmpl $0x0, (%rax)
je 0x2227c
movq 0x15d91(%rip), %rdi     # 0x37fc8
leaq 0x9c79(%rip), %rsi      # 0x2beb7
callq 0x31c0
movq %rax, %rdi
movq -0x58(%rbp), %rax
movl 0x10(%rax), %esi
callq 0x32d0
movq %rax, %rdi
leaq 0x9c69(%rip), %rsi      # 0x2bec5
callq 0x31c0
movq %rax, %rdi
movq -0x10(%rbp), %rsi
callq 0x18f90
movq %rax, %rdi
movq 0x15d31(%rip), %rsi     # 0x37fa8
callq 0x3200
jmp 0x2227e
testb $0x1, 0x165bf(%rip)     # 0x38844
je 0x222a2
movq -0x10(%rbp), %rax
cmpl $0x0, 0x28(%rax)
jne 0x222a2
movq -0x58(%rbp), %rax
movq -0x10(%rbp), %rdi
movq 0x8(%rax), %rsi
callq 0x18ce0
movq -0x10(%rbp), %rax
movl 0x4(%rax), %eax
decl %eax
movl %eax, %ecx
movq %rcx, -0x60(%rbp)
subl $0x7, %eax
ja 0x23017
movq -0x60(%rbp), %rax
leaq 0x9bc3(%rip), %rcx      # 0x2be88
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movl $0x0, -0x14(%rbp)
movl -0x14(%rbp), %eax
cmpl 0x16166(%rip), %eax     # 0x38444
jae 0x22519
movq -0x58(%rbp), %rax
movq 0x50(%rax), %rax
movl -0x14(%rbp), %ecx
shlq $0x6, %rcx
addq %rcx, %rax
cmpl $0x0, (%rax)
jne 0x2231b
movq -0x58(%rbp), %rcx
movq 0x50(%rcx), %rax
movl -0x14(%rbp), %edx
shlq $0x6, %rdx
addq %rdx, %rax
movq 0x8(%rax), %rax
cmpq 0x8(%rcx), %rax
jbe 0x224a8
movq 0x15cce(%rip), %rdi     # 0x37ff0
leaq 0x7de7(%rip), %rsi      # 0x2a110
callq 0x31c0
movq %rax, %rdi
leaq 0x9b9a(%rip), %rsi      # 0x2bed2
callq 0x31c0
movq %rax, %rdi
leaq 0x7d72(%rip), %rsi      # 0x2a0b9
callq 0x31c0
movq %rax, %rdi
movl $0x5d, %esi
callq 0x3380
movq %rax, %rdi
leaq 0x7dbe(%rip), %rsi      # 0x2a121
callq 0x31c0
movq %rax, %rdi
leaq 0x9b69(%rip), %rsi      # 0x2bedb
callq 0x31c0
movq %rax, %rdi
movl -0x14(%rbp), %esi
callq 0x32d0
movq %rax, %rdi
movq 0x15c1c(%rip), %rsi     # 0x37fa8
callq 0x3200
movq 0x15c58(%rip), %rdi     # 0x37ff0
leaq 0x7d71(%rip), %rsi      # 0x2a110
callq 0x31c0
movq %rax, %rdi
leaq 0x9b24(%rip), %rsi      # 0x2bed2
callq 0x31c0
movq %rax, %rdi
leaq 0x7cfc(%rip), %rsi      # 0x2a0b9
callq 0x31c0
movq %rax, %rdi
movl $0x5e, %esi
callq 0x3380
movq %rax, %rdi
leaq 0x7d48(%rip), %rsi      # 0x2a121
callq 0x31c0
movq %rax, %rdi
leaq 0x9b20(%rip), %rsi      # 0x2bf08
callq 0x31c0
movq %rax, %rdi
movq -0x58(%rbp), %rax
movq 0x50(%rax), %rax
movl -0x14(%rbp), %ecx
shlq $0x6, %rcx
addq %rcx, %rax
movq 0x8(%rax), %rsi
callq 0x3070
movq %rax, %rdi
movq 0x15b93(%rip), %rsi     # 0x37fa8
callq 0x3200
movq 0x15bcf(%rip), %rdi     # 0x37ff0
leaq 0x7ce8(%rip), %rsi      # 0x2a110
callq 0x31c0
movq %rax, %rdi
leaq 0x9a9b(%rip), %rsi      # 0x2bed2
callq 0x31c0
movq %rax, %rdi
leaq 0x7c73(%rip), %rsi      # 0x2a0b9
callq 0x31c0
movq %rax, %rdi
movl $0x5f, %esi
callq 0x3380
movq %rax, %rdi
leaq 0x7cbf(%rip), %rsi      # 0x2a121
callq 0x31c0
movq %rax, %rdi
leaq 0x9aad(%rip), %rsi      # 0x2bf1e
callq 0x31c0
movq %rax, %rdi
movq -0x58(%rbp), %rax
movq 0x50(%rax), %rax
movl -0x14(%rbp), %ecx
shlq $0x6, %rcx
addq %rcx, %rax
movl (%rax), %esi
callq 0x3380
movq %rax, %rdi
movq 0x15b0c(%rip), %rsi     # 0x37fa8
callq 0x3200
xorl %edi, %edi
callq 0x3270
movq -0x58(%rbp), %rax
movq 0x50(%rax), %rcx
movl -0x14(%rbp), %edx
shlq $0x6, %rdx
addq %rdx, %rcx
movl $0x5, 0x38(%rcx)
movq 0x50(%rax), %rcx
movl -0x14(%rbp), %edx
shlq $0x6, %rdx
addq %rdx, %rcx
movl $0x3, (%rcx)
movl 0x15f6d(%rip), %edx     # 0x38448
movq 0x50(%rax), %rcx
movl -0x14(%rbp), %esi
shlq $0x6, %rsi
addq %rsi, %rcx
movl %edx, 0x3c(%rcx)
movq 0x8(%rax), %rcx
movl 0x15f52(%rip), %edx     # 0x38448
addq %rdx, %rcx
movq 0x50(%rax), %rax
movl -0x14(%rbp), %edx
shlq $0x6, %rdx
addq %rdx, %rax
movq %rcx, 0x8(%rax)
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
jmp 0x222d5
movq -0x10(%rbp), %rax
movq %rax, -0x68(%rbp)
cmpq $0x0, %rax
je 0x22535
movq -0x68(%rbp), %rdi
movl $0x38, %esi
callq 0x31f0
jmp 0x23082
movq -0x58(%rbp), %rax
movq 0x50(%rax), %rax
movq -0x10(%rbp), %rcx
movl 0x10(%rcx), %ecx
shlq $0x6, %rcx
addq %rcx, %rax
cmpl $0x1, (%rax)
jne 0x2259b
movq -0x58(%rbp), %rax
movq 0x50(%rax), %rax
movq -0x10(%rbp), %rcx
movl 0x10(%rcx), %ecx
shlq $0x6, %rcx
addq %rcx, %rax
movl 0x4(%rax), %eax
movq -0x10(%rbp), %rcx
cmpl 0xc(%rcx), %eax
jne 0x2259b
movq -0x58(%rbp), %rcx
movq 0x8(%rcx), %rax
movq 0x50(%rcx), %rcx
movq -0x10(%rbp), %rdx
movl 0x10(%rdx), %edx
shlq $0x6, %rdx
addq %rdx, %rcx
cmpq 0x10(%rcx), %rax
jae 0x22702
movq 0x15a4e(%rip), %rdi     # 0x37ff0
leaq 0x7b67(%rip), %rsi      # 0x2a110
callq 0x31c0
movq %rax, %rdi
leaq 0x991a(%rip), %rsi      # 0x2bed2
callq 0x31c0
movq %rax, %rdi
leaq 0x7af2(%rip), %rsi      # 0x2a0b9
callq 0x31c0
movq %rax, %rdi
movl $0x6f, %esi
callq 0x3380
movq %rax, %rdi
leaq 0x7b3e(%rip), %rsi      # 0x2a121
callq 0x31c0
movq %rax, %rdi
leaq 0x9940(%rip), %rsi      # 0x2bf32
callq 0x31c0
movq %rax, %rdi
movq 0x159a7(%rip), %rsi     # 0x37fa8
callq 0x3200
movq 0x159e3(%rip), %rdi     # 0x37ff0
leaq 0x7afc(%rip), %rsi      # 0x2a110
callq 0x31c0
movq %rax, %rdi
leaq 0x98af(%rip), %rsi      # 0x2bed2
callq 0x31c0
movq %rax, %rdi
leaq 0x7a87(%rip), %rsi      # 0x2a0b9
callq 0x31c0
movq %rax, %rdi
movl $0x70, %esi
callq 0x3380
movq %rax, %rdi
leaq 0x7ad3(%rip), %rsi      # 0x2a121
callq 0x31c0
movq %rax, %rdi
leaq 0x9907(%rip), %rsi      # 0x2bf64
callq 0x31c0
movq %rax, %rdi
movq -0x58(%rbp), %rax
movq 0x8(%rax), %rsi
callq 0x3070
movq %rax, %rdi
movq 0x1592c(%rip), %rsi     # 0x37fa8
callq 0x3200
movq 0x15968(%rip), %rdi     # 0x37ff0
leaq 0x7a81(%rip), %rsi      # 0x2a110
callq 0x31c0
movq %rax, %rdi
leaq 0x9834(%rip), %rsi      # 0x2bed2
callq 0x31c0
movq %rax, %rdi
leaq 0x7a0c(%rip), %rsi      # 0x2a0b9
callq 0x31c0
movq %rax, %rdi
movl $0x71, %esi
callq 0x3380
movq %rax, %rdi
leaq 0x7a58(%rip), %rsi      # 0x2a121
callq 0x31c0
movq %rax, %rdi
movq -0x58(%rbp), %rax
movq 0x50(%rax), %rsi
movq -0x10(%rbp), %rax
movl 0x10(%rax), %eax
shlq $0x6, %rax
addq %rax, %rsi
callq 0x18b20
movq %rax, %rdi
movq 0x158b2(%rip), %rsi     # 0x37fa8
callq 0x3200
xorl %edi, %edi
callq 0x3270
movq -0x58(%rbp), %rdi
movq -0x10(%rbp), %rax
movl $0x7, 0x4(%rax)
addq $0x30, %rdi
leaq -0x10(%rbp), %rsi
callq 0x23280
movq -0x58(%rbp), %rdi
addq $0x18, %rdi
leaq 0x15d1f(%rip), %rsi     # 0x3844c
callq 0x17090
movl $0x0, -0x18(%rbp)
movl -0x18(%rbp), %eax
cmpl 0x15d02(%rip), %eax     # 0x38444
jae 0x227ea
movq -0x58(%rbp), %rax
movq 0x50(%rax), %rdi
movl -0x18(%rbp), %ecx
shlq $0x6, %rcx
addq %rcx, %rdi
addq $0x10, %rdi
movq 0x8(%rax), %rax
movl 0x15ce8(%rip), %ecx     # 0x38450
addq %rcx, %rax
movq %rax, -0x20(%rbp)
leaq -0x20(%rbp), %rsi
callq 0xd310
movq %rax, %rcx
movq -0x58(%rbp), %rax
movq (%rcx), %rdx
movq 0x50(%rax), %rcx
movl -0x18(%rbp), %esi
shlq $0x6, %rsi
addq %rsi, %rcx
movq %rdx, 0x10(%rcx)
movq 0x50(%rax), %rdi
movl -0x18(%rbp), %ecx
shlq $0x6, %rcx
addq %rcx, %rdi
addq $0x18, %rdi
movq 0x8(%rax), %rax
movl 0x15ca0(%rip), %ecx     # 0x38450
addq %rcx, %rax
movq %rax, -0x28(%rbp)
leaq -0x28(%rbp), %rsi
callq 0xd310
movq %rax, %rcx
movq -0x58(%rbp), %rax
movq (%rcx), %rcx
movq 0x50(%rax), %rax
movl -0x18(%rbp), %edx
shlq $0x6, %rdx
addq %rdx, %rax
movq %rcx, 0x18(%rax)
movl -0x18(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x18(%rbp)
jmp 0x22739
movq -0x58(%rbp), %rax
movq 0x50(%rax), %rcx
movq -0x10(%rbp), %rdx
movl 0x10(%rdx), %edx
shlq $0x6, %rdx
addq %rdx, %rcx
movl $0x1, 0x38(%rcx)
movl 0x15c47(%rip), %edx     # 0x38454
movq 0x50(%rax), %rcx
movq -0x10(%rbp), %rsi
movl 0x10(%rsi), %esi
shlq $0x6, %rsi
addq %rsi, %rcx
movl %edx, 0x3c(%rcx)
movq 0x8(%rax), %rdx
movl 0x15c28(%rip), %ecx     # 0x38454
addq %rcx, %rdx
movl 0x15c23(%rip), %ecx     # 0x38458
addq %rcx, %rdx
movq 0x50(%rax), %rcx
movq -0x10(%rbp), %rsi
movl 0x10(%rsi), %esi
shlq $0x6, %rsi
addq %rsi, %rcx
movq %rdx, 0x8(%rcx)
movq 0x50(%rax), %rcx
movq -0x10(%rbp), %rdx
movl 0x10(%rdx), %edx
shlq $0x6, %rdx
addq %rdx, %rcx
movq 0x8(%rcx), %rdx
movq 0x50(%rax), %rcx
movq -0x10(%rbp), %rsi
movl 0x10(%rsi), %esi
shlq $0x6, %rsi
addq %rsi, %rcx
movq %rdx, 0x10(%rcx)
movq 0x50(%rax), %rcx
movq -0x10(%rbp), %rdx
movl 0x10(%rdx), %edx
shlq $0x6, %rdx
addq %rdx, %rcx
movq 0x8(%rcx), %rcx
movq 0x50(%rax), %rax
movq -0x10(%rbp), %rdx
movl 0x10(%rdx), %edx
shlq $0x6, %rdx
addq %rdx, %rax
movq %rcx, 0x18(%rax)
jmp 0x23082
movq -0x58(%rbp), %rax
movq 0x50(%rax), %rax
movq -0x10(%rbp), %rcx
movl 0x10(%rcx), %ecx
shlq $0x6, %rcx
addq %rcx, %rax
cmpl $0x1, (%rax)
jne 0x2290c
movq -0x58(%rbp), %rax
movq 0x50(%rax), %rax
movq -0x10(%rbp), %rcx
movl 0x10(%rcx), %ecx
shlq $0x6, %rcx
addq %rcx, %rax
movl 0x4(%rax), %eax
movq -0x10(%rbp), %rcx
cmpl 0xc(%rcx), %eax
jne 0x2290c
movq -0x58(%rbp), %rcx
movq 0x8(%rcx), %rax
movq 0x50(%rcx), %rcx
movq -0x10(%rbp), %rdx
movl 0x10(%rdx), %edx
shlq $0x6, %rdx
addq %rdx, %rcx
cmpq 0x18(%rcx), %rax
jae 0x22a91
movq 0x156dd(%rip), %rdi     # 0x37ff0
leaq 0x77f6(%rip), %rsi      # 0x2a110
callq 0x31c0
movq %rax, %rdi
leaq 0x95a9(%rip), %rsi      # 0x2bed2
callq 0x31c0
movq %rax, %rdi
leaq 0x7781(%rip), %rsi      # 0x2a0b9
callq 0x31c0
movq %rax, %rdi
movl $0x8d, %esi
callq 0x3380
movq %rax, %rdi
leaq 0x77cd(%rip), %rsi      # 0x2a121
callq 0x31c0
movq %rax, %rdi
leaq 0x9623(%rip), %rsi      # 0x2bf86
callq 0x31c0
movq %rax, %rdi
movq -0x58(%rbp), %rax
movl 0x10(%rax), %esi
callq 0x32d0
movq %rax, %rdi
leaq 0x9616(%rip), %rsi      # 0x2bf97
callq 0x31c0
movq %rax, %rdi
movq 0x15618(%rip), %rsi     # 0x37fa8
callq 0x3200
movq 0x15654(%rip), %rdi     # 0x37ff0
leaq 0x776d(%rip), %rsi      # 0x2a110
callq 0x31c0
movq %rax, %rdi
leaq 0x9520(%rip), %rsi      # 0x2bed2
callq 0x31c0
movq %rax, %rdi
leaq 0x76f8(%rip), %rsi      # 0x2a0b9
callq 0x31c0
movq %rax, %rdi
movl $0x8e, %esi
callq 0x3380
movq %rax, %rdi
leaq 0x7744(%rip), %rsi      # 0x2a121
callq 0x31c0
movq %rax, %rdi
movq -0x58(%rbp), %rax
movq 0x50(%rax), %rsi
movq -0x10(%rbp), %rax
movl 0x10(%rax), %eax
shlq $0x6, %rax
addq %rax, %rsi
callq 0x18b20
movq %rax, %rdi
movq 0x1559e(%rip), %rsi     # 0x37fa8
callq 0x3200
movq 0x155da(%rip), %rdi     # 0x37ff0
leaq 0x76f3(%rip), %rsi      # 0x2a110
callq 0x31c0
movq %rax, %rdi
leaq 0x94a6(%rip), %rsi      # 0x2bed2
callq 0x31c0
movq %rax, %rdi
leaq 0x767e(%rip), %rsi      # 0x2a0b9
callq 0x31c0
movq %rax, %rdi
movl $0x8f, %esi
callq 0x3380
movq %rax, %rdi
leaq 0x76ca(%rip), %rsi      # 0x2a121
callq 0x31c0
movq %rax, %rdi
leaq 0x9555(%rip), %rsi      # 0x2bfbb
callq 0x31c0
movq %rax, %rdi
movq -0x58(%rbp), %rax
movq 0x8(%rax), %rsi
callq 0x3070
movq %rax, %rdi
movq 0x15523(%rip), %rsi     # 0x37fa8
callq 0x3200
xorl %edi, %edi
callq 0x3270
movl $0x0, -0x2c(%rbp)
movl -0x2c(%rbp), %eax
cmpl 0x159a3(%rip), %eax     # 0x38444
jae 0x22b49
movq -0x58(%rbp), %rax
movq 0x50(%rax), %rdi
movl -0x2c(%rbp), %ecx
shlq $0x6, %rcx
addq %rcx, %rdi
addq $0x10, %rdi
movq 0x8(%rax), %rax
movl 0x15989(%rip), %ecx     # 0x38450
addq %rcx, %rax
movq %rax, -0x38(%rbp)
leaq -0x38(%rbp), %rsi
callq 0xd310
movq %rax, %rcx
movq -0x58(%rbp), %rax
movq (%rcx), %rdx
movq 0x50(%rax), %rcx
movl -0x2c(%rbp), %esi
shlq $0x6, %rsi
addq %rsi, %rcx
movq %rdx, 0x10(%rcx)
movq 0x50(%rax), %rdi
movl -0x2c(%rbp), %ecx
shlq $0x6, %rcx
addq %rcx, %rdi
addq $0x18, %rdi
movq 0x8(%rax), %rax
movl 0x15941(%rip), %ecx     # 0x38450
addq %rcx, %rax
movq %rax, -0x40(%rbp)
leaq -0x40(%rbp), %rsi
callq 0xd310
movq %rax, %rcx
movq -0x58(%rbp), %rax
movq (%rcx), %rcx
movq 0x50(%rax), %rax
movl -0x2c(%rbp), %edx
shlq $0x6, %rdx
addq %rdx, %rax
movq %rcx, 0x18(%rax)
movl -0x2c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x2c(%rbp)
jmp 0x22a98
movq -0x58(%rbp), %rax
movq 0x50(%rax), %rax
movq -0x10(%rbp), %rcx
movl 0x10(%rcx), %ecx
shlq $0x6, %rcx
addq %rcx, %rax
movl $0x3, 0x38(%rax)
movl 0x158f0(%rip), %eax     # 0x3845c
movl %eax, -0x74(%rbp)
movl 0x158eb(%rip), %eax     # 0x38460
xorl %edx, %edx
divl 0x158e7(%rip)           # 0x38464
movl -0x74(%rbp), %edx
movl %eax, %ecx
movq -0x58(%rbp), %rax
addl %ecx, %edx
addl 0x158da(%rip), %edx     # 0x38468
movq 0x50(%rax), %rcx
movq -0x10(%rbp), %rsi
movl 0x10(%rsi), %esi
shlq $0x6, %rsi
addq %rsi, %rcx
movl %edx, 0x3c(%rcx)
movq 0x8(%rax), %rdx
movl 0x158af(%rip), %ecx     # 0x3845c
addq %rcx, %rdx
movq -0x10(%rbp), %rcx
movl 0x24(%rcx), %ecx
addq %rcx, %rdx
movl 0x158a8(%rip), %ecx     # 0x38468
addq %rcx, %rdx
movl 0x1588f(%rip), %ecx     # 0x38458
addq %rcx, %rdx
movq 0x50(%rax), %rcx
movq -0x10(%rbp), %rsi
movl 0x10(%rsi), %esi
shlq $0x6, %rsi
addq %rsi, %rcx
movq %rdx, 0x8(%rcx)
movq 0x50(%rax), %rcx
movq -0x10(%rbp), %rdx
movl 0x10(%rdx), %edx
shlq $0x6, %rdx
addq %rdx, %rcx
movq 0x8(%rcx), %rdx
movq 0x50(%rax), %rcx
movq -0x10(%rbp), %rsi
movl 0x10(%rsi), %esi
shlq $0x6, %rsi
addq %rsi, %rcx
movq %rdx, 0x10(%rcx)
movq 0x50(%rax), %rcx
movq -0x10(%rbp), %rdx
movl 0x10(%rdx), %edx
shlq $0x6, %rdx
addq %rdx, %rcx
movq 0x8(%rcx), %rcx
movq 0x50(%rax), %rax
movq -0x10(%rbp), %rdx
movl 0x10(%rdx), %edx
shlq $0x6, %rdx
addq %rdx, %rax
movq %rcx, 0x18(%rax)
movq -0x10(%rbp), %rax
movq %rax, -0x70(%rbp)
cmpq $0x0, %rax
je 0x22c56
movq -0x70(%rbp), %rdi
movl $0x38, %esi
callq 0x31f0
jmp 0x23082
movq -0x58(%rbp), %rax
movq 0x50(%rax), %rax
movq -0x10(%rbp), %rcx
movl 0x10(%rcx), %ecx
shlq $0x6, %rcx
addq %rcx, %rax
cmpl $0x0, (%rax)
jne 0x22c96
movq -0x58(%rbp), %rcx
movq 0x8(%rcx), %rax
movq 0x50(%rcx), %rcx
movq -0x10(%rbp), %rdx
movl 0x10(%rdx), %edx
shlq $0x6, %rdx
addq %rdx, %rcx
cmpq 0x8(%rcx), %rax
jae 0x22d08
movq 0x15353(%rip), %rdi     # 0x37ff0
leaq 0x746c(%rip), %rsi      # 0x2a110
callq 0x31c0
movq %rax, %rdi
leaq 0x921f(%rip), %rsi      # 0x2bed2
callq 0x31c0
movq %rax, %rdi
leaq 0x73f7(%rip), %rsi      # 0x2a0b9
callq 0x31c0
movq %rax, %rdi
movl $0xa8, %esi
callq 0x3380
movq %rax, %rdi
leaq 0x7443(%rip), %rsi      # 0x2a121
callq 0x31c0
movq %rax, %rdi
leaq 0x92ee(%rip), %rsi      # 0x2bfdb
callq 0x31c0
movq %rax, %rdi
movq 0x152ac(%rip), %rsi     # 0x37fa8
callq 0x3200
xorl %edi, %edi
callq 0x3270
movq -0x58(%rbp), %rax
movq 0x50(%rax), %rcx
movq -0x10(%rbp), %rdx
movl 0x10(%rdx), %edx
shlq $0x6, %rdx
addq %rdx, %rcx
movl $0x1, (%rcx)
movq -0x10(%rbp), %rcx
movl 0xc(%rcx), %edx
movq 0x50(%rax), %rcx
movq -0x10(%rbp), %rsi
movl 0x10(%rsi), %esi
shlq $0x6, %rsi
addq %rsi, %rcx
movl %edx, 0x4(%rcx)
movq 0x8(%rax), %rdx
movl 0x15722(%rip), %ecx     # 0x3846c
addq %rcx, %rdx
movq 0x50(%rax), %rcx
movq -0x10(%rbp), %rsi
movl 0x10(%rsi), %esi
shlq $0x6, %rsi
addq %rsi, %rcx
movq %rdx, 0x10(%rcx)
movq 0x8(%rax), %rdx
movl 0x156ff(%rip), %ecx     # 0x3846c
addq %rcx, %rdx
movq 0x50(%rax), %rcx
movq -0x10(%rbp), %rsi
movl 0x10(%rsi), %esi
shlq $0x6, %rsi
addq %rsi, %rcx
movq %rdx, 0x18(%rcx)
movq 0x8(%rax), %rcx
movl 0x156e0(%rip), %edx     # 0x38470
addq %rdx, %rcx
movq 0x50(%rax), %rax
movq -0x10(%rbp), %rdx
movl 0x10(%rdx), %edx
shlq $0x6, %rdx
addq %rdx, %rax
movq %rcx, 0x8(%rax)
movl $0x0, -0x44(%rbp)
movl -0x44(%rbp), %eax
cmpl 0x1568b(%rip), %eax     # 0x38444
jae 0x22e20
movl -0x44(%rbp), %eax
movq -0x10(%rbp), %rcx
cmpl 0x10(%rcx), %eax
je 0x22e13
movq -0x58(%rbp), %rax
movq 0x50(%rax), %rdi
movl -0x44(%rbp), %ecx
shlq $0x6, %rcx
addq %rcx, %rdi
addq $0x8, %rdi
movq 0x8(%rax), %rax
movl 0x1568d(%rip), %ecx     # 0x38474
addq %rcx, %rax
movq %rax, -0x50(%rbp)
leaq -0x50(%rbp), %rsi
callq 0xd310
movq %rax, %rcx
movq -0x58(%rbp), %rax
movq (%rcx), %rcx
movq 0x50(%rax), %rax
movl -0x44(%rbp), %edx
shlq $0x6, %rdx
addq %rdx, %rax
movq %rcx, 0x8(%rax)
jmp 0x22e15
movl -0x44(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x44(%rbp)
jmp 0x22db0
movq -0x10(%rbp), %rax
movq %rax, -0x80(%rbp)
cmpq $0x0, %rax
je 0x22e3c
movq -0x80(%rbp), %rdi
movl $0x38, %esi
callq 0x31f0
jmp 0x23082
movq -0x58(%rbp), %rax
movq 0x50(%rax), %rax
movq -0x10(%rbp), %rcx
movl 0x10(%rcx), %ecx
shlq $0x6, %rcx
addq %rcx, %rax
cmpl $0x1, (%rax)
jne 0x22e82
movq -0x58(%rbp), %rax
movq 0x50(%rax), %rax
movq -0x10(%rbp), %rcx
movl 0x10(%rcx), %ecx
shlq $0x6, %rcx
addq %rcx, %rax
movl 0x4(%rax), %eax
movq -0x10(%rbp), %rcx
cmpl 0xc(%rcx), %eax
je 0x22fa8
movq 0x15167(%rip), %rdi     # 0x37ff0
leaq 0x7280(%rip), %rsi      # 0x2a110
callq 0x31c0
movq %rax, %rdi
leaq 0x9033(%rip), %rsi      # 0x2bed2
callq 0x31c0
movq %rax, %rdi
leaq 0x720b(%rip), %rsi      # 0x2a0b9
callq 0x31c0
movq %rax, %rdi
movl $0xc3, %esi
callq 0x3380
movq %rax, %rdi
leaq 0x7257(%rip), %rsi      # 0x2a121
callq 0x31c0
movq %rax, %rdi
leaq 0x9131(%rip), %rsi      # 0x2c00a
callq 0x31c0
movq %rax, %rdi
movq -0x58(%rbp), %rax
movq 0x8(%rax), %rsi
callq 0x3070
movq %rax, %rdi
movq 0x150b0(%rip), %rsi     # 0x37fa8
callq 0x3200
movq 0x150ec(%rip), %rdi     # 0x37ff0
leaq 0x7205(%rip), %rsi      # 0x2a110
callq 0x31c0
movq %rax, %rdi
leaq 0x8fb8(%rip), %rsi      # 0x2bed2
callq 0x31c0
movq %rax, %rdi
leaq 0x7190(%rip), %rsi      # 0x2a0b9
callq 0x31c0
movq %rax, %rdi
movl $0xc4, %esi
callq 0x3380
movq %rax, %rdi
leaq 0x71dc(%rip), %rsi      # 0x2a121
callq 0x31c0
movq %rax, %rdi
leaq 0x90d0(%rip), %rsi      # 0x2c024
callq 0x31c0
movq %rax, %rdi
movq -0x10(%rbp), %rsi
callq 0x18f90
movq %rax, %rdi
movq 0x15039(%rip), %rsi     # 0x37fa8
callq 0x3200
movq %rax, %rdi
movq -0x58(%rbp), %rax
movq 0x50(%rax), %rsi
movq -0x10(%rbp), %rax
movl 0x10(%rax), %eax
shlq $0x6, %rax
addq %rax, %rsi
callq 0x18b20
movq %rax, %rdi
movq 0x1500c(%rip), %rsi     # 0x37fa8
callq 0x3200
xorl %edi, %edi
callq 0x3270
movq -0x58(%rbp), %rax
movl 0x154b6(%rip), %edx     # 0x38468
movq 0x50(%rax), %rcx
movq -0x10(%rbp), %rsi
movl 0x10(%rsi), %esi
shlq $0x6, %rsi
addq %rsi, %rcx
movl %edx, 0x3c(%rcx)
movq 0x8(%rax), %rcx
movl 0x15497(%rip), %edx     # 0x38468
addq %rdx, %rcx
movl 0x1547e(%rip), %edx     # 0x38458
addq %rdx, %rcx
movq 0x50(%rax), %rax
movq -0x10(%rbp), %rdx
movl 0x10(%rdx), %edx
shlq $0x6, %rdx
addq %rdx, %rax
movq %rcx, 0x8(%rax)
movq -0x10(%rbp), %rax
movq %rax, -0x88(%rbp)
cmpq $0x0, %rax
je 0x23015
movq -0x88(%rbp), %rdi
movl $0x38, %esi
callq 0x31f0
jmp 0x23082
movq 0x14fd2(%rip), %rdi     # 0x37ff0
leaq 0x70eb(%rip), %rsi      # 0x2a110
callq 0x31c0
movq %rax, %rdi
leaq 0x8e9e(%rip), %rsi      # 0x2bed2
callq 0x31c0
movq %rax, %rdi
leaq 0x7076(%rip), %rsi      # 0x2a0b9
callq 0x31c0
movq %rax, %rdi
movl $0xce, %esi
callq 0x3380
movq %rax, %rdi
leaq 0x70c2(%rip), %rsi      # 0x2a121
callq 0x31c0
movq %rax, %rdi
leaq 0x8fee(%rip), %rsi      # 0x2c05c
callq 0x31c0
movq %rax, %rdi
movq 0x14f2b(%rip), %rsi     # 0x37fa8
callq 0x3200
addq $0x90, %rsp
popq %rbp
retq
nopl (%rax,%rax)