#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*/ my_isspace(char const);
char *find_first_not_space(const char *begin, const char *end) {
  size_t offset = 0;
  size_t length = end - begin;
  for (; offset < length; offset++) {
    if (!my_isspace(begin[offset]))
      break;
  }
  return (char *)begin + offset;
}


x86 assembly (clang, -O0):
<find_first_not_space>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movq   $0x0,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    -0x8(%rbp),%rcx
sub    %rcx,%rax
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rax
cmp    -0x20(%rbp),%rax
jae    117a <find_first_not_space+0x6a>
mov    -0x8(%rbp),%rax
mov    -0x18(%rbp),%rcx
movsbl (%rax,%rcx,1),%edi
call   1030 <my_isspace@plt>
cmp    $0x0,%eax
jne    1164 <find_first_not_space+0x54>
jmp    117a <find_first_not_space+0x6a>
jmp    1169 <find_first_not_space+0x59>
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    1137 <find_first_not_space+0x27>
mov    -0x8(%rbp),%rax
add    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<find_first_not_space>:
push   %r15
push   %r14
push   %rbx
mov    %rsi,%r15
mov    %rdi,%r14
xor    %ebx,%ebx
sub    %rdi,%r15
je     114a <find_first_not_space+0x3a>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
movsbl (%r14,%rbx,1),%edi
call   1030 <my_isspace@plt>
test   %eax,%eax
je     114a <find_first_not_space+0x3a>
add    $0x1,%rbx
cmp    %rbx,%r15
jne    1130 <find_first_not_space+0x20>
mov    %r15,%rbx
add    %rbx,%r14
mov    %r14,%rax
pop    %rbx
pop    %r14
pop    %r15
ret

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

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