; LLVM IR from specinfo-ua/UAPKI :: library/uapkic/src (ecdsa)

; 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.ByteArray_st = type { ptr, i64 }
%struct.EcCtx_st = type { ptr, ptr, ptr, ptr, i8, i8 }
%struct.EcParamsCtx_st = type { i32, ptr, ptr, ptr, ptr, i8, i64, ptr, ptr, i32, ptr }
%struct.WordArray_st = type { ptr, i64 }
%struct.EcGfpCtx_st = type { ptr, ptr, ptr, i8, i64 }
%struct.GfpCtx_st = type { ptr, ptr, ptr, ptr }
%struct.EC2m_st = type { ptr, i64, ptr, i64 }
%struct.Gf2mCtx_st = type { ptr, ptr, i64 }
%struct.ECPoint_st = type { ptr, ptr, ptr }

@.str = external hidden unnamed_addr constant [15 x i8], align 1
@default_opt_level = external global i32, align 4

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

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

19:                                               ; preds = %16
  store i32 2, ptr %13, align 4, !tbaa !9
  %20 = load i32, ptr %13, align 4, !tbaa !9
  call void @stacktrace_create(ptr noundef @.str, i64 noundef 51, i32 noundef %20, ptr noundef null)
  br label %293

21:                                               ; preds = %16
  br label %22

22:                                               ; preds = %21
  br label %23

23:                                               ; preds = %22
  br label %24

24:                                               ; preds = %23
  %25 = load ptr, ptr %7, align 8, !tbaa !5
  %26 = icmp ne ptr %25, null
  br i1 %26, label %29, label %27

27:                                               ; preds = %24
  store i32 2, ptr %13, align 4, !tbaa !9
  %28 = load i32, ptr %13, align 4, !tbaa !9
  call void @stacktrace_create(ptr noundef @.str, i64 noundef 52, i32 noundef %28, ptr noundef null)
  br label %293

29:                                               ; preds = %24
  br label %30

30:                                               ; preds = %29
  br label %31

31:                                               ; preds = %30
  br label %32

32:                                               ; preds = %31
  %33 = load ptr, ptr %8, align 8, !tbaa !5
  %34 = icmp ne ptr %33, null
  br i1 %34, label %37, label %35

35:                                               ; preds = %32
  store i32 2, ptr %13, align 4, !tbaa !9
  %36 = load i32, ptr %13, align 4, !tbaa !9
  call void @stacktrace_create(ptr noundef @.str, i64 noundef 53, i32 noundef %36, ptr noundef null)
  br label %293

37:                                               ; preds = %32
  br label %38

38:                                               ; preds = %37
  br label %39

39:                                               ; preds = %38
  br label %40

40:                                               ; preds = %39
  %41 = load ptr, ptr %9, align 8, !tbaa !5
  %42 = icmp ne ptr %41, null
  br i1 %42, label %45, label %43

43:                                               ; preds = %40
  store i32 2, ptr %13, align 4, !tbaa !9
  %44 = load i32, ptr %13, align 4, !tbaa !9
  call void @stacktrace_create(ptr noundef @.str, i64 noundef 54, i32 noundef %44, ptr noundef null)
  br label %293

45:                                               ; preds = %40
  br label %46

46:                                               ; preds = %45
  br label %47

47:                                               ; preds = %46
  br label %48

48:                                               ; preds = %47
  %49 = load ptr, ptr %7, align 8, !tbaa !5
  %50 = getelementptr inbounds %struct.ByteArray_st, ptr %49, i32 0, i32 0
  %51 = load ptr, ptr %50, align 8, !tbaa !11
  %52 = load ptr, ptr %7, align 8, !tbaa !5
  %53 = getelementptr inbounds %struct.ByteArray_st, ptr %52, i32 0, i32 1
  %54 = load i64, ptr %53, align 8, !tbaa !14
  %55 = call ptr @wa_alloc_from_be(ptr noundef %51, i64 noundef %54)
  store ptr %55, ptr %11, align 8, !tbaa !5
  %56 = icmp eq ptr null, %55
  br i1 %56, label %57, label %59

57:                                               ; preds = %48
  store i32 2, ptr %13, align 4, !tbaa !9
  %58 = load i32, ptr %13, align 4, !tbaa !9
  call void @stacktrace_add(ptr noundef @.str, i64 noundef 56, i32 noundef %58)
  br label %293

59:                                               ; preds = %48
  br label %60

60:                                               ; preds = %59
  br label %61

61:                                               ; preds = %60
  %62 = load ptr, ptr %11, align 8, !tbaa !5
  %63 = call zeroext i1 @int_is_zero(ptr noundef %62)
  br i1 %63, label %73, label %64

64:                                               ; preds = %61
  %65 = load ptr, ptr %11, align 8, !tbaa !5
  %66 = load ptr, ptr %6, align 8, !tbaa !5
  %67 = getelementptr inbounds %struct.EcCtx_st, ptr %66, i32 0, i32 0
  %68 = load ptr, ptr %67, align 8, !tbaa !15
  %69 = getelementptr inbounds %struct.EcParamsCtx_st, ptr %68, i32 0, i32 2
  %70 = load ptr, ptr %69, align 8, !tbaa !18
  %71 = call i32 @int_cmp(ptr noundef %65, ptr noundef %70)
  %72 = icmp sge i32 %71, 0
  br i1 %72, label %73, label %78

73:                                               ; preds = %64, %61
  br label %74

