; LLVM IR from xirc/cp-algorithm :: spoj/lego/main.ll (Z5solvev)

; 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<block, std::allocator<block>>::_Vector_impl" }
%"struct.std::_Vector_base<block, std::allocator<block>>::_Vector_impl" = type { %"struct.std::_Vector_base<block, std::allocator<block>>::_Vector_impl_data" }
%"struct.std::_Vector_base<block, std::allocator<block>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%class.SCC = type { i32, %"class.std::vector.0", %"class.std::vector.0" }
%"class.std::vector.0" = type { %"struct.std::_Vector_base.1" }
%"struct.std::_Vector_base.1" = type { %"struct.std::_Vector_base<std::vector<int>, std::allocator<std::vector<int>>>::_Vector_impl" }
%"struct.std::_Vector_base<std::vector<int>, std::allocator<std::vector<int>>>::_Vector_impl" = type { %"struct.std::_Vector_base<std::vector<int>, std::allocator<std::vector<int>>>::_Vector_impl_data" }
%"struct.std::_Vector_base<std::vector<int>, std::allocator<std::vector<int>>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.__gnu_cxx::__normal_iterator" = type { ptr }
%class.anon = type { i8 }
%struct.block = type { i32, i32, i32, i32, i32 }
%"struct.std::pair" = type { %"class.__gnu_cxx::__normal_iterator", %"class.__gnu_cxx::__normal_iterator" }
%class.anon.5 = type { i8 }
%"class.std::vector.7" = type { %"struct.std::_Vector_base.8" }
%"struct.std::_Vector_base.8" = 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 }

@N = external dso_local global i32, align 4
@blocks = external dso_local global %"class.std::vector", align 8

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_Z10is_connectRK5blockS1_(ptr noundef nonnull align 4 dereferenceable(20), ptr noundef nonnull align 4 dereferenceable(20)) #0

; Function Attrs: mustprogress uwtable
define dso_local noundef i32 @_Z5solvev() #1 personality ptr @__gxx_personality_v0 {
  %1 = alloca %class.SCC, align 8
  %2 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %3 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %4 = alloca %class.anon, align 1
  %5 = alloca ptr, align 8
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  %8 = alloca %struct.block, align 4
  %9 = alloca %"struct.std::pair", align 8
  %10 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %11 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %12 = alloca %class.anon.5, align 1
  %13 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %14 = alloca %"class.std::vector.7", align 8
  call void @llvm.lifetime.start.p0(i64 56, ptr %1) #6
  %15 = load i32, ptr @N, align 4, !tbaa !5
  call void @_ZN3SCCC2Ei(ptr noundef nonnull align 8 dereferenceable(56) %1, i32 noundef %15)
  %16 = call ptr @_ZNSt6vectorI5blockSaIS0_EE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) @blocks) #6
  %17 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %2, i32 0, i32 0
  store ptr %16, ptr %17, align 8
  %18 = call ptr @_ZNSt6vectorI5blockSaIS0_EE3endEv(ptr noundef nonnull align 8 dereferenceable(24) @blocks) #6
  %19 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %3, i32 0, i32 0
  store ptr %18, ptr %19, align 8
  %20 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %2, i32 0, i32 0
  %21 = load ptr, ptr %20, align 8
  %22 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %3, i32 0, i32 0
  %23 = load ptr, ptr %22, align 8
  invoke void @"_ZSt4sortIN9__gnu_cxx17__normal_iteratorIP5blockSt6vectorIS2_SaIS2_EEEEZ5solvevE3$_0EvT_S9_T0_"(ptr %21, ptr %23)
          to label %24 unwind label %30

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

25:                                               ; preds = %101, %24
  %26 = load i32, ptr %7, align 4, !tbaa !5
  %27 = load i32, ptr @N, align 4, !tbaa !5
  %28 = icmp slt i32 %26, %27
  br i1 %28, label %34, label %29

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

