// File: /workspace/github_cpp_makefile_star2_O3/CMU-SAFARI[P]SMLA/src/Main.cpp
// Function: void run_cputrace<ramulator::WideIO>(ramulator::Config const&, ramulator::Memory<ramulator::WideIO, ramulator::Controller>&, std::vector<char const*, std::allocator<char const*>> const&)
void run_cputrace(const Config& configs, Memory<T, Controller>& memory, const std::vector<const char *>& files)
{
    int cpu_tick = configs.get_cpu_tick();
    int mem_tick = configs.get_mem_tick();
    auto send = bind(&Memory<T, Controller>::send, &memory, placeholders::_1);
    Processor proc(configs, files, send, memory);
    for (long i = 0; ; i++) {
        proc.tick();
        Stats::curTick++; // processor clock, global, for Statistics
        if (i % cpu_tick == (cpu_tick - 1))
            for (int j = 0; j < mem_tick; j++)
                memory.tick();
      if (configs.calc_weighted_speedup()) {
        if (proc.has_reached_limit()) {
          break;
        }
      } else {
        if (configs.is_early_exit()) {
          if (proc.finished())
              break;
        } else {
          if (proc.finished() && (memory.pending_requests() == 0))
              break;
        }
      }
    }
    // This a workaround for statistics set only initially lost in the end
    memory.finish();
    Stats::statlist.printall();
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x828, %rsp            # imm = 0x828
movq %rsi, %rbx
movq %rdi, %r13
movslq 0x3c(%rdi), %rax
movq %rax, 0x8(%rsp)
movl 0x40(%rdi), %r14d
leaq 0x18(%rsp), %rdi
movq %rdx, %rsi
callq 0x1a866
xorps %xmm0, %xmm0
movaps %xmm0, 0x40(%rsp)
movaps %xmm0, 0x30(%rsp)
movl $0x18, %edi
callq 0x52c0
movq $0x21, (%rax)
movq $0x0, 0x8(%rax)
movq %rbx, 0x10(%rax)
leaq 0x30(%rsp), %rcx
movq %rax, (%rcx)
leaq 0x9d94(%rip), %rax      # 0x1ab32
movq %rax, 0x18(%rcx)
leaq 0x9d99(%rip), %rax      # 0x1ab42
movq %rax, 0x10(%rcx)
leaq 0x58(%rsp), %rdi
leaq 0x18(%rsp), %rdx
movq %r13, %rsi
movq %rbx, %r8
callq 0x3e3f8
movq 0x40(%rsp), %rax
testq %rax, %rax
je 0x10ddb
leaq 0x30(%rsp), %rdi
movq %rdi, %rsi
movl $0x3, %edx
callq *%rax
movq 0x18(%rsp), %rdi
testq %rdi, %rdi
je 0x10df2
movq 0x28(%rsp), %rsi
subq %rdi, %rsi
callq 0x52d0
movq 0x8(%rsp), %rax
decl %eax
cltq
movq %rax, 0x10(%rsp)
xorl %r15d, %r15d
leaq 0x58(%rsp), %r12
movq %r12, %rdi
callq 0x3ec22
testl %r14d, %r14d
setle %cl
leaq 0x557cb(%rip), %rax     # 0x665e8
incq (%rax)
movq %r15, %rax
cqto
idivq 0x8(%rsp)
cmpq 0x10(%rsp), %rdx
setne %al
orb %cl, %al
movl %r14d, %ebp
jne 0x10e46
movq (%rbx), %rax
movq %rbx, %rdi
callq *0x18(%rax)
decl %ebp
jne 0x10e39
cmpq $0x0, 0x48(%r13)
je 0x10e57
movq %r12, %rdi
callq 0x3f48c
jmp 0x10e6b
movq %r13, %rdi
callq 0x1a8e6
testb %al, %al
je 0x10e74
movq %r12, %rdi
callq 0x3f2d6
testb %al, %al
jne 0x10e8d
incq %r15
jmp 0x10e08
movq %r12, %rdi
callq 0x3f2d6
testb %al, %al
je 0x10e6f
movq (%rbx), %rax
movq %rbx, %rdi
callq *0x28(%rax)
testl %eax, %eax
jne 0x10e6f
movq (%rbx), %rax
movq %rbx, %rdi
callq *0x30(%rax)
leaq 0x55533(%rip), %rdi     # 0x663d0
callq 0x1a9da
leaq 0x58(%rsp), %rdi
callq 0x1aa72
addq $0x828, %rsp            # imm = 0x828
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x10ede
movq %rax, %rbx
movq 0x40(%rsp), %rax
testq %rax, %rax
je 0x10ee9
leaq 0x30(%rsp), %rdi
movq %rdi, %rsi
movl $0x3, %edx
callq *%rax
jmp 0x10ee9
movq %rax, %rdi
callq 0x7cd9
movq %rax, %rbx
movq 0x18(%rsp), %rdi
testq %rdi, %rdi
je 0x10f13
movq 0x28(%rsp), %rsi
subq %rdi, %rsi
callq 0x52d0
jmp 0x10f13
jmp 0x10f06
jmp 0x10f06
movq %rax, %rbx
leaq 0x58(%rsp), %rdi
callq 0x1aa72
movq %rbx, %rdi
callq 0x54c0