#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__ ishtmlspace(char);
char *html_parser_ltrim(char *src, size_t *len) {
  while (ishtmlspace(*src) && *len > 0) {
    src++;
    (*len)--;
  }
  return src;
}


x86 assembly (clang, -O0):
<html_parser_ltrim>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%edi
call   1030 <ishtmlspace@plt>
mov    %rax,%rcx
xor    %eax,%eax
cmp    $0x0,%rcx
mov    %al,-0x11(%rbp)
je     114c <html_parser_ltrim+0x3c>
mov    -0x10(%rbp),%rax
cmpq   $0x0,(%rax)
seta   %al
mov    %al,-0x11(%rbp)
mov    -0x11(%rbp),%al
test   $0x1,%al
jne    115c <html_parser_ltrim+0x4c>
jmp    117b <html_parser_ltrim+0x6b>
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%rcx
add    $0xffffffffffffffff,%rcx
mov    %rcx,(%rax)
jmp    1120 <html_parser_ltrim+0x10>
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<html_parser_ltrim>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
movsbl (%rdi),%edi
nopl   (%rax)
call   1030 <ishtmlspace@plt>
test   %rax,%rax
je     1143 <html_parser_ltrim+0x33>
mov    (%r14),%rax
test   %rax,%rax
je     1143 <html_parser_ltrim+0x33>
add    $0xffffffffffffffff,%rax
mov    %rax,(%r14)
movsbl 0x1(%rbx),%edi
add    $0x1,%rbx
jmp    1120 <html_parser_ltrim+0x10>
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define i8* @html_parser_ltrim(i8* %0, i64* %1) {
%3 = alloca i8*
%4 = alloca i64*
store i8* %0, i8** %3
store i64* %1, i64** %4
br label %5
5: ; preds = %16, %2
%6 = load i8*, i8** %3
%7 = load i8, i8* %6
%8 = call i64 @ishtmlspace(i8 signext %7)
%9 = icmp ne i64 %8, 0
br i1 %9, label %10, label %14
10: ; preds = %5
%11 = load i64*, i64** %4
%12 = load i64, i64* %11
%13 = icmp ugt i64 %12, 0
br label %14
14: ; preds = %10, %5
%15 = phi i1 [ false, %5 ], [ %13, %10 ]
br i1 %15, label %16, label %22
16: ; preds = %14
%17 = load i8*, i8** %3
%18 = getelementptr inbounds i8, i8* %17, i32 1
store i8* %18, i8** %3
%19 = load i64*, i64** %4
%20 = load i64, i64* %19
%21 = add i64 %20, -1
store i64 %21, i64* %19
br label %5
22: ; preds = %14
%23 = load i8*, i8** %3
ret i8* %23
}

LLVM IR (-O2):
define i8* @html_parser_ltrim(i8* %0, i64* nocapture %1) {
%3 = load i8, i8* %0
%4 = tail call i64 @ishtmlspace(i8 signext %3)
%5 = icmp eq i64 %4, 0
br i1 %5, label %16, label %6
6: ; preds = %2, %10
%7 = phi i8* [ %11, %10 ], [ %0, %2 ]
%8 = load i64, i64* %1
%9 = icmp eq i64 %8, 0
br i1 %9, label %16, label %10
10: ; preds = %6
%11 = getelementptr inbounds i8, i8* %7, i64 1
%12 = add i64 %8, -1
store i64 %12, i64* %1
%13 = load i8, i8* %11
%14 = tail call i64 @ishtmlspace(i8 signext %13)
%15 = icmp eq i64 %14, 0
br i1 %15, label %16, label %6
16: ; preds = %6, %10, %2
%17 = phi i8* [ %0, %2 ], [ %11, %10 ], [ %7, %6 ]
ret i8* %17
}