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

; 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
@a = external dso_local global [102 x [102 x i32]], align 16
@sum = external dso_local global i32, align 4
@ans = external dso_local global i32, align 4
@.str = external hidden unnamed_addr constant [5 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [3 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 zeroext i1 @_Z5checkii(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 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
  store i32 0, ptr %1, align 4
  %9 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef @n, ptr noundef @m)
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #4
  store i32 1, ptr %2, align 4, !tbaa !5
  br label %10

10:                                               ; preds = %42, %0
  %11 = load i32, ptr %2, align 4, !tbaa !5
  %12 = load i32, ptr @n, align 4, !tbaa !5
  %13 = icmp sle i32 %11, %12
  br i1 %13, label %15, label %14

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

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

16:                                               ; preds = %38, %15
  %17 = load i32, ptr %4, align 4, !tbaa !5
  %18 = load i32, ptr @m, align 4, !tbaa !5
  %19 = icmp sle i32 %17, %18
  br i1 %19, label %21, label %20

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

21:                                               ; preds = %16
  %22 = load i32, ptr %2, align 4, !tbaa !5
  %23 = sext i32 %22 to i64
  %24 = getelementptr inbounds [102 x [102 x i32]], ptr @a, i64 0, i64 %23
  %25 = load i32, ptr %4, align 4, !tbaa !5
  %26 = sext i32 %25 to i64
  %27 = getelementptr inbounds [102 x i32], ptr %24, i64 0, i64 %26
  %28 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.1, ptr noundef %27)
  %29 = load i32, ptr %2, align 4, !tbaa !5
  %30 = sext i32 %29 to i64
  %31 = getelementptr inbounds [102 x [102 x i32]], ptr @a, i64 0, i64 %30
  %32 = load i32, ptr %4, align 4, !tbaa !5
  %33 = sext i32 %32 to i64
  %34 = getelementptr inbounds [102 x i32], ptr %31, i64 0, i64 %33
  %35 = load i32, ptr %34, align 4, !tbaa !5
  %36 = load i32, ptr @sum, align 4, !tbaa !5
  %37 = add nsw i32 %36, %35
  store i32 %37, ptr @sum, align 4, !tbaa !5
  br label %38

38:                                               ; preds = %21
  %39 = load i32, ptr %4, align 4, !tbaa !5
  %40 = add nsw i32 %39, 1
  store i32 %40, ptr %4, align 4, !tbaa !5
  br label %16, !llvm.loop !9

41:                                               ; preds = %20
  br label %42

42:                                               ; preds = %41
  %43 = load i32, ptr %2, align 4, !tbaa !5
  %44 = add nsw i32 %43, 1
  store i32 %44, ptr %2, align 4, !tbaa !5
  br label %10, !llvm.loop !11

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

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

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

51:                                               ; preds = %47
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #4
  %52 = load i32, ptr @m, align 4, !tbaa !5
  store i32 %52, ptr %6, align 4, !tbaa !5
  br label %53

53:                                               ; preds = %93, %51
  %54 = load i32, ptr %6, align 4, !tbaa !5
  %55 = icmp ne i32 %54, 0
  br i1 %55, label %57, label %56

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

57:                                               ; preds = %53
  %58 = load i32, ptr %5, align 4, !tbaa !5
  %59 = sub nsw i32 %58, 1
  %60 = sext i32 %59 to i64
  %61 = getelementptr inbounds [102 x [102 x i32]], ptr @a, i64 0, i64 %60
  %62 = load i32, ptr %6, align 4, !tbaa !5
  %63 = sext i32 %62 to i64
  %64 = getelementptr inbounds [102 x i32], ptr %61, i64 0, i64 %63
  %65 = load i32, ptr %64, align 4, !tbaa !5
  %66 = load i32, ptr %5, align 4, !tbaa !5
  %67 = sext i32 %66 to i64
  %68 = getelementptr inbounds [102 x [102 x i32]], ptr @a, i64 0, i64 %67
  %69 = load i32, ptr %6, align 4, !tbaa !5
  %70 = sub nsw i32 %69, 1
  %71 = sext i32 %70 to i64
  %72 = getelementptr inbounds [102 x i32], ptr %68, i64 0, i64 %71
  %73 = load i32, ptr %72, align 4, !tbaa !5
  %74 = add nsw i32 %65, %73
  %75 = load i32, ptr %5, align 4, !tbaa !5
  %76 = sub nsw i32 %75, 1
  %77 = sext i32 %76 to i64
  %78 = getelementptr inbounds [102 x [102 x i32]], ptr @a, i64 0, i64 %77
  %79 = load i32, ptr %6, align 4, !tbaa !5
  %80 = sub nsw i32 %79, 1
  %81 = sext i32 %80 to i64
  %82 = getelementptr inbounds [102 x i32], ptr %78, i64 0, i64 %81
  %83 = load i32, ptr %82, align 4, !tbaa !5
  %84 = sub nsw i32 %74, %83
  %85 = load i32, ptr %5, align 4, !tbaa !5
  %86 = sext i32 %85 to i64
  %87 = getelementptr inbounds [102 x [102 x i32]], ptr @a, i64 0, i64 %86
  %88 = load i32, ptr %6, align 4, !tbaa !5
  %89 = sext i32 %88 to i64
  %90 = getelementptr inbounds [102 x i32], ptr %87, i64 0, i64 %89
  %91 = load i32, ptr %90, align 4, !tbaa !5
  %92 = sub nsw i32 %91, %84
  store i32 %92, ptr %90, align 4, !tbaa !5
  br label %93

93:                                               ; preds = %57
  %94 = load i32, ptr %6, align 4, !tbaa !5
  %95 = add nsw i32 %94, -1
  store i32 %95, ptr %6, align 4, !tbaa !5
  br label %53, !llvm.loop !12

96:                                               ; preds = %56
  br label %97

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

100:                                              ; preds = %50
  %101 = load i32, ptr @sum, align 4, !tbaa !5
  store i32 %101, ptr @ans, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #4
  %102 = load i32, ptr @n, align 4, !tbaa !5
  store i32 %102, ptr %7, align 4, !tbaa !5
  br label %103

103:                                              ; preds = %143, %100
  %104 = load i32, ptr %7, align 4, !tbaa !5
  %105 = icmp ne i32 %104, 0
  br i1 %105, label %107, label %106

106:                                              ; preds = %103
  store i32 14, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #4
  br label %146

107:                                              ; preds = %103
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #4
  %108 = load i32, ptr @m, align 4, !tbaa !5
  store i32 %108, ptr %8, align 4, !tbaa !5
  br label %109

109:                                              ; preds = %139, %107
  %110 = load i32, ptr %8, align 4, !tbaa !5
  %111 = icmp ne i32 %110, 0
  br i1 %111, label %113, label %112

112:                                              ; preds = %109
  store i32 17, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #4
  br label %142

113:                                              ; preds = %109
  %114 = load i32, ptr @sum, align 4, !tbaa !5
  %115 = load i32, ptr %7, align 4, !tbaa !5
  %116 = load i32, ptr %8, align 4, !tbaa !5
  %117 = mul nsw i32 %115, %116
  %118 = srem i32 %114, %117
  %119 = icmp eq i32 %118, 0
  br i1 %119, label %120, label %138

120:                                              ; preds = %113
  %121 = load i32, ptr @ans, align 4, !tbaa !5
  %122 = load i32, ptr @sum, align 4, !tbaa !5
  %123 = load i32, ptr %7, align 4, !tbaa !5
  %124 = sdiv i32 %122, %123
  %125 = load i32, ptr %8, align 4, !tbaa !5
  %126 = sdiv i32 %124, %125
  %127 = icmp sgt i32 %121, %126
  br i1 %127, label %128, label %138

128:                                              ; preds = %120
  %129 = load i32, ptr %7, align 4, !tbaa !5
  %130 = load i32, ptr %8, align 4, !tbaa !5
  %131 = call noundef zeroext i1 @_Z5checkii(i32 noundef %129, i32 noundef %130)
  br i1 %131, label %132, label %138

132:                                              ; preds = %128
  %133 = load i32, ptr @sum, align 4, !tbaa !5
  %134 = load i32, ptr %7, align 4, !tbaa !5
  %135 = sdiv i32 %133, %134
  %136 = load i32, ptr %8, align 4, !tbaa !5
  %137 = sdiv i32 %135, %136
  store i32 %137, ptr @ans, align 4, !tbaa !5
  br label %138

138:                                              ; preds = %132, %128, %120, %113
  br label %139

139:                                              ; preds = %138
  %140 = load i32, ptr %8, align 4, !tbaa !5
  %141 = add nsw i32 %140, -1
  store i32 %141, ptr %8, align 4, !tbaa !5
  br label %109, !llvm.loop !14

142:                                              ; preds = %112
  br label %143

143:                                              ; preds = %142
  %144 = load i32, ptr %7, align 4, !tbaa !5
  %145 = add nsw i32 %144, -1
  store i32 %145, ptr %7, align 4, !tbaa !5
  br label %103, !llvm.loop !15

146:                                              ; preds = %106
  %147 = load i32, ptr @ans, align 4, !tbaa !5
  %148 = call i32 (ptr, ...) @printf(ptr noundef @.str.2, i32 noundef %147)
  ret i32 0
}

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}
!15 = distinct !{!15, !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"

@n = external dso_local global i32, align 4
@m = external dso_local global i32, align 4
@a = external dso_local global [102 x [102 x i32]], align 16
@sum = external dso_local local_unnamed_addr global i32, align 4
@ans = external dso_local local_unnamed_addr global i32, align 4
@.str = external hidden unnamed_addr constant [5 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [3 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 zeroext i1 @_Z5checkii(i32 noundef, i32 noundef) local_unnamed_addr #0

; Function Attrs: mustprogress norecurse nounwind uwtable
define dso_local noundef i32 @main() local_unnamed_addr #1 {
  %1 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @n, ptr noundef nonnull @m)
  %2 = load i32, ptr @n, align 4, !tbaa !5
  %.not49 = icmp slt i32 %2, 1
  br i1 %.not49, label %.preheader, label %.preheader46.lr.ph

.preheader46.lr.ph:                               ; preds = %0
  %3 = load i32, ptr @m, align 4, !tbaa !5
  %4 = icmp slt i32 %3, 1
  br i1 %4, label %.lr.ph58, label %.preheader46

.preheader46:                                     ; preds = %.preheader46.lr.ph, %._crit_edge
  %5 = phi i32 [ %11, %._crit_edge ], [ %2, %.preheader46.lr.ph ]
  %6 = phi i32 [ %12, %._crit_edge ], [ %3, %.preheader46.lr.ph ]
  %indvars.iv75 = phi i64 [ %indvars.iv.next76, %._crit_edge ], [ 1, %.preheader46.lr.ph ]
  %.not4247 = icmp slt i32 %6, 1
  br i1 %.not4247, label %._crit_edge, label %.lr.ph

.preheader:                                       ; preds = %._crit_edge, %0
  %.lcssa = phi i32 [ %2, %0 ], [ %11, %._crit_edge ]
  %.not3856 = icmp eq i32 %.lcssa, 0
  br i1 %.not3856, label %._crit_edge59.thread, label %.lr.ph58thread-pre-split

._crit_edge59.thread:                             ; preds = %.preheader
  %7 = load i32, ptr @sum, align 4, !tbaa !5
  store i32 %7, ptr @ans, align 4, !tbaa !5
  br label %._crit_edge69

.lr.ph58thread-pre-split:                         ; preds = %.preheader
  %.pr = load i32, ptr @m, align 4, !tbaa !5
  br label %.lr.ph58

.lr.ph58:                                         ; preds = %.preheader46.lr.ph, %.lr.ph58thread-pre-split
  %8 = phi i32 [ %.pr, %.lr.ph58thread-pre-split ], [ %3, %.preheader46.lr.ph ]
  %.lcssa96 = phi i32 [ %.lcssa, %.lr.ph58thread-pre-split ], [ %2, %.preheader46.lr.ph ]
  %.not4151 = icmp eq i32 %8, 0
  br i1 %.not4151, label %._crit_edge59, label %.lr.ph54.preheader

.lr.ph54.preheader:                               ; preds = %.lr.ph58
  %9 = sext i32 %8 to i64
  %10 = sext i32 %.lcssa96 to i64
  %min.iters.check = icmp ult i32 %8, 8
  %n.vec = and i64 %9, -8
  %ind.end = and i64 %9, 7
  %cmp.n = icmp eq i64 %n.vec, %9
  br label %.lr.ph54

._crit_edge.loopexit:                             ; preds = %.lr.ph
  %.pre = load i32, ptr @n, align 4, !tbaa !5
  br label %._crit_edge

._crit_edge:                                      ; preds = %._crit_edge.loopexit, %.preheader46
  %11 = phi i32 [ %.pre, %._crit_edge.loopexit ], [ %5, %.preheader46 ]
  %12 = phi i32 [ %19, %._crit_edge.loopexit ], [ %6, %.preheader46 ]
  %indvars.iv.next76 = add nuw nsw i64 %indvars.iv75, 1
  %13 = sext i32 %11 to i64
  %.not.not = icmp slt i64 %indvars.iv75, %13
  br i1 %.not.not, label %.preheader46, label %.preheader, !llvm.loop !9

.lr.ph:                                           ; preds = %.preheader46, %.lr.ph
  %indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph ], [ 1, %.preheader46 ]
  %14 = getelementptr inbounds [102 x [102 x i32]], ptr @a, i64 0, i64 %indvars.iv75, i64 %indvars.iv
  %15 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %14)
  %16 = load i32, ptr %14, align 4, !tbaa !5
  %17 = load i32, ptr @sum, align 4, !tbaa !5
  %18 = add nsw i32 %17, %16
  store i32 %18, ptr @sum, align 4, !tbaa !5
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %19 = load i32, ptr @m, align 4, !tbaa !5
  %20 = sext i32 %19 to i64
  %.not42.not = icmp slt i64 %indvars.iv, %20
  br i1 %.not42.not, label %.lr.ph, label %._crit_edge.loopexit, !llvm.loop !12

