const char *visible(ch)
unsigned char ch;
{
  static char buf[10];
  char *bpout = buf;
  if (ch == ((unsigned char)0))
    return "<undef>";
  if (ch >= 32) {
    if (ch < 127)
      *bpout++ = ch;
    else if (ch == 127) {
      *bpout++ = '^';
      *bpout++ = '?';
    } else {
      *bpout++ = 'M', *bpout++ = '-';
      if (ch >= 128 + 32) {
        if (ch < 128 + 127)
          *bpout++ = ch - 128;
        else {
          *bpout++ = '^';
          *bpout++ = '?';
        }
      } else {
        *bpout++ = '^';
        *bpout++ = ch - 128 + 64;
      }
    }
  } else {
    *bpout++ = '^';
    *bpout++ = ch + 64;
  }
  *bpout = '\0';
  return (const char *)buf;
}


x86 assembly (clang, -O0):
<visible>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x9(%rbp)
lea    0x2f10(%rip),%rax
mov    %rax,-0x18(%rbp)
movzbl -0x9(%rbp),%eax
cmp    $0x0,%eax
jne    1132 <visible+0x32>
lea    0xed7(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    12a5 <visible+0x1a5>
movzbl -0x9(%rbp),%eax
cmp    $0x20,%eax
jl     1267 <visible+0x167>
movzbl -0x9(%rbp),%eax
cmp    $0x7f,%eax
jge    1165 <visible+0x65>
mov    -0x9(%rbp),%cl
mov    -0x18(%rbp),%rax
mov    %rax,%rdx
add    $0x1,%rdx
mov    %rdx,-0x18(%rbp)
mov    %cl,(%rax)
jmp    1262 <visible+0x162>
movzbl -0x9(%rbp),%eax
cmp    $0x7f,%eax
jne    119b <visible+0x9b>
mov    -0x18(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x18(%rbp)
movb   $0x5e,(%rax)
mov    -0x18(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x18(%rbp)
movb   $0x3f,(%rax)
jmp    125d <visible+0x15d>
mov    -0x18(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x18(%rbp)
movb   $0x4d,(%rax)
mov    -0x18(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x18(%rbp)
movb   $0x2d,(%rax)
movzbl -0x9(%rbp),%eax
cmp    $0xa0,%eax
jl     1227 <visible+0x127>
movzbl -0x9(%rbp),%eax
cmp    $0xff,%eax
jge    11fe <visible+0xfe>
movzbl -0x9(%rbp),%eax
sub    $0x80,%eax
mov    %al,%cl
mov    -0x18(%rbp),%rax
mov    %rax,%rdx
add    $0x1,%rdx
mov    %rdx,-0x18(%rbp)
mov    %cl,(%rax)
jmp    1222 <visible+0x122>
mov    -0x18(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x18(%rbp)
movb   $0x5e,(%rax)
mov    -0x18(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x18(%rbp)
movb   $0x3f,(%rax)
jmp    1258 <visible+0x158>
mov    -0x18(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x18(%rbp)
movb   $0x5e,(%rax)
movzbl -0x9(%rbp),%eax
sub    $0x80,%eax
add    $0x40,%eax
mov    %al,%cl
mov    -0x18(%rbp),%rax
mov    %rax,%rdx
add    $0x1,%rdx
mov    %rdx,-0x18(%rbp)
mov    %cl,(%rax)
jmp    125d <visible+0x15d>
jmp    1262 <visible+0x162>
jmp    1293 <visible+0x193>
mov    -0x18(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x18(%rbp)
movb   $0x5e,(%rax)
movzbl -0x9(%rbp),%eax
add    $0x40,%eax
mov    %al,%cl
mov    -0x18(%rbp),%rax
mov    %rax,%rdx
add    $0x1,%rdx
mov    %rdx,-0x18(%rbp)
mov    %cl,(%rax)
mov    -0x18(%rbp),%rax
movb   $0x0,(%rax)
lea    0x2d80(%rip),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<visible>:
mov    %edi,%eax
and    $0xff,%eax
je     1123 <visible+0x23>
cmp    $0x20,%eax
jb     112b <visible+0x2b>
cmp    $0x7e,%eax
ja     114f <visible+0x4f>
mov    %dil,0x2f07(%rip)
lea    0x2f01(%rip),%rax
jmp    1144 <visible+0x44>
lea    0xed6(%rip),%rax
ret
movb   $0x5e,0x2eef(%rip)
add    $0x40,%dil
mov    %dil,0x2ee5(%rip)
lea    0x2edf(%rip),%rax
movb   $0x0,(%rax)
lea    0x2ed3(%rip),%rax
ret
cmp    $0x7f,%eax
jne    115f <visible+0x5f>
movw   $0x3f5e,0x2ec4(%rip)
5e 3f
jmp    113d <visible+0x3d>
movw   $0x2d4d,0x2eb9(%rip)
4d 2d
cmp    $0xa0,%eax
jb     1188 <visible+0x88>
cmp    $0xff,%eax
jne    11a3 <visible+0xa3>
movw   $0x3f5e,0x2ea4(%rip)
5e 3f
lea    0x2e9f(%rip),%rax
jmp    1144 <visible+0x44>
movb   $0x5e,0x2e94(%rip)
add    $0xc0,%dil
mov    %dil,0x2e8a(%rip)
lea    0x2e84(%rip),%rax
jmp    1144 <visible+0x44>
xor    $0x80,%dil
mov    %dil,0x2e75(%rip)
lea    0x2e6f(%rip),%rax
jmp    1144 <visible+0x44>

LLVM IR (-O0):
@visible.buf = internal global [10 x i8] zeroinitializer
@.str = [8 x i8] c"<undef>\00"
define i8* @visible(i32 %0) {
%2 = alloca i8*
%3 = alloca i8
%4 = alloca i8*
%5 = trunc i32 %0 to i8
store i8 %5, i8* %3
store i8* getelementptr inbounds ([10 x i8], [10 x i8]* @visible.buf, i64 0, i64 0), i8** %4
%6 = load i8, i8* %3
%7 = zext i8 %6 to i32
%8 = icmp eq i32 %7, 0
br i1 %8, label %9, label %10
9: ; preds = %1
store i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i8** %2
br label %80
10: ; preds = %1
%11 = load i8, i8* %3
%12 = zext i8 %11 to i32
%13 = icmp sge i32 %12, 32
br i1 %13, label %14, label %69
14: ; preds = %10
%15 = load i8, i8* %3
%16 = zext i8 %15 to i32
%17 = icmp slt i32 %16, 127
br i1 %17, label %18, label %22
18: ; preds = %14
%19 = load i8, i8* %3
%20 = load i8*, i8** %4
%21 = getelementptr inbounds i8, i8* %20, i32 1
store i8* %21, i8** %4
store i8 %19, i8* %20
br label %68
22: ; preds = %14
%23 = load i8, i8* %3
%24 = zext i8 %23 to i32
%25 = icmp eq i32 %24, 127
br i1 %25, label %26, label %31
26: ; preds = %22
%27 = load i8*, i8** %4
%28 = getelementptr inbounds i8, i8* %27, i32 1
store i8* %28, i8** %4
store i8 94, i8* %27
%29 = load i8*, i8** %4
%30 = getelementptr inbounds i8, i8* %29, i32 1
store i8* %30, i8** %4
store i8 63, i8* %29
br label %67
31: ; preds = %22
%32 = load i8*, i8** %4
%33 = getelementptr inbounds i8, i8* %32, i32 1
store i8* %33, i8** %4
store i8 77, i8* %32
%34 = load i8*, i8** %4
%35 = getelementptr inbounds i8, i8* %34, i32 1
store i8* %35, i8** %4
store i8 45, i8* %34
%36 = load i8, i8* %3
%37 = zext i8 %36 to i32
%38 = icmp sge i32 %37, 160
br i1 %38, label %39, label %56
39: ; preds = %31
%40 = load i8, i8* %3
%41 = zext i8 %40 to i32
%42 = icmp slt i32 %41, 255
br i1 %42, label %43, label %50
43: ; preds = %39
%44 = load i8, i8* %3
%45 = zext i8 %44 to i32
%46 = sub nsw i32 %45, 128
%47 = trunc i32 %46 to i8
%48 = load i8*, i8** %4
%49 = getelementptr inbounds i8, i8* %48, i32 1
store i8* %49, i8** %4
store i8 %47, i8* %48
br label %55
50: ; preds = %39
%51 = load i8*, i8** %4
%52 = getelementptr inbounds i8, i8* %51, i32 1
store i8* %52, i8** %4
store i8 94, i8* %51
%53 = load i8*, i8** %4
%54 = getelementptr inbounds i8, i8* %53, i32 1
store i8* %54, i8** %4
store i8 63, i8* %53
br label %55
55: ; preds = %50, %43
br label %66
56: ; preds = %31
%57 = load i8*, i8** %4
%58 = getelementptr inbounds i8, i8* %57, i32 1
store i8* %58, i8** %4
store i8 94, i8* %57
%59 = load i8, i8* %3
%60 = zext i8 %59 to i32
%61 = sub nsw i32 %60, 128
%62 = add nsw i32 %61, 64
%63 = trunc i32 %62 to i8
%64 = load i8*, i8** %4
%65 = getelementptr inbounds i8, i8* %64, i32 1
store i8* %65, i8** %4
store i8 %63, i8* %64
br label %66
66: ; preds = %56, %55
br label %67
67: ; preds = %66, %26
br label %68
68: ; preds = %67, %18
br label %78
69: ; preds = %10
%70 = load i8*, i8** %4
%71 = getelementptr inbounds i8, i8* %70, i32 1
store i8* %71, i8** %4
store i8 94, i8* %70
%72 = load i8, i8* %3
%73 = zext i8 %72 to i32
%74 = add nsw i32 %73, 64
%75 = trunc i32 %74 to i8
%76 = load i8*, i8** %4
%77 = getelementptr inbounds i8, i8* %76, i32 1
store i8* %77, i8** %4
store i8 %75, i8* %76
br label %78
78: ; preds = %69, %68
%79 = load i8*, i8** %4
store i8 0, i8* %79
store i8* getelementptr inbounds ([10 x i8], [10 x i8]* @visible.buf, i64 0, i64 0), i8** %2
br label %80
80: ; preds = %78, %9
%81 = load i8*, i8** %2
ret i8* %81
}

LLVM IR (-O2):
@visible.buf = internal global [10 x i8] zeroinitializer
@.str = [8 x i8] c"<undef>\00"
define i8* @visible(i32 %0) {
%2 = trunc i32 %0 to i8
%3 = and i32 %0, 255
%4 = icmp eq i32 %3, 0
br i1 %4, label %26, label %5
5: ; preds = %1
%6 = icmp ugt i32 %3, 31
br i1 %6, label %7, label %22
7: ; preds = %5
%8 = icmp ult i32 %3, 127
br i1 %8, label %9, label %10
9: ; preds = %7
store i8 %2, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @visible.buf, i64 0, i64 0)
br label %24
10: ; preds = %7
%11 = icmp eq i32 %3, 127
br i1 %11, label %12, label %13
12: ; preds = %10
store i8 94, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @visible.buf, i64 0, i64 0)
store i8 63, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @visible.buf, i64 0, i64 1)
br label %24
13: ; preds = %10
store i8 77, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @visible.buf, i64 0, i64 0)
store i8 45, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @visible.buf, i64 0, i64 1)
%14 = icmp ugt i32 %3, 159
br i1 %14, label %15, label %20
15: ; preds = %13
%16 = icmp eq i32 %3, 255
br i1 %16, label %19, label %17
17: ; preds = %15
%18 = xor i8 %2, -128
store i8 %18, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @visible.buf, i64 0, i64 2)
br label %24
19: ; preds = %15
store i8 94, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @visible.buf, i64 0, i64 2)
store i8 63, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @visible.buf, i64 0, i64 3)
br label %24
20: ; preds = %13
store i8 94, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @visible.buf, i64 0, i64 2)
%21 = add i8 %2, -64
store i8 %21, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @visible.buf, i64 0, i64 3)
br label %24
22: ; preds = %5
store i8 94, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @visible.buf, i64 0, i64 0)
%23 = add i8 %2, 64
store i8 %23, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @visible.buf, i64 0, i64 1)
br label %24
24: ; preds = %9, %20, %19, %17, %12, %22
%25 = phi i8* [ getelementptr inbounds ([10 x i8], [10 x i8]* @visible.buf, i64 0, i64 1), %9 ], [ getelementptr inbounds ([10 x i8], [10 x i8]* @visible.buf, i64 0, i64 2), %12 ], [ getelementptr inbounds ([10 x i8], [10 x i8]* @visible.buf, i64 0, i64 3), %17 ], [ getelementptr inbounds ([10 x i8], [10 x i8]* @visible.buf, i64 0, i64 4), %19 ], [ getelementptr inbounds ([10 x i8], [10 x i8]* @visible.buf, i64 0, i64 4), %20 ], [ getelementptr inbounds ([10 x i8], [10 x i8]* @visible.buf, i64 0, i64 2), %22 ]
store i8 0, i8* %25
br label %26
26: ; preds = %1, %24
%27 = phi i8* [ getelementptr inbounds ([10 x i8], [10 x i8]* @visible.buf, i64 0, i64 0), %24 ], [ getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), %1 ]
ret i8* %27
}