#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__ strcmp(char *, char *);
bool isValidAttribute(char *attr) {
  int i;
  char *attributes[3] = {"ID", "DATE", "NAME"};
  if (attr == NULL)
    return false;
  for (i = 0; i < 3; i++) {
    if ((strcmp(attributes[i], attr) == 0))
      return true;
  }
  return false;
}


x86 assembly (clang, -O0):
<isValidAttribute>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    0x2cdd(%rip),%rax
mov    %rax,-0x30(%rbp)
mov    0x2cda(%rip),%rax
mov    %rax,-0x28(%rbp)
mov    0x2cd7(%rip),%rax
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1154 <isValidAttribute+0x44>
movl   $0x0,-0x4(%rbp)
jmp    11a7 <isValidAttribute+0x97>
movl   $0x0,-0x14(%rbp)
cmpl   $0x3,-0x14(%rbp)
jge    11a0 <isValidAttribute+0x90>
movslq -0x14(%rbp),%rax
mov    -0x30(%rbp,%rax,8),%rdi
mov    -0x10(%rbp),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%rax
jne    118d <isValidAttribute+0x7d>
movl   $0x1,-0x4(%rbp)
jmp    11a7 <isValidAttribute+0x97>
jmp    1192 <isValidAttribute+0x82>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    115b <isValidAttribute+0x4b>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<isValidAttribute>:
push   %rbp
push   %rbx
push   %rax
test   %rdi,%rdi
je     1162 <isValidAttribute+0x52>
mov    %rdi,%rbx
lea    0xede(%rip),%rdi
mov    %rbx,%rsi
call   1030 <strcmp@plt>
mov    $0x1,%ebp
test   %rax,%rax
je     1164 <isValidAttribute+0x54>
lea    0xec8(%rip),%rdi
mov    %rbx,%rsi
call   1030 <strcmp@plt>
test   %rax,%rax
je     1164 <isValidAttribute+0x54>
lea    0xeb9(%rip),%rdi
mov    %rbx,%rsi
call   1030 <strcmp@plt>
xor    %ebp,%ebp
test   %rax,%rax
sete   %bpl
jmp    1164 <isValidAttribute+0x54>
xor    %ebp,%ebp
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [3 x i8] c"ID\00"
@.str.1 = [5 x i8] c"DATE\00"
@.str.2 = [5 x i8] c"NAME\00"
@__const.isValidAttribute.attributes = [3 x i8*] [i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i32 0, i32 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i32 0, i32 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i32 0, i32 0)]
define i32 @isValidAttribute(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
%4 = alloca i32
%5 = alloca [3 x i8*]
store i8* %0, i8** %3
%6 = bitcast [3 x i8*]* %5 to i8*
%7 = load i8*, i8** %3
%8 = icmp eq i8* %7, null
br i1 %8, label %9, label %10
9: ; preds = %1
store i32 0, i32* %2
br label %28
10: ; preds = %1
store i32 0, i32* %4
br label %11
11: ; preds = %24, %10
%12 = load i32, i32* %4
%13 = icmp slt i32 %12, 3
br i1 %13, label %14, label %27
14: ; preds = %11
%15 = load i32, i32* %4
%16 = sext i32 %15 to i64
%17 = getelementptr inbounds [3 x i8*], [3 x i8*]* %5, i64 0, i64 %16
%18 = load i8*, i8** %17
%19 = load i8*, i8** %3
%20 = call i64 @strcmp(i8* %18, i8* %19)
%21 = icmp eq i64 %20, 0
br i1 %21, label %22, label %23
22: ; preds = %14
store i32 1, i32* %2
br label %28
23: ; preds = %14
br label %24
24: ; preds = %23
%25 = load i32, i32* %4
%26 = add nsw i32 %25, 1
store i32 %26, i32* %4
br label %11
27: ; preds = %11
store i32 0, i32* %2
br label %28
28: ; preds = %27, %22, %9
%29 = load i32, i32* %2
ret i32 %29
}

LLVM IR (-O2):
@.str = [3 x i8] c"ID\00"
@.str.1 = [5 x i8] c"DATE\00"
@.str.2 = [5 x i8] c"NAME\00"
define i32 @isValidAttribute(i8* %0) {
%2 = icmp eq i8* %0, null
br i1 %2, label %13, label %3
3: ; preds = %1
%4 = tail call i64 @strcmp(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %0)
%5 = icmp eq i64 %4, 0
br i1 %5, label %13, label %6
6: ; preds = %3
%7 = tail call i64 @strcmp(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i8* %0)
%8 = icmp eq i64 %7, 0
br i1 %8, label %13, label %9
9: ; preds = %6
%10 = tail call i64 @strcmp(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i8* %0)
%11 = icmp eq i64 %10, 0
%12 = zext i1 %11 to i32
br label %13
13: ; preds = %9, %3, %6, %1
%14 = phi i32 [ 0, %1 ], [ 1, %3 ], [ 1, %6 ], [ %12, %9 ]
ret i32 %14
}