#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__ iscntrl(char);
int /*<<< orphan*/ isprint(char);
char *ne_strclean(char *str) {
  char *pnt;
  for (pnt = str; *pnt; pnt++)
    if (iscntrl(*pnt) || !isprint(*pnt))
      *pnt = ' ';
  return str;
}


x86 assembly (clang, -O0):
<ne_strclean>:
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     1189 <ne_strclean+0x69>
mov    -0x10(%rbp),%rax
movsbl (%rax),%edi
call   1030 <iscntrl@plt>
cmp    $0x0,%rax
jne    116c <ne_strclean+0x4c>
mov    -0x10(%rbp),%rax
movsbl (%rax),%edi
call   1040 <isprint@plt>
cmp    $0x0,%eax
jne    1173 <ne_strclean+0x53>
mov    -0x10(%rbp),%rax
movb   $0x20,(%rax)
jmp    1178 <ne_strclean+0x58>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    1134 <ne_strclean+0x14>
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ne_strclean>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
mov    (%rdi),%al
test   %al,%al
je     116a <ne_strclean+0x4a>
mov    %r14,%rbx
jmp    114f <ne_strclean+0x2f>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
movb   $0x20,(%rbx)
movzbl 0x1(%rbx),%eax
add    $0x1,%rbx
test   %al,%al
je     116a <ne_strclean+0x4a>
movsbl %al,%edi
call   1030 <iscntrl@plt>
test   %rax,%rax
jne    1140 <ne_strclean+0x20>
movsbl (%rbx),%edi
call   1040 <isprint@plt>
test   %eax,%eax
jne    1143 <ne_strclean+0x23>
jmp    1140 <ne_strclean+0x20>
mov    %r14,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define i8* @ne_strclean(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 = %22, %1
%6 = load i8*, i8** %3
%7 = load i8, i8* %6
%8 = icmp ne i8 %7, 0
br i1 %8, label %9, label %25
9: ; preds = %5
%10 = load i8*, i8** %3
%11 = load i8, i8* %10
%12 = call i64 @iscntrl(i8 signext %11)
%13 = icmp ne i64 %12, 0
br i1 %13, label %19, label %14
14: ; preds = %9
%15 = load i8*, i8** %3
%16 = load i8, i8* %15
%17 = call i32 @isprint(i8 signext %16)
%18 = icmp ne i32 %17, 0
br i1 %18, label %21, label %19
19: ; preds = %14, %9
%20 = load i8*, i8** %3
store i8 32, i8* %20
br label %21
21: ; preds = %19, %14
br label %22
22: ; preds = %21
%23 = load i8*, i8** %3
%24 = getelementptr inbounds i8, i8* %23, i32 1
store i8* %24, i8** %3
br label %5
25: ; preds = %5
%26 = load i8*, i8** %2
ret i8* %26
}

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