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

; 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
@_ZZ9getPriPeriE3per = external hidden global <{ i32, i32, i32, i32, i32, i32, [99995 x i32] }>, align 16

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i32 @_Z7mod_powiii(i32 noundef, i32 noundef, i32 noundef) #0

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

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

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

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #3

; Function Attrs: mustprogress uwtable
define dso_local noundef i32 @_Z9getPriPeri(i32 noundef %0) #2 {
  %2 = alloca i32, align 4
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  %6 = alloca %"struct.std::pair", align 8
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca %"struct.std::pair", align 8
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  %12 = alloca i32, align 4
  %13 = alloca %"struct.std::pair", align 8
  %14 = alloca %"struct.std::pair", align 8
  %15 = alloca %"struct.std::pair", align 8
  %16 = alloca %"struct.std::pair", align 8
  store i32 %0, ptr %3, align 4, !tbaa !5
  %17 = load i32, ptr %3, align 4, !tbaa !5
  %18 = icmp slt i32 %17, 100001
  br i1 %18, label %19, label %30

19:                                               ; preds = %1
  %20 = load i32, ptr %3, align 4, !tbaa !5
  %21 = sext i32 %20 to i64
  %22 = getelementptr inbounds [100001 x i32], ptr @_ZZ9getPriPeriE3per, i64 0, i64 %21
  %23 = load i32, ptr %22, align 4, !tbaa !5
  %24 = icmp ne i32 %23, 0
  br i1 %24, label %25, label %30

25:                                               ; preds = %19
  %26 = load i32, ptr %3, align 4, !tbaa !5
  %27 = sext i32 %26 to i64
  %28 = getelementptr inbounds [100001 x i32], ptr @_ZZ9getPriPeriE3per, i64 0, i64 %27
  %29 = load i32, ptr %28, align 4, !tbaa !5
  store i32 %29, ptr %2, align 4
  br label %173

30:                                               ; preds = %19, %1
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #5
  %31 = load i32, ptr %3, align 4, !tbaa !5
  %32 = sub nsw i32 %31, 1
  %33 = ashr i32 %32, 1
  %34 = load i32, ptr %3, align 4, !tbaa !5
  %35 = call noundef i32 @_Z7mod_powiii(i32 noundef 5, i32 noundef %33, i32 noundef %34)
  %36 = icmp eq i32 %35, 1
  br i1 %36, label %37, label %41

37:                                               ; preds = %30
  %38 = load i32, ptr %3, align 4, !tbaa !5
  %39 = sub nsw i32 %38, 1
  %40 = ashr i32 %39, 1
  br label %44

41:                                               ; preds = %30
  %42 = load i32, ptr %3, align 4, !tbaa !5
  %43 = add nsw i32 %42, 1
  br label %44

44:                                               ; preds = %41, %37
  %45 = phi i32 [ %40, %37 ], [ %43, %41 ]
  store i32 %45, ptr %4, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #5
  %46 = load i32, ptr %4, align 4, !tbaa !5
  store i32 %46, ptr %5, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 16, ptr %6) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #5
  store i32 0, ptr %7, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #5
  store i32 1, ptr %8, align 4, !tbaa !5
  call void @_ZNSt4pairIxxEC2IiiTnNSt9enable_ifIXaaclsr5_PCCPE22_MoveConstructiblePairIT_T0_EEclsr5_PCCPE30_ImplicitlyMoveConvertiblePairIS3_S4_EEEbE4typeELb1EEEOS3_OS4_(ptr noundef nonnull align 8 dereferenceable(16) %6, ptr noundef nonnull align 4 dereferenceable(4) %7, ptr noundef nonnull align 4 dereferenceable(4) %8)
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #5
  call void @llvm.lifetime.start.p0(i64 16, ptr %9) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #5
  %47 = load i32, ptr %3, align 4, !tbaa !5
  %48 = sub nsw i32 %47, 1
  store i32 %48, ptr %10, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #5
  store i32 0, ptr %11, align 4, !tbaa !5
  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)
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #5
  store i32 0, ptr %12, align 4, !tbaa !5
  br label %49

