#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 */
int find_table(char *, int, int);
int /*<<< orphan*/ print_table_header(char *);
int /*<<< orphan*/ table_exclude(char *, char *);
scalar_t__ table_include(char *, char *);
void filter_db_dump(char *include_regexp, char *exclude_regexp) {
  char table_name[255];
  int show = 1;
  for (;;) {
    if (find_table(table_name, 255, show) == 2) {
      if (table_include(table_name, include_regexp) &&
          !table_exclude(table_name, exclude_regexp)) {
        print_table_header(table_name);
        show = 1;
      } else
        show = 0;
    } else
      break;
  }
}


x86 assembly (clang, -O0):
<filter_db_dump>:
push   %rbp
mov    %rsp,%rbp
sub    $0x120,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x1,-0x114(%rbp)
lea    -0x110(%rbp),%rdi
mov    -0x114(%rbp),%edx
mov    $0xff,%esi
call   1050 <find_table@plt>
cmp    $0x2,%eax
jne    11da <filter_db_dump+0x9a>
lea    -0x110(%rbp),%rdi
mov    -0x8(%rbp),%rsi
call   1040 <table_include@plt>
cmp    $0x0,%rax
je     11cb <filter_db_dump+0x8b>
lea    -0x110(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1030 <table_exclude@plt>
cmp    $0x0,%eax
jne    11cb <filter_db_dump+0x8b>
lea    -0x110(%rbp),%rdi
call   1060 <print_table_header@plt>
movl   $0x1,-0x114(%rbp)
jmp    11d5 <filter_db_dump+0x95>
movl   $0x0,-0x114(%rbp)
jmp    11df <filter_db_dump+0x9f>
jmp    11e4 <filter_db_dump+0xa4>
jmp    115d <filter_db_dump+0x1d>
add    $0x120,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<filter_db_dump>:
push   %rbp
push   %r15
push   %r14
push   %rbx
sub    $0x108,%rsp
mov    %rsi,%r14
mov    %rdi,%r15
mov    %rsp,%rdi
mov    $0xff,%esi
mov    $0x1,%edx
call   1050 <find_table@plt>
cmp    $0x2,%eax
jne    11b4 <filter_db_dump+0x74>
mov    %rsp,%rbx
jmp    1184 <filter_db_dump+0x44>
nop
mov    %rbx,%rdi
mov    $0xff,%esi
mov    %ebp,%edx
call   1050 <find_table@plt>
cmp    $0x2,%eax
jne    11b4 <filter_db_dump+0x74>
mov    %rbx,%rdi
mov    %r15,%rsi
call   1040 <table_include@plt>
xor    %ebp,%ebp
test   %rax,%rax
je     1170 <filter_db_dump+0x30>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1030 <table_exclude@plt>
test   %eax,%eax
jne    1170 <filter_db_dump+0x30>
mov    %rbx,%rdi
call   1060 <print_table_header@plt>
mov    $0x1,%ebp
jmp    1170 <filter_db_dump+0x30>
add    $0x108,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @filter_db_dump(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca [255 x i8]
%6 = alloca i32
store i8* %0, i8** %3
store i8* %1, i8** %4
store i32 1, i32* %6
br label %7
7: ; preds = %28, %2
%8 = getelementptr inbounds [255 x i8], [255 x i8]* %5, i64 0, i64 0
%9 = load i32, i32* %6
%10 = call i32 @find_table(i8* %8, i32 255, i32 %9)
%11 = icmp eq i32 %10, 2
br i1 %11, label %12, label %27
12: ; preds = %7
%13 = getelementptr inbounds [255 x i8], [255 x i8]* %5, i64 0, i64 0
%14 = load i8*, i8** %3
%15 = call i64 @table_include(i8* %13, i8* %14)
%16 = icmp ne i64 %15, 0
br i1 %16, label %17, label %25
17: ; preds = %12
%18 = getelementptr inbounds [255 x i8], [255 x i8]* %5, i64 0, i64 0
%19 = load i8*, i8** %4
%20 = call i32 @table_exclude(i8* %18, i8* %19)
%21 = icmp ne i32 %20, 0
br i1 %21, label %25, label %22
22: ; preds = %17
%23 = getelementptr inbounds [255 x i8], [255 x i8]* %5, i64 0, i64 0
%24 = call i32 @print_table_header(i8* %23)
store i32 1, i32* %6
br label %26
25: ; preds = %17, %12
store i32 0, i32* %6
br label %26
26: ; preds = %25, %22
br label %28
27: ; preds = %7
br label %29
28: ; preds = %26
br label %7
29: ; preds = %27
ret void
}

LLVM IR (-O2):
define void @filter_db_dump(i8* %0, i8* %1) {
%3 = alloca [255 x i8]
%4 = getelementptr inbounds [255 x i8], [255 x i8]* %3, i64 0, i64 0
%5 = call i32 @find_table(i8* %4, i32 255, i32 1)
%6 = icmp eq i32 %5, 2
br i1 %6, label %7, label %19
7: ; preds = %2, %15
%8 = call i64 @table_include(i8* %4, i8* %0)
%9 = icmp eq i64 %8, 0
br i1 %9, label %15, label %10
10: ; preds = %7
%11 = call i32 @table_exclude(i8* %4, i8* %1)
%12 = icmp eq i32 %11, 0
br i1 %12, label %13, label %15
13: ; preds = %10
%14 = call i32 @print_table_header(i8* %4)
br label %15
15: ; preds = %7, %10, %13
%16 = phi i32 [ 1, %13 ], [ 0, %10 ], [ 0, %7 ]
%17 = call i32 @find_table(i8* %4, i32 255, i32 %16)
%18 = icmp eq i32 %17, 2
br i1 %18, label %7, label %19
19: ; preds = %15, %2
ret void
}