; LLVM IR from venumb/ZSPACE :: cpp/depends/alglib/cpp/src (alglibinternal)

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

@.str.44 = external hidden unnamed_addr constant [33 x i8], align 1
@.str.45 = external hidden unnamed_addr constant [34 x i8], align 1
@.str.46 = external hidden unnamed_addr constant [51 x i8], align 1
@.str.47 = external hidden unnamed_addr constant [34 x i8], align 1

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

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

declare void @_ZN11alglib_impl9ae_assertEbPKcPNS_8ae_stateE(i1 noundef zeroext, ptr noundef, ptr noundef) #1

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN11alglib_impl27findprimitiverootandinverseElPlS0_PNS_8ae_stateE(i64 noundef %0, ptr noundef %1, ptr noundef %2, ptr noundef %3) #2 {
  %5 = alloca i64, align 8
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  %9 = alloca i64, align 8
  %10 = alloca i64, align 8
  %11 = alloca i64, align 8
  %12 = alloca i64, align 8
  %13 = alloca i8, align 1
  %14 = alloca i64, align 8
  %15 = alloca i64, align 8
  %16 = alloca i64, align 8
  %17 = alloca i64, align 8
  %18 = alloca i64, align 8
  %19 = alloca i64, align 8
  %20 = alloca i64, align 8
  %21 = alloca i64, align 8
  store i64 %0, ptr %5, align 8, !tbaa !5
  store ptr %1, ptr %6, align 8, !tbaa !9
  store ptr %2, ptr %7, align 8, !tbaa !9
  store ptr %3, ptr %8, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #4
  call void @llvm.lifetime.start.p0(i64 1, ptr %13) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %17) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %18) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %19) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %20) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %21) #4
  %22 = load ptr, ptr %6, align 8, !tbaa !9
  store i64 0, ptr %22, align 8, !tbaa !5
  %23 = load ptr, ptr %7, align 8, !tbaa !9
  store i64 0, ptr %23, align 8, !tbaa !5
  %24 = load i64, ptr %5, align 8, !tbaa !5
  %25 = icmp sge i64 %24, 3
  %26 = load ptr, ptr %8, align 8, !tbaa !9
  call void @_ZN11alglib_impl9ae_assertEbPKcPNS_8ae_stateE(i1 noundef zeroext %25, ptr noundef @.str.44, ptr noundef %26)
  %27 = load ptr, ptr %6, align 8, !tbaa !9
  store i64 0, ptr %27, align 8, !tbaa !5
  %28 = load ptr, ptr %7, align 8, !tbaa !9
  store i64 0, ptr %28, align 8, !tbaa !5
  %29 = load i64, ptr %5, align 8, !tbaa !5
  %30 = load ptr, ptr %8, align 8, !tbaa !9
  %31 = call noundef zeroext i1 @_ZN11alglib_implL15ntheory_isprimeElPNS_8ae_stateE(i64 noundef %29, ptr noundef %30)
  %32 = load ptr, ptr %8, align 8, !tbaa !9
  call void @_ZN11alglib_impl9ae_assertEbPKcPNS_8ae_stateE(i1 noundef zeroext %31, ptr noundef @.str.45, ptr noundef %32)
  %33 = load i64, ptr %5, align 8, !tbaa !5
  %34 = sub nsw i64 %33, 1
  store i64 %34, ptr %10, align 8, !tbaa !5
  store i64 2, ptr %9, align 8, !tbaa !5
  br label %35

35:                                               ; preds = %82, %4
  %36 = load i64, ptr %9, align 8, !tbaa !5
  %37 = load i64, ptr %5, align 8, !tbaa !5
  %38 = sub nsw i64 %37, 1
  %39 = icmp sle i64 %36, %38
  br i1 %39, label %40, label %85

40:                                               ; preds = %35
  %41 = load i64, ptr %10, align 8, !tbaa !5
  store i64 %41, ptr %11, align 8, !tbaa !5
  store i64 2, ptr %12, align 8, !tbaa !5
  store i8 1, ptr %13, align 1, !tbaa !11
  br label %42

