#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_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_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    11e0 <main+0x40>
mov    0x2e0b(%rip),%rax
mov    (%rax),%edi
lea    0xe2a(%rip),%rsi
call   1070 <fprintf@plt>
jmp    1259 <main+0xb9>
mov    $0x1,%edi
call   10c0 <CRYPTO_set_mem_debug@plt>
mov    0x2e07(%rip),%rax
mov    (%rax),%edi
call   10b0 <CRYPTO_mem_ctrl@plt>
mov    $0x0,%al
call   1080 <test_ASYNC_init_thread@plt>
cmp    $0x0,%eax
je     1248 <main+0xa8>
mov    $0x0,%al
call   1090 <test_ASYNC_start_job@plt>
cmp    $0x0,%eax
je     1248 <main+0xa8>
mov    $0x0,%al
call   1060 <test_ASYNC_get_current_job@plt>
cmp    $0x0,%eax
je     1248 <main+0xa8>
mov    $0x0,%al
call   10a0 <test_ASYNC_WAIT_CTX_get_all_fds@plt>
cmp    $0x0,%eax
je     1248 <main+0xa8>
mov    $0x0,%al
call   1030 <test_ASYNC_block_pause@plt>
cmp    $0x0,%eax
jne    1254 <main+0xb4>
movl   $0x1,-0x4(%rbp)
jmp    126c <main+0xcc>
jmp    1259 <main+0xb9>
lea    0xddb(%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     1202 <main+0x62>
mov    $0x1,%ebx
mov    $0x1,%edi
call   10c0 <CRYPTO_set_mem_debug@plt>
mov    0x2e36(%rip),%rax
mov    (%rax),%edi
call   10b0 <CRYPTO_mem_ctrl@plt>
xor    %eax,%eax
call   1080 <test_ASYNC_init_thread@plt>
test   %eax,%eax
je     1225 <main+0x85>
xor    %eax,%eax
call   1090 <test_ASYNC_start_job@plt>
test   %eax,%eax
je     1225 <main+0x85>
xor    %eax,%eax
call   1060 <test_ASYNC_get_current_job@plt>
test   %eax,%eax
je     1225 <main+0x85>
xor    %eax,%eax
call   10a0 <test_ASYNC_WAIT_CTX_get_all_fds@plt>
test   %eax,%eax
je     1225 <main+0x85>
xor    %eax,%eax
call   1040 <test_ASYNC_block_pause@plt>
test   %eax,%eax
jne    1217 <main+0x77>
jmp    1225 <main+0x85>
mov    0x2dcf(%rip),%rax
mov    (%rax),%edi
lea    0xdee(%rip),%rsi
call   1070 <fprintf@plt>
lea    0xe1d(%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 %31
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 %29
17: ; preds = %11
%18 = call i32 (...) @test_ASYNC_start_job()
%19 = icmp ne i32 %18, 0
br i1 %19, label %20, label %29
20: ; preds = %17
%21 = call i32 (...) @test_ASYNC_get_current_job()
%22 = icmp ne i32 %21, 0
br i1 %22, label %23, label %29
23: ; preds = %20
%24 = call i32 (...) @test_ASYNC_WAIT_CTX_get_all_fds()
%25 = icmp ne i32 %24, 0
br i1 %25, label %26, label %29
26: ; preds = %23
%27 = call i32 (...) @test_ASYNC_block_pause()
%28 = icmp ne i32 %27, 0
br i1 %28, label %30, label %29
29: ; preds = %26, %23, %20, %17, %11
store i32 1, i32* %3
br label %33
30: ; preds = %26
br label %31
31: ; preds = %30, %8
%32 = 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 %33
33: ; preds = %31, %29
%34 = load i32, i32* %3
ret i32 %34
}

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 %26
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 %28, label %14
14: ; preds = %8
%15 = tail call i32 (...) @test_ASYNC_start_job()
%16 = icmp eq i32 %15, 0
br i1 %16, label %28, label %17
17: ; preds = %14
%18 = tail call i32 (...) @test_ASYNC_get_current_job()
%19 = icmp eq i32 %18, 0
br i1 %19, label %28, label %20
20: ; preds = %17
%21 = tail call i32 (...) @test_ASYNC_WAIT_CTX_get_all_fds()
%22 = icmp eq i32 %21, 0
br i1 %22, label %28, label %23
23: ; preds = %20
%24 = tail call i32 (...) @test_ASYNC_block_pause()
%25 = icmp eq i32 %24, 0
br i1 %25, label %28, label %26
26: ; preds = %23, %5
%27 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @str, i64 0, i64 0))
br label %28
28: ; preds = %8, %14, %17, %20, %23, %26
%29 = phi i32 [ 0, %26 ], [ 1, %23 ], [ 1, %20 ], [ 1, %17 ], [ 1, %14 ], [ 1, %8 ]
ret i32 %29
}