._crit_edge59:                                    ; preds = %._crit_edge55, %.lr.ph58
  %21 = load i32, ptr @sum, align 4, !tbaa !5
  store i32 %21, ptr @ans, align 4, !tbaa !5
  %22 = load i32, ptr @m, align 4
  %23 = icmp eq i32 %22, 0
  br i1 %23, label %._crit_edge69, label %.lr.ph68.split

.lr.ph54:                                         ; preds = %.lr.ph54.preheader, %._crit_edge55
  %indvars.iv81 = phi i64 [ %10, %.lr.ph54.preheader ], [ %indvars.iv.next82, %._crit_edge55 ]
  %indvars.iv.next82 = add nsw i64 %indvars.iv81, -1
  %.phi.trans.insert = getelementptr inbounds [102 x [102 x i32]], ptr @a, i64 0, i64 %indvars.iv.next82, i64 %9
  %.pre84 = load i32, ptr %.phi.trans.insert, align 4, !tbaa !5
  %.phi.trans.insert85 = getelementptr inbounds [102 x [102 x i32]], ptr @a, i64 0, i64 %indvars.iv81, i64 %9
  %.pre86 = load i32, ptr %.phi.trans.insert85, align 4, !tbaa !5
  br i1 %min.iters.check, label %scalar.ph.preheader, label %vector.ph

