; LLVM IR from tangjz/acm-icpc :: lydsy/5474.ll (Z6getPerx)

; 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.std::pair" = type { i64, i64 }

@pr = external dso_local global [100001 x i32], align 16

; 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

; Function Attrs: mustprogress uwtable
declare dso_local { i64, i64 } @_Z7mod_powSt4pairIxxExx(i64, i64, i64 noundef, i64 noundef) #1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt4pairIxxEC2IxiTnNSt9enable_ifIXaaclsr5_PCCPE22_MoveConstructiblePairIT_T0_EEclsr5_PCCPE30_ImplicitlyMoveConvertiblePairIS3_S4_EEEbE4typeELb1EEEOS3_OS4_(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 4 dereferenceable(4)) unnamed_addr #2 align 2

; Function Attrs: mustprogress uwtable
declare dso_local noundef i32 @_Z9getPriPeri(i32 noundef) #1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt4pairIxxEC2IiiTnNSt9enable_ifIXaaclsr5_PCCPE22_MoveConstructiblePairIT_T0_EEclsr5_PCCPE30_ImplicitlyMoveConvertiblePairIS3_S4_EEEbE4typeELb1EEEOS3_OS4_(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4)) unnamed_addr #2 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZSteqIxxEbRKSt4pairIT_T0_ES5_(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 8 dereferenceable(16)) #3

; Function Attrs: mustprogress uwtable
define dso_local noundef i64 @_Z6getPerx(i64 noundef %0) #1 {
  %2 = alloca i64, align 8
  %3 = alloca i64, align 8
  %4 = alloca i64, align 8
  %5 = alloca i32, align 4
  %6 = alloca i64, align 8
  %7 = alloca i64, align 8
  %8 = alloca %"struct.std::pair", align 8
  %9 = alloca %"struct.std::pair", align 8
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  %12 = alloca %"struct.std::pair", align 8
  %13 = alloca i64, align 8
  %14 = alloca i32, align 4
  %15 = alloca i64, align 8
  store i64 %0, ptr %2, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %3) #4
  store i64 1, ptr %3, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #4
  %16 = load i64, ptr %2, align 8, !tbaa !5
  store i64 %16, ptr %4, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #4
  store i32 0, ptr %5, align 4, !tbaa !9
  br label %17

17:                                               ; preds = %132, %1
  %18 = load i32, ptr %5, align 4, !tbaa !9
  %19 = sext i32 %18 to i64
  %20 = getelementptr inbounds [100001 x i32], ptr @pr, i64 0, i64 %19
  %21 = load i32, ptr %20, align 4, !tbaa !9
  %22 = load i32, ptr %5, align 4, !tbaa !9
  %23 = sext i32 %22 to i64
  %24 = getelementptr inbounds [100001 x i32], ptr @pr, i64 0, i64 %23
  %25 = load i32, ptr %24, align 4, !tbaa !9
  %26 = mul nsw i32 %21, %25
  %27 = sext i32 %26 to i64
  %28 = load i64, ptr %4, align 8, !tbaa !5
  %29 = icmp sle i64 %27, %28
  br i1 %29, label %31, label %30

30:                                               ; preds = %17
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #4
  br label %135

31:                                               ; preds = %17
  %32 = load i64, ptr %4, align 8, !tbaa !5
  %33 = load i32, ptr %5, align 4, !tbaa !9
  %34 = sext i32 %33 to i64
  %35 = getelementptr inbounds [100001 x i32], ptr @pr, i64 0, i64 %34
  %36 = load i32, ptr %35, align 4, !tbaa !9
  %37 = sext i32 %36 to i64
  %38 = srem i64 %32, %37
  %39 = icmp sgt i64 %38, 0
  br i1 %39, label %40, label %41

40:                                               ; preds = %31
  br label %132

