; LLVM IR from lzyrapx/Competitive-Programming :: Retired_code/CDQ Divide and Conquer (bzoj 3262（三维偏序）)

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

@n = external dso_local global i32, align 4
@k = external dso_local global i32, align 4
@ans = external dso_local global [200010 x i32], align 16
@a = external dso_local global [200010 x %struct.Query], align 16
@q = external dso_local global [200010 x %struct.Query], 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: inlinehint mustprogress uwtable
declare dso_local void @_ZSt4sortIP5QueryPFbS0_S0_EEvT_S4_T0_(ptr noundef, ptr noundef, ptr noundef) #2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_Z4cmpx5QueryS_(ptr noundef byval(%struct.Query) align 8, ptr noundef byval(%struct.Query) align 8) #3

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main(i32 noundef %0, ptr noundef %1) #4 {
  %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
  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
  %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) @n)
  %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) @k)
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #7
  store i32 1, ptr %6, align 4, !tbaa !5
  br label %14

14:                                               ; preds = %35, %2
  %15 = load i32, ptr %6, align 4, !tbaa !5
  %16 = load i32, ptr @n, align 4, !tbaa !5
  %17 = icmp sle i32 %15, %16
  br i1 %17, label %19, label %18

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

19:                                               ; preds = %14
  %20 = load i32, ptr %6, align 4, !tbaa !5
  %21 = sext i32 %20 to i64
  %22 = getelementptr inbounds [200010 x %struct.Query], ptr @a, i64 0, i64 %21
  %23 = getelementptr inbounds %struct.Query, ptr %22, i32 0, i32 0
  %24 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) %23)
  %25 = load i32, ptr %6, align 4, !tbaa !5
  %26 = sext i32 %25 to i64
  %27 = getelementptr inbounds [200010 x %struct.Query], ptr @a, i64 0, i64 %26
  %28 = getelementptr inbounds %struct.Query, ptr %27, i32 0, i32 1
  %29 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %24, ptr noundef nonnull align 4 dereferenceable(4) %28)
  %30 = load i32, ptr %6, align 4, !tbaa !5
  %31 = sext i32 %30 to i64
  %32 = getelementptr inbounds [200010 x %struct.Query], ptr @a, i64 0, i64 %31
  %33 = getelementptr inbounds %struct.Query, ptr %32, i32 0, i32 2
  %34 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %29, ptr noundef nonnull align 4 dereferenceable(4) %33)
  br label %35

35:                                               ; preds = %19
  %36 = load i32, ptr %6, align 4, !tbaa !5
  %37 = add nsw i32 %36, 1
  store i32 %37, ptr %6, align 4, !tbaa !5
  br label %14, !llvm.loop !11

38:                                               ; preds = %18
  %39 = load i32, ptr @n, align 4, !tbaa !5
  %40 = sext i32 %39 to i64
  %41 = getelementptr inbounds %struct.Query, ptr @a, i64 %40
  %42 = getelementptr inbounds %struct.Query, ptr %41, i64 1
  call void @_ZSt4sortIP5QueryPFbS0_S0_EEvT_S4_T0_(ptr noundef getelementptr inbounds (%struct.Query, ptr @a, i64 1), ptr noundef %42, ptr noundef @_Z4cmpx5QueryS_)
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #7
  store i32 0, ptr %7, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #7
  store i32 0, ptr %8, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #7
  store i32 1, ptr %9, align 4, !tbaa !5
  br label %43

43:                                               ; preds = %103, %38
  %44 = load i32, ptr %9, align 4, !tbaa !5
  %45 = load i32, ptr @n, align 4, !tbaa !5
  %46 = icmp sle i32 %44, %45
  br i1 %46, label %48, label %47

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

