#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_23__ TYPE_9__;
typedef struct TYPE_22__ TYPE_8__;
typedef struct TYPE_21__ TYPE_7__;
typedef struct TYPE_20__ TYPE_6__;
typedef struct TYPE_19__ TYPE_5__;
typedef struct TYPE_18__ TYPE_4__;
typedef struct TYPE_17__ TYPE_3__;
typedef struct TYPE_16__ TYPE_2__;
typedef struct TYPE_15__ TYPE_1__;

/* Type definitions */
struct TYPE_21__ {
  TYPE_3__ *parameter;
};
typedef TYPE_7__ X509_ALGOR;
struct TYPE_20__ {
  TYPE_5__ *sequence;
};
struct TYPE_23__ {
  scalar_t__ type;
  TYPE_6__ value;
};
struct TYPE_22__ {
  TYPE_4__ *maskGenAlgorithm;
};
struct TYPE_19__ {
  unsigned char *data;
  int length;
};
struct TYPE_18__ {
  int /*<<< orphan*/ algorithm;
  TYPE_9__ *parameter;
};
struct TYPE_16__ {
  TYPE_1__ *sequence;
};
struct TYPE_17__ {
  scalar_t__ type;
  TYPE_2__ value;
};
struct TYPE_15__ {
  unsigned char *data;
  int length;
};
typedef TYPE_8__ RSA_PSS_PARAMS;
typedef TYPE_9__ ASN1_TYPE;

/* Variables and functions */
scalar_t__ NID_mgf1;
scalar_t__ OBJ_obj2nid(int /*<<< orphan*/);
scalar_t__ V_ASN1_SEQUENCE;
TYPE_8__ *d2i_RSA_PSS_PARAMS(int /*<<< orphan*/ *, unsigned char const **, int);
TYPE_7__ *d2i_X509_ALGOR(int /*<<< orphan*/ *, unsigned char const **, int);
RSA_PSS_PARAMS *rsa_pss_decode(const X509_ALGOR *alg, X509_ALGOR **pmaskHash) {
  const unsigned char *p;
  int plen;
  RSA_PSS_PARAMS *pss;
  *pmaskHash = NULL;
  if (!alg->parameter || alg->parameter->type != V_ASN1_SEQUENCE)
    return NULL;
  p = alg->parameter->value.sequence->data;
  plen = alg->parameter->value.sequence->length;
  pss = d2i_RSA_PSS_PARAMS(NULL, &p, plen);
  if (!pss)
    return NULL;
  if (pss->maskGenAlgorithm) {
    ASN1_TYPE *param = pss->maskGenAlgorithm->parameter;
    if (OBJ_obj2nid(pss->maskGenAlgorithm->algorithm) == NID_mgf1 && param &&
        param->type == V_ASN1_SEQUENCE) {
      p = param->value.sequence->data;
      plen = param->value.sequence->length;
      *pmaskHash = d2i_X509_ALGOR(NULL, &p, plen);
    }
  }
  return pss;
}


