// File: /workspace/github_c_makefile_star2_O0/JulStrat[P]bams/bams_app.c
// Function: main
int
main(int argc, char *argv[])
{
    int a, b;
    size_t i;
    int min_key = INT_MAX, max_key = INT_MIN;
    BAMS *bas;
    size_t less = 0;
    size_t equal = 0;
    size_t great = 0;

    size_t less_a = 0;
    size_t equal_a = 0;
    size_t great_a = 0;
    size_t all_a = 0;

    int *less_keys;
    int *equal_keys;
    int *great_keys;
    int *all_keys;

    srand(time(NULL));
    for (i = 0; i < ARR_SZ; i++) {
        arint[i] = rand();
        if (arint[i] < min_key) {
            min_key = arint[i];
        }
        if (arint[i] > max_key) {
            max_key = arint[i];
        }
    }

    bas = bams_create(sizeof (int), cmp_int);

    for (i = 0; i < ARR_SZ; i++) {
        bams_insert(bas, &arint[i]);
    }

#if 0
    for (i = 0; i < ARR_SZ; i++) {
        if (0 == bams_contains(bas, &arint[i])) {
            printf("Error: %d not in set.\n", arint[i]);
            break;
        };
    }
#endif

    a = arint[0];
    for (i = 0; i < ARR_SZ; i++) {
        if (arint[i] < a) {
            less++;
        } else if (arint[i] > a) {
            great++;
        } else {
            equal++;
        }
    }
    assert(less == bams_count_less(bas, &a));
    printf("Less than %d: Expected %lu, %lu\n", a, less,
           bams_count_less(bas, &a));

    assert(equal == bams_count_equal(bas, &a));
    printf("Equal to %d: Expected %lu, %lu\n", a, equal,
           bams_count_equal(bas, &a));

    assert(great == bams_count_great(bas, &a));
    printf("Great than %d: Expected %lu, %lu\n", a, great,
           bams_count_great(bas, &a));

    assert(*(int *) bams_min(bas) == min_key);
    printf("Min key: %d, expected: %d\n", *(int *) bams_min(bas), min_key);

    assert(*(int *) bams_max(bas) == max_key);
    printf("Max key: %d, expected: %d\n", *(int *) bams_max(bas), max_key);

    less_keys = bams_less(bas, &a, &less_a);
    assert(less == less_a);
    for (i = 0; i < less_a; i++) {
        assert(less_keys[i] < a);
    }
    free(less_keys);

    equal_keys = bams_equal(bas, &a, &equal_a);
    printf("Equal: %lu, %lu\n", equal, equal_a);
    assert(equal == equal_a);
    for (i = 0; i < equal_a; i++) {
        assert(equal_keys[i] == a);
    }
    free(equal_keys);

    great_keys = bams_great(bas, &a, &great_a);
    assert(great == great_a);
    for (i = 0; i < great_a; i++) {
        assert(great_keys[i] > a);
    }
    free(great_keys);

    all_keys = bams_array(bas, &all_a);
    assert(ARR_SZ == all_a);
    for (i = 1; i < all_a; i++) {
        assert(all_keys[i] >= all_keys[i - 1]);
    }
    free(all_keys);

    printf("Set size: %lu\n", bams_size(bas));
    printf("Check structure result: %d\n", bams_check_structure(bas));
    bams_free(bas);

    /*
     * big set 
     */
    /*
     * bas = bams_create(sizeof (int), cmp_int); for (i = 0; i < 1024 *
     * 1024 * 32; i++) { a = rand(); bams_insert(bas, &a); } printf("Set
     * size: %lu\n", bams_size(bas)); printf("Check structure result:
     * %d\n", bams_check_structure(bas)); bams_free(bas); 
     */
    return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xd0, %rsp
movl $0x0, -0x4(%rbp)
movl %edi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl $0x7fffffff, -0x24(%rbp) # imm = 0x7FFFFFFF
movl $0x80000000, -0x28(%rbp) # imm = 0x80000000
movq $0x0, -0x38(%rbp)
movq $0x0, -0x40(%rbp)
movq $0x0, -0x48(%rbp)
movq $0x0, -0x50(%rbp)
movq $0x0, -0x58(%rbp)
movq $0x0, -0x60(%rbp)
movq $0x0, -0x68(%rbp)
xorl %eax, %eax
movl %eax, %edi
callq 0x1080
movl %eax, %edi
callq 0x1060
movq $0x0, -0x20(%rbp)
cmpq $0xfffff, -0x20(%rbp)   # imm = 0xFFFFF
jae 0x12fe
callq 0x10b0
movl %eax, %edx
movq -0x20(%rbp), %rcx
leaq 0x4ddd(%rip), %rax      # 0x6080
movl %edx, (%rax,%rcx,4)
movq -0x20(%rbp), %rcx
leaq 0x4dcf(%rip), %rax      # 0x6080
movl (%rax,%rcx,4), %eax
cmpl -0x24(%rbp), %eax
jge 0x12ca
movq -0x20(%rbp), %rcx
leaq 0x4dbc(%rip), %rax      # 0x6080
movl (%rax,%rcx,4), %eax
movl %eax, -0x24(%rbp)
movq -0x20(%rbp), %rcx
leaq 0x4dab(%rip), %rax      # 0x6080
movl (%rax,%rcx,4), %eax
cmpl -0x28(%rbp), %eax
jle 0x12ee
movq -0x20(%rbp), %rcx
leaq 0x4d98(%rip), %rax      # 0x6080
movl (%rax,%rcx,4), %eax
movl %eax, -0x28(%rbp)
jmp 0x12f0
movq -0x20(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x20(%rbp)
jmp 0x1287
movl $0x4, %edi
leaq -0x14a(%rip), %rsi      # 0x11c0
callq 0x1f80
movq %rax, -0x30(%rbp)
movq $0x0, -0x20(%rbp)
cmpq $0xfffff, -0x20(%rbp)   # imm = 0xFFFFF
jae 0x134e
movq -0x30(%rbp), %rdi
movq -0x20(%rbp), %rax
leaq 0x4d4c(%rip), %rsi      # 0x6080
shlq $0x2, %rax
addq %rax, %rsi
callq 0x2050
movq -0x20(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x20(%rbp)
jmp 0x131b
movl 0x4d2c(%rip), %eax      # 0x6080
movl %eax, -0x14(%rbp)
movq $0x0, -0x20(%rbp)
cmpq $0xfffff, -0x20(%rbp)   # imm = 0xFFFFF
jae 0x13c9
movq -0x20(%rbp), %rcx
leaq 0x4d0c(%rip), %rax      # 0x6080
movl (%rax,%rcx,4), %eax
cmpl -0x14(%rbp), %eax
jge 0x138a
movq -0x38(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x38(%rbp)
jmp 0x13b9
movq -0x20(%rbp), %rcx
leaq 0x4ceb(%rip), %rax      # 0x6080
movl (%rax,%rcx,4), %eax
cmpl -0x14(%rbp), %eax
jle 0x13ab
movq -0x48(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x48(%rbp)
jmp 0x13b7
movq -0x40(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x40(%rbp)
jmp 0x13b9
jmp 0x13bb
movq -0x20(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x20(%rbp)
jmp 0x135f
movq -0x38(%rbp), %rax
movq %rax, -0x90(%rbp)
movq -0x30(%rbp), %rdi
leaq -0x14(%rbp), %rsi
callq 0x2550
movq %rax, %rcx
movq -0x90(%rbp), %rax
cmpq %rcx, %rax
jne 0x13f2
jmp 0x1411
leaq 0x2c0b(%rip), %rdi      # 0x4004
leaq 0x2c25(%rip), %rsi      # 0x4025
movl $0x56, %edx
leaq 0x2c24(%rip), %rcx      # 0x4030
callq 0x1050
movl -0x14(%rbp), %eax
movl %eax, -0xa4(%rbp)
movq -0x38(%rbp), %rax
movq %rax, -0xa0(%rbp)
movq -0x30(%rbp), %rdi
leaq -0x14(%rbp), %rsi
callq 0x2550
movl -0xa4(%rbp), %esi
movq -0xa0(%rbp), %rdx
movq %rax, %rcx
leaq 0x2bfe(%rip), %rdi      # 0x4047
movb $0x0, %al
callq 0x1040
movq -0x40(%rbp), %rax
movq %rax, -0x98(%rbp)
movq -0x30(%rbp), %rdi
leaq -0x14(%rbp), %rsi
callq 0x2690
movq %rax, %rcx
movq -0x98(%rbp), %rax
cmpq %rcx, %rax
jne 0x1479
jmp 0x1498
leaq 0x2be8(%rip), %rdi      # 0x4068
leaq 0x2b9e(%rip), %rsi      # 0x4025
movl $0x5a, %edx
leaq 0x2b9d(%rip), %rcx      # 0x4030
callq 0x1050
movl -0x14(%rbp), %eax
movl %eax, -0xbc(%rbp)
movq -0x40(%rbp), %rax
movq %rax, -0xb8(%rbp)
movq -0x30(%rbp), %rdi
leaq -0x14(%rbp), %rsi
callq 0x2690
movl -0xbc(%rbp), %esi
movq -0xb8(%rbp), %rdx
movq %rax, %rcx
leaq 0x2bbb(%rip), %rdi      # 0x408b
movb $0x0, %al
callq 0x1040
movq -0x48(%rbp), %rax
movq %rax, -0xb0(%rbp)
movq -0x30(%rbp), %rdi
leaq -0x14(%rbp), %rsi
callq 0x27f0
movq %rax, %rcx
movq -0xb0(%rbp), %rax
cmpq %rcx, %rax
jne 0x1500
jmp 0x151f
leaq 0x2ba4(%rip), %rdi      # 0x40ab
leaq 0x2b17(%rip), %rsi      # 0x4025
movl $0x5e, %edx
leaq 0x2b16(%rip), %rcx      # 0x4030
callq 0x1050
movl -0x14(%rbp), %eax
movl %eax, -0xcc(%rbp)
movq -0x48(%rbp), %rax
movq %rax, -0xc8(%rbp)
movq -0x30(%rbp), %rdi
leaq -0x14(%rbp), %rsi
callq 0x27f0
movl -0xcc(%rbp), %esi
movq -0xc8(%rbp), %rdx
movq %rax, %rcx
leaq 0x2b77(%rip), %rdi      # 0x40ce
movb $0x0, %al
callq 0x1040
movq -0x30(%rbp), %rdi
callq 0x22b0
movl (%rax), %eax
cmpl -0x24(%rbp), %eax
jne 0x1570
jmp 0x158f
leaq 0x2b79(%rip), %rdi      # 0x40f0
leaq 0x2aa7(%rip), %rsi      # 0x4025
movl $0x62, %edx
leaq 0x2aa6(%rip), %rcx      # 0x4030
callq 0x1050
movq -0x30(%rbp), %rdi
callq 0x22b0
movl (%rax), %esi
movl -0x24(%rbp), %edx
leaq 0x2b6e(%rip), %rdi      # 0x4112
movb $0x0, %al
callq 0x1040
movq -0x30(%rbp), %rdi
callq 0x23e0
movl (%rax), %eax
cmpl -0x28(%rbp), %eax
jne 0x15bd
jmp 0x15dc
leaq 0x2b69(%rip), %rdi      # 0x412d
leaq 0x2a5a(%rip), %rsi      # 0x4025
movl $0x65, %edx
leaq 0x2a59(%rip), %rcx      # 0x4030
callq 0x1050
movq -0x30(%rbp), %rdi
callq 0x23e0
movl (%rax), %esi
movl -0x28(%rbp), %edx
leaq 0x2b5e(%rip), %rdi      # 0x414f
movb $0x0, %al
callq 0x1040
movq -0x30(%rbp), %rdi
leaq -0x14(%rbp), %rsi
leaq -0x50(%rbp), %rdx
callq 0x2940
movq %rax, -0x70(%rbp)
movq -0x38(%rbp), %rax
cmpq -0x50(%rbp), %rax
jne 0x1619
jmp 0x1638
leaq 0x2b4a(%rip), %rdi      # 0x416a
leaq 0x29fe(%rip), %rsi      # 0x4025
movl $0x69, %edx
leaq 0x29fd(%rip), %rcx      # 0x4030
callq 0x1050
movq $0x0, -0x20(%rbp)
movq -0x20(%rbp), %rax
cmpq -0x50(%rbp), %rax
jae 0x168b
movq -0x70(%rbp), %rax
movq -0x20(%rbp), %rcx
movl (%rax,%rcx,4), %eax
cmpl -0x14(%rbp), %eax
jge 0x165c
jmp 0x167b
leaq 0x2b16(%rip), %rdi      # 0x4179
leaq 0x29bb(%rip), %rsi      # 0x4025
movl $0x6b, %edx
leaq 0x29ba(%rip), %rcx      # 0x4030
callq 0x1050
jmp 0x167d
movq -0x20(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x20(%rbp)
jmp 0x1640
movq -0x70(%rbp), %rdi
callq 0x1030
movq -0x30(%rbp), %rdi
leaq -0x14(%rbp), %rsi
leaq -0x58(%rbp), %rdx
callq 0x2b00
movq %rax, -0x78(%rbp)
movq -0x40(%rbp), %rsi
movq -0x58(%rbp), %rdx
leaq 0x2ad2(%rip), %rdi      # 0x418a
movb $0x0, %al
callq 0x1040
movq -0x40(%rbp), %rax
cmpq -0x58(%rbp), %rax
jne 0x16cb
jmp 0x16ea
leaq 0x2ac9(%rip), %rdi      # 0x419b
leaq 0x294c(%rip), %rsi      # 0x4025
movl $0x71, %edx
leaq 0x294b(%rip), %rcx      # 0x4030
callq 0x1050
movq $0x0, -0x20(%rbp)
movq -0x20(%rbp), %rax
cmpq -0x58(%rbp), %rax
jae 0x173d
movq -0x78(%rbp), %rax
movq -0x20(%rbp), %rcx
movl (%rax,%rcx,4), %eax
cmpl -0x14(%rbp), %eax
jne 0x170e
jmp 0x172d
leaq 0x2a97(%rip), %rdi      # 0x41ac
leaq 0x2909(%rip), %rsi      # 0x4025
movl $0x73, %edx
leaq 0x2908(%rip), %rcx      # 0x4030
callq 0x1050
jmp 0x172f
movq -0x20(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x20(%rbp)
jmp 0x16f2
movq -0x78(%rbp), %rdi
callq 0x1030
movq -0x30(%rbp), %rdi
leaq -0x14(%rbp), %rsi
leaq -0x60(%rbp), %rdx
callq 0x2d20
movq %rax, -0x80(%rbp)
movq -0x48(%rbp), %rax
cmpq -0x60(%rbp), %rax
jne 0x1767
jmp 0x1786
leaq 0x2a51(%rip), %rdi      # 0x41bf
leaq 0x28b0(%rip), %rsi      # 0x4025
movl $0x78, %edx
leaq 0x28af(%rip), %rcx      # 0x4030
callq 0x1050
movq $0x0, -0x20(%rbp)
movq -0x20(%rbp), %rax
cmpq -0x60(%rbp), %rax
jae 0x17d9
movq -0x80(%rbp), %rax
movq -0x20(%rbp), %rcx
movl (%rax,%rcx,4), %eax
cmpl -0x14(%rbp), %eax
jle 0x17aa
jmp 0x17c9
leaq 0x2a1f(%rip), %rdi      # 0x41d0
leaq 0x286d(%rip), %rsi      # 0x4025
movl $0x7a, %edx
leaq 0x286c(%rip), %rcx      # 0x4030
callq 0x1050
jmp 0x17cb
movq -0x20(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x20(%rbp)
jmp 0x178e
movq -0x80(%rbp), %rdi
callq 0x1030
movq -0x30(%rbp), %rdi
leaq -0x68(%rbp), %rsi
callq 0x2ef0
movq %rax, -0x88(%rbp)
movl $0xfffff, %eax          # imm = 0xFFFFF
cmpq -0x68(%rbp), %rax
jne 0x1803
jmp 0x1822
leaq 0x29d8(%rip), %rdi      # 0x41e2
leaq 0x2814(%rip), %rsi      # 0x4025
movl $0x7f, %edx
leaq 0x2813(%rip), %rcx      # 0x4030
callq 0x1050
movq $0x1, -0x20(%rbp)
movq -0x20(%rbp), %rax
cmpq -0x68(%rbp), %rax
jae 0x1887
movq -0x88(%rbp), %rax
movq -0x20(%rbp), %rcx
movl (%rax,%rcx,4), %eax
movq -0x88(%rbp), %rcx
movq -0x20(%rbp), %rdx
subq $0x1, %rdx
cmpl (%rcx,%rdx,4), %eax
jl 0x1858
jmp 0x1877
leaq 0x2993(%rip), %rdi      # 0x41f2
leaq 0x27bf(%rip), %rsi      # 0x4025
movl $0x81, %edx
leaq 0x27be(%rip), %rcx      # 0x4030
callq 0x1050
jmp 0x1879
movq -0x20(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x20(%rbp)
jmp 0x182a
movq -0x88(%rbp), %rdi
callq 0x1030
movq -0x30(%rbp), %rdi
callq 0x2fe0
movq %rax, %rsi
leaq 0x296b(%rip), %rdi      # 0x4211
movb $0x0, %al
callq 0x1040
movq -0x30(%rbp), %rdi
callq 0x3160
movl %eax, %esi
leaq 0x2961(%rip), %rdi      # 0x4220
movb $0x0, %al
callq 0x1040
movq -0x30(%rbp), %rdi
callq 0x30d0
xorl %eax, %eax
addq $0xd0, %rsp
popq %rbp
retq
nopw (%rax,%rax)