// File: zhjw1998[P]Merkle-Tree/src/merkle_tree.cpp
// Function: MerkleTree::Insert(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&)
void MerkleTree::Insert(const std::string& word){
    TrieTreeNode *p = this->trieroot;
    for (unsigned int i = 0; i < word.size(); i++){
        // std::cout <<"i=" << i << " word[i]=" << word[i] <<" " << word << std::endl;
        if(p->child[GETINDEX(word[i])] == nullptr){
            p->child[GETINDEX(word[i])] = new TrieTreeNode(word[i]);
            p->childCnt++;
        }
        //notice!!this line need to be optimized to handle with duplicated insertion
        p->child[GETINDEX(word[i])]->prefixCnt++;
        p = p->child[GETINDEX(word[i])];
    }
    p->isEnd = true;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x90, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x18(%rbp)
movl $0x0, -0x1c(%rbp)
movl -0x1c(%rbp), %eax
movq %rax, -0x38(%rbp)
movq -0x10(%rbp), %rdi
callq 0x2130
movq %rax, %rcx
movq -0x38(%rbp), %rax
cmpq %rcx, %rax
jae 0x99bd
movq -0x18(%rbp), %rax
addq $0x10, %rax
movq %rax, -0x40(%rbp)
movq -0x10(%rbp), %rdi
movl -0x1c(%rbp), %eax
movl %eax, %esi
callq 0x2250
movsbl (%rax), %eax
cmpl $0x39, %eax
jle 0x97e4
movq -0x10(%rbp), %rdi
movl -0x1c(%rbp), %eax
movl %eax, %esi
callq 0x2250
movsbl (%rax), %eax
subl $0x61, %eax
addl $0xa, %eax
movl %eax, -0x44(%rbp)
jmp 0x97fb
movq -0x10(%rbp), %rdi
movl -0x1c(%rbp), %eax
movl %eax, %esi
callq 0x2250
movsbl (%rax), %eax
subl $0x30, %eax
movl %eax, -0x44(%rbp)
movq -0x40(%rbp), %rax
movl -0x44(%rbp), %ecx
movslq %ecx, %rcx
cmpq $0x0, (%rax,%rcx,8)
jne 0x98d3
movl $0x90, %edi
callq 0x21c0
movq %rax, -0x50(%rbp)
movq %rax, -0x58(%rbp)
movq -0x10(%rbp), %rdi
movl -0x1c(%rbp), %eax
movl %eax, %esi
callq 0x2250
movq -0x50(%rbp), %rdi
movsbl (%rax), %esi
callq 0xf230
jmp 0x983e
movq -0x18(%rbp), %rax
addq $0x10, %rax
movq %rax, -0x60(%rbp)
movq -0x10(%rbp), %rdi
movl -0x1c(%rbp), %eax
movl %eax, %esi
callq 0x2250
movsbl (%rax), %eax
cmpl $0x39, %eax
jle 0x987c
movq -0x10(%rbp), %rdi
movl -0x1c(%rbp), %eax
movl %eax, %esi
callq 0x2250
movsbl (%rax), %eax
subl $0x61, %eax
addl $0xa, %eax
movl %eax, -0x64(%rbp)
jmp 0x9893
movq -0x10(%rbp), %rdi
movl -0x1c(%rbp), %eax
movl %eax, %esi
callq 0x2250
movsbl (%rax), %eax
subl $0x30, %eax
movl %eax, -0x64(%rbp)
movq -0x60(%rbp), %rax
movq -0x58(%rbp), %rdx
movl -0x64(%rbp), %ecx
movslq %ecx, %rcx
movq %rdx, (%rax,%rcx,8)
movq -0x18(%rbp), %rax
movl 0x4(%rax), %ecx
addl $0x1, %ecx
movl %ecx, 0x4(%rax)
jmp 0x98d3
movq -0x58(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x28(%rbp)
movl %eax, -0x2c(%rbp)
movl $0x90, %esi
callq 0x21e0
jmp 0x99ce
movq -0x18(%rbp), %rax
addq $0x10, %rax
movq %rax, -0x70(%rbp)
movq -0x10(%rbp), %rdi
movl -0x1c(%rbp), %eax
movl %eax, %esi
callq 0x2250
movsbl (%rax), %eax
cmpl $0x39, %eax
jle 0x9911
movq -0x10(%rbp), %rdi
movl -0x1c(%rbp), %eax
movl %eax, %esi
callq 0x2250
movsbl (%rax), %eax
subl $0x61, %eax
addl $0xa, %eax
movl %eax, -0x74(%rbp)
jmp 0x9928
movq -0x10(%rbp), %rdi
movl -0x1c(%rbp), %eax
movl %eax, %esi
callq 0x2250
movsbl (%rax), %eax
subl $0x30, %eax
movl %eax, -0x74(%rbp)
movq -0x70(%rbp), %rax
movl -0x74(%rbp), %ecx
movslq %ecx, %rcx
movq (%rax,%rcx,8), %rax
movl 0x8(%rax), %ecx
addl $0x1, %ecx
movl %ecx, 0x8(%rax)
movq -0x18(%rbp), %rax
addq $0x10, %rax
movq %rax, -0x80(%rbp)
movq -0x10(%rbp), %rdi
movl -0x1c(%rbp), %eax
movl %eax, %esi
callq 0x2250
movsbl (%rax), %eax
cmpl $0x39, %eax
jle 0x9980
movq -0x10(%rbp), %rdi
movl -0x1c(%rbp), %eax
movl %eax, %esi
callq 0x2250
movsbl (%rax), %eax
subl $0x61, %eax
addl $0xa, %eax
movl %eax, -0x84(%rbp)
jmp 0x999a
movq -0x10(%rbp), %rdi
movl -0x1c(%rbp), %eax
movl %eax, %esi
callq 0x2250
movsbl (%rax), %eax
subl $0x30, %eax
movl %eax, -0x84(%rbp)
movq -0x80(%rbp), %rax
movl -0x84(%rbp), %ecx
movslq %ecx, %rcx
movq (%rax,%rcx,8), %rax
movq %rax, -0x18(%rbp)
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rbp)
jmp 0x9786
movq -0x18(%rbp), %rax
movb $0x1, 0x1(%rax)
addq $0x90, %rsp
popq %rbp
retq
movq -0x28(%rbp), %rdi
callq 0x2340
nopw (%rax,%rax)