42:                                               ; preds = %72, %40
  %43 = load i64, ptr %11, align 8, !tbaa !5
  %44 = icmp sgt i64 %43, 1
  br i1 %44, label %45, label %75

45:                                               ; preds = %42
  %46 = load i64, ptr %11, align 8, !tbaa !5
  %47 = load i64, ptr %12, align 8, !tbaa !5
  %48 = srem i64 %46, %47
  %49 = icmp eq i64 %48, 0
  br i1 %49, label %50, label %72

50:                                               ; preds = %45
  %51 = load i64, ptr %9, align 8, !tbaa !5
  %52 = load i64, ptr %10, align 8, !tbaa !5
  %53 = load i64, ptr %12, align 8, !tbaa !5
  %54 = sdiv i64 %52, %53
  %55 = load i64, ptr %5, align 8, !tbaa !5
  %56 = load ptr, ptr %8, align 8, !tbaa !9
  %57 = call noundef i64 @_ZN11alglib_implL14ntheory_modexpElllPNS_8ae_stateE(i64 noundef %51, i64 noundef %54, i64 noundef %55, ptr noundef %56)
  store i64 %57, ptr %20, align 8, !tbaa !5
  %58 = load i64, ptr %20, align 8, !tbaa !5
  %59 = icmp eq i64 %58, 1
  br i1 %59, label %60, label %61

60:                                               ; preds = %50
  store i8 0, ptr %13, align 1, !tbaa !11
  br label %75

61:                                               ; preds = %50
  br label %62

62:                                               ; preds = %67, %61
  %63 = load i64, ptr %11, align 8, !tbaa !5
  %64 = load i64, ptr %12, align 8, !tbaa !5
  %65 = srem i64 %63, %64
  %66 = icmp eq i64 %65, 0
  br i1 %66, label %67, label %71

67:                                               ; preds = %62
  %68 = load i64, ptr %11, align 8, !tbaa !5
  %69 = load i64, ptr %12, align 8, !tbaa !5
  %70 = sdiv i64 %68, %69
  store i64 %70, ptr %11, align 8, !tbaa !5
  br label %62, !llvm.loop !13

71:                                               ; preds = %62
  br label %72

72:                                               ; preds = %71, %45
  %73 = load i64, ptr %12, align 8, !tbaa !5
  %74 = add nsw i64 %73, 1
  store i64 %74, ptr %12, align 8, !tbaa !5
  br label %42, !llvm.loop !15

75:                                               ; preds = %60, %42
  %76 = load i8, ptr %13, align 1, !tbaa !11, !range !16, !noundef !17
  %77 = trunc i8 %76 to i1
  br i1 %77, label %78, label %81

78:                                               ; preds = %75
  %79 = load i64, ptr %9, align 8, !tbaa !5
  %80 = load ptr, ptr %6, align 8, !tbaa !9
  store i64 %79, ptr %80, align 8, !tbaa !5
  br label %85

81:                                               ; preds = %75
  br label %82

82:                                               ; preds = %81
  %83 = load i64, ptr %9, align 8, !tbaa !5
  %84 = add nsw i64 %83, 1
  store i64 %84, ptr %9, align 8, !tbaa !5
  br label %35, !llvm.loop !18

85:                                               ; preds = %78, %35
  %86 = load ptr, ptr %6, align 8, !tbaa !9
  %87 = load i64, ptr %86, align 8, !tbaa !5
  %88 = icmp sge i64 %87, 2
  %89 = load ptr, ptr %8, align 8, !tbaa !9
  call void @_ZN11alglib_impl9ae_assertEbPKcPNS_8ae_stateE(i1 noundef zeroext %88, ptr noundef @.str.46, ptr noundef %89)
  store i64 0, ptr %14, align 8, !tbaa !5
  store i64 1, ptr %15, align 8, !tbaa !5
  store i64 1, ptr %16, align 8, !tbaa !5
  store i64 0, ptr %17, align 8, !tbaa !5
  %90 = load ptr, ptr %6, align 8, !tbaa !9
  %91 = load i64, ptr %90, align 8, !tbaa !5
  store i64 %91, ptr %18, align 8, !tbaa !5
  %92 = load i64, ptr %5, align 8, !tbaa !5
  store i64 %92, ptr %19, align 8, !tbaa !5
  br label %93

