; LLVM IR from VastoLorde95/Competitive-Programming :: CodeChef/SHORT/COOK65/Problem E/E.ll (Z23heavyLightDecompositionxx)

; 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<long long, std::allocator<long long>>::_Vector_impl" }
%"struct.std::_Vector_base<long long, std::allocator<long long>>::_Vector_impl" = type { %"struct.std::_Vector_base<long long, std::allocator<long long>>::_Vector_impl_data" }
%"struct.std::_Vector_base<long long, std::allocator<long long>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.__gnu_cxx::__normal_iterator" = type { ptr }

@g = external dso_local global [524288 x %"class.std::vector"], align 16
@c = external dso_local global [524288 x i64], align 16
@indx = external dso_local global i64, align 8
@baseArray = external dso_local global [524288 x i64], align 16
@chainHead = external dso_local global [524288 x i64], align 16
@pos = external dso_local global [524288 x i64], align 16
@chain = external dso_local global [524288 x i64], align 16
@sz = external dso_local global [524288 x i64], align 16
@chain_no = external dso_local global i64, align 8

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

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

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZN9__gnu_cxxneIPxSt6vectorIxSaIxEEEEbRKNS_17__normal_iteratorIT_T0_EESA_(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(8)) #2

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

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

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

; Function Attrs: mustprogress uwtable
define dso_local void @_Z23heavyLightDecompositionxx(i64 noundef %0, i64 noundef %1) #3 {
  %3 = alloca i64, align 8
  %4 = alloca i64, align 8
  %5 = alloca i64, align 8
  %6 = alloca i64, align 8
  %7 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %8 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %9 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %10 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  store i64 %0, ptr %3, align 8, !tbaa !5
  store i64 %1, ptr %4, align 8, !tbaa !5
  %11 = load i64, ptr @chain_no, align 8, !tbaa !5
  %12 = load i64, ptr %3, align 8, !tbaa !5
  %13 = getelementptr inbounds [524288 x i64], ptr @chain, i64 0, i64 %12
  store i64 %11, ptr %13, align 8, !tbaa !5
  %14 = load i64, ptr @indx, align 8, !tbaa !5
  %15 = add nsw i64 %14, 1
  store i64 %15, ptr @indx, align 8, !tbaa !5
  %16 = load i64, ptr %3, align 8, !tbaa !5
  %17 = getelementptr inbounds [524288 x i64], ptr @pos, i64 0, i64 %16
  store i64 %15, ptr %17, align 8, !tbaa !5
  %18 = load i64, ptr %3, align 8, !tbaa !5
  %19 = getelementptr inbounds [524288 x i64], ptr @c, i64 0, i64 %18
  %20 = load i64, ptr %19, align 8, !tbaa !5
  %21 = load i64, ptr @indx, align 8, !tbaa !5
  %22 = getelementptr inbounds [524288 x i64], ptr @baseArray, i64 0, i64 %21
  store i64 %20, ptr %22, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #4
  store i64 -1, ptr %5, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #4
  store i64 0, ptr %6, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #4
  %23 = load i64, ptr %3, align 8, !tbaa !5
  %24 = getelementptr inbounds [524288 x %"class.std::vector"], ptr @g, i64 0, i64 %23
  %25 = call ptr @_ZNSt6vectorIxSaIxEE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) %24) #4
  %26 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %7, i32 0, i32 0
  store ptr %25, ptr %26, align 8
  br label %27

27:                                               ; preds = %55, %2
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #4
  %28 = load i64, ptr %3, align 8, !tbaa !5
  %29 = getelementptr inbounds [524288 x %"class.std::vector"], ptr @g, i64 0, i64 %28
  %30 = call ptr @_ZNSt6vectorIxSaIxEE3endEv(ptr noundef nonnull align 8 dereferenceable(24) %29) #4
  %31 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %8, i32 0, i32 0
  store ptr %30, ptr %31, align 8
  %32 = call noundef zeroext i1 @_ZN9__gnu_cxxneIPxSt6vectorIxSaIxEEEEbRKNS_17__normal_iteratorIT_T0_EESA_(ptr noundef nonnull align 8 dereferenceable(8) %7, ptr noundef nonnull align 8 dereferenceable(8) %8) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #4
  br i1 %32, label %34, label %33

