; LLVM IR from eyangch/competitive-programming :: Codeforces/1393/c.ll (Z5worksiRA100000_ii)

; 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::multiset" = type { %"class.std::_Rb_tree" }
%"class.std::_Rb_tree" = type { %"struct.std::_Rb_tree<int, int, std::_Identity<int>, std::less<int>>::_Rb_tree_impl" }
%"struct.std::_Rb_tree<int, int, std::_Identity<int>, std::less<int>>::_Rb_tree_impl" = type { [8 x i8], %"struct.std::_Rb_tree_header" }
%"struct.std::_Rb_tree_header" = type { %"struct.std::_Rb_tree_node_base", i64 }
%"struct.std::_Rb_tree_node_base" = type { i32, ptr, ptr, ptr }
%"struct.std::_Rb_tree_const_iterator" = type { ptr }

; Function Attrs: mustprogress uwtable
define dso_local noundef zeroext i1 @_Z5worksiRA100000_ii(i32 noundef %0, ptr noundef nonnull align 4 dereferenceable(400000) %1, i32 noundef %2) #0 personality ptr @__gxx_personality_v0 {
  %4 = alloca i1, align 1
  %5 = alloca i32, align 4
  %6 = alloca ptr, align 8
  %7 = alloca i32, align 4
  %8 = alloca %"class.std::multiset", align 8
  %9 = alloca ptr, align 8
  %10 = alloca i64, align 8
  %11 = alloca i32, align 4
  %12 = alloca ptr, align 8
  %13 = alloca i32, align 4
  %14 = alloca i32, align 4
  %15 = alloca i32, align 4
  %16 = alloca %"struct.std::_Rb_tree_const_iterator", align 8
  %17 = alloca i64, align 8
  %18 = alloca i32, align 4
  %19 = alloca i32, align 4
  %20 = alloca %"struct.std::_Rb_tree_const_iterator", align 8
  %21 = alloca %"struct.std::_Rb_tree_const_iterator", align 8
  %22 = alloca %"struct.std::_Rb_tree_const_iterator", align 8
  %23 = alloca %"struct.std::_Rb_tree_const_iterator", align 8
  %24 = alloca i32, align 4
  %25 = alloca %"struct.std::_Rb_tree_const_iterator", align 8
  store i32 %0, ptr %5, align 4, !tbaa !5
  store ptr %1, ptr %6, align 8, !tbaa !9
  store i32 %2, ptr %7, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 48, ptr %8) #6
  call void @_ZNSt8multisetIiSt4lessIiESaIiEEC2Ev(ptr noundef nonnull align 8 dereferenceable(48) %8) #6
  %26 = load i32, ptr %5, align 4, !tbaa !5
  %27 = zext i32 %26 to i64
  %28 = call ptr @llvm.stacksave.p0()
  store ptr %28, ptr %9, align 8
  %29 = alloca i32, i64 %27, align 16
  store i64 %27, ptr %10, align 8
  %30 = load i32, ptr %5, align 4, !tbaa !5
  %31 = sext i32 %30 to i64
  %32 = getelementptr inbounds i32, ptr %29, i64 %31
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #6
  store i32 0, ptr %11, align 4, !tbaa !5
  invoke void @_ZSt4fillIPiiEvT_S1_RKT0_(ptr noundef %29, ptr noundef %32, ptr noundef nonnull align 4 dereferenceable(4) %11)
          to label %33 unwind label %39

33:                                               ; preds = %3
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #6
  store i32 0, ptr %14, align 4, !tbaa !5
  br label %34

34:                                               ; preds = %54, %33
  %35 = load i32, ptr %14, align 4, !tbaa !5
  %36 = load i32, ptr %5, align 4, !tbaa !5
  %37 = icmp slt i32 %35, %36
  br i1 %37, label %43, label %38

38:                                               ; preds = %34
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #6
  br label %57

39:                                               ; preds = %3
  %40 = landingpad { ptr, i32 }
          cleanup
  %41 = extractvalue { ptr, i32 } %40, 0
  store ptr %41, ptr %12, align 8
  %42 = extractvalue { ptr, i32 } %40, 1
  store i32 %42, ptr %13, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #6
  br label %155

