#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 getAttributeLength(char **);
scalar_t__ strcmp(char *, char *);
int isExisting(char *srcString, char **characterArray) {
  int count = 0;
  int attributeCount = 0;
  attributeCount = getAttributeLength(characterArray);
  for (count = 0; count < attributeCount; count++) {
    if (strcmp(srcString, characterArray[count]) == 0)
      return (1);
  }
  return (0);
}


x86 assembly (clang, -O0):
<isExisting>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
movl   $0x0,-0x20(%rbp)
mov    -0x18(%rbp),%rdi
call   1040 <getAttributeLength@plt>
mov    %eax,-0x20(%rbp)
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x20(%rbp),%eax
jge    119b <isExisting+0x7b>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    (%rax,%rcx,8),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%rax
jne    1188 <isExisting+0x68>
movl   $0x1,-0x4(%rbp)
jmp    11a2 <isExisting+0x82>
jmp    118d <isExisting+0x6d>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1151 <isExisting+0x31>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<isExisting>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %rsi,%r15
mov    %rdi,%r14
mov    %rsi,%rdi
call   1040 <getAttributeLength@plt>
test   %eax,%eax
jle    115a <isExisting+0x3a>
mov    %eax,%r12d
xor    %ebx,%ebx
nop
mov    (%r15,%rbx,8),%rsi
mov    %r14,%rdi
call   1030 <strcmp@plt>
test   %rax,%rax
je     115e <isExisting+0x3e>
add    $0x1,%rbx
cmp    %rbx,%r12
jne    1140 <isExisting+0x20>
xor    %eax,%eax
jmp    1163 <isExisting+0x43>
mov    $0x1,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define i32 @isExisting(i8* %0, i8** %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
store i8* %0, i8** %4
store i8** %1, i8*** %5
store i32 0, i32* %6
store i32 0, i32* %7
%8 = load i8**, i8*** %5
%9 = call i32 @getAttributeLength(i8** %8)
store i32 %9, i32* %7
store i32 0, i32* %6
br label %10
10: ; preds = %25, %2
%11 = load i32, i32* %6
%12 = load i32, i32* %7
%13 = icmp slt i32 %11, %12
br i1 %13, label %14, label %28
14: ; preds = %10
%15 = load i8*, i8** %4
%16 = load i8**, i8*** %5
%17 = load i32, i32* %6
%18 = sext i32 %17 to i64
%19 = getelementptr inbounds i8*, i8** %16, i64 %18
%20 = load i8*, i8** %19
%21 = call i64 @strcmp(i8* %15, i8* %20)
%22 = icmp eq i64 %21, 0
br i1 %22, label %23, label %24
23: ; preds = %14
store i32 1, i32* %3
br label %29
24: ; preds = %14
br label %25
25: ; preds = %24
%26 = load i32, i32* %6
%27 = add nsw i32 %26, 1
store i32 %27, i32* %6
br label %10
28: ; preds = %10
store i32 0, i32* %3
br label %29
29: ; preds = %28, %23
%30 = load i32, i32* %3
ret i32 %30
}

LLVM IR (-O2):
define i32 @isExisting(i8* %0, i8** %1) {
%3 = tail call i32 @getAttributeLength(i8** %1)
%4 = icmp sgt i32 %3, 0
br i1 %4, label %5, label %16
5: ; preds = %2
%6 = zext i32 %3 to i64
br label %9
7: ; preds = %9
%8 = icmp eq i64 %15, %6
br i1 %8, label %16, label %9
9: ; preds = %5, %7
%10 = phi i64 [ 0, %5 ], [ %15, %7 ]
%11 = getelementptr inbounds i8*, i8** %1, i64 %10
%12 = load i8*, i8** %11
%13 = tail call i64 @strcmp(i8* %0, i8* %12)
%14 = icmp eq i64 %13, 0
%15 = add nuw nsw i64 %10, 1
br i1 %14, label %16, label %7
16: ; preds = %9, %7, %2
%17 = phi i32 [ 0, %2 ], [ 0, %7 ], [ 1, %9 ]
ret i32 %17
}