#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*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ duplicateLine(char *);
int /*<<< orphan*/ exit(int);
scalar_t__ fgets(char *, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ printf(char *, char *);
int /*<<< orphan*/ storeLine(char *);
int main(int argc, char **argv) {
  char line[255];
  if (argc != 2) {
    printf("usage: %s <filename> \n", argv[0]);
    exit(1);
  }
  FILE *fp = fopen(argv[1], "r");
  if (fp == NULL) {
    printf(" Could not open file: %s\n", argv[1]);
  }
  while (fgets(line, 255, fp)) {
    if (!duplicateLine(line)) {
      storeLine(line);
      printf("%s", line);
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x120,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x2,-0x8(%rbp)
je     11a0 <main+0x40>
mov    -0x10(%rbp),%rax
mov    (%rax),%rsi
lea    0xe6f(%rip),%rdi
call   1030 <printf@plt>
mov    $0x1,%edi
call   1080 <exit@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe68(%rip),%rsi
call   1070 <fopen@plt>
mov    %rax,-0x118(%rbp)
cmpq   $0x0,-0x118(%rbp)
jne    11dd <main+0x7d>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rsi
lea    0xe41(%rip),%rdi
call   1030 <printf@plt>
jmp    11e2 <main+0x82>
lea    -0x110(%rbp),%rdi
mov    -0x118(%rbp),%rdx
mov    $0xff,%esi
call   1040 <fgets@plt>
cmp    $0x0,%rax
je     123d <main+0xdd>
lea    -0x110(%rbp),%rdi
call   1050 <duplicateLine@plt>
cmp    $0x0,%eax
jne    1238 <main+0xd8>
lea    -0x110(%rbp),%rdi
call   1060 <storeLine@plt>
lea    -0x110(%rbp),%rsi
lea    0xe00(%rip),%rdi
call   1030 <printf@plt>
jmp    11e2 <main+0x82>
xor    %eax,%eax
add    $0x120,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x100,%rsp
mov    %rsi,%rbx
cmp    $0x2,%edi
jne    1215 <main+0xb5>
mov    0x8(%rbx),%rdi
lea    0xe94(%rip),%rsi
call   1070 <fopen@plt>
mov    %rax,%r14
test   %rax,%rax
jne    11a0 <main+0x40>
mov    0x8(%rbx),%rsi
lea    0xe7e(%rip),%rdi
call   1030 <printf@plt>
mov    %rsp,%rdi
mov    $0xff,%esi
mov    %r14,%rdx
call   1040 <fgets@plt>
test   %rax,%rax
je     1206 <main+0xa6>
mov    %rsp,%rbx
lea    0xe74(%rip),%r15
jmp    11e5 <main+0x85>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    %rbx,%rdi
mov    $0xff,%esi
mov    %r14,%rdx
call   1040 <fgets@plt>
test   %rax,%rax
je     1206 <main+0xa6>
mov    %rbx,%rdi
call   1050 <duplicateLine@plt>
test   %eax,%eax
jne    11d0 <main+0x70>
mov    %rbx,%rdi
call   1060 <storeLine@plt>
mov    %r15,%rdi
mov    %rbx,%rsi
call   1030 <printf@plt>
jmp    11d0 <main+0x70>
xor    %eax,%eax
add    $0x100,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret
mov    (%rbx),%rsi
lea    0xde1(%rip),%rdi
call   1030 <printf@plt>
mov    $0x1,%edi
call   1080 <exit@plt>

LLVM IR (-O0):
@.str = [23 x i8] c"usage: %s <filename> \0A\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [26 x i8] c" Could not open file: %s\0A\00"
@.str.3 = [3 x i8] c"%s\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [255 x i8]
%7 = alloca i32*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%8 = load i32, i32* %4
%9 = icmp ne i32 %8, 2
br i1 %9, label %10, label %16
10: ; preds = %2
%11 = load i8**, i8*** %5
%12 = getelementptr inbounds i8*, i8** %11, i64 0
%13 = load i8*, i8** %12
%14 = call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i8* %13)
%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.1, i64 0, i64 0))
store i32* %20, i32** %7
%21 = load i32*, i32** %7
%22 = icmp eq i32* %21, null
br i1 %22, label %23, label %28
23: ; preds = %16
%24 = load i8**, i8*** %5
%25 = getelementptr inbounds i8*, i8** %24, i64 1
%26 = load i8*, i8** %25
%27 = call i32 @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.2, i64 0, i64 0), i8* %26)
br label %28
28: ; preds = %23, %16
br label %29
29: ; preds = %43, %28
%30 = getelementptr inbounds [255 x i8], [255 x i8]* %6, i64 0, i64 0
%31 = load i32*, i32** %7
%32 = call i64 @fgets(i8* %30, i32 255, i32* %31)
%33 = icmp ne i64 %32, 0
br i1 %33, label %34, label %44
34: ; preds = %29
%35 = getelementptr inbounds [255 x i8], [255 x i8]* %6, i64 0, i64 0
%36 = call i32 @duplicateLine(i8* %35)
%37 = icmp ne i32 %36, 0
br i1 %37, label %43, label %38
38: ; preds = %34
%39 = getelementptr inbounds [255 x i8], [255 x i8]* %6, i64 0, i64 0
%40 = call i32 @storeLine(i8* %39)
%41 = getelementptr inbounds [255 x i8], [255 x i8]* %6, i64 0, i64 0
%42 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i8* %41)
br label %43
43: ; preds = %38, %34
br label %29
44: ; preds = %29
ret i32 0
}

LLVM IR (-O2):
@.str = [23 x i8] c"usage: %s <filename> \0A\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [26 x i8] c" Could not open file: %s\0A\00"
@.str.3 = [3 x i8] c"%s\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca [255 x i8]
%4 = getelementptr inbounds [255 x i8], [255 x i8]* %3, i64 0, i64 0
%5 = icmp eq i32 %0, 2
br i1 %5, label %10, label %6
6: ; preds = %2
%7 = load i8*, i8** %1
%8 = tail call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i8* %7)
%9 = tail call i32 @exit(i32 1)
unreachable
10: ; preds = %2
%11 = getelementptr inbounds i8*, i8** %1, i64 1
%12 = load i8*, i8** %11
%13 = tail call i32* @fopen(i8* %12, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%14 = icmp eq i32* %13, null
br i1 %14, label %15, label %18
15: ; preds = %10
%16 = load i8*, i8** %11
%17 = tail call i32 @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.2, i64 0, i64 0), i8* %16)
br label %18
18: ; preds = %15, %10
%19 = call i64 @fgets(i8* %4, i32 255, i32* %13)
%20 = icmp eq i64 %19, 0
br i1 %20, label %30, label %21
21: ; preds = %18, %27
%22 = call i32 @duplicateLine(i8* %4)
%23 = icmp eq i32 %22, 0
br i1 %23, label %24, label %27
24: ; preds = %21
%25 = call i32 @storeLine(i8* %4)
%26 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i8* %4)
br label %27
27: ; preds = %24, %21
%28 = call i64 @fgets(i8* %4, i32 255, i32* %13)
%29 = icmp eq i64 %28, 0
br i1 %29, label %30, label %21
30: ; preds = %27, %18
ret i32 0
}