; LLVM IR from tangjz/acm-icpc :: hdu/6453.ll (Z3dfsi)

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

@pw = external dso_local global [1201 x [1201 x i32]], align 16
@w = external dso_local global i32, align 4
@a = external dso_local global [10001 x i32], align 16
@f = external dso_local global [10001 x [3 x [1201 x i32]]], align 16
@cnt = external dso_local global [1201 x i32], align 16
@e = external dso_local global [10001 x %"class.std::vector"], align 16
@vis = external dso_local global [10001 x i8], align 16

; Function Attrs: mustprogress uwtable
define dso_local void @_Z3dfsi(i32 noundef %0) #0 {
  %2 = alloca i32, align 4
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  %5 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %6 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca ptr, align 8
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  store i32 %0, ptr %2, align 4, !tbaa !5
  %12 = load i32, ptr %2, align 4, !tbaa !5
  %13 = sext i32 %12 to i64
  %14 = getelementptr inbounds [10001 x i8], ptr @vis, i64 0, i64 %13
  store i8 1, ptr %14, align 1, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %3) #5
  %15 = load i32, ptr %2, align 4, !tbaa !5
  %16 = sext i32 %15 to i64
  %17 = getelementptr inbounds [10001 x [3 x [1201 x i32]]], ptr @f, i64 0, i64 %16
  %18 = getelementptr inbounds [3 x [1201 x i32]], ptr %17, i64 0, i64 0
  store ptr %18, ptr %3, align 8, !tbaa !11
  %19 = load ptr, ptr %3, align 8, !tbaa !11
  %20 = getelementptr inbounds [1201 x i32], ptr %19, i64 0
  %21 = getelementptr inbounds [1201 x i32], ptr %20, i64 0, i64 0
  %22 = getelementptr inbounds i32, ptr %21, i64 1
  %23 = load i32, ptr %2, align 4, !tbaa !5
  %24 = sext i32 %23 to i64
  %25 = getelementptr inbounds [10001 x i32], ptr @a, i64 0, i64 %24
  %26 = load i32, ptr %25, align 4, !tbaa !5
  %27 = sext i32 %26 to i64
  %28 = getelementptr inbounds [1201 x [1201 x i32]], ptr @pw, i64 0, i64 %27
  %29 = getelementptr inbounds [1201 x i32], ptr %28, i64 0, i64 0
  %30 = getelementptr inbounds i32, ptr %29, i64 1
  %31 = load i32, ptr @w, align 4, !tbaa !5
  %32 = sext i32 %31 to i64
  %33 = mul i64 %32, 4
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %22, ptr align 4 %30, i64 %33, i1 false)
  %34 = load ptr, ptr %3, align 8, !tbaa !11
  %35 = getelementptr inbounds [1201 x i32], ptr %34, i64 1
  %36 = getelementptr inbounds [1201 x i32], ptr %35, i64 0, i64 0
  %37 = getelementptr inbounds i32, ptr %36, i64 1
  %38 = load i32, ptr %2, align 4, !tbaa !5
  %39 = sext i32 %38 to i64
  %40 = getelementptr inbounds [10001 x i32], ptr @a, i64 0, i64 %39
  %41 = load i32, ptr %40, align 4, !tbaa !5
  %42 = mul nsw i32 %41, 2
  %43 = sext i32 %42 to i64
  %44 = getelementptr inbounds [1201 x [1201 x i32]], ptr @pw, i64 0, i64 %43
  %45 = getelementptr inbounds [1201 x i32], ptr %44, i64 0, i64 0
  %46 = getelementptr inbounds i32, ptr %45, i64 1
  %47 = load i32, ptr @w, align 4, !tbaa !5
  %48 = sext i32 %47 to i64
  %49 = mul i64 %48, 4
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %37, ptr align 4 %46, i64 %49, i1 false)
  %50 = load ptr, ptr %3, align 8, !tbaa !11
  %51 = getelementptr inbounds [1201 x i32], ptr %50, i64 2
  %52 = getelementptr inbounds [1201 x i32], ptr %51, i64 0, i64 0
  %53 = getelementptr inbounds i32, ptr %52, i64 1
  %54 = load i32, ptr %2, align 4, !tbaa !5
  %55 = sext i32 %54 to i64
  %56 = getelementptr inbounds [10001 x i32], ptr @a, i64 0, i64 %55
  %57 = load i32, ptr %56, align 4, !tbaa !5
  %58 = mul nsw i32 %57, 3
  %59 = sext i32 %58 to i64
  %60 = getelementptr inbounds [1201 x [1201 x i32]], ptr @pw, i64 0, i64 %59
  %61 = getelementptr inbounds [1201 x i32], ptr %60, i64 0, i64 0
  %62 = getelementptr inbounds i32, ptr %61, i64 1
  %63 = load i32, ptr @w, align 4, !tbaa !5
  %64 = sext i32 %63 to i64
  %65 = mul i64 %64, 4
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %53, ptr align 4 %62, i64 %65, i1 false)
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #5
  %66 = load i32, ptr %2, align 4, !tbaa !5
  %67 = sext i32 %66 to i64
  %68 = getelementptr inbounds [10001 x %"class.std::vector"], ptr @e, i64 0, i64 %67
  store ptr %68, ptr %4, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #5
  %69 = load ptr, ptr %4, align 8, !tbaa !11
  %70 = call ptr @_ZNSt6vectorIiSaIiEE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) %69) #5
  %71 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %5, i32 0, i32 0
  store ptr %70, ptr %71, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #5
  %72 = load ptr, ptr %4, align 8, !tbaa !11
  %73 = call ptr @_ZNSt6vectorIiSaIiEE3endEv(ptr noundef nonnull align 8 dereferenceable(24) %72) #5
  %74 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %6, i32 0, i32 0
  store ptr %73, ptr %74, align 8
  br label %75