41:                                               ; preds = %31
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #4
  %42 = load i32, ptr %5, align 4, !tbaa !9
  %43 = sext i32 %42 to i64
  %44 = getelementptr inbounds [100001 x i32], ptr @pr, i64 0, i64 %43
  %45 = load i32, ptr %44, align 4, !tbaa !9
  %46 = call noundef i32 @_Z9getPriPeri(i32 noundef %45)
  %47 = sext i32 %46 to i64
  store i64 %47, ptr %6, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #4
  %48 = load i32, ptr %5, align 4, !tbaa !9
  %49 = sext i32 %48 to i64
  %50 = getelementptr inbounds [100001 x i32], ptr @pr, i64 0, i64 %49
  %51 = load i32, ptr %50, align 4, !tbaa !9
  %52 = sext i32 %51 to i64
  store i64 %52, ptr %7, align 8, !tbaa !5
  %53 = load i32, ptr %5, align 4, !tbaa !9
  %54 = sext i32 %53 to i64
  %55 = getelementptr inbounds [100001 x i32], ptr @pr, i64 0, i64 %54
  %56 = load i32, ptr %55, align 4, !tbaa !9
  %57 = sext i32 %56 to i64
  %58 = load i64, ptr %4, align 8, !tbaa !5
  %59 = sdiv i64 %58, %57
  store i64 %59, ptr %4, align 8, !tbaa !5
  br label %60

60:                                               ; preds = %70, %41
  %61 = load i64, ptr %4, align 8, !tbaa !5
  %62 = load i32, ptr %5, align 4, !tbaa !9
  %63 = sext i32 %62 to i64
  %64 = getelementptr inbounds [100001 x i32], ptr @pr, i64 0, i64 %63
  %65 = load i32, ptr %64, align 4, !tbaa !9
  %66 = sext i32 %65 to i64
  %67 = srem i64 %61, %66
  %68 = icmp eq i64 %67, 0
  br i1 %68, label %69, label %92

69:                                               ; preds = %60
  br label %70

70:                                               ; preds = %69
  %71 = load i32, ptr %5, align 4, !tbaa !9
  %72 = sext i32 %71 to i64
  %73 = getelementptr inbounds [100001 x i32], ptr @pr, i64 0, i64 %72
  %74 = load i32, ptr %73, align 4, !tbaa !9
  %75 = sext i32 %74 to i64
  %76 = load i64, ptr %4, align 8, !tbaa !5
  %77 = sdiv i64 %76, %75
  store i64 %77, ptr %4, align 8, !tbaa !5
  %78 = load i32, ptr %5, align 4, !tbaa !9
  %79 = sext i32 %78 to i64
  %80 = getelementptr inbounds [100001 x i32], ptr @pr, i64 0, i64 %79
  %81 = load i32, ptr %80, align 4, !tbaa !9
  %82 = sext i32 %81 to i64
  %83 = load i64, ptr %6, align 8, !tbaa !5
  %84 = mul nsw i64 %83, %82
  store i64 %84, ptr %6, align 8, !tbaa !5
  %85 = load i32, ptr %5, align 4, !tbaa !9
  %86 = sext i32 %85 to i64
  %87 = getelementptr inbounds [100001 x i32], ptr @pr, i64 0, i64 %86
  %88 = load i32, ptr %87, align 4, !tbaa !9
  %89 = sext i32 %88 to i64
  %90 = load i64, ptr %7, align 8, !tbaa !5
  %91 = mul nsw i64 %90, %89
  store i64 %91, ptr %7, align 8, !tbaa !5
  br label %60, !llvm.loop !11

92:                                               ; preds = %60
  %93 = load i64, ptr %6, align 8, !tbaa !5
  %94 = and i64 %93, 1
  %95 = icmp ne i64 %94, 0
  call void @llvm.lifetime.start.p0(i64 16, ptr %8) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #4
  call void @llvm.lifetime.start.p0(i64 16, ptr %12) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #4
  br i1 %95, label %119, label %96