43:                                               ; preds = %34
  %44 = load ptr, ptr %6, align 8, !tbaa !9
  %45 = load i32, ptr %14, align 4, !tbaa !5
  %46 = sext i32 %45 to i64
  %47 = getelementptr inbounds [100000 x i32], ptr %44, i64 0, i64 %46
  %48 = load i32, ptr %47, align 4, !tbaa !5
  %49 = sub nsw i32 %48, 1
  %50 = sext i32 %49 to i64
  %51 = getelementptr inbounds i32, ptr %29, i64 %50
  %52 = load i32, ptr %51, align 4, !tbaa !5
  %53 = add nsw i32 %52, 1
  store i32 %53, ptr %51, align 4, !tbaa !5
  br label %54

54:                                               ; preds = %43
  %55 = load i32, ptr %14, align 4, !tbaa !5
  %56 = add nsw i32 %55, 1
  store i32 %56, ptr %14, align 4, !tbaa !5
  br label %34, !llvm.loop !11

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

58:                                               ; preds = %81, %57
  %59 = load i32, ptr %15, align 4, !tbaa !5
  %60 = load i32, ptr %5, align 4, !tbaa !5
  %61 = icmp slt i32 %59, %60
  br i1 %61, label %63, label %62

62:                                               ; preds = %58
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #6
  br label %84

63:                                               ; preds = %58
  %64 = load i32, ptr %15, align 4, !tbaa !5
  %65 = sext i32 %64 to i64
  %66 = getelementptr inbounds i32, ptr %29, i64 %65
  %67 = load i32, ptr %66, align 4, !tbaa !5
  %68 = icmp ne i32 %67, 0
  br i1 %68, label %69, label %80

69:                                               ; preds = %63
  %70 = load i32, ptr %15, align 4, !tbaa !5
  %71 = sext i32 %70 to i64
  %72 = getelementptr inbounds i32, ptr %29, i64 %71
  %73 = invoke ptr @_ZNSt8multisetIiSt4lessIiESaIiEE6insertERKi(ptr noundef nonnull align 8 dereferenceable(48) %8, ptr noundef nonnull align 4 dereferenceable(4) %72)
          to label %74 unwind label %76

74:                                               ; preds = %69
  %75 = getelementptr inbounds %"struct.std::_Rb_tree_const_iterator", ptr %16, i32 0, i32 0
  store ptr %73, ptr %75, align 8
  br label %80

76:                                               ; preds = %69
  %77 = landingpad { ptr, i32 }
          cleanup
  %78 = extractvalue { ptr, i32 } %77, 0
  store ptr %78, ptr %12, align 8
  %79 = extractvalue { ptr, i32 } %77, 1
  store i32 %79, ptr %13, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #6
  br label %155

80:                                               ; preds = %74, %63
  br label %81

81:                                               ; preds = %80
  %82 = load i32, ptr %15, align 4, !tbaa !5
  %83 = add nsw i32 %82, 1
  store i32 %83, ptr %15, align 4, !tbaa !5
  br label %58, !llvm.loop !13

84:                                               ; preds = %62
  %85 = load i32, ptr %5, align 4, !tbaa !5
  %86 = zext i32 %85 to i64
  %87 = alloca i32, i64 %86, align 16
  store i64 %86, ptr %17, align 8
  call void @llvm.lifetime.start.p0(i64 4, ptr %18) #6
  store i32 0, ptr %18, align 4, !tbaa !5
  br label %88

88:                                               ; preds = %145, %84
  %89 = load i32, ptr %18, align 4, !tbaa !5
  %90 = load i32, ptr %5, align 4, !tbaa !5
  %91 = icmp slt i32 %89, %90
  br i1 %91, label %93, label %92

92:                                               ; preds = %88
  store i32 8, ptr %19, align 4
  br label %149

93:                                               ; preds = %88
  %94 = call noundef i64 @_ZNKSt8multisetIiSt4lessIiESaIiEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(48) %8) #6
  %95 = trunc i64 %94 to i32
  %96 = icmp eq i32 %95, 0
  br i1 %96, label %97, label %98

