; LLVM IR from tangjz/acm-icpc :: 51nod/1151.ll (Z8mod_factx)

; 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 }
%"struct.std::pair.0" = type { i32, i32 }

@p = external dso_local global i32, align 4
@sz = external dso_local global i32, align 4
@pp = external dso_local global i64, align 8
@s = external dso_local global [5 x [19 x i64]], align 16
@f = external dso_local global [19 x i64], align 16
@g = external dso_local global [3 x [19 x i64]], align 16
@_ZZ8mod_factxE3len = external hidden global i32, align 4
@_ZZ8mod_factxE3dig = external hidden global [61 x i32], align 16

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z8poly_mulPxS_S_(ptr noundef, ptr noundef, ptr noundef) #0

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #1

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef i64 @_Z7mod_mulxxx(i64 noundef, i64 noundef, i64 noundef) #3

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z8poly_valPxxS_S_(ptr noundef, i64 noundef, ptr noundef, ptr noundef) #0

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

14:                                               ; preds = %19, %1
  %15 = load i64, ptr %4, align 8, !tbaa !5
  %16 = icmp sgt i64 %15, 0
  br i1 %16, label %18, label %17

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

18:                                               ; preds = %14
  br label %19

19:                                               ; preds = %18
  %20 = load i64, ptr %4, align 8, !tbaa !5
  %21 = load i32, ptr @p, align 4, !tbaa !9
  %22 = sext i32 %21 to i64
  %23 = srem i64 %20, %22
  %24 = trunc i64 %23 to i32
  %25 = load i32, ptr @_ZZ8mod_factxE3len, align 4, !tbaa !9
  %26 = add nsw i32 %25, 1
  store i32 %26, ptr @_ZZ8mod_factxE3len, align 4, !tbaa !9
  %27 = sext i32 %25 to i64
  %28 = getelementptr inbounds [61 x i32], ptr @_ZZ8mod_factxE3dig, i64 0, i64 %27
  store i32 %24, ptr %28, align 4, !tbaa !9
  %29 = load i32, ptr @p, align 4, !tbaa !9
  %30 = sext i32 %29 to i64
  %31 = load i64, ptr %4, align 8, !tbaa !5
  %32 = sdiv i64 %31, %30
  store i64 %32, ptr %4, align 8, !tbaa !5
  br label %14, !llvm.loop !11

33:                                               ; preds = %17
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #5
  store i32 1, ptr %6, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #5
  store i32 0, ptr %7, align 4, !tbaa !9
  %34 = call i64 @_ZSt9make_pairIiiESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS1_INS2_IT0_E4typeEE6__typeEEOS3_OS8_(ptr noundef nonnull align 4 dereferenceable(4) %6, ptr noundef nonnull align 4 dereferenceable(4) %7)
  store i64 %34, ptr %5, align 4
  call void @_ZNSt4pairIxxEC2IiiTnNSt9enable_ifIXaaclsr6_PCCFPIT_T0_EE22_MoveConstructiblePairIS3_S4_EEclsr6_PCCFPIS3_S4_EE30_ImplicitlyMoveConvertiblePairIS3_S4_EEEbE4typeELb1EEEOS_IS3_S4_E(ptr noundef nonnull align 8 dereferenceable(16) %2, ptr noundef nonnull align 4 dereferenceable(8) %5)
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #5
  store i64 0, ptr %8, align 8, !tbaa !5
  %35 = load i32, ptr @sz, align 4, !tbaa !9
  %36 = sext i32 %35 to i64
  %37 = mul i64 %36, 8
  call void @llvm.memset.p0.i64(ptr align 16 @f, i8 0, i64 %37, i1 false)
  store i64 1, ptr @f, align 16, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #5
  %38 = load i32, ptr @_ZZ8mod_factxE3len, align 4, !tbaa !9
  %39 = sub nsw i32 %38, 1
  store i32 %39, ptr %9, align 4, !tbaa !9
  br label %40

40:                                               ; preds = %119, %33
  %41 = load i32, ptr %9, align 4, !tbaa !9
  %42 = icmp sge i32 %41, 0
  br i1 %42, label %44, label %43

43:                                               ; preds = %40
  store i32 5, ptr %10, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #5
  br label %122

