#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*/ assert(char *);
int strlen(char *);
void stripSpace(char *line) {
  int i, len;
  assert(line);
  len = strlen(line);
  for (i = len - 1; i >= 0; i++) {
    if (line[i] != ' ')
      break;
    line[i] = 0;
  }
}


x86 assembly (clang, -O0):
<stripSpace>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <assert@plt>
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
jl     1188 <stripSpace+0x68>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x20,%eax
je     116e <stripSpace+0x4e>
jmp    1188 <stripSpace+0x68>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movb   $0x0,(%rax,%rcx,1)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    114a <stripSpace+0x2a>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<stripSpace>:
push   %rbx
mov    %rdi,%rbx
call   1040 <assert@plt>
mov    %rbx,%rdi
call   1030 <strlen@plt>
test   %eax,%eax
jle    115d <stripSpace+0x3d>
add    $0xffffffff,%eax
cmpb   $0x20,(%rbx,%rax,1)
jne    115d <stripSpace+0x3d>
add    %rbx,%rax
add    $0x1,%rax
cs nopw 0x0(%rax,%rax,1)
nop
movb   $0x0,-0x1(%rax)
cmpb   $0x20,(%rax)
lea    0x1(%rax),%rax
je     1150 <stripSpace+0x30>
pop    %rbx
ret

LLVM IR (-O0):
define void @stripSpace(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
%4 = alloca i32
store i8* %0, i8** %2
%5 = load i8*, i8** %2
%6 = call i32 @assert(i8* %5)
%7 = load i8*, i8** %2
%8 = call i32 @strlen(i8* %7)
store i32 %8, i32* %4
%9 = load i32, i32* %4
%10 = sub nsw i32 %9, 1
store i32 %10, i32* %3
br label %11
11: ; preds = %28, %1
%12 = load i32, i32* %3
%13 = icmp sge i32 %12, 0
br i1 %13, label %14, label %31
14: ; preds = %11
%15 = load i8*, i8** %2
%16 = load i32, i32* %3
%17 = sext i32 %16 to i64
%18 = getelementptr inbounds i8, i8* %15, i64 %17
%19 = load i8, i8* %18
%20 = sext i8 %19 to i32
%21 = icmp ne i32 %20, 32
br i1 %21, label %22, label %23
22: ; preds = %14
br label %31
23: ; preds = %14
%24 = load i8*, i8** %2
%25 = load i32, i32* %3
%26 = sext i32 %25 to i64
%27 = getelementptr inbounds i8, i8* %24, i64 %26
store i8 0, i8* %27
br label %28
28: ; preds = %23
%29 = load i32, i32* %3
%30 = add nsw i32 %29, 1
store i32 %30, i32* %3
br label %11
31: ; preds = %22, %11
ret void
}

LLVM IR (-O2):
define void @stripSpace(i8* %0) {
%2 = tail call i32 @assert(i8* %0)
%3 = tail call i32 @strlen(i8* %0)
%4 = icmp sgt i32 %3, 0
br i1 %4, label %5, label %18
5: ; preds = %1
%6 = add nsw i32 %3, -1
%7 = zext i32 %6 to i64
%8 = getelementptr inbounds i8, i8* %0, i64 %7
%9 = load i8, i8* %8
%10 = icmp eq i8 %9, 32
br i1 %10, label %11, label %18
11: ; preds = %5, %11
%12 = phi i8* [ %15, %11 ], [ %8, %5 ]
%13 = phi i64 [ %14, %11 ], [ %7, %5 ]
store i8 0, i8* %12
%14 = add nuw i64 %13, 1
%15 = getelementptr inbounds i8, i8* %0, i64 %14
%16 = load i8, i8* %15
%17 = icmp eq i8 %16, 32
br i1 %17, label %11, label %18
18: ; preds = %11, %5, %1
ret void
}