#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*/ uint8_t;
typedef int uint;
typedef int /*<<< orphan*/ RSA;
typedef int /*<<< orphan*/ EVP_PKEY;
typedef int /*<<< orphan*/ EVP_MD_CTX;

/* Variables and functions */
int ENOMEM;
int /*<<< orphan*/ EVP_MD_CTX_cleanup(int /*<<< orphan*/ *);
int /*<<< orphan*/ *EVP_MD_CTX_create();
int /*<<< orphan*/ EVP_MD_CTX_destroy(int /*<<< orphan*/ *);
int /*<<< orphan*/ EVP_MD_CTX_init(int /*<<< orphan*/ *);
int /*<<< orphan*/ EVP_PKEY_free(int /*<<< orphan*/ *);
int /*<<< orphan*/ *EVP_PKEY_new();
int /*<<< orphan*/ EVP_PKEY_set1_RSA(int /*<<< orphan*/ *,
                                     int /*<<< orphan*/ *);
int EVP_PKEY_size(int /*<<< orphan*/ *);
int /*<<< orphan*/ EVP_SignFinal(int /*<<< orphan*/ *, int /*<<< orphan*/ *,
                                 int *, int /*<<< orphan*/ *);
int /*<<< orphan*/ EVP_SignInit(int /*<<< orphan*/ *, int /*<<< orphan*/);
int /*<<< orphan*/ EVP_SignUpdate(int /*<<< orphan*/ *, void const *,
                                  int const);
int /*<<< orphan*/ EVP_sha1();
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, int);
int /*<<< orphan*/ free(int /*<<< orphan*/ *);
int /*<<< orphan*/ *malloc(int);
int /*<<< orphan*/ printf(char *, int, int);
int rsa_err(char *);
int /*<<< orphan*/ stderr;
int rsa_sign_with_key(RSA *rsa, const void *data, const int data_size,
                      uint8_t **sigp, uint *sig_size) {
  EVP_PKEY *key;
  EVP_MD_CTX *context;
  int size, ret = 0;
  uint8_t *sig;
  key = EVP_PKEY_new();
  if (!key)
    return rsa_err("EVP_PKEY object creation failed");
  if (!EVP_PKEY_set1_RSA(key, rsa)) {
    ret = rsa_err("EVP key setup failed");
    goto err_set;
  }
  size = EVP_PKEY_size(key);
  sig = malloc(size);
  if (!sig) {
    fprintf(stderr, "Out of memory for signature (%d bytes)\n", size);
    ret = -ENOMEM;
    goto err_alloc;
  }
  context = EVP_MD_CTX_create();
  if (!context) {
    ret = rsa_err("EVP context creation failed");
    goto err_create;
  }
  EVP_MD_CTX_init(context);
  if (!EVP_SignInit(context, EVP_sha1())) {
    ret = rsa_err("Signer setup failed");
    goto err_sign;
  }
  if (!EVP_SignUpdate(context, data, data_size)) {
    ret = rsa_err("Signing data failed");
    goto err_sign;
  }
  if (!EVP_SignFinal(context, sig, sig_size, key)) {
    ret = rsa_err("Could not obtain signature");
    goto err_sign;
  }
  EVP_MD_CTX_cleanup(context);
  EVP_MD_CTX_destroy(context);
  EVP_PKEY_free(key);
  printf("Got signature: %d bytes, expected %d\n", *sig_size, size);
  *sigp = sig;
  *sig_size = size;
  return 0;
err_sign:
  EVP_MD_CTX_destroy(context);
err_create:
  free(sig);
err_alloc:
err_set:
  EVP_PKEY_free(key);
  return ret;
}


