; LLVM IR from gost-engine/engine :: gost_ec_keyx (VKO_compute_key)

; Unoptimized IR (clang -disable-llvm-passes):
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

@.str = external hidden unnamed_addr constant [67 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local i32 @VKO_compute_key(ptr noundef %0, ptr noundef %1, ptr noundef %2, ptr noundef %3, i64 noundef %4, i32 noundef %5) #0 {
  %7 = alloca i32, align 4
  %8 = alloca ptr, align 8
  %9 = alloca ptr, align 8
  %10 = alloca ptr, align 8
  %11 = alloca ptr, align 8
  %12 = alloca i64, align 8
  %13 = alloca i32, align 4
  %14 = alloca ptr, align 8
  %15 = alloca ptr, align 8
  %16 = alloca ptr, align 8
  %17 = alloca ptr, align 8
  %18 = alloca ptr, align 8
  %19 = alloca ptr, align 8
  %20 = alloca ptr, align 8
  %21 = alloca ptr, align 8
  %22 = alloca ptr, align 8
  %23 = alloca i32, align 4
  %24 = alloca i32, align 4
  %25 = alloca i32, align 4
  %26 = alloca i32, align 4
  store ptr %0, ptr %8, align 8, !tbaa !5
  store ptr %1, ptr %9, align 8, !tbaa !5
  store ptr %2, ptr %10, align 8, !tbaa !5
  store ptr %3, ptr %11, align 8, !tbaa !5
  store i64 %4, ptr %12, align 8, !tbaa !9
  store i32 %5, ptr %13, align 4, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #3
  store ptr null, ptr %14, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #3
  store ptr null, ptr %15, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #3
  store ptr null, ptr %16, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %17) #3
  store ptr null, ptr %17, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %18) #3
  store ptr null, ptr %18, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %19) #3
  store ptr null, ptr %19, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %20) #3
  store ptr null, ptr %20, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %21) #3
  store ptr null, ptr %21, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %22) #3
  store ptr null, ptr %22, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %23) #3
  call void @llvm.lifetime.start.p0(i64 4, ptr %24) #3
  call void @llvm.lifetime.start.p0(i64 4, ptr %25) #3
  store i32 0, ptr %25, align 4, !tbaa !11
  %27 = call ptr @BN_CTX_secure_new()
  store ptr %27, ptr %20, align 8, !tbaa !5
  %28 = icmp eq ptr %27, null
  br i1 %28, label %29, label %30

29:                                               ; preds = %6
  call void @ERR_GOST_error(i32 noundef 137, i32 noundef 786688, ptr noundef @.str, i32 noundef 43)
  store i32 0, ptr %7, align 4
  store i32 1, ptr %26, align 4
  br label %162

30:                                               ; preds = %6
  %31 = load ptr, ptr %20, align 8, !tbaa !5
  call void @BN_CTX_start(ptr noundef %31)
  %32 = load i32, ptr %13, align 4, !tbaa !11
  %33 = call ptr @OBJ_nid2sn(i32 noundef %32)
  %34 = call ptr @EVP_get_digestbyname(ptr noundef %33)
  store ptr %34, ptr %22, align 8, !tbaa !5
  %35 = load ptr, ptr %22, align 8, !tbaa !5
  %36 = icmp ne ptr %35, null
  br i1 %36, label %38, label %37

37:                                               ; preds = %30
  call void @ERR_GOST_error(i32 noundef 137, i32 noundef 112, ptr noundef @.str, i32 noundef 50)
  br label %155

38:                                               ; preds = %30
  %39 = load ptr, ptr %10, align 8, !tbaa !5
  %40 = call ptr @EC_KEY_get0_group(ptr noundef %39)
  store ptr %40, ptr %18, align 8, !tbaa !5
  %41 = load ptr, ptr %20, align 8, !tbaa !5
  %42 = call ptr @BN_CTX_get(ptr noundef %41)
  store ptr %42, ptr %15, align 8, !tbaa !5
  %43 = load ptr, ptr %20, align 8, !tbaa !5
  %44 = call ptr @BN_CTX_get(ptr noundef %43)
  store ptr %44, ptr %16, align 8, !tbaa !5
  %45 = load ptr, ptr %20, align 8, !tbaa !5
  %46 = call ptr @BN_CTX_get(ptr noundef %45)
  store ptr %46, ptr %17, align 8, !tbaa !5
  %47 = icmp eq ptr %46, null
  br i1 %47, label %69, label %48

