#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 */
typedef struct TYPE_7__ TYPE_3__;
typedef struct TYPE_6__ TYPE_2__;
typedef struct TYPE_5__ TYPE_1__;

/* Type definitions */
struct TYPE_7__ {
  TYPE_1__ *parameter;
  int /*<<< orphan*/ *algorithm;
};
typedef TYPE_3__ X509_ALGOR;
struct TYPE_6__ {
  void *ptr;
};
struct TYPE_5__ {
  int type;
  TYPE_2__ value;
};
typedef int /*<<< orphan*/ ASN1_OBJECT;

/* Variables and functions */
int V_ASN1_UNDEF;
void X509_ALGOR_get0(const ASN1_OBJECT **paobj, int *pptype, const void **ppval,
                     const X509_ALGOR *algor) {
  if (paobj)
    *paobj = algor->algorithm;
  if (pptype) {
    if (algor->parameter == NULL) {
      *pptype = V_ASN1_UNDEF;
      return;
    } else
      *pptype = algor->parameter->type;
    if (ppval)
      *ppval = algor->parameter->value.ptr;
  }
}


x86 assembly (clang, -O0):
<X509_ALGOR_get0>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     112e <X509_ALGOR_get0+0x2e>
mov    -0x20(%rbp),%rax
mov    0x8(%rax),%rcx
mov    -0x8(%rbp),%rax
mov    %rcx,(%rax)
cmpq   $0x0,-0x10(%rbp)
je     118c <X509_ALGOR_get0+0x8c>
mov    -0x20(%rbp),%rax
cmpq   $0x0,(%rax)
jne    115b <X509_ALGOR_get0+0x5b>
mov    0x2e9a(%rip),%rax
mov    (%rax),%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
jmp    118c <X509_ALGOR_get0+0x8c>
mov    -0x20(%rbp),%rax
mov    (%rax),%rax
mov    (%rax),%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
cmpq   $0x0,-0x18(%rbp)
je     1187 <X509_ALGOR_get0+0x87>
mov    -0x20(%rbp),%rax
mov    (%rax),%rax
mov    0x8(%rax),%rcx
mov    -0x18(%rbp),%rax
mov    %rcx,(%rax)
jmp    118c <X509_ALGOR_get0+0x8c>
pop    %rbp
ret

x86 assembly (clang, -O2):
<X509_ALGOR_get0>:
test   %rdi,%rdi
je     110c <X509_ALGOR_get0+0xc>
mov    0x8(%rcx),%rax
mov    %rax,(%rdi)
test   %rsi,%rsi
je     1129 <X509_ALGOR_get0+0x29>
mov    (%rcx),%rax
test   %rax,%rax
je     112a <X509_ALGOR_get0+0x2a>
mov    (%rax),%ecx
mov    %ecx,(%rsi)
test   %rdx,%rdx
je     1129 <X509_ALGOR_get0+0x29>
mov    0x8(%rax),%rax
mov    %rax,(%rdx)
ret
mov    0x2eb7(%rip),%rax
mov    (%rax),%eax
mov    %eax,(%rsi)
ret

