; LLVM IR from intel/cryptography-primitives :: sources/ippcp (pcpprime_test)

; 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._cpPrime = type { i32, i32, ptr, ptr, ptr, ptr, ptr }
%struct._gsModEngine = type { ptr, i32, i32, i32, i32, i32, ptr, ptr, ptr, i64, ptr, ptr, ptr, ptr, i32, i32, ptr }

; Function Attrs: nounwind uwtable
define dso_local i32 @cpPrimeTest(ptr noundef %0, i32 noundef %1, i32 noundef %2, ptr noundef %3, ptr noundef %4, ptr noundef %5) #0 {
  %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 ptr, align 8
  %14 = alloca i32, align 4
  %15 = alloca i32, align 4
  %16 = alloca i32, align 4
  %17 = alloca i32, align 4
  %18 = alloca i32, align 4
  %19 = alloca ptr, align 8
  %20 = alloca ptr, align 8
  %21 = alloca ptr, align 8
  %22 = alloca ptr, align 8
  %23 = alloca i32, align 4
  %24 = alloca i32, align 4
  %25 = alloca i32, align 4
  %26 = alloca i32, align 4
  %27 = alloca i32, align 4
  store ptr %0, ptr %8, align 8, !tbaa !5
  store i32 %1, ptr %9, align 4, !tbaa !9
  store i32 %2, ptr %10, align 4, !tbaa !9
  store ptr %3, ptr %11, align 8, !tbaa !5
  store ptr %4, ptr %12, align 8, !tbaa !5
  store ptr %5, ptr %13, align 8, !tbaa !5
  %28 = load ptr, ptr %8, align 8, !tbaa !5
  %29 = load i32, ptr %9, align 4, !tbaa !9
  %30 = call i32 @cpFix_BNU(ptr noundef %28, i32 noundef %29)
  store i32 %30, ptr %9, align 4, !tbaa !9
  %31 = load i32, ptr %9, align 4, !tbaa !9
  %32 = icmp eq i32 %31, 1
  br i1 %32, label %33, label %39

33:                                               ; preds = %6
  %34 = load ptr, ptr %8, align 8, !tbaa !5
  %35 = getelementptr inbounds i64, ptr %34, i64 0
  %36 = load i64, ptr %35, align 8, !tbaa !11
  %37 = icmp eq i64 %36, 0
  br i1 %37, label %38, label %39

38:                                               ; preds = %33
  store i32 0, ptr %7, align 4
  br label %204

39:                                               ; preds = %33, %6
  %40 = load i32, ptr %9, align 4, !tbaa !9
  %41 = icmp eq i32 %40, 1
  br i1 %41, label %42, label %48

42:                                               ; preds = %39
  %43 = load ptr, ptr %8, align 8, !tbaa !5
  %44 = getelementptr inbounds i64, ptr %43, i64 0
  %45 = load i64, ptr %44, align 8, !tbaa !11
  %46 = icmp eq i64 %45, 2
  br i1 %46, label %47, label %48

47:                                               ; preds = %42
  store i32 1, ptr %7, align 4
  br label %204

48:                                               ; preds = %42, %39
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #4
  %49 = load i32, ptr %9, align 4, !tbaa !9
  %50 = mul nsw i32 %49, 64
  %51 = load ptr, ptr %8, align 8, !tbaa !5
  %52 = load i32, ptr %9, align 4, !tbaa !9
  %53 = sub nsw i32 %52, 1
  %54 = sext i32 %53 to i64
  %55 = getelementptr inbounds i64, ptr %51, i64 %54
  %56 = load i64, ptr %55, align 8, !tbaa !11
  %57 = call i32 @cpNLZ_BNU(i64 noundef %56)
  %58 = sub nsw i32 %50, %57
  store i32 %58, ptr %14, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #4
  %59 = load i32, ptr %14, align 4, !tbaa !9
  %60 = add nsw i32 %59, 31
  %61 = ashr i32 %60, 5
  store i32 %61, ptr %15, align 4, !tbaa !9
  %62 = load ptr, ptr %8, align 8, !tbaa !5
  %63 = load i32, ptr %15, align 4, !tbaa !9
  %64 = call i32 @cpMimimalPrimeTest(ptr noundef %62, i32 noundef %63)
  %65 = icmp eq i32 0, %64
  br i1 %65, label %66, label %67

