// File: /workspace/github_cpp_makefile_star2_O2/estwings57[P]CasHMC/sources/CasHMCWrapper.cpp
// Function: CasHMC::CasHMCWrapper::MakePlotData()
void CasHMCWrapper::MakePlotData()
{
	double elapsedPlotTime = (double)(PLOT_SAMPLING*CPU_CLK_PERIOD*1E-9);
	
	//Effective link bandwidth
	vector<double> downLinkEffecPlotBandwidth = vector<double>(NUM_LINKS, 0);
	vector<double> upLinkEffecPlotBandwidth = vector<double>(NUM_LINKS, 0);
	vector<double> linkEffecPlotBandwidth = vector<double>(NUM_LINKS, 0);
	for(int i=0; i<NUM_LINKS; i++) {
		downLinkEffecPlotBandwidth[i] = (downLinkDataSize[i] - downLinkDataSizeTemp[i]) / elapsedPlotTime / (1<<30);
		upLinkEffecPlotBandwidth[i] = (upLinkDataSize[i] - upLinkDataSizeTemp[i]) / elapsedPlotTime / (1<<30);
		linkEffecPlotBandwidth[i] = downLinkEffecPlotBandwidth[i] + upLinkEffecPlotBandwidth[i];
		downLinkDataSizeTemp[i] = downLinkDataSize[i];
		upLinkDataSizeTemp[i] = upLinkDataSize[i];
	}
	
	//HMC bandwidth
	double hmcPlotBandwidth = (hmcTransmitSize - hmcTransmitSizeTemp)/elapsedPlotTime/(1<<30);
	hmcTransmitSizeTemp = hmcTransmitSize;
	
	plotDataOut<<setw(8)<<setfill(' ')<<currentClockCycle/PLOT_SAMPLING;
	for(int i=0; i<NUM_LINKS; i++) {
		plotDataOut<<setw(10)<<setfill(' ')<<linkEffecPlotBandwidth[i];
	}
	plotDataOut<<setw(10)<<setfill(' ')<<hmcPlotBandwidth<<endl;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x78, %rsp
movq %rdi, %rbx
leaq 0x249a2(%rip), %r12     # 0x3148c
cvtsi2sdl (%r12), %xmm0
leaq 0x249a1(%rip), %rax     # 0x31498
mulsd (%rax), %xmm0
movsd %xmm0, 0x10(%rsp)
leaq 0x249a0(%rip), %r15     # 0x314a8
movslq (%r15), %rsi
leaq 0x48(%rsp), %rdx
andq $0x0, (%rdx)
leaq 0x60(%rsp), %rdi
leaq 0x28(%rsp), %r14
movq %r14, %rcx
callq 0xde5c
movslq (%r15), %rsi
andq $0x0, (%r14)
leaq 0x48(%rsp), %rdi
leaq 0x28(%rsp), %rdx
leaq 0x40(%rsp), %rcx
callq 0xde5c
movslq (%r15), %rsi
leaq 0x40(%rsp), %rdx
andq $0x0, (%rdx)
leaq 0x28(%rsp), %rdi
leaq 0xf(%rsp), %rcx
callq 0xde5c
movsd 0x10(%rsp), %xmm5
mulsd 0x1754e(%rip), %xmm5    # 0x240b8
movl (%r15), %eax
movq 0x160(%rbx), %rcx
movq 0x178(%rbx), %rdx
movq 0x3e8(%rbx), %rsi
movq 0x60(%rsp), %rdi
movq 0x400(%rbx), %r8
movq 0x48(%rsp), %r9
xorl %r10d, %r10d
testl %eax, %eax
cmovlel %r10d, %eax
movq 0x28(%rsp), %r11
movq 0x17587(%rip), %xmm0    # 0x24130
movapd 0x1758f(%rip), %xmm1    # 0x24140
movsd 0x17507(%rip), %xmm2    # 0x240c0
cmpq %r10, %rax
je 0xcc43
movq (%rcx,%r10,8), %r14
movq %r14, %r13
subq (%rsi,%r10,8), %r13
movq %r13, %xmm3
punpckldq %xmm0, %xmm3    # xmm3 = xmm3[0],xmm0[0],xmm3[1],xmm0[1]
subpd %xmm1, %xmm3
movapd %xmm3, %xmm4
unpckhpd %xmm3, %xmm4            # xmm4 = xmm4[1],xmm3[1]
addsd %xmm3, %xmm4
divsd %xmm5, %xmm4
mulsd %xmm2, %xmm4
movsd %xmm4, (%rdi,%r10,8)
movq (%rdx,%r10,8), %r13
subq (%r8,%r10,8), %r13
movq %r13, %xmm3
punpckldq %xmm0, %xmm3    # xmm3 = xmm3[0],xmm0[0],xmm3[1],xmm0[1]
subpd %xmm1, %xmm3
movapd %xmm3, %xmm4
unpckhpd %xmm3, %xmm4            # xmm4 = xmm4[1],xmm3[1]
addsd %xmm3, %xmm4
divsd %xmm5, %xmm4
mulsd %xmm2, %xmm4
movsd %xmm4, (%r9,%r10,8)
addsd (%rdi,%r10,8), %xmm4
movsd %xmm4, (%r11,%r10,8)
movq %r14, (%rsi,%r10,8)
movq (%rdx,%r10,8), %r14
movq %r14, (%r8,%r10,8)
incq %r10
jmp 0xcbb9
movsd %xmm5, 0x10(%rsp)
movq 0x128(%rbx), %rax
movq %rax, %r13
subq 0x3e0(%rbx), %r13
movq %rax, 0x3e0(%rbx)
leaq 0xa18(%rbx), %r14
movq 0xa18(%rbx), %rax
movq -0x18(%rax), %rax
movq $0x8, 0xa28(%rbx,%rax)
pushq $0x20
popq %rsi
movq %r14, %rdi
callq 0x4440
movq %rax, %rdi
movq 0x370(%rbx), %rax
movslq (%r12), %rcx
xorl %edx, %edx
divq %rcx
movq %rax, %rsi
callq 0x4210
movq %r13, %xmm0
punpckldq 0x1747e(%rip), %xmm0 # xmm0 = xmm0[0],mem[0],xmm0[1],mem[1]
subpd 0x17486(%rip), %xmm0    # 0x24140
movapd %xmm0, %xmm1
unpckhpd %xmm0, %xmm1            # xmm1 = xmm1[1],xmm0[1]
addsd %xmm0, %xmm1
divsd 0x10(%rsp), %xmm1
mulsd 0x173ec(%rip), %xmm1    # 0x240c0
movapd %xmm1, 0x10(%rsp)
xorl %r12d, %r12d
pushq $0x20
popq %rbp
movslq (%r15), %rcx
movq (%r14), %rax
movq -0x18(%rax), %rax
cmpq %rcx, %r12
jge 0xcd1d
movq $0xa, 0xa28(%rbx,%rax)
movq %r14, %rdi
movl %ebp, %esi
callq 0x4440
movq 0x28(%rsp), %rcx
movsd (%rcx,%r12,8), %xmm0
movq %rax, %rdi
callq 0x4470
incq %r12
jmp 0xcce0
movq $0xa, 0x10(%r14,%rax)
pushq $0x20
popq %rsi
movq %r14, %rdi
callq 0x4440
movq %rax, %rdi
movdqa 0x10(%rsp), %xmm0
callq 0x4470
movq %rax, %rdi
callq 0x4180
leaq 0x28(%rsp), %rdi
callq 0xeb42
leaq 0x48(%rsp), %rdi
callq 0xeb42
leaq 0x60(%rsp), %rdi
callq 0xeb42
addq $0x78, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
jmp 0xcd8d
movq %rax, %rbx
jmp 0xcd97
jmp 0xcd80
movq %rax, %rbx
leaq 0x28(%rsp), %rdi
callq 0xeb42
leaq 0x48(%rsp), %rdi
callq 0xeb42
leaq 0x60(%rsp), %rdi
callq 0xeb42
movq %rbx, %rdi
callq 0x4520
nop