#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 const *, char);
int mpc_boundary_anchor(char prev, char next) {
  const char *word = "abcdefghijklmnopqrstuvwxyz"
                     "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
                     "0123456789_";
  if (strchr(word, next) && (prev == '\0')) {
    return 1;
  }
  if (strchr(word, prev) && (next == '\0')) {
    return 1;
  }
  if (strchr(word, next) && !strchr(word, prev)) {
    return 1;
  }
  if (!strchr(word, next) && strchr(word, prev)) {
    return 1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<mpc_boundary_anchor>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %sil,%al
mov    %dil,%cl
mov    %cl,-0x5(%rbp)
mov    %al,-0x6(%rbp)
lea    0xed5(%rip),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
movsbl -0x6(%rbp),%esi
call   1030 <strchr@plt>
cmp    $0x0,%rax
je     115f <mpc_boundary_anchor+0x4f>
movsbl -0x5(%rbp),%eax
cmp    $0x0,%eax
jne    115f <mpc_boundary_anchor+0x4f>
movl   $0x1,-0x4(%rbp)
jmp    120a <mpc_boundary_anchor+0xfa>
mov    -0x10(%rbp),%rdi
movsbl -0x5(%rbp),%esi
call   1030 <strchr@plt>
cmp    $0x0,%rax
je     118f <mpc_boundary_anchor+0x7f>
movsbl -0x6(%rbp),%eax
cmp    $0x0,%eax
jne    118f <mpc_boundary_anchor+0x7f>
movl   $0x1,-0x4(%rbp)
jmp    120a <mpc_boundary_anchor+0xfa>
mov    -0x10(%rbp),%rdi
movsbl -0x6(%rbp),%esi
call   1030 <strchr@plt>
cmp    $0x0,%rax
je     11c9 <mpc_boundary_anchor+0xb9>
mov    -0x10(%rbp),%rdi
movsbl -0x5(%rbp),%esi
call   1030 <strchr@plt>
cmp    $0x0,%rax
jne    11c9 <mpc_boundary_anchor+0xb9>
movl   $0x1,-0x4(%rbp)
jmp    120a <mpc_boundary_anchor+0xfa>
mov    -0x10(%rbp),%rdi
movsbl -0x6(%rbp),%esi
call   1030 <strchr@plt>
cmp    $0x0,%rax
jne    1203 <mpc_boundary_anchor+0xf3>
mov    -0x10(%rbp),%rdi
movsbl -0x5(%rbp),%esi
call   1030 <strchr@plt>
cmp    $0x0,%rax
je     1203 <mpc_boundary_anchor+0xf3>
movl   $0x1,-0x4(%rbp)
jmp    120a <mpc_boundary_anchor+0xfa>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mpc_boundary_anchor>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %esi,%ebp
mov    %edi,%ebx
lea    0xede(%rip),%rdi
call   1030 <strchr@plt>
mov    $0x1,%r15d
test   %bl,%bl
jne    1136 <mpc_boundary_anchor+0x26>
test   %rax,%rax
jne    11a8 <mpc_boundary_anchor+0x98>
movsbl %bl,%r14d
lea    0xebf(%rip),%rdi
mov    %r14d,%esi
call   1030 <strchr@plt>
test   %bpl,%bpl
jne    1153 <mpc_boundary_anchor+0x43>
test   %rax,%rax
jne    11a8 <mpc_boundary_anchor+0x98>
movsbl %bpl,%ebp
lea    0xea2(%rip),%rdi
mov    %ebp,%esi
call   1030 <strchr@plt>
test   %rax,%rax
je     117e <mpc_boundary_anchor+0x6e>
lea    0xe8f(%rip),%rdi
mov    %r14d,%esi
call   1030 <strchr@plt>
test   %rax,%rax
je     11a8 <mpc_boundary_anchor+0x98>
lea    0xe7b(%rip),%rdi
mov    %ebp,%esi
call   1030 <strchr@plt>
test   %rax,%rax
jne    11a5 <mpc_boundary_anchor+0x95>
lea    0xe68(%rip),%rdi
mov    %r14d,%esi
call   1030 <strchr@plt>
test   %rax,%rax
jne    11a8 <mpc_boundary_anchor+0x98>
xor    %r15d,%r15d
mov    %r15d,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
@.str = [64 x i8] c"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_\00"
define i32 @mpc_boundary_anchor(i8 signext %0, i8 signext %1) {
%3 = tail call i64 @strchr(i8* getelementptr inbounds ([64 x i8], [64 x i8]* @.str, i64 0, i64 0), i8 signext %1)
%4 = icmp ne i64 %3, 0
%5 = icmp eq i8 %0, 0
%6 = and i1 %5, %4
br i1 %6, label %25, label %7
7: ; preds = %2
%8 = tail call i64 @strchr(i8* getelementptr inbounds ([64 x i8], [64 x i8]* @.str, i64 0, i64 0), i8 signext %0)
%9 = icmp ne i64 %8, 0
%10 = icmp eq i8 %1, 0
%11 = and i1 %10, %9
br i1 %11, label %25, label %12
12: ; preds = %7
%13 = tail call i64 @strchr(i8* getelementptr inbounds ([64 x i8], [64 x i8]* @.str, i64 0, i64 0), i8 signext %1)
%14 = icmp eq i64 %13, 0
br i1 %14, label %18, label %15
15: ; preds = %12
%16 = tail call i64 @strchr(i8* getelementptr inbounds ([64 x i8], [64 x i8]* @.str, i64 0, i64 0), i8 signext %0)
%17 = icmp eq i64 %16, 0
br i1 %17, label %25, label %18
18: ; preds = %15, %12
%19 = tail call i64 @strchr(i8* getelementptr inbounds ([64 x i8], [64 x i8]* @.str, i64 0, i64 0), i8 signext %1)
%20 = icmp eq i64 %19, 0
br i1 %20, label %21, label %24
21: ; preds = %18
%22 = tail call i64 @strchr(i8* getelementptr inbounds ([64 x i8], [64 x i8]* @.str, i64 0, i64 0), i8 signext %0)
%23 = icmp eq i64 %22, 0
br i1 %23, label %24, label %25
24: ; preds = %21, %18
br label %25
25: ; preds = %21, %15, %7, %2, %24
%26 = phi i32 [ 0, %24 ], [ 1, %2 ], [ 1, %7 ], [ 1, %15 ], [ 1, %21 ]
ret i32 %26
}