#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 */

/* Variables and functions */
int /*<<< orphan*/ display(int *, int);
int /*<<< orphan*/ quick_sort(int *, int);
int /*<<< orphan*/ top(int *, int, int);
int main(int argc, char **argv) {
  int array[] = {3, 1, 4, 1, 5, 9, 2, 6, 5, 3};
  display(array, 10);
  quick_sort(array, 10);
  display(array, 10);
  int a[] = {1, 2, 3};
  display(a, 3);
  quick_sort(a, 3);
  display(a, 3);
  int b[] = {2, 1};
  display(b, 2);
  quick_sort(b, 2);
  display(b, 2);
  int data[] = {3, 1, 4, 1, 5, 9, 2, 6, 5, 3};
  display(data, 10);
  top(data, 10, 5);
  display(data, 10);
  top(data, 10, 4);
  display(data, 10);
  top(data, 10, 3);
  display(data, 10);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    -0x40(%rbp),%rdi
lea    0xe9c(%rip),%rsi
mov    $0x28,%edx
call   1040 <memcpy@plt>
lea    -0x40(%rbp),%rdi
mov    $0xa,%esi
call   1030 <display@plt>
lea    -0x40(%rbp),%rdi
mov    $0xa,%esi
call   1060 <quick_sort@plt>
lea    -0x40(%rbp),%rdi
mov    $0xa,%esi
call   1030 <display@plt>
mov    0xe89(%rip),%rax
mov    %rax,-0x4c(%rbp)
mov    0xe87(%rip),%eax
mov    %eax,-0x44(%rbp)
lea    -0x4c(%rbp),%rdi
mov    $0x3,%esi
call   1030 <display@plt>
lea    -0x4c(%rbp),%rdi
mov    $0x3,%esi
call   1060 <quick_sort@plt>
lea    -0x4c(%rbp),%rdi
mov    $0x3,%esi
call   1030 <display@plt>
mov    0xe8b(%rip),%rax
mov    %rax,-0x54(%rbp)
lea    -0x54(%rbp),%rdi
mov    $0x2,%esi
call   1030 <display@plt>
lea    -0x54(%rbp),%rdi
mov    $0x2,%esi
call   1060 <quick_sort@plt>
lea    -0x54(%rbp),%rdi
mov    $0x2,%esi
call   1030 <display@plt>
lea    -0x80(%rbp),%rdi
lea    0xe2a(%rip),%rsi
mov    $0x28,%edx
call   1040 <memcpy@plt>
lea    -0x80(%rbp),%rdi
mov    $0xa,%esi
call   1030 <display@plt>
lea    -0x80(%rbp),%rdi
mov    $0xa,%esi
mov    $0x5,%edx
call   1050 <top@plt>
lea    -0x80(%rbp),%rdi
mov    $0xa,%esi
call   1030 <display@plt>
lea    -0x80(%rbp),%rdi
mov    $0xa,%esi
mov    $0x4,%edx
call   1050 <top@plt>
lea    -0x80(%rbp),%rdi
mov    $0xa,%esi
call   1030 <display@plt>
lea    -0x80(%rbp),%rdi
mov    $0xa,%esi
mov    $0x3,%edx
call   1050 <top@plt>
lea    -0x80(%rbp),%rdi
mov    $0xa,%esi
call   1030 <display@plt>
xor    %eax,%eax
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x78,%rsp
mov    0xef2(%rip),%r14
mov    %r14,0x70(%rsp)
movaps 0xed6(%rip),%xmm0
movaps %xmm0,0x60(%rsp)
movaps 0xeba(%rip),%xmm0
movaps %xmm0,0x50(%rsp)
lea    0x50(%rsp),%rbx
mov    %rbx,%rdi
mov    $0xa,%esi
call   1030 <display@plt>
mov    %rbx,%rdi
mov    $0xa,%esi
call   1050 <quick_sort@plt>
mov    %rbx,%rdi
mov    $0xa,%esi
call   1030 <display@plt>
mov    0xe7b(%rip),%eax
mov    %eax,0x18(%rsp)
mov    0xe68(%rip),%rax
mov    %rax,0x10(%rsp)
lea    0x10(%rsp),%rbx
mov    %rbx,%rdi
mov    $0x3,%esi
call   1030 <display@plt>
mov    %rbx,%rdi
mov    $0x3,%esi
call   1050 <quick_sort@plt>
mov    %rbx,%rdi
mov    $0x3,%esi
call   1030 <display@plt>
movabs $0x100000002,%rax
mov    %rax,0x8(%rsp)
lea    0x8(%rsp),%rbx
mov    %rbx,%rdi
mov    $0x2,%esi
call   1030 <display@plt>
mov    %rbx,%rdi
mov    $0x2,%esi
call   1050 <quick_sort@plt>
mov    %rbx,%rdi
mov    $0x2,%esi
call   1030 <display@plt>
mov    %r14,0x40(%rsp)
movaps 0xe10(%rip),%xmm0
movaps %xmm0,0x30(%rsp)
movaps 0xdf4(%rip),%xmm0
movaps %xmm0,0x20(%rsp)
lea    0x20(%rsp),%rbx
mov    %rbx,%rdi
mov    $0xa,%esi
call   1030 <display@plt>
mov    %rbx,%rdi
mov    $0xa,%esi
mov    $0x5,%edx
call   1040 <top@plt>
mov    %rbx,%rdi
mov    $0xa,%esi
call   1030 <display@plt>
mov    %rbx,%rdi
mov    $0xa,%esi
mov    $0x4,%edx
call   1040 <top@plt>
mov    %rbx,%rdi
mov    $0xa,%esi
call   1030 <display@plt>
mov    %rbx,%rdi
mov    $0xa,%esi
mov    $0x3,%edx
call   1040 <top@plt>
mov    %rbx,%rdi
mov    $0xa,%esi
call   1030 <display@plt>
xor    %eax,%eax
add    $0x78,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@__const.main.array = [10 x i32] [i32 3, i32 1, i32 4, i32 1, i32 5, i32 9, i32 2, i32 6, i32 5, i32 3]
@__const.main.a = [3 x i32] [i32 1, i32 2, i32 3]
@__const.main.b = [2 x i32] [i32 2, i32 1]
@__const.main.data = [10 x i32] [i32 3, i32 1, i32 4, i32 1, i32 5, i32 9, i32 2, i32 6, i32 5, i32 3]
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [10 x i32]
%7 = alloca [3 x i32]
%8 = alloca [2 x i32]
%9 = alloca [10 x i32]
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%10 = bitcast [10 x i32]* %6 to i8*
%11 = getelementptr inbounds [10 x i32], [10 x i32]* %6, i64 0, i64 0
%12 = call i32 @display(i32* %11, i32 10)
%13 = getelementptr inbounds [10 x i32], [10 x i32]* %6, i64 0, i64 0
%14 = call i32 @quick_sort(i32* %13, i32 10)
%15 = getelementptr inbounds [10 x i32], [10 x i32]* %6, i64 0, i64 0
%16 = call i32 @display(i32* %15, i32 10)
%17 = bitcast [3 x i32]* %7 to i8*
%18 = getelementptr inbounds [3 x i32], [3 x i32]* %7, i64 0, i64 0
%19 = call i32 @display(i32* %18, i32 3)
%20 = getelementptr inbounds [3 x i32], [3 x i32]* %7, i64 0, i64 0
%21 = call i32 @quick_sort(i32* %20, i32 3)
%22 = getelementptr inbounds [3 x i32], [3 x i32]* %7, i64 0, i64 0
%23 = call i32 @display(i32* %22, i32 3)
%24 = bitcast [2 x i32]* %8 to i8*
%25 = getelementptr inbounds [2 x i32], [2 x i32]* %8, i64 0, i64 0
%26 = call i32 @display(i32* %25, i32 2)
%27 = getelementptr inbounds [2 x i32], [2 x i32]* %8, i64 0, i64 0
%28 = call i32 @quick_sort(i32* %27, i32 2)
%29 = getelementptr inbounds [2 x i32], [2 x i32]* %8, i64 0, i64 0
%30 = call i32 @display(i32* %29, i32 2)
%31 = bitcast [10 x i32]* %9 to i8*
%32 = getelementptr inbounds [10 x i32], [10 x i32]* %9, i64 0, i64 0
%33 = call i32 @display(i32* %32, i32 10)
%34 = getelementptr inbounds [10 x i32], [10 x i32]* %9, i64 0, i64 0
%35 = call i32 @top(i32* %34, i32 10, i32 5)
%36 = getelementptr inbounds [10 x i32], [10 x i32]* %9, i64 0, i64 0
%37 = call i32 @display(i32* %36, i32 10)
%38 = getelementptr inbounds [10 x i32], [10 x i32]* %9, i64 0, i64 0
%39 = call i32 @top(i32* %38, i32 10, i32 4)
%40 = getelementptr inbounds [10 x i32], [10 x i32]* %9, i64 0, i64 0
%41 = call i32 @display(i32* %40, i32 10)
%42 = getelementptr inbounds [10 x i32], [10 x i32]* %9, i64 0, i64 0
%43 = call i32 @top(i32* %42, i32 10, i32 3)
%44 = getelementptr inbounds [10 x i32], [10 x i32]* %9, i64 0, i64 0
%45 = call i32 @display(i32* %44, i32 10)
ret i32 0
}

