; LLVM IR from ncduy0303/Competitive-Programming :: Data Structures/HLD.ll (Z3hldii)

; 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.std::vector.0" = type { %"struct.std::_Vector_base.1" }
%"struct.std::_Vector_base.1" = type { %"struct.std::_Vector_base<std::array<int, 2>, std::allocator<std::array<int, 2>>>::_Vector_impl" }
%"struct.std::_Vector_base<std::array<int, 2>, std::allocator<std::array<int, 2>>>::_Vector_impl" = type { %"struct.std::_Vector_base<std::array<int, 2>, std::allocator<std::array<int, 2>>>::_Vector_impl_data" }
%"struct.std::_Vector_base<std::array<int, 2>, std::allocator<std::array<int, 2>>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.__gnu_cxx::__normal_iterator" = type { ptr }
%"struct.std::array" = type { [2 x i32] }

@cnt = external dso_local global i32, align 4
@par = external dso_local global [10001 x i32], align 16
@child = external dso_local global [10001 x i32], align 16
@chainNum = external dso_local global i32, align 4
@chainHead = external dso_local global [10001 x i32], align 16
@chainSize = external dso_local global [10001 x i32], align 16
@chainId = external dso_local global [10001 x i32], align 16
@chainPos = external dso_local global [10001 x i32], align 16
@arr = external dso_local global %"class.std::vector", align 8
@pos = external dso_local global [10001 x i32], align 16
@adj = external dso_local global [10001 x %"class.std::vector.0"], align 16

; 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 @_ZNSt6vectorISt5arrayIiLm2EESaIS1_EE5beginEv(ptr noundef nonnull align 8 dereferenceable(24)) #1 align 2

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

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

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

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #3

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

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

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

; Function Attrs: mustprogress uwtable
define dso_local void @_Z3hldii(i32 noundef %0, i32 noundef %1) #4 {
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca ptr, align 8
  %6 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %7 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %8 = alloca %"struct.std::array", align 4
  %9 = alloca ptr, align 8
  %10 = alloca ptr, align 8
  %11 = alloca ptr, align 8
  %12 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %13 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %14 = alloca %"struct.std::array", align 4
  %15 = alloca ptr, align 8
  %16 = alloca ptr, align 8
  store i32 %0, ptr %3, align 4, !tbaa !5
  store i32 %1, ptr %4, align 4, !tbaa !5
  %17 = load i32, ptr @chainNum, align 4, !tbaa !5
  %18 = sext i32 %17 to i64
  %19 = getelementptr inbounds [10001 x i32], ptr @chainHead, i64 0, i64 %18
  %20 = load i32, ptr %19, align 4, !tbaa !5
  %21 = icmp eq i32 %20, -1
  br i1 %21, label %22, label %27

22:                                               ; preds = %2
  %23 = load i32, ptr %3, align 4, !tbaa !5
  %24 = load i32, ptr @chainNum, align 4, !tbaa !5
  %25 = sext i32 %24 to i64
  %26 = getelementptr inbounds [10001 x i32], ptr @chainHead, i64 0, i64 %25
  store i32 %23, ptr %26, align 4, !tbaa !5
  br label %27

