#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 is_opt(char *a) {
  if (a[0] == '-' && isalpha(a[1]))
    return (1);
  if (a[0] == '-' && a[1] == '-')
    return (2);
  return (0);
}


x86 assembly (clang, -O0):
<is_opt>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x2d,%eax
jne    114f <is_opt+0x3f>
mov    -0x10(%rbp),%rax
movsbl 0x1(%rax),%edi
call   1030 <isalpha@plt>
cmp    $0x0,%rax
je     114f <is_opt+0x3f>
movl   $0x1,-0x4(%rbp)
jmp    1183 <is_opt+0x73>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x2d,%eax
jne    117c <is_opt+0x6c>
mov    -0x10(%rbp),%rax
movsbl 0x1(%rax),%eax
cmp    $0x2d,%eax
jne    117c <is_opt+0x6c>
movl   $0x2,-0x4(%rbp)
jmp    1183 <is_opt+0x73>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<is_opt>:
push   %rbx
cmpb   $0x2d,(%rdi)
jne    1141 <is_opt+0x31>
mov    %rdi,%rbx
movsbl 0x1(%rdi),%edi
call   1030 <isalpha@plt>
mov    %rax,%rcx
mov    $0x1,%eax
test   %rcx,%rcx
je     1131 <is_opt+0x21>
pop    %rbx
ret
cmpb   $0x2d,(%rbx)
jne    1141 <is_opt+0x31>
mov    $0x2,%eax
cmpb   $0x2d,0x1(%rbx)
je     112f <is_opt+0x1f>
xor    %eax,%eax
pop    %rbx
ret

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

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