; LLVM IR from ShahjalalShohag/code-library :: Number Theory/Multiplicative Order.ll (Z20multiplicative_orderxx)

; 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::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<long long, std::allocator<long long>>::_Vector_impl" }
%"struct.std::_Vector_base<long long, std::allocator<long long>>::_Vector_impl" = type { %"struct.std::_Vector_base<long long, std::allocator<long long>>::_Vector_impl_data" }
%"struct.std::_Vector_base<long long, std::allocator<long long>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.__gnu_cxx::__normal_iterator" = type { ptr }

@.str = external hidden unnamed_addr constant [12 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [101 x i8], align 1
@__PRETTY_FUNCTION__._Z20multiplicative_orderxx = external hidden unnamed_addr constant [32 x i8], align 1

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

; Function Attrs: mustprogress uwtable
define dso_local noundef i64 @_Z20multiplicative_orderxx(i64 noundef %0, i64 noundef %1) #2 personality ptr @__gxx_personality_v0 {
  %3 = alloca i64, align 8
  %4 = alloca i64, align 8
  %5 = alloca i64, align 8
  %6 = alloca i64, align 8
  %7 = alloca i64, align 8
  %8 = alloca i64, align 8
  %9 = alloca %"class.std::vector", align 8
  %10 = alloca i64, align 8
  %11 = alloca ptr, align 8
  %12 = alloca i32, align 4
  %13 = alloca ptr, align 8
  %14 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %15 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %16 = alloca i64, align 8
  store i64 %0, ptr %4, align 8, !tbaa !5
  store i64 %1, ptr %5, align 8, !tbaa !5
  %17 = load i64, ptr %4, align 8, !tbaa !5
  %18 = load i64, ptr %5, align 8, !tbaa !5
  %19 = call noundef i64 @_ZSt5__gcdIxET_S0_S0_(i64 noundef %17, i64 noundef %18)
  %20 = icmp ne i64 %19, 1
  br i1 %20, label %21, label %22

21:                                               ; preds = %2
  store i64 -1, ptr %3, align 8
  br label %113

22:                                               ; preds = %2
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #5
  %23 = load i64, ptr %5, align 8, !tbaa !5
  %24 = call noundef i64 @_Z7totientx(i64 noundef %23)
  store i64 %24, ptr %6, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #5
  %25 = load i64, ptr %6, align 8, !tbaa !5
  store i64 %25, ptr %7, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #5
  store i64 2000000000000000000, ptr %8, align 8, !tbaa !5
  %26 = load i64, ptr %4, align 8, !tbaa !5
  %27 = load i64, ptr %7, align 8, !tbaa !5
  %28 = load i64, ptr %5, align 8, !tbaa !5
  %29 = call noundef i64 @_Z5powerxxx(i64 noundef %26, i64 noundef %27, i64 noundef %28)
  %30 = icmp eq i64 %29, 1
  br i1 %30, label %31, label %33

31:                                               ; preds = %22
  %32 = load i64, ptr %7, align 8, !tbaa !5
  store i64 %32, ptr %8, align 8, !tbaa !5
  br label %33

33:                                               ; preds = %31, %22
  call void @llvm.lifetime.start.p0(i64 24, ptr %9) #5
  call void @_ZNSt6vectorIxSaIxEEC2Ev(ptr noundef nonnull align 8 dereferenceable(24) %9) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #5
  store i64 2, ptr %10, align 8, !tbaa !5
  br label %34

34:                                               ; preds = %63, %33
  %35 = load i64, ptr %10, align 8, !tbaa !5
  %36 = load i64, ptr %10, align 8, !tbaa !5
  %37 = mul nsw i64 %35, %36
  %38 = load i64, ptr %6, align 8, !tbaa !5
  %39 = icmp sle i64 %37, %38
  br i1 %39, label %41, label %40

40:                                               ; preds = %34
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #5
  br label %66

41:                                               ; preds = %34
  %42 = load i64, ptr %6, align 8, !tbaa !5
  %43 = load i64, ptr %10, align 8, !tbaa !5
  %44 = srem i64 %42, %43
  %45 = icmp eq i64 %44, 0
  br i1 %45, label %46, label %62

46:                                               ; preds = %41
  br label %47

47:                                               ; preds = %56, %46
  %48 = load i64, ptr %6, align 8, !tbaa !5
  %49 = load i64, ptr %10, align 8, !tbaa !5
  %50 = srem i64 %48, %49
  %51 = icmp eq i64 %50, 0
  br i1 %51, label %52, label %61

52:                                               ; preds = %47
  %53 = load i64, ptr %10, align 8, !tbaa !5
  %54 = load i64, ptr %6, align 8, !tbaa !5
  %55 = sdiv i64 %54, %53
  store i64 %55, ptr %6, align 8, !tbaa !5
  invoke void @_ZNSt6vectorIxSaIxEE9push_backERKx(ptr noundef nonnull align 8 dereferenceable(24) %9, ptr noundef nonnull align 8 dereferenceable(8) %10)
          to label %56 unwind label %57

56:                                               ; preds = %52
  br label %47, !llvm.loop !9

57:                                               ; preds = %52
  %58 = landingpad { ptr, i32 }
          cleanup
  %59 = extractvalue { ptr, i32 } %58, 0
  store ptr %59, ptr %11, align 8
  %60 = extractvalue { ptr, i32 } %58, 1
  store i32 %60, ptr %12, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #5
  br label %112

61:                                               ; preds = %47
  br label %62

62:                                               ; preds = %61, %41
  br label %63

63:                                               ; preds = %62
  %64 = load i64, ptr %10, align 8, !tbaa !5
  %65 = add nsw i64 %64, 1
  store i64 %65, ptr %10, align 8, !tbaa !5
  br label %34, !llvm.loop !11

66:                                               ; preds = %40
  %67 = load i64, ptr %6, align 8, !tbaa !5
  %68 = icmp sgt i64 %67, 1
  br i1 %68, label %69, label %75

69:                                               ; preds = %66
  invoke void @_ZNSt6vectorIxSaIxEE9push_backERKx(ptr noundef nonnull align 8 dereferenceable(24) %9, ptr noundef nonnull align 8 dereferenceable(8) %6)
          to label %70 unwind label %71

70:                                               ; preds = %69
  br label %75

71:                                               ; preds = %69
  %72 = landingpad { ptr, i32 }
          cleanup
  %73 = extractvalue { ptr, i32 } %72, 0
  store ptr %73, ptr %11, align 8
  %74 = extractvalue { ptr, i32 } %72, 1
  store i32 %74, ptr %12, align 4
  br label %112

75:                                               ; preds = %70, %66
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #5
  store ptr %9, ptr %13, align 8, !tbaa !12
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #5
  %76 = load ptr, ptr %13, align 8, !tbaa !12
  %77 = call ptr @_ZNSt6vectorIxSaIxEE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) %76) #5
  %78 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %14, i32 0, i32 0
  store ptr %77, ptr %78, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #5
  %79 = load ptr, ptr %13, align 8, !tbaa !12
  %80 = call ptr @_ZNSt6vectorIxSaIxEE3endEv(ptr noundef nonnull align 8 dereferenceable(24) %79) #5
  %81 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %15, i32 0, i32 0
  store ptr %80, ptr %81, align 8
  br label %82