27:                                               ; preds = %22, %2
  %28 = load i32, ptr @chainNum, align 4, !tbaa !5
  %29 = load i32, ptr %3, align 4, !tbaa !5
  %30 = sext i32 %29 to i64
  %31 = getelementptr inbounds [10001 x i32], ptr @chainId, i64 0, i64 %30
  store i32 %28, ptr %31, align 4, !tbaa !5
  %32 = load i32, ptr @chainNum, align 4, !tbaa !5
  %33 = sext i32 %32 to i64
  %34 = getelementptr inbounds [10001 x i32], ptr @chainSize, i64 0, i64 %33
  %35 = load i32, ptr %34, align 4, !tbaa !5
  %36 = add nsw i32 %35, 1
  store i32 %36, ptr %34, align 4, !tbaa !5
  %37 = load i32, ptr %3, align 4, !tbaa !5
  %38 = sext i32 %37 to i64
  %39 = getelementptr inbounds [10001 x i32], ptr @chainPos, i64 0, i64 %38
  store i32 %35, ptr %39, align 4, !tbaa !5
  call void @_ZNSt6vectorIiSaIiEE9push_backERKi(ptr noundef nonnull align 8 dereferenceable(24) @arr, ptr noundef nonnull align 4 dereferenceable(4) %4)
  %40 = load i32, ptr @cnt, align 4, !tbaa !5
  %41 = add nsw i32 %40, 1
  store i32 %41, ptr @cnt, align 4, !tbaa !5
  %42 = load i32, ptr %3, align 4, !tbaa !5
  %43 = sext i32 %42 to i64
  %44 = getelementptr inbounds [10001 x i32], ptr @pos, i64 0, i64 %43
  store i32 %40, ptr %44, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #5
  %45 = load i32, ptr %3, align 4, !tbaa !5
  %46 = sext i32 %45 to i64
  %47 = getelementptr inbounds [10001 x %"class.std::vector.0"], ptr @adj, i64 0, i64 %46
  store ptr %47, ptr %5, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #5
  %48 = load ptr, ptr %5, align 8, !tbaa !9
  %49 = call ptr @_ZNSt6vectorISt5arrayIiLm2EESaIS1_EE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) %48) #5
  %50 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %6, i32 0, i32 0
  store ptr %49, ptr %50, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #5
  %51 = load ptr, ptr %5, align 8, !tbaa !9
  %52 = call ptr @_ZNSt6vectorISt5arrayIiLm2EESaIS1_EE3endEv(ptr noundef nonnull align 8 dereferenceable(24) %51) #5
  %53 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %7, i32 0, i32 0
  store ptr %52, ptr %53, align 8
  br label %54

54:                                               ; preds = %82, %27
  %55 = call noundef zeroext i1 @_ZN9__gnu_cxxneIPSt5arrayIiLm2EESt6vectorIS2_SaIS2_EEEEbRKNS_17__normal_iteratorIT_T0_EESC_(ptr noundef nonnull align 8 dereferenceable(8) %6, ptr noundef nonnull align 8 dereferenceable(8) %7) #5
  br i1 %55, label %57, label %56

56:                                               ; preds = %54
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #5
  br label %84

57:                                               ; preds = %54
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #5
  %58 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNK9__gnu_cxx17__normal_iteratorIPSt5arrayIiLm2EESt6vectorIS2_SaIS2_EEEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %6) #5
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %8, ptr align 4 %58, i64 8, i1 false), !tbaa.struct !11
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #5
  %59 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3getILm0EiLm2EEOT0_OSt5arrayIS0_XT1_EE(ptr noundef nonnull align 4 dereferenceable(8) %8) #5
  store ptr %59, ptr %9, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #5
  %60 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3getILm1EiLm2EEOT0_OSt5arrayIS0_XT1_EE(ptr noundef nonnull align 4 dereferenceable(8) %8) #5
  store ptr %60, ptr %10, align 8, !tbaa !9
  %61 = load ptr, ptr %9, align 8, !tbaa !9
  %62 = load i32, ptr %61, align 4, !tbaa !5
  %63 = load i32, ptr %3, align 4, !tbaa !5
  %64 = sext i32 %63 to i64
  %65 = getelementptr inbounds [10001 x i32], ptr @par, i64 0, i64 %64
  %66 = load i32, ptr %65, align 4, !tbaa !5
  %67 = icmp ne i32 %62, %66
  br i1 %67, label %68, label %81

68:                                               ; preds = %57
  %69 = load ptr, ptr %9, align 8, !tbaa !9
  %70 = load i32, ptr %69, align 4, !tbaa !5
  %71 = load i32, ptr %3, align 4, !tbaa !5
  %72 = sext i32 %71 to i64
  %73 = getelementptr inbounds [10001 x i32], ptr @child, i64 0, i64 %72
  %74 = load i32, ptr %73, align 4, !tbaa !5
  %75 = icmp eq i32 %70, %74
  br i1 %75, label %76, label %81