33:                                               ; preds = %27
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #4
  br label %57

34:                                               ; preds = %27
  %35 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNK9__gnu_cxx17__normal_iteratorIPxSt6vectorIxSaIxEEEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %7) #4
  %36 = load i64, ptr %35, align 8, !tbaa !5
  %37 = load i64, ptr %4, align 8, !tbaa !5
  %38 = icmp eq i64 %36, %37
  br i1 %38, label %39, label %40

39:                                               ; preds = %34
  br label %55

40:                                               ; preds = %34
  %41 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNK9__gnu_cxx17__normal_iteratorIPxSt6vectorIxSaIxEEEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %7) #4
  %42 = load i64, ptr %41, align 8, !tbaa !5
  %43 = getelementptr inbounds [524288 x i64], ptr @sz, i64 0, i64 %42
  %44 = load i64, ptr %43, align 8, !tbaa !5
  %45 = load i64, ptr %6, align 8, !tbaa !5
  %46 = icmp sgt i64 %44, %45
  br i1 %46, label %47, label %54

47:                                               ; preds = %40
  %48 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNK9__gnu_cxx17__normal_iteratorIPxSt6vectorIxSaIxEEEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %7) #4
  %49 = load i64, ptr %48, align 8, !tbaa !5
  %50 = getelementptr inbounds [524288 x i64], ptr @sz, i64 0, i64 %49
  %51 = load i64, ptr %50, align 8, !tbaa !5
  store i64 %51, ptr %6, align 8, !tbaa !5
  %52 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNK9__gnu_cxx17__normal_iteratorIPxSt6vectorIxSaIxEEEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %7) #4
  %53 = load i64, ptr %52, align 8, !tbaa !5
  store i64 %53, ptr %5, align 8, !tbaa !5
  br label %54

54:                                               ; preds = %47, %40
  br label %55

55:                                               ; preds = %54, %39
  %56 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN9__gnu_cxx17__normal_iteratorIPxSt6vectorIxSaIxEEEppEv(ptr noundef nonnull align 8 dereferenceable(8) %7) #4
  br label %27, !llvm.loop !9

57:                                               ; preds = %33
  %58 = load i64, ptr %5, align 8, !tbaa !5
  %59 = icmp ne i64 %58, -1
  br i1 %59, label %60, label %63

60:                                               ; preds = %57
  %61 = load i64, ptr %5, align 8, !tbaa !5
  %62 = load i64, ptr %3, align 8, !tbaa !5
  call void @_Z23heavyLightDecompositionxx(i64 noundef %61, i64 noundef %62)
  br label %63

63:                                               ; preds = %60, %57
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #4
  %64 = load i64, ptr %3, align 8, !tbaa !5
  %65 = getelementptr inbounds [524288 x %"class.std::vector"], ptr @g, i64 0, i64 %64
  %66 = call ptr @_ZNSt6vectorIxSaIxEE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) %65) #4
  %67 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %9, i32 0, i32 0
  store ptr %66, ptr %67, align 8
  br label %68

68:                                               ; preds = %96, %63
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #4
  %69 = load i64, ptr %3, align 8, !tbaa !5
  %70 = getelementptr inbounds [524288 x %"class.std::vector"], ptr @g, i64 0, i64 %69
  %71 = call ptr @_ZNSt6vectorIxSaIxEE3endEv(ptr noundef nonnull align 8 dereferenceable(24) %70) #4
  %72 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %10, i32 0, i32 0
  store ptr %71, ptr %72, align 8
  %73 = call noundef zeroext i1 @_ZN9__gnu_cxxneIPxSt6vectorIxSaIxEEEEbRKNS_17__normal_iteratorIT_T0_EESA_(ptr noundef nonnull align 8 dereferenceable(8) %9, ptr noundef nonnull align 8 dereferenceable(8) %10) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #4
  br i1 %73, label %75, label %74

74:                                               ; preds = %68
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #4
  br label %98