30:                                               ; preds = %0
  %31 = landingpad { ptr, i32 }
          cleanup
  %32 = extractvalue { ptr, i32 } %31, 0
  store ptr %32, ptr %5, align 8
  %33 = extractvalue { ptr, i32 } %31, 1
  store i32 %33, ptr %6, align 4
  br label %111

34:                                               ; preds = %25
  call void @llvm.lifetime.start.p0(i64 20, ptr %8) #6
  call void @llvm.memset.p0.i64(ptr align 4 %8, i8 0, i64 20, i1 false)
  %35 = getelementptr inbounds %struct.block, ptr %8, i32 0, i32 0
  %36 = getelementptr inbounds %struct.block, ptr %8, i32 0, i32 1
  %37 = getelementptr inbounds %struct.block, ptr %8, i32 0, i32 2
  %38 = load i32, ptr %7, align 4, !tbaa !5
  %39 = sext i32 %38 to i64
  %40 = call noundef nonnull align 4 dereferenceable(20) ptr @_ZNSt6vectorI5blockSaIS0_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) @blocks, i64 noundef %39) #6
  %41 = getelementptr inbounds %struct.block, ptr %40, i32 0, i32 4
  %42 = load i32, ptr %41, align 4, !tbaa !9
  store i32 %42, ptr %37, align 4, !tbaa !11
  %43 = getelementptr inbounds %struct.block, ptr %8, i32 0, i32 3
  %44 = getelementptr inbounds %struct.block, ptr %8, i32 0, i32 4
  call void @llvm.lifetime.start.p0(i64 16, ptr %9) #6
  %45 = call ptr @_ZNSt6vectorI5blockSaIS0_EE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) @blocks) #6
  %46 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %10, i32 0, i32 0
  store ptr %45, ptr %46, align 8
  %47 = call ptr @_ZNSt6vectorI5blockSaIS0_EE3endEv(ptr noundef nonnull align 8 dereferenceable(24) @blocks) #6
  %48 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %11, i32 0, i32 0
  store ptr %47, ptr %48, align 8
  %49 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %10, i32 0, i32 0
  %50 = load ptr, ptr %49, align 8
  %51 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %11, i32 0, i32 0
  %52 = load ptr, ptr %51, align 8
  %53 = invoke { ptr, ptr } @"_ZSt11equal_rangeIN9__gnu_cxx17__normal_iteratorIP5blockSt6vectorIS2_SaIS2_EEEES2_Z5solvevE3$_1ESt4pairIT_SA_ESA_SA_RKT0_T1_"(ptr %50, ptr %52, ptr noundef nonnull align 4 dereferenceable(20) %8)
          to label %54 unwind label %91

54:                                               ; preds = %34
  %55 = getelementptr inbounds { ptr, ptr }, ptr %9, i32 0, i32 0
  %56 = extractvalue { ptr, ptr } %53, 0
  store ptr %56, ptr %55, align 8
  %57 = getelementptr inbounds { ptr, ptr }, ptr %9, i32 0, i32 1
  %58 = extractvalue { ptr, ptr } %53, 1
  store ptr %58, ptr %57, align 8
  br label %59

59:                                               ; preds = %96, %54
  %60 = getelementptr inbounds %"struct.std::pair", ptr %9, i32 0, i32 0
  %61 = getelementptr inbounds %"struct.std::pair", ptr %9, i32 0, i32 1
  %62 = call noundef zeroext i1 @_ZN9__gnu_cxxneIP5blockSt6vectorIS1_SaIS1_EEEEbRKNS_17__normal_iteratorIT_T0_EESB_(ptr noundef nonnull align 8 dereferenceable(8) %60, ptr noundef nonnull align 8 dereferenceable(8) %61) #6
  br i1 %62, label %63, label %100

