// File: /workspace/github_c_makefile_star2_O0/JulStrat[P]bams/./sh_merge.h
// Function: merge
void *
merge(const void *arr_a, size_t num_el_a,
      const void *arr_b, size_t num_el_b,
      size_t el_size, int (*compare) (const void *, const void *))
{
    char *ac = (char *) arr_a;
    char *bc = (char *) arr_b;
    char *ah = ac + (num_el_a * el_size);
    char *bh = bc + (num_el_b * el_size);
    char *r = NULL;
    char *rc = NULL;

    ASSERT_MERGE_ARGS();

    r = (char *) malloc((num_el_a + num_el_b) * el_size);
    if (!r || !((num_el_a + num_el_b) * el_size)) {
        return NULL;
    }
    rc = r;

    while ((ac < ah) && (bc < bh)) {
        if ((*compare) (ac, bc) > 0) {
            memcpy(rc, bc, el_size);
            bc += el_size;
        } else {
            memcpy(rc, ac, el_size);
            ac += el_size;
        }
        rc += el_size;
    }

    if (ac < ah) {
        memcpy(rc, ac, ah - ac);
    } else if (bc < bh) {
        memcpy(rc, bc, bh - bc);
    }

    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 -0x10(%rbp), %rax
movq %rax, -0x40(%rbp)
movq -0x20(%rbp), %rax
movq %rax, -0x48(%rbp)
movq -0x40(%rbp), %rax
movq -0x18(%rbp), %rcx
imulq -0x30(%rbp), %rcx
addq %rcx, %rax
movq %rax, -0x50(%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 0x1301
jmp 0x1320
leaq 0x2e38(%rip), %rdi      # 0x4140
leaq 0x2e3e(%rip), %rsi      # 0x414d
movl $0x62, %edx
leaq 0x2e3f(%rip), %rcx      # 0x415a
callq 0x10a0
cmpq $0x0, -0x38(%rbp)
je 0x1329
jmp 0x1348
leaq 0x2e8f(%rip), %rdi      # 0x41bf
leaq 0x2e16(%rip), %rsi      # 0x414d
movl $0x62, %edx
leaq 0x2e17(%rip), %rcx      # 0x415a
callq 0x10a0
movq -0x18(%rbp), %rdi
addq -0x28(%rbp), %rdi
imulq -0x30(%rbp), %rdi
callq 0x1130
movq %rax, -0x60(%rbp)
cmpq $0x0, -0x60(%rbp)
je 0x1378
movq -0x18(%rbp), %rax
addq -0x28(%rbp), %rax
imulq -0x30(%rbp), %rax
cmpq $0x0, %rax
jne 0x1385
movq $0x0, -0x8(%rbp)
jmp 0x1463
movq -0x60(%rbp), %rax
movq %rax, -0x68(%rbp)
movq -0x40(%rbp), %rcx
xorl %eax, %eax
cmpq -0x50(%rbp), %rcx
movb %al, -0x69(%rbp)
jae 0x13aa
movq -0x48(%rbp), %rax
cmpq -0x58(%rbp), %rax
setb %al
movb %al, -0x69(%rbp)
movb -0x69(%rbp), %al
testb $0x1, %al
jne 0x13b3
jmp 0x1413
movq -0x38(%rbp), %rax
movq -0x40(%rbp), %rdi
movq -0x48(%rbp), %rsi
callq *%rax
cmpl $0x0, %eax
jle 0x13e5
movq -0x68(%rbp), %rdi
movq -0x48(%rbp), %rsi
movq -0x30(%rbp), %rdx
callq 0x1110
movq -0x30(%rbp), %rax
addq -0x48(%rbp), %rax
movq %rax, -0x48(%rbp)
jmp 0x1402
movq -0x68(%rbp), %rdi
movq -0x40(%rbp), %rsi
movq -0x30(%rbp), %rdx
callq 0x1110
movq -0x30(%rbp), %rax
addq -0x40(%rbp), %rax
movq %rax, -0x40(%rbp)
movq -0x30(%rbp), %rax
addq -0x68(%rbp), %rax
movq %rax, -0x68(%rbp)
jmp 0x138d
movq -0x40(%rbp), %rax
cmpq -0x50(%rbp), %rax
jae 0x1437
movq -0x68(%rbp), %rdi
movq -0x40(%rbp), %rsi
movq -0x50(%rbp), %rdx
movq -0x40(%rbp), %rax
subq %rax, %rdx
callq 0x1110
jmp 0x145b
movq -0x48(%rbp), %rax
cmpq -0x58(%rbp), %rax
jae 0x1459
movq -0x68(%rbp), %rdi
movq -0x48(%rbp), %rsi
movq -0x58(%rbp), %rdx
movq -0x48(%rbp), %rax
subq %rax, %rdx
callq 0x1110
jmp 0x145b
movq -0x60(%rbp), %rax
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x70, %rsp
popq %rbp
retq
nopl (%rax)