// File: 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:
subq $0x68, %rsp
movq %rdi, 0x60(%rsp)
movq 0x60(%rsp), %rax
movq %rax, 0x38(%rsp)
leaq 0x66936(%rip), %rax     # 0x93ff0
testb $0x1, 0x1cc(%rax)
jne 0x2d6c8
jmp 0x2da31
movl $0x0, 0x5c(%rsp)
movl $0x0, 0x58(%rsp)
movq 0x38(%rsp), %rdi
movl 0x58(%rsp), %eax
movq %rax, 0x30(%rsp)
addq $0x78, %rdi
callq 0xfb20
movq %rax, %rcx
movq 0x30(%rsp), %rax
cmpq %rcx, %rax
jae 0x2d876
movq 0x38(%rsp), %rdi
movl $0x0, 0x54(%rsp)
addq $0x78, %rdi
movl 0x58(%rsp), %eax
movl %eax, %esi
callq 0xef70
movq %rax, %rdi
callq 0x11020
cmpq $0x0, %rax
je 0x2d7d5
movl $0x0, 0x50(%rsp)
movq 0x38(%rsp), %rdi
movl 0x50(%rsp), %eax
movq %rax, 0x28(%rsp)
addq $0x78, %rdi
movl 0x58(%rsp), %eax
movl %eax, %esi
callq 0xef70
movq %rax, %rdi
callq 0x11020
movq %rax, %rcx
movq 0x28(%rsp), %rax
cmpq %rcx, %rax
jae 0x2d7a1
movq 0x38(%rsp), %rdi
addq $0x78, %rdi
movl 0x58(%rsp), %eax
movl %eax, %esi
callq 0xef70
movq %rax, %rdi
movl 0x50(%rsp), %eax
movl %eax, %esi
callq 0xef90
movl (%rax), %eax
addl 0x54(%rsp), %eax
movl %eax, 0x54(%rsp)
movl 0x50(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x50(%rsp)
jmp 0x2d736
movq 0x38(%rsp), %rdi
movl 0x54(%rsp), %eax
movl %eax, 0x24(%rsp)
addq $0x78, %rdi
movl 0x58(%rsp), %eax
movl %eax, %esi
callq 0xef70
movq %rax, %rdi
callq 0x11020
movq %rax, %rcx
movl 0x24(%rsp), %eax
cltd
idivl %ecx
movl %eax, 0x5c(%rsp)
jmp 0x2d829
movq 0x38(%rsp), %rdi
addq $0x60, %rdi
movl 0x58(%rsp), %eax
movl %eax, %esi
callq 0xef70
movq %rax, %rdi
callq 0x2e960
testb $0x1, %al
jne 0x2d7f7
jmp 0x2d7ff
xorl %eax, %eax
movl %eax, 0x20(%rsp)
jmp 0x2d821
movq 0x38(%rsp), %rdi
addq $0x60, %rdi
movl 0x58(%rsp), %eax
movl %eax, %esi
callq 0xef70
movq %rax, %rdi
callq 0x20eb0
movl (%rax), %eax
movl %eax, 0x20(%rsp)
movl 0x20(%rsp), %eax
movl %eax, 0x5c(%rsp)
movq 0x38(%rsp), %rdi
addq $0x60, %rdi
movl 0x58(%rsp), %eax
movl %eax, %esi
callq 0xef70
movq %rax, %rdi
leaq 0x5c(%rsp), %rsi
callq 0xfb70
movq 0x38(%rsp), %rdi
addq $0x78, %rdi
movl 0x58(%rsp), %eax
movl %eax, %esi
callq 0xef70
movq %rax, %rdi
callq 0x2e9b0
movl 0x58(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x58(%rsp)
jmp 0x2d6d8
movl $0x0, 0x4c(%rsp)
movq 0x38(%rsp), %rdi
movl 0x4c(%rsp), %eax
movq %rax, 0x18(%rsp)
addq $0x90, %rdi
callq 0xfb20
movq %rax, %rcx
movq 0x18(%rsp), %rax
cmpq %rcx, %rax
jae 0x2da31
movq 0x38(%rsp), %rdi
movl $0x0, 0x48(%rsp)
addq $0x90, %rdi
movl 0x4c(%rsp), %eax
movl %eax, %esi
callq 0xef70
movq %rax, %rdi
callq 0x11020
cmpq $0x0, %rax
je 0x2d98a
movl $0x0, 0x44(%rsp)
movq 0x38(%rsp), %rdi
movl 0x44(%rsp), %eax
movq %rax, 0x10(%rsp)
addq $0x90, %rdi
movl 0x4c(%rsp), %eax
movl %eax, %esi
callq 0xef70
movq %rax, %rdi
callq 0x11020
movq %rax, %rcx
movq 0x10(%rsp), %rax
cmpq %rcx, %rax
jae 0x2d953
movq 0x38(%rsp), %rdi
addq $0x90, %rdi
movl 0x4c(%rsp), %eax
movl %eax, %esi
callq 0xef70
movq %rax, %rdi
movl 0x44(%rsp), %eax
movl %eax, %esi
callq 0xef90
movl (%rax), %eax
addl 0x48(%rsp), %eax
movl %eax, 0x48(%rsp)
movl 0x44(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x44(%rsp)
jmp 0x2d8e2
movq 0x38(%rsp), %rdi
movl 0x48(%rsp), %eax
movl %eax, 0xc(%rsp)
addq $0x90, %rdi
movl 0x4c(%rsp), %eax
movl %eax, %esi
callq 0xef70
movq %rax, %rdi
callq 0x11020
movq %rax, %rcx
movl 0xc(%rsp), %eax
cltd
idivl %ecx
movl %eax, 0x5c(%rsp)
jmp 0x2d9e1
movq 0x38(%rsp), %rdi
addq $0x48, %rdi
movl 0x4c(%rsp), %eax
movl %eax, %esi
callq 0xef70
movq %rax, %rdi
callq 0x2e960
testb $0x1, %al
jne 0x2d9ac
jmp 0x2d9b7
movl $0x10, %eax
movl %eax, 0x8(%rsp)
jmp 0x2d9d9
movq 0x38(%rsp), %rdi
addq $0x48, %rdi
movl 0x4c(%rsp), %eax
movl %eax, %esi
callq 0xef70
movq %rax, %rdi
callq 0x20eb0
movl (%rax), %eax
movl %eax, 0x8(%rsp)
movl 0x8(%rsp), %eax
movl %eax, 0x5c(%rsp)
movq 0x38(%rsp), %rdi
addq $0x48, %rdi
movl 0x4c(%rsp), %eax
movl %eax, %esi
callq 0xef70
movq %rax, %rdi
leaq 0x5c(%rsp), %rsi
callq 0xfb70
movq 0x38(%rsp), %rdi
addq $0x90, %rdi
movl 0x4c(%rsp), %eax
movl %eax, %esi
callq 0xef70
movq %rax, %rdi
callq 0x2e9b0
movl 0x4c(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x4c(%rsp)
jmp 0x2d87e
addq $0x68, %rsp
retq
nopw %cs:(%rax,%rax)