#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*/ isspace(unsigned char);
int /*<<< orphan*/ strcpy(char *, char *);
int squeeze_str(char *str) {
  char buf[256], *look, *walk;
  look = str;
  walk = buf;
  while (*look) {
    if ((*look == '\'') && (*(look + 1) == ' ') && (*(look + 2) == '\'')) {
      *walk++ = *look++;
      *walk++ = *look++;
      *walk++ = *look++;
      continue;
    }
    if (!isspace((unsigned char)(*look))) {
      *walk = *look;
      walk++;
    }
    look++;
  }
  *walk = 0;
  strcpy(str, buf);
  return 1;
}


x86 assembly (clang, -O0):
<squeeze_str>:
push   %rbp
mov    %rsp,%rbp
sub    $0x120,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x118(%rbp)
lea    -0x110(%rbp),%rax
mov    %rax,-0x120(%rbp)
mov    -0x118(%rbp),%rax
cmpb   $0x0,(%rax)
je     1275 <squeeze_str+0x155>
mov    -0x118(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x27,%eax
jne    1222 <squeeze_str+0x102>
mov    -0x118(%rbp),%rax
movsbl 0x1(%rax),%eax
cmp    $0x20,%eax
jne    1222 <squeeze_str+0x102>
mov    -0x118(%rbp),%rax
movsbl 0x2(%rax),%eax
cmp    $0x27,%eax
jne    1222 <squeeze_str+0x102>
mov    -0x118(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x118(%rbp)
mov    (%rax),%cl
mov    -0x120(%rbp),%rax
mov    %rax,%rdx
add    $0x1,%rdx
mov    %rdx,-0x120(%rbp)
mov    %cl,(%rax)
mov    -0x118(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x118(%rbp)
mov    (%rax),%cl
mov    -0x120(%rbp),%rax
mov    %rax,%rdx
add    $0x1,%rdx
mov    %rdx,-0x120(%rbp)
mov    %cl,(%rax)
mov    -0x118(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x118(%rbp)
mov    (%rax),%cl
mov    -0x120(%rbp),%rax
mov    %rax,%rdx
add    $0x1,%rdx
mov    %rdx,-0x120(%rbp)
mov    %cl,(%rax)
jmp    1148 <squeeze_str+0x28>
mov    -0x118(%rbp),%rax
movzbl (%rax),%edi
call   1040 <isspace@plt>
cmp    $0x0,%eax
jne    125e <squeeze_str+0x13e>
mov    -0x118(%rbp),%rax
mov    (%rax),%cl
mov    -0x120(%rbp),%rax
mov    %cl,(%rax)
mov    -0x120(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x120(%rbp)
mov    -0x118(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x118(%rbp)
jmp    1148 <squeeze_str+0x28>
mov    -0x120(%rbp),%rax
movb   $0x0,(%rax)
mov    -0x8(%rbp),%rdi
lea    -0x110(%rbp),%rsi
call   1030 <strcpy@plt>
mov    $0x1,%eax
add    $0x120,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<squeeze_str>:
push   %r15
push   %r14
push   %rbx
sub    $0x100,%rsp
mov    %rdi,%r14
mov    %rsp,%r15
mov    %rdi,%rbx
jmp    1144 <squeeze_str+0x24>
nopw   0x0(%rax,%rax,1)
add    $0x1,%rbx
movzbl (%rbx),%eax
cmp    $0x27,%al
je     1160 <squeeze_str+0x40>
test   %al,%al
jne    1190 <squeeze_str+0x70>
jmp    11a8 <squeeze_str+0x88>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
cmpb   $0x20,0x1(%rbx)
jne    1190 <squeeze_str+0x70>
cmpb   $0x27,0x2(%rbx)
jne    1190 <squeeze_str+0x70>
movb   $0x27,(%r15)
movzbl 0x1(%rbx),%eax
mov    %al,0x1(%r15)
movzbl 0x2(%rbx),%eax
add    $0x3,%rbx
mov    %al,0x2(%r15)
add    $0x3,%r15
jmp    1144 <squeeze_str+0x24>
nopw   0x0(%rax,%rax,1)
movzbl %al,%edi
call   1040 <isspace@plt>
test   %eax,%eax
jne    1140 <squeeze_str+0x20>
movzbl (%rbx),%eax
mov    %al,(%r15)
add    $0x1,%r15
jmp    1140 <squeeze_str+0x20>
movb   $0x0,(%r15)
mov    %rsp,%rsi
mov    %r14,%rdi
call   1030 <strcpy@plt>
mov    $0x1,%eax
add    $0x100,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
define i32 @squeeze_str(i8* %0) {
%2 = alloca [256 x i8]
%3 = getelementptr inbounds [256 x i8], [256 x i8]* %2, i64 0, i64 0
br label %4
4: ; preds = %23, %1
%5 = phi i8* [ %0, %1 ], [ %24, %23 ]
%6 = phi i8* [ %3, %1 ], [ %25, %23 ]
%7 = load i8, i8* %5
switch i8 %7, label %26 [
i8 0, label %35
i8 39, label %8
]
8: ; preds = %4
%9 = getelementptr inbounds i8, i8* %5, i64 1
%10 = load i8, i8* %9
%11 = icmp eq i8 %10, 32
br i1 %11, label %12, label %26
12: ; preds = %8
%13 = getelementptr inbounds i8, i8* %5, i64 2
%14 = load i8, i8* %13
%15 = icmp eq i8 %14, 39
br i1 %15, label %16, label %26
16: ; preds = %12
%17 = getelementptr inbounds i8, i8* %6, i64 1
store i8 39, i8* %6
%18 = load i8, i8* %9
%19 = getelementptr inbounds i8, i8* %6, i64 2
store i8 %18, i8* %17
%20 = getelementptr inbounds i8, i8* %5, i64 3
%21 = load i8, i8* %13
%22 = getelementptr inbounds i8, i8* %6, i64 3
store i8 %21, i8* %19
br label %23
23: ; preds = %16, %32
%24 = phi i8* [ %20, %16 ], [ %34, %32 ]
%25 = phi i8* [ %22, %16 ], [ %33, %32 ]
br label %4
26: ; preds = %4, %12, %8
%27 = tail call i32 @isspace(i8 zeroext %7)
%28 = icmp eq i32 %27, 0
br i1 %28, label %29, label %32
29: ; preds = %26
%30 = load i8, i8* %5
store i8 %30, i8* %6
%31 = getelementptr inbounds i8, i8* %6, i64 1
br label %32
32: ; preds = %29, %26
%33 = phi i8* [ %6, %26 ], [ %31, %29 ]
%34 = getelementptr inbounds i8, i8* %5, i64 1
br label %23
35: ; preds = %4
store i8 0, i8* %6
%36 = call i32 @strcpy(i8* %0, i8* %3)
ret i32 1
}