74:                                               ; preds = %73
  store i32 6, ptr %13, align 4, !tbaa !9
  %75 = load i32, ptr %13, align 4, !tbaa !9
  call void @stacktrace_create(ptr noundef @.str, i64 noundef 58, i32 noundef %75, ptr noundef null)
  br label %293

76:                                               ; No predecessors!
  br label %77

77:                                               ; preds = %76
  br label %78

78:                                               ; preds = %77, %64
  %79 = load ptr, ptr %11, align 8, !tbaa !5
  %80 = load ptr, ptr %6, align 8, !tbaa !5
  %81 = getelementptr inbounds %struct.EcCtx_st, ptr %80, i32 0, i32 0
  %82 = load ptr, ptr %81, align 8, !tbaa !15
  %83 = getelementptr inbounds %struct.EcParamsCtx_st, ptr %82, i32 0, i32 2
  %84 = load ptr, ptr %83, align 8, !tbaa !18
  %85 = getelementptr inbounds %struct.WordArray_st, ptr %84, i32 0, i32 1
  %86 = load i64, ptr %85, align 8, !tbaa !20
  call void @wa_change_len(ptr noundef %79, i64 noundef %86)
  %87 = load ptr, ptr %6, align 8, !tbaa !5
  %88 = getelementptr inbounds %struct.EcCtx_st, ptr %87, i32 0, i32 0
  %89 = load ptr, ptr %88, align 8, !tbaa !15
  %90 = getelementptr inbounds %struct.EcParamsCtx_st, ptr %89, i32 0, i32 10
  %91 = load ptr, ptr %90, align 8, !tbaa !22
  %92 = icmp eq ptr %91, null
  br i1 %92, label %93, label %115

93:                                               ; preds = %78
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #3
  %94 = load i32, ptr @default_opt_level, align 4, !tbaa !9
  %95 = lshr i32 %94, 8
  %96 = and i32 %95, 15
  store i32 %96, ptr %14, align 4, !tbaa !9
  %97 = load i32, ptr %14, align 4, !tbaa !9
  %98 = icmp eq i32 %97, 0
  br i1 %98, label %99, label %100

99:                                               ; preds = %93
  store i32 5, ptr %14, align 4, !tbaa !9
  br label %100

100:                                              ; preds = %99, %93
  br label %101

101:                                              ; preds = %100
  %102 = load ptr, ptr %6, align 8, !tbaa !5
  %103 = load i32, ptr %14, align 4, !tbaa !9
  %104 = call i32 @ec_set_sign_precomp(ptr noundef %102, i32 noundef 0, i32 noundef %103)
  store i32 %104, ptr %13, align 4, !tbaa !9
  %105 = load i32, ptr %13, align 4, !tbaa !9
  %106 = icmp ne i32 %105, 0
  br i1 %106, label %107, label %109

107:                                              ; preds = %101
  %108 = load i32, ptr %13, align 4, !tbaa !9
  call void @stacktrace_add(ptr noundef @.str, i64 noundef 68, i32 noundef %108)
  store i32 4, ptr %15, align 4
  br label %112

109:                                              ; preds = %101
  br label %110

110:                                              ; preds = %109
  br label %111

111:                                              ; preds = %110
  store i32 0, ptr %15, align 4
  br label %112

112:                                              ; preds = %111, %107
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #3
  %113 = load i32, ptr %15, align 4
  switch i32 %113, label %297 [
    i32 0, label %114
    i32 4, label %293
  ]

114:                                              ; preds = %112
  br label %115

115:                                              ; preds = %114, %78
  %116 = load ptr, ptr %6, align 8, !tbaa !5
  %117 = getelementptr inbounds %struct.EcCtx_st, ptr %116, i32 0, i32 0
  %118 = load ptr, ptr %117, align 8, !tbaa !15
  %119 = getelementptr inbounds %struct.EcParamsCtx_st, ptr %118, i32 0, i32 0
  %120 = load i32, ptr %119, align 8, !tbaa !23
  %121 = icmp eq i32 %120, 0
  br i1 %121, label %122, label %171

122:                                              ; preds = %115
  br label %123

123:                                              ; preds = %122
  %124 = load ptr, ptr %6, align 8, !tbaa !5
  %125 = getelementptr inbounds %struct.EcCtx_st, ptr %124, i32 0, i32 0
  %126 = load ptr, ptr %125, align 8, !tbaa !15
  %127 = getelementptr inbounds %struct.EcParamsCtx_st, ptr %126, i32 0, i32 3
  %128 = load ptr, ptr %127, align 8, !tbaa !24
  %129 = getelementptr inbounds %struct.EcGfpCtx_st, ptr %128, i32 0, i32 4
  %130 = load i64, ptr %129, align 8, !tbaa !25
  %131 = call ptr @ec_point_alloc(i64 noundef %130)
  store ptr %131, ptr %12, align 8, !tbaa !5
  %132 = icmp eq ptr null, %131
  br i1 %132, label %133, label %135

133:                                              ; preds = %123
  store i32 2, ptr %13, align 4, !tbaa !9
  %134 = load i32, ptr %13, align 4, !tbaa !9
  call void @stacktrace_add(ptr noundef @.str, i64 noundef 72, i32 noundef %134)
  br label %293

135:                                              ; preds = %123
  br label %136

136:                                              ; preds = %135
  br label %137

