#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*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ free(char *);
char *malloc(int);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ strcat(char *, char const *);
int strlen(char const *);
int system(char *);
int run_test_suite(const char *executable_file_name, int verbose,
                   int stderr_log) {
  int valgrindlen = 0;
  int retval = 0;
  int optlen = 0;
  char *command = NULL;
  if (NULL == executable_file_name) {
    fprintf(stderr,
            "ERROR: Internal error, suite executable is NULL pointer\n");
    return -1;
  }
  if (0 == verbose) {
    optlen = strlen(" -j -s");
  } else if (2 == verbose) {
    optlen = strlen(" -v -j -s");
    valgrindlen = strlen("valgrind --track-origins=yes -q ");
  } else {
    optlen = strlen(" -? -j -s");
  }
  if (1 == stderr_log) {
    optlen += strlen(" -l");
  }
  command = malloc(valgrindlen + strlen(executable_file_name) + optlen + 1);
  if (NULL == command) {
    fprintf(stderr, "ERROR: Out of memory while allocating suite command.\n");
    return -1;
  }
  command[0] = 0;
  if (2 == verbose) {
    strcat(command, "valgrind --track-origins=yes -q ");
  }
  strcat(command, executable_file_name);
  if (1 == verbose) {
    strcat(command, " -v");
  } else if (2 == verbose) {
    strcat(command, " -v");
  } else if (-1 == verbose) {
    strcat(command, " -n");
  }
  strcat(command, " -j -s");
  if (1 == stderr_log) {
    strcat(command, " -l");
  }
  retval = system(command);
  free(command);
  return retval;
}


