#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 */
void *maxine_log_dlsym(char const *);
void *maxine_misc_dlsym(char const *);
void *maxine_mm_dlsym(char const *);
void *maxine_monitor_dlsym(char const *);
void *maxine_numerics_dlsym(char const *);
void *maxine_tests_dlsym(char const *);
void *maxine_threads_dlsym(char const *);
void *maxine_time_dlsym(char const *);
void *maxine_traps_dlsym(char const *);
void *maxine_dlsym(const char *symbol) {
  void *result;
  if ((result = maxine_misc_dlsym(symbol)) ||
      (result = maxine_threads_dlsym(symbol)) ||
      (result = maxine_log_dlsym(symbol)) ||
      (result = maxine_monitor_dlsym(symbol)) ||
      (result = maxine_mm_dlsym(symbol)) ||
      (result = maxine_numerics_dlsym(symbol)) ||
      (result = maxine_time_dlsym(symbol)) ||
      (result = maxine_traps_dlsym(symbol)) ||
      (result = maxine_tests_dlsym(symbol))) {
    return result;
  } else {
    return 0;
  }
}


x86 assembly (clang, -O0):
<maxine_dlsym>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   10a0 <maxine_misc_dlsym@plt>
mov    %rax,-0x18(%rbp)
cmp    $0x0,%rax
jne    126b <maxine_dlsym+0xdb>
mov    -0x10(%rbp),%rdi
call   1080 <maxine_threads_dlsym@plt>
mov    %rax,-0x18(%rbp)
cmp    $0x0,%rax
jne    126b <maxine_dlsym+0xdb>
mov    -0x10(%rbp),%rdi
call   1090 <maxine_log_dlsym@plt>
mov    %rax,-0x18(%rbp)
cmp    $0x0,%rax
jne    126b <maxine_dlsym+0xdb>
mov    -0x10(%rbp),%rdi
call   1040 <maxine_monitor_dlsym@plt>
mov    %rax,-0x18(%rbp)
cmp    $0x0,%rax
jne    126b <maxine_dlsym+0xdb>
mov    -0x10(%rbp),%rdi
call   1070 <maxine_mm_dlsym@plt>
mov    %rax,-0x18(%rbp)
cmp    $0x0,%rax
jne    126b <maxine_dlsym+0xdb>
mov    -0x10(%rbp),%rdi
call   1060 <maxine_numerics_dlsym@plt>
mov    %rax,-0x18(%rbp)
cmp    $0x0,%rax
jne    126b <maxine_dlsym+0xdb>
mov    -0x10(%rbp),%rdi
call   10b0 <maxine_time_dlsym@plt>
mov    %rax,-0x18(%rbp)
cmp    $0x0,%rax
jne    126b <maxine_dlsym+0xdb>
mov    -0x10(%rbp),%rdi
call   1030 <maxine_traps_dlsym@plt>
mov    %rax,-0x18(%rbp)
cmp    $0x0,%rax
jne    126b <maxine_dlsym+0xdb>
mov    -0x10(%rbp),%rdi
call   1050 <maxine_tests_dlsym@plt>
mov    %rax,-0x18(%rbp)
cmp    $0x0,%rax
je     1278 <maxine_dlsym+0xe8>
mov    -0x18(%rbp),%rax
mov    %rax,-0x8(%rbp)
jmp    1280 <maxine_dlsym+0xf0>
movq   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<maxine_dlsym>:
push   %rbx
mov    %rdi,%rbx
call   10a0 <maxine_misc_dlsym@plt>
test   %rax,%rax
jne    11f9 <maxine_dlsym+0x69>
mov    %rbx,%rdi
call   1080 <maxine_threads_dlsym@plt>
test   %rax,%rax
jne    11f9 <maxine_dlsym+0x69>
mov    %rbx,%rdi
call   1090 <maxine_log_dlsym@plt>
test   %rax,%rax
jne    11f9 <maxine_dlsym+0x69>
mov    %rbx,%rdi
call   1040 <maxine_monitor_dlsym@plt>
test   %rax,%rax
jne    11f9 <maxine_dlsym+0x69>
mov    %rbx,%rdi
call   1070 <maxine_mm_dlsym@plt>
test   %rax,%rax
jne    11f9 <maxine_dlsym+0x69>
mov    %rbx,%rdi
call   1060 <maxine_numerics_dlsym@plt>
test   %rax,%rax
jne    11f9 <maxine_dlsym+0x69>
mov    %rbx,%rdi
call   10b0 <maxine_time_dlsym@plt>
test   %rax,%rax
jne    11f9 <maxine_dlsym+0x69>
mov    %rbx,%rdi
call   1030 <maxine_traps_dlsym@plt>
test   %rax,%rax
je     11fb <maxine_dlsym+0x6b>
pop    %rbx
ret
mov    %rbx,%rdi
pop    %rbx
jmp    1050 <maxine_tests_dlsym@plt>

