#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*/ isalnum(char);
int FSQLF_is_word(char *text, size_t length) {
  if (length <= 2) {
    for (size_t i = 0; i < length; ++i) {
      if (!isalnum(text[i])) {
        return 0;
      }
    }
  }
  return 1;
}


x86 assembly (clang, -O0):
<FSQLF_is_word>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
cmpq   $0x2,-0x18(%rbp)
ja     1182 <FSQLF_is_word+0x72>
movq   $0x0,-0x20(%rbp)
mov    -0x20(%rbp),%rax
cmp    -0x18(%rbp),%rax
jae    117d <FSQLF_is_word+0x6d>
mov    -0x10(%rbp),%rax
mov    -0x20(%rbp),%rcx
movsbl (%rax,%rcx,1),%edi
call   1030 <isalnum@plt>
cmp    $0x0,%eax
jne    1167 <FSQLF_is_word+0x57>
movl   $0x0,-0x4(%rbp)
jmp    1189 <FSQLF_is_word+0x79>
jmp    116c <FSQLF_is_word+0x5c>
mov    -0x20(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x20(%rbp)
jmp    1133 <FSQLF_is_word+0x23>
jmp    1182 <FSQLF_is_word+0x72>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<FSQLF_is_word>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
lea    -0x1(%rsi),%rax
mov    $0x1,%r14d
cmp    $0x1,%rax
ja     114c <FSQLF_is_word+0x3c>
mov    %rsi,%rbx
mov    %rdi,%r15
xor    %ebp,%ebp
nop
movsbl (%r15,%rbp,1),%edi
call   1030 <isalnum@plt>
test   %eax,%eax
je     1149 <FSQLF_is_word+0x39>
add    $0x1,%rbp
cmp    %rbp,%rbx
jne    1130 <FSQLF_is_word+0x20>
jmp    114c <FSQLF_is_word+0x3c>
xor    %r14d,%r14d
mov    %r14d,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

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

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