char *cdesc(i)
int i;
{
  static char xbuf[16];
  if (i == ' ')
    return "SPC";
  else if ((1 && isprint((unsigned char)i))) {
    xbuf[0] = i;
    xbuf[1] = '\0';
    return (xbuf);
  } else if (i == '\001')
    return "CTLESC";
  else if (i == '\177')
    return "CTLNUL";
  else if (i == '\033')
    return "ESC";
  xbuf[0] = '\\';
  xbuf[2] = '\0';
  switch (i) {
  case '\a':
    xbuf[1] = 'a';
    break;
  case '\v':
    xbuf[1] = 'v';
    break;
  case '\b':
    xbuf[1] = 'b';
    break;
  case '\f':
    xbuf[1] = 'f';
    break;
  case '\n':
    xbuf[1] = 'n';
    break;
  case '\r':
    xbuf[1] = 'r';
    break;
  case '\t':
    xbuf[1] = 't';
    break;
  default:
    sprintf(xbuf, "%d", i);
    break;
  }
  return xbuf;
}


x86 assembly (clang, -O0):
<cdesc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0xc(%rbp)
cmpl   $0x20,-0xc(%rbp)
jne    1145 <cdesc+0x25>
lea    0xee0(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1289 <cdesc+0x169>
mov    -0xc(%rbp),%eax
movzbl %al,%edi
call   1030 <isprint@plt>
cmp    $0x0,%eax
je     1179 <cdesc+0x59>
mov    -0xc(%rbp),%eax
mov    %al,0x2ede(%rip)
movb   $0x0,0x2ed8(%rip)
lea    0x2ed0(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1289 <cdesc+0x169>
cmpl   $0x1,-0xc(%rbp)
jne    1193 <cdesc+0x73>
lea    0xe96(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1289 <cdesc+0x169>
cmpl   $0x7f,-0xc(%rbp)
jne    11ad <cdesc+0x8d>
lea    0xe83(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1289 <cdesc+0x169>
cmpl   $0x1b,-0xc(%rbp)
jne    11c7 <cdesc+0xa7>
lea    0xe65(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1289 <cdesc+0x169>
jmp    11cc <cdesc+0xac>
jmp    11d1 <cdesc+0xb1>
jmp    11d6 <cdesc+0xb6>
jmp    11db <cdesc+0xbb>
movb   $0x5c,0x2e5e(%rip)
movb   $0x0,0x2e59(%rip)
mov    -0xc(%rbp),%eax
add    $0xfffffff9,%eax
mov    %eax,%ecx
mov    %rcx,-0x18(%rbp)
sub    $0x6,%eax
ja     1266 <cdesc+0x146>
mov    -0x18(%rbp),%rax
lea    0xdf7(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
movb   $0x61,0x2e28(%rip)
jmp    127e <cdesc+0x15e>
movb   $0x76,0x2e1c(%rip)
jmp    127e <cdesc+0x15e>
movb   $0x62,0x2e10(%rip)
jmp    127e <cdesc+0x15e>
movb   $0x66,0x2e04(%rip)
jmp    127e <cdesc+0x15e>
movb   $0x6e,0x2df8(%rip)
jmp    127e <cdesc+0x15e>
movb   $0x72,0x2dec(%rip)
jmp    127e <cdesc+0x15e>
movb   $0x74,0x2de0(%rip)
jmp    127e <cdesc+0x15e>
mov    -0xc(%rbp),%edx
lea    0x2dd0(%rip),%rdi
lea    0xdb7(%rip),%rsi
mov    $0x0,%al
call   1040 <sprintf@plt>
lea    0x2dbb(%rip),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cdesc>:
push   %r14
push   %rbx
push   %rax
cmp    $0x20,%edi
jne    1132 <cdesc+0x12>
lea    0xeec(%rip),%r14
jmp    1154 <cdesc+0x34>
mov    %edi,%ebx
movzbl %bl,%edi
call   1030 <isprint@plt>
test   %eax,%eax
je     115f <cdesc+0x3f>
mov    %bl,0x2efa(%rip)
lea    0x2ef3(%rip),%r14
movb   $0x0,0x2eed(%rip)
mov    %r14,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret
cmp    $0x1,%ebx
je     1177 <cdesc+0x57>
cmp    $0x1b,%ebx
je     1180 <cdesc+0x60>
cmp    $0x7f,%ebx
jne    1189 <cdesc+0x69>
lea    0xeb2(%rip),%r14
jmp    1154 <cdesc+0x34>
lea    0xea2(%rip),%r14
jmp    1154 <cdesc+0x34>
lea    0xe9c(%rip),%r14
jmp    1154 <cdesc+0x34>
movb   $0x5c,0x2eb0(%rip)
movb   $0x0,0x2eab(%rip)
lea    -0x7(%rbx),%eax
cmp    $0x6,%eax
ja     11bf <cdesc+0x9f>
lea    0xe5a(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
movb   $0x61,0x2e8b(%rip)
lea    0x2e83(%rip),%r14
jmp    1154 <cdesc+0x34>
lea    0x2e7a(%rip),%r14
lea    0xe61(%rip),%rsi
mov    %r14,%rdi
mov    %ebx,%edx
xor    %eax,%eax
call   1040 <sprintf@plt>
jmp    1154 <cdesc+0x34>
movb   $0x62,0x2e5c(%rip)
lea    0x2e54(%rip),%r14
jmp    1154 <cdesc+0x34>
movb   $0x74,0x2e49(%rip)
lea    0x2e41(%rip),%r14
jmp    1154 <cdesc+0x34>
movb   $0x6e,0x2e36(%rip)
lea    0x2e2e(%rip),%r14
jmp    1154 <cdesc+0x34>
movb   $0x76,0x2e23(%rip)
lea    0x2e1b(%rip),%r14
jmp    1154 <cdesc+0x34>
movb   $0x66,0x2e10(%rip)
lea    0x2e08(%rip),%r14
jmp    1154 <cdesc+0x34>
movb   $0x72,0x2dfd(%rip)
lea    0x2df5(%rip),%r14
jmp    1154 <cdesc+0x34>

LLVM IR (-O0):
@cdesc.xbuf = internal global [16 x i8] zeroinitializer
@.str = [4 x i8] c"SPC\00"
@.str.1 = [7 x i8] c"CTLESC\00"
@.str.2 = [7 x i8] c"CTLNUL\00"
@.str.3 = [4 x i8] c"ESC\00"
@.str.4 = [3 x i8] c"%d\00"
define i8* @cdesc(i32 %0) {
%2 = alloca i8*
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
%5 = icmp eq i32 %4, 32
br i1 %5, label %6, label %7
6: ; preds = %1
store i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8** %2
br label %45
7: ; preds = %1
%8 = load i32, i32* %3
%9 = trunc i32 %8 to i8
%10 = zext i8 %9 to i32
%11 = call i32 @isprint(i32 %10)
%12 = icmp ne i32 %11, 0
br i1 %12, label %13, label %16
13: ; preds = %7
%14 = load i32, i32* %3
%15 = trunc i32 %14 to i8
store i8 %15, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @cdesc.xbuf, i64 0, i64 0)
store i8 0, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @cdesc.xbuf, i64 0, i64 1)
store i8* getelementptr inbounds ([16 x i8], [16 x i8]* @cdesc.xbuf, i64 0, i64 0), i8** %2
br label %45
16: ; preds = %7
%17 = load i32, i32* %3
%18 = icmp eq i32 %17, 1
br i1 %18, label %19, label %20
19: ; preds = %16
store i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i8** %2
br label %45
20: ; preds = %16
%21 = load i32, i32* %3
%22 = icmp eq i32 %21, 127
br i1 %22, label %23, label %24
23: ; preds = %20
store i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), i8** %2
br label %45
24: ; preds = %20
%25 = load i32, i32* %3
%26 = icmp eq i32 %25, 27
br i1 %26, label %27, label %28
27: ; preds = %24
store i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i8** %2
br label %45
28: ; preds = %24
br label %29
29: ; preds = %28
br label %30
30: ; preds = %29
br label %31
31: ; preds = %30
br label %32
32: ; preds = %31
store i8 92, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @cdesc.xbuf, i64 0, i64 0)
store i8 0, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @cdesc.xbuf, i64 0, i64 2)
%33 = load i32, i32* %3
switch i32 %33, label %41 [
i32 7, label %34
i32 11, label %35
i32 8, label %36
i32 12, label %37
i32 10, label %38
i32 13, label %39
i32 9, label %40
]
34: ; preds = %32
store i8 97, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @cdesc.xbuf, i64 0, i64 1)
br label %44
35: ; preds = %32
store i8 118, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @cdesc.xbuf, i64 0, i64 1)
br label %44
36: ; preds = %32
store i8 98, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @cdesc.xbuf, i64 0, i64 1)
br label %44
37: ; preds = %32
store i8 102, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @cdesc.xbuf, i64 0, i64 1)
br label %44
38: ; preds = %32
store i8 110, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @cdesc.xbuf, i64 0, i64 1)
br label %44
39: ; preds = %32
store i8 114, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @cdesc.xbuf, i64 0, i64 1)
br label %44
40: ; preds = %32
store i8 116, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @cdesc.xbuf, i64 0, i64 1)
br label %44
41: ; preds = %32
%42 = load i32, i32* %3
%43 = call i32 (i8*, i8*, ...) @sprintf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @cdesc.xbuf, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i32 %42)
br label %44
44: ; preds = %41, %40, %39, %38, %37, %36, %35, %34
store i8* getelementptr inbounds ([16 x i8], [16 x i8]* @cdesc.xbuf, i64 0, i64 0), i8** %2
br label %45
45: ; preds = %44, %27, %23, %19, %13, %6
%46 = load i8*, i8** %2
ret i8* %46
}

