#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 */
typedef int /*<<< orphan*/ regex_t;

/* Variables and functions */
int regexec(int /*<<< orphan*/ const *, char *, int /*<<< orphan*/,
            int /*<<< orphan*/ *, int /*<<< orphan*/);
int /*<<< orphan*/ strcat(char *, char const *);
int carryOutInfoMatch(char *in, char *out, const char *regexStrs[][2],
                      const regex_t regexM[], int size) {
  int i = 0, reti;
  int known = 0;
  for (i = 0; i < size; i++) {
    reti = regexec(&(regexM[i]), in, 0, NULL, 0);
    if (!reti) {
      strcat(out, regexStrs[i][1]);
      known = 1;
    }
  }
  return known;
}


x86 assembly (clang, -O0):
<carryOutInfoMatch>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8d,-0x24(%rbp)
movl   $0x0,-0x28(%rbp)
movl   $0x0,-0x30(%rbp)
movl   $0x0,-0x28(%rbp)
mov    -0x28(%rbp),%eax
cmp    -0x24(%rbp),%eax
jge    11c2 <carryOutInfoMatch+0xa2>
mov    -0x20(%rbp),%rdi
movslq -0x28(%rbp),%rax
shl    $0x2,%rax
add    %rax,%rdi
mov    -0x8(%rbp),%rsi
xor    %r8d,%r8d
xor    %eax,%eax
mov    %eax,%ecx
mov    %r8d,%edx
call   1030 <regexec@plt>
mov    %eax,-0x2c(%rbp)
cmpl   $0x0,-0x2c(%rbp)
jne    11af <carryOutInfoMatch+0x8f>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rax
movslq -0x28(%rbp),%rcx
shl    $0x4,%rcx
add    %rcx,%rax
mov    0x8(%rax),%rsi
call   1040 <strcat@plt>
movl   $0x1,-0x30(%rbp)
jmp    11b4 <carryOutInfoMatch+0x94>
mov    -0x28(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x28(%rbp)
jmp    1151 <carryOutInfoMatch+0x31>
mov    -0x30(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<carryOutInfoMatch>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rdx,(%rsp)
test   %r8d,%r8d
jle    1189 <carryOutInfoMatch+0x69>
mov    %rcx,%r12
mov    %rsi,%r15
mov    %rdi,%rbx
mov    %r8d,%ebp
shl    $0x2,%rbp
xor    %r14d,%r14d
xor    %r13d,%r13d
jmp    1159 <carryOutInfoMatch+0x39>
nopl   0x0(%rax)
add    $0x4,%r14
cmp    %r14,%rbp
je     118c <carryOutInfoMatch+0x6c>
lea    (%r12,%r14,1),%rdi
mov    %rbx,%rsi
xor    %edx,%edx
xor    %ecx,%ecx
xor    %r8d,%r8d
call   1030 <regexec@plt>
test   %eax,%eax
jne    1150 <carryOutInfoMatch+0x30>
mov    (%rsp),%rax
mov    0x8(%rax,%r14,4),%rsi
mov    %r15,%rdi
call   1040 <strcat@plt>
mov    $0x1,%r13d
jmp    1150 <carryOutInfoMatch+0x30>
xor    %r13d,%r13d
mov    %r13d,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

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