137:                                              ; preds = %136
  %138 = load ptr, ptr %6, align 8, !tbaa !5
  %139 = getelementptr inbounds %struct.EcCtx_st, ptr %138, i32 0, i32 0
  %140 = load ptr, ptr %139, align 8, !tbaa !15
  %141 = getelementptr inbounds %struct.EcParamsCtx_st, ptr %140, i32 0, i32 3
  %142 = load ptr, ptr %141, align 8, !tbaa !24
  %143 = getelementptr inbounds %struct.EcGfpCtx_st, ptr %142, i32 0, i32 0
  %144 = load ptr, ptr %143, align 8, !tbaa !27
  %145 = getelementptr inbounds %struct.GfpCtx_st, ptr %144, i32 0, i32 0
  %146 = load ptr, ptr %145, align 8, !tbaa !28
  %147 = call i64 @int_bit_len(ptr noundef %146)
  %148 = add i64 %147, 7
  %149 = udiv i64 %148, 8
  store i64 %149, ptr %10, align 8, !tbaa !30
  br label %150

150:                                              ; preds = %137
  %151 = load ptr, ptr %6, align 8, !tbaa !5
  %152 = getelementptr inbounds %struct.EcCtx_st, ptr %151, i32 0, i32 0
  %153 = load ptr, ptr %152, align 8, !tbaa !15
  %154 = getelementptr inbounds %struct.EcParamsCtx_st, ptr %153, i32 0, i32 3
  %155 = load ptr, ptr %154, align 8, !tbaa !24
  %156 = load ptr, ptr %6, align 8, !tbaa !5
  %157 = getelementptr inbounds %struct.EcCtx_st, ptr %156, i32 0, i32 0
  %158 = load ptr, ptr %157, align 8, !tbaa !15
  %159 = getelementptr inbounds %struct.EcParamsCtx_st, ptr %158, i32 0, i32 10
  %160 = load ptr, ptr %159, align 8, !tbaa !22
  %161 = load ptr, ptr %11, align 8, !tbaa !5
  %162 = load ptr, ptr %12, align 8, !tbaa !5
  %163 = call i32 @ecp_dual_mul_opt(ptr noundef %155, ptr noundef %160, ptr noundef %161, ptr noundef null, ptr noundef null, ptr noundef %162)
  store i32 %163, ptr %13, align 4, !tbaa !9
  %164 = load i32, ptr %13, align 4, !tbaa !9
  %165 = icmp ne i32 %164, 0
  br i1 %165, label %166, label %168

166:                                              ; preds = %150
  %167 = load i32, ptr %13, align 4, !tbaa !9
  call void @stacktrace_add(ptr noundef @.str, i64 noundef 74, i32 noundef %167)
  br label %293

168:                                              ; preds = %150
  br label %169

169:                                              ; preds = %168
  br label %170

170:                                              ; preds = %169
  br label %222

171:                                              ; preds = %115
  br label %172

172:                                              ; preds = %171
  %173 = load ptr, ptr %6, align 8, !tbaa !5
  %174 = getelementptr inbounds %struct.EcCtx_st, ptr %173, i32 0, i32 0
  %175 = load ptr, ptr %174, align 8, !tbaa !15
  %176 = getelementptr inbounds %struct.EcParamsCtx_st, ptr %175, i32 0, i32 4
  %177 = load ptr, ptr %176, align 8, !tbaa !31
  %178 = getelementptr inbounds %struct.EC2m_st, ptr %177, i32 0, i32 3
  %179 = load i64, ptr %178, align 8, !tbaa !32
  %180 = call ptr @ec_point_alloc(i64 noundef %179)
  store ptr %180, ptr %12, align 8, !tbaa !5
  %181 = icmp eq ptr null, %180
  br i1 %181, label %182, label %184

182:                                              ; preds = %172
  store i32 2, ptr %13, align 4, !tbaa !9
  %183 = load i32, ptr %13, align 4, !tbaa !9
  call void @stacktrace_add(ptr noundef @.str, i64 noundef 77, i32 noundef %183)
  br label %293

184:                                              ; preds = %172
  br label %185

185:                                              ; preds = %184
  br label %186

186:                                              ; preds = %185
  %187 = load ptr, ptr %6, align 8, !tbaa !5
  %188 = getelementptr inbounds %struct.EcCtx_st, ptr %187, i32 0, i32 0
  %189 = load ptr, ptr %188, align 8, !tbaa !15
  %190 = getelementptr inbounds %struct.EcParamsCtx_st, ptr %189, i32 0, i32 4
  %191 = load ptr, ptr %190, align 8, !tbaa !31
  %192 = getelementptr inbounds %struct.EC2m_st, ptr %191, i32 0, i32 0
  %193 = load ptr, ptr %192, align 8, !tbaa !34
  %194 = getelementptr inbounds %struct.Gf2mCtx_st, ptr %193, i32 0, i32 0
  %195 = load ptr, ptr %194, align 8, !tbaa !35
  %196 = getelementptr inbounds i32, ptr %195, i64 0
  %197 = load i32, ptr %196, align 4, !tbaa !9
  %198 = sext i32 %197 to i64
  %199 = add i64 %198, 7
  %200 = udiv i64 %199, 8
  store i64 %200, ptr %10, align 8, !tbaa !30
  br label %201

