#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 */
typedef int /*<<< orphan*/ nums;

/* Variables and functions */
int /*<<< orphan*/ InsertionSort(int *, int);
int /*<<< orphan*/ printf(char *, int);
void main() {
  int i;
  int nums[] = {3, 5, 1, 8, 4, 66, 12, 90, 2, 1, 5, 7, 9, 3, 5, 5, 3, 2};
  int length = sizeof(nums) / sizeof(nums[0]);
  InsertionSort(nums, length);
  for (i = 0; i < length; ++i)
    printf("%d\n", nums[i]);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
lea    -0x50(%rbp),%rdi
lea    0xebd(%rip),%rsi
mov    $0x48,%edx
call   1040 <memcpy@plt>
movl   $0x12,-0x54(%rbp)
lea    -0x50(%rbp),%rdi
mov    -0x54(%rbp),%esi
call   1050 <InsertionSort@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
cmp    -0x54(%rbp),%eax
jge    1195 <main+0x65>
movslq -0x4(%rbp),%rax
mov    -0x50(%rbp,%rax,4),%esi
lea    0xec6(%rip),%rdi
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    1167 <main+0x37>
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x50,%rsp
mov    0xf14(%rip),%rax
mov    %rax,0x40(%rsp)
movaps 0xef8(%rip),%xmm0
movaps %xmm0,0x30(%rsp)
movaps 0xedc(%rip),%xmm0
movaps %xmm0,0x20(%rsp)
movaps 0xec0(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movaps 0xea4(%rip),%xmm0
movaps %xmm0,(%rsp)
mov    %rsp,%rdi
mov    $0x12,%esi
call   1040 <InsertionSort@plt>
mov    (%rsp),%esi
lea    0xed1(%rip),%rbx
mov    %rbx,%rdi
call   1030 <printf@plt>
mov    0x4(%rsp),%esi
mov    %rbx,%rdi
call   1030 <printf@plt>
mov    0x8(%rsp),%esi
mov    %rbx,%rdi
call   1030 <printf@plt>
mov    0xc(%rsp),%esi
mov    %rbx,%rdi
call   1030 <printf@plt>
mov    0x10(%rsp),%esi
mov    %rbx,%rdi
call   1030 <printf@plt>
mov    0x14(%rsp),%esi
mov    %rbx,%rdi
call   1030 <printf@plt>
mov    0x18(%rsp),%esi
mov    %rbx,%rdi
call   1030 <printf@plt>
mov    0x1c(%rsp),%esi
mov    %rbx,%rdi
call   1030 <printf@plt>
mov    0x20(%rsp),%esi
mov    %rbx,%rdi
call   1030 <printf@plt>
mov    0x24(%rsp),%esi
mov    %rbx,%rdi
call   1030 <printf@plt>
mov    0x28(%rsp),%esi
mov    %rbx,%rdi
call   1030 <printf@plt>
mov    0x2c(%rsp),%esi
mov    %rbx,%rdi
call   1030 <printf@plt>
mov    0x30(%rsp),%esi
mov    %rbx,%rdi
call   1030 <printf@plt>
mov    0x34(%rsp),%esi
mov    %rbx,%rdi
call   1030 <printf@plt>
mov    0x38(%rsp),%esi
mov    %rbx,%rdi
call   1030 <printf@plt>
mov    0x3c(%rsp),%esi
mov    %rbx,%rdi
call   1030 <printf@plt>
mov    0x40(%rsp),%esi
mov    %rbx,%rdi
call   1030 <printf@plt>
mov    0x44(%rsp),%esi
mov    %rbx,%rdi
call   1030 <printf@plt>
add    $0x50,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@__const.main.nums = [18 x i32] [i32 3, i32 5, i32 1, i32 8, i32 4, i32 66, i32 12, i32 90, i32 2, i32 1, i32 5, i32 7, i32 9, i32 3, i32 5, i32 5, i32 3, i32 2]
@.str = [4 x i8] c"%d\0A\00"
define void @main() {
%1 = alloca i32
%2 = alloca [18 x i32]
%3 = alloca i32
%4 = bitcast [18 x i32]* %2 to i8*
store i32 18, i32* %3
%5 = getelementptr inbounds [18 x i32], [18 x i32]* %2, i64 0, i64 0
%6 = load i32, i32* %3
%7 = call i32 @InsertionSort(i32* %5, i32 %6)
store i32 0, i32* %1
br label %8
8: ; preds = %18, %0
%9 = load i32, i32* %1
%10 = load i32, i32* %3
%11 = icmp slt i32 %9, %10
br i1 %11, label %12, label %21
12: ; preds = %8
%13 = load i32, i32* %1
%14 = sext i32 %13 to i64
%15 = getelementptr inbounds [18 x i32], [18 x i32]* %2, i64 0, i64 %14
%16 = load i32, i32* %15
%17 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %16)
br label %18
18: ; preds = %12
%19 = load i32, i32* %1
%20 = add nsw i32 %19, 1
store i32 %20, i32* %1
br label %8
21: ; preds = %8
ret void
}

LLVM IR (-O2):
@__const.main.nums = [18 x i32] [i32 3, i32 5, i32 1, i32 8, i32 4, i32 66, i32 12, i32 90, i32 2, i32 1, i32 5, i32 7, i32 9, i32 3, i32 5, i32 5, i32 3, i32 2]
@.str = [4 x i8] c"%d\0A\00"
define void @main() {
%1 = alloca [18 x i32]
%2 = bitcast [18 x i32]* %1 to i8*
%3 = getelementptr inbounds [18 x i32], [18 x i32]* %1, i64 0, i64 0
%4 = call i32 @InsertionSort(i32* %3, i32 18)
%5 = load i32, i32* %3
%6 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %5)
%7 = getelementptr inbounds [18 x i32], [18 x i32]* %1, i64 0, i64 1
%8 = load i32, i32* %7
%9 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %8)
%10 = getelementptr inbounds [18 x i32], [18 x i32]* %1, i64 0, i64 2
%11 = load i32, i32* %10
%12 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %11)
%13 = getelementptr inbounds [18 x i32], [18 x i32]* %1, i64 0, i64 3
%14 = load i32, i32* %13
%15 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %14)
%16 = getelementptr inbounds [18 x i32], [18 x i32]* %1, i64 0, i64 4
%17 = load i32, i32* %16
%18 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %17)
%19 = getelementptr inbounds [18 x i32], [18 x i32]* %1, i64 0, i64 5
%20 = load i32, i32* %19
%21 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %20)
%22 = getelementptr inbounds [18 x i32], [18 x i32]* %1, i64 0, i64 6
%23 = load i32, i32* %22
%24 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %23)
%25 = getelementptr inbounds [18 x i32], [18 x i32]* %1, i64 0, i64 7
%26 = load i32, i32* %25
%27 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %26)
%28 = getelementptr inbounds [18 x i32], [18 x i32]* %1, i64 0, i64 8
%29 = load i32, i32* %28
%30 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %29)
%31 = getelementptr inbounds [18 x i32], [18 x i32]* %1, i64 0, i64 9
%32 = load i32, i32* %31
%33 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %32)
%34 = getelementptr inbounds [18 x i32], [18 x i32]* %1, i64 0, i64 10
%35 = load i32, i32* %34
%36 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %35)
%37 = getelementptr inbounds [18 x i32], [18 x i32]* %1, i64 0, i64 11
%38 = load i32, i32* %37
%39 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %38)
%40 = getelementptr inbounds [18 x i32], [18 x i32]* %1, i64 0, i64 12
%41 = load i32, i32* %40
%42 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %41)
%43 = getelementptr inbounds [18 x i32], [18 x i32]* %1, i64 0, i64 13
%44 = load i32, i32* %43
%45 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %44)
%46 = getelementptr inbounds [18 x i32], [18 x i32]* %1, i64 0, i64 14
%47 = load i32, i32* %46
%48 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %47)
%49 = getelementptr inbounds [18 x i32], [18 x i32]* %1, i64 0, i64 15
%50 = load i32, i32* %49
%51 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %50)
%52 = getelementptr inbounds [18 x i32], [18 x i32]* %1, i64 0, i64 16
%53 = load i32, i32* %52
%54 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %53)
%55 = getelementptr inbounds [18 x i32], [18 x i32]* %1, i64 0, i64 17
%56 = load i32, i32* %55
%57 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %56)
ret void
}