#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 */
typedef int /*<<< orphan*/ row;

/* Variables and functions */
int atoi(int /*<<< orphan*/);
int /*<<< orphan*/ bubbleSort(int *, int);
int /*<<< orphan*/ fgets(char *, int, int /*<<< orphan*/);
int /*<<< orphan*/ scanf(char *, int *);
int /*<<< orphan*/ stdin;
int main(int argc, char *argv[]) {
  char row[4];
  int n = atoi(fgets(row, sizeof(row), stdin));
  int as[n];
  int i;
  for (i = 0; i < n; i++) {
    scanf("%d", &as[i]);
  }
  bubbleSort(as, n);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    0x2e8b(%rip),%rax
mov    (%rax),%edx
lea    -0x14(%rbp),%rdi
mov    $0x4,%esi
call   1040 <fgets@plt>
mov    %eax,%edi
call   1060 <atoi@plt>
mov    %eax,-0x18(%rbp)
mov    -0x18(%rbp),%eax
mov    %rsp,%rcx
mov    %rcx,-0x20(%rbp)
lea    0xf(,%rax,4),%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0x38(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x28(%rbp)
movl   $0x0,-0x2c(%rbp)
mov    -0x2c(%rbp),%eax
cmp    -0x18(%rbp),%eax
jge    11da <main+0x9a>
mov    -0x38(%rbp),%rsi
movslq -0x2c(%rbp),%rax
shl    $0x2,%rax
add    %rax,%rsi
lea    0xe39(%rip),%rdi
call   1050 <scanf@plt>
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    11a5 <main+0x65>
mov    -0x38(%rbp),%rdi
mov    -0x18(%rbp),%esi
call   1030 <bubbleSort@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x20(%rbp),%rax
mov    %rax,%rsp
mov    -0x4(%rbp),%eax
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    0x2e90(%rip),%rax
mov    (%rax),%edx
lea    -0x34(%rbp),%rdi
mov    $0x4,%esi
call   1040 <fgets@plt>
mov    %eax,%edi
call   1060 <atoi@plt>
mov    %rsp,-0x30(%rbp)
mov    %eax,%r13d
lea    0xf(,%r13,4),%rcx
and    $0xfffffffffffffff0,%rcx
mov    %rsp,%r15
sub    %rcx,%r15
mov    %r15,%rsp
test   %eax,%eax
jle    11b5 <main+0x75>
lea    0xe6a(%rip),%r12
mov    %r13,%r14
mov    %r15,%rbx
nopl   0x0(%rax)
mov    %r12,%rdi
mov    %rbx,%rsi
call   1050 <scanf@plt>
add    $0x4,%rbx
add    $0xffffffffffffffff,%r14
jne    11a0 <main+0x60>
mov    %r15,%rdi
mov    %r13d,%esi
call   1030 <bubbleSort@plt>
mov    -0x30(%rbp),%rsp
xor    %eax,%eax
lea    -0x28(%rbp),%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@stdin = global i32 0
@.str = [3 x i8] c"%d\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [4 x i8]
%7 = alloca i32
%8 = alloca i8*
%9 = alloca i64
%10 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%11 = getelementptr inbounds [4 x i8], [4 x i8]* %6, i64 0, i64 0
%12 = load i32, i32* @stdin
%13 = call i32 @fgets(i8* %11, i32 4, i32 %12)
%14 = call i32 @atoi(i32 %13)
store i32 %14, i32* %7
%15 = load i32, i32* %7
%16 = zext i32 %15 to i64
%17 = call i8* @llvm.stacksave()
store i8* %17, i8** %8
%18 = alloca i32, i64 %16
store i64 %16, i64* %9
store i32 0, i32* %10
br label %19
19: ; preds = %28, %2
%20 = load i32, i32* %10
%21 = load i32, i32* %7
%22 = icmp slt i32 %20, %21
br i1 %22, label %23, label %31
23: ; preds = %19
%24 = load i32, i32* %10
%25 = sext i32 %24 to i64
%26 = getelementptr inbounds i32, i32* %18, i64 %25
%27 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %26)
br label %28
28: ; preds = %23
%29 = load i32, i32* %10
%30 = add nsw i32 %29, 1
store i32 %30, i32* %10
br label %19
31: ; preds = %19
%32 = load i32, i32* %7
%33 = call i32 @bubbleSort(i32* %18, i32 %32)
store i32 0, i32* %3
%34 = load i8*, i8** %8
%35 = load i32, i32* %3
ret i32 %35
}

LLVM IR (-O2):
@stdin = global i32 0
@.str = [3 x i8] c"%d\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca [4 x i8]
%4 = getelementptr inbounds [4 x i8], [4 x i8]* %3, i64 0, i64 0
%5 = load i32, i32* @stdin
%6 = call i32 @fgets(i8* %4, i32 4, i32 %5)
%7 = call i32 @atoi(i32 %6)
%8 = zext i32 %7 to i64
%9 = call i8* @llvm.stacksave()
%10 = alloca i32, i64 %8
%11 = icmp sgt i32 %7, 0
br i1 %11, label %12, label %18
12: ; preds = %2, %12
%13 = phi i64 [ %16, %12 ], [ 0, %2 ]
%14 = getelementptr inbounds i32, i32* %10, i64 %13
%15 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %14)
%16 = add nuw nsw i64 %13, 1
%17 = icmp eq i64 %16, %8
br i1 %17, label %18, label %12
18: ; preds = %12, %2
%19 = call i32 @bubbleSort(i32* %10, i32 %7)
ret i32 0
}