#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*/ requireUpperCase(char, char *);
size_t strlen(char *);
int requireUpperCases(char *s, char *where) {
  size_t i, length = strlen(s);
  for (i = 0; i < length; i++)
    if (!requireUpperCase(s[i], where))
      return 0;
  return 1;
}


x86 assembly (clang, -O0):
<requireUpperCases>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <strlen@plt>
mov    %rax,-0x28(%rbp)
movq   $0x0,-0x20(%rbp)
mov    -0x20(%rbp),%rax
cmp    -0x28(%rbp),%rax
jae    1195 <requireUpperCases+0x75>
mov    -0x10(%rbp),%rax
mov    -0x20(%rbp),%rcx
mov    (%rax,%rcx,1),%al
mov    -0x18(%rbp),%rsi
movsbl %al,%edi
call   1040 <requireUpperCase@plt>
cmp    $0x0,%eax
jne    117f <requireUpperCases+0x5f>
movl   $0x0,-0x4(%rbp)
jmp    119c <requireUpperCases+0x7c>
jmp    1184 <requireUpperCases+0x64>
mov    -0x20(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x20(%rbp)
jmp    1145 <requireUpperCases+0x25>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<requireUpperCases>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %rsi,%r15
mov    %rdi,%r12
call   1030 <strlen@plt>
mov    $0x1,%r14d
test   %rax,%rax
je     116f <requireUpperCases+0x4f>
mov    %rax,%rbx
xor    %ebp,%ebp
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
movsbl (%r12,%rbp,1),%edi
mov    %r15,%rsi
call   1040 <requireUpperCase@plt>
test   %eax,%eax
je     116c <requireUpperCases+0x4c>
add    $0x1,%rbp
cmp    %rbp,%rbx
jne    1150 <requireUpperCases+0x30>
jmp    116f <requireUpperCases+0x4f>
xor    %r14d,%r14d
mov    %r14d,%eax
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define i32 @requireUpperCases(i8* %0, i8* %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i64
%7 = alloca i64
store i8* %0, i8** %4
store i8* %1, i8** %5
%8 = load i8*, i8** %4
%9 = call i64 @strlen(i8* %8)
store i64 %9, i64* %7
store i64 0, i64* %6
br label %10
10: ; preds = %24, %2
%11 = load i64, i64* %6
%12 = load i64, i64* %7
%13 = icmp ult i64 %11, %12
br i1 %13, label %14, label %27
14: ; preds = %10
%15 = load i8*, i8** %4
%16 = load i64, i64* %6
%17 = getelementptr inbounds i8, i8* %15, i64 %16
%18 = load i8, i8* %17
%19 = load i8*, i8** %5
%20 = call i32 @requireUpperCase(i8 signext %18, i8* %19)
%21 = icmp ne i32 %20, 0
br i1 %21, label %23, label %22
22: ; preds = %14
store i32 0, i32* %3
br label %28
23: ; preds = %14
br label %24
24: ; preds = %23
%25 = load i64, i64* %6
%26 = add i64 %25, 1
store i64 %26, i64* %6
br label %10
27: ; preds = %10
store i32 1, i32* %3
br label %28
28: ; preds = %27, %22
%29 = load i32, i32* %3
ret i32 %29
}

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