#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*/ EVP_PKEY;
typedef int /*<<< orphan*/ DSA;
typedef int /*<<< orphan*/ BIO;

/* Variables and functions */
int /*<<< orphan*/ EVP_PKEY_free(int /*<<< orphan*/ *);
int /*<<< orphan*/ *EVP_PKEY_new();
int EVP_PKEY_print_params(int /*<<< orphan*/ *, int /*<<< orphan*/ *, int,
                          int /*<<< orphan*/ *);
int /*<<< orphan*/ EVP_PKEY_set1_DSA(int /*<<< orphan*/ *,
                                     int /*<<< orphan*/ *);
int DSAparams_print(BIO *bp, const DSA *x) {
  EVP_PKEY *pk;
  int ret;
  pk = EVP_PKEY_new();
  if (!pk || !EVP_PKEY_set1_DSA(pk, (DSA *)x))
    return 0;
  ret = EVP_PKEY_print_params(bp, pk, 4, NULL);
  EVP_PKEY_free(pk);
  return ret;
}


x86 assembly (clang, -O0):
<DSAparams_print>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    $0x0,%al
call   1060 <EVP_PKEY_new@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
je     117c <DSAparams_print+0x3c>
mov    -0x20(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1050 <EVP_PKEY_set1_DSA@plt>
cmp    $0x0,%eax
jne    1188 <DSAparams_print+0x48>
movl   $0x0,-0x4(%rbp)
jmp    11b0 <DSAparams_print+0x70>
mov    -0x10(%rbp),%rdi
mov    -0x20(%rbp),%rsi
mov    $0x4,%edx
xor    %eax,%eax
mov    %eax,%ecx
call   1040 <EVP_PKEY_print_params@plt>
mov    %eax,-0x24(%rbp)
mov    -0x20(%rbp),%rdi
call   1030 <EVP_PKEY_free@plt>
mov    -0x24(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<DSAparams_print>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r15
mov    %rdi,%r14
xor    %eax,%eax
call   1060 <EVP_PKEY_new@plt>
test   %rax,%rax
je     118b <DSAparams_print+0x4b>
mov    %rax,%rbx
mov    %rax,%rdi
mov    %r15,%rsi
call   1050 <EVP_PKEY_set1_DSA@plt>
test   %eax,%eax
je     118b <DSAparams_print+0x4b>
mov    %r14,%rdi
mov    %rbx,%rsi
mov    $0x4,%edx
xor    %ecx,%ecx
call   1040 <EVP_PKEY_print_params@plt>
mov    %eax,%ebp
mov    %rbx,%rdi
call   1030 <EVP_PKEY_free@plt>
mov    %ebp,%eax
jmp    118d <DSAparams_print+0x4d>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define i32 @DSAparams_print(i32* %0, i32* %1) {
%3 = alloca i32
%4 = alloca i32*
%5 = alloca i32*
%6 = alloca i32*
%7 = alloca i32
store i32* %0, i32** %4
store i32* %1, i32** %5
%8 = call i32* (...) @EVP_PKEY_new()
store i32* %8, i32** %6
%9 = load i32*, i32** %6
%10 = icmp ne i32* %9, null
br i1 %10, label %11, label %16
11: ; preds = %2
%12 = load i32*, i32** %6
%13 = load i32*, i32** %5
%14 = call i32 @EVP_PKEY_set1_DSA(i32* %12, i32* %13)
%15 = icmp ne i32 %14, 0
br i1 %15, label %17, label %16
16: ; preds = %11, %2
store i32 0, i32* %3
br label %24
17: ; preds = %11
%18 = load i32*, i32** %4
%19 = load i32*, i32** %6
%20 = call i32 @EVP_PKEY_print_params(i32* %18, i32* %19, i32 4, i32* null)
store i32 %20, i32* %7
%21 = load i32*, i32** %6
%22 = call i32 @EVP_PKEY_free(i32* %21)
%23 = load i32, i32* %7
store i32 %23, i32* %3
br label %24
24: ; preds = %17, %16
%25 = load i32, i32* %3
ret i32 %25
}

LLVM IR (-O2):
define i32 @DSAparams_print(i32* %0, i32* %1) {
%3 = tail call i32* (...) @EVP_PKEY_new()
%4 = icmp eq i32* %3, null
br i1 %4, label %11, label %5
5: ; preds = %2
%6 = tail call i32 @EVP_PKEY_set1_DSA(i32* %3, i32* %1)
%7 = icmp eq i32 %6, 0
br i1 %7, label %11, label %8
8: ; preds = %5
%9 = tail call i32 @EVP_PKEY_print_params(i32* %0, i32* %3, i32 4, i32* null)
%10 = tail call i32 @EVP_PKEY_free(i32* %3)
br label %11
11: ; preds = %2, %5, %8
%12 = phi i32 [ %9, %8 ], [ 0, %5 ], [ 0, %2 ]
ret i32 %12
}