#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*/ memmove(char *, char *, scalar_t__);
scalar_t__ strchr(char *, char);
scalar_t__ strlen(char *);
char *lTrim(char *buf) {
  if (buf) {
    char *tp = buf;
    while (*tp && strchr("\n\r\t ", *tp))
      tp++;
    memmove(buf, tp, strlen(tp) + 1);
  }
  return buf;
}


x86 assembly (clang, -O0):
<lTrim>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     11cf <lTrim+0x9f>
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movsbl (%rax),%ecx
xor    %eax,%eax
cmp    $0x0,%ecx
mov    %al,-0x11(%rbp)
je     1181 <lTrim+0x51>
mov    -0x10(%rbp),%rax
lea    0xe91(%rip),%rdi
movsbl (%rax),%esi
call   1040 <strchr@plt>
cmp    $0x0,%rax
setne  %al
mov    %al,-0x11(%rbp)
mov    -0x11(%rbp),%al
test   $0x1,%al
jne    1191 <lTrim+0x61>
jmp    11a2 <lTrim+0x72>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    114f <lTrim+0x1f>
mov    -0x8(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <strlen@plt>
mov    -0x28(%rbp),%rdi
mov    -0x20(%rbp),%rsi
mov    %rax,%rdx
add    $0x1,%rdx
call   1050 <memmove@plt>
mov    -0x8(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<lTrim>:
push   %r15
push   %r14
push   %rbx
mov    %rdi,%r14
test   %rdi,%rdi
je     1193 <lTrim+0x63>
mov    (%r14),%al
mov    %r14,%rbx
test   %al,%al
je     117c <lTrim+0x4c>
lea    0xeb2(%rip),%r15
mov    %r14,%rbx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
movsbl %al,%esi
mov    %r15,%rdi
call   1040 <strchr@plt>
test   %rax,%rax
je     117c <lTrim+0x4c>
movzbl 0x1(%rbx),%eax
add    $0x1,%rbx
test   %al,%al
jne    1160 <lTrim+0x30>
mov    %rbx,%rdi
call   1030 <strlen@plt>
lea    0x1(%rax),%rdx
mov    %r14,%rdi
mov    %rbx,%rsi
call   1050 <memmove@plt>
mov    %r14,%rax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [5 x i8] c"\0A\0D\09 \00"
define i8* @lTrim(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = icmp ne i8* %4, null
br i1 %5, label %6, label %30
6: ; preds = %1
%7 = load i8*, i8** %2
store i8* %7, i8** %3
br label %8
8: ; preds = %20, %6
%9 = load i8*, i8** %3
%10 = load i8, i8* %9
%11 = sext i8 %10 to i32
%12 = icmp ne i32 %11, 0
br i1 %12, label %13, label %18
13: ; preds = %8
%14 = load i8*, i8** %3
%15 = load i8, i8* %14
%16 = call i64 @strchr(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8 signext %15)
%17 = icmp ne i64 %16, 0
br label %18
18: ; preds = %13, %8
%19 = phi i1 [ false, %8 ], [ %17, %13 ]
br i1 %19, label %20, label %23
20: ; preds = %18
%21 = load i8*, i8** %3
%22 = getelementptr inbounds i8, i8* %21, i32 1
store i8* %22, i8** %3
br label %8
23: ; preds = %18
%24 = load i8*, i8** %2
%25 = load i8*, i8** %3
%26 = load i8*, i8** %3
%27 = call i64 @strlen(i8* %26)
%28 = add nsw i64 %27, 1
%29 = call i32 @memmove(i8* %24, i8* %25, i64 %28)
br label %30
30: ; preds = %23, %1
%31 = load i8*, i8** %2
ret i8* %31
}

LLVM IR (-O2):
@.str = [5 x i8] c"\0A\0D\09 \00"
define i8* @lTrim(i8* returned %0) {
%2 = icmp eq i8* %0, null
br i1 %2, label %20, label %3
3: ; preds = %1
%4 = load i8, i8* %0
%5 = icmp eq i8 %4, 0
br i1 %5, label %15, label %6
6: ; preds = %3, %11
%7 = phi i8 [ %13, %11 ], [ %4, %3 ]
%8 = phi i8* [ %12, %11 ], [ %0, %3 ]
%9 = tail call i64 @strchr(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8 signext %7)
%10 = icmp eq i64 %9, 0
br i1 %10, label %15, label %11
11: ; preds = %6
%12 = getelementptr inbounds i8, i8* %8, i64 1
%13 = load i8, i8* %12
%14 = icmp eq i8 %13, 0
br i1 %14, label %15, label %6
15: ; preds = %6, %11, %3
%16 = phi i8* [ %0, %3 ], [ %12, %11 ], [ %8, %6 ]
%17 = tail call i64 @strlen(i8* %16)
%18 = add nsw i64 %17, 1
%19 = tail call i32 @memmove(i8* %0, i8* %16, i64 %18)
br label %20
20: ; preds = %15, %1
ret i8* %0
}