#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*/ strcpy(char *, char *);
void validateStr(char *str) {
  char *s = str;
  while (*s) {
    if (*s == '\t' || *s == '\n' || *s == '\r')
      *s = ' ';
    ++s;
  }
  if (str[0] == '\0')
    strcpy(str, " ");
}


x86 assembly (clang, -O0):
<validateStr>:
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     1179 <validateStr+0x69>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x9,%eax
je     1161 <validateStr+0x51>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0xa,%eax
je     1161 <validateStr+0x51>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0xd,%eax
jne    1168 <validateStr+0x58>
mov    -0x10(%rbp),%rax
movb   $0x20,(%rax)
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    1124 <validateStr+0x14>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
jne    1199 <validateStr+0x89>
mov    -0x8(%rbp),%rdi
lea    0xe6c(%rip),%rsi
call   1030 <strcpy@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<validateStr>:
mov    %rdi,%rax
jmp    1127 <validateStr+0x17>
cs nopw 0x0(%rax,%rax,1)
nop
movb   $0x20,(%rax)
add    $0x1,%rax
movzbl (%rax),%ecx
lea    -0x9(%rcx),%edx
cmp    $0x2,%dl
jb     1120 <validateStr+0x10>
cmp    $0xd,%cl
je     1120 <validateStr+0x10>
test   %cl,%cl
jne    1123 <validateStr+0x13>
cmpb   $0x0,(%rdi)
je     1141 <validateStr+0x31>
ret
lea    0xeb8(%rip),%rsi
jmp    1030 <strcpy@plt>

LLVM IR (-O0):
@.str = [2 x i8] c" \00"
define void @validateStr(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 = %26, %1
%6 = load i8*, i8** %3
%7 = load i8, i8* %6
%8 = icmp ne i8 %7, 0
br i1 %8, label %9, label %29
9: ; preds = %5
%10 = load i8*, i8** %3
%11 = load i8, i8* %10
%12 = sext i8 %11 to i32
%13 = icmp eq i32 %12, 9
br i1 %13, label %24, label %14
14: ; preds = %9
%15 = load i8*, i8** %3
%16 = load i8, i8* %15
%17 = sext i8 %16 to i32
%18 = icmp eq i32 %17, 10
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, 13
br i1 %23, label %24, label %26
24: ; preds = %19, %14, %9
%25 = load i8*, i8** %3
store i8 32, i8* %25
br label %26
26: ; preds = %24, %19
%27 = load i8*, i8** %3
%28 = getelementptr inbounds i8, i8* %27, i32 1
store i8* %28, i8** %3
br label %5
29: ; preds = %5
%30 = load i8*, i8** %2
%31 = getelementptr inbounds i8, i8* %30, i64 0
%32 = load i8, i8* %31
%33 = sext i8 %32 to i32
%34 = icmp eq i32 %33, 0
br i1 %34, label %35, label %38
35: ; preds = %29
%36 = load i8*, i8** %2
%37 = call i32 @strcpy(i8* %36, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
br label %38
38: ; preds = %35, %29
ret void
}

LLVM IR (-O2):
@.str = [2 x i8] c" \00"
define void @validateStr(i8* %0) {
br label %2
2: ; preds = %6, %1
%3 = phi i8* [ %0, %1 ], [ %7, %6 ]
%4 = load i8, i8* %3
switch i8 %4, label %6 [
i8 0, label %8
i8 9, label %5
i8 10, label %5
i8 13, label %5
]
5: ; preds = %2, %2, %2
store i8 32, i8* %3
br label %6
6: ; preds = %2, %5
%7 = getelementptr inbounds i8, i8* %3, i64 1
br label %2
8: ; preds = %2
%9 = load i8, i8* %0
%10 = icmp eq i8 %9, 0
br i1 %10, label %11, label %13
11: ; preds = %8
%12 = tail call i32 @strcpy(i8* %0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
br label %13
13: ; preds = %11, %8
ret void
}