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

/* Variables and functions */
int /*<<< orphan*/ add_ignored(int /*<<< orphan*/, char);
int /*<<< orphan*/ errno;
int /*<<< orphan*/ exit(int);
scalar_t__ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fgets(char *, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *, ...);
int /*<<< orphan*/ memset(char *, int, int);
int /*<<< orphan*/ removespaces(char *, int /*<<< orphan*/);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ strdup(char *);
char *strerror(int /*<<< orphan*/);
int /*<<< orphan*/ strlen(char *);
void load_ignore_list(char *fn, char src) {
  FILE *fp = NULL;
  char buf[1024];
  if ((fp = fopen(fn, "r")) == NULL) {
    fprintf(stderr, "fopen: %s: %s\n", fn, strerror(errno));
    exit(-1);
  }
  memset(buf, 0x0, sizeof(buf));
  while ((fgets(buf, 1024, fp)) != NULL) {
    removespaces(buf, strlen(buf));
    add_ignored(strdup(buf), src);
    memset(buf, 0x0, sizeof(buf));
  }
  if (fclose(fp) != 0) {
    fprintf(stderr, "File: %s - Line: %d: %s.\n",
            "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
            "2022-01-22/02-19-57/repos/EnderUNIX/spamGuard/refs/heads/master/"
            "functions.c",
            236, strerror(errno));
    exit(-1);
  }
}


