; LLVM IR from codemistic/Data-Structures-and-Algorithms :: graph (code18)

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z8add_edgePSt6vectorIiSaIiEEii(ptr 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: 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 @_Z8kosarajuPSt6vectorIiSaIiEEiS2_(ptr noundef, i32 noundef, ptr noundef) #0

declare i32 @__gxx_personality_v0(...)

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() #2 personality ptr @__gxx_personality_v0 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = alloca ptr, align 8
  %4 = alloca i64, align 8
  %5 = alloca i64, align 8
  %6 = alloca ptr, align 8
  %7 = alloca i32, align 4
  store i32 0, ptr %1, align 4
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #5
  store i32 6, ptr %2, align 4, !tbaa !5
  %8 = load i32, ptr %2, align 4, !tbaa !5
  %9 = zext i32 %8 to i64
  %10 = call ptr @llvm.stacksave.p0()
  store ptr %10, ptr %3, align 8
  %11 = alloca %"class.std::vector", i64 %9, align 16
  store i64 %9, ptr %4, align 8
  %12 = icmp eq i64 %9, 0
  br i1 %12, label %19, label %13

13:                                               ; preds = %0
  %14 = getelementptr inbounds %"class.std::vector", ptr %11, i64 %9
  br label %15

15:                                               ; preds = %15, %13
  %16 = phi ptr [ %11, %13 ], [ %17, %15 ]
  call void @_ZNSt6vectorIiSaIiEEC2Ev(ptr noundef nonnull align 8 dereferenceable(24) %16) #5
  %17 = getelementptr inbounds %"class.std::vector", ptr %16, i64 1
  %18 = icmp eq ptr %17, %14
  br i1 %18, label %19, label %15

19:                                               ; preds = %15, %0
  %20 = load i32, ptr %2, align 4, !tbaa !5
  %21 = zext i32 %20 to i64
  %22 = alloca %"class.std::vector", i64 %21, align 16
  store i64 %21, ptr %5, align 8
  %23 = icmp eq i64 %21, 0
  br i1 %23, label %30, label %24

24:                                               ; preds = %19
  %25 = getelementptr inbounds %"class.std::vector", ptr %22, i64 %21
  br label %26

26:                                               ; preds = %26, %24
  %27 = phi ptr [ %22, %24 ], [ %28, %26 ]
  call void @_ZNSt6vectorIiSaIiEEC2Ev(ptr noundef nonnull align 8 dereferenceable(24) %27) #5
  %28 = getelementptr inbounds %"class.std::vector", ptr %27, i64 1
  %29 = icmp eq ptr %28, %25
  br i1 %29, label %30, label %26

30:                                               ; preds = %26, %19
  invoke void @_Z8add_edgePSt6vectorIiSaIiEEii(ptr noundef %11, i32 noundef 0, i32 noundef 1)
          to label %31 unwind label %42

31:                                               ; preds = %30
  invoke void @_Z8add_edgePSt6vectorIiSaIiEEii(ptr noundef %11, i32 noundef 1, i32 noundef 2)
          to label %32 unwind label %42

32:                                               ; preds = %31
  invoke void @_Z8add_edgePSt6vectorIiSaIiEEii(ptr noundef %11, i32 noundef 2, i32 noundef 3)
          to label %33 unwind label %42

33:                                               ; preds = %32
  invoke void @_Z8add_edgePSt6vectorIiSaIiEEii(ptr noundef %11, i32 noundef 3, i32 noundef 0)
          to label %34 unwind label %42

34:                                               ; preds = %33
  invoke void @_Z8add_edgePSt6vectorIiSaIiEEii(ptr noundef %11, i32 noundef 3, i32 noundef 4)
          to label %35 unwind label %42

35:                                               ; preds = %34
  invoke void @_Z8add_edgePSt6vectorIiSaIiEEii(ptr noundef %11, i32 noundef 4, i32 noundef 5)
          to label %36 unwind label %42

36:                                               ; preds = %35
  invoke void @_Z8add_edgePSt6vectorIiSaIiEEii(ptr noundef %11, i32 noundef 5, i32 noundef 4)
          to label %37 unwind label %42

37:                                               ; preds = %36
  %38 = load i32, ptr %2, align 4, !tbaa !5
  invoke void @_Z8kosarajuPSt6vectorIiSaIiEEiS2_(ptr noundef %11, i32 noundef %38, ptr noundef %22)
          to label %39 unwind label %42

39:                                               ; preds = %37
  store i32 0, ptr %1, align 4
  %40 = getelementptr inbounds %"class.std::vector", ptr %22, i64 %21
  %41 = icmp eq ptr %22, %40
  br i1 %41, label %52, label %48

42:                                               ; preds = %37, %36, %35, %34, %33, %32, %31, %30
  %43 = landingpad { ptr, i32 }
          cleanup
  %44 = extractvalue { ptr, i32 } %43, 0
  store ptr %44, ptr %6, align 8
  %45 = extractvalue { ptr, i32 } %43, 1
  store i32 %45, ptr %7, align 4
  %46 = getelementptr inbounds %"class.std::vector", ptr %22, i64 %21
  %47 = icmp eq ptr %22, %46
  br i1 %47, label %59, label %55

48:                                               ; preds = %48, %39
  %49 = phi ptr [ %40, %39 ], [ %50, %48 ]
  %50 = getelementptr inbounds %"class.std::vector", ptr %49, i64 -1
  call void @_ZNSt6vectorIiSaIiEED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %50) #5
  %51 = icmp eq ptr %50, %22
  br i1 %51, label %52, label %48

