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

    mp_init(memory_length, mp_exit);

    link_list *lk = lk_init();

    char *temp = mp_new(max_string_length * sizeof(char));
    int   word_number = 0;
    int   word_exist_number = 0;

    FILE *output = open_file(output_filename, "w");
    FILE *f = open_file(patterns_filename, "r");
    while (read_file(f, temp)) {
        char *s = mp_new(sizeof(char *) * (strlen(temp) + 1));
        strcpy(s, temp);
        lk_add(lk, s);
    }
    fclose(f);

    f = open_file(words_filename, "r");
    while (read_file(f, temp)) {
        ++word_number;
        // if (word_number % 10000 == 0)
        //     printf("%d %fs %d ok\n", word_number, clock_duration(),
        //            word_exist_number);

        if (NULL != lk_search(lk, temp, compare)) {
            ++word_exist_number;
            fprintf(output, "%s yes\n", temp);
        } else {
            fprintf(output, "%s no\n", temp);
        }
    }
    fclose(f);

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

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movl $0x0, -0x4(%rbp)
movb $0x0, %al
callq 0x2cf0
movl $0x14246810, %edi       # imm = 0x14246810
leaq -0x1902(%rip), %rsi     # 0x2f90
callq 0x2fa0
movb $0x0, %al
callq 0x3700
movq %rax, -0x10(%rbp)
movl $0x100, %edi            # imm = 0x100
callq 0x32b0
movq %rax, -0x18(%rbp)
movl $0x0, -0x1c(%rbp)
movl $0x0, -0x20(%rbp)
movq 0x3853(%rip), %rdi      # 0x8118
leaq 0xac1(%rip), %rsi       # 0x538d
callq 0x2e60
movq %rax, -0x28(%rbp)
movq 0x382c(%rip), %rdi      # 0x8108
leaq 0xaac(%rip), %rsi       # 0x538f
callq 0x2e60
movq %rax, -0x30(%rbp)
movq -0x30(%rbp), %rdi
movq -0x18(%rbp), %rsi
callq 0x2eb0
cmpl $0x0, %eax
je 0x4936
movq -0x18(%rbp), %rdi
callq 0x1070
addq $0x1, %rax
shlq $0x3, %rax
movl %eax, %edi
callq 0x32b0
movq %rax, -0x38(%rbp)
movq -0x38(%rbp), %rdi
movq -0x18(%rbp), %rsi
callq 0x1030
movq -0x10(%rbp), %rdi
movq -0x38(%rbp), %rsi
callq 0x37c0
jmp 0x48ec
movq -0x30(%rbp), %rdi
callq 0x1060
movq 0x37ca(%rip), %rdi      # 0x8110
leaq 0xa42(%rip), %rsi       # 0x538f
callq 0x2e60
movq %rax, -0x30(%rbp)
movq -0x30(%rbp), %rdi
movq -0x18(%rbp), %rsi
callq 0x2eb0
cmpl $0x0, %eax
je 0x49c8
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rbp)
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
leaq -0x140(%rip), %rdx      # 0x4840
callq 0x3940
movq %rax, %rcx
xorl %eax, %eax
cmpq %rcx, %rax
je 0x49b0
movl -0x20(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x20(%rbp)
movq -0x28(%rbp), %rdi
movq -0x18(%rbp), %rdx
leaq 0x9ea(%rip), %rsi       # 0x5391
movb $0x0, %al
callq 0x10f0
jmp 0x49c6
movq -0x28(%rbp), %rdi
movq -0x18(%rbp), %rdx
leaq 0x9da(%rip), %rsi       # 0x5399
movb $0x0, %al
callq 0x10f0
jmp 0x4956
movq -0x30(%rbp), %rdi
callq 0x1060
movq -0x28(%rbp), %rax
movq %rax, -0x40(%rbp)
xorl %eax, %eax
callq 0x3210
movq -0x40(%rbp), %rdi
movq %rax, %xmm0
movaps 0x940(%rip), %xmm1      # 0x5330
punpckldq %xmm1, %xmm0    # xmm0 = xmm0[0],xmm1[0],xmm0[1],xmm1[1]
movapd 0x944(%rip), %xmm1      # 0x5340
subpd %xmm1, %xmm0
movaps %xmm0, %xmm1
unpckhpd %xmm0, %xmm0            # xmm0 = xmm0[1,1]
addsd %xmm1, %xmm0
movsd 0x90d(%rip), %xmm1      # 0x5320
divsd %xmm1, %xmm0
leaq 0x373a(%rip), %rax      # 0x8158
movq (%rax), %rdx
movl -0x1c(%rbp), %ecx
movl -0x20(%rbp), %r8d
leaq 0x971(%rip), %rsi       # 0x53a0
movb $0x1, %al
callq 0x10f0
movb $0x0, %al
callq 0x2d10
leaq 0x970(%rip), %rdi       # 0x53b4
movb $0x1, %al
callq 0x1090
movq -0x28(%rbp), %rdi
callq 0x1060
xorl %eax, %eax
addq $0x40, %rsp
popq %rbp
retq