; LLVM IR from upupming/algorithm :: acwing/算法竞赛进阶指南/0x43-线段树/248. 窗内的星星 (main)

; Unoptimized IR (clang -disable-llvm-passes):
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

%struct.Segment = type { i64, i64, i64, i32 }
%struct.SegmentTree = type { i32, i32, i32, i32 }
%"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" }

@seg = external dso_local global [20020 x %struct.Segment], align 16
@raw = external dso_local global [20020 x i32], align 16
@tree = external dso_local global [80080 x %struct.SegmentTree], align 16
@n = external dso_local global i32, align 4
@w = external dso_local global i32, align 4
@h = external dso_local global i32, align 4
@x = external dso_local global i64, align 8
@y = external dso_local global i64, align 8
@c = external dso_local global i64, align 8
@_ZSt3cin = external global %"class.std::basic_istream", align 8
@_ZSt4cout = external global %"class.std::basic_ostream", align 8

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z5buildiii(i32 noundef, i32 noundef, i32 noundef) #0

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

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

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z6changeiiii(i32 noundef, i32 noundef, i32 noundef, i32 noundef) #0

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() #3 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  store i32 0, ptr %1, align 4
  br label %7

7:                                                ; preds = %201, %0
  %8 = 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)
  %9 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %8, ptr noundef nonnull align 4 dereferenceable(4) @w)
  %10 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %9, ptr noundef nonnull align 4 dereferenceable(4) @h)
  %11 = load ptr, ptr %10, align 8, !tbaa !5
  %12 = getelementptr i8, ptr %11, i64 -24
  %13 = load i64, ptr %12, align 8
  %14 = getelementptr inbounds i8, ptr %10, i64 %13
  %15 = call noundef zeroext i1 @_ZNKSt9basic_iosIcSt11char_traitsIcEEcvbEv(ptr noundef nonnull align 8 dereferenceable(264) %14)
  br i1 %15, label %16, label %205

16:                                               ; preds = %7
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #6
  store i32 1, ptr %2, align 4, !tbaa !8
  br label %17

17:                                               ; preds = %106, %16
  %18 = load i32, ptr %2, align 4, !tbaa !8
  %19 = load i32, ptr @n, align 4, !tbaa !8
  %20 = icmp sle i32 %18, %19
  br i1 %20, label %22, label %21

21:                                               ; preds = %17
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #6
  br label %109

