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

/* Variables and functions */
int /*<<< orphan*/ ExcludeAdd(int /*<<< orphan*/);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fgets(char *, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char const *, char *);
int /*<<< orphan*/ perror(char const *);
int /*<<< orphan*/ rstrip(char *);
int /*<<< orphan*/ strdup(char *);
void ExcludeAddFile(const char *filename) {
  FILE *xfile = fopen(filename, "r");
  char pat[1024];
  if (xfile == NULL) {
    perror(filename);
    return;
  }
  while (fgets(pat, sizeof(pat), xfile) != NULL) {
    rstrip(pat);
    ExcludeAdd(strdup(pat));
  }
  fclose(xfile);
}


x86 assembly (clang, -O0):
<ExcludeAddFile>:
push   %rbp
mov    %rsp,%rbp
sub    $0x410,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xe76(%rip),%rsi
call   1070 <fopen@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    11ac <ExcludeAddFile+0x3c>
mov    -0x8(%rbp),%rdi
call   1080 <perror@plt>
jmp    11fd <ExcludeAddFile+0x8d>
jmp    11b1 <ExcludeAddFile+0x41>
lea    -0x410(%rbp),%rdi
mov    -0x10(%rbp),%rdx
mov    $0x400,%esi
call   1050 <fgets@plt>
cmp    $0x0,%rax
je     11f4 <ExcludeAddFile+0x84>
lea    -0x410(%rbp),%rdi
call   1030 <rstrip@plt>
lea    -0x410(%rbp),%rdi
call   1090 <strdup@plt>
mov    %eax,%edi
call   1060 <ExcludeAdd@plt>
jmp    11b1 <ExcludeAddFile+0x41>
mov    -0x10(%rbp),%rdi
call   1040 <fclose@plt>
add    $0x410,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ExcludeAddFile>:
push   %r14
push   %rbx
sub    $0x408,%rsp
mov    %rdi,%rbx
lea    0xe7c(%rip),%rsi
call   1070 <fopen@plt>
test   %rax,%rax
je     11ef <ExcludeAddFile+0x7f>
mov    %rax,%r14
mov    %rsp,%rdi
mov    $0x400,%esi
mov    %rax,%rdx
call   1050 <fgets@plt>
test   %rax,%rax
je     11dc <ExcludeAddFile+0x6c>
mov    %rsp,%rbx
nopl   0x0(%rax)
mov    %rbx,%rdi
call   1030 <rstrip@plt>
mov    %rbx,%rdi
call   1090 <strdup@plt>
mov    %eax,%edi
call   1060 <ExcludeAdd@plt>
mov    %rbx,%rdi
mov    $0x400,%esi
mov    %r14,%rdx
call   1050 <fgets@plt>
test   %rax,%rax
jne    11b0 <ExcludeAddFile+0x40>
mov    %r14,%rdi
call   1040 <fclose@plt>
add    $0x408,%rsp
pop    %rbx
pop    %r14
ret
mov    %rbx,%rdi
add    $0x408,%rsp
pop    %rbx
pop    %r14
jmp    1080 <perror@plt>

LLVM IR (-O0):
@.str = [2 x i8] c"r\00"
define void @ExcludeAddFile(i8* %0) {
%2 = alloca i8*
%3 = alloca i32*
%4 = alloca [1024 x i8]
store i8* %0, i8** %2
%5 = load i8*, i8** %2
%6 = call i32* @fopen(i8* %5, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
store i32* %6, i32** %3
%7 = load i32*, i32** %3
%8 = icmp eq i32* %7, null
br i1 %8, label %9, label %12
9: ; preds = %1
%10 = load i8*, i8** %2
%11 = call i32 @perror(i8* %10)
br label %27
12: ; preds = %1
br label %13
13: ; preds = %18, %12
%14 = getelementptr inbounds [1024 x i8], [1024 x i8]* %4, i64 0, i64 0
%15 = load i32*, i32** %3
%16 = call i32* @fgets(i8* %14, i32 1024, i32* %15)
%17 = icmp ne i32* %16, null
br i1 %17, label %18, label %24
18: ; preds = %13
%19 = getelementptr inbounds [1024 x i8], [1024 x i8]* %4, i64 0, i64 0
%20 = call i32 @rstrip(i8* %19)
%21 = getelementptr inbounds [1024 x i8], [1024 x i8]* %4, i64 0, i64 0
%22 = call i32 @strdup(i8* %21)
%23 = call i32 @ExcludeAdd(i32 %22)
br label %13
24: ; preds = %13
%25 = load i32*, i32** %3
%26 = call i32 @fclose(i32* %25)
br label %27
27: ; preds = %24, %9
ret void
}

LLVM IR (-O2):
@.str = [2 x i8] c"r\00"
define void @ExcludeAddFile(i8* nocapture %0) {
%2 = alloca [1024 x i8]
%3 = tail call i32* @fopen(i8* %0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%4 = getelementptr inbounds [1024 x i8], [1024 x i8]* %2, i64 0, i64 0
%5 = icmp eq i32* %3, null
br i1 %5, label %9, label %6
6: ; preds = %1
%7 = call i32* @fgets(i8* %4, i32 1024, i32* %3)
%8 = icmp eq i32* %7, null
br i1 %8, label %17, label %11
9: ; preds = %1
%10 = tail call i32 @perror(i8* %0)
br label %19
11: ; preds = %6, %11
%12 = call i32 @rstrip(i8* %4)
%13 = call i32 @strdup(i8* %4)
%14 = call i32 @ExcludeAdd(i32 %13)
%15 = call i32* @fgets(i8* %4, i32 1024, i32* %3)
%16 = icmp eq i32* %15, null
br i1 %16, label %17, label %11
17: ; preds = %11, %6
%18 = call i32 @fclose(i32* %3)
br label %19
19: ; preds = %17, %9
ret void
}