; LLVM IR from tangjz/acm-icpc :: lydsy (2694)

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

@tot = external dso_local global i32, align 4
@pr = external dso_local global [500001 x i32], align 16
@d = external dso_local global [4000001 x i32], align 16
@f = external dso_local global [4000001 x i32], 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 i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  %12 = alloca i32, align 4
  %13 = alloca i32, align 4
  %14 = alloca i32, align 4
  store i32 0, ptr %1, align 4
  store i32 1, ptr getelementptr inbounds ([4000001 x i32], ptr @f, i64 0, i64 1), align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #4
  store i32 2, ptr %2, align 4, !tbaa !5
  br label %15

15:                                               ; preds = %124, %0
  %16 = load i32, ptr %2, align 4, !tbaa !5
  %17 = icmp slt i32 %16, 4000001
  br i1 %17, label %19, label %18

18:                                               ; preds = %15
  store i32 2, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #4
  br label %127

19:                                               ; preds = %15
  %20 = load i32, ptr %2, align 4, !tbaa !5
  %21 = sext i32 %20 to i64
  %22 = getelementptr inbounds [4000001 x i32], ptr @d, i64 0, i64 %21
  %23 = load i32, ptr %22, align 4, !tbaa !5
  %24 = icmp ne i32 %23, 0
  br i1 %24, label %39, label %25

25:                                               ; preds = %19
  %26 = load i32, ptr %2, align 4, !tbaa !5
  %27 = load i32, ptr %2, align 4, !tbaa !5
  %28 = sext i32 %27 to i64
  %29 = getelementptr inbounds [4000001 x i32], ptr @d, i64 0, i64 %28
  store i32 %26, ptr %29, align 4, !tbaa !5
  %30 = load i32, ptr @tot, align 4, !tbaa !5
  %31 = add nsw i32 %30, 1
  store i32 %31, ptr @tot, align 4, !tbaa !5
  %32 = sext i32 %30 to i64
  %33 = getelementptr inbounds [500001 x i32], ptr @pr, i64 0, i64 %32
  store i32 %26, ptr %33, align 4, !tbaa !5
  %34 = load i32, ptr %2, align 4, !tbaa !5
  %35 = sub nsw i32 1, %34
  %36 = load i32, ptr %2, align 4, !tbaa !5
  %37 = sext i32 %36 to i64
  %38 = getelementptr inbounds [4000001 x i32], ptr @f, i64 0, i64 %37
  store i32 %35, ptr %38, align 4, !tbaa !5
  br label %39

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

40:                                               ; preds = %119, %39
  %41 = load i32, ptr %2, align 4, !tbaa !5
  %42 = load i32, ptr %4, align 4, !tbaa !5
  %43 = sext i32 %42 to i64
  %44 = getelementptr inbounds [500001 x i32], ptr @pr, i64 0, i64 %43
  %45 = load i32, ptr %44, align 4, !tbaa !5
  %46 = mul nsw i32 %41, %45
  store i32 %46, ptr %5, align 4, !tbaa !5
  %47 = icmp slt i32 %46, 4000001
  br i1 %47, label %49, label %48

48:                                               ; preds = %40
  store i32 5, ptr %3, align 4
  br label %122

49:                                               ; preds = %40
  %50 = load i32, ptr %4, align 4, !tbaa !5
  %51 = sext i32 %50 to i64
  %52 = getelementptr inbounds [500001 x i32], ptr @pr, i64 0, i64 %51
  %53 = load i32, ptr %52, align 4, !tbaa !5
  %54 = load i32, ptr %5, align 4, !tbaa !5
  %55 = sext i32 %54 to i64
  %56 = getelementptr inbounds [4000001 x i32], ptr @d, i64 0, i64 %55
  store i32 %53, ptr %56, align 4, !tbaa !5
  %57 = load i32, ptr %2, align 4, !tbaa !5
  %58 = sext i32 %57 to i64
  %59 = getelementptr inbounds [4000001 x i32], ptr @d, i64 0, i64 %58
  %60 = load i32, ptr %59, align 4, !tbaa !5
  %61 = load i32, ptr %4, align 4, !tbaa !5
  %62 = sext i32 %61 to i64
  %63 = getelementptr inbounds [500001 x i32], ptr @pr, i64 0, i64 %62
  %64 = load i32, ptr %63, align 4, !tbaa !5
  %65 = icmp eq i32 %60, %64
  br i1 %65, label %66, label %102

