; LLVM IR from pranjalwalia/Competitive-programming :: codeforces/161_D_distance_in_tree.ll (Z7get_ansi)

; Unoptimized IR (clang -disable-llvm-passes):
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

%"class.std::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl" }
%"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl" = type { %"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl_data" }
%"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.__gnu_cxx::__normal_iterator" = type { ptr }

@k = external dso_local global i32, align 4
@CT = external dso_local global [50010 x %"class.std::vector"], align 16
@ans = external dso_local global i64, align 8
@cnt2 = external dso_local global [50010 x [510 x i64]], align 16
@cnt3 = external dso_local global [50010 x [510 x i64]], 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: mustprogress nounwind uwtable
declare dso_local ptr @_ZNSt6vectorIiSaIiEE5beginEv(ptr noundef nonnull align 8 dereferenceable(24)) #1 align 2

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

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

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

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

; Function Attrs: mustprogress uwtable
define dso_local void @_Z7get_ansi(i32 noundef %0) #3 {
  %2 = alloca i32, align 4
  %3 = alloca ptr, align 8
  %4 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %5 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %6 = alloca i32, align 4
  %7 = alloca ptr, align 8
  %8 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %9 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  %12 = alloca i32, align 4
  %13 = alloca i32, align 4
  store i32 %0, ptr %2, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %3) #4
  %14 = load i32, ptr %2, align 4, !tbaa !5
  %15 = sext i32 %14 to i64
  %16 = getelementptr inbounds [50010 x %"class.std::vector"], ptr @CT, i64 0, i64 %15
  store ptr %16, ptr %3, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #4
  %17 = load ptr, ptr %3, align 8, !tbaa !9
  %18 = call ptr @_ZNSt6vectorIiSaIiEE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) %17) #4
  %19 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %4, i32 0, i32 0
  store ptr %18, ptr %19, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #4
  %20 = load ptr, ptr %3, align 8, !tbaa !9
  %21 = call ptr @_ZNSt6vectorIiSaIiEE3endEv(ptr noundef nonnull align 8 dereferenceable(24) %20) #4
  %22 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %5, i32 0, i32 0
  store ptr %21, ptr %22, align 8
  br label %23

23:                                               ; preds = %30, %1
  %24 = call noundef zeroext i1 @_ZN9__gnu_cxxneIPiSt6vectorIiSaIiEEEEbRKNS_17__normal_iteratorIT_T0_EESA_(ptr noundef nonnull align 8 dereferenceable(8) %4, ptr noundef nonnull align 8 dereferenceable(8) %5) #4
  br i1 %24, label %26, label %25

25:                                               ; preds = %23
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %3) #4
  br label %32

26:                                               ; preds = %23
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #4
  %27 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNK9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %4) #4
  %28 = load i32, ptr %27, align 4, !tbaa !5
  store i32 %28, ptr %6, align 4, !tbaa !5
  %29 = load i32, ptr %6, align 4, !tbaa !5
  call void @_Z7get_ansi(i32 noundef %29)
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #4
  br label %30

30:                                               ; preds = %26
  %31 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEppEv(ptr noundef nonnull align 8 dereferenceable(8) %4) #4
  br label %23

32:                                               ; preds = %25
  %33 = load i32, ptr %2, align 4, !tbaa !5
  %34 = sext i32 %33 to i64
  %35 = getelementptr inbounds [50010 x [510 x i64]], ptr @cnt3, i64 0, i64 %34
  %36 = getelementptr inbounds [510 x i64], ptr %35, i64 0, i64 0
  store i64 1, ptr %36, align 16, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #4
  %37 = load i32, ptr %2, align 4, !tbaa !5
  %38 = sext i32 %37 to i64
  %39 = getelementptr inbounds [50010 x %"class.std::vector"], ptr @CT, i64 0, i64 %38
  store ptr %39, ptr %7, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #4
  %40 = load ptr, ptr %7, align 8, !tbaa !9
  %41 = call ptr @_ZNSt6vectorIiSaIiEE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) %40) #4
  %42 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %8, i32 0, i32 0
  store ptr %41, ptr %42, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #4
  %43 = load ptr, ptr %7, align 8, !tbaa !9
  %44 = call ptr @_ZNSt6vectorIiSaIiEE3endEv(ptr noundef nonnull align 8 dereferenceable(24) %43) #4
  %45 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %9, i32 0, i32 0
  store ptr %44, ptr %45, align 8
  br label %46

