#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__ wildcardmatch(char *, char *);
int par_check_word(int npar, char **parlist, int *flaglist, char *par) {
  int found = 0;
  for (int i = 0; i < npar; i++)
    if (wildcardmatch(parlist[i], par) == 0) {
      found = 1;
      flaglist[i] = 1;
    }
  return (found);
}


x86 assembly (clang, -O0):
<par_check_word>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
movl   $0x0,-0x24(%rbp)
movl   $0x0,-0x28(%rbp)
mov    -0x28(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    1189 <par_check_word+0x79>
mov    -0x10(%rbp),%rax
movslq -0x28(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
mov    -0x20(%rbp),%rsi
call   1030 <wildcardmatch@plt>
cmp    $0x0,%rax
jne    1176 <par_check_word+0x66>
movl   $0x1,-0x24(%rbp)
mov    -0x18(%rbp),%rax
movslq -0x28(%rbp),%rcx
movl   $0x1,(%rax,%rcx,4)
jmp    117b <par_check_word+0x6b>
mov    -0x28(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x28(%rbp)
jmp    1135 <par_check_word+0x25>
mov    -0x24(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<par_check_word>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
test   %edi,%edi
jle    116b <par_check_word+0x5b>
mov    %rcx,%r15
mov    %rdx,%r14
mov    %rsi,%r13
mov    %edi,%ebp
xor    %ebx,%ebx
xor    %r12d,%r12d
jmp    1149 <par_check_word+0x39>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
add    $0x1,%rbx
cmp    %rbx,%rbp
je     116e <par_check_word+0x5e>
mov    0x0(%r13,%rbx,8),%rdi
mov    %r15,%rsi
call   1030 <wildcardmatch@plt>
test   %rax,%rax
jne    1140 <par_check_word+0x30>
movl   $0x1,(%r14,%rbx,4)
mov    $0x1,%r12d
jmp    1140 <par_check_word+0x30>
xor    %r12d,%r12d
mov    %r12d,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

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