63:                                               ; preds = %59
  %64 = load i32, ptr %7, align 4, !tbaa !5
  %65 = sext i32 %64 to i64
  %66 = call noundef nonnull align 4 dereferenceable(20) ptr @_ZNSt6vectorI5blockSaIS0_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) @blocks, i64 noundef %65) #6
  %67 = getelementptr inbounds %"struct.std::pair", ptr %9, i32 0, i32 0
  %68 = call noundef nonnull align 4 dereferenceable(20) ptr @_ZNK9__gnu_cxx17__normal_iteratorIP5blockSt6vectorIS1_SaIS1_EEEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %67) #6
  %69 = call noundef zeroext i1 @_Z10is_connectRK5blockS1_(ptr noundef nonnull align 4 dereferenceable(20) %66, ptr noundef nonnull align 4 dereferenceable(20) %68)
  br i1 %69, label %70, label %95

70:                                               ; preds = %63
  %71 = load i32, ptr %7, align 4, !tbaa !5
  %72 = sext i32 %71 to i64
  %73 = call noundef nonnull align 4 dereferenceable(20) ptr @_ZNSt6vectorI5blockSaIS0_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) @blocks, i64 noundef %72) #6
  %74 = getelementptr inbounds %struct.block, ptr %73, i32 0, i32 0
  %75 = load i32, ptr %74, align 4, !tbaa !12
  %76 = getelementptr inbounds %"struct.std::pair", ptr %9, i32 0, i32 0
  %77 = call noundef ptr @_ZNK9__gnu_cxx17__normal_iteratorIP5blockSt6vectorIS1_SaIS1_EEEptEv(ptr noundef nonnull align 8 dereferenceable(8) %76) #6
  %78 = getelementptr inbounds %struct.block, ptr %77, i32 0, i32 0
  %79 = load i32, ptr %78, align 4, !tbaa !12
  invoke void @_ZN3SCC8add_edgeEii(ptr noundef nonnull align 8 dereferenceable(56) %1, i32 noundef %75, i32 noundef %79)
          to label %80 unwind label %91

80:                                               ; preds = %70
  %81 = getelementptr inbounds %"struct.std::pair", ptr %9, i32 0, i32 0
  %82 = call noundef ptr @_ZNK9__gnu_cxx17__normal_iteratorIP5blockSt6vectorIS1_SaIS1_EEEptEv(ptr noundef nonnull align 8 dereferenceable(8) %81) #6
  %83 = getelementptr inbounds %struct.block, ptr %82, i32 0, i32 0
  %84 = load i32, ptr %83, align 4, !tbaa !12
  %85 = load i32, ptr %7, align 4, !tbaa !5
  %86 = sext i32 %85 to i64
  %87 = call noundef nonnull align 4 dereferenceable(20) ptr @_ZNSt6vectorI5blockSaIS0_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) @blocks, i64 noundef %86) #6
  %88 = getelementptr inbounds %struct.block, ptr %87, i32 0, i32 0
  %89 = load i32, ptr %88, align 4, !tbaa !12
  invoke void @_ZN3SCC8add_edgeEii(ptr noundef nonnull align 8 dereferenceable(56) %1, i32 noundef %84, i32 noundef %89)
          to label %90 unwind label %91

90:                                               ; preds = %80
  br label %95

91:                                               ; preds = %80, %70, %34
  %92 = landingpad { ptr, i32 }
          cleanup
  %93 = extractvalue { ptr, i32 } %92, 0
  store ptr %93, ptr %5, align 8
  %94 = extractvalue { ptr, i32 } %92, 1
  store i32 %94, ptr %6, align 4
  call void @llvm.lifetime.end.p0(i64 16, ptr %9) #6
  call void @llvm.lifetime.end.p0(i64 20, ptr %8) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #6
  br label %111

95:                                               ; preds = %90, %63
  br label %96

