#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 */
int /*<<< orphan*/ strspn(char *, char *);
void htmlstrip(char *s) {
  while (s && *s) {
    s += strspn(
        s, "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ,. ");
    if (*s)
      *s++ = '?';
  }
}


x86 assembly (clang, -O0):
<htmlstrip>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
xor    %eax,%eax
cmpq   $0x0,-0x8(%rbp)
mov    %al,-0x9(%rbp)
je     113c <htmlstrip+0x2c>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
setne  %al
mov    %al,-0x9(%rbp)
mov    -0x9(%rbp),%al
test   $0x1,%al
jne    114c <htmlstrip+0x3c>
jmp    1190 <htmlstrip+0x80>
mov    -0x8(%rbp),%rdi
lea    0xea9(%rip),%rsi
call   1030 <strspn@plt>
mov    %eax,%ecx
mov    -0x8(%rbp),%rax
movslq %ecx,%rcx
add    %rcx,%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
cmpb   $0x0,(%rax)
je     118b <htmlstrip+0x7b>
mov    -0x8(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x8(%rbp)
movb   $0x3f,(%rax)
jmp    111c <htmlstrip+0xc>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<htmlstrip>:
push   %r14
push   %rbx
push   %rax
test   %rdi,%rdi
je     1159 <htmlstrip+0x49>
mov    %rdi,%rbx
cmpb   $0x0,(%rdi)
je     1159 <htmlstrip+0x49>
lea    0xed8(%rip),%r14
jmp    1138 <htmlstrip+0x28>
nopw   0x0(%rax,%rax,1)
cmpb   $0x0,(%rax)
mov    %rax,%rbx
je     1159 <htmlstrip+0x49>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1030 <strspn@plt>
movslq %eax,%rcx
lea    (%rbx,%rcx,1),%rax
cmpb   $0x0,(%rbx,%rcx,1)
je     1130 <htmlstrip+0x20>
movb   $0x3f,(%rax)
add    $0x1,%rax
jmp    1130 <htmlstrip+0x20>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [66 x i8] c"0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ,. \00"
define void @htmlstrip(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
br label %3
3: ; preds = %25, %1
%4 = load i8*, i8** %2
%5 = icmp ne i8* %4, null
br i1 %5, label %6, label %11
6: ; preds = %3
%7 = load i8*, i8** %2
%8 = load i8, i8* %7
%9 = sext i8 %8 to i32
%10 = icmp ne i32 %9, 0
br label %11
11: ; preds = %6, %3
%12 = phi i1 [ false, %3 ], [ %10, %6 ]
br i1 %12, label %13, label %26
13: ; preds = %11
%14 = load i8*, i8** %2
%15 = call i32 @strspn(i8* %14, i8* getelementptr inbounds ([66 x i8], [66 x i8]* @.str, i64 0, i64 0))
%16 = load i8*, i8** %2
%17 = sext i32 %15 to i64
%18 = getelementptr inbounds i8, i8* %16, i64 %17
store i8* %18, i8** %2
%19 = load i8*, i8** %2
%20 = load i8, i8* %19
%21 = icmp ne i8 %20, 0
br i1 %21, label %22, label %25
22: ; preds = %13
%23 = load i8*, i8** %2
%24 = getelementptr inbounds i8, i8* %23, i32 1
store i8* %24, i8** %2
store i8 63, i8* %23
br label %25
25: ; preds = %22, %13
br label %3
26: ; preds = %11
ret void
}

LLVM IR (-O2):
@.str = [66 x i8] c"0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ,. \00"
define void @htmlstrip(i8* %0) {
%2 = icmp eq i8* %0, null
br i1 %2, label %19, label %3
3: ; preds = %1
%4 = load i8, i8* %0
%5 = icmp eq i8 %4, 0
br i1 %5, label %19, label %6
6: ; preds = %3, %15
%7 = phi i8* [ %16, %15 ], [ %0, %3 ]
%8 = tail call i32 @strspn(i8* %7, i8* getelementptr inbounds ([66 x i8], [66 x i8]* @.str, i64 0, i64 0))
%9 = sext i32 %8 to i64
%10 = getelementptr inbounds i8, i8* %7, i64 %9
%11 = load i8, i8* %10
%12 = icmp eq i8 %11, 0
br i1 %12, label %15, label %13
13: ; preds = %6
%14 = getelementptr inbounds i8, i8* %10, i64 1
store i8 63, i8* %10
br label %15
15: ; preds = %13, %6
%16 = phi i8* [ %14, %13 ], [ %10, %6 ]
%17 = load i8, i8* %16
%18 = icmp eq i8 %17, 0
br i1 %18, label %19, label %6
19: ; preds = %15, %3, %1
ret void
}