// File: /workspace/github_c_makefile_star2_O1/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 0x23ff
movq %rsi, %r14
testq %rsi, %rsi
je 0x241e
testq %rdx, %rdx
je 0x243d
movq 0x8(%rsp), %rax
movq 0x10(%rax), %r15
cmpl $0x0, 0x20(%rax)
jne 0x22de
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 0x2391
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 0x196d
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 0x1a3c
movq %rax, %r14
subq %rbx, %r14
jb 0x23c1
jbe 0x2384
addq %r13, %rax
subq %rbx, %rax
movq (%rsp), %rdi
movq %rax, %rsi
callq 0x10a0
testq %rax, %rax
je 0x23e0
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 0x2310
jmp 0x239c
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 0x11d0(%rip), %rdi      # 0x3598
leaq 0x105d(%rip), %rsi      # 0x342c
leaq 0x1248(%rip), %rcx      # 0x361e
movl $0x180, %edx            # imm = 0x180
callq 0x1050
leaq 0x126e(%rip), %rdi      # 0x3655
leaq 0x103e(%rip), %rsi      # 0x342c
leaq 0x1229(%rip), %rcx      # 0x361e
movl $0x183, %edx            # imm = 0x183
callq 0x1050
leaq 0x106c(%rip), %rdi      # 0x3472
leaq 0x101f(%rip), %rsi      # 0x342c
leaq 0x120a(%rip), %rcx      # 0x361e
movl $0x16f, %edx            # imm = 0x16F
callq 0x1050
leaq 0x107f(%rip), %rdi      # 0x34a4
leaq 0x1000(%rip), %rsi      # 0x342c
leaq 0x11eb(%rip), %rcx      # 0x361e
movl $0x170, %edx            # imm = 0x170
callq 0x1050
leaq 0x11ca(%rip), %rdi      # 0x360e
leaq 0xfe1(%rip), %rsi       # 0x342c
leaq 0x11cc(%rip), %rcx      # 0x361e
movl $0x171, %edx            # imm = 0x171
callq 0x1050