75:                                               ; preds = %68
  %76 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNK9__gnu_cxx17__normal_iteratorIPxSt6vectorIxSaIxEEEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %9) #4
  %77 = load i64, ptr %76, align 8, !tbaa !5
  %78 = load i64, ptr %4, align 8, !tbaa !5
  %79 = icmp eq i64 %77, %78
  br i1 %79, label %85, label %80

80:                                               ; preds = %75
  %81 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNK9__gnu_cxx17__normal_iteratorIPxSt6vectorIxSaIxEEEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %9) #4
  %82 = load i64, ptr %81, align 8, !tbaa !5
  %83 = load i64, ptr %5, align 8, !tbaa !5
  %84 = icmp eq i64 %82, %83
  br i1 %84, label %85, label %86

85:                                               ; preds = %80, %75
  br label %96

86:                                               ; preds = %80
  %87 = load i64, ptr @chain_no, align 8, !tbaa !5
  %88 = add nsw i64 %87, 1
  store i64 %88, ptr @chain_no, align 8, !tbaa !5
  %89 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNK9__gnu_cxx17__normal_iteratorIPxSt6vectorIxSaIxEEEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %9) #4
  %90 = load i64, ptr %89, align 8, !tbaa !5
  %91 = load i64, ptr @chain_no, align 8, !tbaa !5
  %92 = getelementptr inbounds [524288 x i64], ptr @chainHead, i64 0, i64 %91
  store i64 %90, ptr %92, align 8, !tbaa !5
  %93 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNK9__gnu_cxx17__normal_iteratorIPxSt6vectorIxSaIxEEEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %9) #4
  %94 = load i64, ptr %93, align 8, !tbaa !5
  %95 = load i64, ptr %3, align 8, !tbaa !5
  call void @_Z23heavyLightDecompositionxx(i64 noundef %94, i64 noundef %95)
  br label %96

96:                                               ; preds = %86, %85
  %97 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN9__gnu_cxx17__normal_iteratorIPxSt6vectorIxSaIxEEEppEv(ptr noundef nonnull align 8 dereferenceable(8) %9) #4
  br label %68, !llvm.loop !11

98:                                               ; preds = %74
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #4
  ret void
}

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { inlinehint mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { 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 = !{!"long long", !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}


; 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<long long, std::allocator<long long>>::_Vector_impl" }
%"struct.std::_Vector_base<long long, std::allocator<long long>>::_Vector_impl" = type { %"struct.std::_Vector_base<long long, std::allocator<long long>>::_Vector_impl_data" }
%"struct.std::_Vector_base<long long, std::allocator<long long>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.__gnu_cxx::__normal_iterator" = type { ptr }

@g = external dso_local global [524288 x %"class.std::vector"], align 16
@c = external dso_local local_unnamed_addr global [524288 x i64], align 16
@indx = external dso_local local_unnamed_addr global i64, align 8
@baseArray = external dso_local local_unnamed_addr global [524288 x i64], align 16
@chainHead = external dso_local local_unnamed_addr global [524288 x i64], align 16
@pos = external dso_local local_unnamed_addr global [524288 x i64], align 16
@chain = external dso_local local_unnamed_addr global [524288 x i64], align 16
@sz = external dso_local local_unnamed_addr global [524288 x i64], align 16
@chain_no = external dso_local local_unnamed_addr global i64, align 8

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

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

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZN9__gnu_cxxneIPxSt6vectorIxSaIxEEEEbRKNS_17__normal_iteratorIT_T0_EESA_(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(8)) local_unnamed_addr #2

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

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

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

; Function Attrs: mustprogress nounwind uwtable
define dso_local void @_Z23heavyLightDecompositionxx(i64 noundef %0, i64 noundef %1) local_unnamed_addr #1 {
  %3 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %4 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %5 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %6 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %7 = load i64, ptr @chain_no, align 8, !tbaa !5
  %8 = getelementptr inbounds [524288 x i64], ptr @chain, i64 0, i64 %0
  store i64 %7, ptr %8, align 8, !tbaa !5
  %9 = load i64, ptr @indx, align 8, !tbaa !5
  %10 = add nsw i64 %9, 1
  store i64 %10, ptr @indx, align 8, !tbaa !5
  %11 = getelementptr inbounds [524288 x i64], ptr @pos, i64 0, i64 %0
  store i64 %10, ptr %11, align 8, !tbaa !5
  %12 = getelementptr inbounds [524288 x i64], ptr @c, i64 0, i64 %0
  %13 = load i64, ptr %12, align 8, !tbaa !5
  %14 = getelementptr inbounds [524288 x i64], ptr @baseArray, i64 0, i64 %10
  store i64 %13, ptr %14, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %3) #3
  %15 = getelementptr inbounds [524288 x %"class.std::vector"], ptr @g, i64 0, i64 %0
  %16 = tail call ptr @_ZNSt6vectorIxSaIxEE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) %15) #3
  store ptr %16, ptr %3, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %4) #3
  %17 = tail call ptr @_ZNSt6vectorIxSaIxEE3endEv(ptr noundef nonnull align 8 dereferenceable(24) %15) #3
  store ptr %17, ptr %4, align 8
  %18 = call noundef zeroext i1 @_ZN9__gnu_cxxneIPxSt6vectorIxSaIxEEEEbRKNS_17__normal_iteratorIT_T0_EESA_(ptr noundef nonnull align 8 dereferenceable(8) %3, ptr noundef nonnull align 8 dereferenceable(8) %4) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #3
  br i1 %18, label %.lr.ph, label %._crit_edge.thread

