#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 strlen(char *);
char *unescape(char s[], char t[]) {
  int i, j;
  for (i = j = 0; j < strlen(s); j++) {
    switch (s[j]) {
    case '\\':
      break;
    case 't':
      t[i++] = 9;
      break;
    case 'n':
      t[i++] = 10;
      break;
    default:
      t[i++] = s[j];
      break;
    }
  }
  return t;
}


x86 assembly (clang, -O0):
<unescape>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x18(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x18(%rbp),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,%ecx
mov    -0x1c(%rbp),%eax
cmp    %ecx,%eax
jge    11f7 <unescape+0xe7>
mov    -0x8(%rbp),%rax
movslq -0x18(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
mov    %eax,-0x20(%rbp)
sub    $0x5c,%eax
je     1189 <unescape+0x79>
jmp    1167 <unescape+0x57>
mov    -0x20(%rbp),%eax
sub    $0x6e,%eax
je     11a9 <unescape+0x99>
jmp    1178 <unescape+0x68>
mov    -0x20(%rbp),%eax
sub    $0x74,%eax
je     118e <unescape+0x7e>
jmp    11c4 <unescape+0xb4>
jmp    11e4 <unescape+0xd4>
mov    -0x10(%rbp),%rax
mov    -0x14(%rbp),%ecx
mov    %ecx,%edx
add    $0x1,%edx
mov    %edx,-0x14(%rbp)
movslq %ecx,%rcx
movb   $0x9,(%rax,%rcx,1)
jmp    11e4 <unescape+0xd4>
mov    -0x10(%rbp),%rax
mov    -0x14(%rbp),%ecx
mov    %ecx,%edx
add    $0x1,%edx
mov    %edx,-0x14(%rbp)
movslq %ecx,%rcx
movb   $0xa,(%rax,%rcx,1)
jmp    11e4 <unescape+0xd4>
mov    -0x8(%rbp),%rax
movslq -0x18(%rbp),%rcx
mov    (%rax,%rcx,1),%dl
mov    -0x10(%rbp),%rax
mov    -0x14(%rbp),%ecx
mov    %ecx,%esi
add    $0x1,%esi
mov    %esi,-0x14(%rbp)
movslq %ecx,%rcx
mov    %dl,(%rax,%rcx,1)
jmp    11e9 <unescape+0xd9>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    112e <unescape+0x1e>
mov    -0x10(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<unescape>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%r15
call   1030 <strlen@plt>
test   %eax,%eax
jle    116a <unescape+0x5a>
xor    %ebx,%ebx
xor    %ebp,%ebp
jmp    114f <unescape+0x3f>
nopl   0x0(%rax)
mov    $0x9,%al
movslq %ebp,%rcx
add    $0x1,%ebp
mov    %al,(%r14,%rcx,1)
add    $0x1,%rbx
mov    %r15,%rdi
call   1030 <strlen@plt>
cltq
cmp    %rax,%rbx
jge    116a <unescape+0x5a>
movzbl (%r15,%rbx,1),%eax
movsbl %al,%ecx
cmp    $0x5c,%ecx
je     113c <unescape+0x2c>
cmp    $0x74,%ecx
je     1130 <unescape+0x20>
cmp    $0x6e,%ecx
jne    1132 <unescape+0x22>
mov    $0xa,%al
jmp    1132 <unescape+0x22>
mov    %r14,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
define i8* @unescape(i8* %0, i8* returned writeonly %1) {
%3 = tail call i32 @strlen(i8* %0)
%4 = icmp sgt i32 %3, 0
br i1 %4, label %5, label %24
5: ; preds = %2, %18
%6 = phi i64 [ %20, %18 ], [ 0, %2 ]
%7 = phi i32 [ %19, %18 ], [ 0, %2 ]
%8 = getelementptr inbounds i8, i8* %0, i64 %6
%9 = load i8, i8* %8
%10 = sext i8 %9 to i32
switch i32 %10, label %12 [
i32 92, label %18
i32 116, label %13
i32 110, label %11
]
11: ; preds = %5
br label %13
12: ; preds = %5
br label %13
13: ; preds = %5, %12, %11
%14 = phi i8 [ 10, %11 ], [ %9, %12 ], [ 9, %5 ]
%15 = add nsw i32 %7, 1
%16 = sext i32 %7 to i64
%17 = getelementptr inbounds i8, i8* %1, i64 %16
store i8 %14, i8* %17
br label %18
18: ; preds = %13, %5
%19 = phi i32 [ %7, %5 ], [ %15, %13 ]
%20 = add nuw nsw i64 %6, 1
%21 = tail call i32 @strlen(i8* %0)
%22 = sext i32 %21 to i64
%23 = icmp slt i64 %20, %22
br i1 %23, label %5, label %24
24: ; preds = %18, %2
ret i8* %1
}