#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_1__;

/* Type definitions */
struct TYPE_7__ {
  int /*<<< orphan*/ algorithm;
};
typedef TYPE_1__ X509_ALGOR;
typedef int /*<<< orphan*/ RSA_PSS_PARAMS;
typedef int /*<<< orphan*/ BIO;
typedef int /*<<< orphan*/ ASN1_STRING;
typedef int /*<<< orphan*/ ASN1_PCTX;

/* Variables and functions */
scalar_t__ BIO_puts(int /*<<< orphan*/ *, char *);
scalar_t__ NID_rsassaPss;
scalar_t__ OBJ_obj2nid(int /*<<< orphan*/);
int /*<<< orphan*/ RSA_PSS_PARAMS_free(int /*<<< orphan*/ *);
int /*<<< orphan*/ X509_ALGOR_free(TYPE_1__ *);
int X509_signature_dump(int /*<<< orphan*/ *, int /*<<< orphan*/ const *, int);
int /*<<< orphan*/ *rsa_pss_decode(TYPE_1__ const *, TYPE_1__ **);
int rsa_pss_param_print(int /*<<< orphan*/ *, int /*<<< orphan*/ *, TYPE_1__ *,
                        int);
int rsa_sig_print(BIO *bp, const X509_ALGOR *sigalg, const ASN1_STRING *sig,
                  int indent, ASN1_PCTX *pctx) {
  if (OBJ_obj2nid(sigalg->algorithm) == NID_rsassaPss) {
    int rv;
    RSA_PSS_PARAMS *pss;
    X509_ALGOR *maskHash;
    pss = rsa_pss_decode(sigalg, &maskHash);
    rv = rsa_pss_param_print(bp, pss, maskHash, indent);
    if (pss)
      RSA_PSS_PARAMS_free(pss);
    if (maskHash)
      X509_ALGOR_free(maskHash);
    if (!rv)
      return 0;
  } else if (!sig && BIO_puts(bp, "\n") <= 0)
    return 0;
  if (sig)
    return X509_signature_dump(bp, sig, indent);
  return 1;
}


