#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*/ dlinit(int, char **);
int /*<<< orphan*/ printf(char *);
int main(int argc, char *argv[]) {
  int ret = 0;
  char *builtin[] = {"libgcc.so", "libc.so", "libstdc++.so"};
  void *handle;
  char *error;
  void (*entry_function)() = NULL;
  printf("In DSPAL main\n");
  dlinit(3, builtin);
  return ret;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    0x2cbc(%rip),%rax
mov    %rax,-0x30(%rbp)
mov    0x2cb9(%rip),%rax
mov    %rax,-0x28(%rbp)
mov    0x2cb6(%rip),%rax
mov    %rax,-0x20(%rbp)
movq   $0x0,-0x48(%rbp)
lea    0xeb2(%rip),%rdi
call   1030 <printf@plt>
lea    -0x30(%rbp),%rsi
mov    $0x3,%edi
call   1040 <dlinit@plt>
mov    -0x14(%rbp),%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x18,%rsp
mov    0x2ce5(%rip),%rax
mov    %rax,0x10(%rsp)
movaps 0x2cc9(%rip),%xmm0
movaps %xmm0,(%rsp)
lea    0xedd(%rip),%rdi
call   1030 <puts@plt>
mov    %rsp,%rsi
mov    $0x3,%edi
call   1040 <dlinit@plt>
xor    %eax,%eax
add    $0x18,%rsp
ret

LLVM IR (-O0):
@.str = [10 x i8] c"libgcc.so\00"
@.str.1 = [8 x i8] c"libc.so\00"
@.str.2 = [13 x i8] c"libstdc++.so\00"
@__const.main.builtin = [3 x i8*] [i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i32 0, i32 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i32 0, i32 0), i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i32 0, i32 0)]
@.str.3 = [15 x i8] c"In DSPAL main\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca [3 x i8*]
%8 = alloca i8*
%9 = alloca i8*
%10 = alloca void (...)*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %6
%11 = bitcast [3 x i8*]* %7 to i8*
store void (...)* null, void (...)** %10
%12 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.3, i64 0, i64 0))
%13 = getelementptr inbounds [3 x i8*], [3 x i8*]* %7, i64 0, i64 0
%14 = call i32 @dlinit(i32 3, i8** %13)
%15 = load i32, i32* %6
ret i32 %15
}

LLVM IR (-O2):
@.str = [10 x i8] c"libgcc.so\00"
@.str.1 = [8 x i8] c"libc.so\00"
@.str.2 = [13 x i8] c"libstdc++.so\00"
@__const.main.builtin = [3 x i8*] [i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i32 0, i32 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i32 0, i32 0), i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i32 0, i32 0)]
@str = [14 x i8] c"In DSPAL main\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca [3 x i8*]
%4 = bitcast [3 x i8*]* %3 to i8*
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @str, i64 0, i64 0))
%6 = getelementptr inbounds [3 x i8*], [3 x i8*]* %3, i64 0, i64 0
%7 = call i32 @dlinit(i32 3, i8** %6)
ret i32 0
}