#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 scanf(char *, double *, double *, double *, double *, double *, double *);
int main() {
  double a, b, c, d, e, f, sum;
  int matches = scanf("%lf %lf %lf %lf %lf", &a, &b, &c, &d, &e, &f);
  if (matches != 5) {
    printf("Invalid input\n");
    return 1;
  }
  sum = a + b + c + d + e + f;
  printf("Sum = %.2f\n", sum);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
lea    -0x10(%rbp),%rsi
lea    -0x18(%rbp),%rdx
lea    -0x20(%rbp),%rcx
lea    -0x28(%rbp),%r8
lea    -0x30(%rbp),%r9
lea    -0x38(%rbp),%rax
mov    %rax,(%rsp)
call   1040 <scanf@plt>
mov    %eax,-0x44(%rbp)
cmpl   $0x5,-0x44(%rbp)
je     117e <main+0x5e>
lea    0xea9(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    11bb <main+0x9b>
movsd  -0x10(%rbp),%xmm0
addsd  -0x18(%rbp),%xmm0
addsd  -0x20(%rbp),%xmm0
addsd  -0x28(%rbp),%xmm0
addsd  -0x30(%rbp),%xmm0
addsd  -0x38(%rbp),%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  -0x40(%rbp),%xmm0
lea    0xe76(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x38,%rsp
lea    0x8(%rsp),%rax
mov    %rax,(%rsp)
lea    0xebc(%rip),%rdi
lea    0x30(%rsp),%rsi
lea    0x28(%rsp),%rdx
lea    0x20(%rsp),%rcx
lea    0x18(%rsp),%r8
lea    0x10(%rsp),%r9
call   1050 <scanf@plt>
cmp    $0x5,%eax
jne    11a0 <main+0x70>
movsd  0x30(%rsp),%xmm0
addsd  0x28(%rsp),%xmm0
addsd  0x20(%rsp),%xmm0
addsd  0x18(%rsp),%xmm0
addsd  0x10(%rsp),%xmm0
addsd  0x8(%rsp),%xmm0
lea    0xe82(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x38,%rsp
ret
lea    0xe79(%rip),%rdi
call   1030 <puts@plt>
mov    $0x1,%eax
add    $0x38,%rsp
ret

LLVM IR (-O0):
@.str = [20 x i8] c"%lf %lf %lf %lf %lf\00"
@.str.1 = [15 x i8] c"Invalid input\0A\00"
@.str.2 = [12 x i8] c"Sum = %.2f\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca double
%3 = alloca double
%4 = alloca double
%5 = alloca double
%6 = alloca double
%7 = alloca double
%8 = alloca double
%9 = alloca i32
store i32 0, i32* %1
%10 = call i32 @scanf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), double* %2, double* %3, double* %4, double* %5, double* %6, double* %7)
store i32 %10, i32* %9
%11 = load i32, i32* %9
%12 = icmp ne i32 %11, 5
br i1 %12, label %13, label %15
13: ; preds = %0
%14 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0))
store i32 1, i32* %1
br label %29
15: ; preds = %0
%16 = load double, double* %2
%17 = load double, double* %3
%18 = fadd double %16, %17
%19 = load double, double* %4
%20 = fadd double %18, %19
%21 = load double, double* %5
%22 = fadd double %20, %21
%23 = load double, double* %6
%24 = fadd double %22, %23
%25 = load double, double* %7
%26 = fadd double %24, %25
store double %26, double* %8
%27 = load double, double* %8
%28 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0), double %27)
store i32 0, i32* %1
br label %29
29: ; preds = %15, %13
%30 = load i32, i32* %1
ret i32 %30
}

LLVM IR (-O2):
@.str = [20 x i8] c"%lf %lf %lf %lf %lf\00"
@.str.2 = [12 x i8] c"Sum = %.2f\0A\00"
@str = [14 x i8] c"Invalid input\00"
define i32 @main() {
%1 = alloca double
%2 = alloca double
%3 = alloca double
%4 = alloca double
%5 = alloca double
%6 = alloca double
%7 = bitcast double* %1 to i8*
%8 = bitcast double* %2 to i8*
%9 = bitcast double* %3 to i8*
%10 = bitcast double* %4 to i8*
%11 = bitcast double* %5 to i8*
%12 = bitcast double* %6 to i8*
%13 = call i32 @scanf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), double* %1, double* %2, double* %3, double* %4, double* %5, double* %6)
%14 = icmp eq i32 %13, 5
br i1 %14, label %17, label %15
15: ; preds = %0
%16 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @str, i64 0, i64 0))
br label %30
17: ; preds = %0
%18 = load double, double* %1
%19 = load double, double* %2
%20 = fadd double %18, %19
%21 = load double, double* %3
%22 = fadd double %20, %21
%23 = load double, double* %4
%24 = fadd double %22, %23
%25 = load double, double* %5
%26 = fadd double %24, %25
%27 = load double, double* %6
%28 = fadd double %26, %27
%29 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0), double %28)
br label %30
30: ; preds = %17, %15
%31 = phi i32 [ 1, %15 ], [ 0, %17 ]
ret i32 %31
}