#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*/ isalnum(unsigned char const);
int is_ini(const unsigned char *buffer) {
  const unsigned char *src = buffer;
  if (*src != '[')
    return 0;
  src++;
  while (*src != '\0') {
    if (*src == ']') {
      if (src > buffer + 3)
        return 1;
      return 0;
    }
    if (!isalnum(*src) && *src != ' ')
      return 0;
    src++;
  }
  return 0;
}


x86 assembly (clang, -O0):
<is_ini>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
movzbl (%rax),%eax
cmp    $0x5b,%eax
je     1140 <is_ini+0x30>
movl   $0x0,-0x4(%rbp)
jmp    11e2 <is_ini+0xd2>
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
movzbl (%rax),%eax
cmp    $0x0,%eax
je     11db <is_ini+0xcb>
mov    -0x18(%rbp),%rax
movzbl (%rax),%eax
cmp    $0x5d,%eax
jne    1199 <is_ini+0x89>
mov    -0x18(%rbp),%rax
mov    -0x10(%rbp),%rcx
add    $0x3,%rcx
cmp    %rcx,%rax
jbe    118d <is_ini+0x7d>
movl   $0x1,-0x4(%rbp)
jmp    11e2 <is_ini+0xd2>
movl   $0x0,-0x4(%rbp)
jmp    11e2 <is_ini+0xd2>
mov    -0x18(%rbp),%rax
movzbl (%rax),%edi
call   1030 <isalnum@plt>
cmp    $0x0,%eax
jne    11ca <is_ini+0xba>
mov    -0x18(%rbp),%rax
movzbl (%rax),%eax
cmp    $0x20,%eax
je     11ca <is_ini+0xba>
movl   $0x0,-0x4(%rbp)
jmp    11e2 <is_ini+0xd2>
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    114c <is_ini+0x3c>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<is_ini>:
push   %r15
push   %r14
push   %rbx
xor    %r14d,%r14d
cmpb   $0x5b,(%rdi)
jne    1163 <is_ini+0x53>
mov    %rdi,%r15
xor    %r14d,%r14d
xor    %ebx,%ebx
jmp    1134 <is_ini+0x24>
nopw   0x0(%rax,%rax,1)
add    $0x1,%rbx
movzbl 0x1(%r15,%rbx,1),%eax
test   %al,%al
je     1163 <is_ini+0x53>
cmp    $0x5d,%al
je     1158 <is_ini+0x48>
movzbl %al,%edi
call   1030 <isalnum@plt>
test   %eax,%eax
jne    1130 <is_ini+0x20>
cmpb   $0x20,0x1(%r15,%rbx,1)
je     1130 <is_ini+0x20>
jmp    1163 <is_ini+0x53>
xor    %r14d,%r14d
cmp    $0x3,%rbx
setae  %r14b
mov    %r14d,%eax
pop    %rbx
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
define i32 @is_ini(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 91
br i1 %3, label %4, label %19
4: ; preds = %1, %18
%5 = phi i64 [ %6, %18 ], [ 0, %1 ]
%6 = add nuw nsw i64 %5, 1
%7 = getelementptr inbounds i8, i8* %0, i64 %6
%8 = load i8, i8* %7
switch i8 %8, label %12 [
i8 0, label %19
i8 93, label %9
]
9: ; preds = %4
%10 = icmp ugt i64 %5, 2
%11 = zext i1 %10 to i32
br label %19
12: ; preds = %4
%13 = tail call i32 @isalnum(i8 zeroext %8)
%14 = icmp eq i32 %13, 0
br i1 %14, label %15, label %18
15: ; preds = %12
%16 = load i8, i8* %7
%17 = icmp eq i8 %16, 32
br i1 %17, label %18, label %19
18: ; preds = %15, %12
br label %4
19: ; preds = %4, %15, %9, %1
%20 = phi i32 [ 0, %1 ], [ %11, %9 ], [ 0, %15 ], [ 0, %4 ]
ret i32 %20
}