scalar.ph.preheader:                              ; preds = %middle.block, %.lr.ph54
  %.ph = phi i32 [ %.pre86, %.lr.ph54 ], [ %vector.recur.extract, %middle.block ]
  %.ph120 = phi i32 [ %.pre84, %.lr.ph54 ], [ %vector.recur.extract118, %middle.block ]
  %indvars.iv78.ph = phi i64 [ %9, %.lr.ph54 ], [ %ind.end, %middle.block ]
  br label %scalar.ph

vector.ph:                                        ; preds = %.lr.ph54
  %vector.recur.init = insertelement <4 x i32> poison, i32 %.pre86, i64 3
  %vector.recur.init108 = insertelement <4 x i32> poison, i32 %.pre84, 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 ], [ %reverse111, %vector.body ]
  %vector.recur109 = phi <4 x i32> [ %vector.recur.init108, %vector.ph ], [ %reverse115, %vector.body ]
  %offset.idx = sub i64 %9, %index
  %24 = add nsw i64 %offset.idx, -1
  %25 = getelementptr inbounds [102 x [102 x i32]], ptr @a, i64 0, i64 %indvars.iv81, i64 %24
  %26 = getelementptr inbounds i8, ptr %25, i64 -12
  %27 = getelementptr inbounds i8, ptr %25, i64 -28
  %wide.load = load <4 x i32>, ptr %26, align 4, !tbaa !5
  %reverse = shufflevector <4 x i32> %wide.load, <4 x i32> poison, <4 x i32> <i32 3, i32 2, i32 1, i32 0>
  %wide.load110 = load <4 x i32>, ptr %27, align 4, !tbaa !5
  %reverse111 = shufflevector <4 x i32> %wide.load110, <4 x i32> poison, <4 x i32> <i32 3, i32 2, i32 1, i32 0>
  %28 = shufflevector <4 x i32> %vector.recur, <4 x i32> %reverse, <4 x i32> <i32 3, i32 4, i32 5, i32 6>
  %29 = shufflevector <4 x i32> %reverse, <4 x i32> %reverse111, <4 x i32> <i32 3, i32 4, i32 5, i32 6>
  %30 = getelementptr inbounds [102 x [102 x i32]], ptr @a, i64 0, i64 %indvars.iv.next82, i64 %24
  %31 = getelementptr inbounds i8, ptr %30, i64 -12
  %32 = getelementptr inbounds i8, ptr %30, i64 -28
  %wide.load112 = load <4 x i32>, ptr %31, align 4, !tbaa !5
  %reverse113 = shufflevector <4 x i32> %wide.load112, <4 x i32> poison, <4 x i32> <i32 3, i32 2, i32 1, i32 0>
  %wide.load114 = load <4 x i32>, ptr %32, align 4, !tbaa !5
  %reverse115 = shufflevector <4 x i32> %wide.load114, <4 x i32> poison, <4 x i32> <i32 3, i32 2, i32 1, i32 0>
  %33 = shufflevector <4 x i32> %vector.recur109, <4 x i32> %reverse113, <4 x i32> <i32 3, i32 4, i32 5, i32 6>
  %34 = shufflevector <4 x i32> %reverse113, <4 x i32> %reverse115, <4 x i32> <i32 3, i32 4, i32 5, i32 6>
  %35 = add <4 x i32> %reverse, %33
  %36 = add <4 x i32> %reverse111, %34
  %37 = sub <4 x i32> %reverse113, %35
  %38 = sub <4 x i32> %reverse115, %36
  %39 = getelementptr inbounds [102 x [102 x i32]], ptr @a, i64 0, i64 %indvars.iv81, i64 %offset.idx
  %40 = add <4 x i32> %37, %28
  %41 = add <4 x i32> %38, %29
  %42 = getelementptr inbounds i8, ptr %39, i64 -12
  %43 = getelementptr inbounds i8, ptr %39, i64 -28
  %reverse116 = shufflevector <4 x i32> %40, <4 x i32> poison, <4 x i32> <i32 3, i32 2, i32 1, i32 0>
  store <4 x i32> %reverse116, ptr %42, align 4, !tbaa !5
  %reverse117 = shufflevector <4 x i32> %41, <4 x i32> poison, <4 x i32> <i32 3, i32 2, i32 1, i32 0>
  store <4 x i32> %reverse117, ptr %43, align 4, !tbaa !5
  %index.next = add nuw i64 %index, 8
  %44 = icmp eq i64 %index.next, %n.vec
  br i1 %44, label %middle.block, label %vector.body, !llvm.loop !13

