; LLVM IR from bqi343/cp-notebook :: Contests/USACO Solutions/2018-19/Open 2019/Gold (walk (13:15))

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

%struct.DSU = type { %"class.std::vector.3" }
%"class.std::vector.3" = 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::__cxx11::basic_string" = type { %"struct.std::__cxx11::basic_string<char>::_Alloc_hider", i64, %union.anon }
%"struct.std::__cxx11::basic_string<char>::_Alloc_hider" = type { ptr }
%union.anon = type { i64, [8 x i8] }
%"class.std::allocator" = type { i8 }
%class.anon = type { i8 }
%class.anon.7 = type { i8 }
%"struct.std::pair" = type { i32, i32 }

@N = external dso_local global i32, align 4
@K = external dso_local global i32, align 4
@ed = external dso_local global [28121250 x i32], align 16
@res = external dso_local global [28121250 x i32], align 16
@D = external dso_local global %struct.DSU, align 8
@.str.11 = external hidden unnamed_addr constant [5 x i8], align 1

; 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

declare i32 @__gxx_personality_v0(...)

; Function Attrs: mustprogress nounwind uwtable
declare void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32)) unnamed_addr #1 align 2

; Function Attrs: mustprogress nounwind uwtable
declare void @_ZNSaIcEC2Ev(ptr noundef nonnull align 1 dereferenceable(1)) unnamed_addr #1 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEPKcRKS3_(ptr noundef nonnull align 8 dereferenceable(32), ptr noundef, ptr noundef nonnull align 1 dereferenceable(1)) unnamed_addr #2 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z5setIONSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE(ptr noundef) #2

; Function Attrs: mustprogress uwtable
declare dso_local i64 @_Z4rhshi(i32 noundef) #2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i32 @_Z3weii(i32 noundef) #1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i32 @_Z3hshii(i32 noundef, i32 noundef) #1

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() #3 personality ptr @__gxx_personality_v0 {
  %1 = alloca i32, align 4
  %2 = alloca %"class.std::__cxx11::basic_string", align 8
  %3 = alloca %"class.std::allocator", align 1
  %4 = alloca ptr, align 8
  %5 = alloca i32, align 4
  %6 = alloca i64, align 8
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  %11 = alloca %class.anon, align 1
  %12 = alloca %class.anon.7, align 1
  %13 = alloca %"class.std::vector.3", align 8
  %14 = alloca i32, align 4
  %15 = alloca i32, align 4
  %16 = alloca %"struct.std::pair", align 4
  %17 = alloca i32, align 4
  store i32 0, ptr %1, align 4
  call void @llvm.lifetime.start.p0(i64 1, ptr %3) #5
  call void @_ZNSaIcEC2Ev(ptr noundef nonnull align 1 dereferenceable(1) %3) #5
  invoke void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEPKcRKS3_(ptr noundef nonnull align 8 dereferenceable(32) %2, ptr noundef @.str.11, ptr noundef nonnull align 1 dereferenceable(1) %3)
          to label %18 unwind label %29

18:                                               ; preds = %0
  invoke void @_Z5setIONSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE(ptr noundef %2)
          to label %19 unwind label %33

19:                                               ; preds = %18
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %2) #5
  call void @_ZNSt15__new_allocatorIcED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %3) #5
  call void @llvm.lifetime.end.p0(i64 1, ptr %3) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #5
  %20 = call i64 @clock() #5
  store i64 %20, ptr %6, align 8, !tbaa !5
  call void @_Z2reIiJiEEvRT_DpRT0_(ptr noundef nonnull align 4 dereferenceable(4) @N, ptr noundef nonnull align 4 dereferenceable(4) @K)
  %21 = load i32, ptr @N, align 4, !tbaa !9
  %22 = add nsw i32 %21, 1
  call void @_ZN3DSU4initEi(ptr noundef nonnull align 8 dereferenceable(24) @D, i32 noundef %22)
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #5
  store i32 0, ptr %7, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #5
  store i32 1, ptr %8, align 4, !tbaa !9
  br label %23