._crit_edge.thread:                               ; preds = %2
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %3) #3
  br label %40

._crit_edge:                                      ; preds = %35
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %3) #3
  %.not = icmp eq i64 %.116, -1
  br i1 %.not, label %40, label %39

.lr.ph:                                           ; preds = %2, %35
  %.018 = phi i64 [ %.1, %35 ], [ 0, %2 ]
  %.01517 = phi i64 [ %.116, %35 ], [ -1, %2 ]
  %19 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNK9__gnu_cxx17__normal_iteratorIPxSt6vectorIxSaIxEEEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %3) #3
  %20 = load i64, ptr %19, align 8, !tbaa !5
  %21 = icmp eq i64 %20, %1
  br i1 %21, label %35, label %22

22:                                               ; preds = %.lr.ph
  %23 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNK9__gnu_cxx17__normal_iteratorIPxSt6vectorIxSaIxEEEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %3) #3
  %24 = load i64, ptr %23, align 8, !tbaa !5
  %25 = getelementptr inbounds [524288 x i64], ptr @sz, i64 0, i64 %24
  %26 = load i64, ptr %25, align 8, !tbaa !5
  %27 = icmp sgt i64 %26, %.018
  br i1 %27, label %28, label %35

28:                                               ; preds = %22
  %29 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNK9__gnu_cxx17__normal_iteratorIPxSt6vectorIxSaIxEEEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %3) #3
  %30 = load i64, ptr %29, align 8, !tbaa !5
  %31 = getelementptr inbounds [524288 x i64], ptr @sz, i64 0, i64 %30
  %32 = load i64, ptr %31, align 8, !tbaa !5
  %33 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNK9__gnu_cxx17__normal_iteratorIPxSt6vectorIxSaIxEEEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %3) #3
  %34 = load i64, ptr %33, align 8, !tbaa !5
  br label %35

35:                                               ; preds = %22, %28, %.lr.ph
  %.116 = phi i64 [ %.01517, %.lr.ph ], [ %34, %28 ], [ %.01517, %22 ]
  %.1 = phi i64 [ %.018, %.lr.ph ], [ %32, %28 ], [ %.018, %22 ]
  %36 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN9__gnu_cxx17__normal_iteratorIPxSt6vectorIxSaIxEEEppEv(ptr noundef nonnull align 8 dereferenceable(8) %3) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %4) #3
  %37 = call ptr @_ZNSt6vectorIxSaIxEE3endEv(ptr noundef nonnull align 8 dereferenceable(24) %15) #3
  store ptr %37, ptr %4, align 8
  %38 = call noundef zeroext i1 @_ZN9__gnu_cxxneIPxSt6vectorIxSaIxEEEEbRKNS_17__normal_iteratorIT_T0_EESA_(ptr noundef nonnull align 8 dereferenceable(8) %3, ptr noundef nonnull align 8 dereferenceable(8) %4) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #3
  br i1 %38, label %.lr.ph, label %._crit_edge, !llvm.loop !9

