; LLVM IR from openssl/openssl :: crypto/ec (ec_asn1)

; 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"

%struct.ec_key_st = type { ptr, ptr, i32, ptr, ptr, ptr, i32, i32, %struct.CRYPTO_REF_COUNT, i32, %struct.crypto_ex_data_st, ptr, ptr, i64 }
%struct.CRYPTO_REF_COUNT = type { i32 }
%struct.crypto_ex_data_st = type { ptr, ptr }
%struct.ec_privatekey_st = type { i32, ptr, ptr, ptr }

@.str.2 = external hidden unnamed_addr constant [69 x i8], align 1
@__func__.i2d_ECPrivateKey = external hidden unnamed_addr constant [17 x i8], align 1

; Function Attrs: nounwind uwtable
declare dso_local i32 @i2d_EC_PRIVATEKEY(ptr noundef, ptr noundef) #0

; Function Attrs: nounwind uwtable
declare dso_local ptr @EC_PRIVATEKEY_new() #0

; Function Attrs: nounwind uwtable
declare dso_local void @EC_PRIVATEKEY_free(ptr noundef) #0

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

declare void @ERR_new() #2

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

declare void @ERR_set_error(i32 noundef, i32 noundef, ptr noundef, ...) #2

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

declare void @ASN1_STRING_set0(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

; Function Attrs: nounwind uwtable
declare dso_local ptr @EC_GROUP_get_ecpkparameters(ptr noundef, ptr noundef) #0

; Function Attrs: nounwind uwtable
define dso_local i32 @i2d_ECPrivateKey(ptr noundef %0, ptr noundef %1) #0 {
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  %9 = alloca i64, align 8
  %10 = alloca i64, align 8
  %11 = alloca ptr, align 8
  store ptr %0, ptr %3, align 8, !tbaa !5
  store ptr %1, ptr %4, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #3
  store i32 0, ptr %5, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #3
  store i32 0, ptr %6, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #3
  store ptr null, ptr %7, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #3
  store ptr null, ptr %8, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #3
  store i64 0, ptr %9, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #3
  store i64 0, ptr %10, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #3
  store ptr null, ptr %11, align 8, !tbaa !5
  %12 = load ptr, ptr %3, align 8, !tbaa !5
  %13 = icmp eq ptr %12, null
  br i1 %13, label %30, label %14

14:                                               ; preds = %2
  %15 = load ptr, ptr %3, align 8, !tbaa !5
  %16 = getelementptr inbounds %struct.ec_key_st, ptr %15, i32 0, i32 3
  %17 = load ptr, ptr %16, align 8, !tbaa !13
  %18 = icmp eq ptr %17, null
  br i1 %18, label %30, label %19

19:                                               ; preds = %14
  %20 = load ptr, ptr %3, align 8, !tbaa !5
  %21 = getelementptr inbounds %struct.ec_key_st, ptr %20, i32 0, i32 6
  %22 = load i32, ptr %21, align 8, !tbaa !17
  %23 = and i32 %22, 2
  %24 = icmp ne i32 %23, 0
  br i1 %24, label %31, label %25

25:                                               ; preds = %19
  %26 = load ptr, ptr %3, align 8, !tbaa !5
  %27 = getelementptr inbounds %struct.ec_key_st, ptr %26, i32 0, i32 4
  %28 = load ptr, ptr %27, align 8, !tbaa !18
  %29 = icmp eq ptr %28, null
  br i1 %29, label %30, label %31

30:                                               ; preds = %25, %14, %2
  call void @ERR_new()
  call void @ERR_set_debug(ptr noundef @.str.2, i32 noundef 1027, ptr noundef @__func__.i2d_ECPrivateKey)
  call void (i32, i32, ptr, ...) @ERR_set_error(i32 noundef 16, i32 noundef 786690, ptr noundef null)
  br label %112

31:                                               ; preds = %25, %19
  %32 = call ptr @EC_PRIVATEKEY_new()
  store ptr %32, ptr %11, align 8, !tbaa !5
  %33 = icmp eq ptr %32, null
  br i1 %33, label %34, label %35

34:                                               ; preds = %31
  call void @ERR_new()
  call void @ERR_set_debug(ptr noundef @.str.2, i32 noundef 1032, ptr noundef @__func__.i2d_ECPrivateKey)
  call void (i32, i32, ptr, ...) @ERR_set_error(i32 noundef 16, i32 noundef 524304, ptr noundef null)
  br label %112

35:                                               ; preds = %31
  %36 = load ptr, ptr %3, align 8, !tbaa !5
  %37 = getelementptr inbounds %struct.ec_key_st, ptr %36, i32 0, i32 2
  %38 = load i32, ptr %37, align 8, !tbaa !19
  %39 = load ptr, ptr %11, align 8, !tbaa !5
  %40 = getelementptr inbounds %struct.ec_privatekey_st, ptr %39, i32 0, i32 0
  store i32 %38, ptr %40, align 8, !tbaa !20
  %41 = load ptr, ptr %3, align 8, !tbaa !5
  %42 = call i64 @EC_KEY_priv2buf(ptr noundef %41, ptr noundef %7)
  store i64 %42, ptr %9, align 8, !tbaa !11
  %43 = load i64, ptr %9, align 8, !tbaa !11
  %44 = icmp eq i64 %43, 0
  br i1 %44, label %45, label %46

45:                                               ; preds = %35
  call void @ERR_new()
  call void @ERR_set_debug(ptr noundef @.str.2, i32 noundef 1041, ptr noundef @__func__.i2d_ECPrivateKey)
  call void (i32, i32, ptr, ...) @ERR_set_error(i32 noundef 16, i32 noundef 524304, ptr noundef null)
  br label %112

46:                                               ; preds = %35
  %47 = load ptr, ptr %11, align 8, !tbaa !5
  %48 = getelementptr inbounds %struct.ec_privatekey_st, ptr %47, i32 0, i32 1
  %49 = load ptr, ptr %48, align 8, !tbaa !22
  %50 = load ptr, ptr %7, align 8, !tbaa !5
  %51 = load i64, ptr %9, align 8, !tbaa !11
  %52 = trunc i64 %51 to i32
  call void @ASN1_STRING_set0(ptr noundef %49, ptr noundef %50, i32 noundef %52)
  store ptr null, ptr %7, align 8, !tbaa !5
  %53 = load ptr, ptr %3, align 8, !tbaa !5
  %54 = getelementptr inbounds %struct.ec_key_st, ptr %53, i32 0, i32 6
  %55 = load i32, ptr %54, align 8, !tbaa !17
  %56 = and i32 %55, 1
  %57 = icmp ne i32 %56, 0
  br i1 %57, label %71, label %58

58:                                               ; preds = %46
  %59 = load ptr, ptr %3, align 8, !tbaa !5
  %60 = getelementptr inbounds %struct.ec_key_st, ptr %59, i32 0, i32 3
  %61 = load ptr, ptr %60, align 8, !tbaa !13
  %62 = load ptr, ptr %11, align 8, !tbaa !5
  %63 = getelementptr inbounds %struct.ec_privatekey_st, ptr %62, i32 0, i32 2
  %64 = load ptr, ptr %63, align 8, !tbaa !23
  %65 = call ptr @EC_GROUP_get_ecpkparameters(ptr noundef %61, ptr noundef %64)
  %66 = load ptr, ptr %11, align 8, !tbaa !5
  %67 = getelementptr inbounds %struct.ec_privatekey_st, ptr %66, i32 0, i32 2
  store ptr %65, ptr %67, align 8, !tbaa !23
  %68 = icmp eq ptr %65, null
  br i1 %68, label %69, label %70

69:                                               ; preds = %58
  call void @ERR_new()
  call void @ERR_set_debug(ptr noundef @.str.2, i32 noundef 1052, ptr noundef @__func__.i2d_ECPrivateKey)
  call void (i32, i32, ptr, ...) @ERR_set_error(i32 noundef 16, i32 noundef 524304, ptr noundef null)
  br label %112

70:                                               ; preds = %58
  br label %71

71:                                               ; preds = %70, %46
  %72 = load ptr, ptr %3, align 8, !tbaa !5
  %73 = getelementptr inbounds %struct.ec_key_st, ptr %72, i32 0, i32 6
  %74 = load i32, ptr %73, align 8, !tbaa !17
  %75 = and i32 %74, 2
  %76 = icmp ne i32 %75, 0
  br i1 %76, label %105, label %77

77:                                               ; preds = %71
  %78 = call ptr @ASN1_BIT_STRING_new()
  %79 = load ptr, ptr %11, align 8, !tbaa !5
  %80 = getelementptr inbounds %struct.ec_privatekey_st, ptr %79, i32 0, i32 3
  store ptr %78, ptr %80, align 8, !tbaa !24
  %81 = load ptr, ptr %11, align 8, !tbaa !5
  %82 = getelementptr inbounds %struct.ec_privatekey_st, ptr %81, i32 0, i32 3
  %83 = load ptr, ptr %82, align 8, !tbaa !24
  %84 = icmp eq ptr %83, null
  br i1 %84, label %85, label %86

85:                                               ; preds = %77
  call void @ERR_new()
  call void @ERR_set_debug(ptr noundef @.str.2, i32 noundef 1060, ptr noundef @__func__.i2d_ECPrivateKey)
  call void (i32, i32, ptr, ...) @ERR_set_error(i32 noundef 16, i32 noundef 524301, ptr noundef null)
  br label %112

86:                                               ; preds = %77
  %87 = load ptr, ptr %3, align 8, !tbaa !5
  %88 = load ptr, ptr %3, align 8, !tbaa !5
  %89 = getelementptr inbounds %struct.ec_key_st, ptr %88, i32 0, i32 7
  %90 = load i32, ptr %89, align 4, !tbaa !25
  %91 = call i64 @EC_KEY_key2buf(ptr noundef %87, i32 noundef %90, ptr noundef %8, ptr noundef null)
  store i64 %91, ptr %10, align 8, !tbaa !11
  %92 = load i64, ptr %10, align 8, !tbaa !11
  %93 = icmp eq i64 %92, 0
  br i1 %93, label %94, label %95

94:                                               ; preds = %86
  call void @ERR_new()
  call void @ERR_set_debug(ptr noundef @.str.2, i32 noundef 1067, ptr noundef @__func__.i2d_ECPrivateKey)
  call void (i32, i32, ptr, ...) @ERR_set_error(i32 noundef 16, i32 noundef 524304, ptr noundef null)
  br label %112

95:                                               ; preds = %86
  %96 = load ptr, ptr %11, align 8, !tbaa !5
  %97 = getelementptr inbounds %struct.ec_privatekey_st, ptr %96, i32 0, i32 3
  %98 = load ptr, ptr %97, align 8, !tbaa !24
  call void @ossl_asn1_string_set_bits_left(ptr noundef %98, i32 noundef 0)
  %99 = load ptr, ptr %11, align 8, !tbaa !5
  %100 = getelementptr inbounds %struct.ec_privatekey_st, ptr %99, i32 0, i32 3
  %101 = load ptr, ptr %100, align 8, !tbaa !24
  %102 = load ptr, ptr %8, align 8, !tbaa !5
  %103 = load i64, ptr %10, align 8, !tbaa !11
  %104 = trunc i64 %103 to i32
  call void @ASN1_STRING_set0(ptr noundef %101, ptr noundef %102, i32 noundef %104)
  store ptr null, ptr %8, align 8, !tbaa !5
  br label %105

105:                                              ; preds = %95, %71
  %106 = load ptr, ptr %11, align 8, !tbaa !5
  %107 = load ptr, ptr %4, align 8, !tbaa !5
  %108 = call i32 @i2d_EC_PRIVATEKEY(ptr noundef %106, ptr noundef %107)
  store i32 %108, ptr %5, align 4, !tbaa !9
  %109 = icmp eq i32 %108, 0
  br i1 %109, label %110, label %111

110:                                              ; preds = %105
  call void @ERR_new()
  call void @ERR_set_debug(ptr noundef @.str.2, i32 noundef 1077, ptr noundef @__func__.i2d_ECPrivateKey)
  call void (i32, i32, ptr, ...) @ERR_set_error(i32 noundef 16, i32 noundef 524304, ptr noundef null)
  br label %112

111:                                              ; preds = %105
  store i32 1, ptr %6, align 4, !tbaa !9
  br label %112

112:                                              ; preds = %111, %110, %94, %85, %69, %45, %34, %30
  %113 = load ptr, ptr %7, align 8, !tbaa !5
  %114 = load i64, ptr %9, align 8, !tbaa !11
  call void @CRYPTO_clear_free(ptr noundef %113, i64 noundef %114, ptr noundef @.str.2, i32 noundef 1082)
  %115 = load ptr, ptr %8, align 8, !tbaa !5
  call void @CRYPTO_free(ptr noundef %115, ptr noundef @.str.2, i32 noundef 1083)
  %116 = load ptr, ptr %11, align 8, !tbaa !5
  call void @EC_PRIVATEKEY_free(ptr noundef %116)
  %117 = load i32, ptr %6, align 4, !tbaa !9
  %118 = icmp ne i32 %117, 0
  br i1 %118, label %119, label %121

119:                                              ; preds = %112
  %120 = load i32, ptr %5, align 4, !tbaa !9
  br label %122

121:                                              ; preds = %112
  br label %122

122:                                              ; preds = %121, %119
  %123 = phi i32 [ %120, %119 ], [ 0, %121 ]
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #3
  ret i32 %123
}

