#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 *, ...);
char *test_failover_list_empty(int /*<<< orphan*/);
char *test_failover_list_multiple(int /*<<< orphan*/);
char *test_failover_list_single(int /*<<< orphan*/);
int failoverlist_tests() {
  int result = 0;
  char *test_group = "failover_tests";
  do {
    char *r = test_failover_list_empty(0);
    printf("Test Case %s.%s: ", test_group, "test_failover_list_empty");
    if (r) {
      printf("FAIL: %s\n", r);
      result++;
    } else
      printf("PASS\n");
  } while (0);
  ;
  do {
    char *r = test_failover_list_single(0);
    printf("Test Case %s.%s: ", test_group, "test_failover_list_single");
    if (r) {
      printf("FAIL: %s\n", r);
      result++;
    } else
      printf("PASS\n");
  } while (0);
  ;
  do {
    char *r = test_failover_list_multiple(0);
    printf("Test Case %s.%s: ", test_group, "test_failover_list_multiple");
    if (r) {
      printf("FAIL: %s\n", r);
      result++;
    } else
      printf("PASS\n");
  } while (0);
  ;
  return result;
}


x86 assembly (clang, -O0):
<failoverlist_tests>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeaa(%rip),%rax
mov    %rax,-0x10(%rbp)
xor    %edi,%edi
call   1060 <test_failover_list_empty@plt>
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rsi
lea    0xe9f(%rip),%rdi
lea    0xeaa(%rip),%rdx
mov    $0x0,%al
call   1040 <printf@plt>
cmpq   $0x0,-0x18(%rbp)
je     11a9 <failoverlist_tests+0x69>
mov    -0x18(%rbp),%rsi
lea    0xea6(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    11b7 <failoverlist_tests+0x77>
lea    0xe94(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    11bc <failoverlist_tests+0x7c>
jmp    11c1 <failoverlist_tests+0x81>
xor    %edi,%edi
call   1030 <test_failover_list_single@plt>
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%rsi
lea    0xe38(%rip),%rdi
lea    0xe6c(%rip),%rdx
mov    $0x0,%al
call   1040 <printf@plt>
cmpq   $0x0,-0x20(%rbp)
je     1210 <failoverlist_tests+0xd0>
mov    -0x20(%rbp),%rsi
lea    0xe3f(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    121e <failoverlist_tests+0xde>
lea    0xe2d(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    1223 <failoverlist_tests+0xe3>
jmp    1228 <failoverlist_tests+0xe8>
xor    %edi,%edi
call   1050 <test_failover_list_multiple@plt>
mov    %rax,-0x28(%rbp)
mov    -0x10(%rbp),%rsi
lea    0xdd1(%rip),%rdi
lea    0xe1f(%rip),%rdx
mov    $0x0,%al
call   1040 <printf@plt>
cmpq   $0x0,-0x28(%rbp)
je     1277 <failoverlist_tests+0x137>
mov    -0x28(%rbp),%rsi
lea    0xdd8(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    1285 <failoverlist_tests+0x145>
lea    0xdc6(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    128a <failoverlist_tests+0x14a>
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<failoverlist_tests>:
push   %rbp
push   %rbx
push   %rax
xor    %ebp,%ebp
xor    %edi,%edi
call   1070 <test_failover_list_empty@plt>
mov    %rax,%rbx
lea    0xea9(%rip),%rdi
lea    0xe93(%rip),%rsi
lea    0xead(%rip),%rdx
xor    %eax,%eax
call   1050 <printf@plt>
test   %rbx,%rbx
je     1198 <failoverlist_tests+0x48>
lea    0xeb3(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0x1,%ebp
jmp    11a4 <failoverlist_tests+0x54>
lea    0xedb(%rip),%rdi
call   1040 <puts@plt>
xor    %edi,%edi
call   1030 <test_failover_list_single@plt>
mov    %rax,%rbx
lea    0xe5a(%rip),%rdi
lea    0xe44(%rip),%rsi
lea    0xe81(%rip),%rdx
xor    %eax,%eax
call   1050 <printf@plt>
test   %rbx,%rbx
je     11e5 <failoverlist_tests+0x95>
lea    0xe64(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1050 <printf@plt>
add    $0x1,%ebp
jmp    11f1 <failoverlist_tests+0xa1>
lea    0xe8e(%rip),%rdi
call   1040 <puts@plt>
xor    %edi,%edi
call   1060 <test_failover_list_multiple@plt>
mov    %rax,%rbx
lea    0xe0d(%rip),%rdi
lea    0xdf7(%rip),%rsi
lea    0xe4e(%rip),%rdx
xor    %eax,%eax
call   1050 <printf@plt>
test   %rbx,%rbx
je     1232 <failoverlist_tests+0xe2>
lea    0xe17(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1050 <printf@plt>
add    $0x1,%ebp
jmp    123e <failoverlist_tests+0xee>
lea    0xe41(%rip),%rdi
call   1040 <puts@plt>
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [15 x i8] c"failover_tests\00"
@.str.1 = [18 x i8] c"Test Case %s.%s: \00"
@.str.2 = [25 x i8] c"test_failover_list_empty\00"
@.str.3 = [10 x i8] c"FAIL: %s\0A\00"
@.str.4 = [6 x i8] c"PASS\0A\00"
@.str.5 = [26 x i8] c"test_failover_list_single\00"
@.str.6 = [28 x i8] c"test_failover_list_multiple\00"
define i32 @failoverlist_tests() {
%1 = alloca i32
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i8*
store i32 0, i32* %1
store i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i8** %2
br label %6
6: ; preds = %0
%7 = call i8* @test_failover_list_empty(i32 0)
store i8* %7, i8** %3
%8 = load i8*, i8** %2
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0), i8* %8, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.2, i64 0, i64 0))
%10 = load i8*, i8** %3
%11 = icmp ne i8* %10, null
br i1 %11, label %12, label %17
12: ; preds = %6
%13 = load i8*, i8** %3
%14 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0), i8* %13)
%15 = load i32, i32* %1
%16 = add nsw i32 %15, 1
store i32 %16, i32* %1
br label %19
17: ; preds = %6
%18 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0))
br label %19
19: ; preds = %17, %12
br label %20
20: ; preds = %19
br label %21
21: ; preds = %20
%22 = call i8* @test_failover_list_single(i32 0)
store i8* %22, i8** %4
%23 = load i8*, i8** %2
%24 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0), i8* %23, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.5, i64 0, i64 0))
%25 = load i8*, i8** %4
%26 = icmp ne i8* %25, null
br i1 %26, label %27, label %32
27: ; preds = %21
%28 = load i8*, i8** %4
%29 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0), i8* %28)
%30 = load i32, i32* %1
%31 = add nsw i32 %30, 1
store i32 %31, i32* %1
br label %34
32: ; preds = %21
%33 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0))
br label %34
34: ; preds = %32, %27
br label %35
35: ; preds = %34
br label %36
36: ; preds = %35
%37 = call i8* @test_failover_list_multiple(i32 0)
store i8* %37, i8** %5
%38 = load i8*, i8** %2
%39 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0), i8* %38, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.6, i64 0, i64 0))
%40 = load i8*, i8** %5
%41 = icmp ne i8* %40, null
br i1 %41, label %42, label %47
42: ; preds = %36
%43 = load i8*, i8** %5
%44 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0), i8* %43)
%45 = load i32, i32* %1
%46 = add nsw i32 %45, 1
store i32 %46, i32* %1
br label %49
47: ; preds = %36
%48 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0))
br label %49
49: ; preds = %47, %42
br label %50
50: ; preds = %49
%51 = load i32, i32* %1
ret i32 %51
}

