#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */

/* Variables and functions */
int INT_MAX;
int INT_MIN;
int /*<<< orphan*/ free(int *);
int *malloc(int);
int random_int(int, int);
int /*<<< orphan*/ random_seed();
int /*<<< orphan*/ sort_insertion(int *, int /*<<< orphan*/, int);
int /*<<< orphan*/ sort_quick(int *, int /*<<< orphan*/, int);
int /*<<< orphan*/ sort_quick_norecurse(int *, int /*<<< orphan*/, int);
int /*<<< orphan*/ sort_rnd_data_fill(int *, int, int, int);
int /*<<< orphan*/ sort_selection(int *, int /*<<< orphan*/, int);
int /*<<< orphan*/ sort_set_array(int *);
int /*<<< orphan*/ test_msg_end(int);
int /*<<< orphan*/ test_msg_start(char *);
scalar_t__ test_sort_data(int *, int /*<<< orphan*/, int);
scalar_t__ test_sort_data_loc(int *);
int test_sort() {
  int i, result = 0, length, min_data_val, max_data_val;
  int *temp_data;
  int data[10];
  test_msg_start("Test Selection Sort - Preset Array");
  sort_set_array(data);
  sort_selection(data, 0, 9);
  result += test_sort_data(data, 0, 9);
  result += test_sort_data_loc(data);
  test_msg_end(result);
  test_msg_start("Test Selection Sort - Random Data");
  for (i = 0; i < 1000; i++) {
    random_seed();
    min_data_val = random_int(INT_MIN + 1, (INT_MAX / 2) - 1);
    max_data_val = random_int(min_data_val, (INT_MAX / 2) - 1);
    length = random_int(500, 1000);
    temp_data = malloc(sizeof(int) * length);
    sort_rnd_data_fill(temp_data, length, min_data_val, max_data_val);
    sort_selection(temp_data, 0, length);
    result += test_sort_data(temp_data, 0, length);
    free(temp_data);
    temp_data = NULL;
  }
  test_msg_end(result);
  test_msg_start("Test Insertion Sort - Preset Array");
  sort_set_array(data);
  sort_insertion(data, 0, 9);
  result += test_sort_data(data, 0, 9);
  result += test_sort_data_loc(data);
  test_msg_end(result);
  test_msg_start("Test Insertion Sort - Random Data");
  for (i = 0; i < 1000; i++) {
    random_seed();
    min_data_val = random_int(INT_MIN + 1, (INT_MAX / 2) - 1);
    max_data_val = random_int(min_data_val, (INT_MAX / 2) - 1);
    length = random_int(500, 1000);
    temp_data = malloc(sizeof(int) * length);
    sort_rnd_data_fill(temp_data, length, min_data_val, max_data_val);
    sort_insertion(temp_data, 0, length);
    result += test_sort_data(temp_data, 0, length);
    free(temp_data);
    temp_data = NULL;
  }
  test_msg_end(result);
  test_msg_start("Test Quick Sort (Recursive) - Preset Array");
  sort_set_array(data);
  sort_quick(data, 0, 9);
  result += test_sort_data(data, 0, 9);
  result += test_sort_data_loc(data);
  test_msg_end(result);
  test_msg_start("Test Quick Sort (Recursive) - Random Data");
  for (i = 0; i < 1000; i++) {
    random_seed();
    min_data_val = random_int(INT_MIN + 1, (INT_MAX / 2) - 1);
    max_data_val = random_int(min_data_val, (INT_MAX / 2) - 1);
    length = random_int(500, 1000);
    temp_data = malloc(sizeof(int) * length);
    sort_rnd_data_fill(temp_data, length, min_data_val, max_data_val);
    sort_quick(temp_data, 0, length);
    result += test_sort_data(temp_data, 0, length);
    free(temp_data);
    temp_data = NULL;
  }
  test_msg_end(result);
  test_msg_start("Test Quick Sort - Preset Array");
  sort_set_array(data);
  sort_quick_norecurse(data, 0, 9);
  result += test_sort_data(data, 0, 9);
  result += test_sort_data_loc(data);
  test_msg_end(result);
  test_msg_start("Test Quick Sort - Random Data");
  for (i = 0; i < 1000; i++) {
    random_seed();
    min_data_val = random_int(INT_MIN + 1, (INT_MAX / 2) - 1);
    max_data_val = random_int(min_data_val, (INT_MAX / 2) - 1);
    length = random_int(500, 1000);
    temp_data = malloc(sizeof(int) * length);
    sort_rnd_data_fill(temp_data, length, min_data_val, max_data_val);
    sort_quick_norecurse(temp_data, 0, length);
    result += test_sort_data(temp_data, 0, length);
    free(temp_data);
    temp_data = NULL;
  }
  test_msg_end(result);
  return result;
}


