#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*/ EC_POINT;
typedef int /*<<< orphan*/ EC_KEY;
typedef int /*<<< orphan*/ EC_GROUP;
typedef int /*<<< orphan*/ BN_CTX;
typedef int /*<<< orphan*/ BIO;
typedef int /*<<< orphan*/ BIGNUM;
typedef int /*<<< orphan*/ ASN1_PCTX;

/* Variables and functions */
int /*<<< orphan*/ BIO_indent(int /*<<< orphan*/ *, int, int);
int /*<<< orphan*/ BIO_printf(int /*<<< orphan*/ *, char *, ...);
int /*<<< orphan*/ BN_CTX_end(int /*<<< orphan*/ *);
int /*<<< orphan*/ BN_CTX_free(int /*<<< orphan*/ *);
int /*<<< orphan*/ *BN_CTX_get(int /*<<< orphan*/ *);
int /*<<< orphan*/ *BN_CTX_new();
int /*<<< orphan*/ BN_CTX_start(int /*<<< orphan*/ *);
int /*<<< orphan*/ BN_print(int /*<<< orphan*/ *, int /*<<< orphan*/ *);
int EC_GROUP_get_curve_name(int /*<<< orphan*/ *);
int /*<<< orphan*/ *EC_KEY_get0_group(int /*<<< orphan*/ *);
int /*<<< orphan*/ *EC_KEY_get0_public_key(int /*<<< orphan*/ *);
int /*<<< orphan*/ EC_POINT_get_affine_coordinates_GFp(
    int /*<<< orphan*/ const *, int /*<<< orphan*/ const *,
    int /*<<< orphan*/ *, int /*<<< orphan*/ *, int /*<<< orphan*/ *);
int /*<<< orphan*/ ERR_GOST_error(int, int /*<<< orphan*/, char *, int);
int /*<<< orphan*/ ERR_R_EC_LIB;
int /*<<< orphan*/ ERR_R_MALLOC_FAILURE;
int /*<<< orphan*/ *EVP_PKEY_get0(int /*<<< orphan*/ *);
int NID_undef;
int /*<<< orphan*/ OBJ_nid2ln(int);
int /*<<< orphan*/ *gost_get0_priv_key(int /*<<< orphan*/ const *);
int print_gost_01(BIO *out, const EVP_PKEY *pkey, int indent, ASN1_PCTX *pctx,
                  int type) {
  int param_nid = NID_undef;
  if (type == 2) {
    BIGNUM *key;
    if (!BIO_indent(out, indent, 128))
      return 0;
    BIO_printf(out, "Private key: ");
    key = gost_get0_priv_key(pkey);
    if (!key)
      BIO_printf(out, "<undefined)");
    else
      BN_print(out, key);
    BIO_printf(out, "\n");
  }
  if (type >= 1) {
    BN_CTX *ctx = BN_CTX_new();
    BIGNUM *X, *Y;
    const EC_POINT *pubkey;
    const EC_GROUP *group;
    if (!ctx) {
      ERR_GOST_error(
          (131), (ERR_R_MALLOC_FAILURE),
          "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
          "2022-01-22/02-19-57/repos/Orav/kbengine/refs/heads/master/kbe/src/"
          "lib/dependencies/openssl/engines/ccgost/gost_ameth.c",
          440);
      return 0;
    }
    BN_CTX_start(ctx);
    X = BN_CTX_get(ctx);
    Y = BN_CTX_get(ctx);
    pubkey = EC_KEY_get0_public_key((EC_KEY *)EVP_PKEY_get0((EVP_PKEY *)pkey));
    group = EC_KEY_get0_group((EC_KEY *)EVP_PKEY_get0((EVP_PKEY *)pkey));
    if (!EC_POINT_get_affine_coordinates_GFp(group, pubkey, X, Y, ctx)) {
      ERR_GOST_error(
          (131), (ERR_R_EC_LIB),
          "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
          "2022-01-22/02-19-57/repos/Orav/kbengine/refs/heads/master/kbe/src/"
          "lib/dependencies/openssl/engines/ccgost/gost_ameth.c",
          450);
      BN_CTX_free(ctx);
      return 0;
    }
    if (!BIO_indent(out, indent, 128))
      return 0;
    BIO_printf(out, "Public key:\n");
    if (!BIO_indent(out, indent + 3, 128))
      return 0;
    BIO_printf(out, "X:");
    BN_print(out, X);
    BIO_printf(out, "\n");
    BIO_indent(out, indent + 3, 128);
    BIO_printf(out, "Y:");
    BN_print(out, Y);
    BIO_printf(out, "\n");
    BN_CTX_end(ctx);
    BN_CTX_free(ctx);
  }
  param_nid = EC_GROUP_get_curve_name(
      EC_KEY_get0_group(EVP_PKEY_get0((EVP_PKEY *)pkey)));
  if (!BIO_indent(out, indent, 128))
    return 0;
  BIO_printf(out, "Parameter set: %s\n", OBJ_nid2ln(param_nid));
  return 1;
}