48:                                               ; preds = %43
  %49 = load i32, ptr %7, align 4, !tbaa !5
  %50 = add nsw i32 %49, 1
  store i32 %50, ptr %7, align 4, !tbaa !5
  %51 = load i32, ptr %9, align 4, !tbaa !5
  %52 = sext i32 %51 to i64
  %53 = getelementptr inbounds [200010 x %struct.Query], ptr @a, i64 0, i64 %52
  %54 = getelementptr inbounds %struct.Query, ptr %53, i32 0, i32 0
  %55 = load i32, ptr %54, align 4, !tbaa !13
  %56 = load i32, ptr %9, align 4, !tbaa !5
  %57 = add nsw i32 %56, 1
  %58 = sext i32 %57 to i64
  %59 = getelementptr inbounds [200010 x %struct.Query], ptr @a, i64 0, i64 %58
  %60 = getelementptr inbounds %struct.Query, ptr %59, i32 0, i32 0
  %61 = load i32, ptr %60, align 4, !tbaa !13
  %62 = icmp ne i32 %55, %61
  br i1 %62, label %89, label %63

63:                                               ; preds = %48
  %64 = load i32, ptr %9, align 4, !tbaa !5
  %65 = sext i32 %64 to i64
  %66 = getelementptr inbounds [200010 x %struct.Query], ptr @a, i64 0, i64 %65
  %67 = getelementptr inbounds %struct.Query, ptr %66, i32 0, i32 1
  %68 = load i32, ptr %67, align 4, !tbaa !15
  %69 = load i32, ptr %9, align 4, !tbaa !5
  %70 = add nsw i32 %69, 1
  %71 = sext i32 %70 to i64
  %72 = getelementptr inbounds [200010 x %struct.Query], ptr @a, i64 0, i64 %71
  %73 = getelementptr inbounds %struct.Query, ptr %72, i32 0, i32 1
  %74 = load i32, ptr %73, align 4, !tbaa !15
  %75 = icmp ne i32 %68, %74
  br i1 %75, label %89, label %76

76:                                               ; preds = %63
  %77 = load i32, ptr %9, align 4, !tbaa !5
  %78 = sext i32 %77 to i64
  %79 = getelementptr inbounds [200010 x %struct.Query], ptr @a, i64 0, i64 %78
  %80 = getelementptr inbounds %struct.Query, ptr %79, i32 0, i32 2
  %81 = load i32, ptr %80, align 4, !tbaa !16
  %82 = load i32, ptr %9, align 4, !tbaa !5
  %83 = add nsw i32 %82, 1
  %84 = sext i32 %83 to i64
  %85 = getelementptr inbounds [200010 x %struct.Query], ptr @a, i64 0, i64 %84
  %86 = getelementptr inbounds %struct.Query, ptr %85, i32 0, i32 2
  %87 = load i32, ptr %86, align 4, !tbaa !16
  %88 = icmp ne i32 %81, %87
  br i1 %88, label %89, label %102

89:                                               ; preds = %76, %63, %48
  %90 = load i32, ptr %9, align 4, !tbaa !5
  %91 = sext i32 %90 to i64
  %92 = getelementptr inbounds [200010 x %struct.Query], ptr @a, i64 0, i64 %91
  %93 = load i32, ptr %8, align 4, !tbaa !5
  %94 = add nsw i32 %93, 1
  store i32 %94, ptr %8, align 4, !tbaa !5
  %95 = sext i32 %94 to i64
  %96 = getelementptr inbounds [200010 x %struct.Query], ptr @q, i64 0, i64 %95
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %96, ptr align 4 %92, i64 20, i1 false), !tbaa.struct !17
  %97 = load i32, ptr %7, align 4, !tbaa !5
  %98 = load i32, ptr %8, align 4, !tbaa !5
  %99 = sext i32 %98 to i64
  %100 = getelementptr inbounds [200010 x %struct.Query], ptr @q, i64 0, i64 %99
  %101 = getelementptr inbounds %struct.Query, ptr %100, i32 0, i32 4
  store i32 %97, ptr %101, align 4, !tbaa !18
  store i32 0, ptr %7, align 4, !tbaa !5
  br label %102

102:                                              ; preds = %89, %76
  br label %103

103:                                              ; preds = %102
  %104 = load i32, ptr %9, align 4, !tbaa !5
  %105 = add nsw i32 %104, 1
  store i32 %105, ptr %9, align 4, !tbaa !5
  br label %43, !llvm.loop !19

106:                                              ; preds = %47
  %107 = load i32, ptr %8, align 4, !tbaa !5
  call void @_Z3cdqii(i32 noundef 1, i32 noundef %107)
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #7
  store i32 1, ptr %10, align 4, !tbaa !5
  br label %108