76:                                               ; preds = %68
  %77 = load ptr, ptr %9, align 8, !tbaa !9
  %78 = load i32, ptr %77, align 4, !tbaa !5
  %79 = load ptr, ptr %10, align 8, !tbaa !9
  %80 = load i32, ptr %79, align 4, !tbaa !5
  call void @_Z3hldii(i32 noundef %78, i32 noundef %80)
  br label %81

81:                                               ; preds = %76, %68, %57
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #5
  br label %82

82:                                               ; preds = %81
  %83 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN9__gnu_cxx17__normal_iteratorIPSt5arrayIiLm2EESt6vectorIS2_SaIS2_EEEppEv(ptr noundef nonnull align 8 dereferenceable(8) %6) #5
  br label %54

84:                                               ; preds = %56
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #5
  %85 = load i32, ptr %3, align 4, !tbaa !5
  %86 = sext i32 %85 to i64
  %87 = getelementptr inbounds [10001 x %"class.std::vector.0"], ptr @adj, i64 0, i64 %86
  store ptr %87, ptr %11, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #5
  %88 = load ptr, ptr %11, align 8, !tbaa !9
  %89 = call ptr @_ZNSt6vectorISt5arrayIiLm2EESaIS1_EE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) %88) #5
  %90 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %12, i32 0, i32 0
  store ptr %89, ptr %90, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #5
  %91 = load ptr, ptr %11, align 8, !tbaa !9
  %92 = call ptr @_ZNSt6vectorISt5arrayIiLm2EESaIS1_EE3endEv(ptr noundef nonnull align 8 dereferenceable(24) %91) #5
  %93 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %13, i32 0, i32 0
  store ptr %92, ptr %93, align 8
  br label %94

94:                                               ; preds = %124, %84
  %95 = call noundef zeroext i1 @_ZN9__gnu_cxxneIPSt5arrayIiLm2EESt6vectorIS2_SaIS2_EEEEbRKNS_17__normal_iteratorIT_T0_EESC_(ptr noundef nonnull align 8 dereferenceable(8) %12, ptr noundef nonnull align 8 dereferenceable(8) %13) #5
  br i1 %95, label %97, label %96

96:                                               ; preds = %94
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #5
  br label %126

97:                                               ; preds = %94
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #5
  %98 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNK9__gnu_cxx17__normal_iteratorIPSt5arrayIiLm2EESt6vectorIS2_SaIS2_EEEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %12) #5
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %14, ptr align 4 %98, i64 8, i1 false), !tbaa.struct !11
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #5
  %99 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3getILm0EiLm2EEOT0_OSt5arrayIS0_XT1_EE(ptr noundef nonnull align 4 dereferenceable(8) %14) #5
  store ptr %99, ptr %15, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #5
  %100 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3getILm1EiLm2EEOT0_OSt5arrayIS0_XT1_EE(ptr noundef nonnull align 4 dereferenceable(8) %14) #5
  store ptr %100, ptr %16, align 8, !tbaa !9
  %101 = load ptr, ptr %15, align 8, !tbaa !9
  %102 = load i32, ptr %101, align 4, !tbaa !5
  %103 = load i32, ptr %3, align 4, !tbaa !5
  %104 = sext i32 %103 to i64
  %105 = getelementptr inbounds [10001 x i32], ptr @par, i64 0, i64 %104
  %106 = load i32, ptr %105, align 4, !tbaa !5
  %107 = icmp ne i32 %102, %106
  br i1 %107, label %108, label %123

108:                                              ; preds = %97
  %109 = load ptr, ptr %15, align 8, !tbaa !9
  %110 = load i32, ptr %109, align 4, !tbaa !5
  %111 = load i32, ptr %3, align 4, !tbaa !5
  %112 = sext i32 %111 to i64
  %113 = getelementptr inbounds [10001 x i32], ptr @child, i64 0, i64 %112
  %114 = load i32, ptr %113, align 4, !tbaa !5
  %115 = icmp ne i32 %110, %114
  br i1 %115, label %116, label %123

