#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;
char fgetc(int /*<<< orphan*/ *);
int /*<<< orphan*/ fputc(char, int /*<<< orphan*/ *);
void atob(FILE *inputFile, FILE *outputFile) {
  char ch;
  while ((ch = fgetc(inputFile)) != EOF) {
    char buff[8];
    if (ch & 1)
      buff[0] = 1;
    else
      buff[0] = 0;
    if (ch & 2)
      buff[1] = 1;
    else
      buff[1] = 0;
    if (ch & 4)
      buff[2] = 1;
    else
      buff[2] = 0;
    if (ch & 8)
      buff[3] = 1;
    else
      buff[3] = 0;
    if (ch & 16)
      buff[4] = 1;
    else
      buff[4] = 0;
    if (ch & 32)
      buff[5] = 1;
    else
      buff[5] = 0;
    if (ch & 64)
      buff[6] = 1;
    else
      buff[6] = 0;
    if (ch & 128)
      buff[7] = 1;
    else
      buff[7] = 0;
    for (int i = 7; i >= 0; --i) {
      fputc(buff[i] + '0', outputFile);
    }
  }
  fputc('\n', outputFile);
}


x86 assembly (clang, -O0):
<atob>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%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     1277 <atob+0x157>
movsbl -0x11(%rbp),%eax
and    $0x1,%eax
cmp    $0x0,%eax
je     116a <atob+0x4a>
movb   $0x1,-0x19(%rbp)
jmp    116e <atob+0x4e>
movb   $0x0,-0x19(%rbp)
movsbl -0x11(%rbp),%eax
and    $0x2,%eax
cmp    $0x0,%eax
je     1187 <atob+0x67>
movb   $0x1,-0x18(%rbp)
jmp    118b <atob+0x6b>
movb   $0x0,-0x18(%rbp)
movsbl -0x11(%rbp),%eax
and    $0x4,%eax
cmp    $0x0,%eax
je     11a4 <atob+0x84>
movb   $0x1,-0x17(%rbp)
jmp    11a8 <atob+0x88>
movb   $0x0,-0x17(%rbp)
movsbl -0x11(%rbp),%eax
and    $0x8,%eax
cmp    $0x0,%eax
je     11c1 <atob+0xa1>
movb   $0x1,-0x16(%rbp)
jmp    11c5 <atob+0xa5>
movb   $0x0,-0x16(%rbp)
movsbl -0x11(%rbp),%eax
and    $0x10,%eax
cmp    $0x0,%eax
je     11de <atob+0xbe>
movb   $0x1,-0x15(%rbp)
jmp    11e2 <atob+0xc2>
movb   $0x0,-0x15(%rbp)
movsbl -0x11(%rbp),%eax
and    $0x20,%eax
cmp    $0x0,%eax
je     11fb <atob+0xdb>
movb   $0x1,-0x14(%rbp)
jmp    11ff <atob+0xdf>
movb   $0x0,-0x14(%rbp)
movsbl -0x11(%rbp),%eax
and    $0x40,%eax
cmp    $0x0,%eax
je     1218 <atob+0xf8>
movb   $0x1,-0x13(%rbp)
jmp    121c <atob+0xfc>
movb   $0x0,-0x13(%rbp)
movsbl -0x11(%rbp),%eax
and    $0x80,%eax
cmp    $0x0,%eax
je     1237 <atob+0x117>
movb   $0x1,-0x12(%rbp)
jmp    123b <atob+0x11b>
movb   $0x0,-0x12(%rbp)
movl   $0x7,-0x20(%rbp)
cmpl   $0x0,-0x20(%rbp)
jl     1272 <atob+0x152>
movslq -0x20(%rbp),%rax
movsbl -0x19(%rbp,%rax,1),%eax
add    $0x30,%eax
mov    -0x10(%rbp),%rsi
movsbl %al,%edi
call   1040 <fputc@plt>
mov    -0x20(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x20(%rbp)
jmp    1242 <atob+0x122>
jmp    1130 <atob+0x10>
mov    -0x10(%rbp),%rsi
mov    $0xa,%edi
call   1040 <fputc@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<atob>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %rsi,%r12
mov    %rdi,%rbx
call   1030 <fgetc@plt>
mov    0x2ea8(%rip),%rcx
cmp    (%rcx),%al
je     123d <atob+0x11d>
mov    %rbx,0x10(%rsp)
nopl   (%rax)
movzbl %al,%eax
mov    %eax,%ebx
and    $0x1,%bl
mov    %eax,%ecx
and    $0x2,%ecx
mov    %ecx,0xc(%rsp)
mov    %eax,%ecx
and    $0x4,%ecx
mov    %ecx,0x8(%rsp)
mov    %eax,%r15d
and    $0x8,%r15d
mov    %eax,%r14d
and    $0x10,%r14d
mov    %eax,%r13d
and    $0x20,%r13d
mov    %eax,%ebp
and    $0x40,%ebp
and    $0xffffff80,%eax
cmp    $0x1,%eax
mov    $0x31,%edi
sbb    $0x0,%edi
mov    %r12,%rsi
call   1040 <fputc@plt>
cmp    $0x1,%ebp
mov    $0x31,%edi
sbb    $0x0,%edi
mov    %r12,%rsi
call   1040 <fputc@plt>
cmp    $0x1,%r13d
mov    $0x31,%edi
sbb    $0x0,%edi
mov    %r12,%rsi
call   1040 <fputc@plt>
cmp    $0x1,%r14d
mov    $0x31,%edi
sbb    $0x0,%edi
mov    %r12,%rsi
call   1040 <fputc@plt>
cmp    $0x1,%r15d
mov    $0x31,%edi
sbb    $0x0,%edi
mov    %r12,%rsi
call   1040 <fputc@plt>
cmpl   $0x1,0x8(%rsp)
mov    $0x31,%edi
sbb    $0x0,%edi
mov    %r12,%rsi
call   1040 <fputc@plt>
cmpl   $0x1,0xc(%rsp)
mov    $0x31,%edi
sbb    $0x0,%edi
mov    %r12,%rsi
call   1040 <fputc@plt>
or     $0x30,%bl
movzbl %bl,%edi
mov    0x10(%rsp),%rbx
mov    %r12,%rsi
call   1040 <fputc@plt>
mov    %rbx,%rdi
call   1030 <fgetc@plt>
mov    0x2db3(%rip),%rcx
cmp    (%rcx),%al
jne    1150 <atob+0x30>
mov    $0xa,%edi
mov    %r12,%rsi
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1040 <fputc@plt>

LLVM IR (-O0):
@EOF = global i8 0
define void @atob(i32* %0, i32* %1) {
%3 = alloca i32*
%4 = alloca i32*
%5 = alloca i8
%6 = alloca [8 x i8]
%7 = alloca i32
store i32* %0, i32** %3
store i32* %1, i32** %4
br label %8
8: ; preds = %104, %2
%9 = load i32*, i32** %3
%10 = call signext i8 @fgetc(i32* %9)
store i8 %10, i8* %5
%11 = sext i8 %10 to i32
%12 = load i8, i8* @EOF
%13 = sext i8 %12 to i32
%14 = icmp ne i32 %11, %13
br i1 %14, label %15, label %105
15: ; preds = %8
%16 = load i8, i8* %5
%17 = sext i8 %16 to i32
%18 = and i32 %17, 1
%19 = icmp ne i32 %18, 0
br i1 %19, label %20, label %22
20: ; preds = %15
%21 = getelementptr inbounds [8 x i8], [8 x i8]* %6, i64 0, i64 0
store i8 1, i8* %21
br label %24
22: ; preds = %15
%23 = getelementptr inbounds [8 x i8], [8 x i8]* %6, i64 0, i64 0
store i8 0, i8* %23
br label %24
24: ; preds = %22, %20
%25 = load i8, i8* %5
%26 = sext i8 %25 to i32
%27 = and i32 %26, 2
%28 = icmp ne i32 %27, 0
br i1 %28, label %29, label %31
29: ; preds = %24
%30 = getelementptr inbounds [8 x i8], [8 x i8]* %6, i64 0, i64 1
store i8 1, i8* %30
br label %33
31: ; preds = %24
%32 = getelementptr inbounds [8 x i8], [8 x i8]* %6, i64 0, i64 1
store i8 0, i8* %32
br label %33
33: ; preds = %31, %29
%34 = load i8, i8* %5
%35 = sext i8 %34 to i32
%36 = and i32 %35, 4
%37 = icmp ne i32 %36, 0
br i1 %37, label %38, label %40
38: ; preds = %33
%39 = getelementptr inbounds [8 x i8], [8 x i8]* %6, i64 0, i64 2
store i8 1, i8* %39
br label %42
40: ; preds = %33
%41 = getelementptr inbounds [8 x i8], [8 x i8]* %6, i64 0, i64 2
store i8 0, i8* %41
br label %42
42: ; preds = %40, %38
%43 = load i8, i8* %5
%44 = sext i8 %43 to i32
%45 = and i32 %44, 8
%46 = icmp ne i32 %45, 0
br i1 %46, label %47, label %49
47: ; preds = %42
%48 = getelementptr inbounds [8 x i8], [8 x i8]* %6, i64 0, i64 3
store i8 1, i8* %48
br label %51
49: ; preds = %42
%50 = getelementptr inbounds [8 x i8], [8 x i8]* %6, i64 0, i64 3
store i8 0, i8* %50
br label %51
51: ; preds = %49, %47
%52 = load i8, i8* %5
%53 = sext i8 %52 to i32
%54 = and i32 %53, 16
%55 = icmp ne i32 %54, 0
br i1 %55, label %56, label %58
56: ; preds = %51
%57 = getelementptr inbounds [8 x i8], [8 x i8]* %6, i64 0, i64 4
store i8 1, i8* %57
br label %60
58: ; preds = %51
%59 = getelementptr inbounds [8 x i8], [8 x i8]* %6, i64 0, i64 4
store i8 0, i8* %59
br label %60
60: ; preds = %58, %56
%61 = load i8, i8* %5
%62 = sext i8 %61 to i32
%63 = and i32 %62, 32
%64 = icmp ne i32 %63, 0
br i1 %64, label %65, label %67
65: ; preds = %60
%66 = getelementptr inbounds [8 x i8], [8 x i8]* %6, i64 0, i64 5
store i8 1, i8* %66
br label %69
67: ; preds = %60
%68 = getelementptr inbounds [8 x i8], [8 x i8]* %6, i64 0, i64 5
store i8 0, i8* %68
br label %69
69: ; preds = %67, %65
%70 = load i8, i8* %5
%71 = sext i8 %70 to i32
%72 = and i32 %71, 64
%73 = icmp ne i32 %72, 0
br i1 %73, label %74, label %76
74: ; preds = %69
%75 = getelementptr inbounds [8 x i8], [8 x i8]* %6, i64 0, i64 6
store i8 1, i8* %75
br label %78
76: ; preds = %69
%77 = getelementptr inbounds [8 x i8], [8 x i8]* %6, i64 0, i64 6
store i8 0, i8* %77
br label %78
78: ; preds = %76, %74
%79 = load i8, i8* %5
%80 = sext i8 %79 to i32
%81 = and i32 %80, 128
%82 = icmp ne i32 %81, 0
br i1 %82, label %83, label %85
83: ; preds = %78
%84 = getelementptr inbounds [8 x i8], [8 x i8]* %6, i64 0, i64 7
store i8 1, i8* %84
br label %87
85: ; preds = %78
%86 = getelementptr inbounds [8 x i8], [8 x i8]* %6, i64 0, i64 7
store i8 0, i8* %86
br label %87
87: ; preds = %85, %83
store i32 7, i32* %7
br label %88
88: ; preds = %101, %87
%89 = load i32, i32* %7
%90 = icmp sge i32 %89, 0
br i1 %90, label %91, label %104
91: ; preds = %88
%92 = load i32, i32* %7
%93 = sext i32 %92 to i64
%94 = getelementptr inbounds [8 x i8], [8 x i8]* %6, i64 0, i64 %93
%95 = load i8, i8* %94
%96 = sext i8 %95 to i32
%97 = add nsw i32 %96, 48
%98 = trunc i32 %97 to i8
%99 = load i32*, i32** %4
%100 = call i32 @fputc(i8 signext %98, i32* %99)
br label %101
101: ; preds = %91
%102 = load i32, i32* %7
%103 = add nsw i32 %102, -1
store i32 %103, i32* %7
br label %88
104: ; preds = %88
br label %8
105: ; preds = %8
%106 = load i32*, i32** %4
%107 = call i32 @fputc(i8 signext 10, i32* %106)
ret void
}

LLVM IR (-O2):
@EOF = global i8 0
define void @atob(i32* nocapture %0, i32* nocapture %1) {
%3 = tail call signext i8 @fgetc(i32* %0)
%4 = load i8, i8* @EOF
%5 = icmp eq i8 %3, %4
br i1 %5, label %43, label %6
6: ; preds = %2, %6
%7 = phi i8 [ %40, %6 ], [ %3, %2 ]
%8 = zext i8 %7 to i32
%9 = and i8 %7, 1
%10 = and i32 %8, 2
%11 = icmp eq i32 %10, 0
%12 = select i1 %11, i8 48, i8 49
%13 = and i32 %8, 4
%14 = icmp eq i32 %13, 0
%15 = select i1 %14, i8 48, i8 49
%16 = and i32 %8, 8
%17 = icmp eq i32 %16, 0
%18 = select i1 %17, i8 48, i8 49
%19 = and i32 %8, 16
%20 = icmp eq i32 %19, 0
%21 = select i1 %20, i8 48, i8 49
%22 = and i32 %8, 32
%23 = icmp eq i32 %22, 0
%24 = select i1 %23, i8 48, i8 49
%25 = and i32 %8, 64
%26 = icmp eq i32 %25, 0
%27 = select i1 %26, i8 48, i8 49
%28 = and i32 %8, 128
%29 = icmp eq i32 %28, 0
%30 = select i1 %29, i8 48, i8 49
%31 = tail call i32 @fputc(i8 signext %30, i32* %1)
%32 = tail call i32 @fputc(i8 signext %27, i32* %1)
%33 = tail call i32 @fputc(i8 signext %24, i32* %1)
%34 = tail call i32 @fputc(i8 signext %21, i32* %1)
%35 = tail call i32 @fputc(i8 signext %18, i32* %1)
%36 = tail call i32 @fputc(i8 signext %15, i32* %1)
%37 = tail call i32 @fputc(i8 signext %12, i32* %1)
%38 = or i8 %9, 48
%39 = tail call i32 @fputc(i8 signext %38, i32* %1)
%40 = tail call signext i8 @fgetc(i32* %0)
%41 = load i8, i8* @EOF
%42 = icmp eq i8 %40, %41
br i1 %42, label %43, label %6
43: ; preds = %6, %2
%44 = tail call i32 @fputc(i8 signext 10, i32* %1)
ret void
}