x86 assembly (clang, -O0):
<rsa_sign_with_key>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %edx,-0x1c(%rbp)
mov    %rcx,-0x28(%rbp)
mov    %r8,-0x30(%rbp)
movl   $0x0,-0x48(%rbp)
mov    $0x0,%al
call   10e0 <EVP_PKEY_new@plt>
mov    %rax,-0x38(%rbp)
cmpq   $0x0,-0x38(%rbp)
jne    125c <rsa_sign_with_key+0x4c>
lea    0xdb1(%rip),%rdi
call   1080 <rsa_err@plt>
mov    %eax,-0x4(%rbp)
jmp    1413 <rsa_sign_with_key+0x203>
mov    -0x38(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1130 <EVP_PKEY_set1_RSA@plt>
cmp    $0x0,%eax
jne    1286 <rsa_sign_with_key+0x76>
lea    0xda7(%rip),%rdi
call   1080 <rsa_err@plt>
mov    %eax,-0x48(%rbp)
jmp    1404 <rsa_sign_with_key+0x1f4>
mov    -0x38(%rbp),%rdi
call   10d0 <EVP_PKEY_size@plt>
mov    %eax,-0x44(%rbp)
mov    -0x44(%rbp),%edi
call   10a0 <malloc@plt>
mov    %rax,-0x50(%rbp)
cmpq   $0x0,-0x50(%rbp)
jne    12d4 <rsa_sign_with_key+0xc4>
mov    0x2d28(%rip),%rax
mov    (%rax),%edi
mov    -0x44(%rbp),%edx
lea    0xd79(%rip),%rsi
call   1090 <fprintf@plt>
xor    %eax,%eax
mov    0x2d16(%rip),%rcx
sub    (%rcx),%eax
mov    %eax,-0x48(%rbp)
jmp    13ff <rsa_sign_with_key+0x1ef>
mov    $0x0,%al
call   1120 <EVP_MD_CTX_create@plt>
mov    %rax,-0x40(%rbp)
cmpq   $0x0,-0x40(%rbp)
jne    12fe <rsa_sign_with_key+0xee>
lea    0xd6c(%rip),%rdi
call   1080 <rsa_err@plt>
mov    %eax,-0x48(%rbp)
jmp    13f6 <rsa_sign_with_key+0x1e6>
mov    -0x40(%rbp),%rdi
call   10c0 <EVP_MD_CTX_init@plt>
mov    -0x40(%rbp),%rax
mov    %rax,-0x58(%rbp)
mov    $0x0,%al
call   1050 <EVP_sha1@plt>
mov    -0x58(%rbp),%rdi
mov    %eax,%esi
call   10f0 <EVP_SignInit@plt>
cmp    $0x0,%eax
jne    133e <rsa_sign_with_key+0x12e>
lea    0xd48(%rip),%rdi
call   1080 <rsa_err@plt>
mov    %eax,-0x48(%rbp)
jmp    13ed <rsa_sign_with_key+0x1dd>
mov    -0x40(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x1c(%rbp),%edx
call   1100 <EVP_SignUpdate@plt>
cmp    $0x0,%eax
jne    136b <rsa_sign_with_key+0x15b>
lea    0xd2f(%rip),%rdi
call   1080 <rsa_err@plt>
mov    %eax,-0x48(%rbp)
jmp    13ed <rsa_sign_with_key+0x1dd>
mov    -0x40(%rbp),%rdi
mov    -0x50(%rbp),%rsi
mov    -0x30(%rbp),%rdx
mov    -0x38(%rbp),%rcx
call   1030 <EVP_SignFinal@plt>
cmp    $0x0,%eax
jne    139d <rsa_sign_with_key+0x18d>
lea    0xd11(%rip),%rdi
call   1080 <rsa_err@plt>
mov    %eax,-0x48(%rbp)
jmp    13ed <rsa_sign_with_key+0x1dd>
mov    -0x40(%rbp),%rdi
call   1110 <EVP_MD_CTX_cleanup@plt>
mov    -0x40(%rbp),%rdi
call   10b0 <EVP_MD_CTX_destroy@plt>
mov    -0x38(%rbp),%rdi
call   1070 <EVP_PKEY_free@plt>
mov    -0x30(%rbp),%rax
mov    (%rax),%esi
mov    -0x44(%rbp),%edx
lea    0xcf4(%rip),%rdi
call   1060 <printf@plt>
mov    -0x50(%rbp),%rcx
mov    -0x28(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x44(%rbp),%ecx
mov    -0x30(%rbp),%rax
mov    %ecx,(%rax)
movl   $0x0,-0x4(%rbp)
jmp    1413 <rsa_sign_with_key+0x203>
mov    -0x40(%rbp),%rdi
call   10b0 <EVP_MD_CTX_destroy@plt>
mov    -0x50(%rbp),%rdi
call   1040 <free@plt>
jmp    1404 <rsa_sign_with_key+0x1f4>
mov    -0x38(%rbp),%rdi
call   1070 <EVP_PKEY_free@plt>
mov    -0x48(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<rsa_sign_with_key>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %r8,%r14
mov    %rcx,%rbx
mov    %edx,%r15d
mov    %rsi,%r12
mov    %rdi,%rbp
xor    %eax,%eax
call   10e0 <EVP_PKEY_new@plt>
test   %rax,%rax
je     131d <rsa_sign_with_key+0x10d>
mov    %rax,%r13
mov    %rax,%rdi
mov    %rbp,%rsi
call   1130 <EVP_PKEY_set1_RSA@plt>
test   %eax,%eax
je     1337 <rsa_sign_with_key+0x127>
mov    %rbx,0x10(%rsp)
mov    %r13,%rdi
call   10d0 <EVP_PKEY_size@plt>
mov    %eax,%ebx
mov    %eax,%edi
call   10a0 <malloc@plt>
test   %rax,%rax
je     1347 <rsa_sign_with_key+0x137>
mov    %rax,%rbp
mov    %r14,0x8(%rsp)
xor    %eax,%eax
call   1120 <EVP_MD_CTX_create@plt>
test   %rax,%rax
je     136b <rsa_sign_with_key+0x15b>
mov    %rax,%r14
mov    %rax,%rdi
call   10c0 <EVP_MD_CTX_init@plt>
xor    %eax,%eax
call   1050 <EVP_sha1@plt>
mov    %r14,%rdi
mov    %eax,%esi
call   10f0 <EVP_SignInit@plt>
test   %eax,%eax
je     137e <rsa_sign_with_key+0x16e>
mov    %r14,%rdi
mov    %r12,%rsi
mov    %r15d,%edx
call   1100 <EVP_SignUpdate@plt>
test   %eax,%eax
je     138a <rsa_sign_with_key+0x17a>
mov    %r14,%rdi
mov    %rbp,%rsi
mov    0x8(%rsp),%r15
mov    %r15,%rdx
mov    %r13,%rcx
call   1030 <EVP_SignFinal@plt>
test   %eax,%eax
je     1396 <rsa_sign_with_key+0x186>
mov    %r14,%rdi
call   1110 <EVP_MD_CTX_cleanup@plt>
mov    %r14,%rdi
call   10b0 <EVP_MD_CTX_destroy@plt>
mov    %r13,%rdi
call   1070 <EVP_PKEY_free@plt>
mov    (%r15),%esi
lea    0xdb8(%rip),%rdi
mov    %ebx,%edx
call   1060 <printf@plt>
mov    0x10(%rsp),%rax
mov    %rbp,(%rax)
mov    %ebx,(%r15)
xor    %ebp,%ebp
jmp    13bf <rsa_sign_with_key+0x1af>
lea    0xcdc(%rip),%rdi
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1080 <rsa_err@plt>
lea    0xce2(%rip),%rdi
call   1080 <rsa_err@plt>
mov    %eax,%ebp
jmp    13b7 <rsa_sign_with_key+0x1a7>
mov    0x2c8a(%rip),%rax
mov    (%rax),%edi
lea    0xcde(%rip),%rsi
mov    %ebx,%edx
call   1090 <fprintf@plt>
mov    0x2c7b(%rip),%rax
xor    %ebp,%ebp
sub    (%rax),%ebp
jmp    13b7 <rsa_sign_with_key+0x1a7>
mov    %rbp,%r15
lea    0xce8(%rip),%rdi
call   1080 <rsa_err@plt>
mov    %eax,%ebp
jmp    13af <rsa_sign_with_key+0x19f>
mov    %rbp,%r15
lea    0xcf1(%rip),%rdi
jmp    13a0 <rsa_sign_with_key+0x190>
mov    %rbp,%r15
lea    0xcf9(%rip),%rdi
jmp    13a0 <rsa_sign_with_key+0x190>
mov    %rbp,%r15
lea    0xd01(%rip),%rdi
call   1080 <rsa_err@plt>
mov    %eax,%ebp
mov    %r14,%rdi
call   10b0 <EVP_MD_CTX_destroy@plt>
mov    %r15,%rdi
call   1040 <free@plt>
mov    %r13,%rdi
call   1070 <EVP_PKEY_free@plt>
mov    %ebp,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [32 x i8] c"EVP_PKEY object creation failed\00"
@.str.1 = [21 x i8] c"EVP key setup failed\00"
@stderr = global i32 0
@.str.2 = [40 x i8] c"Out of memory for signature (%d bytes)\0A\00"
@ENOMEM = global i32 0
@.str.3 = [28 x i8] c"EVP context creation failed\00"
@.str.4 = [20 x i8] c"Signer setup failed\00"
@.str.5 = [20 x i8] c"Signing data failed\00"
@.str.6 = [27 x i8] c"Could not obtain signature\00"
@.str.7 = [38 x i8] c"Got signature: %d bytes, expected %d\0A\00"
define i32 @rsa_sign_with_key(i32* %0, i8* %1, i32 %2, i32** %3, i32* %4) {
%6 = alloca i32
%7 = alloca i32*
%8 = alloca i8*
%9 = alloca i32
%10 = alloca i32**
%11 = alloca i32*
%12 = alloca i32*
%13 = alloca i32*
%14 = alloca i32
%15 = alloca i32
%16 = alloca i32*
store i32* %0, i32** %7
store i8* %1, i8** %8
store i32 %2, i32* %9
store i32** %3, i32*** %10
store i32* %4, i32** %11
store i32 0, i32* %15
%17 = call i32* (...) @EVP_PKEY_new()
store i32* %17, i32** %12
%18 = load i32*, i32** %12
%19 = icmp ne i32* %18, null
br i1 %19, label %22, label %20
20: ; preds = %5
%21 = call i32 @rsa_err(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0))
store i32 %21, i32* %6
br label %100
22: ; preds = %5
%23 = load i32*, i32** %12
%24 = load i32*, i32** %7
%25 = call i32 @EVP_PKEY_set1_RSA(i32* %23, i32* %24)
%26 = icmp ne i32 %25, 0
br i1 %26, label %29, label %27
27: ; preds = %22
%28 = call i32 @rsa_err(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0))
store i32 %28, i32* %15
br label %96
29: ; preds = %22
%30 = load i32*, i32** %12
%31 = call i32 @EVP_PKEY_size(i32* %30)
store i32 %31, i32* %14
%32 = load i32, i32* %14
%33 = call i32* @malloc(i32 %32)
store i32* %33, i32** %16
%34 = load i32*, i32** %16
%35 = icmp ne i32* %34, null
br i1 %35, label %42, label %36
36: ; preds = %29
%37 = load i32, i32* @stderr
%38 = load i32, i32* %14
%39 = call i32 @fprintf(i32 %37, i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.2, i64 0, i64 0), i32 %38)
%40 = load i32, i32* @ENOMEM
%41 = sub nsw i32 0, %40
store i32 %41, i32* %15
br label %95
42: ; preds = %29
%43 = call i32* (...) @EVP_MD_CTX_create()
store i32* %43, i32** %13
%44 = load i32*, i32** %13
%45 = icmp ne i32* %44, null
br i1 %45, label %48, label %46
46: ; preds = %42
%47 = call i32 @rsa_err(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.3, i64 0, i64 0))
store i32 %47, i32* %15
br label %92
48: ; preds = %42
%49 = load i32*, i32** %13
%50 = call i32 @EVP_MD_CTX_init(i32* %49)
%51 = load i32*, i32** %13
%52 = call i32 (...) @EVP_sha1()
%53 = call i32 @EVP_SignInit(i32* %51, i32 %52)
%54 = icmp ne i32 %53, 0
br i1 %54, label %57, label %55
55: ; preds = %48
%56 = call i32 @rsa_err(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.4, i64 0, i64 0))
store i32 %56, i32* %15
br label %89
57: ; preds = %48
%58 = load i32*, i32** %13
%59 = load i8*, i8** %8
%60 = load i32, i32* %9
%61 = call i32 @EVP_SignUpdate(i32* %58, i8* %59, i32 %60)
%62 = icmp ne i32 %61, 0
br i1 %62, label %65, label %63
63: ; preds = %57
%64 = call i32 @rsa_err(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.5, i64 0, i64 0))
store i32 %64, i32* %15
br label %89
65: ; preds = %57
%66 = load i32*, i32** %13
%67 = load i32*, i32** %16
%68 = load i32*, i32** %11
%69 = load i32*, i32** %12
%70 = call i32 @EVP_SignFinal(i32* %66, i32* %67, i32* %68, i32* %69)
%71 = icmp ne i32 %70, 0
br i1 %71, label %74, label %72
72: ; preds = %65
%73 = call i32 @rsa_err(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.6, i64 0, i64 0))
store i32 %73, i32* %15
br label %89
74: ; preds = %65
%75 = load i32*, i32** %13
%76 = call i32 @EVP_MD_CTX_cleanup(i32* %75)
%77 = load i32*, i32** %13
%78 = call i32 @EVP_MD_CTX_destroy(i32* %77)
%79 = load i32*, i32** %12
%80 = call i32 @EVP_PKEY_free(i32* %79)
%81 = load i32*, i32** %11
%82 = load i32, i32* %81
%83 = load i32, i32* %14
%84 = call i32 @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.7, i64 0, i64 0), i32 %82, i32 %83)
%85 = load i32*, i32** %16
%86 = load i32**, i32*** %10
store i32* %85, i32** %86
%87 = load i32, i32* %14
%88 = load i32*, i32** %11
store i32 %87, i32* %88
store i32 0, i32* %6
br label %100
89: ; preds = %72, %63, %55
%90 = load i32*, i32** %13
%91 = call i32 @EVP_MD_CTX_destroy(i32* %90)
br label %92
92: ; preds = %89, %46
%93 = load i32*, i32** %16
%94 = call i32 @free(i32* %93)
br label %95
95: ; preds = %92, %36
br label %96
96: ; preds = %95, %27
%97 = load i32*, i32** %12
%98 = call i32 @EVP_PKEY_free(i32* %97)
%99 = load i32, i32* %15
store i32 %99, i32* %6
br label %100
100: ; preds = %96, %74, %20
%101 = load i32, i32* %6
ret i32 %101
}