44:                                               ; preds = %40
  %45 = getelementptr inbounds %"struct.std::pair", ptr %2, i32 0, i32 0
  %46 = load i64, ptr %45, align 8, !tbaa !13
  %47 = load i64, ptr @f, align 16, !tbaa !5
  %48 = load i64, ptr @pp, align 8, !tbaa !5
  %49 = call noundef i64 @_Z7mod_mulxxx(i64 noundef %46, i64 noundef %47, i64 noundef %48)
  %50 = getelementptr inbounds %"struct.std::pair", ptr %2, i32 0, i32 0
  store i64 %49, ptr %50, align 8, !tbaa !13
  %51 = load i64, ptr %8, align 8, !tbaa !5
  %52 = getelementptr inbounds %"struct.std::pair", ptr %2, i32 0, i32 1
  %53 = load i64, ptr %52, align 8, !tbaa !15
  %54 = add nsw i64 %53, %51
  store i64 %54, ptr %52, align 8, !tbaa !15
  %55 = load i32, ptr @p, align 4, !tbaa !9
  %56 = sext i32 %55 to i64
  %57 = load i64, ptr %8, align 8, !tbaa !5
  %58 = mul nsw i64 %57, %56
  store i64 %58, ptr %8, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #5
  %59 = load i64, ptr %8, align 8, !tbaa !5
  store i64 %59, ptr %11, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #5
  store i32 1, ptr %12, align 4, !tbaa !9
  br label %60

60:                                               ; preds = %76, %44
  %61 = load i32, ptr %12, align 4, !tbaa !9
  %62 = load i32, ptr %9, align 4, !tbaa !9
  %63 = sext i32 %62 to i64
  %64 = getelementptr inbounds [61 x i32], ptr @_ZZ8mod_factxE3dig, i64 0, i64 %63
  %65 = load i32, ptr %64, align 4, !tbaa !9
  %66 = icmp sle i32 %61, %65
  br i1 %66, label %68, label %67

67:                                               ; preds = %60
  store i32 8, ptr %10, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #5
  br label %79

68:                                               ; preds = %60
  %69 = getelementptr inbounds %"struct.std::pair", ptr %2, i32 0, i32 0
  %70 = load i64, ptr %69, align 8, !tbaa !13
  %71 = load i64, ptr %8, align 8, !tbaa !5
  %72 = add nsw i64 %71, 1
  store i64 %72, ptr %8, align 8, !tbaa !5
  %73 = load i64, ptr @pp, align 8, !tbaa !5
  %74 = call noundef i64 @_Z7mod_mulxxx(i64 noundef %70, i64 noundef %72, i64 noundef %73)
  %75 = getelementptr inbounds %"struct.std::pair", ptr %2, i32 0, i32 0
  store i64 %74, ptr %75, align 8, !tbaa !13
  br label %76

76:                                               ; preds = %68
  %77 = load i32, ptr %12, align 4, !tbaa !9
  %78 = add nsw i32 %77, 1
  store i32 %78, ptr %12, align 4, !tbaa !9
  br label %60, !llvm.loop !16

79:                                               ; preds = %67
  %80 = load i32, ptr %9, align 4, !tbaa !9
  %81 = icmp eq i32 %80, 0
  br i1 %81, label %82, label %83

82:                                               ; preds = %79
  store i32 7, ptr %10, align 4
  br label %116

83:                                               ; preds = %79
  %84 = load i64, ptr %11, align 8, !tbaa !5
  %85 = icmp ne i64 %84, 0
  br i1 %85, label %86, label %97

86:                                               ; preds = %83
  %87 = load i32, ptr @p, align 4, !tbaa !9
  %88 = icmp eq i32 %87, 2
  br i1 %88, label %89, label %91

89:                                               ; preds = %86
  %90 = load i64, ptr %11, align 8, !tbaa !5
  call void @_Z8poly_valPxxS_S_(ptr noundef @f, i64 noundef %90, ptr noundef @g, ptr noundef getelementptr inbounds ([3 x [19 x i64]], ptr @g, i64 0, i64 1))
  call void @_Z8poly_mulPxS_S_(ptr noundef @f, ptr noundef @g, ptr noundef getelementptr inbounds ([3 x [19 x i64]], ptr @g, i64 0, i64 1))
  br label %96