93:                                               ; preds = %96, %85
  %94 = load i64, ptr %19, align 8, !tbaa !5
  %95 = icmp ne i64 %94, 0
  br i1 %95, label %96, label %119

96:                                               ; preds = %93
  %97 = load i64, ptr %18, align 8, !tbaa !5
  %98 = load i64, ptr %19, align 8, !tbaa !5
  %99 = sdiv i64 %97, %98
  store i64 %99, ptr %11, align 8, !tbaa !5
  %100 = load i64, ptr %18, align 8, !tbaa !5
  %101 = load i64, ptr %19, align 8, !tbaa !5
  %102 = srem i64 %100, %101
  store i64 %102, ptr %20, align 8, !tbaa !5
  %103 = load i64, ptr %19, align 8, !tbaa !5
  store i64 %103, ptr %18, align 8, !tbaa !5
  %104 = load i64, ptr %20, align 8, !tbaa !5
  store i64 %104, ptr %19, align 8, !tbaa !5
  %105 = load i64, ptr %15, align 8, !tbaa !5
  %106 = load i64, ptr %11, align 8, !tbaa !5
  %107 = load i64, ptr %14, align 8, !tbaa !5
  %108 = mul nsw i64 %106, %107
  %109 = sub nsw i64 %105, %108
  store i64 %109, ptr %20, align 8, !tbaa !5
  %110 = load i64, ptr %14, align 8, !tbaa !5
  store i64 %110, ptr %15, align 8, !tbaa !5
  %111 = load i64, ptr %20, align 8, !tbaa !5
  store i64 %111, ptr %14, align 8, !tbaa !5
  %112 = load i64, ptr %17, align 8, !tbaa !5
  %113 = load i64, ptr %11, align 8, !tbaa !5
  %114 = load i64, ptr %16, align 8, !tbaa !5
  %115 = mul nsw i64 %113, %114
  %116 = sub nsw i64 %112, %115
  store i64 %116, ptr %20, align 8, !tbaa !5
  %117 = load i64, ptr %16, align 8, !tbaa !5
  store i64 %117, ptr %17, align 8, !tbaa !5
  %118 = load i64, ptr %20, align 8, !tbaa !5
  store i64 %118, ptr %16, align 8, !tbaa !5
  br label %93, !llvm.loop !19

119:                                              ; preds = %93
  br label %120

120:                                              ; preds = %123, %119
  %121 = load i64, ptr %15, align 8, !tbaa !5
  %122 = icmp slt i64 %121, 0
  br i1 %122, label %123, label %127

123:                                              ; preds = %120
  %124 = load i64, ptr %15, align 8, !tbaa !5
  %125 = load i64, ptr %5, align 8, !tbaa !5
  %126 = add nsw i64 %124, %125
  store i64 %126, ptr %15, align 8, !tbaa !5
  br label %120, !llvm.loop !20

