; LLVM IR from VastoLorde95/Competitive-Programming :: CodeChef/WF/Medium Hard/MGCHGYM (A)

; 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::set" = 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::pair.3" = type <{ %"struct.std::_Rb_tree_const_iterator", i8, [7 x i8] }>
%"struct.std::_Rb_tree_const_iterator" = type { ptr }

@_ZN5Treap4wposE = external dso_local global [100100 x i32], align 16
@_ZN5Treap4poswE = external dso_local global [10 x i32], align 16
@n = external dso_local global i32, align 4
@q = external dso_local global i32, align 4
@w = external dso_local global [100100 x i32], align 16
@t = external dso_local global [100100 x i32], align 16
@x = external dso_local global [100100 x i32], align 16
@y = external dso_local global [100100 x i32], align 16
@ww = external dso_local global [100100 x i32], 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 [5 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [4 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

; Function Attrs: mustprogress uwtable
declare dso_local noundef ptr @_ZN5Treap5mergeEPNS_4nodeES1_(ptr noundef, ptr noundef) #1

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

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

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

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() #2 personality ptr @__gxx_personality_v0 {
  %1 = alloca i32, align 4
  %2 = alloca %"class.std::set", align 8
  %3 = alloca i32, align 4
  %4 = alloca ptr, align 8
  %5 = alloca i32, align 4
  %6 = alloca %"struct.std::pair.3", align 8
  %7 = alloca i32, align 4
  %8 = alloca %"struct.std::pair.3", align 8
  %9 = alloca i32, align 4
  %10 = alloca %"struct.std::_Rb_tree_const_iterator", align 8
  %11 = alloca %"struct.std::_Rb_tree_const_iterator", align 8
  %12 = alloca ptr, align 8
  %13 = alloca i32, align 4
  %14 = alloca ptr, align 8
  %15 = alloca i32, align 4
  store i32 0, ptr %1, align 4
  %16 = call noundef zeroext i1 @_ZNSt8ios_base15sync_with_stdioEb(i1 noundef zeroext false)
  %17 = load ptr, ptr @_ZSt3cin, align 8, !tbaa !5
  %18 = getelementptr i8, ptr %17, i64 -24
  %19 = load i64, ptr %18, align 8
  %20 = getelementptr inbounds i8, ptr @_ZSt3cin, i64 %19
  %21 = call noundef ptr @_ZNSt9basic_iosIcSt11char_traitsIcEE3tieEPSo(ptr noundef nonnull align 8 dereferenceable(264) %20, ptr noundef null)
  %22 = load ptr, ptr @_ZSt4cout, align 8, !tbaa !5
  %23 = getelementptr i8, ptr %22, i64 -24
  %24 = load i64, ptr %23, align 8
  %25 = getelementptr inbounds i8, ptr @_ZSt4cout, i64 %24
  %26 = call noundef ptr @_ZNSt9basic_iosIcSt11char_traitsIcEE3tieEPSo(ptr noundef nonnull align 8 dereferenceable(264) %25, ptr noundef null)
  %27 = call i64 @time(ptr noundef null) #9
  %28 = trunc i64 %27 to i32
  call void @srand(i32 noundef %28) #9
  %29 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) @n)
  %30 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %29, ptr noundef nonnull align 4 dereferenceable(4) @q)
  call void @llvm.lifetime.start.p0(i64 48, ptr %2) #9
  call void @_ZNSt3setIiSt4lessIiESaIiEEC2Ev(ptr noundef nonnull align 8 dereferenceable(48) %2) #9
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #9
  store i32 1, ptr %3, align 4, !tbaa !8
  br label %31

31:                                               ; preds = %51, %0
  %32 = load i32, ptr %3, align 4, !tbaa !8
  %33 = load i32, ptr @n, align 4, !tbaa !8
  %34 = icmp sle i32 %32, %33
  br i1 %34, label %36, label %35

35:                                               ; preds = %31
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #9
  br label %58

36:                                               ; preds = %31
  %37 = load i32, ptr %3, align 4, !tbaa !8
  %38 = sext i32 %37 to i64
  %39 = getelementptr inbounds [100100 x i32], ptr @w, i64 0, i64 %38
  %40 = invoke noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) %39)
          to label %41 unwind label %54

41:                                               ; preds = %36
  %42 = load i32, ptr %3, align 4, !tbaa !8
  %43 = sext i32 %42 to i64
  %44 = getelementptr inbounds [100100 x i32], ptr @w, i64 0, i64 %43
  %45 = invoke { ptr, i8 } @_ZNSt3setIiSt4lessIiESaIiEE6insertERKi(ptr noundef nonnull align 8 dereferenceable(48) %2, ptr noundef nonnull align 4 dereferenceable(4) %44)
          to label %46 unwind label %54

46:                                               ; preds = %41
  %47 = getelementptr inbounds { ptr, i8 }, ptr %6, i32 0, i32 0
  %48 = extractvalue { ptr, i8 } %45, 0
  store ptr %48, ptr %47, align 8
  %49 = getelementptr inbounds { ptr, i8 }, ptr %6, i32 0, i32 1
  %50 = extractvalue { ptr, i8 } %45, 1
  store i8 %50, ptr %49, align 8
  br label %51

51:                                               ; preds = %46
  %52 = load i32, ptr %3, align 4, !tbaa !8
  %53 = add nsw i32 %52, 1
  store i32 %53, ptr %3, align 4, !tbaa !8
  br label %31, !llvm.loop !11

