#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__ seqCharMatches(char *, int, char, int *);
int matrixCharMatches(char **s, int numSeqs, int length, char c, int *filter) {
  int i;
  int matches = 0;
  for (i = 0; i < numSeqs; i++)
    matches += seqCharMatches(s[i], length, c, filter);
  return (matches);
}


x86 assembly (clang, -O0):
<matrixCharMatches>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %cl,%al
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %al,-0x11(%rbp)
mov    %r8,-0x20(%rbp)
movl   $0x0,-0x28(%rbp)
movl   $0x0,-0x24(%rbp)
mov    -0x24(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    117e <matrixCharMatches+0x6e>
mov    -0x8(%rbp),%rax
movslq -0x24(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
mov    -0x10(%rbp),%esi
mov    -0x11(%rbp),%al
mov    -0x20(%rbp),%rcx
movsbl %al,%edx
call   1030 <seqCharMatches@plt>
mov    %rax,%rcx
movslq -0x28(%rbp),%rax
add    %rcx,%rax
mov    %eax,-0x28(%rbp)
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    1139 <matrixCharMatches+0x29>
mov    -0x28(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<matrixCharMatches>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
test   %esi,%esi
jle    1160 <matrixCharMatches+0x50>
mov    %r8,%r15
mov    %edx,%r12d
mov    %rdi,%r13
mov    %esi,%eax
mov    %rax,(%rsp)
xor    %r14d,%r14d
movsbl %cl,%ebx
xor    %ebp,%ebp
cs nopw 0x0(%rax,%rax,1)
mov    0x0(%r13,%r14,8),%rdi
mov    %r12d,%esi
mov    %ebx,%edx
mov    %r15,%rcx
call   1030 <seqCharMatches@plt>
add    %eax,%ebp
add    $0x1,%r14
cmp    %r14,(%rsp)
jne    1140 <matrixCharMatches+0x30>
jmp    1162 <matrixCharMatches+0x52>
xor    %ebp,%ebp
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

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