#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*/ csc_cmp_file_extname(char *, char *);
int csc_cmp_file_extlist(char *fname, char **ext) {
  int i;
  if (!ext || !*ext) {
    return -1;
  }
  for (i = 0; ext[i]; i++) {
    if (!csc_cmp_file_extname(fname, ext[i])) {
      return 0;
    }
  }
  return i;
}


x86 assembly (clang, -O0):
<csc_cmp_file_extlist>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
je     1139 <csc_cmp_file_extlist+0x29>
mov    -0x18(%rbp),%rax
cmpq   $0x0,(%rax)
jne    1145 <csc_cmp_file_extlist+0x35>
movl   $0xffffffff,-0x4(%rbp)
jmp    11a2 <csc_cmp_file_extlist+0x92>
movl   $0x0,-0x1c(%rbp)
mov    -0x18(%rbp),%rax
movslq -0x1c(%rbp),%rcx
cmpq   $0x0,(%rax,%rcx,8)
je     119c <csc_cmp_file_extlist+0x8c>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    (%rax,%rcx,8),%rsi
call   1030 <csc_cmp_file_extname@plt>
cmp    $0x0,%eax
jne    1189 <csc_cmp_file_extlist+0x79>
movl   $0x0,-0x4(%rbp)
jmp    11a2 <csc_cmp_file_extlist+0x92>
jmp    118e <csc_cmp_file_extlist+0x7e>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    114c <csc_cmp_file_extlist+0x3c>
mov    -0x1c(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<csc_cmp_file_extlist>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    $0xffffffff,%r14d
test   %rsi,%rsi
je     115d <csc_cmp_file_extlist+0x4d>
mov    %rsi,%r12
mov    (%rsi),%rsi
test   %rsi,%rsi
je     115d <csc_cmp_file_extlist+0x4d>
mov    %rdi,%r15
xor    %r14d,%r14d
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
mov    %r15,%rdi
call   1030 <csc_cmp_file_extname@plt>
test   %eax,%eax
je     115d <csc_cmp_file_extlist+0x4d>
mov    0x8(%r12,%rbx,8),%rsi
add    $0x1,%rbx
test   %rsi,%rsi
jne    1140 <csc_cmp_file_extlist+0x30>
mov    %ebx,%r14d
mov    %r14d,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define i32 @csc_cmp_file_extlist(i8* %0, i8** %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i8**
%6 = alloca i32
store i8* %0, i8** %4
store i8** %1, i8*** %5
%7 = load i8**, i8*** %5
%8 = icmp ne i8** %7, null
br i1 %8, label %9, label %13
9: ; preds = %2
%10 = load i8**, i8*** %5
%11 = load i8*, i8** %10
%12 = icmp ne i8* %11, null
br i1 %12, label %14, label %13
13: ; preds = %9, %2
store i32 -1, i32* %3
br label %38
14: ; preds = %9
store i32 0, i32* %6
br label %15
15: ; preds = %33, %14
%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 = icmp ne i8* %20, null
br i1 %21, label %22, label %36
22: ; preds = %15
%23 = load i8*, i8** %4
%24 = load i8**, i8*** %5
%25 = load i32, i32* %6
%26 = sext i32 %25 to i64
%27 = getelementptr inbounds i8*, i8** %24, i64 %26
%28 = load i8*, i8** %27
%29 = call i32 @csc_cmp_file_extname(i8* %23, i8* %28)
%30 = icmp ne i32 %29, 0
br i1 %30, label %32, label %31
31: ; preds = %22
store i32 0, i32* %3
br label %38
32: ; preds = %22
br label %33
33: ; preds = %32
%34 = load i32, i32* %6
%35 = add nsw i32 %34, 1
store i32 %35, i32* %6
br label %15
36: ; preds = %15
%37 = load i32, i32* %6
store i32 %37, i32* %3
br label %38
38: ; preds = %36, %31, %13
%39 = load i32, i32* %3
ret i32 %39
}

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