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

/* Variables and functions */
int /*<<< orphan*/ uvl_add_uvl_exports();
scalar_t__ uvl_load(char *);
int /*<<< orphan*/ uvl_pre_clean();
scalar_t__ uvl_resolve_add_all_modules(int);
int /*<<< orphan*/ uvl_resolve_table_destroy();
scalar_t__ uvl_resolve_table_initialize();
int /*<<< orphan*/ vita_logf(char *, int, char *);
int uvl_start_load() {
  if (0)
    vita_logf("/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
              "2022-01-22/02-19-57/repos/MrNetrix/UVLoader/refs/heads/master/"
              "uvloader.c",
              180, "Initializing resolve table.");
  if (uvl_resolve_table_initialize() < 0) {
    vita_logf("/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
              "2022-01-22/02-19-57/repos/MrNetrix/UVLoader/refs/heads/master/"
              "uvloader.c",
              183, "Failed to initialize resolve table.");
    return -1;
  }
  if (0)
    vita_logf("/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
              "2022-01-22/02-19-57/repos/MrNetrix/UVLoader/refs/heads/master/"
              "uvloader.c",
              186, "Filling resolve table.");
  if (uvl_resolve_add_all_modules(0x1 | 0x2 | 0x4 | 0x8) < 0) {
    vita_logf("/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
              "2022-01-22/02-19-57/repos/MrNetrix/UVLoader/refs/heads/master/"
              "uvloader.c",
              189, "Cannot cache all loaded entries.");
    return -1;
  }
  if (0)
    vita_logf("/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
              "2022-01-22/02-19-57/repos/MrNetrix/UVLoader/refs/heads/master/"
              "uvloader.c",
              192, "Adding UVL imports.");
  uvl_add_uvl_exports();
  uvl_pre_clean();
  if (0)
    vita_logf("/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
              "2022-01-22/02-19-57/repos/MrNetrix/UVLoader/refs/heads/master/"
              "uvloader.c",
              197, "Loading homebrew.");
  if (uvl_load("cache0:/VitaDefilerClient/Documents/homebrew.self") < 0) {
    return -1;
  }
  if (0)
    vita_logf("/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
              "2022-01-22/02-19-57/repos/MrNetrix/UVLoader/refs/heads/master/"
              "uvloader.c",
              202, "Cleaning up.");
  uvl_resolve_table_destroy();
  return 0;
}