46:                                               ; preds = %108, %32
  %47 = call noundef zeroext i1 @_ZN9__gnu_cxxneIPiSt6vectorIiSaIiEEEEbRKNS_17__normal_iteratorIT_T0_EESA_(ptr noundef nonnull align 8 dereferenceable(8) %8, ptr noundef nonnull align 8 dereferenceable(8) %9) #4
  br i1 %47, label %49, label %48

48:                                               ; preds = %46
  store i32 4, ptr %10, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #4
  br label %110

49:                                               ; preds = %46
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #4
  %50 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNK9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %8) #4
  %51 = load i32, ptr %50, align 4, !tbaa !5
  store i32 %51, ptr %11, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #4
  store i32 0, ptr %12, align 4, !tbaa !5
  br label %52

52:                                               ; preds = %78, %49
  %53 = load i32, ptr %12, align 4, !tbaa !5
  %54 = load i32, ptr @k, align 4, !tbaa !5
  %55 = add nsw i32 %54, 1
  %56 = icmp slt i32 %53, %55
  br i1 %56, label %58, label %57

57:                                               ; preds = %52
  store i32 6, ptr %10, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #4
  br label %81

58:                                               ; preds = %52
  %59 = load i32, ptr %11, align 4, !tbaa !5
  %60 = sext i32 %59 to i64
  %61 = getelementptr inbounds [50010 x [510 x i64]], ptr @cnt2, i64 0, i64 %60
  %62 = load i32, ptr %12, align 4, !tbaa !5
  %63 = sext i32 %62 to i64
  %64 = getelementptr inbounds [510 x i64], ptr %61, i64 0, i64 %63
  %65 = load i64, ptr %64, align 8, !tbaa !11
  %66 = load i32, ptr %2, align 4, !tbaa !5
  %67 = sext i32 %66 to i64
  %68 = getelementptr inbounds [50010 x [510 x i64]], ptr @cnt3, i64 0, i64 %67
  %69 = load i32, ptr @k, align 4, !tbaa !5
  %70 = load i32, ptr %12, align 4, !tbaa !5
  %71 = sub nsw i32 %69, %70
  %72 = sext i32 %71 to i64
  %73 = getelementptr inbounds [510 x i64], ptr %68, i64 0, i64 %72
  %74 = load i64, ptr %73, align 8, !tbaa !11
  %75 = mul nsw i64 %65, %74
  %76 = load i64, ptr @ans, align 8, !tbaa !11
  %77 = add nsw i64 %76, %75
  store i64 %77, ptr @ans, align 8, !tbaa !11
  br label %78

78:                                               ; preds = %58
  %79 = load i32, ptr %12, align 4, !tbaa !5
  %80 = add nsw i32 %79, 1
  store i32 %80, ptr %12, align 4, !tbaa !5
  br label %52, !llvm.loop !13

81:                                               ; preds = %57
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #4
  store i32 0, ptr %13, align 4, !tbaa !5
  br label %82

82:                                               ; preds = %104, %81
  %83 = load i32, ptr %13, align 4, !tbaa !5
  %84 = load i32, ptr @k, align 4, !tbaa !5
  %85 = add nsw i32 %84, 1
  %86 = icmp slt i32 %83, %85
  br i1 %86, label %88, label %87

87:                                               ; preds = %82
  store i32 9, ptr %10, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #4
  br label %107

