#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 */
typedef int /*<<< orphan*/ to_be_sort;

/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
int main(int argc, char *argv[]) {
  int to_be_sort[] = {3, 2, 5, 1, 6};
  int i = 0;
  int len = sizeof(to_be_sort) / sizeof(to_be_sort[0]);
  for (; i < len; i++) {
    int j = 0;
    for (; j < i; j++) {
      if (to_be_sort[i] < to_be_sort[j]) {
        int temp = to_be_sort[j];
        to_be_sort[j] = to_be_sort[i];
        to_be_sort[i] = temp;
      }
    }
  }
  int k = 0;
  for (; k < len; k++) {
    printf("%d\n", to_be_sort[k]);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    0xed3(%rip),%rax
mov    %rax,-0x30(%rbp)
mov    0xed0(%rip),%rax
mov    %rax,-0x28(%rbp)
mov    0xece(%rip),%eax
mov    %eax,-0x20(%rbp)
movl   $0x0,-0x34(%rbp)
movl   $0x5,-0x38(%rbp)
mov    -0x34(%rbp),%eax
cmp    -0x38(%rbp),%eax
jge    11d4 <main+0xc4>
movl   $0x0,-0x3c(%rbp)
mov    -0x3c(%rbp),%eax
cmp    -0x34(%rbp),%eax
jge    11c1 <main+0xb1>
movslq -0x34(%rbp),%rax
mov    -0x30(%rbp,%rax,4),%eax
movslq -0x3c(%rbp),%rcx
cmp    -0x30(%rbp,%rcx,4),%eax
jge    11ae <main+0x9e>
movslq -0x3c(%rbp),%rax
mov    -0x30(%rbp,%rax,4),%eax
mov    %eax,-0x40(%rbp)
movslq -0x34(%rbp),%rax
mov    -0x30(%rbp,%rax,4),%ecx
movslq -0x3c(%rbp),%rax
mov    %ecx,-0x30(%rbp,%rax,4)
mov    -0x40(%rbp),%ecx
movslq -0x34(%rbp),%rax
mov    %ecx,-0x30(%rbp,%rax,4)
jmp    11b3 <main+0xa3>
mov    -0x3c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x3c(%rbp)
jmp    1166 <main+0x56>
jmp    11c6 <main+0xb6>
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    1153 <main+0x43>
movl   $0x0,-0x44(%rbp)
mov    -0x44(%rbp),%eax
cmp    -0x38(%rbp),%eax
jge    1209 <main+0xf9>
movslq -0x44(%rbp),%rax
mov    -0x30(%rbp,%rax,4),%esi
lea    0xe1e(%rip),%rdi
call   1030 <printf@plt>
mov    -0x44(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x44(%rbp)
jmp    11db <main+0xcb>
xor    %eax,%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
lea    0xee8(%rip),%rbx
mov    %rbx,%rdi
mov    $0x1,%esi
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    $0x2,%esi
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    $0x3,%esi
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    $0x5,%esi
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    $0x6,%esi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@__const.main.to_be_sort = [5 x i32] [i32 3, i32 2, i32 5, i32 1, i32 6]
@.str = [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 [5 x i32]
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%12 = bitcast [5 x i32]* %6 to i8*
store i32 0, i32* %7
store i32 5, i32* %8
br label %13
13: ; preds = %53, %2
%14 = load i32, i32* %7
%15 = load i32, i32* %8
%16 = icmp slt i32 %14, %15
br i1 %16, label %17, label %56
17: ; preds = %13
store i32 0, i32* %9
br label %18
18: ; preds = %49, %17
%19 = load i32, i32* %9
%20 = load i32, i32* %7
%21 = icmp slt i32 %19, %20
br i1 %21, label %22, label %52
22: ; preds = %18
%23 = load i32, i32* %7
%24 = sext i32 %23 to i64
%25 = getelementptr inbounds [5 x i32], [5 x i32]* %6, i64 0, i64 %24
%26 = load i32, i32* %25
%27 = load i32, i32* %9
%28 = sext i32 %27 to i64
%29 = getelementptr inbounds [5 x i32], [5 x i32]* %6, i64 0, i64 %28
%30 = load i32, i32* %29
%31 = icmp slt i32 %26, %30
br i1 %31, label %32, label %48
32: ; preds = %22
%33 = load i32, i32* %9
%34 = sext i32 %33 to i64
%35 = getelementptr inbounds [5 x i32], [5 x i32]* %6, i64 0, i64 %34
%36 = load i32, i32* %35
store i32 %36, i32* %10
%37 = load i32, i32* %7
%38 = sext i32 %37 to i64
%39 = getelementptr inbounds [5 x i32], [5 x i32]* %6, i64 0, i64 %38
%40 = load i32, i32* %39
%41 = load i32, i32* %9
%42 = sext i32 %41 to i64
%43 = getelementptr inbounds [5 x i32], [5 x i32]* %6, i64 0, i64 %42
store i32 %40, i32* %43
%44 = load i32, i32* %10
%45 = load i32, i32* %7
%46 = sext i32 %45 to i64
%47 = getelementptr inbounds [5 x i32], [5 x i32]* %6, i64 0, i64 %46
store i32 %44, i32* %47
br label %48
48: ; preds = %32, %22
br label %49
49: ; preds = %48
%50 = load i32, i32* %9
%51 = add nsw i32 %50, 1
store i32 %51, i32* %9
br label %18
52: ; preds = %18
br label %53
53: ; preds = %52
%54 = load i32, i32* %7
%55 = add nsw i32 %54, 1
store i32 %55, i32* %7
br label %13
56: ; preds = %13
store i32 0, i32* %11
br label %57
57: ; preds = %67, %56
%58 = load i32, i32* %11
%59 = load i32, i32* %8
%60 = icmp slt i32 %58, %59
br i1 %60, label %61, label %70
61: ; preds = %57
%62 = load i32, i32* %11
%63 = sext i32 %62 to i64
%64 = getelementptr inbounds [5 x i32], [5 x i32]* %6, i64 0, i64 %63
%65 = load i32, i32* %64
%66 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %65)
br label %67
67: ; preds = %61
%68 = load i32, i32* %11
%69 = add nsw i32 %68, 1
store i32 %69, i32* %11
br label %57
70: ; preds = %57
ret i32 0
}

LLVM IR (-O2):
@.str = [4 x i8] c"%d\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 1)
%4 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 2)
%5 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 3)
%6 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 5)
%7 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 6)
ret i32 0
}