#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 rand();
int main(int argc, char *argv[]) {
  int n = 10, i, j, a[10];
  int temp = 0;
  for (i = 0; i < n; i++)
    a[i] = rand() % 100;
  for (i = 0; i < n - 1; i++)
    for (j = 0; j < n - i - 1; j++)
      if (a[j] > a[j + 1]) {
        temp = a[j];
        a[j] = a[j + 1];
        a[j + 1] = temp;
      }
  for (i = 0; i < n; i++)
    printf("%d\t", 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   $0xa,-0x14(%rbp)
movl   $0x0,-0x54(%rbp)
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    117c <main+0x5c>
mov    $0x0,%al
call   1040 <rand@plt>
mov    $0x64,%ecx
cltd
idiv   %ecx
movslq -0x18(%rbp),%rax
mov    %edx,-0x50(%rbp,%rax,4)
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    114b <main+0x2b>
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
mov    -0x14(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jge    121e <main+0xfe>
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
mov    -0x14(%rbp),%ecx
sub    -0x18(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jge    120b <main+0xeb>
movslq -0x1c(%rbp),%rax
mov    -0x50(%rbp,%rax,4),%eax
mov    -0x1c(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
cmp    -0x50(%rbp,%rcx,4),%eax
jle    11f8 <main+0xd8>
movslq -0x1c(%rbp),%rax
mov    -0x50(%rbp,%rax,4),%eax
mov    %eax,-0x54(%rbp)
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
cltq
mov    -0x50(%rbp,%rax,4),%ecx
movslq -0x1c(%rbp),%rax
mov    %ecx,-0x50(%rbp,%rax,4)
mov    -0x54(%rbp),%ecx
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
cltq
mov    %ecx,-0x50(%rbp,%rax,4)
jmp    11fd <main+0xdd>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    119b <main+0x7b>
jmp    1210 <main+0xf0>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1183 <main+0x63>
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    1253 <main+0x133>
movslq -0x18(%rbp),%rax
mov    -0x50(%rbp,%rax,4),%esi
lea    0xdc0(%rip),%rdi
call   1030 <printf@plt>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1225 <main+0x105>
xor    %eax,%eax
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x28,%rsp
xor    %r14d,%r14d
xor    %eax,%eax
call   1040 <rand@plt>
cltq
imul   $0x51eb851f,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
shr    $0x20,%rcx
sar    $0x5,%ecx
add    %edx,%ecx
imul   $0x64,%ecx,%ecx
sub    %ecx,%eax
mov    %eax,(%rsp)
xor    %eax,%eax
call   1040 <rand@plt>
cltq
imul   $0x51eb851f,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
shr    $0x20,%rcx
sar    $0x5,%ecx
add    %edx,%ecx
imul   $0x64,%ecx,%ecx
sub    %ecx,%eax
mov    %eax,0x4(%rsp)
xor    %eax,%eax
call   1040 <rand@plt>
cltq
imul   $0x51eb851f,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
shr    $0x20,%rcx
sar    $0x5,%ecx
add    %edx,%ecx
imul   $0x64,%ecx,%ecx
sub    %ecx,%eax
mov    %eax,0x8(%rsp)
xor    %eax,%eax
call   1040 <rand@plt>
cltq
imul   $0x51eb851f,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
shr    $0x20,%rcx
sar    $0x5,%ecx
add    %edx,%ecx
imul   $0x64,%ecx,%ecx
sub    %ecx,%eax
mov    %eax,0xc(%rsp)
xor    %eax,%eax
call   1040 <rand@plt>
cltq
imul   $0x51eb851f,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
shr    $0x20,%rcx
sar    $0x5,%ecx
add    %edx,%ecx
imul   $0x64,%ecx,%ecx
sub    %ecx,%eax
mov    %eax,0x10(%rsp)
xor    %eax,%eax
call   1040 <rand@plt>
cltq
imul   $0x51eb851f,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
shr    $0x20,%rcx
sar    $0x5,%ecx
add    %edx,%ecx
imul   $0x64,%ecx,%ecx
sub    %ecx,%eax
mov    %eax,0x14(%rsp)
xor    %eax,%eax
call   1040 <rand@plt>
cltq
imul   $0x51eb851f,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
shr    $0x20,%rcx
sar    $0x5,%ecx
add    %edx,%ecx
imul   $0x64,%ecx,%ecx
sub    %ecx,%eax
mov    %eax,0x18(%rsp)
xor    %eax,%eax
call   1040 <rand@plt>
cltq
imul   $0x51eb851f,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
shr    $0x20,%rcx
sar    $0x5,%ecx
add    %edx,%ecx
imul   $0x64,%ecx,%ecx
sub    %ecx,%eax
mov    %eax,0x1c(%rsp)
xor    %eax,%eax
call   1040 <rand@plt>
cltq
imul   $0x51eb851f,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
shr    $0x20,%rcx
sar    $0x5,%ecx
add    %edx,%ecx
imul   $0x64,%ecx,%ecx
sub    %ecx,%eax
mov    %eax,0x20(%rsp)
xor    %eax,%eax
call   1040 <rand@plt>
cltq
imul   $0x51eb851f,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
shr    $0x20,%rcx
sar    $0x5,%ecx
add    %edx,%ecx
imul   $0x64,%ecx,%ecx
sub    %ecx,%eax
mov    %eax,0x24(%rsp)
mov    $0x9,%eax
jmp    12de <main+0x1be>
nopw   0x0(%rax,%rax,1)
add    $0x1,%r14
add    $0xffffffffffffffff,%rax
cmp    $0x9,%r14d
je     1352 <main+0x232>
mov    (%rsp),%ebx
cmp    $0x8,%r14
jne    1300 <main+0x1e0>
xor    %esi,%esi
test   $0x1,%al
je     12d0 <main+0x1b0>
mov    0x4(%rsp,%rsi,4),%ecx
cmp    %ecx,%ebx
jle    12d0 <main+0x1b0>
mov    %ecx,(%rsp,%rsi,4)
mov    %ebx,0x4(%rsp,%rsi,4)
jmp    12d0 <main+0x1b0>
xchg   %ax,%ax
mov    %rax,%rdx
and    $0xfffffffffffffffe,%rdx
xor    %edi,%edi
jmp    1320 <main+0x200>
nopl   0x0(%rax,%rax,1)
mov    %ecx,0x4(%rsp,%rdi,4)
mov    %ebx,0x8(%rsp,%rdi,4)
mov    %rsi,%rdi
cmp    %rsi,%rdx
je     12e9 <main+0x1c9>
mov    0x4(%rsp,%rdi,4),%esi
cmp    %esi,%ebx
jle    1340 <main+0x220>
mov    %esi,(%rsp,%rdi,4)
mov    %ebx,0x4(%rsp,%rdi,4)
jmp    1342 <main+0x222>
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     1310 <main+0x1f0>
mov    %ecx,%ebx
jmp    1318 <main+0x1f8>
mov    (%rsp),%esi
lea    0xca4(%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    $0x28,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
@.str = [4 x i8] c"%d\09\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca [10 x i32]
%4 = bitcast [10 x i32]* %3 to i8*
%5 = tail call i32 (...) @rand()
%6 = srem i32 %5, 100
%7 = getelementptr inbounds [10 x i32], [10 x i32]* %3, 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]* %3, 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]* %3, 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]* %3, 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]* %3, 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]* %3, 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]* %3, 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]* %3, 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]* %3, 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]* %3, i64 0, i64 9
store i32 %33, i32* %34
br label %35
35: ; preds = %77, %2
%36 = phi i64 [ %81, %77 ], [ 0, %2 ]
%37 = phi i64 [ %79, %77 ], [ 9, %2 ]
%38 = phi i32 [ %78, %77 ], [ 0, %2 ]
%39 = load i32, i32* %7
%40 = and i64 %37, 1
%41 = icmp eq i64 %36, 8
br i1 %41, label %66, label %42
42: ; preds = %35
%43 = and i64 %37, -2
br label %44
44: ; preds = %62, %42
%45 = phi i32 [ %39, %42 ], [ %63, %62 ]
%46 = phi i64 [ 0, %42 ], [ %56, %62 ]
%47 = phi i64 [ 0, %42 ], [ %64, %62 ]
%48 = or i64 %46, 1
%49 = getelementptr inbounds [10 x i32], [10 x i32]* %3, i64 0, i64 %48
%50 = load i32, i32* %49
%51 = icmp sgt i32 %45, %50
br i1 %51, label %52, label %54
52: ; preds = %44
%53 = getelementptr inbounds [10 x i32], [10 x i32]* %3, i64 0, i64 %46
store i32 %50, i32* %53
store i32 %45, i32* %49
br label %54
54: ; preds = %44, %52
%55 = phi i32 [ %50, %44 ], [ %45, %52 ]
%56 = add nuw nsw i64 %46, 2
%57 = getelementptr inbounds [10 x i32], [10 x i32]* %3, i64 0, i64 %56
%58 = load i32, i32* %57
%59 = icmp sgt i32 %55, %58
br i1 %59, label %60, label %62
60: ; preds = %54
%61 = getelementptr inbounds [10 x i32], [10 x i32]* %3, i64 0, i64 %48
store i32 %58, i32* %61
store i32 %55, i32* %57
br label %62
62: ; preds = %60, %54
%63 = phi i32 [ %58, %54 ], [ %55, %60 ]
%64 = add i64 %47, 2
%65 = icmp eq i64 %64, %43
br i1 %65, label %66, label %44
66: ; preds = %62, %35
%67 = phi i32 [ %39, %35 ], [ %63, %62 ]
%68 = phi i64 [ 0, %35 ], [ %56, %62 ]
%69 = icmp eq i64 %40, 0
br i1 %69, label %77, label %70
70: ; preds = %66
%71 = add nuw nsw i64 %68, 1
%72 = getelementptr inbounds [10 x i32], [10 x i32]* %3, i64 0, i64 %71
%73 = load i32, i32* %72
%74 = icmp sgt i32 %67, %73
br i1 %74, label %75, label %77
75: ; preds = %70
%76 = getelementptr inbounds [10 x i32], [10 x i32]* %3, i64 0, i64 %68
store i32 %73, i32* %76
store i32 %67, i32* %72
br label %77
77: ; preds = %70, %75, %66
%78 = add nuw nsw i32 %38, 1
%79 = add nsw i64 %37, -1
%80 = icmp eq i32 %78, 9
%81 = add i64 %36, 1
br i1 %80, label %82, label %35
82: ; preds = %77
%83 = load i32, i32* %7
%84 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %83)
%85 = load i32, i32* %10
%86 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %85)
%87 = load i32, i32* %13
%88 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %87)
%89 = load i32, i32* %16
%90 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %89)
%91 = load i32, i32* %19
%92 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %91)
%93 = load i32, i32* %22
%94 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %93)
%95 = load i32, i32* %25
%96 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %95)
%97 = load i32, i32* %28
%98 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %97)
%99 = load i32, i32* %31
%100 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %99)
%101 = load i32, i32* %34
%102 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %101)
ret i32 0
}