#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*/ cerror(char *, int);
int hexchar();
int /*<<< orphan*/ isdigit(int);
int next();
int /*<<< orphan*/ putback(int);
int scanch(void) {
  int c = next();
  int c2;
  if ('\\' == c) {
    switch (c = next()) {
    case 'a':
      return '\a';
    case 'b':
      return '\b';
    case 'f':
      return '\f';
    case 'n':
      return '\n';
    case 'r':
      return '\r';
    case 't':
      return '\t';
    case 'v':
      return '\v';
    case '\\':
      return '\\';
    case '"':
      return '"' | 256;
    case '\'':
      return '\'';
    case '0':
    case '1':
    case '2':
    case '3':
    case '4':
    case '5':
    case '6':
    case '7':
      for (c2 = 0; isdigit(c) && c < '8'; c = next())
        c2 = c2 * 8 + (c - '0');
      putback(c);
      return c2;
    case 'x':
      return hexchar();
    default:
      cerror("unknown escape sequence: %s", c);
      return ' ';
    }
  }
  return c;
}


x86 assembly (clang, -O0):
<scanch>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    $0x0,%al
call   1040 <next@plt>
mov    %eax,-0x8(%rbp)
mov    $0x5c,%eax
cmp    -0x8(%rbp),%eax
jne    12ae <scanch+0x15e>
xor    %eax,%eax
call   1040 <next@plt>
mov    %eax,-0x8(%rbp)
add    $0xffffffde,%eax
mov    %eax,%ecx
mov    %rcx,-0x18(%rbp)
sub    $0x56,%eax
ja     1293 <scanch+0x143>
mov    -0x18(%rbp),%rax
lea    0xe69(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
movl   $0x7,-0x4(%rbp)
jmp    12b4 <scanch+0x164>
movl   $0x8,-0x4(%rbp)
jmp    12b4 <scanch+0x164>
movl   $0xc,-0x4(%rbp)
jmp    12b4 <scanch+0x164>
movl   $0xa,-0x4(%rbp)
jmp    12b4 <scanch+0x164>
movl   $0xd,-0x4(%rbp)
jmp    12b4 <scanch+0x164>
movl   $0x9,-0x4(%rbp)
jmp    12b4 <scanch+0x164>
movl   $0xb,-0x4(%rbp)
jmp    12b4 <scanch+0x164>
movl   $0x5c,-0x4(%rbp)
jmp    12b4 <scanch+0x164>
movl   $0x122,-0x4(%rbp)
jmp    12b4 <scanch+0x164>
movl   $0x27,-0x4(%rbp)
jmp    12b4 <scanch+0x164>
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%edi
call   1030 <isdigit@plt>
mov    %eax,%ecx
xor    %eax,%eax
cmp    $0x0,%ecx
mov    %al,-0x19(%rbp)
je     1241 <scanch+0xf1>
cmpl   $0x38,-0x8(%rbp)
setl   %al
mov    %al,-0x19(%rbp)
mov    -0x19(%rbp),%al
test   $0x1,%al
jne    1251 <scanch+0x101>
jmp    1271 <scanch+0x121>
mov    -0xc(%rbp),%eax
shl    $0x3,%eax
mov    -0x8(%rbp),%ecx
sub    $0x30,%ecx
add    %ecx,%eax
mov    %eax,-0xc(%rbp)
mov    $0x0,%al
call   1040 <next@plt>
mov    %eax,-0x8(%rbp)
jmp    121f <scanch+0xcf>
mov    -0x8(%rbp),%edi
call   1060 <putback@plt>
mov    -0xc(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    12b4 <scanch+0x164>
mov    $0x0,%al
call   1050 <hexchar@plt>
mov    %eax,-0x4(%rbp)
jmp    12b4 <scanch+0x164>
mov    -0x8(%rbp),%esi
lea    0xebf(%rip),%rdi
call   1070 <cerror@plt>
movl   $0x20,-0x4(%rbp)
jmp    12b4 <scanch+0x164>
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<scanch>:
push   %rbx
xor    %eax,%eax
call   1030 <next@plt>
mov    %eax,%ebx
cmp    $0x5c,%eax
jne    11f8 <scanch+0xb8>
xor    %eax,%eax
call   1030 <next@plt>
lea    -0x22(%rax),%ecx
cmp    $0x56,%ecx
ja     11bb <scanch+0x7b>
mov    $0x7,%ebx
lea    0xe92(%rip),%rdx
movslq (%rdx,%rcx,4),%rcx
add    %rdx,%rcx
jmp    *%rcx
mov    %eax,%ecx
and    $0xfffffff8,%ecx
xor    %ebx,%ebx
cmp    $0x30,%ecx
jne    11a7 <scanch+0x67>
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nop
lea    (%rax,%rbx,8),%ebx
add    $0xffffffd0,%ebx
xor    %eax,%eax
call   1030 <next@plt>
mov    %eax,%ecx
and    $0xfffffff8,%ecx
cmp    $0x30,%ecx
je     1190 <scanch+0x50>
mov    %eax,%edi
call   1050 <putback@plt>
jmp    11f8 <scanch+0xb8>
mov    %eax,%ebx
jmp    11f8 <scanch+0xb8>
mov    $0x122,%ebx
jmp    11f8 <scanch+0xb8>
lea    0xf9a(%rip),%rdi
mov    %eax,%esi
call   1060 <cerror@plt>
mov    $0x20,%ebx
jmp    11f8 <scanch+0xb8>
mov    $0x8,%ebx
jmp    11f8 <scanch+0xb8>
mov    $0xc,%ebx
jmp    11f8 <scanch+0xb8>
mov    $0xa,%ebx
jmp    11f8 <scanch+0xb8>
mov    $0xd,%ebx
jmp    11f8 <scanch+0xb8>
mov    $0x9,%ebx
jmp    11f8 <scanch+0xb8>
mov    $0xb,%ebx
mov    %ebx,%eax
pop    %rbx
ret
xor    %eax,%eax
pop    %rbx
jmp    1040 <hexchar@plt>

LLVM IR (-O0):
@.str = [28 x i8] c"unknown escape sequence: %s\00"
define i32 @scanch() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = call i32 (...) @next()
store i32 %4, i32* %2
%5 = load i32, i32* %2
%6 = icmp eq i32 92, %5
br i1 %6, label %7, label %46
7: ; preds = %0
%8 = call i32 (...) @next()
store i32 %8, i32* %2
switch i32 %8, label %43 [
i32 97, label %9
i32 98, label %10
i32 102, label %11
i32 110, label %12
i32 114, label %13
i32 116, label %14
i32 118, label %15
i32 92, label %16
i32 34, label %17
i32 39, label %18
i32 48, label %19
i32 49, label %19
i32 50, label %19
i32 51, label %19
i32 52, label %19
i32 53, label %19
i32 54, label %19
i32 55, label %19
i32 120, label %41
]
9: ; preds = %7
store i32 7, i32* %1
br label %48
10: ; preds = %7
store i32 8, i32* %1
br label %48
11: ; preds = %7
store i32 12, i32* %1
br label %48
12: ; preds = %7
store i32 10, i32* %1
br label %48
13: ; preds = %7
store i32 13, i32* %1
br label %48
14: ; preds = %7
store i32 9, i32* %1
br label %48
15: ; preds = %7
store i32 11, i32* %1
br label %48
16: ; preds = %7
store i32 92, i32* %1
br label %48
17: ; preds = %7
store i32 290, i32* %1
br label %48
18: ; preds = %7
store i32 39, i32* %1
br label %48
19: ; preds = %7, %7, %7, %7, %7, %7, %7, %7
store i32 0, i32* %3
br label %20
20: ; preds = %35, %19
%21 = load i32, i32* %2
%22 = call i32 @isdigit(i32 %21)
%23 = icmp ne i32 %22, 0
br i1 %23, label %24, label %27
24: ; preds = %20
%25 = load i32, i32* %2
%26 = icmp slt i32 %25, 56
br label %27
27: ; preds = %24, %20
%28 = phi i1 [ false, %20 ], [ %26, %24 ]
br i1 %28, label %29, label %37
29: ; preds = %27
%30 = load i32, i32* %3
%31 = mul nsw i32 %30, 8
%32 = load i32, i32* %2
%33 = sub nsw i32 %32, 48
%34 = add nsw i32 %31, %33
store i32 %34, i32* %3
br label %35
35: ; preds = %29
%36 = call i32 (...) @next()
store i32 %36, i32* %2
br label %20
37: ; preds = %27
%38 = load i32, i32* %2
%39 = call i32 @putback(i32 %38)
%40 = load i32, i32* %3
store i32 %40, i32* %1
br label %48
41: ; preds = %7
%42 = call i32 (...) @hexchar()
store i32 %42, i32* %1
br label %48
43: ; preds = %7
%44 = load i32, i32* %2
%45 = call i32 @cerror(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0), i32 %44)
store i32 32, i32* %1
br label %48
46: ; preds = %0
%47 = load i32, i32* %2
store i32 %47, i32* %1
br label %48
48: ; preds = %46, %43, %41, %37, %18, %17, %16, %15, %14, %13, %12, %11, %10, %9
%49 = load i32, i32* %1
ret i32 %49
}

