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

/* Variables and functions */
int /*<<< orphan*/ BIO_free(int /*<<< orphan*/ *);
int /*<<< orphan*/ *BIO_new_mem_buf(char *, int /*<<< orphan*/);
int /*<<< orphan*/ BIO_reset(int /*<<< orphan*/ *);
scalar_t__ EC_GROUP_cmp(int /*<<< orphan*/, int /*<<< orphan*/,
                        int /*<<< orphan*/ *);
int /*<<< orphan*/ EC_KEY_copy(int /*<<< orphan*/ *, int /*<<< orphan*/ *);
int /*<<< orphan*/ EC_KEY_free(int /*<<< orphan*/ *);
int /*<<< orphan*/ EC_KEY_get0_group(int /*<<< orphan*/ *);
int /*<<< orphan*/ *EC_KEY_new_by_curve_name(int /*<<< orphan*/);
int /*<<< orphan*/ *EVP_PKCS82PKEY(int /*<<< orphan*/ *);
int /*<<< orphan*/ EVP_PKEY_free(int /*<<< orphan*/ *);
int /*<<< orphan*/ *EVP_PKEY_get1_EC_KEY(int /*<<< orphan*/ *);
int /*<<< orphan*/ NID_secp256k1;
int /*<<< orphan*/ *PEM_read_bio_PKCS8(int /*<<< orphan*/ *,
                                       int /*<<< orphan*/ *,
                                       int /*<<< orphan*/ *,
                                       int /*<<< orphan*/ *);
int /*<<< orphan*/ *PEM_read_bio_PKCS8_PRIV_KEY_INFO(int /*<<< orphan*/ *,
                                                     int /*<<< orphan*/ *,
                                                     int /*<<< orphan*/ *,
                                                     int /*<<< orphan*/ *);
int /*<<< orphan*/ PKCS8_PRIV_KEY_INFO_free(int /*<<< orphan*/ *);
int /*<<< orphan*/ *PKCS8_decrypt(int /*<<< orphan*/ *, char const *,
                                  int /*<<< orphan*/);
int /*<<< orphan*/ X509_SIG_free(int /*<<< orphan*/ *);
int /*<<< orphan*/ strlen(char const *);
int vg_pkcs8_decode_privkey(EC_KEY *pkey, const char *pem_in,
                            const char *pass) {
  EC_KEY *pkey_in = NULL;
  EC_KEY *test_key = NULL;
  EVP_PKEY *evp_key = NULL;
  PKCS8_PRIV_KEY_INFO *pkcs8 = NULL;
  X509_SIG *pkcs8_enc = NULL;
  BIO *bio = NULL;
  int res = 0;
  bio = BIO_new_mem_buf((char *)pem_in, strlen(pem_in));
  if (!bio)
    goto out;
  pkcs8_enc = PEM_read_bio_PKCS8(bio, NULL, NULL, NULL);
  if (pkcs8_enc) {
    if (!pass)
      return -1;
    pkcs8 = PKCS8_decrypt(pkcs8_enc, pass, strlen(pass));
  } else {
    (void)BIO_reset(bio);
    pkcs8 = PEM_read_bio_PKCS8_PRIV_KEY_INFO(bio, NULL, NULL, NULL);
  }
  if (!pkcs8)
    goto out;
  evp_key = EVP_PKCS82PKEY(pkcs8);
  if (!evp_key)
    goto out;
  pkey_in = EVP_PKEY_get1_EC_KEY(evp_key);
  if (!pkey_in)
    goto out;
  test_key = EC_KEY_new_by_curve_name(NID_secp256k1);
  if (!test_key || EC_GROUP_cmp(EC_KEY_get0_group(pkey_in),
                                EC_KEY_get0_group(test_key), NULL))
    goto out;
  if (!EC_KEY_copy(pkey, pkey_in))
    goto out;
  res = 1;
out:
  if (bio)
    BIO_free(bio);
  if (test_key)
    EC_KEY_free(pkey_in);
  if (evp_key)
    EVP_PKEY_free(evp_key);
  if (pkcs8)
    PKCS8_PRIV_KEY_INFO_free(pkcs8);
  if (pkcs8_enc)
    X509_SIG_free(pkcs8_enc);
  return res;
}