23:                                               ; preds = %59, %19
  %24 = load i32, ptr %8, align 4, !tbaa !9
  %25 = load i32, ptr @N, align 4, !tbaa !9
  %26 = add nsw i32 %25, 1
  %27 = icmp slt i32 %24, %26
  br i1 %27, label %38, label %28

28:                                               ; preds = %23
  store i32 2, ptr %9, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #5
  br label %62

29:                                               ; preds = %0
  %30 = landingpad { ptr, i32 }
          cleanup
  %31 = extractvalue { ptr, i32 } %30, 0
  store ptr %31, ptr %4, align 8
  %32 = extractvalue { ptr, i32 } %30, 1
  store i32 %32, ptr %5, align 4
  br label %37

33:                                               ; preds = %18
  %34 = landingpad { ptr, i32 }
          cleanup
  %35 = extractvalue { ptr, i32 } %34, 0
  store ptr %35, ptr %4, align 8
  %36 = extractvalue { ptr, i32 } %34, 1
  store i32 %36, ptr %5, align 4
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %2) #5
  br label %37

37:                                               ; preds = %33, %29
  call void @_ZNSt15__new_allocatorIcED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %3) #5
  call void @llvm.lifetime.end.p0(i64 1, ptr %3) #5
  br label %117

38:                                               ; preds = %23
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #5
  %39 = load i32, ptr %8, align 4, !tbaa !9
  %40 = add nsw i32 %39, 1
  store i32 %40, ptr %10, align 4, !tbaa !9
  br label %41

41:                                               ; preds = %55, %38
  %42 = load i32, ptr %10, align 4, !tbaa !9
  %43 = load i32, ptr @N, align 4, !tbaa !9
  %44 = add nsw i32 %43, 1
  %45 = icmp slt i32 %42, %44
  br i1 %45, label %47, label %46

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

47:                                               ; preds = %41
  %48 = load i32, ptr %8, align 4, !tbaa !9
  %49 = load i32, ptr %10, align 4, !tbaa !9
  %50 = call noundef i32 @_Z3hshii(i32 noundef %48, i32 noundef %49)
  %51 = load i32, ptr %7, align 4, !tbaa !9
  %52 = add nsw i32 %51, 1
  store i32 %52, ptr %7, align 4, !tbaa !9
  %53 = sext i32 %51 to i64
  %54 = getelementptr inbounds [28121250 x i32], ptr @ed, i64 0, i64 %53
  store i32 %50, ptr %54, align 4, !tbaa !9
  br label %55

55:                                               ; preds = %47
  %56 = load i32, ptr %10, align 4, !tbaa !9
  %57 = add nsw i32 %56, 1
  store i32 %57, ptr %10, align 4, !tbaa !9
  br label %41, !llvm.loop !11

58:                                               ; preds = %46
  br label %59

59:                                               ; preds = %58
  %60 = load i32, ptr %8, align 4, !tbaa !9
  %61 = add nsw i32 %60, 1
  store i32 %61, ptr %8, align 4, !tbaa !9
  br label %23, !llvm.loop !13

62:                                               ; preds = %28
  call void @llvm.lifetime.start.p0(i64 1, ptr %11) #5
  call void @"_Z6bucketIZ4mainE3$_0EvPiS1_RKT_"(ptr noundef @ed, ptr noundef @res, ptr noundef nonnull align 1 dereferenceable(1) %11)
  call void @llvm.lifetime.end.p0(i64 1, ptr %11) #5
  call void @llvm.lifetime.start.p0(i64 1, ptr %12) #5
  call void @"_Z6bucketIZ4mainE3$_1EvPiS1_RKT_"(ptr noundef @res, ptr noundef @ed, ptr noundef nonnull align 1 dereferenceable(1) %12)
  call void @llvm.lifetime.end.p0(i64 1, ptr %12) #5
  call void @llvm.lifetime.start.p0(i64 24, ptr %13) #5
  call void @_ZNSt6vectorIiSaIiEEC2Ev(ptr noundef nonnull align 8 dereferenceable(24) %13) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #5
  store i32 0, ptr %14, align 4, !tbaa !9
  br label %63

