int keyspace_client_test() {
  {
    int status;
    printf("%s:%d: "
           "%s: testing"
           "\n",
           __func__, 385, "test_invalid_result()");
    status = test_invalid_result();
    printf("%s:%d: "
           "%s: %s"
           "\n",
           __func__, 385, "test_invalid_result()",
           status == 0 ? "success" : "failure");
    if (status != 0)
      return 1;
  };
  {
    int status;
    printf("%s:%d: "
           "%s: testing"
           "\n",
           __func__, 386, "test_init()");
    status = test_init();
    printf("%s:%d: "
           "%s: %s"
           "\n",
           __func__, 386, "test_init()", status == 0 ? "success" : "failure");
    if (status != 0)
      return 1;
  };
  {
    int status;
    printf("%s:%d: "
           "%s: testing"
           "\n",
           __func__, 387, "test_invalid_init_memleak()");
    status = test_invalid_init_memleak();
    printf("%s:%d: "
           "%s: %s"
           "\n",
           __func__, 387, "test_invalid_init_memleak()",
           status == 0 ? "success" : "failure");
    if (status != 0)
      return 1;
  };
  {
    int status;
    printf("%s:%d: "
           "%s: testing"
           "\n",
           __func__, 388, "test_badconnect()");
    status = test_badconnect();
    printf("%s:%d: "
           "%s: %s"
           "\n",
           __func__, 388, "test_badconnect()",
           status == 0 ? "success" : "failure");
    if (status != 0)
      return 1;
  };
  return 0;
}


