; 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_privatekey_st = type { i32, ptr, ptr, ptr }
%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.ecpk_parameters_st = type { i32, %union.anon }
%union.anon = type { ptr }
%struct.ec_group_st = type { ptr, ptr, ptr, ptr, i32, i32, i32, i32, ptr, i64, ptr, [6 x i32], ptr, ptr, i32, ptr, ptr, ptr, ptr, i32, %union.anon.2, ptr, ptr }
%union.anon.2 = type { ptr }
%struct.ec_method_st = type { i32, i32, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr }

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

; Function Attrs: nounwind uwtable
declare dso_local ptr @d2i_EC_PRIVATEKEY(ptr noundef, ptr noundef, i64 noundef) #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

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

declare i32 @EC_GROUP_get_curve_name(ptr noundef) #2

declare ptr @EC_POINT_new(ptr noundef) #2

declare void @EC_GROUP_free(ptr noundef) #2

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

; Function Attrs: nounwind uwtable
define dso_local ptr @d2i_ECPrivateKey(ptr noundef %0, ptr noundef %1, i64 noundef %2) #0 {
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca i64, align 8
  %8 = alloca ptr, align 8
  %9 = alloca ptr, align 8
  %10 = alloca ptr, align 8
  %11 = alloca i32, align 4
  %12 = alloca ptr, align 8
  %13 = alloca ptr, align 8
  %14 = alloca i32, align 4
  store ptr %0, ptr %5, align 8, !tbaa !5
  store ptr %1, ptr %6, align 8, !tbaa !5
  store i64 %2, ptr %7, align 8, !tbaa !9
  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 ptr null, ptr %9, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #3
  %15 = load ptr, ptr %6, align 8, !tbaa !5
  %16 = load ptr, ptr %15, align 8, !tbaa !5
  store ptr %16, ptr %10, align 8, !tbaa !5
  %17 = load i64, ptr %7, align 8, !tbaa !9
  %18 = call ptr @d2i_EC_PRIVATEKEY(ptr noundef null, ptr noundef %10, i64 noundef %17)
  store ptr %18, ptr %9, align 8, !tbaa !5
  %19 = icmp eq ptr %18, null
  br i1 %19, label %20, label %21

20:                                               ; preds = %3
  store ptr null, ptr %4, align 8
  store i32 1, ptr %11, align 4
  br label %203

21:                                               ; preds = %3
  %22 = load ptr, ptr %5, align 8, !tbaa !5
  %23 = icmp eq ptr %22, null
  br i1 %23, label %28, label %24

24:                                               ; preds = %21
  %25 = load ptr, ptr %5, align 8, !tbaa !5
  %26 = load ptr, ptr %25, align 8, !tbaa !5
  %27 = icmp eq ptr %26, null
  br i1 %27, label %28, label %33

28:                                               ; preds = %24, %21
  %29 = call ptr @EC_KEY_new()
  store ptr %29, ptr %8, align 8, !tbaa !5
  %30 = icmp eq ptr %29, null
  br i1 %30, label %31, label %32

31:                                               ; preds = %28
  call void @ERR_new()
  call void @ERR_set_debug(ptr noundef @.str.2, i32 noundef 944, ptr noundef @__func__.d2i_ECPrivateKey)
  call void (i32, i32, ptr, ...) @ERR_set_error(i32 noundef 16, i32 noundef 524304, ptr noundef null)
  br label %191

32:                                               ; preds = %28
  br label %36

33:                                               ; preds = %24
  %34 = load ptr, ptr %5, align 8, !tbaa !5
  %35 = load ptr, ptr %34, align 8, !tbaa !5
  store ptr %35, ptr %8, align 8, !tbaa !5
  br label %36

36:                                               ; preds = %33, %32
  %37 = load ptr, ptr %9, align 8, !tbaa !5
  %38 = getelementptr inbounds %struct.ec_privatekey_st, ptr %37, i32 0, i32 2
  %39 = load ptr, ptr %38, align 8, !tbaa !11
  %40 = icmp ne ptr %39, null
  br i1 %40, label %41, label %68