66:                                               ; preds = %49
  %67 = load i32, ptr %2, align 4, !tbaa !5
  %68 = load i32, ptr %4, align 4, !tbaa !5
  %69 = sext i32 %68 to i64
  %70 = getelementptr inbounds [500001 x i32], ptr @pr, i64 0, i64 %69
  %71 = load i32, ptr %70, align 4, !tbaa !5
  %72 = sdiv i32 %67, %71
  %73 = sext i32 %72 to i64
  %74 = getelementptr inbounds [4000001 x i32], ptr @d, i64 0, i64 %73
  %75 = load i32, ptr %74, align 4, !tbaa !5
  %76 = load i32, ptr %4, align 4, !tbaa !5
  %77 = sext i32 %76 to i64
  %78 = getelementptr inbounds [500001 x i32], ptr @pr, i64 0, i64 %77
  %79 = load i32, ptr %78, align 4, !tbaa !5
  %80 = icmp eq i32 %75, %79
  br i1 %80, label %81, label %82

81:                                               ; preds = %66
  br label %97

82:                                               ; preds = %66
  %83 = load i32, ptr %2, align 4, !tbaa !5
  %84 = sext i32 %83 to i64
  %85 = getelementptr inbounds [4000001 x i32], ptr @f, i64 0, i64 %84
  %86 = load i32, ptr %85, align 4, !tbaa !5
  %87 = load i32, ptr %2, align 4, !tbaa !5
  %88 = load i32, ptr %4, align 4, !tbaa !5
  %89 = sext i32 %88 to i64
  %90 = getelementptr inbounds [500001 x i32], ptr @pr, i64 0, i64 %89
  %91 = load i32, ptr %90, align 4, !tbaa !5
  %92 = sdiv i32 %87, %91
  %93 = sext i32 %92 to i64
  %94 = getelementptr inbounds [4000001 x i32], ptr @f, i64 0, i64 %93
  %95 = load i32, ptr %94, align 4, !tbaa !5
  %96 = sub nsw i32 %86, %95
  br label %97

97:                                               ; preds = %82, %81
  %98 = phi i32 [ 0, %81 ], [ %96, %82 ]
  %99 = load i32, ptr %5, align 4, !tbaa !5
  %100 = sext i32 %99 to i64
  %101 = getelementptr inbounds [4000001 x i32], ptr @f, i64 0, i64 %100
  store i32 %98, ptr %101, align 4, !tbaa !5
  store i32 5, ptr %3, align 4
  br label %122

102:                                              ; preds = %49
  %103 = load i32, ptr %2, align 4, !tbaa !5
  %104 = sext i32 %103 to i64
  %105 = getelementptr inbounds [4000001 x i32], ptr @f, i64 0, i64 %104
  %106 = load i32, ptr %105, align 4, !tbaa !5
  %107 = load i32, ptr %4, align 4, !tbaa !5
  %108 = sext i32 %107 to i64
  %109 = getelementptr inbounds [500001 x i32], ptr @pr, i64 0, i64 %108
  %110 = load i32, ptr %109, align 4, !tbaa !5
  %111 = sext i32 %110 to i64
  %112 = getelementptr inbounds [4000001 x i32], ptr @f, i64 0, i64 %111
  %113 = load i32, ptr %112, align 4, !tbaa !5
  %114 = mul nsw i32 %106, %113
  %115 = load i32, ptr %5, align 4, !tbaa !5
  %116 = sext i32 %115 to i64
  %117 = getelementptr inbounds [4000001 x i32], ptr @f, i64 0, i64 %116
  store i32 %114, ptr %117, align 4, !tbaa !5
  br label %118

