; LLVM IR from tangjz/acm-icpc :: codeforces/complete (797E)

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

@n = external dso_local global i32, align 4
@q = external dso_local global i32, align 4
@sqn = external dso_local global i32, align 4
@a = external dso_local global [100001 x i32], align 16
@f = external dso_local global [321 x [100001 x %"struct.std::pair"]], align 16
@.str = external hidden unnamed_addr constant [3 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [4 x i8], align 1

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() #0 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  %7 = alloca %"struct.std::pair", align 4
  %8 = alloca i32, align 4
  %9 = alloca %"struct.std::pair", align 4
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  %12 = alloca i32, align 4
  %13 = alloca i32, align 4
  store i32 0, ptr %1, align 4
  %14 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef @n)
  store i32 1, ptr @sqn, align 4, !tbaa !5
  br label %15

15:                                               ; preds = %22, %0
  %16 = load i32, ptr @sqn, align 4, !tbaa !5
  %17 = load i32, ptr @sqn, align 4, !tbaa !5
  %18 = mul nsw i32 %16, %17
  %19 = load i32, ptr @n, align 4, !tbaa !5
  %20 = icmp sle i32 %18, %19
  br i1 %20, label %21, label %25

21:                                               ; preds = %15
  br label %22

22:                                               ; preds = %21
  %23 = load i32, ptr @sqn, align 4, !tbaa !5
  %24 = add nsw i32 %23, 1
  store i32 %24, ptr @sqn, align 4, !tbaa !5
  br label %15, !llvm.loop !9

25:                                               ; preds = %15
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #5
  store i32 1, ptr %2, align 4, !tbaa !5
  br label %26

26:                                               ; preds = %36, %25
  %27 = load i32, ptr %2, align 4, !tbaa !5
  %28 = load i32, ptr @n, align 4, !tbaa !5
  %29 = icmp sle i32 %27, %28
  br i1 %29, label %31, label %30

30:                                               ; preds = %26
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #5
  br label %39

31:                                               ; preds = %26
  %32 = load i32, ptr %2, align 4, !tbaa !5
  %33 = sext i32 %32 to i64
  %34 = getelementptr inbounds i32, ptr @a, i64 %33
  %35 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef %34)
  br label %36

36:                                               ; preds = %31
  %37 = load i32, ptr %2, align 4, !tbaa !5
  %38 = add nsw i32 %37, 1
  store i32 %38, ptr %2, align 4, !tbaa !5
  br label %26, !llvm.loop !11

39:                                               ; preds = %30
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #5
  store i32 1, ptr %3, align 4, !tbaa !5
  br label %40

40:                                               ; preds = %102, %39
  %41 = load i32, ptr %3, align 4, !tbaa !5
  %42 = load i32, ptr @sqn, align 4, !tbaa !5
  %43 = icmp slt i32 %41, %42
  br i1 %43, label %45, label %44

44:                                               ; preds = %40
  store i32 8, ptr %4, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #5
  br label %105

45:                                               ; preds = %40
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #5
  %46 = load i32, ptr @n, align 4, !tbaa !5
  store i32 %46, ptr %5, align 4, !tbaa !5
  br label %47

47:                                               ; preds = %98, %45
  %48 = load i32, ptr %5, align 4, !tbaa !5
  %49 = icmp sge i32 %48, 1
  br i1 %49, label %51, label %50

50:                                               ; preds = %47
  store i32 11, ptr %4, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #5
  br label %101

51:                                               ; preds = %47
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #5
  %52 = load i32, ptr %5, align 4, !tbaa !5
  %53 = load i32, ptr %5, align 4, !tbaa !5
  %54 = sext i32 %53 to i64
  %55 = getelementptr inbounds [100001 x i32], ptr @a, i64 0, i64 %54
  %56 = load i32, ptr %55, align 4, !tbaa !5
  %57 = add nsw i32 %52, %56
  %58 = load i32, ptr %3, align 4, !tbaa !5
  %59 = add nsw i32 %57, %58
  store i32 %59, ptr %6, align 4, !tbaa !5
  %60 = load i32, ptr %6, align 4, !tbaa !5
  %61 = load i32, ptr @n, align 4, !tbaa !5
  %62 = icmp sgt i32 %60, %61
  br i1 %62, label %63, label %72