75:                                               ; preds = %136, %1
  %76 = call noundef zeroext i1 @_ZN9__gnu_cxxneIPiSt6vectorIiSaIiEEEEbRKNS_17__normal_iteratorIT_T0_EESA_(ptr noundef nonnull align 8 dereferenceable(8) %5, ptr noundef nonnull align 8 dereferenceable(8) %6) #5
  br i1 %76, label %78, label %77

77:                                               ; preds = %75
  store i32 2, ptr %7, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #5
  br label %138

78:                                               ; preds = %75
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #5
  %79 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNK9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %5) #5
  %80 = load i32, ptr %79, align 4, !tbaa !5
  store i32 %80, ptr %8, align 4, !tbaa !5
  %81 = load i32, ptr %8, align 4, !tbaa !5
  %82 = sext i32 %81 to i64
  %83 = getelementptr inbounds [10001 x i8], ptr @vis, i64 0, i64 %82
  %84 = load i8, ptr %83, align 1, !tbaa !9, !range !13, !noundef !14
  %85 = trunc i8 %84 to i1
  br i1 %85, label %88, label %86

86:                                               ; preds = %78
  %87 = load i32, ptr %8, align 4, !tbaa !5
  call void @_Z3dfsi(i32 noundef %87)
  br label %88

88:                                               ; preds = %86, %78
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #5
  %89 = load i32, ptr %8, align 4, !tbaa !5
  %90 = sext i32 %89 to i64
  %91 = getelementptr inbounds [10001 x [3 x [1201 x i32]]], ptr @f, i64 0, i64 %90
  %92 = getelementptr inbounds [3 x [1201 x i32]], ptr %91, i64 0, i64 0
  store ptr %92, ptr %9, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #5
  store i32 1, ptr %10, align 4, !tbaa !5
  br label %93

93:                                               ; preds = %132, %88
  %94 = load i32, ptr %10, align 4, !tbaa !5
  %95 = load i32, ptr @w, align 4, !tbaa !5
  %96 = icmp sle i32 %94, %95
  br i1 %96, label %98, label %97

97:                                               ; preds = %93
  store i32 4, ptr %7, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #5
  br label %135

