; LLVM IR from tangjz/acm-icpc :: spoj (EXLAGFIB)

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

@c = external dso_local global [3 x [4219 x [4219 x i32]]], align 16
@_ZL2pr = external hidden constant [3 x i32], align 4
@.str = external hidden unnamed_addr constant [3 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [11 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [4 x i8], align 1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i32 @_Z1Cii(i32 noundef, i32 noundef) #0

; 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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i32 @_Z7mod_powii(i32 noundef, i32 noundef) #0

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() #2 {
  %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
  %15 = alloca i32, align 4
  store i32 0, ptr %1, align 4
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #4
  store i32 0, ptr %2, align 4, !tbaa !5
  br label %16

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

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

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

21:                                               ; preds = %111, %20
  %22 = load i32, ptr %4, align 4, !tbaa !5
  %23 = load i32, ptr %2, align 4, !tbaa !5
  %24 = sext i32 %23 to i64
  %25 = getelementptr inbounds [3 x i32], ptr @_ZL2pr, i64 0, i64 %24
  %26 = load i32, ptr %25, align 4, !tbaa !5
  %27 = icmp slt i32 %22, %26
  br i1 %27, label %29, label %28

28:                                               ; preds = %21
  store i32 5, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #4
  br label %114

29:                                               ; preds = %21
  %30 = load i32, ptr %2, align 4, !tbaa !5
  %31 = sext i32 %30 to i64
  %32 = getelementptr inbounds [3 x [4219 x [4219 x i32]]], ptr @c, i64 0, i64 %31
  %33 = load i32, ptr %4, align 4, !tbaa !5
  %34 = sext i32 %33 to i64
  %35 = getelementptr inbounds [4219 x [4219 x i32]], ptr %32, i64 0, i64 %34
  %36 = load i32, ptr %4, align 4, !tbaa !5
  %37 = sext i32 %36 to i64
  %38 = getelementptr inbounds [4219 x i32], ptr %35, i64 0, i64 %37
  store i32 1, ptr %38, align 4, !tbaa !5
  %39 = load i32, ptr %2, align 4, !tbaa !5
  %40 = sext i32 %39 to i64
  %41 = getelementptr inbounds [3 x [4219 x [4219 x i32]]], ptr @c, i64 0, i64 %40
  %42 = load i32, ptr %4, align 4, !tbaa !5
  %43 = sext i32 %42 to i64
  %44 = getelementptr inbounds [4219 x [4219 x i32]], ptr %41, i64 0, i64 %43
  %45 = getelementptr inbounds [4219 x i32], ptr %44, i64 0, i64 0
  store i32 1, ptr %45, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #4
  store i32 1, ptr %5, align 4, !tbaa !5
  br label %46

46:                                               ; preds = %107, %29
  %47 = load i32, ptr %5, align 4, !tbaa !5
  %48 = load i32, ptr %4, align 4, !tbaa !5
  %49 = icmp slt i32 %47, %48
  br i1 %49, label %51, label %50

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

51:                                               ; preds = %46
  %52 = load i32, ptr %2, align 4, !tbaa !5
  %53 = sext i32 %52 to i64
  %54 = getelementptr inbounds [3 x [4219 x [4219 x i32]]], ptr @c, i64 0, i64 %53
  %55 = load i32, ptr %4, align 4, !tbaa !5
  %56 = sub nsw i32 %55, 1
  %57 = sext i32 %56 to i64
  %58 = getelementptr inbounds [4219 x [4219 x i32]], ptr %54, i64 0, i64 %57
  %59 = load i32, ptr %5, align 4, !tbaa !5
  %60 = sub nsw i32 %59, 1
  %61 = sext i32 %60 to i64
  %62 = getelementptr inbounds [4219 x i32], ptr %58, i64 0, i64 %61
  %63 = load i32, ptr %62, align 4, !tbaa !5
  %64 = load i32, ptr %2, align 4, !tbaa !5
  %65 = sext i32 %64 to i64
  %66 = getelementptr inbounds [3 x [4219 x [4219 x i32]]], ptr @c, i64 0, i64 %65
  %67 = load i32, ptr %4, align 4, !tbaa !5
  %68 = sub nsw i32 %67, 1
  %69 = sext i32 %68 to i64
  %70 = getelementptr inbounds [4219 x [4219 x i32]], ptr %66, i64 0, i64 %69
  %71 = load i32, ptr %5, align 4, !tbaa !5
  %72 = sext i32 %71 to i64
  %73 = getelementptr inbounds [4219 x i32], ptr %70, i64 0, i64 %72
  %74 = load i32, ptr %73, align 4, !tbaa !5
  %75 = add nsw i32 %63, %74
  %76 = load i32, ptr %2, align 4, !tbaa !5
  %77 = sext i32 %76 to i64
  %78 = getelementptr inbounds [3 x [4219 x [4219 x i32]]], ptr @c, i64 0, i64 %77
  %79 = load i32, ptr %4, align 4, !tbaa !5
  %80 = sext i32 %79 to i64
  %81 = getelementptr inbounds [4219 x [4219 x i32]], ptr %78, i64 0, i64 %80
  %82 = load i32, ptr %5, align 4, !tbaa !5
  %83 = sext i32 %82 to i64
  %84 = getelementptr inbounds [4219 x i32], ptr %81, i64 0, i64 %83
  store i32 %75, ptr %84, align 4, !tbaa !5
  %85 = load i32, ptr %2, align 4, !tbaa !5
  %86 = sext i32 %85 to i64
  %87 = getelementptr inbounds [3 x i32], ptr @_ZL2pr, i64 0, i64 %86
  %88 = load i32, ptr %87, align 4, !tbaa !5
  %89 = icmp sge i32 %75, %88
  br i1 %89, label %90, label %106

90:                                               ; preds = %51
  %91 = load i32, ptr %2, align 4, !tbaa !5
  %92 = sext i32 %91 to i64
  %93 = getelementptr inbounds [3 x i32], ptr @_ZL2pr, i64 0, i64 %92
  %94 = load i32, ptr %93, align 4, !tbaa !5
  %95 = load i32, ptr %2, align 4, !tbaa !5
  %96 = sext i32 %95 to i64
  %97 = getelementptr inbounds [3 x [4219 x [4219 x i32]]], ptr @c, i64 0, i64 %96
  %98 = load i32, ptr %4, align 4, !tbaa !5
  %99 = sext i32 %98 to i64
  %100 = getelementptr inbounds [4219 x [4219 x i32]], ptr %97, i64 0, i64 %99
  %101 = load i32, ptr %5, align 4, !tbaa !5
  %102 = sext i32 %101 to i64
  %103 = getelementptr inbounds [4219 x i32], ptr %100, i64 0, i64 %102
  %104 = load i32, ptr %103, align 4, !tbaa !5
  %105 = sub nsw i32 %104, %94
  store i32 %105, ptr %103, align 4, !tbaa !5
  br label %106

106:                                              ; preds = %90, %51
  br label %107

107:                                              ; preds = %106
  %108 = load i32, ptr %5, align 4, !tbaa !5
  %109 = add nsw i32 %108, 1
  store i32 %109, ptr %5, align 4, !tbaa !5
  br label %46, !llvm.loop !9

110:                                              ; preds = %50
  br label %111

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

114:                                              ; preds = %28
  br label %115

115:                                              ; preds = %114
  %116 = load i32, ptr %2, align 4, !tbaa !5
  %117 = add nsw i32 %116, 1
  store i32 %117, ptr %2, align 4, !tbaa !5
  br label %16, !llvm.loop !12

118:                                              ; preds = %19
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #4
  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
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #4
  %119 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef %6)
  br label %120

120:                                              ; preds = %177, %118
  %121 = load i32, ptr %6, align 4, !tbaa !5
  %122 = add nsw i32 %121, -1
  store i32 %122, ptr %6, align 4, !tbaa !5
  %123 = icmp ne i32 %121, 0
  br i1 %123, label %124, label %180

124:                                              ; preds = %120
  store i32 0, ptr %12, align 4, !tbaa !5
  %125 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.1, ptr noundef %7, ptr noundef %8, ptr noundef %9, ptr noundef %10, ptr noundef %11)
  %126 = load i32, ptr %9, align 4, !tbaa !5
  %127 = sub nsw i32 %126, 1
  %128 = load i32, ptr %7, align 4, !tbaa !5
  %129 = sub nsw i32 %128, %127
  store i32 %129, ptr %7, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #4
  store i32 0, ptr %13, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #4
  store i32 0, ptr %14, align 4, !tbaa !5
  br label %130

