#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 */
scalar_t__ isprint(char const);
char const *stringchar(char const *ptr) {
  static char buf[8];
  switch (*ptr) {
  case '\a':
    return "\\a";
  case '\r':
    return "\\r";
  case '\b':
    return "\\b";
  case '\t':
    return "\\t";
  case '\f':
    return "\\f";
  case '\v':
    return "\\v";
  case '\n':
    return "\\n";
  case '\\':
    return "\\\\";
  case '"':
    return "\\\"";
  }
  if (!*ptr && !(ptr[1] >= '0' && ptr[1] <= '7'))
    return "\\0";
  else if (isprint(*ptr) || *ptr == ' ') {
    buf[0] = *ptr;
    buf[1] = '\0';
  } else {
    buf[0] = '\\';
    buf[1] = '0' + ((unsigned char)*ptr / 64);
    buf[2] = '0' + (((unsigned char)*ptr / 8) % 8);
    buf[3] = '0' + ((unsigned char)*ptr % 8);
    buf[4] = '\0';
  }
  return buf;
}


x86 assembly (clang, -O0):
<stringchar>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
add    $0xfffffff9,%eax
mov    %eax,%ecx
mov    %rcx,-0x18(%rbp)
sub    $0x55,%eax
ja     11d9 <stringchar+0xc9>
mov    -0x18(%rbp),%rax
lea    0xec0(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
lea    0x1008(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    12c8 <stringchar+0x1b8>
lea    0xffb(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    12c8 <stringchar+0x1b8>
lea    0xfee(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    12c8 <stringchar+0x1b8>
lea    0xfe1(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    12c8 <stringchar+0x1b8>
lea    0xfd4(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    12c8 <stringchar+0x1b8>
lea    0xfc7(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    12c8 <stringchar+0x1b8>
lea    0xfba(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    12c8 <stringchar+0x1b8>
lea    0xfad(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    12c8 <stringchar+0x1b8>
lea    0xfa0(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    12c8 <stringchar+0x1b8>
mov    -0x10(%rbp),%rax
cmpb   $0x0,(%rax)
jne    1218 <stringchar+0x108>
mov    -0x10(%rbp),%rax
movsbl 0x1(%rax),%eax
cmp    $0x30,%eax
jl     1208 <stringchar+0xf8>
mov    -0x10(%rbp),%rax
movsbl 0x1(%rax),%eax
cmp    $0x37,%eax
jle    1218 <stringchar+0x108>
lea    0xf64(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    12c8 <stringchar+0x1b8>
mov    -0x10(%rbp),%rax
movsbl (%rax),%edi
call   1030 <isprint@plt>
cmp    $0x0,%rax
jne    123e <stringchar+0x12e>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x20,%eax
jne    1256 <stringchar+0x146>
mov    -0x10(%rbp),%rax
mov    (%rax),%al
mov    %al,0x2ddf(%rip)
movb   $0x0,0x2dd9(%rip)
jmp    12b8 <stringchar+0x1a8>
movb   $0x5c,0x2dcc(%rip)
mov    -0x10(%rbp),%rax
movzbl (%rax),%eax
mov    $0x40,%ecx
cltd
idiv   %ecx
add    $0x30,%eax
mov    %al,0x2db5(%rip)
mov    -0x10(%rbp),%rax
movzbl (%rax),%eax
mov    $0x8,%ecx
cltd
idiv   %ecx
mov    $0x8,%ecx
cltd
idiv   %ecx
add    $0x30,%edx
mov    %dl,%al
mov    %al,0x2d94(%rip)
mov    -0x10(%rbp),%rax
movzbl (%rax),%eax
mov    $0x8,%ecx
cltd
idiv   %ecx
add    $0x30,%edx
mov    %dl,%al
mov    %al,0x2d7b(%rip)
movb   $0x0,0x2d75(%rip)
jmp    12bd <stringchar+0x1ad>
lea    0x2d65(%rip),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<stringchar>:
push   %rbx
mov    %rdi,%rbx
movsbl (%rdi),%ecx
lea    -0x7(%rcx),%edx
cmp    $0x55,%edx
ja     116e <stringchar+0x5e>
lea    0x1032(%rip),%rax
lea    0xed3(%rip),%rsi
movslq (%rsi,%rdx,4),%rdx
add    %rsi,%rdx
jmp    *%rdx
pop    %rbx
ret
lea    0x101f(%rip),%rax
pop    %rbx
ret
lea    0x1019(%rip),%rax
pop    %rbx
ret
lea    0x1019(%rip),%rax
pop    %rbx
ret
lea    0x100d(%rip),%rax
pop    %rbx
ret
lea    0x1001(%rip),%rax
pop    %rbx
ret
lea    0xfef(%rip),%rax
pop    %rbx
ret
test   %cl,%cl
jne    117b <stringchar+0x6b>
mov    0x1(%rbx),%al
and    $0xf8,%al
cmp    $0x30,%al
jne    11b9 <stringchar+0xa9>
movsbl %cl,%edi
call   1030 <isprint@plt>
mov    (%rbx),%cl
test   %rax,%rax
jne    1191 <stringchar+0x81>
cmp    $0x20,%cl
mov    $0x20,%cl
jne    11c2 <stringchar+0xb2>
mov    %cl,0x2e92(%rip)
lea    0x2e8b(%rip),%rax
movb   $0x0,0x2e85(%rip)
pop    %rbx
ret
lea    0xfc2(%rip),%rax
pop    %rbx
ret
lea    0xfb6(%rip),%rax
pop    %rbx
ret
lea    0xfb3(%rip),%rax
pop    %rbx
ret
movb   $0x5c,0x2e60(%rip)
lea    0x2e59(%rip),%rax
mov    (%rbx),%cl
shr    $0x6,%cl
or     $0x30,%cl
mov    %cl,0x2e4c(%rip)
mov    (%rbx),%cl
shr    $0x3,%cl
and    $0x7,%cl
or     $0x30,%cl
mov    %cl,0x2e3c(%rip)
mov    (%rbx),%cl
and    $0x7,%cl
or     $0x30,%cl
mov    %cl,0x2e2f(%rip)
movb   $0x0,0x2e29(%rip)
pop    %rbx
ret

LLVM IR (-O0):
@stringchar.buf = internal global [8 x i8] zeroinitializer
@.str = [3 x i8] c"\\a\00"
@.str.1 = [3 x i8] c"\\r\00"
@.str.2 = [3 x i8] c"\\b\00"
@.str.3 = [3 x i8] c"\\t\00"
@.str.4 = [3 x i8] c"\\f\00"
@.str.5 = [3 x i8] c"\\v\00"
@.str.6 = [3 x i8] c"\\n\00"
@.str.7 = [3 x i8] c"\\\\\00"
@.str.8 = [3 x i8] c"\\\22\00"
@.str.9 = [3 x i8] c"\\0\00"
define i8* @stringchar(i8* %0) {
%2 = alloca i8*
%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 %16 [
i32 7, label %7
i32 13, label %8
i32 8, label %9
i32 9, label %10
i32 12, label %11
i32 11, label %12
i32 10, label %13
i32 92, label %14
i32 34, label %15
]
7: ; preds = %1
store i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8** %2
br label %68
8: ; preds = %1
store i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8** %2
br label %68
9: ; preds = %1
store i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8** %2
br label %68
10: ; preds = %1
store i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i8** %2
br label %68
11: ; preds = %1
store i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i8** %2
br label %68
12: ; preds = %1
store i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0), i8** %2
br label %68
13: ; preds = %1
store i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0), i8** %2
br label %68
14: ; preds = %1
store i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.7, i64 0, i64 0), i8** %2
br label %68
15: ; preds = %1
store i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.8, i64 0, i64 0), i8** %2
br label %68
16: ; preds = %1
%17 = load i8*, i8** %3
%18 = load i8, i8* %17
%19 = icmp ne i8 %18, 0
br i1 %19, label %33, label %20
20: ; preds = %16
%21 = load i8*, i8** %3
%22 = getelementptr inbounds i8, i8* %21, i64 1
%23 = load i8, i8* %22
%24 = sext i8 %23 to i32
%25 = icmp sge i32 %24, 48
br i1 %25, label %26, label %32
26: ; preds = %20
%27 = load i8*, i8** %3
%28 = getelementptr inbounds i8, i8* %27, i64 1
%29 = load i8, i8* %28
%30 = sext i8 %29 to i32
%31 = icmp sle i32 %30, 55
br i1 %31, label %33, label %32
32: ; preds = %26, %20
store i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.9, i64 0, i64 0), i8** %2
br label %68
33: ; preds = %26, %16
%34 = load i8*, i8** %3
%35 = load i8, i8* %34
%36 = call i64 @isprint(i8 signext %35)
%37 = icmp ne i64 %36, 0
br i1 %37, label %43, label %38
38: ; preds = %33
%39 = load i8*, i8** %3
%40 = load i8, i8* %39
%41 = sext i8 %40 to i32
%42 = icmp eq i32 %41, 32
br i1 %42, label %43, label %46
43: ; preds = %38, %33
%44 = load i8*, i8** %3
%45 = load i8, i8* %44
store i8 %45, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @stringchar.buf, i64 0, i64 0)
store i8 0, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @stringchar.buf, i64 0, i64 1)
br label %66
46: ; preds = %38
store i8 92, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @stringchar.buf, i64 0, i64 0)
%47 = load i8*, i8** %3
%48 = load i8, i8* %47
%49 = zext i8 %48 to i32
%50 = sdiv i32 %49, 64
%51 = add nsw i32 48, %50
%52 = trunc i32 %51 to i8
store i8 %52, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @stringchar.buf, i64 0, i64 1)
%53 = load i8*, i8** %3
%54 = load i8, i8* %53
%55 = zext i8 %54 to i32
%56 = sdiv i32 %55, 8
%57 = srem i32 %56, 8
%58 = add nsw i32 48, %57
%59 = trunc i32 %58 to i8
store i8 %59, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @stringchar.buf, i64 0, i64 2)
%60 = load i8*, i8** %3
%61 = load i8, i8* %60
%62 = zext i8 %61 to i32
%63 = srem i32 %62, 8
%64 = add nsw i32 48, %63
%65 = trunc i32 %64 to i8
store i8 %65, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @stringchar.buf, i64 0, i64 3)
store i8 0, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @stringchar.buf, i64 0, i64 4)
br label %66
66: ; preds = %46, %43
br label %67
67: ; preds = %66
store i8* getelementptr inbounds ([8 x i8], [8 x i8]* @stringchar.buf, i64 0, i64 0), i8** %2
br label %68
68: ; preds = %67, %32, %15, %14, %13, %12, %11, %10, %9, %8, %7
%69 = load i8*, i8** %2
ret i8* %69
}

