#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*/ strlen(char *);
int /*<<< orphan*/ yyerror(char *);
char scan_escape(char **str) {
  char first = **str;
  *str += 1;
  switch (first) {
  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 '\\':
    return '\\';
  case '"':
    return '"';
  case '\'':
    return '\'';
  case 'x':
  case 'X': {
    char c1 = **str, c2 = *(*str + 1);
    int b = 0;
    if ('0' <= c1 && c1 <= '9')
      b = c1 - '0';
    else if ('A' <= c1 && c1 <= 'F')
      b = c1 - 'A' + 10;
    else if ('a' <= c1 && c1 <= 'f')
      b = c1 - 'a' + 10;
    else
      yyerror("Bad character in \\X construct in string");
    b <<= 4;
    if ('0' <= c2 && c2 <= '9')
      b += c2 - '0';
    else if ('A' <= c2 && c2 <= 'F')
      b += c2 - 'A' + 10;
    else if ('a' <= c2 && c2 <= 'f')
      b += c2 - 'a' + 10;
    else
      yyerror("Bad character in \\X construct in string");
    *str += 2;
    return (char)b;
  }
  default: {
    char message[] = "Bad character \\X";
    message[strlen(message) - 1] = first;
    yyerror(message);
    return '\0';
  }
  }
}