63:                                               ; preds = %51
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #5
  store i32 1, ptr %8, align 4, !tbaa !5
  %64 = call i64 @_ZSt9make_pairIRiiESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 4 dereferenceable(4) %6, ptr noundef nonnull align 4 dereferenceable(4) %8)
  store i64 %64, ptr %7, align 4
  %65 = load i32, ptr %3, align 4, !tbaa !5
  %66 = sext i32 %65 to i64
  %67 = getelementptr inbounds [321 x [100001 x %"struct.std::pair"]], ptr @f, i64 0, i64 %66
  %68 = load i32, ptr %5, align 4, !tbaa !5
  %69 = sext i32 %68 to i64
  %70 = getelementptr inbounds [100001 x %"struct.std::pair"], ptr %67, i64 0, i64 %69
  %71 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt4pairIiiEaSEOS0_(ptr noundef nonnull align 4 dereferenceable(8) %70, ptr noundef nonnull align 4 dereferenceable(8) %7) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #5
  br label %97

72:                                               ; preds = %51
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #5
  %73 = load i32, ptr %3, align 4, !tbaa !5
  %74 = sext i32 %73 to i64
  %75 = getelementptr inbounds [321 x [100001 x %"struct.std::pair"]], ptr @f, i64 0, i64 %74
  %76 = load i32, ptr %6, align 4, !tbaa !5
  %77 = sext i32 %76 to i64
  %78 = getelementptr inbounds [100001 x %"struct.std::pair"], ptr %75, i64 0, i64 %77
  %79 = getelementptr inbounds %"struct.std::pair", ptr %78, i32 0, i32 0
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #5
  %80 = load i32, ptr %3, align 4, !tbaa !5
  %81 = sext i32 %80 to i64
  %82 = getelementptr inbounds [321 x [100001 x %"struct.std::pair"]], ptr @f, i64 0, i64 %81
  %83 = load i32, ptr %6, align 4, !tbaa !5
  %84 = sext i32 %83 to i64
  %85 = getelementptr inbounds [100001 x %"struct.std::pair"], ptr %82, i64 0, i64 %84
  %86 = getelementptr inbounds %"struct.std::pair", ptr %85, i32 0, i32 1
  %87 = load i32, ptr %86, align 4, !tbaa !12
  %88 = add nsw i32 %87, 1
  store i32 %88, ptr %10, align 4, !tbaa !5
  %89 = call i64 @_ZSt9make_pairIRiiESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 4 dereferenceable(4) %79, ptr noundef nonnull align 4 dereferenceable(4) %10)
  store i64 %89, ptr %9, align 4
  %90 = load i32, ptr %3, align 4, !tbaa !5
  %91 = sext i32 %90 to i64
  %92 = getelementptr inbounds [321 x [100001 x %"struct.std::pair"]], ptr @f, i64 0, i64 %91
  %93 = load i32, ptr %5, align 4, !tbaa !5
  %94 = sext i32 %93 to i64
  %95 = getelementptr inbounds [100001 x %"struct.std::pair"], ptr %92, i64 0, i64 %94
  %96 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt4pairIiiEaSEOS0_(ptr noundef nonnull align 4 dereferenceable(8) %95, ptr noundef nonnull align 4 dereferenceable(8) %9) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #5
  br label %97

97:                                               ; preds = %72, %63
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #5
  br label %98

98:                                               ; preds = %97
  %99 = load i32, ptr %5, align 4, !tbaa !5
  %100 = add nsw i32 %99, -1
  store i32 %100, ptr %5, align 4, !tbaa !5
  br label %47, !llvm.loop !14

101:                                              ; preds = %50
  br label %102

102:                                              ; preds = %101
  %103 = load i32, ptr %3, align 4, !tbaa !5
  %104 = add nsw i32 %103, 1
  store i32 %104, ptr %3, align 4, !tbaa !5
  br label %40, !llvm.loop !15

105:                                              ; preds = %44
  %106 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef @q)
  br label %107

107:                                              ; preds = %143, %105
  %108 = load i32, ptr @q, align 4, !tbaa !5
  %109 = add nsw i32 %108, -1
  store i32 %109, ptr @q, align 4, !tbaa !5
  %110 = icmp ne i32 %108, 0
  br i1 %110, label %111, label %146

111:                                              ; preds = %107
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #5
  store i32 0, ptr %13, align 4, !tbaa !5
  %112 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.1, ptr noundef %11, ptr noundef %12)
  %113 = load i32, ptr %12, align 4, !tbaa !5
  %114 = load i32, ptr @sqn, align 4, !tbaa !5
  %115 = icmp slt i32 %113, %114
  br i1 %115, label %116, label %125

