// File: /workspace/github_c_makefile_star2_O0/OhYee[P]computer_application_programming_experiment/utils/compare/test/test_compare.c
// Function: main
int main() {
    boolean       pass = T;
    testcase_char test_char[] = {
        {arg1: 'a', arg2: 'b', want_res: -1},
        {arg1: 'a', arg2: 'a', want_res: 0},
        {arg1: '0', arg2: '0', want_res: 0},
        {arg1: '1', arg2: '!', want_res: 1},
    };
    testcase_string test_string[] = {
        {arg1: "Hello", arg2: "Hello", want_res: 0},
        {arg1: "Hi", arg2: "Hi0", want_res: -1},
        {arg1: "Hi", arg2: "Hi\0", want_res: 0},
        {arg1: "ABC\0B", arg2: "ABC\0A", want_res: 0},
    };

    for (int i = 0; i < sizeof(test_char) / sizeof(testcase_char); ++i) {
        testcase_char *tc = &test_char[i];
        int            got = compare_char(tc->arg1, tc->arg2);
        if (got * tc->want_res < 0 || (tc->want_res == 0 && got != 0)) {
            pass = F;
            print_err("Check error at compare_char('%c','%c')=%d, got=%d\n",
                      tc->arg1, tc->arg2, tc->want_res,
                      compare_char(tc->arg1, tc->arg2));
        }
    }

    for (int i = 0; i < sizeof(test_string) / sizeof(testcase_string); ++i) {
        testcase_string *tc = &test_string[i];
        if (compare_string(tc->arg1, tc->arg2) != tc->want_res) {
            pass = F;
            print_err("Check error at compare_string('%s','%s')=%d\n", tc->arg1,
                      tc->arg2, tc->want_res);
        }
    }

    if (pass) {
        print_ok("All testcase passed\n");
        return 0;
    } else {
        print_err("Some error\n");
        return 1;
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xc0, %rsp
movl $0x0, -0x4(%rbp)
leaq 0xa4b(%rip), %rax       # 0x2004
movl (%rax), %eax
movl %eax, -0x8(%rbp)
movq 0xabb(%rip), %rax       # 0x2080
movq %rax, -0x30(%rbp)
movq 0xab8(%rip), %rax       # 0x2088
movq %rax, -0x28(%rbp)
movq 0xab5(%rip), %rax       # 0x2090
movq %rax, -0x20(%rbp)
movq 0xab2(%rip), %rax       # 0x2098
movq %rax, -0x18(%rbp)
leaq -0x90(%rbp), %rdi
leaq 0x2788(%rip), %rsi      # 0x3d80
movl $0x60, %edx
callq 0x1040
movl $0x0, -0x94(%rbp)
movslq -0x94(%rbp), %rax
cmpq $0x4, %rax
jae 0x171a
movslq -0x94(%rbp), %rcx
leaq -0x30(%rbp), %rax
shlq $0x3, %rcx
addq %rcx, %rax
movq %rax, -0xa0(%rbp)
movq -0xa0(%rbp), %rax
movb (%rax), %cl
movq -0xa0(%rbp), %rax
movsbl %cl, %edi
movsbl 0x1(%rax), %esi
callq 0x14a0
movl %eax, -0xa4(%rbp)
movl -0xa4(%rbp), %eax
movq -0xa0(%rbp), %rcx
imull 0x4(%rcx), %eax
cmpl $0x0, %eax
jl 0x1688
movq -0xa0(%rbp), %rax
cmpl $0x0, 0x4(%rax)
jne 0x1704
cmpl $0x0, -0xa4(%rbp)
je 0x1704
leaq 0x979(%rip), %rax       # 0x2008
movl (%rax), %eax
movl %eax, -0x8(%rbp)
movq -0xa0(%rbp), %rax
movsbl (%rax), %eax
movl %eax, -0xbc(%rbp)
movq -0xa0(%rbp), %rax
movsbl 0x1(%rax), %eax
movl %eax, -0xb8(%rbp)
movq -0xa0(%rbp), %rax
movl 0x4(%rax), %eax
movl %eax, -0xb4(%rbp)
movq -0xa0(%rbp), %rax
movb (%rax), %cl
movq -0xa0(%rbp), %rax
movsbl %cl, %edi
movsbl 0x1(%rax), %esi
callq 0x14a0
movl -0xbc(%rbp), %esi
movl -0xb8(%rbp), %edx
movl -0xb4(%rbp), %ecx
movl %eax, %r8d
leaq 0x9b0(%rip), %rdi       # 0x20ad
movb $0x0, %al
callq 0x1300
jmp 0x1706
movl -0x94(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x94(%rbp)
jmp 0x160c
movl $0x0, -0xa8(%rbp)
movslq -0xa8(%rbp), %rax
cmpq $0x4, %rax
jae 0x17c6
movslq -0xa8(%rbp), %rcx
leaq -0x90(%rbp), %rax
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movq %rax, -0xb0(%rbp)
movq -0xb0(%rbp), %rax
movq (%rax), %rdi
movq -0xb0(%rbp), %rax
movq 0x8(%rax), %rsi
callq 0x14d0
movq -0xb0(%rbp), %rcx
cmpl 0x10(%rcx), %eax
je 0x17b0
leaq 0x88a(%rip), %rax       # 0x2008
movl (%rax), %eax
movl %eax, -0x8(%rbp)
movq -0xb0(%rbp), %rax
movq (%rax), %rsi
movq -0xb0(%rbp), %rax
movq 0x8(%rax), %rdx
movq -0xb0(%rbp), %rax
movl 0x10(%rax), %ecx
leaq 0x937(%rip), %rdi       # 0x20e0
movb $0x0, %al
callq 0x1300
jmp 0x17b2
movl -0xa8(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xa8(%rbp)
jmp 0x1724
cmpl $0x0, -0x8(%rbp)
je 0x17e3
leaq 0x93a(%rip), %rdi       # 0x210d
movb $0x0, %al
callq 0x13c0
movl $0x0, -0x4(%rbp)
jmp 0x17f8
leaq 0x938(%rip), %rdi       # 0x2122
movb $0x0, %al
callq 0x1300
movl $0x1, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0xc0, %rsp
popq %rbp
retq