127:                                              ; preds = %120
  %128 = load i64, ptr %15, align 8, !tbaa !5
  %129 = load ptr, ptr %7, align 8, !tbaa !9
  store i64 %128, ptr %129, align 8, !tbaa !5
  %130 = load i64, ptr %5, align 8, !tbaa !5
  %131 = sub nsw i64 %130, 1
  %132 = load i64, ptr %5, align 8, !tbaa !5
  %133 = sub nsw i64 %132, 1
  %134 = mul nsw i64 %131, %133
  store i64 %134, ptr %21, align 8, !tbaa !5
  %135 = load i64, ptr %21, align 8, !tbaa !5
  %136 = load i64, ptr %5, align 8, !tbaa !5
  %137 = sub nsw i64 %136, 1
  %138 = sdiv i64 %135, %137
  %139 = load i64, ptr %5, align 8, !tbaa !5
  %140 = sub nsw i64 %139, 1
  %141 = icmp eq i64 %138, %140
  %142 = load ptr, ptr %8, align 8, !tbaa !9
  call void @_ZN11alglib_impl9ae_assertEbPKcPNS_8ae_stateE(i1 noundef zeroext %141, ptr noundef @.str.47, ptr noundef %142)
  %143 = load ptr, ptr %6, align 8, !tbaa !9
  %144 = load i64, ptr %143, align 8, !tbaa !5
  %145 = load ptr, ptr %7, align 8, !tbaa !9
  %146 = load i64, ptr %145, align 8, !tbaa !5
  %147 = mul nsw i64 %144, %146
  %148 = load ptr, ptr %6, align 8, !tbaa !9
  %149 = load i64, ptr %148, align 8, !tbaa !5
  %150 = sdiv i64 %147, %149
  %151 = load ptr, ptr %7, align 8, !tbaa !9
  %152 = load i64, ptr %151, align 8, !tbaa !5
  %153 = icmp eq i64 %150, %152
  %154 = load ptr, ptr %8, align 8, !tbaa !9
  call void @_ZN11alglib_impl9ae_assertEbPKcPNS_8ae_stateE(i1 noundef zeroext %153, ptr noundef @.str.47, ptr noundef %154)
  %155 = load ptr, ptr %6, align 8, !tbaa !9
  %156 = load i64, ptr %155, align 8, !tbaa !5
  %157 = load ptr, ptr %7, align 8, !tbaa !9
  %158 = load i64, ptr %157, align 8, !tbaa !5
  %159 = mul nsw i64 %156, %158
  %160 = load ptr, ptr %7, align 8, !tbaa !9
  %161 = load i64, ptr %160, align 8, !tbaa !5
  %162 = sdiv i64 %159, %161
  %163 = load ptr, ptr %6, align 8, !tbaa !9
  %164 = load i64, ptr %163, align 8, !tbaa !5
  %165 = icmp eq i64 %162, %164
  %166 = load ptr, ptr %8, align 8, !tbaa !9
  call void @_ZN11alglib_impl9ae_assertEbPKcPNS_8ae_stateE(i1 noundef zeroext %165, ptr noundef @.str.47, ptr noundef %166)
  %167 = load ptr, ptr %6, align 8, !tbaa !9
  %168 = load i64, ptr %167, align 8, !tbaa !5
  %169 = load ptr, ptr %7, align 8, !tbaa !9
  %170 = load i64, ptr %169, align 8, !tbaa !5
  %171 = mul nsw i64 %168, %170
  %172 = load i64, ptr %5, align 8, !tbaa !5
  %173 = srem i64 %171, %172
  %174 = icmp eq i64 %173, 1
  %175 = load ptr, ptr %8, align 8, !tbaa !9
  call void @_ZN11alglib_impl9ae_assertEbPKcPNS_8ae_stateE(i1 noundef zeroext %174, ptr noundef @.str.47, ptr noundef %175)
  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 8, ptr %18) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #4
  call void @llvm.lifetime.end.p0(i64 1, ptr %13) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #4
  ret void
}

; Function Attrs: mustprogress nounwind uwtable
declare hidden noundef zeroext i1 @_ZN11alglib_implL15ntheory_isprimeElPNS_8ae_stateE(i64 noundef, ptr noundef) #3

; Function Attrs: mustprogress uwtable
declare hidden noundef i64 @_ZN11alglib_implL14ntheory_modexpElllPNS_8ae_stateE(i64 noundef, i64 noundef, i64 noundef, ptr noundef) #2

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

!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", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"any pointer", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"bool", !7, i64 0}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}
!15 = distinct !{!15, !14}
!16 = !{i8 0, i8 2}
!17 = !{}
!18 = distinct !{!18, !14}
!19 = distinct !{!19, !14}
!20 = distinct !{!20, !14}


; 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.44 = external hidden unnamed_addr constant [33 x i8], align 1
@.str.45 = external hidden unnamed_addr constant [34 x i8], align 1
@.str.46 = external hidden unnamed_addr constant [51 x i8], align 1
@.str.47 = external hidden unnamed_addr constant [34 x i8], align 1

