// File: gvaumour[P]cache-simulator/src/FeatureTable.cc
// Function: FeatureEntry::updateDatasetState()
void 
FeatureEntry::updateDatasetState()
{
	
	CostFunctionParameters params = simu_parameters.optTarget;
	int E_SRAM = 0 , E_NVM = 0;
	
	if(simu_parameters.Cerebron_RDmodel)
	{
		E_SRAM = SRAM_seq[WRITE_ACCESS][false] * (params.costDRAM[WRITE_ACCESS] + params.costSRAM[WRITE_ACCESS]) +\
			 SRAM_seq[WRITE_ACCESS][true] * (params.costSRAM[WRITE_ACCESS]) +\
			 SRAM_seq[READ_ACCESS][false] * (params.costDRAM[READ_ACCESS] + params.costSRAM[READ_ACCESS]) +\
			 SRAM_seq[READ_ACCESS][true] * (params.costSRAM[READ_ACCESS]);

		E_NVM = NVM_seq[WRITE_ACCESS][false] * (params.costDRAM[WRITE_ACCESS] + params.costNVM[WRITE_ACCESS]) +\
			 NVM_seq[WRITE_ACCESS][true] * (params.costNVM[WRITE_ACCESS]) +\
			 NVM_seq[READ_ACCESS][false] * (params.costDRAM[READ_ACCESS] + params.costNVM[READ_ACCESS]) +\
			 NVM_seq[READ_ACCESS][true] * (params.costNVM[READ_ACCESS]);
	}
	else
	{
		E_SRAM =(params.costDRAM[READ_ACCESS] + params.costSRAM[READ_ACCESS])* \
				(cpts[READ_ACCESS][RD_NOT_ACCURATE]) + \
			(params.costDRAM[WRITE_ACCESS] + params.costSRAM[WRITE_ACCESS])* \
				(cpts[WRITE_ACCESS][RD_NOT_ACCURATE]) + \
			 params.costDRAM[READ_ACCESS] * cpts[READ_ACCESS][RD_MEDIUM] + \
		         params.costDRAM[WRITE_ACCESS] * cpts[WRITE_ACCESS][RD_MEDIUM] + \
			 params.costSRAM[READ_ACCESS] * cpts[READ_ACCESS][RD_SHORT] + \
			 params.costSRAM[WRITE_ACCESS] * cpts[WRITE_ACCESS][RD_SHORT];	

		E_NVM = (params.costDRAM[READ_ACCESS] + params.costNVM[READ_ACCESS])* \
				(cpts[READ_ACCESS][RD_NOT_ACCURATE]) + \
			(params.costDRAM[WRITE_ACCESS] + params.costNVM[WRITE_ACCESS])* \
				(cpts[WRITE_ACCESS][RD_NOT_ACCURATE]) + \
			       params.costNVM[READ_ACCESS] *  ( cpts[READ_ACCESS][RD_MEDIUM] + cpts[READ_ACCESS][RD_SHORT]) + \
			       params.costNVM[WRITE_ACCESS] * ( cpts[WRITE_ACCESS][RD_MEDIUM] + cpts[WRITE_ACCESS][RD_SHORT]);	
	}

	if(E_SRAM > E_NVM)
		des = ALLOCATE_IN_NVM;
	else
		des = ALLOCATE_IN_SRAM;
		
		
	cpts = vector< vector<int> >(NUM_RW_TYPE, vector<int>(NUM_RD_TYPE, 0));
	cptWindow = 0;
}

