#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 */
scalar_t__ isalnum(char const);
int getidentifierlength(char const *input) {
  int n;
  for (n = 0; (isalnum(input[n]) || (input[n]) == '_'); ++n)
    ;
  return n;
}


x86 assembly (clang, -O0):
<getidentifierlength>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movsbl (%rax,%rcx,1),%edi
call   1030 <isalnum@plt>
mov    %rax,%rcx
mov    $0x1,%al
cmp    $0x0,%rcx
mov    %al,-0xd(%rbp)
jne    115b <getidentifierlength+0x4b>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x5f,%eax
sete   %al
mov    %al,-0xd(%rbp)
mov    -0xd(%rbp),%al
test   $0x1,%al
jne    116b <getidentifierlength+0x5b>
jmp    117e <getidentifierlength+0x6e>
jmp    1170 <getidentifierlength+0x60>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1123 <getidentifierlength+0x13>
mov    -0xc(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getidentifierlength>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
xor    %ebx,%ebx
jmp    1124 <getidentifierlength+0x14>
nopl   0x0(%rax,%rax,1)
add    $0x1,%rbx
movsbl (%r14,%rbx,1),%edi
call   1030 <isalnum@plt>
test   %rax,%rax
jne    1120 <getidentifierlength+0x10>
cmpb   $0x5f,(%r14,%rbx,1)
je     1120 <getidentifierlength+0x10>
mov    %ebx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

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