// File: /workspace/github_c_makefile_star2_O0/JulStrat[P]bams/bams.c
// Function: bams_insert
int
bams_insert(BAMS * set, const void *key)
{
    SET_NODE *curr;
    /** void *keys; */
    void *t;
    /** size_t length = 1; */
    SET_NODE *node;
    SET_NODE *next;

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

    curr = set->head;
    node = make_node(set, key);
    if (!node) {
        return 0;
    }

    node->next = curr;
    set->head = node;
    set->size += 1;

    /*
     * Normalize 
     */
    while (curr != NULL) {
        if ((node->length) >= (curr->length)) {
            next = curr->next;

            t = merge_into(curr->keys, curr->length, node->keys,
                           node->length, set->key_size, set->compare);
            if (NULL == t) {
                return 1;       /*
                                 * return norm error ! 
                                 */
            }
            curr->keys = t;
            curr->length += node->length;
            set->head = curr;

            /*
             * free node 
             */
            free(node->keys);
            free(node);

            node = curr;
            curr = next;
        } else
            break;
    }
    return 1;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
xorl %eax, %eax
cmpq -0x10(%rbp), %rax
je 0x206a
jmp 0x2089
leaq 0x2401(%rip), %rdi      # 0x4472
leaq 0x23b4(%rip), %rsi      # 0x442c
movl $0x71, %edx
leaq 0x23fa(%rip), %rcx      # 0x447e
callq 0x1050
xorl %eax, %eax
cmpq -0x18(%rbp), %rax
je 0x2093
jmp 0x20b2
leaq 0x240a(%rip), %rdi      # 0x44a4
leaq 0x238b(%rip), %rsi      # 0x442c
movl $0x72, %edx
leaq 0x23d1(%rip), %rcx      # 0x447e
callq 0x1050
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
movq %rax, -0x20(%rbp)
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
callq 0x21f0
movq %rax, -0x30(%rbp)
cmpq $0x0, -0x30(%rbp)
jne 0x20e2
movl $0x0, -0x4(%rbp)
jmp 0x21e0
movq -0x20(%rbp), %rcx
movq -0x30(%rbp), %rax
movq %rcx, (%rax)
movq -0x30(%rbp), %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x10(%rax)
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rcx
addq $0x1, %rcx
movq %rcx, 0x18(%rax)
cmpq $0x0, -0x20(%rbp)
je 0x21d9
movq -0x30(%rbp), %rax
movq 0x8(%rax), %rax
movq -0x20(%rbp), %rcx
cmpq 0x8(%rcx), %rax
jb 0x21d2
movq -0x20(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x38(%rbp)
movq -0x20(%rbp), %rax
movq 0x10(%rax), %rdi
movq -0x20(%rbp), %rax
movq 0x8(%rax), %rsi
movq -0x30(%rbp), %rax
movq 0x10(%rax), %rdx
movq -0x30(%rbp), %rax
movq 0x8(%rax), %rcx
movq -0x10(%rbp), %rax
movq (%rax), %r8
movq -0x10(%rbp), %rax
movq 0x8(%rax), %r9
callq 0x1ac0
movq %rax, -0x28(%rbp)
xorl %eax, %eax
cmpq -0x28(%rbp), %rax
jne 0x217e
movl $0x1, -0x4(%rbp)
jmp 0x21e0
movq -0x28(%rbp), %rcx
movq -0x20(%rbp), %rax
movq %rcx, 0x10(%rax)
movq -0x30(%rbp), %rax
movq 0x8(%rax), %rcx
movq -0x20(%rbp), %rax
addq 0x8(%rax), %rcx
movq %rcx, 0x8(%rax)
movq -0x20(%rbp), %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x10(%rax)
movq -0x30(%rbp), %rax
movq 0x10(%rax), %rdi
callq 0x1030
movq -0x30(%rbp), %rdi
callq 0x1030
movq -0x20(%rbp), %rax
movq %rax, -0x30(%rbp)
movq -0x38(%rbp), %rax
movq %rax, -0x20(%rbp)
jmp 0x21d4
jmp 0x21d9
jmp 0x2109
movl $0x1, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x40, %rsp
popq %rbp
retq
nopl (%rax)