#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*/ fprintf(int /*<<< orphan*/, char *, ...);
int /*<<< orphan*/ stderr;
void prstr(char *cp) {
  int c;
  while ((c = (*cp++ & 0377)))
    if (c < ' ')
      fprintf(stderr, "^%c", c + '`');
    else if (c == 0177)
      fprintf(stderr, "^?");
    else if (c > 0200)
      fprintf(stderr, "\\%03o", c);
    else
      fprintf(stderr, "%c", c);
}


x86 assembly (clang, -O0):
<prstr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x8(%rbp)
movsbl (%rax),%eax
and    $0xff,%eax
mov    %eax,-0xc(%rbp)
cmp    $0x0,%eax
je     11e6 <prstr+0xd6>
cmpl   $0x20,-0xc(%rbp)
jge    116b <prstr+0x5b>
mov    0x2e90(%rip),%rax
mov    (%rax),%edi
mov    -0xc(%rbp),%edx
add    $0x60,%edx
lea    0xea1(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
jmp    11e1 <prstr+0xd1>
cmpl   $0x7f,-0xc(%rbp)
jne    1191 <prstr+0x81>
mov    0x2e64(%rip),%rax
mov    (%rax),%edi
lea    0xe7f(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
jmp    11dc <prstr+0xcc>
cmpl   $0x80,-0xc(%rbp)
jle    11bd <prstr+0xad>
mov    0x2e3b(%rip),%rax
mov    (%rax),%edi
mov    -0xc(%rbp),%edx
lea    0xe56(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
jmp    11d7 <prstr+0xc7>
mov    0x2e1c(%rip),%rax
mov    (%rax),%edi
mov    -0xc(%rbp),%edx
lea    0xe31(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
jmp    11dc <prstr+0xcc>
jmp    11e1 <prstr+0xd1>
jmp    111c <prstr+0xc>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<prstr>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    (%rdi),%al
test   %al,%al
je     11b1 <prstr+0xa1>
mov    %rdi,%rbx
add    $0x1,%rbx
mov    0x2ead(%rip),%rbp
lea    0xec6(%rip),%r14
lea    0xec3(%rip),%r15
lea    0xebf(%rip),%r12
lea    0xeb2(%rip),%r13
jmp    117b <prstr+0x6b>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    0x0(%rbp),%edi
add    $0x60,%edx
mov    %r14,%rsi
xor    %eax,%eax
call   1030 <fprintf@plt>
movzbl (%rbx),%eax
add    $0x1,%rbx
test   %al,%al
je     11b1 <prstr+0xa1>
movzbl %al,%edx
cmp    $0x1f,%dl
jbe    1160 <prstr+0x50>
cmp    $0x7f,%al
jne    11a0 <prstr+0x90>
mov    0x0(%rbp),%edi
mov    %r15,%rsi
xor    %eax,%eax
call   1030 <fprintf@plt>
jmp    1170 <prstr+0x60>
cs nopw 0x0(%rax,%rax,1)
mov    0x0(%rbp),%edi
cmp    $0x81,%al
jb     11ac <prstr+0x9c>
mov    %r12,%rsi
jmp    1169 <prstr+0x59>
mov    %r13,%rsi
jmp    1169 <prstr+0x59>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@stderr = global i32 0
@.str = [4 x i8] c"^%c\00"
@.str.1 = [3 x i8] c"^?\00"
@.str.2 = [6 x i8] c"\\%03o\00"
@.str.3 = [3 x i8] c"%c\00"
define void @prstr(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
store i8* %0, i8** %2
br label %4
4: ; preds = %38, %1
%5 = load i8*, i8** %2
%6 = getelementptr inbounds i8, i8* %5, i32 1
store i8* %6, i8** %2
%7 = load i8, i8* %5
%8 = sext i8 %7 to i32
%9 = and i32 %8, 255
store i32 %9, i32* %3
%10 = icmp ne i32 %9, 0
br i1 %10, label %11, label %39
11: ; preds = %4
%12 = load i32, i32* %3
%13 = icmp slt i32 %12, 32
br i1 %13, label %14, label %19
14: ; preds = %11
%15 = load i32, i32* @stderr
%16 = load i32, i32* %3
%17 = add nsw i32 %16, 96
%18 = call i32 (i32, i8*, ...) @fprintf(i32 %15, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %17)
br label %38
19: ; preds = %11
%20 = load i32, i32* %3
%21 = icmp eq i32 %20, 127
br i1 %21, label %22, label %25
22: ; preds = %19
%23 = load i32, i32* @stderr
%24 = call i32 (i32, i8*, ...) @fprintf(i32 %23, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
br label %37
25: ; preds = %19
%26 = load i32, i32* %3
%27 = icmp sgt i32 %26, 128
br i1 %27, label %28, label %32
28: ; preds = %25
%29 = load i32, i32* @stderr
%30 = load i32, i32* %3
%31 = call i32 (i32, i8*, ...) @fprintf(i32 %29, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i32 %30)
br label %36
32: ; preds = %25
%33 = load i32, i32* @stderr
%34 = load i32, i32* %3
%35 = call i32 (i32, i8*, ...) @fprintf(i32 %33, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32 %34)
br label %36
36: ; preds = %32, %28
br label %37
37: ; preds = %36, %22
br label %38
38: ; preds = %37, %14
br label %4
39: ; preds = %4
ret void
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [4 x i8] c"^%c\00"
@.str.1 = [3 x i8] c"^?\00"
@.str.2 = [6 x i8] c"\\%03o\00"
@.str.3 = [3 x i8] c"%c\00"
define void @prstr(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %29, label %4
4: ; preds = %1, %26
%5 = phi i8 [ %27, %26 ], [ %2, %1 ]
%6 = phi i8* [ %7, %26 ], [ %0, %1 ]
%7 = getelementptr inbounds i8, i8* %6, i64 1
%8 = zext i8 %5 to i32
%9 = icmp ult i8 %5, 32
br i1 %9, label %10, label %14
10: ; preds = %4
%11 = load i32, i32* @stderr
%12 = add nuw nsw i32 %8, 96
%13 = tail call i32 (i32, i8*, ...) @fprintf(i32 %11, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %12)
br label %26
14: ; preds = %4
%15 = icmp eq i8 %5, 127
br i1 %15, label %16, label %19
16: ; preds = %14
%17 = load i32, i32* @stderr
%18 = tail call i32 (i32, i8*, ...) @fprintf(i32 %17, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
br label %26
19: ; preds = %14
%20 = icmp ugt i8 %5, -128
%21 = load i32, i32* @stderr
br i1 %20, label %22, label %24
22: ; preds = %19
%23 = tail call i32 (i32, i8*, ...) @fprintf(i32 %21, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i32 %8)
br label %26
24: ; preds = %19
%25 = tail call i32 (i32, i8*, ...) @fprintf(i32 %21, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32 %8)
br label %26
26: ; preds = %16, %24, %22, %10
%27 = load i8, i8* %7
%28 = icmp eq i8 %27, 0
br i1 %28, label %29, label %4
29: ; preds = %26, %1
ret void
}