; LLVM IR from eyangch/competitive-programming :: Codeforces/1702 (f)

; 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::basic_istream" = type { ptr, i64, %"class.std::basic_ios" }
%"class.std::basic_ios" = type { %"class.std::ios_base", ptr, i8, i8, ptr, ptr, ptr, ptr }
%"class.std::ios_base" = type { ptr, i64, i64, i32, i32, i32, ptr, %"struct.std::ios_base::_Words", [8 x %"struct.std::ios_base::_Words"], i32, ptr, %"class.std::locale" }
%"struct.std::ios_base::_Words" = type { ptr, i64 }
%"class.std::locale" = type { ptr }
%"class.std::basic_ostream" = type { ptr, %"class.std::basic_ios" }
%"class.std::multiset" = type { %"class.std::_Rb_tree" }
%"class.std::_Rb_tree" = type { %"struct.std::_Rb_tree<long long, long long, std::_Identity<long long>, std::less<long long>>::_Rb_tree_impl" }
%"struct.std::_Rb_tree<long long, long long, std::_Identity<long long>, std::less<long long>>::_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 }

@T = external dso_local global i64, align 8
@N = external dso_local global i64, align 8
@A = external dso_local global [200000 x i64], align 16
@B = external dso_local global [200000 x i64], align 16
@_ZSt3cin = external global %"class.std::basic_istream", align 8
@_ZSt4cout = external global %"class.std::basic_ostream", align 8
@.str = external hidden unnamed_addr constant [4 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [3 x i8], align 1

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() #0 personality ptr @__gxx_personality_v0 {
  %1 = alloca i32, align 4
  %2 = alloca %"class.std::multiset", align 8
  %3 = alloca i64, align 8
  %4 = alloca ptr, align 8
  %5 = alloca i32, align 4
  %6 = alloca %"struct.std::_Rb_tree_const_iterator", align 8
  %7 = alloca i64, align 8
  %8 = alloca i8, align 1
  %9 = alloca i64, align 8
  %10 = alloca i32, align 4
  %11 = alloca i64, align 8
  %12 = alloca i64, align 8
  %13 = alloca %"struct.std::_Rb_tree_const_iterator", align 8
  %14 = alloca %"struct.std::_Rb_tree_const_iterator", align 8
  store i32 0, ptr %1, align 4
  %15 = load ptr, ptr @_ZSt3cin, align 8, !tbaa !5
  %16 = getelementptr i8, ptr %15, i64 -24
  %17 = load i64, ptr %16, align 8
  %18 = getelementptr inbounds i8, ptr @_ZSt3cin, i64 %17
  %19 = call noundef ptr @_ZNSt9basic_iosIcSt11char_traitsIcEE3tieEPSo(ptr noundef nonnull align 8 dereferenceable(264) %18, ptr noundef null)
  %20 = call noundef zeroext i1 @_ZNSt8ios_base15sync_with_stdioEb(i1 noundef zeroext false)
  %21 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) @T)
  br label %22

22:                                               ; preds = %147, %0
  %23 = load i64, ptr @T, align 8, !tbaa !8
  %24 = add nsw i64 %23, -1
  store i64 %24, ptr @T, align 8, !tbaa !8
  %25 = icmp ne i64 %23, 0
  br i1 %25, label %26, label %150

26:                                               ; preds = %22
  %27 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) @N)
  call void @llvm.lifetime.start.p0(i64 48, ptr %2) #6
  call void @_ZNSt8multisetIxSt4lessIxESaIxEEC2Ev(ptr noundef nonnull align 8 dereferenceable(48) %2) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr %3) #6
  store i64 0, ptr %3, align 8, !tbaa !8
  br label %28

28:                                               ; preds = %59, %26
  %29 = load i64, ptr %3, align 8, !tbaa !8
  %30 = load i64, ptr @N, align 8, !tbaa !8
  %31 = icmp slt i64 %29, %30
  br i1 %31, label %33, label %32

32:                                               ; preds = %28
  call void @llvm.lifetime.end.p0(i64 8, ptr %3) #6
  br label %62

33:                                               ; preds = %28
  %34 = load i64, ptr %3, align 8, !tbaa !8
  %35 = getelementptr inbounds [200000 x i64], ptr @A, i64 0, i64 %34
  %36 = invoke noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) %35)
          to label %37 unwind label %49

37:                                               ; preds = %33
  br label %38

38:                                               ; preds = %44, %37
  %39 = load i64, ptr %3, align 8, !tbaa !8
  %40 = getelementptr inbounds [200000 x i64], ptr @A, i64 0, i64 %39
  %41 = load i64, ptr %40, align 8, !tbaa !8
  %42 = srem i64 %41, 2
  %43 = icmp eq i64 %42, 0
  br i1 %43, label %44, label %53

44:                                               ; preds = %38
  %45 = load i64, ptr %3, align 8, !tbaa !8
  %46 = getelementptr inbounds [200000 x i64], ptr @A, i64 0, i64 %45
  %47 = load i64, ptr %46, align 8, !tbaa !8
  %48 = sdiv i64 %47, 2
  store i64 %48, ptr %46, align 8, !tbaa !8
  br label %38, !llvm.loop !11

49:                                               ; preds = %53, %33
  %50 = landingpad { ptr, i32 }
          cleanup
  %51 = extractvalue { ptr, i32 } %50, 0
  store ptr %51, ptr %4, align 8
  %52 = extractvalue { ptr, i32 } %50, 1
  store i32 %52, ptr %5, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %3) #6
  br label %149

53:                                               ; preds = %38
  %54 = load i64, ptr %3, align 8, !tbaa !8
  %55 = getelementptr inbounds [200000 x i64], ptr @A, i64 0, i64 %54
  %56 = invoke ptr @_ZNSt8multisetIxSt4lessIxESaIxEE6insertERKx(ptr noundef nonnull align 8 dereferenceable(48) %2, ptr noundef nonnull align 8 dereferenceable(8) %55)
          to label %57 unwind label %49

57:                                               ; preds = %53
  %58 = getelementptr inbounds %"struct.std::_Rb_tree_const_iterator", ptr %6, i32 0, i32 0
  store ptr %56, ptr %58, align 8
  br label %59