63:                                               ; preds = %100, %62
  %64 = load i32, ptr %14, align 4, !tbaa !9
  %65 = load i32, ptr @N, align 4, !tbaa !9
  %66 = load i32, ptr @N, align 4, !tbaa !9
  %67 = sub nsw i32 %66, 1
  %68 = mul nsw i32 %65, %67
  %69 = sdiv i32 %68, 2
  %70 = icmp slt i32 %64, %69
  br i1 %70, label %72, label %71

71:                                               ; preds = %63
  store i32 8, ptr %9, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #5
  br label %104

72:                                               ; preds = %63
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #5
  %73 = load i32, ptr %14, align 4, !tbaa !9
  %74 = sext i32 %73 to i64
  %75 = getelementptr inbounds [28121250 x i32], ptr @ed, i64 0, i64 %74
  %76 = load i32, ptr %75, align 4, !tbaa !9
  store i32 %76, ptr %15, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #5
  %77 = load i32, ptr %15, align 4, !tbaa !9
  %78 = invoke i64 @_Z4rhshi(i32 noundef %77)
          to label %79 unwind label %91

79:                                               ; preds = %72
  store i64 %78, ptr %16, align 4
  %80 = getelementptr inbounds %"struct.std::pair", ptr %16, i32 0, i32 0
  %81 = load i32, ptr %80, align 4, !tbaa !14
  %82 = getelementptr inbounds %"struct.std::pair", ptr %16, i32 0, i32 1
  %83 = load i32, ptr %82, align 4, !tbaa !16
  %84 = invoke noundef zeroext i1 @_ZN3DSU5uniteEii(ptr noundef nonnull align 8 dereferenceable(24) @D, i32 noundef %81, i32 noundef %83)
          to label %85 unwind label %91

85:                                               ; preds = %79
  br i1 %84, label %86, label %99

86:                                               ; preds = %85
  call void @llvm.lifetime.start.p0(i64 4, ptr %17) #5
  %87 = load i32, ptr %15, align 4, !tbaa !9
  %88 = call noundef i32 @_Z3weii(i32 noundef %87)
  %89 = sub nsw i32 2019201997, %88
  store i32 %89, ptr %17, align 4, !tbaa !9
  invoke void @_ZNSt6vectorIiSaIiEE9push_backEOi(ptr noundef nonnull align 8 dereferenceable(24) %13, ptr noundef nonnull align 4 dereferenceable(4) %17)
          to label %90 unwind label %95

90:                                               ; preds = %86
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #5
  br label %99

91:                                               ; preds = %79, %72
  %92 = landingpad { ptr, i32 }
          cleanup
  %93 = extractvalue { ptr, i32 } %92, 0
  store ptr %93, ptr %4, align 8
  %94 = extractvalue { ptr, i32 } %92, 1
  store i32 %94, ptr %5, align 4
  br label %103

95:                                               ; preds = %86
  %96 = landingpad { ptr, i32 }
          cleanup
  %97 = extractvalue { ptr, i32 } %96, 0
  store ptr %97, ptr %4, align 8
  %98 = extractvalue { ptr, i32 } %96, 1
  store i32 %98, ptr %5, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #5
  br label %103

99:                                               ; preds = %90, %85
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #5
  br label %100

100:                                              ; preds = %99
  %101 = load i32, ptr %14, align 4, !tbaa !9
  %102 = add nsw i32 %101, 1
  store i32 %102, ptr %14, align 4, !tbaa !9
  br label %63, !llvm.loop !17

103:                                              ; preds = %95, %91
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #5
  br label %116

