int shoesc(escape)
int escape;
{
  extern char *ccntab[];
  extern int tt_escape;
  if ((escape > 0 && escape < 32) || (escape == 127)) {
    printf(" Escape character: Ctrl-%c (ASCII %d, %s): %s\r\n",
           (((escape) ^ 64) & 0xFF), escape,
           (escape == 127 ? "DEL" : ccntab[escape]),
           tt_escape ? "enabled" : "disabled");
  } else {
    printf(" Escape character: Code %d", escape);
    if (escape > 160 && escape < 256)
      printf(" (%c)", escape);
    printf(": %s\r\n", tt_escape ? "enabled" : "disabled");
  }
  return (0);
}


x86 assembly (clang, -O0):
<shoesc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
jle    112f <shoesc+0x1f>
cmpl   $0x20,-0x4(%rbp)
jl     1139 <shoesc+0x29>
cmpl   $0x7f,-0x4(%rbp)
jne    11b5 <shoesc+0xa5>
mov    -0x4(%rbp),%eax
xor    $0x40,%eax
and    $0xff,%eax
mov    %eax,-0xc(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x8(%rbp)
cmpl   $0x7f,-0x4(%rbp)
jne    1167 <shoesc+0x57>
lea    0xed2(%rip),%rax
mov    %rax,-0x18(%rbp)
jmp    117a <shoesc+0x6a>
movslq -0x4(%rbp),%rcx
mov    0x2e6e(%rip),%rax
mov    (%rax,%rcx,8),%rax
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%edx
mov    -0xc(%rbp),%esi
mov    -0x18(%rbp),%rcx
mov    0x2e5d(%rip),%rax
mov    (%rax),%edi
lea    0xea8(%rip),%r8
lea    0xe99(%rip),%rax
cmp    $0x0,%edi
cmovne %rax,%r8
lea    0xe57(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    121d <shoesc+0x10d>
mov    -0x4(%rbp),%esi
lea    0xe86(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
cmpl   $0xa0,-0x4(%rbp)
jle    11f1 <shoesc+0xe1>
cmpl   $0x100,-0x4(%rbp)
jge    11f1 <shoesc+0xe1>
mov    -0x4(%rbp),%esi
lea    0xe76(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    0x2df0(%rip),%rax
mov    (%rax),%ecx
lea    0xe3b(%rip),%rsi
lea    0xe2c(%rip),%rax
cmp    $0x0,%ecx
cmovne %rax,%rsi
lea    0xe13(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<shoesc>:
push   %rbx
mov    %edi,%ebx
cmp    $0x7f,%edi
je     1177 <shoesc+0x67>
lea    -0x1(%rbx),%eax
cmp    $0x1e,%eax
jbe    1177 <shoesc+0x67>
lea    0xf1e(%rip),%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1030 <printf@plt>
lea    -0xa1(%rbx),%eax
cmp    $0x5e,%eax
ja     114b <shoesc+0x3b>
lea    0xf1e(%rip),%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1030 <printf@plt>
mov    0x2e96(%rip),%rax
cmpl   $0x0,(%rax)
lea    0xee0(%rip),%rax
lea    0xed1(%rip),%rsi
cmove  %rax,%rsi
lea    0xebb(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
jmp    11c3 <shoesc+0xb3>
mov    %ebx,%esi
xor    $0x40,%esi
cmp    $0x7f,%ebx
jne    118a <shoesc+0x7a>
lea    0xea8(%rip),%rcx
jmp    1197 <shoesc+0x87>
mov    %ebx,%eax
mov    0x2e4d(%rip),%rcx
mov    (%rcx,%rax,8),%rcx
mov    0x2e4a(%rip),%rax
cmpl   $0x0,(%rax)
lea    0xe94(%rip),%rax
lea    0xe85(%rip),%r8
cmove  %rax,%r8
lea    0xe46(%rip),%rdi
mov    %ebx,%edx
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [48 x i8] c" Escape character: Ctrl-%c (ASCII %d, %s): %s\0D\0A\00"
@.str.1 = [4 x i8] c"DEL\00"
@ccntab = external global [0 x i8*]
@tt_escape = external global i32
@.str.2 = [8 x i8] c"enabled\00"
@.str.3 = [9 x i8] c"disabled\00"
@.str.4 = [27 x i8] c" Escape character: Code %d\00"
@.str.5 = [6 x i8] c" (%c)\00"
@.str.6 = [7 x i8] c": %s\0D\0A\00"
define i32 @shoesc(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = icmp sgt i32 %3, 0
br i1 %4, label %5, label %8
5: ; preds = %1
%6 = load i32, i32* %2
%7 = icmp slt i32 %6, 32
br i1 %7, label %11, label %8
8: ; preds = %5, %1
%9 = load i32, i32* %2
%10 = icmp eq i32 %9, 127
br i1 %10, label %11, label %31
11: ; preds = %8, %5
%12 = load i32, i32* %2
%13 = xor i32 %12, 64
%14 = and i32 %13, 255
%15 = load i32, i32* %2
%16 = load i32, i32* %2
%17 = icmp eq i32 %16, 127
br i1 %17, label %18, label %19
18: ; preds = %11
br label %24
19: ; preds = %11
%20 = load i32, i32* %2
%21 = sext i32 %20 to i64
%22 = getelementptr inbounds [0 x i8*], [0 x i8*]* @ccntab, i64 0, i64 %21
%23 = load i8*, i8** %22
br label %24
24: ; preds = %19, %18
%25 = phi i8* [ getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), %18 ], [ %23, %19 ]
%26 = load i32, i32* @tt_escape
%27 = icmp ne i32 %26, 0
%28 = zext i1 %27 to i64
%29 = select i1 %27, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0)
%30 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str, i64 0, i64 0), i32 %14, i32 %15, i8* %25, i8* %29)
br label %48
31: ; preds = %8
%32 = load i32, i32* %2
%33 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.4, i64 0, i64 0), i32 %32)
%34 = load i32, i32* %2
%35 = icmp sgt i32 %34, 160
br i1 %35, label %36, label %42
36: ; preds = %31
%37 = load i32, i32* %2
%38 = icmp slt i32 %37, 256
br i1 %38, label %39, label %42
39: ; preds = %36
%40 = load i32, i32* %2
%41 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0), i32 %40)
br label %42
42: ; preds = %39, %36, %31
%43 = load i32, i32* @tt_escape
%44 = icmp ne i32 %43, 0
%45 = zext i1 %44 to i64
%46 = select i1 %44, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0)
%47 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.6, i64 0, i64 0), i8* %46)
br label %48
48: ; preds = %42, %24
ret i32 0
}