x86 assembly (clang, -O0):
<scan_escape>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
mov    (%rax),%al
mov    %al,-0x11(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%rcx
add    $0x1,%rcx
mov    %rcx,(%rax)
movsbl -0x11(%rbp),%eax
add    $0xffffffde,%eax
mov    %eax,%ecx
mov    %rcx,-0x38(%rbp)
sub    $0x56,%eax
ja     1352 <scan_escape+0x232>
mov    -0x38(%rbp),%rax
lea    0xe99(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
movb   $0x7,-0x1(%rbp)
jmp    1399 <scan_escape+0x279>
movb   $0x8,-0x1(%rbp)
jmp    1399 <scan_escape+0x279>
movb   $0xc,-0x1(%rbp)
jmp    1399 <scan_escape+0x279>
movb   $0xa,-0x1(%rbp)
jmp    1399 <scan_escape+0x279>
movb   $0xd,-0x1(%rbp)
jmp    1399 <scan_escape+0x279>
movb   $0x9,-0x1(%rbp)
jmp    1399 <scan_escape+0x279>
movb   $0x5c,-0x1(%rbp)
jmp    1399 <scan_escape+0x279>
movb   $0x22,-0x1(%rbp)
jmp    1399 <scan_escape+0x279>
movb   $0x27,-0x1(%rbp)
jmp    1399 <scan_escape+0x279>
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
mov    (%rax),%al
mov    %al,-0x12(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
mov    0x1(%rax),%al
mov    %al,-0x13(%rbp)
movl   $0x0,-0x18(%rbp)
movsbl -0x12(%rbp),%ecx
mov    $0x30,%eax
cmp    %ecx,%eax
jg     120e <scan_escape+0xee>
movsbl -0x12(%rbp),%eax
cmp    $0x39,%eax
jg     120e <scan_escape+0xee>
movsbl -0x12(%rbp),%eax
sub    $0x30,%eax
mov    %eax,-0x18(%rbp)
jmp    1284 <scan_escape+0x164>
movsbl -0x12(%rbp),%ecx
mov    $0x41,%eax
cmp    %ecx,%eax
jg     123e <scan_escape+0x11e>
movsbl -0x12(%rbp),%eax
cmp    $0x46,%eax
jg     123e <scan_escape+0x11e>
movsbl -0x12(%rbp),%eax
sub    $0x41,%eax
add    $0xa,%eax
mov    %eax,-0x18(%rbp)
jmp    127f <scan_escape+0x15f>
movsbl -0x12(%rbp),%ecx
mov    $0x61,%eax
cmp    %ecx,%eax
jg     126e <scan_escape+0x14e>
movsbl -0x12(%rbp),%eax
cmp    $0x66,%eax
jg     126e <scan_escape+0x14e>
movsbl -0x12(%rbp),%eax
sub    $0x61,%eax
add    $0xa,%eax
mov    %eax,-0x18(%rbp)
jmp    127a <scan_escape+0x15a>
lea    0xee7(%rip),%rdi
call   1030 <yyerror@plt>
jmp    127f <scan_escape+0x15f>
jmp    1284 <scan_escape+0x164>
mov    -0x18(%rbp),%eax
shl    $0x4,%eax
mov    %eax,-0x18(%rbp)
movsbl -0x13(%rbp),%ecx
mov    $0x30,%eax
cmp    %ecx,%eax
jg     12bd <scan_escape+0x19d>
movsbl -0x13(%rbp),%eax
cmp    $0x39,%eax
jg     12bd <scan_escape+0x19d>
movsbl -0x13(%rbp),%eax
sub    $0x30,%eax
add    -0x18(%rbp),%eax
mov    %eax,-0x18(%rbp)
jmp    1339 <scan_escape+0x219>
movsbl -0x13(%rbp),%ecx
mov    $0x41,%eax
cmp    %ecx,%eax
jg     12f0 <scan_escape+0x1d0>
movsbl -0x13(%rbp),%eax
cmp    $0x46,%eax
jg     12f0 <scan_escape+0x1d0>
movsbl -0x13(%rbp),%eax
sub    $0x41,%eax
add    $0xa,%eax
add    -0x18(%rbp),%eax
mov    %eax,-0x18(%rbp)
jmp    1334 <scan_escape+0x214>
movsbl -0x13(%rbp),%ecx
mov    $0x61,%eax
cmp    %ecx,%eax
jg     1323 <scan_escape+0x203>
movsbl -0x13(%rbp),%eax
cmp    $0x66,%eax
jg     1323 <scan_escape+0x203>
movsbl -0x13(%rbp),%eax
sub    $0x61,%eax
add    $0xa,%eax
add    -0x18(%rbp),%eax
mov    %eax,-0x18(%rbp)
jmp    132f <scan_escape+0x20f>
lea    0xe32(%rip),%rdi
call   1030 <yyerror@plt>
jmp    1334 <scan_escape+0x214>
jmp    1339 <scan_escape+0x219>
mov    -0x10(%rbp),%rax
mov    (%rax),%rcx
add    $0x2,%rcx
mov    %rcx,(%rax)
mov    -0x18(%rbp),%eax
mov    %al,-0x1(%rbp)
jmp    1399 <scan_escape+0x279>
mov    0xe37(%rip),%rax
mov    %rax,-0x30(%rbp)
mov    0xe34(%rip),%rax
mov    %rax,-0x28(%rbp)
mov    0xe32(%rip),%al
mov    %al,-0x20(%rbp)
mov    -0x11(%rbp),%al
mov    %al,-0x39(%rbp)
lea    -0x30(%rbp),%rdi
call   1040 <strlen@plt>
mov    -0x39(%rbp),%cl
sub    $0x1,%eax
cltq
mov    %cl,-0x30(%rbp,%rax,1)
lea    -0x30(%rbp),%rdi
call   1030 <yyerror@plt>
movb   $0x0,-0x1(%rbp)
movsbl -0x1(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<scan_escape>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    (%rdi),%rax
movsbl (%rax),%ebx
lea    0x1(%rax),%rcx
mov    %rcx,(%rdi)
lea    -0x22(%rbx),%ecx
cmp    $0x56,%ecx
ja     11b2 <scan_escape+0x92>
mov    $0x7,%r12b
lea    0xeb6(%rip),%rdx
movslq (%rdx,%rcx,4),%rcx
add    %rdx,%rcx
jmp    *%rcx
mov    %rdi,%r14
movsbl 0x1(%rax),%r12d
movzbl 0x2(%rax),%r15d
lea    -0x30(%r12),%eax
cmp    $0x9,%al
ja     11e1 <scan_escape+0xc1>
add    $0xffffffd0,%r12d
jmp    120e <scan_escape+0xee>
mov    $0x22,%r12b
jmp    1255 <scan_escape+0x135>
mov    $0x27,%r12b
jmp    1255 <scan_escape+0x135>
mov    $0x5c,%r12b
jmp    1255 <scan_escape+0x135>
mov    $0x8,%r12b
jmp    1255 <scan_escape+0x135>
mov    $0xc,%r12b
jmp    1255 <scan_escape+0x135>
mov    $0xa,%r12b
jmp    1255 <scan_escape+0x135>
mov    $0xd,%r12b
jmp    1255 <scan_escape+0x135>
mov    $0x9,%r12b
jmp    1255 <scan_escape+0x135>
movaps 0xfd7(%rip),%xmm0
movaps %xmm0,(%rsp)
movb   $0x0,0x10(%rsp)
mov    %rsp,%r14
mov    %r14,%rdi
call   1040 <strlen@plt>
cltq
mov    %bl,-0x1(%rax,%r14,1)
mov    %r14,%rdi
call   1030 <yyerror@plt>
xor    %r12d,%r12d
jmp    1255 <scan_escape+0x135>
lea    -0x41(%r12),%eax
cmp    $0x5,%al
ja     11f0 <scan_escape+0xd0>
add    $0xffffffc9,%r12d
jmp    120e <scan_escape+0xee>
lea    -0x61(%r12),%eax
cmp    $0x5,%al
ja     11ff <scan_escape+0xdf>
add    $0xffffffa9,%r12d
jmp    120e <scan_escape+0xee>
lea    0xf56(%rip),%rdi
call   1030 <yyerror@plt>
xor    %r12d,%r12d
shl    $0x4,%r12d
lea    -0x30(%r15),%eax
cmp    $0x9,%al
ja     1223 <scan_escape+0x103>
add    %r15d,%r12d
add    $0xffffffd0,%r12d
jmp    1251 <scan_escape+0x131>
lea    -0x41(%r15),%eax
cmp    $0x5,%al
ja     1234 <scan_escape+0x114>
add    %r15d,%r12d
add    $0xffffffc9,%r12d
jmp    1251 <scan_escape+0x131>
lea    -0x61(%r15),%eax
cmp    $0x5,%al
ja     1245 <scan_escape+0x125>
add    %r15d,%r12d
add    $0xffffffa9,%r12d
jmp    1251 <scan_escape+0x131>
lea    0xf10(%rip),%rdi
call   1030 <yyerror@plt>
addq   $0x2,(%r14)
mov    %r12d,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [40 x i8] c"Bad character in \\X construct in string\00"
@__const.scan_escape.message = [17 x i8] c"Bad character \\X\00"
define signext i8 @scan_escape(i8** %0) {
%2 = alloca i8
%3 = alloca i8**
%4 = alloca i8
%5 = alloca i8
%6 = alloca i8
%7 = alloca i32
%8 = alloca [17 x i8]
store i8** %0, i8*** %3
%9 = load i8**, i8*** %3
%10 = load i8*, i8** %9
%11 = load i8, i8* %10
store i8 %11, i8* %4
%12 = load i8**, i8*** %3
%13 = load i8*, i8** %12
%14 = getelementptr inbounds i8, i8* %13, i64 1
store i8* %14, i8** %12
%15 = load i8, i8* %4
%16 = sext i8 %15 to i32
switch i32 %16, label %131 [
i32 97, label %17
i32 98, label %18
i32 102, label %19
i32 110, label %20
i32 114, label %21
i32 116, label %22
i32 92, label %23
i32 34, label %24
i32 39, label %25
i32 120, label %26
i32 88, label %26
]
17: ; preds = %1
store i8 7, i8* %2
br label %141
18: ; preds = %1
store i8 8, i8* %2
br label %141
19: ; preds = %1
store i8 12, i8* %2
br label %141
20: ; preds = %1
store i8 10, i8* %2
br label %141
21: ; preds = %1
store i8 13, i8* %2
br label %141
22: ; preds = %1
store i8 9, i8* %2
br label %141
23: ; preds = %1
store i8 92, i8* %2
br label %141
24: ; preds = %1
store i8 34, i8* %2
br label %141
25: ; preds = %1
store i8 39, i8* %2
br label %141
26: ; preds = %1, %1
%27 = load i8**, i8*** %3
%28 = load i8*, i8** %27
%29 = load i8, i8* %28
store i8 %29, i8* %5
%30 = load i8**, i8*** %3
%31 = load i8*, i8** %30
%32 = getelementptr inbounds i8, i8* %31, i64 1
%33 = load i8, i8* %32
store i8 %33, i8* %6
store i32 0, i32* %7
%34 = load i8, i8* %5
%35 = sext i8 %34 to i32
%36 = icmp sle i32 48, %35
br i1 %36, label %37, label %45
37: ; preds = %26
%38 = load i8, i8* %5
%39 = sext i8 %38 to i32
%40 = icmp sle i32 %39, 57
br i1 %40, label %41, label %45
41: ; preds = %37
%42 = load i8, i8* %5
%43 = sext i8 %42 to i32
%44 = sub nsw i32 %43, 48
store i32 %44, i32* %7
br label %75
45: ; preds = %37, %26
%46 = load i8, i8* %5
%47 = sext i8 %46 to i32
%48 = icmp sle i32 65, %47
br i1 %48, label %49, label %58
49: ; preds = %45
%50 = load i8, i8* %5
%51 = sext i8 %50 to i32
%52 = icmp sle i32 %51, 70
br i1 %52, label %53, label %58
53: ; preds = %49
%54 = load i8, i8* %5
%55 = sext i8 %54 to i32
%56 = sub nsw i32 %55, 65
%57 = add nsw i32 %56, 10
store i32 %57, i32* %7
br label %74
58: ; preds = %49, %45
%59 = load i8, i8* %5
%60 = sext i8 %59 to i32
%61 = icmp sle i32 97, %60
br i1 %61, label %62, label %71
62: ; preds = %58
%63 = load i8, i8* %5
%64 = sext i8 %63 to i32
%65 = icmp sle i32 %64, 102
br i1 %65, label %66, label %71
66: ; preds = %62
%67 = load i8, i8* %5
%68 = sext i8 %67 to i32
%69 = sub nsw i32 %68, 97
%70 = add nsw i32 %69, 10
store i32 %70, i32* %7
br label %73
71: ; preds = %62, %58
%72 = call i32 @yyerror(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str, i64 0, i64 0))
br label %73
73: ; preds = %71, %66
br label %74
74: ; preds = %73, %53
br label %75
75: ; preds = %74, %41
%76 = load i32, i32* %7
%77 = shl i32 %76, 4
store i32 %77, i32* %7
%78 = load i8, i8* %6
%79 = sext i8 %78 to i32
%80 = icmp sle i32 48, %79
br i1 %80, label %81, label %91
81: ; preds = %75
%82 = load i8, i8* %6
%83 = sext i8 %82 to i32
%84 = icmp sle i32 %83, 57
br i1 %84, label %85, label %91
85: ; preds = %81
%86 = load i8, i8* %6
%87 = sext i8 %86 to i32
%88 = sub nsw i32 %87, 48
%89 = load i32, i32* %7
%90 = add nsw i32 %89, %88
store i32 %90, i32* %7
br label %125
91: ; preds = %81, %75
%92 = load i8, i8* %6
%93 = sext i8 %92 to i32
%94 = icmp sle i32 65, %93
br i1 %94, label %95, label %106
95: ; preds = %91
%96 = load i8, i8* %6
%97 = sext i8 %96 to i32
%98 = icmp sle i32 %97, 70
br i1 %98, label %99, label %106
99: ; preds = %95
%100 = load i8, i8* %6
%101 = sext i8 %100 to i32
%102 = sub nsw i32 %101, 65
%103 = add nsw i32 %102, 10
%104 = load i32, i32* %7
%105 = add nsw i32 %104, %103
store i32 %105, i32* %7
br label %124
106: ; preds = %95, %91
%107 = load i8, i8* %6
%108 = sext i8 %107 to i32
%109 = icmp sle i32 97, %108
br i1 %109, label %110, label %121
110: ; preds = %106
%111 = load i8, i8* %6
%112 = sext i8 %111 to i32
%113 = icmp sle i32 %112, 102
br i1 %113, label %114, label %121
114: ; preds = %110
%115 = load i8, i8* %6
%116 = sext i8 %115 to i32
%117 = sub nsw i32 %116, 97
%118 = add nsw i32 %117, 10
%119 = load i32, i32* %7
%120 = add nsw i32 %119, %118
store i32 %120, i32* %7
br label %123
121: ; preds = %110, %106
%122 = call i32 @yyerror(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str, i64 0, i64 0))
br label %123
123: ; preds = %121, %114
br label %124
124: ; preds = %123, %99
br label %125
125: ; preds = %124, %85
%126 = load i8**, i8*** %3
%127 = load i8*, i8** %126
%128 = getelementptr inbounds i8, i8* %127, i64 2
store i8* %128, i8** %126
%129 = load i32, i32* %7
%130 = trunc i32 %129 to i8
store i8 %130, i8* %2
br label %141
131: ; preds = %1
%132 = bitcast [17 x i8]* %8 to i8*
%133 = load i8, i8* %4
%134 = getelementptr inbounds [17 x i8], [17 x i8]* %8, i64 0, i64 0
%135 = call i32 @strlen(i8* %134)
%136 = sub nsw i32 %135, 1
%137 = sext i32 %136 to i64
%138 = getelementptr inbounds [17 x i8], [17 x i8]* %8, i64 0, i64 %137
store i8 %133, i8* %138
%139 = getelementptr inbounds [17 x i8], [17 x i8]* %8, i64 0, i64 0
%140 = call i32 @yyerror(i8* %139)
store i8 0, i8* %2
br label %141
141: ; preds = %131, %125, %25, %24, %23, %22, %21, %20, %19, %18, %17
%142 = load i8, i8* %2
ret i8 %142
}

LLVM IR (-O2):
@.str = [40 x i8] c"Bad character in \\X construct in string\00"
@__const.scan_escape.message = [17 x i8] c"Bad character \\X\00"
define signext i8 @scan_escape(i8** nocapture %0) {
%2 = alloca [17 x i8]
%3 = load i8*, i8** %0
%4 = load i8, i8* %3
%5 = getelementptr inbounds i8, i8* %3, i64 1
store i8* %5, i8** %0
%6 = sext i8 %4 to i32
switch i32 %6, label %64 [
i32 97, label %71
i32 98, label %7
i32 102, label %8
i32 110, label %9
i32 114, label %10
i32 116, label %11
i32 92, label %12
i32 34, label %13
i32 39, label %14
i32 120, label %15
i32 88, label %15
]
7: ; preds = %1
br label %71
8: ; preds = %1
br label %71
9: ; preds = %1
br label %71
10: ; preds = %1
br label %71
11: ; preds = %1
br label %71
12: ; preds = %1
br label %71
13: ; preds = %1
br label %71
14: ; preds = %1
br label %71
15: ; preds = %1, %1
%16 = load i8, i8* %5
%17 = getelementptr inbounds i8, i8* %3, i64 2
%18 = load i8, i8* %17
%19 = sext i8 %16 to i32
%20 = add i8 %16, -48
%21 = icmp ult i8 %20, 10
br i1 %21, label %22, label %24
22: ; preds = %15
%23 = add nsw i32 %19, -48
br label %36
24: ; preds = %15
%25 = add i8 %16, -65
%26 = icmp ult i8 %25, 6
br i1 %26, label %27, label %29
27: ; preds = %24
%28 = add nsw i32 %19, -55
br label %36
29: ; preds = %24
%30 = add i8 %16, -97
%31 = icmp ult i8 %30, 6
br i1 %31, label %32, label %34
32: ; preds = %29
%33 = add nsw i32 %19, -87
br label %36
34: ; preds = %29
%35 = tail call i32 @yyerror(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str, i64 0, i64 0))
br label %36
36: ; preds = %27, %34, %32, %22
%37 = phi i32 [ %23, %22 ], [ %28, %27 ], [ %33, %32 ], [ 0, %34 ]
%38 = shl nsw i32 %37, 4
%39 = zext i8 %18 to i32
%40 = add i8 %18, -48
%41 = icmp ult i8 %40, 10
br i1 %41, label %42, label %45
42: ; preds = %36
%43 = add nsw i32 %38, %39
%44 = add nsw i32 %43, -48
br label %59
45: ; preds = %36
%46 = add i8 %18, -65
%47 = icmp ult i8 %46, 6
br i1 %47, label %48, label %51
48: ; preds = %45
%49 = add nsw i32 %38, %39
%50 = add nsw i32 %49, -55
br label %59
51: ; preds = %45
%52 = add i8 %18, -97
%53 = icmp ult i8 %52, 6
br i1 %53, label %54, label %57
54: ; preds = %51
%55 = add nsw i32 %38, %39
%56 = add nsw i32 %55, -87
br label %59
57: ; preds = %51
%58 = tail call i32 @yyerror(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str, i64 0, i64 0))
br label %59
59: ; preds = %48, %57, %54, %42
%60 = phi i32 [ %44, %42 ], [ %50, %48 ], [ %56, %54 ], [ %38, %57 ]
%61 = load i8*, i8** %0
%62 = getelementptr inbounds i8, i8* %61, i64 2
store i8* %62, i8** %0
%63 = trunc i32 %60 to i8
br label %71
64: ; preds = %1
%65 = getelementptr inbounds [17 x i8], [17 x i8]* %2, i64 0, i64 0
%66 = call i32 @strlen(i8* %65)
%67 = add nsw i32 %66, -1
%68 = sext i32 %67 to i64
%69 = getelementptr inbounds [17 x i8], [17 x i8]* %2, i64 0, i64 %68
store i8 %4, i8* %69
%70 = call i32 @yyerror(i8* %65)
br label %71
71: ; preds = %1, %64, %59, %14, %13, %12, %11, %10, %9, %8, %7
%72 = phi i8 [ 0, %64 ], [ %63, %59 ], [ 39, %14 ], [ 34, %13 ], [ 92, %12 ], [ 9, %11 ], [ 13, %10 ], [ 10, %9 ], [ 12, %8 ], [ 8, %7 ], [ 7, %1 ]
ret i8 %72
}