#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */

/* Variables and functions */
scalar_t__ CharIsAlphanumeric(char);
void StringElimNonAlphanumeric(char *to) {
  char *from;
  from = to;
  while (*from) {
    if (CharIsAlphanumeric(*from)) {
      *to = *from;
      to++;
      from++;
    } else {
      from++;
    }
  }
  *to = '\0';
}


x86 assembly (clang, -O0):
<StringElimNonAlphanumeric>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
cmpb   $0x0,(%rax)
je     1181 <StringElimNonAlphanumeric+0x71>
mov    -0x10(%rbp),%rax
movsbl (%rax),%edi
call   1030 <CharIsAlphanumeric@plt>
cmp    $0x0,%rax
je     1170 <StringElimNonAlphanumeric+0x60>
mov    -0x10(%rbp),%rax
mov    (%rax),%cl
mov    -0x8(%rbp),%rax
mov    %cl,(%rax)
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    117c <StringElimNonAlphanumeric+0x6c>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    1124 <StringElimNonAlphanumeric+0x14>
mov    -0x8(%rbp),%rax
movb   $0x0,(%rax)
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<StringElimNonAlphanumeric>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
mov    (%rdi),%al
test   %al,%al
je     1155 <StringElimNonAlphanumeric+0x45>
lea    0x1(%r14),%rbx
jmp    113b <StringElimNonAlphanumeric+0x2b>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
movzbl (%rbx),%eax
add    $0x1,%rbx
test   %al,%al
je     1155 <StringElimNonAlphanumeric+0x45>
movsbl %al,%edi
call   1030 <CharIsAlphanumeric@plt>
test   %rax,%rax
je     1130 <StringElimNonAlphanumeric+0x20>
movzbl -0x1(%rbx),%eax
mov    %al,(%r14)
add    $0x1,%r14
jmp    1130 <StringElimNonAlphanumeric+0x20>
movb   $0x0,(%r14)
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define void @StringElimNonAlphanumeric(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
store i8* %0, i8** %2
%4 = load i8*, i8** %2
store i8* %4, i8** %3
br label %5
5: ; preds = %25, %1
%6 = load i8*, i8** %3
%7 = load i8, i8* %6
%8 = icmp ne i8 %7, 0
br i1 %8, label %9, label %26
9: ; preds = %5
%10 = load i8*, i8** %3
%11 = load i8, i8* %10
%12 = call i64 @CharIsAlphanumeric(i8 signext %11)
%13 = icmp ne i64 %12, 0
br i1 %13, label %14, label %22
14: ; preds = %9
%15 = load i8*, i8** %3
%16 = load i8, i8* %15
%17 = load i8*, i8** %2
store i8 %16, i8* %17
%18 = load i8*, i8** %2
%19 = getelementptr inbounds i8, i8* %18, i32 1
store i8* %19, i8** %2
%20 = load i8*, i8** %3
%21 = getelementptr inbounds i8, i8* %20, i32 1
store i8* %21, i8** %3
br label %25
22: ; preds = %9
%23 = load i8*, i8** %3
%24 = getelementptr inbounds i8, i8* %23, i32 1
store i8* %24, i8** %3
br label %25
25: ; preds = %22, %14
br label %5
26: ; preds = %5
%27 = load i8*, i8** %2
store i8 0, i8* %27
ret void
}

LLVM IR (-O2):
define void @StringElimNonAlphanumeric(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %18, label %4
4: ; preds = %1, %13
%5 = phi i8 [ %16, %13 ], [ %2, %1 ]
%6 = phi i8* [ %15, %13 ], [ %0, %1 ]
%7 = phi i8* [ %14, %13 ], [ %0, %1 ]
%8 = tail call i64 @CharIsAlphanumeric(i8 signext %5)
%9 = icmp eq i64 %8, 0
br i1 %9, label %13, label %10
10: ; preds = %4
%11 = load i8, i8* %6
store i8 %11, i8* %7
%12 = getelementptr inbounds i8, i8* %7, i64 1
br label %13
13: ; preds = %4, %10
%14 = phi i8* [ %12, %10 ], [ %7, %4 ]
%15 = getelementptr inbounds i8, i8* %6, i64 1
%16 = load i8, i8* %15
%17 = icmp eq i8 %16, 0
br i1 %17, label %18, label %4
18: ; preds = %13, %1
%19 = phi i8* [ %0, %1 ], [ %14, %13 ]
store i8 0, i8* %19
ret void
}