; LLVM IR from kazunetakahashi/atcoder :: 2019/0707_ABC133/past/F.ll (Z3dfsii)

; 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<Edge, std::allocator<Edge>>::_Vector_impl" }
%"struct.std::_Vector_base<Edge, std::allocator<Edge>>::_Vector_impl" = type { %"struct.std::_Vector_base<Edge, std::allocator<Edge>>::_Vector_impl_data" }
%"struct.std::_Vector_base<Edge, std::allocator<Edge>>::_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<Query, std::allocator<Query>>::_Vector_impl" }
%"struct.std::_Vector_base<Query, std::allocator<Query>>::_Vector_impl" = type { %"struct.std::_Vector_base<Query, std::allocator<Query>>::_Vector_impl_data" }
%"struct.std::_Vector_base<Query, std::allocator<Query>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.std::vector.5" = type { %"struct.std::_Vector_base.6" }
%"struct.std::_Vector_base.6" = 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 }
%struct.Query = type { i32, i32, i32, i32 }
%"class.__gnu_cxx::__normal_iterator.10" = type { ptr }
%struct.Edge = type { i32, i32, i32 }

@es = external dso_local global [100010 x %"class.std::vector"], align 16
@qs = external dso_local global [100010 x %"class.std::vector.0"], align 16
@ans = external dso_local global %"class.std::vector.5", align 8
@cnt = external dso_local global [100010 x i32], align 16
@sum = external dso_local global [100010 x i64], align 16

; Function Attrs: mustprogress uwtable
define dso_local void @_Z3dfsii(i32 noundef %0, i32 noundef %1) #0 {
  %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.Query, align 4
  %9 = alloca i64, align 8
  %10 = alloca ptr, align 8
  %11 = alloca %"class.__gnu_cxx::__normal_iterator.10", align 8
  %12 = alloca %"class.__gnu_cxx::__normal_iterator.10", align 8
  %13 = alloca i32, align 4
  %14 = alloca %struct.Edge, align 4
  store i32 %0, ptr %3, align 4, !tbaa !5
  store i32 %1, ptr %4, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #5
  %15 = load i32, ptr %3, align 4, !tbaa !5
  %16 = sext i32 %15 to i64
  %17 = getelementptr inbounds [100010 x %"class.std::vector.0"], ptr @qs, i64 0, i64 %16
  store ptr %17, ptr %5, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #5
  %18 = load ptr, ptr %5, align 8, !tbaa !9
  %19 = call ptr @_ZNSt6vectorI5QuerySaIS0_EE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) %18) #5
  %20 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %6, i32 0, i32 0
  store ptr %19, ptr %20, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #5
  %21 = load ptr, ptr %5, align 8, !tbaa !9
  %22 = call ptr @_ZNSt6vectorI5QuerySaIS0_EE3endEv(ptr noundef nonnull align 8 dereferenceable(24) %21) #5
  %23 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %7, i32 0, i32 0
  store ptr %22, ptr %23, align 8
  br label %24

24:                                               ; preds = %58, %2
  %25 = call noundef zeroext i1 @_ZN9__gnu_cxxneIP5QuerySt6vectorIS1_SaIS1_EEEEbRKNS_17__normal_iteratorIT_T0_EESB_(ptr noundef nonnull align 8 dereferenceable(8) %6, ptr noundef nonnull align 8 dereferenceable(8) %7) #5
  br i1 %25, label %27, label %26

26:                                               ; preds = %24
  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 %60

