#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);
unsigned get_text_element_size(const char *begin, const char *end) {
  unsigned size = 0;
  char *it = (char *)begin;
  do {
    size++;
    it++;
  } while (!isspace(*it) && it != end);
  return size;
}


x86 assembly (clang, -O0):
<get_text_element_size>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
mov    -0x20(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
movsbl (%rax),%edi
call   1030 <isspace@plt>
mov    %eax,%ecx
xor    %eax,%eax
cmp    $0x0,%ecx
mov    %al,-0x21(%rbp)
jne    116e <get_text_element_size+0x5e>
mov    -0x20(%rbp),%rax
cmp    -0x10(%rbp),%rax
setne  %al
mov    %al,-0x21(%rbp)
mov    -0x21(%rbp),%al
test   $0x1,%al
jne    112f <get_text_element_size+0x1f>
mov    -0x14(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_text_element_size>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%r15
add    $0x1,%r15
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
lea    (%r15,%rbx,1),%r12
movsbl (%r15,%rbx,1),%edi
call   1030 <isspace@plt>
add    $0x1,%rbx
cmp    %r14,%r12
je     114b <get_text_element_size+0x3b>
test   %eax,%eax
je     1130 <get_text_element_size+0x20>
mov    %ebx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

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

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