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

/* Variables and functions */
int /*<<< orphan*/ insertSort(int *, int);
int /*<<< orphan*/ printf(char *, ...);
int rand();
int /*<<< orphan*/ srand(int /*<<< orphan*/);
int /*<<< orphan*/ time(int /*<<< orphan*/ *);
int main() {
  int a[10] = {0};
  srand(time(NULL));
  for (int i = 0; i < sizeof(a) / sizeof(a[0]); i++) {
    a[i] = rand() % 100;
  }
  for (int i = 0; i < sizeof(a) / sizeof(a[0]); i++) {
    printf("%d ", a[i]);
  }
  printf("\n");
  insertSort(a, sizeof(a) / sizeof(a[0]));
  for (int i = 0; i < sizeof(a) / sizeof(a[0]); i++) {
    printf("%d ", a[i]);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x30(%rbp),%rdi
xor    %esi,%esi
mov    $0x28,%edx
call   1050 <memset@plt>
xor    %eax,%eax
mov    %eax,%edi
call   1070 <time@plt>
mov    %eax,%edi
call   1060 <srand@plt>
movl   $0x0,-0x34(%rbp)
movslq -0x34(%rbp),%rax
cmp    $0xa,%rax
jae    11c9 <main+0x69>
mov    $0x0,%al
call   1080 <rand@plt>
mov    $0x64,%ecx
cltd
idiv   %ecx
movslq -0x34(%rbp),%rax
mov    %edx,-0x30(%rbp,%rax,4)
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    1196 <main+0x36>
movl   $0x0,-0x38(%rbp)
movslq -0x38(%rbp),%rax
cmp    $0xa,%rax
jae    1202 <main+0xa2>
movslq -0x38(%rbp),%rax
mov    -0x30(%rbp,%rax,4),%esi
lea    0xe13(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x38(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x38(%rbp)
jmp    11d0 <main+0x70>
lea    0xdfb(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    -0x30(%rbp),%rdi
mov    $0xa,%esi
call   1030 <insertSort@plt>
movl   $0x0,-0x3c(%rbp)
movslq -0x3c(%rbp),%rax
cmp    $0xa,%rax
jae    1257 <main+0xf7>
movslq -0x3c(%rbp),%rax
mov    -0x30(%rbp,%rax,4),%esi
lea    0xdbe(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x3c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x3c(%rbp)
jmp    1225 <main+0xc5>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x58,%rsp
xor    %edi,%edi
call   1070 <time@plt>
mov    %eax,%edi
call   1060 <srand@plt>
xor    %eax,%eax
call   1080 <rand@plt>
movslq %eax,%rdx
imul   $0x51eb851f,%rdx,%rax
mov    %rax,%rcx
shr    $0x3f,%rcx
shr    $0x20,%rax
sar    $0x5,%eax
add    %ecx,%eax
imul   $0x64,%eax,%eax
sub    %eax,%edx
mov    %rdx,0x50(%rsp)
mov    %edx,(%rsp)
xor    %eax,%eax
call   1080 <rand@plt>
movslq %eax,%rdx
imul   $0x51eb851f,%rdx,%rax
mov    %rax,%rcx
shr    $0x3f,%rcx
shr    $0x20,%rax
sar    $0x5,%eax
add    %ecx,%eax
imul   $0x64,%eax,%eax
sub    %eax,%edx
mov    %rdx,0x48(%rsp)
mov    %edx,0x4(%rsp)
xor    %eax,%eax
call   1080 <rand@plt>
movslq %eax,%rdx
imul   $0x51eb851f,%rdx,%rax
mov    %rax,%rcx
shr    $0x3f,%rcx
shr    $0x20,%rax
sar    $0x5,%eax
add    %ecx,%eax
imul   $0x64,%eax,%eax
sub    %eax,%edx
mov    %rdx,0x40(%rsp)
mov    %edx,0x8(%rsp)
xor    %eax,%eax
call   1080 <rand@plt>
movslq %eax,%rdx
imul   $0x51eb851f,%rdx,%rax
mov    %rax,%rcx
shr    $0x3f,%rcx
shr    $0x20,%rax
sar    $0x5,%eax
add    %ecx,%eax
imul   $0x64,%eax,%eax
sub    %eax,%edx
mov    %rdx,0x38(%rsp)
mov    %edx,0xc(%rsp)
xor    %eax,%eax
call   1080 <rand@plt>
movslq %eax,%rdx
imul   $0x51eb851f,%rdx,%rax
mov    %rax,%rcx
shr    $0x3f,%rcx
shr    $0x20,%rax
sar    $0x5,%eax
add    %ecx,%eax
imul   $0x64,%eax,%eax
sub    %eax,%edx
mov    %rdx,0x30(%rsp)
mov    %edx,0x10(%rsp)
xor    %eax,%eax
call   1080 <rand@plt>
movslq %eax,%rbp
imul   $0x51eb851f,%rbp,%rax
mov    %rax,%rcx
shr    $0x3f,%rcx
shr    $0x20,%rax
sar    $0x5,%eax
add    %ecx,%eax
imul   $0x64,%eax,%eax
sub    %eax,%ebp
mov    %ebp,0x14(%rsp)
xor    %eax,%eax
call   1080 <rand@plt>
movslq %eax,%r15
imul   $0x51eb851f,%r15,%rax
mov    %rax,%rcx
shr    $0x3f,%rcx
shr    $0x20,%rax
sar    $0x5,%eax
add    %ecx,%eax
imul   $0x64,%eax,%eax
sub    %eax,%r15d
mov    %r15d,0x18(%rsp)
xor    %eax,%eax
call   1080 <rand@plt>
movslq %eax,%r12
imul   $0x51eb851f,%r12,%rax
mov    %rax,%rcx
shr    $0x3f,%rcx
shr    $0x20,%rax
sar    $0x5,%eax
add    %ecx,%eax
imul   $0x64,%eax,%eax
sub    %eax,%r12d
mov    %r12d,0x1c(%rsp)
xor    %eax,%eax
call   1080 <rand@plt>
movslq %eax,%r13
imul   $0x51eb851f,%r13,%rax
mov    %rax,%rcx
shr    $0x3f,%rcx
shr    $0x20,%rax
sar    $0x5,%eax
add    %ecx,%eax
imul   $0x64,%eax,%eax
sub    %eax,%r13d
mov    %r13d,0x20(%rsp)
xor    %eax,%eax
call   1080 <rand@plt>
movslq %eax,%rbx
imul   $0x51eb851f,%rbx,%rax
mov    %rax,%rcx
shr    $0x3f,%rcx
shr    $0x20,%rax
sar    $0x5,%eax
add    %ecx,%eax
imul   $0x64,%eax,%eax
sub    %eax,%ebx
mov    %ebx,0x24(%rsp)
lea    0xcbb(%rip),%r14
mov    %r14,%rdi
mov    0x50(%rsp),%rsi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %r14,%rdi
mov    0x48(%rsp),%rsi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %r14,%rdi
mov    0x40(%rsp),%rsi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %r14,%rdi
mov    0x38(%rsp),%rsi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %r14,%rdi
mov    0x30(%rsp),%rsi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %r14,%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %r14,%rdi
mov    %r15d,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %r14,%rdi
mov    %r12d,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %r14,%rdi
mov    %r13d,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %r14,%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    %rsp,%rdi
mov    $0xa,%esi
call   1040 <insertSort@plt>
mov    (%rsp),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x4(%rsp),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x8(%rsp),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0xc(%rsp),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x10(%rsp),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x14(%rsp),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x18(%rsp),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x1c(%rsp),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x20(%rsp),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x24(%rsp),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
xor    %eax,%eax
add    $0x58,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [4 x i8] c"%d \00"
@.str.1 = [2 x i8] c"\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [10 x i32]
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 0, i32* %1
%6 = bitcast [10 x i32]* %2 to i8*
%7 = call i32 @time(i32* null)
%8 = call i32 @srand(i32 %7)
store i32 0, i32* %3
br label %9
9: ; preds = %19, %0
%10 = load i32, i32* %3
%11 = sext i32 %10 to i64
%12 = icmp ult i64 %11, 10
br i1 %12, label %13, label %22
13: ; preds = %9
%14 = call i32 (...) @rand()
%15 = srem i32 %14, 100
%16 = load i32, i32* %3
%17 = sext i32 %16 to i64
%18 = getelementptr inbounds [10 x i32], [10 x i32]* %2, i64 0, i64 %17
store i32 %15, i32* %18
br label %19
19: ; preds = %13
%20 = load i32, i32* %3
%21 = add nsw i32 %20, 1
store i32 %21, i32* %3
br label %9
22: ; preds = %9
store i32 0, i32* %4
br label %23
23: ; preds = %33, %22
%24 = load i32, i32* %4
%25 = sext i32 %24 to i64
%26 = icmp ult i64 %25, 10
br i1 %26, label %27, label %36
27: ; preds = %23
%28 = load i32, i32* %4
%29 = sext i32 %28 to i64
%30 = getelementptr inbounds [10 x i32], [10 x i32]* %2, i64 0, i64 %29
%31 = load i32, i32* %30
%32 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %31)
br label %33
33: ; preds = %27
%34 = load i32, i32* %4
%35 = add nsw i32 %34, 1
store i32 %35, i32* %4
br label %23
36: ; preds = %23
%37 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%38 = getelementptr inbounds [10 x i32], [10 x i32]* %2, i64 0, i64 0
%39 = call i32 @insertSort(i32* %38, i32 10)
store i32 0, i32* %5
br label %40
40: ; preds = %50, %36
%41 = load i32, i32* %5
%42 = sext i32 %41 to i64
%43 = icmp ult i64 %42, 10
br i1 %43, label %44, label %53
44: ; preds = %40
%45 = load i32, i32* %5
%46 = sext i32 %45 to i64
%47 = getelementptr inbounds [10 x i32], [10 x i32]* %2, i64 0, i64 %46
%48 = load i32, i32* %47
%49 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %48)
br label %50
50: ; preds = %44
%51 = load i32, i32* %5
%52 = add nsw i32 %51, 1
store i32 %52, i32* %5
br label %40
53: ; preds = %40
ret i32 0
}

LLVM IR (-O2):
@.str = [4 x i8] c"%d \00"
define i32 @main() {
%1 = alloca [10 x i32]
%2 = bitcast [10 x i32]* %1 to i8*
%3 = tail call i32 @time(i32* null)
%4 = tail call i32 @srand(i32 %3)
%5 = tail call i32 (...) @rand()
%6 = srem i32 %5, 100
%7 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 0
store i32 %6, i32* %7
%8 = tail call i32 (...) @rand()
%9 = srem i32 %8, 100
%10 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 1
store i32 %9, i32* %10
%11 = tail call i32 (...) @rand()
%12 = srem i32 %11, 100
%13 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 2
store i32 %12, i32* %13
%14 = tail call i32 (...) @rand()
%15 = srem i32 %14, 100
%16 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 3
store i32 %15, i32* %16
%17 = tail call i32 (...) @rand()
%18 = srem i32 %17, 100
%19 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 4
store i32 %18, i32* %19
%20 = tail call i32 (...) @rand()
%21 = srem i32 %20, 100
%22 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 5
store i32 %21, i32* %22
%23 = tail call i32 (...) @rand()
%24 = srem i32 %23, 100
%25 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 6
store i32 %24, i32* %25
%26 = tail call i32 (...) @rand()
%27 = srem i32 %26, 100
%28 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 7
store i32 %27, i32* %28
%29 = tail call i32 (...) @rand()
%30 = srem i32 %29, 100
%31 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 8
store i32 %30, i32* %31
%32 = tail call i32 (...) @rand()
%33 = srem i32 %32, 100
%34 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 9
store i32 %33, i32* %34
%35 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %6)
%36 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %9)
%37 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %12)
%38 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %15)
%39 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %18)
%40 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %21)
%41 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %24)
%42 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %27)
%43 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %30)
%44 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %33)
%45 = tail call i32 @putchar(i32 10)
%46 = call i32 @insertSort(i32* %7, i32 10)
%47 = load i32, i32* %7
%48 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %47)
%49 = load i32, i32* %10
%50 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %49)
%51 = load i32, i32* %13
%52 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %51)
%53 = load i32, i32* %16
%54 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %53)
%55 = load i32, i32* %19
%56 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %55)
%57 = load i32, i32* %22
%58 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %57)
%59 = load i32, i32* %25
%60 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %59)
%61 = load i32, i32* %28
%62 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %61)
%63 = load i32, i32* %31
%64 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %63)
%65 = load i32, i32* %34
%66 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %65)
ret i32 0
}