; LLVM IR from reyadussalahin/problem-solving :: graph/dfs/codeforces/F764C (Solution)

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

@adj = external dso_local global [100010 x %"class.std::vector"], align 16
@color = external dso_local global [100010 x i32], align 16
@instck = external dso_local global [100010 x i32], align 16
@stck = external dso_local global [100010 x i32], align 16
@.str = external hidden unnamed_addr constant [3 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [6 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [8 x i8], align 1

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

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

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

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

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

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() #4 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  %12 = alloca i32, align 4
  %13 = alloca i32, align 4
  %14 = alloca i32, align 4
  %15 = alloca ptr, align 8
  %16 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %17 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %18 = alloca i32, align 4
  store i32 0, ptr %1, align 4
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #6
  %19 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef %2)
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #6
  store i32 1, ptr %5, align 4, !tbaa !5
  br label %20

20:                                               ; preds = %39, %0
  %21 = load i32, ptr %5, align 4, !tbaa !5
  %22 = load i32, ptr %2, align 4, !tbaa !5
  %23 = icmp slt i32 %21, %22
  br i1 %23, label %25, label %24

24:                                               ; preds = %20
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #6
  br label %42

25:                                               ; preds = %20
  %26 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.2, ptr noundef %3, ptr noundef %4)
  %27 = load i32, ptr %3, align 4, !tbaa !5
  %28 = sub nsw i32 %27, 1
  %29 = sext i32 %28 to i64
  %30 = getelementptr inbounds [100010 x %"class.std::vector"], ptr @adj, i64 0, i64 %29
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #6
  %31 = load i32, ptr %4, align 4, !tbaa !5
  %32 = sub nsw i32 %31, 1
  store i32 %32, ptr %6, align 4, !tbaa !5
  call void @_ZNSt6vectorIiSaIiEE9push_backEOi(ptr noundef nonnull align 8 dereferenceable(24) %30, ptr noundef nonnull align 4 dereferenceable(4) %6)
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #6
  %33 = load i32, ptr %4, align 4, !tbaa !5
  %34 = sub nsw i32 %33, 1
  %35 = sext i32 %34 to i64
  %36 = getelementptr inbounds [100010 x %"class.std::vector"], ptr @adj, i64 0, i64 %35
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #6
  %37 = load i32, ptr %3, align 4, !tbaa !5
  %38 = sub nsw i32 %37, 1
  store i32 %38, ptr %7, align 4, !tbaa !5
  call void @_ZNSt6vectorIiSaIiEE9push_backEOi(ptr noundef nonnull align 8 dereferenceable(24) %36, ptr noundef nonnull align 4 dereferenceable(4) %7)
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #6
  br label %39

39:                                               ; preds = %25
  %40 = load i32, ptr %5, align 4, !tbaa !5
  %41 = add nsw i32 %40, 1
  store i32 %41, ptr %5, align 4, !tbaa !5
  br label %20, !llvm.loop !9

42:                                               ; preds = %24
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #6
  store i32 0, ptr %8, align 4, !tbaa !5
  br label %43

43:                                               ; preds = %53, %42
  %44 = load i32, ptr %8, align 4, !tbaa !5
  %45 = load i32, ptr %2, align 4, !tbaa !5
  %46 = icmp slt i32 %44, %45
  br i1 %46, label %48, label %47

47:                                               ; preds = %43
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #6
  br label %56

48:                                               ; preds = %43
  %49 = load i32, ptr %8, align 4, !tbaa !5
  %50 = sext i32 %49 to i64
  %51 = getelementptr inbounds [100010 x i32], ptr @color, i64 0, i64 %50
  %52 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef %51)
  br label %53

53:                                               ; preds = %48
  %54 = load i32, ptr %8, align 4, !tbaa !5
  %55 = add nsw i32 %54, 1
  store i32 %55, ptr %8, align 4, !tbaa !5
  br label %43, !llvm.loop !11

56:                                               ; preds = %47
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #6
  store i32 0, ptr %9, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #6
  store i32 0, ptr %10, align 4, !tbaa !5
  br label %57

57:                                               ; preds = %78, %56
  %58 = load i32, ptr %10, align 4, !tbaa !5
  %59 = load i32, ptr %2, align 4, !tbaa !5
  %60 = icmp slt i32 %58, %59
  br i1 %60, label %62, label %61

