// File: /workspace/github_c_makefile_star2_O3/JulStrat[P]bams/tests/test_merge.c
// Function: do_merge_test
TEST
do_merge_test(int c)
{
    size_t i;
    void *la, *ra, *r;

    for (i = 0; i < ARR_SZ; i++) {
        arint[i] = rand();
    }

    qsort(&arint[0], c, sizeof (int), cmp_int);
    qsort(&arint[c], ARR_SZ - c, sizeof (int), cmp_int);

    la = malloc(c * sizeof (int));
    ra = malloc((ARR_SZ - c) * sizeof (int));

    memcpy(la, &arint[0], c * sizeof (int));
    memcpy(ra, &arint[c], (ARR_SZ - c) * sizeof (int));

    r = merge(la, c, ra, ARR_SZ - c, sizeof (int), cmp_int);

    ASSERT(r);

    qsort(&arint[0], ARR_SZ, sizeof (int), cmp_int);
    ASSERT_MEM_EQ(&arint[0], r, ARR_SZ * sizeof (int));

    free(la);
    free(ra);
    free(r);

    PASS();
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movl %edi, %ebp
xorl %r14d, %r14d
leaq 0x38a5(%rip), %rbx      # 0x5120
callq 0x1190
movl %eax, (%r14,%rbx)
addq $0x4, %r14
cmpq $0x1e3ec, %r14          # imm = 0x1E3EC
jne 0x187b
movl %ebp, %r14d
leaq -0x2ca(%rip), %r15      # 0x15d1
movl $0x4, %edx
movq %rbx, %rdi
movq %r14, %rsi
movq %r15, %rcx
callq 0x1060
leaq (%rbx,%r14,4), %r13
movl $0x78fb, %r12d          # imm = 0x78FB
subl %ebp, %r12d
movl $0x4, %edx
movq %r13, %rdi
movq %r12, %rsi
movq %r15, %rcx
callq 0x1060
leaq (,%r14,4), %r15
movq %r15, %rdi
callq 0x1130
movl %ebp, 0xc(%rsp)
movq %rax, %rbp
shll $0x2, %r12d
movq %r12, %rdi
callq 0x1130
movq %rbp, %rdi
movq %rbx, %rsi
movq %r15, %rdx
movq %rax, %r15
callq 0x1110
movq %r15, %rdi
movq %r13, %rsi
movq %r12, %rdx
callq 0x1110
movl $0x1e3ec, %edi          # imm = 0x1E3EC
callq 0x1130
testq %rax, %rax
je 0x1a3b
movq %rax, %r13
leaq (,%r14,4), %rax
addq %rbp, %rax
addq %r15, %r12
movl 0xc(%rsp), %r9d
cmpl $0x78fb, %r9d           # imm = 0x78FB
setne %r8b
testl %r9d, %r9d
setne %dl
movq %r15, %rsi
movq %rbp, %rcx
movq %r13, %rdi
je 0x19a4
cmpl $0x78fb, %r9d           # imm = 0x78FB
je 0x19a4
movq %r13, %rdi
movq %rbp, %rcx
movq %r15, %rsi
movl (%rcx), %edx
movl (%rsi), %r8d
xorl %r9d, %r9d
xorl %r10d, %r10d
cmpl %r8d, %edx
setle %r9b
setg %r10b
cmovll %edx, %r8d
leaq (%rsi,%r10,4), %rsi
leaq (%rcx,%r9,4), %rcx
movl %r8d, (%rdi)
addq $0x4, %rdi
cmpq %r12, %rsi
setb %r8b
cmpq %rax, %rcx
setb %dl
jae 0x19a4
cmpq %r12, %rsi
jb 0x1967
testb %dl, %dl
jne 0x19ad
testb %r8b, %r8b
je 0x19c2
testb %dl, %dl
cmovneq %rcx, %rsi
cmovneq %rax, %r12
subq %rsi, %r12
movq %r12, %rdx
callq 0x1110
incl 0x21b8c(%rip)           # 0x23554
leaq -0x3fe(%rip), %rcx      # 0x15d1
movl $0x78fb, %esi           # imm = 0x78FB
movl $0x4, %edx
movq %rbx, %rdi
callq 0x1060
leaq 0x10(%rsp), %rcx
movq %rbx, (%rcx)
movq %r13, 0x8(%rcx)
movq $0x1e3ec, 0x10(%rcx)    # imm = 0x1E3EC
incl 0x21b59(%rip)           # 0x23554
leaq 0x36f6(%rip), %rdx      # 0x50f8
movq %rbx, %rdi
movq %r13, %rsi
callq 0x20ad
testl %eax, %eax
je 0x1a77
movq %rbp, %rdi
callq 0x1030
movq %r15, %rdi
callq 0x1030
movq %r13, %rdi
callq 0x1030
movq $0x0, 0x21b34(%rip) # 0x23568
xorl %eax, %eax
jmp 0x1abe
incl 0x21b13(%rip)           # 0x23554
leaq 0x18b2(%rip), %rax      # 0x32fa
movq %rax, 0x21b11(%rip)     # 0x23560
movl $0x32, 0x21aff(%rip)    # 0x23558
leaq 0x18dd(%rip), %rax      # 0x333d
movq %rax, 0x21b01(%rip)     # 0x23568
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
testb $0x4, 0x21a9d(%rip)     # 0x23510
je 0x1abe
jmp 0x1acd
cmpq $0x0, 0x3679(%rip)      # 0x50f8
leaq 0x1874(%rip), %rax      # 0x32fa
movq %rax, 0x21ad3(%rip)     # 0x23560
movl $0x35, 0x21ac1(%rip)    # 0x23558
je 0x1aa2
leaq 0x1890(%rip), %rax      # 0x3330
jmp 0x1aa9
leaq 0x1864(%rip), %rax      # 0x330d
movq %rax, 0x21ab8(%rip)     # 0x23568
testb $0x4, 0x21a59(%rip)     # 0x23510
jne 0x1acd
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
callq 0x1040