#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 */
typedef int /*<<< orphan*/ tbl;

/* Variables and functions */
int /*<<< orphan*/ strcmp(char const *, char const *);
int geonames_is_valid_feature_code(const char *feature_code) {
  const char *tbl[] = {"PPL", "PCLI", "PPLA", "ADM1", "PPLL", "PPLC", "PPLF"};
  unsigned int i, tlen;
  tlen = sizeof(tbl) / sizeof(tbl[0]);
  for (i = 0; i < tlen; i++) {
    if (!strcmp(feature_code, tbl[i]))
      return 1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<geonames_is_valid_feature_code>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
mov    %rdi,-0x10(%rbp)
lea    -0x50(%rbp),%rdi
lea    0x2ca9(%rip),%rsi
mov    $0x38,%edx
call   1040 <memcpy@plt>
movl   $0x7,-0x58(%rbp)
movl   $0x0,-0x54(%rbp)
mov    -0x54(%rbp),%eax
cmp    -0x58(%rbp),%eax
jae    1194 <geonames_is_valid_feature_code+0x74>
mov    -0x10(%rbp),%rdi
mov    -0x54(%rbp),%eax
mov    -0x50(%rbp,%rax,8),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%eax
jne    1181 <geonames_is_valid_feature_code+0x61>
movl   $0x1,-0x4(%rbp)
jmp    119b <geonames_is_valid_feature_code+0x7b>
jmp    1186 <geonames_is_valid_feature_code+0x66>
mov    -0x54(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x54(%rbp)
jmp    114f <geonames_is_valid_feature_code+0x2f>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<geonames_is_valid_feature_code>:
push   %rbp
push   %rbx
push   %rax
mov    %rdi,%rbx
lea    0xee3(%rip),%rsi
call   1030 <strcmp@plt>
mov    $0x1,%ebp
test   %eax,%eax
je     11a1 <geonames_is_valid_feature_code+0x91>
lea    0xed2(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcmp@plt>
test   %eax,%eax
je     11a1 <geonames_is_valid_feature_code+0x91>
lea    0xec4(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcmp@plt>
test   %eax,%eax
je     11a1 <geonames_is_valid_feature_code+0x91>
lea    0xeb6(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcmp@plt>
test   %eax,%eax
je     11a1 <geonames_is_valid_feature_code+0x91>
lea    0xea8(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcmp@plt>
test   %eax,%eax
je     11a1 <geonames_is_valid_feature_code+0x91>
lea    0xe9a(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcmp@plt>
test   %eax,%eax
je     11a1 <geonames_is_valid_feature_code+0x91>
lea    0xe8c(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcmp@plt>
xor    %ebp,%ebp
test   %eax,%eax
sete   %bpl
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [4 x i8] c"PPL\00"
@.str.1 = [5 x i8] c"PCLI\00"
@.str.2 = [5 x i8] c"PPLA\00"
@.str.3 = [5 x i8] c"ADM1\00"
@.str.4 = [5 x i8] c"PPLL\00"
@.str.5 = [5 x i8] c"PPLC\00"
@.str.6 = [5 x i8] c"PPLF\00"
@__const.geonames_is_valid_feature_code.tbl = [7 x i8*] [i8* getelementptr inbounds ([4 x i8], [4 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), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i32 0, i32 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i32 0, i32 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i32 0, i32 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.6, i32 0, i32 0)]
define i32 @geonames_is_valid_feature_code(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
%4 = alloca [7 x i8*]
%5 = alloca i32
%6 = alloca i32
store i8* %0, i8** %3
%7 = bitcast [7 x i8*]* %4 to i8*
store i32 7, i32* %6
store i32 0, i32* %5
br label %8
8: ; preds = %22, %1
%9 = load i32, i32* %5
%10 = load i32, i32* %6
%11 = icmp ult i32 %9, %10
br i1 %11, label %12, label %25
12: ; preds = %8
%13 = load i8*, i8** %3
%14 = load i32, i32* %5
%15 = zext i32 %14 to i64
%16 = getelementptr inbounds [7 x i8*], [7 x i8*]* %4, i64 0, i64 %15
%17 = load i8*, i8** %16
%18 = call i32 @strcmp(i8* %13, i8* %17)
%19 = icmp ne i32 %18, 0
br i1 %19, label %21, label %20
20: ; preds = %12
store i32 1, i32* %2
br label %26
21: ; preds = %12
br label %22
22: ; preds = %21
%23 = load i32, i32* %5
%24 = add i32 %23, 1
store i32 %24, i32* %5
br label %8
25: ; preds = %8
store i32 0, i32* %2
br label %26
26: ; preds = %25, %20
%27 = load i32, i32* %2
ret i32 %27
}

LLVM IR (-O2):
@.str = [4 x i8] c"PPL\00"
@.str.1 = [5 x i8] c"PCLI\00"
@.str.2 = [5 x i8] c"PPLA\00"
@.str.3 = [5 x i8] c"ADM1\00"
@.str.4 = [5 x i8] c"PPLL\00"
@.str.5 = [5 x i8] c"PPLC\00"
@.str.6 = [5 x i8] c"PPLF\00"
define i32 @geonames_is_valid_feature_code(i8* nocapture %0) {
%2 = tail call i32 @strcmp(i8* dereferenceable(1) %0, i8* dereferenceable(4) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%3 = icmp eq i32 %2, 0
br i1 %3, label %23, label %4
4: ; preds = %1
%5 = tail call i32 @strcmp(i8* dereferenceable(1) %0, i8* dereferenceable(5) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
%6 = icmp eq i32 %5, 0
br i1 %6, label %23, label %7
7: ; preds = %4
%8 = tail call i32 @strcmp(i8* dereferenceable(1) %0, i8* dereferenceable(5) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
%9 = icmp eq i32 %8, 0
br i1 %9, label %23, label %10
10: ; preds = %7
%11 = tail call i32 @strcmp(i8* dereferenceable(1) %0, i8* dereferenceable(5) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0))
%12 = icmp eq i32 %11, 0
br i1 %12, label %23, label %13
13: ; preds = %10
%14 = tail call i32 @strcmp(i8* dereferenceable(1) %0, i8* dereferenceable(5) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0))
%15 = icmp eq i32 %14, 0
br i1 %15, label %23, label %16
16: ; preds = %13
%17 = tail call i32 @strcmp(i8* dereferenceable(1) %0, i8* dereferenceable(5) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i64 0, i64 0))
%18 = icmp eq i32 %17, 0
br i1 %18, label %23, label %19
19: ; preds = %16
%20 = tail call i32 @strcmp(i8* dereferenceable(1) %0, i8* dereferenceable(5) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.6, i64 0, i64 0))
%21 = icmp eq i32 %20, 0
%22 = zext i1 %21 to i32
br label %23
23: ; preds = %19, %16, %13, %10, %7, %4, %1
%24 = phi i32 [ 1, %1 ], [ 1, %4 ], [ 1, %7 ], [ 1, %10 ], [ 1, %13 ], [ 1, %16 ], [ %22, %19 ]
ret i32 %24
}