x86 assembly (clang, -O0):
<keyspace_client_test>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
lea    0xea1(%rip),%rdi
lea    0xeae(%rip),%rsi
mov    $0x181,%edx
lea    0xeb7(%rip),%rcx
mov    $0x0,%al
call   1050 <printf@plt>
mov    $0x0,%al
call   1040 <test_invalid_result@plt>
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%ecx
lea    0xec9(%rip),%r8
lea    0xeba(%rip),%rax
cmp    $0x0,%ecx
cmove  %rax,%r8
lea    0xe9d(%rip),%rdi
lea    0xe6b(%rip),%rsi
mov    $0x181,%edx
lea    0xe74(%rip),%rcx
mov    $0x0,%al
call   1050 <printf@plt>
cmpl   $0x0,-0x8(%rbp)
je     11d2 <keyspace_client_test+0x82>
movl   $0x1,-0x4(%rbp)
jmp    1347 <keyspace_client_test+0x1f7>
lea    0xe27(%rip),%rdi
lea    0xe34(%rip),%rsi
mov    $0x182,%edx
lea    0xe72(%rip),%rcx
mov    $0x0,%al
call   1050 <printf@plt>
mov    $0x0,%al
call   1030 <test_init@plt>
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%ecx
lea    0xe4f(%rip),%r8
lea    0xe40(%rip),%rax
cmp    $0x0,%ecx
cmove  %rax,%r8
lea    0xe23(%rip),%rdi
lea    0xdf1(%rip),%rsi
mov    $0x182,%edx
lea    0xe2f(%rip),%rcx
mov    $0x0,%al
call   1050 <printf@plt>
cmpl   $0x0,-0xc(%rbp)
je     124c <keyspace_client_test+0xfc>
movl   $0x1,-0x4(%rbp)
jmp    1347 <keyspace_client_test+0x1f7>
lea    0xdad(%rip),%rdi
lea    0xdba(%rip),%rsi
mov    $0x183,%edx
lea    0xe04(%rip),%rcx
mov    $0x0,%al
call   1050 <printf@plt>
mov    $0x0,%al
call   1070 <test_invalid_init_memleak@plt>
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%ecx
lea    0xdd5(%rip),%r8
lea    0xdc6(%rip),%rax
cmp    $0x0,%ecx
cmove  %rax,%r8
lea    0xda9(%rip),%rdi
lea    0xd77(%rip),%rsi
mov    $0x183,%edx
lea    0xdc1(%rip),%rcx
mov    $0x0,%al
call   1050 <printf@plt>
cmpl   $0x0,-0x10(%rbp)
je     12c6 <keyspace_client_test+0x176>
movl   $0x1,-0x4(%rbp)
jmp    1347 <keyspace_client_test+0x1f7>
lea    0xd33(%rip),%rdi
lea    0xd40(%rip),%rsi
mov    $0x184,%edx
lea    0xda6(%rip),%rcx
mov    $0x0,%al
call   1050 <printf@plt>
mov    $0x0,%al
call   1060 <test_badconnect@plt>
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%ecx
lea    0xd5b(%rip),%r8
lea    0xd4c(%rip),%rax
cmp    $0x0,%ecx
cmove  %rax,%r8
lea    0xd2f(%rip),%rdi
lea    0xcfd(%rip),%rsi
mov    $0x184,%edx
lea    0xd63(%rip),%rcx
mov    $0x0,%al
call   1050 <printf@plt>
cmpl   $0x0,-0x14(%rbp)
je     1340 <keyspace_client_test+0x1f0>
movl   $0x1,-0x4(%rbp)
jmp    1347 <keyspace_client_test+0x1f7>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<keyspace_client_test>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
lea    0xe9e(%rip),%rdi
lea    0xeab(%rip),%rbp
lea    0xeb9(%rip),%r15
mov    %rbp,%rsi
mov    $0x181,%edx
mov    %r15,%rcx
xor    %eax,%eax
call   1050 <printf@plt>
xor    %eax,%eax
call   1040 <test_invalid_result@plt>
mov    %eax,%ebx
test   %eax,%eax
lea    0xeba(%rip),%r13
lea    0xebb(%rip),%r14
mov    %r14,%r8
cmove  %r13,%r8
lea    0xe96(%rip),%rdi
mov    %rbp,%rsi
mov    $0x181,%edx
mov    %r15,%rcx
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0x1,%ebp
test   %ebx,%ebx
jne    12ce <keyspace_client_test+0x17e>
lea    0xe31(%rip),%rdi
lea    0xe3e(%rip),%r12
lea    0xe81(%rip),%r15
mov    %r12,%rsi
mov    $0x182,%edx
mov    %r15,%rcx
xor    %eax,%eax
call   1050 <printf@plt>
xor    %eax,%eax
call   1030 <test_init@plt>
mov    %eax,%ebx
test   %eax,%eax
mov    %r14,%r8
cmove  %r13,%r8
lea    0xe37(%rip),%rdi
mov    %r12,%rsi
mov    $0x182,%edx
mov    %r15,%rcx
xor    %eax,%eax
call   1050 <printf@plt>
test   %ebx,%ebx
jne    12ce <keyspace_client_test+0x17e>
lea    0xdd7(%rip),%rdi
lea    0xde4(%rip),%r12
lea    0xe33(%rip),%r15
mov    %r12,%rsi
mov    $0x183,%edx
mov    %r15,%rcx
xor    %eax,%eax
call   1050 <printf@plt>
xor    %eax,%eax
call   1070 <test_invalid_init_memleak@plt>
mov    %eax,%ebx
test   %eax,%eax
mov    %r14,%r8
cmove  %r13,%r8
lea    0xddd(%rip),%rdi
mov    %r12,%rsi
mov    $0x183,%edx
mov    %r15,%rcx
xor    %eax,%eax
call   1050 <printf@plt>
test   %ebx,%ebx
jne    12ce <keyspace_client_test+0x17e>
lea    0xd81(%rip),%rdi
lea    0xd8e(%rip),%rbx
lea    0xdf9(%rip),%r15
mov    %rbx,%rsi
mov    $0x184,%edx
mov    %r15,%rcx
xor    %eax,%eax
call   1050 <printf@plt>
xor    %eax,%eax
call   1060 <test_badconnect@plt>
xor    %ebp,%ebp
test   %eax,%eax
setne  %bpl
cmove  %r13,%r14
lea    0xd86(%rip),%rdi
mov    %rbx,%rsi
mov    $0x184,%edx
mov    %r15,%rcx
mov    %r14,%r8
xor    %eax,%eax
call   1050 <printf@plt>
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [20 x i8] c"%s:%d: %s: testing\0A\00"
@__func__.keyspace_client_test = [21 x i8] c"keyspace_client_test\00"
@.str.1 = [22 x i8] c"test_invalid_result()\00"
@.str.2 = [15 x i8] c"%s:%d: %s: %s\0A\00"
@.str.3 = [8 x i8] c"success\00"
@.str.4 = [8 x i8] c"failure\00"
@.str.5 = [12 x i8] c"test_init()\00"
@.str.6 = [28 x i8] c"test_invalid_init_memleak()\00"
@.str.7 = [18 x i8] c"test_badconnect()\00"
define i32 @keyspace_client_test() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([21 x i8], [21 x i8]* @__func__.keyspace_client_test, i64 0, i64 0), i32 385, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0))
%7 = call i32 (...) @test_invalid_result()
store i32 %7, i32* %2
%8 = load i32, i32* %2
%9 = icmp eq i32 %8, 0
%10 = zext i1 %9 to i64
%11 = select i1 %9, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.4, i64 0, i64 0)
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([21 x i8], [21 x i8]* @__func__.keyspace_client_test, i64 0, i64 0), i32 385, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0), i8* %11)
%13 = load i32, i32* %2
%14 = icmp ne i32 %13, 0
br i1 %14, label %15, label %16
15: ; preds = %0
store i32 1, i32* %1
br label %50
16: ; preds = %0
%17 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([21 x i8], [21 x i8]* @__func__.keyspace_client_test, i64 0, i64 0), i32 386, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.5, i64 0, i64 0))
%18 = call i32 (...) @test_init()
store i32 %18, i32* %3
%19 = load i32, i32* %3
%20 = icmp eq i32 %19, 0
%21 = zext i1 %20 to i64
%22 = select i1 %20, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.4, i64 0, i64 0)
%23 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([21 x i8], [21 x i8]* @__func__.keyspace_client_test, i64 0, i64 0), i32 386, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.5, i64 0, i64 0), i8* %22)
%24 = load i32, i32* %3
%25 = icmp ne i32 %24, 0
br i1 %25, label %26, label %27
26: ; preds = %16
store i32 1, i32* %1
br label %50
27: ; preds = %16
%28 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([21 x i8], [21 x i8]* @__func__.keyspace_client_test, i64 0, i64 0), i32 387, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.6, i64 0, i64 0))
%29 = call i32 (...) @test_invalid_init_memleak()
store i32 %29, i32* %4
%30 = load i32, i32* %4
%31 = icmp eq i32 %30, 0
%32 = zext i1 %31 to i64
%33 = select i1 %31, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.4, i64 0, i64 0)
%34 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([21 x i8], [21 x i8]* @__func__.keyspace_client_test, i64 0, i64 0), i32 387, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.6, i64 0, i64 0), i8* %33)
%35 = load i32, i32* %4
%36 = icmp ne i32 %35, 0
br i1 %36, label %37, label %38
37: ; preds = %27
store i32 1, i32* %1
br label %50
38: ; preds = %27
%39 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([21 x i8], [21 x i8]* @__func__.keyspace_client_test, i64 0, i64 0), i32 388, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.7, i64 0, i64 0))
%40 = call i32 (...) @test_badconnect()
store i32 %40, i32* %5
%41 = load i32, i32* %5
%42 = icmp eq i32 %41, 0
%43 = zext i1 %42 to i64
%44 = select i1 %42, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.4, i64 0, i64 0)
%45 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([21 x i8], [21 x i8]* @__func__.keyspace_client_test, i64 0, i64 0), i32 388, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.7, i64 0, i64 0), i8* %44)
%46 = load i32, i32* %5
%47 = icmp ne i32 %46, 0
br i1 %47, label %48, label %49
48: ; preds = %38
store i32 1, i32* %1
br label %50
49: ; preds = %38
store i32 0, i32* %1
br label %50
50: ; preds = %49, %48, %37, %26, %15
%51 = load i32, i32* %1
ret i32 %51
}

