; LLVM IR from ShahjalalShohag/code-library :: Math/BerleKamp Massey.ll (Z7combineiRSt6vectorI6modintILi1000000007EESaIS1_EES4_S4_)

; 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<modint<1000000007>, std::allocator<modint<1000000007>>>::_Vector_impl" }
%"struct.std::_Vector_base<modint<1000000007>, std::allocator<modint<1000000007>>>::_Vector_impl" = type { %"struct.std::_Vector_base<modint<1000000007>, std::allocator<modint<1000000007>>>::_Vector_impl_data" }
%"struct.std::_Vector_base<modint<1000000007>, std::allocator<modint<1000000007>>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%struct.modint = type { i32 }
%"class.std::allocator" = type { i8 }

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSaI6modintILi1000000007EEEC2Ev(ptr noundef nonnull align 1 dereferenceable(1)) unnamed_addr #1 align 2

declare i32 @__gxx_personality_v0(...)

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN6modintILi1000000007EEC2Ei(ptr noundef nonnull align 4 dereferenceable(4), i32 noundef) unnamed_addr #1 align 2

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

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local i32 @_ZNK6modintILi1000000007EEmlES0_(ptr noundef nonnull align 4 dereferenceable(4), i32) #3 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 4 dereferenceable(4) ptr @_ZN6modintILi1000000007EEpLES0_(ptr noundef nonnull align 4 dereferenceable(4), i32) #4 align 2

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

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

; Function Attrs: mustprogress uwtable
define dso_local void @_Z7combineiRSt6vectorI6modintILi1000000007EESaIS1_EES4_S4_(ptr dead_on_unwind noalias writable sret(%"class.std::vector") align 8 %0, i32 noundef %1, ptr noundef nonnull align 8 dereferenceable(24) %2, ptr noundef nonnull align 8 dereferenceable(24) %3, ptr noundef nonnull align 8 dereferenceable(24) %4) #5 personality ptr @__gxx_personality_v0 {
  %6 = alloca ptr, align 8
  %7 = alloca i32, align 4
  %8 = alloca ptr, align 8
  %9 = alloca ptr, align 8
  %10 = alloca ptr, align 8
  %11 = alloca i1, align 1
  %12 = alloca %struct.modint, align 4
  %13 = alloca %"class.std::allocator", align 1
  %14 = alloca ptr, align 8
  %15 = alloca i32, align 4
  %16 = alloca i32, align 4
  %17 = alloca i32, align 4
  %18 = alloca i32, align 4
  %19 = alloca %struct.modint, align 4
  %20 = alloca %struct.modint, align 4
  %21 = alloca i32, align 4
  %22 = alloca i32, align 4
  %23 = alloca %struct.modint, align 4
  %24 = alloca %struct.modint, align 4
  store ptr %0, ptr %6, align 8
  store i32 %1, ptr %7, align 4, !tbaa !5
  store ptr %2, ptr %8, align 8, !tbaa !9
  store ptr %3, ptr %9, align 8, !tbaa !9
  store ptr %4, ptr %10, align 8, !tbaa !9
  store i1 false, ptr %11, align 1
  %25 = load i32, ptr %7, align 4, !tbaa !5
  %26 = mul nsw i32 %25, 2
  %27 = add nsw i32 %26, 1
  %28 = sext i32 %27 to i64
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #6
  call void @_ZN6modintILi1000000007EEC2Ei(ptr noundef nonnull align 4 dereferenceable(4) %12, i32 noundef 0)
  call void @llvm.lifetime.start.p0(i64 1, ptr %13) #6
  call void @_ZNSaI6modintILi1000000007EEEC2Ev(ptr noundef nonnull align 1 dereferenceable(1) %13) #6
  invoke void @_ZNSt6vectorI6modintILi1000000007EESaIS1_EEC2EmRKS1_RKS2_(ptr noundef nonnull align 8 dereferenceable(24) %0, i64 noundef %28, ptr noundef nonnull align 4 dereferenceable(4) %12, ptr noundef nonnull align 1 dereferenceable(1) %13)
          to label %29 unwind label %36

