// File: 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
movq %rsp, %rbp
subq $0x1e0, %rsp            # imm = 0x1E0
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0xd8(%rbp)
leaq 0x5107b(%rip), %rax     # 0x6652c
cvtsi2sdl (%rax), %xmm0
leaq 0x5107c(%rip), %rax     # 0x66538
movsd (%rax), %xmm1
mulsd %xmm1, %xmm0
movsd 0x3bbec(%rip), %xmm1    # 0x510b8
mulsd %xmm1, %xmm0
movsd %xmm0, -0x10(%rbp)
leaq 0x5106c(%rip), %rax     # 0x66548
movslq (%rax), %rax
movq %rax, -0xd0(%rbp)
movq $0x0, -0x30(%rbp)
leaq -0x31(%rbp), %rdi
movq %rdi, -0xc8(%rbp)
callq 0x17d30
movq -0xd0(%rbp), %rsi
movq -0xc8(%rbp), %rcx
leaq -0x28(%rbp), %rdi
leaq -0x30(%rbp), %rdx
callq 0x17d50
jmp 0x1551b
leaq -0x31(%rbp), %rdi
callq 0x17dd0
leaq 0x5101d(%rip), %rax     # 0x66548
movslq (%rax), %rax
movq %rax, -0xe8(%rbp)
movq $0x0, -0x68(%rbp)
leaq -0x69(%rbp), %rdi
movq %rdi, -0xe0(%rbp)
callq 0x17d30
movq -0xe8(%rbp), %rsi
movq -0xe0(%rbp), %rcx
leaq -0x60(%rbp), %rdi
leaq -0x68(%rbp), %rdx
callq 0x17d50
jmp 0x1556a
leaq -0x69(%rbp), %rdi
callq 0x17dd0
leaq 0x50fce(%rip), %rax     # 0x66548
movslq (%rax), %rax
movq %rax, -0xf8(%rbp)
movq $0x0, -0x90(%rbp)
leaq -0x91(%rbp), %rdi
movq %rdi, -0xf0(%rbp)
callq 0x17d30
movq -0xf8(%rbp), %rsi
movq -0xf0(%rbp), %rcx
leaq -0x88(%rbp), %rdi
leaq -0x90(%rbp), %rdx
callq 0x17d50
jmp 0x155c5
leaq -0x91(%rbp), %rdi
callq 0x17dd0
movl $0x0, -0x98(%rbp)
movl -0x98(%rbp), %eax
leaq 0x50f60(%rip), %rcx     # 0x66548
cmpl (%rcx), %eax
jge 0x158a9
movq -0xd8(%rbp), %rdi
addq $0x160, %rdi            # imm = 0x160
movslq -0x98(%rbp), %rsi
callq 0x17df0
movq -0xd8(%rbp), %rdi
movq (%rax), %rax
movq %rax, -0x160(%rbp)
addq $0x3e8, %rdi            # imm = 0x3E8
movslq -0x98(%rbp), %rsi
callq 0x17df0
movq %rax, %rcx
movq -0x160(%rbp), %rax
movq (%rcx), %rcx
subq %rcx, %rax
movq %rax, %xmm0
movaps 0x3bad6(%rip), %xmm1    # 0x51120
movaps %xmm1, -0x150(%rbp)
punpckldq %xmm1, %xmm0    # xmm0 = xmm0[0],xmm1[0],xmm0[1],xmm1[1]
movapd 0x3bad3(%rip), %xmm1    # 0x51130
movaps %xmm1, -0x140(%rbp)
subpd %xmm1, %xmm0
movaps %xmm0, %xmm1
unpckhpd %xmm0, %xmm0            # xmm0 = xmm0[1,1]
addsd %xmm1, %xmm0
movsd -0x10(%rbp), %xmm1
divsd %xmm1, %xmm0
movsd 0x3ba3c(%rip), %xmm1    # 0x510c0
mulsd %xmm1, %xmm0
movsd %xmm0, -0x158(%rbp)
movslq -0x98(%rbp), %rsi
leaq -0x28(%rbp), %rdi
callq 0x17e10
movsd -0x158(%rbp), %xmm0
movq -0xd8(%rbp), %rdi
movsd %xmm0, (%rax)
addq $0x178, %rdi            # imm = 0x178
movslq -0x98(%rbp), %rsi
callq 0x17df0
movq -0xd8(%rbp), %rdi
movq (%rax), %rax
movq %rax, -0x128(%rbp)
addq $0x400, %rdi            # imm = 0x400
movslq -0x98(%rbp), %rsi
callq 0x17df0
movaps -0x150(%rbp), %xmm2
movaps -0x140(%rbp), %xmm1
movq %rax, %rcx
movq -0x128(%rbp), %rax
movq (%rcx), %rcx
subq %rcx, %rax
movq %rax, %xmm0
punpckldq %xmm2, %xmm0    # xmm0 = xmm0[0],xmm2[0],xmm0[1],xmm2[1]
subpd %xmm1, %xmm0
movaps %xmm0, %xmm1
unpckhpd %xmm0, %xmm0            # xmm0 = xmm0[1,1]
addsd %xmm1, %xmm0
divsd -0x10(%rbp), %xmm0
movsd 0x3b9a3(%rip), %xmm1    # 0x510d0
divsd %xmm1, %xmm0
movsd %xmm0, -0x120(%rbp)
movslq -0x98(%rbp), %rsi
leaq -0x60(%rbp), %rdi
callq 0x17e10
movsd -0x120(%rbp), %xmm0
movsd %xmm0, (%rax)
movslq -0x98(%rbp), %rsi
leaq -0x28(%rbp), %rdi
callq 0x17e10
movsd (%rax), %xmm0
movsd %xmm0, -0x118(%rbp)
movslq -0x98(%rbp), %rsi
leaq -0x60(%rbp), %rdi
callq 0x17e10
movsd -0x118(%rbp), %xmm0
addsd (%rax), %xmm0
movsd %xmm0, -0x110(%rbp)
movslq -0x98(%rbp), %rsi
leaq -0x88(%rbp), %rdi
callq 0x17e10
movsd -0x110(%rbp), %xmm0
movq -0xd8(%rbp), %rdi
movsd %xmm0, (%rax)
addq $0x160, %rdi            # imm = 0x160
movslq -0x98(%rbp), %rsi
callq 0x17df0
movq -0xd8(%rbp), %rdi
movq (%rax), %rax
movq %rax, -0x108(%rbp)
addq $0x3e8, %rdi            # imm = 0x3E8
movslq -0x98(%rbp), %rsi
callq 0x17df0
movq -0x108(%rbp), %rcx
movq -0xd8(%rbp), %rdi
movq %rcx, (%rax)
addq $0x178, %rdi            # imm = 0x178
movslq -0x98(%rbp), %rsi
callq 0x17df0
movq -0xd8(%rbp), %rdi
movq (%rax), %rax
movq %rax, -0x100(%rbp)
addq $0x400, %rdi            # imm = 0x400
movslq -0x98(%rbp), %rsi
callq 0x17df0
movq -0x100(%rbp), %rcx
movq %rcx, (%rax)
movl -0x98(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x98(%rbp)
jmp 0x155db
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
leaq -0x31(%rbp), %rdi
callq 0x17dd0
jmp 0x15bb1
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
leaq -0x69(%rbp), %rdi
callq 0x17dd0
jmp 0x15ba8
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
leaq -0x91(%rbp), %rdi
callq 0x17dd0
jmp 0x15b9f
movq -0xd8(%rbp), %rax
movq 0x128(%rax), %rcx
movq 0x3e0(%rax), %rdx
subq %rdx, %rcx
movq %rcx, %xmm0
movaps 0x3b853(%rip), %xmm1    # 0x51120
punpckldq %xmm1, %xmm0    # xmm0 = xmm0[0],xmm1[0],xmm0[1],xmm1[1]
movapd 0x3b857(%rip), %xmm1    # 0x51130
subpd %xmm1, %xmm0
movaps %xmm0, %xmm1
unpckhpd %xmm0, %xmm0            # xmm0 = xmm0[1,1]
addsd %xmm1, %xmm0
movsd -0x10(%rbp), %xmm1
divsd %xmm1, %xmm0
movsd 0x3b7c7(%rip), %xmm1    # 0x510c0
mulsd %xmm1, %xmm0
movsd %xmm0, -0xa0(%rbp)
movq 0x128(%rax), %rcx
movq %rcx, 0x3e0(%rax)
addq $0xa18, %rax            # imm = 0xA18
movq %rax, -0x170(%rbp)
movl $0x8, %edi
callq 0x177b0
movl %eax, -0x164(%rbp)
jmp 0x15932
movq -0x170(%rbp), %rdi
movl -0x164(%rbp), %eax
movl %eax, -0xa4(%rbp)
movl -0xa4(%rbp), %esi
callq 0x4440
movq %rax, -0x178(%rbp)
jmp 0x15959
movl $0x20, %edi
callq 0x177d0
movb %al, -0x179(%rbp)
jmp 0x1596b
movq -0x178(%rbp), %rdi
movb -0x179(%rbp), %al
movb %al, -0xa5(%rbp)
movzbl -0xa5(%rbp), %esi
callq 0x4550
movq %rax, -0x188(%rbp)
jmp 0x15993
movq -0x188(%rbp), %rdi
movq -0xd8(%rbp), %rax
movq 0x370(%rax), %rax
leaq 0x50b7d(%rip), %rcx     # 0x6652c
movslq (%rcx), %rcx
xorl %edx, %edx
divq %rcx
movq %rax, %rsi
callq 0x40f0
jmp 0x159c1
movl $0x0, -0xac(%rbp)
movl -0xac(%rbp), %eax
leaq 0x50b70(%rip), %rcx     # 0x66548
cmpl (%rcx), %eax
jge 0x15abf
movq -0xd8(%rbp), %rax
addq $0xa18, %rax            # imm = 0xA18
movq %rax, -0x198(%rbp)
movl $0xa, %edi
callq 0x177b0
movl %eax, -0x18c(%rbp)
jmp 0x15a06
movq -0x198(%rbp), %rdi
movl -0x18c(%rbp), %eax
movl %eax, -0xb0(%rbp)
movl -0xb0(%rbp), %esi
callq 0x4440
movq %rax, -0x1a0(%rbp)
jmp 0x15a2d
movl $0x20, %edi
callq 0x177d0
movb %al, -0x1a1(%rbp)
jmp 0x15a3f
movq -0x1a0(%rbp), %rdi
movb -0x1a1(%rbp), %al
movb %al, -0xb1(%rbp)
movzbl -0xb1(%rbp), %esi
callq 0x4550
movq %rax, -0x1b0(%rbp)
jmp 0x15a67
movslq -0xac(%rbp), %rsi
leaq -0x88(%rbp), %rdi
callq 0x17e10
movq -0x1b0(%rbp), %rdi
movsd (%rax), %xmm0
callq 0x4690
jmp 0x15a8c
jmp 0x15a8e
movl -0xac(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xac(%rbp)
jmp 0x159cb
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
leaq -0x88(%rbp), %rdi
callq 0x17e30
jmp 0x15b9f
movq -0xd8(%rbp), %rax
addq $0xa18, %rax            # imm = 0xA18
movq %rax, -0x1c0(%rbp)
movl $0xa, %edi
callq 0x177b0
movl %eax, -0x1b4(%rbp)
jmp 0x15ae5
movq -0x1c0(%rbp), %rdi
movl -0x1b4(%rbp), %eax
movl %eax, -0xb8(%rbp)
movl -0xb8(%rbp), %esi
callq 0x4440
movq %rax, -0x1c8(%rbp)
jmp 0x15b0c
movl $0x20, %edi
callq 0x177d0
movb %al, -0x1c9(%rbp)
jmp 0x15b1e
movq -0x1c8(%rbp), %rdi
movb -0x1c9(%rbp), %al
movb %al, -0xb9(%rbp)
movzbl -0xb9(%rbp), %esi
callq 0x4550
movq %rax, -0x1d8(%rbp)
jmp 0x15b46
movq -0x1d8(%rbp), %rdi
movsd -0xa0(%rbp), %xmm0
callq 0x4690
movq %rax, -0x1e0(%rbp)
jmp 0x15b63
movq -0x1e0(%rbp), %rdi
movq 0x5043f(%rip), %rsi     # 0x65fb0
callq 0x43c0
jmp 0x15b78
leaq -0x88(%rbp), %rdi
callq 0x17e30
leaq -0x60(%rbp), %rdi
callq 0x17e30
leaq -0x28(%rbp), %rdi
callq 0x17e30
addq $0x1e0, %rsp            # imm = 0x1E0
popq %rbp
retq
leaq -0x60(%rbp), %rdi
callq 0x17e30
leaq -0x28(%rbp), %rdi
callq 0x17e30
movq -0x40(%rbp), %rdi
callq 0x4630
nopw (%rax,%rax)