#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 */

/* Variables and functions */
unsigned char getOneDigit();
int /*<<< orphan*/ putchar(unsigned char);
unsigned int readNum() {
  unsigned char i, j, inChar;
  unsigned int num;
  do {
    do
      inChar = getOneDigit();
    while (inChar == 8);
    if (inChar == 13)
      return 10000;
    putchar(inChar);
    num = inChar - 48;
    for (i = 1; i <= 3; i++) {
      inChar = getOneDigit();
      j = 0;
      if (inChar == 8) {
        do {
          putchar(8);
          putchar(32);
          putchar(8);
          j++;
        } while (j < i);
        break;
      } else
        putchar(inChar);
      if (inChar == 13)
        return num;
      num = num * 10;
      num = num + (inChar - 48);
    }
    if (inChar != 8) {
      do
        inChar = getOneDigit();
      while ((inChar != 13) && (inChar != 8));
      if ((inChar == 8))
        for (j = 0; j < 4; j++) {
          putchar(8);
          putchar(32);
          putchar(8);
        }
    }
  } while (inChar == 8);
  putchar(inChar);
  return num;
}


x86 assembly (clang, -O0):
<readNum>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
jmp    112d <readNum+0xd>
mov    $0x0,%al
call   1040 <getOneDigit@plt>
mov    %al,-0x7(%rbp)
movzbl -0x7(%rbp),%eax
cmp    $0x8,%eax
je     112d <readNum+0xd>
movzbl -0x7(%rbp),%eax
cmp    $0xd,%eax
jne    115d <readNum+0x3d>
movl   $0x2710,-0x4(%rbp)
jmp    12da <readNum+0x1ba>
movzbl -0x7(%rbp),%edi
call   1030 <putchar@plt>
movzbl -0x7(%rbp),%eax
sub    $0x30,%eax
mov    %eax,-0xc(%rbp)
movb   $0x1,-0x5(%rbp)
movzbl -0x5(%rbp),%eax
cmp    $0x3,%eax
jg     1220 <readNum+0x100>
mov    $0x0,%al
call   1040 <getOneDigit@plt>
mov    %al,-0x7(%rbp)
movb   $0x0,-0x6(%rbp)
movzbl -0x7(%rbp),%eax
cmp    $0x8,%eax
jne    11dc <readNum+0xbc>
jmp    11a1 <readNum+0x81>
mov    $0x8,%edi
call   1030 <putchar@plt>
mov    $0x20,%edi
call   1030 <putchar@plt>
mov    $0x8,%edi
call   1030 <putchar@plt>
mov    -0x6(%rbp),%al
add    $0x1,%al
mov    %al,-0x6(%rbp)
movzbl -0x6(%rbp),%eax
movzbl -0x5(%rbp),%ecx
cmp    %ecx,%eax
jl     11a1 <readNum+0x81>
jmp    1220 <readNum+0x100>
movzbl -0x7(%rbp),%edi
call   1030 <putchar@plt>
movzbl -0x7(%rbp),%eax
cmp    $0xd,%eax
jne    11fd <readNum+0xdd>
mov    -0xc(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    12da <readNum+0x1ba>
imul   $0xa,-0xc(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
movzbl -0x7(%rbp),%ecx
sub    $0x30,%ecx
add    %ecx,%eax
mov    %eax,-0xc(%rbp)
mov    -0x5(%rbp),%al
add    $0x1,%al
mov    %al,-0x5(%rbp)
jmp    1174 <readNum+0x54>
movzbl -0x7(%rbp),%eax
cmp    $0x8,%eax
je     12b9 <readNum+0x199>
jmp    1232 <readNum+0x112>
mov    $0x0,%al
call   1040 <getOneDigit@plt>
mov    %al,-0x7(%rbp)
movzbl -0x7(%rbp),%ecx
xor    %eax,%eax
cmp    $0xd,%ecx
mov    %al,-0xd(%rbp)
je     125b <readNum+0x13b>
movzbl -0x7(%rbp),%eax
cmp    $0x8,%eax
setne  %al
mov    %al,-0xd(%rbp)
mov    -0xd(%rbp),%al
test   $0x1,%al
jne    1232 <readNum+0x112>
movzbl -0x7(%rbp),%eax
cmp    $0x8,%eax
jne    12b4 <readNum+0x194>
movb   $0x0,-0x6(%rbp)
movzbl -0x6(%rbp),%eax
cmp    $0x4,%eax
jge    12af <readNum+0x18f>
mov    $0x8,%edi
call   1030 <putchar@plt>
mov    $0x20,%edi
call   1030 <putchar@plt>
mov    $0x8,%edi
call   1030 <putchar@plt>
mov    -0x6(%rbp),%al
add    $0x1,%al
mov    %al,-0x6(%rbp)
jmp    1277 <readNum+0x157>
jmp    12b4 <readNum+0x194>
jmp    12b9 <readNum+0x199>
jmp    12be <readNum+0x19e>
movzbl -0x7(%rbp),%eax
cmp    $0x8,%eax
je     1128 <readNum+0x8>
movzbl -0x7(%rbp),%edi
call   1030 <putchar@plt>
mov    -0xc(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<readNum>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
nopl   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1040 <getOneDigit@plt>
cmp    $0x8,%al
je     1130 <readNum+0x10>
cmp    $0xd,%al
je     12aa <readNum+0x18a>
movzbl %al,%r14d
mov    %r14d,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
call   1040 <getOneDigit@plt>
mov    $0x1,%bl
cmp    $0x8,%al
je     11b0 <readNum+0x90>
mov    %eax,%ebp
movzbl %al,%r13d
mov    %r13d,%edi
call   1030 <putchar@plt>
cmp    $0xd,%bpl
je     12b2 <readNum+0x192>
xor    %eax,%eax
call   1040 <getOneDigit@plt>
mov    $0x2,%bl
cmp    $0x8,%al
je     11b0 <readNum+0x90>
mov    %eax,%ebp
movzbl %al,%r15d
mov    %r15d,%edi
call   1030 <putchar@plt>
cmp    $0xd,%bpl
je     12b8 <readNum+0x198>
xor    %eax,%eax
call   1040 <getOneDigit@plt>
mov    $0x3,%bl
cmp    $0x8,%al
jne    11d8 <readNum+0xb8>
cs nopw 0x0(%rax,%rax,1)
mov    $0x8,%edi
call   1030 <putchar@plt>
mov    $0x20,%edi
call   1030 <putchar@plt>
mov    $0x8,%edi
call   1030 <putchar@plt>
add    $0xff,%bl
jne    11b0 <readNum+0x90>
jmp    1130 <readNum+0x10>
mov    %eax,%ebp
movzbl %al,%r12d
mov    %r12d,%edi
call   1030 <putchar@plt>
cmp    $0xd,%bpl
je     12c6 <readNum+0x1a6>
xor    %eax,%eax
call   1040 <getOneDigit@plt>
cmp    $0xd,%al
je     1280 <readNum+0x160>
cmp    $0x8,%al
jne    11f0 <readNum+0xd0>
mov    $0x8,%edi
call   1030 <putchar@plt>
mov    $0x20,%edi
call   1030 <putchar@plt>
mov    $0x8,%edi
call   1030 <putchar@plt>
mov    $0x8,%edi
call   1030 <putchar@plt>
mov    $0x20,%edi
call   1030 <putchar@plt>
mov    $0x8,%edi
call   1030 <putchar@plt>
mov    $0x8,%edi
call   1030 <putchar@plt>
mov    $0x20,%edi
call   1030 <putchar@plt>
mov    $0x8,%edi
call   1030 <putchar@plt>
mov    $0x8,%edi
call   1030 <putchar@plt>
mov    $0x20,%edi
call   1030 <putchar@plt>
mov    $0x8,%edi
call   1030 <putchar@plt>
jmp    1130 <readNum+0x10>
lea    (%r14,%r14,4),%eax
lea    0x0(%r13,%rax,2),%eax
lea    (%rax,%rax,4),%eax
lea    (%r15,%rax,2),%eax
lea    (%rax,%rax,4),%eax
lea    (%r12,%rax,2),%r14d
add    $0xffff2fb0,%r14d
mov    $0xd,%edi
call   1030 <putchar@plt>
jmp    12dd <readNum+0x1bd>
mov    $0x2710,%r14d
jmp    12dd <readNum+0x1bd>
add    $0xffffffd0,%r14d
jmp    12dd <readNum+0x1bd>
lea    (%r14,%r14,4),%eax
lea    -0x210(%r13,%rax,2),%r14d
ff
jmp    12dd <readNum+0x1bd>
lea    (%r14,%r14,4),%eax
lea    0x0(%r13,%rax,2),%eax
lea    (%rax,%rax,4),%eax
lea    (%r15,%rax,2),%r14d
add    $0xffffeb30,%r14d
mov    %r14d,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
define i32 @readNum() {
br label %1
1: ; preds = %3, %0
%2 = tail call zeroext i8 (...) @getOneDigit()
switch i8 %2, label %4 [
i8 8, label %3
i8 13, label %81
]
3: ; preds = %10, %1, %34
br label %1
4: ; preds = %1
%5 = tail call i32 @putchar(i8 zeroext %2)
%6 = tail call zeroext i8 (...) @getOneDigit()
%7 = icmp eq i8 %6, 8
br i1 %7, label %8, label %17
8: ; preds = %26, %20, %4
%9 = phi i8 [ 1, %4 ], [ 2, %20 ], [ 3, %26 ]
br label %10
10: ; preds = %8, %10
%11 = phi i8 [ %15, %10 ], [ 0, %8 ]
%12 = tail call i32 @putchar(i8 zeroext 8)
%13 = tail call i32 @putchar(i8 zeroext 32)
%14 = tail call i32 @putchar(i8 zeroext 8)
%15 = add nuw nsw i8 %11, 1
%16 = icmp eq i8 %15, %9
br i1 %16, label %3, label %10
17: ; preds = %4
%18 = tail call i32 @putchar(i8 zeroext %6)
%19 = icmp eq i8 %6, 13
br i1 %19, label %78, label %20
20: ; preds = %17
%21 = tail call zeroext i8 (...) @getOneDigit()
%22 = icmp eq i8 %21, 8
br i1 %22, label %8, label %23
23: ; preds = %20
%24 = tail call i32 @putchar(i8 zeroext %21)
%25 = icmp eq i8 %21, 13
br i1 %25, label %72, label %26
26: ; preds = %23
%27 = tail call zeroext i8 (...) @getOneDigit()
%28 = icmp eq i8 %27, 8
br i1 %28, label %8, label %29
29: ; preds = %26
%30 = tail call i32 @putchar(i8 zeroext %27)
%31 = icmp eq i8 %27, 13
br i1 %31, label %62, label %32
32: ; preds = %29, %32
%33 = tail call zeroext i8 (...) @getOneDigit()
switch i8 %33, label %32 [
i8 8, label %34
i8 13, label %47
]
34: ; preds = %32
%35 = tail call i32 @putchar(i8 zeroext 8)
%36 = tail call i32 @putchar(i8 zeroext 32)
%37 = tail call i32 @putchar(i8 zeroext 8)
%38 = tail call i32 @putchar(i8 zeroext 8)
%39 = tail call i32 @putchar(i8 zeroext 32)
%40 = tail call i32 @putchar(i8 zeroext 8)
%41 = tail call i32 @putchar(i8 zeroext 8)
%42 = tail call i32 @putchar(i8 zeroext 32)
%43 = tail call i32 @putchar(i8 zeroext 8)
%44 = tail call i32 @putchar(i8 zeroext 8)
%45 = tail call i32 @putchar(i8 zeroext 32)
%46 = tail call i32 @putchar(i8 zeroext 8)
br label %3
47: ; preds = %32
%48 = zext i8 %2 to i32
%49 = zext i8 %6 to i32
%50 = mul nuw nsw i32 %48, 10
%51 = add nsw i32 %50, -528
%52 = add nsw i32 %51, %49
%53 = zext i8 %21 to i32
%54 = mul nsw i32 %52, 10
%55 = add nsw i32 %54, -48
%56 = add nsw i32 %55, %53
%57 = zext i8 %27 to i32
%58 = mul nsw i32 %56, 10
%59 = add nsw i32 %58, -48
%60 = add nsw i32 %59, %57
%61 = tail call i32 @putchar(i8 zeroext 13)
br label %81
62: ; preds = %29
%63 = zext i8 %2 to i32
%64 = zext i8 %6 to i32
%65 = mul nuw nsw i32 %63, 10
%66 = add nsw i32 %65, -528
%67 = add nsw i32 %66, %64
%68 = zext i8 %21 to i32
%69 = mul nsw i32 %67, 10
%70 = add nsw i32 %69, -48
%71 = add nsw i32 %70, %68
br label %81
72: ; preds = %23
%73 = zext i8 %2 to i32
%74 = zext i8 %6 to i32
%75 = mul nuw nsw i32 %73, 10
%76 = add nsw i32 %75, -528
%77 = add nsw i32 %76, %74
br label %81
78: ; preds = %17
%79 = zext i8 %2 to i32
%80 = add nsw i32 %79, -48
br label %81
81: ; preds = %1, %62, %72, %78, %47
%82 = phi i32 [ %60, %47 ], [ %71, %62 ], [ %77, %72 ], [ %80, %78 ], [ 10000, %1 ]
ret i32 %82
}