#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*/ isspace(char const);
int _count_leading_whitespace_chars(char const *in_line_start,
                                    char const *in_line_end) {
  char const *ptr = in_line_start;
  do {
    if (!isspace(*ptr))
      break;
  } while (ptr++ != in_line_end);
  return (int)(ptr - in_line_start);
}


x86 assembly (clang, -O0):
<_count_leading_whitespace_chars>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
movsbl (%rax),%edi
call   1030 <isspace@plt>
cmp    $0x0,%eax
jne    1142 <_count_leading_whitespace_chars+0x32>
jmp    1160 <_count_leading_whitespace_chars+0x50>
jmp    1147 <_count_leading_whitespace_chars+0x37>
mov    -0x18(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x18(%rbp)
cmp    -0x10(%rbp),%rax
jne    1128 <_count_leading_whitespace_chars+0x18>
mov    -0x18(%rbp),%rax
mov    -0x8(%rbp),%rcx
sub    %rcx,%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_count_leading_whitespace_chars>:
push   %r15
push   %r14
push   %rbx
mov    %rsi,%r15
mov    %rdi,%r14
mov    %rdi,%rbx
xchg   %ax,%ax
movsbl (%rbx),%edi
call   1030 <isspace@plt>
test   %eax,%eax
je     113a <_count_leading_whitespace_chars+0x2a>
lea    0x1(%rbx),%rax
cmp    %r15,%rbx
mov    %rax,%rbx
jne    1120 <_count_leading_whitespace_chars+0x10>
jmp    113d <_count_leading_whitespace_chars+0x2d>
mov    %rbx,%rax
sub    %r14d,%eax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define i32 @_count_leading_whitespace_chars(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
%6 = load i8*, i8** %3
store i8* %6, i8** %5
br label %7
7: ; preds = %14, %2
%8 = load i8*, i8** %5
%9 = load i8, i8* %8
%10 = call i32 @isspace(i8 signext %9)
%11 = icmp ne i32 %10, 0
br i1 %11, label %13, label %12
12: ; preds = %7
br label %19
13: ; preds = %7
br label %14
14: ; preds = %13
%15 = load i8*, i8** %5
%16 = getelementptr inbounds i8, i8* %15, i32 1
store i8* %16, i8** %5
%17 = load i8*, i8** %4
%18 = icmp ne i8* %15, %17
br i1 %18, label %7, label %19
19: ; preds = %14, %12
%20 = load i8*, i8** %5
%21 = load i8*, i8** %3
%22 = ptrtoint i8* %20 to i64
%23 = ptrtoint i8* %21 to i64
%24 = sub i64 %22, %23
%25 = trunc i64 %24 to i32
ret i32 %25
}

LLVM IR (-O2):
define i32 @_count_leading_whitespace_chars(i8* %0, i8* readnone %1) {
br label %3
3: ; preds = %8, %2
%4 = phi i8* [ %0, %2 ], [ %9, %8 ]
%5 = load i8, i8* %4
%6 = tail call i32 @isspace(i8 signext %5)
%7 = icmp eq i32 %6, 0
br i1 %7, label %11, label %8
8: ; preds = %3
%9 = getelementptr inbounds i8, i8* %4, i64 1
%10 = icmp eq i8* %4, %1
br i1 %10, label %11, label %3
11: ; preds = %3, %8
%12 = phi i8* [ %9, %8 ], [ %4, %3 ]
%13 = ptrtoint i8* %12 to i64
%14 = ptrtoint i8* %0 to i64
%15 = sub i64 %13, %14
%16 = trunc i64 %15 to i32
ret i32 %16
}