; LLVM IR from VastoLorde95/Competitive-Programming :: Codeforces/Educational 14/Problem F (F)

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

%"class.std::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<std::pair<int, int>, std::allocator<std::pair<int, int>>>::_Vector_impl" }
%"struct.std::_Vector_base<std::pair<int, int>, std::allocator<std::pair<int, int>>>::_Vector_impl" = type { %"struct.std::_Vector_base<std::pair<int, int>, std::allocator<std::pair<int, int>>>::_Vector_impl_data" }
%"struct.std::_Vector_base<std::pair<int, int>, std::allocator<std::pair<int, int>>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"struct.std::pair" = type { i32, i32 }

@n = external dso_local global i32, align 4
@m = external dso_local global i32, align 4
@a = external dso_local global [3000002 x i32], align 16
@b = external dso_local global [3000002 x i64], align 16
@q = external dso_local global %"class.std::vector", align 8
@ans = external dso_local global [3000002 x i64], align 16
@.str = external hidden unnamed_addr constant [3 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [7 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 i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca i64, align 8
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  %12 = alloca %"struct.std::pair", align 4
  %13 = alloca i32, align 4
  %14 = alloca i32, align 4
  %15 = alloca i32, align 4
  %16 = alloca i32, align 4
  store i32 0, ptr %1, align 4
  %17 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef @n)
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #5
  store i32 1, ptr %2, align 4, !tbaa !5
  br label %18

18:                                               ; preds = %30, %0
  %19 = load i32, ptr %2, align 4, !tbaa !5
  %20 = load i32, ptr @n, align 4, !tbaa !5
  %21 = icmp sle i32 %19, %20
  br i1 %21, label %23, label %22

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

23:                                               ; preds = %18
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #5
  %24 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef %3)
  %25 = load i32, ptr %3, align 4, !tbaa !5
  %26 = sext i32 %25 to i64
  %27 = getelementptr inbounds [3000002 x i32], ptr @a, i64 0, i64 %26
  %28 = load i32, ptr %27, align 4, !tbaa !5
  %29 = add nsw i32 %28, 1
  store i32 %29, ptr %27, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #5
  br label %30

30:                                               ; preds = %23
  %31 = load i32, ptr %2, align 4, !tbaa !5
  %32 = add nsw i32 %31, 1
  store i32 %32, ptr %2, align 4, !tbaa !5
  br label %18, !llvm.loop !9

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

34:                                               ; preds = %89, %33
  %35 = load i32, ptr %4, align 4, !tbaa !5
  %36 = icmp slt i32 %35, 3000002
  br i1 %36, label %38, label %37

37:                                               ; preds = %34
  store i32 5, ptr %5, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #5
  br label %92

38:                                               ; preds = %34
  %39 = load i32, ptr %4, align 4, !tbaa !5
  %40 = sext i32 %39 to i64
  %41 = getelementptr inbounds [3000002 x i32], ptr @a, i64 0, i64 %40
  %42 = load i32, ptr %41, align 4, !tbaa !5
  %43 = icmp ne i32 %42, 0
  br i1 %43, label %44, label %88

44:                                               ; preds = %38
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #5
  %45 = load i32, ptr %4, align 4, !tbaa !5
  store i32 %45, ptr %6, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #5
  store i32 1, ptr %7, align 4, !tbaa !5
  br label %46

46:                                               ; preds = %81, %44
  %47 = load i32, ptr %6, align 4, !tbaa !5
  %48 = icmp slt i32 %47, 3000002
  br i1 %48, label %50, label %49

49:                                               ; preds = %46
  store i32 8, ptr %5, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #5
  br label %87

50:                                               ; preds = %46
  %51 = load i32, ptr %4, align 4, !tbaa !5
  %52 = sext i32 %51 to i64
  %53 = getelementptr inbounds [3000002 x i32], ptr @a, i64 0, i64 %52
  %54 = load i32, ptr %53, align 4, !tbaa !5
  %55 = load i32, ptr %7, align 4, !tbaa !5
  %56 = sext i32 %55 to i64
  %57 = getelementptr inbounds [3000002 x i32], ptr @a, i64 0, i64 %56
  %58 = load i32, ptr %57, align 4, !tbaa !5
  %59 = mul nsw i32 %54, %58
  %60 = sext i32 %59 to i64
  %61 = load i32, ptr %6, align 4, !tbaa !5
  %62 = sext i32 %61 to i64
  %63 = getelementptr inbounds [3000002 x i64], ptr @b, i64 0, i64 %62
  %64 = load i64, ptr %63, align 8, !tbaa !11
  %65 = add nsw i64 %64, %60
  store i64 %65, ptr %63, align 8, !tbaa !11
  %66 = load i32, ptr %4, align 4, !tbaa !5
  %67 = load i32, ptr %7, align 4, !tbaa !5
  %68 = icmp eq i32 %66, %67
  br i1 %68, label %69, label %80