82:                                               ; preds = %101, %75
  %83 = call noundef zeroext i1 @_ZN9__gnu_cxxneIPxSt6vectorIxSaIxEEEEbRKNS_17__normal_iteratorIT_T0_EESA_(ptr noundef nonnull align 8 dereferenceable(8) %14, ptr noundef nonnull align 8 dereferenceable(8) %15) #5
  br i1 %83, label %85, label %84

84:                                               ; preds = %82
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #5
  br label %103

85:                                               ; preds = %82
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #5
  %86 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNK9__gnu_cxx17__normal_iteratorIPxSt6vectorIxSaIxEEEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %14) #5
  %87 = load i64, ptr %86, align 8, !tbaa !5
  store i64 %87, ptr %16, align 8, !tbaa !5
  %88 = load i64, ptr %4, align 8, !tbaa !5
  %89 = load i64, ptr %7, align 8, !tbaa !5
  %90 = load i64, ptr %16, align 8, !tbaa !5
  %91 = sdiv i64 %89, %90
  %92 = load i64, ptr %5, align 8, !tbaa !5
  %93 = call noundef i64 @_Z5powerxxx(i64 noundef %88, i64 noundef %91, i64 noundef %92)
  %94 = icmp eq i64 %93, 1
  br i1 %94, label %95, label %100