declare i64 @EC_KEY_priv2buf(ptr noundef, ptr noundef) #2

declare ptr @ASN1_BIT_STRING_new() #2

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

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

declare void @CRYPTO_clear_free(ptr noundef, i64 noundef, ptr noundef, i32 noundef) #2

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 = !{!"int", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"long", !7, i64 0}
!13 = !{!14, !6, i64 24}
!14 = !{!"ec_key_st", !6, i64 0, !6, i64 8, !10, i64 16, !6, i64 24, !6, i64 32, !6, i64 40, !10, i64 48, !10, i64 52, !15, i64 56, !10, i64 60, !16, i64 64, !6, i64 80, !6, i64 88, !12, i64 96}
!15 = !{!"", !7, i64 0}
!16 = !{!"crypto_ex_data_st", !6, i64 0, !6, i64 8}
!17 = !{!14, !10, i64 48}
!18 = !{!14, !6, i64 32}
!19 = !{!14, !10, i64 16}
!20 = !{!21, !10, i64 0}
!21 = !{!"ec_privatekey_st", !10, i64 0, !6, i64 8, !6, i64 16, !6, i64 24}
!22 = !{!21, !6, i64 8}
!23 = !{!21, !6, i64 16}
!24 = !{!21, !6, i64 24}
!25 = !{!14, !10, i64 52}