118:                                              ; preds = %102
  br label %119

119:                                              ; preds = %118
  %120 = load i32, ptr %4, align 4, !tbaa !5
  %121 = add nsw i32 %120, 1
  store i32 %121, ptr %4, align 4, !tbaa !5
  br label %40, !llvm.loop !9

122:                                              ; preds = %97, %48
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #4
  br label %123

123:                                              ; preds = %122
  br label %124

124:                                              ; preds = %123
  %125 = load i32, ptr %2, align 4, !tbaa !5
  %126 = add nsw i32 %125, 1
  store i32 %126, ptr %2, align 4, !tbaa !5
  br label %15, !llvm.loop !11

127:                                              ; preds = %18
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #4
  store i32 2, ptr %6, align 4, !tbaa !5
  br label %128

128:                                              ; preds = %148, %127
  %129 = load i32, ptr %6, align 4, !tbaa !5
  %130 = icmp slt i32 %129, 4000001
  br i1 %130, label %132, label %131

131:                                              ; preds = %128
  store i32 8, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #4
  br label %151

132:                                              ; preds = %128
  %133 = load i32, ptr %6, align 4, !tbaa !5
  %134 = sub nsw i32 %133, 1
  %135 = sext i32 %134 to i64
  %136 = getelementptr inbounds [4000001 x i32], ptr @f, i64 0, i64 %135
  %137 = load i32, ptr %136, align 4, !tbaa !5
  %138 = load i32, ptr %6, align 4, !tbaa !5
  %139 = load i32, ptr %6, align 4, !tbaa !5
  %140 = sext i32 %139 to i64
  %141 = getelementptr inbounds [4000001 x i32], ptr @f, i64 0, i64 %140
  %142 = load i32, ptr %141, align 4, !tbaa !5
  %143 = mul nsw i32 %138, %142
  %144 = add nsw i32 %137, %143
  %145 = load i32, ptr %6, align 4, !tbaa !5
  %146 = sext i32 %145 to i64
  %147 = getelementptr inbounds [4000001 x i32], ptr @f, i64 0, i64 %146
  store i32 %144, ptr %147, align 4, !tbaa !5
  br label %148

148:                                              ; preds = %132
  %149 = load i32, ptr %6, align 4, !tbaa !5
  %150 = add nsw i32 %149, 1
  store i32 %150, ptr %6, align 4, !tbaa !5
  br label %128, !llvm.loop !12

151:                                              ; preds = %131
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #4
  %152 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef %7)
  br label %153

153:                                              ; preds = %207, %151
  %154 = load i32, ptr %7, align 4, !tbaa !5
  %155 = add nsw i32 %154, -1
  store i32 %155, ptr %7, align 4, !tbaa !5
  %156 = icmp ne i32 %154, 0
  br i1 %156, label %157, label %211

157:                                              ; preds = %153
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #4
  store i32 0, ptr %10, align 4, !tbaa !5
  %158 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.1, ptr noundef %8, ptr noundef %9)
  %159 = load i32, ptr %8, align 4, !tbaa !5
  %160 = load i32, ptr %9, align 4, !tbaa !5
  %161 = icmp sgt i32 %159, %160
  br i1 %161, label %162, label %163

162:                                              ; preds = %157
  call void @_ZSt4swapIiENSt9enable_ifIXsr6__and_ISt6__not_ISt15__is_tuple_likeIT_EESt21is_move_constructibleIS3_ESt18is_move_assignableIS3_EEE5valueEvE4typeERS3_SC_(ptr noundef nonnull align 4 dereferenceable(4) %8, ptr noundef nonnull align 4 dereferenceable(4) %9) #4
  br label %163

163:                                              ; preds = %162, %157
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #4
  store i32 1, ptr %11, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #4
  br label %164

164:                                              ; preds = %204, %163
  %165 = load i32, ptr %11, align 4, !tbaa !5
  %166 = load i32, ptr %8, align 4, !tbaa !5
  %167 = icmp sle i32 %165, %166
  br i1 %167, label %169, label %168

