#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*/ iscntrl(char);
int /*<<< orphan*/ isspace(char);
StringClean(char *s) {
  char *t;
  t = s;
  while (*s) {
    if (!isspace(*s) && !iscntrl(*s))
      *t++ = *s;
    *s++;
  }
  *t = '\0';
}


x86 assembly (clang, -O0):
<StringClean>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
cmpb   $0x0,(%rax)
je     1193 <StringClean+0x73>
mov    -0x10(%rbp),%rax
movsbl (%rax),%edi
call   1040 <isspace@plt>
cmp    $0x0,%eax
jne    1182 <StringClean+0x62>
mov    -0x10(%rbp),%rax
movsbl (%rax),%edi
call   1030 <iscntrl@plt>
cmp    $0x0,%eax
jne    1182 <StringClean+0x62>
mov    -0x10(%rbp),%rax
mov    (%rax),%cl
mov    -0x18(%rbp),%rax
mov    %rax,%rdx
add    $0x1,%rdx
mov    %rdx,-0x18(%rbp)
mov    %cl,(%rax)
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    1134 <StringClean+0x14>
mov    -0x18(%rbp),%rax
movb   $0x0,(%rax)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<StringClean>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
mov    (%rdi),%al
test   %al,%al
je     1170 <StringClean+0x50>
mov    %r14,%rbx
jmp    114c <StringClean+0x2c>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
movzbl 0x1(%rbx),%eax
add    $0x1,%rbx
test   %al,%al
je     1170 <StringClean+0x50>
movsbl %al,%edi
call   1040 <isspace@plt>
test   %eax,%eax
jne    1140 <StringClean+0x20>
movsbl (%rbx),%edi
call   1030 <iscntrl@plt>
test   %eax,%eax
jne    1140 <StringClean+0x20>
movzbl (%rbx),%eax
mov    %al,(%r14)
add    $0x1,%r14
jmp    1140 <StringClean+0x20>
movb   $0x0,(%r14)
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define i32 @StringClean(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %3
%5 = load i8*, i8** %3
store i8* %5, i8** %4
br label %6
6: ; preds = %25, %1
%7 = load i8*, i8** %3
%8 = load i8, i8* %7
%9 = icmp ne i8 %8, 0
br i1 %9, label %10, label %29
10: ; preds = %6
%11 = load i8*, i8** %3
%12 = load i8, i8* %11
%13 = call i32 @isspace(i8 signext %12)
%14 = icmp ne i32 %13, 0
br i1 %14, label %25, label %15
15: ; preds = %10
%16 = load i8*, i8** %3
%17 = load i8, i8* %16
%18 = call i32 @iscntrl(i8 signext %17)
%19 = icmp ne i32 %18, 0
br i1 %19, label %25, label %20
20: ; preds = %15
%21 = load i8*, i8** %3
%22 = load i8, i8* %21
%23 = load i8*, i8** %4
%24 = getelementptr inbounds i8, i8* %23, i32 1
store i8* %24, i8** %4
store i8 %22, i8* %23
br label %25
25: ; preds = %20, %15, %10
%26 = load i8*, i8** %3
%27 = getelementptr inbounds i8, i8* %26, i32 1
store i8* %27, i8** %3
%28 = load i8, i8* %26
br label %6
29: ; preds = %6
%30 = load i8*, i8** %4
store i8 0, i8* %30
%31 = load i32, i32* %2
ret i32 %31
}

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