#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 */
scalar_t__ strtol(char *, char **, int /*<<< orphan*/);
char *process_escapes(char *str) {
  char *s, *d;
  for (d = s = str; *s != '\0'; s++, d++) {
    if (*s == '\\') {
      switch (*(++s)) {
      case '0':
        *d = (char)strtol(s, &s, 0);
        s--;
        break;
      case 'b':
        *d = '\b';
        break;
      case 'n':
        *d = '\n';
        break;
      case 'r':
        *d = '\r';
        break;
      case 't':
        *d = '\t';
        break;
      default:
        *d = *s;
        break;
      }
    } else {
      *d = *s;
    }
  }
  *d = *s;
  return str;
}


x86 assembly (clang, -O0):
<process_escapes>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     1247 <process_escapes+0x137>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x5c,%eax
jne    1219 <process_escapes+0x109>
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
movsbl 0x1(%rax),%eax
mov    %eax,-0x1c(%rbp)
sub    $0x30,%eax
je     11b0 <process_escapes+0xa0>
jmp    116c <process_escapes+0x5c>
mov    -0x1c(%rbp),%eax
sub    $0x62,%eax
je     11d8 <process_escapes+0xc8>
jmp    117d <process_escapes+0x6d>
mov    -0x1c(%rbp),%eax
sub    $0x6e,%eax
je     11e4 <process_escapes+0xd4>
jmp    118e <process_escapes+0x7e>
mov    -0x1c(%rbp),%eax
sub    $0x72,%eax
je     11f0 <process_escapes+0xe0>
jmp    119f <process_escapes+0x8f>
mov    -0x1c(%rbp),%eax
sub    $0x74,%eax
je     11fc <process_escapes+0xec>
jmp    1208 <process_escapes+0xf8>
mov    -0x10(%rbp),%rdi
lea    -0x10(%rbp),%rsi
xor    %edx,%edx
call   1030 <strtol@plt>
mov    %al,%cl
mov    -0x18(%rbp),%rax
mov    %cl,(%rax)
mov    -0x10(%rbp),%rax
add    $0xffffffffffffffff,%rax
mov    %rax,-0x10(%rbp)
jmp    1214 <process_escapes+0x104>
mov    -0x18(%rbp),%rax
movb   $0x8,(%rax)
jmp    1214 <process_escapes+0x104>
mov    -0x18(%rbp),%rax
movb   $0xa,(%rax)
jmp    1214 <process_escapes+0x104>
mov    -0x18(%rbp),%rax
movb   $0xd,(%rax)
jmp    1214 <process_escapes+0x104>
mov    -0x18(%rbp),%rax
movb   $0x9,(%rax)
jmp    1214 <process_escapes+0x104>
mov    -0x10(%rbp),%rax
mov    (%rax),%cl
mov    -0x18(%rbp),%rax
mov    %cl,(%rax)
jmp    1225 <process_escapes+0x115>
mov    -0x10(%rbp),%rax
mov    (%rax),%cl
mov    -0x18(%rbp),%rax
mov    %cl,(%rax)
jmp    122a <process_escapes+0x11a>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    1128 <process_escapes+0x18>
mov    -0x10(%rbp),%rax
mov    (%rax),%cl
mov    -0x18(%rbp),%rax
mov    %cl,(%rax)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<process_escapes>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %rdi,%r15
mov    %rdi,(%rsp)
mov    %rsp,%r14
lea    0xed7(%rip),%r12
mov    %rdi,%rax
mov    %rdi,%rbx
jmp    114f <process_escapes+0x3f>
mov    %al,(%rbx)
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
add    $0x1,%rdi
mov    %rdi,(%rsp)
add    $0x1,%rbx
mov    %rdi,%rax
movzbl (%rax),%ecx
cmp    $0x5c,%cl
je     1170 <process_escapes+0x60>
test   %cl,%cl
je     11bf <process_escapes+0xaf>
mov    %cl,(%rbx)
mov    %rax,%rdi
jmp    1140 <process_escapes+0x30>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
lea    0x1(%rax),%rdi
mov    %rdi,(%rsp)
movzbl 0x1(%rax),%eax
movsbl %al,%ecx
lea    -0x62(%rcx),%edx
cmp    $0x12,%edx
ja     1195 <process_escapes+0x85>
movslq (%r12,%rdx,4),%rcx
add    %r12,%rcx
jmp    *%rcx
movb   $0x8,(%rbx)
jmp    1140 <process_escapes+0x30>
cmp    $0x30,%ecx
jne    1131 <process_escapes+0x21>
mov    %r14,%rsi
xor    %edx,%edx
call   1030 <strtol@plt>
mov    %al,(%rbx)
mov    (%rsp),%rdi
add    $0xffffffffffffffff,%rdi
jmp    1140 <process_escapes+0x30>
movb   $0xa,(%rbx)
jmp    1140 <process_escapes+0x30>
movb   $0xd,(%rbx)
jmp    1140 <process_escapes+0x30>
movb   $0x9,(%rbx)
jmp    1140 <process_escapes+0x30>
movb   $0x0,(%rbx)
mov    %r15,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
define i8* @process_escapes(i8* returned %0) {
%2 = alloca i8*
%3 = bitcast i8** %2 to i8*
store i8* %0, i8** %2
br label %4
4: ; preds = %23, %1
%5 = phi i8* [ %0, %1 ], [ %25, %23 ]
%6 = phi i8* [ %0, %1 ], [ %26, %23 ]
%7 = load i8, i8* %5
switch i8 %7, label %22 [
i8 0, label %27
i8 92, label %8
]
8: ; preds = %4
%9 = getelementptr inbounds i8, i8* %5, i64 1
store i8* %9, i8** %2
%10 = load i8, i8* %9
%11 = sext i8 %10 to i32
switch i32 %11, label %21 [
i32 48, label %12
i32 98, label %17
i32 110, label %18
i32 114, label %19
i32 116, label %20
]
12: ; preds = %8
%13 = call i64 @strtol(i8* %9, i8** %2, i32 0)
%14 = trunc i64 %13 to i8
store i8 %14, i8* %6
%15 = load i8*, i8** %2
%16 = getelementptr inbounds i8, i8* %15, i64 -1
br label %23
17: ; preds = %8
store i8 8, i8* %6
br label %23
18: ; preds = %8
store i8 10, i8* %6
br label %23
19: ; preds = %8
store i8 13, i8* %6
br label %23
20: ; preds = %8
store i8 9, i8* %6
br label %23
21: ; preds = %8
store i8 %10, i8* %6
br label %23
22: ; preds = %4
store i8 %7, i8* %6
br label %23
23: ; preds = %22, %21, %20, %19, %18, %17, %12
%24 = phi i8* [ %5, %22 ], [ %9, %21 ], [ %9, %20 ], [ %9, %19 ], [ %9, %18 ], [ %9, %17 ], [ %16, %12 ]
%25 = getelementptr inbounds i8, i8* %24, i64 1
store i8* %25, i8** %2
%26 = getelementptr inbounds i8, i8* %6, i64 1
br label %4
27: ; preds = %4
store i8 0, i8* %6
ret i8* %0
}