39:                                               ; preds = %._crit_edge
  call void @_Z23heavyLightDecompositionxx(i64 noundef %.116, i64 noundef %0)
  br label %40

40:                                               ; preds = %._crit_edge.thread, %39, %._crit_edge
  %.015.lcssa24 = phi i64 [ -1, %._crit_edge.thread ], [ %.116, %39 ], [ -1, %._crit_edge ]
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %5) #3
  %41 = call ptr @_ZNSt6vectorIxSaIxEE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) %15) #3
  store ptr %41, ptr %5, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %6) #3
  %42 = call ptr @_ZNSt6vectorIxSaIxEE3endEv(ptr noundef nonnull align 8 dereferenceable(24) %15) #3
  store ptr %42, ptr %6, align 8
  %43 = call noundef zeroext i1 @_ZN9__gnu_cxxneIPxSt6vectorIxSaIxEEEEbRKNS_17__normal_iteratorIT_T0_EESA_(ptr noundef nonnull align 8 dereferenceable(8) %5, ptr noundef nonnull align 8 dereferenceable(8) %6) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %6) #3
  br i1 %43, label %.lr.ph20, label %._crit_edge21

._crit_edge21:                                    ; preds = %60, %40
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %5) #3
  ret void

.lr.ph20:                                         ; preds = %40, %60
  %44 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNK9__gnu_cxx17__normal_iteratorIPxSt6vectorIxSaIxEEEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %5) #3
  %45 = load i64, ptr %44, align 8, !tbaa !5
  %46 = icmp eq i64 %45, %1
  br i1 %46, label %60, label %47

47:                                               ; preds = %.lr.ph20
  %48 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNK9__gnu_cxx17__normal_iteratorIPxSt6vectorIxSaIxEEEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %5) #3
  %49 = load i64, ptr %48, align 8, !tbaa !5
  %50 = icmp eq i64 %49, %.015.lcssa24
  br i1 %50, label %60, label %51

51:                                               ; preds = %47
  %52 = load i64, ptr @chain_no, align 8, !tbaa !5
  %53 = add nsw i64 %52, 1
  store i64 %53, ptr @chain_no, align 8, !tbaa !5
  %54 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNK9__gnu_cxx17__normal_iteratorIPxSt6vectorIxSaIxEEEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %5) #3
  %55 = load i64, ptr %54, align 8, !tbaa !5
  %56 = load i64, ptr @chain_no, align 8, !tbaa !5
  %57 = getelementptr inbounds [524288 x i64], ptr @chainHead, i64 0, i64 %56
  store i64 %55, ptr %57, align 8, !tbaa !5
  %58 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNK9__gnu_cxx17__normal_iteratorIPxSt6vectorIxSaIxEEEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %5) #3
  %59 = load i64, ptr %58, align 8, !tbaa !5
  call void @_Z23heavyLightDecompositionxx(i64 noundef %59, i64 noundef %0)
  br label %60

60:                                               ; preds = %.lr.ph20, %47, %51
  %61 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN9__gnu_cxx17__normal_iteratorIPxSt6vectorIxSaIxEEEppEv(ptr noundef nonnull align 8 dereferenceable(8) %5) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %6) #3
  %62 = call ptr @_ZNSt6vectorIxSaIxEE3endEv(ptr noundef nonnull align 8 dereferenceable(24) %15) #3
  store ptr %62, ptr %6, align 8
  %63 = call noundef zeroext i1 @_ZN9__gnu_cxxneIPxSt6vectorIxSaIxEEEEbRKNS_17__normal_iteratorIT_T0_EESA_(ptr noundef nonnull align 8 dereferenceable(8) %5, ptr noundef nonnull align 8 dereferenceable(8) %6) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %6) #3
  br i1 %63, label %.lr.ph20, label %._crit_edge21, !llvm.loop !11
}

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { inlinehint mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { 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 = !{!"long long", !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}


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