#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 */
typedef size_t uint32_t;

/* Variables and functions */
char *strchr(char *, char);
size_t strlen(char *);
void clean_retbuf(char *retbuf, char *arrayofstrip) {
  uint32_t i;
  for (i = 0; i < strlen(arrayofstrip); ++i) {
    char *underCheck = strchr(retbuf, arrayofstrip[i]);
    if (underCheck != NULL)
      *underCheck = 0x00;
  }
}


x86 assembly (clang, -O0):
<clean_retbuf>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movq   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <strlen@plt>
mov    %rax,%rcx
mov    -0x28(%rbp),%rax
cmp    %rcx,%rax
jae    119a <clean_retbuf+0x7a>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rax
mov    -0x18(%rbp),%rcx
movsbl (%rax,%rcx,1),%esi
call   1040 <strchr@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
je     1184 <clean_retbuf+0x64>
mov    -0x20(%rbp),%rax
movb   $0x0,(%rax)
jmp    1189 <clean_retbuf+0x69>
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    1138 <clean_retbuf+0x18>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<clean_retbuf>:
push   %r15
push   %r14
push   %rbx
mov    (%rsi),%al
test   %al,%al
je     116b <clean_retbuf+0x4b>
mov    %rsi,%r15
mov    %rdi,%r14
mov    $0x1,%ebx
cs nopw 0x0(%rax,%rax,1)
movsbl %al,%esi
mov    %r14,%rdi
call   1040 <strchr@plt>
test   %rax,%rax
je     1153 <clean_retbuf+0x33>
movb   $0x0,(%rax)
mov    %r15,%rdi
call   1030 <strlen@plt>
cmp    %rax,%rbx
jae    116b <clean_retbuf+0x4b>
movzbl (%r15,%rbx,1),%eax
add    $0x1,%rbx
jmp    1140 <clean_retbuf+0x20>
pop    %rbx
pop    %r14
pop    %r15
ret

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

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