; 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.EcPrecompComb_st = type { ptr, i32 }
%struct.EC2m_st = type { ptr, i64, ptr, i64 }
%struct.ECPoint_st = type { ptr, ptr, ptr }
%struct.WordArray_st = type { ptr, i64 }
%struct.Gf2mCtx_st = type { ptr, 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

declare ptr @ec_point_alloc(i64 noundef) #1

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

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

21:                                               ; preds = %18
  store i32 2, ptr %16, align 4, !tbaa !9
  %22 = load i32, ptr %16, align 4, !tbaa !9
  call void @stacktrace_create(ptr noundef @.str, i64 noundef 447, i32 noundef %22, ptr noundef null)
  br label %258

23:                                               ; preds = %18
  br label %24

24:                                               ; preds = %23
  br label %25

25:                                               ; preds = %24
  br label %26

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

29:                                               ; preds = %26
  store i32 1, ptr %16, align 4, !tbaa !9
  %30 = load i32, ptr %16, align 4, !tbaa !9
  call void @stacktrace_create(ptr noundef @.str, i64 noundef 449, i32 noundef %30, ptr noundef null)
  br label %258

31:                                               ; preds = %26
  br label %32

32:                                               ; preds = %31
  br label %33

33:                                               ; preds = %32
  br label %34

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

37:                                               ; preds = %34
  store i32 1, ptr %16, align 4, !tbaa !9
  %38 = load i32, ptr %16, align 4, !tbaa !9
  call void @stacktrace_create(ptr noundef @.str, i64 noundef 450, i32 noundef %38, ptr noundef null)
  br label %258

39:                                               ; preds = %34
  br label %40

40:                                               ; preds = %39
  br label %41

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

52:                                               ; preds = %41
  %53 = load ptr, ptr %12, align 8, !tbaa !5
  %54 = getelementptr inbounds %struct.EcPrecompComb_st, ptr %53, i32 0, i32 0
  store ptr null, ptr %54, align 8, !tbaa !16
  br label %255

55:                                               ; preds = %41
  br label %56

56:                                               ; preds = %55
  %57 = load ptr, ptr %5, align 8, !tbaa !5
  %58 = getelementptr inbounds %struct.EC2m_st, ptr %57, i32 0, i32 3
  %59 = load i64, ptr %58, align 8, !tbaa !17
  %60 = load ptr, ptr %6, align 8, !tbaa !5
  %61 = getelementptr inbounds %struct.ECPoint_st, ptr %60, i32 0, i32 0
  %62 = load ptr, ptr %61, align 8, !tbaa !20
  %63 = getelementptr inbounds %struct.WordArray_st, ptr %62, i32 0, i32 1
  %64 = load i64, ptr %63, align 8, !tbaa !22
  %65 = icmp eq i64 %59, %64
  br i1 %65, label %68, label %66

66:                                               ; preds = %56
  store i32 2, ptr %16, align 4, !tbaa !9
  %67 = load i32, ptr %16, align 4, !tbaa !9
  call void @stacktrace_create(ptr noundef @.str, i64 noundef 459, i32 noundef %67, ptr noundef null)
  br label %258

68:                                               ; preds = %56
  br label %69

69:                                               ; preds = %68
  br label %70

70:                                               ; preds = %69
  %71 = load ptr, ptr %5, align 8, !tbaa !5
  %72 = getelementptr inbounds %struct.EC2m_st, ptr %71, i32 0, i32 0
  %73 = load ptr, ptr %72, align 8, !tbaa !24
  %74 = getelementptr inbounds %struct.Gf2mCtx_st, ptr %73, i32 0, i32 0
  %75 = load ptr, ptr %74, align 8, !tbaa !25
  %76 = getelementptr inbounds i32, ptr %75, i64 0
  %77 = load i32, ptr %76, align 4, !tbaa !9
  %78 = load i32, ptr %7, align 4, !tbaa !9
  %79 = add nsw i32 %77, %78
  %80 = sub nsw i32 %79, 1
  %81 = load i32, ptr %7, align 4, !tbaa !9
  %82 = sdiv i32 %80, %81
  store i32 %82, ptr %13, align 4, !tbaa !9
  %83 = load i32, ptr %7, align 4, !tbaa !9
  %84 = shl i32 1, %83
  %85 = sub nsw i32 %84, 1
  store i32 %85, ptr %14, align 4, !tbaa !9
  br label %86

86:                                               ; preds = %70
  %87 = load i32, ptr %14, align 4, !tbaa !9
  %88 = sext i32 %87 to i64
  %89 = mul i64 %88, 8
  %90 = call noalias ptr @calloc(i64 noundef 1, i64 noundef %89) #5
  %91 = load ptr, ptr %12, align 8, !tbaa !5
  %92 = getelementptr inbounds %struct.EcPrecompComb_st, ptr %91, i32 0, i32 0
  store ptr %90, ptr %92, align 8, !tbaa !16
  %93 = icmp eq ptr null, %90
  br i1 %93, label %94, label %96

94:                                               ; preds = %86
  store i32 1, ptr %16, align 4, !tbaa !9
  %95 = load i32, ptr %16, align 4, !tbaa !9
  call void @stacktrace_create(ptr noundef @.str, i64 noundef 464, i32 noundef %95, ptr noundef null)
  br label %258

96:                                               ; preds = %86
  br label %97

97:                                               ; preds = %96
  br label %98

98:                                               ; preds = %97
  store i32 0, ptr %9, align 4, !tbaa !9
  br label %99

99:                                               ; preds = %121, %98
  %100 = load i32, ptr %9, align 4, !tbaa !9
  %101 = load i32, ptr %14, align 4, !tbaa !9
  %102 = icmp slt i32 %100, %101
  br i1 %102, label %103, label %124

103:                                              ; preds = %99
  %104 = load ptr, ptr %5, align 8, !tbaa !5
  %105 = getelementptr inbounds %struct.EC2m_st, ptr %104, i32 0, i32 3
  %106 = load i64, ptr %105, align 8, !tbaa !17
  %107 = call ptr @ec_point_alloc(i64 noundef %106)
  %108 = load ptr, ptr %12, align 8, !tbaa !5
  %109 = getelementptr inbounds %struct.EcPrecompComb_st, ptr %108, i32 0, i32 0
  %110 = load ptr, ptr %109, align 8, !tbaa !16
  %111 = load i32, ptr %9, align 4, !tbaa !9
  %112 = sext i32 %111 to i64
  %113 = getelementptr inbounds ptr, ptr %110, i64 %112
  store ptr %107, ptr %113, align 8, !tbaa !5
  %114 = load ptr, ptr %12, align 8, !tbaa !5
  %115 = getelementptr inbounds %struct.EcPrecompComb_st, ptr %114, i32 0, i32 0
  %116 = load ptr, ptr %115, align 8, !tbaa !16
  %117 = load i32, ptr %9, 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 @ec_point_zero(ptr noundef %120)
  br label %121

121:                                              ; preds = %103
  %122 = load i32, ptr %9, align 4, !tbaa !9
  %123 = add nsw i32 %122, 1
  store i32 %123, ptr %9, align 4, !tbaa !9
  br label %99, !llvm.loop !27

124:                                              ; preds = %99
  br label %125

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

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

131:                                              ; preds = %125
  br label %132

132:                                              ; preds = %131
  br label %133

133:                                              ; preds = %132
  %134 = load ptr, ptr %11, align 8, !tbaa !5
  %135 = load ptr, ptr %12, align 8, !tbaa !5
  %136 = getelementptr inbounds %struct.EcPrecompComb_st, ptr %135, i32 0, i32 0
  %137 = load ptr, ptr %136, align 8, !tbaa !16
  %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)
  store i32 1, ptr %9, align 4, !tbaa !9
  br label %140