49:                                               ; preds = %134, %44
  %50 = load i32, ptr %12, align 4, !tbaa !5
  %51 = sext i32 %50 to i64
  %52 = getelementptr inbounds [100001 x i32], ptr @pr, i64 0, i64 %51
  %53 = load i32, ptr %52, align 4, !tbaa !5
  %54 = load i32, ptr %12, align 4, !tbaa !5
  %55 = sext i32 %54 to i64
  %56 = getelementptr inbounds [100001 x i32], ptr @pr, i64 0, i64 %55
  %57 = load i32, ptr %56, align 4, !tbaa !5
  %58 = mul nsw i32 %53, %57
  %59 = load i32, ptr %5, align 4, !tbaa !5
  %60 = icmp sle i32 %58, %59
  br i1 %60, label %62, label %61

61:                                               ; preds = %49
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #5
  br label %137

62:                                               ; preds = %49
  %63 = load i32, ptr %5, align 4, !tbaa !5
  %64 = load i32, ptr %12, align 4, !tbaa !5
  %65 = sext i32 %64 to i64
  %66 = getelementptr inbounds [100001 x i32], ptr @pr, i64 0, i64 %65
  %67 = load i32, ptr %66, align 4, !tbaa !5
  %68 = srem i32 %63, %67
  %69 = icmp sgt i32 %68, 0
  br i1 %69, label %70, label %71

70:                                               ; preds = %62
  br label %134

71:                                               ; preds = %62
  %72 = load i32, ptr %12, align 4, !tbaa !5
  %73 = sext i32 %72 to i64
  %74 = getelementptr inbounds [100001 x i32], ptr @pr, i64 0, i64 %73
  %75 = load i32, ptr %74, align 4, !tbaa !5
  %76 = load i32, ptr %5, align 4, !tbaa !5
  %77 = sdiv i32 %76, %75
  store i32 %77, ptr %5, align 4, !tbaa !5
  br label %78

78:                                               ; preds = %87, %71
  %79 = load i32, ptr %5, align 4, !tbaa !5
  %80 = load i32, ptr %12, align 4, !tbaa !5
  %81 = sext i32 %80 to i64
  %82 = getelementptr inbounds [100001 x i32], ptr @pr, i64 0, i64 %81
  %83 = load i32, ptr %82, align 4, !tbaa !5
  %84 = srem i32 %79, %83
  %85 = icmp eq i32 %84, 0
  br i1 %85, label %86, label %94

86:                                               ; preds = %78
  br label %87

87:                                               ; preds = %86
  %88 = load i32, ptr %12, align 4, !tbaa !5
  %89 = sext i32 %88 to i64
  %90 = getelementptr inbounds [100001 x i32], ptr @pr, i64 0, i64 %89
  %91 = load i32, ptr %90, align 4, !tbaa !5
  %92 = load i32, ptr %5, align 4, !tbaa !5
  %93 = sdiv i32 %92, %91
  store i32 %93, ptr %5, align 4, !tbaa !5
  br label %78, !llvm.loop !9

94:                                               ; preds = %78
  br label %95

95:                                               ; preds = %126, %94
  %96 = load i32, ptr %4, align 4, !tbaa !5
  %97 = load i32, ptr %12, align 4, !tbaa !5
  %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 !5
  %101 = srem i32 %96, %100
  %102 = icmp eq i32 %101, 0
  call void @llvm.lifetime.start.p0(i64 16, ptr %13) #5
  br i1 %102, label %103, label %123