x86 assembly (clang, -O0):
<load_ignore_list>:
push   %rbp
mov    %rsp,%rbp
sub    $0x440,%rsp
mov    %sil,%al
mov    %rdi,-0x8(%rbp)
mov    %al,-0x9(%rbp)
movq   $0x0,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xe28(%rip),%rsi
call   1090 <fopen@plt>
mov    %rax,-0x18(%rbp)
cmp    $0x0,%rax
jne    123b <load_ignore_list+0x8b>
mov    0x2dee(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x42c(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x428(%rbp)
mov    0x2dcc(%rip),%rax
mov    (%rax),%edi
call   10c0 <strerror@plt>
mov    -0x42c(%rbp),%edi
mov    -0x428(%rbp),%rdx
mov    %rax,%rcx
lea    0xdd8(%rip),%rsi
mov    $0x0,%al
call   1080 <fprintf@plt>
mov    $0xffffffff,%edi
call   10a0 <exit@plt>
lea    -0x420(%rbp),%rdi
xor    %esi,%esi
mov    $0x400,%edx
call   1060 <memset@plt>
lea    -0x420(%rbp),%rdi
mov    -0x18(%rbp),%rdx
mov    $0x400,%esi
call   1070 <fgets@plt>
cmp    $0x0,%rax
je     12c4 <load_ignore_list+0x114>
lea    -0x420(%rbp),%rax
mov    %rax,-0x438(%rbp)
lea    -0x420(%rbp),%rdi
call   1040 <strlen@plt>
mov    -0x438(%rbp),%rdi
mov    %eax,%esi
call   10d0 <removespaces@plt>
lea    -0x420(%rbp),%rdi
call   10b0 <strdup@plt>
mov    %eax,%edi
movsbl -0x9(%rbp),%esi
call   1050 <add_ignored@plt>
lea    -0x420(%rbp),%rdi
xor    %esi,%esi
mov    $0x400,%edx
call   1060 <memset@plt>
jmp    124e <load_ignore_list+0x9e>
mov    -0x18(%rbp),%rdi
call   1030 <fclose@plt>
cmp    $0x0,%rax
je     1321 <load_ignore_list+0x171>
mov    0x2d02(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x43c(%rbp)
mov    0x2ceb(%rip),%rax
mov    (%rax),%edi
call   10c0 <strerror@plt>
mov    -0x43c(%rbp),%edi
mov    %rax,%r8
lea    0xd0d(%rip),%rsi
lea    0xd20(%rip),%rdx
mov    $0xec,%ecx
mov    $0x0,%al
call   1080 <fprintf@plt>
mov    $0xffffffff,%edi
call   10a0 <exit@plt>
add    $0x440,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<load_ignore_list>:
push   %rbp
push   %r14
push   %rbx
sub    $0x400,%rsp
mov    %esi,%ebp
mov    %rdi,%rbx
lea    0xe39(%rip),%rsi
call   1090 <fopen@plt>
test   %rax,%rax
je     1270 <load_ignore_list+0xc0>
mov    %rax,%r14
mov    %rsp,%rbx
mov    %rbx,%rdi
xor    %esi,%esi
mov    $0x400,%edx
call   1060 <memset@plt>
mov    %rbx,%rdi
mov    $0x400,%esi
mov    %r14,%rdx
call   1070 <fgets@plt>
test   %rax,%rax
je     1257 <load_ignore_list+0xa7>
mov    %rsp,%rbx
movsbl %bpl,%ebp
cs nopw 0x0(%rax,%rax,1)
mov    %rbx,%rdi
call   1040 <strlen@plt>
mov    %rbx,%rdi
mov    %eax,%esi
call   10d0 <removespaces@plt>
mov    %rbx,%rdi
call   10b0 <strdup@plt>
mov    %eax,%edi
mov    %ebp,%esi
call   1050 <add_ignored@plt>
mov    %rbx,%rdi
xor    %esi,%esi
mov    $0x400,%edx
call   1060 <memset@plt>
mov    %rbx,%rdi
mov    $0x400,%esi
mov    %r14,%rdx
call   1070 <fgets@plt>
test   %rax,%rax
jne    1210 <load_ignore_list+0x60>
mov    %r14,%rdi
call   1030 <fclose@plt>
test   %rax,%rax
jne    12a7 <load_ignore_list+0xf7>
add    $0x400,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret
mov    0x2d69(%rip),%rax
mov    (%rax),%ebp
mov    0x2d58(%rip),%rax
mov    (%rax),%edi
call   10c0 <strerror@plt>
lea    0xd74(%rip),%rsi
mov    %ebp,%edi
mov    %rbx,%rdx
mov    %rax,%rcx
xor    %eax,%eax
call   1080 <fprintf@plt>
mov    $0xffffffff,%edi
call   10a0 <exit@plt>
mov    0x2d32(%rip),%rax
mov    (%rax),%ebx
mov    0x2d21(%rip),%rax
mov    (%rax),%edi
call   10c0 <strerror@plt>
lea    0xd4c(%rip),%rsi
lea    0xd5f(%rip),%rdx
mov    %ebx,%edi
mov    $0xec,%ecx
mov    %rax,%r8
xor    %eax,%eax
call   1080 <fprintf@plt>
mov    $0xffffffff,%edi
call   10a0 <exit@plt>

LLVM IR (-O0):
@.str = [2 x i8] c"r\00"
@stderr = global i32 0
@.str.1 = [15 x i8] c"fopen: %s: %s\0A\00"
@errno = global i32 0
@.str.2 = [26 x i8] c"File: %s - Line: %d: %s.\0A\00"
@.str.3 = [140 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/EnderUNIX/spamGuard/refs/heads/master/functions.c\00"
define void @load_ignore_list(i8* %0, i8 signext %1) {
%3 = alloca i8*
%4 = alloca i8
%5 = alloca i32*
%6 = alloca [1024 x i8]
store i8* %0, i8** %3
store i8 %1, i8* %4
store i32* null, i32** %5
%7 = load i8*, i8** %3
%8 = call i32* @fopen(i8* %7, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
store i32* %8, i32** %5
%9 = icmp eq i32* %8, null
br i1 %9, label %10, label %17
10: ; preds = %2
%11 = load i32, i32* @stderr
%12 = load i8*, i8** %3
%13 = load i32, i32* @errno
%14 = call i8* @strerror(i32 %13)
%15 = call i32 (i32, i8*, i8*, ...) @fprintf(i32 %11, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0), i8* %12, i8* %14)
%16 = call i32 @exit(i32 -1)
unreachable
17: ; preds = %2
%18 = getelementptr inbounds [1024 x i8], [1024 x i8]* %6, i64 0, i64 0
%19 = call i32 @memset(i8* %18, i32 0, i32 1024)
br label %20
20: ; preds = %25, %17
%21 = getelementptr inbounds [1024 x i8], [1024 x i8]* %6, i64 0, i64 0
%22 = load i32*, i32** %5
%23 = call i32* @fgets(i8* %21, i32 1024, i32* %22)
%24 = icmp ne i32* %23, null
br i1 %24, label %25, label %36
25: ; preds = %20
%26 = getelementptr inbounds [1024 x i8], [1024 x i8]* %6, i64 0, i64 0
%27 = getelementptr inbounds [1024 x i8], [1024 x i8]* %6, i64 0, i64 0
%28 = call i32 @strlen(i8* %27)
%29 = call i32 @removespaces(i8* %26, i32 %28)
%30 = getelementptr inbounds [1024 x i8], [1024 x i8]* %6, i64 0, i64 0
%31 = call i32 @strdup(i8* %30)
%32 = load i8, i8* %4
%33 = call i32 @add_ignored(i32 %31, i8 signext %32)
%34 = getelementptr inbounds [1024 x i8], [1024 x i8]* %6, i64 0, i64 0
%35 = call i32 @memset(i8* %34, i32 0, i32 1024)
br label %20
36: ; preds = %20
%37 = load i32*, i32** %5
%38 = call i64 @fclose(i32* %37)
%39 = icmp ne i64 %38, 0
br i1 %39, label %40, label %46
40: ; preds = %36
%41 = load i32, i32* @stderr
%42 = load i32, i32* @errno
%43 = call i8* @strerror(i32 %42)
%44 = call i32 (i32, i8*, i8*, ...) @fprintf(i32 %41, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([140 x i8], [140 x i8]* @.str.3, i64 0, i64 0), i32 236, i8* %43)
%45 = call i32 @exit(i32 -1)
unreachable
46: ; preds = %36
ret void
}

LLVM IR (-O2):
@.str = [2 x i8] c"r\00"
@stderr = global i32 0
@.str.1 = [15 x i8] c"fopen: %s: %s\0A\00"
@errno = global i32 0
@.str.2 = [26 x i8] c"File: %s - Line: %d: %s.\0A\00"
@.str.3 = [140 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/EnderUNIX/spamGuard/refs/heads/master/functions.c\00"
define void @load_ignore_list(i8* %0, i8 signext %1) {
%3 = alloca [1024 x i8]
%4 = getelementptr inbounds [1024 x i8], [1024 x i8]* %3, i64 0, i64 0
%5 = tail call i32* @fopen(i8* %0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%6 = icmp eq i32* %5, null
br i1 %6, label %7, label %13
7: ; preds = %2
%8 = load i32, i32* @stderr
%9 = load i32, i32* @errno
%10 = tail call i8* @strerror(i32 %9)
%11 = tail call i32 (i32, i8*, i8*, ...) @fprintf(i32 %8, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0), i8* %0, i8* %10)
%12 = tail call i32 @exit(i32 -1)
unreachable
13: ; preds = %2
%14 = call i32 @memset(i8* %4, i32 0, i32 1024)
%15 = call i32* @fgets(i8* %4, i32 1024, i32* %5)
%16 = icmp eq i32* %15, null
br i1 %16, label %25, label %17
17: ; preds = %13, %17
%18 = call i32 @strlen(i8* %4)
%19 = call i32 @removespaces(i8* %4, i32 %18)
%20 = call i32 @strdup(i8* %4)
%21 = call i32 @add_ignored(i32 %20, i8 signext %1)
%22 = call i32 @memset(i8* %4, i32 0, i32 1024)
%23 = call i32* @fgets(i8* %4, i32 1024, i32* %5)
%24 = icmp eq i32* %23, null
br i1 %24, label %25, label %17
25: ; preds = %17, %13
%26 = call i64 @fclose(i32* %5)
%27 = icmp eq i64 %26, 0
br i1 %27, label %34, label %28
28: ; preds = %25
%29 = load i32, i32* @stderr
%30 = load i32, i32* @errno
%31 = call i8* @strerror(i32 %30)
%32 = call i32 (i32, i8*, i8*, ...) @fprintf(i32 %29, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([140 x i8], [140 x i8]* @.str.3, i64 0, i64 0), i32 236, i8* %31)
%33 = call i32 @exit(i32 -1)
unreachable
34: ; preds = %25
ret void
}