140:                                              ; preds = %177, %133
  %141 = load i32, ptr %9, align 4, !tbaa !9
  %142 = load i32, ptr %7, align 4, !tbaa !9
  %143 = icmp slt i32 %141, %142
  br i1 %143, label %144, label %180

144:                                              ; preds = %140
  store i32 0, ptr %10, align 4, !tbaa !9
  br label %145

145:                                              ; preds = %153, %144
  %146 = load i32, ptr %10, align 4, !tbaa !9
  %147 = load i32, ptr %13, align 4, !tbaa !9
  %148 = icmp slt i32 %146, %147
  br i1 %148, label %149, label %156

149:                                              ; preds = %145
  %150 = load ptr, ptr %5, align 8, !tbaa !5
  %151 = load ptr, ptr %11, align 8, !tbaa !5
  %152 = load ptr, ptr %11, align 8, !tbaa !5
  call void @ec2m_double(ptr noundef %150, ptr noundef %151, ptr noundef %152)
  br label %153

153:                                              ; preds = %149
  %154 = load i32, ptr %10, align 4, !tbaa !9
  %155 = add nsw i32 %154, 1
  store i32 %155, ptr %10, align 4, !tbaa !9
  br label %145, !llvm.loop !29

156:                                              ; preds = %145
  %157 = load ptr, ptr %11, align 8, !tbaa !5
  %158 = load ptr, ptr %12, align 8, !tbaa !5
  %159 = getelementptr inbounds %struct.EcPrecompComb_st, ptr %158, i32 0, i32 0
  %160 = load ptr, ptr %159, align 8, !tbaa !16
  %161 = load i32, ptr %9, align 4, !tbaa !9
  %162 = shl i32 1, %161
  %163 = sub nsw i32 %162, 1
  %164 = sext i32 %163 to i64
  %165 = getelementptr inbounds ptr, ptr %160, i64 %164
  %166 = load ptr, ptr %165, align 8, !tbaa !5
  call void @ec_point_copy(ptr noundef %157, ptr noundef %166)
  %167 = load ptr, ptr %5, align 8, !tbaa !5
  %168 = load ptr, ptr %12, align 8, !tbaa !5
  %169 = getelementptr inbounds %struct.EcPrecompComb_st, ptr %168, i32 0, i32 0
  %170 = load ptr, ptr %169, align 8, !tbaa !16
  %171 = load i32, ptr %9, align 4, !tbaa !9
  %172 = shl i32 1, %171
  %173 = sub nsw i32 %172, 1
  %174 = sext i32 %173 to i64
  %175 = getelementptr inbounds ptr, ptr %170, i64 %174
  %176 = load ptr, ptr %175, align 8, !tbaa !5
  call void @ec2m_point_to_affine(ptr noundef %167, ptr noundef %176)
  br label %177