130:                                              ; preds = %171, %124
  %131 = load i32, ptr %14, align 4, !tbaa !5
  %132 = load i32, ptr %7, align 4, !tbaa !5
  %133 = icmp sle i32 %131, %132
  br i1 %133, label %135, label %134

134:                                              ; preds = %130
  store i32 13, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #4
  br label %177

135:                                              ; preds = %130
  %136 = load i32, ptr %7, align 4, !tbaa !5
  %137 = load i32, ptr %14, align 4, !tbaa !5
  %138 = sub nsw i32 %136, %137
  %139 = load i32, ptr %8, align 4, !tbaa !5
  %140 = srem i32 %138, %139
  %141 = icmp ne i32 %140, 0
  br i1 %141, label %142, label %143

142:                                              ; preds = %135
  br label %171

143:                                              ; preds = %135
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #4
  %144 = load i32, ptr %7, align 4, !tbaa !5
  %145 = load i32, ptr %14, align 4, !tbaa !5
  %146 = sub nsw i32 %144, %145
  %147 = load i32, ptr %8, align 4, !tbaa !5
  %148 = sdiv i32 %146, %147
  store i32 %148, ptr %15, align 4, !tbaa !5
  %149 = load i32, ptr %12, align 4, !tbaa !5
  %150 = sext i32 %149 to i64
  %151 = load i32, ptr %11, align 4, !tbaa !5
  %152 = load i32, ptr %13, align 4, !tbaa !5
  %153 = call noundef i32 @_Z7mod_powii(i32 noundef %151, i32 noundef %152)
  %154 = sext i32 %153 to i64
  %155 = load i32, ptr %10, align 4, !tbaa !5
  %156 = load i32, ptr %15, align 4, !tbaa !5
  %157 = call noundef i32 @_Z7mod_powii(i32 noundef %155, i32 noundef %156)
  %158 = sext i32 %157 to i64
  %159 = mul nsw i64 %154, %158
  %160 = srem i64 %159, 1000000037
  %161 = load i32, ptr %13, align 4, !tbaa !5
  %162 = load i32, ptr %15, align 4, !tbaa !5
  %163 = add nsw i32 %161, %162
  %164 = load i32, ptr %13, align 4, !tbaa !5
  %165 = call noundef i32 @_Z1Cii(i32 noundef %163, i32 noundef %164)
  %166 = sext i32 %165 to i64
  %167 = mul nsw i64 %160, %166
  %168 = add nsw i64 %150, %167
  %169 = srem i64 %168, 1000000037
  %170 = trunc i64 %169 to i32
  store i32 %170, ptr %12, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #4
  br label %171