LLVM IR (-O2):
@.str = [20 x i8] c"%s:%d: %s: testing\0A\00"
@__func__.keyspace_client_test = [21 x i8] c"keyspace_client_test\00"
@.str.1 = [22 x i8] c"test_invalid_result()\00"
@.str.2 = [15 x i8] c"%s:%d: %s: %s\0A\00"
@.str.3 = [8 x i8] c"success\00"
@.str.4 = [8 x i8] c"failure\00"
@.str.5 = [12 x i8] c"test_init()\00"
@.str.6 = [28 x i8] c"test_invalid_init_memleak()\00"
@.str.7 = [18 x i8] c"test_badconnect()\00"
define i32 @keyspace_client_test() {
%1 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([21 x i8], [21 x i8]* @__func__.keyspace_client_test, i64 0, i64 0), i32 385, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0))
%2 = tail call i32 (...) @test_invalid_result()
%3 = icmp eq i32 %2, 0
%4 = select i1 %3, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.4, i64 0, i64 0)
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([21 x i8], [21 x i8]* @__func__.keyspace_client_test, i64 0, i64 0), i32 385, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0), i8* %4)
br i1 %3, label %6, label %26
6: ; preds = %0
%7 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([21 x i8], [21 x i8]* @__func__.keyspace_client_test, i64 0, i64 0), i32 386, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.5, i64 0, i64 0))
%8 = tail call i32 (...) @test_init()
%9 = icmp eq i32 %8, 0
%10 = select i1 %9, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.4, i64 0, i64 0)
%11 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([21 x i8], [21 x i8]* @__func__.keyspace_client_test, i64 0, i64 0), i32 386, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.5, i64 0, i64 0), i8* %10)
br i1 %9, label %12, label %26
12: ; preds = %6
%13 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([21 x i8], [21 x i8]* @__func__.keyspace_client_test, i64 0, i64 0), i32 387, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.6, i64 0, i64 0))
%14 = tail call i32 (...) @test_invalid_init_memleak()
%15 = icmp eq i32 %14, 0
%16 = select i1 %15, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.4, i64 0, i64 0)
%17 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([21 x i8], [21 x i8]* @__func__.keyspace_client_test, i64 0, i64 0), i32 387, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.6, i64 0, i64 0), i8* %16)
br i1 %15, label %18, label %26
18: ; preds = %12
%19 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([21 x i8], [21 x i8]* @__func__.keyspace_client_test, i64 0, i64 0), i32 388, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.7, i64 0, i64 0))
%20 = tail call i32 (...) @test_badconnect()
%21 = icmp eq i32 %20, 0
%22 = select i1 %21, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.4, i64 0, i64 0)
%23 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([21 x i8], [21 x i8]* @__func__.keyspace_client_test, i64 0, i64 0), i32 388, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.7, i64 0, i64 0), i8* %22)
%24 = xor i1 %21, true
%25 = zext i1 %24 to i32
br label %26
26: ; preds = %18, %12, %6, %0
%27 = phi i32 [ 1, %0 ], [ 1, %6 ], [ 1, %12 ], [ %25, %18 ]
ret i32 %27
}