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

; 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 }
%struct.DP = type { i32, i32 }

@n = external dso_local global i32, align 4
@k = external dso_local global i32, align 4
@s = external dso_local global [100010 x i32], align 16
@a = external dso_local global [100010 x %struct.Query], align 16
@q = external dso_local global [100010 x %struct.Query], align 16
@dp = external dso_local global [100010 x %struct.DP], align 16
@idx = external dso_local global i32, align 4
@vec = external dso_local global [100010 x i32], align 16
@.str = external hidden unnamed_addr constant [3 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [7 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [7 x i8], align 1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_Z6getmaxR2DPS0_(ptr noundef nonnull align 4 dereferenceable(8), ptr noundef nonnull align 4 dereferenceable(8)) #0

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN2DPC2Eii(ptr noundef nonnull align 4 dereferenceable(8), i32 noundef, i32 noundef) unnamed_addr #0 align 2

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

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

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

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

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

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main(i32 noundef %0, ptr noundef %1) #5 {
  %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 %struct.DP, align 4
  %10 = alloca %struct.DP, 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
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #8
  %12 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef %6)
  br label %13

13:                                               ; preds = %114, %2
  %14 = load i32, ptr %6, align 4, !tbaa !5
  %15 = add nsw i32 %14, -1
  store i32 %15, ptr %6, align 4, !tbaa !5
  %16 = icmp ne i32 %14, 0
  br i1 %16, label %17, label %121

17:                                               ; preds = %13
  call void @llvm.memset.p0.i64(ptr align 16 @s, i8 0, i64 400040, i1 false)
  call void @llvm.memset.p0.i64(ptr align 16 @a, i8 0, i64 2400240, i1 false)
  call void @llvm.memset.p0.i64(ptr align 16 @q, i8 0, i64 2400240, i1 false)
  call void @llvm.memset.p0.i64(ptr align 16 @dp, i8 0, i64 800080, i1 false)
  %18 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef @n)
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #8
  store i32 1, ptr %7, align 4, !tbaa !5
  br label %19

19:                                               ; preds = %47, %17
  %20 = load i32, ptr %7, align 4, !tbaa !5
  %21 = load i32, ptr @n, align 4, !tbaa !5
  %22 = icmp sle i32 %20, %21
  br i1 %22, label %24, label %23

23:                                               ; preds = %19
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #8
  br label %50

24:                                               ; preds = %19
  %25 = load i32, ptr %7, align 4, !tbaa !5
  %26 = sext i32 %25 to i64
  %27 = getelementptr inbounds [100010 x %struct.Query], ptr @a, i64 0, i64 %26
  %28 = getelementptr inbounds %struct.Query, ptr %27, i32 0, i32 0
  %29 = load i32, ptr %7, align 4, !tbaa !5
  %30 = sext i32 %29 to i64
  %31 = getelementptr inbounds [100010 x %struct.Query], ptr @a, i64 0, i64 %30
  %32 = getelementptr inbounds %struct.Query, ptr %31, i32 0, i32 1
  %33 = load i32, ptr %7, align 4, !tbaa !5
  %34 = sext i32 %33 to i64
  %35 = getelementptr inbounds [100010 x %struct.Query], ptr @a, i64 0, i64 %34
  %36 = getelementptr inbounds %struct.Query, ptr %35, i32 0, i32 2
  %37 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.3, ptr noundef %28, ptr noundef %32, ptr noundef %36)
  %38 = load i32, ptr %7, align 4, !tbaa !5
  %39 = sext i32 %38 to i64
  %40 = getelementptr inbounds [100010 x %struct.Query], ptr @a, i64 0, i64 %39
  %41 = getelementptr inbounds %struct.Query, ptr %40, i32 0, i32 2
  %42 = load i32, ptr %41, align 8, !tbaa !11
  %43 = load i32, ptr %7, align 4, !tbaa !5
  %44 = sub nsw i32 %43, 1
  %45 = sext i32 %44 to i64
  %46 = getelementptr inbounds [100010 x i32], ptr @vec, i64 0, i64 %45
  store i32 %42, ptr %46, align 4, !tbaa !5
  br label %47

47:                                               ; preds = %24
  %48 = load i32, ptr %7, align 4, !tbaa !5
  %49 = add nsw i32 %48, 1
  store i32 %49, ptr %7, align 4, !tbaa !5
  br label %19, !llvm.loop !13

