#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 /*<<< orphan*/ isalpha(char);
scalar_t__ islower(char);
char tolower(char);
int is_good_word(char *word) {
  int seen_lower = 0;
  for (char *c = word; *c; ++c) {
    if (!isalpha(*c))
      return 0;
    if (islower(*c))
      seen_lower = 1;
    *c = tolower(*c);
  }
  if (!seen_lower)
    return 0;
  return 1;
}


x86 assembly (clang, -O0):
<is_good_word>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
cmpb   $0x0,(%rax)
je     11bb <is_good_word+0x8b>
mov    -0x20(%rbp),%rax
movsbl (%rax),%edi
call   1050 <isalpha@plt>
cmp    $0x0,%eax
jne    1179 <is_good_word+0x49>
movl   $0x0,-0x4(%rbp)
jmp    11d8 <is_good_word+0xa8>
mov    -0x20(%rbp),%rax
movsbl (%rax),%edi
call   1030 <islower@plt>
cmp    $0x0,%rax
je     1196 <is_good_word+0x66>
movl   $0x1,-0x14(%rbp)
mov    -0x20(%rbp),%rax
movsbl (%rax),%edi
call   1040 <tolower@plt>
mov    %al,%cl
mov    -0x20(%rbp),%rax
mov    %cl,(%rax)
mov    -0x20(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x20(%rbp)
jmp    114b <is_good_word+0x1b>
cmpl   $0x0,-0x14(%rbp)
jne    11d1 <is_good_word+0xa1>
movl   $0x0,-0x4(%rbp)
jmp    11d8 <is_good_word+0xa8>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<is_good_word>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    (%rdi),%al
test   %al,%al
je     118c <is_good_word+0x5c>
mov    %rdi,%rbx
xor    %r14d,%r14d
mov    $0x1,%r15d
xor    %ebp,%ebp
nopl   0x0(%rax,%rax,1)
movsbl %al,%edi
call   1050 <isalpha@plt>
test   %eax,%eax
je     118f <is_good_word+0x5f>
movsbl (%rbx),%edi
call   1030 <islower@plt>
test   %rax,%rax
cmovne %r15d,%ebp
movsbl (%rbx),%edi
call   1040 <tolower@plt>
mov    %al,(%rbx)
movzbl 0x1(%rbx),%eax
add    $0x1,%rbx
test   %al,%al
jne    1150 <is_good_word+0x20>
xor    %r14d,%r14d
test   %ebp,%ebp
setne  %r14b
jmp    118f <is_good_word+0x5f>
xor    %r14d,%r14d
mov    %r14d,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
define i32 @is_good_word(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %23, label %4
4: ; preds = %1, %10
%5 = phi i8 [ %18, %10 ], [ %2, %1 ]
%6 = phi i8* [ %17, %10 ], [ %0, %1 ]
%7 = phi i32 [ %14, %10 ], [ 0, %1 ]
%8 = tail call i32 @isalpha(i8 signext %5)
%9 = icmp eq i32 %8, 0
br i1 %9, label %23, label %10
10: ; preds = %4
%11 = load i8, i8* %6
%12 = tail call i64 @islower(i8 signext %11)
%13 = icmp eq i64 %12, 0
%14 = select i1 %13, i32 %7, i32 1
%15 = load i8, i8* %6
%16 = tail call signext i8 @tolower(i8 signext %15)
store i8 %16, i8* %6
%17 = getelementptr inbounds i8, i8* %6, i64 1
%18 = load i8, i8* %17
%19 = icmp eq i8 %18, 0
br i1 %19, label %20, label %4
20: ; preds = %10
%21 = icmp ne i32 %14, 0
%22 = zext i1 %21 to i32
br label %23
23: ; preds = %4, %1, %20
%24 = phi i32 [ 0, %1 ], [ %22, %20 ], [ 0, %4 ]
ret i32 %24
}