; LLVM IR from reyadussalahin/problem-solving :: graph/bfs/codeforces/F501C (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
@d = external dso_local global [100010 x i32], align 16
@s = external dso_local global [100010 x i32], align 16
@q = external dso_local global [100010 x i32], align 16
@p = 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 [7 x i8], align 1

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

17:                                               ; preds = %33, %0
  %18 = load i32, ptr %3, align 4, !tbaa !5
  %19 = load i32, ptr %2, align 4, !tbaa !5
  %20 = icmp slt i32 %18, %19
  br i1 %20, label %22, label %21

21:                                               ; preds = %17
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #6
  br label %36

22:                                               ; preds = %17
  %23 = load i32, ptr %3, align 4, !tbaa !5
  %24 = sext i32 %23 to i64
  %25 = getelementptr inbounds [100010 x i32], ptr @p, i64 0, i64 %24
  store i32 -1, ptr %25, align 4, !tbaa !5
  %26 = load i32, ptr %3, align 4, !tbaa !5
  %27 = sext i32 %26 to i64
  %28 = getelementptr inbounds [100010 x i32], ptr @d, i64 0, i64 %27
  %29 = load i32, ptr %3, align 4, !tbaa !5
  %30 = sext i32 %29 to i64
  %31 = getelementptr inbounds [100010 x i32], ptr @s, i64 0, i64 %30
  %32 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.2, ptr noundef %28, ptr noundef %31)
  br label %33

33:                                               ; preds = %22
  %34 = load i32, ptr %3, align 4, !tbaa !5
  %35 = add nsw i32 %34, 1
  store i32 %35, ptr %3, align 4, !tbaa !5
  br label %17, !llvm.loop !9

36:                                               ; preds = %21
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #6
  store i32 0, ptr %4, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #6
  store i32 0, ptr %5, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #6
  store i32 0, ptr %6, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #6
  store i32 0, ptr %7, align 4, !tbaa !5
  br label %37

37:                                               ; preds = %55, %36
  %38 = load i32, ptr %7, align 4, !tbaa !5
  %39 = load i32, ptr %2, align 4, !tbaa !5
  %40 = icmp slt i32 %38, %39
  br i1 %40, label %42, label %41

41:                                               ; preds = %37
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #6
  br label %58

42:                                               ; preds = %37
  %43 = load i32, ptr %7, align 4, !tbaa !5
  %44 = sext i32 %43 to i64
  %45 = getelementptr inbounds [100010 x i32], ptr @d, i64 0, i64 %44
  %46 = load i32, ptr %45, align 4, !tbaa !5
  %47 = icmp eq i32 %46, 1
  br i1 %47, label %48, label %54

48:                                               ; preds = %42
  %49 = load i32, ptr %7, align 4, !tbaa !5
  %50 = load i32, ptr %6, align 4, !tbaa !5
  %51 = add nsw i32 %50, 1
  store i32 %51, ptr %6, align 4, !tbaa !5
  %52 = sext i32 %50 to i64
  %53 = getelementptr inbounds [100010 x i32], ptr @q, i64 0, i64 %52
  store i32 %49, ptr %53, align 4, !tbaa !5
  br label %54

54:                                               ; preds = %48, %42
  br label %55

55:                                               ; preds = %54
  %56 = load i32, ptr %7, align 4, !tbaa !5
  %57 = add nsw i32 %56, 1
  store i32 %57, ptr %7, align 4, !tbaa !5
  br label %37, !llvm.loop !11

58:                                               ; preds = %41
  br label %59

59:                                               ; preds = %110, %108, %58
  %60 = load i32, ptr %5, align 4, !tbaa !5
  %61 = load i32, ptr %6, align 4, !tbaa !5
  %62 = icmp ne i32 %60, %61
  br i1 %62, label %63, label %111

