; LLVM IR from ShahjalalShohag/code-library :: Number Theory (Number of Distinct Kth Powers Modulo n)

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

%"class.std::basic_istream" = type { ptr, i64, %"class.std::basic_ios" }
%"class.std::basic_ios" = type { %"class.std::ios_base", ptr, i8, i8, ptr, ptr, ptr, ptr }
%"class.std::ios_base" = type { ptr, i64, i64, i32, i32, i32, ptr, %"struct.std::ios_base::_Words", [8 x %"struct.std::ios_base::_Words"], i32, ptr, %"class.std::locale" }
%"struct.std::ios_base::_Words" = type { ptr, i64 }
%"class.std::locale" = type { ptr }
%"class.std::set" = type { %"class.std::_Rb_tree" }
%"class.std::_Rb_tree" = type { %"struct.std::_Rb_tree<int, int, std::_Identity<int>, std::less<int>>::_Rb_tree_impl" }
%"struct.std::_Rb_tree<int, int, std::_Identity<int>, std::less<int>>::_Rb_tree_impl" = type { [8 x i8], %"struct.std::_Rb_tree_header" }
%"struct.std::_Rb_tree_header" = type { %"struct.std::_Rb_tree_node_base", i64 }
%"struct.std::_Rb_tree_node_base" = type { i32, ptr, ptr, ptr }
%"struct.std::pair" = type <{ %"struct.std::_Rb_tree_const_iterator", i8, [7 x i8] }>
%"struct.std::_Rb_tree_const_iterator" = type { ptr }