116:                                              ; preds = %108
  %117 = load i32, ptr @chainNum, align 4, !tbaa !5
  %118 = add nsw i32 %117, 1
  store i32 %118, ptr @chainNum, align 4, !tbaa !5
  %119 = load ptr, ptr %15, align 8, !tbaa !9
  %120 = load i32, ptr %119, align 4, !tbaa !5
  %121 = load ptr, ptr %16, align 8, !tbaa !9
  %122 = load i32, ptr %121, align 4, !tbaa !5
  call void @_Z3hldii(i32 noundef %120, i32 noundef %122)
  br label %123

123:                                              ; preds = %116, %108, %97
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #5
  br label %124

124:                                              ; preds = %123
  %125 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN9__gnu_cxx17__normal_iteratorIPSt5arrayIiLm2EESt6vectorIS2_SaIS2_EEEppEv(ptr noundef nonnull align 8 dereferenceable(8) %12) #5
  br label %94

126:                                              ; preds = %96
  ret void
}

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

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 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #4 = { 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 #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"}
!9 = !{!10, !10, i64 0}
!10 = !{!"any pointer", !7, i64 0}
!11 = !{i64 0, i64 8, !12}
!12 = !{!7, !7, i64 0}


; 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.std::vector.0" = type { %"struct.std::_Vector_base.1" }
%"struct.std::_Vector_base.1" = type { %"struct.std::_Vector_base<std::array<int, 2>, std::allocator<std::array<int, 2>>>::_Vector_impl" }
%"struct.std::_Vector_base<std::array<int, 2>, std::allocator<std::array<int, 2>>>::_Vector_impl" = type { %"struct.std::_Vector_base<std::array<int, 2>, std::allocator<std::array<int, 2>>>::_Vector_impl_data" }
%"struct.std::_Vector_base<std::array<int, 2>, std::allocator<std::array<int, 2>>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.__gnu_cxx::__normal_iterator" = type { ptr }
%"struct.std::array" = type { [2 x i32] }

@cnt = external dso_local local_unnamed_addr global i32, align 4
@par = external dso_local local_unnamed_addr global [10001 x i32], align 16
@child = external dso_local local_unnamed_addr global [10001 x i32], align 16
@chainNum = external dso_local local_unnamed_addr global i32, align 4
@chainHead = external dso_local local_unnamed_addr global [10001 x i32], align 16
@chainSize = external dso_local local_unnamed_addr global [10001 x i32], align 16
@chainId = external dso_local local_unnamed_addr global [10001 x i32], align 16
@chainPos = external dso_local local_unnamed_addr global [10001 x i32], align 16
@arr = external dso_local global %"class.std::vector", align 8
@pos = external dso_local local_unnamed_addr global [10001 x i32], align 16
@adj = external dso_local global [10001 x %"class.std::vector.0"], align 16

; 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 @_ZNSt6vectorISt5arrayIiLm2EESaIS1_EE5beginEv(ptr noundef nonnull align 8 dereferenceable(24)) local_unnamed_addr #1 align 2

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

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

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

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

; Function Attrs: mustprogress uwtable
define dso_local void @_Z3hldii(i32 noundef %0, i32 noundef %1) local_unnamed_addr #3 {
  %3 = alloca i32, align 4
  %4 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %5 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %6 = alloca %"struct.std::array", align 8
  %7 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %8 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %9 = alloca %"struct.std::array", align 8
  store i32 %1, ptr %3, align 4, !tbaa !5
  %10 = load i32, ptr @chainNum, align 4, !tbaa !5
  %11 = sext i32 %10 to i64
  %12 = getelementptr inbounds [10001 x i32], ptr @chainHead, i64 0, i64 %11
  %13 = load i32, ptr %12, align 4, !tbaa !5
  %14 = icmp eq i32 %13, -1
  br i1 %14, label %15, label %16

15:                                               ; preds = %2
  store i32 %0, ptr %12, align 4, !tbaa !5
  br label %16