116:                                              ; preds = %111
  %117 = load i32, ptr %12, align 4, !tbaa !5
  %118 = sext i32 %117 to i64
  %119 = getelementptr inbounds [321 x [100001 x %"struct.std::pair"]], ptr @f, i64 0, i64 %118
  %120 = load i32, ptr %11, align 4, !tbaa !5
  %121 = sext i32 %120 to i64
  %122 = getelementptr inbounds [100001 x %"struct.std::pair"], ptr %119, i64 0, i64 %121
  %123 = getelementptr inbounds %"struct.std::pair", ptr %122, i32 0, i32 1
  %124 = load i32, ptr %123, align 4, !tbaa !12
  store i32 %124, ptr %13, align 4, !tbaa !5
  br label %143

125:                                              ; preds = %111
  br label %126

126:                                              ; preds = %131, %125
  %127 = load i32, ptr %11, align 4, !tbaa !5
  %128 = load i32, ptr @n, align 4, !tbaa !5
  %129 = icmp sle i32 %127, %128
  br i1 %129, label %130, label %142

130:                                              ; preds = %126
  br label %131

131:                                              ; preds = %130
  %132 = load i32, ptr %11, align 4, !tbaa !5
  %133 = sext i32 %132 to i64
  %134 = getelementptr inbounds [100001 x i32], ptr @a, i64 0, i64 %133
  %135 = load i32, ptr %134, align 4, !tbaa !5
  %136 = load i32, ptr %12, align 4, !tbaa !5
  %137 = add nsw i32 %135, %136
  %138 = load i32, ptr %11, align 4, !tbaa !5
  %139 = add nsw i32 %138, %137
  store i32 %139, ptr %11, align 4, !tbaa !5
  %140 = load i32, ptr %13, align 4, !tbaa !5
  %141 = add nsw i32 %140, 1
  store i32 %141, ptr %13, align 4, !tbaa !5
  br label %126, !llvm.loop !16

142:                                              ; preds = %126
  br label %143

143:                                              ; preds = %142, %116
  %144 = load i32, ptr %13, align 4, !tbaa !5
  %145 = call i32 (ptr, ...) @printf(ptr noundef @.str.2, i32 noundef %144)
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #5
  br label %107, !llvm.loop !17

146:                                              ; preds = %107
  ret i32 0
}

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

; 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 i64 @_ZSt9make_pairIRiiESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4)) #3

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

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

attributes #0 = { 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 #1 = { "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 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 = { mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { 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 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = !{!13, !6, i64 4}
!13 = !{!"_ZTSSt4pairIiiE", !6, i64 0, !6, i64 4}
!14 = distinct !{!14, !10}
!15 = distinct !{!15, !10}
!16 = distinct !{!16, !10}
!17 = distinct !{!17, !10}


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

@n = external dso_local global i32, align 4
@q = external dso_local global i32, align 4
@sqn = external dso_local local_unnamed_addr global i32, align 4
@a = external dso_local global [100001 x i32], align 16
@f = external dso_local global [321 x [100001 x %"struct.std::pair"]], align 16
@.str = external hidden unnamed_addr constant [3 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [4 x i8], align 1

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #0 {
  %1 = alloca i32, align 4
  %2 = alloca %"struct.std::pair", align 8
  %3 = alloca i32, align 4
  %4 = alloca %"struct.std::pair", align 8
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  %8 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @n)
  %9 = load i32, ptr @n, align 4, !tbaa !5
  br label %10

10:                                               ; preds = %10, %0
  %storemerge = phi i32 [ 1, %0 ], [ %12, %10 ]
  %11 = mul nuw nsw i32 %storemerge, %storemerge
  %.not = icmp sgt i32 %11, %9
  %12 = add nuw nsw i32 %storemerge, 1
  br i1 %.not, label %.preheader27, label %10, !llvm.loop !9

.preheader27:                                     ; preds = %10
  store i32 %storemerge, ptr @sqn, align 4, !tbaa !5
  %.not2328 = icmp slt i32 %9, 1
  br i1 %.not2328, label %._crit_edge34, label %.lr.ph

.preheader26:                                     ; preds = %.lr.ph
  %.pre = load i32, ptr @sqn, align 4, !tbaa !5
  %13 = icmp slt i32 %17, 1
  %14 = icmp slt i32 %.pre, 2
  %brmerge = or i1 %14, %13
  br i1 %brmerge, label %._crit_edge34, label %.lr.ph33.split