54:                                               ; preds = %41, %36
  %55 = landingpad { ptr, i32 }
          cleanup
  %56 = extractvalue { ptr, i32 } %55, 0
  store ptr %56, ptr %4, align 8
  %57 = extractvalue { ptr, i32 } %55, 1
  store i32 %57, ptr %5, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #9
  br label %254

58:                                               ; preds = %35
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #9
  store i32 1, ptr %7, align 4, !tbaa !8
  br label %59

59:                                               ; preds = %113, %58
  %60 = load i32, ptr %7, align 4, !tbaa !8
  %61 = load i32, ptr @q, align 4, !tbaa !8
  %62 = icmp sle i32 %60, %61
  br i1 %62, label %64, label %63

63:                                               ; preds = %59
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #9
  br label %116

64:                                               ; preds = %59
  %65 = load i32, ptr %7, align 4, !tbaa !8
  %66 = sext i32 %65 to i64
  %67 = getelementptr inbounds [100100 x i32], ptr @t, i64 0, i64 %66
  %68 = invoke noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) %67)
          to label %69 unwind label %95

69:                                               ; preds = %64
  %70 = load i32, ptr %7, align 4, !tbaa !8
  %71 = sext i32 %70 to i64
  %72 = getelementptr inbounds [100100 x i32], ptr @x, i64 0, i64 %71
  %73 = invoke noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %68, ptr noundef nonnull align 4 dereferenceable(4) %72)
          to label %74 unwind label %95

74:                                               ; preds = %69
  %75 = load i32, ptr %7, align 4, !tbaa !8
  %76 = sext i32 %75 to i64
  %77 = getelementptr inbounds [100100 x i32], ptr @y, i64 0, i64 %76
  %78 = invoke noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %73, ptr noundef nonnull align 4 dereferenceable(4) %77)
          to label %79 unwind label %95

79:                                               ; preds = %74
  %80 = load i32, ptr %7, align 4, !tbaa !8
  %81 = sext i32 %80 to i64
  %82 = getelementptr inbounds [100100 x i32], ptr @t, i64 0, i64 %81
  %83 = load i32, ptr %82, align 4, !tbaa !8
  %84 = icmp eq i32 %83, 1
  br i1 %84, label %85, label %99

85:                                               ; preds = %79
  %86 = load i32, ptr %7, align 4, !tbaa !8
  %87 = sext i32 %86 to i64
  %88 = getelementptr inbounds [100100 x i32], ptr @y, i64 0, i64 %87
  %89 = invoke { ptr, i8 } @_ZNSt3setIiSt4lessIiESaIiEE6insertERKi(ptr noundef nonnull align 8 dereferenceable(48) %2, ptr noundef nonnull align 4 dereferenceable(4) %88)
          to label %90 unwind label %95

90:                                               ; preds = %85
  %91 = getelementptr inbounds { ptr, i8 }, ptr %8, i32 0, i32 0
  %92 = extractvalue { ptr, i8 } %89, 0
  store ptr %92, ptr %91, align 8
  %93 = getelementptr inbounds { ptr, i8 }, ptr %8, i32 0, i32 1
  %94 = extractvalue { ptr, i8 } %89, 1
  store i8 %94, ptr %93, align 8
  br label %112

95:                                               ; preds = %105, %85, %74, %69, %64
  %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 %7) #9
  br label %254

99:                                               ; preds = %79
  %100 = load i32, ptr %7, align 4, !tbaa !8
  %101 = sext i32 %100 to i64
  %102 = getelementptr inbounds [100100 x i32], ptr @t, i64 0, i64 %101
  %103 = load i32, ptr %102, align 4, !tbaa !8
  %104 = icmp eq i32 %103, 3
  br i1 %104, label %105, label %111

105:                                              ; preds = %99
  %106 = load i32, ptr %7, align 4, !tbaa !8
  %107 = sext i32 %106 to i64
  %108 = getelementptr inbounds [100100 x i32], ptr @ww, i64 0, i64 %107
  %109 = invoke noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) %108)
          to label %110 unwind label %95

110:                                              ; preds = %105
  br label %111

111:                                              ; preds = %110, %99
  br label %112

112:                                              ; preds = %111, %90
  br label %113

113:                                              ; preds = %112
  %114 = load i32, ptr %7, align 4, !tbaa !8
  %115 = add nsw i32 %114, 1
  store i32 %115, ptr %7, align 4, !tbaa !8
  br label %59, !llvm.loop !13

116:                                              ; preds = %63
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #9
  store i32 0, ptr %9, align 4, !tbaa !8
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #9
  %117 = call ptr @_ZNKSt3setIiSt4lessIiESaIiEE5beginEv(ptr noundef nonnull align 8 dereferenceable(48) %2) #9
  %118 = getelementptr inbounds %"struct.std::_Rb_tree_const_iterator", ptr %10, i32 0, i32 0
  store ptr %117, ptr %118, align 8
  br label %119

