// File: /workspace/github_c_makefile_star2_O0/OhYee[P]computer_application_programming_experiment/tree/btree_search/btree_search.c
// Function: main
int main() {
    clock_start();

    mp_init(memory_length, mp_exit);
    char *temp = mp_new(max_string_length * sizeof(char));
    int   word_number = 0;
    int   word_exist_number = 0;

    avl_tree *at = at_init(compare);

    FILE *output = open_file(output_filename, "w");
    FILE *f = open_file(patterns_filename, "r");

    while (read_file(f, temp)) {
        at_add(at, temp, strlen(temp) + 1);
    }
    fclose(f);

    // at_print(at);

    compare_init();

    f = open_file(words_filename, "r");
    while (read_file(f, temp)) {
        ++word_number;

        if (at_search(at, temp)) {
            ++word_exist_number;
            fprintf(output, "%s yes\n", temp);
        } else {
            fprintf(output, "%s no\n", temp);
        }
    }
    fclose(f);

    fprintf(output,
            "%10d %10.2f "
            "%" PRIu64 " %7d %7d\n",
            _avl_tree_node_number, (double)mp_get_length() / 1024,
            compare_number / 1000, word_number, word_exist_number);
    printf("%f s\n", clock_duration());
    fclose(output);
    return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x50, %rsp
movl $0x0, -0x4(%rbp)
movb $0x0, %al
callq 0x2ce0
movl $0x33dd883, %edi        # imm = 0x33DD883
leaq -0x1902(%rip), %rsi     # 0x2f80
callq 0x2f90
movl $0x100, %edi            # imm = 0x100
callq 0x32a0
movq %rax, -0x10(%rbp)
movl $0x0, -0x14(%rbp)
movl $0x0, -0x18(%rbp)
leaq -0x7a(%rip), %rdi       # 0x4830
callq 0x1d90
movq %rax, -0x20(%rbp)
movq 0x3856(%rip), %rdi      # 0x8110
leaq 0xacc(%rip), %rsi       # 0x538d
callq 0x2e50
movq %rax, -0x28(%rbp)
movq 0x382f(%rip), %rdi      # 0x8100
leaq 0xab7(%rip), %rsi       # 0x538f
callq 0x2e50
movq %rax, -0x30(%rbp)
movq -0x30(%rbp), %rdi
movq -0x10(%rbp), %rsi
callq 0x2ea0
cmpl $0x0, %eax
je 0x4921
movq -0x20(%rbp), %rax
movq %rax, -0x40(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x38(%rbp)
movq -0x10(%rbp), %rdi
callq 0x1060
movq -0x40(%rbp), %rdi
movq -0x38(%rbp), %rsi
addq $0x1, %rax
movl %eax, %edx
callq 0x1e10
jmp 0x48e1
movq -0x30(%rbp), %rdi
callq 0x1050
movb $0x0, %al
callq 0x2d30
movq 0x37d0(%rip), %rdi      # 0x8108
leaq 0xa50(%rip), %rsi       # 0x538f
callq 0x2e50
movq %rax, -0x30(%rbp)
movq -0x30(%rbp), %rdi
movq -0x10(%rbp), %rsi
callq 0x2ea0
cmpl $0x0, %eax
je 0x49ae
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
movq -0x20(%rbp), %rdi
movq -0x10(%rbp), %rsi
callq 0x1dd0
cmpl $0x0, %eax
je 0x4996
movl -0x18(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x18(%rbp)
movq -0x28(%rbp), %rdi
movq -0x10(%rbp), %rdx
leaq 0xa04(%rip), %rsi       # 0x5391
movb $0x0, %al
callq 0x10e0
jmp 0x49ac
movq -0x28(%rbp), %rdi
movq -0x10(%rbp), %rdx
leaq 0x9f4(%rip), %rsi       # 0x5399
movb $0x0, %al
callq 0x10e0
jmp 0x4948
movq -0x30(%rbp), %rdi
callq 0x1050
movq -0x28(%rbp), %rax
movq %rax, -0x50(%rbp)
leaq 0x3766(%rip), %rax      # 0x812c
movl (%rax), %eax
movl %eax, -0x44(%rbp)
xorl %eax, %eax
callq 0x3200
movq -0x50(%rbp), %rdi
movq %rax, %xmm0
movaps 0x94e(%rip), %xmm1      # 0x5330
punpckldq %xmm1, %xmm0    # xmm0 = xmm0[0],xmm1[0],xmm0[1],xmm1[1]
movapd 0x952(%rip), %xmm1      # 0x5340
subpd %xmm1, %xmm0
movaps %xmm0, %xmm1
unpckhpd %xmm0, %xmm0            # xmm0 = xmm0[1,1]
addsd %xmm1, %xmm0
movsd 0x91b(%rip), %xmm1      # 0x5320
divsd %xmm1, %xmm0
leaq 0x3740(%rip), %rax      # 0x8150
movq (%rax), %rax
movl $0x3e8, %ecx            # imm = 0x3E8
xorl %edx, %edx
divq %rcx
movl -0x44(%rbp), %edx
movq %rax, %rcx
movl -0x14(%rbp), %r8d
movl -0x18(%rbp), %r9d
leaq 0x96e(%rip), %rsi       # 0x53a0
movb $0x1, %al
callq 0x10e0
movb $0x0, %al
callq 0x2d00
leaq 0x972(%rip), %rdi       # 0x53b9
movb $0x1, %al
callq 0x1080
movq -0x28(%rbp), %rdi
callq 0x1050
xorl %eax, %eax
addq $0x50, %rsp
popq %rbp
retq