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

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

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

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

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

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

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

declare void @wa_free_private(ptr noundef) #1

declare void @ec_point_free(ptr noundef) #1

declare void @ec_precomp_free(ptr noundef) #1

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

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

declare i32 @wa_cmp(ptr noundef, ptr noundef) #1

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

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

13:                                               ; preds = %3
  %14 = load ptr, ptr %4, align 8, !tbaa !5
  %15 = icmp ne ptr %14, null
  br i1 %15, label %18, label %16

16:                                               ; preds = %13
  store i32 2, ptr %7, align 4, !tbaa !9
  %17 = load i32, ptr %7, align 4, !tbaa !9
  call void @stacktrace_create(ptr noundef @.str, i64 noundef 1028, i32 noundef %17, ptr noundef null)
  br label %206

18:                                               ; preds = %13
  br label %19

19:                                               ; preds = %18
  br label %20

20:                                               ; preds = %19
  br label %21

21:                                               ; preds = %20
  %22 = load ptr, ptr %5, align 8, !tbaa !5
  %23 = icmp ne ptr %22, null
  br i1 %23, label %26, label %24

24:                                               ; preds = %21
  store i32 2, ptr %7, align 4, !tbaa !9
  %25 = load i32, ptr %7, align 4, !tbaa !9
  call void @stacktrace_create(ptr noundef @.str, i64 noundef 1029, i32 noundef %25, ptr noundef null)
  br label %206

26:                                               ; preds = %21
  br label %27

27:                                               ; preds = %26
  br label %28

28:                                               ; preds = %27
  br label %29

29:                                               ; preds = %28
  %30 = load ptr, ptr %6, align 8, !tbaa !5
  %31 = icmp ne ptr %30, null
  br i1 %31, label %34, label %32

32:                                               ; preds = %29
  store i32 2, ptr %7, align 4, !tbaa !9
  %33 = load i32, ptr %7, align 4, !tbaa !9
  call void @stacktrace_create(ptr noundef @.str, i64 noundef 1030, i32 noundef %33, ptr noundef null)
  br label %206

34:                                               ; preds = %29
  br label %35

35:                                               ; preds = %34
  br label %36

36:                                               ; preds = %35
  %37 = load ptr, ptr %4, align 8, !tbaa !5
  %38 = getelementptr inbounds %struct.EcCtx_st, ptr %37, i32 0, i32 1
  %39 = load ptr, ptr %38, align 8, !tbaa !13
  %40 = icmp ne ptr %39, null
  br i1 %40, label %41, label %49

41:                                               ; preds = %36
  %42 = load ptr, ptr %4, align 8, !tbaa !5
  %43 = getelementptr inbounds %struct.EcCtx_st, ptr %42, i32 0, i32 4
  store i8 0, ptr %43, align 8, !tbaa !15
  %44 = load ptr, ptr %4, align 8, !tbaa !5
  %45 = getelementptr inbounds %struct.EcCtx_st, ptr %44, i32 0, i32 1
  %46 = load ptr, ptr %45, align 8, !tbaa !13
  call void @wa_free_private(ptr noundef %46)
  %47 = load ptr, ptr %4, align 8, !tbaa !5
  %48 = getelementptr inbounds %struct.EcCtx_st, ptr %47, i32 0, i32 1
  store ptr null, ptr %48, align 8, !tbaa !13
  br label %49

49:                                               ; preds = %41, %36
  br label %50

50:                                               ; preds = %49
  %51 = load ptr, ptr %4, align 8, !tbaa !5
  %52 = getelementptr inbounds %struct.EcCtx_st, ptr %51, i32 0, i32 0
  %53 = load ptr, ptr %52, align 8, !tbaa !16
  %54 = load ptr, ptr %5, align 8, !tbaa !5
  %55 = load ptr, ptr %6, align 8, !tbaa !5
  %56 = call i32 @public_key_to_ec_point(ptr noundef %53, ptr noundef %54, ptr noundef %55, ptr noundef %10)
  store i32 %56, ptr %7, align 4, !tbaa !9
  %57 = load i32, ptr %7, align 4, !tbaa !9
  %58 = icmp ne i32 %57, 0
  br i1 %58, label %59, label %61

59:                                               ; preds = %50
  %60 = load i32, ptr %7, align 4, !tbaa !9
  call void @stacktrace_add(ptr noundef @.str, i64 noundef 1039, i32 noundef %60)
  br label %206

