#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*/ isascii(char const);
void stripBadChar(const char *from, char *to) {
  if (from == NULL)
    return;
  while (*from != '\0') {
    switch (*from) {
    case '|':
      *to++ = 'l';
      break;
    case '`':
      *to++ = '\'';
      break;
    case '/':
    case '\\':
      break;
    default:
      if (isascii(*from))
        *to++ = *from;
      break;
    }
    from++;
  }
  *to = '\0';
}


x86 assembly (clang, -O0):
<stripBadChar>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpq   $0x0,-0x8(%rbp)
jne    1130 <stripBadChar+0x20>
jmp    120c <stripBadChar+0xfc>
jmp    1135 <stripBadChar+0x25>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     1205 <stripBadChar+0xf5>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
mov    %eax,-0x14(%rbp)
sub    $0x2f,%eax
je     11be <stripBadChar+0xae>
jmp    115d <stripBadChar+0x4d>
mov    -0x14(%rbp),%eax
sub    $0x5c,%eax
je     11be <stripBadChar+0xae>
jmp    116e <stripBadChar+0x5e>
mov    -0x14(%rbp),%eax
sub    $0x60,%eax
je     11a7 <stripBadChar+0x97>
jmp    117f <stripBadChar+0x6f>
mov    -0x14(%rbp),%eax
sub    $0x7c,%eax
jne    11c3 <stripBadChar+0xb3>
jmp    1190 <stripBadChar+0x80>
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
movb   $0x6c,(%rax)
jmp    11f4 <stripBadChar+0xe4>
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
movb   $0x27,(%rax)
jmp    11f4 <stripBadChar+0xe4>
jmp    11f4 <stripBadChar+0xe4>
mov    -0x8(%rbp),%rax
movsbl (%rax),%edi
call   1030 <isascii@plt>
cmp    $0x0,%eax
je     11ef <stripBadChar+0xdf>
mov    -0x8(%rbp),%rax
mov    (%rax),%cl
mov    -0x10(%rbp),%rax
mov    %rax,%rdx
add    $0x1,%rdx
mov    %rdx,-0x10(%rbp)
mov    %cl,(%rax)
jmp    11f4 <stripBadChar+0xe4>
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    1135 <stripBadChar+0x25>
mov    -0x10(%rbp),%rax
movb   $0x0,(%rax)
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<stripBadChar>:
test   %rdi,%rdi
je     118a <stripBadChar+0x7a>
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
mov    (%rdi),%al
test   %al,%al
je     117f <stripBadChar+0x6f>
add    $0x1,%rbx
jmp    1144 <stripBadChar+0x34>
nopl   0x0(%rax,%rax,1)
mov    $0x6c,%al
mov    %al,(%r14)
add    $0x1,%r14
movzbl (%rbx),%eax
add    $0x1,%rbx
test   %al,%al
je     117f <stripBadChar+0x6f>
movsbl %al,%edi
cmp    $0x5f,%edi
jg     1160 <stripBadChar+0x50>
cmp    $0x2f,%edi
je     1139 <stripBadChar+0x29>
cmp    $0x5c,%edi
je     1139 <stripBadChar+0x29>
jmp    1170 <stripBadChar+0x60>
nopl   0x0(%rax,%rax,1)
cmp    $0x7c,%edi
je     1130 <stripBadChar+0x20>
cmp    $0x60,%edi
jne    1170 <stripBadChar+0x60>
mov    $0x27,%al
jmp    1132 <stripBadChar+0x22>
xchg   %ax,%ax
call   1030 <isascii@plt>
test   %eax,%eax
je     1139 <stripBadChar+0x29>
movzbl -0x1(%rbx),%eax
jmp    1132 <stripBadChar+0x22>
movb   $0x0,(%r14)
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define void @stripBadChar(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
%5 = load i8*, i8** %3
%6 = icmp eq i8* %5, null
br i1 %6, label %7, label %8
7: ; preds = %2
br label %41
8: ; preds = %2
br label %9
9: ; preds = %36, %8
%10 = load i8*, i8** %3
%11 = load i8, i8* %10
%12 = sext i8 %11 to i32
%13 = icmp ne i32 %12, 0
br i1 %13, label %14, label %39
14: ; preds = %9
%15 = load i8*, i8** %3
%16 = load i8, i8* %15
%17 = sext i8 %16 to i32
switch i32 %17, label %25 [
i32 124, label %18
i32 96, label %21
i32 47, label %24
i32 92, label %24
]
18: ; preds = %14
%19 = load i8*, i8** %4
%20 = getelementptr inbounds i8, i8* %19, i32 1
store i8* %20, i8** %4
store i8 108, i8* %19
br label %36
21: ; preds = %14
%22 = load i8*, i8** %4
%23 = getelementptr inbounds i8, i8* %22, i32 1
store i8* %23, i8** %4
store i8 39, i8* %22
br label %36
24: ; preds = %14, %14
br label %36
25: ; preds = %14
%26 = load i8*, i8** %3
%27 = load i8, i8* %26
%28 = call i32 @isascii(i8 signext %27)
%29 = icmp ne i32 %28, 0
br i1 %29, label %30, label %35
30: ; preds = %25
%31 = load i8*, i8** %3
%32 = load i8, i8* %31
%33 = load i8*, i8** %4
%34 = getelementptr inbounds i8, i8* %33, i32 1
store i8* %34, i8** %4
store i8 %32, i8* %33
br label %35
35: ; preds = %30, %25
br label %36
36: ; preds = %35, %24, %21, %18
%37 = load i8*, i8** %3
%38 = getelementptr inbounds i8, i8* %37, i32 1
store i8* %38, i8** %3
br label %9
39: ; preds = %9
%40 = load i8*, i8** %4
store i8 0, i8* %40
br label %41
41: ; preds = %39, %7
ret void
}

LLVM IR (-O2):
define void @stripBadChar(i8* %0, i8* nocapture writeonly %1) {
%3 = icmp eq i8* %0, null
br i1 %3, label %28, label %4
4: ; preds = %2
%5 = load i8, i8* %0
%6 = icmp eq i8 %5, 0
br i1 %6, label %26, label %7
7: ; preds = %4, %21
%8 = phi i8 [ %24, %21 ], [ %5, %4 ]
%9 = phi i8* [ %22, %21 ], [ %1, %4 ]
%10 = phi i8* [ %23, %21 ], [ %0, %4 ]
%11 = sext i8 %8 to i32
switch i32 %11, label %13 [
i32 124, label %18
i32 96, label %12
i32 47, label %21
i32 92, label %21
]
12: ; preds = %7
br label %18
13: ; preds = %7
%14 = tail call i32 @isascii(i8 signext %8)
%15 = icmp eq i32 %14, 0
br i1 %15, label %21, label %16
16: ; preds = %13
%17 = load i8, i8* %10
br label %18
18: ; preds = %7, %12, %16
%19 = phi i8 [ %17, %16 ], [ 39, %12 ], [ 108, %7 ]
%20 = getelementptr inbounds i8, i8* %9, i64 1
store i8 %19, i8* %9
br label %21
21: ; preds = %18, %13, %7, %7
%22 = phi i8* [ %9, %13 ], [ %9, %7 ], [ %9, %7 ], [ %20, %18 ]
%23 = getelementptr inbounds i8, i8* %10, i64 1
%24 = load i8, i8* %23
%25 = icmp eq i8 %24, 0
br i1 %25, label %26, label %7
26: ; preds = %21, %4
%27 = phi i8* [ %1, %4 ], [ %22, %21 ]
store i8 0, i8* %27
br label %28
28: ; preds = %2, %26
ret void
}