#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 */
typedef int /*<<< orphan*/ s;
typedef int /*<<< orphan*/ name;

/* Variables and functions */
int /*<<< orphan*/ EXIT_FAILURE;
int /*<<< orphan*/ EXIT_SUCCESS;
int /*<<< orphan*/ _snprintf(char *, int, char *, char *, ...);
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
int /*<<< orphan*/ printf(char *, char *);
int sscanf(char *, char *, int *, int *, int *);
int /*<<< orphan*/ stderr;
scalar_t__ system(char *);
int main(int argc, char *argv[]) {
  char *prog, *arch, *def, *effective_version, *version, *lib;
  char s[1024];
  char name[16];
  int current, age, revision;
  if (argc != 7) {
    fprintf(stderr, "bad number of arguments");
    exit(EXIT_FAILURE);
  }
  prog = argv[1];
  arch = argv[2];
  def = argv[3];
  effective_version = argv[4];
  version = argv[5];
  lib = argv[6];
  if (sscanf(version, "%d:%d:%d", &current, &revision, &age) != 3)
    exit(EXIT_FAILURE);
  _snprintf(name, sizeof(name), "libstarpu-%s-%d", effective_version,
            current - age);
  printf("using soname %s\n", name);
  _snprintf(s, sizeof(s), "\"%s\" /machine:%s /def:%s /name:%s /out:%s", prog,
            arch, def, name, lib);
  if (system(s)) {
    fprintf(stderr, "%s failed\n", s);
    exit(EXIT_FAILURE);
  }
  exit(EXIT_SUCCESS);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x470,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x7,-0x8(%rbp)
je     11a8 <main+0x48>
mov    0x2e56(%rip),%rax
mov    (%rax),%edi
lea    0xe6d(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
mov    0x2e37(%rip),%rax
mov    (%rax),%edi
call   1080 <exit@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rax
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rax
mov    %rax,-0x28(%rbp)
mov    -0x10(%rbp),%rax
mov    0x20(%rax),%rax
mov    %rax,-0x30(%rbp)
mov    -0x10(%rbp),%rax
mov    0x28(%rax),%rax
mov    %rax,-0x38(%rbp)
mov    -0x10(%rbp),%rax
mov    0x30(%rax),%rax
mov    %rax,-0x40(%rbp)
mov    -0x38(%rbp),%rdi
lea    0xe1d(%rip),%rsi
lea    -0x454(%rbp),%rdx
lea    -0x45c(%rbp),%rcx
lea    -0x458(%rbp),%r8
call   1060 <sscanf@plt>
cmp    $0x3,%eax
je     122c <main+0xcc>
mov    0x2db3(%rip),%rax
mov    (%rax),%edi
call   1080 <exit@plt>
lea    -0x450(%rbp),%rdi
mov    -0x30(%rbp),%rcx
mov    -0x454(%rbp),%r8d
sub    -0x458(%rbp),%r8d
mov    $0x10,%esi
lea    0xdd0(%rip),%rdx
mov    $0x0,%al
call   1070 <_snprintf@plt>
lea    -0x450(%rbp),%rsi
lea    0xdcb(%rip),%rdi
call   1040 <printf@plt>
lea    -0x440(%rbp),%rdi
mov    -0x18(%rbp),%rcx
mov    -0x20(%rbp),%r8
mov    -0x28(%rbp),%r9
lea    -0x450(%rbp),%r10
mov    -0x40(%rbp),%rax
mov    $0x400,%esi
lea    0xdad(%rip),%rdx
mov    %r10,(%rsp)
mov    %rax,0x8(%rsp)
mov    $0x0,%al
call   1070 <_snprintf@plt>
lea    -0x440(%rbp),%rdi
call   1030 <system@plt>
cmp    $0x0,%rax
je     12e7 <main+0x187>
mov    0x2d1e(%rip),%rax
mov    (%rax),%edi
lea    -0x440(%rbp),%rdx
lea    0xd9a(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
mov    0x2cf8(%rip),%rax
mov    (%rax),%edi
call   1080 <exit@plt>
mov    0x2ce2(%rip),%rax
mov    (%rax),%edi
call   1080 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x428,%rsp
cmp    $0x7,%edi
jne    1233 <main+0xd3>
mov    0x8(%rsi),%r12
mov    0x10(%rsi),%r14
mov    0x18(%rsi),%r15
mov    0x20(%rsi),%rbx
mov    0x28(%rsi),%rdi
mov    0x30(%rsi),%rbp
lea    0xe7f(%rip),%rsi
lea    0x8(%rsp),%rdx
lea    0xc(%rsp),%rcx
lea    0x4(%rsp),%r8
call   1060 <sscanf@plt>
cmp    $0x3,%eax
jne    1268 <main+0x108>
mov    0x8(%rsp),%r8d
sub    0x4(%rsp),%r8d
lea    0xe5a(%rip),%rdx
lea    0x10(%rsp),%r13
mov    %r13,%rdi
mov    $0x10,%esi
mov    %rbx,%rcx
xor    %eax,%eax
call   1070 <_snprintf@plt>
lea    0xe4c(%rip),%rdi
mov    %r13,%rsi
call   1040 <printf@plt>
lea    0xe4e(%rip),%rdx
lea    0x20(%rsp),%rbx
mov    %rbx,%rdi
mov    $0x400,%esi
mov    %r12,%rcx
mov    %r14,%r8
mov    %r15,%r9
xor    %eax,%eax
push   %rbp
push   %r13
call   1070 <_snprintf@plt>
add    $0x10,%rsp
mov    %rbx,%rdi
call   1030 <system@plt>
test   %rax,%rax
jne    124c <main+0xec>
mov    0x2da4(%rip),%rax
mov    (%rax),%edi
call   1080 <exit@plt>
mov    0x2da6(%rip),%rax
mov    (%rax),%edi
lea    0xdbd(%rip),%rsi
xor    %eax,%eax
call   1050 <fprintf@plt>
jmp    1268 <main+0x108>
mov    0x2d8d(%rip),%rax
mov    (%rax),%edi
lea    0xe10(%rip),%rsi
lea    0x20(%rsp),%rdx
xor    %eax,%eax
call   1050 <fprintf@plt>
mov    0x2d69(%rip),%rax
mov    (%rax),%edi
call   1080 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [24 x i8] c"bad number of arguments\00"
@EXIT_FAILURE = global i32 0
@.str.1 = [9 x i8] c"%d:%d:%d\00"
@.str.2 = [16 x i8] c"libstarpu-%s-%d\00"
@.str.3 = [17 x i8] c"using soname %s\0A\00"
@.str.4 = [42 x i8] c"\22%s\22 /machine:%s /def:%s /name:%s /out:%s\00"
@.str.5 = [11 x i8] c"%s failed\0A\00"
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i8*
%9 = alloca i8*
%10 = alloca i8*
%11 = alloca i8*
%12 = alloca [1024 x i8]
%13 = alloca [16 x i8]
%14 = alloca i32
%15 = alloca i32
%16 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%17 = load i32, i32* %4
%18 = icmp ne i32 %17, 7
br i1 %18, label %19, label %24
19: ; preds = %2
%20 = load i32, i32* @stderr
%21 = call i32 (i32, i8*, ...) @fprintf(i32 %20, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0))
%22 = load i32, i32* @EXIT_FAILURE
%23 = call i32 @exit(i32 %22)
unreachable
24: ; preds = %2
%25 = load i8**, i8*** %5
%26 = getelementptr inbounds i8*, i8** %25, i64 1
%27 = load i8*, i8** %26
store i8* %27, i8** %6
%28 = load i8**, i8*** %5
%29 = getelementptr inbounds i8*, i8** %28, i64 2
%30 = load i8*, i8** %29
store i8* %30, i8** %7
%31 = load i8**, i8*** %5
%32 = getelementptr inbounds i8*, i8** %31, i64 3
%33 = load i8*, i8** %32
store i8* %33, i8** %8
%34 = load i8**, i8*** %5
%35 = getelementptr inbounds i8*, i8** %34, i64 4
%36 = load i8*, i8** %35
store i8* %36, i8** %9
%37 = load i8**, i8*** %5
%38 = getelementptr inbounds i8*, i8** %37, i64 5
%39 = load i8*, i8** %38
store i8* %39, i8** %10
%40 = load i8**, i8*** %5
%41 = getelementptr inbounds i8*, i8** %40, i64 6
%42 = load i8*, i8** %41
store i8* %42, i8** %11
%43 = load i8*, i8** %10
%44 = call i32 @sscanf(i8* %43, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i32* %14, i32* %16, i32* %15)
%45 = icmp ne i32 %44, 3
br i1 %45, label %46, label %49
46: ; preds = %24
%47 = load i32, i32* @EXIT_FAILURE
%48 = call i32 @exit(i32 %47)
unreachable
49: ; preds = %24
%50 = getelementptr inbounds [16 x i8], [16 x i8]* %13, i64 0, i64 0
%51 = load i8*, i8** %9
%52 = load i32, i32* %14
%53 = load i32, i32* %15
%54 = sub nsw i32 %52, %53
%55 = call i32 (i8*, i32, i8*, i8*, ...) @_snprintf(i8* %50, i32 16, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0), i8* %51, i32 %54)
%56 = getelementptr inbounds [16 x i8], [16 x i8]* %13, i64 0, i64 0
%57 = call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.3, i64 0, i64 0), i8* %56)
%58 = getelementptr inbounds [1024 x i8], [1024 x i8]* %12, i64 0, i64 0
%59 = load i8*, i8** %6
%60 = load i8*, i8** %7
%61 = load i8*, i8** %8
%62 = getelementptr inbounds [16 x i8], [16 x i8]* %13, i64 0, i64 0
%63 = load i8*, i8** %11
%64 = call i32 (i8*, i32, i8*, i8*, ...) @_snprintf(i8* %58, i32 1024, i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.4, i64 0, i64 0), i8* %59, i8* %60, i8* %61, i8* %62, i8* %63)
%65 = getelementptr inbounds [1024 x i8], [1024 x i8]* %12, i64 0, i64 0
%66 = call i64 @system(i8* %65)
%67 = icmp ne i64 %66, 0
br i1 %67, label %68, label %74
68: ; preds = %49
%69 = load i32, i32* @stderr
%70 = getelementptr inbounds [1024 x i8], [1024 x i8]* %12, i64 0, i64 0
%71 = call i32 (i32, i8*, ...) @fprintf(i32 %69, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.5, i64 0, i64 0), i8* %70)
%72 = load i32, i32* @EXIT_FAILURE
%73 = call i32 @exit(i32 %72)
unreachable
74: ; preds = %49
%75 = load i32, i32* @EXIT_SUCCESS
%76 = call i32 @exit(i32 %75)
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [24 x i8] c"bad number of arguments\00"
@EXIT_FAILURE = global i32 0
@.str.1 = [9 x i8] c"%d:%d:%d\00"
@.str.2 = [16 x i8] c"libstarpu-%s-%d\00"
@.str.3 = [17 x i8] c"using soname %s\0A\00"
@.str.4 = [42 x i8] c"\22%s\22 /machine:%s /def:%s /name:%s /out:%s\00"
@.str.5 = [11 x i8] c"%s failed\0A\00"
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca [1024 x i8]
%4 = alloca [16 x i8]
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = getelementptr inbounds [1024 x i8], [1024 x i8]* %3, i64 0, i64 0
%9 = getelementptr inbounds [16 x i8], [16 x i8]* %4, i64 0, i64 0
%10 = bitcast i32* %5 to i8*
%11 = bitcast i32* %6 to i8*
%12 = bitcast i32* %7 to i8*
%13 = icmp eq i32 %0, 7
br i1 %13, label %19, label %14
14: ; preds = %2
%15 = load i32, i32* @stderr
%16 = tail call i32 (i32, i8*, ...) @fprintf(i32 %15, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0))
%17 = load i32, i32* @EXIT_FAILURE
%18 = tail call i32 @exit(i32 %17)
unreachable
19: ; preds = %2
%20 = getelementptr inbounds i8*, i8** %1, i64 1
%21 = load i8*, i8** %20
%22 = getelementptr inbounds i8*, i8** %1, i64 2
%23 = load i8*, i8** %22
%24 = getelementptr inbounds i8*, i8** %1, i64 3
%25 = load i8*, i8** %24
%26 = getelementptr inbounds i8*, i8** %1, i64 4
%27 = load i8*, i8** %26
%28 = getelementptr inbounds i8*, i8** %1, i64 5
%29 = load i8*, i8** %28
%30 = getelementptr inbounds i8*, i8** %1, i64 6
%31 = load i8*, i8** %30
%32 = call i32 @sscanf(i8* %29, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i32* %5, i32* %7, i32* %6)
%33 = icmp eq i32 %32, 3
br i1 %33, label %37, label %34
34: ; preds = %19
%35 = load i32, i32* @EXIT_FAILURE
%36 = call i32 @exit(i32 %35)
unreachable
37: ; preds = %19
%38 = load i32, i32* %5
%39 = load i32, i32* %6
%40 = sub nsw i32 %38, %39
%41 = call i32 (i8*, i32, i8*, i8*, ...) @_snprintf(i8* %9, i32 16, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0), i8* %27, i32 %40)
%42 = call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.3, i64 0, i64 0), i8* %9)
%43 = call i32 (i8*, i32, i8*, i8*, ...) @_snprintf(i8* %8, i32 1024, i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.4, i64 0, i64 0), i8* %21, i8* %23, i8* %25, i8* %9, i8* %31)
%44 = call i64 @system(i8* %8)
%45 = icmp eq i64 %44, 0
br i1 %45, label %51, label %46
46: ; preds = %37
%47 = load i32, i32* @stderr
%48 = call i32 (i32, i8*, ...) @fprintf(i32 %47, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.5, i64 0, i64 0), i8* %8)
%49 = load i32, i32* @EXIT_FAILURE
%50 = call i32 @exit(i32 %49)
unreachable
51: ; preds = %37
%52 = load i32, i32* @EXIT_SUCCESS
%53 = call i32 @exit(i32 %52)
unreachable
}