; LLVM IR from tangjz/acm-icpc :: usaco/Training/Chapter 2 Bigger challenges (nocows)

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

@n = external dso_local global i32, align 4
@m = external dso_local global i32, align 4
@f = external dso_local global [201 x [201 x i32]], align 16
@g = external dso_local global [201 x [201 x i32]], align 16
@.str = external hidden unnamed_addr constant [10 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [2 x i8], align 1
@stdin = external global ptr, align 8
@.str.2 = external hidden unnamed_addr constant [11 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [2 x i8], align 1
@stdout = external global ptr, align 8
@.str.4 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.5 = 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
  store i32 0, ptr %1, align 4
  %7 = load ptr, ptr @stdin, align 8, !tbaa !5
  %8 = call ptr @freopen(ptr noundef @.str, ptr noundef @.str.1, ptr noundef %7)
  %9 = load ptr, ptr @stdout, align 8, !tbaa !5
  %10 = call ptr @freopen(ptr noundef @.str.2, ptr noundef @.str.3, ptr noundef %9)
  %11 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.4, ptr noundef @n, ptr noundef @m)
  store i32 1, ptr getelementptr inbounds ([201 x i32], ptr getelementptr inbounds ([201 x [201 x i32]], ptr @g, i64 0, i64 1), i64 0, i64 1), align 4, !tbaa !9
  store i32 1, ptr getelementptr inbounds ([201 x i32], ptr getelementptr inbounds ([201 x [201 x i32]], ptr @f, i64 0, i64 1), i64 0, i64 1), align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #3
  store i32 2, ptr %2, align 4, !tbaa !9
  br label %12

12:                                               ; preds = %144, %0
  %13 = load i32, ptr %2, align 4, !tbaa !9
  %14 = load i32, ptr @m, align 4, !tbaa !9
  %15 = icmp sle i32 %13, %14
  br i1 %15, label %17, label %16

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

17:                                               ; preds = %12
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #3
  store i32 3, ptr %4, align 4, !tbaa !9
  br label %18

18:                                               ; preds = %90, %17
  %19 = load i32, ptr %4, align 4, !tbaa !9
  %20 = load i32, ptr @n, align 4, !tbaa !9
  %21 = icmp sle i32 %19, %20
  br i1 %21, label %23, label %22

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

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

24:                                               ; preds = %86, %23
  %25 = load i32, ptr %5, align 4, !tbaa !9
  %26 = load i32, ptr %4, align 4, !tbaa !9
  %27 = icmp slt i32 %25, %26
  br i1 %27, label %29, label %28

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

29:                                               ; preds = %24
  %30 = load i32, ptr %2, align 4, !tbaa !9
  %31 = sext i32 %30 to i64
  %32 = getelementptr inbounds [201 x [201 x i32]], ptr @f, i64 0, i64 %31
  %33 = load i32, ptr %4, align 4, !tbaa !9
  %34 = sext i32 %33 to i64
  %35 = getelementptr inbounds [201 x i32], ptr %32, i64 0, i64 %34
  %36 = load i32, ptr %35, align 4, !tbaa !9
  %37 = load i32, ptr %2, align 4, !tbaa !9
  %38 = sub nsw i32 %37, 1
  %39 = sext i32 %38 to i64
  %40 = getelementptr inbounds [201 x [201 x i32]], ptr @f, i64 0, i64 %39
  %41 = load i32, ptr %5, align 4, !tbaa !9
  %42 = sext i32 %41 to i64
  %43 = getelementptr inbounds [201 x i32], ptr %40, i64 0, i64 %42
  %44 = load i32, ptr %43, align 4, !tbaa !9
  %45 = load i32, ptr %2, align 4, !tbaa !9
  %46 = sub nsw i32 %45, 1
  %47 = sext i32 %46 to i64
  %48 = getelementptr inbounds [201 x [201 x i32]], ptr @g, i64 0, i64 %47
  %49 = load i32, ptr %4, align 4, !tbaa !9
  %50 = sub nsw i32 %49, 1
  %51 = load i32, ptr %5, align 4, !tbaa !9
  %52 = sub nsw i32 %50, %51
  %53 = sext i32 %52 to i64
  %54 = getelementptr inbounds [201 x i32], ptr %48, i64 0, i64 %53
  %55 = load i32, ptr %54, align 4, !tbaa !9
  %56 = mul nsw i32 %44, %55
  %57 = add nsw i32 %36, %56
  %58 = load i32, ptr %2, align 4, !tbaa !9
  %59 = sub nsw i32 %58, 2
  %60 = sext i32 %59 to i64
  %61 = getelementptr inbounds [201 x [201 x i32]], ptr @g, i64 0, i64 %60
  %62 = load i32, ptr %5, align 4, !tbaa !9
  %63 = sext i32 %62 to i64
  %64 = getelementptr inbounds [201 x i32], ptr %61, i64 0, i64 %63
  %65 = load i32, ptr %64, align 4, !tbaa !9
  %66 = load i32, ptr %2, align 4, !tbaa !9
  %67 = sub nsw i32 %66, 1
  %68 = sext i32 %67 to i64
  %69 = getelementptr inbounds [201 x [201 x i32]], ptr @f, i64 0, i64 %68
  %70 = load i32, ptr %4, align 4, !tbaa !9
  %71 = sub nsw i32 %70, 1
  %72 = load i32, ptr %5, align 4, !tbaa !9
  %73 = sub nsw i32 %71, %72
  %74 = sext i32 %73 to i64
  %75 = getelementptr inbounds [201 x i32], ptr %69, i64 0, i64 %74
  %76 = load i32, ptr %75, align 4, !tbaa !9
  %77 = mul nsw i32 %65, %76
  %78 = add nsw i32 %57, %77
  %79 = srem i32 %78, 9901
  %80 = load i32, ptr %2, align 4, !tbaa !9
  %81 = sext i32 %80 to i64
  %82 = getelementptr inbounds [201 x [201 x i32]], ptr @f, i64 0, i64 %81
  %83 = load i32, ptr %4, align 4, !tbaa !9
  %84 = sext i32 %83 to i64
  %85 = getelementptr inbounds [201 x i32], ptr %82, i64 0, i64 %84
  store i32 %79, ptr %85, align 4, !tbaa !9
  br label %86

86:                                               ; preds = %29
  %87 = load i32, ptr %5, align 4, !tbaa !9
  %88 = add nsw i32 %87, 2
  store i32 %88, ptr %5, align 4, !tbaa !9
  br label %24, !llvm.loop !11

89:                                               ; preds = %28
  br label %90

90:                                               ; preds = %89
  %91 = load i32, ptr %4, align 4, !tbaa !9
  %92 = add nsw i32 %91, 1
  store i32 %92, ptr %4, align 4, !tbaa !9
  br label %18, !llvm.loop !13

93:                                               ; preds = %22
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #3
  store i32 1, ptr %6, align 4, !tbaa !9
  br label %94

94:                                               ; preds = %140, %93
  %95 = load i32, ptr %6, align 4, !tbaa !9
  %96 = load i32, ptr @n, align 4, !tbaa !9
  %97 = icmp sle i32 %95, %96
  br i1 %97, label %99, label %98

98:                                               ; preds = %94
  store i32 11, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #3
  br label %143

99:                                               ; preds = %94
  %100 = load i32, ptr %2, align 4, !tbaa !9
  %101 = sub nsw i32 %100, 1
  %102 = sext i32 %101 to i64
  %103 = getelementptr inbounds [201 x [201 x i32]], ptr @g, i64 0, i64 %102
  %104 = load i32, ptr %6, align 4, !tbaa !9
  %105 = sext i32 %104 to i64
  %106 = getelementptr inbounds [201 x i32], ptr %103, i64 0, i64 %105
  %107 = load i32, ptr %106, align 4, !tbaa !9
  %108 = load i32, ptr %2, align 4, !tbaa !9
  %109 = sext i32 %108 to i64
  %110 = getelementptr inbounds [201 x [201 x i32]], ptr @f, i64 0, i64 %109
  %111 = load i32, ptr %6, align 4, !tbaa !9
  %112 = sext i32 %111 to i64
  %113 = getelementptr inbounds [201 x i32], ptr %110, i64 0, i64 %112
  %114 = load i32, ptr %113, align 4, !tbaa !9
  %115 = add nsw i32 %107, %114
  %116 = load i32, ptr %2, align 4, !tbaa !9
  %117 = sext i32 %116 to i64
  %118 = getelementptr inbounds [201 x [201 x i32]], ptr @g, i64 0, i64 %117
  %119 = load i32, ptr %6, align 4, !tbaa !9
  %120 = sext i32 %119 to i64
  %121 = getelementptr inbounds [201 x i32], ptr %118, i64 0, i64 %120
  store i32 %115, ptr %121, align 4, !tbaa !9
  %122 = load i32, ptr %2, align 4, !tbaa !9
  %123 = sext i32 %122 to i64
  %124 = getelementptr inbounds [201 x [201 x i32]], ptr @g, i64 0, i64 %123
  %125 = load i32, ptr %6, align 4, !tbaa !9
  %126 = sext i32 %125 to i64
  %127 = getelementptr inbounds [201 x i32], ptr %124, i64 0, i64 %126
  %128 = load i32, ptr %127, align 4, !tbaa !9
  %129 = icmp sge i32 %128, 9901
  br i1 %129, label %130, label %139

130:                                              ; preds = %99
  %131 = load i32, ptr %2, align 4, !tbaa !9
  %132 = sext i32 %131 to i64
  %133 = getelementptr inbounds [201 x [201 x i32]], ptr @g, i64 0, i64 %132
  %134 = load i32, ptr %6, align 4, !tbaa !9
  %135 = sext i32 %134 to i64
  %136 = getelementptr inbounds [201 x i32], ptr %133, i64 0, i64 %135
  %137 = load i32, ptr %136, align 4, !tbaa !9
  %138 = sub nsw i32 %137, 9901
  store i32 %138, ptr %136, align 4, !tbaa !9
  br label %139

139:                                              ; preds = %130, %99
  br label %140

140:                                              ; preds = %139
  %141 = load i32, ptr %6, align 4, !tbaa !9
  %142 = add nsw i32 %141, 1
  store i32 %142, ptr %6, align 4, !tbaa !9
  br label %94, !llvm.loop !14

143:                                              ; preds = %98
  br label %144

144:                                              ; preds = %143
  %145 = load i32, ptr %2, align 4, !tbaa !9
  %146 = add nsw i32 %145, 1
  store i32 %146, ptr %2, align 4, !tbaa !9
  br label %12, !llvm.loop !15

147:                                              ; preds = %16
  %148 = load i32, ptr @m, align 4, !tbaa !9
  %149 = sext i32 %148 to i64
  %150 = getelementptr inbounds [201 x [201 x i32]], ptr @f, i64 0, i64 %149
  %151 = load i32, ptr @n, align 4, !tbaa !9
  %152 = sext i32 %151 to i64
  %153 = getelementptr inbounds [201 x i32], ptr %150, i64 0, i64 %152
  %154 = load i32, ptr %153, align 4, !tbaa !9
  %155 = call i32 (ptr, ...) @printf(ptr noundef @.str.5, i32 noundef %154)
  ret i32 0
}