177:                                              ; preds = %156
  %178 = load i32, ptr %9, align 4, !tbaa !9
  %179 = add nsw i32 %178, 1
  store i32 %179, ptr %9, align 4, !tbaa !9
  br label %140, !llvm.loop !30

180:                                              ; preds = %140
  store i32 2, ptr %9, align 4, !tbaa !9
  br label %181

181:                                              ; preds = %251, %180
  %182 = load i32, ptr %9, align 4, !tbaa !9
  %183 = load i32, ptr %14, align 4, !tbaa !9
  %184 = icmp slt i32 %182, %183
  br i1 %184, label %185, label %254

185:                                              ; preds = %181
  store i32 0, ptr %10, align 4, !tbaa !9
  br label %186

186:                                              ; preds = %239, %185
  %187 = load i32, ptr %10, align 4, !tbaa !9
  %188 = load i32, ptr %7, align 4, !tbaa !9
  %189 = icmp slt i32 %187, %188
  br i1 %189, label %190, label %242

190:                                              ; preds = %186
  call void @llvm.lifetime.start.p0(i64 4, ptr %17) #4
  %191 = load i32, ptr %10, align 4, !tbaa !9
  %192 = shl i32 1, %191
  %193 = sub nsw i32 %192, 1
  store i32 %193, ptr %17, align 4, !tbaa !9
  %194 = load i32, ptr %9, align 4, !tbaa !9
  %195 = add nsw i32 %194, 1
  %196 = load i32, ptr %10, align 4, !tbaa !9
  %197 = ashr i32 %195, %196
  %198 = and i32 %197, 1
  %199 = icmp ne i32 %198, 0
  br i1 %199, label %200, label %238