201:                                              ; preds = %186
  %202 = load ptr, ptr %6, align 8, !tbaa !5
  %203 = getelementptr inbounds %struct.EcCtx_st, ptr %202, i32 0, i32 0
  %204 = load ptr, ptr %203, align 8, !tbaa !15
  %205 = getelementptr inbounds %struct.EcParamsCtx_st, ptr %204, i32 0, i32 4
  %206 = load ptr, ptr %205, align 8, !tbaa !31
  %207 = load ptr, ptr %6, align 8, !tbaa !5
  %208 = getelementptr inbounds %struct.EcCtx_st, ptr %207, i32 0, i32 0
  %209 = load ptr, ptr %208, align 8, !tbaa !15
  %210 = getelementptr inbounds %struct.EcParamsCtx_st, ptr %209, i32 0, i32 10
  %211 = load ptr, ptr %210, align 8, !tbaa !22
  %212 = load ptr, ptr %11, align 8, !tbaa !5
  %213 = load ptr, ptr %12, align 8, !tbaa !5
  %214 = call i32 @ec2m_dual_mul_opt(ptr noundef %206, ptr noundef %211, ptr noundef %212, ptr noundef null, ptr noundef null, ptr noundef %213)
  store i32 %214, ptr %13, align 4, !tbaa !9
  %215 = load i32, ptr %13, align 4, !tbaa !9
  %216 = icmp ne i32 %215, 0
  br i1 %216, label %217, label %219

217:                                              ; preds = %201
  %218 = load i32, ptr %13, align 4, !tbaa !9
  call void @stacktrace_add(ptr noundef @.str, i64 noundef 79, i32 noundef %218)
  br label %293

219:                                              ; preds = %201
  br label %220

220:                                              ; preds = %219
  br label %221

221:                                              ; preds = %220
  br label %222

222:                                              ; preds = %221, %170
  br label %223

223:                                              ; preds = %222
  %224 = load ptr, ptr %12, align 8, !tbaa !5
  %225 = getelementptr inbounds %struct.ECPoint_st, ptr %224, i32 0, i32 0
  %226 = load ptr, ptr %225, align 8, !tbaa !37
  %227 = call ptr @wa_to_ba(ptr noundef %226)
  %228 = load ptr, ptr %8, align 8, !tbaa !5
  store ptr %227, ptr %228, align 8, !tbaa !5
  %229 = icmp eq ptr null, %227
  br i1 %229, label %230, label %232

230:                                              ; preds = %223
  store i32 2, ptr %13, align 4, !tbaa !9
  %231 = load i32, ptr %13, align 4, !tbaa !9
  call void @stacktrace_add(ptr noundef @.str, i64 noundef 82, i32 noundef %231)
  br label %293

232:                                              ; preds = %223
  br label %233

233:                                              ; preds = %232
  br label %234

234:                                              ; preds = %233
  br label %235

235:                                              ; preds = %234
  %236 = load ptr, ptr %12, align 8, !tbaa !5
  %237 = getelementptr inbounds %struct.ECPoint_st, ptr %236, i32 0, i32 1
  %238 = load ptr, ptr %237, align 8, !tbaa !39
  %239 = call ptr @wa_to_ba(ptr noundef %238)
  %240 = load ptr, ptr %9, align 8, !tbaa !5
  store ptr %239, ptr %240, align 8, !tbaa !5
  %241 = icmp eq ptr null, %239
  br i1 %241, label %242, label %244

242:                                              ; preds = %235
  store i32 2, ptr %13, align 4, !tbaa !9
  %243 = load i32, ptr %13, align 4, !tbaa !9
  call void @stacktrace_add(ptr noundef @.str, i64 noundef 83, i32 noundef %243)
  br label %293

244:                                              ; preds = %235
  br label %245

245:                                              ; preds = %244
  br label %246

246:                                              ; preds = %245
  br label %247

247:                                              ; preds = %246
  %248 = load ptr, ptr %8, align 8, !tbaa !5
  %249 = load ptr, ptr %248, align 8, !tbaa !5
  %250 = load i64, ptr %10, align 8, !tbaa !30
  %251 = call i32 @ba_change_len(ptr noundef %249, i64 noundef %250)
  store i32 %251, ptr %13, align 4, !tbaa !9
  %252 = load i32, ptr %13, align 4, !tbaa !9
  %253 = icmp ne i32 %252, 0
  br i1 %253, label %254, label %256

254:                                              ; preds = %247
  %255 = load i32, ptr %13, align 4, !tbaa !9
  call void @stacktrace_add(ptr noundef @.str, i64 noundef 84, i32 noundef %255)
  br label %293

256:                                              ; preds = %247
  br label %257

257:                                              ; preds = %256
  br label %258

258:                                              ; preds = %257
  br label %259

259:                                              ; preds = %258
  %260 = load ptr, ptr %9, align 8, !tbaa !5
  %261 = load ptr, ptr %260, align 8, !tbaa !5
  %262 = load i64, ptr %10, align 8, !tbaa !30
  %263 = call i32 @ba_change_len(ptr noundef %261, i64 noundef %262)
  store i32 %263, ptr %13, align 4, !tbaa !9
  %264 = load i32, ptr %13, align 4, !tbaa !9
  %265 = icmp ne i32 %264, 0
  br i1 %265, label %266, label %268

266:                                              ; preds = %259
  %267 = load i32, ptr %13, align 4, !tbaa !9
  call void @stacktrace_add(ptr noundef @.str, i64 noundef 85, i32 noundef %267)
  br label %293

268:                                              ; preds = %259
  br label %269

269:                                              ; preds = %268
  br label %270

270:                                              ; preds = %269
  br label %271