61:                                               ; preds = %57
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #6
  br label %81

62:                                               ; preds = %57
  %63 = load i32, ptr %10, align 4, !tbaa !5
  %64 = sext i32 %63 to i64
  %65 = getelementptr inbounds [100010 x i32], ptr @color, i64 0, i64 %64
  %66 = load i32, ptr %65, align 4, !tbaa !5
  %67 = icmp sgt i32 %66, 0
  br i1 %67, label %68, label %77

68:                                               ; preds = %62
  %69 = load i32, ptr %10, align 4, !tbaa !5
  %70 = load i32, ptr %10, align 4, !tbaa !5
  %71 = sext i32 %70 to i64
  %72 = getelementptr inbounds [100010 x i32], ptr @color, i64 0, i64 %71
  %73 = load i32, ptr %72, align 4, !tbaa !5
  %74 = load i32, ptr %9, align 4, !tbaa !5
  call void @_Z3dfsiii(i32 noundef %69, i32 noundef %73, i32 noundef %74)
  %75 = load i32, ptr %9, align 4, !tbaa !5
  %76 = add nsw i32 %75, -1
  store i32 %76, ptr %9, align 4, !tbaa !5
  br label %77

77:                                               ; preds = %68, %62
  br label %78

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

81:                                               ; preds = %61
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #6
  store i32 0, ptr %11, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #6
  store i32 -1, ptr %12, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #6
  store i32 0, ptr %13, align 4, !tbaa !5
  br label %82

82:                                               ; preds = %169, %81
  %83 = load i32, ptr %13, align 4, !tbaa !5
  %84 = load i32, ptr %2, align 4, !tbaa !5
  %85 = icmp slt i32 %83, %84
  br i1 %85, label %87, label %86

86:                                               ; preds = %82
  store i32 11, ptr %14, align 4
  br label %172

87:                                               ; preds = %82
  %88 = load i32, ptr %13, align 4, !tbaa !5
  %89 = sext i32 %88 to i64
  %90 = getelementptr inbounds [100010 x i32], ptr @color, i64 0, i64 %89
  %91 = load i32, ptr %90, align 4, !tbaa !5
  %92 = sub nsw i32 0, %91
  %93 = load i32, ptr %11, align 4, !tbaa !5
  %94 = add nsw i32 %93, 1
  store i32 %94, ptr %11, align 4, !tbaa !5
  %95 = sext i32 %93 to i64
  %96 = getelementptr inbounds [100010 x i32], ptr @stck, i64 0, i64 %95
  store i32 %92, ptr %96, align 4, !tbaa !5
  %97 = load i32, ptr %13, align 4, !tbaa !5
  %98 = sext i32 %97 to i64
  %99 = getelementptr inbounds [100010 x i32], ptr @color, i64 0, i64 %98
  %100 = load i32, ptr %99, align 4, !tbaa !5
  %101 = sub nsw i32 0, %100
  %102 = sext i32 %101 to i64
  %103 = getelementptr inbounds [100010 x i32], ptr @instck, i64 0, i64 %102
  store i32 1, ptr %103, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #6
  %104 = load i32, ptr %13, align 4, !tbaa !5
  %105 = sext i32 %104 to i64
  %106 = getelementptr inbounds [100010 x %"class.std::vector"], ptr @adj, i64 0, i64 %105
  store ptr %106, ptr %15, align 8, !tbaa !13
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #6
  %107 = load ptr, ptr %15, align 8, !tbaa !13
  %108 = call ptr @_ZNSt6vectorIiSaIiEE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) %107) #6
  %109 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %16, i32 0, i32 0
  store ptr %108, ptr %109, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr %17) #6
  %110 = load ptr, ptr %15, align 8, !tbaa !13
  %111 = call ptr @_ZNSt6vectorIiSaIiEE3endEv(ptr noundef nonnull align 8 dereferenceable(24) %110) #6
  %112 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %17, i32 0, i32 0
  store ptr %111, ptr %112, align 8
  br label %113