200:                                              ; preds = %190
  %201 = load i32, ptr %9, align 4, !tbaa !9
  %202 = load i32, ptr %17, align 4, !tbaa !9
  %203 = icmp ne i32 %201, %202
  br i1 %203, label %204, label %238

204:                                              ; preds = %200
  %205 = load ptr, ptr %5, align 8, !tbaa !5
  %206 = load ptr, ptr %12, align 8, !tbaa !5
  %207 = getelementptr inbounds %struct.EcPrecompComb_st, ptr %206, i32 0, i32 0
  %208 = load ptr, ptr %207, align 8, !tbaa !16
  %209 = load i32, ptr %9, align 4, !tbaa !9
  %210 = sext i32 %209 to i64
  %211 = getelementptr inbounds ptr, ptr %208, i64 %210
  %212 = load ptr, ptr %211, align 8, !tbaa !5
  %213 = load ptr, ptr %12, align 8, !tbaa !5
  %214 = getelementptr inbounds %struct.EcPrecompComb_st, ptr %213, i32 0, i32 0
  %215 = load ptr, ptr %214, align 8, !tbaa !16
  %216 = load i32, ptr %17, align 4, !tbaa !9
  %217 = sext i32 %216 to i64
  %218 = getelementptr inbounds ptr, ptr %215, i64 %217
  %219 = load ptr, ptr %218, align 8, !tbaa !5
  %220 = getelementptr inbounds %struct.ECPoint_st, ptr %219, i32 0, i32 0
  %221 = load ptr, ptr %220, align 8, !tbaa !20
  %222 = load ptr, ptr %12, align 8, !tbaa !5
  %223 = getelementptr inbounds %struct.EcPrecompComb_st, ptr %222, i32 0, i32 0
  %224 = load ptr, ptr %223, align 8, !tbaa !16
  %225 = load i32, ptr %17, align 4, !tbaa !9
  %226 = sext i32 %225 to i64
  %227 = getelementptr inbounds ptr, ptr %224, i64 %226
  %228 = load ptr, ptr %227, align 8, !tbaa !5
  %229 = getelementptr inbounds %struct.ECPoint_st, ptr %228, i32 0, i32 1
  %230 = load ptr, ptr %229, align 8, !tbaa !31
  %231 = load ptr, ptr %12, align 8, !tbaa !5
  %232 = getelementptr inbounds %struct.EcPrecompComb_st, ptr %231, i32 0, i32 0
  %233 = load ptr, ptr %232, align 8, !tbaa !16
  %234 = load i32, ptr %9, align 4, !tbaa !9
  %235 = sext i32 %234 to i64
  %236 = getelementptr inbounds ptr, ptr %233, i64 %235
  %237 = load ptr, ptr %236, align 8, !tbaa !5
  call void @ec2m_add(ptr noundef %205, ptr noundef %212, ptr noundef %221, ptr noundef %230, i32 noundef 1, ptr noundef %237)
  br label %238

238:                                              ; preds = %204, %200, %190
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #4
  br label %239

239:                                              ; preds = %238
  %240 = load i32, ptr %10, align 4, !tbaa !9
  %241 = add nsw i32 %240, 1
  store i32 %241, ptr %10, align 4, !tbaa !9
  br label %186, !llvm.loop !32

