#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 */
struct DigitBits {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ DigitBitsOutput(struct DigitBits const *,
                                   int /*<<< orphan*/);
struct DigitBits *DigitToBits(char);
char EOF;
int EXIT_SUCCESS;
char getchar();
int /*<<< orphan*/ stdout;
int main(void) {
  const struct DigitBits *digitPtr = NULL;
  char c = '\0';
  int digitCount = 0;
  while (c != EOF) {
    digitCount = 0;
    while ((c = getchar()) != '\n' && c != EOF && digitCount < 10) {
      digitPtr = DigitToBits(c);
      if (digitPtr) {
        DigitBitsOutput(digitPtr, stdout);
        ++digitCount;
      }
    }
  }
  getchar();
  return EXIT_SUCCESS;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movq   $0x0,-0x10(%rbp)
movb   $0x0,-0x11(%rbp)
movl   $0x0,-0x18(%rbp)
movsbl -0x11(%rbp),%eax
mov    0x2e8b(%rip),%rcx
movsbl (%rcx),%ecx
cmp    %ecx,%eax
je     11fc <main+0xcc>
movl   $0x0,-0x18(%rbp)
mov    $0x0,%al
call   1040 <getchar@plt>
mov    %al,-0x11(%rbp)
movsbl %al,%ecx
xor    %eax,%eax
cmp    $0xa,%ecx
mov    %al,-0x19(%rbp)
je     11af <main+0x7f>
movsbl -0x11(%rbp),%ecx
mov    0x2e53(%rip),%rax
movsbl (%rax),%edx
xor    %eax,%eax
cmp    %edx,%ecx
mov    %al,-0x19(%rbp)
je     11af <main+0x7f>
cmpl   $0xa,-0x18(%rbp)
setl   %al
mov    %al,-0x19(%rbp)
mov    -0x19(%rbp),%al
test   $0x1,%al
jne    11bf <main+0x8f>
jmp    11f7 <main+0xc7>
movsbl -0x11(%rbp),%edi
call   1030 <DigitToBits@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     11f2 <main+0xc2>
mov    -0x10(%rbp),%rdi
mov    0x2df6(%rip),%rax
mov    (%rax),%esi
call   1050 <DigitBitsOutput@plt>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    116f <main+0x3f>
jmp    1152 <main+0x22>
mov    $0x0,%al
call   1040 <getchar@plt>
mov    0x2dc6(%rip),%rax
mov    (%rax),%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
cmpb   $0x0,(%rbx)
je     11a1 <main+0x71>
mov    0x2e8e(%rip),%r14
jmp    1158 <main+0x28>
nopl   0x0(%rax)
mov    %eax,%r15d
cmp    (%rbx),%r15b
je     11a1 <main+0x71>
xor    %eax,%eax
call   1040 <getchar@plt>
mov    $0xa,%r15b
cmp    $0xa,%al
je     1153 <main+0x23>
xor    %ebp,%ebp
jmp    117b <main+0x4b>
nopw   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1040 <getchar@plt>
cmp    $0xa,%al
je     1153 <main+0x23>
cmp    (%rbx),%al
je     1150 <main+0x20>
cmp    $0x9,%ebp
jg     1150 <main+0x20>
movsbl %al,%edi
call   1030 <DigitToBits@plt>
test   %rax,%rax
je     1170 <main+0x40>
mov    (%r14),%esi
mov    %rax,%rdi
call   1050 <DigitBitsOutput@plt>
add    $0x1,%ebp
jmp    1170 <main+0x40>
xor    %eax,%eax
call   1040 <getchar@plt>
mov    0x2e21(%rip),%rax
mov    (%rax),%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.DigitBits = type { i32 }
@EOF = global i8 0
@stdout = global i32 0
@EXIT_SUCCESS = global i32 0
define i32 @main() {
%1 = alloca i32
%2 = alloca %struct.DigitBits*
%3 = alloca i8
%4 = alloca i32
store i32 0, i32* %1
store %struct.DigitBits* null, %struct.DigitBits** %2
store i8 0, i8* %3
store i32 0, i32* %4
br label %5
5: ; preds = %39, %0
%6 = load i8, i8* %3
%7 = sext i8 %6 to i32
%8 = load i8, i8* @EOF
%9 = sext i8 %8 to i32
%10 = icmp ne i32 %7, %9
br i1 %10, label %11, label %40
11: ; preds = %5
store i32 0, i32* %4
br label %12
12: ; preds = %38, %11
%13 = call signext i8 (...) @getchar()
store i8 %13, i8* %3
%14 = sext i8 %13 to i32
%15 = icmp ne i32 %14, 10
br i1 %15, label %16, label %25
16: ; preds = %12
%17 = load i8, i8* %3
%18 = sext i8 %17 to i32
%19 = load i8, i8* @EOF
%20 = sext i8 %19 to i32
%21 = icmp ne i32 %18, %20
br i1 %21, label %22, label %25
22: ; preds = %16
%23 = load i32, i32* %4
%24 = icmp slt i32 %23, 10
br label %25
25: ; preds = %22, %16, %12
%26 = phi i1 [ false, %16 ], [ false, %12 ], [ %24, %22 ]
br i1 %26, label %27, label %39
27: ; preds = %25
%28 = load i8, i8* %3
%29 = call %struct.DigitBits* @DigitToBits(i8 signext %28)
store %struct.DigitBits* %29, %struct.DigitBits** %2
%30 = load %struct.DigitBits*, %struct.DigitBits** %2
%31 = icmp ne %struct.DigitBits* %30, null
br i1 %31, label %32, label %38
32: ; preds = %27
%33 = load %struct.DigitBits*, %struct.DigitBits** %2
%34 = load i32, i32* @stdout
%35 = call i32 @DigitBitsOutput(%struct.DigitBits* %33, i32 %34)
%36 = load i32, i32* %4
%37 = add nsw i32 %36, 1
store i32 %37, i32* %4
br label %38
38: ; preds = %32, %27
br label %12
39: ; preds = %25
br label %5
40: ; preds = %5
%41 = call signext i8 (...) @getchar()
%42 = load i32, i32* @EXIT_SUCCESS
ret i32 %42
}

LLVM IR (-O2):
%struct.DigitBits = type { i32 }
@EOF = global i8 0
@stdout = global i32 0
@EXIT_SUCCESS = global i32 0
define i32 @main() {
%1 = load i8, i8* @EOF
%2 = icmp eq i8 %1, 0
br i1 %2, label %28, label %3
3: ; preds = %0, %24
%4 = tail call signext i8 (...) @getchar()
%5 = icmp eq i8 %4, 10
br i1 %5, label %24, label %6
6: ; preds = %3, %20
%7 = phi i8 [ %22, %20 ], [ %4, %3 ]
%8 = phi i32 [ %21, %20 ], [ 0, %3 ]
%9 = load i8, i8* @EOF
%10 = icmp ne i8 %7, %9
%11 = icmp slt i32 %8, 10
%12 = select i1 %10, i1 %11, i1 false
br i1 %12, label %13, label %24
13: ; preds = %6
%14 = tail call %struct.DigitBits* @DigitToBits(i8 signext %7)
%15 = icmp eq %struct.DigitBits* %14, null
br i1 %15, label %20, label %16
16: ; preds = %13
%17 = load i32, i32* @stdout
%18 = tail call i32 @DigitBitsOutput(%struct.DigitBits* %14, i32 %17)
%19 = add nsw i32 %8, 1
br label %20
20: ; preds = %16, %13
%21 = phi i32 [ %19, %16 ], [ %8, %13 ]
%22 = tail call signext i8 (...) @getchar()
%23 = icmp eq i8 %22, 10
br i1 %23, label %24, label %6
24: ; preds = %6, %20, %3
%25 = phi i8 [ 10, %3 ], [ 10, %20 ], [ %7, %6 ]
%26 = load i8, i8* @EOF
%27 = icmp eq i8 %25, %26
br i1 %27, label %28, label %3
28: ; preds = %24, %0
%29 = tail call signext i8 (...) @getchar()
%30 = load i32, i32* @EXIT_SUCCESS
ret i32 %30
}