; LLVM IR from tangjz/acm-icpc :: codeforces/complete/235D.ll (Z3dfsii)

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

@idx = external dso_local global [3001 x i32], align 16
@dep = external dso_local global [3001 x i32], align 16
@e = external dso_local global [3001 x %"class.std::vector"], align 16
@ban = external dso_local global [3001 x i8], align 16
@f = external dso_local global [3001 x [3001 x i32]], align 16
@g = external dso_local global [3001 x [3001 x i32]], align 16

; 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 ptr @_ZNSt6vectorIiSaIiEE5beginEv(ptr noundef nonnull align 8 dereferenceable(24)) #1 align 2

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

; 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)) #1 align 2

; 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 noundef nonnull align 8 dereferenceable(8) ptr @_ZN9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEppEv(ptr noundef nonnull align 8 dereferenceable(8)) #1 align 2

; Function Attrs: mustprogress uwtable
define dso_local noundef i32 @_Z3dfsii(i32 noundef %0, i32 noundef %1) #3 {
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  %6 = alloca ptr, align 8
  %7 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %8 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %9 = alloca i32, align 4
  %10 = alloca ptr, align 8
  %11 = alloca i32, align 4
  %12 = alloca i32, align 4
  %13 = alloca i32, align 4
  %14 = alloca i32, align 4
  store i32 %0, ptr %3, align 4, !tbaa !5
  store i32 %1, ptr %4, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #5
  store i32 1, ptr %5, align 4, !tbaa !5
  %15 = load i32, ptr %3, align 4, !tbaa !5
  %16 = sext i32 %15 to i64
  %17 = getelementptr inbounds [3001 x [3001 x i32]], ptr @f, i64 0, i64 %16
  %18 = getelementptr inbounds [3001 x i32], ptr %17, i64 0, i64 0
  store i32 1, ptr %18, align 4, !tbaa !5
  %19 = load i32, ptr %3, align 4, !tbaa !5
  %20 = sext i32 %19 to i64
  %21 = getelementptr inbounds [3001 x [3001 x i32]], ptr @g, i64 0, i64 %20
  %22 = getelementptr inbounds [3001 x i32], ptr %21, i64 0, i64 0
  store i32 1, ptr %22, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #5
  %23 = load i32, ptr %3, align 4, !tbaa !5
  %24 = sext i32 %23 to i64
  %25 = getelementptr inbounds [3001 x %"class.std::vector"], ptr @e, i64 0, i64 %24
  store ptr %25, ptr %6, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #5
  %26 = load ptr, ptr %6, align 8, !tbaa !9
  %27 = call ptr @_ZNSt6vectorIiSaIiEE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) %26) #5
  %28 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %7, i32 0, i32 0
  store ptr %27, ptr %28, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #5
  %29 = load ptr, ptr %6, align 8, !tbaa !9
  %30 = call ptr @_ZNSt6vectorIiSaIiEE3endEv(ptr noundef nonnull align 8 dereferenceable(24) %29) #5
  %31 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %8, i32 0, i32 0
  store ptr %30, ptr %31, align 8
  br label %32

32:                                               ; preds = %209, %2
  %33 = call noundef zeroext i1 @_ZN9__gnu_cxxneIPiSt6vectorIiSaIiEEEEbRKNS_17__normal_iteratorIT_T0_EESA_(ptr noundef nonnull align 8 dereferenceable(8) %7, ptr noundef nonnull align 8 dereferenceable(8) %8) #5
  br i1 %33, label %35, label %34

34:                                               ; preds = %32
  store i32 2, ptr %9, align 4
  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 %211

35:                                               ; preds = %32
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #5
  %36 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNK9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %7) #5
  store ptr %36, ptr %10, align 8, !tbaa !9
  %37 = load ptr, ptr %10, align 8, !tbaa !9
  %38 = load i32, ptr %37, align 4, !tbaa !5
  %39 = load i32, ptr %4, align 4, !tbaa !5
  %40 = icmp eq i32 %38, %39
  br i1 %40, label %48, label %41