61:                                               ; preds = %50
  br label %62

62:                                               ; preds = %61
  br label %63

63:                                               ; preds = %62
  %64 = load ptr, ptr %4, align 8, !tbaa !5
  %65 = getelementptr inbounds %struct.EcCtx_st, ptr %64, i32 0, i32 2
  %66 = load ptr, ptr %65, align 8, !tbaa !17
  %67 = icmp ne ptr %66, null
  br i1 %67, label %68, label %109

68:                                               ; preds = %63
  %69 = load ptr, ptr %10, align 8, !tbaa !5
  %70 = getelementptr inbounds %struct.ECPoint_st, ptr %69, i32 0, i32 0
  %71 = load ptr, ptr %70, align 8, !tbaa !18
  %72 = load ptr, ptr %4, align 8, !tbaa !5
  %73 = getelementptr inbounds %struct.EcCtx_st, ptr %72, i32 0, i32 2
  %74 = load ptr, ptr %73, align 8, !tbaa !17
  %75 = getelementptr inbounds %struct.ECPoint_st, ptr %74, i32 0, i32 0
  %76 = load ptr, ptr %75, align 8, !tbaa !18
  %77 = call i32 @wa_cmp(ptr noundef %71, ptr noundef %76)
  %78 = icmp ne i32 %77, 0
  br i1 %78, label %101, label %79

79:                                               ; preds = %68
  %80 = load ptr, ptr %10, align 8, !tbaa !5
  %81 = getelementptr inbounds %struct.ECPoint_st, ptr %80, i32 0, i32 1
  %82 = load ptr, ptr %81, align 8, !tbaa !20
  %83 = load ptr, ptr %4, align 8, !tbaa !5
  %84 = getelementptr inbounds %struct.EcCtx_st, ptr %83, i32 0, i32 2
  %85 = load ptr, ptr %84, align 8, !tbaa !17
  %86 = getelementptr inbounds %struct.ECPoint_st, ptr %85, i32 0, i32 1
  %87 = load ptr, ptr %86, align 8, !tbaa !20
  %88 = call i32 @wa_cmp(ptr noundef %82, ptr noundef %87)
  %89 = icmp ne i32 %88, 0
  br i1 %89, label %101, label %90

90:                                               ; preds = %79
  %91 = load ptr, ptr %10, align 8, !tbaa !5
  %92 = getelementptr inbounds %struct.ECPoint_st, ptr %91, i32 0, i32 2
  %93 = load ptr, ptr %92, align 8, !tbaa !21
  %94 = load ptr, ptr %4, align 8, !tbaa !5
  %95 = getelementptr inbounds %struct.EcCtx_st, ptr %94, i32 0, i32 2
  %96 = load ptr, ptr %95, align 8, !tbaa !17
  %97 = getelementptr inbounds %struct.ECPoint_st, ptr %96, i32 0, i32 2
  %98 = load ptr, ptr %97, align 8, !tbaa !21
  %99 = call i32 @wa_cmp(ptr noundef %93, ptr noundef %98)
  %100 = icmp ne i32 %99, 0
  br i1 %100, label %101, label %108

101:                                              ; preds = %90, %79, %68
  %102 = load ptr, ptr %4, align 8, !tbaa !5
  %103 = getelementptr inbounds %struct.EcCtx_st, ptr %102, i32 0, i32 2
  %104 = load ptr, ptr %103, align 8, !tbaa !17
  call void @ec_point_free(ptr noundef %104)
  %105 = load ptr, ptr %10, align 8, !tbaa !5
  %106 = load ptr, ptr %4, align 8, !tbaa !5
  %107 = getelementptr inbounds %struct.EcCtx_st, ptr %106, i32 0, i32 2
  store ptr %105, ptr %107, align 8, !tbaa !17
  store ptr null, ptr %10, align 8, !tbaa !5
  store i8 1, ptr %11, align 1, !tbaa !11
  br label %108

108:                                              ; preds = %101, %90
  br label %113

109:                                              ; preds = %63
  %110 = load ptr, ptr %10, align 8, !tbaa !5
  %111 = load ptr, ptr %4, align 8, !tbaa !5
  %112 = getelementptr inbounds %struct.EcCtx_st, ptr %111, i32 0, i32 2
  store ptr %110, ptr %112, align 8, !tbaa !17
  store ptr null, ptr %10, align 8, !tbaa !5
  store i8 1, ptr %11, align 1, !tbaa !11
  br label %113

