#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 */
scalar_t__ malloc(int);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ strcpy(char *, char *);
int /*<<< orphan*/ strlen(char *);
char **commandExecute(int simulator, char *fileName, char *topEntity) {
  char **command;
  command = NULL;
  switch (simulator) {
  case 1:
    if (fileName == NULL) {
      printf("File-Name is needed for defining command.\n");
    } else {
      command = (char **)malloc(6 * sizeof(char *));
      command[0] = (char *)malloc((strlen("vvp") + 1) * sizeof(char));
      strcpy(command[0], "vvp");
      command[1] = (char *)malloc((strlen("-N") + 1) * sizeof(char));
      strcpy(command[1], "-N");
      command[2] = (char *)malloc((strlen("-M.") + 1) * sizeof(char));
      strcpy(command[2], "-M.");
      command[3] = (char *)malloc((strlen("-mcosim_vpi") + 1) * sizeof(char));
      strcpy(command[3], "-mcosim_vpi");
      command[4] = (char *)malloc((strlen(fileName) + 1) * sizeof(char));
      strcpy(command[4], fileName);
      command[5] = NULL;
    }
    break;
  case 3:
    printf("GHDL is not supported yet.\n");
    return NULL;
  case 2:
    if (topEntity == NULL) {
      printf("Top-Entity is needed for defining command.\n");
    } else {
      command = (char **)malloc(9 * sizeof(char *));
      command[0] = (char *)malloc((strlen("vsim") + 1) * sizeof(char));
      strcpy(command[0], "vsim");
      command[1] = (char *)malloc((strlen("-c") + 1) * sizeof(char));
      strcpy(command[1], "-c");
      command[2] = (char *)malloc((strlen("-quiet") + 1) * sizeof(char));
      strcpy(command[2], "-quiet");
      command[3] = (char *)malloc((strlen("-do") + 1) * sizeof(char));
      strcpy(command[3], "-do");
      command[4] = (char *)malloc((strlen("onfinish exit; run -all") + 1) *
                                  sizeof(char));
      strcpy(command[4], "onfinish exit; run -all");
      command[5] = (char *)malloc((strlen(topEntity) + 1) * sizeof(char));
      strcpy(command[5], topEntity);
      command[6] = (char *)malloc((strlen("-pli") + 1) * sizeof(char));
      strcpy(command[6], "-pli");
      command[7] = (char *)malloc((strlen("cosim_vpi.sl") + 1) * sizeof(char));
      strcpy(command[7], "cosim_vpi.sl");
      command[8] = NULL;
    }
    break;
  default:
    break;
  }
  return command;
}