// Assembly:
subq $0x168, %rsp            # imm = 0x168
movq %rdi, 0x160(%rsp)
movq 0x160(%rsp), %rax
movq %rax, 0xc0(%rsp)
leaq 0x118(%rsp), %rdi
leaq 0x68062(%rip), %rsi     # 0x93ff0
addq $0xe8, %rsi
callq 0x2e5e0
movl $0x0, 0x114(%rsp)
movl $0x0, 0x110(%rsp)
leaq 0x68039(%rip), %rax     # 0x93ff0
testb $0x1, 0x226(%rax)
je 0x2c325
movq 0xc0(%rsp), %rdi
addq $0x18, %rdi
movl $0x1, %esi
callq 0xef70
movq %rax, %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0xef90
movl (%rax), %eax
movl %eax, 0x7c(%rsp)
leaq 0x118(%rsp), %rdi
addq $0x30, %rdi
movl $0x1, %esi
callq 0xef90
movl (%rax), %eax
movl %eax, 0x78(%rsp)
leaq 0x118(%rsp), %rdi
addq $0x18, %rdi
movl $0x1, %esi
callq 0xef90
movl 0x78(%rsp), %ecx
movq 0xc0(%rsp), %rdi
movq %rax, %rdx
movl 0x7c(%rsp), %eax
addl (%rdx), %ecx
imull %ecx, %eax
movl %eax, 0x84(%rsp)
addq $0x18, %rdi
movl $0x1, %esi
callq 0xef70
movq %rax, %rdi
movl $0x1, %esi
callq 0xef90
movl (%rax), %eax
movl %eax, 0x80(%rsp)
leaq 0x118(%rsp), %rdi
addq $0x18, %rdi
movl $0x1, %esi
callq 0xef90
movl 0x80(%rsp), %ecx
movq 0xc0(%rsp), %rdi
movq %rax, %rdx
movl 0x84(%rsp), %eax
imull (%rdx), %ecx
addl %ecx, %eax
movl %eax, 0x90(%rsp)
addq $0x18, %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0xef70
movq %rax, %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0xef90
movl (%rax), %eax
movl %eax, 0x8c(%rsp)
leaq 0x118(%rsp), %rdi
addq $0x30, %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0xef90
movl (%rax), %eax
movl %eax, 0x88(%rsp)
leaq 0x118(%rsp), %rdi
addq $0x18, %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0xef90
movl 0x88(%rsp), %edx
movl 0x8c(%rsp), %ecx
movq 0xc0(%rsp), %rdi
movq %rax, %rsi
movl 0x90(%rsp), %eax
addl (%rsi), %edx
imull %edx, %ecx
addl %ecx, %eax
movl %eax, 0x98(%rsp)
addq $0x18, %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0xef70
movq %rax, %rdi
movl $0x1, %esi
callq 0xef90
movl (%rax), %eax
movl %eax, 0x94(%rsp)
leaq 0x118(%rsp), %rdi
addq $0x18, %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0xef90
movl 0x94(%rsp), %ecx
movq 0xc0(%rsp), %rdi
movq %rax, %rdx
movl 0x98(%rsp), %eax
imull (%rdx), %ecx
addl %ecx, %eax
movl %eax, 0x114(%rsp)
addq $0x30, %rdi
movl $0x1, %esi
callq 0xef70
movq %rax, %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0xef90
movl (%rax), %eax
movl %eax, 0xa0(%rsp)
leaq 0x118(%rsp), %rdi
addq $0x30, %rdi
movl $0x1, %esi
callq 0xef90
movl (%rax), %eax
movl %eax, 0x9c(%rsp)
leaq 0x118(%rsp), %rdi
movl $0x1, %esi
callq 0xef90
movl 0x9c(%rsp), %ecx
movq 0xc0(%rsp), %rdi
movq %rax, %rdx
movl 0xa0(%rsp), %eax
addl (%rdx), %ecx
imull %ecx, %eax
movl %eax, 0xa8(%rsp)
addq $0x30, %rdi
movl $0x1, %esi
callq 0xef70
movq %rax, %rdi
movl $0x1, %esi
callq 0xef90
movl (%rax), %eax
movl %eax, 0xa4(%rsp)
leaq 0x118(%rsp), %rdi
movl $0x1, %esi
callq 0xef90
movl 0xa4(%rsp), %ecx
movq 0xc0(%rsp), %rdi
movq %rax, %rdx
movl 0xa8(%rsp), %eax
imull (%rdx), %ecx
addl %ecx, %eax
movl %eax, 0xb4(%rsp)
addq $0x30, %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0xef70
movq %rax, %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0xef90
movl (%rax), %eax
movl %eax, 0xb0(%rsp)
leaq 0x118(%rsp), %rdi
addq $0x30, %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0xef90
movl (%rax), %eax
movl %eax, 0xac(%rsp)
leaq 0x118(%rsp), %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0xef90
movl 0xac(%rsp), %edx
movl 0xb0(%rsp), %ecx
movq 0xc0(%rsp), %rdi
movq %rax, %rsi
movl 0xb4(%rsp), %eax
addl (%rsi), %edx
imull %edx, %ecx
addl %ecx, %eax
movl %eax, 0xbc(%rsp)
addq $0x30, %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0xef70
movq %rax, %rdi
movl $0x1, %esi
callq 0xef90
movl (%rax), %eax
movl %eax, 0xb8(%rsp)
leaq 0x118(%rsp), %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0xef90
movl 0xb8(%rsp), %ecx
movq %rax, %rdx
movl 0xbc(%rsp), %eax
imull (%rdx), %ecx
addl %ecx, %eax
movl %eax, 0x110(%rsp)
jmp 0x2c6f6
leaq 0x118(%rsp), %rdi
addq $0x30, %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0xef90
movl (%rax), %eax
movl %eax, 0x18(%rsp)
leaq 0x118(%rsp), %rdi
addq $0x18, %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0xef90
movq 0xc0(%rsp), %rdi
movq %rax, %rcx
movl 0x18(%rsp), %eax
addl (%rcx), %eax
movl %eax, 0x1c(%rsp)
xorl %eax, %eax
movl %eax, %esi
callq 0xef70
movq %rax, %rdi
movl $0x2, %esi
callq 0xef90
movq %rax, %rcx
movl 0x1c(%rsp), %eax
imull (%rcx), %eax
movl %eax, 0x28(%rsp)
leaq 0x118(%rsp), %rdi
addq $0x30, %rdi
movl $0x1, %esi
callq 0xef90
movl (%rax), %eax
movl %eax, 0x20(%rsp)
leaq 0x118(%rsp), %rdi
addq $0x18, %rdi
movl $0x1, %esi
callq 0xef90
movq 0xc0(%rsp), %rdi
movq %rax, %rcx
movl 0x20(%rsp), %eax
addl (%rcx), %eax
movl %eax, 0x24(%rsp)
movl $0x1, %esi
callq 0xef70
movq %rax, %rdi
movl $0x2, %esi
callq 0xef90
movl 0x24(%rsp), %ecx
movq %rax, %rdx
movl 0x28(%rsp), %eax
imull (%rdx), %ecx
addl %ecx, %eax
movl %eax, 0x30(%rsp)
leaq 0x118(%rsp), %rdi
addq $0x30, %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0xef90
movq 0xc0(%rsp), %rdi
movl (%rax), %eax
movl %eax, 0x2c(%rsp)
xorl %eax, %eax
movl %eax, %esi
callq 0xef70
movq %rax, %rdi
movl $0x1, %esi
callq 0xef90
movl 0x2c(%rsp), %ecx
movq %rax, %rdx
movl 0x30(%rsp), %eax
imull (%rdx), %ecx
addl %ecx, %eax
movl %eax, 0x38(%rsp)
leaq 0x118(%rsp), %rdi
addq $0x30, %rdi
movl $0x1, %esi
callq 0xef90
movq 0xc0(%rsp), %rdi
movl (%rax), %eax
movl %eax, 0x34(%rsp)
movl $0x1, %esi
callq 0xef70
movq %rax, %rdi
movl $0x1, %esi
callq 0xef90
movl 0x34(%rsp), %ecx
movq %rax, %rdx
movl 0x38(%rsp), %eax
imull (%rdx), %ecx
addl %ecx, %eax
movl %eax, 0x40(%rsp)
leaq 0x118(%rsp), %rdi
addq $0x18, %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0xef90
movq 0xc0(%rsp), %rdi
movl (%rax), %eax
movl %eax, 0x3c(%rsp)
xorl %eax, %eax
movl %eax, %esi
callq 0xef70
movq %rax, %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0xef90
movl 0x3c(%rsp), %ecx
movq %rax, %rdx
movl 0x40(%rsp), %eax
imull (%rdx), %ecx
addl %ecx, %eax
movl %eax, 0x48(%rsp)
leaq 0x118(%rsp), %rdi
addq $0x18, %rdi
movl $0x1, %esi
callq 0xef90
movq 0xc0(%rsp), %rdi
movl (%rax), %eax
movl %eax, 0x44(%rsp)
movl $0x1, %esi
callq 0xef70
movq %rax, %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0xef90
movl 0x44(%rsp), %ecx
movq %rax, %rdx
movl 0x48(%rsp), %eax
imull (%rdx), %ecx
addl %ecx, %eax
movl %eax, 0x114(%rsp)
leaq 0x118(%rsp), %rdi
addq $0x30, %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0xef90
movl (%rax), %eax
movl %eax, 0x4c(%rsp)
leaq 0x118(%rsp), %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0xef90
movq 0xc0(%rsp), %rdi
movq %rax, %rcx
movl 0x4c(%rsp), %eax
addl (%rcx), %eax
movl %eax, 0x50(%rsp)
xorl %eax, %eax
movl %eax, %esi
callq 0xef70
movq %rax, %rdi
movl $0x2, %esi
callq 0xef90
movq %rax, %rcx
movl 0x50(%rsp), %eax
imull (%rcx), %eax
movl %eax, 0x5c(%rsp)
leaq 0x118(%rsp), %rdi
addq $0x30, %rdi
movl $0x1, %esi
callq 0xef90
movl (%rax), %eax
movl %eax, 0x54(%rsp)
leaq 0x118(%rsp), %rdi
movl $0x1, %esi
callq 0xef90
movq 0xc0(%rsp), %rdi
movq %rax, %rcx
movl 0x54(%rsp), %eax
addl (%rcx), %eax
movl %eax, 0x58(%rsp)
movl $0x1, %esi
callq 0xef70
movq %rax, %rdi
movl $0x2, %esi
callq 0xef90
movl 0x58(%rsp), %ecx
movq %rax, %rdx
movl 0x5c(%rsp), %eax
imull (%rdx), %ecx
addl %ecx, %eax
movl %eax, 0x68(%rsp)
leaq 0x118(%rsp), %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0xef90
movq 0xc0(%rsp), %rdi
movl (%rax), %eax
movl %eax, 0x64(%rsp)
xorl %eax, %eax
movl %eax, %esi
callq 0xef70
movq %rax, %rdi
movl $0x1, %esi
callq 0xef90
movq 0xc0(%rsp), %rdi
movl (%rax), %eax
movl %eax, 0x60(%rsp)
xorl %eax, %eax
movl %eax, %esi
callq 0xef70
movq %rax, %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0xef90
movl 0x60(%rsp), %edx
movl 0x64(%rsp), %ecx
movq %rax, %rsi
movl 0x68(%rsp), %eax
addl (%rsi), %edx
imull %edx, %ecx
addl %ecx, %eax
movl %eax, 0x74(%rsp)
leaq 0x118(%rsp), %rdi
movl $0x1, %esi
callq 0xef90
movq 0xc0(%rsp), %rdi
movl (%rax), %eax
movl %eax, 0x70(%rsp)
movl $0x1, %esi
callq 0xef70
movq %rax, %rdi
movl $0x1, %esi
callq 0xef90
movq 0xc0(%rsp), %rdi
movl (%rax), %eax
movl %eax, 0x6c(%rsp)
movl $0x1, %esi
callq 0xef70
movq %rax, %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0xef90
movl 0x6c(%rsp), %edx
movl 0x70(%rsp), %ecx
movq %rax, %rsi
movl 0x74(%rsp), %eax
addl (%rsi), %edx
imull %edx, %ecx
addl %ecx, %eax
movl %eax, 0x110(%rsp)
movl 0x114(%rsp), %eax
cmpl 0x110(%rsp), %eax
jle 0x2c717
movq 0xc0(%rsp), %rax
movl $0x1, 0x58(%rax)
jmp 0x2c726
movq 0xc0(%rsp), %rax
movl $0x0, 0x58(%rax)
movl $0x0, 0xdc(%rsp)
leaq 0xdb(%rsp), %rdi
movq %rdi, 0x10(%rsp)
callq 0xed30
movq 0x10(%rsp), %rcx
leaq 0xe0(%rsp), %rdi
movl $0x3, %esi
leaq 0xdc(%rsp), %rdx
callq 0xed40
jmp 0x2c764
leaq 0xcb(%rsp), %rdi
movq %rdi, 0x8(%rsp)
callq 0xedc0
movq 0x8(%rsp), %rcx
leaq 0xf8(%rsp), %rdi
movl $0x5, %esi
leaq 0xe0(%rsp), %rdx
callq 0xedd0
jmp 0x2c797
movq 0xc0(%rsp), %rdi
leaq 0xf8(%rsp), %rsi
callq 0xee50
leaq 0xf8(%rsp), %rdi
callq 0xee90
leaq 0xcb(%rsp), %rdi
callq 0xeef0
leaq 0xe0(%rsp), %rdi
callq 0xef00
leaq 0xdb(%rsp), %rdi
callq 0xef60
movq 0xc0(%rsp), %rax
movl $0x0, 0x48(%rax)
leaq 0x118(%rsp), %rdi
callq 0xf520
addq $0x168, %rsp            # imm = 0x168
retq
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xd0(%rsp)
movl %eax, 0xcc(%rsp)
jmp 0x2c848
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xd0(%rsp)
movl %eax, 0xcc(%rsp)
leaq 0xcb(%rsp), %rdi
callq 0xeef0
leaq 0xe0(%rsp), %rdi
callq 0xef00
leaq 0xdb(%rsp), %rdi
callq 0xef60
leaq 0x118(%rsp), %rdi
callq 0xf520
movq 0xd0(%rsp), %rdi
callq 0x5690
nop