271:                                              ; preds = %270
  %272 = load ptr, ptr %8, align 8, !tbaa !5
  %273 = load ptr, ptr %272, align 8, !tbaa !5
  %274 = call i32 @ba_swap(ptr noundef %273)
  store i32 %274, ptr %13, align 4, !tbaa !9
  %275 = load i32, ptr %13, align 4, !tbaa !9
  %276 = icmp ne i32 %275, 0
  br i1 %276, label %277, label %279

277:                                              ; preds = %271
  %278 = load i32, ptr %13, align 4, !tbaa !9
  call void @stacktrace_add(ptr noundef @.str, i64 noundef 86, i32 noundef %278)
  br label %293

279:                                              ; preds = %271
  br label %280

280:                                              ; preds = %279
  br label %281

281:                                              ; preds = %280
  br label %282

282:                                              ; preds = %281
  %283 = load ptr, ptr %9, align 8, !tbaa !5
  %284 = load ptr, ptr %283, align 8, !tbaa !5
  %285 = call i32 @ba_swap(ptr noundef %284)
  store i32 %285, ptr %13, align 4, !tbaa !9
  %286 = load i32, ptr %13, align 4, !tbaa !9
  %287 = icmp ne i32 %286, 0
  br i1 %287, label %288, label %290

288:                                              ; preds = %282
  %289 = load i32, ptr %13, align 4, !tbaa !9
  call void @stacktrace_add(ptr noundef @.str, i64 noundef 87, i32 noundef %289)
  br label %293

290:                                              ; preds = %282
  br label %291

291:                                              ; preds = %290
  br label %292

292:                                              ; preds = %291
  br label %293

293:                                              ; preds = %292, %288, %277, %266, %254, %242, %230, %217, %182, %166, %133, %112, %74, %57, %43, %35, %27, %19
  %294 = load ptr, ptr %12, align 8, !tbaa !5
  call void @ec_point_free(ptr noundef %294)
  %295 = load ptr, ptr %11, align 8, !tbaa !5
  call void @wa_free_private(ptr noundef %295)
  %296 = load i32, ptr %13, align 4, !tbaa !9
  store i32 %296, ptr %5, align 4
  store i32 1, ptr %15, align 4
  br label %297

297:                                              ; preds = %293, %112
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #3
  %298 = load i32, ptr %5, align 4
  ret i32 %298
}

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

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

declare ptr @wa_alloc_from_be(ptr noundef, i64 noundef) #2

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

declare zeroext i1 @int_is_zero(ptr noundef) #2

declare i32 @int_cmp(ptr noundef, ptr noundef) #2

declare void @wa_change_len(ptr noundef, i64 noundef) #2

declare i32 @ec_set_sign_precomp(ptr noundef, i32 noundef, i32 noundef) #2

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

declare ptr @ec_point_alloc(i64 noundef) #2

declare i64 @int_bit_len(ptr noundef) #2

declare i32 @ecp_dual_mul_opt(ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef) #2

declare i32 @ec2m_dual_mul_opt(ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef) #2

declare ptr @wa_to_ba(ptr noundef) #2

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

declare i32 @ba_swap(ptr noundef) #2

declare void @ec_point_free(ptr noundef) #2

declare void @wa_free_private(ptr noundef) #2

attributes #0 = { nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }

!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = !{!12, !6, i64 0}
!12 = !{!"ByteArray_st", !6, i64 0, !13, i64 8}
!13 = !{!"long", !7, i64 0}
!14 = !{!12, !13, i64 8}
!15 = !{!16, !6, i64 0}
!16 = !{!"EcCtx_st", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !17, i64 32, !17, i64 33}
!17 = !{!"_Bool", !7, i64 0}
!18 = !{!19, !6, i64 16}
!19 = !{!"EcParamsCtx_st", !10, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !6, i64 32, !17, i64 40, !13, i64 48, !6, i64 56, !6, i64 64, !10, i64 72, !6, i64 80}
!20 = !{!21, !13, i64 8}
!21 = !{!"WordArray_st", !6, i64 0, !13, i64 8}
!22 = !{!19, !6, i64 80}
!23 = !{!19, !10, i64 0}
!24 = !{!19, !6, i64 24}
!25 = !{!26, !13, i64 32}
!26 = !{!"EcGfpCtx_st", !6, i64 0, !6, i64 8, !6, i64 16, !17, i64 24, !13, i64 32}
!27 = !{!26, !6, i64 0}
!28 = !{!29, !6, i64 0}
!29 = !{!"GfpCtx_st", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24}
!30 = !{!13, !13, i64 0}
!31 = !{!19, !6, i64 32}
!32 = !{!33, !13, i64 24}
!33 = !{!"EC2m_st", !6, i64 0, !13, i64 8, !6, i64 16, !13, i64 24}
!34 = !{!33, !6, i64 0}
!35 = !{!36, !6, i64 0}
!36 = !{!"Gf2mCtx_st", !6, i64 0, !6, i64 8, !13, i64 16}
!37 = !{!38, !6, i64 0}
!38 = !{!"ECPoint_st", !6, i64 0, !6, i64 8, !6, i64 16}
!39 = !{!38, !6, i64 8}


; 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 [15 x i8], align 1
@default_opt_level = external local_unnamed_addr global i32, align 4

; Function Attrs: nounwind uwtable
define dso_local i32 @ecdsa_get_pubkey(ptr noundef %0, ptr noundef readonly %1, ptr noundef %2, ptr noundef %3) local_unnamed_addr #0 {
  %.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 51, i32 noundef 2, ptr noundef null) #2
  br label %117

6:                                                ; preds = %4
  %.not89 = icmp eq ptr %1, null
  br i1 %.not89, label %7, label %8