x86 assembly (clang, -O0):
<uvl_start_load>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1050 <uvl_resolve_table_initialize@plt>
cmp    $0x0,%rax
jge    11ad <uvl_start_load+0x3d>
lea    0xe70(%rip),%rdi
mov    $0xb7,%esi
lea    0xeed(%rip),%rdx
call   1040 <vita_logf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    1223 <uvl_start_load+0xb3>
mov    $0xf,%edi
call   1080 <uvl_resolve_add_all_modules@plt>
cmp    $0x0,%rax
jge    11e5 <uvl_start_load+0x75>
lea    0xe38(%rip),%rdi
mov    $0xbd,%esi
lea    0xed9(%rip),%rdx
call   1040 <vita_logf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    1223 <uvl_start_load+0xb3>
mov    $0x0,%al
call   1090 <uvl_add_uvl_exports@plt>
mov    $0x0,%al
call   1060 <uvl_pre_clean@plt>
lea    0xed4(%rip),%rdi
call   1070 <uvl_load@plt>
cmp    $0x0,%rax
jge    1215 <uvl_start_load+0xa5>
movl   $0xffffffff,-0x4(%rbp)
jmp    1223 <uvl_start_load+0xb3>
mov    $0x0,%al
call   1030 <uvl_resolve_table_destroy@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<uvl_start_load>:
push   %rbx
xor    %eax,%eax
call   1050 <uvl_resolve_table_initialize@plt>
test   %rax,%rax
js     11b6 <uvl_start_load+0x46>
mov    $0xf,%edi
call   1080 <uvl_resolve_add_all_modules@plt>
test   %rax,%rax
js     11cb <uvl_start_load+0x5b>
xor    %ebx,%ebx
xor    %eax,%eax
call   1090 <uvl_add_uvl_exports@plt>
xor    %eax,%eax
call   1060 <uvl_pre_clean@plt>
lea    0xf2b(%rip),%rdi
call   1070 <uvl_load@plt>
test   %rax,%rax
js     11e3 <uvl_start_load+0x73>
xor    %eax,%eax
call   1030 <uvl_resolve_table_destroy@plt>
jmp    11e8 <uvl_start_load+0x78>
lea    0xe43(%rip),%rdi
lea    0xec5(%rip),%rdx
mov    $0xb7,%esi
jmp    11de <uvl_start_load+0x6e>
lea    0xe2e(%rip),%rdi
lea    0xed4(%rip),%rdx
mov    $0xbd,%esi
call   1040 <vita_logf@plt>
mov    $0xffffffff,%ebx
mov    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [137 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/MrNetrix/UVLoader/refs/heads/master/uvloader.c\00"
@.str.1 = [36 x i8] c"Failed to initialize resolve table.\00"
@.str.2 = [33 x i8] c"Cannot cache all loaded entries.\00"
@.str.3 = [50 x i8] c"cache0:/VitaDefilerClient/Documents/homebrew.self\00"
define i32 @uvl_start_load() {
%1 = alloca i32
%2 = call i64 (...) @uvl_resolve_table_initialize()
%3 = icmp slt i64 %2, 0
br i1 %3, label %4, label %6
4: ; preds = %0
%5 = call i32 @vita_logf(i8* getelementptr inbounds ([137 x i8], [137 x i8]* @.str, i64 0, i64 0), i32 183, i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.1, i64 0, i64 0))
store i32 -1, i32* %1
br label %19
6: ; preds = %0
%7 = call i64 @uvl_resolve_add_all_modules(i32 15)
%8 = icmp slt i64 %7, 0
br i1 %8, label %9, label %11
9: ; preds = %6
%10 = call i32 @vita_logf(i8* getelementptr inbounds ([137 x i8], [137 x i8]* @.str, i64 0, i64 0), i32 189, i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.2, i64 0, i64 0))
store i32 -1, i32* %1
br label %19
11: ; preds = %6
%12 = call i32 (...) @uvl_add_uvl_exports()
%13 = call i32 (...) @uvl_pre_clean()
%14 = call i64 @uvl_load(i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str.3, i64 0, i64 0))
%15 = icmp slt i64 %14, 0
br i1 %15, label %16, label %17
16: ; preds = %11
store i32 -1, i32* %1
br label %19
17: ; preds = %11
%18 = call i32 (...) @uvl_resolve_table_destroy()
store i32 0, i32* %1
br label %19
19: ; preds = %17, %16, %9, %4
%20 = load i32, i32* %1
ret i32 %20
}

LLVM IR (-O2):
@.str = [137 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/MrNetrix/UVLoader/refs/heads/master/uvloader.c\00"
@.str.1 = [36 x i8] c"Failed to initialize resolve table.\00"
@.str.2 = [33 x i8] c"Cannot cache all loaded entries.\00"
@.str.3 = [50 x i8] c"cache0:/VitaDefilerClient/Documents/homebrew.self\00"
define i32 @uvl_start_load() {
%1 = tail call i64 (...) @uvl_resolve_table_initialize()
%2 = icmp slt i64 %1, 0
br i1 %2, label %3, label %5
3: ; preds = %0
%4 = tail call i32 @vita_logf(i8* getelementptr inbounds ([137 x i8], [137 x i8]* @.str, i64 0, i64 0), i32 183, i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.1, i64 0, i64 0))
br label %17
5: ; preds = %0
%6 = tail call i64 @uvl_resolve_add_all_modules(i32 15)
%7 = icmp slt i64 %6, 0
br i1 %7, label %8, label %10
8: ; preds = %5
%9 = tail call i32 @vita_logf(i8* getelementptr inbounds ([137 x i8], [137 x i8]* @.str, i64 0, i64 0), i32 189, i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.2, i64 0, i64 0))
br label %17
10: ; preds = %5
%11 = tail call i32 (...) @uvl_add_uvl_exports()
%12 = tail call i32 (...) @uvl_pre_clean()
%13 = tail call i64 @uvl_load(i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str.3, i64 0, i64 0))
%14 = icmp slt i64 %13, 0
br i1 %14, label %17, label %15
15: ; preds = %10
%16 = tail call i32 (...) @uvl_resolve_table_destroy()
br label %17
17: ; preds = %10, %15, %8, %3
%18 = phi i32 [ -1, %3 ], [ -1, %8 ], [ 0, %15 ], [ -1, %10 ]
ret i32 %18
}