#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 */
void *get_char_code(unsigned char **, int);
int deslash(unsigned char *str) {
  unsigned char *wp, *rp;
  rp = wp = str;
  while (*rp) {
    if (*rp != '\\')
      *wp++ = *rp++;
    else {
      switch (*++rp) {
      case 'n':
        *wp++ = 10;
        ++rp;
        break;
      case 'r':
        *wp++ = 13;
        ++rp;
        break;
      case 't':
        *wp++ = 9;
        ++rp;
        break;
      case 'b':
        *wp++ = 8;
        ++rp;
        break;
      case 'x':
        ++rp;
        *wp++ = get_char_code(&rp, 16);
        break;
      case '0':
        *wp++ = get_char_code(&rp, 8);
        break;
      case '1':
      case '2':
      case '3':
      case '4':
      case '5':
      case '6':
      case '7':
      case '8':
      case '9':
        *wp++ = get_char_code(&rp, 10);
        break;
      default:
        *wp++ = *rp++;
        break;
      }
    }
  }
  *wp = '\0';
  return wp - str;
}


x86 assembly (clang, -O0):
<deslash>:
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    -0x18(%rbp),%rax
cmpb   $0x0,(%rax)
je     12db <deslash+0x1cb>
mov    -0x18(%rbp),%rax
movzbl (%rax),%eax
cmp    $0x5c,%eax
je     116c <deslash+0x5c>
mov    -0x18(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x18(%rbp)
mov    (%rax),%cl
mov    -0x10(%rbp),%rax
mov    %rax,%rdx
add    $0x1,%rdx
mov    %rdx,-0x10(%rbp)
mov    %cl,(%rax)
jmp    12d6 <deslash+0x1c6>
mov    -0x18(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x18(%rbp)
movzbl 0x1(%rax),%eax
add    $0xffffffd0,%eax
mov    %eax,%ecx
mov    %rcx,-0x20(%rbp)
sub    $0x48,%eax
ja     12af <deslash+0x19f>
mov    -0x20(%rbp),%rax
lea    0xe64(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
movb   $0xa,(%rax)
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    12d1 <deslash+0x1c1>
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
movb   $0xd,(%rax)
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    12d1 <deslash+0x1c1>
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
movb   $0x9,(%rax)
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    12d1 <deslash+0x1c1>
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
movb   $0x8,(%rax)
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    12d1 <deslash+0x1c1>
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
lea    -0x18(%rbp),%rdi
mov    $0x10,%esi
call   1030 <get_char_code@plt>
mov    %al,%cl
mov    -0x10(%rbp),%rax
mov    %rax,%rdx
add    $0x1,%rdx
mov    %rdx,-0x10(%rbp)
mov    %cl,(%rax)
jmp    12d1 <deslash+0x1c1>
lea    -0x18(%rbp),%rdi
mov    $0x8,%esi
call   1030 <get_char_code@plt>
mov    %al,%cl
mov    -0x10(%rbp),%rax
mov    %rax,%rdx
add    $0x1,%rdx
mov    %rdx,-0x10(%rbp)
mov    %cl,(%rax)
jmp    12d1 <deslash+0x1c1>
lea    -0x18(%rbp),%rdi
mov    $0xa,%esi
call   1030 <get_char_code@plt>
mov    %al,%cl
mov    -0x10(%rbp),%rax
mov    %rax,%rdx
add    $0x1,%rdx
mov    %rdx,-0x10(%rbp)
mov    %cl,(%rax)
jmp    12d1 <deslash+0x1c1>
mov    -0x18(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x18(%rbp)
mov    (%rax),%cl
mov    -0x10(%rbp),%rax
mov    %rax,%rdx
add    $0x1,%rdx
mov    %rdx,-0x10(%rbp)
mov    %cl,(%rax)
jmp    12d6 <deslash+0x1c6>
jmp    1128 <deslash+0x18>
mov    -0x10(%rbp),%rax
movb   $0x0,(%rax)
mov    -0x10(%rbp),%rax
mov    -0x8(%rbp),%rcx
sub    %rcx,%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<deslash>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %rdi,%r14
mov    %rdi,(%rsp)
xor    %ebx,%ebx
lea    0xed8(%rip),%r12
mov    %rsp,%r15
mov    %rdi,%rax
jmp    1148 <deslash+0x38>
movb   $0xa,(%r14,%rbx,1)
add    $0x2,%rax
mov    %rax,(%rsp)
nopl   (%rax)
mov    (%rsp),%rax
add    $0x1,%rbx
movzbl (%rax),%ecx
cmp    $0x5c,%cl
je     1170 <deslash+0x60>
test   %cl,%cl
je     11eb <deslash+0xdb>
lea    0x1(%rax),%rcx
mov    %rcx,(%rsp)
movzbl (%rax),%eax
mov    %al,(%r14,%rbx,1)
jmp    1140 <deslash+0x30>
nopl   0x0(%rax)
lea    0x1(%rax),%rcx
mov    %rcx,(%rsp)
movzbl 0x1(%rax),%ecx
add    $0xd0,%cl
cmp    $0x48,%cl
ja     11ad <deslash+0x9d>
movzbl %cl,%ecx
movslq (%r12,%rcx,4),%rcx
add    %r12,%rcx
jmp    *%rcx
mov    %r15,%rdi
mov    $0xa,%esi
call   1030 <get_char_code@plt>
mov    %al,(%r14,%rbx,1)
jmp    1140 <deslash+0x30>
mov    %r15,%rdi
mov    $0x8,%esi
jmp    1198 <deslash+0x88>
lea    0x2(%rax),%rcx
mov    %rcx,(%rsp)
movzbl 0x1(%rax),%eax
jmp    1163 <deslash+0x53>
movb   $0x8,(%r14,%rbx,1)
jmp    1135 <deslash+0x25>
movb   $0xd,(%r14,%rbx,1)
jmp    1135 <deslash+0x25>
movb   $0x9,(%r14,%rbx,1)
jmp    1135 <deslash+0x25>
add    $0x2,%rax
mov    %rax,(%rsp)
mov    %r15,%rdi
mov    $0x10,%esi
jmp    1198 <deslash+0x88>
movb   $0x0,(%r14,%rbx,1)
mov    %ebx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define i32 @deslash(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 = %70, %1
%7 = load i8*, i8** %4
%8 = load i8, i8* %7
%9 = icmp ne i8 %8, 0
br i1 %9, label %10, label %71
10: ; preds = %6
%11 = load i8*, i8** %4
%12 = load i8, i8* %11
%13 = zext i8 %12 to i32
%14 = icmp ne i32 %13, 92
br i1 %14, label %15, label %21
15: ; preds = %10
%16 = load i8*, i8** %4
%17 = getelementptr inbounds i8, i8* %16, i32 1
store i8* %17, i8** %4
%18 = load i8, i8* %16
%19 = load i8*, i8** %3
%20 = getelementptr inbounds i8, i8* %19, i32 1
store i8* %20, i8** %3
store i8 %18, i8* %19
br label %70
21: ; preds = %10
%22 = load i8*, i8** %4
%23 = getelementptr inbounds i8, i8* %22, i32 1
store i8* %23, i8** %4
%24 = load i8, i8* %23
%25 = zext i8 %24 to i32
switch i32 %25, label %63 [
i32 110, label %26
i32 114, label %31
i32 116, label %36
i32 98, label %41
i32 120, label %46
i32 48, label %53
i32 49, label %58
i32 50, label %58
i32 51, label %58
i32 52, label %58
i32 53, label %58
i32 54, label %58
i32 55, label %58
i32 56, label %58
i32 57, label %58
]
26: ; preds = %21
%27 = load i8*, i8** %3
%28 = getelementptr inbounds i8, i8* %27, i32 1
store i8* %28, i8** %3
store i8 10, i8* %27
%29 = load i8*, i8** %4
%30 = getelementptr inbounds i8, i8* %29, i32 1
store i8* %30, i8** %4
br label %69
31: ; preds = %21
%32 = load i8*, i8** %3
%33 = getelementptr inbounds i8, i8* %32, i32 1
store i8* %33, i8** %3
store i8 13, i8* %32
%34 = load i8*, i8** %4
%35 = getelementptr inbounds i8, i8* %34, i32 1
store i8* %35, i8** %4
br label %69
36: ; preds = %21
%37 = load i8*, i8** %3
%38 = getelementptr inbounds i8, i8* %37, i32 1
store i8* %38, i8** %3
store i8 9, i8* %37
%39 = load i8*, i8** %4
%40 = getelementptr inbounds i8, i8* %39, i32 1
store i8* %40, i8** %4
br label %69
41: ; preds = %21
%42 = load i8*, i8** %3
%43 = getelementptr inbounds i8, i8* %42, i32 1
store i8* %43, i8** %3
store i8 8, i8* %42
%44 = load i8*, i8** %4
%45 = getelementptr inbounds i8, i8* %44, i32 1
store i8* %45, i8** %4
br label %69
46: ; preds = %21
%47 = load i8*, i8** %4
%48 = getelementptr inbounds i8, i8* %47, i32 1
store i8* %48, i8** %4
%49 = call i8* @get_char_code(i8** %4, i32 16)
%50 = ptrtoint i8* %49 to i8
%51 = load i8*, i8** %3
%52 = getelementptr inbounds i8, i8* %51, i32 1
store i8* %52, i8** %3
store i8 %50, i8* %51
br label %69
53: ; preds = %21
%54 = call i8* @get_char_code(i8** %4, i32 8)
%55 = ptrtoint i8* %54 to i8
%56 = load i8*, i8** %3
%57 = getelementptr inbounds i8, i8* %56, i32 1
store i8* %57, i8** %3
store i8 %55, i8* %56
br label %69
58: ; preds = %21, %21, %21, %21, %21, %21, %21, %21, %21
%59 = call i8* @get_char_code(i8** %4, i32 10)
%60 = ptrtoint i8* %59 to i8
%61 = load i8*, i8** %3
%62 = getelementptr inbounds i8, i8* %61, i32 1
store i8* %62, i8** %3
store i8 %60, i8* %61
br label %69
63: ; preds = %21
%64 = load i8*, i8** %4
%65 = getelementptr inbounds i8, i8* %64, i32 1
store i8* %65, i8** %4
%66 = load i8, i8* %64
%67 = load i8*, i8** %3
%68 = getelementptr inbounds i8, i8* %67, i32 1
store i8* %68, i8** %3
store i8 %66, i8* %67
br label %69
69: ; preds = %63, %58, %53, %46, %41, %36, %31, %26
br label %70
70: ; preds = %69, %15
br label %6
71: ; preds = %6
%72 = load i8*, i8** %3
store i8 0, i8* %72
%73 = load i8*, i8** %3
%74 = load i8*, i8** %2
%75 = ptrtoint i8* %73 to i64
%76 = ptrtoint i8* %74 to i64
%77 = sub i64 %75, %76
%78 = trunc i64 %77 to i32
ret i32 %78
}

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