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

/* Variables and functions */
scalar_t__ OBJ_cmp(int /*<<< orphan*/, int /*<<< orphan*/ const *const);
int /*<<< orphan*/ *OBJ_txt2obj(char *, int);
scalar_t__ X509V3_EXT_d2i(int /*<<< orphan*/ *);
int /*<<< orphan*/ X509_EXTENSION_get_object(int /*<<< orphan*/ *);
AUTHORITY_INFO_ACCESS *extract_aia_info(X509_EXTENSION *ext) {
  const ASN1_OBJECT *const kAiaOid = OBJ_txt2obj("1.3.6.1.5.5.7.1.1", 1);
  if (ext == NULL || OBJ_cmp(X509_EXTENSION_get_object(ext), kAiaOid) != 0) {
    return NULL;
  }
  return (AUTHORITY_INFO_ACCESS *)X509V3_EXT_d2i(ext);
}


x86 assembly (clang, -O0):
<extract_aia_info>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
lea    0xead(%rip),%rdi
mov    $0x1,%esi
call   1030 <OBJ_txt2obj@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     118a <extract_aia_info+0x4a>
mov    -0x10(%rbp),%rdi
call   1040 <X509_EXTENSION_get_object@plt>
mov    %eax,%edi
mov    -0x18(%rbp),%rsi
call   1050 <OBJ_cmp@plt>
cmp    $0x0,%rax
je     1197 <extract_aia_info+0x57>
movq   $0x0,-0x8(%rbp)
jmp    11a4 <extract_aia_info+0x64>
mov    -0x10(%rbp),%rdi
call   1060 <X509V3_EXT_d2i@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<extract_aia_info>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%rbx
lea    0xeb2(%rip),%rdi
mov    $0x1,%esi
call   1030 <OBJ_txt2obj@plt>
test   %rbx,%rbx
je     1177 <extract_aia_info+0x37>
mov    %rax,%r14
mov    %rbx,%rdi
call   1040 <X509_EXTENSION_get_object@plt>
mov    %eax,%edi
mov    %r14,%rsi
call   1050 <OBJ_cmp@plt>
test   %rax,%rax
je     117b <extract_aia_info+0x3b>
xor    %eax,%eax
jmp    1183 <extract_aia_info+0x43>
mov    %rbx,%rdi
call   1060 <X509V3_EXT_d2i@plt>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [18 x i8] c"1.3.6.1.5.5.7.1.1\00"
define i32* @extract_aia_info(i32* %0) {
%2 = alloca i32*
%3 = alloca i32*
%4 = alloca i32*
store i32* %0, i32** %3
%5 = call i32* @OBJ_txt2obj(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i32 1)
store i32* %5, i32** %4
%6 = load i32*, i32** %3
%7 = icmp eq i32* %6, null
br i1 %7, label %14, label %8
8: ; preds = %1
%9 = load i32*, i32** %3
%10 = call i32 @X509_EXTENSION_get_object(i32* %9)
%11 = load i32*, i32** %4
%12 = call i64 @OBJ_cmp(i32 %10, i32* %11)
%13 = icmp ne i64 %12, 0
br i1 %13, label %14, label %15
14: ; preds = %8, %1
store i32* null, i32** %2
br label %19
15: ; preds = %8
%16 = load i32*, i32** %3
%17 = call i64 @X509V3_EXT_d2i(i32* %16)
%18 = inttoptr i64 %17 to i32*
store i32* %18, i32** %2
br label %19
19: ; preds = %15, %14
%20 = load i32*, i32** %2
ret i32* %20
}

LLVM IR (-O2):
@.str = [18 x i8] c"1.3.6.1.5.5.7.1.1\00"
define i32* @extract_aia_info(i32* %0) {
%2 = tail call i32* @OBJ_txt2obj(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i32 1)
%3 = icmp eq i32* %0, null
br i1 %3, label %11, label %4
4: ; preds = %1
%5 = tail call i32 @X509_EXTENSION_get_object(i32* %0)
%6 = tail call i64 @OBJ_cmp(i32 %5, i32* %2)
%7 = icmp eq i64 %6, 0
br i1 %7, label %8, label %11
8: ; preds = %4
%9 = tail call i64 @X509V3_EXT_d2i(i32* %0)
%10 = inttoptr i64 %9 to i32*
br label %11
11: ; preds = %1, %4, %8
%12 = phi i32* [ %10, %8 ], [ null, %4 ], [ null, %1 ]
ret i32* %12
}