108:                                              ; preds = %135, %106
  %109 = load i32, ptr %10, align 4, !tbaa !5
  %110 = load i32, ptr %8, align 4, !tbaa !5
  %111 = icmp sle i32 %109, %110
  br i1 %111, label %113, label %112

112:                                              ; preds = %108
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #7
  br label %138

113:                                              ; preds = %108
  %114 = load i32, ptr %10, align 4, !tbaa !5
  %115 = sext i32 %114 to i64
  %116 = getelementptr inbounds [200010 x %struct.Query], ptr @q, i64 0, i64 %115
  %117 = getelementptr inbounds %struct.Query, ptr %116, i32 0, i32 4
  %118 = load i32, ptr %117, align 4, !tbaa !18
  %119 = load i32, ptr %10, align 4, !tbaa !5
  %120 = sext i32 %119 to i64
  %121 = getelementptr inbounds [200010 x %struct.Query], ptr @q, i64 0, i64 %120
  %122 = getelementptr inbounds %struct.Query, ptr %121, i32 0, i32 3
  %123 = load i32, ptr %122, align 4, !tbaa !20
  %124 = load i32, ptr %10, align 4, !tbaa !5
  %125 = sext i32 %124 to i64
  %126 = getelementptr inbounds [200010 x %struct.Query], ptr @q, i64 0, i64 %125
  %127 = getelementptr inbounds %struct.Query, ptr %126, i32 0, i32 4
  %128 = load i32, ptr %127, align 4, !tbaa !18
  %129 = sub nsw i32 %128, 1
  %130 = add nsw i32 %123, %129
  %131 = sext i32 %130 to i64
  %132 = getelementptr inbounds [200010 x i32], ptr @ans, i64 0, i64 %131
  %133 = load i32, ptr %132, align 4, !tbaa !5
  %134 = add nsw i32 %133, %118
  store i32 %134, ptr %132, align 4, !tbaa !5
  br label %135

135:                                              ; preds = %113
  %136 = load i32, ptr %10, align 4, !tbaa !5
  %137 = add nsw i32 %136, 1
  store i32 %137, ptr %10, align 4, !tbaa !5
  br label %108, !llvm.loop !21

138:                                              ; preds = %112
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #7
  store i32 0, ptr %11, align 4, !tbaa !5
  br label %139

139:                                              ; preds = %151, %138
  %140 = load i32, ptr %11, align 4, !tbaa !5
  %141 = load i32, ptr @n, align 4, !tbaa !5
  %142 = icmp slt i32 %140, %141
  br i1 %142, label %144, label %143

143:                                              ; preds = %139
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #7
  br label %154

144:                                              ; preds = %139
  %145 = load i32, ptr %11, align 4, !tbaa !5
  %146 = sext i32 %145 to i64
  %147 = getelementptr inbounds [200010 x i32], ptr @ans, i64 0, i64 %146
  %148 = load i32, ptr %147, align 4, !tbaa !5
  %149 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i32 noundef %148)
  %150 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c(ptr noundef nonnull align 8 dereferenceable(8) %149, i8 noundef signext 10)
  br label %151

151:                                              ; preds = %144
  %152 = load i32, ptr %11, align 4, !tbaa !5
  %153 = add nsw i32 %152, 1
  store i32 %153, ptr %11, align 4, !tbaa !5
  br label %139, !llvm.loop !22

154:                                              ; preds = %143
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #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)) #5

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #6

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

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

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 = { 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 #3 = { 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 #4 = { 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 #5 = { "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 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #7 = { 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 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = !{!14, !6, i64 0}
!14 = !{!"_ZTS5Query", !6, i64 0, !6, i64 4, !6, i64 8, !6, i64 12, !6, i64 16}
!15 = !{!14, !6, i64 4}
!16 = !{!14, !6, i64 8}
!17 = !{i64 0, i64 4, !5, i64 4, i64 4, !5, i64 8, i64 4, !5, i64 12, i64 4, !5, i64 16, i64 4, !5}
!18 = !{!14, !6, i64 16}
!19 = distinct !{!19, !12}
!20 = !{!14, !6, i64 12}
!21 = distinct !{!21, !12}
!22 = distinct !{!22, !12}


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

%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" }

@n = external dso_local global i32, align 4
@k = external dso_local global i32, align 4
@ans = external dso_local local_unnamed_addr global [200010 x i32], align 16
@a = external dso_local global [200010 x %struct.Query], align 16
@q = external dso_local local_unnamed_addr global [200010 x %struct.Query], align 16
@_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 @_Z3cdqii(i32 noundef, i32 noundef) local_unnamed_addr #0

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_Z4cmpx5QueryS_(ptr noundef byval(%struct.Query) align 8, ptr noundef byval(%struct.Query) align 8) #2

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main(i32 noundef %0, ptr nocapture noundef readnone %1) local_unnamed_addr #3 {
  %3 = 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)
  %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) @k)
  %5 = load i32, ptr @n, align 4, !tbaa !5
  %.not40 = icmp slt i32 %5, 1
  br i1 %.not40, label %.._crit_edge_crit_edge, label %.lr.ph