113:                                              ; preds = %146, %87
  %114 = call noundef zeroext i1 @_ZN9__gnu_cxxneIPiSt6vectorIiSaIiEEEEbRKNS_17__normal_iteratorIT_T0_EESA_(ptr noundef nonnull align 8 dereferenceable(8) %16, ptr noundef nonnull align 8 dereferenceable(8) %17) #6
  br i1 %114, label %116, label %115

115:                                              ; preds = %113
  store i32 14, ptr %14, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #6
  br label %148

116:                                              ; preds = %113
  call void @llvm.lifetime.start.p0(i64 4, ptr %18) #6
  %117 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNK9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %16) #6
  %118 = load i32, ptr %117, align 4, !tbaa !5
  store i32 %118, ptr %18, align 4, !tbaa !5
  %119 = load i32, ptr %18, align 4, !tbaa !5
  %120 = sext i32 %119 to i64
  %121 = getelementptr inbounds [100010 x i32], ptr @color, i64 0, i64 %120
  %122 = load i32, ptr %121, align 4, !tbaa !5
  %123 = sub nsw i32 0, %122
  %124 = sext i32 %123 to i64
  %125 = getelementptr inbounds [100010 x i32], ptr @instck, i64 0, i64 %124
  %126 = load i32, ptr %125, align 4, !tbaa !5
  %127 = icmp ne i32 %126, 0
  br i1 %127, label %145, label %128

128:                                              ; preds = %116
  %129 = load i32, ptr %18, align 4, !tbaa !5
  %130 = sext i32 %129 to i64
  %131 = getelementptr inbounds [100010 x i32], ptr @color, i64 0, i64 %130
  %132 = load i32, ptr %131, align 4, !tbaa !5
  %133 = sub nsw i32 0, %132
  %134 = load i32, ptr %11, align 4, !tbaa !5
  %135 = add nsw i32 %134, 1
  store i32 %135, ptr %11, align 4, !tbaa !5
  %136 = sext i32 %134 to i64
  %137 = getelementptr inbounds [100010 x i32], ptr @stck, i64 0, i64 %136
  store i32 %133, ptr %137, align 4, !tbaa !5
  %138 = load i32, ptr %18, align 4, !tbaa !5
  %139 = sext i32 %138 to i64
  %140 = getelementptr inbounds [100010 x i32], ptr @color, i64 0, i64 %139
  %141 = load i32, ptr %140, align 4, !tbaa !5
  %142 = sub nsw i32 0, %141
  %143 = sext i32 %142 to i64
  %144 = getelementptr inbounds [100010 x i32], ptr @instck, i64 0, i64 %143
  store i32 1, ptr %144, align 4, !tbaa !5
  br label %145

145:                                              ; preds = %128, %116
  call void @llvm.lifetime.end.p0(i64 4, ptr %18) #6
  br label %146

146:                                              ; preds = %145
  %147 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEppEv(ptr noundef nonnull align 8 dereferenceable(8) %16) #6
  br label %113

148:                                              ; preds = %115
  %149 = load i32, ptr %11, align 4, !tbaa !5
  %150 = load i32, ptr %9, align 4, !tbaa !5
  %151 = sub nsw i32 0, %150
  %152 = icmp eq i32 %149, %151
  br i1 %152, label %153, label %156

153:                                              ; preds = %148
  %154 = load i32, ptr %13, align 4, !tbaa !5
  %155 = add nsw i32 %154, 1
  store i32 %155, ptr %12, align 4, !tbaa !5
  store i32 11, ptr %14, align 4
  br label %172

156:                                              ; preds = %148
  br label %157

157:                                              ; preds = %160, %156
  %158 = load i32, ptr %11, align 4, !tbaa !5
  %159 = icmp sgt i32 %158, 0
  br i1 %159, label %160, label %168

160:                                              ; preds = %157
  %161 = load i32, ptr %11, align 4, !tbaa !5
  %162 = add nsw i32 %161, -1
  store i32 %162, ptr %11, align 4, !tbaa !5
  %163 = sext i32 %162 to i64
  %164 = getelementptr inbounds [100010 x i32], ptr @stck, i64 0, i64 %163
  %165 = load i32, ptr %164, align 4, !tbaa !5
  %166 = sext i32 %165 to i64
  %167 = getelementptr inbounds [100010 x i32], ptr @instck, i64 0, i64 %166
  store i32 0, ptr %167, align 4, !tbaa !5
  br label %157, !llvm.loop !15

