#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*/ printf(char *, int);
int /*<<< orphan*/ scanf(char *, int *);
int main(int argc, const char *argv[]) {
  int i, j, tmp, a[10];
  for (i = 0; i < 10; i++)
    scanf("%d", &a[i]);
  for (i = 0; i < 10; i++) {
    tmp = a[i];
    for (j = i; j > 0 && a[j - 1] > tmp; j--) {
      a[j] = a[j - 1];
    }
    a[j] = tmp;
  }
  for (i = 0; i < 10; i++) {
    printf("%d\n", a[i]);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
cmpl   $0xa,-0x14(%rbp)
jge    1170 <main+0x50>
movslq -0x14(%rbp),%rax
lea    -0x50(%rbp),%rsi
shl    $0x2,%rax
add    %rax,%rsi
lea    0xea3(%rip),%rdi
call   1040 <scanf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    113d <main+0x1d>
movl   $0x0,-0x14(%rbp)
cmpl   $0xa,-0x14(%rbp)
jge    1201 <main+0xe1>
movslq -0x14(%rbp),%rax
mov    -0x50(%rbp,%rax,4),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x14(%rbp),%eax
mov    %eax,-0x18(%rbp)
xor    %eax,%eax
cmpl   $0x0,-0x18(%rbp)
mov    %al,-0x51(%rbp)
jle    11b6 <main+0x96>
mov    -0x18(%rbp),%eax
sub    $0x1,%eax
cltq
mov    -0x50(%rbp,%rax,4),%eax
cmp    -0x1c(%rbp),%eax
setg   %al
mov    %al,-0x51(%rbp)
mov    -0x51(%rbp),%al
test   $0x1,%al
jne    11c6 <main+0xa6>
jmp    11e8 <main+0xc8>
mov    -0x18(%rbp),%eax
sub    $0x1,%eax
cltq
mov    -0x50(%rbp,%rax,4),%ecx
movslq -0x18(%rbp),%rax
mov    %ecx,-0x50(%rbp,%rax,4)
mov    -0x18(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x18(%rbp)
jmp    1192 <main+0x72>
mov    -0x1c(%rbp),%ecx
movslq -0x18(%rbp),%rax
mov    %ecx,-0x50(%rbp,%rax,4)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1177 <main+0x57>
movl   $0x0,-0x14(%rbp)
cmpl   $0xa,-0x14(%rbp)
jge    1234 <main+0x114>
movslq -0x14(%rbp),%rax
mov    -0x50(%rbp,%rax,4),%esi
lea    0xde2(%rip),%rdi
call   1030 <printf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1208 <main+0xe8>
xor    %eax,%eax
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x30,%rsp
lea    0xed4(%rip),%rbx
mov    %rsp,%rsi
mov    %rbx,%rdi
call   1040 <scanf@plt>
lea    0x4(%rsp),%rsi
mov    %rbx,%rdi
call   1040 <scanf@plt>
lea    0x8(%rsp),%rsi
mov    %rbx,%rdi
call   1040 <scanf@plt>
lea    0xc(%rsp),%rsi
mov    %rbx,%rdi
call   1040 <scanf@plt>
lea    0x10(%rsp),%rsi
mov    %rbx,%rdi
call   1040 <scanf@plt>
lea    0x14(%rsp),%rsi
mov    %rbx,%rdi
call   1040 <scanf@plt>
lea    0x18(%rsp),%rsi
mov    %rbx,%rdi
call   1040 <scanf@plt>
lea    0x1c(%rsp),%rsi
mov    %rbx,%rdi
call   1040 <scanf@plt>
lea    0x20(%rsp),%rsi
mov    %rbx,%rdi
call   1040 <scanf@plt>
lea    0x24(%rsp),%rsi
mov    %rbx,%rdi
call   1040 <scanf@plt>
xor    %eax,%eax
jmp    11c2 <main+0xa2>
xor    %edx,%edx
movslq %edx,%rdx
mov    %ecx,(%rsp,%rdx,4)
add    $0x1,%rax
cmp    $0xa,%rax
je     11ef <main+0xcf>
mov    (%rsp,%rax,4),%ecx
test   %rax,%rax
je     11b0 <main+0x90>
mov    %rax,%rdx
nopl   (%rax)
lea    -0x1(%rdx),%rsi
mov    %esi,%edi
mov    (%rsp,%rdi,4),%edi
cmp    %ecx,%edi
jle    11b2 <main+0x92>
mov    %edi,(%rsp,%rdx,4)
lea    0x1(%rsi),%rdi
mov    %rsi,%rdx
cmp    $0x1,%rdi
jg     11d0 <main+0xb0>
jmp    11b0 <main+0x90>
mov    (%rsp),%esi
lea    0xe0a(%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 = [3 x i8] c"%d\00"
@.str.1 = [4 x i8] c"%d\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca [10 x i32]
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %6
br label %10
10: ; preds = %18, %2
%11 = load i32, i32* %6
%12 = icmp slt i32 %11, 10
br i1 %12, label %13, label %21
13: ; preds = %10
%14 = load i32, i32* %6
%15 = sext i32 %14 to i64
%16 = getelementptr inbounds [10 x i32], [10 x i32]* %9, i64 0, i64 %15
%17 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %16)
br label %18
18: ; preds = %13
%19 = load i32, i32* %6
%20 = add nsw i32 %19, 1
store i32 %20, i32* %6
br label %10
21: ; preds = %10
store i32 0, i32* %6
br label %22
22: ; preds = %61, %21
%23 = load i32, i32* %6
%24 = icmp slt i32 %23, 10
br i1 %24, label %25, label %64
25: ; preds = %22
%26 = load i32, i32* %6
%27 = sext i32 %26 to i64
%28 = getelementptr inbounds [10 x i32], [10 x i32]* %9, i64 0, i64 %27
%29 = load i32, i32* %28
store i32 %29, i32* %8
%30 = load i32, i32* %6
store i32 %30, i32* %7
br label %31
31: ; preds = %53, %25
%32 = load i32, i32* %7
%33 = icmp sgt i32 %32, 0
br i1 %33, label %34, label %42
34: ; preds = %31
%35 = load i32, i32* %7
%36 = sub nsw i32 %35, 1
%37 = sext i32 %36 to i64
%38 = getelementptr inbounds [10 x i32], [10 x i32]* %9, i64 0, i64 %37
%39 = load i32, i32* %38
%40 = load i32, i32* %8
%41 = icmp sgt i32 %39, %40
br label %42
42: ; preds = %34, %31
%43 = phi i1 [ false, %31 ], [ %41, %34 ]
br i1 %43, label %44, label %56
44: ; preds = %42
%45 = load i32, i32* %7
%46 = sub nsw i32 %45, 1
%47 = sext i32 %46 to i64
%48 = getelementptr inbounds [10 x i32], [10 x i32]* %9, i64 0, i64 %47
%49 = load i32, i32* %48
%50 = load i32, i32* %7
%51 = sext i32 %50 to i64
%52 = getelementptr inbounds [10 x i32], [10 x i32]* %9, i64 0, i64 %51
store i32 %49, i32* %52
br label %53
53: ; preds = %44
%54 = load i32, i32* %7
%55 = add nsw i32 %54, -1
store i32 %55, i32* %7
br label %31
56: ; preds = %42
%57 = load i32, i32* %8
%58 = load i32, i32* %7
%59 = sext i32 %58 to i64
%60 = getelementptr inbounds [10 x i32], [10 x i32]* %9, i64 0, i64 %59
store i32 %57, i32* %60
br label %61
61: ; preds = %56
%62 = load i32, i32* %6
%63 = add nsw i32 %62, 1
store i32 %63, i32* %6
br label %22
64: ; preds = %22
store i32 0, i32* %6
br label %65
65: ; preds = %74, %64
%66 = load i32, i32* %6
%67 = icmp slt i32 %66, 10
br i1 %67, label %68, label %77
68: ; preds = %65
%69 = load i32, i32* %6
%70 = sext i32 %69 to i64
%71 = getelementptr inbounds [10 x i32], [10 x i32]* %9, i64 0, i64 %70
%72 = load i32, i32* %71
%73 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %72)
br label %74
74: ; preds = %68
%75 = load i32, i32* %6
%76 = add nsw i32 %75, 1
store i32 %76, i32* %6
br label %65
77: ; preds = %65
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@.str.1 = [4 x i8] c"%d\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 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %5)
%7 = getelementptr inbounds [10 x i32], [10 x i32]* %3, i64 0, i64 1
%8 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %7)
%9 = getelementptr inbounds [10 x i32], [10 x i32]* %3, i64 0, i64 2
%10 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %9)
%11 = getelementptr inbounds [10 x i32], [10 x i32]* %3, i64 0, i64 3
%12 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %11)
%13 = getelementptr inbounds [10 x i32], [10 x i32]* %3, i64 0, i64 4
%14 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %13)
%15 = getelementptr inbounds [10 x i32], [10 x i32]* %3, i64 0, i64 5
%16 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %15)
%17 = getelementptr inbounds [10 x i32], [10 x i32]* %3, i64 0, i64 6
%18 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %17)
%19 = getelementptr inbounds [10 x i32], [10 x i32]* %3, i64 0, i64 7
%20 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %19)
%21 = getelementptr inbounds [10 x i32], [10 x i32]* %3, i64 0, i64 8
%22 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %21)
%23 = getelementptr inbounds [10 x i32], [10 x i32]* %3, i64 0, i64 9
%24 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %23)
br label %25
25: ; preds = %2, %40
%26 = phi i64 [ 0, %2 ], [ %45, %40 ]
%27 = getelementptr inbounds [10 x i32], [10 x i32]* %3, i64 0, i64 %26
%28 = load i32, i32* %27
%29 = icmp eq i64 %26, 0
br i1 %29, label %40, label %30
30: ; preds = %25, %37
%31 = phi i64 [ %32, %37 ], [ %26, %25 ]
%32 = add nsw i64 %31, -1
%33 = and i64 %32, 4294967295
%34 = getelementptr inbounds [10 x i32], [10 x i32]* %3, i64 0, i64 %33
%35 = load i32, i32* %34
%36 = icmp sgt i32 %35, %28
br i1 %36, label %37, label %40
37: ; preds = %30
%38 = getelementptr inbounds [10 x i32], [10 x i32]* %3, i64 0, i64 %31
store i32 %35, i32* %38
%39 = icmp sgt i64 %31, 1
br i1 %39, label %30, label %40
40: ; preds = %30, %37, %25
%41 = phi i64 [ 0, %25 ], [ 0, %37 ], [ %31, %30 ]
%42 = shl i64 %41, 32
%43 = ashr exact i64 %42, 32
%44 = getelementptr inbounds [10 x i32], [10 x i32]* %3, i64 0, i64 %43
store i32 %28, i32* %44
%45 = add nuw nsw i64 %26, 1
%46 = icmp eq i64 %45, 10
br i1 %46, label %47, label %25
47: ; preds = %40
%48 = load i32, i32* %5
%49 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %48)
%50 = load i32, i32* %7
%51 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %50)
%52 = load i32, i32* %9
%53 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %52)
%54 = load i32, i32* %11
%55 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %54)
%56 = load i32, i32* %13
%57 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %56)
%58 = load i32, i32* %15
%59 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %58)
%60 = load i32, i32* %17
%61 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %60)
%62 = load i32, i32* %19
%63 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %62)
%64 = load i32, i32* %21
%65 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %64)
%66 = load i32, i32* %23
%67 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %66)
ret i32 0
}