; 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.EcPrecompComb_st = type { ptr, 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

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

declare void @ec_point_free(ptr noundef) #1

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

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 482, i32 noundef %30, ptr noundef null)
  br label %269

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 483, i32 noundef %38, ptr noundef null)
  br label %269

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

55:                                               ; preds = %41
  br label %56

56:                                               ; preds = %55
  %57 = load ptr, ptr %5, align 8, !tbaa !5
  %58 = getelementptr inbounds %struct.EcGfpCtx_st, ptr %57, i32 0, i32 4
  %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 !21
  %63 = getelementptr inbounds %struct.WordArray_st, ptr %62, i32 0, i32 1
  %64 = load i64, ptr %63, align 8, !tbaa !23
  %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 492, i32 noundef %67, ptr noundef null)
  br label %269

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.EcGfpCtx_st, ptr %71, i32 0, i32 4
  %73 = load i64, ptr %72, align 8, !tbaa !17
  %74 = trunc i64 %73 to i32
  %75 = mul nsw i32 8, %74
  %76 = sext i32 %75 to i64
  %77 = mul i64 %76, 8
  %78 = load i32, ptr %7, align 4, !tbaa !9
  %79 = sext i32 %78 to i64
  %80 = add i64 %77, %79
  %81 = sub i64 %80, 1
  %82 = load i32, ptr %7, align 4, !tbaa !9
  %83 = sext i32 %82 to i64
  %84 = udiv i64 %81, %83
  %85 = trunc i64 %84 to i32
  store i32 %85, ptr %13, align 4, !tbaa !9
  %86 = load i32, ptr %7, align 4, !tbaa !9
  %87 = shl i32 1, %86
  %88 = sub nsw i32 %87, 1
  store i32 %88, ptr %14, align 4, !tbaa !9
  br label %89

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

97:                                               ; preds = %89
  store i32 1, ptr %16, align 4, !tbaa !9
  %98 = load i32, ptr %16, align 4, !tbaa !9
  call void @stacktrace_create(ptr noundef @.str, i64 noundef 497, i32 noundef %98, ptr noundef null)
  br label %269

99:                                               ; preds = %89
  br label %100

100:                                              ; preds = %99
  br label %101

101:                                              ; preds = %100
  store i32 0, ptr %9, align 4, !tbaa !9
  br label %102

102:                                              ; preds = %132, %101
  %103 = load i32, ptr %9, align 4, !tbaa !9
  %104 = load i32, ptr %14, align 4, !tbaa !9
  %105 = icmp slt i32 %103, %104
  br i1 %105, label %106, label %135

106:                                              ; preds = %102
  br label %107

107:                                              ; preds = %106
  %108 = load ptr, ptr %5, align 8, !tbaa !5
  %109 = getelementptr inbounds %struct.EcGfpCtx_st, ptr %108, i32 0, i32 4
  %110 = load i64, ptr %109, align 8, !tbaa !17
  %111 = call ptr @ec_point_alloc(i64 noundef %110)
  %112 = load ptr, ptr %12, align 8, !tbaa !5
  %113 = getelementptr inbounds %struct.EcPrecompComb_st, ptr %112, i32 0, i32 0
  %114 = load ptr, ptr %113, align 8, !tbaa !16
  %115 = load i32, ptr %9, align 4, !tbaa !9
  %116 = sext i32 %115 to i64
  %117 = getelementptr inbounds ptr, ptr %114, i64 %116
  store ptr %111, ptr %117, align 8, !tbaa !5
  %118 = icmp eq ptr null, %111
  br i1 %118, label %119, label %121

119:                                              ; preds = %107
  store i32 2, ptr %16, align 4, !tbaa !9
  %120 = load i32, ptr %16, align 4, !tbaa !9
  call void @stacktrace_add(ptr noundef @.str, i64 noundef 499, i32 noundef %120)
  br label %269

121:                                              ; preds = %107
  br label %122

122:                                              ; preds = %121
  br label %123

123:                                              ; preds = %122
  %124 = load ptr, ptr %5, align 8, !tbaa !5
  %125 = load ptr, ptr %12, align 8, !tbaa !5
  %126 = getelementptr inbounds %struct.EcPrecompComb_st, ptr %125, i32 0, i32 0
  %127 = load ptr, ptr %126, align 8, !tbaa !16
  %128 = load i32, ptr %9, align 4, !tbaa !9
  %129 = sext i32 %128 to i64
  %130 = getelementptr inbounds ptr, ptr %127, i64 %129
  %131 = load ptr, ptr %130, align 8, !tbaa !5
  call void @ecp_point_zero(ptr noundef %124, ptr noundef %131)
  br label %132

