chrprint(s) char *s;
{
  int i;
  printf("  ");
  sgr("7");
  printf(" ");
  for (i = 0; s[i] != '\0'; i++) {
    if (s[i] <= ' ' || s[i] == '\177')
      printf("<%d> ", s[i]);
    else
      printf("%c ", s[i]);
  }
  sgr("");
}


x86 assembly (clang, -O0):
<chrprint>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
lea    0xecd(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xec2(%rip),%rdi
mov    $0x0,%al
call   1040 <sgr@plt>
lea    0xeb2(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x14(%rbp)
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x0,%eax
je     11e8 <chrprint+0xc8>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x20,%eax
jle    119c <chrprint+0x7c>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x7f,%eax
jne    11bb <chrprint+0x9b>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
movsbl (%rax,%rcx,1),%esi
lea    0xe56(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11d5 <chrprint+0xb5>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
movsbl (%rax,%rcx,1),%esi
lea    0xe3d(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11da <chrprint+0xba>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    115d <chrprint+0x3d>
lea    0xe13(%rip),%rdi
mov    $0x0,%al
call   1040 <sgr@plt>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<chrprint>:
push   %r15
push   %r14
push   %rbx
mov    %rdi,%rbx
lea    0xec1(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xeb6(%rip),%rdi
xor    %eax,%eax
call   1050 <sgr@plt>
mov    $0x20,%edi
call   1030 <putchar@plt>
mov    (%rbx),%al
test   %al,%al
je     11a1 <chrprint+0x71>
add    $0x1,%rbx
lea    0xe96(%rip),%r14
lea    0xe95(%rip),%r15
cs nopw 0x0(%rax,%rax,1)
movsbl %al,%esi
lea    -0x7f(%rsi),%eax
cmp    $0xa2,%al
mov    %r15,%rdi
cmovb  %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
movzbl (%rbx),%eax
add    $0x1,%rbx
test   %al,%al
jne    1180 <chrprint+0x50>
lea    0xe5a(%rip),%rdi
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %r15
jmp    1050 <sgr@plt>

LLVM IR (-O0):
@.str = [3 x i8] c" \00"
@.str.1 = [2 x i8] c"7\00"
@.str.2 = [2 x i8] c" \00"
@.str.3 = [6 x i8] c"<%d> \00"
@.str.4 = [4 x i8] c"%c \00"
@.str.5 = [1 x i8] zeroinitializer
define i32 @chrprint(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %3
%5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%6 = call i32 (i8*, ...) bitcast (i32 (...)* @sgr to i32 (i8*, ...)*)(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
store i32 0, i32* %4
br label %8
8: ; preds = %49, %1
%9 = load i8*, i8** %3
%10 = load i32, i32* %4
%11 = sext i32 %10 to i64
%12 = getelementptr inbounds i8, i8* %9, i64 %11
%13 = load i8, i8* %12
%14 = sext i8 %13 to i32
%15 = icmp ne i32 %14, 0
br i1 %15, label %16, label %52
16: ; preds = %8
%17 = load i8*, i8** %3
%18 = load i32, i32* %4
%19 = sext i32 %18 to i64
%20 = getelementptr inbounds i8, i8* %17, i64 %19
%21 = load i8, i8* %20
%22 = sext i8 %21 to i32
%23 = icmp sle i32 %22, 32
br i1 %23, label %32, label %24
24: ; preds = %16
%25 = load i8*, i8** %3
%26 = load i32, i32* %4
%27 = sext i32 %26 to i64
%28 = getelementptr inbounds i8, i8* %25, i64 %27
%29 = load i8, i8* %28
%30 = sext i8 %29 to i32
%31 = icmp eq i32 %30, 127
br i1 %31, label %32, label %40
32: ; preds = %24, %16
%33 = load i8*, i8** %3
%34 = load i32, i32* %4
%35 = sext i32 %34 to i64
%36 = getelementptr inbounds i8, i8* %33, i64 %35
%37 = load i8, i8* %36
%38 = sext i8 %37 to i32
%39 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0), i32 %38)
br label %48
40: ; preds = %24
%41 = load i8*, i8** %3
%42 = load i32, i32* %4
%43 = sext i32 %42 to i64
%44 = getelementptr inbounds i8, i8* %41, i64 %43
%45 = load i8, i8* %44
%46 = sext i8 %45 to i32
%47 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), i32 %46)
br label %48
48: ; preds = %40, %32
br label %49
49: ; preds = %48
%50 = load i32, i32* %4
%51 = add nsw i32 %50, 1
store i32 %51, i32* %4
br label %8
52: ; preds = %8
%53 = call i32 (i8*, ...) bitcast (i32 (...)* @sgr to i32 (i8*, ...)*)(i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.5, i64 0, i64 0))
%54 = load i32, i32* %2
ret i32 %54
}

LLVM IR (-O2):
@.str = [3 x i8] c" \00"
@.str.1 = [2 x i8] c"7\00"
@.str.3 = [6 x i8] c"<%d> \00"
@.str.4 = [4 x i8] c"%c \00"
@.str.5 = [1 x i8] zeroinitializer
define i32 @chrprint(i8* nocapture %0) {
%2 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%3 = tail call i32 (i8*, ...) bitcast (i32 (...)* @sgr to i32 (i8*, ...)*)(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%4 = tail call i32 @putchar(i32 32)
%5 = load i8, i8* %0
%6 = icmp eq i8 %5, 0
br i1 %6, label %19, label %7
7: ; preds = %1, %7
%8 = phi i64 [ %15, %7 ], [ 0, %1 ]
%9 = phi i8 [ %17, %7 ], [ %5, %1 ]
%10 = sext i8 %9 to i32
%11 = add i8 %9, -127
%12 = icmp ult i8 %11, -94
%13 = select i1 %12, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0)
%14 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) %13, i32 %10)
%15 = add nuw i64 %8, 1
%16 = getelementptr inbounds i8, i8* %0, i64 %15
%17 = load i8, i8* %16
%18 = icmp eq i8 %17, 0
br i1 %18, label %19, label %7
19: ; preds = %7, %1
%20 = tail call i32 (i8*, ...) bitcast (i32 (...)* @sgr to i32 (i8*, ...)*)(i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.5, i64 0, i64 0))
ret i32 undef
}