#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 strlen(char *);
scalar_t__ strncasecmp(char *, char *, int);
int is_unique(char *name, char **as, char **ae) {
  char **ap;
  int n;
  n = strlen(name) + 1;
  for (ap = as; ap < ae; ap++)
    if (strncasecmp(*ap, name, n) == 0)
      return (0);
  return (1);
}


x86 assembly (clang, -O0):
<is_unique>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <strlen@plt>
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rax
cmp    -0x20(%rbp),%rax
jae    1198 <is_unique+0x78>
mov    -0x28(%rbp),%rax
mov    (%rax),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x2c(%rbp),%edx
call   1040 <strncasecmp@plt>
cmp    $0x0,%rax
jne    1182 <is_unique+0x62>
movl   $0x0,-0x4(%rbp)
jmp    119f <is_unique+0x7f>
jmp    1187 <is_unique+0x67>
mov    -0x28(%rbp),%rax
add    $0x8,%rax
mov    %rax,-0x28(%rbp)
jmp    114b <is_unique+0x2b>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<is_unique>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %rdx,%r15
mov    %rsi,%rbp
mov    %rdi,%r12
call   1030 <strlen@plt>
mov    $0x1,%r14d
cmp    %r15,%rbp
jae    1171 <is_unique+0x51>
mov    %eax,%ebx
add    $0x1,%ebx
cs nopw 0x0(%rax,%rax,1)
mov    0x0(%rbp),%rdi
mov    %r12,%rsi
mov    %ebx,%edx
call   1040 <strncasecmp@plt>
test   %rax,%rax
je     116e <is_unique+0x4e>
add    $0x8,%rbp
cmp    %r15,%rbp
jb     1150 <is_unique+0x30>
jmp    1171 <is_unique+0x51>
xor    %r14d,%r14d
mov    %r14d,%eax
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

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

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