#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 /*<<< orphan*/ printf(char *, char const *);
scalar_t__ strncmp(char const *, char const *, size_t);
char *strnstr(char const *, char *, size_t);
int isExtensionSupported(const char *support_str, const char *ext_string,
                         size_t ext_buffer_size) {
  size_t offset = 0;
  const char *space_substr =
      strnstr(ext_string + offset, " ", ext_buffer_size - offset);
  size_t space_pos = space_substr ? space_substr - ext_string : 0;
  while (space_pos < ext_buffer_size) {
    if (strncmp(support_str, ext_string + offset, space_pos) == 0) {
      printf("Info: Found extension support ‘%s’!\n", support_str);
      return 1;
    }
    offset = space_pos + 1;
    space_substr = strnstr(ext_string + offset, " ", ext_buffer_size - offset);
    space_pos = space_substr ? space_substr - ext_string : 0;
  }
  printf("Warning: Extension is not supported '%s'!\n", support_str);
  return 0;
}


x86 assembly (clang, -O0):
<isExtensionSupported>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
movq   $0x0,-0x28(%rbp)
mov    -0x18(%rbp),%rdi
add    -0x28(%rbp),%rdi
mov    -0x20(%rbp),%rdx
sub    -0x28(%rbp),%rdx
lea    0xe9d(%rip),%rsi
call   1050 <strnstr@plt>
mov    %rax,-0x30(%rbp)
cmpq   $0x0,-0x30(%rbp)
je     118b <isExtensionSupported+0x5b>
mov    -0x30(%rbp),%rax
mov    -0x18(%rbp),%rcx
sub    %rcx,%rax
mov    %rax,-0x40(%rbp)
jmp    1196 <isExtensionSupported+0x66>
xor    %eax,%eax
mov    %rax,-0x40(%rbp)
jmp    1196 <isExtensionSupported+0x66>
mov    -0x40(%rbp),%rax
mov    %rax,-0x38(%rbp)
mov    -0x38(%rbp),%rax
cmp    -0x20(%rbp),%rax
jae    124a <isExtensionSupported+0x11a>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
add    -0x28(%rbp),%rsi
mov    -0x38(%rbp),%rdx
call   1030 <strncmp@plt>
cmp    $0x0,%rax
jne    11e7 <isExtensionSupported+0xb7>
mov    -0x10(%rbp),%rsi
lea    0xe2c(%rip),%rdi
call   1040 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    1261 <isExtensionSupported+0x131>
mov    -0x38(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x28(%rbp)
mov    -0x18(%rbp),%rdi
add    -0x28(%rbp),%rdi
mov    -0x20(%rbp),%rdx
sub    -0x28(%rbp),%rdx
lea    0xdf6(%rip),%rsi
call   1050 <strnstr@plt>
mov    %rax,-0x30(%rbp)
cmpq   $0x0,-0x30(%rbp)
je     1232 <isExtensionSupported+0x102>
mov    -0x30(%rbp),%rax
mov    -0x18(%rbp),%rcx
sub    %rcx,%rax
mov    %rax,-0x48(%rbp)
jmp    123d <isExtensionSupported+0x10d>
xor    %eax,%eax
mov    %rax,-0x48(%rbp)
jmp    123d <isExtensionSupported+0x10d>
mov    -0x48(%rbp),%rax
mov    %rax,-0x38(%rbp)
jmp    119e <isExtensionSupported+0x6e>
mov    -0x10(%rbp),%rsi
lea    0xdd6(%rip),%rdi
call   1040 <printf@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<isExtensionSupported>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rdx,%r15
mov    %rsi,%r13
mov    %rdi,%r14
lea    0xeb5(%rip),%rsi
mov    %r13,%rdi
call   1050 <strnstr@plt>
mov    %rax,%rbx
sub    %r13,%rbx
test   %rax,%rax
cmove  %rax,%rbx
xor    %ebp,%ebp
lea    0xec2(%rip),%rdi
cmp    %r15,%rbx
jae    11dc <isExtensionSupported+0xac>
xor    %r12d,%r12d
lea    0xe88(%rip),%rbp
nopl   0x0(%rax,%rax,1)
add    %r13,%r12
mov    %r14,%rdi
mov    %r12,%rsi
mov    %rbx,%rdx
call   1030 <strncmp@plt>
test   %rax,%rax
je     11d0 <isExtensionSupported+0xa0>
lea    (%rbx,%r13,1),%rdi
add    $0x1,%rdi
mov    %rbx,%r12
add    $0x1,%r12
mov    %r15,%rdx
sub    %r12,%rdx
mov    %rbp,%rsi
call   1050 <strnstr@plt>
mov    %rax,%rbx
sub    %r13,%rbx
test   %rax,%rax
cmove  %rax,%rbx
cmp    %r15,%rbx
jb     1180 <isExtensionSupported+0x50>
xor    %ebp,%ebp
lea    0xe5d(%rip),%rdi
jmp    11dc <isExtensionSupported+0xac>
mov    $0x1,%ebp
lea    0xe26(%rip),%rdi
mov    %r14,%rsi
call   1040 <printf@plt>
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [2 x i8] c" \00"
@.str.1 = [41 x i8] c"Info: Found extension support \E2\80\98%s\E2\80\99!\0A\00"
@.str.2 = [43 x i8] c"Warning: Extension is not supported '%s'!\0A\00"
define i32 @isExtensionSupported(i8* %0, i8* %1, i64 %2) {
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i64
%8 = alloca i64
%9 = alloca i8*
%10 = alloca i64
store i8* %0, i8** %5
store i8* %1, i8** %6
store i64 %2, i64* %7
store i64 0, i64* %8
%11 = load i8*, i8** %6
%12 = load i64, i64* %8
%13 = getelementptr inbounds i8, i8* %11, i64 %12
%14 = load i64, i64* %7
%15 = load i64, i64* %8
%16 = sub i64 %14, %15
%17 = call i8* @strnstr(i8* %13, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i64 %16)
store i8* %17, i8** %9
%18 = load i8*, i8** %9
%19 = icmp ne i8* %18, null
br i1 %19, label %20, label %26
20: ; preds = %3
%21 = load i8*, i8** %9
%22 = load i8*, i8** %6
%23 = ptrtoint i8* %21 to i64
%24 = ptrtoint i8* %22 to i64
%25 = sub i64 %23, %24
br label %27
26: ; preds = %3
br label %27
27: ; preds = %26, %20
%28 = phi i64 [ %25, %20 ], [ 0, %26 ]
store i64 %28, i64* %10
br label %29
29: ; preds = %63, %27
%30 = load i64, i64* %10
%31 = load i64, i64* %7
%32 = icmp ult i64 %30, %31
br i1 %32, label %33, label %65
33: ; preds = %29
%34 = load i8*, i8** %5
%35 = load i8*, i8** %6
%36 = load i64, i64* %8
%37 = getelementptr inbounds i8, i8* %35, i64 %36
%38 = load i64, i64* %10
%39 = call i64 @strncmp(i8* %34, i8* %37, i64 %38)
%40 = icmp eq i64 %39, 0
br i1 %40, label %41, label %44
41: ; preds = %33
%42 = load i8*, i8** %5
%43 = call i32 @printf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.1, i64 0, i64 0), i8* %42)
store i32 1, i32* %4
br label %68
44: ; preds = %33
%45 = load i64, i64* %10
%46 = add i64 %45, 1
store i64 %46, i64* %8
%47 = load i8*, i8** %6
%48 = load i64, i64* %8
%49 = getelementptr inbounds i8, i8* %47, i64 %48
%50 = load i64, i64* %7
%51 = load i64, i64* %8
%52 = sub i64 %50, %51
%53 = call i8* @strnstr(i8* %49, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i64 %52)
store i8* %53, i8** %9
%54 = load i8*, i8** %9
%55 = icmp ne i8* %54, null
br i1 %55, label %56, label %62
56: ; preds = %44
%57 = load i8*, i8** %9
%58 = load i8*, i8** %6
%59 = ptrtoint i8* %57 to i64
%60 = ptrtoint i8* %58 to i64
%61 = sub i64 %59, %60
br label %63
62: ; preds = %44
br label %63
63: ; preds = %62, %56
%64 = phi i64 [ %61, %56 ], [ 0, %62 ]
store i64 %64, i64* %10
br label %29
65: ; preds = %29
%66 = load i8*, i8** %5
%67 = call i32 @printf(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.2, i64 0, i64 0), i8* %66)
store i32 0, i32* %4
br label %68
68: ; preds = %65, %41
%69 = load i32, i32* %4
ret i32 %69
}