x86 assembly (clang, -O0):
<test_sort>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movl   $0x0,-0x8(%rbp)
lea    0xe0a(%rip),%rdi
call   1080 <test_msg_start@plt>
lea    -0x50(%rbp),%rdi
call   10a0 <sort_set_array@plt>
lea    -0x50(%rbp),%rdi
xor    %esi,%esi
mov    $0x9,%edx
call   10b0 <sort_selection@plt>
lea    -0x50(%rbp),%rdi
xor    %esi,%esi
mov    $0x9,%edx
call   1070 <test_sort_data@plt>
mov    %rax,%rcx
movslq -0x8(%rbp),%rax
add    %rcx,%rax
mov    %eax,-0x8(%rbp)
lea    -0x50(%rbp),%rdi
call   10e0 <test_sort_data_loc@plt>
mov    %rax,%rcx
movslq -0x8(%rbp),%rax
add    %rcx,%rax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%edi
call   1060 <test_msg_end@plt>
lea    0xdcd(%rip),%rdi
call   1080 <test_msg_start@plt>
movl   $0x0,-0x4(%rbp)
cmpl   $0x3e8,-0x4(%rbp)
jge    1340 <test_sort+0x160>
mov    $0x0,%al
call   10f0 <random_seed@plt>
mov    0x2d63(%rip),%rax
mov    (%rax),%edi
add    $0x1,%edi
mov    0x2d5f(%rip),%rax
mov    (%rax),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,%esi
sub    $0x1,%esi
call   10d0 <random_int@plt>
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%edi
mov    0x2d3e(%rip),%rax
mov    (%rax),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,%esi
sub    $0x1,%esi
call   10d0 <random_int@plt>
mov    %eax,-0x14(%rbp)
mov    $0x1f4,%edi
mov    $0x3e8,%esi
call   10d0 <random_int@plt>
mov    %eax,-0xc(%rbp)
movslq -0xc(%rbp),%rax
shl    $0x2,%rax
mov    %eax,%edi
call   1090 <malloc@plt>
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
mov    -0x14(%rbp),%ecx
call   1100 <sort_rnd_data_fill@plt>
mov    -0x20(%rbp),%rdi
mov    -0xc(%rbp),%edx
xor    %esi,%esi
call   10b0 <sort_selection@plt>
mov    -0x20(%rbp),%rdi
mov    -0xc(%rbp),%edx
xor    %esi,%esi
call   1070 <test_sort_data@plt>
mov    %rax,%rcx
movslq -0x8(%rbp),%rax
add    %rcx,%rax
mov    %eax,-0x8(%rbp)
mov    -0x20(%rbp),%rdi
call   1040 <free@plt>
movq   $0x0,-0x20(%rbp)
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    1262 <test_sort+0x82>
mov    -0x8(%rbp),%edi
call   1060 <test_msg_end@plt>
lea    0xcf6(%rip),%rdi
call   1080 <test_msg_start@plt>
lea    -0x50(%rbp),%rdi
call   10a0 <sort_set_array@plt>
lea    -0x50(%rbp),%rdi
xor    %esi,%esi
mov    $0x9,%edx
call   10c0 <sort_insertion@plt>
lea    -0x50(%rbp),%rdi
xor    %esi,%esi
mov    $0x9,%edx
call   1070 <test_sort_data@plt>
mov    %rax,%rcx
movslq -0x8(%rbp),%rax
add    %rcx,%rax
mov    %eax,-0x8(%rbp)
lea    -0x50(%rbp),%rdi
call   10e0 <test_sort_data_loc@plt>
mov    %rax,%rcx
movslq -0x8(%rbp),%rax
add    %rcx,%rax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%edi
call   1060 <test_msg_end@plt>
lea    0xcb9(%rip),%rdi
call   1080 <test_msg_start@plt>
movl   $0x0,-0x4(%rbp)
cmpl   $0x3e8,-0x4(%rbp)
jge    1499 <test_sort+0x2b9>
mov    $0x0,%al
call   10f0 <random_seed@plt>
mov    0x2c0a(%rip),%rax
mov    (%rax),%edi
add    $0x1,%edi
mov    0x2c06(%rip),%rax
mov    (%rax),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,%esi
sub    $0x1,%esi
call   10d0 <random_int@plt>
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%edi
mov    0x2be5(%rip),%rax
mov    (%rax),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,%esi
sub    $0x1,%esi
call   10d0 <random_int@plt>
mov    %eax,-0x14(%rbp)
mov    $0x1f4,%edi
mov    $0x3e8,%esi
call   10d0 <random_int@plt>
mov    %eax,-0xc(%rbp)
movslq -0xc(%rbp),%rax
shl    $0x2,%rax
mov    %eax,%edi
call   1090 <malloc@plt>
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
mov    -0x14(%rbp),%ecx
call   1100 <sort_rnd_data_fill@plt>
mov    -0x20(%rbp),%rdi
mov    -0xc(%rbp),%edx
xor    %esi,%esi
call   10c0 <sort_insertion@plt>
mov    -0x20(%rbp),%rdi
mov    -0xc(%rbp),%edx
xor    %esi,%esi
call   1070 <test_sort_data@plt>
mov    %rax,%rcx
movslq -0x8(%rbp),%rax
add    %rcx,%rax
mov    %eax,-0x8(%rbp)
mov    -0x20(%rbp),%rdi
call   1040 <free@plt>
movq   $0x0,-0x20(%rbp)
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    13bb <test_sort+0x1db>
mov    -0x8(%rbp),%edi
call   1060 <test_msg_end@plt>
lea    0xbe2(%rip),%rdi
call   1080 <test_msg_start@plt>
lea    -0x50(%rbp),%rdi
call   10a0 <sort_set_array@plt>
lea    -0x50(%rbp),%rdi
xor    %esi,%esi
mov    $0x9,%edx
call   1050 <sort_quick@plt>
lea    -0x50(%rbp),%rdi
xor    %esi,%esi
mov    $0x9,%edx
call   1070 <test_sort_data@plt>
mov    %rax,%rcx
movslq -0x8(%rbp),%rax
add    %rcx,%rax
mov    %eax,-0x8(%rbp)
lea    -0x50(%rbp),%rdi
call   10e0 <test_sort_data_loc@plt>
mov    %rax,%rcx
movslq -0x8(%rbp),%rax
add    %rcx,%rax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%edi
call   1060 <test_msg_end@plt>
lea    0xbad(%rip),%rdi
call   1080 <test_msg_start@plt>
movl   $0x0,-0x4(%rbp)
cmpl   $0x3e8,-0x4(%rbp)
jge    15f2 <test_sort+0x412>
mov    $0x0,%al
call   10f0 <random_seed@plt>
mov    0x2ab1(%rip),%rax
mov    (%rax),%edi
add    $0x1,%edi
mov    0x2aad(%rip),%rax
mov    (%rax),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,%esi
sub    $0x1,%esi
call   10d0 <random_int@plt>
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%edi
mov    0x2a8c(%rip),%rax
mov    (%rax),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,%esi
sub    $0x1,%esi
call   10d0 <random_int@plt>
mov    %eax,-0x14(%rbp)
mov    $0x1f4,%edi
mov    $0x3e8,%esi
call   10d0 <random_int@plt>
mov    %eax,-0xc(%rbp)
movslq -0xc(%rbp),%rax
shl    $0x2,%rax
mov    %eax,%edi
call   1090 <malloc@plt>
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
mov    -0x14(%rbp),%ecx
call   1100 <sort_rnd_data_fill@plt>
mov    -0x20(%rbp),%rdi
mov    -0xc(%rbp),%edx
xor    %esi,%esi
call   1050 <sort_quick@plt>
mov    -0x20(%rbp),%rdi
mov    -0xc(%rbp),%edx
xor    %esi,%esi
call   1070 <test_sort_data@plt>
mov    %rax,%rcx
movslq -0x8(%rbp),%rax
add    %rcx,%rax
mov    %eax,-0x8(%rbp)
mov    -0x20(%rbp),%rdi
call   1040 <free@plt>
movq   $0x0,-0x20(%rbp)
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    1514 <test_sort+0x334>
mov    -0x8(%rbp),%edi
call   1060 <test_msg_end@plt>
lea    0xade(%rip),%rdi
call   1080 <test_msg_start@plt>
lea    -0x50(%rbp),%rdi
call   10a0 <sort_set_array@plt>
lea    -0x50(%rbp),%rdi
xor    %esi,%esi
mov    $0x9,%edx
call   1030 <sort_quick_norecurse@plt>
lea    -0x50(%rbp),%rdi
xor    %esi,%esi
mov    $0x9,%edx
call   1070 <test_sort_data@plt>
mov    %rax,%rcx
movslq -0x8(%rbp),%rax
add    %rcx,%rax
mov    %eax,-0x8(%rbp)
lea    -0x50(%rbp),%rdi
call   10e0 <test_sort_data_loc@plt>
mov    %rax,%rcx
movslq -0x8(%rbp),%rax
add    %rcx,%rax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%edi
call   1060 <test_msg_end@plt>
lea    0xa9d(%rip),%rdi
call   1080 <test_msg_start@plt>
movl   $0x0,-0x4(%rbp)
cmpl   $0x3e8,-0x4(%rbp)
jge    174b <test_sort+0x56b>
mov    $0x0,%al
call   10f0 <random_seed@plt>
mov    0x2958(%rip),%rax
mov    (%rax),%edi
add    $0x1,%edi
mov    0x2954(%rip),%rax
mov    (%rax),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,%esi
sub    $0x1,%esi
call   10d0 <random_int@plt>
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%edi
mov    0x2933(%rip),%rax
mov    (%rax),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,%esi
sub    $0x1,%esi
call   10d0 <random_int@plt>
mov    %eax,-0x14(%rbp)
mov    $0x1f4,%edi
mov    $0x3e8,%esi
call   10d0 <random_int@plt>
mov    %eax,-0xc(%rbp)
movslq -0xc(%rbp),%rax
shl    $0x2,%rax
mov    %eax,%edi
call   1090 <malloc@plt>
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
mov    -0x14(%rbp),%ecx
call   1100 <sort_rnd_data_fill@plt>
mov    -0x20(%rbp),%rdi
mov    -0xc(%rbp),%edx
xor    %esi,%esi
call   1030 <sort_quick_norecurse@plt>
mov    -0x20(%rbp),%rdi
mov    -0xc(%rbp),%edx
xor    %esi,%esi
call   1070 <test_sort_data@plt>
mov    %rax,%rcx
movslq -0x8(%rbp),%rax
add    %rcx,%rax
mov    %eax,-0x8(%rbp)
mov    -0x20(%rbp),%rdi
call   1040 <free@plt>
movq   $0x0,-0x20(%rbp)
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    166d <test_sort+0x48d>
mov    -0x8(%rbp),%edi
call   1060 <test_msg_end@plt>
mov    -0x8(%rbp),%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_sort>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x28,%rsp
lea    0xe0b(%rip),%rdi
call   1080 <test_msg_start@plt>
mov    %rsp,%rbx
mov    %rbx,%rdi
call   10a0 <sort_set_array@plt>
mov    %rbx,%rdi
xor    %esi,%esi
mov    $0x9,%edx
call   10b0 <sort_selection@plt>
mov    %rbx,%rdi
xor    %esi,%esi
mov    $0x9,%edx
call   1070 <test_sort_data@plt>
mov    %rax,%rbp
mov    %rbx,%rdi
call   10e0 <test_sort_data_loc@plt>
mov    %rax,%r14
add    %ebp,%r14d
mov    %r14d,%edi
call   1060 <test_msg_end@plt>
lea    0xde0(%rip),%rdi
call   1080 <test_msg_start@plt>
mov    $0x3e8,%r13d
mov    0x2d8b(%rip),%r15
mov    0x2d8c(%rip),%r12
nopl   0x0(%rax)
xor    %eax,%eax
call   10f0 <random_seed@plt>
mov    (%r15),%edi
add    $0x1,%edi
mov    (%r12),%eax
mov    %eax,%esi
shr    $0x1f,%esi
add    %eax,%esi
sar    %esi
add    $0xffffffff,%esi
call   10d0 <random_int@plt>
mov    %eax,%r12d
mov    0x2d5c(%rip),%rax
mov    (%rax),%eax
mov    %eax,%esi
shr    $0x1f,%esi
add    %eax,%esi
sar    %esi
add    $0xffffffff,%esi
mov    %r12d,%edi
call   10d0 <random_int@plt>
mov    %eax,%r15d
mov    $0x1f4,%edi
mov    $0x3e8,%esi
call   10d0 <random_int@plt>
mov    %eax,%ebx
lea    0x0(,%rbx,4),%edi
call   1090 <malloc@plt>
mov    %rax,%rbp
mov    %rax,%rdi
mov    %ebx,%esi
mov    %r12d,%edx
mov    0x2d14(%rip),%r12
mov    %r15d,%ecx
mov    0x2d02(%rip),%r15
call   1100 <sort_rnd_data_fill@plt>
mov    %rbp,%rdi
xor    %esi,%esi
mov    %ebx,%edx
call   10b0 <sort_selection@plt>
mov    %rbp,%rdi
xor    %esi,%esi
mov    %ebx,%edx
call   1070 <test_sort_data@plt>
add    %eax,%r14d
mov    %rbp,%rdi
call   1040 <free@plt>
add    $0xffffffff,%r13d
jne    1260 <test_sort+0x80>
mov    %r14d,%edi
call   1060 <test_msg_end@plt>
lea    0xd26(%rip),%rdi
call   1080 <test_msg_start@plt>
mov    %rsp,%rbx
mov    %rbx,%rdi
call   10a0 <sort_set_array@plt>
mov    %rbx,%rdi
xor    %esi,%esi
mov    $0x9,%edx
call   10c0 <sort_insertion@plt>
mov    %rbx,%rdi
xor    %esi,%esi
mov    $0x9,%edx
call   1070 <test_sort_data@plt>
mov    %rax,%rbp
add    %r14d,%ebp
mov    %rbx,%rdi
call   10e0 <test_sort_data_loc@plt>
mov    %rax,%r14
add    %ebp,%r14d
mov    %r14d,%edi
call   1060 <test_msg_end@plt>
lea    0xcf8(%rip),%rdi
call   1080 <test_msg_start@plt>
mov    $0x3e8,%r13d
nopl   0x0(%rax,%rax,1)
xor    %eax,%eax
call   10f0 <random_seed@plt>
mov    (%r15),%edi
add    $0x1,%edi
mov    (%r12),%eax
mov    %eax,%esi
shr    $0x1f,%esi
add    %eax,%esi
sar    %esi
add    $0xffffffff,%esi
call   10d0 <random_int@plt>
mov    %eax,%r12d
mov    0x2c3c(%rip),%rax
mov    (%rax),%eax
mov    %eax,%esi
shr    $0x1f,%esi
add    %eax,%esi
sar    %esi
add    $0xffffffff,%esi
mov    %r12d,%edi
call   10d0 <random_int@plt>
mov    %eax,%r15d
mov    $0x1f4,%edi
mov    $0x3e8,%esi
call   10d0 <random_int@plt>
mov    %eax,%ebx
lea    0x0(,%rbx,4),%edi
call   1090 <malloc@plt>
mov    %rax,%rbp
mov    %rax,%rdi
mov    %ebx,%esi
mov    %r12d,%edx
mov    0x2bf4(%rip),%r12
mov    %r15d,%ecx
mov    0x2be2(%rip),%r15
call   1100 <sort_rnd_data_fill@plt>
mov    %rbp,%rdi
xor    %esi,%esi
mov    %ebx,%edx
call   10c0 <sort_insertion@plt>
mov    %rbp,%rdi
xor    %esi,%esi
mov    %ebx,%edx
call   1070 <test_sort_data@plt>
add    %eax,%r14d
mov    %rbp,%rdi
call   1040 <free@plt>
add    $0xffffffff,%r13d
jne    1380 <test_sort+0x1a0>
mov    %r14d,%edi
call   1060 <test_msg_end@plt>
lea    0xc4b(%rip),%rdi
call   1080 <test_msg_start@plt>
mov    %rsp,%rbx
mov    %rbx,%rdi
call   10a0 <sort_set_array@plt>
mov    %rbx,%rdi
xor    %esi,%esi
mov    $0x9,%edx
call   1050 <sort_quick@plt>
mov    %rbx,%rdi
xor    %esi,%esi
mov    $0x9,%edx
call   1070 <test_sort_data@plt>
mov    %rax,%rbp
add    %r14d,%ebp
mov    %rbx,%rdi
call   10e0 <test_sort_data_loc@plt>
mov    %rax,%r14
add    %ebp,%r14d
mov    %r14d,%edi
call   1060 <test_msg_end@plt>
lea    0xc25(%rip),%rdi
call   1080 <test_msg_start@plt>
mov    $0x3e8,%r13d
nopl   0x0(%rax,%rax,1)
xor    %eax,%eax
call   10f0 <random_seed@plt>
mov    (%r15),%edi
add    $0x1,%edi
mov    (%r12),%eax
mov    %eax,%esi
shr    $0x1f,%esi
add    %eax,%esi
sar    %esi
add    $0xffffffff,%esi
call   10d0 <random_int@plt>
mov    %eax,%r12d
mov    0x2b1c(%rip),%rax
mov    (%rax),%eax
mov    %eax,%esi
shr    $0x1f,%esi
add    %eax,%esi
sar    %esi
add    $0xffffffff,%esi
mov    %r12d,%edi
call   10d0 <random_int@plt>
mov    %eax,%r15d
mov    $0x1f4,%edi
mov    $0x3e8,%esi
call   10d0 <random_int@plt>
mov    %eax,%ebx
lea    0x0(,%rbx,4),%edi
call   1090 <malloc@plt>
mov    %rax,%rbp
mov    %rax,%rdi
mov    %ebx,%esi
mov    %r12d,%edx
mov    0x2ad4(%rip),%r12
mov    %r15d,%ecx
mov    0x2ac2(%rip),%r15
call   1100 <sort_rnd_data_fill@plt>
mov    %rbp,%rdi
xor    %esi,%esi
mov    %ebx,%edx
call   1050 <sort_quick@plt>
mov    %rbp,%rdi
xor    %esi,%esi
mov    %ebx,%edx
call   1070 <test_sort_data@plt>
add    %eax,%r14d
mov    %rbp,%rdi
call   1040 <free@plt>
add    $0xffffffff,%r13d
jne    14a0 <test_sort+0x2c0>
mov    %r14d,%edi
call   1060 <test_msg_end@plt>
lea    0xb80(%rip),%rdi
call   1080 <test_msg_start@plt>
mov    %rsp,%rbx
mov    %rbx,%rdi
call   10a0 <sort_set_array@plt>
mov    %rbx,%rdi
xor    %esi,%esi
mov    $0x9,%edx
call   1030 <sort_quick_norecurse@plt>
mov    %rbx,%rdi
xor    %esi,%esi
mov    $0x9,%edx
call   1070 <test_sort_data@plt>
mov    %rax,%rbp
add    %r14d,%ebp
mov    %rbx,%rdi
call   10e0 <test_sort_data_loc@plt>
mov    %rax,%r14
add    %ebp,%r14d
mov    %r14d,%edi
call   1060 <test_msg_end@plt>
lea    0xb4e(%rip),%rdi
call   1080 <test_msg_start@plt>
mov    $0x3e8,%r13d
nopl   0x0(%rax,%rax,1)
xor    %eax,%eax
call   10f0 <random_seed@plt>
mov    (%r15),%edi
add    $0x1,%edi
mov    (%r12),%eax
mov    %eax,%esi
shr    $0x1f,%esi
add    %eax,%esi
sar    %esi
add    $0xffffffff,%esi
call   10d0 <random_int@plt>
mov    %eax,%r12d
mov    0x29fc(%rip),%rax
mov    (%rax),%eax
mov    %eax,%esi
shr    $0x1f,%esi
add    %eax,%esi
sar    %esi
add    $0xffffffff,%esi
mov    %r12d,%edi
call   10d0 <random_int@plt>
mov    %eax,%r15d
mov    $0x1f4,%edi
mov    $0x3e8,%esi
call   10d0 <random_int@plt>
mov    %eax,%ebx
lea    0x0(,%rbx,4),%edi
call   1090 <malloc@plt>
mov    %rax,%rbp
mov    %rax,%rdi
mov    %ebx,%esi
mov    %r12d,%edx
mov    0x29b4(%rip),%r12
mov    %r15d,%ecx
mov    0x29a2(%rip),%r15
call   1100 <sort_rnd_data_fill@plt>
mov    %rbp,%rdi
xor    %esi,%esi
mov    %ebx,%edx
call   1030 <sort_quick_norecurse@plt>
mov    %rbp,%rdi
xor    %esi,%esi
mov    %ebx,%edx
call   1070 <test_sort_data@plt>
add    %eax,%r14d
mov    %rbp,%rdi
call   1040 <free@plt>
add    $0xffffffff,%r13d
jne    15c0 <test_sort+0x3e0>
mov    %r14d,%edi
call   1060 <test_msg_end@plt>
mov    %r14d,%eax
add    $0x28,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [35 x i8] c"Test Selection Sort - Preset Array\00"
@.str.1 = [34 x i8] c"Test Selection Sort - Random Data\00"
@INT_MIN = global i32 0
@INT_MAX = global i32 0
@.str.2 = [35 x i8] c"Test Insertion Sort - Preset Array\00"
@.str.3 = [34 x i8] c"Test Insertion Sort - Random Data\00"
@.str.4 = [43 x i8] c"Test Quick Sort (Recursive) - Preset Array\00"
@.str.5 = [42 x i8] c"Test Quick Sort (Recursive) - Random Data\00"
@.str.6 = [31 x i8] c"Test Quick Sort - Preset Array\00"
@.str.7 = [30 x i8] c"Test Quick Sort - Random Data\00"
define i32 @test_sort() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32*
%7 = alloca [10 x i32]
store i32 0, i32* %2
%8 = call i32 @test_msg_start(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i64 0, i64 0))
%9 = getelementptr inbounds [10 x i32], [10 x i32]* %7, i64 0, i64 0
%10 = call i32 @sort_set_array(i32* %9)
%11 = getelementptr inbounds [10 x i32], [10 x i32]* %7, i64 0, i64 0
%12 = call i32 @sort_selection(i32* %11, i32 0, i32 9)
%13 = getelementptr inbounds [10 x i32], [10 x i32]* %7, i64 0, i64 0
%14 = call i64 @test_sort_data(i32* %13, i32 0, i32 9)
%15 = load i32, i32* %2
%16 = sext i32 %15 to i64
%17 = add nsw i64 %16, %14
%18 = trunc i64 %17 to i32
store i32 %18, i32* %2
%19 = getelementptr inbounds [10 x i32], [10 x i32]* %7, i64 0, i64 0
%20 = call i64 @test_sort_data_loc(i32* %19)
%21 = load i32, i32* %2
%22 = sext i32 %21 to i64
%23 = add nsw i64 %22, %20
%24 = trunc i64 %23 to i32
store i32 %24, i32* %2
%25 = load i32, i32* %2
%26 = call i32 @test_msg_end(i32 %25)
%27 = call i32 @test_msg_start(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.1, i64 0, i64 0))
store i32 0, i32* %1
br label %28
28: ; preds = %67, %0
%29 = load i32, i32* %1
%30 = icmp slt i32 %29, 1000
br i1 %30, label %31, label %70
31: ; preds = %28
%32 = call i32 (...) @random_seed()
%33 = load i32, i32* @INT_MIN
%34 = add nsw i32 %33, 1
%35 = load i32, i32* @INT_MAX
%36 = sdiv i32 %35, 2
%37 = sub nsw i32 %36, 1
%38 = call i32 @random_int(i32 %34, i32 %37)
store i32 %38, i32* %4
%39 = load i32, i32* %4
%40 = load i32, i32* @INT_MAX
%41 = sdiv i32 %40, 2
%42 = sub nsw i32 %41, 1
%43 = call i32 @random_int(i32 %39, i32 %42)
store i32 %43, i32* %5
%44 = call i32 @random_int(i32 500, i32 1000)
store i32 %44, i32* %3
%45 = load i32, i32* %3
%46 = sext i32 %45 to i64
%47 = mul i64 4, %46
%48 = trunc i64 %47 to i32
%49 = call i32* @malloc(i32 %48)
store i32* %49, i32** %6
%50 = load i32*, i32** %6
%51 = load i32, i32* %3
%52 = load i32, i32* %4
%53 = load i32, i32* %5
%54 = call i32 @sort_rnd_data_fill(i32* %50, i32 %51, i32 %52, i32 %53)
%55 = load i32*, i32** %6
%56 = load i32, i32* %3
%57 = call i32 @sort_selection(i32* %55, i32 0, i32 %56)
%58 = load i32*, i32** %6
%59 = load i32, i32* %3
%60 = call i64 @test_sort_data(i32* %58, i32 0, i32 %59)
%61 = load i32, i32* %2
%62 = sext i32 %61 to i64
%63 = add nsw i64 %62, %60
%64 = trunc i64 %63 to i32
store i32 %64, i32* %2
%65 = load i32*, i32** %6
%66 = call i32 @free(i32* %65)
store i32* null, i32** %6
br label %67
67: ; preds = %31
%68 = load i32, i32* %1
%69 = add nsw i32 %68, 1
store i32 %69, i32* %1
br label %28
70: ; preds = %28
%71 = load i32, i32* %2
%72 = call i32 @test_msg_end(i32 %71)
%73 = call i32 @test_msg_start(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.2, i64 0, i64 0))
%74 = getelementptr inbounds [10 x i32], [10 x i32]* %7, i64 0, i64 0
%75 = call i32 @sort_set_array(i32* %74)
%76 = getelementptr inbounds [10 x i32], [10 x i32]* %7, i64 0, i64 0
%77 = call i32 @sort_insertion(i32* %76, i32 0, i32 9)
%78 = getelementptr inbounds [10 x i32], [10 x i32]* %7, i64 0, i64 0
%79 = call i64 @test_sort_data(i32* %78, i32 0, i32 9)
%80 = load i32, i32* %2
%81 = sext i32 %80 to i64
%82 = add nsw i64 %81, %79
%83 = trunc i64 %82 to i32
store i32 %83, i32* %2
%84 = getelementptr inbounds [10 x i32], [10 x i32]* %7, i64 0, i64 0
%85 = call i64 @test_sort_data_loc(i32* %84)
%86 = load i32, i32* %2
%87 = sext i32 %86 to i64
%88 = add nsw i64 %87, %85
%89 = trunc i64 %88 to i32
store i32 %89, i32* %2
%90 = load i32, i32* %2
%91 = call i32 @test_msg_end(i32 %90)
%92 = call i32 @test_msg_start(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.3, i64 0, i64 0))
store i32 0, i32* %1
br label %93
93: ; preds = %132, %70
%94 = load i32, i32* %1
%95 = icmp slt i32 %94, 1000
br i1 %95, label %96, label %135
96: ; preds = %93
%97 = call i32 (...) @random_seed()
%98 = load i32, i32* @INT_MIN
%99 = add nsw i32 %98, 1
%100 = load i32, i32* @INT_MAX
%101 = sdiv i32 %100, 2
%102 = sub nsw i32 %101, 1
%103 = call i32 @random_int(i32 %99, i32 %102)
store i32 %103, i32* %4
%104 = load i32, i32* %4
%105 = load i32, i32* @INT_MAX
%106 = sdiv i32 %105, 2
%107 = sub nsw i32 %106, 1
%108 = call i32 @random_int(i32 %104, i32 %107)
store i32 %108, i32* %5
%109 = call i32 @random_int(i32 500, i32 1000)
store i32 %109, i32* %3
%110 = load i32, i32* %3
%111 = sext i32 %110 to i64
%112 = mul i64 4, %111
%113 = trunc i64 %112 to i32
%114 = call i32* @malloc(i32 %113)
store i32* %114, i32** %6
%115 = load i32*, i32** %6
%116 = load i32, i32* %3
%117 = load i32, i32* %4
%118 = load i32, i32* %5
%119 = call i32 @sort_rnd_data_fill(i32* %115, i32 %116, i32 %117, i32 %118)
%120 = load i32*, i32** %6
%121 = load i32, i32* %3
%122 = call i32 @sort_insertion(i32* %120, i32 0, i32 %121)
%123 = load i32*, i32** %6
%124 = load i32, i32* %3
%125 = call i64 @test_sort_data(i32* %123, i32 0, i32 %124)
%126 = load i32, i32* %2
%127 = sext i32 %126 to i64
%128 = add nsw i64 %127, %125
%129 = trunc i64 %128 to i32
store i32 %129, i32* %2
%130 = load i32*, i32** %6
%131 = call i32 @free(i32* %130)
store i32* null, i32** %6
br label %132
132: ; preds = %96
%133 = load i32, i32* %1
%134 = add nsw i32 %133, 1
store i32 %134, i32* %1
br label %93
135: ; preds = %93
%136 = load i32, i32* %2
%137 = call i32 @test_msg_end(i32 %136)
%138 = call i32 @test_msg_start(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.4, i64 0, i64 0))
%139 = getelementptr inbounds [10 x i32], [10 x i32]* %7, i64 0, i64 0
%140 = call i32 @sort_set_array(i32* %139)
%141 = getelementptr inbounds [10 x i32], [10 x i32]* %7, i64 0, i64 0
%142 = call i32 @sort_quick(i32* %141, i32 0, i32 9)
%143 = getelementptr inbounds [10 x i32], [10 x i32]* %7, i64 0, i64 0
%144 = call i64 @test_sort_data(i32* %143, i32 0, i32 9)
%145 = load i32, i32* %2
%146 = sext i32 %145 to i64
%147 = add nsw i64 %146, %144
%148 = trunc i64 %147 to i32
store i32 %148, i32* %2
%149 = getelementptr inbounds [10 x i32], [10 x i32]* %7, i64 0, i64 0
%150 = call i64 @test_sort_data_loc(i32* %149)
%151 = load i32, i32* %2
%152 = sext i32 %151 to i64
%153 = add nsw i64 %152, %150
%154 = trunc i64 %153 to i32
store i32 %154, i32* %2
%155 = load i32, i32* %2
%156 = call i32 @test_msg_end(i32 %155)
%157 = call i32 @test_msg_start(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.5, i64 0, i64 0))
store i32 0, i32* %1
br label %158
158: ; preds = %197, %135
%159 = load i32, i32* %1
%160 = icmp slt i32 %159, 1000
br i1 %160, label %161, label %200
161: ; preds = %158
%162 = call i32 (...) @random_seed()
%163 = load i32, i32* @INT_MIN
%164 = add nsw i32 %163, 1
%165 = load i32, i32* @INT_MAX
%166 = sdiv i32 %165, 2
%167 = sub nsw i32 %166, 1
%168 = call i32 @random_int(i32 %164, i32 %167)
store i32 %168, i32* %4
%169 = load i32, i32* %4
%170 = load i32, i32* @INT_MAX
%171 = sdiv i32 %170, 2
%172 = sub nsw i32 %171, 1
%173 = call i32 @random_int(i32 %169, i32 %172)
store i32 %173, i32* %5
%174 = call i32 @random_int(i32 500, i32 1000)
store i32 %174, i32* %3
%175 = load i32, i32* %3
%176 = sext i32 %175 to i64
%177 = mul i64 4, %176
%178 = trunc i64 %177 to i32
%179 = call i32* @malloc(i32 %178)
store i32* %179, i32** %6
%180 = load i32*, i32** %6
%181 = load i32, i32* %3
%182 = load i32, i32* %4
%183 = load i32, i32* %5
%184 = call i32 @sort_rnd_data_fill(i32* %180, i32 %181, i32 %182, i32 %183)
%185 = load i32*, i32** %6
%186 = load i32, i32* %3
%187 = call i32 @sort_quick(i32* %185, i32 0, i32 %186)
%188 = load i32*, i32** %6
%189 = load i32, i32* %3
%190 = call i64 @test_sort_data(i32* %188, i32 0, i32 %189)
%191 = load i32, i32* %2
%192 = sext i32 %191 to i64
%193 = add nsw i64 %192, %190
%194 = trunc i64 %193 to i32
store i32 %194, i32* %2
%195 = load i32*, i32** %6
%196 = call i32 @free(i32* %195)
store i32* null, i32** %6
br label %197
197: ; preds = %161
%198 = load i32, i32* %1
%199 = add nsw i32 %198, 1
store i32 %199, i32* %1
br label %158
200: ; preds = %158
%201 = load i32, i32* %2
%202 = call i32 @test_msg_end(i32 %201)
%203 = call i32 @test_msg_start(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.6, i64 0, i64 0))
%204 = getelementptr inbounds [10 x i32], [10 x i32]* %7, i64 0, i64 0
%205 = call i32 @sort_set_array(i32* %204)
%206 = getelementptr inbounds [10 x i32], [10 x i32]* %7, i64 0, i64 0
%207 = call i32 @sort_quick_norecurse(i32* %206, i32 0, i32 9)
%208 = getelementptr inbounds [10 x i32], [10 x i32]* %7, i64 0, i64 0
%209 = call i64 @test_sort_data(i32* %208, i32 0, i32 9)
%210 = load i32, i32* %2
%211 = sext i32 %210 to i64
%212 = add nsw i64 %211, %209
%213 = trunc i64 %212 to i32
store i32 %213, i32* %2
%214 = getelementptr inbounds [10 x i32], [10 x i32]* %7, i64 0, i64 0
%215 = call i64 @test_sort_data_loc(i32* %214)
%216 = load i32, i32* %2
%217 = sext i32 %216 to i64
%218 = add nsw i64 %217, %215
%219 = trunc i64 %218 to i32
store i32 %219, i32* %2
%220 = load i32, i32* %2
%221 = call i32 @test_msg_end(i32 %220)
%222 = call i32 @test_msg_start(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.7, i64 0, i64 0))
store i32 0, i32* %1
br label %223
223: ; preds = %262, %200
%224 = load i32, i32* %1
%225 = icmp slt i32 %224, 1000
br i1 %225, label %226, label %265
226: ; preds = %223
%227 = call i32 (...) @random_seed()
%228 = load i32, i32* @INT_MIN
%229 = add nsw i32 %228, 1
%230 = load i32, i32* @INT_MAX
%231 = sdiv i32 %230, 2
%232 = sub nsw i32 %231, 1
%233 = call i32 @random_int(i32 %229, i32 %232)
store i32 %233, i32* %4
%234 = load i32, i32* %4
%235 = load i32, i32* @INT_MAX
%236 = sdiv i32 %235, 2
%237 = sub nsw i32 %236, 1
%238 = call i32 @random_int(i32 %234, i32 %237)
store i32 %238, i32* %5
%239 = call i32 @random_int(i32 500, i32 1000)
store i32 %239, i32* %3
%240 = load i32, i32* %3
%241 = sext i32 %240 to i64
%242 = mul i64 4, %241
%243 = trunc i64 %242 to i32
%244 = call i32* @malloc(i32 %243)
store i32* %244, i32** %6
%245 = load i32*, i32** %6
%246 = load i32, i32* %3
%247 = load i32, i32* %4
%248 = load i32, i32* %5
%249 = call i32 @sort_rnd_data_fill(i32* %245, i32 %246, i32 %247, i32 %248)
%250 = load i32*, i32** %6
%251 = load i32, i32* %3
%252 = call i32 @sort_quick_norecurse(i32* %250, i32 0, i32 %251)
%253 = load i32*, i32** %6
%254 = load i32, i32* %3
%255 = call i64 @test_sort_data(i32* %253, i32 0, i32 %254)
%256 = load i32, i32* %2
%257 = sext i32 %256 to i64
%258 = add nsw i64 %257, %255
%259 = trunc i64 %258 to i32
store i32 %259, i32* %2
%260 = load i32*, i32** %6
%261 = call i32 @free(i32* %260)
store i32* null, i32** %6
br label %262
262: ; preds = %226
%263 = load i32, i32* %1
%264 = add nsw i32 %263, 1
store i32 %264, i32* %1
br label %223
265: ; preds = %223
%266 = load i32, i32* %2
%267 = call i32 @test_msg_end(i32 %266)
%268 = load i32, i32* %2
ret i32 %268
}