7:                                                ; preds = %6
  tail call void @stacktrace_create(ptr noundef nonnull @.str, i64 noundef 52, i32 noundef 2, ptr noundef null) #2
  br label %117

8:                                                ; preds = %6
  %.not90 = icmp eq ptr %2, null
  br i1 %.not90, label %9, label %10

9:                                                ; preds = %8
  tail call void @stacktrace_create(ptr noundef nonnull @.str, i64 noundef 53, i32 noundef 2, ptr noundef null) #2
  br label %117

10:                                               ; preds = %8
  %.not91 = icmp eq ptr %3, null
  br i1 %.not91, label %11, label %12

11:                                               ; preds = %10
  tail call void @stacktrace_create(ptr noundef nonnull @.str, i64 noundef 54, i32 noundef 2, ptr noundef null) #2
  br label %117

12:                                               ; preds = %10
  %13 = load ptr, ptr %1, align 8, !tbaa !5
  %14 = getelementptr inbounds i8, ptr %1, i64 8
  %15 = load i64, ptr %14, align 8, !tbaa !11
  %16 = tail call ptr @wa_alloc_from_be(ptr noundef %13, i64 noundef %15) #2
  %17 = icmp eq ptr %16, null
  br i1 %17, label %18, label %19

18:                                               ; preds = %12
  tail call void @stacktrace_add(ptr noundef nonnull @.str, i64 noundef 56, i32 noundef 2) #2
  br label %117

19:                                               ; preds = %12
  %20 = tail call zeroext i1 @int_is_zero(ptr noundef nonnull %16) #2
  br i1 %20, label %27, label %21

21:                                               ; preds = %19
  %22 = load ptr, ptr %0, align 8, !tbaa !12
  %23 = getelementptr inbounds i8, ptr %22, i64 16
  %24 = load ptr, ptr %23, align 8, !tbaa !15
  %25 = tail call i32 @int_cmp(ptr noundef nonnull %16, ptr noundef %24) #2
  %26 = icmp sgt i32 %25, -1
  br i1 %26, label %27, label %28

27:                                               ; preds = %19, %21
  tail call void @stacktrace_create(ptr noundef nonnull @.str, i64 noundef 58, i32 noundef 6, ptr noundef null) #2
  br label %117

28:                                               ; preds = %21
  %29 = load ptr, ptr %0, align 8, !tbaa !12
  %30 = getelementptr inbounds i8, ptr %29, i64 16
  %31 = load ptr, ptr %30, align 8, !tbaa !15
  %32 = getelementptr inbounds i8, ptr %31, i64 8
  %33 = load i64, ptr %32, align 8, !tbaa !18
  tail call void @wa_change_len(ptr noundef nonnull %16, i64 noundef %33) #2
  %34 = load ptr, ptr %0, align 8, !tbaa !12
  %35 = getelementptr inbounds i8, ptr %34, i64 80
  %36 = load ptr, ptr %35, align 8, !tbaa !20
  %37 = icmp eq ptr %36, null
  br i1 %37, label %38, label %.thread

38:                                               ; preds = %28
  %39 = load i32, ptr @default_opt_level, align 4, !tbaa !21
  %40 = lshr i32 %39, 8
  %41 = and i32 %40, 15
  %42 = icmp eq i32 %41, 0
  %spec.store.select = select i1 %42, i32 5, i32 %41
  %43 = tail call i32 @ec_set_sign_precomp(ptr noundef nonnull %0, i32 noundef 0, i32 noundef %spec.store.select) #2
  %.not92 = icmp eq i32 %43, 0
  br i1 %.not92, label %..thread_crit_edge, label %44

..thread_crit_edge:                               ; preds = %38
  %.pre = load ptr, ptr %0, align 8, !tbaa !12
  br label %.thread

44:                                               ; preds = %38
  tail call void @stacktrace_add(ptr noundef nonnull @.str, i64 noundef 68, i32 noundef %43) #2
  br label %117

.thread:                                          ; preds = %..thread_crit_edge, %28
  %45 = phi ptr [ %.pre, %..thread_crit_edge ], [ %34, %28 ]
  %46 = load i32, ptr %45, align 8, !tbaa !22
  %47 = icmp eq i32 %46, 0
  br i1 %47, label %48, label %70

48:                                               ; preds = %.thread
  %49 = getelementptr inbounds i8, ptr %45, i64 24
  %50 = load ptr, ptr %49, align 8, !tbaa !23
  %51 = getelementptr inbounds i8, ptr %50, i64 32
  %52 = load i64, ptr %51, align 8, !tbaa !24
  %53 = tail call ptr @ec_point_alloc(i64 noundef %52) #2
  %54 = icmp eq ptr %53, null
  br i1 %54, label %55, label %56

55:                                               ; preds = %48
  tail call void @stacktrace_add(ptr noundef nonnull @.str, i64 noundef 72, i32 noundef 2) #2
  br label %117

