// File: /workspace/github_c_makefile_star2_O0/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
movq %rsp, %rbp
subq $0x50, %rsp
movl %edi, -0x8(%rbp)
movq $0x0, -0x10(%rbp)
cmpq $0x78fb, -0x10(%rbp)    # imm = 0x78FB
jae 0x1a20
callq 0x1170
movl %eax, %edx
movq -0x10(%rbp), %rcx
leaq 0x5701(%rip), %rax      # 0x7110
movl %edx, (%rax,%rcx,4)
movq -0x10(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x10(%rbp)
jmp 0x19f3
movslq -0x8(%rbp), %rsi
leaq 0x56e5(%rip), %rdi      # 0x7110
movl $0x4, %edx
leaq -0x3a7(%rip), %rcx      # 0x1690
callq 0x1060
movslq -0x8(%rbp), %rax
leaq 0x56c9(%rip), %rdi      # 0x7110
shlq $0x2, %rax
addq %rax, %rdi
movl $0x78fb, %eax           # imm = 0x78FB
subl -0x8(%rbp), %eax
movslq %eax, %rsi
movl $0x4, %edx
leaq -0x3d5(%rip), %rcx      # 0x1690
callq 0x1060
movslq -0x8(%rbp), %rdi
shlq $0x2, %rdi
callq 0x1130
movq %rax, -0x18(%rbp)
movl $0x78fb, %eax           # imm = 0x78FB
subl -0x8(%rbp), %eax
movslq %eax, %rdi
shlq $0x2, %rdi
callq 0x1130
movq %rax, -0x20(%rbp)
movq -0x18(%rbp), %rdi
movslq -0x8(%rbp), %rdx
shlq $0x2, %rdx
leaq 0x566a(%rip), %rsi      # 0x7110
callq 0x1110
movq -0x20(%rbp), %rdi
movslq -0x8(%rbp), %rax
leaq 0x5656(%rip), %rsi      # 0x7110
shlq $0x2, %rax
addq %rax, %rsi
movl $0x78fb, %eax           # imm = 0x78FB
subl -0x8(%rbp), %eax
movslq %eax, %rdx
shlq $0x2, %rdx
callq 0x1110
movq -0x18(%rbp), %rdi
movslq -0x8(%rbp), %rsi
movq -0x20(%rbp), %rdx
movl $0x78fb, %eax           # imm = 0x78FB
subl -0x8(%rbp), %eax
movslq %eax, %rcx
movl $0x4, %r8d
leaq -0x469(%rip), %r9       # 0x1690
callq 0x1290
movq %rax, -0x28(%rbp)
movl 0x23a3c(%rip), %eax     # 0x25544
addl $0x1, %eax
movl %eax, 0x23a33(%rip)     # 0x25544
cmpq $0x0, -0x28(%rbp)
jne 0x1b60
jmp 0x1b1a
leaq 0x28a1(%rip), %rax      # 0x43c2
movq %rax, 0x23a28(%rip)     # 0x25550
movl $0x32, 0x23a16(%rip)    # 0x25548
leaq 0x28cc(%rip), %rax      # 0x4405
movq %rax, 0x23a18(%rip)     # 0x25558
movzbl 0x239b9(%rip), %eax     # 0x25500
andl $0x4, %eax
cmpl $0x0, %eax
je 0x1b54
callq 0x1040
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x1c9e
jmp 0x1b62
leaq 0x55a7(%rip), %rdi      # 0x7110
movl $0x78fb, %esi           # imm = 0x78FB
movl $0x4, %edx
leaq -0x4ea(%rip), %rcx      # 0x1690
callq 0x1060
leaq 0x558a(%rip), %rax      # 0x7110
movq %rax, -0x40(%rbp)
movq -0x28(%rbp), %rax
movq %rax, -0x38(%rbp)
movq $0x1e3ec, -0x30(%rbp)   # imm = 0x1E3EC
leaq 0x5547(%rip), %rax      # 0x70e8
movq %rax, -0x48(%rbp)
movl 0x23999(%rip), %eax     # 0x25544
addl $0x1, %eax
movl %eax, 0x23990(%rip)     # 0x25544
movq -0x40(%rbp), %rdi
movq -0x38(%rbp), %rsi
movq -0x48(%rbp), %rdx
leaq -0x40(%rbp), %rcx
callq 0x2670
cmpl $0x0, %eax
jne 0x1c6d
cmpq $0x0, -0x48(%rbp)
je 0x1be3
movq -0x48(%rbp), %rax
cmpq $0x0, (%rax)
jne 0x1c28
jmp 0x1be5
leaq 0x27d6(%rip), %rax      # 0x43c2
movq %rax, 0x2395d(%rip)     # 0x25550
movl $0x35, 0x2394b(%rip)    # 0x25548
leaq 0x27d1(%rip), %rax      # 0x43d5
movq %rax, 0x2394d(%rip)     # 0x25558
movzbl 0x238ee(%rip), %eax     # 0x25500
andl $0x4, %eax
cmpl $0x0, %eax
je 0x1c1f
callq 0x1040
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x1c9e
jmp 0x1c2a
leaq 0x2791(%rip), %rax      # 0x43c2
movq %rax, 0x23918(%rip)     # 0x25550
movl $0x35, 0x23906(%rip)    # 0x25548
leaq 0x27af(%rip), %rax      # 0x43f8
movq %rax, 0x23908(%rip)     # 0x25558
movzbl 0x238a9(%rip), %eax     # 0x25500
andl $0x4, %eax
cmpl $0x0, %eax
je 0x1c64
callq 0x1040
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x1c9e
jmp 0x1c6f
jmp 0x1c71
movq -0x18(%rbp), %rdi
callq 0x1030
movq -0x20(%rbp), %rdi
callq 0x1030
movq -0x28(%rbp), %rdi
callq 0x1030
movq $0x0, 0x238c1(%rip) # 0x25558
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x50, %rsp
popq %rbp
retq
nopw (%rax,%rax)