97:                                               ; preds = %93
  store i1 false, ptr %4, align 1
  store i32 1, ptr %19, align 4
  br label %149

98:                                               ; preds = %93
  call void @llvm.lifetime.start.p0(i64 8, ptr %20) #6
  %99 = call ptr @_ZNKSt8multisetIiSt4lessIiESaIiEE3endEv(ptr noundef nonnull align 8 dereferenceable(48) %8) #6
  %100 = getelementptr inbounds %"struct.std::_Rb_tree_const_iterator", ptr %20, i32 0, i32 0
  store ptr %99, ptr %100, align 8
  %101 = call ptr @_ZNSt23_Rb_tree_const_iteratorIiEmmEi(ptr noundef nonnull align 8 dereferenceable(8) %20, i32 noundef 0) #6
  %102 = getelementptr inbounds %"struct.std::_Rb_tree_const_iterator", ptr %21, i32 0, i32 0
  store ptr %101, ptr %102, align 8
  %103 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNKSt23_Rb_tree_const_iteratorIiEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %20) #6
  %104 = load i32, ptr %103, align 4, !tbaa !5
  %105 = load i32, ptr %18, align 4, !tbaa !5
  %106 = sext i32 %105 to i64
  %107 = getelementptr inbounds i32, ptr %87, i64 %106
  store i32 %104, ptr %107, align 4, !tbaa !5
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %22, ptr align 8 %20, i64 8, i1 false), !tbaa.struct !14
  %108 = getelementptr inbounds %"struct.std::_Rb_tree_const_iterator", ptr %22, i32 0, i32 0
  %109 = load ptr, ptr %108, align 8
  %110 = invoke ptr @_ZNSt8multisetIiSt4lessIiESaIiEE5eraseB5cxx11ESt23_Rb_tree_const_iteratorIiE(ptr noundef nonnull align 8 dereferenceable(48) %8, ptr %109)
          to label %111 unwind label %136

111:                                              ; preds = %98
  %112 = getelementptr inbounds %"struct.std::_Rb_tree_const_iterator", ptr %23, i32 0, i32 0
  store ptr %110, ptr %112, align 8
  %113 = load i32, ptr %18, align 4, !tbaa !5
  %114 = load i32, ptr %7, align 4, !tbaa !5
  %115 = icmp sge i32 %113, %114
  br i1 %115, label %116, label %144

116:                                              ; preds = %111
  %117 = load i32, ptr %18, align 4, !tbaa !5
  %118 = load i32, ptr %7, align 4, !tbaa !5
  %119 = sub nsw i32 %117, %118
  %120 = sext i32 %119 to i64
  %121 = getelementptr inbounds i32, ptr %87, i64 %120
  %122 = load i32, ptr %121, align 4, !tbaa !5
  %123 = sub nsw i32 %122, 1
  %124 = icmp sgt i32 %123, 0
  br i1 %124, label %125, label %144

125:                                              ; preds = %116
  call void @llvm.lifetime.start.p0(i64 4, ptr %24) #6
  %126 = load i32, ptr %18, align 4, !tbaa !5
  %127 = load i32, ptr %7, align 4, !tbaa !5
  %128 = sub nsw i32 %126, %127
  %129 = sext i32 %128 to i64
  %130 = getelementptr inbounds i32, ptr %87, i64 %129
  %131 = load i32, ptr %130, align 4, !tbaa !5
  %132 = sub nsw i32 %131, 1
  store i32 %132, ptr %24, align 4, !tbaa !5
  %133 = invoke ptr @_ZNSt8multisetIiSt4lessIiESaIiEE6insertEOi(ptr noundef nonnull align 8 dereferenceable(48) %8, ptr noundef nonnull align 4 dereferenceable(4) %24)
          to label %134 unwind label %140

134:                                              ; preds = %125
  %135 = getelementptr inbounds %"struct.std::_Rb_tree_const_iterator", ptr %25, i32 0, i32 0
  store ptr %133, ptr %135, align 8
  call void @llvm.lifetime.end.p0(i64 4, ptr %24) #6
  br label %144