96:                                               ; preds = %95
  %97 = getelementptr inbounds %"struct.std::pair", ptr %9, i32 0, i32 0
  %98 = call ptr @_ZN9__gnu_cxx17__normal_iteratorIP5blockSt6vectorIS1_SaIS1_EEEppEi(ptr noundef nonnull align 8 dereferenceable(8) %97, i32 noundef 0) #6
  %99 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %13, i32 0, i32 0
  store ptr %98, ptr %99, align 8
  br label %59, !llvm.loop !13

100:                                              ; preds = %59
  call void @llvm.lifetime.end.p0(i64 16, ptr %9) #6
  call void @llvm.lifetime.end.p0(i64 20, ptr %8) #6
  br label %101

101:                                              ; preds = %100
  %102 = load i32, ptr %7, align 4, !tbaa !5
  %103 = add nsw i32 %102, 1
  store i32 %103, ptr %7, align 4, !tbaa !5
  br label %25, !llvm.loop !15

104:                                              ; preds = %29
  call void @llvm.lifetime.start.p0(i64 24, ptr %14) #6
  call void @_ZNSt6vectorIiSaIiEEC2Ev(ptr noundef nonnull align 8 dereferenceable(24) %14) #6
  %105 = invoke noundef i32 @_ZN3SCC5solveERSt6vectorIiSaIiEE(ptr noundef nonnull align 8 dereferenceable(56) %1, ptr noundef nonnull align 8 dereferenceable(24) %14)
          to label %106 unwind label %107

106:                                              ; preds = %104
  call void @_ZNSt6vectorIiSaIiEED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %14) #6
  call void @llvm.lifetime.end.p0(i64 24, ptr %14) #6
  call void @_ZN3SCCD2Ev(ptr noundef nonnull align 8 dereferenceable(56) %1) #6
  call void @llvm.lifetime.end.p0(i64 56, ptr %1) #6
  ret i32 %105

107:                                              ; preds = %104
  %108 = landingpad { ptr, i32 }
          cleanup
  %109 = extractvalue { ptr, i32 } %108, 0
  store ptr %109, ptr %5, align 8
  %110 = extractvalue { ptr, i32 } %108, 1
  store i32 %110, ptr %6, align 4
  call void @_ZNSt6vectorIiSaIiEED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %14) #6
  call void @llvm.lifetime.end.p0(i64 24, ptr %14) #6
  br label %111

111:                                              ; preds = %107, %91, %30
  call void @_ZN3SCCD2Ev(ptr noundef nonnull align 8 dereferenceable(56) %1) #6
  call void @llvm.lifetime.end.p0(i64 56, ptr %1) #6
  br label %112

112:                                              ; preds = %111
  %113 = load ptr, ptr %5, align 8
  %114 = load i32, ptr %6, align 4
  %115 = insertvalue { ptr, i32 } poison, ptr %113, 0
  %116 = insertvalue { ptr, i32 } %115, i32 %114, 1
  resume { ptr, i32 } %116
}

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN3SCCC2Ei(ptr noundef nonnull align 8 dereferenceable(56), i32 noundef) unnamed_addr #1 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare hidden void @"_ZSt4sortIN9__gnu_cxx17__normal_iteratorIP5blockSt6vectorIS2_SaIS2_EEEEZ5solvevE3$_0EvT_S9_T0_"(ptr, ptr) #3

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

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

declare i32 @__gxx_personality_v0(...)

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

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