x86 assembly (clang, -O0):
<vg_pkcs8_decode_privkey>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
movq   $0x0,-0x28(%rbp)
movq   $0x0,-0x30(%rbp)
movq   $0x0,-0x38(%rbp)
movq   $0x0,-0x40(%rbp)
movq   $0x0,-0x48(%rbp)
movq   $0x0,-0x50(%rbp)
movl   $0x0,-0x54(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x60(%rbp)
mov    -0x18(%rbp),%rdi
call   1040 <strlen@plt>
mov    -0x60(%rbp),%rdi
mov    %eax,%esi
call   1090 <BIO_new_mem_buf@plt>
mov    %rax,-0x50(%rbp)
cmpq   $0x0,-0x50(%rbp)
jne    128e <vg_pkcs8_decode_privkey+0x7e>
jmp    13d3 <vg_pkcs8_decode_privkey+0x1c3>
mov    -0x50(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%ecx
mov    %rcx,%rsi
mov    %rcx,%rdx
call   1110 <PEM_read_bio_PKCS8@plt>
mov    %rax,-0x48(%rbp)
cmpq   $0x0,-0x48(%rbp)
je     12f8 <vg_pkcs8_decode_privkey+0xe8>
cmpq   $0x0,-0x20(%rbp)
jne    12c7 <vg_pkcs8_decode_privkey+0xb7>
movl   $0xffffffff,-0x4(%rbp)
jmp    143d <vg_pkcs8_decode_privkey+0x22d>
mov    -0x48(%rbp),%rax
mov    %rax,-0x70(%rbp)
mov    -0x20(%rbp),%rax
mov    %rax,-0x68(%rbp)
mov    -0x20(%rbp),%rdi
call   1040 <strlen@plt>
mov    -0x70(%rbp),%rdi
mov    -0x68(%rbp),%rsi
mov    %eax,%edx
call   1030 <PKCS8_decrypt@plt>
mov    %rax,-0x40(%rbp)
jmp    1318 <vg_pkcs8_decode_privkey+0x108>
mov    -0x50(%rbp),%rdi
call   1100 <BIO_reset@plt>
mov    -0x50(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%ecx
mov    %rcx,%rsi
mov    %rcx,%rdx
call   10b0 <PEM_read_bio_PKCS8_PRIV_KEY_INFO@plt>
mov    %rax,-0x40(%rbp)
cmpq   $0x0,-0x40(%rbp)
jne    1328 <vg_pkcs8_decode_privkey+0x118>
jmp    13d3 <vg_pkcs8_decode_privkey+0x1c3>
mov    -0x40(%rbp),%rdi
call   10e0 <EVP_PKCS82PKEY@plt>
mov    %rax,-0x38(%rbp)
cmpq   $0x0,-0x38(%rbp)
jne    1345 <vg_pkcs8_decode_privkey+0x135>
jmp    13d3 <vg_pkcs8_decode_privkey+0x1c3>
mov    -0x38(%rbp),%rdi
call   1070 <EVP_PKEY_get1_EC_KEY@plt>
mov    %rax,-0x28(%rbp)
cmpq   $0x0,-0x28(%rbp)
jne    1362 <vg_pkcs8_decode_privkey+0x152>
jmp    13d3 <vg_pkcs8_decode_privkey+0x1c3>
mov    0x2c77(%rip),%rax
mov    (%rax),%edi
call   1130 <EC_KEY_new_by_curve_name@plt>
mov    %rax,-0x30(%rbp)
cmpq   $0x0,-0x30(%rbp)
je     13ac <vg_pkcs8_decode_privkey+0x19c>
mov    -0x28(%rbp),%rdi
call   10a0 <EC_KEY_get0_group@plt>
mov    %eax,-0x74(%rbp)
mov    -0x30(%rbp),%rdi
call   10a0 <EC_KEY_get0_group@plt>
mov    -0x74(%rbp),%edi
mov    %eax,%esi
xor    %eax,%eax
mov    %eax,%edx
call   1120 <EC_GROUP_cmp@plt>
cmp    $0x0,%rax
je     13b1 <vg_pkcs8_decode_privkey+0x1a1>
jmp    13d3 <vg_pkcs8_decode_privkey+0x1c3>
mov    -0x10(%rbp),%rdi
mov    -0x28(%rbp),%rsi
call   1080 <EC_KEY_copy@plt>
cmp    $0x0,%eax
jne    13cc <vg_pkcs8_decode_privkey+0x1bc>
jmp    13d3 <vg_pkcs8_decode_privkey+0x1c3>
movl   $0x1,-0x54(%rbp)
cmpq   $0x0,-0x50(%rbp)
je     13e7 <vg_pkcs8_decode_privkey+0x1d7>
mov    -0x50(%rbp),%rdi
call   10c0 <BIO_free@plt>
cmpq   $0x0,-0x30(%rbp)
je     13fb <vg_pkcs8_decode_privkey+0x1eb>
mov    -0x28(%rbp),%rdi
call   10d0 <EC_KEY_free@plt>
cmpq   $0x0,-0x38(%rbp)
je     140f <vg_pkcs8_decode_privkey+0x1ff>
mov    -0x38(%rbp),%rdi
call   1050 <EVP_PKEY_free@plt>
cmpq   $0x0,-0x40(%rbp)
je     1423 <vg_pkcs8_decode_privkey+0x213>
mov    -0x40(%rbp),%rdi
call   10f0 <PKCS8_PRIV_KEY_INFO_free@plt>
cmpq   $0x0,-0x48(%rbp)
je     1437 <vg_pkcs8_decode_privkey+0x227>
mov    -0x48(%rbp),%rdi
call   1060 <X509_SIG_free@plt>
mov    -0x54(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<vg_pkcs8_decode_privkey>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %rdx,%rbp
mov    %rsi,%rbx
mov    %rdi,%r15
mov    %rsi,%rdi
call   1040 <strlen@plt>
mov    %rbx,%rdi
mov    %eax,%esi
call   1090 <BIO_new_mem_buf@plt>
test   %rax,%rax
je     1277 <vg_pkcs8_decode_privkey+0x67>
mov    %rax,%rbx
mov    %rax,%rdi
xor    %esi,%esi
xor    %edx,%edx
xor    %ecx,%ecx
call   1110 <PEM_read_bio_PKCS8@plt>
mov    %rax,%r14
test   %rax,%rax
je     127e <vg_pkcs8_decode_privkey+0x6e>
test   %rbp,%rbp
je     134f <vg_pkcs8_decode_privkey+0x13f>
mov    %rbp,%rdi
call   1040 <strlen@plt>
mov    %r14,%rdi
mov    %rbp,%rsi
mov    %eax,%edx
call   1030 <PKCS8_decrypt@plt>
jmp    1294 <vg_pkcs8_decode_privkey+0x84>
xor    %ebp,%ebp
jmp    1389 <vg_pkcs8_decode_privkey+0x179>
mov    %rbx,%rdi
call   1100 <BIO_reset@plt>
mov    %rbx,%rdi
xor    %esi,%esi
xor    %edx,%edx
xor    %ecx,%ecx
call   10b0 <PEM_read_bio_PKCS8_PRIV_KEY_INFO@plt>
mov    %rax,%r12
test   %rax,%rax
je     133e <vg_pkcs8_decode_privkey+0x12e>
mov    %r12,%rdi
call   10e0 <EVP_PKCS82PKEY@plt>
test   %rax,%rax
je     136a <vg_pkcs8_decode_privkey+0x15a>
mov    %rax,%r13
mov    %rax,%rdi
call   1070 <EVP_PKEY_get1_EC_KEY@plt>
test   %rax,%rax
je     1356 <vg_pkcs8_decode_privkey+0x146>
mov    %r15,0x10(%rsp)
mov    %rax,%r15
mov    0x2d0c(%rip),%rax
mov    (%rax),%edi
call   1130 <EC_KEY_new_by_curve_name@plt>
mov    %r15,%rdi
mov    0x10(%rsp),%r15
test   %rax,%rax
je     1356 <vg_pkcs8_decode_privkey+0x146>
mov    %rax,%rbp
mov    %rdi,0x8(%rsp)
call   10a0 <EC_KEY_get0_group@plt>
mov    %eax,0x4(%rsp)
mov    %rbp,%rdi
call   10a0 <EC_KEY_get0_group@plt>
xor    %ebp,%ebp
mov    0x4(%rsp),%edi
mov    %eax,%esi
xor    %edx,%edx
call   1120 <EC_GROUP_cmp@plt>
test   %rax,%rax
jne    132a <vg_pkcs8_decode_privkey+0x11a>
mov    %r15,%rdi
mov    0x8(%rsp),%rsi
call   1080 <EC_KEY_copy@plt>
xor    %ebp,%ebp
test   %eax,%eax
setne  %bpl
mov    %rbx,%rdi
call   10c0 <BIO_free@plt>
mov    0x8(%rsp),%rdi
call   10d0 <EC_KEY_free@plt>
jmp    1360 <vg_pkcs8_decode_privkey+0x150>
mov    %rbx,%rdi
call   10c0 <BIO_free@plt>
xor    %ebp,%ebp
test   %r14,%r14
jne    1381 <vg_pkcs8_decode_privkey+0x171>
jmp    1389 <vg_pkcs8_decode_privkey+0x179>
mov    $0xffffffff,%ebp
jmp    1389 <vg_pkcs8_decode_privkey+0x179>
mov    %rbx,%rdi
call   10c0 <BIO_free@plt>
xor    %ebp,%ebp
mov    %r13,%rdi
call   1050 <EVP_PKEY_free@plt>
jmp    1374 <vg_pkcs8_decode_privkey+0x164>
mov    %rbx,%rdi
call   10c0 <BIO_free@plt>
xor    %ebp,%ebp
mov    %r12,%rdi
call   10f0 <PKCS8_PRIV_KEY_INFO_free@plt>
test   %r14,%r14
je     1389 <vg_pkcs8_decode_privkey+0x179>
mov    %r14,%rdi
call   1060 <X509_SIG_free@plt>
mov    %ebp,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@NID_secp256k1 = global i32 0
define i32 @vg_pkcs8_decode_privkey(i32* %0, i8* %1, i8* %2) {
%4 = alloca i32
%5 = alloca i32*
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i32*
%9 = alloca i32*
%10 = alloca i32*
%11 = alloca i32*
%12 = alloca i32*
%13 = alloca i32*
%14 = alloca i32
store i32* %0, i32** %5
store i8* %1, i8** %6
store i8* %2, i8** %7
store i32* null, i32** %8
store i32* null, i32** %9
store i32* null, i32** %10
store i32* null, i32** %11
store i32* null, i32** %12
store i32* null, i32** %13
store i32 0, i32* %14
%15 = load i8*, i8** %6
%16 = load i8*, i8** %6
%17 = call i32 @strlen(i8* %16)
%18 = call i32* @BIO_new_mem_buf(i8* %15, i32 %17)
store i32* %18, i32** %13
%19 = load i32*, i32** %13
%20 = icmp ne i32* %19, null
br i1 %20, label %22, label %21
21: ; preds = %3
br label %78
22: ; preds = %3
%23 = load i32*, i32** %13
%24 = call i32* @PEM_read_bio_PKCS8(i32* %23, i32* null, i32* null, i32* null)
store i32* %24, i32** %12
%25 = load i32*, i32** %12
%26 = icmp ne i32* %25, null
br i1 %26, label %27, label %37
27: ; preds = %22
%28 = load i8*, i8** %7
%29 = icmp ne i8* %28, null
br i1 %29, label %31, label %30
30: ; preds = %27
store i32 -1, i32* %4
br label %110
31: ; preds = %27
%32 = load i32*, i32** %12
%33 = load i8*, i8** %7
%34 = load i8*, i8** %7
%35 = call i32 @strlen(i8* %34)
%36 = call i32* @PKCS8_decrypt(i32* %32, i8* %33, i32 %35)
store i32* %36, i32** %11
br label %42
37: ; preds = %22
%38 = load i32*, i32** %13
%39 = call i32 @BIO_reset(i32* %38)
%40 = load i32*, i32** %13
%41 = call i32* @PEM_read_bio_PKCS8_PRIV_KEY_INFO(i32* %40, i32* null, i32* null, i32* null)
store i32* %41, i32** %11
br label %42
42: ; preds = %37, %31
%43 = load i32*, i32** %11
%44 = icmp ne i32* %43, null
br i1 %44, label %46, label %45
45: ; preds = %42
br label %78
46: ; preds = %42
%47 = load i32*, i32** %11
%48 = call i32* @EVP_PKCS82PKEY(i32* %47)
store i32* %48, i32** %10
%49 = load i32*, i32** %10
%50 = icmp ne i32* %49, null
br i1 %50, label %52, label %51
51: ; preds = %46
br label %78
52: ; preds = %46
%53 = load i32*, i32** %10
%54 = call i32* @EVP_PKEY_get1_EC_KEY(i32* %53)
store i32* %54, i32** %8
%55 = load i32*, i32** %8
%56 = icmp ne i32* %55, null
br i1 %56, label %58, label %57
57: ; preds = %52
br label %78
58: ; preds = %52
%59 = load i32, i32* @NID_secp256k1
%60 = call i32* @EC_KEY_new_by_curve_name(i32 %59)
store i32* %60, i32** %9
%61 = load i32*, i32** %9
%62 = icmp ne i32* %61, null
br i1 %62, label %63, label %70
63: ; preds = %58
%64 = load i32*, i32** %8
%65 = call i32 @EC_KEY_get0_group(i32* %64)
%66 = load i32*, i32** %9
%67 = call i32 @EC_KEY_get0_group(i32* %66)
%68 = call i64 @EC_GROUP_cmp(i32 %65, i32 %67, i32* null)
%69 = icmp ne i64 %68, 0
br i1 %69, label %70, label %71
70: ; preds = %63, %58
br label %78
71: ; preds = %63
%72 = load i32*, i32** %5
%73 = load i32*, i32** %8
%74 = call i32 @EC_KEY_copy(i32* %72, i32* %73)
%75 = icmp ne i32 %74, 0
br i1 %75, label %77, label %76
76: ; preds = %71
br label %78
77: ; preds = %71
store i32 1, i32* %14
br label %78
78: ; preds = %77, %76, %70, %57, %51, %45, %21
%79 = load i32*, i32** %13
%80 = icmp ne i32* %79, null
br i1 %80, label %81, label %84
81: ; preds = %78
%82 = load i32*, i32** %13
%83 = call i32 @BIO_free(i32* %82)
br label %84
84: ; preds = %81, %78
%85 = load i32*, i32** %9
%86 = icmp ne i32* %85, null
br i1 %86, label %87, label %90
87: ; preds = %84
%88 = load i32*, i32** %8
%89 = call i32 @EC_KEY_free(i32* %88)
br label %90
90: ; preds = %87, %84
%91 = load i32*, i32** %10
%92 = icmp ne i32* %91, null
br i1 %92, label %93, label %96
93: ; preds = %90
%94 = load i32*, i32** %10
%95 = call i32 @EVP_PKEY_free(i32* %94)
br label %96
96: ; preds = %93, %90
%97 = load i32*, i32** %11
%98 = icmp ne i32* %97, null
br i1 %98, label %99, label %102
99: ; preds = %96
%100 = load i32*, i32** %11
%101 = call i32 @PKCS8_PRIV_KEY_INFO_free(i32* %100)
br label %102
102: ; preds = %99, %96
%103 = load i32*, i32** %12
%104 = icmp ne i32* %103, null
br i1 %104, label %105, label %108
105: ; preds = %102
%106 = load i32*, i32** %12
%107 = call i32 @X509_SIG_free(i32* %106)
br label %108
108: ; preds = %105, %102
%109 = load i32, i32* %14
store i32 %109, i32* %4
br label %110
110: ; preds = %108, %30
%111 = load i32, i32* %4
ret i32 %111
}

LLVM IR (-O2):
@NID_secp256k1 = global i32 0
define i32 @vg_pkcs8_decode_privkey(i32* %0, i8* %1, i8* %2) {
%4 = tail call i32 @strlen(i8* %1)
%5 = tail call i32* @BIO_new_mem_buf(i8* %1, i32 %4)
%6 = icmp eq i32* %5, null
br i1 %6, label %60, label %7
7: ; preds = %3
%8 = tail call i32* @PEM_read_bio_PKCS8(i32* %5, i32* null, i32* null, i32* null)
%9 = icmp eq i32* %8, null
br i1 %9, label %15, label %10
10: ; preds = %7
%11 = icmp eq i8* %2, null
br i1 %11, label %60, label %12
12: ; preds = %10
%13 = tail call i32 @strlen(i8* %2)
%14 = tail call i32* @PKCS8_decrypt(i32* %8, i8* %2, i32 %13)
br label %18
15: ; preds = %7
%16 = tail call i32 @BIO_reset(i32* %5)
%17 = tail call i32* @PEM_read_bio_PKCS8_PRIV_KEY_INFO(i32* %5, i32* null, i32* null, i32* null)
br label %18
18: ; preds = %15, %12
%19 = phi i32* [ %14, %12 ], [ %17, %15 ]
%20 = icmp eq i32* %19, null
br i1 %20, label %21, label %23
21: ; preds = %18
%22 = tail call i32 @BIO_free(i32* %5)
br label %56
23: ; preds = %18
%24 = tail call i32* @EVP_PKCS82PKEY(i32* %19)
%25 = icmp eq i32* %24, null
br i1 %25, label %51, label %26
26: ; preds = %23
%27 = tail call i32* @EVP_PKEY_get1_EC_KEY(i32* %24)
%28 = icmp eq i32* %27, null
br i1 %28, label %46, label %29
29: ; preds = %26
%30 = load i32, i32* @NID_secp256k1
%31 = tail call i32* @EC_KEY_new_by_curve_name(i32 %30)
%32 = icmp eq i32* %31, null
br i1 %32, label %46, label %33
33: ; preds = %29
%34 = tail call i32 @EC_KEY_get0_group(i32* %27)
%35 = tail call i32 @EC_KEY_get0_group(i32* %31)
%36 = tail call i64 @EC_GROUP_cmp(i32 %34, i32 %35, i32* null)
%37 = icmp eq i64 %36, 0
br i1 %37, label %38, label %42
38: ; preds = %33
%39 = tail call i32 @EC_KEY_copy(i32* %0, i32* %27)
%40 = icmp ne i32 %39, 0
%41 = zext i1 %40 to i32
br label %42
42: ; preds = %33, %38
%43 = phi i32 [ %41, %38 ], [ 0, %33 ]
%44 = tail call i32 @BIO_free(i32* %5)
%45 = tail call i32 @EC_KEY_free(i32* %27)
br label %48
46: ; preds = %26, %29
%47 = tail call i32 @BIO_free(i32* %5)
br label %48
48: ; preds = %42, %46
%49 = phi i32 [ %43, %42 ], [ 0, %46 ]
%50 = tail call i32 @EVP_PKEY_free(i32* %24)
br label %53
51: ; preds = %23
%52 = tail call i32 @BIO_free(i32* %5)
br label %53
53: ; preds = %51, %48
%54 = phi i32 [ %49, %48 ], [ 0, %51 ]
%55 = tail call i32 @PKCS8_PRIV_KEY_INFO_free(i32* %19)
br label %56
56: ; preds = %21, %53
%57 = phi i32 [ %54, %53 ], [ 0, %21 ]
br i1 %9, label %60, label %58
58: ; preds = %56
%59 = tail call i32 @X509_SIG_free(i32* %8)
br label %60
60: ; preds = %3, %56, %58, %10
%61 = phi i32 [ -1, %10 ], [ %57, %58 ], [ %57, %56 ], [ 0, %3 ]
ret i32 %61
}