136:                                              ; preds = %98
  %137 = landingpad { ptr, i32 }
          cleanup
  %138 = extractvalue { ptr, i32 } %137, 0
  store ptr %138, ptr %12, align 8
  %139 = extractvalue { ptr, i32 } %137, 1
  store i32 %139, ptr %13, align 4
  br label %148

140:                                              ; preds = %125
  %141 = landingpad { ptr, i32 }
          cleanup
  %142 = extractvalue { ptr, i32 } %141, 0
  store ptr %142, ptr %12, align 8
  %143 = extractvalue { ptr, i32 } %141, 1
  store i32 %143, ptr %13, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %24) #6
  br label %148

144:                                              ; preds = %134, %116, %111
  call void @llvm.lifetime.end.p0(i64 8, ptr %20) #6
  br label %145

145:                                              ; preds = %144
  %146 = load i32, ptr %18, align 4, !tbaa !5
  %147 = add nsw i32 %146, 1
  store i32 %147, ptr %18, align 4, !tbaa !5
  br label %88, !llvm.loop !15

148:                                              ; preds = %140, %136
  call void @llvm.lifetime.end.p0(i64 8, ptr %20) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %18) #6
  br label %155

149:                                              ; preds = %97, %92
  call void @llvm.lifetime.end.p0(i64 4, ptr %18) #6
  %150 = load i32, ptr %19, align 4
  switch i32 %150, label %152 [
    i32 8, label %151
  ]

151:                                              ; preds = %149
  store i1 true, ptr %4, align 1
  store i32 1, ptr %19, align 4
  br label %152

152:                                              ; preds = %151, %149
  %153 = load ptr, ptr %9, align 8
  call void @llvm.stackrestore.p0(ptr %153)
  call void @_ZNSt8multisetIiSt4lessIiESaIiEED2Ev(ptr noundef nonnull align 8 dereferenceable(48) %8) #6
  call void @llvm.lifetime.end.p0(i64 48, ptr %8) #6
  %154 = load i1, ptr %4, align 1
  ret i1 %154

155:                                              ; preds = %148, %76, %39
  call void @_ZNSt8multisetIiSt4lessIiESaIiEED2Ev(ptr noundef nonnull align 8 dereferenceable(48) %8) #6
  call void @llvm.lifetime.end.p0(i64 48, ptr %8) #6
  br label %156

156:                                              ; preds = %155
  %157 = load ptr, ptr %12, align 8
  %158 = load i32, ptr %13, align 4
  %159 = insertvalue { ptr, i32 } poison, ptr %157, 0
  %160 = insertvalue { ptr, i32 } %159, i32 %158, 1
  resume { ptr, i32 } %160
}

; 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 void @_ZNSt8multisetIiSt4lessIiESaIiEEC2Ev(ptr noundef nonnull align 8 dereferenceable(48)) unnamed_addr #2 align 2

; Function Attrs: nocallback nofree nosync nounwind willreturn
declare ptr @llvm.stacksave.p0() #3

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

declare i32 @__gxx_personality_v0(...)

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

; Function Attrs: mustprogress uwtable
declare dso_local ptr @_ZNSt8multisetIiSt4lessIiESaIiEE6insertERKi(ptr noundef nonnull align 8 dereferenceable(48), ptr noundef nonnull align 4 dereferenceable(4)) #0 align 2

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

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

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

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

; Function Attrs: mustprogress uwtable
declare dso_local ptr @_ZNSt8multisetIiSt4lessIiESaIiEE5eraseB5cxx11ESt23_Rb_tree_const_iteratorIiE(ptr noundef nonnull align 8 dereferenceable(48), ptr) #0 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) #5

; Function Attrs: mustprogress uwtable
declare dso_local ptr @_ZNSt8multisetIiSt4lessIiESaIiEE6insertEOi(ptr noundef nonnull align 8 dereferenceable(48), ptr noundef nonnull align 4 dereferenceable(4)) #0 align 2

