// File: /workspace/github_cpp_makefile_star2_O1/zhjw1998[P]Merkle-Tree/src/main.cpp
// Function: TimeCal(int)
void TimeCal(int nodenum){
    std::cout << std::setw(24) << nodenum;
    clock_t start, finish;
    double duration1, duration2;
    std::vector<std::string> leaves;
    for(int i = 0; i < nodenum; i++)
        leaves.push_back(hash_sha256(std::to_string(i)));

    MerkleTree* hashTree = new MerkleTree(leaves);

    start = clock();
    for(int i = 0; i < nodenum / 100; i++){
        hashTree->containsNode(hash_sha256(std::to_string(i * 100)));
    }
    finish = clock();
    duration1 = (double)(finish - start) / CLOCKS_PER_SEC;
    std::cout << std::setw(24) << (10000 * duration1) / nodenum;

    start = clock();
    for(int i = 0; i < nodenum / 100; i++){
        hashTree->Find(hash_sha256(std::to_string(i * 100)));
    }
    finish = clock();
    duration2 = (double)(finish - start) / CLOCKS_PER_SEC;
    std::cout << std::setw(24) << (10000 * duration2) / nodenum;

    std::cout << std::setw(24) << duration1 / duration2 << std::endl;
    //析构整个树
    delete hashTree;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xc8, %rsp
movl %edi, %ebx
movq 0x8b92(%rip), %rdi      # 0xafd8
movq (%rdi), %rax
movq -0x18(%rax), %rax
movq $0x18, 0x10(%rdi,%rax)
movl %ebx, %esi
callq 0x2230
xorpd %xmm0, %xmm0
movapd %xmm0, 0xa0(%rsp)
movq $0x0, 0xb0(%rsp)
movl %ebx, 0x8(%rsp)
testl %ebx, %ebx
jle 0x2583
leaq 0x90(%rsp), %rbp
xorl %r14d, %r14d
leaq 0x18(%rsp), %r12
leaq 0xa0(%rsp), %r13
movl $0xd1b71759, %r15d      # imm = 0xD1B71759
movl $0x1, %ebx
cmpl $0xa, %r14d
jb 0x24e8
movl $0x4, %ebx
movl %r14d, %eax
cmpl $0x63, %eax
jbe 0x24e1
cmpl $0x3e7, %eax            # imm = 0x3E7
jbe 0x24e6
cmpl $0x2710, %eax           # imm = 0x2710
jb 0x24e8
movl %eax, %ecx
imulq %r15, %rcx
shrq $0x2d, %rcx
addl $0x4, %ebx
cmpl $0x1869f, %eax          # imm = 0x1869F
movl %ecx, %eax
ja 0x24b3
addl $-0x3, %ebx
jmp 0x24e8
addl $-0x2, %ebx
jmp 0x24e8
decl %ebx
movl %ebx, %esi
movq %rbp, 0x80(%rsp)
leaq 0x80(%rsp), %rdi
movl $0x2d, %edx
callq 0x21a0
movq 0x80(%rsp), %rdi
movl %ebx, %esi
movl %r14d, %edx
callq 0x4565
movq 0x80(%rsp), %rsi
movq 0x88(%rsp), %rdx
addq %rsi, %rdx
movq %r12, %rdi
callq 0x3a4e
movq %r13, %rdi
movq %r12, %rsi
callq 0x46a2
movq 0x18(%rsp), %rdi
leaq 0x28(%rsp), %rax
cmpq %rax, %rdi
je 0x2558
movq 0x28(%rsp), %rsi
incq %rsi
callq 0x2170
movq 0x80(%rsp), %rdi
cmpq %rbp, %rdi
je 0x2575
movq 0x90(%rsp), %rsi
incq %rsi
callq 0x2170
incl %r14d
cmpl 0x8(%rsp), %r14d
jne 0x24a0
movl $0x10, %edi
callq 0x2160
movq %rax, 0x10(%rsp)
leaq 0xa0(%rsp), %rsi
movq 0x10(%rsp), %rdi
callq 0x4a94
callq 0x20e0
movq %rax, 0x38(%rsp)
movl 0x8(%rsp), %ecx
movslq %ecx, %rax
imulq $0x51eb851f, %rax, %r12 # imm = 0x51EB851F
movq %r12, %rax
shrq $0x3f, %rax
sarq $0x25, %r12
addl %eax, %r12d
cmpl $0x64, %ecx
jl 0x26bd
xorl %r14d, %r14d
leaq 0x18(%rsp), %r13
movl $0xd1b71759, %ebp       # imm = 0xD1B71759
imull $0x64, %r14d, %r15d
testl %r14d, %r14d
je 0x261f
movl $0x4, %ebx
movl %r15d, %eax
cmpl $0x63, %eax
jbe 0x2626
cmpl $0x3e7, %eax            # imm = 0x3E7
jbe 0x262b
cmpl $0x2710, %eax           # imm = 0x2710
jb 0x262d
movl %eax, %ecx
imulq %rbp, %rcx
shrq $0x2d, %rcx
addl $0x4, %ebx
cmpl $0x1869f, %eax          # imm = 0x1869F
movl %ecx, %eax
ja 0x25f1
addl $-0x3, %ebx
jmp 0x262d
movl $0x1, %ebx
jmp 0x262d
addl $-0x2, %ebx
jmp 0x262d
decl %ebx
movl %ebx, %esi
leaq 0x70(%rsp), %rax
movq %rax, 0x60(%rsp)
leaq 0x60(%rsp), %rdi
movl $0x2d, %edx
callq 0x21a0
movq 0x60(%rsp), %rdi
movl %ebx, %esi
movl %r15d, %edx
callq 0x4565
movq 0x60(%rsp), %rsi
movq 0x68(%rsp), %rdx
addq %rsi, %rdx
movq %r13, %rdi
callq 0x3a4e
movq 0x10(%rsp), %rdi
movq %r13, %rsi
callq 0x5284
movq 0x18(%rsp), %rdi
leaq 0x28(%rsp), %rax
cmpq %rax, %rdi
je 0x2695
movq 0x28(%rsp), %rsi
incq %rsi
callq 0x2170
movq 0x60(%rsp), %rdi
leaq 0x70(%rsp), %rax
cmpq %rax, %rdi
je 0x26b1
movq 0x70(%rsp), %rsi
incq %rsi
callq 0x2170
incl %r14d
cmpl %r12d, %r14d
jne 0x25e0
callq 0x20e0
subq 0x38(%rsp), %rax
cvtsi2sd %rax, %xmm1
divsd 0x4934(%rip), %xmm1     # 0x7008
movq 0x88fd(%rip), %rdi      # 0xafd8
movq (%rdi), %rax
movq -0x18(%rax), %rax
movq $0x18, 0x10(%rdi,%rax)
movsd 0x491d(%rip), %xmm0     # 0x7010
movsd %xmm1, 0xc0(%rsp)
mulsd %xmm1, %xmm0
xorps %xmm1, %xmm1
cvtsi2sdl 0x8(%rsp), %xmm1
movsd %xmm1, 0x38(%rsp)
divsd %xmm1, %xmm0
callq 0x2200
callq 0x20e0
movq %rax, 0xb8(%rsp)
cmpl $0x64, 0x8(%rsp)
jl 0x2819
xorl %r14d, %r14d
leaq 0x18(%rsp), %r13
movl $0xd1b71759, %r15d      # imm = 0xD1B71759
imull $0x64, %r14d, %ebp
testl %r14d, %r14d
je 0x277c
movl $0x4, %ebx
movl %ebp, %eax
cmpl $0x63, %eax
jbe 0x2783
cmpl $0x3e7, %eax            # imm = 0x3E7
jbe 0x2788
cmpl $0x2710, %eax           # imm = 0x2710
jb 0x278a
movl %eax, %ecx
imulq %r15, %rcx
shrq $0x2d, %rcx
addl $0x4, %ebx
cmpl $0x1869f, %eax          # imm = 0x1869F
movl %ecx, %eax
ja 0x274e
addl $-0x3, %ebx
jmp 0x278a
movl $0x1, %ebx
jmp 0x278a
addl $-0x2, %ebx
jmp 0x278a
decl %ebx
movl %ebx, %esi
leaq 0x50(%rsp), %rax
movq %rax, 0x40(%rsp)
leaq 0x40(%rsp), %rdi
movl $0x2d, %edx
callq 0x21a0
movq 0x40(%rsp), %rdi
movl %ebx, %esi
movl %ebp, %edx
callq 0x4565
movq 0x40(%rsp), %rsi
movq 0x48(%rsp), %rdx
addq %rsi, %rdx
movq %r13, %rdi
callq 0x3a4e
movq 0x10(%rsp), %rdi
movq %r13, %rsi
callq 0x5ae6
movq 0x18(%rsp), %rdi
leaq 0x28(%rsp), %rax
cmpq %rax, %rdi
je 0x27f1
movq 0x28(%rsp), %rsi
incq %rsi
callq 0x2170
movq 0x40(%rsp), %rdi
leaq 0x50(%rsp), %rax
cmpq %rax, %rdi
je 0x280d
movq 0x50(%rsp), %rsi
incq %rsi
callq 0x2170
incl %r14d
cmpl %r12d, %r14d
jne 0x273e
callq 0x20e0
subq 0xb8(%rsp), %rax
xorps %xmm1, %xmm1
cvtsi2sd %rax, %xmm1
divsd 0x47d2(%rip), %xmm1     # 0x7008
movq 0x879b(%rip), %rdi      # 0xafd8
movq (%rdi), %rax
movq -0x18(%rax), %rax
movq $0x18, 0x10(%rdi,%rax)
movsd 0x47bb(%rip), %xmm0     # 0x7010
movsd %xmm1, 0x8(%rsp)
mulsd %xmm1, %xmm0
divsd 0x38(%rsp), %xmm0
callq 0x2200
movq 0x8767(%rip), %rdi      # 0xafd8
movq (%rdi), %rax
movq -0x18(%rax), %rax
movq $0x18, 0x10(%rdi,%rax)
movsd 0xc0(%rsp), %xmm0
divsd 0x8(%rsp), %xmm0
callq 0x2200
movq %rax, %rbx
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x2150
movsbl %al, %esi
movq %rbx, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x2100
movq 0x10(%rsp), %rbx
movq %rbx, %rdi
callq 0x50f8
movl $0x10, %esi
movq %rbx, %rdi
callq 0x2170
leaq 0xa0(%rsp), %rdi
callq 0x39aa
addq $0xc8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
movl $0x10, %esi
movq 0x10(%rsp), %rdi
jmp 0x29c9
jmp 0x2988
jmp 0x2988
movq %rax, %rbx
jmp 0x2932
movq %rax, %rbx
movq 0x18(%rsp), %rdi
leaq 0x28(%rsp), %rax
cmpq %rax, %rdi
je 0x2932
movq 0x28(%rsp), %rsi
incq %rsi
callq 0x2170
movq 0x40(%rsp), %rdi
leaq 0x50(%rsp), %rax
cmpq %rax, %rdi
je 0x29ce
movq 0x50(%rsp), %rsi
jmp 0x29c6
jmp 0x2988
movq %rax, %rbx
jmp 0x2972
movq %rax, %rbx
movq 0x18(%rsp), %rdi
leaq 0x28(%rsp), %rax
cmpq %rax, %rdi
je 0x2972
movq 0x28(%rsp), %rsi
incq %rsi
callq 0x2170
movq 0x60(%rsp), %rdi
leaq 0x70(%rsp), %rax
cmpq %rax, %rdi
je 0x29ce
movq 0x70(%rsp), %rsi
jmp 0x29c6
movq %rax, %rbx
jmp 0x29ce
movq %rax, %rbx
jmp 0x29b1
movq %rax, %rbx
movq 0x18(%rsp), %rdi
leaq 0x28(%rsp), %rax
cmpq %rax, %rdi
je 0x29b1
movq 0x28(%rsp), %rsi
incq %rsi
callq 0x2170
movq 0x80(%rsp), %rdi
cmpq %rbp, %rdi
je 0x29ce
movq 0x90(%rsp), %rsi
incq %rsi
callq 0x2170
leaq 0xa0(%rsp), %rdi
callq 0x39aa
movq %rbx, %rdi
callq 0x2240