#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() {
  int k, j, z, i[5];
  int x;
  printf("This program needs 5 initial digit(s) to sort them from maximum to "
         "minimum\n\n");
  for (j = 0; j < 5; j++) {
    printf("Please enter a new number: ");
    scanf("%d", &i[j]);
    for (k = 0; k < j; k++) {
      if (i[j] < i[k]) {
        x = i[j];
        i[j] = i[k];
        i[k] = x;
      }
    }
  }
  for (z = 0; z < 5; z++)
    printf("%d  ", i[4 - z]);
  printf("\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0xc(%rbp)
cmpl   $0x5,-0xc(%rbp)
jge    11ec <main+0xcc>
lea    0xef8(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movslq -0xc(%rbp),%rax
lea    -0x30(%rbp),%rsi
shl    $0x2,%rax
add    %rax,%rsi
lea    0xef7(%rip),%rdi
call   1040 <scanf@plt>
movl   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    11d9 <main+0xb9>
movslq -0xc(%rbp),%rax
mov    -0x30(%rbp,%rax,4),%eax
movslq -0x8(%rbp),%rcx
cmp    -0x30(%rbp,%rcx,4),%eax
jge    11c6 <main+0xa6>
movslq -0xc(%rbp),%rax
mov    -0x30(%rbp,%rax,4),%eax
mov    %eax,-0x34(%rbp)
movslq -0x8(%rbp),%rax
mov    -0x30(%rbp,%rax,4),%ecx
movslq -0xc(%rbp),%rax
mov    %ecx,-0x30(%rbp,%rax,4)
mov    -0x34(%rbp),%ecx
movslq -0x8(%rbp),%rax
mov    %ecx,-0x30(%rbp,%rax,4)
jmp    11cb <main+0xab>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    117e <main+0x5e>
jmp    11de <main+0xbe>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1144 <main+0x24>
movl   $0x0,-0x10(%rbp)
cmpl   $0x5,-0x10(%rbp)
jge    1227 <main+0x107>
mov    $0x4,%eax
sub    -0x10(%rbp),%eax
cltq
mov    -0x30(%rbp,%rax,4),%esi
lea    0xe5a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    11f3 <main+0xd3>
lea    0xe1d(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x18,%rsp
lea    0xed6(%rip),%rdi
call   1040 <puts@plt>
lea    0xea6(%rip),%r14
mov    %r14,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xeb1(%rip),%rbx
mov    %rsp,%rsi
mov    %rbx,%rdi
call   1060 <scanf@plt>
mov    %r14,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0x4(%rsp),%rsi
mov    %rbx,%rdi
call   1060 <scanf@plt>
mov    (%rsp),%ecx
mov    0x4(%rsp),%eax
cmp    %ecx,%eax
jge    119f <main+0x5f>
mov    %ecx,0x4(%rsp)
mov    %eax,(%rsp)
lea    0xe5a(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0x8(%rsp),%rsi
lea    0xe63(%rip),%rdi
call   1060 <scanf@plt>
mov    (%rsp),%eax
mov    0x8(%rsp),%ecx
cmp    %eax,%ecx
jge    11d2 <main+0x92>
mov    %eax,0x8(%rsp)
mov    %ecx,(%rsp)
jmp    11d4 <main+0x94>
mov    %ecx,%eax
mov    0x4(%rsp),%ecx
cmp    %ecx,%eax
jge    11e4 <main+0xa4>
mov    %ecx,0x8(%rsp)
mov    %eax,0x4(%rsp)
lea    0xe15(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xc(%rsp),%rsi
lea    0xe1e(%rip),%rdi
call   1060 <scanf@plt>
mov    (%rsp),%eax
mov    0xc(%rsp),%ecx
cmp    %eax,%ecx
jge    1217 <main+0xd7>
mov    %eax,0xc(%rsp)
mov    %ecx,(%rsp)
jmp    1219 <main+0xd9>
mov    %ecx,%eax
mov    0x4(%rsp),%ecx
cmp    %ecx,%eax
jge    122b <main+0xeb>
mov    %ecx,0xc(%rsp)
mov    %eax,0x4(%rsp)
jmp    122d <main+0xed>
mov    %eax,%ecx
mov    0x8(%rsp),%eax
cmp    %eax,%ecx
jge    123d <main+0xfd>
mov    %eax,0xc(%rsp)
mov    %ecx,0x8(%rsp)
lea    0xdbc(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0x10(%rsp),%rsi
lea    0xdc5(%rip),%rdi
call   1060 <scanf@plt>
mov    (%rsp),%eax
mov    0x10(%rsp),%ecx
cmp    %eax,%ecx
jge    1270 <main+0x130>
mov    %eax,0x10(%rsp)
mov    %ecx,(%rsp)
jmp    1272 <main+0x132>
mov    %ecx,%eax
mov    0x4(%rsp),%ecx
cmp    %ecx,%eax
jge    1284 <main+0x144>
mov    %ecx,0x10(%rsp)
mov    %eax,0x4(%rsp)
jmp    1286 <main+0x146>
mov    %eax,%ecx
mov    0x8(%rsp),%eax
cmp    %eax,%ecx
jge    1298 <main+0x158>
mov    %eax,0x10(%rsp)
mov    %ecx,0x8(%rsp)
jmp    129a <main+0x15a>
mov    %ecx,%eax
mov    0xc(%rsp),%esi
cmp    %esi,%eax
jge    12ac <main+0x16c>
mov    %esi,0x10(%rsp)
mov    %eax,0xc(%rsp)
jmp    12ae <main+0x16e>
mov    %eax,%esi
lea    0xd6a(%rip),%rbx
mov    %rbx,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0xc(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x8(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x4(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    (%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [77 x i8] c"This program needs 5 initial digit(s) to sort them from maximum to minimum\0A\0A\00"
@.str.1 = [28 x i8] c"Please enter a new number: \00"
@.str.2 = [3 x i8] c"%d\00"
@.str.3 = [5 x i8] c"%d \00"
@.str.4 = [2 x i8] c"\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca [5 x i32]
%6 = alloca i32
store i32 0, i32* %1
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([77 x i8], [77 x i8]* @.str, i64 0, i64 0))
store i32 0, i32* %3
br label %8
8: ; preds = %52, %0
%9 = load i32, i32* %3
%10 = icmp slt i32 %9, 5
br i1 %10, label %11, label %55
11: ; preds = %8
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.1, i64 0, i64 0))
%13 = load i32, i32* %3
%14 = sext i32 %13 to i64
%15 = getelementptr inbounds [5 x i32], [5 x i32]* %5, i64 0, i64 %14
%16 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %15)
store i32 0, i32* %2
br label %17
17: ; preds = %48, %11
%18 = load i32, i32* %2
%19 = load i32, i32* %3
%20 = icmp slt i32 %18, %19
br i1 %20, label %21, label %51
21: ; preds = %17
%22 = load i32, i32* %3
%23 = sext i32 %22 to i64
%24 = getelementptr inbounds [5 x i32], [5 x i32]* %5, i64 0, i64 %23
%25 = load i32, i32* %24
%26 = load i32, i32* %2
%27 = sext i32 %26 to i64
%28 = getelementptr inbounds [5 x i32], [5 x i32]* %5, i64 0, i64 %27
%29 = load i32, i32* %28
%30 = icmp slt i32 %25, %29
br i1 %30, label %31, label %47
31: ; preds = %21
%32 = load i32, i32* %3
%33 = sext i32 %32 to i64
%34 = getelementptr inbounds [5 x i32], [5 x i32]* %5, i64 0, i64 %33
%35 = load i32, i32* %34
store i32 %35, i32* %6
%36 = load i32, i32* %2
%37 = sext i32 %36 to i64
%38 = getelementptr inbounds [5 x i32], [5 x i32]* %5, i64 0, i64 %37
%39 = load i32, i32* %38
%40 = load i32, i32* %3
%41 = sext i32 %40 to i64
%42 = getelementptr inbounds [5 x i32], [5 x i32]* %5, i64 0, i64 %41
store i32 %39, i32* %42
%43 = load i32, i32* %6
%44 = load i32, i32* %2
%45 = sext i32 %44 to i64
%46 = getelementptr inbounds [5 x i32], [5 x i32]* %5, i64 0, i64 %45
store i32 %43, i32* %46
br label %47
47: ; preds = %31, %21
br label %48
48: ; preds = %47
%49 = load i32, i32* %2
%50 = add nsw i32 %49, 1
store i32 %50, i32* %2
br label %17
51: ; preds = %17
br label %52
52: ; preds = %51
%53 = load i32, i32* %3
%54 = add nsw i32 %53, 1
store i32 %54, i32* %3
br label %8
55: ; preds = %8
store i32 0, i32* %4
br label %56
56: ; preds = %66, %55
%57 = load i32, i32* %4
%58 = icmp slt i32 %57, 5
br i1 %58, label %59, label %69
59: ; preds = %56
%60 = load i32, i32* %4
%61 = sub nsw i32 4, %60
%62 = sext i32 %61 to i64
%63 = getelementptr inbounds [5 x i32], [5 x i32]* %5, i64 0, i64 %62
%64 = load i32, i32* %63
%65 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i32 %64)
br label %66
66: ; preds = %59
%67 = load i32, i32* %4
%68 = add nsw i32 %67, 1
store i32 %68, i32* %4
br label %56
69: ; preds = %56
%70 = 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.1 = [28 x i8] c"Please enter a new number: \00"
@.str.2 = [3 x i8] c"%d\00"
@.str.3 = [5 x i8] c"%d \00"
@str = [76 x i8] c"This program needs 5 initial digit(s) to sort them from maximum to minimum\0A\00"
define i32 @main() {
%1 = alloca [5 x i32]
%2 = bitcast [5 x i32]* %1 to i8*
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([76 x i8], [76 x i8]* @str, i64 0, i64 0))
%4 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @.str.1, i64 0, i64 0))
%5 = getelementptr inbounds [5 x i32], [5 x i32]* %1, i64 0, i64 0
%6 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %5)
%7 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @.str.1, i64 0, i64 0))
%8 = getelementptr inbounds [5 x i32], [5 x i32]* %1, i64 0, i64 1
%9 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %8)
%10 = load i32, i32* %8
%11 = load i32, i32* %5
%12 = icmp slt i32 %10, %11
br i1 %12, label %13, label %14
13: ; preds = %0
store i32 %11, i32* %8
store i32 %10, i32* %5
br label %14
14: ; preds = %13, %0
%15 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @.str.1, i64 0, i64 0))
%16 = getelementptr inbounds [5 x i32], [5 x i32]* %1, i64 0, i64 2
%17 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %16)
%18 = load i32, i32* %16
%19 = load i32, i32* %5
%20 = icmp slt i32 %18, %19
br i1 %20, label %21, label %22
21: ; preds = %14
store i32 %19, i32* %16
store i32 %18, i32* %5
br label %22
22: ; preds = %21, %14
%23 = phi i32 [ %19, %21 ], [ %18, %14 ]
%24 = load i32, i32* %8
%25 = icmp slt i32 %23, %24
br i1 %25, label %26, label %27
26: ; preds = %22
store i32 %24, i32* %16
store i32 %23, i32* %8
br label %27
27: ; preds = %26, %22
%28 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @.str.1, i64 0, i64 0))
%29 = getelementptr inbounds [5 x i32], [5 x i32]* %1, i64 0, i64 3
%30 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %29)
%31 = load i32, i32* %29
%32 = load i32, i32* %5
%33 = icmp slt i32 %31, %32
br i1 %33, label %34, label %35
34: ; preds = %27
store i32 %32, i32* %29
store i32 %31, i32* %5
br label %35
35: ; preds = %34, %27
%36 = phi i32 [ %32, %34 ], [ %31, %27 ]
%37 = load i32, i32* %8
%38 = icmp slt i32 %36, %37
br i1 %38, label %39, label %40
39: ; preds = %35
store i32 %37, i32* %29
store i32 %36, i32* %8
br label %40
40: ; preds = %39, %35
%41 = phi i32 [ %37, %39 ], [ %36, %35 ]
%42 = load i32, i32* %16
%43 = icmp slt i32 %41, %42
br i1 %43, label %44, label %45
44: ; preds = %40
store i32 %42, i32* %29
store i32 %41, i32* %16
br label %45
45: ; preds = %44, %40
%46 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @.str.1, i64 0, i64 0))
%47 = getelementptr inbounds [5 x i32], [5 x i32]* %1, i64 0, i64 4
%48 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %47)
%49 = load i32, i32* %47
%50 = load i32, i32* %5
%51 = icmp slt i32 %49, %50
br i1 %51, label %52, label %53
52: ; preds = %45
store i32 %50, i32* %47
store i32 %49, i32* %5
br label %53
53: ; preds = %52, %45
%54 = phi i32 [ %50, %52 ], [ %49, %45 ]
%55 = load i32, i32* %8
%56 = icmp slt i32 %54, %55
br i1 %56, label %57, label %58
57: ; preds = %53
store i32 %55, i32* %47
store i32 %54, i32* %8
br label %58
58: ; preds = %57, %53
%59 = phi i32 [ %55, %57 ], [ %54, %53 ]
%60 = load i32, i32* %16
%61 = icmp slt i32 %59, %60
br i1 %61, label %62, label %63
62: ; preds = %58
store i32 %60, i32* %47
store i32 %59, i32* %16
br label %63
63: ; preds = %62, %58
%64 = phi i32 [ %60, %62 ], [ %59, %58 ]
%65 = load i32, i32* %29
%66 = icmp slt i32 %64, %65
br i1 %66, label %67, label %68
67: ; preds = %63
store i32 %65, i32* %47
store i32 %64, i32* %29
br label %68
68: ; preds = %63, %67
%69 = phi i32 [ %65, %67 ], [ %64, %63 ]
%70 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i32 %69)
%71 = load i32, i32* %29
%72 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i32 %71)
%73 = load i32, i32* %16
%74 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i32 %73)
%75 = load i32, i32* %8
%76 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i32 %75)
%77 = load i32, i32* %5
%78 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i32 %77)
%79 = call i32 @putchar(i32 10)
ret i32 0
}