#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 jep_is_escape(char);
int /*<<< orphan*/ printf(char *, char);
int jep_escape(char c, char *esc) {
  int result = 1;
  switch (jep_is_escape(c)) {
  case 0:
    *esc = '\a';
    break;
  case 1:
    *esc = '\b';
    break;
  case 2:
    *esc = '\f';
    break;
  case 3:
    *esc = '\n';
    break;
  case 4:
    *esc = '\r';
    break;
  case 5:
    *esc = '\t';
    break;
  case 6:
    *esc = '\v';
    break;
  case 7:
    *esc = '\\';
    break;
  case 8:
    *esc = '\'';
    break;
  case 9:
    *esc = '\"';
    break;
  case 10:
    *esc = '\?';
    break;
  case 11:
    *esc = '\0';
    break;
  default:
    printf("tokenizer error: invalid escape character %c\n", c);
    result = 0;
    break;
  }
  return result;
}


x86 assembly (clang, -O0):
<jep_escape>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %dil,%al
mov    %al,-0x1(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x1,-0x14(%rbp)
movsbl -0x1(%rbp),%edi
call   1040 <jep_is_escape@plt>
mov    %eax,%ecx
mov    %rcx,-0x20(%rbp)
sub    $0xb,%eax
ja     11f5 <jep_escape+0xd5>
mov    -0x20(%rbp),%rax
lea    0xea4(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    -0x10(%rbp),%rax
movb   $0x7,(%rax)
jmp    120c <jep_escape+0xec>
mov    -0x10(%rbp),%rax
movb   $0x8,(%rax)
jmp    120c <jep_escape+0xec>
mov    -0x10(%rbp),%rax
movb   $0xc,(%rax)
jmp    120c <jep_escape+0xec>
mov    -0x10(%rbp),%rax
movb   $0xa,(%rax)
jmp    120c <jep_escape+0xec>
mov    -0x10(%rbp),%rax
movb   $0xd,(%rax)
jmp    120c <jep_escape+0xec>
mov    -0x10(%rbp),%rax
movb   $0x9,(%rax)
jmp    120c <jep_escape+0xec>
mov    -0x10(%rbp),%rax
movb   $0xb,(%rax)
jmp    120c <jep_escape+0xec>
mov    -0x10(%rbp),%rax
movb   $0x5c,(%rax)
jmp    120c <jep_escape+0xec>
mov    -0x10(%rbp),%rax
movb   $0x27,(%rax)
jmp    120c <jep_escape+0xec>
mov    -0x10(%rbp),%rax
movb   $0x22,(%rax)
jmp    120c <jep_escape+0xec>
mov    -0x10(%rbp),%rax
movb   $0x3f,(%rax)
jmp    120c <jep_escape+0xec>
mov    -0x10(%rbp),%rax
movb   $0x0,(%rax)
jmp    120c <jep_escape+0xec>
lea    0xe34(%rip),%rdi
movsbl -0x1(%rbp),%esi
call   1030 <printf@plt>
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<jep_escape>:
push   %rbp
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %edi,%ebp
call   1040 <jep_is_escape@plt>
cmp    $0xb,%eax
ja     11c3 <jep_escape+0xa3>
mov    %eax,%eax
lea    0xec1(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
movb   $0x7,(%rbx)
mov    $0x1,%eax
jmp    11d5 <jep_escape+0xb5>
movb   $0x8,(%rbx)
mov    $0x1,%eax
jmp    11d5 <jep_escape+0xb5>
movb   $0xc,(%rbx)
mov    $0x1,%eax
jmp    11d5 <jep_escape+0xb5>
movb   $0xa,(%rbx)
mov    $0x1,%eax
jmp    11d5 <jep_escape+0xb5>
movb   $0xd,(%rbx)
mov    $0x1,%eax
jmp    11d5 <jep_escape+0xb5>
movb   $0x9,(%rbx)
mov    $0x1,%eax
jmp    11d5 <jep_escape+0xb5>
movb   $0xb,(%rbx)
mov    $0x1,%eax
jmp    11d5 <jep_escape+0xb5>
movb   $0x5c,(%rbx)
mov    $0x1,%eax
jmp    11d5 <jep_escape+0xb5>
movb   $0x27,(%rbx)
mov    $0x1,%eax
jmp    11d5 <jep_escape+0xb5>
movb   $0x22,(%rbx)
mov    $0x1,%eax
jmp    11d5 <jep_escape+0xb5>
movb   $0x3f,(%rbx)
mov    $0x1,%eax
jmp    11d5 <jep_escape+0xb5>
movb   $0x0,(%rbx)
mov    $0x1,%eax
jmp    11d5 <jep_escape+0xb5>
movsbl %bpl,%esi
lea    0xe62(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [46 x i8] c"tokenizer error: invalid escape character %c\0A\00"
define i32 @jep_escape(i8 signext %0, i8* %1) {
%3 = alloca i8
%4 = alloca i8*
%5 = alloca i32
store i8 %0, i8* %3
store i8* %1, i8** %4
store i32 1, i32* %5
%6 = load i8, i8* %3
%7 = call i32 @jep_is_escape(i8 signext %6)
switch i32 %7, label %32 [
i32 0, label %8
i32 1, label %10
i32 2, label %12
i32 3, label %14
i32 4, label %16
i32 5, label %18
i32 6, label %20
i32 7, label %22
i32 8, label %24
i32 9, label %26
i32 10, label %28
i32 11, label %30
]
8: ; preds = %2
%9 = load i8*, i8** %4
store i8 7, i8* %9
br label %35
10: ; preds = %2
%11 = load i8*, i8** %4
store i8 8, i8* %11
br label %35
12: ; preds = %2
%13 = load i8*, i8** %4
store i8 12, i8* %13
br label %35
14: ; preds = %2
%15 = load i8*, i8** %4
store i8 10, i8* %15
br label %35
16: ; preds = %2
%17 = load i8*, i8** %4
store i8 13, i8* %17
br label %35
18: ; preds = %2
%19 = load i8*, i8** %4
store i8 9, i8* %19
br label %35
20: ; preds = %2
%21 = load i8*, i8** %4
store i8 11, i8* %21
br label %35
22: ; preds = %2
%23 = load i8*, i8** %4
store i8 92, i8* %23
br label %35
24: ; preds = %2
%25 = load i8*, i8** %4
store i8 39, i8* %25
br label %35
26: ; preds = %2
%27 = load i8*, i8** %4
store i8 34, i8* %27
br label %35
28: ; preds = %2
%29 = load i8*, i8** %4
store i8 63, i8* %29
br label %35
30: ; preds = %2
%31 = load i8*, i8** %4
store i8 0, i8* %31
br label %35
32: ; preds = %2
%33 = load i8, i8* %3
%34 = call i32 @printf(i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str, i64 0, i64 0), i8 signext %33)
store i32 0, i32* %5
br label %35
35: ; preds = %32, %30, %28, %26, %24, %22, %20, %18, %16, %14, %12, %10, %8
%36 = load i32, i32* %5
ret i32 %36
}

LLVM IR (-O2):
@.str = [46 x i8] c"tokenizer error: invalid escape character %c\0A\00"
define i32 @jep_escape(i8 signext %0, i8* nocapture writeonly %1) {
%3 = tail call i32 @jep_is_escape(i8 signext %0)
switch i32 %3, label %16 [
i32 0, label %4
i32 1, label %5
i32 2, label %6
i32 3, label %7
i32 4, label %8
i32 5, label %9
i32 6, label %10
i32 7, label %11
i32 8, label %12
i32 9, label %13
i32 10, label %14
i32 11, label %15
]
4: ; preds = %2
store i8 7, i8* %1
br label %18
5: ; preds = %2
store i8 8, i8* %1
br label %18
6: ; preds = %2
store i8 12, i8* %1
br label %18
7: ; preds = %2
store i8 10, i8* %1
br label %18
8: ; preds = %2
store i8 13, i8* %1
br label %18
9: ; preds = %2
store i8 9, i8* %1
br label %18
10: ; preds = %2
store i8 11, i8* %1
br label %18
11: ; preds = %2
store i8 92, i8* %1
br label %18
12: ; preds = %2
store i8 39, i8* %1
br label %18
13: ; preds = %2
store i8 34, i8* %1
br label %18
14: ; preds = %2
store i8 63, i8* %1
br label %18
15: ; preds = %2
store i8 0, i8* %1
br label %18
16: ; preds = %2
%17 = tail call i32 @printf(i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str, i64 0, i64 0), i8 signext %0)
br label %18
18: ; preds = %16, %15, %14, %13, %12, %11, %10, %9, %8, %7, %6, %5, %4
%19 = phi i32 [ 0, %16 ], [ 1, %15 ], [ 1, %14 ], [ 1, %13 ], [ 1, %12 ], [ 1, %11 ], [ 1, %10 ], [ 1, %9 ], [ 1, %8 ], [ 1, %7 ], [ 1, %6 ], [ 1, %5 ], [ 1, %4 ]
ret i32 %19
}