63:                                               ; preds = %59
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #6
  %64 = load i32, ptr %5, align 4, !tbaa !5
  %65 = add nsw i32 %64, 1
  store i32 %65, ptr %5, align 4, !tbaa !5
  %66 = sext i32 %64 to i64
  %67 = getelementptr inbounds [100010 x i32], ptr @q, i64 0, i64 %66
  %68 = load i32, ptr %67, align 4, !tbaa !5
  store i32 %68, ptr %8, align 4, !tbaa !5
  %69 = load i32, ptr %8, align 4, !tbaa !5
  %70 = sext i32 %69 to i64
  %71 = getelementptr inbounds [100010 x i32], ptr @d, i64 0, i64 %70
  %72 = load i32, ptr %71, align 4, !tbaa !5
  %73 = icmp eq i32 %72, 0
  br i1 %73, label %74, label %75

74:                                               ; preds = %63
  store i32 8, ptr %9, align 4
  br label %108, !llvm.loop !12

75:                                               ; preds = %63
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #6
  %76 = load i32, ptr %8, align 4, !tbaa !5
  %77 = sext i32 %76 to i64
  %78 = getelementptr inbounds [100010 x i32], ptr @s, i64 0, i64 %77
  %79 = load i32, ptr %78, align 4, !tbaa !5
  store i32 %79, ptr %10, align 4, !tbaa !5
  %80 = load i32, ptr %8, align 4, !tbaa !5
  %81 = load i32, ptr %10, align 4, !tbaa !5
  %82 = sext i32 %81 to i64
  %83 = getelementptr inbounds [100010 x i32], ptr @s, i64 0, i64 %82
  %84 = load i32, ptr %83, align 4, !tbaa !5
  %85 = xor i32 %84, %80
  store i32 %85, ptr %83, align 4, !tbaa !5
  %86 = load i32, ptr %10, align 4, !tbaa !5
  %87 = sext i32 %86 to i64
  %88 = getelementptr inbounds [100010 x i32], ptr @d, i64 0, i64 %87
  %89 = load i32, ptr %88, align 4, !tbaa !5
  %90 = add nsw i32 %89, -1
  store i32 %90, ptr %88, align 4, !tbaa !5
  %91 = load i32, ptr %8, align 4, !tbaa !5
  %92 = sext i32 %91 to i64
  %93 = getelementptr inbounds [100010 x %"class.std::vector"], ptr @adj, i64 0, i64 %92
  call void @_ZNSt6vectorIiSaIiEE9push_backERKi(ptr noundef nonnull align 8 dereferenceable(24) %93, ptr noundef nonnull align 4 dereferenceable(4) %10)
  %94 = load i32, ptr %4, align 4, !tbaa !5
  %95 = add nsw i32 %94, 1
  store i32 %95, ptr %4, align 4, !tbaa !5
  %96 = load i32, ptr %10, align 4, !tbaa !5
  %97 = sext i32 %96 to i64
  %98 = getelementptr inbounds [100010 x i32], ptr @d, i64 0, i64 %97
  %99 = load i32, ptr %98, align 4, !tbaa !5
  %100 = icmp eq i32 %99, 1
  br i1 %100, label %101, label %107

101:                                              ; preds = %75
  %102 = load i32, ptr %10, align 4, !tbaa !5
  %103 = load i32, ptr %6, align 4, !tbaa !5
  %104 = add nsw i32 %103, 1
  store i32 %104, ptr %6, align 4, !tbaa !5
  %105 = sext i32 %103 to i64
  %106 = getelementptr inbounds [100010 x i32], ptr @q, i64 0, i64 %105
  store i32 %102, ptr %106, align 4, !tbaa !5
  br label %107

107:                                              ; preds = %101, %75
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #6
  store i32 0, ptr %9, align 4
  br label %108

108:                                              ; preds = %107, %74
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #6
  %109 = load i32, ptr %9, align 4
  switch i32 %109, label %146 [
    i32 0, label %110
    i32 8, label %59
  ]

110:                                              ; preds = %108
  br label %59, !llvm.loop !12

111:                                              ; preds = %59
  %112 = load i32, ptr %4, align 4, !tbaa !5
  %113 = call i32 (ptr, ...) @printf(ptr noundef @.str.3, i32 noundef %112)
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #6
  store i32 0, ptr %11, align 4, !tbaa !5
  br label %114

