#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);
scalar_t__ strlen(char *);
char *cname(unsigned char c) {
  static char *cnametab[256] = {
      "<NUL>", "<SOH>", "<STX>", "<ETX>",  "<EOT>", "<ENQ>", "<ACK>", "<BEL>",
      "<BS>",  "<HT>",  "<LF>",  "<VT>",   "<FF>",  "<CR>",  "<SO>",  "<SI>",
      "<DLE>", "<XON>", "<DC2>", "<XOFF>", "<DC4>", "<NAK>", "<SYN>", "<ETB>",
      "<CAN>", "<EM>",  "<SUB>", "<ESC>",  "<FS>",  "<GS>",  "<RS>",  "<US>"};
  static char names[(127 - 32) * 2 + 129 * (6 + 1)];
  char *p = names;
  static int i = 0;
  if (!i) {
    for (i = 32; i < 256; i++) {
      cnametab[i] = p;
      sprintf(p, i < 127 ? "%c" : "<0x%02x>", i);
      p += strlen(p) + 1;
    }
  }
  return cnametab[c];
}


x86 assembly (clang, -O0):
<cname>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dil,%al
mov    %al,-0x1(%rbp)
lea    0x371b(%rip),%rax
mov    %rax,-0x10(%rbp)
cmpl   $0x0,0x3b58(%rip)
jne    11ce <cname+0xae>
movl   $0x20,0x3b48(%rip)
cmpl   $0x100,0x3b3e(%rip)
jge    11c9 <cname+0xa9>
mov    -0x10(%rbp),%rdx
movslq 0x3b2d(%rip),%rcx
lea    0x2ece(%rip),%rax
mov    %rdx,(%rax,%rcx,8)
mov    -0x10(%rbp),%rdi
mov    0x3b18(%rip),%ecx
lea    0xf30(%rip),%rsi
lea    0xf26(%rip),%rax
cmp    $0x7f,%ecx
cmovl  %rax,%rsi
mov    0x3afd(%rip),%edx
call   1040 <sprintf@plt>
mov    -0x10(%rbp),%rdi
call   1030 <strlen@plt>
add    $0x1,%rax
add    -0x10(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    0x3add(%rip),%eax
add    $0x1,%eax
mov    %eax,0x3ad4(%rip)
jmp    1150 <cname+0x30>
jmp    11ce <cname+0xae>
movzbl -0x1(%rbp),%eax
mov    %eax,%ecx
lea    0x2e65(%rip),%rax
mov    (%rax,%rcx,8),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cname>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %edi,%r14d
cmpl   $0x0,0x3b66(%rip)
jne    119f <cname+0x7f>
movl   $0x20,0x3b5a(%rip)
mov    $0x20,%eax
lea    0x3706(%rip),%rbx
lea    0x2eef(%rip),%r15
lea    0xf5c(%rip),%r12
lea    0xf58(%rip),%rbp
nop
movslq %eax,%rdx
mov    %rbx,(%r15,%rdx,8)
cmp    $0x7f,%edx
mov    %rbp,%rsi
cmovl  %r12,%rsi
mov    %rbx,%rdi
call   1040 <sprintf@plt>
mov    %rbx,%rdi
call   1030 <strlen@plt>
add    %rax,%rbx
add    $0x1,%rbx
mov    0x3b0a(%rip),%ecx
lea    0x1(%rcx),%eax
mov    %eax,0x3b01(%rip)
cmp    $0xff,%ecx
jl     1160 <cname+0x40>
movzbl %r14b,%eax
lea    0x2e96(%rip),%rcx
mov    (%rcx,%rax,8),%rax
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@cname.cnametab = internal global <{ [32 x i8*], [224 x i8*] }> <{ [32 x i8*] [i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i32 0, i32 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i32 0, i32 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i32 0, i32 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i32 0, i32 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i32 0, i32 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i32 0, i32 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.6, i32 0, i32 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.7, i32 0, i32 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.8, i32 0, i32 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.9, i32 0, i32 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.10, i32 0, i32 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.11, i32 0, i32 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.12, i32 0, i32 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.13, i32 0, i32 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.14, i32 0, i32 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.15, i32 0, i32 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.16, i32 0, i32 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.17, i32 0, i32 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.18, i32 0, i32 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.19, i32 0, i32 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.20, i32 0, i32 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.21, i32 0, i32 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.22, i32 0, i32 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.23, i32 0, i32 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.24, i32 0, i32 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.25, i32 0, i32 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.26, i32 0, i32 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.27, i32 0, i32 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.28, i32 0, i32 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.29, i32 0, i32 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.30, i32 0, i32 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.31, i32 0, i32 0)], [224 x i8*] zeroinitializer }>
@.str = [6 x i8] c"<NUL>\00"
@.str.1 = [6 x i8] c"<SOH>\00"
@.str.2 = [6 x i8] c"<STX>\00"
@.str.3 = [6 x i8] c"<ETX>\00"
@.str.4 = [6 x i8] c"<EOT>\00"
@.str.5 = [6 x i8] c"<ENQ>\00"
@.str.6 = [6 x i8] c"<ACK>\00"
@.str.7 = [6 x i8] c"<BEL>\00"
@.str.8 = [5 x i8] c"<BS>\00"
@.str.9 = [5 x i8] c"<HT>\00"
@.str.10 = [5 x i8] c"<LF>\00"
@.str.11 = [5 x i8] c"<VT>\00"
@.str.12 = [5 x i8] c"<FF>\00"
@.str.13 = [5 x i8] c"<CR>\00"
@.str.14 = [5 x i8] c"<SO>\00"
@.str.15 = [5 x i8] c"<SI>\00"
@.str.16 = [6 x i8] c"<DLE>\00"
@.str.17 = [6 x i8] c"<XON>\00"
@.str.18 = [6 x i8] c"<DC2>\00"
@.str.19 = [7 x i8] c"<XOFF>\00"
@.str.20 = [6 x i8] c"<DC4>\00"
@.str.21 = [6 x i8] c"<NAK>\00"
@.str.22 = [6 x i8] c"<SYN>\00"
@.str.23 = [6 x i8] c"<ETB>\00"
@.str.24 = [6 x i8] c"<CAN>\00"
@.str.25 = [5 x i8] c"<EM>\00"
@.str.26 = [6 x i8] c"<SUB>\00"
@.str.27 = [6 x i8] c"<ESC>\00"
@.str.28 = [5 x i8] c"<FS>\00"
@.str.29 = [5 x i8] c"<GS>\00"
@.str.30 = [5 x i8] c"<RS>\00"
@.str.31 = [5 x i8] c"<US>\00"
@cname.names = internal global [1093 x i8] zeroinitializer
@cname.i = internal global i32 0
@.str.32 = [3 x i8] c"%c\00"
@.str.33 = [9 x i8] c"<0x%02x>\00"
define i8* @cname(i8 zeroext %0) {
%2 = alloca i8
%3 = alloca i8*
store i8 %0, i8* %2
store i8* getelementptr inbounds ([1093 x i8], [1093 x i8]* @cname.names, i64 0, i64 0), i8** %3
%4 = load i32, i32* @cname.i
%5 = icmp ne i32 %4, 0
br i1 %5, label %31, label %6
6: ; preds = %1
store i32 32, i32* @cname.i
br label %7
7: ; preds = %27, %6
%8 = load i32, i32* @cname.i
%9 = icmp slt i32 %8, 256
br i1 %9, label %10, label %30
10: ; preds = %7
%11 = load i8*, i8** %3
%12 = load i32, i32* @cname.i
%13 = sext i32 %12 to i64
%14 = getelementptr inbounds [256 x i8*], [256 x i8*]* bitcast (<{ [32 x i8*], [224 x i8*] }>* @cname.cnametab to [256 x i8*]*), i64 0, i64 %13
store i8* %11, i8** %14
%15 = load i8*, i8** %3
%16 = load i32, i32* @cname.i
%17 = icmp slt i32 %16, 127
%18 = zext i1 %17 to i64
%19 = select i1 %17, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.32, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.33, i64 0, i64 0)
%20 = load i32, i32* @cname.i
%21 = call i32 @sprintf(i8* %15, i8* %19, i32 %20)
%22 = load i8*, i8** %3
%23 = call i64 @strlen(i8* %22)
%24 = add nsw i64 %23, 1
%25 = load i8*, i8** %3
%26 = getelementptr inbounds i8, i8* %25, i64 %24
store i8* %26, i8** %3
br label %27
27: ; preds = %10
%28 = load i32, i32* @cname.i
%29 = add nsw i32 %28, 1
store i32 %29, i32* @cname.i
br label %7
30: ; preds = %7
br label %31
31: ; preds = %30, %1
%32 = load i8, i8* %2
%33 = zext i8 %32 to i64
%34 = getelementptr inbounds [256 x i8*], [256 x i8*]* bitcast (<{ [32 x i8*], [224 x i8*] }>* @cname.cnametab to [256 x i8*]*), i64 0, i64 %33
%35 = load i8*, i8** %34
ret i8* %35
}