; Function Attrs: nocallback nofree nosync nounwind willreturn
declare void @llvm.stackrestore.p0(ptr) #3

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt8multisetIiSt4lessIiESaIiEED2Ev(ptr noundef nonnull align 8 dereferenceable(48)) unnamed_addr #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 = { nocallback nofree nosync nounwind willreturn }
attributes #4 = { inlinehint 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 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #6 = { 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 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = distinct !{!13, !12}
!14 = !{i64 0, i64 8, !9}
!15 = distinct !{!15, !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"

%"class.std::multiset" = type { %"class.std::_Rb_tree" }
%"class.std::_Rb_tree" = type { %"struct.std::_Rb_tree<int, int, std::_Identity<int>, std::less<int>>::_Rb_tree_impl" }
%"struct.std::_Rb_tree<int, int, std::_Identity<int>, std::less<int>>::_Rb_tree_impl" = type { [8 x i8], %"struct.std::_Rb_tree_header" }
%"struct.std::_Rb_tree_header" = type { %"struct.std::_Rb_tree_node_base", i64 }
%"struct.std::_Rb_tree_node_base" = type { i32, ptr, ptr, ptr }
%"struct.std::_Rb_tree_const_iterator" = type { ptr }

; Function Attrs: mustprogress uwtable
define dso_local noundef zeroext i1 @_Z5worksiRA100000_ii(i32 noundef %0, ptr nocapture noundef nonnull readonly align 4 dereferenceable(400000) %1, i32 noundef %2) local_unnamed_addr #0 personality ptr @__gxx_personality_v0 {
  %4 = alloca %"class.std::multiset", align 8
  %5 = alloca i32, align 4
  %6 = alloca %"struct.std::_Rb_tree_const_iterator", align 8
  %7 = alloca i32, align 4
  call void @llvm.lifetime.start.p0(i64 48, ptr nonnull %4) #5
  call void @_ZNSt8multisetIiSt4lessIiESaIiEEC2Ev(ptr noundef nonnull align 8 dereferenceable(48) %4) #5
  %8 = zext i32 %0 to i64
  %9 = call ptr @llvm.stacksave.p0()
  %10 = alloca i32, i64 %8, align 16
  %11 = sext i32 %0 to i64
  %12 = getelementptr inbounds i32, ptr %10, i64 %11
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %5) #5
  store i32 0, ptr %5, align 4, !tbaa !5
  invoke void @_ZSt4fillIPiiEvT_S1_RKT0_(ptr noundef nonnull %10, ptr noundef nonnull %12, ptr noundef nonnull align 4 dereferenceable(4) %5)
          to label %13 unwind label %21

13:                                               ; preds = %3
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %5) #5
  %invariant.gep = getelementptr i8, ptr %10, i64 -4
  %14 = icmp sgt i32 %0, 0
  br i1 %14, label %.lr.ph.preheader, label %.critedge

.lr.ph.preheader:                                 ; preds = %13
  %xtraiter = and i64 %8, 3
  %15 = icmp ult i32 %0, 4
  br i1 %15, label %.preheader.unr-lcssa, label %.lr.ph.preheader.new

.lr.ph.preheader.new:                             ; preds = %.lr.ph.preheader
  %unroll_iter = and i64 %8, 2147483644
  br label %.lr.ph

.preheader.unr-lcssa:                             ; preds = %.lr.ph, %.lr.ph.preheader
  %indvars.iv.unr = phi i64 [ 0, %.lr.ph.preheader ], [ %indvars.iv.next.3, %.lr.ph ]
  %lcmp.mod.not = icmp eq i64 %xtraiter, 0
  br i1 %lcmp.mod.not, label %.preheader, label %.lr.ph.epil

