#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*/ checkAscending(int *, int);
int /*<<< orphan*/ insertionSort(int *, int /*<<< orphan*/, int);
int /*<<< orphan*/ printArray(int *, int);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ randomIntArray(int *, int, int /*<<< orphan*/, int);
void main() {
  int numbers[200];
  randomIntArray(numbers, 200, 0, 1000);
  printArray(numbers, 200);
  checkAscending(numbers, 200);
  printf("After sorting:\n***********************\n");
  insertionSort(numbers, 0, 200 - 1);
  printArray(numbers, 200);
  checkAscending(numbers, 200);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x320,%rsp
lea    -0x320(%rbp),%rdi
mov    $0xc8,%esi
xor    %edx,%edx
mov    $0x3e8,%ecx
call   1030 <randomIntArray@plt>
lea    -0x320(%rbp),%rdi
mov    $0xc8,%esi
call   1060 <printArray@plt>
lea    -0x320(%rbp),%rdi
mov    $0xc8,%esi
call   1070 <checkAscending@plt>
lea    0xe64(%rip),%rdi
call   1040 <printf@plt>
lea    -0x320(%rbp),%rdi
xor    %esi,%esi
mov    $0xc7,%edx
call   1050 <insertionSort@plt>
lea    -0x320(%rbp),%rdi
mov    $0xc8,%esi
call   1060 <printArray@plt>
lea    -0x320(%rbp),%rdi
mov    $0xc8,%esi
call   1070 <checkAscending@plt>
add    $0x320,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x320,%rsp
mov    %rsp,%rbx
mov    %rbx,%rdi
mov    $0xc8,%esi
xor    %edx,%edx
mov    $0x3e8,%ecx
call   1030 <randomIntArray@plt>
mov    %rbx,%rdi
mov    $0xc8,%esi
call   1060 <printArray@plt>
mov    %rbx,%rdi
mov    $0xc8,%esi
call   1070 <checkAscending@plt>
lea    0xe70(%rip),%rdi
call   1040 <puts@plt>
mov    %rbx,%rdi
xor    %esi,%esi
mov    $0xc7,%edx
call   1050 <insertionSort@plt>
mov    %rbx,%rdi
mov    $0xc8,%esi
call   1060 <printArray@plt>
mov    %rbx,%rdi
mov    $0xc8,%esi
call   1070 <checkAscending@plt>
add    $0x320,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [40 x i8] c"After sorting:\0A***********************\0A\00"
define void @main() {
%1 = alloca [200 x i32]
%2 = getelementptr inbounds [200 x i32], [200 x i32]* %1, i64 0, i64 0
%3 = call i32 @randomIntArray(i32* %2, i32 200, i32 0, i32 1000)
%4 = getelementptr inbounds [200 x i32], [200 x i32]* %1, i64 0, i64 0
%5 = call i32 @printArray(i32* %4, i32 200)
%6 = getelementptr inbounds [200 x i32], [200 x i32]* %1, i64 0, i64 0
%7 = call i32 @checkAscending(i32* %6, i32 200)
%8 = call i32 @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str, i64 0, i64 0))
%9 = getelementptr inbounds [200 x i32], [200 x i32]* %1, i64 0, i64 0
%10 = call i32 @insertionSort(i32* %9, i32 0, i32 199)
%11 = getelementptr inbounds [200 x i32], [200 x i32]* %1, i64 0, i64 0
%12 = call i32 @printArray(i32* %11, i32 200)
%13 = getelementptr inbounds [200 x i32], [200 x i32]* %1, i64 0, i64 0
%14 = call i32 @checkAscending(i32* %13, i32 200)
ret void
}

LLVM IR (-O2):
@str = [39 x i8] c"After sorting:\0A***********************\00"
define void @main() {
%1 = alloca [200 x i32]
%2 = bitcast [200 x i32]* %1 to i8*
%3 = getelementptr inbounds [200 x i32], [200 x i32]* %1, i64 0, i64 0
%4 = call i32 @randomIntArray(i32* %3, i32 200, i32 0, i32 1000)
%5 = call i32 @printArray(i32* %3, i32 200)
%6 = call i32 @checkAscending(i32* %3, i32 200)
%7 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([39 x i8], [39 x i8]* @str, i64 0, i64 0))
%8 = call i32 @insertionSort(i32* %3, i32 0, i32 199)
%9 = call i32 @printArray(i32* %3, i32 200)
%10 = call i32 @checkAscending(i32* %3, i32 200)
ret void
}