declare ptr @freopen(ptr noundef, ptr noundef, ptr noundef) #1

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

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 = { 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 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = distinct !{!13, !12}
!14 = distinct !{!14, !12}
!15 = distinct !{!15, !12}


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

@n = external dso_local global i32, align 4
@m = external dso_local global i32, align 4
@f = external dso_local local_unnamed_addr global [201 x [201 x i32]], align 16
@g = external dso_local local_unnamed_addr global [201 x [201 x i32]], align 16
@.str = external hidden unnamed_addr constant [10 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [2 x i8], align 1
@stdin = external local_unnamed_addr global ptr, align 8
@.str.2 = external hidden unnamed_addr constant [11 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [2 x i8], align 1
@stdout = external local_unnamed_addr global ptr, align 8
@.str.4 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [4 x i8], align 1

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #0 {
  %1 = load ptr, ptr @stdin, align 8, !tbaa !5
  %2 = tail call ptr @freopen(ptr noundef nonnull @.str, ptr noundef nonnull @.str.1, ptr noundef %1)
  %3 = load ptr, ptr @stdout, align 8, !tbaa !5
  %4 = tail call ptr @freopen(ptr noundef nonnull @.str.2, ptr noundef nonnull @.str.3, ptr noundef %3)
  %5 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.4, ptr noundef nonnull @n, ptr noundef nonnull @m)
  store i32 1, ptr getelementptr inbounds (i8, ptr @g, i64 808), align 8, !tbaa !9
  store i32 1, ptr getelementptr inbounds (i8, ptr @f, i64 808), align 8, !tbaa !9
  %6 = load i32, ptr @m, align 4, !tbaa !9
  %.not48 = icmp slt i32 %6, 2
  %.pre = load i32, ptr @n, align 4, !tbaa !9
  br i1 %.not48, label %._crit_edge50, label %.preheader41.lr.ph

.preheader41.lr.ph:                               ; preds = %0
  %.not3844 = icmp slt i32 %.pre, 3
  br i1 %.not3844, label %.preheader41.lr.ph.split.us, label %.preheader41.preheader

.preheader41.preheader:                           ; preds = %.preheader41.lr.ph
  %7 = add nuw i32 %.pre, 1
  %8 = add nuw i32 %6, 1
  %wide.trip.count71 = zext i32 %8 to i64
  %wide.trip.count = zext i32 %7 to i64
  %9 = zext nneg i32 %.pre to i64
  %min.iters.check = icmp eq i32 %.pre, 3
  %n.vec = and i64 %9, 2147483644
  %ind.end = or disjoint i64 %n.vec, 1
  %cmp.n = icmp eq i64 %n.vec, %9
  br label %.preheader41

.preheader41.lr.ph.split.us:                      ; preds = %.preheader41.lr.ph
  %.not3946 = icmp slt i32 %.pre, 1
  br i1 %.not3946, label %._crit_edge50, label %.preheader41.us.preheader

.preheader41.us.preheader:                        ; preds = %.preheader41.lr.ph.split.us
  %10 = add nuw i32 %6, 1
  %wide.trip.count81 = zext i32 %10 to i64
  %exitcond77.not = icmp eq i32 %.pre, 1
  br label %.preheader41.us

.preheader41.us:                                  ; preds = %.preheader41.us.preheader, %._crit_edge.us
  %indvars.iv78 = phi i64 [ 2, %.preheader41.us.preheader ], [ %indvars.iv.next79, %._crit_edge.us ]
  %11 = add nsw i64 %indvars.iv78, -1
  %12 = getelementptr inbounds [201 x [201 x i32]], ptr @g, i64 0, i64 %11, i64 1
  %13 = load i32, ptr %12, align 4, !tbaa !9
  %14 = getelementptr inbounds [201 x [201 x i32]], ptr @f, i64 0, i64 %indvars.iv78, i64 1
  %15 = load i32, ptr %14, align 4, !tbaa !9
  %16 = add nsw i32 %15, %13
  %17 = getelementptr inbounds [201 x [201 x i32]], ptr @g, i64 0, i64 %indvars.iv78, i64 1
  %18 = icmp sgt i32 %16, 9900
  %19 = add nsw i32 %16, -9901
  %spec.select.us = select i1 %18, i32 %19, i32 %16
  store i32 %spec.select.us, ptr %17, align 4, !tbaa !9
  br i1 %exitcond77.not, label %._crit_edge.us, label %20, !llvm.loop !11

20:                                               ; preds = %.preheader41.us
  %21 = getelementptr inbounds [201 x [201 x i32]], ptr @g, i64 0, i64 %11, i64 2
  %22 = load i32, ptr %21, align 4, !tbaa !9
  %23 = getelementptr inbounds [201 x [201 x i32]], ptr @f, i64 0, i64 %indvars.iv78, i64 2
  %24 = load i32, ptr %23, align 4, !tbaa !9
  %25 = add nsw i32 %24, %22
  %26 = getelementptr inbounds [201 x [201 x i32]], ptr @g, i64 0, i64 %indvars.iv78, i64 2
  %27 = icmp sgt i32 %25, 9900
  %28 = add nsw i32 %25, -9901
  %spec.select.us.1 = select i1 %27, i32 %28, i32 %25
  store i32 %spec.select.us.1, ptr %26, align 4, !tbaa !9
  br label %._crit_edge.us

._crit_edge.us:                                   ; preds = %20, %.preheader41.us
  %indvars.iv.next79 = add nuw nsw i64 %indvars.iv78, 1
  %exitcond82.not = icmp eq i64 %indvars.iv.next79, %wide.trip.count81
  br i1 %exitcond82.not, label %._crit_edge50, label %.preheader41.us, !llvm.loop !13

.preheader41:                                     ; preds = %.preheader41.preheader, %._crit_edge
  %indvars.iv68 = phi i64 [ 2, %.preheader41.preheader ], [ %indvars.iv.next69, %._crit_edge ]
  %29 = add nsw i64 %indvars.iv68, -1
  %30 = add nsw i64 %indvars.iv68, -2
  br label %.preheader

._crit_edge50:                                    ; preds = %._crit_edge, %._crit_edge.us, %.preheader41.lr.ph.split.us, %0
  %31 = sext i32 %6 to i64
  %32 = sext i32 %.pre to i64
  %33 = getelementptr inbounds [201 x [201 x i32]], ptr @f, i64 0, i64 %31, i64 %32
  %34 = load i32, ptr %33, align 4, !tbaa !9
  %35 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.5, i32 noundef %34)
  ret i32 0

.preheader:                                       ; preds = %.preheader41, %37
  %indvars.iv60 = phi i64 [ 3, %.preheader41 ], [ %indvars.iv.next61, %37 ]
  %36 = getelementptr inbounds [201 x [201 x i32]], ptr @f, i64 0, i64 %indvars.iv68, i64 %indvars.iv60
  %.promoted = load i32, ptr %36, align 4, !tbaa !9
  br label %46

37:                                               ; preds = %46
  %indvars.iv.next61 = add nuw nsw i64 %indvars.iv60, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next61, %wide.trip.count
  br i1 %exitcond.not, label %..preheader40_crit_edge.preheader, label %.preheader, !llvm.loop !14

..preheader40_crit_edge.preheader:                ; preds = %37
  br i1 %min.iters.check, label %..preheader40_crit_edge.preheader86, label %vector.body

..preheader40_crit_edge.preheader86:              ; preds = %middle.block, %..preheader40_crit_edge.preheader
  %indvars.iv63.ph = phi i64 [ 1, %..preheader40_crit_edge.preheader ], [ %ind.end, %middle.block ]
  br label %..preheader40_crit_edge

vector.body:                                      ; preds = %..preheader40_crit_edge.preheader, %vector.body
  %index = phi i64 [ %index.next, %vector.body ], [ 0, %..preheader40_crit_edge.preheader ]
  %offset.idx = or disjoint i64 %index, 1
  %38 = getelementptr inbounds [201 x [201 x i32]], ptr @g, i64 0, i64 %29, i64 %offset.idx
  %wide.load = load <4 x i32>, ptr %38, align 4, !tbaa !9
  %39 = getelementptr inbounds [201 x [201 x i32]], ptr @f, i64 0, i64 %indvars.iv68, i64 %offset.idx
  %wide.load85 = load <4 x i32>, ptr %39, align 4, !tbaa !9
  %40 = add nsw <4 x i32> %wide.load85, %wide.load
  %41 = getelementptr inbounds [201 x [201 x i32]], ptr @g, i64 0, i64 %indvars.iv68, i64 %offset.idx
  %42 = icmp sgt <4 x i32> %40, <i32 9900, i32 9900, i32 9900, i32 9900>
  %43 = add nsw <4 x i32> %40, <i32 -9901, i32 -9901, i32 -9901, i32 -9901>
  %44 = select <4 x i1> %42, <4 x i32> %43, <4 x i32> %40
  store <4 x i32> %44, ptr %41, align 4, !tbaa !9
  %index.next = add nuw i64 %index, 4
  %45 = icmp eq i64 %index.next, %n.vec
  br i1 %45, label %middle.block, label %vector.body, !llvm.loop !15

middle.block:                                     ; preds = %vector.body
  br i1 %cmp.n, label %._crit_edge, label %..preheader40_crit_edge.preheader86

46:                                               ; preds = %.preheader, %46
  %indvars.iv = phi i64 [ 1, %.preheader ], [ %indvars.iv.next, %46 ]
  %47 = phi i32 [ %.promoted, %.preheader ], [ %62, %46 ]
  %48 = getelementptr inbounds [201 x [201 x i32]], ptr @f, i64 0, i64 %29, i64 %indvars.iv
  %49 = load i32, ptr %48, align 4, !tbaa !9
  %50 = xor i64 %indvars.iv, -1
  %51 = add nsw i64 %indvars.iv60, %50
  %52 = getelementptr inbounds [201 x [201 x i32]], ptr @g, i64 0, i64 %29, i64 %51
  %53 = load i32, ptr %52, align 4, !tbaa !9
  %54 = mul nsw i32 %53, %49
  %55 = add nsw i32 %54, %47
  %56 = getelementptr inbounds [201 x [201 x i32]], ptr @g, i64 0, i64 %30, i64 %indvars.iv
  %57 = load i32, ptr %56, align 4, !tbaa !9
  %58 = getelementptr inbounds [201 x [201 x i32]], ptr @f, i64 0, i64 %29, i64 %51
  %59 = load i32, ptr %58, align 4, !tbaa !9
  %60 = mul nsw i32 %59, %57
  %61 = add nsw i32 %55, %60
  %62 = srem i32 %61, 9901
  store i32 %62, ptr %36, align 4, !tbaa !9
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 2
  %63 = icmp ult i64 %indvars.iv.next, %indvars.iv60
  br i1 %63, label %46, label %37, !llvm.loop !18

._crit_edge:                                      ; preds = %..preheader40_crit_edge, %middle.block
  %indvars.iv.next69 = add nuw nsw i64 %indvars.iv68, 1
  %exitcond72.not = icmp eq i64 %indvars.iv.next69, %wide.trip.count71
  br i1 %exitcond72.not, label %._crit_edge50, label %.preheader41, !llvm.loop !13

..preheader40_crit_edge:                          ; preds = %..preheader40_crit_edge.preheader86, %..preheader40_crit_edge
  %indvars.iv63 = phi i64 [ %indvars.iv.next64, %..preheader40_crit_edge ], [ %indvars.iv63.ph, %..preheader40_crit_edge.preheader86 ]
  %64 = getelementptr inbounds [201 x [201 x i32]], ptr @g, i64 0, i64 %29, i64 %indvars.iv63
  %65 = load i32, ptr %64, align 4, !tbaa !9
  %66 = getelementptr inbounds [201 x [201 x i32]], ptr @f, i64 0, i64 %indvars.iv68, i64 %indvars.iv63
  %67 = load i32, ptr %66, align 4, !tbaa !9
  %68 = add nsw i32 %67, %65
  %69 = getelementptr inbounds [201 x [201 x i32]], ptr @g, i64 0, i64 %indvars.iv68, i64 %indvars.iv63
  %70 = icmp sgt i32 %68, 9900
  %71 = add nsw i32 %68, -9901
  %spec.select = select i1 %70, i32 %71, i32 %68
  store i32 %spec.select, ptr %69, align 4, !tbaa !9
  %indvars.iv.next64 = add nuw nsw i64 %indvars.iv63, 1
  %exitcond67.not = icmp eq i64 %indvars.iv.next64, %wide.trip.count
  br i1 %exitcond67.not, label %._crit_edge, label %..preheader40_crit_edge, !llvm.loop !19
}

declare ptr @freopen(ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #1

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

; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #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 = { "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 = { 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" }

!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 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = distinct !{!13, !12}
!14 = distinct !{!14, !12}
!15 = distinct !{!15, !12, !16, !17}
!16 = !{!"llvm.loop.isvectorized", i32 1}
!17 = !{!"llvm.loop.unroll.runtime.disable"}
!18 = distinct !{!18, !12}
!19 = distinct !{!19, !12, !17, !16}


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