.lr.ph.epil:                                      ; preds = %.preheader.unr-lcssa, %.lr.ph.epil
  %indvars.iv.epil = phi i64 [ %indvars.iv.next.epil, %.lr.ph.epil ], [ %indvars.iv.unr, %.preheader.unr-lcssa ]
  %epil.iter = phi i64 [ %epil.iter.next, %.lr.ph.epil ], [ 0, %.preheader.unr-lcssa ]
  %16 = getelementptr inbounds [100000 x i32], ptr %1, i64 0, i64 %indvars.iv.epil
  %17 = load i32, ptr %16, align 4, !tbaa !5
  %18 = sext i32 %17 to i64
  %gep.epil = getelementptr i32, ptr %invariant.gep, i64 %18
  %19 = load i32, ptr %gep.epil, align 4, !tbaa !5
  %20 = add nsw i32 %19, 1
  store i32 %20, ptr %gep.epil, align 4, !tbaa !5
  %indvars.iv.next.epil = add nuw nsw i64 %indvars.iv.epil, 1
  %epil.iter.next = add i64 %epil.iter, 1
  %epil.iter.cmp.not = icmp eq i64 %epil.iter.next, %xtraiter
  br i1 %epil.iter.cmp.not, label %.preheader, label %.lr.ph.epil, !llvm.loop !9

.preheader:                                       ; preds = %.lr.ph.epil, %.preheader.unr-lcssa
  br i1 %14, label %.lr.ph49, label %.critedge

21:                                               ; preds = %3
  %22 = landingpad { ptr, i32 }
          cleanup
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %5) #5
  br label %80

.lr.ph:                                           ; preds = %.lr.ph, %.lr.ph.preheader.new
  %indvars.iv = phi i64 [ 0, %.lr.ph.preheader.new ], [ %indvars.iv.next.3, %.lr.ph ]
  %niter = phi i64 [ 0, %.lr.ph.preheader.new ], [ %niter.next.3, %.lr.ph ]
  %23 = getelementptr inbounds [100000 x i32], ptr %1, i64 0, i64 %indvars.iv
  %24 = load i32, ptr %23, align 4, !tbaa !5
  %25 = sext i32 %24 to i64
  %gep = getelementptr i32, ptr %invariant.gep, i64 %25
  %26 = load i32, ptr %gep, align 4, !tbaa !5
  %27 = add nsw i32 %26, 1
  store i32 %27, ptr %gep, align 4, !tbaa !5
  %indvars.iv.next = or disjoint i64 %indvars.iv, 1
  %28 = getelementptr inbounds [100000 x i32], ptr %1, i64 0, i64 %indvars.iv.next
  %29 = load i32, ptr %28, align 4, !tbaa !5
  %30 = sext i32 %29 to i64
  %gep.1 = getelementptr i32, ptr %invariant.gep, i64 %30
  %31 = load i32, ptr %gep.1, align 4, !tbaa !5
  %32 = add nsw i32 %31, 1
  store i32 %32, ptr %gep.1, align 4, !tbaa !5
  %indvars.iv.next.1 = or disjoint i64 %indvars.iv, 2
  %33 = getelementptr inbounds [100000 x i32], ptr %1, i64 0, i64 %indvars.iv.next.1
  %34 = load i32, ptr %33, align 4, !tbaa !5
  %35 = sext i32 %34 to i64
  %gep.2 = getelementptr i32, ptr %invariant.gep, i64 %35
  %36 = load i32, ptr %gep.2, align 4, !tbaa !5
  %37 = add nsw i32 %36, 1
  store i32 %37, ptr %gep.2, align 4, !tbaa !5
  %indvars.iv.next.2 = or disjoint i64 %indvars.iv, 3
  %38 = getelementptr inbounds [100000 x i32], ptr %1, i64 0, i64 %indvars.iv.next.2
  %39 = load i32, ptr %38, align 4, !tbaa !5
  %40 = sext i32 %39 to i64
  %gep.3 = getelementptr i32, ptr %invariant.gep, i64 %40
  %41 = load i32, ptr %gep.3, align 4, !tbaa !5
  %42 = add nsw i32 %41, 1
  store i32 %42, ptr %gep.3, align 4, !tbaa !5
  %indvars.iv.next.3 = add nuw nsw i64 %indvars.iv, 4
  %niter.next.3 = add i64 %niter, 4
  %niter.ncmp.3 = icmp eq i64 %niter.next.3, %unroll_iter
  br i1 %niter.ncmp.3, label %.preheader.unr-lcssa, label %.lr.ph, !llvm.loop !11