middle.block:                                     ; preds = %vector.body
  %vector.recur.extract = extractelement <4 x i32> %wide.load110, i64 0
  %vector.recur.extract118 = extractelement <4 x i32> %wide.load114, i64 0
  br i1 %cmp.n, label %._crit_edge55, label %scalar.ph.preheader

._crit_edge55:                                    ; preds = %scalar.ph, %middle.block
  %.not38 = icmp eq i64 %indvars.iv.next82, 0
  br i1 %.not38, label %._crit_edge59, label %.lr.ph54, !llvm.loop !16

scalar.ph:                                        ; preds = %scalar.ph.preheader, %scalar.ph
  %45 = phi i32 [ %48, %scalar.ph ], [ %.ph, %scalar.ph.preheader ]
  %46 = phi i32 [ %50, %scalar.ph ], [ %.ph120, %scalar.ph.preheader ]
  %indvars.iv78 = phi i64 [ %indvars.iv.next79, %scalar.ph ], [ %indvars.iv78.ph, %scalar.ph.preheader ]
  %indvars.iv.next79 = add nsw i64 %indvars.iv78, -1
  %47 = getelementptr inbounds [102 x [102 x i32]], ptr @a, i64 0, i64 %indvars.iv81, i64 %indvars.iv.next79
  %48 = load i32, ptr %47, align 4, !tbaa !5
  %49 = getelementptr inbounds [102 x [102 x i32]], ptr @a, i64 0, i64 %indvars.iv.next82, i64 %indvars.iv.next79
  %50 = load i32, ptr %49, align 4, !tbaa !5
  %51 = add i32 %48, %46
  %.neg = sub i32 %50, %51
  %52 = getelementptr inbounds [102 x [102 x i32]], ptr @a, i64 0, i64 %indvars.iv81, i64 %indvars.iv78
  %53 = add i32 %.neg, %45
  store i32 %53, ptr %52, align 4, !tbaa !5
  %.not41 = icmp eq i64 %indvars.iv.next79, 0
  br i1 %.not41, label %._crit_edge55, label %scalar.ph, !llvm.loop !17

