#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*/ printf(char *, ...);
int /*<<< orphan*/ sprintf(char *, char *, char const *, char const *,
                           char const *, char const *, char const *,
                           char const *, char const *, char const *,
                           char const *);
int /*<<< orphan*/ system(char *);
void recompileLib(const char *dbin, const char *dsrc, const char *fname,
                  const char *fflags) {
  printf("Compiling '%s' | dbin '%s'  dsrc '%s' fflags '%s' \n", fname, dbin,
         dsrc, fflags);
  char buf[8096];
  sprintf(buf,
          "cd %s;"
          "rm lib%s.so;"
          "rm %s.o;"
          "g++ -std=c++11 %s -fPIC -c %s%s.cpp;"
          "g++ -shared -Wl,-soname,lib%s.so -o lib%s.so %s.o;",
          dbin, fname, fname, fflags, dsrc, fname, fname, fname, fname);
  printf("Compilation string >>>\n %s \n<<<\n", buf);
  printf("==== BEGIN COMPILATION ==== \n");
  system(buf);
  printf("==== END   COMPILATION ==== \n");
}


x86 assembly (clang, -O0):
<recompileLib>:
push   %rbp
mov    %rsp,%rbp
push   %r14
push   %rbx
sub    $0x1ff0,%rsp
mov    %rdi,-0x18(%rbp)
mov    %rsi,-0x20(%rbp)
mov    %rdx,-0x28(%rbp)
mov    %rcx,-0x30(%rbp)
mov    -0x28(%rbp),%rsi
mov    -0x18(%rbp),%rdx
mov    -0x20(%rbp),%rcx
mov    -0x30(%rbp),%r8
lea    0xe9b(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    -0x1fd0(%rbp),%rdi
mov    -0x18(%rbp),%rdx
mov    -0x28(%rbp),%rcx
mov    -0x28(%rbp),%r8
mov    -0x30(%rbp),%r9
mov    -0x20(%rbp),%r14
mov    -0x28(%rbp),%rbx
mov    -0x28(%rbp),%r11
mov    -0x28(%rbp),%r10
mov    -0x28(%rbp),%rax
lea    0xe96(%rip),%rsi
mov    %r14,(%rsp)
mov    %rbx,0x8(%rsp)
mov    %r11,0x10(%rsp)
mov    %r10,0x18(%rsp)
mov    %rax,0x20(%rsp)
call   1050 <sprintf@plt>
lea    -0x1fd0(%rbp),%rsi
lea    0xedc(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xeef(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    -0x1fd0(%rbp),%rdi
call   1030 <system@plt>
lea    0xef3(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
add    $0x1ff0,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

x86 assembly (clang, -O2):
<recompileLib>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x1fa0,%rsp
mov    %rcx,%r12
mov    %rdx,%rbx
mov    %rsi,%r15
mov    %rdi,%r13
lea    0xe9d(%rip),%rdi
mov    %rdx,%rsi
mov    %r13,%rdx
mov    %r15,%rcx
mov    %r12,%r8
xor    %eax,%eax
call   1050 <printf@plt>
sub    $0x8,%rsp
lea    0xeb3(%rip),%rsi
lea    0x8(%rsp),%r14
mov    %r14,%rdi
mov    %r13,%rdx
mov    %rbx,%rcx
mov    %rbx,%r8
mov    %r12,%r9
push   %rbx
push   %rbx
push   %rbx
push   %rbx
push   %r15
call   1060 <sprintf@plt>
add    $0x30,%rsp
lea    0xefa(%rip),%rdi
mov    %r14,%rsi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xf0a(%rip),%rdi
call   1030 <puts@plt>
mov    %r14,%rdi
call   1040 <system@plt>
lea    0xf13(%rip),%rdi
call   1030 <puts@plt>
add    $0x1fa0,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [52 x i8] c"Compiling '%s' | dbin '%s' dsrc '%s' fflags '%s' \0A\00"
@.str.1 = [113 x i8] c"cd %s;rm lib%s.so;rm %s.o;g++ -std=c++11 %s -fPIC -c %s%s.cpp;g++ -shared -Wl,-soname,lib%s.so -o lib%s.so %s.o;\00"
@.str.2 = [33 x i8] c"Compilation string >>>\0A %s \0A<<<\0A\00"
@.str.3 = [30 x i8] c"==== BEGIN COMPILATION ==== \0A\00"
@.str.4 = [30 x i8] c"==== END COMPILATION ==== \0A\00"
define void @recompileLib(i8* %0, i8* %1, i8* %2, i8* %3) {
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i8*
%9 = alloca [8096 x i8]
store i8* %0, i8** %5
store i8* %1, i8** %6
store i8* %2, i8** %7
store i8* %3, i8** %8
%10 = load i8*, i8** %7
%11 = load i8*, i8** %5
%12 = load i8*, i8** %6
%13 = load i8*, i8** %8
%14 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([52 x i8], [52 x i8]* @.str, i64 0, i64 0), i8* %10, i8* %11, i8* %12, i8* %13)
%15 = getelementptr inbounds [8096 x i8], [8096 x i8]* %9, i64 0, i64 0
%16 = load i8*, i8** %5
%17 = load i8*, i8** %7
%18 = load i8*, i8** %7
%19 = load i8*, i8** %8
%20 = load i8*, i8** %6
%21 = load i8*, i8** %7
%22 = load i8*, i8** %7
%23 = load i8*, i8** %7
%24 = load i8*, i8** %7
%25 = call i32 @sprintf(i8* %15, i8* getelementptr inbounds ([113 x i8], [113 x i8]* @.str.1, i64 0, i64 0), i8* %16, i8* %17, i8* %18, i8* %19, i8* %20, i8* %21, i8* %22, i8* %23, i8* %24)
%26 = getelementptr inbounds [8096 x i8], [8096 x i8]* %9, i64 0, i64 0
%27 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.2, i64 0, i64 0), i8* %26)
%28 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.3, i64 0, i64 0))
%29 = getelementptr inbounds [8096 x i8], [8096 x i8]* %9, i64 0, i64 0
%30 = call i32 @system(i8* %29)
%31 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.4, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [52 x i8] c"Compiling '%s' | dbin '%s' dsrc '%s' fflags '%s' \0A\00"
@.str.1 = [113 x i8] c"cd %s;rm lib%s.so;rm %s.o;g++ -std=c++11 %s -fPIC -c %s%s.cpp;g++ -shared -Wl,-soname,lib%s.so -o lib%s.so %s.o;\00"
@.str.2 = [33 x i8] c"Compilation string >>>\0A %s \0A<<<\0A\00"
@str = [29 x i8] c"==== BEGIN COMPILATION ==== \00"
@str.5 = [29 x i8] c"==== END COMPILATION ==== \00"
define void @recompileLib(i8* %0, i8* %1, i8* %2, i8* %3) {
%5 = alloca [8096 x i8]
%6 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([52 x i8], [52 x i8]* @.str, i64 0, i64 0), i8* %2, i8* %0, i8* %1, i8* %3)
%7 = getelementptr inbounds [8096 x i8], [8096 x i8]* %5, i64 0, i64 0
%8 = call i32 @sprintf(i8* %7, i8* dereferenceable(1) getelementptr inbounds ([113 x i8], [113 x i8]* @.str.1, i64 0, i64 0), i8* %0, i8* %2, i8* %2, i8* %3, i8* %1, i8* %2, i8* %2, i8* %2, i8* %2)
%9 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @.str.2, i64 0, i64 0), i8* %7)
%10 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @str, i64 0, i64 0))
%11 = call i32 @system(i8* %7)
%12 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @str.5, i64 0, i64 0))
ret void
}