50:                                               ; preds = %23
  store i32 100010, ptr @k, align 4, !tbaa !5
  %51 = load i32, ptr @n, align 4, !tbaa !5
  %52 = sext i32 %51 to i64
  %53 = getelementptr inbounds %struct.Query, ptr @a, i64 %52
  %54 = getelementptr inbounds %struct.Query, ptr %53, i64 1
  call void @_ZSt4sortIP5QueryPFbS0_S0_EEvT_S4_T0_(ptr noundef getelementptr inbounds (%struct.Query, ptr @a, i64 1), ptr noundef %54, ptr noundef @_Z4cmpx5QueryS_)
  %55 = load i32, ptr @n, align 4, !tbaa !5
  %56 = sext i32 %55 to i64
  %57 = getelementptr inbounds i32, ptr @vec, i64 %56
  call void @_ZSt4sortIPiEvT_S1_(ptr noundef @vec, ptr noundef %57)
  %58 = load i32, ptr @n, align 4, !tbaa !5
  %59 = sext i32 %58 to i64
  %60 = getelementptr inbounds i32, ptr @vec, i64 %59
  %61 = call noundef ptr @_ZSt6uniqueIPiET_S1_S1_(ptr noundef @vec, ptr noundef %60)
  %62 = ptrtoint ptr %61 to i64
  %63 = sub i64 %62, ptrtoint (ptr @vec to i64)
  %64 = sdiv exact i64 %63, 4
  %65 = trunc i64 %64 to i32
  store i32 %65, ptr @idx, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #8
  store i32 1, ptr %8, align 4, !tbaa !5
  br label %66

66:                                               ; preds = %97, %50
  %67 = load i32, ptr %8, align 4, !tbaa !5
  %68 = load i32, ptr @n, align 4, !tbaa !5
  %69 = icmp sle i32 %67, %68
  br i1 %69, label %71, label %70

70:                                               ; preds = %66
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #8
  br label %100

71:                                               ; preds = %66
  %72 = load i32, ptr @idx, align 4, !tbaa !5
  %73 = sext i32 %72 to i64
  %74 = getelementptr inbounds i32, ptr @vec, i64 %73
  %75 = load i32, ptr %8, align 4, !tbaa !5
  %76 = sext i32 %75 to i64
  %77 = getelementptr inbounds [100010 x %struct.Query], ptr @a, i64 0, i64 %76
  %78 = getelementptr inbounds %struct.Query, ptr %77, i32 0, i32 2
  %79 = call noundef ptr @_ZSt11lower_boundIPiiET_S1_S1_RKT0_(ptr noundef @vec, ptr noundef %74, ptr noundef nonnull align 4 dereferenceable(4) %78)
  %80 = ptrtoint ptr %79 to i64
  %81 = sub i64 %80, ptrtoint (ptr @vec to i64)
  %82 = sdiv exact i64 %81, 4
  %83 = add nsw i64 %82, 1
  %84 = trunc i64 %83 to i32
  %85 = load i32, ptr %8, align 4, !tbaa !5
  %86 = sext i32 %85 to i64
  %87 = getelementptr inbounds [100010 x %struct.Query], ptr @a, i64 0, i64 %86
  %88 = getelementptr inbounds %struct.Query, ptr %87, i32 0, i32 2
  store i32 %84, ptr %88, align 8, !tbaa !11
  %89 = load i32, ptr %8, align 4, !tbaa !5
  %90 = load i32, ptr %8, align 4, !tbaa !5
  %91 = sext i32 %90 to i64
  %92 = getelementptr inbounds [100010 x %struct.Query], ptr @a, i64 0, i64 %91
  %93 = getelementptr inbounds %struct.Query, ptr %92, i32 0, i32 5
  store i32 %89, ptr %93, align 4, !tbaa !15
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #8
  call void @_ZN2DPC2Eii(ptr noundef nonnull align 4 dereferenceable(8) %9, i32 noundef 1, i32 noundef 1)
  %94 = load i32, ptr %8, align 4, !tbaa !5
  %95 = sext i32 %94 to i64
  %96 = getelementptr inbounds [100010 x %struct.DP], ptr @dp, i64 0, i64 %95
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %96, ptr align 4 %9, i64 8, i1 false), !tbaa.struct !16
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #8
  br label %97

97:                                               ; preds = %71
  %98 = load i32, ptr %8, align 4, !tbaa !5
  %99 = add nsw i32 %98, 1
  store i32 %99, ptr %8, align 4, !tbaa !5
  br label %66, !llvm.loop !17