; Function Attrs: inlinehint mustprogress uwtable
declare hidden { ptr, ptr } @"_ZSt11equal_rangeIN9__gnu_cxx17__normal_iteratorIP5blockSt6vectorIS2_SaIS2_EEEES2_Z5solvevE3$_1ESt4pairIT_SA_ESA_SA_RKT0_T1_"(ptr, ptr, ptr noundef nonnull align 4 dereferenceable(20)) #3

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZN9__gnu_cxxneIP5blockSt6vectorIS1_SaIS1_EEEEbRKNS_17__normal_iteratorIT_T0_EESB_(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(20) ptr @_ZNK9__gnu_cxx17__normal_iteratorIP5blockSt6vectorIS1_SaIS1_EEEdeEv(ptr noundef nonnull align 8 dereferenceable(8)) #0 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN3SCC8add_edgeEii(ptr noundef nonnull align 8 dereferenceable(56), i32 noundef, i32 noundef) #1 align 2

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local ptr @_ZN9__gnu_cxx17__normal_iteratorIP5blockSt6vectorIS1_SaIS1_EEEppEi(ptr noundef nonnull align 8 dereferenceable(8), i32 noundef) #0 align 2

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

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

; Function Attrs: mustprogress uwtable
declare dso_local noundef i32 @_ZN3SCC5solveERSt6vectorIiSaIiEE(ptr noundef nonnull align 8 dereferenceable(56), ptr noundef nonnull align 8 dereferenceable(24)) #1 align 2

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZN3SCCD2Ev(ptr noundef nonnull align 8 dereferenceable(56)) unnamed_addr #5 align 2

attributes #0 = { mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { inlinehint mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nocallback nofree nounwind willreturn memory(argmem: write) }
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 = !{!10, !6, i64 16}
!10 = !{!"_ZTS5block", !6, i64 0, !6, i64 4, !6, i64 8, !6, i64 12, !6, i64 16}
!11 = !{!10, !6, i64 8}
!12 = !{!10, !6, i64 0}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}
!15 = distinct !{!15, !14}


; 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<block, std::allocator<block>>::_Vector_impl" }
%"struct.std::_Vector_base<block, std::allocator<block>>::_Vector_impl" = type { %"struct.std::_Vector_base<block, std::allocator<block>>::_Vector_impl_data" }
%"struct.std::_Vector_base<block, std::allocator<block>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%class.SCC = type { i32, %"class.std::vector.0", %"class.std::vector.0" }
%"class.std::vector.0" = type { %"struct.std::_Vector_base.1" }
%"struct.std::_Vector_base.1" = type { %"struct.std::_Vector_base<std::vector<int>, std::allocator<std::vector<int>>>::_Vector_impl" }
%"struct.std::_Vector_base<std::vector<int>, std::allocator<std::vector<int>>>::_Vector_impl" = type { %"struct.std::_Vector_base<std::vector<int>, std::allocator<std::vector<int>>>::_Vector_impl_data" }
%"struct.std::_Vector_base<std::vector<int>, std::allocator<std::vector<int>>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%struct.block = type { i32, i32, i32, i32, i32 }
%"struct.std::pair" = type { %"class.__gnu_cxx::__normal_iterator", %"class.__gnu_cxx::__normal_iterator" }
%"class.__gnu_cxx::__normal_iterator" = type { ptr }
%"class.std::vector.7" = type { %"struct.std::_Vector_base.8" }
%"struct.std::_Vector_base.8" = 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 }

@N = external dso_local local_unnamed_addr global i32, align 4
@blocks = external dso_local global %"class.std::vector", align 8

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_Z10is_connectRK5blockS1_(ptr noundef nonnull align 4 dereferenceable(20), ptr noundef nonnull align 4 dereferenceable(20)) local_unnamed_addr #0

; Function Attrs: mustprogress uwtable
define dso_local noundef i32 @_Z5solvev() local_unnamed_addr #1 personality ptr @__gxx_personality_v0 {
  %1 = alloca %class.SCC, align 8
  %2 = alloca %struct.block, align 4
  %3 = alloca %"struct.std::pair", align 8
  %4 = alloca %"class.std::vector.7", align 8
  call void @llvm.lifetime.start.p0(i64 56, ptr nonnull %1) #6
  %5 = load i32, ptr @N, align 4, !tbaa !5
  call void @_ZN3SCCC2Ei(ptr noundef nonnull align 8 dereferenceable(56) %1, i32 noundef %5)
  %6 = call ptr @_ZNSt6vectorI5blockSaIS0_EE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) @blocks) #6
  %7 = call ptr @_ZNSt6vectorI5blockSaIS0_EE3endEv(ptr noundef nonnull align 8 dereferenceable(24) @blocks) #6
  invoke void @"_ZSt4sortIN9__gnu_cxx17__normal_iteratorIP5blockSt6vectorIS2_SaIS2_EEEEZ5solvevE3$_0EvT_S9_T0_"(ptr %6, ptr %7)
          to label %.preheader unwind label %13

