#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 */
long *malloc(long);
int /*<<< orphan*/ print(char *);
int /*<<< orphan*/ printArray(long *, int /*<<< orphan*/, long);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ quicksort(long *, long);
void main() {
  long n;
  long *a;
  print("Hello");
  n = 10;
  a = malloc(n * 8);
  a[0] = 8;
  a[1] = 7;
  a[2] = 1;
  a[3] = 9;
  a[4] = 11;
  a[5] = 83;
  a[6] = 7;
  a[7] = 13;
  a[8] = 94;
  a[9] = 1;
  printf("-------- Before -------\n");
  printArray(a, 0, n - 1);
  quicksort(a, n);
  printf("-------- After -------\n");
  printArray(a, 0, n - 1);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xea1(%rip),%rdi
call   1050 <print@plt>
movq   $0xa,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
shl    $0x3,%rdi
call   1060 <malloc@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movq   $0x8,(%rax)
mov    -0x10(%rbp),%rax
movq   $0x7,0x8(%rax)
mov    -0x10(%rbp),%rax
movq   $0x1,0x10(%rax)
mov    -0x10(%rbp),%rax
movq   $0x9,0x18(%rax)
mov    -0x10(%rbp),%rax
movq   $0xb,0x20(%rax)
mov    -0x10(%rbp),%rax
movq   $0x53,0x28(%rax)
mov    -0x10(%rbp),%rax
movq   $0x7,0x30(%rax)
mov    -0x10(%rbp),%rax
movq   $0xd,0x38(%rax)
mov    -0x10(%rbp),%rax
movq   $0x5e,0x40(%rax)
mov    -0x10(%rbp),%rax
movq   $0x1,0x48(%rax)
lea    0xe0b(%rip),%rdi
call   1040 <printf@plt>
mov    -0x10(%rbp),%rdi
mov    -0x8(%rbp),%rdx
sub    $0x1,%rdx
xor    %esi,%esi
call   1070 <printArray@plt>
mov    -0x10(%rbp),%rdi
mov    -0x8(%rbp),%rsi
call   1030 <quicksort@plt>
lea    0xdf8(%rip),%rdi
call   1040 <printf@plt>
mov    -0x10(%rbp),%rdi
mov    -0x8(%rbp),%rdx
sub    $0x1,%rdx
xor    %esi,%esi
call   1070 <printArray@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
lea    0xef8(%rip),%rdi
call   1050 <print@plt>
mov    $0x50,%edi
call   1060 <malloc@plt>
mov    %rax,%rbx
movaps 0xe8f(%rip),%xmm0
movups %xmm0,(%rax)
movaps 0xe95(%rip),%xmm0
movups %xmm0,0x10(%rax)
movaps 0xe9a(%rip),%xmm0
movups %xmm0,0x20(%rax)
movaps 0xe9f(%rip),%xmm0
movups %xmm0,0x30(%rax)
movaps 0xea4(%rip),%xmm0
movups %xmm0,0x40(%rax)
lea    0xeaf(%rip),%rdi
call   1030 <puts@plt>
mov    $0x9,%edx
mov    %rbx,%rdi
xor    %esi,%esi
call   1070 <printArray@plt>
mov    $0xa,%esi
mov    %rbx,%rdi
call   1040 <quicksort@plt>
lea    0xe9f(%rip),%rdi
call   1030 <puts@plt>
mov    $0x9,%edx
mov    %rbx,%rdi
xor    %esi,%esi
pop    %rbx
jmp    1070 <printArray@plt>

LLVM IR (-O0):
@.str = [6 x i8] c"Hello\00"
@.str.1 = [25 x i8] c"-------- Before -------\0A\00"
@.str.2 = [24 x i8] c"-------- After -------\0A\00"
define void @main() {
%1 = alloca i64
%2 = alloca i64*
%3 = call i32 @print(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
store i64 10, i64* %1
%4 = load i64, i64* %1
%5 = mul nsw i64 %4, 8
%6 = call i64* @malloc(i64 %5)
store i64* %6, i64** %2
%7 = load i64*, i64** %2
%8 = getelementptr inbounds i64, i64* %7, i64 0
store i64 8, i64* %8
%9 = load i64*, i64** %2
%10 = getelementptr inbounds i64, i64* %9, i64 1
store i64 7, i64* %10
%11 = load i64*, i64** %2
%12 = getelementptr inbounds i64, i64* %11, i64 2
store i64 1, i64* %12
%13 = load i64*, i64** %2
%14 = getelementptr inbounds i64, i64* %13, i64 3
store i64 9, i64* %14
%15 = load i64*, i64** %2
%16 = getelementptr inbounds i64, i64* %15, i64 4
store i64 11, i64* %16
%17 = load i64*, i64** %2
%18 = getelementptr inbounds i64, i64* %17, i64 5
store i64 83, i64* %18
%19 = load i64*, i64** %2
%20 = getelementptr inbounds i64, i64* %19, i64 6
store i64 7, i64* %20
%21 = load i64*, i64** %2
%22 = getelementptr inbounds i64, i64* %21, i64 7
store i64 13, i64* %22
%23 = load i64*, i64** %2
%24 = getelementptr inbounds i64, i64* %23, i64 8
store i64 94, i64* %24
%25 = load i64*, i64** %2
%26 = getelementptr inbounds i64, i64* %25, i64 9
store i64 1, i64* %26
%27 = call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.1, i64 0, i64 0))
%28 = load i64*, i64** %2
%29 = load i64, i64* %1
%30 = sub nsw i64 %29, 1
%31 = call i32 @printArray(i64* %28, i32 0, i64 %30)
%32 = load i64*, i64** %2
%33 = load i64, i64* %1
%34 = call i32 @quicksort(i64* %32, i64 %33)
%35 = call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.2, i64 0, i64 0))
%36 = load i64*, i64** %2
%37 = load i64, i64* %1
%38 = sub nsw i64 %37, 1
%39 = call i32 @printArray(i64* %36, i32 0, i64 %38)
ret void
}

LLVM IR (-O2):
@.str = [6 x i8] c"Hello\00"
@str = [24 x i8] c"-------- Before -------\00"
@str.3 = [23 x i8] c"-------- After -------\00"
define void @main() {
%1 = tail call i32 @print(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%2 = tail call i64* @malloc(i64 80)
%3 = bitcast i64* %2 to <2 x i64>*
store <2 x i64> <i64 8, i64 7>, <2 x i64>* %3
%4 = getelementptr inbounds i64, i64* %2, i64 2
%5 = bitcast i64* %4 to <2 x i64>*
store <2 x i64> <i64 1, i64 9>, <2 x i64>* %5
%6 = getelementptr inbounds i64, i64* %2, i64 4
%7 = bitcast i64* %6 to <2 x i64>*
store <2 x i64> <i64 11, i64 83>, <2 x i64>* %7
%8 = getelementptr inbounds i64, i64* %2, i64 6
%9 = bitcast i64* %8 to <2 x i64>*
store <2 x i64> <i64 7, i64 13>, <2 x i64>* %9
%10 = getelementptr inbounds i64, i64* %2, i64 8
%11 = bitcast i64* %10 to <2 x i64>*
store <2 x i64> <i64 94, i64 1>, <2 x i64>* %11
%12 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @str, i64 0, i64 0))
%13 = tail call i32 @printArray(i64* %2, i32 0, i64 9)
%14 = tail call i32 @quicksort(i64* %2, i64 10)
%15 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @str.3, i64 0, i64 0))
%16 = tail call i32 @printArray(i64* %2, i32 0, i64 9)
ret void
}