._crit_edge:                                      ; preds = %54
  %43 = alloca i32, i64 %8, align 16
  %44 = sext i32 %2 to i64
  %45 = call noundef i64 @_ZNKSt8multisetIiSt4lessIiESaIiEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(48) %4) #5
  %46 = and i64 %45, 4294967295
  %47 = icmp eq i64 %46, 0
  br i1 %47, label %.critedge, label %.lr.ph69

.lr.ph49:                                         ; preds = %.preheader, %54
  %indvars.iv58 = phi i64 [ %indvars.iv.next59, %54 ], [ 0, %.preheader ]
  %48 = getelementptr inbounds i32, ptr %10, i64 %indvars.iv58
  %49 = load i32, ptr %48, align 4, !tbaa !5
  %.not42 = icmp eq i32 %49, 0
  br i1 %.not42, label %54, label %50

50:                                               ; preds = %.lr.ph49
  %51 = invoke ptr @_ZNSt8multisetIiSt4lessIiESaIiEE6insertERKi(ptr noundef nonnull align 8 dereferenceable(48) %4, ptr noundef nonnull align 4 dereferenceable(4) %48)
          to label %54 unwind label %52

52:                                               ; preds = %50
  %53 = landingpad { ptr, i32 }
          cleanup
  br label %80

54:                                               ; preds = %50, %.lr.ph49
  %indvars.iv.next59 = add nuw nsw i64 %indvars.iv58, 1
  %exitcond62.not = icmp eq i64 %indvars.iv.next59, %8
  br i1 %exitcond62.not, label %._crit_edge, label %.lr.ph49, !llvm.loop !13

.lr.ph54:                                         ; preds = %78
  %55 = call noundef i64 @_ZNKSt8multisetIiSt4lessIiESaIiEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(48) %4) #5
  %56 = and i64 %55, 4294967295
  %57 = icmp eq i64 %56, 0
  br i1 %57, label %.critedge.loopexit, label %.lr.ph69, !llvm.loop !14

.lr.ph69:                                         ; preds = %._crit_edge, %.lr.ph54
  %indvars.iv6368 = phi i64 [ %indvars.iv.next64, %.lr.ph54 ], [ 0, %._crit_edge ]
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %6) #5
  %58 = call ptr @_ZNKSt8multisetIiSt4lessIiESaIiEE3endEv(ptr noundef nonnull align 8 dereferenceable(48) %4) #5
  store ptr %58, ptr %6, align 8
  %59 = call ptr @_ZNSt23_Rb_tree_const_iteratorIiEmmEi(ptr noundef nonnull align 8 dereferenceable(8) %6, i32 noundef 0) #5
  %60 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNKSt23_Rb_tree_const_iteratorIiEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %6) #5
  %61 = load i32, ptr %60, align 4, !tbaa !5
  %62 = getelementptr inbounds i32, ptr %43, i64 %indvars.iv6368
  store i32 %61, ptr %62, align 4, !tbaa !5
  %.sroa.02.0.copyload = load ptr, ptr %6, align 8, !tbaa !15
  %63 = invoke ptr @_ZNSt8multisetIiSt4lessIiESaIiEE5eraseB5cxx11ESt23_Rb_tree_const_iteratorIiE(ptr noundef nonnull align 8 dereferenceable(48) %4, ptr %.sroa.02.0.copyload)
          to label %64 unwind label %74

64:                                               ; preds = %.lr.ph69
  %.not = icmp slt i64 %indvars.iv6368, %44
  br i1 %.not, label %78, label %65

65:                                               ; preds = %64
  %66 = sub nsw i64 %indvars.iv6368, %44
  %67 = getelementptr inbounds i32, ptr %43, i64 %66
  %68 = load i32, ptr %67, align 4, !tbaa !5
  %69 = icmp sgt i32 %68, 1
  br i1 %69, label %70, label %78

