#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 */
char *malloc(size_t);
int strlen(char *);
char *TSDef_TranslateStringLiteral(char *raw_literal) {
  char *translated_literal;
  char *insertion_position;
  size_t raw_length;
  char current_character;
  raw_length = strlen(raw_literal) - 2;
  translated_literal = malloc(raw_length + 1);
  if (translated_literal == NULL)
    return NULL;
  raw_literal++;
  insertion_position = translated_literal;
  for (current_character = *raw_literal; current_character != '"';
       current_character = *raw_literal) {
    if (current_character == '\\') {
      raw_literal++;
      current_character = *raw_literal;
      switch (current_character) {
      case 'n':
        *insertion_position = '\n';
        break;
      case 'a':
        *insertion_position = '\a';
        break;
      default:
        *insertion_position = current_character;
        break;
      }
    } else
      *insertion_position = current_character;
    insertion_position++;
    raw_literal++;
  }
  *insertion_position = 0;
  return translated_literal;
}


x86 assembly (clang, -O0):
<TSDef_TranslateStringLiteral>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <strlen@plt>
sub    $0x2,%eax
cltq
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rdi
add    $0x1,%rdi
call   1040 <malloc@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    1167 <TSDef_TranslateStringLiteral+0x47>
movq   $0x0,-0x8(%rbp)
jmp    123d <TSDef_TranslateStringLiteral+0x11d>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%al
mov    %al,-0x29(%rbp)
movsbl -0x29(%rbp),%eax
cmp    $0x22,%eax
je     122e <TSDef_TranslateStringLiteral+0x10e>
movsbl -0x29(%rbp),%eax
cmp    $0x5c,%eax
jne    11ff <TSDef_TranslateStringLiteral+0xdf>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%al
mov    %al,-0x29(%rbp)
movsbl -0x29(%rbp),%eax
mov    %eax,-0x30(%rbp)
sub    $0x61,%eax
je     11e5 <TSDef_TranslateStringLiteral+0xc5>
jmp    11c8 <TSDef_TranslateStringLiteral+0xa8>
mov    -0x30(%rbp),%eax
sub    $0x6e,%eax
jne    11f1 <TSDef_TranslateStringLiteral+0xd1>
jmp    11d9 <TSDef_TranslateStringLiteral+0xb9>
mov    -0x20(%rbp),%rax
movb   $0xa,(%rax)
jmp    11fa <TSDef_TranslateStringLiteral+0xda>
mov    -0x20(%rbp),%rax
movb   $0x7,(%rax)
jmp    11fa <TSDef_TranslateStringLiteral+0xda>
mov    -0x29(%rbp),%cl
mov    -0x20(%rbp),%rax
mov    %cl,(%rax)
jmp    1208 <TSDef_TranslateStringLiteral+0xe8>
mov    -0x29(%rbp),%cl
mov    -0x20(%rbp),%rax
mov    %cl,(%rax)
mov    -0x20(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%al
mov    %al,-0x29(%rbp)
jmp    1184 <TSDef_TranslateStringLiteral+0x64>
mov    -0x20(%rbp),%rax
movb   $0x0,(%rax)
mov    -0x18(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<TSDef_TranslateStringLiteral>:
push   %rbx
mov    %rdi,%rbx
call   1030 <strlen@plt>
movslq %eax,%rdi
add    $0xffffffffffffffff,%rdi
call   1040 <malloc@plt>
test   %rax,%rax
je     118c <TSDef_TranslateStringLiteral+0x6c>
mov    %rax,%rcx
jmp    1156 <TSDef_TranslateStringLiteral+0x36>
mov    $0xa,%dl
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    %dl,(%rcx)
add    $0x1,%rcx
movzbl 0x1(%rbx),%edx
cmp    $0x5c,%dl
je     1170 <TSDef_TranslateStringLiteral+0x50>
cmp    $0x22,%dl
je     1189 <TSDef_TranslateStringLiteral+0x69>
add    $0x1,%rbx
jmp    1150 <TSDef_TranslateStringLiteral+0x30>
nopw   0x0(%rax,%rax,1)
movzbl 0x2(%rbx),%edx
add    $0x2,%rbx
movsbl %dl,%esi
cmp    $0x6e,%esi
je     113f <TSDef_TranslateStringLiteral+0x1f>
cmp    $0x61,%esi
jne    1150 <TSDef_TranslateStringLiteral+0x30>
mov    $0x7,%dl
jmp    1150 <TSDef_TranslateStringLiteral+0x30>
movb   $0x0,(%rcx)
pop    %rbx
ret

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

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