91:                                               ; preds = %86
  %92 = load i64, ptr %11, align 8, !tbaa !5
  call void @_Z8poly_valPxxS_S_(ptr noundef @f, i64 noundef %92, ptr noundef @g, ptr noundef getelementptr inbounds ([3 x [19 x i64]], ptr @g, i64 0, i64 2))
  call void @_Z8poly_mulPxS_S_(ptr noundef @g, ptr noundef @f, ptr noundef getelementptr inbounds ([3 x [19 x i64]], ptr @g, i64 0, i64 2))
  %93 = load i64, ptr %11, align 8, !tbaa !5
  %94 = shl i64 %93, 1
  call void @_Z8poly_valPxxS_S_(ptr noundef @g, i64 noundef %94, ptr noundef getelementptr inbounds ([3 x [19 x i64]], ptr @g, i64 0, i64 1), ptr noundef getelementptr inbounds ([3 x [19 x i64]], ptr @g, i64 0, i64 2))
  call void @_Z8poly_mulPxS_S_(ptr noundef getelementptr inbounds ([3 x [19 x i64]], ptr @g, i64 0, i64 1), ptr noundef @g, ptr noundef getelementptr inbounds ([3 x [19 x i64]], ptr @g, i64 0, i64 2))
  %95 = load i64, ptr %11, align 8, !tbaa !5
  call void @_Z8poly_valPxxS_S_(ptr noundef getelementptr inbounds ([3 x [19 x i64]], ptr @g, i64 0, i64 1), i64 noundef %95, ptr noundef @g, ptr noundef getelementptr inbounds ([3 x [19 x i64]], ptr @g, i64 0, i64 2))
  call void @_Z8poly_mulPxS_S_(ptr noundef @f, ptr noundef @g, ptr noundef getelementptr inbounds ([3 x [19 x i64]], ptr @g, i64 0, i64 2))
  br label %96

96:                                               ; preds = %91, %89
  br label %97

97:                                               ; preds = %96, %83
  %98 = load i32, ptr %9, align 4, !tbaa !9
  %99 = sext i32 %98 to i64
  %100 = getelementptr inbounds [61 x i32], ptr @_ZZ8mod_factxE3dig, i64 0, i64 %99
  %101 = load i32, ptr %100, align 4, !tbaa !9
  %102 = icmp ne i32 %101, 0
  br i1 %102, label %103, label %115

103:                                              ; preds = %97
  %104 = load i32, ptr %9, align 4, !tbaa !9
  %105 = sext i32 %104 to i64
  %106 = getelementptr inbounds [61 x i32], ptr @_ZZ8mod_factxE3dig, i64 0, i64 %105
  %107 = load i32, ptr %106, align 4, !tbaa !9
  %108 = sext i32 %107 to i64
  %109 = getelementptr inbounds [5 x [19 x i64]], ptr @s, i64 0, i64 %108
  %110 = getelementptr inbounds [19 x i64], ptr %109, i64 0, i64 0
  %111 = load i64, ptr %11, align 8, !tbaa !5
  %112 = load i32, ptr @p, align 4, !tbaa !9
  %113 = sext i32 %112 to i64
  %114 = mul nsw i64 %111, %113
  call void @_Z8poly_valPxxS_S_(ptr noundef %110, i64 noundef %114, ptr noundef @g, ptr noundef getelementptr inbounds ([3 x [19 x i64]], ptr @g, i64 0, i64 1))
  call void @_Z8poly_mulPxS_S_(ptr noundef @f, ptr noundef @g, ptr noundef getelementptr inbounds ([3 x [19 x i64]], ptr @g, i64 0, i64 1))
  br label %115

115:                                              ; preds = %103, %97
  store i32 0, ptr %10, align 4
  br label %116

116:                                              ; preds = %115, %82
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #5
  %117 = load i32, ptr %10, align 4
  switch i32 %117, label %124 [
    i32 0, label %118
    i32 7, label %119
  ]

118:                                              ; preds = %116
  br label %119

119:                                              ; preds = %118, %116
  %120 = load i32, ptr %9, align 4, !tbaa !9
  %121 = add nsw i32 %120, -1
  store i32 %121, ptr %9, align 4, !tbaa !9
  br label %40, !llvm.loop !17

