; LLVM IR from lzyrapx/Competitive-Programming :: Retired_code/CDQ Divide and Conquer (BZOJ 3295（动态逆序对）)

; 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
@m = external dso_local global i32, align 4
@q = external dso_local global [2020000 x %struct.Query], align 16
@id = external dso_local global [505000 x i32], align 16
@ans = external dso_local global [2020000 x i64], align 16
@.str = external hidden unnamed_addr constant [5 x i8], align 1
@_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: 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) #2

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

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

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

21:                                               ; preds = %16
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #7
  %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) %9)
  %23 = load i32, ptr %8, align 4, !tbaa !5
  %24 = load i32, ptr %9, align 4, !tbaa !5
  %25 = sext i32 %24 to i64
  %26 = getelementptr inbounds [505000 x i32], ptr @id, i64 0, i64 %25
  store i32 %23, ptr %26, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 20, ptr %10) #7
  %27 = load i32, ptr %7, align 4, !tbaa !5
  %28 = add nsw i32 %27, 1
  store i32 %28, ptr %7, align 4, !tbaa !5
  %29 = load i32, ptr %9, align 4, !tbaa !5
  %30 = sext i32 %29 to i64
  %31 = getelementptr inbounds [505000 x i32], ptr @id, i64 0, i64 %30
  %32 = load i32, ptr %31, align 4, !tbaa !5
  %33 = load i32, ptr %9, align 4, !tbaa !5
  call void @_ZN5QueryC2Eiiiii(ptr noundef nonnull align 4 dereferenceable(20) %10, i32 noundef %28, i32 noundef %32, i32 noundef %33, i32 noundef 1, i32 noundef 0)
  %34 = load i32, ptr %6, align 4, !tbaa !5
  %35 = add nsw i32 %34, 1
  store i32 %35, ptr %6, align 4, !tbaa !5
  %36 = sext i32 %35 to i64
  %37 = getelementptr inbounds [2020000 x %struct.Query], ptr @q, i64 0, i64 %36
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %37, ptr align 4 %10, i64 20, i1 false), !tbaa.struct !11
  call void @llvm.lifetime.end.p0(i64 20, ptr %10) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #7
  br label %38

38:                                               ; preds = %21
  %39 = load i32, ptr %8, align 4, !tbaa !5
  %40 = add nsw i32 %39, 1
  store i32 %40, ptr %8, align 4, !tbaa !5
  br label %16, !llvm.loop !12

41:                                               ; preds = %20
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #7
  store i32 1, ptr %11, align 4, !tbaa !5
  br label %42

42:                                               ; preds = %61, %41
  %43 = load i32, ptr %11, align 4, !tbaa !5
  %44 = load i32, ptr @m, align 4, !tbaa !5
  %45 = icmp sle i32 %43, %44
  br i1 %45, label %47, label %46

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

47:                                               ; preds = %42
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #7
  %48 = 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)
  call void @llvm.lifetime.start.p0(i64 20, ptr %13) #7
  %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 %12, align 4, !tbaa !5
  %52 = sext i32 %51 to i64
  %53 = getelementptr inbounds [505000 x i32], ptr @id, i64 0, i64 %52
  %54 = load i32, ptr %53, align 4, !tbaa !5
  %55 = load i32, ptr %12, align 4, !tbaa !5
  %56 = load i32, ptr %11, align 4, !tbaa !5
  call void @_ZN5QueryC2Eiiiii(ptr noundef nonnull align 4 dereferenceable(20) %13, i32 noundef %50, i32 noundef %54, i32 noundef %55, i32 noundef -1, i32 noundef %56)
  %57 = load i32, ptr %6, align 4, !tbaa !5
  %58 = add nsw i32 %57, 1
  store i32 %58, ptr %6, align 4, !tbaa !5
  %59 = sext i32 %58 to i64
  %60 = getelementptr inbounds [2020000 x %struct.Query], ptr @q, i64 0, i64 %59
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %60, ptr align 4 %13, i64 20, i1 false), !tbaa.struct !11
  call void @llvm.lifetime.end.p0(i64 20, ptr %13) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #7
  br label %61

61:                                               ; preds = %47
  %62 = load i32, ptr %11, align 4, !tbaa !5
  %63 = add nsw i32 %62, 1
  store i32 %63, ptr %11, align 4, !tbaa !5
  br label %42, !llvm.loop !14

64:                                               ; preds = %46
  %65 = load i32, ptr %6, align 4, !tbaa !5
  %66 = sext i32 %65 to i64
  %67 = getelementptr inbounds %struct.Query, ptr @q, i64 %66
  %68 = getelementptr inbounds %struct.Query, ptr %67, i64 1
  call void @_ZSt4sortIP5QueryEvT_S2_(ptr noundef getelementptr inbounds (%struct.Query, ptr @q, i64 1), ptr noundef %68)
  %69 = load i32, ptr %6, align 4, !tbaa !5
  call void @_Z3cdqii(i32 noundef 1, i32 noundef %69)
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #7
  store i32 1, ptr %14, align 4, !tbaa !5
  br label %70

