#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(float *, int, int, int /*<<< orphan*/);
int /*<<< orphan*/ fwrite(unsigned short *, 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 (;;) {
    float x[4096];
    unsigned short y[4096];
    int r = fread(x, sizeof(float), 4096, stdin);
    if (r == 0)
      break;
    {
      int i;
      for (i = 0; i < r; i++) {
        if (x[i] < 0)
          y[i] = 0;
        else if (x[i] > 65535)
          y[i] = 65535;
        else
          y[i] = (unsigned short)x[i];
      }
    }
    fwrite(y, sizeof(unsigned short), r, stdout);
  }
  fprintf(stderr, "%s: done\n", argv[0]);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x6020,%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    0xea1(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
jmp    12cf <main+0x19f>
mov    0x2e5b(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
lea    0xe8b(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
lea    -0x4010(%rbp),%rdi
mov    0x2e46(%rip),%rax
mov    (%rax),%ecx
mov    $0x4,%esi
mov    $0x1000,%edx
call   1030 <fread@plt>
mov    %eax,-0x6014(%rbp)
cmpl   $0x0,-0x6014(%rbp)
jne    11cb <main+0x9b>
jmp    12b1 <main+0x181>
movl   $0x0,-0x6018(%rbp)
mov    -0x6018(%rbp),%eax
cmp    -0x6014(%rbp),%eax
jge    128c <main+0x15c>
movslq -0x6018(%rbp),%rax
xorps  %xmm0,%xmm0
ucomiss -0x4010(%rbp,%rax,4),%xmm0
ff
jbe    1215 <main+0xe5>
movslq -0x6018(%rbp),%rax
movw   $0x0,-0x6010(%rbp,%rax,2)
jmp    1273 <main+0x143>
movslq -0x6018(%rbp),%rax
movss  -0x4010(%rbp,%rax,4),%xmm0
ff ff
movss  0xdd3(%rip),%xmm1
ucomiss %xmm1,%xmm0
jbe    124c <main+0x11c>
movslq -0x6018(%rbp),%rax
movw   $0xffff,-0x6010(%rbp,%rax,2)
ff ff ff
jmp    126e <main+0x13e>
movslq -0x6018(%rbp),%rax
cvttss2si -0x4010(%rbp,%rax,4),%eax
ff ff
mov    %ax,%cx
movslq -0x6018(%rbp),%rax
mov    %cx,-0x6010(%rbp,%rax,2)
ff
jmp    1273 <main+0x143>
jmp    1278 <main+0x148>
mov    -0x6018(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x6018(%rbp)
jmp    11d5 <main+0xa5>
lea    -0x6010(%rbp),%rdi
mov    -0x6014(%rbp),%edx
mov    0x2d30(%rip),%rax
mov    (%rax),%ecx
mov    $0x2,%esi
call   1050 <fwrite@plt>
jmp    1194 <main+0x64>
mov    0x2d20(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
lea    0xd5d(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
mov    -0x4(%rbp),%eax
add    $0x6020,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x6008,%rsp
mov    %edi,%eax
mov    0x2e8e(%rip),%rcx
mov    (%rcx),%edi
cmp    $0x2,%eax
jl     116a <main+0x3a>
lea    0xebc(%rip),%rsi
xor    %eax,%eax
call   1040 <fprintf@plt>
mov    $0x1,%r14d
jmp    133b <main+0x20b>
mov    %rsi,%r15
mov    (%rsi),%rdx
lea    0xeb1(%rip),%rsi
xor    %r14d,%r14d
xor    %eax,%eax
call   1040 <fprintf@plt>
mov    0x2e60(%rip),%r13
mov    0x0(%r13),%ecx
lea    0x2000(%rsp),%rdi
mov    $0x4,%esi
mov    $0x1000,%edx
call   1030 <fread@plt>
test   %eax,%eax
je     1321 <main+0x1f1>
xorps  %xmm6,%xmm6
movss  0xe59(%rip),%xmm8
xorps  %xmm7,%xmm7
movaps 0xe3f(%rip),%xmm5
pcmpeqd %xmm9,%xmm9
mov    0x2e03(%rip),%r12
mov    %rsp,%rbp
lea    0x2000(%rsp),%rbx
jmp    122c <main+0xfc>
nopw   0x0(%rax,%rax,1)
mov    (%r12),%ecx
mov    %rbp,%rdi
mov    $0x2,%esi
mov    %eax,%edx
call   1050 <fwrite@plt>
mov    0x0(%r13),%ecx
mov    %rbx,%rdi
mov    $0x4,%esi
mov    $0x1000,%edx
call   1030 <fread@plt>
pcmpeqd %xmm9,%xmm9
movaps 0xdeb(%rip),%xmm5
xorps  %xmm7,%xmm7
movss  0xdef(%rip),%xmm8
xorps  %xmm6,%xmm6
test   %eax,%eax
je     1321 <main+0x1f1>
test   %eax,%eax
jle    11e0 <main+0xb0>
mov    %eax,%ecx
cmp    $0x8,%eax
jae    1240 <main+0x110>
xor    %edx,%edx
jmp    1303 <main+0x1d3>
xchg   %ax,%ax
mov    %ecx,%edx
and    $0xfffffff8,%edx
xor    %esi,%esi
nopw   0x0(%rax,%rax,1)
movaps 0x2000(%rsp,%rsi,4),%xmm1
movaps 0x2010(%rsp,%rsi,4),%xmm2
movaps %xmm5,%xmm0
cmpnltps %xmm1,%xmm0
movaps %xmm1,%xmm3
cmpnleps %xmm7,%xmm3
andps  %xmm1,%xmm3
cmpltps %xmm7,%xmm1
orps   %xmm1,%xmm0
movaps %xmm5,%xmm1
cmpnltps %xmm2,%xmm1
movaps %xmm2,%xmm4
cmpnleps %xmm7,%xmm4
andps  %xmm2,%xmm4
cmpltps %xmm7,%xmm2
orps   %xmm2,%xmm1
cvttps2dq %xmm3,%xmm2
cvttps2dq %xmm4,%xmm3
andps  %xmm0,%xmm2
pshuflw $0xe8,%xmm2,%xmm2
pshufhw $0xe8,%xmm2,%xmm2
pshufd $0xe8,%xmm2,%xmm2
andps  %xmm1,%xmm3
pshuflw $0xe8,%xmm3,%xmm3
pshufhw $0xe8,%xmm3,%xmm3
pshufd $0xe8,%xmm3,%xmm3
punpcklqdq %xmm3,%xmm2
packssdw %xmm1,%xmm0
pxor   %xmm9,%xmm0
por    %xmm2,%xmm0
movdqa %xmm0,(%rsp,%rsi,2)
add    $0x8,%rsi
cmp    %rsi,%rdx
jne    1250 <main+0x120>
cmp    %rcx,%rdx
jne    1303 <main+0x1d3>
jmp    11e0 <main+0xb0>
nopl   0x0(%rax)
xor    %esi,%esi
mov    %si,(%rsp,%rdx,2)
add    $0x1,%rdx
cmp    %rdx,%rcx
je     11e0 <main+0xb0>
movss  0x2000(%rsp,%rdx,4),%xmm0
ucomiss %xmm0,%xmm6
ja     12f0 <main+0x1c0>
mov    $0xffff,%si
ucomiss %xmm8,%xmm0
ja     12f2 <main+0x1c2>
cvttss2si %xmm0,%esi
jmp    12f2 <main+0x1c2>
mov    0x2cb0(%rip),%rax
mov    (%rax),%edi
mov    (%r15),%rdx
lea    0xd01(%rip),%rsi
xor    %eax,%eax
call   1040 <fprintf@plt>
mov    %r14d,%eax
add    $0x6008,%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 = [13 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 float]
%7 = alloca [4096 x i16]
%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 %78
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 ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0), i8* %19)
br label %21
21: ; preds = %67, %15
%22 = getelementptr inbounds [4096 x float], [4096 x float]* %6, i64 0, i64 0
%23 = load i32, i32* @stdin
%24 = call i32 @fread(float* %22, i32 4, 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 %72
28: ; preds = %21
store i32 0, i32* %9
br label %29
29: ; preds = %64, %28
%30 = load i32, i32* %9
%31 = load i32, i32* %8
%32 = icmp slt i32 %30, %31
br i1 %32, label %33, label %67
33: ; preds = %29
%34 = load i32, i32* %9
%35 = sext i32 %34 to i64
%36 = getelementptr inbounds [4096 x float], [4096 x float]* %6, i64 0, i64 %35
%37 = load float, float* %36
%38 = fcmp olt float %37, 0.000000e+00
br i1 %38, label %39, label %43
39: ; preds = %33
%40 = load i32, i32* %9
%41 = sext i32 %40 to i64
%42 = getelementptr inbounds [4096 x i16], [4096 x i16]* %7, i64 0, i64 %41
store i16 0, i16* %42
br label %63
43: ; preds = %33
%44 = load i32, i32* %9
%45 = sext i32 %44 to i64
%46 = getelementptr inbounds [4096 x float], [4096 x float]* %6, i64 0, i64 %45
%47 = load float, float* %46
%48 = fcmp ogt float %47, 6.553500e+04
br i1 %48, label %49, label %53
49: ; preds = %43
%50 = load i32, i32* %9
%51 = sext i32 %50 to i64
%52 = getelementptr inbounds [4096 x i16], [4096 x i16]* %7, i64 0, i64 %51
store i16 -1, i16* %52
br label %62
53: ; preds = %43
%54 = load i32, i32* %9
%55 = sext i32 %54 to i64
%56 = getelementptr inbounds [4096 x float], [4096 x float]* %6, i64 0, i64 %55
%57 = load float, float* %56
%58 = fptoui float %57 to i16
%59 = load i32, i32* %9
%60 = sext i32 %59 to i64
%61 = getelementptr inbounds [4096 x i16], [4096 x i16]* %7, i64 0, i64 %60
store i16 %58, i16* %61
br label %62
62: ; preds = %53, %49
br label %63
63: ; preds = %62, %39
br label %64
64: ; preds = %63
%65 = load i32, i32* %9
%66 = add nsw i32 %65, 1
store i32 %66, i32* %9
br label %29
67: ; preds = %29
%68 = getelementptr inbounds [4096 x i16], [4096 x i16]* %7, i64 0, i64 0
%69 = load i32, i32* %8
%70 = load i32, i32* @stdout
%71 = call i32 @fwrite(i16* %68, i32 2, i32 %69, i32 %70)
br label %21
72: ; preds = %27
%73 = load i32, i32* @stderr
%74 = load i8**, i8*** %5
%75 = getelementptr inbounds i8*, i8** %74, i64 0
%76 = load i8*, i8** %75
%77 = call i32 (i32, i8*, ...) @fprintf(i32 %73, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0), i8* %76)
br label %78
78: ; preds = %72, %12
%79 = load i32, i32* %3
ret i32 %79
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [20 x i8] c"< entrada > salida\0A\00"
@.str.1 = [13 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 float]
%4 = alloca [4096 x i16]
%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 %84
9: ; preds = %2
%10 = load i8*, i8** %1
%11 = tail call i32 (i32, i8*, ...) @fprintf(i32 %6, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0), i8* %10)
%12 = bitcast [4096 x float]* %3 to i8*
%13 = bitcast [4096 x i16]* %4 to i8*
%14 = getelementptr inbounds [4096 x float], [4096 x float]* %3, i64 0, i64 0
%15 = load i32, i32* @stdin
%16 = call i32 @fread(float* %14, i32 4, i32 4096, i32 %15)
%17 = icmp eq i32 %16, 0
br i1 %17, label %80, label %18
18: ; preds = %9
%19 = getelementptr inbounds [4096 x i16], [4096 x i16]* %4, i64 0, i64 0
br label %20
20: ; preds = %18, %74
%21 = phi i32 [ %16, %18 ], [ %78, %74 ]
%22 = icmp sgt i32 %21, 0
br i1 %22, label %23, label %74
23: ; preds = %20
%24 = zext i32 %21 to i64
%25 = icmp ult i32 %21, 8
br i1 %25, label %58, label %26
26: ; preds = %23
%27 = and i64 %24, 4294967288
br label %28
28: ; preds = %28, %26
%29 = phi i64 [ 0, %26 ], [ %54, %28 ]
%30 = getelementptr inbounds [4096 x float], [4096 x float]* %3, i64 0, i64 %29
%31 = bitcast float* %30 to <4 x float>*
%32 = load <4 x float>, <4 x float>* %31
%33 = getelementptr inbounds float, float* %30, i64 4
%34 = bitcast float* %33 to <4 x float>*
%35 = load <4 x float>, <4 x float>* %34
%36 = fcmp olt <4 x float> %32, zeroinitializer
%37 = fcmp olt <4 x float> %35, zeroinitializer
%38 = fcmp ule <4 x float> %32, <float 6.553500e+04, float 6.553500e+04, float 6.553500e+04, float 6.553500e+04>
%39 = fcmp ule <4 x float> %35, <float 6.553500e+04, float 6.553500e+04, float 6.553500e+04, float 6.553500e+04>
%40 = or <4 x i1> %36, %38
%41 = or <4 x i1> %37, %39
%42 = fcmp ole <4 x float> %32, zeroinitializer
%43 = select <4 x i1> %42, <4 x float> zeroinitializer, <4 x float> %32
%44 = fptoui <4 x float> %43 to <4 x i16>
%45 = fcmp ole <4 x float> %35, zeroinitializer
%46 = select <4 x i1> %45, <4 x float> zeroinitializer, <4 x float> %35
%47 = fptoui <4 x float> %46 to <4 x i16>
%48 = select <4 x i1> %40, <4 x i16> %44, <4 x i16> <i16 -1, i16 -1, i16 -1, i16 -1>
%49 = select <4 x i1> %41, <4 x i16> %47, <4 x i16> <i16 -1, i16 -1, i16 -1, i16 -1>
%50 = getelementptr inbounds [4096 x i16], [4096 x i16]* %4, i64 0, i64 %29
%51 = bitcast i16* %50 to <4 x i16>*
store <4 x i16> %48, <4 x i16>* %51
%52 = getelementptr inbounds i16, i16* %50, i64 4
%53 = bitcast i16* %52 to <4 x i16>*
store <4 x i16> %49, <4 x i16>* %53
%54 = add nuw i64 %29, 8
%55 = icmp eq i64 %54, %27
br i1 %55, label %56, label %28
56: ; preds = %28
%57 = icmp eq i64 %27, %24
br i1 %57, label %74, label %58
58: ; preds = %23, %56
%59 = phi i64 [ 0, %23 ], [ %27, %56 ]
br label %60
60: ; preds = %58, %69
%61 = phi i64 [ %72, %69 ], [ %59, %58 ]
%62 = getelementptr inbounds [4096 x float], [4096 x float]* %3, i64 0, i64 %61
%63 = load float, float* %62
%64 = fcmp olt float %63, 0.000000e+00
br i1 %64, label %69, label %65
65: ; preds = %60
%66 = fcmp ogt float %63, 6.553500e+04
br i1 %66, label %69, label %67
67: ; preds = %65
%68 = fptoui float %63 to i16
br label %69
69: ; preds = %65, %60, %67
%70 = phi i16 [ %68, %67 ], [ 0, %60 ], [ -1, %65 ]
%71 = getelementptr inbounds [4096 x i16], [4096 x i16]* %4, i64 0, i64 %61
store i16 %70, i16* %71
%72 = add nuw nsw i64 %61, 1
%73 = icmp eq i64 %72, %24
br i1 %73, label %74, label %60
74: ; preds = %69, %56, %20
%75 = load i32, i32* @stdout
%76 = call i32 @fwrite(i16* %19, i32 2, i32 %21, i32 %75)
%77 = load i32, i32* @stdin
%78 = call i32 @fread(float* %14, i32 4, i32 4096, i32 %77)
%79 = icmp eq i32 %78, 0
br i1 %79, label %80, label %20
80: ; preds = %74, %9
%81 = load i32, i32* @stderr
%82 = load i8*, i8** %1
%83 = call i32 (i32, i8*, ...) @fprintf(i32 %81, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0), i8* %82)
br label %84
84: ; preds = %80, %7
%85 = phi i32 [ 1, %7 ], [ 0, %80 ]
ret i32 %85
}