#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 */
char ch();
int /*<<< orphan*/ gch();
spechar() {
  char c;
  c = ch();
  if (c == 0)
    return 0;
  else if (c == 'n')
    c = 10;
  else if (c == 't')
    c = 9;
  else if (c == 'r')
    c = 13;
  else if (c == 'f')
    c = 12;
  else if (c == 'b')
    c = 8;
  else if (c >= '0' && c <= '7') {
    int n = c - '0';
    gch();
    c = ch();
    if (c < '0' || c > '7')
      return n;
    n = (n << 3) + c - '0';
    gch();
    c = ch();
    if (c < '0' || c > '7')
      return n;
    n = (n << 3) + c - '0';
    gch();
    return n;
  }
  gch();
  return c;
}


x86 assembly (clang, -O0):
<spechar>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1030 <ch@plt>
mov    %al,-0x5(%rbp)
movsbl -0x5(%rbp),%eax
cmp    $0x0,%eax
jne    114b <spechar+0x2b>
movl   $0x0,-0x4(%rbp)
jmp    12ab <spechar+0x18b>
movsbl -0x5(%rbp),%eax
cmp    $0x6e,%eax
jne    1161 <spechar+0x41>
movb   $0xa,-0x5(%rbp)
jmp    1298 <spechar+0x178>
movsbl -0x5(%rbp),%eax
cmp    $0x74,%eax
jne    1177 <spechar+0x57>
movb   $0x9,-0x5(%rbp)
jmp    1293 <spechar+0x173>
movsbl -0x5(%rbp),%eax
cmp    $0x72,%eax
jne    118d <spechar+0x6d>
movb   $0xd,-0x5(%rbp)
jmp    128e <spechar+0x16e>
movsbl -0x5(%rbp),%eax
cmp    $0x66,%eax
jne    11a3 <spechar+0x83>
movb   $0xc,-0x5(%rbp)
jmp    1289 <spechar+0x169>
movsbl -0x5(%rbp),%eax
cmp    $0x62,%eax
jne    11b9 <spechar+0x99>
movb   $0x8,-0x5(%rbp)
jmp    1284 <spechar+0x164>
movsbl -0x5(%rbp),%eax
cmp    $0x30,%eax
jl     127f <spechar+0x15f>
movsbl -0x5(%rbp),%eax
cmp    $0x37,%eax
jg     127f <spechar+0x15f>
movsbl -0x5(%rbp),%eax
sub    $0x30,%eax
mov    %eax,-0xc(%rbp)
mov    $0x0,%al
call   1040 <gch@plt>
mov    $0x0,%al
call   1030 <ch@plt>
mov    %al,-0x5(%rbp)
movsbl -0x5(%rbp),%eax
cmp    $0x30,%eax
jl     1208 <spechar+0xe8>
movsbl -0x5(%rbp),%eax
cmp    $0x37,%eax
jle    1213 <spechar+0xf3>
mov    -0xc(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    12ab <spechar+0x18b>
mov    -0xc(%rbp),%eax
shl    $0x3,%eax
movsbl -0x5(%rbp),%ecx
add    %ecx,%eax
sub    $0x30,%eax
mov    %eax,-0xc(%rbp)
mov    $0x0,%al
call   1040 <gch@plt>
mov    $0x0,%al
call   1030 <ch@plt>
mov    %al,-0x5(%rbp)
movsbl -0x5(%rbp),%eax
cmp    $0x30,%eax
jl     1250 <spechar+0x130>
movsbl -0x5(%rbp),%eax
cmp    $0x37,%eax
jle    125b <spechar+0x13b>
mov    -0xc(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    12ab <spechar+0x18b>
mov    -0xc(%rbp),%eax
shl    $0x3,%eax
movsbl -0x5(%rbp),%ecx
add    %ecx,%eax
sub    $0x30,%eax
mov    %eax,-0xc(%rbp)
mov    $0x0,%al
call   1040 <gch@plt>
mov    -0xc(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    12ab <spechar+0x18b>
jmp    1284 <spechar+0x164>
jmp    1289 <spechar+0x169>
jmp    128e <spechar+0x16e>
jmp    1293 <spechar+0x173>
jmp    1298 <spechar+0x178>
jmp    129d <spechar+0x17d>
mov    $0x0,%al
call   1040 <gch@plt>
movsbl -0x5(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<spechar>:
push   %rbx
xor    %ebx,%ebx
xor    %eax,%eax
call   1030 <ch@plt>
lea    -0x62(%rax),%ecx
cmp    $0x12,%cl
ja     114b <spechar+0x2b>
mov    $0xa,%bl
movzbl %cl,%ecx
lea    0xec2(%rip),%rdx
movslq (%rdx,%rcx,4),%rcx
add    %rdx,%rcx
jmp    *%rcx
mov    $0x8,%bl
jmp    11b2 <spechar+0x92>
test   %al,%al
je     11bc <spechar+0x9c>
mov    %eax,%ecx
and    $0xf8,%cl
mov    %eax,%ebx
cmp    $0x30,%cl
jne    11b2 <spechar+0x92>
movsbl %al,%ebx
add    $0xffffffd0,%ebx
xor    %eax,%eax
call   1040 <gch@plt>
xor    %eax,%eax
call   1030 <ch@plt>
lea    -0x38(%rax),%ecx
cmp    $0xf8,%cl
jb     11bc <spechar+0x9c>
movzbl %al,%eax
lea    (%rax,%rbx,8),%ebx
add    $0xffffffd0,%ebx
xor    %eax,%eax
call   1040 <gch@plt>
xor    %eax,%eax
call   1030 <ch@plt>
lea    -0x38(%rax),%ecx
cmp    $0xf8,%cl
jb     11bc <spechar+0x9c>
movzbl %al,%eax
lea    (%rax,%rbx,8),%ebx
add    $0xffffffd0,%ebx
xor    %eax,%eax
call   1040 <gch@plt>
jmp    11bc <spechar+0x9c>
mov    $0xc,%bl
jmp    11b2 <spechar+0x92>
mov    $0xd,%bl
jmp    11b2 <spechar+0x92>
mov    $0x9,%bl
xor    %eax,%eax
call   1040 <gch@plt>
movsbl %bl,%ebx
mov    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @spechar() {
%1 = alloca i32
%2 = alloca i8
%3 = alloca i32
%4 = call signext i8 (...) @ch()
store i8 %4, i8* %2
%5 = load i8, i8* %2
%6 = sext i8 %5 to i32
%7 = icmp eq i32 %6, 0
br i1 %7, label %8, label %9
8: ; preds = %0
store i32 0, i32* %1
br label %94
9: ; preds = %0
%10 = load i8, i8* %2
%11 = sext i8 %10 to i32
%12 = icmp eq i32 %11, 110
br i1 %12, label %13, label %14
13: ; preds = %9
store i8 10, i8* %2
br label %89
14: ; preds = %9
%15 = load i8, i8* %2
%16 = sext i8 %15 to i32
%17 = icmp eq i32 %16, 116
br i1 %17, label %18, label %19
18: ; preds = %14
store i8 9, i8* %2
br label %88
19: ; preds = %14
%20 = load i8, i8* %2
%21 = sext i8 %20 to i32
%22 = icmp eq i32 %21, 114
br i1 %22, label %23, label %24
23: ; preds = %19
store i8 13, i8* %2
br label %87
24: ; preds = %19
%25 = load i8, i8* %2
%26 = sext i8 %25 to i32
%27 = icmp eq i32 %26, 102
br i1 %27, label %28, label %29
28: ; preds = %24
store i8 12, i8* %2
br label %86
29: ; preds = %24
%30 = load i8, i8* %2
%31 = sext i8 %30 to i32
%32 = icmp eq i32 %31, 98
br i1 %32, label %33, label %34
33: ; preds = %29
store i8 8, i8* %2
br label %85
34: ; preds = %29
%35 = load i8, i8* %2
%36 = sext i8 %35 to i32
%37 = icmp sge i32 %36, 48
br i1 %37, label %38, label %84
38: ; preds = %34
%39 = load i8, i8* %2
%40 = sext i8 %39 to i32
%41 = icmp sle i32 %40, 55
br i1 %41, label %42, label %84
42: ; preds = %38
%43 = load i8, i8* %2
%44 = sext i8 %43 to i32
%45 = sub nsw i32 %44, 48
store i32 %45, i32* %3
%46 = call i32 (...) @gch()
%47 = call signext i8 (...) @ch()
store i8 %47, i8* %2
%48 = load i8, i8* %2
%49 = sext i8 %48 to i32
%50 = icmp slt i32 %49, 48
br i1 %50, label %55, label %51
51: ; preds = %42
%52 = load i8, i8* %2
%53 = sext i8 %52 to i32
%54 = icmp sgt i32 %53, 55
br i1 %54, label %55, label %57
55: ; preds = %51, %42
%56 = load i32, i32* %3
store i32 %56, i32* %1
br label %94
57: ; preds = %51
%58 = load i32, i32* %3
%59 = shl i32 %58, 3
%60 = load i8, i8* %2
%61 = sext i8 %60 to i32
%62 = add nsw i32 %59, %61
%63 = sub nsw i32 %62, 48
store i32 %63, i32* %3
%64 = call i32 (...) @gch()
%65 = call signext i8 (...) @ch()
store i8 %65, i8* %2
%66 = load i8, i8* %2
%67 = sext i8 %66 to i32
%68 = icmp slt i32 %67, 48
br i1 %68, label %73, label %69
69: ; preds = %57
%70 = load i8, i8* %2
%71 = sext i8 %70 to i32
%72 = icmp sgt i32 %71, 55
br i1 %72, label %73, label %75
73: ; preds = %69, %57
%74 = load i32, i32* %3
store i32 %74, i32* %1
br label %94
75: ; preds = %69
%76 = load i32, i32* %3
%77 = shl i32 %76, 3
%78 = load i8, i8* %2
%79 = sext i8 %78 to i32
%80 = add nsw i32 %77, %79
%81 = sub nsw i32 %80, 48
store i32 %81, i32* %3
%82 = call i32 (...) @gch()
%83 = load i32, i32* %3
store i32 %83, i32* %1
br label %94
84: ; preds = %38, %34
br label %85
85: ; preds = %84, %33
br label %86
86: ; preds = %85, %28
br label %87
87: ; preds = %86, %23
br label %88
88: ; preds = %87, %18
br label %89
89: ; preds = %88, %13
br label %90
90: ; preds = %89
%91 = call i32 (...) @gch()
%92 = load i8, i8* %2
%93 = sext i8 %92 to i32
store i32 %93, i32* %1
br label %94
94: ; preds = %90, %75, %73, %55, %8
%95 = load i32, i32* %1
ret i32 %95
}

LLVM IR (-O2):
define i32 @spechar() {
%1 = tail call signext i8 (...) @ch()
%2 = sext i8 %1 to i32
switch i8 %1, label %7 [
i8 0, label %35
i8 110, label %31
i8 116, label %3
i8 114, label %4
i8 102, label %5
i8 98, label %6
]
3: ; preds = %0
br label %31
4: ; preds = %0
br label %31
5: ; preds = %0
br label %31
6: ; preds = %0
br label %31
7: ; preds = %0
%8 = and i8 %1, -8
%9 = icmp eq i8 %8, 48
br i1 %9, label %10, label %31
10: ; preds = %7
%11 = add nsw i32 %2, -48
%12 = tail call i32 (...) @gch()
%13 = tail call signext i8 (...) @ch()
%14 = add i8 %13, -56
%15 = icmp ult i8 %14, -8
br i1 %15, label %35, label %16
16: ; preds = %10
%17 = zext i8 %13 to i32
%18 = shl nsw i32 %11, 3
%19 = add nsw i32 %18, -48
%20 = add nsw i32 %19, %17
%21 = tail call i32 (...) @gch()
%22 = tail call signext i8 (...) @ch()
%23 = add i8 %22, -56
%24 = icmp ult i8 %23, -8
br i1 %24, label %35, label %25
25: ; preds = %16
%26 = zext i8 %22 to i32
%27 = shl nsw i32 %20, 3
%28 = add nsw i32 %27, -48
%29 = add i32 %28, %26
%30 = tail call i32 (...) @gch()
br label %35
31: ; preds = %0, %4, %6, %7, %5, %3
%32 = phi i8 [ 9, %3 ], [ 13, %4 ], [ 12, %5 ], [ 8, %6 ], [ %1, %7 ], [ 10, %0 ]
%33 = tail call i32 (...) @gch()
%34 = sext i8 %32 to i32
br label %35
35: ; preds = %25, %10, %16, %0, %31
%36 = phi i32 [ %34, %31 ], [ 0, %0 ], [ %29, %25 ], [ %11, %10 ], [ %20, %16 ]
ret i32 %36
}