41:                                               ; preds = %35
  %42 = load ptr, ptr %10, align 8, !tbaa !9
  %43 = load i32, ptr %42, align 4, !tbaa !5
  %44 = sext i32 %43 to i64
  %45 = getelementptr inbounds [3001 x i8], ptr @ban, i64 0, i64 %44
  %46 = load i8, ptr %45, align 1, !tbaa !11, !range !13, !noundef !14
  %47 = trunc i8 %46 to i1
  br i1 %47, label %48, label %49

48:                                               ; preds = %41, %35
  store i32 3, ptr %9, align 4
  br label %206

49:                                               ; preds = %41
  %50 = load i32, ptr %3, align 4, !tbaa !5
  %51 = sext i32 %50 to i64
  %52 = getelementptr inbounds [3001 x i32], ptr @idx, i64 0, i64 %51
  %53 = load i32, ptr %52, align 4, !tbaa !5
  %54 = load ptr, ptr %10, align 8, !tbaa !9
  %55 = load i32, ptr %54, align 4, !tbaa !5
  %56 = sext i32 %55 to i64
  %57 = getelementptr inbounds [3001 x i32], ptr @idx, i64 0, i64 %56
  store i32 %53, ptr %57, align 4, !tbaa !5
  %58 = load i32, ptr %3, align 4, !tbaa !5
  %59 = sext i32 %58 to i64
  %60 = getelementptr inbounds [3001 x i32], ptr @dep, i64 0, i64 %59
  %61 = load i32, ptr %60, align 4, !tbaa !5
  %62 = add nsw i32 %61, 1
  %63 = load ptr, ptr %10, align 8, !tbaa !9
  %64 = load i32, ptr %63, align 4, !tbaa !5
  %65 = sext i32 %64 to i64
  %66 = getelementptr inbounds [3001 x i32], ptr @dep, i64 0, i64 %65
  store i32 %62, ptr %66, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #5
  %67 = load ptr, ptr %10, align 8, !tbaa !9
  %68 = load i32, ptr %67, align 4, !tbaa !5
  %69 = load i32, ptr %3, align 4, !tbaa !5
  %70 = call noundef i32 @_Z3dfsii(i32 noundef %68, i32 noundef %69)
  store i32 %70, ptr %11, align 4, !tbaa !5
  %71 = load i32, ptr %3, align 4, !tbaa !5
  %72 = sext i32 %71 to i64
  %73 = getelementptr inbounds [3001 x [3001 x i32]], ptr @f, i64 0, i64 %72
  %74 = getelementptr inbounds [3001 x i32], ptr %73, i64 0, i64 0
  %75 = load i32, ptr %5, align 4, !tbaa !5
  %76 = sext i32 %75 to i64
  %77 = getelementptr inbounds i32, ptr %74, i64 %76
  %78 = load i32, ptr %11, align 4, !tbaa !5
  %79 = sext i32 %78 to i64
  %80 = mul i64 %79, 4
  call void @llvm.memset.p0.i64(ptr align 4 %77, i8 0, i64 %80, i1 false)
  %81 = load i32, ptr %3, align 4, !tbaa !5
  %82 = sext i32 %81 to i64
  %83 = getelementptr inbounds [3001 x [3001 x i32]], ptr @g, i64 0, i64 %82
  %84 = getelementptr inbounds [3001 x i32], ptr %83, i64 0, i64 0
  %85 = load i32, ptr %5, align 4, !tbaa !5
  %86 = sext i32 %85 to i64
  %87 = getelementptr inbounds i32, ptr %84, i64 %86
  %88 = load i32, ptr %11, align 4, !tbaa !5
  %89 = sext i32 %88 to i64
  %90 = mul i64 %89, 4
  call void @llvm.memset.p0.i64(ptr align 4 %87, i8 0, i64 %90, i1 false)
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #5
  store i32 0, ptr %12, align 4, !tbaa !5
  br label %91

91:                                               ; preds = %156, %49
  %92 = load i32, ptr %12, align 4, !tbaa !5
  %93 = load i32, ptr %5, align 4, !tbaa !5
  %94 = icmp slt i32 %92, %93
  br i1 %94, label %96, label %95