113:                                              ; preds = %109, %108
  %114 = load ptr, ptr %4, align 8, !tbaa !5
  %115 = getelementptr inbounds %struct.EcCtx_st, ptr %114, i32 0, i32 0
  %116 = load ptr, ptr %115, align 8, !tbaa !16
  %117 = getelementptr inbounds %struct.EcParamsCtx_st, ptr %116, i32 0, i32 10
  %118 = load ptr, ptr %117, align 8, !tbaa !22
  %119 = icmp eq ptr %118, null
  br i1 %119, label %120, label %131

120:                                              ; preds = %113
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #3
  %121 = load i32, ptr @default_opt_level, align 4, !tbaa !9
  %122 = lshr i32 %121, 8
  %123 = and i32 %122, 15
  store i32 %123, ptr %12, align 4, !tbaa !9
  %124 = load i32, ptr %12, align 4, !tbaa !9
  %125 = icmp eq i32 %124, 0
  br i1 %125, label %126, label %127

126:                                              ; preds = %120
  store i32 5, ptr %12, align 4, !tbaa !9
  br label %127

127:                                              ; preds = %126, %120
  %128 = load ptr, ptr %4, align 8, !tbaa !5
  %129 = load i32, ptr %12, align 4, !tbaa !9
  %130 = call i32 @ec_set_sign_precomp(ptr noundef %128, i32 noundef 0, i32 noundef %129)
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #3
  br label %131

131:                                              ; preds = %127, %113
  %132 = load ptr, ptr %4, align 8, !tbaa !5
  %133 = getelementptr inbounds %struct.EcCtx_st, ptr %132, i32 0, i32 3
  %134 = load ptr, ptr %133, align 8, !tbaa !25
  %135 = icmp ne ptr %134, null
  br i1 %135, label %136, label %180

136:                                              ; preds = %131
  %137 = load i8, ptr %11, align 1, !tbaa !11, !range !26, !noundef !27
  %138 = trunc i8 %137 to i1
  br i1 %138, label %139, label %179

139:                                              ; preds = %136
  %140 = load ptr, ptr %4, align 8, !tbaa !5
  %141 = getelementptr inbounds %struct.EcCtx_st, ptr %140, i32 0, i32 3
  %142 = load ptr, ptr %141, align 8, !tbaa !25
  %143 = getelementptr inbounds %struct.EcPrecomp_st, ptr %142, i32 0, i32 0
  %144 = load i32, ptr %143, align 8, !tbaa !28
  %145 = icmp eq i32 %144, 1
  br i1 %145, label %146, label %154

146:                                              ; preds = %139
  %147 = load ptr, ptr %4, align 8, !tbaa !5
  %148 = getelementptr inbounds %struct.EcCtx_st, ptr %147, i32 0, i32 3
  %149 = load ptr, ptr %148, align 8, !tbaa !25
  %150 = getelementptr inbounds %struct.EcPrecomp_st, ptr %149, i32 0, i32 1
  %151 = load ptr, ptr %150, align 8, !tbaa !30
  %152 = getelementptr inbounds %struct.EcPrecompComb_st, ptr %151, i32 0, i32 1
  %153 = load i32, ptr %152, align 8, !tbaa !31
  br label %155

154:                                              ; preds = %139
  br label %155

155:                                              ; preds = %154, %146
  %156 = phi i32 [ %153, %146 ], [ 0, %154 ]
  store i32 %156, ptr %8, align 4, !tbaa !9
  %157 = load ptr, ptr %4, align 8, !tbaa !5
  %158 = getelementptr inbounds %struct.EcCtx_st, ptr %157, i32 0, i32 3
  %159 = load ptr, ptr %158, align 8, !tbaa !25
  %160 = getelementptr inbounds %struct.EcPrecomp_st, ptr %159, i32 0, i32 0
  %161 = load i32, ptr %160, align 8, !tbaa !28
  %162 = icmp eq i32 %161, 0
  br i1 %162, label %163, label %171