103:                                              ; preds = %95
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %14, ptr align 8 %6, i64 16, i1 false)
  %104 = load i32, ptr %4, align 4, !tbaa !5
  %105 = load i32, ptr %12, align 4, !tbaa !5
  %106 = sext i32 %105 to i64
  %107 = getelementptr inbounds [100001 x i32], ptr @pr, i64 0, i64 %106
  %108 = load i32, ptr %107, align 4, !tbaa !5
  %109 = sdiv i32 %104, %108
  %110 = sext i32 %109 to i64
  %111 = load i32, ptr %3, align 4, !tbaa !5
  %112 = sext i32 %111 to i64
  %113 = getelementptr inbounds { i64, i64 }, ptr %14, i32 0, i32 0
  %114 = load i64, ptr %113, align 8
  %115 = getelementptr inbounds { i64, i64 }, ptr %14, i32 0, i32 1
  %116 = load i64, ptr %115, align 8
  %117 = call { i64, i64 } @_Z7mod_powSt4pairIxxExx(i64 %114, i64 %116, i64 noundef %110, i64 noundef %112)
  %118 = getelementptr inbounds { i64, i64 }, ptr %13, i32 0, i32 0
  %119 = extractvalue { i64, i64 } %117, 0
  store i64 %119, ptr %118, align 8
  %120 = getelementptr inbounds { i64, i64 }, ptr %13, i32 0, i32 1
  %121 = extractvalue { i64, i64 } %117, 1
  store i64 %121, ptr %120, align 8
  %122 = call noundef zeroext i1 @_ZSteqIxxEbRKSt4pairIT_T0_ES5_(ptr noundef nonnull align 8 dereferenceable(16) %13, ptr noundef nonnull align 8 dereferenceable(16) %9)
  br label %123

123:                                              ; preds = %103, %95
  %124 = phi i1 [ false, %95 ], [ %122, %103 ]
  call void @llvm.lifetime.end.p0(i64 16, ptr %13) #5
  br i1 %124, label %125, label %133

125:                                              ; preds = %123
  br label %126

126:                                              ; preds = %125
  %127 = load i32, ptr %12, align 4, !tbaa !5
  %128 = sext i32 %127 to i64
  %129 = getelementptr inbounds [100001 x i32], ptr @pr, i64 0, i64 %128
  %130 = load i32, ptr %129, align 4, !tbaa !5
  %131 = load i32, ptr %4, align 4, !tbaa !5
  %132 = sdiv i32 %131, %130
  store i32 %132, ptr %4, align 4, !tbaa !5
  br label %95, !llvm.loop !11

133:                                              ; preds = %123
  br label %134

134:                                              ; preds = %133, %70
  %135 = load i32, ptr %12, align 4, !tbaa !5
  %136 = add nsw i32 %135, 1
  store i32 %136, ptr %12, align 4, !tbaa !5
  br label %49, !llvm.loop !12

137:                                              ; preds = %61
  %138 = load i32, ptr %5, align 4, !tbaa !5
  %139 = icmp sgt i32 %138, 1
  call void @llvm.lifetime.start.p0(i64 16, ptr %15) #5
  br i1 %139, label %140, label %157

140:                                              ; preds = %137
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %16, ptr align 8 %6, i64 16, i1 false)
  %141 = load i32, ptr %4, align 4, !tbaa !5
  %142 = load i32, ptr %5, align 4, !tbaa !5
  %143 = sdiv i32 %141, %142
  %144 = sext i32 %143 to i64
  %145 = load i32, ptr %3, align 4, !tbaa !5
  %146 = sext i32 %145 to i64
  %147 = getelementptr inbounds { i64, i64 }, ptr %16, i32 0, i32 0
  %148 = load i64, ptr %147, align 8
  %149 = getelementptr inbounds { i64, i64 }, ptr %16, i32 0, i32 1
  %150 = load i64, ptr %149, align 8
  %151 = call { i64, i64 } @_Z7mod_powSt4pairIxxExx(i64 %148, i64 %150, i64 noundef %144, i64 noundef %146)
  %152 = getelementptr inbounds { i64, i64 }, ptr %15, i32 0, i32 0
  %153 = extractvalue { i64, i64 } %151, 0
  store i64 %153, ptr %152, align 8
  %154 = getelementptr inbounds { i64, i64 }, ptr %15, i32 0, i32 1
  %155 = extractvalue { i64, i64 } %151, 1
  store i64 %155, ptr %154, align 8
  %156 = call noundef zeroext i1 @_ZSteqIxxEbRKSt4pairIT_T0_ES5_(ptr noundef nonnull align 8 dereferenceable(16) %15, ptr noundef nonnull align 8 dereferenceable(16) %9)
  br label %157