27:                                               ; preds = %24
  call void @llvm.lifetime.start.p0(i64 16, ptr %8) #5
  %28 = call noundef nonnull align 4 dereferenceable(16) ptr @_ZNK9__gnu_cxx17__normal_iteratorIP5QuerySt6vectorIS1_SaIS1_EEEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %6) #5
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %8, ptr align 4 %28, i64 16, i1 false), !tbaa.struct !11
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #5
  %29 = getelementptr inbounds %struct.Query, ptr %8, i32 0, i32 0
  %30 = load i32, ptr %29, align 4, !tbaa !12
  %31 = sext i32 %30 to i64
  %32 = getelementptr inbounds [100010 x i64], ptr @sum, i64 0, i64 %31
  %33 = load i64, ptr %32, align 8, !tbaa !14
  %34 = sub nsw i64 0, %33
  store i64 %34, ptr %9, align 8, !tbaa !14
  %35 = getelementptr inbounds %struct.Query, ptr %8, i32 0, i32 3
  %36 = load i32, ptr %35, align 4, !tbaa !16
  %37 = sext i32 %36 to i64
  %38 = getelementptr inbounds %struct.Query, ptr %8, i32 0, i32 0
  %39 = load i32, ptr %38, align 4, !tbaa !12
  %40 = sext i32 %39 to i64
  %41 = getelementptr inbounds [100010 x i32], ptr @cnt, i64 0, i64 %40
  %42 = load i32, ptr %41, align 4, !tbaa !5
  %43 = sext i32 %42 to i64
  %44 = mul nsw i64 %37, %43
  %45 = load i64, ptr %9, align 8, !tbaa !14
  %46 = add nsw i64 %45, %44
  store i64 %46, ptr %9, align 8, !tbaa !14
  %47 = load i64, ptr %9, align 8, !tbaa !14
  %48 = getelementptr inbounds %struct.Query, ptr %8, i32 0, i32 2
  %49 = load i32, ptr %48, align 4, !tbaa !17
  %50 = sext i32 %49 to i64
  %51 = mul nsw i64 %47, %50
  %52 = getelementptr inbounds %struct.Query, ptr %8, i32 0, i32 1
  %53 = load i32, ptr %52, align 4, !tbaa !18
  %54 = sext i32 %53 to i64
  %55 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIxSaIxEEixEm(ptr noundef nonnull align 8 dereferenceable(24) @ans, i64 noundef %54) #5
  %56 = load i64, ptr %55, align 8, !tbaa !14
  %57 = add nsw i64 %56, %51
  store i64 %57, ptr %55, align 8, !tbaa !14
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #5
  call void @llvm.lifetime.end.p0(i64 16, ptr %8) #5
  br label %58

58:                                               ; preds = %27
  %59 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN9__gnu_cxx17__normal_iteratorIP5QuerySt6vectorIS1_SaIS1_EEEppEv(ptr noundef nonnull align 8 dereferenceable(8) %6) #5
  br label %24

60:                                               ; preds = %26
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #5
  %61 = load i32, ptr %3, align 4, !tbaa !5
  %62 = sext i32 %61 to i64
  %63 = getelementptr inbounds [100010 x %"class.std::vector"], ptr @es, i64 0, i64 %62
  store ptr %63, ptr %10, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #5
  %64 = load ptr, ptr %10, align 8, !tbaa !9
  %65 = call ptr @_ZNSt6vectorI4EdgeSaIS0_EE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) %64) #5
  %66 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator.10", ptr %11, i32 0, i32 0
  store ptr %65, ptr %66, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #5
  %67 = load ptr, ptr %10, align 8, !tbaa !9
  %68 = call ptr @_ZNSt6vectorI4EdgeSaIS0_EE3endEv(ptr noundef nonnull align 8 dereferenceable(24) %67) #5
  %69 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator.10", ptr %12, i32 0, i32 0
  store ptr %68, ptr %69, align 8
  br label %70

70:                                               ; preds = %117, %60
  %71 = call noundef zeroext i1 @_ZN9__gnu_cxxneIP4EdgeSt6vectorIS1_SaIS1_EEEEbRKNS_17__normal_iteratorIT_T0_EESB_(ptr noundef nonnull align 8 dereferenceable(8) %11, ptr noundef nonnull align 8 dereferenceable(8) %12) #5
  br i1 %71, label %73, label %72

72:                                               ; preds = %70
  store i32 4, ptr %13, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #5
  br label %119

73:                                               ; preds = %70
  call void @llvm.lifetime.start.p0(i64 12, ptr %14) #5
  %74 = call noundef nonnull align 4 dereferenceable(12) ptr @_ZNK9__gnu_cxx17__normal_iteratorIP4EdgeSt6vectorIS1_SaIS1_EEEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %11) #5
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %14, ptr align 4 %74, i64 12, i1 false), !tbaa.struct !19
  %75 = getelementptr inbounds %struct.Edge, ptr %14, i32 0, i32 0
  %76 = load i32, ptr %75, align 4, !tbaa !20
  %77 = load i32, ptr %4, align 4, !tbaa !5
  %78 = icmp eq i32 %76, %77
  br i1 %78, label %79, label %80

