#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 main() {
  int array[10] = {10, 9, 8, 7, 6, 5, 4, 3, 2, 1};
  int i, j, temp;
  for (i = 0; i < 10; i++) {
    printf("%d\t", array[i]);
  }
  printf("\n");
  for (i = 0; i < 10 - 1; i++) {
    for (j = 0; j < 10 - i - 1; j++) {
      if (array[j] > array[j + 1]) {
        temp = array[j];
        array[j] = array[j + 1];
        array[j + 1] = temp;
      }
    }
  }
  for (i = 0; i < 10; i++) {
    printf("%d\t", array[i]);
  }
  printf("\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x30(%rbp),%rdi
lea    0xec6(%rip),%rsi
mov    $0x28,%edx
call   1040 <memcpy@plt>
movl   $0x0,-0x34(%rbp)
cmpl   $0xa,-0x34(%rbp)
jge    1179 <main+0x59>
movslq -0x34(%rbp),%rax
mov    -0x30(%rbp,%rax,4),%esi
lea    0xec4(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    114b <main+0x2b>
lea    0xeac(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x34(%rbp)
cmpl   $0x9,-0x34(%rbp)
jge    1224 <main+0x104>
movl   $0x0,-0x38(%rbp)
mov    -0x38(%rbp),%eax
mov    $0xa,%ecx
sub    -0x34(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jge    1211 <main+0xf1>
movslq -0x38(%rbp),%rax
mov    -0x30(%rbp,%rax,4),%eax
mov    -0x38(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
cmp    -0x30(%rbp,%rcx,4),%eax
jle    11fe <main+0xde>
movslq -0x38(%rbp),%rax
mov    -0x30(%rbp,%rax,4),%eax
mov    %eax,-0x3c(%rbp)
mov    -0x38(%rbp),%eax
add    $0x1,%eax
cltq
mov    -0x30(%rbp,%rax,4),%ecx
movslq -0x38(%rbp),%rax
mov    %ecx,-0x30(%rbp,%rax,4)
mov    -0x3c(%rbp),%ecx
mov    -0x38(%rbp),%eax
add    $0x1,%eax
cltq
mov    %ecx,-0x30(%rbp,%rax,4)
jmp    1203 <main+0xe3>
mov    -0x38(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x38(%rbp)
jmp    119f <main+0x7f>
jmp    1216 <main+0xf6>
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    118e <main+0x6e>
movl   $0x0,-0x34(%rbp)
cmpl   $0xa,-0x34(%rbp)
jge    1259 <main+0x139>
movslq -0x34(%rbp),%rax
mov    -0x30(%rbp,%rax,4),%esi
lea    0xde4(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    122b <main+0x10b>
lea    0xdcc(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x30,%rsp
mov    0xef0(%rip),%rax
mov    %rax,0x20(%rsp)
movaps 0xed4(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movaps 0xeb8(%rip),%xmm0
movaps %xmm0,(%rsp)
lea    0xed5(%rip),%r14
xor    %r15d,%r15d
mov    %r14,%rdi
mov    $0xa,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %r14,%rdi
mov    $0x9,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %r14,%rdi
mov    $0x8,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %r14,%rdi
mov    $0x7,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %r14,%rdi
mov    $0x6,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %r14,%rdi
mov    $0x5,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %r14,%rdi
mov    $0x4,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %r14,%rdi
mov    $0x3,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %r14,%rdi
mov    $0x2,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %r14,%rdi
mov    $0x1,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    $0x9,%eax
jmp    120e <main+0xee>
nopl   (%rax)
add    $0x1,%r15
add    $0xffffffffffffffff,%rax
cmp    $0x9,%r15d
je     1282 <main+0x162>
mov    (%rsp),%ebx
cmp    $0x8,%r15
jne    1230 <main+0x110>
xor    %esi,%esi
test   $0x1,%al
je     1200 <main+0xe0>
mov    0x4(%rsp,%rsi,4),%ecx
cmp    %ecx,%ebx
jle    1200 <main+0xe0>
mov    %ecx,(%rsp,%rsi,4)
mov    %ebx,0x4(%rsp,%rsi,4)
jmp    1200 <main+0xe0>
xchg   %ax,%ax
mov    %rax,%rdx
and    $0xfffffffffffffffe,%rdx
xor    %edi,%edi
jmp    1250 <main+0x130>
nopl   0x0(%rax,%rax,1)
mov    %ecx,0x4(%rsp,%rdi,4)
mov    %ebx,0x8(%rsp,%rdi,4)
mov    %rsi,%rdi
cmp    %rsi,%rdx
je     1219 <main+0xf9>
mov    0x4(%rsp,%rdi,4),%esi
cmp    %esi,%ebx
jle    1270 <main+0x150>
mov    %esi,(%rsp,%rdi,4)
mov    %ebx,0x4(%rsp,%rdi,4)
jmp    1272 <main+0x152>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    %esi,%ebx
lea    0x2(%rdi),%rsi
mov    0x8(%rsp,%rdi,4),%ecx
cmp    %ecx,%ebx
jg     1240 <main+0x120>
mov    %ecx,%ebx
jmp    1248 <main+0x128>
mov    (%rsp),%esi
lea    0xd9c(%rip),%rbx
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x4(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x8(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0xc(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x10(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x14(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x18(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x1c(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x20(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x24(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

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

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