LLVM IR (-O0):
%struct.TYPE_7__ = type { %struct.TYPE_5__*, i32* }
%struct.TYPE_5__ = type { i32, %struct.TYPE_6__ }
%struct.TYPE_6__ = type { i8* }
@V_ASN1_UNDEF = global i32 0
define void @X509_ALGOR_get0(i32** %0, i32* %1, i8** %2, %struct.TYPE_7__* %3) {
%5 = alloca i32**
%6 = alloca i32*
%7 = alloca i8**
%8 = alloca %struct.TYPE_7__*
store i32** %0, i32*** %5
store i32* %1, i32** %6
store i8** %2, i8*** %7
store %struct.TYPE_7__* %3, %struct.TYPE_7__** %8
%9 = load i32**, i32*** %5
%10 = icmp ne i32** %9, null
br i1 %10, label %11, label %16
11: ; preds = %4
%12 = load %struct.TYPE_7__*, %struct.TYPE_7__** %8
%13 = getelementptr inbounds %struct.TYPE_7__, %struct.TYPE_7__* %12, i32 0, i32 1
%14 = load i32*, i32** %13
%15 = load i32**, i32*** %5
store i32* %14, i32** %15
br label %16
16: ; preds = %11, %4
%17 = load i32*, i32** %6
%18 = icmp ne i32* %17, null
br i1 %18, label %19, label %46
19: ; preds = %16
%20 = load %struct.TYPE_7__*, %struct.TYPE_7__** %8
%21 = getelementptr inbounds %struct.TYPE_7__, %struct.TYPE_7__* %20, i32 0, i32 0
%22 = load %struct.TYPE_5__*, %struct.TYPE_5__** %21
%23 = icmp eq %struct.TYPE_5__* %22, null
br i1 %23, label %24, label %27
24: ; preds = %19
%25 = load i32, i32* @V_ASN1_UNDEF
%26 = load i32*, i32** %6
store i32 %25, i32* %26
br label %46
27: ; preds = %19
%28 = load %struct.TYPE_7__*, %struct.TYPE_7__** %8
%29 = getelementptr inbounds %struct.TYPE_7__, %struct.TYPE_7__* %28, i32 0, i32 0
%30 = load %struct.TYPE_5__*, %struct.TYPE_5__** %29
%31 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %30, i32 0, i32 0
%32 = load i32, i32* %31
%33 = load i32*, i32** %6
store i32 %32, i32* %33
br label %34
34: ; preds = %27
%35 = load i8**, i8*** %7
%36 = icmp ne i8** %35, null
br i1 %36, label %37, label %45
37: ; preds = %34
%38 = load %struct.TYPE_7__*, %struct.TYPE_7__** %8
%39 = getelementptr inbounds %struct.TYPE_7__, %struct.TYPE_7__* %38, i32 0, i32 0
%40 = load %struct.TYPE_5__*, %struct.TYPE_5__** %39
%41 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %40, i32 0, i32 1
%42 = getelementptr inbounds %struct.TYPE_6__, %struct.TYPE_6__* %41, i32 0, i32 0
%43 = load i8*, i8** %42
%44 = load i8**, i8*** %7
store i8* %43, i8** %44
br label %45
45: ; preds = %37, %34
br label %46
46: ; preds = %24, %45, %16
ret void
}

LLVM IR (-O2):
%struct.TYPE_7__ = type { %struct.TYPE_5__*, i32* }
%struct.TYPE_5__ = type { i32, %struct.TYPE_6__ }
%struct.TYPE_6__ = type { i8* }
@V_ASN1_UNDEF = global i32 0
define void @X509_ALGOR_get0(i32** writeonly %0, i32* writeonly %1, i8** writeonly %2, %struct.TYPE_7__* nocapture %3) {
%5 = icmp eq i32** %0, null
br i1 %5, label %9, label %6
6: ; preds = %4
%7 = getelementptr inbounds %struct.TYPE_7__, %struct.TYPE_7__* %3, i64 0, i32 1
%8 = load i32*, i32** %7
store i32* %8, i32** %0
br label %9
9: ; preds = %6, %4
%10 = icmp eq i32* %1, null
br i1 %10, label %24, label %11
11: ; preds = %9
%12 = getelementptr inbounds %struct.TYPE_7__, %struct.TYPE_7__* %3, i64 0, i32 0
%13 = load %struct.TYPE_5__*, %struct.TYPE_5__** %12
%14 = icmp eq %struct.TYPE_5__* %13, null
br i1 %14, label %15, label %17
15: ; preds = %11
%16 = load i32, i32* @V_ASN1_UNDEF
store i32 %16, i32* %1
br label %24
17: ; preds = %11
%18 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %13, i64 0, i32 0
%19 = load i32, i32* %18
store i32 %19, i32* %1
%20 = icmp eq i8** %2, null
br i1 %20, label %24, label %21
21: ; preds = %17
%22 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %13, i64 0, i32 1, i32 0
%23 = load i8*, i8** %22
store i8* %23, i8** %2
br label %24
24: ; preds = %17, %21, %15, %9
ret void
}