LLVM IR (-O2):
@.str = [15 x i8] c"failover_tests\00"
@.str.1 = [18 x i8] c"Test Case %s.%s: \00"
@.str.2 = [25 x i8] c"test_failover_list_empty\00"
@.str.3 = [10 x i8] c"FAIL: %s\0A\00"
@.str.5 = [26 x i8] c"test_failover_list_single\00"
@.str.6 = [28 x i8] c"test_failover_list_multiple\00"
@str.8 = [5 x i8] c"PASS\00"
define i32 @failoverlist_tests() {
%1 = tail call i8* @test_failover_list_empty(i32 0)
%2 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.2, i64 0, i64 0))
%3 = icmp eq i8* %1, null
br i1 %3, label %6, label %4
4: ; preds = %0
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0), i8* %1)
br label %8
6: ; preds = %0
%7 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @str.8, i64 0, i64 0))
br label %8
8: ; preds = %6, %4
%9 = phi i32 [ 1, %4 ], [ 0, %6 ]
%10 = tail call i8* @test_failover_list_single(i32 0)
%11 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.5, i64 0, i64 0))
%12 = icmp eq i8* %10, null
br i1 %12, label %16, label %13
13: ; preds = %8
%14 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0), i8* %10)
%15 = add nuw nsw i32 %9, 1
br label %18
16: ; preds = %8
%17 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @str.8, i64 0, i64 0))
br label %18
18: ; preds = %16, %13
%19 = phi i32 [ %15, %13 ], [ %9, %16 ]
%20 = tail call i8* @test_failover_list_multiple(i32 0)
%21 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.6, i64 0, i64 0))
%22 = icmp eq i8* %20, null
br i1 %22, label %26, label %23
23: ; preds = %18
%24 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0), i8* %20)
%25 = add nuw nsw i32 %19, 1
br label %28
26: ; preds = %18
%27 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @str.8, i64 0, i64 0))
br label %28
28: ; preds = %26, %23
%29 = phi i32 [ %25, %23 ], [ %19, %26 ]
ret i32 %29
}