// File: CMU-SAFARI[P]ramulator/src/ALDRAM.cpp
// Function: ramulator::ALDRAM::ALDRAM(ramulator::ALDRAM::Org, ramulator::ALDRAM::Speed)
ALDRAM::ALDRAM(Org org, Speed speed) :
    org_entry(org_table[int(org)]),
    speed_entry(speed_table[int(Temp::COLD)][int(speed)]),
    read_latency(speed_entry.nCL + speed_entry.nBL)
{
    current_speed = speed;
    init_speed();
    init_prereq();
    init_rowhit(); // SAUGATA: added row hit function
    init_lambda();
    init_timing(speed_table[int(Temp::HOT)][int(speed)]);
    temperature = Temp::COLD;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x300, %rsp            # imm = 0x300
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movl %edx, -0x10(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0xc0(%rbp)
movq %rax, %rcx
movq %rcx, -0xc8(%rbp)
movb $0x1, -0x38(%rbp)
movq %rax, -0x18(%rbp)
leaq -0x19(%rbp), %rdi
movq %rdi, -0xb8(%rbp)
callq 0xc5e0
movq -0xc0(%rbp), %rdi
movq -0xb8(%rbp), %rdx
leaq 0xebfbb(%rip), %rsi     # 0x25abb2
callq 0x17a40
jmp 0x16ebfe
movq -0xc0(%rbp), %rax
addq $0x20, %rax
movq %rax, -0xd8(%rbp)
movq %rax, -0x18(%rbp)
leaq -0x2d(%rbp), %rdi
movq %rdi, -0xd0(%rbp)
callq 0xc5e0
movq -0xd8(%rbp), %rdi
movq -0xd0(%rbp), %rdx
leaq 0xebf7d(%rip), %rsi     # 0x25abb6
callq 0x17a40
jmp 0x16ec40
movq -0xc0(%rbp), %rax
addq $0x40, %rax
movq %rax, -0xe8(%rbp)
movq %rax, -0x18(%rbp)
leaq -0x2e(%rbp), %rdi
movq %rdi, -0xe0(%rbp)
callq 0xc5e0
movq -0xe8(%rbp), %rdi
movq -0xe0(%rbp), %rdx
leaq 0xe2670(%rip), %rsi     # 0x2512eb
callq 0x17a40
jmp 0x16ec82
movq -0xc0(%rbp), %rax
addq $0x60, %rax
movq %rax, -0xf8(%rbp)
movq %rax, -0x18(%rbp)
leaq -0x2f(%rbp), %rdi
movq %rdi, -0xf0(%rbp)
callq 0xc5e0
movq -0xf8(%rbp), %rdi
movq -0xf0(%rbp), %rdx
leaq 0xebefd(%rip), %rsi     # 0x25abba
callq 0x17a40
jmp 0x16ecc4
movq -0xc0(%rbp), %rax
subq $-0x80, %rax
movq %rax, -0x108(%rbp)
movq %rax, -0x18(%rbp)
leaq -0x30(%rbp), %rdi
movq %rdi, -0x100(%rbp)
callq 0xc5e0
movq -0x108(%rbp), %rdi
movq -0x100(%rbp), %rdx
leaq 0xe16ab(%rip), %rsi     # 0x2503aa
callq 0x17a40
jmp 0x16ed06
movq -0xc0(%rbp), %rax
addq $0xa0, %rax
movq %rax, -0x118(%rbp)
movq %rax, -0x18(%rbp)
leaq -0x31(%rbp), %rdi
movq %rdi, -0x110(%rbp)
callq 0xc5e0
movq -0x118(%rbp), %rdi
movq -0x110(%rbp), %rdx
leaq 0xebe7a(%rip), %rsi     # 0x25abbd
callq 0x17a40
jmp 0x16ed4a
movq -0xc0(%rbp), %rax
addq $0xc0, %rax
movq %rax, -0x128(%rbp)
movq %rax, -0x18(%rbp)
leaq -0x32(%rbp), %rdi
movq %rdi, -0x120(%rbp)
callq 0xc5e0
movq -0x128(%rbp), %rdi
movq -0x120(%rbp), %rdx
leaq 0xebe3a(%rip), %rsi     # 0x25abc1
callq 0x17a40
jmp 0x16ed8e
movq -0xc0(%rbp), %rax
addq $0xe0, %rax
movq %rax, -0x138(%rbp)
movq %rax, -0x18(%rbp)
leaq -0x33(%rbp), %rdi
movq %rdi, -0x130(%rbp)
callq 0xc5e0
movq -0x138(%rbp), %rdi
movq -0x130(%rbp), %rdx
leaq 0xf5d95(%rip), %rsi     # 0x264b60
callq 0x17a40
jmp 0x16edd2
movq -0xc0(%rbp), %rax
addq $0x100, %rax            # imm = 0x100
movq %rax, -0x148(%rbp)
movq %rax, -0x18(%rbp)
leaq -0x34(%rbp), %rdi
movq %rdi, -0x140(%rbp)
callq 0xc5e0
movq -0x148(%rbp), %rdi
movq -0x140(%rbp), %rdx
leaq 0xebdb6(%rip), %rsi     # 0x25abc5
callq 0x17a40
jmp 0x16ee16
movq -0xc0(%rbp), %rax
addq $0x120, %rax            # imm = 0x120
movq %rax, -0x158(%rbp)
movq %rax, -0x18(%rbp)
leaq -0x35(%rbp), %rdi
movq %rdi, -0x150(%rbp)
callq 0xc5e0
movq -0x158(%rbp), %rdi
movq -0x150(%rbp), %rdx
leaq 0xebd76(%rip), %rsi     # 0x25abc9
callq 0x17a40
jmp 0x16ee5a
movq -0xc0(%rbp), %rax
addq $0x140, %rax            # imm = 0x140
movq %rax, -0x168(%rbp)
movq %rax, -0x18(%rbp)
leaq -0x36(%rbp), %rdi
movq %rdi, -0x160(%rbp)
callq 0xc5e0
movq -0x168(%rbp), %rdi
movq -0x160(%rbp), %rdx
leaq 0xebd36(%rip), %rsi     # 0x25abcd
callq 0x17a40
jmp 0x16ee9e
movq -0xc0(%rbp), %rax
addq $0x160, %rax            # imm = 0x160
movq %rax, -0x178(%rbp)
movq %rax, -0x18(%rbp)
leaq -0x37(%rbp), %rdi
movq %rdi, -0x170(%rbp)
callq 0xc5e0
movq -0x178(%rbp), %rdi
movq -0x170(%rbp), %rdx
leaq 0xebcf6(%rip), %rsi     # 0x25abd1
callq 0x17a40
jmp 0x16eee2
movb $0x0, -0x38(%rbp)
leaq -0x37(%rbp), %rdi
callq 0xc3c0
leaq -0x36(%rbp), %rdi
callq 0xc3c0
leaq -0x35(%rbp), %rdi
callq 0xc3c0
leaq -0x34(%rbp), %rdi
callq 0xc3c0
leaq -0x33(%rbp), %rdi
callq 0xc3c0
leaq -0x32(%rbp), %rdi
callq 0xc3c0
leaq -0x31(%rbp), %rdi
callq 0xc3c0
leaq -0x30(%rbp), %rdi
callq 0xc3c0
leaq -0x2f(%rbp), %rdi
callq 0xc3c0
leaq -0x2e(%rbp), %rdi
callq 0xc3c0
leaq -0x2d(%rbp), %rdi
callq 0xc3c0
leaq -0x19(%rbp), %rdi
callq 0xc3c0
movq -0xc8(%rbp), %rdi
addq $0x180, %rdi            # imm = 0x180
leaq 0xea999(%rip), %rsi     # 0x259900
movl $0x30, %edx
callq 0xc300
movq -0xc8(%rbp), %rax
movq 0xea9b1(%rip), %rcx     # 0x259930
movq %rcx, 0x1b0(%rax)
movq 0xea9ab(%rip), %rcx     # 0x259938
movq %rcx, 0x1b8(%rax)
movl 0xea9a6(%rip), %ecx     # 0x259940
movl %ecx, 0x1c0(%rax)
movq 0xea99d(%rip), %rcx     # 0x259944
movq %rcx, 0x1c4(%rax)
movq 0xea997(%rip), %rcx     # 0x25994c
movq %rcx, 0x1cc(%rax)
movq 0xea991(%rip), %rcx     # 0x259954
movq %rcx, 0x1d4(%rax)
addq $0x1e0, %rax            # imm = 0x1E0
movq %rax, -0x190(%rbp)
movq %rax, %rcx
addq $0x780, %rcx            # imm = 0x780
movq %rcx, -0x188(%rbp)
movq %rax, -0x180(%rbp)
movq -0x180(%rbp), %rdi
movq %rdi, -0x198(%rbp)
callq 0x176fd0
movq -0x198(%rbp), %rax
movq -0x188(%rbp), %rcx
addq $0x20, %rax
cmpq %rcx, %rax
movq %rax, -0x180(%rbp)
jne 0x16efef
movq -0xc8(%rbp), %rax
addq $0x960, %rax            # imm = 0x960
movq %rax, -0x1b0(%rbp)
movq %rax, %rcx
addq $0x780, %rcx            # imm = 0x780
movq %rcx, -0x1a8(%rbp)
movq %rax, -0x1a0(%rbp)
movq -0x1a0(%rbp), %rdi
movq %rdi, -0x1b8(%rbp)
callq 0x177010
movq -0x1b8(%rbp), %rax
movq -0x1a8(%rbp), %rcx
addq $0x20, %rax
cmpq %rcx, %rax
movq %rax, -0x1a0(%rbp)
jne 0x16f04c
movq -0xc8(%rbp), %rax
addq $0x10e0, %rax           # imm = 0x10E0
movq %rax, -0x1d0(%rbp)
movq %rax, %rcx
addq $0x780, %rcx            # imm = 0x780
movq %rcx, -0x1c8(%rbp)
movq %rax, -0x1c0(%rbp)
movq -0x1c0(%rbp), %rdi
movq %rdi, -0x1d8(%rbp)
callq 0x177010
movq -0x1d8(%rbp), %rax
movq -0x1c8(%rbp), %rcx
addq $0x20, %rax
cmpq %rcx, %rax
movq %rax, -0x1c0(%rbp)
jne 0x16f0a9
movq -0xc8(%rbp), %rax
addq $0x1860, %rax           # imm = 0x1860
movq %rax, -0x1f0(%rbp)
movq %rax, %rcx
addq $0x5a0, %rcx            # imm = 0x5A0
movq %rcx, -0x1e8(%rbp)
movq %rax, -0x1e0(%rbp)
movq -0x1e0(%rbp), %rdi
movq %rdi, -0x1f8(%rbp)
callq 0x177050
movq -0x1f8(%rbp), %rax
movq -0x1e8(%rbp), %rcx
addq $0x18, %rax
cmpq %rcx, %rax
movq %rax, -0x1e0(%rbp)
jne 0x16f106
movq -0xc8(%rbp), %rax
addq $0x1e00, %rax           # imm = 0x1E00
movq %rax, -0x210(%rbp)
movq %rax, %rcx
addq $0x780, %rcx            # imm = 0x780
movq %rcx, -0x208(%rbp)
movq %rax, -0x200(%rbp)
movq -0x200(%rbp), %rdi
movq %rdi, -0x218(%rbp)
callq 0x177070
movq -0x218(%rbp), %rax
movq -0x208(%rbp), %rcx
addq $0x20, %rax
cmpq %rcx, %rax
movq %rax, -0x200(%rbp)
jne 0x16f163
movq -0xc8(%rbp), %rdi
addq $0x2580, %rdi           # imm = 0x2580
leaq 0xea7b3(%rip), %rsi     # 0x25995c
movl $0x1a4, %edx            # imm = 0x1A4
callq 0xc300
movq -0xc8(%rbp), %rdi
movslq -0xc(%rbp), %rcx
leaq (%rcx,%rcx,8), %rax
leaq (%rax,%rax,2), %rax
addq %rcx, %rax
movups 0x2580(%rdi,%rax), %xmm0
movups 0x258c(%rdi,%rax), %xmm1
movups %xmm1, 0x2730(%rdi)
movups %xmm0, 0x2724(%rdi)
movl $0x1, 0x2744(%rdi)
movl $0x8, 0x2748(%rdi)
movl $0x40, 0x274c(%rdi)
addq $0x2750, %rdi           # imm = 0x2750
leaq 0xea8ed(%rip), %rsi     # 0x259b00
movl $0xc40, %edx            # imm = 0xC40
callq 0xc300
movq -0xc8(%rbp), %rdi
movslq -0x10(%rbp), %rax
imulq $0x70, %rax, %rax
movups 0x27b0(%rdi,%rax), %xmm0
movups %xmm0, 0x33f0(%rdi)
movups 0x27a0(%rdi,%rax), %xmm0
movups %xmm0, 0x33e0(%rdi)
movups 0x2790(%rdi,%rax), %xmm0
movups %xmm0, 0x33d0(%rdi)
movups 0x2750(%rdi,%rax), %xmm0
movups 0x2760(%rdi,%rax), %xmm1
movups 0x2770(%rdi,%rax), %xmm2
movups 0x2780(%rdi,%rax), %xmm3
movups %xmm3, 0x33c0(%rdi)
movups %xmm2, 0x33b0(%rdi)
movups %xmm1, 0x33a0(%rdi)
movups %xmm0, 0x3390(%rdi)
movl 0x33a8(%rdi), %ecx
movl 0x33b4(%rdi), %eax
addl %ecx, %eax
movl %eax, 0x3400(%rdi)
movl -0x10(%rbp), %eax
movl %eax, 0x2740(%rdi)
callq 0x16f6f0
jmp 0x16f2b9
movq -0xc8(%rbp), %rdi
callq 0x16ffd0
jmp 0x16f2c7
movq -0xc8(%rbp), %rdi
callq 0x1700f0
jmp 0x16f2d5
movq -0xc8(%rbp), %rdi
callq 0x170160
jmp 0x16f2e3
movq -0xc8(%rbp), %rdi
movslq -0x10(%rbp), %rax
imulq $0x70, %rax, %rax
movups 0x2dd0(%rdi,%rax), %xmm0
movaps %xmm0, -0x50(%rbp)
movups 0x2dc0(%rdi,%rax), %xmm0
movaps %xmm0, -0x60(%rbp)
movups 0x2db0(%rdi,%rax), %xmm0
movaps %xmm0, -0x70(%rbp)
movups 0x2d70(%rdi,%rax), %xmm0
movups 0x2d80(%rdi,%rax), %xmm1
movups 0x2d90(%rdi,%rax), %xmm2
movups 0x2da0(%rdi,%rax), %xmm3
movaps %xmm3, -0x80(%rbp)
movaps %xmm2, -0x90(%rbp)
movaps %xmm1, -0xa0(%rbp)
movaps %xmm0, -0xb0(%rbp)
movaps -0x50(%rbp), %xmm0
movq %rsp, %rax
movups %xmm0, 0x60(%rax)
movaps -0x60(%rbp), %xmm0
movups %xmm0, 0x50(%rax)
movaps -0x70(%rbp), %xmm0
movups %xmm0, 0x40(%rax)
movaps -0xb0(%rbp), %xmm0
movaps -0xa0(%rbp), %xmm1
movaps -0x90(%rbp), %xmm2
movaps -0x80(%rbp), %xmm3
movups %xmm3, 0x30(%rax)
movups %xmm2, 0x20(%rax)
movups %xmm1, 0x10(%rax)
movups %xmm0, (%rax)
callq 0x170300
jmp 0x16f399
movq -0xc8(%rbp), %rax
movl $0x0, 0x2744(%rax)
addq $0x300, %rsp            # imm = 0x300
popq %rbp
retq
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x28(%rbp)
movl %eax, -0x2c(%rbp)
jmp 0x16f4ce
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x28(%rbp)
movl %eax, -0x2c(%rbp)
jmp 0x16f4c5
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x28(%rbp)
movl %eax, -0x2c(%rbp)
jmp 0x16f4bc
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x28(%rbp)
movl %eax, -0x2c(%rbp)
jmp 0x16f4b3
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x28(%rbp)
movl %eax, -0x2c(%rbp)
jmp 0x16f4aa
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x28(%rbp)
movl %eax, -0x2c(%rbp)
jmp 0x16f4a1
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x28(%rbp)
movl %eax, -0x2c(%rbp)
jmp 0x16f498
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x28(%rbp)
movl %eax, -0x2c(%rbp)
jmp 0x16f48f
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x28(%rbp)
movl %eax, -0x2c(%rbp)
jmp 0x16f486
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x28(%rbp)
movl %eax, -0x2c(%rbp)
jmp 0x16f47d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x28(%rbp)
movl %eax, -0x2c(%rbp)
jmp 0x16f474
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x28(%rbp)
movl %eax, -0x2c(%rbp)
leaq -0x37(%rbp), %rdi
callq 0xc3c0
leaq -0x36(%rbp), %rdi
callq 0xc3c0
leaq -0x35(%rbp), %rdi
callq 0xc3c0
leaq -0x34(%rbp), %rdi
callq 0xc3c0
leaq -0x33(%rbp), %rdi
callq 0xc3c0
leaq -0x32(%rbp), %rdi
callq 0xc3c0
leaq -0x31(%rbp), %rdi
callq 0xc3c0
leaq -0x30(%rbp), %rdi
callq 0xc3c0
leaq -0x2f(%rbp), %rdi
callq 0xc3c0
leaq -0x2e(%rbp), %rdi
callq 0xc3c0
leaq -0x2d(%rbp), %rdi
callq 0xc3c0
leaq -0x19(%rbp), %rdi
callq 0xc3c0
testb $0x1, -0x38(%rbp)
jne 0x16f4df
jmp 0x16f529
movq -0xc0(%rbp), %rcx
movq -0x18(%rbp), %rax
cmpq %rax, %rcx
movq %rax, -0x220(%rbp)
je 0x16f527
movq -0x220(%rbp), %rdi
addq $-0x20, %rdi
movq %rdi, -0x228(%rbp)
callq 0xc6b8
movq -0xc0(%rbp), %rcx
movq -0x228(%rbp), %rax
cmpq %rcx, %rax
movq %rax, -0x220(%rbp)
jne 0x16f4f6
jmp 0x16f529
jmp 0x16f6db
movq %rdx, %rcx
movq %rax, %rdx
movq -0x210(%rbp), %rax
movq %rdx, -0x28(%rbp)
movl %ecx, -0x2c(%rbp)
addq $0x780, %rax            # imm = 0x780
movq %rax, -0x230(%rbp)
movq -0x230(%rbp), %rdi
addq $-0x20, %rdi
movq %rdi, -0x238(%rbp)
callq 0x15b9c0
movq -0x210(%rbp), %rcx
movq -0x238(%rbp), %rax
cmpq %rcx, %rax
movq %rax, -0x230(%rbp)
jne 0x16f54f
movq -0x1f0(%rbp), %rax
addq $0x5a0, %rax            # imm = 0x5A0
movq %rax, -0x240(%rbp)
movq -0x240(%rbp), %rdi
addq $-0x18, %rdi
movq %rdi, -0x248(%rbp)
callq 0x15b9e0
movq -0x1f0(%rbp), %rcx
movq -0x248(%rbp), %rax
cmpq %rcx, %rax
movq %rax, -0x240(%rbp)
jne 0x16f594
movq -0x1d0(%rbp), %rax
addq $0x780, %rax            # imm = 0x780
movq %rax, -0x250(%rbp)
movq -0x250(%rbp), %rdi
addq $-0x20, %rdi
movq %rdi, -0x258(%rbp)
callq 0x15ba40
movq -0x1d0(%rbp), %rcx
movq -0x258(%rbp), %rax
cmpq %rcx, %rax
movq %rax, -0x250(%rbp)
jne 0x16f5d9
movq -0x1b0(%rbp), %rax
addq $0x780, %rax            # imm = 0x780
movq %rax, -0x260(%rbp)
movq -0x260(%rbp), %rdi
addq $-0x20, %rdi
movq %rdi, -0x268(%rbp)
callq 0x15ba40
movq -0x1b0(%rbp), %rcx
movq -0x268(%rbp), %rax
cmpq %rcx, %rax
movq %rax, -0x260(%rbp)
jne 0x16f61e
movq -0x190(%rbp), %rax
addq $0x780, %rax            # imm = 0x780
movq %rax, -0x270(%rbp)
movq -0x270(%rbp), %rdi
addq $-0x20, %rdi
movq %rdi, -0x278(%rbp)
callq 0x15ba60
movq -0x190(%rbp), %rcx
movq -0x278(%rbp), %rax
cmpq %rcx, %rax
movq %rax, -0x270(%rbp)
jne 0x16f663
movq -0xc0(%rbp), %rax
addq $0x180, %rax            # imm = 0x180
movq %rax, -0x280(%rbp)
movq -0x280(%rbp), %rdi
addq $-0x20, %rdi
movq %rdi, -0x288(%rbp)
callq 0xc6b8
movq -0xc0(%rbp), %rcx
movq -0x288(%rbp), %rax
cmpq %rcx, %rax
movq %rax, -0x280(%rbp)
jne 0x16f6a8
jmp 0x16f6db
movq -0x28(%rbp), %rdi
callq 0xc5d0
nopw %cs:(%rax,%rax)