88:                                               ; preds = %82
  %89 = load i32, ptr %11, align 4, !tbaa !5
  %90 = sext i32 %89 to i64
  %91 = getelementptr inbounds [50010 x [510 x i64]], ptr @cnt2, i64 0, i64 %90
  %92 = load i32, ptr %13, align 4, !tbaa !5
  %93 = sext i32 %92 to i64
  %94 = getelementptr inbounds [510 x i64], ptr %91, i64 0, i64 %93
  %95 = load i64, ptr %94, align 8, !tbaa !11
  %96 = load i32, ptr %2, align 4, !tbaa !5
  %97 = sext i32 %96 to i64
  %98 = getelementptr inbounds [50010 x [510 x i64]], ptr @cnt3, i64 0, i64 %97
  %99 = load i32, ptr %13, align 4, !tbaa !5
  %100 = sext i32 %99 to i64
  %101 = getelementptr inbounds [510 x i64], ptr %98, i64 0, i64 %100
  %102 = load i64, ptr %101, align 8, !tbaa !11
  %103 = add nsw i64 %102, %95
  store i64 %103, ptr %101, align 8, !tbaa !11
  br label %104

104:                                              ; preds = %88
  %105 = load i32, ptr %13, align 4, !tbaa !5
  %106 = add nsw i32 %105, 1
  store i32 %106, ptr %13, align 4, !tbaa !5
  br label %82, !llvm.loop !15

107:                                              ; preds = %87
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #4
  br label %108

108:                                              ; preds = %107
  %109 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEppEv(ptr noundef nonnull align 8 dereferenceable(8) %8) #4
  br label %46

110:                                              ; preds = %48
  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 = !{!"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 = !{!12, !12, i64 0}
!12 = !{!"long long", !7, 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<int, std::allocator<int>>::_Vector_impl" }
%"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl" = type { %"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl_data" }
%"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.__gnu_cxx::__normal_iterator" = type { ptr }

@k = external dso_local local_unnamed_addr global i32, align 4
@CT = external dso_local global [50010 x %"class.std::vector"], align 16
@ans = external dso_local local_unnamed_addr global i64, align 8
@cnt2 = external dso_local local_unnamed_addr global [50010 x [510 x i64]], align 16
@cnt3 = external dso_local local_unnamed_addr global [50010 x [510 x i64]], 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 nounwind uwtable
declare dso_local ptr @_ZNSt6vectorIiSaIiEE5beginEv(ptr noundef nonnull align 8 dereferenceable(24)) local_unnamed_addr #1 align 2

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

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

; Function Attrs: mustprogress nounwind uwtable
define dso_local void @_Z7get_ansi(i32 noundef %0) local_unnamed_addr #1 {
  %2 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %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 = sext i32 %0 to i64
  %7 = getelementptr inbounds [50010 x %"class.std::vector"], ptr @CT, i64 0, i64 %6
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %2) #4
  %8 = tail call ptr @_ZNSt6vectorIiSaIiEE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) %7) #4
  store ptr %8, ptr %2, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %3) #4
  %9 = tail call ptr @_ZNSt6vectorIiSaIiEE3endEv(ptr noundef nonnull align 8 dereferenceable(24) %7) #4
  store ptr %9, ptr %3, align 8
  %10 = call noundef zeroext i1 @_ZN9__gnu_cxxneIPiSt6vectorIiSaIiEEEEbRKNS_17__normal_iteratorIT_T0_EESA_(ptr noundef nonnull align 8 dereferenceable(8) %2, ptr noundef nonnull align 8 dereferenceable(8) %3) #4
  br i1 %10, label %.lr.ph, label %._crit_edge

