#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 /*<<< orphan*/ abort();
scalar_t__ strcmp(char const *, char *);
int getChrPosArray(char **snplist, const char *snpid) {
  char **iter = snplist;
  int counter = 0;
  while (*iter != NULL) {
    if (strcmp(snpid, *iter) == 0)
      return counter;
    iter++;
    counter++;
  }
  abort();
}


x86 assembly (clang, -O0):
<getChrPosArray>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
mov    -0x18(%rbp),%rax
cmpq   $0x0,(%rax)
je     118a <getChrPosArray+0x6a>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rax
mov    (%rax),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
jne    1170 <getChrPosArray+0x50>
mov    -0x1c(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret
mov    -0x18(%rbp),%rax
add    $0x8,%rax
mov    %rax,-0x18(%rbp)
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    113f <getChrPosArray+0x1f>
mov    $0x0,%al
call   1030 <abort@plt>

x86 assembly (clang, -O2):
<getChrPosArray>:
push   %r15
push   %r14
push   %rbx
mov    %rsi,%r14
mov    (%rdi),%rsi
test   %rsi,%rsi
je     115b <getChrPosArray+0x3b>
mov    %rdi,%r15
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nop
mov    %r14,%rdi
call   1040 <strcmp@plt>
test   %rax,%rax
je     1162 <getChrPosArray+0x42>
mov    0x8(%r15,%rbx,8),%rsi
add    $0x1,%rbx
test   %rsi,%rsi
jne    1140 <getChrPosArray+0x20>
xor    %eax,%eax
call   1030 <abort@plt>
mov    %ebx,%eax
pop    %rbx
pop    %r14
pop    %r15
ret

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

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