56:                                               ; preds = %48
  %57 = load ptr, ptr %0, align 8, !tbaa !12
  %58 = getelementptr inbounds i8, ptr %57, i64 24
  %59 = load ptr, ptr %58, align 8, !tbaa !23
  %60 = load ptr, ptr %59, align 8, !tbaa !26
  %61 = load ptr, ptr %60, align 8, !tbaa !27
  %62 = tail call i64 @int_bit_len(ptr noundef %61) #2
  %63 = load ptr, ptr %0, align 8, !tbaa !12
  %64 = getelementptr inbounds i8, ptr %63, i64 24
  %65 = load ptr, ptr %64, align 8, !tbaa !23
  %66 = getelementptr inbounds i8, ptr %63, i64 80
  %67 = load ptr, ptr %66, align 8, !tbaa !20
  %68 = tail call i32 @ecp_dual_mul_opt(ptr noundef %65, ptr noundef %67, ptr noundef nonnull %16, ptr noundef null, ptr noundef null, ptr noundef nonnull %53) #2
  %.not94 = icmp eq i32 %68, 0
  br i1 %.not94, label %90, label %69

69:                                               ; preds = %56
  tail call void @stacktrace_add(ptr noundef nonnull @.str, i64 noundef 74, i32 noundef %68) #2
  br label %117

70:                                               ; preds = %.thread
  %71 = getelementptr inbounds i8, ptr %45, i64 32
  %72 = load ptr, ptr %71, align 8, !tbaa !29
  %73 = getelementptr inbounds i8, ptr %72, i64 24
  %74 = load i64, ptr %73, align 8, !tbaa !30
  %75 = tail call ptr @ec_point_alloc(i64 noundef %74) #2
  %76 = icmp eq ptr %75, null
  br i1 %76, label %77, label %78

77:                                               ; preds = %70
  tail call void @stacktrace_add(ptr noundef nonnull @.str, i64 noundef 77, i32 noundef 2) #2
  br label %117

78:                                               ; preds = %70
  %79 = load ptr, ptr %0, align 8, !tbaa !12
  %80 = getelementptr inbounds i8, ptr %79, i64 32
  %81 = load ptr, ptr %80, align 8, !tbaa !29
  %82 = load ptr, ptr %81, align 8, !tbaa !32
  %83 = load ptr, ptr %82, align 8, !tbaa !33
  %84 = load i32, ptr %83, align 4, !tbaa !21
  %85 = sext i32 %84 to i64
  %86 = getelementptr inbounds i8, ptr %79, i64 80
  %87 = load ptr, ptr %86, align 8, !tbaa !20
  %88 = tail call i32 @ec2m_dual_mul_opt(ptr noundef nonnull %81, ptr noundef %87, ptr noundef nonnull %16, ptr noundef null, ptr noundef null, ptr noundef nonnull %75) #2
  %.not93 = icmp eq i32 %88, 0
  br i1 %.not93, label %90, label %89

89:                                               ; preds = %78
  tail call void @stacktrace_add(ptr noundef nonnull @.str, i64 noundef 79, i32 noundef %88) #2
  br label %117

90:                                               ; preds = %56, %78
  %.070.in.in = phi i64 [ %62, %56 ], [ %85, %78 ]
  %.068 = phi ptr [ %53, %56 ], [ %75, %78 ]
  %.070.in = add i64 %.070.in.in, 7
  %.070 = lshr i64 %.070.in, 3
  %91 = load ptr, ptr %.068, align 8, !tbaa !35
  %92 = tail call ptr @wa_to_ba(ptr noundef %91) #2
  store ptr %92, ptr %2, align 8, !tbaa !37
  %93 = icmp eq ptr %92, null
  br i1 %93, label %94, label %95

94:                                               ; preds = %90
  tail call void @stacktrace_add(ptr noundef nonnull @.str, i64 noundef 82, i32 noundef 2) #2
  br label %117

95:                                               ; preds = %90
  %96 = getelementptr inbounds i8, ptr %.068, i64 8
  %97 = load ptr, ptr %96, align 8, !tbaa !38
  %98 = tail call ptr @wa_to_ba(ptr noundef %97) #2
  store ptr %98, ptr %3, align 8, !tbaa !37
  %99 = icmp eq ptr %98, null
  br i1 %99, label %100, label %101

100:                                              ; preds = %95
  tail call void @stacktrace_add(ptr noundef nonnull @.str, i64 noundef 83, i32 noundef 2) #2
  br label %117

101:                                              ; preds = %95
  %102 = load ptr, ptr %2, align 8, !tbaa !37
  %103 = tail call i32 @ba_change_len(ptr noundef %102, i64 noundef %.070) #2
  %.not95 = icmp eq i32 %103, 0
  br i1 %.not95, label %105, label %104

104:                                              ; preds = %101
  tail call void @stacktrace_add(ptr noundef nonnull @.str, i64 noundef 84, i32 noundef %103) #2
  br label %117

105:                                              ; preds = %101
  %106 = load ptr, ptr %3, align 8, !tbaa !37
  %107 = tail call i32 @ba_change_len(ptr noundef %106, i64 noundef %.070) #2
  %.not96 = icmp eq i32 %107, 0
  br i1 %.not96, label %109, label %108

108:                                              ; preds = %105
  tail call void @stacktrace_add(ptr noundef nonnull @.str, i64 noundef 85, i32 noundef %107) #2
  br label %117

109:                                              ; preds = %105
  %110 = load ptr, ptr %2, align 8, !tbaa !37
  %111 = tail call i32 @ba_swap(ptr noundef %110) #2
  %.not97 = icmp eq i32 %111, 0
  br i1 %.not97, label %113, label %112

112:                                              ; preds = %109
  tail call void @stacktrace_add(ptr noundef nonnull @.str, i64 noundef 86, i32 noundef %111) #2
  br label %117

113:                                              ; preds = %109
  %114 = load ptr, ptr %3, align 8, !tbaa !37
  %115 = tail call i32 @ba_swap(ptr noundef %114) #2
  %.not98 = icmp eq i32 %115, 0
  br i1 %.not98, label %117, label %116