95:                                               ; preds = %91
  store i32 4, ptr %9, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #5
  br label %159

96:                                               ; preds = %91
  %97 = load i32, ptr %3, align 4, !tbaa !5
  %98 = sext i32 %97 to i64
  %99 = getelementptr inbounds [3001 x [3001 x i32]], ptr @f, i64 0, i64 %98
  %100 = load i32, ptr %12, align 4, !tbaa !5
  %101 = sext i32 %100 to i64
  %102 = getelementptr inbounds [3001 x i32], ptr %99, i64 0, i64 %101
  %103 = load i32, ptr %102, align 4, !tbaa !5
  %104 = icmp ne i32 %103, 0
  br i1 %104, label %105, label %155

105:                                              ; preds = %96
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #5
  store i32 0, ptr %13, align 4, !tbaa !5
  br label %106

106:                                              ; preds = %151, %105
  %107 = load i32, ptr %13, align 4, !tbaa !5
  %108 = load i32, ptr %11, align 4, !tbaa !5
  %109 = icmp slt i32 %107, %108
  br i1 %109, label %111, label %110

110:                                              ; preds = %106
  store i32 7, ptr %9, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #5
  br label %154

111:                                              ; preds = %106
  %112 = load ptr, ptr %10, align 8, !tbaa !9
  %113 = load i32, ptr %112, align 4, !tbaa !5
  %114 = sext i32 %113 to i64
  %115 = getelementptr inbounds [3001 x [3001 x i32]], ptr @f, i64 0, i64 %114
  %116 = load i32, ptr %13, align 4, !tbaa !5
  %117 = sext i32 %116 to i64
  %118 = getelementptr inbounds [3001 x i32], ptr %115, i64 0, i64 %117
  %119 = load i32, ptr %118, align 4, !tbaa !5
  %120 = icmp ne i32 %119, 0
  br i1 %120, label %121, label %150

121:                                              ; preds = %111
  %122 = load i32, ptr %3, align 4, !tbaa !5
  %123 = sext i32 %122 to i64
  %124 = getelementptr inbounds [3001 x [3001 x i32]], ptr @f, i64 0, i64 %123
  %125 = load i32, ptr %12, align 4, !tbaa !5
  %126 = sext i32 %125 to i64
  %127 = getelementptr inbounds [3001 x i32], ptr %124, i64 0, i64 %126
  %128 = load i32, ptr %127, align 4, !tbaa !5
  %129 = mul nsw i32 2, %128
  %130 = load ptr, ptr %10, align 8, !tbaa !9
  %131 = load i32, ptr %130, align 4, !tbaa !5
  %132 = sext i32 %131 to i64
  %133 = getelementptr inbounds [3001 x [3001 x i32]], ptr @f, i64 0, i64 %132
  %134 = load i32, ptr %13, align 4, !tbaa !5
  %135 = sext i32 %134 to i64
  %136 = getelementptr inbounds [3001 x i32], ptr %133, i64 0, i64 %135
  %137 = load i32, ptr %136, align 4, !tbaa !5
  %138 = mul nsw i32 %129, %137
  %139 = load i32, ptr %3, align 4, !tbaa !5
  %140 = sext i32 %139 to i64
  %141 = getelementptr inbounds [3001 x [3001 x i32]], ptr @g, i64 0, i64 %140
  %142 = load i32, ptr %12, align 4, !tbaa !5
  %143 = load i32, ptr %13, align 4, !tbaa !5
  %144 = add nsw i32 %142, %143
  %145 = add nsw i32 %144, 1
  %146 = sext i32 %145 to i64
  %147 = getelementptr inbounds [3001 x i32], ptr %141, i64 0, i64 %146
  %148 = load i32, ptr %147, align 4, !tbaa !5
  %149 = add nsw i32 %148, %138
  store i32 %149, ptr %147, align 4, !tbaa !5
  br label %150

150:                                              ; preds = %121, %111
  br label %151

151:                                              ; preds = %150
  %152 = load i32, ptr %13, align 4, !tbaa !5
  %153 = add nsw i32 %152, 1
  store i32 %153, ptr %13, align 4, !tbaa !5
  br label %106, !llvm.loop !15