@_ZSt3cin = external global %"class.std::basic_istream", align 8
@.str = external hidden unnamed_addr constant [22 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [119 x i8], align 1
@__PRETTY_FUNCTION__.main = external hidden unnamed_addr constant [15 x i8], align 1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i64 @_Z5powerxx(i64 noundef, i64 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 noundef i64 @_Z2yoxx(i64 noundef, i64 noundef) #2

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() #3 personality ptr @__gxx_personality_v0 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca %"class.std::set", align 8
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  %8 = alloca ptr, align 8
  %9 = alloca i32, align 4
  %10 = alloca %"struct.std::pair", align 8
  store i32 0, ptr %1, align 4
  %11 = call noundef zeroext i1 @_ZNSt8ios_base15sync_with_stdioEb(i1 noundef zeroext false)
  %12 = load ptr, ptr @_ZSt3cin, align 8, !tbaa !5
  %13 = getelementptr i8, ptr %12, i64 -24
  %14 = load i64, ptr %13, align 8
  %15 = getelementptr inbounds i8, ptr @_ZSt3cin, i64 %14
  %16 = call noundef ptr @_ZNSt9basic_iosIcSt11char_traitsIcEE3tieEPSo(ptr noundef nonnull align 8 dereferenceable(264) %15, ptr noundef null)
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #6
  store i32 0, ptr %2, align 4, !tbaa !8
  br label %17

17:                                               ; preds = %77, %0
  %18 = load i32, ptr %2, align 4, !tbaa !8
  %19 = icmp sle i32 %18, 5
  br i1 %19, label %21, label %20

20:                                               ; preds = %17
  store i32 2, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #6
  br label %80

21:                                               ; preds = %17
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #6
  store i32 1, ptr %4, align 4, !tbaa !8
  br label %22

22:                                               ; preds = %72, %21
  %23 = load i32, ptr %4, align 4, !tbaa !8
  %24 = icmp sle i32 %23, 12
  br i1 %24, label %26, label %25

25:                                               ; preds = %22
  store i32 5, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #6
  br label %76

26:                                               ; preds = %22
  call void @llvm.lifetime.start.p0(i64 48, ptr %5) #6
  call void @_ZNSt3setIiSt4lessIiESaIiEEC2Ev(ptr noundef nonnull align 8 dereferenceable(48) %5) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #6
  store i32 0, ptr %6, align 4, !tbaa !8
  br label %27

27:                                               ; preds = %48, %26
  %28 = load i32, ptr %6, align 4, !tbaa !8
  %29 = load i32, ptr %4, align 4, !tbaa !8
  %30 = icmp sle i32 %28, %29
  br i1 %30, label %32, label %31

31:                                               ; preds = %27
  store i32 8, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #6
  br label %55

32:                                               ; preds = %27
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #6
  %33 = load i32, ptr %6, align 4, !tbaa !8
  %34 = sext i32 %33 to i64
  %35 = load i32, ptr %2, align 4, !tbaa !8
  %36 = sext i32 %35 to i64
  %37 = call noundef i64 @_Z5powerxx(i64 noundef %34, i64 noundef %36)
  %38 = load i32, ptr %4, align 4, !tbaa !8
  %39 = sext i32 %38 to i64
  %40 = srem i64 %37, %39
  %41 = trunc i64 %40 to i32
  store i32 %41, ptr %7, align 4, !tbaa !8
  %42 = invoke { ptr, i8 } @_ZNSt3setIiSt4lessIiESaIiEE6insertEOi(ptr noundef nonnull align 8 dereferenceable(48) %5, ptr noundef nonnull align 4 dereferenceable(4) %7)
          to label %43 unwind label %51

43:                                               ; preds = %32
  %44 = getelementptr inbounds { ptr, i8 }, ptr %10, i32 0, i32 0
  %45 = extractvalue { ptr, i8 } %42, 0
  store ptr %45, ptr %44, align 8
  %46 = getelementptr inbounds { ptr, i8 }, ptr %10, i32 0, i32 1
  %47 = extractvalue { ptr, i8 } %42, 1
  store i8 %47, ptr %46, align 8
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #6
  br label %48

48:                                               ; preds = %43
  %49 = load i32, ptr %6, align 4, !tbaa !8
  %50 = add nsw i32 %49, 1
  store i32 %50, ptr %6, align 4, !tbaa !8
  br label %27, !llvm.loop !11

51:                                               ; preds = %32
  %52 = landingpad { ptr, i32 }
          cleanup
  %53 = extractvalue { ptr, i32 } %52, 0
  store ptr %53, ptr %8, align 8
  %54 = extractvalue { ptr, i32 } %52, 1
  store i32 %54, ptr %9, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #6
  br label %75

55:                                               ; preds = %31
  %56 = call noundef i64 @_ZNKSt3setIiSt4lessIiESaIiEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(48) %5) #6
  %57 = load i32, ptr %2, align 4, !tbaa !8
  %58 = sext i32 %57 to i64
  %59 = load i32, ptr %4, align 4, !tbaa !8
  %60 = sext i32 %59 to i64
  %61 = invoke noundef i64 @_Z2yoxx(i64 noundef %58, i64 noundef %60)
          to label %62 unwind label %66

62:                                               ; preds = %55
  %63 = icmp eq i64 %56, %61
  br i1 %63, label %64, label %65

64:                                               ; preds = %62
  br label %71

65:                                               ; preds = %62
  call void @__assert_fail(ptr noundef @.str, ptr noundef @.str.1, i32 noundef 52, ptr noundef @__PRETTY_FUNCTION__.main) #7
  unreachable

66:                                               ; preds = %55
  %67 = landingpad { ptr, i32 }
          cleanup
  %68 = extractvalue { ptr, i32 } %67, 0
  store ptr %68, ptr %8, align 8
  %69 = extractvalue { ptr, i32 } %67, 1
  store i32 %69, ptr %9, align 4
  br label %75

70:                                               ; No predecessors!
  br label %71

71:                                               ; preds = %70, %64
  call void @_ZNSt3setIiSt4lessIiESaIiEED2Ev(ptr noundef nonnull align 8 dereferenceable(48) %5) #6
  call void @llvm.lifetime.end.p0(i64 48, ptr %5) #6
  br label %72

72:                                               ; preds = %71
  %73 = load i32, ptr %4, align 4, !tbaa !8
  %74 = add nsw i32 %73, 1
  store i32 %74, ptr %4, align 4, !tbaa !8
  br label %22, !llvm.loop !13

75:                                               ; preds = %66, %51
  call void @_ZNSt3setIiSt4lessIiESaIiEED2Ev(ptr noundef nonnull align 8 dereferenceable(48) %5) #6
  call void @llvm.lifetime.end.p0(i64 48, ptr %5) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #6
  br label %81

76:                                               ; preds = %25
  br label %77

77:                                               ; preds = %76
  %78 = load i32, ptr %2, align 4, !tbaa !8
  %79 = add nsw i32 %78, 1
  store i32 %79, ptr %2, align 4, !tbaa !8
  br label %17, !llvm.loop !14

80:                                               ; preds = %20
  ret i32 0

81:                                               ; preds = %75
  %82 = load ptr, ptr %8, align 8
  %83 = load i32, ptr %9, align 4
  %84 = insertvalue { ptr, i32 } poison, ptr %82, 0
  %85 = insertvalue { ptr, i32 } %84, i32 %83, 1
  resume { ptr, i32 } %85
}

declare noundef zeroext i1 @_ZNSt8ios_base15sync_with_stdioEb(i1 noundef zeroext) #4

; Function Attrs: mustprogress nounwind uwtable
declare noundef ptr @_ZNSt9basic_iosIcSt11char_traitsIcEE3tieEPSo(ptr noundef nonnull align 8 dereferenceable(264), ptr noundef) #0 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt3setIiSt4lessIiESaIiEEC2Ev(ptr noundef nonnull align 8 dereferenceable(48)) unnamed_addr #0 align 2