69:                                               ; preds = %50
  %70 = load i32, ptr %4, align 4, !tbaa !5
  %71 = sext i32 %70 to i64
  %72 = getelementptr inbounds [3000002 x i32], ptr @a, i64 0, i64 %71
  %73 = load i32, ptr %72, align 4, !tbaa !5
  %74 = sext i32 %73 to i64
  %75 = load i32, ptr %6, align 4, !tbaa !5
  %76 = sext i32 %75 to i64
  %77 = getelementptr inbounds [3000002 x i64], ptr @b, i64 0, i64 %76
  %78 = load i64, ptr %77, align 8, !tbaa !11
  %79 = sub nsw i64 %78, %74
  store i64 %79, ptr %77, align 8, !tbaa !11
  br label %80

80:                                               ; preds = %69, %50
  br label %81

81:                                               ; preds = %80
  %82 = load i32, ptr %4, align 4, !tbaa !5
  %83 = load i32, ptr %6, align 4, !tbaa !5
  %84 = add nsw i32 %83, %82
  store i32 %84, ptr %6, align 4, !tbaa !5
  %85 = load i32, ptr %7, align 4, !tbaa !5
  %86 = add nsw i32 %85, 1
  store i32 %86, ptr %7, align 4, !tbaa !5
  br label %46, !llvm.loop !13

87:                                               ; preds = %49
  br label %88

88:                                               ; preds = %87, %38
  br label %89

89:                                               ; preds = %88
  %90 = load i32, ptr %4, align 4, !tbaa !5
  %91 = add nsw i32 %90, 1
  store i32 %91, ptr %4, align 4, !tbaa !5
  br label %34, !llvm.loop !14

92:                                               ; preds = %37
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #5
  store i32 1, ptr %8, align 4, !tbaa !5
  br label %93

93:                                               ; preds = %108, %92
  %94 = load i32, ptr %8, align 4, !tbaa !5
  %95 = icmp slt i32 %94, 3000002
  br i1 %95, label %97, label %96

96:                                               ; preds = %93
  store i32 11, ptr %5, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #5
  br label %111

97:                                               ; preds = %93
  %98 = load i32, ptr %8, align 4, !tbaa !5
  %99 = sub nsw i32 %98, 1
  %100 = sext i32 %99 to i64
  %101 = getelementptr inbounds [3000002 x i64], ptr @b, i64 0, i64 %100
  %102 = load i64, ptr %101, align 8, !tbaa !11
  %103 = load i32, ptr %8, align 4, !tbaa !5
  %104 = sext i32 %103 to i64
  %105 = getelementptr inbounds [3000002 x i64], ptr @b, i64 0, i64 %104
  %106 = load i64, ptr %105, align 8, !tbaa !11
  %107 = add nsw i64 %106, %102
  store i64 %107, ptr %105, align 8, !tbaa !11
  br label %108

108:                                              ; preds = %97
  %109 = load i32, ptr %8, align 4, !tbaa !5
  %110 = add nsw i32 %109, 1
  store i32 %110, ptr %8, align 4, !tbaa !5
  br label %93, !llvm.loop !15

111:                                              ; preds = %96
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #5
  %112 = load i32, ptr @n, align 4, !tbaa !5
  %113 = sext i32 %112 to i64
  %114 = mul nsw i64 1, %113
  %115 = load i32, ptr @n, align 4, !tbaa !5
  %116 = sub nsw i32 %115, 1
  %117 = sext i32 %116 to i64
  %118 = mul nsw i64 %114, %117
  store i64 %118, ptr %9, align 8, !tbaa !11
  %119 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef @m)
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #5
  store i32 1, ptr %10, align 4, !tbaa !5
  br label %120

120:                                              ; preds = %128, %111
  %121 = load i32, ptr %10, align 4, !tbaa !5
  %122 = load i32, ptr @m, align 4, !tbaa !5
  %123 = icmp sle i32 %121, %122
  br i1 %123, label %125, label %124

