#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 main() {
  int a, b, c;
  printf("Input three different integers: ");
  scanf("%d %d %d", &a, &b, &c);
  printf("Sum is %d\n", a + b + c);
  printf("Average is %d\n", (a + b + c) / 3);
  printf("Product is %d\n", a * b * c);
  int smallest = a;
  if (b < smallest)
    smallest = b;
  if (c < smallest)
    smallest = c;
  printf("Smallest is %d\n", smallest);
  int largest = a;
  if (b > largest)
    largest = b;
  if (c > largest)
    largest = c;
  printf("Largest is %d\n", largest);
  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    0xedd(%rip),%rdi
lea    -0x8(%rbp),%rsi
lea    -0xc(%rbp),%rdx
lea    -0x10(%rbp),%rcx
call   1040 <scanf@plt>
mov    -0x8(%rbp),%esi
add    -0xc(%rbp),%esi
add    -0x10(%rbp),%esi
lea    0xec5(%rip),%rdi
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,%esi
lea    0xeaf(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%esi
imul   -0xc(%rbp),%esi
imul   -0x10(%rbp),%esi
lea    0xea5(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    11be <main+0x9e>
mov    -0xc(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    11d0 <main+0xb0>
mov    -0x10(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%esi
lea    0xe79(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x18(%rbp),%eax
jle    11f9 <main+0xd9>
mov    -0xc(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0x18(%rbp),%eax
jle    120b <main+0xeb>
mov    -0x10(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x18(%rbp),%esi
lea    0xe4e(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x18,%rsp
lea    0xed5(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xee8(%rip),%rdi
lea    0x14(%rsp),%rsi
lea    0x10(%rsp),%rdx
lea    0xc(%rsp),%rcx
call   1040 <scanf@plt>
mov    0x10(%rsp),%esi
add    0x14(%rsp),%esi
add    0xc(%rsp),%esi
lea    0xeca(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    0x10(%rsp),%eax
add    0x14(%rsp),%eax
add    0xc(%rsp),%eax
cltq
imul   $0x55555556,%rax,%rsi
mov    %rsi,%rax
shr    $0x3f,%rax
shr    $0x20,%rsi
add    %eax,%esi
lea    0xea5(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    0x10(%rsp),%esi
imul   0x14(%rsp),%esi
imul   0xc(%rsp),%esi
lea    0xe98(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    0x14(%rsp),%esi
mov    0x10(%rsp),%eax
cmp    %esi,%eax
cmovl  %eax,%esi
mov    0xc(%rsp),%eax
cmp    %esi,%eax
cmovl  %eax,%esi
lea    0xe83(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    0x14(%rsp),%esi
mov    0x10(%rsp),%eax
cmp    %esi,%eax
cmovg  %eax,%esi
mov    0xc(%rsp),%eax
cmp    %esi,%eax
cmovg  %eax,%esi
lea    0xe6f(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x18,%rsp
ret

LLVM IR (-O0):
@.str = [33 x i8] c"Input three different integers: \00"
@.str.1 = [9 x i8] c"%d %d %d\00"
@.str.2 = [11 x i8] c"Sum is %d\0A\00"
@.str.3 = [15 x i8] c"Average is %d\0A\00"
@.str.4 = [15 x i8] c"Product is %d\0A\00"
@.str.5 = [16 x i8] c"Smallest is %d\0A\00"
@.str.6 = [15 x i8] c"Largest 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
store i32 0, i32* %1
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0))
%8 = call i32 @scanf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, 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*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, 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*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.3, 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*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.4, i64 0, i64 0), i32 %26)
%28 = load i32, i32* %2
store i32 %28, i32* %5
%29 = load i32, i32* %3
%30 = load i32, i32* %5
%31 = icmp slt i32 %29, %30
br i1 %31, label %32, label %34
32: ; preds = %0
%33 = load i32, i32* %3
store i32 %33, i32* %5
br label %34
34: ; preds = %32, %0
%35 = load i32, i32* %4
%36 = load i32, i32* %5
%37 = icmp slt i32 %35, %36
br i1 %37, label %38, label %40
38: ; preds = %34
%39 = load i32, i32* %4
store i32 %39, i32* %5
br label %40
40: ; preds = %38, %34
%41 = load i32, i32* %5
%42 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.5, i64 0, i64 0), i32 %41)
%43 = load i32, i32* %2
store i32 %43, i32* %6
%44 = load i32, i32* %3
%45 = load i32, i32* %6
%46 = icmp sgt i32 %44, %45
br i1 %46, label %47, label %49
47: ; preds = %40
%48 = load i32, i32* %3
store i32 %48, i32* %6
br label %49
49: ; preds = %47, %40
%50 = load i32, i32* %4
%51 = load i32, i32* %6
%52 = icmp sgt i32 %50, %51
br i1 %52, label %53, label %55
53: ; preds = %49
%54 = load i32, i32* %4
store i32 %54, i32* %6
br label %55
55: ; preds = %53, %49
%56 = load i32, i32* %6
%57 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.6, i64 0, i64 0), i32 %56)
ret i32 0
}

LLVM IR (-O2):
@.str = [33 x i8] c"Input three different integers: \00"
@.str.1 = [9 x i8] c"%d %d %d\00"
@.str.2 = [11 x i8] c"Sum is %d\0A\00"
@.str.3 = [15 x i8] c"Average is %d\0A\00"
@.str.4 = [15 x i8] c"Product is %d\0A\00"
@.str.5 = [16 x i8] c"Smallest is %d\0A\00"
@.str.6 = [15 x i8] c"Largest is %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = bitcast i32* %1 to i8*
%5 = bitcast i32* %2 to i8*
%6 = bitcast i32* %3 to i8*
%7 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0))
%8 = call i32 @scanf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, 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*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, 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*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str.3, 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*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str.4, i64 0, i64 0), i32 %26)
%28 = load i32, i32* %1
%29 = load i32, i32* %2
%30 = icmp slt i32 %29, %28
%31 = select i1 %30, i32 %29, i32 %28
%32 = load i32, i32* %3
%33 = icmp slt i32 %32, %31
%34 = select i1 %33, i32 %32, i32 %31
%35 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str.5, i64 0, i64 0), i32 %34)
%36 = load i32, i32* %1
%37 = load i32, i32* %2
%38 = icmp sgt i32 %37, %36
%39 = select i1 %38, i32 %37, i32 %36
%40 = load i32, i32* %3
%41 = icmp sgt i32 %40, %39
%42 = select i1 %41, i32 %40, i32 %39
%43 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str.6, i64 0, i64 0), i32 %42)
ret i32 0
}