// File: /workspace/github_cpp_makefile_star2_O2/CMU-SAFARI[P]ramulator/src/Controller.h
// Function: ramulator::Controller<ramulator::DDR3>::issue_cmd(ramulator::DDR3::Command, std::vector<int, std::allocator<int>> const&)
void issue_cmd(typename T::Command cmd, const vector<int>& addr_vec)
    {
        cmd_issue_autoprecharge(cmd, addr_vec);
        assert(is_ready(cmd, addr_vec));
        channel->update(cmd, addr_vec.data(), clk);

        if(cmd == T::Command::PRE){
            if(rowtable->get_hits(addr_vec, true) == 0){
                useless_activates++;
            }
        }
 
        rowtable->update(cmd, addr_vec, clk);
        if (record_cmd_trace){
            // select rank
            auto& file = cmd_trace_files[addr_vec[1]];
            string& cmd_name = channel->spec->command_name[int(cmd)];
            file<<clk<<','<<cmd_name;
            // TODO bad coding here
            if (cmd_name == "PREA" || cmd_name == "REF")
                file<<endl;
            else{
                int bank_id = addr_vec[int(T::Level::Bank)];
                if (channel->spec->standard_name == "DDR4" || channel->spec->standard_name == "GDDR5")
                    bank_id += addr_vec[int(T::Level::Bank) - 1] * channel->spec->org_entry.count[int(T::Level::Bank)];
                file<<','<<bank_id<<endl;
            }
        }
        if (print_cmd_trace){
            printf("%5s %10ld:", channel->spec->command_name[int(cmd)].c_str(), clk);
            for (int lev = 0; lev < int(T::Level::MAX); lev++)
                printf(" %5d", addr_vec[lev]);
            printf("\n");
        }
    }

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x10, %rsp
movq %rdx, %rbx
movq %rdi, %r14
leaq 0xc(%rsp), %r15
movl %esi, (%r15)
movq %r15, %rsi
callq 0x2057e
movl (%r15), %esi
movq %r14, %rdi
movq %rbx, %rdx
callq 0x1bbb4
testb %al, %al
je 0x1fad5
movq 0x1090(%r14), %rcx
movq 0x1098(%r14), %rdi
movl 0xc(%rsp), %esi
movq (%rbx), %rdx
callq 0x2073c
cmpl $0x1, 0xc(%rsp)
jne 0x1f953
movq 0x10b0(%r14), %rdi
pushq $0x1
popq %rdx
movq %rbx, %rsi
callq 0x1b6ca
testl %eax, %eax
jne 0x1f953
movsd 0x788(%r14), %xmm0
addsd 0xb172e(%rip), %xmm0    # 0xd1078
movsd %xmm0, 0x788(%r14)
movq 0x1090(%r14), %rcx
movq 0x10b0(%r14), %rdi
movl 0xc(%rsp), %esi
movq %rbx, %rdx
callq 0x20774
cmpb $0x1, 0x11d8(%r14)
jne 0x1fa60
movq (%rbx), %rax
movslq 0x4(%rax), %r15
shlq $0x9, %r15
addq 0x11c0(%r14), %r15
movq 0x1090(%r14), %rsi
movq 0x1098(%r14), %rax
movslq 0xc(%rsp), %r12
shlq $0x5, %r12
addq 0x390(%rax), %r12
movq %r15, %rdi
callq 0xb2b0
pushq $0x2c
popq %rsi
movq %rax, %rdi
callq 0xb320
movq %rax, %rdi
movq %r12, %rsi
callq 0xb290
leaq 0xb30ff(%rip), %rsi     # 0xd2acf
movq %r12, %rdi
callq 0x110e2
testb %al, %al
jne 0x1fa58
leaq 0xc4904(%rip), %rsi     # 0xe42e7
movq %r12, %rdi
callq 0x110e2
testb %al, %al
jne 0x1fa58
movq (%rbx), %rax
movl 0x8(%rax), %ebp
leaq 0x116a2c(%rip), %rdi    # 0x136428
leaq 0xb19a1(%rip), %rsi     # 0xd13a4
callq 0x110e2
testb %al, %al
jne 0x1fa23
leaq 0x116a15(%rip), %rdi    # 0x136428
leaq 0xb198f(%rip), %rsi     # 0xd13a9
callq 0x110e2
testb %al, %al
je 0x1fa40
movq (%rbx), %rax
movq 0x1098(%r14), %rcx
movq 0x390(%rcx), %rcx
movl 0x2734(%rcx), %ecx
imull 0x4(%rax), %ecx
addl %ecx, %ebp
pushq $0x2c
popq %rsi
movq %r15, %rdi
callq 0xb320
movq %rax, %rdi
movl %ebp, %esi
callq 0xb4c0
movq %rax, %r15
movq %r15, %rdi
callq 0xb190
cmpb $0x1, 0x11d9(%r14)
jne 0x1fac8
movq 0x1090(%r14), %rdx
movq 0x1098(%r14), %rax
movq 0x390(%rax), %rax
movslq 0xc(%rsp), %rcx
shlq $0x5, %rcx
movq (%rax,%rcx), %rsi
leaq 0xb3041(%rip), %rdi     # 0xd2ad4
xorl %eax, %eax
callq 0xb050
leaq 0xb303e(%rip), %r14     # 0xd2adf
xorl %r15d, %r15d
cmpq $0x5, %r15
je 0x1fac0
movq (%rbx), %rax
movl (%rax,%r15,4), %esi
movq %r14, %rdi
xorl %eax, %eax
callq 0xb050
incq %r15
jmp 0x1faa4
pushq $0xa
popq %rdi
callq 0xb380
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
leaq 0xb2f53(%rip), %rdi     # 0xd2a2f
leaq 0xb2f64(%rip), %rsi     # 0xd2a47
leaq 0xb2f6e(%rip), %rcx     # 0xd2a58
movl $0x259, %edx            # imm = 0x259
callq 0xb210