// File: CMU-SAFARI[P]ramulator/src/Scheduler.h
// Function: ramulator::RowTable<ramulator::DDR3>::update(ramulator::DDR3::Command, std::vector<int, std::allocator<int>> const&, long)
void update(typename T::Command cmd, const vector<int>& addr_vec, long clk)
    {
        auto begin = addr_vec.begin();
        auto end = begin + int(T::Level::Row);
        vector<int> rowgroup(begin, end); // bank or subarray
        int row = *end;

        T* spec = ctrl->channel->spec;

        if (spec->is_opening(cmd))
            table.insert({rowgroup, {row, 0, clk}});

        if (spec->is_accessing(cmd)) {
            // we are accessing a row -- update its entry
            auto match = table.find(rowgroup);
            assert(match != table.end());
            assert(match->second.row == row);
            match->second.hits++;
            match->second.timestamp = clk;
        } /* accessing */

        if (spec->is_closing(cmd)) {
          // we are closing one or more rows -- remove their entries
          int n_rm = 0;
          int scope;
          if (spec->is_accessing(cmd))
            scope = int(T::Level::Row) - 1; //special condition for RDA and WRA
          else
            scope = int(spec->scope[int(cmd)]);

          for (auto it = table.begin(); it != table.end();) {
            if (equal(begin, begin + scope + 1, it->first.begin())) {
              n_rm++;
              it = table.erase(it);
            }
            else
              it++;
          }

          assert(n_rm > 0);
        } /* closing */
    }

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x170, %rsp            # imm = 0x170
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x130(%rbp)
movq -0x18(%rbp), %rdi
callq 0x2fac0
movq %rax, -0x28(%rbp)
leaq -0x28(%rbp), %rdi
movl $0x3, %esi
callq 0x2faf0
movq %rax, -0x30(%rbp)
movq -0x28(%rbp), %rax
movq %rax, -0x50(%rbp)
movq -0x30(%rbp), %rax
movq %rax, -0x58(%rbp)
leaq -0x59(%rbp), %rdi
movq %rdi, -0x128(%rbp)
callq 0x2fb30
movq -0x128(%rbp), %rcx
movq -0x50(%rbp), %rsi
movq -0x58(%rbp), %rdx
leaq -0x48(%rbp), %rdi
callq 0x2fb50
jmp 0x44ace
leaq -0x59(%rbp), %rdi
callq 0x2fbd0
leaq -0x30(%rbp), %rdi
callq 0x2fbf0
movq %rax, %rcx
movq -0x130(%rbp), %rax
movl (%rcx), %ecx
movl %ecx, -0x70(%rbp)
movq (%rax), %rax
movq 0x1098(%rax), %rax
movq 0x390(%rax), %rax
movq %rax, -0x78(%rbp)
movq -0x78(%rbp), %rdi
movl -0xc(%rbp), %esi
callq 0x41c80
movb %al, -0x131(%rbp)
jmp 0x44b18
movb -0x131(%rbp), %al
testb $0x1, %al
jne 0x44b27
jmp 0x44c02
movq -0x130(%rbp), %rax
addq $0x8, %rax
movq %rax, -0x140(%rbp)
movl -0x70(%rbp), %eax
movl %eax, -0xb0(%rbp)
movl $0x0, -0xac(%rbp)
movq -0x20(%rbp), %rax
movq %rax, -0xa8(%rbp)
leaq -0xa0(%rbp), %rdi
leaq -0x48(%rbp), %rsi
leaq -0xb0(%rbp), %rdx
callq 0x460d0
jmp 0x44b70
movq -0x140(%rbp), %rdi
leaq -0xa0(%rbp), %rsi
callq 0x46090
movb %dl, -0x149(%rbp)
movq %rax, -0x148(%rbp)
jmp 0x44b92
movb -0x149(%rbp), %al
movq -0x148(%rbp), %rcx
movq %rcx, -0xc0(%rbp)
movb %al, -0xb8(%rbp)
leaq -0xa0(%rbp), %rdi
callq 0x46120
jmp 0x44c02
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x68(%rbp)
movl %eax, -0x6c(%rbp)
leaq -0x59(%rbp), %rdi
callq 0x2fbd0
jmp 0x44ee7
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x68(%rbp)
movl %eax, -0x6c(%rbp)
jmp 0x44ede
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x68(%rbp)
movl %eax, -0x6c(%rbp)
leaq -0xa0(%rbp), %rdi
callq 0x46120
jmp 0x44ede
movq -0x78(%rbp), %rdi
movl -0xc(%rbp), %esi
callq 0x44f10
testb $0x1, %al
jne 0x44c17
jmp 0x44cff
movq -0x130(%rbp), %rdi
addq $0x8, %rdi
leaq -0x48(%rbp), %rsi
callq 0x2fc10
movq %rax, -0x158(%rbp)
jmp 0x44c34
movq -0x130(%rbp), %rdi
movq -0x158(%rbp), %rax
movq %rax, -0xc8(%rbp)
addq $0x8, %rdi
callq 0x2fc70
movq %rax, -0xd0(%rbp)
leaq -0xc8(%rbp), %rdi
leaq -0xd0(%rbp), %rsi
callq 0x31a60
testb $0x1, %al
jne 0x44c72
jmp 0x44c74
jmp 0x44c93
leaq 0x20c7ff(%rip), %rdi    # 0x25147a
leaq 0x20c80d(%rip), %rsi    # 0x25148f
movl $0x12d, %edx            # imm = 0x12D
leaq 0x20c811(%rip), %rcx    # 0x25149f
callq 0xc280
leaq -0xc8(%rbp), %rdi
callq 0x2fca0
movl 0x18(%rax), %eax
cmpl -0x70(%rbp), %eax
jne 0x44ca9
jmp 0x44cc8
leaq 0x20c867(%rip), %rdi    # 0x251517
leaq 0x20c7d8(%rip), %rsi    # 0x25148f
movl $0x12e, %edx            # imm = 0x12E
leaq 0x20c7dc(%rip), %rcx    # 0x25149f
callq 0xc280
leaq -0xc8(%rbp), %rdi
callq 0x2fca0
movl 0x1c(%rax), %ecx
addl $0x1, %ecx
movl %ecx, 0x1c(%rax)
movq -0x20(%rbp), %rax
movq %rax, -0x160(%rbp)
leaq -0xc8(%rbp), %rdi
callq 0x2fca0
movq -0x160(%rbp), %rcx
movq %rcx, 0x20(%rax)
movq -0x78(%rbp), %rdi
movl -0xc(%rbp), %esi
callq 0x46140
movb %al, -0x161(%rbp)
jmp 0x44d13
movb -0x161(%rbp), %al
testb $0x1, %al
jne 0x44d22
jmp 0x44ecc
movl $0x0, -0xd4(%rbp)
movq -0x78(%rbp), %rdi
movl -0xc(%rbp), %esi
callq 0x44f10
testb $0x1, %al
jne 0x44d3e
jmp 0x44d4a
movl $0x2, -0xd8(%rbp)
jmp 0x44d5f
movq -0x78(%rbp), %rax
movslq -0xc(%rbp), %rcx
movl 0x180(%rax,%rcx,4), %eax
movl %eax, -0xd8(%rbp)
movq -0x130(%rbp), %rdi
addq $0x8, %rdi
callq 0x31a30
movq %rax, -0xe0(%rbp)
movq -0x130(%rbp), %rdi
addq $0x8, %rdi
callq 0x2fc70
movq %rax, -0xe8(%rbp)
leaq -0xe0(%rbp), %rdi
leaq -0xe8(%rbp), %rsi
callq 0x31a60
testb $0x1, %al
jne 0x44da9
jmp 0x44ea0
movq -0x28(%rbp), %rax
movq %rax, -0xf0(%rbp)
movslq -0xd8(%rbp), %rsi
leaq -0x28(%rbp), %rdi
callq 0x2faf0
movq %rax, -0x100(%rbp)
leaq -0x100(%rbp), %rdi
movl $0x1, %esi
callq 0x2faf0
movq %rax, -0xf8(%rbp)
leaq -0xe0(%rbp), %rdi
callq 0x2fca0
movq %rax, %rdi
callq 0x2fac0
movq %rax, -0x108(%rbp)
movq -0xf0(%rbp), %rdi
movq -0xf8(%rbp), %rsi
movq -0x108(%rbp), %rdx
callq 0x442a0
movb %al, -0x162(%rbp)
jmp 0x44e20
movb -0x162(%rbp), %al
testb $0x1, %al
jne 0x44e2c
jmp 0x44e86
movq -0x130(%rbp), %rdi
movl -0xd4(%rbp), %eax
incl %eax
movl %eax, -0xd4(%rbp)
addq $0x8, %rdi
movq -0xe0(%rbp), %rax
movq %rax, -0x118(%rbp)
movq -0x118(%rbp), %rsi
callq 0x46180
movq %rax, -0x170(%rbp)
jmp 0x44e68
movq -0x170(%rbp), %rax
movq %rax, -0x110(%rbp)
movq -0x110(%rbp), %rax
movq %rax, -0xe0(%rbp)
jmp 0x44e9b
leaq -0xe0(%rbp), %rdi
xorl %esi, %esi
callq 0x461c0
movq %rax, -0x120(%rbp)
jmp 0x44d76
cmpl $0x0, -0xd4(%rbp)
jle 0x44eab
jmp 0x44eca
leaq 0x20c67e(%rip), %rdi    # 0x251530
leaq 0x20c5d6(%rip), %rsi    # 0x25148f
movl $0x145, %edx            # imm = 0x145
leaq 0x20c5da(%rip), %rcx    # 0x25149f
callq 0xc280
jmp 0x44ecc
leaq -0x48(%rbp), %rdi
callq 0x2fcd0
addq $0x170, %rsp            # imm = 0x170
popq %rbp
retq
leaq -0x48(%rbp), %rdi
callq 0x2fcd0
movq -0x68(%rbp), %rdi
callq 0xc5d0