122:                                              ; preds = %43
  store i32 1, ptr %10, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #5
  %123 = load { i64, i64 }, ptr %2, align 8
  ret { i64, i64 } %123

124:                                              ; preds = %116
  unreachable
}

; Function Attrs: mustprogress uwtable
declare dso_local i64 @_ZSt9make_pairIiiESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS1_INS2_IT0_E4typeEE6__typeEEOS3_OS8_(ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4)) #0

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

attributes #0 = { 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 #1 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #2 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { 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 = !{!"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 = !{!14, !6, i64 0}
!14 = !{!"_ZTSSt4pairIxxE", !6, i64 0, !6, i64 8}
!15 = !{!14, !6, i64 8}
!16 = distinct !{!16, !12}
!17 = distinct !{!17, !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 }
%"struct.std::pair.0" = type { i32, i32 }

@p = external dso_local local_unnamed_addr global i32, align 4
@sz = external dso_local local_unnamed_addr global i32, align 4
@pp = external dso_local local_unnamed_addr global i64, align 8
@s = external dso_local global [5 x [19 x i64]], align 16
@f = external dso_local global [19 x i64], align 16
@g = external dso_local global [3 x [19 x i64]], align 16
@_ZZ8mod_factxE3len = external hidden local_unnamed_addr global i32, align 4
@_ZZ8mod_factxE3dig = external hidden local_unnamed_addr global [61 x i32], align 16

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z8poly_mulPxS_S_(ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #0

; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #1

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef i64 @_Z7mod_mulxxx(i64 noundef, i64 noundef, i64 noundef) local_unnamed_addr #3

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z8poly_valPxxS_S_(ptr noundef, i64 noundef, ptr noundef, ptr noundef) local_unnamed_addr #0

; Function Attrs: mustprogress uwtable
define dso_local { i64, i64 } @_Z8mod_factx(i64 noundef %0) local_unnamed_addr #0 {
  %2 = alloca %"struct.std::pair", align 8
  %3 = alloca %"struct.std::pair.0", align 8
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  store i32 0, ptr @_ZZ8mod_factxE3len, align 4, !tbaa !5
  %6 = icmp sgt i64 %0, 0
  br i1 %6, label %.lr.ph, label %10

.lr.ph:                                           ; preds = %1
  %7 = load i32, ptr @p, align 4, !tbaa !5
  %8 = sext i32 %7 to i64
  br label %19

._crit_edge:                                      ; preds = %19
  %9 = trunc nsw i64 %indvars.iv.next to i32
  store i32 %9, ptr @_ZZ8mod_factxE3len, align 4, !tbaa !5
  br label %10

10:                                               ; preds = %._crit_edge, %1
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %3) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %4) #5
  store i32 1, ptr %4, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %5) #5
  store i32 0, ptr %5, align 4, !tbaa !5
  %11 = call i64 @_ZSt9make_pairIiiESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS1_INS2_IT0_E4typeEE6__typeEEOS3_OS8_(ptr noundef nonnull align 4 dereferenceable(4) %4, ptr noundef nonnull align 4 dereferenceable(4) %5)
  store i64 %11, ptr %3, align 8
  call void @_ZNSt4pairIxxEC2IiiTnNSt9enable_ifIXaaclsr6_PCCFPIT_T0_EE22_MoveConstructiblePairIS3_S4_EEclsr6_PCCFPIS3_S4_EE30_ImplicitlyMoveConvertiblePairIS3_S4_EEEbE4typeELb1EEEOS_IS3_S4_E(ptr noundef nonnull align 8 dereferenceable(16) %2, ptr noundef nonnull align 4 dereferenceable(8) %3)
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %5) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %4) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %3) #5
  %12 = load i32, ptr @sz, align 4, !tbaa !5
  %13 = sext i32 %12 to i64
  %14 = shl nsw i64 %13, 3
  call void @llvm.memset.p0.i64(ptr nonnull align 16 @f, i8 0, i64 %14, i1 false)
  store i64 1, ptr @f, align 16, !tbaa !9
  %15 = load i32, ptr @_ZZ8mod_factxE3len, align 4, !tbaa !5
  %16 = icmp sgt i32 %15, 0
  br i1 %16, label %.lr.ph43, label %._crit_edge44