242:                                              ; preds = %186
  %243 = load ptr, ptr %5, align 8, !tbaa !5
  %244 = load ptr, ptr %12, align 8, !tbaa !5
  %245 = getelementptr inbounds %struct.EcPrecompComb_st, ptr %244, i32 0, i32 0
  %246 = load ptr, ptr %245, align 8, !tbaa !16
  %247 = load i32, ptr %9, align 4, !tbaa !9
  %248 = sext i32 %247 to i64
  %249 = getelementptr inbounds ptr, ptr %246, i64 %248
  %250 = load ptr, ptr %249, align 8, !tbaa !5
  call void @ec2m_point_to_affine(ptr noundef %243, ptr noundef %250)
  br label %251

251:                                              ; preds = %242
  %252 = load i32, ptr %9, align 4, !tbaa !9
  %253 = add nsw i32 %252, 1
  store i32 %253, ptr %9, align 4, !tbaa !9
  br label %181, !llvm.loop !33

254:                                              ; preds = %181
  br label %255

255:                                              ; preds = %254, %52
  %256 = load ptr, ptr %15, align 8, !tbaa !5
  %257 = load ptr, ptr %8, align 8, !tbaa !5
  store ptr %256, ptr %257, align 8, !tbaa !5
  br label %258

258:                                              ; preds = %255, %129, %94, %66, %37, %29, %21
  %259 = load ptr, ptr %11, align 8, !tbaa !5
  call void @ec_point_free(ptr noundef %259)
  %260 = load i32, ptr %16, align 4, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #4
  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 4, ptr %10) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #4
  ret i32 %260
}

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 8}
!15 = !{!"EcPrecompComb_st", !6, i64 0, !10, i64 8}
!16 = !{!15, !6, i64 0}
!17 = !{!18, !19, i64 24}
!18 = !{!"EC2m_st", !6, i64 0, !19, i64 8, !6, i64 16, !19, i64 24}
!19 = !{!"long", !7, i64 0}
!20 = !{!21, !6, i64 0}
!21 = !{!"ECPoint_st", !6, i64 0, !6, i64 8, !6, i64 16}
!22 = !{!23, !19, i64 8}
!23 = !{!"WordArray_st", !6, i64 0, !19, i64 8}
!24 = !{!18, !6, i64 0}
!25 = !{!26, !6, i64 0}
!26 = !{!"Gf2mCtx_st", !6, i64 0, !6, i64 8, !19, i64 16}
!27 = distinct !{!27, !28}
!28 = !{!"llvm.loop.mustprogress"}
!29 = distinct !{!29, !28}
!30 = distinct !{!30, !28}
!31 = !{!21, !6, i64 8}
!32 = distinct !{!32, !28}
!33 = distinct !{!33, !28}


; 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

declare ptr @ec_point_alloc(i64 noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
define dso_local range(i32 0, 3) i32 @ec2m_calc_comb_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 447, i32 noundef 2, ptr noundef null) #4
  br label %99

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 449, i32 noundef 1, ptr noundef null) #4
  br label %99

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 450, i32 noundef 1, ptr noundef null) #4
  br label %99

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

18:                                               ; preds = %14
  %19 = getelementptr inbounds i8, ptr %0, i64 24
  %20 = load i64, ptr %19, align 8, !tbaa !14
  %21 = load ptr, ptr %1, align 8, !tbaa !17
  %22 = getelementptr inbounds i8, ptr %21, i64 8
  %23 = load i64, ptr %22, align 8, !tbaa !19
  %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 459, i32 noundef 2, ptr noundef null) #4
  br label %99

