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


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xc020,%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    1262 <main+0x132>
mov    0x2e5b(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
lea    0xe87(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
lea    -0x8010(%rbp),%rdi
mov    0x2e46(%rip),%rax
mov    (%rax),%ecx
mov    $0x8,%esi
mov    $0x1000,%edx
call   1030 <fread@plt>
mov    %eax,-0xc014(%rbp)
cmpl   $0x0,-0xc014(%rbp)
jne    11cb <main+0x9b>
jmp    1244 <main+0x114>
movl   $0x0,-0xc018(%rbp)
mov    -0xc018(%rbp),%eax
cmp    -0xc014(%rbp),%eax
jge    121f <main+0xef>
movslq -0xc018(%rbp),%rax
movsd  -0x8010(%rbp,%rax,8),%xmm0
ff ff
cvtsd2ss %xmm0,%xmm0
movslq -0xc018(%rbp),%rax
movss  %xmm0,-0xc010(%rbp,%rax,4)
ff ff
mov    -0xc018(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc018(%rbp)
jmp    11d5 <main+0xa5>
lea    -0xc010(%rbp),%rdi
mov    -0xc014(%rbp),%edx
mov    0x2d9d(%rip),%rax
mov    (%rax),%ecx
mov    $0x4,%esi
call   1050 <fwrite@plt>
jmp    1194 <main+0x64>
mov    0x2d8d(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
lea    0xdca(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
mov    -0x4(%rbp),%eax
add    $0xc020,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0xc008,%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    12f6 <main+0x1c6>
mov    %rsi,%r15
mov    (%rsi),%rdx
lea    0xe9e(%rip),%rsi
xor    %eax,%eax
call   1040 <fprintf@plt>
mov    0x2e64(%rip),%r13
mov    0x0(%r13),%ecx
lea    0x4000(%rsp),%rdi
mov    $0x8,%esi
mov    $0x1000,%edx
call   1030 <fread@plt>
test   %eax,%eax
je     12da <main+0x1aa>
mov    0x2e22(%rip),%r12
mov    %rsp,%r14
lea    0x4000(%rsp),%rbx
jmp    11f1 <main+0xc1>
nopl   0x0(%rax,%rax,1)
mov    (%r12),%ecx
mov    %r14,%rdi
mov    $0x4,%esi
mov    %eax,%edx
call   1050 <fwrite@plt>
mov    0x0(%r13),%ecx
mov    %rbx,%rdi
mov    $0x8,%esi
mov    $0x1000,%edx
call   1030 <fread@plt>
test   %eax,%eax
je     12da <main+0x1aa>
test   %eax,%eax
jle    11c0 <main+0x90>
mov    %eax,%ecx
cmp    $0x4,%eax
jae    1210 <main+0xe0>
xor    %edx,%edx
jmp    12b0 <main+0x180>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    %ecx,%edx
and    $0xfffffffc,%edx
lea    -0x4(%rdx),%rsi
mov    %rsi,%rbp
shr    $0x2,%rbp
add    $0x1,%rbp
test   %rsi,%rsi
je     12d0 <main+0x1a0>
mov    %rbp,%rsi
and    $0xfffffffffffffffe,%rsi
xor    %edi,%edi
cs nopw 0x0(%rax,%rax,1)
cvtpd2ps 0x4000(%rsp,%rdi,8),%xmm0
cvtpd2ps 0x4010(%rsp,%rdi,8),%xmm1
unpcklpd %xmm1,%xmm0
cvtpd2ps 0x4020(%rsp,%rdi,8),%xmm1
movapd %xmm0,(%rsp,%rdi,4)
cvtpd2ps 0x4030(%rsp,%rdi,8),%xmm0
unpcklpd %xmm0,%xmm1
movapd %xmm1,0x10(%rsp,%rdi,4)
add    $0x8,%rdi
add    $0xfffffffffffffffe,%rsi
jne    1240 <main+0x110>
test   $0x1,%bpl
je     12a2 <main+0x172>
cvtpd2ps 0x4000(%rsp,%rdi,8),%xmm0
cvtpd2ps 0x4010(%rsp,%rdi,8),%xmm1
unpcklpd %xmm1,%xmm0
movapd %xmm0,(%rsp,%rdi,4)
cmp    %rcx,%rdx
je     11c0 <main+0x90>
nopl   0x0(%rax,%rax,1)
movsd  0x4000(%rsp,%rdx,8),%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,(%rsp,%rdx,4)
add    $0x1,%rdx
cmp    %rdx,%rcx
jne    12b0 <main+0x180>
jmp    11c0 <main+0x90>
xor    %edi,%edi
test   $0x1,%bpl
jne    1287 <main+0x157>
jmp    12a2 <main+0x172>
mov    0x2cf7(%rip),%rax
mov    (%rax),%edi
mov    (%r15),%rdx
lea    0xd38(%rip),%rsi
xor    %eax,%eax
call   1040 <fprintf@plt>
xor    %eax,%eax
add    $0xc008,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@stderr = global i32 0
@.str = [20 x i8] c"< entrada > salida\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 double]
%7 = alloca [4096 x float]
%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 ([20 x i8], [20 x i8]* @.str, i64 0, i64 0))
store i32 1, i32* %3
br label %56
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 double], [4096 x double]* %6, i64 0, i64 0
%23 = load i32, i32* @stdin
%24 = call i32 @fread(double* %22, i32 8, 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 %50
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 double], [4096 x double]* %6, i64 0, i64 %35
%37 = load double, double* %36
%38 = fptrunc double %37 to float
%39 = load i32, i32* %9
%40 = sext i32 %39 to i64
%41 = getelementptr inbounds [4096 x float], [4096 x float]* %7, i64 0, i64 %40
store float %38, float* %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 = getelementptr inbounds [4096 x float], [4096 x float]* %7, i64 0, i64 0
%47 = load i32, i32* %8
%48 = load i32, i32* @stdout
%49 = call i32 @fwrite(float* %46, i32 4, i32 %47, i32 %48)
br label %21
50: ; preds = %27
%51 = load i32, i32* @stderr
%52 = load i8**, i8*** %5
%53 = getelementptr inbounds i8*, i8** %52, i64 0
%54 = load i8*, i8** %53
%55 = call i32 (i32, i8*, ...) @fprintf(i32 %51, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0), i8* %54)
br label %56
56: ; preds = %50, %12
%57 = load i32, i32* %3
ret i32 %57
}

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