#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 */
struct fact_table {
  int dummy;
};
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ EXIT_FAILURE;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
scalar_t__ fgets(char *, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
struct fact_table *read_fact(struct fact_table *, char *);
int /*<<< orphan*/ stderr;
int strlen(char *);
char *strstr(char *, char *);
struct fact_table *read_output() {
  char s[4096], *tmp;
  FILE *f = fopen("clips.out", "r");
  struct fact_table *ft = NULL;
  if (!f) {
    fprintf(stderr, "Cannot open CLIPS output");
    exit(EXIT_FAILURE);
  }
  fgets(s, 4096, f);
  while (fgets(s, 4096, f)) {
    int l = strlen(s);
    if (s[l - 1] != '\n' && l >= 4096 - 5) {
      fprintf(stderr, "Line too long. Skipped\n");
      continue;
    }
    s[l - 1] = 0;
    if (strstr(s, "FALSE"))
      goto out;
    if (strstr(s, "STOP_RUN"))
      break;
  }
  while (fgets(s, 4096, f)) {
    int l = strlen(s);
    if (s[l - 1] != '\n' && l >= 4096 - 5) {
      fprintf(stderr, "Line too long. Skipped\n");
      continue;
    }
    s[l - 1] = 0;
    tmp = s;
    while (strstr(tmp, "CLIPS>") == tmp) {
      tmp += strlen("CLIPS>");
      if (tmp[0] == ' ')
        tmp++;
    }
    if (strstr(tmp, "CLIPS>")) {
      fprintf(stderr, "Malformed line. skipped\n");
      continue;
    }
    if (strstr(tmp, "For a total of"))
      break;
    if (strlen(tmp) == 0)
      continue;
    ft = read_fact(ft, tmp);
    if (!ft)
      goto out;
  }
out:
  fclose(f);
  return ft;
}


x86 assembly (clang, -O0):
<read_output>:
push   %rbp
mov    %rsp,%rbp
sub    $0x1020,%rsp
lea    0xe6e(%rip),%rdi
lea    0xe71(%rip),%rsi
call   1070 <fopen@plt>
mov    %rax,-0x1010(%rbp)
movq   $0x0,-0x1018(%rbp)
cmpq   $0x0,-0x1010(%rbp)
jne    11e1 <read_output+0x61>
mov    0x2e1b(%rip),%rax
mov    (%rax),%edi
lea    0xe3e(%rip),%rsi
call   1060 <fprintf@plt>
mov    0x2dfe(%rip),%rax
mov    (%rax),%edi
call   1080 <exit@plt>
lea    -0x1000(%rbp),%rdi
mov    -0x1010(%rbp),%rdx
mov    $0x1000,%esi
call   1050 <fgets@plt>
lea    -0x1000(%rbp),%rdi
mov    -0x1010(%rbp),%rdx
mov    $0x1000,%esi
call   1050 <fgets@plt>
cmp    $0x0,%rax
je     12cf <read_output+0x14f>
lea    -0x1000(%rbp),%rdi
call   1040 <strlen@plt>
mov    %eax,-0x101c(%rbp)
mov    -0x101c(%rbp),%eax
sub    $0x1,%eax
cltq
movsbl -0x1000(%rbp,%rax,1),%eax
ff
cmp    $0xa,%eax
je     1273 <read_output+0xf3>
cmpl   $0xffb,-0x101c(%rbp)
jl     1273 <read_output+0xf3>
mov    0x2d80(%rip),%rax
mov    (%rax),%edi
lea    0xdbc(%rip),%rsi
call   1060 <fprintf@plt>
jmp    11f9 <read_output+0x79>
mov    -0x101c(%rbp),%eax
sub    $0x1,%eax
cltq
movb   $0x0,-0x1000(%rbp,%rax,1)
lea    -0x1000(%rbp),%rdi
lea    0xda9(%rip),%rsi
call   1090 <strstr@plt>
cmp    $0x0,%rax
je     12a8 <read_output+0x128>
jmp    1485 <read_output+0x305>
lea    -0x1000(%rbp),%rdi
lea    0xd8d(%rip),%rsi
call   1090 <strstr@plt>
cmp    $0x0,%rax
je     12ca <read_output+0x14a>
jmp    12cf <read_output+0x14f>
jmp    11f9 <read_output+0x79>
jmp    12d4 <read_output+0x154>
lea    -0x1000(%rbp),%rdi
mov    -0x1010(%rbp),%rdx
mov    $0x1000,%esi
call   1050 <fgets@plt>
cmp    $0x0,%rax
je     1480 <read_output+0x300>
lea    -0x1000(%rbp),%rdi
call   1040 <strlen@plt>
mov    %eax,-0x1020(%rbp)
mov    -0x1020(%rbp),%eax
sub    $0x1,%eax
cltq
movsbl -0x1000(%rbp,%rax,1),%eax
ff
cmp    $0xa,%eax
je     134e <read_output+0x1ce>
cmpl   $0xffb,-0x1020(%rbp)
jl     134e <read_output+0x1ce>
mov    0x2ca5(%rip),%rax
mov    (%rax),%edi
lea    0xce1(%rip),%rsi
call   1060 <fprintf@plt>
jmp    12d4 <read_output+0x154>
mov    -0x1020(%rbp),%eax
sub    $0x1,%eax
cltq
movb   $0x0,-0x1000(%rbp,%rax,1)
lea    -0x1000(%rbp),%rax
mov    %rax,-0x1008(%rbp)
mov    -0x1008(%rbp),%rdi
lea    0xccf(%rip),%rsi
call   1090 <strstr@plt>
cmp    -0x1008(%rbp),%rax
jne    13db <read_output+0x25b>
lea    0xcb6(%rip),%rdi
call   1040 <strlen@plt>
mov    %eax,%ecx
mov    -0x1008(%rbp),%rax
movslq %ecx,%rcx
add    %rcx,%rax
mov    %rax,-0x1008(%rbp)
mov    -0x1008(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x20,%eax
jne    13d6 <read_output+0x256>
mov    -0x1008(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x1008(%rbp)
jmp    136f <read_output+0x1ef>
mov    -0x1008(%rbp),%rdi
lea    0xc63(%rip),%rsi
call   1090 <strstr@plt>
cmp    $0x0,%rax
je     1412 <read_output+0x292>
mov    0x2be1(%rip),%rax
mov    (%rax),%edi
lea    0xc4b(%rip),%rsi
call   1060 <fprintf@plt>
jmp    12d4 <read_output+0x154>
mov    -0x1008(%rbp),%rdi
lea    0xc4c(%rip),%rsi
call   1090 <strstr@plt>
cmp    $0x0,%rax
je     1434 <read_output+0x2b4>
jmp    1480 <read_output+0x300>
mov    -0x1008(%rbp),%rdi
call   1040 <strlen@plt>
cmp    $0x0,%eax
jne    144e <read_output+0x2ce>
jmp    12d4 <read_output+0x154>
mov    -0x1018(%rbp),%rdi
mov    -0x1008(%rbp),%rsi
call   10a0 <read_fact@plt>
mov    %rax,-0x1018(%rbp)
cmpq   $0x0,-0x1018(%rbp)
jne    147b <read_output+0x2fb>
jmp    1485 <read_output+0x305>
jmp    12d4 <read_output+0x154>
jmp    1485 <read_output+0x305>
mov    -0x1010(%rbp),%rdi
call   1030 <fclose@plt>
mov    -0x1018(%rbp),%rax
add    $0x1020,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<read_output>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x1008,%rsp
lea    0xe68(%rip),%rdi
lea    0xe6b(%rip),%rsi
call   1070 <fopen@plt>
test   %rax,%rax
je     1399 <read_output+0x219>
mov    %rax,%r15
mov    %rsp,%rbx
mov    %rbx,%rdi
mov    $0x1000,%esi
mov    %rax,%rdx
call   1050 <fgets@plt>
mov    %rbx,%rdi
mov    $0x1000,%esi
mov    %r15,%rdx
call   1050 <fgets@plt>
test   %rax,%rax
je     1268 <read_output+0xe8>
lea    0xe42(%rip),%r12
lea    0xe53(%rip),%rbp
xor    %r14d,%r14d
lea    0xe4f(%rip),%r13
jmp    1226 <read_output+0xa6>
cs nopw 0x0(%rax,%rax,1)
mov    0x2dd9(%rip),%rax
mov    (%rax),%edi
mov    %r12,%rsi
call   1060 <fprintf@plt>
mov    %rbx,%rdi
mov    $0x1000,%esi
mov    %r15,%rdx
call   1050 <fgets@plt>
test   %rax,%rax
je     1268 <read_output+0xe8>
mov    %rbx,%rdi
call   1040 <strlen@plt>
movslq %eax,%rcx
cmpb   $0xa,-0x1(%rcx,%rbx,1)
je     123f <read_output+0xbf>
cmp    $0xffb,%eax
jge    1200 <read_output+0x80>
movb   $0x0,-0x1(%rsp,%rcx,1)
mov    %rbx,%rdi
mov    %rbp,%rsi
call   1090 <strstr@plt>
test   %rax,%rax
jne    137c <read_output+0x1fc>
mov    %rbx,%rdi
mov    %r13,%rsi
call   1090 <strstr@plt>
test   %rax,%rax
je     1211 <read_output+0x91>
mov    %rsp,%r12
mov    %r12,%rdi
mov    $0x1000,%esi
mov    %r15,%rdx
call   1050 <fgets@plt>
test   %rax,%rax
je     1379 <read_output+0x1f9>
mov    0x2d55(%rip),%r13
lea    0xdba(%rip),%rbx
xor    %r14d,%r14d
jmp    12c2 <read_output+0x142>
nopw   0x0(%rax,%rax,1)
mov    0x0(%r13),%edi
call   1060 <fprintf@plt>
mov    %r12,%rdi
mov    $0x1000,%esi
mov    %r15,%rdx
call   1050 <fgets@plt>
test   %rax,%rax
je     137c <read_output+0x1fc>
mov    %r12,%rdi
call   1040 <strlen@plt>
movslq %eax,%rcx
cmpb   $0xa,-0x1(%rcx,%r12,1)
je     12e3 <read_output+0x163>
lea    0xd49(%rip),%rsi
cmp    $0xffa,%eax
jg     12a0 <read_output+0x120>
movb   $0x0,-0x1(%rsp,%rcx,1)
mov    %r12,%rdi
mov    %rbx,%rsi
call   1090 <strstr@plt>
mov    %r12,%rbp
cmp    %r12,%rax
jne    132e <read_output+0x1ae>
mov    %r12,%rbp
xchg   %ax,%ax
mov    %rbx,%rdi
call   1040 <strlen@plt>
cltq
lea    (%rax,%rbp,1),%rcx
xor    %edx,%edx
cmpb   $0x20,0x0(%rbp,%rax,1)
sete   %dl
mov    %rdx,%rbp
add    %rcx,%rbp
mov    %rbp,%rdi
mov    %rbx,%rsi
call   1090 <strstr@plt>
cmp    %rbp,%rax
je     1300 <read_output+0x180>
lea    0xd1e(%rip),%rsi
test   %rax,%rax
jne    12a0 <read_output+0x120>
mov    %rbp,%rdi
lea    0xd24(%rip),%rsi
call   1090 <strstr@plt>
test   %rax,%rax
jne    137c <read_output+0x1fc>
mov    %rbp,%rdi
call   1040 <strlen@plt>
test   %eax,%eax
je     12a9 <read_output+0x129>
mov    %r14,%rdi
mov    %rbp,%rsi
call   10a0 <read_fact@plt>
mov    %rax,%r14
test   %rax,%rax
jne    12a9 <read_output+0x129>
xor    %r14d,%r14d
mov    %r15,%rdi
call   1030 <fclose@plt>
mov    %r14,%rax
add    $0x1008,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    0x2c40(%rip),%rax
mov    (%rax),%edi
lea    0xc63(%rip),%rsi
call   1060 <fprintf@plt>
mov    0x2c23(%rip),%rax
mov    (%rax),%edi
call   1080 <exit@plt>

LLVM IR (-O0):
%struct.fact_table = type { i32 }
@.str = [10 x i8] c"clips.out\00"
@.str.1 = [2 x i8] c"r\00"
@stderr = global i32 0
@.str.2 = [25 x i8] c"Cannot open CLIPS output\00"
@EXIT_FAILURE = global i32 0
@.str.3 = [24 x i8] c"Line too long. Skipped\0A\00"
@.str.4 = [6 x i8] c"FALSE\00"
@.str.5 = [9 x i8] c"STOP_RUN\00"
@.str.6 = [7 x i8] c"CLIPS>\00"
@.str.7 = [25 x i8] c"Malformed line. skipped\0A\00"
@.str.8 = [15 x i8] c"For a total of\00"
define %struct.fact_table* @read_output() {
%1 = alloca [4096 x i8]
%2 = alloca i8*
%3 = alloca i32*
%4 = alloca %struct.fact_table*
%5 = alloca i32
%6 = alloca i32
%7 = call i32* @fopen(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %7, i32** %3
store %struct.fact_table* null, %struct.fact_table** %4
%8 = load i32*, i32** %3
%9 = icmp ne i32* %8, null
br i1 %9, label %15, label %10
10: ; preds = %0
%11 = load i32, i32* @stderr
%12 = call i32 @fprintf(i32 %11, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.2, i64 0, i64 0))
%13 = load i32, i32* @EXIT_FAILURE
%14 = call i32 @exit(i32 %13)
unreachable
15: ; preds = %0
%16 = getelementptr inbounds [4096 x i8], [4096 x i8]* %1, i64 0, i64 0
%17 = load i32*, i32** %3
%18 = call i64 @fgets(i8* %16, i32 4096, i32* %17)
br label %19
19: ; preds = %54, %37, %15
%20 = getelementptr inbounds [4096 x i8], [4096 x i8]* %1, i64 0, i64 0
%21 = load i32*, i32** %3
%22 = call i64 @fgets(i8* %20, i32 4096, i32* %21)
%23 = icmp ne i64 %22, 0
br i1 %23, label %24, label %55
24: ; preds = %19
%25 = getelementptr inbounds [4096 x i8], [4096 x i8]* %1, i64 0, i64 0
%26 = call i32 @strlen(i8* %25)
store i32 %26, i32* %5
%27 = load i32, i32* %5
%28 = sub nsw i32 %27, 1
%29 = sext i32 %28 to i64
%30 = getelementptr inbounds [4096 x i8], [4096 x i8]* %1, i64 0, i64 %29
%31 = load i8, i8* %30
%32 = sext i8 %31 to i32
%33 = icmp ne i32 %32, 10
br i1 %33, label %34, label %40
34: ; preds = %24
%35 = load i32, i32* %5
%36 = icmp sge i32 %35, 4091
br i1 %36, label %37, label %40
37: ; preds = %34
%38 = load i32, i32* @stderr
%39 = call i32 @fprintf(i32 %38, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.3, i64 0, i64 0))
br label %19
40: ; preds = %34, %24
%41 = load i32, i32* %5
%42 = sub nsw i32 %41, 1
%43 = sext i32 %42 to i64
%44 = getelementptr inbounds [4096 x i8], [4096 x i8]* %1, i64 0, i64 %43
store i8 0, i8* %44
%45 = getelementptr inbounds [4096 x i8], [4096 x i8]* %1, i64 0, i64 0
%46 = call i8* @strstr(i8* %45, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0))
%47 = icmp ne i8* %46, null
br i1 %47, label %48, label %49
48: ; preds = %40
br label %128
49: ; preds = %40
%50 = getelementptr inbounds [4096 x i8], [4096 x i8]* %1, i64 0, i64 0
%51 = call i8* @strstr(i8* %50, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.5, i64 0, i64 0))
%52 = icmp ne i8* %51, null
br i1 %52, label %53, label %54
53: ; preds = %49
br label %55
54: ; preds = %49
br label %19
55: ; preds = %53, %19
br label %56
56: ; preds = %126, %118, %106, %74, %55
%57 = getelementptr inbounds [4096 x i8], [4096 x i8]* %1, i64 0, i64 0
%58 = load i32*, i32** %3
%59 = call i64 @fgets(i8* %57, i32 4096, i32* %58)
%60 = icmp ne i64 %59, 0
br i1 %60, label %61, label %127
61: ; preds = %56
%62 = getelementptr inbounds [4096 x i8], [4096 x i8]* %1, i64 0, i64 0
%63 = call i32 @strlen(i8* %62)
store i32 %63, i32* %6
%64 = load i32, i32* %6
%65 = sub nsw i32 %64, 1
%66 = sext i32 %65 to i64
%67 = getelementptr inbounds [4096 x i8], [4096 x i8]* %1, i64 0, i64 %66
%68 = load i8, i8* %67
%69 = sext i8 %68 to i32
%70 = icmp ne i32 %69, 10
br i1 %70, label %71, label %77
71: ; preds = %61
%72 = load i32, i32* %6
%73 = icmp sge i32 %72, 4091
br i1 %73, label %74, label %77
74: ; preds = %71
%75 = load i32, i32* @stderr
%76 = call i32 @fprintf(i32 %75, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.3, i64 0, i64 0))
br label %56
77: ; preds = %71, %61
%78 = load i32, i32* %6
%79 = sub nsw i32 %78, 1
%80 = sext i32 %79 to i64
%81 = getelementptr inbounds [4096 x i8], [4096 x i8]* %1, i64 0, i64 %80
store i8 0, i8* %81
%82 = getelementptr inbounds [4096 x i8], [4096 x i8]* %1, i64 0, i64 0
store i8* %82, i8** %2
br label %83
83: ; preds = %101, %77
%84 = load i8*, i8** %2
%85 = call i8* @strstr(i8* %84, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.6, i64 0, i64 0))
%86 = load i8*, i8** %2
%87 = icmp eq i8* %85, %86
br i1 %87, label %88, label %102
88: ; preds = %83
%89 = call i32 @strlen(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.6, i64 0, i64 0))
%90 = load i8*, i8** %2
%91 = sext i32 %89 to i64
%92 = getelementptr inbounds i8, i8* %90, i64 %91
store i8* %92, i8** %2
%93 = load i8*, i8** %2
%94 = getelementptr inbounds i8, i8* %93, i64 0
%95 = load i8, i8* %94
%96 = sext i8 %95 to i32
%97 = icmp eq i32 %96, 32
br i1 %97, label %98, label %101
98: ; preds = %88
%99 = load i8*, i8** %2
%100 = getelementptr inbounds i8, i8* %99, i32 1
store i8* %100, i8** %2
br label %101
101: ; preds = %98, %88
br label %83
102: ; preds = %83
%103 = load i8*, i8** %2
%104 = call i8* @strstr(i8* %103, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.6, i64 0, i64 0))
%105 = icmp ne i8* %104, null
br i1 %105, label %106, label %109
106: ; preds = %102
%107 = load i32, i32* @stderr
%108 = call i32 @fprintf(i32 %107, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.7, i64 0, i64 0))
br label %56
109: ; preds = %102
%110 = load i8*, i8** %2
%111 = call i8* @strstr(i8* %110, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.8, i64 0, i64 0))
%112 = icmp ne i8* %111, null
br i1 %112, label %113, label %114
113: ; preds = %109
br label %127
114: ; preds = %109
%115 = load i8*, i8** %2
%116 = call i32 @strlen(i8* %115)
%117 = icmp eq i32 %116, 0
br i1 %117, label %118, label %119
118: ; preds = %114
br label %56
119: ; preds = %114
%120 = load %struct.fact_table*, %struct.fact_table** %4
%121 = load i8*, i8** %2
%122 = call %struct.fact_table* @read_fact(%struct.fact_table* %120, i8* %121)
store %struct.fact_table* %122, %struct.fact_table** %4
%123 = load %struct.fact_table*, %struct.fact_table** %4
%124 = icmp ne %struct.fact_table* %123, null
br i1 %124, label %126, label %125
125: ; preds = %119
br label %128
126: ; preds = %119
br label %56
127: ; preds = %113, %56
br label %128
128: ; preds = %127, %125, %48
%129 = load i32*, i32** %3
%130 = call i32 @fclose(i32* %129)
%131 = load %struct.fact_table*, %struct.fact_table** %4
ret %struct.fact_table* %131
}

