// File: dramninjasUMD[P]BOBSim/BOB.cpp
// Function: BOBSim::BOB::PrintStats(std::basic_ofstream<char, std::char_traits<char>>&, std::basic_ofstream<char, std::char_traits<char>>&, bool, unsigned int)
void BOB::PrintStats(ofstream &statsOut, ofstream &powerOut, bool finalPrint, unsigned elapsedCycles)
{
	unsigned long dramCyclesElapsed;
	//check if we are on an epoch boundary or if there are cycles left over
	//
	//NOTE : subtract one from currentClockCycle since BOB object Update() has already been called
	//       before this call to PrintStats()

	if((currentClockCycle-1)%EPOCH_LENGTH==0)
	{
		//OLD - doesn't work for non-even ratios
		//dramCyclesElapsed = EPOCH_LENGTH / DRAM_CPU_CLK_RATIO;

		//NEW
		dramCyclesElapsed = EPOCH_LENGTH / ((float)tCK/(float)CPU_CLK_PERIOD);
	}
	else
	{
		//same as above
		dramCyclesElapsed = ((currentClockCycle-1)%EPOCH_LENGTH)/((float)tCK/(float)CPU_CLK_PERIOD);
	}

	//dramCyclesElapsed = channels[0]->currentClockCycle;

#define MAX_TMP_STR 512
	char tmp_str[MAX_TMP_STR];

	PRINT(" === BOB Print === ");
	unsigned long totalRequestsAtChannels = 0L;
	PRINT(" == Ports");
	for(unsigned p=0; p<NUM_PORTS; p++)
	{
		PRINT("  -- Port "<<p<<" - inputBufferAvg : "<<(float)portInputBufferAvg[p]/elapsedCycles<<" ("<<ports[p].inputBuffer.size()<<")   outputBufferAvg : "<<(float)portOutputBufferAvg[p]/elapsedCycles<<" ("<<ports[p].outputBuffer.size()<<")");
		portInputBufferAvg[p]=0;
		portOutputBufferAvg[p]=0;
	}

	//calculate possible bandwidth of part
	float dataperiod = tCK/2;
	float bw = (1/dataperiod)*64/8;//64-bit bus, 8 bits/byte

	unsigned numDevices = 64 / DEVICE_WIDTH;
	unsigned long totalBytesPerDevice = (NUM_COLS * NUM_ROWS * NUM_BANKS * DEVICE_WIDTH) / 8L; //in bytes
	unsigned long gigabytesPerRank = (numDevices * totalBytesPerDevice)>>30;

	//calculate peak bandwidth for link bus
	float reqbwpeak = 0;
	float rspbwpeak = 0;
	if(LINK_BUS_USE_DDR)
	{
		reqbwpeak = ((REQUEST_LINK_BUS_WIDTH * 2) / LINK_BUS_CLK_PERIOD)/8; //in bytes
		rspbwpeak = ((RESPONSE_LINK_BUS_WIDTH * 2) / LINK_BUS_CLK_PERIOD)/8; //in bytes
	}
	else
	{
		reqbwpeak = (REQUEST_LINK_BUS_WIDTH / LINK_BUS_CLK_PERIOD) / 8; //in bytes
		rspbwpeak = (RESPONSE_LINK_BUS_WIDTH / LINK_BUS_CLK_PERIOD) / 8; //in bytes
	}

	PRINT(" == Link Bandwidth (!! Includes packet overhead and request packets !!)")
	PRINT("    Req Link("<<reqbwpeak<<" GB/s peak)  Rsp Link("<<rspbwpeak<<" GB/s peak)");
	double reqtotal = 0;
	double rsptotal = 0;
	for(int l=0; l<NUM_LINK_BUSES; l++)
	{
		reqtotal += (1-(float)requestLinkIdle[l]/(float)elapsedCycles) * reqbwpeak;
		rsptotal += (1-(float)responseLinkIdle[l]/(float)elapsedCycles) * rspbwpeak;
		PRINTN("      "<<(1-(float)requestLinkIdle[l]/(float)elapsedCycles) * reqbwpeak<<" GB/s             ");
		requestLinkIdle[l]=0;
		PRINT((1-(float)responseLinkIdle[l]/(float)elapsedCycles) * rspbwpeak<<" GB/s");
		responseLinkIdle[l]=0;
	}


	PRINT("     -----------");
	PRINT("      "<<reqtotal/NUM_LINK_BUSES<<"          "<<rsptotal/NUM_LINK_BUSES<<" (avgs)");


	PRINT(" == Channel Usage and Stats ("<<(NUM_RANKS * gigabytesPerRank)<<"GB/Chan == "<<NUM_RANKS * gigabytesPerRank * NUM_CHANNELS<<" GB total)");
	PRINT("     reqs   workQAvg  workQMax idleBanks   actBanks  preBanks  refBanks  (totalBanks) BusIdle  BW("<<bw<<")  RRQMax("<<CHANNEL_RETURN_Q_MAX/TRANSACTION_SIZE<<")   RRQFull lifetimeRequests");
	float totalDRAMbw = 0;
	for(unsigned i=0; i<NUM_CHANNELS; i++)
	{
		//compute each DRAM channel's BW
		double DRAMBandwidth= (bw * (1 - ((double)channels[i]->DRAMBusIdleCount/(double)dramCyclesElapsed))) * 1E9 / (1<<30);

		statsOut<<DRAMBandwidth<<",";

		totalDRAMbw += DRAMBandwidth;
		totalRequestsAtChannels+=channelCounters[i];
		channelCountersLifetime[i]+=channelCounters[i];

		// since trying to actually format strings with stream operators is a huge pain
		snprintf(tmp_str, MAX_TMP_STR, "%d]%9d%10.4f%10d%10.4f%10.4f%10.4f%10.4f%10.4f%10.2f%10.3f%10d(%d)%10d%10ld\n",
		         i,
		         channelCounters[i],
		         (float)channels[i]->simpleController.commandQueueAverage/dramCyclesElapsed,
		         channels[i]->simpleController.commandQueueMax,
		         (float)channels[i]->simpleController.numIdleBanksAverage/dramCyclesElapsed,
		         (float)channels[i]->simpleController.numActBanksAverage/dramCyclesElapsed,
		         (float)channels[i]->simpleController.numPreBanksAverage/dramCyclesElapsed,
		         (float)channels[i]->simpleController.numRefBanksAverage/dramCyclesElapsed,
		         (float)(channels[i]->simpleController.numIdleBanksAverage+
		                 channels[i]->simpleController.numActBanksAverage+
		                 channels[i]->simpleController.numPreBanksAverage+
		                 channels[i]->simpleController.numRefBanksAverage)/dramCyclesElapsed,
		         100*((float)channels[i]->DRAMBusIdleCount/(float)dramCyclesElapsed),
		         DRAMBandwidth,
		         channels[i]->readReturnQueueMax,
		         (int)channels[i]->readReturnQueue.size(),
		         channels[i]->simpleController.RRQFull,
		         channelCountersLifetime[i]

		        );

		for(int r=0; r<NUM_RANKS; r++)
		{
			for(int b=0; b<NUM_BANKS; b++)
			{
				//PRINTN(channels[i]->simpleController.bankStates[r][b]);
			}
		}

		//reset
		channels[i]->simpleController.commandQueueAverage=0;
		channels[i]->simpleController.numIdleBanksAverage=0;
		channels[i]->simpleController.numActBanksAverage=0;
		channels[i]->simpleController.numPreBanksAverage=0;
		channels[i]->simpleController.numRefBanksAverage=0;
		channels[i]->simpleController.commandQueueMax=0;
		channels[i]->readReturnQueueMax=0;
		channels[i]->DRAMBusIdleCount=0;
		channelCounters[i]=0;
		channels[i]->simpleController.RRQFull=0;
		cmdQFull[i]=0;

		PRINTN(tmp_str);
	}

	//separates bandwidth numbers and power numbers
	statsOut<<";";

	PRINT("                                                                                          AVG : "<<totalDRAMbw/NUM_CHANNELS);
	PRINT(" == Requests seen at Channels");
	PRINT("  -- Reads  : "<<readCounter);
	PRINT("  -- Writes : "<<writeCounter);
	PRINT("            = "<<totalRequestsAtChannels);
	readCounter = 0;
	writeCounter = 0;
	totalRequestsAtChannels = 0;

	//
	//
	//POWER
	//
	//
	PRINT(" == Channel Power");
	powerOut<<currentClockCycle * CPU_CLK_PERIOD / 1000000<<",";

	bool detailedOutput = false;
	bool shortOutput = true;
	float allChanAveragePower = 0;
	for(unsigned c=0; c<NUM_CHANNELS; c++)
	{
		float totalChannelPower = 0;
		PRINTN("    -- Channel "<<c);
		for(unsigned r=0; r<NUM_RANKS; r++)
		{
			float backgroundPower = ((float)channels[c]->simpleController.backgroundEnergy[r] / (float) dramCyclesElapsed) * Vdd / 1000;
			float burstPower = ((float)channels[c]->simpleController.burstEnergy[r] / (float) dramCyclesElapsed) * Vdd / 1000;
			float actprePower = ((float)channels[c]->simpleController.actpreEnergy[r] / (float) dramCyclesElapsed) * Vdd / 1000;
			float refreshPower = ((float)channels[c]->simpleController.refreshEnergy[r] / (float) dramCyclesElapsed) * Vdd / 1000;

			float averagePower = ((float)(channels[c]->simpleController.actpreEnergy[r] +
			                              channels[c]->simpleController.backgroundEnergy[r] +
			                              channels[c]->simpleController.burstEnergy[r] +
			                              channels[c]->simpleController.refreshEnergy[r]) / (float) dramCyclesElapsed) * Vdd / 1000;
			totalChannelPower += averagePower;

			if(!shortOutput)
			{
				PRINTN("     -- Rank "<<r<<" : ");
				if(detailedOutput)
				{
					PRINT(setprecision(4)<<"TOT :"<<averagePower<<"  bkg:"<<backgroundPower<<" brst:"<<burstPower<<" ap:"<<actprePower<<" ref:"<<refreshPower);
				}
				else
				{
					PRINTN(setprecision(4)<<averagePower<<"w ");
				}
			}

			//clear for next epoch
			channels[c]->simpleController.backgroundEnergy[r]=0;
			channels[c]->simpleController.burstEnergy[r]=0;
			channels[c]->simpleController.actpreEnergy[r]=0;
			channels[c]->simpleController.refreshEnergy[r]=0;
		}

		allChanAveragePower += totalChannelPower;
		statsOut<<totalChannelPower<<",";
		powerOut<<totalChannelPower<<",";

		PRINT(" -- DRAM Power : "<<totalChannelPower<<" w");
	}

	PRINT("   Average Power  : "<<allChanAveragePower/NUM_CHANNELS<<" w");
	PRINT("   Total Power    : "<<allChanAveragePower<<" w");
	PRINT("   SimpCont BG Power : "<<NUM_LINK_BUSES * SIMP_CONT_BACKGROUND_POWER<<" w");
	PRINT("   SimpCont Core Power : "<<NUM_CHANNELS * SIMP_CONT_CORE_POWER<<" w");
	PRINT("   System Power   : "<<allChanAveragePower + NUM_LINK_BUSES * SIMP_CONT_BACKGROUND_POWER + NUM_CHANNELS * SIMP_CONT_CORE_POWER<<" w");

	statsOut << ";" << allChanAveragePower/NUM_CHANNELS << endl;

	//compute static power from controllers
	powerOut<<SIMP_CONT_BACKGROUND_POWER * NUM_LINK_BUSES + NUM_CHANNELS * SIMP_CONT_CORE_POWER <<",";
	powerOut<<(SIMP_CONT_BACKGROUND_POWER * NUM_LINK_BUSES + NUM_CHANNELS * SIMP_CONT_CORE_POWER) + allChanAveragePower<<endl;

	PRINT(" == Time Check");
	PRINT("    CPU Time : "<<currentClockCycle * CPU_CLK_PERIOD<<"ns");
	PRINT("   DRAM Time : "<<(channels[0]->currentClockCycle * tCK)<<"ns");
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
subq $0x508, %rsp            # imm = 0x508
movb %cl, %al
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
andb $0x1, %al
movb %al, -0x21(%rbp)
movl %r8d, -0x28(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x2c8(%rbp)
movq 0x8(%rax), %rax
subq $0x1, %rax
movl 0x2ee38(%rip), %ecx     # 0x38274
xorl %edx, %edx
divq %rcx
cmpq $0x0, %rdx
jne 0x9496
movl 0x2ee27(%rip), %eax     # 0x38274
cvtsi2ss %rax, %xmm0
movss 0x2ede2(%rip), %xmm1    # 0x3823c
movss 0x2edd2(%rip), %xmm2    # 0x38234
divss %xmm2, %xmm1
divss %xmm1, %xmm0
movaps %xmm0, %xmm1
cvttss2si %xmm1, %rax
movq %rax, %rdx
sarq $0x3f, %rdx
movss 0x20bd7(%rip), %xmm1    # 0x2a058
subss %xmm1, %xmm0
cvttss2si %xmm0, %rcx
andq %rdx, %rcx
orq %rcx, %rax
movq %rax, -0x30(%rbp)
jmp 0x94f6
movq -0x2c8(%rbp), %rax
movq 0x8(%rax), %rax
decq %rax
movl 0x2edca(%rip), %ecx     # 0x38274
xorl %edx, %edx
divq %rcx
cvtsi2ss %rdx, %xmm0
movss 0x2ed80(%rip), %xmm1    # 0x3823c
movss 0x2ed70(%rip), %xmm2    # 0x38234
divss %xmm2, %xmm1
divss %xmm1, %xmm0
movaps %xmm0, %xmm1
cvttss2si %xmm1, %rax
movq %rax, %rdx
sarq $0x3f, %rdx
movss 0x20b75(%rip), %xmm1    # 0x2a058
subss %xmm1, %xmm0
cvttss2si %xmm0, %rcx
andq %rdx, %rcx
orq %rcx, %rax
movq %rax, -0x30(%rbp)
movq 0x2eacb(%rip), %rdi     # 0x37fc8
leaq 0x21233(%rip), %rsi     # 0x2a737
callq 0x31c0
movq %rax, %rdi
movq 0x2ea95(%rip), %rsi     # 0x37fa8
callq 0x3200
movq $0x0, -0x238(%rbp)
movq 0x2ea9e(%rip), %rdi     # 0x37fc8
leaq 0x2121a(%rip), %rsi     # 0x2a74b
callq 0x31c0
movq %rax, %rdi
movq 0x2ea68(%rip), %rsi     # 0x37fa8
callq 0x3200
movl $0x0, -0x23c(%rbp)
movl -0x23c(%rbp), %eax
leaq 0x2ee14(%rip), %rcx     # 0x38370
cmpl (%rcx), %eax
jae 0x972b
movq 0x2ea5d(%rip), %rdi     # 0x37fc8
leaq 0x211e3(%rip), %rsi     # 0x2a755
callq 0x31c0
movq %rax, %rdi
movl -0x23c(%rbp), %esi
callq 0x32d0
movq %rax, %rdi
leaq 0x211d1(%rip), %rsi     # 0x2a760
callq 0x31c0
movq -0x2c8(%rbp), %rdi
movq %rax, -0x2e8(%rbp)
addq $0x88, %rdi
movl -0x23c(%rbp), %eax
movl %eax, %esi
callq 0xbec0
movq -0x2e8(%rbp), %rdi
movl (%rax), %eax
cvtsi2ss %rax, %xmm0
movl -0x28(%rbp), %eax
cvtsi2ss %rax, %xmm1
divss %xmm1, %xmm0
callq 0x3140
movq %rax, %rdi
leaq 0x20b37(%rip), %rsi     # 0x2a116
callq 0x31c0
movq -0x2c8(%rbp), %rdi
movq %rax, -0x2e0(%rbp)
addq $0x10, %rdi
movl -0x23c(%rbp), %eax
movl %eax, %esi
callq 0xbee0
movq %rax, %rdi
addq $0x10, %rdi
callq 0xbe00
movq -0x2e0(%rbp), %rdi
movq %rax, %rsi
callq 0x3070
movq %rax, %rdi
leaq 0x2114d(%rip), %rsi     # 0x2a775
callq 0x31c0
movq -0x2c8(%rbp), %rdi
movq %rax, -0x2d8(%rbp)
addq $0xa0, %rdi
movl -0x23c(%rbp), %eax
movl %eax, %esi
callq 0xbec0
movq -0x2d8(%rbp), %rdi
movl (%rax), %eax
cvtsi2ss %rax, %xmm0
movl -0x28(%rbp), %eax
cvtsi2ss %rax, %xmm1
divss %xmm1, %xmm0
callq 0x3140
movq %rax, %rdi
leaq 0x20a9e(%rip), %rsi     # 0x2a116
callq 0x31c0
movq -0x2c8(%rbp), %rdi
movq %rax, -0x2d0(%rbp)
addq $0x10, %rdi
movl -0x23c(%rbp), %eax
movl %eax, %esi
callq 0xbee0
movq %rax, %rdi
addq $0x28, %rdi
callq 0xbe00
movq -0x2d0(%rbp), %rdi
movq %rax, %rsi
callq 0x3070
movq %rax, %rdi
leaq 0x21111(%rip), %rsi     # 0x2a7d2
callq 0x31c0
movq %rax, %rdi
movq 0x2e8d8(%rip), %rsi     # 0x37fa8
callq 0x3200
movq -0x2c8(%rbp), %rdi
addq $0x88, %rdi
movl -0x23c(%rbp), %eax
movl %eax, %esi
callq 0xbec0
movq -0x2c8(%rbp), %rdi
movl $0x0, (%rax)
addq $0xa0, %rdi
movl -0x23c(%rbp), %eax
movl %eax, %esi
callq 0xbec0
movl $0x0, (%rax)
movl -0x23c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x23c(%rbp)
jmp 0x954f
movss 0x2eb09(%rip), %xmm0    # 0x3823c
movss 0x2092d(%rip), %xmm1    # 0x2a068
divss %xmm1, %xmm0
movss %xmm0, -0x240(%rbp)
movss 0x20915(%rip), %xmm0    # 0x2a064
divss -0x240(%rbp), %xmm0
movss 0x20901(%rip), %xmm1    # 0x2a060
mulss %xmm1, %xmm0
movss 0x208f1(%rip), %xmm1    # 0x2a05c
divss %xmm1, %xmm0
movss %xmm0, -0x244(%rbp)
movl $0x40, %eax
xorl %ecx, %ecx
movl %ecx, %edx
divq 0x2eaf1(%rip)           # 0x38278
movl %eax, -0x248(%rbp)
movq 0x2ea8c(%rip), %rax     # 0x38220
imulq 0x2ea7c(%rip), %rax     # 0x38218
movl 0x2ea72(%rip), %ecx     # 0x38214
imulq %rcx, %rax
imulq 0x2eaca(%rip), %rax     # 0x38278
shrq $0x3, %rax
movq %rax, -0x250(%rbp)
movl -0x248(%rbp), %eax
imulq -0x250(%rbp), %rax
shrq $0x1e, %rax
movq %rax, -0x258(%rbp)
xorps %xmm0, %xmm0
movss %xmm0, -0x25c(%rbp)
xorps %xmm0, %xmm0
movss %xmm0, -0x260(%rbp)
testb $0x1, 0x2ea69(%rip)     # 0x38258
je 0x9849
movl 0x2ea55(%rip), %eax     # 0x3824c
addl %eax, %eax
cvtsi2ss %rax, %xmm0
movss 0x2ea32(%rip), %xmm1    # 0x38238
divss %xmm1, %xmm0
movss 0x2085a(%rip), %xmm1    # 0x2a06c
mulss %xmm1, %xmm0
movss %xmm0, -0x25c(%rbp)
movl 0x2ea44(%rip), %eax     # 0x38268
addl %eax, %eax
cvtsi2ss %rax, %xmm0
divss 0x2ea05(%rip), %xmm0    # 0x38238
movss 0x20821(%rip), %xmm1    # 0x2a05c
divss %xmm1, %xmm0
movss %xmm0, -0x260(%rbp)
jmp 0x989b
movl 0x2e9fd(%rip), %eax     # 0x3824c
cvtsi2ss %rax, %xmm0
movss 0x2e9dc(%rip), %xmm1    # 0x38238
divss %xmm1, %xmm0
movss 0x20804(%rip), %xmm1    # 0x2a06c
mulss %xmm1, %xmm0
movss %xmm0, -0x25c(%rbp)
movl 0x2e9ee(%rip), %eax     # 0x38268
cvtsi2ss %rax, %xmm0
divss 0x2e9b1(%rip), %xmm0    # 0x38238
movss 0x207cd(%rip), %xmm1    # 0x2a05c
divss %xmm1, %xmm0
movss %xmm0, -0x260(%rbp)
movq 0x2e726(%rip), %rdi     # 0x37fc8
leaq 0x20ee3(%rip), %rsi     # 0x2a78c
callq 0x31c0
movq %rax, %rdi
movq 0x2e6f0(%rip), %rsi     # 0x37fa8
callq 0x3200
movq 0x2e704(%rip), %rdi     # 0x37fc8
leaq 0x20f09(%rip), %rsi     # 0x2a7d4
callq 0x31c0
movq %rax, %rdi
movss -0x25c(%rbp), %xmm0
callq 0x3140
movq %rax, %rdi
leaq 0x20ef8(%rip), %rsi     # 0x2a7e2
callq 0x31c0
movq %rax, %rdi
movss -0x260(%rbp), %xmm0
callq 0x3140
movq %rax, %rdi
leaq 0x20ef0(%rip), %rsi     # 0x2a7f9
callq 0x31c0
movq %rax, %rdi
movq 0x2e690(%rip), %rsi     # 0x37fa8
callq 0x3200
xorps %xmm0, %xmm0
movsd %xmm0, -0x268(%rbp)
xorps %xmm0, %xmm0
movsd %xmm0, -0x270(%rbp)
movl $0x0, -0x274(%rbp)
movl -0x274(%rbp), %eax
cmpl 0x2e8fb(%rip), %eax     # 0x38244
jae 0x9b43
movq -0x2c8(%rbp), %rdi
addq $0x100, %rdi            # imm = 0x100
movq %rdi, -0x2f8(%rbp)
movslq -0x274(%rbp), %rsi
callq 0xbec0
movq -0x2c8(%rbp), %rdi
movl (%rax), %eax
cvtsi2ss %rax, %xmm1
movl -0x28(%rbp), %eax
cvtsi2ss %rax, %xmm0
divss %xmm0, %xmm1
movss 0x206d2(%rip), %xmm0    # 0x2a064
movss %xmm0, -0x304(%rbp)
subss %xmm1, %xmm0
movss -0x25c(%rbp), %xmm1
mulss %xmm1, %xmm0
cvtss2sd %xmm0, %xmm1
movsd -0x268(%rbp), %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, -0x268(%rbp)
addq $0x160, %rdi            # imm = 0x160
movq %rdi, -0x2f0(%rbp)
movslq -0x274(%rbp), %rsi
callq 0xbec0
movss -0x304(%rbp), %xmm0
movl (%rax), %eax
cvtsi2ss %rax, %xmm1
movl -0x28(%rbp), %eax
cvtsi2ss %rax, %xmm2
divss %xmm2, %xmm1
subss %xmm1, %xmm0
movss -0x260(%rbp), %xmm1
mulss %xmm1, %xmm0
cvtss2sd %xmm0, %xmm1
movsd -0x270(%rbp), %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, -0x270(%rbp)
movq 0x2e5a2(%rip), %rdi     # 0x37fc8
leaq 0x20de4(%rip), %rsi     # 0x2a811
callq 0x31c0
movq -0x2f8(%rbp), %rdi
movq %rax, -0x300(%rbp)
movslq -0x274(%rbp), %rsi
callq 0xbec0
movss -0x304(%rbp), %xmm0
movq -0x300(%rbp), %rdi
movl (%rax), %eax
cvtsi2ss %rax, %xmm1
movl -0x28(%rbp), %eax
cvtsi2ss %rax, %xmm2
divss %xmm2, %xmm1
subss %xmm1, %xmm0
movss -0x25c(%rbp), %xmm1
mulss %xmm1, %xmm0
callq 0x3140
movq %rax, %rdi
leaq 0x20d78(%rip), %rsi     # 0x2a805
callq 0x31c0
movq -0x2f8(%rbp), %rdi
movslq -0x274(%rbp), %rsi
callq 0xbec0
movq -0x2f0(%rbp), %rdi
movl $0x0, (%rax)
movslq -0x274(%rbp), %rsi
callq 0xbec0
movl (%rax), %eax
cvtsi2ss %rax, %xmm1
movl -0x28(%rbp), %eax
cvtsi2ss %rax, %xmm0
divss %xmm0, %xmm1
movss 0x2058b(%rip), %xmm0    # 0x2a064
subss %xmm1, %xmm0
mulss -0x260(%rbp), %xmm0
movq 0x2e4dc(%rip), %rdi     # 0x37fc8
callq 0x3140
movq %rax, %rdi
leaq 0x20d1d(%rip), %rsi     # 0x2a818
callq 0x31c0
movq %rax, %rdi
movq 0x2e49e(%rip), %rsi     # 0x37fa8
callq 0x3200
movq -0x2c8(%rbp), %rdi
addq $0x160, %rdi            # imm = 0x160
movslq -0x274(%rbp), %rsi
callq 0xbec0
movl $0x0, (%rax)
movl -0x274(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x274(%rbp)
jmp 0x993d
movq 0x2e47e(%rip), %rdi     # 0x37fc8
movq %rdi, -0x310(%rbp)
leaq 0x20cc6(%rip), %rsi     # 0x2a81e
callq 0x31c0
movq %rax, %rdi
movq 0x2e441(%rip), %rsi     # 0x37fa8
callq 0x3200
movq -0x310(%rbp), %rdi
leaq 0x20c97(%rip), %rsi     # 0x2a811
callq 0x31c0
movq %rax, %rdi
movsd -0x268(%rbp), %xmm0
movl 0x2e6b4(%rip), %eax     # 0x38244
cvtsi2sd %rax, %xmm1
divsd %xmm1, %xmm0
callq 0x33e0
movq %rax, %rdi
leaq 0x20c65(%rip), %rsi     # 0x2a80d
callq 0x31c0
movq %rax, %rdi
movsd -0x270(%rbp), %xmm0
movl 0x2e686(%rip), %eax     # 0x38244
cvtsi2sd %rax, %xmm1
divsd %xmm1, %xmm0
callq 0x33e0
movq %rax, %rdi
leaq 0x20c59(%rip), %rsi     # 0x2a82f
callq 0x31c0
movq %rax, %rdi
movq 0x2e3c3(%rip), %rsi     # 0x37fa8
callq 0x3200
movq 0x2e3d7(%rip), %rdi     # 0x37fc8
leaq 0x20c3f(%rip), %rsi     # 0x2a837
callq 0x31c0
movq %rax, %rdi
movl 0x2e60a(%rip), %eax     # 0x38210
movl %eax, %esi
imulq -0x258(%rbp), %rsi
callq 0x3070
movq %rax, %rdi
leaq 0x20c36(%rip), %rsi     # 0x2a855
callq 0x31c0
movq %rax, %rdi
movl 0x2e5e3(%rip), %eax     # 0x38210
movl %eax, %esi
imulq -0x258(%rbp), %rsi
movl 0x2e5ef(%rip), %eax     # 0x3822c
imulq %rax, %rsi
callq 0x3070
movq %rax, %rdi
leaq 0x20c11(%rip), %rsi     # 0x2a861
callq 0x31c0
movq %rax, %rdi
movq 0x2e349(%rip), %rsi     # 0x37fa8
callq 0x3200
movq 0x2e35d(%rip), %rdi     # 0x37fc8
leaq 0x20bfa(%rip), %rsi     # 0x2a86c
callq 0x31c0
movq %rax, %rdi
movss -0x244(%rbp), %xmm0
callq 0x3140
movq %rax, %rdi
leaq 0x20c3e(%rip), %rsi     # 0x2a8cf
callq 0x31c0
movq %rax, %rdi
movl 0x2e5e1(%rip), %eax     # 0x38280
xorl %edx, %edx
divl 0x2e5ad(%rip)           # 0x38254
movl %eax, %esi
callq 0x32d0
movq %rax, %rdi
leaq 0x20c22(%rip), %rsi     # 0x2a8da
callq 0x31c0
movq %rax, %rdi
movq 0x2e2e1(%rip), %rsi     # 0x37fa8
callq 0x3200
xorps %xmm0, %xmm0
movss %xmm0, -0x278(%rbp)
movl $0x0, -0x27c(%rbp)
movl -0x27c(%rbp), %eax
cmpl 0x2e53f(%rip), %eax     # 0x3822c
jae 0xa62d
movq -0x2c8(%rbp), %rdi
movss -0x244(%rbp), %xmm0
cvtss2sd %xmm0, %xmm0
movsd %xmm0, -0x350(%rbp)
addq $0x28, %rdi
movq %rdi, -0x328(%rbp)
movl -0x27c(%rbp), %eax
movl %eax, %esi
callq 0xbe20
movsd -0x350(%rbp), %xmm0
movq (%rax), %rax
movl 0x27c(%rax), %eax
cvtsi2sd %rax, %xmm2
movaps 0x2033d(%rip), %xmm3    # 0x2a080
movq -0x30(%rbp), %xmm1
punpckldq %xmm3, %xmm1    # xmm1 = xmm1[0],xmm3[0],xmm1[1],xmm3[1]
movapd 0x2033c(%rip), %xmm3    # 0x2a090
subpd %xmm3, %xmm1
movaps %xmm1, %xmm3
unpckhpd %xmm1, %xmm1            # xmm1 = xmm1[1,1]
addsd %xmm3, %xmm1
divsd %xmm1, %xmm2
movsd 0x202a1(%rip), %xmm1    # 0x2a010
subsd %xmm2, %xmm1
mulsd %xmm1, %xmm0
movsd 0x20299(%rip), %xmm1    # 0x2a018
mulsd %xmm1, %xmm0
movsd 0x20295(%rip), %xmm1    # 0x2a020
mulsd %xmm1, %xmm0
movsd %xmm0, -0x288(%rbp)
movq -0x18(%rbp), %rdi
movsd -0x288(%rbp), %xmm0
callq 0x33e0
movq %rax, %rdi
leaq 0x20b45(%rip), %rsi     # 0x2a8f7
callq 0x31c0
movq -0x2c8(%rbp), %rdi
movsd -0x288(%rbp), %xmm1
movss -0x278(%rbp), %xmm0
cvtss2sd %xmm0, %xmm0
addsd %xmm1, %xmm0
cvtsd2ss %xmm0, %xmm0
movss %xmm0, -0x278(%rbp)
addq $0x40, %rdi
movq %rdi, -0x340(%rbp)
movl -0x27c(%rbp), %eax
movl %eax, %esi
callq 0xbec0
movq -0x340(%rbp), %rdi
movl (%rax), %eax
movl %eax, %ecx
movq -0x238(%rbp), %rax
addq %rcx, %rax
movq %rax, -0x238(%rbp)
movl -0x27c(%rbp), %eax
movl %eax, %esi
callq 0xbec0
movq -0x2c8(%rbp), %rdi
movl (%rax), %eax
movq %rax, -0x348(%rbp)
addq $0x58, %rdi
movl -0x27c(%rbp), %eax
movl %eax, %esi
callq 0xc160
movq -0x348(%rbp), %rdx
movq -0x340(%rbp), %rdi
movq (%rax), %rcx
addq %rdx, %rcx
movq %rcx, (%rax)
leaq -0x230(%rbp), %rax
movq %rax, -0x338(%rbp)
movl -0x27c(%rbp), %eax
movl %eax, -0x32c(%rbp)
movl %eax, %esi
callq 0xbec0
movq -0x328(%rbp), %rdi
movl (%rax), %eax
movl %eax, -0x320(%rbp)
movl -0x27c(%rbp), %eax
movl %eax, %esi
callq 0xbe20
movq (%rax), %rax
movl 0x24(%rax), %eax
cvtsi2ss %rax, %xmm0
movss %xmm0, -0x31c(%rbp)
movq -0x30(%rbp), %rax
movq %rax, %rdx
shrq %rdx
movl %eax, %ecx
andl $0x1, %ecx
orq %rdx, %rcx
cvtsi2ss %rcx, %xmm0
addss %xmm0, %xmm0
cvtsi2ss %rax, %xmm1
movss %xmm1, -0x318(%rbp)
testq %rax, %rax
movss %xmm0, -0x314(%rbp)
js 0x9ef0
movss -0x318(%rbp), %xmm0
movss %xmm0, -0x314(%rbp)
movq -0x328(%rbp), %rdi
movss -0x31c(%rbp), %xmm0
movss -0x314(%rbp), %xmm1
divss %xmm1, %xmm0
cvtss2sd %xmm0, %xmm0
movsd %xmm0, -0x368(%rbp)
movl -0x27c(%rbp), %eax
movl %eax, %esi
callq 0xbe20
movq -0x328(%rbp), %rdi
movq (%rax), %rax
movl 0x20(%rax), %eax
movl %eax, -0x360(%rbp)
movl -0x27c(%rbp), %eax
movl %eax, %esi
callq 0xbe20
movq (%rax), %rax
movl 0x28(%rax), %eax
cvtsi2ss %rax, %xmm0
movss %xmm0, -0x35c(%rbp)
movq -0x30(%rbp), %rax
movq %rax, %rdx
shrq %rdx
movl %eax, %ecx
andl $0x1, %ecx
orq %rdx, %rcx
cvtsi2ss %rcx, %xmm0
addss %xmm0, %xmm0
cvtsi2ss %rax, %xmm1
movss %xmm1, -0x358(%rbp)
testq %rax, %rax
movss %xmm0, -0x354(%rbp)
js 0x9f9c
movss -0x358(%rbp), %xmm0
movss %xmm0, -0x354(%rbp)
movq -0x328(%rbp), %rdi
movss -0x35c(%rbp), %xmm0
movss -0x354(%rbp), %xmm1
divss %xmm1, %xmm0
cvtss2sd %xmm0, %xmm0
movsd %xmm0, -0x380(%rbp)
movl -0x27c(%rbp), %eax
movl %eax, %esi
callq 0xbe20
movq (%rax), %rax
movl 0x2c(%rax), %eax
cvtsi2ss %rax, %xmm0
movss %xmm0, -0x374(%rbp)
movq -0x30(%rbp), %rax
movq %rax, %rdx
shrq %rdx
movl %eax, %ecx
andl $0x1, %ecx
orq %rdx, %rcx
cvtsi2ss %rcx, %xmm0
addss %xmm0, %xmm0
cvtsi2ss %rax, %xmm1
movss %xmm1, -0x370(%rbp)
testq %rax, %rax
movss %xmm0, -0x36c(%rbp)
js 0xa028
movss -0x370(%rbp), %xmm0
movss %xmm0, -0x36c(%rbp)
movq -0x328(%rbp), %rdi
movss -0x374(%rbp), %xmm0
movss -0x36c(%rbp), %xmm1
divss %xmm1, %xmm0
cvtss2sd %xmm0, %xmm0
movsd %xmm0, -0x398(%rbp)
movl -0x27c(%rbp), %eax
movl %eax, %esi
callq 0xbe20
movq (%rax), %rax
movl 0x30(%rax), %eax
cvtsi2ss %rax, %xmm0
movss %xmm0, -0x38c(%rbp)
movq -0x30(%rbp), %rax
movq %rax, %rdx
shrq %rdx
movl %eax, %ecx
andl $0x1, %ecx
orq %rdx, %rcx
cvtsi2ss %rcx, %xmm0
addss %xmm0, %xmm0
cvtsi2ss %rax, %xmm1
movss %xmm1, -0x388(%rbp)
testq %rax, %rax
movss %xmm0, -0x384(%rbp)
js 0xa0b4
movss -0x388(%rbp), %xmm0
movss %xmm0, -0x384(%rbp)
movq -0x328(%rbp), %rdi
movss -0x38c(%rbp), %xmm0
movss -0x384(%rbp), %xmm1
divss %xmm1, %xmm0
cvtss2sd %xmm0, %xmm0
movsd %xmm0, -0x3b0(%rbp)
movl -0x27c(%rbp), %eax
movl %eax, %esi
callq 0xbe20
movq (%rax), %rax
movl 0x34(%rax), %eax
cvtsi2ss %rax, %xmm0
movss %xmm0, -0x3a4(%rbp)
movq -0x30(%rbp), %rax
movq %rax, %rdx
shrq %rdx
movl %eax, %ecx
andl $0x1, %ecx
orq %rdx, %rcx
cvtsi2ss %rcx, %xmm0
addss %xmm0, %xmm0
cvtsi2ss %rax, %xmm1
movss %xmm1, -0x3a0(%rbp)
testq %rax, %rax
movss %xmm0, -0x39c(%rbp)
js 0xa140
movss -0x3a0(%rbp), %xmm0
movss %xmm0, -0x39c(%rbp)
movq -0x328(%rbp), %rdi
movss -0x3a4(%rbp), %xmm0
movss -0x39c(%rbp), %xmm1
divss %xmm1, %xmm0
cvtss2sd %xmm0, %xmm0
movsd %xmm0, -0x3d0(%rbp)
movl -0x27c(%rbp), %eax
movl %eax, %esi
callq 0xbe20
movq -0x328(%rbp), %rdi
movq (%rax), %rax
movl 0x28(%rax), %eax
movl %eax, -0x3c8(%rbp)
movl -0x27c(%rbp), %eax
movl %eax, %esi
callq 0xbe20
movq -0x328(%rbp), %rdi
movq %rax, %rcx
movl -0x3c8(%rbp), %eax
movq (%rcx), %rcx
movl 0x2c(%rcx), %ecx
addl %ecx, %eax
movl %eax, -0x3c4(%rbp)
movl -0x27c(%rbp), %eax
movl %eax, %esi
callq 0xbe20
movq -0x328(%rbp), %rdi
movq %rax, %rcx
movl -0x3c4(%rbp), %eax
movq (%rcx), %rcx
movl 0x30(%rcx), %ecx
addl %ecx, %eax
movl %eax, -0x3c0(%rbp)
movl -0x27c(%rbp), %eax
movl %eax, %esi
callq 0xbe20
movq %rax, %rcx
movl -0x3c0(%rbp), %eax
movq (%rcx), %rcx
movl 0x34(%rcx), %ecx
addl %ecx, %eax
cvtsi2ss %rax, %xmm0
movss %xmm0, -0x3bc(%rbp)
movq -0x30(%rbp), %rax
movq %rax, %rdx
shrq %rdx
movl %eax, %ecx
andl $0x1, %ecx
orq %rdx, %rcx
cvtsi2ss %rcx, %xmm0
addss %xmm0, %xmm0
cvtsi2ss %rax, %xmm1
movss %xmm1, -0x3b8(%rbp)
testq %rax, %rax
movss %xmm0, -0x3b4(%rbp)
js 0xa24d
movss -0x3b8(%rbp), %xmm0
movss %xmm0, -0x3b4(%rbp)
movq -0x328(%rbp), %rdi
movss -0x3bc(%rbp), %xmm0
movss -0x3b4(%rbp), %xmm1
divss %xmm1, %xmm0
cvtss2sd %xmm0, %xmm0
movsd %xmm0, -0x3e8(%rbp)
movl -0x27c(%rbp), %eax
movl %eax, %esi
callq 0xbe20
movq (%rax), %rax
movl 0x27c(%rax), %eax
cvtsi2ss %rax, %xmm0
movss %xmm0, -0x3dc(%rbp)
movq -0x30(%rbp), %rax
movq %rax, %rdx
shrq %rdx
movl %eax, %ecx
andl $0x1, %ecx
orq %rdx, %rcx
cvtsi2ss %rcx, %xmm0
addss %xmm0, %xmm0
cvtsi2ss %rax, %xmm1
movss %xmm1, -0x3d8(%rbp)
testq %rax, %rax
movss %xmm0, -0x3d4(%rbp)
js 0xa2dc
movss -0x3d8(%rbp), %xmm0
movss %xmm0, -0x3d4(%rbp)
movq -0x2c8(%rbp), %rdi
movss -0x3dc(%rbp), %xmm1
movss -0x3d4(%rbp), %xmm0
divss %xmm0, %xmm1
movss 0x1fd79(%rip), %xmm0    # 0x2a078
mulss %xmm1, %xmm0
cvtss2sd %xmm0, %xmm0
movsd %xmm0, -0x400(%rbp)
movsd -0x288(%rbp), %xmm0
movsd %xmm0, -0x3f8(%rbp)
addq $0x28, %rdi
movl -0x27c(%rbp), %eax
movl %eax, %esi
callq 0xbe20
movq -0x2c8(%rbp), %rdi
movq (%rax), %rax
movl 0x1f8(%rax), %ebx
addq $0x28, %rdi
movl -0x27c(%rbp), %eax
movl %eax, %esi
callq 0xbe20
movq (%rax), %rdi
addq $0x200, %rdi            # imm = 0x200
callq 0xbe60
movq -0x2c8(%rbp), %rdi
movl %eax, -0x3f0(%rbp)
addq $0x28, %rdi
movl -0x27c(%rbp), %eax
movl %eax, %esi
callq 0xbe20
movq -0x2c8(%rbp), %rdi
movq (%rax), %rax
movl 0xfc(%rax), %eax
movl %eax, -0x3ec(%rbp)
addq $0x58, %rdi
movl -0x27c(%rbp), %eax
movl %eax, %esi
callq 0xc160
movq -0x338(%rbp), %rdi
movl -0x32c(%rbp), %ecx
movl -0x320(%rbp), %r8d
movsd -0x368(%rbp), %xmm0
movl -0x360(%rbp), %r9d
movsd -0x380(%rbp), %xmm1
movsd -0x398(%rbp), %xmm2
movsd -0x3b0(%rbp), %xmm3
movsd -0x3d0(%rbp), %xmm4
movsd -0x3e8(%rbp), %xmm5
movsd -0x400(%rbp), %xmm6
movsd -0x3f8(%rbp), %xmm7
movl -0x3f0(%rbp), %r11d
movl -0x3ec(%rbp), %r10d
movq (%rax), %rax
movl $0x200, %esi            # imm = 0x200
leaq 0x204dc(%rip), %rdx     # 0x2a8f9
movl %ebx, (%rsp)
movl %r11d, 0x8(%rsp)
movl %r10d, 0x10(%rsp)
movq %rax, 0x18(%rsp)
movb $0x8, %al
callq 0x3330
movl $0x0, -0x28c(%rbp)
movl -0x28c(%rbp), %eax
cmpl 0x2ddc4(%rip), %eax     # 0x38210
jae 0xa48c
movl $0x0, -0x290(%rbp)
movl -0x290(%rbp), %eax
cmpl 0x2ddb0(%rip), %eax     # 0x38214
jae 0xa479
jmp 0xa468
movl -0x290(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x290(%rbp)
jmp 0xa458
jmp 0xa47b
movl -0x28c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x28c(%rbp)
jmp 0xa440
movq -0x2c8(%rbp), %rdi
addq $0x28, %rdi
movl -0x27c(%rbp), %eax
movl %eax, %esi
callq 0xbe20
movq -0x2c8(%rbp), %rdi
movq (%rax), %rax
movl $0x0, 0x24(%rax)
addq $0x28, %rdi
movl -0x27c(%rbp), %eax
movl %eax, %esi
callq 0xbe20
movq -0x2c8(%rbp), %rdi
movq (%rax), %rax
movl $0x0, 0x28(%rax)
addq $0x28, %rdi
movl -0x27c(%rbp), %eax
movl %eax, %esi
callq 0xbe20
movq -0x2c8(%rbp), %rdi
movq (%rax), %rax
movl $0x0, 0x2c(%rax)
addq $0x28, %rdi
movl -0x27c(%rbp), %eax
movl %eax, %esi
callq 0xbe20
movq -0x2c8(%rbp), %rdi
movq (%rax), %rax
movl $0x0, 0x30(%rax)
addq $0x28, %rdi
movl -0x27c(%rbp), %eax
movl %eax, %esi
callq 0xbe20
movq -0x2c8(%rbp), %rdi
movq (%rax), %rax
movl $0x0, 0x34(%rax)
addq $0x28, %rdi
movl -0x27c(%rbp), %eax
movl %eax, %esi
callq 0xbe20
movq -0x2c8(%rbp), %rdi
movq (%rax), %rax
movl $0x0, 0x20(%rax)
addq $0x28, %rdi
movl -0x27c(%rbp), %eax
movl %eax, %esi
callq 0xbe20
movq -0x2c8(%rbp), %rdi
movq (%rax), %rax
movl $0x0, 0x1f8(%rax)
addq $0x28, %rdi
movl -0x27c(%rbp), %eax
movl %eax, %esi
callq 0xbe20
movq -0x2c8(%rbp), %rdi
movq (%rax), %rax
movl $0x0, 0x27c(%rax)
addq $0x40, %rdi
movl -0x27c(%rbp), %eax
movl %eax, %esi
callq 0xbec0
movq -0x2c8(%rbp), %rdi
movl $0x0, (%rax)
addq $0x28, %rdi
movl -0x27c(%rbp), %eax
movl %eax, %esi
callq 0xbe20
movq -0x2c8(%rbp), %rdi
movq (%rax), %rax
movl $0x0, 0xfc(%rax)
addq $0x1b0, %rdi            # imm = 0x1B0
movl -0x27c(%rbp), %eax
movl %eax, %esi
callq 0xbec0
movl $0x0, (%rax)
leaq -0x230(%rbp), %rsi
movq 0x2d9b4(%rip), %rdi     # 0x37fc8
callq 0x31c0
movl -0x27c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x27c(%rbp)
jmp 0x9ce1
movq -0x18(%rbp), %rdi
leaq 0x20e8f(%rip), %rsi     # 0x2b4c7
callq 0x31c0
movq 0x2d984(%rip), %rdi     # 0x37fc8
movq %rdi, -0x420(%rbp)
leaq 0x202f4(%rip), %rsi     # 0x2a946
callq 0x31c0
movq %rax, %rdi
movss -0x278(%rbp), %xmm0
movl 0x2dbc4(%rip), %eax     # 0x3822c
cvtsi2ss %rax, %xmm1
divss %xmm1, %xmm0
callq 0x3140
movq %rax, %rdi
movq 0x2d928(%rip), %rsi     # 0x37fa8
movq %rsi, -0x418(%rbp)
callq 0x3200
movq -0x420(%rbp), %rdi
leaq 0x2030d(%rip), %rsi     # 0x2a9a7
callq 0x31c0
movq -0x418(%rbp), %rsi
movq %rax, %rdi
callq 0x3200
movq -0x420(%rbp), %rdi
leaq 0x20309(%rip), %rsi     # 0x2a9c5
callq 0x31c0
movq %rax, %rdi
movq -0x2c8(%rbp), %rax
movl 0x1c8(%rax), %esi
callq 0x32d0
movq -0x418(%rbp), %rsi
movq %rax, %rdi
callq 0x3200
movq -0x420(%rbp), %rdi
leaq 0x202e1(%rip), %rsi     # 0x2a9d4
callq 0x31c0
movq %rax, %rdi
movq -0x2c8(%rbp), %rax
movl 0x1cc(%rax), %esi
callq 0x32d0
movq -0x418(%rbp), %rsi
movq %rax, %rdi
callq 0x3200
movq -0x420(%rbp), %rdi
leaq 0x202b9(%rip), %rsi     # 0x2a9e3
callq 0x31c0
movq %rax, %rdi
movq -0x238(%rbp), %rsi
callq 0x3070
movq -0x418(%rbp), %rsi
movq %rax, %rdi
callq 0x3200
movq -0x420(%rbp), %rdi
movq -0x2c8(%rbp), %rax
movl $0x0, 0x1c8(%rax)
movl $0x0, 0x1cc(%rax)
movq $0x0, -0x238(%rbp)
leaq 0x20271(%rip), %rsi     # 0x2a9f2
callq 0x31c0
movq -0x418(%rbp), %rsi
movq %rax, %rdi
callq 0x3200
movq -0x2c8(%rbp), %rax
movq -0x20(%rbp), %rcx
movq %rcx, -0x410(%rbp)
movq 0x8(%rax), %rax
movq %rax, %rdx
shrq %rdx
movl %eax, %ecx
andl $0x1, %ecx
orq %rdx, %rcx
cvtsi2ss %rcx, %xmm0
addss %xmm0, %xmm0
cvtsi2ss %rax, %xmm1
movss %xmm1, -0x408(%rbp)
testq %rax, %rax
movss %xmm0, -0x404(%rbp)
js 0xa7ec
movss -0x408(%rbp), %xmm0
movss %xmm0, -0x404(%rbp)
movq -0x410(%rbp), %rdi
movss -0x404(%rbp), %xmm0
mulss 0x2da31(%rip), %xmm0    # 0x38234
movss 0x1f865(%rip), %xmm1    # 0x2a070
divss %xmm1, %xmm0
callq 0x3140
movq %rax, %rdi
leaq 0x200d9(%rip), %rsi     # 0x2a8f7
callq 0x31c0
movb $0x0, -0x291(%rbp)
movb $0x1, -0x292(%rbp)
xorps %xmm0, %xmm0
movss %xmm0, -0x298(%rbp)
movl $0x0, -0x29c(%rbp)
movl -0x29c(%rbp), %eax
cmpl 0x2d9da(%rip), %eax     # 0x3822c
jae 0xb169
xorps %xmm0, %xmm0
movss %xmm0, -0x2a0(%rbp)
movq 0x2d75e(%rip), %rdi     # 0x37fc8
leaq 0x20193(%rip), %rsi     # 0x2aa04
callq 0x31c0
movq %rax, %rdi
movl -0x29c(%rbp), %esi
callq 0x32d0
movl $0x0, -0x2a4(%rbp)
movl -0x2a4(%rbp), %eax
cmpl 0x2d976(%rip), %eax     # 0x38210
jae 0xb0bc
movq -0x2c8(%rbp), %rdi
addq $0x28, %rdi
movq %rdi, -0x430(%rbp)
movl -0x29c(%rbp), %eax
movl %eax, %esi
callq 0xbe20
movq (%rax), %rdi
addq $0x108, %rdi            # imm = 0x108
movl -0x2a4(%rbp), %eax
movl %eax, %esi
callq 0xc160
movq (%rax), %rax
movq %rax, %rdx
shrq %rdx
movl %eax, %ecx
andl $0x1, %ecx
orq %rdx, %rcx
cvtsi2ss %rcx, %xmm0
addss %xmm0, %xmm0
cvtsi2ss %rax, %xmm1
movss %xmm1, -0x428(%rbp)
testq %rax, %rax
movss %xmm0, -0x424(%rbp)
js 0xa91a
movss -0x428(%rbp), %xmm0
movss %xmm0, -0x424(%rbp)
movss -0x424(%rbp), %xmm0
movss %xmm0, -0x43c(%rbp)
movq -0x30(%rbp), %rax
movq %rax, %rdx
shrq %rdx
movl %eax, %ecx
andl $0x1, %ecx
orq %rdx, %rcx
cvtsi2ss %rcx, %xmm0
addss %xmm0, %xmm0
cvtsi2ss %rax, %xmm1
movss %xmm1, -0x438(%rbp)
testq %rax, %rax
movss %xmm0, -0x434(%rbp)
js 0xa96f
movss -0x438(%rbp), %xmm0
movss %xmm0, -0x434(%rbp)
movq -0x430(%rbp), %rdi
movss -0x43c(%rbp), %xmm0
movss -0x434(%rbp), %xmm1
divss %xmm1, %xmm0
movss 0x2d8f2(%rip), %xmm1    # 0x38284
mulss %xmm1, %xmm0
movss 0x1f6d6(%rip), %xmm1    # 0x2a074
movss %xmm1, -0x448(%rbp)
divss %xmm1, %xmm0
movss %xmm0, -0x2a8(%rbp)
movl -0x29c(%rbp), %eax
movl %eax, %esi
callq 0xbe20
movq (%rax), %rdi
addq $0x120, %rdi            # imm = 0x120
movl -0x2a4(%rbp), %eax
movl %eax, %esi
callq 0xc160
movq (%rax), %rax
movq %rax, %rdx
shrq %rdx
movl %eax, %ecx
andl $0x1, %ecx
orq %rdx, %rcx
cvtsi2ss %rcx, %xmm0
addss %xmm0, %xmm0
cvtsi2ss %rax, %xmm1
movss %xmm1, -0x444(%rbp)
testq %rax, %rax
movss %xmm0, -0x440(%rbp)
js 0xaa1a
movss -0x444(%rbp), %xmm0
movss %xmm0, -0x440(%rbp)
movss -0x440(%rbp), %xmm0
movss %xmm0, -0x454(%rbp)
movq -0x30(%rbp), %rax
movq %rax, %rdx
shrq %rdx
movl %eax, %ecx
andl $0x1, %ecx
orq %rdx, %rcx
cvtsi2ss %rcx, %xmm0
addss %xmm0, %xmm0
cvtsi2ss %rax, %xmm1
movss %xmm1, -0x450(%rbp)
testq %rax, %rax
movss %xmm0, -0x44c(%rbp)
js 0xaa6f
movss -0x450(%rbp), %xmm0
movss %xmm0, -0x44c(%rbp)
movq -0x430(%rbp), %rdi
movss -0x448(%rbp), %xmm1
movss -0x454(%rbp), %xmm0
movss -0x44c(%rbp), %xmm2
divss %xmm2, %xmm0
movss 0x2d7ea(%rip), %xmm2    # 0x38284
mulss %xmm2, %xmm0
divss %xmm1, %xmm0
movss %xmm0, -0x2ac(%rbp)
movl -0x29c(%rbp), %eax
movl %eax, %esi
callq 0xbe20
movq (%rax), %rdi
addq $0x138, %rdi            # imm = 0x138
movl -0x2a4(%rbp), %eax
movl %eax, %esi
callq 0xc160
movq (%rax), %rax
movq %rax, %rdx
shrq %rdx
movl %eax, %ecx
andl $0x1, %ecx
orq %rdx, %rcx
cvtsi2ss %rcx, %xmm0
addss %xmm0, %xmm0
cvtsi2ss %rax, %xmm1
movss %xmm1, -0x45c(%rbp)
testq %rax, %rax
movss %xmm0, -0x458(%rbp)
js 0xab12
movss -0x45c(%rbp), %xmm0
movss %xmm0, -0x458(%rbp)
movss -0x458(%rbp), %xmm0
movss %xmm0, -0x468(%rbp)
movq -0x30(%rbp), %rax
movq %rax, %rdx
shrq %rdx
movl %eax, %ecx
andl $0x1, %ecx
orq %rdx, %rcx
cvtsi2ss %rcx, %xmm0
addss %xmm0, %xmm0
cvtsi2ss %rax, %xmm1
movss %xmm1, -0x464(%rbp)
testq %rax, %rax
movss %xmm0, -0x460(%rbp)
js 0xab67
movss -0x464(%rbp), %xmm0
movss %xmm0, -0x460(%rbp)
movq -0x430(%rbp), %rdi
movss -0x448(%rbp), %xmm1
movss -0x468(%rbp), %xmm0
movss -0x460(%rbp), %xmm2
divss %xmm2, %xmm0
movss 0x2d6f2(%rip), %xmm2    # 0x38284
mulss %xmm2, %xmm0
divss %xmm1, %xmm0
movss %xmm0, -0x2b0(%rbp)
movl -0x29c(%rbp), %eax
movl %eax, %esi
callq 0xbe20
movq (%rax), %rdi
addq $0x150, %rdi            # imm = 0x150
movl -0x2a4(%rbp), %eax
movl %eax, %esi
callq 0xc160
movq (%rax), %rax
movq %rax, %rdx
shrq %rdx
movl %eax, %ecx
andl $0x1, %ecx
orq %rdx, %rcx
cvtsi2ss %rcx, %xmm0
addss %xmm0, %xmm0
cvtsi2ss %rax, %xmm1
movss %xmm1, -0x470(%rbp)
testq %rax, %rax
movss %xmm0, -0x46c(%rbp)
js 0xac0a
movss -0x470(%rbp), %xmm0
movss %xmm0, -0x46c(%rbp)
movss -0x46c(%rbp), %xmm0
movss %xmm0, -0x47c(%rbp)
movq -0x30(%rbp), %rax
movq %rax, %rdx
shrq %rdx
movl %eax, %ecx
andl $0x1, %ecx
orq %rdx, %rcx
cvtsi2ss %rcx, %xmm0
addss %xmm0, %xmm0
cvtsi2ss %rax, %xmm1
movss %xmm1, -0x478(%rbp)
testq %rax, %rax
movss %xmm0, -0x474(%rbp)
js 0xac5f
movss -0x478(%rbp), %xmm0
movss %xmm0, -0x474(%rbp)
movq -0x430(%rbp), %rdi
movss -0x448(%rbp), %xmm1
movss -0x47c(%rbp), %xmm0
movss -0x474(%rbp), %xmm2
divss %xmm2, %xmm0
movss 0x2d5fa(%rip), %xmm2    # 0x38284
mulss %xmm2, %xmm0
divss %xmm1, %xmm0
movss %xmm0, -0x2b4(%rbp)
movl -0x29c(%rbp), %eax
movl %eax, %esi
callq 0xbe20
movq (%rax), %rdi
addq $0x138, %rdi            # imm = 0x138
movl -0x2a4(%rbp), %eax
movl %eax, %esi
callq 0xc160
movq -0x430(%rbp), %rdi
movq (%rax), %rax
movq %rax, -0x4a0(%rbp)
movl -0x29c(%rbp), %eax
movl %eax, %esi
callq 0xbe20
movq (%rax), %rdi
addq $0x108, %rdi            # imm = 0x108
movl -0x2a4(%rbp), %eax
movl %eax, %esi
callq 0xc160
movq -0x430(%rbp), %rdi
movq %rax, %rcx
movq -0x4a0(%rbp), %rax
movq (%rcx), %rcx
addq %rcx, %rax
movq %rax, -0x498(%rbp)
movl -0x29c(%rbp), %eax
movl %eax, %esi
callq 0xbe20
movq (%rax), %rdi
addq $0x120, %rdi            # imm = 0x120
movl -0x2a4(%rbp), %eax
movl %eax, %esi
callq 0xc160
movq -0x430(%rbp), %rdi
movq %rax, %rcx
movq -0x498(%rbp), %rax
movq (%rcx), %rcx
addq %rcx, %rax
movq %rax, -0x490(%rbp)
movl -0x29c(%rbp), %eax
movl %eax, %esi
callq 0xbe20
movq (%rax), %rdi
addq $0x150, %rdi            # imm = 0x150
movl -0x2a4(%rbp), %eax
movl %eax, %esi
callq 0xc160
movq %rax, %rcx
movq -0x490(%rbp), %rax
movq (%rcx), %rcx
addq %rcx, %rax
movq %rax, %rdx
shrq %rdx
movl %eax, %ecx
andl $0x1, %ecx
orq %rdx, %rcx
cvtsi2ss %rcx, %xmm0
addss %xmm0, %xmm0
cvtsi2ss %rax, %xmm1
movss %xmm1, -0x484(%rbp)
testq %rax, %rax
movss %xmm0, -0x480(%rbp)
js 0xadc8
movss -0x484(%rbp), %xmm0
movss %xmm0, -0x480(%rbp)
movss -0x480(%rbp), %xmm0
movss %xmm0, -0x4ac(%rbp)
movq -0x30(%rbp), %rax
movq %rax, %rdx
shrq %rdx
movl %eax, %ecx
andl $0x1, %ecx
orq %rdx, %rcx
cvtsi2ss %rcx, %xmm0
addss %xmm0, %xmm0
cvtsi2ss %rax, %xmm1
movss %xmm1, -0x4a8(%rbp)
testq %rax, %rax
movss %xmm0, -0x4a4(%rbp)
js 0xae1d
movss -0x4a8(%rbp), %xmm0
movss %xmm0, -0x4a4(%rbp)
movss -0x4ac(%rbp), %xmm0
movss -0x4a4(%rbp), %xmm1
divss %xmm1, %xmm0
mulss 0x2d44b(%rip), %xmm0    # 0x38284
movss 0x1f233(%rip), %xmm1    # 0x2a074
divss %xmm1, %xmm0
movss %xmm0, -0x2b8(%rbp)
movss -0x2b8(%rbp), %xmm0
addss -0x2a0(%rbp), %xmm0
movss %xmm0, -0x2a0(%rbp)
testb $0x1, -0x292(%rbp)
jne 0xafc0
movq 0x2d14f(%rip), %rdi     # 0x37fc8
leaq 0x1fb94(%rip), %rsi     # 0x2aa14
callq 0x31c0
movq %rax, %rdi
movl -0x2a4(%rbp), %esi
callq 0x32d0
movq %rax, %rdi
leaq 0x202d1(%rip), %rsi     # 0x2b16e
callq 0x31c0
testb $0x1, -0x291(%rbp)
je 0xaf7d
movl $0x4, %edi
callq 0xc180
movl %eax, -0x2bc(%rbp)
movl -0x2bc(%rbp), %esi
movq 0x2d0fc(%rip), %rdi     # 0x37fc8
callq 0x3320
movq %rax, %rdi
leaq 0x1fb47(%rip), %rsi     # 0x2aa22
callq 0x31c0
movq %rax, %rdi
movss -0x2b8(%rbp), %xmm0
callq 0x3140
movq %rax, %rdi
leaq 0x1fb2e(%rip), %rsi     # 0x2aa28
callq 0x31c0
movq %rax, %rdi
movss -0x2a8(%rbp), %xmm0
callq 0x3140
movq %rax, %rdi
leaq 0x1fb16(%rip), %rsi     # 0x2aa2f
callq 0x31c0
movq %rax, %rdi
movss -0x2ac(%rbp), %xmm0
callq 0x3140
movq %rax, %rdi
leaq 0x1fafe(%rip), %rsi     # 0x2aa36
callq 0x31c0
movq %rax, %rdi
movss -0x2b0(%rbp), %xmm0
callq 0x3140
movq %rax, %rdi
leaq 0x1fae4(%rip), %rsi     # 0x2aa3b
callq 0x31c0
movq %rax, %rdi
movss -0x2b4(%rbp), %xmm0
callq 0x3140
movq %rax, %rdi
movq 0x2d032(%rip), %rsi     # 0x37fa8
callq 0x3200
jmp 0xafbe
movl $0x4, %edi
callq 0xc180
movl %eax, -0x2c0(%rbp)
movl -0x2c0(%rbp), %esi
movq 0x2d02e(%rip), %rdi     # 0x37fc8
callq 0x3320
movq %rax, %rdi
movss -0x2b8(%rbp), %xmm0
callq 0x3140
movq %rax, %rdi
leaq 0x1fa88(%rip), %rsi     # 0x2aa41
callq 0x31c0
jmp 0xafc0
movq -0x2c8(%rbp), %rdi
addq $0x28, %rdi
movl -0x29c(%rbp), %eax
movl %eax, %esi
callq 0xbe20
movq (%rax), %rdi
addq $0x10, %rdi
addq $0xf8, %rdi
movl -0x2a4(%rbp), %eax
movl %eax, %esi
callq 0xc160
movq -0x2c8(%rbp), %rdi
movq $0x0, (%rax)
addq $0x28, %rdi
movl -0x29c(%rbp), %eax
movl %eax, %esi
callq 0xbe20
movq (%rax), %rdi
addq $0x10, %rdi
addq $0x110, %rdi            # imm = 0x110
movl -0x2a4(%rbp), %eax
movl %eax, %esi
callq 0xc160
movq -0x2c8(%rbp), %rdi
movq $0x0, (%rax)
addq $0x28, %rdi
movl -0x29c(%rbp), %eax
movl %eax, %esi
callq 0xbe20
movq (%rax), %rdi
addq $0x10, %rdi
addq $0x128, %rdi            # imm = 0x128
movl -0x2a4(%rbp), %eax
movl %eax, %esi
callq 0xc160
movq -0x2c8(%rbp), %rdi
movq $0x0, (%rax)
addq $0x28, %rdi
movl -0x29c(%rbp), %eax
movl %eax, %esi
callq 0xbe20
movq (%rax), %rdi
addq $0x10, %rdi
addq $0x140, %rdi            # imm = 0x140
movl -0x2a4(%rbp), %eax
movl %eax, %esi
callq 0xc160
movq $0x0, (%rax)
movl -0x2a4(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x2a4(%rbp)
jmp 0xa88e
movss -0x2a0(%rbp), %xmm0
addss -0x298(%rbp), %xmm0
movss %xmm0, -0x298(%rbp)
movq -0x18(%rbp), %rdi
movss -0x2a0(%rbp), %xmm0
callq 0x3140
movq %rax, %rdi
leaq 0x1f808(%rip), %rsi     # 0x2a8f7
callq 0x31c0
movq -0x20(%rbp), %rdi
movss -0x2a0(%rbp), %xmm0
callq 0x3140
movq %rax, %rdi
leaq 0x1f7e8(%rip), %rsi     # 0x2a8f7
callq 0x31c0
movq 0x2cead(%rip), %rdi     # 0x37fc8
leaq 0x1f922(%rip), %rsi     # 0x2aa44
callq 0x31c0
movq %rax, %rdi
movss -0x2a0(%rbp), %xmm0
callq 0x3140
movq %rax, %rdi
leaq 0x1f915(%rip), %rsi     # 0x2aa56
callq 0x31c0
movq %rax, %rdi
movq 0x2ce58(%rip), %rsi     # 0x37fa8
callq 0x3200
movl -0x29c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x29c(%rbp)
jmp 0xa846
movq 0x2ce58(%rip), %rdi     # 0x37fc8
movq %rdi, -0x4c8(%rbp)
leaq 0x1f8db(%rip), %rsi     # 0x2aa59
callq 0x31c0
movq %rax, %rdi
movss -0x298(%rbp), %xmm0
movl 0x2d098(%rip), %eax     # 0x3822c
cvtsi2ss %rax, %xmm1
divss %xmm1, %xmm0
callq 0x3140
movq %rax, %rdi
leaq 0x1f8aa(%rip), %rsi     # 0x2aa56
movq %rsi, -0x4d8(%rbp)
callq 0x31c0
movq %rax, %rdi
movq 0x2cde6(%rip), %rsi     # 0x37fa8
movq %rsi, -0x4d0(%rbp)
callq 0x3200
movq -0x4c8(%rbp), %rdi
leaq 0x1f892(%rip), %rsi     # 0x2aa6e
callq 0x31c0
movq %rax, %rdi
movss -0x298(%rbp), %xmm0
callq 0x3140
movq -0x4d8(%rbp), %rsi
movq %rax, %rdi
callq 0x31c0
movq -0x4d0(%rbp), %rsi
movq %rax, %rdi
callq 0x3200
movq -0x4c8(%rbp), %rdi
leaq 0x1f866(%rip), %rsi     # 0x2aa83
callq 0x31c0
movq %rax, %rdi
movl 0x2d019(%rip), %esi     # 0x38244
movl 0x2d057(%rip), %eax     # 0x38288
imull %eax, %esi
callq 0x32d0
movq -0x4d8(%rbp), %rsi
movq %rax, %rdi
callq 0x31c0
movq -0x4d0(%rbp), %rsi
movq %rax, %rdi
callq 0x3200
movq -0x4c8(%rbp), %rdi
leaq 0x1f836(%rip), %rsi     # 0x2aa9b
callq 0x31c0
movq %rax, %rdi
movl 0x2cfb9(%rip), %eax     # 0x3822c
cvtsi2ss %rax, %xmm0
movss 0x2d00c(%rip), %xmm1    # 0x3828c
mulss %xmm1, %xmm0
callq 0x3140
movq -0x4d8(%rbp), %rsi
movq %rax, %rdi
callq 0x31c0
movq -0x4d0(%rbp), %rsi
movq %rax, %rdi
callq 0x3200
movq -0x4c8(%rbp), %rdi
leaq 0x1f800(%rip), %rsi     # 0x2aab5
callq 0x31c0
movq %rax, %rdi
movss -0x298(%rbp), %xmm1
movl 0x2cf79(%rip), %eax     # 0x38244
movl 0x2cfb7(%rip), %ecx     # 0x38288
imull %ecx, %eax
cvtsi2ss %rax, %xmm0
addss %xmm0, %xmm1
movl 0x2cf49(%rip), %eax     # 0x3822c
cvtsi2ss %rax, %xmm0
movss 0x2cf9c(%rip), %xmm2    # 0x3828c
mulss %xmm2, %xmm0
addss %xmm1, %xmm0
callq 0x3140
movq -0x4d8(%rbp), %rsi
movq %rax, %rdi
callq 0x31c0
movq -0x4d0(%rbp), %rsi
movq %rax, %rdi
callq 0x3200
movq -0x18(%rbp), %rdi
leaq 0x201a1(%rip), %rsi     # 0x2b4c7
callq 0x31c0
movq %rax, %rdi
movss -0x298(%rbp), %xmm0
movl 0x2cef0(%rip), %eax     # 0x3822c
cvtsi2ss %rax, %xmm1
divss %xmm1, %xmm0
callq 0x3140
movq -0x4d0(%rbp), %rsi
movq %rax, %rdi
callq 0x3200
movq -0x20(%rbp), %rdi
movl 0x2cf25(%rip), %eax     # 0x38288
movl 0x2cedb(%rip), %ecx     # 0x38244
imull %ecx, %eax
cvtsi2ss %rax, %xmm1
movl 0x2ceb5(%rip), %eax     # 0x3822c
cvtsi2ss %rax, %xmm0
movss 0x2cf08(%rip), %xmm2    # 0x3828c
mulss %xmm2, %xmm0
addss %xmm1, %xmm0
callq 0x3140
movq %rax, %rdi
leaq 0x1f55c(%rip), %rsi     # 0x2a8f7
callq 0x31c0
movq -0x20(%rbp), %rdi
movl 0x2cede(%rip), %eax     # 0x38288
movl 0x2ce94(%rip), %ecx     # 0x38244
imull %ecx, %eax
cvtsi2ss %rax, %xmm1
movl 0x2ce6e(%rip), %eax     # 0x3822c
cvtsi2ss %rax, %xmm0
movss 0x2cec1(%rip), %xmm2    # 0x3828c
mulss %xmm2, %xmm0
addss %xmm1, %xmm0
movss -0x298(%rbp), %xmm1
addss %xmm1, %xmm0
callq 0x3140
movq -0x4d0(%rbp), %rsi
movq %rax, %rdi
callq 0x3200
movq -0x4c8(%rbp), %rdi
leaq 0x1f6c9(%rip), %rsi     # 0x2aaca
callq 0x31c0
movq -0x4d0(%rbp), %rsi
movq %rax, %rdi
callq 0x3200
movq -0x4c8(%rbp), %rdi
leaq 0x1f6b6(%rip), %rsi     # 0x2aad9
callq 0x31c0
movq %rax, %rcx
movq -0x2c8(%rbp), %rax
movq %rcx, -0x4c0(%rbp)
movq 0x8(%rax), %rax
movq %rax, %rdx
shrq %rdx
movl %eax, %ecx
andl $0x1, %ecx
orq %rdx, %rcx
cvtsi2ss %rcx, %xmm0
addss %xmm0, %xmm0
cvtsi2ss %rax, %xmm1
movss %xmm1, -0x4b4(%rbp)
testq %rax, %rax
movss %xmm0, -0x4b0(%rbp)
js 0xb47e
movss -0x4b4(%rbp), %xmm0
movss %xmm0, -0x4b0(%rbp)
movq -0x4c0(%rbp), %rdi
movss -0x4b0(%rbp), %xmm0
movss 0x2cd9f(%rip), %xmm1    # 0x38234
mulss %xmm1, %xmm0
callq 0x3140
movq %rax, %rdi
leaq 0x1fd17(%rip), %rsi     # 0x2b1bf
callq 0x31c0
movq -0x4d0(%rbp), %rsi
movq %rax, %rdi
callq 0x3200
movq -0x4c8(%rbp), %rdi
leaq 0x1f61f(%rip), %rsi     # 0x2aae9
callq 0x31c0
movq -0x2c8(%rbp), %rdi
movq %rax, -0x4e8(%rbp)
addq $0x28, %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0xbe20
movq (%rax), %rax
movq 0x8(%rax), %rax
movq %rax, %rdx
shrq %rdx
movl %eax, %ecx
andl $0x1, %ecx
orq %rdx, %rcx
cvtsi2ss %rcx, %xmm0
addss %xmm0, %xmm0
cvtsi2ss %rax, %xmm1
movss %xmm1, -0x4e0(%rbp)
testq %rax, %rax
movss %xmm0, -0x4dc(%rbp)
js 0xb532
movss -0x4e0(%rbp), %xmm0
movss %xmm0, -0x4dc(%rbp)
movq -0x4e8(%rbp), %rdi
movss -0x4dc(%rbp), %xmm0
mulss 0x2ccf3(%rip), %xmm0    # 0x3823c
callq 0x3140
movq %rax, %rdi
leaq 0x1fc67(%rip), %rsi     # 0x2b1bf
callq 0x31c0
movq %rax, %rdi
movq 0x2ca41(%rip), %rsi     # 0x37fa8
callq 0x3200
addq $0x508, %rsp            # imm = 0x508
popq %rbx
popq %rbp
retq
nopw %cs:(%rax,%rax)