#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*/ stricmp(int /*<<< orphan*/, char *);
int /*<<< orphan*/ wfile_ext(char *);
int wfile_is_archive(char *filename) {
  static char *archexts[] = {"zip", "7z", ""};
  int i;
  for (i = 0; archexts[i][0] != '\0'; i++)
    if (!stricmp(wfile_ext(filename), archexts[i]))
      return (1);
  return (0);
}


x86 assembly (clang, -O0):
<wfile_is_archive>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
movslq -0x14(%rbp),%rcx
lea    0x2f02(%rip),%rax
mov    (%rax,%rcx,8),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     1195 <wfile_is_archive+0x75>
mov    -0x10(%rbp),%rdi
call   1040 <wfile_ext@plt>
mov    %eax,%edi
movslq -0x14(%rbp),%rcx
lea    0x2edc(%rip),%rax
mov    (%rax,%rcx,8),%rsi
call   1030 <stricmp@plt>
cmp    $0x0,%eax
jne    1182 <wfile_is_archive+0x62>
movl   $0x1,-0x4(%rbp)
jmp    119c <wfile_is_archive+0x7c>
jmp    1187 <wfile_is_archive+0x67>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1133 <wfile_is_archive+0x13>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<wfile_is_archive>:
push   %rbx
mov    %rdi,%rbx
call   1040 <wfile_ext@plt>
lea    0xed0(%rip),%rsi
mov    %eax,%edi
call   1030 <stricmp@plt>
test   %eax,%eax
je     115c <wfile_is_archive+0x3c>
mov    %rbx,%rdi
call   1040 <wfile_ext@plt>
lea    0xeba(%rip),%rsi
mov    %eax,%edi
call   1030 <stricmp@plt>
mov    %eax,%ecx
xor    %eax,%eax
test   %ecx,%ecx
sete   %al
pop    %rbx
ret
mov    $0x1,%eax
pop    %rbx
ret

LLVM IR (-O0):
@wfile_is_archive.archexts = internal global [3 x i8*] [i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i32 0, i32 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i32 0, i32 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.2, i32 0, i32 0)]
@.str = [4 x i8] c"zip\00"
@.str.1 = [3 x i8] c"7z\00"
@.str.2 = [1 x i8] zeroinitializer
define i32 @wfile_is_archive(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %3
store i32 0, i32* %4
br label %5
5: ; preds = %25, %1
%6 = load i32, i32* %4
%7 = sext i32 %6 to i64
%8 = getelementptr inbounds [3 x i8*], [3 x i8*]* @wfile_is_archive.archexts, i64 0, i64 %7
%9 = load i8*, i8** %8
%10 = getelementptr inbounds i8, i8* %9, i64 0
%11 = load i8, i8* %10
%12 = sext i8 %11 to i32
%13 = icmp ne i32 %12, 0
br i1 %13, label %14, label %28
14: ; preds = %5
%15 = load i8*, i8** %3
%16 = call i32 @wfile_ext(i8* %15)
%17 = load i32, i32* %4
%18 = sext i32 %17 to i64
%19 = getelementptr inbounds [3 x i8*], [3 x i8*]* @wfile_is_archive.archexts, i64 0, i64 %18
%20 = load i8*, i8** %19
%21 = call i32 @stricmp(i32 %16, i8* %20)
%22 = icmp ne i32 %21, 0
br i1 %22, label %24, label %23
23: ; preds = %14
store i32 1, i32* %2
br label %29
24: ; preds = %14
br label %25
25: ; preds = %24
%26 = load i32, i32* %4
%27 = add nsw i32 %26, 1
store i32 %27, i32* %4
br label %5
28: ; preds = %5
store i32 0, i32* %2
br label %29
29: ; preds = %28, %23
%30 = load i32, i32* %2
ret i32 %30
}

LLVM IR (-O2):
@.str = [4 x i8] c"zip\00"
@.str.1 = [3 x i8] c"7z\00"
define i32 @wfile_is_archive(i8* %0) {
%2 = tail call i32 @wfile_ext(i8* %0)
%3 = tail call i32 @stricmp(i32 %2, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%4 = icmp eq i32 %3, 0
br i1 %4, label %10, label %5
5: ; preds = %1
%6 = tail call i32 @wfile_ext(i8* %0)
%7 = tail call i32 @stricmp(i32 %6, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%8 = icmp eq i32 %7, 0
%9 = zext i1 %8 to i32
br label %10
10: ; preds = %5, %1
%11 = phi i32 [ 1, %1 ], [ %9, %5 ]
ret i32 %11
}