171:                                              ; preds = %143, %142
  %172 = load i32, ptr %13, align 4, !tbaa !5
  %173 = add nsw i32 %172, 1
  store i32 %173, ptr %13, align 4, !tbaa !5
  %174 = load i32, ptr %9, align 4, !tbaa !5
  %175 = load i32, ptr %14, align 4, !tbaa !5
  %176 = add nsw i32 %175, %174
  store i32 %176, ptr %14, align 4, !tbaa !5
  br label %130, !llvm.loop !13

177:                                              ; preds = %134
  %178 = load i32, ptr %12, align 4, !tbaa !5
  %179 = call i32 (ptr, ...) @printf(ptr noundef @.str.2, i32 noundef %178)
  br label %120, !llvm.loop !14

180:                                              ; preds = %120
  store i32 0, ptr %1, align 4
  store i32 1, 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
  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
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #4
  %181 = load i32, ptr %1, align 4
  ret i32 %181
}

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

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

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

@c = external dso_local local_unnamed_addr global [3 x [4219 x [4219 x i32]]], align 16
@_ZL2pr = external hidden local_unnamed_addr constant [3 x i32], align 4
@.str = external hidden unnamed_addr constant [3 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [11 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [4 x i8], align 1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i32 @_Z1Cii(i32 noundef, i32 noundef) local_unnamed_addr #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: mustprogress nounwind uwtable
declare dso_local noundef i32 @_Z7mod_powii(i32 noundef, i32 noundef) local_unnamed_addr #0

; Function Attrs: mustprogress norecurse nounwind uwtable
define dso_local noundef i32 @main() local_unnamed_addr #2 {
.preheader:
  %0 = alloca i32, align 4
  %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 = load i32, ptr @_ZL2pr, align 4, !tbaa !5
  %7 = icmp sgt i32 %6, 0
  br i1 %7, label %.lr.ph54.preheader, label %._crit_edge55

.lr.ph54.preheader:                               ; preds = %.preheader
  %wide.trip.count72 = zext nneg i32 %6 to i64
  %broadcast.splatinsert = insertelement <4 x i32> poison, i32 %6, i64 0
  %broadcast.splat = shufflevector <4 x i32> %broadcast.splatinsert, <4 x i32> poison, <4 x i32> zeroinitializer
  br label %.lr.ph54

._crit_edge55:                                    ; preds = %._crit_edge, %.preheader
  %8 = load i32, ptr getelementptr inbounds (i8, ptr @_ZL2pr, i64 4), align 4, !tbaa !5
  %9 = icmp sgt i32 %8, 0
  br i1 %9, label %.lr.ph54.preheader.1, label %._crit_edge55.1

.lr.ph54.preheader.1:                             ; preds = %._crit_edge55
  %wide.trip.count72.1 = zext nneg i32 %8 to i64
  %broadcast.splatinsert98 = insertelement <4 x i32> poison, i32 %8, i64 0
  %broadcast.splat99 = shufflevector <4 x i32> %broadcast.splatinsert98, <4 x i32> poison, <4 x i32> zeroinitializer
  br label %.lr.ph54.1

.lr.ph54.1:                                       ; preds = %._crit_edge.1, %.lr.ph54.preheader.1
  %indvars.iv69.1 = phi i64 [ 0, %.lr.ph54.preheader.1 ], [ %indvars.iv.next70.1, %._crit_edge.1 ]
  %10 = add nsw i64 %indvars.iv69.1, -1
  %11 = getelementptr inbounds [3 x [4219 x [4219 x i32]]], ptr @c, i64 0, i64 1, i64 %indvars.iv69.1
  %12 = getelementptr inbounds [3 x [4219 x [4219 x i32]]], ptr @c, i64 0, i64 1, i64 %indvars.iv69.1, i64 %indvars.iv69.1
  store i32 1, ptr %12, align 4, !tbaa !5
  store i32 1, ptr %11, align 4, !tbaa !5
  %13 = icmp ugt i64 %indvars.iv69.1, 1
  br i1 %13, label %.lr.ph.1, label %._crit_edge.1

.lr.ph.1:                                         ; preds = %.lr.ph54.1
  %14 = add nsw i64 %indvars.iv69.1, -1
  %.phi.trans.insert78 = getelementptr inbounds [3 x [4219 x [4219 x i32]]], ptr @c, i64 0, i64 1, i64 %14, i64 0
  %.pre79 = load i32, ptr %.phi.trans.insert78, align 4, !tbaa !5
  %min.iters.check86 = icmp ult i64 %indvars.iv69.1, 5
  br i1 %min.iters.check86, label %scalar.ph85.preheader, label %vector.ph87

vector.ph87:                                      ; preds = %.lr.ph.1
  %n.vec89 = and i64 %10, -4
  %ind.end90 = or disjoint i64 %n.vec89, 1
  %vector.recur.init94 = insertelement <4 x i32> poison, i32 %.pre79, i64 3
  br label %vector.body92

vector.body92:                                    ; preds = %vector.body92, %vector.ph87
  %index93 = phi i64 [ 0, %vector.ph87 ], [ %index.next100, %vector.body92 ]
  %vector.recur95 = phi <4 x i32> [ %vector.recur.init94, %vector.ph87 ], [ %wide.load97, %vector.body92 ]
  %offset.idx96 = or disjoint i64 %index93, 1
  %15 = getelementptr inbounds [3 x [4219 x [4219 x i32]]], ptr @c, i64 0, i64 1, i64 %14, i64 %offset.idx96
  %wide.load97 = load <4 x i32>, ptr %15, align 4, !tbaa !5
  %16 = shufflevector <4 x i32> %vector.recur95, <4 x i32> %wide.load97, <4 x i32> <i32 3, i32 4, i32 5, i32 6>
  %17 = add nsw <4 x i32> %wide.load97, %16
  %18 = getelementptr inbounds [3 x [4219 x [4219 x i32]]], ptr @c, i64 0, i64 1, i64 %indvars.iv69.1, i64 %offset.idx96
  %19 = icmp slt <4 x i32> %17, %broadcast.splat99
  %20 = select <4 x i1> %19, <4 x i32> zeroinitializer, <4 x i32> %broadcast.splat99
  %21 = sub nsw <4 x i32> %17, %20
  store <4 x i32> %21, ptr %18, align 4, !tbaa !5
  %index.next100 = add nuw i64 %index93, 4
  %22 = icmp eq i64 %index.next100, %n.vec89
  br i1 %22, label %middle.block84, label %vector.body92, !llvm.loop !9

middle.block84:                                   ; preds = %vector.body92
  %vector.recur.extract101 = extractelement <4 x i32> %wide.load97, i64 3
  %cmp.n102 = icmp eq i64 %10, %n.vec89
  br i1 %cmp.n102, label %._crit_edge.1, label %scalar.ph85.preheader

scalar.ph85.preheader:                            ; preds = %middle.block84, %.lr.ph.1
  %.ph124 = phi i32 [ %.pre79, %.lr.ph.1 ], [ %vector.recur.extract101, %middle.block84 ]
  %indvars.iv.1.ph = phi i64 [ 1, %.lr.ph.1 ], [ %ind.end90, %middle.block84 ]
  br label %scalar.ph85

scalar.ph85:                                      ; preds = %scalar.ph85.preheader, %scalar.ph85
  %23 = phi i32 [ %25, %scalar.ph85 ], [ %.ph124, %scalar.ph85.preheader ]
  %indvars.iv.1 = phi i64 [ %indvars.iv.next.1, %scalar.ph85 ], [ %indvars.iv.1.ph, %scalar.ph85.preheader ]
  %24 = getelementptr inbounds [3 x [4219 x [4219 x i32]]], ptr @c, i64 0, i64 1, i64 %14, i64 %indvars.iv.1
  %25 = load i32, ptr %24, align 4, !tbaa !5
  %26 = add nsw i32 %25, %23
  %27 = getelementptr inbounds [3 x [4219 x [4219 x i32]]], ptr @c, i64 0, i64 1, i64 %indvars.iv69.1, i64 %indvars.iv.1
  %.not50.1 = icmp slt i32 %26, %8
  %28 = select i1 %.not50.1, i32 0, i32 %8
  %spec.select.1 = sub nsw i32 %26, %28
  store i32 %spec.select.1, ptr %27, align 4, !tbaa !5
  %indvars.iv.next.1 = add nuw nsw i64 %indvars.iv.1, 1
  %exitcond.1.not = icmp eq i64 %indvars.iv.next.1, %indvars.iv69.1
  br i1 %exitcond.1.not, label %._crit_edge.1, label %scalar.ph85, !llvm.loop !13

._crit_edge.1:                                    ; preds = %scalar.ph85, %middle.block84, %.lr.ph54.1
  %indvars.iv.next70.1 = add nuw nsw i64 %indvars.iv69.1, 1
  %exitcond73.1.not = icmp eq i64 %indvars.iv.next70.1, %wide.trip.count72.1
  br i1 %exitcond73.1.not, label %._crit_edge55.1, label %.lr.ph54.1, !llvm.loop !14

._crit_edge55.1:                                  ; preds = %._crit_edge.1, %._crit_edge55
  %29 = load i32, ptr getelementptr inbounds (i8, ptr @_ZL2pr, i64 8), align 4, !tbaa !5
  %30 = icmp sgt i32 %29, 0
  br i1 %30, label %.lr.ph54.preheader.2, label %._crit_edge55.2

.lr.ph54.preheader.2:                             ; preds = %._crit_edge55.1
  %wide.trip.count72.2 = zext nneg i32 %29 to i64
  %broadcast.splatinsert118 = insertelement <4 x i32> poison, i32 %29, i64 0
  %broadcast.splat119 = shufflevector <4 x i32> %broadcast.splatinsert118, <4 x i32> poison, <4 x i32> zeroinitializer
  br label %.lr.ph54.2

.lr.ph54.2:                                       ; preds = %._crit_edge.2, %.lr.ph54.preheader.2
  %indvars.iv69.2 = phi i64 [ 0, %.lr.ph54.preheader.2 ], [ %indvars.iv.next70.2, %._crit_edge.2 ]
  %31 = add nsw i64 %indvars.iv69.2, -1
  %32 = getelementptr inbounds [3 x [4219 x [4219 x i32]]], ptr @c, i64 0, i64 2, i64 %indvars.iv69.2
  %33 = getelementptr inbounds [3 x [4219 x [4219 x i32]]], ptr @c, i64 0, i64 2, i64 %indvars.iv69.2, i64 %indvars.iv69.2
  store i32 1, ptr %33, align 4, !tbaa !5
  store i32 1, ptr %32, align 4, !tbaa !5
  %34 = icmp ugt i64 %indvars.iv69.2, 1
  br i1 %34, label %.lr.ph.2, label %._crit_edge.2

.lr.ph.2:                                         ; preds = %.lr.ph54.2
  %35 = add nsw i64 %indvars.iv69.2, -1
  %.phi.trans.insert80 = getelementptr inbounds [3 x [4219 x [4219 x i32]]], ptr @c, i64 0, i64 2, i64 %35, i64 0
  %.pre81 = load i32, ptr %.phi.trans.insert80, align 4, !tbaa !5
  %min.iters.check106 = icmp ult i64 %indvars.iv69.2, 5
  br i1 %min.iters.check106, label %scalar.ph105.preheader, label %vector.ph107

vector.ph107:                                     ; preds = %.lr.ph.2
  %n.vec109 = and i64 %31, -4
  %ind.end110 = or disjoint i64 %n.vec109, 1
  %vector.recur.init114 = insertelement <4 x i32> poison, i32 %.pre81, i64 3
  br label %vector.body112

vector.body112:                                   ; preds = %vector.body112, %vector.ph107
  %index113 = phi i64 [ 0, %vector.ph107 ], [ %index.next120, %vector.body112 ]
  %vector.recur115 = phi <4 x i32> [ %vector.recur.init114, %vector.ph107 ], [ %wide.load117, %vector.body112 ]
  %offset.idx116 = or disjoint i64 %index113, 1
  %36 = getelementptr inbounds [3 x [4219 x [4219 x i32]]], ptr @c, i64 0, i64 2, i64 %35, i64 %offset.idx116
  %wide.load117 = load <4 x i32>, ptr %36, align 4, !tbaa !5
  %37 = shufflevector <4 x i32> %vector.recur115, <4 x i32> %wide.load117, <4 x i32> <i32 3, i32 4, i32 5, i32 6>
  %38 = add nsw <4 x i32> %wide.load117, %37
  %39 = getelementptr inbounds [3 x [4219 x [4219 x i32]]], ptr @c, i64 0, i64 2, i64 %indvars.iv69.2, i64 %offset.idx116
  %40 = icmp slt <4 x i32> %38, %broadcast.splat119
  %41 = select <4 x i1> %40, <4 x i32> zeroinitializer, <4 x i32> %broadcast.splat119
  %42 = sub nsw <4 x i32> %38, %41
  store <4 x i32> %42, ptr %39, align 4, !tbaa !5
  %index.next120 = add nuw i64 %index113, 4
  %43 = icmp eq i64 %index.next120, %n.vec109
  br i1 %43, label %middle.block104, label %vector.body112, !llvm.loop !15

middle.block104:                                  ; preds = %vector.body112
  %vector.recur.extract121 = extractelement <4 x i32> %wide.load117, i64 3
  %cmp.n122 = icmp eq i64 %31, %n.vec109
  br i1 %cmp.n122, label %._crit_edge.2, label %scalar.ph105.preheader

scalar.ph105.preheader:                           ; preds = %middle.block104, %.lr.ph.2
  %.ph = phi i32 [ %.pre81, %.lr.ph.2 ], [ %vector.recur.extract121, %middle.block104 ]
  %indvars.iv.2.ph = phi i64 [ 1, %.lr.ph.2 ], [ %ind.end110, %middle.block104 ]
  br label %scalar.ph105

scalar.ph105:                                     ; preds = %scalar.ph105.preheader, %scalar.ph105
  %44 = phi i32 [ %46, %scalar.ph105 ], [ %.ph, %scalar.ph105.preheader ]
  %indvars.iv.2 = phi i64 [ %indvars.iv.next.2, %scalar.ph105 ], [ %indvars.iv.2.ph, %scalar.ph105.preheader ]
  %45 = getelementptr inbounds [3 x [4219 x [4219 x i32]]], ptr @c, i64 0, i64 2, i64 %35, i64 %indvars.iv.2
  %46 = load i32, ptr %45, align 4, !tbaa !5
  %47 = add nsw i32 %46, %44
  %48 = getelementptr inbounds [3 x [4219 x [4219 x i32]]], ptr @c, i64 0, i64 2, i64 %indvars.iv69.2, i64 %indvars.iv.2
  %.not50.2 = icmp slt i32 %47, %29
  %49 = select i1 %.not50.2, i32 0, i32 %29
  %spec.select.2 = sub nsw i32 %47, %49
  store i32 %spec.select.2, ptr %48, align 4, !tbaa !5
  %indvars.iv.next.2 = add nuw nsw i64 %indvars.iv.2, 1
  %exitcond.2.not = icmp eq i64 %indvars.iv.next.2, %indvars.iv69.2
  br i1 %exitcond.2.not, label %._crit_edge.2, label %scalar.ph105, !llvm.loop !16

._crit_edge.2:                                    ; preds = %scalar.ph105, %middle.block104, %.lr.ph54.2
  %indvars.iv.next70.2 = add nuw nsw i64 %indvars.iv69.2, 1
  %exitcond73.2.not = icmp eq i64 %indvars.iv.next70.2, %wide.trip.count72.2
  br i1 %exitcond73.2.not, label %._crit_edge55.2, label %.lr.ph54.2, !llvm.loop !14

._crit_edge55.2:                                  ; preds = %._crit_edge.2, %._crit_edge55.1
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %0) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %1) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %2) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %3) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %4) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %5) #4
  %50 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %0)
  %51 = load i32, ptr %0, align 4, !tbaa !5
  %52 = add nsw i32 %51, -1
  store i32 %52, ptr %0, align 4, !tbaa !5
  %.not64 = icmp eq i32 %51, 0
  br i1 %.not64, label %._crit_edge67, label %.lr.ph66