98:                                               ; preds = %93
  %99 = load ptr, ptr %3, align 8, !tbaa !11
  %100 = getelementptr inbounds [1201 x i32], ptr %99, i64 0
  %101 = load i32, ptr %10, align 4, !tbaa !5
  %102 = sext i32 %101 to i64
  %103 = getelementptr inbounds [1201 x i32], ptr %100, i64 0, i64 %102
  %104 = load ptr, ptr %9, align 8, !tbaa !11
  %105 = getelementptr inbounds [1201 x i32], ptr %104, i64 0
  %106 = load i32, ptr %10, align 4, !tbaa !5
  %107 = sext i32 %106 to i64
  %108 = getelementptr inbounds [1201 x i32], ptr %105, i64 0, i64 %107
  %109 = load i32, ptr %108, align 4, !tbaa !5
  call void @_Z7mod_incRii(ptr noundef nonnull align 4 dereferenceable(4) %103, i32 noundef %109)
  %110 = load ptr, ptr %3, align 8, !tbaa !11
  %111 = getelementptr inbounds [1201 x i32], ptr %110, i64 1
  %112 = load i32, ptr %10, align 4, !tbaa !5
  %113 = sext i32 %112 to i64
  %114 = getelementptr inbounds [1201 x i32], ptr %111, i64 0, i64 %113
  %115 = load ptr, ptr %9, align 8, !tbaa !11
  %116 = getelementptr inbounds [1201 x i32], ptr %115, i64 1
  %117 = load i32, ptr %10, align 4, !tbaa !5
  %118 = sext i32 %117 to i64
  %119 = getelementptr inbounds [1201 x i32], ptr %116, i64 0, i64 %118
  %120 = load i32, ptr %119, align 4, !tbaa !5
  call void @_Z7mod_incRii(ptr noundef nonnull align 4 dereferenceable(4) %114, i32 noundef %120)
  %121 = load ptr, ptr %3, align 8, !tbaa !11
  %122 = getelementptr inbounds [1201 x i32], ptr %121, i64 2
  %123 = load i32, ptr %10, align 4, !tbaa !5
  %124 = sext i32 %123 to i64
  %125 = getelementptr inbounds [1201 x i32], ptr %122, i64 0, i64 %124
  %126 = load ptr, ptr %9, align 8, !tbaa !11
  %127 = getelementptr inbounds [1201 x i32], ptr %126, i64 2
  %128 = load i32, ptr %10, align 4, !tbaa !5
  %129 = sext i32 %128 to i64
  %130 = getelementptr inbounds [1201 x i32], ptr %127, i64 0, i64 %129
  %131 = load i32, ptr %130, align 4, !tbaa !5
  call void @_Z7mod_incRii(ptr noundef nonnull align 4 dereferenceable(4) %125, i32 noundef %131)
  br label %132

132:                                              ; preds = %98
  %133 = load i32, ptr %10, align 4, !tbaa !5
  %134 = add nsw i32 %133, 1
  store i32 %134, ptr %10, align 4, !tbaa !5
  br label %93, !llvm.loop !15

135:                                              ; preds = %97
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #5
  br label %136

136:                                              ; preds = %135
  %137 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEppEv(ptr noundef nonnull align 8 dereferenceable(8) %5) #5
  br label %75

138:                                              ; preds = %77
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #5
  store i32 1, ptr %11, align 4, !tbaa !5
  br label %139

139:                                              ; preds = %198, %138
  %140 = load i32, ptr %11, align 4, !tbaa !5
  %141 = load i32, ptr @w, align 4, !tbaa !5
  %142 = icmp sle i32 %140, %141
  br i1 %142, label %144, label %143

143:                                              ; preds = %139
  store i32 7, ptr %7, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #5
  br label %201