16:                                               ; preds = %15, %2
  %17 = sext i32 %0 to i64
  %18 = getelementptr inbounds [10001 x i32], ptr @chainId, i64 0, i64 %17
  store i32 %10, ptr %18, align 4, !tbaa !5
  %19 = getelementptr inbounds [10001 x i32], ptr @chainSize, i64 0, i64 %11
  %20 = load i32, ptr %19, align 4, !tbaa !5
  %21 = add nsw i32 %20, 1
  store i32 %21, ptr %19, align 4, !tbaa !5
  %22 = getelementptr inbounds [10001 x i32], ptr @chainPos, i64 0, i64 %17
  store i32 %20, ptr %22, align 4, !tbaa !5
  call void @_ZNSt6vectorIiSaIiEE9push_backERKi(ptr noundef nonnull align 8 dereferenceable(24) @arr, ptr noundef nonnull align 4 dereferenceable(4) %3)
  %23 = load i32, ptr @cnt, align 4, !tbaa !5
  %24 = add nsw i32 %23, 1
  store i32 %24, ptr @cnt, align 4, !tbaa !5
  %25 = getelementptr inbounds [10001 x i32], ptr @pos, i64 0, i64 %17
  store i32 %23, ptr %25, align 4, !tbaa !5
  %26 = getelementptr inbounds [10001 x %"class.std::vector.0"], ptr @adj, i64 0, i64 %17
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %4) #4
  %27 = call ptr @_ZNSt6vectorISt5arrayIiLm2EESaIS1_EE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) %26) #4
  store ptr %27, ptr %4, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %5) #4
  %28 = call ptr @_ZNSt6vectorISt5arrayIiLm2EESaIS1_EE3endEv(ptr noundef nonnull align 8 dereferenceable(24) %26) #4
  store ptr %28, ptr %5, align 8
  %29 = call noundef zeroext i1 @_ZN9__gnu_cxxneIPSt5arrayIiLm2EESt6vectorIS2_SaIS2_EEEEbRKNS_17__normal_iteratorIT_T0_EESC_(ptr noundef nonnull align 8 dereferenceable(8) %4, ptr noundef nonnull align 8 dereferenceable(8) %5) #4
  br i1 %29, label %.lr.ph, label %._crit_edge

.lr.ph:                                           ; preds = %16
  %30 = getelementptr inbounds [10001 x i32], ptr @par, i64 0, i64 %17
  %31 = getelementptr inbounds [10001 x i32], ptr @child, i64 0, i64 %17
  br label %37

._crit_edge:                                      ; preds = %49, %16
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %5) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %7) #4
  %32 = call ptr @_ZNSt6vectorISt5arrayIiLm2EESaIS1_EE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) %26) #4
  store ptr %32, ptr %7, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %8) #4
  %33 = call ptr @_ZNSt6vectorISt5arrayIiLm2EESaIS1_EE3endEv(ptr noundef nonnull align 8 dereferenceable(24) %26) #4
  store ptr %33, ptr %8, align 8
  %34 = call noundef zeroext i1 @_ZN9__gnu_cxxneIPSt5arrayIiLm2EESt6vectorIS2_SaIS2_EEEEbRKNS_17__normal_iteratorIT_T0_EESC_(ptr noundef nonnull align 8 dereferenceable(8) %7, ptr noundef nonnull align 8 dereferenceable(8) %8) #4
  br i1 %34, label %.lr.ph25, label %._crit_edge26

.lr.ph25:                                         ; preds = %._crit_edge
  %35 = getelementptr inbounds [10001 x i32], ptr @par, i64 0, i64 %17
  %36 = getelementptr inbounds [10001 x i32], ptr @child, i64 0, i64 %17
  br label %52

