#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*/ strcmp(char *, char *);
int /*<<< orphan*/ test_list();
int /*<<< orphan*/ test_queue();
int /*<<< orphan*/ test_stack();
int /*<<< orphan*/ test_vector();
int tests_get_failures();
int tests_get_successes();
int tests_get_total_tests();
int main(int argc, char **argv) {
  bool stack = false, queue = false, list = false, vector = false;
  if (argc < 2) {
    stack = true;
    queue = true;
    list = true;
    vector = true;
  } else {
    size_t i = 0;
    while (argv[++i]) {
      if (!strcmp(argv[i], "stack")) {
        stack = true;
      } else if (!strcmp(argv[i], "queue")) {
        queue = true;
      } else if (!strcmp(argv[i], "list")) {
        list = true;
      } else if (!strcmp(argv[i], "vector")) {
        vector = true;
      }
    }
  }
  if (stack) {
    printf("Running unit tests for generic stack...\n");
    test_stack();
  }
  if (queue) {
    printf("Running unit tests for generic queue...\n");
    test_queue();
  }
  if (list) {
    printf("Running unit tests for generic list...\n");
    test_list();
  }
  if (vector) {
    printf("Running unit tests for generic vector...\n");
    test_vector();
  }
  printf("%d successes and %d failures from %d tests.\n", tests_get_successes(),
         tests_get_failures(), tests_get_total_tests());
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
movl   $0x0,-0x20(%rbp)
cmpl   $0x2,-0x8(%rbp)
jge    11ed <main+0x5d>
movl   $0x1,-0x14(%rbp)
movl   $0x1,-0x18(%rbp)
movl   $0x1,-0x1c(%rbp)
movl   $0x1,-0x20(%rbp)
jmp    12dc <main+0x14c>
movq   $0x0,-0x28(%rbp)
mov    -0x10(%rbp),%rax
mov    -0x28(%rbp),%rcx
mov    %rcx,%rdx
add    $0x1,%rdx
mov    %rdx,-0x28(%rbp)
cmpq   $0x0,0x8(%rax,%rcx,8)
je     12d7 <main+0x147>
mov    -0x10(%rbp),%rax
mov    -0x28(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
lea    0xdd9(%rip),%rsi
call   1080 <strcmp@plt>
cmp    $0x0,%eax
jne    1241 <main+0xb1>
movl   $0x1,-0x14(%rbp)
jmp    12d2 <main+0x142>
mov    -0x10(%rbp),%rax
mov    -0x28(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
lea    0xdb2(%rip),%rsi
call   1080 <strcmp@plt>
cmp    $0x0,%eax
jne    126e <main+0xde>
movl   $0x1,-0x18(%rbp)
jmp    12cd <main+0x13d>
mov    -0x10(%rbp),%rax
mov    -0x28(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
lea    0xd8b(%rip),%rsi
call   1080 <strcmp@plt>
cmp    $0x0,%eax
jne    129b <main+0x10b>
movl   $0x1,-0x1c(%rbp)
jmp    12c8 <main+0x138>
mov    -0x10(%rbp),%rax
mov    -0x28(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
lea    0xd63(%rip),%rsi
call   1080 <strcmp@plt>
cmp    $0x0,%eax
jne    12c3 <main+0x133>
movl   $0x1,-0x20(%rbp)
jmp    12c8 <main+0x138>
jmp    12cd <main+0x13d>
jmp    12d2 <main+0x142>
jmp    11f5 <main+0x65>
jmp    12dc <main+0x14c>
cmpl   $0x0,-0x14(%rbp)
je     12fb <main+0x16b>
lea    0xd2b(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    $0x0,%al
call   10a0 <test_stack@plt>
cmpl   $0x0,-0x18(%rbp)
je     131a <main+0x18a>
lea    0xd35(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    $0x0,%al
call   1090 <test_queue@plt>
cmpl   $0x0,-0x1c(%rbp)
je     1339 <main+0x1a9>
lea    0xd3f(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    $0x0,%al
call   1070 <test_list@plt>
cmpl   $0x0,-0x20(%rbp)
je     1358 <main+0x1c8>
lea    0xd48(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    $0x0,%al
call   1030 <test_vector@plt>
mov    $0x0,%al
call   10b0 <tests_get_successes@plt>
mov    %eax,-0x30(%rbp)
mov    $0x0,%al
call   1050 <tests_get_failures@plt>
mov    %eax,-0x2c(%rbp)
mov    $0x0,%al
call   1060 <tests_get_total_tests@plt>
mov    -0x30(%rbp),%esi
mov    -0x2c(%rbp),%edx
mov    %eax,%ecx
lea    0xd3a(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    $0x1,%r13d
mov    $0x1,%ebp
mov    $0x1,%r12d
cmp    $0x2,%edi
jl     128b <main+0xeb>
mov    %rsi,%rbx
mov    0x8(%rsi),%rbp
test   %rbp,%rbp
je     12e5 <main+0x145>
add    $0x10,%rbx
xor    %r13d,%r13d
lea    0xe1d(%rip),%r14
movl   $0x0,0x4(%rsp)
xor    %r12d,%r12d
xor    %r15d,%r15d
jmp    1212 <main+0x72>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    $0x1,%r15d
mov    (%rbx),%rbp
add    $0x8,%rbx
test   %rbp,%rbp
je     1282 <main+0xe2>
mov    %rbp,%rdi
mov    %r14,%rsi
call   1090 <strcmp@plt>
test   %eax,%eax
je     1200 <main+0x60>
mov    %rbp,%rdi
lea    0xddb(%rip),%rsi
call   1090 <strcmp@plt>
test   %eax,%eax
je     1270 <main+0xd0>
mov    %rbp,%rdi
lea    0xdce(%rip),%rsi
call   1090 <strcmp@plt>
test   %eax,%eax
je     1278 <main+0xd8>
mov    %rbp,%rdi
lea    0xdc0(%rip),%rsi
call   1090 <strcmp@plt>
test   %eax,%eax
mov    $0x1,%eax
cmove  %eax,%r13d
jmp    1206 <main+0x66>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    $0x1,%r12d
jmp    1206 <main+0x66>
movl   $0x1,0x4(%rsp)
jmp    1206 <main+0x66>
test   %r15d,%r15d
mov    0x4(%rsp),%ebp
je     129e <main+0xfe>
lea    0xe2b(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
call   10b0 <test_stack@plt>
test   %r12d,%r12d
je     12b6 <main+0x116>
lea    0xdeb(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
call   10a0 <test_queue@plt>
test   %ebp,%ebp
je     12cd <main+0x12d>
lea    0xdad(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
call   1080 <test_list@plt>
test   %r13d,%r13d
je     12e5 <main+0x145>
lea    0xd6c(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
call   1040 <test_vector@plt>
xor    %eax,%eax
call   10c0 <tests_get_successes@plt>
mov    %eax,%ebx
xor    %eax,%eax
call   1060 <tests_get_failures@plt>
mov    %eax,%ebp
xor    %eax,%eax
call   1070 <tests_get_total_tests@plt>
lea    0xd13(%rip),%rdi
mov    %ebx,%esi
mov    %ebp,%edx
mov    %eax,%ecx
xor    %eax,%eax
call   1050 <printf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [6 x i8] c"stack\00"
@.str.1 = [6 x i8] c"queue\00"
@.str.2 = [5 x i8] c"list\00"
@.str.3 = [7 x i8] c"vector\00"
@.str.4 = [41 x i8] c"Running unit tests for generic stack...\0A\00"
@.str.5 = [41 x i8] c"Running unit tests for generic queue...\0A\00"
@.str.6 = [40 x i8] c"Running unit tests for generic list...\0A\00"
@.str.7 = [42 x i8] c"Running unit tests for generic vector...\0A\00"
@.str.8 = [45 x i8] c"%d successes and %d failures from %d tests.\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i64
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %6
store i32 0, i32* %7
store i32 0, i32* %8
store i32 0, i32* %9
%11 = load i32, i32* %4
%12 = icmp slt i32 %11, 2
br i1 %12, label %13, label %14
13: ; preds = %2
store i32 1, i32* %6
store i32 1, i32* %7
store i32 1, i32* %8
store i32 1, i32* %9
br label %59
14: ; preds = %2
store i64 0, i64* %10
br label %15
15: ; preds = %57, %14
%16 = load i8**, i8*** %5
%17 = load i64, i64* %10
%18 = add i64 %17, 1
store i64 %18, i64* %10
%19 = getelementptr inbounds i8*, i8** %16, i64 %18
%20 = load i8*, i8** %19
%21 = icmp ne i8* %20, null
br i1 %21, label %22, label %58
22: ; preds = %15
%23 = load i8**, i8*** %5
%24 = load i64, i64* %10
%25 = getelementptr inbounds i8*, i8** %23, i64 %24
%26 = load i8*, i8** %25
%27 = call i32 @strcmp(i8* %26, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%28 = icmp ne i32 %27, 0
br i1 %28, label %30, label %29
29: ; preds = %22
store i32 1, i32* %6
br label %57
30: ; preds = %22
%31 = load i8**, i8*** %5
%32 = load i64, i64* %10
%33 = getelementptr inbounds i8*, i8** %31, i64 %32
%34 = load i8*, i8** %33
%35 = call i32 @strcmp(i8* %34, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
%36 = icmp ne i32 %35, 0
br i1 %36, label %38, label %37
37: ; preds = %30
store i32 1, i32* %7
br label %56
38: ; preds = %30
%39 = load i8**, i8*** %5
%40 = load i64, i64* %10
%41 = getelementptr inbounds i8*, i8** %39, i64 %40
%42 = load i8*, i8** %41
%43 = call i32 @strcmp(i8* %42, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
%44 = icmp ne i32 %43, 0
br i1 %44, label %46, label %45
45: ; preds = %38
store i32 1, i32* %8
br label %55
46: ; preds = %38
%47 = load i8**, i8*** %5
%48 = load i64, i64* %10
%49 = getelementptr inbounds i8*, i8** %47, i64 %48
%50 = load i8*, i8** %49
%51 = call i32 @strcmp(i8* %50, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0))
%52 = icmp ne i32 %51, 0
br i1 %52, label %54, label %53
53: ; preds = %46
store i32 1, i32* %9
br label %54
54: ; preds = %53, %46
br label %55
55: ; preds = %54, %45
br label %56
56: ; preds = %55, %37
br label %57
57: ; preds = %56, %29
br label %15
58: ; preds = %15
br label %59
59: ; preds = %58, %13
%60 = load i32, i32* %6
%61 = icmp ne i32 %60, 0
br i1 %61, label %62, label %65
62: ; preds = %59
%63 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.4, i64 0, i64 0))
%64 = call i32 (...) @test_stack()
br label %65
65: ; preds = %62, %59
%66 = load i32, i32* %7
%67 = icmp ne i32 %66, 0
br i1 %67, label %68, label %71
68: ; preds = %65
%69 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.5, i64 0, i64 0))
%70 = call i32 (...) @test_queue()
br label %71
71: ; preds = %68, %65
%72 = load i32, i32* %8
%73 = icmp ne i32 %72, 0
br i1 %73, label %74, label %77
74: ; preds = %71
%75 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.6, i64 0, i64 0))
%76 = call i32 (...) @test_list()
br label %77
77: ; preds = %74, %71
%78 = load i32, i32* %9
%79 = icmp ne i32 %78, 0
br i1 %79, label %80, label %83
80: ; preds = %77
%81 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.7, i64 0, i64 0))
%82 = call i32 (...) @test_vector()
br label %83
83: ; preds = %80, %77
%84 = call i32 (...) @tests_get_successes()
%85 = call i32 (...) @tests_get_failures()
%86 = call i32 (...) @tests_get_total_tests()
%87 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.8, i64 0, i64 0), i32 %84, i32 %85, i32 %86)
ret i32 0
}

LLVM IR (-O2):
@.str = [6 x i8] c"stack\00"
@.str.1 = [6 x i8] c"queue\00"
@.str.2 = [5 x i8] c"list\00"
@.str.3 = [7 x i8] c"vector\00"
@.str.8 = [45 x i8] c"%d successes and %d failures from %d tests.\0A\00"
@str = [41 x i8] c"Running unit tests for generic vector...\00"
@str.9 = [39 x i8] c"Running unit tests for generic list...\00"
@str.10 = [40 x i8] c"Running unit tests for generic queue...\00"
@str.11 = [40 x i8] c"Running unit tests for generic stack...\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp slt i32 %0, 2
br i1 %3, label %38, label %4
4: ; preds = %2
%5 = getelementptr inbounds i8*, i8** %1, i64 1
%6 = load i8*, i8** %5
%7 = icmp eq i8* %6, null
br i1 %7, label %62, label %8
8: ; preds = %4, %27
%9 = phi i8* [ %34, %27 ], [ %6, %4 ]
%10 = phi i64 [ %32, %27 ], [ 1, %4 ]
%11 = phi i32 [ %31, %27 ], [ 0, %4 ]
%12 = phi i32 [ %30, %27 ], [ 0, %4 ]
%13 = phi i32 [ %29, %27 ], [ 0, %4 ]
%14 = phi i32 [ %28, %27 ], [ 0, %4 ]
%15 = tail call i32 @strcmp(i8* %9, i8* dereferenceable(6) getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%16 = icmp eq i32 %15, 0
br i1 %16, label %27, label %17
17: ; preds = %8
%18 = tail call i32 @strcmp(i8* %9, i8* dereferenceable(6) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
%19 = icmp eq i32 %18, 0
br i1 %19, label %27, label %20
20: ; preds = %17
%21 = tail call i32 @strcmp(i8* %9, i8* dereferenceable(5) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
%22 = icmp eq i32 %21, 0
br i1 %22, label %27, label %23
23: ; preds = %20
%24 = tail call i32 @strcmp(i8* %9, i8* dereferenceable(7) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0))
%25 = icmp eq i32 %24, 0
%26 = select i1 %25, i32 1, i32 %11
br label %27
27: ; preds = %23, %20, %17, %8
%28 = phi i32 [ 1, %8 ], [ %14, %17 ], [ %14, %20 ], [ %14, %23 ]
%29 = phi i32 [ %13, %8 ], [ 1, %17 ], [ %13, %20 ], [ %13, %23 ]
%30 = phi i32 [ %12, %8 ], [ %12, %17 ], [ 1, %20 ], [ %12, %23 ]
%31 = phi i32 [ %11, %8 ], [ %11, %17 ], [ %11, %20 ], [ %26, %23 ]
%32 = add i64 %10, 1
%33 = getelementptr inbounds i8*, i8** %1, i64 %32
%34 = load i8*, i8** %33
%35 = icmp eq i8* %34, null
br i1 %35, label %36, label %8
36: ; preds = %27
%37 = icmp eq i32 %28, 0
br i1 %37, label %44, label %38
38: ; preds = %2, %36
%39 = phi i32 [ %31, %36 ], [ 1, %2 ]
%40 = phi i32 [ %30, %36 ], [ 1, %2 ]
%41 = phi i32 [ %29, %36 ], [ 1, %2 ]
%42 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([40 x i8], [40 x i8]* @str.11, i64 0, i64 0))
%43 = tail call i32 (...) @test_stack()
br label %44
44: ; preds = %38, %36
%45 = phi i32 [ %39, %38 ], [ %31, %36 ]
%46 = phi i32 [ %40, %38 ], [ %30, %36 ]
%47 = phi i32 [ %41, %38 ], [ %29, %36 ]
%48 = icmp eq i32 %47, 0
br i1 %48, label %52, label %49
49: ; preds = %44
%50 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([40 x i8], [40 x i8]* @str.10, i64 0, i64 0))
%51 = tail call i32 (...) @test_queue()
br label %52
52: ; preds = %49, %44
%53 = icmp eq i32 %46, 0
br i1 %53, label %57, label %54
54: ; preds = %52
%55 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([39 x i8], [39 x i8]* @str.9, i64 0, i64 0))
%56 = tail call i32 (...) @test_list()
br label %57
57: ; preds = %54, %52
%58 = icmp eq i32 %45, 0
br i1 %58, label %62, label %59
59: ; preds = %57
%60 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([41 x i8], [41 x i8]* @str, i64 0, i64 0))
%61 = tail call i32 (...) @test_vector()
br label %62
62: ; preds = %4, %59, %57
%63 = tail call i32 (...) @tests_get_successes()
%64 = tail call i32 (...) @tests_get_failures()
%65 = tail call i32 (...) @tests_get_total_tests()
%66 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([45 x i8], [45 x i8]* @.str.8, i64 0, i64 0), i32 %63, i32 %64, i32 %65)
ret i32 0
}