; 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.2 = external hidden unnamed_addr constant [69 x i8], align 1
@__func__.i2d_ECPrivateKey = external hidden unnamed_addr constant [17 x i8], align 1

; Function Attrs: nounwind uwtable
declare dso_local i32 @i2d_EC_PRIVATEKEY(ptr noundef, ptr noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
declare dso_local ptr @EC_PRIVATEKEY_new() local_unnamed_addr #0

; Function Attrs: nounwind uwtable
declare dso_local void @EC_PRIVATEKEY_free(ptr noundef) local_unnamed_addr #0

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

declare void @ERR_new() local_unnamed_addr #2

declare void @ERR_set_debug(ptr noundef, i32 noundef, ptr noundef) local_unnamed_addr #2

declare void @ERR_set_error(i32 noundef, i32 noundef, ptr noundef, ...) local_unnamed_addr #2

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

declare void @ASN1_STRING_set0(ptr noundef, ptr noundef, i32 noundef) local_unnamed_addr #2

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

; Function Attrs: nounwind uwtable
declare dso_local ptr @EC_GROUP_get_ecpkparameters(ptr noundef, ptr noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
define dso_local i32 @i2d_ECPrivateKey(ptr noundef %0, ptr noundef %1) local_unnamed_addr #0 {
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %3) #3
  store ptr null, ptr %3, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %4) #3
  store ptr null, ptr %4, align 8, !tbaa !5
  %5 = icmp eq ptr %0, null
  br i1 %5, label %18, label %6

