#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);
void ConvertIllegalChar(char *name) {
  char *p;
  for (p = name; *p; p++) {
    if (!isprint(*p) || *p == '{' || *p == '}')
      *p = ' ';
    else if (*p == '[')
      *p = '(';
    else if (*p == ']')
      *p = ')';
  }
}


x86 assembly (clang, -O0):
<ConvertIllegalChar>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
cmpb   $0x0,(%rax)
je     11c5 <ConvertIllegalChar+0xb5>
mov    -0x10(%rbp),%rax
movsbl (%rax),%edi
call   1030 <isprint@plt>
cmp    $0x0,%eax
je     1166 <ConvertIllegalChar+0x56>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x7b,%eax
je     1166 <ConvertIllegalChar+0x56>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x7d,%eax
jne    1172 <ConvertIllegalChar+0x62>
mov    -0x10(%rbp),%rax
movb   $0x20,(%rax)
jmp    11af <ConvertIllegalChar+0x9f>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x5b,%eax
jne    118e <ConvertIllegalChar+0x7e>
mov    -0x10(%rbp),%rax
movb   $0x28,(%rax)
jmp    11aa <ConvertIllegalChar+0x9a>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x5d,%eax
jne    11a5 <ConvertIllegalChar+0x95>
mov    -0x10(%rbp),%rax
movb   $0x29,(%rax)
jmp    11aa <ConvertIllegalChar+0x9a>
jmp    11af <ConvertIllegalChar+0x9f>
jmp    11b4 <ConvertIllegalChar+0xa4>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    1124 <ConvertIllegalChar+0x14>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ConvertIllegalChar>:
push   %r14
push   %rbx
push   %rax
mov    (%rdi),%al
test   %al,%al
je     1165 <ConvertIllegalChar+0x55>
mov    %rdi,%rbx
lea    0xedc(%rip),%r14
jmp    113e <ConvertIllegalChar+0x2e>
mov    $0x29,%cl
nopl   0x0(%rax,%rax,1)
mov    %cl,(%rbx)
movzbl 0x1(%rbx),%eax
add    $0x1,%rbx
test   %al,%al
je     1165 <ConvertIllegalChar+0x55>
movsbl %al,%edi
call   1030 <isprint@plt>
mov    $0x20,%cl
test   %eax,%eax
je     1130 <ConvertIllegalChar+0x20>
movzbl (%rbx),%eax
add    $0xa5,%al
cmp    $0x22,%al
ja     1132 <ConvertIllegalChar+0x22>
movzbl %al,%eax
movslq (%r14,%rax,4),%rax
add    %r14,%rax
jmp    *%rax
mov    $0x28,%cl
jmp    1130 <ConvertIllegalChar+0x20>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define void @ConvertIllegalChar(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
store i8* %0, i8** %2
%4 = load i8*, i8** %2
store i8* %4, i8** %3
br label %5
5: ; preds = %43, %1
%6 = load i8*, i8** %3
%7 = load i8, i8* %6
%8 = icmp ne i8 %7, 0
br i1 %8, label %9, label %46
9: ; preds = %5
%10 = load i8*, i8** %3
%11 = load i8, i8* %10
%12 = call i32 @isprint(i8 signext %11)
%13 = icmp ne i32 %12, 0
br i1 %13, label %14, label %24
14: ; preds = %9
%15 = load i8*, i8** %3
%16 = load i8, i8* %15
%17 = sext i8 %16 to i32
%18 = icmp eq i32 %17, 123
br i1 %18, label %24, label %19
19: ; preds = %14
%20 = load i8*, i8** %3
%21 = load i8, i8* %20
%22 = sext i8 %21 to i32
%23 = icmp eq i32 %22, 125
br i1 %23, label %24, label %26
24: ; preds = %19, %14, %9
%25 = load i8*, i8** %3
store i8 32, i8* %25
br label %42
26: ; preds = %19
%27 = load i8*, i8** %3
%28 = load i8, i8* %27
%29 = sext i8 %28 to i32
%30 = icmp eq i32 %29, 91
br i1 %30, label %31, label %33
31: ; preds = %26
%32 = load i8*, i8** %3
store i8 40, i8* %32
br label %41
33: ; preds = %26
%34 = load i8*, i8** %3
%35 = load i8, i8* %34
%36 = sext i8 %35 to i32
%37 = icmp eq i32 %36, 93
br i1 %37, label %38, label %40
38: ; preds = %33
%39 = load i8*, i8** %3
store i8 41, i8* %39
br label %40
40: ; preds = %38, %33
br label %41
41: ; preds = %40, %31
br label %42
42: ; preds = %41, %24
br label %43
43: ; preds = %42
%44 = load i8*, i8** %3
%45 = getelementptr inbounds i8, i8* %44, i32 1
store i8* %45, i8** %3
br label %5
46: ; preds = %5
ret void
}

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