#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__ isalpha(int);
scalar_t__ isupper(char);
int strlen(char *);
char *strstr(char const *, char *);
int is_element_a_metal(char szEl[]) {
  static const char szMetals[] =
      "K;V;Y;W;U;"
      "Li;Be;Na;Mg;Al;Ca;Sc;Ti;Cr;Mn;Fe;Co;Ni;Cu;Zn;Ga;Rb;Sr;Zr;"
      "Nb;Mo;Tc;Ru;Rh;Pd;Ag;Cd;In;Sn;Sb;Cs;Ba;La;Ce;Pr;Nd;Pm;Sm;"
      "Eu;Gd;Tb;Dy;Ho;Er;Tm;Yb;Lu;Hf;Ta;Re;Os;Ir;Pt;Au;Hg;Tl;Pb;"
      "Bi;Po;Fr;Ra;Ac;Th;Pa;Np;Pu;Am;Cm;Bk;Cf;Es;Fm;Md;No;Lr;Rf;";
  const int len = strlen(szEl);
  const char *p;
  if (0 < len && len <= 2 && isalpha((int)(unsigned char)szEl[0]) &&
      isupper(szEl[0]) && (p = strstr(szMetals, szEl)) && p[len] == ';') {
    return 1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<is_element_a_metal>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,-0x14(%rbp)
xor    %eax,%eax
cmp    -0x14(%rbp),%eax
jge    11d8 <is_element_a_metal+0x98>
cmpl   $0x2,-0x14(%rbp)
jg     11d8 <is_element_a_metal+0x98>
mov    -0x10(%rbp),%rax
movzbl (%rax),%edi
call   1040 <isalpha@plt>
cmp    $0x0,%rax
je     11d8 <is_element_a_metal+0x98>
mov    -0x10(%rbp),%rax
movsbl (%rax),%edi
call   1050 <isupper@plt>
cmp    $0x0,%rax
je     11d8 <is_element_a_metal+0x98>
mov    -0x10(%rbp),%rsi
lea    0xe5c(%rip),%rdi
call   1060 <strstr@plt>
mov    %rax,-0x20(%rbp)
cmp    $0x0,%rax
je     11d8 <is_element_a_metal+0x98>
mov    -0x20(%rbp),%rax
movslq -0x14(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x3b,%eax
jne    11d8 <is_element_a_metal+0x98>
movl   $0x1,-0x4(%rbp)
jmp    11df <is_element_a_metal+0x9f>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<is_element_a_metal>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%rbx
call   1030 <strlen@plt>
mov    %eax,%r14d
lea    -0x1(%r14),%eax
cmp    $0x1,%eax
ja     1194 <is_element_a_metal+0x54>
movzbl (%rbx),%edi
call   1040 <isalpha@plt>
test   %rax,%rax
je     1194 <is_element_a_metal+0x54>
movsbl (%rbx),%edi
call   1050 <isupper@plt>
test   %rax,%rax
je     1194 <is_element_a_metal+0x54>
lea    0xe87(%rip),%rdi
mov    %rbx,%rsi
call   1060 <strstr@plt>
test   %rax,%rax
je     1194 <is_element_a_metal+0x54>
mov    %r14d,%edx
mov    $0x1,%ecx
cmpb   $0x3b,(%rax,%rdx,1)
je     1196 <is_element_a_metal+0x56>
xor    %ecx,%ecx
mov    %ecx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@is_element_a_metal.szMetals = internal constant [239 x i8] c"K;V;Y;W;U;Li;Be;Na;Mg;Al;Ca;Sc;Ti;Cr;Mn;Fe;Co;Ni;Cu;Zn;Ga;Rb;Sr;Zr;Nb;Mo;Tc;Ru;Rh;Pd;Ag;Cd;In;Sn;Sb;Cs;Ba;La;Ce;Pr;Nd;Pm;Sm;Eu;Gd;Tb;Dy;Ho;Er;Tm;Yb;Lu;Hf;Ta;Re;Os;Ir;Pt;Au;Hg;Tl;Pb;Bi;Po;Fr;Ra;Ac;Th;Pa;Np;Pu;Am;Cm;Bk;Cf;Es;Fm;Md;No;Lr;Rf;\00"
define i32 @is_element_a_metal(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
%4 = alloca i32
%5 = alloca i8*
store i8* %0, i8** %3
%6 = load i8*, i8** %3
%7 = call i32 @strlen(i8* %6)
store i32 %7, i32* %4
%8 = load i32, i32* %4
%9 = icmp slt i32 0, %8
br i1 %9, label %10, label %39
10: ; preds = %1
%11 = load i32, i32* %4
%12 = icmp sle i32 %11, 2
br i1 %12, label %13, label %39
13: ; preds = %10
%14 = load i8*, i8** %3
%15 = getelementptr inbounds i8, i8* %14, i64 0
%16 = load i8, i8* %15
%17 = zext i8 %16 to i32
%18 = call i64 @isalpha(i32 %17)
%19 = icmp ne i64 %18, 0
br i1 %19, label %20, label %39
20: ; preds = %13
%21 = load i8*, i8** %3
%22 = getelementptr inbounds i8, i8* %21, i64 0
%23 = load i8, i8* %22
%24 = call i64 @isupper(i8 signext %23)
%25 = icmp ne i64 %24, 0
br i1 %25, label %26, label %39
26: ; preds = %20
%27 = load i8*, i8** %3
%28 = call i8* @strstr(i8* getelementptr inbounds ([239 x i8], [239 x i8]* @is_element_a_metal.szMetals, i64 0, i64 0), i8* %27)
store i8* %28, i8** %5
%29 = icmp ne i8* %28, null
br i1 %29, label %30, label %39
30: ; preds = %26
%31 = load i8*, i8** %5
%32 = load i32, i32* %4
%33 = sext i32 %32 to i64
%34 = getelementptr inbounds i8, i8* %31, i64 %33
%35 = load i8, i8* %34
%36 = sext i8 %35 to i32
%37 = icmp eq i32 %36, 59
br i1 %37, label %38, label %39
38: ; preds = %30
store i32 1, i32* %2
br label %40
39: ; preds = %30, %26, %20, %13, %10, %1
store i32 0, i32* %2
br label %40
40: ; preds = %39, %38
%41 = load i32, i32* %2
ret i32 %41
}

LLVM IR (-O2):
@is_element_a_metal.szMetals = internal constant [239 x i8] c"K;V;Y;W;U;Li;Be;Na;Mg;Al;Ca;Sc;Ti;Cr;Mn;Fe;Co;Ni;Cu;Zn;Ga;Rb;Sr;Zr;Nb;Mo;Tc;Ru;Rh;Pd;Ag;Cd;In;Sn;Sb;Cs;Ba;La;Ce;Pr;Nd;Pm;Sm;Eu;Gd;Tb;Dy;Ho;Er;Tm;Yb;Lu;Hf;Ta;Re;Os;Ir;Pt;Au;Hg;Tl;Pb;Bi;Po;Fr;Ra;Ac;Th;Pa;Np;Pu;Am;Cm;Bk;Cf;Es;Fm;Md;No;Lr;Rf;\00"
define i32 @is_element_a_metal(i8* %0) {
%2 = tail call i32 @strlen(i8* %0)
%3 = add i32 %2, -1
%4 = icmp ult i32 %3, 2
br i1 %4, label %5, label %22
5: ; preds = %1
%6 = load i8, i8* %0
%7 = zext i8 %6 to i32
%8 = tail call i64 @isalpha(i32 %7)
%9 = icmp eq i64 %8, 0
br i1 %9, label %22, label %10
10: ; preds = %5
%11 = load i8, i8* %0
%12 = tail call i64 @isupper(i8 signext %11)
%13 = icmp eq i64 %12, 0
br i1 %13, label %22, label %14
14: ; preds = %10
%15 = tail call i8* @strstr(i8* dereferenceable(1) getelementptr inbounds ([239 x i8], [239 x i8]* @is_element_a_metal.szMetals, i64 0, i64 0), i8* %0)
%16 = icmp eq i8* %15, null
br i1 %16, label %22, label %17
17: ; preds = %14
%18 = zext i32 %2 to i64
%19 = getelementptr inbounds i8, i8* %15, i64 %18
%20 = load i8, i8* %19
%21 = icmp eq i8 %20, 59
br i1 %21, label %23, label %22
22: ; preds = %17, %14, %10, %5, %1
br label %23
23: ; preds = %17, %22
%24 = phi i32 [ 0, %22 ], [ 1, %17 ]
ret i32 %24
}