96:                                               ; preds = %92
  %97 = load i32, ptr %5, align 4, !tbaa !9
  %98 = sext i32 %97 to i64
  %99 = getelementptr inbounds [100001 x i32], ptr @pr, i64 0, i64 %98
  %100 = load i32, ptr %99, align 4, !tbaa !9
  %101 = and i32 %100, 1
  %102 = icmp ne i32 %101, 0
  br i1 %102, label %119, label %103

103:                                              ; preds = %96
  store i32 0, ptr %10, align 4, !tbaa !9
  store i32 1, ptr %11, align 4, !tbaa !9
  call void @_ZNSt4pairIxxEC2IiiTnNSt9enable_ifIXaaclsr5_PCCPE22_MoveConstructiblePairIT_T0_EEclsr5_PCCPE30_ImplicitlyMoveConvertiblePairIS3_S4_EEEbE4typeELb1EEEOS3_OS4_(ptr noundef nonnull align 8 dereferenceable(16) %9, ptr noundef nonnull align 4 dereferenceable(4) %10, ptr noundef nonnull align 4 dereferenceable(4) %11)
  %104 = load i64, ptr %6, align 8, !tbaa !5
  %105 = ashr i64 %104, 1
  %106 = load i64, ptr %7, align 8, !tbaa !5
  %107 = getelementptr inbounds { i64, i64 }, ptr %9, i32 0, i32 0
  %108 = load i64, ptr %107, align 8
  %109 = getelementptr inbounds { i64, i64 }, ptr %9, i32 0, i32 1
  %110 = load i64, ptr %109, align 8
  %111 = call { i64, i64 } @_Z7mod_powSt4pairIxxExx(i64 %108, i64 %110, i64 noundef %105, i64 noundef %106)
  %112 = getelementptr inbounds { i64, i64 }, ptr %8, i32 0, i32 0
  %113 = extractvalue { i64, i64 } %111, 0
  store i64 %113, ptr %112, align 8
  %114 = getelementptr inbounds { i64, i64 }, ptr %8, i32 0, i32 1
  %115 = extractvalue { i64, i64 } %111, 1
  store i64 %115, ptr %114, align 8
  %116 = load i64, ptr %7, align 8, !tbaa !5
  %117 = sub nsw i64 %116, 1
  store i64 %117, ptr %13, align 8, !tbaa !5
  store i32 0, ptr %14, align 4, !tbaa !9
  call void @_ZNSt4pairIxxEC2IxiTnNSt9enable_ifIXaaclsr5_PCCPE22_MoveConstructiblePairIT_T0_EEclsr5_PCCPE30_ImplicitlyMoveConvertiblePairIS3_S4_EEEbE4typeELb1EEEOS3_OS4_(ptr noundef nonnull align 8 dereferenceable(16) %12, ptr noundef nonnull align 8 dereferenceable(8) %13, ptr noundef nonnull align 4 dereferenceable(4) %14)
  %118 = call noundef zeroext i1 @_ZSteqIxxEbRKSt4pairIT_T0_ES5_(ptr noundef nonnull align 8 dereferenceable(16) %8, ptr noundef nonnull align 8 dereferenceable(16) %12)
  br label %119

119:                                              ; preds = %103, %96, %92
  %120 = phi i1 [ false, %96 ], [ false, %92 ], [ %118, %103 ]
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #4
  call void @llvm.lifetime.end.p0(i64 16, ptr %12) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #4
  call void @llvm.lifetime.end.p0(i64 16, ptr %8) #4
  br i1 %120, label %121, label %124

121:                                              ; preds = %119
  %122 = load i64, ptr %6, align 8, !tbaa !5
  %123 = ashr i64 %122, 1
  store i64 %123, ptr %6, align 8, !tbaa !5
  br label %124

124:                                              ; preds = %121, %119
  %125 = load i64, ptr %6, align 8, !tbaa !5
  %126 = load i64, ptr %3, align 8, !tbaa !5
  %127 = load i64, ptr %6, align 8, !tbaa !5
  %128 = call noundef i64 @_ZSt5__gcdIxET_S0_S0_(i64 noundef %126, i64 noundef %127)
  %129 = sdiv i64 %125, %128
  %130 = load i64, ptr %3, align 8, !tbaa !5
  %131 = mul nsw i64 %130, %129
  store i64 %131, ptr %3, align 8, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #4
  br label %132