100:                                              ; preds = %70
  %101 = load i32, ptr @n, align 4, !tbaa !5
  call void @_Z3cdqii(i32 noundef 1, i32 noundef %101)
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #8
  call void @_ZN2DPC2Eii(ptr noundef nonnull align 4 dereferenceable(8) %10, i32 noundef 0, i32 noundef 0)
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #8
  store i32 1, ptr %11, align 4, !tbaa !5
  br label %102

102:                                              ; preds = %111, %100
  %103 = load i32, ptr %11, align 4, !tbaa !5
  %104 = load i32, ptr @n, align 4, !tbaa !5
  %105 = icmp sle i32 %103, %104
  br i1 %105, label %107, label %106

106:                                              ; preds = %102
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #8
  br label %114

107:                                              ; preds = %102
  %108 = load i32, ptr %11, align 4, !tbaa !5
  %109 = sext i32 %108 to i64
  %110 = getelementptr inbounds [100010 x %struct.DP], ptr @dp, i64 0, i64 %109
  call void @_Z6getmaxR2DPS0_(ptr noundef nonnull align 4 dereferenceable(8) %10, ptr noundef nonnull align 4 dereferenceable(8) %110)
  br label %111

111:                                              ; preds = %107
  %112 = load i32, ptr %11, align 4, !tbaa !5
  %113 = add nsw i32 %112, 1
  store i32 %113, ptr %11, align 4, !tbaa !5
  br label %102, !llvm.loop !18

114:                                              ; preds = %106
  %115 = getelementptr inbounds %struct.DP, ptr %10, i32 0, i32 0
  %116 = load i32, ptr %115, align 4, !tbaa !19
  %117 = getelementptr inbounds %struct.DP, ptr %10, i32 0, i32 1
  %118 = load i32, ptr %117, align 4, !tbaa !21
  %119 = srem i32 %118, 1073741824
  %120 = call i32 (ptr, ...) @printf(ptr noundef @.str.4, i32 noundef %116, i32 noundef %119)
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #8
  br label %13, !llvm.loop !22

121:                                              ; preds = %13
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #8
  ret i32 0
}

declare i32 @__isoc99_scanf(ptr noundef, ...) #6

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #7

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

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

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

declare i32 @printf(ptr noundef, ...) #6

attributes #0 = { 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 #1 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { 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 #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 = { 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 #6 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #7 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #8 = { 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 8}
!12 = !{!"_ZTS5Query", !6, i64 0, !6, i64 4, !6, i64 8, !6, i64 12, !6, i64 16, !6, i64 20}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}
!15 = !{!12, !6, i64 20}
!16 = !{i64 0, i64 4, !5, i64 4, i64 4, !5}
!17 = distinct !{!17, !14}
!18 = distinct !{!18, !14}
!19 = !{!20, !6, i64 0}
!20 = !{!"_ZTS2DP", !6, i64 0, !6, i64 4}
!21 = !{!20, !6, i64 4}
!22 = distinct !{!22, !14}


; 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 }
%struct.DP = type { i32, i32 }

@n = external dso_local global i32, align 4
@k = external dso_local local_unnamed_addr global i32, align 4
@s = external dso_local local_unnamed_addr global [100010 x i32], align 16
@a = external dso_local global [100010 x %struct.Query], align 16
@q = external dso_local local_unnamed_addr global [100010 x %struct.Query], align 16
@dp = external dso_local global [100010 x %struct.DP], align 16
@idx = external dso_local local_unnamed_addr global i32, align 4
@vec = external dso_local global [100010 x i32], align 16
@.str = external hidden unnamed_addr constant [3 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [7 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [7 x i8], align 1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_Z6getmaxR2DPS0_(ptr noundef nonnull align 4 dereferenceable(8), ptr noundef nonnull align 4 dereferenceable(8)) local_unnamed_addr #0

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN2DPC2Eii(ptr noundef nonnull align 4 dereferenceable(8), i32 noundef, i32 noundef) unnamed_addr #0 align 2

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

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

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

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

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

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main(i32 noundef %0, ptr nocapture noundef readnone %1) local_unnamed_addr #4 {
  %3 = alloca i32, align 4
  %4 = alloca %struct.DP, align 8
  %5 = alloca %struct.DP, align 4
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %3) #7
  %6 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %3)
  %7 = load i32, ptr %3, align 4, !tbaa !5
  %8 = add nsw i32 %7, -1
  store i32 %8, ptr %3, align 4, !tbaa !5
  %.not37 = icmp eq i32 %7, 0
  br i1 %.not37, label %._crit_edge40, label %.lr.ph39