x86 assembly (clang, -O0):
<commandExecute>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0xc(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
movq   $0x0,-0x28(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x2c(%rbp)
sub    $0x1,%eax
je     1191 <commandExecute+0x51>
jmp    116f <commandExecute+0x2f>
mov    -0x2c(%rbp),%eax
sub    $0x2,%eax
je     1304 <commandExecute+0x1c4>
jmp    1180 <commandExecute+0x40>
mov    -0x2c(%rbp),%eax
sub    $0x3,%eax
je     12eb <commandExecute+0x1ab>
jmp    150f <commandExecute+0x3cf>
cmpq   $0x0,-0x18(%rbp)
jne    11ad <commandExecute+0x6d>
lea    0xe5d(%rip),%rdi
call   1050 <printf@plt>
jmp    12e6 <commandExecute+0x1a6>
mov    $0x30,%edi
call   1060 <malloc@plt>
mov    %rax,-0x28(%rbp)
lea    0xe69(%rip),%rdi
call   1040 <strlen@plt>
add    $0x1,%eax
cltq
shl    $0x0,%rax
mov    %eax,%edi
call   1060 <malloc@plt>
mov    %rax,%rcx
mov    -0x28(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x28(%rbp),%rax
mov    (%rax),%rdi
lea    0xe3c(%rip),%rsi
call   1030 <strcpy@plt>
lea    0xe34(%rip),%rdi
call   1040 <strlen@plt>
add    $0x1,%eax
cltq
shl    $0x0,%rax
mov    %eax,%edi
call   1060 <malloc@plt>
mov    %rax,%rcx
mov    -0x28(%rbp),%rax
mov    %rcx,0x8(%rax)
mov    -0x28(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe05(%rip),%rsi
call   1030 <strcpy@plt>
lea    0xdfc(%rip),%rdi
call   1040 <strlen@plt>
add    $0x1,%eax
cltq
shl    $0x0,%rax
mov    %eax,%edi
call   1060 <malloc@plt>
mov    %rax,%rcx
mov    -0x28(%rbp),%rax
mov    %rcx,0x10(%rax)
mov    -0x28(%rbp),%rax
mov    0x10(%rax),%rdi
lea    0xdcd(%rip),%rsi
call   1030 <strcpy@plt>
lea    0xdc5(%rip),%rdi
call   1040 <strlen@plt>
add    $0x1,%eax
cltq
shl    $0x0,%rax
mov    %eax,%edi
call   1060 <malloc@plt>
mov    %rax,%rcx
mov    -0x28(%rbp),%rax
mov    %rcx,0x18(%rax)
mov    -0x28(%rbp),%rax
mov    0x18(%rax),%rdi
lea    0xd96(%rip),%rsi
call   1030 <strcpy@plt>
mov    -0x18(%rbp),%rdi
call   1040 <strlen@plt>
add    $0x1,%eax
cltq
shl    $0x0,%rax
mov    %eax,%edi
call   1060 <malloc@plt>
mov    %rax,%rcx
mov    -0x28(%rbp),%rax
mov    %rcx,0x20(%rax)
mov    -0x28(%rbp),%rax
mov    0x20(%rax),%rdi
mov    -0x18(%rbp),%rsi
call   1030 <strcpy@plt>
mov    -0x28(%rbp),%rax
movq   $0x0,0x28(%rax)
jmp    1514 <commandExecute+0x3d4>
lea    0xd50(%rip),%rdi
call   1050 <printf@plt>
movq   $0x0,-0x8(%rbp)
jmp    151c <commandExecute+0x3dc>
cmpq   $0x0,-0x20(%rbp)
jne    1320 <commandExecute+0x1e0>
lea    0xd48(%rip),%rdi
call   1050 <printf@plt>
jmp    150a <commandExecute+0x3ca>
mov    $0x48,%edi
call   1060 <malloc@plt>
mov    %rax,-0x28(%rbp)
lea    0xd55(%rip),%rdi
call   1040 <strlen@plt>
add    $0x1,%eax
cltq
shl    $0x0,%rax
mov    %eax,%edi
call   1060 <malloc@plt>
mov    %rax,%rcx
mov    -0x28(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x28(%rbp),%rax
mov    (%rax),%rdi
lea    0xd28(%rip),%rsi
call   1030 <strcpy@plt>
lea    0xd21(%rip),%rdi
call   1040 <strlen@plt>
add    $0x1,%eax
cltq
shl    $0x0,%rax
mov    %eax,%edi
call   1060 <malloc@plt>
mov    %rax,%rcx
mov    -0x28(%rbp),%rax
mov    %rcx,0x8(%rax)
mov    -0x28(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xcf2(%rip),%rsi
call   1030 <strcpy@plt>
lea    0xce9(%rip),%rdi
call   1040 <strlen@plt>
add    $0x1,%eax
cltq
shl    $0x0,%rax
mov    %eax,%edi
call   1060 <malloc@plt>
mov    %rax,%rcx
mov    -0x28(%rbp),%rax
mov    %rcx,0x10(%rax)
mov    -0x28(%rbp),%rax
mov    0x10(%rax),%rdi
lea    0xcba(%rip),%rsi
call   1030 <strcpy@plt>
lea    0xcb5(%rip),%rdi
call   1040 <strlen@plt>
add    $0x1,%eax
cltq
shl    $0x0,%rax
mov    %eax,%edi
call   1060 <malloc@plt>
mov    %rax,%rcx
mov    -0x28(%rbp),%rax
mov    %rcx,0x18(%rax)
mov    -0x28(%rbp),%rax
mov    0x18(%rax),%rdi
lea    0xc86(%rip),%rsi
call   1030 <strcpy@plt>
lea    0xc7e(%rip),%rdi
call   1040 <strlen@plt>
add    $0x1,%eax
cltq
shl    $0x0,%rax
mov    %eax,%edi
call   1060 <malloc@plt>
mov    %rax,%rcx
mov    -0x28(%rbp),%rax
mov    %rcx,0x20(%rax)
mov    -0x28(%rbp),%rax
mov    0x20(%rax),%rdi
lea    0xc4f(%rip),%rsi
call   1030 <strcpy@plt>
mov    -0x20(%rbp),%rdi
call   1040 <strlen@plt>
add    $0x1,%eax
cltq
shl    $0x0,%rax
mov    %eax,%edi
call   1060 <malloc@plt>
mov    %rax,%rcx
mov    -0x28(%rbp),%rax
mov    %rcx,0x28(%rax)
mov    -0x28(%rbp),%rax
mov    0x28(%rax),%rdi
mov    -0x20(%rbp),%rsi
call   1030 <strcpy@plt>
lea    0xc26(%rip),%rdi
call   1040 <strlen@plt>
add    $0x1,%eax
cltq
shl    $0x0,%rax
mov    %eax,%edi
call   1060 <malloc@plt>
mov    %rax,%rcx
mov    -0x28(%rbp),%rax
mov    %rcx,0x30(%rax)
mov    -0x28(%rbp),%rax
mov    0x30(%rax),%rdi
lea    0xbf7(%rip),%rsi
call   1030 <strcpy@plt>
lea    0xbf0(%rip),%rdi
call   1040 <strlen@plt>
add    $0x1,%eax
cltq
shl    $0x0,%rax
mov    %eax,%edi
call   1060 <malloc@plt>
mov    %rax,%rcx
mov    -0x28(%rbp),%rax
mov    %rcx,0x38(%rax)
mov    -0x28(%rbp),%rax
mov    0x38(%rax),%rdi
lea    0xbc1(%rip),%rsi
call   1030 <strcpy@plt>
mov    -0x28(%rbp),%rax
movq   $0x0,0x40(%rax)
jmp    1514 <commandExecute+0x3d4>
jmp    1514 <commandExecute+0x3d4>
mov    -0x28(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<commandExecute>:
push   %r15
push   %r14
push   %rbx
cmp    $0x3,%edi
je     123c <commandExecute+0xfc>
cmp    $0x2,%edi
je     1248 <commandExecute+0x108>
cmp    $0x1,%edi
jne    13a8 <commandExecute+0x268>
mov    %rsi,%r15
test   %rsi,%rsi
je     1393 <commandExecute+0x253>
mov    $0x30,%edi
call   1060 <malloc@plt>
mov    %rax,%rbx
lea    0xe80(%rip),%r14
mov    %r14,%rdi
call   1050 <strlen@plt>
lea    0x1(%rax),%edi
call   1060 <malloc@plt>
mov    %rax,(%rbx)
mov    %rax,%rdi
mov    %r14,%rsi
call   1030 <strcpy@plt>
lea    0xe5f(%rip),%r14
mov    %r14,%rdi
call   1050 <strlen@plt>
lea    0x1(%rax),%edi
call   1060 <malloc@plt>
mov    %rax,0x8(%rbx)
mov    %rax,%rdi
mov    %r14,%rsi
call   1030 <strcpy@plt>
lea    0xe3c(%rip),%r14
mov    %r14,%rdi
call   1050 <strlen@plt>
lea    0x1(%rax),%edi
call   1060 <malloc@plt>
mov    %rax,0x10(%rbx)
mov    %rax,%rdi
mov    %r14,%rsi
call   1030 <strcpy@plt>
lea    0xe1a(%rip),%r14
mov    %r14,%rdi
call   1050 <strlen@plt>
lea    0x1(%rax),%edi
call   1060 <malloc@plt>
mov    %rax,0x18(%rbx)
mov    %rax,%rdi
mov    %r14,%rsi
call   1030 <strcpy@plt>
mov    %r15,%rdi
call   1050 <strlen@plt>
lea    0x1(%rax),%edi
call   1060 <malloc@plt>
mov    %rax,0x20(%rbx)
mov    %rax,%rdi
mov    %r15,%rsi
call   1030 <strcpy@plt>
movq   $0x0,0x28(%rbx)
jmp    13aa <commandExecute+0x26a>
lea    0xe3c(%rip),%rdi
jmp    13a3 <commandExecute+0x263>
mov    %rdx,%r14
test   %rdx,%rdx
je     139c <commandExecute+0x25c>
mov    $0x48,%edi
call   1060 <malloc@plt>
mov    %rax,%rbx
lea    0xdaf(%rip),%r15
mov    %r15,%rdi
call   1050 <strlen@plt>
lea    0x1(%rax),%edi
call   1060 <malloc@plt>
mov    %rax,(%rbx)
mov    %rax,%rdi
mov    %r15,%rsi
call   1030 <strcpy@plt>
lea    0xd8f(%rip),%r15
mov    %r15,%rdi
call   1050 <strlen@plt>
lea    0x1(%rax),%edi
call   1060 <malloc@plt>
mov    %rax,0x8(%rbx)
mov    %rax,%rdi
mov    %r15,%rsi
call   1030 <strcpy@plt>
lea    0xd6c(%rip),%r15
mov    %r15,%rdi
call   1050 <strlen@plt>
lea    0x1(%rax),%edi
call   1060 <malloc@plt>
mov    %rax,0x10(%rbx)
mov    %rax,%rdi
mov    %r15,%rsi
call   1030 <strcpy@plt>
lea    0xd4d(%rip),%r15
mov    %r15,%rdi
call   1050 <strlen@plt>
lea    0x1(%rax),%edi
call   1060 <malloc@plt>
mov    %rax,0x18(%rbx)
mov    %rax,%rdi
mov    %r15,%rsi
call   1030 <strcpy@plt>
lea    0xd2b(%rip),%r15
mov    %r15,%rdi
call   1050 <strlen@plt>
lea    0x1(%rax),%edi
call   1060 <malloc@plt>
mov    %rax,0x20(%rbx)
mov    %rax,%rdi
mov    %r15,%rsi
call   1030 <strcpy@plt>
mov    %r14,%rdi
call   1050 <strlen@plt>
lea    0x1(%rax),%edi
call   1060 <malloc@plt>
mov    %rax,0x28(%rbx)
mov    %rax,%rdi
mov    %r14,%rsi
call   1030 <strcpy@plt>
lea    0xcfe(%rip),%r14
mov    %r14,%rdi
call   1050 <strlen@plt>
lea    0x1(%rax),%edi
call   1060 <malloc@plt>
mov    %rax,0x30(%rbx)
mov    %rax,%rdi
mov    %r14,%rsi
call   1030 <strcpy@plt>
lea    0xcdd(%rip),%r14
mov    %r14,%rdi
call   1050 <strlen@plt>
lea    0x1(%rax),%edi
call   1060 <malloc@plt>
mov    %rax,0x38(%rbx)
mov    %rax,%rdi
mov    %r14,%rsi
call   1030 <strcpy@plt>
movq   $0x0,0x40(%rbx)
jmp    13aa <commandExecute+0x26a>
lea    0xd00(%rip),%rdi
jmp    13a3 <commandExecute+0x263>
lea    0xcb1(%rip),%rdi
call   1040 <puts@plt>
xor    %ebx,%ebx
mov    %rbx,%rax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [43 x i8] c"File-Name is needed for defining command.\0A\00"
@.str.1 = [4 x i8] c"vvp\00"
@.str.2 = [3 x i8] c"-N\00"
@.str.3 = [4 x i8] c"-M.\00"
@.str.4 = [12 x i8] c"-mcosim_vpi\00"
@.str.5 = [28 x i8] c"GHDL is not supported yet.\0A\00"
@.str.6 = [44 x i8] c"Top-Entity is needed for defining command.\0A\00"
@.str.7 = [5 x i8] c"vsim\00"
@.str.8 = [3 x i8] c"-c\00"
@.str.9 = [7 x i8] c"-quiet\00"
@.str.10 = [4 x i8] c"-do\00"
@.str.11 = [24 x i8] c"onfinish exit; run -all\00"
@.str.12 = [5 x i8] c"-pli\00"
@.str.13 = [13 x i8] c"cosim_vpi.sl\00"
define i8** @commandExecute(i32 %0, i8* %1, i8* %2) {
%4 = alloca i8**
%5 = alloca i32
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i8**
store i32 %0, i32* %5
store i8* %1, i8** %6
store i8* %2, i8** %7
store i8** null, i8*** %8
%9 = load i32, i32* %5
switch i32 %9, label %207 [
i32 1, label %10
i32 3, label %88
i32 2, label %90
]
10: ; preds = %3
%11 = load i8*, i8** %6
%12 = icmp eq i8* %11, null
br i1 %12, label %13, label %15
13: ; preds = %10
%14 = call i32 @printf(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str, i64 0, i64 0))
br label %87
15: ; preds = %10
%16 = call i64 @malloc(i32 48)
%17 = inttoptr i64 %16 to i8**
store i8** %17, i8*** %8
%18 = call i32 @strlen(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
%19 = add nsw i32 %18, 1
%20 = sext i32 %19 to i64
%21 = mul i64 %20, 1
%22 = trunc i64 %21 to i32
%23 = call i64 @malloc(i32 %22)
%24 = inttoptr i64 %23 to i8*
%25 = load i8**, i8*** %8
%26 = getelementptr inbounds i8*, i8** %25, i64 0
store i8* %24, i8** %26
%27 = load i8**, i8*** %8
%28 = getelementptr inbounds i8*, i8** %27, i64 0
%29 = load i8*, i8** %28
%30 = call i32 @strcpy(i8* %29, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
%31 = call i32 @strlen(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
%32 = add nsw i32 %31, 1
%33 = sext i32 %32 to i64
%34 = mul i64 %33, 1
%35 = trunc i64 %34 to i32
%36 = call i64 @malloc(i32 %35)
%37 = inttoptr i64 %36 to i8*
%38 = load i8**, i8*** %8
%39 = getelementptr inbounds i8*, i8** %38, i64 1
store i8* %37, i8** %39
%40 = load i8**, i8*** %8
%41 = getelementptr inbounds i8*, i8** %40, i64 1
%42 = load i8*, i8** %41
%43 = call i32 @strcpy(i8* %42, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
%44 = call i32 @strlen(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0))
%45 = add nsw i32 %44, 1
%46 = sext i32 %45 to i64
%47 = mul i64 %46, 1
%48 = trunc i64 %47 to i32
%49 = call i64 @malloc(i32 %48)
%50 = inttoptr i64 %49 to i8*
%51 = load i8**, i8*** %8
%52 = getelementptr inbounds i8*, i8** %51, i64 2
store i8* %50, i8** %52
%53 = load i8**, i8*** %8
%54 = getelementptr inbounds i8*, i8** %53, i64 2
%55 = load i8*, i8** %54
%56 = call i32 @strcpy(i8* %55, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0))
%57 = call i32 @strlen(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.4, i64 0, i64 0))
%58 = add nsw i32 %57, 1
%59 = sext i32 %58 to i64
%60 = mul i64 %59, 1
%61 = trunc i64 %60 to i32
%62 = call i64 @malloc(i32 %61)
%63 = inttoptr i64 %62 to i8*
%64 = load i8**, i8*** %8
%65 = getelementptr inbounds i8*, i8** %64, i64 3
store i8* %63, i8** %65
%66 = load i8**, i8*** %8
%67 = getelementptr inbounds i8*, i8** %66, i64 3
%68 = load i8*, i8** %67
%69 = call i32 @strcpy(i8* %68, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.4, i64 0, i64 0))
%70 = load i8*, i8** %6
%71 = call i32 @strlen(i8* %70)
%72 = add nsw i32 %71, 1
%73 = sext i32 %72 to i64
%74 = mul i64 %73, 1
%75 = trunc i64 %74 to i32
%76 = call i64 @malloc(i32 %75)
%77 = inttoptr i64 %76 to i8*
%78 = load i8**, i8*** %8
%79 = getelementptr inbounds i8*, i8** %78, i64 4
store i8* %77, i8** %79
%80 = load i8**, i8*** %8
%81 = getelementptr inbounds i8*, i8** %80, i64 4
%82 = load i8*, i8** %81
%83 = load i8*, i8** %6
%84 = call i32 @strcpy(i8* %82, i8* %83)
%85 = load i8**, i8*** %8
%86 = getelementptr inbounds i8*, i8** %85, i64 5
store i8* null, i8** %86
br label %87
87: ; preds = %15, %13
br label %208
88: ; preds = %3
%89 = call i32 @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.5, i64 0, i64 0))
store i8** null, i8*** %4
br label %210
90: ; preds = %3
%91 = load i8*, i8** %7
%92 = icmp eq i8* %91, null
br i1 %92, label %93, label %95
93: ; preds = %90
%94 = call i32 @printf(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.6, i64 0, i64 0))
br label %206
95: ; preds = %90
%96 = call i64 @malloc(i32 72)
%97 = inttoptr i64 %96 to i8**
store i8** %97, i8*** %8
%98 = call i32 @strlen(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.7, i64 0, i64 0))
%99 = add nsw i32 %98, 1
%100 = sext i32 %99 to i64
%101 = mul i64 %100, 1
%102 = trunc i64 %101 to i32
%103 = call i64 @malloc(i32 %102)
%104 = inttoptr i64 %103 to i8*
%105 = load i8**, i8*** %8
%106 = getelementptr inbounds i8*, i8** %105, i64 0
store i8* %104, i8** %106
%107 = load i8**, i8*** %8
%108 = getelementptr inbounds i8*, i8** %107, i64 0
%109 = load i8*, i8** %108
%110 = call i32 @strcpy(i8* %109, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.7, i64 0, i64 0))
%111 = call i32 @strlen(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.8, i64 0, i64 0))
%112 = add nsw i32 %111, 1
%113 = sext i32 %112 to i64
%114 = mul i64 %113, 1
%115 = trunc i64 %114 to i32
%116 = call i64 @malloc(i32 %115)
%117 = inttoptr i64 %116 to i8*
%118 = load i8**, i8*** %8
%119 = getelementptr inbounds i8*, i8** %118, i64 1
store i8* %117, i8** %119
%120 = load i8**, i8*** %8
%121 = getelementptr inbounds i8*, i8** %120, i64 1
%122 = load i8*, i8** %121
%123 = call i32 @strcpy(i8* %122, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.8, i64 0, i64 0))
%124 = call i32 @strlen(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.9, i64 0, i64 0))
%125 = add nsw i32 %124, 1
%126 = sext i32 %125 to i64
%127 = mul i64 %126, 1
%128 = trunc i64 %127 to i32
%129 = call i64 @malloc(i32 %128)
%130 = inttoptr i64 %129 to i8*
%131 = load i8**, i8*** %8
%132 = getelementptr inbounds i8*, i8** %131, i64 2
store i8* %130, i8** %132
%133 = load i8**, i8*** %8
%134 = getelementptr inbounds i8*, i8** %133, i64 2
%135 = load i8*, i8** %134
%136 = call i32 @strcpy(i8* %135, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.9, i64 0, i64 0))
%137 = call i32 @strlen(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.10, i64 0, i64 0))
%138 = add nsw i32 %137, 1
%139 = sext i32 %138 to i64
%140 = mul i64 %139, 1
%141 = trunc i64 %140 to i32
%142 = call i64 @malloc(i32 %141)
%143 = inttoptr i64 %142 to i8*
%144 = load i8**, i8*** %8
%145 = getelementptr inbounds i8*, i8** %144, i64 3
store i8* %143, i8** %145
%146 = load i8**, i8*** %8
%147 = getelementptr inbounds i8*, i8** %146, i64 3
%148 = load i8*, i8** %147
%149 = call i32 @strcpy(i8* %148, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.10, i64 0, i64 0))
%150 = call i32 @strlen(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.11, i64 0, i64 0))
%151 = add nsw i32 %150, 1
%152 = sext i32 %151 to i64
%153 = mul i64 %152, 1
%154 = trunc i64 %153 to i32
%155 = call i64 @malloc(i32 %154)
%156 = inttoptr i64 %155 to i8*
%157 = load i8**, i8*** %8
%158 = getelementptr inbounds i8*, i8** %157, i64 4
store i8* %156, i8** %158
%159 = load i8**, i8*** %8
%160 = getelementptr inbounds i8*, i8** %159, i64 4
%161 = load i8*, i8** %160
%162 = call i32 @strcpy(i8* %161, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.11, i64 0, i64 0))
%163 = load i8*, i8** %7
%164 = call i32 @strlen(i8* %163)
%165 = add nsw i32 %164, 1
%166 = sext i32 %165 to i64
%167 = mul i64 %166, 1
%168 = trunc i64 %167 to i32
%169 = call i64 @malloc(i32 %168)
%170 = inttoptr i64 %169 to i8*
%171 = load i8**, i8*** %8
%172 = getelementptr inbounds i8*, i8** %171, i64 5
store i8* %170, i8** %172
%173 = load i8**, i8*** %8
%174 = getelementptr inbounds i8*, i8** %173, i64 5
%175 = load i8*, i8** %174
%176 = load i8*, i8** %7
%177 = call i32 @strcpy(i8* %175, i8* %176)
%178 = call i32 @strlen(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.12, i64 0, i64 0))
%179 = add nsw i32 %178, 1
%180 = sext i32 %179 to i64
%181 = mul i64 %180, 1
%182 = trunc i64 %181 to i32
%183 = call i64 @malloc(i32 %182)
%184 = inttoptr i64 %183 to i8*
%185 = load i8**, i8*** %8
%186 = getelementptr inbounds i8*, i8** %185, i64 6
store i8* %184, i8** %186
%187 = load i8**, i8*** %8
%188 = getelementptr inbounds i8*, i8** %187, i64 6
%189 = load i8*, i8** %188
%190 = call i32 @strcpy(i8* %189, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.12, i64 0, i64 0))
%191 = call i32 @strlen(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.13, i64 0, i64 0))
%192 = add nsw i32 %191, 1
%193 = sext i32 %192 to i64
%194 = mul i64 %193, 1
%195 = trunc i64 %194 to i32
%196 = call i64 @malloc(i32 %195)
%197 = inttoptr i64 %196 to i8*
%198 = load i8**, i8*** %8
%199 = getelementptr inbounds i8*, i8** %198, i64 7
store i8* %197, i8** %199
%200 = load i8**, i8*** %8
%201 = getelementptr inbounds i8*, i8** %200, i64 7
%202 = load i8*, i8** %201
%203 = call i32 @strcpy(i8* %202, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.13, i64 0, i64 0))
%204 = load i8**, i8*** %8
%205 = getelementptr inbounds i8*, i8** %204, i64 8
store i8* null, i8** %205
br label %206
206: ; preds = %95, %93
br label %208
207: ; preds = %3
br label %208
208: ; preds = %207, %206, %87
%209 = load i8**, i8*** %8
store i8** %209, i8*** %4
br label %210
210: ; preds = %208, %88
%211 = load i8**, i8*** %4
ret i8** %211
}

