#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*/ *strchr(char *, char);
size_t strlen(char *);
char *strxfilter(char *s, char *allowedChars, char c) {
  size_t ii;
  for (ii = 0; ii < strlen(s); ++ii)
    if (strchr(allowedChars, s[ii]) == NULL)
      s[ii] = c;
  return s;
}


x86 assembly (clang, -O0):
<strxfilter>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %dl,%al
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %al,-0x11(%rbp)
movq   $0x0,-0x20(%rbp)
mov    -0x20(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
mov    %rax,%rcx
mov    -0x28(%rbp),%rax
cmp    %rcx,%rax
jae    11a1 <strxfilter+0x81>
mov    -0x10(%rbp),%rdi
mov    -0x8(%rbp),%rax
mov    -0x20(%rbp),%rcx
movsbl (%rax,%rcx,1),%esi
call   1040 <strchr@plt>
cmp    $0x0,%rax
jne    118b <strxfilter+0x6b>
mov    -0x11(%rbp),%dl
mov    -0x8(%rbp),%rax
mov    -0x20(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
jmp    1190 <strxfilter+0x70>
mov    -0x20(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x20(%rbp)
jmp    113d <strxfilter+0x1d>
mov    -0x8(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<strxfilter>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %rdi,%rbx
mov    (%rdi),%al
test   %al,%al
je     116c <strxfilter+0x4c>
mov    %edx,%r14d
mov    %rsi,%r15
mov    $0x1,%ebp
nopl   0x0(%rax,%rax,1)
movsbl %al,%esi
mov    %r15,%rdi
call   1040 <strchr@plt>
test   %rax,%rax
jne    1155 <strxfilter+0x35>
mov    %r14b,-0x1(%rbx,%rbp,1)
mov    %rbx,%rdi
call   1030 <strlen@plt>
cmp    %rax,%rbp
jae    116c <strxfilter+0x4c>
movzbl (%rbx,%rbp,1),%eax
add    $0x1,%rbp
jmp    1140 <strxfilter+0x20>
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
define i8* @strxfilter(i8* returned %0, i8* %1, i8 signext %2) {
%4 = load i8, i8* %0
%5 = icmp eq i8 %4, 0
br i1 %5, label %20, label %6
6: ; preds = %3, %17
%7 = phi i8 [ %19, %17 ], [ %4, %3 ]
%8 = phi i64 [ %14, %17 ], [ 0, %3 ]
%9 = tail call i32* @strchr(i8* %1, i8 signext %7)
%10 = icmp eq i32* %9, null
br i1 %10, label %11, label %13
11: ; preds = %6
%12 = getelementptr inbounds i8, i8* %0, i64 %8
store i8 %2, i8* %12
br label %13
13: ; preds = %6, %11
%14 = add nuw i64 %8, 1
%15 = tail call i64 @strlen(i8* dereferenceable(1) %0)
%16 = icmp ult i64 %14, %15
br i1 %16, label %17, label %20
17: ; preds = %13
%18 = getelementptr inbounds i8, i8* %0, i64 %14
%19 = load i8, i8* %18
br label %6
20: ; preds = %13, %3
ret i8* %0
}