157:                                              ; preds = %140, %137
  %158 = phi i1 [ false, %137 ], [ %156, %140 ]
  call void @llvm.lifetime.end.p0(i64 16, ptr %15) #5
  br i1 %158, label %159, label %163

159:                                              ; preds = %157
  %160 = load i32, ptr %5, align 4, !tbaa !5
  %161 = load i32, ptr %4, align 4, !tbaa !5
  %162 = sdiv i32 %161, %160
  store i32 %162, ptr %4, align 4, !tbaa !5
  br label %163

163:                                              ; preds = %159, %157
  %164 = load i32, ptr %3, align 4, !tbaa !5
  %165 = icmp slt i32 %164, 100001
  br i1 %165, label %166, label %171

166:                                              ; preds = %163
  %167 = load i32, ptr %4, align 4, !tbaa !5
  %168 = load i32, ptr %3, align 4, !tbaa !5
  %169 = sext i32 %168 to i64
  %170 = getelementptr inbounds [100001 x i32], ptr @_ZZ9getPriPeriE3per, i64 0, i64 %169
  store i32 %167, ptr %170, align 4, !tbaa !5
  br label %171

171:                                              ; preds = %166, %163
  %172 = load i32, ptr %4, align 4, !tbaa !5
  store i32 %172, ptr %2, align 4
  call void @llvm.lifetime.end.p0(i64 16, ptr %9) #5
  call void @llvm.lifetime.end.p0(i64 16, ptr %6) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #5
  br label %173

173:                                              ; preds = %171, %25
  %174 = load i32, ptr %2, align 4
  ret i32 %174
}

; 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 #0 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)) #4

attributes #0 = { 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 #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #4 = { 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 #5 = { 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 = distinct !{!11, !10}
!12 = distinct !{!12, !10}


; 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
@_ZZ9getPriPeriE3per = external hidden local_unnamed_addr global <{ i32, i32, i32, i32, i32, i32, [99995 x i32] }>, align 16

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i32 @_Z7mod_powiii(i32 noundef, i32 noundef, i32 noundef) local_unnamed_addr #0

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

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

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

; Function Attrs: mustprogress uwtable
define dso_local noundef i32 @_Z9getPriPeri(i32 noundef %0) local_unnamed_addr #2 {
  %2 = alloca %"struct.std::pair", align 8
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca %"struct.std::pair", align 8
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  %8 = alloca %"struct.std::pair", align 8
  %9 = alloca %"struct.std::pair", align 8
  %10 = icmp slt i32 %0, 100001
  br i1 %10, label %11, label %15

11:                                               ; preds = %1
  %12 = sext i32 %0 to i64
  %13 = getelementptr inbounds [100001 x i32], ptr @_ZZ9getPriPeriE3per, i64 0, i64 %12
  %14 = load i32, ptr %13, align 4, !tbaa !5
  %.not = icmp eq i32 %14, 0
  br i1 %.not, label %15, label %65

