#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*/ EXIT_FAILURE;
int EXIT_SUCCESS;
int /*<<< orphan*/ bubble_sort(int *, int);
int /*<<< orphan*/ check_intInput(int *);
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ fill_array(int *, int);
int /*<<< orphan*/ print_array(int *, int);
int /*<<< orphan*/ printf(char *, ...);
int main() {
  int n;
  printf("Enter n: ");
  check_intInput(&n);
  if (n <= 0) {
    printf("n > 0 !");
    exit(EXIT_FAILURE);
  }
  int array[n];
  printf("Enter %d numbers : ", n);
  fill_array(array, n);
  bubble_sort(array, n);
  print_array(array, n);
  return (EXIT_SUCCESS);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xe8a(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    -0x8(%rbp),%rdi
call   1030 <check_intInput@plt>
cmpl   $0x0,-0x8(%rbp)
jg     11ac <main+0x4c>
lea    0xe73(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    0x2e3b(%rip),%rax
mov    (%rax),%edi
call   1070 <exit@plt>
mov    -0x8(%rbp),%eax
mov    %rsp,%rcx
mov    %rcx,-0x10(%rbp)
lea    0xf(,%rax,4),%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0x20(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%esi
lea    0xe35(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x20(%rbp),%rdi
mov    -0x8(%rbp),%esi
call   1060 <fill_array@plt>
mov    -0x20(%rbp),%rdi
mov    -0x8(%rbp),%esi
call   1080 <bubble_sort@plt>
mov    -0x20(%rbp),%rdi
mov    -0x8(%rbp),%esi
call   1040 <print_array@plt>
mov    0x2dc9(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
mov    -0x10(%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   %r14
push   %rbx
sub    $0x10,%rsp
lea    0xe8e(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
lea    -0x14(%rbp),%rdi
call   1030 <check_intInput@plt>
mov    -0x14(%rbp),%eax
test   %eax,%eax
jle    11e8 <main+0x88>
mov    %rsp,%r14
mov    %rsp,%rbx
lea    0xf(,%rax,4),%rax
and    $0xfffffffffffffff0,%rax
sub    %rax,%rbx
mov    %rbx,%rsp
mov    -0x14(%rbp),%esi
lea    0xe67(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    -0x14(%rbp),%esi
mov    %rbx,%rdi
call   1060 <fill_array@plt>
mov    -0x14(%rbp),%esi
mov    %rbx,%rdi
call   1080 <bubble_sort@plt>
mov    -0x14(%rbp),%esi
mov    %rbx,%rdi
call   1040 <print_array@plt>
mov    0x2dfe(%rip),%rax
mov    (%rax),%eax
mov    %r14,%rsp
lea    -0x10(%rbp),%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret
lea    0xe1b(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x2de3(%rip),%rax
mov    (%rax),%edi
call   1070 <exit@plt>

LLVM IR (-O0):
@.str = [10 x i8] c"Enter n: \00"
@.str.1 = [8 x i8] c"n > 0 !\00"
@EXIT_FAILURE = global i32 0
@.str.2 = [20 x i8] c"Enter %d numbers : \00"
@EXIT_SUCCESS = global i32 0
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i8*
%4 = alloca i64
store i32 0, i32* %1
%5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
%6 = call i32 @check_intInput(i32* %2)
%7 = load i32, i32* %2
%8 = icmp sle i32 %7, 0
br i1 %8, label %9, label %13
9: ; preds = %0
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0))
%11 = load i32, i32* @EXIT_FAILURE
%12 = call i32 @exit(i32 %11)
unreachable
13: ; preds = %0
%14 = load i32, i32* %2
%15 = zext i32 %14 to i64
%16 = call i8* @llvm.stacksave()
store i8* %16, i8** %3
%17 = alloca i32, i64 %15
store i64 %15, i64* %4
%18 = load i32, i32* %2
%19 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.2, i64 0, i64 0), i32 %18)
%20 = load i32, i32* %2
%21 = call i32 @fill_array(i32* %17, i32 %20)
%22 = load i32, i32* %2
%23 = call i32 @bubble_sort(i32* %17, i32 %22)
%24 = load i32, i32* %2
%25 = call i32 @print_array(i32* %17, i32 %24)
%26 = load i32, i32* @EXIT_SUCCESS
store i32 %26, i32* %1
%27 = load i8*, i8** %3
%28 = load i32, i32* %1
ret i32 %28
}

LLVM IR (-O2):
@.str = [10 x i8] c"Enter n: \00"
@.str.1 = [8 x i8] c"n > 0 !\00"
@EXIT_FAILURE = global i32 0
@.str.2 = [20 x i8] c"Enter %d numbers : \00"
@EXIT_SUCCESS = global i32 0
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @check_intInput(i32* %1)
%5 = load i32, i32* %1
%6 = icmp slt i32 %5, 1
br i1 %6, label %7, label %11
7: ; preds = %0
%8 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0))
%9 = load i32, i32* @EXIT_FAILURE
%10 = call i32 @exit(i32 %9)
unreachable
11: ; preds = %0
%12 = zext i32 %5 to i64
%13 = call i8* @llvm.stacksave()
%14 = alloca i32, i64 %12
%15 = load i32, i32* %1
%16 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str.2, i64 0, i64 0), i32 %15)
%17 = load i32, i32* %1
%18 = call i32 @fill_array(i32* %14, i32 %17)
%19 = load i32, i32* %1
%20 = call i32 @bubble_sort(i32* %14, i32 %19)
%21 = load i32, i32* %1
%22 = call i32 @print_array(i32* %14, i32 %21)
%23 = load i32, i32* @EXIT_SUCCESS
ret i32 %23
}