// File: /workspace/github_cpp_makefile_star2_O3/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 $0x48, %rsp
movq %rcx, %r12
movl %esi, %r15d
movq %rdi, %rbx
movq (%rdx), %r14
leaq 0xc(%r14), %rdx
leaq 0x8(%rsp), %rdi
leaq 0x20(%rsp), %rcx
movq %r14, %rsi
callq 0x24766
movl 0xc(%r14), %ebp
testl %r15d, %r15d
je 0x2a2c4
movq (%rbx), %rax
movq 0x1098(%rax), %rax
movq 0x390(%rax), %rcx
leal -0x3(%r15), %r13d
cmpl $0x3, %r13d
ja 0x2a312
movq %rcx, (%rsp)
leaq 0x8(%rbx), %rdi
leaq 0x8(%rsp), %rsi
callq 0x24842
leaq 0x10(%rbx), %rcx
cmpq %rcx, %rax
je 0x2a3d7
cmpl %ebp, 0x38(%rax)
movq (%rsp), %rcx
jne 0x2a3f6
incl 0x3c(%rax)
movq %r12, 0x40(%rax)
leal -0x1(%r15), %eax
testl $0xfffffffa, %eax       # imm = 0xFFFFFFFA
jne 0x2a392
movq %rbx, %rdx
movl $0x2, %eax
cmpl $0x4, %r13d
jae 0x2a320
jmp 0x2a32b
leaq 0x20(%rsp), %rdi
leaq 0x8(%rsp), %rsi
callq 0x24b42
leaq 0x20(%rsp), %rsi
movl %ebp, 0x18(%rsi)
movl $0x0, 0x1c(%rsi)
movq %r12, 0x20(%rsi)
addq $0x8, %rbx
movq %rbx, %rdi
callq 0x2aa36
movq 0x20(%rsp), %rdi
testq %rdi, %rdi
je 0x2a392
movq 0x30(%rsp), %rsi
subq %rdi, %rsi
callq 0xb2f0
jmp 0x2a392
movq %rbx, %rdx
leal -0x1(%r15), %eax
testl $0xfffffffa, %eax       # imm = 0xFFFFFFFA
jne 0x2a392
movslq %r15d, %rax
movslq 0x180(%rcx,%rax,4), %rax
movq 0x20(%rdx), %r15
movq %rdx, (%rsp)
leaq 0x10(%rdx), %r13
cmpq %r13, %r15
je 0x2a3b8
addq $0x8, (%rsp)
leaq (%r14,%rax,4), %rbp
addq $0x4, %rbp
leaq 0x4(,%rax,4), %r12
xorl %ebx, %ebx
cmpq %r14, %rbp
je 0x2a378
movq 0x20(%r15), %rsi
movq %r14, %rdi
movq %r12, %rdx
callq 0xb300
testl %eax, %eax
je 0x2a378
movq %r15, %rdi
callq 0xb230
movq %rax, %r15
jmp 0x2a389
movq (%rsp), %rdi
movq %r15, %rsi
callq 0x2abd8
movq %rax, %r15
incl %ebx
cmpq %r13, %r15
jne 0x2a353
testl %ebx, %ebx
jle 0x2a3b8
movq 0x8(%rsp), %rdi
testq %rdi, %rdi
je 0x2a3a9
movq 0x18(%rsp), %rsi
subq %rdi, %rsi
callq 0xb2f0
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x1219d9(%rip), %rdi    # 0x14bd98
leaq 0x121931(%rip), %rsi    # 0x14bcf7
leaq 0x12193a(%rip), %rcx    # 0x14bd07
movl $0x145, %edx            # imm = 0x145
callq 0xb200
leaq 0x121904(%rip), %rdi    # 0x14bce2
leaq 0x121912(%rip), %rsi    # 0x14bcf7
leaq 0x12191b(%rip), %rcx    # 0x14bd07
movl $0x12d, %edx            # imm = 0x12D
callq 0xb200
leaq 0x121982(%rip), %rdi    # 0x14bd7f
leaq 0x1218f3(%rip), %rsi    # 0x14bcf7
leaq 0x1218fc(%rip), %rcx    # 0x14bd07
movl $0x12e, %edx            # imm = 0x12E
callq 0xb200
jmp 0x2a435
movq %rax, %rbx
movq 0x20(%rsp), %rdi
testq %rdi, %rdi
je 0x2a438
movq 0x30(%rsp), %rsi
subq %rdi, %rsi
callq 0xb2f0
jmp 0x2a438
jmp 0x2a435
movq %rax, %rbx
movq 0x8(%rsp), %rdi
testq %rdi, %rdi
je 0x2a44f
movq 0x18(%rsp), %rsi
subq %rdi, %rsi
callq 0xb2f0
movq %rbx, %rdi
callq 0xb510
nop