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


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x5020,%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    12bf <main+0x18f>
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    -0x4010(%rbp),%rdi
mov    0x2e46(%rip),%rax
mov    (%rax),%ecx
mov    $0x4,%esi
mov    $0x1000,%edx
call   1030 <fread@plt>
mov    %eax,-0x5014(%rbp)
cmpl   $0x0,-0x5014(%rbp)
jne    11cb <main+0x9b>
jmp    129a <main+0x16a>
movl   $0x0,-0x5018(%rbp)
mov    -0x5018(%rbp),%eax
cmp    -0x5014(%rbp),%eax
jge    1275 <main+0x145>
movslq -0x5018(%rbp),%rax
cmpl   $0xffffff80,-0x4010(%rbp,%rax,4)
80
jge    1210 <main+0xe0>
movslq -0x5018(%rbp),%rax
movb   $0x80,-0x5010(%rbp,%rax,1)
80
jmp    125c <main+0x12c>
movslq -0x5018(%rbp),%rax
cmpl   $0x7f,-0x4010(%rbp,%rax,4)
7f
jle    1239 <main+0x109>
movslq -0x5018(%rbp),%rax
movb   $0x7f,-0x5010(%rbp,%rax,1)
7f
jmp    1257 <main+0x127>
movslq -0x5018(%rbp),%rax
mov    -0x4010(%rbp,%rax,4),%eax
mov    %al,%cl
movslq -0x5018(%rbp),%rax
mov    %cl,-0x5010(%rbp,%rax,1)
jmp    125c <main+0x12c>
jmp    1261 <main+0x131>
mov    -0x5018(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x5018(%rbp)
jmp    11d5 <main+0xa5>
lea    -0x5010(%rbp),%rdi
mov    -0x5014(%rbp),%edx
mov    0x2d47(%rip),%rax
mov    (%rax),%ecx
mov    $0x1,%esi
call   1050 <fwrite@plt>
jmp    1194 <main+0x64>
mov    0x2d37(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
lea    0xd74(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x5020,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x5018,%rsp
mov    %edi,%eax
mov    0x2e8e(%rip),%rcx
mov    (%rcx),%edi
cmp    $0x2,%eax
jl     1169 <main+0x39>
lea    0xed8(%rip),%rsi
xor    %eax,%eax
call   1040 <fprintf@plt>
mov    $0x1,%eax
jmp    1349 <main+0x219>
mov    %rsi,0x8(%rsp)
mov    (%rsi),%rdx
lea    0xecc(%rip),%rsi
xor    %eax,%eax
call   1040 <fprintf@plt>
mov    0x2e62(%rip),%r13
mov    0x0(%r13),%ecx
lea    0x1010(%rsp),%rdi
mov    $0x4,%esi
mov    $0x1000,%edx
call   1030 <fread@plt>
test   %eax,%eax
je     1328 <main+0x1f8>
mov    $0x7f,%r12d
mov    $0x80,%r14d
movdqa 0xe43(%rip),%xmm3
movdqa 0xe4b(%rip),%xmm4
movdqa 0xe53(%rip),%xmm5
mov    0x2dfc(%rip),%r15
lea    0x10(%rsp),%rbp
lea    0x1010(%rsp),%rbx
jmp    1238 <main+0x108>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    (%r15),%ecx
mov    %rbp,%rdi
mov    $0x1,%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>
movdqa 0xe00(%rip),%xmm5
movdqa 0xde8(%rip),%xmm4
movdqa 0xdd0(%rip),%xmm3
test   %eax,%eax
je     1328 <main+0x1f8>
test   %eax,%eax
jle    11f0 <main+0xc0>
mov    %eax,%ecx
cmp    $0x8,%eax
jae    1250 <main+0x120>
xor    %edx,%edx
jmp    1300 <main+0x1d0>
nopw   0x0(%rax,%rax,1)
mov    %ecx,%edx
and    $0xfffffff8,%edx
xor    %esi,%esi
nopw   0x0(%rax,%rax,1)
movdqa 0x1010(%rsp,%rsi,4),%xmm0
movdqa 0x1020(%rsp,%rsi,4),%xmm1
movdqa %xmm3,%xmm2
pcmpgtd %xmm0,%xmm2
pand   %xmm2,%xmm0
pandn  %xmm3,%xmm2
por    %xmm0,%xmm2
movdqa %xmm3,%xmm0
pcmpgtd %xmm1,%xmm0
pand   %xmm0,%xmm1
pandn  %xmm3,%xmm0
por    %xmm1,%xmm0
movdqa %xmm2,%xmm1
pcmpgtd %xmm4,%xmm1
pand   %xmm1,%xmm2
pandn  %xmm4,%xmm1
por    %xmm2,%xmm1
movdqa %xmm0,%xmm2
pcmpgtd %xmm4,%xmm2
pand   %xmm2,%xmm0
pandn  %xmm4,%xmm2
por    %xmm0,%xmm2
pand   %xmm5,%xmm1
packuswb %xmm1,%xmm1
packuswb %xmm1,%xmm1
pand   %xmm5,%xmm2
packuswb %xmm2,%xmm2
packuswb %xmm2,%xmm2
movd   %xmm1,0x10(%rsp,%rsi,1)
movd   %xmm2,0x14(%rsp,%rsi,1)
add    $0x8,%rsi
cmp    %rsi,%rdx
jne    1260 <main+0x130>
cmp    %rcx,%rdx
je     11f0 <main+0xc0>
nopl   0x0(%rax)
mov    0x1010(%rsp,%rdx,4),%esi
cmp    $0x7f,%esi
cmovge %r12d,%esi
cmp    $0xffffff81,%esi
cmovl  %r14d,%esi
mov    %sil,0x10(%rsp,%rdx,1)
add    $0x1,%rdx
cmp    %rdx,%rcx
jne    1300 <main+0x1d0>
jmp    11f0 <main+0xc0>
mov    0x2ca9(%rip),%rax
mov    (%rax),%edi
mov    0x8(%rsp),%rax
mov    (%rax),%rdx
lea    0xd15(%rip),%rsi
xor    %eax,%eax
call   1040 <fprintf@plt>
xor    %eax,%eax
add    $0x5018,%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 i32]
%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 ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0), i8* %19)
br label %21
21: ; preds = %67, %15
%22 = getelementptr inbounds [4096 x i32], [4096 x i32]* %6, i64 0, i64 0
%23 = load i32, i32* @stdin
%24 = call i32 @fread(i32* %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 i32], [4096 x i32]* %6, i64 0, i64 %35
%37 = load i32, i32* %36
%38 = icmp slt i32 %37, -128
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 -128, i8* %42
br label %63
43: ; preds = %33
%44 = load i32, i32* %9
%45 = sext i32 %44 to i64
%46 = getelementptr inbounds [4096 x i32], [4096 x i32]* %6, i64 0, i64 %45
%47 = load i32, i32* %46
%48 = icmp sgt i32 %47, 127
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 127, i8* %52
br label %62
53: ; preds = %43
%54 = load i32, i32* %9
%55 = sext i32 %54 to i64
%56 = getelementptr inbounds [4096 x i32], [4096 x i32]* %6, i64 0, i64 %55
%57 = load i32, i32* %56
%58 = trunc i32 %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)
store i32 0, i32* %3
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 = [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 i32]
%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 %76
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 i32]* %3 to i8*
%13 = getelementptr inbounds [4096 x i8], [4096 x i8]* %4, i64 0, i64 0
%14 = getelementptr inbounds [4096 x i32], [4096 x i32]* %3, i64 0, i64 0
%15 = load i32, i32* @stdin
%16 = call i32 @fread(i32* %14, i32 4, i32 4096, i32 %15)
%17 = icmp eq i32 %16, 0
br i1 %17, label %72, label %18
18: ; preds = %9, %66
%19 = phi i32 [ %70, %66 ], [ %16, %9 ]
%20 = icmp sgt i32 %19, 0
br i1 %20, label %21, label %66
21: ; preds = %18
%22 = zext i32 %19 to i64
%23 = icmp ult i32 %19, 8
br i1 %23, label %52, label %24
24: ; preds = %21
%25 = and i64 %22, 4294967288
br label %26
26: ; preds = %26, %24
%27 = phi i64 [ 0, %24 ], [ %48, %26 ]
%28 = getelementptr inbounds [4096 x i32], [4096 x i32]* %3, i64 0, i64 %27
%29 = bitcast i32* %28 to <4 x i32>*
%30 = load <4 x i32>, <4 x i32>* %29
%31 = getelementptr inbounds i32, i32* %28, i64 4
%32 = bitcast i32* %31 to <4 x i32>*
%33 = load <4 x i32>, <4 x i32>* %32
%34 = icmp slt <4 x i32> %30, <i32 127, i32 127, i32 127, i32 127>
%35 = icmp slt <4 x i32> %33, <i32 127, i32 127, i32 127, i32 127>
%36 = select <4 x i1> %34, <4 x i32> %30, <4 x i32> <i32 127, i32 127, i32 127, i32 127>
%37 = select <4 x i1> %35, <4 x i32> %33, <4 x i32> <i32 127, i32 127, i32 127, i32 127>
%38 = icmp sgt <4 x i32> %36, <i32 -128, i32 -128, i32 -128, i32 -128>
%39 = icmp sgt <4 x i32> %37, <i32 -128, i32 -128, i32 -128, i32 -128>
%40 = select <4 x i1> %38, <4 x i32> %36, <4 x i32> <i32 -128, i32 -128, i32 -128, i32 -128>
%41 = select <4 x i1> %39, <4 x i32> %37, <4 x i32> <i32 -128, i32 -128, i32 -128, i32 -128>
%42 = trunc <4 x i32> %40 to <4 x i8>
%43 = trunc <4 x i32> %41 to <4 x i8>
%44 = getelementptr inbounds [4096 x i8], [4096 x i8]* %4, i64 0, i64 %27
%45 = bitcast i8* %44 to <4 x i8>*
store <4 x i8> %42, <4 x i8>* %45
%46 = getelementptr inbounds i8, i8* %44, i64 4
%47 = bitcast i8* %46 to <4 x i8>*
store <4 x i8> %43, <4 x i8>* %47
%48 = add nuw i64 %27, 8
%49 = icmp eq i64 %48, %25
br i1 %49, label %50, label %26
50: ; preds = %26
%51 = icmp eq i64 %25, %22
br i1 %51, label %66, label %52
52: ; preds = %21, %50
%53 = phi i64 [ 0, %21 ], [ %25, %50 ]
br label %54
54: ; preds = %52, %54
%55 = phi i64 [ %64, %54 ], [ %53, %52 ]
%56 = getelementptr inbounds [4096 x i32], [4096 x i32]* %3, i64 0, i64 %55
%57 = load i32, i32* %56
%58 = icmp slt i32 %57, 127
%59 = select i1 %58, i32 %57, i32 127
%60 = icmp sgt i32 %59, -128
%61 = select i1 %60, i32 %59, i32 -128
%62 = trunc i32 %61 to i8
%63 = getelementptr inbounds [4096 x i8], [4096 x i8]* %4, i64 0, i64 %55
store i8 %62, i8* %63
%64 = add nuw nsw i64 %55, 1
%65 = icmp eq i64 %64, %22
br i1 %65, label %66, label %54
66: ; preds = %54, %50, %18
%67 = load i32, i32* @stdout
%68 = call i32 @fwrite(i8* %13, i32 1, i32 %19, i32 %67)
%69 = load i32, i32* @stdin
%70 = call i32 @fread(i32* %14, i32 4, i32 4096, i32 %69)
%71 = icmp eq i32 %70, 0
br i1 %71, label %72, label %18
72: ; preds = %66, %9
%73 = load i32, i32* @stderr
%74 = load i8*, i8** %1
%75 = call i32 (i32, i8*, ...) @fprintf(i32 %73, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0), i8* %74)
br label %76
76: ; preds = %72, %7
%77 = phi i32 [ 1, %7 ], [ 0, %72 ]
ret i32 %77
}