114:                                              ; preds = %141, %111
  %115 = load i32, ptr %11, align 4, !tbaa !5
  %116 = load i32, ptr %2, align 4, !tbaa !5
  %117 = icmp slt i32 %115, %116
  br i1 %117, label %119, label %118

118:                                              ; preds = %114
  store i32 10, ptr %9, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #6
  br label %144

119:                                              ; preds = %114
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #6
  %120 = load i32, ptr %11, align 4, !tbaa !5
  %121 = sext i32 %120 to i64
  %122 = getelementptr inbounds [100010 x %"class.std::vector"], ptr @adj, i64 0, i64 %121
  store ptr %122, ptr %12, align 8, !tbaa !13
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #6
  %123 = load ptr, ptr %12, align 8, !tbaa !13
  %124 = call ptr @_ZNSt6vectorIiSaIiEE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) %123) #6
  %125 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %13, i32 0, i32 0
  store ptr %124, ptr %125, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #6
  %126 = load ptr, ptr %12, align 8, !tbaa !13
  %127 = call ptr @_ZNSt6vectorIiSaIiEE3endEv(ptr noundef nonnull align 8 dereferenceable(24) %126) #6
  %128 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %14, i32 0, i32 0
  store ptr %127, ptr %128, align 8
  br label %129

129:                                              ; preds = %138, %119
  %130 = call noundef zeroext i1 @_ZN9__gnu_cxxneIPiSt6vectorIiSaIiEEEEbRKNS_17__normal_iteratorIT_T0_EESA_(ptr noundef nonnull align 8 dereferenceable(8) %13, ptr noundef nonnull align 8 dereferenceable(8) %14) #6
  br i1 %130, label %132, label %131

131:                                              ; preds = %129
  store i32 13, ptr %9, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #6
  br label %140

132:                                              ; preds = %129
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #6
  %133 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNK9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %13) #6
  %134 = load i32, ptr %133, align 4, !tbaa !5
  store i32 %134, ptr %15, align 4, !tbaa !5
  %135 = load i32, ptr %11, align 4, !tbaa !5
  %136 = load i32, ptr %15, align 4, !tbaa !5
  %137 = call i32 (ptr, ...) @printf(ptr noundef @.str.4, i32 noundef %135, i32 noundef %136)
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #6
  br label %138

138:                                              ; preds = %132
  %139 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEppEv(ptr noundef nonnull align 8 dereferenceable(8) %13) #6
  br label %129

140:                                              ; preds = %131
  br label %141

141:                                              ; preds = %140
  %142 = load i32, ptr %11, align 4, !tbaa !5
  %143 = add nsw i32 %142, 1
  store i32 %143, ptr %11, align 4, !tbaa !5
  br label %114, !llvm.loop !15

144:                                              ; preds = %118
  store i32 0, ptr %1, align 4
  store i32 1, ptr %9, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #6
  %145 = load i32, ptr %1, align 4
  ret i32 %145

146:                                              ; preds = %108
  unreachable
}

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

declare i32 @__isoc99_scanf(ptr noundef, ...) #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 uwtable
declare dso_local void @_ZNSt6vectorIiSaIiEE9push_backERKi(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 4 dereferenceable(4)) #3 align 2

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

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

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

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

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

attributes #0 = { 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 #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { "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 = { 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 = { 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 #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}


; 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
@d = external dso_local global [100010 x i32], align 16
@s = external dso_local global [100010 x i32], align 16
@q = external dso_local local_unnamed_addr global [100010 x i32], align 16
@p = 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 [7 x i8], align 1

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

.preheader33:                                     ; preds = %.lr.ph
  %8 = icmp sgt i32 %14, 0
  br i1 %8, label %.lr.ph37.preheader, label %._crit_edge

