; LLVM IR from lzyrapx/Competitive-Programming :: Retired_code/CDQ Divide and Conquer (BZOJ 1935 (强行cdq分治) (二维偏序))

; 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.Query = type { i32, 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" }

@k = external dso_local global i32, align 4
@q = external dso_local global [2525000 x %struct.Query], align 16
@ans = external dso_local global [505000 x i32], align 16
@_ZSt3cin = external global %"class.std::basic_istream", align 8
@_ZSt4cout = external global %"class.std::basic_ostream", align 8

; 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 void @_Z3cdqii(i32 noundef, i32 noundef) #1

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main(i32 noundef %0, ptr noundef %1) #2 {
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca ptr, align 8
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  %12 = alloca i32, align 4
  %13 = alloca i32, align 4
  %14 = alloca i32, align 4
  %15 = alloca i32, align 4
  %16 = alloca i32, align 4
  %17 = alloca i32, align 4
  %18 = alloca i32, align 4
  store i32 0, ptr %3, align 4
  store i32 %0, ptr %4, align 4, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #6
  store i32 0, ptr %8, align 4, !tbaa !5
  %19 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) %6)
  %20 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %19, ptr noundef nonnull align 4 dereferenceable(4) %7)
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #6
  store i32 1, ptr %9, align 4, !tbaa !5
  br label %21

21:                                               ; preds = %46, %2
  %22 = load i32, ptr %9, align 4, !tbaa !5
  %23 = load i32, ptr %6, align 4, !tbaa !5
  %24 = icmp sle i32 %22, %23
  br i1 %24, label %26, label %25

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

26:                                               ; preds = %21
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #6
  %27 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) %10)
  %28 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %27, ptr noundef nonnull align 4 dereferenceable(4) %11)
  %29 = load i32, ptr %10, align 4, !tbaa !5
  %30 = add nsw i32 %29, 1
  %31 = load i32, ptr %8, align 4, !tbaa !5
  %32 = add nsw i32 %31, 1
  store i32 %32, ptr %8, align 4, !tbaa !5
  %33 = sext i32 %32 to i64
  %34 = getelementptr inbounds [2525000 x %struct.Query], ptr @q, i64 0, i64 %33
  %35 = getelementptr inbounds %struct.Query, ptr %34, i32 0, i32 1
  store i32 %30, ptr %35, align 4, !tbaa !11
  %36 = load i32, ptr %11, align 4, !tbaa !5
  %37 = add nsw i32 %36, 1
  %38 = load i32, ptr %8, align 4, !tbaa !5
  %39 = sext i32 %38 to i64
  %40 = getelementptr inbounds [2525000 x %struct.Query], ptr @q, i64 0, i64 %39
  %41 = getelementptr inbounds %struct.Query, ptr %40, i32 0, i32 2
  store i32 %37, ptr %41, align 4, !tbaa !13
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #6
  %42 = load i32, ptr %11, align 4, !tbaa !5
  %43 = add nsw i32 %42, 1
  store i32 %43, ptr %12, align 4, !tbaa !5
  %44 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) @k, ptr noundef nonnull align 4 dereferenceable(4) %12)
  %45 = load i32, ptr %44, align 4, !tbaa !5
  store i32 %45, ptr @k, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #6
  br label %46

46:                                               ; preds = %26
  %47 = load i32, ptr %9, align 4, !tbaa !5
  %48 = add nsw i32 %47, 1
  store i32 %48, ptr %9, align 4, !tbaa !5
  br label %21, !llvm.loop !14

49:                                               ; preds = %25
  %50 = load i32, ptr @k, align 4, !tbaa !5
  %51 = add nsw i32 %50, 1
  store i32 %51, ptr @k, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %17) #6
  store i32 1, ptr %17, align 4, !tbaa !5
  br label %52

52:                                               ; preds = %170, %49
  %53 = load i32, ptr %17, align 4, !tbaa !5
  %54 = load i32, ptr %7, align 4, !tbaa !5
  %55 = icmp sle i32 %53, %54
  br i1 %55, label %57, label %56

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

57:                                               ; preds = %52
  %58 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) %13)
  %59 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %58, ptr noundef nonnull align 4 dereferenceable(4) %14)
  %60 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %59, ptr noundef nonnull align 4 dereferenceable(4) %15)
  %61 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %60, ptr noundef nonnull align 4 dereferenceable(4) %16)
  %62 = load i32, ptr %13, align 4, !tbaa !5
  %63 = add nsw i32 %62, 1
  store i32 %63, ptr %13, align 4, !tbaa !5
  %64 = load i32, ptr %14, align 4, !tbaa !5
  %65 = add nsw i32 %64, 1
  store i32 %65, ptr %14, align 4, !tbaa !5
  %66 = load i32, ptr %15, align 4, !tbaa !5
  %67 = add nsw i32 %66, 1
  store i32 %67, ptr %15, align 4, !tbaa !5
  %68 = load i32, ptr %16, align 4, !tbaa !5
  %69 = add nsw i32 %68, 1
  store i32 %69, ptr %16, align 4, !tbaa !5
  %70 = load i32, ptr %13, align 4, !tbaa !5
  %71 = sub nsw i32 %70, 1
  %72 = load i32, ptr %8, align 4, !tbaa !5
  %73 = add nsw i32 %72, 1
  store i32 %73, ptr %8, align 4, !tbaa !5
  %74 = sext i32 %73 to i64
  %75 = getelementptr inbounds [2525000 x %struct.Query], ptr @q, i64 0, i64 %74
  %76 = getelementptr inbounds %struct.Query, ptr %75, i32 0, i32 1
  store i32 %71, ptr %76, align 4, !tbaa !11
  %77 = load i32, ptr %14, align 4, !tbaa !5
  %78 = sub nsw i32 %77, 1
  %79 = load i32, ptr %8, align 4, !tbaa !5
  %80 = sext i32 %79 to i64
  %81 = getelementptr inbounds [2525000 x %struct.Query], ptr @q, i64 0, i64 %80
  %82 = getelementptr inbounds %struct.Query, ptr %81, i32 0, i32 2
  store i32 %78, ptr %82, align 4, !tbaa !13
  %83 = load i32, ptr %8, align 4, !tbaa !5
  %84 = sext i32 %83 to i64
  %85 = getelementptr inbounds [2525000 x %struct.Query], ptr @q, i64 0, i64 %84
  %86 = getelementptr inbounds %struct.Query, ptr %85, i32 0, i32 3
  store i32 1, ptr %86, align 4, !tbaa !16
  %87 = load i32, ptr %8, align 4, !tbaa !5
  %88 = sext i32 %87 to i64
  %89 = getelementptr inbounds [2525000 x %struct.Query], ptr @q, i64 0, i64 %88
  %90 = getelementptr inbounds %struct.Query, ptr %89, i32 0, i32 0
  store i32 1, ptr %90, align 4, !tbaa !17
  %91 = load i32, ptr %17, align 4, !tbaa !5
  %92 = load i32, ptr %8, align 4, !tbaa !5
  %93 = sext i32 %92 to i64
  %94 = getelementptr inbounds [2525000 x %struct.Query], ptr @q, i64 0, i64 %93
  %95 = getelementptr inbounds %struct.Query, ptr %94, i32 0, i32 4
  store i32 %91, ptr %95, align 4, !tbaa !18
  %96 = load i32, ptr %13, align 4, !tbaa !5
  %97 = sub nsw i32 %96, 1
  %98 = load i32, ptr %8, align 4, !tbaa !5
  %99 = add nsw i32 %98, 1
  store i32 %99, ptr %8, align 4, !tbaa !5
  %100 = sext i32 %99 to i64
  %101 = getelementptr inbounds [2525000 x %struct.Query], ptr @q, i64 0, i64 %100
  %102 = getelementptr inbounds %struct.Query, ptr %101, i32 0, i32 1
  store i32 %97, ptr %102, align 4, !tbaa !11
  %103 = load i32, ptr %16, align 4, !tbaa !5
  %104 = load i32, ptr %8, align 4, !tbaa !5
  %105 = sext i32 %104 to i64
  %106 = getelementptr inbounds [2525000 x %struct.Query], ptr @q, i64 0, i64 %105
  %107 = getelementptr inbounds %struct.Query, ptr %106, i32 0, i32 2
  store i32 %103, ptr %107, align 4, !tbaa !13
  %108 = load i32, ptr %8, align 4, !tbaa !5
  %109 = sext i32 %108 to i64
  %110 = getelementptr inbounds [2525000 x %struct.Query], ptr @q, i64 0, i64 %109
  %111 = getelementptr inbounds %struct.Query, ptr %110, i32 0, i32 3
  store i32 -1, ptr %111, align 4, !tbaa !16
  %112 = load i32, ptr %8, align 4, !tbaa !5
  %113 = sext i32 %112 to i64
  %114 = getelementptr inbounds [2525000 x %struct.Query], ptr @q, i64 0, i64 %113
  %115 = getelementptr inbounds %struct.Query, ptr %114, i32 0, i32 0
  store i32 1, ptr %115, align 4, !tbaa !17
  %116 = load i32, ptr %17, align 4, !tbaa !5
  %117 = load i32, ptr %8, align 4, !tbaa !5
  %118 = sext i32 %117 to i64
  %119 = getelementptr inbounds [2525000 x %struct.Query], ptr @q, i64 0, i64 %118
  %120 = getelementptr inbounds %struct.Query, ptr %119, i32 0, i32 4
  store i32 %116, ptr %120, align 4, !tbaa !18
  %121 = load i32, ptr %15, align 4, !tbaa !5
  %122 = load i32, ptr %8, align 4, !tbaa !5
  %123 = add nsw i32 %122, 1
  store i32 %123, ptr %8, align 4, !tbaa !5
  %124 = sext i32 %123 to i64
  %125 = getelementptr inbounds [2525000 x %struct.Query], ptr @q, i64 0, i64 %124
  %126 = getelementptr inbounds %struct.Query, ptr %125, i32 0, i32 1
  store i32 %121, ptr %126, align 4, !tbaa !11
  %127 = load i32, ptr %14, align 4, !tbaa !5
  %128 = sub nsw i32 %127, 1
  %129 = load i32, ptr %8, align 4, !tbaa !5
  %130 = sext i32 %129 to i64
  %131 = getelementptr inbounds [2525000 x %struct.Query], ptr @q, i64 0, i64 %130
  %132 = getelementptr inbounds %struct.Query, ptr %131, i32 0, i32 2
  store i32 %128, ptr %132, align 4, !tbaa !13
  %133 = load i32, ptr %8, align 4, !tbaa !5
  %134 = sext i32 %133 to i64
  %135 = getelementptr inbounds [2525000 x %struct.Query], ptr @q, i64 0, i64 %134
  %136 = getelementptr inbounds %struct.Query, ptr %135, i32 0, i32 3
  store i32 -1, ptr %136, align 4, !tbaa !16
  %137 = load i32, ptr %8, align 4, !tbaa !5
  %138 = sext i32 %137 to i64
  %139 = getelementptr inbounds [2525000 x %struct.Query], ptr @q, i64 0, i64 %138
  %140 = getelementptr inbounds %struct.Query, ptr %139, i32 0, i32 0
  store i32 1, ptr %140, align 4, !tbaa !17
  %141 = load i32, ptr %17, align 4, !tbaa !5
  %142 = load i32, ptr %8, align 4, !tbaa !5
  %143 = sext i32 %142 to i64
  %144 = getelementptr inbounds [2525000 x %struct.Query], ptr @q, i64 0, i64 %143
  %145 = getelementptr inbounds %struct.Query, ptr %144, i32 0, i32 4
  store i32 %141, ptr %145, align 4, !tbaa !18
  %146 = load i32, ptr %15, align 4, !tbaa !5
  %147 = load i32, ptr %8, align 4, !tbaa !5
  %148 = add nsw i32 %147, 1
  store i32 %148, ptr %8, align 4, !tbaa !5
  %149 = sext i32 %148 to i64
  %150 = getelementptr inbounds [2525000 x %struct.Query], ptr @q, i64 0, i64 %149
  %151 = getelementptr inbounds %struct.Query, ptr %150, i32 0, i32 1
  store i32 %146, ptr %151, align 4, !tbaa !11
  %152 = load i32, ptr %16, align 4, !tbaa !5
  %153 = load i32, ptr %8, align 4, !tbaa !5
  %154 = sext i32 %153 to i64
  %155 = getelementptr inbounds [2525000 x %struct.Query], ptr @q, i64 0, i64 %154
  %156 = getelementptr inbounds %struct.Query, ptr %155, i32 0, i32 2
  store i32 %152, ptr %156, align 4, !tbaa !13
  %157 = load i32, ptr %8, align 4, !tbaa !5
  %158 = sext i32 %157 to i64
  %159 = getelementptr inbounds [2525000 x %struct.Query], ptr @q, i64 0, i64 %158
  %160 = getelementptr inbounds %struct.Query, ptr %159, i32 0, i32 3
  store i32 1, ptr %160, align 4, !tbaa !16
  %161 = load i32, ptr %8, align 4, !tbaa !5
  %162 = sext i32 %161 to i64
  %163 = getelementptr inbounds [2525000 x %struct.Query], ptr @q, i64 0, i64 %162
  %164 = getelementptr inbounds %struct.Query, ptr %163, i32 0, i32 0
  store i32 1, ptr %164, align 4, !tbaa !17
  %165 = load i32, ptr %17, align 4, !tbaa !5
  %166 = load i32, ptr %8, align 4, !tbaa !5
  %167 = sext i32 %166 to i64
  %168 = getelementptr inbounds [2525000 x %struct.Query], ptr @q, i64 0, i64 %167
  %169 = getelementptr inbounds %struct.Query, ptr %168, i32 0, i32 4
  store i32 %165, ptr %169, align 4, !tbaa !18
  br label %170

170:                                              ; preds = %57
  %171 = load i32, ptr %17, align 4, !tbaa !5
  %172 = add nsw i32 %171, 1
  store i32 %172, ptr %17, align 4, !tbaa !5
  br label %52, !llvm.loop !19

173:                                              ; preds = %56
  %174 = load i32, ptr %8, align 4, !tbaa !5
  call void @_Z3cdqii(i32 noundef 1, i32 noundef %174)
  call void @llvm.lifetime.start.p0(i64 4, ptr %18) #6
  store i32 1, ptr %18, align 4, !tbaa !5
  br label %175

175:                                              ; preds = %187, %173
  %176 = load i32, ptr %18, align 4, !tbaa !5
  %177 = load i32, ptr %7, align 4, !tbaa !5
  %178 = icmp sle i32 %176, %177
  br i1 %178, label %180, label %179

179:                                              ; preds = %175
  call void @llvm.lifetime.end.p0(i64 4, ptr %18) #6
  br label %190

180:                                              ; preds = %175
  %181 = load i32, ptr %18, align 4, !tbaa !5
  %182 = sext i32 %181 to i64
  %183 = getelementptr inbounds [505000 x i32], ptr @ans, i64 0, i64 %182
  %184 = load i32, ptr %183, align 4, !tbaa !5
  %185 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i32 noundef %184)
  %186 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c(ptr noundef nonnull align 8 dereferenceable(8) %185, i8 noundef signext 10)
  br label %187

187:                                              ; preds = %180
  %188 = load i32, ptr %18, align 4, !tbaa !5
  %189 = add nsw i32 %188, 1
  store i32 %189, ptr %18, align 4, !tbaa !5
  br label %175, !llvm.loop !20

190:                                              ; preds = %179
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #6
  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)) #3

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

; 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

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

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 = { 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 #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 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"any pointer", !7, i64 0}
!11 = !{!12, !6, i64 4}
!12 = !{!"_ZTS5Query", !6, i64 0, !6, i64 4, !6, i64 8, !6, i64 12, !6, i64 16}
!13 = !{!12, !6, i64 8}
!14 = distinct !{!14, !15}
!15 = !{!"llvm.loop.mustprogress"}
!16 = !{!12, !6, i64 12}
!17 = !{!12, !6, i64 0}
!18 = !{!12, !6, i64 16}
!19 = distinct !{!19, !15}
!20 = distinct !{!20, !15}


; 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.Query = type { i32, 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" }

@k = external dso_local global i32, align 4
@q = external dso_local local_unnamed_addr global [2525000 x %struct.Query], align 16
@ans = external dso_local local_unnamed_addr global [505000 x i32], align 16
@_ZSt3cin = external global %"class.std::basic_istream", align 8
@_ZSt4cout = external global %"class.std::basic_ostream", align 8

; 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 void @_Z3cdqii(i32 noundef, i32 noundef) local_unnamed_addr #1

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main(i32 noundef %0, ptr nocapture noundef readnone %1) local_unnamed_addr #2 {
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %3) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %4) #6
  %12 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) %3)
  %13 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %12, ptr noundef nonnull align 4 dereferenceable(4) %4)
  %14 = load i32, ptr %3, align 4, !tbaa !5
  %.not39 = icmp slt i32 %14, 1
  br i1 %.not39, label %.._crit_edge_crit_edge, label %.lr.ph

.._crit_edge_crit_edge:                           ; preds = %2
  %.pre = load i32, ptr @k, align 4, !tbaa !5
  br label %._crit_edge

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

._crit_edge:                                      ; preds = %.._crit_edge_crit_edge, %._crit_edge.loopexit
  %16 = phi i32 [ %.pre, %.._crit_edge_crit_edge ], [ %30, %._crit_edge.loopexit ]
  %.036.lcssa = phi i32 [ 0, %.._crit_edge_crit_edge ], [ %15, %._crit_edge.loopexit ]
  %17 = add nsw i32 %16, 1
  store i32 %17, ptr @k, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %8) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %9) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %10) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %11) #6
  %18 = load i32, ptr %4, align 4, !tbaa !5
  %.not3742 = icmp slt i32 %18, 1
  br i1 %.not3742, label %._crit_edge47, label %.lr.ph46.preheader

.lr.ph46.preheader:                               ; preds = %._crit_edge
  %19 = zext nneg i32 %.036.lcssa to i64
  br label %.lr.ph46

.lr.ph:                                           ; preds = %2, %.lr.ph
  %indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph ], [ 0, %2 ]
  %.03541 = phi i32 [ %31, %.lr.ph ], [ 1, %2 ]
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %5) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %6) #6
  %20 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) %5)
  %21 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %20, ptr noundef nonnull align 4 dereferenceable(4) %6)
  %22 = load i32, ptr %5, align 4, !tbaa !5
  %23 = add nsw i32 %22, 1
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %24 = getelementptr inbounds [2525000 x %struct.Query], ptr @q, i64 0, i64 %indvars.iv.next
  %25 = getelementptr inbounds i8, ptr %24, i64 4
  store i32 %23, ptr %25, align 4, !tbaa !9
  %26 = load i32, ptr %6, align 4, !tbaa !5
  %27 = add nsw i32 %26, 1
  %28 = getelementptr inbounds i8, ptr %24, i64 8
  store i32 %27, ptr %28, align 4, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %7) #6
  store i32 %27, ptr %7, align 4, !tbaa !5
  %29 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) @k, ptr noundef nonnull align 4 dereferenceable(4) %7)
  %30 = load i32, ptr %29, align 4, !tbaa !5
  store i32 %30, ptr @k, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %7) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %6) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %5) #6
  %31 = add nuw nsw i32 %.03541, 1
  %32 = load i32, ptr %3, align 4, !tbaa !5
  %.not.not = icmp slt i32 %.03541, %32
  br i1 %.not.not, label %.lr.ph, label %._crit_edge.loopexit, !llvm.loop !12

._crit_edge47.loopexit:                           ; preds = %.lr.ph46
  %33 = trunc nuw i64 %indvars.iv.next57 to i32
  br label %._crit_edge47

._crit_edge47:                                    ; preds = %._crit_edge47.loopexit, %._crit_edge
  %.1.lcssa = phi i32 [ %.036.lcssa, %._crit_edge ], [ %33, %._crit_edge47.loopexit ]
  call void @_Z3cdqii(i32 noundef 1, i32 noundef %.1.lcssa)
  %34 = load i32, ptr %4, align 4, !tbaa !5
  %.not3849 = icmp slt i32 %34, 1
  br i1 %.not3849, label %._crit_edge53, label %.lr.ph52

.lr.ph46:                                         ; preds = %.lr.ph46.preheader, %.lr.ph46
  %indvars.iv56 = phi i64 [ %19, %.lr.ph46.preheader ], [ %indvars.iv.next57, %.lr.ph46 ]
  %.03444 = phi i32 [ 1, %.lr.ph46.preheader ], [ %70, %.lr.ph46 ]
  %35 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) %8)
  %36 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %35, ptr noundef nonnull align 4 dereferenceable(4) %9)
  %37 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %36, ptr noundef nonnull align 4 dereferenceable(4) %10)
  %38 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %37, ptr noundef nonnull align 4 dereferenceable(4) %11)
  %39 = load i32, ptr %8, align 4, !tbaa !5
  %40 = add nsw i32 %39, 1
  store i32 %40, ptr %8, align 4, !tbaa !5
  %41 = load i32, ptr %9, align 4, !tbaa !5
  %42 = add nsw i32 %41, 1
  store i32 %42, ptr %9, align 4, !tbaa !5
  %43 = load i32, ptr %10, align 4, !tbaa !5
  %44 = add nsw i32 %43, 1
  store i32 %44, ptr %10, align 4, !tbaa !5
  %45 = load i32, ptr %11, align 4, !tbaa !5
  %46 = add nsw i32 %45, 1
  store i32 %46, ptr %11, align 4, !tbaa !5
  %47 = add nuw nsw i64 %indvars.iv56, 1
  %48 = getelementptr inbounds [2525000 x %struct.Query], ptr @q, i64 0, i64 %47
  %49 = getelementptr inbounds i8, ptr %48, i64 4
  store i32 %39, ptr %49, align 4, !tbaa !9
  %50 = getelementptr inbounds i8, ptr %48, i64 8
  store i32 %41, ptr %50, align 4, !tbaa !11
  %51 = getelementptr inbounds i8, ptr %48, i64 12
  store i32 1, ptr %51, align 4, !tbaa !14
  store i32 1, ptr %48, align 4, !tbaa !15
  %52 = getelementptr inbounds i8, ptr %48, i64 16
  store i32 %.03444, ptr %52, align 4, !tbaa !16
  %53 = add nuw nsw i64 %indvars.iv56, 2
  %54 = getelementptr inbounds [2525000 x %struct.Query], ptr @q, i64 0, i64 %53
  %55 = getelementptr inbounds i8, ptr %54, i64 4
  store i32 %39, ptr %55, align 4, !tbaa !9
  %56 = getelementptr inbounds i8, ptr %54, i64 8
  store i32 %46, ptr %56, align 4, !tbaa !11
  %57 = getelementptr inbounds i8, ptr %54, i64 12
  store i32 -1, ptr %57, align 4, !tbaa !14
  store i32 1, ptr %54, align 4, !tbaa !15
  %58 = getelementptr inbounds i8, ptr %54, i64 16
  store i32 %.03444, ptr %58, align 4, !tbaa !16
  %59 = add nuw nsw i64 %indvars.iv56, 3
  %60 = getelementptr inbounds [2525000 x %struct.Query], ptr @q, i64 0, i64 %59
  %61 = getelementptr inbounds i8, ptr %60, i64 4
  store i32 %44, ptr %61, align 4, !tbaa !9
  %62 = getelementptr inbounds i8, ptr %60, i64 8
  store i32 %41, ptr %62, align 4, !tbaa !11
  %63 = getelementptr inbounds i8, ptr %60, i64 12
  store i32 -1, ptr %63, align 4, !tbaa !14
  store i32 1, ptr %60, align 4, !tbaa !15
  %64 = getelementptr inbounds i8, ptr %60, i64 16
  store i32 %.03444, ptr %64, align 4, !tbaa !16
  %indvars.iv.next57 = add nuw nsw i64 %indvars.iv56, 4
  %65 = getelementptr inbounds [2525000 x %struct.Query], ptr @q, i64 0, i64 %indvars.iv.next57
  %66 = getelementptr inbounds i8, ptr %65, i64 4
  store i32 %44, ptr %66, align 4, !tbaa !9
  %67 = getelementptr inbounds i8, ptr %65, i64 8
  store i32 %46, ptr %67, align 4, !tbaa !11
  %68 = getelementptr inbounds i8, ptr %65, i64 12
  store i32 1, ptr %68, align 4, !tbaa !14
  store i32 1, ptr %65, align 4, !tbaa !15
  %69 = getelementptr inbounds i8, ptr %65, i64 16
  store i32 %.03444, ptr %69, align 4, !tbaa !16
  %70 = add nuw nsw i32 %.03444, 1
  %71 = load i32, ptr %4, align 4, !tbaa !5
  %.not37.not = icmp slt i32 %.03444, %71
  br i1 %.not37.not, label %.lr.ph46, label %._crit_edge47.loopexit, !llvm.loop !17

._crit_edge53:                                    ; preds = %.lr.ph52, %._crit_edge47
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %11) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %10) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %9) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %8) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %4) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %3) #6
  ret i32 0

.lr.ph52:                                         ; preds = %._crit_edge47, %.lr.ph52
  %indvars.iv59 = phi i64 [ %indvars.iv.next60, %.lr.ph52 ], [ 1, %._crit_edge47 ]
  %72 = getelementptr inbounds [505000 x i32], ptr @ans, i64 0, i64 %indvars.iv59
  %73 = load i32, ptr %72, align 4, !tbaa !5
  %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 @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c(ptr noundef nonnull align 8 dereferenceable(8) %74, i8 noundef signext 10)
  %indvars.iv.next60 = add nuw nsw i64 %indvars.iv59, 1
  %76 = load i32, ptr %4, align 4, !tbaa !5
  %77 = sext i32 %76 to i64
  %.not38.not = icmp slt i64 %indvars.iv59, %77
  br i1 %.not38.not, label %.lr.ph52, label %._crit_edge53, !llvm.loop !18
}

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

; 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

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

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 = { 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 #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 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !6, i64 4}
!10 = !{!"_ZTS5Query", !6, i64 0, !6, i64 4, !6, i64 8, !6, i64 12, !6, i64 16}
!11 = !{!10, !6, i64 8}
!12 = distinct !{!12, !13}
!13 = !{!"llvm.loop.mustprogress"}
!14 = !{!10, !6, i64 12}
!15 = !{!10, !6, i64 0}
!16 = !{!10, !6, i64 16}
!17 = distinct !{!17, !13}
!18 = distinct !{!18, !13}


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