59:                                               ; preds = %57
  %60 = load i64, ptr %3, align 8, !tbaa !8
  %61 = add nsw i64 %60, 1
  store i64 %61, ptr %3, align 8, !tbaa !8
  br label %28, !llvm.loop !13

62:                                               ; preds = %32
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #6
  store i64 0, ptr %7, align 8, !tbaa !8
  br label %63

63:                                               ; preds = %73, %62
  %64 = load i64, ptr %7, align 8, !tbaa !8
  %65 = load i64, ptr @N, align 8, !tbaa !8
  %66 = icmp slt i64 %64, %65
  br i1 %66, label %68, label %67

67:                                               ; preds = %63
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #6
  br label %80

68:                                               ; preds = %63
  %69 = load i64, ptr %7, align 8, !tbaa !8
  %70 = getelementptr inbounds [200000 x i64], ptr @B, i64 0, i64 %69
  %71 = invoke noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) %70)
          to label %72 unwind label %76

72:                                               ; preds = %68
  br label %73

73:                                               ; preds = %72
  %74 = load i64, ptr %7, align 8, !tbaa !8
  %75 = add nsw i64 %74, 1
  store i64 %75, ptr %7, align 8, !tbaa !8
  br label %63, !llvm.loop !14

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

80:                                               ; preds = %67
  call void @llvm.lifetime.start.p0(i64 1, ptr %8) #6
  store i8 1, ptr %8, align 1, !tbaa !15
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #6
  store i64 0, ptr %9, align 8, !tbaa !8
  br label %81

81:                                               ; preds = %126, %80
  %82 = load i64, ptr %9, align 8, !tbaa !8
  %83 = load i64, ptr @N, align 8, !tbaa !8
  %84 = icmp slt i64 %82, %83
  br i1 %84, label %86, label %85

85:                                               ; preds = %81
  store i32 12, ptr %10, align 4
  br label %129

86:                                               ; preds = %81
  store i8 0, ptr %8, align 1, !tbaa !15
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #6
  store i64 0, ptr %11, align 8, !tbaa !8
  br label %87

87:                                               ; preds = %117, %86
  %88 = load i64, ptr %11, align 8, !tbaa !8
  %89 = icmp slt i64 %88, 32
  br i1 %89, label %91, label %90

90:                                               ; preds = %87
  store i32 15, ptr %10, align 4
  br label %120

91:                                               ; preds = %87
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #6
  %92 = load i64, ptr %9, align 8, !tbaa !8
  %93 = getelementptr inbounds [200000 x i64], ptr @B, i64 0, i64 %92
  %94 = load i64, ptr %93, align 8, !tbaa !8
  %95 = load i64, ptr %11, align 8, !tbaa !8
  %96 = ashr i64 %94, %95
  store i64 %96, ptr %12, align 8, !tbaa !8
  %97 = invoke noundef i64 @_ZNKSt8multisetIxSt4lessIxESaIxEE5countERKx(ptr noundef nonnull align 8 dereferenceable(48) %2, ptr noundef nonnull align 8 dereferenceable(8) %12)
          to label %98 unwind label %109

98:                                               ; preds = %91
  %99 = icmp ne i64 %97, 0
  br i1 %99, label %100, label %113

100:                                              ; preds = %98
  %101 = invoke ptr @_ZNSt8multisetIxSt4lessIxESaIxEE4findERKx(ptr noundef nonnull align 8 dereferenceable(48) %2, ptr noundef nonnull align 8 dereferenceable(8) %12)
          to label %102 unwind label %109

102:                                              ; preds = %100
  %103 = getelementptr inbounds %"struct.std::_Rb_tree_const_iterator", ptr %13, i32 0, i32 0
  store ptr %101, ptr %103, align 8
  %104 = getelementptr inbounds %"struct.std::_Rb_tree_const_iterator", ptr %13, i32 0, i32 0
  %105 = load ptr, ptr %104, align 8
  %106 = invoke ptr @_ZNSt8multisetIxSt4lessIxESaIxEE5eraseB5cxx11ESt23_Rb_tree_const_iteratorIxE(ptr noundef nonnull align 8 dereferenceable(48) %2, ptr %105)
          to label %107 unwind label %109

107:                                              ; preds = %102
  %108 = getelementptr inbounds %"struct.std::_Rb_tree_const_iterator", ptr %14, i32 0, i32 0
  store ptr %106, ptr %108, align 8
  store i8 1, ptr %8, align 1, !tbaa !15
  store i32 15, ptr %10, align 4
  br label %114

109:                                              ; preds = %102, %100, %91
  %110 = landingpad { ptr, i32 }
          cleanup
  %111 = extractvalue { ptr, i32 } %110, 0
  store ptr %111, ptr %4, align 8
  %112 = extractvalue { ptr, i32 } %110, 1
  store i32 %112, ptr %5, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #6
  br label %148

113:                                              ; preds = %98
  store i32 0, ptr %10, align 4
  br label %114

114:                                              ; preds = %113, %107
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #6
  %115 = load i32, ptr %10, align 4
  switch i32 %115, label %120 [
    i32 0, label %116
  ]

116:                                              ; preds = %114
  br label %117

117:                                              ; preds = %116
  %118 = load i64, ptr %11, align 8, !tbaa !8
  %119 = add nsw i64 %118, 1
  store i64 %119, ptr %11, align 8, !tbaa !8
  br label %87, !llvm.loop !17

120:                                              ; preds = %114, %90
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #6
  br label %121

121:                                              ; preds = %120
  %122 = load i8, ptr %8, align 1, !tbaa !15, !range !18, !noundef !19
  %123 = trunc i8 %122 to i1
  br i1 %123, label %125, label %124

124:                                              ; preds = %121
  store i32 12, ptr %10, align 4
  br label %129

125:                                              ; preds = %121
  br label %126

126:                                              ; preds = %125
  %127 = load i64, ptr %9, align 8, !tbaa !8
  %128 = add nsw i64 %127, 1
  store i64 %128, ptr %9, align 8, !tbaa !8
  br label %81, !llvm.loop !20

