// File: /workspace/github_cpp_makefile_star2_O1/CMU-SAFARI[P]ramulator/src/ALDRAM.cpp
// Function: ramulator::ALDRAM::init_speed()
void ALDRAM::init_speed()
{
    // nRRD, nFAW
    int page = (org_entry.dq * org_entry.count[int(Level::Column)]) >> 13;
    switch (speed_entry.rate) {
        case 800:  speed_entry.nRRD = (page==1) ? 4 : 4; speed_entry.nFAW = (page==1) ? 16 : 20; break;
        case 1066: speed_entry.nRRD = (page==1) ? 4 : 6; speed_entry.nFAW = (page==1) ? 20 : 27; break;
        case 1333: speed_entry.nRRD = (page==1) ? 4 : 5; speed_entry.nFAW = (page==1) ? 20 : 30; break;
        case 1600: speed_entry.nRRD = (page==1) ? 5 : 6; speed_entry.nFAW = (page==1) ? 24 : 32; break;
        case 1866: speed_entry.nRRD = (page==1) ? 5 : 6; speed_entry.nFAW = (page==1) ? 26 : 33; break;
        case 2133: speed_entry.nRRD = (page==1) ? 5 : 6; speed_entry.nFAW = (page==1) ? 27 : 34; break;
        default: assert(false);
    }

    // nRFC, nXS
    int chip = org_entry.size;
    switch (speed_entry.rate) {
        case 800:  speed_entry.nRFC = (chip==512) ? 36  : (chip==1<<10) ? 44  : (chip==1<<11) ? 64  : (chip==1<<12) ? 104 : 140; break;
        case 1066: speed_entry.nRFC = (chip==512) ? 48  : (chip==1<<10) ? 59  : (chip==1<<11) ? 86  : (chip==1<<12) ? 139 : 187; break;
        case 1333: speed_entry.nRFC = (chip==512) ? 60  : (chip==1<<10) ? 74  : (chip==1<<11) ? 107 : (chip==1<<12) ? 174 : 234; break;
        case 1600: speed_entry.nRFC = (chip==512) ? 72  : (chip==1<<10) ? 88  : (chip==1<<11) ? 128 : (chip==1<<12) ? 208 : 280; break;
        case 1866: speed_entry.nRFC = (chip==512) ? 84  : (chip==1<<10) ? 103 : (chip==1<<11) ? 150 : (chip==1<<12) ? 243 : 327; break;
        case 2133: speed_entry.nRFC = (chip==512) ? 96  : (chip==1<<10) ? 118 : (chip==1<<11) ? 171 : (chip==1<<12) ? 278 : 374; break;
        default: assert(false);
    }
    switch (speed_entry.rate) {
        case 800:  speed_entry.nXS  = (chip==512) ? 40  : (chip==1<<10) ? 48  : (chip==1<<11) ? 68  : (chip==1<<12) ? 108 : 144; break;
        case 1066: speed_entry.nXS  = (chip==512) ? 54  : (chip==1<<10) ? 64  : (chip==1<<11) ? 91  : (chip==1<<12) ? 144 : 192; break;
        case 1333: speed_entry.nXS  = (chip==512) ? 67  : (chip==1<<10) ? 80  : (chip==1<<11) ? 114 : (chip==1<<12) ? 180 : 240; break;
        case 1600: speed_entry.nXS  = (chip==512) ? 80  : (chip==1<<10) ? 96  : (chip==1<<11) ? 136 : (chip==1<<12) ? 216 : 288; break;
        case 1866: speed_entry.nXS  = (chip==512) ? 94  : (chip==1<<10) ? 112 : (chip==1<<11) ? 159 : (chip==1<<12) ? 252 : 336; break;
        case 2133: speed_entry.nXS  = (chip==512) ? 107 : (chip==1<<10) ? 128 : (chip==1<<11) ? 182 : (chip==1<<12) ? 288 : 384; break;
        default: assert(false);
    }
}