66:                                               ; preds = %48
  store i32 0, ptr %7, align 4
  store i32 1, ptr %16, align 4
  br label %203

67:                                               ; preds = %48
  call void @llvm.lifetime.start.p0(i64 4, ptr %17) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %18) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %19) #4
  %68 = load ptr, ptr %11, align 8, !tbaa !5
  %69 = getelementptr inbounds %struct._cpPrime, ptr %68, i32 0, i32 6
  %70 = load ptr, ptr %69, align 8, !tbaa !13
  store ptr %70, ptr %19, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %20) #4
  %71 = load ptr, ptr %11, align 8, !tbaa !5
  %72 = getelementptr inbounds %struct._cpPrime, ptr %71, i32 0, i32 3
  %73 = load ptr, ptr %72, align 8, !tbaa !15
  store ptr %73, ptr %20, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %21) #4
  %74 = load ptr, ptr %11, align 8, !tbaa !5
  %75 = getelementptr inbounds %struct._cpPrime, ptr %74, i32 0, i32 4
  %76 = load ptr, ptr %75, align 8, !tbaa !16
  store ptr %76, ptr %21, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %22) #4
  %77 = load ptr, ptr %11, align 8, !tbaa !5
  %78 = getelementptr inbounds %struct._cpPrime, ptr %77, i32 0, i32 5
  %79 = load ptr, ptr %78, align 8, !tbaa !17
  store ptr %79, ptr %22, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %23) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %24) #4
  %80 = load ptr, ptr %19, align 8, !tbaa !5
  %81 = load ptr, ptr %8, align 8, !tbaa !5
  %82 = load i32, ptr %9, align 4, !tbaa !9
  %83 = mul nsw i32 %82, 64
  %84 = load ptr, ptr %8, align 8, !tbaa !5
  %85 = load i32, ptr %9, align 4, !tbaa !9
  %86 = sub nsw i32 %85, 1
  %87 = sext i32 %86 to i64
  %88 = getelementptr inbounds i64, ptr %84, i64 %87
  %89 = load i64, ptr %88, align 8, !tbaa !11
  %90 = call i32 @cpNLZ_BNU(i64 noundef %89)
  %91 = sub nsw i32 %83, %90
  %92 = call ptr @gsModArithMont()
  %93 = call i32 @gsModEngineInit(ptr noundef %80, ptr noundef %81, i32 noundef %91, i32 noundef 6, ptr noundef %92)
  %94 = load ptr, ptr %20, align 8, !tbaa !5
  %95 = load ptr, ptr %8, align 8, !tbaa !5
  %96 = load i32, ptr %9, align 4, !tbaa !9
  %97 = call i64 @cpDec_BNU(ptr noundef %94, ptr noundef %95, i32 noundef %96, i64 noundef 1)
  store i32 0, ptr %17, align 4, !tbaa !9
  store i32 0, ptr %18, align 4, !tbaa !9
  br label %98

98:                                               ; preds = %119, %67
  %99 = load i32, ptr %17, align 4, !tbaa !9
  %100 = load i32, ptr %9, align 4, !tbaa !9
  %101 = icmp slt i32 %99, %100
  br i1 %101, label %102, label %122

102:                                              ; preds = %98
  call void @llvm.lifetime.start.p0(i64 4, ptr %25) #4
  %103 = load ptr, ptr %20, align 8, !tbaa !5
  %104 = load i32, ptr %17, align 4, !tbaa !9
  %105 = sext i32 %104 to i64
  %106 = getelementptr inbounds i64, ptr %103, i64 %105
  %107 = load i64, ptr %106, align 8, !tbaa !11
  %108 = call i32 @cpNTZ_BNU(i64 noundef %107)
  store i32 %108, ptr %25, align 4, !tbaa !9
  %109 = load i32, ptr %25, align 4, !tbaa !9
  %110 = load i32, ptr %18, align 4, !tbaa !9
  %111 = add nsw i32 %110, %109
  store i32 %111, ptr %18, align 4, !tbaa !9
  %112 = load i32, ptr %25, align 4, !tbaa !9
  %113 = icmp ne i32 64, %112
  br i1 %113, label %114, label %115