70:                                               ; preds = %93, %64
  %71 = load i32, ptr %14, align 4, !tbaa !5
  %72 = load i32, ptr @m, align 4, !tbaa !5
  %73 = icmp sle i32 %71, %72
  br i1 %73, label %75, label %74

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

75:                                               ; preds = %70
  %76 = load i32, ptr %14, align 4, !tbaa !5
  %77 = sub nsw i32 %76, 1
  %78 = sext i32 %77 to i64
  %79 = getelementptr inbounds [2020000 x i64], ptr @ans, i64 0, i64 %78
  %80 = load i64, ptr %79, align 8, !tbaa !15
  %81 = load i32, ptr %14, align 4, !tbaa !5
  %82 = sext i32 %81 to i64
  %83 = getelementptr inbounds [2020000 x i64], ptr @ans, i64 0, i64 %82
  %84 = load i64, ptr %83, align 8, !tbaa !15
  %85 = add nsw i64 %84, %80
  store i64 %85, ptr %83, align 8, !tbaa !15
  %86 = load i32, ptr %14, align 4, !tbaa !5
  %87 = sub nsw i32 %86, 1
  %88 = sext i32 %87 to i64
  %89 = getelementptr inbounds [2020000 x i64], ptr @ans, i64 0, i64 %88
  %90 = load i64, ptr %89, align 8, !tbaa !15
  %91 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i64 noundef %90)
  %92 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c(ptr noundef nonnull align 8 dereferenceable(8) %91, i8 noundef signext 10)
  br label %93

93:                                               ; preds = %75
  %94 = load i32, ptr %14, align 4, !tbaa !5
  %95 = add nsw i32 %94, 1
  store i32 %95, ptr %14, align 4, !tbaa !5
  br label %70, !llvm.loop !17

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

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

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

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

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZSt4sortIP5QueryEvT_S2_(ptr noundef, ptr noundef) #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) #6

; 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 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
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 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 #6 = { 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 #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 = !{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}
!12 = distinct !{!12, !13}
!13 = !{!"llvm.loop.mustprogress"}
!14 = distinct !{!14, !13}
!15 = !{!16, !16, i64 0}
!16 = !{!"long long", !7, i64 0}
!17 = distinct !{!17, !13}


; 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
@m = external dso_local global i32, align 4
@q = external dso_local global [2020000 x %struct.Query], align 16
@id = external dso_local local_unnamed_addr global [505000 x i32], align 16
@ans = external dso_local local_unnamed_addr global [2020000 x i64], align 16
@.str = external hidden unnamed_addr constant [5 x i8], align 1
@_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 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) #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 = alloca i32, align 4
  %4 = alloca %struct.Query, align 4
  %5 = alloca i32, align 4
  %6 = alloca %struct.Query, align 4
  %7 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @n, ptr noundef nonnull @m)
  %8 = load i32, ptr @n, align 4, !tbaa !5
  %.not24 = icmp slt i32 %8, 1
  br i1 %.not24, label %.preheader, label %.lr.ph

.preheader:                                       ; preds = %.lr.ph, %2
  %.020.lcssa = phi i32 [ 0, %2 ], [ %indvars, %.lr.ph ]
  %9 = load i32, ptr @m, align 4, !tbaa !5
  %.not2229 = icmp slt i32 %9, 1
  br i1 %.not2229, label %._crit_edge, label %.lr.ph33.preheader

.lr.ph33.preheader:                               ; preds = %.preheader
  %10 = zext nneg i32 %.020.lcssa to i64
  br label %.lr.ph33

.lr.ph:                                           ; preds = %2, %.lr.ph
  %indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph ], [ 0, %2 ]
  %.01827 = phi i32 [ %16, %.lr.ph ], [ 1, %2 ]
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %3) #8
  %11 = 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)
  %12 = load i32, ptr %3, align 4, !tbaa !5
  %13 = sext i32 %12 to i64
  %14 = getelementptr inbounds [505000 x i32], ptr @id, i64 0, i64 %13
  store i32 %.01827, ptr %14, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 20, ptr nonnull %4) #8
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %indvars = trunc i64 %indvars.iv.next to i32
  call void @_ZN5QueryC2Eiiiii(ptr noundef nonnull align 4 dereferenceable(20) %4, i32 noundef %indvars, i32 noundef %.01827, i32 noundef %12, i32 noundef 1, i32 noundef 0)
  %15 = getelementptr inbounds [2020000 x %struct.Query], ptr @q, i64 0, i64 %indvars.iv.next
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 4 dereferenceable(20) %15, ptr noundef nonnull align 4 dereferenceable(20) %4, i64 20, i1 false), !tbaa.struct !9
  call void @llvm.lifetime.end.p0(i64 20, ptr nonnull %4) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %3) #8
  %16 = add nuw nsw i32 %.01827, 1
  %17 = load i32, ptr @n, align 4, !tbaa !5
  %.not.not = icmp slt i32 %.01827, %17
  br i1 %.not.not, label %.lr.ph, label %.preheader, !llvm.loop !10

