#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 /*<<< orphan*/ addvariable(char *);
int /*<<< orphan*/ assert(int /*<<< orphan*/);
int /*<<< orphan*/ *fgets(char *, int, int /*<<< orphan*/);
int /*<<< orphan*/ init_keywords();
scalar_t__ isspace(char);
scalar_t__ matchline(char *);
int /*<<< orphan*/ parseline(char *);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ stdin;
int /*<<< orphan*/ *strchr(char *, char);
scalar_t__ strncmp(char *, char *, int);
int /*<<< orphan*/ strncpy(char *, char *, int);
int main(int argc, char **argv) {
  char buf[8192], *p, *q, buf2[8192];
  int i, n = 0;
  init_keywords();
  if (argc < 2) {
    printf("Usage: cat file | prune <varname>\n");
    return 0;
  }
  addvariable(argv[1]);
  while (fgets(buf, sizeof buf, stdin) != NULL) {
    p = buf;
    while (isspace(*p))
      p++;
    if (*p == '\0' || strncmp(p, "XXX", 3) == 0) {
      continue;
    }
    assert(strchr(p, '\n') != NULL);
    strncpy(buf2, p, 8192);
    q = buf2;
    if (matchline(p)) {
      printf("%s", q);
      parseline(q);
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x4030,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x4028(%rbp)
mov    $0x0,%al
call   1050 <init_keywords@plt>
cmpl   $0x2,-0x8(%rbp)
jge    11fe <main+0x4e>
lea    0xe15(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    1332 <main+0x182>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   10d0 <addvariable@plt>
lea    -0x2010(%rbp),%rdi
mov    0x2dcf(%rip),%rax
mov    (%rax),%edx
mov    $0x2000,%esi
call   10a0 <fgets@plt>
cmp    $0x0,%rax
je     132b <main+0x17b>
lea    -0x2010(%rbp),%rax
mov    %rax,-0x2018(%rbp)
mov    -0x2018(%rbp),%rax
movsbl (%rax),%edi
call   1090 <isspace@plt>
cmp    $0x0,%rax
je     126d <main+0xbd>
mov    -0x2018(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x2018(%rbp)
jmp    123d <main+0x8d>
mov    -0x2018(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     12a2 <main+0xf2>
mov    -0x2018(%rbp),%rdi
lea    0xd95(%rip),%rsi
mov    $0x3,%edx
call   1040 <strncmp@plt>
cmp    $0x0,%rax
jne    12a7 <main+0xf7>
jmp    120b <main+0x5b>
mov    -0x2018(%rbp),%rdi
mov    $0xa,%esi
call   1060 <strchr@plt>
cmp    $0x0,%rax
setne  %al
and    $0x1,%al
movzbl %al,%edi
call   10c0 <assert@plt>
lea    -0x4020(%rbp),%rdi
mov    -0x2018(%rbp),%rsi
mov    $0x2000,%edx
call   1030 <strncpy@plt>
lea    -0x4020(%rbp),%rax
mov    %rax,-0x2020(%rbp)
mov    -0x2018(%rbp),%rdi
call   10b0 <matchline@plt>
cmp    $0x0,%rax
je     1326 <main+0x176>
mov    -0x2020(%rbp),%rsi
lea    0xd14(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
mov    -0x2020(%rbp),%rdi
call   1080 <parseline@plt>
jmp    120b <main+0x5b>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x4030,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x4008,%rsp
mov    %rsi,%rbx
mov    %edi,%ebp
xor    %eax,%eax
call   1050 <init_keywords@plt>
cmp    $0x1,%ebp
jg     11f3 <main+0x33>
lea    0xe1e(%rip),%rdi
call   1060 <puts@plt>
jmp    12e0 <main+0x120>
mov    0x8(%rbx),%rdi
call   10e0 <addvariable@plt>
mov    0x2de5(%rip),%rbp
mov    0x0(%rbp),%edx
lea    0x2000(%rsp),%r13
mov    %r13,%rdi
mov    $0x2000,%esi
call   10b0 <fgets@plt>
test   %rax,%rax
je     12e0 <main+0x120>
lea    0xdd5(%rip),%r14
mov    %rsp,%r15
lea    0xdcf(%rip),%r12
mov    %r13,%rcx
jmp    125c <main+0x9c>
nopw   0x0(%rax,%rax,1)
mov    0x0(%rbp),%edx
mov    %r13,%rdi
mov    $0x2000,%esi
call   10b0 <fgets@plt>
mov    %r13,%rcx
test   %rax,%rax
je     12e0 <main+0x120>
mov    %rcx,%rbx
movsbl (%rcx),%edi
call   10a0 <isspace@plt>
lea    0x1(%rbx),%rcx
test   %rax,%rax
jne    125c <main+0x9c>
cmpb   $0x0,(%rbx)
je     1240 <main+0x80>
mov    %rbx,%rdi
mov    %r14,%rsi
mov    $0x3,%edx
call   1040 <strncmp@plt>
test   %rax,%rax
je     1240 <main+0x80>
mov    %rbx,%rdi
mov    $0xa,%esi
call   1070 <strchr@plt>
xor    %edi,%edi
test   %rax,%rax
setne  %dil
call   10d0 <assert@plt>
mov    %r15,%rdi
mov    %rbx,%rsi
mov    $0x2000,%edx
call   1030 <strncpy@plt>
mov    %rbx,%rdi
call   10c0 <matchline@plt>
test   %rax,%rax
je     1240 <main+0x80>
mov    %r12,%rdi
mov    %r15,%rsi
xor    %eax,%eax
call   1080 <printf@plt>
mov    %r15,%rdi
call   1090 <parseline@plt>
jmp    1240 <main+0x80>
xor    %eax,%eax
add    $0x4008,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [35 x i8] c"Usage: cat file | prune <varname>\0A\00"
@stdin = global i32 0
@.str.1 = [4 x i8] c"XXX\00"
@.str.2 = [3 x i8] c"%s\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [8192 x i8]
%7 = alloca i8*
%8 = alloca i8*
%9 = alloca [8192 x i8]
%10 = alloca i32
%11 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %11
%12 = call i32 (...) @init_keywords()
%13 = load i32, i32* %4
%14 = icmp slt i32 %13, 2
br i1 %14, label %15, label %17
15: ; preds = %2
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i64 0, i64 0))
store i32 0, i32* %3
br label %67
17: ; preds = %2
%18 = load i8**, i8*** %5
%19 = getelementptr inbounds i8*, i8** %18, i64 1
%20 = load i8*, i8** %19
%21 = call i32 @addvariable(i8* %20)
br label %22
22: ; preds = %65, %46, %17
%23 = getelementptr inbounds [8192 x i8], [8192 x i8]* %6, i64 0, i64 0
%24 = load i32, i32* @stdin
%25 = call i32* @fgets(i8* %23, i32 8192, i32 %24)
%26 = icmp ne i32* %25, null
br i1 %26, label %27, label %66
27: ; preds = %22
%28 = getelementptr inbounds [8192 x i8], [8192 x i8]* %6, i64 0, i64 0
store i8* %28, i8** %7
br label %29
29: ; preds = %34, %27
%30 = load i8*, i8** %7
%31 = load i8, i8* %30
%32 = call i64 @isspace(i8 signext %31)
%33 = icmp ne i64 %32, 0
br i1 %33, label %34, label %37
34: ; preds = %29
%35 = load i8*, i8** %7
%36 = getelementptr inbounds i8, i8* %35, i32 1
store i8* %36, i8** %7
br label %29
37: ; preds = %29
%38 = load i8*, i8** %7
%39 = load i8, i8* %38
%40 = sext i8 %39 to i32
%41 = icmp eq i32 %40, 0
br i1 %41, label %46, label %42
42: ; preds = %37
%43 = load i8*, i8** %7
%44 = call i64 @strncmp(i8* %43, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 3)
%45 = icmp eq i64 %44, 0
br i1 %45, label %46, label %47
46: ; preds = %42, %37
br label %22
47: ; preds = %42
%48 = load i8*, i8** %7
%49 = call i32* @strchr(i8* %48, i8 signext 10)
%50 = icmp ne i32* %49, null
%51 = zext i1 %50 to i32
%52 = call i32 @assert(i32 %51)
%53 = getelementptr inbounds [8192 x i8], [8192 x i8]* %9, i64 0, i64 0
%54 = load i8*, i8** %7
%55 = call i32 @strncpy(i8* %53, i8* %54, i32 8192)
%56 = getelementptr inbounds [8192 x i8], [8192 x i8]* %9, i64 0, i64 0
store i8* %56, i8** %8
%57 = load i8*, i8** %7
%58 = call i64 @matchline(i8* %57)
%59 = icmp ne i64 %58, 0
br i1 %59, label %60, label %65
60: ; preds = %47
%61 = load i8*, i8** %8
%62 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8* %61)
%63 = load i8*, i8** %8
%64 = call i32 @parseline(i8* %63)
br label %65
65: ; preds = %60, %47
br label %22
66: ; preds = %22
store i32 0, i32* %3
br label %67
67: ; preds = %66, %15
%68 = load i32, i32* %3
ret i32 %68
}

LLVM IR (-O2):
@stdin = global i32 0
@.str.1 = [4 x i8] c"XXX\00"
@.str.2 = [3 x i8] c"%s\00"
@str = [34 x i8] c"Usage: cat file | prune <varname>\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca [8192 x i8]
%4 = alloca [8192 x i8]
%5 = getelementptr inbounds [8192 x i8], [8192 x i8]* %3, i64 0, i64 0
%6 = getelementptr inbounds [8192 x i8], [8192 x i8]* %4, i64 0, i64 0
%7 = tail call i32 (...) @init_keywords()
%8 = icmp slt i32 %0, 2
br i1 %8, label %9, label %11
9: ; preds = %2
%10 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @str, i64 0, i64 0))
br label %47
11: ; preds = %2
%12 = getelementptr inbounds i8*, i8** %1, i64 1
%13 = load i8*, i8** %12
%14 = tail call i32 @addvariable(i8* %13)
%15 = load i32, i32* @stdin
%16 = call i32* @fgets(i8* %5, i32 8192, i32 %15)
%17 = icmp eq i32* %16, null
br i1 %17, label %47, label %18
18: ; preds = %11, %24
%19 = phi i8* [ %25, %24 ], [ %5, %11 ]
%20 = load i8, i8* %19
%21 = call i64 @isspace(i8 signext %20)
%22 = icmp eq i64 %21, 0
%23 = getelementptr inbounds i8, i8* %19, i64 1
br i1 %22, label %26, label %24
24: ; preds = %18, %32
%25 = phi i8* [ %23, %18 ], [ %5, %32 ]
br label %18
26: ; preds = %18
%27 = load i8, i8* %19
%28 = icmp eq i8 %27, 0
br i1 %28, label %32, label %29
29: ; preds = %26
%30 = call i64 @strncmp(i8* %19, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 3)
%31 = icmp eq i64 %30, 0
br i1 %31, label %32, label %36
32: ; preds = %36, %44, %26, %29
%33 = load i32, i32* @stdin
%34 = call i32* @fgets(i8* %5, i32 8192, i32 %33)
%35 = icmp eq i32* %34, null
br i1 %35, label %47, label %24
36: ; preds = %29
%37 = call i32* @strchr(i8* %19, i8 signext 10)
%38 = icmp ne i32* %37, null
%39 = zext i1 %38 to i32
%40 = call i32 @assert(i32 %39)
%41 = call i32 @strncpy(i8* %6, i8* %19, i32 8192)
%42 = call i64 @matchline(i8* %19)
%43 = icmp eq i64 %42, 0
br i1 %43, label %32, label %44
44: ; preds = %36
%45 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8* %6)
%46 = call i32 @parseline(i8* %6)
br label %32
47: ; preds = %32, %11, %9
ret i32 0
}