#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 int clock_t;

/* Variables and functions */
int CLOCKS_PER_SEC;
int clock();
int /*<<< orphan*/ fillArray(int *, int);
int /*<<< orphan*/ quickSort(int *, int, int);
float getTimeForQuickSort(int arr[], int low, int high) {
  int i;
  float total = 0.0;
  clock_t start, stop;
  for (i = 0; i < 5000; i++) {
    start = clock();
    quickSort(arr, low, high);
    stop = clock();
    total += (float)(1000 * (stop - start) / CLOCKS_PER_SEC);
    fillArray(arr, high);
  }
  total = (float)total / 5000;
  return total;
}


x86 assembly (clang, -O0):
<getTimeForQuickSort>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
xorps  %xmm0,%xmm0
movss  %xmm0,-0x18(%rbp)
movl   $0x0,-0x14(%rbp)
cmpl   $0x1388,-0x14(%rbp)
jge    11bf <getTimeForQuickSort+0x8f>
mov    $0x0,%al
call   1030 <clock@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
call   1050 <quickSort@plt>
mov    $0x0,%al
call   1030 <clock@plt>
mov    %eax,-0x20(%rbp)
mov    -0x20(%rbp),%eax
sub    -0x1c(%rbp),%eax
imul   $0x3e8,%eax,%eax
mov    0x2e54(%rip),%rcx
cltd
idivl  (%rcx)
cvtsi2ss %eax,%xmm0
addss  -0x18(%rbp),%xmm0
movss  %xmm0,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%esi
call   1040 <fillArray@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1151 <getTimeForQuickSort+0x21>
movss  -0x18(%rbp),%xmm0
movss  0xe34(%rip),%xmm1
divss  %xmm1,%xmm0
movss  %xmm0,-0x18(%rbp)
movss  -0x18(%rbp),%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getTimeForQuickSort>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %edx,%r15d
mov    %esi,%r14d
mov    %rdi,%r12
xorps  %xmm0,%xmm0
movss  %xmm0,0x4(%rsp)
mov    $0x1388,%ebp
mov    0x2e8f(%rip),%r13
nopl   0x0(%rax)
xor    %eax,%eax
call   1030 <clock@plt>
mov    %eax,%ebx
mov    %r12,%rdi
mov    %r14d,%esi
mov    %r15d,%edx
call   1050 <quickSort@plt>
xor    %eax,%eax
call   1030 <clock@plt>
sub    %ebx,%eax
imul   $0x3e8,%eax,%eax
cltd
idivl  0x0(%r13)
xorps  %xmm0,%xmm0
cvtsi2ss %eax,%xmm0
movss  0x4(%rsp),%xmm1
addss  %xmm0,%xmm1
movss  %xmm1,0x4(%rsp)
mov    %r12,%rdi
mov    %r15d,%esi
call   1040 <fillArray@plt>
add    $0xffffffff,%ebp
jne    1160 <getTimeForQuickSort+0x30>
movss  0x4(%rsp),%xmm0
divss  0xe40(%rip),%xmm0
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@CLOCKS_PER_SEC = global i32 0
define float @getTimeForQuickSort(i32* %0, i32 %1, i32 %2) {
%4 = alloca i32*
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca float
%9 = alloca i32
%10 = alloca i32
store i32* %0, i32** %4
store i32 %1, i32* %5
store i32 %2, i32* %6
store float 0.000000e+00, float* %8
store i32 0, i32* %7
br label %11
11: ; preds = %33, %3
%12 = load i32, i32* %7
%13 = icmp slt i32 %12, 5000
br i1 %13, label %14, label %36
14: ; preds = %11
%15 = call i32 (...) @clock()
store i32 %15, i32* %9
%16 = load i32*, i32** %4
%17 = load i32, i32* %5
%18 = load i32, i32* %6
%19 = call i32 @quickSort(i32* %16, i32 %17, i32 %18)
%20 = call i32 (...) @clock()
store i32 %20, i32* %10
%21 = load i32, i32* %10
%22 = load i32, i32* %9
%23 = sub nsw i32 %21, %22
%24 = mul nsw i32 1000, %23
%25 = load i32, i32* @CLOCKS_PER_SEC
%26 = sdiv i32 %24, %25
%27 = sitofp i32 %26 to float
%28 = load float, float* %8
%29 = fadd float %28, %27
store float %29, float* %8
%30 = load i32*, i32** %4
%31 = load i32, i32* %6
%32 = call i32 @fillArray(i32* %30, i32 %31)
br label %33
33: ; preds = %14
%34 = load i32, i32* %7
%35 = add nsw i32 %34, 1
store i32 %35, i32* %7
br label %11
36: ; preds = %11
%37 = load float, float* %8
%38 = fdiv float %37, 5.000000e+03
store float %38, float* %8
%39 = load float, float* %8
ret float %39
}

LLVM IR (-O2):
@CLOCKS_PER_SEC = global i32 0
define float @getTimeForQuickSort(i32* %0, i32 %1, i32 %2) {
br label %4
4: ; preds = %3, %4
%5 = phi i32 [ 0, %3 ], [ %17, %4 ]
%6 = phi float [ 0.000000e+00, %3 ], [ %15, %4 ]
%7 = tail call i32 (...) @clock()
%8 = tail call i32 @quickSort(i32* %0, i32 %1, i32 %2)
%9 = tail call i32 (...) @clock()
%10 = sub nsw i32 %9, %7
%11 = mul nsw i32 %10, 1000
%12 = load i32, i32* @CLOCKS_PER_SEC
%13 = sdiv i32 %11, %12
%14 = sitofp i32 %13 to float
%15 = fadd float %6, %14
%16 = tail call i32 @fillArray(i32* %0, i32 %2)
%17 = add nuw nsw i32 %5, 1
%18 = icmp eq i32 %17, 5000
br i1 %18, label %19, label %4
19: ; preds = %4
%20 = fdiv float %15, 5.000000e+03
ret float %20
}