.lr.ph37.preheader:                               ; preds = %.preheader33
  %wide.trip.count = zext nneg i32 %14 to i64
  %xtraiter = and i64 %wide.trip.count, 1
  %9 = icmp eq i32 %14, 1
  br i1 %9, label %.preheader.unr-lcssa, label %.lr.ph37.preheader.new

.lr.ph37.preheader.new:                           ; preds = %.lr.ph37.preheader
  %unroll_iter = and i64 %wide.trip.count, 2147483646
  br label %.lr.ph37

.lr.ph:                                           ; preds = %0, %.lr.ph
  %indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph ], [ 0, %0 ]
  %10 = getelementptr inbounds [100010 x i32], ptr @p, i64 0, i64 %indvars.iv
  store i32 -1, ptr %10, align 4, !tbaa !5
  %11 = getelementptr inbounds [100010 x i32], ptr @d, i64 0, i64 %indvars.iv
  %12 = getelementptr inbounds [100010 x i32], ptr @s, i64 0, i64 %indvars.iv
  %13 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.2, ptr noundef nonnull %11, ptr noundef nonnull %12)
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %14 = load i32, ptr %1, align 4, !tbaa !5
  %15 = sext i32 %14 to i64
  %16 = icmp slt i64 %indvars.iv.next, %15
  br i1 %16, label %.lr.ph, label %.preheader33, !llvm.loop !9

.preheader.unr-lcssa:                             ; preds = %41, %.lr.ph37.preheader
  %.131.lcssa.ph = phi i32 [ poison, %.lr.ph37.preheader ], [ %.131.1, %41 ]
  %indvars.iv54.unr = phi i64 [ 0, %.lr.ph37.preheader ], [ %indvars.iv.next55.1, %41 ]
  %.03035.unr = phi i32 [ 0, %.lr.ph37.preheader ], [ %.131.1, %41 ]
  %lcmp.mod.not = icmp eq i64 %xtraiter, 0
  br i1 %lcmp.mod.not, label %.preheader, label %.lr.ph37.epil

.lr.ph37.epil:                                    ; preds = %.preheader.unr-lcssa
  %17 = getelementptr inbounds [100010 x i32], ptr @d, i64 0, i64 %indvars.iv54.unr
  %18 = load i32, ptr %17, align 4, !tbaa !5
  %19 = icmp eq i32 %18, 1
  br i1 %19, label %20, label %.preheader

20:                                               ; preds = %.lr.ph37.epil
  %21 = add nsw i32 %.03035.unr, 1
  %22 = sext i32 %.03035.unr to i64
  %23 = getelementptr inbounds [100010 x i32], ptr @q, i64 0, i64 %22
  %24 = trunc nuw nsw i64 %indvars.iv54.unr to i32
  store i32 %24, ptr %23, align 4, !tbaa !5
  br label %.preheader

.preheader:                                       ; preds = %.lr.ph37.epil, %20, %.preheader.unr-lcssa
  %.131.lcssa = phi i32 [ %.131.lcssa.ph, %.preheader.unr-lcssa ], [ %21, %20 ], [ %.03035.unr, %.lr.ph37.epil ]
  %.not39 = icmp eq i32 %.131.lcssa, 0
  br i1 %.not39, label %._crit_edge, label %.lr.ph43

.lr.ph37:                                         ; preds = %41, %.lr.ph37.preheader.new
  %indvars.iv54 = phi i64 [ 0, %.lr.ph37.preheader.new ], [ %indvars.iv.next55.1, %41 ]
  %.03035 = phi i32 [ 0, %.lr.ph37.preheader.new ], [ %.131.1, %41 ]
  %niter = phi i64 [ 0, %.lr.ph37.preheader.new ], [ %niter.next.1, %41 ]
  %25 = getelementptr inbounds [100010 x i32], ptr @d, i64 0, i64 %indvars.iv54
  %26 = load i32, ptr %25, align 8, !tbaa !5
  %27 = icmp eq i32 %26, 1
  br i1 %27, label %28, label %.lr.ph37.1

