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

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

%struct.Matrix = type { i32, i32, [16 x [16 x i32]] }

@k = external dso_local global i32, align 4
@p = external dso_local global i32, align 4
@A = external dso_local global %struct.Matrix, align 4
@B = external dso_local global %struct.Matrix, align 4
@n = external dso_local global i64, align 8
@m = external dso_local global i64, align 8
@.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 uwtable
declare dso_local noundef i32 @_Z4calcx(i64 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
  store i32 0, ptr %1, align 4
  %6 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef @k)
  store i32 1, ptr @A, align 4, !tbaa !5
  %7 = load i32, ptr @k, align 4, !tbaa !10
  %8 = add nsw i32 %7, 1
  store i32 %8, ptr getelementptr inbounds (%struct.Matrix, ptr @B, i32 0, i32 1), align 4, !tbaa !11
  store i32 %8, ptr @B, align 4, !tbaa !5
  store i32 %8, ptr getelementptr inbounds (%struct.Matrix, ptr @A, i32 0, i32 1), align 4, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #4
  store i32 0, ptr %2, align 4, !tbaa !10
  br label %9

9:                                                ; preds = %19, %0
  %10 = load i32, ptr %2, align 4, !tbaa !10
  %11 = load i32, ptr @k, align 4, !tbaa !10
  %12 = icmp slt i32 %10, %11
  br i1 %12, label %14, label %13

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

14:                                               ; preds = %9
  %15 = load i32, ptr %2, align 4, !tbaa !10
  %16 = sext i32 %15 to i64
  %17 = getelementptr inbounds [16 x i32], ptr getelementptr inbounds (%struct.Matrix, ptr @A, i32 0, i32 2), i64 0, i64 %16
  %18 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef %17)
  br label %19

19:                                               ; preds = %14
  %20 = load i32, ptr %2, align 4, !tbaa !10
  %21 = add nsw i32 %20, 1
  store i32 %21, ptr %2, align 4, !tbaa !10
  br label %9, !llvm.loop !12

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

23:                                               ; preds = %36, %22
  %24 = load i32, ptr %3, align 4, !tbaa !10
  %25 = load i32, ptr @k, align 4, !tbaa !10
  %26 = icmp slt i32 %24, %25
  br i1 %26, label %28, label %27

27:                                               ; preds = %23
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #4
  br label %39

28:                                               ; preds = %23
  %29 = load i32, ptr %3, align 4, !tbaa !10
  %30 = sext i32 %29 to i64
  %31 = getelementptr inbounds [16 x [16 x i32]], ptr getelementptr inbounds (%struct.Matrix, ptr @B, i32 0, i32 2), i64 0, i64 %30
  %32 = load i32, ptr %3, align 4, !tbaa !10
  %33 = sub nsw i32 %32, 1
  %34 = sext i32 %33 to i64
  %35 = getelementptr inbounds [16 x i32], ptr %31, i64 0, i64 %34
  store i32 1, ptr %35, align 4, !tbaa !10
  br label %36

36:                                               ; preds = %28
  %37 = load i32, ptr %3, align 4, !tbaa !10
  %38 = add nsw i32 %37, 1
  store i32 %38, ptr %3, align 4, !tbaa !10
  br label %23, !llvm.loop !14

39:                                               ; preds = %27
  %40 = load i32, ptr @k, align 4, !tbaa !10
  %41 = sext i32 %40 to i64
  %42 = getelementptr inbounds [16 x [16 x i32]], ptr getelementptr inbounds (%struct.Matrix, ptr @B, i32 0, i32 2), i64 0, i64 %41
  %43 = load i32, ptr @k, align 4, !tbaa !10
  %44 = sext i32 %43 to i64
  %45 = getelementptr inbounds [16 x i32], ptr %42, i64 0, i64 %44
  store i32 1, ptr %45, align 4, !tbaa !10
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #4
  %46 = load i32, ptr @k, align 4, !tbaa !10
  %47 = sub nsw i32 %46, 1
  store i32 %47, ptr %4, align 4, !tbaa !10
  br label %48

48:                                               ; preds = %75, %39
  %49 = load i32, ptr %4, align 4, !tbaa !10
  %50 = icmp sge i32 %49, 0
  br i1 %50, label %52, label %51