._crit_edge:                                      ; preds = %.lr.ph, %1
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %3) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %2) #4
  %11 = getelementptr inbounds [50010 x [510 x i64]], ptr @cnt3, i64 0, i64 %6
  store i64 1, ptr %11, align 16, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %4) #4
  %12 = call ptr @_ZNSt6vectorIiSaIiEE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) %7) #4
  store ptr %12, ptr %4, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %5) #4
  %13 = call ptr @_ZNSt6vectorIiSaIiEE3endEv(ptr noundef nonnull align 8 dereferenceable(24) %7) #4
  store ptr %13, ptr %5, align 8
  %14 = call noundef zeroext i1 @_ZN9__gnu_cxxneIPiSt6vectorIiSaIiEEEEbRKNS_17__normal_iteratorIT_T0_EESA_(ptr noundef nonnull align 8 dereferenceable(8) %4, ptr noundef nonnull align 8 dereferenceable(8) %5) #4
  br i1 %14, label %.lr.ph31, label %._crit_edge32

.lr.ph:                                           ; preds = %1, %.lr.ph
  %15 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNK9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %2) #4
  %16 = load i32, ptr %15, align 4, !tbaa !9
  call void @_Z7get_ansi(i32 noundef %16)
  %17 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEppEv(ptr noundef nonnull align 8 dereferenceable(8) %2) #4
  %18 = call noundef zeroext i1 @_ZN9__gnu_cxxneIPiSt6vectorIiSaIiEEEEbRKNS_17__normal_iteratorIT_T0_EESA_(ptr noundef nonnull align 8 dereferenceable(8) %2, ptr noundef nonnull align 8 dereferenceable(8) %3) #4
  br i1 %18, label %.lr.ph, label %._crit_edge

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

.lr.ph31:                                         ; preds = %._crit_edge, %._crit_edge29
  %19 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNK9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %4) #4
  %20 = load i32, ptr %19, align 4, !tbaa !9
  %21 = load i32, ptr @k, align 4, !tbaa !9
  %.not21 = icmp slt i32 %21, 0
  br i1 %.not21, label %._crit_edge29, label %.lr.ph24

.lr.ph24:                                         ; preds = %.lr.ph31
  %ans.promoted = load i64, ptr @ans, align 8, !tbaa !5
  %22 = sext i32 %20 to i64
  %23 = zext nneg i32 %21 to i64
  %24 = add nuw i32 %21, 1
  %wide.trip.count = zext i32 %24 to i64
  %min.iters.check44 = icmp ult i32 %21, 3
  br i1 %min.iters.check44, label %scalar.ph43.preheader, label %vector.ph45

scalar.ph43.preheader:                            ; preds = %middle.block42, %.lr.ph24
  %indvars.iv.ph = phi i64 [ 0, %.lr.ph24 ], [ %n.vec47, %middle.block42 ]
  %.ph = phi i64 [ %ans.promoted, %.lr.ph24 ], [ %37, %middle.block42 ]
  br label %scalar.ph43

vector.ph45:                                      ; preds = %.lr.ph24
  %n.vec47 = and i64 %wide.trip.count, 4294967292
  %25 = insertelement <2 x i64> <i64 poison, i64 0>, i64 %ans.promoted, i64 0
  br label %vector.body49