LLVM IR (-O2):
@.str = [48 x i8] c" Escape character: Ctrl-%c (ASCII %d, %s): %s\0D\0A\00"
@.str.1 = [4 x i8] c"DEL\00"
@ccntab = external global [0 x i8*]
@tt_escape = external global i32
@.str.2 = [8 x i8] c"enabled\00"
@.str.3 = [9 x i8] c"disabled\00"
@.str.4 = [27 x i8] c" Escape character: Code %d\00"
@.str.5 = [6 x i8] c" (%c)\00"
@.str.6 = [7 x i8] c": %s\0D\0A\00"
define i32 @shoesc(i32 %0) {
%2 = add i32 %0, -1
%3 = icmp ult i32 %2, 31
%4 = icmp eq i32 %0, 127
%5 = or i1 %4, %3
br i1 %5, label %6, label %18
6: ; preds = %1
%7 = xor i32 %0, 64
br i1 %4, label %12, label %8
8: ; preds = %6
%9 = zext i32 %0 to i64
%10 = getelementptr inbounds [0 x i8*], [0 x i8*]* @ccntab, i64 0, i64 %9
%11 = load i8*, i8** %10
br label %12
12: ; preds = %6, %8
%13 = phi i8* [ %11, %8 ], [ getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), %6 ]
%14 = load i32, i32* @tt_escape
%15 = icmp eq i32 %14, 0
%16 = select i1 %15, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0)
%17 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([48 x i8], [48 x i8]* @.str, i64 0, i64 0), i32 %7, i32 %0, i8* %13, i8* %16)
br label %29
18: ; preds = %1
%19 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @.str.4, i64 0, i64 0), i32 %0)
%20 = add i32 %0, -161
%21 = icmp ult i32 %20, 95
br i1 %21, label %22, label %24
22: ; preds = %18
%23 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0), i32 %0)
br label %24
24: ; preds = %22, %18
%25 = load i32, i32* @tt_escape
%26 = icmp eq i32 %25, 0
%27 = select i1 %26, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0)
%28 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.6, i64 0, i64 0), i8* %27)
br label %29
29: ; preds = %24, %12
ret i32 0
}