#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*/ printArray(long *, long);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ setUnsortedArray(long *, long);
int /*<<< orphan*/ sort(long *, long);
int main() {
  long size = 10;
  long array[size];
  setUnsortedArray(array, size);
  printf("Unsorted Array:");
  printArray(array, size);
  sort(array, size);
  printf("Sorted Array:");
  printArray(array, size);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
movq   $0xa,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    %rsp,%rcx
mov    %rcx,-0x18(%rbp)
lea    0xf(,%rax,8),%rcx
and    $0xfffffffffffffff0,%rcx
mov    %rsp,%rdi
sub    %rcx,%rdi
mov    %rdi,-0x28(%rbp)
mov    %rdi,%rsp
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%rsi
call   1050 <setUnsortedArray@plt>
lea    0xe71(%rip),%rdi
call   1030 <printf@plt>
mov    -0x28(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1060 <printArray@plt>
mov    -0x28(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1040 <sort@plt>
lea    0xe5b(%rip),%rdi
call   1030 <printf@plt>
mov    -0x28(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1060 <printArray@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,%rsp
mov    -0x4(%rbp),%eax
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x50,%rsp
mov    %rsp,%rbx
mov    $0xa,%esi
mov    %rbx,%rdi
call   1050 <setUnsortedArray@plt>
lea    0xea4(%rip),%rdi
call   1030 <printf@plt>
mov    $0xa,%esi
mov    %rbx,%rdi
call   1060 <printArray@plt>
mov    $0xa,%esi
mov    %rbx,%rdi
call   1040 <sort@plt>
lea    0xe8e(%rip),%rdi
call   1030 <printf@plt>
mov    $0xa,%esi
mov    %rbx,%rdi
call   1060 <printArray@plt>
xor    %eax,%eax
add    $0x50,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [16 x i8] c"Unsorted Array:\00"
@.str.1 = [14 x i8] c"Sorted Array:\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i64
%3 = alloca i8*
%4 = alloca i64
store i32 0, i32* %1
store i64 10, i64* %2
%5 = load i64, i64* %2
%6 = call i8* @llvm.stacksave()
store i8* %6, i8** %3
%7 = alloca i64, i64 %5
store i64 %5, i64* %4
%8 = load i64, i64* %2
%9 = call i32 @setUnsortedArray(i64* %7, i64 %8)
%10 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0))
%11 = load i64, i64* %2
%12 = call i32 @printArray(i64* %7, i64 %11)
%13 = load i64, i64* %2
%14 = call i32 @sort(i64* %7, i64 %13)
%15 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0))
%16 = load i64, i64* %2
%17 = call i32 @printArray(i64* %7, i64 %16)
store i32 0, i32* %1
%18 = load i8*, i8** %3
%19 = load i32, i32* %1
ret i32 %19
}

LLVM IR (-O2):
@.str = [16 x i8] c"Unsorted Array:\00"
@.str.1 = [14 x i8] c"Sorted Array:\00"
define i32 @main() {
%1 = alloca [10 x i64]
%2 = getelementptr inbounds [10 x i64], [10 x i64]* %1, i64 0, i64 0
%3 = call i32 @setUnsortedArray(i64* %2, i64 10)
%4 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0))
%5 = call i32 @printArray(i64* %2, i64 10)
%6 = call i32 @sort(i64* %2, i64 10)
%7 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0))
%8 = call i32 @printArray(i64* %2, i64 10)
ret i32 0
}