#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*/ *strstr(char *, char *);
int /*<<< orphan*/ toupper(int /*<<< orphan*/);
int name_is_elem(char *groupname) {
  char prool_buffer[512];
  int i, ret;
  char *cc, *groupname0;
  groupname0 = groupname;
  for (i = 0; i < 512; i++)
    prool_buffer[i] = 0;
  cc = prool_buffer;
  while (*groupname) {
    *cc++ = toupper(*groupname++);
  }
  if (strstr(prool_buffer, "ELEM") == NULL)
    ret = 0;
  else
    ret = 1;
  return ret;
}


x86 assembly (clang, -O0):
<name_is_elem>:
push   %rbp
mov    %rsp,%rbp
sub    $0x230,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x228(%rbp)
movl   $0x0,-0x214(%rbp)
cmpl   $0x200,-0x214(%rbp)
jge    1177 <name_is_elem+0x57>
movslq -0x214(%rbp),%rax
movb   $0x0,-0x210(%rbp,%rax,1)
mov    -0x214(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x214(%rbp)
jmp    1144 <name_is_elem+0x24>
lea    -0x210(%rbp),%rax
mov    %rax,-0x220(%rbp)
mov    -0x8(%rbp),%rax
cmpb   $0x0,(%rax)
je     11c7 <name_is_elem+0xa7>
mov    -0x8(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x8(%rbp)
movsbl (%rax),%edi
call   1030 <toupper@plt>
mov    %al,%cl
mov    -0x220(%rbp),%rax
mov    %rax,%rdx
add    $0x1,%rdx
mov    %rdx,-0x220(%rbp)
mov    %cl,(%rax)
jmp    1185 <name_is_elem+0x65>
lea    -0x210(%rbp),%rdi
lea    0xe2b(%rip),%rsi
call   1040 <strstr@plt>
cmp    $0x0,%rax
jne    11f3 <name_is_elem+0xd3>
movl   $0x0,-0x218(%rbp)
jmp    11fd <name_is_elem+0xdd>
movl   $0x1,-0x218(%rbp)
mov    -0x218(%rbp),%eax
add    $0x230,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<name_is_elem>:
push   %r14
push   %rbx
sub    $0x208,%rsp
mov    %rdi,%r14
mov    %rsp,%rdi
mov    $0x200,%edx
xor    %esi,%esi
call   1040 <memset@plt>
mov    (%r14),%al
test   %al,%al
je     1179 <name_is_elem+0x49>
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nop
movsbl %al,%edi
call   1030 <toupper@plt>
mov    %al,(%rsp,%rbx,1)
movzbl 0x1(%r14,%rbx,1),%eax
add    $0x1,%rbx
test   %al,%al
jne    1160 <name_is_elem+0x30>
lea    0xe80(%rip),%rsi
mov    %rsp,%rdi
call   1050 <strstr@plt>
xor    %ecx,%ecx
test   %rax,%rax
setne  %cl
mov    %ecx,%eax
add    $0x208,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
@.str = [5 x i8] c"ELEM\00"
define i32 @name_is_elem(i8* nocapture %0) {
%2 = alloca [512 x i8]
%3 = getelementptr inbounds [512 x i8], [512 x i8]* %2, i64 0, i64 0
%4 = getelementptr inbounds [512 x i8], [512 x i8]* %2, i64 0, i64 0
%5 = load i8, i8* %0
%6 = icmp eq i8 %5, 0
br i1 %6, label %18, label %7
7: ; preds = %1, %7
%8 = phi i8 [ %16, %7 ], [ %5, %1 ]
%9 = phi i8* [ %11, %7 ], [ %0, %1 ]
%10 = phi i8* [ %15, %7 ], [ %4, %1 ]
%11 = getelementptr inbounds i8, i8* %9, i64 1
%12 = sext i8 %8 to i32
%13 = tail call i32 @toupper(i32 %12)
%14 = trunc i32 %13 to i8
%15 = getelementptr inbounds i8, i8* %10, i64 1
store i8 %14, i8* %10
%16 = load i8, i8* %11
%17 = icmp eq i8 %16, 0
br i1 %17, label %18, label %7
18: ; preds = %7, %1
%19 = call i32* @strstr(i8* %4, i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%20 = icmp ne i32* %19, null
%21 = zext i1 %20 to i32
ret i32 %21
}