#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 */
int /*<<< orphan*/ printf(char *);
int scan(char *s) {
  char *p = s;
  for (;;) {
    {
      char yych;
      yych = *p;
      switch (yych) {
      case 0x00:
        goto yy10;
      case '+':
        goto yy6;
      case '-':
        goto yy8;
      case '0':
        goto yy2;
      case '1':
      case '2':
      case '3':
      case '4':
      case '5':
      case '6':
      case '7':
      case '8':
      case '9':
        goto yy4;
      default:
        goto yy12;
      }
    yy2:
      ++p;
      switch ((yych = *p)) {
      case '0':
      case '1':
      case '2':
      case '3':
      case '4':
      case '5':
      case '6':
      case '7':
      case '8':
      case '9':
        goto yy16;
      default:
        goto yy3;
      }
    yy3 : {
      printf("Num\n");
      continue;
    }
    yy4:
      ++p;
      yych = *p;
      goto yy15;
    yy5 : {
      printf("Num\n");
      continue;
    }
    yy6:
      ++p;
      {
        printf("+\n");
        continue;
      }
    yy8:
      ++p;
      {
        printf("-\n");
        continue;
      }
    yy10:
      ++p;
      {
        printf("EOF\n");
        return 0;
      }
    yy12:
      ++p;
      {
        printf("ERR\n");
        return 1;
      }
    yy14:
      ++p;
      yych = *p;
    yy15:
      switch (yych) {
      case '0':
      case '1':
      case '2':
      case '3':
      case '4':
      case '5':
      case '6':
      case '7':
      case '8':
      case '9':
        goto yy14;
      default:
        goto yy5;
      }
    yy16:
      ++p;
      yych = *p;
      switch (yych) {
      case '0':
      case '1':
      case '2':
      case '3':
      case '4':
      case '5':
      case '6':
      case '7':
      case '8':
      case '9':
        goto yy16;
      default:
        goto yy18;
      }
    yy18 : {
      printf("Oct\n");
      continue;
    }
    }
  }
}