52:                                               ; preds = %48, %39
  %53 = getelementptr inbounds %"class.std::vector", ptr %11, i64 %9
  %54 = icmp eq ptr %11, %53
  br i1 %54, label %66, label %62

55:                                               ; preds = %55, %42
  %56 = phi ptr [ %46, %42 ], [ %57, %55 ]
  %57 = getelementptr inbounds %"class.std::vector", ptr %56, i64 -1
  call void @_ZNSt6vectorIiSaIiEED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %57) #5
  %58 = icmp eq ptr %57, %22
  br i1 %58, label %59, label %55

59:                                               ; preds = %55, %42
  %60 = getelementptr inbounds %"class.std::vector", ptr %11, i64 %9
  %61 = icmp eq ptr %11, %60
  br i1 %61, label %73, label %69

62:                                               ; preds = %62, %52
  %63 = phi ptr [ %53, %52 ], [ %64, %62 ]
  %64 = getelementptr inbounds %"class.std::vector", ptr %63, i64 -1
  call void @_ZNSt6vectorIiSaIiEED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %64) #5
  %65 = icmp eq ptr %64, %11
  br i1 %65, label %66, label %62

66:                                               ; preds = %62, %52
  %67 = load ptr, ptr %3, align 8
  call void @llvm.stackrestore.p0(ptr %67)
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #5
  %68 = load i32, ptr %1, align 4
  ret i32 %68

69:                                               ; preds = %69, %59
  %70 = phi ptr [ %60, %59 ], [ %71, %69 ]
  %71 = getelementptr inbounds %"class.std::vector", ptr %70, i64 -1
  call void @_ZNSt6vectorIiSaIiEED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %71) #5
  %72 = icmp eq ptr %71, %11
  br i1 %72, label %73, label %69

73:                                               ; preds = %69, %59
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #5
  br label %74

74:                                               ; preds = %73
  %75 = load ptr, ptr %6, align 8
  %76 = load i32, ptr %7, align 4
  %77 = insertvalue { ptr, i32 } poison, ptr %75, 0
  %78 = insertvalue { ptr, i32 } %77, i32 %76, 1
  resume { ptr, i32 } %78
}

; Function Attrs: nocallback nofree nosync nounwind willreturn
declare ptr @llvm.stacksave.p0() #3

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

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

