#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 value1;
  int value2;
  int value3;
  int value4;
  int value5;
  float average;
  printf("\n - Write five numbers and I'll give you the average - \n");
  printf("\nWhat is the first value? \n");
  scanf("%d", &value1);
  printf("What is the second value? \n");
  scanf("%d", &value2);
  printf("What is the third value? \n");
  scanf("%d", &value3);
  printf("What is the fourth value? \n");
  scanf("%d", &value4);
  printf("What is the fifth value? \n");
  scanf("%d", &value5);
  average = (value1 + value2 + value3 + value4 + value5) / 5;
  average = value1;
  average += value2;
  average += value3;
  average += value4;
  average += value5;
  average /= 5;
  printf(" \n\n\t\tYour average is %.2f", average);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xece(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xef9(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xf07(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
lea    0xefa(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xee9(%rip),%rdi
lea    -0xc(%rbp),%rsi
call   1040 <scanf@plt>
lea    0xef8(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xecb(%rip),%rdi
lea    -0x10(%rbp),%rsi
call   1040 <scanf@plt>
lea    0xef5(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xead(%rip),%rdi
lea    -0x14(%rbp),%rsi
call   1040 <scanf@plt>
lea    0xef3(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe8f(%rip),%rdi
lea    -0x18(%rbp),%rsi
call   1040 <scanf@plt>
mov    -0x8(%rbp),%eax
add    -0xc(%rbp),%eax
add    -0x10(%rbp),%eax
add    -0x14(%rbp),%eax
add    -0x18(%rbp),%eax
mov    $0x5,%ecx
cltd
idiv   %ecx
cvtsi2ss %eax,%xmm0
movss  %xmm0,-0x1c(%rbp)
cvtsi2ssl -0x8(%rbp),%xmm0
movss  %xmm0,-0x1c(%rbp)
cvtsi2ssl -0xc(%rbp),%xmm0
addss  -0x1c(%rbp),%xmm0
movss  %xmm0,-0x1c(%rbp)
cvtsi2ssl -0x10(%rbp),%xmm0
addss  -0x1c(%rbp),%xmm0
movss  %xmm0,-0x1c(%rbp)
cvtsi2ssl -0x14(%rbp),%xmm0
addss  -0x1c(%rbp),%xmm0
movss  %xmm0,-0x1c(%rbp)
cvtsi2ssl -0x18(%rbp),%xmm0
addss  -0x1c(%rbp),%xmm0
movss  %xmm0,-0x1c(%rbp)
movss  -0x1c(%rbp),%xmm0
movss  0xdba(%rip),%xmm1
divss  %xmm1,%xmm0
movss  %xmm0,-0x1c(%rbp)
movss  -0x1c(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe6b(%rip),%rdi
mov    $0x1,%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    0xee5(%rip),%rdi
call   1030 <puts@plt>
lea    0xf11(%rip),%rdi
call   1030 <puts@plt>
lea    0xeb0(%rip),%rbx
lea    0x1c(%rsp),%rsi
mov    %rbx,%rdi
call   1050 <scanf@plt>
lea    0xf0c(%rip),%rdi
call   1030 <puts@plt>
lea    0x18(%rsp),%rsi
mov    %rbx,%rdi
call   1050 <scanf@plt>
lea    0xf0e(%rip),%rdi
call   1030 <puts@plt>
lea    0x14(%rsp),%rsi
mov    %rbx,%rdi
call   1050 <scanf@plt>
lea    0xf0f(%rip),%rdi
call   1030 <puts@plt>
lea    0x10(%rsp),%rsi
mov    %rbx,%rdi
call   1050 <scanf@plt>
lea    0xf11(%rip),%rdi
call   1030 <puts@plt>
lea    0xc(%rsp),%rsi
mov    %rbx,%rdi
call   1050 <scanf@plt>
cvtsi2ssl 0x1c(%rsp),%xmm0
cvtsi2ssl 0x18(%rsp),%xmm1
addss  %xmm0,%xmm1
xorps  %xmm0,%xmm0
cvtsi2ssl 0x14(%rsp),%xmm0
addss  %xmm1,%xmm0
xorps  %xmm1,%xmm1
cvtsi2ssl 0x10(%rsp),%xmm1
addss  %xmm0,%xmm1
xorps  %xmm0,%xmm0
cvtsi2ssl 0xc(%rsp),%xmm0
addss  %xmm1,%xmm0
divss  0xdfc(%rip),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xdf8(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [57 x i8] c"\0A - Write five numbers and I'll give you the average - \0A\00"
@.str.1 = [28 x i8] c"\0AWhat is the first value? \0A\00"
@.str.2 = [3 x i8] c"%d\00"
@.str.3 = [28 x i8] c"What is the second value? \0A\00"
@.str.4 = [27 x i8] c"What is the third value? \0A\00"
@.str.5 = [28 x i8] c"What is the fourth value? \0A\00"
@.str.6 = [27 x i8] c"What is the fifth value? \0A\00"
@.str.7 = [26 x i8] c" \0A\0A\09\09Your average is %.2f\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca float
store i32 0, i32* %1
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([57 x i8], [57 x i8]* @.str, i64 0, i64 0))
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.1, i64 0, i64 0))
%10 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %2)
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.3, i64 0, i64 0))
%12 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %3)
%13 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.4, i64 0, i64 0))
%14 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %4)
%15 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.5, i64 0, i64 0))
%16 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %5)
%17 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.6, i64 0, i64 0))
%18 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %6)
%19 = load i32, i32* %2
%20 = load i32, i32* %3
%21 = add nsw i32 %19, %20
%22 = load i32, i32* %4
%23 = add nsw i32 %21, %22
%24 = load i32, i32* %5
%25 = add nsw i32 %23, %24
%26 = load i32, i32* %6
%27 = add nsw i32 %25, %26
%28 = sdiv i32 %27, 5
%29 = sitofp i32 %28 to float
store float %29, float* %7
%30 = load i32, i32* %2
%31 = sitofp i32 %30 to float
store float %31, float* %7
%32 = load i32, i32* %3
%33 = sitofp i32 %32 to float
%34 = load float, float* %7
%35 = fadd float %34, %33
store float %35, float* %7
%36 = load i32, i32* %4
%37 = sitofp i32 %36 to float
%38 = load float, float* %7
%39 = fadd float %38, %37
store float %39, float* %7
%40 = load i32, i32* %5
%41 = sitofp i32 %40 to float
%42 = load float, float* %7
%43 = fadd float %42, %41
store float %43, float* %7
%44 = load i32, i32* %6
%45 = sitofp i32 %44 to float
%46 = load float, float* %7
%47 = fadd float %46, %45
store float %47, float* %7
%48 = load float, float* %7
%49 = fdiv float %48, 5.000000e+00
store float %49, float* %7
%50 = load float, float* %7
%51 = fpext float %50 to double
%52 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.7, i64 0, i64 0), double %51)
ret i32 0
}

