// File: /workspace/github_c_makefile_star2_O3/JulStrat[P]bams/bams.c
// Function: bams_equal
void *
bams_equal(const BAMS * set, const void *key, size_t *key_num)
{
    SET_NODE *curr;
    size_t key_size;
    char *low, *high;
    char *r = NULL;
    size_t equal = 0;
    const void *tkey;

    assert(NULL != set);
    assert(NULL != key);
    assert(NULL != key_num);

    curr = set->head;
    key_size = set->key_size;

    if (set->type == COPY_POINTER) {
        POINTER_ADDR(key, tkey);
    }

    *key_num = 0;
    while (NULL != curr) {
        low = (char *) bisect_left(key, curr->keys, curr->length,
                                   key_size, set->compare);
        high = (char *) bisect_right(key, curr->keys, curr->length,
                                     key_size, set->compare);
        assert(high >= low);
        if (high > low) {
            r = realloc(r, equal + high - low);
            assert(NULL != r);
            memcpy(r + equal, low, high - low);
            equal += high - low;
        }

        curr = curr->next;
    }
    *key_num = (size_t) (equal / key_size);

    return r;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rdi, 0x8(%rsp)
testq %rdi, %rdi
je 0x23f0
movq %rsi, %r14
testq %rsi, %rsi
je 0x240f
testq %rdx, %rdx
je 0x242e
movq 0x8(%rsp), %rax
movq 0x10(%rax), %r15
cmpl $0x0, 0x20(%rax)
jne 0x22cf
leaq 0x20(%rsp), %rax
movq %r14, (%rax)
movq %rax, %r14
movq 0x8(%rsp), %rax
movq (%rax), %rax
movq %rax, 0x10(%rsp)
movq $0x0, (%rdx)
testq %r15, %r15
movq %rdx, 0x18(%rsp)
je 0x2382
xorl %r13d, %r13d
movq $0x0, (%rsp)
movq 0x10(%rsp), %rbp
movq 0x8(%r15), %rdx
movq 0x10(%r15), %rsi
movq 0x8(%rsp), %r12
movq 0x8(%r12), %r8
movq %r14, %rdi
movq %rbp, %rcx
callq 0x1969
movq %rax, %rbx
movq 0x8(%r15), %rdx
movq 0x10(%r15), %rsi
movq 0x8(%r12), %r8
movq %r14, %r12
movq %r14, %rdi
movq %rbp, %rcx
callq 0x1a38
movq %rax, %r14
subq %rbx, %r14
jb 0x23b2
jbe 0x2375
addq %r13, %rax
subq %rbx, %rax
movq (%rsp), %rdi
movq %rax, %rsi
callq 0x10a0
testq %rax, %rax
je 0x23d1
movq %rax, (%rsp)
movq %rax, %rdi
addq %r13, %rdi
movq %rbx, %rsi
movq %r14, %rdx
callq 0x1070
addq %r14, %r13
movq (%r15), %r15
testq %r15, %r15
movq %r12, %r14
jne 0x2301
jmp 0x238d
movq $0x0, (%rsp)
xorl %r13d, %r13d
movq %r13, %rax
xorl %edx, %edx
divq 0x10(%rsp)
movq 0x18(%rsp), %rcx
movq %rax, (%rcx)
movq (%rsp), %rax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x11df(%rip), %rdi      # 0x3598
leaq 0x106c(%rip), %rsi      # 0x342c
leaq 0x1257(%rip), %rcx      # 0x361e
movl $0x180, %edx            # imm = 0x180
callq 0x1050
leaq 0x127d(%rip), %rdi      # 0x3655
leaq 0x104d(%rip), %rsi      # 0x342c
leaq 0x1238(%rip), %rcx      # 0x361e
movl $0x183, %edx            # imm = 0x183
callq 0x1050
leaq 0x107b(%rip), %rdi      # 0x3472
leaq 0x102e(%rip), %rsi      # 0x342c
leaq 0x1219(%rip), %rcx      # 0x361e
movl $0x16f, %edx            # imm = 0x16F
callq 0x1050
leaq 0x108e(%rip), %rdi      # 0x34a4
leaq 0x100f(%rip), %rsi      # 0x342c
leaq 0x11fa(%rip), %rcx      # 0x361e
movl $0x170, %edx            # imm = 0x170
callq 0x1050
leaq 0x11d9(%rip), %rdi      # 0x360e
leaq 0xff0(%rip), %rsi       # 0x342c
leaq 0x11db(%rip), %rcx      # 0x361e
movl $0x171, %edx            # imm = 0x171
callq 0x1050