.lr.ph39:                                         ; preds = %2
  %9 = getelementptr inbounds i8, ptr %5, i64 4
  br label %10

10:                                               ; preds = %.lr.ph39, %._crit_edge36
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(400040) @s, i8 0, i64 400040, i1 false)
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(2400240) @a, i8 0, i64 2400240, i1 false)
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(2400240) @q, i8 0, i64 2400240, i1 false)
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(800080) @dp, i8 0, i64 800080, i1 false)
  %11 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @n)
  %12 = load i32, ptr @n, align 4, !tbaa !5
  %.not2024 = icmp slt i32 %12, 1
  br i1 %.not2024, label %.._crit_edge_crit_edge, label %.lr.ph

.._crit_edge_crit_edge:                           ; preds = %10
  %.pre = sext i32 %12 to i64
  br label %._crit_edge

._crit_edge:                                      ; preds = %.lr.ph, %.._crit_edge_crit_edge
  %.pre-phi = phi i64 [ %.pre, %.._crit_edge_crit_edge ], [ %33, %.lr.ph ]
  store i32 100010, ptr @k, align 4, !tbaa !5
  %gep = getelementptr %struct.Query, ptr getelementptr inbounds (i8, ptr @a, i64 24), i64 %.pre-phi
  call void @_ZSt4sortIP5QueryPFbS0_S0_EEvT_S4_T0_(ptr noundef nonnull getelementptr inbounds (i8, ptr @a, i64 24), ptr noundef nonnull %gep, ptr noundef nonnull @_Z4cmpx5QueryS_)
  %13 = load i32, ptr @n, align 4, !tbaa !5
  %14 = sext i32 %13 to i64
  %15 = getelementptr inbounds i32, ptr @vec, i64 %14
  call void @_ZSt4sortIPiEvT_S1_(ptr noundef nonnull @vec, ptr noundef nonnull %15)
  %16 = load i32, ptr @n, align 4, !tbaa !5
  %17 = sext i32 %16 to i64
  %18 = getelementptr inbounds i32, ptr @vec, i64 %17
  %19 = call noundef ptr @_ZSt6uniqueIPiET_S1_S1_(ptr noundef nonnull @vec, ptr noundef nonnull %18)
  %20 = ptrtoint ptr %19 to i64
  %21 = sub i64 %20, ptrtoint (ptr @vec to i64)
  %22 = lshr exact i64 %21, 2
  %23 = trunc i64 %22 to i32
  store i32 %23, ptr @idx, align 4, !tbaa !5
  %24 = load i32, ptr @n, align 4, !tbaa !5
  %.not2126 = icmp slt i32 %24, 1
  br i1 %.not2126, label %._crit_edge30, label %.lr.ph29

.lr.ph:                                           ; preds = %10, %.lr.ph
  %indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph ], [ 1, %10 ]
  %25 = getelementptr inbounds [100010 x %struct.Query], ptr @a, i64 0, i64 %indvars.iv
  %26 = getelementptr inbounds i8, ptr %25, i64 4
  %27 = getelementptr inbounds i8, ptr %25, i64 8
  %28 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.3, ptr noundef nonnull %25, ptr noundef nonnull %26, ptr noundef nonnull %27)
  %29 = load i32, ptr %27, align 8, !tbaa !9
  %30 = add nsw i64 %indvars.iv, -1
  %31 = getelementptr inbounds [100010 x i32], ptr @vec, i64 0, i64 %30
  store i32 %29, ptr %31, align 4, !tbaa !5
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %32 = load i32, ptr @n, align 4, !tbaa !5
  %33 = sext i32 %32 to i64
  %.not20.not = icmp slt i64 %indvars.iv, %33
  br i1 %.not20.not, label %.lr.ph, label %._crit_edge, !llvm.loop !11

._crit_edge30:                                    ; preds = %.lr.ph29, %._crit_edge
  %.lcssa23 = phi i32 [ %24, %._crit_edge ], [ %50, %.lr.ph29 ]
  call void @_Z3cdqii(i32 noundef 1, i32 noundef %.lcssa23)
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %5) #7
  call void @_ZN2DPC2Eii(ptr noundef nonnull align 4 dereferenceable(8) %5, i32 noundef 0, i32 noundef 0)
  %34 = load i32, ptr @n, align 4, !tbaa !5
  %.not2232 = icmp slt i32 %34, 1
  br i1 %.not2232, label %._crit_edge36, label %.lr.ph35