114:                                              ; preds = %102
  store i32 2, ptr %16, align 4
  br label %116

115:                                              ; preds = %102
  store i32 0, ptr %16, align 4
  br label %116

116:                                              ; preds = %115, %114
  call void @llvm.lifetime.end.p0(i64 4, ptr %25) #4
  %117 = load i32, ptr %16, align 4
  switch i32 %117, label %206 [
    i32 0, label %118
    i32 2, label %122
  ]

118:                                              ; preds = %116
  br label %119

119:                                              ; preds = %118
  %120 = load i32, ptr %17, align 4, !tbaa !9
  %121 = add nsw i32 %120, 1
  store i32 %121, ptr %17, align 4, !tbaa !9
  br label %98, !llvm.loop !18

122:                                              ; preds = %116, %98
  %123 = load ptr, ptr %20, align 8, !tbaa !5
  %124 = load ptr, ptr %20, align 8, !tbaa !5
  %125 = load i32, ptr %9, align 4, !tbaa !9
  %126 = load i32, ptr %18, align 4, !tbaa !9
  %127 = call i32 @cpLSR_BNU(ptr noundef %123, ptr noundef %124, i32 noundef %125, i32 noundef %126)
  store i32 %127, ptr %23, align 4, !tbaa !9
  %128 = load ptr, ptr %20, align 8, !tbaa !5
  %129 = load i32, ptr %23, align 4, !tbaa !9
  %130 = call i32 @cpFix_BNU(ptr noundef %128, i32 noundef %129)
  store i32 %130, ptr %23, align 4, !tbaa !9
  store i32 0, ptr %17, align 4, !tbaa !9
  br label %131

131:                                              ; preds = %198, %122
  %132 = load i32, ptr %17, align 4, !tbaa !9
  %133 = load i32, ptr %10, align 4, !tbaa !9
  %134 = icmp slt i32 %132, %133
  br i1 %134, label %135, label %201

135:                                              ; preds = %131
  call void @llvm.lifetime.start.p0(i64 4, ptr %26) #4
  store i32 0, ptr %26, align 4, !tbaa !9
  br label %136

136:                                              ; preds = %147, %135
  %137 = load i32, ptr %26, align 4, !tbaa !9
  %138 = load ptr, ptr %19, align 8, !tbaa !5
  %139 = getelementptr inbounds %struct._gsModEngine, ptr %138, i32 0, i32 3
  %140 = load i32, ptr %139, align 8, !tbaa !20
  %141 = icmp slt i32 %137, %140
  br i1 %141, label %142, label %150

142:                                              ; preds = %136
  %143 = load ptr, ptr %21, align 8, !tbaa !5
  %144 = load i32, ptr %26, align 4, !tbaa !9
  %145 = sext i32 %144 to i64
  %146 = getelementptr inbounds i64, ptr %143, i64 %145
  store i64 0, ptr %146, align 8, !tbaa !11
  br label %147

147:                                              ; preds = %142
  %148 = load i32, ptr %26, align 4, !tbaa !9
  %149 = add nsw i32 %148, 1
  store i32 %149, ptr %26, align 4, !tbaa !9
  br label %136, !llvm.loop !22

150:                                              ; preds = %136
  call void @llvm.lifetime.end.p0(i64 4, ptr %26) #4
  %151 = load ptr, ptr %12, align 8, !tbaa !5
  %152 = load ptr, ptr %21, align 8, !tbaa !5
  %153 = load i32, ptr %14, align 4, !tbaa !9
  %154 = load ptr, ptr %13, align 8, !tbaa !5
  %155 = call i32 %151(ptr noundef %152, i32 noundef %153, ptr noundef %154)
  %156 = icmp ne i32 0, %155
  br i1 %156, label %157, label %158

157:                                              ; preds = %150
  store i32 -1, ptr %7, align 4
  store i32 1, ptr %16, align 4
  br label %202

