#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 LEN = 5;
  int arr[LEN];
  int i = 0;
  int min = 0, max = 0;
  printf("Please input any 5 numbers... \n");
  for (i = 0; i < LEN; i++) {
    scanf("%d", &arr[i]);
  }
  min = max = arr[0];
  for (i = 0; i < LEN; i++) {
    if (min > arr[i])
      min = arr[i];
    if (max < arr[i])
      max = arr[i];
  }
  printf("The minimum is %d and the maximum is %d\n", min, max);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x5,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    %rsp,%rcx
mov    %rcx,-0x10(%rbp)
lea    0xf(,%rax,4),%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0x30(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
movl   $0x0,-0x20(%rbp)
movl   $0x0,-0x24(%rbp)
lea    0xe87(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    11bc <main+0x9c>
mov    -0x30(%rbp),%rsi
movslq -0x1c(%rbp),%rax
shl    $0x2,%rax
add    %rax,%rsi
lea    0xe77(%rip),%rdi
call   1040 <scanf@plt>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1187 <main+0x67>
mov    -0x30(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x24(%rbp)
mov    %eax,-0x20(%rbp)
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    1232 <main+0x112>
mov    -0x30(%rbp),%rcx
mov    -0x20(%rbp),%eax
movslq -0x1c(%rbp),%rdx
cmp    (%rcx,%rdx,4),%eax
jle    11fd <main+0xdd>
mov    -0x30(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
mov    %eax,-0x20(%rbp)
mov    -0x30(%rbp),%rcx
mov    -0x24(%rbp),%eax
movslq -0x1c(%rbp),%rdx
cmp    (%rcx,%rdx,4),%eax
jge    121f <main+0xff>
mov    -0x30(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
mov    %eax,-0x24(%rbp)
jmp    1224 <main+0x104>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    11cf <main+0xaf>
mov    -0x20(%rbp),%esi
mov    -0x24(%rbp),%edx
lea    0xde4(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,%rsp
mov    -0x4(%rbp),%eax
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x20,%rsp
lea    0xef0(%rip),%rdi
call   1030 <puts@plt>
lea    0xeb8(%rip),%rbx
mov    %rsp,%rsi
mov    %rbx,%rdi
call   1050 <scanf@plt>
lea    0x4(%rsp),%rsi
mov    %rbx,%rdi
call   1050 <scanf@plt>
lea    0x8(%rsp),%rsi
mov    %rbx,%rdi
call   1050 <scanf@plt>
lea    0xc(%rsp),%rsi
mov    %rbx,%rdi
call   1050 <scanf@plt>
lea    0x10(%rsp),%rsi
mov    %rbx,%rdi
call   1050 <scanf@plt>
mov    (%rsp),%edx
mov    0x4(%rsp),%eax
cmp    %eax,%edx
mov    %edx,%esi
cmovg  %eax,%esi
cmovl  %eax,%edx
mov    0x8(%rsp),%eax
cmp    %eax,%esi
cmovg  %eax,%esi
cmp    %eax,%edx
cmovl  %eax,%edx
mov    0xc(%rsp),%eax
cmp    %eax,%esi
cmovg  %eax,%esi
cmp    %eax,%edx
cmovl  %eax,%edx
mov    0x10(%rsp),%eax
cmp    %eax,%esi
cmovg  %eax,%esi
cmp    %eax,%edx
cmovl  %eax,%edx
lea    0xe3a(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [32 x i8] c"Please input any 5 numbers... \0A\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [41 x i8] c"The minimum is %d and the maximum is %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i8*
%4 = alloca i64
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
store i32 0, i32* %1
store i32 5, i32* %2
%8 = load i32, i32* %2
%9 = zext i32 %8 to i64
%10 = call i8* @llvm.stacksave()
store i8* %10, i8** %3
%11 = alloca i32, i64 %9
store i64 %9, i64* %4
store i32 0, i32* %5
store i32 0, i32* %6
store i32 0, i32* %7
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0))
store i32 0, i32* %5
br label %13
13: ; preds = %22, %0
%14 = load i32, i32* %5
%15 = load i32, i32* %2
%16 = icmp slt i32 %14, %15
br i1 %16, label %17, label %25
17: ; preds = %13
%18 = load i32, i32* %5
%19 = sext i32 %18 to i64
%20 = getelementptr inbounds i32, i32* %11, i64 %19
%21 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %20)
br label %22
22: ; preds = %17
%23 = load i32, i32* %5
%24 = add nsw i32 %23, 1
store i32 %24, i32* %5
br label %13
25: ; preds = %13
%26 = getelementptr inbounds i32, i32* %11, i64 0
%27 = load i32, i32* %26
store i32 %27, i32* %7
store i32 %27, i32* %6
store i32 0, i32* %5
br label %28
28: ; preds = %57, %25
%29 = load i32, i32* %5
%30 = load i32, i32* %2
%31 = icmp slt i32 %29, %30
br i1 %31, label %32, label %60
32: ; preds = %28
%33 = load i32, i32* %6
%34 = load i32, i32* %5
%35 = sext i32 %34 to i64
%36 = getelementptr inbounds i32, i32* %11, i64 %35
%37 = load i32, i32* %36
%38 = icmp sgt i32 %33, %37
br i1 %38, label %39, label %44
39: ; preds = %32
%40 = load i32, i32* %5
%41 = sext i32 %40 to i64
%42 = getelementptr inbounds i32, i32* %11, i64 %41
%43 = load i32, i32* %42
store i32 %43, i32* %6
br label %44
44: ; preds = %39, %32
%45 = load i32, i32* %7
%46 = load i32, i32* %5
%47 = sext i32 %46 to i64
%48 = getelementptr inbounds i32, i32* %11, i64 %47
%49 = load i32, i32* %48
%50 = icmp slt i32 %45, %49
br i1 %50, label %51, label %56
51: ; preds = %44
%52 = load i32, i32* %5
%53 = sext i32 %52 to i64
%54 = getelementptr inbounds i32, i32* %11, i64 %53
%55 = load i32, i32* %54
store i32 %55, i32* %7
br label %56
56: ; preds = %51, %44
br label %57
57: ; preds = %56
%58 = load i32, i32* %5
%59 = add nsw i32 %58, 1
store i32 %59, i32* %5
br label %28
60: ; preds = %28
%61 = load i32, i32* %6
%62 = load i32, i32* %7
%63 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.2, i64 0, i64 0), i32 %61, i32 %62)
store i32 0, i32* %1
%64 = load i8*, i8** %3
%65 = load i32, i32* %1
ret i32 %65
}

LLVM IR (-O2):
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [41 x i8] c"The minimum is %d and the maximum is %d\0A\00"
@str = [31 x i8] c"Please input any 5 numbers... \00"
define i32 @main() {
%1 = alloca [5 x i32]
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @str, i64 0, i64 0))
%3 = getelementptr inbounds [5 x i32], [5 x i32]* %1, i64 0, i64 0
%4 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %3)
%5 = getelementptr inbounds [5 x i32], [5 x i32]* %1, i64 0, i64 1
%6 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %5)
%7 = getelementptr inbounds [5 x i32], [5 x i32]* %1, i64 0, i64 2
%8 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %7)
%9 = getelementptr inbounds [5 x i32], [5 x i32]* %1, i64 0, i64 3
%10 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %9)
%11 = getelementptr inbounds [5 x i32], [5 x i32]* %1, i64 0, i64 4
%12 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %11)
%13 = load i32, i32* %3
%14 = load i32, i32* %5
%15 = icmp sgt i32 %13, %14
%16 = select i1 %15, i32 %14, i32 %13
%17 = icmp slt i32 %13, %14
%18 = select i1 %17, i32 %14, i32 %13
%19 = load i32, i32* %7
%20 = icmp sgt i32 %16, %19
%21 = select i1 %20, i32 %19, i32 %16
%22 = icmp slt i32 %18, %19
%23 = select i1 %22, i32 %19, i32 %18
%24 = load i32, i32* %9
%25 = icmp sgt i32 %21, %24
%26 = select i1 %25, i32 %24, i32 %21
%27 = icmp slt i32 %23, %24
%28 = select i1 %27, i32 %24, i32 %23
%29 = load i32, i32* %11
%30 = icmp sgt i32 %26, %29
%31 = select i1 %30, i32 %29, i32 %26
%32 = icmp slt i32 %28, %29
%33 = select i1 %32, i32 %29, i32 %28
%34 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([41 x i8], [41 x i8]* @.str.2, i64 0, i64 0), i32 %31, i32 %33)
ret i32 0
}