.lr.ph29:                                         ; preds = %._crit_edge, %.lr.ph29
  %indvars.iv44 = phi i64 [ %indvars.iv.next45, %.lr.ph29 ], [ 1, %._crit_edge ]
  %35 = load i32, ptr @idx, align 4, !tbaa !5
  %36 = sext i32 %35 to i64
  %37 = getelementptr inbounds i32, ptr @vec, i64 %36
  %38 = getelementptr inbounds [100010 x %struct.Query], ptr @a, i64 0, i64 %indvars.iv44
  %39 = getelementptr inbounds i8, ptr %38, i64 8
  %40 = call noundef ptr @_ZSt11lower_boundIPiiET_S1_S1_RKT0_(ptr noundef nonnull @vec, ptr noundef nonnull %37, ptr noundef nonnull align 4 dereferenceable(4) %39)
  %41 = ptrtoint ptr %40 to i64
  %42 = sub i64 %41, ptrtoint (ptr @vec to i64)
  %43 = lshr exact i64 %42, 2
  %44 = trunc i64 %43 to i32
  %45 = add i32 %44, 1
  store i32 %45, ptr %39, align 8, !tbaa !9
  %46 = getelementptr inbounds i8, ptr %38, i64 20
  %47 = trunc nuw nsw i64 %indvars.iv44 to i32
  store i32 %47, ptr %46, align 4, !tbaa !13
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %4) #7
  call void @_ZN2DPC2Eii(ptr noundef nonnull align 4 dereferenceable(8) %4, i32 noundef 1, i32 noundef 1)
  %48 = getelementptr inbounds [100010 x %struct.DP], ptr @dp, i64 0, i64 %indvars.iv44
  %49 = load i64, ptr %4, align 8
  store i64 %49, ptr %48, align 8
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #7
  %indvars.iv.next45 = add nuw nsw i64 %indvars.iv44, 1
  %50 = load i32, ptr @n, align 4, !tbaa !5
  %51 = sext i32 %50 to i64
  %.not21.not = icmp slt i64 %indvars.iv44, %51
  br i1 %.not21.not, label %.lr.ph29, label %._crit_edge30, !llvm.loop !14

._crit_edge36:                                    ; preds = %.lr.ph35, %._crit_edge30
  %52 = load i32, ptr %5, align 4, !tbaa !15
  %53 = load i32, ptr %9, align 4, !tbaa !17
  %54 = srem i32 %53, 1073741824
  %55 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.4, i32 noundef %52, i32 noundef %54)
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %5) #7
  %56 = load i32, ptr %3, align 4, !tbaa !5
  %57 = add nsw i32 %56, -1
  store i32 %57, ptr %3, align 4, !tbaa !5
  %.not = icmp eq i32 %56, 0
  br i1 %.not, label %._crit_edge40, label %10, !llvm.loop !18

.lr.ph35:                                         ; preds = %._crit_edge30, %.lr.ph35
  %indvars.iv47 = phi i64 [ %indvars.iv.next48, %.lr.ph35 ], [ 1, %._crit_edge30 ]
  %58 = getelementptr inbounds [100010 x %struct.DP], ptr @dp, i64 0, i64 %indvars.iv47
  call void @_Z6getmaxR2DPS0_(ptr noundef nonnull align 4 dereferenceable(8) %5, ptr noundef nonnull align 4 dereferenceable(8) %58)
  %indvars.iv.next48 = add nuw nsw i64 %indvars.iv47, 1
  %59 = load i32, ptr @n, align 4, !tbaa !5
  %60 = sext i32 %59 to i64
  %.not22.not = icmp slt i64 %indvars.iv47, %60
  br i1 %.not22.not, label %.lr.ph35, label %._crit_edge36, !llvm.loop !19

._crit_edge40:                                    ; preds = %._crit_edge36, %2
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %3) #7
  ret i32 0
}

; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #5

; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #6

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

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

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

; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #5

attributes #0 = { 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 #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { 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 = { 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 #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 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #6 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
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, !6, i64 8}
!10 = !{!"_ZTS5Query", !6, i64 0, !6, i64 4, !6, i64 8, !6, i64 12, !6, i64 16, !6, i64 20}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = !{!10, !6, i64 20}
!14 = distinct !{!14, !12}
!15 = !{!16, !6, i64 0}
!16 = !{!"_ZTS2DP", !6, i64 0, !6, i64 4}
!17 = !{!16, !6, i64 4}
!18 = distinct !{!18, !12}
!19 = distinct !{!19, !12}


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