41:                                               ; preds = %36
  %42 = load ptr, ptr %8, align 8, !tbaa !5
  %43 = getelementptr inbounds %struct.ec_key_st, ptr %42, i32 0, i32 3
  %44 = load ptr, ptr %43, align 8, !tbaa !14
  call void @EC_GROUP_free(ptr noundef %44)
  %45 = load ptr, ptr %9, align 8, !tbaa !5
  %46 = getelementptr inbounds %struct.ec_privatekey_st, ptr %45, i32 0, i32 2
  %47 = load ptr, ptr %46, align 8, !tbaa !11
  %48 = call ptr @EC_GROUP_new_from_ecpkparameters(ptr noundef %47)
  %49 = load ptr, ptr %8, align 8, !tbaa !5
  %50 = getelementptr inbounds %struct.ec_key_st, ptr %49, i32 0, i32 3
  store ptr %48, ptr %50, align 8, !tbaa !14
  %51 = load ptr, ptr %8, align 8, !tbaa !5
  %52 = getelementptr inbounds %struct.ec_key_st, ptr %51, i32 0, i32 3
  %53 = load ptr, ptr %52, align 8, !tbaa !14
  %54 = icmp ne ptr %53, null
  br i1 %54, label %55, label %67

55:                                               ; preds = %41
  %56 = load ptr, ptr %9, align 8, !tbaa !5
  %57 = getelementptr inbounds %struct.ec_privatekey_st, ptr %56, i32 0, i32 2
  %58 = load ptr, ptr %57, align 8, !tbaa !11
  %59 = getelementptr inbounds %struct.ecpk_parameters_st, ptr %58, i32 0, i32 0
  %60 = load i32, ptr %59, align 8, !tbaa !18
  %61 = icmp eq i32 %60, 1
  br i1 %61, label %62, label %67

62:                                               ; preds = %55
  %63 = load ptr, ptr %8, align 8, !tbaa !5
  %64 = getelementptr inbounds %struct.ec_key_st, ptr %63, i32 0, i32 3
  %65 = load ptr, ptr %64, align 8, !tbaa !14
  %66 = getelementptr inbounds %struct.ec_group_st, ptr %65, i32 0, i32 6
  store i32 1, ptr %66, align 8, !tbaa !20
  br label %67

67:                                               ; preds = %62, %55, %41
  br label %68

68:                                               ; preds = %67, %36
  %69 = load ptr, ptr %8, align 8, !tbaa !5
  %70 = getelementptr inbounds %struct.ec_key_st, ptr %69, i32 0, i32 3
  %71 = load ptr, ptr %70, align 8, !tbaa !14
  %72 = icmp eq ptr %71, null
  br i1 %72, label %73, label %74

73:                                               ; preds = %68
  call void @ERR_new()
  call void @ERR_set_debug(ptr noundef @.str.2, i32 noundef 959, ptr noundef @__func__.d2i_ECPrivateKey)
  call void (i32, i32, ptr, ...) @ERR_set_error(i32 noundef 16, i32 noundef 524304, ptr noundef null)
  br label %191

74:                                               ; preds = %68
  %75 = load ptr, ptr %9, align 8, !tbaa !5
  %76 = getelementptr inbounds %struct.ec_privatekey_st, ptr %75, i32 0, i32 0
  %77 = load i32, ptr %76, align 8, !tbaa !22
  %78 = load ptr, ptr %8, align 8, !tbaa !5
  %79 = getelementptr inbounds %struct.ec_key_st, ptr %78, i32 0, i32 2
  store i32 %77, ptr %79, align 8, !tbaa !23
  %80 = load ptr, ptr %9, align 8, !tbaa !5
  %81 = getelementptr inbounds %struct.ec_privatekey_st, ptr %80, i32 0, i32 1
  %82 = load ptr, ptr %81, align 8, !tbaa !24
  %83 = icmp ne ptr %82, null
  br i1 %83, label %84, label %101

84:                                               ; preds = %74
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #3
  %85 = load ptr, ptr %9, align 8, !tbaa !5
  %86 = getelementptr inbounds %struct.ec_privatekey_st, ptr %85, i32 0, i32 1
  %87 = load ptr, ptr %86, align 8, !tbaa !24
  store ptr %87, ptr %12, align 8, !tbaa !5
  %88 = load ptr, ptr %8, align 8, !tbaa !5
  %89 = load ptr, ptr %12, align 8, !tbaa !5
  %90 = call ptr @ASN1_STRING_get0_data(ptr noundef %89)
  %91 = load ptr, ptr %12, align 8, !tbaa !5
  %92 = call i32 @ASN1_STRING_length(ptr noundef %91)
  %93 = sext i32 %92 to i64
  %94 = call i32 @EC_KEY_oct2priv(ptr noundef %88, ptr noundef %90, i64 noundef %93)
  %95 = icmp eq i32 %94, 0
  br i1 %95, label %96, label %97