119:                                              ; preds = %136, %116
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #9
  %120 = call ptr @_ZNKSt3setIiSt4lessIiESaIiEE3endEv(ptr noundef nonnull align 8 dereferenceable(48) %2) #9
  %121 = getelementptr inbounds %"struct.std::_Rb_tree_const_iterator", ptr %11, i32 0, i32 0
  store ptr %120, ptr %121, align 8
  %122 = call noundef zeroext i1 @_ZStneRKSt23_Rb_tree_const_iteratorIiES2_(ptr noundef nonnull align 8 dereferenceable(8) %10, ptr noundef nonnull align 8 dereferenceable(8) %11) #9
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #9
  br i1 %122, label %124, label %123

123:                                              ; preds = %119
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #9
  br label %138

124:                                              ; preds = %119
  %125 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNKSt23_Rb_tree_const_iteratorIiEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %10) #9
  %126 = load i32, ptr %125, align 4, !tbaa !8
  %127 = load i32, ptr %9, align 4, !tbaa !8
  %128 = sext i32 %127 to i64
  %129 = getelementptr inbounds [10 x i32], ptr @_ZN5Treap4poswE, i64 0, i64 %128
  store i32 %126, ptr %129, align 4, !tbaa !8
  %130 = load i32, ptr %9, align 4, !tbaa !8
  %131 = add nsw i32 %130, 1
  store i32 %131, ptr %9, align 4, !tbaa !8
  %132 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNKSt23_Rb_tree_const_iteratorIiEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %10) #9
  %133 = load i32, ptr %132, align 4, !tbaa !8
  %134 = sext i32 %133 to i64
  %135 = getelementptr inbounds [100100 x i32], ptr @_ZN5Treap4wposE, i64 0, i64 %134
  store i32 %130, ptr %135, align 4, !tbaa !8
  br label %136

136:                                              ; preds = %124
  %137 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt23_Rb_tree_const_iteratorIiEppEv(ptr noundef nonnull align 8 dereferenceable(8) %10) #9
  br label %119, !llvm.loop !14

138:                                              ; preds = %123
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #9
  %139 = invoke noalias noundef nonnull ptr @_Znwm(i64 noundef 64) #10
          to label %140 unwind label %148

140:                                              ; preds = %138
  %141 = load i32, ptr getelementptr inbounds ([100100 x i32], ptr @w, i64 0, i64 1), align 4, !tbaa !8
  invoke void @_ZN5Treap4nodeC2Ei(ptr noundef nonnull align 8 dereferenceable(60) %139, i32 noundef %141)
          to label %142 unwind label %152

142:                                              ; preds = %140
  store ptr %139, ptr %12, align 8, !tbaa !15
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #9
  store i32 2, ptr %13, align 4, !tbaa !8
  br label %143

143:                                              ; preds = %168, %142
  %144 = load i32, ptr %13, align 4, !tbaa !8
  %145 = load i32, ptr @n, align 4, !tbaa !8
  %146 = icmp sle i32 %144, %145
  br i1 %146, label %156, label %147

147:                                              ; preds = %143
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #9
  br label %180

148:                                              ; preds = %138
  %149 = landingpad { ptr, i32 }
          cleanup
  %150 = extractvalue { ptr, i32 } %149, 0
  store ptr %150, ptr %4, align 8
  %151 = extractvalue { ptr, i32 } %149, 1
  store i32 %151, ptr %5, align 4
  br label %253

152:                                              ; preds = %140
  %153 = landingpad { ptr, i32 }
          cleanup
  %154 = extractvalue { ptr, i32 } %153, 0
  store ptr %154, ptr %4, align 8
  %155 = extractvalue { ptr, i32 } %153, 1
  store i32 %155, ptr %5, align 4
  call void @_ZdlPvm(ptr noundef %139, i64 noundef 64) #11
  br label %253

156:                                              ; preds = %143
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #9
  %157 = invoke noalias noundef nonnull ptr @_Znwm(i64 noundef 64) #10
          to label %158 unwind label %171

158:                                              ; preds = %156
  %159 = load i32, ptr %13, align 4, !tbaa !8
  %160 = sext i32 %159 to i64
  %161 = getelementptr inbounds [100100 x i32], ptr @w, i64 0, i64 %160
  %162 = load i32, ptr %161, align 4, !tbaa !8
  invoke void @_ZN5Treap4nodeC2Ei(ptr noundef nonnull align 8 dereferenceable(60) %157, i32 noundef %162)
          to label %163 unwind label %175

163:                                              ; preds = %158
  store ptr %157, ptr %14, align 8, !tbaa !15
  %164 = load ptr, ptr %12, align 8, !tbaa !15
  %165 = load ptr, ptr %14, align 8, !tbaa !15
  %166 = invoke noundef ptr @_ZN5Treap5mergeEPNS_4nodeES1_(ptr noundef %164, ptr noundef %165)
          to label %167 unwind label %171

167:                                              ; preds = %163
  store ptr %166, ptr %12, align 8, !tbaa !15
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #9
  br label %168

168:                                              ; preds = %167
  %169 = load i32, ptr %13, align 4, !tbaa !8
  %170 = add nsw i32 %169, 1
  store i32 %170, ptr %13, align 4, !tbaa !8
  br label %143, !llvm.loop !17

171:                                              ; preds = %163, %156
  %172 = landingpad { ptr, i32 }
          cleanup
  %173 = extractvalue { ptr, i32 } %172, 0
  store ptr %173, ptr %4, align 8
  %174 = extractvalue { ptr, i32 } %172, 1
  store i32 %174, ptr %5, align 4
  br label %179

