#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*/ assert(int);
int strlen(char const *);
const char *l_expand_char(const char *str) {
  assert(strlen(str) == 2);
  switch (str[1]) {
  case 'a':
    return "\a";
  case 'e':
    return "\033";
  case 't':
    return "\t";
  case 'n':
    return "\n";
  case 'r':
    return "\r";
  default:
    return str + 1;
  }
}


x86 assembly (clang, -O0):
<l_expand_char>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <strlen@plt>
sub    $0x2,%eax
sete   %al
movzbl %al,%edi
call   1040 <assert@plt>
mov    -0x10(%rbp),%rax
movsbl 0x1(%rax),%eax
add    $0xffffff9f,%eax
mov    %eax,%ecx
mov    %rcx,-0x18(%rbp)
sub    $0x13,%eax
ja     11c1 <l_expand_char+0xa1>
mov    -0x18(%rbp),%rax
lea    0xe98(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
lea    0xed8(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    11cd <l_expand_char+0xad>
lea    0xeca(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    11cd <l_expand_char+0xad>
lea    0xebc(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    11cd <l_expand_char+0xad>
lea    0xeae(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    11cd <l_expand_char+0xad>
lea    0xea0(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    11cd <l_expand_char+0xad>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<l_expand_char>:
push   %rbx
mov    %rdi,%rbx
call   1030 <strlen@plt>
xor    %edi,%edi
cmp    $0x2,%eax
sete   %dil
call   1040 <assert@plt>
movsbl 0x1(%rbx),%ecx
add    $0xffffff9f,%ecx
cmp    $0x13,%ecx
ja     1163 <l_expand_char+0x43>
lea    0xf06(%rip),%rax
lea    0xeaf(%rip),%rdx
movslq (%rdx,%rcx,4),%rcx
add    %rdx,%rcx
jmp    *%rcx
lea    0xef1(%rip),%rax
pop    %rbx
ret
add    $0x1,%rbx
mov    %rbx,%rax
pop    %rbx
ret
lea    0xee3(%rip),%rax
pop    %rbx
ret
lea    0xedc(%rip),%rax
pop    %rbx
ret
lea    0xecf(%rip),%rax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [2 x i8] c"\07\00"
@.str.1 = [2 x i8] c"\1B\00"
@.str.2 = [2 x i8] c"\09\00"
@.str.3 = [2 x i8] c"\0A\00"
@.str.4 = [2 x i8] c"\0D\00"
define i8* @l_expand_char(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
store i8* %0, i8** %3
%4 = load i8*, i8** %3
%5 = call i32 @strlen(i8* %4)
%6 = icmp eq i32 %5, 2
%7 = zext i1 %6 to i32
%8 = call i32 @assert(i32 %7)
%9 = load i8*, i8** %3
%10 = getelementptr inbounds i8, i8* %9, i64 1
%11 = load i8, i8* %10
%12 = sext i8 %11 to i32
switch i32 %12, label %18 [
i32 97, label %13
i32 101, label %14
i32 116, label %15
i32 110, label %16
i32 114, label %17
]
13: ; preds = %1
store i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i8** %2
br label %21
14: ; preds = %1
store i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0), i8** %2
br label %21
15: ; preds = %1
store i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0), i8** %2
br label %21
16: ; preds = %1
store i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0), i8** %2
br label %21
17: ; preds = %1
store i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0), i8** %2
br label %21
18: ; preds = %1
%19 = load i8*, i8** %3
%20 = getelementptr inbounds i8, i8* %19, i64 1
store i8* %20, i8** %2
br label %21
21: ; preds = %18, %17, %16, %15, %14, %13
%22 = load i8*, i8** %2
ret i8* %22
}

LLVM IR (-O2):
@.str = [2 x i8] c"\07\00"
@.str.1 = [2 x i8] c"\1B\00"
@.str.2 = [2 x i8] c"\09\00"
@.str.3 = [2 x i8] c"\0A\00"
@.str.4 = [2 x i8] c"\0D\00"
define i8* @l_expand_char(i8* %0) {
%2 = tail call i32 @strlen(i8* %0)
%3 = icmp eq i32 %2, 2
%4 = zext i1 %3 to i32
%5 = tail call i32 @assert(i32 %4)
%6 = getelementptr inbounds i8, i8* %0, i64 1
%7 = load i8, i8* %6
%8 = sext i8 %7 to i32
switch i32 %8, label %13 [
i32 97, label %14
i32 101, label %9
i32 116, label %10
i32 110, label %11
i32 114, label %12
]
9: ; preds = %1
br label %14
10: ; preds = %1
br label %14
11: ; preds = %1
br label %14
12: ; preds = %1
br label %14
13: ; preds = %1
br label %14
14: ; preds = %1, %13, %12, %11, %10, %9
%15 = phi i8* [ %6, %13 ], [ getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0), %12 ], [ getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0), %11 ], [ getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0), %10 ], [ getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0), %9 ], [ getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), %1 ]
ret i8* %15
}