// File: /workspace/github_cpp_makefile_star2_O3/gvaumour[P]cache-simulator/src/FeatureTable.cc
// Function: FeatureTable::openNewTimeFrame()
void 
FeatureTable::openNewTimeFrame()
{
	if(!simu_parameters.perceptron_drawFeatureMaps)
		return;
	int avg = 0;
	for(unsigned i = 0; i < stats_allocation_buffer.size() ; i++)
	{
		int sum = 0;
		if(stats_allocation_buffer[i].size() != 0)
		{
			for(unsigned j = 0 ; j < stats_allocation_buffer[i].size() ; j++)
				sum += stats_allocation_buffer[i][j];


			avg = sum / (int)stats_allocation_buffer[i].size();		
		}
		else 
			avg = stats_heatmap_allocation[i].empty() ? 0 : stats_heatmap_allocation[i].back() ;

		stats_heatmap_allocation[i].push_back(avg);

		stats_allocation_buffer[i].clear();
	}

	
	for(unsigned i = 0; i < stats_weight_buffer.size() ; i++)
	{
		int sum = 0;
		if(stats_weight_buffer[i].size() != 0)
		{
			for(unsigned j = 0 ; j < stats_weight_buffer[i].size() ; j++)
				sum += stats_weight_buffer[i][j];


			avg = sum / (int)stats_weight_buffer[i].size();		
		}
		else 
			avg = stats_heatmap_weight[i].empty() ? 16 : stats_heatmap_weight[i].back() ;

		stats_heatmap_weight[i].push_back(avg);

		stats_weight_buffer[i].clear();
	}


}

// Assembly:
leaq 0x31507(%rip), %rax     # 0x45f50
cmpb $0x1, 0x1cc(%rax)
jne 0x14c0c
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x10, %rsp
movq %rdi, %rbx
movl $0x0, 0xc(%rsp)
movq 0x78(%rdi), %rcx
movabsq $-0x5555555555555555, %r15 # imm = 0xAAAAAAAAAAAAAAAB
cmpq %rcx, 0x80(%rdi)
je 0x14b37
xorl %r12d, %r12d
leaq 0xc(%rsp), %r14
leaq (%r12,%r12,2), %r13
movq (%rcx,%r13,8), %r8
movq 0x8(%rcx,%r13,8), %rsi
subq %r8, %rsi
je 0x14ac7
sarq $0x2, %rsi
xorl %edx, %edx
xorl %eax, %eax
addl (%r8,%rdx,4), %eax
incq %rdx
movl %edx, %edi
cmpq %rdi, %rsi
ja 0x14aab
cltd
idivl %esi
movq 0x60(%rbx), %rdx
movq 0x8(%rdx,%r13,8), %rsi
jmp 0x14add
movq 0x60(%rbx), %rdx
movq 0x8(%rdx,%r13,8), %rsi
cmpq %rsi, (%rdx,%r13,8)
je 0x14adb
movl -0x4(%rsi), %eax
jmp 0x14add
xorl %eax, %eax
movl %eax, 0xc(%rsp)
leaq (%rdx,%r13,8), %rdi
cmpq 0x10(%rdi), %rsi
je 0x14af7
movl %eax, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x8(%rdi)
jmp 0x14b07
movq %r14, %rdx
callq 0xd652
movq 0x78(%rbx), %rcx
movq (%rcx,%r13,8), %r8
cmpq %r8, 0x8(%rcx,%r13,8)
je 0x14b19
leaq (%rcx,%r13,8), %rax
addq $0x8, %rax
movq %r8, (%rax)
incl %r12d
movq 0x80(%rbx), %rax
subq %rcx, %rax
sarq $0x3, %rax
imulq %r15, %rax
cmpq %r12, %rax
ja 0x14a91
movq 0x90(%rbx), %rcx
cmpq %rcx, 0x98(%rbx)
je 0x14bff
xorl %r12d, %r12d
leaq 0xc(%rsp), %r14
leaq (%r12,%r12,2), %r13
movq (%rcx,%r13,8), %r8
movq 0x8(%rcx,%r13,8), %rsi
subq %r8, %rsi
je 0x14b89
sarq $0x2, %rsi
xorl %edx, %edx
xorl %eax, %eax
addl (%r8,%rdx,4), %eax
incq %rdx
movl %edx, %edi
cmpq %rdi, %rsi
ja 0x14b6d
cltd
idivl %esi
movq 0x48(%rbx), %rdx
movq 0x8(%rdx,%r13,8), %rsi
jmp 0x14ba2
movq 0x48(%rbx), %rdx
movq 0x8(%rdx,%r13,8), %rsi
cmpq %rsi, (%rdx,%r13,8)
je 0x14b9d
movl -0x4(%rsi), %eax
jmp 0x14ba2
movl $0x10, %eax
movl %eax, 0xc(%rsp)
leaq (%rdx,%r13,8), %rdi
cmpq 0x10(%rdi), %rsi
je 0x14bbc
movl %eax, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x8(%rdi)
jmp 0x14bcf
movq %r14, %rdx
callq 0xd652
movq 0x90(%rbx), %rcx
movq (%rcx,%r13,8), %r8
cmpq %r8, 0x8(%rcx,%r13,8)
je 0x14be1
leaq (%rcx,%r13,8), %rax
addq $0x8, %rax
movq %r8, (%rax)
incl %r12d
movq 0x98(%rbx), %rax
subq %rcx, %rax
sarq $0x3, %rax
imulq %r15, %rax
cmpq %r12, %rax
ja 0x14b53
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
nop