132:                                              ; preds = %123
  %133 = load i32, ptr %9, align 4, !tbaa !9
  %134 = add nsw i32 %133, 1
  store i32 %134, ptr %9, align 4, !tbaa !9
  br label %102, !llvm.loop !25

135:                                              ; preds = %102
  br label %136

136:                                              ; preds = %135
  %137 = load ptr, ptr %6, align 8, !tbaa !5
  %138 = call ptr @ec_point_copy_with_alloc(ptr noundef %137)
  store ptr %138, ptr %11, align 8, !tbaa !5
  %139 = icmp eq ptr null, %138
  br i1 %139, label %140, label %142

140:                                              ; preds = %136
  store i32 2, ptr %16, align 4, !tbaa !9
  %141 = load i32, ptr %16, align 4, !tbaa !9
  call void @stacktrace_add(ptr noundef @.str, i64 noundef 503, i32 noundef %141)
  br label %269

142:                                              ; preds = %136
  br label %143

143:                                              ; preds = %142
  br label %144

144:                                              ; preds = %143
  %145 = load ptr, ptr %11, align 8, !tbaa !5
  %146 = load ptr, ptr %12, align 8, !tbaa !5
  %147 = getelementptr inbounds %struct.EcPrecompComb_st, ptr %146, i32 0, i32 0
  %148 = load ptr, ptr %147, align 8, !tbaa !16
  %149 = getelementptr inbounds ptr, ptr %148, i64 0
  %150 = load ptr, ptr %149, align 8, !tbaa !5
  call void @ec_point_copy(ptr noundef %145, ptr noundef %150)
  store i32 1, ptr %9, align 4, !tbaa !9
  br label %151

151:                                              ; preds = %188, %144
  %152 = load i32, ptr %9, align 4, !tbaa !9
  %153 = load i32, ptr %7, align 4, !tbaa !9
  %154 = icmp slt i32 %152, %153
  br i1 %154, label %155, label %191

155:                                              ; preds = %151
  store i32 0, ptr %10, align 4, !tbaa !9
  br label %156

156:                                              ; preds = %164, %155
  %157 = load i32, ptr %10, align 4, !tbaa !9
  %158 = load i32, ptr %13, align 4, !tbaa !9
  %159 = icmp slt i32 %157, %158
  br i1 %159, label %160, label %167

160:                                              ; preds = %156
  %161 = load ptr, ptr %5, align 8, !tbaa !5
  %162 = load ptr, ptr %11, align 8, !tbaa !5
  %163 = load ptr, ptr %11, align 8, !tbaa !5
  call void @ecp_double_point(ptr noundef %161, ptr noundef %162, ptr noundef %163)
  br label %164

164:                                              ; preds = %160
  %165 = load i32, ptr %10, align 4, !tbaa !9
  %166 = add nsw i32 %165, 1
  store i32 %166, ptr %10, align 4, !tbaa !9
  br label %156, !llvm.loop !27

167:                                              ; preds = %156
  %168 = load ptr, ptr %11, align 8, !tbaa !5
  %169 = load ptr, ptr %12, align 8, !tbaa !5
  %170 = getelementptr inbounds %struct.EcPrecompComb_st, ptr %169, i32 0, i32 0
  %171 = load ptr, ptr %170, align 8, !tbaa !16
  %172 = load i32, ptr %9, align 4, !tbaa !9
  %173 = shl i32 1, %172
  %174 = sub nsw i32 %173, 1
  %175 = sext i32 %174 to i64
  %176 = getelementptr inbounds ptr, ptr %171, i64 %175
  %177 = load ptr, ptr %176, align 8, !tbaa !5
  call void @ec_point_copy(ptr noundef %168, ptr noundef %177)
  %178 = load ptr, ptr %5, align 8, !tbaa !5
  %179 = load ptr, ptr %12, align 8, !tbaa !5
  %180 = getelementptr inbounds %struct.EcPrecompComb_st, ptr %179, i32 0, i32 0
  %181 = load ptr, ptr %180, align 8, !tbaa !16
  %182 = load i32, ptr %9, align 4, !tbaa !9
  %183 = shl i32 1, %182
  %184 = sub nsw i32 %183, 1
  %185 = sext i32 %184 to i64
  %186 = getelementptr inbounds ptr, ptr %181, i64 %185
  %187 = load ptr, ptr %186, align 8, !tbaa !5
  call void @ecp_point_to_affine(ptr noundef %178, ptr noundef %187)
  br label %188

