#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*/ isprint(char);
int strlen(char *);
void NameFilter(char *host, char *atari) {
  int len = strlen(atari);
  while (len--) {
    char c = *(atari++) & 0x7F;
    if (c == ' ')
      continue;
    if (!isprint(c))
      c = '_';
    switch (c) {
    case '*':
    case ':':
    case '\"':
    case ',':
    case '.':
    case '|':
    case '?':
    case '/':
    case '\\':
      c = '_';
      break;
    }
    *(host++) = c;
  }
  *host = '\0';
}


x86 assembly (clang, -O0):
<NameFilter>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    %eax,%ecx
add    $0xffffffff,%ecx
mov    %ecx,-0x14(%rbp)
cmp    $0x0,%eax
je     123c <NameFilter+0x11c>
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
movsbl (%rax),%eax
and    $0x7f,%eax
mov    %al,-0x15(%rbp)
movsbl -0x15(%rbp),%eax
cmp    $0x20,%eax
jne    117a <NameFilter+0x5a>
jmp    113c <NameFilter+0x1c>
movsbl -0x15(%rbp),%edi
call   1040 <isprint@plt>
cmp    $0x0,%eax
jne    1190 <NameFilter+0x70>
movb   $0x5f,-0x15(%rbp)
movsbl -0x15(%rbp),%eax
mov    %eax,-0x1c(%rbp)
sub    $0x22,%eax
je     121f <NameFilter+0xff>
jmp    11a5 <NameFilter+0x85>
mov    -0x1c(%rbp),%eax
sub    $0x2a,%eax
je     121f <NameFilter+0xff>
jmp    11b6 <NameFilter+0x96>
mov    -0x1c(%rbp),%eax
sub    $0x2c,%eax
je     121f <NameFilter+0xff>
jmp    11c7 <NameFilter+0xa7>
mov    -0x1c(%rbp),%eax
add    $0xffffffd2,%eax
sub    $0x2,%eax
jb     121f <NameFilter+0xff>
jmp    11db <NameFilter+0xbb>
mov    -0x1c(%rbp),%eax
sub    $0x3a,%eax
je     121f <NameFilter+0xff>
jmp    11ec <NameFilter+0xcc>
mov    -0x1c(%rbp),%eax
sub    $0x3f,%eax
je     121f <NameFilter+0xff>
jmp    11fd <NameFilter+0xdd>
mov    -0x1c(%rbp),%eax
sub    $0x5c,%eax
je     121f <NameFilter+0xff>
jmp    120e <NameFilter+0xee>
mov    -0x1c(%rbp),%eax
sub    $0x7c,%eax
jne    1223 <NameFilter+0x103>
jmp    121f <NameFilter+0xff>
movb   $0x5f,-0x15(%rbp)
mov    -0x15(%rbp),%cl
mov    -0x8(%rbp),%rax
mov    %rax,%rdx
add    $0x1,%rdx
mov    %rdx,-0x8(%rbp)
mov    %cl,(%rax)
jmp    113c <NameFilter+0x1c>
mov    -0x8(%rbp),%rax
movb   $0x0,(%rax)
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<NameFilter>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%r12
mov    %rsi,%rdi
call   1030 <strlen@plt>
test   %eax,%eax
je     119d <NameFilter+0x7d>
mov    %eax,%r15d
xor    %ebx,%ebx
movabs $0x400000021003501,%r13
jmp    1174 <NameFilter+0x54>
xchg   %ax,%ax
movzbl %cl,%eax
lea    -0x22(%rax),%edx
cmp    $0x3a,%edx
ja     1196 <NameFilter+0x76>
bt     %rdx,%r13
jae    1196 <NameFilter+0x76>
mov    $0x5f,%cl
mov    %cl,(%r12)
add    $0x1,%r12
add    $0x1,%rbx
cmp    %ebx,%r15d
je     119d <NameFilter+0x7d>
movzbl (%r14,%rbx,1),%eax
and    $0x7f,%al
cmp    $0x20,%al
je     116b <NameFilter+0x4b>
movzbl %al,%ebp
mov    %ebp,%edi
call   1040 <isprint@plt>
mov    $0x5f,%ecx
test   %eax,%eax
je     1150 <NameFilter+0x30>
mov    %ebp,%ecx
jmp    1150 <NameFilter+0x30>
cmp    $0x7c,%eax
je     1161 <NameFilter+0x41>
jmp    1163 <NameFilter+0x43>
movb   $0x0,(%r12)
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @NameFilter(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i8
store i8* %0, i8** %3
store i8* %1, i8** %4
%7 = load i8*, i8** %4
%8 = call i32 @strlen(i8* %7)
store i32 %8, i32* %5
br label %9
9: ; preds = %33, %23, %2
%10 = load i32, i32* %5
%11 = add nsw i32 %10, -1
store i32 %11, i32* %5
%12 = icmp ne i32 %10, 0
br i1 %12, label %13, label %37
13: ; preds = %9
%14 = load i8*, i8** %4
%15 = getelementptr inbounds i8, i8* %14, i32 1
store i8* %15, i8** %4
%16 = load i8, i8* %14
%17 = sext i8 %16 to i32
%18 = and i32 %17, 127
%19 = trunc i32 %18 to i8
store i8 %19, i8* %6
%20 = load i8, i8* %6
%21 = sext i8 %20 to i32
%22 = icmp eq i32 %21, 32
br i1 %22, label %23, label %24
23: ; preds = %13
br label %9
24: ; preds = %13
%25 = load i8, i8* %6
%26 = call i32 @isprint(i8 signext %25)
%27 = icmp ne i32 %26, 0
br i1 %27, label %29, label %28
28: ; preds = %24
store i8 95, i8* %6
br label %29
29: ; preds = %28, %24
%30 = load i8, i8* %6
%31 = sext i8 %30 to i32
switch i32 %31, label %33 [
i32 42, label %32
i32 58, label %32
i32 34, label %32
i32 44, label %32
i32 46, label %32
i32 124, label %32
i32 63, label %32
i32 47, label %32
i32 92, label %32
]
32: ; preds = %29, %29, %29, %29, %29, %29, %29, %29, %29
store i8 95, i8* %6
br label %33
33: ; preds = %29, %32
%34 = load i8, i8* %6
%35 = load i8*, i8** %3
%36 = getelementptr inbounds i8, i8* %35, i32 1
store i8* %36, i8** %3
store i8 %34, i8* %35
br label %9
37: ; preds = %9
%38 = load i8*, i8** %3
store i8 0, i8* %38
ret void
}