175:                                              ; preds = %158
  %176 = landingpad { ptr, i32 }
          cleanup
  %177 = extractvalue { ptr, i32 } %176, 0
  store ptr %177, ptr %4, align 8
  %178 = extractvalue { ptr, i32 } %176, 1
  store i32 %178, ptr %5, align 4
  call void @_ZdlPvm(ptr noundef %157, i64 noundef 64) #11
  br label %179

179:                                              ; preds = %175, %171
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #9
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #9
  br label %253

180:                                              ; preds = %147
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #9
  store i32 1, ptr %15, align 4, !tbaa !8
  br label %181

181:                                              ; preds = %248, %180
  %182 = load i32, ptr %15, align 4, !tbaa !8
  %183 = load i32, ptr @q, align 4, !tbaa !8
  %184 = icmp sle i32 %182, %183
  br i1 %184, label %186, label %185

185:                                              ; preds = %181
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #9
  br label %251

186:                                              ; preds = %181
  %187 = load i32, ptr %15, align 4, !tbaa !8
  %188 = sext i32 %187 to i64
  %189 = getelementptr inbounds [100100 x i32], ptr @t, i64 0, i64 %188
  %190 = load i32, ptr %189, align 4, !tbaa !8
  %191 = icmp eq i32 %190, 1
  br i1 %191, label %192, label %208

192:                                              ; preds = %186
  %193 = load ptr, ptr %12, align 8, !tbaa !15
  %194 = load i32, ptr %15, align 4, !tbaa !8
  %195 = sext i32 %194 to i64
  %196 = getelementptr inbounds [100100 x i32], ptr @x, i64 0, i64 %195
  %197 = load i32, ptr %196, align 4, !tbaa !8
  %198 = load i32, ptr %15, align 4, !tbaa !8
  %199 = sext i32 %198 to i64
  %200 = getelementptr inbounds [100100 x i32], ptr @y, i64 0, i64 %199
  %201 = load i32, ptr %200, align 4, !tbaa !8
  %202 = invoke noundef i32 @_ZN5Treap12point_updateEPNS_4nodeEii(ptr noundef %193, i32 noundef %197, i32 noundef %201)
          to label %203 unwind label %204

203:                                              ; preds = %192
  br label %247

204:                                              ; preds = %242, %239, %224, %214, %192
  %205 = landingpad { ptr, i32 }
          cleanup
  %206 = extractvalue { ptr, i32 } %205, 0
  store ptr %206, ptr %4, align 8
  %207 = extractvalue { ptr, i32 } %205, 1
  store i32 %207, ptr %5, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #9
  br label %253

208:                                              ; preds = %186
  %209 = load i32, ptr %15, align 4, !tbaa !8
  %210 = sext i32 %209 to i64
  %211 = getelementptr inbounds [100100 x i32], ptr @t, i64 0, i64 %210
  %212 = load i32, ptr %211, align 4, !tbaa !8
  %213 = icmp eq i32 %212, 2
  br i1 %213, label %214, label %224

214:                                              ; preds = %208
  %215 = load i32, ptr %15, align 4, !tbaa !8
  %216 = sext i32 %215 to i64
  %217 = getelementptr inbounds [100100 x i32], ptr @x, i64 0, i64 %216
  %218 = load i32, ptr %217, align 4, !tbaa !8
  %219 = load i32, ptr %15, align 4, !tbaa !8
  %220 = sext i32 %219 to i64
  %221 = getelementptr inbounds [100100 x i32], ptr @y, i64 0, i64 %220
  %222 = load i32, ptr %221, align 4, !tbaa !8
  invoke void @_ZN5Treap12range_updateERPNS_4nodeEii(ptr noundef nonnull align 8 dereferenceable(8) %12, i32 noundef %218, i32 noundef %222)
          to label %223 unwind label %204

223:                                              ; preds = %214
  br label %246

224:                                              ; preds = %208
  %225 = load i32, ptr %15, align 4, !tbaa !8
  %226 = sext i32 %225 to i64
  %227 = getelementptr inbounds [100100 x i32], ptr @x, i64 0, i64 %226
  %228 = load i32, ptr %227, align 4, !tbaa !8
  %229 = load i32, ptr %15, align 4, !tbaa !8
  %230 = sext i32 %229 to i64
  %231 = getelementptr inbounds [100100 x i32], ptr @y, i64 0, i64 %230
  %232 = load i32, ptr %231, align 4, !tbaa !8
  %233 = load i32, ptr %15, align 4, !tbaa !8
  %234 = sext i32 %233 to i64
  %235 = getelementptr inbounds [100100 x i32], ptr @ww, i64 0, i64 %234
  %236 = load i32, ptr %235, align 4, !tbaa !8
  %237 = invoke noundef zeroext i1 @_ZN5Treap11range_queryERPNS_4nodeEiii(ptr noundef nonnull align 8 dereferenceable(8) %12, i32 noundef %228, i32 noundef %232, i32 noundef %236)
          to label %238 unwind label %204

238:                                              ; preds = %224
  br i1 %237, label %239, label %242

239:                                              ; preds = %238
  %240 = 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 %241 unwind label %204

241:                                              ; preds = %239
  br label %245

242:                                              ; preds = %238
  %243 = 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 %244 unwind label %204

244:                                              ; preds = %242
  br label %245

245:                                              ; preds = %244, %241
  br label %246

246:                                              ; preds = %245, %223
  br label %247

