int stb__clex_parse_char(char *p, char **q) {
  if (*p == '\\') {
    *q = p + 2;
    switch (p[1]) {
    case '\\':
      return '\\';
    case '\'':
      return '\'';
    case '"':
      return '"';
    case 't':
      return '\t';
    case 'f':
      return '\f';
    case 'n':
      return '\n';
    case 'r':
      return '\r';
    case '0':
      return '\0';
    case 'x':
    case 'X':
      return -1;
    case 'u':
      return -1;
    }
  }
  *q = p + 1;
  return (unsigned char)*p;
}


x86 assembly (clang, -O0):
<stb__clex_parse_char>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x5c,%eax
jne    11d6 <stb__clex_parse_char+0xd6>
mov    -0x10(%rbp),%rcx
add    $0x2,%rcx
mov    -0x18(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x10(%rbp),%rax
movsbl 0x1(%rax),%eax
add    $0xffffffde,%eax
mov    %eax,%ecx
mov    %rcx,-0x20(%rbp)
sub    $0x56,%eax
ja     11d1 <stb__clex_parse_char+0xd1>
mov    -0x20(%rbp),%rax
lea    0xeb0(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
movl   $0x5c,-0x4(%rbp)
jmp    11ef <stb__clex_parse_char+0xef>
movl   $0x27,-0x4(%rbp)
jmp    11ef <stb__clex_parse_char+0xef>
movl   $0x22,-0x4(%rbp)
jmp    11ef <stb__clex_parse_char+0xef>
movl   $0x9,-0x4(%rbp)
jmp    11ef <stb__clex_parse_char+0xef>
movl   $0xc,-0x4(%rbp)
jmp    11ef <stb__clex_parse_char+0xef>
movl   $0xa,-0x4(%rbp)
jmp    11ef <stb__clex_parse_char+0xef>
movl   $0xd,-0x4(%rbp)
jmp    11ef <stb__clex_parse_char+0xef>
movl   $0x0,-0x4(%rbp)
jmp    11ef <stb__clex_parse_char+0xef>
movl   $0xffffffff,-0x4(%rbp)
jmp    11ef <stb__clex_parse_char+0xef>
movl   $0xffffffff,-0x4(%rbp)
jmp    11ef <stb__clex_parse_char+0xef>
jmp    11d6 <stb__clex_parse_char+0xd6>
mov    -0x10(%rbp),%rcx
add    $0x1,%rcx
mov    -0x18(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x10(%rbp),%rax
movzbl (%rax),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<stb__clex_parse_char>:
cmpb   $0x5c,(%rdi)
jne    112e <stb__clex_parse_char+0x2e>
lea    0x2(%rdi),%rax
mov    %rax,(%rsi)
movsbl 0x1(%rdi),%eax
lea    -0x22(%rax),%ecx
cmp    $0x56,%ecx
ja     112e <stb__clex_parse_char+0x2e>
lea    0xee1(%rip),%rdx
movslq (%rdx,%rcx,4),%rcx
add    %rdx,%rcx
jmp    *%rcx
mov    $0xffffffff,%eax
ret
lea    0x1(%rdi),%rax
mov    %rax,(%rsi)
movzbl (%rdi),%eax
ret
xor    %eax,%eax
ret
mov    $0xc,%eax
ret
mov    $0xa,%eax
ret
mov    $0xd,%eax
ret
mov    $0x9,%eax
ret

LLVM IR (-O0):
define i32 @stb__clex_parse_char(i8* %0, i8** %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i8**
store i8* %0, i8** %4
store i8** %1, i8*** %5
%6 = load i8*, i8** %4
%7 = load i8, i8* %6
%8 = sext i8 %7 to i32
%9 = icmp eq i32 %8, 92
br i1 %9, label %10, label %29
10: ; preds = %2
%11 = load i8*, i8** %4
%12 = getelementptr inbounds i8, i8* %11, i64 2
%13 = load i8**, i8*** %5
store i8* %12, i8** %13
%14 = load i8*, i8** %4
%15 = getelementptr inbounds i8, i8* %14, i64 1
%16 = load i8, i8* %15
%17 = sext i8 %16 to i32
switch i32 %17, label %28 [
i32 92, label %18
i32 39, label %19
i32 34, label %20
i32 116, label %21
i32 102, label %22
i32 110, label %23
i32 114, label %24
i32 48, label %25
i32 120, label %26
i32 88, label %26
i32 117, label %27
]
18: ; preds = %10
store i32 92, i32* %3
br label %36
19: ; preds = %10
store i32 39, i32* %3
br label %36
20: ; preds = %10
store i32 34, i32* %3
br label %36
21: ; preds = %10
store i32 9, i32* %3
br label %36
22: ; preds = %10
store i32 12, i32* %3
br label %36
23: ; preds = %10
store i32 10, i32* %3
br label %36
24: ; preds = %10
store i32 13, i32* %3
br label %36
25: ; preds = %10
store i32 0, i32* %3
br label %36
26: ; preds = %10, %10
store i32 -1, i32* %3
br label %36
27: ; preds = %10
store i32 -1, i32* %3
br label %36
28: ; preds = %10
br label %29
29: ; preds = %28, %2
%30 = load i8*, i8** %4
%31 = getelementptr inbounds i8, i8* %30, i64 1
%32 = load i8**, i8*** %5
store i8* %31, i8** %32
%33 = load i8*, i8** %4
%34 = load i8, i8* %33
%35 = zext i8 %34 to i32
store i32 %35, i32* %3
br label %36
36: ; preds = %29, %27, %26, %25, %24, %23, %22, %21, %20, %19, %18
%37 = load i32, i32* %3
ret i32 %37
}

LLVM IR (-O2):
define i32 @stb__clex_parse_char(i8* %0, i8** nocapture writeonly %1) {
%3 = load i8, i8* %0
%4 = icmp eq i8 %3, 92
br i1 %4, label %5, label %17
5: ; preds = %2
%6 = getelementptr inbounds i8, i8* %0, i64 2
store i8* %6, i8** %1
%7 = getelementptr inbounds i8, i8* %0, i64 1
%8 = load i8, i8* %7
%9 = sext i8 %8 to i32
switch i32 %9, label %17 [
i32 92, label %21
i32 39, label %21
i32 34, label %21
i32 116, label %10
i32 102, label %11
i32 110, label %12
i32 114, label %13
i32 48, label %14
i32 120, label %15
i32 88, label %15
i32 117, label %16
]
10: ; preds = %5
br label %21
11: ; preds = %5
br label %21
12: ; preds = %5
br label %21
13: ; preds = %5
br label %21
14: ; preds = %5
br label %21
15: ; preds = %5, %5
br label %21
16: ; preds = %5
br label %21
17: ; preds = %5, %2
%18 = getelementptr inbounds i8, i8* %0, i64 1
store i8* %18, i8** %1
%19 = load i8, i8* %0
%20 = zext i8 %19 to i32
br label %21
21: ; preds = %5, %5, %5, %17, %16, %15, %14, %13, %12, %11, %10
%22 = phi i32 [ %20, %17 ], [ -1, %16 ], [ -1, %15 ], [ 0, %14 ], [ 13, %13 ], [ 10, %12 ], [ 12, %11 ], [ 9, %10 ], [ %9, %5 ], [ %9, %5 ], [ %9, %5 ]
ret i32 %22
}