163:                                              ; preds = %155
  %164 = load ptr, ptr %4, align 8, !tbaa !5
  %165 = getelementptr inbounds %struct.EcCtx_st, ptr %164, i32 0, i32 3
  %166 = load ptr, ptr %165, align 8, !tbaa !25
  %167 = getelementptr inbounds %struct.EcPrecomp_st, ptr %166, i32 0, i32 1
  %168 = load ptr, ptr %167, align 8, !tbaa !30
  %169 = getelementptr inbounds %struct.EcPrecompWin_st, ptr %168, i32 0, i32 2
  %170 = load i32, ptr %169, align 4, !tbaa !33
  br label %172

171:                                              ; preds = %155
  br label %172

172:                                              ; preds = %171, %163
  %173 = phi i32 [ %170, %163 ], [ 0, %171 ]
  store i32 %173, ptr %9, align 4, !tbaa !9
  %174 = load ptr, ptr %4, align 8, !tbaa !5
  %175 = getelementptr inbounds %struct.EcCtx_st, ptr %174, i32 0, i32 3
  %176 = load ptr, ptr %175, align 8, !tbaa !25
  call void @ec_precomp_free(ptr noundef %176)
  %177 = load ptr, ptr %4, align 8, !tbaa !5
  %178 = getelementptr inbounds %struct.EcCtx_st, ptr %177, i32 0, i32 3
  store ptr null, ptr %178, align 8, !tbaa !25
  br label %179

179:                                              ; preds = %172, %136
  br label %187

180:                                              ; preds = %131
  store i32 0, ptr %8, align 4, !tbaa !9
  %181 = load i32, ptr @default_opt_level, align 4, !tbaa !9
  %182 = and i32 %181, 15
  store i32 %182, ptr %9, align 4, !tbaa !9
  %183 = load i32, ptr %9, align 4, !tbaa !9
  %184 = icmp eq i32 %183, 0
  br i1 %184, label %185, label %186

185:                                              ; preds = %180
  store i32 5, ptr %9, align 4, !tbaa !9
  br label %186

186:                                              ; preds = %185, %180
  store i8 1, ptr %11, align 1, !tbaa !11
  br label %187

187:                                              ; preds = %186, %179
  %188 = load i8, ptr %11, align 1, !tbaa !11, !range !26, !noundef !27
  %189 = trunc i8 %188 to i1
  br i1 %189, label %190, label %203

190:                                              ; preds = %187
  br label %191

191:                                              ; preds = %190
  %192 = load ptr, ptr %4, align 8, !tbaa !5
  %193 = load i32, ptr %8, align 4, !tbaa !9
  %194 = load i32, ptr %9, align 4, !tbaa !9
  %195 = call i32 @ec_set_verify_precomp(ptr noundef %192, i32 noundef %193, i32 noundef %194)
  store i32 %195, ptr %7, align 4, !tbaa !9
  %196 = load i32, ptr %7, align 4, !tbaa !9
  %197 = icmp ne i32 %196, 0
  br i1 %197, label %198, label %200

198:                                              ; preds = %191
  %199 = load i32, ptr %7, align 4, !tbaa !9
  call void @stacktrace_add(ptr noundef @.str, i64 noundef 1084, i32 noundef %199)
  br label %206

200:                                              ; preds = %191
  br label %201

201:                                              ; preds = %200
  br label %202

202:                                              ; preds = %201
  br label %203

203:                                              ; preds = %202, %187
  %204 = load ptr, ptr %4, align 8, !tbaa !5
  %205 = getelementptr inbounds %struct.EcCtx_st, ptr %204, i32 0, i32 5
  store i8 1, ptr %205, align 1, !tbaa !35
  br label %206

206:                                              ; preds = %203, %198, %59, %32, %24, %16
  %207 = load ptr, ptr %10, align 8, !tbaa !5
  call void @ec_point_free(ptr noundef %207)
  %208 = load i32, ptr %7, align 4, !tbaa !9
  %209 = icmp ne i32 %208, 0
  br i1 %209, label %210, label %216

210:                                              ; preds = %206
  %211 = load ptr, ptr %4, align 8, !tbaa !5
  %212 = icmp ne ptr %211, null
  br i1 %212, label %213, label %216

213:                                              ; preds = %210
  %214 = load ptr, ptr %4, align 8, !tbaa !5
  %215 = getelementptr inbounds %struct.EcCtx_st, ptr %214, i32 0, i32 5
  store i8 0, ptr %215, align 1, !tbaa !35
  br label %216

