#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 */
typedef int /*<<< orphan*/ BIGNUM;

/* Variables and functions */
scalar_t__ BN_is_negative(int /*<<< orphan*/ const *);
scalar_t__ BN_is_zero(int /*<<< orphan*/ const *);
int /*<<< orphan*/ test_fail_bignum_mono_message(int /*<<< orphan*/ *,
                                                 char const *, int, char *,
                                                 char const *, char *, char *,
                                                 int /*<<< orphan*/ const *);
int test_BN_le_zero(const char *file, int line, const char *s,
                    const BIGNUM *a) {
  if (a != NULL && (BN_is_negative(a) || BN_is_zero(a)))
    return 1;
  test_fail_bignum_mono_message(NULL, file, line, "BIGNUM", s, "0", "<=", a);
  return 0;
}


x86 assembly (clang, -O0):
<test_BN_le_zero>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    %rdx,-0x20(%rbp)
mov    %rcx,-0x28(%rbp)
cmpq   $0x0,-0x28(%rbp)
je     1184 <test_BN_le_zero+0x54>
mov    -0x28(%rbp),%rdi
call   1050 <BN_is_negative@plt>
cmp    $0x0,%rax
jne    1178 <test_BN_le_zero+0x48>
mov    -0x28(%rbp),%rdi
call   1030 <BN_is_zero@plt>
cmp    $0x0,%rax
je     1184 <test_BN_le_zero+0x54>
movl   $0x1,-0x4(%rbp)
jmp    11c1 <test_BN_le_zero+0x91>
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
mov    -0x20(%rbp),%r8
mov    -0x28(%rbp),%rax
xor    %ecx,%ecx
mov    %ecx,%edi
lea    0xe62(%rip),%rcx
lea    0xe62(%rip),%r9
lea    0xe5d(%rip),%r10
mov    %r10,(%rsp)
mov    %rax,0x8(%rsp)
call   1040 <test_fail_bignum_mono_message@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_BN_le_zero>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %rcx,%rbx
mov    %rdx,%r14
mov    %esi,%r15d
mov    %rdi,%r12
test   %rcx,%rcx
je     1168 <test_BN_le_zero+0x38>
mov    %rbx,%rdi
call   1050 <BN_is_negative@plt>
mov    $0x1,%ebp
test   %rax,%rax
jne    1195 <test_BN_le_zero+0x65>
mov    %rbx,%rdi
call   1030 <BN_is_zero@plt>
test   %rax,%rax
jne    1195 <test_BN_le_zero+0x65>
lea    0xe9a(%rip),%rax
lea    0xe8a(%rip),%rcx
lea    0xe8a(%rip),%r9
xor    %ebp,%ebp
xor    %edi,%edi
mov    %r12,%rsi
mov    %r15d,%edx
mov    %r14,%r8
push   %rbx
push   %rax
call   1040 <test_fail_bignum_mono_message@plt>
add    $0x10,%rsp
mov    %ebp,%eax
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [7 x i8] c"BIGNUM\00"
@.str.1 = [2 x i8] c"0\00"
@.str.2 = [3 x i8] c"<=\00"
define i32 @test_BN_le_zero(i8* %0, i32 %1, i8* %2, i32* %3) {
%5 = alloca i32
%6 = alloca i8*
%7 = alloca i32
%8 = alloca i8*
%9 = alloca i32*
store i8* %0, i8** %6
store i32 %1, i32* %7
store i8* %2, i8** %8
store i32* %3, i32** %9
%10 = load i32*, i32** %9
%11 = icmp ne i32* %10, null
br i1 %11, label %12, label %21
12: ; preds = %4
%13 = load i32*, i32** %9
%14 = call i64 @BN_is_negative(i32* %13)
%15 = icmp ne i64 %14, 0
br i1 %15, label %20, label %16
16: ; preds = %12
%17 = load i32*, i32** %9
%18 = call i64 @BN_is_zero(i32* %17)
%19 = icmp ne i64 %18, 0
br i1 %19, label %20, label %21
20: ; preds = %16, %12
store i32 1, i32* %5
br label %27
21: ; preds = %16, %4
%22 = load i8*, i8** %6
%23 = load i32, i32* %7
%24 = load i8*, i8** %8
%25 = load i32*, i32** %9
%26 = call i32 @test_fail_bignum_mono_message(i32* null, i8* %22, i32 %23, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8* %24, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %25)
store i32 0, i32* %5
br label %27
27: ; preds = %21, %20
%28 = load i32, i32* %5
ret i32 %28
}

LLVM IR (-O2):
@.str = [7 x i8] c"BIGNUM\00"
@.str.1 = [2 x i8] c"0\00"
@.str.2 = [3 x i8] c"<=\00"
define i32 @test_BN_le_zero(i8* %0, i32 %1, i8* %2, i32* %3) {
%5 = icmp eq i32* %3, null
br i1 %5, label %12, label %6
6: ; preds = %4
%7 = tail call i64 @BN_is_negative(i32* %3)
%8 = icmp eq i64 %7, 0
br i1 %8, label %9, label %14
9: ; preds = %6
%10 = tail call i64 @BN_is_zero(i32* %3)
%11 = icmp eq i64 %10, 0
br i1 %11, label %12, label %14
12: ; preds = %9, %4
%13 = tail call i32 @test_fail_bignum_mono_message(i32* null, i8* %0, i32 %1, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8* %2, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %3)
br label %14
14: ; preds = %6, %9, %12
%15 = phi i32 [ 0, %12 ], [ 1, %9 ], [ 1, %6 ]
ret i32 %15
}