#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_4__ TYPE_1__;

/* Type definitions */
typedef int /*<<< orphan*/ X509_ALGOR;
struct TYPE_4__ {
  int length;
  unsigned char *data;
};
typedef int /*<<< orphan*/ PKCS8_PRIV_KEY_INFO;
typedef int /*<<< orphan*/ EVP_PKEY;
typedef int /*<<< orphan*/ BIGNUM;
typedef TYPE_1__ ASN1_OCTET_STRING;
typedef int /*<<< orphan*/ ASN1_OBJECT;
typedef int /*<<< orphan*/ ASN1_INTEGER;

/* Variables and functions */
int /*<<< orphan*/ ASN1_INTEGER_free(int /*<<< orphan*/ *);
int /*<<< orphan*/ *ASN1_INTEGER_to_BN(int /*<<< orphan*/ *,
                                       int /*<<< orphan*/ *);
int /*<<< orphan*/ ASN1_STRING_free(TYPE_1__ *);
int /*<<< orphan*/ BN_free(int /*<<< orphan*/ *);
int /*<<< orphan*/ ERR_GOST_error(int, int /*<<< orphan*/, char *, int);
int /*<<< orphan*/ EVP_R_DECODE_ERROR;
int /*<<< orphan*/ PKCS8_pkey_get0(int /*<<< orphan*/ **,
                                   unsigned char const **, int *,
                                   int /*<<< orphan*/ **, int /*<<< orphan*/ *);
unsigned char const V_ASN1_OCTET_STRING;
int /*<<< orphan*/ *d2i_ASN1_INTEGER(int /*<<< orphan*/ *,
                                     unsigned char const **, int);
TYPE_1__ *d2i_ASN1_OCTET_STRING(int /*<<< orphan*/ *, unsigned char const **,
                                int);
int /*<<< orphan*/ decode_gost_algor_params(int /*<<< orphan*/ *,
                                            int /*<<< orphan*/ *);
int /*<<< orphan*/ *getbnfrombuf(unsigned char *, int);
int gost_set_priv_key(int /*<<< orphan*/ *, int /*<<< orphan*/ *);
int priv_decode_gost(EVP_PKEY *pk, PKCS8_PRIV_KEY_INFO *p8inf) {
  const unsigned char *pkey_buf = NULL, *p = NULL;
  int priv_len = 0;
  BIGNUM *pk_num = NULL;
  int ret = 0;
  X509_ALGOR *palg = NULL;
  ASN1_OBJECT *palg_obj = NULL;
  ASN1_INTEGER *priv_key = NULL;
  if (!PKCS8_pkey_get0(&palg_obj, &pkey_buf, &priv_len, &palg, p8inf))
    return 0;
  p = pkey_buf;
  if (!decode_gost_algor_params(pk, palg)) {
    return 0;
  }
  if (V_ASN1_OCTET_STRING == *p) {
    unsigned char rev_buf[32];
    int i;
    ASN1_OCTET_STRING *s = d2i_ASN1_OCTET_STRING(NULL, &p, priv_len);
    if (!s || s->length != 32) {
      ERR_GOST_error((132), (EVP_R_DECODE_ERROR),
                     "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/"
                     "outputs/2022-01-22/02-19-57/repos/caidongyun/"
                     "nginx-openresty-windows/refs/heads/master/nginx/objs/lib/"
                     "openssl-1.0.1g/engines/ccgost/gost_ameth.c",
                     334);
      return 0;
    }
    for (i = 0; i < 32; i++) {
      rev_buf[31 - i] = s->data[i];
    }
    ASN1_STRING_free(s);
    pk_num = getbnfrombuf(rev_buf, 32);
  } else {
    priv_key = d2i_ASN1_INTEGER(NULL, &p, priv_len);
    if (!priv_key)
      return 0;
    ret = ((pk_num = ASN1_INTEGER_to_BN(priv_key, NULL)) != NULL);
    ASN1_INTEGER_free(priv_key);
    if (!ret) {
      ERR_GOST_error((132), (EVP_R_DECODE_ERROR),
                     "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/"
                     "outputs/2022-01-22/02-19-57/repos/caidongyun/"
                     "nginx-openresty-windows/refs/heads/master/nginx/objs/lib/"
                     "openssl-1.0.1g/engines/ccgost/gost_ameth.c",
                     353);
      return 0;
    }
  }
  ret = gost_set_priv_key(pk, pk_num);
  BN_free(pk_num);
  return ret;
}