22:                                               ; preds = %17
  %23 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) @x)
  %24 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) %23, ptr noundef nonnull align 8 dereferenceable(8) @y)
  %25 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) %24, ptr noundef nonnull align 8 dereferenceable(8) @c)
  %26 = load i64, ptr @x, align 8, !tbaa !11
  %27 = load i32, ptr %2, align 4, !tbaa !8
  %28 = mul nsw i32 2, %27
  %29 = sub nsw i32 %28, 1
  %30 = sext i32 %29 to i64
  %31 = getelementptr inbounds [20020 x %struct.Segment], ptr @seg, i64 0, i64 %30
  %32 = getelementptr inbounds %struct.Segment, ptr %31, i32 0, i32 0
  store i64 %26, ptr %32, align 16, !tbaa !13
  %33 = load i64, ptr @y, align 8, !tbaa !11
  %34 = load i32, ptr %2, align 4, !tbaa !8
  %35 = mul nsw i32 2, %34
  %36 = sub nsw i32 %35, 1
  %37 = sext i32 %36 to i64
  %38 = getelementptr inbounds [20020 x %struct.Segment], ptr @seg, i64 0, i64 %37
  %39 = getelementptr inbounds %struct.Segment, ptr %38, i32 0, i32 1
  store i64 %33, ptr %39, align 8, !tbaa !15
  %40 = load i64, ptr @y, align 8, !tbaa !11
  %41 = load i32, ptr @h, align 4, !tbaa !8
  %42 = sext i32 %41 to i64
  %43 = add nsw i64 %40, %42
  %44 = load i32, ptr %2, align 4, !tbaa !8
  %45 = mul nsw i32 2, %44
  %46 = sub nsw i32 %45, 1
  %47 = sext i32 %46 to i64
  %48 = getelementptr inbounds [20020 x %struct.Segment], ptr @seg, i64 0, i64 %47
  %49 = getelementptr inbounds %struct.Segment, ptr %48, i32 0, i32 2
  store i64 %43, ptr %49, align 16, !tbaa !16
  %50 = load i64, ptr @c, align 8, !tbaa !11
  %51 = trunc i64 %50 to i32
  %52 = load i32, ptr %2, align 4, !tbaa !8
  %53 = mul nsw i32 2, %52
  %54 = sub nsw i32 %53, 1
  %55 = sext i32 %54 to i64
  %56 = getelementptr inbounds [20020 x %struct.Segment], ptr @seg, i64 0, i64 %55
  %57 = getelementptr inbounds %struct.Segment, ptr %56, i32 0, i32 3
  store i32 %51, ptr %57, align 8, !tbaa !17
  %58 = load i64, ptr @x, align 8, !tbaa !11
  %59 = load i32, ptr @w, align 4, !tbaa !8
  %60 = sext i32 %59 to i64
  %61 = add nsw i64 %58, %60
  %62 = load i32, ptr %2, align 4, !tbaa !8
  %63 = mul nsw i32 2, %62
  %64 = sext i32 %63 to i64
  %65 = getelementptr inbounds [20020 x %struct.Segment], ptr @seg, i64 0, i64 %64
  %66 = getelementptr inbounds %struct.Segment, ptr %65, i32 0, i32 0
  store i64 %61, ptr %66, align 16, !tbaa !13
  %67 = load i64, ptr @y, align 8, !tbaa !11
  %68 = load i32, ptr %2, align 4, !tbaa !8
  %69 = mul nsw i32 2, %68
  %70 = sext i32 %69 to i64
  %71 = getelementptr inbounds [20020 x %struct.Segment], ptr @seg, i64 0, i64 %70
  %72 = getelementptr inbounds %struct.Segment, ptr %71, i32 0, i32 1
  store i64 %67, ptr %72, align 8, !tbaa !15
  %73 = load i64, ptr @y, align 8, !tbaa !11
  %74 = load i32, ptr @h, align 4, !tbaa !8
  %75 = sext i32 %74 to i64
  %76 = add nsw i64 %73, %75
  %77 = load i32, ptr %2, align 4, !tbaa !8
  %78 = mul nsw i32 2, %77
  %79 = sext i32 %78 to i64
  %80 = getelementptr inbounds [20020 x %struct.Segment], ptr @seg, i64 0, i64 %79
  %81 = getelementptr inbounds %struct.Segment, ptr %80, i32 0, i32 2
  store i64 %76, ptr %81, align 16, !tbaa !16
  %82 = load i64, ptr @c, align 8, !tbaa !11
  %83 = sub nsw i64 0, %82
  %84 = trunc i64 %83 to i32
  %85 = load i32, ptr %2, align 4, !tbaa !8
  %86 = mul nsw i32 2, %85
  %87 = sext i32 %86 to i64
  %88 = getelementptr inbounds [20020 x %struct.Segment], ptr @seg, i64 0, i64 %87
  %89 = getelementptr inbounds %struct.Segment, ptr %88, i32 0, i32 3
  store i32 %84, ptr %89, align 8, !tbaa !17
  %90 = load i64, ptr @y, align 8, !tbaa !11
  %91 = trunc i64 %90 to i32
  %92 = load i32, ptr %2, align 4, !tbaa !8
  %93 = mul nsw i32 2, %92
  %94 = sub nsw i32 %93, 1
  %95 = sext i32 %94 to i64
  %96 = getelementptr inbounds [20020 x i32], ptr @raw, i64 0, i64 %95
  store i32 %91, ptr %96, align 4, !tbaa !8
  %97 = load i64, ptr @y, align 8, !tbaa !11
  %98 = load i32, ptr @h, align 4, !tbaa !8
  %99 = sext i32 %98 to i64
  %100 = add nsw i64 %97, %99
  %101 = trunc i64 %100 to i32
  %102 = load i32, ptr %2, align 4, !tbaa !8
  %103 = mul nsw i32 2, %102
  %104 = sext i32 %103 to i64
  %105 = getelementptr inbounds [20020 x i32], ptr @raw, i64 0, i64 %104
  store i32 %101, ptr %105, align 4, !tbaa !8
  br label %106

