#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 const *, char const *);
int hashmap_key_is_in_vector(const char **vec, size_t size, const char *key) {
  size_t i;
  for (i = 0; i < size; i++) {
    if (strcmp(vec[i], key) == 0)
      return 1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<hashmap_key_is_in_vector>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
movq   $0x0,-0x28(%rbp)
mov    -0x28(%rbp),%rax
cmp    -0x18(%rbp),%rax
jae    117b <hashmap_key_is_in_vector+0x6b>
mov    -0x10(%rbp),%rax
mov    -0x28(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
mov    -0x20(%rbp),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%rax
jne    1165 <hashmap_key_is_in_vector+0x55>
movl   $0x1,-0x4(%rbp)
jmp    1182 <hashmap_key_is_in_vector+0x72>
jmp    116a <hashmap_key_is_in_vector+0x5a>
mov    -0x28(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x28(%rbp)
jmp    112c <hashmap_key_is_in_vector+0x1c>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<hashmap_key_is_in_vector>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
test   %rsi,%rsi
je     114a <hashmap_key_is_in_vector+0x3a>
mov    %rdx,%r14
mov    %rsi,%r12
mov    %rdi,%r15
xor    %ebx,%ebx
nopl   0x0(%rax,%rax,1)
mov    (%r15,%rbx,8),%rdi
mov    %r14,%rsi
call   1030 <strcmp@plt>
test   %rax,%rax
je     114e <hashmap_key_is_in_vector+0x3e>
add    $0x1,%rbx
cmp    %rbx,%r12
jne    1130 <hashmap_key_is_in_vector+0x20>
xor    %eax,%eax
jmp    1153 <hashmap_key_is_in_vector+0x43>
mov    $0x1,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

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

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