#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_private(int /*<<< orphan*/ *, int /*<<< orphan*/ *, int,
                           int /*<<< orphan*/ *);
int /*<<< orphan*/ EVP_PKEY_set1_DSA(int /*<<< orphan*/ *,
                                     int /*<<< orphan*/ *);
int DSA_print(BIO *bp, const DSA *x, int off) {
  EVP_PKEY *pk;
  int ret;
  pk = EVP_PKEY_new();
  if (!pk || !EVP_PKEY_set1_DSA(pk, (DSA *)x))
    return 0;
  ret = EVP_PKEY_print_private(bp, pk, off, NULL);
  EVP_PKEY_free(pk);
  return ret;
}


x86 assembly (clang, -O0):
<DSA_print>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %edx,-0x1c(%rbp)
mov    $0x0,%al
call   1060 <EVP_PKEY_new@plt>
mov    %rax,-0x28(%rbp)
cmpq   $0x0,-0x28(%rbp)
je     117f <DSA_print+0x3f>
mov    -0x28(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1050 <EVP_PKEY_set1_DSA@plt>
cmp    $0x0,%eax
jne    118b <DSA_print+0x4b>
movl   $0x0,-0x4(%rbp)
jmp    11b1 <DSA_print+0x71>
mov    -0x10(%rbp),%rdi
mov    -0x28(%rbp),%rsi
mov    -0x1c(%rbp),%edx
xor    %eax,%eax
mov    %eax,%ecx
call   1040 <EVP_PKEY_print_private@plt>
mov    %eax,-0x2c(%rbp)
mov    -0x28(%rbp),%rdi
call   1030 <EVP_PKEY_free@plt>
mov    -0x2c(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<DSA_print>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %edx,%r14d
mov    %rsi,%rbp
mov    %rdi,%r15
xor    %eax,%eax
call   1060 <EVP_PKEY_new@plt>
test   %rax,%rax
je     118c <DSA_print+0x4c>
mov    %rax,%rbx
mov    %rax,%rdi
mov    %rbp,%rsi
call   1050 <EVP_PKEY_set1_DSA@plt>
test   %eax,%eax
je     118c <DSA_print+0x4c>
mov    %r15,%rdi
mov    %rbx,%rsi
mov    %r14d,%edx
xor    %ecx,%ecx
call   1040 <EVP_PKEY_print_private@plt>
mov    %eax,%ebp
mov    %rbx,%rdi
call   1030 <EVP_PKEY_free@plt>
mov    %ebp,%eax
jmp    118e <DSA_print+0x4e>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

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

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