216:                                              ; preds = %213, %210, %206
  %217 = load i32, ptr %7, align 4, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 1, ptr %11) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #3
  ret i32 %217
}

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 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 = { 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, !12, i64 0}
!12 = !{!"_Bool", !7, i64 0}
!13 = !{!14, !6, i64 8}
!14 = !{!"EcCtx_st", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !12, i64 32, !12, i64 33}
!15 = !{!14, !12, i64 32}
!16 = !{!14, !6, i64 0}
!17 = !{!14, !6, i64 16}
!18 = !{!19, !6, i64 0}
!19 = !{!"ECPoint_st", !6, i64 0, !6, i64 8, !6, i64 16}
!20 = !{!19, !6, i64 8}
!21 = !{!19, !6, i64 16}
!22 = !{!23, !6, i64 80}
!23 = !{!"EcParamsCtx_st", !10, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !6, i64 32, !12, i64 40, !24, i64 48, !6, i64 56, !6, i64 64, !10, i64 72, !6, i64 80}
!24 = !{!"long", !7, i64 0}
!25 = !{!14, !6, i64 24}
!26 = !{i8 0, i8 2}
!27 = !{}
!28 = !{!29, !10, i64 0}
!29 = !{!"EcPrecomp_st", !10, i64 0, !7, i64 8}
!30 = !{!7, !7, i64 0}
!31 = !{!32, !10, i64 8}
!32 = !{!"EcPrecompComb_st", !6, i64 0, !10, i64 8}
!33 = !{!34, !10, i64 12}
!34 = !{!"EcPrecompWin_st", !6, i64 0, !10, i64 8, !10, i64 12}
!35 = !{!14, !12, i64 33}


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

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

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

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

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

declare void @wa_free_private(ptr noundef) local_unnamed_addr #1

declare void @ec_point_free(ptr noundef) local_unnamed_addr #1

declare void @ec_precomp_free(ptr noundef) local_unnamed_addr #1

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

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

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

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

; Function Attrs: nounwind uwtable
define dso_local i32 @ec_init_verify(ptr noundef %0, ptr noundef %1, ptr noundef %2) local_unnamed_addr #2 {
  %4 = alloca ptr, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %4) #3
  store ptr null, ptr %4, align 8, !tbaa !5
  %5 = icmp ne ptr %0, null
  br i1 %5, label %7, label %6

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

7:                                                ; preds = %3
  %.not = icmp eq ptr %1, null
  br i1 %.not, label %8, label %9

8:                                                ; preds = %7
  tail call void @stacktrace_create(ptr noundef nonnull @.str, i64 noundef 1029, i32 noundef 2, ptr noundef null) #3
  br label %84

9:                                                ; preds = %7
  %.not61 = icmp eq ptr %2, null
  br i1 %.not61, label %10, label %11

10:                                               ; preds = %9
  tail call void @stacktrace_create(ptr noundef nonnull @.str, i64 noundef 1030, i32 noundef 2, ptr noundef null) #3
  br label %84

11:                                               ; preds = %9
  %12 = getelementptr inbounds i8, ptr %0, i64 8
  %13 = load ptr, ptr %12, align 8, !tbaa !9
  %.not62 = icmp eq ptr %13, null
  br i1 %.not62, label %16, label %14

14:                                               ; preds = %11
  %15 = getelementptr inbounds i8, ptr %0, i64 32
  store i8 0, ptr %15, align 8, !tbaa !12
  tail call void @wa_free_private(ptr noundef nonnull %13) #3
  store ptr null, ptr %12, align 8, !tbaa !9
  br label %16

16:                                               ; preds = %11, %14
  %17 = load ptr, ptr %0, align 8, !tbaa !13
  %18 = call i32 @public_key_to_ec_point(ptr noundef %17, ptr noundef nonnull %1, ptr noundef nonnull %2, ptr noundef nonnull %4)
  %.not63 = icmp eq i32 %18, 0
  br i1 %.not63, label %20, label %19

19:                                               ; preds = %16
  call void @stacktrace_add(ptr noundef nonnull @.str, i64 noundef 1039, i32 noundef %18) #3
  br label %84