154:                                              ; preds = %110
  br label %155

155:                                              ; preds = %154, %96
  br label %156

156:                                              ; preds = %155
  %157 = load i32, ptr %12, align 4, !tbaa !5
  %158 = add nsw i32 %157, 1
  store i32 %158, ptr %12, align 4, !tbaa !5
  br label %91, !llvm.loop !17

159:                                              ; preds = %95
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #5
  store i32 0, ptr %14, align 4, !tbaa !5
  br label %160

160:                                              ; preds = %199, %159
  %161 = load i32, ptr %14, align 4, !tbaa !5
  %162 = load i32, ptr %11, align 4, !tbaa !5
  %163 = icmp slt i32 %161, %162
  br i1 %163, label %165, label %164

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

165:                                              ; preds = %160
  %166 = load ptr, ptr %10, align 8, !tbaa !9
  %167 = load i32, ptr %166, align 4, !tbaa !5
  %168 = sext i32 %167 to i64
  %169 = getelementptr inbounds [3001 x [3001 x i32]], ptr @f, i64 0, i64 %168
  %170 = load i32, ptr %14, align 4, !tbaa !5
  %171 = sext i32 %170 to i64
  %172 = getelementptr inbounds [3001 x i32], ptr %169, i64 0, i64 %171
  %173 = load i32, ptr %172, align 4, !tbaa !5
  %174 = load i32, ptr %3, align 4, !tbaa !5
  %175 = sext i32 %174 to i64
  %176 = getelementptr inbounds [3001 x [3001 x i32]], ptr @f, i64 0, i64 %175
  %177 = load i32, ptr %14, align 4, !tbaa !5
  %178 = add nsw i32 %177, 1
  %179 = sext i32 %178 to i64
  %180 = getelementptr inbounds [3001 x i32], ptr %176, i64 0, i64 %179
  %181 = load i32, ptr %180, align 4, !tbaa !5
  %182 = add nsw i32 %181, %173
  store i32 %182, ptr %180, align 4, !tbaa !5
  %183 = load ptr, ptr %10, align 8, !tbaa !9
  %184 = load i32, ptr %183, align 4, !tbaa !5
  %185 = sext i32 %184 to i64
  %186 = getelementptr inbounds [3001 x [3001 x i32]], ptr @g, i64 0, i64 %185
  %187 = load i32, ptr %14, align 4, !tbaa !5
  %188 = sext i32 %187 to i64
  %189 = getelementptr inbounds [3001 x i32], ptr %186, i64 0, i64 %188
  %190 = load i32, ptr %189, align 4, !tbaa !5
  %191 = load i32, ptr %3, align 4, !tbaa !5
  %192 = sext i32 %191 to i64
  %193 = getelementptr inbounds [3001 x [3001 x i32]], ptr @g, i64 0, i64 %192
  %194 = load i32, ptr %14, align 4, !tbaa !5
  %195 = sext i32 %194 to i64
  %196 = getelementptr inbounds [3001 x i32], ptr %193, i64 0, i64 %195
  %197 = load i32, ptr %196, align 4, !tbaa !5
  %198 = add nsw i32 %197, %190
  store i32 %198, ptr %196, align 4, !tbaa !5
  br label %199

199:                                              ; preds = %165
  %200 = load i32, ptr %14, align 4, !tbaa !5
  %201 = add nsw i32 %200, 1
  store i32 %201, ptr %14, align 4, !tbaa !5
  br label %160, !llvm.loop !18

202:                                              ; preds = %164
  %203 = load i32, ptr %11, align 4, !tbaa !5
  %204 = load i32, ptr %5, align 4, !tbaa !5
  %205 = add nsw i32 %204, %203
  store i32 %205, ptr %5, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #5
  store i32 0, ptr %9, align 4
  br label %206

206:                                              ; preds = %202, %48
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #5
  %207 = load i32, ptr %9, align 4
  switch i32 %207, label %213 [
    i32 0, label %208
    i32 3, label %209
  ]

208:                                              ; preds = %206
  br label %209

209:                                              ; preds = %208, %206
  %210 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEppEv(ptr noundef nonnull align 8 dereferenceable(8) %7) #5
  br label %32

