// File: /workspace/github_c_makefile_star2_O2/OhYee[P]computer_application_programming_experiment/utils/bplus_tree/test/test_bplus_tree.c
// Function: main
int main() {
    mp_init(1 << 20, mp_exit);
    a = mp_new(sizeof(int));
    bplus_tree *bpt = bpt_init(3, compare);
    bpt_add(bpt, num(1), sizeof(int));
    bpt_add(bpt, num(1), sizeof(int));
    bpt_add(bpt, num(2), sizeof(int));
    bpt_add(bpt, num(3), sizeof(int));
    bpt_print(bpt);

    bpt_add(bpt, num(4), sizeof(int));
    bpt_add(bpt, num(4), sizeof(int));
    bpt_print(bpt);

    bpt_add(bpt, num(5), sizeof(int));
    bpt_print(bpt);

    bpt_add(bpt, num(6), sizeof(int));
    bpt_print(bpt);

    bpt_add(bpt, num(7), sizeof(int));
    bpt_print(bpt);

    bpt_add(bpt, num(8), sizeof(int));
    bpt_print(bpt);

    bpt_add(bpt, num(9), sizeof(int));
    bpt_print(bpt);

    bpt_add(bpt, num(10), sizeof(int));
    bpt_print(bpt);

    bpt_add(bpt, num(11), sizeof(int));
    bpt_print(bpt);

    bpt_add(bpt, num(18), sizeof(int));
    bpt_print(bpt);

    bpt_add(bpt, num(19), sizeof(int));
    bpt_print(bpt);

    bpt_add(bpt, num(12), sizeof(int));
    bpt_print(bpt);

    bpt_add(bpt, num(13), sizeof(int));
    bpt_print(bpt);

    boolean pass = T;
    int     testcases[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 18, 19};
    for (int i = 0; i < sizeof(testcases) / 8; ++i) {
        int n = testcases[i];
        if (bpt_exist(bpt, num(n)) == T) {
            print_ok("Search %d passed.\n", n);
        } else {
            print_err("Search %d has error!\n", n);
            pass = F;
        }
    }
    if (bpt_exist(bpt, num(0)) == F) {
        print_ok("Search %d passed.\n", 0);
    } else {
        print_err("Search %d has error!\n", 0);
        pass = F;
    }
    if (bpt_exist(bpt, num(23)) == F) {
        print_ok("Search %d passed.\n", 23);
    } else {
        print_err("Search %d has error!\n", 23);
        pass = F;
    }

    if (pass) {
        print_ok("All testcases passed.\n");
    } else {
        print_err("Has error!\n");
    }

    return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
leaq -0xa2a(%rip), %rsi      # 0x11bc
movl $0x100000, %edi         # imm = 0x100000
callq 0x11c5
pushq $0x4
popq %rbp
movl %ebp, %edi
callq 0x13b1
movq %rax, 0x24b7(%rip)      # 0x40b8
leaq -0x58(%rip), %rsi       # 0x1bb0
pushq $0x3
popq %rdi
callq 0x1438
movq %rax, %r15
movq 0x249e(%rip), %rax      # 0x40b8
pushq $0x1
popq %r14
movl %r14d, (%rax)
movq 0x2490(%rip), %rsi      # 0x40b8
movq %r15, %rdi
movl %ebp, %edx
callq 0x145a
movq 0x247f(%rip), %rax      # 0x40b8
movl %r14d, (%rax)
movq 0x2475(%rip), %rsi      # 0x40b8
movq %r15, %rdi
movl %ebp, %edx
callq 0x145a
movq 0x2464(%rip), %rax      # 0x40b8
movl $0x2, (%rax)
movq 0x2457(%rip), %rsi      # 0x40b8
movq %r15, %rdi
movl %ebp, %edx
callq 0x145a
movq 0x2446(%rip), %rax      # 0x40b8
movl $0x3, (%rax)
movq 0x2439(%rip), %rsi      # 0x40b8
movq %r15, %rdi
movl %ebp, %edx
callq 0x145a
movq %r15, %rdi
callq 0x1534
movq 0x2420(%rip), %rax      # 0x40b8
movl %ebp, (%rax)
movq 0x2417(%rip), %rsi      # 0x40b8
movq %r15, %rdi
movl %ebp, %edx
callq 0x145a
movq 0x2406(%rip), %rax      # 0x40b8
movl %ebp, (%rax)
movq 0x23fd(%rip), %rsi      # 0x40b8
movq %r15, %rdi
movl %ebp, %edx
callq 0x145a
movq %r15, %rdi
callq 0x1534
movq 0x23e4(%rip), %rax      # 0x40b8
movl $0x5, (%rax)
movq 0x23d7(%rip), %rsi      # 0x40b8
movq %r15, %rdi
movl %ebp, %edx
callq 0x145a
movq %r15, %rdi
callq 0x1534
movq 0x23be(%rip), %rax      # 0x40b8
movl $0x6, (%rax)
movq 0x23b1(%rip), %rsi      # 0x40b8
movq %r15, %rdi
movl %ebp, %edx
callq 0x145a
movq %r15, %rdi
callq 0x1534
movq 0x2398(%rip), %rax      # 0x40b8
movl $0x7, (%rax)
movq 0x238b(%rip), %rsi      # 0x40b8
movq %r15, %rdi
movl %ebp, %edx
callq 0x145a
movq %r15, %rdi
callq 0x1534
movq 0x2372(%rip), %rax      # 0x40b8
movl $0x8, (%rax)
movq 0x2365(%rip), %rsi      # 0x40b8
movq %r15, %rdi
movl %ebp, %edx
callq 0x145a
movq %r15, %rdi
callq 0x1534
movq 0x234c(%rip), %rax      # 0x40b8
movl $0x9, (%rax)
movq 0x233f(%rip), %rsi      # 0x40b8
movq %r15, %rdi
movl %ebp, %edx
callq 0x145a
movq %r15, %rdi
callq 0x1534
movq 0x2326(%rip), %rax      # 0x40b8
movl $0xa, (%rax)
movq 0x2319(%rip), %rsi      # 0x40b8
movq %r15, %rdi
movl %ebp, %edx
callq 0x145a
movq %r15, %rdi
callq 0x1534
movq 0x2300(%rip), %rax      # 0x40b8
movl $0xb, (%rax)
movq 0x22f3(%rip), %rsi      # 0x40b8
movq %r15, %rdi
movl %ebp, %edx
callq 0x145a
movq %r15, %rdi
callq 0x1534
movq 0x22da(%rip), %rax      # 0x40b8
movl $0x12, (%rax)
movq 0x22cd(%rip), %rsi      # 0x40b8
movq %r15, %rdi
movl %ebp, %edx
callq 0x145a
movq %r15, %rdi
callq 0x1534
movq 0x22b4(%rip), %rax      # 0x40b8
movl $0x13, (%rax)
movq 0x22a7(%rip), %rsi      # 0x40b8
movq %r15, %rdi
movl %ebp, %edx
callq 0x145a
movq %r15, %rdi
callq 0x1534
movq 0x228e(%rip), %rax      # 0x40b8
movl $0xc, (%rax)
movq 0x2281(%rip), %rsi      # 0x40b8
movq %r15, %rdi
movl %ebp, %edx
callq 0x145a
movq %r15, %rdi
callq 0x1534
movq 0x2268(%rip), %rax      # 0x40b8
movl $0xd, (%rax)
movq 0x225b(%rip), %rsi      # 0x40b8
movq %r15, %rdi
movl %ebp, %edx
callq 0x145a
movq %r15, %rbx
movq %r15, %rdi
callq 0x1534
leaq 0x2f7(%rip), %rax       # 0x2170
movl (%rax), %r13d
leaq 0x2f1(%rip), %rax       # 0x2174
movl (%rax), %r12d
leaq 0x2f3(%rip), %r15       # 0x2180
xorl %r14d, %r14d
movl %r13d, 0x4(%rsp)
cmpq $0x1c, %r14
je 0x1ee9
movl (%r14,%r15), %ebp
movq 0x2212(%rip), %rax      # 0x40b8
movl %ebp, (%rax)
movq 0x2209(%rip), %rsi      # 0x40b8
movq %rbx, %rdi
callq 0x1547
cmpl %r13d, %eax
jne 0x1ece
leaq 0x2f9(%rip), %rdi       # 0x21bc
movl %ebp, %esi
xorl %eax, %eax
callq 0x1af8
jmp 0x1ee3
leaq 0x2fa(%rip), %rdi       # 0x21cf
movl %ebp, %esi
xorl %eax, %eax
callq 0x1a40
movl %r12d, 0x4(%rsp)
addq $0x4, %r14
jmp 0x1e95
movq 0x21c8(%rip), %rax      # 0x40b8
andl $0x0, (%rax)
movq 0x21be(%rip), %rsi      # 0x40b8
movq %rbx, %rdi
callq 0x1547
cmpl %r12d, %eax
jne 0x1f1d
leaq 0x2ae(%rip), %rdi       # 0x21bc
xorl %esi, %esi
xorl %eax, %eax
callq 0x1af8
movl 0x4(%rsp), %ebp
jmp 0x1f30
leaq 0x2ab(%rip), %rdi       # 0x21cf
xorl %esi, %esi
xorl %eax, %eax
callq 0x1a40
movl %r12d, %ebp
movq 0x2181(%rip), %rax      # 0x40b8
movl $0x17, (%rax)
movq 0x2174(%rip), %rsi      # 0x40b8
movq %rbx, %rdi
callq 0x1547
cmpl %r12d, %eax
jne 0x1f64
leaq 0x264(%rip), %rdi       # 0x21bc
pushq $0x17
popq %rsi
xorl %eax, %eax
callq 0x1af8
jmp 0x1f78
leaq 0x264(%rip), %rdi       # 0x21cf
pushq $0x17
popq %rsi
xorl %eax, %eax
callq 0x1a40
movl %r12d, %ebp
testl %ebp, %ebp
je 0x1f8c
leaq 0x262(%rip), %rdi       # 0x21e5
xorl %eax, %eax
callq 0x1af8
jmp 0x1f9a
leaq 0x269(%rip), %rdi       # 0x21fc
xorl %eax, %eax
callq 0x1a40
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq