#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 */
typedef scalar_t__ clock_t;

/* Variables and functions */
double CLOCKS_PER_SEC;
int atoi(char *);
scalar_t__ clock();
int /*<<< orphan*/ i_qsort(int *, int);
int /*<<< orphan*/ print_array(int *, int);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ r_qsort(int *, int);
int rand();
int /*<<< orphan*/ srand(scalar_t__);
int /*<<< orphan*/ usage(char *);
int main(int argc, char **argv) {
  if (argc < 2 + 1) {
    usage(argv[0]);
    return 1;
  }
  int num_elements = atoi(argv[1]);
  int num_attempts = atoi(argv[2]);
  int i, j;
  clock_t begin, end;
  double i_total_time, r_total_time;
  double i_avg_time, r_avg_time;
  printf("Preparing to start testing.\n");
  printf("Number of tests will be %d with %d elements per array.\n",
         num_attempts, num_elements);
  int i_array[10], r_array[10];
  srand(clock());
  for (i = 0; i < 10; ++i) {
    i_array[i] = r_array[i] = rand() % 10;
  }
  printf("Doing test sort...\n\tTest Array is:  ");
  print_array(i_array, 10);
  i_qsort(i_array, 10);
  printf("\tIterative Sort: ");
  print_array(i_array, 10);
  r_qsort(r_array, 10);
  printf("\tRecursive Sort: ");
  print_array(r_array, 10);
  for (i = 0; i < num_attempts; ++i) {
    srand(clock());
    int i_array[num_elements], r_array[num_elements];
    for (j = 0; j < num_elements; ++j) {
      i_array[i] = r_array[i] = rand() % num_elements;
    }
    begin = clock();
    i_qsort(i_array, num_elements);
    end = clock();
    i_total_time += ((double)end - (double)begin) / CLOCKS_PER_SEC;
    begin = clock();
    r_qsort(r_array, num_elements);
    end = clock();
    r_total_time += ((double)end - (double)begin) / CLOCKS_PER_SEC;
  }
  i_avg_time = i_total_time / num_attempts;
  r_avg_time = r_total_time / num_attempts;
  printf("Finished testing.\n");
  printf("Iterative quicksort stats:\n\tTotal time:   %f seconds\n\tAverage "
         "time: %f seconds\n",
         i_total_time, i_avg_time);
  printf("Recursive quicksort stats:\n\tTotal time:   %f seconds\n\tAverage "
         "time: %f seconds\n",
         r_total_time, r_avg_time);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xe0,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x3,-0x8(%rbp)
jge    11cb <main+0x3b>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
call   1090 <usage@plt>
movl   $0x1,-0x4(%rbp)
jmp    14aa <main+0x31a>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   10a0 <atoi@plt>
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
call   10a0 <atoi@plt>
mov    %eax,-0x18(%rbp)
lea    0xe0e(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x18(%rbp),%esi
mov    -0x14(%rbp),%edx
lea    0xe17(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    $0x0,%al
call   1030 <clock@plt>
mov    %rax,%rdi
call   1070 <srand@plt>
movl   $0x0,-0x1c(%rbp)
cmpl   $0xa,-0x1c(%rbp)
jge    125d <main+0xcd>
mov    $0x0,%al
call   10b0 <rand@plt>
mov    $0xa,%ecx
cltd
idiv   %ecx
movslq -0x1c(%rbp),%rax
mov    %edx,-0xb0(%rbp,%rax,4)
movslq -0x1c(%rbp),%rax
mov    %edx,-0x80(%rbp,%rax,4)
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1223 <main+0x93>
lea    0xdf1(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    -0x80(%rbp),%rdi
mov    $0xa,%esi
call   1040 <print_array@plt>
lea    -0x80(%rbp),%rdi
mov    $0xa,%esi
call   1060 <i_qsort@plt>
lea    0xdec(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    -0x80(%rbp),%rdi
mov    $0xa,%esi
call   1040 <print_array@plt>
lea    -0xb0(%rbp),%rdi
mov    $0xa,%esi
call   1080 <r_qsort@plt>
lea    0xdd1(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    -0xb0(%rbp),%rdi
mov    $0xa,%esi
call   1040 <print_array@plt>
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x18(%rbp),%eax
jge    143f <main+0x2af>
xor    %eax,%eax
call   1030 <clock@plt>
mov    %rax,%rdi
call   1070 <srand@plt>
mov    -0x14(%rbp),%eax
mov    %rsp,%rcx
mov    %rcx,-0xb8(%rbp)
lea    0xf(,%rax,4),%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0xd8(%rbp)
mov    %rcx,%rsp
mov    %rax,-0xc0(%rbp)
mov    -0x14(%rbp),%eax
lea    0xf(,%rax,4),%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0xd0(%rbp)
mov    %rcx,%rsp
mov    %rax,-0xc8(%rbp)
movl   $0x0,-0x20(%rbp)
mov    -0x20(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    1393 <main+0x203>
mov    $0x0,%al
call   10b0 <rand@plt>
mov    -0xd0(%rbp),%rcx
cltd
idivl  -0x14(%rbp)
mov    -0xd8(%rbp),%rax
movslq -0x1c(%rbp),%rsi
mov    %edx,(%rcx,%rsi,4)
movslq -0x1c(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    1352 <main+0x1c2>
mov    $0x0,%al
call   1030 <clock@plt>
mov    -0xd8(%rbp),%rdi
mov    %rax,-0x28(%rbp)
mov    -0x14(%rbp),%esi
call   1060 <i_qsort@plt>
mov    $0x0,%al
call   1030 <clock@plt>
mov    %rax,-0x30(%rbp)
cvtsi2sdq -0x30(%rbp),%xmm0
cvtsi2sdq -0x28(%rbp),%xmm1
subsd  %xmm1,%xmm0
mov    0x2c19(%rip),%rax
divsd  (%rax),%xmm0
addsd  -0x38(%rbp),%xmm0
movsd  %xmm0,-0x38(%rbp)
mov    $0x0,%al
call   1030 <clock@plt>
mov    -0xd0(%rbp),%rdi
mov    %rax,-0x28(%rbp)
mov    -0x14(%rbp),%esi
call   1080 <r_qsort@plt>
mov    $0x0,%al
call   1030 <clock@plt>
mov    %rax,-0x30(%rbp)
cvtsi2sdq -0x30(%rbp),%xmm0
cvtsi2sdq -0x28(%rbp),%xmm1
subsd  %xmm1,%xmm0
mov    0x2bcf(%rip),%rax
divsd  (%rax),%xmm0
addsd  -0x40(%rbp),%xmm0
movsd  %xmm0,-0x40(%rbp)
mov    -0xb8(%rbp),%rax
mov    %rax,%rsp
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    12da <main+0x14a>
movsd  -0x38(%rbp),%xmm0
cvtsi2sdl -0x18(%rbp),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x48(%rbp)
movsd  -0x40(%rbp),%xmm0
cvtsi2sdl -0x18(%rbp),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x50(%rbp)
lea    0xc32(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movsd  -0x38(%rbp),%xmm0
movsd  -0x48(%rbp),%xmm1
lea    0xc2d(%rip),%rdi
mov    $0x2,%al
call   1050 <printf@plt>
movsd  -0x40(%rbp),%xmm0
movsd  -0x50(%rbp),%xmm1
lea    0xc65(%rip),%rdi
mov    $0x2,%al
call   1050 <printf@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x98,%rsp
mov    %rsi,%rbx
cmp    $0x2,%edi
jg     11ce <main+0x2e>
mov    (%rbx),%rdi
call   10a0 <usage@plt>
mov    $0x1,%eax
jmp    1610 <main+0x470>
mov    0x8(%rbx),%rdi
call   10b0 <atoi@plt>
mov    %eax,%r15d
mov    0x10(%rbx),%rdi
call   10b0 <atoi@plt>
mov    %eax,%r14d
lea    0xf34(%rip),%rdi
call   1030 <puts@plt>
lea    0xe07(%rip),%rdi
mov    %r14d,%esi
mov    %r15d,-0x30(%rbp)
mov    %r15d,%edx
xor    %eax,%eax
call   1060 <printf@plt>
xor    %eax,%eax
call   1040 <clock@plt>
mov    %rax,%rdi
call   1080 <srand@plt>
xor    %eax,%eax
call   10c0 <rand@plt>
cltq
imul   $0x66666667,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
shr    $0x20,%rcx
sar    $0x2,%ecx
add    %edx,%ecx
add    %ecx,%ecx
lea    (%rcx,%rcx,4),%ecx
sub    %ecx,%eax
mov    %eax,-0x80(%rbp)
mov    %eax,-0xb0(%rbp)
xor    %eax,%eax
call   10c0 <rand@plt>
cltq
imul   $0x66666667,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
shr    $0x20,%rcx
sar    $0x2,%ecx
add    %edx,%ecx
add    %ecx,%ecx
lea    (%rcx,%rcx,4),%ecx
sub    %ecx,%eax
mov    %eax,-0x7c(%rbp)
mov    %eax,-0xac(%rbp)
xor    %eax,%eax
call   10c0 <rand@plt>
cltq
imul   $0x66666667,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
shr    $0x20,%rcx
sar    $0x2,%ecx
add    %edx,%ecx
add    %ecx,%ecx
lea    (%rcx,%rcx,4),%ecx
sub    %ecx,%eax
mov    %eax,-0x78(%rbp)
mov    %eax,-0xa8(%rbp)
xor    %eax,%eax
call   10c0 <rand@plt>
cltq
imul   $0x66666667,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
shr    $0x20,%rcx
sar    $0x2,%ecx
add    %edx,%ecx
add    %ecx,%ecx
lea    (%rcx,%rcx,4),%ecx
sub    %ecx,%eax
mov    %eax,-0x74(%rbp)
mov    %eax,-0xa4(%rbp)
xor    %eax,%eax
call   10c0 <rand@plt>
cltq
imul   $0x66666667,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
shr    $0x20,%rcx
sar    $0x2,%ecx
add    %edx,%ecx
add    %ecx,%ecx
lea    (%rcx,%rcx,4),%ecx
sub    %ecx,%eax
mov    %eax,-0x70(%rbp)
mov    %eax,-0xa0(%rbp)
xor    %eax,%eax
call   10c0 <rand@plt>
cltq
imul   $0x66666667,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
shr    $0x20,%rcx
sar    $0x2,%ecx
add    %edx,%ecx
add    %ecx,%ecx
lea    (%rcx,%rcx,4),%ecx
sub    %ecx,%eax
mov    %eax,-0x6c(%rbp)
mov    %eax,-0x9c(%rbp)
xor    %eax,%eax
call   10c0 <rand@plt>
cltq
imul   $0x66666667,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
shr    $0x20,%rcx
sar    $0x2,%ecx
add    %edx,%ecx
add    %ecx,%ecx
lea    (%rcx,%rcx,4),%ecx
sub    %ecx,%eax
mov    %eax,-0x68(%rbp)
mov    %eax,-0x98(%rbp)
xor    %eax,%eax
call   10c0 <rand@plt>
cltq
imul   $0x66666667,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
shr    $0x20,%rcx
sar    $0x2,%ecx
add    %edx,%ecx
add    %ecx,%ecx
lea    (%rcx,%rcx,4),%ecx
sub    %ecx,%eax
mov    %eax,-0x64(%rbp)
mov    %eax,-0x94(%rbp)
xor    %eax,%eax
call   10c0 <rand@plt>
cltq
imul   $0x66666667,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
shr    $0x20,%rcx
sar    $0x2,%ecx
add    %edx,%ecx
add    %ecx,%ecx
lea    (%rcx,%rcx,4),%ecx
sub    %ecx,%eax
mov    %eax,-0x60(%rbp)
mov    %eax,-0x90(%rbp)
xor    %eax,%eax
call   10c0 <rand@plt>
cltq
imul   $0x66666667,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
shr    $0x20,%rcx
sar    $0x2,%ecx
add    %edx,%ecx
add    %ecx,%ecx
lea    (%rcx,%rcx,4),%ecx
sub    %ecx,%eax
mov    %eax,-0x5c(%rbp)
mov    %eax,-0x8c(%rbp)
lea    0xc38(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
lea    -0xb0(%rbp),%rbx
mov    %rbx,%rdi
mov    $0xa,%esi
call   1050 <print_array@plt>
mov    %rbx,%rdi
mov    $0xa,%esi
call   1070 <i_qsort@plt>
lea    0xc2e(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
mov    %rbx,%rdi
mov    $0xa,%esi
call   1050 <print_array@plt>
lea    -0x80(%rbp),%rbx
mov    %rbx,%rdi
mov    $0xa,%esi
call   1090 <r_qsort@plt>
lea    0xc14(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
mov    %rbx,%rdi
mov    $0xa,%esi
call   1050 <print_array@plt>
test   %r14d,%r14d
mov    %r14d,-0x4c(%rbp)
jle    15ae <main+0x40e>
mov    -0x30(%rbp),%ecx
mov    %ecx,%eax
mov    %r14d,%edx
mov    %rdx,-0xc0(%rbp)
mov    %ecx,%r14d
lea    0xf(,%rax,4),%rax
and    $0xfffffffffffffff0,%rax
mov    %rax,-0xb8(%rbp)
xor    %r15d,%r15d
jmp    1554 <main+0x3b4>
nopl   0x0(%rax)
xor    %eax,%eax
call   1040 <clock@plt>
mov    %rax,%r14
mov    %r12,%rdi
mov    -0x30(%rbp),%esi
call   1070 <i_qsort@plt>
xor    %eax,%eax
call   1040 <clock@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %rax,%xmm0
xorps  %xmm1,%xmm1
cvtsi2sd %r14,%xmm1
mov    -0x30(%rbp),%r14d
subsd  %xmm1,%xmm0
mov    0x2afd(%rip),%r12
divsd  (%r12),%xmm0
movsd  -0x40(%rbp),%xmm1
addsd  %xmm0,%xmm1
movsd  %xmm1,-0x40(%rbp)
xor    %eax,%eax
call   1040 <clock@plt>
mov    %rax,%rbx
mov    %r13,%rdi
mov    %r14d,%esi
call   1090 <r_qsort@plt>
xor    %eax,%eax
call   1040 <clock@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %rax,%xmm0
xorps  %xmm1,%xmm1
cvtsi2sd %rbx,%xmm1
subsd  %xmm1,%xmm0
divsd  (%r12),%xmm0
movsd  -0x48(%rbp),%xmm1
addsd  %xmm0,%xmm1
movsd  %xmm1,-0x48(%rbp)
mov    -0x38(%rbp),%rsp
add    $0x1,%r15
cmp    -0xc0(%rbp),%r15
je     15ae <main+0x40e>
xor    %eax,%eax
call   1040 <clock@plt>
mov    %rax,%rdi
call   1080 <srand@plt>
mov    %rsp,-0x38(%rbp)
mov    %rsp,%r12
mov    -0xb8(%rbp),%rax
sub    %rax,%r12
mov    %r12,%rsp
mov    %rsp,%r13
sub    %rax,%r13
mov    %r13,%rsp
test   %r14d,%r14d
jle    14b0 <main+0x310>
mov    %r14d,%ebx
nopl   0x0(%rax)
xor    %eax,%eax
call   10c0 <rand@plt>
cltd
idiv   %r14d
mov    %edx,0x0(%r13,%r15,4)
mov    %edx,(%r12,%r15,4)
add    $0xffffffff,%ebx
jne    1590 <main+0x3f0>
jmp    14b0 <main+0x310>
xorps  %xmm0,%xmm0
cvtsi2sdl -0x4c(%rbp),%xmm0
movsd  -0x40(%rbp),%xmm1
divsd  %xmm0,%xmm1
movsd  %xmm1,-0x38(%rbp)
movsd  -0x48(%rbp),%xmm1
divsd  %xmm0,%xmm1
movsd  %xmm1,-0x30(%rbp)
lea    0xb64(%rip),%rdi
call   1030 <puts@plt>
lea    0xa9c(%rip),%rdi
movsd  -0x40(%rbp),%xmm0
movsd  -0x38(%rbp),%xmm1
mov    $0x2,%al
call   1060 <printf@plt>
lea    0xad4(%rip),%rdi
movsd  -0x48(%rbp),%xmm0
movsd  -0x30(%rbp),%xmm1
mov    $0x2,%al
call   1060 <printf@plt>
xor    %eax,%eax
lea    -0x28(%rbp),%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [29 x i8] c"Preparing to start testing.\0A\00"
@.str.1 = [56 x i8] c"Number of tests will be %d with %d elements per array.\0A\00"
@.str.2 = [37 x i8] c"Doing test sort...\0A\09Test Array is: \00"
@.str.3 = [18 x i8] c"\09Iterative Sort: \00"
@.str.4 = [18 x i8] c"\09Recursive Sort: \00"
@CLOCKS_PER_SEC = global double 0.000000e+00
@.str.5 = [19 x i8] c"Finished testing.\0A\00"
@.str.6 = [80 x i8] c"Iterative quicksort stats:\0A\09Total time: %f seconds\0A\09Average time: %f seconds\0A\00"
@.str.7 = [80 x i8] c"Recursive quicksort stats:\0A\09Total time: %f seconds\0A\09Average time: %f seconds\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i64
%11 = alloca i64
%12 = alloca double
%13 = alloca double
%14 = alloca double
%15 = alloca double
%16 = alloca [10 x i32]
%17 = alloca [10 x i32]
%18 = alloca i8*
%19 = alloca i64
%20 = alloca i64
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%21 = load i32, i32* %4
%22 = icmp slt i32 %21, 3
br i1 %22, label %23, label %28
23: ; preds = %2
%24 = load i8**, i8*** %5
%25 = getelementptr inbounds i8*, i8** %24, i64 0
%26 = load i8*, i8** %25
%27 = call i32 @usage(i8* %26)
store i32 1, i32* %3
br label %150
28: ; preds = %2
%29 = load i8**, i8*** %5
%30 = getelementptr inbounds i8*, i8** %29, i64 1
%31 = load i8*, i8** %30
%32 = call i32 @atoi(i8* %31)
store i32 %32, i32* %6
%33 = load i8**, i8*** %5
%34 = getelementptr inbounds i8*, i8** %33, i64 2
%35 = load i8*, i8** %34
%36 = call i32 @atoi(i8* %35)
store i32 %36, i32* %7
%37 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0))
%38 = load i32, i32* %7
%39 = load i32, i32* %6
%40 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([56 x i8], [56 x i8]* @.str.1, i64 0, i64 0), i32 %38, i32 %39)
%41 = call i64 (...) @clock()
%42 = call i32 @srand(i64 %41)
store i32 0, i32* %8
br label %43
43: ; preds = %55, %28
%44 = load i32, i32* %8
%45 = icmp slt i32 %44, 10
br i1 %45, label %46, label %58
46: ; preds = %43
%47 = call i32 (...) @rand()
%48 = srem i32 %47, 10
%49 = load i32, i32* %8
%50 = sext i32 %49 to i64
%51 = getelementptr inbounds [10 x i32], [10 x i32]* %17, i64 0, i64 %50
store i32 %48, i32* %51
%52 = load i32, i32* %8
%53 = sext i32 %52 to i64
%54 = getelementptr inbounds [10 x i32], [10 x i32]* %16, i64 0, i64 %53
store i32 %48, i32* %54
br label %55
55: ; preds = %46
%56 = load i32, i32* %8
%57 = add nsw i32 %56, 1
store i32 %57, i32* %8
br label %43
58: ; preds = %43
%59 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.2, i64 0, i64 0))
%60 = getelementptr inbounds [10 x i32], [10 x i32]* %16, i64 0, i64 0
%61 = call i32 @print_array(i32* %60, i32 10)
%62 = getelementptr inbounds [10 x i32], [10 x i32]* %16, i64 0, i64 0
%63 = call i32 @i_qsort(i32* %62, i32 10)
%64 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.3, i64 0, i64 0))
%65 = getelementptr inbounds [10 x i32], [10 x i32]* %16, i64 0, i64 0
%66 = call i32 @print_array(i32* %65, i32 10)
%67 = getelementptr inbounds [10 x i32], [10 x i32]* %17, i64 0, i64 0
%68 = call i32 @r_qsort(i32* %67, i32 10)
%69 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.4, i64 0, i64 0))
%70 = getelementptr inbounds [10 x i32], [10 x i32]* %17, i64 0, i64 0
%71 = call i32 @print_array(i32* %70, i32 10)
store i32 0, i32* %8
br label %72
72: ; preds = %131, %58
%73 = load i32, i32* %8
%74 = load i32, i32* %7
%75 = icmp slt i32 %73, %74
br i1 %75, label %76, label %134
76: ; preds = %72
%77 = call i64 (...) @clock()
%78 = call i32 @srand(i64 %77)
%79 = load i32, i32* %6
%80 = zext i32 %79 to i64
%81 = call i8* @llvm.stacksave()
store i8* %81, i8** %18
%82 = alloca i32, i64 %80
store i64 %80, i64* %19
%83 = load i32, i32* %6
%84 = zext i32 %83 to i64
%85 = alloca i32, i64 %84
store i64 %84, i64* %20
store i32 0, i32* %9
br label %86
86: ; preds = %100, %76
%87 = load i32, i32* %9
%88 = load i32, i32* %6
%89 = icmp slt i32 %87, %88
br i1 %89, label %90, label %103
90: ; preds = %86
%91 = call i32 (...) @rand()
%92 = load i32, i32* %6
%93 = srem i32 %91, %92
%94 = load i32, i32* %8
%95 = sext i32 %94 to i64
%96 = getelementptr inbounds i32, i32* %85, i64 %95
store i32 %93, i32* %96
%97 = load i32, i32* %8
%98 = sext i32 %97 to i64
%99 = getelementptr inbounds i32, i32* %82, i64 %98
store i32 %93, i32* %99
br label %100
100: ; preds = %90
%101 = load i32, i32* %9
%102 = add nsw i32 %101, 1
store i32 %102, i32* %9
br label %86
103: ; preds = %86
%104 = call i64 (...) @clock()
store i64 %104, i64* %10
%105 = load i32, i32* %6
%106 = call i32 @i_qsort(i32* %82, i32 %105)
%107 = call i64 (...) @clock()
store i64 %107, i64* %11
%108 = load i64, i64* %11
%109 = sitofp i64 %108 to double
%110 = load i64, i64* %10
%111 = sitofp i64 %110 to double
%112 = fsub double %109, %111
%113 = load double, double* @CLOCKS_PER_SEC
%114 = fdiv double %112, %113
%115 = load double, double* %12
%116 = fadd double %115, %114
store double %116, double* %12
%117 = call i64 (...) @clock()
store i64 %117, i64* %10
%118 = load i32, i32* %6
%119 = call i32 @r_qsort(i32* %85, i32 %118)
%120 = call i64 (...) @clock()
store i64 %120, i64* %11
%121 = load i64, i64* %11
%122 = sitofp i64 %121 to double
%123 = load i64, i64* %10
%124 = sitofp i64 %123 to double
%125 = fsub double %122, %124
%126 = load double, double* @CLOCKS_PER_SEC
%127 = fdiv double %125, %126
%128 = load double, double* %13
%129 = fadd double %128, %127
store double %129, double* %13
%130 = load i8*, i8** %18
br label %131
131: ; preds = %103
%132 = load i32, i32* %8
%133 = add nsw i32 %132, 1
store i32 %133, i32* %8
br label %72
134: ; preds = %72
%135 = load double, double* %12
%136 = load i32, i32* %7
%137 = sitofp i32 %136 to double
%138 = fdiv double %135, %137
store double %138, double* %14
%139 = load double, double* %13
%140 = load i32, i32* %7
%141 = sitofp i32 %140 to double
%142 = fdiv double %139, %141
store double %142, double* %15
%143 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.5, i64 0, i64 0))
%144 = load double, double* %12
%145 = load double, double* %14
%146 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([80 x i8], [80 x i8]* @.str.6, i64 0, i64 0), double %144, double %145)
%147 = load double, double* %13
%148 = load double, double* %15
%149 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([80 x i8], [80 x i8]* @.str.7, i64 0, i64 0), double %147, double %148)
store i32 0, i32* %3
br label %150
150: ; preds = %134, %23
%151 = load i32, i32* %3
ret i32 %151
}

