#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 *);
char *stripallspaces(char s[]) {
  char s1[256];
  int c0 = 0, c1 = 0;
  while (s[c0] != '\0') {
    while (s[c0] == ' ')
      c0++;
    s1[c1] = s[c0];
    c0++;
    c1++;
  }
  s1[c1] = '\0';
  strcpy(s, s1);
  return &s[0];
}


x86 assembly (clang, -O0):
<stripallspaces>:
push   %rbp
mov    %rsp,%rbp
sub    $0x120,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0x114(%rbp)
movl   $0x0,-0x118(%rbp)
mov    -0x8(%rbp),%rax
movslq -0x114(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x0,%eax
je     11bb <stripallspaces+0xab>
jmp    1150 <stripallspaces+0x40>
mov    -0x8(%rbp),%rax
movslq -0x114(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x20,%eax
jne    117c <stripallspaces+0x6c>
mov    -0x114(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x114(%rbp)
jmp    1150 <stripallspaces+0x40>
mov    -0x8(%rbp),%rax
movslq -0x114(%rbp),%rcx
mov    (%rax,%rcx,1),%cl
movslq -0x118(%rbp),%rax
mov    %cl,-0x110(%rbp,%rax,1)
mov    -0x114(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x114(%rbp)
mov    -0x118(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x118(%rbp)
jmp    1133 <stripallspaces+0x23>
movslq -0x118(%rbp),%rax
movb   $0x0,-0x110(%rbp,%rax,1)
mov    -0x8(%rbp),%rdi
lea    -0x110(%rbp),%rsi
call   1030 <strcpy@plt>
mov    -0x8(%rbp),%rax
add    $0x120,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<stripallspaces>:
push   %r14
push   %rbx
sub    $0x108,%rsp
mov    %rdi,%r14
xor    %eax,%eax
cmpb   $0x0,(%rdi)
je     1162 <stripallspaces+0x52>
xor    %ecx,%ecx
cs nopw 0x0(%rax,%rax,1)
movslq %eax,%rdx
add    %r14,%rdx
cs nopw 0x0(%rax,%rax,1)
movzbl (%rdx),%ebx
add    $0x1,%eax
add    $0x1,%rdx
cmp    $0x20,%bl
je     1140 <stripallspaces+0x30>
mov    %bl,(%rsp,%rcx,1)
add    $0x1,%rcx
movslq %eax,%rdx
cmpb   $0x0,(%r14,%rdx,1)
jne    1130 <stripallspaces+0x20>
mov    %ecx,%eax
movb   $0x0,(%rsp,%rax,1)
mov    %rsp,%rsi
mov    %r14,%rdi
call   1030 <strcpy@plt>
mov    %r14,%rax
add    $0x108,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
define i8* @stripallspaces(i8* returned %0) {
%2 = alloca [256 x i8]
%3 = getelementptr inbounds [256 x i8], [256 x i8]* %2, i64 0, i64 0
%4 = load i8, i8* %0
%5 = icmp eq i8 %4, 0
br i1 %5, label %27, label %6
6: ; preds = %1, %16
%7 = phi i64 [ %20, %16 ], [ 0, %1 ]
%8 = phi i32 [ %19, %16 ], [ 0, %1 ]
%9 = sext i32 %8 to i64
br label %10
10: ; preds = %10, %6
%11 = phi i64 [ %15, %10 ], [ %9, %6 ]
%12 = getelementptr inbounds i8, i8* %0, i64 %11
%13 = load i8, i8* %12
%14 = icmp eq i8 %13, 32
%15 = add i64 %11, 1
br i1 %14, label %10, label %16
16: ; preds = %10
%17 = trunc i64 %11 to i32
%18 = getelementptr inbounds [256 x i8], [256 x i8]* %2, i64 0, i64 %7
store i8 %13, i8* %18
%19 = add nsw i32 %17, 1
%20 = add nuw i64 %7, 1
%21 = sext i32 %19 to i64
%22 = getelementptr inbounds i8, i8* %0, i64 %21
%23 = load i8, i8* %22
%24 = icmp eq i8 %23, 0
br i1 %24, label %25, label %6
25: ; preds = %16
%26 = and i64 %20, 4294967295
br label %27
27: ; preds = %25, %1
%28 = phi i64 [ 0, %1 ], [ %26, %25 ]
%29 = getelementptr inbounds [256 x i8], [256 x i8]* %2, i64 0, i64 %28
store i8 0, i8* %29
%30 = call i32 @strcpy(i8* %0, i8* %3)
ret i8* %0
}