x86 assembly (clang, -O0):
<scan>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
mov    (%rax),%al
mov    %al,-0x19(%rbp)
movsbl -0x19(%rbp),%eax
mov    %eax,%ecx
mov    %rcx,-0x28(%rbp)
sub    $0x39,%eax
ja     116d <scan+0x5d>
mov    -0x28(%rbp),%rax
lea    0xeb5(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
jmp    121b <scan+0x10b>
jmp    11e1 <scan+0xd1>
jmp    11fe <scan+0xee>
jmp    1172 <scan+0x62>
jmp    11b6 <scan+0xa6>
jmp    123f <scan+0x12f>
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
movsbl (%rax),%eax
mov    %al,%cl
mov    %cl,-0x19(%rbp)
add    $0xffffffd0,%eax
sub    $0x9,%eax
ja     11a0 <scan+0x90>
jmp    119b <scan+0x8b>
jmp    1297 <scan+0x187>
jmp    11a5 <scan+0x95>
lea    0xf3c(%rip),%rdi
call   1030 <printf@plt>
jmp    1124 <scan+0x14>
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
mov    (%rax),%al
mov    %al,-0x19(%rbp)
jmp    1278 <scan+0x168>
lea    0xf11(%rip),%rdi
call   1030 <printf@plt>
jmp    1124 <scan+0x14>
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
lea    0xef9(%rip),%rdi
call   1030 <printf@plt>
jmp    1124 <scan+0x14>
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
lea    0xedf(%rip),%rdi
call   1030 <printf@plt>
jmp    1124 <scan+0x14>
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
lea    0xec5(%rip),%rdi
call   1030 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    12dc <scan+0x1cc>
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
lea    0xea6(%rip),%rdi
call   1030 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    12dc <scan+0x1cc>
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
mov    (%rax),%al
mov    %al,-0x19(%rbp)
movsbl -0x19(%rbp),%eax
add    $0xffffffd0,%eax
sub    $0x9,%eax
ja     1292 <scan+0x182>
jmp    128d <scan+0x17d>
jmp    1263 <scan+0x153>
jmp    11d0 <scan+0xc0>
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
mov    (%rax),%al
mov    %al,-0x19(%rbp)
movsbl -0x19(%rbp),%eax
add    $0xffffffd0,%eax
sub    $0x9,%eax
ja     12c6 <scan+0x1b6>
jmp    12c1 <scan+0x1b1>
jmp    1297 <scan+0x187>
jmp    12cb <scan+0x1bb>
lea    0xe2b(%rip),%rdi
call   1030 <printf@plt>
jmp    1124 <scan+0x14>
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<scan>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
mov    %rdi,%rbx
lea    0xee1(%rip),%r14
lea    0xee0(%rip),%r15
lea    0xed7(%rip),%r12
lea    0xec8(%rip),%r13
jmp    1150 <scan+0x40>
add    $0x1,%rbx
mov    %r12,%rdi
call   1030 <puts@plt>
cs nopw 0x0(%rax,%rax,1)
movsbl (%rbx),%eax
lea    -0x31(%rax),%ecx
cmp    $0x9,%ecx
jae    1180 <scan+0x70>
nopl   0x0(%rax,%rax,1)
movsbl 0x1(%rbx),%eax
add    $0x1,%rbx
add    $0xffffffd0,%eax
cmp    $0xa,%eax
jb     1160 <scan+0x50>
mov    %r14,%rdi
call   1030 <puts@plt>
jmp    1150 <scan+0x40>
nopw   0x0(%rax,%rax,1)
cmp    $0x2c,%eax
jle    11ca <scan+0xba>
cmp    $0x2d,%eax
je     113a <scan+0x2a>
cmp    $0x30,%eax
jne    11ef <scan+0xdf>
movsbl 0x1(%rbx),%eax
add    $0x1,%rbx
add    $0xffffffd0,%eax
mov    %r14,%rdi
cmp    $0x9,%eax
ja     1173 <scan+0x63>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
movsbl 0x1(%rbx),%eax
add    $0x1,%rbx
add    $0xffffffd0,%eax
cmp    $0xa,%eax
jb     11b0 <scan+0xa0>
mov    %r13,%rdi
call   1030 <puts@plt>
jmp    1150 <scan+0x40>
cmp    $0x2b,%eax
jne    11e0 <scan+0xd0>
add    $0x1,%rbx
mov    %r15,%rdi
call   1030 <puts@plt>
jmp    1150 <scan+0x40>
test   %eax,%eax
jne    11ef <scan+0xdf>
xor    %ebx,%ebx
lea    0xe1f(%rip),%rdi
jmp    11fb <scan+0xeb>
mov    $0x1,%ebx
lea    0xe15(%rip),%rdi
call   1030 <puts@plt>
mov    %ebx,%eax
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [5 x i8] c"Num\0A\00"
@.str.1 = [3 x i8] c"+\0A\00"
@.str.2 = [3 x i8] c"-\0A\00"
@.str.3 = [5 x i8] c"EOF\0A\00"
@.str.4 = [5 x i8] c"ERR\0A\00"
@.str.5 = [5 x i8] c"Oct\0A\00"
define i32 @scan(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i8
store i8* %0, i8** %3
%6 = load i8*, i8** %3
store i8* %6, i8** %4
br label %7
7: ; preds = %70, %39, %35, %33, %26, %1
%8 = load i8*, i8** %4
%9 = load i8, i8* %8
store i8 %9, i8* %5
%10 = load i8, i8* %5
%11 = sext i8 %10 to i32
switch i32 %11, label %17 [
i32 0, label %12
i32 43, label %13
i32 45, label %14
i32 48, label %15
i32 49, label %16
i32 50, label %16
i32 51, label %16
i32 52, label %16
i32 53, label %16
i32 54, label %16
i32 55, label %16
i32 56, label %16
i32 57, label %16
]
12: ; preds = %7
br label %43
13: ; preds = %7
br label %35
14: ; preds = %7
br label %39
15: ; preds = %7
br label %18
16: ; preds = %7, %7, %7, %7, %7, %7, %7, %7, %7
br label %28
17: ; preds = %7
br label %47
18: ; preds = %15
%19 = load i8*, i8** %4
%20 = getelementptr inbounds i8, i8* %19, i32 1
store i8* %20, i8** %4
%21 = load i8*, i8** %4
%22 = load i8, i8* %21
store i8 %22, i8* %5
%23 = sext i8 %22 to i32
switch i32 %23, label %25 [
i32 48, label %24
i32 49, label %24
i32 50, label %24
i32 51, label %24
i32 52, label %24
i32 53, label %24
i32 54, label %24
i32 55, label %24
i32 56, label %24
i32 57, label %24
]
24: ; preds = %18, %18, %18, %18, %18, %18, %18, %18, %18, %18
br label %61
25: ; preds = %18
br label %26
26: ; preds = %25
%27 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
br label %7
28: ; preds = %16
%29 = load i8*, i8** %4
%30 = getelementptr inbounds i8, i8* %29, i32 1
store i8* %30, i8** %4
%31 = load i8*, i8** %4
%32 = load i8, i8* %31
store i8 %32, i8* %5
br label %56
33: ; preds = %60
%34 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
br label %7
35: ; preds = %13
%36 = load i8*, i8** %4
%37 = getelementptr inbounds i8, i8* %36, i32 1
store i8* %37, i8** %4
%38 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
br label %7
39: ; preds = %14
%40 = load i8*, i8** %4
%41 = getelementptr inbounds i8, i8* %40, i32 1
store i8* %41, i8** %4
%42 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
br label %7
43: ; preds = %12
%44 = load i8*, i8** %4
%45 = getelementptr inbounds i8, i8* %44, i32 1
store i8* %45, i8** %4
%46 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0))
store i32 0, i32* %2
br label %72
47: ; preds = %17
%48 = load i8*, i8** %4
%49 = getelementptr inbounds i8, i8* %48, i32 1
store i8* %49, i8** %4
%50 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0))
store i32 1, i32* %2
br label %72
51: ; preds = %59
%52 = load i8*, i8** %4
%53 = getelementptr inbounds i8, i8* %52, i32 1
store i8* %53, i8** %4
%54 = load i8*, i8** %4
%55 = load i8, i8* %54
store i8 %55, i8* %5
br label %56
56: ; preds = %51, %28
%57 = load i8, i8* %5
%58 = sext i8 %57 to i32
switch i32 %58, label %60 [
i32 48, label %59
i32 49, label %59
i32 50, label %59
i32 51, label %59
i32 52, label %59
i32 53, label %59
i32 54, label %59
i32 55, label %59
i32 56, label %59
i32 57, label %59
]
59: ; preds = %56, %56, %56, %56, %56, %56, %56, %56, %56, %56
br label %51
60: ; preds = %56
br label %33
61: ; preds = %68, %24
%62 = load i8*, i8** %4
%63 = getelementptr inbounds i8, i8* %62, i32 1
store i8* %63, i8** %4
%64 = load i8*, i8** %4
%65 = load i8, i8* %64
store i8 %65, i8* %5
%66 = load i8, i8* %5
%67 = sext i8 %66 to i32
switch i32 %67, label %69 [
i32 48, label %68
i32 49, label %68
i32 50, label %68
i32 51, label %68
i32 52, label %68
i32 53, label %68
i32 54, label %68
i32 55, label %68
i32 56, label %68
i32 57, label %68
]
68: ; preds = %61, %61, %61, %61, %61, %61, %61, %61, %61, %61
br label %61
69: ; preds = %61
br label %70
70: ; preds = %69
%71 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i64 0, i64 0))
br label %7
72: ; preds = %47, %43
%73 = load i32, i32* %2
ret i32 %73
}