95:                                               ; preds = %85
  %96 = load i64, ptr %16, align 8, !tbaa !5
  %97 = load i64, ptr %7, align 8, !tbaa !5
  %98 = sdiv i64 %97, %96
  store i64 %98, ptr %7, align 8, !tbaa !5
  %99 = load i64, ptr %7, align 8, !tbaa !5
  store i64 %99, ptr %8, align 8, !tbaa !5
  br label %100

100:                                              ; preds = %95, %85
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #5
  br label %101

101:                                              ; preds = %100
  %102 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN9__gnu_cxx17__normal_iteratorIPxSt6vectorIxSaIxEEEppEv(ptr noundef nonnull align 8 dereferenceable(8) %14) #5
  br label %82

103:                                              ; preds = %84
  %104 = load i64, ptr %8, align 8, !tbaa !5
  %105 = sitofp i64 %104 to double
  %106 = fcmp une double %105, 2.000000e+18
  br i1 %106, label %107, label %108

107:                                              ; preds = %103
  br label %110

108:                                              ; preds = %103
  call void @__assert_fail(ptr noundef @.str, ptr noundef @.str.1, i32 noundef 46, ptr noundef @__PRETTY_FUNCTION__._Z20multiplicative_orderxx) #6
  unreachable

109:                                              ; No predecessors!
  br label %110

110:                                              ; preds = %109, %107
  %111 = load i64, ptr %8, align 8, !tbaa !5
  store i64 %111, ptr %3, align 8
  call void @_ZNSt6vectorIxSaIxEED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %9) #5
  call void @llvm.lifetime.end.p0(i64 24, ptr %9) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #5
  br label %113

112:                                              ; preds = %71, %57
  call void @_ZNSt6vectorIxSaIxEED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %9) #5
  call void @llvm.lifetime.end.p0(i64 24, ptr %9) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #5
  br label %115

113:                                              ; preds = %110, %21
  %114 = load i64, ptr %3, align 8
  ret i64 %114

115:                                              ; preds = %112
  %116 = load ptr, ptr %11, align 8
  %117 = load i32, ptr %12, align 4
  %118 = insertvalue { ptr, i32 } poison, ptr %116, 0
  %119 = insertvalue { ptr, i32 } %118, i32 %117, 1
  resume { ptr, i32 } %119
}

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

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt6vectorIxSaIxEE9push_backERKx(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 8 dereferenceable(8)) #2 align 2