129:                                              ; preds = %124, %85
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #6
  br label %130

130:                                              ; preds = %129
  %131 = load i8, ptr %8, align 1, !tbaa !15, !range !18, !noundef !19
  %132 = trunc i8 %131 to i1
  br i1 %132, label %133, label %142

133:                                              ; preds = %130
  %134 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, ptr noundef @.str)
          to label %135 unwind label %138

135:                                              ; preds = %133
  %136 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c(ptr noundef nonnull align 8 dereferenceable(8) %134, i8 noundef signext 10)
          to label %137 unwind label %138

137:                                              ; preds = %135
  br label %147

138:                                              ; preds = %144, %142, %135, %133
  %139 = landingpad { ptr, i32 }
          cleanup
  %140 = extractvalue { ptr, i32 } %139, 0
  store ptr %140, ptr %4, align 8
  %141 = extractvalue { ptr, i32 } %139, 1
  store i32 %141, ptr %5, align 4
  br label %148

142:                                              ; preds = %130
  %143 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, ptr noundef @.str.1)
          to label %144 unwind label %138

144:                                              ; preds = %142
  %145 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c(ptr noundef nonnull align 8 dereferenceable(8) %143, i8 noundef signext 10)
          to label %146 unwind label %138

146:                                              ; preds = %144
  br label %147

147:                                              ; preds = %146, %137
  call void @llvm.lifetime.end.p0(i64 1, ptr %8) #6
  call void @_ZNSt8multisetIxSt4lessIxESaIxEED2Ev(ptr noundef nonnull align 8 dereferenceable(48) %2) #6
  call void @llvm.lifetime.end.p0(i64 48, ptr %2) #6
  br label %22, !llvm.loop !21

148:                                              ; preds = %138, %109
  call void @llvm.lifetime.end.p0(i64 1, ptr %8) #6
  br label %149

149:                                              ; preds = %148, %76, %49
  call void @_ZNSt8multisetIxSt4lessIxESaIxEED2Ev(ptr noundef nonnull align 8 dereferenceable(48) %2) #6
  call void @llvm.lifetime.end.p0(i64 48, ptr %2) #6
  br label %152

150:                                              ; preds = %22
  %151 = load i32, ptr %1, align 4
  ret i32 %151

152:                                              ; preds = %149
  %153 = load ptr, ptr %4, align 8
  %154 = load i32, ptr %5, align 4
  %155 = insertvalue { ptr, i32 } poison, ptr %153, 0
  %156 = insertvalue { ptr, i32 } %155, i32 %154, 1
  resume { ptr, i32 } %156
}

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

declare noundef zeroext i1 @_ZNSt8ios_base15sync_with_stdioEb(i1 noundef zeroext) #2

; Function Attrs: mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 8 dereferenceable(8)) #3 align 2

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

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

declare i32 @__gxx_personality_v0(...)

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

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

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

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

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

; Function Attrs: inlinehint mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c(ptr noundef nonnull align 8 dereferenceable(8), i8 noundef signext) #5

; Function Attrs: inlinehint mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef) #5

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

attributes #0 = { 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 #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 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #5 = { 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 #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 = !{!"vtable pointer", !7, i64 0}
!7 = !{!"Simple C++ TBAA"}
!8 = !{!9, !9, i64 0}
!9 = !{!"long long", !10, i64 0}
!10 = !{!"omnipotent char", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = distinct !{!13, !12}
!14 = distinct !{!14, !12}
!15 = !{!16, !16, i64 0}
!16 = !{!"bool", !10, i64 0}
!17 = distinct !{!17, !12}
!18 = !{i8 0, i8 2}
!19 = !{}
!20 = distinct !{!20, !12}
!21 = distinct !{!21, !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::basic_istream" = type { ptr, i64, %"class.std::basic_ios" }
%"class.std::basic_ios" = type { %"class.std::ios_base", ptr, i8, i8, ptr, ptr, ptr, ptr }
%"class.std::ios_base" = type { ptr, i64, i64, i32, i32, i32, ptr, %"struct.std::ios_base::_Words", [8 x %"struct.std::ios_base::_Words"], i32, ptr, %"class.std::locale" }
%"struct.std::ios_base::_Words" = type { ptr, i64 }
%"class.std::locale" = type { ptr }
%"class.std::basic_ostream" = type { ptr, %"class.std::basic_ios" }
%"class.std::multiset" = type { %"class.std::_Rb_tree" }
%"class.std::_Rb_tree" = type { %"struct.std::_Rb_tree<long long, long long, std::_Identity<long long>, std::less<long long>>::_Rb_tree_impl" }
%"struct.std::_Rb_tree<long long, long long, std::_Identity<long long>, std::less<long long>>::_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 }

@T = external dso_local global i64, align 8
@N = external dso_local global i64, align 8
@A = external dso_local global [200000 x i64], align 16
@B = external dso_local global [200000 x i64], align 16
@_ZSt3cin = external global %"class.std::basic_istream", align 8
@_ZSt4cout = external global %"class.std::basic_ostream", align 8
@.str = external hidden unnamed_addr constant [4 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [3 x i8], align 1

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #0 personality ptr @__gxx_personality_v0 {
  %1 = alloca %"class.std::multiset", align 8
  %2 = alloca i64, align 8
  %3 = load ptr, ptr @_ZSt3cin, align 8, !tbaa !5
  %4 = getelementptr i8, ptr %3, i64 -24
  %5 = load i64, ptr %4, align 8
  %6 = getelementptr inbounds i8, ptr @_ZSt3cin, i64 %5
  %7 = tail call noundef ptr @_ZNSt9basic_iosIcSt11char_traitsIcEE3tieEPSo(ptr noundef nonnull align 8 dereferenceable(264) %6, ptr noundef null)
  %8 = tail call noundef zeroext i1 @_ZNSt8ios_base15sync_with_stdioEb(i1 noundef zeroext false)
  %9 = tail call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) @T)
  %10 = load i64, ptr @T, align 8, !tbaa !8
  %11 = add nsw i64 %10, -1
  store i64 %11, ptr @T, align 8, !tbaa !8
  %.not52 = icmp eq i64 %10, 0
  br i1 %.not52, label %._crit_edge55, label %.lr.ph54

.lr.ph54:                                         ; preds = %0, %212
  %12 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) @N)
  call void @llvm.lifetime.start.p0(i64 48, ptr nonnull %1) #6
  call void @_ZNSt8multisetIxSt4lessIxESaIxEEC2Ev(ptr noundef nonnull align 8 dereferenceable(48) %1) #6
  %13 = load i64, ptr @N, align 8, !tbaa !8
  %14 = icmp sgt i64 %13, 0
  br i1 %14, label %.lr.ph46, label %.invoke59

