; LLVM IR from specinfo-ua/UAPKI :: library/uapkic/src (math-ecp-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.EcGfpCtx_st = type { ptr, ptr, ptr, i8, i64 }
%struct.ECPoint_st = type { ptr, ptr, ptr }
%struct.WordArray_st = type { ptr, i64 }

@.str = external hidden unnamed_addr constant [27 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 @ecp_add_point(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 hidden void @ecp_double_point(ptr noundef, ptr noundef, ptr noundef) #3

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

; Function Attrs: nounwind uwtable
define dso_local i32 @ecp_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 424, i32 noundef %21, ptr noundef null)
  br label %197

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 426, i32 noundef %29, ptr noundef null)
  br label %197

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 427, i32 noundef %37, ptr noundef null)
  br label %197

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 %194

56:                                               ; preds = %40
  br label %57

57:                                               ; preds = %56
  %58 = load ptr, ptr %6, align 8, !tbaa !5
  %59 = getelementptr inbounds %struct.EcGfpCtx_st, ptr %58, i32 0, i32 4
  %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 !22
  %64 = getelementptr inbounds %struct.WordArray_st, ptr %63, i32 0, i32 1
  %65 = load i64, ptr %64, align 8, !tbaa !24
  %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 437, i32 noundef %68, ptr noundef null)
  br label %197

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 442, i32 noundef %87, ptr noundef null)
  store i32 4, ptr %16, align 4
  br label %191

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 = %121, %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 %124

95:                                               ; preds = %91
  br label %96

96:                                               ; preds = %95
  %97 = load ptr, ptr %6, align 8, !tbaa !5
  %98 = getelementptr inbounds %struct.EcGfpCtx_st, ptr %97, i32 0, i32 4
  %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 444, i32 noundef %109)
  store i32 4, ptr %16, align 4
  br label %191

110:                                              ; preds = %96
  br label %111

111:                                              ; preds = %110
  br label %112

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

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

124:                                              ; preds = %91
  br label %125

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

129:                                              ; preds = %125
  store i32 2, ptr %14, align 4, !tbaa !9
  %130 = load i32, ptr %14, align 4, !tbaa !9
  call void @stacktrace_add(ptr noundef @.str, i64 noundef 448, i32 noundef %130)
  store i32 4, ptr %16, align 4
  br label %191

131:                                              ; preds = %125
  br label %132

132:                                              ; preds = %131
  br label %133

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

145:                                              ; preds = %172, %133
  %146 = load i32, ptr %13, align 4, !tbaa !9
  %147 = load i32, ptr %15, align 4, !tbaa !9
  %148 = icmp slt i32 %146, %147
  br i1 %148, label %149, label %175

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

172:                                              ; preds = %149
  %173 = load i32, ptr %13, align 4, !tbaa !9
  %174 = add nsw i32 %173, 1
  store i32 %174, ptr %13, align 4, !tbaa !9
  br label %145, !llvm.loop !29

175:                                              ; preds = %145
  br label %176

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

186:                                              ; preds = %176
  %187 = load i32, ptr %14, align 4, !tbaa !9
  call void @stacktrace_add(ptr noundef @.str, i64 noundef 458, i32 noundef %187)
  store i32 4, ptr %16, align 4
  br label %191

188:                                              ; preds = %176
  br label %189

189:                                              ; preds = %188
  br label %190

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

191:                                              ; preds = %190, %186, %129, %108, %86
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #4
  %192 = load i32, ptr %16, align 4
  switch i32 %192, label %200 [
    i32 0, label %193
    i32 4, label %197
  ]

193:                                              ; preds = %191
  br label %194

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

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

200:                                              ; preds = %197, %191
  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
  %201 = load i32, ptr %5, align 4
  ret i32 %201
}

declare ptr @ec_point_alloc(i64 noundef) #1

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

declare ptr @ec_point_copy_with_alloc(ptr noundef) #1

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

declare void @ec_point_free(ptr noundef) #1

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, !21, i64 32}
!19 = !{!"EcGfpCtx_st", !6, i64 0, !6, i64 8, !6, i64 16, !20, i64 24, !21, i64 32}
!20 = !{!"_Bool", !7, i64 0}
!21 = !{!"long", !7, i64 0}
!22 = !{!23, !6, i64 0}
!23 = !{!"ECPoint_st", !6, i64 0, !6, i64 8, !6, i64 16}
!24 = !{!25, !21, i64 8}
!25 = !{!"WordArray_st", !6, i64 0, !21, i64 8}
!26 = distinct !{!26, !27}
!27 = !{!"llvm.loop.mustprogress"}
!28 = !{!23, !6, i64 8}
!29 = distinct !{!29, !27}