106:                                              ; preds = %22
  %107 = load i32, ptr %2, align 4, !tbaa !8
  %108 = add nsw i32 %107, 1
  store i32 %108, ptr %2, align 4, !tbaa !8
  br label %17, !llvm.loop !18

109:                                              ; preds = %21
  %110 = load i32, ptr @n, align 4, !tbaa !8
  %111 = mul nsw i32 2, %110
  %112 = sext i32 %111 to i64
  %113 = getelementptr inbounds i32, ptr getelementptr inbounds (i32, ptr @raw, i64 1), i64 %112
  call void @_ZSt4sortIPiEvT_S1_(ptr noundef getelementptr inbounds (i32, ptr @raw, i64 1), ptr noundef %113)
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #6
  %114 = load i32, ptr @n, align 4, !tbaa !8
  %115 = mul nsw i32 2, %114
  %116 = sext i32 %115 to i64
  %117 = getelementptr inbounds i32, ptr getelementptr inbounds (i32, ptr @raw, i64 1), i64 %116
  %118 = call noundef ptr @_ZSt6uniqueIPiET_S1_S1_(ptr noundef getelementptr inbounds (i32, ptr @raw, i64 1), ptr noundef %117)
  %119 = ptrtoint ptr %118 to i64
  %120 = sub i64 %119, ptrtoint (ptr getelementptr inbounds (i32, ptr @raw, i64 1) to i64)
  %121 = sdiv exact i64 %120, 4
  %122 = trunc i64 %121 to i32
  store i32 %122, ptr %3, align 4, !tbaa !8
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #6
  store i32 1, ptr %4, align 4, !tbaa !8
  br label %123

123:                                              ; preds = %162, %109
  %124 = load i32, ptr %4, align 4, !tbaa !8
  %125 = load i32, ptr @n, align 4, !tbaa !8
  %126 = mul nsw i32 2, %125
  %127 = icmp sle i32 %124, %126
  br i1 %127, label %129, label %128

128:                                              ; preds = %123
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #6
  br label %165

