int main() {
  int a[50] = {50, 49, 48, 47, 46, 45, 44, 43, 42, 41, 40, 39, 38,
               37, 36, 35, 34, 33, 32, 31, 30, 29, 28, 27, 26, 25,
               24, 23, 22, 21, 20, 19, 18, 17, 16, 15, 14, 13, 12,
               11, 10, 9,  8,  7,  6,  5,  4,  3,  2,  1};
  int n = 50;
  int i, j;
  int iMin;
  int temp;
  for (j = 0; j < n - 1; j++) {
    iMin = j;
    for (i = j + 1; i < n; i++) {
      if (a[i] < a[iMin]) {
        iMin = i;
      }
    }
    if (iMin != j) {
      temp = a[j];
      a[j] = a[iMin];
      a[iMin] = temp;
    }
  }
  return a[49];
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xf0,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0xd0(%rbp),%rdi
lea    0xed0(%rip),%rsi
mov    $0xc8,%edx
call   1030 <memcpy@plt>
movl   $0x32,-0xd4(%rbp)
movl   $0x0,-0xdc(%rbp)
mov    -0xdc(%rbp),%eax
mov    -0xd4(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jge    1248 <main+0x138>
mov    -0xdc(%rbp),%eax
mov    %eax,-0xe0(%rbp)
mov    -0xdc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xd8(%rbp)
mov    -0xd8(%rbp),%eax
cmp    -0xd4(%rbp),%eax
jge    11d9 <main+0xc9>
movslq -0xd8(%rbp),%rax
mov    -0xd0(%rbp,%rax,4),%eax
movslq -0xe0(%rbp),%rcx
cmp    -0xd0(%rbp,%rcx,4),%eax
jge    11c0 <main+0xb0>
mov    -0xd8(%rbp),%eax
mov    %eax,-0xe0(%rbp)
jmp    11c5 <main+0xb5>
mov    -0xd8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xd8(%rbp)
jmp    1180 <main+0x70>
mov    -0xe0(%rbp),%eax
cmp    -0xdc(%rbp),%eax
je     122f <main+0x11f>
movslq -0xdc(%rbp),%rax
mov    -0xd0(%rbp,%rax,4),%eax
mov    %eax,-0xe4(%rbp)
movslq -0xe0(%rbp),%rax
mov    -0xd0(%rbp,%rax,4),%ecx
movslq -0xdc(%rbp),%rax
mov    %ecx,-0xd0(%rbp,%rax,4)
mov    -0xe4(%rbp),%ecx
movslq -0xe0(%rbp),%rax
mov    %ecx,-0xd0(%rbp,%rax,4)
jmp    1234 <main+0x124>
mov    -0xdc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xdc(%rbp)
jmp    114e <main+0x3e>
mov    -0xc(%rbp),%eax
add    $0xf0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0xc8,%rsp
lea    0xee2(%rip),%rsi
mov    %rsp,%rdi
mov    $0xc8,%edx
call   1030 <memcpy@plt>
mov    $0x1,%r10d
xor    %r8d,%r8d
jmp    114a <main+0x3a>
cs nopw 0x0(%rax,%rax,1)
add    $0x1,%r10
cmp    $0x31,%r8
je     119a <main+0x8a>
mov    %r8,%r9
add    $0x1,%r8
mov    %r10,%rsi
mov    %r9d,%edi
jmp    116c <main+0x5c>
nopl   0x0(%rax)
add    $0x1,%rsi
mov    %ecx,%edi
cmp    $0x32,%rsi
je     1180 <main+0x70>
mov    (%rsp,%rsi,4),%edx
movslq %edi,%rax
mov    %esi,%ecx
cmp    (%rsp,%rax,4),%edx
jl     1160 <main+0x50>
mov    %edi,%ecx
jmp    1160 <main+0x50>
nopl   (%rax)
mov    %ecx,%eax
cmp    %rax,%r9
je     1140 <main+0x30>
mov    (%rsp,%r9,4),%eax
movslq %ecx,%rcx
mov    (%rsp,%rcx,4),%edx
mov    %edx,(%rsp,%r9,4)
mov    %eax,(%rsp,%rcx,4)
jmp    1140 <main+0x30>
mov    0xc4(%rsp),%eax
add    $0xc8,%rsp
ret

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

LLVM IR (-O2):
@__const.main.a = [50 x i32] [i32 50, i32 49, i32 48, i32 47, i32 46, i32 45, i32 44, i32 43, i32 42, i32 41, i32 40, i32 39, i32 38, i32 37, i32 36, i32 35, i32 34, i32 33, i32 32, i32 31, i32 30, i32 29, i32 28, i32 27, i32 26, i32 25, i32 24, i32 23, i32 22, i32 21, i32 20, i32 19, i32 18, i32 17, i32 16, i32 15, i32 14, i32 13, i32 12, i32 11, i32 10, i32 9, i32 8, i32 7, i32 6, i32 5, i32 4, i32 3, i32 2, i32 1]
define i32 @main() {
%1 = alloca [50 x i32]
%2 = bitcast [50 x i32]* %1 to i8*
br label %3
3: ; preds = %30, %0
%4 = phi i64 [ 0, %0 ], [ %6, %30 ]
%5 = phi i64 [ 1, %0 ], [ %31, %30 ]
%6 = add nuw nsw i64 %4, 1
%7 = trunc i64 %4 to i32
br label %8
8: ; preds = %3, %8
%9 = phi i64 [ %5, %3 ], [ %19, %8 ]
%10 = phi i32 [ %7, %3 ], [ %18, %8 ]
%11 = getelementptr inbounds [50 x i32], [50 x i32]* %1, i64 0, i64 %9
%12 = load i32, i32* %11
%13 = sext i32 %10 to i64
%14 = getelementptr inbounds [50 x i32], [50 x i32]* %1, i64 0, i64 %13
%15 = load i32, i32* %14
%16 = icmp slt i32 %12, %15
%17 = trunc i64 %9 to i32
%18 = select i1 %16, i32 %17, i32 %10
%19 = add nuw nsw i64 %9, 1
%20 = icmp eq i64 %19, 50
br i1 %20, label %21, label %8
21: ; preds = %8
%22 = zext i32 %18 to i64
%23 = icmp eq i64 %4, %22
br i1 %23, label %30, label %24
24: ; preds = %21
%25 = getelementptr inbounds [50 x i32], [50 x i32]* %1, i64 0, i64 %4
%26 = load i32, i32* %25
%27 = sext i32 %18 to i64
%28 = getelementptr inbounds [50 x i32], [50 x i32]* %1, i64 0, i64 %27
%29 = load i32, i32* %28
store i32 %29, i32* %25
store i32 %26, i32* %28
br label %30
30: ; preds = %21, %24
%31 = add nuw nsw i64 %5, 1
%32 = icmp eq i64 %6, 49
br i1 %32, label %33, label %3
33: ; preds = %30
%34 = getelementptr inbounds [50 x i32], [50 x i32]* %1, i64 0, i64 49
%35 = load i32, i32* %34
ret i32 %35
}