124:                                              ; preds = %120
  store i32 14, ptr %5, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #5
  br label %131

125:                                              ; preds = %120
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #5
  %126 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef %11)
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #5
  %127 = call i64 @_ZSt9make_pairIRiS0_ESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 4 dereferenceable(4) %11, ptr noundef nonnull align 4 dereferenceable(4) %10)
  store i64 %127, ptr %12, align 4
  call void @_ZNSt6vectorISt4pairIiiESaIS1_EE9push_backEOS1_(ptr noundef nonnull align 8 dereferenceable(24) @q, ptr noundef nonnull align 4 dereferenceable(8) %12)
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #5
  br label %128

128:                                              ; preds = %125
  %129 = load i32, ptr %10, align 4, !tbaa !5
  %130 = add nsw i32 %129, 1
  store i32 %130, ptr %10, align 4, !tbaa !5
  br label %120, !llvm.loop !16

131:                                              ; preds = %124
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #5
  store i32 0, ptr %13, align 4, !tbaa !5
  br label %132

132:                                              ; preds = %158, %131
  %133 = load i32, ptr %13, align 4, !tbaa !5
  %134 = load i32, ptr @m, align 4, !tbaa !5
  %135 = icmp slt i32 %133, %134
  br i1 %135, label %137, label %136

136:                                              ; preds = %132
  store i32 17, ptr %5, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #5
  br label %161

137:                                              ; preds = %132
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #5
  %138 = load i32, ptr %13, align 4, !tbaa !5
  %139 = sext i32 %138 to i64
  %140 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt6vectorISt4pairIiiESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) @q, i64 noundef %139) #5
  %141 = getelementptr inbounds %"struct.std::pair", ptr %140, i32 0, i32 0
  %142 = load i32, ptr %141, align 4, !tbaa !17
  store i32 %142, ptr %14, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #5
  %143 = load i32, ptr %13, align 4, !tbaa !5
  %144 = sext i32 %143 to i64
  %145 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt6vectorISt4pairIiiESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) @q, i64 noundef %144) #5
  %146 = getelementptr inbounds %"struct.std::pair", ptr %145, i32 0, i32 1
  %147 = load i32, ptr %146, align 4, !tbaa !19
  store i32 %147, ptr %15, align 4, !tbaa !5
  %148 = load i64, ptr %9, align 8, !tbaa !11
  %149 = load i32, ptr %14, align 4, !tbaa !5
  %150 = sub nsw i32 %149, 1
  %151 = sext i32 %150 to i64
  %152 = getelementptr inbounds [3000002 x i64], ptr @b, i64 0, i64 %151
  %153 = load i64, ptr %152, align 8, !tbaa !11
  %154 = sub nsw i64 %148, %153
  %155 = load i32, ptr %15, align 4, !tbaa !5
  %156 = sext i32 %155 to i64
  %157 = getelementptr inbounds [3000002 x i64], ptr @ans, i64 0, i64 %156
  store i64 %154, ptr %157, align 8, !tbaa !11
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #5
  br label %158

158:                                              ; preds = %137
  %159 = load i32, ptr %13, align 4, !tbaa !5
  %160 = add nsw i32 %159, 1
  store i32 %160, ptr %13, align 4, !tbaa !5
  br label %132, !llvm.loop !20

161:                                              ; preds = %136
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #5
  store i32 1, ptr %16, align 4, !tbaa !5
  br label %162

162:                                              ; preds = %173, %161
  %163 = load i32, ptr %16, align 4, !tbaa !5
  %164 = load i32, ptr @m, align 4, !tbaa !5
  %165 = icmp sle i32 %163, %164
  br i1 %165, label %167, label %166

166:                                              ; preds = %162
  store i32 20, ptr %5, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #5
  br label %176

167:                                              ; preds = %162
  %168 = load i32, ptr %16, align 4, !tbaa !5
  %169 = sext i32 %168 to i64
  %170 = getelementptr inbounds [3000002 x i64], ptr @ans, i64 0, i64 %169
  %171 = load i64, ptr %170, align 8, !tbaa !11
  %172 = call i32 (ptr, ...) @printf(ptr noundef @.str.2, i64 noundef %171)
  br label %173

173:                                              ; preds = %167
  %174 = load i32, ptr %16, align 4, !tbaa !5
  %175 = add nsw i32 %174, 1
  store i32 %175, ptr %16, align 4, !tbaa !5
  br label %162, !llvm.loop !21

