// File: /workspace/github_cpp_makefile_star2_O2/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 $0xb8, %rsp
movl %edi, %ebp
movq 0x13b42(%rip), %rdi     # 0x15fd8
movq (%rdi), %rax
movq -0x18(%rax), %rax
movq $0x18, 0x10(%rdi,%rax)
movl %ebp, %esi
callq 0x22f0
xorpd %xmm0, %xmm0
leaq 0x40(%rsp), %r14
andq $0x0, 0x10(%r14)
movapd %xmm0, (%r14)
xorl %r15d, %r15d
testl %ebp, %ebp
movl $0x0, %r13d
cmovgl %ebp, %r13d
leaq 0x98(%rsp), %rbx
leaq 0x20(%rsp), %r12
cmpl %r15d, %r13d
je 0x2517
movq %rbx, %rdi
movl %r15d, %esi
callq 0x30ec
movq %r12, %rdi
movq %rbx, %rsi
callq 0x31dd
movq %r14, %rdi
movq %r12, %rsi
callq 0x3d9a
movq %r12, %rdi
callq 0x20b0
movq %rbx, %rdi
callq 0x20b0
incl %r15d
jmp 0x24dc
pushq $0x10
popq %rdi
callq 0x21b0
movq %rax, (%rsp)
leaq 0x40(%rsp), %rsi
movq (%rsp), %rdi
callq 0x40da
callq 0x2110
movq %rax, 0x8(%rsp)
pushq $0x64
popq %rcx
movl %ebp, %eax
cltd
idivl %ecx
movl %eax, %r14d
xorl %r13d, %r13d
testl %eax, %eax
cmovlel %r13d, %r14d
leaq 0x78(%rsp), %r12
leaq 0x20(%rsp), %rbx
movl %r14d, %r15d
subl $0x1, %r15d
jb 0x259a
movq %r12, %rdi
movl %r13d, %esi
callq 0x30ec
movq %rbx, %rdi
movq %r12, %rsi
callq 0x31dd
movq (%rsp), %rdi
movq %rbx, %rsi
callq 0x464e
movq %rbx, %rdi
callq 0x20b0
movq %r12, %rdi
callq 0x20b0
addl $0x64, %r13d
jmp 0x255c
callq 0x2110
subq 0x8(%rsp), %rax
cvtsi2sd %rax, %xmm1
divsd 0xba57(%rip), %xmm1     # 0xe008
movq 0x13a20(%rip), %rdi     # 0x15fd8
movq (%rdi), %rax
movq -0x18(%rax), %rax
movq $0x18, 0x10(%rdi,%rax)
movsd 0xba40(%rip), %xmm0     # 0xe010
movsd %xmm1, 0x18(%rsp)
mulsd %xmm1, %xmm0
cvtsi2sd %ebp, %xmm1
movsd %xmm1, 0x8(%rsp)
divsd %xmm1, %xmm0
callq 0x22c0
xorl %ebp, %ebp
callq 0x2110
movq %rax, %r12
leaq 0x58(%rsp), %r13
leaq 0x20(%rsp), %rbx
subl $0x1, %r14d
jb 0x263d
movq %r13, %rdi
movl %ebp, %esi
callq 0x30ec
movq %rbx, %rdi
movq %r13, %rsi
callq 0x31dd
movq (%rsp), %rdi
movq %rbx, %rsi
callq 0x54b6
movq %rbx, %rdi
callq 0x20b0
movq %r13, %rdi
callq 0x20b0
addl $0x64, %ebp
jmp 0x2601
callq 0x2110
subq %r12, %rax
cvtsi2sd %rax, %xmm1
divsd 0xb9b6(%rip), %xmm1     # 0xe008
movq 0x1397f(%rip), %rdi     # 0x15fd8
movq (%rdi), %rax
movq -0x18(%rax), %rax
movq $0x18, 0x10(%rdi,%rax)
movsd 0xb99f(%rip), %xmm0     # 0xe010
movsd %xmm1, 0x10(%rsp)
mulsd %xmm1, %xmm0
divsd 0x8(%rsp), %xmm0
callq 0x22c0
movq 0x1394b(%rip), %rdi     # 0x15fd8
movq (%rdi), %rax
movq -0x18(%rax), %rax
movq $0x18, 0x10(%rdi,%rax)
movsd 0x18(%rsp), %xmm0
divsd 0x10(%rsp), %xmm0
callq 0x22c0
movq %rax, %rdi
callq 0x2358
movq (%rsp), %rbx
movq %rbx, %rdi
callq 0x444a
pushq $0x10
popq %rsi
movq %rbx, %rdi
callq 0x21c0
leaq 0x40(%rsp), %rdi
callq 0x3146
addq $0xb8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
pushq $0x10
popq %rsi
movq (%rsp), %rdi
callq 0x21c0
jmp 0x2756
jmp 0x2732
jmp 0x2732
movq %rax, %rbx
jmp 0x2710
movq %rax, %rbx
leaq 0x20(%rsp), %rdi
callq 0x20b0
leaq 0x58(%rsp), %rdi
jmp 0x2751
jmp 0x2732
movq %rax, %rbx
jmp 0x272b
movq %rax, %rbx
leaq 0x20(%rsp), %rdi
callq 0x20b0
leaq 0x78(%rsp), %rdi
jmp 0x2751
movq %rax, %rbx
jmp 0x2756
movq %rax, %rbx
jmp 0x2749
movq %rax, %rbx
leaq 0x20(%rsp), %rdi
callq 0x20b0
leaq 0x98(%rsp), %rdi
callq 0x20b0
leaq 0x40(%rsp), %rdi
callq 0x3146
movq %rbx, %rdi
callq 0x2300