#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 test_list_add();
int test_list_create();
int test_list_print();
int test_list_remove();
int test_list_search();
int test_str_split();
int test_all() {
  int num_tests;
  int num_passed;
  int return_value;
  num_tests = 0;
  num_passed = 0;
  num_tests++;
  return_value = test_str_split();
  if (return_value == 0) {
    num_passed++;
  }
  num_tests++;
  return_value = test_list_create();
  if (return_value == 0) {
    num_passed++;
  }
  num_tests++;
  return_value = test_list_add();
  if (return_value == 0) {
    num_passed++;
  }
  num_tests++;
  return_value = test_list_remove();
  if (return_value == 0) {
    num_passed++;
  }
  num_tests++;
  return_value = test_list_print();
  if (return_value == 0) {
    num_passed++;
  }
  num_tests++;
  return_value = test_list_search();
  if (return_value == 0) {
    num_passed++;
  }
  if (num_passed == num_tests) {
    printf("\n");
    printf("all tests passed\n");
    return 0;
  } else {
    printf("\n");
    printf("at least one test failed\n");
    return -1;
  }
}


x86 assembly (clang, -O0):
<test_all>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
mov    $0x0,%al
call   1060 <test_str_split@plt>
mov    %eax,-0x10(%rbp)
cmpl   $0x0,-0x10(%rbp)
jne    11ac <test_all+0x3c>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
mov    $0x0,%al
call   1030 <test_list_create@plt>
mov    %eax,-0x10(%rbp)
cmpl   $0x0,-0x10(%rbp)
jne    11d2 <test_all+0x62>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
mov    $0x0,%al
call   1090 <test_list_add@plt>
mov    %eax,-0x10(%rbp)
cmpl   $0x0,-0x10(%rbp)
jne    11f8 <test_all+0x88>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
mov    $0x0,%al
call   1070 <test_list_remove@plt>
mov    %eax,-0x10(%rbp)
cmpl   $0x0,-0x10(%rbp)
jne    121e <test_all+0xae>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
mov    $0x0,%al
call   1080 <test_list_print@plt>
mov    %eax,-0x10(%rbp)
cmpl   $0x0,-0x10(%rbp)
jne    1244 <test_all+0xd4>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
mov    $0x0,%al
call   1040 <test_list_search@plt>
mov    %eax,-0x10(%rbp)
cmpl   $0x0,-0x10(%rbp)
jne    126a <test_all+0xfa>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jne    129a <test_all+0x12a>
lea    0xdad(%rip),%rdi
call   1050 <printf@plt>
lea    0xd77(%rip),%rdi
call   1050 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    12b9 <test_all+0x149>
lea    0xd89(%rip),%rdi
call   1050 <printf@plt>
lea    0xd65(%rip),%rdi
call   1050 <printf@plt>
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_all>:
push   %rbp
push   %rbx
push   %rax
xor    %eax,%eax
call   1070 <test_str_split@plt>
xor    %ebx,%ebx
test   %eax,%eax
sete   %bl
xor    %eax,%eax
call   1030 <test_list_create@plt>
lea    0x1(%rbx),%ebp
test   %eax,%eax
cmovne %ebx,%ebp
xor    %eax,%eax
call   10a0 <test_list_add@plt>
cmp    $0x1,%eax
adc    $0x0,%ebp
xor    %eax,%eax
call   1080 <test_list_remove@plt>
cmp    $0x1,%eax
adc    $0x0,%ebp
xor    %eax,%eax
call   1090 <test_list_print@plt>
cmp    $0x1,%eax
adc    $0x0,%ebp
xor    %eax,%eax
call   1060 <test_list_search@plt>
cmp    $0x1,%eax
adc    $0x0,%ebp
mov    $0xa,%edi
call   1040 <putchar@plt>
xor    %ebx,%ebx
cmp    $0x6,%ebp
setne  %bl
lea    0xe2c(%rip),%rax
lea    0xe0c(%rip),%rdi
cmove  %rax,%rdi
neg    %ebx
call   1050 <puts@plt>
mov    %ebx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [2 x i8] c"\0A\00"
@.str.1 = [18 x i8] c"all tests passed\0A\00"
@.str.2 = [26 x i8] c"at least one test failed\0A\00"
define i32 @test_all() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 0, i32* %2
store i32 0, i32* %3
%5 = load i32, i32* %2
%6 = add nsw i32 %5, 1
store i32 %6, i32* %2
%7 = call i32 (...) @test_str_split()
store i32 %7, i32* %4
%8 = load i32, i32* %4
%9 = icmp eq i32 %8, 0
br i1 %9, label %10, label %13
10: ; preds = %0
%11 = load i32, i32* %3
%12 = add nsw i32 %11, 1
store i32 %12, i32* %3
br label %13
13: ; preds = %10, %0
%14 = load i32, i32* %2
%15 = add nsw i32 %14, 1
store i32 %15, i32* %2
%16 = call i32 (...) @test_list_create()
store i32 %16, i32* %4
%17 = load i32, i32* %4
%18 = icmp eq i32 %17, 0
br i1 %18, label %19, label %22
19: ; preds = %13
%20 = load i32, i32* %3
%21 = add nsw i32 %20, 1
store i32 %21, i32* %3
br label %22
22: ; preds = %19, %13
%23 = load i32, i32* %2
%24 = add nsw i32 %23, 1
store i32 %24, i32* %2
%25 = call i32 (...) @test_list_add()
store i32 %25, i32* %4
%26 = load i32, i32* %4
%27 = icmp eq i32 %26, 0
br i1 %27, label %28, label %31
28: ; preds = %22
%29 = load i32, i32* %3
%30 = add nsw i32 %29, 1
store i32 %30, i32* %3
br label %31
31: ; preds = %28, %22
%32 = load i32, i32* %2
%33 = add nsw i32 %32, 1
store i32 %33, i32* %2
%34 = call i32 (...) @test_list_remove()
store i32 %34, i32* %4
%35 = load i32, i32* %4
%36 = icmp eq i32 %35, 0
br i1 %36, label %37, label %40
37: ; preds = %31
%38 = load i32, i32* %3
%39 = add nsw i32 %38, 1
store i32 %39, i32* %3
br label %40
40: ; preds = %37, %31
%41 = load i32, i32* %2
%42 = add nsw i32 %41, 1
store i32 %42, i32* %2
%43 = call i32 (...) @test_list_print()
store i32 %43, i32* %4
%44 = load i32, i32* %4
%45 = icmp eq i32 %44, 0
br i1 %45, label %46, label %49
46: ; preds = %40
%47 = load i32, i32* %3
%48 = add nsw i32 %47, 1
store i32 %48, i32* %3
br label %49
49: ; preds = %46, %40
%50 = load i32, i32* %2
%51 = add nsw i32 %50, 1
store i32 %51, i32* %2
%52 = call i32 (...) @test_list_search()
store i32 %52, i32* %4
%53 = load i32, i32* %4
%54 = icmp eq i32 %53, 0
br i1 %54, label %55, label %58
55: ; preds = %49
%56 = load i32, i32* %3
%57 = add nsw i32 %56, 1
store i32 %57, i32* %3
br label %58
58: ; preds = %55, %49
%59 = load i32, i32* %3
%60 = load i32, i32* %2
%61 = icmp eq i32 %59, %60
br i1 %61, label %62, label %65
62: ; preds = %58
%63 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%64 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0))
store i32 0, i32* %1
br label %68
65: ; preds = %58
%66 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%67 = call i32 @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.2, i64 0, i64 0))
store i32 -1, i32* %1
br label %68
68: ; preds = %65, %62
%69 = load i32, i32* %1
ret i32 %69
}

