void putsesc(a) const char *a;
{
  int c, k;
  for (c = 0;; putcesc(c = k))
    switch (k = *a++) {
    case '\0':
      return;
    case '|':
    case ':':
      if (c != ' ')
        printf("\\\\h'-\\\\w' 'u' ");
    }
}


x86 assembly (clang, -O0):
<putsesc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x8(%rbp)
movsbl (%rax),%eax
mov    %eax,-0x14(%rbp)
mov    %eax,-0x10(%rbp)
test   %eax,%eax
je     117a <putsesc+0x5a>
jmp    1158 <putsesc+0x38>
mov    -0x14(%rbp),%eax
sub    $0x3a,%eax
je     1180 <putsesc+0x60>
jmp    1169 <putsesc+0x49>
mov    -0x14(%rbp),%eax
sub    $0x7c,%eax
je     1180 <putsesc+0x60>
jmp    119d <putsesc+0x7d>
add    $0x20,%rsp
pop    %rbp
ret
cmpl   $0x20,-0xc(%rbp)
je     1198 <putsesc+0x78>
lea    0xe6f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    119d <putsesc+0x7d>
jmp    11a2 <putsesc+0x82>
mov    -0x10(%rbp),%edi
mov    %edi,-0xc(%rbp)
mov    $0x0,%al
call   1040 <putcesc@plt>
jmp    1133 <putsesc+0x13>

x86 assembly (clang, -O2):
<putsesc>:
push   %rbp
push   %r14
push   %rbx
mov    %rdi,%rbx
lea    0xed2(%rip),%r14
xor    %eax,%eax
jmp    1153 <putsesc+0x33>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
test   %ebp,%ebp
je     1171 <putsesc+0x51>
add    $0x1,%rbx
mov    %ebp,%edi
xor    %eax,%eax
call   1040 <putcesc@plt>
mov    %ebp,%eax
movsbl (%rbx),%ebp
cmp    $0x3a,%ebp
je     1160 <putsesc+0x40>
cmp    $0x7c,%ebp
jne    1140 <putsesc+0x20>
cmp    $0x20,%eax
je     1144 <putsesc+0x24>
mov    %r14,%rdi
xor    %eax,%eax
call   1030 <printf@plt>
jmp    1144 <putsesc+0x24>
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [15 x i8] c"\\\\h'-\\\\w' 'u' \00"
define void @putsesc(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
%4 = alloca i32
store i8* %0, i8** %2
store i32 0, i32* %3
br label %5
5: ; preds = %18, %1
%6 = load i8*, i8** %2
%7 = getelementptr inbounds i8, i8* %6, i32 1
store i8* %7, i8** %2
%8 = load i8, i8* %6
%9 = sext i8 %8 to i32
store i32 %9, i32* %4
switch i32 %9, label %17 [
i32 0, label %10
i32 124, label %11
i32 58, label %11
]
10: ; preds = %5
ret void
11: ; preds = %5, %5
%12 = load i32, i32* %3
%13 = icmp ne i32 %12, 32
br i1 %13, label %14, label %16
14: ; preds = %11
%15 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
br label %16
16: ; preds = %14, %11
br label %17
17: ; preds = %16, %5
br label %18
18: ; preds = %17
%19 = load i32, i32* %4
store i32 %19, i32* %3
%20 = call i32 (i32, ...) bitcast (i32 (...)* @putcesc to i32 (i32, ...)*)(i32 %19)
br label %5
}

LLVM IR (-O2):
@.str = [15 x i8] c"\\\\h'-\\\\w' 'u' \00"
define void @putsesc(i8* nocapture %0) {
br label %2
2: ; preds = %13, %1
%3 = phi i32 [ 0, %1 ], [ %7, %13 ]
%4 = phi i8* [ %0, %1 ], [ %5, %13 ]
%5 = getelementptr inbounds i8, i8* %4, i64 1
%6 = load i8, i8* %4
%7 = sext i8 %6 to i32
switch i32 %7, label %13 [
i32 0, label %8
i32 124, label %9
i32 58, label %9
]
8: ; preds = %2
ret void
9: ; preds = %2, %2
%10 = icmp eq i32 %3, 32
br i1 %10, label %13, label %11
11: ; preds = %9
%12 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
br label %13
13: ; preds = %2, %11, %9
%14 = tail call i32 (i32, ...) bitcast (i32 (...)* @putcesc to i32 (i32, ...)*)(i32 %7)
br label %2
}