#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 isAlpha(char);
int isNumeric(char);
char matchIdentifier(char *fulltxt, long *cpos, long clen) {
  if (isAlpha(fulltxt[*cpos]) == 0)
    return 0;
  (*cpos)++;
  while (*cpos < clen &&
         (isAlpha(fulltxt[*cpos]) == 1 || isNumeric(fulltxt[*cpos]) == 1)) {
    (*cpos)++;
  }
  return 1;
}


x86 assembly (clang, -O0):
<matchIdentifier>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    -0x10(%rbp),%rax
mov    -0x18(%rbp),%rcx
mov    (%rcx),%rcx
movsbl (%rax,%rcx,1),%edi
call   1040 <isAlpha@plt>
cmp    $0x0,%eax
jne    115a <matchIdentifier+0x3a>
movb   $0x0,-0x1(%rbp)
jmp    11ec <matchIdentifier+0xcc>
mov    -0x18(%rbp),%rax
mov    (%rax),%rcx
add    $0x1,%rcx
mov    %rcx,(%rax)
mov    -0x18(%rbp),%rax
mov    (%rax),%rcx
xor    %eax,%eax
cmp    -0x20(%rbp),%rcx
mov    %al,-0x21(%rbp)
jge    11c5 <matchIdentifier+0xa5>
mov    -0x10(%rbp),%rax
mov    -0x18(%rbp),%rcx
mov    (%rcx),%rcx
movsbl (%rax,%rcx,1),%edi
call   1040 <isAlpha@plt>
mov    %eax,%ecx
mov    $0x1,%al
cmp    $0x1,%ecx
mov    %al,-0x22(%rbp)
je     11bf <matchIdentifier+0x9f>
mov    -0x10(%rbp),%rax
mov    -0x18(%rbp),%rcx
mov    (%rcx),%rcx
movsbl (%rax,%rcx,1),%edi
call   1030 <isNumeric@plt>
cmp    $0x1,%eax
sete   %al
mov    %al,-0x22(%rbp)
mov    -0x22(%rbp),%al
mov    %al,-0x21(%rbp)
mov    -0x21(%rbp),%al
test   $0x1,%al
jne    11d5 <matchIdentifier+0xb5>
jmp    11e8 <matchIdentifier+0xc8>
mov    -0x18(%rbp),%rax
mov    (%rax),%rcx
add    $0x1,%rcx
mov    %rcx,(%rax)
jmp    1168 <matchIdentifier+0x48>
movb   $0x1,-0x1(%rbp)
movsbl -0x1(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<matchIdentifier>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %rdx,%r14
mov    %rsi,%rbx
mov    %rdi,%r15
mov    (%rsi),%rax
movsbl (%rdi,%rax,1),%edi
call   1040 <isAlpha@plt>
test   %eax,%eax
je     1182 <matchIdentifier+0x62>
mov    (%rbx),%rax
add    $0x1,%rax
mov    %rax,(%rbx)
mov    $0x1,%bpl
jmp    115a <matchIdentifier+0x3a>
nop
mov    (%rbx),%rax
add    $0x1,%rax
mov    %rax,(%rbx)
cmp    %r14,%rax
jge    1184 <matchIdentifier+0x64>
movsbl (%r15,%rax,1),%edi
call   1040 <isAlpha@plt>
cmp    $0x1,%eax
je     1150 <matchIdentifier+0x30>
mov    (%rbx),%rax
movsbl (%r15,%rax,1),%edi
call   1030 <isNumeric@plt>
cmp    $0x1,%eax
je     1150 <matchIdentifier+0x30>
jmp    1184 <matchIdentifier+0x64>
xor    %ebp,%ebp
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define signext i8 @matchIdentifier(i8* %0, i64* %1, i64 %2) {
%4 = alloca i8
%5 = alloca i8*
%6 = alloca i64*
%7 = alloca i64
store i8* %0, i8** %5
store i64* %1, i64** %6
store i64 %2, i64* %7
%8 = load i8*, i8** %5
%9 = load i64*, i64** %6
%10 = load i64, i64* %9
%11 = getelementptr inbounds i8, i8* %8, i64 %10
%12 = load i8, i8* %11
%13 = call i32 @isAlpha(i8 signext %12)
%14 = icmp eq i32 %13, 0
br i1 %14, label %15, label %16
15: ; preds = %3
store i8 0, i8* %4
br label %50
16: ; preds = %3
%17 = load i64*, i64** %6
%18 = load i64, i64* %17
%19 = add nsw i64 %18, 1
store i64 %19, i64* %17
br label %20
20: ; preds = %45, %16
%21 = load i64*, i64** %6
%22 = load i64, i64* %21
%23 = load i64, i64* %7
%24 = icmp slt i64 %22, %23
br i1 %24, label %25, label %43
25: ; preds = %20
%26 = load i8*, i8** %5
%27 = load i64*, i64** %6
%28 = load i64, i64* %27
%29 = getelementptr inbounds i8, i8* %26, i64 %28
%30 = load i8, i8* %29
%31 = call i32 @isAlpha(i8 signext %30)
%32 = icmp eq i32 %31, 1
br i1 %32, label %41, label %33
33: ; preds = %25
%34 = load i8*, i8** %5
%35 = load i64*, i64** %6
%36 = load i64, i64* %35
%37 = getelementptr inbounds i8, i8* %34, i64 %36
%38 = load i8, i8* %37
%39 = call i32 @isNumeric(i8 signext %38)
%40 = icmp eq i32 %39, 1
br label %41
41: ; preds = %33, %25
%42 = phi i1 [ true, %25 ], [ %40, %33 ]
br label %43
43: ; preds = %41, %20
%44 = phi i1 [ false, %20 ], [ %42, %41 ]
br i1 %44, label %45, label %49
45: ; preds = %43
%46 = load i64*, i64** %6
%47 = load i64, i64* %46
%48 = add nsw i64 %47, 1
store i64 %48, i64* %46
br label %20
49: ; preds = %43
store i8 1, i8* %4
br label %50
50: ; preds = %49, %15
%51 = load i8, i8* %4
ret i8 %51
}

LLVM IR (-O2):
define signext i8 @matchIdentifier(i8* nocapture %0, i64* nocapture %1, i64 %2) {
%4 = load i64, i64* %1
%5 = getelementptr inbounds i8, i8* %0, i64 %4
%6 = load i8, i8* %5
%7 = tail call i32 @isAlpha(i8 signext %6)
%8 = icmp eq i32 %7, 0
br i1 %8, label %29, label %9
9: ; preds = %3
%10 = load i64, i64* %1
%11 = add nsw i64 %10, 1
store i64 %11, i64* %1
%12 = icmp slt i64 %11, %2
br i1 %12, label %13, label %29
13: ; preds = %9, %25
%14 = phi i64 [ %27, %25 ], [ %11, %9 ]
%15 = getelementptr inbounds i8, i8* %0, i64 %14
%16 = load i8, i8* %15
%17 = tail call i32 @isAlpha(i8 signext %16)
%18 = icmp eq i32 %17, 1
br i1 %18, label %25, label %19
19: ; preds = %13
%20 = load i64, i64* %1
%21 = getelementptr inbounds i8, i8* %0, i64 %20
%22 = load i8, i8* %21
%23 = tail call i32 @isNumeric(i8 signext %22)
%24 = icmp eq i32 %23, 1
br i1 %24, label %25, label %29
25: ; preds = %13, %19
%26 = load i64, i64* %1
%27 = add nsw i64 %26, 1
store i64 %27, i64* %1
%28 = icmp slt i64 %27, %2
br i1 %28, label %13, label %29
29: ; preds = %25, %19, %9, %3
%30 = phi i8 [ 0, %3 ], [ 1, %9 ], [ 1, %19 ], [ 1, %25 ]
ret i8 %30
}