#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__ time_t;

/* Variables and functions */
double CLOCKS_PER_SEC;
scalar_t__ clock();
int /*<<< orphan*/ printf(char *, double);
int /*<<< orphan*/ rand_quicksort(int *, int /*<<< orphan*/, int, int);
int /*<<< orphan*/ rand_seq3(int *, int);
int main() {
  time_t c_start, c_end;
  int i, n, k;
  n = 2000000;
  int A[n];
  rand_seq3(A, n);
  k = 9;
  c_start = clock();
  rand_quicksort(A, 0, n - 1, k);
  c_end = clock();
  printf("The pause used %f s by clock()\n",
         (double)(c_end, c_start) / CLOCKS_PER_SEC);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x1e8480,-0x20(%rbp)
mov    -0x20(%rbp),%eax
mov    %rsp,%rcx
mov    %rcx,-0x30(%rbp)
lea    0xf(,%rax,4),%rcx
and    $0xfffffffffffffff0,%rcx
mov    %rsp,%rdi
sub    %rcx,%rdi
mov    %rdi,-0x40(%rbp)
mov    %rdi,%rsp
mov    %rax,-0x38(%rbp)
mov    -0x20(%rbp),%esi
call   1060 <rand_seq3@plt>
movl   $0x9,-0x24(%rbp)
mov    $0x0,%al
call   1030 <clock@plt>
mov    -0x40(%rbp),%rdi
mov    %rax,-0x10(%rbp)
mov    -0x20(%rbp),%edx
sub    $0x1,%edx
mov    -0x24(%rbp),%ecx
xor    %esi,%esi
call   1050 <rand_quicksort@plt>
mov    $0x0,%al
call   1030 <clock@plt>
mov    %rax,-0x18(%rbp)
cvtsi2sdq -0x10(%rbp),%xmm0
mov    0x2e25(%rip),%rax
divsd  (%rax),%xmm0
lea    0xe32(%rip),%rdi
call   1040 <printf@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x30(%rbp),%rax
mov    %rax,%rsp
mov    -0x4(%rbp),%eax
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x7a1208,%rsp
mov    %rsp,%r14
mov    %r14,%rdi
mov    $0x1e8480,%esi
call   1060 <rand_seq3@plt>
xor    %eax,%eax
call   1030 <clock@plt>
mov    %rax,%rbx
mov    %r14,%rdi
xor    %esi,%esi
mov    $0x1e847f,%edx
mov    $0x9,%ecx
call   1050 <rand_quicksort@plt>
xor    %eax,%eax
call   1030 <clock@plt>
cvtsi2sd %rbx,%xmm0
mov    0x2e5d(%rip),%rax
divsd  (%rax),%xmm0
lea    0xe6a(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x7a1208,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [32 x i8] c"The pause used %f s by clock()\0A\00"
@CLOCKS_PER_SEC = global double 0.000000e+00
define i32 @main() {
%1 = alloca i32
%2 = alloca i64
%3 = alloca i64
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i8*
%8 = alloca i64
store i32 0, i32* %1
store i32 2000000, i32* %5
%9 = load i32, i32* %5
%10 = zext i32 %9 to i64
%11 = call i8* @llvm.stacksave()
store i8* %11, i8** %7
%12 = alloca i32, i64 %10
store i64 %10, i64* %8
%13 = load i32, i32* %5
%14 = call i32 @rand_seq3(i32* %12, i32 %13)
store i32 9, i32* %6
%15 = call i64 (...) @clock()
store i64 %15, i64* %2
%16 = load i32, i32* %5
%17 = sub nsw i32 %16, 1
%18 = load i32, i32* %6
%19 = call i32 @rand_quicksort(i32* %12, i32 0, i32 %17, i32 %18)
%20 = call i64 (...) @clock()
store i64 %20, i64* %3
%21 = load i64, i64* %3
%22 = load i64, i64* %2
%23 = sitofp i64 %22 to double
%24 = load double, double* @CLOCKS_PER_SEC
%25 = fdiv double %23, %24
%26 = call i32 @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0), double %25)
store i32 0, i32* %1
%27 = load i8*, i8** %7
%28 = load i32, i32* %1
ret i32 %28
}

LLVM IR (-O2):
@.str = [32 x i8] c"The pause used %f s by clock()\0A\00"
@CLOCKS_PER_SEC = global double 0.000000e+00
define i32 @main() {
%1 = alloca [2000000 x i32]
%2 = getelementptr inbounds [2000000 x i32], [2000000 x i32]* %1, i64 0, i64 0
%3 = call i32 @rand_seq3(i32* %2, i32 2000000)
%4 = call i64 (...) @clock()
%5 = call i32 @rand_quicksort(i32* %2, i32 0, i32 1999999, i32 9)
%6 = call i64 (...) @clock()
%7 = sitofp i64 %4 to double
%8 = load double, double* @CLOCKS_PER_SEC
%9 = fdiv double %7, %8
%10 = call i32 @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0), double %9)
ret i32 0
}