// File: gvaumour[P]cache-simulator/src/Level.cc
// Function: Level::Level(int, std::vector<ConfigCache, std::allocator<ConfigCache>>, Hierarchy*)
Level::Level(int id_core, std::vector<ConfigCache> configs, Hierarchy* system) : m_IDcore(id_core), m_system(system){
	assert(configs.size()  >  0);
	
	m_isUnified = true;
	m_printStats = configs[0].m_printStats;
	
	m_dcache = new HybridCache(m_IDcore, false, configs[0].m_size, configs[0].m_assoc , \
					configs[0].m_blocksize, configs[0].m_nbNVMways, configs[0].m_policy, this);
	
	m_dcache->setPrintState(m_printStats);
	m_icache = NULL;	
	if(configs.size() == 2){
		m_isUnified = false;
		m_icache = new HybridCache(m_IDcore, true, configs[1].m_size, configs[1].m_assoc , \
					configs[1].m_blocksize, configs[1].m_nbNVMways, configs[1].m_policy, this);
		m_icache->setPrintState(m_printStats);
	}
}

// Assembly:
subq $0xf8, %rsp
movq %rdx, 0x68(%rsp)
movq %rdi, %rax
movq 0x68(%rsp), %rdi
movq %rdi, 0x70(%rsp)
movq %rax, 0xf0(%rsp)
movl %esi, 0xec(%rsp)
movq %rdi, 0xe0(%rsp)
movq %rcx, 0xd8(%rsp)
movq 0xf0(%rsp), %rax
movq %rax, 0x78(%rsp)
movl 0xec(%rsp), %ecx
movl %ecx, 0x10(%rax)
movq 0xd8(%rsp), %rcx
movq %rcx, 0x18(%rax)
callq 0x34dc0
cmpq $0x0, %rax
jbe 0x46758
jmp 0x46777
leaq 0x2c755(%rip), %rdi     # 0x72eb4
leaq 0x2c761(%rip), %rsi     # 0x72ec7
movl $0x16, %edx
leaq 0x2c762(%rip), %rcx     # 0x72ed4
callq 0x5260
movq 0x70(%rsp), %rdi
movq 0x78(%rsp), %rax
movb $0x1, 0x20(%rax)
xorl %eax, %eax
movl %eax, %esi
movq %rsi, 0x58(%rsp)
callq 0x47280
movq %rax, %rcx
movq 0x78(%rsp), %rax
movb 0x34(%rcx), %cl
andb $0x1, %cl
movb %cl, 0x21(%rax)
movl $0x230, %edi            # imm = 0x230
callq 0x53a0
movq 0x70(%rsp), %rdi
movq 0x58(%rsp), %rsi
movq %rax, %rcx
movq 0x78(%rsp), %rax
movq %rcx, 0x40(%rsp)
movb $0x1, 0xab(%rsp)
movl 0x10(%rax), %eax
movl %eax, 0x48(%rsp)
callq 0x47280
movq 0x70(%rsp), %rdi
movq 0x58(%rsp), %rsi
movl (%rax), %eax
movl %eax, 0x4c(%rsp)
callq 0x47280
movq 0x70(%rsp), %rdi
movq 0x58(%rsp), %rsi
movl 0x4(%rax), %eax
movl %eax, 0x50(%rsp)
callq 0x47280
movq 0x70(%rsp), %rdi
movq 0x58(%rsp), %rsi
movl 0x8(%rax), %eax
movl %eax, 0x54(%rsp)
callq 0x47280
movq 0x70(%rsp), %rdi
movq 0x58(%rsp), %rsi
movl 0x30(%rax), %eax
movl %eax, 0x64(%rsp)
callq 0x47280
movq %rax, %rsi
addq $0x10, %rsi
leaq 0xb8(%rsp), %rdi
callq 0x51b0
jmp 0x46846
movl 0x54(%rsp), %r9d
movl 0x50(%rsp), %r8d
movl 0x4c(%rsp), %ecx
movl 0x48(%rsp), %esi
movq 0x40(%rsp), %rdi
movl 0x64(%rsp), %edx
movq 0x78(%rsp), %r10
movq %rsp, %rax
movq %r10, 0x10(%rax)
leaq 0xb8(%rsp), %r10
movq %r10, 0x8(%rax)
movl %edx, (%rax)
xorl %edx, %edx
callq 0x35be0
jmp 0x46884
movq 0x78(%rsp), %rax
movq 0x40(%rsp), %rcx
movb $0x0, 0xab(%rsp)
movq %rcx, (%rax)
leaq 0xb8(%rsp), %rdi
callq 0x5768
movq 0x78(%rsp), %rax
movq (%rax), %rdi
movb 0x21(%rax), %al
andb $0x1, %al
movzbl %al, %esi
callq 0x472a0
movq 0x78(%rsp), %rax
movq 0x70(%rsp), %rdi
movq $0x0, 0x8(%rax)
callq 0x34dc0
cmpq $0x2, %rax
jne 0x46aa9
movq 0x78(%rsp), %rax
movb $0x0, 0x20(%rax)
movl $0x230, %edi            # imm = 0x230
callq 0x53a0
movq 0x70(%rsp), %rdi
movq %rax, %rcx
movq 0x78(%rsp), %rax
movq %rcx, 0x18(%rsp)
movb $0x1, 0x87(%rsp)
movl 0x10(%rax), %eax
movl %eax, 0x20(%rsp)
movl $0x1, %esi
movq %rsi, 0x30(%rsp)
callq 0x47280
movq 0x70(%rsp), %rdi
movq 0x30(%rsp), %rsi
movl (%rax), %eax
movl %eax, 0x24(%rsp)
callq 0x47280
movq 0x70(%rsp), %rdi
movq 0x30(%rsp), %rsi
movl 0x4(%rax), %eax
movl %eax, 0x28(%rsp)
callq 0x47280
movq 0x70(%rsp), %rdi
movq 0x30(%rsp), %rsi
movl 0x8(%rax), %eax
movl %eax, 0x2c(%rsp)
callq 0x47280
movq 0x70(%rsp), %rdi
movq 0x30(%rsp), %rsi
movl 0x30(%rax), %eax
movl %eax, 0x3c(%rsp)
callq 0x47280
movq %rax, %rsi
addq $0x10, %rsi
leaq 0x88(%rsp), %rdi
callq 0x51b0
jmp 0x4698c
movl 0x2c(%rsp), %r9d
movl 0x28(%rsp), %r8d
movl 0x24(%rsp), %ecx
movl 0x20(%rsp), %esi
movq 0x18(%rsp), %rdi
movl 0x3c(%rsp), %edx
movq 0x78(%rsp), %r10
movq %rsp, %rax
movq %r10, 0x10(%rax)
leaq 0x88(%rsp), %r10
movq %r10, 0x8(%rax)
movl %edx, (%rax)
movl $0x1, %edx
callq 0x35be0
jmp 0x469cd
movq 0x78(%rsp), %rax
movq 0x18(%rsp), %rcx
movb $0x0, 0x87(%rsp)
movq %rcx, 0x8(%rax)
leaq 0x88(%rsp), %rdi
callq 0x5768
movq 0x78(%rsp), %rax
movq 0x8(%rax), %rdi
movb 0x21(%rax), %al
andb $0x1, %al
movzbl %al, %esi
callq 0x472a0
jmp 0x46aa9
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xb0(%rsp)
movl %eax, 0xac(%rsp)
jmp 0x46a42
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xb0(%rsp)
movl %eax, 0xac(%rsp)
leaq 0xb8(%rsp), %rdi
callq 0x5768
testb $0x1, 0xab(%rsp)
jne 0x46a4e
jmp 0x46a58
movq 0x40(%rsp), %rdi
callq 0x5340
jmp 0x46ab1
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xb0(%rsp)
movl %eax, 0xac(%rsp)
jmp 0x46a91
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xb0(%rsp)
movl %eax, 0xac(%rsp)
leaq 0x88(%rsp), %rdi
callq 0x5768
testb $0x1, 0x87(%rsp)
jne 0x46a9d
jmp 0x46aa7
movq 0x18(%rsp), %rdi
callq 0x5340
jmp 0x46ab1
addq $0xf8, %rsp
retq
movq 0xb0(%rsp), %rdi
callq 0x5690
nop