#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*/ getchar();
int /*<<< orphan*/ printf(char *, int);
int /*<<< orphan*/ putchar(char);
int /*<<< orphan*/ puts(char *);
int main() {
  int loto[] = {10, 48, 1, 37, 6, 24};
  int c, a, b, temp;
  puts("Here is the array unsorted:*");
  for (c = 0; c < 6; c++)
    printf("%2d ", loto[c]);
  putchar('\n');
  for (a = 0; a < 6; a++)
    for (b = a + 1; b < 6; b++)
      if (loto[a] > loto[b]) {
        temp = loto[b];
        loto[b] = loto[a];
        loto[a] = temp;
      }
  puts("Here is the sorted array:");
  for (c = 0; c < 6; c++)
    printf("%2d ", loto[c]);
  putchar('\n');
  getchar();
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    0xeaa(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0xea7(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    0xea4(%rip),%rax
mov    %rax,-0x10(%rbp)
lea    0xea1(%rip),%rdi
call   1040 <puts@plt>
movl   $0x0,-0x24(%rbp)
cmpl   $0x6,-0x24(%rbp)
jge    11af <main+0x6f>
movslq -0x24(%rbp),%rax
mov    -0x20(%rbp,%rax,4),%esi
lea    0xe99(%rip),%rdi
call   1050 <printf@plt>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    1183 <main+0x43>
mov    $0xa,%edi
call   1030 <putchar@plt>
movl   $0x0,-0x28(%rbp)
cmpl   $0x6,-0x28(%rbp)
jge    123f <main+0xff>
mov    -0x28(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
cmpl   $0x6,-0x2c(%rbp)
jge    122c <main+0xec>
movslq -0x28(%rbp),%rax
mov    -0x20(%rbp,%rax,4),%eax
movslq -0x2c(%rbp),%rcx
cmp    -0x20(%rbp,%rcx,4),%eax
jle    1219 <main+0xd9>
movslq -0x2c(%rbp),%rax
mov    -0x20(%rbp,%rax,4),%eax
mov    %eax,-0x30(%rbp)
movslq -0x28(%rbp),%rax
mov    -0x20(%rbp,%rax,4),%ecx
movslq -0x2c(%rbp),%rax
mov    %ecx,-0x20(%rbp,%rax,4)
mov    -0x30(%rbp),%ecx
movslq -0x28(%rbp),%rax
mov    %ecx,-0x20(%rbp,%rax,4)
jmp    121e <main+0xde>
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    11d3 <main+0x93>
jmp    1231 <main+0xf1>
mov    -0x28(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x28(%rbp)
jmp    11c0 <main+0x80>
lea    0xdf4(%rip),%rdi
call   1040 <puts@plt>
movl   $0x0,-0x24(%rbp)
cmpl   $0x6,-0x24(%rbp)
jge    127e <main+0x13e>
movslq -0x24(%rbp),%rax
mov    -0x20(%rbp,%rax,4),%esi
lea    0xdca(%rip),%rdi
call   1050 <printf@plt>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    1252 <main+0x112>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    $0x0,%al
call   1060 <getchar@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
lea    0xeb8(%rip),%rdi
call   1040 <puts@plt>
lea    0xec9(%rip),%rbx
mov    %rbx,%rdi
mov    $0xa,%esi
call   1050 <printf@plt>
mov    %rbx,%rdi
mov    $0x30,%esi
call   1050 <printf@plt>
mov    %rbx,%rdi
mov    $0x1,%esi
call   1050 <printf@plt>
mov    %rbx,%rdi
mov    $0x25,%esi
call   1050 <printf@plt>
mov    %rbx,%rdi
mov    $0x6,%esi
call   1050 <printf@plt>
mov    %rbx,%rdi
mov    $0x18,%esi
call   1050 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0xe6f(%rip),%rdi
call   1040 <puts@plt>
mov    %rbx,%rdi
mov    $0x1,%esi
call   1050 <printf@plt>
mov    %rbx,%rdi
mov    $0x6,%esi
call   1050 <printf@plt>
mov    %rbx,%rdi
mov    $0xa,%esi
call   1050 <printf@plt>
mov    %rbx,%rdi
mov    $0x18,%esi
call   1050 <printf@plt>
mov    %rbx,%rdi
mov    $0x25,%esi
call   1050 <printf@plt>
mov    %rbx,%rdi
mov    $0x30,%esi
call   1050 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
call   1060 <getchar@plt>
xor    %eax,%eax
pop    %rbx
ret

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

LLVM IR (-O2):
@.str = [29 x i8] c"Here is the array unsorted:*\00"
@.str.1 = [5 x i8] c"%2d \00"
@.str.2 = [26 x i8] c"Here is the sorted array:\00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 10)
%3 = tail call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 48)
%4 = tail call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 1)
%5 = tail call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 37)
%6 = tail call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 6)
%7 = tail call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 24)
%8 = tail call i32 @putchar(i8 signext 10)
%9 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @.str.2, i64 0, i64 0))
%10 = tail call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 1)
%11 = tail call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 6)
%12 = tail call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 10)
%13 = tail call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 24)
%14 = tail call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 37)
%15 = tail call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 48)
%16 = tail call i32 @putchar(i8 signext 10)
%17 = tail call i32 (...) @getchar()
ret i32 0
}