.lr.ph:                                           ; preds = %.preheader27, %.lr.ph
  %indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph ], [ 1, %.preheader27 ]
  %15 = getelementptr inbounds i32, ptr @a, i64 %indvars.iv
  %16 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %15)
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %17 = load i32, ptr @n, align 4, !tbaa !5
  %18 = sext i32 %17 to i64
  %.not23.not = icmp slt i64 %indvars.iv, %18
  br i1 %.not23.not, label %.lr.ph, label %.preheader26, !llvm.loop !11

._crit_edge34:                                    ; preds = %._crit_edge, %.preheader26, %.preheader27
  %19 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @q)
  %20 = load i32, ptr @q, align 4, !tbaa !5
  %21 = add nsw i32 %20, -1
  store i32 %21, ptr @q, align 4, !tbaa !5
  %.not2438 = icmp eq i32 %20, 0
  br i1 %.not2438, label %._crit_edge41, label %.lr.ph40

.lr.ph33.split:                                   ; preds = %.preheader26, %._crit_edge
  %22 = phi i32 [ %27, %._crit_edge ], [ %.pre, %.preheader26 ]
  %indvars.iv48 = phi i64 [ %indvars.iv.next49, %._crit_edge ], [ 1, %.preheader26 ]
  %23 = load i32, ptr @n, align 4, !tbaa !5
  %24 = icmp sgt i32 %23, 0
  br i1 %24, label %.lr.ph31, label %._crit_edge

.lr.ph31:                                         ; preds = %.lr.ph33.split
  %25 = zext nneg i32 %23 to i64
  %26 = trunc nuw nsw i64 %indvars.iv48 to i32
  br label %30

._crit_edge.loopexit:                             ; preds = %51
  %.pre51 = load i32, ptr @sqn, align 4, !tbaa !5
  br label %._crit_edge

._crit_edge:                                      ; preds = %._crit_edge.loopexit, %.lr.ph33.split
  %27 = phi i32 [ %.pre51, %._crit_edge.loopexit ], [ %22, %.lr.ph33.split ]
  %indvars.iv.next49 = add nuw nsw i64 %indvars.iv48, 1
  %28 = sext i32 %27 to i64
  %29 = icmp slt i64 %indvars.iv.next49, %28
  br i1 %29, label %.lr.ph33.split, label %._crit_edge34, !llvm.loop !12

30:                                               ; preds = %.lr.ph31, %51
  %indvars.iv45 = phi i64 [ %25, %.lr.ph31 ], [ %indvars.iv.next46, %51 ]
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %1) #5
  %31 = getelementptr inbounds [100001 x i32], ptr @a, i64 0, i64 %indvars.iv45
  %32 = load i32, ptr %31, align 4, !tbaa !5
  %33 = trunc nuw nsw i64 %indvars.iv45 to i32
  %34 = add i32 %33, %26
  %35 = add i32 %34, %32
  store i32 %35, ptr %1, align 4, !tbaa !5
  %36 = load i32, ptr @n, align 4, !tbaa !5
  %37 = icmp sgt i32 %35, %36
  br i1 %37, label %38, label %42

38:                                               ; preds = %30
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %2) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %3) #5
  store i32 1, ptr %3, align 4, !tbaa !5
  %39 = call i64 @_ZSt9make_pairIRiiESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 4 dereferenceable(4) %1, ptr noundef nonnull align 4 dereferenceable(4) %3)
  store i64 %39, ptr %2, align 8
  %40 = getelementptr inbounds [321 x [100001 x %"struct.std::pair"]], ptr @f, i64 0, i64 %indvars.iv48, i64 %indvars.iv45
  %41 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt4pairIiiEaSEOS0_(ptr noundef nonnull align 4 dereferenceable(8) %40, ptr noundef nonnull align 4 dereferenceable(8) %2) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %3) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %2) #5
  br label %51

42:                                               ; preds = %30
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %4) #5
  %43 = sext i32 %35 to i64
  %44 = getelementptr inbounds [321 x [100001 x %"struct.std::pair"]], ptr @f, i64 0, i64 %indvars.iv48, i64 %43
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %5) #5
  %45 = getelementptr inbounds [321 x [100001 x %"struct.std::pair"]], ptr @f, i64 0, i64 %indvars.iv48, i64 %43, i32 1
  %46 = load i32, ptr %45, align 4, !tbaa !14
  %47 = add nsw i32 %46, 1
  store i32 %47, ptr %5, align 4, !tbaa !5
  %48 = call i64 @_ZSt9make_pairIRiiESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 4 dereferenceable(4) %44, ptr noundef nonnull align 4 dereferenceable(4) %5)
  store i64 %48, ptr %4, align 8
  %49 = getelementptr inbounds [321 x [100001 x %"struct.std::pair"]], ptr @f, i64 0, i64 %indvars.iv48, i64 %indvars.iv45
  %50 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt4pairIiiEaSEOS0_(ptr noundef nonnull align 4 dereferenceable(8) %49, ptr noundef nonnull align 4 dereferenceable(8) %4) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %5) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #5
  br label %51