LLVM IR (-O2):
%struct.fact_table = type { i32 }
@.str = [10 x i8] c"clips.out\00"
@.str.1 = [2 x i8] c"r\00"
@stderr = global i32 0
@.str.2 = [25 x i8] c"Cannot open CLIPS output\00"
@EXIT_FAILURE = global i32 0
@.str.3 = [24 x i8] c"Line too long. Skipped\0A\00"
@.str.4 = [6 x i8] c"FALSE\00"
@.str.5 = [9 x i8] c"STOP_RUN\00"
@.str.6 = [7 x i8] c"CLIPS>\00"
@.str.7 = [25 x i8] c"Malformed line. skipped\0A\00"
@.str.8 = [15 x i8] c"For a total of\00"
define %struct.fact_table* @read_output() {
%1 = alloca [4096 x i8]
%2 = getelementptr inbounds [4096 x i8], [4096 x i8]* %1, i64 0, i64 0
%3 = tail call i32* @fopen(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%4 = icmp eq i32* %3, null
br i1 %4, label %5, label %10
5: ; preds = %0
%6 = load i32, i32* @stderr
%7 = tail call i32 @fprintf(i32 %6, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.2, i64 0, i64 0))
%8 = load i32, i32* @EXIT_FAILURE
%9 = tail call i32 @exit(i32 %8)
unreachable
10: ; preds = %0
%11 = call i64 @fgets(i8* %2, i32 4096, i32* %3)
%12 = call i64 @fgets(i8* %2, i32 4096, i32* %3)
%13 = icmp eq i64 %12, 0
br i1 %13, label %35, label %14
14: ; preds = %10, %32
%15 = call i32 @strlen(i8* %2)
%16 = add nsw i32 %15, -1
%17 = sext i32 %16 to i64
%18 = getelementptr inbounds [4096 x i8], [4096 x i8]* %1, i64 0, i64 %17
%19 = load i8, i8* %18
%20 = icmp ne i8 %19, 10
%21 = icmp sgt i32 %15, 4090
%22 = select i1 %20, i1 %21, i1 false
br i1 %22, label %23, label %26
23: ; preds = %14
%24 = load i32, i32* @stderr
%25 = call i32 @fprintf(i32 %24, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.3, i64 0, i64 0))
br label %32
26: ; preds = %14
store i8 0, i8* %18
%27 = call i8* @strstr(i8* %2, i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0))
%28 = icmp eq i8* %27, null
br i1 %28, label %29, label %83
29: ; preds = %26
%30 = call i8* @strstr(i8* %2, i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.5, i64 0, i64 0))
%31 = icmp eq i8* %30, null
br i1 %31, label %32, label %35
32: ; preds = %29, %23
%33 = call i64 @fgets(i8* %2, i32 4096, i32* %3)
%34 = icmp eq i64 %33, 0
br i1 %34, label %35, label %14
35: ; preds = %32, %29, %10
%36 = call i64 @fgets(i8* %2, i32 4096, i32* %3)
%37 = icmp eq i64 %36, 0
br i1 %37, label %83, label %38
38: ; preds = %35, %79
%39 = phi %struct.fact_table* [ %80, %79 ], [ null, %35 ]
%40 = call i32 @strlen(i8* %2)
%41 = add nsw i32 %40, -1
%42 = sext i32 %41 to i64
%43 = getelementptr inbounds [4096 x i8], [4096 x i8]* %1, i64 0, i64 %42
%44 = load i8, i8* %43
%45 = icmp ne i8 %44, 10
%46 = icmp sgt i32 %40, 4090
%47 = select i1 %45, i1 %46, i1 false
br i1 %47, label %75, label %48
48: ; preds = %38
store i8 0, i8* %43
%49 = call i8* @strstr(i8* dereferenceable(1) %2, i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.6, i64 0, i64 0))
%50 = icmp eq i8* %49, %2
br i1 %50, label %51, label %62
51: ; preds = %48, %51
%52 = phi i8* [ %59, %51 ], [ %2, %48 ]
%53 = call i32 @strlen(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.6, i64 0, i64 0))
%54 = sext i32 %53 to i64
%55 = getelementptr inbounds i8, i8* %52, i64 %54
%56 = load i8, i8* %55
%57 = icmp eq i8 %56, 32
%58 = zext i1 %57 to i64
%59 = getelementptr i8, i8* %55, i64 %58
%60 = call i8* @strstr(i8* dereferenceable(1) %59, i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.6, i64 0, i64 0))
%61 = icmp eq i8* %60, %59
br i1 %61, label %51, label %62
62: ; preds = %51, %48
%63 = phi i8* [ %2, %48 ], [ %59, %51 ]
%64 = phi i8* [ %49, %48 ], [ %60, %51 ]
%65 = icmp eq i8* %64, null
br i1 %65, label %66, label %75
66: ; preds = %62
%67 = call i8* @strstr(i8* dereferenceable(1) %63, i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str.8, i64 0, i64 0))
%68 = icmp eq i8* %67, null
br i1 %68, label %69, label %83
69: ; preds = %66
%70 = call i32 @strlen(i8* %63)
%71 = icmp eq i32 %70, 0
br i1 %71, label %79, label %72
72: ; preds = %69
%73 = call %struct.fact_table* @read_fact(%struct.fact_table* %39, i8* %63)
%74 = icmp eq %struct.fact_table* %73, null
br i1 %74, label %83, label %79
75: ; preds = %62, %38
%76 = phi i8* [ getelementptr inbounds ([24 x i8], [24 x i8]* @.str.3, i64 0, i64 0), %38 ], [ getelementptr inbounds ([25 x i8], [25 x i8]* @.str.7, i64 0, i64 0), %62 ]
%77 = load i32, i32* @stderr
%78 = call i32 @fprintf(i32 %77, i8* %76)
br label %79
79: ; preds = %75, %72, %69
%80 = phi %struct.fact_table* [ %39, %69 ], [ %73, %72 ], [ %39, %75 ]
%81 = call i64 @fgets(i8* %2, i32 4096, i32* %3)
%82 = icmp eq i64 %81, 0
br i1 %82, label %83, label %38
83: ; preds = %26, %79, %66, %72, %35
%84 = phi %struct.fact_table* [ null, %35 ], [ %80, %79 ], [ %39, %66 ], [ null, %72 ], [ null, %26 ]
%85 = call i32 @fclose(i32* %3)
ret %struct.fact_table* %84
}