; Function Attrs: mustprogress uwtable
declare dso_local { ptr, i8 } @_ZNSt3setIiSt4lessIiESaIiEE6insertEOi(ptr noundef nonnull align 8 dereferenceable(48), ptr noundef nonnull align 4 dereferenceable(4)) #2 align 2

declare i32 @__gxx_personality_v0(...)

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i64 @_ZNKSt3setIiSt4lessIiESaIiEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(48)) #0 align 2

; Function Attrs: noreturn nounwind
declare void @__assert_fail(ptr noundef, ptr noundef, i32 noundef, ptr noundef) #5

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt3setIiSt4lessIiESaIiEED2Ev(ptr noundef nonnull align 8 dereferenceable(48)) unnamed_addr #0 align 2

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 = { mustprogress norecurse 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 = { "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 = { noreturn nounwind "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 #6 = { nounwind }
attributes #7 = { noreturn 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 = !{!"vtable pointer", !7, i64 0}
!7 = !{!"Simple C++ TBAA"}
!8 = !{!9, !9, i64 0}
!9 = !{!"int", !10, i64 0}
!10 = !{!"omnipotent char", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = distinct !{!13, !12}
!14 = distinct !{!14, !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"

%"class.std::basic_istream" = type { ptr, i64, %"class.std::basic_ios" }
%"class.std::basic_ios" = type { %"class.std::ios_base", ptr, i8, i8, ptr, ptr, ptr, ptr }
%"class.std::ios_base" = type { ptr, i64, i64, i32, i32, i32, ptr, %"struct.std::ios_base::_Words", [8 x %"struct.std::ios_base::_Words"], i32, ptr, %"class.std::locale" }
%"struct.std::ios_base::_Words" = type { ptr, i64 }
%"class.std::locale" = type { ptr }
%"class.std::set" = type { %"class.std::_Rb_tree" }
%"class.std::_Rb_tree" = type { %"struct.std::_Rb_tree<int, int, std::_Identity<int>, std::less<int>>::_Rb_tree_impl" }
%"struct.std::_Rb_tree<int, int, std::_Identity<int>, std::less<int>>::_Rb_tree_impl" = type { [8 x i8], %"struct.std::_Rb_tree_header" }
%"struct.std::_Rb_tree_header" = type { %"struct.std::_Rb_tree_node_base", i64 }
%"struct.std::_Rb_tree_node_base" = type { i32, ptr, ptr, ptr }

@_ZSt3cin = external global %"class.std::basic_istream", align 8
@.str = external hidden unnamed_addr constant [22 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [119 x i8], align 1
@__PRETTY_FUNCTION__.main = external hidden unnamed_addr constant [15 x i8], align 1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i64 @_Z5powerxx(i64 noundef, i64 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 noundef i64 @_Z2yoxx(i64 noundef, i64 noundef) local_unnamed_addr #2

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #3 personality ptr @__gxx_personality_v0 {
.preheader:
  %0 = alloca %"class.std::set", align 8
  %1 = alloca i32, align 4
  %2 = tail call noundef zeroext i1 @_ZNSt8ios_base15sync_with_stdioEb(i1 noundef zeroext false)
  %3 = load ptr, ptr @_ZSt3cin, align 8, !tbaa !5
  %4 = getelementptr i8, ptr %3, i64 -24
  %5 = load i64, ptr %4, align 8
  %6 = getelementptr inbounds i8, ptr @_ZSt3cin, i64 %5
  %7 = tail call noundef ptr @_ZNSt9basic_iosIcSt11char_traitsIcEE3tieEPSo(ptr noundef nonnull align 8 dereferenceable(264) %6, ptr noundef null)
  br label %69

.preheader.1:                                     ; preds = %81, %19
  %indvars.iv26.1 = phi i64 [ %indvars.iv.next27.1, %19 ], [ 1, %81 ]
  %indvars.iv24.1 = phi i64 [ %indvars.iv.next25.1, %19 ], [ 2, %81 ]
  call void @llvm.lifetime.start.p0(i64 48, ptr nonnull %0) #6
  call void @_ZNSt3setIiSt4lessIiESaIiEEC2Ev(ptr noundef nonnull align 8 dereferenceable(48) %0) #6
  br label %8

8:                                                ; preds = %13, %.preheader.1
  %indvars.iv.1 = phi i64 [ 0, %.preheader.1 ], [ %indvars.iv.next.1, %13 ]
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %1) #6
  %9 = call noundef i64 @_Z5powerxx(i64 noundef %indvars.iv.1, i64 noundef 1)
  %10 = srem i64 %9, %indvars.iv26.1
  %11 = trunc i64 %10 to i32
  store i32 %11, ptr %1, align 4, !tbaa !8
  %12 = invoke { ptr, i8 } @_ZNSt3setIiSt4lessIiESaIiEE6insertEOi(ptr noundef nonnull align 8 dereferenceable(48) %0, ptr noundef nonnull align 4 dereferenceable(4) %1)
          to label %13 unwind label %.loopexit.split-lp.loopexit

13:                                               ; preds = %8
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #6
  %indvars.iv.next.1 = add nuw nsw i64 %indvars.iv.1, 1
  %exitcond.1.not = icmp eq i64 %indvars.iv.next.1, %indvars.iv24.1
  br i1 %exitcond.1.not, label %14, label %8, !llvm.loop !11

14:                                               ; preds = %13
  %15 = call noundef i64 @_ZNKSt3setIiSt4lessIiESaIiEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(48) %0) #6
  %16 = invoke noundef i64 @_Z2yoxx(i64 noundef 1, i64 noundef %indvars.iv26.1)
          to label %17 unwind label %.loopexit.split-lp37.loopexit

17:                                               ; preds = %14
  %18 = icmp eq i64 %15, %16
  br i1 %18, label %19, label %.loopexit41

19:                                               ; preds = %17
  call void @_ZNSt3setIiSt4lessIiESaIiEED2Ev(ptr noundef nonnull align 8 dereferenceable(48) %0) #6
  call void @llvm.lifetime.end.p0(i64 48, ptr nonnull %0) #6
  %indvars.iv.next27.1 = add nuw nsw i64 %indvars.iv26.1, 1
  %indvars.iv.next25.1 = add nuw nsw i64 %indvars.iv24.1, 1
  %exitcond31.1.not = icmp eq i64 %indvars.iv.next27.1, 13
  br i1 %exitcond31.1.not, label %.preheader.2, label %.preheader.1, !llvm.loop !13

.preheader.2:                                     ; preds = %19, %31
  %indvars.iv26.2 = phi i64 [ %indvars.iv.next27.2, %31 ], [ 1, %19 ]
  %indvars.iv24.2 = phi i64 [ %indvars.iv.next25.2, %31 ], [ 2, %19 ]
  call void @llvm.lifetime.start.p0(i64 48, ptr nonnull %0) #6
  call void @_ZNSt3setIiSt4lessIiESaIiEEC2Ev(ptr noundef nonnull align 8 dereferenceable(48) %0) #6
  br label %20

20:                                               ; preds = %25, %.preheader.2
  %indvars.iv.2 = phi i64 [ 0, %.preheader.2 ], [ %indvars.iv.next.2, %25 ]
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %1) #6
  %21 = call noundef i64 @_Z5powerxx(i64 noundef %indvars.iv.2, i64 noundef 2)
  %22 = srem i64 %21, %indvars.iv26.2
  %23 = trunc i64 %22 to i32
  store i32 %23, ptr %1, align 4, !tbaa !8
  %24 = invoke { ptr, i8 } @_ZNSt3setIiSt4lessIiESaIiEE6insertEOi(ptr noundef nonnull align 8 dereferenceable(48) %0, ptr noundef nonnull align 4 dereferenceable(4) %1)
          to label %25 unwind label %.loopexit.split-lp.loopexit.split-lp.loopexit

25:                                               ; preds = %20
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #6
  %indvars.iv.next.2 = add nuw nsw i64 %indvars.iv.2, 1
  %exitcond.2.not = icmp eq i64 %indvars.iv.next.2, %indvars.iv24.2
  br i1 %exitcond.2.not, label %26, label %20, !llvm.loop !11

26:                                               ; preds = %25
  %27 = call noundef i64 @_ZNKSt3setIiSt4lessIiESaIiEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(48) %0) #6
  %28 = invoke noundef i64 @_Z2yoxx(i64 noundef 2, i64 noundef %indvars.iv26.2)
          to label %29 unwind label %.loopexit.split-lp37.loopexit.split-lp.loopexit

29:                                               ; preds = %26
  %30 = icmp eq i64 %27, %28
  br i1 %30, label %31, label %.loopexit41

31:                                               ; preds = %29
  call void @_ZNSt3setIiSt4lessIiESaIiEED2Ev(ptr noundef nonnull align 8 dereferenceable(48) %0) #6
  call void @llvm.lifetime.end.p0(i64 48, ptr nonnull %0) #6
  %indvars.iv.next27.2 = add nuw nsw i64 %indvars.iv26.2, 1
  %indvars.iv.next25.2 = add nuw nsw i64 %indvars.iv24.2, 1
  %exitcond31.2.not = icmp eq i64 %indvars.iv.next27.2, 13
  br i1 %exitcond31.2.not, label %.preheader.3, label %.preheader.2, !llvm.loop !13

.preheader.3:                                     ; preds = %31, %43
  %indvars.iv26.3 = phi i64 [ %indvars.iv.next27.3, %43 ], [ 1, %31 ]
  %indvars.iv24.3 = phi i64 [ %indvars.iv.next25.3, %43 ], [ 2, %31 ]
  call void @llvm.lifetime.start.p0(i64 48, ptr nonnull %0) #6
  call void @_ZNSt3setIiSt4lessIiESaIiEEC2Ev(ptr noundef nonnull align 8 dereferenceable(48) %0) #6
  br label %32

32:                                               ; preds = %37, %.preheader.3
  %indvars.iv.3 = phi i64 [ 0, %.preheader.3 ], [ %indvars.iv.next.3, %37 ]
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %1) #6
  %33 = call noundef i64 @_Z5powerxx(i64 noundef %indvars.iv.3, i64 noundef 3)
  %34 = srem i64 %33, %indvars.iv26.3
  %35 = trunc i64 %34 to i32
  store i32 %35, ptr %1, align 4, !tbaa !8
  %36 = invoke { ptr, i8 } @_ZNSt3setIiSt4lessIiESaIiEE6insertEOi(ptr noundef nonnull align 8 dereferenceable(48) %0, ptr noundef nonnull align 4 dereferenceable(4) %1)
          to label %37 unwind label %.loopexit.split-lp.loopexit.split-lp.loopexit.split-lp.loopexit

37:                                               ; preds = %32
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #6
  %indvars.iv.next.3 = add nuw nsw i64 %indvars.iv.3, 1
  %exitcond.3.not = icmp eq i64 %indvars.iv.next.3, %indvars.iv24.3
  br i1 %exitcond.3.not, label %38, label %32, !llvm.loop !11

38:                                               ; preds = %37
  %39 = call noundef i64 @_ZNKSt3setIiSt4lessIiESaIiEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(48) %0) #6
  %40 = invoke noundef i64 @_Z2yoxx(i64 noundef 3, i64 noundef %indvars.iv26.3)
          to label %41 unwind label %.loopexit.split-lp37.loopexit.split-lp.loopexit.split-lp.loopexit