x86 assembly (clang, -O0):
<rsa_pss_decode>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x18(%rbp),%rax
movq   $0x0,(%rax)
mov    -0x10(%rbp),%rax
cmpq   $0x0,(%rax)
je     1173 <rsa_pss_decode+0x43>
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
mov    (%rax),%rax
mov    0x2e6e(%rip),%rcx
cmp    (%rcx),%rax
je     1180 <rsa_pss_decode+0x50>
movq   $0x0,-0x8(%rbp)
jmp    1270 <rsa_pss_decode+0x140>
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
mov    0x8(%rax),%rax
mov    (%rax),%rax
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
mov    0x8(%rax),%rax
mov    0x8(%rax),%eax
mov    %eax,-0x24(%rbp)
mov    -0x24(%rbp),%edx
xor    %eax,%eax
mov    %eax,%edi
lea    -0x20(%rbp),%rsi
call   1050 <d2i_RSA_PSS_PARAMS@plt>
mov    %rax,-0x30(%rbp)
cmpq   $0x0,-0x30(%rbp)
jne    11cf <rsa_pss_decode+0x9f>
movq   $0x0,-0x8(%rbp)
jmp    1270 <rsa_pss_decode+0x140>
mov    -0x30(%rbp),%rax
cmpq   $0x0,(%rax)
je     1268 <rsa_pss_decode+0x138>
mov    -0x30(%rbp),%rax
mov    (%rax),%rax
mov    0x8(%rax),%rax
mov    %rax,-0x38(%rbp)
mov    -0x30(%rbp),%rax
mov    (%rax),%rax
mov    (%rax),%edi
call   1030 <OBJ_obj2nid@plt>
mov    0x2dcf(%rip),%rcx
cmp    (%rcx),%rax
jne    1263 <rsa_pss_decode+0x133>
cmpq   $0x0,-0x38(%rbp)
je     1263 <rsa_pss_decode+0x133>
mov    -0x38(%rbp),%rax
mov    (%rax),%rax
mov    0x2db5(%rip),%rcx
cmp    (%rcx),%rax
jne    1263 <rsa_pss_decode+0x133>
mov    -0x38(%rbp),%rax
mov    0x8(%rax),%rax
mov    (%rax),%rax
mov    %rax,-0x20(%rbp)
mov    -0x38(%rbp),%rax
mov    0x8(%rax),%rax
mov    0x8(%rax),%eax
mov    %eax,-0x24(%rbp)
mov    -0x24(%rbp),%edx
xor    %eax,%eax
mov    %eax,%edi
lea    -0x20(%rbp),%rsi
call   1040 <d2i_X509_ALGOR@plt>
mov    %rax,%rcx
mov    -0x18(%rbp),%rax
mov    %rcx,(%rax)
jmp    1268 <rsa_pss_decode+0x138>
mov    -0x30(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<rsa_pss_decode>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
movq   $0x0,(%rsi)
mov    (%rdi),%rax
test   %rax,%rax
je     11cd <rsa_pss_decode+0x9d>
mov    (%rax),%rcx
mov    0x2e83(%rip),%r12
cmp    (%r12),%rcx
jne    11cd <rsa_pss_decode+0x9d>
mov    %rsi,%r15
mov    0x8(%rax),%rax
mov    (%rax),%rcx
mov    %rcx,(%rsp)
mov    0x8(%rax),%edx
xor    %ebx,%ebx
mov    %rsp,%rsi
xor    %edi,%edi
call   1050 <d2i_RSA_PSS_PARAMS@plt>
test   %rax,%rax
je     11cf <rsa_pss_decode+0x9f>
mov    %rax,%r14
mov    (%rax),%rax
test   %rax,%rax
je     11c8 <rsa_pss_decode+0x98>
mov    0x8(%rax),%rbx
mov    (%rax),%edi
call   1030 <OBJ_obj2nid@plt>
mov    0x2e36(%rip),%rcx
cmp    (%rcx),%rax
jne    11c8 <rsa_pss_decode+0x98>
test   %rbx,%rbx
je     11c8 <rsa_pss_decode+0x98>
mov    (%rbx),%rax
cmp    (%r12),%rax
jne    11c8 <rsa_pss_decode+0x98>
mov    0x8(%rbx),%rax
mov    (%rax),%rcx
mov    %rcx,(%rsp)
mov    0x8(%rax),%edx
mov    %rsp,%rsi
xor    %edi,%edi
call   1040 <d2i_X509_ALGOR@plt>
mov    %rax,(%r15)
mov    %r14,%rbx
jmp    11cf <rsa_pss_decode+0x9f>
xor    %ebx,%ebx
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
%struct.TYPE_22__ = type { %struct.TYPE_18__* }
%struct.TYPE_18__ = type { i32, %struct.TYPE_23__* }
%struct.TYPE_23__ = type { i64, %struct.TYPE_20__ }
%struct.TYPE_20__ = type { %struct.TYPE_19__* }
%struct.TYPE_19__ = type { i8*, i32 }
%struct.TYPE_21__ = type { %struct.TYPE_17__* }
%struct.TYPE_17__ = type { i64, %struct.TYPE_16__ }
%struct.TYPE_16__ = type { %struct.TYPE_15__* }
%struct.TYPE_15__ = type { i8*, i32 }
@V_ASN1_SEQUENCE = global i64 0
@NID_mgf1 = global i64 0
define %struct.TYPE_22__* @rsa_pss_decode(%struct.TYPE_21__* %0, %struct.TYPE_21__** %1) {
%3 = alloca %struct.TYPE_22__*
%4 = alloca %struct.TYPE_21__*
%5 = alloca %struct.TYPE_21__**
%6 = alloca i8*
%7 = alloca i32
%8 = alloca %struct.TYPE_22__*
%9 = alloca %struct.TYPE_23__*
store %struct.TYPE_21__* %0, %struct.TYPE_21__** %4
store %struct.TYPE_21__** %1, %struct.TYPE_21__*** %5
%10 = load %struct.TYPE_21__**, %struct.TYPE_21__*** %5
store %struct.TYPE_21__* null, %struct.TYPE_21__** %10
%11 = load %struct.TYPE_21__*, %struct.TYPE_21__** %4
%12 = getelementptr inbounds %struct.TYPE_21__, %struct.TYPE_21__* %11, i32 0, i32 0
%13 = load %struct.TYPE_17__*, %struct.TYPE_17__** %12
%14 = icmp ne %struct.TYPE_17__* %13, null
br i1 %14, label %15, label %23
15: ; preds = %2
%16 = load %struct.TYPE_21__*, %struct.TYPE_21__** %4
%17 = getelementptr inbounds %struct.TYPE_21__, %struct.TYPE_21__* %16, i32 0, i32 0
%18 = load %struct.TYPE_17__*, %struct.TYPE_17__** %17
%19 = getelementptr inbounds %struct.TYPE_17__, %struct.TYPE_17__* %18, i32 0, i32 0
%20 = load i64, i64* %19
%21 = load i64, i64* @V_ASN1_SEQUENCE
%22 = icmp ne i64 %20, %21
br i1 %22, label %23, label %24
23: ; preds = %15, %2
store %struct.TYPE_22__* null, %struct.TYPE_22__** %3
br label %93
24: ; preds = %15
%25 = load %struct.TYPE_21__*, %struct.TYPE_21__** %4
%26 = getelementptr inbounds %struct.TYPE_21__, %struct.TYPE_21__* %25, i32 0, i32 0
%27 = load %struct.TYPE_17__*, %struct.TYPE_17__** %26
%28 = getelementptr inbounds %struct.TYPE_17__, %struct.TYPE_17__* %27, i32 0, i32 1
%29 = getelementptr inbounds %struct.TYPE_16__, %struct.TYPE_16__* %28, i32 0, i32 0
%30 = load %struct.TYPE_15__*, %struct.TYPE_15__** %29
%31 = getelementptr inbounds %struct.TYPE_15__, %struct.TYPE_15__* %30, i32 0, i32 0
%32 = load i8*, i8** %31
store i8* %32, i8** %6
%33 = load %struct.TYPE_21__*, %struct.TYPE_21__** %4
%34 = getelementptr inbounds %struct.TYPE_21__, %struct.TYPE_21__* %33, i32 0, i32 0
%35 = load %struct.TYPE_17__*, %struct.TYPE_17__** %34
%36 = getelementptr inbounds %struct.TYPE_17__, %struct.TYPE_17__* %35, i32 0, i32 1
%37 = getelementptr inbounds %struct.TYPE_16__, %struct.TYPE_16__* %36, i32 0, i32 0
%38 = load %struct.TYPE_15__*, %struct.TYPE_15__** %37
%39 = getelementptr inbounds %struct.TYPE_15__, %struct.TYPE_15__* %38, i32 0, i32 1
%40 = load i32, i32* %39
store i32 %40, i32* %7
%41 = load i32, i32* %7
%42 = call %struct.TYPE_22__* @d2i_RSA_PSS_PARAMS(i32* null, i8** %6, i32 %41)
store %struct.TYPE_22__* %42, %struct.TYPE_22__** %8
%43 = load %struct.TYPE_22__*, %struct.TYPE_22__** %8
%44 = icmp ne %struct.TYPE_22__* %43, null
br i1 %44, label %46, label %45
45: ; preds = %24
store %struct.TYPE_22__* null, %struct.TYPE_22__** %3
br label %93
46: ; preds = %24
%47 = load %struct.TYPE_22__*, %struct.TYPE_22__** %8
%48 = getelementptr inbounds %struct.TYPE_22__, %struct.TYPE_22__* %47, i32 0, i32 0
%49 = load %struct.TYPE_18__*, %struct.TYPE_18__** %48
%50 = icmp ne %struct.TYPE_18__* %49, null
br i1 %50, label %51, label %91
51: ; preds = %46
%52 = load %struct.TYPE_22__*, %struct.TYPE_22__** %8
%53 = getelementptr inbounds %struct.TYPE_22__, %struct.TYPE_22__* %52, i32 0, i32 0
%54 = load %struct.TYPE_18__*, %struct.TYPE_18__** %53
%55 = getelementptr inbounds %struct.TYPE_18__, %struct.TYPE_18__* %54, i32 0, i32 1
%56 = load %struct.TYPE_23__*, %struct.TYPE_23__** %55
store %struct.TYPE_23__* %56, %struct.TYPE_23__** %9
%57 = load %struct.TYPE_22__*, %struct.TYPE_22__** %8
%58 = getelementptr inbounds %struct.TYPE_22__, %struct.TYPE_22__* %57, i32 0, i32 0
%59 = load %struct.TYPE_18__*, %struct.TYPE_18__** %58
%60 = getelementptr inbounds %struct.TYPE_18__, %struct.TYPE_18__* %59, i32 0, i32 0
%61 = load i32, i32* %60
%62 = call i64 @OBJ_obj2nid(i32 %61)
%63 = load i64, i64* @NID_mgf1
%64 = icmp eq i64 %62, %63
br i1 %64, label %65, label %90
65: ; preds = %51
%66 = load %struct.TYPE_23__*, %struct.TYPE_23__** %9
%67 = icmp ne %struct.TYPE_23__* %66, null
br i1 %67, label %68, label %90
68: ; preds = %65
%69 = load %struct.TYPE_23__*, %struct.TYPE_23__** %9
%70 = getelementptr inbounds %struct.TYPE_23__, %struct.TYPE_23__* %69, i32 0, i32 0
%71 = load i64, i64* %70
%72 = load i64, i64* @V_ASN1_SEQUENCE
%73 = icmp eq i64 %71, %72
br i1 %73, label %74, label %90
74: ; preds = %68
%75 = load %struct.TYPE_23__*, %struct.TYPE_23__** %9
%76 = getelementptr inbounds %struct.TYPE_23__, %struct.TYPE_23__* %75, i32 0, i32 1
%77 = getelementptr inbounds %struct.TYPE_20__, %struct.TYPE_20__* %76, i32 0, i32 0
%78 = load %struct.TYPE_19__*, %struct.TYPE_19__** %77
%79 = getelementptr inbounds %struct.TYPE_19__, %struct.TYPE_19__* %78, i32 0, i32 0
%80 = load i8*, i8** %79
store i8* %80, i8** %6
%81 = load %struct.TYPE_23__*, %struct.TYPE_23__** %9
%82 = getelementptr inbounds %struct.TYPE_23__, %struct.TYPE_23__* %81, i32 0, i32 1
%83 = getelementptr inbounds %struct.TYPE_20__, %struct.TYPE_20__* %82, i32 0, i32 0
%84 = load %struct.TYPE_19__*, %struct.TYPE_19__** %83
%85 = getelementptr inbounds %struct.TYPE_19__, %struct.TYPE_19__* %84, i32 0, i32 1
%86 = load i32, i32* %85
store i32 %86, i32* %7
%87 = load i32, i32* %7
%88 = call %struct.TYPE_21__* @d2i_X509_ALGOR(i32* null, i8** %6, i32 %87)
%89 = load %struct.TYPE_21__**, %struct.TYPE_21__*** %5
store %struct.TYPE_21__* %88, %struct.TYPE_21__** %89
br label %90
90: ; preds = %74, %68, %65, %51
br label %91
91: ; preds = %90, %46
%92 = load %struct.TYPE_22__*, %struct.TYPE_22__** %8
store %struct.TYPE_22__* %92, %struct.TYPE_22__** %3
br label %93
93: ; preds = %91, %45, %23
%94 = load %struct.TYPE_22__*, %struct.TYPE_22__** %3
ret %struct.TYPE_22__* %94
}

LLVM IR (-O2):
%struct.TYPE_22__ = type { %struct.TYPE_18__* }
%struct.TYPE_18__ = type { i32, %struct.TYPE_23__* }
%struct.TYPE_23__ = type { i64, %struct.TYPE_20__ }
%struct.TYPE_20__ = type { %struct.TYPE_19__* }
%struct.TYPE_19__ = type { i8*, i32 }
%struct.TYPE_21__ = type { %struct.TYPE_17__* }
%struct.TYPE_17__ = type { i64, %struct.TYPE_16__ }
%struct.TYPE_16__ = type { %struct.TYPE_15__* }
%struct.TYPE_15__ = type { i8*, i32 }
@V_ASN1_SEQUENCE = global i64 0
@NID_mgf1 = global i64 0
define %struct.TYPE_22__* @rsa_pss_decode(%struct.TYPE_21__* nocapture %0, %struct.TYPE_21__** nocapture writeonly %1) {
%3 = alloca i8*
%4 = bitcast i8** %3 to i8*
store %struct.TYPE_21__* null, %struct.TYPE_21__** %1
%5 = getelementptr inbounds %struct.TYPE_21__, %struct.TYPE_21__* %0, i64 0, i32 0
%6 = load %struct.TYPE_17__*, %struct.TYPE_17__** %5
%7 = icmp eq %struct.TYPE_17__* %6, null
br i1 %7, label %49, label %8
8: ; preds = %2
%9 = getelementptr inbounds %struct.TYPE_17__, %struct.TYPE_17__* %6, i64 0, i32 0
%10 = load i64, i64* %9
%11 = load i64, i64* @V_ASN1_SEQUENCE
%12 = icmp eq i64 %10, %11
br i1 %12, label %13, label %49
13: ; preds = %8
%14 = getelementptr inbounds %struct.TYPE_17__, %struct.TYPE_17__* %6, i64 0, i32 1, i32 0
%15 = load %struct.TYPE_15__*, %struct.TYPE_15__** %14
%16 = getelementptr inbounds %struct.TYPE_15__, %struct.TYPE_15__* %15, i64 0, i32 0
%17 = load i8*, i8** %16
store i8* %17, i8** %3
%18 = getelementptr inbounds %struct.TYPE_15__, %struct.TYPE_15__* %15, i64 0, i32 1
%19 = load i32, i32* %18
%20 = call %struct.TYPE_22__* @d2i_RSA_PSS_PARAMS(i32* null, i8** %3, i32 %19)
%21 = icmp eq %struct.TYPE_22__* %20, null
br i1 %21, label %49, label %22
22: ; preds = %13
%23 = getelementptr inbounds %struct.TYPE_22__, %struct.TYPE_22__* %20, i64 0, i32 0
%24 = load %struct.TYPE_18__*, %struct.TYPE_18__** %23
%25 = icmp eq %struct.TYPE_18__* %24, null
br i1 %25, label %49, label %26
26: ; preds = %22
%27 = getelementptr inbounds %struct.TYPE_18__, %struct.TYPE_18__* %24, i64 0, i32 1
%28 = load %struct.TYPE_23__*, %struct.TYPE_23__** %27
%29 = getelementptr inbounds %struct.TYPE_18__, %struct.TYPE_18__* %24, i64 0, i32 0
%30 = load i32, i32* %29
%31 = call i64 @OBJ_obj2nid(i32 %30)
%32 = load i64, i64* @NID_mgf1
%33 = icmp eq i64 %31, %32
%34 = icmp ne %struct.TYPE_23__* %28, null
%35 = select i1 %33, i1 %34, i1 false
br i1 %35, label %36, label %49
36: ; preds = %26
%37 = getelementptr inbounds %struct.TYPE_23__, %struct.TYPE_23__* %28, i64 0, i32 0
%38 = load i64, i64* %37
%39 = load i64, i64* @V_ASN1_SEQUENCE
%40 = icmp eq i64 %38, %39
br i1 %40, label %41, label %49
41: ; preds = %36
%42 = getelementptr inbounds %struct.TYPE_23__, %struct.TYPE_23__* %28, i64 0, i32 1, i32 0
%43 = load %struct.TYPE_19__*, %struct.TYPE_19__** %42
%44 = getelementptr inbounds %struct.TYPE_19__, %struct.TYPE_19__* %43, i64 0, i32 0
%45 = load i8*, i8** %44
store i8* %45, i8** %3
%46 = getelementptr inbounds %struct.TYPE_19__, %struct.TYPE_19__* %43, i64 0, i32 1
%47 = load i32, i32* %46
%48 = call %struct.TYPE_21__* @d2i_X509_ALGOR(i32* null, i8** %3, i32 %47)
store %struct.TYPE_21__* %48, %struct.TYPE_21__** %1
br label %49
49: ; preds = %22, %41, %36, %26, %13, %2, %8
%50 = phi %struct.TYPE_22__* [ null, %8 ], [ null, %2 ], [ null, %13 ], [ %20, %26 ], [ %20, %36 ], [ %20, %41 ], [ %20, %22 ]
ret %struct.TYPE_22__* %50
}