96:                                               ; preds = %84
  store i32 2, ptr %11, align 4
  br label %98

97:                                               ; preds = %84
  store i32 0, ptr %11, align 4
  br label %98

98:                                               ; preds = %97, %96
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #3
  %99 = load i32, ptr %11, align 4
  switch i32 %99, label %203 [
    i32 0, label %100
    i32 2, label %191
  ]

100:                                              ; preds = %98
  br label %102

101:                                              ; preds = %74
  call void @ERR_new()
  call void @ERR_set_debug(ptr noundef @.str.2, i32 noundef 971, ptr noundef @__func__.d2i_ECPrivateKey)
  call void (i32, i32, ptr, ...) @ERR_set_error(i32 noundef 16, i32 noundef 125, ptr noundef null)
  br label %191

102:                                              ; preds = %100
  %103 = load ptr, ptr %8, align 8, !tbaa !5
  %104 = getelementptr inbounds %struct.ec_key_st, ptr %103, i32 0, i32 3
  %105 = load ptr, ptr %104, align 8, !tbaa !14
  %106 = call i32 @EC_GROUP_get_curve_name(ptr noundef %105)
  %107 = icmp eq i32 %106, 1172
  br i1 %107, label %108, label %110

108:                                              ; preds = %102
  %109 = load ptr, ptr %8, align 8, !tbaa !5
  call void @EC_KEY_set_flags(ptr noundef %109, i32 noundef 4)
  br label %110

110:                                              ; preds = %108, %102
  %111 = load ptr, ptr %8, align 8, !tbaa !5
  %112 = getelementptr inbounds %struct.ec_key_st, ptr %111, i32 0, i32 4
  %113 = load ptr, ptr %112, align 8, !tbaa !25
  call void @EC_POINT_clear_free(ptr noundef %113)
  %114 = load ptr, ptr %8, align 8, !tbaa !5
  %115 = getelementptr inbounds %struct.ec_key_st, ptr %114, i32 0, i32 3
  %116 = load ptr, ptr %115, align 8, !tbaa !14
  %117 = call ptr @EC_POINT_new(ptr noundef %116)
  %118 = load ptr, ptr %8, align 8, !tbaa !5
  %119 = getelementptr inbounds %struct.ec_key_st, ptr %118, i32 0, i32 4
  store ptr %117, ptr %119, align 8, !tbaa !25
  %120 = load ptr, ptr %8, align 8, !tbaa !5
  %121 = getelementptr inbounds %struct.ec_key_st, ptr %120, i32 0, i32 4
  %122 = load ptr, ptr %121, align 8, !tbaa !25
  %123 = icmp eq ptr %122, null
  br i1 %123, label %124, label %125

124:                                              ; preds = %110
  call void @ERR_new()
  call void @ERR_set_debug(ptr noundef @.str.2, i32 noundef 981, ptr noundef @__func__.d2i_ECPrivateKey)
  call void (i32, i32, ptr, ...) @ERR_set_error(i32 noundef 16, i32 noundef 524304, ptr noundef null)
  br label %191

125:                                              ; preds = %110
  %126 = load ptr, ptr %9, align 8, !tbaa !5
  %127 = getelementptr inbounds %struct.ec_privatekey_st, ptr %126, i32 0, i32 3
  %128 = load ptr, ptr %127, align 8, !tbaa !26
  %129 = icmp ne ptr %128, null
  br i1 %129, label %130, label %150