15:                                               ; preds = %11, %1
  %16 = add nsw i32 %0, -1
  %17 = ashr i32 %16, 1
  %18 = tail call noundef i32 @_Z7mod_powiii(i32 noundef 5, i32 noundef %17, i32 noundef %0)
  %19 = icmp eq i32 %18, 1
  %20 = add nsw i32 %0, 1
  %21 = select i1 %19, i32 %17, i32 %20
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %2) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %3) #4
  store i32 0, ptr %3, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %4) #4
  store i32 1, ptr %4, align 4, !tbaa !5
  call void @_ZNSt4pairIxxEC2IiiTnNSt9enable_ifIXaaclsr5_PCCPE22_MoveConstructiblePairIT_T0_EEclsr5_PCCPE30_ImplicitlyMoveConvertiblePairIS3_S4_EEEbE4typeELb1EEEOS3_OS4_(ptr noundef nonnull align 8 dereferenceable(16) %2, ptr noundef nonnull align 4 dereferenceable(4) %3, ptr noundef nonnull align 4 dereferenceable(4) %4)
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %4) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %3) #4
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %5) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %6) #4
  store i32 %16, ptr %6, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %7) #4
  store i32 0, ptr %7, align 4, !tbaa !5
  call void @_ZNSt4pairIxxEC2IiiTnNSt9enable_ifIXaaclsr5_PCCPE22_MoveConstructiblePairIT_T0_EEclsr5_PCCPE30_ImplicitlyMoveConvertiblePairIS3_S4_EEEbE4typeELb1EEEOS3_OS4_(ptr noundef nonnull align 8 dereferenceable(16) %5, ptr noundef nonnull align 4 dereferenceable(4) %6, ptr noundef nonnull align 4 dereferenceable(4) %7)
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %7) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %6) #4
  %22 = load i32, ptr @pr, align 16, !tbaa !5
  %23 = mul nsw i32 %22, %22
  %.not5155 = icmp sgt i32 %23, %21
  br i1 %.not5155, label %._crit_edge, label %.lr.ph59

.lr.ph59:                                         ; preds = %15
  %.sroa.24.0..sroa_idx = getelementptr inbounds i8, ptr %2, i64 8
  %24 = sext i32 %0 to i64
  %25 = getelementptr inbounds i8, ptr %8, i64 8
  br label %27

._crit_edge:                                      ; preds = %.loopexit, %15
  %.044.lcssa = phi i32 [ %21, %15 ], [ %.246, %.loopexit ]
  %.043.lcssa = phi i32 [ %21, %15 ], [ %.2, %.loopexit ]
  %26 = icmp sgt i32 %.044.lcssa, 1
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %9) #4
  br i1 %26, label %51, label %.critedge2

27:                                               ; preds = %.lr.ph59, %.loopexit
  %indvars.iv = phi i64 [ 0, %.lr.ph59 ], [ %indvars.iv.next, %.loopexit ]
  %28 = phi i32 [ %22, %.lr.ph59 ], [ %49, %.loopexit ]
  %29 = phi ptr [ @pr, %.lr.ph59 ], [ %48, %.loopexit ]
  %.04358 = phi i32 [ %21, %.lr.ph59 ], [ %.2, %.loopexit ]
  %.04457 = phi i32 [ %21, %.lr.ph59 ], [ %.246, %.loopexit ]
  %30 = srem i32 %.04457, %28
  %31 = icmp sgt i32 %30, 0
  br i1 %31, label %.loopexit, label %.preheader52

.preheader52:                                     ; preds = %27, %.preheader52
  %.044.pn = phi i32 [ %.145, %.preheader52 ], [ %.04457, %27 ]
  %.145 = sdiv i32 %.044.pn, %28
  %32 = srem i32 %.145, %28
  %33 = icmp eq i32 %32, 0
  br i1 %33, label %.preheader52, label %.preheader, !llvm.loop !9

.preheader:                                       ; preds = %.preheader52
  %34 = srem i32 %.04358, %28
  %35 = icmp eq i32 %34, 0
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %8) #4
  br i1 %35, label %.lr.ph, label %.critedge

.lr.ph:                                           ; preds = %.preheader, %43
  %36 = phi i32 [ %44, %43 ], [ %28, %.preheader ]
  %.154 = phi i32 [ %45, %43 ], [ %.04358, %.preheader ]
  %.sroa.03.0.copyload = load i64, ptr %2, align 8
  %.sroa.24.0.copyload = load i64, ptr %.sroa.24.0..sroa_idx, align 8
  %37 = sdiv i32 %.154, %36
  %38 = sext i32 %37 to i64
  %39 = call { i64, i64 } @_Z7mod_powSt4pairIxxExx(i64 %.sroa.03.0.copyload, i64 %.sroa.24.0.copyload, i64 noundef %38, i64 noundef %24)
  %40 = extractvalue { i64, i64 } %39, 0
  store i64 %40, ptr %8, align 8
  %41 = extractvalue { i64, i64 } %39, 1
  store i64 %41, ptr %25, align 8
  %42 = call noundef zeroext i1 @_ZSteqIxxEbRKSt4pairIT_T0_ES5_(ptr noundef nonnull align 8 dereferenceable(16) %8, ptr noundef nonnull align 8 dereferenceable(16) %5)
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %8) #4
  br i1 %42, label %43, label %.loopexit