.._crit_edge_crit_edge:                           ; preds = %2
  %.pre70 = sext i32 %5 to i64
  br label %._crit_edge

._crit_edge:                                      ; preds = %.lr.ph, %.._crit_edge_crit_edge
  %.pre-phi = phi i64 [ %.pre70, %.._crit_edge_crit_edge ], [ %17, %.lr.ph ]
  %6 = getelementptr inbounds %struct.Query, ptr @a, i64 %.pre-phi
  %7 = getelementptr inbounds i8, ptr %6, i64 20
  tail call void @_ZSt4sortIP5QueryPFbS0_S0_EEvT_S4_T0_(ptr noundef nonnull getelementptr inbounds (i8, ptr @a, i64 20), ptr noundef nonnull %7, ptr noundef nonnull @_Z4cmpx5QueryS_)
  %8 = load i32, ptr @n, align 4, !tbaa !5
  %.not3542 = icmp slt i32 %8, 1
  br i1 %.not3542, label %._crit_edge48.thread, label %.lr.ph47.preheader

._crit_edge48.thread:                             ; preds = %._crit_edge
  tail call void @_Z3cdqii(i32 noundef 1, i32 noundef 0)
  br label %.preheader

.lr.ph47.preheader:                               ; preds = %._crit_edge
  %9 = add nuw i32 %8, 1
  %wide.trip.count = zext i32 %9 to i64
  %.pre = load i32, ptr getelementptr inbounds (i8, ptr @a, i64 20), align 4, !tbaa !9
  br label %.lr.ph47

.lr.ph:                                           ; preds = %2, %.lr.ph
  %indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph ], [ 1, %2 ]
  %10 = getelementptr inbounds [200010 x %struct.Query], ptr @a, i64 0, i64 %indvars.iv
  %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) %10)
  %12 = getelementptr inbounds i8, ptr %10, i64 4
  %13 = 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) %12)
  %14 = getelementptr inbounds i8, ptr %10, i64 8
  %15 = tail call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %13, ptr noundef nonnull align 4 dereferenceable(4) %14)
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %16 = load i32, ptr @n, align 4, !tbaa !5
  %17 = sext i32 %16 to i64
  %.not.not = icmp slt i64 %indvars.iv, %17
  br i1 %.not.not, label %.lr.ph, label %._crit_edge, !llvm.loop !11

._crit_edge48:                                    ; preds = %40
  tail call void @_Z3cdqii(i32 noundef 1, i32 noundef %.1)
  %.not3650 = icmp slt i32 %.1, 1
  br i1 %.not3650, label %.preheader, label %.lr.ph53.preheader

.lr.ph53.preheader:                               ; preds = %._crit_edge48
  %18 = zext nneg i32 %.1 to i64
  %xtraiter = and i64 %18, 1
  %19 = icmp eq i32 %.1, 1
  br i1 %19, label %.preheader.loopexit.unr-lcssa, label %.lr.ph53.preheader.new

.lr.ph53.preheader.new:                           ; preds = %.lr.ph53.preheader
  %unroll_iter = and i64 %18, 2147483646
  br label %.lr.ph53

