#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 *, char *, ...);
int /*<<< orphan*/ puts(char *);
int /*<<< orphan*/ scanf(char *, int *, int *, int *);
int main() {
  int integerA = 0;
  int integerB = 0;
  int integerC = 0;
  int min = 0;
  int max = 0;
  printf("%s", "Enter three different integers: ");
  scanf("%d %d %d", &integerA, &integerB, &integerC);
  puts("");
  max = integerA;
  if (integerB > max) {
    max = integerB;
    if (integerC > max) {
      max = integerC;
    }
  }
  if (integerC > max) {
    max = integerC;
    if (integerB > max) {
      max = integerB;
    }
  }
  min = integerA;
  if (integerB < min) {
    min = integerB;
    if (integerC < min) {
      min = integerC;
    }
  }
  if (integerC < min) {
    min = integerC;
    if (integerB < min) {
      min = integerB;
    }
  }
  printf("%s %d \n", "Smallest is: ", min);
  printf("%s %d \n", "Largest is: ", max);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
lea    0xe97(%rip),%rdi
lea    0xe93(%rip),%rsi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xea6(%rip),%rdi
lea    -0x8(%rbp),%rsi
lea    -0xc(%rbp),%rdx
lea    -0x10(%rbp),%rcx
call   1050 <scanf@plt>
lea    0xe9e(%rip),%rdi
call   1030 <puts@plt>
mov    -0x8(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x18(%rbp),%eax
jle    11ca <main+0x9a>
mov    -0xc(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0x18(%rbp),%eax
jle    11c5 <main+0x95>
mov    -0x10(%rbp),%eax
mov    %eax,-0x18(%rbp)
jmp    11ca <main+0x9a>
mov    -0x10(%rbp),%eax
cmp    -0x18(%rbp),%eax
jle    11f3 <main+0xc3>
mov    -0x10(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x18(%rbp),%eax
jle    11ee <main+0xbe>
mov    -0xc(%rbp),%eax
mov    %eax,-0x18(%rbp)
jmp    11f3 <main+0xc3>
mov    -0x8(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    1222 <main+0xf2>
mov    -0xc(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    121d <main+0xed>
mov    -0x10(%rbp),%eax
mov    %eax,-0x14(%rbp)
jmp    1222 <main+0xf2>
mov    -0x10(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    124b <main+0x11b>
mov    -0x10(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    1246 <main+0x116>
mov    -0xc(%rbp),%eax
mov    %eax,-0x14(%rbp)
jmp    124b <main+0x11b>
mov    -0x14(%rbp),%edx
lea    0xdd8(%rip),%rdi
lea    0xdd9(%rip),%rsi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x18(%rbp),%edx
lea    0xdc0(%rip),%rdi
lea    0xdcf(%rip),%rsi
mov    $0x0,%al
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x18,%rsp
movl   $0x0,0x14(%rsp)
movl   $0x0,0x10(%rsp)
movl   $0x0,0xc(%rsp)
lea    0xeaa(%rip),%rdi
lea    0xea6(%rip),%rsi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xeb9(%rip),%rdi
lea    0x14(%rsp),%rsi
lea    0x10(%rsp),%rdx
lea    0xc(%rsp),%rcx
call   1050 <scanf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    0x10(%rsp),%eax
mov    0xc(%rsp),%ecx
cmp    %eax,%ecx
mov    %eax,%esi
cmovg  %ecx,%esi
mov    0x14(%rsp),%edx
mov    %eax,%edi
cmovl  %ecx,%edi
cmp    %edx,%eax
mov    %edx,%ebx
cmovg  %esi,%ebx
cmovl  %edi,%edx
cmp    %ebx,%ecx
cmovg  %esi,%ebx
cmp    %edx,%ecx
cmovl  %edi,%edx
lea    0xe71(%rip),%r14
lea    0xe72(%rip),%rsi
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xe6f(%rip),%rsi
mov    %r14,%rdi
mov    %ebx,%edx
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r14
ret

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

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