#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*/ strncmp(char const *, char *, size_t const);
int inarr(const char *str, const size_t mxl, char arr[][mxl],
          const size_t asz) {
  unsigned int a = 0;
  for (a = 0; a < asz; a++) {
    if (!strncmp(str, arr[a], mxl))
      return 0;
  }
  return 1;
}


x86 assembly (clang, -O0):
<inarr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    %rcx,-0x28(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x38(%rbp)
movl   $0x0,-0x2c(%rbp)
movl   $0x0,-0x2c(%rbp)
mov    -0x2c(%rbp),%eax
cmp    -0x28(%rbp),%rax
jae    1192 <inarr+0x82>
mov    -0x38(%rbp),%rcx
mov    -0x10(%rbp),%rdi
mov    -0x20(%rbp),%rsi
mov    -0x2c(%rbp),%eax
imul   %rcx,%rax
add    %rax,%rsi
mov    -0x18(%rbp),%rdx
call   1030 <strncmp@plt>
cmp    $0x0,%eax
jne    117f <inarr+0x6f>
movl   $0x0,-0x4(%rbp)
jmp    1199 <inarr+0x89>
jmp    1184 <inarr+0x74>
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    113e <inarr+0x2e>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<inarr>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    $0x1,%r14d
test   %rcx,%rcx
je     1166 <inarr+0x56>
mov    %rcx,%r13
mov    %rdx,%r15
mov    %rsi,%rbp
mov    %rdi,%r12
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    %rbx,%rsi
imul   %rbp,%rsi
add    %r15,%rsi
mov    %r12,%rdi
mov    %rbp,%rdx
call   1030 <strncmp@plt>
test   %eax,%eax
je     1163 <inarr+0x53>
add    $0x1,%ebx
cmp    %r13,%rbx
jb     1140 <inarr+0x30>
jmp    1166 <inarr+0x56>
xor    %r14d,%r14d
mov    %r14d,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

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