declare i32 @__gxx_personality_v0(...)

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

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

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

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

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt6vectorIxSaIxEED2Ev(ptr noundef nonnull align 8 dereferenceable(24)) 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 = { 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 = { 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 #5 = { nounwind }
attributes #6 = { 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 = !{!"long 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 = !{!13, !13, i64 0}
!13 = !{!"any pointer", !7, i64 0}


; 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::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<long long, std::allocator<long long>>::_Vector_impl" }
%"struct.std::_Vector_base<long long, std::allocator<long long>>::_Vector_impl" = type { %"struct.std::_Vector_base<long long, std::allocator<long long>>::_Vector_impl_data" }
%"struct.std::_Vector_base<long long, std::allocator<long long>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.__gnu_cxx::__normal_iterator" = type { ptr }

@.str = external hidden unnamed_addr constant [12 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [101 x i8], align 1
@__PRETTY_FUNCTION__._Z20multiplicative_orderxx = external hidden unnamed_addr constant [32 x i8], align 1

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

; Function Attrs: mustprogress uwtable
define dso_local noundef i64 @_Z20multiplicative_orderxx(i64 noundef %0, i64 noundef %1) local_unnamed_addr #2 personality ptr @__gxx_personality_v0 {
  %3 = alloca i64, align 8
  %4 = alloca %"class.std::vector", align 8
  %5 = alloca i64, align 8
  %6 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %7 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %8 = tail call noundef i64 @_ZSt5__gcdIxET_S0_S0_(i64 noundef %0, i64 noundef %1)
  %.not = icmp eq i64 %8, 1
  br i1 %.not, label %9, label %48

9:                                                ; preds = %2
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %3) #5
  %10 = tail call noundef i64 @_Z7totientx(i64 noundef %1)
  store i64 %10, ptr %3, align 8, !tbaa !5
  %11 = tail call noundef i64 @_Z5powerxxx(i64 noundef %0, i64 noundef %10, i64 noundef %1)
  %12 = icmp eq i64 %11, 1
  %spec.select = select i1 %12, i64 %10, i64 2000000000000000000
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %4) #5
  call void @_ZNSt6vectorIxSaIxEEC2Ev(ptr noundef nonnull align 8 dereferenceable(24) %4) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %5) #5
  store i64 2, ptr %5, align 8, !tbaa !5
  %.not2631 = icmp slt i64 %10, 4
  br i1 %.not2631, label %._crit_edge, label %.lr.ph

._crit_edge:                                      ; preds = %.loopexit, %9
  %.lcssa = phi i64 [ %10, %9 ], [ %25, %.loopexit ]
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %5) #5
  %13 = icmp sgt i64 %.lcssa, 1
  br i1 %13, label %29, label %32

.lr.ph:                                           ; preds = %9, %.loopexit
  %14 = phi i64 [ %25, %.loopexit ], [ %10, %9 ]
  %storemerge32 = phi i64 [ %27, %.loopexit ], [ 2, %9 ]
  %15 = srem i64 %14, %storemerge32
  %16 = icmp eq i64 %15, 0
  br i1 %16, label %.preheader, label %.loopexit

.preheader:                                       ; preds = %.lr.ph, %22
  %17 = phi i64 [ %20, %22 ], [ %14, %.lr.ph ]
  %18 = load i64, ptr %5, align 8, !tbaa !5
  %19 = srem i64 %17, %18
  %20 = sdiv i64 %17, %18
  %21 = icmp eq i64 %19, 0
  br i1 %21, label %22, label %.loopexit

22:                                               ; preds = %.preheader
  store i64 %20, ptr %3, align 8, !tbaa !5
  invoke void @_ZNSt6vectorIxSaIxEE9push_backERKx(ptr noundef nonnull align 8 dereferenceable(24) %4, ptr noundef nonnull align 8 dereferenceable(8) %5)
          to label %.preheader unwind label %23, !llvm.loop !9

23:                                               ; preds = %22
  %24 = landingpad { ptr, i32 }
          cleanup
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %5) #5
  br label %47

.loopexit:                                        ; preds = %.preheader, %.lr.ph
  %25 = phi i64 [ %14, %.lr.ph ], [ %17, %.preheader ]
  %26 = phi i64 [ %storemerge32, %.lr.ph ], [ %18, %.preheader ]
  %27 = add nsw i64 %26, 1
  store i64 %27, ptr %5, align 8, !tbaa !5
  %28 = mul nsw i64 %27, %27
  %.not26 = icmp sgt i64 %28, %25
  br i1 %.not26, label %._crit_edge, label %.lr.ph, !llvm.loop !11

29:                                               ; preds = %._crit_edge
  invoke void @_ZNSt6vectorIxSaIxEE9push_backERKx(ptr noundef nonnull align 8 dereferenceable(24) %4, ptr noundef nonnull align 8 dereferenceable(8) %3)
          to label %32 unwind label %30

30:                                               ; preds = %29
  %31 = landingpad { ptr, i32 }
          cleanup
  br label %47

