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

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x270, %rsp            # imm = 0x270
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movl %edx, -0x10(%rbp)
movl %ecx, -0x14(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x60(%rbp)
movl -0x14(%rbp), %ecx
movl %ecx, (%rax)
addq $0x8, %rax
movq %rax, -0x58(%rbp)
movb $0x1, -0x45(%rbp)
movq %rax, -0x20(%rbp)
leaq -0x21(%rbp), %rdi
movq %rdi, -0x50(%rbp)
callq 0xc5e0
movq -0x58(%rbp), %rdi
movq -0x50(%rbp), %rdx
leaq 0x34de1(%rip), %rsi     # 0x25abb2
callq 0x17a40
jmp 0x225dd8
movq -0x58(%rbp), %rax
addq $0x20, %rax
movq %rax, -0x70(%rbp)
movq %rax, -0x20(%rbp)
leaq -0x35(%rbp), %rdi
movq %rdi, -0x68(%rbp)
callq 0xc5e0
movq -0x70(%rbp), %rdi
movq -0x68(%rbp), %rdx
leaq 0x34db2(%rip), %rsi     # 0x25abb6
callq 0x17a40
jmp 0x225e0b
movq -0x58(%rbp), %rax
addq $0x40, %rax
movq %rax, -0x80(%rbp)
movq %rax, -0x20(%rbp)
leaq -0x36(%rbp), %rdi
movq %rdi, -0x78(%rbp)
callq 0xc5e0
movq -0x80(%rbp), %rdi
movq -0x78(%rbp), %rdx
leaq 0x2b4b4(%rip), %rsi     # 0x2512eb
callq 0x17a40
jmp 0x225e3e
movq -0x58(%rbp), %rax
addq $0x60, %rax
movq %rax, -0x90(%rbp)
movq %rax, -0x20(%rbp)
leaq -0x37(%rbp), %rdi
movq %rdi, -0x88(%rbp)
callq 0xc5e0
movq -0x90(%rbp), %rdi
movq -0x88(%rbp), %rdx
leaq 0x34d44(%rip), %rsi     # 0x25abba
callq 0x17a40
jmp 0x225e7d
movq -0x58(%rbp), %rax
subq $-0x80, %rax
movq %rax, -0xa0(%rbp)
movq %rax, -0x20(%rbp)
leaq -0x38(%rbp), %rdi
movq %rdi, -0x98(%rbp)
callq 0xc5e0
movq -0xa0(%rbp), %rdi
movq -0x98(%rbp), %rdx
leaq 0x2a4f5(%rip), %rsi     # 0x2503aa
callq 0x17a40
jmp 0x225ebc
movq -0x58(%rbp), %rax
addq $0xa0, %rax
movq %rax, -0xb0(%rbp)
movq %rax, -0x20(%rbp)
leaq -0x39(%rbp), %rdi
movq %rdi, -0xa8(%rbp)
callq 0xc5e0
movq -0xb0(%rbp), %rdi
movq -0xa8(%rbp), %rdx
leaq 0x3ec6a(%rip), %rsi     # 0x264b60
callq 0x17a40
jmp 0x225efd
movq -0x58(%rbp), %rax
addq $0xc0, %rax
movq %rax, -0xc0(%rbp)
movq %rax, -0x20(%rbp)
leaq -0x3a(%rbp), %rdi
movq %rdi, -0xb8(%rbp)
callq 0xc5e0
movq -0xc0(%rbp), %rdi
movq -0xb8(%rbp), %rdx
leaq 0x34c8e(%rip), %rsi     # 0x25abc5
callq 0x17a40
jmp 0x225f3e
movq -0x58(%rbp), %rax
addq $0xe0, %rax
movq %rax, -0xd0(%rbp)
movq %rax, -0x20(%rbp)
leaq -0x3b(%rbp), %rdi
movq %rdi, -0xc8(%rbp)
callq 0xc5e0
movq -0xd0(%rbp), %rdi
movq -0xc8(%rbp), %rdx
leaq 0x34c51(%rip), %rsi     # 0x25abc9
callq 0x17a40
jmp 0x225f7f
movq -0x58(%rbp), %rax
addq $0x100, %rax            # imm = 0x100
movq %rax, -0xe0(%rbp)
movq %rax, -0x20(%rbp)
leaq -0x3c(%rbp), %rdi
movq %rdi, -0xd8(%rbp)
callq 0xc5e0
movq -0xe0(%rbp), %rdi
movq -0xd8(%rbp), %rdx
leaq 0x34c14(%rip), %rsi     # 0x25abcd
callq 0x17a40
jmp 0x225fc0
movq -0x58(%rbp), %rax
addq $0x120, %rax            # imm = 0x120
movq %rax, -0xf0(%rbp)
movq %rax, -0x20(%rbp)
leaq -0x3d(%rbp), %rdi
movq %rdi, -0xe8(%rbp)
callq 0xc5e0
movq -0xf0(%rbp), %rdi
movq -0xe8(%rbp), %rdx
leaq 0x34bd7(%rip), %rsi     # 0x25abd1
callq 0x17a40
jmp 0x226001
movq -0x58(%rbp), %rax
addq $0x140, %rax            # imm = 0x140
movq %rax, -0x100(%rbp)
movq %rax, -0x20(%rbp)
leaq -0x3e(%rbp), %rdi
movq %rdi, -0xf8(%rbp)
callq 0xc5e0
movq -0x100(%rbp), %rdi
movq -0xf8(%rbp), %rdx
leaq 0x3eb1f(%rip), %rsi     # 0x264b5a
callq 0x17a40
jmp 0x226042
movq -0x58(%rbp), %rax
addq $0x160, %rax            # imm = 0x160
movq %rax, -0x110(%rbp)
movq %rax, -0x20(%rbp)
leaq -0x3f(%rbp), %rdi
movq %rdi, -0x108(%rbp)
callq 0xc5e0
movq -0x110(%rbp), %rdi
movq -0x108(%rbp), %rdx
leaq 0x3eae3(%rip), %rsi     # 0x264b5f
callq 0x17a40
jmp 0x226083
movq -0x58(%rbp), %rax
addq $0x180, %rax            # imm = 0x180
movq %rax, -0x120(%rbp)
movq %rax, -0x20(%rbp)
leaq -0x40(%rbp), %rdi
movq %rdi, -0x118(%rbp)
callq 0xc5e0
movq -0x120(%rbp), %rdi
movq -0x118(%rbp), %rdx
leaq 0x3eaa7(%rip), %rsi     # 0x264b64
callq 0x17a40
jmp 0x2260c4
movq -0x58(%rbp), %rax
addq $0x1a0, %rax            # imm = 0x1A0
movq %rax, -0x130(%rbp)
movq %rax, -0x20(%rbp)
leaq -0x41(%rbp), %rdi
movq %rdi, -0x128(%rbp)
callq 0xc5e0
movq -0x130(%rbp), %rdi
movq -0x128(%rbp), %rdx
leaq 0x3ea6c(%rip), %rsi     # 0x264b6a
callq 0x17a40
jmp 0x226105
movq -0x58(%rbp), %rax
addq $0x1c0, %rax            # imm = 0x1C0
movq %rax, -0x140(%rbp)
movq %rax, -0x20(%rbp)
leaq -0x42(%rbp), %rdi
movq %rdi, -0x138(%rbp)
callq 0xc5e0
movq -0x140(%rbp), %rdi
movq -0x138(%rbp), %rdx
leaq 0x3ea2f(%rip), %rsi     # 0x264b6e
callq 0x17a40
jmp 0x226146
movq -0x58(%rbp), %rax
addq $0x1e0, %rax            # imm = 0x1E0
movq %rax, -0x150(%rbp)
movq %rax, -0x20(%rbp)
leaq -0x43(%rbp), %rdi
movq %rdi, -0x148(%rbp)
callq 0xc5e0
movq -0x150(%rbp), %rdi
movq -0x148(%rbp), %rdx
leaq 0x3e9f3(%rip), %rsi     # 0x264b73
callq 0x17a40
jmp 0x226187
movq -0x58(%rbp), %rax
addq $0x200, %rax            # imm = 0x200
movq %rax, -0x160(%rbp)
movq %rax, -0x20(%rbp)
leaq -0x44(%rbp), %rdi
movq %rdi, -0x158(%rbp)
callq 0xc5e0
movq -0x160(%rbp), %rdi
movq -0x158(%rbp), %rdx
leaq 0x3e9b7(%rip), %rsi     # 0x264b78
callq 0x17a40
jmp 0x2261c8
movb $0x0, -0x45(%rbp)
leaq -0x44(%rbp), %rdi
callq 0xc3c0
leaq -0x43(%rbp), %rdi
callq 0xc3c0
leaq -0x42(%rbp), %rdi
callq 0xc3c0
leaq -0x41(%rbp), %rdi
callq 0xc3c0
leaq -0x40(%rbp), %rdi
callq 0xc3c0
leaq -0x3f(%rbp), %rdi
callq 0xc3c0
leaq -0x3e(%rbp), %rdi
callq 0xc3c0
leaq -0x3d(%rbp), %rdi
callq 0xc3c0
leaq -0x3c(%rbp), %rdi
callq 0xc3c0
leaq -0x3b(%rbp), %rdi
callq 0xc3c0
leaq -0x3a(%rbp), %rdi
callq 0xc3c0
leaq -0x39(%rbp), %rdi
callq 0xc3c0
leaq -0x38(%rbp), %rdi
callq 0xc3c0
leaq -0x37(%rbp), %rdi
callq 0xc3c0
leaq -0x36(%rbp), %rdi
callq 0xc3c0
leaq -0x35(%rbp), %rdi
callq 0xc3c0
leaq -0x21(%rbp), %rdi
callq 0xc3c0
movq -0x60(%rbp), %rdi
addq $0x228, %rdi            # imm = 0x228
leaq 0x3d941(%rip), %rsi     # 0x263bb8
movl $0x44, %edx
callq 0xc300
movq -0x60(%rbp), %rax
movq 0x3d970(%rip), %rcx     # 0x263bfc
movq %rcx, 0x26c(%rax)
movq 0x3d96a(%rip), %rcx     # 0x263c04
movq %rcx, 0x274(%rax)
movl 0x3d965(%rip), %ecx     # 0x263c0c
movl %ecx, 0x27c(%rax)
movq 0x3d95c(%rip), %rcx     # 0x263c10
movq %rcx, 0x280(%rax)
movq 0x3d956(%rip), %rcx     # 0x263c18
movq %rcx, 0x288(%rax)
movq 0x3d950(%rip), %rcx     # 0x263c20
movq %rcx, 0x290(%rax)
addq $0x298, %rax            # imm = 0x298
movq %rax, -0x178(%rbp)
movq %rax, %rcx
addq $0xaa0, %rcx            # imm = 0xAA0
movq %rcx, -0x170(%rbp)
movq %rax, -0x168(%rbp)
movq -0x168(%rbp), %rdi
movq %rdi, -0x180(%rbp)
callq 0x231990
movq -0x180(%rbp), %rax
movq -0x170(%rbp), %rcx
addq $0x20, %rax
cmpq %rcx, %rax
movq %rax, -0x168(%rbp)
jne 0x2262fc
movq -0x60(%rbp), %rax
addq $0xd38, %rax            # imm = 0xD38
movq %rax, -0x198(%rbp)
movq %rax, %rcx
addq $0xaa0, %rcx            # imm = 0xAA0
movq %rcx, -0x190(%rbp)
movq %rax, -0x188(%rbp)
movq -0x188(%rbp), %rdi
movq %rdi, -0x1a0(%rbp)
callq 0x2319d0
movq -0x1a0(%rbp), %rax
movq -0x190(%rbp), %rcx
addq $0x20, %rax
cmpq %rcx, %rax
movq %rax, -0x188(%rbp)
jne 0x226356
movq -0x60(%rbp), %rax
addq $0x17d8, %rax           # imm = 0x17D8
movq %rax, -0x1b8(%rbp)
movq %rax, %rcx
addq $0xaa0, %rcx            # imm = 0xAA0
movq %rcx, -0x1b0(%rbp)
movq %rax, -0x1a8(%rbp)
movq -0x1a8(%rbp), %rdi
movq %rdi, -0x1c0(%rbp)
callq 0x2319d0
movq -0x1c0(%rbp), %rax
movq -0x1b0(%rbp), %rcx
addq $0x20, %rax
cmpq %rcx, %rax
movq %rax, -0x1a8(%rbp)
jne 0x2263b0
movq -0x60(%rbp), %rax
addq $0x2278, %rax           # imm = 0x2278
movq %rax, -0x1d8(%rbp)
movq %rax, %rcx
addq $0x7f8, %rcx            # imm = 0x7F8
movq %rcx, -0x1d0(%rbp)
movq %rax, -0x1c8(%rbp)
movq -0x1c8(%rbp), %rdi
movq %rdi, -0x1e0(%rbp)
callq 0x231a10
movq -0x1e0(%rbp), %rax
movq -0x1d0(%rbp), %rcx
addq $0x18, %rax
cmpq %rcx, %rax
movq %rax, -0x1c8(%rbp)
jne 0x22640a
movq -0x60(%rbp), %rax
addq $0x2a70, %rax           # imm = 0x2A70
movq %rax, -0x1f8(%rbp)
movq %rax, %rcx
addq $0xaa0, %rcx            # imm = 0xAA0
movq %rcx, -0x1f0(%rbp)
movq %rax, -0x1e8(%rbp)
movq -0x1e8(%rbp), %rdi
movq %rdi, -0x200(%rbp)
callq 0x231a30
movq -0x200(%rbp), %rax
movq -0x1f0(%rbp), %rcx
addq $0x20, %rax
cmpq %rcx, %rax
movq %rax, -0x1e8(%rbp)
jne 0x226464
movq -0x60(%rbp), %rdi
addq $0x3510, %rdi           # imm = 0x3510
leaq 0x3d781(%rip), %rsi     # 0x263c28
movl $0x1a4, %edx            # imm = 0x1A4
callq 0xc300
movq -0x60(%rbp), %rdi
movslq -0xc(%rbp), %rcx
leaq (%rcx,%rcx,8), %rax
leaq (%rax,%rax,2), %rax
addq %rcx, %rax
movups 0x3510(%rdi,%rax), %xmm0
movups 0x351c(%rdi,%rax), %xmm1
movups %xmm1, 0x36c0(%rdi)
movups %xmm0, 0x36b4(%rdi)
movl $0x8, 0x36d0(%rdi)
movl $0x40, 0x36d4(%rdi)
addq $0x36d8, %rdi           # imm = 0x36D8
leaq 0x3d8cc(%rip), %rsi     # 0x263dd0
movl $0x7e0, %edx            # imm = 0x7E0
callq 0xc300
movq -0x60(%rbp), %rax
movq %rax, %rdi
addq $0x3eb8, %rdi           # imm = 0x3EB8
movslq -0x10(%rbp), %rcx
leaq (%rcx,%rcx,8), %rcx
shlq $0x4, %rcx
leaq 0x36d8(%rax,%rcx), %rsi
movl $0x90, %edx
callq 0xc300
movq -0x60(%rbp), %rdi
movl 0x3ed0(%rdi), %ecx
movl 0x3edc(%rdi), %eax
addl %ecx, %eax
movl %eax, 0x3f48(%rdi)
movl -0x14(%rbp), %eax
movl %eax, (%rdi)
callq 0x226950
jmp 0x22655e
movq -0x60(%rbp), %rdi
callq 0x227230
jmp 0x226569
movq -0x60(%rbp), %rdi
callq 0x2273b0
jmp 0x226574
movq -0x60(%rbp), %rdi
callq 0x227420
jmp 0x22657f
movq -0x60(%rbp), %rdi
callq 0x227490
jmp 0x22658a
movq -0x60(%rbp), %rdi
callq 0x227700
jmp 0x226595
addq $0x270, %rsp            # imm = 0x270
popq %rbp
retq
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x30(%rbp)
movl %eax, -0x34(%rbp)
jmp 0x22673b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x30(%rbp)
movl %eax, -0x34(%rbp)
jmp 0x226732
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x30(%rbp)
movl %eax, -0x34(%rbp)
jmp 0x226729
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x30(%rbp)
movl %eax, -0x34(%rbp)
jmp 0x226720
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x30(%rbp)
movl %eax, -0x34(%rbp)
jmp 0x226717
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x30(%rbp)
movl %eax, -0x34(%rbp)
jmp 0x22670e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x30(%rbp)
movl %eax, -0x34(%rbp)
jmp 0x226705
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x30(%rbp)
movl %eax, -0x34(%rbp)
jmp 0x2266fc
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x30(%rbp)
movl %eax, -0x34(%rbp)
jmp 0x2266f3
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x30(%rbp)
movl %eax, -0x34(%rbp)
jmp 0x2266ea
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x30(%rbp)
movl %eax, -0x34(%rbp)
jmp 0x2266e1
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x30(%rbp)
movl %eax, -0x34(%rbp)
jmp 0x2266d8
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x30(%rbp)
movl %eax, -0x34(%rbp)
jmp 0x2266cf
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x30(%rbp)
movl %eax, -0x34(%rbp)
jmp 0x2266c6
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x30(%rbp)
movl %eax, -0x34(%rbp)
jmp 0x2266bd
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x30(%rbp)
movl %eax, -0x34(%rbp)
jmp 0x2266b4
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x30(%rbp)
movl %eax, -0x34(%rbp)
leaq -0x44(%rbp), %rdi
callq 0xc3c0
leaq -0x43(%rbp), %rdi
callq 0xc3c0
leaq -0x42(%rbp), %rdi
callq 0xc3c0
leaq -0x41(%rbp), %rdi
callq 0xc3c0
leaq -0x40(%rbp), %rdi
callq 0xc3c0
leaq -0x3f(%rbp), %rdi
callq 0xc3c0
leaq -0x3e(%rbp), %rdi
callq 0xc3c0
leaq -0x3d(%rbp), %rdi
callq 0xc3c0
leaq -0x3c(%rbp), %rdi
callq 0xc3c0
leaq -0x3b(%rbp), %rdi
callq 0xc3c0
leaq -0x3a(%rbp), %rdi
callq 0xc3c0
leaq -0x39(%rbp), %rdi
callq 0xc3c0
leaq -0x38(%rbp), %rdi
callq 0xc3c0
leaq -0x37(%rbp), %rdi
callq 0xc3c0
leaq -0x36(%rbp), %rdi
callq 0xc3c0
leaq -0x35(%rbp), %rdi
callq 0xc3c0
leaq -0x21(%rbp), %rdi
callq 0xc3c0
testb $0x1, -0x45(%rbp)
jne 0x22674c
jmp 0x226790
movq -0x58(%rbp), %rcx
movq -0x20(%rbp), %rax
cmpq %rax, %rcx
movq %rax, -0x208(%rbp)
je 0x22678e
movq -0x208(%rbp), %rdi
addq $-0x20, %rdi
movq %rdi, -0x210(%rbp)
callq 0xc6b8
movq -0x58(%rbp), %rcx
movq -0x210(%rbp), %rax
cmpq %rcx, %rax
movq %rax, -0x208(%rbp)
jne 0x226760
jmp 0x226790
jmp 0x22693c
movq %rdx, %rcx
movq %rax, %rdx
movq -0x1f8(%rbp), %rax
movq %rdx, -0x30(%rbp)
movl %ecx, -0x34(%rbp)
addq $0xaa0, %rax            # imm = 0xAA0
movq %rax, -0x218(%rbp)
movq -0x218(%rbp), %rdi
addq $-0x20, %rdi
movq %rdi, -0x220(%rbp)
callq 0x16e930
movq -0x1f8(%rbp), %rcx
movq -0x220(%rbp), %rax
cmpq %rcx, %rax
movq %rax, -0x218(%rbp)
jne 0x2267b6
movq -0x1d8(%rbp), %rax
addq $0x7f8, %rax            # imm = 0x7F8
movq %rax, -0x228(%rbp)
movq -0x228(%rbp), %rdi
addq $-0x18, %rdi
movq %rdi, -0x230(%rbp)
callq 0x16e950
movq -0x1d8(%rbp), %rcx
movq -0x230(%rbp), %rax
cmpq %rcx, %rax
movq %rax, -0x228(%rbp)
jne 0x2267fb
movq -0x1b8(%rbp), %rax
addq $0xaa0, %rax            # imm = 0xAA0
movq %rax, -0x238(%rbp)
movq -0x238(%rbp), %rdi
addq $-0x20, %rdi
movq %rdi, -0x240(%rbp)
callq 0x16e9b0
movq -0x1b8(%rbp), %rcx
movq -0x240(%rbp), %rax
cmpq %rcx, %rax
movq %rax, -0x238(%rbp)
jne 0x226840
movq -0x198(%rbp), %rax
addq $0xaa0, %rax            # imm = 0xAA0
movq %rax, -0x248(%rbp)
movq -0x248(%rbp), %rdi
addq $-0x20, %rdi
movq %rdi, -0x250(%rbp)
callq 0x16e9b0
movq -0x198(%rbp), %rcx
movq -0x250(%rbp), %rax
cmpq %rcx, %rax
movq %rax, -0x248(%rbp)
jne 0x226885
movq -0x178(%rbp), %rax
addq $0xaa0, %rax            # imm = 0xAA0
movq %rax, -0x258(%rbp)
movq -0x258(%rbp), %rdi
addq $-0x20, %rdi
movq %rdi, -0x260(%rbp)
callq 0x16e9d0
movq -0x178(%rbp), %rcx
movq -0x260(%rbp), %rax
cmpq %rcx, %rax
movq %rax, -0x258(%rbp)
jne 0x2268ca
movq -0x58(%rbp), %rax
addq $0x220, %rax            # imm = 0x220
movq %rax, -0x268(%rbp)
movq -0x268(%rbp), %rdi
addq $-0x20, %rdi
movq %rdi, -0x270(%rbp)
callq 0xc6b8
movq -0x58(%rbp), %rcx
movq -0x270(%rbp), %rax
cmpq %rcx, %rax
movq %rax, -0x268(%rbp)
jne 0x22690c
jmp 0x22693c
movq -0x30(%rbp), %rdi
callq 0xc5d0
nopw %cs:(%rax,%rax)