#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 */
short strlen(char *);
bool hasInvalidChars(char *string) {
  short i;
  for (i = 0; i < strlen(string); i++) {
    if (string[i] < 'a' || string[i] > 'z')
      return true;
  }
  return false;
}


x86 assembly (clang, -O0):
<hasInvalidChars>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
movw   $0x0,-0x12(%rbp)
movswl -0x12(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <strlen@plt>
mov    %ax,%cx
mov    -0x18(%rbp),%eax
movswl %cx,%ecx
cmp    %ecx,%eax
jge    1191 <hasInvalidChars+0x81>
mov    -0x10(%rbp),%rax
movswq -0x12(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x61,%eax
jl     116f <hasInvalidChars+0x5f>
mov    -0x10(%rbp),%rax
movswq -0x12(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x7a,%eax
jle    117b <hasInvalidChars+0x6b>
movl   $0x1,-0x4(%rbp)
jmp    1198 <hasInvalidChars+0x88>
jmp    1180 <hasInvalidChars+0x70>
mov    -0x12(%rbp),%ax
add    $0x1,%ax
mov    %ax,-0x12(%rbp)
jmp    1122 <hasInvalidChars+0x12>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<hasInvalidChars>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
call   1030 <strlen@plt>
test   %ax,%ax
jle    1150 <hasInvalidChars+0x40>
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
movzbl (%r14,%rbx,1),%eax
add    $0x85,%al
cmp    $0xe5,%al
jbe    1154 <hasInvalidChars+0x44>
add    $0x1,%rbx
mov    %r14,%rdi
call   1030 <strlen@plt>
movswq %ax,%rax
cmp    %rax,%rbx
jl     1130 <hasInvalidChars+0x20>
xor    %eax,%eax
jmp    1159 <hasInvalidChars+0x49>
mov    $0x1,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
define i32 @hasInvalidChars(i8* %0) {
%2 = tail call signext i16 @strlen(i8* %0)
%3 = icmp sgt i16 %2, 0
br i1 %3, label %8, label %15
4: ; preds = %8
%5 = tail call signext i16 @strlen(i8* %0)
%6 = sext i16 %5 to i64
%7 = icmp slt i64 %14, %6
br i1 %7, label %8, label %15
8: ; preds = %1, %4
%9 = phi i64 [ %14, %4 ], [ 0, %1 ]
%10 = getelementptr inbounds i8, i8* %0, i64 %9
%11 = load i8, i8* %10
%12 = add i8 %11, -123
%13 = icmp ult i8 %12, -26
%14 = add nuw nsw i64 %9, 1
br i1 %13, label %15, label %4
15: ; preds = %8, %4, %1
%16 = phi i32 [ 0, %1 ], [ 0, %4 ], [ 1, %8 ]
ret i32 %16
}