#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 */
int is_space(char const);
int is_space_underscore(char const, char const);
int mockable_is_surrounded_by_whitespaces_but_old_gcc(const char *buf, int pos,
                                                      int end) {
  const int left = is_space_underscore(buf[pos - 2], buf[pos - 1]);
  const int right = is_space(buf[end + 1]);
  return (left && right);
}


x86 assembly (clang, -O0):
<mockable_is_surrounded_by_whitespaces_but_old_gcc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    -0xc(%rbp),%ecx
sub    $0x2,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,1),%dl
mov    -0x8(%rbp),%rax
mov    -0xc(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movsbl %dl,%edi
movsbl (%rax,%rcx,1),%esi
call   1030 <is_space_underscore@plt>
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
movsbl (%rax,%rcx,1),%edi
call   1040 <is_space@plt>
mov    %eax,-0x18(%rbp)
xor    %eax,%eax
cmpl   $0x0,-0x14(%rbp)
mov    %al,-0x19(%rbp)
je     1190 <mockable_is_surrounded_by_whitespaces_but_old_gcc+0x70>
cmpl   $0x0,-0x18(%rbp)
setne  %al
mov    %al,-0x19(%rbp)
mov    -0x19(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mockable_is_surrounded_by_whitespaces_but_old_gcc>:
push   %rbp
push   %r14
push   %rbx
mov    %edx,%r14d
mov    %rdi,%rbx
movslq %esi,%rax
movsbl -0x2(%rax,%rdi,1),%edi
movsbl -0x1(%rax,%rbx,1),%esi
call   1030 <is_space_underscore@plt>
mov    %eax,%ebp
movslq %r14d,%rax
movsbl 0x1(%rax,%rbx,1),%edi
call   1040 <is_space@plt>
test   %ebp,%ebp
setne  %cl
test   %eax,%eax
setne  %al
and    %cl,%al
movzbl %al,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define i32 @mockable_is_surrounded_by_whitespaces_but_old_gcc(i8* %0, i32 %1, i32 %2) {
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
store i8* %0, i8** %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%9 = load i8*, i8** %4
%10 = load i32, i32* %5
%11 = sub nsw i32 %10, 2
%12 = sext i32 %11 to i64
%13 = getelementptr inbounds i8, i8* %9, i64 %12
%14 = load i8, i8* %13
%15 = load i8*, i8** %4
%16 = load i32, i32* %5
%17 = sub nsw i32 %16, 1
%18 = sext i32 %17 to i64
%19 = getelementptr inbounds i8, i8* %15, i64 %18
%20 = load i8, i8* %19
%21 = call i32 @is_space_underscore(i8 signext %14, i8 signext %20)
store i32 %21, i32* %7
%22 = load i8*, i8** %4
%23 = load i32, i32* %6
%24 = add nsw i32 %23, 1
%25 = sext i32 %24 to i64
%26 = getelementptr inbounds i8, i8* %22, i64 %25
%27 = load i8, i8* %26
%28 = call i32 @is_space(i8 signext %27)
store i32 %28, i32* %8
%29 = load i32, i32* %7
%30 = icmp ne i32 %29, 0
br i1 %30, label %31, label %34
31: ; preds = %3
%32 = load i32, i32* %8
%33 = icmp ne i32 %32, 0
br label %34
34: ; preds = %31, %3
%35 = phi i1 [ false, %3 ], [ %33, %31 ]
%36 = zext i1 %35 to i32
ret i32 %36
}

LLVM IR (-O2):
define i32 @mockable_is_surrounded_by_whitespaces_but_old_gcc(i8* nocapture %0, i32 %1, i32 %2) {
%4 = add nsw i32 %1, -2
%5 = sext i32 %4 to i64
%6 = getelementptr inbounds i8, i8* %0, i64 %5
%7 = load i8, i8* %6
%8 = add nsw i32 %1, -1
%9 = sext i32 %8 to i64
%10 = getelementptr inbounds i8, i8* %0, i64 %9
%11 = load i8, i8* %10
%12 = tail call i32 @is_space_underscore(i8 signext %7, i8 signext %11)
%13 = add nsw i32 %2, 1
%14 = sext i32 %13 to i64
%15 = getelementptr inbounds i8, i8* %0, i64 %14
%16 = load i8, i8* %15
%17 = tail call i32 @is_space(i8 signext %16)
%18 = icmp ne i32 %12, 0
%19 = icmp ne i32 %17, 0
%20 = select i1 %18, i1 %19, i1 false
%21 = zext i1 %20 to i32
ret i32 %21
}