51:                                               ; preds = %48
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #4
  br label %78

52:                                               ; preds = %48
  %53 = load i32, ptr %4, align 4, !tbaa !10
  %54 = sext i32 %53 to i64
  %55 = getelementptr inbounds [16 x [16 x i32]], ptr getelementptr inbounds (%struct.Matrix, ptr @B, i32 0, i32 2), i64 0, i64 %54
  %56 = load i32, ptr @k, align 4, !tbaa !10
  %57 = sub nsw i32 %56, 1
  %58 = sext i32 %57 to i64
  %59 = getelementptr inbounds [16 x i32], ptr %55, i64 0, i64 %58
  %60 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef %59)
  %61 = load i32, ptr %4, align 4, !tbaa !10
  %62 = sext i32 %61 to i64
  %63 = getelementptr inbounds [16 x [16 x i32]], ptr getelementptr inbounds (%struct.Matrix, ptr @B, i32 0, i32 2), i64 0, i64 %62
  %64 = load i32, ptr @k, align 4, !tbaa !10
  %65 = sub nsw i32 %64, 1
  %66 = sext i32 %65 to i64
  %67 = getelementptr inbounds [16 x i32], ptr %63, i64 0, i64 %66
  %68 = load i32, ptr %67, align 4, !tbaa !10
  %69 = load i32, ptr %4, align 4, !tbaa !10
  %70 = sext i32 %69 to i64
  %71 = getelementptr inbounds [16 x [16 x i32]], ptr getelementptr inbounds (%struct.Matrix, ptr @B, i32 0, i32 2), i64 0, i64 %70
  %72 = load i32, ptr @k, align 4, !tbaa !10
  %73 = sext i32 %72 to i64
  %74 = getelementptr inbounds [16 x i32], ptr %71, i64 0, i64 %73
  store i32 %68, ptr %74, align 4, !tbaa !10
  br label %75

75:                                               ; preds = %52
  %76 = load i32, ptr %4, align 4, !tbaa !10
  %77 = add nsw i32 %76, -1
  store i32 %77, ptr %4, align 4, !tbaa !10
  br label %48, !llvm.loop !15

78:                                               ; preds = %51
  %79 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.1, ptr noundef @m, ptr noundef @n, ptr noundef @p)
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #4
  store i32 0, ptr %5, align 4, !tbaa !10
  br label %80

80:                                               ; preds = %109, %78
  %81 = load i32, ptr %5, align 4, !tbaa !10
  %82 = load i32, ptr @k, align 4, !tbaa !10
  %83 = icmp slt i32 %81, %82
  br i1 %83, label %85, label %84

84:                                               ; preds = %80
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #4
  br label %112

85:                                               ; preds = %80
  %86 = load i32, ptr %5, align 4, !tbaa !10
  %87 = sext i32 %86 to i64
  %88 = getelementptr inbounds [16 x i32], ptr getelementptr inbounds (%struct.Matrix, ptr @A, i32 0, i32 2), i64 0, i64 %87
  %89 = load i32, ptr %88, align 4, !tbaa !10
  %90 = load i32, ptr @k, align 4, !tbaa !10
  %91 = sext i32 %90 to i64
  %92 = getelementptr inbounds [16 x i32], ptr getelementptr inbounds (%struct.Matrix, ptr @A, i32 0, i32 2), i64 0, i64 %91
  %93 = load i32, ptr %92, align 4, !tbaa !10
  %94 = add nsw i32 %93, %89
  store i32 %94, ptr %92, align 4, !tbaa !10
  %95 = load i32, ptr @k, align 4, !tbaa !10
  %96 = sext i32 %95 to i64
  %97 = getelementptr inbounds [16 x i32], ptr getelementptr inbounds (%struct.Matrix, ptr @A, i32 0, i32 2), i64 0, i64 %96
  %98 = load i32, ptr %97, align 4, !tbaa !10
  %99 = load i32, ptr @p, align 4, !tbaa !10
  %100 = icmp sge i32 %98, %99
  br i1 %100, label %101, label %108

