#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 *);
void remove_lb(char *s) {
  int i, l;
  char *p;
  while (*s == ' ') {
    l = strlen(s);
    if (l <= 0)
      return;
    for (i = 0, p = s; i < l; i++, p++)
      *p = *(p + 1);
  }
  return;
}


x86 assembly (clang, -O0):
<remove_lb>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x20,%eax
jne    118e <remove_lb+0x7e>
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,-0x10(%rbp)
cmpl   $0x0,-0x10(%rbp)
jg     1147 <remove_lb+0x37>
jmp    1193 <remove_lb+0x83>
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x10(%rbp),%eax
jge    1189 <remove_lb+0x79>
mov    -0x18(%rbp),%rax
mov    0x1(%rax),%cl
mov    -0x18(%rbp),%rax
mov    %cl,(%rax)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    1156 <remove_lb+0x46>
jmp    111c <remove_lb+0xc>
jmp    1193 <remove_lb+0x83>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<remove_lb>:
push   %r14
push   %rbx
push   %rax
cmpb   $0x20,(%rdi)
jne    114e <remove_lb+0x2e>
mov    %rdi,%rbx
lea    0x1(%rdi),%r14
mov    %rbx,%rdi
call   1030 <strlen@plt>
test   %eax,%eax
jle    114e <remove_lb+0x2e>
mov    %eax,%edx
mov    %rbx,%rdi
mov    %r14,%rsi
call   1040 <memmove@plt>
cmpb   $0x20,(%rbx)
je     1130 <remove_lb+0x10>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
define void @remove_lb(i8* %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 32
br i1 %3, label %4, label %13
4: ; preds = %1
%5 = getelementptr i8, i8* %0, i64 1
br label %10
6: ; preds = %10
%7 = zext i32 %11 to i64
%8 = load i8, i8* %0
%9 = icmp eq i8 %8, 32
br i1 %9, label %10, label %13
10: ; preds = %4, %6
%11 = tail call i32 @strlen(i8* %0)
%12 = icmp slt i32 %11, 1
br i1 %12, label %13, label %6
13: ; preds = %10, %6, %1
ret void
}