26:                                               ; preds = %18
  %27 = load ptr, ptr %0, align 8, !tbaa !21
  %28 = load ptr, ptr %27, align 8, !tbaa !22
  %29 = load i32, ptr %28, align 4, !tbaa !24
  %30 = add i32 %2, -1
  %31 = add i32 %30, %29
  %32 = sdiv i32 %31, %2
  %notmask = shl nsw i32 -1, %2
  %33 = xor i32 %notmask, -1
  %34 = zext nneg i32 %33 to i64
  %35 = shl nuw nsw i64 %34, 3
  %36 = tail call noalias ptr @calloc(i64 noundef 1, i64 noundef %35) #5
  store ptr %36, ptr %7, align 8, !tbaa !25
  %37 = icmp eq ptr %36, null
  br i1 %37, label %38, label %.lr.ph.preheader

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

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

.lr.ph:                                           ; preds = %.lr.ph.preheader, %.lr.ph
  %indvars.iv = phi i64 [ 0, %.lr.ph.preheader ], [ %indvars.iv.next, %.lr.ph ]
  %39 = load i64, ptr %19, align 8, !tbaa !14
  %40 = tail call ptr @ec_point_alloc(i64 noundef %39) #4
  %41 = load ptr, ptr %7, align 8, !tbaa !25
  %42 = getelementptr inbounds ptr, ptr %41, i64 %indvars.iv
  store ptr %40, ptr %42, align 8, !tbaa !26
  %43 = load ptr, ptr %7, align 8, !tbaa !25
  %44 = getelementptr inbounds ptr, ptr %43, i64 %indvars.iv
  %45 = load ptr, ptr %44, align 8, !tbaa !26
  tail call void @ec_point_zero(ptr noundef %45) #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 !27

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

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

49:                                               ; preds = %._crit_edge
  %50 = load ptr, ptr %7, align 8, !tbaa !25
  %51 = load ptr, ptr %50, align 8, !tbaa !26
  tail call void @ec_point_copy(ptr noundef nonnull %46, ptr noundef %51) #4
  %52 = icmp sgt i32 %2, 1
  br i1 %52, label %.preheader93.lr.ph, label %.preheader92

.preheader93.lr.ph:                               ; preds = %49
  %53 = icmp sgt i32 %32, 0
  br i1 %53, label %.preheader93.us, label %.preheader93

.preheader93.us:                                  ; preds = %.preheader93.lr.ph, %._crit_edge98.us
  %.199.us = phi i32 [ %64, %._crit_edge98.us ], [ 1, %.preheader93.lr.ph ]
  br label %54

54:                                               ; preds = %.preheader93.us, %54
  %.07596.us = phi i32 [ 0, %.preheader93.us ], [ %55, %54 ]
  tail call void @ec2m_double(ptr noundef nonnull %0, ptr noundef nonnull %46, ptr noundef nonnull %46)
  %55 = add nuw nsw i32 %.07596.us, 1
  %exitcond109.not = icmp eq i32 %55, %32
  br i1 %exitcond109.not, label %._crit_edge98.us, label %54, !llvm.loop !29

._crit_edge98.us:                                 ; preds = %54
  %56 = load ptr, ptr %7, align 8, !tbaa !25
  %notmask91.us = shl nsw i32 -1, %.199.us
  %57 = xor i32 %notmask91.us, -1
  %58 = zext nneg i32 %57 to i64
  %59 = getelementptr inbounds ptr, ptr %56, i64 %58
  %60 = load ptr, ptr %59, align 8, !tbaa !26
  tail call void @ec_point_copy(ptr noundef nonnull %46, ptr noundef %60) #4
  %61 = load ptr, ptr %7, align 8, !tbaa !25
  %62 = getelementptr inbounds ptr, ptr %61, i64 %58
  %63 = load ptr, ptr %62, align 8, !tbaa !26
  tail call void @ec2m_point_to_affine(ptr noundef nonnull %0, ptr noundef %63)
  %64 = add nuw nsw i32 %.199.us, 1
  %exitcond110.not = icmp eq i32 %64, %2
  br i1 %exitcond110.not, label %.preheader92, label %.preheader93.us, !llvm.loop !30