6:                                                ; preds = %2
  %7 = getelementptr inbounds i8, ptr %0, i64 24
  %8 = load ptr, ptr %7, align 8, !tbaa !9
  %9 = icmp eq ptr %8, null
  br i1 %9, label %18, label %10

10:                                               ; preds = %6
  %11 = getelementptr inbounds i8, ptr %0, i64 48
  %12 = load i32, ptr %11, align 8, !tbaa !15
  %13 = and i32 %12, 2
  %.not = icmp eq i32 %13, 0
  br i1 %.not, label %14, label %19

14:                                               ; preds = %10
  %15 = getelementptr inbounds i8, ptr %0, i64 32
  %16 = load ptr, ptr %15, align 8, !tbaa !16
  %17 = icmp eq ptr %16, null
  br i1 %17, label %18, label %19

18:                                               ; preds = %14, %6, %2
  tail call void @ERR_new() #3
  tail call void @ERR_set_debug(ptr noundef nonnull @.str.2, i32 noundef 1027, ptr noundef nonnull @__func__.i2d_ECPrivateKey) #3
  tail call void (i32, i32, ptr, ...) @ERR_set_error(i32 noundef 16, i32 noundef 786690, ptr noundef null) #3
  br label %66

19:                                               ; preds = %14, %10
  %20 = tail call ptr @EC_PRIVATEKEY_new()
  %21 = icmp eq ptr %20, null
  br i1 %21, label %22, label %23