176:                                              ; preds = %166
  store i32 0, ptr %1, align 4
  store i32 1, ptr %5, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #5
  %177 = load i32, ptr %1, align 4
  ret i32 %177
}

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 void @_ZNSt6vectorISt4pairIiiESaIS1_EE9push_backEOS1_(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 4 dereferenceable(8)) #3 align 2

; Function Attrs: mustprogress uwtable
declare dso_local i64 @_ZSt9make_pairIRiS0_ESt4pairINSt25__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 @_ZNSt6vectorISt4pairIiiESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24), i64 noundef) #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 = !{!12, !12, i64 0}
!12 = !{!"long long", !7, i64 0}
!13 = distinct !{!13, !10}
!14 = distinct !{!14, !10}
!15 = distinct !{!15, !10}
!16 = distinct !{!16, !10}
!17 = !{!18, !6, i64 0}
!18 = !{!"_ZTSSt4pairIiiE", !6, i64 0, !6, i64 4}
!19 = !{!18, !6, i64 4}
!20 = distinct !{!20, !10}
!21 = distinct !{!21, !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"

%"class.std::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<std::pair<int, int>, std::allocator<std::pair<int, int>>>::_Vector_impl" }
%"struct.std::_Vector_base<std::pair<int, int>, std::allocator<std::pair<int, int>>>::_Vector_impl" = type { %"struct.std::_Vector_base<std::pair<int, int>, std::allocator<std::pair<int, int>>>::_Vector_impl_data" }
%"struct.std::_Vector_base<std::pair<int, int>, std::allocator<std::pair<int, int>>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"struct.std::pair" = type { i32, i32 }

@n = external dso_local global i32, align 4
@m = external dso_local global i32, align 4
@a = external dso_local local_unnamed_addr global [3000002 x i32], align 16
@b = external dso_local local_unnamed_addr global [3000002 x i64], align 16
@q = external dso_local global %"class.std::vector", align 8
@ans = external dso_local local_unnamed_addr global [3000002 x i64], align 16
@.str = external hidden unnamed_addr constant [3 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [7 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 i32, align 4
  %3 = alloca i32, align 4
  %4 = alloca %"struct.std::pair", align 8
  %5 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @n)
  %6 = load i32, ptr @n, align 4, !tbaa !5
  %.not45 = icmp slt i32 %6, 1
  br i1 %.not45, label %.preheader44, label %.lr.ph

.preheader44:                                     ; preds = %.lr.ph, %0
  %.lcssa = phi i32 [ %6, %0 ], [ %14, %.lr.ph ]
  br label %15

.lr.ph:                                           ; preds = %0, %.lr.ph
  %.03246 = phi i32 [ %13, %.lr.ph ], [ 1, %0 ]
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %1) #5
  %7 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %1)
  %8 = load i32, ptr %1, align 4, !tbaa !5
  %9 = sext i32 %8 to i64
  %10 = getelementptr inbounds [3000002 x i32], ptr @a, i64 0, i64 %9
  %11 = load i32, ptr %10, align 4, !tbaa !5
  %12 = add nsw i32 %11, 1
  store i32 %12, ptr %10, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #5
  %13 = add nuw nsw i32 %.03246, 1
  %14 = load i32, ptr @n, align 4, !tbaa !5
  %.not.not = icmp slt i32 %.03246, %14
  br i1 %.not.not, label %.lr.ph, label %.preheader44, !llvm.loop !9

15:                                               ; preds = %.preheader44, %.loopexit
  %indvars.iv63 = phi i64 [ 1, %.preheader44 ], [ %indvars.iv.next64, %.loopexit ]
  %16 = getelementptr inbounds [3000002 x i32], ptr @a, i64 0, i64 %indvars.iv63
  %17 = load i32, ptr %16, align 4, !tbaa !5
  %.not40.not = icmp eq i32 %17, 0
  br i1 %.not40.not, label %.loopexit, label %.lr.ph49

.lr.ph49:                                         ; preds = %15
  %18 = sext i32 %17 to i64
  br label %19