LLVM IR (-O2):
@.str.1 = [56 x i8] c"Number of tests will be %d with %d elements per array.\0A\00"
@.str.2 = [37 x i8] c"Doing test sort...\0A\09Test Array is: \00"
@.str.3 = [18 x i8] c"\09Iterative Sort: \00"
@.str.4 = [18 x i8] c"\09Recursive Sort: \00"
@CLOCKS_PER_SEC = global double 0.000000e+00
@.str.6 = [80 x i8] c"Iterative quicksort stats:\0A\09Total time: %f seconds\0A\09Average time: %f seconds\0A\00"
@.str.7 = [80 x i8] c"Recursive quicksort stats:\0A\09Total time: %f seconds\0A\09Average time: %f seconds\0A\00"
@str = [28 x i8] c"Preparing to start testing.\00"
@str.8 = [18 x i8] c"Finished testing.\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca [10 x i32]
%4 = alloca [10 x i32]
%5 = icmp slt i32 %0, 3
br i1 %5, label %6, label %9
6: ; preds = %2
%7 = load i8*, i8** %1
%8 = tail call i32 @usage(i8* %7)
br label %123
9: ; preds = %2
%10 = getelementptr inbounds i8*, i8** %1, i64 1
%11 = load i8*, i8** %10
%12 = tail call i32 @atoi(i8* %11)
%13 = getelementptr inbounds i8*, i8** %1, i64 2
%14 = load i8*, i8** %13
%15 = tail call i32 @atoi(i8* %14)
%16 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @str, i64 0, i64 0))
%17 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([56 x i8], [56 x i8]* @.str.1, i64 0, i64 0), i32 %15, i32 %12)
%18 = bitcast [10 x i32]* %3 to i8*
%19 = bitcast [10 x i32]* %4 to i8*
%20 = tail call i64 (...) @clock()
%21 = tail call i32 @srand(i64 %20)
%22 = tail call i32 (...) @rand()
%23 = srem i32 %22, 10
%24 = getelementptr inbounds [10 x i32], [10 x i32]* %4, i64 0, i64 0
store i32 %23, i32* %24
%25 = getelementptr inbounds [10 x i32], [10 x i32]* %3, i64 0, i64 0
store i32 %23, i32* %25
%26 = tail call i32 (...) @rand()
%27 = srem i32 %26, 10
%28 = getelementptr inbounds [10 x i32], [10 x i32]* %4, i64 0, i64 1
store i32 %27, i32* %28
%29 = getelementptr inbounds [10 x i32], [10 x i32]* %3, i64 0, i64 1
store i32 %27, i32* %29
%30 = tail call i32 (...) @rand()
%31 = srem i32 %30, 10
%32 = getelementptr inbounds [10 x i32], [10 x i32]* %4, i64 0, i64 2
store i32 %31, i32* %32
%33 = getelementptr inbounds [10 x i32], [10 x i32]* %3, i64 0, i64 2
store i32 %31, i32* %33
%34 = tail call i32 (...) @rand()
%35 = srem i32 %34, 10
%36 = getelementptr inbounds [10 x i32], [10 x i32]* %4, i64 0, i64 3
store i32 %35, i32* %36
%37 = getelementptr inbounds [10 x i32], [10 x i32]* %3, i64 0, i64 3
store i32 %35, i32* %37
%38 = tail call i32 (...) @rand()
%39 = srem i32 %38, 10
%40 = getelementptr inbounds [10 x i32], [10 x i32]* %4, i64 0, i64 4
store i32 %39, i32* %40
%41 = getelementptr inbounds [10 x i32], [10 x i32]* %3, i64 0, i64 4
store i32 %39, i32* %41
%42 = tail call i32 (...) @rand()
%43 = srem i32 %42, 10
%44 = getelementptr inbounds [10 x i32], [10 x i32]* %4, i64 0, i64 5
store i32 %43, i32* %44
%45 = getelementptr inbounds [10 x i32], [10 x i32]* %3, i64 0, i64 5
store i32 %43, i32* %45
%46 = tail call i32 (...) @rand()
%47 = srem i32 %46, 10
%48 = getelementptr inbounds [10 x i32], [10 x i32]* %4, i64 0, i64 6
store i32 %47, i32* %48
%49 = getelementptr inbounds [10 x i32], [10 x i32]* %3, i64 0, i64 6
store i32 %47, i32* %49
%50 = tail call i32 (...) @rand()
%51 = srem i32 %50, 10
%52 = getelementptr inbounds [10 x i32], [10 x i32]* %4, i64 0, i64 7
store i32 %51, i32* %52
%53 = getelementptr inbounds [10 x i32], [10 x i32]* %3, i64 0, i64 7
store i32 %51, i32* %53
%54 = tail call i32 (...) @rand()
%55 = srem i32 %54, 10
%56 = getelementptr inbounds [10 x i32], [10 x i32]* %4, i64 0, i64 8
store i32 %55, i32* %56
%57 = getelementptr inbounds [10 x i32], [10 x i32]* %3, i64 0, i64 8
store i32 %55, i32* %57
%58 = tail call i32 (...) @rand()
%59 = srem i32 %58, 10
%60 = getelementptr inbounds [10 x i32], [10 x i32]* %4, i64 0, i64 9
store i32 %59, i32* %60
%61 = getelementptr inbounds [10 x i32], [10 x i32]* %3, i64 0, i64 9
store i32 %59, i32* %61
%62 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([37 x i8], [37 x i8]* @.str.2, i64 0, i64 0))
%63 = call i32 @print_array(i32* %25, i32 10)
%64 = call i32 @i_qsort(i32* %25, i32 10)
%65 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.3, i64 0, i64 0))
%66 = call i32 @print_array(i32* %25, i32 10)
%67 = call i32 @r_qsort(i32* %24, i32 10)
%68 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.4, i64 0, i64 0))
%69 = call i32 @print_array(i32* %24, i32 10)
%70 = icmp sgt i32 %15, 0
br i1 %70, label %71, label %114
71: ; preds = %9
%72 = zext i32 %12 to i64
%73 = icmp sgt i32 %12, 0
%74 = zext i32 %15 to i64
br label %75
75: ; preds = %71, %93
%76 = phi i64 [ 0, %71 ], [ %112, %93 ]
%77 = phi double [ undef, %71 ], [ %102, %93 ]
%78 = phi double [ undef, %71 ], [ %111, %93 ]
%79 = call i64 (...) @clock()
%80 = call i32 @srand(i64 %79)
%81 = call i8* @llvm.stacksave()
%82 = alloca i32, i64 %72
%83 = alloca i32, i64 %72
br i1 %73, label %84, label %93
84: ; preds = %75
%85 = getelementptr inbounds i32, i32* %83, i64 %76
%86 = getelementptr inbounds i32, i32* %82, i64 %76
br label %87
87: ; preds = %84, %87
%88 = phi i32 [ 0, %84 ], [ %91, %87 ]
%89 = call i32 (...) @rand()
%90 = srem i32 %89, %12
store i32 %90, i32* %85
store i32 %90, i32* %86
%91 = add nuw nsw i32 %88, 1
%92 = icmp eq i32 %91, %12
br i1 %92, label %93, label %87
93: ; preds = %87, %75
%94 = call i64 (...) @clock()
%95 = call i32 @i_qsort(i32* %82, i32 %12)
%96 = call i64 (...) @clock()
%97 = sitofp i64 %96 to double
%98 = sitofp i64 %94 to double
%99 = fsub double %97, %98
%100 = load double, double* @CLOCKS_PER_SEC
%101 = fdiv double %99, %100
%102 = fadd double %77, %101
%103 = call i64 (...) @clock()
%104 = call i32 @r_qsort(i32* %83, i32 %12)
%105 = call i64 (...) @clock()
%106 = sitofp i64 %105 to double
%107 = sitofp i64 %103 to double
%108 = fsub double %106, %107
%109 = load double, double* @CLOCKS_PER_SEC
%110 = fdiv double %108, %109
%111 = fadd double %78, %110
%112 = add nuw nsw i64 %76, 1
%113 = icmp eq i64 %112, %74
br i1 %113, label %114, label %75
114: ; preds = %93, %9
%115 = phi double [ undef, %9 ], [ %111, %93 ]
%116 = phi double [ undef, %9 ], [ %102, %93 ]
%117 = sitofp i32 %15 to double
%118 = fdiv double %116, %117
%119 = fdiv double %115, %117
%120 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @str.8, i64 0, i64 0))
%121 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([80 x i8], [80 x i8]* @.str.6, i64 0, i64 0), double %116, double %118)
%122 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([80 x i8], [80 x i8]* @.str.7, i64 0, i64 0), double %115, double %119)
br label %123
123: ; preds = %114, %6
%124 = phi i32 [ 1, %6 ], [ 0, %114 ]
ret i32 %124
}