#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);
int /*<<< orphan*/ isupper(char);
int isAllUpper(char *s) {
  char c;
  while ((c = *s++) != 0) {
    if (isalpha(c) && !isupper(c))
      return 0;
  }
  return 1;
}


x86 assembly (clang, -O0):
<isAllUpper>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
mov    (%rax),%al
mov    %al,-0x11(%rbp)
movsbl %al,%eax
cmp    $0x0,%eax
je     1182 <isAllUpper+0x62>
movsbl -0x11(%rbp),%edi
call   1030 <isalpha@plt>
cmp    $0x0,%rax
je     117d <isAllUpper+0x5d>
movsbl -0x11(%rbp),%edi
call   1040 <isupper@plt>
cmp    $0x0,%eax
jne    117d <isAllUpper+0x5d>
movl   $0x0,-0x4(%rbp)
jmp    1189 <isAllUpper+0x69>
jmp    112c <isAllUpper+0xc>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<isAllUpper>:
push   %rbp
push   %r14
push   %rbx
mov    (%rdi),%al
mov    $0x1,%r14d
test   %al,%al
je     1168 <isAllUpper+0x48>
mov    %rdi,%rbx
add    $0x1,%rbx
jmp    114b <isAllUpper+0x2b>
nopl   0x0(%rax)
movzbl (%rbx),%eax
add    $0x1,%rbx
test   %al,%al
je     1168 <isAllUpper+0x48>
movsbl %al,%ebp
mov    %ebp,%edi
call   1030 <isalpha@plt>
test   %rax,%rax
je     1140 <isAllUpper+0x20>
mov    %ebp,%edi
call   1040 <isupper@plt>
test   %eax,%eax
jne    1140 <isAllUpper+0x20>
xor    %r14d,%r14d
mov    %r14d,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

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

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