.lr.ph47:                                         ; preds = %.lr.ph47.preheader, %40
  %20 = phi i32 [ %.pre, %.lr.ph47.preheader ], [ %24, %40 ]
  %indvars.iv59 = phi i64 [ 1, %.lr.ph47.preheader ], [ %indvars.iv.next60, %40 ]
  %.03044 = phi i32 [ 0, %.lr.ph47.preheader ], [ %.1, %40 ]
  %.03143 = phi i32 [ 0, %.lr.ph47.preheader ], [ %.132, %40 ]
  %21 = add nsw i32 %.03143, 1
  %22 = getelementptr inbounds [200010 x %struct.Query], ptr @a, i64 0, i64 %indvars.iv59
  %indvars.iv.next60 = add nuw nsw i64 %indvars.iv59, 1
  %23 = getelementptr inbounds [200010 x %struct.Query], ptr @a, i64 0, i64 %indvars.iv.next60
  %24 = load i32, ptr %23, align 4, !tbaa !9
  %.not37 = icmp eq i32 %20, %24
  br i1 %.not37, label %25, label %35

25:                                               ; preds = %.lr.ph47
  %26 = getelementptr inbounds i8, ptr %22, i64 4
  %27 = load i32, ptr %26, align 4, !tbaa !13
  %28 = getelementptr inbounds i8, ptr %23, i64 4
  %29 = load i32, ptr %28, align 4, !tbaa !13
  %.not38 = icmp eq i32 %27, %29
  br i1 %.not38, label %30, label %35

30:                                               ; preds = %25
  %31 = getelementptr inbounds i8, ptr %22, i64 8
  %32 = load i32, ptr %31, align 4, !tbaa !14
  %33 = getelementptr inbounds i8, ptr %23, i64 8
  %34 = load i32, ptr %33, align 4, !tbaa !14
  %.not39 = icmp eq i32 %32, %34
  br i1 %.not39, label %40, label %35

35:                                               ; preds = %30, %25, %.lr.ph47
  %36 = add nsw i32 %.03044, 1
  %37 = sext i32 %36 to i64
  %38 = getelementptr inbounds [200010 x %struct.Query], ptr @q, i64 0, i64 %37
  tail call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 4 dereferenceable(20) %38, ptr noundef nonnull align 4 dereferenceable(20) %22, i64 16, i1 false), !tbaa.struct !15
  %39 = getelementptr inbounds i8, ptr %38, i64 16
  store i32 %21, ptr %39, align 4, !tbaa !16
  br label %40

40:                                               ; preds = %30, %35
  %.132 = phi i32 [ 0, %35 ], [ %21, %30 ]
  %.1 = phi i32 [ %36, %35 ], [ %.03044, %30 ]
  %exitcond.not = icmp eq i64 %indvars.iv.next60, %wide.trip.count
  br i1 %exitcond.not, label %._crit_edge48, label %.lr.ph47, !llvm.loop !17

.preheader.loopexit.unr-lcssa:                    ; preds = %.lr.ph53, %.lr.ph53.preheader
  %indvars.iv62.unr = phi i64 [ 1, %.lr.ph53.preheader ], [ %indvars.iv.next63.1, %.lr.ph53 ]
  %lcmp.mod.not = icmp eq i64 %xtraiter, 0
  br i1 %lcmp.mod.not, label %.preheader, label %.lr.ph53.epil

.lr.ph53.epil:                                    ; preds = %.preheader.loopexit.unr-lcssa
  %41 = getelementptr inbounds [200010 x %struct.Query], ptr @q, i64 0, i64 %indvars.iv62.unr
  %42 = getelementptr inbounds i8, ptr %41, i64 16
  %43 = load i32, ptr %42, align 4, !tbaa !16
  %44 = getelementptr inbounds i8, ptr %41, i64 12
  %45 = load i32, ptr %44, align 4, !tbaa !18
  %46 = add nsw i32 %43, -1
  %47 = add nsw i32 %46, %45
  %48 = sext i32 %47 to i64
  %49 = getelementptr inbounds [200010 x i32], ptr @ans, i64 0, i64 %48
  %50 = load i32, ptr %49, align 4, !tbaa !5
  %51 = add nsw i32 %50, %43
  store i32 %51, ptr %49, align 4, !tbaa !5
  br label %.preheader

.preheader:                                       ; preds = %.lr.ph53.epil, %.preheader.loopexit.unr-lcssa, %._crit_edge48.thread, %._crit_edge48
  %52 = load i32, ptr @n, align 4, !tbaa !5
  %53 = icmp sgt i32 %52, 0
  br i1 %53, label %.lr.ph55, label %._crit_edge56