20:                                               ; preds = %16
  %21 = getelementptr inbounds i8, ptr %0, i64 16
  %22 = load ptr, ptr %21, align 8, !tbaa !14
  %.not64 = icmp eq ptr %22, null
  %23 = load ptr, ptr %4, align 8, !tbaa !5
  br i1 %.not64, label %47, label %24

24:                                               ; preds = %20
  %25 = load ptr, ptr %23, align 8, !tbaa !15
  %26 = load ptr, ptr %22, align 8, !tbaa !15
  %27 = call i32 @wa_cmp(ptr noundef %25, ptr noundef %26) #3
  %.not65 = icmp eq i32 %27, 0
  br i1 %.not65, label %28, label %44

28:                                               ; preds = %24
  %29 = load ptr, ptr %4, align 8, !tbaa !5
  %30 = getelementptr inbounds i8, ptr %29, i64 8
  %31 = load ptr, ptr %30, align 8, !tbaa !17
  %32 = load ptr, ptr %21, align 8, !tbaa !14
  %33 = getelementptr inbounds i8, ptr %32, i64 8
  %34 = load ptr, ptr %33, align 8, !tbaa !17
  %35 = call i32 @wa_cmp(ptr noundef %31, ptr noundef %34) #3
  %.not66 = icmp eq i32 %35, 0
  br i1 %.not66, label %36, label %44

36:                                               ; preds = %28
  %37 = load ptr, ptr %4, align 8, !tbaa !5
  %38 = getelementptr inbounds i8, ptr %37, i64 16
  %39 = load ptr, ptr %38, align 8, !tbaa !18
  %40 = load ptr, ptr %21, align 8, !tbaa !14
  %41 = getelementptr inbounds i8, ptr %40, i64 16
  %42 = load ptr, ptr %41, align 8, !tbaa !18
  %43 = call i32 @wa_cmp(ptr noundef %39, ptr noundef %42) #3
  %.not67 = icmp eq i32 %43, 0
  br i1 %.not67, label %48, label %44

44:                                               ; preds = %36, %28, %24
  %45 = load ptr, ptr %21, align 8, !tbaa !14
  call void @ec_point_free(ptr noundef %45) #3
  %46 = load ptr, ptr %4, align 8, !tbaa !5
  store ptr %46, ptr %21, align 8, !tbaa !14
  store ptr null, ptr %4, align 8, !tbaa !5
  br label %48

47:                                               ; preds = %20
  store ptr %23, ptr %21, align 8, !tbaa !14
  store ptr null, ptr %4, align 8, !tbaa !5
  br label %48

48:                                               ; preds = %36, %44, %47
  %.047 = phi i1 [ true, %44 ], [ false, %36 ], [ true, %47 ]
  %49 = load ptr, ptr %0, align 8, !tbaa !13
  %50 = getelementptr inbounds i8, ptr %49, i64 80
  %51 = load ptr, ptr %50, align 8, !tbaa !19
  %52 = icmp eq ptr %51, null
  br i1 %52, label %53, label %59

53:                                               ; preds = %48
  %54 = load i32, ptr @default_opt_level, align 4, !tbaa !23
  %55 = lshr i32 %54, 8
  %56 = and i32 %55, 15
  %57 = icmp eq i32 %56, 0
  %spec.store.select = select i1 %57, i32 5, i32 %56
  %58 = call i32 @ec_set_sign_precomp(ptr noundef nonnull %0, i32 noundef 0, i32 noundef %spec.store.select)
  br label %59

59:                                               ; preds = %53, %48
  %60 = getelementptr inbounds i8, ptr %0, i64 24
  %61 = load ptr, ptr %60, align 8, !tbaa !24
  %.not68 = icmp eq ptr %61, null
  br i1 %.not68, label %.thread70, label %62

62:                                               ; preds = %59
  br i1 %.047, label %63, label %82

63:                                               ; preds = %62
  %64 = load i32, ptr %61, align 8, !tbaa !25
  switch i32 %64, label %.thread76 [
    i32 1, label %.thread
    i32 0, label %69
  ]

.thread:                                          ; preds = %63
  %65 = getelementptr inbounds i8, ptr %61, i64 8
  %66 = load ptr, ptr %65, align 8, !tbaa !27
  %67 = getelementptr inbounds i8, ptr %66, i64 8
  %68 = load i32, ptr %67, align 8, !tbaa !28
  br label %.thread76

