#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*/ extract_file_extension(char const *, char *);
scalar_t__ strcmp(char *, char const *);
int check_path_against_extension_list(const char *path, const char *list_ext[],
                                      size_t list_count) {
  int i;
  char ext[32];
  extract_file_extension(path, ext);
  if (ext[0] == '\0')
    return 0;
  for (i = 0; i < list_count; i++)
    if (strcmp(ext, list_ext[i]) == 0)
      return 1;
  return 0;
}


x86 assembly (clang, -O0):
<check_path_against_extension_list>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    -0x10(%rbp),%rdi
lea    -0x50(%rbp),%rsi
call   1040 <extract_file_extension@plt>
movsbl -0x50(%rbp),%eax
cmp    $0x0,%eax
jne    115a <check_path_against_extension_list+0x3a>
movl   $0x0,-0x4(%rbp)
jmp    11b4 <check_path_against_extension_list+0x94>
movl   $0x0,-0x24(%rbp)
movslq -0x24(%rbp),%rax
cmp    -0x20(%rbp),%rax
jae    11ad <check_path_against_extension_list+0x8d>
lea    -0x50(%rbp),%rdi
mov    -0x18(%rbp),%rax
movslq -0x24(%rbp),%rcx
mov    (%rax,%rcx,8),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%rax
jne    119a <check_path_against_extension_list+0x7a>
movl   $0x1,-0x4(%rbp)
jmp    11b4 <check_path_against_extension_list+0x94>
jmp    119f <check_path_against_extension_list+0x7f>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    1161 <check_path_against_extension_list+0x41>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<check_path_against_extension_list>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x28,%rsp
mov    %rdx,%r12
mov    %rsi,%r14
mov    %rsp,%rsi
call   1040 <extract_file_extension@plt>
xor    %eax,%eax
cmpb   $0x0,(%rsp)
je     1173 <check_path_against_extension_list+0x53>
test   %r12,%r12
je     1173 <check_path_against_extension_list+0x53>
xor    %ebx,%ebx
mov    %rsp,%r15
nopl   0x0(%rax,%rax,1)
mov    (%r14,%rbx,8),%rsi
mov    %r15,%rdi
call   1030 <strcmp@plt>
test   %rax,%rax
je     116e <check_path_against_extension_list+0x4e>
add    $0x1,%rbx
cmp    %rbx,%r12
jne    1150 <check_path_against_extension_list+0x30>
xor    %eax,%eax
jmp    1173 <check_path_against_extension_list+0x53>
mov    $0x1,%eax
add    $0x28,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define i32 @check_path_against_extension_list(i8* %0, i8** %1, i64 %2) {
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i8**
%7 = alloca i64
%8 = alloca i32
%9 = alloca [32 x i8]
store i8* %0, i8** %5
store i8** %1, i8*** %6
store i64 %2, i64* %7
%10 = load i8*, i8** %5
%11 = getelementptr inbounds [32 x i8], [32 x i8]* %9, i64 0, i64 0
%12 = call i32 @extract_file_extension(i8* %10, i8* %11)
%13 = getelementptr inbounds [32 x i8], [32 x i8]* %9, i64 0, i64 0
%14 = load i8, i8* %13
%15 = sext i8 %14 to i32
%16 = icmp eq i32 %15, 0
br i1 %16, label %17, label %18
17: ; preds = %3
store i32 0, i32* %4
br label %39
18: ; preds = %3
store i32 0, i32* %8
br label %19
19: ; preds = %35, %18
%20 = load i32, i32* %8
%21 = sext i32 %20 to i64
%22 = load i64, i64* %7
%23 = icmp ult i64 %21, %22
br i1 %23, label %24, label %38
24: ; preds = %19
%25 = getelementptr inbounds [32 x i8], [32 x i8]* %9, i64 0, i64 0
%26 = load i8**, i8*** %6
%27 = load i32, i32* %8
%28 = sext i32 %27 to i64
%29 = getelementptr inbounds i8*, i8** %26, i64 %28
%30 = load i8*, i8** %29
%31 = call i64 @strcmp(i8* %25, i8* %30)
%32 = icmp eq i64 %31, 0
br i1 %32, label %33, label %34
33: ; preds = %24
store i32 1, i32* %4
br label %39
34: ; preds = %24
br label %35
35: ; preds = %34
%36 = load i32, i32* %8
%37 = add nsw i32 %36, 1
store i32 %37, i32* %8
br label %19
38: ; preds = %19
store i32 0, i32* %4
br label %39
39: ; preds = %38, %33, %17
%40 = load i32, i32* %4
ret i32 %40
}

LLVM IR (-O2):
define i32 @check_path_against_extension_list(i8* %0, i8** nocapture %1, i64 %2) {
%4 = alloca [32 x i8]
%5 = getelementptr inbounds [32 x i8], [32 x i8]* %4, i64 0, i64 0
%6 = call i32 @extract_file_extension(i8* %0, i8* %5)
%7 = load i8, i8* %5
%8 = icmp ne i8 %7, 0
%9 = icmp ne i64 %2, 0
%10 = and i1 %8, %9
br i1 %10, label %13, label %20
11: ; preds = %13
%12 = icmp eq i64 %19, %2
br i1 %12, label %20, label %13
13: ; preds = %3, %11
%14 = phi i64 [ %19, %11 ], [ 0, %3 ]
%15 = getelementptr inbounds i8*, i8** %1, i64 %14
%16 = load i8*, i8** %15
%17 = call i64 @strcmp(i8* %5, i8* %16)
%18 = icmp eq i64 %17, 0
%19 = add nuw i64 %14, 1
br i1 %18, label %20, label %11
20: ; preds = %13, %11, %3
%21 = phi i32 [ 0, %3 ], [ 1, %13 ], [ 0, %11 ]
ret i32 %21
}