char *CodeFilter(s)
char *s;
{
  static char aux[20];
  char *t, *p;
  int i;
  t = aux;
  for (p = s, i = 0; *p; p++) {
    if (isalnum(*p))
      t[i++] = *p;
  }
  t[i] = 0;
  return t;
}


x86 assembly (clang, -O0):
<CodeFilter>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
lea    0x2f1d(%rip),%rax
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
mov    -0x18(%rbp),%rax
cmpb   $0x0,(%rax)
je     1189 <CodeFilter+0x79>
mov    -0x18(%rbp),%rax
movsbl (%rax),%edi
call   1030 <isalnum@plt>
cmp    $0x0,%eax
je     1173 <CodeFilter+0x63>
mov    -0x18(%rbp),%rax
mov    (%rax),%dl
mov    -0x10(%rbp),%rax
mov    -0x1c(%rbp),%ecx
mov    %ecx,%esi
add    $0x1,%esi
mov    %esi,-0x1c(%rbp)
movslq %ecx,%rcx
mov    %dl,(%rax,%rcx,1)
jmp    1178 <CodeFilter+0x68>
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    1136 <CodeFilter+0x26>
mov    -0x10(%rbp),%rax
movslq -0x1c(%rbp),%rcx
movb   $0x0,(%rax,%rcx,1)
mov    -0x10(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<CodeFilter>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    (%rdi),%r15b
test   %r15b,%r15b
je     1166 <CodeFilter+0x56>
mov    %rdi,%rbx
add    $0x1,%rbx
xor    %ebp,%ebp
lea    0x2f11(%rip),%r14
jmp    114d <CodeFilter+0x3d>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
movzbl (%rbx),%r15d
add    $0x1,%rbx
test   %r15b,%r15b
je     1168 <CodeFilter+0x58>
movsbl %r15b,%edi
call   1030 <isalnum@plt>
test   %eax,%eax
je     1140 <CodeFilter+0x30>
movslq %ebp,%rax
add    $0x1,%ebp
mov    %r15b,(%rax,%r14,1)
jmp    1140 <CodeFilter+0x30>
xor    %ebp,%ebp
movslq %ebp,%rcx
lea    0x2ece(%rip),%rax
movb   $0x0,(%rcx,%rax,1)
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@CodeFilter.aux = internal global [20 x i8] zeroinitializer
define i8* @CodeFilter(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i32
store i8* %0, i8** %2
store i8* getelementptr inbounds ([20 x i8], [20 x i8]* @CodeFilter.aux, i64 0, i64 0), i8** %3
%6 = load i8*, i8** %2
store i8* %6, i8** %4
store i32 0, i32* %5
br label %7
7: ; preds = %26, %1
%8 = load i8*, i8** %4
%9 = load i8, i8* %8
%10 = icmp ne i8 %9, 0
br i1 %10, label %11, label %29
11: ; preds = %7
%12 = load i8*, i8** %4
%13 = load i8, i8* %12
%14 = sext i8 %13 to i32
%15 = call i32 @isalnum(i32 %14)
%16 = icmp ne i32 %15, 0
br i1 %16, label %17, label %25
17: ; preds = %11
%18 = load i8*, i8** %4
%19 = load i8, i8* %18
%20 = load i8*, i8** %3
%21 = load i32, i32* %5
%22 = add nsw i32 %21, 1
store i32 %22, i32* %5
%23 = sext i32 %21 to i64
%24 = getelementptr inbounds i8, i8* %20, i64 %23
store i8 %19, i8* %24
br label %25
25: ; preds = %17, %11
br label %26
26: ; preds = %25
%27 = load i8*, i8** %4
%28 = getelementptr inbounds i8, i8* %27, i32 1
store i8* %28, i8** %4
br label %7
29: ; preds = %7
%30 = load i8*, i8** %3
%31 = load i32, i32* %5
%32 = sext i32 %31 to i64
%33 = getelementptr inbounds i8, i8* %30, i64 %32
store i8 0, i8* %33
%34 = load i8*, i8** %3
ret i8* %34
}

LLVM IR (-O2):
@CodeFilter.aux = internal global [20 x i8] zeroinitializer
define i8* @CodeFilter(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %20, label %4
4: ; preds = %1, %15
%5 = phi i8 [ %18, %15 ], [ %2, %1 ]
%6 = phi i32 [ %16, %15 ], [ 0, %1 ]
%7 = phi i8* [ %17, %15 ], [ %0, %1 ]
%8 = sext i8 %5 to i32
%9 = tail call i32 @isalnum(i32 %8)
%10 = icmp eq i32 %9, 0
br i1 %10, label %15, label %11
11: ; preds = %4
%12 = add nsw i32 %6, 1
%13 = sext i32 %6 to i64
%14 = getelementptr inbounds [20 x i8], [20 x i8]* @CodeFilter.aux, i64 0, i64 %13
store i8 %5, i8* %14
br label %15
15: ; preds = %4, %11
%16 = phi i32 [ %12, %11 ], [ %6, %4 ]
%17 = getelementptr inbounds i8, i8* %7, i64 1
%18 = load i8, i8* %17
%19 = icmp eq i8 %18, 0
br i1 %19, label %20, label %4
20: ; preds = %15, %1
%21 = phi i32 [ 0, %1 ], [ %16, %15 ]
%22 = sext i32 %21 to i64
%23 = getelementptr inbounds [20 x i8], [20 x i8]* @CodeFilter.aux, i64 0, i64 %22
store i8 0, i8* %23
ret i8* getelementptr inbounds ([20 x i8], [20 x i8]* @CodeFilter.aux, i64 0, i64 0)
}