#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 strtoul(char *, char **, int);
void unescape(char *s) {
  char *out = s;
  int c;
  while (c = *s++) {
    if (c == '\\')
      switch (c = *s++) {
      case 'a':
        c = '\a';
        break;
      case 'b':
        c = '\b';
        break;
      case 'e':
        c = '\e';
        break;
      case 'f':
        c = '\f';
        break;
      case 'n':
        c = '\n';
        break;
      case 'r':
        c = '\r';
        break;
      case 't':
        c = '\t';
        break;
      case 'v':
        c = '\v';
        break;
      case '0':
        c = strtoul(s, &s, 8);
        break;
      case '1':
      case '2':
      case '3':
      case '4':
      case '5':
      case '6':
      case '7':
      case '8':
      case '9':
        c = strtoul(s - 1, &s, 10);
        break;
      case 'x':
        c = strtoul(s, &s, 16);
      }
    *out++ = c;
  }
  *out = '\0';
}


x86 assembly (clang, -O0):
<unescape>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x8(%rbp)
movsbl (%rax),%eax
mov    %eax,-0x14(%rbp)
cmp    $0x0,%eax
je     1254 <unescape+0x144>
cmpl   $0x5c,-0x14(%rbp)
jne    1239 <unescape+0x129>
mov    -0x8(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x8(%rbp)
movsbl (%rax),%eax
mov    %eax,-0x14(%rbp)
add    $0xffffffd0,%eax
mov    %eax,%ecx
mov    %rcx,-0x20(%rbp)
sub    $0x48,%eax
ja     1234 <unescape+0x124>
mov    -0x20(%rbp),%rax
lea    0xe82(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
movl   $0x7,-0x14(%rbp)
jmp    1234 <unescape+0x124>
movl   $0x8,-0x14(%rbp)
jmp    1234 <unescape+0x124>
movl   $0x1b,-0x14(%rbp)
jmp    1234 <unescape+0x124>
movl   $0xc,-0x14(%rbp)
jmp    1234 <unescape+0x124>
movl   $0xa,-0x14(%rbp)
jmp    1234 <unescape+0x124>
movl   $0xd,-0x14(%rbp)
jmp    1234 <unescape+0x124>
movl   $0x9,-0x14(%rbp)
jmp    1234 <unescape+0x124>
movl   $0xb,-0x14(%rbp)
jmp    1234 <unescape+0x124>
mov    -0x8(%rbp),%rdi
lea    -0x8(%rbp),%rsi
mov    $0x8,%edx
call   1030 <strtoul@plt>
mov    %eax,-0x14(%rbp)
jmp    1234 <unescape+0x124>
mov    -0x8(%rbp),%rdi
add    $0xffffffffffffffff,%rdi
lea    -0x8(%rbp),%rsi
mov    $0xa,%edx
call   1030 <strtoul@plt>
mov    %eax,-0x14(%rbp)
jmp    1234 <unescape+0x124>
mov    -0x8(%rbp),%rdi
lea    -0x8(%rbp),%rsi
mov    $0x10,%edx
call   1030 <strtoul@plt>
mov    %eax,-0x14(%rbp)
jmp    1239 <unescape+0x129>
mov    -0x14(%rbp),%eax
mov    %al,%cl
mov    -0x10(%rbp),%rax
mov    %rax,%rdx
add    $0x1,%rdx
mov    %rdx,-0x10(%rbp)
mov    %cl,(%rax)
jmp    1124 <unescape+0x14>
mov    -0x10(%rbp),%rax
movb   $0x0,(%rax)
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<unescape>:
push   %r15
push   %r14
push   %rbx
sub    $0x10,%rsp
lea    0x1(%rdi),%rax
mov    %rax,0x8(%rsp)
mov    (%rdi),%cl
test   %cl,%cl
je     11f5 <unescape+0xe5>
lea    0xecd(%rip),%r15
lea    0x8(%rsp),%r14
mov    %rdi,%rbx
jmp    1162 <unescape+0x52>
nopl   (%rax)
movzbl %cl,%eax
mov    %al,(%rbx)
add    $0x1,%rbx
mov    0x8(%rsp),%rdi
lea    0x1(%rdi),%rax
mov    %rax,0x8(%rsp)
movzbl (%rdi),%ecx
test   %cl,%cl
je     11f8 <unescape+0xe8>
cmp    $0x5c,%cl
jne    1140 <unescape+0x30>
lea    0x2(%rdi),%rcx
mov    %rcx,0x8(%rsp)
movsbl (%rax),%eax
lea    -0x30(%rax),%edx
cmp    $0x48,%edx
ja     1143 <unescape+0x33>
movslq (%r15,%rdx,4),%rdx
add    %r15,%rdx
jmp    *%rdx
add    $0x1,%rdi
mov    %r14,%rsi
mov    $0xa,%edx
call   1030 <strtoul@plt>
jmp    1143 <unescape+0x33>
mov    %rcx,%rdi
mov    %r14,%rsi
mov    $0x8,%edx
jmp    1190 <unescape+0x80>
mov    $0x7,%eax
jmp    1143 <unescape+0x33>
mov    $0x8,%eax
jmp    1143 <unescape+0x33>
mov    $0x1b,%eax
jmp    1143 <unescape+0x33>
mov    $0xc,%eax
jmp    1143 <unescape+0x33>
mov    $0xa,%eax
jmp    1143 <unescape+0x33>
mov    $0xd,%eax
jmp    1143 <unescape+0x33>
mov    $0x9,%eax
jmp    1143 <unescape+0x33>
mov    $0xb,%eax
jmp    1143 <unescape+0x33>
mov    %rcx,%rdi
mov    %r14,%rsi
mov    $0x10,%edx
jmp    1190 <unescape+0x80>
mov    %rdi,%rbx
movb   $0x0,(%rbx)
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define void @unescape(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %2
%5 = load i8*, i8** %2
store i8* %5, i8** %3
br label %6
6: ; preds = %39, %1
%7 = load i8*, i8** %2
%8 = getelementptr inbounds i8, i8* %7, i32 1
store i8* %8, i8** %2
%9 = load i8, i8* %7
%10 = sext i8 %9 to i32
store i32 %10, i32* %4
%11 = icmp ne i32 %10, 0
br i1 %11, label %12, label %44
12: ; preds = %6
%13 = load i32, i32* %4
%14 = icmp eq i32 %13, 92
br i1 %14, label %15, label %39
15: ; preds = %12
%16 = load i8*, i8** %2
%17 = getelementptr inbounds i8, i8* %16, i32 1
store i8* %17, i8** %2
%18 = load i8, i8* %16
%19 = sext i8 %18 to i32
store i32 %19, i32* %4
switch i32 %19, label %38 [
i32 97, label %20
i32 98, label %21
i32 101, label %22
i32 102, label %23
i32 110, label %24
i32 114, label %25
i32 116, label %26
i32 118, label %27
i32 48, label %28
i32 49, label %31
i32 50, label %31
i32 51, label %31
i32 52, label %31
i32 53, label %31
i32 54, label %31
i32 55, label %31
i32 56, label %31
i32 57, label %31
i32 120, label %35
]
20: ; preds = %15
store i32 7, i32* %4
br label %38
21: ; preds = %15
store i32 8, i32* %4
br label %38
22: ; preds = %15
store i32 27, i32* %4
br label %38
23: ; preds = %15
store i32 12, i32* %4
br label %38
24: ; preds = %15
store i32 10, i32* %4
br label %38
25: ; preds = %15
store i32 13, i32* %4
br label %38
26: ; preds = %15
store i32 9, i32* %4
br label %38
27: ; preds = %15
store i32 11, i32* %4
br label %38
28: ; preds = %15
%29 = load i8*, i8** %2
%30 = call i32 @strtoul(i8* %29, i8** %2, i32 8)
store i32 %30, i32* %4
br label %38
31: ; preds = %15, %15, %15, %15, %15, %15, %15, %15, %15
%32 = load i8*, i8** %2
%33 = getelementptr inbounds i8, i8* %32, i64 -1
%34 = call i32 @strtoul(i8* %33, i8** %2, i32 10)
store i32 %34, i32* %4
br label %38
35: ; preds = %15
%36 = load i8*, i8** %2
%37 = call i32 @strtoul(i8* %36, i8** %2, i32 16)
store i32 %37, i32* %4
br label %38
38: ; preds = %35, %15, %31, %28, %27, %26, %25, %24, %23, %22, %21, %20
br label %39
39: ; preds = %38, %12
%40 = load i32, i32* %4
%41 = trunc i32 %40 to i8
%42 = load i8*, i8** %3
%43 = getelementptr inbounds i8, i8* %42, i32 1
store i8* %43, i8** %3
store i8 %41, i8* %42
br label %6
44: ; preds = %6
%45 = load i8*, i8** %3
store i8 0, i8* %45
ret void
}

LLVM IR (-O2):
define void @unescape(i8* %0) {
%2 = alloca i8*
%3 = getelementptr inbounds i8, i8* %0, i64 1
store i8* %3, i8** %2
%4 = load i8, i8* %0
%5 = icmp eq i8 %4, 0
br i1 %5, label %40, label %6
6: ; preds = %1, %32
%7 = phi i8 [ %38, %32 ], [ %4, %1 ]
%8 = phi i8* [ %37, %32 ], [ %3, %1 ]
%9 = phi i8* [ %36, %32 ], [ %0, %1 ]
%10 = phi i8* [ %35, %32 ], [ %0, %1 ]
%11 = zext i8 %7 to i32
%12 = icmp eq i8 %7, 92
br i1 %12, label %13, label %32
13: ; preds = %6
%14 = getelementptr inbounds i8, i8* %9, i64 2
store i8* %14, i8** %2
%15 = load i8, i8* %8
%16 = sext i8 %15 to i32
switch i32 %16, label %32 [
i32 97, label %17
i32 98, label %18
i32 101, label %19
i32 102, label %20
i32 110, label %21
i32 114, label %22
i32 116, label %23
i32 118, label %24
i32 48, label %25
i32 49, label %27
i32 50, label %27
i32 51, label %27
i32 52, label %27
i32 53, label %27
i32 54, label %27
i32 55, label %27
i32 56, label %27
i32 57, label %27
i32 120, label %30
]
17: ; preds = %13
br label %32
18: ; preds = %13
br label %32
19: ; preds = %13
br label %32
20: ; preds = %13
br label %32
21: ; preds = %13
br label %32
22: ; preds = %13
br label %32
23: ; preds = %13
br label %32
24: ; preds = %13
br label %32
25: ; preds = %13
%26 = call i32 @strtoul(i8* %14, i8** %2, i32 8)
br label %32
27: ; preds = %13, %13, %13, %13, %13, %13, %13, %13, %13
%28 = getelementptr inbounds i8, i8* %9, i64 1
%29 = call i32 @strtoul(i8* %28, i8** %2, i32 10)
br label %32
30: ; preds = %13
%31 = call i32 @strtoul(i8* %14, i8** %2, i32 16)
br label %32
32: ; preds = %17, %18, %19, %20, %21, %22, %23, %24, %25, %27, %13, %30, %6
%33 = phi i32 [ %16, %13 ], [ %31, %30 ], [ %29, %27 ], [ %26, %25 ], [ 11, %24 ], [ 9, %23 ], [ 13, %22 ], [ 10, %21 ], [ 12, %20 ], [ 27, %19 ], [ 8, %18 ], [ 7, %17 ], [ %11, %6 ]
%34 = trunc i32 %33 to i8
%35 = getelementptr inbounds i8, i8* %10, i64 1
store i8 %34, i8* %10
%36 = load i8*, i8** %2
%37 = getelementptr inbounds i8, i8* %36, i64 1
store i8* %37, i8** %2
%38 = load i8, i8* %36
%39 = icmp eq i8 %38, 0
br i1 %39, label %40, label %6
40: ; preds = %32, %1
%41 = phi i8* [ %0, %1 ], [ %35, %32 ]
store i8 0, i8* %41
ret void
}