.lr.ph53:                                         ; preds = %.lr.ph53, %.lr.ph53.preheader.new
  %indvars.iv62 = phi i64 [ 1, %.lr.ph53.preheader.new ], [ %indvars.iv.next63.1, %.lr.ph53 ]
  %niter = phi i64 [ 0, %.lr.ph53.preheader.new ], [ %niter.next.1, %.lr.ph53 ]
  %54 = getelementptr inbounds [200010 x %struct.Query], ptr @q, i64 0, i64 %indvars.iv62
  %55 = getelementptr inbounds i8, ptr %54, i64 16
  %56 = load i32, ptr %55, align 4, !tbaa !16
  %57 = getelementptr inbounds i8, ptr %54, i64 12
  %58 = load i32, ptr %57, align 4, !tbaa !18
  %59 = add nsw i32 %56, -1
  %60 = add nsw i32 %59, %58
  %61 = sext i32 %60 to i64
  %62 = getelementptr inbounds [200010 x i32], ptr @ans, i64 0, i64 %61
  %63 = load i32, ptr %62, align 4, !tbaa !5
  %64 = add nsw i32 %63, %56
  store i32 %64, ptr %62, align 4, !tbaa !5
  %indvars.iv.next63 = add nuw nsw i64 %indvars.iv62, 1
  %65 = getelementptr inbounds [200010 x %struct.Query], ptr @q, i64 0, i64 %indvars.iv.next63
  %66 = getelementptr inbounds i8, ptr %65, i64 16
  %67 = load i32, ptr %66, align 4, !tbaa !16
  %68 = getelementptr inbounds i8, ptr %65, i64 12
  %69 = load i32, ptr %68, align 4, !tbaa !18
  %70 = add nsw i32 %67, -1
  %71 = add nsw i32 %70, %69
  %72 = sext i32 %71 to i64
  %73 = getelementptr inbounds [200010 x i32], ptr @ans, i64 0, i64 %72
  %74 = load i32, ptr %73, align 4, !tbaa !5
  %75 = add nsw i32 %74, %67
  store i32 %75, ptr %73, align 4, !tbaa !5
  %indvars.iv.next63.1 = add nuw nsw i64 %indvars.iv62, 2
  %niter.next.1 = add i64 %niter, 2
  %niter.ncmp.1 = icmp eq i64 %niter.next.1, %unroll_iter
  br i1 %niter.ncmp.1, label %.preheader.loopexit.unr-lcssa, label %.lr.ph53, !llvm.loop !19

._crit_edge56:                                    ; preds = %.lr.ph55, %.preheader
  ret i32 0

.lr.ph55:                                         ; preds = %.preheader, %.lr.ph55
  %indvars.iv67 = phi i64 [ %indvars.iv.next68, %.lr.ph55 ], [ 0, %.preheader ]
  %76 = getelementptr inbounds [200010 x i32], ptr @ans, i64 0, i64 %indvars.iv67
  %77 = load i32, ptr %76, align 4, !tbaa !5
  %78 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i32 noundef %77)
  %79 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c(ptr noundef nonnull align 8 dereferenceable(8) %78, i8 noundef signext 10)
  %indvars.iv.next68 = add nuw nsw i64 %indvars.iv67, 1
  %80 = load i32, ptr @n, align 4, !tbaa !5
  %81 = sext i32 %80 to i64
  %82 = icmp slt i64 %indvars.iv.next68, %81
  br i1 %82, label %.lr.ph55, label %._crit_edge56, !llvm.loop !20
}

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 nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #5

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

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

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 = { 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 #2 = { 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 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) }

!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}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = !{!10, !6, i64 4}
!14 = !{!10, !6, i64 8}
!15 = !{i64 0, i64 4, !5, i64 4, i64 4, !5, i64 8, i64 4, !5, i64 12, i64 4, !5, i64 16, i64 4, !5}
!16 = !{!10, !6, i64 16}
!17 = distinct !{!17, !12}
!18 = !{!10, !6, i64 12}
!19 = distinct !{!19, !12}
!20 = distinct !{!20, !12}


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