101:                                              ; preds = %85
  %102 = load i32, ptr @p, align 4, !tbaa !10
  %103 = load i32, ptr @k, align 4, !tbaa !10
  %104 = sext i32 %103 to i64
  %105 = getelementptr inbounds [16 x i32], ptr getelementptr inbounds (%struct.Matrix, ptr @A, i32 0, i32 2), i64 0, i64 %104
  %106 = load i32, ptr %105, align 4, !tbaa !10
  %107 = sub nsw i32 %106, %102
  store i32 %107, ptr %105, align 4, !tbaa !10
  br label %108

108:                                              ; preds = %101, %85
  br label %109

109:                                              ; preds = %108
  %110 = load i32, ptr %5, align 4, !tbaa !10
  %111 = add nsw i32 %110, 1
  store i32 %111, ptr %5, align 4, !tbaa !10
  br label %80, !llvm.loop !16

112:                                              ; preds = %84
  %113 = load i64, ptr @n, align 8, !tbaa !17
  %114 = call noundef i32 @_Z4calcx(i64 noundef %113)
  %115 = load i64, ptr @m, align 8, !tbaa !17
  %116 = sub nsw i64 %115, 1
  %117 = call noundef i32 @_Z4calcx(i64 noundef %116)
  %118 = sub nsw i32 %114, %117
  %119 = load i32, ptr @p, align 4, !tbaa !10
  %120 = add nsw i32 %118, %119
  %121 = load i32, ptr @p, align 4, !tbaa !10
  %122 = srem i32 %120, %121
  %123 = call i32 (ptr, ...) @printf(ptr noundef @.str.2, i32 noundef %122)
  ret i32 0
}

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

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

attributes #0 = { mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #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, !7, i64 0}
!6 = !{!"_ZTS6Matrix", !7, i64 0, !7, i64 4, !8, i64 8}
!7 = !{!"int", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!7, !7, i64 0}
!11 = !{!6, !7, i64 4}
!12 = distinct !{!12, !13}
!13 = !{!"llvm.loop.mustprogress"}
!14 = distinct !{!14, !13}
!15 = distinct !{!15, !13}
!16 = distinct !{!16, !13}
!17 = !{!18, !18, i64 0}
!18 = !{!"long long", !8, i64 0}


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

%struct.Matrix = type { i32, i32, [16 x [16 x i32]] }

@k = external dso_local global i32, align 4
@p = external dso_local global i32, align 4
@A = external dso_local global %struct.Matrix, align 4
@B = external dso_local global %struct.Matrix, align 4
@n = external dso_local global i64, align 8
@m = external dso_local global i64, align 8
@.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 uwtable
declare dso_local noundef i32 @_Z4calcx(i64 noundef) local_unnamed_addr #0

; Function Attrs: mustprogress norecurse 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 @k)
  store i32 1, ptr @A, align 4, !tbaa !5
  %2 = load i32, ptr @k, align 4, !tbaa !10
  %3 = add nsw i32 %2, 1
  store i32 %3, ptr getelementptr inbounds (i8, ptr @B, i64 4), align 4, !tbaa !11
  store i32 %3, ptr @B, align 4, !tbaa !5
  store i32 %3, ptr getelementptr inbounds (i8, ptr @A, i64 4), align 4, !tbaa !11
  %4 = icmp sgt i32 %2, 0
  br i1 %4, label %.lr.ph, label %._crit_edge.thread

._crit_edge.thread:                               ; preds = %0
  %5 = sext i32 %2 to i64
  %6 = getelementptr inbounds [16 x [16 x i32]], ptr getelementptr inbounds (i8, ptr @B, i64 8), i64 0, i64 %5, i64 %5
  store i32 1, ptr %6, align 4, !tbaa !10
  br label %._crit_edge28

.preheader:                                       ; preds = %.lr.ph
  %7 = icmp sgt i32 %13, 1
  br i1 %7, label %.lr.ph24.preheader, label %._crit_edge

.lr.ph24.preheader:                               ; preds = %.preheader
  %wide.trip.count = zext nneg i32 %13 to i64
  %8 = add nsw i64 %wide.trip.count, -1
  %9 = add nsw i64 %wide.trip.count, -2
  %xtraiter = and i64 %8, 3
  %10 = icmp ult i64 %9, 3
  br i1 %10, label %._crit_edge.loopexit.unr-lcssa, label %.lr.ph24.preheader.new

.lr.ph24.preheader.new:                           ; preds = %.lr.ph24.preheader
  %unroll_iter = and i64 %8, -4
  br label %.lr.ph24