LLVM IR (-O2):
@.str = [35 x i8] c"Test Selection Sort - Preset Array\00"
@.str.1 = [34 x i8] c"Test Selection Sort - Random Data\00"
@INT_MIN = global i32 0
@INT_MAX = global i32 0
@.str.2 = [35 x i8] c"Test Insertion Sort - Preset Array\00"
@.str.3 = [34 x i8] c"Test Insertion Sort - Random Data\00"
@.str.4 = [43 x i8] c"Test Quick Sort (Recursive) - Preset Array\00"
@.str.5 = [42 x i8] c"Test Quick Sort (Recursive) - Random Data\00"
@.str.6 = [31 x i8] c"Test Quick Sort - Preset Array\00"
@.str.7 = [30 x i8] c"Test Quick Sort - Random Data\00"
define i32 @test_sort() {
%1 = alloca [10 x i32]
%2 = bitcast [10 x i32]* %1 to i8*
%3 = tail call i32 @test_msg_start(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i64 0, i64 0))
%4 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 0
%5 = call i32 @sort_set_array(i32* %4)
%6 = call i32 @sort_selection(i32* %4, i32 0, i32 9)
%7 = call i64 @test_sort_data(i32* %4, i32 0, i32 9)
%8 = call i64 @test_sort_data_loc(i32* %4)
%9 = add i64 %8, %7
%10 = trunc i64 %9 to i32
%11 = call i32 @test_msg_end(i32 %10)
%12 = call i32 @test_msg_start(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.1, i64 0, i64 0))
br label %13
13: ; preds = %0, %13
%14 = phi i32 [ %10, %0 ], [ %34, %13 ]
%15 = phi i32 [ 0, %0 ], [ %36, %13 ]
%16 = call i32 (...) @random_seed()
%17 = load i32, i32* @INT_MIN
%18 = add nsw i32 %17, 1
%19 = load i32, i32* @INT_MAX
%20 = sdiv i32 %19, 2
%21 = add nsw i32 %20, -1
%22 = call i32 @random_int(i32 %18, i32 %21)
%23 = load i32, i32* @INT_MAX
%24 = sdiv i32 %23, 2
%25 = add nsw i32 %24, -1
%26 = call i32 @random_int(i32 %22, i32 %25)
%27 = call i32 @random_int(i32 500, i32 1000)
%28 = shl i32 %27, 2
%29 = call i32* @malloc(i32 %28)
%30 = call i32 @sort_rnd_data_fill(i32* %29, i32 %27, i32 %22, i32 %26)
%31 = call i32 @sort_selection(i32* %29, i32 0, i32 %27)
%32 = call i64 @test_sort_data(i32* %29, i32 0, i32 %27)
%33 = trunc i64 %32 to i32
%34 = add i32 %14, %33
%35 = call i32 @free(i32* %29)
%36 = add nuw nsw i32 %15, 1
%37 = icmp eq i32 %36, 1000
br i1 %37, label %38, label %13
38: ; preds = %13
%39 = call i32 @test_msg_end(i32 %34)
%40 = call i32 @test_msg_start(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.2, i64 0, i64 0))
%41 = call i32 @sort_set_array(i32* %4)
%42 = call i32 @sort_insertion(i32* %4, i32 0, i32 9)
%43 = call i64 @test_sort_data(i32* %4, i32 0, i32 9)
%44 = trunc i64 %43 to i32
%45 = add i32 %34, %44
%46 = call i64 @test_sort_data_loc(i32* %4)
%47 = trunc i64 %46 to i32
%48 = add i32 %45, %47
%49 = call i32 @test_msg_end(i32 %48)
%50 = call i32 @test_msg_start(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.3, i64 0, i64 0))
br label %51
51: ; preds = %38, %51
%52 = phi i32 [ %48, %38 ], [ %72, %51 ]
%53 = phi i32 [ 0, %38 ], [ %74, %51 ]
%54 = call i32 (...) @random_seed()
%55 = load i32, i32* @INT_MIN
%56 = add nsw i32 %55, 1
%57 = load i32, i32* @INT_MAX
%58 = sdiv i32 %57, 2
%59 = add nsw i32 %58, -1
%60 = call i32 @random_int(i32 %56, i32 %59)
%61 = load i32, i32* @INT_MAX
%62 = sdiv i32 %61, 2
%63 = add nsw i32 %62, -1
%64 = call i32 @random_int(i32 %60, i32 %63)
%65 = call i32 @random_int(i32 500, i32 1000)
%66 = shl i32 %65, 2
%67 = call i32* @malloc(i32 %66)
%68 = call i32 @sort_rnd_data_fill(i32* %67, i32 %65, i32 %60, i32 %64)
%69 = call i32 @sort_insertion(i32* %67, i32 0, i32 %65)
%70 = call i64 @test_sort_data(i32* %67, i32 0, i32 %65)
%71 = trunc i64 %70 to i32
%72 = add i32 %52, %71
%73 = call i32 @free(i32* %67)
%74 = add nuw nsw i32 %53, 1
%75 = icmp eq i32 %74, 1000
br i1 %75, label %76, label %51
76: ; preds = %51
%77 = call i32 @test_msg_end(i32 %72)
%78 = call i32 @test_msg_start(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.4, i64 0, i64 0))
%79 = call i32 @sort_set_array(i32* %4)
%80 = call i32 @sort_quick(i32* %4, i32 0, i32 9)
%81 = call i64 @test_sort_data(i32* %4, i32 0, i32 9)
%82 = trunc i64 %81 to i32
%83 = add i32 %72, %82
%84 = call i64 @test_sort_data_loc(i32* %4)
%85 = trunc i64 %84 to i32
%86 = add i32 %83, %85
%87 = call i32 @test_msg_end(i32 %86)
%88 = call i32 @test_msg_start(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.5, i64 0, i64 0))
br label %89
89: ; preds = %76, %89
%90 = phi i32 [ %86, %76 ], [ %110, %89 ]
%91 = phi i32 [ 0, %76 ], [ %112, %89 ]
%92 = call i32 (...) @random_seed()
%93 = load i32, i32* @INT_MIN
%94 = add nsw i32 %93, 1
%95 = load i32, i32* @INT_MAX
%96 = sdiv i32 %95, 2
%97 = add nsw i32 %96, -1
%98 = call i32 @random_int(i32 %94, i32 %97)
%99 = load i32, i32* @INT_MAX
%100 = sdiv i32 %99, 2
%101 = add nsw i32 %100, -1
%102 = call i32 @random_int(i32 %98, i32 %101)
%103 = call i32 @random_int(i32 500, i32 1000)
%104 = shl i32 %103, 2
%105 = call i32* @malloc(i32 %104)
%106 = call i32 @sort_rnd_data_fill(i32* %105, i32 %103, i32 %98, i32 %102)
%107 = call i32 @sort_quick(i32* %105, i32 0, i32 %103)
%108 = call i64 @test_sort_data(i32* %105, i32 0, i32 %103)
%109 = trunc i64 %108 to i32
%110 = add i32 %90, %109
%111 = call i32 @free(i32* %105)
%112 = add nuw nsw i32 %91, 1
%113 = icmp eq i32 %112, 1000
br i1 %113, label %114, label %89
114: ; preds = %89
%115 = call i32 @test_msg_end(i32 %110)
%116 = call i32 @test_msg_start(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.6, i64 0, i64 0))
%117 = call i32 @sort_set_array(i32* %4)
%118 = call i32 @sort_quick_norecurse(i32* %4, i32 0, i32 9)
%119 = call i64 @test_sort_data(i32* %4, i32 0, i32 9)
%120 = trunc i64 %119 to i32
%121 = add i32 %110, %120
%122 = call i64 @test_sort_data_loc(i32* %4)
%123 = trunc i64 %122 to i32
%124 = add i32 %121, %123
%125 = call i32 @test_msg_end(i32 %124)
%126 = call i32 @test_msg_start(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.7, i64 0, i64 0))
br label %127
127: ; preds = %114, %127
%128 = phi i32 [ %124, %114 ], [ %148, %127 ]
%129 = phi i32 [ 0, %114 ], [ %150, %127 ]
%130 = call i32 (...) @random_seed()
%131 = load i32, i32* @INT_MIN
%132 = add nsw i32 %131, 1
%133 = load i32, i32* @INT_MAX
%134 = sdiv i32 %133, 2
%135 = add nsw i32 %134, -1
%136 = call i32 @random_int(i32 %132, i32 %135)
%137 = load i32, i32* @INT_MAX
%138 = sdiv i32 %137, 2
%139 = add nsw i32 %138, -1
%140 = call i32 @random_int(i32 %136, i32 %139)
%141 = call i32 @random_int(i32 500, i32 1000)
%142 = shl i32 %141, 2
%143 = call i32* @malloc(i32 %142)
%144 = call i32 @sort_rnd_data_fill(i32* %143, i32 %141, i32 %136, i32 %140)
%145 = call i32 @sort_quick_norecurse(i32* %143, i32 0, i32 %141)
%146 = call i64 @test_sort_data(i32* %143, i32 0, i32 %141)
%147 = trunc i64 %146 to i32
%148 = add i32 %128, %147
%149 = call i32 @free(i32* %143)
%150 = add nuw nsw i32 %129, 1
%151 = icmp eq i32 %150, 1000
br i1 %151, label %152, label %127
152: ; preds = %127
%153 = call i32 @test_msg_end(i32 %148)
ret i32 %148
}