132:                                              ; preds = %124, %40
  %133 = load i32, ptr %5, align 4, !tbaa !9
  %134 = add nsw i32 %133, 1
  store i32 %134, ptr %5, align 4, !tbaa !9
  br label %17, !llvm.loop !13

135:                                              ; preds = %30
  %136 = load i64, ptr %4, align 8, !tbaa !5
  %137 = icmp sgt i64 %136, 1
  br i1 %137, label %138, label %150

138:                                              ; preds = %135
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #4
  %139 = load i64, ptr %4, align 8, !tbaa !5
  %140 = trunc i64 %139 to i32
  %141 = call noundef i32 @_Z9getPriPeri(i32 noundef %140)
  %142 = sext i32 %141 to i64
  store i64 %142, ptr %15, align 8, !tbaa !5
  %143 = load i64, ptr %15, align 8, !tbaa !5
  %144 = load i64, ptr %3, align 8, !tbaa !5
  %145 = load i64, ptr %15, align 8, !tbaa !5
  %146 = call noundef i64 @_ZSt5__gcdIxET_S0_S0_(i64 noundef %144, i64 noundef %145)
  %147 = sdiv i64 %143, %146
  %148 = load i64, ptr %3, align 8, !tbaa !5
  %149 = mul nsw i64 %148, %147
  store i64 %149, ptr %3, align 8, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #4
  br label %150