.preheader93:                                     ; preds = %.preheader93.lr.ph, %.preheader93
  %.199 = phi i32 [ %73, %.preheader93 ], [ 1, %.preheader93.lr.ph ]
  %65 = load ptr, ptr %7, align 8, !tbaa !25
  %notmask91 = shl nsw i32 -1, %.199
  %66 = xor i32 %notmask91, -1
  %67 = zext nneg i32 %66 to i64
  %68 = getelementptr inbounds ptr, ptr %65, i64 %67
  %69 = load ptr, ptr %68, align 8, !tbaa !26
  tail call void @ec_point_copy(ptr noundef nonnull %46, ptr noundef %69) #4
  %70 = load ptr, ptr %7, align 8, !tbaa !25
  %71 = getelementptr inbounds ptr, ptr %70, i64 %67
  %72 = load ptr, ptr %71, align 8, !tbaa !26
  tail call void @ec2m_point_to_affine(ptr noundef nonnull %0, ptr noundef %72)
  %73 = add nuw nsw i32 %.199, 1
  %exitcond108.not = icmp eq i32 %73, %2
  br i1 %exitcond108.not, label %.preheader92, label %.preheader93, !llvm.loop !30

.preheader92:                                     ; preds = %.preheader93, %._crit_edge98.us, %49
  %74 = icmp ult i32 %notmask, -3
  br i1 %74, label %.preheader.lr.ph, label %.loopexit

.preheader.lr.ph:                                 ; preds = %.preheader92
  %75 = icmp sgt i32 %2, 0
  br i1 %75, label %.preheader.us, label %.preheader

.preheader.us:                                    ; preds = %.preheader.lr.ph, %._crit_edge102.us
  %indvars.iv117 = phi i64 [ %indvars.iv.next118, %._crit_edge102.us ], [ 2, %.preheader.lr.ph ]
  %indvars.iv.next118 = add nuw nsw i64 %indvars.iv117, 1
  %76 = trunc nuw nsw i64 %indvars.iv.next118 to i32
  br label %77

77:                                               ; preds = %.preheader.us, %91
  %.176100.us = phi i32 [ 0, %.preheader.us ], [ %92, %91 ]
  %notmask88.us = shl nsw i32 -1, %.176100.us
  %78 = xor i32 %notmask88.us, -1
  %79 = shl nuw i32 1, %.176100.us
  %80 = and i32 %79, %76
  %.not89.us = icmp eq i32 %80, 0
  %81 = zext nneg i32 %78 to i64
  %.not90.us = icmp eq i64 %indvars.iv117, %81
  %or.cond.us = select i1 %.not89.us, i1 true, i1 %.not90.us
  br i1 %or.cond.us, label %91, label %82

82:                                               ; preds = %77
  %83 = load ptr, ptr %7, align 8, !tbaa !25
  %84 = getelementptr inbounds ptr, ptr %83, i64 %indvars.iv117
  %85 = load ptr, ptr %84, align 8, !tbaa !26
  %86 = getelementptr inbounds ptr, ptr %83, i64 %81
  %87 = load ptr, ptr %86, align 8, !tbaa !26
  %88 = load ptr, ptr %87, align 8, !tbaa !17
  %89 = getelementptr inbounds i8, ptr %87, i64 8
  %90 = load ptr, ptr %89, align 8, !tbaa !31
  tail call void @ec2m_add(ptr noundef nonnull %0, ptr noundef %85, ptr noundef %88, ptr noundef %90, i32 noundef 1, ptr noundef %85)
  br label %91

91:                                               ; preds = %82, %77
  %92 = add nuw nsw i32 %.176100.us, 1
  %exitcond116.not = icmp eq i32 %92, %2
  br i1 %exitcond116.not, label %._crit_edge102.us, label %77, !llvm.loop !32

