// File: /workspace/github_c_makefile_star2_O1/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, %r12d
xorl %r14d, %r14d
leaq 0x4895(%rip), %rbx      # 0x6120
callq 0x1190
movl %eax, (%r14,%rbx)
addq $0x4, %r14
cmpq $0x1e3ec, %r14          # imm = 0x1E3EC
jne 0x188b
movl %r12d, %r13d
leaq -0x2da(%rip), %r15      # 0x15d1
movl $0x4, %edx
movq %rbx, %rdi
movq %r13, %rsi
movq %r15, %rcx
callq 0x1060
leaq (%rbx,%r13,4), %rdi
movq %rdi, 0x8(%rsp)
movl $0x78fb, %r14d          # imm = 0x78FB
subl %r12d, %r14d
movl $0x4, %edx
movq %r14, %rsi
movq %r15, %rcx
callq 0x1060
leaq (,%r13,4), %r15
movq %r15, %rdi
callq 0x1130
movq %rax, %rbp
shll $0x2, %r14d
movq %r14, %rdi
callq 0x1130
movq %rbp, %rdi
movq %rbx, %rsi
movq %r15, %rdx
movq %rax, %r15
callq 0x1110
movq %r15, (%rsp)
movq %r15, %rdi
movq 0x8(%rsp), %rsi
movq %r14, %rdx
callq 0x1110
movl $0x1e3ec, %edi          # imm = 0x1E3EC
callq 0x1130
testq %rax, %rax
je 0x19b2
movq %rax, %r15
leaq (,%r13,4), %rax
addq %rbp, %rax
movq (%rsp), %rdx
addq %r14, %rdx
cmpl $0x78fb, %r12d          # imm = 0x78FB
setne %r8b
testl %r12d, %r12d
setne %r9b
je 0x19b7
movq (%rsp), %rsi
movq %rbp, %rcx
movq %r15, %rdi
cmpl $0x78fb, %r12d          # imm = 0x78FB
je 0x19c1
movq %r15, %rdi
movq %rbp, %rcx
movq (%rsp), %rsi
movl (%rcx), %r8d
cmpl (%rsi), %r8d
jle 0x198d
movl (%rsi), %r8d
movl %r8d, (%rdi)
addq $0x4, %rsi
jmp 0x1997
movl (%rcx), %r8d
movl %r8d, (%rdi)
addq $0x4, %rcx
addq $0x4, %rdi
cmpq %rdx, %rsi
setb %r8b
cmpq %rax, %rcx
setb %r9b
jae 0x19c1
cmpq %rdx, %rsi
jb 0x1979
jmp 0x19c1
xorl %r15d, %r15d
jmp 0x19de
movq (%rsp), %rsi
movq %rbp, %rcx
movq %r15, %rdi
testb %r9b, %r9b
jne 0x19cb
testb %r8b, %r8b
je 0x19de
testb %r9b, %r9b
cmovneq %rcx, %rsi
cmovneq %rax, %rdx
subq %rsi, %rdx
callq 0x1110
incl 0x22b70(%rip)           # 0x24554
testq %r15, %r15
je 0x1a5a
leaq -0x41f(%rip), %rcx      # 0x15d1
movl $0x78fb, %esi           # imm = 0x78FB
movl $0x4, %edx
movq %rbx, %rdi
callq 0x1060
leaq 0x10(%rsp), %rcx
movq %rbx, (%rcx)
movq %r15, 0x8(%rcx)
movq $0x1e3ec, 0x10(%rcx)    # imm = 0x1E3EC
incl 0x22b38(%rip)           # 0x24554
leaq 0x46d5(%rip), %rdx      # 0x60f8
movq %rbx, %rdi
movq %r15, %rsi
callq 0x20de
testl %eax, %eax
je 0x1a90
movq %rbp, %rdi
callq 0x1030
movq (%rsp), %rdi
callq 0x1030
movq %r15, %rdi
callq 0x1030
movq $0x0, 0x22b12(%rip) # 0x24568
xorl %eax, %eax
jmp 0x1ad7
leaq 0x18d1(%rip), %rax      # 0x3332
movq %rax, 0x22af8(%rip)     # 0x24560
movl $0x32, 0x22ae6(%rip)    # 0x24558
leaq 0x18fc(%rip), %rax      # 0x3375
movq %rax, 0x22ae8(%rip)     # 0x24568
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
testb $0x4, 0x22a84(%rip)     # 0x24510
je 0x1ad7
jmp 0x1ae6
cmpq $0x0, 0x4660(%rip)      # 0x60f8
leaq 0x1893(%rip), %rax      # 0x3332
movq %rax, 0x22aba(%rip)     # 0x24560
movl $0x35, 0x22aa8(%rip)    # 0x24558
je 0x1abb
leaq 0x18af(%rip), %rax      # 0x3368
jmp 0x1ac2
leaq 0x1883(%rip), %rax      # 0x3345
movq %rax, 0x22a9f(%rip)     # 0x24568
testb $0x4, 0x22a40(%rip)     # 0x24510
jne 0x1ae6
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
callq 0x1040