41:                                               ; preds = %38
  %42 = icmp eq i64 %39, %40
  br i1 %42, label %43, label %.loopexit41

43:                                               ; preds = %41
  call void @_ZNSt3setIiSt4lessIiESaIiEED2Ev(ptr noundef nonnull align 8 dereferenceable(48) %0) #6
  call void @llvm.lifetime.end.p0(i64 48, ptr nonnull %0) #6
  %indvars.iv.next27.3 = add nuw nsw i64 %indvars.iv26.3, 1
  %indvars.iv.next25.3 = add nuw nsw i64 %indvars.iv24.3, 1
  %exitcond31.3.not = icmp eq i64 %indvars.iv.next27.3, 13
  br i1 %exitcond31.3.not, label %.preheader.4, label %.preheader.3, !llvm.loop !13

.preheader.4:                                     ; preds = %43, %55
  %indvars.iv26.4 = phi i64 [ %indvars.iv.next27.4, %55 ], [ 1, %43 ]
  %indvars.iv24.4 = phi i64 [ %indvars.iv.next25.4, %55 ], [ 2, %43 ]
  call void @llvm.lifetime.start.p0(i64 48, ptr nonnull %0) #6
  call void @_ZNSt3setIiSt4lessIiESaIiEEC2Ev(ptr noundef nonnull align 8 dereferenceable(48) %0) #6
  br label %44