79:                                               ; preds = %73
  store i32 5, ptr %13, align 4
  br label %114

80:                                               ; preds = %73
  %81 = getelementptr inbounds %struct.Edge, ptr %14, i32 0, i32 2
  %82 = load i32, ptr %81, align 4, !tbaa !22
  %83 = sext i32 %82 to i64
  %84 = getelementptr inbounds [100010 x i32], ptr @cnt, i64 0, i64 %83
  %85 = load i32, ptr %84, align 4, !tbaa !5
  %86 = add nsw i32 %85, 1
  store i32 %86, ptr %84, align 4, !tbaa !5
  %87 = getelementptr inbounds %struct.Edge, ptr %14, i32 0, i32 1
  %88 = load i32, ptr %87, align 4, !tbaa !23
  %89 = sext i32 %88 to i64
  %90 = getelementptr inbounds %struct.Edge, ptr %14, i32 0, i32 2
  %91 = load i32, ptr %90, align 4, !tbaa !22
  %92 = sext i32 %91 to i64
  %93 = getelementptr inbounds [100010 x i64], ptr @sum, i64 0, i64 %92
  %94 = load i64, ptr %93, align 8, !tbaa !14
  %95 = add nsw i64 %94, %89
  store i64 %95, ptr %93, align 8, !tbaa !14
  %96 = getelementptr inbounds %struct.Edge, ptr %14, i32 0, i32 0
  %97 = load i32, ptr %96, align 4, !tbaa !20
  %98 = load i32, ptr %3, align 4, !tbaa !5
  call void @_Z3dfsii(i32 noundef %97, i32 noundef %98)
  %99 = getelementptr inbounds %struct.Edge, ptr %14, i32 0, i32 2
  %100 = load i32, ptr %99, align 4, !tbaa !22
  %101 = sext i32 %100 to i64
  %102 = getelementptr inbounds [100010 x i32], ptr @cnt, i64 0, i64 %101
  %103 = load i32, ptr %102, align 4, !tbaa !5
  %104 = add nsw i32 %103, -1
  store i32 %104, ptr %102, align 4, !tbaa !5
  %105 = getelementptr inbounds %struct.Edge, ptr %14, i32 0, i32 1
  %106 = load i32, ptr %105, align 4, !tbaa !23
  %107 = sext i32 %106 to i64
  %108 = getelementptr inbounds %struct.Edge, ptr %14, i32 0, i32 2
  %109 = load i32, ptr %108, align 4, !tbaa !22
  %110 = sext i32 %109 to i64
  %111 = getelementptr inbounds [100010 x i64], ptr @sum, i64 0, i64 %110
  %112 = load i64, ptr %111, align 8, !tbaa !14
  %113 = sub nsw i64 %112, %107
  store i64 %113, ptr %111, align 8, !tbaa !14
  store i32 0, ptr %13, align 4
  br label %114

114:                                              ; preds = %80, %79
  call void @llvm.lifetime.end.p0(i64 12, ptr %14) #5
  %115 = load i32, ptr %13, align 4
  switch i32 %115, label %120 [
    i32 0, label %116
    i32 5, label %117
  ]

116:                                              ; preds = %114
  br label %117

117:                                              ; preds = %116, %114
  %118 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN9__gnu_cxx17__normal_iteratorIP4EdgeSt6vectorIS1_SaIS1_EEEppEv(ptr noundef nonnull align 8 dereferenceable(8) %11) #5
  br label %70

119:                                              ; preds = %72
  ret void

120:                                              ; preds = %114
  unreachable
}

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

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

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

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

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

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

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

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

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

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

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(8) ptr @_ZN9__gnu_cxx17__normal_iteratorIP4EdgeSt6vectorIS1_SaIS1_EEEppEv(ptr noundef nonnull align 8 dereferenceable(8)) #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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { 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 #4 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
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 4, !5, i64 4, i64 4, !5, i64 8, i64 4, !5, i64 12, i64 4, !5}
!12 = !{!13, !6, i64 0}
!13 = !{!"_ZTS5Query", !6, i64 0, !6, i64 4, !6, i64 8, !6, i64 12}
!14 = !{!15, !15, i64 0}
!15 = !{!"long long", !7, i64 0}
!16 = !{!13, !6, i64 12}
!17 = !{!13, !6, i64 8}
!18 = !{!13, !6, i64 4}
!19 = !{i64 0, i64 4, !5, i64 4, i64 4, !5, i64 8, i64 4, !5}
!20 = !{!21, !6, i64 0}
!21 = !{!"_ZTS4Edge", !6, i64 0, !6, i64 4, !6, i64 8}
!22 = !{!21, !6, i64 8}
!23 = !{!21, !6, i64 4}


