#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 */
scalar_t__ isspace(char);
int /*<<< orphan*/ memmove(char *, char *, int);
int strlen(char *);
void StripLeadingWhitespace(char *String) {
  int count, len;
  len = (String ? strlen(String) : 0);
  if (len == 0)
    return;
  for (count = 0; (count < len - 1) && isspace(String[count]); count++)
    ;
  memmove(String, String + count, len - count);
  String[len - count] = 0;
}


x86 assembly (clang, -O0):
<StripLeadingWhitespace>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     1158 <StripLeadingWhitespace+0x28>
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,-0x14(%rbp)
jmp    1162 <StripLeadingWhitespace+0x32>
xor    %eax,%eax
mov    %eax,-0x14(%rbp)
jmp    1162 <StripLeadingWhitespace+0x32>
mov    -0x14(%rbp),%eax
mov    %eax,-0x10(%rbp)
cmpl   $0x0,-0x10(%rbp)
jne    1177 <StripLeadingWhitespace+0x47>
jmp    11fd <StripLeadingWhitespace+0xcd>
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%ecx
mov    -0x10(%rbp),%edx
sub    $0x1,%edx
xor    %eax,%eax
cmp    %edx,%ecx
mov    %al,-0x15(%rbp)
jge    11af <StripLeadingWhitespace+0x7f>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movsbl (%rax,%rcx,1),%edi
call   1040 <isspace@plt>
cmp    $0x0,%rax
setne  %al
mov    %al,-0x15(%rbp)
mov    -0x15(%rbp),%al
test   $0x1,%al
jne    11bf <StripLeadingWhitespace+0x8f>
jmp    11d2 <StripLeadingWhitespace+0xa2>
jmp    11c4 <StripLeadingWhitespace+0x94>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    117e <StripLeadingWhitespace+0x4e>
mov    -0x8(%rbp),%rdi
mov    -0x8(%rbp),%rsi
movslq -0xc(%rbp),%rax
add    %rax,%rsi
mov    -0x10(%rbp),%edx
sub    -0xc(%rbp),%edx
call   1050 <memmove@plt>
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%ecx
sub    -0xc(%rbp),%ecx
movslq %ecx,%rcx
movb   $0x0,(%rax,%rcx,1)
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<StripLeadingWhitespace>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
test   %rdi,%rdi
je     1197 <StripLeadingWhitespace+0x67>
mov    %rdi,%rbx
call   1030 <strlen@plt>
test   %eax,%eax
je     1197 <StripLeadingWhitespace+0x67>
mov    %eax,%r14d
xor    %r15d,%r15d
cmp    $0x2,%eax
jl     117c <StripLeadingWhitespace+0x4c>
lea    -0x1(%r14),%r15d
mov    %r15d,%r12d
xor    %ebp,%ebp
nopl   (%rax)
movsbl (%rbx,%rbp,1),%edi
call   1040 <isspace@plt>
test   %rax,%rax
je     1179 <StripLeadingWhitespace+0x49>
add    $0x1,%rbp
cmp    %rbp,%r12
jne    1160 <StripLeadingWhitespace+0x30>
jmp    117c <StripLeadingWhitespace+0x4c>
mov    %ebp,%r15d
mov    %r15d,%esi
add    %rbx,%rsi
sub    %r15d,%r14d
mov    %rbx,%rdi
mov    %r14d,%edx
call   1050 <memmove@plt>
movslq %r14d,%rax
movb   $0x0,(%rbx,%rax,1)
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
define void @StripLeadingWhitespace(i8* %0) {
%2 = icmp eq i8* %0, null
br i1 %2, label %30, label %3
3: ; preds = %1
%4 = tail call i32 @strlen(i8* %0)
%5 = icmp eq i32 %4, 0
br i1 %5, label %30, label %6
6: ; preds = %3
%7 = add i32 %4, -1
%8 = icmp sgt i32 %4, 1
br i1 %8, label %9, label %22
9: ; preds = %6
%10 = zext i32 %7 to i64
br label %11
11: ; preds = %9, %17
%12 = phi i64 [ 0, %9 ], [ %18, %17 ]
%13 = getelementptr inbounds i8, i8* %0, i64 %12
%14 = load i8, i8* %13
%15 = tail call i64 @isspace(i8 signext %14)
%16 = icmp eq i64 %15, 0
br i1 %16, label %20, label %17
17: ; preds = %11
%18 = add nuw nsw i64 %12, 1
%19 = icmp eq i64 %18, %10
br i1 %19, label %22, label %11
20: ; preds = %11
%21 = trunc i64 %12 to i32
br label %22
22: ; preds = %17, %20, %6
%23 = phi i32 [ 0, %6 ], [ %21, %20 ], [ %7, %17 ]
%24 = zext i32 %23 to i64
%25 = getelementptr inbounds i8, i8* %0, i64 %24
%26 = sub nsw i32 %4, %23
%27 = tail call i32 @memmove(i8* %0, i8* %25, i32 %26)
%28 = sext i32 %26 to i64
%29 = getelementptr inbounds i8, i8* %0, i64 %28
store i8 0, i8* %29
br label %30
30: ; preds = %1, %3, %22
ret void
}