.preheader43:                                     ; preds = %28
  %15 = icmp sgt i64 %30, 0
  br i1 %15, label %.lr.ph48, label %.invoke59

.lr.ph46:                                         ; preds = %.lr.ph54, %28
  %.044 = phi i64 [ %29, %28 ], [ 0, %.lr.ph54 ]
  %16 = getelementptr inbounds [200000 x i64], ptr @A, i64 0, i64 %.044
  %17 = invoke noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) %16)
          to label %.preheader41 unwind label %24

.preheader41:                                     ; preds = %.lr.ph46
  %.promoted = load i64, ptr %16, align 8, !tbaa !8
  %18 = and i64 %.promoted, 1
  %19 = icmp eq i64 %18, 0
  br i1 %19, label %.lr.ph, label %26

.lr.ph:                                           ; preds = %.preheader41, %.lr.ph
  %20 = phi i64 [ %21, %.lr.ph ], [ %.promoted, %.preheader41 ]
  %21 = ashr exact i64 %20, 1
  %22 = and i64 %20, 2
  %23 = icmp eq i64 %22, 0
  br i1 %23, label %.lr.ph, label %._crit_edge, !llvm.loop !11

24:                                               ; preds = %26, %.lr.ph46
  %25 = landingpad { ptr, i32 }
          cleanup
  br label %215

._crit_edge:                                      ; preds = %.lr.ph
  store i64 %21, ptr %16, align 8, !tbaa !8
  br label %26

26:                                               ; preds = %._crit_edge, %.preheader41
  %27 = invoke ptr @_ZNSt8multisetIxSt4lessIxESaIxEE6insertERKx(ptr noundef nonnull align 8 dereferenceable(48) %1, ptr noundef nonnull align 8 dereferenceable(8) %16)
          to label %28 unwind label %24

28:                                               ; preds = %26
  %29 = add nuw nsw i64 %.044, 1
  %30 = load i64, ptr @N, align 8, !tbaa !8
  %31 = icmp slt i64 %29, %30
  br i1 %31, label %.lr.ph46, label %.preheader43, !llvm.loop !13

.preheader42:                                     ; preds = %34
  %.not4050 = icmp sgt i64 %36, 0
  br i1 %.not4050, label %.preheader, label %.invoke59

.lr.ph48:                                         ; preds = %.preheader43, %34
  %.02847 = phi i64 [ %35, %34 ], [ 0, %.preheader43 ]
  %32 = getelementptr inbounds [200000 x i64], ptr @B, i64 0, i64 %.02847
  %33 = invoke noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) %32)
          to label %34 unwind label %38

34:                                               ; preds = %.lr.ph48
  %35 = add nuw nsw i64 %.02847, 1
  %36 = load i64, ptr @N, align 8, !tbaa !8
  %37 = icmp slt i64 %35, %36
  br i1 %37, label %.lr.ph48, label %.preheader42, !llvm.loop !14

38:                                               ; preds = %.lr.ph48
  %39 = landingpad { ptr, i32 }
          cleanup
  br label %215

.preheader:                                       ; preds = %.preheader42, %.thread37
  %.02551 = phi i64 [ %49, %.thread37 ], [ 0, %.preheader42 ]
  %40 = getelementptr inbounds [200000 x i64], ptr @B, i64 0, i64 %.02551
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %2) #6
  %41 = load i64, ptr %40, align 8, !tbaa !8
  store i64 %41, ptr %2, align 8, !tbaa !8
  %42 = invoke noundef i64 @_ZNKSt8multisetIxSt4lessIxESaIxEE5countERKx(ptr noundef nonnull align 8 dereferenceable(48) %1, ptr noundef nonnull align 8 dereferenceable(8) %2)
          to label %43 unwind label %.loopexit

43:                                               ; preds = %.preheader
  %.not31 = icmp eq i64 %42, 0
  br i1 %.not31, label %51, label %44

44:                                               ; preds = %205, %200, %195, %190, %185, %180, %175, %170, %165, %160, %155, %150, %145, %140, %135, %130, %125, %120, %115, %110, %105, %100, %95, %90, %85, %80, %75, %70, %65, %60, %55, %43
  %45 = invoke ptr @_ZNSt8multisetIxSt4lessIxESaIxEE4findERKx(ptr noundef nonnull align 8 dereferenceable(48) %1, ptr noundef nonnull align 8 dereferenceable(8) %2)
          to label %46 unwind label %.loopexit.split-lp

46:                                               ; preds = %44
  %47 = invoke ptr @_ZNSt8multisetIxSt4lessIxESaIxEE5eraseB5cxx11ESt23_Rb_tree_const_iteratorIxE(ptr noundef nonnull align 8 dereferenceable(48) %1, ptr %45)
          to label %.thread37 unwind label %.loopexit.split-lp

.loopexit:                                        ; preds = %201, %196, %191, %186, %181, %176, %171, %166, %161, %156, %151, %146, %141, %136, %131, %126, %121, %116, %111, %106, %101, %96, %91, %86, %81, %76, %71, %66, %61, %56, %51, %.preheader
  %lpad.loopexit = landingpad { ptr, i32 }
          cleanup
  br label %48

.loopexit.split-lp:                               ; preds = %44, %46
  %lpad.loopexit.split-lp = landingpad { ptr, i32 }
          cleanup
  br label %48

48:                                               ; preds = %.loopexit.split-lp, %.loopexit
  %lpad.phi = phi { ptr, i32 } [ %lpad.loopexit, %.loopexit ], [ %lpad.loopexit.split-lp, %.loopexit.split-lp ]
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %2) #6
  br label %215