LLVM IR (-O2):
@.str = [28 x i8] c"unknown escape sequence: %s\00"
define i32 @scanch() {
%1 = tail call i32 (...) @next()
%2 = icmp eq i32 %1, 92
br i1 %2, label %3, label %34
3: ; preds = %0
%4 = tail call i32 (...) @next()
switch i32 %4, label %32 [
i32 97, label %34
i32 98, label %5
i32 102, label %6
i32 110, label %7
i32 114, label %8
i32 116, label %9
i32 118, label %10
i32 92, label %11
i32 34, label %12
i32 39, label %13
i32 48, label %14
i32 49, label %14
i32 50, label %14
i32 51, label %14
i32 52, label %14
i32 53, label %14
i32 54, label %14
i32 55, label %14
i32 120, label %30
]
5: ; preds = %3
br label %34
6: ; preds = %3
br label %34
7: ; preds = %3
br label %34
8: ; preds = %3
br label %34
9: ; preds = %3
br label %34
10: ; preds = %3
br label %34
11: ; preds = %3
br label %34
12: ; preds = %3
br label %34
13: ; preds = %3
br label %34
14: ; preds = %3, %3, %3, %3, %3, %3, %3, %3
%15 = and i32 %4, -8
%16 = icmp eq i32 %15, 48
br i1 %16, label %17, label %26
17: ; preds = %14, %17
%18 = phi i32 [ %22, %17 ], [ 0, %14 ]
%19 = phi i32 [ %23, %17 ], [ %4, %14 ]
%20 = shl nsw i32 %18, 3
%21 = add nsw i32 %19, -48
%22 = add nuw nsw i32 %21, %20
%23 = tail call i32 (...) @next()
%24 = and i32 %23, -8
%25 = icmp eq i32 %24, 48
br i1 %25, label %17, label %26
26: ; preds = %17, %14
%27 = phi i32 [ %4, %14 ], [ %23, %17 ]
%28 = phi i32 [ 0, %14 ], [ %22, %17 ]
%29 = tail call i32 @putback(i32 %27)
br label %34
30: ; preds = %3
%31 = tail call i32 (...) @hexchar()
br label %34
32: ; preds = %3
%33 = tail call i32 @cerror(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0), i32 %4)
br label %34
34: ; preds = %0, %3, %32, %30, %26, %13, %12, %11, %10, %9, %8, %7, %6, %5
%35 = phi i32 [ 32, %32 ], [ %31, %30 ], [ %28, %26 ], [ %4, %13 ], [ 290, %12 ], [ %4, %11 ], [ 11, %10 ], [ 9, %9 ], [ 13, %8 ], [ 10, %7 ], [ 12, %6 ], [ 8, %5 ], [ 7, %3 ], [ %1, %0 ]
ret i32 %35
}