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

/* Variables and functions */
int /*<<< orphan*/ print_val(int);
int /*<<< orphan*/ quick_sort(int *, int /*<<< orphan*/, int);
int main(int argc, const char *argv[]) {
  int a[] = {2, 3, 54, 5, 6, 21, 8, -1};
  quick_sort(a, 0, (sizeof(a) / sizeof((a)[0])) - 1);
  do {
    int __loop;
    for (__loop = 0; __loop < (sizeof(a) / sizeof((a)[0])); __loop++) {
      print_val(a[__loop]);
    }
  } while (0);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    0xec3(%rip),%rax
mov    %rax,-0x30(%rbp)
mov    0xec0(%rip),%rax
mov    %rax,-0x28(%rbp)
mov    0xebd(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0xeba(%rip),%rax
mov    %rax,-0x18(%rbp)
lea    -0x30(%rbp),%rdi
xor    %esi,%esi
mov    $0x7,%edx
call   1040 <quick_sort@plt>
movl   $0x0,-0x34(%rbp)
movslq -0x34(%rbp),%rax
cmp    $0x8,%rax
jae    11a2 <main+0x82>
movslq -0x34(%rbp),%rax
mov    -0x30(%rbp,%rax,4),%edi
call   1030 <print_val@plt>
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    1179 <main+0x59>
jmp    11a7 <main+0x87>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x28,%rsp
movaps 0xee5(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movaps 0xec9(%rip),%xmm0
movaps %xmm0,(%rsp)
mov    %rsp,%rdi
xor    %esi,%esi
mov    $0x7,%edx
call   1040 <quick_sort@plt>
mov    (%rsp),%edi
call   1030 <print_val@plt>
mov    0x4(%rsp),%edi
call   1030 <print_val@plt>
mov    0x8(%rsp),%edi
call   1030 <print_val@plt>
mov    0xc(%rsp),%edi
call   1030 <print_val@plt>
mov    0x10(%rsp),%edi
call   1030 <print_val@plt>
mov    0x14(%rsp),%edi
call   1030 <print_val@plt>
mov    0x18(%rsp),%edi
call   1030 <print_val@plt>
mov    0x1c(%rsp),%edi
call   1030 <print_val@plt>
xor    %eax,%eax
add    $0x28,%rsp
ret

LLVM IR (-O0):
@__const.main.a = [8 x i32] [i32 2, i32 3, i32 54, i32 5, i32 6, i32 21, i32 8, i32 -1]
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [8 x i32]
%7 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%8 = bitcast [8 x i32]* %6 to i8*
%9 = getelementptr inbounds [8 x i32], [8 x i32]* %6, i64 0, i64 0
%10 = call i32 @quick_sort(i32* %9, i32 0, i32 7)
br label %11
11: ; preds = %2
store i32 0, i32* %7
br label %12
12: ; preds = %22, %11
%13 = load i32, i32* %7
%14 = sext i32 %13 to i64
%15 = icmp ult i64 %14, 8
br i1 %15, label %16, label %25
16: ; preds = %12
%17 = load i32, i32* %7
%18 = sext i32 %17 to i64
%19 = getelementptr inbounds [8 x i32], [8 x i32]* %6, i64 0, i64 %18
%20 = load i32, i32* %19
%21 = call i32 @print_val(i32 %20)
br label %22
22: ; preds = %16
%23 = load i32, i32* %7
%24 = add nsw i32 %23, 1
store i32 %24, i32* %7
br label %12
25: ; preds = %12
br label %26
26: ; preds = %25
ret i32 0
}

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