48:                                               ; preds = %38
  %49 = load ptr, ptr %18, align 8, !tbaa !5
  %50 = call ptr @EC_POINT_new(ptr noundef %49)
  store ptr %50, ptr %19, align 8, !tbaa !5
  %51 = icmp eq ptr %50, null
  br i1 %51, label %69, label %52

52:                                               ; preds = %48
  %53 = load ptr, ptr %11, align 8, !tbaa !5
  %54 = load i64, ptr %12, align 8, !tbaa !9
  %55 = trunc i64 %54 to i32
  %56 = load ptr, ptr %15, align 8, !tbaa !5
  %57 = call ptr @BN_lebin2bn(ptr noundef %53, i32 noundef %55, ptr noundef %56)
  %58 = icmp eq ptr %57, null
  br i1 %58, label %69, label %59

59:                                               ; preds = %52
  %60 = load ptr, ptr %15, align 8, !tbaa !5
  %61 = load ptr, ptr %15, align 8, !tbaa !5
  %62 = load ptr, ptr %10, align 8, !tbaa !5
  %63 = call ptr @EC_KEY_get0_private_key(ptr noundef %62)
  %64 = load ptr, ptr %18, align 8, !tbaa !5
  %65 = call ptr @EC_GROUP_get0_order(ptr noundef %64)
  %66 = load ptr, ptr %20, align 8, !tbaa !5
  %67 = call i32 @BN_mod_mul(ptr noundef %60, ptr noundef %61, ptr noundef %63, ptr noundef %65, ptr noundef %66)
  %68 = icmp ne i32 %67, 0
  br i1 %68, label %70, label %69

69:                                               ; preds = %59, %52, %48, %38
  br label %155

70:                                               ; preds = %59
  %71 = load ptr, ptr %18, align 8, !tbaa !5
  %72 = load ptr, ptr %19, align 8, !tbaa !5
  %73 = load ptr, ptr %9, align 8, !tbaa !5
  %74 = load ptr, ptr %15, align 8, !tbaa !5
  %75 = load ptr, ptr %20, align 8, !tbaa !5
  %76 = call i32 @gost_ec_point_mul(ptr noundef %71, ptr noundef %72, ptr noundef null, ptr noundef %73, ptr noundef %74, ptr noundef %75)
  %77 = icmp ne i32 %76, 0
  br i1 %77, label %79, label %78

78:                                               ; preds = %70
  call void @ERR_GOST_error(i32 noundef 137, i32 noundef 107, ptr noundef @.str, i32 noundef 81)
  br label %155

79:                                               ; preds = %70
  %80 = load ptr, ptr %18, align 8, !tbaa !5
  %81 = load ptr, ptr %19, align 8, !tbaa !5
  %82 = load ptr, ptr %16, align 8, !tbaa !5
  %83 = load ptr, ptr %17, align 8, !tbaa !5
  %84 = load ptr, ptr %20, align 8, !tbaa !5
  %85 = call i32 @EC_POINT_get_affine_coordinates(ptr noundef %80, ptr noundef %81, ptr noundef %82, ptr noundef %83, ptr noundef %84)
  %86 = icmp ne i32 %85, 0
  br i1 %86, label %88, label %87

87:                                               ; preds = %79
  call void @ERR_GOST_error(i32 noundef 137, i32 noundef 524304, ptr noundef @.str, i32 noundef 85)
  br label %155