.thread37:                                        ; preds = %46
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %2) #6
  %49 = add nuw nsw i64 %.02551, 1
  %50 = load i64, ptr @N, align 8, !tbaa !8
  %.not40 = icmp slt i64 %49, %50
  br i1 %.not40, label %.preheader, label %.invoke59, !llvm.loop !15

51:                                               ; preds = %43
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %2) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %2) #6
  %52 = load i64, ptr %40, align 8, !tbaa !8
  %53 = ashr i64 %52, 1
  store i64 %53, ptr %2, align 8, !tbaa !8
  %54 = invoke noundef i64 @_ZNKSt8multisetIxSt4lessIxESaIxEE5countERKx(ptr noundef nonnull align 8 dereferenceable(48) %1, ptr noundef nonnull align 8 dereferenceable(8) %2)
          to label %55 unwind label %.loopexit

55:                                               ; preds = %51
  %.not31.1 = icmp eq i64 %54, 0
  br i1 %.not31.1, label %56, label %44

56:                                               ; preds = %55
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %2) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %2) #6
  %57 = load i64, ptr %40, align 8, !tbaa !8
  %58 = ashr i64 %57, 2
  store i64 %58, ptr %2, align 8, !tbaa !8
  %59 = invoke noundef i64 @_ZNKSt8multisetIxSt4lessIxESaIxEE5countERKx(ptr noundef nonnull align 8 dereferenceable(48) %1, ptr noundef nonnull align 8 dereferenceable(8) %2)
          to label %60 unwind label %.loopexit

60:                                               ; preds = %56
  %.not31.2 = icmp eq i64 %59, 0
  br i1 %.not31.2, label %61, label %44

61:                                               ; preds = %60
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %2) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %2) #6
  %62 = load i64, ptr %40, align 8, !tbaa !8
  %63 = ashr i64 %62, 3
  store i64 %63, ptr %2, align 8, !tbaa !8
  %64 = invoke noundef i64 @_ZNKSt8multisetIxSt4lessIxESaIxEE5countERKx(ptr noundef nonnull align 8 dereferenceable(48) %1, ptr noundef nonnull align 8 dereferenceable(8) %2)
          to label %65 unwind label %.loopexit

65:                                               ; preds = %61
  %.not31.3 = icmp eq i64 %64, 0
  br i1 %.not31.3, label %66, label %44

66:                                               ; preds = %65
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %2) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %2) #6
  %67 = load i64, ptr %40, align 8, !tbaa !8
  %68 = ashr i64 %67, 4
  store i64 %68, ptr %2, align 8, !tbaa !8
  %69 = invoke noundef i64 @_ZNKSt8multisetIxSt4lessIxESaIxEE5countERKx(ptr noundef nonnull align 8 dereferenceable(48) %1, ptr noundef nonnull align 8 dereferenceable(8) %2)
          to label %70 unwind label %.loopexit

70:                                               ; preds = %66
  %.not31.4 = icmp eq i64 %69, 0
  br i1 %.not31.4, label %71, label %44

71:                                               ; preds = %70
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %2) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %2) #6
  %72 = load i64, ptr %40, align 8, !tbaa !8
  %73 = ashr i64 %72, 5
  store i64 %73, ptr %2, align 8, !tbaa !8
  %74 = invoke noundef i64 @_ZNKSt8multisetIxSt4lessIxESaIxEE5countERKx(ptr noundef nonnull align 8 dereferenceable(48) %1, ptr noundef nonnull align 8 dereferenceable(8) %2)
          to label %75 unwind label %.loopexit

75:                                               ; preds = %71
  %.not31.5 = icmp eq i64 %74, 0
  br i1 %.not31.5, label %76, label %44

76:                                               ; preds = %75
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %2) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %2) #6
  %77 = load i64, ptr %40, align 8, !tbaa !8
  %78 = ashr i64 %77, 6
  store i64 %78, ptr %2, align 8, !tbaa !8
  %79 = invoke noundef i64 @_ZNKSt8multisetIxSt4lessIxESaIxEE5countERKx(ptr noundef nonnull align 8 dereferenceable(48) %1, ptr noundef nonnull align 8 dereferenceable(8) %2)
          to label %80 unwind label %.loopexit

80:                                               ; preds = %76
  %.not31.6 = icmp eq i64 %79, 0
  br i1 %.not31.6, label %81, label %44

81:                                               ; preds = %80
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %2) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %2) #6
  %82 = load i64, ptr %40, align 8, !tbaa !8
  %83 = ashr i64 %82, 7
  store i64 %83, ptr %2, align 8, !tbaa !8
  %84 = invoke noundef i64 @_ZNKSt8multisetIxSt4lessIxESaIxEE5countERKx(ptr noundef nonnull align 8 dereferenceable(48) %1, ptr noundef nonnull align 8 dereferenceable(8) %2)
          to label %85 unwind label %.loopexit

85:                                               ; preds = %81
  %.not31.7 = icmp eq i64 %84, 0
  br i1 %.not31.7, label %86, label %44

86:                                               ; preds = %85
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %2) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %2) #6
  %87 = load i64, ptr %40, align 8, !tbaa !8
  %88 = ashr i64 %87, 8
  store i64 %88, ptr %2, align 8, !tbaa !8
  %89 = invoke noundef i64 @_ZNKSt8multisetIxSt4lessIxESaIxEE5countERKx(ptr noundef nonnull align 8 dereferenceable(48) %1, ptr noundef nonnull align 8 dereferenceable(8) %2)
          to label %90 unwind label %.loopexit

90:                                               ; preds = %86
  %.not31.8 = icmp eq i64 %89, 0
  br i1 %.not31.8, label %91, label %44

91:                                               ; preds = %90
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %2) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %2) #6
  %92 = load i64, ptr %40, align 8, !tbaa !8
  %93 = ashr i64 %92, 9
  store i64 %93, ptr %2, align 8, !tbaa !8
  %94 = invoke noundef i64 @_ZNKSt8multisetIxSt4lessIxESaIxEE5countERKx(ptr noundef nonnull align 8 dereferenceable(48) %1, ptr noundef nonnull align 8 dereferenceable(8) %2)
          to label %95 unwind label %.loopexit