70:                                               ; preds = %65
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %7) #5
  %71 = add nsw i32 %68, -1
  store i32 %71, ptr %7, align 4, !tbaa !5
  %72 = invoke ptr @_ZNSt8multisetIiSt4lessIiESaIiEE6insertEOi(ptr noundef nonnull align 8 dereferenceable(48) %4, ptr noundef nonnull align 4 dereferenceable(4) %7)
          to label %73 unwind label %76

73:                                               ; preds = %70
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %7) #5
  br label %78

74:                                               ; preds = %.lr.ph69
  %75 = landingpad { ptr, i32 }
          cleanup
  br label %79

76:                                               ; preds = %70
  %77 = landingpad { ptr, i32 }
          cleanup
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %7) #5
  br label %79

78:                                               ; preds = %73, %65, %64
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %6) #5
  %indvars.iv.next64 = add nuw nsw i64 %indvars.iv6368, 1
  %exitcond66 = icmp eq i64 %indvars.iv.next64, %8
  br i1 %exitcond66, label %.critedge.loopexit, label %.lr.ph54, !llvm.loop !14

79:                                               ; preds = %76, %74
  %.pn = phi { ptr, i32 } [ %77, %76 ], [ %75, %74 ]
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %6) #5
  br label %80

.critedge.loopexit:                               ; preds = %.lr.ph54, %78
  %.not41.le = icmp sge i64 %indvars.iv.next64, %11
  br label %.critedge

.critedge:                                        ; preds = %.critedge.loopexit, %._crit_edge, %13, %.preheader
  %.not41.lcssa = phi i1 [ true, %.preheader ], [ true, %13 ], [ false, %._crit_edge ], [ %.not41.le, %.critedge.loopexit ]
  call void @llvm.stackrestore.p0(ptr %9)
  call void @_ZNSt8multisetIiSt4lessIiESaIiEED2Ev(ptr noundef nonnull align 8 dereferenceable(48) %4) #5
  call void @llvm.lifetime.end.p0(i64 48, ptr nonnull %4) #5
  ret i1 %.not41.lcssa

80:                                               ; preds = %79, %52, %21
  %.pn43 = phi { ptr, i32 } [ %53, %52 ], [ %.pn, %79 ], [ %22, %21 ]
  call void @_ZNSt8multisetIiSt4lessIiESaIiEED2Ev(ptr noundef nonnull align 8 dereferenceable(48) %4) #5
  call void @llvm.lifetime.end.p0(i64 48, ptr nonnull %4) #5
  resume { ptr, i32 } %.pn43
}

; 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 void @_ZNSt8multisetIiSt4lessIiESaIiEEC2Ev(ptr noundef nonnull align 8 dereferenceable(48)) unnamed_addr #2 align 2

; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare ptr @llvm.stacksave.p0() #3

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

declare i32 @__gxx_personality_v0(...)

; 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 uwtable
declare dso_local ptr @_ZNSt8multisetIiSt4lessIiESaIiEE6insertERKi(ptr noundef nonnull align 8 dereferenceable(48), ptr noundef nonnull align 4 dereferenceable(4)) local_unnamed_addr #0 align 2

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

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

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

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

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

; Function Attrs: mustprogress uwtable
declare dso_local ptr @_ZNSt8multisetIiSt4lessIiESaIiEE6insertEOi(ptr noundef nonnull align 8 dereferenceable(48), ptr noundef nonnull align 4 dereferenceable(4)) local_unnamed_addr #0 align 2

; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare void @llvm.stackrestore.p0(ptr) #3

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt8multisetIiSt4lessIiESaIiEED2Ev(ptr noundef nonnull align 8 dereferenceable(48)) unnamed_addr #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 = { mustprogress 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 = { mustprogress nocallback nofree nosync nounwind willreturn }
attributes #4 = { inlinehint 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 = distinct !{!9, !10}
!10 = !{!"llvm.loop.unroll.disable"}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = distinct !{!13, !12}
!14 = distinct !{!14, !12}
!15 = !{!16, !16, i64 0}
!16 = !{!"any pointer", !7, i64 0}


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