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

/* Variables and functions */
int /*<<< orphan*/ *fgets(char *, int, int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, char *);
int /*<<< orphan*/ regexec(int /*<<< orphan*/ *, char *, int,
                           int /*<<< orphan*/ *, int /*<<< orphan*/);
int /*<<< orphan*/ stdin;
int pass(regex_t *reg, int exclude) {
  regmatch_t result;
  char line[1024];
  while (NULL != fgets(line, 1024, stdin))
    if (exclude != !regexec(reg, line, 1, &result, 0))
      printf("%s", line);
  return 0;
}


x86 assembly (clang, -O0):
<pass>:
push   %rbp
mov    %rsp,%rbp
sub    $0x420,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
lea    -0x410(%rbp),%rdi
mov    0x2e98(%rip),%rax
mov    (%rax),%edx
mov    $0x400,%esi
call   1040 <fgets@plt>
mov    %rax,%rcx
xor    %eax,%eax
cmp    %rcx,%rax
je     11c6 <pass+0x96>
mov    -0xc(%rbp),%eax
mov    %eax,-0x414(%rbp)
mov    -0x8(%rbp),%rdi
lea    -0x410(%rbp),%rsi
mov    $0x1,%edx
lea    -0x10(%rbp),%rcx
xor    %r8d,%r8d
call   1050 <regexec@plt>
mov    %eax,%ecx
mov    -0x414(%rbp),%eax
cmp    $0x0,%ecx
setne  %cl
xor    $0xff,%cl
and    $0x1,%cl
movzbl %cl,%ecx
cmp    %ecx,%eax
je     11c1 <pass+0x91>
lea    -0x410(%rbp),%rsi
lea    0xe44(%rip),%rdi
call   1030 <printf@plt>
jmp    1142 <pass+0x12>
xor    %eax,%eax
add    $0x420,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<pass>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x418,%rsp
mov    %esi,%r14d
mov    %rdi,%rbx
mov    0x2e9a(%rip),%r13
mov    0x0(%r13),%edx
lea    0x10(%rsp),%rdi
mov    $0x400,%esi
call   1040 <fgets@plt>
test   %rax,%rax
je     11c5 <pass+0x95>
lea    0x10(%rsp),%rbp
lea    0xc(%rsp),%r15
lea    0xe89(%rip),%r12
jmp    1196 <pass+0x66>
nopl   0x0(%rax)
mov    0x0(%r13),%edx
mov    %rbp,%rdi
mov    $0x400,%esi
call   1040 <fgets@plt>
test   %rax,%rax
je     11c5 <pass+0x95>
mov    %rbx,%rdi
mov    %rbp,%rsi
mov    $0x1,%edx
mov    %r15,%rcx
xor    %r8d,%r8d
call   1050 <regexec@plt>
xor    %ecx,%ecx
test   %eax,%eax
sete   %cl
cmp    %r14d,%ecx
je     1180 <pass+0x50>
mov    %r12,%rdi
mov    %rbp,%rsi
call   1030 <printf@plt>
jmp    1180 <pass+0x50>
xor    %eax,%eax
add    $0x418,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@stdin = global i32 0
@.str = [3 x i8] c"%s\00"
define i32 @pass(i32* %0, i32 %1) {
%3 = alloca i32*
%4 = alloca i32
%5 = alloca i32
%6 = alloca [1024 x i8]
store i32* %0, i32** %3
store i32 %1, i32* %4
br label %7
7: ; preds = %24, %2
%8 = getelementptr inbounds [1024 x i8], [1024 x i8]* %6, i64 0, i64 0
%9 = load i32, i32* @stdin
%10 = call i32* @fgets(i8* %8, i32 1024, i32 %9)
%11 = icmp ne i32* null, %10
br i1 %11, label %12, label %25
12: ; preds = %7
%13 = load i32, i32* %4
%14 = load i32*, i32** %3
%15 = getelementptr inbounds [1024 x i8], [1024 x i8]* %6, i64 0, i64 0
%16 = call i32 @regexec(i32* %14, i8* %15, i32 1, i32* %5, i32 0)
%17 = icmp ne i32 %16, 0
%18 = xor i1 %17, true
%19 = zext i1 %18 to i32
%20 = icmp ne i32 %13, %19
br i1 %20, label %21, label %24
21: ; preds = %12
%22 = getelementptr inbounds [1024 x i8], [1024 x i8]* %6, i64 0, i64 0
%23 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %22)
br label %24
24: ; preds = %21, %12
br label %7
25: ; preds = %7
ret i32 0
}

LLVM IR (-O2):
@stdin = global i32 0
@.str = [3 x i8] c"%s\00"
define i32 @pass(i32* %0, i32 %1) {
%3 = alloca i32
%4 = alloca [1024 x i8]
%5 = bitcast i32* %3 to i8*
%6 = getelementptr inbounds [1024 x i8], [1024 x i8]* %4, i64 0, i64 0
%7 = load i32, i32* @stdin
%8 = call i32* @fgets(i8* %6, i32 1024, i32 %7)
%9 = icmp eq i32* %8, null
br i1 %9, label %21, label %10
10: ; preds = %2, %17
%11 = call i32 @regexec(i32* %0, i8* %6, i32 1, i32* %3, i32 0)
%12 = icmp eq i32 %11, 0
%13 = zext i1 %12 to i32
%14 = icmp eq i32 %13, %1
br i1 %14, label %17, label %15
15: ; preds = %10
%16 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %6)
br label %17
17: ; preds = %15, %10
%18 = load i32, i32* @stdin
%19 = call i32* @fgets(i8* %6, i32 1024, i32 %18)
%20 = icmp eq i32* %19, null
br i1 %20, label %21, label %10
21: ; preds = %17, %2
ret i32 0
}