#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 /*<<< orphan*/ printf(char *, int);
int main(int argc, char **argv) {
  int array[10];
  for (int i = 0; i < 10; i++) {
    array[i] = array[i] % 10;
  }
  insertionSort(array);
  for (int i = 0; i < 10; i++) {
    printf("%i\n", array[i]);
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x44(%rbp)
cmpl   $0xa,-0x44(%rbp)
jge    116d <main+0x4d>
movslq -0x44(%rbp),%rax
mov    -0x40(%rbp,%rax,4),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
movslq -0x44(%rbp),%rax
mov    %edx,-0x40(%rbp,%rax,4)
mov    -0x44(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x44(%rbp)
jmp    113d <main+0x1d>
lea    -0x40(%rbp),%rdi
call   1040 <insertionSort@plt>
movl   $0x0,-0x48(%rbp)
cmpl   $0xa,-0x48(%rbp)
jge    11a9 <main+0x89>
movslq -0x48(%rbp),%rax
mov    -0x40(%rbp,%rax,4),%esi
lea    0xe6a(%rip),%rdi
call   1030 <printf@plt>
mov    -0x48(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x48(%rbp)
jmp    117d <main+0x5d>
mov    -0x4(%rbp),%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x30,%rsp
xorps  %xmm0,%xmm0
movaps %xmm0,0x10(%rsp)
movaps %xmm0,(%rsp)
movq   $0x0,0x20(%rsp)
mov    %rsp,%rdi
call   1040 <insertionSort@plt>
mov    (%rsp),%esi
lea    0xeb4(%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>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [4 x i8] c"%i\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [10 x i32]
%7 = alloca i32
%8 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %7
br label %9
9: ; preds = %21, %2
%10 = load i32, i32* %7
%11 = icmp slt i32 %10, 10
br i1 %11, label %12, label %24
12: ; preds = %9
%13 = load i32, i32* %7
%14 = sext i32 %13 to i64
%15 = getelementptr inbounds [10 x i32], [10 x i32]* %6, i64 0, i64 %14
%16 = load i32, i32* %15
%17 = srem i32 %16, 10
%18 = load i32, i32* %7
%19 = sext i32 %18 to i64
%20 = getelementptr inbounds [10 x i32], [10 x i32]* %6, i64 0, i64 %19
store i32 %17, i32* %20
br label %21
21: ; preds = %12
%22 = load i32, i32* %7
%23 = add nsw i32 %22, 1
store i32 %23, i32* %7
br label %9
24: ; preds = %9
%25 = getelementptr inbounds [10 x i32], [10 x i32]* %6, i64 0, i64 0
%26 = call i32 @insertionSort(i32* %25)
store i32 0, i32* %8
br label %27
27: ; preds = %36, %24
%28 = load i32, i32* %8
%29 = icmp slt i32 %28, 10
br i1 %29, label %30, label %39
30: ; preds = %27
%31 = load i32, i32* %8
%32 = sext i32 %31 to i64
%33 = getelementptr inbounds [10 x i32], [10 x i32]* %6, i64 0, i64 %32
%34 = load i32, i32* %33
%35 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %34)
br label %36
36: ; preds = %30
%37 = load i32, i32* %8
%38 = add nsw i32 %37, 1
store i32 %38, i32* %8
br label %27
39: ; preds = %27
%40 = load i32, i32* %3
ret i32 %40
}

LLVM IR (-O2):
@.str = [4 x i8] c"%i\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca [10 x i32]
%4 = bitcast [10 x i32]* %3 to i8*
%5 = getelementptr inbounds [10 x i32], [10 x i32]* %3, i64 0, i64 0
%6 = getelementptr inbounds [10 x i32], [10 x i32]* %3, i64 0, i64 1
%7 = getelementptr inbounds [10 x i32], [10 x i32]* %3, i64 0, i64 2
%8 = getelementptr inbounds [10 x i32], [10 x i32]* %3, i64 0, i64 3
%9 = getelementptr inbounds [10 x i32], [10 x i32]* %3, i64 0, i64 4
%10 = getelementptr inbounds [10 x i32], [10 x i32]* %3, i64 0, i64 5
%11 = getelementptr inbounds [10 x i32], [10 x i32]* %3, i64 0, i64 6
%12 = getelementptr inbounds [10 x i32], [10 x i32]* %3, i64 0, i64 7
%13 = getelementptr inbounds [10 x i32], [10 x i32]* %3, i64 0, i64 8
%14 = getelementptr inbounds [10 x i32], [10 x i32]* %3, i64 0, i64 9
%15 = bitcast [10 x i32]* %3 to i8*
%16 = call i32 @insertionSort(i32* %5)
%17 = load i32, i32* %5
%18 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %17)
%19 = load i32, i32* %6
%20 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %19)
%21 = load i32, i32* %7
%22 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %21)
%23 = load i32, i32* %8
%24 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %23)
%25 = load i32, i32* %9
%26 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %25)
%27 = load i32, i32* %10
%28 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %27)
%29 = load i32, i32* %11
%30 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %29)
%31 = load i32, i32* %12
%32 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %31)
%33 = load i32, i32* %13
%34 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %33)
%35 = load i32, i32* %14
%36 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %35)
ret i32 0
}