.preheader:                                       ; preds = %0
  %8 = load i32, ptr @N, align 4, !tbaa !5
  %9 = icmp sgt i32 %8, 0
  br i1 %9, label %.lr.ph15, label %._crit_edge16

.lr.ph15:                                         ; preds = %.preheader
  %10 = getelementptr inbounds i8, ptr %2, i64 8
  %11 = getelementptr inbounds i8, ptr %3, i64 8
  br label %15

._crit_edge16:                                    ; preds = %._crit_edge, %.preheader
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %4) #6
  call void @_ZNSt6vectorIiSaIiEEC2Ev(ptr noundef nonnull align 8 dereferenceable(24) %4) #6
  %12 = invoke noundef i32 @_ZN3SCC5solveERSt6vectorIiSaIiEE(ptr noundef nonnull align 8 dereferenceable(56) %1, ptr noundef nonnull align 8 dereferenceable(24) %4)
          to label %46 unwind label %47

13:                                               ; preds = %0
  %14 = landingpad { ptr, i32 }
          cleanup
  br label %49

15:                                               ; preds = %.lr.ph15, %._crit_edge
  %indvars.iv = phi i64 [ 0, %.lr.ph15 ], [ %indvars.iv.next, %._crit_edge ]
  call void @llvm.lifetime.start.p0(i64 20, ptr nonnull %2) #6
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 4 dereferenceable(20) %2, i8 0, i64 20, i1 false)
  %16 = call noundef nonnull align 4 dereferenceable(20) ptr @_ZNSt6vectorI5blockSaIS0_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) @blocks, i64 noundef %indvars.iv) #6
  %17 = getelementptr inbounds i8, ptr %16, i64 16
  %18 = load i32, ptr %17, align 4, !tbaa !9
  store i32 %18, ptr %10, align 4, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %3) #6
  %19 = call ptr @_ZNSt6vectorI5blockSaIS0_EE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) @blocks) #6
  %20 = call ptr @_ZNSt6vectorI5blockSaIS0_EE3endEv(ptr noundef nonnull align 8 dereferenceable(24) @blocks) #6
  %21 = invoke { ptr, ptr } @"_ZSt11equal_rangeIN9__gnu_cxx17__normal_iteratorIP5blockSt6vectorIS2_SaIS2_EEEES2_Z5solvevE3$_1ESt4pairIT_SA_ESA_SA_RKT0_T1_"(ptr %19, ptr %20, ptr noundef nonnull align 4 dereferenceable(20) %2)
          to label %22 unwind label %.loopexit.split-lp

22:                                               ; preds = %15
  %23 = extractvalue { ptr, ptr } %21, 0
  store ptr %23, ptr %3, align 8
  %24 = extractvalue { ptr, ptr } %21, 1
  store ptr %24, ptr %11, align 8
  %25 = call noundef zeroext i1 @_ZN9__gnu_cxxneIP5blockSt6vectorIS1_SaIS1_EEEEbRKNS_17__normal_iteratorIT_T0_EESB_(ptr noundef nonnull align 8 dereferenceable(8) %3, ptr noundef nonnull align 8 dereferenceable(8) %11) #6
  br i1 %25, label %.lr.ph, label %._crit_edge