.lr.ph54:                                         ; preds = %.lr.ph54.preheader, %._crit_edge
  %indvars.iv69 = phi i64 [ 0, %.lr.ph54.preheader ], [ %indvars.iv.next70, %._crit_edge ]
  %53 = add nsw i64 %indvars.iv69, -1
  %54 = getelementptr inbounds [3 x [4219 x [4219 x i32]]], ptr @c, i64 0, i64 0, i64 %indvars.iv69
  %55 = getelementptr inbounds [3 x [4219 x [4219 x i32]]], ptr @c, i64 0, i64 0, i64 %indvars.iv69, i64 %indvars.iv69
  store i32 1, ptr %55, align 4, !tbaa !5
  store i32 1, ptr %54, align 4, !tbaa !5
  %56 = icmp ugt i64 %indvars.iv69, 1
  br i1 %56, label %.lr.ph, label %._crit_edge

.lr.ph:                                           ; preds = %.lr.ph54
  %57 = add nsw i64 %indvars.iv69, -1
  %.phi.trans.insert = getelementptr inbounds [3 x [4219 x [4219 x i32]]], ptr @c, i64 0, i64 0, i64 %57, i64 0
  %.pre = load i32, ptr %.phi.trans.insert, align 4, !tbaa !5
  %min.iters.check = icmp ult i64 %indvars.iv69, 5
  br i1 %min.iters.check, label %scalar.ph.preheader, label %vector.ph