51:                                               ; preds = %42, %38
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #5
  %indvars.iv.next46 = add nsw i64 %indvars.iv45, -1
  %52 = icmp sgt i64 %indvars.iv45, 1
  br i1 %52, label %30, label %._crit_edge.loopexit, !llvm.loop !16

.lr.ph40:                                         ; preds = %._crit_edge34, %.loopexit
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %6) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %7) #5
  %53 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %6, ptr noundef nonnull %7)
  %54 = load i32, ptr %7, align 4, !tbaa !5
  %55 = load i32, ptr @sqn, align 4, !tbaa !5
  %56 = icmp slt i32 %54, %55
  %57 = load i32, ptr %6, align 4, !tbaa !5
  br i1 %56, label %59, label %.preheader

.preheader:                                       ; preds = %.lr.ph40
  %58 = load i32, ptr @n, align 4, !tbaa !5
  %.not2535 = icmp sgt i32 %57, %58
  br i1 %.not2535, label %.loopexit, label %.lr.ph37

59:                                               ; preds = %.lr.ph40
  %60 = sext i32 %54 to i64
  %61 = sext i32 %57 to i64
  %62 = getelementptr inbounds [321 x [100001 x %"struct.std::pair"]], ptr @f, i64 0, i64 %60, i64 %61, i32 1
  %63 = load i32, ptr %62, align 4, !tbaa !14
  br label %.loopexit

.lr.ph37:                                         ; preds = %.preheader, %.lr.ph37
  %.036 = phi i32 [ %70, %.lr.ph37 ], [ 0, %.preheader ]
  %64 = phi i32 [ %69, %.lr.ph37 ], [ %57, %.preheader ]
  %65 = sext i32 %64 to i64
  %66 = getelementptr inbounds [100001 x i32], ptr @a, i64 0, i64 %65
  %67 = load i32, ptr %66, align 4, !tbaa !5
  %68 = add i32 %64, %54
  %69 = add i32 %68, %67
  %70 = add nuw nsw i32 %.036, 1
  %.not25 = icmp sgt i32 %69, %58
  br i1 %.not25, label %..loopexit_crit_edge, label %.lr.ph37, !llvm.loop !17

..loopexit_crit_edge:                             ; preds = %.lr.ph37
  store i32 %69, ptr %6, align 4, !tbaa !5
  br label %.loopexit

.loopexit:                                        ; preds = %.preheader, %..loopexit_crit_edge, %59
  %.1 = phi i32 [ %63, %59 ], [ %70, %..loopexit_crit_edge ], [ 0, %.preheader ]
  %71 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %.1)
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %7) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %6) #5
  %72 = load i32, ptr @q, align 4, !tbaa !5
  %73 = add nsw i32 %72, -1
  store i32 %73, ptr @q, align 4, !tbaa !5
  %.not24 = icmp eq i32 %72, 0
  br i1 %.not24, label %._crit_edge41, label %.lr.ph40, !llvm.loop !18

._crit_edge41:                                    ; preds = %.loopexit, %._crit_edge34
  ret i32 0
}

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

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

; Function Attrs: mustprogress 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 i64 @_ZSt9make_pairIRiiESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4)) local_unnamed_addr #3

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

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

attributes #0 = { 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 #1 = { 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 #2 = { mustprogress 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 = { mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { 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 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10, !13}
!13 = !{!"llvm.loop.unswitch.partial.disable"}
!14 = !{!15, !6, i64 4}
!15 = !{!"_ZTSSt4pairIiiE", !6, i64 0, !6, i64 4}
!16 = distinct !{!16, !10}
!17 = distinct !{!17, !10}
!18 = distinct !{!18, !10}


; Effective O3 passes: ADCEPass,CorrelatedValuePropagationPass,EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferAlignmentPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LICMPass,LoopRotatePass,LoopSimplifyCFGPass,LoopSimplifyPass,LoopUnrollPass,ReassociatePass,SROAPass,SimpleLoopUnswitchPass,SimplifyCFGPass,TailCallElimPass