#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 */
scalar_t__ shellpattern_match(char const *, char const *, short);
short int shellpattern_match_any(const char *string, const char *pattern[],
                                 short int casess) {
  int i = -1;
  while (pattern[++i]) {
    if (shellpattern_match(string, pattern[i], casess))
      return (1);
  }
  return (0);
}


x86 assembly (clang, -O0):
<shellpattern_match_any>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %dx,%ax
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %ax,-0x1a(%rbp)
movl   $0xffffffff,-0x20(%rbp)
mov    -0x18(%rbp),%rax
mov    -0x20(%rbp),%ecx
add    $0x1,%ecx
mov    %ecx,-0x20(%rbp)
movslq %ecx,%rcx
cmpq   $0x0,(%rax,%rcx,8)
je     117c <shellpattern_match_any+0x6c>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rax
movslq -0x20(%rbp),%rcx
mov    (%rax,%rcx,8),%rsi
movswl -0x1a(%rbp),%edx
call   1030 <shellpattern_match@plt>
cmp    $0x0,%rax
je     1177 <shellpattern_match_any+0x67>
movw   $0x1,-0x2(%rbp)
jmp    1182 <shellpattern_match_any+0x72>
jmp    112e <shellpattern_match_any+0x1e>
movw   $0x0,-0x2(%rbp)
movswl -0x2(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<shellpattern_match_any>:
push   %rbp
push   %r14
push   %rbx
mov    %rsi,%rbx
mov    %rdi,%r14
movswl %dx,%ebp
nopl   (%rax)
mov    (%rbx),%rsi
test   %rsi,%rsi
je     1141 <shellpattern_match_any+0x31>
mov    %r14,%rdi
mov    %ebp,%edx
call   1030 <shellpattern_match@plt>
add    $0x8,%rbx
test   %rax,%rax
je     1120 <shellpattern_match_any+0x10>
mov    $0x1,%ax
jmp    1143 <shellpattern_match_any+0x33>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

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

LLVM IR (-O2):
define signext i16 @shellpattern_match_any(i8* %0, i8** nocapture %1, i16 signext %2) {
br label %4
4: ; preds = %10, %3
%5 = phi i64 [ %6, %10 ], [ -1, %3 ]
%6 = add nsw i64 %5, 1
%7 = getelementptr inbounds i8*, i8** %1, i64 %6
%8 = load i8*, i8** %7
%9 = icmp eq i8* %8, null
br i1 %9, label %13, label %10
10: ; preds = %4
%11 = tail call i64 @shellpattern_match(i8* %0, i8* %8, i16 signext %2)
%12 = icmp eq i64 %11, 0
br i1 %12, label %4, label %13
13: ; preds = %4, %10
%14 = phi i16 [ 1, %10 ], [ 0, %4 ]
ret i16 %14
}