// File: /workspace/github_cpp_makefile_star2_O3/ahupowerdns[P]mcounter/mcounter-multi.cc
// Function: main
int main(int argc, char **argv)
{
  cout<<sizeof(mca)<<endl;
  int num= argc > 1 ? atoi(argv[1]) : 1;
  bool unshared = argc > 2 ? argv[2]==std::string("unshared") : 1;
  std::thread progress(printWorker);
  progress.detach();

  vector<std::thread> threads;

  auto start = high_resolution_clock::now();
  for(int n=0; n < num; ++n)
    threads.emplace_back(unshared ? unsharedStructWorker: sharedStructWorker,
                         100000000);

  for(auto& t : threads)
    t.join();
                           
  auto finish = high_resolution_clock::now();
  auto msecs = duration_cast<milliseconds>(finish-start);
  cout<<msecs.count()<<" milliseconds"<<endl;
  cout << "Final: "<<myc.get().a << " / "<<mca.a<<", "<<mca.b<<endl;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movq %rsi, %r15
movl %edi, %ebp
movq 0x3a78(%rip), %rdi      # 0x5fd8
movl $0x10, %esi
callq 0x20d0
movq %rax, %rbx
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x2160
movsbl %al, %esi
movq %rbx, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x20e0
movl $0x1, %ebx
leaq -0x194(%rip), %r14      # 0x240c
cmpl $0x2, %ebp
jl 0x2612
movq 0x8(%r15), %rdi
callq 0x21f0
movl %eax, %ebx
cmpl $0x2, %ebp
je 0x2612
movq 0x10(%r15), %r14
leaq 0x20(%rsp), %r12
movq %r12, -0x10(%r12)
leaq 0x1a41(%rip), %rsi      # 0x400b
leaq 0x1a42(%rip), %rdx      # 0x4013
leaq 0x10(%rsp), %r15
movq %r15, %rdi
callq 0x2e5c
movq %r15, %rdi
movq %r14, %rsi
callq 0x2060
testl %eax, %eax
leaq -0x1e6(%rip), %rax      # 0x240c
leaq -0x1ae(%rip), %r14      # 0x244b
cmoveq %rax, %r14
movq (%r15), %rdi
cmpq %r12, %rdi
je 0x2612
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x2180
leaq -0x188(%rip), %rsi      # 0x2491
leaq 0x8(%rsp), %r15
movq %r15, %rdi
callq 0x2886
movq %r15, %rdi
callq 0x2220
xorps %xmm0, %xmm0
movaps %xmm0, 0x10(%rsp)
movq $0x0, 0x20(%rsp)
callq 0x2040
movq %rax, %r15
testl %ebx, %ebx
jle 0x266f
leaq 0x10(%rsp), %r12
leaq 0x4(%rsp), %r13
movl $0x5f5e100, 0x4(%rsp)   # imm = 0x5F5E100
movq %r12, %rdi
movq %r14, %rsi
movq %r13, %rdx
callq 0x28f0
decl %ebx
jne 0x2655
movq 0x10(%rsp), %rbx
movq 0x18(%rsp), %r14
cmpq %r14, %rbx
je 0x268c
movq %rbx, %rdi
callq 0x2210
addq $0x8, %rbx
jmp 0x2679
callq 0x2040
subq %r15, %rax
movabsq $0x431bde82d7b634db, %rcx # imm = 0x431BDE82D7B634DB
imulq %rcx
movq %rdx, %rsi
shrq $0x3f, %rsi
sarq $0x12, %rdx
addq %rdx, %rsi
movq 0x3922(%rip), %rdi      # 0x5fd8
callq 0x2150
movq %rax, %rbx
leaq 0x194f(%rip), %rsi      # 0x4014
movl $0xd, %edx
movq %rax, %rdi
callq 0x2190
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x2160
movsbl %al, %esi
movq %rbx, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x20e0
movq 0x38d8(%rip), %rdi      # 0x5fd8
leaq 0x191b(%rip), %rsi      # 0x4022
movl $0x7, %edx
callq 0x2190
leaq 0x3a38(%rip), %rdi      # 0x6150
callq 0x2814
movq 0x38b4(%rip), %rdi      # 0x5fd8
movq %rax, %rsi
callq 0x20d0
movq %rax, %rbx
leaq 0x18ce(%rip), %rsi      # 0x4004
movl $0x3, %edx
movq %rax, %rdi
callq 0x2190
movq 0x3a76(%rip), %rsi      # 0x61c0
movq %rbx, %rdi
callq 0x20d0
movq %rax, %rbx
leaq 0x18ac(%rip), %rsi      # 0x4008
movl $0x2, %edx
movq %rax, %rdi
callq 0x2190
movq 0x3a58(%rip), %rsi      # 0x61c8
movq %rbx, %rdi
callq 0x20d0
movq %rax, %rbx
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x2160
movsbl %al, %esi
movq %rbx, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x20e0
leaq 0x10(%rsp), %rdi
callq 0x2932
cmpq $0x0, 0x8(%rsp)
jne 0x27ed
xorl %eax, %eax
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
jmp 0x27dd
jmp 0x27d0
jmp 0x27d0
jmp 0x27d0
movq %rax, %rbx
leaq 0x10(%rsp), %rdi
callq 0x2932
cmpq $0x0, 0x8(%rsp)
jne 0x27ed
movq %rbx, %rdi
callq 0x2230
callq 0x2050