// File: /workspace/github_c_makefile_star2_O2/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, (%rsp)
testq %rdi, %rdi
je 0x232a
movq %rsi, %r14
testq %rsi, %rsi
je 0x2349
testq %rdx, %rdx
je 0x2368
movq (%rsp), %rax
cmpl $0x0, 0x20(%rax)
jne 0x220c
leaq 0x20(%rsp), %rax
movq %r14, (%rax)
movq %rax, %r14
movq (%rsp), %rax
movq (%rax), %rcx
movq %rcx, 0x8(%rsp)
movq 0x10(%rax), %r15
movq %rdx, 0x18(%rsp)
andq $0x0, (%rdx)
xorl %r13d, %r13d
xorl %ebp, %ebp
testq %r15, %r15
je 0x22c8
movq %r13, 0x10(%rsp)
movq %rbp, %r13
movq 0x8(%r15), %rdx
movq 0x10(%r15), %rsi
movq (%rsp), %r12
movq 0x8(%r12), %r8
movq %r14, %rdi
movq 0x8(%rsp), %rbp
movq %rbp, %rcx
callq 0x18f8
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 0x19bb
movq %rax, %r14
subq %rbx, %r14
jb 0x22ec
movq %r13, %rbp
jbe 0x22b8
addq %rbp, %rax
subq %rbx, %rax
movq 0x10(%rsp), %rdi
movq %rax, %rsi
callq 0x10a0
testq %rax, %rax
je 0x230b
movq %rax, %r13
movq %rax, %rdi
addq %rbp, %rdi
movq %rbx, %rsi
movq %r14, %rdx
callq 0x1070
addq %r14, %rbp
jmp 0x22bd
movq 0x10(%rsp), %r13
movq (%r15), %r15
movq %r12, %r14
jmp 0x222a
movq %rbp, %rax
xorl %edx, %edx
divq 0x8(%rsp)
movq 0x18(%rsp), %rcx
movq %rax, (%rcx)
movq %r13, %rax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x12a5(%rip), %rdi      # 0x3598
leaq 0x1132(%rip), %rsi      # 0x342c
leaq 0x131d(%rip), %rcx      # 0x361e
movl $0x180, %edx            # imm = 0x180
callq 0x1050
leaq 0x1343(%rip), %rdi      # 0x3655
leaq 0x1113(%rip), %rsi      # 0x342c
leaq 0x12fe(%rip), %rcx      # 0x361e
movl $0x183, %edx            # imm = 0x183
callq 0x1050
leaq 0x1141(%rip), %rdi      # 0x3472
leaq 0x10f4(%rip), %rsi      # 0x342c
leaq 0x12df(%rip), %rcx      # 0x361e
movl $0x16f, %edx            # imm = 0x16F
callq 0x1050
leaq 0x1154(%rip), %rdi      # 0x34a4
leaq 0x10d5(%rip), %rsi      # 0x342c
leaq 0x12c0(%rip), %rcx      # 0x361e
movl $0x170, %edx            # imm = 0x170
callq 0x1050
leaq 0x129f(%rip), %rdi      # 0x360e
leaq 0x10b6(%rip), %rsi      # 0x342c
leaq 0x12a1(%rip), %rcx      # 0x361e
movl $0x171, %edx            # imm = 0x171
callq 0x1050