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


x86 assembly (clang, -O0):
<key_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    0x2e7d(%rip),%rcx
cmp    (%rcx),%rax
jne    1198 <key_unsupported+0x58>
mov    -0x10(%rbp),%rdi
call   1060 <ERR_GET_REASON@plt>
mov    0x2e44(%rip),%rcx
cmp    (%rcx),%rax
jne    1198 <key_unsupported+0x58>
mov    $0x0,%al
call   1040 <ERR_clear_error@plt>
movl   $0x1,-0x4(%rbp)
jmp    11e4 <key_unsupported+0xa4>
mov    -0x10(%rbp),%rdi
call   1050 <ERR_GET_LIB@plt>
mov    0x2e40(%rip),%rcx
cmp    (%rcx),%rax
jne    11dd <key_unsupported+0x9d>
mov    -0x10(%rbp),%rdi
call   1060 <ERR_GET_REASON@plt>
mov    0x2e17(%rip),%rcx
cmp    (%rcx),%rax
jne    11dd <key_unsupported+0x9d>
mov    $0x0,%al
call   1040 <ERR_clear_error@plt>
movl   $0x1,-0x4(%rbp)
jmp    11e4 <key_unsupported+0xa4>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<key_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    0x2e82(%rip),%rcx
cmp    (%rcx),%rax
jne    1177 <key_unsupported+0x37>
mov    %rbx,%rdi
call   1060 <ERR_GET_REASON@plt>
mov    0x2e4e(%rip),%rcx
cmp    (%rcx),%rax
je     119f <key_unsupported+0x5f>
mov    %rbx,%rdi
call   1050 <ERR_GET_LIB@plt>
mov    0x2e62(%rip),%rcx
cmp    (%rcx),%rax
jne    11ab <key_unsupported+0x6b>
mov    %rbx,%rdi
call   1060 <ERR_GET_REASON@plt>
mov    0x2e3e(%rip),%rcx
cmp    (%rcx),%rax
jne    11ab <key_unsupported+0x6b>
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
@ERR_LIB_EC = global i64 0
@EC_R_UNKNOWN_GROUP = global i64 0
define i32 @key_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 %28
15: ; preds = %8, %0
%16 = load i64, i64* %2
%17 = call i64 @ERR_GET_LIB(i64 %16)
%18 = load i64, i64* @ERR_LIB_EC
%19 = icmp eq i64 %17, %18
br i1 %19, label %20, label %27
20: ; preds = %15
%21 = load i64, i64* %2
%22 = call i64 @ERR_GET_REASON(i64 %21)
%23 = load i64, i64* @EC_R_UNKNOWN_GROUP
%24 = icmp eq i64 %22, %23
br i1 %24, label %25, label %27
25: ; preds = %20
%26 = call i32 (...) @ERR_clear_error()
store i32 1, i32* %1
br label %28
27: ; preds = %20, %15
store i32 0, i32* %1
br label %28
28: ; preds = %27, %25, %13
%29 = load i32, i32* %1
ret i32 %29
}

LLVM IR (-O2):
@ERR_LIB_EVP = global i64 0
@EVP_R_UNSUPPORTED_ALGORITHM = global i64 0
@ERR_LIB_EC = global i64 0
@EC_R_UNKNOWN_GROUP = global i64 0
define i32 @key_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 %9
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 %17, label %9
9: ; preds = %5, %0
%10 = tail call i64 @ERR_GET_LIB(i64 %1)
%11 = load i64, i64* @ERR_LIB_EC
%12 = icmp eq i64 %10, %11
br i1 %12, label %13, label %19
13: ; preds = %9
%14 = tail call i64 @ERR_GET_REASON(i64 %1)
%15 = load i64, i64* @EC_R_UNKNOWN_GROUP
%16 = icmp eq i64 %14, %15
br i1 %16, label %17, label %19
17: ; preds = %13, %5
%18 = tail call i32 (...) @ERR_clear_error()
br label %19
19: ; preds = %17, %9, %13
%20 = phi i32 [ 0, %13 ], [ 0, %9 ], [ 1, %17 ]
ret i32 %20
}