scalar.ph.preheader:                              ; preds = %middle.block, %.lr.ph
  %.ph125 = phi i32 [ %.pre, %.lr.ph ], [ %vector.recur.extract, %middle.block ]
  %indvars.iv.ph = phi i64 [ 1, %.lr.ph ], [ %ind.end, %middle.block ]
  br label %scalar.ph

vector.ph:                                        ; preds = %.lr.ph
  %n.vec = and i64 %53, -4
  %ind.end = or disjoint i64 %n.vec, 1
  %vector.recur.init = insertelement <4 x i32> poison, i32 %.pre, i64 3
  br label %vector.body

vector.body:                                      ; preds = %vector.body, %vector.ph
  %index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
  %vector.recur = phi <4 x i32> [ %vector.recur.init, %vector.ph ], [ %wide.load, %vector.body ]
  %offset.idx = or disjoint i64 %index, 1
  %58 = getelementptr inbounds [3 x [4219 x [4219 x i32]]], ptr @c, i64 0, i64 0, i64 %57, i64 %offset.idx
  %wide.load = load <4 x i32>, ptr %58, align 4, !tbaa !5
  %59 = shufflevector <4 x i32> %vector.recur, <4 x i32> %wide.load, <4 x i32> <i32 3, i32 4, i32 5, i32 6>
  %60 = add nsw <4 x i32> %wide.load, %59
  %61 = getelementptr inbounds [3 x [4219 x [4219 x i32]]], ptr @c, i64 0, i64 0, i64 %indvars.iv69, i64 %offset.idx
  %62 = icmp slt <4 x i32> %60, %broadcast.splat
  %63 = select <4 x i1> %62, <4 x i32> zeroinitializer, <4 x i32> %broadcast.splat
  %64 = sub nsw <4 x i32> %60, %63
  store <4 x i32> %64, ptr %61, align 4, !tbaa !5
  %index.next = add nuw i64 %index, 4
  %65 = icmp eq i64 %index.next, %n.vec
  br i1 %65, label %middle.block, label %vector.body, !llvm.loop !17

