#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*/ ASYNC_is_capable();
int /*<<< orphan*/ CRYPTO_MEM_CHECK_ON;
int /*<<< orphan*/ CRYPTO_mem_ctrl(int /*<<< orphan*/);
int /*<<< orphan*/ CRYPTO_set_mem_debug(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ test_ASYNC_WAIT_CTX_get_all_fds();
int /*<<< orphan*/ test_ASYNC_block_pause();
int /*<<< orphan*/ test_ASYNC_callback_status();
int /*<<< orphan*/ test_ASYNC_get_current_job();
int /*<<< orphan*/ test_ASYNC_init_thread();
int /*<<< orphan*/ test_ASYNC_start_job();
int main(int argc, char **argv) {
  if (!ASYNC_is_capable()) {
    fprintf(stderr,
            "OpenSSL build is not ASYNC capable - skipping async tests\n");
  } else {
    CRYPTO_set_mem_debug(1);
    CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_ON);
    if (!test_ASYNC_init_thread() || !test_ASYNC_callback_status() ||
        !test_ASYNC_start_job() || !test_ASYNC_get_current_job() ||
        !test_ASYNC_WAIT_CTX_get_all_fds() || !test_ASYNC_block_pause()) {
      return 1;
    }
  }
  printf("PASS\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x0,%al
call   1040 <ASYNC_is_capable@plt>
cmp    $0x0,%eax
jne    11f0 <main+0x40>
mov    0x2dfb(%rip),%rax
mov    (%rax),%edi
lea    0xe1a(%rip),%rsi
call   1070 <fprintf@plt>
jmp    1279 <main+0xc9>
mov    $0x1,%edi
call   10d0 <CRYPTO_set_mem_debug@plt>
mov    0x2df7(%rip),%rax
mov    (%rax),%edi
call   10c0 <CRYPTO_mem_ctrl@plt>
mov    $0x0,%al
call   1080 <test_ASYNC_init_thread@plt>
cmp    $0x0,%eax
je     1268 <main+0xb8>
mov    $0x0,%al
call   1090 <test_ASYNC_callback_status@plt>
cmp    $0x0,%eax
je     1268 <main+0xb8>
mov    $0x0,%al
call   10a0 <test_ASYNC_start_job@plt>
cmp    $0x0,%eax
je     1268 <main+0xb8>
mov    $0x0,%al
call   1060 <test_ASYNC_get_current_job@plt>
cmp    $0x0,%eax
je     1268 <main+0xb8>
mov    $0x0,%al
call   10b0 <test_ASYNC_WAIT_CTX_get_all_fds@plt>
cmp    $0x0,%eax
je     1268 <main+0xb8>
mov    $0x0,%al
call   1030 <test_ASYNC_block_pause@plt>
cmp    $0x0,%eax
jne    1274 <main+0xc4>
movl   $0x1,-0x4(%rbp)
jmp    128c <main+0xdc>
jmp    1279 <main+0xc9>
lea    0xdbb(%rip),%rdi
call   1050 <printf@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
xor    %eax,%eax
call   1050 <ASYNC_is_capable@plt>
test   %eax,%eax
je     121d <main+0x6d>
mov    $0x1,%ebx
mov    $0x1,%edi
call   10d0 <CRYPTO_set_mem_debug@plt>
mov    0x2e26(%rip),%rax
mov    (%rax),%edi
call   10c0 <CRYPTO_mem_ctrl@plt>
xor    %eax,%eax
call   1080 <test_ASYNC_init_thread@plt>
test   %eax,%eax
je     1240 <main+0x90>
xor    %eax,%eax
call   1090 <test_ASYNC_callback_status@plt>
test   %eax,%eax
je     1240 <main+0x90>
xor    %eax,%eax
call   10a0 <test_ASYNC_start_job@plt>
test   %eax,%eax
je     1240 <main+0x90>
xor    %eax,%eax
call   1060 <test_ASYNC_get_current_job@plt>
test   %eax,%eax
je     1240 <main+0x90>
xor    %eax,%eax
call   10b0 <test_ASYNC_WAIT_CTX_get_all_fds@plt>
test   %eax,%eax
je     1240 <main+0x90>
xor    %eax,%eax
call   1040 <test_ASYNC_block_pause@plt>
test   %eax,%eax
jne    1232 <main+0x82>
jmp    1240 <main+0x90>
mov    0x2db4(%rip),%rax
mov    (%rax),%edi
lea    0xdd3(%rip),%rsi
call   1070 <fprintf@plt>
lea    0xe02(%rip),%rdi
call   1030 <puts@plt>
xor    %ebx,%ebx
mov    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
@stderr = global i32 0
@.str = [59 x i8] c"OpenSSL build is not ASYNC capable - skipping async tests\0A\00"
@CRYPTO_MEM_CHECK_ON = global i32 0
@.str.1 = [6 x i8] c"PASS\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%6 = call i32 (...) @ASYNC_is_capable()
%7 = icmp ne i32 %6, 0
br i1 %7, label %11, label %8
8: ; preds = %2
%9 = load i32, i32* @stderr
%10 = call i32 @fprintf(i32 %9, i8* getelementptr inbounds ([59 x i8], [59 x i8]* @.str, i64 0, i64 0))
br label %34
11: ; preds = %2
%12 = call i32 @CRYPTO_set_mem_debug(i32 1)
%13 = load i32, i32* @CRYPTO_MEM_CHECK_ON
%14 = call i32 @CRYPTO_mem_ctrl(i32 %13)
%15 = call i32 (...) @test_ASYNC_init_thread()
%16 = icmp ne i32 %15, 0
br i1 %16, label %17, label %32
17: ; preds = %11
%18 = call i32 (...) @test_ASYNC_callback_status()
%19 = icmp ne i32 %18, 0
br i1 %19, label %20, label %32
20: ; preds = %17
%21 = call i32 (...) @test_ASYNC_start_job()
%22 = icmp ne i32 %21, 0
br i1 %22, label %23, label %32
23: ; preds = %20
%24 = call i32 (...) @test_ASYNC_get_current_job()
%25 = icmp ne i32 %24, 0
br i1 %25, label %26, label %32
26: ; preds = %23
%27 = call i32 (...) @test_ASYNC_WAIT_CTX_get_all_fds()
%28 = icmp ne i32 %27, 0
br i1 %28, label %29, label %32
29: ; preds = %26
%30 = call i32 (...) @test_ASYNC_block_pause()
%31 = icmp ne i32 %30, 0
br i1 %31, label %33, label %32
32: ; preds = %29, %26, %23, %20, %17, %11
store i32 1, i32* %3
br label %36
33: ; preds = %29
br label %34
34: ; preds = %33, %8
%35 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
store i32 0, i32* %3
br label %36
36: ; preds = %34, %32
%37 = load i32, i32* %3
ret i32 %37
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [59 x i8] c"OpenSSL build is not ASYNC capable - skipping async tests\0A\00"
@CRYPTO_MEM_CHECK_ON = global i32 0
@str = [5 x i8] c"PASS\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 (...) @ASYNC_is_capable()
%4 = icmp eq i32 %3, 0
br i1 %4, label %5, label %8
5: ; preds = %2
%6 = load i32, i32* @stderr
%7 = tail call i32 @fprintf(i32 %6, i8* getelementptr inbounds ([59 x i8], [59 x i8]* @.str, i64 0, i64 0))
br label %29
8: ; preds = %2
%9 = tail call i32 @CRYPTO_set_mem_debug(i32 1)
%10 = load i32, i32* @CRYPTO_MEM_CHECK_ON
%11 = tail call i32 @CRYPTO_mem_ctrl(i32 %10)
%12 = tail call i32 (...) @test_ASYNC_init_thread()
%13 = icmp eq i32 %12, 0
br i1 %13, label %31, label %14
14: ; preds = %8
%15 = tail call i32 (...) @test_ASYNC_callback_status()
%16 = icmp eq i32 %15, 0
br i1 %16, label %31, label %17
17: ; preds = %14
%18 = tail call i32 (...) @test_ASYNC_start_job()
%19 = icmp eq i32 %18, 0
br i1 %19, label %31, label %20
20: ; preds = %17
%21 = tail call i32 (...) @test_ASYNC_get_current_job()
%22 = icmp eq i32 %21, 0
br i1 %22, label %31, label %23
23: ; preds = %20
%24 = tail call i32 (...) @test_ASYNC_WAIT_CTX_get_all_fds()
%25 = icmp eq i32 %24, 0
br i1 %25, label %31, label %26
26: ; preds = %23
%27 = tail call i32 (...) @test_ASYNC_block_pause()
%28 = icmp eq i32 %27, 0
br i1 %28, label %31, label %29
29: ; preds = %26, %5
%30 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @str, i64 0, i64 0))
br label %31
31: ; preds = %8, %14, %17, %20, %23, %26, %29
%32 = phi i32 [ 0, %29 ], [ 1, %26 ], [ 1, %23 ], [ 1, %20 ], [ 1, %17 ], [ 1, %14 ], [ 1, %8 ]
ret i32 %32
}