#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*/ createversion(int /*<<< orphan*/, char *, char *);
int /*<<< orphan*/ seek4Lib(char *);
int main(int argc, char *argv[]) {
  int i = 0;
  createversion(seek4Lib("libc.so"), argv[++i], "model/libc.version");
  createversion(seek4Lib("libpthread.so"), argv[++i],
                "model/libpthread.version");
  createversion(seek4Lib("librt.so"), argv[++i], "model/librt.version");
  createversion(seek4Lib("libm.so"), argv[++i], "model/libm.version");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
lea    0xebc(%rip),%rdi
call   1040 <seek4Lib@plt>
mov    %eax,%edi
mov    -0x10(%rbp),%rax
mov    -0x14(%rbp),%ecx
add    $0x1,%ecx
mov    %ecx,-0x14(%rbp)
movslq %ecx,%rcx
mov    (%rax,%rcx,8),%rsi
lea    0xea2(%rip),%rdx
call   1030 <createversion@plt>
lea    0xea9(%rip),%rdi
call   1040 <seek4Lib@plt>
mov    %eax,%edi
mov    -0x10(%rbp),%rax
mov    -0x14(%rbp),%ecx
add    $0x1,%ecx
mov    %ecx,-0x14(%rbp)
movslq %ecx,%rcx
mov    (%rax,%rcx,8),%rsi
lea    0xe95(%rip),%rdx
call   1030 <createversion@plt>
lea    0xea2(%rip),%rdi
call   1040 <seek4Lib@plt>
mov    %eax,%edi
mov    -0x10(%rbp),%rax
mov    -0x14(%rbp),%ecx
add    $0x1,%ecx
mov    %ecx,-0x14(%rbp)
movslq %ecx,%rcx
mov    (%rax,%rcx,8),%rsi
lea    0xe89(%rip),%rdx
call   1030 <createversion@plt>
lea    0xe91(%rip),%rdi
call   1040 <seek4Lib@plt>
mov    %eax,%edi
mov    -0x10(%rbp),%rax
mov    -0x14(%rbp),%ecx
add    $0x1,%ecx
mov    %ecx,-0x14(%rbp)
movslq %ecx,%rcx
mov    (%rax,%rcx,8),%rsi
lea    0xe77(%rip),%rdx
call   1030 <createversion@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
mov    %rsi,%rbx
lea    0xed5(%rip),%rdi
call   1040 <seek4Lib@plt>
mov    0x8(%rbx),%rsi
lea    0xecd(%rip),%rdx
mov    %eax,%edi
call   1030 <createversion@plt>
lea    0xed2(%rip),%rdi
call   1040 <seek4Lib@plt>
mov    0x10(%rbx),%rsi
lea    0xed0(%rip),%rdx
mov    %eax,%edi
call   1030 <createversion@plt>
lea    0xedb(%rip),%rdi
call   1040 <seek4Lib@plt>
mov    0x18(%rbx),%rsi
lea    0xed4(%rip),%rdx
mov    %eax,%edi
call   1030 <createversion@plt>
lea    0xeda(%rip),%rdi
call   1040 <seek4Lib@plt>
mov    0x20(%rbx),%rsi
lea    0xed2(%rip),%rdx
mov    %eax,%edi
call   1030 <createversion@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [8 x i8] c"libc.so\00"
@.str.1 = [19 x i8] c"model/libc.version\00"
@.str.2 = [14 x i8] c"libpthread.so\00"
@.str.3 = [25 x i8] c"model/libpthread.version\00"
@.str.4 = [9 x i8] c"librt.so\00"
@.str.5 = [20 x i8] c"model/librt.version\00"
@.str.6 = [8 x i8] c"libm.so\00"
@.str.7 = [19 x i8] c"model/libm.version\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %6
%7 = call i32 @seek4Lib(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
%8 = load i8**, i8*** %5
%9 = load i32, i32* %6
%10 = add nsw i32 %9, 1
store i32 %10, i32* %6
%11 = sext i32 %10 to i64
%12 = getelementptr inbounds i8*, i8** %8, i64 %11
%13 = load i8*, i8** %12
%14 = call i32 @createversion(i32 %7, i8* %13, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0))
%15 = call i32 @seek4Lib(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0))
%16 = load i8**, i8*** %5
%17 = load i32, i32* %6
%18 = add nsw i32 %17, 1
store i32 %18, i32* %6
%19 = sext i32 %18 to i64
%20 = getelementptr inbounds i8*, i8** %16, i64 %19
%21 = load i8*, i8** %20
%22 = call i32 @createversion(i32 %15, i8* %21, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.3, i64 0, i64 0))
%23 = call i32 @seek4Lib(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.4, i64 0, i64 0))
%24 = load i8**, i8*** %5
%25 = load i32, i32* %6
%26 = add nsw i32 %25, 1
store i32 %26, i32* %6
%27 = sext i32 %26 to i64
%28 = getelementptr inbounds i8*, i8** %24, i64 %27
%29 = load i8*, i8** %28
%30 = call i32 @createversion(i32 %23, i8* %29, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.5, i64 0, i64 0))
%31 = call i32 @seek4Lib(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.6, i64 0, i64 0))
%32 = load i8**, i8*** %5
%33 = load i32, i32* %6
%34 = add nsw i32 %33, 1
store i32 %34, i32* %6
%35 = sext i32 %34 to i64
%36 = getelementptr inbounds i8*, i8** %32, i64 %35
%37 = load i8*, i8** %36
%38 = call i32 @createversion(i32 %31, i8* %37, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.7, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [8 x i8] c"libc.so\00"
@.str.1 = [19 x i8] c"model/libc.version\00"
@.str.2 = [14 x i8] c"libpthread.so\00"
@.str.3 = [25 x i8] c"model/libpthread.version\00"
@.str.4 = [9 x i8] c"librt.so\00"
@.str.5 = [20 x i8] c"model/librt.version\00"
@.str.6 = [8 x i8] c"libm.so\00"
@.str.7 = [19 x i8] c"model/libm.version\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = tail call i32 @seek4Lib(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
%4 = getelementptr inbounds i8*, i8** %1, i64 1
%5 = load i8*, i8** %4
%6 = tail call i32 @createversion(i32 %3, i8* %5, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0))
%7 = tail call i32 @seek4Lib(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0))
%8 = getelementptr inbounds i8*, i8** %1, i64 2
%9 = load i8*, i8** %8
%10 = tail call i32 @createversion(i32 %7, i8* %9, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.3, i64 0, i64 0))
%11 = tail call i32 @seek4Lib(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.4, i64 0, i64 0))
%12 = getelementptr inbounds i8*, i8** %1, i64 3
%13 = load i8*, i8** %12
%14 = tail call i32 @createversion(i32 %11, i8* %13, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.5, i64 0, i64 0))
%15 = tail call i32 @seek4Lib(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.6, i64 0, i64 0))
%16 = getelementptr inbounds i8*, i8** %1, i64 4
%17 = load i8*, i8** %16
%18 = tail call i32 @createversion(i32 %15, i8* %17, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.7, i64 0, i64 0))
ret i32 0
}