144:                                              ; preds = %139
  %145 = load i32, ptr %11, align 4, !tbaa !5
  %146 = sext i32 %145 to i64
  %147 = getelementptr inbounds [1201 x i32], ptr @cnt, i64 0, i64 %146
  %148 = load i32, ptr %147, align 4, !tbaa !5
  %149 = sext i32 %148 to i64
  %150 = load ptr, ptr %3, align 8, !tbaa !11
  %151 = getelementptr inbounds [1201 x i32], ptr %150, i64 0
  %152 = load i32, ptr %11, align 4, !tbaa !5
  %153 = sext i32 %152 to i64
  %154 = getelementptr inbounds [1201 x i32], ptr %151, i64 0, i64 %153
  %155 = load i32, ptr %154, align 4, !tbaa !5
  %156 = sext i32 %155 to i64
  %157 = load ptr, ptr %3, align 8, !tbaa !11
  %158 = getelementptr inbounds [1201 x i32], ptr %157, i64 0
  %159 = load i32, ptr %11, align 4, !tbaa !5
  %160 = sext i32 %159 to i64
  %161 = getelementptr inbounds [1201 x i32], ptr %158, i64 0, i64 %160
  %162 = load i32, ptr %161, align 4, !tbaa !5
  %163 = sext i32 %162 to i64
  %164 = mul nsw i64 %156, %163
  %165 = load ptr, ptr %3, align 8, !tbaa !11
  %166 = getelementptr inbounds [1201 x i32], ptr %165, i64 1
  %167 = load i32, ptr %11, align 4, !tbaa !5
  %168 = sext i32 %167 to i64
  %169 = getelementptr inbounds [1201 x i32], ptr %166, i64 0, i64 %168
  %170 = load i32, ptr %169, align 4, !tbaa !5
  %171 = sext i32 %170 to i64
  %172 = mul nsw i64 3, %171
  %173 = sub nsw i64 %164, %172
  %174 = srem i64 %173, 1000000007
  %175 = load ptr, ptr %3, align 8, !tbaa !11
  %176 = getelementptr inbounds [1201 x i32], ptr %175, i64 0
  %177 = load i32, ptr %11, align 4, !tbaa !5
  %178 = sext i32 %177 to i64
  %179 = getelementptr inbounds [1201 x i32], ptr %176, i64 0, i64 %178
  %180 = load i32, ptr %179, align 4, !tbaa !5
  %181 = sext i32 %180 to i64
  %182 = mul nsw i64 %174, %181
  %183 = load ptr, ptr %3, align 8, !tbaa !11
  %184 = getelementptr inbounds [1201 x i32], ptr %183, i64 2
  %185 = load i32, ptr %11, align 4, !tbaa !5
  %186 = sext i32 %185 to i64
  %187 = getelementptr inbounds [1201 x i32], ptr %184, i64 0, i64 %186
  %188 = load i32, ptr %187, align 4, !tbaa !5
  %189 = sext i32 %188 to i64
  %190 = mul nsw i64 2, %189
  %191 = add nsw i64 %182, %190
  %192 = add nsw i64 %149, %191
  %193 = srem i64 %192, 1000000007
  %194 = trunc i64 %193 to i32
  %195 = load i32, ptr %11, align 4, !tbaa !5
  %196 = sext i32 %195 to i64
  %197 = getelementptr inbounds [1201 x i32], ptr @cnt, i64 0, i64 %196
  store i32 %194, ptr %197, align 4, !tbaa !5
  br label %198

198:                                              ; preds = %144
  %199 = load i32, ptr %11, align 4, !tbaa !5
  %200 = add nsw i32 %199, 1
  store i32 %200, ptr %11, align 4, !tbaa !5
  br label %139, !llvm.loop !17

201:                                              ; preds = %143
  call void @llvm.lifetime.end.p0(i64 8, ptr %3) #5
  ret void
}

; 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 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: mustprogress nounwind uwtable
declare dso_local ptr @_ZNSt6vectorIiSaIiEE5beginEv(ptr noundef nonnull align 8 dereferenceable(24)) #3 align 2

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

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

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

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

; 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 nonnull align 8 dereferenceable(8) ptr @_ZN9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEppEv(ptr noundef nonnull align 8 dereferenceable(8)) #3 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 nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { 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 = { inlinehint mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { nounwind }

!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"bool", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"any pointer", !7, i64 0}
!13 = !{i8 0, i8 2}
!14 = !{}
!15 = distinct !{!15, !16}
!16 = !{!"llvm.loop.mustprogress"}
!17 = distinct !{!17, !16}


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

@pw = external dso_local local_unnamed_addr global [1201 x [1201 x i32]], align 16
@w = external dso_local local_unnamed_addr global i32, align 4
@a = external dso_local local_unnamed_addr global [10001 x i32], align 16
@f = external dso_local global [10001 x [3 x [1201 x i32]]], align 16
@cnt = external dso_local local_unnamed_addr global [1201 x i32], align 16
@e = external dso_local global [10001 x %"class.std::vector"], align 16
@vis = external dso_local local_unnamed_addr global [10001 x i8], align 16

