#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 */
unsigned int readNextName(char *, char **, char **, unsigned int *);
unsigned int readNextString(char *, char **, char **, unsigned int *);
unsigned int validateIdentifier(char *rule, unsigned char *identifierType) {
  char *first;
  char *last;
  unsigned int hash;
  do {
    if (readNextName(rule, &first, &last, &hash) != 0) {
      return readNextName(rule, &first, &last, &hash);
    }
  } while (0);
  *identifierType = 0x09;
  if (hash == 1690058490) {
    *identifierType = 0x0A;
  }
  do {
    if (readNextString(last, &first, &last, &hash) != 0) {
      return readNextString(last, &first, &last, &hash);
    }
  } while (0);
  return 0;
}


x86 assembly (clang, -O0):
<validateIdentifier>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
lea    -0x20(%rbp),%rsi
lea    -0x28(%rbp),%rdx
lea    -0x2c(%rbp),%rcx
call   1040 <readNextName@plt>
cmp    $0x0,%eax
je     116b <validateIdentifier+0x4b>
mov    -0x10(%rbp),%rdi
lea    -0x20(%rbp),%rsi
lea    -0x28(%rbp),%rdx
lea    -0x2c(%rbp),%rcx
call   1040 <readNextName@plt>
mov    %eax,-0x4(%rbp)
jmp    11d7 <validateIdentifier+0xb7>
jmp    1170 <validateIdentifier+0x50>
mov    -0x18(%rbp),%rax
movb   $0x9,(%rax)
cmpl   $0x64bc3efa,-0x2c(%rbp)
jne    118b <validateIdentifier+0x6b>
mov    -0x18(%rbp),%rax
movb   $0xa,(%rax)
jmp    1190 <validateIdentifier+0x70>
mov    -0x28(%rbp),%rdi
lea    -0x20(%rbp),%rsi
lea    -0x28(%rbp),%rdx
lea    -0x2c(%rbp),%rcx
call   1030 <readNextString@plt>
cmp    $0x0,%eax
je     11cb <validateIdentifier+0xab>
mov    -0x28(%rbp),%rdi
lea    -0x20(%rbp),%rsi
lea    -0x28(%rbp),%rdx
lea    -0x2c(%rbp),%rcx
call   1030 <readNextString@plt>
mov    %eax,-0x4(%rbp)
jmp    11d7 <validateIdentifier+0xb7>
jmp    11d0 <validateIdentifier+0xb0>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<validateIdentifier>:
push   %r14
push   %rbx
sub    $0x18,%rsp
mov    %rsi,%r14
mov    %rdi,%rbx
lea    0x10(%rsp),%rsi
lea    0x8(%rsp),%rdx
lea    0x4(%rsp),%rcx
call   1040 <readNextName@plt>
test   %eax,%eax
je     115e <validateIdentifier+0x3e>
lea    0x10(%rsp),%rsi
lea    0x8(%rsp),%rdx
lea    0x4(%rsp),%rcx
mov    %rbx,%rdi
call   1040 <readNextName@plt>
jmp    11a8 <validateIdentifier+0x88>
cmpl   $0x64bc3efa,0x4(%rsp)
64
sete   %al
add    $0x9,%al
mov    %al,(%r14)
mov    0x8(%rsp),%rdi
lea    0x10(%rsp),%rsi
lea    0x8(%rsp),%rdx
lea    0x4(%rsp),%rcx
call   1030 <readNextString@plt>
test   %eax,%eax
je     11a6 <validateIdentifier+0x86>
mov    0x8(%rsp),%rdi
lea    0x10(%rsp),%rsi
lea    0x8(%rsp),%rdx
lea    0x4(%rsp),%rcx
call   1030 <readNextString@plt>
jmp    11a8 <validateIdentifier+0x88>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define i32 @validateIdentifier(i8* %0, i8* %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i32
store i8* %0, i8** %4
store i8* %1, i8** %5
br label %9
9: ; preds = %2
%10 = load i8*, i8** %4
%11 = call i32 @readNextName(i8* %10, i8** %6, i8** %7, i32* %8)
%12 = icmp ne i32 %11, 0
br i1 %12, label %13, label %16
13: ; preds = %9
%14 = load i8*, i8** %4
%15 = call i32 @readNextName(i8* %14, i8** %6, i8** %7, i32* %8)
store i32 %15, i32* %3
br label %33
16: ; preds = %9
br label %17
17: ; preds = %16
%18 = load i8*, i8** %5
store i8 9, i8* %18
%19 = load i32, i32* %8
%20 = icmp eq i32 %19, 1690058490
br i1 %20, label %21, label %23
21: ; preds = %17
%22 = load i8*, i8** %5
store i8 10, i8* %22
br label %23
23: ; preds = %21, %17
br label %24
24: ; preds = %23
%25 = load i8*, i8** %7
%26 = call i32 @readNextString(i8* %25, i8** %6, i8** %7, i32* %8)
%27 = icmp ne i32 %26, 0
br i1 %27, label %28, label %31
28: ; preds = %24
%29 = load i8*, i8** %7
%30 = call i32 @readNextString(i8* %29, i8** %6, i8** %7, i32* %8)
store i32 %30, i32* %3
br label %33
31: ; preds = %24
br label %32
32: ; preds = %31
store i32 0, i32* %3
br label %33
33: ; preds = %32, %28, %13
%34 = load i32, i32* %3
ret i32 %34
}

LLVM IR (-O2):
define i32 @validateIdentifier(i8* %0, i8* nocapture writeonly %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i32
%6 = bitcast i8** %3 to i8*
%7 = bitcast i8** %4 to i8*
%8 = bitcast i32* %5 to i8*
%9 = call i32 @readNextName(i8* %0, i8** %3, i8** %4, i32* %5)
%10 = icmp eq i32 %9, 0
br i1 %10, label %13, label %11
11: ; preds = %2
%12 = call i32 @readNextName(i8* %0, i8** %3, i8** %4, i32* %5)
br label %23
13: ; preds = %2
%14 = load i32, i32* %5
%15 = icmp eq i32 %14, 1690058490
%16 = select i1 %15, i8 10, i8 9
store i8 %16, i8* %1
%17 = load i8*, i8** %4
%18 = call i32 @readNextString(i8* %17, i8** %3, i8** %4, i32* %5)
%19 = icmp eq i32 %18, 0
br i1 %19, label %23, label %20
20: ; preds = %13
%21 = load i8*, i8** %4
%22 = call i32 @readNextString(i8* %21, i8** %3, i8** %4, i32* %5)
br label %23
23: ; preds = %13, %20, %11
%24 = phi i32 [ %12, %11 ], [ %22, %20 ], [ 0, %13 ]
ret i32 %24
}