; 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<Edge, std::allocator<Edge>>::_Vector_impl" }
%"struct.std::_Vector_base<Edge, std::allocator<Edge>>::_Vector_impl" = type { %"struct.std::_Vector_base<Edge, std::allocator<Edge>>::_Vector_impl_data" }
%"struct.std::_Vector_base<Edge, std::allocator<Edge>>::_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<Query, std::allocator<Query>>::_Vector_impl" }
%"struct.std::_Vector_base<Query, std::allocator<Query>>::_Vector_impl" = type { %"struct.std::_Vector_base<Query, std::allocator<Query>>::_Vector_impl_data" }
%"struct.std::_Vector_base<Query, std::allocator<Query>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.std::vector.5" = type { %"struct.std::_Vector_base.6" }
%"struct.std::_Vector_base.6" = 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 }
%"class.__gnu_cxx::__normal_iterator.10" = type { ptr }

@es = external dso_local global [100010 x %"class.std::vector"], align 16
@qs = external dso_local global [100010 x %"class.std::vector.0"], align 16
@ans = external dso_local global %"class.std::vector.5", align 8
@cnt = external dso_local local_unnamed_addr global [100010 x i32], align 16
@sum = external dso_local local_unnamed_addr global [100010 x i64], align 16

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

._crit_edge:                                      ; preds = %.lr.ph, %2
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %3) #3
  %12 = getelementptr inbounds [100010 x %"class.std::vector"], ptr @es, i64 0, i64 %7
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %5) #3
  %13 = call ptr @_ZNSt6vectorI4EdgeSaIS0_EE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) %12) #3
  store ptr %13, ptr %5, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %6) #3
  %14 = call ptr @_ZNSt6vectorI4EdgeSaIS0_EE3endEv(ptr noundef nonnull align 8 dereferenceable(24) %12) #3
  store ptr %14, ptr %6, align 8
  %15 = call noundef zeroext i1 @_ZN9__gnu_cxxneIP4EdgeSt6vectorIS1_SaIS1_EEEEbRKNS_17__normal_iteratorIT_T0_EESB_(ptr noundef nonnull align 8 dereferenceable(8) %5, ptr noundef nonnull align 8 dereferenceable(8) %6) #3
  br i1 %15, label %.lr.ph19, label %._crit_edge20

.lr.ph:                                           ; preds = %2, %.lr.ph
  %16 = call noundef nonnull align 4 dereferenceable(16) ptr @_ZNK9__gnu_cxx17__normal_iteratorIP5QuerySt6vectorIS1_SaIS1_EEEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %3) #3
  %.sroa.08.0.copyload = load i32, ptr %16, align 4, !tbaa !5
  %.sroa.510.0..sroa_idx = getelementptr inbounds i8, ptr %16, i64 4
  %.sroa.510.0.copyload = load i32, ptr %.sroa.510.0..sroa_idx, align 4, !tbaa !5
  %.sroa.6.0..sroa_idx = getelementptr inbounds i8, ptr %16, i64 8
  %.sroa.6.0.copyload = load i32, ptr %.sroa.6.0..sroa_idx, align 4, !tbaa !5
  %.sroa.711.0..sroa_idx = getelementptr inbounds i8, ptr %16, i64 12
  %.sroa.711.0.copyload = load i32, ptr %.sroa.711.0..sroa_idx, align 4, !tbaa !5
  %17 = sext i32 %.sroa.08.0.copyload to i64
  %18 = getelementptr inbounds [100010 x i64], ptr @sum, i64 0, i64 %17
  %19 = load i64, ptr %18, align 8, !tbaa !9
  %20 = sext i32 %.sroa.711.0.copyload to i64
  %21 = getelementptr inbounds [100010 x i32], ptr @cnt, i64 0, i64 %17
  %22 = load i32, ptr %21, align 4, !tbaa !5
  %23 = sext i32 %22 to i64
  %24 = mul nsw i64 %23, %20
  %25 = sub i64 %24, %19
  %26 = sext i32 %.sroa.6.0.copyload to i64
  %27 = mul nsw i64 %25, %26
  %28 = sext i32 %.sroa.510.0.copyload to i64
  %29 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIxSaIxEEixEm(ptr noundef nonnull align 8 dereferenceable(24) @ans, i64 noundef %28) #3
  %30 = load i64, ptr %29, align 8, !tbaa !9
  %31 = add nsw i64 %27, %30
  store i64 %31, ptr %29, align 8, !tbaa !9
  %32 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN9__gnu_cxx17__normal_iteratorIP5QuerySt6vectorIS1_SaIS1_EEEppEv(ptr noundef nonnull align 8 dereferenceable(8) %3) #3
  %33 = call noundef zeroext i1 @_ZN9__gnu_cxxneIP5QuerySt6vectorIS1_SaIS1_EEEEbRKNS_17__normal_iteratorIT_T0_EESB_(ptr noundef nonnull align 8 dereferenceable(8) %3, ptr noundef nonnull align 8 dereferenceable(8) %4) #3
  br i1 %33, label %.lr.ph, label %._crit_edge