29:                                               ; preds = %5
  call void @_ZNSt15__new_allocatorI6modintILi1000000007EEED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %13) #6
  call void @llvm.lifetime.end.p0(i64 1, ptr %13) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #6
  store i32 0, ptr %16, align 4, !tbaa !5
  br label %30

30:                                               ; preds = %78, %29
  %31 = load i32, ptr %16, align 4, !tbaa !5
  %32 = load i32, ptr %7, align 4, !tbaa !5
  %33 = add nsw i32 %32, 1
  %34 = icmp slt i32 %31, %33
  br i1 %34, label %40, label %35

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

36:                                               ; preds = %5
  %37 = landingpad { ptr, i32 }
          cleanup
  %38 = extractvalue { ptr, i32 } %37, 0
  store ptr %38, ptr %14, align 8
  %39 = extractvalue { ptr, i32 } %37, 1
  store i32 %39, ptr %15, align 4
  call void @_ZNSt15__new_allocatorI6modintILi1000000007EEED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %13) #6
  call void @llvm.lifetime.end.p0(i64 1, ptr %13) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #6
  br label %142

40:                                               ; preds = %30
  call void @llvm.lifetime.start.p0(i64 4, ptr %18) #6
  store i32 0, ptr %18, align 4, !tbaa !5
  br label %41

41:                                               ; preds = %70, %40
  %42 = load i32, ptr %18, align 4, !tbaa !5
  %43 = load i32, ptr %7, align 4, !tbaa !5
  %44 = add nsw i32 %43, 1
  %45 = icmp slt i32 %42, %44
  br i1 %45, label %47, label %46

46:                                               ; preds = %41
  store i32 5, ptr %17, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %18) #6
  br label %77

47:                                               ; preds = %41
  %48 = load ptr, ptr %8, align 8, !tbaa !9
  %49 = load i32, ptr %16, align 4, !tbaa !5
  %50 = sext i32 %49 to i64
  %51 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt6vectorI6modintILi1000000007EESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %48, i64 noundef %50) #6
  %52 = load ptr, ptr %9, align 8, !tbaa !9
  %53 = load i32, ptr %18, align 4, !tbaa !5
  %54 = sext i32 %53 to i64
  %55 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt6vectorI6modintILi1000000007EESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %52, i64 noundef %54) #6
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %20, ptr align 4 %55, i64 4, i1 false), !tbaa.struct !11
  %56 = getelementptr inbounds %struct.modint, ptr %20, i32 0, i32 0
  %57 = load i32, ptr %56, align 4
  %58 = invoke i32 @_ZNK6modintILi1000000007EEmlES0_(ptr noundef nonnull align 4 dereferenceable(4) %51, i32 %57)
          to label %59 unwind label %73

59:                                               ; preds = %47
  %60 = getelementptr inbounds %struct.modint, ptr %19, i32 0, i32 0
  store i32 %58, ptr %60, align 4
  %61 = load i32, ptr %16, align 4, !tbaa !5
  %62 = load i32, ptr %18, align 4, !tbaa !5
  %63 = add nsw i32 %61, %62
  %64 = sext i32 %63 to i64
  %65 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt6vectorI6modintILi1000000007EESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %0, i64 noundef %64) #6
  %66 = getelementptr inbounds %struct.modint, ptr %19, i32 0, i32 0
  %67 = load i32, ptr %66, align 4
  %68 = invoke noundef nonnull align 4 dereferenceable(4) ptr @_ZN6modintILi1000000007EEpLES0_(ptr noundef nonnull align 4 dereferenceable(4) %65, i32 %67)
          to label %69 unwind label %73

69:                                               ; preds = %59
  br label %70

70:                                               ; preds = %69
  %71 = load i32, ptr %18, align 4, !tbaa !5
  %72 = add nsw i32 %71, 1
  store i32 %72, ptr %18, align 4, !tbaa !5
  br label %41, !llvm.loop !12

73:                                               ; preds = %59, %47
  %74 = landingpad { ptr, i32 }
          cleanup
  %75 = extractvalue { ptr, i32 } %74, 0
  store ptr %75, ptr %14, align 8
  %76 = extractvalue { ptr, i32 } %74, 1
  store i32 %76, ptr %15, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %18) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #6
  br label %141