._crit_edge69.loopexit70:                         ; preds = %._crit_edge64
  %.pre89 = load i32, ptr @ans, align 4, !tbaa !5
  br label %._crit_edge69

._crit_edge69:                                    ; preds = %._crit_edge59.thread, %._crit_edge69.loopexit70, %._crit_edge59
  %54 = phi i32 [ %.pre89, %._crit_edge69.loopexit70 ], [ %21, %._crit_edge59 ], [ %7, %._crit_edge59.thread ]
  %55 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %54)
  ret i32 0

.lr.ph68.splitthread-pre-split:                   ; preds = %._crit_edge64
  %.pr102 = load i32, ptr @m, align 4, !tbaa !5
  br label %.lr.ph68.split

.lr.ph68.split:                                   ; preds = %._crit_edge59, %.lr.ph68.splitthread-pre-split
  %56 = phi i32 [ %.pr102, %.lr.ph68.splitthread-pre-split ], [ %22, %._crit_edge59 ]
  %.pre88 = phi i32 [ %.pre8892, %.lr.ph68.splitthread-pre-split ], [ %21, %._crit_edge59 ]
  %.03266 = phi i32 [ %57, %.lr.ph68.splitthread-pre-split ], [ %.lcssa96, %._crit_edge59 ]
  %.not4060 = icmp eq i32 %56, 0
  br i1 %.not4060, label %._crit_edge64, label %.lr.ph63