.lr.ph:                                           ; preds = %0, %.lr.ph
  %indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph ], [ 0, %0 ]
  %11 = getelementptr inbounds [16 x i32], ptr getelementptr inbounds (i8, ptr @A, i64 8), i64 0, i64 %indvars.iv
  %12 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %11)
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %13 = load i32, ptr @k, align 4, !tbaa !10
  %14 = sext i32 %13 to i64
  %15 = icmp slt i64 %indvars.iv.next, %14
  br i1 %15, label %.lr.ph, label %.preheader, !llvm.loop !12

._crit_edge.loopexit.unr-lcssa:                   ; preds = %.lr.ph24, %.lr.ph24.preheader
  %indvars.iv35.unr = phi i64 [ 1, %.lr.ph24.preheader ], [ %indvars.iv.next36.3, %.lr.ph24 ]
  %lcmp.mod.not = icmp eq i64 %xtraiter, 0
  br i1 %lcmp.mod.not, label %._crit_edge, label %.lr.ph24.epil

.lr.ph24.epil:                                    ; preds = %._crit_edge.loopexit.unr-lcssa, %.lr.ph24.epil
  %indvars.iv35.epil = phi i64 [ %indvars.iv.next36.epil, %.lr.ph24.epil ], [ %indvars.iv35.unr, %._crit_edge.loopexit.unr-lcssa ]
  %epil.iter = phi i64 [ %epil.iter.next, %.lr.ph24.epil ], [ 0, %._crit_edge.loopexit.unr-lcssa ]
  %16 = add nsw i64 %indvars.iv35.epil, -1
  %17 = getelementptr inbounds [16 x [16 x i32]], ptr getelementptr inbounds (i8, ptr @B, i64 8), i64 0, i64 %indvars.iv35.epil, i64 %16
  store i32 1, ptr %17, align 4, !tbaa !10
  %indvars.iv.next36.epil = add nuw nsw i64 %indvars.iv35.epil, 1
  %epil.iter.next = add i64 %epil.iter, 1
  %epil.iter.cmp.not = icmp eq i64 %epil.iter.next, %xtraiter
  br i1 %epil.iter.cmp.not, label %._crit_edge, label %.lr.ph24.epil, !llvm.loop !14

._crit_edge:                                      ; preds = %._crit_edge.loopexit.unr-lcssa, %.lr.ph24.epil, %.preheader
  %18 = sext i32 %13 to i64
  %19 = getelementptr inbounds [16 x [16 x i32]], ptr getelementptr inbounds (i8, ptr @B, i64 8), i64 0, i64 %18, i64 %18
  store i32 1, ptr %19, align 4, !tbaa !10
  %20 = icmp sgt i32 %13, 0
  br i1 %20, label %.lr.ph27.preheader, label %._crit_edge28

.lr.ph27.preheader:                               ; preds = %._crit_edge
  %21 = zext nneg i32 %13 to i64
  br label %.lr.ph27

.lr.ph24:                                         ; preds = %.lr.ph24, %.lr.ph24.preheader.new
  %indvars.iv35 = phi i64 [ 1, %.lr.ph24.preheader.new ], [ %indvars.iv.next36.3, %.lr.ph24 ]
  %niter = phi i64 [ 0, %.lr.ph24.preheader.new ], [ %niter.next.3, %.lr.ph24 ]
  %22 = add nsw i64 %indvars.iv35, -1
  %23 = getelementptr inbounds [16 x [16 x i32]], ptr getelementptr inbounds (i8, ptr @B, i64 8), i64 0, i64 %indvars.iv35, i64 %22
  store i32 1, ptr %23, align 4, !tbaa !10
  %indvars.iv.next36 = add nuw nsw i64 %indvars.iv35, 1
  %24 = getelementptr inbounds [16 x [16 x i32]], ptr getelementptr inbounds (i8, ptr @B, i64 8), i64 0, i64 %indvars.iv.next36, i64 %indvars.iv35
  store i32 1, ptr %24, align 4, !tbaa !10
  %indvars.iv.next36.1 = add nuw nsw i64 %indvars.iv35, 2
  %25 = add nuw nsw i64 %indvars.iv35, 1
  %26 = getelementptr inbounds [16 x [16 x i32]], ptr getelementptr inbounds (i8, ptr @B, i64 8), i64 0, i64 %indvars.iv.next36.1, i64 %25
  store i32 1, ptr %26, align 4, !tbaa !10
  %indvars.iv.next36.2 = add nuw nsw i64 %indvars.iv35, 3
  %27 = add nuw nsw i64 %indvars.iv35, 2
  %28 = getelementptr inbounds [16 x [16 x i32]], ptr getelementptr inbounds (i8, ptr @B, i64 8), i64 0, i64 %indvars.iv.next36.2, i64 %27
  store i32 1, ptr %28, align 4, !tbaa !10
  %indvars.iv.next36.3 = add nuw nsw i64 %indvars.iv35, 4
  %niter.next.3 = add nuw i64 %niter, 4
  %niter.ncmp.3 = icmp eq i64 %niter.next.3, %unroll_iter
  br i1 %niter.ncmp.3, label %._crit_edge.loopexit.unr-lcssa, label %.lr.ph24, !llvm.loop !16