middle.block:                                     ; preds = %vector.body
  %vector.recur.extract = extractelement <4 x i32> %wide.load, i64 3
  %cmp.n = icmp eq i64 %53, %n.vec
  br i1 %cmp.n, label %._crit_edge, label %scalar.ph.preheader

._crit_edge:                                      ; preds = %scalar.ph, %middle.block, %.lr.ph54
  %indvars.iv.next70 = add nuw nsw i64 %indvars.iv69, 1
  %exitcond73.not = icmp eq i64 %indvars.iv.next70, %wide.trip.count72
  br i1 %exitcond73.not, label %._crit_edge55, label %.lr.ph54, !llvm.loop !14

scalar.ph:                                        ; preds = %scalar.ph.preheader, %scalar.ph
  %66 = phi i32 [ %68, %scalar.ph ], [ %.ph125, %scalar.ph.preheader ]
  %indvars.iv = phi i64 [ %indvars.iv.next, %scalar.ph ], [ %indvars.iv.ph, %scalar.ph.preheader ]
  %67 = getelementptr inbounds [3 x [4219 x [4219 x i32]]], ptr @c, i64 0, i64 0, i64 %57, i64 %indvars.iv
  %68 = load i32, ptr %67, align 4, !tbaa !5
  %69 = add nsw i32 %68, %66
  %70 = getelementptr inbounds [3 x [4219 x [4219 x i32]]], ptr @c, i64 0, i64 0, i64 %indvars.iv69, i64 %indvars.iv
  %.not50 = icmp slt i32 %69, %6
  %71 = select i1 %.not50, i32 0, i32 %6
  %spec.select = sub nsw i32 %69, %71
  store i32 %spec.select, ptr %70, align 4, !tbaa !5
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next, %indvars.iv69
  br i1 %exitcond.not, label %._crit_edge, label %scalar.ph, !llvm.loop !18