x86 assembly (clang, -O0):
<run_test_suite>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    %edx,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
movl   $0x0,-0x20(%rbp)
movl   $0x0,-0x24(%rbp)
movq   $0x0,-0x30(%rbp)
xor    %eax,%eax
cmp    -0x10(%rbp),%rax
jne    11bc <run_test_suite+0x5c>
mov    0x2e3e(%rip),%rax
mov    (%rax),%edi
lea    0xe55(%rip),%rsi
call   1060 <fprintf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    1379 <run_test_suite+0x219>
xor    %eax,%eax
cmp    -0x14(%rbp),%eax
jne    11db <run_test_suite+0x7b>
lea    0xe99(%rip),%rdi
call   1040 <strlen@plt>
mov    %eax,-0x24(%rbp)
jmp    1220 <run_test_suite+0xc0>
mov    $0x2,%eax
cmp    -0x14(%rbp),%eax
jne    120c <run_test_suite+0xac>
lea    0xe49(%rip),%rdi
call   1040 <strlen@plt>
mov    %eax,-0x24(%rbp)
lea    0xe44(%rip),%rdi
call   1040 <strlen@plt>
mov    %eax,-0x1c(%rbp)
jmp    121b <run_test_suite+0xbb>
lea    0xe51(%rip),%rdi
call   1040 <strlen@plt>
mov    %eax,-0x24(%rbp)
jmp    1220 <run_test_suite+0xc0>
mov    $0x1,%eax
cmp    -0x18(%rbp),%eax
jne    1240 <run_test_suite+0xe0>
lea    0xe39(%rip),%rdi
call   1040 <strlen@plt>
add    -0x24(%rbp),%eax
mov    %eax,-0x24(%rbp)
mov    -0x1c(%rbp),%eax
mov    %eax,-0x34(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <strlen@plt>
mov    -0x34(%rbp),%edi
add    %eax,%edi
add    -0x24(%rbp),%edi
add    $0x1,%edi
call   1070 <malloc@plt>
mov    %rax,-0x30(%rbp)
xor    %eax,%eax
cmp    -0x30(%rbp),%rax
jne    1290 <run_test_suite+0x130>
mov    0x2d6a(%rip),%rax
mov    (%rax),%edi
lea    0xdf3(%rip),%rsi
call   1060 <fprintf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    1379 <run_test_suite+0x219>
mov    -0x30(%rbp),%rax
movb   $0x0,(%rax)
mov    $0x2,%eax
cmp    -0x14(%rbp),%eax
jne    12b5 <run_test_suite+0x155>
mov    -0x30(%rbp),%rdi
lea    0xd93(%rip),%rsi
call   1080 <strcat@plt>
mov    -0x30(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1080 <strcat@plt>
mov    $0x1,%eax
cmp    -0x14(%rbp),%eax
jne    12e5 <run_test_suite+0x185>
mov    -0x30(%rbp),%rdi
lea    0xdcd(%rip),%rsi
call   1080 <strcat@plt>
jmp    1330 <run_test_suite+0x1d0>
mov    $0x2,%eax
cmp    -0x14(%rbp),%eax
jne    1308 <run_test_suite+0x1a8>
mov    -0x30(%rbp),%rdi
lea    0xdaa(%rip),%rsi
call   1080 <strcat@plt>
jmp    132b <run_test_suite+0x1cb>
mov    $0xffffffff,%eax
cmp    -0x14(%rbp),%eax
jne    1326 <run_test_suite+0x1c6>
mov    -0x30(%rbp),%rdi
lea    0xd8b(%rip),%rsi
call   1080 <strcat@plt>
jmp    132b <run_test_suite+0x1cb>
jmp    1330 <run_test_suite+0x1d0>
mov    -0x30(%rbp),%rdi
lea    0xd2c(%rip),%rsi
call   1080 <strcat@plt>
mov    $0x1,%eax
cmp    -0x18(%rbp),%eax
jne    135e <run_test_suite+0x1fe>
mov    -0x30(%rbp),%rdi
lea    0xd15(%rip),%rsi
call   1080 <strcat@plt>
mov    -0x30(%rbp),%rdi
call   1050 <system@plt>
mov    %eax,-0x20(%rbp)
mov    -0x30(%rbp),%rdi
call   1030 <free@plt>
mov    -0x20(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<run_test_suite>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
test   %rdi,%rdi
je     1189 <run_test_suite+0x29>
mov    %edx,%r14d
mov    %esi,%r15d
mov    %rdi,%r12
cmp    $0x2,%esi
je     119e <run_test_suite+0x3e>
test   %r15d,%r15d
jne    11c5 <run_test_suite+0x65>
lea    0xee0(%rip),%rdi
jmp    11cc <run_test_suite+0x6c>
mov    0x2e50(%rip),%rax
mov    (%rax),%edi
lea    0xe67(%rip),%rsi
jmp    1243 <run_test_suite+0xe3>
lea    0xe94(%rip),%rdi
call   1040 <strlen@plt>
mov    %eax,%ebx
lea    0xe90(%rip),%rdi
call   1040 <strlen@plt>
mov    %eax,%ebp
add    $0x1,%ebp
cmp    $0x1,%r14d
je     11de <run_test_suite+0x7e>
jmp    11ec <run_test_suite+0x8c>
lea    0xe98(%rip),%rdi
call   1040 <strlen@plt>
mov    %eax,%ebx
mov    $0x1,%ebp
cmp    $0x1,%r14d
jne    11ec <run_test_suite+0x8c>
lea    0xe89(%rip),%rdi
call   1040 <strlen@plt>
add    %eax,%ebx
add    %ebx,%ebp
mov    %r12,%rdi
call   1040 <strlen@plt>
add    %eax,%ebp
mov    %ebp,%edi
call   1070 <malloc@plt>
test   %rax,%rax
je     1233 <run_test_suite+0xd3>
mov    %rax,%rbp
movb   $0x0,(%rax)
cmp    $0x2,%r15d
jne    124f <run_test_suite+0xef>
lea    0xe2c(%rip),%rsi
mov    %rbp,%rdi
call   1080 <strcat@plt>
mov    %rbp,%rdi
mov    %r12,%rsi
call   1080 <strcat@plt>
lea    0xe77(%rip),%rsi
jmp    1276 <run_test_suite+0x116>
mov    0x2da6(%rip),%rax
mov    (%rax),%edi
lea    0xe2f(%rip),%rsi
call   1060 <fprintf@plt>
mov    $0xffffffff,%eax
jmp    12b6 <run_test_suite+0x156>
mov    %rbp,%rdi
mov    %r12,%rsi
call   1080 <strcat@plt>
cmp    $0xffffffff,%r15d
je     126f <run_test_suite+0x10f>
cmp    $0x1,%r15d
jne    127e <run_test_suite+0x11e>
lea    0xe3b(%rip),%rsi
jmp    1276 <run_test_suite+0x116>
lea    0xe36(%rip),%rsi
mov    %rbp,%rdi
call   1080 <strcat@plt>
lea    0xde2(%rip),%rsi
mov    %rbp,%rdi
call   1080 <strcat@plt>
cmp    $0x1,%r14d
jne    12a2 <run_test_suite+0x142>
lea    0xdd4(%rip),%rsi
mov    %rbp,%rdi
call   1080 <strcat@plt>
mov    %rbp,%rdi
call   1050 <system@plt>
mov    %eax,%ebx
mov    %rbp,%rdi
call   1030 <free@plt>
mov    %ebx,%eax
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@stderr = global i32 0
@.str = [57 x i8] c"ERROR: Internal error, suite executable is NULL pointer\0A\00"
@.str.1 = [7 x i8] c" -j -s\00"
@.str.2 = [10 x i8] c" -v -j -s\00"
@.str.3 = [33 x i8] c"valgrind --track-origins=yes -q \00"
@.str.4 = [10 x i8] c" -? -j -s\00"
@.str.5 = [4 x i8] c" -l\00"
@.str.6 = [54 x i8] c"ERROR: Out of memory while allocating suite command.\0A\00"
@.str.7 = [4 x i8] c" -v\00"
@.str.8 = [4 x i8] c" -n\00"
define i32 @run_test_suite(i8* %0, i32 %1, i32 %2) {
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i8*
store i8* %0, i8** %5
store i32 %1, i32* %6
store i32 %2, i32* %7
store i32 0, i32* %8
store i32 0, i32* %9
store i32 0, i32* %10
store i8* null, i8** %11
%12 = load i8*, i8** %5
%13 = icmp eq i8* null, %12
br i1 %13, label %14, label %17
14: ; preds = %3
%15 = load i32, i32* @stderr
%16 = call i32 @fprintf(i32 %15, i8* getelementptr inbounds ([57 x i8], [57 x i8]* @.str, i64 0, i64 0))
store i32 -1, i32* %4
br label %97
17: ; preds = %3
%18 = load i32, i32* %6
%19 = icmp eq i32 0, %18
br i1 %19, label %20, label %22
20: ; preds = %17
%21 = call i32 @strlen(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
store i32 %21, i32* %10
br label %31
22: ; preds = %17
%23 = load i32, i32* %6
%24 = icmp eq i32 2, %23
br i1 %24, label %25, label %28
25: ; preds = %22
%26 = call i32 @strlen(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0))
store i32 %26, i32* %10
%27 = call i32 @strlen(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.3, i64 0, i64 0))
store i32 %27, i32* %8
br label %30
28: ; preds = %22
%29 = call i32 @strlen(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.4, i64 0, i64 0))
store i32 %29, i32* %10
br label %30
30: ; preds = %28, %25
br label %31
31: ; preds = %30, %20
%32 = load i32, i32* %7
%33 = icmp eq i32 1, %32
br i1 %33, label %34, label %38
34: ; preds = %31
%35 = call i32 @strlen(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0))
%36 = load i32, i32* %10
%37 = add nsw i32 %36, %35
store i32 %37, i32* %10
br label %38
38: ; preds = %34, %31
%39 = load i32, i32* %8
%40 = load i8*, i8** %5
%41 = call i32 @strlen(i8* %40)
%42 = add nsw i32 %39, %41
%43 = load i32, i32* %10
%44 = add nsw i32 %42, %43
%45 = add nsw i32 %44, 1
%46 = call i8* @malloc(i32 %45)
store i8* %46, i8** %11
%47 = load i8*, i8** %11
%48 = icmp eq i8* null, %47
br i1 %48, label %49, label %52
49: ; preds = %38
%50 = load i32, i32* @stderr
%51 = call i32 @fprintf(i32 %50, i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str.6, i64 0, i64 0))
store i32 -1, i32* %4
br label %97
52: ; preds = %38
%53 = load i8*, i8** %11
%54 = getelementptr inbounds i8, i8* %53, i64 0
store i8 0, i8* %54
%55 = load i32, i32* %6
%56 = icmp eq i32 2, %55
br i1 %56, label %57, label %60
57: ; preds = %52
%58 = load i8*, i8** %11
%59 = call i32 @strcat(i8* %58, i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.3, i64 0, i64 0))
br label %60
60: ; preds = %57, %52
%61 = load i8*, i8** %11
%62 = load i8*, i8** %5
%63 = call i32 @strcat(i8* %61, i8* %62)
%64 = load i32, i32* %6
%65 = icmp eq i32 1, %64
br i1 %65, label %66, label %69
66: ; preds = %60
%67 = load i8*, i8** %11
%68 = call i32 @strcat(i8* %67, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.7, i64 0, i64 0))
br label %83
69: ; preds = %60
%70 = load i32, i32* %6
%71 = icmp eq i32 2, %70
br i1 %71, label %72, label %75
72: ; preds = %69
%73 = load i8*, i8** %11
%74 = call i32 @strcat(i8* %73, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.7, i64 0, i64 0))
br label %82
75: ; preds = %69
%76 = load i32, i32* %6
%77 = icmp eq i32 -1, %76
br i1 %77, label %78, label %81
78: ; preds = %75
%79 = load i8*, i8** %11
%80 = call i32 @strcat(i8* %79, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.8, i64 0, i64 0))
br label %81
81: ; preds = %78, %75
br label %82
82: ; preds = %81, %72
br label %83
83: ; preds = %82, %66
%84 = load i8*, i8** %11
%85 = call i32 @strcat(i8* %84, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
%86 = load i32, i32* %7
%87 = icmp eq i32 1, %86
br i1 %87, label %88, label %91
88: ; preds = %83
%89 = load i8*, i8** %11
%90 = call i32 @strcat(i8* %89, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0))
br label %91
91: ; preds = %88, %83
%92 = load i8*, i8** %11
%93 = call i32 @system(i8* %92)
store i32 %93, i32* %9
%94 = load i8*, i8** %11
%95 = call i32 @free(i8* %94)
%96 = load i32, i32* %9
store i32 %96, i32* %4
br label %97
97: ; preds = %91, %49, %14
%98 = load i32, i32* %4
ret i32 %98
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [57 x i8] c"ERROR: Internal error, suite executable is NULL pointer\0A\00"
@.str.1 = [7 x i8] c" -j -s\00"
@.str.2 = [10 x i8] c" -v -j -s\00"
@.str.3 = [33 x i8] c"valgrind --track-origins=yes -q \00"
@.str.4 = [10 x i8] c" -? -j -s\00"
@.str.5 = [4 x i8] c" -l\00"
@.str.6 = [54 x i8] c"ERROR: Out of memory while allocating suite command.\0A\00"
@.str.7 = [4 x i8] c" -v\00"
@.str.8 = [4 x i8] c" -n\00"
define i32 @run_test_suite(i8* %0, i32 %1, i32 %2) {
%4 = icmp eq i8* %0, null
br i1 %4, label %5, label %8
5: ; preds = %3
%6 = load i32, i32* @stderr
%7 = tail call i32 @fprintf(i32 %6, i8* getelementptr inbounds ([57 x i8], [57 x i8]* @.str, i64 0, i64 0))
br label %52
8: ; preds = %3
switch i32 %1, label %15 [
i32 0, label %9
i32 2, label %11
]
9: ; preds = %8
%10 = tail call i32 @strlen(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
br label %17
11: ; preds = %8
%12 = tail call i32 @strlen(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0))
%13 = tail call i32 @strlen(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.3, i64 0, i64 0))
%14 = add i32 %13, 1
br label %17
15: ; preds = %8
%16 = tail call i32 @strlen(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.4, i64 0, i64 0))
br label %17
17: ; preds = %11, %15, %9
%18 = phi i32 [ 1, %9 ], [ %14, %11 ], [ 1, %15 ]
%19 = phi i32 [ %10, %9 ], [ %12, %11 ], [ %16, %15 ]
%20 = icmp eq i32 %2, 1
br i1 %20, label %21, label %24
21: ; preds = %17
%22 = tail call i32 @strlen(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0))
%23 = add nsw i32 %22, %19
br label %24
24: ; preds = %21, %17
%25 = phi i32 [ %23, %21 ], [ %19, %17 ]
%26 = tail call i32 @strlen(i8* %0)
%27 = add i32 %18, %25
%28 = add i32 %27, %26
%29 = tail call i8* @malloc(i32 %28)
%30 = icmp eq i8* %29, null
br i1 %30, label %31, label %34
31: ; preds = %24
%32 = load i32, i32* @stderr
%33 = tail call i32 @fprintf(i32 %32, i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str.6, i64 0, i64 0))
br label %52
34: ; preds = %24
store i8 0, i8* %29
%35 = icmp eq i32 %1, 2
br i1 %35, label %38, label %36
36: ; preds = %34
%37 = tail call i32 @strcat(i8* %29, i8* %0)
switch i32 %1, label %45 [
i32 1, label %42
i32 -1, label %41
]
38: ; preds = %34
%39 = tail call i32 @strcat(i8* %29, i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.3, i64 0, i64 0))
%40 = tail call i32 @strcat(i8* %29, i8* %0)
br label %42
41: ; preds = %36
br label %42
42: ; preds = %36, %41, %38
%43 = phi i8* [ getelementptr inbounds ([4 x i8], [4 x i8]* @.str.7, i64 0, i64 0), %38 ], [ getelementptr inbounds ([4 x i8], [4 x i8]* @.str.8, i64 0, i64 0), %41 ], [ getelementptr inbounds ([4 x i8], [4 x i8]* @.str.7, i64 0, i64 0), %36 ]
%44 = tail call i32 @strcat(i8* %29, i8* %43)
br label %45
45: ; preds = %42, %36
%46 = tail call i32 @strcat(i8* %29, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
br i1 %20, label %47, label %49
47: ; preds = %45
%48 = tail call i32 @strcat(i8* %29, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0))
br label %49
49: ; preds = %47, %45
%50 = tail call i32 @system(i8* %29)
%51 = tail call i32 @free(i8* %29)
br label %52
52: ; preds = %49, %31, %5
%53 = phi i32 [ -1, %5 ], [ -1, %31 ], [ %50, %49 ]
ret i32 %53
}