int checkname(cp)
register char *cp;
{
  if (!letter(*cp++))
    return (0);
  while (*cp)
    if (!letnum(*cp++))
      return (0);
  return (1);
}


x86 assembly (clang, -O0):
<checkname>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
movsbl (%rax),%edi
mov    $0x0,%al
call   1040 <letter@plt>
cmp    $0x0,%eax
jne    115a <checkname+0x3a>
movl   $0x0,-0x4(%rbp)
jmp    11a6 <checkname+0x86>
jmp    115f <checkname+0x3f>
mov    -0x10(%rbp),%rax
cmpb   $0x0,(%rax)
je     119f <checkname+0x7f>
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
movsbl (%rax),%edi
mov    $0x0,%al
call   1030 <letnum@plt>
cmp    $0x0,%eax
jne    119a <checkname+0x7a>
movl   $0x0,-0x4(%rbp)
jmp    11a6 <checkname+0x86>
jmp    115f <checkname+0x3f>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<checkname>:
push   %rbp
push   %rbx
push   %rax
mov    %rdi,%rbx
movsbl (%rdi),%edi
xor    %ebp,%ebp
xor    %eax,%eax
call   1040 <letter@plt>
test   %eax,%eax
je     115d <checkname+0x3d>
add    $0x1,%rbx
xor    %ebp,%ebp
nopl   0x0(%rax)
movsbl (%rbx),%edi
test   %edi,%edi
je     1158 <checkname+0x38>
xor    %eax,%eax
call   1030 <letnum@plt>
add    $0x1,%rbx
test   %eax,%eax
jne    1140 <checkname+0x20>
jmp    115d <checkname+0x3d>
mov    $0x1,%ebp
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define i32 @checkname(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
store i8* %0, i8** %3
%4 = load i8*, i8** %3
%5 = getelementptr inbounds i8, i8* %4, i32 1
store i8* %5, i8** %3
%6 = load i8, i8* %4
%7 = sext i8 %6 to i32
%8 = call i32 (i32, ...) bitcast (i32 (...)* @letter to i32 (i32, ...)*)(i32 %7)
%9 = icmp ne i32 %8, 0
br i1 %9, label %11, label %10
10: ; preds = %1
store i32 0, i32* %2
br label %26
11: ; preds = %1
br label %12
12: ; preds = %24, %11
%13 = load i8*, i8** %3
%14 = load i8, i8* %13
%15 = icmp ne i8 %14, 0
br i1 %15, label %16, label %25
16: ; preds = %12
%17 = load i8*, i8** %3
%18 = getelementptr inbounds i8, i8* %17, i32 1
store i8* %18, i8** %3
%19 = load i8, i8* %17
%20 = sext i8 %19 to i32
%21 = call i32 (i32, ...) bitcast (i32 (...)* @letnum to i32 (i32, ...)*)(i32 %20)
%22 = icmp ne i32 %21, 0
br i1 %22, label %24, label %23
23: ; preds = %16
store i32 0, i32* %2
br label %26
24: ; preds = %16
br label %12
25: ; preds = %12
store i32 1, i32* %2
br label %26
26: ; preds = %25, %23, %10
%27 = load i32, i32* %2
ret i32 %27
}

LLVM IR (-O2):
define i32 @checkname(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = sext i8 %2 to i32
%4 = tail call i32 (i32, ...) bitcast (i32 (...)* @letter to i32 (i32, ...)*)(i32 %3)
%5 = icmp eq i32 %4, 0
br i1 %5, label %15, label %6
6: ; preds = %1, %11
%7 = phi i8* [ %8, %11 ], [ %0, %1 ]
%8 = getelementptr inbounds i8, i8* %7, i64 1
%9 = load i8, i8* %8
%10 = icmp eq i8 %9, 0
br i1 %10, label %15, label %11
11: ; preds = %6
%12 = sext i8 %9 to i32
%13 = tail call i32 (i32, ...) bitcast (i32 (...)* @letnum to i32 (i32, ...)*)(i32 %12)
%14 = icmp eq i32 %13, 0
br i1 %14, label %15, label %6
15: ; preds = %6, %11, %1
%16 = phi i32 [ 0, %1 ], [ 1, %6 ], [ 0, %11 ]
ret i32 %16
}