247:                                              ; preds = %246, %203
  br label %248

248:                                              ; preds = %247
  %249 = load i32, ptr %15, align 4, !tbaa !8
  %250 = add nsw i32 %249, 1
  store i32 %250, ptr %15, align 4, !tbaa !8
  br label %181, !llvm.loop !18

251:                                              ; preds = %185
  store i32 0, ptr %1, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #9
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #9
  call void @_ZNSt3setIiSt4lessIiESaIiEED2Ev(ptr noundef nonnull align 8 dereferenceable(48) %2) #9
  call void @llvm.lifetime.end.p0(i64 48, ptr %2) #9
  %252 = load i32, ptr %1, align 4
  ret i32 %252

253:                                              ; preds = %204, %179, %152, %148
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #9
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #9
  br label %254

254:                                              ; preds = %253, %95, %54
  call void @_ZNSt3setIiSt4lessIiESaIiEED2Ev(ptr noundef nonnull align 8 dereferenceable(48) %2) #9
  call void @llvm.lifetime.end.p0(i64 48, ptr %2) #9
  br label %255

255:                                              ; preds = %254
  %256 = load ptr, ptr %4, align 8
  %257 = load i32, ptr %5, align 4
  %258 = insertvalue { ptr, i32 } poison, ptr %256, 0
  %259 = insertvalue { ptr, i32 } %258, i32 %257, 1
  resume { ptr, i32 } %259
}

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

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

; Function Attrs: nounwind
declare void @srand(i32 noundef) #5

; Function Attrs: nounwind
declare i64 @time(ptr noundef) #5

declare noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 4 dereferenceable(4)) #3

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

declare i32 @__gxx_personality_v0(...)

; Function Attrs: mustprogress uwtable
declare dso_local { ptr, i8 } @_ZNSt3setIiSt4lessIiESaIiEE6insertERKi(ptr noundef nonnull align 8 dereferenceable(48), ptr noundef nonnull align 4 dereferenceable(4)) #1 align 2

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

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

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

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

; Function Attrs: nobuiltin allocsize(0)
declare noundef nonnull ptr @_Znwm(i64 noundef) #6

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

; Function Attrs: nobuiltin nounwind
declare void @_ZdlPvm(ptr noundef, i64 noundef) #7

; 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) #8

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

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #2 = { 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 #3 = { "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 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 #5 = { 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 #6 = { nobuiltin allocsize(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 #7 = { nobuiltin 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 #8 = { 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 #9 = { nounwind }
attributes #10 = { builtin allocsize(0) }
attributes #11 = { builtin 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 = !{!"int", !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 = !{!"any pointer", !10, i64 0}
!17 = distinct !{!17, !12}
!18 = distinct !{!18, !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::set" = 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 }

@_ZN5Treap4wposE = external dso_local local_unnamed_addr global [100100 x i32], align 16
@_ZN5Treap4poswE = external dso_local local_unnamed_addr global [10 x i32], align 16
@n = external dso_local global i32, align 4
@q = external dso_local global i32, align 4
@w = external dso_local global [100100 x i32], align 16
@t = external dso_local global [100100 x i32], align 16
@x = external dso_local global [100100 x i32], align 16
@y = external dso_local global [100100 x i32], align 16
@ww = external dso_local global [100100 x i32], 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 [5 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [4 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

; Function Attrs: mustprogress uwtable
declare dso_local noundef ptr @_ZN5Treap5mergeEPNS_4nodeES1_(ptr noundef, ptr noundef) local_unnamed_addr #1

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

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

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

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #2 personality ptr @__gxx_personality_v0 {
  %1 = alloca %"class.std::set", align 8
  %2 = alloca %"struct.std::_Rb_tree_const_iterator", align 8
  %3 = alloca %"struct.std::_Rb_tree_const_iterator", align 8
  %4 = alloca ptr, align 8
  %5 = tail call noundef zeroext i1 @_ZNSt8ios_base15sync_with_stdioEb(i1 noundef zeroext false)
  %6 = load ptr, ptr @_ZSt3cin, align 8, !tbaa !5
  %7 = getelementptr i8, ptr %6, i64 -24
  %8 = load i64, ptr %7, align 8
  %9 = getelementptr inbounds i8, ptr @_ZSt3cin, i64 %8
  %10 = tail call noundef ptr @_ZNSt9basic_iosIcSt11char_traitsIcEE3tieEPSo(ptr noundef nonnull align 8 dereferenceable(264) %9, ptr noundef null)
  %11 = load ptr, ptr @_ZSt4cout, align 8, !tbaa !5
  %12 = getelementptr i8, ptr %11, i64 -24
  %13 = load i64, ptr %12, align 8
  %14 = getelementptr inbounds i8, ptr @_ZSt4cout, i64 %13
  %15 = tail call noundef ptr @_ZNSt9basic_iosIcSt11char_traitsIcEE3tieEPSo(ptr noundef nonnull align 8 dereferenceable(264) %14, ptr noundef null)
  %16 = tail call i64 @time(ptr noundef null) #9
  %17 = trunc i64 %16 to i32
  tail call void @srand(i32 noundef %17) #9
  %18 = tail call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) @n)
  %19 = tail call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %18, ptr noundef nonnull align 4 dereferenceable(4) @q)
  call void @llvm.lifetime.start.p0(i64 48, ptr nonnull %1) #9
  call void @_ZNSt3setIiSt4lessIiESaIiEEC2Ev(ptr noundef nonnull align 8 dereferenceable(48) %1) #9
  %20 = load i32, ptr @n, align 4, !tbaa !8
  %.not52 = icmp slt i32 %20, 1
  br i1 %.not52, label %.preheader51, label %.lr.ph

