// File: /workspace/github_cpp_makefile_star2_O3/NishadSaraf[P]Championship-Simulator/inc/cache.h
// Function: CACHE::CACHE(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, unsigned int, int, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int)
CACHE(string v1, uint32_t v2, int v3, uint32_t v4, uint32_t v5, uint32_t v6, uint32_t v7, uint32_t v8) 
        : NAME(v1), NUM_SET(v2), NUM_WAY(v3), NUM_LINE(v4), WQ_SIZE(v5), RQ_SIZE(v6), PQ_SIZE(v7), MSHR_SIZE(v8) {

        LATENCY = 0;

        // cache block
        block = new BLOCK* [NUM_SET];
        for (uint32_t i=0; i<NUM_SET; i++) {
            block[i] = new BLOCK[NUM_WAY]; 

            for (uint32_t j=0; j<NUM_WAY; j++) {
                block[i][j].lru = j;
            }
        }

        for (uint32_t i=0; i<NUM_CPUS; i++) {
            upper_level_icache[i] = NULL;
            upper_level_dcache[i] = NULL;

            for (uint32_t j=0; j<NUM_TYPES; j++) {
                sim_access[i][j] = 0;
                sim_hit[i][j] = 0;
                sim_miss[i][j] = 0;
                roi_access[i][j] = 0;
                roi_hit[i][j] = 0;
                roi_miss[i][j] = 0;
            }
        }

        lower_level = NULL;
        extra_interface = NULL;
        fill_level = -1;
        MAX_READ = 1;
        MAX_FILL = 1;
    }

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x108, %rsp            # imm = 0x108
movl %r9d, %ebp
movl %r8d, %r14d
movl %ecx, %r15d
movl %edx, %r12d
movq %rsi, %r13
movq %rdi, %rbx
callq 0x10f66
leaq 0x940f(%rip), %rax      # 0x19c10
addq $0x10, %rax
movq %rax, (%rbx)
leaq 0x7350(%rbx), %rdi
leaq 0x7360(%rbx), %rax
movq %rax, 0x38(%rsp)
movq %rax, 0x7350(%rbx)
movq (%r13), %rsi
movq 0x8(%r13), %rdx
addq %rsi, %rdx
movq %rdi, 0x40(%rsp)
movq %rbx, 0x8(%rsp)
callq 0x10ed0
movl 0x150(%rsp), %eax
movl 0x148(%rsp), %ecx
movl 0x140(%rsp), %edx
movl %r12d, 0x7370(%rbx)
movl %r15d, 0x7374(%rbx)
movl %r14d, 0x7378(%rbx)
movl %ebp, 0x737c(%rbx)
movl %edx, 0x7380(%rbx)
movl %ecx, 0x7384(%rbx)
movl %eax, 0x7388(%rbx)
leaq 0xe0(%rsp), %r15
movq %r15, -0x10(%r15)
movq 0x7350(%rbx), %rsi
movq 0x7358(%rbx), %rdx
addq %rsi, %rdx
leaq 0xd0(%rsp), %rdi
movq %rbx, %r14
callq 0x10ed0
leaq 0x42de(%rip), %rsi      # 0x14b90
leaq 0xd0(%rsp), %rdi
callq 0x33f0
leaq 0x73a8(%r14), %r12
movl 0x737c(%r14), %edx
leaq 0xd0(%rsp), %rsi
movq %r12, %rdi
callq 0x11142
movq 0xd0(%rsp), %rdi
cmpq %r15, %rdi
je 0x108ef
callq 0x3220
leaq 0xc0(%rsp), %rbx
movq %rbx, -0x10(%rbx)
movq 0x7350(%r14), %rsi
movq 0x7358(%r14), %rdx
addq %rsi, %rdx
leaq 0xb0(%rsp), %rdi
movq %r12, 0x30(%rsp)
callq 0x10ed0
leaq 0x4753(%rip), %rsi      # 0x15078
leaq 0xb0(%rsp), %rdi
callq 0x33f0
leaq 0x9048(%r14), %rdi
movl 0x7380(%r14), %edx
leaq 0xb0(%rsp), %rsi
movq %rdi, 0x28(%rsp)
callq 0x11142
movq 0xb0(%rsp), %rdi
cmpq %rbx, %rdi
je 0x10964
callq 0x3220
leaq 0xa0(%rsp), %rbx
movq %rbx, -0x10(%rbx)
movq 0x7350(%r14), %rsi
movq 0x7358(%r14), %rdx
addq %rsi, %rdx
leaq 0x90(%rsp), %rdi
callq 0x10ed0
leaq 0x46e7(%rip), %rsi      # 0x1507c
leaq 0x90(%rsp), %rdi
callq 0x33f0
leaq 0xace8(%r14), %rdi
movl 0x7384(%r14), %edx
leaq 0x90(%rsp), %rsi
movq %rdi, 0x20(%rsp)
callq 0x11142
movq 0x90(%rsp), %rdi
cmpq %rbx, %rdi
je 0x109d4
callq 0x3220
leaq 0x80(%rsp), %rbx
movq %rbx, -0x10(%rbx)
movq 0x7350(%r14), %rsi
movq 0x7358(%r14), %rdx
addq %rsi, %rdx
leaq 0x70(%rsp), %rdi
callq 0x10ed0
leaq 0x467e(%rip), %rsi      # 0x15080
leaq 0x70(%rsp), %rdi
callq 0x33f0
leaq 0xc988(%r14), %rdi
movl 0x7388(%r14), %edx
leaq 0x70(%rsp), %rsi
movq %rdi, 0x18(%rsp)
callq 0x11142
movq 0x70(%rsp), %rdi
cmpq %rbx, %rdi
je 0x10a38
callq 0x3220
leaq 0x60(%rsp), %rbx
movq %rbx, -0x10(%rbx)
movq 0x7350(%r14), %rsi
movq 0x7358(%r14), %rdx
addq %rsi, %rdx
leaq 0x50(%rsp), %rdi
callq 0x10ed0
leaq 0x4623(%rip), %rsi      # 0x15086
leaq 0x50(%rsp), %rdi
callq 0x33f0
leaq 0xe628(%r14), %rdi
leaq 0x50(%rsp), %rsi
movq %rdi, 0x10(%rsp)
movl $0x100, %edx            # imm = 0x100
callq 0x11142
movq 0x50(%rsp), %rdi
cmpq %rbx, %rdi
je 0x10a97
callq 0x3220
pxor %xmm0, %xmm0
movdqu %xmm0, 0x102d8(%r14)
movdqu %xmm0, 0x102c8(%r14)
movl $0x0, 0x738c(%r14)
movl 0x7370(%r14), %r12d
leaq (,%r12,8), %rdi
callq 0x3030
movq %rax, 0x7390(%r14)
testq %r12, %r12
je 0x10c3b
movq 0x8(%rsp), %rax
movl 0x7374(%rax), %r13d
movq %r13, %rax
shlq $0x4, %rax
leaq (%rax,%rax,4), %r15
leaq 0x1(%r13), %rbp
andq $-0x2, %rbp
leaq -0x1(%r13), %rax
movq %rax, %xmm0
pshufd $0x44, %xmm0, %xmm0     # xmm0 = xmm0[0,1,0,1]
xorl %r14d, %r14d
leaq (,%r13,4), %rax
addq %r13, %rax
shlq $0x4, %rax
movq %rax, 0x48(%rsp)
pxor 0x4148(%rip), %xmm0     # 0x14c70
movdqa %xmm0, 0xf0(%rsp)
xorl %ebx, %ebx
movq %r15, %rdi
callq 0x3030
testq %r13, %r13
je 0x10c1f
movq %rax, %rcx
addq 0x48(%rsp), %rcx
movq %rax, %rdx
pxor %xmm0, %xmm0
movl %r14d, 0x10(%rdx)
movdqu %xmm0, (%rdx)
movdqu %xmm0, 0x18(%rdx)
movdqu %xmm0, 0x28(%rdx)
movdqu %xmm0, 0x38(%rdx)
movl %r14d, 0x48(%rdx)
addq $0x50, %rdx
cmpq %rcx, %rdx
jne 0x10b53
movq 0x8(%rsp), %rcx
movq 0x7390(%rcx), %rcx
movq %rax, (%rcx,%rbx,8)
testq %r13, %r13
je 0x10c2f
movq 0x8(%rsp), %rax
movq 0x7390(%rax), %rax
movq (%rax,%rbx,8), %rax
addq $0x48, %rax
xorl %ecx, %ecx
movdqa 0x40b2(%rip), %xmm0     # 0x14c60
movdqa %xmm0, %xmm1
pxor 0x40b6(%rip), %xmm1     # 0x14c70
movdqa %xmm1, %xmm2
movdqa 0xf0(%rsp), %xmm3
pcmpgtd %xmm3, %xmm2
pcmpeqd %xmm3, %xmm1
pshufd $0xf5, %xmm1, %xmm3     # xmm3 = xmm1[1,1,3,3]
pand %xmm2, %xmm3
pshufd $0xf5, %xmm2, %xmm1     # xmm1 = xmm2[1,1,3,3]
por %xmm3, %xmm1
movd %xmm1, %edx
notl %edx
testb $0x1, %dl
je 0x10bee
movl %ecx, (%rax)
pxor 0x405a(%rip), %xmm1     # 0x14c50
pextrw $0x4, %xmm1, %edx
testb $0x1, %dl
je 0x10c06
leal 0x1(%rcx), %edx
movl %edx, 0x50(%rax)
addq $0x2, %rcx
paddq 0x406e(%rip), %xmm0     # 0x14c80
addq $0xa0, %rax
cmpq %rcx, %rbp
jne 0x10bae
jmp 0x10c2f
movq 0x8(%rsp), %rcx
movq 0x7390(%rcx), %rcx
movq %rax, (%rcx,%rbx,8)
incq %rbx
cmpq %r12, %rbx
jne 0x10b33
movq 0x8(%rsp), %rbx
leaq 0x102e8(%rbx), %rdi
pxor %xmm0, %xmm0
movdqu %xmm0, 0x18(%rbx)
movdqu %xmm0, 0x8(%rbx)
movl $0xc0, %edx
xorl %esi, %esi
callq 0x3130
movabsq $0x1ffffffff, %rax      # imm = 0x1FFFFFFFF
movq %rax, 0x7398(%rbx)
movl $0x1, 0x73a0(%rbx)
addq $0x108, %rsp            # imm = 0x108
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x10d36
jmp 0x10c95
movq %rax, %r14
movq 0x50(%rsp), %rdi
cmpq %rbx, %rdi
je 0x10d43
callq 0x3220
jmp 0x10d43
movq %rax, %r14
jmp 0x10d43
jmp 0x10cba
movq %rax, %r14
movq 0x70(%rsp), %rdi
cmpq %rbx, %rdi
je 0x10d4d
callq 0x3220
jmp 0x10d4d
movq %rax, %r14
jmp 0x10d4d
jmp 0x10cd9
movq %rax, %r14
movq 0x90(%rsp), %rdi
cmpq %rbx, %rdi
je 0x10d57
callq 0x3220
jmp 0x10d57
movq %rax, %r14
jmp 0x10d57
jmp 0x10cf7
movq %rax, %r14
movq 0xb0(%rsp), %rdi
cmpq %rbx, %rdi
je 0x10d61
callq 0x3220
jmp 0x10d61
movq %rax, %r14
jmp 0x10d61
jmp 0x10d15
movq %rax, %r14
movq 0xd0(%rsp), %rdi
cmpq %r15, %rdi
je 0x10d6b
callq 0x3220
jmp 0x10d6b
movq %rax, %r14
jmp 0x10d6b
movq %rax, %r14
jmp 0x10d7f
movq %rax, %r14
movq 0x10(%rsp), %rdi
callq 0x1131e
movq 0x18(%rsp), %rdi
callq 0x1131e
movq 0x20(%rsp), %rdi
callq 0x1131e
movq 0x28(%rsp), %rdi
callq 0x1131e
movq 0x30(%rsp), %rdi
callq 0x1131e
movq 0x40(%rsp), %rax
movq (%rax), %rdi
cmpq 0x38(%rsp), %rdi
je 0x10d7f
callq 0x3220
movq 0x8(%rsp), %rdi
callq 0x11348
movq %r14, %rdi
callq 0x33d0
nop