32:                                               ; preds = %29, %._crit_edge
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %6) #5
  %33 = call ptr @_ZNSt6vectorIxSaIxEE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) %4) #5
  store ptr %33, ptr %6, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %7) #5
  %34 = call ptr @_ZNSt6vectorIxSaIxEE3endEv(ptr noundef nonnull align 8 dereferenceable(24) %4) #5
  store ptr %34, ptr %7, align 8
  %35 = call noundef zeroext i1 @_ZN9__gnu_cxxneIPxSt6vectorIxSaIxEEEEbRKNS_17__normal_iteratorIT_T0_EESA_(ptr noundef nonnull align 8 dereferenceable(8) %6, ptr noundef nonnull align 8 dereferenceable(8) %7) #5
  br i1 %35, label %.lr.ph36, label %._crit_edge37

._crit_edge37:                                    ; preds = %.lr.ph36, %32
  %.124.lcssa = phi i64 [ %spec.select, %32 ], [ %spec.select28, %.lr.ph36 ]
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %7) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %6) #5
  %36 = sitofp i64 %.124.lcssa to double
  %37 = fcmp une double %36, 2.000000e+18
  br i1 %37, label %46, label %45

.lr.ph36:                                         ; preds = %32, %.lr.ph36
  %.02034 = phi i64 [ %spec.select29, %.lr.ph36 ], [ %10, %32 ]
  %.12433 = phi i64 [ %spec.select28, %.lr.ph36 ], [ %spec.select, %32 ]
  %38 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNK9__gnu_cxx17__normal_iteratorIPxSt6vectorIxSaIxEEEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %6) #5
  %39 = load i64, ptr %38, align 8, !tbaa !5
  %40 = sdiv i64 %.02034, %39
  %41 = call noundef i64 @_Z5powerxxx(i64 noundef %0, i64 noundef %40, i64 noundef %1)
  %42 = icmp eq i64 %41, 1
  %spec.select28 = select i1 %42, i64 %40, i64 %.12433
  %spec.select29 = select i1 %42, i64 %40, i64 %.02034
  %43 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN9__gnu_cxx17__normal_iteratorIPxSt6vectorIxSaIxEEEppEv(ptr noundef nonnull align 8 dereferenceable(8) %6) #5
  %44 = call noundef zeroext i1 @_ZN9__gnu_cxxneIPxSt6vectorIxSaIxEEEEbRKNS_17__normal_iteratorIT_T0_EESA_(ptr noundef nonnull align 8 dereferenceable(8) %6, ptr noundef nonnull align 8 dereferenceable(8) %7) #5
  br i1 %44, label %.lr.ph36, label %._crit_edge37

45:                                               ; preds = %._crit_edge37
  call void @__assert_fail(ptr noundef nonnull @.str, ptr noundef nonnull @.str.1, i32 noundef 46, ptr noundef nonnull @__PRETTY_FUNCTION__._Z20multiplicative_orderxx) #6
  unreachable

46:                                               ; preds = %._crit_edge37
  call void @_ZNSt6vectorIxSaIxEED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %4) #5
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %4) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %3) #5
  br label %48

47:                                               ; preds = %30, %23
  %.pn = phi { ptr, i32 } [ %24, %23 ], [ %31, %30 ]
  call void @_ZNSt6vectorIxSaIxEED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %4) #5
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %4) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %3) #5
  resume { ptr, i32 } %.pn

48:                                               ; preds = %2, %46
  %.0 = phi i64 [ %.124.lcssa, %46 ], [ -1, %2 ]
  ret i64 %.0
}

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

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt6vectorIxSaIxEE9push_backERKx(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 8 dereferenceable(8)) local_unnamed_addr #2 align 2

declare i32 @__gxx_personality_v0(...)

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

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

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(8) ptr @_ZN9__gnu_cxx17__normal_iteratorIPxSt6vectorIxSaIxEEEppEv(ptr noundef nonnull align 8 dereferenceable(8)) 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 #4

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt6vectorIxSaIxEED2Ev(ptr noundef nonnull align 8 dereferenceable(24)) 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 = { 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 = { 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 #5 = { nounwind }
attributes #6 = { 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 = !{!"long 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}


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