// File: zheng-ji[P]lruCache/example.cpp
// Function: main
int main(int argc, char ** argv) 
{
    struct timeval tStart;
    gettimeofday(&tStart, NULL);

    srand(time(NULL));

    std::thread threads[50];

    for (auto i = 0; i < 50; i++) 
    {
        threads[i] = std::thread(TestCacheUpdateThread);
    }

    for (auto & th : threads) 
    {
        th.join();
    }

    struct timeval tEnd;
    gettimeofday(&tEnd, NULL);
    std::cout << "cost" << 1000*(tEnd.tv_sec-tStart.tv_sec) + (tEnd.tv_usec-tStart.tv_usec)/1000 << " ms" << std::endl;

    return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x260, %rsp            # imm = 0x260
movl $0x0, -0x4(%rbp)
movl %edi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
leaq -0x20(%rbp), %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x21b0
xorl %eax, %eax
movl %eax, %edi
callq 0x2110
movl %eax, %edi
callq 0x2130
leaq -0x1b0(%rbp), %rax
movq %rax, %rcx
addq $0x190, %rcx            # imm = 0x190
movq %rcx, -0x210(%rbp)
movq %rax, -0x208(%rbp)
movq -0x208(%rbp), %rdi
movq %rdi, -0x218(%rbp)
callq 0x2e90
movq -0x218(%rbp), %rax
movq -0x210(%rbp), %rcx
addq $0x8, %rax
cmpq %rcx, %rax
movq %rax, -0x208(%rbp)
jne 0x2575
movl $0x0, -0x1b4(%rbp)
cmpl $0x32, -0x1b4(%rbp)
jge 0x2642
leaq -0x164(%rip), %rsi      # 0x2460
leaq -0x1c0(%rbp), %rdi
callq 0x2eb0
jmp 0x25d2
movslq -0x1b4(%rbp), %rax
leaq -0x1b0(%rbp), %rdi
shlq $0x3, %rax
addq %rax, %rdi
leaq -0x1c0(%rbp), %rsi
callq 0x2f60
leaq -0x1c0(%rbp), %rdi
callq 0x2fa0
movl -0x1b4(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1b4(%rbp)
jmp 0x25b0
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x1c8(%rbp)
movl %eax, -0x1cc(%rbp)
leaq -0x1b0(%rbp), %rax
movq %rax, -0x228(%rbp)
addq $0x190, %rax            # imm = 0x190
movq %rax, -0x220(%rbp)
jmp 0x27c9
leaq -0x1b0(%rbp), %rax
movq %rax, -0x1d8(%rbp)
movq -0x1d8(%rbp), %rax
movq %rax, -0x1e0(%rbp)
movq -0x1d8(%rbp), %rax
addq $0x190, %rax            # imm = 0x190
movq %rax, -0x1e8(%rbp)
movq -0x1e0(%rbp), %rax
cmpq -0x1e8(%rbp), %rax
je 0x26b4
movq -0x1e0(%rbp), %rax
movq %rax, -0x1f0(%rbp)
movq -0x1f0(%rbp), %rdi
callq 0x21e0
jmp 0x269e
jmp 0x26a0
movq -0x1e0(%rbp), %rax
addq $0x8, %rax
movq %rax, -0x1e0(%rbp)
jmp 0x2672
xorl %eax, %eax
movl %eax, %esi
leaq -0x200(%rbp), %rdi
callq 0x21b0
movq 0x790d(%rip), %rdi      # 0x9fd8
leaq 0x394e(%rip), %rsi      # 0x6020
callq 0x2140
movq %rax, -0x230(%rbp)
jmp 0x26e0
movq -0x230(%rbp), %rdi
movq -0x200(%rbp), %rdx
movq -0x1f8(%rbp), %rax
movq -0x20(%rbp), %rsi
movq -0x18(%rbp), %rcx
subq %rsi, %rdx
imulq $0x3e8, %rdx, %rsi      # imm = 0x3E8
subq %rcx, %rax
movabsq $0x20c49ba5e353f7cf, %rcx # imm = 0x20C49BA5E353F7CF
imulq %rcx
movq %rdx, %rax
movq %rax, %rdx
shrq $0x3f, %rdx
sarq $0x7, %rax
addq %rdx, %rax
addq %rax, %rsi
callq 0x2220
movq %rax, -0x238(%rbp)
jmp 0x2739
movq -0x238(%rbp), %rdi
leaq 0x38de(%rip), %rsi      # 0x6025
callq 0x2140
movq %rax, -0x240(%rbp)
jmp 0x2755
movq -0x240(%rbp), %rdi
movq 0x785d(%rip), %rsi      # 0x9fc0
callq 0x2160
jmp 0x276a
movl $0x0, -0x4(%rbp)
leaq -0x1b0(%rbp), %rax
movq %rax, -0x250(%rbp)
addq $0x190, %rax            # imm = 0x190
movq %rax, -0x248(%rbp)
movq -0x248(%rbp), %rdi
addq $-0x8, %rdi
movq %rdi, -0x258(%rbp)
callq 0x2fa0
movq -0x250(%rbp), %rcx
movq -0x258(%rbp), %rax
cmpq %rcx, %rax
movq %rax, -0x248(%rbp)
jne 0x278c
movl -0x4(%rbp), %eax
addq $0x260, %rsp            # imm = 0x260
popq %rbp
retq
movq -0x220(%rbp), %rdi
addq $-0x8, %rdi
movq %rdi, -0x260(%rbp)
callq 0x2fa0
movq -0x228(%rbp), %rcx
movq -0x260(%rbp), %rax
cmpq %rcx, %rax
movq %rax, -0x220(%rbp)
jne 0x27c9
jmp 0x27fc
movq -0x1c8(%rbp), %rdi
callq 0x2200
nopl (%rax,%rax)