// File: /workspace/github_cpp_makefile_star2_O1/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
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x58, %rsp
movq %rcx, %r12
movl %esi, %r15d
movq %rdi, %rbx
movq (%rdx), %r14
leaq 0xc(%r14), %rdx
leaq 0x10(%rsp), %rdi
leaq 0x30(%rsp), %rcx
movq %r14, %rsi
callq 0x24746
movl 0xc(%r14), %ebp
movq (%rbx), %rax
movq 0x1098(%rax), %rax
movq 0x390(%rax), %r13
testl %r15d, %r15d
jne 0x29fc4
leaq 0x30(%rsp), %rdi
leaq 0x10(%rsp), %rsi
callq 0x24b6e
leaq 0x30(%rsp), %rsi
movl %ebp, 0x18(%rsi)
movl $0x0, 0x1c(%rsi)
movq %r12, 0x20(%rsi)
leaq 0x8(%rbx), %rdi
callq 0x2a75e
movq 0x30(%rsp), %rdi
testq %rdi, %rdi
je 0x29fc4
movq 0x40(%rsp), %rsi
subq %rdi, %rsi
callq 0xb2f0
movq %rbx, 0x8(%rsp)
leal -0x3(%r15), %ebx
cmpl $0x3, %ebx
ja 0x2a012
movq %r12, 0x28(%rsp)
movq %r13, %r12
movq 0x8(%rsp), %r13
leaq 0x8(%r13), %rdi
leaq 0x10(%rsp), %rsi
callq 0x2482e
leaq 0x10(%r13), %rcx
cmpq %rcx, %rax
je 0x2a0e1
cmpl %ebp, 0x38(%rax)
jne 0x2a100
movq %r12, %r13
incl 0x3c(%rax)
movq 0x28(%rsp), %rcx
movq %rcx, 0x40(%rax)
leal -0x1(%r15), %eax
testl $0xfffffffa, %eax       # imm = 0xFFFFFFFA
jne 0x2a09c
movl $0x2, %eax
cmpl $0x4, %ebx
jb 0x2a032
movslq %r15d, %rax
movslq 0x180(%r13,%rax,4), %rax
movq 0x8(%rsp), %rcx
movq 0x20(%rcx), %r15
leaq 0x10(%rcx), %r13
cmpq %r13, %r15
je 0x2a0c2
addq $0x8, 0x8(%rsp)
leaq (%r14,%rax,4), %rbp
addq $0x4, %rbp
leaq 0x4(,%rax,4), %r12
xorl %ebx, %ebx
cmpq %r14, %rbp
je 0x2a081
movq 0x20(%r15), %rsi
movq %r14, %rdi
movq %r12, %rdx
callq 0xb300
testl %eax, %eax
je 0x2a081
movq %r15, %rdi
callq 0xb230
movq %rax, %r15
jmp 0x2a093
movq 0x8(%rsp), %rdi
movq %r15, %rsi
callq 0x2a9ba
movq %rax, %r15
incl %ebx
cmpq %r13, %r15
jne 0x2a05c
testl %ebx, %ebx
jle 0x2a0c2
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x2a0b3
movq 0x20(%rsp), %rsi
subq %rdi, %rsi
callq 0xb2f0
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x124c8f(%rip), %rdi    # 0x14ed58
leaq 0x124be7(%rip), %rsi    # 0x14ecb7
leaq 0x124bf0(%rip), %rcx    # 0x14ecc7
movl $0x145, %edx            # imm = 0x145
callq 0xb200
leaq 0x124bba(%rip), %rdi    # 0x14eca2
leaq 0x124bc8(%rip), %rsi    # 0x14ecb7
leaq 0x124bd1(%rip), %rcx    # 0x14ecc7
movl $0x12d, %edx            # imm = 0x12D
callq 0xb200
leaq 0x124c38(%rip), %rdi    # 0x14ed3f
leaq 0x124ba9(%rip), %rsi    # 0x14ecb7
leaq 0x124bb2(%rip), %rcx    # 0x14ecc7
movl $0x12e, %edx            # imm = 0x12E
callq 0xb200
movq %rax, %rbx
movq 0x30(%rsp), %rdi
testq %rdi, %rdi
je 0x2a142
movq 0x40(%rsp), %rsi
subq %rdi, %rsi
callq 0xb2f0
jmp 0x2a142
jmp 0x2a13f
jmp 0x2a13f
movq %rax, %rbx
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x2a159
movq 0x20(%rsp), %rsi
subq %rdi, %rsi
callq 0xb2f0
movq %rbx, %rdi
callq 0xb510
nop