211:                                              ; preds = %34
  %212 = load i32, ptr %5, align 4, !tbaa !5
  store i32 1, ptr %9, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #5
  ret i32 %212

213:                                              ; preds = %206
  unreachable
}

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

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 = { 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 #3 = { 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 = { nocallback nofree nounwind willreturn memory(argmem: write) }
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 = !{!"any pointer", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"bool", !7, i64 0}
!13 = !{i8 0, i8 2}
!14 = !{}
!15 = distinct !{!15, !16}
!16 = !{!"llvm.loop.mustprogress"}
!17 = distinct !{!17, !16}
!18 = distinct !{!18, !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 }

@idx = external dso_local local_unnamed_addr global [3001 x i32], align 16
@dep = external dso_local local_unnamed_addr global [3001 x i32], align 16
@e = external dso_local global [3001 x %"class.std::vector"], align 16
@ban = external dso_local local_unnamed_addr global [3001 x i8], align 16
@f = external dso_local local_unnamed_addr global [3001 x [3001 x i32]], align 16
@g = external dso_local local_unnamed_addr global [3001 x [3001 x i32]], align 16

; 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 ptr @_ZNSt6vectorIiSaIiEE5beginEv(ptr noundef nonnull align 8 dereferenceable(24)) local_unnamed_addr #1 align 2

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

; 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 #1 align 2

; 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 noundef nonnull align 8 dereferenceable(8) ptr @_ZN9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEppEv(ptr noundef nonnull align 8 dereferenceable(8)) local_unnamed_addr #1 align 2

; Function Attrs: mustprogress nounwind uwtable
define dso_local noundef i32 @_Z3dfsii(i32 noundef %0, i32 noundef %1) local_unnamed_addr #1 {
  %3 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %4 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %5 = sext i32 %0 to i64
  %6 = getelementptr inbounds [3001 x [3001 x i32]], ptr @f, i64 0, i64 %5
  store i32 1, ptr %6, align 4, !tbaa !5
  %7 = getelementptr inbounds [3001 x [3001 x i32]], ptr @g, i64 0, i64 %5
  store i32 1, ptr %7, align 4, !tbaa !5
  %8 = getelementptr inbounds [3001 x %"class.std::vector"], ptr @e, i64 0, i64 %5
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %3) #4
  %9 = tail call ptr @_ZNSt6vectorIiSaIiEE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) %8) #4
  store ptr %9, ptr %3, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %4) #4
  %10 = tail call ptr @_ZNSt6vectorIiSaIiEE3endEv(ptr noundef nonnull align 8 dereferenceable(24) %8) #4
  store ptr %10, ptr %4, align 8
  %11 = call noundef zeroext i1 @_ZN9__gnu_cxxneIPiSt6vectorIiSaIiEEEEbRKNS_17__normal_iteratorIT_T0_EESA_(ptr noundef nonnull align 8 dereferenceable(8) %3, ptr noundef nonnull align 8 dereferenceable(8) %4) #4
  br i1 %11, label %.lr.ph66, label %._crit_edge67

.lr.ph66:                                         ; preds = %2
  %12 = getelementptr inbounds [3001 x i32], ptr @idx, i64 0, i64 %5
  %13 = getelementptr inbounds [3001 x i32], ptr @dep, i64 0, i64 %5
  br label %14

._crit_edge67:                                    ; preds = %72, %2
  %.052.lcssa = phi i32 [ 1, %2 ], [ %.1, %72 ]
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %3) #4
  ret i32 %.052.lcssa

14:                                               ; preds = %.lr.ph66, %72
  %.05263 = phi i32 [ 1, %.lr.ph66 ], [ %.1, %72 ]
  %15 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNK9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %3) #4
  %16 = load i32, ptr %15, align 4, !tbaa !5
  %17 = icmp eq i32 %16, %1
  br i1 %17, label %72, label %18

18:                                               ; preds = %14
  %19 = sext i32 %16 to i64
  %20 = getelementptr inbounds [3001 x i8], ptr @ban, i64 0, i64 %19
  %21 = load i8, ptr %20, align 1, !tbaa !9, !range !11, !noundef !12
  %22 = trunc nuw i8 %21 to i1
  br i1 %22, label %72, label %23