x86 assembly (clang, -O0):
<print_gost_01>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %edx,-0x1c(%rbp)
mov    %rcx,-0x28(%rbp)
mov    %r8d,-0x2c(%rbp)
mov    0x2dae(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x30(%rbp)
cmpl   $0x2,-0x2c(%rbp)
jne    12b7 <print_gost_01+0xb7>
mov    -0x10(%rbp),%rdi
mov    -0x1c(%rbp),%esi
mov    $0x80,%edx
call   1040 <BIO_indent@plt>
cmp    $0x0,%eax
jne    1257 <print_gost_01+0x57>
movl   $0x0,-0x4(%rbp)
jmp    14fb <print_gost_01+0x2fb>
mov    -0x10(%rbp),%rdi
lea    0xd9e(%rip),%rsi
mov    $0x0,%al
call   1090 <BIO_printf@plt>
mov    -0x18(%rbp),%rdi
call   1050 <gost_get0_priv_key@plt>
mov    %rax,-0x38(%rbp)
cmpq   $0x0,-0x38(%rbp)
jne    1298 <print_gost_01+0x98>
mov    -0x10(%rbp),%rdi
lea    0xd82(%rip),%rsi
mov    $0x0,%al
call   1090 <BIO_printf@plt>
jmp    12a5 <print_gost_01+0xa5>
mov    -0x10(%rbp),%rdi
mov    -0x38(%rbp),%rsi
call   10f0 <BN_print@plt>
mov    -0x10(%rbp),%rdi
lea    0xe2c(%rip),%rsi
mov    $0x0,%al
call   1090 <BIO_printf@plt>
cmpl   $0x1,-0x2c(%rbp)
jl     148e <print_gost_01+0x28e>
mov    $0x0,%al
call   10d0 <BN_CTX_new@plt>
mov    %rax,-0x40(%rbp)
cmpq   $0x0,-0x40(%rbp)
jne    1302 <print_gost_01+0x102>
mov    0x2d0a(%rip),%rax
mov    (%rax),%esi
mov    $0x83,%edi
lea    0xd2e(%rip),%rdx
mov    $0x1b8,%ecx
call   1120 <ERR_GOST_error@plt>
movl   $0x0,-0x4(%rbp)
jmp    14fb <print_gost_01+0x2fb>
mov    -0x40(%rbp),%rdi
call   10c0 <BN_CTX_start@plt>
mov    -0x40(%rbp),%rdi
call   1030 <BN_CTX_get@plt>
mov    %rax,-0x48(%rbp)
mov    -0x40(%rbp),%rdi
call   1030 <BN_CTX_get@plt>
mov    %rax,-0x50(%rbp)
mov    -0x18(%rbp),%rdi
call   1060 <EVP_PKEY_get0@plt>
mov    %rax,%rdi
call   1070 <EC_KEY_get0_public_key@plt>
mov    %rax,-0x58(%rbp)
mov    -0x18(%rbp),%rdi
call   1060 <EVP_PKEY_get0@plt>
mov    %rax,%rdi
call   10e0 <EC_KEY_get0_group@plt>
mov    %rax,-0x60(%rbp)
mov    -0x60(%rbp),%rdi
mov    -0x58(%rbp),%rsi
mov    -0x48(%rbp),%rdx
mov    -0x50(%rbp),%rcx
mov    -0x40(%rbp),%r8
call   1080 <EC_POINT_get_affine_coordinates_GFp@plt>
cmp    $0x0,%eax
jne    13a5 <print_gost_01+0x1a5>
mov    0x2c68(%rip),%rax
mov    (%rax),%esi
mov    $0x83,%edi
lea    0xc94(%rip),%rdx
mov    $0x1c2,%ecx
call   1120 <ERR_GOST_error@plt>
mov    -0x40(%rbp),%rdi
call   10a0 <BN_CTX_free@plt>
movl   $0x0,-0x4(%rbp)
jmp    14fb <print_gost_01+0x2fb>
mov    -0x10(%rbp),%rdi
mov    -0x1c(%rbp),%esi
mov    $0x80,%edx
call   1040 <BIO_indent@plt>
cmp    $0x0,%eax
jne    13cb <print_gost_01+0x1cb>
movl   $0x0,-0x4(%rbp)
jmp    14fb <print_gost_01+0x2fb>
mov    -0x10(%rbp),%rdi
lea    0xcfb(%rip),%rsi
mov    $0x0,%al
call   1090 <BIO_printf@plt>
mov    -0x10(%rbp),%rdi
mov    -0x1c(%rbp),%esi
add    $0x3,%esi
mov    $0x80,%edx
call   1040 <BIO_indent@plt>
cmp    $0x0,%eax
jne    1406 <print_gost_01+0x206>
movl   $0x0,-0x4(%rbp)
jmp    14fb <print_gost_01+0x2fb>
mov    -0x10(%rbp),%rdi
lea    0xccd(%rip),%rsi
mov    $0x0,%al
call   1090 <BIO_printf@plt>
mov    -0x10(%rbp),%rdi
mov    -0x48(%rbp),%rsi
call   10f0 <BN_print@plt>
mov    -0x10(%rbp),%rdi
lea    0xcac(%rip),%rsi
mov    $0x0,%al
call   1090 <BIO_printf@plt>
mov    -0x10(%rbp),%rdi
mov    -0x1c(%rbp),%esi
add    $0x3,%esi
mov    $0x80,%edx
call   1040 <BIO_indent@plt>
mov    -0x10(%rbp),%rdi
lea    0xc8b(%rip),%rsi
mov    $0x0,%al
call   1090 <BIO_printf@plt>
mov    -0x10(%rbp),%rdi
mov    -0x50(%rbp),%rsi
call   10f0 <BN_print@plt>
mov    -0x10(%rbp),%rdi
lea    0xc67(%rip),%rsi
mov    $0x0,%al
call   1090 <BIO_printf@plt>
mov    -0x40(%rbp),%rdi
call   10b0 <BN_CTX_end@plt>
mov    -0x40(%rbp),%rdi
call   10a0 <BN_CTX_free@plt>
mov    -0x18(%rbp),%rdi
call   1060 <EVP_PKEY_get0@plt>
mov    %rax,%rdi
call   10e0 <EC_KEY_get0_group@plt>
mov    %rax,%rdi
call   1110 <EC_GROUP_get_curve_name@plt>
mov    %eax,-0x30(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x1c(%rbp),%esi
mov    $0x80,%edx
call   1040 <BIO_indent@plt>
cmp    $0x0,%eax
jne    14d0 <print_gost_01+0x2d0>
movl   $0x0,-0x4(%rbp)
jmp    14fb <print_gost_01+0x2fb>
mov    -0x10(%rbp),%rax
mov    %rax,-0x68(%rbp)
mov    -0x30(%rbp),%edi
call   1100 <OBJ_nid2ln@plt>
mov    -0x68(%rbp),%rdi
mov    %eax,%edx
lea    0xbf7(%rip),%rsi
mov    $0x0,%al
call   1090 <BIO_printf@plt>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_gost_01>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %edx,%ebp
mov    %rsi,%r15
mov    %rdi,%r12
cmp    $0x2,%r8d
jne    125e <print_gost_01+0x5e>
mov    %r12,%rdi
mov    %ebp,%esi
mov    $0x80,%edx
call   1040 <BIO_indent@plt>
test   %eax,%eax
je     146a <print_gost_01+0x26a>
lea    0xdc6(%rip),%rsi
mov    %r12,%rdi
xor    %eax,%eax
call   1090 <BIO_printf@plt>
mov    %r15,%rdi
call   1050 <gost_get0_priv_key@plt>
test   %rax,%rax
je     1268 <print_gost_01+0x68>
mov    %r12,%rdi
mov    %rax,%rsi
call   10f0 <BN_print@plt>
jmp    1279 <print_gost_01+0x79>
test   %r8d,%r8d
jg     128a <print_gost_01+0x8a>
jmp    13d3 <print_gost_01+0x1d3>
lea    0xd9f(%rip),%rsi
mov    %r12,%rdi
xor    %eax,%eax
call   1090 <BIO_printf@plt>
lea    0xe5c(%rip),%rsi
mov    %r12,%rdi
xor    %eax,%eax
call   1090 <BIO_printf@plt>
xor    %r13d,%r13d
xor    %eax,%eax
call   10d0 <BN_CTX_new@plt>
test   %rax,%rax
je     1422 <print_gost_01+0x222>
mov    %rax,%rbx
mov    %rbp,0x10(%rsp)
mov    %rax,%rdi
call   10c0 <BN_CTX_start@plt>
mov    %rbx,%rdi
call   1030 <BN_CTX_get@plt>
mov    %rax,%rbp
mov    %rbx,%rdi
call   1030 <BN_CTX_get@plt>
mov    %rax,%r13
mov    %r15,%rdi
call   1060 <EVP_PKEY_get0@plt>
mov    %rax,%rdi
call   1070 <EC_KEY_get0_public_key@plt>
mov    %rax,%r14
mov    %r15,%rdi
call   1060 <EVP_PKEY_get0@plt>
mov    %rax,%rdi
call   10e0 <EC_KEY_get0_group@plt>
mov    %rax,%rdi
mov    %r14,%rsi
mov    %rbp,0x8(%rsp)
mov    %rbp,%rdx
mov    %r13,%rcx
mov    %rbx,%r8
call   1080 <EC_POINT_get_affine_coordinates_GFp@plt>
test   %eax,%eax
je     1443 <print_gost_01+0x243>
mov    %r12,%rdi
mov    0x10(%rsp),%rbp
mov    %ebp,%esi
mov    $0x80,%edx
call   1040 <BIO_indent@plt>
test   %eax,%eax
je     146a <print_gost_01+0x26a>
mov    %r13,(%rsp)
lea    0xda3(%rip),%rsi
xor    %r13d,%r13d
mov    %r12,%rdi
xor    %eax,%eax
call   1090 <BIO_printf@plt>
lea    0x3(%rbp),%r14d
mov    %r12,%rdi
mov    %r14d,%esi
mov    $0x80,%edx
call   1040 <BIO_indent@plt>
test   %eax,%eax
je     146d <print_gost_01+0x26d>
lea    0xd80(%rip),%rsi
mov    %r12,%rdi
xor    %eax,%eax
call   1090 <BIO_printf@plt>
mov    %r12,%rdi
mov    0x8(%rsp),%rsi
call   10f0 <BN_print@plt>
lea    0xd60(%rip),%r13
mov    %r12,%rdi
mov    %r13,%rsi
xor    %eax,%eax
call   1090 <BIO_printf@plt>
mov    %r12,%rdi
mov    %r14d,%esi
mov    $0x80,%edx
call   1040 <BIO_indent@plt>
lea    0xd41(%rip),%rsi
mov    %r12,%rdi
xor    %eax,%eax
call   1090 <BIO_printf@plt>
mov    %r12,%rdi
mov    (%rsp),%rsi
call   10f0 <BN_print@plt>
mov    %r12,%rdi
mov    %r13,%rsi
xor    %eax,%eax
call   1090 <BIO_printf@plt>
mov    %rbx,%rdi
call   10b0 <BN_CTX_end@plt>
mov    %rbx,%rdi
call   10a0 <BN_CTX_free@plt>
mov    %r15,%rdi
call   1060 <EVP_PKEY_get0@plt>
mov    %rax,%rdi
call   10e0 <EC_KEY_get0_group@plt>
mov    %rax,%rdi
call   1110 <EC_GROUP_get_curve_name@plt>
mov    %eax,%ebx
mov    %r12,%rdi
mov    %ebp,%esi
mov    $0x80,%edx
call   1040 <BIO_indent@plt>
test   %eax,%eax
je     146a <print_gost_01+0x26a>
mov    %ebx,%edi
call   1100 <OBJ_nid2ln@plt>
lea    0xcd6(%rip),%rsi
mov    %r12,%rdi
mov    %eax,%edx
xor    %eax,%eax
call   1090 <BIO_printf@plt>
mov    $0x1,%r13d
jmp    146d <print_gost_01+0x26d>
mov    0x2bbf(%rip),%rax
mov    (%rax),%esi
lea    0xbe8(%rip),%rdx
mov    $0x83,%edi
mov    $0x1b8,%ecx
call   1120 <ERR_GOST_error@plt>
jmp    146d <print_gost_01+0x26d>
mov    0x2b96(%rip),%rax
mov    (%rax),%esi
lea    0xbc7(%rip),%rdx
mov    $0x83,%edi
mov    $0x1c2,%ecx
call   1120 <ERR_GOST_error@plt>
mov    %rbx,%rdi
call   10a0 <BN_CTX_free@plt>
xor    %r13d,%r13d
mov    %r13d,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@NID_undef = global i32 0
@.str = [14 x i8] c"Private key: \00"
@.str.1 = [12 x i8] c"<undefined)\00"
@.str.2 = [2 x i8] c"\0A\00"
@ERR_R_MALLOC_FAILURE = global i32 0
@.str.3 = [183 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/Orav/kbengine/refs/heads/master/kbe/src/lib/dependencies/openssl/engines/ccgost/gost_ameth.c\00"
@ERR_R_EC_LIB = global i32 0
@.str.4 = [13 x i8] c"Public key:\0A\00"
@.str.5 = [3 x i8] c"X:\00"
@.str.6 = [3 x i8] c"Y:\00"
@.str.7 = [19 x i8] c"Parameter set: %s\0A\00"
define i32 @print_gost_01(i32* %0, i32* %1, i32 %2, i32* %3, i32 %4) {
%6 = alloca i32
%7 = alloca i32*
%8 = alloca i32*
%9 = alloca i32
%10 = alloca i32*
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32*
%14 = alloca i32*
%15 = alloca i32*
%16 = alloca i32*
%17 = alloca i32*
%18 = alloca i32*
store i32* %0, i32** %7
store i32* %1, i32** %8
store i32 %2, i32* %9
store i32* %3, i32** %10
store i32 %4, i32* %11
%19 = load i32, i32* @NID_undef
store i32 %19, i32* %12
%20 = load i32, i32* %11
%21 = icmp eq i32 %20, 2
br i1 %21, label %22, label %45
22: ; preds = %5
%23 = load i32*, i32** %7
%24 = load i32, i32* %9
%25 = call i32 @BIO_indent(i32* %23, i32 %24, i32 128)
%26 = icmp ne i32 %25, 0
br i1 %26, label %28, label %27
27: ; preds = %22
store i32 0, i32* %6
br label %133
28: ; preds = %22
%29 = load i32*, i32** %7
%30 = call i32 (i32*, i8*, ...) @BIO_printf(i32* %29, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
%31 = load i32*, i32** %8
%32 = call i32* @gost_get0_priv_key(i32* %31)
store i32* %32, i32** %13
%33 = load i32*, i32** %13
%34 = icmp ne i32* %33, null
br i1 %34, label %38, label %35
35: ; preds = %28
%36 = load i32*, i32** %7
%37 = call i32 (i32*, i8*, ...) @BIO_printf(i32* %36, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0))
br label %42
38: ; preds = %28
%39 = load i32*, i32** %7
%40 = load i32*, i32** %13
%41 = call i32 @BN_print(i32* %39, i32* %40)
br label %42
42: ; preds = %38, %35
%43 = load i32*, i32** %7
%44 = call i32 (i32*, i8*, ...) @BIO_printf(i32* %43, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
br label %45
45: ; preds = %42, %5
%46 = load i32, i32* %11
%47 = icmp sge i32 %46, 1
br i1 %47, label %48, label %118
48: ; preds = %45
%49 = call i32* (...) @BN_CTX_new()
store i32* %49, i32** %14
%50 = load i32*, i32** %14
%51 = icmp ne i32* %50, null
br i1 %51, label %55, label %52
52: ; preds = %48
%53 = load i32, i32* @ERR_R_MALLOC_FAILURE
%54 = call i32 @ERR_GOST_error(i32 131, i32 %53, i8* getelementptr inbounds ([183 x i8], [183 x i8]* @.str.3, i64 0, i64 0), i32 440)
store i32 0, i32* %6
br label %133
55: ; preds = %48
%56 = load i32*, i32** %14
%57 = call i32 @BN_CTX_start(i32* %56)
%58 = load i32*, i32** %14
%59 = call i32* @BN_CTX_get(i32* %58)
store i32* %59, i32** %15
%60 = load i32*, i32** %14
%61 = call i32* @BN_CTX_get(i32* %60)
store i32* %61, i32** %16
%62 = load i32*, i32** %8
%63 = call i32* @EVP_PKEY_get0(i32* %62)
%64 = call i32* @EC_KEY_get0_public_key(i32* %63)
store i32* %64, i32** %17
%65 = load i32*, i32** %8
%66 = call i32* @EVP_PKEY_get0(i32* %65)
%67 = call i32* @EC_KEY_get0_group(i32* %66)
store i32* %67, i32** %18
%68 = load i32*, i32** %18
%69 = load i32*, i32** %17
%70 = load i32*, i32** %15
%71 = load i32*, i32** %16
%72 = load i32*, i32** %14
%73 = call i32 @EC_POINT_get_affine_coordinates_GFp(i32* %68, i32* %69, i32* %70, i32* %71, i32* %72)
%74 = icmp ne i32 %73, 0
br i1 %74, label %80, label %75
75: ; preds = %55
%76 = load i32, i32* @ERR_R_EC_LIB
%77 = call i32 @ERR_GOST_error(i32 131, i32 %76, i8* getelementptr inbounds ([183 x i8], [183 x i8]* @.str.3, i64 0, i64 0), i32 450)
%78 = load i32*, i32** %14
%79 = call i32 @BN_CTX_free(i32* %78)
store i32 0, i32* %6
br label %133
80: ; preds = %55
%81 = load i32*, i32** %7
%82 = load i32, i32* %9
%83 = call i32 @BIO_indent(i32* %81, i32 %82, i32 128)
%84 = icmp ne i32 %83, 0
br i1 %84, label %86, label %85
85: ; preds = %80
store i32 0, i32* %6
br label %133
86: ; preds = %80
%87 = load i32*, i32** %7
%88 = call i32 (i32*, i8*, ...) @BIO_printf(i32* %87, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.4, i64 0, i64 0))
%89 = load i32*, i32** %7
%90 = load i32, i32* %9
%91 = add nsw i32 %90, 3
%92 = call i32 @BIO_indent(i32* %89, i32 %91, i32 128)
%93 = icmp ne i32 %92, 0
br i1 %93, label %95, label %94
94: ; preds = %86
store i32 0, i32* %6
br label %133
95: ; preds = %86
%96 = load i32*, i32** %7
%97 = call i32 (i32*, i8*, ...) @BIO_printf(i32* %96, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0))
%98 = load i32*, i32** %7
%99 = load i32*, i32** %15
%100 = call i32 @BN_print(i32* %98, i32* %99)
%101 = load i32*, i32** %7
%102 = call i32 (i32*, i8*, ...) @BIO_printf(i32* %101, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%103 = load i32*, i32** %7
%104 = load i32, i32* %9
%105 = add nsw i32 %104, 3
%106 = call i32 @BIO_indent(i32* %103, i32 %105, i32 128)
%107 = load i32*, i32** %7
%108 = call i32 (i32*, i8*, ...) @BIO_printf(i32* %107, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0))
%109 = load i32*, i32** %7
%110 = load i32*, i32** %16
%111 = call i32 @BN_print(i32* %109, i32* %110)
%112 = load i32*, i32** %7
%113 = call i32 (i32*, i8*, ...) @BIO_printf(i32* %112, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%114 = load i32*, i32** %14
%115 = call i32 @BN_CTX_end(i32* %114)
%116 = load i32*, i32** %14
%117 = call i32 @BN_CTX_free(i32* %116)
br label %118
118: ; preds = %95, %45
%119 = load i32*, i32** %8
%120 = call i32* @EVP_PKEY_get0(i32* %119)
%121 = call i32* @EC_KEY_get0_group(i32* %120)
%122 = call i32 @EC_GROUP_get_curve_name(i32* %121)
store i32 %122, i32* %12
%123 = load i32*, i32** %7
%124 = load i32, i32* %9
%125 = call i32 @BIO_indent(i32* %123, i32 %124, i32 128)
%126 = icmp ne i32 %125, 0
br i1 %126, label %128, label %127
127: ; preds = %118
store i32 0, i32* %6
br label %133
128: ; preds = %118
%129 = load i32*, i32** %7
%130 = load i32, i32* %12
%131 = call i32 @OBJ_nid2ln(i32 %130)
%132 = call i32 (i32*, i8*, ...) @BIO_printf(i32* %129, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.7, i64 0, i64 0), i32 %131)
store i32 1, i32* %6
br label %133
133: ; preds = %128, %127, %94, %85, %75, %52, %27
%134 = load i32, i32* %6
ret i32 %134
}

LLVM IR (-O2):
@NID_undef = global i32 0
@.str = [14 x i8] c"Private key: \00"
@.str.1 = [12 x i8] c"<undefined)\00"
@.str.2 = [2 x i8] c"\0A\00"
@ERR_R_MALLOC_FAILURE = global i32 0
@.str.3 = [183 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/Orav/kbengine/refs/heads/master/kbe/src/lib/dependencies/openssl/engines/ccgost/gost_ameth.c\00"
@ERR_R_EC_LIB = global i32 0
@.str.4 = [13 x i8] c"Public key:\0A\00"
@.str.5 = [3 x i8] c"X:\00"
@.str.6 = [3 x i8] c"Y:\00"
@.str.7 = [19 x i8] c"Parameter set: %s\0A\00"
define i32 @print_gost_01(i32* %0, i32* %1, i32 %2, i32* nocapture readnone %3, i32 %4) {
%6 = icmp eq i32 %4, 2
br i1 %6, label %7, label %20
7: ; preds = %5
%8 = tail call i32 @BIO_indent(i32* %0, i32 %2, i32 128)
%9 = icmp eq i32 %8, 0
br i1 %9, label %69, label %10
10: ; preds = %7
%11 = tail call i32 (i32*, i8*, ...) @BIO_printf(i32* %0, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
%12 = tail call i32* @gost_get0_priv_key(i32* %1)
%13 = icmp eq i32* %12, null
br i1 %13, label %14, label %16
14: ; preds = %10
%15 = tail call i32 (i32*, i8*, ...) @BIO_printf(i32* %0, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0))
br label %18
16: ; preds = %10
%17 = tail call i32 @BN_print(i32* %0, i32* %12)
br label %18
18: ; preds = %14, %16
%19 = tail call i32 (i32*, i8*, ...) @BIO_printf(i32* %0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
br label %22
20: ; preds = %5
%21 = icmp sgt i32 %4, 0
br i1 %21, label %22, label %60
22: ; preds = %18, %20
%23 = tail call i32* (...) @BN_CTX_new()
%24 = icmp eq i32* %23, null
br i1 %24, label %25, label %28
25: ; preds = %22
%26 = load i32, i32* @ERR_R_MALLOC_FAILURE
%27 = tail call i32 @ERR_GOST_error(i32 131, i32 %26, i8* getelementptr inbounds ([183 x i8], [183 x i8]* @.str.3, i64 0, i64 0), i32 440)
br label %69
28: ; preds = %22
%29 = tail call i32 @BN_CTX_start(i32* %23)
%30 = tail call i32* @BN_CTX_get(i32* %23)
%31 = tail call i32* @BN_CTX_get(i32* %23)
%32 = tail call i32* @EVP_PKEY_get0(i32* %1)
%33 = tail call i32* @EC_KEY_get0_public_key(i32* %32)
%34 = tail call i32* @EVP_PKEY_get0(i32* %1)
%35 = tail call i32* @EC_KEY_get0_group(i32* %34)
%36 = tail call i32 @EC_POINT_get_affine_coordinates_GFp(i32* %35, i32* %33, i32* %30, i32* %31, i32* %23)
%37 = icmp eq i32 %36, 0
br i1 %37, label %38, label %42
38: ; preds = %28
%39 = load i32, i32* @ERR_R_EC_LIB
%40 = tail call i32 @ERR_GOST_error(i32 131, i32 %39, i8* getelementptr inbounds ([183 x i8], [183 x i8]* @.str.3, i64 0, i64 0), i32 450)
%41 = tail call i32 @BN_CTX_free(i32* %23)
br label %69
42: ; preds = %28
%43 = tail call i32 @BIO_indent(i32* %0, i32 %2, i32 128)
%44 = icmp eq i32 %43, 0
br i1 %44, label %69, label %45
45: ; preds = %42
%46 = tail call i32 (i32*, i8*, ...) @BIO_printf(i32* %0, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.4, i64 0, i64 0))
%47 = add nsw i32 %2, 3
%48 = tail call i32 @BIO_indent(i32* %0, i32 %47, i32 128)
%49 = icmp eq i32 %48, 0
br i1 %49, label %69, label %50
50: ; preds = %45
%51 = tail call i32 (i32*, i8*, ...) @BIO_printf(i32* %0, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0))
%52 = tail call i32 @BN_print(i32* %0, i32* %30)
%53 = tail call i32 (i32*, i8*, ...) @BIO_printf(i32* %0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%54 = tail call i32 @BIO_indent(i32* %0, i32 %47, i32 128)
%55 = tail call i32 (i32*, i8*, ...) @BIO_printf(i32* %0, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0))
%56 = tail call i32 @BN_print(i32* %0, i32* %31)
%57 = tail call i32 (i32*, i8*, ...) @BIO_printf(i32* %0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%58 = tail call i32 @BN_CTX_end(i32* %23)
%59 = tail call i32 @BN_CTX_free(i32* %23)
br label %60
60: ; preds = %50, %20
%61 = tail call i32* @EVP_PKEY_get0(i32* %1)
%62 = tail call i32* @EC_KEY_get0_group(i32* %61)
%63 = tail call i32 @EC_GROUP_get_curve_name(i32* %62)
%64 = tail call i32 @BIO_indent(i32* %0, i32 %2, i32 128)
%65 = icmp eq i32 %64, 0
br i1 %65, label %69, label %66
66: ; preds = %60
%67 = tail call i32 @OBJ_nid2ln(i32 %63)
%68 = tail call i32 (i32*, i8*, ...) @BIO_printf(i32* %0, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.7, i64 0, i64 0), i32 %67)
br label %69
69: ; preds = %7, %60, %25, %38, %42, %45, %66
%70 = phi i32 [ 1, %66 ], [ 0, %45 ], [ 0, %42 ], [ 0, %38 ], [ 0, %25 ], [ 0, %60 ], [ 0, %7 ]
ret i32 %70
}