#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__ strchr(char *, char);
char *name_char_validate(char *abc) {
  char key[] = "?<>\"'|/\\*", *p = abc, ch;
  while ((ch = *p)) {
    if (strchr(key, ch)) {
      *p = ' ';
    }
    p++;
  }
  return abc;
}


x86 assembly (clang, -O0):
<name_char_validate>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    0xedd(%rip),%rax
mov    %rax,-0x12(%rbp)
mov    0xeda(%rip),%ax
mov    %ax,-0xa(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
mov    (%rax),%al
mov    %al,-0x21(%rbp)
cmp    $0x0,%al
je     117a <name_char_validate+0x6a>
lea    -0x12(%rbp),%rdi
movsbl -0x21(%rbp),%esi
call   1030 <strchr@plt>
cmp    $0x0,%rax
je     1169 <name_char_validate+0x59>
mov    -0x20(%rbp),%rax
movb   $0x20,(%rax)
mov    -0x20(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x20(%rbp)
jmp    113a <name_char_validate+0x2a>
mov    -0x8(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<name_char_validate>:
push   %r15
push   %r14
push   %rbx
sub    $0x10,%rsp
mov    %rdi,%r14
movabs $0x5c2f7c27223e3c3f,%rax
7c 2f 5c
mov    %rax,(%rsp)
movw   $0x2a,0x8(%rsp)
mov    (%rdi),%al
test   %al,%al
je     1161 <name_char_validate+0x51>
lea    0x1(%r14),%rbx
mov    %rsp,%r15
jmp    114b <name_char_validate+0x3b>
movzbl (%rbx),%eax
add    $0x1,%rbx
test   %al,%al
je     1161 <name_char_validate+0x51>
movsbl %al,%esi
mov    %r15,%rdi
call   1030 <strchr@plt>
test   %rax,%rax
je     1140 <name_char_validate+0x30>
movb   $0x20,-0x1(%rbx)
jmp    1140 <name_char_validate+0x30>
mov    %r14,%rax
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@__const.name_char_validate.key = [10 x i8] c"?<>\22'|/\\*\00"
define i8* @name_char_validate(i8* %0) {
%2 = alloca i8*
%3 = alloca [10 x i8]
%4 = alloca i8*
%5 = alloca i8
store i8* %0, i8** %2
%6 = bitcast [10 x i8]* %3 to i8*
%7 = load i8*, i8** %2
store i8* %7, i8** %4
br label %8
8: ; preds = %19, %1
%9 = load i8*, i8** %4
%10 = load i8, i8* %9
store i8 %10, i8* %5
%11 = icmp ne i8 %10, 0
br i1 %11, label %12, label %22
12: ; preds = %8
%13 = getelementptr inbounds [10 x i8], [10 x i8]* %3, i64 0, i64 0
%14 = load i8, i8* %5
%15 = call i64 @strchr(i8* %13, i8 signext %14)
%16 = icmp ne i64 %15, 0
br i1 %16, label %17, label %19
17: ; preds = %12
%18 = load i8*, i8** %4
store i8 32, i8* %18
br label %19
19: ; preds = %17, %12
%20 = load i8*, i8** %4
%21 = getelementptr inbounds i8, i8* %20, i32 1
store i8* %21, i8** %4
br label %8
22: ; preds = %8
%23 = load i8*, i8** %2
ret i8* %23
}

LLVM IR (-O2):
@__const.name_char_validate.key = [10 x i8] c"?<>\22'|/\\*\00"
define i8* @name_char_validate(i8* returned %0) {
%2 = alloca [10 x i8]
%3 = getelementptr inbounds [10 x i8], [10 x i8]* %2, i64 0, i64 0
%4 = load i8, i8* %0
%5 = icmp eq i8 %4, 0
br i1 %5, label %16, label %6
6: ; preds = %1, %12
%7 = phi i8 [ %14, %12 ], [ %4, %1 ]
%8 = phi i8* [ %13, %12 ], [ %0, %1 ]
%9 = call i64 @strchr(i8* %3, i8 signext %7)
%10 = icmp eq i64 %9, 0
br i1 %10, label %12, label %11
11: ; preds = %6
store i8 32, i8* %8
br label %12
12: ; preds = %11, %6
%13 = getelementptr inbounds i8, i8* %8, i64 1
%14 = load i8, i8* %13
%15 = icmp eq i8 %14, 0
br i1 %15, label %16, label %6
16: ; preds = %12, %1
ret i8* %0
}