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

/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ *fopen(char *, char *);
int getline(char **, size_t *, int /*<<< orphan*/ *);
double print_line(int, char *, double);
scalar_t__ strstr(char *, char *);
int /*<<< orphan*/ system(char *);
int main(int argc, char *argv[]) {
  FILE *fp;
  char *line = NULL, *line2 = 0;
  size_t len = 0;
  ssize_t read;
  if (argc != 2)
    exit(-1);
  if (!(fp = fopen(argv[1], "r")))
    exit(-1);
  system("cat bin/header.txt");
  int first = 0;
  getline(&line, &len, fp);
  for (; (read = getline(&line, &len, fp)) != -1 &&
         (read = getline(&line2, &len, fp)) != -1;
       first++) {
    if (strstr(line, "cyc")) {
      print_line(0, line, print_line(1, line2, 1.0));
    } else {
      print_line(0, line2, print_line(1, line, 1.0));
    }
  }
  system("cat bin/footer.txt");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movq   $0x0,-0x20(%rbp)
movq   $0x0,-0x28(%rbp)
movq   $0x0,-0x30(%rbp)
cmpl   $0x2,-0x8(%rbp)
je     11a2 <main+0x42>
mov    $0xffffffff,%edi
call   1070 <exit@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe57(%rip),%rsi
call   1050 <fopen@plt>
mov    %rax,-0x18(%rbp)
cmp    $0x0,%rax
jne    11ce <main+0x6e>
mov    $0xffffffff,%edi
call   1070 <exit@plt>
lea    0xe35(%rip),%rdi
call   1040 <system@plt>
movl   $0x0,-0x38(%rbp)
mov    -0x18(%rbp),%rdx
lea    -0x20(%rbp),%rdi
lea    -0x30(%rbp),%rsi
call   1060 <getline@plt>
mov    -0x18(%rbp),%rdx
lea    -0x20(%rbp),%rdi
lea    -0x30(%rbp),%rsi
call   1060 <getline@plt>
mov    %eax,%ecx
mov    %ecx,-0x34(%rbp)
xor    %eax,%eax
cmp    $0xffffffff,%ecx
mov    %al,-0x39(%rbp)
je     1233 <main+0xd3>
mov    -0x18(%rbp),%rdx
lea    -0x28(%rbp),%rdi
lea    -0x30(%rbp),%rsi
call   1060 <getline@plt>
mov    %eax,-0x34(%rbp)
cmp    $0xffffffff,%eax
setne  %al
mov    %al,-0x39(%rbp)
mov    -0x39(%rbp),%al
test   $0x1,%al
jne    1243 <main+0xe3>
jmp    12c7 <main+0x167>
mov    -0x20(%rbp),%rdi
lea    0xdcf(%rip),%rsi
call   1080 <strstr@plt>
cmp    $0x0,%rax
je     128b <main+0x12b>
mov    -0x20(%rbp),%rax
mov    %rax,-0x48(%rbp)
mov    -0x28(%rbp),%rsi
mov    $0x1,%edi
movsd  0xd8a(%rip),%xmm0
call   1030 <print_line@plt>
mov    -0x48(%rbp),%rsi
xor    %edi,%edi
call   1030 <print_line@plt>
jmp    12b4 <main+0x154>
mov    -0x28(%rbp),%rax
mov    %rax,-0x50(%rbp)
mov    -0x20(%rbp),%rsi
mov    $0x1,%edi
movsd  0xd5c(%rip),%xmm0
call   1030 <print_line@plt>
mov    -0x50(%rbp),%rsi
xor    %edi,%edi
call   1030 <print_line@plt>
jmp    12b9 <main+0x159>
mov    -0x38(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x38(%rbp)
jmp    11f2 <main+0x92>
lea    0xd53(%rip),%rdi
call   1040 <system@plt>
xor    %eax,%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
movq   $0x0,(%rsp)
movq   $0x0,0x10(%rsp)
movq   $0x0,0x8(%rsp)
cmp    $0x2,%edi
jne    1282 <main+0x122>
mov    0x8(%rsi),%rdi
lea    0xe6c(%rip),%rsi
call   1050 <fopen@plt>
test   %rax,%rax
je     1282 <main+0x122>
mov    %rax,%rbx
lea    0xe56(%rip),%rdi
call   1040 <system@plt>
mov    %rsp,%r14
lea    0x8(%rsp),%r15
mov    %r14,%rdi
mov    %r15,%rsi
mov    %rbx,%rdx
call   1060 <getline@plt>
mov    %r14,%rdi
mov    %r15,%rsi
mov    %rbx,%rdx
call   1060 <getline@plt>
cmp    $0xffffffff,%eax
je     1265 <main+0x105>
lea    0x10(%rsp),%r14
lea    0x8(%rsp),%r15
lea    0xe26(%rip),%r12
mov    %rsp,%r13
nopw   0x0(%rax,%rax,1)
mov    %r14,%rdi
mov    %r15,%rsi
mov    %rbx,%rdx
call   1060 <getline@plt>
cmp    $0xffffffff,%eax
je     1265 <main+0x105>
mov    (%rsp),%rdi
mov    %r12,%rsi
call   1080 <strstr@plt>
test   %rax,%rax
mov    (%rsp),%rbp
mov    0x10(%rsp),%rax
mov    %rax,%rsi
cmove  %rbp,%rsi
cmove  %rax,%rbp
mov    $0x1,%edi
movsd  0xdbd(%rip),%xmm0
call   1030 <print_line@plt>
xor    %edi,%edi
mov    %rbp,%rsi
call   1030 <print_line@plt>
mov    %r13,%rdi
mov    %r15,%rsi
mov    %rbx,%rdx
call   1060 <getline@plt>
cmp    $0xffffffff,%eax
jne    1200 <main+0xa0>
lea    0xdb5(%rip),%rdi
call   1040 <system@plt>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    $0xffffffff,%edi
call   1070 <exit@plt>

LLVM IR (-O0):
@.str = [2 x i8] c"r\00"
@.str.1 = [19 x i8] c"cat bin/header.txt\00"
@.str.2 = [4 x i8] c"cyc\00"
@.str.3 = [19 x i8] c"cat bin/footer.txt\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32*
%7 = alloca i8*
%8 = alloca i8*
%9 = alloca i64
%10 = alloca i32
%11 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i8* null, i8** %7
store i8* null, i8** %8
store i64 0, i64* %9
%12 = load i32, i32* %4
%13 = icmp ne i32 %12, 2
br i1 %13, label %14, label %16
14: ; preds = %2
%15 = call i32 @exit(i32 -1)
unreachable
16: ; preds = %2
%17 = load i8**, i8*** %5
%18 = getelementptr inbounds i8*, i8** %17, i64 1
%19 = load i8*, i8** %18
%20 = call i32* @fopen(i8* %19, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
store i32* %20, i32** %6
%21 = icmp ne i32* %20, null
br i1 %21, label %24, label %22
22: ; preds = %16
%23 = call i32 @exit(i32 -1)
unreachable
24: ; preds = %16
%25 = call i32 @system(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0))
store i32 0, i32* %11
%26 = load i32*, i32** %6
%27 = call i32 @getline(i8** %7, i64* %9, i32* %26)
br label %28
28: ; preds = %53, %24
%29 = load i32*, i32** %6
%30 = call i32 @getline(i8** %7, i64* %9, i32* %29)
store i32 %30, i32* %10
%31 = icmp ne i32 %30, -1
br i1 %31, label %32, label %36
32: ; preds = %28
%33 = load i32*, i32** %6
%34 = call i32 @getline(i8** %8, i64* %9, i32* %33)
store i32 %34, i32* %10
%35 = icmp ne i32 %34, -1
br label %36
36: ; preds = %32, %28
%37 = phi i1 [ false, %28 ], [ %35, %32 ]
br i1 %37, label %38, label %56
38: ; preds = %36
%39 = load i8*, i8** %7
%40 = call i64 @strstr(i8* %39, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0))
%41 = icmp ne i64 %40, 0
br i1 %41, label %42, label %47
42: ; preds = %38
%43 = load i8*, i8** %7
%44 = load i8*, i8** %8
%45 = call double @print_line(i32 1, i8* %44, double 1.000000e+00)
%46 = call double @print_line(i32 0, i8* %43, double %45)
br label %52
47: ; preds = %38
%48 = load i8*, i8** %8
%49 = load i8*, i8** %7
%50 = call double @print_line(i32 1, i8* %49, double 1.000000e+00)
%51 = call double @print_line(i32 0, i8* %48, double %50)
br label %52
52: ; preds = %47, %42
br label %53
53: ; preds = %52
%54 = load i32, i32* %11
%55 = add nsw i32 %54, 1
store i32 %55, i32* %11
br label %28
56: ; preds = %36
%57 = call i32 @system(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.3, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [2 x i8] c"r\00"
@.str.1 = [19 x i8] c"cat bin/header.txt\00"
@.str.2 = [4 x i8] c"cyc\00"
@.str.3 = [19 x i8] c"cat bin/footer.txt\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i64
%6 = bitcast i8** %3 to i8*
store i8* null, i8** %3
%7 = bitcast i8** %4 to i8*
store i8* null, i8** %4
%8 = bitcast i64* %5 to i8*
store i64 0, i64* %5
%9 = icmp eq i32 %0, 2
br i1 %9, label %12, label %10
10: ; preds = %2
%11 = tail call i32 @exit(i32 -1)
unreachable
12: ; preds = %2
%13 = getelementptr inbounds i8*, i8** %1, i64 1
%14 = load i8*, i8** %13
%15 = tail call i32* @fopen(i8* %14, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%16 = icmp eq i32* %15, null
br i1 %16, label %17, label %19
17: ; preds = %12
%18 = tail call i32 @exit(i32 -1)
unreachable
19: ; preds = %12
%20 = tail call i32 @system(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0))
%21 = call i32 @getline(i8** %3, i64* %5, i32* %15)
%22 = call i32 @getline(i8** %3, i64* %5, i32* %15)
%23 = icmp eq i32 %22, -1
br i1 %23, label %39, label %24
24: ; preds = %19, %27
%25 = call i32 @getline(i8** %4, i64* %5, i32* %15)
%26 = icmp eq i32 %25, -1
br i1 %26, label %39, label %27
27: ; preds = %24
%28 = load i8*, i8** %3
%29 = call i64 @strstr(i8* %28, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0))
%30 = icmp eq i64 %29, 0
%31 = load i8*, i8** %3
%32 = load i8*, i8** %4
%33 = select i1 %30, i8* %31, i8* %32
%34 = select i1 %30, i8* %32, i8* %31
%35 = call double @print_line(i32 1, i8* %33, double 1.000000e+00)
%36 = call double @print_line(i32 0, i8* %34, double %35)
%37 = call i32 @getline(i8** %3, i64* %5, i32* %15)
%38 = icmp eq i32 %37, -1
br i1 %38, label %39, label %24
39: ; preds = %24, %27, %19
%40 = call i32 @system(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.3, i64 0, i64 0))
ret i32 0
}