95:                                               ; preds = %91
  %.not31.9 = icmp eq i64 %94, 0
  br i1 %.not31.9, label %96, label %44

96:                                               ; preds = %95
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %2) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %2) #6
  %97 = load i64, ptr %40, align 8, !tbaa !8
  %98 = ashr i64 %97, 10
  store i64 %98, ptr %2, align 8, !tbaa !8
  %99 = invoke noundef i64 @_ZNKSt8multisetIxSt4lessIxESaIxEE5countERKx(ptr noundef nonnull align 8 dereferenceable(48) %1, ptr noundef nonnull align 8 dereferenceable(8) %2)
          to label %100 unwind label %.loopexit

100:                                              ; preds = %96
  %.not31.10 = icmp eq i64 %99, 0
  br i1 %.not31.10, label %101, label %44

101:                                              ; preds = %100
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %2) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %2) #6
  %102 = load i64, ptr %40, align 8, !tbaa !8
  %103 = ashr i64 %102, 11
  store i64 %103, ptr %2, align 8, !tbaa !8
  %104 = invoke noundef i64 @_ZNKSt8multisetIxSt4lessIxESaIxEE5countERKx(ptr noundef nonnull align 8 dereferenceable(48) %1, ptr noundef nonnull align 8 dereferenceable(8) %2)
          to label %105 unwind label %.loopexit

105:                                              ; preds = %101
  %.not31.11 = icmp eq i64 %104, 0
  br i1 %.not31.11, label %106, label %44

106:                                              ; preds = %105
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %2) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %2) #6
  %107 = load i64, ptr %40, align 8, !tbaa !8
  %108 = ashr i64 %107, 12
  store i64 %108, ptr %2, align 8, !tbaa !8
  %109 = invoke noundef i64 @_ZNKSt8multisetIxSt4lessIxESaIxEE5countERKx(ptr noundef nonnull align 8 dereferenceable(48) %1, ptr noundef nonnull align 8 dereferenceable(8) %2)
          to label %110 unwind label %.loopexit

110:                                              ; preds = %106
  %.not31.12 = icmp eq i64 %109, 0
  br i1 %.not31.12, label %111, label %44

111:                                              ; preds = %110
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %2) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %2) #6
  %112 = load i64, ptr %40, align 8, !tbaa !8
  %113 = ashr i64 %112, 13
  store i64 %113, ptr %2, align 8, !tbaa !8
  %114 = invoke noundef i64 @_ZNKSt8multisetIxSt4lessIxESaIxEE5countERKx(ptr noundef nonnull align 8 dereferenceable(48) %1, ptr noundef nonnull align 8 dereferenceable(8) %2)
          to label %115 unwind label %.loopexit

115:                                              ; preds = %111
  %.not31.13 = icmp eq i64 %114, 0
  br i1 %.not31.13, label %116, label %44

116:                                              ; preds = %115
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %2) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %2) #6
  %117 = load i64, ptr %40, align 8, !tbaa !8
  %118 = ashr i64 %117, 14
  store i64 %118, ptr %2, align 8, !tbaa !8
  %119 = invoke noundef i64 @_ZNKSt8multisetIxSt4lessIxESaIxEE5countERKx(ptr noundef nonnull align 8 dereferenceable(48) %1, ptr noundef nonnull align 8 dereferenceable(8) %2)
          to label %120 unwind label %.loopexit

120:                                              ; preds = %116
  %.not31.14 = icmp eq i64 %119, 0
  br i1 %.not31.14, label %121, label %44

121:                                              ; preds = %120
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %2) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %2) #6
  %122 = load i64, ptr %40, align 8, !tbaa !8
  %123 = ashr i64 %122, 15
  store i64 %123, ptr %2, align 8, !tbaa !8
  %124 = invoke noundef i64 @_ZNKSt8multisetIxSt4lessIxESaIxEE5countERKx(ptr noundef nonnull align 8 dereferenceable(48) %1, ptr noundef nonnull align 8 dereferenceable(8) %2)
          to label %125 unwind label %.loopexit

125:                                              ; preds = %121
  %.not31.15 = icmp eq i64 %124, 0
  br i1 %.not31.15, label %126, label %44

126:                                              ; preds = %125
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %2) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %2) #6
  %127 = load i64, ptr %40, align 8, !tbaa !8
  %128 = ashr i64 %127, 16
  store i64 %128, ptr %2, align 8, !tbaa !8
  %129 = invoke noundef i64 @_ZNKSt8multisetIxSt4lessIxESaIxEE5countERKx(ptr noundef nonnull align 8 dereferenceable(48) %1, ptr noundef nonnull align 8 dereferenceable(8) %2)
          to label %130 unwind label %.loopexit

130:                                              ; preds = %126
  %.not31.16 = icmp eq i64 %129, 0
  br i1 %.not31.16, label %131, label %44

131:                                              ; preds = %130
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %2) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %2) #6
  %132 = load i64, ptr %40, align 8, !tbaa !8
  %133 = ashr i64 %132, 17
  store i64 %133, ptr %2, align 8, !tbaa !8
  %134 = invoke noundef i64 @_ZNKSt8multisetIxSt4lessIxESaIxEE5countERKx(ptr noundef nonnull align 8 dereferenceable(48) %1, ptr noundef nonnull align 8 dereferenceable(8) %2)
          to label %135 unwind label %.loopexit

135:                                              ; preds = %131
  %.not31.17 = icmp eq i64 %134, 0
  br i1 %.not31.17, label %136, label %44

136:                                              ; preds = %135
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %2) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %2) #6
  %137 = load i64, ptr %40, align 8, !tbaa !8
  %138 = ashr i64 %137, 18
  store i64 %138, ptr %2, align 8, !tbaa !8
  %139 = invoke noundef i64 @_ZNKSt8multisetIxSt4lessIxESaIxEE5countERKx(ptr noundef nonnull align 8 dereferenceable(48) %1, ptr noundef nonnull align 8 dereferenceable(8) %2)
          to label %140 unwind label %.loopexit