LLVM IR (-O2):
@str.6 = [4 x i8] c"Oct\00"
@str.7 = [4 x i8] c"Num\00"
@str.8 = [2 x i8] c"-\00"
@str.9 = [2 x i8] c"+\00"
@str.10 = [4 x i8] c"EOF\00"
@str.11 = [4 x i8] c"ERR\00"
define i32 @scan(i8* nocapture %0) {
br label %2
2: ; preds = %31, %1
%3 = phi i8* [ %0, %1 ], [ %33, %31 ]
%4 = load i8, i8* %3
%5 = sext i8 %4 to i32
switch i32 %5, label %35 [
i32 0, label %36
i32 43, label %13
i32 45, label %15
i32 48, label %7
i32 49, label %6
i32 50, label %6
i32 51, label %6
i32 52, label %6
i32 53, label %6
i32 54, label %6
i32 55, label %6
i32 56, label %6
i32 57, label %6
]
6: ; preds = %2, %2, %2, %2, %2, %2, %2, %2, %2
br label %17
7: ; preds = %2
%8 = getelementptr inbounds i8, i8* %3, i64 1
%9 = load i8, i8* %8
%10 = sext i8 %9 to i32
%11 = add nsw i32 %10, -48
%12 = icmp ult i32 %11, 10
br i1 %12, label %24, label %31
13: ; preds = %2
%14 = getelementptr inbounds i8, i8* %3, i64 1
br label %31
15: ; preds = %2
%16 = getelementptr inbounds i8, i8* %3, i64 1
br label %31
17: ; preds = %6, %17
%18 = phi i8* [ %19, %17 ], [ %3, %6 ]
%19 = getelementptr inbounds i8, i8* %18, i64 1
%20 = load i8, i8* %19
%21 = sext i8 %20 to i32
%22 = add nsw i32 %21, -48
%23 = icmp ult i32 %22, 10
br i1 %23, label %17, label %31
24: ; preds = %7, %24
%25 = phi i8* [ %26, %24 ], [ %8, %7 ]
%26 = getelementptr inbounds i8, i8* %25, i64 1
%27 = load i8, i8* %26
%28 = sext i8 %27 to i32
%29 = add nsw i32 %28, -48
%30 = icmp ult i32 %29, 10
br i1 %30, label %24, label %31
31: ; preds = %17, %24, %7, %15, %13
%32 = phi i8* [ getelementptr inbounds ([2 x i8], [2 x i8]* @str.8, i64 0, i64 0), %15 ], [ getelementptr inbounds ([2 x i8], [2 x i8]* @str.9, i64 0, i64 0), %13 ], [ getelementptr inbounds ([4 x i8], [4 x i8]* @str.7, i64 0, i64 0), %7 ], [ getelementptr inbounds ([4 x i8], [4 x i8]* @str.6, i64 0, i64 0), %24 ], [ getelementptr inbounds ([4 x i8], [4 x i8]* @str.7, i64 0, i64 0), %17 ]
%33 = phi i8* [ %16, %15 ], [ %14, %13 ], [ %8, %7 ], [ %26, %24 ], [ %19, %17 ]
%34 = tail call i32 @puts(i8* dereferenceable(1) %32)
br label %2
35: ; preds = %2
br label %36
36: ; preds = %2, %35
%37 = phi i8* [ getelementptr inbounds ([4 x i8], [4 x i8]* @str.11, i64 0, i64 0), %35 ], [ getelementptr inbounds ([4 x i8], [4 x i8]* @str.10, i64 0, i64 0), %2 ]
%38 = phi i32 [ 1, %35 ], [ 0, %2 ]
%39 = tail call i32 @puts(i8* dereferenceable(1) %37)
ret i32 %38
}