.lr.ph:                                           ; preds = %22, %40
  %26 = call noundef nonnull align 4 dereferenceable(20) ptr @_ZNSt6vectorI5blockSaIS0_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) @blocks, i64 noundef %indvars.iv) #6
  %27 = call noundef nonnull align 4 dereferenceable(20) ptr @_ZNK9__gnu_cxx17__normal_iteratorIP5blockSt6vectorIS1_SaIS1_EEEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %3) #6
  %28 = call noundef zeroext i1 @_Z10is_connectRK5blockS1_(ptr noundef nonnull align 4 dereferenceable(20) %26, ptr noundef nonnull align 4 dereferenceable(20) %27)
  br i1 %28, label %29, label %40

29:                                               ; preds = %.lr.ph
  %30 = call noundef nonnull align 4 dereferenceable(20) ptr @_ZNSt6vectorI5blockSaIS0_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) @blocks, i64 noundef %indvars.iv) #6
  %31 = load i32, ptr %30, align 4, !tbaa !12
  %32 = call noundef ptr @_ZNK9__gnu_cxx17__normal_iteratorIP5blockSt6vectorIS1_SaIS1_EEEptEv(ptr noundef nonnull align 8 dereferenceable(8) %3) #6
  %33 = load i32, ptr %32, align 4, !tbaa !12
  invoke void @_ZN3SCC8add_edgeEii(ptr noundef nonnull align 8 dereferenceable(56) %1, i32 noundef %31, i32 noundef %33)
          to label %34 unwind label %.loopexit

34:                                               ; preds = %29
  %35 = call noundef ptr @_ZNK9__gnu_cxx17__normal_iteratorIP5blockSt6vectorIS1_SaIS1_EEEptEv(ptr noundef nonnull align 8 dereferenceable(8) %3) #6
  %36 = load i32, ptr %35, align 4, !tbaa !12
  %37 = call noundef nonnull align 4 dereferenceable(20) ptr @_ZNSt6vectorI5blockSaIS0_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) @blocks, i64 noundef %indvars.iv) #6
  %38 = load i32, ptr %37, align 4, !tbaa !12
  invoke void @_ZN3SCC8add_edgeEii(ptr noundef nonnull align 8 dereferenceable(56) %1, i32 noundef %36, i32 noundef %38)
          to label %40 unwind label %.loopexit

.loopexit:                                        ; preds = %29, %34
  %lpad.loopexit = landingpad { ptr, i32 }
          cleanup
  br label %39

.loopexit.split-lp:                               ; preds = %15
  %lpad.loopexit.split-lp = landingpad { ptr, i32 }
          cleanup
  br label %39

39:                                               ; preds = %.loopexit.split-lp, %.loopexit
  %lpad.phi = phi { ptr, i32 } [ %lpad.loopexit, %.loopexit ], [ %lpad.loopexit.split-lp, %.loopexit.split-lp ]
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %3) #6
  call void @llvm.lifetime.end.p0(i64 20, ptr nonnull %2) #6
  br label %49

40:                                               ; preds = %.lr.ph, %34
  %41 = call ptr @_ZN9__gnu_cxx17__normal_iteratorIP5blockSt6vectorIS1_SaIS1_EEEppEi(ptr noundef nonnull align 8 dereferenceable(8) %3, i32 noundef 0) #6
  %42 = call noundef zeroext i1 @_ZN9__gnu_cxxneIP5blockSt6vectorIS1_SaIS1_EEEEbRKNS_17__normal_iteratorIT_T0_EESB_(ptr noundef nonnull align 8 dereferenceable(8) %3, ptr noundef nonnull align 8 dereferenceable(8) %11) #6
  br i1 %42, label %.lr.ph, label %._crit_edge, !llvm.loop !13

._crit_edge:                                      ; preds = %40, %22
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %3) #6
  call void @llvm.lifetime.end.p0(i64 20, ptr nonnull %2) #6
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %43 = load i32, ptr @N, align 4, !tbaa !5
  %44 = sext i32 %43 to i64
  %45 = icmp slt i64 %indvars.iv.next, %44
  br i1 %45, label %15, label %._crit_edge16, !llvm.loop !15