88:                                               ; preds = %79
  %89 = load ptr, ptr %18, align 8, !tbaa !5
  %90 = call ptr @EC_GROUP_get0_field(ptr noundef %89)
  %91 = call i32 @BN_num_bits(ptr noundef %90)
  %92 = add nsw i32 %91, 7
  %93 = sdiv i32 %92, 8
  store i32 %93, ptr %24, align 4, !tbaa !11
  %94 = load i32, ptr %24, align 4, !tbaa !11
  %95 = mul nsw i32 2, %94
  store i32 %95, ptr %23, align 4, !tbaa !11
  %96 = load i32, ptr %23, align 4, !tbaa !11
  %97 = sext i32 %96 to i64
  %98 = call ptr @CRYPTO_malloc(i64 noundef %97, ptr noundef @.str, i32 noundef 91)
  store ptr %98, ptr %14, align 8, !tbaa !5
  %99 = icmp eq ptr %98, null
  br i1 %99, label %100, label %101

100:                                              ; preds = %88
  call void @ERR_GOST_error(i32 noundef 137, i32 noundef 786688, ptr noundef @.str, i32 noundef 92)
  br label %155

101:                                              ; preds = %88
  %102 = load ptr, ptr %16, align 8, !tbaa !5
  %103 = load ptr, ptr %14, align 8, !tbaa !5
  %104 = load i32, ptr %24, align 4, !tbaa !11
  %105 = call i32 @BN_bn2lebinpad(ptr noundef %102, ptr noundef %103, i32 noundef %104)
  %106 = load i32, ptr %24, align 4, !tbaa !11
  %107 = icmp ne i32 %105, %106
  br i1 %107, label %118, label %108

108:                                              ; preds = %101
  %109 = load ptr, ptr %17, align 8, !tbaa !5
  %110 = load ptr, ptr %14, align 8, !tbaa !5
  %111 = load i32, ptr %24, align 4, !tbaa !11
  %112 = sext i32 %111 to i64
  %113 = getelementptr inbounds i8, ptr %110, i64 %112
  %114 = load i32, ptr %24, align 4, !tbaa !11
  %115 = call i32 @BN_bn2lebinpad(ptr noundef %109, ptr noundef %113, i32 noundef %114)
  %116 = load i32, ptr %24, align 4, !tbaa !11
  %117 = icmp ne i32 %115, %116
  br i1 %117, label %118, label %119

118:                                              ; preds = %108, %101
  br label %155

119:                                              ; preds = %108
  %120 = call ptr @EVP_MD_CTX_new()
  store ptr %120, ptr %21, align 8, !tbaa !5
  %121 = icmp eq ptr %120, null
  br i1 %121, label %122, label %123

122:                                              ; preds = %119
  call void @ERR_GOST_error(i32 noundef 137, i32 noundef 786688, ptr noundef @.str, i32 noundef 104)
  br label %155

123:                                              ; preds = %119
  %124 = load ptr, ptr %21, align 8, !tbaa !5
  %125 = call i32 @EVP_MD_CTX_reset(ptr noundef %124)
  %126 = icmp eq i32 %125, 0
  br i1 %126, label %144, label %127

127:                                              ; preds = %123
  %128 = load ptr, ptr %21, align 8, !tbaa !5
  %129 = load ptr, ptr %22, align 8, !tbaa !5
  %130 = call i32 @EVP_DigestInit_ex(ptr noundef %128, ptr noundef %129, ptr noundef null)
  %131 = icmp eq i32 %130, 0
  br i1 %131, label %144, label %132

132:                                              ; preds = %127
  %133 = load ptr, ptr %21, align 8, !tbaa !5
  %134 = load ptr, ptr %14, align 8, !tbaa !5
  %135 = load i32, ptr %23, align 4, !tbaa !11
  %136 = sext i32 %135 to i64
  %137 = call i32 @EVP_DigestUpdate(ptr noundef %133, ptr noundef %134, i64 noundef %136)
  %138 = icmp eq i32 %137, 0
  br i1 %138, label %144, label %139

139:                                              ; preds = %132
  %140 = load ptr, ptr %21, align 8, !tbaa !5
  %141 = load ptr, ptr %8, align 8, !tbaa !5
  %142 = call i32 @EVP_DigestFinal_ex(ptr noundef %140, ptr noundef %141, ptr noundef null)
  %143 = icmp eq i32 %142, 0
  br i1 %143, label %144, label %145

144:                                              ; preds = %139, %132, %127, %123
  call void @ERR_GOST_error(i32 noundef 137, i32 noundef 524294, ptr noundef @.str, i32 noundef 112)
  br label %155