150:                                              ; preds = %138, %135
  %151 = load i64, ptr %3, align 8, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %3) #4
  ret i64 %151
}

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i64 @_ZSt5__gcdIxET_S0_S0_(i64 noundef, i64 noundef) #2

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { inlinehint 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 long", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = distinct !{!13, !12}


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

%"struct.std::pair" = type { i64, i64 }

@pr = external dso_local local_unnamed_addr global [100001 x i32], align 16

; 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

; Function Attrs: mustprogress uwtable
declare dso_local { i64, i64 } @_Z7mod_powSt4pairIxxExx(i64, i64, i64 noundef, i64 noundef) local_unnamed_addr #1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt4pairIxxEC2IxiTnNSt9enable_ifIXaaclsr5_PCCPE22_MoveConstructiblePairIT_T0_EEclsr5_PCCPE30_ImplicitlyMoveConvertiblePairIS3_S4_EEEbE4typeELb1EEEOS3_OS4_(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 4 dereferenceable(4)) unnamed_addr #2 align 2

; Function Attrs: mustprogress uwtable
declare dso_local noundef i32 @_Z9getPriPeri(i32 noundef) local_unnamed_addr #1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt4pairIxxEC2IiiTnNSt9enable_ifIXaaclsr5_PCCPE22_MoveConstructiblePairIT_T0_EEclsr5_PCCPE30_ImplicitlyMoveConvertiblePairIS3_S4_EEEbE4typeELb1EEEOS3_OS4_(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4)) unnamed_addr #2 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZSteqIxxEbRKSt4pairIT_T0_ES5_(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 8 dereferenceable(16)) local_unnamed_addr #3

; Function Attrs: mustprogress uwtable
define dso_local noundef i64 @_Z6getPerx(i64 noundef %0) local_unnamed_addr #1 {
  %2 = alloca %"struct.std::pair", align 8
  %3 = alloca %"struct.std::pair", align 8
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  %6 = alloca %"struct.std::pair", align 8
  %7 = alloca i64, align 8
  %8 = alloca i32, align 4
  %9 = load i32, ptr @pr, align 16, !tbaa !5
  %10 = mul nsw i32 %9, %9
  %11 = zext nneg i32 %10 to i64
  %.not52 = icmp sgt i64 %11, %0
  br i1 %.not52, label %._crit_edge58, label %.lr.ph57

.lr.ph57:                                         ; preds = %1
  %12 = getelementptr inbounds i8, ptr %3, i64 8
  %13 = getelementptr inbounds i8, ptr %2, i64 8
  br label %15

._crit_edge58:                                    ; preds = %46, %1
  %.040.lcssa = phi i64 [ %0, %1 ], [ %.242, %46 ]
  %.0.lcssa = phi i64 [ 1, %1 ], [ %.1, %46 ]
  %14 = icmp sgt i64 %.040.lcssa, 1
  br i1 %14, label %51, label %58

15:                                               ; preds = %.lr.ph57, %46
  %indvars.iv = phi i64 [ 0, %.lr.ph57 ], [ %indvars.iv.next, %46 ]
  %16 = phi i32 [ %9, %.lr.ph57 ], [ %48, %46 ]
  %17 = phi ptr [ @pr, %.lr.ph57 ], [ %47, %46 ]
  %.055 = phi i64 [ 1, %.lr.ph57 ], [ %.1, %46 ]
  %.04053 = phi i64 [ %0, %.lr.ph57 ], [ %.242, %46 ]
  %18 = sext i32 %16 to i64
  %19 = srem i64 %.04053, %18
  %.not45 = icmp eq i64 %19, 0
  br i1 %.not45, label %20, label %46

20:                                               ; preds = %15
  %21 = call noundef i32 @_Z9getPriPeri(i32 noundef %16)
  %22 = sext i32 %21 to i64
  %23 = load i32, ptr %17, align 4, !tbaa !5
  %24 = sext i32 %23 to i64
  %.14146 = sdiv i64 %.04053, %24
  %25 = srem i64 %.14146, %24
  %26 = icmp eq i64 %25, 0
  br i1 %26, label %.lr.ph, label %._crit_edge

.lr.ph:                                           ; preds = %20, %.lr.ph
  %.14149 = phi i64 [ %.141, %.lr.ph ], [ %.14146, %20 ]
  %.03648 = phi i64 [ %28, %.lr.ph ], [ %24, %20 ]
  %.03747 = phi i64 [ %27, %.lr.ph ], [ %22, %20 ]
  %27 = mul nsw i64 %.03747, %24
  %28 = mul nsw i64 %.03648, %24
  %.141 = sdiv i64 %.14149, %24
  %29 = srem i64 %.141, %24
  %30 = icmp eq i64 %29, 0
  br i1 %30, label %.lr.ph, label %._crit_edge, !llvm.loop !9

._crit_edge:                                      ; preds = %.lr.ph, %20
  %.037.lcssa = phi i64 [ %22, %20 ], [ %27, %.lr.ph ]
  %.036.lcssa = phi i64 [ %24, %20 ], [ %28, %.lr.ph ]
  %.141.lcssa = phi i64 [ %.14146, %20 ], [ %.141, %.lr.ph ]
  %31 = and i64 %.037.lcssa, 1
  %.not43 = icmp eq i64 %31, 0
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %2) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %4) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %5) #4
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %6) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %7) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %8) #4
  %32 = and i32 %23, 1
  %.not44 = icmp eq i32 %32, 0
  %or.cond = and i1 %.not44, %.not43
  br i1 %or.cond, label %33, label %.critedge