.preheader51:                                     ; preds = %26, %0
  %21 = load i32, ptr @q, align 4, !tbaa !8
  %.not4454 = icmp slt i32 %21, 1
  br i1 %.not4454, label %._crit_edge, label %.lr.ph56

.lr.ph:                                           ; preds = %0, %26
  %indvars.iv = phi i64 [ %indvars.iv.next, %26 ], [ 1, %0 ]
  %22 = getelementptr inbounds [100100 x i32], ptr @w, i64 0, i64 %indvars.iv
  %23 = invoke noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) %22)
          to label %24 unwind label %29

24:                                               ; preds = %.lr.ph
  %25 = invoke { ptr, i8 } @_ZNSt3setIiSt4lessIiESaIiEE6insertERKi(ptr noundef nonnull align 8 dereferenceable(48) %1, ptr noundef nonnull align 4 dereferenceable(4) %22)
          to label %26 unwind label %29

26:                                               ; preds = %24
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %27 = load i32, ptr @n, align 4, !tbaa !8
  %28 = sext i32 %27 to i64
  %.not.not = icmp slt i64 %indvars.iv, %28
  br i1 %.not.not, label %.lr.ph, label %.preheader51, !llvm.loop !11

29:                                               ; preds = %24, %.lr.ph
  %30 = landingpad { ptr, i32 }
          cleanup
  br label %118

._crit_edge:                                      ; preds = %51, %.preheader51
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %2) #9
  %31 = call ptr @_ZNKSt3setIiSt4lessIiESaIiEE5beginEv(ptr noundef nonnull align 8 dereferenceable(48) %1) #9
  store ptr %31, ptr %2, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %3) #9
  %32 = call ptr @_ZNKSt3setIiSt4lessIiESaIiEE3endEv(ptr noundef nonnull align 8 dereferenceable(48) %1) #9
  store ptr %32, ptr %3, align 8
  %33 = call noundef zeroext i1 @_ZStneRKSt23_Rb_tree_const_iteratorIiES2_(ptr noundef nonnull align 8 dereferenceable(8) %2, ptr noundef nonnull align 8 dereferenceable(8) %3) #9
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %3) #9
  br i1 %33, label %.lr.ph59, label %._crit_edge60

.lr.ph56:                                         ; preds = %.preheader51, %51
  %indvars.iv71 = phi i64 [ %indvars.iv.next72, %51 ], [ 1, %.preheader51 ]
  %34 = getelementptr inbounds [100100 x i32], ptr @t, i64 0, i64 %indvars.iv71
  %35 = invoke noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) %34)
          to label %36 unwind label %46

36:                                               ; preds = %.lr.ph56
  %37 = getelementptr inbounds [100100 x i32], ptr @x, i64 0, i64 %indvars.iv71
  %38 = invoke noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %35, ptr noundef nonnull align 4 dereferenceable(4) %37)
          to label %39 unwind label %46

39:                                               ; preds = %36
  %40 = getelementptr inbounds [100100 x i32], ptr @y, i64 0, i64 %indvars.iv71
  %41 = invoke noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %38, ptr noundef nonnull align 4 dereferenceable(4) %40)
          to label %42 unwind label %46

42:                                               ; preds = %39
  %43 = load i32, ptr %34, align 4, !tbaa !8
  switch i32 %43, label %51 [
    i32 1, label %44
    i32 3, label %48
  ]

44:                                               ; preds = %42
  %45 = invoke { ptr, i8 } @_ZNSt3setIiSt4lessIiESaIiEE6insertERKi(ptr noundef nonnull align 8 dereferenceable(48) %1, ptr noundef nonnull align 4 dereferenceable(4) %40)
          to label %51 unwind label %46

46:                                               ; preds = %48, %44, %39, %36, %.lr.ph56
  %47 = landingpad { ptr, i32 }
          cleanup
  br label %118

48:                                               ; preds = %42
  %49 = getelementptr inbounds [100100 x i32], ptr @ww, i64 0, i64 %indvars.iv71
  %50 = invoke noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) %49)
          to label %51 unwind label %46

51:                                               ; preds = %42, %44, %48
  %indvars.iv.next72 = add nuw nsw i64 %indvars.iv71, 1
  %52 = load i32, ptr @q, align 4, !tbaa !8
  %53 = sext i32 %52 to i64
  %.not44.not = icmp slt i64 %indvars.iv71, %53
  br i1 %.not44.not, label %.lr.ph56, label %._crit_edge, !llvm.loop !13

._crit_edge60:                                    ; preds = %.lr.ph59, %._crit_edge
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %2) #9
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %4) #9
  %54 = invoke noalias noundef nonnull dereferenceable(64) ptr @_Znwm(i64 noundef 64) #10
          to label %66 unwind label %71