168:                                              ; preds = %157
  br label %169

169:                                              ; preds = %168
  %170 = load i32, ptr %13, align 4, !tbaa !5
  %171 = add nsw i32 %170, 1
  store i32 %171, ptr %13, align 4, !tbaa !5
  br label %82, !llvm.loop !16

172:                                              ; preds = %153, %86
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #6
  br label %173

173:                                              ; preds = %172
  %174 = load i32, ptr %12, align 4, !tbaa !5
  %175 = icmp eq i32 %174, -1
  br i1 %175, label %176, label %178

176:                                              ; preds = %173
  %177 = call i32 (ptr, ...) @printf(ptr noundef @.str.3)
  br label %181

178:                                              ; preds = %173
  %179 = load i32, ptr %12, align 4, !tbaa !5
  %180 = call i32 (ptr, ...) @printf(ptr noundef @.str.4, i32 noundef %179)
  br label %181

181:                                              ; preds = %178, %176
  store i32 0, ptr %1, align 4
  store i32 1, ptr %14, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #6
  %182 = load i32, ptr %1, align 4
  ret i32 %182
}

declare i32 @__isoc99_scanf(ptr noundef, ...) #5

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

declare i32 @printf(ptr noundef, ...) #5

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 = { 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 = { 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 norecurse 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 = { "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 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
!13 = !{!14, !14, i64 0}
!14 = !{!"any pointer", !7, i64 0}
!15 = distinct !{!15, !10}
!16 = distinct !{!16, !10}


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

@adj = external dso_local global [100010 x %"class.std::vector"], align 16
@color = external dso_local global [100010 x i32], align 16
@instck = external dso_local local_unnamed_addr global [100010 x i32], align 16
@stck = external dso_local local_unnamed_addr global [100010 x i32], align 16
@.str = external hidden unnamed_addr constant [3 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [6 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [8 x i8], align 1

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

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

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

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

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

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #4 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  %6 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %7 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %1) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %2) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %3) #6
  %8 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %1)
  %9 = load i32, ptr %1, align 4, !tbaa !5
  %10 = icmp sgt i32 %9, 1
  br i1 %10, label %.lr.ph, label %.preheader42

.preheader42:                                     ; preds = %.lr.ph, %0
  %11 = phi i32 [ %9, %0 ], [ %27, %.lr.ph ]
  %12 = icmp sgt i32 %11, 0
  br i1 %12, label %.lr.ph46, label %.thread

.lr.ph:                                           ; preds = %0, %.lr.ph
  %.044 = phi i32 [ %26, %.lr.ph ], [ 1, %0 ]
  %13 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.2, ptr noundef nonnull %2, ptr noundef nonnull %3)
  %14 = load i32, ptr %2, align 4, !tbaa !5
  %15 = add nsw i32 %14, -1
  %16 = sext i32 %15 to i64
  %17 = getelementptr inbounds [100010 x %"class.std::vector"], ptr @adj, i64 0, i64 %16
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %4) #6
  %18 = load i32, ptr %3, align 4, !tbaa !5
  %19 = add nsw i32 %18, -1
  store i32 %19, ptr %4, align 4, !tbaa !5
  call void @_ZNSt6vectorIiSaIiEE9push_backEOi(ptr noundef nonnull align 8 dereferenceable(24) %17, ptr noundef nonnull align 4 dereferenceable(4) %4)
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %4) #6
  %20 = load i32, ptr %3, align 4, !tbaa !5
  %21 = add nsw i32 %20, -1
  %22 = sext i32 %21 to i64
  %23 = getelementptr inbounds [100010 x %"class.std::vector"], ptr @adj, i64 0, i64 %22
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %5) #6
  %24 = load i32, ptr %2, align 4, !tbaa !5
  %25 = add nsw i32 %24, -1
  store i32 %25, ptr %5, align 4, !tbaa !5
  call void @_ZNSt6vectorIiSaIiEE9push_backEOi(ptr noundef nonnull align 8 dereferenceable(24) %23, ptr noundef nonnull align 4 dereferenceable(4) %5)
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %5) #6
  %26 = add nuw nsw i32 %.044, 1
  %27 = load i32, ptr %1, align 4, !tbaa !5
  %28 = icmp slt i32 %26, %27
  br i1 %28, label %.lr.ph, label %.preheader42, !llvm.loop !9

