// File: /workspace/github_cpp_makefile_star2_O2/dramninjasUMD[P]BOBSim/BOBWrapper.cpp
// Function: BOBSim::BOBWrapper::PrintStats(bool)
void BOBWrapper::PrintStats(bool finalPrint)
{
	float fullMean = (float)fullSum / returnedReads;
	float dramMean = (float)dramSum / returnedReads;
	float chanMean = (float)chanSum / returnedReads;

	//calculate standard deviation
	double fullstdsum = 0;
	double dramstdsum = 0;
	double chanstdsum = 0;
	unsigned fullLatMax = 0;
	unsigned fullLatMin = -1;//max unsigned value
	unsigned dramLatMax = 0;
	unsigned dramLatMin = -1;
	unsigned chanLatMax = 0;
	unsigned chanLatMin = -1;
	for(unsigned i=0; i<fullLatencies.size(); i++)
	{
		fullLatMax = max(fullLatencies[i],fullLatMax);
		fullLatMin = min(fullLatencies[i], fullLatMin);
		fullstdsum+=pow(fullLatencies[i]-fullMean,2);

		if(dramLatencies[i]>dramLatMax) dramLatMax = dramLatencies[i];
		if(dramLatencies[i]<dramLatMin) dramLatMin = dramLatencies[i];
		dramstdsum+=pow(dramLatencies[i]-dramMean,2);

		if(chanLatencies[i]>chanLatMax) chanLatMax = chanLatencies[i];
		if(chanLatencies[i]<chanLatMin) chanLatMin = chanLatencies[i];
		chanstdsum+=pow(chanLatencies[i]-chanMean,2);
	}
	double fullstddev = sqrt(fullstdsum/returnedReads);
	double dramstddev = sqrt(dramstdsum/returnedReads);
	double chanstddev = sqrt(chanstdsum/returnedReads);

	//
	//
	//check - 1E9 or 2E30????
	//
	//
	unsigned elapsedCycles;
	if(currentClockCycle%EPOCH_LENGTH==0)
	{
		elapsedCycles = EPOCH_LENGTH;
	}
	else
	{
		elapsedCycles = currentClockCycle%EPOCH_LENGTH;
	}


	double bandwidth = ((issuedWrites+returnedReads)*TRANSACTION_SIZE)/(double)(elapsedCycles*CPU_CLK_PERIOD*1E-9)/(1<<30);

	double rw_ratio = ((double)returnedReads/(double)committedWrites)*100.0f;

	statsOut  <<currentClockCycle*CPU_CLK_PERIOD/1000000<< ","<< setprecision(4) << bandwidth << "," << fullMean*CPU_CLK_PERIOD<<","<<rw_ratio<<",;";

	totalTransactionsServiced += (issuedWrites + returnedReads);
	totalReturnedReads += returnedReads;
	totalIssuedWrites += issuedWrites;

	PRINT("==================Epoch ["<<currentClockCycle/EPOCH_LENGTH<<"]=======================");
	PRINT("per epoch] reads   : "<<returnedReads<<" writes : "<<issuedWrites<<" ("<<(float)returnedReads/(float)(returnedReads+issuedWrites)*100<<"% Reads) : "<<returnedReads+issuedWrites);
	PRINT("lifetime ] reads   : "<<totalReturnedReads<<" writes : "<<totalIssuedWrites<<" total : "<<totalTransactionsServiced);
	PRINT("issued logic ops   : "<<issuedLogicOperations<< " returned logic responses : "<<totalLogicResponses);
	PRINT("bandwidth          : "<<bandwidth<<" GB/sec");
	PRINT("current cycle      : "<<currentClockCycle);
	PRINT("--------------------------");
	PRINT("full time mean  : "<<fullMean*CPU_CLK_PERIOD<<" ns");
	PRINT("          std   : "<<fullstddev*CPU_CLK_PERIOD<<" ns");
	PRINT("          min   : "<<fullLatMin*CPU_CLK_PERIOD<<" ns");
	PRINT("          max   : "<<fullLatMax*CPU_CLK_PERIOD<<" ns");
	PRINT("chan time mean  : "<<chanMean*CPU_CLK_PERIOD<<" ns");
	PRINT("           std  : "<<chanstddev*CPU_CLK_PERIOD);
	PRINT("           min  : "<<chanLatMin*CPU_CLK_PERIOD<<" ns");
	PRINT("           max  : "<<chanLatMax*CPU_CLK_PERIOD<<" ns");
	PRINT("dram time mean  : "<<dramMean*CPU_CLK_PERIOD<<" ns");
	PRINT("          std   : "<<dramstddev*CPU_CLK_PERIOD<<" ns");
	PRINT("          min   : "<<dramLatMin*CPU_CLK_PERIOD<<" ns");
	PRINT("          max   : "<<dramLatMax*CPU_CLK_PERIOD<<" ns");
	PRINT("-- Per Channel Latency Components in nanoseconds (All from READs) : ");
	maxReadsPerCycle = maxWritesPerCycle = 0;
	PRINT("      reqPort    reqLink     workQ    access     rrq    rspLink   rspPort  total");
	for(unsigned i=0; i<NUM_CHANNELS; i++)
	{
		float tempSum=0;
		unsigned tempMax=0;
		unsigned tempMin=-1;
		double stdsum=0;
		double mean=0;
		double reqLinkSum=0;
		double rspLinkSum=0;
		double reqPortSum=0;
		double rspPortSum=0;
		double vSum=0;
		double rrqSum=0;
		double workQSum=0;

		for(unsigned j=0; j<perChanFullLatencies[i].size(); j++)
		{
			if(perChanFullLatencies[i][j]>tempMax) tempMax = perChanFullLatencies[i][j];
			if(perChanFullLatencies[i][j]<tempMin) tempMin = perChanFullLatencies[i][j];

			tempSum+=perChanFullLatencies[i][j];
			reqLinkSum+=perChanReqLink[i][j];
			rspLinkSum+=perChanRspLink[i][j];
			reqPortSum+=perChanReqPort[i][j];
			rspPortSum+=perChanRspPort[i][j];
			vSum+=perChanAccess[i][j];
			rrqSum+=perChanRRQ[i][j];
			workQSum+=perChanWorkQTimes[i][j];
		}

		mean=tempSum/(float)perChanFullLatencies[i].size();

		//write per channel latency to stats file
		statsOut<<CPU_CLK_PERIOD*mean<<",";

		for(unsigned j=0; j<perChanFullLatencies[i].size(); j++)
		{
			stdsum+=pow(perChanFullLatencies[i][j]-mean,2);
		}

#define MAX_STR 512
		char tmp_str[MAX_STR];

		snprintf(tmp_str,MAX_STR,"%d]%10.4f%10.4f%10.4f%10.4f%10.4f%10.4f%10.4f%10.4f\n",
		         i,
		         CPU_CLK_PERIOD*(reqPortSum/perChanReqPort[i].size()),
		         CPU_CLK_PERIOD*(reqLinkSum/perChanReqLink[i].size()),
		         CPU_CLK_PERIOD*(workQSum/perChanWorkQTimes[i].size()),
		         CPU_CLK_PERIOD*(vSum/perChanAccess[i].size()),
		         CPU_CLK_PERIOD*(rrqSum/perChanRRQ[i].size()),
		         CPU_CLK_PERIOD*(rspLinkSum/perChanRspLink[i].size()),
		         CPU_CLK_PERIOD*(rspPortSum/perChanRspPort[i].size()),
		         CPU_CLK_PERIOD*(mean));

		PRINTN(tmp_str);
		//clear
		perChanWorkQTimes[i].clear();
		perChanFullLatencies[i].clear();
		perChanReqLink[i].clear();
		perChanRspLink[i].clear();
		perChanReqPort[i].clear();
		perChanRspPort[i].clear();
		perChanAccess[i].clear();
		perChanRRQ[i].clear();
	}

	PRINT(" ---  Port stats (per epoch) : ");
	for(unsigned i=0; i<NUM_PORTS; i++)
	{
		PRINTN(" "<<i<<"] ");
		PRINTN(" request: "<<(float)requestPortEmptyCount[i]/(elapsedCycles)*100.0<<"\% idle ");
		PRINTN(" response: "<<(float)responsePortEmptyCount[i]/(elapsedCycles)*100.0<<"\% idle ");
		PRINTN(" rds:"<<readsPerPort[i]);
		PRINTN(" wrts:"<<writesPerPort[i]);
		PRINTN(" rtn:"<<returnsPerPort[i]);
		PRINT(" tot:"<<requestCounterPerPort[i]);

		//clear
		returnsPerPort[i]=0;
		writesPerPort[i]=0;
		readsPerPort[i]=0;
		responsePortEmptyCount[i]=0;
		requestPortEmptyCount[i]=0;
		requestCounterPerPort[i]=0;
	}

	issuedWrites = 0;
	returnedReads = 0;
	fullSum = 0;
	dramSum = 0;
	chanSum = 0;

	fullLatencies.clear();
	dramLatencies.clear();
	chanLatencies.clear();
	bob->PrintStats(statsOut, powerOut, finalPrint, elapsedCycles);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x298, %rsp            # imm = 0x298
movl %esi, 0x4c(%rsp)
movq %rdi, %rbx
movl 0x298(%rdi), %eax
cvtsi2ss %rax, %xmm1
movupd 0x268(%rdi), %xmm2
movss 0x248(%rdi), %xmm0
unpcklps %xmm0, %xmm2            # xmm2 = xmm2[0],xmm0[0],xmm2[1],xmm0[1]
xorpd %xmm5, %xmm5
unpcklps %xmm5, %xmm2            # xmm2 = xmm2[0],xmm5[0],xmm2[1],xmm5[1]
movapd 0x6f61(%rip), %xmm0     # 0xf0b0
orpd %xmm0, %xmm2
subpd %xmm0, %xmm2
movl 0x288(%rdi), %ecx
cvtsi2ss %rcx, %xmm4
cvtpd2ps %xmm2, %xmm3
divss %xmm1, %xmm4
shufps $0x0, %xmm1, %xmm1      # xmm1 = xmm1[0,0,0,0]
divps %xmm1, %xmm3
movq 0x230(%rdi), %rcx
movq 0x238(%rdi), %rdx
subq %rcx, %rdx
sarq $0x2, %rdx
movq 0x250(%rdi), %rsi
movq 0x270(%rdi), %rdi
xorpd %xmm6, %xmm6
pushq $-0x1
popq %rbp
xorl %r15d, %r15d
movl %ebp, %r13d
xorl %r8d, %r8d
xorl %r14d, %r14d
movl %ebp, %r11d
xorl %r10d, %r10d
movl %r8d, %r8d
cmpq %r8, %rdx
jbe 0x8232
movl (%rcx,%r8,4), %r9d
cmpl %r15d, %r9d
cmoval %r9d, %r15d
cmpl %r9d, %ebp
cmovael %r9d, %ebp
movl (%rsi,%r8,4), %r9d
cmpl %r10d, %r9d
cmoval %r9d, %r10d
cmpl %r11d, %r9d
cmovbl %r9d, %r11d
movss (%rcx,%r8,4), %xmm1
movss (%rsi,%r8,4), %xmm2
unpcklpd %xmm1, %xmm2            # xmm2 = xmm2[0],xmm1[0]
orpd %xmm0, %xmm2
subpd %xmm0, %xmm2
cvtpd2ps %xmm2, %xmm1
subps %xmm3, %xmm1
cvtps2pd %xmm1, %xmm1
mulpd %xmm1, %xmm1
movl (%rdi,%r8,4), %r9d
cmpl %r14d, %r9d
cmoval %r9d, %r14d
addpd %xmm1, %xmm5
cmpl %r13d, %r9d
cmovbl %r9d, %r13d
cvtsi2ss %r9, %xmm1
subss %xmm4, %xmm1
cvtss2sd %xmm1, %xmm1
mulsd %xmm1, %xmm1
addsd %xmm1, %xmm6
incl %r8d
jmp 0x81ad
movl %eax, %eax
cvtsi2sd %rax, %xmm1
movapd %xmm5, %xmm0
unpckhpd %xmm5, %xmm0            # xmm0 = xmm0[1],xmm5[1]
divsd %xmm1, %xmm0
xorpd %xmm1, %xmm1
ucomisd %xmm1, %xmm0
movl %r10d, 0x40(%rsp)
movl %r11d, 0x38(%rsp)
movaps %xmm3, 0x60(%rsp)
movss %xmm4, 0x30(%rsp)
movsd %xmm6, 0x8(%rsp)
jb 0x8270
sqrtsd %xmm0, %xmm0
jmp 0x8285
movapd %xmm5, 0x50(%rsp)
callq 0x2150
xorpd %xmm1, %xmm1
movapd 0x50(%rsp), %xmm5
movsd %xmm0, 0x10(%rsp)
movl 0x298(%rbx), %eax
cvtsi2sd %rax, %xmm0
divsd %xmm0, %xmm5
ucomisd %xmm1, %xmm5
jb 0x82a6
sqrtsd %xmm5, %xmm0
jmp 0x82af
movapd %xmm5, %xmm0
callq 0x2150
movsd %xmm0, 0x20(%rsp)
movsd 0x8(%rsp), %xmm0
movl 0x298(%rbx), %eax
cvtsi2sd %rax, %xmm1
divsd %xmm1, %xmm0
xorpd %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jb 0x82da
sqrtsd %xmm0, %xmm0
jmp 0x82df
callq 0x2150
movsd %xmm0, 0x18(%rsp)
movq 0x8(%rbx), %rcx
xorl %r12d, %r12d
movl $0xf4240, %esi          # imm = 0xF4240
movq %rcx, %rax
xorl %edx, %edx
divq %rsi
testq %rdx, %rdx
movl $0xf4240, %esi          # imm = 0xF4240
cmovnel %edx, %esi
movl 0x298(%rbx), %eax
movl 0x290(%rbx), %edx
addl %eax, %edx
shll $0x6, %edx
cvtsi2sd %rdx, %xmm2
movl %esi, 0x48(%rsp)
cvtsi2ss %esi, %xmm0
movss 0x6d1e(%rip), %xmm1     # 0xf048
movss %xmm0, 0x8(%rsp)
mulss %xmm1, %xmm0
cvtss2sd %xmm0, %xmm0
mulsd 0x7538(%rip), %xmm0     # 0xf878
divsd %xmm0, %xmm2
mulsd 0x6d44(%rip), %xmm2     # 0xf090
movsd %xmm2, 0x50(%rsp)
cvtsi2sd %rax, %xmm2
movl 0x294(%rbx), %eax
cvtsi2sd %rax, %xmm0
divsd %xmm0, %xmm2
mulsd 0x7512(%rip), %xmm2     # 0xf880
movsd %xmm2, 0x78(%rsp)
leaq 0x2b0(%rbx), %rax
movq %rax, 0x28(%rsp)
testq %rcx, %rcx
js 0x838c
cvtsi2ss %rcx, %xmm0
jmp 0x83a1
movq %rcx, %rax
shrq %rax
andl $0x1, %ecx
orq %rax, %rcx
cvtsi2ss %rcx, %xmm0
addss %xmm0, %xmm0
mulss %xmm1, %xmm0
divss 0x6c9f(%rip), %xmm0     # 0xf04c
movq 0x28(%rsp), %rdi
callq 0x2120
leaq 0x71dc(%rip), %rsi      # 0xf59a
movq %rax, %rdi
callq 0x2180
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
movq $0x4, 0x8(%rax,%rcx)
movq %rax, %rdi
movsd 0x50(%rsp), %xmm0
callq 0x2290
movq %rax, %rdi
leaq 0x71ac(%rip), %rsi      # 0xf59a
callq 0x2180
movaps 0x60(%rsp), %xmm0
shufps $0x55, %xmm0, %xmm0     # xmm0 = xmm0[1,1,1,1]
mulss 0x6c44(%rip), %xmm0     # 0xf048
movaps %xmm0, 0x80(%rsp)
movq %rax, %rdi
callq 0x2120
movq %rax, %rdi
leaq 0x717c(%rip), %rsi      # 0xf59a
callq 0x2180
movq %rax, %rdi
movsd 0x78(%rsp), %xmm0
callq 0x2290
leaq 0x78a7(%rip), %rsi      # 0xfcdf
movq %rax, %rdi
callq 0x2180
movl 0x290(%rbx), %eax
movl 0x298(%rbx), %ecx
leal (%rcx,%rax), %edx
addl %edx, 0x2a4(%rbx)
addl %ecx, 0x29c(%rbx)
addl %eax, 0x2a0(%rbx)
movq 0xdb60(%rip), %rdi      # 0x15fc8
leaq 0x7873(%rip), %rsi      # 0xfce2
callq 0x2180
movq %rax, %rdi
movq 0x8(%rbx), %rax
xorl %edx, %edx
movl $0xf4240, %ecx          # imm = 0xF4240
divq %rcx
movq %rax, %rsi
callq 0x2100
leaq 0x7868(%rip), %rsi      # 0xfcfc
movq %rax, %rdi
callq 0x2180
movq %rax, %rdi
callq 0x20b0
leaq 0x786a(%rip), %rsi      # 0xfd15
movq 0xdb16(%rip), %rdi      # 0x15fc8
callq 0x2180
movl 0x298(%rbx), %esi
movq %rax, %rdi
callq 0x2100
leaq 0x785f(%rip), %rsi      # 0xfd2b
movq %rax, %rdi
callq 0x2180
movl 0x290(%rbx), %esi
movq %rax, %rdi
callq 0x2100
leaq 0x6c9d(%rip), %rsi      # 0xf186
movq %rax, %rdi
callq 0x2180
movl 0x298(%rbx), %ecx
cvtsi2ss %rcx, %xmm0
movl 0x290(%rbx), %edx
addl %ecx, %edx
cvtsi2ss %rdx, %xmm1
divss %xmm1, %xmm0
mulss 0x6b2b(%rip), %xmm0     # 0xf040
movq %rax, %rdi
callq 0x2120
leaq 0x7812(%rip), %rsi      # 0xfd36
movq %rax, %rdi
callq 0x2180
movl 0x290(%rbx), %esi
addl 0x298(%rbx), %esi
movq %rax, %rdi
callq 0x2100
movq %rax, %rdi
callq 0x20b0
leaq 0x77f3(%rip), %rsi      # 0xfd42
movq 0xda72(%rip), %rdi      # 0x15fc8
callq 0x2180
movl 0x29c(%rbx), %esi
movq %rax, %rdi
callq 0x2100
movq %rax, %rdi
leaq 0x77b8(%rip), %rsi      # 0xfd2b
callq 0x2180
movl 0x2a0(%rbx), %esi
movq %rax, %rdi
callq 0x2100
leaq 0x77cb(%rip), %rsi      # 0xfd58
movq %rax, %rdi
callq 0x2180
movl 0x2a4(%rbx), %esi
movq %rax, %rdi
callq 0x2100
movq %rax, %rdi
callq 0x20b0
leaq 0x77b0(%rip), %rsi      # 0xfd62
movq 0xda0f(%rip), %rdi      # 0x15fc8
callq 0x2180
movl 0x28c(%rbx), %esi
movq %rax, %rdi
callq 0x2100
leaq 0x77a5(%rip), %rsi      # 0xfd78
movq %rax, %rdi
callq 0x2180
movl 0x2a8(%rbx), %esi
movq %rax, %rdi
callq 0x2100
movq %rax, %rdi
callq 0x20b0
leaq 0x779d(%rip), %rsi      # 0xfd95
movq 0xd9c9(%rip), %rdi      # 0x15fc8
callq 0x2180
movq %rax, %rdi
movsd 0x50(%rsp), %xmm0
callq 0x2290
leaq 0x7792(%rip), %rsi      # 0xfdab
movq %rax, %rdi
callq 0x2180
movq %rax, %rdi
callq 0x20b0
leaq 0x7783(%rip), %rsi      # 0xfdb3
movq 0xd991(%rip), %rdi      # 0x15fc8
callq 0x2180
movq 0x8(%rbx), %rsi
movq %rax, %rdi
callq 0x2100
movq %rax, %rdi
callq 0x20b0
leaq 0x7772(%rip), %rsi      # 0xfdc9
movq 0xd96a(%rip), %rdi      # 0x15fc8
callq 0x2180
movq %rax, %rdi
callq 0x20b0
leaq 0x7772(%rip), %rsi      # 0xfde4
movq 0xd94f(%rip), %rdi      # 0x15fc8
callq 0x2180
movq %rax, %rdi
movaps 0x80(%rsp), %xmm0
callq 0x2120
leaq 0x7762(%rip), %rsi      # 0xfdf7
movq %rax, %rdi
callq 0x2180
movq %rax, %rdi
callq 0x20b0
leaq 0x774f(%rip), %rsi      # 0xfdfb
movq 0xd915(%rip), %rdi      # 0x15fc8
callq 0x2180
movsd 0x10(%rsp), %xmm0
mulsd 0x71c2(%rip), %xmm0     # 0xf888
movq %rax, %rdi
callq 0x2290
movq %rax, %rdi
leaq 0x771f(%rip), %rsi      # 0xfdf7
callq 0x2180
movq %rax, %rdi
callq 0x20b0
leaq 0x7722(%rip), %rsi      # 0xfe0e
movq 0xd8d5(%rip), %rdi      # 0x15fc8
callq 0x2180
movl %ebp, %ecx
cvtsi2ss %rcx, %xmm0
mulss 0x6941(%rip), %xmm0     # 0xf048
movq %rax, %rdi
callq 0x2120
movq %rax, %rdi
leaq 0x76de(%rip), %rsi      # 0xfdf7
callq 0x2180
movq %rax, %rdi
callq 0x20b0
leaq 0x76f4(%rip), %rsi      # 0xfe21
movq 0xd894(%rip), %rdi      # 0x15fc8
callq 0x2180
movl %r15d, %ecx
cvtsi2ss %rcx, %xmm0
mulss 0x68ff(%rip), %xmm0     # 0xf048
movq %rax, %rdi
callq 0x2120
movq %rax, %rdi
leaq 0x769c(%rip), %rbp      # 0xfdf7
movq %rbp, %rsi
callq 0x2180
movq %rax, %rdi
callq 0x20b0
leaq 0x76c2(%rip), %rsi      # 0xfe34
movq 0xd84f(%rip), %r15      # 0x15fc8
movq %r15, %rdi
callq 0x2180
movss 0x30(%rsp), %xmm0
mulss 0x68b9(%rip), %xmm0     # 0xf048
movq %rax, %rdi
callq 0x2120
movq %rax, %rdi
movq %rbp, %rsi
callq 0x2180
movq %rax, %rdi
callq 0x20b0
leaq 0x7696(%rip), %rsi      # 0xfe47
movq %r15, %rdi
callq 0x2180
movsd 0x18(%rsp), %xmm0
mulsd 0x70c1(%rip), %xmm0     # 0xf888
movq %rax, %rdi
callq 0x2290
movq %rax, %rdi
callq 0x20b0
leaq 0x767c(%rip), %rsi      # 0xfe5a
movq %r15, %rdi
callq 0x2180
movl %r13d, %ecx
cvtsi2ss %rcx, %xmm0
mulss 0x6852(%rip), %xmm0     # 0xf048
movq %rax, %rdi
callq 0x2120
movq %rax, %rdi
movq %rbp, %rsi
callq 0x2180
movq %rax, %rdi
callq 0x20b0
leaq 0x7655(%rip), %rsi      # 0xfe6d
movq %r15, %rdi
callq 0x2180
movl %r14d, %ecx
cvtsi2ss %rcx, %xmm0
mulss 0x6818(%rip), %xmm0     # 0xf048
movq %rax, %rdi
callq 0x2120
movq %rax, %rdi
movq %rbp, %rsi
callq 0x2180
movq %rax, %rdi
callq 0x20b0
leaq 0x762e(%rip), %rsi      # 0xfe80
movq %r15, %rdi
callq 0x2180
movaps 0x60(%rsp), %xmm0
mulss 0x67e1(%rip), %xmm0     # 0xf048
movq %rax, %rdi
callq 0x2120
movq %rax, %rdi
movq %rbp, %rsi
callq 0x2180
movq %rax, %rdi
callq 0x20b0
movq %r15, %rdi
leaq 0x756f(%rip), %rsi      # 0xfdfb
callq 0x2180
movsd 0x20(%rsp), %xmm0
mulsd 0x6fe9(%rip), %xmm0     # 0xf888
movq %rax, %rdi
callq 0x2290
movq %rax, %rdi
movq %rbp, %rsi
callq 0x2180
movq %rax, %rdi
callq 0x20b0
movq %r15, %rdi
leaq 0x754a(%rip), %rsi      # 0xfe0e
callq 0x2180
movl 0x38(%rsp), %ecx
cvtsi2ss %rcx, %xmm0
mulss 0x676e(%rip), %xmm0     # 0xf048
movq %rax, %rdi
callq 0x2120
movq %rax, %rdi
movq %rbp, %rsi
callq 0x2180
movq %rax, %rdi
callq 0x20b0
movq %r15, %rdi
leaq 0x7522(%rip), %rsi      # 0xfe21
callq 0x2180
movl 0x40(%rsp), %ecx
cvtsi2ss %rcx, %xmm0
mulss 0x6733(%rip), %xmm0     # 0xf048
movq %rax, %rdi
callq 0x2120
movq %rax, %rdi
movq %rbp, %rsi
callq 0x2180
movq %rax, %rdi
callq 0x20b0
leaq 0x755c(%rip), %rsi      # 0xfe93
movq %r15, %rdi
callq 0x2180
movq %rax, %rdi
callq 0x20b0
xorps %xmm0, %xmm0
movups %xmm0, 0xa8(%rbx)
leaq 0x7580(%rip), %rsi      # 0xfed8
movq %r15, %rdi
callq 0x2180
movq %rax, %rdi
callq 0x20b0
leaq 0x90(%rsp), %r13
cmpq $0x8, %r12
je 0x8dc0
movq 0x170(%rbx), %rax
imulq $0x18, %r12, %r15
movq (%rax,%r15), %rcx
movq 0x8(%rax,%r15), %rax
subq %rcx, %rax
sarq $0x2, %rax
movq 0x1b8(%rbx), %rdx
addq %r15, %rdx
movq 0x1d0(%rbx), %rsi
addq %r15, %rsi
movq 0x188(%rbx), %rdi
addq %r15, %rdi
movq 0x1a0(%rbx), %r8
addq %r15, %r8
movq 0x1e8(%rbx), %r9
addq %r15, %r9
movq 0x200(%rbx), %r10
addq %r15, %r10
movq 0x218(%rbx), %r11
addq %r15, %r11
xorl %ebp, %ebp
xorps %xmm3, %xmm3
xorps %xmm0, %xmm0
xorps %xmm4, %xmm4
xorpd %xmm8, %xmm8
xorpd %xmm5, %xmm5
xorpd %xmm6, %xmm6
xorpd %xmm7, %xmm7
xorpd %xmm9, %xmm9
movl %ebp, %ebp
cmpq %rbp, %rax
jbe 0x8a8d
movl (%rcx,%rbp,4), %r14d
cvtsi2ss %r14, %xmm1
addss %xmm1, %xmm0
movq (%rdx), %r14
movl (%r14,%rbp,4), %r14d
cvtsi2sd %r14, %xmm1
movq (%rsi), %r14
movl (%r14,%rbp,4), %r14d
cvtsi2sd %r14, %xmm2
addsd %xmm1, %xmm3
addsd %xmm2, %xmm4
movq (%rdi), %r14
movl (%r14,%rbp,4), %r14d
cvtsi2sd %r14, %xmm1
addsd %xmm1, %xmm8
movq (%r8), %r14
movl (%r14,%rbp,4), %r14d
cvtsi2sd %r14, %xmm1
addsd %xmm1, %xmm5
movq (%r9), %r14
movl (%r14,%rbp,4), %r14d
cvtsi2sd %r14, %xmm1
movq (%r10), %r14
movl (%r14,%rbp,4), %r14d
cvtsi2sd %r14, %xmm2
addsd %xmm1, %xmm6
addsd %xmm2, %xmm7
movq (%r11), %r14
movl (%r14,%rbp,4), %r14d
cvtsi2sd %r14, %xmm1
addsd %xmm1, %xmm9
incl %ebp
jmp 0x89fc
cvtsi2ss %rax, %xmm1
divss %xmm1, %xmm0
cvtss2sd %xmm0, %xmm1
movsd 0x6de6(%rip), %xmm0     # 0xf888
mulsd %xmm0, %xmm1
movsd %xmm1, 0x60(%rsp)
movq 0x28(%rsp), %rdi
movapd %xmm1, %xmm0
movsd %xmm3, 0x18(%rsp)
movsd %xmm4, 0x40(%rsp)
movsd %xmm5, 0x50(%rsp)
movsd %xmm6, 0x30(%rsp)
movsd %xmm7, 0x38(%rsp)
movsd %xmm8, 0x10(%rsp)
movsd %xmm9, 0x20(%rsp)
callq 0x2290
movq %rax, %rdi
leaq 0x6aaa(%rip), %rsi      # 0xf59a
callq 0x2180
movq 0x188(%rbx), %rcx
movq 0x1a0(%rbx), %rax
movq 0x8(%rcx,%r15), %rdx
subq (%rcx,%r15), %rdx
sarq $0x2, %rdx
movq %rdx, %xmm0
movq 0x65c2(%rip), %xmm8     # 0xf0e0
punpckldq %xmm8, %xmm0    # xmm0 = xmm0[0],xmm8[0],xmm0[1],xmm8[1]
movapd 0x65c5(%rip), %xmm6     # 0xf0f0
subpd %xmm6, %xmm0
movapd %xmm0, %xmm1
unpckhpd %xmm0, %xmm1            # xmm1 = xmm1[1],xmm0[1]
addsd %xmm0, %xmm1
movsd 0x10(%rsp), %xmm0
divsd %xmm1, %xmm0
movsd 0x6d3a(%rip), %xmm10    # 0xf888
mulsd %xmm10, %xmm0
movq 0x1b8(%rbx), %rcx
movq 0x8(%rcx,%r15), %rdx
subq (%rcx,%r15), %rdx
sarq $0x2, %rdx
movq %rdx, %xmm2
punpckldq %xmm8, %xmm2    # xmm2 = xmm2[0],xmm8[0],xmm2[1],xmm8[1]
subpd %xmm6, %xmm2
movapd %xmm2, %xmm1
unpckhpd %xmm2, %xmm1            # xmm1 = xmm1[1],xmm2[1]
addsd %xmm2, %xmm1
movsd 0x18(%rsp), %xmm2
divsd %xmm1, %xmm2
mulsd %xmm10, %xmm2
movapd %xmm2, %xmm1
movq 0x218(%rbx), %rcx
movq 0x8(%rcx,%r15), %rdx
subq (%rcx,%r15), %rdx
sarq $0x2, %rdx
movq %rdx, %xmm2
punpckldq %xmm8, %xmm2    # xmm2 = xmm2[0],xmm8[0],xmm2[1],xmm8[1]
subpd %xmm6, %xmm2
movapd %xmm2, %xmm3
unpckhpd %xmm2, %xmm3            # xmm3 = xmm3[1],xmm2[1]
addsd %xmm2, %xmm3
movsd 0x20(%rsp), %xmm2
divsd %xmm3, %xmm2
movq 0x1e8(%rbx), %rcx
movq 0x8(%rcx,%r15), %rdx
subq (%rcx,%r15), %rdx
mulsd %xmm10, %xmm2
sarq $0x2, %rdx
movq %rdx, %xmm3
punpckldq %xmm8, %xmm3    # xmm3 = xmm3[0],xmm8[0],xmm3[1],xmm8[1]
subpd %xmm6, %xmm3
movapd %xmm3, %xmm4
unpckhpd %xmm3, %xmm4            # xmm4 = xmm4[1],xmm3[1]
addsd %xmm3, %xmm4
movsd 0x30(%rsp), %xmm3
divsd %xmm4, %xmm3
mulsd %xmm10, %xmm3
movq 0x200(%rbx), %rcx
movq 0x8(%rcx,%r15), %rdx
subq (%rcx,%r15), %rdx
sarq $0x2, %rdx
movq %rdx, %xmm4
punpckldq %xmm8, %xmm4    # xmm4 = xmm4[0],xmm8[0],xmm4[1],xmm8[1]
subpd %xmm6, %xmm4
movapd %xmm4, %xmm5
unpckhpd %xmm4, %xmm5            # xmm5 = xmm5[1],xmm4[1]
addsd %xmm4, %xmm5
movsd 0x38(%rsp), %xmm4
divsd %xmm5, %xmm4
mulsd %xmm10, %xmm4
movq 0x1d0(%rbx), %rcx
movq 0x8(%rcx,%r15), %rdx
subq (%rcx,%r15), %rdx
sarq $0x2, %rdx
movq %rdx, %xmm5
punpckldq %xmm8, %xmm5    # xmm5 = xmm5[0],xmm8[0],xmm5[1],xmm8[1]
subpd %xmm6, %xmm5
movapd %xmm5, %xmm7
unpckhpd %xmm5, %xmm7            # xmm7 = xmm7[1],xmm5[1]
addsd %xmm5, %xmm7
movsd 0x40(%rsp), %xmm5
divsd %xmm7, %xmm5
mulsd %xmm10, %xmm5
movq 0x8(%rax,%r15), %rcx
subq (%rax,%r15), %rcx
sarq $0x2, %rcx
movq %rcx, %xmm9
punpckldq %xmm8, %xmm9    # xmm9 = xmm9[0],xmm8[0],xmm9[1],xmm8[1]
subpd %xmm6, %xmm9
movapd %xmm9, %xmm7
unpckhpd %xmm9, %xmm7            # xmm7 = xmm7[1],xmm9[1]
addsd %xmm9, %xmm7
movsd 0x50(%rsp), %xmm6
divsd %xmm7, %xmm6
mulsd %xmm10, %xmm6
movl $0x200, %esi            # imm = 0x200
movq %r13, %rdi
leaq 0x7258(%rip), %rdx      # 0xff29
movl %r12d, %ecx
movsd 0x60(%rsp), %xmm7
movb $0x8, %al
callq 0x2280
movq 0xd2e0(%rip), %rdi      # 0x15fc8
movq %r13, %rsi
callq 0x2180
movq 0x218(%rbx), %rax
movq (%rax,%r15), %rcx
cmpq %rcx, 0x8(%rax,%r15)
je 0x8d09
addq %r15, %rax
movq %rcx, 0x8(%rax)
movq 0x170(%rbx), %rax
movq (%rax,%r15), %rcx
cmpq %rcx, 0x8(%rax,%r15)
je 0x8d22
addq %r15, %rax
movq %rcx, 0x8(%rax)
movq 0x1b8(%rbx), %rax
movq (%rax,%r15), %rcx
cmpq %rcx, 0x8(%rax,%r15)
je 0x8d3b
addq %r15, %rax
movq %rcx, 0x8(%rax)
movq 0x1d0(%rbx), %rax
movq (%rax,%r15), %rcx
cmpq %rcx, 0x8(%rax,%r15)
je 0x8d54
addq %r15, %rax
movq %rcx, 0x8(%rax)
movq 0x188(%rbx), %rax
movq (%rax,%r15), %rcx
cmpq %rcx, 0x8(%rax,%r15)
je 0x8d6d
addq %r15, %rax
movq %rcx, 0x8(%rax)
movq 0x1a0(%rbx), %rax
movq (%rax,%r15), %rcx
cmpq %rcx, 0x8(%rax,%r15)
je 0x8d86
addq %r15, %rax
movq %rcx, 0x8(%rax)
movq 0x1e8(%rbx), %rax
movq (%rax,%r15), %rcx
cmpq %rcx, 0x8(%rax,%r15)
je 0x8d9f
addq %r15, %rax
movq %rcx, 0x8(%rax)
movq 0x200(%rbx), %rax
movq (%rax,%r15), %rcx
cmpq %rcx, 0x8(%rax,%r15)
je 0x8db8
addq %r15, %rax
movq %rcx, 0x8(%rax)
incq %r12
jmp 0x8970
movq 0xd201(%rip), %r14      # 0x15fc8
leaq 0x7190(%rip), %rsi      # 0xff5e
movq %r14, %rdi
callq 0x2180
movq %rax, %rdi
callq 0x20b0
xorl %r12d, %r12d
leaq 0x71a4(%rip), %r13      # 0xff8c
leaq 0x71be(%rip), %r15      # 0xffad
leaq 0x71bd(%rip), %rbp      # 0xffb3
leaq 0xd3b3(%rip), %rax      # 0x161b0
movl (%rax), %eax
cmpq %rax, %r12
jae 0x8f95
movq %r14, %rdi
leaq 0x66a7(%rip), %rsi      # 0xf4b9
callq 0x2180
movq %rax, %rdi
movq %r12, %rsi
callq 0x2100
movq %rax, %rdi
leaq 0x7152(%rip), %rsi      # 0xff7e
callq 0x2180
movq %r14, %rdi
leaq 0x7146(%rip), %rsi      # 0xff81
callq 0x2180
movq 0xc8(%rbx), %rcx
movl (%rcx,%r12,4), %ecx
cvtsi2ss %rcx, %xmm0
divss 0x8(%rsp), %xmm0
cvtss2sd %xmm0, %xmm0
movsd 0x6a1e(%rip), %xmm1     # 0xf880
mulsd %xmm1, %xmm0
movq %rax, %rdi
callq 0x2290
movq %rax, %rdi
movq %r13, %rsi
callq 0x2180
movq %r14, %rdi
leaq 0x7111(%rip), %rsi      # 0xff94
callq 0x2180
movq 0xe0(%rbx), %rcx
movl (%rcx,%r12,4), %ecx
cvtsi2ss %rcx, %xmm0
divss 0x8(%rsp), %xmm0
cvtss2sd %xmm0, %xmm0
mulsd 0x69d6(%rip), %xmm0     # 0xf880
movq %rax, %rdi
callq 0x2290
movq %rax, %rdi
movq %r13, %rsi
callq 0x2180
movq %r14, %rdi
leaq 0x70d9(%rip), %rsi      # 0xffa0
callq 0x2180
movq 0x110(%rbx), %rcx
movl (%rcx,%r12,4), %esi
movq %rax, %rdi
callq 0x2100
movq %r14, %rdi
leaq 0x70bd(%rip), %rsi      # 0xffa6
callq 0x2180
movq 0x128(%rbx), %rcx
movl (%rcx,%r12,4), %esi
movq %rax, %rdi
callq 0x2100
movq %r14, %rdi
movq %r15, %rsi
callq 0x2180
movq 0x140(%rbx), %rcx
movl (%rcx,%r12,4), %esi
movq %rax, %rdi
callq 0x2100
movq %r14, %rdi
movq %rbp, %rsi
callq 0x2180
movq 0xf8(%rbx), %rcx
movl (%rcx,%r12,4), %esi
movq %rax, %rdi
callq 0x2100
movq %rax, %rdi
callq 0x20b0
movq 0x140(%rbx), %rax
andl $0x0, (%rax,%r12,4)
movq 0x128(%rbx), %rax
andl $0x0, (%rax,%r12,4)
movq 0x110(%rbx), %rax
andl $0x0, (%rax,%r12,4)
movq 0xe0(%rbx), %rax
andl $0x0, (%rax,%r12,4)
movq 0xc8(%rbx), %rax
andl $0x0, (%rax,%r12,4)
movq 0xf8(%rbx), %rax
andl $0x0, (%rax,%r12,4)
incq %r12
jmp 0x8df6
andl $0x0, 0x290(%rbx)
andl $0x0, 0x298(%rbx)
andl $0x0, 0x248(%rbx)
andl $0x0, 0x268(%rbx)
andl $0x0, 0x288(%rbx)
movq 0x230(%rbx), %rax
cmpq %rax, 0x238(%rbx)
je 0x8fcf
movq %rax, 0x238(%rbx)
movq 0x250(%rbx), %rax
cmpq %rax, 0x258(%rbx)
je 0x8fe6
movq %rax, 0x258(%rbx)
movq 0x270(%rbx), %rax
cmpq %rax, 0x278(%rbx)
je 0x8ffd
movq %rax, 0x278(%rbx)
movq 0x10(%rbx), %rdi
addq $0x4b0, %rbx            # imm = 0x4B0
movzbl 0x4c(%rsp), %ecx
movq 0x28(%rsp), %rsi
movq %rbx, %rdx
movl 0x48(%rsp), %r8d
callq 0x44e2
addq $0x298, %rsp            # imm = 0x298
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq