#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 */
typedef int int16_t;

/* Variables and functions */
int /*<<< orphan*/ feof(int /*<<< orphan*/);
int fgetc(int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, int);
int /*<<< orphan*/ stdin;
int /*<<< orphan*/ stdout;
int main(int argc, char **argv) {
  int16_t v;
  while (!feof(stdin)) {
    v = fgetc(stdin) | fgetc(stdin) << 8;
    fprintf(stdout, "%d\n", v);
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    0x2e9b(%rip),%rax
mov    (%rax),%edi
call   1050 <feof@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
test   $0x1,%al
jne    1169 <main+0x39>
jmp    11b2 <main+0x82>
mov    0x2e78(%rip),%rax
mov    (%rax),%edi
call   1030 <fgetc@plt>
mov    %eax,-0x18(%rbp)
mov    0x2e67(%rip),%rax
mov    (%rax),%edi
call   1030 <fgetc@plt>
mov    %eax,%ecx
mov    -0x18(%rbp),%eax
shl    $0x8,%ecx
or     %ecx,%eax
mov    %eax,-0x14(%rbp)
mov    0x2e3c(%rip),%rax
mov    (%rax),%edi
mov    -0x14(%rbp),%edx
lea    0xe58(%rip),%rsi
call   1040 <fprintf@plt>
jmp    1146 <main+0x16>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    0x2eaa(%rip),%rbx
mov    (%rbx),%edi
call   1050 <feof@plt>
test   %eax,%eax
jne    118d <main+0x5d>
mov    0x2e88(%rip),%r15
lea    0xea9(%rip),%r14
nopw   0x0(%rax,%rax,1)
mov    (%rbx),%edi
call   1030 <fgetc@plt>
mov    %eax,%ebp
mov    (%rbx),%edi
call   1030 <fgetc@plt>
shl    $0x8,%eax
or     %eax,%ebp
mov    (%r15),%edi
mov    %r14,%rsi
mov    %ebp,%edx
call   1040 <fprintf@plt>
mov    (%rbx),%edi
call   1050 <feof@plt>
test   %eax,%eax
je     1160 <main+0x30>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@stdin = global i32 0
@stdout = global i32 0
@.str = [4 x i8] c"%d\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
br label %7
7: ; preds = %12, %2
%8 = load i32, i32* @stdin
%9 = call i32 @feof(i32 %8)
%10 = icmp ne i32 %9, 0
%11 = xor i1 %10, true
br i1 %11, label %12, label %22
12: ; preds = %7
%13 = load i32, i32* @stdin
%14 = call i32 @fgetc(i32 %13)
%15 = load i32, i32* @stdin
%16 = call i32 @fgetc(i32 %15)
%17 = shl i32 %16, 8
%18 = or i32 %14, %17
store i32 %18, i32* %6
%19 = load i32, i32* @stdout
%20 = load i32, i32* %6
%21 = call i32 @fprintf(i32 %19, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %20)
br label %7
22: ; preds = %7
%23 = load i32, i32* %3
ret i32 %23
}

LLVM IR (-O2):
@stdin = global i32 0
@stdout = global i32 0
@.str = [4 x i8] c"%d\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = load i32, i32* @stdin
%4 = tail call i32 @feof(i32 %3)
%5 = icmp eq i32 %4, 0
br i1 %5, label %6, label %18
6: ; preds = %2, %6
%7 = load i32, i32* @stdin
%8 = tail call i32 @fgetc(i32 %7)
%9 = load i32, i32* @stdin
%10 = tail call i32 @fgetc(i32 %9)
%11 = shl i32 %10, 8
%12 = or i32 %11, %8
%13 = load i32, i32* @stdout
%14 = tail call i32 @fprintf(i32 %13, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %12)
%15 = load i32, i32* @stdin
%16 = tail call i32 @feof(i32 %15)
%17 = icmp eq i32 %16, 0
br i1 %17, label %6, label %18
18: ; preds = %6, %2
ret i32 0
}