168:                                              ; preds = %164
  store i32 13, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #4
  br label %207

169:                                              ; preds = %164
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #4
  %170 = load i32, ptr %8, align 4, !tbaa !5
  %171 = load i32, ptr %8, align 4, !tbaa !5
  %172 = load i32, ptr %11, align 4, !tbaa !5
  %173 = sdiv i32 %171, %172
  %174 = sdiv i32 %170, %173
  store i32 %174, ptr %13, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #4
  %175 = load i32, ptr %9, align 4, !tbaa !5
  %176 = load i32, ptr %9, align 4, !tbaa !5
  %177 = load i32, ptr %11, align 4, !tbaa !5
  %178 = sdiv i32 %176, %177
  %179 = sdiv i32 %175, %178
  store i32 %179, ptr %14, align 4, !tbaa !5
  %180 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %13, ptr noundef nonnull align 4 dereferenceable(4) %14)
  %181 = load i32, ptr %180, align 4, !tbaa !5
  store i32 %181, ptr %12, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #4
  %182 = load i32, ptr %12, align 4, !tbaa !5
  %183 = sext i32 %182 to i64
  %184 = getelementptr inbounds [4000001 x i32], ptr @f, i64 0, i64 %183
  %185 = load i32, ptr %184, align 4, !tbaa !5
  %186 = load i32, ptr %11, align 4, !tbaa !5
  %187 = sub nsw i32 %186, 1
  %188 = sext i32 %187 to i64
  %189 = getelementptr inbounds [4000001 x i32], ptr @f, i64 0, i64 %188
  %190 = load i32, ptr %189, align 4, !tbaa !5
  %191 = sub nsw i32 %185, %190
  %192 = load i32, ptr %8, align 4, !tbaa !5
  %193 = load i32, ptr %11, align 4, !tbaa !5
  %194 = sdiv i32 %192, %193
  %195 = call noundef i32 @_Z4sum2i(i32 noundef %194)
  %196 = mul nsw i32 %191, %195
  %197 = load i32, ptr %9, align 4, !tbaa !5
  %198 = load i32, ptr %11, align 4, !tbaa !5
  %199 = sdiv i32 %197, %198
  %200 = call noundef i32 @_Z4sum2i(i32 noundef %199)
  %201 = mul nsw i32 %196, %200
  %202 = load i32, ptr %10, align 4, !tbaa !5
  %203 = add nsw i32 %202, %201
  store i32 %203, ptr %10, align 4, !tbaa !5
  br label %204

204:                                              ; preds = %169
  %205 = load i32, ptr %12, align 4, !tbaa !5
  %206 = add nsw i32 %205, 1
  store i32 %206, ptr %11, align 4, !tbaa !5
  br label %164, !llvm.loop !13

207:                                              ; preds = %168
  %208 = load i32, ptr %10, align 4, !tbaa !5
  %209 = and i32 %208, 1073741823
  %210 = call i32 (ptr, ...) @printf(ptr noundef @.str.2, i32 noundef %209)
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #4
  br label %153, !llvm.loop !14

