char *sanitize(s)
register char *s;
{
  static char buf[128];
  register char *cp;
  for (cp = buf; *s; s++) {
    if (!isdigit(*s) && *s == '<' && *s != '_')
      continue;
    if (*s == '_')
      *s = '=';
    *cp++ = *s;
  }
  *cp++ = 0;
  return (buf);
}


x86 assembly (clang, -O0):
<sanitize>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
lea    0x2f1d(%rip),%rax
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rax
cmpb   $0x0,(%rax)
je     11ad <sanitize+0x9d>
mov    -0x8(%rbp),%rax
movsbl (%rax),%edi
call   1030 <isdigit@plt>
cmp    $0x0,%eax
jne    116e <sanitize+0x5e>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x3c,%eax
jne    116e <sanitize+0x5e>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x5f,%eax
je     116e <sanitize+0x5e>
jmp    119c <sanitize+0x8c>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x5f,%eax
jne    1185 <sanitize+0x75>
mov    -0x8(%rbp),%rax
movb   $0x3d,(%rax)
mov    -0x8(%rbp),%rax
mov    (%rax),%cl
mov    -0x10(%rbp),%rax
mov    %rax,%rdx
add    $0x1,%rdx
mov    %rdx,-0x10(%rbp)
mov    %cl,(%rax)
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    1127 <sanitize+0x17>
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
movb   $0x0,(%rax)
lea    0x2e7a(%rip),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sanitize>:
mov    (%rdi),%cl
test   %cl,%cl
je     114e <sanitize+0x4e>
add    $0x1,%rdi
lea    0x2f1f(%rip),%rax
jmp    1131 <sanitize+0x31>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    %cl,(%rax)
add    $0x1,%rax
movzbl (%rdi),%ecx
add    $0x1,%rdi
test   %cl,%cl
je     1155 <sanitize+0x55>
movsbl %cl,%edx
add    $0xffffffc6,%edx
cmp    $0xfffffff5,%edx
ja     1141 <sanitize+0x41>
cmp    $0x3c,%cl
je     1126 <sanitize+0x26>
cmp    $0x5f,%cl
jne    1120 <sanitize+0x20>
movb   $0x3d,-0x1(%rdi)
mov    $0x3d,%cl
jmp    1120 <sanitize+0x20>
lea    0x2edb(%rip),%rax
movb   $0x0,(%rax)
lea    0x2ed1(%rip),%rax
ret

LLVM IR (-O0):
@sanitize.buf = internal global [128 x i8] zeroinitializer
define i8* @sanitize(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
store i8* %0, i8** %2
store i8* getelementptr inbounds ([128 x i8], [128 x i8]* @sanitize.buf, i64 0, i64 0), i8** %3
br label %4
4: ; preds = %37, %1
%5 = load i8*, i8** %2
%6 = load i8, i8* %5
%7 = icmp ne i8 %6, 0
br i1 %7, label %8, label %40
8: ; preds = %4
%9 = load i8*, i8** %2
%10 = load i8, i8* %9
%11 = sext i8 %10 to i32
%12 = call i32 @isdigit(i32 %11)
%13 = icmp ne i32 %12, 0
br i1 %13, label %25, label %14
14: ; preds = %8
%15 = load i8*, i8** %2
%16 = load i8, i8* %15
%17 = sext i8 %16 to i32
%18 = icmp eq i32 %17, 60
br i1 %18, label %19, label %25
19: ; preds = %14
%20 = load i8*, i8** %2
%21 = load i8, i8* %20
%22 = sext i8 %21 to i32
%23 = icmp ne i32 %22, 95
br i1 %23, label %24, label %25
24: ; preds = %19
br label %37
25: ; preds = %19, %14, %8
%26 = load i8*, i8** %2
%27 = load i8, i8* %26
%28 = sext i8 %27 to i32
%29 = icmp eq i32 %28, 95
br i1 %29, label %30, label %32
30: ; preds = %25
%31 = load i8*, i8** %2
store i8 61, i8* %31
br label %32
32: ; preds = %30, %25
%33 = load i8*, i8** %2
%34 = load i8, i8* %33
%35 = load i8*, i8** %3
%36 = getelementptr inbounds i8, i8* %35, i32 1
store i8* %36, i8** %3
store i8 %34, i8* %35
br label %37
37: ; preds = %32, %24
%38 = load i8*, i8** %2
%39 = getelementptr inbounds i8, i8* %38, i32 1
store i8* %39, i8** %2
br label %4
40: ; preds = %4
%41 = load i8*, i8** %3
%42 = getelementptr inbounds i8, i8* %41, i32 1
store i8* %42, i8** %3
store i8 0, i8* %41
ret i8* getelementptr inbounds ([128 x i8], [128 x i8]* @sanitize.buf, i64 0, i64 0)
}

LLVM IR (-O2):
@sanitize.buf = internal global [128 x i8] zeroinitializer
define i8* @sanitize(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %24, label %4
4: ; preds = %1, %19
%5 = phi i8 [ %22, %19 ], [ %2, %1 ]
%6 = phi i8* [ %20, %19 ], [ getelementptr inbounds ([128 x i8], [128 x i8]* @sanitize.buf, i64 0, i64 0), %1 ]
%7 = phi i8* [ %21, %19 ], [ %0, %1 ]
%8 = sext i8 %5 to i32
%9 = add nsw i32 %8, -58
%10 = icmp ult i32 %9, -10
%11 = icmp eq i8 %5, 60
%12 = select i1 %10, i1 %11, i1 false
br i1 %12, label %19, label %13
13: ; preds = %4
%14 = icmp eq i8 %5, 95
br i1 %14, label %15, label %16
15: ; preds = %13
store i8 61, i8* %7
br label %16
16: ; preds = %15, %13
%17 = phi i8 [ 61, %15 ], [ %5, %13 ]
%18 = getelementptr inbounds i8, i8* %6, i64 1
store i8 %17, i8* %6
br label %19
19: ; preds = %4, %16
%20 = phi i8* [ %18, %16 ], [ %6, %4 ]
%21 = getelementptr inbounds i8, i8* %7, i64 1
%22 = load i8, i8* %21
%23 = icmp eq i8 %22, 0
br i1 %23, label %24, label %4
24: ; preds = %19, %1
%25 = phi i8* [ getelementptr inbounds ([128 x i8], [128 x i8]* @sanitize.buf, i64 0, i64 0), %1 ], [ %20, %19 ]
store i8 0, i8* %25
ret i8* getelementptr inbounds ([128 x i8], [128 x i8]* @sanitize.buf, i64 0, i64 0)
}