22:                                               ; preds = %19
  tail call void @ERR_new() #3
  tail call void @ERR_set_debug(ptr noundef nonnull @.str.2, i32 noundef 1032, ptr noundef nonnull @__func__.i2d_ECPrivateKey) #3
  tail call void (i32, i32, ptr, ...) @ERR_set_error(i32 noundef 16, i32 noundef 524304, ptr noundef null) #3
  br label %66

23:                                               ; preds = %19
  %24 = getelementptr inbounds i8, ptr %0, i64 16
  %25 = load i32, ptr %24, align 8, !tbaa !17
  store i32 %25, ptr %20, align 8, !tbaa !18
  %26 = call i64 @EC_KEY_priv2buf(ptr noundef nonnull %0, ptr noundef nonnull %3) #3
  %27 = icmp eq i64 %26, 0
  br i1 %27, label %28, label %29

28:                                               ; preds = %23
  call void @ERR_new() #3
  call void @ERR_set_debug(ptr noundef nonnull @.str.2, i32 noundef 1041, ptr noundef nonnull @__func__.i2d_ECPrivateKey) #3
  call void (i32, i32, ptr, ...) @ERR_set_error(i32 noundef 16, i32 noundef 524304, ptr noundef null) #3
  br label %66

29:                                               ; preds = %23
  %30 = getelementptr inbounds i8, ptr %20, i64 8
  %31 = load ptr, ptr %30, align 8, !tbaa !20
  %32 = load ptr, ptr %3, align 8, !tbaa !5
  %33 = trunc i64 %26 to i32
  call void @ASN1_STRING_set0(ptr noundef %31, ptr noundef %32, i32 noundef %33) #3
  store ptr null, ptr %3, align 8, !tbaa !5
  %34 = load i32, ptr %11, align 8, !tbaa !15
  %35 = and i32 %34, 1
  %.not38 = icmp eq i32 %35, 0
  br i1 %.not38, label %36, label %43