77:                                               ; preds = %46
  br label %78

78:                                               ; preds = %77
  %79 = load i32, ptr %16, align 4, !tbaa !5
  %80 = add nsw i32 %79, 1
  store i32 %80, ptr %16, align 4, !tbaa !5
  br label %30, !llvm.loop !14

81:                                               ; preds = %35
  call void @llvm.lifetime.start.p0(i64 4, ptr %21) #6
  %82 = load i32, ptr %7, align 4, !tbaa !5
  %83 = mul nsw i32 2, %82
  store i32 %83, ptr %21, align 4, !tbaa !5
  br label %84

84:                                               ; preds = %126, %81
  %85 = load i32, ptr %21, align 4, !tbaa !5
  %86 = load i32, ptr %7, align 4, !tbaa !5
  %87 = icmp sgt i32 %85, %86
  br i1 %87, label %89, label %88

88:                                               ; preds = %84
  store i32 8, ptr %17, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %21) #6
  br label %129

89:                                               ; preds = %84
  call void @llvm.lifetime.start.p0(i64 4, ptr %22) #6
  store i32 0, ptr %22, align 4, !tbaa !5
  br label %90

90:                                               ; preds = %118, %89
  %91 = load i32, ptr %22, align 4, !tbaa !5
  %92 = load i32, ptr %7, align 4, !tbaa !5
  %93 = icmp slt i32 %91, %92
  br i1 %93, label %95, label %94

94:                                               ; preds = %90
  store i32 11, ptr %17, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %22) #6
  br label %125

95:                                               ; preds = %90
  %96 = load i32, ptr %21, align 4, !tbaa !5
  %97 = sext i32 %96 to i64
  %98 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt6vectorI6modintILi1000000007EESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %0, i64 noundef %97) #6
  %99 = load ptr, ptr %10, align 8, !tbaa !9
  %100 = load i32, ptr %22, align 4, !tbaa !5
  %101 = sext i32 %100 to i64
  %102 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt6vectorI6modintILi1000000007EESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %99, i64 noundef %101) #6
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %24, ptr align 4 %102, i64 4, i1 false), !tbaa.struct !11
  %103 = getelementptr inbounds %struct.modint, ptr %24, i32 0, i32 0
  %104 = load i32, ptr %103, align 4
  %105 = invoke i32 @_ZNK6modintILi1000000007EEmlES0_(ptr noundef nonnull align 4 dereferenceable(4) %98, i32 %104)
          to label %106 unwind label %121

106:                                              ; preds = %95
  %107 = getelementptr inbounds %struct.modint, ptr %23, i32 0, i32 0
  store i32 %105, ptr %107, align 4
  %108 = load i32, ptr %21, align 4, !tbaa !5
  %109 = sub nsw i32 %108, 1
  %110 = load i32, ptr %22, align 4, !tbaa !5
  %111 = sub nsw i32 %109, %110
  %112 = sext i32 %111 to i64
  %113 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt6vectorI6modintILi1000000007EESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %0, i64 noundef %112) #6
  %114 = getelementptr inbounds %struct.modint, ptr %23, i32 0, i32 0
  %115 = load i32, ptr %114, align 4
  %116 = invoke noundef nonnull align 4 dereferenceable(4) ptr @_ZN6modintILi1000000007EEpLES0_(ptr noundef nonnull align 4 dereferenceable(4) %113, i32 %115)
          to label %117 unwind label %121

117:                                              ; preds = %106
  br label %118

118:                                              ; preds = %117
  %119 = load i32, ptr %22, align 4, !tbaa !5
  %120 = add nsw i32 %119, 1
  store i32 %120, ptr %22, align 4, !tbaa !5
  br label %90, !llvm.loop !15

121:                                              ; preds = %106, %95
  %122 = landingpad { ptr, i32 }
          cleanup
  %123 = extractvalue { ptr, i32 } %122, 0
  store ptr %123, ptr %14, align 8
  %124 = extractvalue { ptr, i32 } %122, 1
  store i32 %124, ptr %15, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %22) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %21) #6
  br label %141

