#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__ ExprMatch(char *, char *);
int matchname(int arg, int argc, char **argv, char *fname) {
  if (arg == argc)
    return 1;
  while (arg < argc)
    if (ExprMatch(fname, argv[arg++]))
      return 1;
  return 0;
}


x86 assembly (clang, -O0):
<matchname>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
jne    113e <matchname+0x2e>
movl   $0x1,-0x4(%rbp)
jmp    1190 <matchname+0x80>
jmp    1143 <matchname+0x33>
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1189 <matchname+0x79>
mov    -0x20(%rbp),%rdi
mov    -0x18(%rbp),%rax
mov    -0x8(%rbp),%ecx
mov    %ecx,%edx
add    $0x1,%edx
mov    %edx,-0x8(%rbp)
movslq %ecx,%rcx
mov    (%rax,%rcx,8),%rsi
call   1030 <ExprMatch@plt>
cmp    $0x0,%rax
je     1184 <matchname+0x74>
movl   $0x1,-0x4(%rbp)
jmp    1190 <matchname+0x80>
jmp    1143 <matchname+0x33>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<matchname>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    $0x1,%r14d
cmp    %esi,%edi
je     115f <matchname+0x4f>
mov    %rcx,%r15
mov    %rdx,%r12
movslq %edi,%rbx
cmovge %edi,%esi
movslq %esi,%rbp
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
cmp    %rbx,%rbp
je     115c <matchname+0x4c>
mov    (%r12,%rbx,8),%rsi
add    $0x1,%rbx
mov    %r15,%rdi
call   1030 <ExprMatch@plt>
test   %rax,%rax
je     1140 <matchname+0x30>
jmp    115f <matchname+0x4f>
xor    %r14d,%r14d
mov    %r14d,%eax
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

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

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