// File: /workspace/github_c_makefile_star2_O0/JulStrat[P]bams/./sh_merge.h
// Function: merge_into
void *
merge_into(void *dst, size_t num_el_dst,
           const void *src, size_t num_el_src,
           size_t el_size, int (*compare) (const void *, const void *))
{
    char *dl;
    char *sl = (char *) src;
    char *dc;
    char *sc = sl + (num_el_src * el_size);
    char *r = NULL;
    char *rc = NULL;

    ASSERT_MERGE_ARGS();

    r = (char *) realloc(dst, (num_el_dst + num_el_src) * el_size);
    if (!r || !((num_el_dst + num_el_src) * el_size)) {
        return NULL;
    }
    rc = r + (num_el_dst + num_el_src) * el_size;

    dl = (char *) r;
    dc = dl + (num_el_dst * el_size);

    while ((dl < dc) && (sl < sc)) {
        if ((*compare) (dc - el_size, sc - el_size) > 0) {
            memcpy(rc - el_size, dc - el_size, el_size);
            dc -= el_size;
        } else {
            memcpy(rc - el_size, sc - el_size, el_size);
            sc -= el_size;
        }
        rc -= el_size;
    }

    if (sl < sc) {
        memcpy(r, sl, sc - sl);
    }

    return r;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x70, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movq %rcx, -0x28(%rbp)
movq %r8, -0x30(%rbp)
movq %r9, -0x38(%rbp)
movq -0x20(%rbp), %rax
movq %rax, -0x48(%rbp)
movq -0x48(%rbp), %rax
movq -0x28(%rbp), %rcx
imulq -0x30(%rbp), %rcx
addq %rcx, %rax
movq %rax, -0x58(%rbp)
movq $0x0, -0x60(%rbp)
movq $0x0, -0x68(%rbp)
cmpq $0x0, -0x30(%rbp)
je 0x14c5
jmp 0x14e4
leaq 0x2c74(%rip), %rdi      # 0x4140
leaq 0x2c7a(%rip), %rsi      # 0x414d
movl $0x8a, %edx
leaq 0x2cf0(%rip), %rcx      # 0x41cf
callq 0x10a0
cmpq $0x0, -0x38(%rbp)
je 0x14ed
jmp 0x150c
leaq 0x2ccb(%rip), %rdi      # 0x41bf
leaq 0x2c52(%rip), %rsi      # 0x414d
movl $0x8a, %edx
leaq 0x2cc8(%rip), %rcx      # 0x41cf
callq 0x10a0
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
addq -0x28(%rbp), %rsi
imulq -0x30(%rbp), %rsi
callq 0x1150
movq %rax, -0x60(%rbp)
cmpq $0x0, -0x60(%rbp)
je 0x1540
movq -0x18(%rbp), %rax
addq -0x28(%rbp), %rax
imulq -0x30(%rbp), %rax
cmpq $0x0, %rax
jne 0x154d
movq $0x0, -0x8(%rbp)
jmp 0x1682
movq -0x60(%rbp), %rax
movq -0x18(%rbp), %rcx
addq -0x28(%rbp), %rcx
imulq -0x30(%rbp), %rcx
addq %rcx, %rax
movq %rax, -0x68(%rbp)
movq -0x60(%rbp), %rax
movq %rax, -0x40(%rbp)
movq -0x40(%rbp), %rax
movq -0x18(%rbp), %rcx
imulq -0x30(%rbp), %rcx
addq %rcx, %rax
movq %rax, -0x50(%rbp)
movq -0x40(%rbp), %rcx
xorl %eax, %eax
cmpq -0x50(%rbp), %rcx
movb %al, -0x69(%rbp)
jae 0x159e
movq -0x48(%rbp), %rax
cmpq -0x58(%rbp), %rax
setb %al
movb %al, -0x69(%rbp)
movb -0x69(%rbp), %al
testb $0x1, %al
jne 0x15aa
jmp 0x1658
movq -0x38(%rbp), %rax
movq -0x50(%rbp), %rdi
xorl %ecx, %ecx
subq -0x30(%rbp), %rcx
addq %rcx, %rdi
movq -0x58(%rbp), %rsi
xorl %ecx, %ecx
subq -0x30(%rbp), %rcx
addq %rcx, %rsi
callq *%rax
cmpl $0x0, %eax
jle 0x1608
movq -0x68(%rbp), %rdi
xorl %eax, %eax
subq -0x30(%rbp), %rax
addq %rax, %rdi
movq -0x50(%rbp), %rsi
xorl %eax, %eax
subq -0x30(%rbp), %rax
addq %rax, %rsi
movq -0x30(%rbp), %rdx
callq 0x1110
movq -0x30(%rbp), %rdx
movq -0x50(%rbp), %rax
xorl %ecx, %ecx
subq %rdx, %rcx
addq %rcx, %rax
movq %rax, -0x50(%rbp)
jmp 0x163f
movq -0x68(%rbp), %rdi
xorl %eax, %eax
subq -0x30(%rbp), %rax
addq %rax, %rdi
movq -0x58(%rbp), %rsi
xorl %eax, %eax
subq -0x30(%rbp), %rax
addq %rax, %rsi
movq -0x30(%rbp), %rdx
callq 0x1110
movq -0x30(%rbp), %rdx
movq -0x58(%rbp), %rax
xorl %ecx, %ecx
subq %rdx, %rcx
addq %rcx, %rax
movq %rax, -0x58(%rbp)
movq -0x30(%rbp), %rdx
movq -0x68(%rbp), %rax
xorl %ecx, %ecx
subq %rdx, %rcx
addq %rcx, %rax
movq %rax, -0x68(%rbp)
jmp 0x1581
movq -0x48(%rbp), %rax
cmpq -0x58(%rbp), %rax
jae 0x167a
movq -0x60(%rbp), %rdi
movq -0x48(%rbp), %rsi
movq -0x58(%rbp), %rdx
movq -0x48(%rbp), %rax
subq %rax, %rdx
callq 0x1110
movq -0x60(%rbp), %rax
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x70, %rsp
popq %rbp
retq
nopl (%rax)