; Function Attrs: nocallback nofree nosync nounwind willreturn
declare void @llvm.stackrestore.p0(ptr) #3

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 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 #3 = { nocallback nofree nosync nounwind willreturn }
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 = { 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"}


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

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

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

declare i32 @__gxx_personality_v0(...)

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #1 personality ptr @__gxx_personality_v0 {
  %1 = alloca [6 x %"class.std::vector"], align 16
  call void @_ZNSt6vectorIiSaIiEEC2Ev(ptr noundef nonnull align 8 dereferenceable(24) %1) #3
  %.ptr.1 = getelementptr inbounds i8, ptr %1, i64 24
  call void @_ZNSt6vectorIiSaIiEEC2Ev(ptr noundef nonnull align 8 dereferenceable(24) %.ptr.1) #3
  %.ptr.2 = getelementptr inbounds i8, ptr %1, i64 48
  call void @_ZNSt6vectorIiSaIiEEC2Ev(ptr noundef nonnull align 8 dereferenceable(24) %.ptr.2) #3
  %.ptr.3 = getelementptr inbounds i8, ptr %1, i64 72
  call void @_ZNSt6vectorIiSaIiEEC2Ev(ptr noundef nonnull align 8 dereferenceable(24) %.ptr.3) #3
  %.ptr.4 = getelementptr inbounds i8, ptr %1, i64 96
  call void @_ZNSt6vectorIiSaIiEEC2Ev(ptr noundef nonnull align 8 dereferenceable(24) %.ptr.4) #3
  %.ptr.5 = getelementptr inbounds i8, ptr %1, i64 120
  call void @_ZNSt6vectorIiSaIiEEC2Ev(ptr noundef nonnull align 8 dereferenceable(24) %.ptr.5) #3
  %2 = alloca [6 x %"class.std::vector"], align 16
  call void @_ZNSt6vectorIiSaIiEEC2Ev(ptr noundef nonnull align 8 dereferenceable(24) %2) #3
  %.ptr9.1 = getelementptr inbounds i8, ptr %2, i64 24
  call void @_ZNSt6vectorIiSaIiEEC2Ev(ptr noundef nonnull align 8 dereferenceable(24) %.ptr9.1) #3
  %.ptr9.2 = getelementptr inbounds i8, ptr %2, i64 48
  call void @_ZNSt6vectorIiSaIiEEC2Ev(ptr noundef nonnull align 8 dereferenceable(24) %.ptr9.2) #3
  %.ptr9.3 = getelementptr inbounds i8, ptr %2, i64 72
  call void @_ZNSt6vectorIiSaIiEEC2Ev(ptr noundef nonnull align 8 dereferenceable(24) %.ptr9.3) #3
  %.ptr9.4 = getelementptr inbounds i8, ptr %2, i64 96
  call void @_ZNSt6vectorIiSaIiEEC2Ev(ptr noundef nonnull align 8 dereferenceable(24) %.ptr9.4) #3
  %.ptr9.5 = getelementptr inbounds i8, ptr %2, i64 120
  call void @_ZNSt6vectorIiSaIiEEC2Ev(ptr noundef nonnull align 8 dereferenceable(24) %.ptr9.5) #3
  invoke void @_Z8add_edgePSt6vectorIiSaIiEEii(ptr noundef nonnull %1, i32 noundef 0, i32 noundef 1)
          to label %3 unwind label %21

3:                                                ; preds = %0
  invoke void @_Z8add_edgePSt6vectorIiSaIiEEii(ptr noundef nonnull %1, i32 noundef 1, i32 noundef 2)
          to label %4 unwind label %21

4:                                                ; preds = %3
  invoke void @_Z8add_edgePSt6vectorIiSaIiEEii(ptr noundef nonnull %1, i32 noundef 2, i32 noundef 3)
          to label %5 unwind label %21

5:                                                ; preds = %4
  invoke void @_Z8add_edgePSt6vectorIiSaIiEEii(ptr noundef nonnull %1, i32 noundef 3, i32 noundef 0)
          to label %6 unwind label %21

6:                                                ; preds = %5
  invoke void @_Z8add_edgePSt6vectorIiSaIiEEii(ptr noundef nonnull %1, i32 noundef 3, i32 noundef 4)
          to label %7 unwind label %21

7:                                                ; preds = %6
  invoke void @_Z8add_edgePSt6vectorIiSaIiEEii(ptr noundef nonnull %1, i32 noundef 4, i32 noundef 5)
          to label %8 unwind label %21

8:                                                ; preds = %7
  invoke void @_Z8add_edgePSt6vectorIiSaIiEEii(ptr noundef nonnull %1, i32 noundef 5, i32 noundef 4)
          to label %9 unwind label %21

9:                                                ; preds = %8
  invoke void @_Z8kosarajuPSt6vectorIiSaIiEEiS2_(ptr noundef nonnull %1, i32 noundef 6, ptr noundef nonnull %2)
          to label %10 unwind label %21

10:                                               ; preds = %9
  %11 = getelementptr inbounds i8, ptr %2, i64 120
  call void @_ZNSt6vectorIiSaIiEED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %11) #3
  %12 = getelementptr inbounds i8, ptr %2, i64 96
  call void @_ZNSt6vectorIiSaIiEED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %12) #3
  %13 = getelementptr inbounds i8, ptr %2, i64 72
  call void @_ZNSt6vectorIiSaIiEED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %13) #3
  %14 = getelementptr inbounds i8, ptr %2, i64 48
  call void @_ZNSt6vectorIiSaIiEED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %14) #3
  %15 = getelementptr inbounds i8, ptr %2, i64 24
  call void @_ZNSt6vectorIiSaIiEED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %15) #3
  call void @_ZNSt6vectorIiSaIiEED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %2) #3
  %16 = getelementptr inbounds i8, ptr %1, i64 120
  call void @_ZNSt6vectorIiSaIiEED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %16) #3
  %17 = getelementptr inbounds i8, ptr %1, i64 96
  call void @_ZNSt6vectorIiSaIiEED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %17) #3
  %18 = getelementptr inbounds i8, ptr %1, i64 72
  call void @_ZNSt6vectorIiSaIiEED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %18) #3
  %19 = getelementptr inbounds i8, ptr %1, i64 48
  call void @_ZNSt6vectorIiSaIiEED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %19) #3
  %20 = getelementptr inbounds i8, ptr %1, i64 24
  call void @_ZNSt6vectorIiSaIiEED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %20) #3
  call void @_ZNSt6vectorIiSaIiEED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %1) #3
  ret i32 0