LLVM IR (-O2):
@.str.1 = [4 x i8] c"vvp\00"
@.str.2 = [3 x i8] c"-N\00"
@.str.3 = [4 x i8] c"-M.\00"
@.str.4 = [12 x i8] c"-mcosim_vpi\00"
@.str.7 = [5 x i8] c"vsim\00"
@.str.8 = [3 x i8] c"-c\00"
@.str.9 = [7 x i8] c"-quiet\00"
@.str.10 = [4 x i8] c"-do\00"
@.str.11 = [24 x i8] c"onfinish exit; run -all\00"
@.str.12 = [5 x i8] c"-pli\00"
@.str.13 = [13 x i8] c"cosim_vpi.sl\00"
@str = [43 x i8] c"Top-Entity is needed for defining command.\00"
@str.14 = [27 x i8] c"GHDL is not supported yet.\00"
@str.15 = [42 x i8] c"File-Name is needed for defining command.\00"
define i8** @commandExecute(i32 %0, i8* %1, i8* %2) {
switch i32 %0, label %98 [
i32 1, label %4
i32 3, label %41
i32 2, label %43
]
4: ; preds = %3
%5 = icmp eq i8* %1, null
br i1 %5, label %6, label %8
6: ; preds = %4
%7 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([42 x i8], [42 x i8]* @str.15, i64 0, i64 0))
br label %98
8: ; preds = %4
%9 = tail call i64 @malloc(i32 48)
%10 = inttoptr i64 %9 to i8**
%11 = tail call i32 @strlen(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
%12 = add nsw i32 %11, 1
%13 = tail call i64 @malloc(i32 %12)
%14 = inttoptr i64 %13 to i8*
store i8* %14, i8** %10
%15 = tail call i32 @strcpy(i8* %14, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
%16 = tail call i32 @strlen(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
%17 = add nsw i32 %16, 1
%18 = tail call i64 @malloc(i32 %17)
%19 = inttoptr i64 %18 to i8*
%20 = getelementptr inbounds i8*, i8** %10, i64 1
store i8* %19, i8** %20
%21 = tail call i32 @strcpy(i8* %19, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
%22 = tail call i32 @strlen(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0))
%23 = add nsw i32 %22, 1
%24 = tail call i64 @malloc(i32 %23)
%25 = inttoptr i64 %24 to i8*
%26 = getelementptr inbounds i8*, i8** %10, i64 2
store i8* %25, i8** %26
%27 = tail call i32 @strcpy(i8* %25, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0))
%28 = tail call i32 @strlen(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.4, i64 0, i64 0))
%29 = add nsw i32 %28, 1
%30 = tail call i64 @malloc(i32 %29)
%31 = inttoptr i64 %30 to i8*
%32 = getelementptr inbounds i8*, i8** %10, i64 3
store i8* %31, i8** %32
%33 = tail call i32 @strcpy(i8* %31, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.4, i64 0, i64 0))
%34 = tail call i32 @strlen(i8* %1)
%35 = add nsw i32 %34, 1
%36 = tail call i64 @malloc(i32 %35)
%37 = inttoptr i64 %36 to i8*
%38 = getelementptr inbounds i8*, i8** %10, i64 4
store i8* %37, i8** %38
%39 = tail call i32 @strcpy(i8* %37, i8* %1)
%40 = getelementptr inbounds i8*, i8** %10, i64 5
store i8* null, i8** %40
br label %98
41: ; preds = %3
%42 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @str.14, i64 0, i64 0))
br label %98
43: ; preds = %3
%44 = icmp eq i8* %2, null
br i1 %44, label %45, label %47
45: ; preds = %43
%46 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([43 x i8], [43 x i8]* @str, i64 0, i64 0))
br label %98
47: ; preds = %43
%48 = tail call i64 @malloc(i32 72)
%49 = inttoptr i64 %48 to i8**
%50 = tail call i32 @strlen(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.7, i64 0, i64 0))
%51 = add nsw i32 %50, 1
%52 = tail call i64 @malloc(i32 %51)
%53 = inttoptr i64 %52 to i8*
store i8* %53, i8** %49
%54 = tail call i32 @strcpy(i8* %53, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.7, i64 0, i64 0))
%55 = tail call i32 @strlen(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.8, i64 0, i64 0))
%56 = add nsw i32 %55, 1
%57 = tail call i64 @malloc(i32 %56)
%58 = inttoptr i64 %57 to i8*
%59 = getelementptr inbounds i8*, i8** %49, i64 1
store i8* %58, i8** %59
%60 = tail call i32 @strcpy(i8* %58, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.8, i64 0, i64 0))
%61 = tail call i32 @strlen(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.9, i64 0, i64 0))
%62 = add nsw i32 %61, 1
%63 = tail call i64 @malloc(i32 %62)
%64 = inttoptr i64 %63 to i8*
%65 = getelementptr inbounds i8*, i8** %49, i64 2
store i8* %64, i8** %65
%66 = tail call i32 @strcpy(i8* %64, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.9, i64 0, i64 0))
%67 = tail call i32 @strlen(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.10, i64 0, i64 0))
%68 = add nsw i32 %67, 1
%69 = tail call i64 @malloc(i32 %68)
%70 = inttoptr i64 %69 to i8*
%71 = getelementptr inbounds i8*, i8** %49, i64 3
store i8* %70, i8** %71
%72 = tail call i32 @strcpy(i8* %70, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.10, i64 0, i64 0))
%73 = tail call i32 @strlen(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.11, i64 0, i64 0))
%74 = add nsw i32 %73, 1
%75 = tail call i64 @malloc(i32 %74)
%76 = inttoptr i64 %75 to i8*
%77 = getelementptr inbounds i8*, i8** %49, i64 4
store i8* %76, i8** %77
%78 = tail call i32 @strcpy(i8* %76, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.11, i64 0, i64 0))
%79 = tail call i32 @strlen(i8* %2)
%80 = add nsw i32 %79, 1
%81 = tail call i64 @malloc(i32 %80)
%82 = inttoptr i64 %81 to i8*
%83 = getelementptr inbounds i8*, i8** %49, i64 5
store i8* %82, i8** %83
%84 = tail call i32 @strcpy(i8* %82, i8* %2)
%85 = tail call i32 @strlen(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.12, i64 0, i64 0))
%86 = add nsw i32 %85, 1
%87 = tail call i64 @malloc(i32 %86)
%88 = inttoptr i64 %87 to i8*
%89 = getelementptr inbounds i8*, i8** %49, i64 6
store i8* %88, i8** %89
%90 = tail call i32 @strcpy(i8* %88, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.12, i64 0, i64 0))
%91 = tail call i32 @strlen(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.13, i64 0, i64 0))
%92 = add nsw i32 %91, 1
%93 = tail call i64 @malloc(i32 %92)
%94 = inttoptr i64 %93 to i8*
%95 = getelementptr inbounds i8*, i8** %49, i64 7
store i8* %94, i8** %95
%96 = tail call i32 @strcpy(i8* %94, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.13, i64 0, i64 0))
%97 = getelementptr inbounds i8*, i8** %49, i64 8
store i8* null, i8** %97
br label %98
98: ; preds = %8, %6, %47, %45, %3, %41
%99 = phi i8** [ null, %41 ], [ null, %3 ], [ null, %45 ], [ %49, %47 ], [ null, %6 ], [ %10, %8 ]
ret i8** %99
}