28:                                               ; preds = %.lr.ph37
  %29 = add nsw i32 %.03035, 1
  %30 = sext i32 %.03035 to i64
  %31 = getelementptr inbounds [100010 x i32], ptr @q, i64 0, i64 %30
  %32 = trunc nuw nsw i64 %indvars.iv54 to i32
  store i32 %32, ptr %31, align 4, !tbaa !5
  br label %.lr.ph37.1

.lr.ph37.1:                                       ; preds = %.lr.ph37, %28
  %.131 = phi i32 [ %29, %28 ], [ %.03035, %.lr.ph37 ]
  %indvars.iv.next55 = or disjoint i64 %indvars.iv54, 1
  %33 = getelementptr inbounds [100010 x i32], ptr @d, i64 0, i64 %indvars.iv.next55
  %34 = load i32, ptr %33, align 4, !tbaa !5
  %35 = icmp eq i32 %34, 1
  br i1 %35, label %36, label %41

36:                                               ; preds = %.lr.ph37.1
  %37 = add nsw i32 %.131, 1
  %38 = sext i32 %.131 to i64
  %39 = getelementptr inbounds [100010 x i32], ptr @q, i64 0, i64 %38
  %40 = trunc nuw nsw i64 %indvars.iv.next55 to i32
  store i32 %40, ptr %39, align 4, !tbaa !5
  br label %41

41:                                               ; preds = %36, %.lr.ph37.1
  %.131.1 = phi i32 [ %37, %36 ], [ %.131, %.lr.ph37.1 ]
  %indvars.iv.next55.1 = add nuw nsw i64 %indvars.iv54, 2
  %niter.next.1 = add i64 %niter, 2
  %niter.ncmp.1 = icmp eq i64 %niter.next.1, %unroll_iter
  br i1 %niter.ncmp.1, label %.preheader.unr-lcssa, label %.lr.ph37, !llvm.loop !11

.lr.ph43:                                         ; preds = %.preheader, %70
  %indvars.iv57 = phi i64 [ %indvars.iv.next58, %70 ], [ 0, %.preheader ]
  %.02842 = phi i32 [ %.1, %70 ], [ 0, %.preheader ]
  %.241 = phi i32 [ %.4, %70 ], [ %.131.lcssa, %.preheader ]
  %indvars.iv.next58 = add nuw nsw i64 %indvars.iv57, 1
  %42 = getelementptr inbounds [100010 x i32], ptr @q, i64 0, i64 %indvars.iv57
  %43 = load i32, ptr %42, align 4, !tbaa !5
  %44 = sext i32 %43 to i64
  %45 = getelementptr inbounds [100010 x i32], ptr @d, i64 0, i64 %44
  %46 = load i32, ptr %45, align 4, !tbaa !5
  %47 = icmp eq i32 %46, 0
  br i1 %47, label %70, label %48, !llvm.loop !12

48:                                               ; preds = %.lr.ph43
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %2) #6
  %49 = getelementptr inbounds [100010 x i32], ptr @s, i64 0, i64 %44
  %50 = load i32, ptr %49, align 4, !tbaa !5
  store i32 %50, ptr %2, align 4, !tbaa !5
  %51 = sext i32 %50 to i64
  %52 = getelementptr inbounds [100010 x i32], ptr @s, i64 0, i64 %51
  %53 = load i32, ptr %52, align 4, !tbaa !5
  %54 = xor i32 %53, %43
  store i32 %54, ptr %52, align 4, !tbaa !5
  %55 = getelementptr inbounds [100010 x i32], ptr @d, i64 0, i64 %51
  %56 = load i32, ptr %55, align 4, !tbaa !5
  %57 = add nsw i32 %56, -1
  store i32 %57, ptr %55, align 4, !tbaa !5
  %58 = getelementptr inbounds [100010 x %"class.std::vector"], ptr @adj, i64 0, i64 %44
  call void @_ZNSt6vectorIiSaIiEE9push_backERKi(ptr noundef nonnull align 8 dereferenceable(24) %58, ptr noundef nonnull align 4 dereferenceable(4) %2)
  %59 = add nsw i32 %.02842, 1
  %60 = load i32, ptr %2, align 4, !tbaa !5
  %61 = sext i32 %60 to i64
  %62 = getelementptr inbounds [100010 x i32], ptr @d, i64 0, i64 %61
  %63 = load i32, ptr %62, align 4, !tbaa !5
  %64 = icmp eq i32 %63, 1
  br i1 %64, label %65, label %69

