#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 *, int *, int *, int *);
int main(void) {
  int small;
  int large;
  int a, b, c, d, e;
  printf("Enter five integers: ");
  scanf("%d%d%d%d%d", &a, &b, &c, &d, &e);
  small = a;
  large = a;
  if (small > b)
    small = b;
  if (small > c)
    small = c;
  if (small > d)
    small = d;
  if (small > e)
    small = e;
  if (large < b)
    large = b;
  if (large < c)
    large = c;
  if (large < d)
    large = d;
  if (large < e)
    large = e;
  printf("Largest is %d\n", large);
  printf("Smallest is %d\n", small);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xed2(%rip),%rdi
lea    -0x10(%rbp),%rsi
lea    -0x14(%rbp),%rdx
lea    -0x18(%rbp),%rcx
lea    -0x1c(%rbp),%r8
lea    -0x20(%rbp),%r9
call   1040 <scanf@plt>
mov    -0x10(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x10(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0x14(%rbp),%eax
jle    117b <main+0x5b>
mov    -0x14(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0x18(%rbp),%eax
jle    118d <main+0x6d>
mov    -0x18(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jle    119f <main+0x7f>
mov    -0x1c(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0x20(%rbp),%eax
jle    11b1 <main+0x91>
mov    -0x20(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    11c3 <main+0xa3>
mov    -0x14(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x18(%rbp),%eax
jge    11d5 <main+0xb5>
mov    -0x18(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jge    11e7 <main+0xc7>
mov    -0x1c(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x20(%rbp),%eax
jge    11f9 <main+0xd9>
mov    -0x20(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%esi
lea    0xe1e(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%esi
lea    0xe1c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x20,%rsp
lea    0xed4(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xedc(%rip),%rdi
lea    0x1c(%rsp),%rsi
lea    0x18(%rsp),%rdx
lea    0x14(%rsp),%rcx
lea    0x10(%rsp),%r8
lea    0xc(%rsp),%r9
call   1040 <scanf@plt>
mov    0x1c(%rsp),%esi
mov    0x18(%rsp),%eax
cmp    %eax,%esi
mov    %esi,%ebx
cmovg  %eax,%ebx
cmovl  %eax,%esi
mov    0x14(%rsp),%eax
cmp    %eax,%ebx
cmovg  %eax,%ebx
mov    0x10(%rsp),%ecx
cmp    %ecx,%ebx
cmovg  %ecx,%ebx
mov    0xc(%rsp),%edx
cmp    %edx,%ebx
cmovg  %edx,%ebx
cmp    %eax,%esi
cmovl  %eax,%esi
cmp    %ecx,%esi
cmovl  %ecx,%esi
cmp    %edx,%esi
cmovl  %edx,%esi
lea    0xe86(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xe87(%rip),%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbx
ret

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

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