43:                                               ; preds = %.lr.ph
  %44 = load i32, ptr %29, align 4, !tbaa !5
  %45 = sdiv i32 %.154, %44
  %46 = srem i32 %45, %44
  %47 = icmp eq i32 %46, 0
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %8) #4
  br i1 %47, label %.lr.ph, label %.critedge, !llvm.loop !11

.critedge:                                        ; preds = %43, %.preheader
  %.1.lcssa = phi i32 [ %.04358, %.preheader ], [ %45, %43 ]
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %8) #4
  br label %.loopexit

.loopexit:                                        ; preds = %.lr.ph, %.critedge, %27
  %.246 = phi i32 [ %.04457, %27 ], [ %.145, %.critedge ], [ %.145, %.lr.ph ]
  %.2 = phi i32 [ %.04358, %27 ], [ %.1.lcssa, %.critedge ], [ %.154, %.lr.ph ]
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %48 = getelementptr inbounds [100001 x i32], ptr @pr, i64 0, i64 %indvars.iv.next
  %49 = load i32, ptr %48, align 4, !tbaa !5
  %50 = mul nsw i32 %49, %49
  %.not51 = icmp sgt i32 %50, %.246
  br i1 %.not51, label %._crit_edge, label %27, !llvm.loop !12

51:                                               ; preds = %._crit_edge
  %.sroa.0.0.copyload = load i64, ptr %2, align 8
  %.sroa.2.0..sroa_idx = getelementptr inbounds i8, ptr %2, i64 8
  %.sroa.2.0.copyload = load i64, ptr %.sroa.2.0..sroa_idx, align 8
  %52 = sdiv i32 %.043.lcssa, %.044.lcssa
  %53 = sext i32 %52 to i64
  %54 = sext i32 %0 to i64
  %55 = call { i64, i64 } @_Z7mod_powSt4pairIxxExx(i64 %.sroa.0.0.copyload, i64 %.sroa.2.0.copyload, i64 noundef %53, i64 noundef %54)
  %56 = extractvalue { i64, i64 } %55, 0
  store i64 %56, ptr %9, align 8
  %57 = getelementptr inbounds i8, ptr %9, i64 8
  %58 = extractvalue { i64, i64 } %55, 1
  store i64 %58, ptr %57, align 8
  %59 = call noundef zeroext i1 @_ZSteqIxxEbRKSt4pairIT_T0_ES5_(ptr noundef nonnull align 8 dereferenceable(16) %9, ptr noundef nonnull align 8 dereferenceable(16) %5)
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %9) #4
  %spec.select = select i1 %59, i32 %52, i32 %.043.lcssa
  br label %60

.critedge2:                                       ; preds = %._crit_edge
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %9) #4
  br label %60

60:                                               ; preds = %51, %.critedge2
  %.3 = phi i32 [ %.043.lcssa, %.critedge2 ], [ %spec.select, %51 ]
  br i1 %10, label %61, label %64

61:                                               ; preds = %60
  %62 = sext i32 %0 to i64
  %63 = getelementptr inbounds [100001 x i32], ptr @_ZZ9getPriPeriE3per, i64 0, i64 %62
  store i32 %.3, ptr %63, align 4, !tbaa !5
  br label %64

64:                                               ; preds = %61, %60
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %5) #4
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %2) #4
  br label %65

65:                                               ; preds = %11, %64
  %.0 = phi i32 [ %.3, %64 ], [ %14, %11 ]
  ret i32 %.0
}

; 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 #0 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

attributes #0 = { 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 #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { 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 = distinct !{!11, !10}
!12 = distinct !{!12, !10}


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