140:                                              ; preds = %136
  %.not31.18 = icmp eq i64 %139, 0
  br i1 %.not31.18, label %141, label %44

141:                                              ; preds = %140
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %2) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %2) #6
  %142 = load i64, ptr %40, align 8, !tbaa !8
  %143 = ashr i64 %142, 19
  store i64 %143, ptr %2, align 8, !tbaa !8
  %144 = invoke noundef i64 @_ZNKSt8multisetIxSt4lessIxESaIxEE5countERKx(ptr noundef nonnull align 8 dereferenceable(48) %1, ptr noundef nonnull align 8 dereferenceable(8) %2)
          to label %145 unwind label %.loopexit

145:                                              ; preds = %141
  %.not31.19 = icmp eq i64 %144, 0
  br i1 %.not31.19, label %146, label %44

146:                                              ; preds = %145
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %2) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %2) #6
  %147 = load i64, ptr %40, align 8, !tbaa !8
  %148 = ashr i64 %147, 20
  store i64 %148, ptr %2, align 8, !tbaa !8
  %149 = invoke noundef i64 @_ZNKSt8multisetIxSt4lessIxESaIxEE5countERKx(ptr noundef nonnull align 8 dereferenceable(48) %1, ptr noundef nonnull align 8 dereferenceable(8) %2)
          to label %150 unwind label %.loopexit

150:                                              ; preds = %146
  %.not31.20 = icmp eq i64 %149, 0
  br i1 %.not31.20, label %151, label %44

151:                                              ; preds = %150
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %2) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %2) #6
  %152 = load i64, ptr %40, align 8, !tbaa !8
  %153 = ashr i64 %152, 21
  store i64 %153, ptr %2, align 8, !tbaa !8
  %154 = invoke noundef i64 @_ZNKSt8multisetIxSt4lessIxESaIxEE5countERKx(ptr noundef nonnull align 8 dereferenceable(48) %1, ptr noundef nonnull align 8 dereferenceable(8) %2)
          to label %155 unwind label %.loopexit

155:                                              ; preds = %151
  %.not31.21 = icmp eq i64 %154, 0
  br i1 %.not31.21, label %156, label %44

156:                                              ; preds = %155
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %2) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %2) #6
  %157 = load i64, ptr %40, align 8, !tbaa !8
  %158 = ashr i64 %157, 22
  store i64 %158, ptr %2, align 8, !tbaa !8
  %159 = invoke noundef i64 @_ZNKSt8multisetIxSt4lessIxESaIxEE5countERKx(ptr noundef nonnull align 8 dereferenceable(48) %1, ptr noundef nonnull align 8 dereferenceable(8) %2)
          to label %160 unwind label %.loopexit

160:                                              ; preds = %156
  %.not31.22 = icmp eq i64 %159, 0
  br i1 %.not31.22, label %161, label %44

161:                                              ; preds = %160
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %2) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %2) #6
  %162 = load i64, ptr %40, align 8, !tbaa !8
  %163 = ashr i64 %162, 23
  store i64 %163, ptr %2, align 8, !tbaa !8
  %164 = invoke noundef i64 @_ZNKSt8multisetIxSt4lessIxESaIxEE5countERKx(ptr noundef nonnull align 8 dereferenceable(48) %1, ptr noundef nonnull align 8 dereferenceable(8) %2)
          to label %165 unwind label %.loopexit

165:                                              ; preds = %161
  %.not31.23 = icmp eq i64 %164, 0
  br i1 %.not31.23, label %166, label %44

166:                                              ; preds = %165
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %2) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %2) #6
  %167 = load i64, ptr %40, align 8, !tbaa !8
  %168 = ashr i64 %167, 24
  store i64 %168, ptr %2, align 8, !tbaa !8
  %169 = invoke noundef i64 @_ZNKSt8multisetIxSt4lessIxESaIxEE5countERKx(ptr noundef nonnull align 8 dereferenceable(48) %1, ptr noundef nonnull align 8 dereferenceable(8) %2)
          to label %170 unwind label %.loopexit

170:                                              ; preds = %166
  %.not31.24 = icmp eq i64 %169, 0
  br i1 %.not31.24, label %171, label %44

171:                                              ; preds = %170
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %2) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %2) #6
  %172 = load i64, ptr %40, align 8, !tbaa !8
  %173 = ashr i64 %172, 25
  store i64 %173, ptr %2, align 8, !tbaa !8
  %174 = invoke noundef i64 @_ZNKSt8multisetIxSt4lessIxESaIxEE5countERKx(ptr noundef nonnull align 8 dereferenceable(48) %1, ptr noundef nonnull align 8 dereferenceable(8) %2)
          to label %175 unwind label %.loopexit

175:                                              ; preds = %171
  %.not31.25 = icmp eq i64 %174, 0
  br i1 %.not31.25, label %176, label %44

176:                                              ; preds = %175
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %2) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %2) #6
  %177 = load i64, ptr %40, align 8, !tbaa !8
  %178 = ashr i64 %177, 26
  store i64 %178, ptr %2, align 8, !tbaa !8
  %179 = invoke noundef i64 @_ZNKSt8multisetIxSt4lessIxESaIxEE5countERKx(ptr noundef nonnull align 8 dereferenceable(48) %1, ptr noundef nonnull align 8 dereferenceable(8) %2)
          to label %180 unwind label %.loopexit

180:                                              ; preds = %176
  %.not31.26 = icmp eq i64 %179, 0
  br i1 %.not31.26, label %181, label %44

181:                                              ; preds = %180
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %2) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %2) #6
  %182 = load i64, ptr %40, align 8, !tbaa !8
  %183 = ashr i64 %182, 27
  store i64 %183, ptr %2, align 8, !tbaa !8
  %184 = invoke noundef i64 @_ZNKSt8multisetIxSt4lessIxESaIxEE5countERKx(ptr noundef nonnull align 8 dereferenceable(48) %1, ptr noundef nonnull align 8 dereferenceable(8) %2)
          to label %185 unwind label %.loopexit

