#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 */
typedef char wchar_t;

/* Variables and functions */
int /*<<< orphan*/ errx(int, char *);
int tr(wchar_t *arg) {
  int cnt;
  wchar_t ch, *p;
  for (p = arg, cnt = 0; (ch = *p++); ++arg, ++cnt)
    if (ch == '\\')
      switch (ch = *p++) {
      case 'n':
        *arg = '\n';
        break;
      case 't':
        *arg = '\t';
        break;
      case '0':
        *arg = '\0';
        break;
      default:
        *arg = ch;
        break;
      }
    else
      *arg = ch;
  if (!cnt)
    errx(1, "no delimiters specified");
  return (cnt);
}


x86 assembly (clang, -O0):
<tr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x18(%rbp)
mov    (%rax),%al
mov    %al,-0xd(%rbp)
cmp    $0x0,%al
je     11f8 <tr+0xe8>
movsbl -0xd(%rbp),%eax
cmp    $0x5c,%eax
jne    11d0 <tr+0xc0>
mov    -0x18(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x18(%rbp)
movsbl (%rax),%eax
mov    %eax,-0x1c(%rbp)
mov    %al,%cl
mov    %cl,-0xd(%rbp)
sub    $0x30,%eax
je     11b6 <tr+0xa6>
jmp    117c <tr+0x6c>
mov    -0x1c(%rbp),%eax
sub    $0x6e,%eax
je     119e <tr+0x8e>
jmp    118d <tr+0x7d>
mov    -0x1c(%rbp),%eax
sub    $0x74,%eax
je     11aa <tr+0x9a>
jmp    11c2 <tr+0xb2>
mov    -0x8(%rbp),%rax
movb   $0xa,(%rax)
jmp    11cb <tr+0xbb>
mov    -0x8(%rbp),%rax
movb   $0x9,(%rax)
jmp    11cb <tr+0xbb>
mov    -0x8(%rbp),%rax
movb   $0x0,(%rax)
jmp    11cb <tr+0xbb>
mov    -0xd(%rbp),%cl
mov    -0x8(%rbp),%rax
mov    %cl,(%rax)
jmp    11d9 <tr+0xc9>
mov    -0xd(%rbp),%cl
mov    -0x8(%rbp),%rax
mov    %cl,(%rax)
jmp    11de <tr+0xce>
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    112b <tr+0x1b>
cmpl   $0x0,-0xc(%rbp)
jne    1213 <tr+0x103>
mov    $0x1,%edi
lea    0xdf2(%rip),%rsi
call   1030 <errx@plt>
mov    -0xc(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<tr>:
push   %rbx
xor    %ebx,%ebx
mov    %rdi,%rax
jmp    1127 <tr+0x17>
xor    %ecx,%ecx
nopw   0x0(%rax,%rax,1)
mov    %cl,(%rdi,%rbx,1)
add    $0x1,%rbx
movzbl (%rax),%ecx
cmp    $0x5c,%cl
je     1140 <tr+0x30>
test   %cl,%cl
je     1162 <tr+0x52>
add    $0x1,%rax
jmp    1120 <tr+0x10>
nopl   0x0(%rax)
movzbl 0x1(%rax),%ecx
add    $0x2,%rax
movsbl %cl,%edx
cmp    $0x30,%edx
je     1118 <tr+0x8>
cmp    $0x6e,%edx
je     115e <tr+0x4e>
cmp    $0x74,%edx
jne    1120 <tr+0x10>
mov    $0x9,%cl
jmp    1120 <tr+0x10>
mov    $0xa,%cl
jmp    1120 <tr+0x10>
test   %ebx,%ebx
jne    1177 <tr+0x67>
lea    0xe93(%rip),%rsi
mov    $0x1,%edi
call   1030 <errx@plt>
mov    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [24 x i8] c"no delimiters specified\00"
define i32 @tr(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
%4 = alloca i8
%5 = alloca i8*
store i8* %0, i8** %2
%6 = load i8*, i8** %2
store i8* %6, i8** %5
store i32 0, i32* %3
br label %7
7: ; preds = %35, %1
%8 = load i8*, i8** %5
%9 = getelementptr inbounds i8, i8* %8, i32 1
store i8* %9, i8** %5
%10 = load i8, i8* %8
store i8 %10, i8* %4
%11 = icmp ne i8 %10, 0
br i1 %11, label %12, label %40
12: ; preds = %7
%13 = load i8, i8* %4
%14 = sext i8 %13 to i32
%15 = icmp eq i32 %14, 92
br i1 %15, label %16, label %31
16: ; preds = %12
%17 = load i8*, i8** %5
%18 = getelementptr inbounds i8, i8* %17, i32 1
store i8* %18, i8** %5
%19 = load i8, i8* %17
store i8 %19, i8* %4
%20 = sext i8 %19 to i32
switch i32 %20, label %27 [
i32 110, label %21
i32 116, label %23
i32 48, label %25
]
21: ; preds = %16
%22 = load i8*, i8** %2
store i8 10, i8* %22
br label %30
23: ; preds = %16
%24 = load i8*, i8** %2
store i8 9, i8* %24
br label %30
25: ; preds = %16
%26 = load i8*, i8** %2
store i8 0, i8* %26
br label %30
27: ; preds = %16
%28 = load i8, i8* %4
%29 = load i8*, i8** %2
store i8 %28, i8* %29
br label %30
30: ; preds = %27, %25, %23, %21
br label %34
31: ; preds = %12
%32 = load i8, i8* %4
%33 = load i8*, i8** %2
store i8 %32, i8* %33
br label %34
34: ; preds = %31, %30
br label %35
35: ; preds = %34
%36 = load i8*, i8** %2
%37 = getelementptr inbounds i8, i8* %36, i32 1
store i8* %37, i8** %2
%38 = load i32, i32* %3
%39 = add nsw i32 %38, 1
store i32 %39, i32* %3
br label %7
40: ; preds = %7
%41 = load i32, i32* %3
%42 = icmp ne i32 %41, 0
br i1 %42, label %45, label %43
43: ; preds = %40
%44 = call i32 @errx(i32 1, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0))
br label %45
45: ; preds = %43, %40
%46 = load i32, i32* %3
ret i32 %46
}

LLVM IR (-O2):
@.str = [24 x i8] c"no delimiters specified\00"
define i32 @tr(i8* nocapture %0) {
br label %2
2: ; preds = %15, %1
%3 = phi i8* [ %0, %1 ], [ %18, %15 ]
%4 = phi i32 [ 0, %1 ], [ %19, %15 ]
%5 = phi i8* [ %0, %1 ], [ %17, %15 ]
%6 = getelementptr inbounds i8, i8* %5, i64 1
%7 = load i8, i8* %5
switch i8 %7, label %15 [
i8 0, label %20
i8 92, label %8
]
8: ; preds = %2
%9 = getelementptr inbounds i8, i8* %5, i64 2
%10 = load i8, i8* %6
%11 = sext i8 %10 to i32
switch i32 %11, label %14 [
i32 110, label %15
i32 116, label %12
i32 48, label %13
]
12: ; preds = %8
br label %15
13: ; preds = %8
br label %15
14: ; preds = %8
br label %15
15: ; preds = %2, %8, %14, %13, %12
%16 = phi i8 [ %10, %14 ], [ 0, %13 ], [ 9, %12 ], [ 10, %8 ], [ %7, %2 ]
%17 = phi i8* [ %9, %14 ], [ %9, %13 ], [ %9, %12 ], [ %9, %8 ], [ %6, %2 ]
store i8 %16, i8* %3
%18 = getelementptr inbounds i8, i8* %3, i64 1
%19 = add nuw nsw i32 %4, 1
br label %2
20: ; preds = %2
%21 = icmp eq i32 %4, 0
br i1 %21, label %22, label %24
22: ; preds = %20
%23 = tail call i32 @errx(i32 1, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0))
br label %24
24: ; preds = %22, %20
ret i32 %4
}