vector.body49:                                    ; preds = %vector.body49, %vector.ph45
  %index50 = phi i64 [ 0, %vector.ph45 ], [ %index.next57, %vector.body49 ]
  %vec.phi = phi <2 x i64> [ %25, %vector.ph45 ], [ %34, %vector.body49 ]
  %vec.phi51 = phi <2 x i64> [ zeroinitializer, %vector.ph45 ], [ %35, %vector.body49 ]
  %26 = getelementptr inbounds [50010 x [510 x i64]], ptr @cnt2, i64 0, i64 %22, i64 %index50
  %27 = getelementptr inbounds i8, ptr %26, i64 16
  %wide.load52 = load <2 x i64>, ptr %26, align 16, !tbaa !5
  %wide.load53 = load <2 x i64>, ptr %27, align 16, !tbaa !5
  %28 = sub nsw i64 %23, %index50
  %29 = getelementptr inbounds [50010 x [510 x i64]], ptr @cnt3, i64 0, i64 %6, i64 %28
  %30 = getelementptr inbounds i8, ptr %29, i64 -8
  %31 = getelementptr inbounds i8, ptr %29, i64 -24
  %wide.load54 = load <2 x i64>, ptr %30, align 8, !tbaa !5
  %reverse = shufflevector <2 x i64> %wide.load54, <2 x i64> poison, <2 x i32> <i32 1, i32 0>
  %wide.load55 = load <2 x i64>, ptr %31, align 8, !tbaa !5
  %reverse56 = shufflevector <2 x i64> %wide.load55, <2 x i64> poison, <2 x i32> <i32 1, i32 0>
  %32 = mul nsw <2 x i64> %reverse, %wide.load52
  %33 = mul nsw <2 x i64> %reverse56, %wide.load53
  %34 = add <2 x i64> %vec.phi, %32
  %35 = add <2 x i64> %vec.phi51, %33
  %index.next57 = add nuw i64 %index50, 4
  %36 = icmp eq i64 %index.next57, %n.vec47
  br i1 %36, label %middle.block42, label %vector.body49, !llvm.loop !11

middle.block42:                                   ; preds = %vector.body49
  %bin.rdx = add <2 x i64> %35, %34
  %37 = call i64 @llvm.vector.reduce.add.v2i64(<2 x i64> %bin.rdx)
  %cmp.n58 = icmp eq i64 %n.vec47, %wide.trip.count
  br i1 %cmp.n58, label %.preheader, label %scalar.ph43.preheader

.preheader:                                       ; preds = %scalar.ph43, %middle.block42
  %.lcssa = phi i64 [ %37, %middle.block42 ], [ %54, %scalar.ph43 ]
  store i64 %.lcssa, ptr @ans, align 8, !tbaa !5
  br i1 %.not21, label %._crit_edge29, label %.lr.ph28

.lr.ph28:                                         ; preds = %.preheader
  %38 = sext i32 %20 to i64
  %39 = add nuw i32 %21, 1
  %wide.trip.count37 = zext i32 %39 to i64
  %min.iters.check = icmp ult i32 %21, 3
  br i1 %min.iters.check, label %scalar.ph.preheader, label %vector.ph

scalar.ph.preheader:                              ; preds = %middle.block, %.lr.ph28
  %indvars.iv34.ph = phi i64 [ 0, %.lr.ph28 ], [ %n.vec, %middle.block ]
  br label %scalar.ph

vector.ph:                                        ; preds = %.lr.ph28
  %n.vec = and i64 %wide.trip.count, 4294967292
  br label %vector.body

vector.body:                                      ; preds = %vector.body, %vector.ph
  %index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
  %40 = getelementptr inbounds [50010 x [510 x i64]], ptr @cnt2, i64 0, i64 %38, i64 %index
  %41 = getelementptr inbounds i8, ptr %40, i64 16
  %wide.load = load <2 x i64>, ptr %40, align 16, !tbaa !5
  %wide.load39 = load <2 x i64>, ptr %41, align 16, !tbaa !5
  %42 = getelementptr inbounds [50010 x [510 x i64]], ptr @cnt3, i64 0, i64 %6, i64 %index
  %43 = getelementptr inbounds i8, ptr %42, i64 16
  %wide.load40 = load <2 x i64>, ptr %42, align 16, !tbaa !5
  %wide.load41 = load <2 x i64>, ptr %43, align 16, !tbaa !5
  %44 = add nsw <2 x i64> %wide.load40, %wide.load
  %45 = add nsw <2 x i64> %wide.load41, %wide.load39
  store <2 x i64> %44, ptr %42, align 16, !tbaa !5
  store <2 x i64> %45, ptr %43, align 16, !tbaa !5
  %index.next = add nuw i64 %index, 4
  %46 = icmp eq i64 %index.next, %n.vec
  br i1 %46, label %middle.block, label %vector.body, !llvm.loop !15

