#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 */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ feof(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fscanf(int /*<<< orphan*/ *, char *, long double *);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ *stdin;
int main(int argc, char *argv[]) {
  FILE *f;
  long double sum = 0, x = 0;
  if (!(f = argc <= 1 ? stdin : fopen(argv[1], "r"))) {
    printf("Unable to open stream for reading.\n");
    return 1;
  }
  while (!feof(f)) {
    sum += x;
    fscanf(f, "%Lf", &x);
  }
  printf("%.10Lg\n", sum);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
fldz
fld    %st(0)
fstpt  -0x30(%rbp)
fstpt  -0x40(%rbp)
cmpl   $0x1,-0x8(%rbp)
jg     117d <main+0x3d>
mov    0x2e77(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x48(%rbp)
jmp    1195 <main+0x55>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe74(%rip),%rsi
call   1060 <fopen@plt>
mov    %rax,-0x48(%rbp)
mov    -0x48(%rbp),%rax
mov    %rax,-0x18(%rbp)
cmp    $0x0,%rax
jne    11c1 <main+0x81>
lea    0xe54(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    1225 <main+0xe5>
jmp    11c6 <main+0x86>
mov    -0x18(%rbp),%rdi
call   1050 <feof@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
test   $0x1,%al
jne    11e4 <main+0xa4>
jmp    1208 <main+0xc8>
fldt   -0x40(%rbp)
fldt   -0x30(%rbp)
faddp  %st,%st(1)
fstpt  -0x30(%rbp)
mov    -0x18(%rbp),%rdi
lea    0xe2c(%rip),%rsi
lea    -0x40(%rbp),%rdx
call   1040 <fscanf@plt>
jmp    11c6 <main+0x86>
fldt   -0x30(%rbp)
mov    %rsp,%rax
fstpt  (%rax)
lea    0xe13(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x30,%rsp
fldz
fld    %st(0)
fstpt  0x20(%rsp)
cmp    $0x1,%edi
fstpt  0x14(%rsp)
jg     11dd <main+0x8d>
mov    0x2e77(%rip),%rax
mov    (%rax),%rbx
test   %rbx,%rbx
je     11f5 <main+0xa5>
mov    %rbx,%rdi
call   1060 <feof@plt>
test   %eax,%eax
fldt   0x14(%rsp)
jne    11c8 <main+0x78>
fstp   %st(0)
fldz
lea    0xe6e(%rip),%r14
lea    0x20(%rsp),%r15
nopl   0x0(%rax)
fldt   0x20(%rsp)
faddp  %st,%st(1)
fstpt  0x14(%rsp)
mov    %rbx,%rdi
mov    %r14,%rsi
mov    %r15,%rdx
call   1050 <fscanf@plt>
mov    %rbx,%rdi
call   1060 <feof@plt>
fldt   0x14(%rsp)
test   %eax,%eax
je     11a0 <main+0x50>
fstpt  (%rsp)
lea    0xe34(%rip),%rdi
xor    %ebx,%ebx
xor    %eax,%eax
call   1040 <printf@plt>
jmp    1206 <main+0xb6>
mov    0x8(%rsi),%rdi
lea    0xe18(%rip),%rsi
call   1070 <fopen@plt>
mov    %rax,%rbx
test   %rbx,%rbx
jne    1179 <main+0x29>
lea    0xe12(%rip),%rdi
call   1030 <puts@plt>
mov    $0x1,%ebx
mov    %ebx,%eax
add    $0x30,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@stdin = global i32* null
@.str = [2 x i8] c"r\00"
@.str.1 = [36 x i8] c"Unable to open stream for reading.\0A\00"
@.str.2 = [4 x i8] c"%Lf\00"
@.str.3 = [8 x i8] c"%.10Lg\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32*
%7 = alloca x86_fp80
%8 = alloca x86_fp80
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store x86_fp80 0xK00000000000000000000, x86_fp80* %7
store x86_fp80 0xK00000000000000000000, x86_fp80* %8
%9 = load i32, i32* %4
%10 = icmp sle i32 %9, 1
br i1 %10, label %11, label %13
11: ; preds = %2
%12 = load i32*, i32** @stdin
br label %18
13: ; preds = %2
%14 = load i8**, i8*** %5
%15 = getelementptr inbounds i8*, i8** %14, i64 1
%16 = load i8*, i8** %15
%17 = call i32* @fopen(i8* %16, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
br label %18
18: ; preds = %13, %11
%19 = phi i32* [ %12, %11 ], [ %17, %13 ]
store i32* %19, i32** %6
%20 = icmp ne i32* %19, null
br i1 %20, label %23, label %21
21: ; preds = %18
%22 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.1, i64 0, i64 0))
store i32 1, i32* %3
br label %38
23: ; preds = %18
br label %24
24: ; preds = %29, %23
%25 = load i32*, i32** %6
%26 = call i32 @feof(i32* %25)
%27 = icmp ne i32 %26, 0
%28 = xor i1 %27, true
br i1 %28, label %29, label %35
29: ; preds = %24
%30 = load x86_fp80, x86_fp80* %8
%31 = load x86_fp80, x86_fp80* %7
%32 = fadd x86_fp80 %31, %30
store x86_fp80 %32, x86_fp80* %7
%33 = load i32*, i32** %6
%34 = call i32 @fscanf(i32* %33, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), x86_fp80* %8)
br label %24
35: ; preds = %24
%36 = load x86_fp80, x86_fp80* %7
%37 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0), x86_fp80 %36)
store i32 0, i32* %3
br label %38
38: ; preds = %35, %21
%39 = load i32, i32* %3
ret i32 %39
}

LLVM IR (-O2):
@stdin = global i32* null
@.str = [2 x i8] c"r\00"
@.str.2 = [4 x i8] c"%Lf\00"
@.str.3 = [8 x i8] c"%.10Lg\0A\00"
@str = [35 x i8] c"Unable to open stream for reading.\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca x86_fp80
%4 = bitcast x86_fp80* %3 to i8*
store x86_fp80 0xK00000000000000000000, x86_fp80* %3
%5 = icmp slt i32 %0, 2
br i1 %5, label %6, label %8
6: ; preds = %2
%7 = load i32*, i32** @stdin
br label %12
8: ; preds = %2
%9 = getelementptr inbounds i8*, i8** %1, i64 1
%10 = load i8*, i8** %9
%11 = tail call i32* @fopen(i8* %10, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
br label %12
12: ; preds = %8, %6
%13 = phi i32* [ %7, %6 ], [ %11, %8 ]
%14 = icmp eq i32* %13, null
br i1 %14, label %18, label %15
15: ; preds = %12
%16 = call i32 @feof(i32* %13)
%17 = icmp eq i32 %16, 0
br i1 %17, label %20, label %27
18: ; preds = %12
%19 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @str, i64 0, i64 0))
br label %30
20: ; preds = %15, %20
%21 = phi x86_fp80 [ %23, %20 ], [ 0xK00000000000000000000, %15 ]
%22 = load x86_fp80, x86_fp80* %3
%23 = fadd x86_fp80 %21, %22
%24 = call i32 @fscanf(i32* %13, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), x86_fp80* %3)
%25 = call i32 @feof(i32* %13)
%26 = icmp eq i32 %25, 0
br i1 %26, label %20, label %27
27: ; preds = %20, %15
%28 = phi x86_fp80 [ 0xK00000000000000000000, %15 ], [ %23, %20 ]
%29 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0), x86_fp80 %28)
br label %30
30: ; preds = %27, %18
%31 = phi i32 [ 0, %27 ], [ 1, %18 ]
ret i32 %31
}