158:                                              ; preds = %150
  %159 = load ptr, ptr %21, align 8, !tbaa !5
  %160 = load i32, ptr %9, align 4, !tbaa !9
  %161 = load ptr, ptr %19, align 8, !tbaa !5
  %162 = getelementptr inbounds %struct._gsModEngine, ptr %161, i32 0, i32 8
  %163 = load ptr, ptr %162, align 8, !tbaa !23
  %164 = load i32, ptr %9, align 4, !tbaa !9
  %165 = call i32 @cpMod_BNU(ptr noundef %159, i32 noundef %160, ptr noundef %163, i32 noundef %164)
  store i32 %165, ptr %24, align 4, !tbaa !9
  %166 = load ptr, ptr %21, align 8, !tbaa !5
  %167 = load i32, ptr %24, align 4, !tbaa !9
  %168 = call i32 @cpTst_BNU(ptr noundef %166, i32 noundef %167)
  %169 = icmp ne i32 %168, 0
  br i1 %169, label %175, label %170

170:                                              ; preds = %158
  %171 = load ptr, ptr %21, align 8, !tbaa !5
  %172 = getelementptr inbounds i64, ptr %171, i64 0
  %173 = load i64, ptr %172, align 8, !tbaa !11
  %174 = or i64 %173, 1
  store i64 %174, ptr %172, align 8, !tbaa !11
  br label %175

175:                                              ; preds = %170, %158
  %176 = load ptr, ptr %21, align 8, !tbaa !5
  %177 = load i32, ptr %24, align 4, !tbaa !9
  %178 = call i32 @cpFix_BNU(ptr noundef %176, i32 noundef %177)
  store i32 %178, ptr %24, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %27) #4
  %179 = load i32, ptr %18, align 4, !tbaa !9
  %180 = load ptr, ptr %22, align 8, !tbaa !5
  %181 = load ptr, ptr %21, align 8, !tbaa !5
  %182 = load i32, ptr %9, align 4, !tbaa !9
  %183 = load ptr, ptr %20, align 8, !tbaa !5
  %184 = load i32, ptr %23, align 4, !tbaa !9
  %185 = load ptr, ptr %19, align 8, !tbaa !5
  %186 = call i32 @RabinMiller(i32 noundef %179, ptr noundef %180, ptr noundef %181, i32 noundef %182, ptr noundef %183, i32 noundef %184, ptr noundef %185)
  store i32 %186, ptr %27, align 4, !tbaa !9
  %187 = load i32, ptr %27, align 4, !tbaa !9
  %188 = icmp eq i32 -1, %187
  br i1 %188, label %189, label %190

189:                                              ; preds = %175
  store i32 -1, ptr %7, align 4
  store i32 1, ptr %16, align 4
  br label %195

190:                                              ; preds = %175
  %191 = load i32, ptr %27, align 4, !tbaa !9
  %192 = icmp eq i32 0, %191
  br i1 %192, label %193, label %194

193:                                              ; preds = %190
  store i32 0, ptr %7, align 4
  store i32 1, ptr %16, align 4
  br label %195

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

195:                                              ; preds = %194, %193, %189
  call void @llvm.lifetime.end.p0(i64 4, ptr %27) #4
  %196 = load i32, ptr %16, align 4
  switch i32 %196, label %202 [
    i32 0, label %197
  ]

197:                                              ; preds = %195
  br label %198

198:                                              ; preds = %197
  %199 = load i32, ptr %17, align 4, !tbaa !9
  %200 = add nsw i32 %199, 1
  store i32 %200, ptr %17, align 4, !tbaa !9
  br label %131, !llvm.loop !24

201:                                              ; preds = %131
  store i32 1, ptr %7, align 4
  store i32 1, ptr %16, align 4
  br label %202

202:                                              ; preds = %201, %195, %157
  call void @llvm.lifetime.end.p0(i64 4, ptr %24) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %23) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %22) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %21) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %20) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %19) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %18) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #4
  br label %203

203:                                              ; preds = %202, %66
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #4
  br label %204

204:                                              ; preds = %203, %47, %38
  %205 = load i32, ptr %7, align 4
  ret i32 %205

206:                                              ; preds = %116
  unreachable
}

