// File: /workspace/github_cpp_makefile_star2_O3/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, 0x50(%rsp)
movq %rcx, 0x38(%rsp)
movq %rdx, %r13
movq %rsi, %r14
movq %rdi, %rbx
xorps %xmm0, %xmm0
movups %xmm0, (%rdi)
movq $0x0, 0x10(%rdi)
leaq 0x18(%rdi), %r12
movq 0x8(%rdx), %rsi
subq (%rdx), %rsi
sarq $0x3, %rsi
movabsq $-0x4010000000000000, %rax # imm = 0xBFF0000000000000
leaq 0x58(%rsp), %rdx
movq %rax, (%rdx)
leaq 0x17(%rsp), %rcx
movq %r12, %rdi
callq 0x12e5c4
movq $0x0, 0x30(%rbx)
movq %r14, %rdi
callq 0x2bc5a
movb %al, 0x38(%rbx)
movq %r14, %rdi
callq 0x12e6e6
xorb $0x1, %al
movb %al, 0x39(%rbx)
movq %r14, %rdi
callq 0x12e7f2
xorb $0x1, %al
movb %al, 0x3a(%rbx)
movaps 0x2edf8(%rip), %xmm0    # 0x15aaa0
movups %xmm0, 0x3c(%rbx)
movl $0x60, %edi
callq 0xb2e0
movq %rax, %r15
leaq 0x128(%rsp), %rdi
movq 0x38(%rsp), %rsi
callq 0x12e8fe
movb $0x1, %bpl
leaq 0x128(%rsp), %rdx
movq %r15, %rdi
movq %r14, %rsi
callq 0x12e95c
movq %r15, 0x50(%rbx)
leaq 0x58(%rbx), %rdi
xorl %ebp, %ebp
movq %rdi, 0x8(%rsp)
movq %r15, %rsi
callq 0x12f004
movq 0x138(%rsp), %rax
testq %rax, %rax
je 0x12bd17
leaq 0x128(%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, 0xb8(%rsp)
movq 0x58(%rbx), %rax
movq %rax, 0xc0(%rsp)
testq %rax, %rax
je 0x12bd68
movq 0x74237(%rip), %r9      # 0x19ff90
cmpb $0x0, (%r9)
je 0x12bd64
incl 0x8(%rax)
jmp 0x12bd68
lock
incl 0x8(%rax)
subq $0x8, %rsp
leaq 0xc0(%rsp), %rax
movq %rdi, 0x38(%rsp)
movl $0x2, %r9d
pushq %rax
callq 0x103170
addq $0x10, %rsp
movq 0xc0(%rsp), %rdi
testq %rdi, %rdi
je 0x12bd9b
callq 0x2c668
leaq 0x750(%rbx), %rdi
movq %rdi, 0x28(%rsp)
callq 0x21b38
leaq 0x7137d(%rip), %rax     # 0x19d130
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 0x12c188
movq %r14, 0x48(%rsp)
movq %r12, 0x18(%rsp)
movq 0x8(%r13), %r14
subq (%r13), %r14
shrq $0x3, %r14
testl %r14d, %r14d
jle 0x12c1a7
leaq 0x2ed92(%rip), %rdi     # 0x15aba1
movl %r14d, %esi
xorl %eax, %eax
callq 0xb060
movq %r14, 0x20(%rsp)
andl $0x7fffffff, %r14d      # imm = 0x7FFFFFFF
leaq 0x2ed83(%rip), %r15     # 0x15abaf
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, %r14
jne 0x12be2f
cmpb $0x0, 0x3a(%rbx)
movq %r13, 0x40(%rsp)
je 0x12bf44
xorl %r15d, %r15d
movl $0x5c8, %edi            # imm = 0x5C8
callq 0xb2e0
movq %rax, %r12
movq (%r13), %rax
movq (%rax,%r15,8), %r13
leaq 0x108(%rsp), %rdi
movq 0x38(%rsp), %rsi
callq 0x12e8fe
movq 0x50(%rbx), %rax
movq %rax, 0xa8(%rsp)
movq 0x58(%rbx), %rax
movq %rax, 0xb0(%rsp)
testq %rax, %rax
je 0x12beb7
movq 0x740e7(%rip), %rcx     # 0x19ff90
cmpb $0x0, (%rcx)
je 0x12beb3
incl 0x8(%rax)
jmp 0x12beb7
lock
incl 0x8(%rax)
movb $0x1, %bpl
movq %r12, %rdi
movq 0x48(%rsp), %rsi
movl %r15d, %edx
movq %r13, %rcx
leaq 0x108(%rsp), %r8
xorl %r9d, %r9d
pushq 0x50(%rsp)
leaq 0xb0(%rsp), %rax
pushq %rax
callq 0x12ce0a
addq $0x10, %rsp
movq %r12, 0x58(%rsp)
xorl %ebp, %ebp
movq %rbx, %rdi
leaq 0x58(%rsp), %rsi
callq 0x12ea4a
movq 0xb0(%rsp), %rdi
testq %rdi, %rdi
movq 0x40(%rsp), %r13
je 0x12bf14
callq 0x2c668
movq 0x118(%rsp), %rax
testq %rax, %rax
je 0x12bf33
leaq 0x108(%rsp), %rdi
movq %rdi, %rsi
movl $0x3, %edx
callq *%rax
incq %r15
cmpq %r15, %r14
jne 0x12be5e
jmp 0x12c066
xorl %r12d, %r12d
movl $0x5c8, %edi            # imm = 0x5C8
callq 0xb2e0
movq %rax, %rbp
movq (%r13), %rax
movq (%rax,%r12,8), %r13
xorps %xmm0, %xmm0
movaps %xmm0, 0x80(%rsp)
movaps %xmm0, 0x70(%rsp)
movl $0x18, %edi
callq 0xb2e0
leaq -0x278ef(%rip), %rcx    # 0x10468e
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movq 0x30(%rsp), %r9
movq %r9, 0x10(%rax)
movq %rax, 0x70(%rsp)
leaq 0x32e7(%rip), %rax      # 0x12f284
movq %rax, 0x88(%rsp)
leaq 0x32e8(%rip), %rax      # 0x12f294
movq %rax, 0x80(%rsp)
movq 0x50(%rbx), %rax
movq %rax, 0x98(%rsp)
movq 0x58(%rbx), %rax
movq %rax, 0xa0(%rsp)
testq %rax, %rax
je 0x12bfe6
movq 0x73fb8(%rip), %rcx     # 0x19ff90
cmpb $0x0, (%rcx)
je 0x12bfe2
incl 0x8(%rax)
jmp 0x12bfe6
lock
incl 0x8(%rax)
movb $0x1, %r15b
movq %rbp, %rdi
movq 0x48(%rsp), %rsi
movl %r12d, %edx
movq %r13, %rcx
leaq 0x70(%rsp), %r8
pushq 0x50(%rsp)
leaq 0xa0(%rsp), %rax
pushq %rax
callq 0x12ce0a
addq $0x10, %rsp
movq %rbp, 0x58(%rsp)
xorl %r15d, %r15d
movq %rbx, %rdi
leaq 0x58(%rsp), %rsi
callq 0x12ea4a
movq 0xa0(%rsp), %rdi
testq %rdi, %rdi
movq 0x40(%rsp), %r13
je 0x12c03e
callq 0x2c668
movq 0x80(%rsp), %rax
testq %rax, %rax
je 0x12c05a
leaq 0x70(%rsp), %rdi
movq %rdi, %rsi
movl $0x3, %edx
callq *%rax
incq %r12
cmpq %r12, %r14
jne 0x12bf47
movq 0x20(%rsp), %rax
andl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
movq %rax, 0x20(%rsp)
xorl %r15d, %r15d
leaq 0x323(%rip), %r12       # 0x12c3a2
leaq 0x58(%rsp), %r14
movq %r12, 0x58(%rsp)
movq $0x0, 0x60(%rsp)
movq %rbx, 0x68(%rsp)
movq (%rbx), %rax
movq (%rax,%r15,8), %rdi
addq $0x38, %rdi
movq %r14, %rsi
callq 0x12ea82
incq %r15
cmpq %r15, 0x20(%rsp)
jne 0x12c084
leaq 0xf8(%rsp), %r15
movq %r15, -0x10(%r15)
leaq 0x2eafc(%rip), %rsi     # 0x15abc3
leaq 0x2eaff(%rip), %rdx     # 0x15abcd
leaq 0xe8(%rsp), %rdi
callq 0x175a0
leaq 0xe8(%rsp), %rsi
movq 0x28(%rsp), %rdi
callq 0x23884
movq %rax, %r14
leaq 0xd8(%rsp), %r12
movq %r12, -0x10(%r12)
leaq 0x2eaca(%rip), %rsi     # 0x15abce
leaq 0x2ead3(%rip), %rdx     # 0x15abde
leaq 0xc8(%rsp), %rdi
callq 0x175a0
leaq 0x28(%r14), %rdi
leaq 0xc8(%rsp), %rsi
callq 0xb1c0
movl $0x0, 0x48(%r14)
movq 0xc8(%rsp), %rdi
cmpq %r12, %rdi
je 0x12c14e
movq 0xd8(%rsp), %rsi
incq %rsi
callq 0xb2f0
movq 0xe8(%rsp), %rdi
cmpq %r15, %rdi
je 0x12c16b
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 0x2e971(%rip), %rdi     # 0x15ab00
leaq 0x2e97e(%rip), %rsi     # 0x15ab14
leaq 0x2e989(%rip), %rcx     # 0x15ab26
movl $0x14, %edx
callq 0xb200
leaq 0x2e9e6(%rip), %rdi     # 0x15ab94
leaq 0x2e95f(%rip), %rsi     # 0x15ab14
leaq 0x2e96a(%rip), %rcx     # 0x15ab26
movl $0x16, %edx
callq 0xb200
jmp 0x12c399
movq %rax, %r14
movq 0xc8(%rsp), %rdi
cmpq %r12, %rdi
je 0x12c1f2
movq 0xd8(%rsp), %rsi
incq %rsi
callq 0xb2f0
jmp 0x12c1f2
jmp 0x12c1ef
movq %rax, %r14
movq 0xe8(%rsp), %rdi
cmpq %r15, %rdi
je 0x12c349
movq 0xf8(%rsp), %rsi
incq %rsi
jmp 0x12c344
jmp 0x12c2b6
movq %rax, %r14
movq 0x8(%rsp), %r15
jmp 0x12c35d
movq %rax, %r14
movq 0xc0(%rsp), %rdi
testq %rdi, %rdi
je 0x12c23a
callq 0x2c668
movq 0x8(%rsp), %r15
jmp 0x12c367
movq %rax, %r14
jmp 0x12c27c
movq %rax, %r14
jmp 0x12c389
movq %rax, %r14
movq 0x138(%rsp), %rax
testq %rax, %rax
je 0x12c273
leaq 0x128(%rsp), %rdi
movq %rdi, %rsi
movl $0x3, %edx
callq *%rax
testb %bpl, %bpl
je 0x12c374
movl $0x60, %esi
movq %r15, %rdi
callq 0xb2f0
jmp 0x12c374
jmp 0x12c399
movq %rax, %r14
jmp 0x12c374
jmp 0x12c399
jmp 0x12c399
jmp 0x12c2b6
jmp 0x12c2b6
movq %rax, %r14
jmp 0x12c2f4
movq %rax, %r14
jmp 0x12c33c
movq %rax, %r14
jmp 0x12c349
movq %rax, %r14
movq 0xa0(%rsp), %rdi
testq %rdi, %rdi
je 0x12c2d3
callq 0x2c668
movq 0x80(%rsp), %rax
testq %rax, %rax
je 0x12c2ef
leaq 0x70(%rsp), %rdi
movq %rdi, %rsi
movl $0x3, %edx
callq *%rax
testb %r15b, %r15b
je 0x12c349
movl $0x5c8, %esi            # imm = 0x5C8
movq %rbp, %rdi
jmp 0x12c344
jmp 0x12c399
movq %rax, %r14
movq 0xb0(%rsp), %rdi
testq %rdi, %rdi
je 0x12c318
callq 0x2c668
movq 0x118(%rsp), %rax
testq %rax, %rax
je 0x12c337
leaq 0x108(%rsp), %rdi
movq %rdi, %rsi
movl $0x3, %edx
callq *%rax
testb %bpl, %bpl
je 0x12c349
movl $0x5c8, %esi            # imm = 0x5C8
movq %r12, %rdi
callq 0xb2f0
movq 0x18(%rsp), %r12
movq 0x8(%rsp), %r15
movq 0x28(%rsp), %rdi
callq 0x2191a
movq 0x30(%rsp), %rdi
callq 0x2c01e
movq (%r15), %rdi
testq %rdi, %rdi
je 0x12c374
callq 0x2c668
movq (%r12), %rdi
testq %rdi, %rdi
je 0x12c389
movq 0x28(%rbx), %rsi
subq %rdi, %rsi
callq 0xb2f0
movq %rbx, %rdi
callq 0x2c596
movq %r14, %rdi
callq 0xb510
movq %rax, %rdi
callq 0x171a3
nop