33:                                               ; preds = %._crit_edge
  store i32 0, ptr %4, align 4, !tbaa !5
  store i32 1, ptr %5, align 4, !tbaa !5
  call void @_ZNSt4pairIxxEC2IiiTnNSt9enable_ifIXaaclsr5_PCCPE22_MoveConstructiblePairIT_T0_EEclsr5_PCCPE30_ImplicitlyMoveConvertiblePairIS3_S4_EEEbE4typeELb1EEEOS3_OS4_(ptr noundef nonnull align 8 dereferenceable(16) %3, ptr noundef nonnull align 4 dereferenceable(4) %4, ptr noundef nonnull align 4 dereferenceable(4) %5)
  %34 = ashr exact i64 %.037.lcssa, 1
  %35 = load i64, ptr %3, align 8
  %36 = load i64, ptr %12, align 8
  %37 = call { i64, i64 } @_Z7mod_powSt4pairIxxExx(i64 %35, i64 %36, i64 noundef %34, i64 noundef %.036.lcssa)
  %38 = extractvalue { i64, i64 } %37, 0
  store i64 %38, ptr %2, align 8
  %39 = extractvalue { i64, i64 } %37, 1
  store i64 %39, ptr %13, align 8
  %40 = add nsw i64 %.036.lcssa, -1
  store i64 %40, ptr %7, align 8, !tbaa !11
  store i32 0, ptr %8, align 4, !tbaa !5
  call void @_ZNSt4pairIxxEC2IxiTnNSt9enable_ifIXaaclsr5_PCCPE22_MoveConstructiblePairIT_T0_EEclsr5_PCCPE30_ImplicitlyMoveConvertiblePairIS3_S4_EEEbE4typeELb1EEEOS3_OS4_(ptr noundef nonnull align 8 dereferenceable(16) %6, ptr noundef nonnull align 8 dereferenceable(8) %7, ptr noundef nonnull align 4 dereferenceable(4) %8)
  %41 = call noundef zeroext i1 @_ZSteqIxxEbRKSt4pairIT_T0_ES5_(ptr noundef nonnull align 8 dereferenceable(16) %2, ptr noundef nonnull align 8 dereferenceable(16) %6)
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %8) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %7) #4
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %6) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %5) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %4) #4
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %2) #4
  %spec.select = select i1 %41, i64 %34, i64 %.037.lcssa
  br label %42

.critedge:                                        ; preds = %._crit_edge
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %8) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %7) #4
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %6) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %5) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %4) #4
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %2) #4
  br label %42

42:                                               ; preds = %33, %.critedge
  %.138 = phi i64 [ %.037.lcssa, %.critedge ], [ %spec.select, %33 ]
  %43 = call noundef i64 @_ZSt5__gcdIxET_S0_S0_(i64 noundef %.055, i64 noundef %.138)
  %44 = sdiv i64 %.138, %43
  %45 = mul nsw i64 %44, %.055
  br label %46

46:                                               ; preds = %15, %42
  %.242 = phi i64 [ %.04053, %15 ], [ %.141.lcssa, %42 ]
  %.1 = phi i64 [ %.055, %15 ], [ %45, %42 ]
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %47 = getelementptr inbounds [100001 x i32], ptr @pr, i64 0, i64 %indvars.iv.next
  %48 = load i32, ptr %47, align 4, !tbaa !5
  %49 = mul nsw i32 %48, %48
  %50 = zext nneg i32 %49 to i64
  %.not = icmp slt i64 %.242, %50
  br i1 %.not, label %._crit_edge58, label %15, !llvm.loop !13

51:                                               ; preds = %._crit_edge58
  %52 = trunc nuw nsw i64 %.040.lcssa to i32
  %53 = call noundef i32 @_Z9getPriPeri(i32 noundef %52)
  %54 = sext i32 %53 to i64
  %55 = call noundef i64 @_ZSt5__gcdIxET_S0_S0_(i64 noundef %.0.lcssa, i64 noundef %54)
  %56 = sdiv i64 %54, %55
  %57 = mul nsw i64 %56, %.0.lcssa
  br label %58

58:                                               ; preds = %51, %._crit_edge58
  %.2 = phi i64 [ %57, %51 ], [ %.0.lcssa, %._crit_edge58 ]
  ret i64 %.2
}

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i64 @_ZSt5__gcdIxET_S0_S0_(i64 noundef, i64 noundef) local_unnamed_addr #2

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { inlinehint 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 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = !{!12, !12, i64 0}
!12 = !{!"long long", !7, i64 0}
!13 = distinct !{!13, !10}


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