#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__ strlen(char *);
scalar_t__ strncmp(char *, char *, scalar_t__);
int is_option(char *buffer, char *option_name) {
  while (*buffer < 65 || *buffer > 90) {
    buffer++;
  }
  if (strlen(buffer) > strlen(option_name)) {
    return (strncmp(buffer, option_name, strlen(option_name)) == 0);
  } else {
    return 0;
  }
}


x86 assembly (clang, -O0):
<is_option>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rax
movsbl (%rax),%ecx
mov    $0x1,%al
cmp    $0x41,%ecx
mov    %al,-0x19(%rbp)
jl     1155 <is_option+0x35>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x5a,%eax
setg   %al
mov    %al,-0x19(%rbp)
mov    -0x19(%rbp),%al
test   $0x1,%al
jne    1165 <is_option+0x45>
jmp    1176 <is_option+0x56>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    1130 <is_option+0x10>
mov    -0x10(%rbp),%rdi
call   1040 <strlen@plt>
mov    %rax,-0x28(%rbp)
mov    -0x18(%rbp),%rdi
call   1040 <strlen@plt>
mov    %rax,%rcx
mov    -0x28(%rbp),%rax
cmp    %rcx,%rax
jle    11d9 <is_option+0xb9>
mov    -0x10(%rbp),%rax
mov    %rax,-0x38(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x30(%rbp)
mov    -0x18(%rbp),%rdi
call   1040 <strlen@plt>
mov    -0x38(%rbp),%rdi
mov    -0x30(%rbp),%rsi
mov    %rax,%rdx
call   1030 <strncmp@plt>
cmp    $0x0,%rax
sete   %al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x4(%rbp)
jmp    11e0 <is_option+0xc0>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<is_option>:
push   %r15
push   %r14
push   %rbx
mov    %rsi,%r14
mov    %rdi,%rbx
add    $0xffffffffffffffff,%rbx
nop
movzbl 0x1(%rbx),%eax
add    $0x1,%rbx
add    $0xa5,%al
cmp    $0xe6,%al
jb     1130 <is_option+0x10>
mov    %rbx,%rdi
call   1040 <strlen@plt>
mov    %rax,%r15
mov    %r14,%rdi
call   1040 <strlen@plt>
mov    %rax,%rdx
xor    %eax,%eax
cmp    %rdx,%r15
jle    1171 <is_option+0x51>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1030 <strncmp@plt>
mov    %rax,%rcx
xor    %eax,%eax
test   %rcx,%rcx
sete   %al
pop    %rbx
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
define i32 @is_option(i8* %0, i8* %1) {
br label %3
3: ; preds = %3, %2
%4 = phi i8* [ %0, %2 ], [ %8, %3 ]
%5 = load i8, i8* %4
%6 = add i8 %5, -91
%7 = icmp ult i8 %6, -26
%8 = getelementptr inbounds i8, i8* %4, i64 1
br i1 %7, label %3, label %9
9: ; preds = %3
%10 = tail call i64 @strlen(i8* %4)
%11 = tail call i64 @strlen(i8* dereferenceable(1) %1)
%12 = icmp sgt i64 %10, %11
br i1 %12, label %13, label %17
13: ; preds = %9
%14 = tail call i64 @strncmp(i8* %4, i8* %1, i64 %11)
%15 = icmp eq i64 %14, 0
%16 = zext i1 %15 to i32
br label %17
17: ; preds = %9, %13
%18 = phi i32 [ %16, %13 ], [ 0, %9 ]
ret i32 %18
}