104:                                              ; preds = %71
  %105 = load i32, ptr @N, align 4, !tbaa !9
  %106 = load i32, ptr @K, align 4, !tbaa !9
  %107 = sub nsw i32 %105, %106
  %108 = sext i32 %107 to i64
  %109 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt6vectorIiSaIiEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %13, i64 noundef %108) #5
  invoke void @_Z2psIiJEEvRKT_DpRKT0_(ptr noundef nonnull align 4 dereferenceable(4) %109)
          to label %110 unwind label %112

110:                                              ; preds = %104
  call void @_ZNSt6vectorIiSaIiEED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %13) #5
  call void @llvm.lifetime.end.p0(i64 24, ptr %13) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #5
  %111 = load i32, ptr %1, align 4
  ret i32 %111

112:                                              ; preds = %104
  %113 = landingpad { ptr, i32 }
          cleanup
  %114 = extractvalue { ptr, i32 } %113, 0
  store ptr %114, ptr %4, align 8
  %115 = extractvalue { ptr, i32 } %113, 1
  store i32 %115, ptr %5, align 4
  br label %116

116:                                              ; preds = %112, %103
  call void @_ZNSt6vectorIiSaIiEED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %13) #5
  call void @llvm.lifetime.end.p0(i64 24, ptr %13) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #5
  br label %117

117:                                              ; preds = %116, %37
  %118 = load ptr, ptr %4, align 8
  %119 = load i32, ptr %5, align 4
  %120 = insertvalue { ptr, i32 } poison, ptr %118, 0
  %121 = insertvalue { ptr, i32 } %120, i32 %119, 1
  resume { ptr, i32 } %121
}

; Function Attrs: nounwind
declare i64 @clock() #4

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

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

; Function Attrs: mustprogress uwtable
declare hidden void @"_Z6bucketIZ4mainE3$_0EvPiS1_RKT_"(ptr noundef, ptr noundef, ptr noundef nonnull align 1 dereferenceable(1)) #2

; Function Attrs: mustprogress uwtable
declare hidden void @"_Z6bucketIZ4mainE3$_1EvPiS1_RKT_"(ptr noundef, ptr noundef, ptr noundef nonnull align 1 dereferenceable(1)) #2

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

; Function Attrs: mustprogress uwtable
declare dso_local noundef zeroext i1 @_ZN3DSU5uniteEii(ptr noundef nonnull align 8 dereferenceable(24), i32 noundef, i32 noundef) #2 align 2

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

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

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt15__new_allocatorIcED2Ev(ptr noundef nonnull align 1 dereferenceable(1)) unnamed_addr #1 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 = { 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 #3 = { mustprogress norecurse uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nounwind "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 = !{!"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}
!12 = !{!"llvm.loop.mustprogress"}
!13 = distinct !{!13, !12}
!14 = !{!15, !10, i64 0}
!15 = !{!"_ZTSSt4pairIiiE", !10, i64 0, !10, i64 4}
!16 = !{!15, !10, i64 4}
!17 = distinct !{!17, !12}


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

%struct.DSU = type { %"class.std::vector.3" }
%"class.std::vector.3" = 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::__cxx11::basic_string" = type { %"struct.std::__cxx11::basic_string<char>::_Alloc_hider", i64, %union.anon }
%"struct.std::__cxx11::basic_string<char>::_Alloc_hider" = type { ptr }
%union.anon = type { i64, [8 x i8] }
%"class.std::allocator" = type { i8 }
%class.anon = type { i8 }
%class.anon.7 = type { i8 }

@N = external dso_local global i32, align 4
@K = external dso_local global i32, align 4
@ed = external dso_local global [28121250 x i32], align 16
@res = external dso_local global [28121250 x i32], align 16
@D = external dso_local global %struct.DSU, align 8
@.str.11 = external hidden unnamed_addr constant [5 x i8], align 1

; 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

declare i32 @__gxx_personality_v0(...)

