#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 /*<<< orphan*/ scanf(char *, int *);
void main() {
  int a[10];
  int i, j, k, t;
  printf("Please input 10numbes: \n");
  for (i = 0; i < 10; i++)
    scanf("%d", &a[i]);
  printf("\n");
  for (j = 0; j < 9; j++) {
    for (k = 0; k < 9 - j; k++)
      if (a[k] > a[k + 1]) {
        t = a[k];
        a[k] = a[k + 1];
        a[k + 1] = t;
      }
  }
  printf("The sorted numbers :\n");
  for (i = 0; i < 10; i++)
    printf("%d ", a[i]);
  printf("\n");
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
lea    0xed1(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x34(%rbp)
cmpl   $0xa,-0x34(%rbp)
jge    1170 <main+0x50>
movslq -0x34(%rbp),%rax
lea    -0x30(%rbp),%rsi
shl    $0x2,%rax
add    %rax,%rsi
lea    0xebc(%rip),%rdi
call   1040 <scanf@plt>
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    113d <main+0x1d>
lea    0xea0(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x38(%rbp)
cmpl   $0x9,-0x38(%rbp)
jge    1218 <main+0xf8>
movl   $0x0,-0x3c(%rbp)
mov    -0x3c(%rbp),%eax
mov    $0x9,%ecx
sub    -0x38(%rbp),%ecx
cmp    %ecx,%eax
jge    1205 <main+0xe5>
movslq -0x3c(%rbp),%rax
mov    -0x30(%rbp,%rax,4),%eax
mov    -0x3c(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
cmp    -0x30(%rbp,%rcx,4),%eax
jle    11f2 <main+0xd2>
movslq -0x3c(%rbp),%rax
mov    -0x30(%rbp,%rax,4),%eax
mov    %eax,-0x40(%rbp)
mov    -0x3c(%rbp),%eax
add    $0x1,%eax
cltq
mov    -0x30(%rbp,%rax,4),%ecx
movslq -0x3c(%rbp),%rax
mov    %ecx,-0x30(%rbp,%rax,4)
mov    -0x40(%rbp),%ecx
mov    -0x3c(%rbp),%eax
add    $0x1,%eax
cltq
mov    %ecx,-0x30(%rbp,%rax,4)
jmp    11f7 <main+0xd7>
mov    -0x3c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x3c(%rbp)
jmp    1196 <main+0x76>
jmp    120a <main+0xea>
mov    -0x38(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x38(%rbp)
jmp    1185 <main+0x65>
lea    0xdfd(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x34(%rbp)
cmpl   $0xa,-0x34(%rbp)
jge    125b <main+0x13b>
movslq -0x34(%rbp),%rax
mov    -0x30(%rbp,%rax,4),%esi
lea    0xdec(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    122d <main+0x10d>
lea    0xdb5(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x30,%rsp
lea    0xebb(%rip),%rdi
call   1040 <puts@plt>
lea    0xea8(%rip),%rbx
mov    %rsp,%rsi
mov    %rbx,%rdi
call   1060 <scanf@plt>
lea    0x4(%rsp),%rsi
mov    %rbx,%rdi
call   1060 <scanf@plt>
lea    0x8(%rsp),%rsi
mov    %rbx,%rdi
call   1060 <scanf@plt>
lea    0xc(%rsp),%rsi
mov    %rbx,%rdi
call   1060 <scanf@plt>
lea    0x10(%rsp),%rsi
mov    %rbx,%rdi
call   1060 <scanf@plt>
lea    0x14(%rsp),%rsi
mov    %rbx,%rdi
call   1060 <scanf@plt>
lea    0x18(%rsp),%rsi
mov    %rbx,%rdi
call   1060 <scanf@plt>
lea    0x1c(%rsp),%rsi
mov    %rbx,%rdi
call   1060 <scanf@plt>
lea    0x20(%rsp),%rsi
mov    %rbx,%rdi
call   1060 <scanf@plt>
lea    0x24(%rsp),%rsi
mov    %rbx,%rdi
call   1060 <scanf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    $0x9,%r8d
xor    %ecx,%ecx
jmp    11fd <main+0xbd>
nopl   0x0(%rax)
add    $0x1,%rcx
add    $0xffffffffffffffff,%r8
cmp    $0x9,%ecx
je     1272 <main+0x132>
mov    (%rsp),%eax
cmp    $0x8,%rcx
jne    1220 <main+0xe0>
xor    %ebx,%ebx
test   $0x1,%r8b
je     11f0 <main+0xb0>
mov    0x4(%rsp,%rbx,4),%edx
cmp    %edx,%eax
jle    11f0 <main+0xb0>
mov    %edx,(%rsp,%rbx,4)
mov    %eax,0x4(%rsp,%rbx,4)
jmp    11f0 <main+0xb0>
nop
mov    %r8,%rsi
and    $0xfffffffffffffffe,%rsi
xor    %edi,%edi
jmp    1240 <main+0x100>
nopl   0x0(%rax,%rax,1)
mov    %edx,0x4(%rsp,%rdi,4)
mov    %eax,0x8(%rsp,%rdi,4)
mov    %rbx,%rdi
cmp    %rbx,%rsi
je     1208 <main+0xc8>
mov    0x4(%rsp,%rdi,4),%edx
cmp    %edx,%eax
jle    1260 <main+0x120>
mov    %edx,(%rsp,%rdi,4)
mov    %eax,0x4(%rsp,%rdi,4)
jmp    1262 <main+0x122>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    %edx,%eax
lea    0x2(%rdi),%rbx
mov    0x8(%rsp,%rdi,4),%edx
cmp    %edx,%eax
jg     1230 <main+0xf0>
mov    %edx,%eax
jmp    1238 <main+0xf8>
lea    0xda6(%rip),%rdi
call   1040 <puts@plt>
mov    (%rsp),%esi
lea    0xd7b(%rip),%rbx
mov    %rbx,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x4(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x8(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0xc(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x10(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x14(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x18(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x1c(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x20(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x24(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
add    $0x30,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [25 x i8] c"Please input 10numbes: \0A\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [2 x i8] c"\0A\00"
@.str.3 = [22 x i8] c"The sorted numbers :\0A\00"
@.str.4 = [4 x i8] c"%d \00"
define void @main() {
%1 = alloca [10 x i32]
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0))
store i32 0, i32* %2
br label %7
7: ; preds = %15, %0
%8 = load i32, i32* %2
%9 = icmp slt i32 %8, 10
br i1 %9, label %10, label %18
10: ; preds = %7
%11 = load i32, i32* %2
%12 = sext i32 %11 to i64
%13 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 %12
%14 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %13)
br label %15
15: ; preds = %10
%16 = load i32, i32* %2
%17 = add nsw i32 %16, 1
store i32 %17, i32* %2
br label %7
18: ; preds = %7
%19 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
store i32 0, i32* %3
br label %20
20: ; preds = %63, %18
%21 = load i32, i32* %3
%22 = icmp slt i32 %21, 9
br i1 %22, label %23, label %66
23: ; preds = %20
store i32 0, i32* %4
br label %24
24: ; preds = %59, %23
%25 = load i32, i32* %4
%26 = load i32, i32* %3
%27 = sub nsw i32 9, %26
%28 = icmp slt i32 %25, %27
br i1 %28, label %29, label %62
29: ; preds = %24
%30 = load i32, i32* %4
%31 = sext i32 %30 to i64
%32 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 %31
%33 = load i32, i32* %32
%34 = load i32, i32* %4
%35 = add nsw i32 %34, 1
%36 = sext i32 %35 to i64
%37 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 %36
%38 = load i32, i32* %37
%39 = icmp sgt i32 %33, %38
br i1 %39, label %40, label %58
40: ; preds = %29
%41 = load i32, i32* %4
%42 = sext i32 %41 to i64
%43 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 %42
%44 = load i32, i32* %43
store i32 %44, i32* %5
%45 = load i32, i32* %4
%46 = add nsw i32 %45, 1
%47 = sext i32 %46 to i64
%48 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 %47
%49 = load i32, i32* %48
%50 = load i32, i32* %4
%51 = sext i32 %50 to i64
%52 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 %51
store i32 %49, i32* %52
%53 = load i32, i32* %5
%54 = load i32, i32* %4
%55 = add nsw i32 %54, 1
%56 = sext i32 %55 to i64
%57 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 %56
store i32 %53, i32* %57
br label %58
58: ; preds = %40, %29
br label %59
59: ; preds = %58
%60 = load i32, i32* %4
%61 = add nsw i32 %60, 1
store i32 %61, i32* %4
br label %24
62: ; preds = %24
br label %63
63: ; preds = %62
%64 = load i32, i32* %3
%65 = add nsw i32 %64, 1
store i32 %65, i32* %3
br label %20
66: ; preds = %20
%67 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.3, i64 0, i64 0))
store i32 0, i32* %2
br label %68
68: ; preds = %77, %66
%69 = load i32, i32* %2
%70 = icmp slt i32 %69, 10
br i1 %70, label %71, label %80
71: ; preds = %68
%72 = load i32, i32* %2
%73 = sext i32 %72 to i64
%74 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 %73
%75 = load i32, i32* %74
%76 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), i32 %75)
br label %77
77: ; preds = %71
%78 = load i32, i32* %2
%79 = add nsw i32 %78, 1
store i32 %79, i32* %2
br label %68
80: ; preds = %68
%81 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str.1 = [3 x i8] c"%d\00"
@.str.4 = [4 x i8] c"%d \00"
@str = [24 x i8] c"Please input 10numbes: \00"
@str.5 = [21 x i8] c"The sorted numbers :\00"
define void @main() {
%1 = alloca [10 x i32]
%2 = bitcast [10 x i32]* %1 to i8*
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @str, i64 0, i64 0))
%4 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 0
%5 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %4)
%6 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 1
%7 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %6)
%8 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 2
%9 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %8)
%10 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 3
%11 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %10)
%12 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 4
%13 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %12)
%14 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 5
%15 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %14)
%16 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 6
%17 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %16)
%18 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 7
%19 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %18)
%20 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 8
%21 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %20)
%22 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 9
%23 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %22)
%24 = call i32 @putchar(i32 10)
br label %25
25: ; preds = %67, %0
%26 = phi i64 [ %71, %67 ], [ 0, %0 ]
%27 = phi i64 [ %69, %67 ], [ 9, %0 ]
%28 = phi i32 [ %68, %67 ], [ 0, %0 ]
%29 = load i32, i32* %4
%30 = and i64 %27, 1
%31 = icmp eq i64 %26, 8
br i1 %31, label %56, label %32
32: ; preds = %25
%33 = and i64 %27, -2
br label %34
34: ; preds = %52, %32
%35 = phi i32 [ %29, %32 ], [ %53, %52 ]
%36 = phi i64 [ 0, %32 ], [ %46, %52 ]
%37 = phi i64 [ 0, %32 ], [ %54, %52 ]
%38 = or i64 %36, 1
%39 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 %38
%40 = load i32, i32* %39
%41 = icmp sgt i32 %35, %40
br i1 %41, label %42, label %44
42: ; preds = %34
%43 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 %36
store i32 %40, i32* %43
store i32 %35, i32* %39
br label %44
44: ; preds = %34, %42
%45 = phi i32 [ %40, %34 ], [ %35, %42 ]
%46 = add nuw nsw i64 %36, 2
%47 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 %46
%48 = load i32, i32* %47
%49 = icmp sgt i32 %45, %48
br i1 %49, label %50, label %52
50: ; preds = %44
%51 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 %38
store i32 %48, i32* %51
store i32 %45, i32* %47
br label %52
52: ; preds = %50, %44
%53 = phi i32 [ %48, %44 ], [ %45, %50 ]
%54 = add i64 %37, 2
%55 = icmp eq i64 %54, %33
br i1 %55, label %56, label %34
56: ; preds = %52, %25
%57 = phi i32 [ %29, %25 ], [ %53, %52 ]
%58 = phi i64 [ 0, %25 ], [ %46, %52 ]
%59 = icmp eq i64 %30, 0
br i1 %59, label %67, label %60
60: ; preds = %56
%61 = add nuw nsw i64 %58, 1
%62 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 %61
%63 = load i32, i32* %62
%64 = icmp sgt i32 %57, %63
br i1 %64, label %65, label %67
65: ; preds = %60
%66 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 %58
store i32 %63, i32* %66
store i32 %57, i32* %62
br label %67
67: ; preds = %60, %65, %56
%68 = add nuw nsw i32 %28, 1
%69 = add nsw i64 %27, -1
%70 = icmp eq i32 %68, 9
%71 = add i64 %26, 1
br i1 %70, label %72, label %25
72: ; preds = %67
%73 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @str.5, i64 0, i64 0))
%74 = load i32, i32* %4
%75 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), i32 %74)
%76 = load i32, i32* %6
%77 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), i32 %76)
%78 = load i32, i32* %8
%79 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), i32 %78)
%80 = load i32, i32* %10
%81 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), i32 %80)
%82 = load i32, i32* %12
%83 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), i32 %82)
%84 = load i32, i32* %14
%85 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), i32 %84)
%86 = load i32, i32* %16
%87 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), i32 %86)
%88 = load i32, i32* %18
%89 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), i32 %88)
%90 = load i32, i32* %20
%91 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), i32 %90)
%92 = load i32, i32* %22
%93 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), i32 %92)
%94 = call i32 @putchar(i32 10)
ret void
}