#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*/ print_ints(int *, int);
int /*<<< orphan*/ print_longs(long *, int);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ quicksort_ints(int *, int /*<<< orphan*/, int);
int /*<<< orphan*/ shuffle(long *, int);
int main() {
  int n = 10;
  long A[10];
  for (int i = 0; i < n; i++)
    A[i] = i;
  print_longs(A, n);
  printf("\n");
  shuffle(A, n);
  print_longs(A, n);
  printf("\n\n");
  printf("ints:\n");
  int B[n];
  for (int i = 0; i < n; i++)
    B[i] = A[i];
  print_ints(B, n);
  printf("\n");
  quicksort_ints(B, 0, 9);
  print_ints(B, n);
  printf("\n");
  printf("DONE\n");
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x90,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0xa,-0x8(%rbp)
movl   $0x0,-0x64(%rbp)
mov    -0x64(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    1197 <main+0x47>
movslq -0x64(%rbp),%rcx
movslq -0x64(%rbp),%rax
mov    %rcx,-0x60(%rbp,%rax,8)
mov    -0x64(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x64(%rbp)
jmp    1170 <main+0x20>
mov    -0x8(%rbp),%esi
lea    -0x60(%rbp),%rdi
mov    %rdi,-0x90(%rbp)
call   1050 <print_longs@plt>
lea    0xe50(%rip),%rdi
call   1040 <printf@plt>
mov    -0x90(%rbp),%rdi
mov    -0x8(%rbp),%esi
call   1030 <shuffle@plt>
mov    -0x90(%rbp),%rdi
mov    -0x8(%rbp),%esi
call   1050 <print_longs@plt>
lea    0xe25(%rip),%rdi
call   1040 <printf@plt>
lea    0xe1c(%rip),%rdi
call   1040 <printf@plt>
mov    -0x8(%rbp),%eax
mov    %rsp,%rcx
mov    %rcx,-0x70(%rbp)
lea    0xf(,%rax,4),%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0x88(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x78(%rbp)
movl   $0x0,-0x7c(%rbp)
mov    -0x7c(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    1250 <main+0x100>
mov    -0x88(%rbp),%rax
movslq -0x7c(%rbp),%rcx
mov    -0x60(%rbp,%rcx,8),%rcx
mov    %ecx,%edx
movslq -0x7c(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x7c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x7c(%rbp)
jmp    121d <main+0xcd>
mov    -0x88(%rbp),%rdi
mov    -0x8(%rbp),%esi
call   1070 <print_ints@plt>
lea    0xd9b(%rip),%rdi
call   1040 <printf@plt>
mov    -0x88(%rbp),%rdi
xor    %esi,%esi
mov    $0x9,%edx
call   1060 <quicksort_ints@plt>
mov    -0x88(%rbp),%rdi
mov    -0x8(%rbp),%esi
call   1070 <print_ints@plt>
lea    0xd6d(%rip),%rdi
call   1040 <printf@plt>
lea    0xd6a(%rip),%rdi
call   1040 <printf@plt>
mov    -0x70(%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    $0x78,%rsp
movaps 0xe92(%rip),%xmm0
movaps %xmm0,(%rsp)
movaps 0xe97(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movaps 0xe9b(%rip),%xmm0
movaps %xmm0,0x20(%rsp)
movaps 0xe9f(%rip),%xmm0
movaps %xmm0,0x30(%rsp)
movaps 0xea3(%rip),%xmm0
movaps %xmm0,0x40(%rsp)
mov    %rsp,%rbx
mov    %rbx,%rdi
mov    $0xa,%esi
call   1060 <print_longs@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    %rbx,%rdi
mov    $0xa,%esi
call   1050 <shuffle@plt>
mov    %rbx,%rdi
mov    $0xa,%esi
call   1060 <print_longs@plt>
lea    0xe73(%rip),%rdi
call   1040 <puts@plt>
lea    0xe69(%rip),%rdi
call   1040 <puts@plt>
pshufd $0xe8,(%rsp),%xmm0
pshufd $0xe8,0x10(%rsp),%xmm1
mov    %rsp,%r14
punpcklqdq %xmm1,%xmm0
pshufd $0xe8,0x20(%rsp),%xmm1
movdqa %xmm0,0x50(%rsp)
pshufd $0xe8,0x30(%rsp),%xmm0
punpcklqdq %xmm0,%xmm1
movdqa %xmm1,0x60(%rsp)
pshufd $0xe8,0x40(%rsp),%xmm0
movq   %xmm0,0x70(%rsp)
lea    0x50(%rsp),%rbx
mov    %rbx,%rdi
mov    $0xa,%esi
call   1080 <print_ints@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    %rbx,%rdi
xor    %esi,%esi
mov    $0x9,%edx
call   1070 <quicksort_ints@plt>
mov    %rbx,%rdi
mov    $0xa,%esi
call   1080 <print_ints@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0xde2(%rip),%rdi
call   1040 <puts@plt>
mov    %r14,%rsp
xor    %eax,%eax
add    $0x78,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [2 x i8] c"\0A\00"
@.str.1 = [3 x i8] c"\0A\0A\00"
@.str.2 = [7 x i8] c"ints:\0A\00"
@.str.3 = [6 x i8] c"DONE\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca [10 x i64]
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i64
%7 = alloca i32
store i32 0, i32* %1
store i32 10, i32* %2
store i32 0, i32* %4
br label %8
8: ; preds = %18, %0
%9 = load i32, i32* %4
%10 = load i32, i32* %2
%11 = icmp slt i32 %9, %10
br i1 %11, label %12, label %21
12: ; preds = %8
%13 = load i32, i32* %4
%14 = sext i32 %13 to i64
%15 = load i32, i32* %4
%16 = sext i32 %15 to i64
%17 = getelementptr inbounds [10 x i64], [10 x i64]* %3, i64 0, i64 %16
store i64 %14, i64* %17
br label %18
18: ; preds = %12
%19 = load i32, i32* %4
%20 = add nsw i32 %19, 1
store i32 %20, i32* %4
br label %8
21: ; preds = %8
%22 = getelementptr inbounds [10 x i64], [10 x i64]* %3, i64 0, i64 0
%23 = load i32, i32* %2
%24 = call i32 @print_longs(i64* %22, i32 %23)
%25 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%26 = getelementptr inbounds [10 x i64], [10 x i64]* %3, i64 0, i64 0
%27 = load i32, i32* %2
%28 = call i32 @shuffle(i64* %26, i32 %27)
%29 = getelementptr inbounds [10 x i64], [10 x i64]* %3, i64 0, i64 0
%30 = load i32, i32* %2
%31 = call i32 @print_longs(i64* %29, i32 %30)
%32 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%33 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0))
%34 = load i32, i32* %2
%35 = zext i32 %34 to i64
%36 = call i8* @llvm.stacksave()
store i8* %36, i8** %5
%37 = alloca i32, i64 %35
store i64 %35, i64* %6
store i32 0, i32* %7
br label %38
38: ; preds = %51, %21
%39 = load i32, i32* %7
%40 = load i32, i32* %2
%41 = icmp slt i32 %39, %40
br i1 %41, label %42, label %54
42: ; preds = %38
%43 = load i32, i32* %7
%44 = sext i32 %43 to i64
%45 = getelementptr inbounds [10 x i64], [10 x i64]* %3, i64 0, i64 %44
%46 = load i64, i64* %45
%47 = trunc i64 %46 to i32
%48 = load i32, i32* %7
%49 = sext i32 %48 to i64
%50 = getelementptr inbounds i32, i32* %37, i64 %49
store i32 %47, i32* %50
br label %51
51: ; preds = %42
%52 = load i32, i32* %7
%53 = add nsw i32 %52, 1
store i32 %53, i32* %7
br label %38
54: ; preds = %38
%55 = load i32, i32* %2
%56 = call i32 @print_ints(i32* %37, i32 %55)
%57 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%58 = call i32 @quicksort_ints(i32* %37, i32 0, i32 9)
%59 = load i32, i32* %2
%60 = call i32 @print_ints(i32* %37, i32 %59)
%61 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%62 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0))
%63 = load i8*, i8** %5
%64 = load i32, i32* %1
ret i32 %64
}

LLVM IR (-O2):
@str = [2 x i8] c"\0A\00"
@str.4 = [6 x i8] c"ints:\00"
@str.5 = [5 x i8] c"DONE\00"
define i32 @main() {
%1 = alloca [10 x i64]
%2 = bitcast [10 x i64]* %1 to i8*
%3 = getelementptr inbounds [10 x i64], [10 x i64]* %1, i64 0, i64 0
%4 = bitcast [10 x i64]* %1 to <2 x i64>*
store <2 x i64> <i64 0, i64 1>, <2 x i64>* %4
%5 = getelementptr inbounds [10 x i64], [10 x i64]* %1, i64 0, i64 2
%6 = bitcast i64* %5 to <2 x i64>*
store <2 x i64> <i64 2, i64 3>, <2 x i64>* %6
%7 = getelementptr inbounds [10 x i64], [10 x i64]* %1, i64 0, i64 4
%8 = bitcast i64* %7 to <2 x i64>*
store <2 x i64> <i64 4, i64 5>, <2 x i64>* %8
%9 = getelementptr inbounds [10 x i64], [10 x i64]* %1, i64 0, i64 6
%10 = bitcast i64* %9 to <2 x i64>*
store <2 x i64> <i64 6, i64 7>, <2 x i64>* %10
%11 = getelementptr inbounds [10 x i64], [10 x i64]* %1, i64 0, i64 8
%12 = bitcast i64* %11 to <2 x i64>*
store <2 x i64> <i64 8, i64 9>, <2 x i64>* %12
%13 = call i32 @print_longs(i64* %3, i32 10)
%14 = call i32 @putchar(i32 10)
%15 = call i32 @shuffle(i64* %3, i32 10)
%16 = call i32 @print_longs(i64* %3, i32 10)
%17 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([2 x i8], [2 x i8]* @str, i64 0, i64 0))
%18 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @str.4, i64 0, i64 0))
%19 = call i8* @llvm.stacksave()
%20 = alloca [10 x i32]
%21 = getelementptr inbounds [10 x i32], [10 x i32]* %20, i64 0, i64 0
%22 = bitcast [10 x i64]* %1 to <2 x i64>*
%23 = load <2 x i64>, <2 x i64>* %22
%24 = trunc <2 x i64> %23 to <2 x i32>
%25 = bitcast [10 x i32]* %20 to <2 x i32>*
store <2 x i32> %24, <2 x i32>* %25
%26 = getelementptr inbounds [10 x i32], [10 x i32]* %20, i64 0, i64 2
%27 = bitcast i64* %5 to <2 x i64>*
%28 = load <2 x i64>, <2 x i64>* %27
%29 = trunc <2 x i64> %28 to <2 x i32>
%30 = bitcast i32* %26 to <2 x i32>*
store <2 x i32> %29, <2 x i32>* %30
%31 = getelementptr inbounds [10 x i32], [10 x i32]* %20, i64 0, i64 4
%32 = bitcast i64* %7 to <2 x i64>*
%33 = load <2 x i64>, <2 x i64>* %32
%34 = trunc <2 x i64> %33 to <2 x i32>
%35 = bitcast i32* %31 to <2 x i32>*
store <2 x i32> %34, <2 x i32>* %35
%36 = getelementptr inbounds [10 x i32], [10 x i32]* %20, i64 0, i64 6
%37 = bitcast i64* %9 to <2 x i64>*
%38 = load <2 x i64>, <2 x i64>* %37
%39 = trunc <2 x i64> %38 to <2 x i32>
%40 = bitcast i32* %36 to <2 x i32>*
store <2 x i32> %39, <2 x i32>* %40
%41 = getelementptr inbounds [10 x i32], [10 x i32]* %20, i64 0, i64 8
%42 = bitcast i64* %11 to <2 x i64>*
%43 = load <2 x i64>, <2 x i64>* %42
%44 = trunc <2 x i64> %43 to <2 x i32>
%45 = bitcast i32* %41 to <2 x i32>*
store <2 x i32> %44, <2 x i32>* %45
%46 = call i32 @print_ints(i32* %21, i32 10)
%47 = call i32 @putchar(i32 10)
%48 = call i32 @quicksort_ints(i32* %21, i32 0, i32 9)
%49 = call i32 @print_ints(i32* %21, i32 10)
%50 = call i32 @putchar(i32 10)
%51 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @str.5, i64 0, i64 0))
ret i32 0
}