65:                                               ; preds = %48
  %66 = add nsw i32 %.241, 1
  %67 = sext i32 %.241 to i64
  %68 = getelementptr inbounds [100010 x i32], ptr @q, i64 0, i64 %67
  store i32 %60, ptr %68, align 4, !tbaa !5
  br label %69

69:                                               ; preds = %65, %48
  %.3 = phi i32 [ %66, %65 ], [ %.241, %48 ]
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %2) #6
  br label %70

70:                                               ; preds = %.lr.ph43, %69
  %.4 = phi i32 [ %.3, %69 ], [ %.241, %.lr.ph43 ]
  %.1 = phi i32 [ %59, %69 ], [ %.02842, %.lr.ph43 ]
  %71 = zext i32 %.4 to i64
  %.not = icmp eq i64 %indvars.iv.next58, %71
  br i1 %.not, label %._crit_edge, label %.lr.ph43

._crit_edge:                                      ; preds = %70, %0, %.preheader33, %.preheader
  %.028.lcssa = phi i32 [ 0, %.preheader ], [ 0, %.preheader33 ], [ 0, %0 ], [ %.1, %70 ]
  %72 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %.028.lcssa)
  %73 = load i32, ptr %1, align 4, !tbaa !5
  %74 = icmp sgt i32 %73, 0
  br i1 %74, label %.lr.ph50, label %._crit_edge51

._crit_edge51:                                    ; preds = %._crit_edge47, %._crit_edge
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #6
  ret i32 0

.lr.ph50:                                         ; preds = %._crit_edge, %._crit_edge47
  %indvars.iv60 = phi i64 [ %indvars.iv.next61, %._crit_edge47 ], [ 0, %._crit_edge ]
  %75 = getelementptr inbounds [100010 x %"class.std::vector"], ptr @adj, i64 0, i64 %indvars.iv60
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %3) #6
  %76 = call ptr @_ZNSt6vectorIiSaIiEE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) %75) #6
  store ptr %76, ptr %3, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %4) #6
  %77 = call ptr @_ZNSt6vectorIiSaIiEE3endEv(ptr noundef nonnull align 8 dereferenceable(24) %75) #6
  store ptr %77, ptr %4, align 8
  %78 = 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) #6
  br i1 %78, label %.lr.ph46.preheader, label %._crit_edge47

.lr.ph46.preheader:                               ; preds = %.lr.ph50
  %79 = trunc nuw nsw i64 %indvars.iv60 to i32
  br label %.lr.ph46

._crit_edge47:                                    ; preds = %.lr.ph46, %.lr.ph50
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %3) #6
  %indvars.iv.next61 = add nuw nsw i64 %indvars.iv60, 1
  %80 = load i32, ptr %1, align 4, !tbaa !5
  %81 = sext i32 %80 to i64
  %82 = icmp slt i64 %indvars.iv.next61, %81
  br i1 %82, label %.lr.ph50, label %._crit_edge51, !llvm.loop !13

.lr.ph46:                                         ; preds = %.lr.ph46.preheader, %.lr.ph46
  %83 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNK9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %3) #6
  %84 = load i32, ptr %83, align 4, !tbaa !5
  %85 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.4, i32 noundef %79, i32 noundef %84)
  %86 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEppEv(ptr noundef nonnull align 8 dereferenceable(8) %3) #6
  %87 = 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) #6
  br i1 %87, label %.lr.ph46, label %._crit_edge47
}

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

; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #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 uwtable
declare dso_local void @_ZNSt6vectorIiSaIiEE9push_backERKi(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 4 dereferenceable(4)) local_unnamed_addr #3 align 2

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

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

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

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

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

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


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