.preheader41:                                     ; preds = %.lr.ph46
  %29 = icmp sgt i32 %32, 0
  br i1 %29, label %.lr.ph49, label %.thread

.lr.ph46:                                         ; preds = %.preheader42, %.lr.ph46
  %indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph46 ], [ 0, %.preheader42 ]
  %30 = getelementptr inbounds [100010 x i32], ptr @color, i64 0, i64 %indvars.iv
  %31 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %30)
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %32 = load i32, ptr %1, align 4, !tbaa !5
  %33 = sext i32 %32 to i64
  %34 = icmp slt i64 %indvars.iv.next, %33
  br i1 %34, label %.lr.ph46, label %.preheader41, !llvm.loop !11

.preheader40:                                     ; preds = %44
  %35 = icmp sgt i32 %45, 0
  br i1 %35, label %.lr.ph59, label %.thread

.lr.ph59:                                         ; preds = %.preheader40
  %36 = sub nsw i32 0, %.136
  br label %48

.lr.ph49:                                         ; preds = %.preheader41, %44
  %37 = phi i32 [ %45, %44 ], [ %32, %.preheader41 ]
  %indvars.iv62 = phi i64 [ %indvars.iv.next63, %44 ], [ 0, %.preheader41 ]
  %.03547 = phi i32 [ %.136, %44 ], [ 0, %.preheader41 ]
  %38 = getelementptr inbounds [100010 x i32], ptr @color, i64 0, i64 %indvars.iv62
  %39 = load i32, ptr %38, align 4, !tbaa !5
  %40 = icmp sgt i32 %39, 0
  br i1 %40, label %41, label %44

41:                                               ; preds = %.lr.ph49
  %42 = trunc nuw nsw i64 %indvars.iv62 to i32
  call void @_Z3dfsiii(i32 noundef %42, i32 noundef %39, i32 noundef %.03547)
  %43 = add nsw i32 %.03547, -1
  %.pre = load i32, ptr %1, align 4, !tbaa !5
  br label %44

44:                                               ; preds = %.lr.ph49, %41
  %45 = phi i32 [ %.pre, %41 ], [ %37, %.lr.ph49 ]
  %.136 = phi i32 [ %43, %41 ], [ %.03547, %.lr.ph49 ]
  %indvars.iv.next63 = add nuw nsw i64 %indvars.iv62, 1
  %46 = sext i32 %45 to i64
  %47 = icmp slt i64 %indvars.iv.next63, %46
  br i1 %47, label %.lr.ph49, label %.preheader40, !llvm.loop !12

48:                                               ; preds = %.lr.ph59, %._crit_edge55
  %indvars.iv68 = phi i64 [ 0, %.lr.ph59 ], [ %indvars.iv.next69, %._crit_edge55 ]
  %.03357 = phi i32 [ 0, %.lr.ph59 ], [ %.3.lcssa, %._crit_edge55 ]
  %49 = getelementptr inbounds [100010 x i32], ptr @color, i64 0, i64 %indvars.iv68
  %50 = load i32, ptr %49, align 4, !tbaa !5
  %51 = sub nsw i32 0, %50
  %52 = add nsw i32 %.03357, 1
  %53 = sext i32 %.03357 to i64
  %54 = getelementptr inbounds [100010 x i32], ptr @stck, i64 0, i64 %53
  store i32 %51, ptr %54, align 4, !tbaa !5
  %55 = sext i32 %51 to i64
  %56 = getelementptr inbounds [100010 x i32], ptr @instck, i64 0, i64 %55
  store i32 1, ptr %56, align 4, !tbaa !5
  %57 = getelementptr inbounds [100010 x %"class.std::vector"], ptr @adj, i64 0, i64 %indvars.iv68
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %6) #6
  %58 = call ptr @_ZNSt6vectorIiSaIiEE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) %57) #6
  store ptr %58, ptr %6, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %7) #6
  %59 = call ptr @_ZNSt6vectorIiSaIiEE3endEv(ptr noundef nonnull align 8 dereferenceable(24) %57) #6
  store ptr %59, ptr %7, align 8
  %60 = call noundef zeroext i1 @_ZN9__gnu_cxxneIPiSt6vectorIiSaIiEEEEbRKNS_17__normal_iteratorIT_T0_EESA_(ptr noundef nonnull align 8 dereferenceable(8) %6, ptr noundef nonnull align 8 dereferenceable(8) %7) #6
  br i1 %60, label %.lr.ph51, label %._crit_edge