.lr.ph43:                                         ; preds = %10
  %17 = getelementptr inbounds i8, ptr %2, i64 8
  %18 = zext nneg i32 %15 to i64
  br label %25

19:                                               ; preds = %.lr.ph, %19
  %indvars.iv = phi i64 [ 0, %.lr.ph ], [ %indvars.iv.next, %19 ]
  %.02229 = phi i64 [ %0, %.lr.ph ], [ %23, %19 ]
  %20 = srem i64 %.02229, %8
  %21 = trunc nuw nsw i64 %20 to i32
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %22 = getelementptr inbounds [61 x i32], ptr @_ZZ8mod_factxE3dig, i64 0, i64 %indvars.iv
  store i32 %21, ptr %22, align 4, !tbaa !5
  %23 = sdiv i64 %.02229, %8
  %24 = icmp sgt i64 %23, 0
  br i1 %24, label %19, label %._crit_edge, !llvm.loop !11

._crit_edge44:                                    ; preds = %._crit_edge37, %59, %10
  %.fca.0.load = load i64, ptr %2, align 8
  %.fca.0.insert = insertvalue { i64, i64 } poison, i64 %.fca.0.load, 0
  %.fca.1.gep = getelementptr inbounds i8, ptr %2, i64 8
  %.fca.1.load = load i64, ptr %.fca.1.gep, align 8
  %.fca.1.insert = insertvalue { i64, i64 } %.fca.0.insert, i64 %.fca.1.load, 1
  ret { i64, i64 } %.fca.1.insert

25:                                               ; preds = %.lr.ph43, %59
  %indvars.iv47 = phi i64 [ %18, %.lr.ph43 ], [ %indvars.iv.next48, %59 ]
  %.02440 = phi i64 [ 0, %.lr.ph43 ], [ %.1.lcssa, %59 ]
  %indvars.iv.next48 = add nsw i64 %indvars.iv47, -1
  %26 = load i64, ptr %2, align 8, !tbaa !13
  %27 = load i64, ptr @f, align 16, !tbaa !9
  %28 = load i64, ptr @pp, align 8, !tbaa !9
  %29 = call noundef i64 @_Z7mod_mulxxx(i64 noundef %26, i64 noundef %27, i64 noundef %28)
  store i64 %29, ptr %2, align 8, !tbaa !13
  %30 = load i64, ptr %17, align 8, !tbaa !15
  %31 = add nsw i64 %30, %.02440
  store i64 %31, ptr %17, align 8, !tbaa !15
  %32 = load i32, ptr @p, align 4, !tbaa !5
  %33 = sext i32 %32 to i64
  %34 = mul nsw i64 %.02440, %33
  %35 = getelementptr inbounds [61 x i32], ptr @_ZZ8mod_factxE3dig, i64 0, i64 %indvars.iv.next48
  %36 = load i32, ptr %35, align 4, !tbaa !5
  %.not32 = icmp slt i32 %36, 1
  br i1 %.not32, label %._crit_edge37, label %.lr.ph36

._crit_edge37:                                    ; preds = %.lr.ph36, %25
  %.1.lcssa = phi i64 [ %34, %25 ], [ %39, %.lr.ph36 ]
  %37 = icmp eq i64 %indvars.iv.next48, 0
  br i1 %37, label %._crit_edge44, label %44

.lr.ph36:                                         ; preds = %25, %.lr.ph36
  %38 = phi i64 [ %41, %.lr.ph36 ], [ %29, %25 ]
  %.034 = phi i32 [ %42, %.lr.ph36 ], [ 1, %25 ]
  %.133 = phi i64 [ %39, %.lr.ph36 ], [ %34, %25 ]
  %39 = add nsw i64 %.133, 1
  %40 = load i64, ptr @pp, align 8, !tbaa !9
  %41 = call noundef i64 @_Z7mod_mulxxx(i64 noundef %38, i64 noundef %39, i64 noundef %40)
  store i64 %41, ptr %2, align 8, !tbaa !13
  %42 = add nuw nsw i32 %.034, 1
  %43 = load i32, ptr %35, align 4, !tbaa !5
  %.not.not = icmp slt i32 %.034, %43
  br i1 %.not.not, label %.lr.ph36, label %._crit_edge37, !llvm.loop !16

