#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 strlen(char *);
char *stripSpace(char *expr) {
  while (*expr == ' ' || *expr == '\t')
    expr++;
  int i;
  for (i = strlen(expr) - 1; i >= 0; i--)
    if (!(expr[i] == ' ' || expr[i] == '\t'))
      break;
  expr[i + 1] = 0;
  return expr;
}


x86 assembly (clang, -O0):
<stripSpace>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%ecx
mov    $0x1,%al
cmp    $0x20,%ecx
mov    %al,-0xd(%rbp)
je     1141 <stripSpace+0x31>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x9,%eax
sete   %al
mov    %al,-0xd(%rbp)
mov    -0xd(%rbp),%al
test   $0x1,%al
jne    1151 <stripSpace+0x41>
jmp    1162 <stripSpace+0x52>
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    111c <stripSpace+0xc>
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
sub    $0x1,%eax
mov    %eax,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
jl     11bd <stripSpace+0xad>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x20,%eax
je     11aa <stripSpace+0x9a>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x9,%eax
je     11aa <stripSpace+0x9a>
jmp    11bd <stripSpace+0xad>
jmp    11af <stripSpace+0x9f>
mov    -0xc(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0xc(%rbp)
jmp    1171 <stripSpace+0x61>
mov    -0x8(%rbp),%rax
mov    -0xc(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
movb   $0x0,(%rax,%rcx,1)
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<stripSpace>:
push   %rbx
mov    %rdi,%rbx
jmp    1124 <stripSpace+0x14>
cs nopw 0x0(%rax,%rax,1)
add    $0x1,%rbx
movzbl (%rbx),%eax
cmp    $0x20,%al
je     1120 <stripSpace+0x10>
cmp    $0x9,%al
je     1120 <stripSpace+0x10>
mov    %rbx,%rdi
call   1030 <strlen@plt>
test   %eax,%eax
jle    1177 <stripSpace+0x67>
mov    %eax,%ecx
add    $0xffffffff,%eax
jmp    1161 <stripSpace+0x51>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
add    $0xffffffffffffffff,%rcx
lea    0x1(%rcx),%rdx
add    $0xffffffff,%eax
cmp    $0x1,%rdx
jbe    1175 <stripSpace+0x65>
mov    %eax,%edx
movzbl (%rbx,%rdx,1),%edx
cmp    $0x20,%dl
je     1150 <stripSpace+0x40>
cmp    $0x9,%dl
je     1150 <stripSpace+0x40>
mov    %ecx,%eax
jmp    1177 <stripSpace+0x67>
xor    %eax,%eax
cltq
movb   $0x0,(%rbx,%rax,1)
mov    %rbx,%rax
pop    %rbx
ret

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

LLVM IR (-O2):
define i8* @stripSpace(i8* %0) {
br label %2
2: ; preds = %5, %1
%3 = phi i8* [ %0, %1 ], [ %6, %5 ]
%4 = load i8, i8* %3
switch i8 %4, label %7 [
i8 32, label %5
i8 9, label %5
]
5: ; preds = %2, %2
%6 = getelementptr inbounds i8, i8* %3, i64 1
br label %2
7: ; preds = %2
%8 = tail call i32 @strlen(i8* %3)
%9 = icmp sgt i32 %8, 0
br i1 %9, label %10, label %22
10: ; preds = %7
%11 = zext i32 %8 to i64
br label %12
12: ; preds = %10, %18
%13 = phi i64 [ %11, %10 ], [ %14, %18 ]
%14 = add nsw i64 %13, -1
%15 = and i64 %14, 4294967295
%16 = getelementptr inbounds i8, i8* %3, i64 %15
%17 = load i8, i8* %16
switch i8 %17, label %20 [
i8 32, label %18
i8 9, label %18
]
18: ; preds = %12, %12
%19 = icmp ugt i64 %13, 1
br i1 %19, label %12, label %22
20: ; preds = %12
%21 = trunc i64 %13 to i32
br label %22
22: ; preds = %18, %20, %7
%23 = phi i32 [ %8, %7 ], [ %21, %20 ], [ 0, %18 ]
%24 = sext i32 %23 to i64
%25 = getelementptr inbounds i8, i8* %3, i64 %24
store i8 0, i8* %25
ret i8* %3
}