#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 const *, char);
void tor_strstrip(char *s, const char *strip) {
  char *read = s;
  while (*read) {
    if (strchr(strip, *read)) {
      ++read;
    } else {
      *s++ = *read++;
    }
  }
  *s = '\0';
}


x86 assembly (clang, -O0):
<tor_strstrip>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
cmpb   $0x0,(%rax)
je     1187 <tor_strstrip+0x77>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rax
movsbl (%rax),%esi
call   1030 <strchr@plt>
cmp    $0x0,%rax
je     1160 <tor_strstrip+0x50>
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    1182 <tor_strstrip+0x72>
mov    -0x18(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x18(%rbp)
mov    (%rax),%cl
mov    -0x8(%rbp),%rax
mov    %rax,%rdx
add    $0x1,%rdx
mov    %rdx,-0x8(%rbp)
mov    %cl,(%rax)
jmp    1128 <tor_strstrip+0x18>
mov    -0x8(%rbp),%rax
movb   $0x0,(%rax)
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<tor_strstrip>:
push   %r15
push   %r14
push   %rbx
mov    %rdi,%r15
mov    (%rdi),%al
test   %al,%al
je     1158 <tor_strstrip+0x48>
mov    %rsi,%r14
lea    0x1(%r15),%rbx
jmp    113b <tor_strstrip+0x2b>
nopw   0x0(%rax,%rax,1)
movzbl (%rbx),%eax
add    $0x1,%rbx
test   %al,%al
je     1158 <tor_strstrip+0x48>
movsbl %al,%esi
mov    %r14,%rdi
call   1030 <strchr@plt>
test   %rax,%rax
jne    1130 <tor_strstrip+0x20>
movzbl -0x1(%rbx),%eax
mov    %al,(%r15)
add    $0x1,%r15
jmp    1130 <tor_strstrip+0x20>
movb   $0x0,(%r15)
pop    %rbx
pop    %r14
pop    %r15
ret

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

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