#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*/ bubble(int *, int);
int /*<<< orphan*/ init_array(int *);
int /*<<< orphan*/ insert(int *, int);
int /*<<< orphan*/ print_array(int *);
int /*<<< orphan*/ select(int *, int);
int main(void) {
  int x[5];
  init_array(x);
  insert(x, 5);
  print_array(x);
  init_array(x);
  bubble(x, 5);
  print_array(x);
  init_array(x);
  select(x, 5);
  print_array(x);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x20(%rbp),%rdi
call   1050 <init_array@plt>
lea    -0x20(%rbp),%rdi
mov    $0x5,%esi
call   1070 <insert@plt>
lea    -0x20(%rbp),%rdi
call   1030 <print_array@plt>
lea    -0x20(%rbp),%rdi
call   1050 <init_array@plt>
lea    -0x20(%rbp),%rdi
mov    $0x5,%esi
call   1040 <bubble@plt>
lea    -0x20(%rbp),%rdi
call   1030 <print_array@plt>
lea    -0x20(%rbp),%rdi
call   1050 <init_array@plt>
lea    -0x20(%rbp),%rdi
mov    $0x5,%esi
call   1060 <select@plt>
lea    -0x20(%rbp),%rdi
call   1030 <print_array@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x20,%rsp
mov    %rsp,%rbx
mov    %rbx,%rdi
call   1050 <init_array@plt>
mov    %rbx,%rdi
mov    $0x5,%esi
call   1070 <insert@plt>
mov    %rbx,%rdi
call   1030 <print_array@plt>
mov    %rbx,%rdi
call   1050 <init_array@plt>
mov    %rbx,%rdi
mov    $0x5,%esi
call   1040 <bubble@plt>
mov    %rbx,%rdi
call   1030 <print_array@plt>
mov    %rbx,%rdi
call   1050 <init_array@plt>
mov    %rbx,%rdi
mov    $0x5,%esi
call   1060 <select@plt>
mov    %rbx,%rdi
call   1030 <print_array@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca [5 x i32]
store i32 0, i32* %1
%3 = getelementptr inbounds [5 x i32], [5 x i32]* %2, i64 0, i64 0
%4 = call i32 @init_array(i32* %3)
%5 = getelementptr inbounds [5 x i32], [5 x i32]* %2, i64 0, i64 0
%6 = call i32 @insert(i32* %5, i32 5)
%7 = getelementptr inbounds [5 x i32], [5 x i32]* %2, i64 0, i64 0
%8 = call i32 @print_array(i32* %7)
%9 = getelementptr inbounds [5 x i32], [5 x i32]* %2, i64 0, i64 0
%10 = call i32 @init_array(i32* %9)
%11 = getelementptr inbounds [5 x i32], [5 x i32]* %2, i64 0, i64 0
%12 = call i32 @bubble(i32* %11, i32 5)
%13 = getelementptr inbounds [5 x i32], [5 x i32]* %2, i64 0, i64 0
%14 = call i32 @print_array(i32* %13)
%15 = getelementptr inbounds [5 x i32], [5 x i32]* %2, i64 0, i64 0
%16 = call i32 @init_array(i32* %15)
%17 = getelementptr inbounds [5 x i32], [5 x i32]* %2, i64 0, i64 0
%18 = call i32 @select(i32* %17, i32 5)
%19 = getelementptr inbounds [5 x i32], [5 x i32]* %2, i64 0, i64 0
%20 = call i32 @print_array(i32* %19)
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = alloca [5 x i32]
%2 = bitcast [5 x i32]* %1 to i8*
%3 = getelementptr inbounds [5 x i32], [5 x i32]* %1, i64 0, i64 0
%4 = call i32 @init_array(i32* %3)
%5 = call i32 @insert(i32* %3, i32 5)
%6 = call i32 @print_array(i32* %3)
%7 = call i32 @init_array(i32* %3)
%8 = call i32 @bubble(i32* %3, i32 5)
%9 = call i32 @print_array(i32* %3)
%10 = call i32 @init_array(i32* %3)
%11 = call i32 @select(i32* %3, i32 5)
%12 = call i32 @print_array(i32* %3)
ret i32 0
}