._crit_edge:                                      ; preds = %82, %48
  %.1.lcssa = phi i32 [ %52, %48 ], [ %.2, %82 ]
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %7) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %6) #6
  %61 = icmp eq i32 %.1.lcssa, %36
  br i1 %61, label %106, label %.preheader

.preheader:                                       ; preds = %._crit_edge
  %62 = icmp sgt i32 %.1.lcssa, 0
  br i1 %62, label %.lr.ph54.preheader, label %._crit_edge55

.lr.ph54.preheader:                               ; preds = %.preheader
  %63 = zext nneg i32 %.1.lcssa to i64
  %xtraiter = and i64 %63, 3
  %lcmp.mod.not = icmp eq i64 %xtraiter, 0
  br i1 %lcmp.mod.not, label %.lr.ph54.prol.loopexit, label %.lr.ph54.prol

.lr.ph54.prol:                                    ; preds = %.lr.ph54.preheader, %.lr.ph54.prol
  %indvars.iv65.prol = phi i64 [ %indvars.iv.next66.prol, %.lr.ph54.prol ], [ %63, %.lr.ph54.preheader ]
  %prol.iter = phi i64 [ %prol.iter.next, %.lr.ph54.prol ], [ 0, %.lr.ph54.preheader ]
  %indvars.iv.next66.prol = add nsw i64 %indvars.iv65.prol, -1
  %64 = getelementptr inbounds [100010 x i32], ptr @stck, i64 0, i64 %indvars.iv.next66.prol
  %65 = load i32, ptr %64, align 4, !tbaa !5
  %66 = sext i32 %65 to i64
  %67 = getelementptr inbounds [100010 x i32], ptr @instck, i64 0, i64 %66
  store i32 0, ptr %67, align 4, !tbaa !5
  %prol.iter.next = add i64 %prol.iter, 1
  %prol.iter.cmp.not = icmp eq i64 %prol.iter.next, %xtraiter
  br i1 %prol.iter.cmp.not, label %.lr.ph54.prol.loopexit, label %.lr.ph54.prol, !llvm.loop !13

.lr.ph54.prol.loopexit:                           ; preds = %.lr.ph54.prol, %.lr.ph54.preheader
  %indvars.iv65.unr = phi i64 [ %63, %.lr.ph54.preheader ], [ %indvars.iv.next66.prol, %.lr.ph54.prol ]
  %68 = icmp ult i32 %.1.lcssa, 4
  br i1 %68, label %._crit_edge55, label %.lr.ph54

.lr.ph51:                                         ; preds = %48, %82
  %.150 = phi i32 [ %.2, %82 ], [ %52, %48 ]
  %69 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNK9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %6) #6
  %70 = load i32, ptr %69, align 4, !tbaa !5
  %71 = sext i32 %70 to i64
  %72 = getelementptr inbounds [100010 x i32], ptr @color, i64 0, i64 %71
  %73 = load i32, ptr %72, align 4, !tbaa !5
  %74 = sub nsw i32 0, %73
  %75 = sext i32 %74 to i64
  %76 = getelementptr inbounds [100010 x i32], ptr @instck, i64 0, i64 %75
  %77 = load i32, ptr %76, align 4, !tbaa !5
  %.not = icmp eq i32 %77, 0
  br i1 %.not, label %78, label %82

78:                                               ; preds = %.lr.ph51
  %79 = add nsw i32 %.150, 1
  %80 = sext i32 %.150 to i64
  %81 = getelementptr inbounds [100010 x i32], ptr @stck, i64 0, i64 %80
  store i32 %74, ptr %81, align 4, !tbaa !5
  store i32 1, ptr %76, align 4, !tbaa !5
  br label %82