36:                                               ; preds = %29
  %37 = load ptr, ptr %7, align 8, !tbaa !9
  %38 = getelementptr inbounds i8, ptr %20, i64 16
  %39 = load ptr, ptr %38, align 8, !tbaa !21
  %40 = call ptr @EC_GROUP_get_ecpkparameters(ptr noundef %37, ptr noundef %39)
  store ptr %40, ptr %38, align 8, !tbaa !21
  %41 = icmp eq ptr %40, null
  br i1 %41, label %42, label %._crit_edge

._crit_edge:                                      ; preds = %36
  %.pre = load i32, ptr %11, align 8, !tbaa !15
  br label %43

42:                                               ; preds = %36
  call void @ERR_new() #3
  call void @ERR_set_debug(ptr noundef nonnull @.str.2, i32 noundef 1052, ptr noundef nonnull @__func__.i2d_ECPrivateKey) #3
  call void (i32, i32, ptr, ...) @ERR_set_error(i32 noundef 16, i32 noundef 524304, ptr noundef null) #3
  br label %66

43:                                               ; preds = %._crit_edge, %29
  %44 = phi i32 [ %.pre, %._crit_edge ], [ %34, %29 ]
  %45 = and i32 %44, 2
  %.not39 = icmp eq i32 %45, 0
  br i1 %.not39, label %46, label %62

46:                                               ; preds = %43
  %47 = call ptr @ASN1_BIT_STRING_new() #3
  %48 = getelementptr inbounds i8, ptr %20, i64 24
  store ptr %47, ptr %48, align 8, !tbaa !22
  %49 = icmp eq ptr %47, null
  br i1 %49, label %50, label %51

50:                                               ; preds = %46
  call void @ERR_new() #3
  call void @ERR_set_debug(ptr noundef nonnull @.str.2, i32 noundef 1060, ptr noundef nonnull @__func__.i2d_ECPrivateKey) #3
  call void (i32, i32, ptr, ...) @ERR_set_error(i32 noundef 16, i32 noundef 524301, ptr noundef null) #3
  br label %66

51:                                               ; preds = %46
  %52 = getelementptr inbounds i8, ptr %0, i64 52
  %53 = load i32, ptr %52, align 4, !tbaa !23
  %54 = call i64 @EC_KEY_key2buf(ptr noundef nonnull %0, i32 noundef %53, ptr noundef nonnull %4, ptr noundef null) #3
  %55 = icmp eq i64 %54, 0
  br i1 %55, label %56, label %57

56:                                               ; preds = %51
  call void @ERR_new() #3
  call void @ERR_set_debug(ptr noundef nonnull @.str.2, i32 noundef 1067, ptr noundef nonnull @__func__.i2d_ECPrivateKey) #3
  call void (i32, i32, ptr, ...) @ERR_set_error(i32 noundef 16, i32 noundef 524304, ptr noundef null) #3
  br label %66

57:                                               ; preds = %51
  %58 = load ptr, ptr %48, align 8, !tbaa !22
  call void @ossl_asn1_string_set_bits_left(ptr noundef %58, i32 noundef 0) #3
  %59 = load ptr, ptr %48, align 8, !tbaa !22
  %60 = load ptr, ptr %4, align 8, !tbaa !5
  %61 = trunc i64 %54 to i32
  call void @ASN1_STRING_set0(ptr noundef %59, ptr noundef %60, i32 noundef %61) #3
  store ptr null, ptr %4, align 8, !tbaa !5
  br label %62

