// File: /workspace/github_cpp_makefile_star2_O1/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 0x11174
leaq 0x91e5(%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 0x110e4
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 0x110e4
leaq 0x4074(%rip), %rsi      # 0x14b50
leaq 0xd0(%rsp), %rdi
callq 0x33f0
leaq 0x73a8(%r14), %r12
movl 0x737c(%r14), %edx
leaq 0xd0(%rsp), %rsi
movq %r12, %rdi
callq 0x11350
movq 0xd0(%rsp), %rdi
cmpq %r15, %rdi
je 0x10b19
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 0x110e4
leaq 0x44f9(%rip), %rsi      # 0x15048
leaq 0xb0(%rsp), %rdi
callq 0x33f0
leaq 0x9048(%r14), %rdi
movl 0x7380(%r14), %edx
leaq 0xb0(%rsp), %rsi
movq %rdi, 0x28(%rsp)
callq 0x11350
movq 0xb0(%rsp), %rdi
cmpq %rbx, %rdi
je 0x10b8e
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 0x110e4
leaq 0x448d(%rip), %rsi      # 0x1504c
leaq 0x90(%rsp), %rdi
callq 0x33f0
leaq 0xace8(%r14), %rdi
movl 0x7384(%r14), %edx
leaq 0x90(%rsp), %rsi
movq %rdi, 0x20(%rsp)
callq 0x11350
movq 0x90(%rsp), %rdi
cmpq %rbx, %rdi
je 0x10bfe
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 0x110e4
leaq 0x4424(%rip), %rsi      # 0x15050
leaq 0x70(%rsp), %rdi
callq 0x33f0
leaq 0xc988(%r14), %rdi
movl 0x7388(%r14), %edx
leaq 0x70(%rsp), %rsi
movq %rdi, 0x18(%rsp)
callq 0x11350
movq 0x70(%rsp), %rdi
cmpq %rbx, %rdi
je 0x10c62
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 0x110e4
leaq 0x43c9(%rip), %rsi      # 0x15056
leaq 0x50(%rsp), %rdi
callq 0x33f0
leaq 0xe628(%r14), %rdi
leaq 0x50(%rsp), %rsi
movq %rdi, 0x10(%rsp)
movl $0x100, %edx            # imm = 0x100
callq 0x11350
movq 0x50(%rsp), %rdi
cmpq %rbx, %rdi
je 0x10cc1
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 0x10e4f
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
pxor 0x3f02(%rip), %xmm0     # 0x14c40
movdqa %xmm0, 0xf0(%rsp)
leaq (,%r13,4), %rax
addq %r13, %rax
shlq $0x4, %rax
movq %rax, 0x48(%rsp)
xorl %ebx, %ebx
movq %r15, %rdi
callq 0x3030
testq %r13, %r13
pxor %xmm0, %xmm0
je 0x10d9d
movq %rax, %rcx
addq 0x48(%rsp), %rcx
movq %rax, %rdx
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 0x10d79
movq 0x8(%rsp), %rcx
movq 0x7390(%rcx), %rcx
movq %rax, (%rcx,%rbx,8)
testq %r13, %r13
je 0x10e43
movq 0x8(%rsp), %rax
movq 0x7390(%rax), %rax
movq (%rax,%rbx,8), %rax
addq $0x48, %rax
xorl %ecx, %ecx
movdqa 0x3e5c(%rip), %xmm0     # 0x14c30
movdqa %xmm0, %xmm1
pxor 0x3e60(%rip), %xmm1     # 0x14c40
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 0x10e14
movl %ecx, (%rax)
pxor 0x3df4(%rip), %xmm1     # 0x14c10
pextrw $0x4, %xmm1, %edx
testb $0x1, %dl
je 0x10e2c
leal 0x1(%rcx), %edx
movl %edx, 0x50(%rax)
addq $0x2, %rcx
paddq 0x3e18(%rip), %xmm0     # 0x14c50
addq $0xa0, %rax
cmpq %rcx, %rbp
jne 0x10dd4
incq %rbx
cmpq %r12, %rbx
jne 0x10d5d
movq 0x8(%rsp), %rbx
leaq 0x102e8(%rbx), %rdi
pxor %xmm0, %xmm0
movdqu %xmm0, 0x8(%rbx)
movl $0xc0, %edx
xorl %esi, %esi
callq 0x3130
pxor %xmm0, %xmm0
movdqu %xmm0, 0x18(%rbx)
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 0x10f4e
jmp 0x10ead
movq %rax, %r14
movq 0x50(%rsp), %rdi
cmpq %rbx, %rdi
je 0x10f5b
callq 0x3220
jmp 0x10f5b
movq %rax, %r14
jmp 0x10f5b
jmp 0x10ed2
movq %rax, %r14
movq 0x70(%rsp), %rdi
cmpq %rbx, %rdi
je 0x10f65
callq 0x3220
jmp 0x10f65
movq %rax, %r14
jmp 0x10f65
jmp 0x10ef1
movq %rax, %r14
movq 0x90(%rsp), %rdi
cmpq %rbx, %rdi
je 0x10f6f
callq 0x3220
jmp 0x10f6f
movq %rax, %r14
jmp 0x10f6f
jmp 0x10f0f
movq %rax, %r14
movq 0xb0(%rsp), %rdi
cmpq %rbx, %rdi
je 0x10f79
callq 0x3220
jmp 0x10f79
movq %rax, %r14
jmp 0x10f79
jmp 0x10f2d
movq %rax, %r14
movq 0xd0(%rsp), %rdi
cmpq %r15, %rdi
je 0x10f83
callq 0x3220
jmp 0x10f83
movq %rax, %r14
jmp 0x10f83
movq %rax, %r14
jmp 0x10f97
movq %rax, %r14
movq 0x10(%rsp), %rdi
callq 0x1152c
movq 0x18(%rsp), %rdi
callq 0x1152c
movq 0x20(%rsp), %rdi
callq 0x1152c
movq 0x28(%rsp), %rdi
callq 0x1152c
movq 0x30(%rsp), %rdi
callq 0x1152c
movq 0x40(%rsp), %rax
movq (%rax), %rdi
cmpq 0x38(%rsp), %rdi
je 0x10f97
callq 0x3220
movq 0x8(%rsp), %rdi
callq 0x11556
movq %r14, %rdi
callq 0x33d0
nop