#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*/ numbers;

/* Variables and functions */
int /*<<< orphan*/ insertion_sort(int *, int);
int /*<<< orphan*/ printf(char *, int);
int /*<<< orphan*/ putchar(char);
int main() {
  int number_count = 0;
  int numbers[] = {1,    -900, 484,  -78, 194,  518,  326, 125,  549, -145, 531,
                   -416, 978,  -416, 979, -421, -391, 841, -129, 561, 166,  -3};
  number_count = sizeof(numbers) / sizeof(int) - 1;
  insertion_sort(numbers, number_count);
  int i;
  for (i = 0; i <= number_count; i++) {
    printf("%d ", numbers[i]);
  }
  putchar('\n');
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
lea    -0x60(%rbp),%rdi
lea    0xe9f(%rip),%rsi
mov    $0x58,%edx
call   1050 <memcpy@plt>
movl   $0x15,-0x8(%rbp)
lea    -0x60(%rbp),%rdi
mov    -0x8(%rbp),%esi
call   1060 <insertion_sort@plt>
movl   $0x0,-0x64(%rbp)
mov    -0x64(%rbp),%eax
cmp    -0x8(%rbp),%eax
jg     11b3 <main+0x73>
movslq -0x64(%rbp),%rax
mov    -0x60(%rbp,%rax,4),%esi
lea    0xeb8(%rip),%rdi
call   1040 <printf@plt>
mov    -0x64(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x64(%rbp)
jmp    1185 <main+0x45>
mov    $0xa,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x60,%rsp
mov    0xf14(%rip),%rax
mov    %rax,0x50(%rsp)
movaps 0xef8(%rip),%xmm0
movaps %xmm0,0x40(%rsp)
movaps 0xedc(%rip),%xmm0
movaps %xmm0,0x30(%rsp)
movaps 0xec0(%rip),%xmm0
movaps %xmm0,0x20(%rsp)
movaps 0xea4(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movaps 0xe88(%rip),%xmm0
movaps %xmm0,(%rsp)
mov    %rsp,%rdi
mov    $0x15,%esi
call   1050 <insertion_sort@plt>
mov    (%rsp),%esi
lea    0xec5(%rip),%rbx
mov    %rbx,%rdi
call   1040 <printf@plt>
mov    0x4(%rsp),%esi
mov    %rbx,%rdi
call   1040 <printf@plt>
mov    0x8(%rsp),%esi
mov    %rbx,%rdi
call   1040 <printf@plt>
mov    0xc(%rsp),%esi
mov    %rbx,%rdi
call   1040 <printf@plt>
mov    0x10(%rsp),%esi
mov    %rbx,%rdi
call   1040 <printf@plt>
mov    0x14(%rsp),%esi
mov    %rbx,%rdi
call   1040 <printf@plt>
mov    0x18(%rsp),%esi
mov    %rbx,%rdi
call   1040 <printf@plt>
mov    0x1c(%rsp),%esi
mov    %rbx,%rdi
call   1040 <printf@plt>
mov    0x20(%rsp),%esi
mov    %rbx,%rdi
call   1040 <printf@plt>
mov    0x24(%rsp),%esi
mov    %rbx,%rdi
call   1040 <printf@plt>
mov    0x28(%rsp),%esi
mov    %rbx,%rdi
call   1040 <printf@plt>
mov    0x2c(%rsp),%esi
mov    %rbx,%rdi
call   1040 <printf@plt>
mov    0x30(%rsp),%esi
mov    %rbx,%rdi
call   1040 <printf@plt>
mov    0x34(%rsp),%esi
mov    %rbx,%rdi
call   1040 <printf@plt>
mov    0x38(%rsp),%esi
mov    %rbx,%rdi
call   1040 <printf@plt>
mov    0x3c(%rsp),%esi
mov    %rbx,%rdi
call   1040 <printf@plt>
mov    0x40(%rsp),%esi
mov    %rbx,%rdi
call   1040 <printf@plt>
mov    0x44(%rsp),%esi
mov    %rbx,%rdi
call   1040 <printf@plt>
mov    0x48(%rsp),%esi
mov    %rbx,%rdi
call   1040 <printf@plt>
mov    0x4c(%rsp),%esi
mov    %rbx,%rdi
call   1040 <printf@plt>
mov    0x50(%rsp),%esi
mov    %rbx,%rdi
call   1040 <printf@plt>
mov    0x54(%rsp),%esi
mov    %rbx,%rdi
call   1040 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
add    $0x60,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@__const.main.numbers = [22 x i32] [i32 1, i32 -900, i32 484, i32 -78, i32 194, i32 518, i32 326, i32 125, i32 549, i32 -145, i32 531, i32 -416, i32 978, i32 -416, i32 979, i32 -421, i32 -391, i32 841, i32 -129, i32 561, i32 166, i32 -3]
@.str = [4 x i8] c"%d \00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca [22 x i32]
%4 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %2
%5 = bitcast [22 x i32]* %3 to i8*
store i32 21, i32* %2
%6 = getelementptr inbounds [22 x i32], [22 x i32]* %3, i64 0, i64 0
%7 = load i32, i32* %2
%8 = call i32 @insertion_sort(i32* %6, i32 %7)
store i32 0, i32* %4
br label %9
9: ; preds = %19, %0
%10 = load i32, i32* %4
%11 = load i32, i32* %2
%12 = icmp sle i32 %10, %11
br i1 %12, label %13, label %22
13: ; preds = %9
%14 = load i32, i32* %4
%15 = sext i32 %14 to i64
%16 = getelementptr inbounds [22 x i32], [22 x i32]* %3, i64 0, i64 %15
%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)
br label %19
19: ; preds = %13
%20 = load i32, i32* %4
%21 = add nsw i32 %20, 1
store i32 %21, i32* %4
br label %9
22: ; preds = %9
%23 = call i32 @putchar(i8 signext 10)
ret i32 0
}

LLVM IR (-O2):
@__const.main.numbers = [22 x i32] [i32 1, i32 -900, i32 484, i32 -78, i32 194, i32 518, i32 326, i32 125, i32 549, i32 -145, i32 531, i32 -416, i32 978, i32 -416, i32 979, i32 -421, i32 -391, i32 841, i32 -129, i32 561, i32 166, i32 -3]
@.str = [4 x i8] c"%d \00"
define i32 @main() {
%1 = alloca [22 x i32]
%2 = bitcast [22 x i32]* %1 to i8*
%3 = getelementptr inbounds [22 x i32], [22 x i32]* %1, i64 0, i64 0
%4 = call i32 @insertion_sort(i32* %3, i32 21)
%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 [22 x i32], [22 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 [22 x i32], [22 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 [22 x i32], [22 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 [22 x i32], [22 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 [22 x i32], [22 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 [22 x i32], [22 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 [22 x i32], [22 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 [22 x i32], [22 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 [22 x i32], [22 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 [22 x i32], [22 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 [22 x i32], [22 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 [22 x i32], [22 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 [22 x i32], [22 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 [22 x i32], [22 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 [22 x i32], [22 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 [22 x i32], [22 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 [22 x i32], [22 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)
%58 = getelementptr inbounds [22 x i32], [22 x i32]* %1, i64 0, i64 18
%59 = load i32, i32* %58
%60 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %59)
%61 = getelementptr inbounds [22 x i32], [22 x i32]* %1, i64 0, i64 19
%62 = load i32, i32* %61
%63 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %62)
%64 = getelementptr inbounds [22 x i32], [22 x i32]* %1, i64 0, i64 20
%65 = load i32, i32* %64
%66 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %65)
%67 = getelementptr inbounds [22 x i32], [22 x i32]* %1, i64 0, i64 21
%68 = load i32, i32* %67
%69 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %68)
%70 = call i32 @putchar(i8 signext 10)
ret i32 0
}