130:                                              ; preds = %125
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #3
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #3
  %131 = load ptr, ptr %9, align 8, !tbaa !5
  %132 = getelementptr inbounds %struct.ec_privatekey_st, ptr %131, i32 0, i32 3
  %133 = load ptr, ptr %132, align 8, !tbaa !26
  %134 = call ptr @ASN1_STRING_get0_data(ptr noundef %133)
  store ptr %134, ptr %13, align 8, !tbaa !5
  %135 = load ptr, ptr %9, align 8, !tbaa !5
  %136 = getelementptr inbounds %struct.ec_privatekey_st, ptr %135, i32 0, i32 3
  %137 = load ptr, ptr %136, align 8, !tbaa !26
  %138 = call i32 @ASN1_STRING_length(ptr noundef %137)
  store i32 %138, ptr %14, align 4, !tbaa !27
  %139 = load ptr, ptr %8, align 8, !tbaa !5
  %140 = load ptr, ptr %13, align 8, !tbaa !5
  %141 = load i32, ptr %14, align 4, !tbaa !27
  %142 = sext i32 %141 to i64
  %143 = call i32 @EC_KEY_oct2key(ptr noundef %139, ptr noundef %140, i64 noundef %142, ptr noundef null)
  %144 = icmp ne i32 %143, 0
  br i1 %144, label %146, label %145

145:                                              ; preds = %130
  call void @ERR_new()
  call void @ERR_set_debug(ptr noundef @.str.2, i32 noundef 992, ptr noundef @__func__.d2i_ECPrivateKey)
  call void (i32, i32, ptr, ...) @ERR_set_error(i32 noundef 16, i32 noundef 524304, ptr noundef null)
  store i32 2, ptr %11, align 4
  br label %147

146:                                              ; preds = %130
  store i32 0, ptr %11, align 4
  br label %147

147:                                              ; preds = %146, %145
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #3
  %148 = load i32, ptr %11, align 4
  switch i32 %148, label %203 [
    i32 0, label %149
    i32 2, label %191
  ]

149:                                              ; preds = %147
  br label %176

150:                                              ; preds = %125
  %151 = load ptr, ptr %8, align 8, !tbaa !5
  %152 = getelementptr inbounds %struct.ec_key_st, ptr %151, i32 0, i32 3
  %153 = load ptr, ptr %152, align 8, !tbaa !14
  %154 = getelementptr inbounds %struct.ec_group_st, ptr %153, i32 0, i32 0
  %155 = load ptr, ptr %154, align 8, !tbaa !28
  %156 = getelementptr inbounds %struct.ec_method_st, ptr %155, i32 0, i32 44
  %157 = load ptr, ptr %156, align 8, !tbaa !29
  %158 = icmp eq ptr %157, null
  br i1 %158, label %170, label %159

159:                                              ; preds = %150
  %160 = load ptr, ptr %8, align 8, !tbaa !5
  %161 = getelementptr inbounds %struct.ec_key_st, ptr %160, i32 0, i32 3
  %162 = load ptr, ptr %161, align 8, !tbaa !14
  %163 = getelementptr inbounds %struct.ec_group_st, ptr %162, i32 0, i32 0
  %164 = load ptr, ptr %163, align 8, !tbaa !28
  %165 = getelementptr inbounds %struct.ec_method_st, ptr %164, i32 0, i32 44
  %166 = load ptr, ptr %165, align 8, !tbaa !29
  %167 = load ptr, ptr %8, align 8, !tbaa !5
  %168 = call i32 %166(ptr noundef %167)
  %169 = icmp eq i32 %168, 0
  br i1 %169, label %170, label %171

170:                                              ; preds = %159, %150
  br label %191

171:                                              ; preds = %159
  %172 = load ptr, ptr %8, align 8, !tbaa !5
  %173 = getelementptr inbounds %struct.ec_key_st, ptr %172, i32 0, i32 6
  %174 = load i32, ptr %173, align 8, !tbaa !31
  %175 = or i32 %174, 2
  store i32 %175, ptr %173, align 8, !tbaa !31
  br label %176

176:                                              ; preds = %171, %149
  %177 = load ptr, ptr %5, align 8, !tbaa !5
  %178 = icmp ne ptr %177, null
  br i1 %178, label %179, label %182

179:                                              ; preds = %176
  %180 = load ptr, ptr %8, align 8, !tbaa !5
  %181 = load ptr, ptr %5, align 8, !tbaa !5
  store ptr %180, ptr %181, align 8, !tbaa !5
  br label %182

182:                                              ; preds = %179, %176
  %183 = load ptr, ptr %9, align 8, !tbaa !5
  call void @EC_PRIVATEKEY_free(ptr noundef %183)
  %184 = load ptr, ptr %10, align 8, !tbaa !5
  %185 = load ptr, ptr %6, align 8, !tbaa !5
  store ptr %184, ptr %185, align 8, !tbaa !5
  %186 = load ptr, ptr %8, align 8, !tbaa !5
  %187 = getelementptr inbounds %struct.ec_key_st, ptr %186, i32 0, i32 13
  %188 = load i64, ptr %187, align 8, !tbaa !32
  %189 = add i64 %188, 1
  store i64 %189, ptr %187, align 8, !tbaa !32
  %190 = load ptr, ptr %8, align 8, !tbaa !5
  store ptr %190, ptr %4, align 8
  store i32 1, ptr %11, align 4
  br label %203

191:                                              ; preds = %170, %147, %124, %101, %98, %73, %31
  %192 = load ptr, ptr %5, align 8, !tbaa !5
  %193 = icmp eq ptr %192, null
  br i1 %193, label %199, label %194

194:                                              ; preds = %191
  %195 = load ptr, ptr %5, align 8, !tbaa !5
  %196 = load ptr, ptr %195, align 8, !tbaa !5
  %197 = load ptr, ptr %8, align 8, !tbaa !5
  %198 = icmp ne ptr %196, %197
  br i1 %198, label %199, label %201

199:                                              ; preds = %194, %191
  %200 = load ptr, ptr %8, align 8, !tbaa !5
  call void @EC_KEY_free(ptr noundef %200)
  br label %201

201:                                              ; preds = %199, %194
  %202 = load ptr, ptr %9, align 8, !tbaa !5
  call void @EC_PRIVATEKEY_free(ptr noundef %202)
  store ptr null, ptr %4, align 8
  store i32 1, ptr %11, align 4
  br label %203

203:                                              ; preds = %201, %182, %147, %98, %20
  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
  %204 = load ptr, ptr %4, align 8
  ret ptr %204
}

declare ptr @EC_KEY_new() #2

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

declare ptr @ASN1_STRING_get0_data(ptr noundef) #2

declare i32 @ASN1_STRING_length(ptr noundef) #2

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

declare void @EC_POINT_clear_free(ptr noundef) #2

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

