#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*/ printf(char *, ...);
void prctl(char c) {
  if (c < ' ')
    printf("^%c", 'A' + c - 1);
  else if (c == 0177)
    printf("^?");
  else
    printf("%c", c);
}


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

x86 assembly (clang, -O2):
<prctl>:
mov    %edi,%esi
cmp    $0x1f,%sil
jg     1139 <prctl+0x19>
add    $0x40,%esi
lea    0xece(%rip),%rdi
xor    %eax,%eax
jmp    1040 <printf@plt>
cmp    $0x7f,%sil
jne    114d <prctl+0x2d>
lea    0xebe(%rip),%rdi
xor    %eax,%eax
jmp    1040 <printf@plt>
mov    %esi,%edi
jmp    1030 <putchar@plt>

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

LLVM IR (-O2):
@.str = [4 x i8] c"^%c\00"
@.str.1 = [3 x i8] c"^?\00"
define void @prctl(i8 signext %0) {
%2 = sext i8 %0 to i32
%3 = icmp slt i8 %0, 32
br i1 %3, label %4, label %7
4: ; preds = %1
%5 = add nsw i32 %2, 64
%6 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %5)
br label %13
7: ; preds = %1
%8 = icmp eq i8 %0, 127
br i1 %8, label %9, label %11
9: ; preds = %7
%10 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
br label %13
11: ; preds = %7
%12 = tail call i32 @putchar(i32 %2)
br label %13
13: ; preds = %9, %11, %4
ret void
}