#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 */
float INT_MAX;
float INT_MIN;
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
int fread(float *, int, int, int /*<<< orphan*/);
int /*<<< orphan*/ fwrite(int *, 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");
    fprintf(stderr, "Transforma float's en int's\n");
    return 1;
  }
  fprintf(stderr, "%s: running\n", argv[0]);
  for (;;) {
    float x[4096];
    int 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] < INT_MIN)
          y[i] = INT_MIN;
        else if (x[i] > INT_MAX)
          y[i] = INT_MAX;
        else
          y[i] = (int)x[i];
      }
    }
    fwrite(y, sizeof(int), r, stdout);
  }
  fprintf(stderr, "%s: done\n", argv[0]);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x8020,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x1,-0x8(%rbp)
jle    118d <main+0x5d>
mov    0x2e6e(%rip),%rax
mov    (%rax),%edi
lea    0xe9d(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
mov    0x2e57(%rip),%rax
mov    (%rax),%edi
lea    0xe9a(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
jmp    12fd <main+0x1cd>
mov    0x2e34(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
lea    0xe8d(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
lea    -0x4010(%rbp),%rdi
mov    0x2e2f(%rip),%rax
mov    (%rax),%ecx
mov    $0x4,%esi
mov    $0x1000,%edx
call   1030 <fread@plt>
mov    %eax,-0x8014(%rbp)
cmpl   $0x0,-0x8014(%rbp)
jne    11e2 <main+0xb2>
jmp    12df <main+0x1af>
movl   $0x0,-0x8018(%rbp)
mov    -0x8018(%rbp),%eax
cmp    -0x8014(%rbp),%eax
jge    12ba <main+0x18a>
movslq -0x8018(%rbp),%rax
movss  -0x4010(%rbp,%rax,4),%xmm1
ff ff
mov    0x2dc3(%rip),%rax
movss  (%rax),%xmm0
ucomiss %xmm1,%xmm0
jbe    1240 <main+0x110>
mov    0x2daf(%rip),%rax
cvttss2si (%rax),%ecx
movslq -0x8018(%rbp),%rax
mov    %ecx,-0x8010(%rbp,%rax,4)
jmp    12a1 <main+0x171>
movslq -0x8018(%rbp),%rax
movss  -0x4010(%rbp,%rax,4),%xmm0
ff ff
mov    0x2d89(%rip),%rax
ucomiss (%rax),%xmm0
jbe    127e <main+0x14e>
mov    0x2d79(%rip),%rax
cvttss2si (%rax),%ecx
movslq -0x8018(%rbp),%rax
mov    %ecx,-0x8010(%rbp,%rax,4)
jmp    129c <main+0x16c>
movslq -0x8018(%rbp),%rax
cvttss2si -0x4010(%rbp,%rax,4),%ecx
ff ff
movslq -0x8018(%rbp),%rax
mov    %ecx,-0x8010(%rbp,%rax,4)
jmp    12a1 <main+0x171>
jmp    12a6 <main+0x176>
mov    -0x8018(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8018(%rbp)
jmp    11ec <main+0xbc>
lea    -0x8010(%rbp),%rdi
mov    -0x8014(%rbp),%edx
mov    0x2cf2(%rip),%rax
mov    (%rax),%ecx
mov    $0x4,%esi
call   1050 <fwrite@plt>
jmp    11ab <main+0x7b>
mov    0x2ce2(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
lea    0xd48(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
mov    -0x4(%rbp),%eax
add    $0x8020,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x8018,%rsp
mov    %edi,%eax
mov    0x2e7e(%rip),%rbx
mov    (%rbx),%edi
cmp    $0x2,%eax
jl     1179 <main+0x49>
lea    0xea8(%rip),%rsi
xor    %eax,%eax
call   1040 <fprintf@plt>
mov    (%rbx),%edi
lea    0xeac(%rip),%rsi
xor    %eax,%eax
call   1040 <fprintf@plt>
mov    $0x1,%eax
jmp    1336 <main+0x206>
mov    %rsi,0x8(%rsp)
mov    (%rsi),%rdx
lea    0xea9(%rip),%rsi
xor    %eax,%eax
call   1040 <fprintf@plt>
mov    0x2e52(%rip),%r13
mov    0x0(%r13),%ecx
lea    0x10(%rsp),%rdi
mov    $0x4,%esi
mov    $0x1000,%edx
call   1030 <fread@plt>
test   %eax,%eax
je     1315 <main+0x1e5>
mov    0x2e1b(%rip),%r12
mov    0x2e1c(%rip),%r14
mov    0x2df5(%rip),%r15
lea    0x4010(%rsp),%rbp
lea    0x10(%rsp),%rbx
jmp    1210 <main+0xe0>
nopw   0x0(%rax,%rax,1)
mov    (%r15),%ecx
mov    %rbp,%rdi
mov    $0x4,%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>
test   %eax,%eax
je     1315 <main+0x1e5>
test   %eax,%eax
jle    11e0 <main+0xb0>
movss  (%r12),%xmm1
movss  (%r14),%xmm8
mov    %eax,%ecx
cmp    $0x8,%eax
jae    1230 <main+0x100>
xor    %edx,%edx
jmp    12f8 <main+0x1c8>
nopl   (%rax)
mov    %ecx,%edx
and    $0xfffffff8,%edx
movaps %xmm1,%xmm0
shufps $0x0,%xmm1,%xmm0
movaps %xmm8,%xmm3
shufps $0x0,%xmm8,%xmm3
lea    0x0(,%rcx,4),%rsi
and    $0xffffffffffffffe0,%rsi
xor    %edi,%edi
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
movaps 0x10(%rsp,%rdi,1),%xmm4
movaps 0x20(%rsp,%rdi,1),%xmm5
movaps %xmm3,%xmm6
cmpltps %xmm4,%xmm6
movaps %xmm0,%xmm7
maxps  %xmm4,%xmm7
cmpnltps %xmm0,%xmm4
andps  %xmm4,%xmm6
movaps %xmm3,%xmm4
cmpltps %xmm5,%xmm4
movaps %xmm0,%xmm2
maxps  %xmm5,%xmm2
cmpnltps %xmm0,%xmm5
andps  %xmm5,%xmm4
movaps %xmm3,%xmm5
andps  %xmm6,%xmm5
andnps %xmm7,%xmm6
orps   %xmm5,%xmm6
movaps %xmm3,%xmm5
andps  %xmm4,%xmm5
andnps %xmm2,%xmm4
orps   %xmm5,%xmm4
cvttps2dq %xmm6,%xmm2
cvttps2dq %xmm4,%xmm4
movaps %xmm2,0x4010(%rsp,%rdi,1)
movaps %xmm4,0x4020(%rsp,%rdi,1)
add    $0x20,%rdi
cmp    %rdi,%rsi
jne    1260 <main+0x130>
cmp    %rcx,%rdx
jne    12f8 <main+0x1c8>
jmp    11e0 <main+0xb0>
cs nopw 0x0(%rax,%rax,1)
nop
cvttss2si %xmm3,%esi
mov    %esi,0x4010(%rsp,%rdx,4)
add    $0x1,%rdx
cmp    %rdx,%rcx
je     11e0 <main+0xb0>
movss  0x10(%rsp,%rdx,4),%xmm2
ucomiss %xmm2,%xmm1
movaps %xmm1,%xmm3
ja     12e0 <main+0x1b0>
ucomiss %xmm8,%xmm2
movaps %xmm8,%xmm3
ja     12e0 <main+0x1b0>
movaps %xmm2,%xmm3
jmp    12e0 <main+0x1b0>
mov    0x2cac(%rip),%rax
mov    (%rax),%edi
mov    0x8(%rsp),%rax
mov    (%rax),%rdx
lea    0xd11(%rip),%rsi
xor    %eax,%eax
call   1040 <fprintf@plt>
xor    %eax,%eax
add    $0x8018,%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 = [29 x i8] c"Transforma float's en int's\0A\00"
@.str.2 = [13 x i8] c"%s: running\0A\00"
@stdin = global i32 0
@INT_MIN = global float 0.000000e+00
@INT_MAX = global float 0.000000e+00
@stdout = global i32 0
@.str.3 = [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 i32]
%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 %17
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))
%15 = load i32, i32* @stderr
%16 = call i32 (i32, i8*, ...) @fprintf(i32 %15, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0))
store i32 1, i32* %3
br label %86
17: ; preds = %2
%18 = load i32, i32* @stderr
%19 = load i8**, i8*** %5
%20 = getelementptr inbounds i8*, i8** %19, i64 0
%21 = load i8*, i8** %20
%22 = call i32 (i32, i8*, ...) @fprintf(i32 %18, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0), i8* %21)
br label %23
23: ; preds = %75, %17
%24 = getelementptr inbounds [4096 x float], [4096 x float]* %6, i64 0, i64 0
%25 = load i32, i32* @stdin
%26 = call i32 @fread(float* %24, i32 4, i32 4096, i32 %25)
store i32 %26, i32* %8
%27 = load i32, i32* %8
%28 = icmp eq i32 %27, 0
br i1 %28, label %29, label %30
29: ; preds = %23
br label %80
30: ; preds = %23
store i32 0, i32* %9
br label %31
31: ; preds = %72, %30
%32 = load i32, i32* %9
%33 = load i32, i32* %8
%34 = icmp slt i32 %32, %33
br i1 %34, label %35, label %75
35: ; preds = %31
%36 = load i32, i32* %9
%37 = sext i32 %36 to i64
%38 = getelementptr inbounds [4096 x float], [4096 x float]* %6, i64 0, i64 %37
%39 = load float, float* %38
%40 = load float, float* @INT_MIN
%41 = fcmp olt float %39, %40
br i1 %41, label %42, label %48
42: ; preds = %35
%43 = load float, float* @INT_MIN
%44 = fptosi float %43 to i32
%45 = load i32, i32* %9
%46 = sext i32 %45 to i64
%47 = getelementptr inbounds [4096 x i32], [4096 x i32]* %7, i64 0, i64 %46
store i32 %44, i32* %47
br label %71
48: ; preds = %35
%49 = load i32, i32* %9
%50 = sext i32 %49 to i64
%51 = getelementptr inbounds [4096 x float], [4096 x float]* %6, i64 0, i64 %50
%52 = load float, float* %51
%53 = load float, float* @INT_MAX
%54 = fcmp ogt float %52, %53
br i1 %54, label %55, label %61
55: ; preds = %48
%56 = load float, float* @INT_MAX
%57 = fptosi float %56 to i32
%58 = load i32, i32* %9
%59 = sext i32 %58 to i64
%60 = getelementptr inbounds [4096 x i32], [4096 x i32]* %7, i64 0, i64 %59
store i32 %57, i32* %60
br label %70
61: ; preds = %48
%62 = load i32, i32* %9
%63 = sext i32 %62 to i64
%64 = getelementptr inbounds [4096 x float], [4096 x float]* %6, i64 0, i64 %63
%65 = load float, float* %64
%66 = fptosi float %65 to i32
%67 = load i32, i32* %9
%68 = sext i32 %67 to i64
%69 = getelementptr inbounds [4096 x i32], [4096 x i32]* %7, i64 0, i64 %68
store i32 %66, i32* %69
br label %70
70: ; preds = %61, %55
br label %71
71: ; preds = %70, %42
br label %72
72: ; preds = %71
%73 = load i32, i32* %9
%74 = add nsw i32 %73, 1
store i32 %74, i32* %9
br label %31
75: ; preds = %31
%76 = getelementptr inbounds [4096 x i32], [4096 x i32]* %7, i64 0, i64 0
%77 = load i32, i32* %8
%78 = load i32, i32* @stdout
%79 = call i32 @fwrite(i32* %76, i32 4, i32 %77, i32 %78)
br label %23
80: ; preds = %29
%81 = load i32, i32* @stderr
%82 = load i8**, i8*** %5
%83 = getelementptr inbounds i8*, i8** %82, i64 0
%84 = load i8*, i8** %83
%85 = call i32 (i32, i8*, ...) @fprintf(i32 %81, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0), i8* %84)
br label %86
86: ; preds = %80, %12
%87 = load i32, i32* %3
ret i32 %87
}

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