// File: /workspace/github_cpp_makefile_star2_O2/CMU-SAFARI[P]ramulator/src/SALP.cpp
// Function: ramulator::SALP::SALP(ramulator::SALP::Org, ramulator::SALP::Speed, ramulator::SALP::Type, int)
SALP::SALP(Org org, Speed speed, Type type, int n_sa) :
    type(type),
    n_sa(n_sa),
    org_entry(org_table[int(org)]),
    speed_entry(speed_table[int(speed)]),
    read_latency(speed_entry.nCL + speed_entry.nBL)
{
    switch(int(type)){
        case int(Type::SALP_1): standard_name = "SALP-1"; break;
        case int(Type::SALP_2): standard_name = "SALP-2"; break;
        case int(Type::MASA):   standard_name = "SALP-MASA"; break;
    }
    if (type == Type::SALP_1) {
      scope[int(Command::PRE)] = Level::Bank;
    }
    assert(n_sa && n_sa <= 128 && (n_sa & (n_sa-1)) == 0); // is power of 2, within [1, 128]
    org_entry.count[int(Level::SubArray)] = n_sa;
    long tmp = long(org_entry.dq) * org_entry.count[int(Level::Bank)] * n_sa * org_entry.count[int(Level::Column)];
    org_entry.count[int(Level::Row)] = long(org_entry.size) * (1<<20) / tmp;
    init_speed();
    init_prereq();
    init_rowhit(); // SAUGATA: added row hit function
    init_rowopen();
    init_lambda();
    init_timing();
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x10, %rsp
movl %r8d, %ebp
movl %ecx, %r14d
movl %edx, %r15d
movq %rdi, %rbx
leaq 0x10(%rdi), %rax
movq %rax, (%rdi)
andq $0x0, 0x8(%rdi)
movl %esi, %r12d
movb $0x0, 0x10(%rdi)
movl %ecx, 0x20(%rdi)
addq $0x28, %rdi
leaq 0x1d7ef(%rip), %rsi     # 0xdb170
leaq 0xf(%rsp), %rdx
callq 0x10eea
leaq 0x48(%rbx), %rdi
leaq 0x24b9f(%rip), %rsi     # 0xe2535
leaq 0xe(%rsp), %rdx
callq 0x10eea
leaq 0x68(%rbx), %rdi
leaq 0x1d7c9(%rip), %rsi     # 0xdb174
leaq 0xd(%rsp), %rdx
callq 0x10eea
leaq 0x88(%rbx), %rdi
leaq 0x24b78(%rip), %rsi     # 0xe253b
leaq 0xc(%rsp), %rdx
callq 0x10eea
leaq 0xa8(%rbx), %rdi
leaq 0x1d79d(%rip), %rsi     # 0xdb178
leaq 0xb(%rsp), %rdx
callq 0x10eea
leaq 0xc8(%rbx), %rdi
leaq 0x141af(%rip), %rsi     # 0xd1ba2
leaq 0xa(%rsp), %rdx
callq 0x10eea
leaq 0xe8(%rbx), %rdi
leaq 0x1d770(%rip), %rsi     # 0xdb17b
leaq 0x9(%rsp), %rdx
callq 0x10eea
leaq 0x108(%rbx), %rdi
leaq 0x1d75c(%rip), %rsi     # 0xdb17f
leaq 0x8(%rsp), %rdx
callq 0x10eea
leaq 0x128(%rbx), %rdi
leaq 0x268ac(%rip), %rsi     # 0xe42e7
leaq 0x7(%rsp), %rdx
callq 0x10eea
leaq 0x148(%rbx), %rdi
leaq 0x1d730(%rip), %rsi     # 0xdb183
leaq 0x6(%rsp), %rdx
callq 0x10eea
leaq 0x168(%rbx), %rdi
leaq 0x1d71c(%rip), %rsi     # 0xdb187
leaq 0x5(%rsp), %rdx
callq 0x10eea
leaq 0x188(%rbx), %rdi
leaq 0x1d708(%rip), %rsi     # 0xdb18b
leaq 0x4(%rsp), %rdx
callq 0x10eea
leaq 0x1a8(%rbx), %rdi
leaq 0x1d6f4(%rip), %rsi     # 0xdb18f
leaq 0x3(%rsp), %rdx
callq 0x10eea
leaq 0x1c8(%rbx), %rdi
leaq 0x24a8d(%rip), %rsi     # 0xe2540
leaq 0x2(%rsp), %rdx
callq 0x10eea
movups 0x24cec(%rip), %xmm0    # 0xe27b0
movups %xmm0, 0x208(%rbx)
movups 0x24cce(%rip), %xmm0    # 0xe27a0
movups %xmm0, 0x1f8(%rbx)
movups 0x24cb0(%rip), %xmm0    # 0xe2790
movups %xmm0, 0x1e8(%rbx)
movabsq $0x300000001, %rax      # imm = 0x300000001
movq %rax, 0x218(%rbx)
movabsq $0x700000001, %rax      # imm = 0x700000001
movq %rax, 0x230(%rbx)
movups 0x24cb8(%rip), %xmm0    # 0xe27c8
movups %xmm0, 0x220(%rbx)
movups 0x25b56(%rip), %xmm0    # 0xe3674
movups %xmm0, 0x238(%rbx)
movq $0xb, 0x248(%rbx)
leaq 0x250(%rbx), %rdi
movl $0x31e0, %edx           # imm = 0x31E0
xorl %esi, %esi
callq 0xb1d0
movl %ebp, 0x3430(%rbx)
leaq 0x3434(%rbx), %rdi
leaq 0x24c89(%rip), %rsi     # 0xe27e0
movl $0x1e0, %edx            # imm = 0x1E0
callq 0xb270
movslq %r12d, %rax
shlq $0x5, %rax
movups 0x3434(%rbx,%rax), %xmm0
movups 0x3444(%rbx,%rax), %xmm1
movups %xmm0, 0x3614(%rbx)
movups %xmm1, 0x3624(%rbx)
movabsq $0x4000000008, %rax     # imm = 0x4000000008
movq %rax, 0x3634(%rbx)
leaq 0x3640(%rbx), %rdi
leaq 0x24e1b(%rip), %rsi     # 0xe29c0
movl $0x700, %edx            # imm = 0x700
callq 0xb270
leaq 0x3d40(%rbx), %rdi
movslq %r15d, %rax
shlq $0x7, %rax
leaq (%rbx,%rax), %rsi
addq $0x3640, %rsi           # imm = 0x3640
pushq $0x10
popq %rcx
rep  movsq (%rsi), %es:(%rdi)
movl 0x3d58(%rbx), %eax
addl 0x3d64(%rbx), %eax
movl %eax, 0x3dc0(%rbx)
testl %r14d, %r14d
je 0xbdc0b
cmpl $0x1, %r14d
je 0xbdbfa
cmpl $0x2, %r14d
jne 0xbdc24
leaq 0x13799(%rip), %rsi     # 0xd1391
jmp 0xbdc01
leaq 0x2492d(%rip), %rsi     # 0xe252e
movq %rbx, %rdi
callq 0xb510
jmp 0xbdc24
leaq 0x24915(%rip), %rsi     # 0xe2527
movq %rbx, %rdi
callq 0xb510
movl $0x2, 0x1f0(%rbx)
testl %ebp, %ebp
je 0xbdcec
cmpl $0x80, %ebp
jg 0xbdcec
movl %ebp, %eax
shrl %eax
andl $0x55555555, %eax       # imm = 0x55555555
movl %ebp, %ecx
subl %eax, %ecx
movl $0x33333333, %eax       # imm = 0x33333333
movl %ecx, %edx
andl %eax, %edx
shrl $0x2, %ecx
andl %eax, %ecx
addl %edx, %ecx
movl %ecx, %eax
shrl $0x4, %eax
addl %ecx, %eax
andl $0xf0f0f0f, %eax        # imm = 0xF0F0F0F
imull $0x1010101, %eax, %eax  # imm = 0x1010101
shrl $0x18, %eax
cmpl $0x2, %eax
jae 0xbdcec
movl %ebp, 0x3628(%rbx)
movslq 0x3618(%rbx), %rax
movslq 0x3624(%rbx), %rcx
movslq %ebp, %rdx
imulq %rax, %rdx
movslq 0x3630(%rbx), %rsi
imulq %rcx, %rsi
imulq %rdx, %rsi
movslq 0x3614(%rbx), %rax
shlq $0x14, %rax
cqto
idivq %rsi
movl %eax, 0x362c(%rbx)
movq %rbx, %rdi
callq 0xbde7e
movq %rbx, %rdi
callq 0xbe2ba
movq %rbx, %rdi
callq 0xbe626
movq %rbx, %rdi
callq 0xbe74c
movq %rbx, %rdi
callq 0xbe888
movq %rbx, %rdi
callq 0xbef2c
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
leaq 0x20c25(%rip), %rdi     # 0xde918
leaq 0x24850(%rip), %rsi     # 0xe254a
leaq 0x24856(%rip), %rcx     # 0xe2557
pushq $0x31
popq %rdx
callq 0xb210
jmp 0xbddb9
movq %rax, %r14
movl $0x1c8, %r15d           # imm = 0x1C8
jmp 0xbdd95
movq %rax, %r14
movl $0x1a8, %r15d           # imm = 0x1A8
jmp 0xbdd95
movq %rax, %r14
movl $0x188, %r15d           # imm = 0x188
jmp 0xbdd95
movq %rax, %r14
movl $0x168, %r15d           # imm = 0x168
jmp 0xbdd95
movq %rax, %r14
movl $0x148, %r15d           # imm = 0x148
jmp 0xbdd95
movq %rax, %r14
movl $0x128, %r15d           # imm = 0x128
jmp 0xbdd95
movq %rax, %r14
movl $0x108, %r15d           # imm = 0x108
jmp 0xbdd95
movq %rax, %r14
movl $0xe8, %r15d
jmp 0xbdd95
movq %rax, %r14
movl $0xc8, %r15d
jmp 0xbdd95
movq %rax, %r14
movl $0xa8, %r15d
jmp 0xbdd95
movq %rax, %r14
movl $0x88, %r15d
jmp 0xbdd95
movq %rax, %r14
pushq $0x68
jmp 0xbdd93
movq %rax, %r14
pushq $0x48
popq %r15
leaq -0x20(%rbx), %r12
leaq (%r12,%r15), %rdi
addq $-0x20, %r15
callq 0xb568
cmpq $0x28, %r15
jne 0xbdd99
jmp 0xbde6d
movq %rax, %r14
jmp 0xbde6d
movq %rax, %r14
leaq 0x3410(%rbx), %r15
xorl %r12d, %r12d
leaq (%r15,%r12), %rdi
callq 0x96b6a
addq $-0x20, %r12
cmpq $-0xa80, %r12           # imm = 0xF580
jne 0xbddc6
leaq 0x2998(%rbx), %r15
xorl %r12d, %r12d
leaq (%r15,%r12), %rdi
callq 0x350a8
addq $-0x18, %r12
cmpq $-0x7e0, %r12           # imm = 0xF820
jne 0xbdde6
leaq 0x21b0(%rbx), %r15
xorl %r12d, %r12d
leaq (%r15,%r12), %rdi
callq 0x96b6a
addq $-0x20, %r12
cmpq $-0xa80, %r12           # imm = 0xF580
jne 0xbde06
movl $0x1730, %r15d          # imm = 0x1730
leaq (%rbx,%r15), %rdi
callq 0x96b6a
addq $-0x20, %r15
cmpq $0xcb0, %r15            # imm = 0xCB0
jne 0xbde22
movl $0xcb0, %r15d           # imm = 0xCB0
leaq (%rbx,%r15), %rdi
callq 0x96b6a
addq $-0x20, %r15
cmpq $0x230, %r15            # imm = 0x230
jne 0xbde3e
movl $0x1c8, %r15d           # imm = 0x1C8
leaq (%rbx,%r15), %rdi
callq 0xb568
addq $-0x20, %r15
cmpq $0x8, %r15
jne 0xbde5a
movq %rbx, %rdi
callq 0xb568
movq %r14, %rdi
callq 0xb4d0
nop