#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*/ isspace(char const);
unsigned int strlen(char const *);
bool checkSecondSquareBracket(const char *line, unsigned int *end) {
  unsigned int length = strlen(line);
  for (unsigned int j = length - 1; j > 0; j--) {
    if (!isspace(line[j])) {
      if (line[j] == ']') {
        *end = j;
        return true;
      } else {
        break;
      }
    }
  }
  return false;
}


x86 assembly (clang, -O0):
<checkSecondSquareBracket>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0x20(%rbp)
cmpl   $0x0,-0x20(%rbp)
jbe    11a9 <checkSecondSquareBracket+0x89>
mov    -0x10(%rbp),%rax
mov    -0x20(%rbp),%ecx
movsbl (%rax,%rcx,1),%edi
call   1040 <isspace@plt>
cmp    $0x0,%eax
jne    1196 <checkSecondSquareBracket+0x76>
mov    -0x10(%rbp),%rax
mov    -0x20(%rbp),%ecx
movsbl (%rax,%rcx,1),%eax
cmp    $0x5d,%eax
jne    1191 <checkSecondSquareBracket+0x71>
mov    -0x20(%rbp),%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,(%rax)
movl   $0x1,-0x4(%rbp)
jmp    11b0 <checkSecondSquareBracket+0x90>
jmp    11a9 <checkSecondSquareBracket+0x89>
jmp    119b <checkSecondSquareBracket+0x7b>
mov    -0x20(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x20(%rbp)
jmp    1145 <checkSecondSquareBracket+0x25>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<checkSecondSquareBracket>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
call   1030 <strlen@plt>
mov    %eax,%ebp
add    $0xffffffff,%eax
add    %rax,%rbx
add    $0x1,%rbx
xor    %r15d,%r15d
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
cmp    $0x1,%ebp
je     1177 <checkSecondSquareBracket+0x57>
movsbl -0x1(%rbx),%edi
add    $0xffffffffffffffff,%rbx
call   1040 <isspace@plt>
add    $0xffffffff,%ebp
test   %eax,%eax
jne    1150 <checkSecondSquareBracket+0x30>
cmpb   $0x5d,(%rbx)
jne    1177 <checkSecondSquareBracket+0x57>
mov    %ebp,(%r14)
mov    $0x1,%r15d
mov    %r15d,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

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

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