// File: /workspace/github_cpp_makefile_star2_O1/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 0x2321a(%rip), %rsi     # 0x157161
leaq 0x23216(%rip), %rdx     # 0x157164
callq 0x17586
leaq 0x48(%rbx), %rdi
leaq 0x58(%rbx), %rax
movq %rax, 0x48(%rbx)
leaq 0x2a598(%rip), %rsi     # 0x15e4fe
leaq 0x2a596(%rip), %rdx     # 0x15e503
callq 0x17586
leaq 0x68(%rbx), %rdi
leaq 0x78(%rbx), %rax
movq %rax, 0x68(%rbx)
leaq 0x231e0(%rip), %rsi     # 0x157165
leaq 0x231dc(%rip), %rdx     # 0x157168
callq 0x17586
leaq 0x88(%rbx), %rdi
leaq 0x98(%rbx), %rax
movq %rax, 0x88(%rbx)
leaq 0x2a557(%rip), %rsi     # 0x15e504
leaq 0x2a554(%rip), %rdx     # 0x15e508
callq 0x17586
leaq 0xa8(%rbx), %rdi
leaq 0xb8(%rbx), %rax
movq %rax, 0xa8(%rbx)
leaq 0x23194(%rip), %rsi     # 0x157169
leaq 0x2318f(%rip), %rdx     # 0x15716b
callq 0x17586
leaq 0xc8(%rbx), %rdi
leaq 0xd8(%rbx), %rax
movq %rax, 0xc8(%rbx)
leaq 0x19ba5(%rip), %rsi     # 0x14dba2
leaq 0x19ba0(%rip), %rdx     # 0x14dba4
callq 0x17586
leaq 0xe8(%rbx), %rdi
leaq 0xf8(%rbx), %rax
movq %rax, 0xe8(%rbx)
leaq 0x23147(%rip), %rsi     # 0x15716c
leaq 0x23143(%rip), %rdx     # 0x15716f
callq 0x17586
leaq 0x108(%rbx), %rdi
leaq 0x118(%rbx), %rax
movq %rax, 0x108(%rbx)
leaq 0x23123(%rip), %rsi     # 0x157170
leaq 0x2311f(%rip), %rdx     # 0x157173
callq 0x17586
leaq 0x128(%rbx), %rdi
leaq 0x138(%rbx), %rax
movq %rax, 0x128(%rbx)
leaq 0x2c20d(%rip), %rsi     # 0x160282
leaq 0x2c209(%rip), %rdx     # 0x160285
callq 0x17586
leaq 0x148(%rbx), %rdi
leaq 0x158(%rbx), %rax
movq %rax, 0x148(%rbx)
leaq 0x230d7(%rip), %rsi     # 0x157174
leaq 0x230d3(%rip), %rdx     # 0x157177
callq 0x17586
leaq 0x168(%rbx), %rdi
leaq 0x178(%rbx), %rax
movq %rax, 0x168(%rbx)
leaq 0x230b3(%rip), %rsi     # 0x157178
leaq 0x230af(%rip), %rdx     # 0x15717b
callq 0x17586
leaq 0x188(%rbx), %rdi
leaq 0x198(%rbx), %rax
movq %rax, 0x188(%rbx)
leaq 0x2308f(%rip), %rsi     # 0x15717c
leaq 0x2308b(%rip), %rdx     # 0x15717f
callq 0x17586
leaq 0x1a8(%rbx), %rdi
leaq 0x1b8(%rbx), %rax
movq %rax, 0x1a8(%rbx)
leaq 0x2306b(%rip), %rsi     # 0x157180
leaq 0x23067(%rip), %rdx     # 0x157183
callq 0x17586
leaq 0x1c8(%rbx), %rdi
leaq 0x1d8(%rbx), %rax
movq %rax, 0x1c8(%rbx)
leaq 0x2a3cc(%rip), %rsi     # 0x15e509
leaq 0x2a3ce(%rip), %rdx     # 0x15e512
callq 0x17586
movups 0x2a628(%rip), %xmm0    # 0x15e778
movups %xmm0, 0x208(%rbx)
movups 0x2a60a(%rip), %xmm0    # 0x15e768
movups %xmm0, 0x1f8(%rbx)
movups 0x2a5ec(%rip), %xmm0    # 0x15e758
movups %xmm0, 0x1e8(%rbx)
movabsq $0x300000001, %rax      # imm = 0x300000001
movq %rax, 0x218(%rbx)
movups 0x2a605(%rip), %xmm0    # 0x15e790
movups %xmm0, 0x220(%rbx)
movabsq $0x700000001, %rax      # imm = 0x700000001
movq %rax, 0x230(%rbx)
movups 0x2b4b6(%rip), %xmm0    # 0x15f660
movups %xmm0, 0x238(%rbx)
movq $0xb, 0x248(%rbx)
leaq 0x250(%rbx), %rdi
movl $0xa80, %edx            # imm = 0xA80
xorl %esi, %esi
callq 0xb1d0
leaq 0xcd0(%rbx), %rdi
movl $0xa80, %edx            # imm = 0xA80
xorl %esi, %esi
callq 0xb1d0
leaq 0x1750(%rbx), %rdi
movl $0xa80, %edx            # imm = 0xA80
xorl %esi, %esi
callq 0xb1d0
leaq 0x21d0(%rbx), %rdi
movl $0x7e0, %edx            # imm = 0x7E0
xorl %esi, %esi
callq 0xb1d0
leaq 0x29b0(%rbx), %rdi
movl $0xa80, %edx            # imm = 0xA80
xorl %esi, %esi
callq 0xb1d0
movl %ebp, 0x3430(%rbx)
leaq 0x3434(%rbx), %rdi
leaq 0x2a579(%rip), %rsi     # 0x15e7a8
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 0x2a70b(%rip), %rsi     # 0x15e988
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)
cmpl $0x3, %r14d
jae 0x1342f9
movl %r14d, %eax
leaq 0x2b372(%rip), %rdx     # 0x15f63c
movslq (%rdx,%rax,4), %rcx
addq %rdx, %rcx
leaq 0x2b370(%rip), %rdx     # 0x15f648
movq (%rdx,%rax,8), %r8
movq 0x8(%rbx), %rdx
movq %rbx, %rdi
xorl %esi, %esi
callq 0xb430
testl %r14d, %r14d
jne 0x1342f9
movl $0x2, 0x1f0(%rbx)
testl %ebp, %ebp
je 0x1343c3
cmpl $0x80, %ebp
jg 0x1343c3
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 0x1343c3
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 0x1345e0
movq %rbx, %rdi
callq 0x134b9e
movq %rbx, %rdi
callq 0x13508e
movq %rbx, %rdi
callq 0x13523c
movq %rbx, %rdi
callq 0x1353f8
movq %rbx, %rdi
callq 0x135dc6
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x26511(%rip), %rdi     # 0x15a8db
leaq 0x2a142(%rip), %rsi     # 0x15e513
leaq 0x2a148(%rip), %rcx     # 0x15e520
movl $0x31, %edx
callq 0xb200
jmp 0x1344ba
movq %rax, %r14
movl $0x1c8, %r15d           # imm = 0x1C8
jmp 0x134477
movq %rax, %r14
movl $0x1a8, %r15d           # imm = 0x1A8
jmp 0x134477
movq %rax, %r14
movl $0x188, %r15d           # imm = 0x188
jmp 0x134477
movq %rax, %r14
movl $0x168, %r15d           # imm = 0x168
jmp 0x134477
movq %rax, %r14
movl $0x148, %r15d           # imm = 0x148
jmp 0x134477
movq %rax, %r14
movl $0x128, %r15d           # imm = 0x128
jmp 0x134477
movq %rax, %r14
movl $0x108, %r15d           # imm = 0x108
jmp 0x134477
movq %rax, %r14
movl $0xe8, %r15d
jmp 0x134477
movq %rax, %r14
movl $0xc8, %r15d
jmp 0x134477
movq %rax, %r14
movl $0xa8, %r15d
jmp 0x134477
movq %rax, %r14
movl $0x88, %r15d
jmp 0x134477
movq %rax, %r14
movl $0x68, %r15d
jmp 0x134477
movq %rax, %r14
movl $0x48, %r15d
xorl %eax, %eax
testb %al, %al
jne 0x1345b6
leaq -0x10(%rbx), %r12
leaq (%r12,%r15), %rax
movq -0x10(%r12,%r15), %rdi
cmpq %rdi, %rax
je 0x13449e
movq (%rax), %rsi
incq %rsi
callq 0xb2f0
addq $-0x20, %r15
cmpq $0x28, %r15
jne 0x134485
jmp 0x1345b6
movq %rax, %r14
movl $0x28, %r15d
movb $0x1, %al
jmp 0x134479
movq %rax, %r14
leaq 0x3410(%rbx), %r15
xorl %r12d, %r12d
movq 0x3420(%rbx,%r12), %rax
testq %rax, %rax
je 0x1344e2
leaq (%r15,%r12), %rdi
movq %rdi, %rsi
movl $0x3, %edx
callq *%rax
addq $-0x20, %r12
cmpq $-0xa80, %r12           # imm = 0xF580
jne 0x1344c7
movl $0x29a8, %r15d          # imm = 0x29A8
movq -0x10(%rbx,%r15), %rdi
testq %rdi, %rdi
je 0x13450b
movq (%rbx,%r15), %rsi
subq %rdi, %rsi
callq 0xb2f0
addq $-0x18, %r15
cmpq $0x21c8, %r15           # imm = 0x21C8
jne 0x1344f5
leaq 0x21b0(%rbx), %r15
xorl %r12d, %r12d
movq 0x21c0(%rbx,%r12), %rax
testq %rax, %rax
je 0x13453d
leaq (%r15,%r12), %rdi
movq %rdi, %rsi
movl $0x3, %edx
callq *%rax
addq $-0x20, %r12
cmpq $-0xa80, %r12           # imm = 0xF580
jne 0x134522
leaq 0x1730(%rbx), %r15
xorl %r12d, %r12d
movq 0x1740(%rbx,%r12), %rax
testq %rax, %rax
je 0x13456f
leaq (%r15,%r12), %rdi
movq %rdi, %rsi
movl $0x3, %edx
callq *%rax
addq $-0x20, %r12
cmpq $-0xa80, %r12           # imm = 0xF580
jne 0x134554
leaq 0xcb0(%rbx), %r15
xorl %r12d, %r12d
movq 0xcc0(%rbx,%r12), %rax
testq %rax, %rax
je 0x1345a1
leaq (%r15,%r12), %rdi
movq %rdi, %rsi
movl $0x3, %edx
callq *%rax
addq $-0x20, %r12
cmpq $-0xa80, %r12           # imm = 0xF580
jne 0x134586
movq %rbx, %rdi
callq 0xc2f4
movq (%rbx), %rdi
cmpq %r13, %rdi
je 0x1345ca
movq (%r13), %rsi
incq %rsi
callq 0xb2f0
movq %r14, %rdi
callq 0xb510
jmp 0x1345d8
jmp 0x1345d8
jmp 0x1345d8
movq %rax, %rdi
callq 0x1718f