#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 char wchar_t;

/* Variables and functions */
int /*<<< orphan*/ feof(int /*<<< orphan*/);
char fgetwc(int /*<<< orphan*/);
int /*<<< orphan*/ fputwc(char, int /*<<< orphan*/);
int /*<<< orphan*/ fputws(char *, int /*<<< orphan*/);
int /*<<< orphan*/ fwide(int /*<<< orphan*/, int);
int /*<<< orphan*/ fwprintf(int /*<<< orphan*/, char *, int, char);
int /*<<< orphan*/ stdin;
int /*<<< orphan*/ stdout;
int main(int argc, char *argv[]) {
  fwide(stdin, 1);
  fwide(stdout, 1);
  for (wchar_t c = fgetwc(stdin); !feof(stdin); c = fgetwc(stdin)) {
    if (c != '\n') {
      fwprintf(stdout, L"Read character %d, %C\t", (int)c, c);
      fputwc(c, stdout);
      fputws(L"\n", stdout);
    }
  }
}


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    0x2e6b(%rip),%rax
mov    (%rax),%edi
mov    $0x1,%esi
call   1080 <fwide@plt>
mov    0x2e48(%rip),%rax
mov    (%rax),%edi
mov    $0x1,%esi
call   1080 <fwide@plt>
mov    0x2e45(%rip),%rax
mov    (%rax),%edi
call   1030 <fgetwc@plt>
mov    %al,-0x11(%rbp)
mov    0x2e34(%rip),%rax
mov    (%rax),%edi
call   1050 <feof@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
test   $0x1,%al
jne    11d0 <main+0x70>
jmp    123e <main+0xde>
movsbl -0x11(%rbp),%eax
cmp    $0xa,%eax
je     1223 <main+0xc3>
mov    0x2df4(%rip),%rax
mov    (%rax),%edi
movsbl -0x11(%rbp),%edx
lea    0xe0f(%rip),%rsi
movsbl -0x11(%rbp),%ecx
call   1070 <fwprintf@plt>
mov    -0x11(%rbp),%al
mov    0x2dd4(%rip),%rcx
mov    (%rcx),%esi
movsbl %al,%edi
call   1040 <fputwc@plt>
mov    0x2dc3(%rip),%rax
mov    (%rax),%esi
lea    0xe3e(%rip),%rdi
call   1060 <fputws@plt>
jmp    1228 <main+0xc8>
mov    0x2db9(%rip),%rax
mov    (%rax),%edi
call   1030 <fgetwc@plt>
mov    %al,-0x11(%rbp)
jmp    11ad <main+0x4d>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
mov    0x2e78(%rip),%r12
mov    (%r12),%edi
mov    $0x1,%esi
call   1080 <fwide@plt>
mov    0x2e53(%rip),%r13
mov    0x0(%r13),%edi
mov    $0x1,%esi
call   1080 <fwide@plt>
mov    (%r12),%edi
call   1030 <fgetwc@plt>
mov    %eax,%ebx
mov    (%r12),%edi
call   1050 <feof@plt>
test   %eax,%eax
je     11b7 <main+0x57>
xor    %eax,%eax
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret
lea    0xe42(%rip),%r14
lea    0xe97(%rip),%r15
jmp    11e8 <main+0x88>
nopw   0x0(%rax,%rax,1)
mov    (%r12),%edi
call   1030 <fgetwc@plt>
mov    %eax,%ebx
mov    (%r12),%edi
call   1050 <feof@plt>
test   %eax,%eax
jne    11ab <main+0x4b>
cmp    $0xa,%bl
je     11d0 <main+0x70>
movsbl %bl,%ebx
mov    0x0(%r13),%edi
mov    %r14,%rsi
mov    %ebx,%edx
mov    %ebx,%ecx
call   1070 <fwprintf@plt>
mov    0x0(%r13),%esi
mov    %ebx,%edi
call   1040 <fputwc@plt>
mov    0x0(%r13),%esi
mov    %r15,%rdi
call   1060 <fputws@plt>
jmp    11d0 <main+0x70>