declare void @_ZN11alglib_impl9ae_assertEbPKcPNS_8ae_stateE(i1 noundef zeroext, ptr noundef, ptr noundef) local_unnamed_addr #0

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN11alglib_impl27findprimitiverootandinverseElPlS0_PNS_8ae_stateE(i64 noundef %0, ptr nocapture noundef %1, ptr nocapture noundef %2, ptr noundef %3) local_unnamed_addr #1 {
  store i64 0, ptr %1, align 8, !tbaa !5
  store i64 0, ptr %2, align 8, !tbaa !5
  %5 = icmp sgt i64 %0, 2
  tail call void @_ZN11alglib_impl9ae_assertEbPKcPNS_8ae_stateE(i1 noundef zeroext %5, ptr noundef nonnull @.str.44, ptr noundef %3)
  store i64 0, ptr %1, align 8, !tbaa !5
  store i64 0, ptr %2, align 8, !tbaa !5
  %6 = tail call noundef zeroext i1 @_ZN11alglib_implL15ntheory_isprimeElPNS_8ae_stateE(i64 noundef %0, ptr noundef %3)
  tail call void @_ZN11alglib_impl9ae_assertEbPKcPNS_8ae_stateE(i1 noundef zeroext %6, ptr noundef nonnull @.str.45, ptr noundef %3)
  %7 = add nsw i64 %0, -1
  br i1 %5, label %.preheader88, label %.loopexit89

.preheader88:                                     ; preds = %4, %22
  %.098 = phi i64 [ %23, %22 ], [ 2, %4 ]
  br label %8

8:                                                ; preds = %.preheader88, %.loopexit
  %.08393 = phi i64 [ 2, %.preheader88 ], [ %20, %.loopexit ]
  %.08492 = phi i64 [ %7, %.preheader88 ], [ %.2, %.loopexit ]
  %9 = urem i64 %.08492, %.08393
  %10 = icmp eq i64 %9, 0
  br i1 %10, label %11, label %.loopexit

11:                                               ; preds = %8
  %12 = sdiv i64 %7, %.08393
  %13 = tail call noundef i64 @_ZN11alglib_implL14ntheory_modexpElllPNS_8ae_stateE(i64 noundef %.098, i64 noundef %12, i64 noundef %0, ptr noundef %3)
  %14 = icmp eq i64 %13, 1
  br i1 %14, label %22, label %.preheader87

.preheader87:                                     ; preds = %11
  %15 = srem i64 %.08492, %.08393
  %16 = icmp eq i64 %15, 0
  br i1 %16, label %.lr.ph, label %.loopexit

.lr.ph:                                           ; preds = %.preheader87, %.lr.ph
  %.18591 = phi i64 [ %17, %.lr.ph ], [ %.08492, %.preheader87 ]
  %17 = sdiv i64 %.18591, %.08393
  %18 = srem i64 %17, %.08393
  %19 = icmp eq i64 %18, 0
  br i1 %19, label %.lr.ph, label %.loopexit, !llvm.loop !9

.loopexit:                                        ; preds = %.lr.ph, %.preheader87, %8
  %.2 = phi i64 [ %.08492, %8 ], [ %.08492, %.preheader87 ], [ %17, %.lr.ph ]
  %20 = add nuw nsw i64 %.08393, 1
  %21 = icmp slt i64 %.2, 2
  br i1 %21, label %.critedge, label %8, !llvm.loop !11

.critedge:                                        ; preds = %.loopexit
  store i64 %.098, ptr %1, align 8, !tbaa !5
  br label %.loopexit89

22:                                               ; preds = %11
  %23 = add nuw nsw i64 %.098, 1
  %exitcond.not = icmp eq i64 %23, %0
  br i1 %exitcond.not, label %.loopexit89, label %.preheader88, !llvm.loop !12

