#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*/ *strchr(char *, char);
void stripSpaces(char *text, size_t length, char **first,
                 size_t *stripped_length) {
  while (length > 0 && strchr(" \t\v\f\n\r", *text) != NULL) {
    text++;
    length--;
  }
  while (length > 0 && strchr(" \t\v\f\n\r", text[length - 1]) != NULL) {
    length--;
  }
  *first = text;
  *stripped_length = length;
}


x86 assembly (clang, -O0):
<stripSpaces>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
xor    %eax,%eax
cmpq   $0x0,-0x10(%rbp)
mov    %al,-0x21(%rbp)
jbe    1155 <stripSpaces+0x45>
mov    -0x8(%rbp),%rax
lea    0xebd(%rip),%rdi
movsbl (%rax),%esi
call   1030 <strchr@plt>
cmp    $0x0,%rax
setne  %al
mov    %al,-0x21(%rbp)
mov    -0x21(%rbp),%al
test   $0x1,%al
jne    1165 <stripSpaces+0x55>
jmp    1182 <stripSpaces+0x72>
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
mov    -0x10(%rbp),%rax
add    $0xffffffffffffffff,%rax
mov    %rax,-0x10(%rbp)
jmp    1128 <stripSpaces+0x18>
jmp    1187 <stripSpaces+0x77>
xor    %eax,%eax
cmpq   $0x0,-0x10(%rbp)
mov    %al,-0x22(%rbp)
jbe    11bd <stripSpaces+0xad>
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%rcx
sub    $0x1,%rcx
lea    0xe56(%rip),%rdi
movsbl (%rax,%rcx,1),%esi
call   1030 <strchr@plt>
cmp    $0x0,%rax
setne  %al
mov    %al,-0x22(%rbp)
mov    -0x22(%rbp),%al
test   $0x1,%al
jne    11cd <stripSpaces+0xbd>
jmp    11de <stripSpaces+0xce>
mov    -0x10(%rbp),%rax
add    $0xffffffffffffffff,%rax
mov    %rax,-0x10(%rbp)
jmp    1187 <stripSpaces+0x77>
mov    -0x8(%rbp),%rcx
mov    -0x18(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x10(%rbp),%rcx
mov    -0x20(%rbp),%rax
mov    %rcx,(%rax)
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<stripSpaces>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rcx,%r14
mov    %rdx,%r15
mov    %rdi,%r12
test   %rsi,%rsi
je     115c <stripSpaces+0x4c>
mov    %rsi,%rbx
lea    0xecd(%rip),%r13
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
movsbl (%r12),%esi
mov    %r13,%rdi
call   1030 <strchr@plt>
test   %rax,%rax
je     115e <stripSpaces+0x4e>
add    $0x1,%r12
add    $0xffffffffffffffff,%rbx
jne    1140 <stripSpaces+0x30>
xor    %ebx,%ebx
lea    0xe9b(%rip),%r13
cs nopw 0x0(%rax,%rax,1)
nop
mov    %rbx,%rbp
sub    $0x1,%rbx
jb     118c <stripSpaces+0x7c>
movsbl -0x1(%r12,%rbp,1),%esi
mov    %r13,%rdi
call   1030 <strchr@plt>
test   %rax,%rax
jne    1170 <stripSpaces+0x60>
mov    %r12,(%r15)
mov    %rbp,(%r14)
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [7 x i8] c" \09\0B\0C\0A\0D\00"
define void @stripSpaces(i8* %0, i64 %1, i8** %2, i64* %3) {
%5 = alloca i8*
%6 = alloca i64
%7 = alloca i8**
%8 = alloca i64*
store i8* %0, i8** %5
store i64 %1, i64* %6
store i8** %2, i8*** %7
store i64* %3, i64** %8
br label %9
9: ; preds = %19, %4
%10 = load i64, i64* %6
%11 = icmp ugt i64 %10, 0
br i1 %11, label %12, label %17
12: ; preds = %9
%13 = load i8*, i8** %5
%14 = load i8, i8* %13
%15 = call i32* @strchr(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8 signext %14)
%16 = icmp ne i32* %15, null
br label %17
17: ; preds = %12, %9
%18 = phi i1 [ false, %9 ], [ %16, %12 ]
br i1 %18, label %19, label %24
19: ; preds = %17
%20 = load i8*, i8** %5
%21 = getelementptr inbounds i8, i8* %20, i32 1
store i8* %21, i8** %5
%22 = load i64, i64* %6
%23 = add i64 %22, -1
store i64 %23, i64* %6
br label %9
24: ; preds = %17
br label %25
25: ; preds = %38, %24
%26 = load i64, i64* %6
%27 = icmp ugt i64 %26, 0
br i1 %27, label %28, label %36
28: ; preds = %25
%29 = load i8*, i8** %5
%30 = load i64, i64* %6
%31 = sub i64 %30, 1
%32 = getelementptr inbounds i8, i8* %29, i64 %31
%33 = load i8, i8* %32
%34 = call i32* @strchr(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8 signext %33)
%35 = icmp ne i32* %34, null
br label %36
36: ; preds = %28, %25
%37 = phi i1 [ false, %25 ], [ %35, %28 ]
br i1 %37, label %38, label %41
38: ; preds = %36
%39 = load i64, i64* %6
%40 = add i64 %39, -1
store i64 %40, i64* %6
br label %25
41: ; preds = %36
%42 = load i8*, i8** %5
%43 = load i8**, i8*** %7
store i8* %42, i8** %43
%44 = load i64, i64* %6
%45 = load i64*, i64** %8
store i64 %44, i64* %45
ret void
}

LLVM IR (-O2):
@.str = [7 x i8] c" \09\0B\0C\0A\0D\00"
define void @stripSpaces(i8* %0, i64 %1, i8** nocapture writeonly %2, i64* nocapture writeonly %3) {
%5 = icmp eq i64 %1, 0
br i1 %5, label %16, label %6
6: ; preds = %4, %12
%7 = phi i8* [ %13, %12 ], [ %0, %4 ]
%8 = phi i64 [ %14, %12 ], [ %1, %4 ]
%9 = load i8, i8* %7
%10 = tail call i32* @strchr(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8 signext %9)
%11 = icmp eq i32* %10, null
br i1 %11, label %16, label %12
12: ; preds = %6
%13 = getelementptr inbounds i8, i8* %7, i64 1
%14 = add i64 %8, -1
%15 = icmp eq i64 %14, 0
br i1 %15, label %16, label %6
16: ; preds = %6, %12, %4
%17 = phi i64 [ 0, %4 ], [ 0, %12 ], [ %8, %6 ]
%18 = phi i8* [ %0, %4 ], [ %13, %12 ], [ %7, %6 ]
br label %19
19: ; preds = %22, %16
%20 = phi i64 [ %17, %16 ], [ %23, %22 ]
%21 = icmp eq i64 %20, 0
br i1 %21, label %28, label %22
22: ; preds = %19
%23 = add i64 %20, -1
%24 = getelementptr inbounds i8, i8* %18, i64 %23
%25 = load i8, i8* %24
%26 = tail call i32* @strchr(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8 signext %25)
%27 = icmp eq i32* %26, null
br i1 %27, label %28, label %19
28: ; preds = %19, %22
store i8* %18, i8** %2
store i64 %20, i64* %3
ret void
}