116:                                              ; preds = %113
  tail call void @stacktrace_add(ptr noundef nonnull @.str, i64 noundef 87, i32 noundef %115) #2
  br label %117

117:                                              ; preds = %44, %113, %116, %112, %108, %104, %100, %94, %89, %77, %69, %55, %27, %18, %11, %9, %7, %5
  %.069 = phi ptr [ null, %18 ], [ %16, %27 ], [ %16, %44 ], [ %16, %55 ], [ %16, %69 ], [ %16, %94 ], [ %16, %100 ], [ %16, %104 ], [ %16, %108 ], [ %16, %112 ], [ %16, %116 ], [ %16, %113 ], [ %16, %77 ], [ %16, %89 ], [ null, %11 ], [ null, %9 ], [ null, %7 ], [ null, %5 ]
  %.1 = phi ptr [ null, %18 ], [ null, %27 ], [ null, %44 ], [ null, %55 ], [ %53, %69 ], [ %.068, %94 ], [ %.068, %100 ], [ %.068, %104 ], [ %.068, %108 ], [ %.068, %112 ], [ %.068, %116 ], [ %.068, %113 ], [ null, %77 ], [ %75, %89 ], [ null, %11 ], [ null, %9 ], [ null, %7 ], [ null, %5 ]
  %.067 = phi i32 [ 2, %18 ], [ 6, %27 ], [ %43, %44 ], [ 2, %55 ], [ %68, %69 ], [ 2, %94 ], [ 2, %100 ], [ %103, %104 ], [ %107, %108 ], [ %111, %112 ], [ %115, %116 ], [ 0, %113 ], [ 2, %77 ], [ %88, %89 ], [ 2, %11 ], [ 2, %9 ], [ 2, %7 ], [ 2, %5 ]
  tail call void @ec_point_free(ptr noundef %.1) #2
  tail call void @wa_free_private(ptr noundef %.069) #2
  ret i32 %.067
}

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

declare ptr @wa_alloc_from_be(ptr noundef, i64 noundef) local_unnamed_addr #1

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

declare zeroext i1 @int_is_zero(ptr noundef) local_unnamed_addr #1

declare i32 @int_cmp(ptr noundef, ptr noundef) local_unnamed_addr #1

declare void @wa_change_len(ptr noundef, i64 noundef) local_unnamed_addr #1

declare i32 @ec_set_sign_precomp(ptr noundef, i32 noundef, i32 noundef) local_unnamed_addr #1

declare ptr @ec_point_alloc(i64 noundef) local_unnamed_addr #1

declare i64 @int_bit_len(ptr noundef) local_unnamed_addr #1

declare i32 @ecp_dual_mul_opt(ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #1

declare i32 @ec2m_dual_mul_opt(ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #1

declare ptr @wa_to_ba(ptr noundef) local_unnamed_addr #1

declare i32 @ba_change_len(ptr noundef, i64 noundef) local_unnamed_addr #1

declare i32 @ba_swap(ptr noundef) local_unnamed_addr #1

declare void @ec_point_free(ptr noundef) local_unnamed_addr #1

declare void @wa_free_private(ptr noundef) local_unnamed_addr #1

attributes #0 = { nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { "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 }

!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 = !{!"ByteArray_st", !7, i64 0, !10, i64 8}
!7 = !{!"any pointer", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"long", !8, i64 0}
!11 = !{!6, !10, i64 8}
!12 = !{!13, !7, i64 0}
!13 = !{!"EcCtx_st", !7, i64 0, !7, i64 8, !7, i64 16, !7, i64 24, !14, i64 32, !14, i64 33}
!14 = !{!"_Bool", !8, i64 0}
!15 = !{!16, !7, i64 16}
!16 = !{!"EcParamsCtx_st", !17, i64 0, !7, i64 8, !7, i64 16, !7, i64 24, !7, i64 32, !14, i64 40, !10, i64 48, !7, i64 56, !7, i64 64, !17, i64 72, !7, i64 80}
!17 = !{!"int", !8, i64 0}
!18 = !{!19, !10, i64 8}
!19 = !{!"WordArray_st", !7, i64 0, !10, i64 8}
!20 = !{!16, !7, i64 80}
!21 = !{!17, !17, i64 0}
!22 = !{!16, !17, i64 0}
!23 = !{!16, !7, i64 24}
!24 = !{!25, !10, i64 32}
!25 = !{!"EcGfpCtx_st", !7, i64 0, !7, i64 8, !7, i64 16, !14, i64 24, !10, i64 32}
!26 = !{!25, !7, i64 0}
!27 = !{!28, !7, i64 0}
!28 = !{!"GfpCtx_st", !7, i64 0, !7, i64 8, !7, i64 16, !7, i64 24}
!29 = !{!16, !7, i64 32}
!30 = !{!31, !10, i64 24}
!31 = !{!"EC2m_st", !7, i64 0, !10, i64 8, !7, i64 16, !10, i64 24}
!32 = !{!31, !7, i64 0}
!33 = !{!34, !7, i64 0}
!34 = !{!"Gf2mCtx_st", !7, i64 0, !7, i64 8, !10, i64 16}
!35 = !{!36, !7, i64 0}
!36 = !{!"ECPoint_st", !7, i64 0, !7, i64 8, !7, i64 16}
!37 = !{!7, !7, i64 0}
!38 = !{!36, !7, i64 8}


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