; Function Attrs: mustprogress nounwind uwtable
declare void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32)) unnamed_addr #1 align 2

; Function Attrs: mustprogress nounwind uwtable
declare void @_ZNSaIcEC2Ev(ptr noundef nonnull align 1 dereferenceable(1)) unnamed_addr #1 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEPKcRKS3_(ptr noundef nonnull align 8 dereferenceable(32), ptr noundef, ptr noundef nonnull align 1 dereferenceable(1)) unnamed_addr #2 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z5setIONSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE(ptr noundef) local_unnamed_addr #2

; Function Attrs: mustprogress uwtable
declare dso_local i64 @_Z4rhshi(i32 noundef) local_unnamed_addr #2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i32 @_Z3weii(i32 noundef) local_unnamed_addr #1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i32 @_Z3hshii(i32 noundef, i32 noundef) local_unnamed_addr #1

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #3 personality ptr @__gxx_personality_v0 {
  %1 = alloca %"class.std::__cxx11::basic_string", align 8
  %2 = alloca %"class.std::allocator", align 1
  %3 = alloca %class.anon, align 1
  %4 = alloca %class.anon.7, align 1
  %5 = alloca %"class.std::vector.3", align 8
  %6 = alloca i32, align 4
  call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %2) #5
  call void @_ZNSaIcEC2Ev(ptr noundef nonnull align 1 dereferenceable(1) %2) #5
  invoke void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEPKcRKS3_(ptr noundef nonnull align 8 dereferenceable(32) %1, ptr noundef nonnull @.str.11, ptr noundef nonnull align 1 dereferenceable(1) %2)
          to label %7 unwind label %19

7:                                                ; preds = %0
  invoke void @_Z5setIONSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE(ptr noundef nonnull %1)
          to label %8 unwind label %21

8:                                                ; preds = %7
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %1) #5
  call void @_ZNSt15__new_allocatorIcED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %2) #5
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %2) #5
  %9 = call i64 @clock() #5
  call void @_Z2reIiJiEEvRT_DpRT0_(ptr noundef nonnull align 4 dereferenceable(4) @N, ptr noundef nonnull align 4 dereferenceable(4) @K)
  %10 = load i32, ptr @N, align 4, !tbaa !5
  %11 = add nsw i32 %10, 1
  call void @_ZN3DSU4initEi(ptr noundef nonnull align 8 dereferenceable(24) @D, i32 noundef %11)
  %12 = load i32, ptr @N, align 4, !tbaa !5
  %.not35 = icmp slt i32 %12, 1
  br i1 %.not35, label %._crit_edge, label %.lr.ph38

.loopexit.loopexit:                               ; preds = %.lr.ph
  %13 = trunc nsw i64 %indvars.iv.next to i32
  br label %.loopexit

.loopexit:                                        ; preds = %.loopexit.loopexit, %.lr.ph38
  %14 = phi i32 [ %24, %.lr.ph38 ], [ %30, %.loopexit.loopexit ]
  %.120.lcssa = phi i32 [ %.01937, %.lr.ph38 ], [ %13, %.loopexit.loopexit ]
  %.not.not = icmp slt i32 %.02336, %14
  br i1 %.not.not, label %.lr.ph38, label %._crit_edge, !llvm.loop !9

._crit_edge:                                      ; preds = %.loopexit, %8
  call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %3) #5
  call void @"_Z6bucketIZ4mainE3$_0EvPiS1_RKT_"(ptr noundef nonnull @ed, ptr noundef nonnull @res, ptr noundef nonnull align 1 dereferenceable(1) %3)
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %3) #5
  call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %4) #5
  call void @"_Z6bucketIZ4mainE3$_1EvPiS1_RKT_"(ptr noundef nonnull @res, ptr noundef nonnull @ed, ptr noundef nonnull align 1 dereferenceable(1) %4)
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %4) #5
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %5) #5
  call void @_ZNSt6vectorIiSaIiEEC2Ev(ptr noundef nonnull align 8 dereferenceable(24) %5) #5
  %15 = load i32, ptr @N, align 4, !tbaa !5
  %16 = add nsw i32 %15, -1
  %17 = mul nsw i32 %16, %15
  %18 = icmp sgt i32 %17, 1
  br i1 %18, label %.lr.ph41, label %._crit_edge42