211:                                              ; preds = %153
  store i32 0, ptr %1, align 4
  store i32 1, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #4
  %212 = load i32, ptr %1, align 4
  ret i32 %212
}

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

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

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

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

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef i32 @_Z4sum2i(i32 noundef) #3

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

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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { "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 nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { 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 = distinct !{!13, !10}
!14 = distinct !{!14, !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"

@tot = external dso_local local_unnamed_addr global i32, align 4
@pr = external dso_local local_unnamed_addr global [500001 x i32], align 16
@d = external dso_local local_unnamed_addr global [4000001 x i32], align 16
@f = external dso_local local_unnamed_addr global [4000001 x i32], 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 nounwind 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 i32, align 4
  %5 = alloca i32, align 4
  store i32 1, ptr getelementptr inbounds (i8, ptr @f, i64 4), align 4, !tbaa !5
  %tot.promoted = load i32, ptr @tot, align 4, !tbaa !5
  br label %6

6:                                                ; preds = %0, %.loopexit
  %indvars.iv68 = phi i64 [ 2, %0 ], [ %indvars.iv.next69, %.loopexit ]
  %7 = phi i32 [ %tot.promoted, %0 ], [ %18, %.loopexit ]
  %8 = getelementptr inbounds [4000001 x i32], ptr @d, i64 0, i64 %indvars.iv68
  %9 = load i32, ptr %8, align 4, !tbaa !5
  %.not48 = icmp eq i32 %9, 0
  %10 = trunc nuw nsw i64 %indvars.iv68 to i32
  br i1 %.not48, label %11, label %._crit_edge76

11:                                               ; preds = %6
  store i32 %10, ptr %8, align 4, !tbaa !5
  %12 = add nsw i32 %7, 1
  store i32 %12, ptr @tot, align 4, !tbaa !5
  %13 = sext i32 %7 to i64
  %14 = getelementptr inbounds [500001 x i32], ptr @pr, i64 0, i64 %13
  store i32 %10, ptr %14, align 4, !tbaa !5
  %15 = getelementptr inbounds [4000001 x i32], ptr @f, i64 0, i64 %indvars.iv68
  %16 = trunc i64 %indvars.iv68 to i32
  %17 = sub i32 1, %16
  store i32 %17, ptr %15, align 4, !tbaa !5
  br label %._crit_edge76

._crit_edge76:                                    ; preds = %6, %11
  %18 = phi i32 [ %12, %11 ], [ %7, %6 ]
  %19 = load i32, ptr @pr, align 16, !tbaa !5
  %20 = mul nsw i32 %19, %10
  %21 = icmp slt i32 %20, 4000001
  br i1 %21, label %.lr.ph, label %.loopexit

.lr.ph:                                           ; preds = %._crit_edge76
  %22 = getelementptr inbounds [4000001 x i32], ptr @f, i64 0, i64 %indvars.iv68
  br label %23

23:                                               ; preds = %.lr.ph, %44
  %indvars.iv = phi i64 [ 0, %.lr.ph ], [ %indvars.iv.next, %44 ]
  %24 = phi i32 [ %20, %.lr.ph ], [ %53, %44 ]
  %25 = phi i32 [ %19, %.lr.ph ], [ %52, %44 ]
  %26 = sext i32 %24 to i64
  %27 = getelementptr inbounds [4000001 x i32], ptr @d, i64 0, i64 %26
  store i32 %25, ptr %27, align 4, !tbaa !5
  %28 = load i32, ptr %8, align 4, !tbaa !5
  %29 = icmp eq i32 %28, %25
  br i1 %29, label %30, label %44

30:                                               ; preds = %23
  %31 = sdiv i32 %10, %25
  %32 = sext i32 %31 to i64
  %33 = getelementptr inbounds [4000001 x i32], ptr @d, i64 0, i64 %32
  %34 = load i32, ptr %33, align 4, !tbaa !5
  %35 = icmp eq i32 %34, %25
  br i1 %35, label %41, label %36

36:                                               ; preds = %30
  %37 = load i32, ptr %22, align 4, !tbaa !5
  %38 = getelementptr inbounds [4000001 x i32], ptr @f, i64 0, i64 %32
  %39 = load i32, ptr %38, align 4, !tbaa !5
  %40 = sub nsw i32 %37, %39
  br label %41

41:                                               ; preds = %30, %36
  %42 = phi i32 [ %40, %36 ], [ 0, %30 ]
  %43 = getelementptr inbounds [4000001 x i32], ptr @f, i64 0, i64 %26
  store i32 %42, ptr %43, align 4, !tbaa !5
  br label %.loopexit

44:                                               ; preds = %23
  %45 = load i32, ptr %22, align 4, !tbaa !5
  %46 = sext i32 %25 to i64
  %47 = getelementptr inbounds [4000001 x i32], ptr @f, i64 0, i64 %46
  %48 = load i32, ptr %47, align 4, !tbaa !5
  %49 = mul nsw i32 %48, %45
  %50 = getelementptr inbounds [4000001 x i32], ptr @f, i64 0, i64 %26
  store i32 %49, ptr %50, align 4, !tbaa !5
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %51 = getelementptr inbounds [500001 x i32], ptr @pr, i64 0, i64 %indvars.iv.next
  %52 = load i32, ptr %51, align 4, !tbaa !5
  %53 = mul nsw i32 %52, %10
  %54 = icmp slt i32 %53, 4000001
  br i1 %54, label %23, label %.loopexit, !llvm.loop !9

.loopexit:                                        ; preds = %44, %._crit_edge76, %41
  %indvars.iv.next69 = add nuw nsw i64 %indvars.iv68, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next69, 4000001
  br i1 %exitcond.not, label %.preheader.preheader, label %6, !llvm.loop !11

.preheader.preheader:                             ; preds = %.loopexit
  %.pre = load i32, ptr getelementptr inbounds (i8, ptr @f, i64 4), align 4, !tbaa !5
  br label %.preheader

55:                                               ; preds = %.preheader
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %1) #4
  %56 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %1)
  %57 = load i32, ptr %1, align 4, !tbaa !5
  %58 = add nsw i32 %57, -1
  store i32 %58, ptr %1, align 4, !tbaa !5
  %.not59 = icmp eq i32 %57, 0
  br i1 %.not59, label %._crit_edge62, label %.lr.ph61

