#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*/ display(int *, int);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ sort(int *, int);
int main(int argc, char **argv) {
  int arr[] = {34, 3212, 51, 52, 612, 456, 12, 31, 412, 123, 1, 3};
  int length = 12;
  printf("Before : ");
  display(arr, length);
  sort(arr, length);
  printf("After : ");
  display(arr, length);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    -0x40(%rbp),%rdi
lea    0xe9f(%rip),%rsi
mov    $0x30,%edx
call   1060 <memcpy@plt>
movl   $0xc,-0x44(%rbp)
lea    0xeb7(%rip),%rdi
call   1040 <printf@plt>
lea    -0x40(%rbp),%rdi
mov    -0x44(%rbp),%esi
call   1030 <display@plt>
lea    -0x40(%rbp),%rdi
mov    -0x44(%rbp),%esi
call   1050 <sort@plt>
lea    0xe9d(%rip),%rdi
call   1040 <printf@plt>
lea    -0x40(%rbp),%rdi
mov    -0x44(%rbp),%esi
call   1030 <display@plt>
xor    %eax,%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x30,%rsp
movaps 0xee4(%rip),%xmm0
movaps %xmm0,0x20(%rsp)
movaps 0xec8(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movaps 0xeac(%rip),%xmm0
movaps %xmm0,(%rsp)
lea    0xed1(%rip),%rdi
call   1040 <printf@plt>
mov    %rsp,%rbx
mov    %rbx,%rdi
mov    $0xc,%esi
call   1030 <display@plt>
mov    %rbx,%rdi
mov    $0xc,%esi
call   1050 <sort@plt>
lea    0xeb2(%rip),%rdi
call   1040 <printf@plt>
mov    %rbx,%rdi
mov    $0xc,%esi
call   1030 <display@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@__const.main.arr = [12 x i32] [i32 34, i32 3212, i32 51, i32 52, i32 612, i32 456, i32 12, i32 31, i32 412, i32 123, i32 1, i32 3]
@.str = [10 x i8] c"Before : \00"
@.str.1 = [9 x i8] c"After : \00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [12 x i32]
%7 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%8 = bitcast [12 x i32]* %6 to i8*
store i32 12, i32* %7
%9 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
%10 = getelementptr inbounds [12 x i32], [12 x i32]* %6, i64 0, i64 0
%11 = load i32, i32* %7
%12 = call i32 @display(i32* %10, i32 %11)
%13 = getelementptr inbounds [12 x i32], [12 x i32]* %6, i64 0, i64 0
%14 = load i32, i32* %7
%15 = call i32 @sort(i32* %13, i32 %14)
%16 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0))
%17 = getelementptr inbounds [12 x i32], [12 x i32]* %6, i64 0, i64 0
%18 = load i32, i32* %7
%19 = call i32 @display(i32* %17, i32 %18)
ret i32 0
}

LLVM IR (-O2):
@__const.main.arr = [12 x i32] [i32 34, i32 3212, i32 51, i32 52, i32 612, i32 456, i32 12, i32 31, i32 412, i32 123, i32 1, i32 3]
@.str = [10 x i8] c"Before : \00"
@.str.1 = [9 x i8] c"After : \00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca [12 x i32]
%4 = bitcast [12 x i32]* %3 to i8*
%5 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
%6 = getelementptr inbounds [12 x i32], [12 x i32]* %3, i64 0, i64 0
%7 = call i32 @display(i32* %6, i32 12)
%8 = call i32 @sort(i32* %6, i32 12)
%9 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0))
%10 = call i32 @display(i32* %6, i32 12)
ret i32 0
}