#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*/ ENOSYS;
int _printf_error(char const *, int);
int /*<<< orphan*/ errno;
int /*<<< orphan*/ putc(char const, int /*<<< orphan*/);
int /*<<< orphan*/ stdout;
int _printf_unescape(char const *p) {
  switch (*p) {
  case '\0':
    break;
  case 'a':
    putc('\a', stdout);
    break;
  case 'b':
    putc('\b', stdout);
    break;
  case 'e':
    putc('\x1b', stdout);
    break;
  case 'f':
    putc('\f', stdout);
    break;
  case 'n':
    putc('\n', stdout);
    break;
  case 'r':
    putc('\r', stdout);
    break;
  case 't':
    putc('\t', stdout);
    break;
  case 'v':
    putc('\v', stdout);
    break;
  case '0':
  case '1':
  case '2':
  case '3':
  case '4':
  case '5':
  case '6':
  case '7':
  case '8':
  case '9':
  case 'x':
    errno = ENOSYS;
    return _printf_error(p, 1);
  default:
    putc(*p, stdout);
    break;
  }
  return 0;
}


x86 assembly (clang, -O0):
<_printf_unescape>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
mov    %eax,%ecx
mov    %rcx,-0x18(%rbp)
sub    $0x78,%eax
ja     1243 <_printf_unescape+0x123>
mov    -0x18(%rbp),%rax
lea    0xeb3(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
jmp    125a <_printf_unescape+0x13a>
mov    0x2e6e(%rip),%rax
mov    (%rax),%esi
mov    $0x7,%edi
call   1030 <putc@plt>
jmp    125a <_printf_unescape+0x13a>
mov    0x2e56(%rip),%rax
mov    (%rax),%esi
mov    $0x8,%edi
call   1030 <putc@plt>
jmp    125a <_printf_unescape+0x13a>
mov    0x2e3e(%rip),%rax
mov    (%rax),%esi
mov    $0x1b,%edi
call   1030 <putc@plt>
jmp    125a <_printf_unescape+0x13a>
mov    0x2e26(%rip),%rax
mov    (%rax),%esi
mov    $0xc,%edi
call   1030 <putc@plt>
jmp    125a <_printf_unescape+0x13a>
mov    0x2e0e(%rip),%rax
mov    (%rax),%esi
mov    $0xa,%edi
call   1030 <putc@plt>
jmp    125a <_printf_unescape+0x13a>
mov    0x2df6(%rip),%rax
mov    (%rax),%esi
mov    $0xd,%edi
call   1030 <putc@plt>
jmp    125a <_printf_unescape+0x13a>
mov    0x2dde(%rip),%rax
mov    (%rax),%esi
mov    $0x9,%edi
call   1030 <putc@plt>
jmp    125a <_printf_unescape+0x13a>
mov    0x2dc6(%rip),%rax
mov    (%rax),%esi
mov    $0xb,%edi
call   1030 <putc@plt>
jmp    125a <_printf_unescape+0x13a>
mov    0x2dc6(%rip),%rax
mov    (%rax),%ecx
mov    0x2dad(%rip),%rax
mov    %ecx,(%rax)
mov    -0x10(%rbp),%rdi
mov    $0x1,%esi
call   1040 <_printf_error@plt>
mov    %eax,-0x4(%rbp)
jmp    1261 <_printf_unescape+0x141>
mov    -0x10(%rbp),%rax
mov    (%rax),%al
mov    0x2d80(%rip),%rcx
mov    (%rcx),%esi
movsbl %al,%edi
call   1030 <putc@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_printf_unescape>:
push   %rax
movsbl (%rdi),%eax
cmp    $0x78,%eax
ja     1156 <_printf_unescape+0x36>
lea    0xed0(%rip),%rcx
movslq (%rcx,%rax,4),%rdx
add    %rcx,%rdx
jmp    *%rdx
mov    0x2ea8(%rip),%rax
mov    (%rax),%eax
mov    0x2e8f(%rip),%rcx
mov    %eax,(%rcx)
mov    $0x1,%esi
pop    %rax
jmp    1040 <_printf_error@plt>
mov    0x2e73(%rip),%rcx
mov    (%rcx),%esi
mov    %eax,%edi
jmp    11e1 <_printf_unescape+0xc1>
mov    0x2e66(%rip),%rax
mov    (%rax),%esi
mov    $0x7,%edi
jmp    11e1 <_printf_unescape+0xc1>
mov    0x2e56(%rip),%rax
mov    (%rax),%esi
mov    $0x8,%edi
jmp    11e1 <_printf_unescape+0xc1>
mov    0x2e46(%rip),%rax
mov    (%rax),%esi
mov    $0x1b,%edi
jmp    11e1 <_printf_unescape+0xc1>
mov    0x2e36(%rip),%rax
mov    (%rax),%esi
mov    $0xc,%edi
jmp    11e1 <_printf_unescape+0xc1>
mov    0x2e26(%rip),%rax
mov    (%rax),%esi
mov    $0xa,%edi
jmp    11e1 <_printf_unescape+0xc1>
mov    0x2e16(%rip),%rax
mov    (%rax),%esi
mov    $0xd,%edi
jmp    11e1 <_printf_unescape+0xc1>
mov    0x2e06(%rip),%rax
mov    (%rax),%esi
mov    $0x9,%edi
jmp    11e1 <_printf_unescape+0xc1>
mov    0x2df6(%rip),%rax
mov    (%rax),%esi
mov    $0xb,%edi
call   1030 <putc@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@stdout = global i32 0
@ENOSYS = global i32 0
@errno = global i32 0
define i32 @_printf_unescape(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
store i8* %0, i8** %3
%4 = load i8*, i8** %3
%5 = load i8, i8* %4
%6 = sext i8 %5 to i32
switch i32 %6, label %36 [
i32 0, label %7
i32 97, label %8
i32 98, label %11
i32 101, label %14
i32 102, label %17
i32 110, label %20
i32 114, label %23
i32 116, label %26
i32 118, label %29
i32 48, label %32
i32 49, label %32
i32 50, label %32
i32 51, label %32
i32 52, label %32
i32 53, label %32
i32 54, label %32
i32 55, label %32
i32 56, label %32
i32 57, label %32
i32 120, label %32
]
7: ; preds = %1
br label %41
8: ; preds = %1
%9 = load i32, i32* @stdout
%10 = call i32 @putc(i8 signext 7, i32 %9)
br label %41
11: ; preds = %1
%12 = load i32, i32* @stdout
%13 = call i32 @putc(i8 signext 8, i32 %12)
br label %41
14: ; preds = %1
%15 = load i32, i32* @stdout
%16 = call i32 @putc(i8 signext 27, i32 %15)
br label %41
17: ; preds = %1
%18 = load i32, i32* @stdout
%19 = call i32 @putc(i8 signext 12, i32 %18)
br label %41
20: ; preds = %1
%21 = load i32, i32* @stdout
%22 = call i32 @putc(i8 signext 10, i32 %21)
br label %41
23: ; preds = %1
%24 = load i32, i32* @stdout
%25 = call i32 @putc(i8 signext 13, i32 %24)
br label %41
26: ; preds = %1
%27 = load i32, i32* @stdout
%28 = call i32 @putc(i8 signext 9, i32 %27)
br label %41
29: ; preds = %1
%30 = load i32, i32* @stdout
%31 = call i32 @putc(i8 signext 11, i32 %30)
br label %41
32: ; preds = %1, %1, %1, %1, %1, %1, %1, %1, %1, %1, %1
%33 = load i32, i32* @ENOSYS
store i32 %33, i32* @errno
%34 = load i8*, i8** %3
%35 = call i32 @_printf_error(i8* %34, i32 1)
store i32 %35, i32* %2
br label %42
36: ; preds = %1
%37 = load i8*, i8** %3
%38 = load i8, i8* %37
%39 = load i32, i32* @stdout
%40 = call i32 @putc(i8 signext %38, i32 %39)
br label %41
41: ; preds = %36, %29, %26, %23, %20, %17, %14, %11, %8, %7
store i32 0, i32* %2
br label %42
42: ; preds = %41, %32
%43 = load i32, i32* %2
ret i32 %43
}

LLVM IR (-O2):
@stdout = global i32 0
@ENOSYS = global i32 0
@errno = global i32 0
define i32 @_printf_unescape(i8* %0) {
%2 = load i8, i8* %0
%3 = sext i8 %2 to i32
switch i32 %3, label %31 [
i32 0, label %34
i32 97, label %4
i32 98, label %7
i32 101, label %10
i32 102, label %13
i32 110, label %16
i32 114, label %19
i32 116, label %22
i32 118, label %25
i32 48, label %28
i32 49, label %28
i32 50, label %28
i32 51, label %28
i32 52, label %28
i32 53, label %28
i32 54, label %28
i32 55, label %28
i32 56, label %28
i32 57, label %28
i32 120, label %28
]
4: ; preds = %1
%5 = load i32, i32* @stdout
%6 = tail call i32 @putc(i8 signext 7, i32 %5)
br label %34
7: ; preds = %1
%8 = load i32, i32* @stdout
%9 = tail call i32 @putc(i8 signext 8, i32 %8)
br label %34
10: ; preds = %1
%11 = load i32, i32* @stdout
%12 = tail call i32 @putc(i8 signext 27, i32 %11)
br label %34
13: ; preds = %1
%14 = load i32, i32* @stdout
%15 = tail call i32 @putc(i8 signext 12, i32 %14)
br label %34
16: ; preds = %1
%17 = load i32, i32* @stdout
%18 = tail call i32 @putc(i8 signext 10, i32 %17)
br label %34
19: ; preds = %1
%20 = load i32, i32* @stdout
%21 = tail call i32 @putc(i8 signext 13, i32 %20)
br label %34
22: ; preds = %1
%23 = load i32, i32* @stdout
%24 = tail call i32 @putc(i8 signext 9, i32 %23)
br label %34
25: ; preds = %1
%26 = load i32, i32* @stdout
%27 = tail call i32 @putc(i8 signext 11, i32 %26)
br label %34
28: ; preds = %1, %1, %1, %1, %1, %1, %1, %1, %1, %1, %1
%29 = load i32, i32* @ENOSYS
store i32 %29, i32* @errno
%30 = tail call i32 @_printf_error(i8* %0, i32 1)
br label %34
31: ; preds = %1
%32 = load i32, i32* @stdout
%33 = tail call i32 @putc(i8 signext %2, i32 %32)
br label %34
34: ; preds = %4, %7, %10, %13, %16, %19, %22, %25, %1, %31, %28
%35 = phi i32 [ %30, %28 ], [ 0, %31 ], [ %3, %1 ], [ 0, %25 ], [ 0, %22 ], [ 0, %19 ], [ 0, %16 ], [ 0, %13 ], [ 0, %10 ], [ 0, %7 ], [ 0, %4 ]
ret i32 %35
}