#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*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ print(int *, int);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, int *);
int main() {
  int arr[10];
  int i, j, k;
  printf("Enter %d number:\n", 10);
  for (i = 0; i < 10; i++) {
    scanf("%d", &arr[i]);
  }
  printf("- - -\n");
  for (i = 0; i < 10; i++) {
    print(arr, 10);
    k = 0;
    for (j = 1; j < 10 - i; j++) {
      if (arr[j - 1] - arr[j] > 0) {
        k++;
        arr[j - 1] = arr[j - 1] + arr[j];
        arr[j] = arr[j - 1] - arr[j];
        arr[j - 1] = arr[j - 1] - arr[j];
      }
    }
    if (k == 0) {
      break;
    }
  }
  print(arr, 10);
  exit(0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeaa(%rip),%rdi
mov    $0xa,%esi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x34(%rbp)
cmpl   $0xa,-0x34(%rbp)
jge    119c <main+0x5c>
movslq -0x34(%rbp),%rax
lea    -0x30(%rbp),%rsi
shl    $0x2,%rax
add    %rax,%rsi
lea    0xe89(%rip),%rdi
call   1050 <scanf@plt>
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    1169 <main+0x29>
lea    0xe72(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x34(%rbp)
cmpl   $0xa,-0x34(%rbp)
jge    12a1 <main+0x161>
lea    -0x30(%rbp),%rdi
mov    $0xa,%esi
call   1040 <print@plt>
movl   $0x0,-0x3c(%rbp)
movl   $0x1,-0x38(%rbp)
mov    -0x38(%rbp),%eax
mov    $0xa,%ecx
sub    -0x34(%rbp),%ecx
cmp    %ecx,%eax
jge    127f <main+0x13f>
mov    -0x38(%rbp),%eax
sub    $0x1,%eax
cltq
mov    -0x30(%rbp,%rax,4),%eax
movslq -0x38(%rbp),%rcx
sub    -0x30(%rbp,%rcx,4),%eax
cmp    $0x0,%eax
jle    126c <main+0x12c>
mov    -0x3c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x3c(%rbp)
mov    -0x38(%rbp),%eax
sub    $0x1,%eax
cltq
mov    -0x30(%rbp,%rax,4),%ecx
movslq -0x38(%rbp),%rax
add    -0x30(%rbp,%rax,4),%ecx
mov    -0x38(%rbp),%eax
sub    $0x1,%eax
cltq
mov    %ecx,-0x30(%rbp,%rax,4)
mov    -0x38(%rbp),%eax
sub    $0x1,%eax
cltq
mov    -0x30(%rbp,%rax,4),%ecx
movslq -0x38(%rbp),%rax
sub    -0x30(%rbp,%rax,4),%ecx
movslq -0x38(%rbp),%rax
mov    %ecx,-0x30(%rbp,%rax,4)
mov    -0x38(%rbp),%eax
sub    $0x1,%eax
cltq
mov    -0x30(%rbp,%rax,4),%ecx
movslq -0x38(%rbp),%rax
sub    -0x30(%rbp,%rax,4),%ecx
mov    -0x38(%rbp),%eax
sub    $0x1,%eax
cltq
mov    %ecx,-0x30(%rbp,%rax,4)
jmp    1271 <main+0x131>
mov    -0x38(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x38(%rbp)
jmp    11d7 <main+0x97>
cmpl   $0x0,-0x3c(%rbp)
jne    128e <main+0x14e>
jmp    12a1 <main+0x161>
jmp    1293 <main+0x153>
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    11b1 <main+0x71>
lea    -0x30(%rbp),%rdi
mov    $0xa,%esi
call   1040 <print@plt>
xor    %edi,%edi
call   1060 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x30,%rsp
lea    0xea0(%rip),%rdi
xor    %ebx,%ebx
mov    $0xa,%esi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xe9d(%rip),%r14
mov    %rsp,%r15
mov    %r14,%rdi
mov    %r15,%rsi
call   1060 <scanf@plt>
lea    0x4(%rsp),%rsi
mov    %r14,%rdi
call   1060 <scanf@plt>
lea    0x8(%rsp),%rsi
mov    %r14,%rdi
call   1060 <scanf@plt>
lea    0xc(%rsp),%rsi
mov    %r14,%rdi
call   1060 <scanf@plt>
lea    0x10(%rsp),%rsi
mov    %r14,%rdi
call   1060 <scanf@plt>
lea    0x14(%rsp),%rsi
mov    %r14,%rdi
call   1060 <scanf@plt>
lea    0x18(%rsp),%rsi
mov    %r14,%rdi
call   1060 <scanf@plt>
lea    0x1c(%rsp),%rsi
mov    %r14,%rdi
call   1060 <scanf@plt>
lea    0x20(%rsp),%rsi
mov    %r14,%rdi
call   1060 <scanf@plt>
lea    0x24(%rsp),%rsi
mov    %r14,%rdi
call   1060 <scanf@plt>
lea    0xe16(%rip),%rdi
call   1030 <puts@plt>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    %r15,%rdi
mov    $0xa,%esi
call   1050 <print@plt>
cmp    $0x8,%rbx
ja     126e <main+0x11e>
mov    $0xa,%eax
sub    %rbx,%rax
xor    %ecx,%ecx
mov    $0x1,%edx
mov    (%rsp),%esi
jmp    1253 <main+0x103>
nopw   0x0(%rax,%rax,1)
add    $0x1,%ecx
mov    %esi,(%rsp,%rdx,4)
mov    %edi,-0x4(%rsp,%rdx,4)
add    $0x1,%rdx
cmp    %rax,%rdx
jae    1260 <main+0x110>
mov    (%rsp,%rdx,4),%edi
cmp    %edi,%esi
jg     1240 <main+0xf0>
mov    %edi,%esi
jmp    124a <main+0xfa>
xchg   %ax,%ax
test   %ecx,%ecx
je     126e <main+0x11e>
add    $0x1,%rbx
cmp    $0xa,%rbx
jne    1210 <main+0xc0>
mov    %rsp,%rdi
mov    $0xa,%esi
call   1050 <print@plt>
xor    %edi,%edi
call   1070 <exit@plt>

LLVM IR (-O0):
@.str = [18 x i8] c"Enter %d number:\0A\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [7 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 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i32 10)
store i32 0, i32* %3
br label %7
7: ; preds = %15, %0
%8 = load i32, i32* %3
%9 = icmp slt i32 %8, 10
br i1 %9, label %10, label %18
10: ; preds = %7
%11 = load i32, i32* %3
%12 = sext i32 %11 to i64
%13 = getelementptr inbounds [10 x i32], [10 x i32]* %2, 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* %3
%17 = add nsw i32 %16, 1
store i32 %17, i32* %3
br label %7
18: ; preds = %7
%19 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0))
store i32 0, i32* %3
br label %20
20: ; preds = %96, %18
%21 = load i32, i32* %3
%22 = icmp slt i32 %21, 10
br i1 %22, label %23, label %99
23: ; preds = %20
%24 = getelementptr inbounds [10 x i32], [10 x i32]* %2, i64 0, i64 0
%25 = call i32 @print(i32* %24, i32 10)
store i32 0, i32* %5
store i32 1, i32* %4
br label %26
26: ; preds = %88, %23
%27 = load i32, i32* %4
%28 = load i32, i32* %3
%29 = sub nsw i32 10, %28
%30 = icmp slt i32 %27, %29
br i1 %30, label %31, label %91
31: ; preds = %26
%32 = load i32, i32* %4
%33 = sub nsw i32 %32, 1
%34 = sext i32 %33 to i64
%35 = getelementptr inbounds [10 x i32], [10 x i32]* %2, i64 0, i64 %34
%36 = load i32, i32* %35
%37 = load i32, i32* %4
%38 = sext i32 %37 to i64
%39 = getelementptr inbounds [10 x i32], [10 x i32]* %2, i64 0, i64 %38
%40 = load i32, i32* %39
%41 = sub nsw i32 %36, %40
%42 = icmp sgt i32 %41, 0
br i1 %42, label %43, label %87
43: ; preds = %31
%44 = load i32, i32* %5
%45 = add nsw i32 %44, 1
store i32 %45, i32* %5
%46 = load i32, i32* %4
%47 = sub nsw i32 %46, 1
%48 = sext i32 %47 to i64
%49 = getelementptr inbounds [10 x i32], [10 x i32]* %2, i64 0, i64 %48
%50 = load i32, i32* %49
%51 = load i32, i32* %4
%52 = sext i32 %51 to i64
%53 = getelementptr inbounds [10 x i32], [10 x i32]* %2, i64 0, i64 %52
%54 = load i32, i32* %53
%55 = add nsw i32 %50, %54
%56 = load i32, i32* %4
%57 = sub nsw i32 %56, 1
%58 = sext i32 %57 to i64
%59 = getelementptr inbounds [10 x i32], [10 x i32]* %2, i64 0, i64 %58
store i32 %55, i32* %59
%60 = load i32, i32* %4
%61 = sub nsw i32 %60, 1
%62 = sext i32 %61 to i64
%63 = getelementptr inbounds [10 x i32], [10 x i32]* %2, i64 0, i64 %62
%64 = load i32, i32* %63
%65 = load i32, i32* %4
%66 = sext i32 %65 to i64
%67 = getelementptr inbounds [10 x i32], [10 x i32]* %2, i64 0, i64 %66
%68 = load i32, i32* %67
%69 = sub nsw i32 %64, %68
%70 = load i32, i32* %4
%71 = sext i32 %70 to i64
%72 = getelementptr inbounds [10 x i32], [10 x i32]* %2, i64 0, i64 %71
store i32 %69, i32* %72
%73 = load i32, i32* %4
%74 = sub nsw i32 %73, 1
%75 = sext i32 %74 to i64
%76 = getelementptr inbounds [10 x i32], [10 x i32]* %2, i64 0, i64 %75
%77 = load i32, i32* %76
%78 = load i32, i32* %4
%79 = sext i32 %78 to i64
%80 = getelementptr inbounds [10 x i32], [10 x i32]* %2, i64 0, i64 %79
%81 = load i32, i32* %80
%82 = sub nsw i32 %77, %81
%83 = load i32, i32* %4
%84 = sub nsw i32 %83, 1
%85 = sext i32 %84 to i64
%86 = getelementptr inbounds [10 x i32], [10 x i32]* %2, i64 0, i64 %85
store i32 %82, i32* %86
br label %87
87: ; preds = %43, %31
br label %88
88: ; preds = %87
%89 = load i32, i32* %4
%90 = add nsw i32 %89, 1
store i32 %90, i32* %4
br label %26
91: ; preds = %26
%92 = load i32, i32* %5
%93 = icmp eq i32 %92, 0
br i1 %93, label %94, label %95
94: ; preds = %91
br label %99
95: ; preds = %91
br label %96
96: ; preds = %95
%97 = load i32, i32* %3
%98 = add nsw i32 %97, 1
store i32 %98, i32* %3
br label %20
99: ; preds = %94, %20
%100 = getelementptr inbounds [10 x i32], [10 x i32]* %2, i64 0, i64 0
%101 = call i32 @print(i32* %100, i32 10)
%102 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
@.str = [18 x i8] c"Enter %d number:\0A\00"
@.str.1 = [3 x i8] c"%d\00"
@str = [6 x i8] c"- - -\00"
define i32 @main() {
%1 = alloca [10 x i32]
%2 = bitcast [10 x i32]* %1 to i8*
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i32 10)
%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 @puts(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @str, i64 0, i64 0))
br label %25
25: ; preds = %48, %0
%26 = phi i64 [ 0, %0 ], [ %50, %48 ]
%27 = call i32 @print(i32* %4, i32 10)
%28 = sub nuw nsw i64 10, %26
%29 = icmp ult i64 %26, 9
br i1 %29, label %30, label %53
30: ; preds = %25
%31 = load i32, i32* %4
br label %32
32: ; preds = %30, %43
%33 = phi i32 [ %31, %30 ], [ %44, %43 ]
%34 = phi i64 [ 1, %30 ], [ %46, %43 ]
%35 = phi i32 [ 0, %30 ], [ %45, %43 ]
%36 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 %34
%37 = load i32, i32* %36
%38 = icmp sgt i32 %33, %37
br i1 %38, label %39, label %43
39: ; preds = %32
%40 = add nsw i64 %34, -1
%41 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 %40
%42 = add nsw i32 %35, 1
store i32 %33, i32* %36
store i32 %37, i32* %41
br label %43
43: ; preds = %32, %39
%44 = phi i32 [ %33, %39 ], [ %37, %32 ]
%45 = phi i32 [ %42, %39 ], [ %35, %32 ]
%46 = add nuw nsw i64 %34, 1
%47 = icmp ult i64 %46, %28
br i1 %47, label %32, label %48
48: ; preds = %43
%49 = icmp eq i32 %45, 0
%50 = add nuw nsw i64 %26, 1
%51 = icmp eq i64 %50, 10
%52 = select i1 %49, i1 true, i1 %51
br i1 %52, label %53, label %25
53: ; preds = %25, %48
%54 = call i32 @print(i32* %4, i32 10)
%55 = call i32 @exit(i32 0)
unreachable
}