LLVM IR (-O2):
define void @NameFilter(i8* nocapture writeonly %0, i8* %1) {
%3 = tail call i32 @strlen(i8* %1)
%4 = icmp eq i32 %3, 0
br i1 %4, label %26, label %5
5: ; preds = %2, %23
%6 = phi i32 [ %9, %23 ], [ %3, %2 ]
%7 = phi i8* [ %10, %23 ], [ %1, %2 ]
%8 = phi i8* [ %24, %23 ], [ %0, %2 ]
%9 = add nsw i32 %6, -1
%10 = getelementptr inbounds i8, i8* %7, i64 1
%11 = load i8, i8* %7
%12 = and i8 %11, 127
%13 = icmp eq i8 %12, 32
br i1 %13, label %23, label %14
14: ; preds = %5
%15 = tail call i32 @isprint(i8 signext %12)
%16 = icmp eq i32 %15, 0
%17 = select i1 %16, i8 95, i8 %12
%18 = zext i8 %17 to i32
switch i32 %18, label %20 [
i32 42, label %19
i32 58, label %19
i32 34, label %19
i32 44, label %19
i32 46, label %19
i32 124, label %19
i32 63, label %19
i32 47, label %19
i32 92, label %19
]
19: ; preds = %14, %14, %14, %14, %14, %14, %14, %14, %14
br label %20
20: ; preds = %14, %19
%21 = phi i8 [ %17, %14 ], [ 95, %19 ]
%22 = getelementptr inbounds i8, i8* %8, i64 1
store i8 %21, i8* %8
br label %23
23: ; preds = %5, %20
%24 = phi i8* [ %22, %20 ], [ %8, %5 ]
%25 = icmp eq i32 %9, 0
br i1 %25, label %26, label %5
26: ; preds = %23, %2
%27 = phi i8* [ %0, %2 ], [ %24, %23 ]
store i8 0, i8* %27
ret void
}