.loopexit89:                                      ; preds = %22, %4, %.critedge
  %24 = load i64, ptr %1, align 8, !tbaa !5
  %25 = icmp sgt i64 %24, 1
  tail call void @_ZN11alglib_impl9ae_assertEbPKcPNS_8ae_stateE(i1 noundef zeroext %25, ptr noundef nonnull @.str.46, ptr noundef %3)
  %.not99 = icmp eq i64 %0, 0
  br i1 %.not99, label %.preheader, label %.lr.ph106.preheader

.lr.ph106.preheader:                              ; preds = %.loopexit89
  %26 = load i64, ptr %1, align 8, !tbaa !5
  br label %.lr.ph106

.preheader:                                       ; preds = %.lr.ph106, %.loopexit89
  %.080.lcssa = phi i64 [ 1, %.loopexit89 ], [ %.081100, %.lr.ph106 ]
  %smax = tail call i64 @llvm.smax.i64(i64 %.080.lcssa, i64 0)
  %.080.lcssa.lobit = lshr i64 %.080.lcssa, 63
  %27 = add i64 %.080.lcssa, %.080.lcssa.lobit
  %28 = sub i64 %smax, %27
  %umax = tail call i64 @llvm.umax.i64(i64 %0, i64 1)
  %29 = udiv i64 %28, %umax
  %30 = add i64 %.080.lcssa.lobit, %29
  %31 = mul i64 %30, %0
  %32 = add i64 %.080.lcssa, %31
  store i64 %32, ptr %2, align 8, !tbaa !5
  tail call void @_ZN11alglib_impl9ae_assertEbPKcPNS_8ae_stateE(i1 noundef zeroext true, ptr noundef nonnull @.str.47, ptr noundef %3)
  tail call void @_ZN11alglib_impl9ae_assertEbPKcPNS_8ae_stateE(i1 noundef zeroext true, ptr noundef nonnull @.str.47, ptr noundef %3)
  tail call void @_ZN11alglib_impl9ae_assertEbPKcPNS_8ae_stateE(i1 noundef zeroext true, ptr noundef nonnull @.str.47, ptr noundef %3)
  %33 = load i64, ptr %1, align 8, !tbaa !5
  %34 = load i64, ptr %2, align 8, !tbaa !5
  %35 = mul nsw i64 %34, %33
  %36 = srem i64 %35, %0
  %37 = icmp eq i64 %36, 1
  tail call void @_ZN11alglib_impl9ae_assertEbPKcPNS_8ae_stateE(i1 noundef zeroext %37, ptr noundef nonnull @.str.47, ptr noundef %3)
  ret void

.lr.ph106:                                        ; preds = %.lr.ph106.preheader, %.lr.ph106
  %.076105 = phi i64 [ %39, %.lr.ph106 ], [ %0, %.lr.ph106.preheader ]
  %.077104 = phi i64 [ %.076105, %.lr.ph106 ], [ %26, %.lr.ph106.preheader ]
  %.080101 = phi i64 [ %.081100, %.lr.ph106 ], [ 1, %.lr.ph106.preheader ]
  %.081100 = phi i64 [ %41, %.lr.ph106 ], [ 0, %.lr.ph106.preheader ]
  %38 = sdiv i64 %.077104, %.076105
  %39 = srem i64 %.077104, %.076105
  %40 = mul nsw i64 %38, %.081100
  %41 = sub nsw i64 %.080101, %40
  %.not = icmp eq i64 %39, 0
  br i1 %.not, label %.preheader, label %.lr.ph106, !llvm.loop !13
}

; Function Attrs: mustprogress nounwind uwtable
declare hidden noundef zeroext i1 @_ZN11alglib_implL15ntheory_isprimeElPNS_8ae_stateE(i64 noundef, ptr noundef) local_unnamed_addr #2

; Function Attrs: mustprogress uwtable
declare hidden noundef i64 @_ZN11alglib_implL14ntheory_modexpElllPNS_8ae_stateE(i64 noundef, i64 noundef, i64 noundef, ptr noundef) local_unnamed_addr #1

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.smax.i64(i64, i64) #3

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.umax.i64(i64, i64) #3

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

!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", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
!13 = distinct !{!13, !10}


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