// File: /workspace/github_cpp_makefile_star2_O1/CMU-SAFARI[P]ramulator/src/Processor.cpp
// Function: ramulator::Processor::Processor(ramulator::Config const&, std::vector<char const*, std::allocator<char const*>>, std::function<bool (ramulator::Request)>, ramulator::MemoryBase&)
Processor::Processor(const Config& configs,
    vector<const char*> trace_list,
    function<bool(Request)> send_memory,
    MemoryBase& memory)
    : ipcs(trace_list.size(), -1),
    early_exit(configs.is_early_exit()),
    no_core_caches(!configs.has_core_caches()),
    no_shared_cache(!configs.has_l3_cache()),
    cachesys(new CacheSystem(configs, send_memory)),
    llc(l3_size, l3_assoc, l3_blocksz,
         mshr_per_bank * trace_list.size(),
         Cache::Level::L3, cachesys) {

  assert(cachesys != nullptr);
  int tracenum = trace_list.size();
  assert(tracenum > 0);
  printf("tracenum: %d\n", tracenum);
  for (int i = 0 ; i < tracenum ; ++i) {
    printf("trace_list[%d]: %s\n", i, trace_list[i]);
  }
  if (no_shared_cache) {
    for (int i = 0 ; i < tracenum ; ++i) {
      cores.emplace_back(new Core(
          configs, i, trace_list[i], send_memory, nullptr,
          cachesys, memory));
    }
  } else {
    for (int i = 0 ; i < tracenum ; ++i) {
      cores.emplace_back(new Core(configs, i, trace_list[i],
          std::bind(&Cache::send, &llc, std::placeholders::_1),
          &llc, cachesys, memory));
    }
  }
  for (int i = 0 ; i < tracenum ; ++i) {
    cores[i]->callback = std::bind(&Processor::receive, this,
        placeholders::_1);
  }

  // regStats
  cpu_cycles.name("cpu_cycles")
            .desc("cpu cycle number")
            .precision(0)
            ;
  cpu_cycles = 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x148, %rsp            # imm = 0x148
movq %r8, 0x48(%rsp)
movq %rcx, 0x38(%rsp)
movq %rdx, %r13
movq %rsi, %r15
movq %rdi, %rbx
xorps %xmm0, %xmm0
movups %xmm0, (%rdi)
movq $0x0, 0x10(%rdi)
leaq 0x18(%rdi), %r14
movq 0x8(%rdx), %rsi
subq (%rdx), %rsi
sarq $0x3, %rsi
movabsq $-0x4010000000000000, %rax # imm = 0xBFF0000000000000
leaq 0x58(%rsp), %rdx
movq %rax, (%rdx)
leaq 0xf(%rsp), %rcx
movq %r14, %rdi
callq 0x1317ca
movq $0x0, 0x30(%rbx)
movq %r15, %rdi
callq 0x2ba52
movb %al, 0x38(%rbx)
movq %r15, %rdi
callq 0x13184c
xorb $0x1, %al
movb %al, 0x39(%rbx)
movq %r15, %rdi
callq 0x131958
xorb $0x1, %al
movb %al, 0x3a(%rbx)
movaps 0x2ec30(%rip), %xmm0    # 0x15da40
movups %xmm0, 0x3c(%rbx)
movl $0x60, %edi
callq 0xb2e0
movq %rax, %r12
leaq 0x108(%rsp), %rdi
movq 0x38(%rsp), %rsi
callq 0x131a64
movb $0x1, %bpl
leaq 0x108(%rsp), %rdx
movq %r12, %rdi
movq %r15, 0x40(%rsp)
movq %r15, %rsi
callq 0x131aca
movq %r12, 0x50(%rbx)
leaq 0x58(%rbx), %r15
xorl %ebp, %ebp
movq %r15, %rdi
movq %r12, %rsi
callq 0x1320e2
movq 0x118(%rsp), %rax
testq %rax, %rax
je 0x12ee82
leaq 0x108(%rsp), %rdi
movq %rdi, %rsi
movl $0x3, %edx
callq *%rax
leaq 0x60(%rbx), %rdi
movl 0x3c(%rbx), %esi
movl 0x40(%rbx), %edx
movl 0x44(%rbx), %ecx
movq 0x8(%r13), %r8
subq (%r13), %r8
shrq $0x3, %r8
imull 0x48(%rbx), %r8d
movq 0x50(%rbx), %rax
movq %rax, 0xb0(%rsp)
movq 0x58(%rbx), %rax
movq %rax, 0xb8(%rsp)
testq %rax, %rax
je 0x12eed3
movq 0x750cc(%rip), %r9      # 0x1a3f90
cmpb $0x0, (%r9)
je 0x12eecf
incl 0x8(%rax)
jmp 0x12eed3
lock
incl 0x8(%rax)
subq $0x8, %rsp
leaq 0xb8(%rsp), %rax
movq %rdi, 0x38(%rsp)
movl $0x2, %r9d
pushq %rax
callq 0x105bcc
addq $0x10, %rsp
movq 0xb8(%rsp), %rdi
testq %rdi, %rdi
je 0x12ef06
callq 0x2c468
leaq 0x750(%rbx), %rdi
movq %rdi, 0x20(%rsp)
callq 0x21be2
leaq 0x721da(%rip), %rax     # 0x1a10f8
movq %rax, 0x750(%rbx)
xorl %eax, %eax
movq %rax, 0x7c0(%rbx)
leaq 0x7d8(%rbx), %rcx
movq %rcx, 0x7c8(%rbx)
movq %rax, 0x7d0(%rbx)
movb $0x0, 0x7d8(%rbx)
cmpq %rax, 0x50(%rbx)
je 0x12f303
movq %r15, 0x10(%rsp)
movq %r14, 0x18(%rsp)
movq 0x8(%r13), %r14
subq (%r13), %r14
shrq $0x3, %r14
testl %r14d, %r14d
jle 0x12f322
leaq 0x2ebc7(%rip), %rdi     # 0x15db41
movl %r14d, %esi
xorl %eax, %eax
callq 0xb060
movq %r14, 0x28(%rsp)
movl %r14d, %ebp
andl $0x7fffffff, %ebp       # imm = 0x7FFFFFFF
leaq 0x2ebb6(%rip), %r15     # 0x15db4f
xorl %r12d, %r12d
movq (%r13), %rax
movq (%rax,%r12,8), %rdx
movq %r15, %rdi
movl %r12d, %esi
xorl %eax, %eax
callq 0xb060
incq %r12
cmpq %r12, %rbp
jne 0x12ef9c
movq %r13, 0x50(%rsp)
cmpb $0x0, 0x3a(%rbx)
je 0x12f0bf
movq 0x28(%rsp), %rax
andl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
movq %rax, 0xc0(%rsp)
xorl %ebp, %ebp
leaq 0x128(%rsp), %r13
movl $0x5c8, %edi            # imm = 0x5C8
callq 0xb2e0
movq %rax, %r12
movq 0x50(%rsp), %rax
movq (%rax), %rax
movq (%rax,%rbp,8), %r15
movq %r13, %rdi
movq 0x38(%rsp), %rsi
callq 0x131a64
movq 0x50(%rbx), %rax
movq %rax, 0xa0(%rsp)
movq 0x58(%rbx), %rax
movq %rax, 0xa8(%rsp)
testq %rax, %rax
je 0x12f03c
movq 0x74f62(%rip), %rcx     # 0x1a3f90
cmpb $0x0, (%rcx)
je 0x12f038
incl 0x8(%rax)
jmp 0x12f03c
lock
incl 0x8(%rax)
movb $0x1, %r14b
movq %r12, %rdi
movq 0x40(%rsp), %rsi
movl %ebp, %edx
movq %r15, %rcx
movq %r13, %r8
xorl %r9d, %r9d
pushq 0x48(%rsp)
leaq 0xa8(%rsp), %rax
pushq %rax
callq 0x12fff8
addq $0x10, %rsp
movq %r12, 0x58(%rsp)
xorl %r14d, %r14d
movq %rbx, %rdi
leaq 0x58(%rsp), %rsi
callq 0x131bb8
movq 0xa8(%rsp), %rdi
testq %rdi, %rdi
je 0x12f08f
callq 0x2c468
movq 0x138(%rsp), %rax
testq %rax, %rax
je 0x12f0a9
movq %r13, %rdi
movq %r13, %rsi
movl $0x3, %edx
callq *%rax
incq %rbp
cmpq %rbp, 0xc0(%rsp)
jne 0x12efe4
jmp 0x12f1e0
xorl %r13d, %r13d
movl $0x5c8, %edi            # imm = 0x5C8
callq 0xb2e0
movq %rax, %r12
movq 0x50(%rsp), %rax
movq (%rax), %rax
movq (%rax,%r13,8), %r15
xorps %xmm0, %xmm0
movaps %xmm0, 0x80(%rsp)
movaps %xmm0, 0x70(%rsp)
movl $0x18, %edi
callq 0xb2e0
leaq -0x28012(%rip), %rcx    # 0x1070ea
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movq 0x30(%rsp), %r9
movq %r9, 0x10(%rax)
movq %rax, 0x70(%rsp)
leaq 0x3240(%rip), %rax      # 0x13235c
movq %rax, 0x88(%rsp)
leaq 0x3241(%rip), %rax      # 0x13236c
movq %rax, 0x80(%rsp)
movq 0x50(%rbx), %rax
movq %rax, 0x90(%rsp)
movq 0x58(%rbx), %rax
movq %rax, 0x98(%rsp)
testq %rax, %rax
je 0x12f165
movq 0x74e39(%rip), %rcx     # 0x1a3f90
cmpb $0x0, (%rcx)
je 0x12f161
incl 0x8(%rax)
jmp 0x12f165
lock
incl 0x8(%rax)
movb $0x1, %r14b
movq %r12, %rdi
movq 0x40(%rsp), %rsi
movl %r13d, %edx
movq %r15, %rcx
leaq 0x70(%rsp), %r8
pushq 0x48(%rsp)
leaq 0x98(%rsp), %rax
pushq %rax
callq 0x12fff8
addq $0x10, %rsp
movq %r12, 0x58(%rsp)
xorl %r14d, %r14d
movq %rbx, %rdi
leaq 0x58(%rsp), %rsi
callq 0x131bb8
movq 0x98(%rsp), %rdi
testq %rdi, %rdi
je 0x12f1b8
callq 0x2c468
movq 0x80(%rsp), %rax
testq %rax, %rax
je 0x12f1d4
leaq 0x70(%rsp), %rdi
movq %rdi, %rsi
movl $0x3, %edx
callq *%rax
incq %r13
cmpq %r13, %rbp
jne 0x12f0c2
movq 0x28(%rsp), %rax
cmpl $0x2, %eax
movl $0x1, %r15d
cmovgel %eax, %r15d
xorl %r12d, %r12d
leaq 0x318(%rip), %r13       # 0x12f514
leaq 0x58(%rsp), %r14
movq %r13, 0x58(%rsp)
movq $0x0, 0x60(%rsp)
movq %rbx, 0x68(%rsp)
movq (%rbx), %rax
movq (%rax,%r12,8), %rdi
addq $0x38, %rdi
movq %r14, %rsi
callq 0x131be8
incq %r12
cmpq %r12, %r15
jne 0x12f201
leaq 0xf8(%rsp), %r15
movq %r15, -0x10(%r15)
leaq 0x2e921(%rip), %rsi     # 0x15db63
leaq 0x2e924(%rip), %rdx     # 0x15db6d
leaq 0xe8(%rsp), %rdi
callq 0x17586
leaq 0xe8(%rsp), %rsi
movq 0x20(%rsp), %rdi
callq 0x2386a
movq %rax, %r14
leaq 0xd8(%rsp), %r12
movq %r12, -0x10(%r12)
leaq 0x2e8ef(%rip), %rsi     # 0x15db6e
leaq 0x2e8f8(%rip), %rdx     # 0x15db7e
leaq 0xc8(%rsp), %rdi
callq 0x17586
leaq 0x28(%r14), %rdi
leaq 0xc8(%rsp), %rsi
callq 0xb1c0
movl $0x0, 0x48(%r14)
movq 0xc8(%rsp), %rdi
cmpq %r12, %rdi
je 0x12f2c9
movq 0xd8(%rsp), %rsi
incq %rsi
callq 0xb2f0
movq 0xe8(%rsp), %rdi
cmpq %r15, %rdi
je 0x12f2e6
movq 0xf8(%rsp), %rsi
incq %rsi
callq 0xb2f0
movq $0x0, 0x7c0(%rbx)
addq $0x148, %rsp            # imm = 0x148
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x2e796(%rip), %rdi     # 0x15daa0
leaq 0x2e7a3(%rip), %rsi     # 0x15dab4
leaq 0x2e7ae(%rip), %rcx     # 0x15dac6
movl $0x14, %edx
callq 0xb200
leaq 0x2e80b(%rip), %rdi     # 0x15db34
leaq 0x2e784(%rip), %rsi     # 0x15dab4
leaq 0x2e78f(%rip), %rcx     # 0x15dac6
movl $0x16, %edx
callq 0xb200
jmp 0x12f50b
movq %rax, %r13
movq 0xc8(%rsp), %rdi
cmpq %r12, %rdi
je 0x12f36d
movq 0xd8(%rsp), %rsi
incq %rsi
callq 0xb2f0
jmp 0x12f36d
jmp 0x12f36a
movq %rax, %r13
movq 0xe8(%rsp), %rdi
cmpq %r15, %rdi
je 0x12f4bc
movq 0xf8(%rsp), %rsi
incq %rsi
jmp 0x12f4b7
jmp 0x12f431
movq %rax, %r13
jmp 0x12f4d0
movq %rax, %r13
movq 0xb8(%rsp), %rdi
testq %rdi, %rdi
je 0x12f4da
callq 0x2c468
jmp 0x12f4da
movq %rax, %r13
movb $0x1, %bpl
jmp 0x12f3eb
movq %rax, %r13
jmp 0x12f4fb
movq %rax, %r13
movq 0x118(%rsp), %rax
testq %rax, %rax
je 0x12f3eb
leaq 0x108(%rsp), %rdi
movq %rdi, %rsi
movl $0x3, %edx
callq *%rax
testb %bpl, %bpl
je 0x12f4e7
movl $0x60, %esi
movq %r12, %rdi
callq 0xb2f0
jmp 0x12f4e7
jmp 0x12f50b
movq %rax, %r13
jmp 0x12f4e7
jmp 0x12f50b
jmp 0x12f50b
jmp 0x12f431
jmp 0x12f431
movq %rax, %r13
movb $0x1, %r14b
jmp 0x12f46a
movq %rax, %r13
movb $0x1, %r14b
jmp 0x12f4aa
movq %rax, %r13
jmp 0x12f4bc
movq %rax, %r13
movq 0x98(%rsp), %rdi
testq %rdi, %rdi
je 0x12f44e
callq 0x2c468
movq 0x80(%rsp), %rax
testq %rax, %rax
je 0x12f46a
leaq 0x70(%rsp), %rdi
movq %rdi, %rsi
movl $0x3, %edx
callq *%rax
testb %r14b, %r14b
je 0x12f4bc
jmp 0x12f4af
jmp 0x12f50b
movq %rax, %r13
movq 0xa8(%rsp), %rdi
testq %rdi, %rdi
je 0x12f48b
callq 0x2c468
movq 0x138(%rsp), %rax
testq %rax, %rax
je 0x12f4aa
leaq 0x128(%rsp), %rdi
movq %rdi, %rsi
movl $0x3, %edx
callq *%rax
testb %r14b, %r14b
je 0x12f4bc
movl $0x5c8, %esi            # imm = 0x5C8
movq %r12, %rdi
callq 0xb2f0
movq 0x18(%rsp), %r14
movq 0x10(%rsp), %r15
movq 0x20(%rsp), %rdi
callq 0x219b2
movq 0x30(%rsp), %rdi
callq 0x2be24
movq (%r15), %rdi
testq %rdi, %rdi
je 0x12f4e7
callq 0x2c468
movq (%r14), %rdi
testq %rdi, %rdi
je 0x12f4fb
movq 0x28(%rbx), %rsi
subq %rdi, %rsi
callq 0xb2f0
movq %rbx, %rdi
callq 0x2c39c
movq %r13, %rdi
callq 0xb510
movq %rax, %rdi
callq 0x1718f
nop