._crit_edge20:                                    ; preds = %49, %._crit_edge
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %6) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %5) #3
  ret void

.lr.ph19:                                         ; preds = %._crit_edge, %49
  %34 = call noundef nonnull align 4 dereferenceable(12) ptr @_ZNK9__gnu_cxx17__normal_iteratorIP4EdgeSt6vectorIS1_SaIS1_EEEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %5) #3
  %.sroa.0.0.copyload = load i32, ptr %34, align 4, !tbaa !5
  %35 = icmp eq i32 %.sroa.0.0.copyload, %1
  br i1 %35, label %49, label %36

36:                                               ; preds = %.lr.ph19
  %.sroa.7.0..sroa_idx = getelementptr inbounds i8, ptr %34, i64 8
  %.sroa.7.0.copyload = load i32, ptr %.sroa.7.0..sroa_idx, align 4, !tbaa !5
  %.sroa.5.0..sroa_idx = getelementptr inbounds i8, ptr %34, i64 4
  %.sroa.5.0.copyload = load i32, ptr %.sroa.5.0..sroa_idx, align 4, !tbaa !5
  %37 = sext i32 %.sroa.7.0.copyload to i64
  %38 = getelementptr inbounds [100010 x i32], ptr @cnt, i64 0, i64 %37
  %39 = load i32, ptr %38, align 4, !tbaa !5
  %40 = add nsw i32 %39, 1
  store i32 %40, ptr %38, align 4, !tbaa !5
  %41 = sext i32 %.sroa.5.0.copyload to i64
  %42 = getelementptr inbounds [100010 x i64], ptr @sum, i64 0, i64 %37
  %43 = load i64, ptr %42, align 8, !tbaa !9
  %44 = add nsw i64 %43, %41
  store i64 %44, ptr %42, align 8, !tbaa !9
  call void @_Z3dfsii(i32 noundef %.sroa.0.0.copyload, i32 noundef %0)
  %45 = load i32, ptr %38, align 4, !tbaa !5
  %46 = add nsw i32 %45, -1
  store i32 %46, ptr %38, align 4, !tbaa !5
  %47 = load i64, ptr %42, align 8, !tbaa !9
  %48 = sub nsw i64 %47, %41
  store i64 %48, ptr %42, align 8, !tbaa !9
  br label %49

49:                                               ; preds = %.lr.ph19, %36
  %50 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN9__gnu_cxx17__normal_iteratorIP4EdgeSt6vectorIS1_SaIS1_EEEppEv(ptr noundef nonnull align 8 dereferenceable(8) %5) #3
  %51 = call noundef zeroext i1 @_ZN9__gnu_cxxneIP4EdgeSt6vectorIS1_SaIS1_EEEEbRKNS_17__normal_iteratorIT_T0_EESB_(ptr noundef nonnull align 8 dereferenceable(8) %5, ptr noundef nonnull align 8 dereferenceable(8) %6) #3
  br i1 %51, label %.lr.ph19, label %._crit_edge20
}

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

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

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

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

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

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

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

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

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

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

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

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


; Effective O3 passes: EarlyCSEPass,GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,PostOrderFunctionAttrsPass,ReassociatePass,SROAPass,SimplifyCFGPass,TailCallElimPass