#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__ strchr(char *, char);
int Is_Ambigu(char *state, int datatype, int stepsize) {
  int i;
  if (!datatype) {
    for (i = 0; i < stepsize; i++) {
      if (strchr("MRWSYKBDHVNXO?-.", state[i]))
        return 1;
    }
  } else {
    if (strchr("X?-.", state[0]))
      return 1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<Is_Ambigu>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    %edx,-0x18(%rbp)
cmpl   $0x0,-0x14(%rbp)
jne    1185 <Is_Ambigu+0x75>
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x18(%rbp),%eax
jge    1180 <Is_Ambigu+0x70>
mov    -0x10(%rbp),%rax
movslq -0x1c(%rbp),%rcx
lea    0xeb2(%rip),%rdi
movsbl (%rax,%rcx,1),%esi
call   1030 <strchr@plt>
cmp    $0x0,%rax
je     116d <Is_Ambigu+0x5d>
movl   $0x1,-0x4(%rbp)
jmp    11ba <Is_Ambigu+0xaa>
jmp    1172 <Is_Ambigu+0x62>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1133 <Is_Ambigu+0x23>
jmp    11b3 <Is_Ambigu+0xa3>
mov    -0x10(%rbp),%rax
lea    0xe81(%rip),%rdi
movsbl (%rax),%esi
call   1030 <strchr@plt>
cmp    $0x0,%rax
je     11ae <Is_Ambigu+0x9e>
movl   $0x1,-0x4(%rbp)
jmp    11ba <Is_Ambigu+0xaa>
jmp    11b3 <Is_Ambigu+0xa3>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Is_Ambigu>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %rdi,%r12
test   %esi,%esi
je     113f <Is_Ambigu+0x2f>
movsbl (%r12),%esi
lea    0xee6(%rip),%rdi
call   1030 <strchr@plt>
mov    %rax,%rcx
mov    $0x1,%eax
test   %rcx,%rcx
jne    116d <Is_Ambigu+0x5d>
jmp    116b <Is_Ambigu+0x5b>
test   %edx,%edx
jle    116b <Is_Ambigu+0x5b>
mov    %edx,%r15d
xor    %ebx,%ebx
lea    0xeb1(%rip),%r14
nop
movsbl (%r12,%rbx,1),%esi
mov    %r14,%rdi
call   1030 <strchr@plt>
test   %rax,%rax
jne    1179 <Is_Ambigu+0x69>
add    $0x1,%rbx
cmp    %rbx,%r15
jne    1150 <Is_Ambigu+0x40>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret
mov    $0x1,%eax
jmp    116d <Is_Ambigu+0x5d>

LLVM IR (-O0):
@.str = [17 x i8] c"MRWSYKBDHVNXO?-.\00"
@.str.1 = [5 x i8] c"X?-.\00"
define i32 @Is_Ambigu(i8* %0, i32 %1, i32 %2) {
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
store i8* %0, i8** %5
store i32 %1, i32* %6
store i32 %2, i32* %7
%9 = load i32, i32* %6
%10 = icmp ne i32 %9, 0
br i1 %10, label %30, label %11
11: ; preds = %3
store i32 0, i32* %8
br label %12
12: ; preds = %26, %11
%13 = load i32, i32* %8
%14 = load i32, i32* %7
%15 = icmp slt i32 %13, %14
br i1 %15, label %16, label %29
16: ; preds = %12
%17 = load i8*, i8** %5
%18 = load i32, i32* %8
%19 = sext i32 %18 to i64
%20 = getelementptr inbounds i8, i8* %17, i64 %19
%21 = load i8, i8* %20
%22 = call i64 @strchr(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i8 signext %21)
%23 = icmp ne i64 %22, 0
br i1 %23, label %24, label %25
24: ; preds = %16
store i32 1, i32* %4
br label %39
25: ; preds = %16
br label %26
26: ; preds = %25
%27 = load i32, i32* %8
%28 = add nsw i32 %27, 1
store i32 %28, i32* %8
br label %12
29: ; preds = %12
br label %38
30: ; preds = %3
%31 = load i8*, i8** %5
%32 = getelementptr inbounds i8, i8* %31, i64 0
%33 = load i8, i8* %32
%34 = call i64 @strchr(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i8 signext %33)
%35 = icmp ne i64 %34, 0
br i1 %35, label %36, label %37
36: ; preds = %30
store i32 1, i32* %4
br label %39
37: ; preds = %30
br label %38
38: ; preds = %37, %29
store i32 0, i32* %4
br label %39
39: ; preds = %38, %36, %24
%40 = load i32, i32* %4
ret i32 %40
}

LLVM IR (-O2):
@.str = [17 x i8] c"MRWSYKBDHVNXO?-.\00"
@.str.1 = [5 x i8] c"X?-.\00"
define i32 @Is_Ambigu(i8* nocapture %0, i32 %1, i32 %2) {
%4 = icmp eq i32 %1, 0
br i1 %4, label %5, label %18
5: ; preds = %3
%6 = icmp sgt i32 %2, 0
br i1 %6, label %7, label %22
7: ; preds = %5
%8 = zext i32 %2 to i64
br label %11
9: ; preds = %11
%10 = icmp eq i64 %17, %8
br i1 %10, label %22, label %11
11: ; preds = %7, %9
%12 = phi i64 [ 0, %7 ], [ %17, %9 ]
%13 = getelementptr inbounds i8, i8* %0, i64 %12
%14 = load i8, i8* %13
%15 = tail call i64 @strchr(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i8 signext %14)
%16 = icmp eq i64 %15, 0
%17 = add nuw nsw i64 %12, 1
br i1 %16, label %9, label %23
18: ; preds = %3
%19 = load i8, i8* %0
%20 = tail call i64 @strchr(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i8 signext %19)
%21 = icmp eq i64 %20, 0
br i1 %21, label %22, label %23
22: ; preds = %9, %5, %18
br label %23
23: ; preds = %11, %18, %22
%24 = phi i32 [ 0, %22 ], [ 1, %18 ], [ 1, %11 ]
ret i32 %24
}