#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*/ 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);
  printf("%s %d \n", "Sum is: ", (integerA + integerB + integerC));
  printf("%s %d \n", "Average is: ", ((integerA + integerB + integerC) / 3));
  printf("%s %d \n", "Product is: ", (integerA * integerB * integerC));
  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    0xea7(%rip),%rdi
lea    0xea3(%rip),%rsi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xeb6(%rip),%rdi
lea    -0x8(%rbp),%rsi
lea    -0xc(%rbp),%rdx
lea    -0x10(%rbp),%rcx
call   1040 <scanf@plt>
mov    -0x8(%rbp),%edx
add    -0xc(%rbp),%edx
add    -0x10(%rbp),%edx
lea    0xe9e(%rip),%rdi
lea    0xe9f(%rip),%rsi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
add    -0xc(%rbp),%eax
add    -0x10(%rbp),%eax
mov    $0x3,%ecx
cltd
idiv   %ecx
mov    %eax,%edx
lea    0xe76(%rip),%rdi
lea    0xe80(%rip),%rsi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%edx
imul   -0xc(%rbp),%edx
imul   -0x10(%rbp),%edx
lea    0xe56(%rip),%rdi
lea    0xe6d(%rip),%rsi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x18(%rbp),%eax
jle    1214 <main+0xf4>
mov    -0xc(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0x18(%rbp),%eax
jle    120f <main+0xef>
mov    -0x10(%rbp),%eax
mov    %eax,-0x18(%rbp)
jmp    1214 <main+0xf4>
mov    -0x10(%rbp),%eax
cmp    -0x18(%rbp),%eax
jle    123d <main+0x11d>
mov    -0x10(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x18(%rbp),%eax
jle    1238 <main+0x118>
mov    -0xc(%rbp),%eax
mov    %eax,-0x18(%rbp)
jmp    123d <main+0x11d>
mov    -0x8(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    126c <main+0x14c>
mov    -0xc(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    1267 <main+0x147>
mov    -0x10(%rbp),%eax
mov    %eax,-0x14(%rbp)
jmp    126c <main+0x14c>
mov    -0x10(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    1295 <main+0x175>
mov    -0x10(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    1290 <main+0x170>
mov    -0xc(%rbp),%eax
mov    %eax,-0x14(%rbp)
jmp    1295 <main+0x175>
mov    -0x14(%rbp),%edx
lea    0xd8e(%rip),%rdi
lea    0xdb2(%rip),%rsi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x18(%rbp),%edx
lea    0xd76(%rip),%rdi
lea    0xda8(%rip),%rsi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
sub    $0x18,%rsp
movl   $0x0,0x14(%rsp)
movl   $0x0,0x10(%rsp)
movl   $0x0,0xc(%rsp)
lea    0xebb(%rip),%rdi
lea    0xeb7(%rip),%rsi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xeca(%rip),%rdi
lea    0x14(%rsp),%rsi
lea    0x10(%rsp),%rdx
lea    0xc(%rsp),%rcx
call   1040 <scanf@plt>
mov    0x10(%rsp),%edx
add    0x14(%rsp),%edx
add    0xc(%rsp),%edx
lea    0xeac(%rip),%rbx
lea    0xead(%rip),%rsi
mov    %rbx,%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    0x10(%rsp),%eax
add    0x14(%rsp),%eax
add    0xc(%rsp),%eax
cltq
imul   $0x55555556,%rax,%rdx
mov    %rdx,%rax
shr    $0x3f,%rax
shr    $0x20,%rdx
add    %eax,%edx
lea    0xe83(%rip),%rsi
mov    %rbx,%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    0x10(%rsp),%edx
imul   0x14(%rsp),%edx
imul   0xc(%rsp),%edx
lea    0xe71(%rip),%rsi
mov    %rbx,%rdi
xor    %eax,%eax
call   1030 <printf@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,%ebp
cmovg  %esi,%ebp
cmovl  %edi,%edx
cmp    %ebp,%ecx
cmovg  %esi,%ebp
cmp    %edx,%ecx
cmovl  %edi,%edx
lea    0xe41(%rip),%rsi
mov    %rbx,%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xe3e(%rip),%rsi
mov    %rbx,%rdi
mov    %ebp,%edx
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %rbp
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 = [8 x i8] c"%s %d \0A\00"
@.str.4 = [9 x i8] c"Sum is: \00"
@.str.5 = [13 x i8] c"Average is: \00"
@.str.6 = [13 x i8] c"Product is: \00"
@.str.7 = [14 x i8] c"Smallest is: \00"
@.str.8 = [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 = load i32, i32* %2
%10 = load i32, i32* %3
%11 = add nsw i32 %9, %10
%12 = load i32, i32* %4
%13 = add nsw i32 %11, %12
%14 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.4, i64 0, i64 0), i32 %13)
%15 = load i32, i32* %2
%16 = load i32, i32* %3
%17 = add nsw i32 %15, %16
%18 = load i32, i32* %4
%19 = add nsw i32 %17, %18
%20 = sdiv i32 %19, 3
%21 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.5, i64 0, i64 0), i32 %20)
%22 = load i32, i32* %2
%23 = load i32, i32* %3
%24 = mul nsw i32 %22, %23
%25 = load i32, i32* %4
%26 = mul nsw i32 %24, %25
%27 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.6, i64 0, i64 0), i32 %26)
%28 = load i32, i32* %2
store i32 %28, i32* %6
%29 = load i32, i32* %3
%30 = load i32, i32* %6
%31 = icmp sgt i32 %29, %30
br i1 %31, label %32, label %40
32: ; preds = %0
%33 = load i32, i32* %3
store i32 %33, i32* %6
%34 = load i32, i32* %4
%35 = load i32, i32* %6
%36 = icmp sgt i32 %34, %35
br i1 %36, label %37, label %39
37: ; preds = %32
%38 = load i32, i32* %4
store i32 %38, i32* %6
br label %39
39: ; preds = %37, %32
br label %40
40: ; preds = %39, %0
%41 = load i32, i32* %4
%42 = load i32, i32* %6
%43 = icmp sgt i32 %41, %42
br i1 %43, label %44, label %52
44: ; preds = %40
%45 = load i32, i32* %4
store i32 %45, i32* %6
%46 = load i32, i32* %3
%47 = load i32, i32* %6
%48 = icmp sgt i32 %46, %47
br i1 %48, label %49, label %51
49: ; preds = %44
%50 = load i32, i32* %3
store i32 %50, i32* %6
br label %51
51: ; preds = %49, %44
br label %52
52: ; preds = %51, %40
%53 = load i32, i32* %2
store i32 %53, i32* %5
%54 = load i32, i32* %3
%55 = load i32, i32* %5
%56 = icmp slt i32 %54, %55
br i1 %56, label %57, label %65
57: ; preds = %52
%58 = load i32, i32* %3
store i32 %58, i32* %5
%59 = load i32, i32* %4
%60 = load i32, i32* %5
%61 = icmp slt i32 %59, %60
br i1 %61, label %62, label %64
62: ; preds = %57
%63 = load i32, i32* %4
store i32 %63, i32* %5
br label %64
64: ; preds = %62, %57
br label %65
65: ; preds = %64, %52
%66 = load i32, i32* %4
%67 = load i32, i32* %5
%68 = icmp slt i32 %66, %67
br i1 %68, label %69, label %77
69: ; preds = %65
%70 = load i32, i32* %4
store i32 %70, i32* %5
%71 = load i32, i32* %3
%72 = load i32, i32* %5
%73 = icmp slt i32 %71, %72
br i1 %73, label %74, label %76
74: ; preds = %69
%75 = load i32, i32* %3
store i32 %75, i32* %5
br label %76
76: ; preds = %74, %69
br label %77
77: ; preds = %76, %65
%78 = load i32, i32* %5
%79 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.7, i64 0, i64 0), i32 %78)
%80 = load i32, i32* %6
%81 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.8, i64 0, i64 0), i32 %80)
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.3 = [8 x i8] c"%s %d \0A\00"
@.str.4 = [9 x i8] c"Sum is: \00"
@.str.5 = [13 x i8] c"Average is: \00"
@.str.6 = [13 x i8] c"Product is: \00"
@.str.7 = [14 x i8] c"Smallest is: \00"
@.str.8 = [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 = load i32, i32* %1
%10 = load i32, i32* %2
%11 = add nsw i32 %10, %9
%12 = load i32, i32* %3
%13 = add nsw i32 %11, %12
%14 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.4, i64 0, i64 0), i32 %13)
%15 = load i32, i32* %1
%16 = load i32, i32* %2
%17 = add nsw i32 %16, %15
%18 = load i32, i32* %3
%19 = add nsw i32 %17, %18
%20 = sdiv i32 %19, 3
%21 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.5, i64 0, i64 0), i32 %20)
%22 = load i32, i32* %1
%23 = load i32, i32* %2
%24 = mul nsw i32 %23, %22
%25 = load i32, i32* %3
%26 = mul nsw i32 %24, %25
%27 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.6, i64 0, i64 0), i32 %26)
%28 = load i32, i32* %1
%29 = load i32, i32* %2
%30 = icmp sgt i32 %29, %28
%31 = load i32, i32* %3
%32 = icmp sgt i32 %31, %29
%33 = select i1 %32, i32 %31, i32 %29
%34 = select i1 %30, i32 %33, i32 %28
%35 = icmp sgt i32 %31, %34
%36 = icmp sgt i32 %29, %31
%37 = select i1 %35, i32 %33, i32 %34
%38 = icmp slt i32 %29, %28
%39 = select i1 %36, i32 %31, i32 %29
%40 = select i1 %38, i32 %39, i32 %28
%41 = icmp slt i32 %31, %40
%42 = select i1 %41, i32 %39, i32 %40
%43 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.7, i64 0, i64 0), i32 %42)
%44 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.8, i64 0, i64 0), i32 %37)
ret i32 0
}