#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__ strcmp(char *, char *);
int validate_prefix(char *str) {
  int i;
  char prefix[3] = "";
  for (i = 0; i < 2 && str[i] != '\0'; i++)
    prefix[i] = str[i];
  prefix[i] = '\0';
  if (!(strcmp(prefix, ">>") == 0 || strcmp(prefix, "##") == 0 ||
        strcmp(prefix, "++") == 0 || strcmp(prefix, "==") == 0 ||
        strcmp(prefix, "//") == 0)) {
    return 0;
  }
  return 1;
}


x86 assembly (clang, -O0):
<validate_prefix>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
lea    -0x17(%rbp),%rdi
xor    %esi,%esi
mov    $0x3,%edx
call   1030 <memset@plt>
movl   $0x0,-0x14(%rbp)
xor    %eax,%eax
cmpl   $0x2,-0x14(%rbp)
mov    %al,-0x18(%rbp)
jge    1167 <validate_prefix+0x47>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x0,%eax
setne  %al
mov    %al,-0x18(%rbp)
mov    -0x18(%rbp),%al
test   $0x1,%al
jne    1177 <validate_prefix+0x57>
jmp    1198 <validate_prefix+0x78>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,1),%cl
movslq -0x14(%rbp),%rax
mov    %cl,-0x17(%rbp,%rax,1)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1143 <validate_prefix+0x23>
movslq -0x14(%rbp),%rax
movb   $0x0,-0x17(%rbp,%rax,1)
lea    -0x17(%rbp),%rdi
lea    0xe54(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
je     122f <validate_prefix+0x10f>
lea    -0x17(%rbp),%rdi
lea    0xe3d(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
je     122f <validate_prefix+0x10f>
lea    -0x17(%rbp),%rdi
lea    0xe26(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
je     122f <validate_prefix+0x10f>
lea    -0x17(%rbp),%rdi
lea    0xe0f(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
je     122f <validate_prefix+0x10f>
lea    -0x17(%rbp),%rdi
lea    0xdf8(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
je     122f <validate_prefix+0x10f>
movl   $0x0,-0x4(%rbp)
jmp    1236 <validate_prefix+0x116>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<validate_prefix>:
push   %rax
movb   $0x0,0x6(%rsp)
movw   $0x0,0x4(%rsp)
mov    (%rdi),%al
test   %al,%al
je     1139 <validate_prefix+0x29>
mov    %al,0x4(%rsp)
mov    0x1(%rdi),%al
test   %al,%al
je     113d <validate_prefix+0x2d>
mov    %al,0x5(%rsp)
mov    $0x2,%eax
jmp    1142 <validate_prefix+0x32>
xor    %eax,%eax
jmp    1142 <validate_prefix+0x32>
mov    $0x1,%eax
movb   $0x0,0x4(%rsp,%rax,1)
lea    0xeb2(%rip),%rsi
lea    0x4(%rsp),%rdi
call   1030 <strcmp@plt>
test   %rax,%rax
je     11bc <validate_prefix+0xac>
lea    0xe9f(%rip),%rsi
lea    0x4(%rsp),%rdi
call   1030 <strcmp@plt>
test   %rax,%rax
je     11bc <validate_prefix+0xac>
lea    0xe8c(%rip),%rsi
lea    0x4(%rsp),%rdi
call   1030 <strcmp@plt>
test   %rax,%rax
je     11bc <validate_prefix+0xac>
lea    0xe79(%rip),%rsi
lea    0x4(%rsp),%rdi
call   1030 <strcmp@plt>
test   %rax,%rax
je     11bc <validate_prefix+0xac>
lea    0xe66(%rip),%rsi
lea    0x4(%rsp),%rdi
call   1030 <strcmp@plt>
mov    %rax,%rcx
xor    %eax,%eax
test   %rcx,%rcx
je     11bc <validate_prefix+0xac>
pop    %rcx
ret
mov    $0x1,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [3 x i8] c">>\00"
@.str.1 = [3 x i8] c"##\00"
@.str.2 = [3 x i8] c"++\00"
@.str.3 = [3 x i8] c"==\00"
@.str.4 = [3 x i8] c"//\00"
define i32 @validate_prefix(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
%4 = alloca i32
%5 = alloca [3 x i8]
store i8* %0, i8** %3
%6 = bitcast [3 x i8]* %5 to i8*
store i32 0, i32* %4
br label %7
7: ; preds = %29, %1
%8 = load i32, i32* %4
%9 = icmp slt i32 %8, 2
br i1 %9, label %10, label %18
10: ; preds = %7
%11 = load i8*, i8** %3
%12 = load i32, i32* %4
%13 = sext i32 %12 to i64
%14 = getelementptr inbounds i8, i8* %11, i64 %13
%15 = load i8, i8* %14
%16 = sext i8 %15 to i32
%17 = icmp ne i32 %16, 0
br label %18
18: ; preds = %10, %7
%19 = phi i1 [ false, %7 ], [ %17, %10 ]
br i1 %19, label %20, label %32
20: ; preds = %18
%21 = load i8*, i8** %3
%22 = load i32, i32* %4
%23 = sext i32 %22 to i64
%24 = getelementptr inbounds i8, i8* %21, i64 %23
%25 = load i8, i8* %24
%26 = load i32, i32* %4
%27 = sext i32 %26 to i64
%28 = getelementptr inbounds [3 x i8], [3 x i8]* %5, i64 0, i64 %27
store i8 %25, i8* %28
br label %29
29: ; preds = %20
%30 = load i32, i32* %4
%31 = add nsw i32 %30, 1
store i32 %31, i32* %4
br label %7
32: ; preds = %18
%33 = load i32, i32* %4
%34 = sext i32 %33 to i64
%35 = getelementptr inbounds [3 x i8], [3 x i8]* %5, i64 0, i64 %34
store i8 0, i8* %35
%36 = getelementptr inbounds [3 x i8], [3 x i8]* %5, i64 0, i64 0
%37 = call i64 @strcmp(i8* %36, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%38 = icmp eq i64 %37, 0
br i1 %38, label %56, label %39
39: ; preds = %32
%40 = getelementptr inbounds [3 x i8], [3 x i8]* %5, i64 0, i64 0
%41 = call i64 @strcmp(i8* %40, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%42 = icmp eq i64 %41, 0
br i1 %42, label %56, label %43
43: ; preds = %39
%44 = getelementptr inbounds [3 x i8], [3 x i8]* %5, i64 0, i64 0
%45 = call i64 @strcmp(i8* %44, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
%46 = icmp eq i64 %45, 0
br i1 %46, label %56, label %47
47: ; preds = %43
%48 = getelementptr inbounds [3 x i8], [3 x i8]* %5, i64 0, i64 0
%49 = call i64 @strcmp(i8* %48, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
%50 = icmp eq i64 %49, 0
br i1 %50, label %56, label %51
51: ; preds = %47
%52 = getelementptr inbounds [3 x i8], [3 x i8]* %5, i64 0, i64 0
%53 = call i64 @strcmp(i8* %52, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0))
%54 = icmp eq i64 %53, 0
br i1 %54, label %56, label %55
55: ; preds = %51
store i32 0, i32* %2
br label %57
56: ; preds = %51, %47, %43, %39, %32
store i32 1, i32* %2
br label %57
57: ; preds = %56, %55
%58 = load i32, i32* %2
ret i32 %58
}

LLVM IR (-O2):
@.str = [3 x i8] c">>\00"
@.str.1 = [3 x i8] c"##\00"
@.str.2 = [3 x i8] c"++\00"
@.str.3 = [3 x i8] c"==\00"
@.str.4 = [3 x i8] c"//\00"
define i32 @validate_prefix(i8* nocapture %0) {
%2 = alloca [3 x i8]
%3 = getelementptr inbounds [3 x i8], [3 x i8]* %2, i64 0, i64 0
%4 = load i8, i8* %0
%5 = icmp eq i8 %4, 0
br i1 %5, label %12, label %6
6: ; preds = %1
store i8 %4, i8* %3
%7 = getelementptr inbounds i8, i8* %0, i64 1
%8 = load i8, i8* %7
%9 = icmp eq i8 %8, 0
br i1 %9, label %12, label %10
10: ; preds = %6
%11 = getelementptr inbounds [3 x i8], [3 x i8]* %2, i64 0, i64 1
store i8 %8, i8* %11
br label %12
12: ; preds = %10, %6, %1
%13 = phi i64 [ 0, %1 ], [ 1, %6 ], [ 2, %10 ]
%14 = getelementptr inbounds [3 x i8], [3 x i8]* %2, i64 0, i64 %13
store i8 0, i8* %14
%15 = call i64 @strcmp(i8* %3, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%16 = icmp eq i64 %15, 0
br i1 %16, label %29, label %17
17: ; preds = %12
%18 = call i64 @strcmp(i8* %3, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%19 = icmp eq i64 %18, 0
br i1 %19, label %29, label %20
20: ; preds = %17
%21 = call i64 @strcmp(i8* %3, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
%22 = icmp eq i64 %21, 0
br i1 %22, label %29, label %23
23: ; preds = %20
%24 = call i64 @strcmp(i8* %3, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
%25 = icmp eq i64 %24, 0
br i1 %25, label %29, label %26
26: ; preds = %23
%27 = call i64 @strcmp(i8* %3, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0))
%28 = icmp eq i64 %27, 0
br i1 %28, label %29, label %30
29: ; preds = %26, %23, %20, %17, %12
br label %30
30: ; preds = %26, %29
%31 = phi i32 [ 1, %29 ], [ 0, %26 ]
ret i32 %31
}