LLVM IR (-O2):
@cname.cnametab = internal unnamed_addr global <{ [32 x i8*], [224 x i8*] }> <{ [32 x i8*] [i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i32 0, i32 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i32 0, i32 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i32 0, i32 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i32 0, i32 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i32 0, i32 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i32 0, i32 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.6, i32 0, i32 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.7, i32 0, i32 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.8, i32 0, i32 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.9, i32 0, i32 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.10, i32 0, i32 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.11, i32 0, i32 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.12, i32 0, i32 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.13, i32 0, i32 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.14, i32 0, i32 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.15, i32 0, i32 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.16, i32 0, i32 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.17, i32 0, i32 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.18, i32 0, i32 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.19, i32 0, i32 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.20, i32 0, i32 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.21, i32 0, i32 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.22, i32 0, i32 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.23, i32 0, i32 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.24, i32 0, i32 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.25, i32 0, i32 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.26, i32 0, i32 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.27, i32 0, i32 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.28, i32 0, i32 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.29, i32 0, i32 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.30, i32 0, i32 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.31, i32 0, i32 0)], [224 x i8*] zeroinitializer }>
@.str = [6 x i8] c"<NUL>\00"
@.str.1 = [6 x i8] c"<SOH>\00"
@.str.2 = [6 x i8] c"<STX>\00"
@.str.3 = [6 x i8] c"<ETX>\00"
@.str.4 = [6 x i8] c"<EOT>\00"
@.str.5 = [6 x i8] c"<ENQ>\00"
@.str.6 = [6 x i8] c"<ACK>\00"
@.str.7 = [6 x i8] c"<BEL>\00"
@.str.8 = [5 x i8] c"<BS>\00"
@.str.9 = [5 x i8] c"<HT>\00"
@.str.10 = [5 x i8] c"<LF>\00"
@.str.11 = [5 x i8] c"<VT>\00"
@.str.12 = [5 x i8] c"<FF>\00"
@.str.13 = [5 x i8] c"<CR>\00"
@.str.14 = [5 x i8] c"<SO>\00"
@.str.15 = [5 x i8] c"<SI>\00"
@.str.16 = [6 x i8] c"<DLE>\00"
@.str.17 = [6 x i8] c"<XON>\00"
@.str.18 = [6 x i8] c"<DC2>\00"
@.str.19 = [7 x i8] c"<XOFF>\00"
@.str.20 = [6 x i8] c"<DC4>\00"
@.str.21 = [6 x i8] c"<NAK>\00"
@.str.22 = [6 x i8] c"<SYN>\00"
@.str.23 = [6 x i8] c"<ETB>\00"
@.str.24 = [6 x i8] c"<CAN>\00"
@.str.25 = [5 x i8] c"<EM>\00"
@.str.26 = [6 x i8] c"<SUB>\00"
@.str.27 = [6 x i8] c"<ESC>\00"
@.str.28 = [5 x i8] c"<FS>\00"
@.str.29 = [5 x i8] c"<GS>\00"
@.str.30 = [5 x i8] c"<RS>\00"
@.str.31 = [5 x i8] c"<US>\00"
@cname.names = internal global [1093 x i8] zeroinitializer
@cname.i = internal unnamed_addr global i32 0
@.str.32 = [3 x i8] c"%c\00"
@.str.33 = [9 x i8] c"<0x%02x>\00"
define i8* @cname(i8 zeroext %0) {
%2 = load i32, i32* @cname.i
%3 = icmp eq i32 %2, 0
br i1 %3, label %4, label %19
4: ; preds = %1
store i32 32, i32* @cname.i
br label %5
5: ; preds = %4, %5
%6 = phi i8* [ getelementptr inbounds ([1093 x i8], [1093 x i8]* @cname.names, i64 0, i64 0), %4 ], [ %15, %5 ]
%7 = phi i32 [ 32, %4 ], [ %17, %5 ]
%8 = sext i32 %7 to i64
%9 = getelementptr inbounds [256 x i8*], [256 x i8*]* bitcast (<{ [32 x i8*], [224 x i8*] }>* @cname.cnametab to [256 x i8*]*), i64 0, i64 %8
store i8* %6, i8** %9
%10 = icmp slt i32 %7, 127
%11 = select i1 %10, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.32, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.33, i64 0, i64 0)
%12 = tail call i32 @sprintf(i8* dereferenceable(1) %6, i8* dereferenceable(1) %11, i32 %7)
%13 = tail call i64 @strlen(i8* dereferenceable(1) %6)
%14 = add nsw i64 %13, 1
%15 = getelementptr inbounds i8, i8* %6, i64 %14
%16 = load i32, i32* @cname.i
%17 = add nsw i32 %16, 1
store i32 %17, i32* @cname.i
%18 = icmp slt i32 %16, 255
br i1 %18, label %5, label %19
19: ; preds = %5, %1
%20 = zext i8 %0 to i64
%21 = getelementptr inbounds [256 x i8*], [256 x i8*]* bitcast (<{ [32 x i8*], [224 x i8*] }>* @cname.cnametab to [256 x i8*]*), i64 0, i64 %20
%22 = load i8*, i8** %21
ret i8* %22
}