23:                                               ; preds = %18
  %24 = load i32, ptr %12, align 4, !tbaa !5
  %25 = getelementptr inbounds [3001 x i32], ptr @idx, i64 0, i64 %19
  store i32 %24, ptr %25, align 4, !tbaa !5
  %26 = load i32, ptr %13, align 4, !tbaa !5
  %27 = add nsw i32 %26, 1
  %28 = load i32, ptr %15, align 4, !tbaa !5
  %29 = sext i32 %28 to i64
  %30 = getelementptr inbounds [3001 x i32], ptr @dep, i64 0, i64 %29
  store i32 %27, ptr %30, align 4, !tbaa !5
  %31 = load i32, ptr %15, align 4, !tbaa !5
  %32 = call noundef i32 @_Z3dfsii(i32 noundef %31, i32 noundef %0)
  %33 = sext i32 %.05263 to i64
  %34 = getelementptr inbounds i32, ptr %6, i64 %33
  %35 = sext i32 %32 to i64
  %36 = shl nsw i64 %35, 2
  call void @llvm.memset.p0.i64(ptr nonnull align 4 %34, i8 0, i64 %36, i1 false)
  %37 = getelementptr inbounds i32, ptr %7, i64 %33
  call void @llvm.memset.p0.i64(ptr nonnull align 4 %37, i8 0, i64 %36, i1 false)
  %38 = icmp sgt i32 %.05263, 0
  br i1 %38, label %.lr.ph61, label %.preheader57

.lr.ph61:                                         ; preds = %23
  %39 = icmp sgt i32 %32, 0
  br i1 %39, label %.lr.ph61.split.us.preheader, label %._crit_edge

.lr.ph61.split.us.preheader:                      ; preds = %.lr.ph61
  %wide.trip.count73 = zext nneg i32 %.05263 to i64
  %wide.trip.count = zext nneg i32 %32 to i64
  br label %.lr.ph61.split.us

.lr.ph61.split.us:                                ; preds = %.lr.ph61.split.us.preheader, %..loopexit_crit_edge.us
  %indvars.iv70 = phi i64 [ 0, %.lr.ph61.split.us.preheader ], [ %indvars.iv.next71.pre-phi, %..loopexit_crit_edge.us ]
  %40 = getelementptr inbounds [3001 x [3001 x i32]], ptr @f, i64 0, i64 %5, i64 %indvars.iv70
  %41 = load i32, ptr %40, align 4, !tbaa !5
  %.not.us = icmp eq i32 %41, 0
  br i1 %.not.us, label %.lr.ph61.split.us...loopexit_crit_edge.us_crit_edge, label %.preheader.us

.lr.ph61.split.us...loopexit_crit_edge.us_crit_edge: ; preds = %.lr.ph61.split.us
  %.pre = add nuw nsw i64 %indvars.iv70, 1
  br label %..loopexit_crit_edge.us

42:                                               ; preds = %.preheader.us, %53
  %indvars.iv = phi i64 [ 0, %.preheader.us ], [ %indvars.iv.next, %53 ]
  %43 = load i32, ptr %15, align 4, !tbaa !5
  %44 = sext i32 %43 to i64
  %45 = getelementptr inbounds [3001 x [3001 x i32]], ptr @f, i64 0, i64 %44, i64 %indvars.iv
  %46 = load i32, ptr %45, align 4, !tbaa !5
  %.not56.us = icmp eq i32 %46, 0
  br i1 %.not56.us, label %53, label %47

47:                                               ; preds = %42
  %48 = mul nsw i32 %54, %46
  %49 = add nuw nsw i64 %55, %indvars.iv
  %50 = getelementptr inbounds [3001 x [3001 x i32]], ptr @g, i64 0, i64 %5, i64 %49
  %51 = load i32, ptr %50, align 4, !tbaa !5
  %52 = add nsw i32 %51, %48
  store i32 %52, ptr %50, align 4, !tbaa !5
  br label %53