62:                                               ; preds = %57, %43
  %63 = call i32 @i2d_EC_PRIVATEKEY(ptr noundef nonnull %20, ptr noundef %1)
  %64 = icmp eq i32 %63, 0
  br i1 %64, label %65, label %66

65:                                               ; preds = %62
  call void @ERR_new() #3
  call void @ERR_set_debug(ptr noundef nonnull @.str.2, i32 noundef 1077, ptr noundef nonnull @__func__.i2d_ECPrivateKey) #3
  call void (i32, i32, ptr, ...) @ERR_set_error(i32 noundef 16, i32 noundef 524304, ptr noundef null) #3
  br label %66

66:                                               ; preds = %62, %65, %56, %50, %42, %28, %22, %18
  %.not40 = phi i32 [ 0, %18 ], [ 0, %22 ], [ 0, %28 ], [ 0, %65 ], [ 0, %50 ], [ 0, %56 ], [ 0, %42 ], [ %63, %62 ]
  %.028 = phi i64 [ 0, %18 ], [ 0, %22 ], [ 0, %28 ], [ %26, %65 ], [ %26, %50 ], [ %26, %56 ], [ %26, %42 ], [ %26, %62 ]
  %.0 = phi ptr [ null, %18 ], [ null, %22 ], [ %20, %28 ], [ %20, %65 ], [ %20, %50 ], [ %20, %56 ], [ %20, %42 ], [ %20, %62 ]
  %67 = load ptr, ptr %3, align 8, !tbaa !5
  call void @CRYPTO_clear_free(ptr noundef %67, i64 noundef %.028, ptr noundef nonnull @.str.2, i32 noundef 1082) #3
  %68 = load ptr, ptr %4, align 8, !tbaa !5
  call void @CRYPTO_free(ptr noundef %68, ptr noundef nonnull @.str.2, i32 noundef 1083) #3
  call void @EC_PRIVATEKEY_free(ptr noundef %.0)
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %3) #3
  ret i32 %.not40
}

declare i64 @EC_KEY_priv2buf(ptr noundef, ptr noundef) local_unnamed_addr #2

declare ptr @ASN1_BIT_STRING_new() local_unnamed_addr #2

declare i64 @EC_KEY_key2buf(ptr noundef, i32 noundef, ptr noundef, ptr noundef) local_unnamed_addr #2

declare void @ossl_asn1_string_set_bits_left(ptr noundef, i32 noundef) local_unnamed_addr #2

declare void @CRYPTO_clear_free(ptr noundef, i64 noundef, ptr noundef, i32 noundef) local_unnamed_addr #2

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 = { mustprogress 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, !6, i64 24}
!10 = !{!"ec_key_st", !6, i64 0, !6, i64 8, !11, i64 16, !6, i64 24, !6, i64 32, !6, i64 40, !11, i64 48, !11, i64 52, !12, i64 56, !11, i64 60, !13, i64 64, !6, i64 80, !6, i64 88, !14, i64 96}
!11 = !{!"int", !7, i64 0}
!12 = !{!"", !7, i64 0}
!13 = !{!"crypto_ex_data_st", !6, i64 0, !6, i64 8}
!14 = !{!"long", !7, i64 0}
!15 = !{!10, !11, i64 48}
!16 = !{!10, !6, i64 32}
!17 = !{!10, !11, i64 16}
!18 = !{!19, !11, i64 0}
!19 = !{!"ec_privatekey_st", !11, i64 0, !6, i64 8, !6, i64 16, !6, i64 24}
!20 = !{!19, !6, i64 8}
!21 = !{!19, !6, i64 16}
!22 = !{!19, !6, i64 24}
!23 = !{!10, !11, i64 52}


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