LLVM IR (-O2):
@.str = [2 x i8] c" \00"
@.str.1 = [41 x i8] c"Info: Found extension support \E2\80\98%s\E2\80\99!\0A\00"
@.str.2 = [43 x i8] c"Warning: Extension is not supported '%s'!\0A\00"
define i32 @isExtensionSupported(i8* %0, i8* %1, i64 %2) {
%4 = tail call i8* @strnstr(i8* %1, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i64 %2)
%5 = icmp eq i8* %4, null
%6 = ptrtoint i8* %4 to i64
%7 = ptrtoint i8* %1 to i64
%8 = sub i64 %6, %7
%9 = select i1 %5, i64 0, i64 %8
%10 = icmp ult i64 %9, %2
br i1 %10, label %11, label %27
11: ; preds = %3, %17
%12 = phi i64 [ %25, %17 ], [ %9, %3 ]
%13 = phi i64 [ %18, %17 ], [ 0, %3 ]
%14 = getelementptr inbounds i8, i8* %1, i64 %13
%15 = tail call i64 @strncmp(i8* %0, i8* %14, i64 %12)
%16 = icmp eq i64 %15, 0
br i1 %16, label %27, label %17
17: ; preds = %11
%18 = add nuw i64 %12, 1
%19 = getelementptr inbounds i8, i8* %1, i64 %18
%20 = sub i64 %2, %18
%21 = tail call i8* @strnstr(i8* %19, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i64 %20)
%22 = icmp eq i8* %21, null
%23 = ptrtoint i8* %21 to i64
%24 = sub i64 %23, %7
%25 = select i1 %22, i64 0, i64 %24
%26 = icmp ult i64 %25, %2
br i1 %26, label %11, label %27
27: ; preds = %17, %11, %3
%28 = phi i8* [ getelementptr inbounds ([43 x i8], [43 x i8]* @.str.2, i64 0, i64 0), %3 ], [ getelementptr inbounds ([41 x i8], [41 x i8]* @.str.1, i64 0, i64 0), %11 ], [ getelementptr inbounds ([43 x i8], [43 x i8]* @.str.2, i64 0, i64 0), %17 ]
%29 = phi i32 [ 0, %3 ], [ 1, %11 ], [ 0, %17 ]
%30 = tail call i32 @printf(i8* %28, i8* %0)
ret i32 %29
}