; 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 [27 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 @ecp_add_point(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 hidden void @ecp_double_point(ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #2

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

; Function Attrs: nounwind uwtable
define dso_local i32 @ecp_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 424, 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 426, 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 427, 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 32
  %20 = load i64, ptr %19, align 8, !tbaa !12
  %21 = load ptr, ptr %1, align 8, !tbaa !16
  %22 = getelementptr inbounds i8, ptr %21, i64 8
  %23 = load i64, ptr %22, align 8, !tbaa !18
  %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 437, 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 !20
  %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 !21
  %33 = icmp eq ptr %32, null
  br i1 %33, label %34, label %.preheader

.preheader:                                       ; preds = %26
  %.not87 = icmp eq i32 %27, 31
  br i1 %.not87, 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 442, 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 !21
  %38 = getelementptr inbounds ptr, ptr %37, i64 %indvars.iv
  store ptr %36, ptr %38, align 8, !tbaa !22
  %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 444, i32 noundef 2) #4
  br label %.thread

41:                                               ; preds = %.lr.ph
  %42 = load ptr, ptr %7, align 8, !tbaa !21
  %43 = getelementptr inbounds ptr, ptr %42, i64 %indvars.iv
  %44 = load ptr, ptr %43, align 8, !tbaa !22
  tail call void @ecp_point_zero(ptr noundef nonnull %0, ptr noundef %44)
  %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 !23

._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 448, i32 noundef 2) #4
  br label %.thread

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

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

53:                                               ; preds = %.lr.ph85, %53
  %indvars.iv89 = phi i64 [ 1, %.lr.ph85 ], [ %indvars.iv.next90, %53 ]
  %54 = load ptr, ptr %7, align 8, !tbaa !21
  %55 = getelementptr ptr, ptr %54, i64 %indvars.iv89
  %56 = getelementptr i8, ptr %55, i64 -8
  %57 = load ptr, ptr %56, align 8, !tbaa !22
  %58 = load ptr, ptr %45, align 8, !tbaa !16
  %59 = load ptr, ptr %52, align 8, !tbaa !25
  %60 = load ptr, ptr %55, align 8, !tbaa !22
  tail call void @ecp_add_point(ptr noundef nonnull %0, ptr noundef %57, ptr noundef %58, ptr noundef %59, i32 noundef 1, ptr noundef %60)
  %indvars.iv.next90 = add nuw nsw i64 %indvars.iv89, 1
  %exitcond93.not = icmp eq i64 %indvars.iv.next90, %wide.trip.count92
  br i1 %exitcond93.not, label %._crit_edge86, label %53, !llvm.loop !26

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

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

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

.thread:                                          ; preds = %64, %47, %40, %34, %65, %25, %13, %9, %5
  %.266 = phi ptr [ null, %9 ], [ null, %13 ], [ %.165, %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 %.266) #4
  ret i32 %.2
}

declare ptr @ec_point_alloc(i64 noundef) local_unnamed_addr #0

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

declare ptr @ec_point_copy_with_alloc(ptr noundef) local_unnamed_addr #0

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

declare void @ec_point_free(ptr noundef) local_unnamed_addr #0

; 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, !15, i64 32}
!13 = !{!"EcGfpCtx_st", !10, i64 0, !10, i64 8, !10, i64 16, !14, i64 24, !15, i64 32}
!14 = !{!"_Bool", !6, i64 0}
!15 = !{!"long", !6, i64 0}
!16 = !{!17, !10, i64 0}
!17 = !{!"ECPoint_st", !10, i64 0, !10, i64 8, !10, i64 16}
!18 = !{!19, !15, i64 8}
!19 = !{!"WordArray_st", !10, i64 0, !15, i64 8}
!20 = !{!9, !11, i64 8}
!21 = !{!9, !10, i64 0}
!22 = !{!10, !10, i64 0}
!23 = distinct !{!23, !24}
!24 = !{!"llvm.loop.mustprogress"}
!25 = !{!17, !10, i64 8}
!26 = distinct !{!26, !24}


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