#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 */
char getCharacter(char **);
int parse_NameChar(char **xml, char *szName) {
  char c = '\0';
  int i = 0;
  c = getCharacter(xml);
  szName[0] = c;
  i++;
  while ((c >= '1' && c <= '0') || (c >= 'A' && c <= 'Z') ||
         (c >= 'a' && c <= 'z') || (c == '.') || (c == '_') || (c == ':') ||
         (c == '-')) {
    c = getCharacter(xml);
    szName[i] = c;
    i++;
  }
  i--;
  szName[i] = '\0';
  (*xml)--;
  return 0;
}


x86 assembly (clang, -O0):
<parse_NameChar>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movb   $0x0,-0x11(%rbp)
movl   $0x0,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <getCharacter@plt>
mov    %al,-0x11(%rbp)
mov    -0x11(%rbp),%cl
mov    -0x10(%rbp),%rax
mov    %cl,(%rax)
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
movsbl -0x11(%rbp),%eax
cmp    $0x31,%eax
jl     1168 <parse_NameChar+0x58>
movsbl -0x11(%rbp),%ecx
mov    $0x1,%al
cmp    $0x30,%ecx
mov    %al,-0x19(%rbp)
jle    11e9 <parse_NameChar+0xd9>
movsbl -0x11(%rbp),%eax
cmp    $0x41,%eax
jl     1187 <parse_NameChar+0x77>
movsbl -0x11(%rbp),%ecx
mov    $0x1,%al
cmp    $0x5a,%ecx
mov    %al,-0x19(%rbp)
jle    11e9 <parse_NameChar+0xd9>
movsbl -0x11(%rbp),%eax
cmp    $0x61,%eax
jl     11a6 <parse_NameChar+0x96>
movsbl -0x11(%rbp),%ecx
mov    $0x1,%al
cmp    $0x7a,%ecx
mov    %al,-0x19(%rbp)
jle    11e9 <parse_NameChar+0xd9>
movsbl -0x11(%rbp),%ecx
mov    $0x1,%al
cmp    $0x2e,%ecx
mov    %al,-0x19(%rbp)
je     11e9 <parse_NameChar+0xd9>
movsbl -0x11(%rbp),%ecx
mov    $0x1,%al
cmp    $0x5f,%ecx
mov    %al,-0x19(%rbp)
je     11e9 <parse_NameChar+0xd9>
movsbl -0x11(%rbp),%ecx
mov    $0x1,%al
cmp    $0x3a,%ecx
mov    %al,-0x19(%rbp)
je     11e9 <parse_NameChar+0xd9>
movsbl -0x11(%rbp),%eax
cmp    $0x2d,%eax
sete   %al
mov    %al,-0x19(%rbp)
mov    -0x19(%rbp),%al
test   $0x1,%al
jne    11f9 <parse_NameChar+0xe9>
jmp    1221 <parse_NameChar+0x111>
mov    -0x8(%rbp),%rdi
call   1030 <getCharacter@plt>
mov    %al,-0x11(%rbp)
mov    -0x11(%rbp),%dl
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1149 <parse_NameChar+0x39>
mov    -0x18(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
movb   $0x0,(%rax,%rcx,1)
mov    -0x8(%rbp),%rax
mov    (%rax),%rcx
add    $0xffffffffffffffff,%rcx
mov    %rcx,(%rax)
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<parse_NameChar>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%r15
call   1030 <getCharacter@plt>
mov    %al,(%r14)
lea    0x1(%r14),%rbx
xor    %r12d,%r12d
movabs $0x100000000,%r13
movabs $0x4000000002003,%rbp
jmp    1161 <parse_NameChar+0x51>
cs nopw 0x0(%rax,%rax,1)
mov    %r15,%rdi
call   1030 <getCharacter@plt>
mov    %al,(%rbx)
add    %r13,%r12
add    $0x1,%rbx
lea    -0x41(%rax),%ecx
cmp    $0x1a,%cl
jb     1150 <parse_NameChar+0x40>
lea    -0x61(%rax),%ecx
cmp    $0x1a,%cl
jb     1150 <parse_NameChar+0x40>
add    $0xd3,%al
cmp    $0x32,%al
ja     1180 <parse_NameChar+0x70>
movzbl %al,%eax
bt     %rax,%rbp
jb     1150 <parse_NameChar+0x40>
sar    $0x20,%r12
movb   $0x0,(%r14,%r12,1)
addq   $0xffffffffffffffff,(%r15)
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define i32 @parse_NameChar(i8** %0, i8* %1) {
%3 = alloca i8**
%4 = alloca i8*
%5 = alloca i8
%6 = alloca i32
store i8** %0, i8*** %3
store i8* %1, i8** %4
store i8 0, i8* %5
store i32 0, i32* %6
%7 = load i8**, i8*** %3
%8 = call signext i8 @getCharacter(i8** %7)
store i8 %8, i8* %5
%9 = load i8, i8* %5
%10 = load i8*, i8** %4
%11 = getelementptr inbounds i8, i8* %10, i64 0
store i8 %9, i8* %11
%12 = load i32, i32* %6
%13 = add nsw i32 %12, 1
store i32 %13, i32* %6
br label %14
14: ; preds = %56, %2
%15 = load i8, i8* %5
%16 = sext i8 %15 to i32
%17 = icmp sge i32 %16, 49
br i1 %17, label %18, label %22
18: ; preds = %14
%19 = load i8, i8* %5
%20 = sext i8 %19 to i32
%21 = icmp sle i32 %20, 48
br i1 %21, label %54, label %22
22: ; preds = %18, %14
%23 = load i8, i8* %5
%24 = sext i8 %23 to i32
%25 = icmp sge i32 %24, 65
br i1 %25, label %26, label %30
26: ; preds = %22
%27 = load i8, i8* %5
%28 = sext i8 %27 to i32
%29 = icmp sle i32 %28, 90
br i1 %29, label %54, label %30
30: ; preds = %26, %22
%31 = load i8, i8* %5
%32 = sext i8 %31 to i32
%33 = icmp sge i32 %32, 97
br i1 %33, label %34, label %38
34: ; preds = %30
%35 = load i8, i8* %5
%36 = sext i8 %35 to i32
%37 = icmp sle i32 %36, 122
br i1 %37, label %54, label %38
38: ; preds = %34, %30
%39 = load i8, i8* %5
%40 = sext i8 %39 to i32
%41 = icmp eq i32 %40, 46
br i1 %41, label %54, label %42
42: ; preds = %38
%43 = load i8, i8* %5
%44 = sext i8 %43 to i32
%45 = icmp eq i32 %44, 95
br i1 %45, label %54, label %46
46: ; preds = %42
%47 = load i8, i8* %5
%48 = sext i8 %47 to i32
%49 = icmp eq i32 %48, 58
br i1 %49, label %54, label %50
50: ; preds = %46
%51 = load i8, i8* %5
%52 = sext i8 %51 to i32
%53 = icmp eq i32 %52, 45
br label %54
54: ; preds = %50, %46, %42, %38, %34, %26, %18
%55 = phi i1 [ true, %46 ], [ true, %42 ], [ true, %38 ], [ true, %34 ], [ true, %26 ], [ true, %18 ], [ %53, %50 ]
br i1 %55, label %56, label %66
56: ; preds = %54
%57 = load i8**, i8*** %3
%58 = call signext i8 @getCharacter(i8** %57)
store i8 %58, i8* %5
%59 = load i8, i8* %5
%60 = load i8*, i8** %4
%61 = load i32, i32* %6
%62 = sext i32 %61 to i64
%63 = getelementptr inbounds i8, i8* %60, i64 %62
store i8 %59, i8* %63
%64 = load i32, i32* %6
%65 = add nsw i32 %64, 1
store i32 %65, i32* %6
br label %14
66: ; preds = %54
%67 = load i32, i32* %6
%68 = add nsw i32 %67, -1
store i32 %68, i32* %6
%69 = load i8*, i8** %4
%70 = load i32, i32* %6
%71 = sext i32 %70 to i64
%72 = getelementptr inbounds i8, i8* %69, i64 %71
store i8 0, i8* %72
%73 = load i8**, i8*** %3
%74 = load i8*, i8** %73
%75 = getelementptr inbounds i8, i8* %74, i32 -1
store i8* %75, i8** %73
ret i32 0
}

LLVM IR (-O2):
define i32 @parse_NameChar(i8** %0, i8* nocapture writeonly %1) {
%3 = tail call signext i8 @getCharacter(i8** %0)
store i8 %3, i8* %1
br label %4
4: ; preds = %14, %2
%5 = phi i64 [ %17, %14 ], [ 1, %2 ]
%6 = phi i8 [ %15, %14 ], [ %3, %2 ]
%7 = add i8 %6, -65
%8 = icmp ult i8 %7, 26
br i1 %8, label %14, label %9
9: ; preds = %4
%10 = freeze i8 %6
%11 = add i8 %10, -97
%12 = icmp ult i8 %11, 26
br i1 %12, label %14, label %13
13: ; preds = %9
switch i8 %10, label %18 [
i8 95, label %14
i8 58, label %14
i8 46, label %14
i8 45, label %14
]
14: ; preds = %13, %13, %13, %13, %9, %4
%15 = tail call signext i8 @getCharacter(i8** %0)
%16 = getelementptr inbounds i8, i8* %1, i64 %5
store i8 %15, i8* %16
%17 = add nuw i64 %5, 1
br label %4
18: ; preds = %13
%19 = shl i64 %5, 32
%20 = add i64 %19, -4294967296
%21 = ashr exact i64 %20, 32
%22 = getelementptr inbounds i8, i8* %1, i64 %21
store i8 0, i8* %22
%23 = load i8*, i8** %0
%24 = getelementptr inbounds i8, i8* %23, i64 -1
store i8* %24, i8** %0
ret i32 0
}