._crit_edge28:                                    ; preds = %.lr.ph27, %._crit_edge.thread, %._crit_edge
  %29 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull @m, ptr noundef nonnull @n, ptr noundef nonnull @p)
  %30 = load i32, ptr @k, align 4, !tbaa !10
  %31 = icmp sgt i32 %30, 0
  br i1 %31, label %.lr.ph31, label %._crit_edge32

.lr.ph31:                                         ; preds = %._crit_edge28
  %32 = zext nneg i32 %30 to i64
  %33 = getelementptr inbounds [16 x i32], ptr getelementptr inbounds (i8, ptr @A, i64 8), i64 0, i64 %32
  %34 = load i32, ptr @p, align 4, !tbaa !10
  %.promoted = load i32, ptr %33, align 4, !tbaa !10
  %xtraiter49 = and i64 %32, 1
  %35 = icmp eq i32 %30, 1
  br i1 %35, label %._crit_edge32.loopexit.unr-lcssa, label %.lr.ph31.new

.lr.ph31.new:                                     ; preds = %.lr.ph31
  %unroll_iter52 = and i64 %32, 2147483646
  br label %63

.lr.ph27:                                         ; preds = %.lr.ph27.preheader, %.lr.ph27
  %36 = phi i32 [ %13, %.lr.ph27.preheader ], [ %41, %.lr.ph27 ]
  %indvars.iv38 = phi i64 [ %21, %.lr.ph27.preheader ], [ %indvars.iv.next39, %.lr.ph27 ]
  %indvars.iv.next39 = add nsw i64 %indvars.iv38, -1
  %37 = add nsw i32 %36, -1
  %38 = sext i32 %37 to i64
  %39 = getelementptr inbounds [16 x [16 x i32]], ptr getelementptr inbounds (i8, ptr @B, i64 8), i64 0, i64 %indvars.iv.next39, i64 %38
  %40 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %39)
  %41 = load i32, ptr @k, align 4, !tbaa !10
  %42 = add nsw i32 %41, -1
  %43 = sext i32 %42 to i64
  %44 = getelementptr inbounds [16 x [16 x i32]], ptr getelementptr inbounds (i8, ptr @B, i64 8), i64 0, i64 %indvars.iv.next39, i64 %43
  %45 = load i32, ptr %44, align 4, !tbaa !10
  %46 = sext i32 %41 to i64
  %47 = getelementptr inbounds [16 x [16 x i32]], ptr getelementptr inbounds (i8, ptr @B, i64 8), i64 0, i64 %indvars.iv.next39, i64 %46
  store i32 %45, ptr %47, align 4, !tbaa !10
  %48 = icmp ugt i64 %indvars.iv38, 1
  br i1 %48, label %.lr.ph27, label %._crit_edge28, !llvm.loop !17

._crit_edge32.loopexit.unr-lcssa:                 ; preds = %63, %.lr.ph31
  %indvars.iv41.unr = phi i64 [ 0, %.lr.ph31 ], [ %indvars.iv.next42.1, %63 ]
  %.unr = phi i32 [ %.promoted, %.lr.ph31 ], [ %spec.select.1, %63 ]
  %lcmp.mod51.not = icmp eq i64 %xtraiter49, 0
  br i1 %lcmp.mod51.not, label %._crit_edge32, label %._crit_edge32.loopexit.epilog-lcssa

