#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 */
scalar_t__ ERR_GET_LIB(long);
scalar_t__ ERR_GET_REASON(long);
scalar_t__ ERR_LIB_EVP;
int /*<<< orphan*/ ERR_clear_error();
long ERR_peek_error();
scalar_t__ EVP_R_UNSUPPORTED_ALGORITHM;
int check_unsupported() {
  long err = ERR_peek_error();
  if (ERR_GET_LIB(err) == ERR_LIB_EVP &&
      ERR_GET_REASON(err) == EVP_R_UNSUPPORTED_ALGORITHM) {
    ERR_clear_error();
    return 1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<check_unsupported>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1030 <ERR_peek_error@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1050 <ERR_GET_LIB@plt>
mov    0x2e85(%rip),%rcx
cmp    (%rcx),%rax
jne    1198 <check_unsupported+0x58>
mov    -0x10(%rbp),%rdi
call   1060 <ERR_GET_REASON@plt>
mov    0x2e54(%rip),%rcx
cmp    (%rcx),%rax
jne    1198 <check_unsupported+0x58>
mov    $0x0,%al
call   1040 <ERR_clear_error@plt>
movl   $0x1,-0x4(%rbp)
jmp    119f <check_unsupported+0x5f>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<check_unsupported>:
push   %rbp
push   %rbx
push   %rax
xor    %ebp,%ebp
xor    %eax,%eax
call   1030 <ERR_peek_error@plt>
mov    %rax,%rbx
mov    %rax,%rdi
call   1050 <ERR_GET_LIB@plt>
mov    0x2e8a(%rip),%rcx
cmp    (%rcx),%rax
jne    1183 <check_unsupported+0x43>
mov    %rbx,%rdi
call   1060 <ERR_GET_REASON@plt>
mov    0x2e5e(%rip),%rcx
cmp    (%rcx),%rax
jne    1183 <check_unsupported+0x43>
xor    %eax,%eax
call   1040 <ERR_clear_error@plt>
mov    $0x1,%ebp
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@ERR_LIB_EVP = global i64 0
@EVP_R_UNSUPPORTED_ALGORITHM = global i64 0
define i32 @check_unsupported() {
%1 = alloca i32
%2 = alloca i64
%3 = call i64 (...) @ERR_peek_error()
store i64 %3, i64* %2
%4 = load i64, i64* %2
%5 = call i64 @ERR_GET_LIB(i64 %4)
%6 = load i64, i64* @ERR_LIB_EVP
%7 = icmp eq i64 %5, %6
br i1 %7, label %8, label %15
8: ; preds = %0
%9 = load i64, i64* %2
%10 = call i64 @ERR_GET_REASON(i64 %9)
%11 = load i64, i64* @EVP_R_UNSUPPORTED_ALGORITHM
%12 = icmp eq i64 %10, %11
br i1 %12, label %13, label %15
13: ; preds = %8
%14 = call i32 (...) @ERR_clear_error()
store i32 1, i32* %1
br label %16
15: ; preds = %8, %0
store i32 0, i32* %1
br label %16
16: ; preds = %15, %13
%17 = load i32, i32* %1
ret i32 %17
}

LLVM IR (-O2):
@ERR_LIB_EVP = global i64 0
@EVP_R_UNSUPPORTED_ALGORITHM = global i64 0
define i32 @check_unsupported() {
%1 = tail call i64 (...) @ERR_peek_error()
%2 = tail call i64 @ERR_GET_LIB(i64 %1)
%3 = load i64, i64* @ERR_LIB_EVP
%4 = icmp eq i64 %2, %3
br i1 %4, label %5, label %11
5: ; preds = %0
%6 = tail call i64 @ERR_GET_REASON(i64 %1)
%7 = load i64, i64* @EVP_R_UNSUPPORTED_ALGORITHM
%8 = icmp eq i64 %6, %7
br i1 %8, label %9, label %11
9: ; preds = %5
%10 = tail call i32 (...) @ERR_clear_error()
br label %11
11: ; preds = %0, %5, %9
%12 = phi i32 [ 1, %9 ], [ 0, %5 ], [ 0, %0 ]
ret i32 %12
}