x86 assembly (clang, -O0):
<rsa_sig_print>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    %ecx,-0x24(%rbp)
mov    %r8,-0x30(%rbp)
mov    -0x18(%rbp),%rax
mov    (%rax),%edi
call   1030 <OBJ_obj2nid@plt>
mov    0x2e4b(%rip),%rcx
cmp    (%rcx),%rax
jne    1211 <rsa_sig_print+0xa1>
mov    -0x18(%rbp),%rdi
lea    -0x48(%rbp),%rsi
call   1050 <rsa_pss_decode@plt>
mov    %rax,-0x40(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x40(%rbp),%rsi
mov    -0x48(%rbp),%rdx
mov    -0x24(%rbp),%ecx
call   1090 <rsa_pss_param_print@plt>
mov    %eax,-0x34(%rbp)
cmpq   $0x0,-0x40(%rbp)
je     11e2 <rsa_sig_print+0x72>
mov    -0x40(%rbp),%rdi
call   1040 <RSA_PSS_PARAMS_free@plt>
cmpq   $0x0,-0x48(%rbp)
je     11f6 <rsa_sig_print+0x86>
mov    -0x48(%rbp),%rdi
call   1060 <X509_ALGOR_free@plt>
cmpl   $0x0,-0x34(%rbp)
jne    120c <rsa_sig_print+0x9c>
movl   $0x0,-0x4(%rbp)
jmp    1271 <rsa_sig_print+0x101>
jmp    1247 <rsa_sig_print+0xd7>
cmpq   $0x0,-0x20(%rbp)
jne    1242 <rsa_sig_print+0xd2>
mov    -0x10(%rbp),%rdi
lea    0xdd9(%rip),%rsi
call   1070 <BIO_puts@plt>
cmp    $0x0,%rax
jg     1242 <rsa_sig_print+0xd2>
movl   $0x0,-0x4(%rbp)
jmp    1271 <rsa_sig_print+0x101>
jmp    1247 <rsa_sig_print+0xd7>
cmpq   $0x0,-0x20(%rbp)
je     126a <rsa_sig_print+0xfa>
mov    -0x10(%rbp),%rdi
mov    -0x20(%rbp),%rsi
mov    -0x24(%rbp),%edx
call   1080 <X509_signature_dump@plt>
mov    %eax,-0x4(%rbp)
jmp    1271 <rsa_sig_print+0x101>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<rsa_sig_print>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x10,%rsp
mov    %ecx,%r14d
mov    %rdx,%rbp
mov    %rsi,%rbx
mov    %rdi,%r12
mov    (%rsi),%edi
call   1030 <OBJ_obj2nid@plt>
mov    0x2e52(%rip),%rcx
cmp    (%rcx),%rax
jne    11ee <rsa_sig_print+0x7e>
lea    0x8(%rsp),%rsi
mov    %rbx,%rdi
call   1050 <rsa_pss_decode@plt>
mov    %rax,%rbx
mov    0x8(%rsp),%rdx
mov    %r12,%rdi
mov    %rax,%rsi
mov    %r14d,%ecx
call   1090 <rsa_pss_param_print@plt>
mov    %eax,%r15d
test   %rbx,%rbx
je     11ce <rsa_sig_print+0x5e>
mov    %rbx,%rdi
call   1040 <RSA_PSS_PARAMS_free@plt>
mov    0x8(%rsp),%rdi
test   %rdi,%rdi
je     11dd <rsa_sig_print+0x6d>
call   1060 <X509_ALGOR_free@plt>
test   %r15d,%r15d
je     1203 <rsa_sig_print+0x93>
test   %rbp,%rbp
jne    11f3 <rsa_sig_print+0x83>
mov    $0x1,%eax
jmp    1221 <rsa_sig_print+0xb1>
test   %rbp,%rbp
je     1207 <rsa_sig_print+0x97>
mov    %r12,%rdi
mov    %rbp,%rsi
mov    %r14d,%edx
call   1080 <X509_signature_dump@plt>
jmp    1221 <rsa_sig_print+0xb1>
xor    %eax,%eax
jmp    1221 <rsa_sig_print+0xb1>
lea    0xdf2(%rip),%rsi
mov    %r12,%rdi
call   1070 <BIO_puts@plt>
mov    %rax,%rcx
xor    %eax,%eax
test   %rcx,%rcx
setg   %al
add    $0x10,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.TYPE_7__ = type { i32 }
@NID_rsassaPss = global i64 0
@.str = [2 x i8] c"\0A\00"
define i32 @rsa_sig_print(i32* %0, %struct.TYPE_7__* %1, i32* %2, i32 %3, i32* %4) {
%6 = alloca i32
%7 = alloca i32*
%8 = alloca %struct.TYPE_7__*
%9 = alloca i32*
%10 = alloca i32
%11 = alloca i32*
%12 = alloca i32
%13 = alloca i32*
%14 = alloca %struct.TYPE_7__*
store i32* %0, i32** %7
store %struct.TYPE_7__* %1, %struct.TYPE_7__** %8
store i32* %2, i32** %9
store i32 %3, i32* %10
store i32* %4, i32** %11
%15 = load %struct.TYPE_7__*, %struct.TYPE_7__** %8
%16 = getelementptr inbounds %struct.TYPE_7__, %struct.TYPE_7__* %15, i32 0, i32 0
%17 = load i32, i32* %16
%18 = call i64 @OBJ_obj2nid(i32 %17)
%19 = load i64, i64* @NID_rsassaPss
%20 = icmp eq i64 %18, %19
br i1 %20, label %21, label %45
21: ; preds = %5
%22 = load %struct.TYPE_7__*, %struct.TYPE_7__** %8
%23 = call i32* @rsa_pss_decode(%struct.TYPE_7__* %22, %struct.TYPE_7__** %14)
store i32* %23, i32** %13
%24 = load i32*, i32** %7
%25 = load i32*, i32** %13
%26 = load %struct.TYPE_7__*, %struct.TYPE_7__** %14
%27 = load i32, i32* %10
%28 = call i32 @rsa_pss_param_print(i32* %24, i32* %25, %struct.TYPE_7__* %26, i32 %27)
store i32 %28, i32* %12
%29 = load i32*, i32** %13
%30 = icmp ne i32* %29, null
br i1 %30, label %31, label %34
31: ; preds = %21
%32 = load i32*, i32** %13
%33 = call i32 @RSA_PSS_PARAMS_free(i32* %32)
br label %34
34: ; preds = %31, %21
%35 = load %struct.TYPE_7__*, %struct.TYPE_7__** %14
%36 = icmp ne %struct.TYPE_7__* %35, null
br i1 %36, label %37, label %40
37: ; preds = %34
%38 = load %struct.TYPE_7__*, %struct.TYPE_7__** %14
%39 = call i32 @X509_ALGOR_free(%struct.TYPE_7__* %38)
br label %40
40: ; preds = %37, %34
%41 = load i32, i32* %12
%42 = icmp ne i32 %41, 0
br i1 %42, label %44, label %43
43: ; preds = %40
store i32 0, i32* %6
br label %63
44: ; preds = %40
br label %54
45: ; preds = %5
%46 = load i32*, i32** %9
%47 = icmp ne i32* %46, null
br i1 %47, label %53, label %48
48: ; preds = %45
%49 = load i32*, i32** %7
%50 = call i64 @BIO_puts(i32* %49, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%51 = icmp sle i64 %50, 0
br i1 %51, label %52, label %53
52: ; preds = %48
store i32 0, i32* %6
br label %63
53: ; preds = %48, %45
br label %54
54: ; preds = %53, %44
%55 = load i32*, i32** %9
%56 = icmp ne i32* %55, null
br i1 %56, label %57, label %62
57: ; preds = %54
%58 = load i32*, i32** %7
%59 = load i32*, i32** %9
%60 = load i32, i32* %10
%61 = call i32 @X509_signature_dump(i32* %58, i32* %59, i32 %60)
store i32 %61, i32* %6
br label %63
62: ; preds = %54
store i32 1, i32* %6
br label %63
63: ; preds = %62, %57, %52, %43
%64 = load i32, i32* %6
ret i32 %64
}

LLVM IR (-O2):
%struct.TYPE_7__ = type { i32 }
@NID_rsassaPss = global i64 0
@.str = [2 x i8] c"\0A\00"
define i32 @rsa_sig_print(i32* %0, %struct.TYPE_7__* %1, i32* %2, i32 %3, i32* nocapture readnone %4) {
%6 = alloca %struct.TYPE_7__*
%7 = getelementptr inbounds %struct.TYPE_7__, %struct.TYPE_7__* %1, i64 0, i32 0
%8 = load i32, i32* %7
%9 = tail call i64 @OBJ_obj2nid(i32 %8)
%10 = load i64, i64* @NID_rsassaPss
%11 = icmp eq i64 %9, %10
br i1 %11, label %12, label %27
12: ; preds = %5
%13 = bitcast %struct.TYPE_7__** %6 to i8*
%14 = call i32* @rsa_pss_decode(%struct.TYPE_7__* %1, %struct.TYPE_7__** %6)
%15 = load %struct.TYPE_7__*, %struct.TYPE_7__** %6
%16 = call i32 @rsa_pss_param_print(i32* %0, i32* %14, %struct.TYPE_7__* %15, i32 %3)
%17 = icmp eq i32* %14, null
br i1 %17, label %20, label %18
18: ; preds = %12
%19 = call i32 @RSA_PSS_PARAMS_free(i32* %14)
br label %20
20: ; preds = %18, %12
%21 = load %struct.TYPE_7__*, %struct.TYPE_7__** %6
%22 = icmp eq %struct.TYPE_7__* %21, null
br i1 %22, label %25, label %23
23: ; preds = %20
%24 = call i32 @X509_ALGOR_free(%struct.TYPE_7__* %21)
br label %25
25: ; preds = %23, %20
%26 = icmp eq i32 %16, 0
br i1 %26, label %37, label %33
27: ; preds = %5
%28 = icmp eq i32* %2, null
br i1 %28, label %29, label %35
29: ; preds = %27
%30 = tail call i64 @BIO_puts(i32* %0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%31 = icmp sgt i64 %30, 0
%32 = zext i1 %31 to i32
br label %37
33: ; preds = %25
%34 = icmp eq i32* %2, null
br i1 %34, label %37, label %35
35: ; preds = %27, %33
%36 = call i32 @X509_signature_dump(i32* %0, i32* %2, i32 %3)
br label %37
37: ; preds = %29, %25, %33, %35
%38 = phi i32 [ 0, %25 ], [ %36, %35 ], [ 1, %33 ], [ %32, %29 ]
ret i32 %38
}