._crit_edge32.loopexit.epilog-lcssa:              ; preds = %._crit_edge32.loopexit.unr-lcssa
  %49 = getelementptr inbounds [16 x i32], ptr getelementptr inbounds (i8, ptr @A, i64 8), i64 0, i64 %indvars.iv41.unr
  %50 = load i32, ptr %49, align 4, !tbaa !10
  %51 = add nsw i32 %.unr, %50
  %.not.epil = icmp slt i32 %51, %34
  %52 = select i1 %.not.epil, i32 0, i32 %34
  %spec.select.epil = sub nsw i32 %51, %52
  store i32 %spec.select.epil, ptr %33, align 4, !tbaa !10
  br label %._crit_edge32

._crit_edge32:                                    ; preds = %._crit_edge32.loopexit.epilog-lcssa, %._crit_edge32.loopexit.unr-lcssa, %._crit_edge28
  %53 = load i64, ptr @n, align 8, !tbaa !18
  %54 = tail call noundef i32 @_Z4calcx(i64 noundef %53)
  %55 = load i64, ptr @m, align 8, !tbaa !18
  %56 = add nsw i64 %55, -1
  %57 = tail call noundef i32 @_Z4calcx(i64 noundef %56)
  %58 = sub i32 %54, %57
  %59 = load i32, ptr @p, align 4, !tbaa !10
  %60 = add nsw i32 %58, %59
  %61 = srem i32 %60, %59
  %62 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %61)
  ret i32 0

63:                                               ; preds = %63, %.lr.ph31.new
  %indvars.iv41 = phi i64 [ 0, %.lr.ph31.new ], [ %indvars.iv.next42.1, %63 ]
  %64 = phi i32 [ %.promoted, %.lr.ph31.new ], [ %spec.select.1, %63 ]
  %niter53 = phi i64 [ 0, %.lr.ph31.new ], [ %niter53.next.1, %63 ]
  %65 = getelementptr inbounds [16 x i32], ptr getelementptr inbounds (i8, ptr @A, i64 8), i64 0, i64 %indvars.iv41
  %66 = load i32, ptr %65, align 4, !tbaa !10
  %67 = add nsw i32 %64, %66
  %.not = icmp slt i32 %67, %34
  %68 = select i1 %.not, i32 0, i32 %34
  %spec.select = sub nsw i32 %67, %68
  store i32 %spec.select, ptr %33, align 4, !tbaa !10
  %indvars.iv.next42 = or disjoint i64 %indvars.iv41, 1
  %69 = getelementptr inbounds [16 x i32], ptr getelementptr inbounds (i8, ptr @A, i64 8), i64 0, i64 %indvars.iv.next42
  %70 = load i32, ptr %69, align 4, !tbaa !10
  %71 = add nsw i32 %spec.select, %70
  %.not.1 = icmp slt i32 %71, %34
  %72 = select i1 %.not.1, i32 0, i32 %34
  %spec.select.1 = sub nsw i32 %71, %72
  store i32 %spec.select.1, ptr %33, align 4, !tbaa !10
  %indvars.iv.next42.1 = add nuw nsw i64 %indvars.iv41, 2
  %niter53.next.1 = add i64 %niter53, 2
  %niter53.ncmp.1 = icmp eq i64 %niter53.next.1, %unroll_iter52
  br i1 %niter53.ncmp.1, label %._crit_edge32.loopexit.unr-lcssa, label %63, !llvm.loop !20
}

; 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 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 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, !7, i64 0}
!6 = !{!"_ZTS6Matrix", !7, i64 0, !7, i64 4, !8, i64 8}
!7 = !{!"int", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!7, !7, i64 0}
!11 = !{!6, !7, i64 4}
!12 = distinct !{!12, !13}
!13 = !{!"llvm.loop.mustprogress"}
!14 = distinct !{!14, !15}
!15 = !{!"llvm.loop.unroll.disable"}
!16 = distinct !{!16, !13}
!17 = distinct !{!17, !13}
!18 = !{!19, !19, i64 0}
!19 = !{!"long long", !8, i64 0}
!20 = distinct !{!20, !13}


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