// File: /workspace/github_cpp_makefile_star2_O1/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 0x31397(%rip), %rax     # 0x45f50
cmpb $0x1, 0x1cc(%rax)
jne 0x14d7d
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x10, %rsp
movq %rdi, %rbx
movl $0x0, 0xc(%rsp)
movq 0x78(%rdi), %rax
movabsq $-0x5555555555555555, %r15 # imm = 0xAAAAAAAAAAAAAAAB
cmpq %rax, 0x80(%rdi)
je 0x14ca6
xorl %r12d, %r12d
leaq 0xc(%rsp), %r14
leaq (%r12,%r12,2), %r13
movq (%rax,%r13,8), %rdx
movq 0x8(%rax,%r13,8), %rcx
subq %rdx, %rcx
je 0x14c2d
sarq $0x2, %rcx
xorl %esi, %esi
xorl %eax, %eax
addl (%rdx,%rsi,4), %eax
incq %rsi
movl %esi, %edi
cmpq %rdi, %rcx
ja 0x14c1b
cltd
idivl %ecx
jmp 0x14c43
movq 0x60(%rbx), %rcx
movq 0x8(%rcx,%r13,8), %rax
cmpq %rax, (%rcx,%r13,8)
je 0x14c41
movl -0x4(%rax), %eax
jmp 0x14c43
xorl %eax, %eax
movl %eax, 0xc(%rsp)
movq 0x60(%rbx), %rcx
leaq (%rcx,%r13,8), %rdi
movq 0x8(%rdi), %rsi
cmpq 0x10(%rdi), %rsi
je 0x14c65
movl %eax, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x8(%rdi)
jmp 0x14c6d
movq %r14, %rdx
callq 0xd68c
movq 0x78(%rbx), %rcx
movq (%rcx,%r13,8), %rax
cmpq %rax, 0x8(%rcx,%r13,8)
je 0x14c84
leaq (%rcx,%r13,8), %rcx
movq %rax, 0x8(%rcx)
incl %r12d
movq 0x78(%rbx), %rax
movq 0x80(%rbx), %rcx
subq %rax, %rcx
sarq $0x3, %rcx
imulq %r15, %rcx
cmpq %r12, %rcx
ja 0x14c01
movq 0x90(%rbx), %rax
cmpq %rax, 0x98(%rbx)
je 0x14d70
xorl %r12d, %r12d
leaq 0xc(%rsp), %r14
leaq (%r12,%r12,2), %r13
movq (%rax,%r13,8), %rdx
movq 0x8(%rax,%r13,8), %rcx
subq %rdx, %rcx
je 0x14cee
sarq $0x2, %rcx
xorl %esi, %esi
xorl %eax, %eax
addl (%rdx,%rsi,4), %eax
incq %rsi
movl %esi, %edi
cmpq %rdi, %rcx
ja 0x14cdc
cltd
idivl %ecx
jmp 0x14d07
movq 0x48(%rbx), %rcx
movq 0x8(%rcx,%r13,8), %rax
cmpq %rax, (%rcx,%r13,8)
je 0x14d02
movl -0x4(%rax), %eax
jmp 0x14d07
movl $0x10, %eax
movl %eax, 0xc(%rsp)
movq 0x48(%rbx), %rcx
leaq (%rcx,%r13,8), %rdi
movq 0x8(%rdi), %rsi
cmpq 0x10(%rdi), %rsi
je 0x14d29
movl %eax, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x8(%rdi)
jmp 0x14d31
movq %r14, %rdx
callq 0xd68c
movq 0x90(%rbx), %rcx
movq (%rcx,%r13,8), %rax
cmpq %rax, 0x8(%rcx,%r13,8)
je 0x14d4b
leaq (%rcx,%r13,8), %rcx
movq %rax, 0x8(%rcx)
incl %r12d
movq 0x90(%rbx), %rax
movq 0x98(%rbx), %rcx
subq %rax, %rcx
sarq $0x3, %rcx
imulq %r15, %rcx
cmpq %r12, %rcx
ja 0x14cc2
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq