; LLVM IR from specinfo-ua/UAPKI :: library/uapkic/src (math-ec2m-internal)

; 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.EcPrecomp_st = type { i32, %union.anon }
%union.anon = type { ptr }
%struct.EcPrecompWin_st = type { ptr, i32, i32 }
%struct.EC2m_st = type { ptr, i64, ptr, i64 }
%struct.ECPoint_st = type { ptr, ptr, ptr }
%struct.WordArray_st = type { ptr, i64 }

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

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

declare void @stacktrace_create(ptr noundef, i64 noundef, i32 noundef, ptr noundef) #1

; Function Attrs: nounwind allocsize(0,1)
declare noalias ptr @calloc(i64 noundef, i64 noundef) #2

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

declare void @stacktrace_add(ptr noundef, i64 noundef, i32 noundef) #1

; Function Attrs: nounwind uwtable
declare dso_local void @ec2m_double(ptr noundef, ptr noundef, ptr noundef) #3

declare void @ec_point_zero(ptr noundef) #1

; Function Attrs: nounwind uwtable
declare dso_local void @ec2m_add(ptr noundef, ptr noundef, ptr noundef, ptr noundef, i32 noundef, ptr noundef) #3

declare void @ec_point_copy(ptr noundef, ptr noundef) #1

; Function Attrs: nounwind uwtable
declare dso_local void @ec2m_point_to_affine(ptr noundef, ptr noundef) #3

declare ptr @ec_point_copy_with_alloc(ptr noundef) #1

declare void @ec_point_free(ptr noundef) #1

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

17:                                               ; preds = %4
  %18 = load ptr, ptr %6, align 8, !tbaa !5
  %19 = icmp ne ptr %18, null
  br i1 %19, label %22, label %20

20:                                               ; preds = %17
  store i32 2, ptr %14, align 4, !tbaa !9
  %21 = load i32, ptr %14, align 4, !tbaa !9
  call void @stacktrace_create(ptr noundef @.str, i64 noundef 391, i32 noundef %21, ptr noundef null)
  br label %196

22:                                               ; preds = %17
  br label %23

23:                                               ; preds = %22
  br label %24

24:                                               ; preds = %23
  br label %25

25:                                               ; preds = %24
  %26 = call noalias ptr @calloc(i64 noundef 1, i64 noundef 16) #5
  store ptr %26, ptr %11, align 8, !tbaa !5
  %27 = icmp eq ptr null, %26
  br i1 %27, label %28, label %30

28:                                               ; preds = %25
  store i32 1, ptr %14, align 4, !tbaa !9
  %29 = load i32, ptr %14, align 4, !tbaa !9
  call void @stacktrace_create(ptr noundef @.str, i64 noundef 393, i32 noundef %29, ptr noundef null)
  br label %196

30:                                               ; preds = %25
  br label %31

31:                                               ; preds = %30
  br label %32

32:                                               ; preds = %31
  br label %33

33:                                               ; preds = %32
  %34 = call noalias ptr @calloc(i64 noundef 1, i64 noundef 16) #5
  store ptr %34, ptr %10, align 8, !tbaa !5
  %35 = icmp eq ptr null, %34
  br i1 %35, label %36, label %38

36:                                               ; preds = %33
  store i32 1, ptr %14, align 4, !tbaa !9
  %37 = load i32, ptr %14, align 4, !tbaa !9
  call void @stacktrace_create(ptr noundef @.str, i64 noundef 394, i32 noundef %37, ptr noundef null)
  br label %196

38:                                               ; preds = %33
  br label %39

39:                                               ; preds = %38
  br label %40

40:                                               ; preds = %39
  %41 = load ptr, ptr %10, align 8, !tbaa !5
  %42 = getelementptr inbounds %struct.EcPrecomp_st, ptr %41, i32 0, i32 0
  store i32 0, ptr %42, align 8, !tbaa !11
  %43 = load ptr, ptr %11, align 8, !tbaa !5
  %44 = load ptr, ptr %10, align 8, !tbaa !5
  %45 = getelementptr inbounds %struct.EcPrecomp_st, ptr %44, i32 0, i32 1
  store ptr %43, ptr %45, align 8, !tbaa !13
  %46 = load i32, ptr %8, align 4, !tbaa !9
  %47 = load ptr, ptr %11, align 8, !tbaa !5
  %48 = getelementptr inbounds %struct.EcPrecompWin_st, ptr %47, i32 0, i32 2
  store i32 %46, ptr %48, align 4, !tbaa !14
  %49 = load ptr, ptr %7, align 8, !tbaa !5
  %50 = icmp eq ptr %49, null
  br i1 %50, label %51, label %56

51:                                               ; preds = %40
  %52 = load ptr, ptr %11, align 8, !tbaa !5
  %53 = getelementptr inbounds %struct.EcPrecompWin_st, ptr %52, i32 0, i32 1
  store i32 0, ptr %53, align 8, !tbaa !16
  %54 = load ptr, ptr %11, align 8, !tbaa !5
  %55 = getelementptr inbounds %struct.EcPrecompWin_st, ptr %54, i32 0, i32 0
  store ptr null, ptr %55, align 8, !tbaa !17
  br label %193

56:                                               ; preds = %40
  br label %57

57:                                               ; preds = %56
  %58 = load ptr, ptr %6, align 8, !tbaa !5
  %59 = getelementptr inbounds %struct.EC2m_st, ptr %58, i32 0, i32 3
  %60 = load i64, ptr %59, align 8, !tbaa !18
  %61 = load ptr, ptr %7, align 8, !tbaa !5
  %62 = getelementptr inbounds %struct.ECPoint_st, ptr %61, i32 0, i32 0
  %63 = load ptr, ptr %62, align 8, !tbaa !21
  %64 = getelementptr inbounds %struct.WordArray_st, ptr %63, i32 0, i32 1
  %65 = load i64, ptr %64, align 8, !tbaa !23
  %66 = icmp eq i64 %60, %65
  br i1 %66, label %69, label %67

67:                                               ; preds = %57
  store i32 2, ptr %14, align 4, !tbaa !9
  %68 = load i32, ptr %14, align 4, !tbaa !9
  call void @stacktrace_create(ptr noundef @.str, i64 noundef 404, i32 noundef %68, ptr noundef null)
  br label %196

69:                                               ; preds = %57
  br label %70

70:                                               ; preds = %69
  br label %71

71:                                               ; preds = %70
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #4
  %72 = load i32, ptr %8, align 4, !tbaa !9
  %73 = sub nsw i32 %72, 2
  %74 = shl i32 1, %73
  store i32 %74, ptr %15, align 4, !tbaa !9
  %75 = load i32, ptr %15, align 4, !tbaa !9
  %76 = load ptr, ptr %11, align 8, !tbaa !5
  %77 = getelementptr inbounds %struct.EcPrecompWin_st, ptr %76, i32 0, i32 1
  store i32 %75, ptr %77, align 8, !tbaa !16
  br label %78

78:                                               ; preds = %71
  %79 = load i32, ptr %15, align 4, !tbaa !9
  %80 = sext i32 %79 to i64
  %81 = mul i64 %80, 8
  %82 = call noalias ptr @calloc(i64 noundef 1, i64 noundef %81) #5
  %83 = load ptr, ptr %11, align 8, !tbaa !5
  %84 = getelementptr inbounds %struct.EcPrecompWin_st, ptr %83, i32 0, i32 0
  store ptr %82, ptr %84, align 8, !tbaa !17
  %85 = icmp eq ptr null, %82
  br i1 %85, label %86, label %88

86:                                               ; preds = %78
  store i32 1, ptr %14, align 4, !tbaa !9
  %87 = load i32, ptr %14, align 4, !tbaa !9
  call void @stacktrace_create(ptr noundef @.str, i64 noundef 409, i32 noundef %87, ptr noundef null)
  store i32 4, ptr %16, align 4
  br label %190

88:                                               ; preds = %78
  br label %89

89:                                               ; preds = %88
  br label %90

90:                                               ; preds = %89
  store i32 0, ptr %13, align 4, !tbaa !9
  br label %91

91:                                               ; preds = %120, %90
  %92 = load i32, ptr %13, align 4, !tbaa !9
  %93 = load i32, ptr %15, align 4, !tbaa !9
  %94 = icmp slt i32 %92, %93
  br i1 %94, label %95, label %123

95:                                               ; preds = %91
  br label %96

96:                                               ; preds = %95
  %97 = load ptr, ptr %6, align 8, !tbaa !5
  %98 = getelementptr inbounds %struct.EC2m_st, ptr %97, i32 0, i32 3
  %99 = load i64, ptr %98, align 8, !tbaa !18
  %100 = call ptr @ec_point_alloc(i64 noundef %99)
  %101 = load ptr, ptr %11, align 8, !tbaa !5
  %102 = getelementptr inbounds %struct.EcPrecompWin_st, ptr %101, i32 0, i32 0
  %103 = load ptr, ptr %102, align 8, !tbaa !17
  %104 = load i32, ptr %13, align 4, !tbaa !9
  %105 = sext i32 %104 to i64
  %106 = getelementptr inbounds ptr, ptr %103, i64 %105
  store ptr %100, ptr %106, align 8, !tbaa !5
  %107 = icmp eq ptr null, %100
  br i1 %107, label %108, label %110

108:                                              ; preds = %96
  store i32 2, ptr %14, align 4, !tbaa !9
  %109 = load i32, ptr %14, align 4, !tbaa !9
  call void @stacktrace_add(ptr noundef @.str, i64 noundef 411, i32 noundef %109)
  store i32 4, ptr %16, align 4
  br label %190

110:                                              ; preds = %96
  br label %111

111:                                              ; preds = %110
  br label %112

112:                                              ; preds = %111
  %113 = load ptr, ptr %11, align 8, !tbaa !5
  %114 = getelementptr inbounds %struct.EcPrecompWin_st, ptr %113, i32 0, i32 0
  %115 = load ptr, ptr %114, align 8, !tbaa !17
  %116 = load i32, ptr %13, align 4, !tbaa !9
  %117 = sext i32 %116 to i64
  %118 = getelementptr inbounds ptr, ptr %115, i64 %117
  %119 = load ptr, ptr %118, align 8, !tbaa !5
  call void @ec_point_zero(ptr noundef %119)
  br label %120

120:                                              ; preds = %112
  %121 = load i32, ptr %13, align 4, !tbaa !9
  %122 = add nsw i32 %121, 1
  store i32 %122, ptr %13, align 4, !tbaa !9
  br label %91, !llvm.loop !25

123:                                              ; preds = %91
  br label %124

124:                                              ; preds = %123
  %125 = load ptr, ptr %7, align 8, !tbaa !5
  %126 = call ptr @ec_point_copy_with_alloc(ptr noundef %125)
  store ptr %126, ptr %12, align 8, !tbaa !5
  %127 = icmp eq ptr null, %126
  br i1 %127, label %128, label %130

128:                                              ; preds = %124
  store i32 2, ptr %14, align 4, !tbaa !9
  %129 = load i32, ptr %14, align 4, !tbaa !9
  call void @stacktrace_add(ptr noundef @.str, i64 noundef 415, i32 noundef %129)
  store i32 4, ptr %16, align 4
  br label %190

130:                                              ; preds = %124
  br label %131

131:                                              ; preds = %130
  br label %132

132:                                              ; preds = %131
  %133 = load ptr, ptr %12, align 8, !tbaa !5
  %134 = load ptr, ptr %11, align 8, !tbaa !5
  %135 = getelementptr inbounds %struct.EcPrecompWin_st, ptr %134, i32 0, i32 0
  %136 = load ptr, ptr %135, align 8, !tbaa !17
  %137 = getelementptr inbounds ptr, ptr %136, i64 0
  %138 = load ptr, ptr %137, align 8, !tbaa !5
  call void @ec_point_copy(ptr noundef %133, ptr noundef %138)
  %139 = load ptr, ptr %6, align 8, !tbaa !5
  %140 = load ptr, ptr %12, align 8, !tbaa !5
  %141 = load ptr, ptr %12, align 8, !tbaa !5
  call void @ec2m_double(ptr noundef %139, ptr noundef %140, ptr noundef %141)
  %142 = load ptr, ptr %6, align 8, !tbaa !5
  %143 = load ptr, ptr %12, align 8, !tbaa !5
  call void @ec2m_point_to_affine(ptr noundef %142, ptr noundef %143)
  store i32 1, ptr %13, align 4, !tbaa !9
  br label %144

144:                                              ; preds = %171, %132
  %145 = load i32, ptr %13, align 4, !tbaa !9
  %146 = load i32, ptr %15, align 4, !tbaa !9
  %147 = icmp slt i32 %145, %146
  br i1 %147, label %148, label %174

148:                                              ; preds = %144
  %149 = load ptr, ptr %6, align 8, !tbaa !5
  %150 = load ptr, ptr %11, align 8, !tbaa !5
  %151 = getelementptr inbounds %struct.EcPrecompWin_st, ptr %150, i32 0, i32 0
  %152 = load ptr, ptr %151, align 8, !tbaa !17
  %153 = load i32, ptr %13, align 4, !tbaa !9
  %154 = sub nsw i32 %153, 1
  %155 = sext i32 %154 to i64
  %156 = getelementptr inbounds ptr, ptr %152, i64 %155
  %157 = load ptr, ptr %156, align 8, !tbaa !5
  %158 = load ptr, ptr %12, align 8, !tbaa !5
  %159 = getelementptr inbounds %struct.ECPoint_st, ptr %158, i32 0, i32 0
  %160 = load ptr, ptr %159, align 8, !tbaa !21
  %161 = load ptr, ptr %12, align 8, !tbaa !5
  %162 = getelementptr inbounds %struct.ECPoint_st, ptr %161, i32 0, i32 1
  %163 = load ptr, ptr %162, align 8, !tbaa !27
  %164 = load ptr, ptr %11, align 8, !tbaa !5
  %165 = getelementptr inbounds %struct.EcPrecompWin_st, ptr %164, i32 0, i32 0
  %166 = load ptr, ptr %165, align 8, !tbaa !17
  %167 = load i32, ptr %13, align 4, !tbaa !9
  %168 = sext i32 %167 to i64
  %169 = getelementptr inbounds ptr, ptr %166, i64 %168
  %170 = load ptr, ptr %169, align 8, !tbaa !5
  call void @ec2m_add(ptr noundef %149, ptr noundef %157, ptr noundef %160, ptr noundef %163, i32 noundef 1, ptr noundef %170)
  br label %171

171:                                              ; preds = %148
  %172 = load i32, ptr %13, align 4, !tbaa !9
  %173 = add nsw i32 %172, 1
  store i32 %173, ptr %13, align 4, !tbaa !9
  br label %144, !llvm.loop !28

174:                                              ; preds = %144
  br label %175

175:                                              ; preds = %174
  %176 = load ptr, ptr %6, align 8, !tbaa !5
  %177 = load ptr, ptr %11, align 8, !tbaa !5
  %178 = getelementptr inbounds %struct.EcPrecompWin_st, ptr %177, i32 0, i32 0
  %179 = load ptr, ptr %178, align 8, !tbaa !17
  %180 = load i32, ptr %15, align 4, !tbaa !9
  %181 = sub nsw i32 %180, 1
  %182 = call i32 @ec2m_points_to_affine(ptr noundef %176, ptr noundef %179, i32 noundef 1, i32 noundef %181)
  store i32 %182, ptr %14, align 4, !tbaa !9
  %183 = load i32, ptr %14, align 4, !tbaa !9
  %184 = icmp ne i32 %183, 0
  br i1 %184, label %185, label %187

185:                                              ; preds = %175
  %186 = load i32, ptr %14, align 4, !tbaa !9
  call void @stacktrace_add(ptr noundef @.str, i64 noundef 425, i32 noundef %186)
  store i32 4, ptr %16, align 4
  br label %190

187:                                              ; preds = %175
  br label %188

188:                                              ; preds = %187
  br label %189

189:                                              ; preds = %188
  store i32 0, ptr %16, align 4
  br label %190

190:                                              ; preds = %189, %185, %128, %108, %86
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #4
  %191 = load i32, ptr %16, align 4
  switch i32 %191, label %199 [
    i32 0, label %192
    i32 4, label %196
  ]

192:                                              ; preds = %190
  br label %193

193:                                              ; preds = %192, %51
  %194 = load ptr, ptr %10, align 8, !tbaa !5
  %195 = load ptr, ptr %9, align 8, !tbaa !5
  store ptr %194, ptr %195, align 8, !tbaa !5
  br label %196

196:                                              ; preds = %193, %190, %67, %36, %28, %20
  %197 = load ptr, ptr %12, align 8, !tbaa !5
  call void @ec_point_free(ptr noundef %197)
  %198 = load i32, ptr %14, align 4, !tbaa !9
  store i32 %198, ptr %5, align 4
  store i32 1, ptr %16, align 4
  br label %199

199:                                              ; preds = %196, %190
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #4
  %200 = load i32, ptr %5, align 4
  ret i32 %200
}

declare ptr @ec_point_alloc(i64 noundef) #1

; Function Attrs: nounwind uwtable
declare hidden i32 @ec2m_points_to_affine(ptr noundef, ptr noundef, i32 noundef, i32 noundef) #3

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 allocsize(0,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 #3 = { 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 #4 = { nounwind }
attributes #5 = { nounwind allocsize(0,1) }

!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, !10, i64 0}
!12 = !{!"EcPrecomp_st", !10, i64 0, !7, i64 8}
!13 = !{!7, !7, i64 0}
!14 = !{!15, !10, i64 12}
!15 = !{!"EcPrecompWin_st", !6, i64 0, !10, i64 8, !10, i64 12}
!16 = !{!15, !10, i64 8}
!17 = !{!15, !6, i64 0}
!18 = !{!19, !20, i64 24}
!19 = !{!"EC2m_st", !6, i64 0, !20, i64 8, !6, i64 16, !20, i64 24}
!20 = !{!"long", !7, i64 0}
!21 = !{!22, !6, i64 0}
!22 = !{!"ECPoint_st", !6, i64 0, !6, i64 8, !6, i64 16}
!23 = !{!24, !20, i64 8}
!24 = !{!"WordArray_st", !6, i64 0, !20, i64 8}
!25 = distinct !{!25, !26}
!26 = !{!"llvm.loop.mustprogress"}
!27 = !{!22, !6, i64 8}
!28 = distinct !{!28, !26}


; 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 [28 x i8], align 1

declare void @stacktrace_create(ptr noundef, i64 noundef, i32 noundef, ptr noundef) local_unnamed_addr #0

; Function Attrs: mustprogress nofree nounwind willreturn allockind("alloc,zeroed") allocsize(0,1) memory(inaccessiblemem: readwrite)
declare noalias noundef ptr @calloc(i64 noundef, i64 noundef) local_unnamed_addr #1