69:                                               ; preds = %63
  %70 = getelementptr inbounds i8, ptr %61, i64 8
  %71 = load ptr, ptr %70, align 8, !tbaa !27
  %72 = getelementptr inbounds i8, ptr %71, i64 12
  %73 = load i32, ptr %72, align 4, !tbaa !30
  br label %.thread76

.thread76:                                        ; preds = %69, %.thread, %63
  %74 = phi i32 [ 0, %69 ], [ %68, %.thread ], [ 0, %63 ]
  %75 = phi i32 [ %73, %69 ], [ 0, %.thread ], [ 0, %63 ]
  call void @ec_precomp_free(ptr noundef nonnull %61) #3
  store ptr null, ptr %60, align 8, !tbaa !24
  br label %79

.thread70:                                        ; preds = %59
  %76 = load i32, ptr @default_opt_level, align 4, !tbaa !23
  %77 = and i32 %76, 15
  %78 = icmp eq i32 %77, 0
  %spec.store.select1 = select i1 %78, i32 5, i32 %77
  br label %79

79:                                               ; preds = %.thread76, %.thread70
  %.04975 = phi i32 [ %spec.store.select1, %.thread70 ], [ %75, %.thread76 ]
  %.05074 = phi i32 [ 0, %.thread70 ], [ %74, %.thread76 ]
  %80 = call i32 @ec_set_verify_precomp(ptr noundef nonnull %0, i32 noundef %.05074, i32 noundef %.04975)
  %.not69 = icmp eq i32 %80, 0
  br i1 %.not69, label %82, label %81

81:                                               ; preds = %79
  call void @stacktrace_add(ptr noundef nonnull @.str, i64 noundef 1084, i32 noundef %80) #3
  br label %84

82:                                               ; preds = %62, %79
  %83 = getelementptr inbounds i8, ptr %0, i64 33
  store i8 1, ptr %83, align 1, !tbaa !32
  br label %84

84:                                               ; preds = %82, %81, %19, %10, %8, %6
  %.1 = phi i32 [ %18, %19 ], [ %80, %81 ], [ 0, %82 ], [ 2, %10 ], [ 2, %8 ], [ 2, %6 ]
  %85 = load ptr, ptr %4, align 8, !tbaa !5
  call void @ec_point_free(ptr noundef %85) #3
  %86 = icmp ne i32 %.1, 0
  %or.cond = and i1 %5, %86
  br i1 %or.cond, label %87, label %89

87:                                               ; preds = %84
  %88 = getelementptr inbounds i8, ptr %0, i64 33
  store i8 0, ptr %88, align 1, !tbaa !32
  br label %89

89:                                               ; preds = %87, %84
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #3
  ret i32 %.1
}

attributes #0 = { mustprogress 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 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 = { 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, !6, i64 8}
!10 = !{!"EcCtx_st", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !11, i64 32, !11, i64 33}
!11 = !{!"_Bool", !7, i64 0}
!12 = !{!10, !11, i64 32}
!13 = !{!10, !6, i64 0}
!14 = !{!10, !6, i64 16}
!15 = !{!16, !6, i64 0}
!16 = !{!"ECPoint_st", !6, i64 0, !6, i64 8, !6, i64 16}
!17 = !{!16, !6, i64 8}
!18 = !{!16, !6, i64 16}
!19 = !{!20, !6, i64 80}
!20 = !{!"EcParamsCtx_st", !21, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !6, i64 32, !11, i64 40, !22, i64 48, !6, i64 56, !6, i64 64, !21, i64 72, !6, i64 80}
!21 = !{!"int", !7, i64 0}
!22 = !{!"long", !7, i64 0}
!23 = !{!21, !21, i64 0}
!24 = !{!10, !6, i64 24}
!25 = !{!26, !21, i64 0}
!26 = !{!"EcPrecomp_st", !21, i64 0, !7, i64 8}
!27 = !{!7, !7, i64 0}
!28 = !{!29, !21, i64 8}
!29 = !{!"EcPrecompComb_st", !6, i64 0, !21, i64 8}
!30 = !{!31, !21, i64 12}
!31 = !{!"EcPrecompWin_st", !6, i64 0, !21, i64 8, !21, i64 12}
!32 = !{!10, !11, i64 33}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,ReassociatePass,SROAPass,SimplifyCFGPass,TailCallElimPass