.lr.ph66:                                         ; preds = %._crit_edge55.2, %._crit_edge63
  %72 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %1, ptr noundef nonnull %2, ptr noundef nonnull %3, ptr noundef nonnull %4, ptr noundef nonnull %5)
  %73 = load i32, ptr %3, align 4, !tbaa !5
  %74 = load i32, ptr %1, align 4, !tbaa !5
  %reass.sub = sub i32 %74, %73
  %75 = add i32 %reass.sub, 1
  store i32 %75, ptr %1, align 4, !tbaa !5
  %.not4857 = icmp slt i32 %75, 0
  br i1 %.not4857, label %._crit_edge63, label %.lr.ph62

._crit_edge63:                                    ; preds = %102, %.lr.ph66
  %.041.lcssa = phi i32 [ 0, %.lr.ph66 ], [ %.1, %102 ]
  %76 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %.041.lcssa)
  %77 = load i32, ptr %0, align 4, !tbaa !5
  %78 = add nsw i32 %77, -1
  store i32 %78, ptr %0, align 4, !tbaa !5
  %.not = icmp eq i32 %77, 0
  br i1 %.not, label %._crit_edge67, label %.lr.ph66, !llvm.loop !19

.lr.ph62:                                         ; preds = %.lr.ph66, %102
  %79 = phi i32 [ %103, %102 ], [ %75, %.lr.ph66 ]
  %80 = phi i32 [ %104, %102 ], [ %73, %.lr.ph66 ]
  %.060 = phi i32 [ %106, %102 ], [ 0, %.lr.ph66 ]
  %.04059 = phi i32 [ %105, %102 ], [ 0, %.lr.ph66 ]
  %.04158 = phi i32 [ %.1, %102 ], [ 0, %.lr.ph66 ]
  %81 = sub nsw i32 %79, %.060
  %82 = load i32, ptr %2, align 4, !tbaa !5
  %83 = srem i32 %81, %82
  %84 = sdiv i32 %81, %82
  %.not49 = icmp eq i32 %83, 0
  br i1 %.not49, label %85, label %102

