#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*/ insertionSort(int *, int);
int /*<<< orphan*/ printArray(int *, int);
int /*<<< orphan*/ printf(char *);
void test_insertionSort() {
  printf("TEST: insertionSort\n");
  int test[] = {64, 51, 34, 32, 21, 8};
  printf("Befor insertionSort: ");
  printArray(test, 6);
  insertionSort(test, 6);
  printf("After insertionSort: ");
  printArray(test, 6);
}


x86 assembly (clang, -O0):
<test_insertionSort>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
lea    0xec1(%rip),%rdi
call   1030 <printf@plt>
mov    0xf05(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0xf02(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    0xeff(%rip),%rax
mov    %rax,-0x10(%rbp)
lea    0xea9(%rip),%rdi
call   1030 <printf@plt>
lea    -0x20(%rbp),%rdi
mov    $0x6,%esi
call   1050 <printArray@plt>
lea    -0x20(%rbp),%rdi
mov    $0x6,%esi
call   1040 <insertionSort@plt>
lea    0xe97(%rip),%rdi
call   1030 <printf@plt>
lea    -0x20(%rbp),%rdi
mov    $0x6,%esi
call   1050 <printArray@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_insertionSort>:
push   %rbx
sub    $0x20,%rsp
lea    0xef8(%rip),%rdi
call   1030 <puts@plt>
mov    0xeb8(%rip),%rax
mov    %rax,0x10(%rsp)
movaps 0xe9c(%rip),%xmm0
movaps %xmm0,(%rsp)
lea    0xea9(%rip),%rdi
call   1040 <printf@plt>
mov    %rsp,%rbx
mov    %rbx,%rdi
mov    $0x6,%esi
call   1060 <printArray@plt>
mov    %rbx,%rdi
mov    $0x6,%esi
call   1050 <insertionSort@plt>
lea    0xe96(%rip),%rdi
call   1040 <printf@plt>
mov    %rbx,%rdi
mov    $0x6,%esi
call   1060 <printArray@plt>
add    $0x20,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [21 x i8] c"TEST: insertionSort\0A\00"
@__const.test_insertionSort.test = [6 x i32] [i32 64, i32 51, i32 34, i32 32, i32 21, i32 8]
@.str.1 = [22 x i8] c"Befor insertionSort: \00"
@.str.2 = [22 x i8] c"After insertionSort: \00"
define void @test_insertionSort() {
%1 = alloca [6 x i32]
%2 = call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0))
%3 = bitcast [6 x i32]* %1 to i8*
%4 = call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0))
%5 = getelementptr inbounds [6 x i32], [6 x i32]* %1, i64 0, i64 0
%6 = call i32 @printArray(i32* %5, i32 6)
%7 = getelementptr inbounds [6 x i32], [6 x i32]* %1, i64 0, i64 0
%8 = call i32 @insertionSort(i32* %7, i32 6)
%9 = call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.2, i64 0, i64 0))
%10 = getelementptr inbounds [6 x i32], [6 x i32]* %1, i64 0, i64 0
%11 = call i32 @printArray(i32* %10, i32 6)
ret void
}

LLVM IR (-O2):
@__const.test_insertionSort.test = [6 x i32] [i32 64, i32 51, i32 34, i32 32, i32 21, i32 8]
@.str.1 = [22 x i8] c"Befor insertionSort: \00"
@.str.2 = [22 x i8] c"After insertionSort: \00"
@str = [20 x i8] c"TEST: insertionSort\00"
define void @test_insertionSort() {
%1 = alloca [6 x i32]
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @str, i64 0, i64 0))
%3 = bitcast [6 x i32]* %1 to i8*
%4 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0))
%5 = getelementptr inbounds [6 x i32], [6 x i32]* %1, i64 0, i64 0
%6 = call i32 @printArray(i32* %5, i32 6)
%7 = call i32 @insertionSort(i32* %5, i32 6)
%8 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str.2, i64 0, i64 0))
%9 = call i32 @printArray(i32* %5, i32 6)
ret void
}