188:                                              ; preds = %167
  %189 = load i32, ptr %9, align 4, !tbaa !9
  %190 = add nsw i32 %189, 1
  store i32 %190, ptr %9, align 4, !tbaa !9
  br label %151, !llvm.loop !28

191:                                              ; preds = %151
  store i32 2, ptr %9, align 4, !tbaa !9
  br label %192

192:                                              ; preds = %262, %191
  %193 = load i32, ptr %9, align 4, !tbaa !9
  %194 = load i32, ptr %14, align 4, !tbaa !9
  %195 = icmp slt i32 %193, %194
  br i1 %195, label %196, label %265

196:                                              ; preds = %192
  store i32 0, ptr %10, align 4, !tbaa !9
  br label %197

197:                                              ; preds = %250, %196
  %198 = load i32, ptr %10, align 4, !tbaa !9
  %199 = load i32, ptr %7, align 4, !tbaa !9
  %200 = icmp slt i32 %198, %199
  br i1 %200, label %201, label %253

201:                                              ; preds = %197
  call void @llvm.lifetime.start.p0(i64 4, ptr %17) #4
  %202 = load i32, ptr %10, align 4, !tbaa !9
  %203 = shl i32 1, %202
  %204 = sub nsw i32 %203, 1
  store i32 %204, ptr %17, align 4, !tbaa !9
  %205 = load i32, ptr %9, align 4, !tbaa !9
  %206 = add nsw i32 %205, 1
  %207 = load i32, ptr %10, align 4, !tbaa !9
  %208 = ashr i32 %206, %207
  %209 = and i32 %208, 1
  %210 = icmp ne i32 %209, 0
  br i1 %210, label %211, label %249

211:                                              ; preds = %201
  %212 = load i32, ptr %9, align 4, !tbaa !9
  %213 = load i32, ptr %17, align 4, !tbaa !9
  %214 = icmp ne i32 %212, %213
  br i1 %214, label %215, label %249

215:                                              ; preds = %211
  %216 = load ptr, ptr %5, align 8, !tbaa !5
  %217 = load ptr, ptr %12, align 8, !tbaa !5
  %218 = getelementptr inbounds %struct.EcPrecompComb_st, ptr %217, i32 0, i32 0
  %219 = load ptr, ptr %218, align 8, !tbaa !16
  %220 = load i32, ptr %9, align 4, !tbaa !9
  %221 = sext i32 %220 to i64
  %222 = getelementptr inbounds ptr, ptr %219, i64 %221
  %223 = load ptr, ptr %222, align 8, !tbaa !5
  %224 = load ptr, ptr %12, align 8, !tbaa !5
  %225 = getelementptr inbounds %struct.EcPrecompComb_st, ptr %224, i32 0, i32 0
  %226 = load ptr, ptr %225, align 8, !tbaa !16
  %227 = load i32, ptr %17, align 4, !tbaa !9
  %228 = sext i32 %227 to i64
  %229 = getelementptr inbounds ptr, ptr %226, i64 %228
  %230 = load ptr, ptr %229, align 8, !tbaa !5
  %231 = getelementptr inbounds %struct.ECPoint_st, ptr %230, i32 0, i32 0
  %232 = load ptr, ptr %231, align 8, !tbaa !21
  %233 = load ptr, ptr %12, align 8, !tbaa !5
  %234 = getelementptr inbounds %struct.EcPrecompComb_st, ptr %233, i32 0, i32 0
  %235 = load ptr, ptr %234, align 8, !tbaa !16
  %236 = load i32, ptr %17, align 4, !tbaa !9
  %237 = sext i32 %236 to i64
  %238 = getelementptr inbounds ptr, ptr %235, i64 %237
  %239 = load ptr, ptr %238, align 8, !tbaa !5
  %240 = getelementptr inbounds %struct.ECPoint_st, ptr %239, i32 0, i32 1
  %241 = load ptr, ptr %240, align 8, !tbaa !29
  %242 = load ptr, ptr %12, align 8, !tbaa !5
  %243 = getelementptr inbounds %struct.EcPrecompComb_st, ptr %242, i32 0, i32 0
  %244 = load ptr, ptr %243, align 8, !tbaa !16
  %245 = load i32, ptr %9, align 4, !tbaa !9
  %246 = sext i32 %245 to i64
  %247 = getelementptr inbounds ptr, ptr %244, i64 %246
  %248 = load ptr, ptr %247, align 8, !tbaa !5
  call void @ecp_add_point(ptr noundef %216, ptr noundef %223, ptr noundef %232, ptr noundef %241, i32 noundef 1, ptr noundef %248)
  br label %249

