#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 */
scalar_t__ strncmp(char *, char *, int);
char toupper(char);
int issection(char *text) {
  int rc;
  int i;
  char maybe_section[9];
  if (*text != '?')
    rc = 0;
  else {
    for (i = 0; i < 9; i++)
      maybe_section[i] = toupper(text[i]);
    if (strncmp(maybe_section, "?SECTION", 8) == 0)
      rc = 1;
    else
      rc = 0;
  }
  return rc;
}


x86 assembly (clang, -O0):
<issection>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x3f,%eax
je     1148 <issection+0x28>
movl   $0x0,-0xc(%rbp)
jmp    11b9 <issection+0x99>
movl   $0x0,-0x10(%rbp)
cmpl   $0x9,-0x10(%rbp)
jge    1182 <issection+0x62>
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
movsbl (%rax,%rcx,1),%edi
call   1040 <toupper@plt>
mov    %al,%cl
movslq -0x10(%rbp),%rax
mov    %cl,-0x19(%rbp,%rax,1)
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    114f <issection+0x2f>
lea    -0x19(%rbp),%rdi
lea    0xe73(%rip),%rsi
mov    $0x8,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%rax
jne    11ad <issection+0x8d>
movl   $0x1,-0xc(%rbp)
jmp    11b4 <issection+0x94>
movl   $0x0,-0xc(%rbp)
jmp    11b9 <issection+0x99>
mov    -0xc(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<issection>:
push   %rbx
sub    $0x10,%rsp
xor    %eax,%eax
cmpb   $0x3f,(%rdi)
jne    11ca <issection+0xaa>
mov    %rdi,%rbx
mov    $0x3f,%edi
call   1040 <toupper@plt>
mov    %al,0x7(%rsp)
movsbl 0x1(%rbx),%edi
call   1040 <toupper@plt>
mov    %al,0x8(%rsp)
movsbl 0x2(%rbx),%edi
call   1040 <toupper@plt>
mov    %al,0x9(%rsp)
movsbl 0x3(%rbx),%edi
call   1040 <toupper@plt>
mov    %al,0xa(%rsp)
movsbl 0x4(%rbx),%edi
call   1040 <toupper@plt>
mov    %al,0xb(%rsp)
movsbl 0x5(%rbx),%edi
call   1040 <toupper@plt>
mov    %al,0xc(%rsp)
movsbl 0x6(%rbx),%edi
call   1040 <toupper@plt>
mov    %al,0xd(%rsp)
movsbl 0x7(%rbx),%edi
call   1040 <toupper@plt>
mov    %al,0xe(%rsp)
movsbl 0x8(%rbx),%edi
call   1040 <toupper@plt>
mov    %al,0xf(%rsp)
lea    0xe50(%rip),%rsi
lea    0x7(%rsp),%rdi
mov    $0x8,%edx
call   1030 <strncmp@plt>
mov    %rax,%rcx
xor    %eax,%eax
test   %rcx,%rcx
sete   %al
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [9 x i8] c"?SECTION\00"
define i32 @issection(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
%4 = alloca i32
%5 = alloca [9 x i8]
store i8* %0, i8** %2
%6 = load i8*, i8** %2
%7 = load i8, i8* %6
%8 = sext i8 %7 to i32
%9 = icmp ne i32 %8, 63
br i1 %9, label %10, label %11
10: ; preds = %1
store i32 0, i32* %3
br label %35
11: ; preds = %1
store i32 0, i32* %4
br label %12
12: ; preds = %25, %11
%13 = load i32, i32* %4
%14 = icmp slt i32 %13, 9
br i1 %14, label %15, label %28
15: ; preds = %12
%16 = load i8*, i8** %2
%17 = load i32, i32* %4
%18 = sext i32 %17 to i64
%19 = getelementptr inbounds i8, i8* %16, i64 %18
%20 = load i8, i8* %19
%21 = call signext i8 @toupper(i8 signext %20)
%22 = load i32, i32* %4
%23 = sext i32 %22 to i64
%24 = getelementptr inbounds [9 x i8], [9 x i8]* %5, i64 0, i64 %23
store i8 %21, i8* %24
br label %25
25: ; preds = %15
%26 = load i32, i32* %4
%27 = add nsw i32 %26, 1
store i32 %27, i32* %4
br label %12
28: ; preds = %12
%29 = getelementptr inbounds [9 x i8], [9 x i8]* %5, i64 0, i64 0
%30 = call i64 @strncmp(i8* %29, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 8)
%31 = icmp eq i64 %30, 0
br i1 %31, label %32, label %33
32: ; preds = %28
store i32 1, i32* %3
br label %34
33: ; preds = %28
store i32 0, i32* %3
br label %34
34: ; preds = %33, %32
br label %35
35: ; preds = %34, %10
%36 = load i32, i32* %3
ret i32 %36
}

LLVM IR (-O2):
@.str = [9 x i8] c"?SECTION\00"
define i32 @issection(i8* nocapture %0) {
%2 = alloca [9 x i8]
%3 = getelementptr inbounds [9 x i8], [9 x i8]* %2, i64 0, i64 0
%4 = load i8, i8* %0
%5 = icmp eq i8 %4, 63
br i1 %5, label %6, label %43
6: ; preds = %1
%7 = tail call signext i8 @toupper(i8 signext 63)
store i8 %7, i8* %3
%8 = getelementptr inbounds i8, i8* %0, i64 1
%9 = load i8, i8* %8
%10 = tail call signext i8 @toupper(i8 signext %9)
%11 = getelementptr inbounds [9 x i8], [9 x i8]* %2, i64 0, i64 1
store i8 %10, i8* %11
%12 = getelementptr inbounds i8, i8* %0, i64 2
%13 = load i8, i8* %12
%14 = tail call signext i8 @toupper(i8 signext %13)
%15 = getelementptr inbounds [9 x i8], [9 x i8]* %2, i64 0, i64 2
store i8 %14, i8* %15
%16 = getelementptr inbounds i8, i8* %0, i64 3
%17 = load i8, i8* %16
%18 = tail call signext i8 @toupper(i8 signext %17)
%19 = getelementptr inbounds [9 x i8], [9 x i8]* %2, i64 0, i64 3
store i8 %18, i8* %19
%20 = getelementptr inbounds i8, i8* %0, i64 4
%21 = load i8, i8* %20
%22 = tail call signext i8 @toupper(i8 signext %21)
%23 = getelementptr inbounds [9 x i8], [9 x i8]* %2, i64 0, i64 4
store i8 %22, i8* %23
%24 = getelementptr inbounds i8, i8* %0, i64 5
%25 = load i8, i8* %24
%26 = tail call signext i8 @toupper(i8 signext %25)
%27 = getelementptr inbounds [9 x i8], [9 x i8]* %2, i64 0, i64 5
store i8 %26, i8* %27
%28 = getelementptr inbounds i8, i8* %0, i64 6
%29 = load i8, i8* %28
%30 = tail call signext i8 @toupper(i8 signext %29)
%31 = getelementptr inbounds [9 x i8], [9 x i8]* %2, i64 0, i64 6
store i8 %30, i8* %31
%32 = getelementptr inbounds i8, i8* %0, i64 7
%33 = load i8, i8* %32
%34 = tail call signext i8 @toupper(i8 signext %33)
%35 = getelementptr inbounds [9 x i8], [9 x i8]* %2, i64 0, i64 7
store i8 %34, i8* %35
%36 = getelementptr inbounds i8, i8* %0, i64 8
%37 = load i8, i8* %36
%38 = tail call signext i8 @toupper(i8 signext %37)
%39 = getelementptr inbounds [9 x i8], [9 x i8]* %2, i64 0, i64 8
store i8 %38, i8* %39
%40 = call i64 @strncmp(i8* %3, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 8)
%41 = icmp eq i64 %40, 0
%42 = zext i1 %41 to i32
br label %43
43: ; preds = %6, %1
%44 = phi i32 [ 0, %1 ], [ %42, %6 ]
ret i32 %44
}