129:                                              ; preds = %123
  %130 = load i32, ptr %3, align 4, !tbaa !8
  %131 = sext i32 %130 to i64
  %132 = getelementptr inbounds i32, ptr @raw, i64 %131
  %133 = getelementptr inbounds i32, ptr %132, i64 1
  %134 = load i32, ptr %4, align 4, !tbaa !8
  %135 = sext i32 %134 to i64
  %136 = getelementptr inbounds [20020 x %struct.Segment], ptr @seg, i64 0, i64 %135
  %137 = getelementptr inbounds %struct.Segment, ptr %136, i32 0, i32 1
  %138 = call noundef ptr @_ZSt11lower_boundIPixET_S1_S1_RKT0_(ptr noundef getelementptr inbounds (i32, ptr @raw, i64 1), ptr noundef %133, ptr noundef nonnull align 8 dereferenceable(8) %137)
  %139 = ptrtoint ptr %138 to i64
  %140 = sub i64 %139, ptrtoint (ptr @raw to i64)
  %141 = sdiv exact i64 %140, 4
  %142 = load i32, ptr %4, align 4, !tbaa !8
  %143 = sext i32 %142 to i64
  %144 = getelementptr inbounds [20020 x %struct.Segment], ptr @seg, i64 0, i64 %143
  %145 = getelementptr inbounds %struct.Segment, ptr %144, i32 0, i32 1
  store i64 %141, ptr %145, align 8, !tbaa !15
  %146 = load i32, ptr %3, align 4, !tbaa !8
  %147 = sext i32 %146 to i64
  %148 = getelementptr inbounds i32, ptr @raw, i64 %147
  %149 = getelementptr inbounds i32, ptr %148, i64 1
  %150 = load i32, ptr %4, align 4, !tbaa !8
  %151 = sext i32 %150 to i64
  %152 = getelementptr inbounds [20020 x %struct.Segment], ptr @seg, i64 0, i64 %151
  %153 = getelementptr inbounds %struct.Segment, ptr %152, i32 0, i32 2
  %154 = call noundef ptr @_ZSt11lower_boundIPixET_S1_S1_RKT0_(ptr noundef getelementptr inbounds (i32, ptr @raw, i64 1), ptr noundef %149, ptr noundef nonnull align 8 dereferenceable(8) %153)
  %155 = ptrtoint ptr %154 to i64
  %156 = sub i64 %155, ptrtoint (ptr @raw to i64)
  %157 = sdiv exact i64 %156, 4
  %158 = load i32, ptr %4, align 4, !tbaa !8
  %159 = sext i32 %158 to i64
  %160 = getelementptr inbounds [20020 x %struct.Segment], ptr @seg, i64 0, i64 %159
  %161 = getelementptr inbounds %struct.Segment, ptr %160, i32 0, i32 2
  store i64 %157, ptr %161, align 16, !tbaa !16
  br label %162

162:                                              ; preds = %129
  %163 = load i32, ptr %4, align 4, !tbaa !8
  %164 = add nsw i32 %163, 1
  store i32 %164, ptr %4, align 4, !tbaa !8
  br label %123, !llvm.loop !20

165:                                              ; preds = %128
  %166 = load i32, ptr @n, align 4, !tbaa !8
  %167 = mul nsw i32 2, %166
  %168 = sext i32 %167 to i64
  %169 = getelementptr inbounds %struct.Segment, ptr getelementptr inbounds (%struct.Segment, ptr @seg, i64 1), i64 %168
  call void @_ZSt4sortIP7SegmentEvT_S2_(ptr noundef getelementptr inbounds (%struct.Segment, ptr @seg, i64 1), ptr noundef %169)
  %170 = load i32, ptr %3, align 4, !tbaa !8
  call void @_Z5buildiii(i32 noundef 1, i32 noundef 1, i32 noundef %170)
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #6
  store i32 0, ptr %5, align 4, !tbaa !8
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #6
  store i32 1, ptr %6, align 4, !tbaa !8
  br label %171

171:                                              ; preds = %198, %165
  %172 = load i32, ptr %6, align 4, !tbaa !8
  %173 = load i32, ptr @n, align 4, !tbaa !8
  %174 = mul nsw i32 2, %173
  %175 = icmp sle i32 %172, %174
  br i1 %175, label %177, label %176

176:                                              ; preds = %171
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #6
  br label %201

177:                                              ; preds = %171
  %178 = load i32, ptr %6, align 4, !tbaa !8
  %179 = sext i32 %178 to i64
  %180 = getelementptr inbounds [20020 x %struct.Segment], ptr @seg, i64 0, i64 %179
  %181 = getelementptr inbounds %struct.Segment, ptr %180, i32 0, i32 1
  %182 = load i64, ptr %181, align 8, !tbaa !15
  %183 = trunc i64 %182 to i32
  %184 = load i32, ptr %6, align 4, !tbaa !8
  %185 = sext i32 %184 to i64
  %186 = getelementptr inbounds [20020 x %struct.Segment], ptr @seg, i64 0, i64 %185
  %187 = getelementptr inbounds %struct.Segment, ptr %186, i32 0, i32 2
  %188 = load i64, ptr %187, align 16, !tbaa !16
  %189 = sub nsw i64 %188, 1
  %190 = trunc i64 %189 to i32
  %191 = load i32, ptr %6, align 4, !tbaa !8
  %192 = sext i32 %191 to i64
  %193 = getelementptr inbounds [20020 x %struct.Segment], ptr @seg, i64 0, i64 %192
  %194 = getelementptr inbounds %struct.Segment, ptr %193, i32 0, i32 3
  %195 = load i32, ptr %194, align 8, !tbaa !17
  call void @_Z6changeiiii(i32 noundef 1, i32 noundef %183, i32 noundef %190, i32 noundef %195)
  %196 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %5, ptr noundef nonnull align 4 dereferenceable(4) getelementptr inbounds (%struct.SegmentTree, ptr getelementptr inbounds ([80080 x %struct.SegmentTree], ptr @tree, i64 0, i64 1), i32 0, i32 2))
  %197 = load i32, ptr %196, align 4, !tbaa !8
  store i32 %197, ptr %5, align 4, !tbaa !8
  br label %198

198:                                              ; preds = %177
  %199 = load i32, ptr %6, align 4, !tbaa !8
  %200 = add nsw i32 %199, 1
  store i32 %200, ptr %6, align 4, !tbaa !8
  br label %171, !llvm.loop !21

201:                                              ; preds = %176
  %202 = load i32, ptr %5, align 4, !tbaa !8
  %203 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i32 noundef %202)
  %204 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %203, ptr noundef @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #6
  br label %7, !llvm.loop !22

205:                                              ; preds = %7
  ret i32 0
}

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

; Function Attrs: mustprogress uwtable
declare noundef zeroext i1 @_ZNKSt9basic_iosIcSt11char_traitsIcEEcvbEv(ptr noundef nonnull align 8 dereferenceable(264)) #0 align 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)) #0 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZSt4sortIPiEvT_S1_(ptr noundef, ptr noundef) #5

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef ptr @_ZSt6uniqueIPiET_S1_S1_(ptr noundef, ptr noundef) #5

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

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZSt4sortIP7SegmentEvT_S2_(ptr noundef, ptr noundef) #5

declare noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8), i32 noundef) #4

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

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

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


; Optimized IR (opt -passes='default<O3>'):
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

%struct.Segment = type { i64, i64, i64, i32 }
%struct.SegmentTree = type { i32, i32, i32, i32 }
%"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" }

@seg = external dso_local global [20020 x %struct.Segment], align 16
@raw = external dso_local global [20020 x i32], align 16
@tree = external dso_local global [80080 x %struct.SegmentTree], align 16
@n = external dso_local global i32, align 4
@w = external dso_local global i32, align 4
@h = external dso_local global i32, align 4
@x = external dso_local global i64, align 8
@y = external dso_local global i64, align 8
@c = external dso_local global i64, align 8
@_ZSt3cin = external global %"class.std::basic_istream", align 8
@_ZSt4cout = external global %"class.std::basic_ostream", align 8

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z5buildiii(i32 noundef, i32 noundef, i32 noundef) local_unnamed_addr #0

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

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

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z6changeiiii(i32 noundef, i32 noundef, i32 noundef, i32 noundef) local_unnamed_addr #0

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #3 {
  %1 = alloca i32, align 4
  %2 = 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)
  %3 = tail call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %2, ptr noundef nonnull align 4 dereferenceable(4) @w)
  %4 = tail call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %3, ptr noundef nonnull align 4 dereferenceable(4) @h)
  %5 = load ptr, ptr %4, align 8, !tbaa !5
  %6 = getelementptr i8, ptr %5, i64 -24
  %7 = load i64, ptr %6, align 8
  %8 = getelementptr inbounds i8, ptr %4, i64 %7
  %9 = tail call noundef zeroext i1 @_ZNKSt9basic_iosIcSt11char_traitsIcEEcvbEv(ptr noundef nonnull align 8 dereferenceable(264) %8)
  br i1 %9, label %.preheader, label %._crit_edge46

.preheader:                                       ; preds = %0, %._crit_edge45
  %10 = load i32, ptr @n, align 4, !tbaa !8
  %.not33 = icmp slt i32 %10, 1
  br i1 %.not33, label %._crit_edge, label %.lr.ph

._crit_edge:                                      ; preds = %.lr.ph, %.preheader
  %.lcssa = phi i32 [ %10, %.preheader ], [ %54, %.lr.ph ]
  %11 = shl nsw i32 %.lcssa, 1
  %12 = sext i32 %11 to i64
  %13 = getelementptr inbounds i32, ptr getelementptr inbounds (i8, ptr @raw, i64 4), i64 %12
  call void @_ZSt4sortIPiEvT_S1_(ptr noundef nonnull getelementptr inbounds (i8, ptr @raw, i64 4), ptr noundef nonnull %13)
  %14 = load i32, ptr @n, align 4, !tbaa !8
  %15 = shl nsw i32 %14, 1
  %16 = sext i32 %15 to i64
  %17 = getelementptr inbounds i32, ptr getelementptr inbounds (i8, ptr @raw, i64 4), i64 %16
  %18 = call noundef ptr @_ZSt6uniqueIPiET_S1_S1_(ptr noundef nonnull getelementptr inbounds (i8, ptr @raw, i64 4), ptr noundef nonnull %17)
  %19 = ptrtoint ptr %18 to i64
  %20 = sub i64 %19, ptrtoint (ptr getelementptr inbounds (i8, ptr @raw, i64 4) to i64)
  %21 = lshr exact i64 %20, 2
  %22 = trunc i64 %21 to i32
  %23 = load i32, ptr @n, align 4, !tbaa !8
  %.not3035 = icmp slt i32 %23, 1
  br i1 %.not3035, label %._crit_edge.._crit_edge39_crit_edge, label %.lr.ph38

._crit_edge.._crit_edge39_crit_edge:              ; preds = %._crit_edge
  %24 = shl nsw i32 %23, 1
  %.pre = sext i32 %24 to i64
  br label %._crit_edge39

.lr.ph38:                                         ; preds = %._crit_edge
  %sext = shl i64 %20, 30
  %25 = ashr i64 %sext, 32
  %gep = getelementptr i32, ptr getelementptr inbounds (i8, ptr @raw, i64 4), i64 %25
  br label %58

.lr.ph:                                           ; preds = %.preheader, %.lr.ph
  %indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph ], [ 1, %.preheader ]
  %26 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) @x)
  %27 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) %26, ptr noundef nonnull align 8 dereferenceable(8) @y)
  %28 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) %27, ptr noundef nonnull align 8 dereferenceable(8) @c)
  %29 = load i64, ptr @x, align 8, !tbaa !11
  %30 = shl nuw nsw i64 %indvars.iv, 1
  %31 = add nsw i64 %30, -1
  %32 = getelementptr inbounds [20020 x %struct.Segment], ptr @seg, i64 0, i64 %31
  store i64 %29, ptr %32, align 16, !tbaa !13
  %33 = load i64, ptr @y, align 8, !tbaa !11
  %34 = getelementptr inbounds i8, ptr %32, i64 8
  store i64 %33, ptr %34, align 8, !tbaa !15
  %35 = load i32, ptr @h, align 4, !tbaa !8
  %36 = sext i32 %35 to i64
  %37 = add nsw i64 %33, %36
  %38 = getelementptr inbounds i8, ptr %32, i64 16
  store i64 %37, ptr %38, align 16, !tbaa !16
  %39 = load i64, ptr @c, align 8, !tbaa !11
  %40 = trunc i64 %39 to i32
  %41 = getelementptr inbounds i8, ptr %32, i64 24
  store i32 %40, ptr %41, align 8, !tbaa !17
  %42 = load i32, ptr @w, align 4, !tbaa !8
  %43 = sext i32 %42 to i64
  %44 = add nsw i64 %29, %43
  %45 = getelementptr inbounds [20020 x %struct.Segment], ptr @seg, i64 0, i64 %30
  store i64 %44, ptr %45, align 16, !tbaa !13
  %46 = getelementptr inbounds i8, ptr %45, i64 8
  store i64 %33, ptr %46, align 8, !tbaa !15
  %47 = getelementptr inbounds i8, ptr %45, i64 16
  store i64 %37, ptr %47, align 16, !tbaa !16
  %48 = sub i32 0, %40
  %49 = getelementptr inbounds i8, ptr %45, i64 24
  store i32 %48, ptr %49, align 8, !tbaa !17
  %50 = trunc i64 %33 to i32
  %51 = getelementptr inbounds [20020 x i32], ptr @raw, i64 0, i64 %31
  store i32 %50, ptr %51, align 4, !tbaa !8
  %52 = add i32 %35, %50
  %53 = getelementptr inbounds [20020 x i32], ptr @raw, i64 0, i64 %30
  store i32 %52, ptr %53, align 8, !tbaa !8
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %54 = load i32, ptr @n, align 4, !tbaa !8
  %55 = sext i32 %54 to i64
  %.not.not = icmp slt i64 %indvars.iv, %55
  br i1 %.not.not, label %.lr.ph, label %._crit_edge, !llvm.loop !18

._crit_edge39:                                    ; preds = %58, %._crit_edge.._crit_edge39_crit_edge
  %.pre-phi = phi i64 [ %.pre, %._crit_edge.._crit_edge39_crit_edge ], [ %72, %58 ]
  %56 = getelementptr inbounds %struct.Segment, ptr getelementptr inbounds (i8, ptr @seg, i64 32), i64 %.pre-phi
  call void @_ZSt4sortIP7SegmentEvT_S2_(ptr noundef nonnull getelementptr inbounds (i8, ptr @seg, i64 32), ptr noundef nonnull %56)
  call void @_Z5buildiii(i32 noundef 1, i32 noundef 1, i32 noundef %22)
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %1) #6
  store i32 0, ptr %1, align 4, !tbaa !8
  %57 = load i32, ptr @n, align 4, !tbaa !8
  %.not3141 = icmp slt i32 %57, 1
  br i1 %.not3141, label %._crit_edge45, label %.lr.ph44

58:                                               ; preds = %.lr.ph38, %58
  %indvars.iv50 = phi i64 [ 1, %.lr.ph38 ], [ %indvars.iv.next51, %58 ]
  %59 = getelementptr inbounds [20020 x %struct.Segment], ptr @seg, i64 0, i64 %indvars.iv50
  %60 = getelementptr inbounds i8, ptr %59, i64 8
  %61 = call noundef ptr @_ZSt11lower_boundIPixET_S1_S1_RKT0_(ptr noundef nonnull getelementptr inbounds (i8, ptr @raw, i64 4), ptr noundef nonnull %gep, ptr noundef nonnull align 8 dereferenceable(8) %60)
  %62 = ptrtoint ptr %61 to i64
  %63 = sub i64 %62, ptrtoint (ptr @raw to i64)
  %64 = ashr exact i64 %63, 2
  store i64 %64, ptr %60, align 8, !tbaa !15
  %65 = getelementptr inbounds i8, ptr %59, i64 16
  %66 = call noundef ptr @_ZSt11lower_boundIPixET_S1_S1_RKT0_(ptr noundef nonnull getelementptr inbounds (i8, ptr @raw, i64 4), ptr noundef nonnull %gep, ptr noundef nonnull align 8 dereferenceable(8) %65)
  %67 = ptrtoint ptr %66 to i64
  %68 = sub i64 %67, ptrtoint (ptr @raw to i64)
  %69 = ashr exact i64 %68, 2
  store i64 %69, ptr %65, align 16, !tbaa !16
  %indvars.iv.next51 = add nuw nsw i64 %indvars.iv50, 1
  %70 = load i32, ptr @n, align 4, !tbaa !8
  %71 = shl nsw i32 %70, 1
  %72 = sext i32 %71 to i64
  %.not30.not = icmp slt i64 %indvars.iv50, %72
  br i1 %.not30.not, label %58, label %._crit_edge39, !llvm.loop !20

._crit_edge45:                                    ; preds = %.lr.ph44, %._crit_edge39
  %73 = phi i32 [ 0, %._crit_edge39 ], [ %95, %.lr.ph44 ]
  %74 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i32 noundef %73)
  %75 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %74, ptr noundef nonnull @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #6
  %76 = 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)
  %77 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %76, ptr noundef nonnull align 4 dereferenceable(4) @w)
  %78 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %77, ptr noundef nonnull align 4 dereferenceable(4) @h)
  %79 = load ptr, ptr %78, align 8, !tbaa !5
  %80 = getelementptr i8, ptr %79, i64 -24
  %81 = load i64, ptr %80, align 8
  %82 = getelementptr inbounds i8, ptr %78, i64 %81
  %83 = call noundef zeroext i1 @_ZNKSt9basic_iosIcSt11char_traitsIcEEcvbEv(ptr noundef nonnull align 8 dereferenceable(264) %82)
  br i1 %83, label %.preheader, label %._crit_edge46, !llvm.loop !21

.lr.ph44:                                         ; preds = %._crit_edge39, %.lr.ph44
  %indvars.iv53 = phi i64 [ %indvars.iv.next54, %.lr.ph44 ], [ 1, %._crit_edge39 ]
  %84 = getelementptr inbounds [20020 x %struct.Segment], ptr @seg, i64 0, i64 %indvars.iv53
  %85 = getelementptr inbounds i8, ptr %84, i64 8
  %86 = load i64, ptr %85, align 8, !tbaa !15
  %87 = trunc i64 %86 to i32
  %88 = getelementptr inbounds i8, ptr %84, i64 16
  %89 = load i64, ptr %88, align 16, !tbaa !16
  %90 = trunc i64 %89 to i32
  %91 = add i32 %90, -1
  %92 = getelementptr inbounds i8, ptr %84, i64 24
  %93 = load i32, ptr %92, align 8, !tbaa !17
  call void @_Z6changeiiii(i32 noundef 1, i32 noundef %87, i32 noundef %91, i32 noundef %93)
  %94 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %1, ptr noundef nonnull align 4 dereferenceable(4) getelementptr inbounds (i8, ptr @tree, i64 24))
  %95 = load i32, ptr %94, align 4, !tbaa !8
  store i32 %95, ptr %1, align 4, !tbaa !8
  %indvars.iv.next54 = add nuw nsw i64 %indvars.iv53, 1
  %96 = load i32, ptr @n, align 4, !tbaa !8
  %97 = shl nsw i32 %96, 1
  %98 = sext i32 %97 to i64
  %.not31.not = icmp slt i64 %indvars.iv53, %98
  br i1 %.not31.not, label %.lr.ph44, label %._crit_edge45, !llvm.loop !22

._crit_edge46:                                    ; preds = %._crit_edge45, %0
  ret i32 0
}

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 #4

; Function Attrs: mustprogress uwtable
declare noundef zeroext i1 @_ZNKSt9basic_iosIcSt11char_traitsIcEEcvbEv(ptr noundef nonnull align 8 dereferenceable(264)) local_unnamed_addr #0 align 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 #0 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZSt4sortIPiEvT_S1_(ptr noundef, ptr noundef) local_unnamed_addr #5

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef ptr @_ZSt6uniqueIPiET_S1_S1_(ptr noundef, ptr noundef) local_unnamed_addr #5

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

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZSt4sortIP7SegmentEvT_S2_(ptr noundef, ptr noundef) local_unnamed_addr #5

declare noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8), i32 noundef) local_unnamed_addr #4

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

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

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


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