53:                                               ; preds = %47, %42
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
  br i1 %exitcond.not, label %..loopexit_crit_edge.us, label %42, !llvm.loop !13

..loopexit_crit_edge.us:                          ; preds = %53, %.lr.ph61.split.us...loopexit_crit_edge.us_crit_edge
  %indvars.iv.next71.pre-phi = phi i64 [ %.pre, %.lr.ph61.split.us...loopexit_crit_edge.us_crit_edge ], [ %55, %53 ]
  %exitcond74.not = icmp eq i64 %indvars.iv.next71.pre-phi, %wide.trip.count73
  br i1 %exitcond74.not, label %.preheader57, label %.lr.ph61.split.us, !llvm.loop !15

.preheader.us:                                    ; preds = %.lr.ph61.split.us
  %54 = shl nsw i32 %41, 1
  %55 = add nuw nsw i64 %indvars.iv70, 1
  br label %42

.preheader57:                                     ; preds = %..loopexit_crit_edge.us, %23
  %56 = icmp sgt i32 %32, 0
  br i1 %56, label %.lr.ph.preheader, label %._crit_edge

.lr.ph.preheader:                                 ; preds = %.preheader57
  %wide.trip.count78 = zext nneg i32 %32 to i64
  br label %.lr.ph

._crit_edge:                                      ; preds = %.lr.ph, %.lr.ph61, %.preheader57
  %57 = add nsw i32 %32, %.05263
  br label %72

.lr.ph:                                           ; preds = %.lr.ph.preheader, %.lr.ph
  %indvars.iv75 = phi i64 [ 0, %.lr.ph.preheader ], [ %indvars.iv.next76, %.lr.ph ]
  %58 = load i32, ptr %15, align 4, !tbaa !5
  %59 = sext i32 %58 to i64
  %60 = getelementptr inbounds [3001 x [3001 x i32]], ptr @f, i64 0, i64 %59, i64 %indvars.iv75
  %61 = load i32, ptr %60, align 4, !tbaa !5
  %indvars.iv.next76 = add nuw nsw i64 %indvars.iv75, 1
  %62 = getelementptr inbounds [3001 x [3001 x i32]], ptr @f, i64 0, i64 %5, i64 %indvars.iv.next76
  %63 = load i32, ptr %62, align 4, !tbaa !5
  %64 = add nsw i32 %63, %61
  store i32 %64, ptr %62, align 4, !tbaa !5
  %65 = load i32, ptr %15, align 4, !tbaa !5
  %66 = sext i32 %65 to i64
  %67 = getelementptr inbounds [3001 x [3001 x i32]], ptr @g, i64 0, i64 %66, i64 %indvars.iv75
  %68 = load i32, ptr %67, align 4, !tbaa !5
  %69 = getelementptr inbounds [3001 x [3001 x i32]], ptr @g, i64 0, i64 %5, i64 %indvars.iv75
  %70 = load i32, ptr %69, align 4, !tbaa !5
  %71 = add nsw i32 %70, %68
  store i32 %71, ptr %69, align 4, !tbaa !5
  %exitcond79.not = icmp eq i64 %indvars.iv.next76, %wide.trip.count78
  br i1 %exitcond79.not, label %._crit_edge, label %.lr.ph, !llvm.loop !16

72:                                               ; preds = %14, %18, %._crit_edge
  %.1 = phi i32 [ %57, %._crit_edge ], [ %.05263, %18 ], [ %.05263, %14 ]
  %73 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEppEv(ptr noundef nonnull align 8 dereferenceable(8) %3) #4
  %74 = call noundef zeroext i1 @_ZN9__gnu_cxxneIPiSt6vectorIiSaIiEEEEbRKNS_17__normal_iteratorIT_T0_EESA_(ptr noundef nonnull align 8 dereferenceable(8) %3, ptr noundef nonnull align 8 dereferenceable(8) %4) #4
  br i1 %74, label %14, label %._crit_edge67
}

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

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 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 #3 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
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 = !{!"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 = !{i8 0, i8 2}
!12 = !{}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}
!15 = distinct !{!15, !14}
!16 = distinct !{!16, !14}


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