#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 /*<<< orphan*/ FILE;

/* Variables and functions */
char EOF;
scalar_t__ fgetc(int /*<<< orphan*/ *);
int /*<<< orphan*/ fputc(unsigned char, int /*<<< orphan*/ *);
void read_write(FILE *inputFile, FILE *outputFile) {
  char bit;
  while ((bit = (int)fgetc(inputFile)) != EOF) {
    if (bit != '\n') {
      unsigned char character =
          bit - '0' << 7 | (int)fgetc(inputFile) - '0' << 6 |
          (int)fgetc(inputFile) - '0' << 5 | (int)fgetc(inputFile) - '0' << 4 |
          (int)fgetc(inputFile) - '0' << 3 | (int)fgetc(inputFile) - '0' << 2 |
          (int)fgetc(inputFile) - '0' << 1 | (int)fgetc(inputFile) - '0';
      fputc(character, outputFile);
    }
  }
}


x86 assembly (clang, -O0):
<read_write>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <fgetc@plt>
mov    %al,-0x11(%rbp)
movsbl %al,%eax
mov    0x2ea2(%rip),%rcx
movsbl (%rcx),%ecx
cmp    %ecx,%eax
je     1232 <read_write+0x112>
movsbl -0x11(%rbp),%eax
cmp    $0xa,%eax
je     122d <read_write+0x10d>
movsbl -0x11(%rbp),%eax
sub    $0x30,%eax
shl    $0x7,%eax
mov    %eax,-0x30(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <fgetc@plt>
mov    %rax,%rcx
mov    -0x30(%rbp),%eax
sub    $0x30,%ecx
shl    $0x6,%ecx
or     %ecx,%eax
mov    %eax,-0x2c(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <fgetc@plt>
mov    %rax,%rcx
mov    -0x2c(%rbp),%eax
sub    $0x30,%ecx
shl    $0x5,%ecx
or     %ecx,%eax
mov    %eax,-0x28(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <fgetc@plt>
mov    %rax,%rcx
mov    -0x28(%rbp),%eax
sub    $0x30,%ecx
shl    $0x4,%ecx
or     %ecx,%eax
mov    %eax,-0x24(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <fgetc@plt>
mov    %rax,%rcx
mov    -0x24(%rbp),%eax
sub    $0x30,%ecx
shl    $0x3,%ecx
or     %ecx,%eax
mov    %eax,-0x20(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <fgetc@plt>
mov    %rax,%rcx
mov    -0x20(%rbp),%eax
sub    $0x30,%ecx
shl    $0x2,%ecx
or     %ecx,%eax
mov    %eax,-0x1c(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <fgetc@plt>
mov    %rax,%rcx
mov    -0x1c(%rbp),%eax
sub    $0x30,%ecx
shl    $0x1,%ecx
or     %ecx,%eax
mov    %eax,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <fgetc@plt>
mov    %rax,%rcx
mov    -0x18(%rbp),%eax
sub    $0x30,%ecx
or     %ecx,%eax
mov    %al,-0x12(%rbp)
mov    -0x12(%rbp),%al
mov    -0x10(%rbp),%rsi
movzbl %al,%edi
call   1040 <fputc@plt>
jmp    1130 <read_write+0x10>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<read_write>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rsi,(%rsp)
mov    %rdi,%r15
call   1030 <fgetc@plt>
mov    %rax,%rbx
movsbl %bl,%eax
mov    0x2ea4(%rip),%r14
movsbl (%r14),%ecx
cmp    %ecx,%eax
jne    115b <read_write+0x3b>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
shl    $0x18,%ebx
jmp    1178 <read_write+0x58>
mov    %r15,%rdi
call   1030 <fgetc@plt>
movsbl %al,%ecx
mov    %eax,%ebx
shl    $0x18,%ebx
movsbl (%r14),%eax
cmp    %eax,%ecx
je     114c <read_write+0x2c>
cmp    $0xa000000,%ebx
je     1160 <read_write+0x40>
sar    $0x11,%ebx
add    $0xffffe800,%ebx
mov    %r15,%rdi
call   1030 <fgetc@plt>
mov    %rax,%r12
shl    $0x6,%r12d
add    $0xfffff400,%r12d
or     %ebx,%r12d
mov    %r15,%rdi
call   1030 <fgetc@plt>
mov    %rax,%rbx
shl    $0x5,%ebx
add    $0xfffffa00,%ebx
mov    %r15,%rdi
call   1030 <fgetc@plt>
mov    %rax,%r13
shl    $0x4,%r13d
add    $0xfffffd00,%r13d
or     %ebx,%r13d
or     %r12d,%r13d
mov    %r15,%rdi
call   1030 <fgetc@plt>
lea    0x80(,%rax,8),%ebx
mov    %r15,%rdi
call   1030 <fgetc@plt>
lea    0x40(,%rax,4),%ebp
or     %ebx,%ebp
mov    %r15,%rdi
call   1030 <fgetc@plt>
lea    (%rax,%rax,1),%ebx
add    $0xa0,%ebx
or     %ebp,%ebx
mov    %r15,%rdi
call   1030 <fgetc@plt>
add    $0xd0,%eax
or     %ebx,%eax
or     %r13d,%eax
movzbl %al,%edi
mov    (%rsp),%rsi
call   1040 <fputc@plt>
jmp    1160 <read_write+0x40>

LLVM IR (-O0):
@EOF = global i8 0
define void @read_write(i32* %0, i32* %1) {
%3 = alloca i32*
%4 = alloca i32*
%5 = alloca i8
%6 = alloca i8
store i32* %0, i32** %3
store i32* %1, i32** %4
br label %7
7: ; preds = %70, %2
%8 = load i32*, i32** %3
%9 = call i64 @fgetc(i32* %8)
%10 = trunc i64 %9 to i32
%11 = trunc i32 %10 to i8
store i8 %11, i8* %5
%12 = sext i8 %11 to i32
%13 = load i8, i8* @EOF
%14 = sext i8 %13 to i32
%15 = icmp ne i32 %12, %14
br i1 %15, label %16, label %71
16: ; preds = %7
%17 = load i8, i8* %5
%18 = sext i8 %17 to i32
%19 = icmp ne i32 %18, 10
br i1 %19, label %20, label %70
20: ; preds = %16
%21 = load i8, i8* %5
%22 = sext i8 %21 to i32
%23 = sub nsw i32 %22, 48
%24 = shl i32 %23, 7
%25 = load i32*, i32** %3
%26 = call i64 @fgetc(i32* %25)
%27 = trunc i64 %26 to i32
%28 = sub nsw i32 %27, 48
%29 = shl i32 %28, 6
%30 = or i32 %24, %29
%31 = load i32*, i32** %3
%32 = call i64 @fgetc(i32* %31)
%33 = trunc i64 %32 to i32
%34 = sub nsw i32 %33, 48
%35 = shl i32 %34, 5
%36 = or i32 %30, %35
%37 = load i32*, i32** %3
%38 = call i64 @fgetc(i32* %37)
%39 = trunc i64 %38 to i32
%40 = sub nsw i32 %39, 48
%41 = shl i32 %40, 4
%42 = or i32 %36, %41
%43 = load i32*, i32** %3
%44 = call i64 @fgetc(i32* %43)
%45 = trunc i64 %44 to i32
%46 = sub nsw i32 %45, 48
%47 = shl i32 %46, 3
%48 = or i32 %42, %47
%49 = load i32*, i32** %3
%50 = call i64 @fgetc(i32* %49)
%51 = trunc i64 %50 to i32
%52 = sub nsw i32 %51, 48
%53 = shl i32 %52, 2
%54 = or i32 %48, %53
%55 = load i32*, i32** %3
%56 = call i64 @fgetc(i32* %55)
%57 = trunc i64 %56 to i32
%58 = sub nsw i32 %57, 48
%59 = shl i32 %58, 1
%60 = or i32 %54, %59
%61 = load i32*, i32** %3
%62 = call i64 @fgetc(i32* %61)
%63 = trunc i64 %62 to i32
%64 = sub nsw i32 %63, 48
%65 = or i32 %60, %64
%66 = trunc i32 %65 to i8
store i8 %66, i8* %6
%67 = load i8, i8* %6
%68 = load i32*, i32** %4
%69 = call i32 @fputc(i8 zeroext %67, i32* %68)
br label %70
70: ; preds = %20, %16
br label %7
71: ; preds = %7
ret void
}

LLVM IR (-O2):
@EOF = global i8 0
define void @read_write(i32* nocapture %0, i32* nocapture %1) {
%3 = tail call i64 @fgetc(i32* %0)
%4 = trunc i64 %3 to i32
%5 = shl i32 %4, 24
%6 = ashr exact i32 %5, 24
%7 = load i8, i8* @EOF
%8 = sext i8 %7 to i32
%9 = icmp eq i32 %6, %8
br i1 %9, label %60, label %10
10: ; preds = %2, %52
%11 = phi i32 [ %55, %52 ], [ %5, %2 ]
%12 = icmp eq i32 %11, 167772160
br i1 %12, label %52, label %13
13: ; preds = %10
%14 = ashr exact i32 %11, 17
%15 = add nsw i32 %14, -6144
%16 = tail call i64 @fgetc(i32* %0)
%17 = trunc i64 %16 to i32
%18 = shl i32 %17, 6
%19 = add i32 %18, -3072
%20 = or i32 %19, %15
%21 = tail call i64 @fgetc(i32* %0)
%22 = trunc i64 %21 to i32
%23 = shl i32 %22, 5
%24 = add i32 %23, -1536
%25 = or i32 %20, %24
%26 = tail call i64 @fgetc(i32* %0)
%27 = trunc i64 %26 to i32
%28 = shl i32 %27, 4
%29 = add i32 %28, -768
%30 = or i32 %25, %29
%31 = tail call i64 @fgetc(i32* %0)
%32 = trunc i64 %31 to i32
%33 = shl i32 %32, 3
%34 = add i32 %33, 128
%35 = or i32 %30, %34
%36 = tail call i64 @fgetc(i32* %0)
%37 = trunc i64 %36 to i32
%38 = shl i32 %37, 2
%39 = add i32 %38, 64
%40 = or i32 %35, %39
%41 = tail call i64 @fgetc(i32* %0)
%42 = trunc i64 %41 to i32
%43 = shl i32 %42, 1
%44 = add i32 %43, 160
%45 = or i32 %40, %44
%46 = tail call i64 @fgetc(i32* %0)
%47 = trunc i64 %46 to i32
%48 = add i32 %47, 208
%49 = or i32 %45, %48
%50 = trunc i32 %49 to i8
%51 = tail call i32 @fputc(i8 zeroext %50, i32* %1)
br label %52
52: ; preds = %13, %10
%53 = tail call i64 @fgetc(i32* %0)
%54 = trunc i64 %53 to i32
%55 = shl i32 %54, 24
%56 = ashr exact i32 %55, 24
%57 = load i8, i8* @EOF
%58 = sext i8 %57 to i32
%59 = icmp eq i32 %56, %58
br i1 %59, label %60, label %10
60: ; preds = %52, %2
ret void
}