#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*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ read_export_file(int /*<<< orphan*/ *);
int /*<<< orphan*/ warn(char *, char *);
void load_exports(char **files, size_t count) {
  size_t indx;
  for (indx = 0; indx < count; indx++) {
    char *exp_file = files[indx];
    FILE *fp = fopen(exp_file, "r");
    if (fp == NULL) {
      warn("Could not open %s", exp_file);
    }
    read_export_file(fp);
    fclose(fp);
  }
  return;
}


x86 assembly (clang, -O0):
<load_exports>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movq   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%rax
cmp    -0x10(%rbp),%rax
jae    11c8 <load_exports+0x88>
mov    -0x8(%rbp),%rax
mov    -0x18(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rdi
lea    0xe7f(%rip),%rsi
call   1060 <fopen@plt>
mov    %rax,-0x28(%rbp)
cmpq   $0x0,-0x28(%rbp)
jne    11a5 <load_exports+0x65>
mov    -0x20(%rbp),%rsi
lea    0xe62(%rip),%rdi
call   1030 <warn@plt>
mov    -0x28(%rbp),%rdi
call   1050 <read_export_file@plt>
mov    -0x28(%rbp),%rdi
call   1040 <fclose@plt>
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    1158 <load_exports+0x18>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<load_exports>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
test   %rsi,%rsi
je     11b1 <load_exports+0x71>
mov    %rsi,%r13
mov    %rdi,%r14
xor    %r12d,%r12d
lea    0xea0(%rip),%r15
jmp    1189 <load_exports+0x49>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    %rbx,%rdi
call   1050 <read_export_file@plt>
mov    %rbx,%rdi
call   1040 <fclose@plt>
add    $0x1,%r12
cmp    %r12,%r13
je     11b1 <load_exports+0x71>
mov    (%r14,%r12,8),%rbp
mov    %rbp,%rdi
mov    %r15,%rsi
call   1060 <fopen@plt>
mov    %rax,%rbx
test   %rax,%rax
jne    1170 <load_exports+0x30>
lea    0xe5b(%rip),%rdi
mov    %rbp,%rsi
call   1030 <warn@plt>
jmp    1170 <load_exports+0x30>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [2 x i8] c"r\00"
@.str.1 = [18 x i8] c"Could not open %s\00"
define void @load_exports(i8** %0, i64 %1) {
%3 = alloca i8**
%4 = alloca i64
%5 = alloca i64
%6 = alloca i8*
%7 = alloca i32*
store i8** %0, i8*** %3
store i64 %1, i64* %4
store i64 0, i64* %5
br label %8
8: ; preds = %29, %2
%9 = load i64, i64* %5
%10 = load i64, i64* %4
%11 = icmp ult i64 %9, %10
br i1 %11, label %12, label %32
12: ; preds = %8
%13 = load i8**, i8*** %3
%14 = load i64, i64* %5
%15 = getelementptr inbounds i8*, i8** %13, i64 %14
%16 = load i8*, i8** %15
store i8* %16, i8** %6
%17 = load i8*, i8** %6
%18 = call i32* @fopen(i8* %17, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
store i32* %18, i32** %7
%19 = load i32*, i32** %7
%20 = icmp eq i32* %19, null
br i1 %20, label %21, label %24
21: ; preds = %12
%22 = load i8*, i8** %6
%23 = call i32 @warn(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0), i8* %22)
br label %24
24: ; preds = %21, %12
%25 = load i32*, i32** %7
%26 = call i32 @read_export_file(i32* %25)
%27 = load i32*, i32** %7
%28 = call i32 @fclose(i32* %27)
br label %29
29: ; preds = %24
%30 = load i64, i64* %5
%31 = add i64 %30, 1
store i64 %31, i64* %5
br label %8
32: ; preds = %8
ret void
}

LLVM IR (-O2):
@.str = [2 x i8] c"r\00"
@.str.1 = [18 x i8] c"Could not open %s\00"
define void @load_exports(i8** nocapture %0, i64 %1) {
%3 = icmp eq i64 %1, 0
br i1 %3, label %17, label %4
4: ; preds = %2, %12
%5 = phi i64 [ %15, %12 ], [ 0, %2 ]
%6 = getelementptr inbounds i8*, i8** %0, i64 %5
%7 = load i8*, i8** %6
%8 = tail call i32* @fopen(i8* %7, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%9 = icmp eq i32* %8, null
br i1 %9, label %10, label %12
10: ; preds = %4
%11 = tail call i32 @warn(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0), i8* %7)
br label %12
12: ; preds = %10, %4
%13 = tail call i32 @read_export_file(i32* %8)
%14 = tail call i32 @fclose(i32* %8)
%15 = add nuw i64 %5, 1
%16 = icmp eq i64 %15, %1
br i1 %16, label %17, label %4
17: ; preds = %12, %2
ret void
}