#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 /*<<< orphan*/ array;

/* Variables and functions */
int /*<<< orphan*/ init(int *, size_t, int);
int /*<<< orphan*/ output(int *, size_t);
int /*<<< orphan*/ puts(char *);
int /*<<< orphan*/ quick_sort(int *, size_t);
int /*<<< orphan*/ srandom(int /*<<< orphan*/);
int /*<<< orphan*/ test(int *, size_t);
int /*<<< orphan*/ time(int /*<<< orphan*/ *);
int /*<<< orphan*/ validate(int *, size_t);
int main(int argc, char **argv) {
  int array[32] = {2, 9, 4, 7, 5, 3, 6, 1, 8, 0};
  size_t len = sizeof(array) / sizeof(array[0]);
  srandom(time(NULL));
  init(array, len, 100);
  output(array, len);
  quick_sort(array, len);
  validate(array, len);
  output(array, len);
  test(array, len);
  puts("----------------------------");
  init(array, len, 100);
  output(array, len);
  quick_sort(array, len);
  validate(array, len);
  output(array, len);
  test(array, len);
  puts("----------------------------");
  init(array, len, 100);
  output(array, len);
  quick_sort(array, len);
  validate(array, len);
  output(array, len);
  test(array, len);
  puts("----------------------------");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xa0,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    -0x90(%rbp),%rdi
lea    0xe49(%rip),%rsi
mov    $0x80,%edx
call   1060 <memcpy@plt>
movq   $0x20,-0x98(%rbp)
xor    %eax,%eax
mov    %eax,%edi
call   1080 <time@plt>
mov    %eax,%edi
call   1030 <srandom@plt>
lea    -0x90(%rbp),%rdi
mov    -0x98(%rbp),%rsi
mov    $0x64,%edx
call   1070 <init@plt>
lea    -0x90(%rbp),%rdi
mov    -0x98(%rbp),%rsi
call   1050 <output@plt>
lea    -0x90(%rbp),%rdi
mov    -0x98(%rbp),%rsi
call   10a0 <quick_sort@plt>
lea    -0x90(%rbp),%rdi
mov    -0x98(%rbp),%rsi
call   1090 <validate@plt>
lea    -0x90(%rbp),%rdi
mov    -0x98(%rbp),%rsi
call   1050 <output@plt>
lea    -0x90(%rbp),%rdi
mov    -0x98(%rbp),%rsi
call   10b0 <test@plt>
lea    0xe26(%rip),%rdi
call   1040 <puts@plt>
lea    -0x90(%rbp),%rdi
mov    -0x98(%rbp),%rsi
mov    $0x64,%edx
call   1070 <init@plt>
lea    -0x90(%rbp),%rdi
mov    -0x98(%rbp),%rsi
call   1050 <output@plt>
lea    -0x90(%rbp),%rdi
mov    -0x98(%rbp),%rsi
call   10a0 <quick_sort@plt>
lea    -0x90(%rbp),%rdi
mov    -0x98(%rbp),%rsi
call   1090 <validate@plt>
lea    -0x90(%rbp),%rdi
mov    -0x98(%rbp),%rsi
call   1050 <output@plt>
lea    -0x90(%rbp),%rdi
mov    -0x98(%rbp),%rsi
call   10b0 <test@plt>
lea    0xda3(%rip),%rdi
call   1040 <puts@plt>
lea    -0x90(%rbp),%rdi
mov    -0x98(%rbp),%rsi
mov    $0x64,%edx
call   1070 <init@plt>
lea    -0x90(%rbp),%rdi
mov    -0x98(%rbp),%rsi
call   1050 <output@plt>
lea    -0x90(%rbp),%rdi
mov    -0x98(%rbp),%rsi
call   10a0 <quick_sort@plt>
lea    -0x90(%rbp),%rdi
mov    -0x98(%rbp),%rsi
call   1090 <validate@plt>
lea    -0x90(%rbp),%rdi
mov    -0x98(%rbp),%rsi
call   1050 <output@plt>
lea    -0x90(%rbp),%rdi
mov    -0x98(%rbp),%rsi
call   10b0 <test@plt>
lea    0xd20(%rip),%rdi
call   1040 <puts@plt>
xor    %eax,%eax
add    $0xa0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x88,%rsp
movaps 0xedf(%rip),%xmm0
movaps %xmm0,0x70(%rsp)
movaps 0xec3(%rip),%xmm0
movaps %xmm0,0x60(%rsp)
movaps 0xea7(%rip),%xmm0
movaps %xmm0,0x50(%rsp)
movaps 0xe8b(%rip),%xmm0
movaps %xmm0,0x40(%rsp)
movaps 0xe6f(%rip),%xmm0
movaps %xmm0,0x30(%rsp)
movaps 0xe53(%rip),%xmm0
movaps %xmm0,0x20(%rsp)
movaps 0xe37(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movaps 0xe1b(%rip),%xmm0
movaps %xmm0,(%rsp)
xor    %edi,%edi
call   1070 <time@plt>
mov    %eax,%edi
call   1030 <srandom@plt>
mov    %rsp,%rbx
mov    $0x20,%esi
mov    %rbx,%rdi
mov    $0x64,%edx
call   1060 <init@plt>
mov    $0x20,%esi
mov    %rbx,%rdi
call   1050 <output@plt>
mov    $0x20,%esi
mov    %rbx,%rdi
call   1090 <quick_sort@plt>
mov    $0x20,%esi
mov    %rbx,%rdi
call   1080 <validate@plt>
mov    $0x20,%esi
mov    %rbx,%rdi
call   1050 <output@plt>
mov    $0x20,%esi
mov    %rbx,%rdi
call   10a0 <test@plt>
lea    0xe2c(%rip),%r14
mov    %r14,%rdi
call   1040 <puts@plt>
mov    $0x20,%esi
mov    %rbx,%rdi
mov    $0x64,%edx
call   1060 <init@plt>
mov    $0x20,%esi
mov    %rbx,%rdi
call   1050 <output@plt>
mov    $0x20,%esi
mov    %rbx,%rdi
call   1090 <quick_sort@plt>
mov    $0x20,%esi
mov    %rbx,%rdi
call   1080 <validate@plt>
mov    $0x20,%esi
mov    %rbx,%rdi
call   1050 <output@plt>
mov    $0x20,%esi
mov    %rbx,%rdi
call   10a0 <test@plt>
mov    %r14,%rdi
call   1040 <puts@plt>
mov    $0x20,%esi
mov    %rbx,%rdi
mov    $0x64,%edx
call   1060 <init@plt>
mov    $0x20,%esi
mov    %rbx,%rdi
call   1050 <output@plt>
mov    $0x20,%esi
mov    %rbx,%rdi
call   1090 <quick_sort@plt>
mov    $0x20,%esi
mov    %rbx,%rdi
call   1080 <validate@plt>
mov    $0x20,%esi
mov    %rbx,%rdi
call   1050 <output@plt>
mov    $0x20,%esi
mov    %rbx,%rdi
call   10a0 <test@plt>
mov    %r14,%rdi
call   1040 <puts@plt>
xor    %eax,%eax
add    $0x88,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@__const.main.array = <{ [9 x i32], [23 x i32] }> <{ [9 x i32] [i32 2, i32 9, i32 4, i32 7, i32 5, i32 3, i32 6, i32 1, i32 8], [23 x i32] zeroinitializer }>
@.str = [29 x i8] c"----------------------------\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [32 x i32]
%7 = alloca i64
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%8 = bitcast [32 x i32]* %6 to i8*
store i64 32, i64* %7
%9 = call i32 @time(i32* null)
%10 = call i32 @srandom(i32 %9)
%11 = getelementptr inbounds [32 x i32], [32 x i32]* %6, i64 0, i64 0
%12 = load i64, i64* %7
%13 = call i32 @init(i32* %11, i64 %12, i32 100)
%14 = getelementptr inbounds [32 x i32], [32 x i32]* %6, i64 0, i64 0
%15 = load i64, i64* %7
%16 = call i32 @output(i32* %14, i64 %15)
%17 = getelementptr inbounds [32 x i32], [32 x i32]* %6, i64 0, i64 0
%18 = load i64, i64* %7
%19 = call i32 @quick_sort(i32* %17, i64 %18)
%20 = getelementptr inbounds [32 x i32], [32 x i32]* %6, i64 0, i64 0
%21 = load i64, i64* %7
%22 = call i32 @validate(i32* %20, i64 %21)
%23 = getelementptr inbounds [32 x i32], [32 x i32]* %6, i64 0, i64 0
%24 = load i64, i64* %7
%25 = call i32 @output(i32* %23, i64 %24)
%26 = getelementptr inbounds [32 x i32], [32 x i32]* %6, i64 0, i64 0
%27 = load i64, i64* %7
%28 = call i32 @test(i32* %26, i64 %27)
%29 = call i32 @puts(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0))
%30 = getelementptr inbounds [32 x i32], [32 x i32]* %6, i64 0, i64 0
%31 = load i64, i64* %7
%32 = call i32 @init(i32* %30, i64 %31, i32 100)
%33 = getelementptr inbounds [32 x i32], [32 x i32]* %6, i64 0, i64 0
%34 = load i64, i64* %7
%35 = call i32 @output(i32* %33, i64 %34)
%36 = getelementptr inbounds [32 x i32], [32 x i32]* %6, i64 0, i64 0
%37 = load i64, i64* %7
%38 = call i32 @quick_sort(i32* %36, i64 %37)
%39 = getelementptr inbounds [32 x i32], [32 x i32]* %6, i64 0, i64 0
%40 = load i64, i64* %7
%41 = call i32 @validate(i32* %39, i64 %40)
%42 = getelementptr inbounds [32 x i32], [32 x i32]* %6, i64 0, i64 0
%43 = load i64, i64* %7
%44 = call i32 @output(i32* %42, i64 %43)
%45 = getelementptr inbounds [32 x i32], [32 x i32]* %6, i64 0, i64 0
%46 = load i64, i64* %7
%47 = call i32 @test(i32* %45, i64 %46)
%48 = call i32 @puts(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0))
%49 = getelementptr inbounds [32 x i32], [32 x i32]* %6, i64 0, i64 0
%50 = load i64, i64* %7
%51 = call i32 @init(i32* %49, i64 %50, i32 100)
%52 = getelementptr inbounds [32 x i32], [32 x i32]* %6, i64 0, i64 0
%53 = load i64, i64* %7
%54 = call i32 @output(i32* %52, i64 %53)
%55 = getelementptr inbounds [32 x i32], [32 x i32]* %6, i64 0, i64 0
%56 = load i64, i64* %7
%57 = call i32 @quick_sort(i32* %55, i64 %56)
%58 = getelementptr inbounds [32 x i32], [32 x i32]* %6, i64 0, i64 0
%59 = load i64, i64* %7
%60 = call i32 @validate(i32* %58, i64 %59)
%61 = getelementptr inbounds [32 x i32], [32 x i32]* %6, i64 0, i64 0
%62 = load i64, i64* %7
%63 = call i32 @output(i32* %61, i64 %62)
%64 = getelementptr inbounds [32 x i32], [32 x i32]* %6, i64 0, i64 0
%65 = load i64, i64* %7
%66 = call i32 @test(i32* %64, i64 %65)
%67 = call i32 @puts(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@__const.main.array = <{ [9 x i32], [23 x i32] }> <{ [9 x i32] [i32 2, i32 9, i32 4, i32 7, i32 5, i32 3, i32 6, i32 1, i32 8], [23 x i32] zeroinitializer }>
@.str = [29 x i8] c"----------------------------\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca [32 x i32]
%4 = bitcast [32 x i32]* %3 to i8*
%5 = tail call i32 @time(i32* null)
%6 = tail call i32 @srandom(i32 %5)
%7 = getelementptr inbounds [32 x i32], [32 x i32]* %3, i64 0, i64 0
%8 = call i32 @init(i32* %7, i64 32, i32 100)
%9 = call i32 @output(i32* %7, i64 32)
%10 = call i32 @quick_sort(i32* %7, i64 32)
%11 = call i32 @validate(i32* %7, i64 32)
%12 = call i32 @output(i32* %7, i64 32)
%13 = call i32 @test(i32* %7, i64 32)
%14 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0))
%15 = call i32 @init(i32* %7, i64 32, i32 100)
%16 = call i32 @output(i32* %7, i64 32)
%17 = call i32 @quick_sort(i32* %7, i64 32)
%18 = call i32 @validate(i32* %7, i64 32)
%19 = call i32 @output(i32* %7, i64 32)
%20 = call i32 @test(i32* %7, i64 32)
%21 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0))
%22 = call i32 @init(i32* %7, i64 32, i32 100)
%23 = call i32 @output(i32* %7, i64 32)
%24 = call i32 @quick_sort(i32* %7, i64 32)
%25 = call i32 @validate(i32* %7, i64 32)
%26 = call i32 @output(i32* %7, i64 32)
%27 = call i32 @test(i32* %7, i64 32)
%28 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0))
ret i32 0
}