LLVM IR (-O2):
@.str.2 = [3 x i8] c"%d\00"
@.str.7 = [26 x i8] c" \0A\0A\09\09Your average is %.2f\00"
@str = [56 x i8] c"\0A - Write five numbers and I'll give you the average - \00"
@str.8 = [27 x i8] c"\0AWhat is the first value? \00"
@str.9 = [27 x i8] c"What is the second value? \00"
@str.10 = [26 x i8] c"What is the third value? \00"
@str.11 = [27 x i8] c"What is the fourth value? \00"
@str.12 = [26 x i8] c"What is the fifth value? \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 @puts(i8* dereferenceable(1) getelementptr inbounds ([56 x i8], [56 x i8]* @str, i64 0, i64 0))
%12 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @str.8, i64 0, i64 0))
%13 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %1)
%14 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @str.9, i64 0, i64 0))
%15 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %2)
%16 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @str.10, i64 0, i64 0))
%17 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %3)
%18 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @str.11, i64 0, i64 0))
%19 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %4)
%20 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @str.12, i64 0, i64 0))
%21 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %5)
%22 = load i32, i32* %1
%23 = load i32, i32* %2
%24 = load i32, i32* %3
%25 = load i32, i32* %4
%26 = load i32, i32* %5
%27 = sitofp i32 %22 to float
%28 = sitofp i32 %23 to float
%29 = fadd float %27, %28
%30 = sitofp i32 %24 to float
%31 = fadd float %29, %30
%32 = sitofp i32 %25 to float
%33 = fadd float %31, %32
%34 = sitofp i32 %26 to float
%35 = fadd float %33, %34
%36 = fdiv float %35, 5.000000e+00
%37 = fpext float %36 to double
%38 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @.str.7, i64 0, i64 0), double %37)
ret i32 0
}