; Function Attrs: mustprogress nounwind uwtable
define dso_local void @_Z3dfsi(i32 noundef %0) local_unnamed_addr #0 {
  %2 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %3 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %4 = sext i32 %0 to i64
  %5 = getelementptr inbounds [10001 x i8], ptr @vis, i64 0, i64 %4
  store i8 1, ptr %5, align 1, !tbaa !5
  %6 = getelementptr inbounds [10001 x [3 x [1201 x i32]]], ptr @f, i64 0, i64 %4
  %7 = getelementptr inbounds i8, ptr %6, i64 4
  %8 = getelementptr inbounds [10001 x i32], ptr @a, i64 0, i64 %4
  %9 = load i32, ptr %8, align 4, !tbaa !9
  %10 = sext i32 %9 to i64
  %11 = getelementptr inbounds [1201 x [1201 x i32]], ptr @pw, i64 0, i64 %10, i64 1
  %12 = load i32, ptr @w, align 4, !tbaa !9
  %13 = sext i32 %12 to i64
  %14 = shl nsw i64 %13, 2
  tail call void @llvm.memcpy.p0.p0.i64(ptr nonnull align 4 %7, ptr nonnull align 4 %11, i64 %14, i1 false)
  %15 = getelementptr inbounds i8, ptr %6, i64 4804
  %16 = getelementptr inbounds i8, ptr %6, i64 4808
  %17 = shl nsw i32 %9, 1
  %18 = sext i32 %17 to i64
  %19 = getelementptr inbounds [1201 x [1201 x i32]], ptr @pw, i64 0, i64 %18, i64 1
  tail call void @llvm.memcpy.p0.p0.i64(ptr nonnull align 4 %16, ptr nonnull align 4 %19, i64 %14, i1 false)
  %20 = getelementptr inbounds i8, ptr %6, i64 9608
  %21 = getelementptr inbounds i8, ptr %6, i64 9612
  %22 = mul nsw i32 %9, 3
  %23 = sext i32 %22 to i64
  %24 = getelementptr inbounds [1201 x [1201 x i32]], ptr @pw, i64 0, i64 %23, i64 1
  tail call void @llvm.memcpy.p0.p0.i64(ptr nonnull align 4 %21, ptr nonnull align 4 %24, i64 %14, i1 false)
  %25 = getelementptr inbounds [10001 x %"class.std::vector"], ptr @e, i64 0, i64 %4
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %2) #4
  %26 = tail call ptr @_ZNSt6vectorIiSaIiEE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) %25) #4
  store ptr %26, ptr %2, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %3) #4
  %27 = tail call ptr @_ZNSt6vectorIiSaIiEE3endEv(ptr noundef nonnull align 8 dereferenceable(24) %25) #4
  store ptr %27, ptr %3, align 8
  %28 = call noundef zeroext i1 @_ZN9__gnu_cxxneIPiSt6vectorIiSaIiEEEEbRKNS_17__normal_iteratorIT_T0_EESA_(ptr noundef nonnull align 8 dereferenceable(8) %2, ptr noundef nonnull align 8 dereferenceable(8) %3) #4
  br i1 %28, label %.lr.ph46, label %._crit_edge47

._crit_edge47:                                    ; preds = %._crit_edge, %1
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %3) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %2) #4
  %29 = load i32, ptr @w, align 4, !tbaa !9
  %.not48 = icmp slt i32 %29, 1
  br i1 %.not48, label %._crit_edge52, label %.lr.ph51.preheader

.lr.ph51.preheader:                               ; preds = %._crit_edge47
  %30 = add nuw i32 %29, 1
  %wide.trip.count = zext i32 %30 to i64
  br label %.lr.ph51

.lr.ph46:                                         ; preds = %1, %._crit_edge
  %31 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNK9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %2) #4
  %32 = load i32, ptr %31, align 4, !tbaa !9
  %33 = sext i32 %32 to i64
  %34 = getelementptr inbounds [10001 x i8], ptr @vis, i64 0, i64 %33
  %35 = load i8, ptr %34, align 1, !tbaa !5, !range !11, !noundef !12
  %36 = trunc nuw i8 %35 to i1
  br i1 %36, label %38, label %37

37:                                               ; preds = %.lr.ph46
  call void @_Z3dfsi(i32 noundef %32)
  br label %38

38:                                               ; preds = %37, %.lr.ph46
  %39 = getelementptr inbounds [10001 x [3 x [1201 x i32]]], ptr @f, i64 0, i64 %33
  %40 = load i32, ptr @w, align 4, !tbaa !9
  %.not4243 = icmp slt i32 %40, 1
  br i1 %.not4243, label %._crit_edge, label %.lr.ph

.lr.ph:                                           ; preds = %38
  %41 = getelementptr inbounds i8, ptr %39, i64 4804
  %42 = getelementptr inbounds i8, ptr %39, i64 9608
  br label %45

._crit_edge:                                      ; preds = %45, %38
  %43 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEppEv(ptr noundef nonnull align 8 dereferenceable(8) %2) #4
  %44 = call noundef zeroext i1 @_ZN9__gnu_cxxneIPiSt6vectorIiSaIiEEEEbRKNS_17__normal_iteratorIT_T0_EESA_(ptr noundef nonnull align 8 dereferenceable(8) %2, ptr noundef nonnull align 8 dereferenceable(8) %3) #4
  br i1 %44, label %.lr.ph46, label %._crit_edge47

