#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*/ sprintf(char *, char *, int);
const char *esc_low_ascii1(char c) {
  unsigned char uc = *(unsigned char *)(void *)&c;
  static char ehex[0x20][6];
  static int initialized = 0;
  if (uc >= 0x20)
    return NULL;
  if (!initialized) {
    int i;
    for (i = 0; i < 0x20; i++)
      sprintf(ehex[i], "\\0x%02x", i);
    initialized = 1;
  }
  switch (c) {
  case 0x00:
    return "\\0";
  case 0x07:
    return "\\a";
  case 0x08:
    return "\\b";
  case 0x09:
    return "\\t";
  case 0x0a:
    return "\\n";
  case 0x0b:
    return "\\v";
  case 0x0c:
    return "\\f";
  case 0x0d:
    return "\\r";
  case 0x1b:
    return "\\e";
  default:
    return ehex[(unsigned)c];
  }
}


x86 assembly (clang, -O0):
<esc_low_ascii1>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %dil,%al
mov    %al,-0x9(%rbp)
mov    -0x9(%rbp),%al
mov    %al,-0xa(%rbp)
movzbl -0xa(%rbp),%eax
cmp    $0x20,%eax
jl     113e <esc_low_ascii1+0x2e>
movq   $0x0,-0x8(%rbp)
jmp    1266 <esc_low_ascii1+0x156>
cmpl   $0x0,0x2fbb(%rip)
jne    1195 <esc_low_ascii1+0x85>
movl   $0x0,-0x10(%rbp)
cmpl   $0x20,-0x10(%rbp)
jge    118b <esc_low_ascii1+0x7b>
movslq -0x10(%rbp),%rax
lea    0x2ed9(%rip),%rdi
imul   $0x6,%rax,%rax
add    %rax,%rdi
mov    -0x10(%rbp),%edx
lea    0xef8(%rip),%rsi
call   1030 <sprintf@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1152 <esc_low_ascii1+0x42>
movl   $0x1,0x2f6b(%rip)
movsbl -0x9(%rbp),%eax
mov    %eax,%ecx
mov    %rcx,-0x18(%rbp)
sub    $0x1b,%eax
ja     124c <esc_low_ascii1+0x13c>
mov    -0x18(%rbp),%rax
lea    0xe4d(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
lea    0xeb5(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1266 <esc_low_ascii1+0x156>
lea    0xea8(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1266 <esc_low_ascii1+0x156>
lea    0xe9b(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1266 <esc_low_ascii1+0x156>
lea    0xe8e(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1266 <esc_low_ascii1+0x156>
lea    0xe81(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1266 <esc_low_ascii1+0x156>
lea    0xe74(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1266 <esc_low_ascii1+0x156>
lea    0xe67(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1266 <esc_low_ascii1+0x156>
lea    0xe5a(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1266 <esc_low_ascii1+0x156>
lea    0xe4d(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1266 <esc_low_ascii1+0x156>
movsbl -0x9(%rbp),%eax
mov    %eax,%eax
mov    %eax,%ecx
lea    0x2de5(%rip),%rax
imul   $0x6,%rcx,%rcx
add    %rcx,%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<esc_low_ascii1>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %edi,%r14d
cmp    $0x1f,%r14b
jbe    112d <esc_low_ascii1+0x1d>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret
cmpb   $0x0,0x2fcc(%rip)
jne    1172 <esc_low_ascii1+0x62>
lea    0x2f03(%rip),%rbx
xor    %ebp,%ebp
lea    0xf2a(%rip),%r15
cs nopw 0x0(%rax,%rax,1)
mov    %rbx,%rdi
mov    %r15,%rsi
mov    %ebp,%edx
call   1030 <sprintf@plt>
add    $0x1,%rbp
add    $0x6,%rbx
cmp    $0x20,%rbp
jne    1150 <esc_low_ascii1+0x40>
movb   $0x1,0x2f8e(%rip)
movsbl %r14b,%ecx
cmp    $0x1b,%ecx
ja     119b <esc_low_ascii1+0x8b>
lea    0xef6(%rip),%rax
lea    0xe77(%rip),%rdx
movslq (%rdx,%rcx,4),%rsi
add    %rdx,%rsi
jmp    *%rsi
lea    0xee2(%rip),%rax
jmp    1122 <esc_low_ascii1+0x12>
mov    %ecx,%eax
lea    (%rax,%rax,2),%rax
lea    0x2e98(%rip),%rcx
lea    (%rcx,%rax,2),%rax
jmp    1122 <esc_low_ascii1+0x12>
lea    0xec6(%rip),%rax
jmp    1122 <esc_low_ascii1+0x12>
lea    0xebd(%rip),%rax
jmp    1122 <esc_low_ascii1+0x12>
lea    0xeb4(%rip),%rax
jmp    1122 <esc_low_ascii1+0x12>
lea    0xeab(%rip),%rax
jmp    1122 <esc_low_ascii1+0x12>
lea    0xea2(%rip),%rax
jmp    1122 <esc_low_ascii1+0x12>
lea    0xe99(%rip),%rax
jmp    1122 <esc_low_ascii1+0x12>
lea    0xe90(%rip),%rax
jmp    1122 <esc_low_ascii1+0x12>

LLVM IR (-O0):
@esc_low_ascii1.ehex = internal global [32 x [6 x i8]] zeroinitializer
@esc_low_ascii1.initialized = internal global i32 0
@.str = [8 x i8] c"\\0x%02x\00"
@.str.1 = [3 x i8] c"\\0\00"
@.str.2 = [3 x i8] c"\\a\00"
@.str.3 = [3 x i8] c"\\b\00"
@.str.4 = [3 x i8] c"\\t\00"
@.str.5 = [3 x i8] c"\\n\00"
@.str.6 = [3 x i8] c"\\v\00"
@.str.7 = [3 x i8] c"\\f\00"
@.str.8 = [3 x i8] c"\\r\00"
@.str.9 = [3 x i8] c"\\e\00"
define i8* @esc_low_ascii1(i8 signext %0) {
%2 = alloca i8*
%3 = alloca i8
%4 = alloca i8
%5 = alloca i32
store i8 %0, i8* %3
%6 = load i8, i8* %3
store i8 %6, i8* %4
%7 = load i8, i8* %4
%8 = zext i8 %7 to i32
%9 = icmp sge i32 %8, 32
br i1 %9, label %10, label %11
10: ; preds = %1
store i8* null, i8** %2
br label %47
11: ; preds = %1
%12 = load i32, i32* @esc_low_ascii1.initialized
%13 = icmp ne i32 %12, 0
br i1 %13, label %29, label %14
14: ; preds = %11
store i32 0, i32* %5
br label %15
15: ; preds = %25, %14
%16 = load i32, i32* %5
%17 = icmp slt i32 %16, 32
br i1 %17, label %18, label %28
18: ; preds = %15
%19 = load i32, i32* %5
%20 = sext i32 %19 to i64
%21 = getelementptr inbounds [32 x [6 x i8]], [32 x [6 x i8]]* @esc_low_ascii1.ehex, i64 0, i64 %20
%22 = getelementptr inbounds [6 x i8], [6 x i8]* %21, i64 0, i64 0
%23 = load i32, i32* %5
%24 = call i32 @sprintf(i8* %22, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i32 %23)
br label %25
25: ; preds = %18
%26 = load i32, i32* %5
%27 = add nsw i32 %26, 1
store i32 %27, i32* %5
br label %15
28: ; preds = %15
store i32 1, i32* @esc_low_ascii1.initialized
br label %29
29: ; preds = %28, %11
%30 = load i8, i8* %3
%31 = sext i8 %30 to i32
switch i32 %31, label %41 [
i32 0, label %32
i32 7, label %33
i32 8, label %34
i32 9, label %35
i32 10, label %36
i32 11, label %37
i32 12, label %38
i32 13, label %39
i32 27, label %40
]
32: ; preds = %29
store i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8** %2
br label %47
33: ; preds = %29
store i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8** %2
br label %47
34: ; preds = %29
store i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i8** %2
br label %47
35: ; preds = %29
store i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i8** %2
br label %47
36: ; preds = %29
store i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0), i8** %2
br label %47
37: ; preds = %29
store i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0), i8** %2
br label %47
38: ; preds = %29
store i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.7, i64 0, i64 0), i8** %2
br label %47
39: ; preds = %29
store i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.8, i64 0, i64 0), i8** %2
br label %47
40: ; preds = %29
store i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.9, i64 0, i64 0), i8** %2
br label %47
41: ; preds = %29
%42 = load i8, i8* %3
%43 = sext i8 %42 to i32
%44 = zext i32 %43 to i64
%45 = getelementptr inbounds [32 x [6 x i8]], [32 x [6 x i8]]* @esc_low_ascii1.ehex, i64 0, i64 %44
%46 = getelementptr inbounds [6 x i8], [6 x i8]* %45, i64 0, i64 0
store i8* %46, i8** %2
br label %47
47: ; preds = %41, %40, %39, %38, %37, %36, %35, %34, %33, %32, %10
%48 = load i8*, i8** %2
ret i8* %48
}

LLVM IR (-O2):
@esc_low_ascii1.ehex = internal global [32 x [6 x i8]] zeroinitializer
@esc_low_ascii1.initialized = internal unnamed_addr global i1 false
@.str = [8 x i8] c"\\0x%02x\00"
@.str.1 = [3 x i8] c"\\0\00"
@.str.2 = [3 x i8] c"\\a\00"
@.str.3 = [3 x i8] c"\\b\00"
@.str.4 = [3 x i8] c"\\t\00"
@.str.5 = [3 x i8] c"\\n\00"
@.str.6 = [3 x i8] c"\\v\00"
@.str.7 = [3 x i8] c"\\f\00"
@.str.8 = [3 x i8] c"\\r\00"
@.str.9 = [3 x i8] c"\\e\00"
define i8* @esc_low_ascii1(i8 signext %0) {
%2 = icmp ugt i8 %0, 31
br i1 %2, label %26, label %3
3: ; preds = %1
%4 = load i1, i1* @esc_low_ascii1.initialized
br i1 %4, label %13, label %5
5: ; preds = %3, %5
%6 = phi i64 [ %10, %5 ], [ 0, %3 ]
%7 = getelementptr inbounds [32 x [6 x i8]], [32 x [6 x i8]]* @esc_low_ascii1.ehex, i64 0, i64 %6, i64 0
%8 = trunc i64 %6 to i32
%9 = tail call i32 @sprintf(i8* %7, i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i32 %8)
%10 = add nuw nsw i64 %6, 1
%11 = icmp eq i64 %10, 32
br i1 %11, label %12, label %5
12: ; preds = %5
store i1 true, i1* @esc_low_ascii1.initialized
br label %13
13: ; preds = %12, %3
%14 = sext i8 %0 to i32
switch i32 %14, label %23 [
i32 0, label %26
i32 7, label %15
i32 8, label %16
i32 9, label %17
i32 10, label %18
i32 11, label %19
i32 12, label %20
i32 13, label %21
i32 27, label %22
]
15: ; preds = %13
br label %26
16: ; preds = %13
br label %26
17: ; preds = %13
br label %26
18: ; preds = %13
br label %26
19: ; preds = %13
br label %26
20: ; preds = %13
br label %26
21: ; preds = %13
br label %26
22: ; preds = %13
br label %26
23: ; preds = %13
%24 = zext i32 %14 to i64
%25 = getelementptr inbounds [32 x [6 x i8]], [32 x [6 x i8]]* @esc_low_ascii1.ehex, i64 0, i64 %24, i64 0
br label %26
26: ; preds = %13, %1, %23, %22, %21, %20, %19, %18, %17, %16, %15
%27 = phi i8* [ %25, %23 ], [ getelementptr inbounds ([3 x i8], [3 x i8]* @.str.9, i64 0, i64 0), %22 ], [ getelementptr inbounds ([3 x i8], [3 x i8]* @.str.8, i64 0, i64 0), %21 ], [ getelementptr inbounds ([3 x i8], [3 x i8]* @.str.7, i64 0, i64 0), %20 ], [ getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0), %19 ], [ getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0), %18 ], [ getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), %17 ], [ getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), %16 ], [ getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), %15 ], [ null, %1 ], [ getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), %13 ]
ret i8* %27
}