19:                                               ; preds = %.lr.ph49, %19
  %indvars.iv65 = phi i64 [ %indvars.iv63, %.lr.ph49 ], [ %indvars.iv.next66, %19 ]
  %indvars.iv = phi i64 [ 1, %.lr.ph49 ], [ %indvars.iv.next, %19 ]
  %20 = getelementptr inbounds [3000002 x i32], ptr @a, i64 0, i64 %indvars.iv
  %21 = load i32, ptr %20, align 4, !tbaa !5
  %22 = mul nsw i32 %21, %17
  %23 = sext i32 %22 to i64
  %24 = getelementptr inbounds [3000002 x i64], ptr @b, i64 0, i64 %indvars.iv65
  %25 = load i64, ptr %24, align 8, !tbaa !11
  %26 = add nsw i64 %25, %23
  %27 = icmp eq i64 %indvars.iv63, %indvars.iv
  %28 = select i1 %27, i64 %18, i64 0
  %storemerge41 = sub nsw i64 %26, %28
  store i64 %storemerge41, ptr %24, align 8, !tbaa !11
  %indvars.iv.next66 = add nuw nsw i64 %indvars.iv65, %indvars.iv63
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %29 = icmp ult i64 %indvars.iv.next66, 3000002
  br i1 %29, label %19, label %.loopexit, !llvm.loop !13

.loopexit:                                        ; preds = %19, %15
  %indvars.iv.next64 = add nuw nsw i64 %indvars.iv63, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next64, 3000002
  br i1 %exitcond.not, label %.preheader42.preheader, label %15, !llvm.loop !14

.preheader42.preheader:                           ; preds = %.loopexit
  %.pre = load i64, ptr @b, align 16, !tbaa !11
  br label %.preheader42

30:                                               ; preds = %.preheader42
  %31 = sext i32 %.lcssa to i64
  %32 = add nsw i32 %.lcssa, -1
  %33 = sext i32 %32 to i64
  %34 = mul nsw i64 %33, %31
  %35 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @m)
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %2) #5
  store i32 1, ptr %2, align 4, !tbaa !5
  %36 = load i32, ptr @m, align 4, !tbaa !5
  %.not3853 = icmp slt i32 %36, 1
  br i1 %.not3853, label %._crit_edge.thread, label %.lr.ph54

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

.preheader42:                                     ; preds = %.preheader42.1, %.preheader42.preheader
  %37 = phi i64 [ %.pre, %.preheader42.preheader ], [ %49, %.preheader42.1 ]
  %indvars.iv71 = phi i64 [ 1, %.preheader42.preheader ], [ %indvars.iv.next72.3, %.preheader42.1 ]
  %38 = getelementptr inbounds [3000002 x i64], ptr @b, i64 0, i64 %indvars.iv71
  %39 = load i64, ptr %38, align 8, !tbaa !11
  %40 = add nsw i64 %39, %37
  store i64 %40, ptr %38, align 8, !tbaa !11
  %indvars.iv.next72 = add nuw nsw i64 %indvars.iv71, 1
  %exitcond74.not = icmp eq i64 %indvars.iv.next72, 3000002
  br i1 %exitcond74.not, label %30, label %.preheader42.1, !llvm.loop !15

.preheader42.1:                                   ; preds = %.preheader42
  %41 = getelementptr inbounds [3000002 x i64], ptr @b, i64 0, i64 %indvars.iv.next72
  %42 = load i64, ptr %41, align 8, !tbaa !11
  %43 = add nsw i64 %42, %40
  store i64 %43, ptr %41, align 8, !tbaa !11
  %indvars.iv.next72.1 = add nuw nsw i64 %indvars.iv71, 2
  %44 = getelementptr inbounds [3000002 x i64], ptr @b, i64 0, i64 %indvars.iv.next72.1
  %45 = load i64, ptr %44, align 8, !tbaa !11
  %46 = add nsw i64 %45, %43
  store i64 %46, ptr %44, align 8, !tbaa !11
  %indvars.iv.next72.2 = add nuw nsw i64 %indvars.iv71, 3
  %47 = getelementptr inbounds [3000002 x i64], ptr @b, i64 0, i64 %indvars.iv.next72.2
  %48 = load i64, ptr %47, align 8, !tbaa !11
  %49 = add nsw i64 %48, %46
  store i64 %49, ptr %47, align 8, !tbaa !11
  %indvars.iv.next72.3 = add nuw nsw i64 %indvars.iv71, 4
  br label %.preheader42

._crit_edge:                                      ; preds = %.lr.ph54
  %50 = icmp sgt i32 %55, 0
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %2) #5
  br i1 %50, label %.lr.ph57, label %._crit_edge61

