#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 /*<<< orphan*/ isdigit(char);
char *tdecode(register char *str, char **area) {
  register char *cp;
  register int c;
  register char *dp;
  int i;
  cp = *area;
  while ((c = *str++) && c != ':') {
    switch (c) {
    case '^':
      c = *str++ & 037;
      break;
    case '\\':
      dp = "E\033^^\\\\::n\nr\rt\tb\bf\f";
      c = *str++;
    nextc:
      if (*dp++ == c) {
        c = *dp++;
        break;
      }
      dp++;
      if (*dp)
        goto nextc;
      if (isdigit(c)) {
        c -= '0', i = 2;
        do
          c <<= 3, c |= *str++ - '0';
        while (--i && isdigit(*str));
      }
      break;
    }
    *cp++ = c;
  }
  *cp++ = 0;
  str = *area;
  *area = cp;
  return (str);
}


x86 assembly (clang, -O0):
<tdecode>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x8(%rbp)
movsbl (%rax),%ecx
mov    %ecx,-0x1c(%rbp)
xor    %eax,%eax
cmp    $0x0,%ecx
mov    %al,-0x2d(%rbp)
je     1158 <tdecode+0x48>
cmpl   $0x3a,-0x1c(%rbp)
setne  %al
mov    %al,-0x2d(%rbp)
mov    -0x2d(%rbp),%al
test   $0x1,%al
jne    1168 <tdecode+0x58>
jmp    12c1 <tdecode+0x1b1>
mov    -0x1c(%rbp),%eax
mov    %eax,-0x34(%rbp)
sub    $0x5c,%eax
je     11aa <tdecode+0x9a>
jmp    117c <tdecode+0x6c>
mov    -0x34(%rbp),%eax
sub    $0x5e,%eax
jne    12a6 <tdecode+0x196>
jmp    118d <tdecode+0x7d>
mov    -0x8(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x8(%rbp)
movsbl (%rax),%eax
and    $0x1f,%eax
mov    %eax,-0x1c(%rbp)
jmp    12a6 <tdecode+0x196>
lea    0xe4f(%rip),%rax
mov    %rax,-0x28(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x8(%rbp)
movsbl (%rax),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x28(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x28(%rbp)
movsbl (%rax),%eax
cmp    -0x1c(%rbp),%eax
jne    11ff <tdecode+0xef>
mov    -0x28(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x28(%rbp)
movsbl (%rax),%eax
mov    %eax,-0x1c(%rbp)
jmp    12a6 <tdecode+0x196>
mov    -0x28(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rax
cmpb   $0x0,(%rax)
je     121d <tdecode+0x10d>
jmp    11ca <tdecode+0xba>
mov    -0x1c(%rbp),%eax
movsbl %al,%edi
call   1030 <isdigit@plt>
cmp    $0x0,%eax
je     12a1 <tdecode+0x191>
mov    -0x1c(%rbp),%eax
sub    $0x30,%eax
mov    %eax,-0x1c(%rbp)
movl   $0x2,-0x2c(%rbp)
mov    -0x1c(%rbp),%eax
shl    $0x3,%eax
mov    %eax,-0x1c(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x8(%rbp)
movsbl (%rax),%eax
sub    $0x30,%eax
or     -0x1c(%rbp),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x2c(%rbp),%ecx
add    $0xffffffff,%ecx
mov    %ecx,-0x2c(%rbp)
xor    %eax,%eax
cmp    $0x0,%ecx
mov    %al,-0x35(%rbp)
je     1291 <tdecode+0x181>
mov    -0x8(%rbp),%rax
movsbl (%rax),%edi
call   1030 <isdigit@plt>
cmp    $0x0,%eax
setne  %al
mov    %al,-0x35(%rbp)
mov    -0x35(%rbp),%al
test   $0x1,%al
jne    1241 <tdecode+0x131>
jmp    12a1 <tdecode+0x191>
jmp    12a6 <tdecode+0x196>
mov    -0x1c(%rbp),%eax
mov    %al,%cl
mov    -0x18(%rbp),%rax
mov    %rax,%rdx
add    $0x1,%rdx
mov    %rdx,-0x18(%rbp)
mov    %cl,(%rax)
jmp    112b <tdecode+0x1b>
mov    -0x18(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x18(%rbp)
movb   $0x0,(%rax)
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x8(%rbp)
mov    -0x18(%rbp),%rcx
mov    -0x10(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x8(%rbp),%rax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<tdecode>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
mov    (%rsi),%r15
add    $0x1,%r15
lea    0xfbd(%rip),%rdx
lea    0xeca(%rip),%r13
lea    0xfb5(%rip),%r8
lea    0xfac(%rip),%r9
lea    0xfa3(%rip),%r10
lea    0xfa8(%rip),%r11
lea    0xfa3(%rip),%rsi
lea    0xf94(%rip),%rdi
jmp    1182 <tdecode+0x72>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
add    $0x1,%rbx
mov    %rbx,%r12
mov    %bpl,-0x1(%r15)
add    $0x1,%r15
mov    %r12,%rbx
movsbl (%rbx),%ebp
test   %ebp,%ebp
je     12ba <tdecode+0x1aa>
cmp    $0x3a,%bpl
je     12ba <tdecode+0x1aa>
cmp    $0x5c,%ebp
je     11b0 <tdecode+0xa0>
cmp    $0x5e,%ebp
jne    1170 <tdecode+0x60>
movzbl 0x1(%rbx),%ebp
add    $0x2,%rbx
and    $0x1f,%ebp
jmp    1174 <tdecode+0x64>
xchg   %ax,%ax
lea    0x2(%rbx),%r12
movzbl 0x1(%rbx),%ebp
lea    -0x3a(%rbp),%eax
cmp    $0x3a,%al
ja     11d9 <tdecode+0xc9>
movzbl %al,%eax
movslq 0x0(%r13,%rax,4),%rcx
add    %r13,%rcx
mov    %rdx,%rax
jmp    *%rcx
mov    %r8,%rax
movzbl 0x1(%r8),%ebp
jmp    1177 <tdecode+0x67>
movsbl %bpl,%edi
call   1030 <isdigit@plt>
test   %eax,%eax
je     1284 <tdecode+0x174>
lea    -0x180(,%rbp,8),%eax
movzbl 0x2(%rbx),%ebp
add    $0xffffffd0,%ebp
or     %eax,%ebp
movsbl 0x3(%rbx),%edi
call   1030 <isdigit@plt>
test   %eax,%eax
je     127d <tdecode+0x16d>
shl    $0x3,%ebp
movzbl 0x3(%rbx),%eax
add    $0x4,%rbx
add    $0xffffffd0,%eax
or     %ebp,%eax
mov    %rbx,%r12
mov    %eax,%ebp
jmp    1284 <tdecode+0x174>
mov    %r9,%rax
movzbl 0x1(%r9),%ebp
jmp    1177 <tdecode+0x67>
mov    %r10,%rax
movzbl 0x1(%r10),%ebp
jmp    1177 <tdecode+0x67>
mov    %r11,%rax
movzbl 0x1(%r11),%ebp
jmp    1177 <tdecode+0x67>
mov    %rsi,%rax
movzbl 0x1(%rax),%ebp
jmp    1177 <tdecode+0x67>
mov    %rdi,%rax
movzbl 0x1(%rdi),%ebp
jmp    1177 <tdecode+0x67>
lea    0xe92(%rip),%rax
movzbl 0x1(%rax),%ebp
jmp    1177 <tdecode+0x67>
lea    0xe84(%rip),%rax
movzbl 0x1(%rax),%ebp
jmp    1177 <tdecode+0x67>
add    $0x3,%rbx
mov    %rbx,%r12
lea    0xe61(%rip),%rdx
lea    0xe60(%rip),%r8
lea    0xe57(%rip),%r9
lea    0xe4e(%rip),%r10
lea    0xe53(%rip),%r11
lea    0xe4e(%rip),%rsi
lea    0xe3f(%rip),%rdi
jmp    1177 <tdecode+0x67>
movb   $0x0,-0x1(%r15)
mov    (%r14),%rax
mov    %r15,(%r14)
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [19 x i8] c"E\1B^^\\\\::n\0Ar\0Dt\09b\08f\0C\00"
define i8* @tdecode(i8* %0, i8** %1) {
%3 = alloca i8*
%4 = alloca i8**
%5 = alloca i8*
%6 = alloca i32
%7 = alloca i8*
%8 = alloca i32
store i8* %0, i8** %3
store i8** %1, i8*** %4
%9 = load i8**, i8*** %4
%10 = load i8*, i8** %9
store i8* %10, i8** %5
br label %11
11: ; preds = %85, %2
%12 = load i8*, i8** %3
%13 = getelementptr inbounds i8, i8* %12, i32 1
store i8* %13, i8** %3
%14 = load i8, i8* %12
%15 = sext i8 %14 to i32
store i32 %15, i32* %6
%16 = icmp ne i32 %15, 0
br i1 %16, label %17, label %20
17: ; preds = %11
%18 = load i32, i32* %6
%19 = icmp ne i32 %18, 58
br label %20
20: ; preds = %17, %11
%21 = phi i1 [ false, %11 ], [ %19, %17 ]
br i1 %21, label %22, label %90
22: ; preds = %20
%23 = load i32, i32* %6
switch i32 %23, label %85 [
i32 94, label %24
i32 92, label %30
]
24: ; preds = %22
%25 = load i8*, i8** %3
%26 = getelementptr inbounds i8, i8* %25, i32 1
store i8* %26, i8** %3
%27 = load i8, i8* %25
%28 = sext i8 %27 to i32
%29 = and i32 %28, 31
store i32 %29, i32* %6
br label %85
30: ; preds = %22
store i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), i8** %7
%31 = load i8*, i8** %3
%32 = getelementptr inbounds i8, i8* %31, i32 1
store i8* %32, i8** %3
%33 = load i8, i8* %31
%34 = sext i8 %33 to i32
store i32 %34, i32* %6
br label %35
35: ; preds = %53, %30
%36 = load i8*, i8** %7
%37 = getelementptr inbounds i8, i8* %36, i32 1
store i8* %37, i8** %7
%38 = load i8, i8* %36
%39 = sext i8 %38 to i32
%40 = load i32, i32* %6
%41 = icmp eq i32 %39, %40
br i1 %41, label %42, label %47
42: ; preds = %35
%43 = load i8*, i8** %7
%44 = getelementptr inbounds i8, i8* %43, i32 1
store i8* %44, i8** %7
%45 = load i8, i8* %43
%46 = sext i8 %45 to i32
store i32 %46, i32* %6
br label %85
47: ; preds = %35
%48 = load i8*, i8** %7
%49 = getelementptr inbounds i8, i8* %48, i32 1
store i8* %49, i8** %7
%50 = load i8*, i8** %7
%51 = load i8, i8* %50
%52 = icmp ne i8 %51, 0
br i1 %52, label %53, label %54
53: ; preds = %47
br label %35
54: ; preds = %47
%55 = load i32, i32* %6
%56 = trunc i32 %55 to i8
%57 = call i32 @isdigit(i8 signext %56)
%58 = icmp ne i32 %57, 0
br i1 %58, label %59, label %84
59: ; preds = %54
%60 = load i32, i32* %6
%61 = sub nsw i32 %60, 48
store i32 %61, i32* %6
store i32 2, i32* %8
br label %62
62: ; preds = %81, %59
%63 = load i32, i32* %6
%64 = shl i32 %63, 3
store i32 %64, i32* %6
%65 = load i8*, i8** %3
%66 = getelementptr inbounds i8, i8* %65, i32 1
store i8* %66, i8** %3
%67 = load i8, i8* %65
%68 = sext i8 %67 to i32
%69 = sub nsw i32 %68, 48
%70 = load i32, i32* %6
%71 = or i32 %70, %69
store i32 %71, i32* %6
br label %72
72: ; preds = %62
%73 = load i32, i32* %8
%74 = add nsw i32 %73, -1
store i32 %74, i32* %8
%75 = icmp ne i32 %74, 0
br i1 %75, label %76, label %81
76: ; preds = %72
%77 = load i8*, i8** %3
%78 = load i8, i8* %77
%79 = call i32 @isdigit(i8 signext %78)
%80 = icmp ne i32 %79, 0
br label %81
81: ; preds = %76, %72
%82 = phi i1 [ false, %72 ], [ %80, %76 ]
br i1 %82, label %62, label %83
83: ; preds = %81
br label %84
84: ; preds = %83, %54
br label %85
85: ; preds = %22, %84, %42, %24
%86 = load i32, i32* %6
%87 = trunc i32 %86 to i8
%88 = load i8*, i8** %5
%89 = getelementptr inbounds i8, i8* %88, i32 1
store i8* %89, i8** %5
store i8 %87, i8* %88
br label %11
90: ; preds = %20
%91 = load i8*, i8** %5
%92 = getelementptr inbounds i8, i8* %91, i32 1
store i8* %92, i8** %5
store i8 0, i8* %91
%93 = load i8**, i8*** %4
%94 = load i8*, i8** %93
store i8* %94, i8** %3
%95 = load i8*, i8** %5
%96 = load i8**, i8*** %4
store i8* %95, i8** %96
%97 = load i8*, i8** %3
ret i8* %97
}

LLVM IR (-O2):
@.str = [19 x i8] c"E\1B^^\\\\::n\0Ar\0Dt\09b\08f\0C\00"
define i8* @tdecode(i8* nocapture %0, i8** nocapture %1) {
%3 = load i8*, i8** %1
br label %4
4: ; preds = %54, %2
%5 = phi i8* [ %0, %2 ], [ %55, %54 ]
%6 = phi i8* [ %3, %2 ], [ %58, %54 ]
%7 = getelementptr inbounds i8, i8* %5, i64 1
%8 = load i8, i8* %5
%9 = sext i8 %8 to i32
switch i8 %8, label %10 [
i8 58, label %59
i8 0, label %59
]
10: ; preds = %4
switch i32 %9, label %54 [
i32 94, label %11
i32 92, label %16
]
11: ; preds = %10
%12 = getelementptr inbounds i8, i8* %5, i64 2
%13 = load i8, i8* %7
%14 = and i8 %13, 31
%15 = zext i8 %14 to i32
br label %54
16: ; preds = %10
%17 = getelementptr inbounds i8, i8* %5, i64 2
%18 = load i8, i8* %7
%19 = zext i8 %18 to i32
switch i8 %18, label %33 [
i8 69, label %28
i8 94, label %20
i8 92, label %21
i8 58, label %22
i8 110, label %23
i8 114, label %24
i8 116, label %25
i8 98, label %26
i8 102, label %27
]
20: ; preds = %16
br label %28
21: ; preds = %16
br label %28
22: ; preds = %16
br label %28
23: ; preds = %16
br label %28
24: ; preds = %16
br label %28
25: ; preds = %16
br label %28
26: ; preds = %16
br label %28
27: ; preds = %16
br label %28
28: ; preds = %16, %27, %26, %25, %24, %23, %22, %21, %20
%29 = phi i8* [ getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), %16 ], [ getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 2), %20 ], [ getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 4), %21 ], [ getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 6), %22 ], [ getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 8), %23 ], [ getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 10), %24 ], [ getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 12), %25 ], [ getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 14), %26 ], [ getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 16), %27 ]
%30 = getelementptr inbounds i8, i8* %29, i64 1
%31 = load i8, i8* %30
%32 = zext i8 %31 to i32
br label %54
33: ; preds = %16
%34 = tail call i32 @isdigit(i8 signext %18)
%35 = icmp eq i32 %34, 0
br i1 %35, label %54, label %36
36: ; preds = %33
%37 = shl nuw nsw i32 %19, 3
%38 = add nsw i32 %37, -384
%39 = getelementptr inbounds i8, i8* %5, i64 3
%40 = load i8, i8* %17
%41 = zext i8 %40 to i32
%42 = add nsw i32 %41, -48
%43 = or i32 %42, %38
%44 = load i8, i8* %39
%45 = tail call i32 @isdigit(i8 signext %44)
%46 = icmp eq i32 %45, 0
br i1 %46, label %54, label %47
47: ; preds = %36
%48 = shl nsw i32 %43, 3
%49 = getelementptr inbounds i8, i8* %5, i64 4
%50 = load i8, i8* %39
%51 = zext i8 %50 to i32
%52 = add nsw i32 %51, -48
%53 = or i32 %52, %48
br label %54
54: ; preds = %36, %47, %33, %10, %28, %11
%55 = phi i8* [ %7, %10 ], [ %17, %28 ], [ %17, %33 ], [ %12, %11 ], [ %39, %36 ], [ %49, %47 ]
%56 = phi i32 [ %9, %10 ], [ %32, %28 ], [ %19, %33 ], [ %15, %11 ], [ %43, %36 ], [ %53, %47 ]
%57 = trunc i32 %56 to i8
%58 = getelementptr inbounds i8, i8* %6, i64 1
store i8 %57, i8* %6
br label %4
59: ; preds = %4, %4
%60 = getelementptr inbounds i8, i8* %6, i64 1
store i8 0, i8* %6
%61 = load i8*, i8** %1
store i8* %60, i8** %1
ret i8* %61
}