249:                                              ; preds = %215, %211, %201
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #4
  br label %250

250:                                              ; preds = %249
  %251 = load i32, ptr %10, align 4, !tbaa !9
  %252 = add nsw i32 %251, 1
  store i32 %252, ptr %10, align 4, !tbaa !9
  br label %197, !llvm.loop !30

253:                                              ; preds = %197
  %254 = load ptr, ptr %5, align 8, !tbaa !5
  %255 = load ptr, ptr %12, align 8, !tbaa !5
  %256 = getelementptr inbounds %struct.EcPrecompComb_st, ptr %255, i32 0, i32 0
  %257 = load ptr, ptr %256, align 8, !tbaa !16
  %258 = load i32, ptr %9, align 4, !tbaa !9
  %259 = sext i32 %258 to i64
  %260 = getelementptr inbounds ptr, ptr %257, i64 %259
  %261 = load ptr, ptr %260, align 8, !tbaa !5
  call void @ecp_point_to_affine(ptr noundef %254, ptr noundef %261)
  br label %262

262:                                              ; preds = %253
  %263 = load i32, ptr %9, align 4, !tbaa !9
  %264 = add nsw i32 %263, 1
  store i32 %264, ptr %9, align 4, !tbaa !9
  br label %192, !llvm.loop !31

265:                                              ; preds = %192
  br label %266

266:                                              ; preds = %265, %52
  %267 = load ptr, ptr %15, align 8, !tbaa !5
  %268 = load ptr, ptr %8, align 8, !tbaa !5
  store ptr %267, ptr %268, align 8, !tbaa !5
  br label %269

