#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*/ fprintf(int /*<<< orphan*/, char *, ...);
int fread(unsigned char *, int, int, int /*<<< orphan*/);
int /*<<< orphan*/ fwrite(double **, int, int, int /*<<< orphan*/);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ stdin;
int /*<<< orphan*/ stdout;
int main(int argc, char *argv[]) {
  if (argc > 1) {
    fprintf(stderr, "< input > output\n");
    return 1;
  }
  fprintf(stderr, "%s: running ...\n", argv[0]);
  for (;;) {
    unsigned char x[4096];
    double y[4096];
    int r = fread(x, sizeof(unsigned char), 4096, stdin);
    if (r == 0)
      break;
    {
      int i;
      for (i = 0; i < r; i++) {
        y[i] = (double)x[i];
      }
    }
    fwrite(&y, sizeof(double), 1, stdout);
  }
  fprintf(stderr, "%s: done\n", argv[0]);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x9020,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x1,-0x8(%rbp)
jle    1176 <main+0x46>
mov    0x2e7e(%rip),%rax
mov    (%rax),%edi
lea    0xe9d(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
jmp    1267 <main+0x137>
mov    0x2e5b(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
lea    0xe85(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
lea    -0x1010(%rbp),%rdi
mov    0x2e46(%rip),%rax
mov    (%rax),%ecx
mov    $0x1,%esi
mov    $0x1000,%edx
call   1030 <fread@plt>
mov    %eax,-0x9014(%rbp)
cmpl   $0x0,-0x9014(%rbp)
jne    11cb <main+0x9b>
jmp    1242 <main+0x112>
movl   $0x0,-0x9018(%rbp)
mov    -0x9018(%rbp),%eax
cmp    -0x9014(%rbp),%eax
jge    121e <main+0xee>
movslq -0x9018(%rbp),%rax
movzbl -0x1010(%rbp,%rax,1),%eax
ff
cvtsi2sd %eax,%xmm0
movslq -0x9018(%rbp),%rax
movsd  %xmm0,-0x9010(%rbp,%rax,8)
ff ff
mov    -0x9018(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x9018(%rbp)
jmp    11d5 <main+0xa5>
lea    -0x9010(%rbp),%rdi
mov    0x2da4(%rip),%rax
mov    (%rax),%ecx
mov    $0x8,%esi
mov    $0x1,%edx
call   1050 <fwrite@plt>
jmp    1194 <main+0x64>
mov    0x2d8f(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
lea    0xdca(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x9020,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x9008,%rsp
mov    %edi,%eax
mov    0x2e8e(%rip),%rcx
mov    (%rcx),%edi
cmp    $0x2,%eax
jl     1169 <main+0x39>
lea    0xea8(%rip),%rsi
xor    %eax,%eax
call   1040 <fprintf@plt>
mov    $0x1,%eax
jmp    1348 <main+0x218>
mov    %rsi,%r15
mov    (%rsi),%rdx
lea    0xe9c(%rip),%rsi
xor    %eax,%eax
call   1040 <fprintf@plt>
mov    0x2e64(%rip),%r13
mov    0x0(%r13),%ecx
mov    %rsp,%rdi
mov    $0x1,%esi
mov    $0x1000,%edx
call   1030 <fread@plt>
test   %eax,%eax
je     132c <main+0x1fc>
pxor   %xmm2,%xmm2
mov    0x2e23(%rip),%r12
lea    0x1000(%rsp),%r14
mov    %rsp,%rbx
jmp    11f8 <main+0xc8>
nopw   0x0(%rax,%rax,1)
mov    (%r12),%ecx
mov    %r14,%rdi
mov    $0x8,%esi
mov    $0x1,%edx
call   1050 <fwrite@plt>
mov    0x0(%r13),%ecx
mov    %rbx,%rdi
mov    $0x1,%esi
mov    $0x1000,%edx
call   1030 <fread@plt>
pxor   %xmm2,%xmm2
test   %eax,%eax
je     132c <main+0x1fc>
test   %eax,%eax
jle    11c0 <main+0x90>
mov    %eax,%ecx
cmp    $0x4,%eax
jae    1210 <main+0xe0>
xor    %eax,%eax
jmp    1300 <main+0x1d0>
nopw   0x0(%rax,%rax,1)
mov    %ecx,%eax
and    $0xfffffffc,%eax
lea    -0x4(%rax),%rdx
mov    %rdx,%rsi
shr    $0x2,%rsi
add    $0x1,%rsi
test   %rdx,%rdx
je     1322 <main+0x1f2>
mov    %rsi,%rdi
and    $0xfffffffffffffffe,%rdi
xor    %edx,%edx
cs nopw 0x0(%rax,%rax,1)
movq   (%rsp,%rdx,1),%xmm0
movzwl 0x2(%rsp,%rdx,1),%ebp
movd   %ebp,%xmm1
punpcklbw %xmm2,%xmm0
punpcklwd %xmm2,%xmm0
cvtdq2pd %xmm0,%xmm0
punpcklbw %xmm2,%xmm1
punpcklwd %xmm2,%xmm1
cvtdq2pd %xmm1,%xmm1
movaps %xmm0,0x1000(%rsp,%rdx,8)
movaps %xmm1,0x1010(%rsp,%rdx,8)
movd   0x4(%rsp,%rdx,1),%xmm0
movzwl 0x6(%rsp,%rdx,1),%ebp
movd   %ebp,%xmm1
punpcklbw %xmm2,%xmm0
punpcklwd %xmm2,%xmm0
cvtdq2pd %xmm0,%xmm0
punpcklbw %xmm2,%xmm1
punpcklwd %xmm2,%xmm1
cvtdq2pd %xmm1,%xmm1
movapd %xmm0,0x1020(%rsp,%rdx,8)
movaps %xmm1,0x1030(%rsp,%rdx,8)
add    $0x8,%rdx
add    $0xfffffffffffffffe,%rdi
jne    1240 <main+0x110>
test   $0x1,%sil
je     12f5 <main+0x1c5>
movd   (%rsp,%rdx,1),%xmm0
movzwl 0x2(%rsp,%rdx,1),%esi
movd   %esi,%xmm1
punpcklbw %xmm2,%xmm0
punpcklwd %xmm2,%xmm0
cvtdq2pd %xmm0,%xmm0
punpcklbw %xmm2,%xmm1
punpcklwd %xmm2,%xmm1
cvtdq2pd %xmm1,%xmm1
movapd %xmm0,0x1000(%rsp,%rdx,8)
movaps %xmm1,0x1010(%rsp,%rdx,8)
cmp    %rcx,%rax
je     11c0 <main+0x90>
xchg   %ax,%ax
movzbl (%rsp,%rax,1),%edx
xorps  %xmm0,%xmm0
cvtsi2sd %edx,%xmm0
movsd  %xmm0,0x1000(%rsp,%rax,8)
add    $0x1,%rax
cmp    %rax,%rcx
jne    1300 <main+0x1d0>
jmp    11c0 <main+0x90>
xor    %edx,%edx
test   $0x1,%sil
jne    12be <main+0x18e>
jmp    12f5 <main+0x1c5>
mov    0x2ca5(%rip),%rax
mov    (%rax),%edi
mov    (%r15),%rdx
lea    0xce4(%rip),%rsi
xor    %eax,%eax
call   1040 <fprintf@plt>
xor    %eax,%eax
add    $0x9008,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@stderr = global i32 0
@.str = [18 x i8] c"< input > output\0A\00"
@.str.1 = [17 x i8] c"%s: running ...\0A\00"
@stdin = global i32 0
@stdout = global i32 0
@.str.2 = [10 x i8] c"%s: done\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [4096 x i8]
%7 = alloca [4096 x double]
%8 = alloca i32
%9 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%10 = load i32, i32* %4
%11 = icmp sgt i32 %10, 1
br i1 %11, label %12, label %15
12: ; preds = %2
%13 = load i32, i32* @stderr
%14 = call i32 (i32, i8*, ...) @fprintf(i32 %13, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0))
store i32 1, i32* %3
br label %55
15: ; preds = %2
%16 = load i32, i32* @stderr
%17 = load i8**, i8*** %5
%18 = getelementptr inbounds i8*, i8** %17, i64 0
%19 = load i8*, i8** %18
%20 = call i32 (i32, i8*, ...) @fprintf(i32 %16, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0), i8* %19)
br label %21
21: ; preds = %45, %15
%22 = getelementptr inbounds [4096 x i8], [4096 x i8]* %6, i64 0, i64 0
%23 = load i32, i32* @stdin
%24 = call i32 @fread(i8* %22, i32 1, i32 4096, i32 %23)
store i32 %24, i32* %8
%25 = load i32, i32* %8
%26 = icmp eq i32 %25, 0
br i1 %26, label %27, label %28
27: ; preds = %21
br label %49
28: ; preds = %21
store i32 0, i32* %9
br label %29
29: ; preds = %42, %28
%30 = load i32, i32* %9
%31 = load i32, i32* %8
%32 = icmp slt i32 %30, %31
br i1 %32, label %33, label %45
33: ; preds = %29
%34 = load i32, i32* %9
%35 = sext i32 %34 to i64
%36 = getelementptr inbounds [4096 x i8], [4096 x i8]* %6, i64 0, i64 %35
%37 = load i8, i8* %36
%38 = uitofp i8 %37 to double
%39 = load i32, i32* %9
%40 = sext i32 %39 to i64
%41 = getelementptr inbounds [4096 x double], [4096 x double]* %7, i64 0, i64 %40
store double %38, double* %41
br label %42
42: ; preds = %33
%43 = load i32, i32* %9
%44 = add nsw i32 %43, 1
store i32 %44, i32* %9
br label %29
45: ; preds = %29
%46 = bitcast [4096 x double]* %7 to double**
%47 = load i32, i32* @stdout
%48 = call i32 @fwrite(double** %46, i32 8, i32 1, i32 %47)
br label %21
49: ; preds = %27
%50 = load i32, i32* @stderr
%51 = load i8**, i8*** %5
%52 = getelementptr inbounds i8*, i8** %51, i64 0
%53 = load i8*, i8** %52
%54 = call i32 (i32, i8*, ...) @fprintf(i32 %50, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0), i8* %53)
store i32 0, i32* %3
br label %55
55: ; preds = %49, %12
%56 = load i32, i32* %3
ret i32 %56
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [18 x i8] c"< input > output\0A\00"
@.str.1 = [17 x i8] c"%s: running ...\0A\00"
@stdin = global i32 0
@stdout = global i32 0
@.str.2 = [10 x i8] c"%s: done\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca [4096 x i8]
%4 = alloca [4096 x double]
%5 = icmp sgt i32 %0, 1
%6 = load i32, i32* @stderr
br i1 %5, label %7, label %9
7: ; preds = %2
%8 = tail call i32 (i32, i8*, ...) @fprintf(i32 %6, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0))
br label %103
9: ; preds = %2
%10 = load i8*, i8** %1
%11 = tail call i32 (i32, i8*, ...) @fprintf(i32 %6, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0), i8* %10)
%12 = getelementptr inbounds [4096 x i8], [4096 x i8]* %3, i64 0, i64 0
%13 = bitcast [4096 x double]* %4 to i8*
%14 = load i32, i32* @stdin
%15 = call i32 @fread(i8* %12, i32 1, i32 4096, i32 %14)
%16 = icmp eq i32 %15, 0
br i1 %16, label %99, label %17
17: ; preds = %9
%18 = bitcast [4096 x double]* %4 to double**
br label %19
19: ; preds = %17, %93
%20 = phi i32 [ %15, %17 ], [ %97, %93 ]
%21 = icmp sgt i32 %20, 0
br i1 %21, label %22, label %93
22: ; preds = %19
%23 = zext i32 %20 to i64
%24 = icmp ult i32 %20, 4
br i1 %24, label %83, label %25
25: ; preds = %22
%26 = and i64 %23, 4294967292
%27 = add nsw i64 %26, -4
%28 = lshr exact i64 %27, 2
%29 = add nuw nsw i64 %28, 1
%30 = and i64 %29, 1
%31 = icmp eq i64 %27, 0
br i1 %31, label %65, label %32
32: ; preds = %25
%33 = and i64 %29, 9223372036854775806
br label %34
34: ; preds = %34, %32
%35 = phi i64 [ 0, %32 ], [ %62, %34 ]
%36 = phi i64 [ 0, %32 ], [ %63, %34 ]
%37 = getelementptr inbounds [4096 x i8], [4096 x i8]* %3, i64 0, i64 %35
%38 = bitcast i8* %37 to <2 x i8>*
%39 = load <2 x i8>, <2 x i8>* %38
%40 = getelementptr inbounds i8, i8* %37, i64 2
%41 = bitcast i8* %40 to <2 x i8>*
%42 = load <2 x i8>, <2 x i8>* %41
%43 = uitofp <2 x i8> %39 to <2 x double>
%44 = uitofp <2 x i8> %42 to <2 x double>
%45 = getelementptr inbounds [4096 x double], [4096 x double]* %4, i64 0, i64 %35
%46 = bitcast double* %45 to <2 x double>*
store <2 x double> %43, <2 x double>* %46
%47 = getelementptr inbounds double, double* %45, i64 2
%48 = bitcast double* %47 to <2 x double>*
store <2 x double> %44, <2 x double>* %48
%49 = or i64 %35, 4
%50 = getelementptr inbounds [4096 x i8], [4096 x i8]* %3, i64 0, i64 %49
%51 = bitcast i8* %50 to <2 x i8>*
%52 = load <2 x i8>, <2 x i8>* %51
%53 = getelementptr inbounds i8, i8* %50, i64 2
%54 = bitcast i8* %53 to <2 x i8>*
%55 = load <2 x i8>, <2 x i8>* %54
%56 = uitofp <2 x i8> %52 to <2 x double>
%57 = uitofp <2 x i8> %55 to <2 x double>
%58 = getelementptr inbounds [4096 x double], [4096 x double]* %4, i64 0, i64 %49
%59 = bitcast double* %58 to <2 x double>*
store <2 x double> %56, <2 x double>* %59
%60 = getelementptr inbounds double, double* %58, i64 2
%61 = bitcast double* %60 to <2 x double>*
store <2 x double> %57, <2 x double>* %61
%62 = add nuw i64 %35, 8
%63 = add i64 %36, 2
%64 = icmp eq i64 %63, %33
br i1 %64, label %65, label %34
65: ; preds = %34, %25
%66 = phi i64 [ 0, %25 ], [ %62, %34 ]
%67 = icmp eq i64 %30, 0
br i1 %67, label %81, label %68
68: ; preds = %65
%69 = getelementptr inbounds [4096 x i8], [4096 x i8]* %3, i64 0, i64 %66
%70 = bitcast i8* %69 to <2 x i8>*
%71 = load <2 x i8>, <2 x i8>* %70
%72 = getelementptr inbounds i8, i8* %69, i64 2
%73 = bitcast i8* %72 to <2 x i8>*
%74 = load <2 x i8>, <2 x i8>* %73
%75 = uitofp <2 x i8> %71 to <2 x double>
%76 = uitofp <2 x i8> %74 to <2 x double>
%77 = getelementptr inbounds [4096 x double], [4096 x double]* %4, i64 0, i64 %66
%78 = bitcast double* %77 to <2 x double>*
store <2 x double> %75, <2 x double>* %78
%79 = getelementptr inbounds double, double* %77, i64 2
%80 = bitcast double* %79 to <2 x double>*
store <2 x double> %76, <2 x double>* %80
br label %81
81: ; preds = %65, %68
%82 = icmp eq i64 %26, %23
br i1 %82, label %93, label %83
83: ; preds = %22, %81
%84 = phi i64 [ 0, %22 ], [ %26, %81 ]
br label %85
85: ; preds = %83, %85
%86 = phi i64 [ %91, %85 ], [ %84, %83 ]
%87 = getelementptr inbounds [4096 x i8], [4096 x i8]* %3, i64 0, i64 %86
%88 = load i8, i8* %87
%89 = uitofp i8 %88 to double
%90 = getelementptr inbounds [4096 x double], [4096 x double]* %4, i64 0, i64 %86
store double %89, double* %90
%91 = add nuw nsw i64 %86, 1
%92 = icmp eq i64 %91, %23
br i1 %92, label %93, label %85
93: ; preds = %85, %81, %19
%94 = load i32, i32* @stdout
%95 = call i32 @fwrite(double** %18, i32 8, i32 1, i32 %94)
%96 = load i32, i32* @stdin
%97 = call i32 @fread(i8* %12, i32 1, i32 4096, i32 %96)
%98 = icmp eq i32 %97, 0
br i1 %98, label %99, label %19
99: ; preds = %93, %9
%100 = load i32, i32* @stderr
%101 = load i8*, i8** %1
%102 = call i32 (i32, i8*, ...) @fprintf(i32 %100, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0), i8* %101)
br label %103
103: ; preds = %99, %7
%104 = phi i32 [ 1, %7 ], [ 0, %99 ]
ret i32 %104
}