125:                                              ; preds = %94
  br label %126

126:                                              ; preds = %125
  %127 = load i32, ptr %21, align 4, !tbaa !5
  %128 = add nsw i32 %127, -1
  store i32 %128, ptr %21, align 4, !tbaa !5
  br label %84, !llvm.loop !16

129:                                              ; preds = %88
  %130 = load i32, ptr %7, align 4, !tbaa !5
  %131 = add nsw i32 %130, 1
  %132 = sext i32 %131 to i64
  invoke void @_ZNSt6vectorI6modintILi1000000007EESaIS1_EE6resizeEm(ptr noundef nonnull align 8 dereferenceable(24) %0, i64 noundef %132)
          to label %133 unwind label %135

133:                                              ; preds = %129
  store i1 true, ptr %11, align 1
  store i32 1, ptr %17, align 4
  %134 = load i1, ptr %11, align 1
  br i1 %134, label %140, label %139

135:                                              ; preds = %129
  %136 = landingpad { ptr, i32 }
          cleanup
  %137 = extractvalue { ptr, i32 } %136, 0
  store ptr %137, ptr %14, align 8
  %138 = extractvalue { ptr, i32 } %136, 1
  store i32 %138, ptr %15, align 4
  br label %141

139:                                              ; preds = %133
  call void @_ZNSt6vectorI6modintILi1000000007EESaIS1_EED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %0) #6
  br label %140

140:                                              ; preds = %139, %133
  ret void

141:                                              ; preds = %135, %121, %73
  call void @_ZNSt6vectorI6modintILi1000000007EESaIS1_EED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %0) #6
  br label %142

142:                                              ; preds = %141, %36
  %143 = load ptr, ptr %14, align 8
  %144 = load i32, ptr %15, align 4
  %145 = insertvalue { ptr, i32 } poison, ptr %143, 0
  %146 = insertvalue { ptr, i32 } %145, i32 %144, 1
  resume { ptr, i32 } %146
}

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt6vectorI6modintILi1000000007EESaIS1_EEC2EmRKS1_RKS2_(ptr noundef nonnull align 8 dereferenceable(24), i64 noundef, ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 1 dereferenceable(1)) unnamed_addr #5 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt15__new_allocatorI6modintILi1000000007EEED2Ev(ptr noundef nonnull align 1 dereferenceable(1)) unnamed_addr #1 align 2

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #2 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { inlinehint 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 #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 = { 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 #6 = { 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 = !{!"any pointer", !7, i64 0}
!11 = !{i64 0, i64 4, !5}
!12 = distinct !{!12, !13}
!13 = !{!"llvm.loop.mustprogress"}
!14 = distinct !{!14, !13}
!15 = distinct !{!15, !13}
!16 = distinct !{!16, !13}


; 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<modint<1000000007>, std::allocator<modint<1000000007>>>::_Vector_impl" }
%"struct.std::_Vector_base<modint<1000000007>, std::allocator<modint<1000000007>>>::_Vector_impl" = type { %"struct.std::_Vector_base<modint<1000000007>, std::allocator<modint<1000000007>>>::_Vector_impl_data" }
%"struct.std::_Vector_base<modint<1000000007>, std::allocator<modint<1000000007>>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%struct.modint = type { i32 }
%"class.std::allocator" = type { i8 }

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSaI6modintILi1000000007EEEC2Ev(ptr noundef nonnull align 1 dereferenceable(1)) unnamed_addr #1 align 2

declare i32 @__gxx_personality_v0(...)

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN6modintILi1000000007EEC2Ei(ptr noundef nonnull align 4 dereferenceable(4), i32 noundef) unnamed_addr #1 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt6vectorI6modintILi1000000007EESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24), i64 noundef) local_unnamed_addr #1 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local i32 @_ZNK6modintILi1000000007EEmlES0_(ptr noundef nonnull align 4 dereferenceable(4), i32) local_unnamed_addr #2 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 4 dereferenceable(4) ptr @_ZN6modintILi1000000007EEpLES0_(ptr noundef nonnull align 4 dereferenceable(4), i32) local_unnamed_addr #3 align 2

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

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