declare void @EC_KEY_free(ptr 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 = !{!"long", !7, i64 0}
!11 = !{!12, !6, i64 16}
!12 = !{!"ec_privatekey_st", !13, i64 0, !6, i64 8, !6, i64 16, !6, i64 24}
!13 = !{!"int", !7, i64 0}
!14 = !{!15, !6, i64 24}
!15 = !{!"ec_key_st", !6, i64 0, !6, i64 8, !13, i64 16, !6, i64 24, !6, i64 32, !6, i64 40, !13, i64 48, !13, i64 52, !16, i64 56, !13, i64 60, !17, i64 64, !6, i64 80, !6, i64 88, !10, i64 96}
!16 = !{!"", !7, i64 0}
!17 = !{!"crypto_ex_data_st", !6, i64 0, !6, i64 8}
!18 = !{!19, !13, i64 0}
!19 = !{!"ecpk_parameters_st", !13, i64 0, !7, i64 8}
!20 = !{!21, !13, i64 40}
!21 = !{!"ec_group_st", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !13, i64 32, !13, i64 36, !13, i64 40, !13, i64 44, !6, i64 48, !10, i64 56, !6, i64 64, !7, i64 72, !6, i64 96, !6, i64 104, !13, i64 112, !6, i64 120, !6, i64 128, !6, i64 136, !6, i64 144, !13, i64 152, !7, i64 160, !6, i64 168, !6, i64 176}
!22 = !{!12, !13, i64 0}
!23 = !{!15, !13, i64 16}
!24 = !{!12, !6, i64 8}
!25 = !{!15, !6, i64 32}
!26 = !{!12, !6, i64 24}
!27 = !{!13, !13, i64 0}
!28 = !{!21, !6, i64 0}
!29 = !{!30, !6, i64 344}
!30 = !{!"ec_method_st", !13, i64 0, !13, i64 4, !6, i64 8, !6, i64 16, !6, i64 24, !6, i64 32, !6, i64 40, !6, i64 48, !6, i64 56, !6, i64 64, !6, i64 72, !6, i64 80, !6, i64 88, !6, i64 96, !6, i64 104, !6, i64 112, !6, i64 120, !6, i64 128, !6, i64 136, !6, i64 144, !6, i64 152, !6, i64 160, !6, i64 168, !6, i64 176, !6, i64 184, !6, i64 192, !6, i64 200, !6, i64 208, !6, i64 216, !6, i64 224, !6, i64 232, !6, i64 240, !6, i64 248, !6, i64 256, !6, i64 264, !6, i64 272, !6, i64 280, !6, i64 288, !6, i64 296, !6, i64 304, !6, i64 312, !6, i64 320, !6, i64 328, !6, i64 336, !6, i64 344, !6, i64 352, !6, i64 360, !6, i64 368, !6, i64 376, !6, i64 384, !6, i64 392, !6, i64 400, !6, i64 408, !6, i64 416, !6, i64 424, !6, i64 432, !6, i64 440}
!31 = !{!15, !13, i64 48}
!32 = !{!15, !10, i64 96}


; 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__.d2i_ECPrivateKey = external hidden unnamed_addr constant [17 x i8], align 1

; Function Attrs: nounwind uwtable
declare dso_local ptr @d2i_EC_PRIVATEKEY(ptr noundef, ptr noundef, i64 noundef) 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

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

declare i32 @EC_GROUP_get_curve_name(ptr noundef) local_unnamed_addr #2

declare ptr @EC_POINT_new(ptr noundef) local_unnamed_addr #2

declare void @EC_GROUP_free(ptr noundef) local_unnamed_addr #2

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

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

8:                                                ; preds = %3
  %9 = icmp eq ptr %0, null
  br i1 %9, label %13, label %10

10:                                               ; preds = %8
  %11 = load ptr, ptr %0, align 8, !tbaa !5
  %12 = icmp eq ptr %11, null
  br i1 %12, label %13, label %16

13:                                               ; preds = %10, %8
  %14 = call ptr @EC_KEY_new() #3
  %15 = icmp eq ptr %14, null
  br i1 %15, label %.sink.split, label %16

16:                                               ; preds = %10, %13
  %.050 = phi ptr [ %14, %13 ], [ %11, %10 ]
  %17 = getelementptr inbounds i8, ptr %6, i64 16
  %18 = load ptr, ptr %17, align 8, !tbaa !9
  %.not = icmp eq ptr %18, null
  %.phi.trans.insert = getelementptr inbounds i8, ptr %.050, i64 24
  %.pre = load ptr, ptr %.phi.trans.insert, align 8, !tbaa !12
  br i1 %.not, label %28, label %19

19:                                               ; preds = %16
  call void @EC_GROUP_free(ptr noundef %.pre) #3
  %20 = load ptr, ptr %17, align 8, !tbaa !9
  %21 = call ptr @EC_GROUP_new_from_ecpkparameters(ptr noundef %20)
  store ptr %21, ptr %.phi.trans.insert, align 8, !tbaa !12
  %.not63 = icmp eq ptr %21, null
  br i1 %.not63, label %.sink.split, label %22

22:                                               ; preds = %19
  %23 = load ptr, ptr %17, align 8, !tbaa !9
  %24 = load i32, ptr %23, align 8, !tbaa !17
  %25 = icmp eq i32 %24, 1
  br i1 %25, label %26, label %.thread72

26:                                               ; preds = %22
  %27 = getelementptr inbounds i8, ptr %21, i64 40
  store i32 1, ptr %27, align 8, !tbaa !19
  br label %.thread72

28:                                               ; preds = %16
  %29 = icmp eq ptr %.pre, null
  br i1 %29, label %.sink.split, label %.thread72

.thread72:                                        ; preds = %26, %22, %28
  %30 = getelementptr inbounds i8, ptr %.050, i64 24
  %31 = load i32, ptr %6, align 8, !tbaa !21
  %32 = getelementptr inbounds i8, ptr %.050, i64 16
  store i32 %31, ptr %32, align 8, !tbaa !22
  %33 = getelementptr inbounds i8, ptr %6, i64 8
  %34 = load ptr, ptr %33, align 8, !tbaa !23
  %.not64 = icmp eq ptr %34, null
  br i1 %.not64, label %.sink.split, label %35

35:                                               ; preds = %.thread72
  %36 = call ptr @ASN1_STRING_get0_data(ptr noundef nonnull %34) #3
  %37 = call i32 @ASN1_STRING_length(ptr noundef nonnull %34) #3
  %38 = sext i32 %37 to i64
  %39 = call i32 @EC_KEY_oct2priv(ptr noundef nonnull %.050, ptr noundef %36, i64 noundef %38) #3
  %40 = icmp eq i32 %39, 0
  br i1 %40, label %80, label %41

41:                                               ; preds = %35
  %42 = load ptr, ptr %30, align 8, !tbaa !12
  %43 = call i32 @EC_GROUP_get_curve_name(ptr noundef %42) #3
  %44 = icmp eq i32 %43, 1172
  br i1 %44, label %45, label %46

45:                                               ; preds = %41
  call void @EC_KEY_set_flags(ptr noundef nonnull %.050, i32 noundef 4) #3
  br label %46

46:                                               ; preds = %45, %41
  %47 = getelementptr inbounds i8, ptr %.050, i64 32
  %48 = load ptr, ptr %47, align 8, !tbaa !24
  call void @EC_POINT_clear_free(ptr noundef %48) #3
  %49 = load ptr, ptr %30, align 8, !tbaa !12
  %50 = call ptr @EC_POINT_new(ptr noundef %49) #3
  store ptr %50, ptr %47, align 8, !tbaa !24
  %51 = icmp eq ptr %50, null
  br i1 %51, label %.sink.split, label %52

52:                                               ; preds = %46
  %53 = getelementptr inbounds i8, ptr %6, i64 24
  %54 = load ptr, ptr %53, align 8, !tbaa !25
  %.not65 = icmp eq ptr %54, null
  br i1 %.not65, label %61, label %55

55:                                               ; preds = %52
  %56 = call ptr @ASN1_STRING_get0_data(ptr noundef nonnull %54) #3
  %57 = load ptr, ptr %53, align 8, !tbaa !25
  %58 = call i32 @ASN1_STRING_length(ptr noundef %57) #3
  %59 = sext i32 %58 to i64
  %60 = call i32 @EC_KEY_oct2key(ptr noundef nonnull %.050, ptr noundef %56, i64 noundef %59, ptr noundef null) #3
  %.not66 = icmp eq i32 %60, 0
  br i1 %.not66, label %.sink.split, label %.thread

61:                                               ; preds = %52
  %62 = load ptr, ptr %30, align 8, !tbaa !12
  %63 = load ptr, ptr %62, align 8, !tbaa !26
  %64 = getelementptr inbounds i8, ptr %63, i64 344
  %65 = load ptr, ptr %64, align 8, !tbaa !27
  %66 = icmp eq ptr %65, null
  br i1 %66, label %80, label %67

67:                                               ; preds = %61
  %68 = call i32 %65(ptr noundef nonnull %.050) #3
  %69 = icmp eq i32 %68, 0
  br i1 %69, label %80, label %70

70:                                               ; preds = %67
  %71 = getelementptr inbounds i8, ptr %.050, i64 48
  %72 = load i32, ptr %71, align 8, !tbaa !29
  %73 = or i32 %72, 2
  store i32 %73, ptr %71, align 8, !tbaa !29
  br label %.thread

.thread:                                          ; preds = %55, %70
  br i1 %9, label %75, label %74

74:                                               ; preds = %.thread
  store ptr %.050, ptr %0, align 8, !tbaa !5
  br label %75

75:                                               ; preds = %74, %.thread
  call void @EC_PRIVATEKEY_free(ptr noundef nonnull %6)
  %76 = load ptr, ptr %4, align 8, !tbaa !5
  store ptr %76, ptr %1, align 8, !tbaa !5
  %77 = getelementptr inbounds i8, ptr %.050, i64 96
  %78 = load i64, ptr %77, align 8, !tbaa !30
  %79 = add i64 %78, 1
  store i64 %79, ptr %77, align 8, !tbaa !30
  br label %85

.sink.split:                                      ; preds = %55, %46, %.thread72, %28, %19, %13
  %.sink74 = phi i32 [ 944, %13 ], [ 959, %19 ], [ 959, %28 ], [ 971, %.thread72 ], [ 981, %46 ], [ 992, %55 ]
  %.sink = phi i32 [ 524304, %13 ], [ 524304, %19 ], [ 524304, %28 ], [ 125, %.thread72 ], [ 524304, %46 ], [ 524304, %55 ]
  %.1.ph = phi ptr [ null, %13 ], [ %.050, %19 ], [ %.050, %28 ], [ %.050, %.thread72 ], [ %.050, %46 ], [ %.050, %55 ]
  call void @ERR_new() #3
  call void @ERR_set_debug(ptr noundef nonnull @.str.2, i32 noundef %.sink74, ptr noundef nonnull @__func__.d2i_ECPrivateKey) #3
  call void (i32, i32, ptr, ...) @ERR_set_error(i32 noundef 16, i32 noundef %.sink, ptr noundef null) #3
  br label %80

80:                                               ; preds = %.sink.split, %35, %61, %67
  %.1 = phi ptr [ %.050, %35 ], [ %.050, %61 ], [ %.050, %67 ], [ %.1.ph, %.sink.split ]
  br i1 %9, label %83, label %81

81:                                               ; preds = %80
  %82 = load ptr, ptr %0, align 8, !tbaa !5
  %.not68 = icmp eq ptr %82, %.1
  br i1 %.not68, label %84, label %83

83:                                               ; preds = %81, %80
  call void @EC_KEY_free(ptr noundef %.1) #3
  br label %84

84:                                               ; preds = %83, %81
  call void @EC_PRIVATEKEY_free(ptr noundef nonnull %6)
  br label %85

85:                                               ; preds = %3, %84, %75
  %.0 = phi ptr [ null, %84 ], [ %.050, %75 ], [ null, %3 ]
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #3
  ret ptr %.0
}