declare void @stacktrace_add(ptr noundef, i64 noundef, i32 noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
declare dso_local void @ec2m_double(ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #2

declare void @ec_point_zero(ptr noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
declare dso_local void @ec2m_add(ptr noundef, ptr noundef, ptr noundef, ptr noundef, i32 noundef, ptr noundef) local_unnamed_addr #2

declare void @ec_point_copy(ptr noundef, ptr noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
declare dso_local void @ec2m_point_to_affine(ptr noundef, ptr noundef) local_unnamed_addr #2

declare ptr @ec_point_copy_with_alloc(ptr noundef) local_unnamed_addr #0

declare void @ec_point_free(ptr noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
define dso_local i32 @ec2m_calc_win_precomp(ptr noundef %0, ptr noundef %1, i32 noundef %2, ptr nocapture noundef writeonly %3) local_unnamed_addr #2 {
  %.not = icmp eq ptr %0, null
  br i1 %.not, label %5, label %6

5:                                                ; preds = %4
  tail call void @stacktrace_create(ptr noundef nonnull @.str, i64 noundef 391, i32 noundef 2, ptr noundef null) #4
  br label %.thread

6:                                                ; preds = %4
  %7 = tail call noalias dereferenceable_or_null(16) ptr @calloc(i64 noundef 1, i64 noundef 16) #5
  %8 = icmp eq ptr %7, null
  br i1 %8, label %9, label %10

9:                                                ; preds = %6
  tail call void @stacktrace_create(ptr noundef nonnull @.str, i64 noundef 393, i32 noundef 1, ptr noundef null) #4
  br label %.thread

10:                                               ; preds = %6
  %11 = tail call noalias dereferenceable_or_null(16) ptr @calloc(i64 noundef 1, i64 noundef 16) #5
  %12 = icmp eq ptr %11, null
  br i1 %12, label %13, label %14

13:                                               ; preds = %10
  tail call void @stacktrace_create(ptr noundef nonnull @.str, i64 noundef 394, i32 noundef 1, ptr noundef null) #4
  br label %.thread

14:                                               ; preds = %10
  %15 = getelementptr inbounds i8, ptr %11, i64 8
  store ptr %7, ptr %15, align 8, !tbaa !5
  %16 = getelementptr inbounds i8, ptr %7, i64 12
  store i32 %2, ptr %16, align 4, !tbaa !8
  %17 = icmp eq ptr %1, null
  br i1 %17, label %65, label %18

18:                                               ; preds = %14
  %19 = getelementptr inbounds i8, ptr %0, i64 24
  %20 = load i64, ptr %19, align 8, !tbaa !12
  %21 = load ptr, ptr %1, align 8, !tbaa !15
  %22 = getelementptr inbounds i8, ptr %21, i64 8
  %23 = load i64, ptr %22, align 8, !tbaa !17
  %24 = icmp eq i64 %20, %23
  br i1 %24, label %26, label %25

25:                                               ; preds = %18
  tail call void @stacktrace_create(ptr noundef nonnull @.str, i64 noundef 404, i32 noundef 2, ptr noundef null) #4
  br label %.thread

26:                                               ; preds = %18
  %27 = add nsw i32 %2, -2
  %28 = shl nuw i32 1, %27
  %29 = getelementptr inbounds i8, ptr %7, i64 8
  store i32 %28, ptr %29, align 8, !tbaa !19
  %30 = sext i32 %28 to i64
  %31 = shl nsw i64 %30, 3
  %32 = tail call noalias ptr @calloc(i64 noundef 1, i64 noundef %31) #5
  store ptr %32, ptr %7, align 8, !tbaa !20
  %33 = icmp eq ptr %32, null
  br i1 %33, label %34, label %.preheader

.preheader:                                       ; preds = %26
  %.not86 = icmp eq i32 %27, 31
  br i1 %.not86, label %._crit_edge, label %.lr.ph.preheader

.lr.ph.preheader:                                 ; preds = %.preheader
  %smax = tail call i32 @llvm.smax.i32(i32 %28, i32 1)
  %wide.trip.count = zext nneg i32 %smax to i64
  br label %.lr.ph

34:                                               ; preds = %26
  tail call void @stacktrace_create(ptr noundef nonnull @.str, i64 noundef 409, i32 noundef 1, ptr noundef null) #4
  br label %.thread

.lr.ph:                                           ; preds = %.lr.ph.preheader, %41
  %indvars.iv = phi i64 [ 0, %.lr.ph.preheader ], [ %indvars.iv.next, %41 ]
  %35 = load i64, ptr %19, align 8, !tbaa !12
  %36 = tail call ptr @ec_point_alloc(i64 noundef %35) #4
  %37 = load ptr, ptr %7, align 8, !tbaa !20
  %38 = getelementptr inbounds ptr, ptr %37, i64 %indvars.iv
  store ptr %36, ptr %38, align 8, !tbaa !21
  %39 = icmp eq ptr %36, null
  br i1 %39, label %40, label %41

40:                                               ; preds = %.lr.ph
  tail call void @stacktrace_add(ptr noundef nonnull @.str, i64 noundef 411, i32 noundef 2) #4
  br label %.thread

41:                                               ; preds = %.lr.ph
  %42 = load ptr, ptr %7, align 8, !tbaa !20
  %43 = getelementptr inbounds ptr, ptr %42, i64 %indvars.iv
  %44 = load ptr, ptr %43, align 8, !tbaa !21
  tail call void @ec_point_zero(ptr noundef %44) #4
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
  br i1 %exitcond.not, label %._crit_edge, label %.lr.ph, !llvm.loop !22

._crit_edge:                                      ; preds = %41, %.preheader
  %45 = tail call ptr @ec_point_copy_with_alloc(ptr noundef nonnull %1) #4
  %46 = icmp eq ptr %45, null
  br i1 %46, label %47, label %48

47:                                               ; preds = %._crit_edge
  tail call void @stacktrace_add(ptr noundef nonnull @.str, i64 noundef 415, i32 noundef 2) #4
  br label %.thread

48:                                               ; preds = %._crit_edge
  %49 = load ptr, ptr %7, align 8, !tbaa !20
  %50 = load ptr, ptr %49, align 8, !tbaa !21
  tail call void @ec_point_copy(ptr noundef nonnull %45, ptr noundef %50) #4
  tail call void @ec2m_double(ptr noundef nonnull %0, ptr noundef nonnull %45, ptr noundef nonnull %45)
  tail call void @ec2m_point_to_affine(ptr noundef nonnull %0, ptr noundef nonnull %45)
  %51 = icmp sgt i32 %28, 1
  br i1 %51, label %.lr.ph84, label %._crit_edge85

.lr.ph84:                                         ; preds = %48
  %52 = getelementptr inbounds i8, ptr %45, i64 8
  %wide.trip.count91 = zext nneg i32 %28 to i64
  br label %53

53:                                               ; preds = %.lr.ph84, %53
  %indvars.iv88 = phi i64 [ 1, %.lr.ph84 ], [ %indvars.iv.next89, %53 ]
  %54 = load ptr, ptr %7, align 8, !tbaa !20
  %55 = getelementptr ptr, ptr %54, i64 %indvars.iv88
  %56 = getelementptr i8, ptr %55, i64 -8
  %57 = load ptr, ptr %56, align 8, !tbaa !21
  %58 = load ptr, ptr %45, align 8, !tbaa !15
  %59 = load ptr, ptr %52, align 8, !tbaa !24
  %60 = load ptr, ptr %55, align 8, !tbaa !21
  tail call void @ec2m_add(ptr noundef nonnull %0, ptr noundef %57, ptr noundef %58, ptr noundef %59, i32 noundef 1, ptr noundef %60)
  %indvars.iv.next89 = add nuw nsw i64 %indvars.iv88, 1
  %exitcond92.not = icmp eq i64 %indvars.iv.next89, %wide.trip.count91
  br i1 %exitcond92.not, label %._crit_edge85, label %53, !llvm.loop !25

._crit_edge85:                                    ; preds = %53, %48
  %61 = load ptr, ptr %7, align 8, !tbaa !20
  %62 = add nsw i32 %28, -1
  %63 = tail call i32 @ec2m_points_to_affine(ptr noundef nonnull %0, ptr noundef %61, i32 noundef 1, i32 noundef %62)
  %.not75 = icmp eq i32 %63, 0
  br i1 %.not75, label %65, label %64

64:                                               ; preds = %._crit_edge85
  tail call void @stacktrace_add(ptr noundef nonnull @.str, i64 noundef 425, i32 noundef %63) #4
  br label %.thread

65:                                               ; preds = %14, %._crit_edge85
  %.164 = phi ptr [ %45, %._crit_edge85 ], [ null, %14 ]
  store ptr %11, ptr %3, align 8, !tbaa !21
  br label %.thread

.thread:                                          ; preds = %64, %47, %40, %34, %65, %25, %13, %9, %5
  %.265 = phi ptr [ null, %9 ], [ null, %13 ], [ %.164, %65 ], [ null, %25 ], [ null, %5 ], [ %45, %64 ], [ null, %47 ], [ null, %40 ], [ null, %34 ]
  %.2 = phi i32 [ 1, %9 ], [ 1, %13 ], [ 0, %65 ], [ 2, %25 ], [ 2, %5 ], [ %63, %64 ], [ 2, %47 ], [ 2, %40 ], [ 1, %34 ]
  tail call void @ec_point_free(ptr noundef %.265) #4
  ret i32 %.2
}

declare ptr @ec_point_alloc(i64 noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
declare hidden i32 @ec2m_points_to_affine(ptr noundef, ptr noundef, i32 noundef, i32 noundef) local_unnamed_addr #2

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smax.i32(i32, i32) #3

attributes #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 nofree nounwind willreturn allockind("alloc,zeroed") allocsize(0,1) memory(inaccessiblemem: readwrite) "alloc-family"="malloc" "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 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 #3 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #4 = { nounwind }
attributes #5 = { nounwind allocsize(0,1) }

!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 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C/C++ TBAA"}
!8 = !{!9, !11, i64 12}
!9 = !{!"EcPrecompWin_st", !10, i64 0, !11, i64 8, !11, i64 12}
!10 = !{!"any pointer", !6, i64 0}
!11 = !{!"int", !6, i64 0}
!12 = !{!13, !14, i64 24}
!13 = !{!"EC2m_st", !10, i64 0, !14, i64 8, !10, i64 16, !14, i64 24}
!14 = !{!"long", !6, i64 0}
!15 = !{!16, !10, i64 0}
!16 = !{!"ECPoint_st", !10, i64 0, !10, i64 8, !10, i64 16}
!17 = !{!18, !14, i64 8}
!18 = !{!"WordArray_st", !10, i64 0, !14, i64 8}
!19 = !{!9, !11, i64 8}
!20 = !{!9, !10, i64 0}
!21 = !{!10, !10, i64 0}
!22 = distinct !{!22, !23}
!23 = !{!"llvm.loop.mustprogress"}
!24 = !{!16, !10, i64 8}
!25 = distinct !{!25, !23}


; Effective O3 passes: CorrelatedValuePropagationPass,DSEPass,EarlyCSEPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LICMPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,PostOrderFunctionAttrsPass,SCCPPass,SROAPass,SimplifyCFGPass,TailCallElimPass