269:                                              ; preds = %266, %140, %119, %97, %66, %37, %29, %21
  %270 = load ptr, ptr %11, align 8, !tbaa !5
  call void @ec_point_free(ptr noundef %270)
  %271 = 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 %271
}

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, !20, i64 32}
!18 = !{!"EcGfpCtx_st", !6, i64 0, !6, i64 8, !6, i64 16, !19, i64 24, !20, i64 32}
!19 = !{!"_Bool", !7, i64 0}
!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 = distinct !{!27, !26}
!28 = distinct !{!28, !26}
!29 = !{!22, !6, i64 8}
!30 = distinct !{!30, !26}
!31 = distinct !{!31, !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 [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

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

declare void @ec_point_free(ptr noundef) local_unnamed_addr #0

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

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

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

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 32
  %20 = load i64, ptr %19, align 8, !tbaa !14
  %21 = load ptr, ptr %1, align 8, !tbaa !18
  %22 = getelementptr inbounds i8, ptr %21, i64 8
  %23 = load i64, ptr %22, align 8, !tbaa !20
  %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 492, i32 noundef 2, ptr noundef null) #4
  br label %106

26:                                               ; preds = %18
  %27 = trunc i64 %20 to i32
  %28 = shl nsw i32 %27, 3
  %29 = sext i32 %28 to i64
  %30 = shl nsw i64 %29, 3
  %31 = sext i32 %2 to i64
  %32 = add nsw i64 %31, -1
  %33 = add nsw i64 %32, %30
  %34 = udiv i64 %33, %31
  %35 = trunc i64 %34 to i32
  %notmask = shl nsw i32 -1, %2
  %36 = xor i32 %notmask, -1
  %37 = zext nneg i32 %36 to i64
  %38 = shl nuw nsw i64 %37, 3
  %39 = tail call noalias ptr @calloc(i64 noundef 1, i64 noundef %38) #5
  store ptr %39, ptr %7, align 8, !tbaa !22
  %40 = icmp eq ptr %39, null
  br i1 %40, label %41, label %.preheader97

.preheader97:                                     ; preds = %26
  %.not107 = icmp eq i32 %2, 0
  br i1 %.not107, label %._crit_edge, label %.lr.ph.preheader

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

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

.lr.ph:                                           ; preds = %.lr.ph.preheader, %48
  %indvars.iv = phi i64 [ 0, %.lr.ph.preheader ], [ %indvars.iv.next, %48 ]
  %42 = load i64, ptr %19, align 8, !tbaa !14
  %43 = tail call ptr @ec_point_alloc(i64 noundef %42) #4
  %44 = load ptr, ptr %7, align 8, !tbaa !22
  %45 = getelementptr inbounds ptr, ptr %44, i64 %indvars.iv
  store ptr %43, ptr %45, align 8, !tbaa !23
  %46 = icmp eq ptr %43, null
  br i1 %46, label %47, label %48

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

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

._crit_edge:                                      ; preds = %48, %.preheader97
  %52 = tail call ptr @ec_point_copy_with_alloc(ptr noundef nonnull %1) #4
  %53 = icmp eq ptr %52, null
  br i1 %53, label %54, label %55

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

55:                                               ; preds = %._crit_edge
  %56 = load ptr, ptr %7, align 8, !tbaa !22
  %57 = load ptr, ptr %56, align 8, !tbaa !23
  tail call void @ec_point_copy(ptr noundef nonnull %52, ptr noundef %57) #4
  %58 = icmp sgt i32 %2, 1
  br i1 %58, label %.preheader96.lr.ph, label %.preheader95

.preheader96.lr.ph:                               ; preds = %55
  %59 = icmp sgt i32 %35, 0
  br i1 %59, label %.preheader96.us, label %.preheader96

.preheader96.us:                                  ; preds = %.preheader96.lr.ph, %._crit_edge101.us
  %.1102.us = phi i32 [ %71, %._crit_edge101.us ], [ 1, %.preheader96.lr.ph ]
  br label %60

60:                                               ; preds = %.preheader96.us, %60
  %.07799.us = phi i32 [ 0, %.preheader96.us ], [ %61, %60 ]
  tail call void @ecp_double_point(ptr noundef nonnull %0, ptr noundef nonnull %52, ptr noundef nonnull %52)
  %61 = add nuw nsw i32 %.07799.us, 1
  %62 = icmp slt i32 %61, %35
  br i1 %62, label %60, label %._crit_edge101.us, !llvm.loop !26

._crit_edge101.us:                                ; preds = %60
  %63 = load ptr, ptr %7, align 8, !tbaa !22
  %notmask94.us = shl nsw i32 -1, %.1102.us
  %64 = xor i32 %notmask94.us, -1
  %65 = zext nneg i32 %64 to i64
  %66 = getelementptr inbounds ptr, ptr %63, i64 %65
  %67 = load ptr, ptr %66, align 8, !tbaa !23
  tail call void @ec_point_copy(ptr noundef nonnull %52, ptr noundef %67) #4
  %68 = load ptr, ptr %7, align 8, !tbaa !22
  %69 = getelementptr inbounds ptr, ptr %68, i64 %65
  %70 = load ptr, ptr %69, align 8, !tbaa !23
  tail call void @ecp_point_to_affine(ptr noundef nonnull %0, ptr noundef %70)
  %71 = add nuw nsw i32 %.1102.us, 1
  %exitcond112.not = icmp eq i32 %71, %2
  br i1 %exitcond112.not, label %.preheader95, label %.preheader96.us, !llvm.loop !27

.preheader96:                                     ; preds = %.preheader96.lr.ph, %.preheader96
  %.1102 = phi i32 [ %80, %.preheader96 ], [ 1, %.preheader96.lr.ph ]
  %72 = load ptr, ptr %7, align 8, !tbaa !22
  %notmask94 = shl nsw i32 -1, %.1102
  %73 = xor i32 %notmask94, -1
  %74 = zext nneg i32 %73 to i64
  %75 = getelementptr inbounds ptr, ptr %72, i64 %74
  %76 = load ptr, ptr %75, align 8, !tbaa !23
  tail call void @ec_point_copy(ptr noundef nonnull %52, ptr noundef %76) #4
  %77 = load ptr, ptr %7, align 8, !tbaa !22
  %78 = getelementptr inbounds ptr, ptr %77, i64 %74
  %79 = load ptr, ptr %78, align 8, !tbaa !23
  tail call void @ecp_point_to_affine(ptr noundef nonnull %0, ptr noundef %79)
  %80 = add nuw nsw i32 %.1102, 1
  %exitcond111.not = icmp eq i32 %80, %2
  br i1 %exitcond111.not, label %.preheader95, label %.preheader96, !llvm.loop !27

.preheader95:                                     ; preds = %.preheader96, %._crit_edge101.us, %55
  %81 = icmp ult i32 %notmask, -3
  br i1 %81, label %.preheader.lr.ph, label %.loopexit

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

.preheader.us:                                    ; preds = %.preheader.lr.ph, %._crit_edge105.us
  %indvars.iv119 = phi i64 [ %indvars.iv.next120, %._crit_edge105.us ], [ 2, %.preheader.lr.ph ]
  %indvars.iv.next120 = add nuw nsw i64 %indvars.iv119, 1
  %83 = trunc nuw nsw i64 %indvars.iv.next120 to i32
  br label %84

84:                                               ; preds = %.preheader.us, %98
  %.178103.us = phi i32 [ 0, %.preheader.us ], [ %99, %98 ]
  %notmask91.us = shl nsw i32 -1, %.178103.us
  %85 = xor i32 %notmask91.us, -1
  %86 = shl nuw i32 1, %.178103.us
  %87 = and i32 %86, %83
  %.not92.us = icmp eq i32 %87, 0
  %88 = zext nneg i32 %85 to i64
  %.not93.us = icmp eq i64 %indvars.iv119, %88
  %or.cond.us = select i1 %.not92.us, i1 true, i1 %.not93.us
  br i1 %or.cond.us, label %98, label %89

89:                                               ; preds = %84
  %90 = load ptr, ptr %7, align 8, !tbaa !22
  %91 = getelementptr inbounds ptr, ptr %90, i64 %indvars.iv119
  %92 = load ptr, ptr %91, align 8, !tbaa !23
  %93 = getelementptr inbounds ptr, ptr %90, i64 %88
  %94 = load ptr, ptr %93, align 8, !tbaa !23
  %95 = load ptr, ptr %94, align 8, !tbaa !18
  %96 = getelementptr inbounds i8, ptr %94, i64 8
  %97 = load ptr, ptr %96, align 8, !tbaa !28
  tail call void @ecp_add_point(ptr noundef nonnull %0, ptr noundef %92, ptr noundef %95, ptr noundef %97, i32 noundef 1, ptr noundef %92)
  br label %98

98:                                               ; preds = %89, %84
  %99 = add nuw nsw i32 %.178103.us, 1
  %exitcond118.not = icmp eq i32 %99, %2
  br i1 %exitcond118.not, label %._crit_edge105.us, label %84, !llvm.loop !29

._crit_edge105.us:                                ; preds = %98
  %100 = load ptr, ptr %7, align 8, !tbaa !22
  %101 = getelementptr inbounds ptr, ptr %100, i64 %indvars.iv119
  %102 = load ptr, ptr %101, align 8, !tbaa !23
  tail call void @ecp_point_to_affine(ptr noundef nonnull %0, ptr noundef %102)
  %exitcond123.not = icmp eq i64 %indvars.iv.next120, %37
  br i1 %exitcond123.not, label %.loopexit, label %.preheader.us, !llvm.loop !30

.preheader:                                       ; preds = %.preheader.lr.ph, %.preheader
  %indvars.iv113 = phi i64 [ %indvars.iv.next114, %.preheader ], [ 2, %.preheader.lr.ph ]
  %103 = load ptr, ptr %7, align 8, !tbaa !22
  %104 = getelementptr inbounds ptr, ptr %103, i64 %indvars.iv113
  %105 = load ptr, ptr %104, align 8, !tbaa !23
  tail call void @ecp_point_to_affine(ptr noundef nonnull %0, ptr noundef %105)
  %indvars.iv.next114 = add nuw nsw i64 %indvars.iv113, 1
  %exitcond117.not = icmp eq i64 %indvars.iv.next114, %37
  br i1 %exitcond117.not, label %.loopexit, label %.preheader, !llvm.loop !30

.loopexit:                                        ; preds = %.preheader, %._crit_edge105.us, %14, %.preheader95
  %.079 = phi ptr [ %52, %.preheader95 ], [ null, %14 ], [ %52, %._crit_edge105.us ], [ %52, %.preheader ]
  store ptr %11, ptr %3, align 8, !tbaa !23
  br label %106

106:                                              ; preds = %.loopexit, %54, %47, %41, %25, %13, %9, %5
  %.180 = phi ptr [ null, %9 ], [ null, %13 ], [ %.079, %.loopexit ], [ null, %41 ], [ null, %47 ], [ null, %54 ], [ null, %25 ], [ null, %5 ]
  %.076 = phi i32 [ 1, %9 ], [ 1, %13 ], [ 0, %.loopexit ], [ 1, %41 ], [ 2, %47 ], [ 2, %54 ], [ 2, %25 ], [ 2, %5 ]
  tail call void @ec_point_free(ptr noundef %.180) #4
  ret i32 %.076
}

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


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