#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__ isalnum(char);
extern void sanitize(char *str) {
  char *src, *dest;
  for (src = dest = str; *src; src++)
    if (*src == '/' || isalnum(*src))
      *dest++ = *src;
  *dest = '\0';
}


x86 assembly (clang, -O0):
<sanitize>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
cmpb   $0x0,(%rax)
je     1188 <sanitize+0x78>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x2f,%eax
je     115b <sanitize+0x4b>
mov    -0x10(%rbp),%rax
movsbl (%rax),%edi
call   1030 <isalnum@plt>
cmp    $0x0,%rax
je     1172 <sanitize+0x62>
mov    -0x10(%rbp),%rax
mov    (%rax),%cl
mov    -0x18(%rbp),%rax
mov    %rax,%rdx
add    $0x1,%rdx
mov    %rdx,-0x18(%rbp)
mov    %cl,(%rax)
jmp    1177 <sanitize+0x67>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    1128 <sanitize+0x18>
mov    -0x18(%rbp),%rax
movb   $0x0,(%rax)
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sanitize>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%rbx
mov    %rdi,%r14
jmp    112b <sanitize+0x1b>
nopl   0x0(%rax)
mov    %al,(%r14)
add    $0x1,%r14
add    $0x1,%rbx
movzbl (%rbx),%eax
cmp    $0x2f,%al
je     1120 <sanitize+0x10>
test   %al,%al
je     1148 <sanitize+0x38>
movsbl %al,%edi
call   1030 <isalnum@plt>
test   %rax,%rax
je     1127 <sanitize+0x17>
movzbl (%rbx),%eax
jmp    1120 <sanitize+0x10>
movb   $0x0,(%r14)
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

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