.lr.ph54:                                         ; preds = %30, %.lr.ph54
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %3) #5
  %51 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %3)
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %4) #5
  %52 = call i64 @_ZSt9make_pairIRiS0_ESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 4 dereferenceable(4) %3, ptr noundef nonnull align 4 dereferenceable(4) %2)
  store i64 %52, ptr %4, align 8
  call void @_ZNSt6vectorISt4pairIiiESaIS1_EE9push_backEOS1_(ptr noundef nonnull align 8 dereferenceable(24) @q, ptr noundef nonnull align 4 dereferenceable(8) %4)
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %3) #5
  %53 = load i32, ptr %2, align 4, !tbaa !5
  %54 = add nsw i32 %53, 1
  store i32 %54, ptr %2, align 4, !tbaa !5
  %55 = load i32, ptr @m, align 4, !tbaa !5
  %.not38.not = icmp slt i32 %53, %55
  br i1 %.not38.not, label %.lr.ph54, label %._crit_edge, !llvm.loop !16

.preheader:                                       ; preds = %.lr.ph57
  %56 = icmp slt i32 %69, 1
  br i1 %56, label %._crit_edge61, label %.lr.ph60

.lr.ph57:                                         ; preds = %._crit_edge, %.lr.ph57
  %indvars.iv75 = phi i64 [ %indvars.iv.next76, %.lr.ph57 ], [ 0, %._crit_edge ]
  %57 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt6vectorISt4pairIiiESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) @q, i64 noundef %indvars.iv75) #5
  %58 = load i32, ptr %57, align 4, !tbaa !17
  %59 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt6vectorISt4pairIiiESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) @q, i64 noundef %indvars.iv75) #5
  %60 = getelementptr inbounds i8, ptr %59, i64 4
  %61 = load i32, ptr %60, align 4, !tbaa !19
  %62 = add nsw i32 %58, -1
  %63 = sext i32 %62 to i64
  %64 = getelementptr inbounds [3000002 x i64], ptr @b, i64 0, i64 %63
  %65 = load i64, ptr %64, align 8, !tbaa !11
  %66 = sub nsw i64 %34, %65
  %67 = sext i32 %61 to i64
  %68 = getelementptr inbounds [3000002 x i64], ptr @ans, i64 0, i64 %67
  store i64 %66, ptr %68, align 8, !tbaa !11
  %indvars.iv.next76 = add nuw nsw i64 %indvars.iv75, 1
  %69 = load i32, ptr @m, align 4, !tbaa !5
  %70 = sext i32 %69 to i64
  %71 = icmp slt i64 %indvars.iv.next76, %70
  br i1 %71, label %.lr.ph57, label %.preheader, !llvm.loop !20

._crit_edge61:                                    ; preds = %.lr.ph60, %._crit_edge.thread, %._crit_edge, %.preheader
  ret i32 0

.lr.ph60:                                         ; preds = %.preheader, %.lr.ph60
  %indvars.iv78 = phi i64 [ %indvars.iv.next79, %.lr.ph60 ], [ 1, %.preheader ]
  %72 = getelementptr inbounds [3000002 x i64], ptr @ans, i64 0, i64 %indvars.iv78
  %73 = load i64, ptr %72, align 8, !tbaa !11
  %74 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i64 noundef %73)
  %indvars.iv.next79 = add nuw nsw i64 %indvars.iv78, 1
  %75 = load i32, ptr @m, align 4, !tbaa !5
  %76 = sext i32 %75 to i64
  %.not39.not = icmp slt i64 %indvars.iv78, %76
  br i1 %.not39.not, label %.lr.ph60, label %._crit_edge61, !llvm.loop !21
}

; 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 void @_ZNSt6vectorISt4pairIiiESaIS1_EE9push_backEOS1_(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 4 dereferenceable(8)) local_unnamed_addr #3 align 2

; Function Attrs: mustprogress uwtable
declare dso_local i64 @_ZSt9make_pairIRiS0_ESt4pairINSt25__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 @_ZNSt6vectorISt4pairIiiESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24), i64 noundef) 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 = !{!12, !12, i64 0}
!12 = !{!"long long", !7, i64 0}
!13 = distinct !{!13, !10}
!14 = distinct !{!14, !10}
!15 = distinct !{!15, !10}
!16 = distinct !{!16, !10}
!17 = !{!18, !6, i64 0}
!18 = !{!"_ZTSSt4pairIiiE", !6, i64 0, !6, i64 4}
!19 = !{!18, !6, i64 4}
!20 = distinct !{!20, !10}
!21 = distinct !{!21, !10}


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