// File: CMU-SAFARI[P]ramulator/src/LPDDR3.cpp
// Function: ramulator::LPDDR3::init_lambda()
void LPDDR3::init_lambda()
{
    lambda[int(Level::Bank)][int(Command::ACT)] = [] (DRAM<LPDDR3>* node, int id) {
        node->state = State::Opened;
        node->row_state[id] = State::Opened;};
    lambda[int(Level::Bank)][int(Command::PRE)] = [] (DRAM<LPDDR3>* node, int id) {
        node->state = State::Closed;
        node->row_state.clear();};
    lambda[int(Level::Rank)][int(Command::PRA)] = [] (DRAM<LPDDR3>* node, int id) {
        for (auto bank : node->children) {
            bank->state = State::Closed;
            bank->row_state.clear();}};
    lambda[int(Level::Rank)][int(Command::REF)] = [] (DRAM<LPDDR3>* node, int id) {};
    lambda[int(Level::Bank)][int(Command::RD)] = [] (DRAM<LPDDR3>* node, int id) {};
    lambda[int(Level::Bank)][int(Command::WR)] = [] (DRAM<LPDDR3>* node, int id) {};
    lambda[int(Level::Bank)][int(Command::RDA)] = [] (DRAM<LPDDR3>* node, int id) {
        node->state = State::Closed;
        node->row_state.clear();};
    lambda[int(Level::Bank)][int(Command::WRA)] = [] (DRAM<LPDDR3>* node, int id) {
        node->state = State::Closed;
        node->row_state.clear();};
    lambda[int(Level::Rank)][int(Command::PD)] = [] (DRAM<LPDDR3>* node, int id) {
        for (auto bank : node->children) {
            if (bank->state == State::Closed)
                continue;
            node->state = State::ActPowerDown;
            return;
        }
        node->state = State::PrePowerDown;};
    lambda[int(Level::Rank)][int(Command::PDX)] = [] (DRAM<LPDDR3>* node, int id) {
        node->state = State::PowerUp;};
    lambda[int(Level::Rank)][int(Command::SREF)] = [] (DRAM<LPDDR3>* node, int id) {
        node->state = State::SelfRefresh;};
    lambda[int(Level::Rank)][int(Command::SREFX)] = [] (DRAM<LPDDR3>* node, int id) {
        node->state = State::PowerUp;};
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rdi
movq %rdi, -0x20(%rbp)
addq $0x2078, %rdi           # imm = 0x2078
addq $0x340, %rdi            # imm = 0x340
leaq -0x9(%rbp), %rsi
callq 0x1d15b0
movq -0x20(%rbp), %rdi
addq $0x2078, %rdi           # imm = 0x2078
addq $0x340, %rdi            # imm = 0x340
addq $0x20, %rdi
leaq -0xa(%rbp), %rsi
callq 0x1d1600
movq -0x20(%rbp), %rdi
addq $0x2078, %rdi           # imm = 0x2078
addq $0x1a0, %rdi            # imm = 0x1A0
addq $0x40, %rdi
leaq -0xb(%rbp), %rsi
callq 0x1d1650
movq -0x20(%rbp), %rdi
addq $0x2078, %rdi           # imm = 0x2078
addq $0x1a0, %rdi            # imm = 0x1A0
addq $0xe0, %rdi
leaq -0xc(%rbp), %rsi
callq 0x1d16a0
movq -0x20(%rbp), %rdi
addq $0x2078, %rdi           # imm = 0x2078
addq $0x340, %rdi            # imm = 0x340
addq $0x60, %rdi
leaq -0xd(%rbp), %rsi
callq 0x1d16f0
movq -0x20(%rbp), %rdi
addq $0x2078, %rdi           # imm = 0x2078
addq $0x340, %rdi            # imm = 0x340
addq $0x80, %rdi
leaq -0xe(%rbp), %rsi
callq 0x1d1740
movq -0x20(%rbp), %rdi
addq $0x2078, %rdi           # imm = 0x2078
addq $0x340, %rdi            # imm = 0x340
addq $0xa0, %rdi
leaq -0xf(%rbp), %rsi
callq 0x1d1790
movq -0x20(%rbp), %rdi
addq $0x2078, %rdi           # imm = 0x2078
addq $0x340, %rdi            # imm = 0x340
addq $0xc0, %rdi
leaq -0x10(%rbp), %rsi
callq 0x1d17e0
movq -0x20(%rbp), %rdi
addq $0x2078, %rdi           # imm = 0x2078
addq $0x1a0, %rdi            # imm = 0x1A0
addq $0x120, %rdi            # imm = 0x120
leaq -0x11(%rbp), %rsi
callq 0x1d1830
movq -0x20(%rbp), %rdi
addq $0x2078, %rdi           # imm = 0x2078
addq $0x1a0, %rdi            # imm = 0x1A0
addq $0x140, %rdi            # imm = 0x140
leaq -0x12(%rbp), %rsi
callq 0x1d1880
movq -0x20(%rbp), %rdi
addq $0x2078, %rdi           # imm = 0x2078
addq $0x1a0, %rdi            # imm = 0x1A0
addq $0x160, %rdi            # imm = 0x160
leaq -0x13(%rbp), %rsi
callq 0x1d18d0
movq -0x20(%rbp), %rdi
addq $0x2078, %rdi           # imm = 0x2078
addq $0x1a0, %rdi            # imm = 0x1A0
addq $0x180, %rdi            # imm = 0x180
leaq -0x14(%rbp), %rsi
callq 0x1d1920
addq $0x20, %rsp
popq %rbp
retq
nop