#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);
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,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
cmpb   $0x0,(%rax)
je     1188 <sanitize+0x78>
mov    -0x18(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x2f,%eax
je     115b <sanitize+0x4b>
mov    -0x18(%rbp),%rax
movsbl (%rax),%edi
call   1030 <isalnum@plt>
cmp    $0x0,%rax
je     1172 <sanitize+0x62>
mov    -0x18(%rbp),%rax
mov    (%rax),%cl
mov    -0x20(%rbp),%rax
mov    %rax,%rdx
add    $0x1,%rdx
mov    %rdx,-0x20(%rbp)
mov    %cl,(%rax)
jmp    1177 <sanitize+0x67>
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    1128 <sanitize+0x18>
mov    -0x20(%rbp),%rax
movb   $0x0,(%rax)
mov    -0x4(%rbp),%eax
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 i32 @sanitize(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i8*
store i8* %0, i8** %3
%6 = load i8*, i8** %3
store i8* %6, i8** %5
store i8* %6, i8** %4
br label %7
7: ; preds = %27, %1
%8 = load i8*, i8** %4
%9 = load i8, i8* %8
%10 = icmp ne i8 %9, 0
br i1 %10, label %11, label %30
11: ; preds = %7
%12 = load i8*, i8** %4
%13 = load i8, i8* %12
%14 = sext i8 %13 to i32
%15 = icmp eq i32 %14, 47
br i1 %15, label %21, label %16
16: ; preds = %11
%17 = load i8*, i8** %4
%18 = load i8, i8* %17
%19 = call i64 @isalnum(i8 signext %18)
%20 = icmp ne i64 %19, 0
br i1 %20, label %21, label %26
21: ; preds = %16, %11
%22 = load i8*, i8** %4
%23 = load i8, i8* %22
%24 = load i8*, i8** %5
%25 = getelementptr inbounds i8, i8* %24, i32 1
store i8* %25, i8** %5
store i8 %23, i8* %24
br label %26
26: ; preds = %21, %16
br label %27
27: ; preds = %26
%28 = load i8*, i8** %4
%29 = getelementptr inbounds i8, i8* %28, i32 1
store i8* %29, i8** %4
br label %7
30: ; preds = %7
%31 = load i8*, i8** %5
store i8 0, i8* %31
%32 = load i32, i32* %2
ret i32 %32
}

LLVM IR (-O2):
define i32 @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 i32 undef
}