.preheader:                                       ; preds = %.preheader, %.preheader.preheader
  %59 = phi i32 [ %.pre, %.preheader.preheader ], [ %74, %.preheader ]
  %indvars.iv71 = phi i64 [ 2, %.preheader.preheader ], [ %indvars.iv.next72.2, %.preheader ]
  %60 = getelementptr inbounds [4000001 x i32], ptr @f, i64 0, i64 %indvars.iv71
  %61 = load i32, ptr %60, align 4, !tbaa !5
  %62 = trunc nuw nsw i64 %indvars.iv71 to i32
  %63 = mul nsw i32 %61, %62
  %64 = add nsw i32 %63, %59
  store i32 %64, ptr %60, align 4, !tbaa !5
  %indvars.iv.next72 = add nuw nsw i64 %indvars.iv71, 1
  %65 = getelementptr inbounds [4000001 x i32], ptr @f, i64 0, i64 %indvars.iv.next72
  %66 = load i32, ptr %65, align 4, !tbaa !5
  %67 = trunc nuw nsw i64 %indvars.iv.next72 to i32
  %68 = mul nsw i32 %66, %67
  %69 = add nsw i32 %68, %64
  store i32 %69, ptr %65, align 4, !tbaa !5
  %indvars.iv.next72.1 = add nuw nsw i64 %indvars.iv71, 2
  %70 = getelementptr inbounds [4000001 x i32], ptr @f, i64 0, i64 %indvars.iv.next72.1
  %71 = load i32, ptr %70, align 4, !tbaa !5
  %72 = trunc nuw nsw i64 %indvars.iv.next72.1 to i32
  %73 = mul nsw i32 %71, %72
  %74 = add nsw i32 %73, %69
  store i32 %74, ptr %70, align 4, !tbaa !5
  %indvars.iv.next72.2 = add nuw nsw i64 %indvars.iv71, 3
  %exitcond74.not.2 = icmp eq i64 %indvars.iv.next72.2, 4000001
  br i1 %exitcond74.not.2, label %55, label %.preheader, !llvm.loop !12

.lr.ph61:                                         ; preds = %55, %._crit_edge
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %2) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %3) #4
  %75 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %2, ptr noundef nonnull %3)
  %76 = load i32, ptr %2, align 4, !tbaa !5
  %77 = load i32, ptr %3, align 4, !tbaa !5
  %78 = icmp sgt i32 %76, %77
  br i1 %78, label %79, label %80