._crit_edge.loopexit:                             ; preds = %.lr.ph33
  %18 = trunc nuw i64 %indvars.iv.next46 to i32
  br label %._crit_edge

._crit_edge:                                      ; preds = %._crit_edge.loopexit, %.preheader
  %.121.lcssa = phi i32 [ %.020.lcssa, %.preheader ], [ %18, %._crit_edge.loopexit ]
  %19 = zext nneg i32 %.121.lcssa to i64
  %20 = getelementptr inbounds %struct.Query, ptr @q, i64 %19
  %21 = getelementptr inbounds i8, ptr %20, i64 20
  call void @_ZSt4sortIP5QueryEvT_S2_(ptr noundef nonnull getelementptr inbounds (i8, ptr @q, i64 20), ptr noundef nonnull %21)
  call void @_Z3cdqii(i32 noundef 1, i32 noundef %.121.lcssa)
  %22 = load i32, ptr @m, align 4, !tbaa !5
  %.not2335 = icmp slt i32 %22, 1
  br i1 %.not2335, label %._crit_edge39, label %.lr.ph38

.lr.ph33:                                         ; preds = %.lr.ph33.preheader, %.lr.ph33
  %indvars.iv45 = phi i64 [ %10, %.lr.ph33.preheader ], [ %indvars.iv.next46, %.lr.ph33 ]
  %.01732 = phi i32 [ 1, %.lr.ph33.preheader ], [ %30, %.lr.ph33 ]
  %.131 = phi i32 [ %.020.lcssa, %.lr.ph33.preheader ], [ %24, %.lr.ph33 ]
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %5) #8
  %23 = 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)
  call void @llvm.lifetime.start.p0(i64 20, ptr nonnull %6) #8
  %24 = add nuw nsw i32 %.131, 1
  %25 = load i32, ptr %5, align 4, !tbaa !5
  %26 = sext i32 %25 to i64
  %27 = getelementptr inbounds [505000 x i32], ptr @id, i64 0, i64 %26
  %28 = load i32, ptr %27, align 4, !tbaa !5
  call void @_ZN5QueryC2Eiiiii(ptr noundef nonnull align 4 dereferenceable(20) %6, i32 noundef %24, i32 noundef %28, i32 noundef %25, i32 noundef -1, i32 noundef %.01732)
  %indvars.iv.next46 = add nuw nsw i64 %indvars.iv45, 1
  %29 = getelementptr inbounds [2020000 x %struct.Query], ptr @q, i64 0, i64 %indvars.iv.next46
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 4 dereferenceable(20) %29, ptr noundef nonnull align 4 dereferenceable(20) %6, i64 20, i1 false), !tbaa.struct !9
  call void @llvm.lifetime.end.p0(i64 20, ptr nonnull %6) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %5) #8
  %30 = add nuw nsw i32 %.01732, 1
  %31 = load i32, ptr @m, align 4, !tbaa !5
  %.not22.not = icmp slt i32 %.01732, %31
  br i1 %.not22.not, label %.lr.ph33, label %._crit_edge.loopexit, !llvm.loop !12

._crit_edge39:                                    ; preds = %.lr.ph38, %._crit_edge
  ret i32 0

.lr.ph38:                                         ; preds = %._crit_edge, %.lr.ph38
  %indvars.iv49 = phi i64 [ %indvars.iv.next50, %.lr.ph38 ], [ 1, %._crit_edge ]
  %32 = add nsw i64 %indvars.iv49, -1
  %33 = getelementptr inbounds [2020000 x i64], ptr @ans, i64 0, i64 %32
  %34 = load i64, ptr %33, align 8, !tbaa !13
  %35 = getelementptr inbounds [2020000 x i64], ptr @ans, i64 0, i64 %indvars.iv49
  %36 = load i64, ptr %35, align 8, !tbaa !13
  %37 = add nsw i64 %36, %34
  store i64 %37, ptr %35, align 8, !tbaa !13
  %38 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i64 noundef %34)
  %39 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c(ptr noundef nonnull align 8 dereferenceable(8) %38, i8 noundef signext 10)
  %indvars.iv.next50 = add nuw nsw i64 %indvars.iv49, 1
  %40 = load i32, ptr @m, align 4, !tbaa !5
  %41 = sext i32 %40 to i64
  %.not23.not = icmp slt i64 %indvars.iv49, %41
  br i1 %.not23.not, label %.lr.ph38, label %._crit_edge39, !llvm.loop !15
}

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

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

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

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

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

; 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 nocallback nofree nounwind willreturn memory(argmem: readwrite) }
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 = { 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 #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 = { 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 #7 = { 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 #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 = !{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}
!10 = distinct !{!10, !11}
!11 = !{!"llvm.loop.mustprogress"}
!12 = distinct !{!12, !11}
!13 = !{!14, !14, i64 0}
!14 = !{!"long long", !7, i64 0}
!15 = distinct !{!15, !11}


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