#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*/ Texlist_Add(char *);
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char const *, char *);
int fscanf(int /*<<< orphan*/ *, char *, char *);
int /*<<< orphan*/ printf(char *, char const *);
void LoadList(const char *filename) {
  printf("Loading list of textures to defullbright from '%s'...\n", filename);
  FILE *f = fopen(filename, "rt");
  if (!f) {
    printf("error opening '%s'\n", filename);
    exit(1);
  }
  char texname[65];
  int fields = 0;
  while ((fields = fscanf(f, "%64s", texname)) == 1) {
    Texlist_Add(texname);
  }
  fclose(f);
}


x86 assembly (clang, -O0):
<LoadList>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rsi
lea    0xe89(%rip),%rdi
call   1040 <printf@plt>
mov    -0x8(%rbp),%rdi
lea    0xeb0(%rip),%rsi
call   1070 <fopen@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    11b5 <LoadList+0x55>
mov    -0x8(%rbp),%rsi
lea    0xe94(%rip),%rdi
call   1040 <printf@plt>
mov    $0x1,%edi
call   1080 <exit@plt>
movl   $0x0,-0x64(%rbp)
mov    -0x10(%rbp),%rdi
lea    -0x60(%rbp),%rdx
lea    0xe83(%rip),%rsi
call   1050 <fscanf@plt>
mov    %eax,-0x64(%rbp)
cmp    $0x1,%eax
jne    11ea <LoadList+0x8a>
lea    -0x60(%rbp),%rdi
call   1060 <Texlist_Add@plt>
jmp    11bc <LoadList+0x5c>
mov    -0x10(%rbp),%rdi
call   1030 <fclose@plt>
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<LoadList>:
push   %r15
push   %r14
push   %rbx
sub    $0x50,%rsp
mov    %rdi,%r14
lea    0xe8d(%rip),%rdi
mov    %r14,%rsi
call   1040 <printf@plt>
lea    0xeb5(%rip),%rsi
mov    %r14,%rdi
call   1070 <fopen@plt>
test   %rax,%rax
je     11ed <LoadList+0x8d>
mov    %rax,%r15
lea    0xeb5(%rip),%rsi
mov    %rsp,%rdx
mov    %rax,%rdi
call   1050 <fscanf@plt>
cmp    $0x1,%eax
jne    11db <LoadList+0x7b>
mov    %rsp,%rbx
lea    0xe9b(%rip),%r14
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    %rbx,%rdi
call   1060 <Texlist_Add@plt>
mov    %r15,%rdi
mov    %r14,%rsi
mov    %rbx,%rdx
call   1050 <fscanf@plt>
cmp    $0x1,%eax
je     11c0 <LoadList+0x60>
mov    %r15,%rdi
call   1030 <fclose@plt>
add    $0x50,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret
lea    0xe46(%rip),%rdi
mov    %r14,%rsi
call   1040 <printf@plt>
mov    $0x1,%edi
call   1080 <exit@plt>

LLVM IR (-O0):
@.str = [55 x i8] c"Loading list of textures to defullbright from '%s'...\0A\00"
@.str.1 = [3 x i8] c"rt\00"
@.str.2 = [20 x i8] c"error opening '%s'\0A\00"
@.str.3 = [5 x i8] c"%64s\00"
define void @LoadList(i8* %0) {
%2 = alloca i8*
%3 = alloca i32*
%4 = alloca [65 x i8]
%5 = alloca i32
store i8* %0, i8** %2
%6 = load i8*, i8** %2
%7 = call i32 @printf(i8* getelementptr inbounds ([55 x i8], [55 x i8]* @.str, i64 0, i64 0), i8* %6)
%8 = load i8*, i8** %2
%9 = call i32* @fopen(i8* %8, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
store i32* %9, i32** %3
%10 = load i32*, i32** %3
%11 = icmp ne i32* %10, null
br i1 %11, label %16, label %12
12: ; preds = %1
%13 = load i8*, i8** %2
%14 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.2, i64 0, i64 0), i8* %13)
%15 = call i32 @exit(i32 1)
unreachable
16: ; preds = %1
store i32 0, i32* %5
br label %17
17: ; preds = %22, %16
%18 = load i32*, i32** %3
%19 = getelementptr inbounds [65 x i8], [65 x i8]* %4, i64 0, i64 0
%20 = call i32 @fscanf(i32* %18, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i8* %19)
store i32 %20, i32* %5
%21 = icmp eq i32 %20, 1
br i1 %21, label %22, label %25
22: ; preds = %17
%23 = getelementptr inbounds [65 x i8], [65 x i8]* %4, i64 0, i64 0
%24 = call i32 @Texlist_Add(i8* %23)
br label %17
25: ; preds = %17
%26 = load i32*, i32** %3
%27 = call i32 @fclose(i32* %26)
ret void
}

LLVM IR (-O2):
@.str = [55 x i8] c"Loading list of textures to defullbright from '%s'...\0A\00"
@.str.1 = [3 x i8] c"rt\00"
@.str.2 = [20 x i8] c"error opening '%s'\0A\00"
@.str.3 = [5 x i8] c"%64s\00"
define void @LoadList(i8* %0) {
%2 = alloca [65 x i8]
%3 = tail call i32 @printf(i8* getelementptr inbounds ([55 x i8], [55 x i8]* @.str, i64 0, i64 0), i8* %0)
%4 = tail call i32* @fopen(i8* %0, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%5 = icmp eq i32* %4, null
br i1 %5, label %6, label %9
6: ; preds = %1
%7 = tail call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.2, i64 0, i64 0), i8* %0)
%8 = tail call i32 @exit(i32 1)
unreachable
9: ; preds = %1
%10 = getelementptr inbounds [65 x i8], [65 x i8]* %2, i64 0, i64 0
%11 = call i32 @fscanf(i32* %4, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i8* %10)
%12 = icmp eq i32 %11, 1
br i1 %12, label %13, label %17
13: ; preds = %9, %13
%14 = call i32 @Texlist_Add(i8* %10)
%15 = call i32 @fscanf(i32* %4, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i8* %10)
%16 = icmp eq i32 %15, 1
br i1 %16, label %13, label %17
17: ; preds = %13, %9
%18 = call i32 @fclose(i32* %4)
ret void
}