void printchar(c) char c;
{
  if (c < 040 || c >= 0177) {
    putchar('\\');
    putchar(((c >> 6) & 3) + '0');
    putchar(((c >> 3) & 7) + '0');
    putchar((c & 7) + '0');
  } else
    putchar(c);
}


x86 assembly (clang, -O0):
<printchar>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%eax
cmp    $0x20,%eax
jl     1138 <printchar+0x28>
movsbl -0x1(%rbp),%eax
cmp    $0x7f,%eax
jl     1182 <printchar+0x72>
mov    $0x5c,%edi
mov    $0x0,%al
call   1030 <putchar@plt>
movsbl -0x1(%rbp),%edi
sar    $0x6,%edi
and    $0x3,%edi
add    $0x30,%edi
mov    $0x0,%al
call   1030 <putchar@plt>
movsbl -0x1(%rbp),%edi
sar    $0x3,%edi
and    $0x7,%edi
add    $0x30,%edi
mov    $0x0,%al
call   1030 <putchar@plt>
movsbl -0x1(%rbp),%edi
and    $0x7,%edi
add    $0x30,%edi
mov    $0x0,%al
call   1030 <putchar@plt>
jmp    118d <printchar+0x7d>
movsbl -0x1(%rbp),%edi
mov    $0x0,%al
call   1030 <putchar@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<printchar>:
push   %rbp
push   %rbx
push   %rax
mov    %edi,%ebp
mov    %edi,%ebx
shl    $0x18,%ebx
lea    -0x7e000001(%rbx),%eax
cmp    $0xa1fffffe,%eax
ja     115c <printchar+0x4c>
mov    $0x5c,%edi
xor    %eax,%eax
call   1030 <putchar@plt>
mov    %ebx,%edi
shr    $0x1e,%edi
or     $0x30,%edi
xor    %eax,%eax
call   1030 <putchar@plt>
shr    $0x1b,%ebx
and    $0x7,%ebx
or     $0x30,%ebx
mov    %ebx,%edi
xor    %eax,%eax
call   1030 <putchar@plt>
and    $0x7,%ebp
or     $0x30,%ebp
jmp    1160 <printchar+0x50>
movzbl %bpl,%ebp
mov    %ebp,%edi
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1030 <putchar@plt>

LLVM IR (-O0):
define void @printchar(i32 %0) {
%2 = alloca i8
%3 = trunc i32 %0 to i8
store i8 %3, i8* %2
%4 = load i8, i8* %2
%5 = sext i8 %4 to i32
%6 = icmp slt i32 %5, 32
br i1 %6, label %11, label %7
7: ; preds = %1
%8 = load i8, i8* %2
%9 = sext i8 %8 to i32
%10 = icmp sge i32 %9, 127
br i1 %10, label %11, label %30
11: ; preds = %7, %1
%12 = call i32 (i32, ...) bitcast (i32 (...)* @putchar to i32 (i32, ...)*)(i32 92)
%13 = load i8, i8* %2
%14 = sext i8 %13 to i32
%15 = ashr i32 %14, 6
%16 = and i32 %15, 3
%17 = add nsw i32 %16, 48
%18 = call i32 (i32, ...) bitcast (i32 (...)* @putchar to i32 (i32, ...)*)(i32 %17)
%19 = load i8, i8* %2
%20 = sext i8 %19 to i32
%21 = ashr i32 %20, 3
%22 = and i32 %21, 7
%23 = add nsw i32 %22, 48
%24 = call i32 (i32, ...) bitcast (i32 (...)* @putchar to i32 (i32, ...)*)(i32 %23)
%25 = load i8, i8* %2
%26 = sext i8 %25 to i32
%27 = and i32 %26, 7
%28 = add nsw i32 %27, 48
%29 = call i32 (i32, ...) bitcast (i32 (...)* @putchar to i32 (i32, ...)*)(i32 %28)
br label %34
30: ; preds = %7
%31 = load i8, i8* %2
%32 = sext i8 %31 to i32
%33 = call i32 (i32, ...) bitcast (i32 (...)* @putchar to i32 (i32, ...)*)(i32 %32)
br label %34
34: ; preds = %30, %11
ret void
}

LLVM IR (-O2):
define void @printchar(i32 %0) {
%2 = shl i32 %0, 24
%3 = add i32 %2, -2113929217
%4 = icmp ult i32 %3, -1577058305
br i1 %4, label %5, label %16
5: ; preds = %1
%6 = tail call i32 (i32, ...) bitcast (i32 (...)* @putchar to i32 (i32, ...)*)(i32 92)
%7 = lshr i32 %2, 30
%8 = or i32 %7, 48
%9 = tail call i32 (i32, ...) bitcast (i32 (...)* @putchar to i32 (i32, ...)*)(i32 %8)
%10 = lshr i32 %2, 27
%11 = and i32 %10, 7
%12 = or i32 %11, 48
%13 = tail call i32 (i32, ...) bitcast (i32 (...)* @putchar to i32 (i32, ...)*)(i32 %12)
%14 = and i32 %0, 7
%15 = or i32 %14, 48
br label %18
16: ; preds = %1
%17 = and i32 %0, 255
br label %18
18: ; preds = %16, %5
%19 = phi i32 [ %17, %16 ], [ %15, %5 ]
%20 = tail call i32 (i32, ...) bitcast (i32 (...)* @putchar to i32 (i32, ...)*)(i32 %19)
ret void
}