prctl(c) char c;
{
  if (c < ' ')
    prints("^%c", 'A' + c - 1);
  else if (c == 0177)
    prints("DEL");
  else
    prints("%c", c);
}


x86 assembly (clang, -O0):
<prctl>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dil,%al
mov    %al,-0x5(%rbp)
movsbl -0x5(%rbp),%eax
cmp    $0x20,%eax
jge    1148 <prctl+0x38>
movsbl -0x5(%rbp),%esi
add    $0x41,%esi
sub    $0x1,%esi
lea    0xec4(%rip),%rdi
mov    $0x0,%al
call   1030 <prints@plt>
jmp    117f <prctl+0x6f>
movsbl -0x5(%rbp),%eax
cmp    $0x7f,%eax
jne    1168 <prctl+0x58>
lea    0xea8(%rip),%rdi
mov    $0x0,%al
call   1030 <prints@plt>
jmp    117a <prctl+0x6a>
movsbl -0x5(%rbp),%esi
lea    0xe8e(%rip),%rdi
mov    $0x0,%al
call   1030 <prints@plt>
jmp    117f <prctl+0x6f>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<prctl>:
push   %rax
movsbl %dil,%esi
shl    $0x18,%edi
cmp    $0x1fffffff,%edi
jg     112c <prctl+0x1c>
add    $0x40,%esi
lea    0xed6(%rip),%rdi
jmp    114b <prctl+0x3b>
cmp    $0x7f000000,%edi
jne    1144 <prctl+0x34>
lea    0xec9(%rip),%rdi
xor    %eax,%eax
call   1030 <prints@plt>
pop    %rcx
ret
lea    0xeb6(%rip),%rdi
xor    %eax,%eax
call   1030 <prints@plt>
pop    %rcx
ret

LLVM IR (-O0):
@.str = [4 x i8] c"^%c\00"
@.str.1 = [4 x i8] c"DEL\00"
@.str.2 = [3 x i8] c"%c\00"
define i32 @prctl(i32 %0) {
%2 = alloca i32
%3 = alloca i8
%4 = trunc i32 %0 to i8
store i8 %4, i8* %3
%5 = load i8, i8* %3
%6 = sext i8 %5 to i32
%7 = icmp slt i32 %6, 32
br i1 %7, label %8, label %14
8: ; preds = %1
%9 = load i8, i8* %3
%10 = sext i8 %9 to i32
%11 = add nsw i32 65, %10
%12 = sub nsw i32 %11, 1
%13 = call i32 (i8*, i32, ...) bitcast (i32 (...)* @prints to i32 (i8*, i32, ...)*)(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %12)
br label %25
14: ; preds = %1
%15 = load i8, i8* %3
%16 = sext i8 %15 to i32
%17 = icmp eq i32 %16, 127
br i1 %17, label %18, label %20
18: ; preds = %14
%19 = call i32 (i8*, ...) bitcast (i32 (...)* @prints to i32 (i8*, ...)*)(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
br label %24
20: ; preds = %14
%21 = load i8, i8* %3
%22 = sext i8 %21 to i32
%23 = call i32 (i8*, i32, ...) bitcast (i32 (...)* @prints to i32 (i8*, i32, ...)*)(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32 %22)
br label %24
24: ; preds = %20, %18
br label %25
25: ; preds = %24, %8
%26 = load i32, i32* %2
ret i32 %26
}

LLVM IR (-O2):
@.str = [4 x i8] c"^%c\00"
@.str.1 = [4 x i8] c"DEL\00"
@.str.2 = [3 x i8] c"%c\00"
define i32 @prctl(i32 %0) {
%2 = shl i32 %0, 24
%3 = ashr exact i32 %2, 24
%4 = icmp slt i32 %2, 536870912
br i1 %4, label %5, label %8
5: ; preds = %1
%6 = add nsw i32 %3, 64
%7 = tail call i32 (i8*, i32, ...) bitcast (i32 (...)* @prints to i32 (i8*, i32, ...)*)(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %6)
br label %14
8: ; preds = %1
%9 = icmp eq i32 %2, 2130706432
br i1 %9, label %10, label %12
10: ; preds = %8
%11 = tail call i32 (i8*, ...) bitcast (i32 (...)* @prints to i32 (i8*, ...)*)(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
br label %14
12: ; preds = %8
%13 = tail call i32 (i8*, i32, ...) bitcast (i32 (...)* @prints to i32 (i8*, i32, ...)*)(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32 %3)
br label %14
14: ; preds = %10, %12, %5
ret i32 undef
}