46:                                               ; preds = %._crit_edge16
  call void @_ZNSt6vectorIiSaIiEED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %4) #6
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %4) #6
  call void @_ZN3SCCD2Ev(ptr noundef nonnull align 8 dereferenceable(56) %1) #6
  call void @llvm.lifetime.end.p0(i64 56, ptr nonnull %1) #6
  ret i32 %12

47:                                               ; preds = %._crit_edge16
  %48 = landingpad { ptr, i32 }
          cleanup
  call void @_ZNSt6vectorIiSaIiEED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %4) #6
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %4) #6
  br label %49

49:                                               ; preds = %47, %39, %13
  %.pn = phi { ptr, i32 } [ %lpad.phi, %39 ], [ %48, %47 ], [ %14, %13 ]
  call void @_ZN3SCCD2Ev(ptr noundef nonnull align 8 dereferenceable(56) %1) #6
  call void @llvm.lifetime.end.p0(i64 56, ptr nonnull %1) #6
  resume { ptr, i32 } %.pn
}

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN3SCCC2Ei(ptr noundef nonnull align 8 dereferenceable(56), i32 noundef) unnamed_addr #1 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare hidden void @"_ZSt4sortIN9__gnu_cxx17__normal_iteratorIP5blockSt6vectorIS2_SaIS2_EEEEZ5solvevE3$_0EvT_S9_T0_"(ptr, ptr) local_unnamed_addr #3

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

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

declare i32 @__gxx_personality_v0(...)

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

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

; Function Attrs: inlinehint mustprogress uwtable
declare hidden { ptr, ptr } @"_ZSt11equal_rangeIN9__gnu_cxx17__normal_iteratorIP5blockSt6vectorIS2_SaIS2_EEEES2_Z5solvevE3$_1ESt4pairIT_SA_ESA_SA_RKT0_T1_"(ptr, ptr, ptr noundef nonnull align 4 dereferenceable(20)) local_unnamed_addr #3

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZN9__gnu_cxxneIP5blockSt6vectorIS1_SaIS1_EEEEbRKNS_17__normal_iteratorIT_T0_EESB_(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(20) ptr @_ZNK9__gnu_cxx17__normal_iteratorIP5blockSt6vectorIS1_SaIS1_EEEdeEv(ptr noundef nonnull align 8 dereferenceable(8)) local_unnamed_addr #0 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN3SCC8add_edgeEii(ptr noundef nonnull align 8 dereferenceable(56), i32 noundef, i32 noundef) local_unnamed_addr #1 align 2

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local ptr @_ZN9__gnu_cxx17__normal_iteratorIP5blockSt6vectorIS1_SaIS1_EEEppEi(ptr noundef nonnull align 8 dereferenceable(8), i32 noundef) local_unnamed_addr #0 align 2

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

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

; Function Attrs: mustprogress uwtable
declare dso_local noundef i32 @_ZN3SCC5solveERSt6vectorIiSaIiEE(ptr noundef nonnull align 8 dereferenceable(56), ptr noundef nonnull align 8 dereferenceable(24)) local_unnamed_addr #1 align 2

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZN3SCCD2Ev(ptr noundef nonnull align 8 dereferenceable(56)) unnamed_addr #5 align 2

attributes #0 = { mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress 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 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { inlinehint mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
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 = !{!10, !6, i64 16}
!10 = !{!"_ZTS5block", !6, i64 0, !6, i64 4, !6, i64 8, !6, i64 12, !6, i64 16}
!11 = !{!10, !6, i64 8}
!12 = !{!10, !6, i64 0}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}
!15 = distinct !{!15, !14}


; Effective O3 passes: EarlyCSEPass,GlobalOptPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LICMPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,SROAPass,SimplifyCFGPass