#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(unsigned char *, 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];
    unsigned char y[4096];
    int r = fread(x, sizeof(double), 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] > 255)
          y[i] = 255;
        else
          y[i] = (unsigned char)x[i];
      }
    }
    fwrite(y, sizeof(unsigned char), r, stdout);
  }
  fprintf(stderr, "%s: done\n", argv[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    0xea5(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
jmp    12cb <main+0x19b>
mov    0x2e5b(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
lea    0xe8f(%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,-0x9014(%rbp)
cmpl   $0x0,-0x9014(%rbp)
jne    11cb <main+0x9b>
jmp    12ad <main+0x17d>
movl   $0x0,-0x9018(%rbp)
mov    -0x9018(%rbp),%eax
cmp    -0x9014(%rbp),%eax
jge    1288 <main+0x158>
movslq -0x9018(%rbp),%rax
xorps  %xmm0,%xmm0
ucomisd -0x8010(%rbp,%rax,8),%xmm0
ff ff
jbe    1214 <main+0xe4>
movslq -0x9018(%rbp),%rax
movb   $0x0,-0x9010(%rbp,%rax,1)
jmp    126f <main+0x13f>
movslq -0x9018(%rbp),%rax
movsd  -0x8010(%rbp,%rax,8),%xmm0
ff ff
movsd  0xdd4(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    124a <main+0x11a>
movslq -0x9018(%rbp),%rax
movb   $0xff,-0x9010(%rbp,%rax,1)
ff
jmp    126a <main+0x13a>
movslq -0x9018(%rbp),%rax
cvttsd2si -0x8010(%rbp,%rax,8),%eax
ff ff
mov    %al,%cl
movslq -0x9018(%rbp),%rax
mov    %cl,-0x9010(%rbp,%rax,1)
jmp    126f <main+0x13f>
jmp    1274 <main+0x144>
mov    -0x9018(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x9018(%rbp)
jmp    11d5 <main+0xa5>
lea    -0x9010(%rbp),%rdi
mov    -0x9014(%rbp),%edx
mov    0x2d34(%rip),%rax
mov    (%rax),%ecx
mov    $0x1,%esi
call   1050 <fwrite@plt>
jmp    1194 <main+0x64>
mov    0x2d24(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
lea    0xd65(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
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     116a <main+0x3a>
lea    0xeb0(%rip),%rsi
xor    %eax,%eax
call   1040 <fprintf@plt>
mov    $0x1,%r14d
jmp    12c9 <main+0x199>
mov    %rsi,%r15
mov    (%rsi),%rdx
lea    0xea5(%rip),%rsi
xor    %r14d,%r14d
xor    %eax,%eax
call   1040 <fprintf@plt>
mov    0x2e60(%rip),%r13
mov    0x0(%r13),%ecx
lea    0x1000(%rsp),%rdi
mov    $0x8,%esi
mov    $0x1000,%edx
call   1030 <fread@plt>
test   %eax,%eax
je     12af <main+0x17f>
xorpd  %xmm1,%xmm1
movsd  0xe49(%rip),%xmm2
mov    0x2e12(%rip),%r12
mov    %rsp,%rbp
lea    0x1000(%rsp),%rbx
jmp    120d <main+0xdd>
xor    %edx,%edx
mov    %dl,(%rsp,%rcx,1)
mov    (%r12),%ecx
mov    %rbp,%rdi
mov    $0x1,%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>
movsd  0xdff(%rip),%xmm2
xorpd  %xmm1,%xmm1
test   %eax,%eax
je     12af <main+0x17f>
test   %eax,%eax
jle    11d0 <main+0xa0>
mov    %eax,%edx
cmp    $0x1,%eax
jne    1240 <main+0x110>
xor    %ecx,%ecx
test   $0x1,%dl
je     11d0 <main+0xa0>
movsd  0x1000(%rsp,%rcx,8),%xmm0
ucomisd %xmm0,%xmm1
ja     11cb <main+0x9b>
mov    $0xff,%dl
ucomisd %xmm2,%xmm0
ja     11cd <main+0x9d>
cvttsd2si %xmm0,%edx
jmp    11cd <main+0x9d>
nopl   0x0(%rax)
mov    %edx,%esi
and    $0xfffffffe,%esi
xor    %ecx,%ecx
jmp    1260 <main+0x130>
nopl   0x0(%rax)
xor    %edi,%edi
mov    %dil,0x1(%rsp,%rcx,1)
add    $0x2,%rcx
cmp    %rcx,%rsi
je     121a <main+0xea>
movsd  0x1000(%rsp,%rcx,8),%xmm0
ucomisd %xmm0,%xmm1
jbe    1280 <main+0x150>
xor    %edi,%edi
jmp    128d <main+0x15d>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    $0xff,%dil
ucomisd %xmm2,%xmm0
ja     128d <main+0x15d>
cvttsd2si %xmm0,%edi
mov    %dil,(%rsp,%rcx,1)
movsd  0x1008(%rsp,%rcx,8),%xmm0
ucomisd %xmm0,%xmm1
ja     1250 <main+0x120>
mov    $0xff,%dil
ucomisd %xmm2,%xmm0
ja     1252 <main+0x122>
cvttsd2si %xmm0,%edi
jmp    1252 <main+0x122>
mov    0x2d22(%rip),%rax
mov    (%rax),%edi
mov    (%r15),%rdx
lea    0xd67(%rip),%rsi
xor    %eax,%eax
call   1040 <fprintf@plt>
mov    %r14d,%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 = [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 double]
%7 = alloca [4096 x i8]
%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 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 %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 double], [4096 x double]* %6, i64 0, i64 %35
%37 = load double, double* %36
%38 = fcmp olt double %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 i8], [4096 x i8]* %7, i64 0, i64 %41
store i8 0, i8* %42
br label %63
43: ; preds = %33
%44 = load i32, i32* %9
%45 = sext i32 %44 to i64
%46 = getelementptr inbounds [4096 x double], [4096 x double]* %6, i64 0, i64 %45
%47 = load double, double* %46
%48 = fcmp ogt double %47, 2.550000e+02
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 i8], [4096 x i8]* %7, i64 0, i64 %51
store i8 -1, i8* %52
br label %62
53: ; preds = %43
%54 = load i32, i32* %9
%55 = sext i32 %54 to i64
%56 = getelementptr inbounds [4096 x double], [4096 x double]* %6, i64 0, i64 %55
%57 = load double, double* %56
%58 = fptoui double %57 to i8
%59 = load i32, i32* %9
%60 = sext i32 %59 to i64
%61 = getelementptr inbounds [4096 x i8], [4096 x i8]* %7, i64 0, i64 %60
store i8 %58, i8* %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 i8], [4096 x i8]* %7, i64 0, i64 0
%69 = load i32, i32* %8
%70 = load i32, i32* @stdout
%71 = call i32 @fwrite(i8* %68, i32 1, 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 double]
%4 = alloca [4096 x i8]
%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 %78
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 double]* %3 to i8*
%13 = getelementptr inbounds [4096 x i8], [4096 x i8]* %4, i64 0, i64 0
%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 %74, label %18
18: ; preds = %9, %68
%19 = phi i32 [ %72, %68 ], [ %16, %9 ]
%20 = icmp sgt i32 %19, 0
br i1 %20, label %21, label %68
21: ; preds = %18
%22 = zext i32 %19 to i64
%23 = and i64 %22, 1
%24 = icmp eq i32 %19, 1
br i1 %24, label %54, label %25
25: ; preds = %21
%26 = and i64 %22, 4294967294
br label %27
27: ; preds = %48, %25
%28 = phi i64 [ 0, %25 ], [ %51, %48 ]
%29 = phi i64 [ 0, %25 ], [ %52, %48 ]
%30 = getelementptr inbounds [4096 x double], [4096 x double]* %3, i64 0, i64 %28
%31 = load double, double* %30
%32 = fcmp olt double %31, 0.000000e+00
br i1 %32, label %37, label %33
33: ; preds = %27
%34 = fcmp ogt double %31, 2.550000e+02
br i1 %34, label %37, label %35
35: ; preds = %33
%36 = fptoui double %31 to i8
br label %37
37: ; preds = %33, %27, %35
%38 = phi i8 [ %36, %35 ], [ 0, %27 ], [ -1, %33 ]
%39 = getelementptr inbounds [4096 x i8], [4096 x i8]* %4, i64 0, i64 %28
store i8 %38, i8* %39
%40 = or i64 %28, 1
%41 = getelementptr inbounds [4096 x double], [4096 x double]* %3, i64 0, i64 %40
%42 = load double, double* %41
%43 = fcmp olt double %42, 0.000000e+00
br i1 %43, label %48, label %44
44: ; preds = %37
%45 = fcmp ogt double %42, 2.550000e+02
br i1 %45, label %48, label %46
46: ; preds = %44
%47 = fptoui double %42 to i8
br label %48
48: ; preds = %46, %44, %37
%49 = phi i8 [ %47, %46 ], [ 0, %37 ], [ -1, %44 ]
%50 = getelementptr inbounds [4096 x i8], [4096 x i8]* %4, i64 0, i64 %40
store i8 %49, i8* %50
%51 = add nuw nsw i64 %28, 2
%52 = add i64 %29, 2
%53 = icmp eq i64 %52, %26
br i1 %53, label %54, label %27
54: ; preds = %48, %21
%55 = phi i64 [ 0, %21 ], [ %51, %48 ]
%56 = icmp eq i64 %23, 0
br i1 %56, label %68, label %57
57: ; preds = %54
%58 = getelementptr inbounds [4096 x double], [4096 x double]* %3, i64 0, i64 %55
%59 = load double, double* %58
%60 = fcmp olt double %59, 0.000000e+00
br i1 %60, label %65, label %61
61: ; preds = %57
%62 = fcmp ogt double %59, 2.550000e+02
br i1 %62, label %65, label %63
63: ; preds = %61
%64 = fptoui double %59 to i8
br label %65
65: ; preds = %63, %61, %57
%66 = phi i8 [ %64, %63 ], [ 0, %57 ], [ -1, %61 ]
%67 = getelementptr inbounds [4096 x i8], [4096 x i8]* %4, i64 0, i64 %55
store i8 %66, i8* %67
br label %68
68: ; preds = %65, %54, %18
%69 = load i32, i32* @stdout
%70 = call i32 @fwrite(i8* %13, i32 1, i32 %19, i32 %69)
%71 = load i32, i32* @stdin
%72 = call i32 @fread(double* %14, i32 8, i32 4096, i32 %71)
%73 = icmp eq i32 %72, 0
br i1 %73, label %74, label %18
74: ; preds = %68, %9
%75 = load i32, i32* @stderr
%76 = load i8*, i8** %1
%77 = call i32 (i32, i8*, ...) @fprintf(i32 %75, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0), i8* %76)
br label %78
78: ; preds = %74, %7
%79 = phi i32 [ 1, %7 ], [ 0, %74 ]
ret i32 %79
}