19:                                               ; preds = %0
  %20 = landingpad { ptr, i32 }
          cleanup
  br label %23

21:                                               ; preds = %7
  %22 = landingpad { ptr, i32 }
          cleanup
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %1) #5
  br label %23

23:                                               ; preds = %21, %19
  %.pn = phi { ptr, i32 } [ %22, %21 ], [ %20, %19 ]
  call void @_ZNSt15__new_allocatorIcED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %2) #5
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %2) #5
  br label %60

.lr.ph38:                                         ; preds = %8, %.loopexit
  %24 = phi i32 [ %14, %.loopexit ], [ %12, %8 ]
  %.01937 = phi i32 [ %.120.lcssa, %.loopexit ], [ 0, %8 ]
  %.02336 = phi i32 [ %25, %.loopexit ], [ 1, %8 ]
  %25 = add nuw nsw i32 %.02336, 1
  %.not2932.not = icmp slt i32 %.02336, %24
  br i1 %.not2932.not, label %.lr.ph.preheader, label %.loopexit

.lr.ph.preheader:                                 ; preds = %.lr.ph38
  %26 = sext i32 %.01937 to i64
  br label %.lr.ph

.lr.ph:                                           ; preds = %.lr.ph.preheader, %.lr.ph
  %indvars.iv = phi i64 [ %26, %.lr.ph.preheader ], [ %indvars.iv.next, %.lr.ph ]
  %.02233 = phi i32 [ %25, %.lr.ph.preheader ], [ %29, %.lr.ph ]
  %27 = call noundef i32 @_Z3hshii(i32 noundef %.02336, i32 noundef %.02233)
  %indvars.iv.next = add nsw i64 %indvars.iv, 1
  %28 = getelementptr inbounds [28121250 x i32], ptr @ed, i64 0, i64 %indvars.iv
  store i32 %27, ptr %28, align 4, !tbaa !5
  %29 = add nuw nsw i32 %.02233, 1
  %30 = load i32, ptr @N, align 4, !tbaa !5
  %.not29.not = icmp slt i32 %.02233, %30
  br i1 %.not29.not, label %.lr.ph, label %.loopexit.loopexit, !llvm.loop !11

._crit_edge42:                                    ; preds = %49, %._crit_edge
  %.lcssa = phi i32 [ %15, %._crit_edge ], [ %50, %49 ]
  %31 = load i32, ptr @K, align 4, !tbaa !5
  %32 = sub nsw i32 %.lcssa, %31
  %33 = sext i32 %32 to i64
  %34 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt6vectorIiSaIiEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %5, i64 noundef %33) #5
  invoke void @_Z2psIiJEEvRKT_DpRKT0_(ptr noundef nonnull align 4 dereferenceable(4) %34)
          to label %56 unwind label %57

.lr.ph41:                                         ; preds = %._crit_edge, %49
  %indvars.iv47 = phi i64 [ %indvars.iv.next48, %49 ], [ 0, %._crit_edge ]
  %35 = getelementptr inbounds [28121250 x i32], ptr @ed, i64 0, i64 %indvars.iv47
  %36 = load i32, ptr %35, align 4, !tbaa !5
  %37 = invoke i64 @_Z4rhshi(i32 noundef %36)
          to label %38 unwind label %45