; Function Attrs: inlinehint nounwind uwtable
declare hidden i32 @cpFix_BNU(ptr noundef, i32 noundef) #1

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

declare i32 @cpNLZ_BNU(i64 noundef) #3

declare i32 @cpMimimalPrimeTest(ptr noundef, i32 noundef) #3

declare i32 @gsModEngineInit(ptr noundef, ptr noundef, i32 noundef, i32 noundef, ptr noundef) #3

declare ptr @gsModArithMont() #3

declare i64 @cpDec_BNU(ptr noundef, ptr noundef, i32 noundef, i64 noundef) #3

declare i32 @cpNTZ_BNU(i64 noundef) #3

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

declare i32 @cpLSR_BNU(ptr noundef, ptr noundef, i32 noundef, i32 noundef) #3

; Function Attrs: inlinehint nounwind uwtable
declare hidden i32 @cpMod_BNU(ptr noundef, i32 noundef, ptr noundef, i32 noundef) #1

; Function Attrs: inlinehint nounwind uwtable
declare hidden i32 @cpTst_BNU(ptr noundef, i32 noundef) #1

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

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 = { inlinehint 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 #2 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { "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 }

!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 = !{!"long long", !7, i64 0}
!13 = !{!14, !6, i64 40}
!14 = !{!"_cpPrime", !10, i64 0, !10, i64 4, !6, i64 8, !6, i64 16, !6, i64 24, !6, i64 32, !6, i64 40}
!15 = !{!14, !6, i64 16}
!16 = !{!14, !6, i64 24}
!17 = !{!14, !6, i64 32}
!18 = distinct !{!18, !19}
!19 = !{!"llvm.loop.mustprogress"}
!20 = !{!21, !10, i64 16}
!21 = !{!"_gsModEngine", !6, i64 0, !10, i64 8, !10, i64 12, !10, i64 16, !10, i64 20, !10, i64 24, !6, i64 32, !6, i64 40, !6, i64 48, !12, i64 56, !6, i64 64, !6, i64 72, !6, i64 80, !6, i64 88, !10, i64 96, !10, i64 100, !6, i64 104}
!22 = distinct !{!22, !19}
!23 = !{!21, !6, i64 48}
!24 = distinct !{!24, !19}


; 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"

; Function Attrs: nounwind uwtable
define dso_local noundef i32 @cpPrimeTest(ptr noundef %0, i32 noundef %1, i32 noundef %2, ptr nocapture noundef readonly %3, ptr nocapture noundef readonly %4, ptr noundef %5) local_unnamed_addr #0 {
  %7 = tail call i32 @cpFix_BNU(ptr noundef %0, i32 noundef %1)
  %8 = icmp eq i32 %7, 1
  br i1 %8, label %9, label %.critedge

9:                                                ; preds = %6
  %10 = load i64, ptr %0, align 8, !tbaa !5
  switch i64 %10, label %.critedge [
    i64 0, label %.thread
    i64 2, label %.thread.fold.split
  ]

.critedge:                                        ; preds = %9, %6
  %11 = shl nsw i32 %7, 6
  %12 = sext i32 %7 to i64
  %13 = getelementptr i64, ptr %0, i64 %12
  %14 = getelementptr i8, ptr %13, i64 -8
  %15 = load i64, ptr %14, align 8, !tbaa !5
  %16 = tail call i32 @cpNLZ_BNU(i64 noundef %15) #4
  %17 = sub nsw i32 %11, %16
  %18 = add nsw i32 %17, 31
  %19 = ashr i32 %18, 5
  %20 = tail call i32 @cpMimimalPrimeTest(ptr noundef %0, i32 noundef %19) #4
  %21 = icmp eq i32 %20, 0
  br i1 %21, label %.thread, label %22

22:                                               ; preds = %.critedge
  %23 = getelementptr inbounds i8, ptr %3, i64 40
  %24 = load ptr, ptr %23, align 8, !tbaa !9
  %25 = getelementptr inbounds i8, ptr %3, i64 16
  %26 = load ptr, ptr %25, align 8, !tbaa !13
  %27 = getelementptr inbounds i8, ptr %3, i64 24
  %28 = load ptr, ptr %27, align 8, !tbaa !14
  %29 = getelementptr inbounds i8, ptr %3, i64 32
  %30 = load ptr, ptr %29, align 8, !tbaa !15
  %31 = load i64, ptr %14, align 8, !tbaa !5
  %32 = tail call i32 @cpNLZ_BNU(i64 noundef %31) #4
  %33 = sub nsw i32 %11, %32
  %34 = tail call ptr @gsModArithMont() #4
  %35 = tail call i32 @gsModEngineInit(ptr noundef %24, ptr noundef nonnull %0, i32 noundef %33, i32 noundef 6, ptr noundef %34) #4
  %36 = tail call i64 @cpDec_BNU(ptr noundef %26, ptr noundef nonnull %0, i32 noundef %7, i64 noundef 1) #4
  %37 = icmp sgt i32 %7, 0
  br i1 %37, label %.lr.ph.preheader, label %._crit_edge

.lr.ph.preheader:                                 ; preds = %22
  %wide.trip.count = zext nneg i32 %7 to i64
  br label %.lr.ph

.lr.ph:                                           ; preds = %.lr.ph, %.lr.ph.preheader
  %indvars.iv = phi i64 [ 0, %.lr.ph.preheader ], [ %indvars.iv.next, %.lr.ph ]
  %.07582 = phi i32 [ 0, %.lr.ph.preheader ], [ %41, %.lr.ph ]
  %38 = getelementptr inbounds i64, ptr %26, i64 %indvars.iv
  %39 = load i64, ptr %38, align 8, !tbaa !5
  %40 = tail call i32 @cpNTZ_BNU(i64 noundef %39) #4
  %41 = add nsw i32 %40, %.07582
  %.not = icmp ne i32 %40, 64
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
  %or.cond = select i1 %.not, i1 true, i1 %exitcond.not
  br i1 %or.cond, label %._crit_edge, label %.lr.ph, !llvm.loop !16

._crit_edge:                                      ; preds = %.lr.ph, %22
  %.176 = phi i32 [ 0, %22 ], [ %41, %.lr.ph ]
  %42 = tail call i32 @cpLSR_BNU(ptr noundef %26, ptr noundef %26, i32 noundef %7, i32 noundef %.176) #4
  %43 = tail call i32 @cpFix_BNU(ptr noundef %26, i32 noundef %42)
  %44 = icmp sgt i32 %2, 0
  br i1 %44, label %.preheader.lr.ph, label %.thread

.preheader.lr.ph:                                 ; preds = %._crit_edge
  %45 = getelementptr inbounds i8, ptr %24, i64 16
  %46 = getelementptr inbounds i8, ptr %24, i64 48
  br label %.preheader

.preheader:                                       ; preds = %.preheader.lr.ph, %62
  %.17489 = phi i32 [ 0, %.preheader.lr.ph ], [ %63, %62 ]
  %47 = load i32, ptr %45, align 8, !tbaa !18
  %48 = icmp sgt i32 %47, 0
  br i1 %48, label %.lr.ph87.preheader, label %._crit_edge88

.lr.ph87.preheader:                               ; preds = %.preheader
  %49 = zext nneg i32 %47 to i64
  %50 = shl nuw nsw i64 %49, 3
  tail call void @llvm.memset.p0.i64(ptr align 8 %28, i8 0, i64 %50, i1 false), !tbaa !5
  br label %._crit_edge88

._crit_edge88:                                    ; preds = %.lr.ph87.preheader, %.preheader
  %51 = tail call i32 %4(ptr noundef %28, i32 noundef %17, ptr noundef %5) #4
  %.not78 = icmp eq i32 %51, 0
  br i1 %.not78, label %52, label %.thread

52:                                               ; preds = %._crit_edge88
  %53 = load ptr, ptr %46, align 8, !tbaa !20
  %54 = tail call i32 @cpMod_BNU(ptr noundef %28, i32 noundef %7, ptr noundef %53, i32 noundef %7)
  %55 = tail call i32 @cpTst_BNU(ptr noundef %28, i32 noundef %54)
  %.not79 = icmp eq i32 %55, 0
  br i1 %.not79, label %56, label %59

56:                                               ; preds = %52
  %57 = load i64, ptr %28, align 8, !tbaa !5
  %58 = or i64 %57, 1
  store i64 %58, ptr %28, align 8, !tbaa !5
  br label %59

59:                                               ; preds = %56, %52
  %60 = tail call i32 @cpFix_BNU(ptr noundef %28, i32 noundef %54)
  %61 = tail call i32 @RabinMiller(i32 noundef %.176, ptr noundef %30, ptr noundef %28, i32 noundef %7, ptr noundef %26, i32 noundef %43, ptr noundef nonnull %24)
  switch i32 %61, label %62 [
    i32 -1, label %.thread
    i32 0, label %.thread
  ]

62:                                               ; preds = %59
  %63 = add nuw nsw i32 %.17489, 1
  %exitcond100.not = icmp eq i32 %63, %2
  br i1 %exitcond100.not, label %.thread, label %.preheader, !llvm.loop !21

.thread.fold.split:                               ; preds = %9
  br label %.thread

.thread:                                          ; preds = %59, %59, %._crit_edge88, %62, %._crit_edge, %9, %.thread.fold.split, %.critedge
  %.4 = phi i32 [ 0, %9 ], [ 0, %.critedge ], [ 1, %.thread.fold.split ], [ 1, %._crit_edge ], [ %61, %59 ], [ -1, %._crit_edge88 ], [ 1, %62 ], [ %61, %59 ]
  ret i32 %.4
}