45:                                               ; preds = %.lr.ph, %45
  %indvars.iv = phi i64 [ 1, %.lr.ph ], [ %indvars.iv.next, %45 ]
  %46 = getelementptr inbounds [1201 x i32], ptr %6, i64 0, i64 %indvars.iv
  %47 = getelementptr inbounds [1201 x i32], ptr %39, i64 0, i64 %indvars.iv
  %48 = load i32, ptr %47, align 4, !tbaa !9
  call void @_Z7mod_incRii(ptr noundef nonnull align 4 dereferenceable(4) %46, i32 noundef %48)
  %49 = getelementptr inbounds [1201 x i32], ptr %15, i64 0, i64 %indvars.iv
  %50 = getelementptr inbounds [1201 x i32], ptr %41, i64 0, i64 %indvars.iv
  %51 = load i32, ptr %50, align 4, !tbaa !9
  call void @_Z7mod_incRii(ptr noundef nonnull align 4 dereferenceable(4) %49, i32 noundef %51)
  %52 = getelementptr inbounds [1201 x i32], ptr %20, i64 0, i64 %indvars.iv
  %53 = getelementptr inbounds [1201 x i32], ptr %42, i64 0, i64 %indvars.iv
  %54 = load i32, ptr %53, align 4, !tbaa !9
  call void @_Z7mod_incRii(ptr noundef nonnull align 4 dereferenceable(4) %52, i32 noundef %54)
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %55 = load i32, ptr @w, align 4, !tbaa !9
  %56 = sext i32 %55 to i64
  %.not42.not = icmp slt i64 %indvars.iv, %56
  br i1 %.not42.not, label %45, label %._crit_edge, !llvm.loop !13

._crit_edge52:                                    ; preds = %.lr.ph51, %._crit_edge47
  ret void

.lr.ph51:                                         ; preds = %.lr.ph51.preheader, %.lr.ph51
  %indvars.iv54 = phi i64 [ 1, %.lr.ph51.preheader ], [ %indvars.iv.next55, %.lr.ph51 ]
  %57 = getelementptr inbounds [1201 x i32], ptr @cnt, i64 0, i64 %indvars.iv54
  %58 = load i32, ptr %57, align 4, !tbaa !9
  %59 = sext i32 %58 to i64
  %60 = getelementptr inbounds [1201 x i32], ptr %6, i64 0, i64 %indvars.iv54
  %61 = load i32, ptr %60, align 4, !tbaa !9
  %62 = sext i32 %61 to i64
  %63 = mul nsw i64 %62, %62
  %64 = getelementptr inbounds [1201 x i32], ptr %15, i64 0, i64 %indvars.iv54
  %65 = load i32, ptr %64, align 4, !tbaa !9
  %66 = sext i32 %65 to i64
  %.neg = mul nsw i64 %66, -3
  %67 = add nsw i64 %.neg, %63
  %68 = srem i64 %67, 1000000007
  %69 = mul nsw i64 %68, %62
  %70 = getelementptr inbounds [1201 x i32], ptr %20, i64 0, i64 %indvars.iv54
  %71 = load i32, ptr %70, align 4, !tbaa !9
  %72 = sext i32 %71 to i64
  %73 = shl nsw i64 %72, 1
  %74 = add nsw i64 %73, %59
  %75 = add nsw i64 %74, %69
  %76 = srem i64 %75, 1000000007
  %77 = trunc nsw i64 %76 to i32
  store i32 %77, ptr %57, align 4, !tbaa !9
  %indvars.iv.next55 = add nuw nsw i64 %indvars.iv54, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next55, %wide.trip.count
  br i1 %exitcond.not, label %._crit_edge52, label %.lr.ph51, !llvm.loop !15
}

; 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 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: mustprogress nounwind uwtable
declare dso_local ptr @_ZNSt6vectorIiSaIiEE5beginEv(ptr noundef nonnull align 8 dereferenceable(24)) local_unnamed_addr #0 align 2

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_Z7mod_incRii(ptr noundef nonnull align 4 dereferenceable(4), i32 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) #1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(8) ptr @_ZN9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEppEv(ptr noundef nonnull align 8 dereferenceable(8)) local_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 nocallback nofree 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 = { 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 = !{!"bool", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = !{i8 0, i8 2}
!12 = !{}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}
!15 = distinct !{!15, !14}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LICMPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,PostOrderFunctionAttrsPass,ReassociatePass,SROAPass,SimplifyCFGPass,TailCallElimPass