#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 */
typedef struct TYPE_3__ TYPE_1__;

/* Type definitions */
struct TYPE_3__ {
  char *filename;
  char *name;
  int ref_count;
};
typedef TYPE_1__ lt_dlinfo;
typedef int /*<<< orphan*/ lt_dlhandle;

/* Variables and functions */
scalar_t__ atol(char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
int /*<<< orphan*/ getcwd(char *, int);
scalar_t__ lt_dlclose(int /*<<< orphan*/);
char *lt_dlerror();
int /*<<< orphan*/ lt_dlexit();
TYPE_1__ *lt_dlgetinfo(int /*<<< orphan*/);
char *lt_dlgetsearchpath();
scalar_t__ lt_dlinit();
int /*<<< orphan*/ lt_dlopen(char *);
int /*<<< orphan*/ lt_dlsetsearchpath(char *);
int /*<<< orphan*/ memset(char *, int /*<<< orphan*/, int);
void *my_dlsym(int /*<<< orphan*/, char *);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ strncat(char *, char *, int);
int main(int argc, char *argv[]) {
  char modulepath[1024];
  int *size;
  int *pause;
  int *repeat;
  lt_dlhandle module;
  const lt_dlinfo *info;
  int (*wave)(void);
  if (argc < 5) {
    fprintf(stderr, "Usage: %s MODULENAME <size> <repeat> <pause>\n", argv[0]);
    return (1);
  };
  if (lt_dlinit()) {
    fprintf(stderr, "lt_dlinit(): %s\n", lt_dlerror());
    lt_dlexit();
    return (1);
  };
  memset(modulepath, 0, 1024);
  getcwd(modulepath, 1023);
  strncat(modulepath, "/", 1023);
  lt_dlsetsearchpath(modulepath);
  printf("DL Data:\n");
  printf("  Search Path:           %s\n", lt_dlgetsearchpath());
  printf("\n");
  if (!(module = lt_dlopen(argv[1]))) {
    fprintf(stderr, "lt_dlopen(): %s\n", lt_dlerror());
    lt_dlexit();
    return (1);
  };
  if (!(info = lt_dlgetinfo(module))) {
    fprintf(stderr, "lt_dlgetinfo(): %s\n", lt_dlerror());
    lt_dlexit();
    return (1);
  };
  printf("DL Module Data:\n");
  printf("   Opened:               %s\n", argv[1]);
  printf("   File Name:            %s\n", info->filename);
  printf("   Module Name:          %s\n", info->name);
  printf("   Reference Count:      %i\n", info->ref_count);
  printf("   Available Functions:\n");
  size = my_dlsym(module, "size");
  pause = my_dlsym(module, "pause");
  repeat = my_dlsym(module, "repeat");
  wave = my_dlsym(module, "wave");
  printf("\n");
  if (size) {
    *size = (int)atol(argv[2]);
    printf("setting size to    argv[2] (%i)\n", *size);
  };
  if (repeat) {
    *repeat = (int)atol(argv[3]);
    printf("setting repeat to  argv[3] (%i)\n", *repeat);
  };
  if (pause) {
    *pause = (int)atol(argv[4]);
    printf("setting pause to   argv[4] (%i)\n", *pause);
  };
  if (wave) {
    printf("running wave()...\n");
    wave();
  };
  if ((lt_dlclose(module))) {
    fprintf(stderr, "lt_dlclose(): %s\n", lt_dlerror());
    lt_dlexit();
    return (1);
  };
  lt_dlexit();
  return (0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x450,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x5,-0x8(%rbp)
jge    123b <main+0x4b>
mov    0x2dc6(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
lea    0xdd6(%rip),%rsi
call   10a0 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
jmp    15e1 <main+0x3f1>
mov    $0x0,%al
call   10d0 <lt_dlinit@plt>
cmp    $0x0,%rax
je     128a <main+0x9a>
mov    0x2d8d(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x444(%rbp)
mov    $0x0,%al
call   1040 <lt_dlerror@plt>
mov    -0x444(%rbp),%edi
mov    %rax,%rdx
lea    0xdbc(%rip),%rsi
call   10a0 <fprintf@plt>
mov    $0x0,%al
call   1100 <lt_dlexit@plt>
movl   $0x1,-0x4(%rbp)
jmp    15e1 <main+0x3f1>
lea    -0x410(%rbp),%rdi
xor    %esi,%esi
mov    $0x400,%edx
call   1070 <memset@plt>
lea    -0x410(%rbp),%rdi
mov    $0x3ff,%esi
call   1080 <getcwd@plt>
lea    -0x410(%rbp),%rdi
lea    0xd83(%rip),%rsi
mov    $0x3ff,%edx
call   1090 <strncat@plt>
lea    -0x410(%rbp),%rdi
call   1110 <lt_dlsetsearchpath@plt>
lea    0xd68(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    $0x0,%al
call   10b0 <lt_dlgetsearchpath@plt>
mov    %rax,%rsi
lea    0xd5a(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
lea    0xe62(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   10c0 <lt_dlopen@plt>
mov    %eax,-0x42c(%rbp)
cmp    $0x0,%eax
jne    1360 <main+0x170>
mov    0x2cb7(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x448(%rbp)
mov    $0x0,%al
call   1040 <lt_dlerror@plt>
mov    -0x448(%rbp),%edi
mov    %rax,%rdx
lea    0xd20(%rip),%rsi
call   10a0 <fprintf@plt>
mov    $0x0,%al
call   1100 <lt_dlexit@plt>
movl   $0x1,-0x4(%rbp)
jmp    15e1 <main+0x3f1>
mov    -0x42c(%rbp),%edi
call   10e0 <lt_dlgetinfo@plt>
mov    %rax,-0x438(%rbp)
cmp    $0x0,%rax
jne    13ba <main+0x1ca>
mov    0x2c5d(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x44c(%rbp)
mov    $0x0,%al
call   1040 <lt_dlerror@plt>
mov    -0x44c(%rbp),%edi
mov    %rax,%rdx
lea    0xcd7(%rip),%rsi
call   10a0 <fprintf@plt>
mov    $0x0,%al
call   1100 <lt_dlexit@plt>
movl   $0x1,-0x4(%rbp)
jmp    15e1 <main+0x3f1>
lea    0xccc(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rsi
lea    0xcc7(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    -0x438(%rbp),%rax
mov    (%rax),%rsi
lea    0xccc(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    -0x438(%rbp),%rax
mov    0x8(%rax),%rsi
lea    0xcd0(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    -0x438(%rbp),%rax
mov    0x10(%rax),%esi
lea    0xcd5(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
lea    0xce4(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    -0x42c(%rbp),%edi
lea    0xce9(%rip),%rsi
call   1050 <my_dlsym@plt>
mov    %rax,-0x418(%rbp)
mov    -0x42c(%rbp),%edi
lea    0xcd5(%rip),%rsi
call   1050 <my_dlsym@plt>
mov    %rax,-0x420(%rbp)
mov    -0x42c(%rbp),%edi
lea    0xcc2(%rip),%rsi
call   1050 <my_dlsym@plt>
mov    %rax,-0x428(%rbp)
mov    -0x42c(%rbp),%edi
lea    0xcb0(%rip),%rsi
call   1050 <my_dlsym@plt>
mov    %rax,-0x440(%rbp)
lea    0xcc1(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
cmpq   $0x0,-0x418(%rbp)
je     14e4 <main+0x2f4>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
call   10f0 <atol@plt>
mov    %eax,%ecx
mov    -0x418(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x418(%rbp),%rax
mov    (%rax),%esi
lea    0xc65(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
cmpq   $0x0,-0x428(%rbp)
je     1521 <main+0x331>
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rdi
call   10f0 <atol@plt>
mov    %eax,%ecx
mov    -0x428(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x428(%rbp),%rax
mov    (%rax),%esi
lea    0xc49(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
cmpq   $0x0,-0x420(%rbp)
je     155e <main+0x36e>
mov    -0x10(%rbp),%rax
mov    0x20(%rax),%rdi
call   10f0 <atol@plt>
mov    %eax,%ecx
mov    -0x420(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x420(%rbp),%rax
mov    (%rax),%esi
lea    0xc2d(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
cmpq   $0x0,-0x440(%rbp)
je     1580 <main+0x390>
lea    0xc32(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
call   *-0x440(%rbp)
mov    -0x42c(%rbp),%edi
call   1030 <lt_dlclose@plt>
cmp    $0x0,%rax
je     15d3 <main+0x3e3>
mov    0x2a44(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x450(%rbp)
mov    $0x0,%al
call   1040 <lt_dlerror@plt>
mov    -0x450(%rbp),%edi
mov    %rax,%rdx
lea    0xbfd(%rip),%rsi
call   10a0 <fprintf@plt>
mov    $0x0,%al
call   1100 <lt_dlexit@plt>
movl   $0x1,-0x4(%rbp)
jmp    15e1 <main+0x3f1>
mov    $0x0,%al
call   1100 <lt_dlexit@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x450,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x408,%rsp
mov    %rsi,%rbx
cmp    $0x4,%edi
jg     1243 <main+0x33>
mov    0x2db0(%rip),%rax
mov    (%rax),%edi
mov    (%rbx),%rdx
lea    0xdc4(%rip),%rsi
call   10c0 <fprintf@plt>
jmp    1277 <main+0x67>
xor    %eax,%eax
call   10f0 <lt_dlinit@plt>
test   %rax,%rax
je     1290 <main+0x80>
mov    0x2d8a(%rip),%rax
mov    (%rax),%ebx
xor    %eax,%eax
call   1060 <lt_dlerror@plt>
lea    0xdc8(%rip),%rsi
mov    %ebx,%edi
mov    %rax,%rdx
call   10c0 <fprintf@plt>
xor    %eax,%eax
call   1120 <lt_dlexit@plt>
mov    $0x1,%ebx
mov    %ebx,%eax
add    $0x408,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    %rsp,%rbp
mov    %rbp,%rdi
xor    %esi,%esi
mov    $0x400,%edx
call   1090 <memset@plt>
mov    %rbp,%rdi
mov    $0x3ff,%esi
call   10a0 <getcwd@plt>
lea    0xd89(%rip),%rsi
mov    %rbp,%rdi
mov    $0x3ff,%edx
call   10b0 <strncat@plt>
mov    %rbp,%rdi
call   1130 <lt_dlsetsearchpath@plt>
lea    0xeb1(%rip),%rdi
call   1050 <puts@plt>
xor    %eax,%eax
call   10d0 <lt_dlgetsearchpath@plt>
lea    0xd5c(%rip),%rdi
mov    %rax,%rsi
xor    %eax,%eax
call   1080 <printf@plt>
mov    $0xa,%edi
call   1040 <putchar@plt>
mov    0x8(%rbx),%rdi
call   10e0 <lt_dlopen@plt>
test   %eax,%eax
je     1472 <main+0x262>
mov    %eax,%r14d
mov    %eax,%edi
call   1100 <lt_dlgetinfo@plt>
test   %rax,%rax
je     148e <main+0x27e>
mov    %rax,%rbp
lea    0xe65(%rip),%rdi
call   1050 <puts@plt>
mov    0x8(%rbx),%rsi
lea    0xd4c(%rip),%rdi
xor    %eax,%eax
call   1080 <printf@plt>
mov    0x0(%rbp),%rsi
lea    0xd57(%rip),%rdi
xor    %eax,%eax
call   1080 <printf@plt>
mov    0x8(%rbp),%rsi
lea    0xd62(%rip),%rdi
xor    %eax,%eax
call   1080 <printf@plt>
mov    0x10(%rbp),%esi
lea    0xd6e(%rip),%rdi
xor    %eax,%eax
call   1080 <printf@plt>
lea    0xe22(%rip),%rdi
call   1050 <puts@plt>
lea    0xd71(%rip),%rsi
mov    %r14d,%edi
call   1070 <my_dlsym@plt>
mov    %rax,%r13
lea    0xd64(%rip),%rsi
mov    %r14d,%edi
call   1070 <my_dlsym@plt>
mov    %rax,%r15
lea    0xd58(%rip),%rsi
mov    %r14d,%edi
call   1070 <my_dlsym@plt>
mov    %rax,%r12
lea    0xd4d(%rip),%rsi
mov    %r14d,%edi
call   1070 <my_dlsym@plt>
mov    %rax,%rbp
mov    $0xa,%edi
call   1040 <putchar@plt>
test   %r13,%r13
je     13f3 <main+0x1e3>
mov    0x10(%rbx),%rdi
call   1110 <atol@plt>
mov    %eax,0x0(%r13)
lea    0xd24(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1080 <printf@plt>
test   %r12,%r12
je     1415 <main+0x205>
mov    0x18(%rbx),%rdi
call   1110 <atol@plt>
mov    %eax,(%r12)
lea    0xd23(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1080 <printf@plt>
test   %r15,%r15
je     1436 <main+0x226>
mov    0x20(%rbx),%rdi
call   1110 <atol@plt>
mov    %eax,(%r15)
lea    0xd23(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1080 <printf@plt>
test   %rbp,%rbp
je     1449 <main+0x239>
lea    0xd72(%rip),%rdi
call   1050 <puts@plt>
call   *%rbp
mov    %r14d,%edi
call   1030 <lt_dlclose@plt>
test   %rax,%rax
je     14aa <main+0x29a>
mov    0x2b83(%rip),%rax
mov    (%rax),%ebx
xor    %eax,%eax
call   1060 <lt_dlerror@plt>
lea    0xd04(%rip),%rsi
jmp    1266 <main+0x56>
mov    0x2b67(%rip),%rax
mov    (%rax),%ebx
xor    %eax,%eax
call   1060 <lt_dlerror@plt>
lea    0xbd5(%rip),%rsi
jmp    1266 <main+0x56>
mov    0x2b4b(%rip),%rax
mov    (%rax),%ebx
xor    %eax,%eax
call   1060 <lt_dlerror@plt>
lea    0xbca(%rip),%rsi
jmp    1266 <main+0x56>
xor    %ebx,%ebx
xor    %eax,%eax
call   1120 <lt_dlexit@plt>
jmp    127c <main+0x6c>

LLVM IR (-O0):
%struct.TYPE_3__ = type { i8*, i8*, i32 }
@stderr = global i32 0
@.str = [46 x i8] c"Usage: %s MODULENAME <size> <repeat> <pause>\0A\00"
@.str.1 = [17 x i8] c"lt_dlinit(): %s\0A\00"
@.str.2 = [2 x i8] c"/\00"
@.str.3 = [10 x i8] c"DL Data:\0A\00"
@.str.4 = [29 x i8] c" Search Path: %s\0A\00"
@.str.5 = [2 x i8] c"\0A\00"
@.str.6 = [17 x i8] c"lt_dlopen(): %s\0A\00"
@.str.7 = [20 x i8] c"lt_dlgetinfo(): %s\0A\00"
@.str.8 = [17 x i8] c"DL Module Data:\0A\00"
@.str.9 = [29 x i8] c" Opened: %s\0A\00"
@.str.10 = [29 x i8] c" File Name: %s\0A\00"
@.str.11 = [29 x i8] c" Module Name: %s\0A\00"
@.str.12 = [29 x i8] c" Reference Count: %i\0A\00"
@.str.13 = [25 x i8] c" Available Functions:\0A\00"
@.str.14 = [5 x i8] c"size\00"
@.str.15 = [6 x i8] c"pause\00"
@.str.16 = [7 x i8] c"repeat\00"
@.str.17 = [5 x i8] c"wave\00"
@.str.18 = [33 x i8] c"setting size to argv[2] (%i)\0A\00"
@.str.19 = [33 x i8] c"setting repeat to argv[3] (%i)\0A\00"
@.str.20 = [33 x i8] c"setting pause to argv[4] (%i)\0A\00"
@.str.21 = [19 x i8] c"running wave()...\0A\00"
@.str.22 = [18 x i8] c"lt_dlclose(): %s\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [1024 x i8]
%7 = alloca i32*
%8 = alloca i32*
%9 = alloca i32*
%10 = alloca i32
%11 = alloca %struct.TYPE_3__*
%12 = alloca i32 ()*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%13 = load i32, i32* %4
%14 = icmp slt i32 %13, 5
br i1 %14, label %15, label %21
15: ; preds = %2
%16 = load i32, i32* @stderr
%17 = load i8**, i8*** %5
%18 = getelementptr inbounds i8*, i8** %17, i64 0
%19 = load i8*, i8** %18
%20 = call i32 @fprintf(i32 %16, i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str, i64 0, i64 0), i8* %19)
store i32 1, i32* %3
br label %149
21: ; preds = %2
%22 = call i64 (...) @lt_dlinit()
%23 = icmp ne i64 %22, 0
br i1 %23, label %24, label %29
24: ; preds = %21
%25 = load i32, i32* @stderr
%26 = call i8* (...) @lt_dlerror()
%27 = call i32 @fprintf(i32 %25, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0), i8* %26)
%28 = call i32 (...) @lt_dlexit()
store i32 1, i32* %3
br label %149
29: ; preds = %21
%30 = getelementptr inbounds [1024 x i8], [1024 x i8]* %6, i64 0, i64 0
%31 = call i32 @memset(i8* %30, i32 0, i32 1024)
%32 = getelementptr inbounds [1024 x i8], [1024 x i8]* %6, i64 0, i64 0
%33 = call i32 @getcwd(i8* %32, i32 1023)
%34 = getelementptr inbounds [1024 x i8], [1024 x i8]* %6, i64 0, i64 0
%35 = call i32 @strncat(i8* %34, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0), i32 1023)
%36 = getelementptr inbounds [1024 x i8], [1024 x i8]* %6, i64 0, i64 0
%37 = call i32 @lt_dlsetsearchpath(i8* %36)
%38 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0))
%39 = call i8* (...) @lt_dlgetsearchpath()
%40 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.4, i64 0, i64 0), i8* %39)
%41 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
%42 = load i8**, i8*** %5
%43 = getelementptr inbounds i8*, i8** %42, i64 1
%44 = load i8*, i8** %43
%45 = call i32 @lt_dlopen(i8* %44)
store i32 %45, i32* %10
%46 = icmp ne i32 %45, 0
br i1 %46, label %52, label %47
47: ; preds = %29
%48 = load i32, i32* @stderr
%49 = call i8* (...) @lt_dlerror()
%50 = call i32 @fprintf(i32 %48, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.6, i64 0, i64 0), i8* %49)
%51 = call i32 (...) @lt_dlexit()
store i32 1, i32* %3
br label %149
52: ; preds = %29
%53 = load i32, i32* %10
%54 = call %struct.TYPE_3__* @lt_dlgetinfo(i32 %53)
store %struct.TYPE_3__* %54, %struct.TYPE_3__** %11
%55 = icmp ne %struct.TYPE_3__* %54, null
br i1 %55, label %61, label %56
56: ; preds = %52
%57 = load i32, i32* @stderr
%58 = call i8* (...) @lt_dlerror()
%59 = call i32 @fprintf(i32 %57, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.7, i64 0, i64 0), i8* %58)
%60 = call i32 (...) @lt_dlexit()
store i32 1, i32* %3
br label %149
61: ; preds = %52
%62 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.8, i64 0, i64 0))
%63 = load i8**, i8*** %5
%64 = getelementptr inbounds i8*, i8** %63, i64 1
%65 = load i8*, i8** %64
%66 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.9, i64 0, i64 0), i8* %65)
%67 = load %struct.TYPE_3__*, %struct.TYPE_3__** %11
%68 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %67, i32 0, i32 0
%69 = load i8*, i8** %68
%70 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.10, i64 0, i64 0), i8* %69)
%71 = load %struct.TYPE_3__*, %struct.TYPE_3__** %11
%72 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %71, i32 0, i32 1
%73 = load i8*, i8** %72
%74 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.11, i64 0, i64 0), i8* %73)
%75 = load %struct.TYPE_3__*, %struct.TYPE_3__** %11
%76 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %75, i32 0, i32 2
%77 = load i32, i32* %76
%78 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.12, i64 0, i64 0), i32 %77)
%79 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.13, i64 0, i64 0))
%80 = load i32, i32* %10
%81 = call i8* @my_dlsym(i32 %80, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.14, i64 0, i64 0))
%82 = bitcast i8* %81 to i32*
store i32* %82, i32** %7
%83 = load i32, i32* %10
%84 = call i8* @my_dlsym(i32 %83, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.15, i64 0, i64 0))
%85 = bitcast i8* %84 to i32*
store i32* %85, i32** %8
%86 = load i32, i32* %10
%87 = call i8* @my_dlsym(i32 %86, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.16, i64 0, i64 0))
%88 = bitcast i8* %87 to i32*
store i32* %88, i32** %9
%89 = load i32, i32* %10
%90 = call i8* @my_dlsym(i32 %89, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.17, i64 0, i64 0))
%91 = bitcast i8* %90 to i32 ()*
store i32 ()* %91, i32 ()** %12
%92 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
%93 = load i32*, i32** %7
%94 = icmp ne i32* %93, null
br i1 %94, label %95, label %105
95: ; preds = %61
%96 = load i8**, i8*** %5
%97 = getelementptr inbounds i8*, i8** %96, i64 2
%98 = load i8*, i8** %97
%99 = call i64 @atol(i8* %98)
%100 = trunc i64 %99 to i32
%101 = load i32*, i32** %7
store i32 %100, i32* %101
%102 = load i32*, i32** %7
%103 = load i32, i32* %102
%104 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.18, i64 0, i64 0), i32 %103)
br label %105
105: ; preds = %95, %61
%106 = load i32*, i32** %9
%107 = icmp ne i32* %106, null
br i1 %107, label %108, label %118
108: ; preds = %105
%109 = load i8**, i8*** %5
%110 = getelementptr inbounds i8*, i8** %109, i64 3
%111 = load i8*, i8** %110
%112 = call i64 @atol(i8* %111)
%113 = trunc i64 %112 to i32
%114 = load i32*, i32** %9
store i32 %113, i32* %114
%115 = load i32*, i32** %9
%116 = load i32, i32* %115
%117 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.19, i64 0, i64 0), i32 %116)
br label %118
118: ; preds = %108, %105
%119 = load i32*, i32** %8
%120 = icmp ne i32* %119, null
br i1 %120, label %121, label %131
121: ; preds = %118
%122 = load i8**, i8*** %5
%123 = getelementptr inbounds i8*, i8** %122, i64 4
%124 = load i8*, i8** %123
%125 = call i64 @atol(i8* %124)
%126 = trunc i64 %125 to i32
%127 = load i32*, i32** %8
store i32 %126, i32* %127
%128 = load i32*, i32** %8
%129 = load i32, i32* %128
%130 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.20, i64 0, i64 0), i32 %129)
br label %131
131: ; preds = %121, %118
%132 = load i32 ()*, i32 ()** %12
%133 = icmp ne i32 ()* %132, null
br i1 %133, label %134, label %138
134: ; preds = %131
%135 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.21, i64 0, i64 0))
%136 = load i32 ()*, i32 ()** %12
%137 = call i32 %136()
br label %138
138: ; preds = %134, %131
%139 = load i32, i32* %10
%140 = call i64 @lt_dlclose(i32 %139)
%141 = icmp ne i64 %140, 0
br i1 %141, label %142, label %147
142: ; preds = %138
%143 = load i32, i32* @stderr
%144 = call i8* (...) @lt_dlerror()
%145 = call i32 @fprintf(i32 %143, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.22, i64 0, i64 0), i8* %144)
%146 = call i32 (...) @lt_dlexit()
store i32 1, i32* %3
br label %149
147: ; preds = %138
%148 = call i32 (...) @lt_dlexit()
store i32 0, i32* %3
br label %149
149: ; preds = %147, %142, %56, %47, %24, %15
%150 = load i32, i32* %3
ret i32 %150
}