145:                                              ; preds = %139
  %146 = load ptr, ptr %22, align 8, !tbaa !5
  %147 = call i32 @EVP_MD_get_size(ptr noundef %146)
  %148 = icmp sgt i32 %147, 0
  br i1 %148, label %149, label %152

149:                                              ; preds = %145
  %150 = load ptr, ptr %22, align 8, !tbaa !5
  %151 = call i32 @EVP_MD_get_size(ptr noundef %150)
  br label %153

152:                                              ; preds = %145
  br label %153

153:                                              ; preds = %152, %149
  %154 = phi i32 [ %151, %149 ], [ 0, %152 ]
  store i32 %154, ptr %25, align 4, !tbaa !11
  br label %155

155:                                              ; preds = %153, %144, %122, %118, %100, %87, %78, %69, %37
  %156 = load ptr, ptr %20, align 8, !tbaa !5
  call void @BN_CTX_end(ptr noundef %156)
  %157 = load ptr, ptr %20, align 8, !tbaa !5
  call void @BN_CTX_free(ptr noundef %157)
  %158 = load ptr, ptr %19, align 8, !tbaa !5
  call void @EC_POINT_free(ptr noundef %158)
  %159 = load ptr, ptr %21, align 8, !tbaa !5
  call void @EVP_MD_CTX_free(ptr noundef %159)
  %160 = load ptr, ptr %14, align 8, !tbaa !5
  call void @CRYPTO_free(ptr noundef %160, ptr noundef @.str, i32 noundef 123)
  %161 = load i32, ptr %25, align 4, !tbaa !11
  store i32 %161, ptr %7, align 4
  store i32 1, ptr %26, align 4
  br label %162

162:                                              ; preds = %155, %29
  call void @llvm.lifetime.end.p0(i64 4, ptr %25) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %24) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %23) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %22) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %21) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %20) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %19) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %18) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #3
  %163 = load i32, ptr %7, align 4
  ret i32 %163
}

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1

declare ptr @BN_CTX_secure_new() #2

declare void @ERR_GOST_error(i32 noundef, i32 noundef, ptr noundef, i32 noundef) #2

declare void @BN_CTX_start(ptr noundef) #2

declare ptr @EVP_get_digestbyname(ptr noundef) #2

declare ptr @OBJ_nid2sn(i32 noundef) #2

declare ptr @EC_KEY_get0_group(ptr noundef) #2

declare ptr @BN_CTX_get(ptr noundef) #2

declare ptr @EC_POINT_new(ptr noundef) #2

declare ptr @BN_lebin2bn(ptr noundef, i32 noundef, ptr noundef) #2

declare i32 @BN_mod_mul(ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef) #2

declare ptr @EC_KEY_get0_private_key(ptr noundef) #2

declare ptr @EC_GROUP_get0_order(ptr noundef) #2

declare i32 @gost_ec_point_mul(ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef) #2

declare i32 @EC_POINT_get_affine_coordinates(ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef) #2

declare i32 @BN_num_bits(ptr noundef) #2

declare ptr @EC_GROUP_get0_field(ptr noundef) #2

declare ptr @CRYPTO_malloc(i64 noundef, ptr noundef, i32 noundef) #2

declare i32 @BN_bn2lebinpad(ptr noundef, ptr noundef, i32 noundef) #2

declare ptr @EVP_MD_CTX_new() #2

declare i32 @EVP_MD_CTX_reset(ptr noundef) #2

declare i32 @EVP_DigestInit_ex(ptr noundef, ptr noundef, ptr noundef) #2

declare i32 @EVP_DigestUpdate(ptr noundef, ptr noundef, i64 noundef) #2

declare i32 @EVP_DigestFinal_ex(ptr noundef, ptr noundef, ptr noundef) #2

declare i32 @EVP_MD_get_size(ptr noundef) #2

declare void @BN_CTX_end(ptr noundef) #2

declare void @BN_CTX_free(ptr noundef) #2

declare void @EC_POINT_free(ptr noundef) #2

declare void @EVP_MD_CTX_free(ptr noundef) #2

declare void @CRYPTO_free(ptr noundef, ptr noundef, i32 noundef) #2

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1

