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


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x3020,%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    1299 <main+0x169>
mov    0x2e5b(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
lea    0xe85(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
lea    -0x1010(%rbp),%rdi
mov    0x2e46(%rip),%rax
mov    (%rax),%ecx
mov    $0x1,%esi
mov    $0x1000,%edx
call   1030 <fread@plt>
mov    %eax,-0x3014(%rbp)
cmpl   $0x0,-0x3014(%rbp)
jne    11cb <main+0x9b>
jmp    1274 <main+0x144>
movl   $0x0,-0x3018(%rbp)
mov    -0x3018(%rbp),%eax
cmp    -0x3014(%rbp),%eax
jge    124f <main+0x11f>
movslq -0x3018(%rbp),%rax
movsbl -0x1010(%rbp,%rax,1),%eax
ff
cmp    $0x0,%eax
jge    1215 <main+0xe5>
movslq -0x3018(%rbp),%rax
movw   $0x0,-0x3010(%rbp,%rax,2)
jmp    1236 <main+0x106>
movslq -0x3018(%rbp),%rax
movsbl -0x1010(%rbp,%rax,1),%eax
ff
mov    %ax,%cx
movslq -0x3018(%rbp),%rax
mov    %cx,-0x3010(%rbp,%rax,2)
ff
jmp    123b <main+0x10b>
mov    -0x3018(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x3018(%rbp)
jmp    11d5 <main+0xa5>
lea    -0x3010(%rbp),%rdi
mov    -0x3014(%rbp),%edx
mov    0x2d6d(%rip),%rax
mov    (%rax),%ecx
mov    $0x2,%esi
call   1050 <fwrite@plt>
jmp    1194 <main+0x64>
mov    0x2d5d(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
lea    0xd98(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x3020,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x3018,%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,%ebx
jmp    137e <main+0x24e>
mov    %rsi,0x8(%rsp)
mov    (%rsi),%rdx
lea    0xe9a(%rip),%rsi
xor    %ebx,%ebx
xor    %eax,%eax
call   1040 <fprintf@plt>
mov    0x2e60(%rip),%r14
mov    (%r14),%ecx
lea    0x10(%rsp),%rdi
mov    $0x1,%esi
mov    $0x1000,%edx
call   1030 <fread@plt>
test   %eax,%eax
je     135f <main+0x22f>
pxor   %xmm3,%xmm3
mov    0x2e1e(%rip),%r13
lea    0x1010(%rsp),%r15
lea    0x10(%rsp),%r12
jmp    1204 <main+0xd4>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    0x0(%r13),%ecx
mov    %r15,%rdi
mov    $0x2,%esi
mov    %eax,%edx
call   1050 <fwrite@plt>
mov    (%r14),%ecx
mov    %r12,%rdi
mov    $0x1,%esi
mov    $0x1000,%edx
call   1030 <fread@plt>
pxor   %xmm3,%xmm3
test   %eax,%eax
je     135f <main+0x22f>
test   %eax,%eax
jle    11d0 <main+0xa0>
mov    %eax,%ecx
cmp    $0x10,%eax
jae    1220 <main+0xf0>
xor    %edx,%edx
jmp    1330 <main+0x200>
cs nopw 0x0(%rax,%rax,1)
mov    %ecx,%edx
and    $0xfffffff0,%edx
lea    -0x10(%rdx),%rsi
mov    %rsi,%rbp
shr    $0x4,%rbp
add    $0x1,%rbp
test   %rsi,%rsi
je     1355 <main+0x225>
mov    %rbp,%rdi
and    $0xfffffffffffffffe,%rdi
xor    %esi,%esi
cs nopw 0x0(%rax,%rax,1)
movq   0x10(%rsp,%rsi,1),%xmm0
movq   0x18(%rsp,%rsi,1),%xmm1
movdqa %xmm0,%xmm2
pcmpgtb %xmm3,%xmm2
pand   %xmm0,%xmm2
movdqa %xmm1,%xmm0
pcmpgtb %xmm3,%xmm0
pand   %xmm1,%xmm0
punpcklbw %xmm3,%xmm2
punpcklbw %xmm3,%xmm0
movdqa %xmm2,0x1010(%rsp,%rsi,2)
movdqa %xmm0,0x1020(%rsp,%rsi,2)
movq   0x20(%rsp,%rsi,1),%xmm0
movq   0x28(%rsp,%rsi,1),%xmm1
movdqa %xmm0,%xmm2
pcmpgtb %xmm3,%xmm2
pand   %xmm0,%xmm2
movdqa %xmm1,%xmm0
pcmpgtb %xmm3,%xmm0
pand   %xmm1,%xmm0
punpcklbw %xmm3,%xmm2
punpcklbw %xmm3,%xmm0
movdqa %xmm2,0x1030(%rsp,%rsi,2)
movdqa %xmm0,0x1040(%rsp,%rsi,2)
add    $0x20,%rsi
add    $0xfffffffffffffffe,%rdi
jne    1250 <main+0x120>
test   $0x1,%bpl
je     131e <main+0x1ee>
movq   0x10(%rsp,%rsi,1),%xmm0
movq   0x18(%rsp,%rsi,1),%xmm1
movdqa %xmm0,%xmm2
pcmpgtb %xmm3,%xmm2
pand   %xmm0,%xmm2
movdqa %xmm1,%xmm0
pcmpgtb %xmm3,%xmm0
pand   %xmm1,%xmm0
punpcklbw %xmm3,%xmm2
punpcklbw %xmm3,%xmm0
movdqa %xmm2,0x1010(%rsp,%rsi,2)
movdqa %xmm0,0x1020(%rsp,%rsi,2)
cmp    %rcx,%rdx
je     11d0 <main+0xa0>
nopw   0x0(%rax,%rax,1)
movzbl 0x10(%rsp,%rdx,1),%esi
test   %sil,%sil
cmovs  %ebx,%esi
movzbl %sil,%esi
mov    %si,0x1010(%rsp,%rdx,2)
add    $0x1,%rdx
cmp    %rdx,%rcx
jne    1330 <main+0x200>
jmp    11d0 <main+0xa0>
xor    %esi,%esi
test   $0x1,%bpl
jne    12e0 <main+0x1b0>
jmp    131e <main+0x1ee>
mov    0x2c72(%rip),%rax
mov    (%rax),%edi
mov    0x8(%rsp),%rax
mov    (%rax),%rdx
lea    0xcac(%rip),%rsi
xor    %eax,%eax
call   1040 <fprintf@plt>
mov    %ebx,%eax
add    $0x3018,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@stderr = global i32 0
@.str = [18 x i8] c"< input > output\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 i8]
%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 ([18 x i8], [18 x i8]* @.str, i64 0, i64 0))
store i32 1, i32* %3
br label %68
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 = %57, %15
%22 = getelementptr inbounds [4096 x i8], [4096 x i8]* %6, i64 0, i64 0
%23 = load i32, i32* @stdin
%24 = call i32 @fread(i8* %22, i32 1, 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 %62
28: ; preds = %21
store i32 0, i32* %9
br label %29
29: ; preds = %54, %28
%30 = load i32, i32* %9
%31 = load i32, i32* %8
%32 = icmp slt i32 %30, %31
br i1 %32, label %33, label %57
33: ; preds = %29
%34 = load i32, i32* %9
%35 = sext i32 %34 to i64
%36 = getelementptr inbounds [4096 x i8], [4096 x i8]* %6, i64 0, i64 %35
%37 = load i8, i8* %36
%38 = sext i8 %37 to i32
%39 = icmp slt i32 %38, 0
br i1 %39, label %40, label %44
40: ; preds = %33
%41 = load i32, i32* %9
%42 = sext i32 %41 to i64
%43 = getelementptr inbounds [4096 x i16], [4096 x i16]* %7, i64 0, i64 %42
store i16 0, i16* %43
br label %53
44: ; preds = %33
%45 = load i32, i32* %9
%46 = sext i32 %45 to i64
%47 = getelementptr inbounds [4096 x i8], [4096 x i8]* %6, i64 0, i64 %46
%48 = load i8, i8* %47
%49 = sext i8 %48 to i16
%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 %49, i16* %52
br label %53
53: ; preds = %44, %40
br label %54
54: ; preds = %53
%55 = load i32, i32* %9
%56 = add nsw i32 %55, 1
store i32 %56, i32* %9
br label %29
57: ; preds = %29
%58 = getelementptr inbounds [4096 x i16], [4096 x i16]* %7, i64 0, i64 0
%59 = load i32, i32* %8
%60 = load i32, i32* @stdout
%61 = call i32 @fwrite(i16* %58, i32 2, i32 %59, i32 %60)
br label %21
62: ; preds = %27
%63 = load i32, i32* @stderr
%64 = load i8**, i8*** %5
%65 = getelementptr inbounds i8*, i8** %64, i64 0
%66 = load i8*, i8** %65
%67 = call i32 (i32, i8*, ...) @fprintf(i32 %63, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0), i8* %66)
store i32 0, i32* %3
br label %68
68: ; preds = %62, %12
%69 = load i32, i32* %3
ret i32 %69
}

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