LLVM IR (-O2):
@str = [25 x i8] c"at least one test failed\00"
@str.3 = [17 x i8] c"all tests passed\00"
define i32 @test_all() {
%1 = tail call i32 (...) @test_str_split()
%2 = icmp eq i32 %1, 0
%3 = zext i1 %2 to i32
%4 = tail call i32 (...) @test_list_create()
%5 = icmp eq i32 %4, 0
%6 = select i1 %2, i32 2, i32 1
%7 = select i1 %5, i32 %6, i32 %3
%8 = tail call i32 (...) @test_list_add()
%9 = icmp eq i32 %8, 0
%10 = zext i1 %9 to i32
%11 = add nuw nsw i32 %7, %10
%12 = tail call i32 (...) @test_list_remove()
%13 = icmp eq i32 %12, 0
%14 = zext i1 %13 to i32
%15 = add nuw nsw i32 %11, %14
%16 = tail call i32 (...) @test_list_print()
%17 = icmp eq i32 %16, 0
%18 = zext i1 %17 to i32
%19 = add nuw nsw i32 %15, %18
%20 = tail call i32 (...) @test_list_search()
%21 = icmp eq i32 %20, 0
%22 = zext i1 %21 to i32
%23 = add nuw nsw i32 %19, %22
%24 = icmp eq i32 %23, 6
%25 = tail call i32 @putchar(i32 10)
%26 = select i1 %24, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @str.3, i64 0, i64 0), i8* getelementptr inbounds ([25 x i8], [25 x i8]* @str, i64 0, i64 0)
%27 = xor i1 %24, true
%28 = sext i1 %27 to i32
%29 = tail call i32 @puts(i8* dereferenceable(1) %26)
ret i32 %28
}