declare ptr @EC_KEY_new() local_unnamed_addr #2

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

declare ptr @ASN1_STRING_get0_data(ptr noundef) local_unnamed_addr #2

declare i32 @ASN1_STRING_length(ptr noundef) local_unnamed_addr #2

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

declare void @EC_POINT_clear_free(ptr noundef) local_unnamed_addr #2

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

declare void @EC_KEY_free(ptr 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 16}
!10 = !{!"ec_privatekey_st", !11, i64 0, !6, i64 8, !6, i64 16, !6, i64 24}
!11 = !{!"int", !7, i64 0}
!12 = !{!13, !6, i64 24}
!13 = !{!"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, !14, i64 56, !11, i64 60, !15, i64 64, !6, i64 80, !6, i64 88, !16, i64 96}
!14 = !{!"", !7, i64 0}
!15 = !{!"crypto_ex_data_st", !6, i64 0, !6, i64 8}
!16 = !{!"long", !7, i64 0}
!17 = !{!18, !11, i64 0}
!18 = !{!"ecpk_parameters_st", !11, i64 0, !7, i64 8}
!19 = !{!20, !11, i64 40}
!20 = !{!"ec_group_st", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !11, i64 32, !11, i64 36, !11, i64 40, !11, i64 44, !6, i64 48, !16, i64 56, !6, i64 64, !7, i64 72, !6, i64 96, !6, i64 104, !11, i64 112, !6, i64 120, !6, i64 128, !6, i64 136, !6, i64 144, !11, i64 152, !7, i64 160, !6, i64 168, !6, i64 176}
!21 = !{!10, !11, i64 0}
!22 = !{!13, !11, i64 16}
!23 = !{!10, !6, i64 8}
!24 = !{!13, !6, i64 32}
!25 = !{!10, !6, i64 24}
!26 = !{!20, !6, i64 0}
!27 = !{!28, !6, i64 344}
!28 = !{!"ec_method_st", !11, i64 0, !11, i64 4, !6, i64 8, !6, i64 16, !6, i64 24, !6, i64 32, !6, i64 40, !6, i64 48, !6, i64 56, !6, i64 64, !6, i64 72, !6, i64 80, !6, i64 88, !6, i64 96, !6, i64 104, !6, i64 112, !6, i64 120, !6, i64 128, !6, i64 136, !6, i64 144, !6, i64 152, !6, i64 160, !6, i64 168, !6, i64 176, !6, i64 184, !6, i64 192, !6, i64 200, !6, i64 208, !6, i64 216, !6, i64 224, !6, i64 232, !6, i64 240, !6, i64 248, !6, i64 256, !6, i64 264, !6, i64 272, !6, i64 280, !6, i64 288, !6, i64 296, !6, i64 304, !6, i64 312, !6, i64 320, !6, i64 328, !6, i64 336, !6, i64 344, !6, i64 352, !6, i64 360, !6, i64 368, !6, i64 376, !6, i64 384, !6, i64 392, !6, i64 400, !6, i64 408, !6, i64 416, !6, i64 424, !6, i64 432, !6, i64 440}
!29 = !{!13, !11, i64 48}
!30 = !{!13, !16, i64 96}


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