attributes #0 = { nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }

!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"long", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"int", !7, i64 0}


; Optimized IR (opt -passes='default<O3>'):
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

@.str = external hidden unnamed_addr constant [67 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local i32 @VKO_compute_key(ptr noundef %0, ptr noundef %1, ptr noundef %2, ptr noundef %3, i64 noundef %4, i32 noundef %5) local_unnamed_addr #0 {
  %7 = tail call ptr @BN_CTX_secure_new() #2
  %8 = icmp eq ptr %7, null
  br i1 %8, label %9, label %10

9:                                                ; preds = %6
  tail call void @ERR_GOST_error(i32 noundef 137, i32 noundef 786688, ptr noundef nonnull @.str, i32 noundef 43) #2
  br label %76

10:                                               ; preds = %6
  tail call void @BN_CTX_start(ptr noundef nonnull %7) #2
  %11 = tail call ptr @OBJ_nid2sn(i32 noundef %5) #2
  %12 = tail call ptr @EVP_get_digestbyname(ptr noundef %11) #2
  %.not = icmp eq ptr %12, null
  br i1 %.not, label %13, label %14

13:                                               ; preds = %10
  tail call void @ERR_GOST_error(i32 noundef 137, i32 noundef 112, ptr noundef nonnull @.str, i32 noundef 50) #2
  br label %75

14:                                               ; preds = %10
  %15 = tail call ptr @EC_KEY_get0_group(ptr noundef %2) #2
  %16 = tail call ptr @BN_CTX_get(ptr noundef nonnull %7) #2
  %17 = tail call ptr @BN_CTX_get(ptr noundef nonnull %7) #2
  %18 = tail call ptr @BN_CTX_get(ptr noundef nonnull %7) #2
  %19 = icmp eq ptr %18, null
  br i1 %19, label %75, label %20

20:                                               ; preds = %14
  %21 = tail call ptr @EC_POINT_new(ptr noundef %15) #2
  %22 = icmp eq ptr %21, null
  br i1 %22, label %75, label %23

23:                                               ; preds = %20
  %24 = trunc i64 %4 to i32
  %25 = tail call ptr @BN_lebin2bn(ptr noundef %3, i32 noundef %24, ptr noundef %16) #2
  %26 = icmp eq ptr %25, null
  br i1 %26, label %75, label %27

27:                                               ; preds = %23
  %28 = tail call ptr @EC_KEY_get0_private_key(ptr noundef %2) #2
  %29 = tail call ptr @EC_GROUP_get0_order(ptr noundef %15) #2
  %30 = tail call i32 @BN_mod_mul(ptr noundef %16, ptr noundef %16, ptr noundef %28, ptr noundef %29, ptr noundef nonnull %7) #2
  %.not67 = icmp eq i32 %30, 0
  br i1 %.not67, label %75, label %31

31:                                               ; preds = %27
  %32 = tail call i32 @gost_ec_point_mul(ptr noundef %15, ptr noundef nonnull %21, ptr noundef null, ptr noundef %1, ptr noundef %16, ptr noundef nonnull %7) #2
  %.not68 = icmp eq i32 %32, 0
  br i1 %.not68, label %33, label %34

33:                                               ; preds = %31
  tail call void @ERR_GOST_error(i32 noundef 137, i32 noundef 107, ptr noundef nonnull @.str, i32 noundef 81) #2
  br label %75

34:                                               ; preds = %31
  %35 = tail call i32 @EC_POINT_get_affine_coordinates(ptr noundef %15, ptr noundef nonnull %21, ptr noundef %17, ptr noundef nonnull %18, ptr noundef nonnull %7) #2
  %.not69 = icmp eq i32 %35, 0
  br i1 %.not69, label %36, label %37

36:                                               ; preds = %34
  tail call void @ERR_GOST_error(i32 noundef 137, i32 noundef 524304, ptr noundef nonnull @.str, i32 noundef 85) #2
  br label %75

37:                                               ; preds = %34
  %38 = tail call ptr @EC_GROUP_get0_field(ptr noundef %15) #2
  %39 = tail call i32 @BN_num_bits(ptr noundef %38) #2
  %40 = add nsw i32 %39, 7
  %41 = sdiv i32 %40, 8
  %42 = shl nsw i32 %41, 1
  %43 = sext i32 %42 to i64
  %44 = tail call ptr @CRYPTO_malloc(i64 noundef %43, ptr noundef nonnull @.str, i32 noundef 91) #2
  %45 = icmp eq ptr %44, null
  br i1 %45, label %46, label %47

46:                                               ; preds = %37
  tail call void @ERR_GOST_error(i32 noundef 137, i32 noundef 786688, ptr noundef nonnull @.str, i32 noundef 92) #2
  br label %75

47:                                               ; preds = %37
  %48 = tail call i32 @BN_bn2lebinpad(ptr noundef %17, ptr noundef nonnull %44, i32 noundef %41) #2
  %.not70 = icmp eq i32 %48, %41
  br i1 %.not70, label %49, label %75

49:                                               ; preds = %47
  %50 = sext i32 %41 to i64
  %51 = getelementptr inbounds i8, ptr %44, i64 %50
  %52 = tail call i32 @BN_bn2lebinpad(ptr noundef nonnull %18, ptr noundef nonnull %51, i32 noundef %41) #2
  %.not71 = icmp eq i32 %52, %41
  br i1 %.not71, label %53, label %75

53:                                               ; preds = %49
  %54 = tail call ptr @EVP_MD_CTX_new() #2
  %55 = icmp eq ptr %54, null
  br i1 %55, label %56, label %57

56:                                               ; preds = %53
  tail call void @ERR_GOST_error(i32 noundef 137, i32 noundef 786688, ptr noundef nonnull @.str, i32 noundef 104) #2
  br label %75

57:                                               ; preds = %53
  %58 = tail call i32 @EVP_MD_CTX_reset(ptr noundef nonnull %54) #2
  %59 = icmp eq i32 %58, 0
  br i1 %59, label %69, label %60

60:                                               ; preds = %57
  %61 = tail call i32 @EVP_DigestInit_ex(ptr noundef nonnull %54, ptr noundef nonnull %12, ptr noundef null) #2
  %62 = icmp eq i32 %61, 0
  br i1 %62, label %69, label %63

63:                                               ; preds = %60
  %64 = tail call i32 @EVP_DigestUpdate(ptr noundef nonnull %54, ptr noundef nonnull %44, i64 noundef %43) #2
  %65 = icmp eq i32 %64, 0
  br i1 %65, label %69, label %66

66:                                               ; preds = %63
  %67 = tail call i32 @EVP_DigestFinal_ex(ptr noundef nonnull %54, ptr noundef %0, ptr noundef null) #2
  %68 = icmp eq i32 %67, 0
  br i1 %68, label %69, label %70

69:                                               ; preds = %66, %63, %60, %57
  tail call void @ERR_GOST_error(i32 noundef 137, i32 noundef 524294, ptr noundef nonnull @.str, i32 noundef 112) #2
  br label %75

70:                                               ; preds = %66
  %71 = tail call i32 @EVP_MD_get_size(ptr noundef nonnull %12) #2
  %72 = icmp sgt i32 %71, 0
  br i1 %72, label %73, label %75

73:                                               ; preds = %70
  %74 = tail call i32 @EVP_MD_get_size(ptr noundef nonnull %12) #2
  br label %75

75:                                               ; preds = %73, %70, %47, %49, %14, %20, %23, %27, %69, %56, %46, %36, %33, %13
  %.057 = phi ptr [ null, %14 ], [ null, %20 ], [ %21, %23 ], [ %21, %46 ], [ %21, %47 ], [ %21, %49 ], [ %21, %56 ], [ %21, %69 ], [ %21, %36 ], [ %21, %33 ], [ %21, %27 ], [ null, %13 ], [ %21, %70 ], [ %21, %73 ]
  %.056 = phi ptr [ null, %14 ], [ null, %20 ], [ null, %23 ], [ null, %46 ], [ null, %47 ], [ null, %49 ], [ null, %56 ], [ %54, %69 ], [ null, %36 ], [ null, %33 ], [ null, %27 ], [ null, %13 ], [ %54, %70 ], [ %54, %73 ]
  %.055 = phi ptr [ null, %14 ], [ null, %20 ], [ null, %23 ], [ null, %46 ], [ %44, %47 ], [ %44, %49 ], [ %44, %56 ], [ %44, %69 ], [ null, %36 ], [ null, %33 ], [ null, %27 ], [ null, %13 ], [ %44, %70 ], [ %44, %73 ]
  %.0 = phi i32 [ 0, %14 ], [ 0, %20 ], [ 0, %23 ], [ 0, %46 ], [ 0, %47 ], [ 0, %49 ], [ 0, %56 ], [ 0, %69 ], [ 0, %36 ], [ 0, %33 ], [ 0, %27 ], [ 0, %13 ], [ 0, %70 ], [ %74, %73 ]
  tail call void @BN_CTX_end(ptr noundef nonnull %7) #2
  tail call void @BN_CTX_free(ptr noundef nonnull %7) #2
  tail call void @EC_POINT_free(ptr noundef %.057) #2
  tail call void @EVP_MD_CTX_free(ptr noundef %.056) #2
  tail call void @CRYPTO_free(ptr noundef %.055, ptr noundef nonnull @.str, i32 noundef 123) #2
  br label %76

76:                                               ; preds = %75, %9
  %.054 = phi i32 [ 0, %9 ], [ %.0, %75 ]
  ret i32 %.054
}