; Function Attrs: inlinehint nounwind uwtable
declare hidden i32 @cpFix_BNU(ptr noundef, i32 noundef) local_unnamed_addr #1

declare i32 @cpNLZ_BNU(i64 noundef) local_unnamed_addr #2

declare i32 @cpMimimalPrimeTest(ptr noundef, i32 noundef) local_unnamed_addr #2

declare i32 @gsModEngineInit(ptr noundef, ptr noundef, i32 noundef, i32 noundef, ptr noundef) local_unnamed_addr #2

declare ptr @gsModArithMont() local_unnamed_addr #2

declare i64 @cpDec_BNU(ptr noundef, ptr noundef, i32 noundef, i64 noundef) local_unnamed_addr #2

declare i32 @cpNTZ_BNU(i64 noundef) local_unnamed_addr #2

declare i32 @cpLSR_BNU(ptr noundef, ptr noundef, i32 noundef, i32 noundef) local_unnamed_addr #2

; Function Attrs: inlinehint nounwind uwtable
declare hidden i32 @cpMod_BNU(ptr noundef, i32 noundef, ptr noundef, i32 noundef) local_unnamed_addr #1

; Function Attrs: inlinehint nounwind uwtable
declare hidden i32 @cpTst_BNU(ptr noundef, i32 noundef) local_unnamed_addr #1

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

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #3

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 = { inlinehint 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 #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 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #4 = { 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 = !{!"long long", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !12, i64 40}
!10 = !{!"_cpPrime", !11, i64 0, !11, i64 4, !12, i64 8, !12, i64 16, !12, i64 24, !12, i64 32, !12, i64 40}
!11 = !{!"int", !7, i64 0}
!12 = !{!"any pointer", !7, i64 0}
!13 = !{!10, !12, i64 16}
!14 = !{!10, !12, i64 24}
!15 = !{!10, !12, i64 32}
!16 = distinct !{!16, !17}
!17 = !{!"llvm.loop.mustprogress"}
!18 = !{!19, !11, i64 16}
!19 = !{!"_gsModEngine", !12, i64 0, !11, i64 8, !11, i64 12, !11, i64 16, !11, i64 20, !11, i64 24, !12, i64 32, !12, i64 40, !12, i64 48, !6, i64 56, !12, i64 64, !12, i64 72, !12, i64 80, !12, i64 88, !11, i64 96, !11, i64 100, !12, i64 104}
!20 = !{!19, !12, i64 48}
!21 = distinct !{!21, !17}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GVNPass,GlobalOptPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LICMPass,LoopIdiomRecognizePass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,PostOrderFunctionAttrsPass,ReassociatePass,SROAPass,SimplifyCFGPass,TailCallElimPass