LLVM IR (-O0):
define i8* @maxine_dlsym(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %3
%5 = load i8*, i8** %3
%6 = call i8* @maxine_misc_dlsym(i8* %5)
store i8* %6, i8** %4
%7 = icmp ne i8* %6, null
br i1 %7, label %40, label %8
8: ; preds = %1
%9 = load i8*, i8** %3
%10 = call i8* @maxine_threads_dlsym(i8* %9)
store i8* %10, i8** %4
%11 = icmp ne i8* %10, null
br i1 %11, label %40, label %12
12: ; preds = %8
%13 = load i8*, i8** %3
%14 = call i8* @maxine_log_dlsym(i8* %13)
store i8* %14, i8** %4
%15 = icmp ne i8* %14, null
br i1 %15, label %40, label %16
16: ; preds = %12
%17 = load i8*, i8** %3
%18 = call i8* @maxine_monitor_dlsym(i8* %17)
store i8* %18, i8** %4
%19 = icmp ne i8* %18, null
br i1 %19, label %40, label %20
20: ; preds = %16
%21 = load i8*, i8** %3
%22 = call i8* @maxine_mm_dlsym(i8* %21)
store i8* %22, i8** %4
%23 = icmp ne i8* %22, null
br i1 %23, label %40, label %24
24: ; preds = %20
%25 = load i8*, i8** %3
%26 = call i8* @maxine_numerics_dlsym(i8* %25)
store i8* %26, i8** %4
%27 = icmp ne i8* %26, null
br i1 %27, label %40, label %28
28: ; preds = %24
%29 = load i8*, i8** %3
%30 = call i8* @maxine_time_dlsym(i8* %29)
store i8* %30, i8** %4
%31 = icmp ne i8* %30, null
br i1 %31, label %40, label %32
32: ; preds = %28
%33 = load i8*, i8** %3
%34 = call i8* @maxine_traps_dlsym(i8* %33)
store i8* %34, i8** %4
%35 = icmp ne i8* %34, null
br i1 %35, label %40, label %36
36: ; preds = %32
%37 = load i8*, i8** %3
%38 = call i8* @maxine_tests_dlsym(i8* %37)
store i8* %38, i8** %4
%39 = icmp ne i8* %38, null
br i1 %39, label %40, label %42
40: ; preds = %36, %32, %28, %24, %20, %16, %12, %8, %1
%41 = load i8*, i8** %4
store i8* %41, i8** %2
br label %43
42: ; preds = %36
store i8* null, i8** %2
br label %43
43: ; preds = %42, %40
%44 = load i8*, i8** %2
ret i8* %44
}

LLVM IR (-O2):
define i8* @maxine_dlsym(i8* %0) {
%2 = tail call i8* @maxine_misc_dlsym(i8* %0)
%3 = icmp eq i8* %2, null
br i1 %3, label %4, label %27
4: ; preds = %1
%5 = tail call i8* @maxine_threads_dlsym(i8* %0)
%6 = icmp eq i8* %5, null
br i1 %6, label %7, label %27
7: ; preds = %4
%8 = tail call i8* @maxine_log_dlsym(i8* %0)
%9 = icmp eq i8* %8, null
br i1 %9, label %10, label %27
10: ; preds = %7
%11 = tail call i8* @maxine_monitor_dlsym(i8* %0)
%12 = icmp eq i8* %11, null
br i1 %12, label %13, label %27
13: ; preds = %10
%14 = tail call i8* @maxine_mm_dlsym(i8* %0)
%15 = icmp eq i8* %14, null
br i1 %15, label %16, label %27
16: ; preds = %13
%17 = tail call i8* @maxine_numerics_dlsym(i8* %0)
%18 = icmp eq i8* %17, null
br i1 %18, label %19, label %27
19: ; preds = %16
%20 = tail call i8* @maxine_time_dlsym(i8* %0)
%21 = icmp eq i8* %20, null
br i1 %21, label %22, label %27
22: ; preds = %19
%23 = tail call i8* @maxine_traps_dlsym(i8* %0)
%24 = icmp eq i8* %23, null
br i1 %24, label %25, label %27
25: ; preds = %22
%26 = tail call i8* @maxine_tests_dlsym(i8* %0)
br label %27
27: ; preds = %25, %1, %4, %7, %10, %13, %16, %19, %22
%28 = phi i8* [ %2, %1 ], [ %5, %4 ], [ %8, %7 ], [ %11, %10 ], [ %14, %13 ], [ %17, %16 ], [ %20, %19 ], [ %23, %22 ], [ %26, %25 ]
ret i8* %28
}