#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*/ bubbleSort(int *, int);
int getIntArray(int *, int, int /*<<< orphan*/);
int /*<<< orphan*/ printIntArray(int *, int);
int /*<<< orphan*/ printf(char *);
int main(void) {
  int x[10];
  int hmny;
  int who;
  int where;
  hmny = getIntArray(x, 10, 0);
  if (hmny == 0)
    printf("This is the empty array!\n");
  else {
    printf("The array was: \n");
    printIntArray(x, hmny);
    bubbleSort(x, hmny);
    printf("The sorted array is: \n");
    printIntArray(x, hmny);
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x30(%rbp),%rdi
mov    $0xa,%esi
xor    %edx,%edx
call   1060 <getIntArray@plt>
mov    %eax,-0x34(%rbp)
cmpl   $0x0,-0x34(%rbp)
jne    117d <main+0x3d>
lea    0xe8d(%rip),%rdi
call   1030 <printf@plt>
jmp    11b9 <main+0x79>
lea    0xe96(%rip),%rdi
call   1030 <printf@plt>
lea    -0x30(%rbp),%rdi
mov    -0x34(%rbp),%esi
call   1050 <printIntArray@plt>
lea    -0x30(%rbp),%rdi
mov    -0x34(%rbp),%esi
call   1040 <bubbleSort@plt>
lea    0xe83(%rip),%rdi
call   1030 <printf@plt>
lea    -0x30(%rbp),%rdi
mov    -0x34(%rbp),%esi
call   1050 <printIntArray@plt>
mov    -0x4(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x28,%rsp
mov    %rsp,%rdi
mov    $0xa,%esi
xor    %edx,%edx
call   1060 <getIntArray@plt>
test   %eax,%eax
je     1197 <main+0x57>
mov    %eax,%ebx
lea    0xe9d(%rip),%rdi
call   1030 <puts@plt>
mov    %rsp,%r14
mov    %r14,%rdi
mov    %ebx,%esi
call   1050 <printIntArray@plt>
mov    %r14,%rdi
mov    %ebx,%esi
call   1040 <bubbleSort@plt>
lea    0xe8a(%rip),%rdi
call   1030 <puts@plt>
mov    %r14,%rdi
mov    %ebx,%esi
call   1050 <printIntArray@plt>
jmp    11a3 <main+0x63>
lea    0xe88(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0x28,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [26 x i8] c"This is the empty array!\0A\00"
@.str.1 = [17 x i8] c"The array was: \0A\00"
@.str.2 = [23 x i8] c"The sorted array is: \0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [10 x i32]
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 0, i32* %1
%6 = getelementptr inbounds [10 x i32], [10 x i32]* %2, i64 0, i64 0
%7 = call i32 @getIntArray(i32* %6, i32 10, i32 0)
store i32 %7, i32* %3
%8 = load i32, i32* %3
%9 = icmp eq i32 %8, 0
br i1 %9, label %10, label %12
10: ; preds = %0
%11 = call i32 @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0))
br label %24
12: ; preds = %0
%13 = call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0))
%14 = getelementptr inbounds [10 x i32], [10 x i32]* %2, i64 0, i64 0
%15 = load i32, i32* %3
%16 = call i32 @printIntArray(i32* %14, i32 %15)
%17 = getelementptr inbounds [10 x i32], [10 x i32]* %2, i64 0, i64 0
%18 = load i32, i32* %3
%19 = call i32 @bubbleSort(i32* %17, i32 %18)
%20 = call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.2, i64 0, i64 0))
%21 = getelementptr inbounds [10 x i32], [10 x i32]* %2, i64 0, i64 0
%22 = load i32, i32* %3
%23 = call i32 @printIntArray(i32* %21, i32 %22)
br label %24
24: ; preds = %12, %10
%25 = load i32, i32* %1
ret i32 %25
}

LLVM IR (-O2):
@str = [16 x i8] c"The array was: \00"
@str.3 = [22 x i8] c"The sorted array is: \00"
@str.4 = [25 x i8] c"This is the empty array!\00"
define i32 @main() {
%1 = alloca [10 x i32]
%2 = bitcast [10 x i32]* %1 to i8*
%3 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 0
%4 = call i32 @getIntArray(i32* %3, i32 10, i32 0)
%5 = icmp eq i32 %4, 0
br i1 %5, label %6, label %8
6: ; preds = %0
%7 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @str.4, i64 0, i64 0))
br label %14
8: ; preds = %0
%9 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @str, i64 0, i64 0))
%10 = call i32 @printIntArray(i32* %3, i32 %4)
%11 = call i32 @bubbleSort(i32* %3, i32 %4)
%12 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @str.3, i64 0, i64 0))
%13 = call i32 @printIntArray(i32* %3, i32 %4)
br label %14
14: ; preds = %8, %6
ret i32 0
}