#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__ _citrus_bcs_isspace(char const);
const char *_citrus_bcs_skip_ws_len(const char *__restrict p,
                                    size_t *__restrict len) {
  while (*p && *len > 0 && _citrus_bcs_isspace(*p)) {
    p++;
    (*len)--;
  }
  return (p);
}


x86 assembly (clang, -O0):
<_citrus_bcs_skip_ws_len>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%ecx
xor    %eax,%eax
cmp    $0x0,%ecx
mov    %al,-0x11(%rbp)
je     115e <_citrus_bcs_skip_ws_len+0x4e>
mov    -0x10(%rbp),%rcx
xor    %eax,%eax
cmpq   $0x0,(%rcx)
mov    %al,-0x11(%rbp)
jbe    115e <_citrus_bcs_skip_ws_len+0x4e>
mov    -0x8(%rbp),%rax
movsbl (%rax),%edi
call   1030 <_citrus_bcs_isspace@plt>
cmp    $0x0,%rax
setne  %al
mov    %al,-0x11(%rbp)
mov    -0x11(%rbp),%al
test   $0x1,%al
jne    116e <_citrus_bcs_skip_ws_len+0x5e>
jmp    118d <_citrus_bcs_skip_ws_len+0x7d>
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 <_citrus_bcs_skip_ws_len+0x10>
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_citrus_bcs_skip_ws_len>:
push   %r15
push   %r14
push   %rbx
mov    %rdi,%r15
mov    (%rdi),%al
test   %al,%al
je     1157 <_citrus_bcs_skip_ws_len+0x47>
mov    %rsi,%r14
mov    (%rsi),%rbx
add    $0xffffffffffffffff,%rbx
nopl   0x0(%rax,%rax,1)
cmp    $0xffffffffffffffff,%rbx
je     1157 <_citrus_bcs_skip_ws_len+0x47>
movsbl %al,%edi
call   1030 <_citrus_bcs_isspace@plt>
test   %rax,%rax
je     1157 <_citrus_bcs_skip_ws_len+0x47>
mov    %rbx,(%r14)
movzbl 0x1(%r15),%eax
add    $0x1,%r15
add    $0xffffffffffffffff,%rbx
test   %al,%al
jne    1130 <_citrus_bcs_skip_ws_len+0x20>
mov    %r15,%rax
pop    %rbx
pop    %r14
pop    %r15
ret

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

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