38:                                               ; preds = %.lr.ph41
  %.sroa.0.0.extract.trunc = trunc i64 %37 to i32
  %.sroa.5.0.extract.shift = lshr i64 %37, 32
  %.sroa.5.0.extract.trunc = trunc nuw i64 %.sroa.5.0.extract.shift to i32
  %39 = invoke noundef zeroext i1 @_ZN3DSU5uniteEii(ptr noundef nonnull align 8 dereferenceable(24) @D, i32 noundef %.sroa.0.0.extract.trunc, i32 noundef %.sroa.5.0.extract.trunc)
          to label %40 unwind label %45

40:                                               ; preds = %38
  br i1 %39, label %41, label %49

41:                                               ; preds = %40
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %6) #5
  %42 = call noundef i32 @_Z3weii(i32 noundef %36)
  %43 = sub nsw i32 2019201997, %42
  store i32 %43, ptr %6, align 4, !tbaa !5
  invoke void @_ZNSt6vectorIiSaIiEE9push_backEOi(ptr noundef nonnull align 8 dereferenceable(24) %5, ptr noundef nonnull align 4 dereferenceable(4) %6)
          to label %44 unwind label %47

44:                                               ; preds = %41
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %6) #5
  br label %49

45:                                               ; preds = %38, %.lr.ph41
  %46 = landingpad { ptr, i32 }
          cleanup
  br label %59

47:                                               ; preds = %41
  %48 = landingpad { ptr, i32 }
          cleanup
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %6) #5
  br label %59

49:                                               ; preds = %44, %40
  %indvars.iv.next48 = add nuw nsw i64 %indvars.iv47, 1
  %50 = load i32, ptr @N, align 4, !tbaa !5
  %51 = add nsw i32 %50, -1
  %52 = mul nsw i32 %51, %50
  %53 = sdiv i32 %52, 2
  %54 = sext i32 %53 to i64
  %55 = icmp slt i64 %indvars.iv.next48, %54
  br i1 %55, label %.lr.ph41, label %._crit_edge42, !llvm.loop !12

56:                                               ; preds = %._crit_edge42
  call void @_ZNSt6vectorIiSaIiEED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %5) #5
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %5) #5
  ret i32 0

57:                                               ; preds = %._crit_edge42
  %58 = landingpad { ptr, i32 }
          cleanup
  br label %59

59:                                               ; preds = %45, %47, %57
  %.pn25.pn = phi { ptr, i32 } [ %58, %57 ], [ %48, %47 ], [ %46, %45 ]
  call void @_ZNSt6vectorIiSaIiEED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %5) #5
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %5) #5
  br label %60

60:                                               ; preds = %59, %23
  %.pn25.pn.pn = phi { ptr, i32 } [ %.pn25.pn, %59 ], [ %.pn, %23 ]
  resume { ptr, i32 } %.pn25.pn.pn
}

; Function Attrs: nounwind
declare i64 @clock() local_unnamed_addr #4

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

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

; Function Attrs: mustprogress uwtable
declare hidden void @"_Z6bucketIZ4mainE3$_0EvPiS1_RKT_"(ptr noundef, ptr noundef, ptr noundef nonnull align 1 dereferenceable(1)) local_unnamed_addr #2

; Function Attrs: mustprogress uwtable
declare hidden void @"_Z6bucketIZ4mainE3$_1EvPiS1_RKT_"(ptr noundef, ptr noundef, ptr noundef nonnull align 1 dereferenceable(1)) local_unnamed_addr #2

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

; Function Attrs: mustprogress uwtable
declare dso_local noundef zeroext i1 @_ZN3DSU5uniteEii(ptr noundef nonnull align 8 dereferenceable(24), i32 noundef, i32 noundef) local_unnamed_addr #2 align 2

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z2psIiJEEvRKT_DpRKT0_(ptr noundef nonnull align 4 dereferenceable(4)) local_unnamed_addr #2

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt15__new_allocatorIcED2Ev(ptr noundef nonnull align 1 dereferenceable(1)) unnamed_addr #1 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 = { 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 #3 = { mustprogress norecurse uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nounwind "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 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}


; Effective O3 passes: EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,ReassociatePass,SROAPass,SimplifyCFGPass