85:                                               ; preds = %.lr.ph62
  %86 = sext i32 %.04158 to i64
  %87 = load i32, ptr %5, align 4, !tbaa !5
  %88 = call noundef i32 @_Z7mod_powii(i32 noundef %87, i32 noundef %.04059)
  %89 = sext i32 %88 to i64
  %90 = load i32, ptr %4, align 4, !tbaa !5
  %91 = call noundef i32 @_Z7mod_powii(i32 noundef %90, i32 noundef %84)
  %92 = sext i32 %91 to i64
  %93 = mul nsw i64 %92, %89
  %94 = srem i64 %93, 1000000037
  %95 = add nsw i32 %84, %.04059
  %96 = call noundef i32 @_Z1Cii(i32 noundef %95, i32 noundef %.04059)
  %97 = sext i32 %96 to i64
  %98 = mul nsw i64 %94, %97
  %99 = add nsw i64 %98, %86
  %100 = srem i64 %99, 1000000037
  %101 = trunc nsw i64 %100 to i32
  %.pre82 = load i32, ptr %3, align 4, !tbaa !5
  %.pre83 = load i32, ptr %1, align 4, !tbaa !5
  br label %102

102:                                              ; preds = %.lr.ph62, %85
  %103 = phi i32 [ %79, %.lr.ph62 ], [ %.pre83, %85 ]
  %104 = phi i32 [ %80, %.lr.ph62 ], [ %.pre82, %85 ]
  %.1 = phi i32 [ %.04158, %.lr.ph62 ], [ %101, %85 ]
  %105 = add nuw nsw i32 %.04059, 1
  %106 = add nsw i32 %104, %.060
  %.not48 = icmp sgt i32 %106, %103
  br i1 %.not48, label %._crit_edge63, label %.lr.ph62, !llvm.loop !20

._crit_edge67:                                    ; preds = %._crit_edge63, %._crit_edge55.2
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %5) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %4) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %3) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %2) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %0) #4
  ret i32 0
}

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

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

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


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