44:                                               ; preds = %49, %.preheader.4
  %indvars.iv.4 = phi i64 [ 0, %.preheader.4 ], [ %indvars.iv.next.4, %49 ]
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %1) #6
  %45 = call noundef i64 @_Z5powerxx(i64 noundef %indvars.iv.4, i64 noundef 4)
  %46 = srem i64 %45, %indvars.iv26.4
  %47 = trunc i64 %46 to i32
  store i32 %47, ptr %1, align 4, !tbaa !8
  %48 = invoke { ptr, i8 } @_ZNSt3setIiSt4lessIiESaIiEE6insertEOi(ptr noundef nonnull align 8 dereferenceable(48) %0, ptr noundef nonnull align 4 dereferenceable(4) %1)
          to label %49 unwind label %.loopexit.split-lp.loopexit.split-lp.loopexit.split-lp.loopexit.split-lp.loopexit

49:                                               ; preds = %44
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #6
  %indvars.iv.next.4 = add nuw nsw i64 %indvars.iv.4, 1
  %exitcond.4.not = icmp eq i64 %indvars.iv.next.4, %indvars.iv24.4
  br i1 %exitcond.4.not, label %50, label %44, !llvm.loop !11

50:                                               ; preds = %49
  %51 = call noundef i64 @_ZNKSt3setIiSt4lessIiESaIiEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(48) %0) #6
  %52 = invoke noundef i64 @_Z2yoxx(i64 noundef 4, i64 noundef %indvars.iv26.4)
          to label %53 unwind label %.loopexit.split-lp37.loopexit.split-lp.loopexit.split-lp.loopexit.split-lp.loopexit