LLVM IR (-O0):
@stdin = global i32 0
@stdout = global i32 0
@.str = [23 x i32] [i32 82, i32 101, i32 97, i32 100, i32 32, i32 99, i32 104, i32 97, i32 114, i32 97, i32 99, i32 116, i32 101, i32 114, i32 32, i32 37, i32 100, i32 44, i32 32, i32 37, i32 67, i32 9, i32 0]
@.str.1 = [2 x i32] [i32 10, i32 0]
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i8
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%7 = load i32, i32* @stdin
%8 = call i32 @fwide(i32 %7, i32 1)
%9 = load i32, i32* @stdout
%10 = call i32 @fwide(i32 %9, i32 1)
%11 = load i32, i32* @stdin
%12 = call signext i8 @fgetwc(i32 %11)
store i8 %12, i8* %6
br label %13
13: ; preds = %34, %2
%14 = load i32, i32* @stdin
%15 = call i32 @feof(i32 %14)
%16 = icmp ne i32 %15, 0
%17 = xor i1 %16, true
br i1 %17, label %18, label %37
18: ; preds = %13
%19 = load i8, i8* %6
%20 = sext i8 %19 to i32
%21 = icmp ne i32 %20, 10
br i1 %21, label %22, label %33
22: ; preds = %18
%23 = load i32, i32* @stdout
%24 = load i8, i8* %6
%25 = sext i8 %24 to i32
%26 = load i8, i8* %6
%27 = call i32 @fwprintf(i32 %23, i8* bitcast ([23 x i32]* @.str to i8*), i32 %25, i8 signext %26)
%28 = load i8, i8* %6
%29 = load i32, i32* @stdout
%30 = call i32 @fputwc(i8 signext %28, i32 %29)
%31 = load i32, i32* @stdout
%32 = call i32 @fputws(i8* bitcast ([2 x i32]* @.str.1 to i8*), i32 %31)
br label %33
33: ; preds = %22, %18
br label %34
34: ; preds = %33
%35 = load i32, i32* @stdin
%36 = call signext i8 @fgetwc(i32 %35)
store i8 %36, i8* %6
br label %13
37: ; preds = %13
%38 = load i32, i32* %3
ret i32 %38
}

LLVM IR (-O2):
@stdin = global i32 0
@stdout = global i32 0
@.str = [23 x i32] [i32 82, i32 101, i32 97, i32 100, i32 32, i32 99, i32 104, i32 97, i32 114, i32 97, i32 99, i32 116, i32 101, i32 114, i32 32, i32 37, i32 100, i32 44, i32 32, i32 37, i32 67, i32 9, i32 0]
@.str.1 = [2 x i32] [i32 10, i32 0]
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = load i32, i32* @stdin
%4 = tail call i32 @fwide(i32 %3, i32 1)
%5 = load i32, i32* @stdout
%6 = tail call i32 @fwide(i32 %5, i32 1)
%7 = load i32, i32* @stdin
%8 = tail call signext i8 @fgetwc(i32 %7)
%9 = load i32, i32* @stdin
%10 = tail call i32 @feof(i32 %9)
%11 = icmp eq i32 %10, 0
br i1 %11, label %13, label %12
12: ; preds = %24, %2
ret i32 0
13: ; preds = %2, %24
%14 = phi i8 [ %26, %24 ], [ %8, %2 ]
%15 = icmp eq i8 %14, 10
br i1 %15, label %24, label %16
16: ; preds = %13
%17 = sext i8 %14 to i32
%18 = load i32, i32* @stdout
%19 = tail call i32 @fwprintf(i32 %18, i8* bitcast ([23 x i32]* @.str to i8*), i32 %17, i8 signext %14)
%20 = load i32, i32* @stdout
%21 = tail call i32 @fputwc(i8 signext %14, i32 %20)
%22 = load i32, i32* @stdout
%23 = tail call i32 @fputws(i8* bitcast ([2 x i32]* @.str.1 to i8*), i32 %22)
br label %24
24: ; preds = %13, %16
%25 = load i32, i32* @stdin
%26 = tail call signext i8 @fgetwc(i32 %25)
%27 = load i32, i32* @stdin
%28 = tail call i32 @feof(i32 %27)
%29 = icmp eq i32 %28, 0
br i1 %29, label %13, label %12
}