; Function Attrs: mustprogress uwtable
define dso_local void @_Z7combineiRSt6vectorI6modintILi1000000007EESaIS1_EES4_S4_(ptr dead_on_unwind noalias writable sret(%"class.std::vector") align 8 %0, i32 noundef %1, ptr noundef nonnull align 8 dereferenceable(24) %2, ptr noundef nonnull align 8 dereferenceable(24) %3, ptr noundef nonnull align 8 dereferenceable(24) %4) local_unnamed_addr #4 personality ptr @__gxx_personality_v0 {
  %6 = alloca %struct.modint, align 4
  %7 = alloca %"class.std::allocator", align 1
  %8 = shl i32 %1, 1
  %9 = or disjoint i32 %8, 1
  %10 = sext i32 %9 to i64
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %6) #5
  call void @_ZN6modintILi1000000007EEC2Ei(ptr noundef nonnull align 4 dereferenceable(4) %6, i32 noundef 0)
  call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %7) #5
  call void @_ZNSaI6modintILi1000000007EEEC2Ev(ptr noundef nonnull align 1 dereferenceable(1) %7) #5
  invoke void @_ZNSt6vectorI6modintILi1000000007EESaIS1_EEC2EmRKS1_RKS2_(ptr noundef nonnull align 8 dereferenceable(24) %0, i64 noundef %10, ptr noundef nonnull align 4 dereferenceable(4) %6, ptr noundef nonnull align 1 dereferenceable(1) %7)
          to label %11 unwind label %28

11:                                               ; preds = %5
  call void @_ZNSt15__new_allocatorI6modintILi1000000007EEED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %7) #5
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %7) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %6) #5
  %.not48 = icmp slt i32 %1, 0
  %.pre = add i32 %1, 1
  br i1 %.not48, label %.preheader43, label %.preheader44.preheader

.preheader44.preheader:                           ; preds = %11
  %wide.trip.count59 = zext i32 %.pre to i64
  br label %.preheader44

.preheader44:                                     ; preds = %.preheader44.preheader, %._crit_edge
  %indvars.iv56 = phi i64 [ 0, %.preheader44.preheader ], [ %indvars.iv.next57, %._crit_edge ]
  br label %30

.preheader43:                                     ; preds = %._crit_edge, %11
  %12 = icmp sgt i32 %8, %1
  %13 = icmp sgt i32 %1, 0
  %or.cond = and i1 %12, %13
  br i1 %or.cond, label %.preheader.us.preheader, label %._crit_edge53

.preheader.us.preheader:                          ; preds = %.preheader43
  %14 = sext i32 %8 to i64
  %15 = zext nneg i32 %1 to i64
  %wide.trip.count64 = zext nneg i32 %1 to i64
  br label %.preheader.us

.preheader.us:                                    ; preds = %.preheader.us.preheader, %._crit_edge51.us
  %indvars.iv66 = phi i64 [ %14, %.preheader.us.preheader ], [ %indvars.iv.next67, %._crit_edge51.us ]
  br label %16

16:                                               ; preds = %.preheader.us, %20
  %indvars.iv61 = phi i64 [ 0, %.preheader.us ], [ %indvars.iv.next62, %20 ]
  %17 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt6vectorI6modintILi1000000007EESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %0, i64 noundef %indvars.iv66) #5
  %18 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt6vectorI6modintILi1000000007EESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %4, i64 noundef %indvars.iv61) #5
  %.sroa.0.0.copyload.us = load i32, ptr %18, align 4, !tbaa !5
  %19 = invoke i32 @_ZNK6modintILi1000000007EEmlES0_(ptr noundef nonnull align 4 dereferenceable(4) %17, i32 %.sroa.0.0.copyload.us)
          to label %20 unwind label %.split.us

