#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 utf8_first_char_uppercase(unsigned char *str) {
  if (str == NULL || str[0] == '\0')
    return 0;
  if (str[0] >= 'A' && str[0] <= 'Z')
    return 1;
  if (str[0] == 0xc3 && str[1] >= 0x80 && str[1] <= 0x9e)
    return 1;
  return 0;
}


x86 assembly (clang, -O0):
<utf8_first_char_uppercase>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     1123 <utf8_first_char_uppercase+0x23>
mov    -0x10(%rbp),%rax
movzbl (%rax),%eax
cmp    $0x0,%eax
jne    112f <utf8_first_char_uppercase+0x2f>
movl   $0x0,-0x4(%rbp)
jmp    11a6 <utf8_first_char_uppercase+0xa6>
mov    -0x10(%rbp),%rax
movzbl (%rax),%eax
cmp    $0x41,%eax
jl     115b <utf8_first_char_uppercase+0x5b>
mov    -0x10(%rbp),%rax
movzbl (%rax),%eax
cmp    $0x5a,%eax
jg     115b <utf8_first_char_uppercase+0x5b>
movl   $0x1,-0x4(%rbp)
jmp    11a6 <utf8_first_char_uppercase+0xa6>
mov    -0x10(%rbp),%rax
movzbl (%rax),%eax
cmp    $0xc3,%eax
jne    119f <utf8_first_char_uppercase+0x9f>
mov    -0x10(%rbp),%rax
movzbl 0x1(%rax),%eax
cmp    $0x80,%eax
jl     119f <utf8_first_char_uppercase+0x9f>
mov    -0x10(%rbp),%rax
movzbl 0x1(%rax),%eax
cmp    $0x9e,%eax
jg     119f <utf8_first_char_uppercase+0x9f>
movl   $0x1,-0x4(%rbp)
jmp    11a6 <utf8_first_char_uppercase+0xa6>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<utf8_first_char_uppercase>:
xor    %eax,%eax
test   %rdi,%rdi
je     1127 <utf8_first_char_uppercase+0x27>
mov    (%rdi),%cl
test   %cl,%cl
je     1127 <utf8_first_char_uppercase+0x27>
lea    -0x41(%rcx),%edx
mov    $0x1,%eax
cmp    $0x1a,%dl
jb     1127 <utf8_first_char_uppercase+0x27>
cmp    $0xc3,%cl
jne    1125 <utf8_first_char_uppercase+0x25>
cmpb   $0x9f,0x1(%rdi)
jl     1127 <utf8_first_char_uppercase+0x27>
xor    %eax,%eax
ret

LLVM IR (-O0):
define i32 @utf8_first_char_uppercase(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
store i8* %0, i8** %3
%4 = load i8*, i8** %3
%5 = icmp eq i8* %4, null
br i1 %5, label %12, label %6
6: ; preds = %1
%7 = load i8*, i8** %3
%8 = getelementptr inbounds i8, i8* %7, i64 0
%9 = load i8, i8* %8
%10 = zext i8 %9 to i32
%11 = icmp eq i32 %10, 0
br i1 %11, label %12, label %13
12: ; preds = %6, %1
store i32 0, i32* %2
br label %46
13: ; preds = %6
%14 = load i8*, i8** %3
%15 = getelementptr inbounds i8, i8* %14, i64 0
%16 = load i8, i8* %15
%17 = zext i8 %16 to i32
%18 = icmp sge i32 %17, 65
br i1 %18, label %19, label %26
19: ; preds = %13
%20 = load i8*, i8** %3
%21 = getelementptr inbounds i8, i8* %20, i64 0
%22 = load i8, i8* %21
%23 = zext i8 %22 to i32
%24 = icmp sle i32 %23, 90
br i1 %24, label %25, label %26
25: ; preds = %19
store i32 1, i32* %2
br label %46
26: ; preds = %19, %13
%27 = load i8*, i8** %3
%28 = getelementptr inbounds i8, i8* %27, i64 0
%29 = load i8, i8* %28
%30 = zext i8 %29 to i32
%31 = icmp eq i32 %30, 195
br i1 %31, label %32, label %45
32: ; preds = %26
%33 = load i8*, i8** %3
%34 = getelementptr inbounds i8, i8* %33, i64 1
%35 = load i8, i8* %34
%36 = zext i8 %35 to i32
%37 = icmp sge i32 %36, 128
br i1 %37, label %38, label %45
38: ; preds = %32
%39 = load i8*, i8** %3
%40 = getelementptr inbounds i8, i8* %39, i64 1
%41 = load i8, i8* %40
%42 = zext i8 %41 to i32
%43 = icmp sle i32 %42, 158
br i1 %43, label %44, label %45
44: ; preds = %38
store i32 1, i32* %2
br label %46
45: ; preds = %38, %32, %26
store i32 0, i32* %2
br label %46
46: ; preds = %45, %44, %25, %12
%47 = load i32, i32* %2
ret i32 %47
}

LLVM IR (-O2):
define i32 @utf8_first_char_uppercase(i8* %0) {
%2 = icmp eq i8* %0, null
br i1 %2, label %16, label %3
3: ; preds = %1
%4 = load i8, i8* %0
%5 = icmp eq i8 %4, 0
br i1 %5, label %16, label %6
6: ; preds = %3
%7 = add i8 %4, -65
%8 = icmp ult i8 %7, 26
br i1 %8, label %16, label %9
9: ; preds = %6
%10 = icmp eq i8 %4, -61
br i1 %10, label %11, label %15
11: ; preds = %9
%12 = getelementptr inbounds i8, i8* %0, i64 1
%13 = load i8, i8* %12
%14 = icmp slt i8 %13, -97
br i1 %14, label %16, label %15
15: ; preds = %11, %9
br label %16
16: ; preds = %11, %6, %1, %3, %15
%17 = phi i32 [ 0, %15 ], [ 0, %3 ], [ 0, %1 ], [ 1, %6 ], [ 1, %11 ]
ret i32 %17
}