._crit_edge64:                                    ; preds = %72, %.lr.ph68.split
  %.pre8892 = phi i32 [ %.pre88, %.lr.ph68.split ], [ %.pre8890, %72 ]
  %57 = add nsw i32 %.03266, -1
  %.not39 = icmp eq i32 %57, 0
  br i1 %.not39, label %._crit_edge69.loopexit70, label %.lr.ph68.splitthread-pre-split, !llvm.loop !18

.lr.ph63:                                         ; preds = %.lr.ph68.split, %72
  %.pre8891 = phi i32 [ %.pre8890, %72 ], [ %.pre88, %.lr.ph68.split ]
  %58 = phi i32 [ %73, %72 ], [ %.pre88, %.lr.ph68.split ]
  %.061 = phi i32 [ %74, %72 ], [ %56, %.lr.ph68.split ]
  %59 = mul nsw i32 %.061, %.03266
  %60 = srem i32 %58, %59
  %61 = icmp eq i32 %60, 0
  br i1 %61, label %62, label %72

62:                                               ; preds = %.lr.ph63
  %63 = load i32, ptr @ans, align 4, !tbaa !5
  %64 = sdiv i32 %58, %.03266
  %65 = sdiv i32 %64, %.061
  %66 = icmp sgt i32 %63, %65
  br i1 %66, label %67, label %72

67:                                               ; preds = %62
  %68 = tail call noundef zeroext i1 @_Z5checkii(i32 noundef %.03266, i32 noundef %.061)
  %.pre87 = load i32, ptr @sum, align 4, !tbaa !5
  br i1 %68, label %69, label %72

69:                                               ; preds = %67
  %70 = sdiv i32 %.pre87, %.03266
  %71 = sdiv i32 %70, %.061
  store i32 %71, ptr @ans, align 4, !tbaa !5
  br label %72

72:                                               ; preds = %.lr.ph63, %62, %67, %69
  %.pre8890 = phi i32 [ %.pre8891, %.lr.ph63 ], [ %.pre8891, %62 ], [ %.pre87, %67 ], [ %.pre87, %69 ]
  %73 = phi i32 [ %58, %.lr.ph63 ], [ %58, %62 ], [ %.pre87, %67 ], [ %.pre87, %69 ]
  %74 = add nsw i32 %.061, -1
  %.not40 = icmp eq i32 %74, 0
  br i1 %.not40, label %._crit_edge64, label %.lr.ph63, !llvm.loop !19
}

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


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