LLVM IR (-O2):
@cdesc.xbuf = internal global [16 x i8] zeroinitializer
@.str = [4 x i8] c"SPC\00"
@.str.1 = [7 x i8] c"CTLESC\00"
@.str.2 = [7 x i8] c"CTLNUL\00"
@.str.3 = [4 x i8] c"ESC\00"
@.str.4 = [3 x i8] c"%d\00"
define i8* @cdesc(i32 %0) {
%2 = icmp eq i32 %0, 32
br i1 %2, label %22, label %3
3: ; preds = %1
%4 = and i32 %0, 255
%5 = tail call i32 @isprint(i32 %4)
%6 = icmp eq i32 %5, 0
br i1 %6, label %9, label %7
7: ; preds = %3
%8 = trunc i32 %0 to i8
store i8 %8, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @cdesc.xbuf, i64 0, i64 0)
store i8 0, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @cdesc.xbuf, i64 0, i64 1)
br label %22
9: ; preds = %3
switch i32 %0, label %12 [
i32 1, label %22
i32 127, label %10
i32 27, label %11
]
10: ; preds = %9
br label %22
11: ; preds = %9
br label %22
12: ; preds = %9
store i8 92, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @cdesc.xbuf, i64 0, i64 0)
store i8 0, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @cdesc.xbuf, i64 0, i64 2)
switch i32 %0, label %20 [
i32 7, label %13
i32 11, label %14
i32 8, label %15
i32 12, label %16
i32 10, label %17
i32 13, label %18
i32 9, label %19
]
13: ; preds = %12
store i8 97, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @cdesc.xbuf, i64 0, i64 1)
br label %22
14: ; preds = %12
store i8 118, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @cdesc.xbuf, i64 0, i64 1)
br label %22
15: ; preds = %12
store i8 98, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @cdesc.xbuf, i64 0, i64 1)
br label %22
16: ; preds = %12
store i8 102, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @cdesc.xbuf, i64 0, i64 1)
br label %22
17: ; preds = %12
store i8 110, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @cdesc.xbuf, i64 0, i64 1)
br label %22
18: ; preds = %12
store i8 114, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @cdesc.xbuf, i64 0, i64 1)
br label %22
19: ; preds = %12
store i8 116, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @cdesc.xbuf, i64 0, i64 1)
br label %22
20: ; preds = %12
%21 = tail call i32 (i8*, i8*, ...) @sprintf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @cdesc.xbuf, i64 0, i64 0), i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i32 %0)
br label %22
22: ; preds = %13, %14, %15, %16, %17, %18, %19, %20, %9, %1, %11, %10, %7
%23 = phi i8* [ getelementptr inbounds ([16 x i8], [16 x i8]* @cdesc.xbuf, i64 0, i64 0), %7 ], [ getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), %10 ], [ getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), %11 ], [ getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), %1 ], [ getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), %9 ], [ getelementptr inbounds ([16 x i8], [16 x i8]* @cdesc.xbuf, i64 0, i64 0), %20 ], [ getelementptr inbounds ([16 x i8], [16 x i8]* @cdesc.xbuf, i64 0, i64 0), %19 ], [ getelementptr inbounds ([16 x i8], [16 x i8]* @cdesc.xbuf, i64 0, i64 0), %18 ], [ getelementptr inbounds ([16 x i8], [16 x i8]* @cdesc.xbuf, i64 0, i64 0), %17 ], [ getelementptr inbounds ([16 x i8], [16 x i8]* @cdesc.xbuf, i64 0, i64 0), %16 ], [ getelementptr inbounds ([16 x i8], [16 x i8]* @cdesc.xbuf, i64 0, i64 0), %15 ], [ getelementptr inbounds ([16 x i8], [16 x i8]* @cdesc.xbuf, i64 0, i64 0), %14 ], [ getelementptr inbounds ([16 x i8], [16 x i8]* @cdesc.xbuf, i64 0, i64 0), %13 ]
ret i8* %23
}