21:                                               ; preds = %9, %8, %7, %6, %5, %4, %3, %0
  %22 = landingpad { ptr, i32 }
          cleanup
  %23 = getelementptr inbounds i8, ptr %2, i64 120
  call void @_ZNSt6vectorIiSaIiEED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %23) #3
  %24 = getelementptr inbounds i8, ptr %2, i64 96
  call void @_ZNSt6vectorIiSaIiEED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %24) #3
  %25 = getelementptr inbounds i8, ptr %2, i64 72
  call void @_ZNSt6vectorIiSaIiEED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %25) #3
  %26 = getelementptr inbounds i8, ptr %2, i64 48
  call void @_ZNSt6vectorIiSaIiEED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %26) #3
  %27 = getelementptr inbounds i8, ptr %2, i64 24
  call void @_ZNSt6vectorIiSaIiEED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %27) #3
  call void @_ZNSt6vectorIiSaIiEED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %2) #3
  %28 = getelementptr inbounds i8, ptr %1, i64 120
  call void @_ZNSt6vectorIiSaIiEED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %28) #3
  %29 = getelementptr inbounds i8, ptr %1, i64 96
  call void @_ZNSt6vectorIiSaIiEED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %29) #3
  %30 = getelementptr inbounds i8, ptr %1, i64 72
  call void @_ZNSt6vectorIiSaIiEED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %30) #3
  %31 = getelementptr inbounds i8, ptr %1, i64 48
  call void @_ZNSt6vectorIiSaIiEED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %31) #3
  %32 = getelementptr inbounds i8, ptr %1, i64 24
  call void @_ZNSt6vectorIiSaIiEED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %32) #3
  call void @_ZNSt6vectorIiSaIiEED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %1) #3
  resume { ptr, i32 } %22
}

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

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

attributes #0 = { mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { 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 #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 = { 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)"}


; Effective O3 passes: EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,SROAPass,SimplifyCFGPass