int vui_getchar_escaped(char **s, int *escaped) {
  *escaped = 0;
  switch (**s) {
  case '\\':
    (*s)++;
    *escaped = 1;
    switch (**s) {
    case 'n':
      return '\n';
      break;
    case 'r':
      return '\r';
      break;
    case 't':
      return '\t';
      break;
    case '0':
      return '\0';
      break;
    case 'x': {
      char a = *(*s)++;
      char b = *(*s)++;
      return (a << 4) + b;
      break;
    }
    default:
      return *(*s)++;
      break;
    }
    break;
  default:
    return *(*s)++;
  }
}


x86 assembly (clang, -O0):
<vui_getchar_escaped>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x18(%rbp),%rax
movl   $0x0,(%rax)
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
mov    (%rax),%al
sub    $0x5c,%al
jne    1230 <vui_getchar_escaped+0x130>
jmp    112c <vui_getchar_escaped+0x2c>
mov    -0x10(%rbp),%rax
mov    (%rax),%rcx
add    $0x1,%rcx
mov    %rcx,(%rax)
mov    -0x18(%rbp),%rax
movl   $0x1,(%rax)
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
movsbl (%rax),%eax
mov    %eax,-0x20(%rbp)
sub    $0x30,%eax
je     11c7 <vui_getchar_escaped+0xc7>
jmp    115f <vui_getchar_escaped+0x5f>
mov    -0x20(%rbp),%eax
sub    $0x6e,%eax
je     11a3 <vui_getchar_escaped+0xa3>
jmp    1170 <vui_getchar_escaped+0x70>
mov    -0x20(%rbp),%eax
sub    $0x72,%eax
je     11af <vui_getchar_escaped+0xaf>
jmp    1181 <vui_getchar_escaped+0x81>
mov    -0x20(%rbp),%eax
sub    $0x74,%eax
je     11bb <vui_getchar_escaped+0xbb>
jmp    1192 <vui_getchar_escaped+0x92>
mov    -0x20(%rbp),%eax
sub    $0x78,%eax
je     11d3 <vui_getchar_escaped+0xd3>
jmp    1214 <vui_getchar_escaped+0x114>
movl   $0xa,-0x4(%rbp)
jmp    1247 <vui_getchar_escaped+0x147>
movl   $0xd,-0x4(%rbp)
jmp    1247 <vui_getchar_escaped+0x147>
movl   $0x9,-0x4(%rbp)
jmp    1247 <vui_getchar_escaped+0x147>
movl   $0x0,-0x4(%rbp)
jmp    1247 <vui_getchar_escaped+0x147>
mov    -0x10(%rbp),%rcx
mov    (%rcx),%rax
mov    %rax,%rdx
add    $0x1,%rdx
mov    %rdx,(%rcx)
mov    (%rax),%al
mov    %al,-0x19(%rbp)
mov    -0x10(%rbp),%rcx
mov    (%rcx),%rax
mov    %rax,%rdx
add    $0x1,%rdx
mov    %rdx,(%rcx)
mov    (%rax),%al
mov    %al,-0x1a(%rbp)
movsbl -0x19(%rbp),%eax
shl    $0x4,%eax
movsbl -0x1a(%rbp),%ecx
add    %ecx,%eax
mov    %eax,-0x4(%rbp)
jmp    1247 <vui_getchar_escaped+0x147>
mov    -0x10(%rbp),%rcx
mov    (%rcx),%rax
mov    %rax,%rdx
add    $0x1,%rdx
mov    %rdx,(%rcx)
movsbl (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    1247 <vui_getchar_escaped+0x147>
mov    -0x10(%rbp),%rcx
mov    (%rcx),%rax
mov    %rax,%rdx
add    $0x1,%rdx
mov    %rdx,(%rcx)
movsbl (%rax),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<vui_getchar_escaped>:
movl   $0x0,(%rsi)
mov    (%rdi),%rcx
lea    0x1(%rcx),%rax
cmpb   $0x5c,(%rcx)
mov    %rax,(%rdi)
jne    1141 <vui_getchar_escaped+0x41>
movl   $0x1,(%rsi)
movsbl (%rax),%eax
lea    -0x6e(%rax),%edx
cmp    $0xa,%edx
ja     1145 <vui_getchar_escaped+0x45>
mov    $0xa,%eax
lea    0xece(%rip),%rsi
movslq (%rsi,%rdx,4),%rdx
add    %rsi,%rdx
jmp    *%rdx
mov    $0xd,%eax
ret
movsbl (%rcx),%eax
ret
cmp    $0x30,%eax
jne    114d <vui_getchar_escaped+0x4d>
xor    %eax,%eax
ret
lea    0x2(%rcx),%rax
mov    %rax,(%rdi)
movsbl 0x1(%rcx),%eax
ret
mov    $0x9,%eax
ret
lea    0x2(%rcx),%rax
mov    %rax,(%rdi)
movsbl 0x1(%rcx),%eax
lea    0x3(%rcx),%rdx
mov    %rdx,(%rdi)
movsbl 0x2(%rcx),%ecx
shl    $0x4,%eax
add    %ecx,%eax
ret

LLVM IR (-O0):
define i32 @vui_getchar_escaped(i8** %0, i32* %1) {
%3 = alloca i32
%4 = alloca i8**
%5 = alloca i32*
%6 = alloca i8
%7 = alloca i8
store i8** %0, i8*** %4
store i32* %1, i32** %5
%8 = load i32*, i32** %5
store i32 0, i32* %8
%9 = load i8**, i8*** %4
%10 = load i8*, i8** %9
%11 = load i8, i8* %10
%12 = sext i8 %11 to i32
switch i32 %12, label %47 [
i32 92, label %13
]
13: ; preds = %2
%14 = load i8**, i8*** %4
%15 = load i8*, i8** %14
%16 = getelementptr inbounds i8, i8* %15, i32 1
store i8* %16, i8** %14
%17 = load i32*, i32** %5
store i32 1, i32* %17
%18 = load i8**, i8*** %4
%19 = load i8*, i8** %18
%20 = load i8, i8* %19
%21 = sext i8 %20 to i32
switch i32 %21, label %41 [
i32 110, label %22
i32 114, label %23
i32 116, label %24
i32 48, label %25
i32 120, label %26
]
22: ; preds = %13
store i32 10, i32* %3
br label %53
23: ; preds = %13
store i32 13, i32* %3
br label %53
24: ; preds = %13
store i32 9, i32* %3
br label %53
25: ; preds = %13
store i32 0, i32* %3
br label %53
26: ; preds = %13
%27 = load i8**, i8*** %4
%28 = load i8*, i8** %27
%29 = getelementptr inbounds i8, i8* %28, i32 1
store i8* %29, i8** %27
%30 = load i8, i8* %28
store i8 %30, i8* %6
%31 = load i8**, i8*** %4
%32 = load i8*, i8** %31
%33 = getelementptr inbounds i8, i8* %32, i32 1
store i8* %33, i8** %31
%34 = load i8, i8* %32
store i8 %34, i8* %7
%35 = load i8, i8* %6
%36 = sext i8 %35 to i32
%37 = shl i32 %36, 4
%38 = load i8, i8* %7
%39 = sext i8 %38 to i32
%40 = add nsw i32 %37, %39
store i32 %40, i32* %3
br label %53
41: ; preds = %13
%42 = load i8**, i8*** %4
%43 = load i8*, i8** %42
%44 = getelementptr inbounds i8, i8* %43, i32 1
store i8* %44, i8** %42
%45 = load i8, i8* %43
%46 = sext i8 %45 to i32
store i32 %46, i32* %3
br label %53
47: ; preds = %2
%48 = load i8**, i8*** %4
%49 = load i8*, i8** %48
%50 = getelementptr inbounds i8, i8* %49, i32 1
store i8* %50, i8** %48
%51 = load i8, i8* %49
%52 = sext i8 %51 to i32
store i32 %52, i32* %3
br label %53
53: ; preds = %47, %41, %26, %25, %24, %23, %22
%54 = load i32, i32* %3
ret i32 %54
}

LLVM IR (-O2):
define i32 @vui_getchar_escaped(i8** nocapture %0, i32* nocapture writeonly %1) {
store i32 0, i32* %1
%3 = load i8*, i8** %0
%4 = load i8, i8* %3
%5 = icmp eq i8 %4, 92
%6 = getelementptr inbounds i8, i8* %3, i64 1
store i8* %6, i8** %0
br i1 %5, label %7, label %26
7: ; preds = %2
store i32 1, i32* %1
%8 = load i8, i8* %6
%9 = sext i8 %8 to i32
switch i32 %9, label %22 [
i32 110, label %29
i32 114, label %10
i32 116, label %11
i32 48, label %12
i32 120, label %13
]
10: ; preds = %7
br label %29
11: ; preds = %7
br label %29
12: ; preds = %7
br label %29
13: ; preds = %7
%14 = getelementptr inbounds i8, i8* %3, i64 2
store i8* %14, i8** %0
%15 = load i8, i8* %6
%16 = getelementptr inbounds i8, i8* %3, i64 3
store i8* %16, i8** %0
%17 = load i8, i8* %14
%18 = sext i8 %15 to i32
%19 = shl nsw i32 %18, 4
%20 = sext i8 %17 to i32
%21 = add nsw i32 %19, %20
br label %29
22: ; preds = %7
%23 = getelementptr inbounds i8, i8* %3, i64 2
store i8* %23, i8** %0
%24 = load i8, i8* %6
%25 = sext i8 %24 to i32
br label %29
26: ; preds = %2
%27 = load i8, i8* %3
%28 = sext i8 %27 to i32
br label %29
29: ; preds = %7, %26, %22, %13, %12, %11, %10
%30 = phi i32 [ %25, %22 ], [ %21, %13 ], [ 0, %12 ], [ 9, %11 ], [ 13, %10 ], [ %28, %26 ], [ 10, %7 ]
ret i32 %30
}