LLVM IR (-O2):
@stringchar.buf = internal global [8 x i8] zeroinitializer
@.str = [3 x i8] c"\\a\00"
@.str.1 = [3 x i8] c"\\r\00"
@.str.2 = [3 x i8] c"\\b\00"
@.str.3 = [3 x i8] c"\\t\00"
@.str.4 = [3 x i8] c"\\f\00"
@.str.5 = [3 x i8] c"\\v\00"
@.str.6 = [3 x i8] c"\\n\00"
@.str.7 = [3 x i8] c"\\\\\00"
@.str.8 = [3 x i8] c"\\\22\00"
@.str.9 = [3 x i8] c"\\0\00"
define i8* @stringchar(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = sext i8 %2 to i32
switch i32 %3, label %12 [
i32 7, label %38
i32 13, label %4
i32 8, label %5
i32 9, label %6
i32 12, label %7
i32 11, label %8
i32 10, label %9
i32 92, label %10
i32 34, label %11
]
4: ; preds = %1
br label %38
5: ; preds = %1
br label %38
6: ; preds = %1
br label %38
7: ; preds = %1
br label %38
8: ; preds = %1
br label %38
9: ; preds = %1
br label %38
10: ; preds = %1
br label %38
11: ; preds = %1
br label %38
12: ; preds = %1
%13 = icmp eq i8 %2, 0
br i1 %13, label %14, label %19
14: ; preds = %12
%15 = getelementptr inbounds i8, i8* %0, i64 1
%16 = load i8, i8* %15
%17 = and i8 %16, -8
%18 = icmp eq i8 %17, 48
br i1 %18, label %19, label %38
19: ; preds = %14, %12
%20 = tail call i64 @isprint(i8 signext %2)
%21 = icmp eq i64 %20, 0
%22 = load i8, i8* %0
br i1 %21, label %23, label %25
23: ; preds = %19
%24 = icmp eq i8 %22, 32
br i1 %24, label %25, label %27
25: ; preds = %19, %23
%26 = phi i8 [ 32, %23 ], [ %22, %19 ]
store i8 %26, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @stringchar.buf, i64 0, i64 0)
store i8 0, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @stringchar.buf, i64 0, i64 1)
br label %38
27: ; preds = %23
store i8 92, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @stringchar.buf, i64 0, i64 0)
%28 = load i8, i8* %0
%29 = lshr i8 %28, 6
%30 = or i8 %29, 48
store i8 %30, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @stringchar.buf, i64 0, i64 1)
%31 = load i8, i8* %0
%32 = lshr i8 %31, 3
%33 = and i8 %32, 7
%34 = or i8 %33, 48
store i8 %34, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @stringchar.buf, i64 0, i64 2)
%35 = load i8, i8* %0
%36 = and i8 %35, 7
%37 = or i8 %36, 48
store i8 %37, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @stringchar.buf, i64 0, i64 3)
store i8 0, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @stringchar.buf, i64 0, i64 4)
br label %38
38: ; preds = %27, %25, %14, %1, %11, %10, %9, %8, %7, %6, %5, %4
%39 = phi i8* [ getelementptr inbounds ([3 x i8], [3 x i8]* @.str.8, i64 0, i64 0), %11 ], [ getelementptr inbounds ([3 x i8], [3 x i8]* @.str.7, i64 0, i64 0), %10 ], [ getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0), %9 ], [ getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0), %8 ], [ getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), %7 ], [ getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), %6 ], [ getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), %5 ], [ getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), %4 ], [ getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), %1 ], [ getelementptr inbounds ([3 x i8], [3 x i8]* @.str.9, i64 0, i64 0), %14 ], [ getelementptr inbounds ([8 x i8], [8 x i8]* @stringchar.buf, i64 0, i64 0), %25 ], [ getelementptr inbounds ([8 x i8], [8 x i8]* @stringchar.buf, i64 0, i64 0), %27 ]
ret i8* %39
}