// File: /workspace/github_cpp_makefile_star2_O3/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 %r13
pushq %r12
pushq %rbx
pushq %rax
movl %r8d, %ebp
movl %ecx, %r14d
movl %edx, %r15d
movl %esi, %r12d
movq %rdi, %rbx
leaq 0x10(%rdi), %r13
movq %r13, (%rdi)
movq $0x0, 0x8(%rdi)
movb $0x0, 0x10(%rdi)
movl %ecx, 0x20(%rdi)
addq $0x28, %rdi
leaq 0x38(%rbx), %rax
movq %rax, 0x28(%rbx)
leaq 0x2343e(%rip), %rsi     # 0x1541d1
leaq 0x2343a(%rip), %rdx     # 0x1541d4
callq 0x175a0
leaq 0x48(%rbx), %rdi
leaq 0x58(%rbx), %rax
movq %rax, 0x48(%rbx)
leaq 0x2a7c3(%rip), %rsi     # 0x15b575
leaq 0x2a7c1(%rip), %rdx     # 0x15b57a
callq 0x175a0
leaq 0x68(%rbx), %rdi
leaq 0x78(%rbx), %rax
movq %rax, 0x68(%rbx)
leaq 0x23404(%rip), %rsi     # 0x1541d5
leaq 0x23400(%rip), %rdx     # 0x1541d8
callq 0x175a0
leaq 0x88(%rbx), %rdi
leaq 0x98(%rbx), %rax
movq %rax, 0x88(%rbx)
leaq 0x2a782(%rip), %rsi     # 0x15b57b
leaq 0x2a77f(%rip), %rdx     # 0x15b57f
callq 0x175a0
leaq 0xa8(%rbx), %rdi
leaq 0xb8(%rbx), %rax
movq %rax, 0xa8(%rbx)
leaq 0x233b8(%rip), %rsi     # 0x1541d9
leaq 0x233b3(%rip), %rdx     # 0x1541db
callq 0x175a0
leaq 0xc8(%rbx), %rdi
leaq 0xd8(%rbx), %rax
movq %rax, 0xc8(%rbx)
leaq 0x19d99(%rip), %rsi     # 0x14abe2
leaq 0x19d94(%rip), %rdx     # 0x14abe4
callq 0x175a0
leaq 0xe8(%rbx), %rdi
leaq 0xf8(%rbx), %rax
movq %rax, 0xe8(%rbx)
leaq 0x2336b(%rip), %rsi     # 0x1541dc
leaq 0x23367(%rip), %rdx     # 0x1541df
callq 0x175a0
leaq 0x108(%rbx), %rdi
leaq 0x118(%rbx), %rax
movq %rax, 0x108(%rbx)
leaq 0x23347(%rip), %rsi     # 0x1541e0
leaq 0x23343(%rip), %rdx     # 0x1541e3
callq 0x175a0
leaq 0x128(%rbx), %rdi
leaq 0x138(%rbx), %rax
movq %rax, 0x128(%rbx)
leaq 0x2c466(%rip), %rsi     # 0x15d327
leaq 0x2c462(%rip), %rdx     # 0x15d32a
callq 0x175a0
leaq 0x148(%rbx), %rdi
leaq 0x158(%rbx), %rax
movq %rax, 0x148(%rbx)
leaq 0x232fb(%rip), %rsi     # 0x1541e4
leaq 0x232f7(%rip), %rdx     # 0x1541e7
callq 0x175a0
leaq 0x168(%rbx), %rdi
leaq 0x178(%rbx), %rax
movq %rax, 0x168(%rbx)
leaq 0x232d7(%rip), %rsi     # 0x1541e8
leaq 0x232d3(%rip), %rdx     # 0x1541eb
callq 0x175a0
leaq 0x188(%rbx), %rdi
leaq 0x198(%rbx), %rax
movq %rax, 0x188(%rbx)
leaq 0x232b3(%rip), %rsi     # 0x1541ec
leaq 0x232af(%rip), %rdx     # 0x1541ef
callq 0x175a0
leaq 0x1a8(%rbx), %rdi
leaq 0x1b8(%rbx), %rax
movq %rax, 0x1a8(%rbx)
leaq 0x2328f(%rip), %rsi     # 0x1541f0
leaq 0x2328b(%rip), %rdx     # 0x1541f3
callq 0x175a0
leaq 0x1c8(%rbx), %rdi
leaq 0x1d8(%rbx), %rax
movq %rax, 0x1c8(%rbx)
leaq 0x2a5f7(%rip), %rsi     # 0x15b580
leaq 0x2a5f9(%rip), %rdx     # 0x15b589
callq 0x175a0
movups 0x2a854(%rip), %xmm0    # 0x15b7f0
movups %xmm0, 0x208(%rbx)
movups 0x2a836(%rip), %xmm0    # 0x15b7e0
movups %xmm0, 0x1f8(%rbx)
movups 0x2a818(%rip), %xmm0    # 0x15b7d0
movups %xmm0, 0x1e8(%rbx)
movabsq $0x300000001, %rax      # imm = 0x300000001
movq %rax, 0x218(%rbx)
movups 0x2a831(%rip), %xmm0    # 0x15b808
movups %xmm0, 0x220(%rbx)
movabsq $0x700000001, %rax      # imm = 0x700000001
movq %rax, 0x230(%rbx)
movups 0x2b6be(%rip), %xmm0    # 0x15c6b4
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 0x2a7f1(%rip), %rsi     # 0x15b820
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 0x2a983(%rip), %rsi     # 0x15ba00
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
movl $0x10, %ecx
rep  movsq (%rsi), %es:(%rdi)
movl 0x3d58(%rbx), %eax
addl 0x3d64(%rbx), %eax
movl %eax, 0x3dc0(%rbx)
testl %r14d, %r14d
je 0x1310f7
cmpl $0x1, %r14d
je 0x1310da
cmpl $0x2, %r14d
jne 0x13111c
movl $0x9, %r8d
leaq 0x192f9(%rip), %rcx     # 0x14a3d1
jmp 0x1310e7
movl $0x6, %r8d
leaq 0x2a487(%rip), %rcx     # 0x15b56e
movq 0x8(%rbx), %rdx
movq %rbx, %rdi
xorl %esi, %esi
callq 0xb430
jmp 0x13111c
movq 0x8(%rbx), %rdx
leaq 0x2a465(%rip), %rcx     # 0x15b567
movl $0x6, %r8d
movq %rbx, %rdi
xorl %esi, %esi
callq 0xb430
movl $0x2, 0x1f0(%rbx)
testl %ebp, %ebp
je 0x1311e6
cmpl $0x80, %ebp
jg 0x1311e6
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 0x1311e6
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 0x1313f4
movq %rbx, %rdi
callq 0x13187a
movq %rbx, %rdi
callq 0x131cde
movq %rbx, %rdi
callq 0x131e62
movq %rbx, %rdi
callq 0x131ff0
movq %rbx, %rdi
callq 0x13288a
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x26788(%rip), %rdi     # 0x157975
leaq 0x2a396(%rip), %rsi     # 0x15b58a
leaq 0x2a39c(%rip), %rcx     # 0x15b597
movl $0x31, %edx
callq 0xb200
jmp 0x1312ce
movq %rax, %r14
movl $0x1c8, %r15d           # imm = 0x1C8
jmp 0x13129a
movq %rax, %r14
movl $0x1a8, %r15d           # imm = 0x1A8
jmp 0x13129a
movq %rax, %r14
movl $0x188, %r15d           # imm = 0x188
jmp 0x13129a
movq %rax, %r14
movl $0x168, %r15d           # imm = 0x168
jmp 0x13129a
movq %rax, %r14
movl $0x148, %r15d           # imm = 0x148
jmp 0x13129a
movq %rax, %r14
movl $0x128, %r15d           # imm = 0x128
jmp 0x13129a
movq %rax, %r14
movl $0x108, %r15d           # imm = 0x108
jmp 0x13129a
movq %rax, %r14
movl $0xe8, %r15d
jmp 0x13129a
movq %rax, %r14
movl $0xc8, %r15d
jmp 0x13129a
movq %rax, %r14
movl $0xa8, %r15d
jmp 0x13129a
movq %rax, %r14
movl $0x88, %r15d
jmp 0x13129a
movq %rax, %r14
movl $0x68, %r15d
jmp 0x13129a
movq %rax, %r14
movl $0x48, %r15d
leaq -0x10(%rbx), %r12
leaq (%r12,%r15), %rax
movq -0x10(%r12,%r15), %rdi
cmpq %rdi, %rax
je 0x1312b7
movq (%rax), %rsi
incq %rsi
callq 0xb2f0
addq $-0x20, %r15
cmpq $0x28, %r15
jne 0x13129e
jmp 0x1313ca
movq %rax, %r14
jmp 0x1313ca
movq %rax, %r14
leaq 0x3410(%rbx), %r15
xorl %r12d, %r12d
movq 0x3420(%rbx,%r12), %rax
testq %rax, %rax
je 0x1312f6
leaq (%r15,%r12), %rdi
movq %rdi, %rsi
movl $0x3, %edx
callq *%rax
addq $-0x20, %r12
cmpq $-0xa80, %r12           # imm = 0xF580
jne 0x1312db
movl $0x29a8, %r15d          # imm = 0x29A8
movq -0x10(%rbx,%r15), %rdi
testq %rdi, %rdi
je 0x13131f
movq (%rbx,%r15), %rsi
subq %rdi, %rsi
callq 0xb2f0
addq $-0x18, %r15
cmpq $0x21c8, %r15           # imm = 0x21C8
jne 0x131309
leaq 0x21b0(%rbx), %r15
xorl %r12d, %r12d
movq 0x21c0(%rbx,%r12), %rax
testq %rax, %rax
je 0x131351
leaq (%r15,%r12), %rdi
movq %rdi, %rsi
movl $0x3, %edx
callq *%rax
addq $-0x20, %r12
cmpq $-0xa80, %r12           # imm = 0xF580
jne 0x131336
leaq 0x1730(%rbx), %r15
xorl %r12d, %r12d
movq 0x1740(%rbx,%r12), %rax
testq %rax, %rax
je 0x131383
leaq (%r15,%r12), %rdi
movq %rdi, %rsi
movl $0x3, %edx
callq *%rax
addq $-0x20, %r12
cmpq $-0xa80, %r12           # imm = 0xF580
jne 0x131368
leaq 0xcb0(%rbx), %r15
xorl %r12d, %r12d
movq 0xcc0(%rbx,%r12), %rax
testq %rax, %rax
je 0x1313b5
leaq (%r15,%r12), %rdi
movq %rdi, %rsi
movl $0x3, %edx
callq *%rax
addq $-0x20, %r12
cmpq $-0xa80, %r12           # imm = 0xF580
jne 0x13139a
movq %rbx, %rdi
callq 0xc325
movq (%rbx), %rdi
cmpq %r13, %rdi
je 0x1313de
movq (%r13), %rsi
incq %rsi
callq 0xb2f0
movq %r14, %rdi
callq 0xb510
jmp 0x1313ec
jmp 0x1313ec
jmp 0x1313ec
movq %rax, %rdi
callq 0x171a3