#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__ isalnum(char);
bool suitable_for_replacement(char *line, char *occurence,
                              int replacement_length) {
  if (occurence == NULL) {
    return false;
  }
  if (occurence == line) {
    return !isalnum(*(occurence + replacement_length));
  } else {
    return !(isalnum(*(occurence - 1)) ||
             isalnum(*(occurence + replacement_length)));
  }
}


x86 assembly (clang, -O0):
<suitable_for_replacement>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %edx,-0x1c(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    113a <suitable_for_replacement+0x2a>
movl   $0x0,-0x4(%rbp)
jmp    11b6 <suitable_for_replacement+0xa6>
mov    -0x18(%rbp),%rax
cmp    -0x10(%rbp),%rax
jne    116f <suitable_for_replacement+0x5f>
mov    -0x18(%rbp),%rax
movslq -0x1c(%rbp),%rcx
movsbl (%rax,%rcx,1),%edi
call   1030 <isalnum@plt>
cmp    $0x0,%rax
setne  %al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x4(%rbp)
jmp    11b6 <suitable_for_replacement+0xa6>
mov    -0x18(%rbp),%rax
movsbl -0x1(%rax),%edi
call   1030 <isalnum@plt>
mov    %rax,%rcx
mov    $0x1,%al
cmp    $0x0,%rcx
mov    %al,-0x1d(%rbp)
jne    11a9 <suitable_for_replacement+0x99>
mov    -0x18(%rbp),%rax
movslq -0x1c(%rbp),%rcx
movsbl (%rax,%rcx,1),%edi
call   1030 <isalnum@plt>
cmp    $0x0,%rax
setne  %al
mov    %al,-0x1d(%rbp)
mov    -0x1d(%rbp),%al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<suitable_for_replacement>:
push   %rbp
push   %r14
push   %rbx
xor    %ebp,%ebp
test   %rsi,%rsi
je     1149 <suitable_for_replacement+0x39>
mov    %edx,%r14d
mov    %rsi,%rbx
cmp    %rdi,%rsi
je     1134 <suitable_for_replacement+0x24>
movsbl -0x1(%rbx),%edi
call   1030 <isalnum@plt>
test   %rax,%rax
jne    1149 <suitable_for_replacement+0x39>
movslq %r14d,%rax
movsbl (%rbx,%rax,1),%edi
call   1030 <isalnum@plt>
xor    %ebp,%ebp
test   %rax,%rax
sete   %bpl
mov    %ebp,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define i32 @suitable_for_replacement(i8* %0, i8* %1, i32 %2) {
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i32
store i8* %0, i8** %5
store i8* %1, i8** %6
store i32 %2, i32* %7
%8 = load i8*, i8** %6
%9 = icmp eq i8* %8, null
br i1 %9, label %10, label %11
10: ; preds = %3
store i32 0, i32* %4
br label %43
11: ; preds = %3
%12 = load i8*, i8** %6
%13 = load i8*, i8** %5
%14 = icmp eq i8* %12, %13
br i1 %14, label %15, label %25
15: ; preds = %11
%16 = load i8*, i8** %6
%17 = load i32, i32* %7
%18 = sext i32 %17 to i64
%19 = getelementptr inbounds i8, i8* %16, i64 %18
%20 = load i8, i8* %19
%21 = call i64 @isalnum(i8 signext %20)
%22 = icmp ne i64 %21, 0
%23 = xor i1 %22, true
%24 = zext i1 %23 to i32
store i32 %24, i32* %4
br label %43
25: ; preds = %11
%26 = load i8*, i8** %6
%27 = getelementptr inbounds i8, i8* %26, i64 -1
%28 = load i8, i8* %27
%29 = call i64 @isalnum(i8 signext %28)
%30 = icmp ne i64 %29, 0
br i1 %30, label %39, label %31
31: ; preds = %25
%32 = load i8*, i8** %6
%33 = load i32, i32* %7
%34 = sext i32 %33 to i64
%35 = getelementptr inbounds i8, i8* %32, i64 %34
%36 = load i8, i8* %35
%37 = call i64 @isalnum(i8 signext %36)
%38 = icmp ne i64 %37, 0
br label %39
39: ; preds = %31, %25
%40 = phi i1 [ true, %25 ], [ %38, %31 ]
%41 = xor i1 %40, true
%42 = zext i1 %41 to i32
store i32 %42, i32* %4
br label %43
43: ; preds = %39, %15, %10
%44 = load i32, i32* %4
ret i32 %44
}

LLVM IR (-O2):
define i32 @suitable_for_replacement(i8* readnone %0, i8* %1, i32 %2) {
%4 = icmp eq i8* %1, null
br i1 %4, label %19, label %5
5: ; preds = %3
%6 = icmp eq i8* %1, %0
br i1 %6, label %12, label %7
7: ; preds = %5
%8 = getelementptr inbounds i8, i8* %1, i64 -1
%9 = load i8, i8* %8
%10 = tail call i64 @isalnum(i8 signext %9)
%11 = icmp eq i64 %10, 0
br i1 %11, label %12, label %19
12: ; preds = %7, %5
%13 = sext i32 %2 to i64
%14 = getelementptr inbounds i8, i8* %1, i64 %13
%15 = load i8, i8* %14
%16 = tail call i64 @isalnum(i8 signext %15)
%17 = icmp eq i64 %16, 0
%18 = zext i1 %17 to i32
br label %19
19: ; preds = %12, %7, %3
%20 = phi i32 [ 0, %3 ], [ 0, %7 ], [ %18, %12 ]
ret i32 %20
}