#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 /*<<< orphan*/ scanf(char *, int *);
int main(void) {
  int numbers[5];
  int i, aux;
  int swapped;
  for (i = 0; i < 5; i++) {
    printf("\nEnter value #%i\n", i + 1);
    scanf("%d", &numbers[i]);
  }
  do {
    swapped = 0;
    for (i = 0; i < 4; i++)
      if (numbers[i] > numbers[i + 1]) {
        swapped = 1;
        aux = numbers[i];
        numbers[i] = numbers[i + 1];
        numbers[i + 1] = aux;
      }
  } while (swapped);
  printf("\nSorted array: ");
  for (i = 0; i < 5; i++)
    printf("%d ", numbers[i]);
  printf("\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x24(%rbp)
cmpl   $0x5,-0x24(%rbp)
jge    117d <main+0x5d>
mov    -0x24(%rbp),%esi
add    $0x1,%esi
lea    0xeb3(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movslq -0x24(%rbp),%rax
lea    -0x20(%rbp),%rsi
shl    $0x2,%rax
add    %rax,%rsi
lea    0xea8(%rip),%rdi
call   1040 <scanf@plt>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    1136 <main+0x16>
jmp    1182 <main+0x62>
movl   $0x0,-0x2c(%rbp)
movl   $0x0,-0x24(%rbp)
cmpl   $0x4,-0x24(%rbp)
jge    11fd <main+0xdd>
movslq -0x24(%rbp),%rax
mov    -0x20(%rbp,%rax,4),%eax
mov    -0x24(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
cmp    -0x20(%rbp,%rcx,4),%eax
jle    11ea <main+0xca>
movl   $0x1,-0x2c(%rbp)
movslq -0x24(%rbp),%rax
mov    -0x20(%rbp,%rax,4),%eax
mov    %eax,-0x28(%rbp)
mov    -0x24(%rbp),%eax
add    $0x1,%eax
cltq
mov    -0x20(%rbp,%rax,4),%ecx
movslq -0x24(%rbp),%rax
mov    %ecx,-0x20(%rbp,%rax,4)
mov    -0x28(%rbp),%ecx
mov    -0x24(%rbp),%eax
add    $0x1,%eax
cltq
mov    %ecx,-0x20(%rbp,%rax,4)
jmp    11ef <main+0xcf>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    1190 <main+0x70>
jmp    1202 <main+0xe2>
cmpl   $0x0,-0x2c(%rbp)
jne    1182 <main+0x62>
lea    0xe02(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x24(%rbp)
cmpl   $0x5,-0x24(%rbp)
jge    124f <main+0x12f>
movslq -0x24(%rbp),%rax
mov    -0x20(%rbp,%rax,4),%esi
lea    0xdeb(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    1221 <main+0x101>
lea    0xdba(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x18,%rsp
lea    0xec2(%rip),%r14
mov    %r14,%rdi
mov    $0x1,%esi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xebe(%rip),%rbx
mov    %rsp,%rsi
mov    %rbx,%rdi
call   1050 <scanf@plt>
mov    %r14,%rdi
mov    $0x2,%esi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0x4(%rsp),%rsi
mov    %rbx,%rdi
call   1050 <scanf@plt>
mov    %r14,%rdi
mov    $0x3,%esi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0x8(%rsp),%rsi
mov    %rbx,%rdi
call   1050 <scanf@plt>
mov    %r14,%rdi
mov    $0x4,%esi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xc(%rsp),%rsi
mov    %rbx,%rdi
call   1050 <scanf@plt>
mov    %r14,%rdi
mov    $0x5,%esi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0x10(%rsp),%rsi
mov    %rbx,%rdi
call   1050 <scanf@plt>
mov    (%rsp),%r8d
mov    0x4(%rsp),%r9d
mov    0x8(%rsp),%eax
mov    0xc(%rsp),%edi
mov    0x10(%rsp),%ecx
jmp    1207 <main+0xd7>
cs nopw 0x0(%rax,%rax,1)
mov    %ecx,0xc(%rsp)
mov    %edx,0x10(%rsp)
mov    $0x1,%ebx
mov    %edx,%esi
mov    %ecx,%edi
mov    %esi,%ecx
test   %ebx,%ebx
je     127e <main+0x14e>
cmp    %r9d,%r8d
jle    1240 <main+0x110>
mov    %r9d,(%rsp)
mov    %r8d,0x4(%rsp)
mov    $0x1,%ebx
mov    %r8d,%edx
mov    %r9d,%r8d
cmp    %eax,%edx
jg     1249 <main+0x119>
mov    %eax,%esi
mov    %edx,%r9d
cmp    %edi,%esi
jg     125f <main+0x12f>
mov    %edi,%edx
mov    %esi,%eax
cmp    %ecx,%edx
jg     11f0 <main+0xc0>
jmp    1278 <main+0x148>
nopw   0x0(%rax,%rax,1)
mov    %r9d,%edx
xor    %ebx,%ebx
cmp    %eax,%edx
jle    1224 <main+0xf4>
mov    %eax,0x4(%rsp)
mov    %edx,0x8(%rsp)
mov    $0x1,%ebx
mov    %edx,%esi
mov    %eax,%r9d
cmp    %edi,%esi
jle    122d <main+0xfd>
mov    %edi,0x8(%rsp)
mov    %esi,0xc(%rsp)
mov    $0x1,%ebx
mov    %esi,%edx
mov    %edi,%eax
cmp    %ecx,%edx
jg     11f0 <main+0xc0>
mov    %ecx,%esi
mov    %edx,%ecx
jmp    11ff <main+0xcf>
lea    0xd90(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    (%rsp),%esi
lea    0xd8f(%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    $0xa,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [18 x i8] c"\0AEnter value #%i\0A\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [16 x i8] c"\0ASorted array: \00"
@.str.3 = [4 x i8] c"%d \00"
@.str.4 = [2 x i8] c"\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [5 x i32]
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %3
br label %6
6: ; preds = %17, %0
%7 = load i32, i32* %3
%8 = icmp slt i32 %7, 5
br i1 %8, label %9, label %20
9: ; preds = %6
%10 = load i32, i32* %3
%11 = add nsw i32 %10, 1
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i32 %11)
%13 = load i32, i32* %3
%14 = sext i32 %13 to i64
%15 = getelementptr inbounds [5 x i32], [5 x i32]* %2, i64 0, i64 %14
%16 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %15)
br label %17
17: ; preds = %9
%18 = load i32, i32* %3
%19 = add nsw i32 %18, 1
store i32 %19, i32* %3
br label %6
20: ; preds = %6
br label %21
21: ; preds = %59, %20
store i32 0, i32* %5
store i32 0, i32* %3
br label %22
22: ; preds = %55, %21
%23 = load i32, i32* %3
%24 = icmp slt i32 %23, 4
br i1 %24, label %25, label %58
25: ; preds = %22
%26 = load i32, i32* %3
%27 = sext i32 %26 to i64
%28 = getelementptr inbounds [5 x i32], [5 x i32]* %2, i64 0, i64 %27
%29 = load i32, i32* %28
%30 = load i32, i32* %3
%31 = add nsw i32 %30, 1
%32 = sext i32 %31 to i64
%33 = getelementptr inbounds [5 x i32], [5 x i32]* %2, i64 0, i64 %32
%34 = load i32, i32* %33
%35 = icmp sgt i32 %29, %34
br i1 %35, label %36, label %54
36: ; preds = %25
store i32 1, i32* %5
%37 = load i32, i32* %3
%38 = sext i32 %37 to i64
%39 = getelementptr inbounds [5 x i32], [5 x i32]* %2, i64 0, i64 %38
%40 = load i32, i32* %39
store i32 %40, i32* %4
%41 = load i32, i32* %3
%42 = add nsw i32 %41, 1
%43 = sext i32 %42 to i64
%44 = getelementptr inbounds [5 x i32], [5 x i32]* %2, i64 0, i64 %43
%45 = load i32, i32* %44
%46 = load i32, i32* %3
%47 = sext i32 %46 to i64
%48 = getelementptr inbounds [5 x i32], [5 x i32]* %2, i64 0, i64 %47
store i32 %45, i32* %48
%49 = load i32, i32* %4
%50 = load i32, i32* %3
%51 = add nsw i32 %50, 1
%52 = sext i32 %51 to i64
%53 = getelementptr inbounds [5 x i32], [5 x i32]* %2, i64 0, i64 %52
store i32 %49, i32* %53
br label %54
54: ; preds = %36, %25
br label %55
55: ; preds = %54
%56 = load i32, i32* %3
%57 = add nsw i32 %56, 1
store i32 %57, i32* %3
br label %22
58: ; preds = %22
br label %59
59: ; preds = %58
%60 = load i32, i32* %5
%61 = icmp ne i32 %60, 0
br i1 %61, label %21, label %62
62: ; preds = %59
%63 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0))
store i32 0, i32* %3
br label %64
64: ; preds = %73, %62
%65 = load i32, i32* %3
%66 = icmp slt i32 %65, 5
br i1 %66, label %67, label %76
67: ; preds = %64
%68 = load i32, i32* %3
%69 = sext i32 %68 to i64
%70 = getelementptr inbounds [5 x i32], [5 x i32]* %2, i64 0, i64 %69
%71 = load i32, i32* %70
%72 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i32 %71)
br label %73
73: ; preds = %67
%74 = load i32, i32* %3
%75 = add nsw i32 %74, 1
store i32 %75, i32* %3
br label %64
76: ; preds = %64
%77 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [18 x i8] c"\0AEnter value #%i\0A\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [16 x i8] c"\0ASorted array: \00"
@.str.3 = [4 x i8] c"%d \00"
define i32 @main() {
%1 = alloca [5 x i32]
%2 = bitcast [5 x i32]* %1 to i8*
%3 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i32 1)
%4 = getelementptr inbounds [5 x i32], [5 x i32]* %1, i64 0, i64 0
%5 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %4)
%6 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i32 2)
%7 = getelementptr inbounds [5 x i32], [5 x i32]* %1, i64 0, i64 1
%8 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %7)
%9 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i32 3)
%10 = getelementptr inbounds [5 x i32], [5 x i32]* %1, i64 0, i64 2
%11 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %10)
%12 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i32 4)
%13 = getelementptr inbounds [5 x i32], [5 x i32]* %1, i64 0, i64 3
%14 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %13)
%15 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i32 5)
%16 = getelementptr inbounds [5 x i32], [5 x i32]* %1, i64 0, i64 4
%17 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %16)
%18 = load i32, i32* %4
%19 = load i32, i32* %7
%20 = load i32, i32* %10
%21 = load i32, i32* %13
%22 = load i32, i32* %16
br label %23
23: ; preds = %0, %49
%24 = phi i32 [ %22, %0 ], [ %50, %49 ]
%25 = phi i32 [ %21, %0 ], [ %51, %49 ]
%26 = phi i32 [ %20, %0 ], [ %45, %49 ]
%27 = phi i32 [ %19, %0 ], [ %39, %49 ]
%28 = phi i32 [ %18, %0 ], [ %33, %49 ]
%29 = icmp sgt i32 %28, %27
br i1 %29, label %30, label %31
30: ; preds = %23
store i32 %27, i32* %4
store i32 %28, i32* %7
br label %31
31: ; preds = %23, %30
%32 = phi i32 [ %28, %30 ], [ %27, %23 ]
%33 = phi i32 [ %27, %30 ], [ %28, %23 ]
%34 = phi i32 [ 1, %30 ], [ 0, %23 ]
%35 = icmp sgt i32 %32, %26
br i1 %35, label %36, label %37
36: ; preds = %31
store i32 %26, i32* %7
store i32 %32, i32* %10
br label %37
37: ; preds = %36, %31
%38 = phi i32 [ %32, %36 ], [ %26, %31 ]
%39 = phi i32 [ %26, %36 ], [ %32, %31 ]
%40 = phi i32 [ 1, %36 ], [ %34, %31 ]
%41 = icmp sgt i32 %38, %25
br i1 %41, label %42, label %43
42: ; preds = %37
store i32 %25, i32* %10
store i32 %38, i32* %13
br label %43
43: ; preds = %42, %37
%44 = phi i32 [ %38, %42 ], [ %25, %37 ]
%45 = phi i32 [ %25, %42 ], [ %38, %37 ]
%46 = phi i32 [ 1, %42 ], [ %40, %37 ]
%47 = icmp sgt i32 %44, %24
br i1 %47, label %48, label %49
48: ; preds = %43
store i32 %24, i32* %13
store i32 %44, i32* %16
br label %49
49: ; preds = %48, %43
%50 = phi i32 [ %44, %48 ], [ %24, %43 ]
%51 = phi i32 [ %24, %48 ], [ %44, %43 ]
%52 = phi i32 [ 1, %48 ], [ %46, %43 ]
%53 = icmp eq i32 %52, 0
br i1 %53, label %54, label %23
54: ; preds = %49
%55 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0))
%56 = load i32, i32* %4
%57 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i32 %56)
%58 = load i32, i32* %7
%59 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i32 %58)
%60 = load i32, i32* %10
%61 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i32 %60)
%62 = load i32, i32* %13
%63 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i32 %62)
%64 = load i32, i32* %16
%65 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i32 %64)
%66 = call i32 @putchar(i32 10)
ret i32 0
}