#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 chrIsalm(char const);
int isalpha(char const);
int chrIsnam(const char *string) {
  const char *pr;
  int result;
  if (!string)
    return 0;
  result = isalpha(string[0]);
  pr = string;
  while (result && *(++pr)) {
    result = chrIsalm(*pr);
  }
  return result;
}


x86 assembly (clang, -O0):
<chrIsnam>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1143 <chrIsnam+0x23>
movl   $0x0,-0x4(%rbp)
jmp    11af <chrIsnam+0x8f>
mov    -0x10(%rbp),%rax
movsbl (%rax),%edi
call   1040 <isalpha@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
xor    %eax,%eax
cmpl   $0x0,-0x1c(%rbp)
mov    %al,-0x1d(%rbp)
je     1185 <chrIsnam+0x65>
mov    -0x18(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x18(%rbp)
movsbl 0x1(%rax),%eax
cmp    $0x0,%eax
setne  %al
mov    %al,-0x1d(%rbp)
mov    -0x1d(%rbp),%al
test   $0x1,%al
jne    1195 <chrIsnam+0x75>
jmp    11a9 <chrIsnam+0x89>
mov    -0x18(%rbp),%rax
movsbl (%rax),%edi
call   1030 <chrIsalm@plt>
mov    %eax,-0x1c(%rbp)
jmp    115a <chrIsnam+0x3a>
mov    -0x1c(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<chrIsnam>:
push   %rbp
push   %rbx
push   %rax
xor    %ebp,%ebp
test   %rdi,%rdi
je     1169 <chrIsnam+0x49>
mov    %rdi,%rbx
movsbl (%rdi),%edi
call   1040 <isalpha@plt>
test   %eax,%eax
je     1169 <chrIsnam+0x49>
mov    0x1(%rbx),%cl
test   %cl,%cl
je     1167 <chrIsnam+0x47>
add    $0x2,%rbx
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
movsbl %cl,%edi
call   1030 <chrIsalm@plt>
test   %eax,%eax
je     1169 <chrIsnam+0x49>
movzbl (%rbx),%ecx
add    $0x1,%rbx
test   %cl,%cl
jne    1150 <chrIsnam+0x30>
mov    %eax,%ebp
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define i32 @chrIsnam(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i32
store i8* %0, i8** %3
%6 = load i8*, i8** %3
%7 = icmp ne i8* %6, null
br i1 %7, label %9, label %8
8: ; preds = %1
store i32 0, i32* %2
br label %32
9: ; preds = %1
%10 = load i8*, i8** %3
%11 = getelementptr inbounds i8, i8* %10, i64 0
%12 = load i8, i8* %11
%13 = call i32 @isalpha(i8 signext %12)
store i32 %13, i32* %5
%14 = load i8*, i8** %3
store i8* %14, i8** %4
br label %15
15: ; preds = %26, %9
%16 = load i32, i32* %5
%17 = icmp ne i32 %16, 0
br i1 %17, label %18, label %24
18: ; preds = %15
%19 = load i8*, i8** %4
%20 = getelementptr inbounds i8, i8* %19, i32 1
store i8* %20, i8** %4
%21 = load i8, i8* %20
%22 = sext i8 %21 to i32
%23 = icmp ne i32 %22, 0
br label %24
24: ; preds = %18, %15
%25 = phi i1 [ false, %15 ], [ %23, %18 ]
br i1 %25, label %26, label %30
26: ; preds = %24
%27 = load i8*, i8** %4
%28 = load i8, i8* %27
%29 = call i32 @chrIsalm(i8 signext %28)
store i32 %29, i32* %5
br label %15
30: ; preds = %24
%31 = load i32, i32* %5
store i32 %31, i32* %2
br label %32
32: ; preds = %30, %8
%33 = load i32, i32* %2
ret i32 %33
}

LLVM IR (-O2):
define i32 @chrIsnam(i8* %0) {
%2 = icmp eq i8* %0, null
br i1 %2, label %20, label %3
3: ; preds = %1
%4 = load i8, i8* %0
%5 = tail call i32 @isalpha(i8 signext %4)
%6 = icmp eq i32 %5, 0
br i1 %6, label %20, label %7
7: ; preds = %3
%8 = getelementptr inbounds i8, i8* %0, i64 1
%9 = load i8, i8* %8
%10 = icmp eq i8 %9, 0
br i1 %10, label %20, label %15
11: ; preds = %15
%12 = getelementptr inbounds i8, i8* %17, i64 1
%13 = load i8, i8* %12
%14 = icmp eq i8 %13, 0
br i1 %14, label %20, label %15
15: ; preds = %7, %11
%16 = phi i8 [ %13, %11 ], [ %9, %7 ]
%17 = phi i8* [ %12, %11 ], [ %8, %7 ]
%18 = tail call i32 @chrIsalm(i8 signext %16)
%19 = icmp eq i32 %18, 0
br i1 %19, label %20, label %11
20: ; preds = %11, %15, %7, %3, %1
%21 = phi i32 [ 0, %1 ], [ 0, %3 ], [ %5, %7 ], [ 0, %15 ], [ %18, %11 ]
ret i32 %21
}