LLVM IR (-O2):
@__const.main.a = [3 x i32] [i32 1, i32 2, i32 3]
@__const.main.data = [10 x i32] [i32 3, i32 1, i32 4, i32 1, i32 5, i32 9, i32 2, i32 6, i32 5, i32 3]
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca [10 x i32]
%4 = alloca [3 x i32]
%5 = alloca i64
%6 = alloca [10 x i32]
%7 = bitcast [10 x i32]* %3 to i8*
%8 = getelementptr inbounds [10 x i32], [10 x i32]* %3, i64 0, i64 0
%9 = call i32 @display(i32* %8, i32 10)
%10 = call i32 @quick_sort(i32* %8, i32 10)
%11 = call i32 @display(i32* %8, i32 10)
%12 = bitcast [3 x i32]* %4 to i8*
%13 = getelementptr inbounds [3 x i32], [3 x i32]* %4, i64 0, i64 0
%14 = call i32 @display(i32* %13, i32 3)
%15 = call i32 @quick_sort(i32* %13, i32 3)
%16 = call i32 @display(i32* %13, i32 3)
%17 = bitcast i64* %5 to i8*
store i64 4294967298, i64* %5
%18 = bitcast i64* %5 to i32*
%19 = call i32 @display(i32* %18, i32 2)
%20 = call i32 @quick_sort(i32* %18, i32 2)
%21 = call i32 @display(i32* %18, i32 2)
%22 = bitcast [10 x i32]* %6 to i8*
%23 = getelementptr inbounds [10 x i32], [10 x i32]* %6, i64 0, i64 0
%24 = call i32 @display(i32* %23, i32 10)
%25 = call i32 @top(i32* %23, i32 10, i32 5)
%26 = call i32 @display(i32* %23, i32 10)
%27 = call i32 @top(i32* %23, i32 10, i32 4)
%28 = call i32 @display(i32* %23, i32 10)
%29 = call i32 @top(i32* %23, i32 10, i32 3)
%30 = call i32 @display(i32* %23, i32 10)
ret i32 0
}