middle.block:                                     ; preds = %vector.body
  %cmp.n = icmp eq i64 %n.vec, %wide.trip.count
  br i1 %cmp.n, label %._crit_edge29, label %scalar.ph.preheader

scalar.ph43:                                      ; preds = %scalar.ph43.preheader, %scalar.ph43
  %indvars.iv = phi i64 [ %indvars.iv.next, %scalar.ph43 ], [ %indvars.iv.ph, %scalar.ph43.preheader ]
  %47 = phi i64 [ %54, %scalar.ph43 ], [ %.ph, %scalar.ph43.preheader ]
  %48 = getelementptr inbounds [50010 x [510 x i64]], ptr @cnt2, i64 0, i64 %22, i64 %indvars.iv
  %49 = load i64, ptr %48, align 8, !tbaa !5
  %50 = sub nsw i64 %23, %indvars.iv
  %51 = getelementptr inbounds [50010 x [510 x i64]], ptr @cnt3, i64 0, i64 %6, i64 %50
  %52 = load i64, ptr %51, align 8, !tbaa !5
  %53 = mul nsw i64 %52, %49
  %54 = add nsw i64 %47, %53
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
  br i1 %exitcond.not, label %.preheader, label %scalar.ph43, !llvm.loop !16

._crit_edge29:                                    ; preds = %scalar.ph, %middle.block, %.lr.ph31, %.preheader
  %55 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEppEv(ptr noundef nonnull align 8 dereferenceable(8) %4) #4
  %56 = call noundef zeroext i1 @_ZN9__gnu_cxxneIPiSt6vectorIiSaIiEEEEbRKNS_17__normal_iteratorIT_T0_EESA_(ptr noundef nonnull align 8 dereferenceable(8) %4, ptr noundef nonnull align 8 dereferenceable(8) %5) #4
  br i1 %56, label %.lr.ph31, label %._crit_edge32

scalar.ph:                                        ; preds = %scalar.ph.preheader, %scalar.ph
  %indvars.iv34 = phi i64 [ %indvars.iv.next35, %scalar.ph ], [ %indvars.iv34.ph, %scalar.ph.preheader ]
  %57 = getelementptr inbounds [50010 x [510 x i64]], ptr @cnt2, i64 0, i64 %38, i64 %indvars.iv34
  %58 = load i64, ptr %57, align 8, !tbaa !5
  %59 = getelementptr inbounds [50010 x [510 x i64]], ptr @cnt3, i64 0, i64 %6, i64 %indvars.iv34
  %60 = load i64, ptr %59, align 8, !tbaa !5
  %61 = add nsw i64 %60, %58
  store i64 %61, ptr %59, align 8, !tbaa !5
  %indvars.iv.next35 = add nuw nsw i64 %indvars.iv34, 1
  %exitcond38.not = icmp eq i64 %indvars.iv.next35, %wide.trip.count37
  br i1 %exitcond38.not, label %._crit_edge29, label %scalar.ph, !llvm.loop !17
}

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.vector.reduce.add.v2i64(<2 x i64>) #3

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 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
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 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = distinct !{!11, !12, !13, !14}
!12 = !{!"llvm.loop.mustprogress"}
!13 = !{!"llvm.loop.isvectorized", i32 1}
!14 = !{!"llvm.loop.unroll.runtime.disable"}
!15 = distinct !{!15, !12, !13, !14}
!16 = distinct !{!16, !12, !14, !13}
!17 = distinct !{!17, !12, !14, !13}


; Effective O3 passes: EarlyCSEPass,GVNPass,GlobalOptPass,IndVarSimplifyPass,InferAlignmentPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LICMPass,LoopInstSimplifyPass,LoopLoadEliminationPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,LoopVectorizePass,PostOrderFunctionAttrsPass,ReassociatePass,SROAPass,SimplifyCFGPass,TailCallElimPass