#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*/ printf(char *);
int main(void) {
  int i;
  int array[16] = {34, -5, 6,  0,  12, 100, 56, 22,
                   44, -3, -9, 12, 17, 22,  6,  11};
  void sort(int a[], int n);
  void printArray(int a[], int n);
  printf("The array before the sort:\n");
  printArray(array, 16);
  sort(array, 16);
  printf("\n\nThe array after the sort:\n");
  printArray(array, 16);
  printf("\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x50(%rbp),%rdi
lea    0xea6(%rip),%rsi
mov    $0x40,%edx
call   1050 <memcpy@plt>
lea    0xed5(%rip),%rdi
call   1030 <printf@plt>
lea    -0x50(%rbp),%rdi
mov    $0x10,%esi
call   1060 <printArray@plt>
lea    -0x50(%rbp),%rdi
mov    $0x10,%esi
call   1040 <sort@plt>
lea    0xec9(%rip),%rdi
call   1030 <printf@plt>
lea    -0x50(%rbp),%rdi
mov    $0x10,%esi
call   1060 <printArray@plt>
lea    0xead(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x40,%rsp
movaps 0xee4(%rip),%xmm0
movaps %xmm0,0x30(%rsp)
movaps 0xec8(%rip),%xmm0
movaps %xmm0,0x20(%rsp)
movaps 0xeac(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movaps 0xe90(%rip),%xmm0
movaps %xmm0,(%rsp)
lea    0xec5(%rip),%rdi
call   1040 <puts@plt>
mov    %rsp,%rbx
mov    %rbx,%rdi
mov    $0x10,%esi
call   1060 <printArray@plt>
mov    %rbx,%rdi
mov    $0x10,%esi
call   1050 <sort@plt>
lea    0xeb7(%rip),%rdi
call   1040 <puts@plt>
mov    %rbx,%rdi
mov    $0x10,%esi
call   1060 <printArray@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@__const.main.array = [16 x i32] [i32 34, i32 -5, i32 6, i32 0, i32 12, i32 100, i32 56, i32 22, i32 44, i32 -3, i32 -9, i32 12, i32 17, i32 22, i32 6, i32 11]
@.str = [28 x i8] c"The array before the sort:\0A\00"
@.str.1 = [29 x i8] c"\0A\0AThe array after the sort:\0A\00"
@.str.2 = [2 x i8] c"\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca [16 x i32]
store i32 0, i32* %1
%4 = bitcast [16 x i32]* %3 to i8*
%5 = call i32 @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0))
%6 = getelementptr inbounds [16 x i32], [16 x i32]* %3, i64 0, i64 0
%7 = getelementptr inbounds [16 x i32], [16 x i32]* %3, i64 0, i64 0
%8 = call i32 @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0))
%9 = getelementptr inbounds [16 x i32], [16 x i32]* %3, i64 0, i64 0
%10 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@__const.main.array = [16 x i32] [i32 34, i32 -5, i32 6, i32 0, i32 12, i32 100, i32 56, i32 22, i32 44, i32 -3, i32 -9, i32 12, i32 17, i32 22, i32 6, i32 11]
@str = [27 x i8] c"The array before the sort:\00"
@str.3 = [28 x i8] c"\0A\0AThe array after the sort:\00"
define i32 @main() {
%1 = alloca [16 x i32]
%2 = bitcast [16 x i32]* %1 to i8*
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @str, i64 0, i64 0))
%4 = getelementptr inbounds [16 x i32], [16 x i32]* %1, i64 0, i64 0
%5 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @str.3, i64 0, i64 0))
%6 = call i32 @putchar(i32 10)
ret i32 0
}