53:                                               ; preds = %50
  %54 = icmp eq i64 %51, %52
  br i1 %54, label %55, label %.loopexit41

55:                                               ; preds = %53
  call void @_ZNSt3setIiSt4lessIiESaIiEED2Ev(ptr noundef nonnull align 8 dereferenceable(48) %0) #6
  call void @llvm.lifetime.end.p0(i64 48, ptr nonnull %0) #6
  %indvars.iv.next27.4 = add nuw nsw i64 %indvars.iv26.4, 1
  %indvars.iv.next25.4 = add nuw nsw i64 %indvars.iv24.4, 1
  %exitcond31.4.not = icmp eq i64 %indvars.iv.next27.4, 13
  br i1 %exitcond31.4.not, label %.preheader.5, label %.preheader.4, !llvm.loop !13

.preheader.5:                                     ; preds = %55, %67
  %indvars.iv26.5 = phi i64 [ %indvars.iv.next27.5, %67 ], [ 1, %55 ]
  %indvars.iv24.5 = phi i64 [ %indvars.iv.next25.5, %67 ], [ 2, %55 ]
  call void @llvm.lifetime.start.p0(i64 48, ptr nonnull %0) #6
  call void @_ZNSt3setIiSt4lessIiESaIiEEC2Ev(ptr noundef nonnull align 8 dereferenceable(48) %0) #6
  br label %56

56:                                               ; preds = %61, %.preheader.5
  %indvars.iv.5 = phi i64 [ 0, %.preheader.5 ], [ %indvars.iv.next.5, %61 ]
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %1) #6
  %57 = call noundef i64 @_Z5powerxx(i64 noundef %indvars.iv.5, i64 noundef 5)
  %58 = srem i64 %57, %indvars.iv26.5
  %59 = trunc i64 %58 to i32
  store i32 %59, ptr %1, align 4, !tbaa !8
  %60 = invoke { ptr, i8 } @_ZNSt3setIiSt4lessIiESaIiEE6insertEOi(ptr noundef nonnull align 8 dereferenceable(48) %0, ptr noundef nonnull align 4 dereferenceable(4) %1)
          to label %61 unwind label %.loopexit.split-lp.loopexit.split-lp.loopexit.split-lp.loopexit.split-lp.loopexit.split-lp

61:                                               ; preds = %56
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #6
  %indvars.iv.next.5 = add nuw nsw i64 %indvars.iv.5, 1
  %exitcond.5.not = icmp eq i64 %indvars.iv.next.5, %indvars.iv24.5
  br i1 %exitcond.5.not, label %62, label %56, !llvm.loop !11

62:                                               ; preds = %61
  %63 = call noundef i64 @_ZNKSt3setIiSt4lessIiESaIiEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(48) %0) #6
  %64 = invoke noundef i64 @_Z2yoxx(i64 noundef 5, i64 noundef %indvars.iv26.5)
          to label %65 unwind label %.loopexit.split-lp37.loopexit.split-lp.loopexit.split-lp.loopexit.split-lp.loopexit.split-lp

65:                                               ; preds = %62
  %66 = icmp eq i64 %63, %64
  br i1 %66, label %67, label %.loopexit41

67:                                               ; preds = %65
  call void @_ZNSt3setIiSt4lessIiESaIiEED2Ev(ptr noundef nonnull align 8 dereferenceable(48) %0) #6
  call void @llvm.lifetime.end.p0(i64 48, ptr nonnull %0) #6
  %indvars.iv.next27.5 = add nuw nsw i64 %indvars.iv26.5, 1
  %indvars.iv.next25.5 = add nuw nsw i64 %indvars.iv24.5, 1
  %exitcond31.5.not = icmp eq i64 %indvars.iv.next27.5, 13
  br i1 %exitcond31.5.not, label %68, label %.preheader.5, !llvm.loop !13

68:                                               ; preds = %67
  ret i32 0

69:                                               ; preds = %.preheader, %81
  %indvars.iv26 = phi i64 [ 1, %.preheader ], [ %indvars.iv.next27, %81 ]
  %indvars.iv24 = phi i64 [ 2, %.preheader ], [ %indvars.iv.next25, %81 ]
  call void @llvm.lifetime.start.p0(i64 48, ptr nonnull %0) #6
  call void @_ZNSt3setIiSt4lessIiESaIiEEC2Ev(ptr noundef nonnull align 8 dereferenceable(48) %0) #6
  br label %73

70:                                               ; preds = %78
  %71 = call noundef i64 @_ZNKSt3setIiSt4lessIiESaIiEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(48) %0) #6
  %72 = invoke noundef i64 @_Z2yoxx(i64 noundef 0, i64 noundef %indvars.iv26)
          to label %79 unwind label %.loopexit36

