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

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x210, %rsp            # imm = 0x210
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movl %edx, -0x10(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x48(%rbp)
movq %rax, %rcx
movq %rcx, -0x50(%rbp)
movb $0x1, -0x38(%rbp)
movq %rax, -0x18(%rbp)
leaq -0x19(%rbp), %rdi
movq %rdi, -0x40(%rbp)
callq 0xc5e0
movq -0x48(%rbp), %rdi
movq -0x40(%rbp), %rdx
leaq 0xd02ca(%rip), %rsi     # 0x25abb2
callq 0x17a40
jmp 0x18a8ef
movq -0x48(%rbp), %rax
addq $0x20, %rax
movq %rax, -0x60(%rbp)
movq %rax, -0x18(%rbp)
leaq -0x2d(%rbp), %rdi
movq %rdi, -0x58(%rbp)
callq 0xc5e0
movq -0x60(%rbp), %rdi
movq -0x58(%rbp), %rdx
leaq 0xd029b(%rip), %rsi     # 0x25abb6
callq 0x17a40
jmp 0x18a922
movq -0x48(%rbp), %rax
addq $0x40, %rax
movq %rax, -0x70(%rbp)
movq %rax, -0x18(%rbp)
leaq -0x2e(%rbp), %rdi
movq %rdi, -0x68(%rbp)
callq 0xc5e0
movq -0x70(%rbp), %rdi
movq -0x68(%rbp), %rdx
leaq 0xc699d(%rip), %rsi     # 0x2512eb
callq 0x17a40
jmp 0x18a955
movq -0x48(%rbp), %rax
addq $0x60, %rax
movq %rax, -0x80(%rbp)
movq %rax, -0x18(%rbp)
leaq -0x2f(%rbp), %rdi
movq %rdi, -0x78(%rbp)
callq 0xc5e0
movq -0x80(%rbp), %rdi
movq -0x78(%rbp), %rdx
leaq 0xd0239(%rip), %rsi     # 0x25abba
callq 0x17a40
jmp 0x18a988
movq -0x48(%rbp), %rax
subq $-0x80, %rax
movq %rax, -0x90(%rbp)
movq %rax, -0x18(%rbp)
leaq -0x30(%rbp), %rdi
movq %rdi, -0x88(%rbp)
callq 0xc5e0
movq -0x90(%rbp), %rdi
movq -0x88(%rbp), %rdx
leaq 0xc59ea(%rip), %rsi     # 0x2503aa
callq 0x17a40
jmp 0x18a9c7
movq -0x48(%rbp), %rax
addq $0xa0, %rax
movq %rax, -0xa0(%rbp)
movq %rax, -0x18(%rbp)
leaq -0x31(%rbp), %rdi
movq %rdi, -0x98(%rbp)
callq 0xc5e0
movq -0xa0(%rbp), %rdi
movq -0x98(%rbp), %rdx
leaq 0xd01bc(%rip), %rsi     # 0x25abbd
callq 0x17a40
jmp 0x18aa08
movq -0x48(%rbp), %rax
addq $0xc0, %rax
movq %rax, -0xb0(%rbp)
movq %rax, -0x18(%rbp)
leaq -0x32(%rbp), %rdi
movq %rdi, -0xa8(%rbp)
callq 0xc5e0
movq -0xb0(%rbp), %rdi
movq -0xa8(%rbp), %rdx
leaq 0xd017f(%rip), %rsi     # 0x25abc1
callq 0x17a40
jmp 0x18aa49
movq -0x48(%rbp), %rax
addq $0xe0, %rax
movq %rax, -0xc0(%rbp)
movq %rax, -0x18(%rbp)
leaq -0x33(%rbp), %rdi
movq %rdi, -0xb8(%rbp)
callq 0xc5e0
movq -0xc0(%rbp), %rdi
movq -0xb8(%rbp), %rdx
leaq 0xda0dd(%rip), %rsi     # 0x264b60
callq 0x17a40
jmp 0x18aa8a
movq -0x48(%rbp), %rax
addq $0x100, %rax            # imm = 0x100
movq %rax, -0xd0(%rbp)
movq %rax, -0x18(%rbp)
leaq -0x34(%rbp), %rdi
movq %rdi, -0xc8(%rbp)
callq 0xc5e0
movq -0xd0(%rbp), %rdi
movq -0xc8(%rbp), %rdx
leaq 0xd0101(%rip), %rsi     # 0x25abc5
callq 0x17a40
jmp 0x18aacb
movq -0x48(%rbp), %rax
addq $0x120, %rax            # imm = 0x120
movq %rax, -0xe0(%rbp)
movq %rax, -0x18(%rbp)
leaq -0x35(%rbp), %rdi
movq %rdi, -0xd8(%rbp)
callq 0xc5e0
movq -0xe0(%rbp), %rdi
movq -0xd8(%rbp), %rdx
leaq 0xd00c4(%rip), %rsi     # 0x25abc9
callq 0x17a40
jmp 0x18ab0c
movq -0x48(%rbp), %rax
addq $0x140, %rax            # imm = 0x140
movq %rax, -0xf0(%rbp)
movq %rax, -0x18(%rbp)
leaq -0x36(%rbp), %rdi
movq %rdi, -0xe8(%rbp)
callq 0xc5e0
movq -0xf0(%rbp), %rdi
movq -0xe8(%rbp), %rdx
leaq 0xd0087(%rip), %rsi     # 0x25abcd
callq 0x17a40
jmp 0x18ab4d
movq -0x48(%rbp), %rax
addq $0x160, %rax            # imm = 0x160
movq %rax, -0x100(%rbp)
movq %rax, -0x18(%rbp)
leaq -0x37(%rbp), %rdi
movq %rdi, -0xf8(%rbp)
callq 0xc5e0
movq -0x100(%rbp), %rdi
movq -0xf8(%rbp), %rdx
leaq 0xd004a(%rip), %rsi     # 0x25abd1
callq 0x17a40
jmp 0x18ab8e
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 -0x50(%rbp), %rdi
addq $0x180, %rdi            # imm = 0x180
leaq 0xd0ad0(%rip), %rsi     # 0x25b6e0
movl $0x30, %edx
callq 0xc300
movq -0x50(%rbp), %rax
movq 0xd0aeb(%rip), %rcx     # 0x25b710
movq %rcx, 0x1b0(%rax)
movq 0xd0ae5(%rip), %rcx     # 0x25b718
movq %rcx, 0x1b8(%rax)
movl 0xd0ae0(%rip), %ecx     # 0x25b720
movl %ecx, 0x1c0(%rax)
movq 0xd0ad7(%rip), %rcx     # 0x25b724
movq %rcx, 0x1c4(%rax)
movq 0xd0ad1(%rip), %rcx     # 0x25b72c
movq %rcx, 0x1cc(%rax)
movq 0xd0acb(%rip), %rcx     # 0x25b734
movq %rcx, 0x1d4(%rax)
addq $0x1e0, %rax            # imm = 0x1E0
movq %rax, -0x118(%rbp)
movq %rax, %rcx
addq $0x780, %rcx            # imm = 0x780
movq %rcx, -0x110(%rbp)
movq %rax, -0x108(%rbp)
movq -0x108(%rbp), %rdi
movq %rdi, -0x120(%rbp)
callq 0x193030
movq -0x120(%rbp), %rax
movq -0x110(%rbp), %rcx
addq $0x20, %rax
cmpq %rcx, %rax
movq %rax, -0x108(%rbp)
jne 0x18ac95
movq -0x50(%rbp), %rax
addq $0x960, %rax            # imm = 0x960
movq %rax, -0x138(%rbp)
movq %rax, %rcx
addq $0x780, %rcx            # imm = 0x780
movq %rcx, -0x130(%rbp)
movq %rax, -0x128(%rbp)
movq -0x128(%rbp), %rdi
movq %rdi, -0x140(%rbp)
callq 0x193070
movq -0x140(%rbp), %rax
movq -0x130(%rbp), %rcx
addq $0x20, %rax
cmpq %rcx, %rax
movq %rax, -0x128(%rbp)
jne 0x18acef
movq -0x50(%rbp), %rax
addq $0x10e0, %rax           # imm = 0x10E0
movq %rax, -0x158(%rbp)
movq %rax, %rcx
addq $0x780, %rcx            # imm = 0x780
movq %rcx, -0x150(%rbp)
movq %rax, -0x148(%rbp)
movq -0x148(%rbp), %rdi
movq %rdi, -0x160(%rbp)
callq 0x193070
movq -0x160(%rbp), %rax
movq -0x150(%rbp), %rcx
addq $0x20, %rax
cmpq %rcx, %rax
movq %rax, -0x148(%rbp)
jne 0x18ad49
movq -0x50(%rbp), %rax
addq $0x1860, %rax           # imm = 0x1860
movq %rax, -0x178(%rbp)
movq %rax, %rcx
addq $0x5a0, %rcx            # imm = 0x5A0
movq %rcx, -0x170(%rbp)
movq %rax, -0x168(%rbp)
movq -0x168(%rbp), %rdi
movq %rdi, -0x180(%rbp)
callq 0x1930b0
movq -0x180(%rbp), %rax
movq -0x170(%rbp), %rcx
addq $0x18, %rax
cmpq %rcx, %rax
movq %rax, -0x168(%rbp)
jne 0x18ada3
movq -0x50(%rbp), %rax
addq $0x1e00, %rax           # imm = 0x1E00
movq %rax, -0x198(%rbp)
movq %rax, %rcx
addq $0x780, %rcx            # imm = 0x780
movq %rcx, -0x190(%rbp)
movq %rax, -0x188(%rbp)
movq -0x188(%rbp), %rdi
movq %rdi, -0x1a0(%rbp)
callq 0x1930d0
movq -0x1a0(%rbp), %rax
movq -0x190(%rbp), %rcx
addq $0x20, %rax
cmpq %rcx, %rax
movq %rax, -0x188(%rbp)
jne 0x18adfd
movq -0x50(%rbp), %rdi
addq $0x2580, %rdi           # imm = 0x2580
leaq 0xd08fc(%rip), %rsi     # 0x25b73c
movl $0x1a4, %edx            # imm = 0x1A4
callq 0xc300
movq -0x50(%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 $0x8, 0x2740(%rdi)
movl $0x40, 0x2744(%rdi)
addq $0x2748, %rdi           # imm = 0x2748
leaq 0xd0a43(%rip), %rsi     # 0x25b8e0
movl $0x620, %edx            # imm = 0x620
callq 0xc300
movq -0x50(%rbp), %rdi
movslq -0x10(%rbp), %rax
imulq $0x70, %rax, %rax
movups 0x27a8(%rdi,%rax), %xmm0
movups %xmm0, 0x2dc8(%rdi)
movups 0x2798(%rdi,%rax), %xmm0
movups %xmm0, 0x2db8(%rdi)
movups 0x2788(%rdi,%rax), %xmm0
movups %xmm0, 0x2da8(%rdi)
movups 0x2748(%rdi,%rax), %xmm0
movups 0x2758(%rdi,%rax), %xmm1
movups 0x2768(%rdi,%rax), %xmm2
movups 0x2778(%rdi,%rax), %xmm3
movups %xmm3, 0x2d98(%rdi)
movups %xmm2, 0x2d88(%rdi)
movups %xmm1, 0x2d78(%rdi)
movups %xmm0, 0x2d68(%rdi)
movl 0x2d80(%rdi), %ecx
movl 0x2d8c(%rdi), %eax
addl %ecx, %eax
movl %eax, 0x2dd8(%rdi)
callq 0x18b2a0
jmp 0x18af37
movq -0x50(%rbp), %rdi
callq 0x18bb80
jmp 0x18af42
movq -0x50(%rbp), %rdi
callq 0x18bca0
jmp 0x18af4d
movq -0x50(%rbp), %rdi
callq 0x18bd10
jmp 0x18af58
movq -0x50(%rbp), %rdi
callq 0x18bd80
jmp 0x18af63
movq -0x50(%rbp), %rdi
callq 0x18bf20
jmp 0x18af6e
addq $0x210, %rsp            # imm = 0x210
popq %rbp
retq
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x28(%rbp)
movl %eax, -0x2c(%rbp)
jmp 0x18b092
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x28(%rbp)
movl %eax, -0x2c(%rbp)
jmp 0x18b089
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x28(%rbp)
movl %eax, -0x2c(%rbp)
jmp 0x18b080
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x28(%rbp)
movl %eax, -0x2c(%rbp)
jmp 0x18b077
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x28(%rbp)
movl %eax, -0x2c(%rbp)
jmp 0x18b06e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x28(%rbp)
movl %eax, -0x2c(%rbp)
jmp 0x18b065
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x28(%rbp)
movl %eax, -0x2c(%rbp)
jmp 0x18b05c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x28(%rbp)
movl %eax, -0x2c(%rbp)
jmp 0x18b053
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x28(%rbp)
movl %eax, -0x2c(%rbp)
jmp 0x18b04a
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x28(%rbp)
movl %eax, -0x2c(%rbp)
jmp 0x18b041
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x28(%rbp)
movl %eax, -0x2c(%rbp)
jmp 0x18b038
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 0x18b0a3
jmp 0x18b0e7
movq -0x48(%rbp), %rcx
movq -0x18(%rbp), %rax
cmpq %rax, %rcx
movq %rax, -0x1a8(%rbp)
je 0x18b0e5
movq -0x1a8(%rbp), %rdi
addq $-0x20, %rdi
movq %rdi, -0x1b0(%rbp)
callq 0xc6b8
movq -0x48(%rbp), %rcx
movq -0x1b0(%rbp), %rax
cmpq %rcx, %rax
movq %rax, -0x1a8(%rbp)
jne 0x18b0b7
jmp 0x18b0e7
jmp 0x18b293
movq %rdx, %rcx
movq %rax, %rdx
movq -0x198(%rbp), %rax
movq %rdx, -0x28(%rbp)
movl %ecx, -0x2c(%rbp)
addq $0x780, %rax            # imm = 0x780
movq %rax, -0x1b8(%rbp)
movq -0x1b8(%rbp), %rdi
addq $-0x20, %rdi
movq %rdi, -0x1c0(%rbp)
callq 0x4ecc0
movq -0x198(%rbp), %rcx
movq -0x1c0(%rbp), %rax
cmpq %rcx, %rax
movq %rax, -0x1b8(%rbp)
jne 0x18b10d
movq -0x178(%rbp), %rax
addq $0x5a0, %rax            # imm = 0x5A0
movq %rax, -0x1c8(%rbp)
movq -0x1c8(%rbp), %rdi
addq $-0x18, %rdi
movq %rdi, -0x1d0(%rbp)
callq 0x4ece0
movq -0x178(%rbp), %rcx
movq -0x1d0(%rbp), %rax
cmpq %rcx, %rax
movq %rax, -0x1c8(%rbp)
jne 0x18b152
movq -0x158(%rbp), %rax
addq $0x780, %rax            # imm = 0x780
movq %rax, -0x1d8(%rbp)
movq -0x1d8(%rbp), %rdi
addq $-0x20, %rdi
movq %rdi, -0x1e0(%rbp)
callq 0x4ed40
movq -0x158(%rbp), %rcx
movq -0x1e0(%rbp), %rax
cmpq %rcx, %rax
movq %rax, -0x1d8(%rbp)
jne 0x18b197
movq -0x138(%rbp), %rax
addq $0x780, %rax            # imm = 0x780
movq %rax, -0x1e8(%rbp)
movq -0x1e8(%rbp), %rdi
addq $-0x20, %rdi
movq %rdi, -0x1f0(%rbp)
callq 0x4ed40
movq -0x138(%rbp), %rcx
movq -0x1f0(%rbp), %rax
cmpq %rcx, %rax
movq %rax, -0x1e8(%rbp)
jne 0x18b1dc
movq -0x118(%rbp), %rax
addq $0x780, %rax            # imm = 0x780
movq %rax, -0x1f8(%rbp)
movq -0x1f8(%rbp), %rdi
addq $-0x20, %rdi
movq %rdi, -0x200(%rbp)
callq 0x4ed60
movq -0x118(%rbp), %rcx
movq -0x200(%rbp), %rax
cmpq %rcx, %rax
movq %rax, -0x1f8(%rbp)
jne 0x18b221
movq -0x48(%rbp), %rax
addq $0x180, %rax            # imm = 0x180
movq %rax, -0x208(%rbp)
movq -0x208(%rbp), %rdi
addq $-0x20, %rdi
movq %rdi, -0x210(%rbp)
callq 0xc6b8
movq -0x48(%rbp), %rcx
movq -0x210(%rbp), %rax
cmpq %rcx, %rax
movq %rax, -0x208(%rbp)
jne 0x18b263
jmp 0x18b293
movq -0x28(%rbp), %rdi
callq 0xc5d0
nopl (%rax)