44:                                               ; preds = %._crit_edge37
  %.not27 = icmp eq i64 %34, 0
  br i1 %.not27, label %51, label %45

45:                                               ; preds = %44
  %46 = load i32, ptr @p, align 4, !tbaa !5
  %47 = icmp eq i32 %46, 2
  br i1 %47, label %48, label %49

48:                                               ; preds = %45
  call void @_Z8poly_valPxxS_S_(ptr noundef nonnull @f, i64 noundef %34, ptr noundef nonnull @g, ptr noundef nonnull getelementptr inbounds (i8, ptr @g, i64 152))
  br label %.sink.split

49:                                               ; preds = %45
  call void @_Z8poly_valPxxS_S_(ptr noundef nonnull @f, i64 noundef %34, ptr noundef nonnull @g, ptr noundef nonnull getelementptr inbounds (i8, ptr @g, i64 304))
  call void @_Z8poly_mulPxS_S_(ptr noundef nonnull @g, ptr noundef nonnull @f, ptr noundef nonnull getelementptr inbounds (i8, ptr @g, i64 304))
  %50 = shl i64 %34, 1
  call void @_Z8poly_valPxxS_S_(ptr noundef nonnull @g, i64 noundef %50, ptr noundef nonnull getelementptr inbounds (i8, ptr @g, i64 152), ptr noundef nonnull getelementptr inbounds (i8, ptr @g, i64 304))
  call void @_Z8poly_mulPxS_S_(ptr noundef nonnull getelementptr inbounds (i8, ptr @g, i64 152), ptr noundef nonnull @g, ptr noundef nonnull getelementptr inbounds (i8, ptr @g, i64 304))
  call void @_Z8poly_valPxxS_S_(ptr noundef nonnull getelementptr inbounds (i8, ptr @g, i64 152), i64 noundef %34, ptr noundef nonnull @g, ptr noundef nonnull getelementptr inbounds (i8, ptr @g, i64 304))
  br label %.sink.split

.sink.split:                                      ; preds = %49, %48
  %.sink = phi ptr [ getelementptr inbounds (i8, ptr @g, i64 152), %48 ], [ getelementptr inbounds (i8, ptr @g, i64 304), %49 ]
  call void @_Z8poly_mulPxS_S_(ptr noundef nonnull @f, ptr noundef nonnull @g, ptr noundef nonnull %.sink)
  br label %51

51:                                               ; preds = %.sink.split, %44
  %52 = load i32, ptr %35, align 4, !tbaa !5
  %.not28 = icmp eq i32 %52, 0
  br i1 %.not28, label %59, label %53

53:                                               ; preds = %51
  %54 = sext i32 %52 to i64
  %55 = getelementptr inbounds [5 x [19 x i64]], ptr @s, i64 0, i64 %54
  %56 = load i32, ptr @p, align 4, !tbaa !5
  %57 = sext i32 %56 to i64
  %58 = mul nsw i64 %34, %57
  call void @_Z8poly_valPxxS_S_(ptr noundef nonnull %55, i64 noundef %58, ptr noundef nonnull @g, ptr noundef nonnull getelementptr inbounds (i8, ptr @g, i64 152))
  call void @_Z8poly_mulPxS_S_(ptr noundef nonnull @f, ptr noundef nonnull @g, ptr noundef nonnull getelementptr inbounds (i8, ptr @g, i64 152))
  br label %59

59:                                               ; preds = %51, %53
  %60 = icmp sgt i64 %indvars.iv47, 1
  br i1 %60, label %25, label %._crit_edge44, !llvm.loop !17
}

; Function Attrs: mustprogress uwtable
declare dso_local i64 @_ZSt9make_pairIiiESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS1_INS2_IT0_E4typeEE6__typeEEOS3_OS8_(ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4)) local_unnamed_addr #0

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

attributes #0 = { 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 #1 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #2 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { 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 = !{!10, !10, i64 0}
!10 = !{!"long long", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = !{!14, !10, i64 0}
!14 = !{!"_ZTSSt4pairIxxE", !10, i64 0, !10, i64 8}
!15 = !{!14, !10, i64 8}
!16 = distinct !{!16, !12}
!17 = distinct !{!17, !12}


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