73:                                               ; preds = %69, %78
  %indvars.iv = phi i64 [ 0, %69 ], [ %indvars.iv.next, %78 ]
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %1) #6
  %74 = call noundef i64 @_Z5powerxx(i64 noundef %indvars.iv, i64 noundef 0)
  %75 = srem i64 %74, %indvars.iv26
  %76 = trunc i64 %75 to i32
  store i32 %76, ptr %1, align 4, !tbaa !8
  %77 = invoke { ptr, i8 } @_ZNSt3setIiSt4lessIiESaIiEE6insertEOi(ptr noundef nonnull align 8 dereferenceable(48) %0, ptr noundef nonnull align 4 dereferenceable(4) %1)
          to label %78 unwind label %.loopexit

78:                                               ; preds = %73
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #6
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next, %indvars.iv24
  br i1 %exitcond.not, label %70, label %73, !llvm.loop !11

.loopexit:                                        ; preds = %73
  %lpad.loopexit = landingpad { ptr, i32 }
          cleanup
  br label %.loopexit.split-lp

.loopexit.split-lp.loopexit:                      ; preds = %8
  %lpad.loopexit42 = landingpad { ptr, i32 }
          cleanup
  br label %.loopexit.split-lp

.loopexit.split-lp.loopexit.split-lp.loopexit:    ; preds = %20
  %lpad.loopexit48 = landingpad { ptr, i32 }
          cleanup
  br label %.loopexit.split-lp

.loopexit.split-lp.loopexit.split-lp.loopexit.split-lp.loopexit: ; preds = %32
  %lpad.loopexit55 = landingpad { ptr, i32 }
          cleanup
  br label %.loopexit.split-lp

.loopexit.split-lp.loopexit.split-lp.loopexit.split-lp.loopexit.split-lp.loopexit: ; preds = %44
  %lpad.loopexit61 = landingpad { ptr, i32 }
          cleanup
  br label %.loopexit.split-lp

.loopexit.split-lp.loopexit.split-lp.loopexit.split-lp.loopexit.split-lp.loopexit.split-lp: ; preds = %56
  %lpad.loopexit.split-lp62 = landingpad { ptr, i32 }
          cleanup
  br label %.loopexit.split-lp

.loopexit.split-lp:                               ; preds = %.loopexit.split-lp.loopexit, %.loopexit.split-lp.loopexit.split-lp.loopexit.split-lp.loopexit, %.loopexit.split-lp.loopexit.split-lp.loopexit.split-lp.loopexit.split-lp.loopexit.split-lp, %.loopexit.split-lp.loopexit.split-lp.loopexit.split-lp.loopexit.split-lp.loopexit, %.loopexit.split-lp.loopexit.split-lp.loopexit, %.loopexit
  %lpad.phi = phi { ptr, i32 } [ %lpad.loopexit, %.loopexit ], [ %lpad.loopexit42, %.loopexit.split-lp.loopexit ], [ %lpad.loopexit48, %.loopexit.split-lp.loopexit.split-lp.loopexit ], [ %lpad.loopexit55, %.loopexit.split-lp.loopexit.split-lp.loopexit.split-lp.loopexit ], [ %lpad.loopexit61, %.loopexit.split-lp.loopexit.split-lp.loopexit.split-lp.loopexit.split-lp.loopexit ], [ %lpad.loopexit.split-lp62, %.loopexit.split-lp.loopexit.split-lp.loopexit.split-lp.loopexit.split-lp.loopexit.split-lp ]
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #6
  br label %.loopexit.split-lp37

79:                                               ; preds = %70
  %80 = icmp eq i64 %71, %72
  br i1 %80, label %81, label %.loopexit41

.loopexit41:                                      ; preds = %79, %17, %29, %41, %53, %65
  call void @__assert_fail(ptr noundef nonnull @.str, ptr noundef nonnull @.str.1, i32 noundef 52, ptr noundef nonnull @__PRETTY_FUNCTION__.main) #7
  unreachable

.loopexit36:                                      ; preds = %70
  %lpad.loopexit38 = landingpad { ptr, i32 }
          cleanup
  br label %.loopexit.split-lp37

.loopexit.split-lp37.loopexit:                    ; preds = %14
  %lpad.loopexit45 = landingpad { ptr, i32 }
          cleanup
  br label %.loopexit.split-lp37

.loopexit.split-lp37.loopexit.split-lp.loopexit:  ; preds = %26
  %lpad.loopexit51 = landingpad { ptr, i32 }
          cleanup
  br label %.loopexit.split-lp37

