#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__ isalpha(char const);
int isLetter(const char *c, char *value) {
  const char *start = c;
  if (c == NULL)
    return 0;
  if (isalpha(*c)) {
    if (value != NULL)
      *value = *c;
    c++;
    return c - start;
  } else
    return 0;
}


x86 assembly (clang, -O0):
<isLetter>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    113f <isLetter+0x2f>
movl   $0x0,-0x4(%rbp)
jmp    1192 <isLetter+0x82>
mov    -0x10(%rbp),%rax
movsbl (%rax),%edi
call   1030 <isalpha@plt>
cmp    $0x0,%rax
je     118b <isLetter+0x7b>
cmpq   $0x0,-0x18(%rbp)
je     116c <isLetter+0x5c>
mov    -0x10(%rbp),%rax
mov    (%rax),%cl
mov    -0x18(%rbp),%rax
mov    %cl,(%rax)
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    -0x20(%rbp),%rcx
sub    %rcx,%rax
mov    %eax,-0x4(%rbp)
jmp    1192 <isLetter+0x82>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<isLetter>:
push   %rbp
push   %r14
push   %rbx
xor    %ebp,%ebp
test   %rdi,%rdi
je     113d <isLetter+0x2d>
mov    %rsi,%r14
mov    %rdi,%rbx
movsbl (%rdi),%edi
call   1030 <isalpha@plt>
test   %rax,%rax
je     113d <isLetter+0x2d>
mov    $0x1,%ebp
test   %r14,%r14
je     113d <isLetter+0x2d>
mov    (%rbx),%al
mov    %al,(%r14)
mov    %ebp,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

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

LLVM IR (-O2):
define i32 @isLetter(i8* %0, i8* writeonly %1) {
%3 = icmp eq i8* %0, null
br i1 %3, label %12, label %4
4: ; preds = %2
%5 = load i8, i8* %0
%6 = tail call i64 @isalpha(i8 signext %5)
%7 = icmp eq i64 %6, 0
br i1 %7, label %12, label %8
8: ; preds = %4
%9 = icmp eq i8* %1, null
br i1 %9, label %12, label %10
10: ; preds = %8
%11 = load i8, i8* %0
store i8 %11, i8* %1
br label %12
12: ; preds = %4, %8, %10, %2
%13 = phi i32 [ 0, %2 ], [ 1, %10 ], [ 1, %8 ], [ 0, %4 ]
ret i32 %13
}