#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*/ insertion_sort(int *, int);
int /*<<< orphan*/ print_array(int *, int, char *);
int main(int argc, char const *argv[]) {
  int test1[7] = {4, 5, 1, 4, 9, 0, 1};
  int test2[8] = {1, 1, 1, 2, 2, 0, 1, 15};
  int test3[7] = {4, 0, -1, -8, -9, 0, 1};
  print_array(test1, 7, "Before");
  insertion_sort(test1, 7);
  print_array(test1, 7, "After");
  print_array(test2, 8, "Before");
  insertion_sort(test2, 8);
  print_array(test2, 8, "After");
  print_array(test3, 7, "Before");
  insertion_sort(test3, 7);
  print_array(test3, 7, "After");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    0xec3(%rip),%rax
mov    %rax,-0x30(%rbp)
mov    0xec0(%rip),%rax
mov    %rax,-0x28(%rbp)
mov    0xebd(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0xebb(%rip),%eax
mov    %eax,-0x18(%rbp)
mov    0xed9(%rip),%rax
mov    %rax,-0x50(%rbp)
mov    0xed6(%rip),%rax
mov    %rax,-0x48(%rbp)
mov    0xed3(%rip),%rax
mov    %rax,-0x40(%rbp)
mov    0xed0(%rip),%rax
mov    %rax,-0x38(%rbp)
mov    0xe8d(%rip),%rax
mov    %rax,-0x70(%rbp)
mov    0xe8a(%rip),%rax
mov    %rax,-0x68(%rbp)
mov    0xe87(%rip),%rax
mov    %rax,-0x60(%rbp)
mov    0xe85(%rip),%eax
mov    %eax,-0x58(%rbp)
lea    -0x30(%rbp),%rdi
mov    $0x7,%esi
lea    0xe9a(%rip),%rdx
call   1030 <print_array@plt>
lea    -0x30(%rbp),%rdi
mov    $0x7,%esi
call   1040 <insertion_sort@plt>
lea    -0x30(%rbp),%rdi
mov    $0x7,%esi
lea    0xe7e(%rip),%rdx
call   1030 <print_array@plt>
lea    -0x50(%rbp),%rdi
mov    $0x8,%esi
lea    0xe62(%rip),%rdx
call   1030 <print_array@plt>
lea    -0x50(%rbp),%rdi
mov    $0x8,%esi
call   1040 <insertion_sort@plt>
lea    -0x50(%rbp),%rdi
mov    $0x8,%esi
lea    0xe46(%rip),%rdx
call   1030 <print_array@plt>
lea    -0x70(%rbp),%rdi
mov    $0x7,%esi
lea    0xe2a(%rip),%rdx
call   1030 <print_array@plt>
lea    -0x70(%rbp),%rdi
mov    $0x7,%esi
call   1040 <insertion_sort@plt>
lea    -0x70(%rbp),%rdi
mov    $0x7,%esi
lea    0xe0e(%rip),%rdx
call   1030 <print_array@plt>
xor    %eax,%eax
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x60,%rsp
movups 0xedc(%rip),%xmm0
movups %xmm0,0x2c(%rsp)
movaps 0xec4(%rip),%xmm0
movaps %xmm0,0x20(%rsp)
movaps 0xf08(%rip),%xmm0
movaps %xmm0,0x50(%rsp)
movaps 0xeec(%rip),%xmm0
movaps %xmm0,0x40(%rsp)
movups 0xecc(%rip),%xmm0
movups %xmm0,0xc(%rsp)
movaps 0xeb4(%rip),%xmm0
movaps %xmm0,(%rsp)
lea    0xee9(%rip),%r14
lea    0x20(%rsp),%rbx
mov    %rbx,%rdi
mov    $0x7,%esi
mov    %r14,%rdx
call   1030 <print_array@plt>
mov    %rbx,%rdi
mov    $0x7,%esi
call   1040 <insertion_sort@plt>
lea    0xec7(%rip),%r15
mov    %rbx,%rdi
mov    $0x7,%esi
mov    %r15,%rdx
call   1030 <print_array@plt>
lea    0x40(%rsp),%rbx
mov    %rbx,%rdi
mov    $0x8,%esi
mov    %r14,%rdx
call   1030 <print_array@plt>
mov    %rbx,%rdi
mov    $0x8,%esi
call   1040 <insertion_sort@plt>
mov    %rbx,%rdi
mov    $0x8,%esi
mov    %r15,%rdx
call   1030 <print_array@plt>
mov    %rsp,%rbx
mov    %rbx,%rdi
mov    $0x7,%esi
mov    %r14,%rdx
call   1030 <print_array@plt>
mov    %rbx,%rdi
mov    $0x7,%esi
call   1040 <insertion_sort@plt>
mov    %rbx,%rdi
mov    $0x7,%esi
mov    %r15,%rdx
call   1030 <print_array@plt>
xor    %eax,%eax
add    $0x60,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@__const.main.test1 = [7 x i32] [i32 4, i32 5, i32 1, i32 4, i32 9, i32 0, i32 1]
@__const.main.test2 = [8 x i32] [i32 1, i32 1, i32 1, i32 2, i32 2, i32 0, i32 1, i32 15]
@__const.main.test3 = [7 x i32] [i32 4, i32 0, i32 -1, i32 -8, i32 -9, i32 0, i32 1]
@.str = [7 x i8] c"Before\00"
@.str.1 = [6 x i8] c"After\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [7 x i32]
%7 = alloca [8 x i32]
%8 = alloca [7 x i32]
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%9 = bitcast [7 x i32]* %6 to i8*
%10 = bitcast [8 x i32]* %7 to i8*
%11 = bitcast [7 x i32]* %8 to i8*
%12 = getelementptr inbounds [7 x i32], [7 x i32]* %6, i64 0, i64 0
%13 = call i32 @print_array(i32* %12, i32 7, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
%14 = getelementptr inbounds [7 x i32], [7 x i32]* %6, i64 0, i64 0
%15 = call i32 @insertion_sort(i32* %14, i32 7)
%16 = getelementptr inbounds [7 x i32], [7 x i32]* %6, i64 0, i64 0
%17 = call i32 @print_array(i32* %16, i32 7, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
%18 = getelementptr inbounds [8 x i32], [8 x i32]* %7, i64 0, i64 0
%19 = call i32 @print_array(i32* %18, i32 8, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
%20 = getelementptr inbounds [8 x i32], [8 x i32]* %7, i64 0, i64 0
%21 = call i32 @insertion_sort(i32* %20, i32 8)
%22 = getelementptr inbounds [8 x i32], [8 x i32]* %7, i64 0, i64 0
%23 = call i32 @print_array(i32* %22, i32 8, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
%24 = getelementptr inbounds [7 x i32], [7 x i32]* %8, i64 0, i64 0
%25 = call i32 @print_array(i32* %24, i32 7, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
%26 = getelementptr inbounds [7 x i32], [7 x i32]* %8, i64 0, i64 0
%27 = call i32 @insertion_sort(i32* %26, i32 7)
%28 = getelementptr inbounds [7 x i32], [7 x i32]* %8, i64 0, i64 0
%29 = call i32 @print_array(i32* %28, i32 7, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@__const.main.test1 = [7 x i32] [i32 4, i32 5, i32 1, i32 4, i32 9, i32 0, i32 1]
@__const.main.test2 = [8 x i32] [i32 1, i32 1, i32 1, i32 2, i32 2, i32 0, i32 1, i32 15]
@__const.main.test3 = [7 x i32] [i32 4, i32 0, i32 -1, i32 -8, i32 -9, i32 0, i32 1]
@.str = [7 x i8] c"Before\00"
@.str.1 = [6 x i8] c"After\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca [7 x i32]
%4 = alloca [8 x i32]
%5 = alloca [7 x i32]
%6 = bitcast [7 x i32]* %3 to i8*
%7 = bitcast [8 x i32]* %4 to i8*
%8 = bitcast [7 x i32]* %5 to i8*
%9 = getelementptr inbounds [7 x i32], [7 x i32]* %3, i64 0, i64 0
%10 = call i32 @print_array(i32* %9, i32 7, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
%11 = call i32 @insertion_sort(i32* %9, i32 7)
%12 = call i32 @print_array(i32* %9, i32 7, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
%13 = getelementptr inbounds [8 x i32], [8 x i32]* %4, i64 0, i64 0
%14 = call i32 @print_array(i32* %13, i32 8, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
%15 = call i32 @insertion_sort(i32* %13, i32 8)
%16 = call i32 @print_array(i32* %13, i32 8, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
%17 = getelementptr inbounds [7 x i32], [7 x i32]* %5, i64 0, i64 0
%18 = call i32 @print_array(i32* %17, i32 7, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
%19 = call i32 @insertion_sort(i32* %17, i32 7)
%20 = call i32 @print_array(i32* %17, i32 7, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
ret i32 0
}