82:                                               ; preds = %78, %.lr.ph51
  %.2 = phi i32 [ %.150, %.lr.ph51 ], [ %79, %78 ]
  %83 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEppEv(ptr noundef nonnull align 8 dereferenceable(8) %6) #6
  %84 = call noundef zeroext i1 @_ZN9__gnu_cxxneIPiSt6vectorIiSaIiEEEEbRKNS_17__normal_iteratorIT_T0_EESA_(ptr noundef nonnull align 8 dereferenceable(8) %6, ptr noundef nonnull align 8 dereferenceable(8) %7) #6
  br i1 %84, label %.lr.ph51, label %._crit_edge

.lr.ph54:                                         ; preds = %.lr.ph54.prol.loopexit, %.lr.ph54
  %indvars.iv65 = phi i64 [ %indvars.iv.next66.3, %.lr.ph54 ], [ %indvars.iv65.unr, %.lr.ph54.prol.loopexit ]
  %indvars.iv.next66 = add nsw i64 %indvars.iv65, -1
  %85 = getelementptr inbounds [100010 x i32], ptr @stck, i64 0, i64 %indvars.iv.next66
  %86 = load i32, ptr %85, align 4, !tbaa !5
  %87 = sext i32 %86 to i64
  %88 = getelementptr inbounds [100010 x i32], ptr @instck, i64 0, i64 %87
  store i32 0, ptr %88, align 4, !tbaa !5
  %indvars.iv.next66.1 = add nsw i64 %indvars.iv65, -2
  %89 = getelementptr inbounds [100010 x i32], ptr @stck, i64 0, i64 %indvars.iv.next66.1
  %90 = load i32, ptr %89, align 4, !tbaa !5
  %91 = sext i32 %90 to i64
  %92 = getelementptr inbounds [100010 x i32], ptr @instck, i64 0, i64 %91
  store i32 0, ptr %92, align 4, !tbaa !5
  %indvars.iv.next66.2 = add nsw i64 %indvars.iv65, -3
  %93 = getelementptr inbounds [100010 x i32], ptr @stck, i64 0, i64 %indvars.iv.next66.2
  %94 = load i32, ptr %93, align 4, !tbaa !5
  %95 = sext i32 %94 to i64
  %96 = getelementptr inbounds [100010 x i32], ptr @instck, i64 0, i64 %95
  store i32 0, ptr %96, align 4, !tbaa !5
  %indvars.iv.next66.3 = add nsw i64 %indvars.iv65, -4
  %97 = getelementptr inbounds [100010 x i32], ptr @stck, i64 0, i64 %indvars.iv.next66.3
  %98 = load i32, ptr %97, align 4, !tbaa !5
  %99 = sext i32 %98 to i64
  %100 = getelementptr inbounds [100010 x i32], ptr @instck, i64 0, i64 %99
  store i32 0, ptr %100, align 4, !tbaa !5
  %101 = icmp ugt i64 %indvars.iv.next66.2, 1
  br i1 %101, label %.lr.ph54, label %._crit_edge55, !llvm.loop !15

._crit_edge55:                                    ; preds = %.lr.ph54.prol.loopexit, %.lr.ph54, %.preheader
  %.3.lcssa = phi i32 [ %.1.lcssa, %.preheader ], [ 0, %.lr.ph54 ], [ 0, %.lr.ph54.prol.loopexit ]
  %indvars.iv.next69 = add nuw nsw i64 %indvars.iv68, 1
  %102 = load i32, ptr %1, align 4, !tbaa !5
  %103 = sext i32 %102 to i64
  %104 = icmp slt i64 %indvars.iv.next69, %103
  br i1 %104, label %48, label %.thread, !llvm.loop !16

.thread:                                          ; preds = %._crit_edge55, %.preheader42, %.preheader41, %.preheader40
  %105 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3)
  br label %110

106:                                              ; preds = %._crit_edge
  %107 = trunc nuw nsw i64 %indvars.iv68 to i32
  %108 = add nuw nsw i32 %107, 1
  %109 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.4, i32 noundef %108)
  br label %110

110:                                              ; preds = %106, %.thread
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %3) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %2) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #6
  ret i32 0
}

; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #5

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

; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #5

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 nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { 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 = { 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 norecurse 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 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #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 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.unroll.disable"}
!15 = distinct !{!15, !10}
!16 = distinct !{!16, !10}


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