#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*/ printf(char *, double);
int /*<<< orphan*/ quicksort(int *, int /*<<< orphan*/, int);
int /*<<< orphan*/ scanf(char *, int *);
int main() {
  clock_t start, end;
  double res;
  int arr[1000000], size, i;
  size = 1000000;
  for (i = 0; i < size; i++) {
    scanf("%d", arr + i);
  }
  start = clock();
  quicksort(arr, 0, size - 1);
  end = clock();
  res = (end - start) * 1000 / CLOCKS_PER_SEC;
  printf("%f", res);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x3d0930,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0xf4240,-0x3d0924(%rbp)
movl   $0x0,-0x3d0928(%rbp)
mov    -0x3d0928(%rbp),%eax
cmp    -0x3d0924(%rbp),%eax
jge    11ad <main+0x6d>
lea    -0x3d0920(%rbp),%rsi
movslq -0x3d0928(%rbp),%rax
shl    $0x2,%rax
add    %rax,%rsi
lea    0xe6c(%rip),%rdi
call   1060 <scanf@plt>
mov    -0x3d0928(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x3d0928(%rbp)
jmp    1166 <main+0x26>
mov    $0x0,%al
call   1030 <clock@plt>
mov    %eax,-0x8(%rbp)
lea    -0x3d0920(%rbp),%rdi
mov    -0x3d0924(%rbp),%edx
sub    $0x1,%edx
xor    %esi,%esi
call   1040 <quicksort@plt>
mov    $0x0,%al
call   1030 <clock@plt>
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
sub    -0x8(%rbp),%eax
imul   $0x3e8,%eax,%eax
mov    0x2dfd(%rip),%rcx
cltd
idivl  (%rcx)
cvtsi2sd %eax,%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
lea    0xe00(%rip),%rdi
call   1050 <printf@plt>
xor    %eax,%eax
add    $0x3d0930,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x3d0908,%rsp
xor    %ebx,%ebx
lea    0xead(%rip),%r14
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
lea    (%rsp,%rbx,1),%rsi
mov    %r14,%rdi
call   1060 <scanf@plt>
add    $0x4,%rbx
cmp    $0x3d0900,%rbx
jne    1160 <main+0x20>
xor    %eax,%eax
call   1030 <clock@plt>
mov    %eax,%ebx
mov    %rsp,%rdi
xor    %esi,%esi
mov    $0xf423f,%edx
call   1040 <quicksort@plt>
xor    %eax,%eax
call   1030 <clock@plt>
sub    %ebx,%eax
imul   $0x3e8,%eax,%eax
mov    0x2e41(%rip),%rcx
cltd
idivl  (%rcx)
cvtsi2sd %eax,%xmm0
lea    0xe4e(%rip),%rdi
call   1050 <printf@plt>
xor    %eax,%eax
add    $0x3d0908,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
@CLOCKS_PER_SEC = global i32 0
@.str.1 = [3 x i8] c"%f\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca double
%5 = alloca [1000000 x i32]
%6 = alloca i32
%7 = alloca i32
store i32 0, i32* %1
store i32 1000000, i32* %6
store i32 0, i32* %7
br label %8
8: ; preds = %18, %0
%9 = load i32, i32* %7
%10 = load i32, i32* %6
%11 = icmp slt i32 %9, %10
br i1 %11, label %12, label %21
12: ; preds = %8
%13 = getelementptr inbounds [1000000 x i32], [1000000 x i32]* %5, i64 0, i64 0
%14 = load i32, i32* %7
%15 = sext i32 %14 to i64
%16 = getelementptr inbounds i32, i32* %13, i64 %15
%17 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %16)
br label %18
18: ; preds = %12
%19 = load i32, i32* %7
%20 = add nsw i32 %19, 1
store i32 %20, i32* %7
br label %8
21: ; preds = %8
%22 = call i32 (...) @clock()
store i32 %22, i32* %2
%23 = getelementptr inbounds [1000000 x i32], [1000000 x i32]* %5, i64 0, i64 0
%24 = load i32, i32* %6
%25 = sub nsw i32 %24, 1
%26 = call i32 @quicksort(i32* %23, i32 0, i32 %25)
%27 = call i32 (...) @clock()
store i32 %27, i32* %3
%28 = load i32, i32* %3
%29 = load i32, i32* %2
%30 = sub nsw i32 %28, %29
%31 = mul nsw i32 %30, 1000
%32 = load i32, i32* @CLOCKS_PER_SEC
%33 = sdiv i32 %31, %32
%34 = sitofp i32 %33 to double
store double %34, double* %4
%35 = load double, double* %4
%36 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), double %35)
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@CLOCKS_PER_SEC = global i32 0
@.str.1 = [3 x i8] c"%f\00"
define i32 @main() {
%1 = alloca [1000000 x i32]
%2 = bitcast [1000000 x i32]* %1 to i8*
br label %3
3: ; preds = %0, %3
%4 = phi i64 [ 0, %0 ], [ %7, %3 ]
%5 = getelementptr inbounds [1000000 x i32], [1000000 x i32]* %1, i64 0, i64 %4
%6 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %5)
%7 = add nuw nsw i64 %4, 1
%8 = icmp eq i64 %7, 1000000
br i1 %8, label %9, label %3
9: ; preds = %3
%10 = call i32 (...) @clock()
%11 = getelementptr inbounds [1000000 x i32], [1000000 x i32]* %1, i64 0, i64 0
%12 = call i32 @quicksort(i32* %11, i32 0, i32 999999)
%13 = call i32 (...) @clock()
%14 = sub nsw i32 %13, %10
%15 = mul nsw i32 %14, 1000
%16 = load i32, i32* @CLOCKS_PER_SEC
%17 = sdiv i32 %15, %16
%18 = sitofp i32 %17 to double
%19 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), double %18)
ret i32 0
}