// File: /workspace/github_c_makefile_star2_O1/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
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
xorl %ebx, %ebx
xorl %eax, %eax
callq 0x23e4
leaq -0xed0(%rip), %rsi      # 0x2508
movl $0x33dd883, %edi        # imm = 0x33DD883
callq 0x2513
movl $0x100, %edi            # imm = 0x100
callq 0x2748
movq %rax, %r15
leaq -0x3e(%rip), %rdi       # 0x33b8
callq 0x1aa4
movq %rax, %r12
movq 0x3d0b(%rip), %rdi      # 0x7110
leaq 0xf99(%rip), %rsi       # 0x43a5
callq 0x2480
movq %rax, %r14
movq 0x3ce5(%rip), %rdi      # 0x7100
leaq 0xf85(%rip), %rsi       # 0x43a7
callq 0x2480
movq %rax, %r13
movq %rax, %rdi
movq %r15, %rsi
callq 0x24ab
testl %eax, %eax
je 0x3454
movq %r15, %rdi
callq 0x1070
leal 0x1(%rax), %edx
movq %r12, %rdi
movq %r15, %rsi
callq 0x1adb
movq %r13, %rdi
jmp 0x342d
movq %r13, %rdi
callq 0x1060
xorl %eax, %eax
callq 0x2410
movq 0x3c9e(%rip), %rdi      # 0x7108
leaq 0xf36(%rip), %rsi       # 0x43a7
callq 0x2480
movq %rax, %r13
movq %rax, %rdi
movq %r15, %rsi
callq 0x24ab
movl $0x0, %ebp
testl %eax, %eax
je 0x34d5
xorl %ebp, %ebp
xorl %ebx, %ebx
incl %ebp
movq %r12, %rdi
movq %r15, %rsi
callq 0x1abf
xorl %ecx, %ecx
testl %eax, %eax
setne %cl
leaq 0xf05(%rip), %rsi       # 0x43b1
leaq 0xef6(%rip), %rax       # 0x43a9
cmovneq %rax, %rsi
addl %ecx, %ebx
movq %r14, %rdi
movq %r15, %rdx
xorl %eax, %eax
callq 0x10e0
movq %r13, %rdi
movq %r15, %rsi
callq 0x24ab
testl %eax, %eax
jne 0x3491
movq %r13, %rdi
callq 0x1060
leaq 0x3c48(%rip), %rax      # 0x712c
movl (%rax), %r15d
xorl %eax, %eax
callq 0x26f4
movq %rax, %xmm1
punpckldq 0xe45(%rip), %xmm1 # xmm1 = xmm1[0],mem[0],xmm1[1],mem[1]
subpd 0xe4d(%rip), %xmm1      # 0x4350
movapd %xmm1, %xmm0
unpckhpd %xmm1, %xmm0            # xmm0 = xmm0[1],xmm1[1]
addsd %xmm1, %xmm0
mulsd 0xe49(%rip), %xmm0      # 0x4360
leaq 0x3c32(%rip), %rax      # 0x7150
movq (%rax), %rax
shrq $0x3, %rax
movabsq $0x20c49ba5e353f7cf, %rcx # imm = 0x20C49BA5E353F7CF
mulq %rcx
movq %rdx, %rcx
shrq $0x4, %rcx
leaq 0xe78(%rip), %rsi       # 0x43b8
movq %r14, %rdi
movl %r15d, %edx
movl %ebp, %r8d
movl %ebx, %r9d
movb $0x1, %al
callq 0x10e0
xorl %eax, %eax
callq 0x23f3
leaq 0xe70(%rip), %rdi       # 0x43d1
movb $0x1, %al
callq 0x1080
movq %r14, %rdi
callq 0x1060
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq