; LLVM IR from lzyrapx/Competitive-Programming :: Retired_code/CDQ Divide and Conquer (BZOJ 1176（二维偏序）)

; 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, 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" }

@q = external dso_local global [2020000 x %struct.Query], align 16
@w = external dso_local global i32, align 4
@ans = external dso_local global [2020000 x i64], align 16
@S = external dso_local global i32, align 4
@_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
  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
  %18 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) @S)
  %19 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %18, ptr noundef nonnull align 4 dereferenceable(4) @w)
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #5
  store i32 0, ptr %6, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #5
  store i32 0, ptr %7, align 4, !tbaa !5
  br label %20

20:                                               ; preds = %185, %2
  br label %21

21:                                               ; preds = %20
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #5
  %22 = 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)
  %23 = load i32, ptr %8, align 4, !tbaa !5
  %24 = icmp eq i32 %23, 1
  br i1 %24, label %25, label %50

25:                                               ; preds = %21
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #5
  %26 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) %9)
  %27 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %26, 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 %9, align 4, !tbaa !5
  %30 = load i32, ptr %6, align 4, !tbaa !5
  %31 = add nsw i32 %30, 1
  store i32 %31, ptr %6, align 4, !tbaa !5
  %32 = sext i32 %31 to i64
  %33 = getelementptr inbounds [2020000 x %struct.Query], ptr @q, i64 0, i64 %32
  %34 = getelementptr inbounds %struct.Query, ptr %33, i32 0, i32 0
  store i32 %29, ptr %34, align 8, !tbaa !11
  %35 = load i32, ptr %10, align 4, !tbaa !5
  %36 = load i32, ptr %6, align 4, !tbaa !5
  %37 = sext i32 %36 to i64
  %38 = getelementptr inbounds [2020000 x %struct.Query], ptr @q, i64 0, i64 %37
  %39 = getelementptr inbounds %struct.Query, ptr %38, i32 0, i32 1
  store i32 %35, ptr %39, align 4, !tbaa !13
  %40 = load i32, ptr %11, align 4, !tbaa !5
  %41 = load i32, ptr %6, align 4, !tbaa !5
  %42 = sext i32 %41 to i64
  %43 = getelementptr inbounds [2020000 x %struct.Query], ptr @q, i64 0, i64 %42
  %44 = getelementptr inbounds %struct.Query, ptr %43, i32 0, i32 2
  store i32 %40, ptr %44, align 8, !tbaa !14
  %45 = load i32, ptr %6, align 4, !tbaa !5
  %46 = load i32, ptr %6, align 4, !tbaa !5
  %47 = sext i32 %46 to i64
  %48 = getelementptr inbounds [2020000 x %struct.Query], ptr @q, i64 0, i64 %47
  %49 = getelementptr inbounds %struct.Query, ptr %48, i32 0, i32 4
  store i32 %45, ptr %49, align 8, !tbaa !15
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #5
  br label %182

50:                                               ; preds = %21
  %51 = load i32, ptr %8, align 4, !tbaa !5
  %52 = icmp eq i32 %51, 2
  br i1 %52, label %53, label %180

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

180:                                              ; preds = %50
  store i32 3, ptr %16, align 4
  br label %183

181:                                              ; preds = %53
  br label %182

182:                                              ; preds = %181, %25
  store i32 0, ptr %16, align 4
  br label %183

183:                                              ; preds = %182, %180
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #5
  %184 = load i32, ptr %16, align 4
  switch i32 %184, label %209 [
    i32 0, label %185
    i32 3, label %186
  ]

185:                                              ; preds = %183
  br label %20, !llvm.loop !18

186:                                              ; preds = %183
  %187 = load i32, ptr %6, align 4, !tbaa !5
  %188 = sext i32 %187 to i64
  %189 = getelementptr inbounds %struct.Query, ptr @q, i64 %188
  %190 = getelementptr inbounds %struct.Query, ptr %189, i64 1
  call void @_ZSt4sortIP5QueryEvT_S2_(ptr noundef getelementptr inbounds (%struct.Query, ptr @q, i64 1), ptr noundef %190)
  %191 = load i32, ptr %6, align 4, !tbaa !5
  call void @_Z3cdqii(i32 noundef 1, i32 noundef %191)
  call void @llvm.lifetime.start.p0(i64 4, ptr %17) #5
  store i32 1, ptr %17, align 4, !tbaa !5
  br label %192

192:                                              ; preds = %204, %186
  %193 = load i32, ptr %17, align 4, !tbaa !5
  %194 = load i32, ptr %7, align 4, !tbaa !5
  %195 = icmp sle i32 %193, %194
  br i1 %195, label %197, label %196

196:                                              ; preds = %192
  store i32 4, ptr %16, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #5
  br label %207

197:                                              ; preds = %192
  %198 = load i32, ptr %17, align 4, !tbaa !5
  %199 = sext i32 %198 to i64
  %200 = getelementptr inbounds [2020000 x i64], ptr @ans, i64 0, i64 %199
  %201 = load i64, ptr %200, align 8, !tbaa !20
  %202 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i64 noundef %201)
  %203 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c(ptr noundef nonnull align 8 dereferenceable(8) %202, i8 noundef signext 10)
  br label %204

204:                                              ; preds = %197
  %205 = load i32, ptr %17, align 4, !tbaa !5
  %206 = add nsw i32 %205, 1
  store i32 %206, ptr %17, align 4, !tbaa !5
  br label %192, !llvm.loop !22

207:                                              ; preds = %196
  store i32 0, ptr %3, align 4
  store i32 1, ptr %16, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #5
  %208 = load i32, ptr %3, align 4
  ret i32 %208

209:                                              ; preds = %183
  unreachable
}

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 uwtable
declare dso_local void @_ZSt4sortIP5QueryEvT_S2_(ptr noundef, ptr noundef) #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) #4

; Function Attrs: mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8), i64 noundef) #1 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 = { inlinehint mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { nounwind }

!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"any pointer", !7, i64 0}
!11 = !{!12, !6, i64 0}
!12 = !{!"_ZTS5Query", !6, i64 0, !6, i64 4, !6, i64 8, !6, i64 12, !6, i64 16, !6, i64 20}
!13 = !{!12, !6, i64 4}
!14 = !{!12, !6, i64 8}
!15 = !{!12, !6, i64 16}
!16 = !{!12, !6, i64 12}
!17 = !{!12, !6, i64 20}
!18 = distinct !{!18, !19}
!19 = !{!"llvm.loop.mustprogress"}
!20 = !{!21, !21, i64 0}
!21 = !{!"long long", !7, i64 0}
!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.Query = type { i32, 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" }

@q = external dso_local global [2020000 x %struct.Query], align 16
@w = external dso_local global i32, align 4
@ans = external dso_local local_unnamed_addr global [2020000 x i64], align 16
@S = external dso_local global i32, align 4
@_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 = 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) @S)
  %12 = tail call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %11, ptr noundef nonnull align 4 dereferenceable(4) @w)
  br label %13

13:                                               ; preds = %73, %2
  %.048 = phi i32 [ 0, %2 ], [ %.250, %73 ]
  %.047 = phi i32 [ 0, %2 ], [ %.2, %73 ]
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %3) #5
  %14 = 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)
  %15 = load i32, ptr %3, align 4, !tbaa !5
  switch i32 %15, label %74 [
    i32 1, label %16
    i32 2, label %29
  ]

16:                                               ; preds = %13
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %4) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %5) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %6) #5
  %17 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) %4)
  %18 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %17, ptr noundef nonnull align 4 dereferenceable(4) %5)
  %19 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %18, ptr noundef nonnull align 4 dereferenceable(4) %6)
  %20 = load i32, ptr %4, align 4, !tbaa !5
  %21 = add nsw i32 %.048, 1
  %22 = sext i32 %21 to i64
  %23 = getelementptr inbounds [2020000 x %struct.Query], ptr @q, i64 0, i64 %22
  store i32 %20, ptr %23, align 8, !tbaa !9
  %24 = load i32, ptr %5, align 4, !tbaa !5
  %25 = getelementptr inbounds i8, ptr %23, i64 4
  store i32 %24, ptr %25, align 4, !tbaa !11
  %26 = load i32, ptr %6, align 4, !tbaa !5
  %27 = getelementptr inbounds i8, ptr %23, i64 8
  store i32 %26, ptr %27, align 8, !tbaa !12
  %28 = getelementptr inbounds i8, ptr %23, i64 16
  store i32 %21, ptr %28, align 8, !tbaa !13
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %6) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %5) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %4) #5
  br label %73

29:                                               ; preds = %13
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %7) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %8) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %9) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %10) #5
  %30 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) %7)
  %31 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %30, ptr noundef nonnull align 4 dereferenceable(4) %8)
  %32 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %31, ptr noundef nonnull align 4 dereferenceable(4) %9)
  %33 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %32, ptr noundef nonnull align 4 dereferenceable(4) %10)
  %34 = add nsw i32 %.047, 1
  %35 = add nsw i32 %.048, 1
  %36 = sext i32 %35 to i64
  %37 = getelementptr inbounds [2020000 x %struct.Query], ptr @q, i64 0, i64 %36
  %38 = getelementptr inbounds i8, ptr %37, i64 12
  store i32 %34, ptr %38, align 4, !tbaa !14
  %39 = load i32, ptr %7, align 4, !tbaa !5
  %40 = add nsw i32 %39, -1
  store i32 %40, ptr %37, align 8, !tbaa !9
  %41 = load i32, ptr %8, align 4, !tbaa !5
  %42 = add nsw i32 %41, -1
  %43 = getelementptr inbounds i8, ptr %37, i64 4
  store i32 %42, ptr %43, align 4, !tbaa !11
  %44 = getelementptr inbounds i8, ptr %37, i64 8
  store i32 1, ptr %44, align 8, !tbaa !12
  %45 = getelementptr inbounds i8, ptr %37, i64 20
  store i32 1, ptr %45, align 4, !tbaa !15
  %46 = getelementptr inbounds i8, ptr %37, i64 16
  store i32 %35, ptr %46, align 8, !tbaa !13
  %47 = add nsw i32 %.048, 2
  %48 = sext i32 %47 to i64
  %49 = getelementptr inbounds [2020000 x %struct.Query], ptr @q, i64 0, i64 %48
  %50 = getelementptr inbounds i8, ptr %49, i64 12
  store i32 %34, ptr %50, align 4, !tbaa !14
  %51 = load i32, ptr %9, align 4, !tbaa !5
  store i32 %51, ptr %49, align 8, !tbaa !9
  %52 = load i32, ptr %10, align 4, !tbaa !5
  %53 = getelementptr inbounds i8, ptr %49, i64 4
  store i32 %52, ptr %53, align 4, !tbaa !11
  %54 = getelementptr inbounds i8, ptr %49, i64 8
  store i32 1, ptr %54, align 8, !tbaa !12
  %55 = getelementptr inbounds i8, ptr %49, i64 20
  store i32 1, ptr %55, align 4, !tbaa !15
  %56 = getelementptr inbounds i8, ptr %49, i64 16
  store i32 %47, ptr %56, align 8, !tbaa !13
  %57 = add nsw i32 %.048, 3
  %58 = sext i32 %57 to i64
  %59 = getelementptr inbounds [2020000 x %struct.Query], ptr @q, i64 0, i64 %58
  %60 = getelementptr inbounds i8, ptr %59, i64 12
  store i32 %34, ptr %60, align 4, !tbaa !14
  store i32 %40, ptr %59, align 8, !tbaa !9
  %61 = getelementptr inbounds i8, ptr %59, i64 4
  store i32 %52, ptr %61, align 4, !tbaa !11
  %62 = getelementptr inbounds i8, ptr %59, i64 8
  store i32 -1, ptr %62, align 8, !tbaa !12
  %63 = getelementptr inbounds i8, ptr %59, i64 20
  store i32 1, ptr %63, align 4, !tbaa !15
  %64 = getelementptr inbounds i8, ptr %59, i64 16
  store i32 %57, ptr %64, align 8, !tbaa !13
  %65 = add nsw i32 %.048, 4
  %66 = sext i32 %65 to i64
  %67 = getelementptr inbounds [2020000 x %struct.Query], ptr @q, i64 0, i64 %66
  %68 = getelementptr inbounds i8, ptr %67, i64 12
  store i32 %34, ptr %68, align 4, !tbaa !14
  store i32 %51, ptr %67, align 8, !tbaa !9
  %69 = getelementptr inbounds i8, ptr %67, i64 4
  store i32 %42, ptr %69, align 4, !tbaa !11
  %70 = getelementptr inbounds i8, ptr %67, i64 8
  store i32 -1, ptr %70, align 8, !tbaa !12
  %71 = getelementptr inbounds i8, ptr %67, i64 20
  store i32 1, ptr %71, align 4, !tbaa !15
  %72 = getelementptr inbounds i8, ptr %67, i64 16
  store i32 %65, ptr %72, align 8, !tbaa !13
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %10) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %9) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %8) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %7) #5
  br label %73

73:                                               ; preds = %16, %29
  %.250 = phi i32 [ %21, %16 ], [ %65, %29 ]
  %.2 = phi i32 [ %.047, %16 ], [ %34, %29 ]
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %3) #5
  br label %13

74:                                               ; preds = %13
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %3) #5
  %75 = sext i32 %.048 to i64
  %76 = getelementptr inbounds %struct.Query, ptr @q, i64 %75
  %77 = getelementptr inbounds i8, ptr %76, i64 24
  call void @_ZSt4sortIP5QueryEvT_S2_(ptr noundef nonnull getelementptr inbounds (i8, ptr @q, i64 24), ptr noundef nonnull %77)
  call void @_Z3cdqii(i32 noundef 1, i32 noundef %.048)
  %.not58 = icmp slt i32 %.047, 1
  br i1 %.not58, label %._crit_edge, label %.lr.ph.preheader

.lr.ph.preheader:                                 ; preds = %74
  %78 = add nuw i32 %.047, 1
  %wide.trip.count = zext i32 %78 to i64
  br label %.lr.ph

._crit_edge:                                      ; preds = %.lr.ph, %74
  ret i32 0

.lr.ph:                                           ; preds = %.lr.ph.preheader, %.lr.ph
  %indvars.iv = phi i64 [ 1, %.lr.ph.preheader ], [ %indvars.iv.next, %.lr.ph ]
  %79 = getelementptr inbounds [2020000 x i64], ptr @ans, i64 0, i64 %indvars.iv
  %80 = load i64, ptr %79, align 8, !tbaa !16
  %81 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i64 noundef %80)
  %82 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c(ptr noundef nonnull align 8 dereferenceable(8) %81, i8 noundef signext 10)
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
  br i1 %exitcond.not, label %._crit_edge, label %.lr.ph, !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 uwtable
declare dso_local void @_ZSt4sortIP5QueryEvT_S2_(ptr noundef, ptr noundef) 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 #4

; Function Attrs: mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8), i64 noundef) local_unnamed_addr #1 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 = { inlinehint mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { nounwind }

!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !6, i64 0}
!10 = !{!"_ZTS5Query", !6, i64 0, !6, i64 4, !6, i64 8, !6, i64 12, !6, i64 16, !6, i64 20}
!11 = !{!10, !6, i64 4}
!12 = !{!10, !6, i64 8}
!13 = !{!10, !6, i64 16}
!14 = !{!10, !6, i64 12}
!15 = !{!10, !6, i64 20}
!16 = !{!17, !17, i64 0}
!17 = !{!"long long", !7, i64 0}
!18 = distinct !{!18, !19}
!19 = !{!"llvm.loop.mustprogress"}


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