#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*/ SPC_Strip(char *);
int /*<<< orphan*/ SPC_Trim(char *);
int strlen(char *);
int /*<<< orphan*/ strncpy(char *, char *, int);
int isSection(char *line, char *section) {
  int len;
  SPC_Trim(line);
  SPC_Strip(line);
  len = strlen(line);
  if (len < 2) {
    return 0;
  }
  if (line[0] == '[' && line[len - 1] == ']') {
    strncpy(section, line + 1, len - 2);
    section[len - 2] = '\0';
    return 1;
  } else {
    return 0;
  }
}


x86 assembly (clang, -O0):
<isSection>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
call   1050 <SPC_Trim@plt>
mov    -0x10(%rbp),%rdi
call   1060 <SPC_Strip@plt>
mov    -0x10(%rbp),%rdi
call   1040 <strlen@plt>
mov    %eax,-0x1c(%rbp)
cmpl   $0x2,-0x1c(%rbp)
jge    1184 <isSection+0x44>
movl   $0x0,-0x4(%rbp)
jmp    11e9 <isSection+0xa9>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x5b,%eax
jne    11e2 <isSection+0xa2>
mov    -0x10(%rbp),%rax
mov    -0x1c(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x5d,%eax
jne    11e2 <isSection+0xa2>
mov    -0x18(%rbp),%rdi
mov    -0x10(%rbp),%rsi
add    $0x1,%rsi
mov    -0x1c(%rbp),%edx
sub    $0x2,%edx
call   1030 <strncpy@plt>
mov    -0x18(%rbp),%rax
mov    -0x1c(%rbp),%ecx
sub    $0x2,%ecx
movslq %ecx,%rcx
movb   $0x0,(%rax,%rcx,1)
movl   $0x1,-0x4(%rbp)
jmp    11e9 <isSection+0xa9>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<isSection>:
push   %r15
push   %r14
push   %rbx
mov    %rsi,%r14
mov    %rdi,%rbx
call   1050 <SPC_Trim@plt>
mov    %rbx,%rdi
call   1060 <SPC_Strip@plt>
mov    %rbx,%rdi
call   1040 <strlen@plt>
mov    %eax,%r15d
xor    %eax,%eax
cmp    $0x2,%r15d
jl     119a <isSection+0x5a>
cmpb   $0x5b,(%rbx)
jne    119a <isSection+0x5a>
lea    -0x1(%r15),%ecx
cmpb   $0x5d,(%rbx,%rcx,1)
jne    119a <isSection+0x5a>
add    $0x1,%rbx
add    $0xfffffffe,%r15d
mov    %r14,%rdi
mov    %rbx,%rsi
mov    %r15d,%edx
call   1030 <strncpy@plt>
movb   $0x0,(%r14,%r15,1)
mov    $0x1,%eax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define i32 @isSection(i8* %0, i8* %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i32
store i8* %0, i8** %4
store i8* %1, i8** %5
%7 = load i8*, i8** %4
%8 = call i32 @SPC_Trim(i8* %7)
%9 = load i8*, i8** %4
%10 = call i32 @SPC_Strip(i8* %9)
%11 = load i8*, i8** %4
%12 = call i32 @strlen(i8* %11)
store i32 %12, i32* %6
%13 = load i32, i32* %6
%14 = icmp slt i32 %13, 2
br i1 %14, label %15, label %16
15: ; preds = %2
store i32 0, i32* %3
br label %44
16: ; preds = %2
%17 = load i8*, i8** %4
%18 = getelementptr inbounds i8, i8* %17, i64 0
%19 = load i8, i8* %18
%20 = sext i8 %19 to i32
%21 = icmp eq i32 %20, 91
br i1 %21, label %22, label %43
22: ; preds = %16
%23 = load i8*, i8** %4
%24 = load i32, i32* %6
%25 = sub nsw i32 %24, 1
%26 = sext i32 %25 to i64
%27 = getelementptr inbounds i8, i8* %23, 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 %43
31: ; preds = %22
%32 = load i8*, i8** %5
%33 = load i8*, i8** %4
%34 = getelementptr inbounds i8, i8* %33, i64 1
%35 = load i32, i32* %6
%36 = sub nsw i32 %35, 2
%37 = call i32 @strncpy(i8* %32, i8* %34, i32 %36)
%38 = load i8*, i8** %5
%39 = load i32, i32* %6
%40 = sub nsw i32 %39, 2
%41 = sext i32 %40 to i64
%42 = getelementptr inbounds i8, i8* %38, i64 %41
store i8 0, i8* %42
store i32 1, i32* %3
br label %44
43: ; preds = %22, %16
store i32 0, i32* %3
br label %44
44: ; preds = %43, %31, %15
%45 = load i32, i32* %3
ret i32 %45
}

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