#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*/ free_array(int *);
int /*<<< orphan*/ insertion_int(int *, int);
int /*<<< orphan*/ print_array(int *, int);
int /*<<< orphan*/ printf(char *);
int *random_gen(int);
int main(int argc, char *argv[]) {
  int *array = random_gen(50);
  printf("\n# ----- Original Data ----- #\n\n");
  print_array(array, 50);
  insertion_int(array, 50);
  printf("\n# ----- Sorted Data ----- #\n\n");
  print_array(array, 50);
  printf("\n");
  free_array(array);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x32,%edi
call   1070 <random_gen@plt>
mov    %rax,-0x18(%rbp)
lea    0xe85(%rip),%rdi
call   1040 <printf@plt>
mov    -0x18(%rbp),%rdi
mov    $0x32,%esi
call   1030 <print_array@plt>
mov    -0x18(%rbp),%rdi
mov    $0x32,%esi
call   1050 <insertion_int@plt>
lea    0xe7e(%rip),%rdi
call   1040 <printf@plt>
mov    -0x18(%rbp),%rdi
mov    $0x32,%esi
call   1030 <print_array@plt>
lea    0xe81(%rip),%rdi
call   1040 <printf@plt>
mov    -0x18(%rbp),%rdi
call   1060 <free_array@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
mov    $0x32,%edi
call   1080 <random_gen@plt>
mov    %rax,%rbx
lea    0xe8b(%rip),%rdi
call   1040 <puts@plt>
mov    %rbx,%rdi
mov    $0x32,%esi
call   1050 <print_array@plt>
mov    %rbx,%rdi
mov    $0x32,%esi
call   1060 <insertion_int@plt>
lea    0xe85(%rip),%rdi
call   1040 <puts@plt>
mov    %rbx,%rdi
mov    $0x32,%esi
call   1050 <print_array@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    %rbx,%rdi
call   1070 <free_array@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [33 x i8] c"\0A# ----- Original Data ----- #\0A\0A\00"
@.str.1 = [31 x i8] c"\0A# ----- Sorted Data ----- #\0A\0A\00"
@.str.2 = [2 x i8] c"\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%7 = call i32* @random_gen(i32 50)
store i32* %7, i32** %6
%8 = call i32 @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0))
%9 = load i32*, i32** %6
%10 = call i32 @print_array(i32* %9, i32 50)
%11 = load i32*, i32** %6
%12 = call i32 @insertion_int(i32* %11, i32 50)
%13 = call i32 @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.1, i64 0, i64 0))
%14 = load i32*, i32** %6
%15 = call i32 @print_array(i32* %14, i32 50)
%16 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%17 = load i32*, i32** %6
%18 = call i32 @free_array(i32* %17)
ret i32 0
}

LLVM IR (-O2):
@str = [32 x i8] c"\0A# ----- Original Data ----- #\0A\00"
@str.3 = [30 x i8] c"\0A# ----- Sorted Data ----- #\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32* @random_gen(i32 50)
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @str, i64 0, i64 0))
%5 = tail call i32 @print_array(i32* %3, i32 50)
%6 = tail call i32 @insertion_int(i32* %3, i32 50)
%7 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @str.3, i64 0, i64 0))
%8 = tail call i32 @print_array(i32* %3, i32 50)
%9 = tail call i32 @putchar(i32 10)
%10 = tail call i32 @free_array(i32* %3)
ret i32 0
}