LLVM IR (-O2):
@.str = [32 x i8] c"EVP_PKEY object creation failed\00"
@.str.1 = [21 x i8] c"EVP key setup failed\00"
@stderr = global i32 0
@.str.2 = [40 x i8] c"Out of memory for signature (%d bytes)\0A\00"
@ENOMEM = global i32 0
@.str.3 = [28 x i8] c"EVP context creation failed\00"
@.str.4 = [20 x i8] c"Signer setup failed\00"
@.str.5 = [20 x i8] c"Signing data failed\00"
@.str.6 = [27 x i8] c"Could not obtain signature\00"
@.str.7 = [38 x i8] c"Got signature: %d bytes, expected %d\0A\00"
define i32 @rsa_sign_with_key(i32* %0, i8* %1, i32 %2, i32** nocapture writeonly %3, i32* %4) {
%6 = tail call i32* (...) @EVP_PKEY_new()
%7 = icmp eq i32* %6, null
br i1 %7, label %8, label %10
8: ; preds = %5
%9 = tail call i32 @rsa_err(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0))
br label %56
10: ; preds = %5
%11 = tail call i32 @EVP_PKEY_set1_RSA(i32* %6, i32* %0)
%12 = icmp eq i32 %11, 0
br i1 %12, label %13, label %15
13: ; preds = %10
%14 = tail call i32 @rsa_err(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0))
br label %53
15: ; preds = %10
%16 = tail call i32 @EVP_PKEY_size(i32* %6)
%17 = tail call i32* @malloc(i32 %16)
%18 = icmp eq i32* %17, null
br i1 %18, label %19, label %24
19: ; preds = %15
%20 = load i32, i32* @stderr
%21 = tail call i32 @fprintf(i32 %20, i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.2, i64 0, i64 0), i32 %16)
%22 = load i32, i32* @ENOMEM
%23 = sub nsw i32 0, %22
br label %53
24: ; preds = %15
%25 = tail call i32* (...) @EVP_MD_CTX_create()
%26 = icmp eq i32* %25, null
br i1 %26, label %27, label %29
27: ; preds = %24
%28 = tail call i32 @rsa_err(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.3, i64 0, i64 0))
br label %50
29: ; preds = %24
%30 = tail call i32 @EVP_MD_CTX_init(i32* %25)
%31 = tail call i32 (...) @EVP_sha1()
%32 = tail call i32 @EVP_SignInit(i32* %25, i32 %31)
%33 = icmp eq i32 %32, 0
br i1 %33, label %46, label %34
34: ; preds = %29
%35 = tail call i32 @EVP_SignUpdate(i32* %25, i8* %1, i32 %2)
%36 = icmp eq i32 %35, 0
br i1 %36, label %46, label %37
37: ; preds = %34
%38 = tail call i32 @EVP_SignFinal(i32* %25, i32* %17, i32* %4, i32* %6)
%39 = icmp eq i32 %38, 0
br i1 %39, label %46, label %40
40: ; preds = %37
%41 = tail call i32 @EVP_MD_CTX_cleanup(i32* %25)
%42 = tail call i32 @EVP_MD_CTX_destroy(i32* %25)
%43 = tail call i32 @EVP_PKEY_free(i32* %6)
%44 = load i32, i32* %4
%45 = tail call i32 @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.7, i64 0, i64 0), i32 %44, i32 %16)
store i32* %17, i32** %3
store i32 %16, i32* %4
br label %56
46: ; preds = %37, %34, %29
%47 = phi i8* [ getelementptr inbounds ([20 x i8], [20 x i8]* @.str.4, i64 0, i64 0), %29 ], [ getelementptr inbounds ([20 x i8], [20 x i8]* @.str.5, i64 0, i64 0), %34 ], [ getelementptr inbounds ([27 x i8], [27 x i8]* @.str.6, i64 0, i64 0), %37 ]
%48 = tail call i32 @rsa_err(i8* %47)
%49 = tail call i32 @EVP_MD_CTX_destroy(i32* %25)
br label %50
50: ; preds = %46, %27
%51 = phi i32 [ %48, %46 ], [ %28, %27 ]
%52 = tail call i32 @free(i32* %17)
br label %53
53: ; preds = %19, %50, %13
%54 = phi i32 [ %51, %50 ], [ %23, %19 ], [ %14, %13 ]
%55 = tail call i32 @EVP_PKEY_free(i32* %6)
br label %56
56: ; preds = %53, %40, %8
%57 = phi i32 [ 0, %40 ], [ %54, %53 ], [ %9, %8 ]
ret i32 %57
}