37:                                               ; preds = %.lr.ph, %49
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %6) #4
  %38 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNK9__gnu_cxx17__normal_iteratorIPSt5arrayIiLm2EESt6vectorIS2_SaIS2_EEEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %4) #4
  %39 = load i64, ptr %38, align 4, !tbaa !9
  store i64 %39, ptr %6, align 8, !tbaa !9
  %40 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3getILm0EiLm2EEOT0_OSt5arrayIS0_XT1_EE(ptr noundef nonnull align 4 dereferenceable(8) %6) #4
  %41 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3getILm1EiLm2EEOT0_OSt5arrayIS0_XT1_EE(ptr noundef nonnull align 4 dereferenceable(8) %6) #4
  %42 = load i32, ptr %40, align 4, !tbaa !5
  %43 = load i32, ptr %30, align 4, !tbaa !5
  %.not23 = icmp eq i32 %42, %43
  br i1 %.not23, label %49, label %44

44:                                               ; preds = %37
  %45 = load i32, ptr %31, align 4, !tbaa !5
  %46 = icmp eq i32 %42, %45
  br i1 %46, label %47, label %49

47:                                               ; preds = %44
  %48 = load i32, ptr %41, align 4, !tbaa !5
  call void @_Z3hldii(i32 noundef %42, i32 noundef %48)
  br label %49

49:                                               ; preds = %47, %44, %37
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %6) #4
  %50 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN9__gnu_cxx17__normal_iteratorIPSt5arrayIiLm2EESt6vectorIS2_SaIS2_EEEppEv(ptr noundef nonnull align 8 dereferenceable(8) %4) #4
  %51 = call noundef zeroext i1 @_ZN9__gnu_cxxneIPSt5arrayIiLm2EESt6vectorIS2_SaIS2_EEEEbRKNS_17__normal_iteratorIT_T0_EESC_(ptr noundef nonnull align 8 dereferenceable(8) %4, ptr noundef nonnull align 8 dereferenceable(8) %5) #4
  br i1 %51, label %37, label %._crit_edge

._crit_edge26:                                    ; preds = %66, %._crit_edge
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %8) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %7) #4
  ret void

52:                                               ; preds = %.lr.ph25, %66
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %9) #4
  %53 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNK9__gnu_cxx17__normal_iteratorIPSt5arrayIiLm2EESt6vectorIS2_SaIS2_EEEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %7) #4
  %54 = load i64, ptr %53, align 4, !tbaa !9
  store i64 %54, ptr %9, align 8, !tbaa !9
  %55 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3getILm0EiLm2EEOT0_OSt5arrayIS0_XT1_EE(ptr noundef nonnull align 4 dereferenceable(8) %9) #4
  %56 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3getILm1EiLm2EEOT0_OSt5arrayIS0_XT1_EE(ptr noundef nonnull align 4 dereferenceable(8) %9) #4
  %57 = load i32, ptr %55, align 4, !tbaa !5
  %58 = load i32, ptr %35, align 4, !tbaa !5
  %.not = icmp eq i32 %57, %58
  br i1 %.not, label %66, label %59

59:                                               ; preds = %52
  %60 = load i32, ptr %36, align 4, !tbaa !5
  %.not22 = icmp eq i32 %57, %60
  br i1 %.not22, label %66, label %61

61:                                               ; preds = %59
  %62 = load i32, ptr @chainNum, align 4, !tbaa !5
  %63 = add nsw i32 %62, 1
  store i32 %63, ptr @chainNum, align 4, !tbaa !5
  %64 = load i32, ptr %55, align 4, !tbaa !5
  %65 = load i32, ptr %56, align 4, !tbaa !5
  call void @_Z3hldii(i32 noundef %64, i32 noundef %65)
  br label %66

66:                                               ; preds = %61, %59, %52
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %9) #4
  %67 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN9__gnu_cxx17__normal_iteratorIPSt5arrayIiLm2EESt6vectorIS2_SaIS2_EEEppEv(ptr noundef nonnull align 8 dereferenceable(8) %7) #4
  %68 = call noundef zeroext i1 @_ZN9__gnu_cxxneIPSt5arrayIiLm2EESt6vectorIS2_SaIS2_EEEEbRKNS_17__normal_iteratorIT_T0_EESC_(ptr noundef nonnull align 8 dereferenceable(8) %7, ptr noundef nonnull align 8 dereferenceable(8) %8) #4
  br i1 %68, label %52, label %._crit_edge26
}

; 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

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 = { 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 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!7, !7, i64 0}


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