declare ptr @BN_CTX_secure_new() local_unnamed_addr #1

declare void @ERR_GOST_error(i32 noundef, i32 noundef, ptr noundef, i32 noundef) local_unnamed_addr #1

declare void @BN_CTX_start(ptr noundef) local_unnamed_addr #1

declare ptr @EVP_get_digestbyname(ptr noundef) local_unnamed_addr #1

declare ptr @OBJ_nid2sn(i32 noundef) local_unnamed_addr #1

declare ptr @EC_KEY_get0_group(ptr noundef) local_unnamed_addr #1

declare ptr @BN_CTX_get(ptr noundef) local_unnamed_addr #1

declare ptr @EC_POINT_new(ptr noundef) local_unnamed_addr #1

declare ptr @BN_lebin2bn(ptr noundef, i32 noundef, ptr noundef) local_unnamed_addr #1

declare i32 @BN_mod_mul(ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #1

declare ptr @EC_KEY_get0_private_key(ptr noundef) local_unnamed_addr #1

declare ptr @EC_GROUP_get0_order(ptr noundef) local_unnamed_addr #1

declare i32 @gost_ec_point_mul(ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #1

declare i32 @EC_POINT_get_affine_coordinates(ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #1

declare i32 @BN_num_bits(ptr noundef) local_unnamed_addr #1

declare ptr @EC_GROUP_get0_field(ptr noundef) local_unnamed_addr #1

declare ptr @CRYPTO_malloc(i64 noundef, ptr noundef, i32 noundef) local_unnamed_addr #1

declare i32 @BN_bn2lebinpad(ptr noundef, ptr noundef, i32 noundef) local_unnamed_addr #1

declare ptr @EVP_MD_CTX_new() local_unnamed_addr #1

declare i32 @EVP_MD_CTX_reset(ptr noundef) local_unnamed_addr #1

declare i32 @EVP_DigestInit_ex(ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #1

declare i32 @EVP_DigestUpdate(ptr noundef, ptr noundef, i64 noundef) local_unnamed_addr #1

declare i32 @EVP_DigestFinal_ex(ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #1

declare i32 @EVP_MD_get_size(ptr noundef) local_unnamed_addr #1

declare void @BN_CTX_end(ptr noundef) local_unnamed_addr #1

declare void @BN_CTX_free(ptr noundef) local_unnamed_addr #1

declare void @EC_POINT_free(ptr noundef) local_unnamed_addr #1

declare void @EVP_MD_CTX_free(ptr noundef) local_unnamed_addr #1

declare void @CRYPTO_free(ptr noundef, ptr noundef, i32 noundef) local_unnamed_addr #1

attributes #0 = { nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { nounwind }

!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}


; Effective O3 passes: EarlyCSEPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,SROAPass,SimplifyCFGPass,TailCallElimPass