LLVM IR (-O2):
%struct.TYPE_3__ = type { i8*, i8*, i32 }
@stderr = global i32 0
@.str = [46 x i8] c"Usage: %s MODULENAME <size> <repeat> <pause>\0A\00"
@.str.1 = [17 x i8] c"lt_dlinit(): %s\0A\00"
@.str.2 = [2 x i8] c"/\00"
@.str.4 = [29 x i8] c" Search Path: %s\0A\00"
@.str.6 = [17 x i8] c"lt_dlopen(): %s\0A\00"
@.str.7 = [20 x i8] c"lt_dlgetinfo(): %s\0A\00"
@.str.9 = [29 x i8] c" Opened: %s\0A\00"
@.str.10 = [29 x i8] c" File Name: %s\0A\00"
@.str.11 = [29 x i8] c" Module Name: %s\0A\00"
@.str.12 = [29 x i8] c" Reference Count: %i\0A\00"
@.str.14 = [5 x i8] c"size\00"
@.str.15 = [6 x i8] c"pause\00"
@.str.16 = [7 x i8] c"repeat\00"
@.str.17 = [5 x i8] c"wave\00"
@.str.18 = [33 x i8] c"setting size to argv[2] (%i)\0A\00"
@.str.19 = [33 x i8] c"setting repeat to argv[3] (%i)\0A\00"
@.str.20 = [33 x i8] c"setting pause to argv[4] (%i)\0A\00"
@.str.22 = [18 x i8] c"lt_dlclose(): %s\0A\00"
@str = [9 x i8] c"DL Data:\00"
@str.23 = [16 x i8] c"DL Module Data:\00"
@str.24 = [24 x i8] c" Available Functions:\00"
@str.25 = [18 x i8] c"running wave()...\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca [1024 x i8]
%4 = getelementptr inbounds [1024 x i8], [1024 x i8]* %3, i64 0, i64 0
%5 = icmp slt i32 %0, 5
br i1 %5, label %6, label %10
6: ; preds = %2
%7 = load i32, i32* @stderr
%8 = load i8*, i8** %1
%9 = tail call i32 @fprintf(i32 %7, i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str, i64 0, i64 0), i8* %8)
br label %105
10: ; preds = %2
%11 = tail call i64 (...) @lt_dlinit()
%12 = icmp eq i64 %11, 0
br i1 %12, label %18, label %13
13: ; preds = %10
%14 = load i32, i32* @stderr
%15 = tail call i8* (...) @lt_dlerror()
%16 = tail call i32 @fprintf(i32 %14, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0), i8* %15)
%17 = tail call i32 (...) @lt_dlexit()
br label %105
18: ; preds = %10
%19 = call i32 @memset(i8* %4, i32 0, i32 1024)
%20 = call i32 @getcwd(i8* %4, i32 1023)
%21 = call i32 @strncat(i8* %4, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0), i32 1023)
%22 = call i32 @lt_dlsetsearchpath(i8* %4)
%23 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @str, i64 0, i64 0))
%24 = call i8* (...) @lt_dlgetsearchpath()
%25 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @.str.4, i64 0, i64 0), i8* %24)
%26 = call i32 @putchar(i32 10)
%27 = getelementptr inbounds i8*, i8** %1, i64 1
%28 = load i8*, i8** %27
%29 = call i32 @lt_dlopen(i8* %28)
%30 = icmp eq i32 %29, 0
br i1 %30, label %31, label %36
31: ; preds = %18
%32 = load i32, i32* @stderr
%33 = call i8* (...) @lt_dlerror()
%34 = call i32 @fprintf(i32 %32, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.6, i64 0, i64 0), i8* %33)
%35 = call i32 (...) @lt_dlexit()
br label %105
36: ; preds = %18
%37 = call %struct.TYPE_3__* @lt_dlgetinfo(i32 %29)
%38 = icmp eq %struct.TYPE_3__* %37, null
br i1 %38, label %39, label %44
39: ; preds = %36
%40 = load i32, i32* @stderr
%41 = call i8* (...) @lt_dlerror()
%42 = call i32 @fprintf(i32 %40, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.7, i64 0, i64 0), i8* %41)
%43 = call i32 (...) @lt_dlexit()
br label %105
44: ; preds = %36
%45 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @str.23, i64 0, i64 0))
%46 = load i8*, i8** %27
%47 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @.str.9, i64 0, i64 0), i8* %46)
%48 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %37, i64 0, i32 0
%49 = load i8*, i8** %48
%50 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @.str.10, i64 0, i64 0), i8* %49)
%51 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %37, i64 0, i32 1
%52 = load i8*, i8** %51
%53 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @.str.11, i64 0, i64 0), i8* %52)
%54 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %37, i64 0, i32 2
%55 = load i32, i32* %54
%56 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @.str.12, i64 0, i64 0), i32 %55)
%57 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @str.24, i64 0, i64 0))
%58 = call i8* @my_dlsym(i32 %29, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.14, i64 0, i64 0))
%59 = call i8* @my_dlsym(i32 %29, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.15, i64 0, i64 0))
%60 = bitcast i8* %59 to i32*
%61 = call i8* @my_dlsym(i32 %29, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.16, i64 0, i64 0))
%62 = bitcast i8* %61 to i32*
%63 = call i8* @my_dlsym(i32 %29, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.17, i64 0, i64 0))
%64 = bitcast i8* %63 to i32 ()*
%65 = call i32 @putchar(i32 10)
%66 = icmp eq i8* %58, null
br i1 %66, label %74, label %67
67: ; preds = %44
%68 = bitcast i8* %58 to i32*
%69 = getelementptr inbounds i8*, i8** %1, i64 2
%70 = load i8*, i8** %69
%71 = call i64 @atol(i8* %70)
%72 = trunc i64 %71 to i32
store i32 %72, i32* %68
%73 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @.str.18, i64 0, i64 0), i32 %72)
br label %74
74: ; preds = %67, %44
%75 = icmp eq i8* %61, null
br i1 %75, label %82, label %76
76: ; preds = %74
%77 = getelementptr inbounds i8*, i8** %1, i64 3
%78 = load i8*, i8** %77
%79 = call i64 @atol(i8* %78)
%80 = trunc i64 %79 to i32
store i32 %80, i32* %62
%81 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @.str.19, i64 0, i64 0), i32 %80)
br label %82
82: ; preds = %76, %74
%83 = icmp eq i8* %59, null
br i1 %83, label %90, label %84
84: ; preds = %82
%85 = getelementptr inbounds i8*, i8** %1, i64 4
%86 = load i8*, i8** %85
%87 = call i64 @atol(i8* %86)
%88 = trunc i64 %87 to i32
store i32 %88, i32* %60
%89 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @.str.20, i64 0, i64 0), i32 %88)
br label %90
90: ; preds = %84, %82
%91 = icmp eq i8* %63, null
br i1 %91, label %95, label %92
92: ; preds = %90
%93 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @str.25, i64 0, i64 0))
%94 = call i32 %64()
br label %95
95: ; preds = %92, %90
%96 = call i64 @lt_dlclose(i32 %29)
%97 = icmp eq i64 %96, 0
br i1 %97, label %103, label %98
98: ; preds = %95
%99 = load i32, i32* @stderr
%100 = call i8* (...) @lt_dlerror()
%101 = call i32 @fprintf(i32 %99, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.22, i64 0, i64 0), i8* %100)
%102 = call i32 (...) @lt_dlexit()
br label %105
103: ; preds = %95
%104 = call i32 (...) @lt_dlexit()
br label %105
105: ; preds = %103, %98, %39, %31, %13, %6
%106 = phi i32 [ 1, %6 ], [ 1, %13 ], [ 1, %98 ], [ 0, %103 ], [ 1, %39 ], [ 1, %31 ]
ret i32 %106
}