79:                                               ; preds = %.lr.ph61
  call void @_ZSt4swapIiENSt9enable_ifIXsr6__and_ISt6__not_ISt15__is_tuple_likeIT_EESt21is_move_constructibleIS3_ESt18is_move_assignableIS3_EEE5valueEvE4typeERS3_SC_(ptr noundef nonnull align 4 dereferenceable(4) %2, ptr noundef nonnull align 4 dereferenceable(4) %3) #4
  %.pre75 = load i32, ptr %2, align 4, !tbaa !5
  br label %80

80:                                               ; preds = %79, %.lr.ph61
  %81 = phi i32 [ %.pre75, %79 ], [ %76, %.lr.ph61 ]
  %.not4755 = icmp slt i32 %81, 1
  br i1 %.not4755, label %._crit_edge, label %.lr.ph58

._crit_edge:                                      ; preds = %.lr.ph58, %80
  %.041.lcssa = phi i32 [ 0, %80 ], [ %110, %.lr.ph58 ]
  %82 = and i32 %.041.lcssa, 1073741823
  %83 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %82)
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %3) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %2) #4
  %84 = load i32, ptr %1, align 4, !tbaa !5
  %85 = add nsw i32 %84, -1
  store i32 %85, ptr %1, align 4, !tbaa !5
  %.not = icmp eq i32 %84, 0
  br i1 %.not, label %._crit_edge62, label %.lr.ph61, !llvm.loop !13

.lr.ph58:                                         ; preds = %80, %.lr.ph58
  %86 = phi i32 [ %112, %.lr.ph58 ], [ %81, %80 ]
  %.057 = phi i32 [ %111, %.lr.ph58 ], [ 1, %80 ]
  %.04156 = phi i32 [ %110, %.lr.ph58 ], [ 0, %80 ]
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %4) #4
  %87 = sdiv i32 %86, %.057
  %88 = sdiv i32 %86, %87
  store i32 %88, ptr %4, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %5) #4
  %89 = load i32, ptr %3, align 4, !tbaa !5
  %90 = sdiv i32 %89, %.057
  %91 = sdiv i32 %89, %90
  store i32 %91, ptr %5, align 4, !tbaa !5
  %92 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %4, ptr noundef nonnull align 4 dereferenceable(4) %5)
  %93 = load i32, ptr %92, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %5) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %4) #4
  %94 = sext i32 %93 to i64
  %95 = getelementptr inbounds [4000001 x i32], ptr @f, i64 0, i64 %94
  %96 = load i32, ptr %95, align 4, !tbaa !5
  %97 = add nsw i32 %.057, -1
  %98 = sext i32 %97 to i64
  %99 = getelementptr inbounds [4000001 x i32], ptr @f, i64 0, i64 %98
  %100 = load i32, ptr %99, align 4, !tbaa !5
  %101 = sub nsw i32 %96, %100
  %102 = load i32, ptr %2, align 4, !tbaa !5
  %103 = sdiv i32 %102, %.057
  %104 = call noundef i32 @_Z4sum2i(i32 noundef %103)
  %105 = mul nsw i32 %104, %101
  %106 = load i32, ptr %3, align 4, !tbaa !5
  %107 = sdiv i32 %106, %.057
  %108 = call noundef i32 @_Z4sum2i(i32 noundef %107)
  %109 = mul nsw i32 %105, %108
  %110 = add nsw i32 %109, %.04156
  %111 = add nsw i32 %93, 1
  %112 = load i32, ptr %2, align 4, !tbaa !5
  %.not47.not = icmp slt i32 %93, %112
  br i1 %.not47.not, label %.lr.ph58, label %._crit_edge, !llvm.loop !14

._crit_edge62:                                    ; preds = %._crit_edge, %55
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #4
  ret i32 0
}

; 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: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2

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

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef i32 @_Z4sum2i(i32 noundef) local_unnamed_addr #3

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

attributes #0 = { mustprogress norecurse 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 = { 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 #3 = { inlinehint mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { 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 = distinct !{!13, !10}
!14 = distinct !{!14, !10}


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