20:                                               ; preds = %16
  %21 = xor i64 %indvars.iv61, -1
  %22 = add i64 %indvars.iv66, %21
  %sext = shl i64 %22, 32
  %23 = ashr exact i64 %sext, 32
  %24 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt6vectorI6modintILi1000000007EESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %0, i64 noundef %23) #5
  %25 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZN6modintILi1000000007EEpLES0_(ptr noundef nonnull align 4 dereferenceable(4) %24, i32 %19)
  %indvars.iv.next62 = add nuw nsw i64 %indvars.iv61, 1
  %exitcond65.not = icmp eq i64 %indvars.iv.next62, %wide.trip.count64
  br i1 %exitcond65.not, label %._crit_edge51.us, label %16, !llvm.loop !9

._crit_edge51.us:                                 ; preds = %20
  %indvars.iv.next67 = add nsw i64 %indvars.iv66, -1
  %26 = icmp sgt i64 %indvars.iv.next67, %15
  br i1 %26, label %.preheader.us, label %._crit_edge53, !llvm.loop !11

.split.us:                                        ; preds = %16
  %27 = landingpad { ptr, i32 }
          cleanup
  br label %44

28:                                               ; preds = %5
  %29 = landingpad { ptr, i32 }
          cleanup
  call void @_ZNSt15__new_allocatorI6modintILi1000000007EEED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %7) #5
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %7) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %6) #5
  br label %45

._crit_edge:                                      ; preds = %34
  %indvars.iv.next57 = add nuw nsw i64 %indvars.iv56, 1
  %exitcond60.not = icmp eq i64 %indvars.iv.next57, %wide.trip.count59
  br i1 %exitcond60.not, label %.preheader43, label %.preheader44, !llvm.loop !12

30:                                               ; preds = %.preheader44, %34
  %indvars.iv = phi i64 [ 0, %.preheader44 ], [ %indvars.iv.next, %34 ]
  %31 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt6vectorI6modintILi1000000007EESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %2, i64 noundef %indvars.iv56) #5
  %32 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt6vectorI6modintILi1000000007EESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %3, i64 noundef %indvars.iv) #5
  %.sroa.09.0.copyload = load i32, ptr %32, align 4, !tbaa !5
  %33 = invoke i32 @_ZNK6modintILi1000000007EEmlES0_(ptr noundef nonnull align 4 dereferenceable(4) %31, i32 %.sroa.09.0.copyload)
          to label %34 unwind label %38

34:                                               ; preds = %30
  %35 = add nuw nsw i64 %indvars.iv, %indvars.iv56
  %36 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt6vectorI6modintILi1000000007EESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %0, i64 noundef %35) #5
  %37 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZN6modintILi1000000007EEpLES0_(ptr noundef nonnull align 4 dereferenceable(4) %36, i32 %33)
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count59
  br i1 %exitcond.not, label %._crit_edge, label %30, !llvm.loop !13

38:                                               ; preds = %30
  %39 = landingpad { ptr, i32 }
          cleanup
  br label %44

._crit_edge53:                                    ; preds = %._crit_edge51.us, %.preheader43
  %40 = sext i32 %.pre to i64
  invoke void @_ZNSt6vectorI6modintILi1000000007EESaIS1_EE6resizeEm(ptr noundef nonnull align 8 dereferenceable(24) %0, i64 noundef %40)
          to label %43 unwind label %41

41:                                               ; preds = %._crit_edge53
  %42 = landingpad { ptr, i32 }
          cleanup
  br label %44

43:                                               ; preds = %._crit_edge53
  ret void

44:                                               ; preds = %41, %.split.us, %38
  %.pn = phi { ptr, i32 } [ %39, %38 ], [ %27, %.split.us ], [ %42, %41 ]
  call void @_ZNSt6vectorI6modintILi1000000007EESaIS1_EED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %0) #5
  br label %45

45:                                               ; preds = %44, %28
  %.pn.pn = phi { ptr, i32 } [ %.pn, %44 ], [ %29, %28 ]
  resume { ptr, i32 } %.pn.pn
}

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt6vectorI6modintILi1000000007EESaIS1_EEC2EmRKS1_RKS2_(ptr noundef nonnull align 8 dereferenceable(24), i64 noundef, ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 1 dereferenceable(1)) unnamed_addr #4 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt15__new_allocatorI6modintILi1000000007EEED2Ev(ptr noundef nonnull align 1 dereferenceable(1)) unnamed_addr #1 align 2

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


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