#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->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    1265 <rsa_pss_decode+0x135>
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    1265 <rsa_pss_decode+0x135>
mov    -0x30(%rbp),%rax
cmpq   $0x0,(%rax)
je     125d <rsa_pss_decode+0x12d>
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    1258 <rsa_pss_decode+0x128>
mov    -0x38(%rbp),%rax
mov    (%rax),%rax
mov    0x2dc0(%rip),%rcx
cmp    (%rcx),%rax
jne    1258 <rsa_pss_decode+0x128>
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    125d <rsa_pss_decode+0x12d>
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     11c4 <rsa_pss_decode+0x94>
mov    (%rax),%rcx
mov    0x2e87(%rip),%r12
cmp    (%r12),%rcx
jne    11c4 <rsa_pss_decode+0x94>
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     11c6 <rsa_pss_decode+0x96>
mov    %rax,%r14
mov    (%rax),%rax
test   %rax,%rax
je     11bf <rsa_pss_decode+0x8f>
mov    0x8(%rax),%rbx
mov    (%rax),%edi
call   1030 <OBJ_obj2nid@plt>
mov    0x2e3a(%rip),%rcx
cmp    (%rcx),%rax
jne    11bf <rsa_pss_decode+0x8f>
mov    (%rbx),%rax
cmp    (%r12),%rax
jne    11bf <rsa_pss_decode+0x8f>
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    11c6 <rsa_pss_decode+0x96>
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 %90
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 %90
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 %88
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 %87
65: ; preds = %51
%66 = load %struct.TYPE_23__*, %struct.TYPE_23__** %9
%67 = getelementptr inbounds %struct.TYPE_23__, %struct.TYPE_23__* %66, i32 0, i32 0
%68 = load i64, i64* %67
%69 = load i64, i64* @V_ASN1_SEQUENCE
%70 = icmp eq i64 %68, %69
br i1 %70, label %71, label %87
71: ; preds = %65
%72 = load %struct.TYPE_23__*, %struct.TYPE_23__** %9
%73 = getelementptr inbounds %struct.TYPE_23__, %struct.TYPE_23__* %72, i32 0, i32 1
%74 = getelementptr inbounds %struct.TYPE_20__, %struct.TYPE_20__* %73, i32 0, i32 0
%75 = load %struct.TYPE_19__*, %struct.TYPE_19__** %74
%76 = getelementptr inbounds %struct.TYPE_19__, %struct.TYPE_19__* %75, i32 0, i32 0
%77 = load i8*, i8** %76
store i8* %77, i8** %6
%78 = load %struct.TYPE_23__*, %struct.TYPE_23__** %9
%79 = getelementptr inbounds %struct.TYPE_23__, %struct.TYPE_23__* %78, i32 0, i32 1
%80 = getelementptr inbounds %struct.TYPE_20__, %struct.TYPE_20__* %79, i32 0, i32 0
%81 = load %struct.TYPE_19__*, %struct.TYPE_19__** %80
%82 = getelementptr inbounds %struct.TYPE_19__, %struct.TYPE_19__* %81, i32 0, i32 1
%83 = load i32, i32* %82
store i32 %83, i32* %7
%84 = load i32, i32* %7
%85 = call %struct.TYPE_21__* @d2i_X509_ALGOR(i32* null, i8** %6, i32 %84)
%86 = load %struct.TYPE_21__**, %struct.TYPE_21__*** %5
store %struct.TYPE_21__* %85, %struct.TYPE_21__** %86
br label %87
87: ; preds = %71, %65, %51
br label %88
88: ; preds = %87, %46
%89 = load %struct.TYPE_22__*, %struct.TYPE_22__** %8
store %struct.TYPE_22__* %89, %struct.TYPE_22__** %3
br label %90
90: ; preds = %88, %45, %23
%91 = load %struct.TYPE_22__*, %struct.TYPE_22__** %3
ret %struct.TYPE_22__* %91
}

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 %47, 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 %47
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 %47, 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 %47, 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
br i1 %33, label %34, label %47
34: ; preds = %26
%35 = getelementptr inbounds %struct.TYPE_23__, %struct.TYPE_23__* %28, i64 0, i32 0
%36 = load i64, i64* %35
%37 = load i64, i64* @V_ASN1_SEQUENCE
%38 = icmp eq i64 %36, %37
br i1 %38, label %39, label %47
39: ; preds = %34
%40 = getelementptr inbounds %struct.TYPE_23__, %struct.TYPE_23__* %28, i64 0, i32 1, i32 0
%41 = load %struct.TYPE_19__*, %struct.TYPE_19__** %40
%42 = getelementptr inbounds %struct.TYPE_19__, %struct.TYPE_19__* %41, i64 0, i32 0
%43 = load i8*, i8** %42
store i8* %43, i8** %3
%44 = getelementptr inbounds %struct.TYPE_19__, %struct.TYPE_19__* %41, i64 0, i32 1
%45 = load i32, i32* %44
%46 = call %struct.TYPE_21__* @d2i_X509_ALGOR(i32* null, i8** %3, i32 %45)
store %struct.TYPE_21__* %46, %struct.TYPE_21__** %1
br label %47
47: ; preds = %22, %39, %34, %26, %13, %2, %8
%48 = phi %struct.TYPE_22__* [ null, %8 ], [ null, %2 ], [ null, %13 ], [ %20, %26 ], [ %20, %34 ], [ %20, %39 ], [ %20, %22 ]
ret %struct.TYPE_22__* %48
}