.loopexit.split-lp37.loopexit.split-lp.loopexit.split-lp.loopexit: ; preds = %38
  %lpad.loopexit57 = landingpad { ptr, i32 }
          cleanup
  br label %.loopexit.split-lp37

.loopexit.split-lp37.loopexit.split-lp.loopexit.split-lp.loopexit.split-lp.loopexit: ; preds = %50
  %lpad.loopexit64 = landingpad { ptr, i32 }
          cleanup
  br label %.loopexit.split-lp37

.loopexit.split-lp37.loopexit.split-lp.loopexit.split-lp.loopexit.split-lp.loopexit.split-lp: ; preds = %62
  %lpad.loopexit.split-lp = landingpad { ptr, i32 }
          cleanup
  br label %.loopexit.split-lp37

81:                                               ; preds = %79
  call void @_ZNSt3setIiSt4lessIiESaIiEED2Ev(ptr noundef nonnull align 8 dereferenceable(48) %0) #6
  call void @llvm.lifetime.end.p0(i64 48, ptr nonnull %0) #6
  %indvars.iv.next27 = add nuw nsw i64 %indvars.iv26, 1
  %indvars.iv.next25 = add nuw nsw i64 %indvars.iv24, 1
  %exitcond31.not = icmp eq i64 %indvars.iv.next27, 13
  br i1 %exitcond31.not, label %.preheader.1, label %69, !llvm.loop !13

.loopexit.split-lp37:                             ; preds = %.loopexit36, %.loopexit.split-lp37.loopexit.split-lp.loopexit, %.loopexit.split-lp37.loopexit.split-lp.loopexit.split-lp.loopexit.split-lp.loopexit, %.loopexit.split-lp37.loopexit.split-lp.loopexit.split-lp.loopexit.split-lp.loopexit.split-lp, %.loopexit.split-lp37.loopexit.split-lp.loopexit.split-lp.loopexit, %.loopexit.split-lp37.loopexit, %.loopexit.split-lp
  %.pn = phi { ptr, i32 } [ %lpad.phi, %.loopexit.split-lp ], [ %lpad.loopexit38, %.loopexit36 ], [ %lpad.loopexit45, %.loopexit.split-lp37.loopexit ], [ %lpad.loopexit51, %.loopexit.split-lp37.loopexit.split-lp.loopexit ], [ %lpad.loopexit57, %.loopexit.split-lp37.loopexit.split-lp.loopexit.split-lp.loopexit ], [ %lpad.loopexit64, %.loopexit.split-lp37.loopexit.split-lp.loopexit.split-lp.loopexit.split-lp.loopexit ], [ %lpad.loopexit.split-lp, %.loopexit.split-lp37.loopexit.split-lp.loopexit.split-lp.loopexit.split-lp.loopexit.split-lp ]
  call void @_ZNSt3setIiSt4lessIiESaIiEED2Ev(ptr noundef nonnull align 8 dereferenceable(48) %0) #6
  call void @llvm.lifetime.end.p0(i64 48, ptr nonnull %0) #6
  resume { ptr, i32 } %.pn
}

declare noundef zeroext i1 @_ZNSt8ios_base15sync_with_stdioEb(i1 noundef zeroext) local_unnamed_addr #4

; Function Attrs: mustprogress nounwind uwtable
declare noundef ptr @_ZNSt9basic_iosIcSt11char_traitsIcEE3tieEPSo(ptr noundef nonnull align 8 dereferenceable(264), ptr noundef) local_unnamed_addr #0 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt3setIiSt4lessIiESaIiEEC2Ev(ptr noundef nonnull align 8 dereferenceable(48)) unnamed_addr #0 align 2

; Function Attrs: mustprogress uwtable
declare dso_local { ptr, i8 } @_ZNSt3setIiSt4lessIiESaIiEE6insertEOi(ptr noundef nonnull align 8 dereferenceable(48), ptr noundef nonnull align 4 dereferenceable(4)) local_unnamed_addr #2 align 2

declare i32 @__gxx_personality_v0(...)

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i64 @_ZNKSt3setIiSt4lessIiESaIiEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(48)) local_unnamed_addr #0 align 2

; Function Attrs: noreturn nounwind
declare void @__assert_fail(ptr noundef, ptr noundef, i32 noundef, ptr noundef) local_unnamed_addr #5

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt3setIiSt4lessIiESaIiEED2Ev(ptr noundef nonnull align 8 dereferenceable(48)) unnamed_addr #0 align 2

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 = { mustprogress norecurse 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 = { "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 = { noreturn nounwind "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 #6 = { nounwind }
attributes #7 = { noreturn 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 = !{!"vtable pointer", !7, i64 0}
!7 = !{!"Simple C++ TBAA"}
!8 = !{!9, !9, i64 0}
!9 = !{!"int", !10, i64 0}
!10 = !{!"omnipotent char", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = distinct !{!13, !12}


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