185:                                              ; preds = %181
  %.not31.27 = icmp eq i64 %184, 0
  br i1 %.not31.27, label %186, label %44

186:                                              ; preds = %185
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %2) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %2) #6
  %187 = load i64, ptr %40, align 8, !tbaa !8
  %188 = ashr i64 %187, 28
  store i64 %188, ptr %2, align 8, !tbaa !8
  %189 = invoke noundef i64 @_ZNKSt8multisetIxSt4lessIxESaIxEE5countERKx(ptr noundef nonnull align 8 dereferenceable(48) %1, ptr noundef nonnull align 8 dereferenceable(8) %2)
          to label %190 unwind label %.loopexit

190:                                              ; preds = %186
  %.not31.28 = icmp eq i64 %189, 0
  br i1 %.not31.28, label %191, label %44

191:                                              ; preds = %190
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %2) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %2) #6
  %192 = load i64, ptr %40, align 8, !tbaa !8
  %193 = ashr i64 %192, 29
  store i64 %193, ptr %2, align 8, !tbaa !8
  %194 = invoke noundef i64 @_ZNKSt8multisetIxSt4lessIxESaIxEE5countERKx(ptr noundef nonnull align 8 dereferenceable(48) %1, ptr noundef nonnull align 8 dereferenceable(8) %2)
          to label %195 unwind label %.loopexit

195:                                              ; preds = %191
  %.not31.29 = icmp eq i64 %194, 0
  br i1 %.not31.29, label %196, label %44

196:                                              ; preds = %195
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %2) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %2) #6
  %197 = load i64, ptr %40, align 8, !tbaa !8
  %198 = ashr i64 %197, 30
  store i64 %198, ptr %2, align 8, !tbaa !8
  %199 = invoke noundef i64 @_ZNKSt8multisetIxSt4lessIxESaIxEE5countERKx(ptr noundef nonnull align 8 dereferenceable(48) %1, ptr noundef nonnull align 8 dereferenceable(8) %2)
          to label %200 unwind label %.loopexit

200:                                              ; preds = %196
  %.not31.30 = icmp eq i64 %199, 0
  br i1 %.not31.30, label %201, label %44

201:                                              ; preds = %200
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %2) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %2) #6
  %202 = load i64, ptr %40, align 8, !tbaa !8
  %203 = ashr i64 %202, 31
  store i64 %203, ptr %2, align 8, !tbaa !8
  %204 = invoke noundef i64 @_ZNKSt8multisetIxSt4lessIxESaIxEE5countERKx(ptr noundef nonnull align 8 dereferenceable(48) %1, ptr noundef nonnull align 8 dereferenceable(8) %2)
          to label %205 unwind label %.loopexit

205:                                              ; preds = %201
  %.not31.31 = icmp eq i64 %204, 0
  br i1 %.not31.31, label %206, label %44

206:                                              ; preds = %205
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %2) #6
  br label %.invoke59

.invoke59:                                        ; preds = %.thread37, %.preheader42, %.preheader43, %.lr.ph54, %206
  %207 = phi ptr [ @.str.1, %206 ], [ @.str, %.lr.ph54 ], [ @.str, %.preheader43 ], [ @.str, %.preheader42 ], [ @.str, %.thread37 ]
  %208 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, ptr noundef nonnull %207)
          to label %.invoke unwind label %209

209:                                              ; preds = %.invoke59, %.invoke
  %210 = landingpad { ptr, i32 }
          cleanup
  br label %215

.invoke:                                          ; preds = %.invoke59
  %211 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c(ptr noundef nonnull align 8 dereferenceable(8) %208, i8 noundef signext 10)
          to label %212 unwind label %209

212:                                              ; preds = %.invoke
  call void @_ZNSt8multisetIxSt4lessIxESaIxEED2Ev(ptr noundef nonnull align 8 dereferenceable(48) %1) #6
  call void @llvm.lifetime.end.p0(i64 48, ptr nonnull %1) #6
  %213 = load i64, ptr @T, align 8, !tbaa !8
  %214 = add nsw i64 %213, -1
  store i64 %214, ptr @T, align 8, !tbaa !8
  %.not = icmp eq i64 %213, 0
  br i1 %.not, label %._crit_edge55, label %.lr.ph54, !llvm.loop !16

215:                                              ; preds = %48, %209, %38, %24
  %.pn33 = phi { ptr, i32 } [ %25, %24 ], [ %39, %38 ], [ %210, %209 ], [ %lpad.phi, %48 ]
  call void @_ZNSt8multisetIxSt4lessIxESaIxEED2Ev(ptr noundef nonnull align 8 dereferenceable(48) %1) #6
  call void @llvm.lifetime.end.p0(i64 48, ptr nonnull %1) #6
  resume { ptr, i32 } %.pn33

._crit_edge55:                                    ; preds = %212, %0
  ret i32 0
}

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

declare noundef zeroext i1 @_ZNSt8ios_base15sync_with_stdioEb(i1 noundef zeroext) local_unnamed_addr #2

; Function Attrs: mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 8 dereferenceable(8)) local_unnamed_addr #3 align 2

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

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

declare i32 @__gxx_personality_v0(...)

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

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

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

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

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

; Function Attrs: inlinehint mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c(ptr noundef nonnull align 8 dereferenceable(8), i8 noundef signext) local_unnamed_addr #5

; Function Attrs: inlinehint mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef) local_unnamed_addr #5

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

attributes #0 = { 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 #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 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #5 = { 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 #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 = !{!"vtable pointer", !7, i64 0}
!7 = !{!"Simple C++ TBAA"}
!8 = !{!9, !9, i64 0}
!9 = !{!"long long", !10, i64 0}
!10 = !{!"omnipotent char", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = distinct !{!13, !12}
!14 = distinct !{!14, !12}
!15 = distinct !{!15, !12}
!16 = distinct !{!16, !12}


; Effective O3 passes: ConstraintEliminationPass,CorrelatedValuePropagationPass,EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LICMPass,LoopRotatePass,LoopSimplifyCFGPass,LoopSimplifyPass,LoopUnrollPass,SROAPass,SimplifyCFGPass,TailCallElimPass