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

/* Variables and functions */
#define NID_basic_constraints 138
#define NID_certificate_policies 137
#define NID_ext_key_usage 136
#define NID_inhibit_any_policy 135
#define NID_key_usage 134
#define NID_name_constraints 133
#define NID_netscape_cert_type 132
#define NID_policy_constraints 131
#define NID_policy_mappings 130
#define NID_proxyCertInfo 129
#define NID_subject_alt_name 128
int NID_undef;
scalar_t__ OBJ_bsearch_nid(int *, int const *, int);
int OBJ_obj2nid(int /*<<< orphan*/);
int /*<<< orphan*/ X509_EXTENSION_get_object(int /*<<< orphan*/ *);
int X509_supported_extension(X509_EXTENSION *ex) {
  static const int supported_nids[] = {
      NID_netscape_cert_type,   NID_key_usage,
      NID_subject_alt_name,     NID_basic_constraints,
      NID_certificate_policies, NID_ext_key_usage,
      NID_policy_constraints,   NID_proxyCertInfo,
      NID_name_constraints,     NID_policy_mappings,
      NID_inhibit_any_policy};
  int ex_nid = OBJ_obj2nid(X509_EXTENSION_get_object(ex));
  if (ex_nid == NID_undef)
    return 0;
  if (OBJ_bsearch_nid(&ex_nid, supported_nids,
                      sizeof(supported_nids) / sizeof(int)))
    return 1;
  return 0;
}


x86 assembly (clang, -O0):
<X509_supported_extension>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1050 <X509_EXTENSION_get_object@plt>
mov    %eax,%edi
call   1030 <OBJ_obj2nid@plt>
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    0x2e87(%rip),%rcx
cmp    (%rcx),%eax
jne    116d <X509_supported_extension+0x3d>
movl   $0x0,-0x4(%rbp)
jmp    119f <X509_supported_extension+0x6f>
lea    -0x14(%rbp),%rdi
lea    0xe88(%rip),%rsi
mov    $0xb,%edx
call   1040 <OBJ_bsearch_nid@plt>
cmp    $0x0,%rax
je     1198 <X509_supported_extension+0x68>
movl   $0x1,-0x4(%rbp)
jmp    119f <X509_supported_extension+0x6f>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<X509_supported_extension>:
push   %rax
call   1050 <X509_EXTENSION_get_object@plt>
mov    %eax,%edi
call   1030 <OBJ_obj2nid@plt>
mov    %eax,%ecx
mov    %eax,0x4(%rsp)
mov    0x2e96(%rip),%rdx
xor    %eax,%eax
cmp    (%rdx),%ecx
je     1171 <X509_supported_extension+0x41>
lea    0xea9(%rip),%rsi
lea    0x4(%rsp),%rdi
mov    $0xb,%edx
call   1040 <OBJ_bsearch_nid@plt>
mov    %rax,%rcx
xor    %eax,%eax
test   %rcx,%rcx
setne  %al
pop    %rcx
ret

LLVM IR (-O0):
@X509_supported_extension.supported_nids = internal constant [11 x i32] [i32 132, i32 134, i32 128, i32 138, i32 137, i32 136, i32 131, i32 129, i32 133, i32 130, i32 135]
@NID_undef = global i32 0
define i32 @X509_supported_extension(i32* %0) {
%2 = alloca i32
%3 = alloca i32*
%4 = alloca i32
store i32* %0, i32** %3
%5 = load i32*, i32** %3
%6 = call i32 @X509_EXTENSION_get_object(i32* %5)
%7 = call i32 @OBJ_obj2nid(i32 %6)
store i32 %7, i32* %4
%8 = load i32, i32* %4
%9 = load i32, i32* @NID_undef
%10 = icmp eq i32 %8, %9
br i1 %10, label %11, label %12
11: ; preds = %1
store i32 0, i32* %2
br label %17
12: ; preds = %1
%13 = call i64 @OBJ_bsearch_nid(i32* %4, i32* getelementptr inbounds ([11 x i32], [11 x i32]* @X509_supported_extension.supported_nids, i64 0, i64 0), i32 11)
%14 = icmp ne i64 %13, 0
br i1 %14, label %15, label %16
15: ; preds = %12
store i32 1, i32* %2
br label %17
16: ; preds = %12
store i32 0, i32* %2
br label %17
17: ; preds = %16, %15, %11
%18 = load i32, i32* %2
ret i32 %18
}

LLVM IR (-O2):
@X509_supported_extension.supported_nids = internal constant [11 x i32] [i32 132, i32 134, i32 128, i32 138, i32 137, i32 136, i32 131, i32 129, i32 133, i32 130, i32 135]
@NID_undef = global i32 0
define i32 @X509_supported_extension(i32* %0) {
%2 = alloca i32
%3 = bitcast i32* %2 to i8*
%4 = tail call i32 @X509_EXTENSION_get_object(i32* %0)
%5 = tail call i32 @OBJ_obj2nid(i32 %4)
store i32 %5, i32* %2
%6 = load i32, i32* @NID_undef
%7 = icmp eq i32 %5, %6
br i1 %7, label %12, label %8
8: ; preds = %1
%9 = call i64 @OBJ_bsearch_nid(i32* %2, i32* getelementptr inbounds ([11 x i32], [11 x i32]* @X509_supported_extension.supported_nids, i64 0, i64 0), i32 11)
%10 = icmp ne i64 %9, 0
%11 = zext i1 %10 to i32
br label %12
12: ; preds = %8, %1
%13 = phi i32 [ 0, %1 ], [ %11, %8 ]
ret i32 %13
}