x86 assembly (clang, -O0):
<priv_decode_gost>:
push   %rbp
mov    %rsp,%rbp
sub    $0x90,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
movq   $0x0,-0x20(%rbp)
movq   $0x0,-0x28(%rbp)
movl   $0x0,-0x2c(%rbp)
movq   $0x0,-0x38(%rbp)
movl   $0x0,-0x3c(%rbp)
movq   $0x0,-0x48(%rbp)
movq   $0x0,-0x50(%rbp)
movq   $0x0,-0x58(%rbp)
mov    -0x18(%rbp),%r8
lea    -0x50(%rbp),%rdi
lea    -0x20(%rbp),%rsi
lea    -0x2c(%rbp),%rdx
lea    -0x48(%rbp),%rcx
call   1080 <PKCS8_pkey_get0@plt>
cmp    $0x0,%eax
jne    122f <priv_decode_gost+0x7f>
movl   $0x0,-0x4(%rbp)
jmp    13f3 <priv_decode_gost+0x243>
mov    -0x20(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x48(%rbp),%rsi
call   10a0 <decode_gost_algor_params@plt>
cmp    $0x0,%eax
jne    1259 <priv_decode_gost+0xa9>
movl   $0x0,-0x4(%rbp)
jmp    13f3 <priv_decode_gost+0x243>
mov    0x2d78(%rip),%rax
movzbl (%rax),%eax
mov    -0x28(%rbp),%rcx
movzbl (%rcx),%ecx
cmp    %ecx,%eax
jne    1346 <priv_decode_gost+0x196>
mov    -0x2c(%rbp),%edx
xor    %eax,%eax
mov    %eax,%edi
lea    -0x28(%rbp),%rsi
call   1040 <d2i_ASN1_OCTET_STRING@plt>
mov    %rax,-0x90(%rbp)
cmpq   $0x0,-0x90(%rbp)
je     12a7 <priv_decode_gost+0xf7>
mov    -0x90(%rbp),%rax
cmpl   $0x20,(%rax)
je     12d2 <priv_decode_gost+0x122>
mov    0x2d32(%rip),%rax
mov    (%rax),%esi
mov    $0x84,%edi
lea    0xd45(%rip),%rdx
mov    $0x14e,%ecx
call   10c0 <ERR_GOST_error@plt>
movl   $0x0,-0x4(%rbp)
jmp    13f3 <priv_decode_gost+0x243>
movl   $0x0,-0x84(%rbp)
cmpl   $0x20,-0x84(%rbp)
jge    1323 <priv_decode_gost+0x173>
mov    -0x90(%rbp),%rax
mov    0x8(%rax),%rax
movslq -0x84(%rbp),%rcx
mov    (%rax,%rcx,1),%cl
mov    $0x1f,%eax
sub    -0x84(%rbp),%eax
cltq
mov    %cl,-0x80(%rbp,%rax,1)
mov    -0x84(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x84(%rbp)
jmp    12dc <priv_decode_gost+0x12c>
mov    -0x90(%rbp),%rdi
call   1060 <ASN1_STRING_free@plt>
lea    -0x80(%rbp),%rdi
mov    $0x20,%esi
call   1030 <getbnfrombuf@plt>
mov    %rax,-0x38(%rbp)
jmp    13d4 <priv_decode_gost+0x224>
mov    -0x2c(%rbp),%edx
xor    %eax,%eax
mov    %eax,%edi
lea    -0x28(%rbp),%rsi
call   10b0 <d2i_ASN1_INTEGER@plt>
mov    %rax,-0x58(%rbp)
cmpq   $0x0,-0x58(%rbp)
jne    1371 <priv_decode_gost+0x1c1>
movl   $0x0,-0x4(%rbp)
jmp    13f3 <priv_decode_gost+0x243>
mov    -0x58(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1070 <ASN1_INTEGER_to_BN@plt>
mov    %rax,-0x38(%rbp)
cmp    $0x0,%rax
setne  %al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x3c(%rbp)
mov    -0x58(%rbp),%rdi
call   10d0 <ASN1_INTEGER_free@plt>
cmpl   $0x0,-0x3c(%rbp)
jne    13cf <priv_decode_gost+0x21f>
mov    0x2c35(%rip),%rax
mov    (%rax),%esi
mov    $0x84,%edi
lea    0xc48(%rip),%rdx
mov    $0x161,%ecx
call   10c0 <ERR_GOST_error@plt>
movl   $0x0,-0x4(%rbp)
jmp    13f3 <priv_decode_gost+0x243>
jmp    13d4 <priv_decode_gost+0x224>
mov    -0x10(%rbp),%rdi
mov    -0x38(%rbp),%rsi
call   1050 <gost_set_priv_key@plt>
mov    %eax,-0x3c(%rbp)
mov    -0x38(%rbp),%rdi
call   1090 <BN_free@plt>
mov    -0x3c(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x90,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<priv_decode_gost>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x50,%rsp
mov    %rsi,%r8
mov    %rdi,%r14
movq   $0x0,0x20(%rsp)
movl   $0x0,0xc(%rsp)
movq   $0x0,0x10(%rsp)
movq   $0x0,0x28(%rsp)
lea    0x28(%rsp),%rdi
lea    0x20(%rsp),%rsi
lea    0xc(%rsp),%rdx
lea    0x10(%rsp),%rcx
call   1080 <PKCS8_pkey_get0@plt>
xor    %r13d,%r13d
test   %eax,%eax
je     134d <priv_decode_gost+0x19d>
mov    0x20(%rsp),%rbx
mov    %rbx,0x18(%rsp)
mov    0x10(%rsp),%rsi
mov    %r14,%rdi
call   10a0 <decode_gost_algor_params@plt>
test   %eax,%eax
je     134d <priv_decode_gost+0x19d>
cmpb   $0x0,(%rbx)
je     128d <priv_decode_gost+0xdd>
mov    0xc(%rsp),%edx
xor    %r13d,%r13d
lea    0x18(%rsp),%rsi
xor    %edi,%edi
call   10b0 <d2i_ASN1_INTEGER@plt>
test   %rax,%rax
je     134d <priv_decode_gost+0x19d>
mov    %rax,%r12
xor    %r13d,%r13d
mov    %rax,%rdi
xor    %esi,%esi
call   1070 <ASN1_INTEGER_to_BN@plt>
mov    %rax,%r15
mov    %r12,%rdi
call   10d0 <ASN1_INTEGER_free@plt>
test   %r15,%r15
jne    1316 <priv_decode_gost+0x166>
mov    0x2d6b(%rip),%rax
mov    (%rax),%esi
lea    0xd83(%rip),%rdx
mov    $0x84,%edi
mov    $0x161,%ecx
jmp    1348 <priv_decode_gost+0x198>
mov    0xc(%rsp),%edx
xor    %r13d,%r13d
lea    0x18(%rsp),%rsi
xor    %edi,%edi
call   1040 <d2i_ASN1_OCTET_STRING@plt>
test   %rax,%rax
je     132e <priv_decode_gost+0x17e>
cmpl   $0x20,(%rax)
jne    132e <priv_decode_gost+0x17e>
lea    0x4f(%rsp),%rcx
xor    %edx,%edx
nopl   0x0(%rax)
mov    0x8(%rax),%rsi
movzbl (%rsi,%rdx,1),%ebx
mov    %bl,(%rcx)
mov    0x8(%rax),%rsi
movzbl 0x1(%rsi,%rdx,1),%ebx
mov    %bl,-0x1(%rcx)
mov    0x8(%rax),%rsi
movzbl 0x2(%rsi,%rdx,1),%ebx
mov    %bl,-0x2(%rcx)
mov    0x8(%rax),%rsi
movzbl 0x3(%rsi,%rdx,1),%ebx
mov    %bl,-0x3(%rcx)
add    $0x4,%rdx
add    $0xfffffffffffffffc,%rcx
cmp    $0x20,%rdx
jne    12c0 <priv_decode_gost+0x110>
mov    %rax,%rdi
call   1060 <ASN1_STRING_free@plt>
lea    0x30(%rsp),%rdi
mov    $0x20,%esi
call   1030 <getbnfrombuf@plt>
mov    %rax,%r15
mov    %r14,%rdi
mov    %r15,%rsi
call   1050 <gost_set_priv_key@plt>
mov    %eax,%r13d
mov    %r15,%rdi
call   1090 <BN_free@plt>
jmp    134d <priv_decode_gost+0x19d>
mov    0x2cab(%rip),%rax
mov    (%rax),%esi
lea    0xcc3(%rip),%rdx
mov    $0x84,%edi
mov    $0x14e,%ecx
call   10c0 <ERR_GOST_error@plt>
mov    %r13d,%eax
add    $0x50,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
%struct.TYPE_4__ = type { i32, i8* }
@V_ASN1_OCTET_STRING = constant i8 0
@EVP_R_DECODE_ERROR = global i32 0
@.str = [201 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/caidongyun/nginx-openresty-windows/refs/heads/master/nginx/objs/lib/openssl-1.0.1g/engines/ccgost/gost_ameth.c\00"
define i32 @priv_decode_gost(i32* %0, i32* %1) {
%3 = alloca i32
%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 [32 x i8]
%15 = alloca i32
%16 = alloca %struct.TYPE_4__*
store i32* %0, i32** %4
store i32* %1, i32** %5
store i8* null, i8** %6
store i8* null, i8** %7
store i32 0, i32* %8
store i32* null, i32** %9
store i32 0, i32* %10
store i32* null, i32** %11
store i32* null, i32** %12
store i32* null, i32** %13
%17 = load i32*, i32** %5
%18 = call i32 @PKCS8_pkey_get0(i32** %12, i8** %6, i32* %8, i32** %11, i32* %17)
%19 = icmp ne i32 %18, 0
br i1 %19, label %21, label %20
20: ; preds = %2
store i32 0, i32* %3
br label %98
21: ; preds = %2
%22 = load i8*, i8** %6
store i8* %22, i8** %7
%23 = load i32*, i32** %4
%24 = load i32*, i32** %11
%25 = call i32 @decode_gost_algor_params(i32* %23, i32* %24)
%26 = icmp ne i32 %25, 0
br i1 %26, label %28, label %27
27: ; preds = %21
store i32 0, i32* %3
br label %98
28: ; preds = %21
%29 = load i8, i8* @V_ASN1_OCTET_STRING
%30 = zext i8 %29 to i32
%31 = load i8*, i8** %7
%32 = load i8, i8* %31
%33 = zext i8 %32 to i32
%34 = icmp eq i32 %30, %33
br i1 %34, label %35, label %72
35: ; preds = %28
%36 = load i32, i32* %8
%37 = call %struct.TYPE_4__* @d2i_ASN1_OCTET_STRING(i32* null, i8** %7, i32 %36)
store %struct.TYPE_4__* %37, %struct.TYPE_4__** %16
%38 = load %struct.TYPE_4__*, %struct.TYPE_4__** %16
%39 = icmp ne %struct.TYPE_4__* %38, null
br i1 %39, label %40, label %45
40: ; preds = %35
%41 = load %struct.TYPE_4__*, %struct.TYPE_4__** %16
%42 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %41, i32 0, i32 0
%43 = load i32, i32* %42
%44 = icmp ne i32 %43, 32
br i1 %44, label %45, label %48
45: ; preds = %40, %35
%46 = load i32, i32* @EVP_R_DECODE_ERROR
%47 = call i32 @ERR_GOST_error(i32 132, i32 %46, i8* getelementptr inbounds ([201 x i8], [201 x i8]* @.str, i64 0, i64 0), i32 334)
store i32 0, i32* %3
br label %98
48: ; preds = %40
store i32 0, i32* %15
br label %49
49: ; preds = %64, %48
%50 = load i32, i32* %15
%51 = icmp slt i32 %50, 32
br i1 %51, label %52, label %67
52: ; preds = %49
%53 = load %struct.TYPE_4__*, %struct.TYPE_4__** %16
%54 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %53, i32 0, i32 1
%55 = load i8*, i8** %54
%56 = load i32, i32* %15
%57 = sext i32 %56 to i64
%58 = getelementptr inbounds i8, i8* %55, i64 %57
%59 = load i8, i8* %58
%60 = load i32, i32* %15
%61 = sub nsw i32 31, %60
%62 = sext i32 %61 to i64
%63 = getelementptr inbounds [32 x i8], [32 x i8]* %14, i64 0, i64 %62
store i8 %59, i8* %63
br label %64
64: ; preds = %52
%65 = load i32, i32* %15
%66 = add nsw i32 %65, 1
store i32 %66, i32* %15
br label %49
67: ; preds = %49
%68 = load %struct.TYPE_4__*, %struct.TYPE_4__** %16
%69 = call i32 @ASN1_STRING_free(%struct.TYPE_4__* %68)
%70 = getelementptr inbounds [32 x i8], [32 x i8]* %14, i64 0, i64 0
%71 = call i32* @getbnfrombuf(i8* %70, i32 32)
store i32* %71, i32** %9
br label %91
72: ; preds = %28
%73 = load i32, i32* %8
%74 = call i32* @d2i_ASN1_INTEGER(i32* null, i8** %7, i32 %73)
store i32* %74, i32** %13
%75 = load i32*, i32** %13
%76 = icmp ne i32* %75, null
br i1 %76, label %78, label %77
77: ; preds = %72
store i32 0, i32* %3
br label %98
78: ; preds = %72
%79 = load i32*, i32** %13
%80 = call i32* @ASN1_INTEGER_to_BN(i32* %79, i32* null)
store i32* %80, i32** %9
%81 = icmp ne i32* %80, null
%82 = zext i1 %81 to i32
store i32 %82, i32* %10
%83 = load i32*, i32** %13
%84 = call i32 @ASN1_INTEGER_free(i32* %83)
%85 = load i32, i32* %10
%86 = icmp ne i32 %85, 0
br i1 %86, label %90, label %87
87: ; preds = %78
%88 = load i32, i32* @EVP_R_DECODE_ERROR
%89 = call i32 @ERR_GOST_error(i32 132, i32 %88, i8* getelementptr inbounds ([201 x i8], [201 x i8]* @.str, i64 0, i64 0), i32 353)
store i32 0, i32* %3
br label %98
90: ; preds = %78
br label %91
91: ; preds = %90, %67
%92 = load i32*, i32** %4
%93 = load i32*, i32** %9
%94 = call i32 @gost_set_priv_key(i32* %92, i32* %93)
store i32 %94, i32* %10
%95 = load i32*, i32** %9
%96 = call i32 @BN_free(i32* %95)
%97 = load i32, i32* %10
store i32 %97, i32* %3
br label %98
98: ; preds = %91, %87, %77, %45, %27, %20
%99 = load i32, i32* %3
ret i32 %99
}

LLVM IR (-O2):
%struct.TYPE_4__ = type { i32, i8* }
@V_ASN1_OCTET_STRING = constant i8 0
@EVP_R_DECODE_ERROR = global i32 0
@.str = [201 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/caidongyun/nginx-openresty-windows/refs/heads/master/nginx/objs/lib/openssl-1.0.1g/engines/ccgost/gost_ameth.c\00"
define i32 @priv_decode_gost(i32* %0, i32* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i32*
%7 = alloca i32*
%8 = alloca [32 x i8]
%9 = bitcast i8** %3 to i8*
store i8* null, i8** %3
%10 = bitcast i8** %4 to i8*
%11 = bitcast i32* %5 to i8*
store i32 0, i32* %5
%12 = bitcast i32** %6 to i8*
store i32* null, i32** %6
%13 = bitcast i32** %7 to i8*
store i32* null, i32** %7
%14 = call i32 @PKCS8_pkey_get0(i32** %7, i8** %3, i32* %5, i32** %6, i32* %1)
%15 = icmp eq i32 %14, 0
br i1 %15, label %83, label %16
16: ; preds = %2
%17 = load i8*, i8** %3
store i8* %17, i8** %4
%18 = load i32*, i32** %6
%19 = call i32 @decode_gost_algor_params(i32* %0, i32* %18)
%20 = icmp eq i32 %19, 0
br i1 %20, label %83, label %21
21: ; preds = %16
%22 = load i8, i8* %17
%23 = icmp eq i8 %22, 0
br i1 %23, label %24, label %68
24: ; preds = %21
%25 = getelementptr inbounds [32 x i8], [32 x i8]* %8, i64 0, i64 0
%26 = load i32, i32* %5
%27 = call %struct.TYPE_4__* @d2i_ASN1_OCTET_STRING(i32* null, i8** %4, i32 %26)
%28 = icmp eq %struct.TYPE_4__* %27, null
br i1 %28, label %65, label %29
29: ; preds = %24
%30 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %27, i64 0, i32 0
%31 = load i32, i32* %30
%32 = icmp eq i32 %31, 32
br i1 %32, label %33, label %65
33: ; preds = %29
%34 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %27, i64 0, i32 1
br label %35
35: ; preds = %35, %33
%36 = phi i64 [ 0, %33 ], [ %60, %35 ]
%37 = load i8*, i8** %34
%38 = getelementptr inbounds i8, i8* %37, i64 %36
%39 = load i8, i8* %38
%40 = sub nuw nsw i64 31, %36
%41 = getelementptr inbounds [32 x i8], [32 x i8]* %8, i64 0, i64 %40
store i8 %39, i8* %41
%42 = or i64 %36, 1
%43 = load i8*, i8** %34
%44 = getelementptr inbounds i8, i8* %43, i64 %42
%45 = load i8, i8* %44
%46 = sub nsw i64 30, %36
%47 = getelementptr inbounds [32 x i8], [32 x i8]* %8, i64 0, i64 %46
store i8 %45, i8* %47
%48 = or i64 %36, 2
%49 = load i8*, i8** %34
%50 = getelementptr inbounds i8, i8* %49, i64 %48
%51 = load i8, i8* %50
%52 = sub nsw i64 29, %36
%53 = getelementptr inbounds [32 x i8], [32 x i8]* %8, i64 0, i64 %52
store i8 %51, i8* %53
%54 = or i64 %36, 3
%55 = load i8*, i8** %34
%56 = getelementptr inbounds i8, i8* %55, i64 %54
%57 = load i8, i8* %56
%58 = sub nsw i64 28, %36
%59 = getelementptr inbounds [32 x i8], [32 x i8]* %8, i64 0, i64 %58
store i8 %57, i8* %59
%60 = add nuw nsw i64 %36, 4
%61 = icmp eq i64 %60, 32
br i1 %61, label %62, label %35
62: ; preds = %35
%63 = call i32 @ASN1_STRING_free(%struct.TYPE_4__* %27)
%64 = call i32* @getbnfrombuf(i8* %25, i32 32)
br label %79
65: ; preds = %24, %29
%66 = load i32, i32* @EVP_R_DECODE_ERROR
%67 = call i32 @ERR_GOST_error(i32 132, i32 %66, i8* getelementptr inbounds ([201 x i8], [201 x i8]* @.str, i64 0, i64 0), i32 334)
br label %83
68: ; preds = %21
%69 = load i32, i32* %5
%70 = call i32* @d2i_ASN1_INTEGER(i32* null, i8** %4, i32 %69)
%71 = icmp eq i32* %70, null
br i1 %71, label %83, label %72
72: ; preds = %68
%73 = call i32* @ASN1_INTEGER_to_BN(i32* %70, i32* null)
%74 = icmp eq i32* %73, null
%75 = call i32 @ASN1_INTEGER_free(i32* %70)
br i1 %74, label %76, label %79
76: ; preds = %72
%77 = load i32, i32* @EVP_R_DECODE_ERROR
%78 = call i32 @ERR_GOST_error(i32 132, i32 %77, i8* getelementptr inbounds ([201 x i8], [201 x i8]* @.str, i64 0, i64 0), i32 353)
br label %83
79: ; preds = %62, %72
%80 = phi i32* [ %73, %72 ], [ %64, %62 ]
%81 = call i32 @gost_set_priv_key(i32* %0, i32* %80)
%82 = call i32 @BN_free(i32* %80)
br label %83
83: ; preds = %65, %68, %16, %2, %79, %76
%84 = phi i32 [ %81, %79 ], [ 0, %65 ], [ 0, %76 ], [ 0, %2 ], [ 0, %16 ], [ 0, %68 ]
ret i32 %84
}