._crit_edge102.us:                                ; preds = %91
  %93 = load ptr, ptr %7, align 8, !tbaa !25
  %94 = getelementptr inbounds ptr, ptr %93, i64 %indvars.iv117
  %95 = load ptr, ptr %94, align 8, !tbaa !26
  tail call void @ec2m_point_to_affine(ptr noundef nonnull %0, ptr noundef %95)
  %exitcond121.not = icmp eq i64 %indvars.iv.next118, %34
  br i1 %exitcond121.not, label %.loopexit, label %.preheader.us, !llvm.loop !33

.preheader:                                       ; preds = %.preheader.lr.ph, %.preheader
  %indvars.iv111 = phi i64 [ %indvars.iv.next112, %.preheader ], [ 2, %.preheader.lr.ph ]
  %96 = load ptr, ptr %7, align 8, !tbaa !25
  %97 = getelementptr inbounds ptr, ptr %96, i64 %indvars.iv111
  %98 = load ptr, ptr %97, align 8, !tbaa !26
  tail call void @ec2m_point_to_affine(ptr noundef nonnull %0, ptr noundef %98)
  %indvars.iv.next112 = add nuw nsw i64 %indvars.iv111, 1
  %exitcond115.not = icmp eq i64 %indvars.iv.next112, %34
  br i1 %exitcond115.not, label %.loopexit, label %.preheader, !llvm.loop !33

.loopexit:                                        ; preds = %.preheader, %._crit_edge102.us, %14, %.preheader92
  %.077 = phi ptr [ %46, %.preheader92 ], [ null, %14 ], [ %46, %._crit_edge102.us ], [ %46, %.preheader ]
  store ptr %11, ptr %3, align 8, !tbaa !26
  br label %99

99:                                               ; preds = %.loopexit, %48, %38, %25, %13, %9, %5
  %.178 = phi ptr [ null, %9 ], [ null, %13 ], [ %.077, %.loopexit ], [ null, %38 ], [ null, %48 ], [ null, %25 ], [ null, %5 ]
  %.074 = phi i32 [ 1, %9 ], [ 1, %13 ], [ 0, %.loopexit ], [ 1, %38 ], [ 2, %48 ], [ 2, %25 ], [ 2, %5 ]
  tail call void @ec_point_free(ptr noundef %.178) #4
  ret i32 %.074
}

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.umax.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, !7, i64 0}
!6 = !{!"EcPrecomp_st", !7, i64 0, !8, i64 8}
!7 = !{!"int", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!8, !8, i64 0}
!11 = !{!12, !7, i64 8}
!12 = !{!"EcPrecompComb_st", !13, i64 0, !7, i64 8}
!13 = !{!"any pointer", !8, i64 0}
!14 = !{!15, !16, i64 24}
!15 = !{!"EC2m_st", !13, i64 0, !16, i64 8, !13, i64 16, !16, i64 24}
!16 = !{!"long", !8, i64 0}
!17 = !{!18, !13, i64 0}
!18 = !{!"ECPoint_st", !13, i64 0, !13, i64 8, !13, i64 16}
!19 = !{!20, !16, i64 8}
!20 = !{!"WordArray_st", !13, i64 0, !16, i64 8}
!21 = !{!15, !13, i64 0}
!22 = !{!23, !13, i64 0}
!23 = !{!"Gf2mCtx_st", !13, i64 0, !13, i64 8, !16, i64 16}
!24 = !{!7, !7, i64 0}
!25 = !{!12, !13, i64 0}
!26 = !{!13, !13, i64 0}
!27 = distinct !{!27, !28}
!28 = !{!"llvm.loop.mustprogress"}
!29 = distinct !{!29, !28}
!30 = distinct !{!30, !28}
!31 = !{!18, !13, i64 8}
!32 = distinct !{!32, !28}
!33 = distinct !{!33, !28}


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