.lr.ph59:                                         ; preds = %._crit_edge, %.lr.ph59
  %indvars.iv74 = phi i64 [ %indvars.iv.next75, %.lr.ph59 ], [ 0, %._crit_edge ]
  %55 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNKSt23_Rb_tree_const_iteratorIiEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %2) #9
  %56 = load i32, ptr %55, align 4, !tbaa !8
  %57 = getelementptr inbounds [10 x i32], ptr @_ZN5Treap4poswE, i64 0, i64 %indvars.iv74
  store i32 %56, ptr %57, align 4, !tbaa !8
  %indvars.iv.next75 = add nuw nsw i64 %indvars.iv74, 1
  %58 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNKSt23_Rb_tree_const_iteratorIiEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %2) #9
  %59 = load i32, ptr %58, align 4, !tbaa !8
  %60 = sext i32 %59 to i64
  %61 = getelementptr inbounds [100100 x i32], ptr @_ZN5Treap4wposE, i64 0, i64 %60
  %62 = trunc nuw nsw i64 %indvars.iv74 to i32
  store i32 %62, ptr %61, align 4, !tbaa !8
  %63 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt23_Rb_tree_const_iteratorIiEppEv(ptr noundef nonnull align 8 dereferenceable(8) %2) #9
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %3) #9
  %64 = call ptr @_ZNKSt3setIiSt4lessIiESaIiEE3endEv(ptr noundef nonnull align 8 dereferenceable(48) %1) #9
  store ptr %64, ptr %3, align 8
  %65 = call noundef zeroext i1 @_ZStneRKSt23_Rb_tree_const_iteratorIiES2_(ptr noundef nonnull align 8 dereferenceable(8) %2, ptr noundef nonnull align 8 dereferenceable(8) %3) #9
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %3) #9
  br i1 %65, label %.lr.ph59, label %._crit_edge60, !llvm.loop !14

66:                                               ; preds = %._crit_edge60
  %67 = load i32, ptr getelementptr inbounds (i8, ptr @w, i64 4), align 4, !tbaa !8
  invoke void @_ZN5Treap4nodeC2Ei(ptr noundef nonnull align 8 dereferenceable(60) %54, i32 noundef %67)
          to label %68 unwind label %73

68:                                               ; preds = %66
  store ptr %54, ptr %4, align 8, !tbaa !15
  %69 = load i32, ptr @n, align 4, !tbaa !8
  %.not4561 = icmp slt i32 %69, 2
  br i1 %.not4561, label %.preheader, label %.lr.ph64

.preheader:                                       ; preds = %82, %68
  %70 = load i32, ptr @q, align 4, !tbaa !8
  %.not4665 = icmp slt i32 %70, 1
  br i1 %.not4665, label %._crit_edge68, label %.lr.ph67

71:                                               ; preds = %._crit_edge60
  %72 = landingpad { ptr, i32 }
          cleanup
  br label %117

73:                                               ; preds = %66
  %74 = landingpad { ptr, i32 }
          cleanup
  call void @_ZdlPvm(ptr noundef nonnull %54, i64 noundef 64) #11
  br label %117

.lr.ph64:                                         ; preds = %68, %82
  %75 = phi ptr [ %81, %82 ], [ %54, %68 ]
  %indvars.iv77 = phi i64 [ %indvars.iv.next78, %82 ], [ 2, %68 ]
  %76 = invoke noalias noundef nonnull dereferenceable(64) ptr @_Znwm(i64 noundef 64) #10
          to label %77 unwind label %85

77:                                               ; preds = %.lr.ph64
  %78 = getelementptr inbounds [100100 x i32], ptr @w, i64 0, i64 %indvars.iv77
  %79 = load i32, ptr %78, align 4, !tbaa !8
  invoke void @_ZN5Treap4nodeC2Ei(ptr noundef nonnull align 8 dereferenceable(60) %76, i32 noundef %79)
          to label %80 unwind label %87

80:                                               ; preds = %77
  %81 = invoke noundef ptr @_ZN5Treap5mergeEPNS_4nodeES1_(ptr noundef %75, ptr noundef nonnull %76)
          to label %82 unwind label %85

82:                                               ; preds = %80
  store ptr %81, ptr %4, align 8, !tbaa !15
  %indvars.iv.next78 = add nuw nsw i64 %indvars.iv77, 1
  %83 = load i32, ptr @n, align 4, !tbaa !8
  %84 = sext i32 %83 to i64
  %.not45.not = icmp slt i64 %indvars.iv77, %84
  br i1 %.not45.not, label %.lr.ph64, label %.preheader, !llvm.loop !17

85:                                               ; preds = %80, %.lr.ph64
  %86 = landingpad { ptr, i32 }
          cleanup
  br label %117

87:                                               ; preds = %77
  %88 = landingpad { ptr, i32 }
          cleanup
  call void @_ZdlPvm(ptr noundef nonnull %76, i64 noundef 64) #11
  br label %117

._crit_edge68:                                    ; preds = %114, %.preheader
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #9
  call void @_ZNSt3setIiSt4lessIiESaIiEED2Ev(ptr noundef nonnull align 8 dereferenceable(48) %1) #9
  call void @llvm.lifetime.end.p0(i64 48, ptr nonnull %1) #9
  ret i32 0

.lr.ph67:                                         ; preds = %.preheader, %114
  %indvars.iv80 = phi i64 [ %indvars.iv.next81, %114 ], [ 1, %.preheader ]
  %89 = getelementptr inbounds [100100 x i32], ptr @t, i64 0, i64 %indvars.iv80
  %90 = load i32, ptr %89, align 4, !tbaa !8
  switch i32 %90, label %105 [
    i32 1, label %91
    i32 2, label %100
  ]

91:                                               ; preds = %.lr.ph67
  %92 = load ptr, ptr %4, align 8, !tbaa !15
  %93 = getelementptr inbounds [100100 x i32], ptr @x, i64 0, i64 %indvars.iv80
  %94 = load i32, ptr %93, align 4, !tbaa !8
  %95 = getelementptr inbounds [100100 x i32], ptr @y, i64 0, i64 %indvars.iv80
  %96 = load i32, ptr %95, align 4, !tbaa !8
  %97 = invoke noundef i32 @_ZN5Treap12point_updateEPNS_4nodeEii(ptr noundef %92, i32 noundef %94, i32 noundef %96)
          to label %114 unwind label %98

98:                                               ; preds = %.invoke, %105, %100, %91
  %99 = landingpad { ptr, i32 }
          cleanup
  br label %117

100:                                              ; preds = %.lr.ph67
  %101 = getelementptr inbounds [100100 x i32], ptr @x, i64 0, i64 %indvars.iv80
  %102 = load i32, ptr %101, align 4, !tbaa !8
  %103 = getelementptr inbounds [100100 x i32], ptr @y, i64 0, i64 %indvars.iv80
  %104 = load i32, ptr %103, align 4, !tbaa !8
  invoke void @_ZN5Treap12range_updateERPNS_4nodeEii(ptr noundef nonnull align 8 dereferenceable(8) %4, i32 noundef %102, i32 noundef %104)
          to label %114 unwind label %98

105:                                              ; preds = %.lr.ph67
  %106 = getelementptr inbounds [100100 x i32], ptr @x, i64 0, i64 %indvars.iv80
  %107 = load i32, ptr %106, align 4, !tbaa !8
  %108 = getelementptr inbounds [100100 x i32], ptr @y, i64 0, i64 %indvars.iv80
  %109 = load i32, ptr %108, align 4, !tbaa !8
  %110 = getelementptr inbounds [100100 x i32], ptr @ww, i64 0, i64 %indvars.iv80
  %111 = load i32, ptr %110, align 4, !tbaa !8
  %112 = invoke noundef zeroext i1 @_ZN5Treap11range_queryERPNS_4nodeEiii(ptr noundef nonnull align 8 dereferenceable(8) %4, i32 noundef %107, i32 noundef %109, i32 noundef %111)
          to label %.invoke unwind label %98

.invoke:                                          ; preds = %105
  %.str..str.1 = select i1 %112, ptr @.str, ptr @.str.1
  %113 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, ptr noundef nonnull %.str..str.1)
          to label %114 unwind label %98

114:                                              ; preds = %.invoke, %91, %100
  %indvars.iv.next81 = add nuw nsw i64 %indvars.iv80, 1
  %115 = load i32, ptr @q, align 4, !tbaa !8
  %116 = sext i32 %115 to i64
  %.not46.not = icmp slt i64 %indvars.iv80, %116
  br i1 %.not46.not, label %.lr.ph67, label %._crit_edge68, !llvm.loop !18

117:                                              ; preds = %85, %87, %98, %73, %71
  %.pn.pn = phi { ptr, i32 } [ %99, %98 ], [ %74, %73 ], [ %72, %71 ], [ %86, %85 ], [ %88, %87 ]
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #9
  br label %118

118:                                              ; preds = %117, %46, %29
  %.pn49 = phi { ptr, i32 } [ %30, %29 ], [ %47, %46 ], [ %.pn.pn, %117 ]
  call void @_ZNSt3setIiSt4lessIiESaIiEED2Ev(ptr noundef nonnull align 8 dereferenceable(48) %1) #9
  call void @llvm.lifetime.end.p0(i64 48, ptr nonnull %1) #9
  resume { ptr, i32 } %.pn49
}

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

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

; Function Attrs: nounwind
declare void @srand(i32 noundef) local_unnamed_addr #5

; Function Attrs: nounwind
declare i64 @time(ptr noundef) local_unnamed_addr #5

declare noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 4 dereferenceable(4)) local_unnamed_addr #3

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

declare i32 @__gxx_personality_v0(...)

; Function Attrs: mustprogress uwtable
declare dso_local { ptr, i8 } @_ZNSt3setIiSt4lessIiESaIiEE6insertERKi(ptr noundef nonnull align 8 dereferenceable(48), ptr noundef nonnull align 4 dereferenceable(4)) local_unnamed_addr #1 align 2

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZStneRKSt23_Rb_tree_const_iteratorIiES2_(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(8)) local_unnamed_addr #4

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

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

; Function Attrs: nobuiltin allocsize(0)
declare noundef nonnull ptr @_Znwm(i64 noundef) local_unnamed_addr #6

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

; Function Attrs: nobuiltin nounwind
declare void @_ZdlPvm(ptr noundef, i64 noundef) local_unnamed_addr #7

; 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 #8

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

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #2 = { 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 #3 = { "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 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 #5 = { 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 #6 = { nobuiltin allocsize(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 #7 = { nobuiltin 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 #8 = { 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 #9 = { nounwind }
attributes #10 = { builtin allocsize(0) }
attributes #11 = { builtin 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 = !{!"int", !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 = !{!"any pointer", !10, i64 0}
!17 = distinct !{!17, !12}
!18 = distinct !{!18, !12}


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