// Assembly:
pushq %rax
movl 0x273c(%rdi), %ecx
imull 0x2728(%rdi), %ecx
sarl $0xd, %ecx
movl 0x3390(%rdi), %eax
cmpl $0x63f, %eax            # imm = 0x63F
jg 0x101d9d
cmpl $0x320, %eax            # imm = 0x320
je 0x101e0f
cmpl $0x42a, %eax            # imm = 0x42A
je 0x101dce
cmpl $0x535, %eax            # imm = 0x535
jne 0x1022a8
xorl %edx, %edx
cmpl $0x1, %ecx
sete %dl
movl $0x14, %esi
movl $0x1e, %ecx
cmovel %esi, %ecx
xorl $0x5, %edx
jmp 0x101e07
cmpl $0x640, %eax            # imm = 0x640
je 0x101e2a
cmpl $0x74a, %eax            # imm = 0x74A
je 0x101def
cmpl $0x855, %eax            # imm = 0x855
jne 0x1022a8
xorl %edx, %edx
cmpl $0x1, %ecx
setne %dl
movl $0x1b, %esi
movl $0x22, %ecx
jmp 0x101e01
xorl %edx, %edx
cmpl $0x1, %ecx
setne %dl
leal 0x4(%rdx,%rdx), %ecx
movl %ecx, 0x33d8(%rdi)
movl $0x14, %edx
movl $0x1b, %ecx
cmovel %edx, %ecx
jmp 0x101e42
xorl %edx, %edx
cmpl $0x1, %ecx
setne %dl
movl $0x1a, %esi
movl $0x21, %ecx
cmovel %esi, %ecx
addl $0x5, %edx
movl %edx, 0x33d8(%rdi)
jmp 0x101e42
xorl %edx, %edx
cmpl $0x1, %ecx
setne %dl
movl $0x4, 0x33d8(%rdi)
leal 0x10(,%rdx,4), %ecx
jmp 0x101e42
xorl %edx, %edx
cmpl $0x1, %ecx
setne %dl
leal 0x5(%rdx), %ecx
movl %ecx, 0x33d8(%rdi)
leal 0x18(,%rdx,8), %ecx
movl %ecx, 0x33dc(%rdi)
movl 0x2724(%rdi), %ecx
cmpl $0x63f, %eax            # imm = 0x63F
jg 0x101ea4
cmpl $0x320, %eax            # imm = 0x320
je 0x101f47
cmpl $0x42a, %eax            # imm = 0x42A
je 0x101eef
cmpl $0x535, %eax            # imm = 0x535
jne 0x1022c7
cmpl $0x200, %ecx            # imm = 0x200
je 0x101fdb
cmpl $0x400, %ecx            # imm = 0x400
je 0x101fb3
cmpl $0x800, %ecx            # imm = 0x800
jne 0x102024
movl $0x6b, %edx
jmp 0x10207b
cmpl $0x640, %eax            # imm = 0x640
je 0x101f75
cmpl $0x74a, %eax            # imm = 0x74A
je 0x101f1d
cmpl $0x855, %eax            # imm = 0x855
jne 0x1022c7
cmpl $0x200, %ecx            # imm = 0x200
je 0x101fe5
cmpl $0x400, %ecx            # imm = 0x400
je 0x101fbd
cmpl $0x800, %ecx            # imm = 0x800
jne 0x102036
movl $0xab, %edx
jmp 0x10207b
cmpl $0x200, %ecx            # imm = 0x200
je 0x101fc7
cmpl $0x400, %ecx            # imm = 0x400
je 0x101f9f
cmpl $0x800, %ecx            # imm = 0x800
jne 0x102000
movl $0x56, %edx
jmp 0x10207b
cmpl $0x200, %ecx            # imm = 0x200
je 0x101fd1
cmpl $0x400, %ecx            # imm = 0x400
je 0x101fa9
cmpl $0x800, %ecx            # imm = 0x800
jne 0x102012
movl $0x96, %edx
jmp 0x10207b
cmpl $0x200, %ecx            # imm = 0x200
je 0x102048
cmpl $0x400, %ecx            # imm = 0x400
je 0x101fef
cmpl $0x800, %ecx            # imm = 0x800
jne 0x102056
movl $0x40, %edx
jmp 0x10207b
cmpl $0x200, %ecx            # imm = 0x200
je 0x10204f
cmpl $0x400, %ecx            # imm = 0x400
je 0x101ff9
cmpl $0x800, %ecx            # imm = 0x800
jne 0x102068
movl $0x80, %edx
jmp 0x10207b
movl $0x3b, %edx
jmp 0x10207b
movl $0x67, %edx
jmp 0x10207b
movl $0x4a, %edx
jmp 0x10207b
movl $0x76, %edx
jmp 0x10207b
movl $0x30, %edx
jmp 0x10207b
movl $0x54, %edx
jmp 0x10207b
movl $0x3c, %edx
jmp 0x10207b
movl $0x60, %edx
jmp 0x10207b
movl $0x2c, %edx
jmp 0x10207b
movl $0x58, %edx
jmp 0x10207b
cmpl $0x1000, %ecx           # imm = 0x1000
movl $0x8b, %esi
movl $0xbb, %edx
jmp 0x102078
cmpl $0x1000, %ecx           # imm = 0x1000
movl $0xf3, %esi
movl $0x147, %edx            # imm = 0x147
jmp 0x102078
cmpl $0x1000, %ecx           # imm = 0x1000
movl $0xae, %esi
movl $0xea, %edx
jmp 0x102078
cmpl $0x1000, %ecx           # imm = 0x1000
movl $0x116, %esi            # imm = 0x116
movl $0x176, %edx            # imm = 0x176
jmp 0x102078
movl $0x24, %edx
jmp 0x10207b
movl $0x48, %edx
jmp 0x10207b
cmpl $0x1000, %ecx           # imm = 0x1000
movl $0x68, %esi
movl $0x8c, %edx
jmp 0x102078
cmpl $0x1000, %ecx           # imm = 0x1000
movl $0xd0, %esi
movl $0x118, %edx            # imm = 0x118
cmovel %esi, %edx
movl %edx, 0x33e0(%rdi)
cmpl $0x63f, %eax            # imm = 0x63F
jg 0x1020d7
cmpl $0x320, %eax            # imm = 0x320
je 0x10217a
cmpl $0x42a, %eax            # imm = 0x42A
je 0x102122
cmpl $0x535, %eax            # imm = 0x535
jne 0x1022e6
cmpl $0x200, %ecx            # imm = 0x200
je 0x10220a
cmpl $0x400, %ecx            # imm = 0x400
je 0x1021ce
cmpl $0x800, %ecx            # imm = 0x800
jne 0x102250
movl $0x72, %eax
jmp 0x1022a0
cmpl $0x640, %eax            # imm = 0x640
je 0x1021a8
cmpl $0x74a, %eax            # imm = 0x74A
je 0x102150
cmpl $0x855, %eax            # imm = 0x855
jne 0x1022e6
cmpl $0x200, %ecx            # imm = 0x200
je 0x102214
cmpl $0x400, %ecx            # imm = 0x400
je 0x1021ec
cmpl $0x800, %ecx            # imm = 0x800
jne 0x102262
movl $0xb6, %eax
jmp 0x1022a0
cmpl $0x200, %ecx            # imm = 0x200
je 0x1021f6
cmpl $0x400, %ecx            # imm = 0x400
je 0x1021d8
cmpl $0x800, %ecx            # imm = 0x800
jne 0x10222c
movl $0x5b, %eax
jmp 0x1022a0
cmpl $0x200, %ecx            # imm = 0x200
je 0x102200
cmpl $0x400, %ecx            # imm = 0x400
je 0x1021e2
cmpl $0x800, %ecx            # imm = 0x800
jne 0x10223e
movl $0x9f, %eax
jmp 0x1022a0
cmpl $0x200, %ecx            # imm = 0x200
je 0x102274
cmpl $0x400, %ecx            # imm = 0x400
je 0x10221e
cmpl $0x800, %ecx            # imm = 0x800
jne 0x10227b
movl $0x44, %eax
jmp 0x1022a0
cmpl $0x200, %ecx            # imm = 0x200
je 0x1021ce
cmpl $0x400, %ecx            # imm = 0x400
je 0x102225
cmpl $0x800, %ecx            # imm = 0x800
jne 0x10228d
movl $0x88, %eax
jmp 0x1022a0
movl $0x50, %eax
jmp 0x1022a0
movl $0x40, %eax
jmp 0x1022a0
movl $0x70, %eax
jmp 0x1022a0
movl $0x80, %eax
jmp 0x1022a0
movl $0x36, %eax
jmp 0x1022a0
movl $0x5e, %eax
jmp 0x1022a0
movl $0x43, %eax
jmp 0x1022a0
movl $0x6b, %eax
jmp 0x1022a0
movl $0x30, %eax
jmp 0x1022a0
movl $0x60, %eax
jmp 0x1022a0
cmpl $0x1000, %ecx           # imm = 0x1000
movl $0x90, %ecx
movl $0xc0, %eax
jmp 0x10229d
cmpl $0x1000, %ecx           # imm = 0x1000
movl $0xfc, %ecx
movl $0x150, %eax            # imm = 0x150
jmp 0x10229d
cmpl $0x1000, %ecx           # imm = 0x1000
movl $0xb4, %ecx
movl $0xf0, %eax
jmp 0x10229d
cmpl $0x1000, %ecx           # imm = 0x1000
movl $0x120, %ecx            # imm = 0x120
movl $0x180, %eax            # imm = 0x180
jmp 0x10229d
movl $0x28, %eax
jmp 0x1022a0
cmpl $0x1000, %ecx           # imm = 0x1000
movl $0x6c, %ecx
movl $0x90, %eax
jmp 0x10229d
cmpl $0x1000, %ecx           # imm = 0x1000
movl $0xd8, %ecx
movl $0x120, %eax            # imm = 0x120
cmovel %ecx, %eax
movl %eax, 0x33f8(%rdi)
popq %rax
retq
leaq 0x4b0aa(%rip), %rdi     # 0x14d359
leaq 0x54ece(%rip), %rsi     # 0x157184
leaq 0x54ed6(%rip), %rcx     # 0x157193
movl $0x57, %edx
callq 0xb200
leaq 0x4b08b(%rip), %rdi     # 0x14d359
leaq 0x54eaf(%rip), %rsi     # 0x157184
leaq 0x54eb7(%rip), %rcx     # 0x157193
movl $0x63, %edx
callq 0xb200
leaq 0x4b06c(%rip), %rdi     # 0x14d359
leaq 0x54e90(%rip), %rsi     # 0x157184
leaq 0x54e98(%rip), %rcx     # 0x157193
movl $0x6c, %edx
callq 0xb200
nop