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

; 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, [1000 x [1000 x i32]] }

@T = external dso_local global %struct.Matrix, align 4
@A = external dso_local global %struct.Matrix, align 4
@B = external dso_local global %struct.Matrix, align 4
@C = external dso_local global %struct.Matrix, align 4
@T1 = external dso_local global %struct.Matrix, align 4
@T2 = external dso_local global %struct.Matrix, align 4
@n = external dso_local global i32, align 4
@flag = external dso_local global i8, align 1
@.str = external hidden unnamed_addr constant [3 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [3 x i8], align 1

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() #0 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  store i32 0, ptr %1, align 4
  call void @srand(i32 noundef 2333) #5
  br label %11

11:                                               ; preds = %124, %0
  %12 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef @n)
  %13 = icmp ne i32 %12, -1
  br i1 %13, label %14, label %130

14:                                               ; preds = %11
  store i32 1, ptr @T, align 4, !tbaa !5
  %15 = load i32, ptr @n, align 4, !tbaa !10
  store i32 %15, ptr getelementptr inbounds (%struct.Matrix, ptr @C, i32 0, i32 1), align 4, !tbaa !11
  store i32 %15, ptr @C, align 4, !tbaa !5
  store i32 %15, ptr getelementptr inbounds (%struct.Matrix, ptr @B, i32 0, i32 1), align 4, !tbaa !11
  store i32 %15, ptr @B, align 4, !tbaa !5
  store i32 %15, ptr getelementptr inbounds (%struct.Matrix, ptr @A, i32 0, i32 1), align 4, !tbaa !11
  store i32 %15, ptr @A, align 4, !tbaa !5
  store i32 %15, ptr getelementptr inbounds (%struct.Matrix, ptr @T, i32 0, i32 1), align 4, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #5
  store i32 0, ptr %2, align 4, !tbaa !10
  br label %16

16:                                               ; preds = %39, %14
  %17 = load i32, ptr %2, align 4, !tbaa !10
  %18 = load i32, ptr @n, align 4, !tbaa !10
  %19 = icmp slt i32 %17, %18
  br i1 %19, label %21, label %20

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

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

22:                                               ; preds = %35, %21
  %23 = load i32, ptr %4, align 4, !tbaa !10
  %24 = load i32, ptr @n, align 4, !tbaa !10
  %25 = icmp slt i32 %23, %24
  br i1 %25, label %27, label %26

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

27:                                               ; preds = %22
  %28 = load i32, ptr %2, align 4, !tbaa !10
  %29 = sext i32 %28 to i64
  %30 = getelementptr inbounds [1000 x [1000 x i32]], ptr getelementptr inbounds (%struct.Matrix, ptr @A, i32 0, i32 2), i64 0, i64 %29
  %31 = load i32, ptr %4, align 4, !tbaa !10
  %32 = sext i32 %31 to i64
  %33 = getelementptr inbounds [1000 x i32], ptr %30, i64 0, i64 %32
  %34 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef %33)
  br label %35

35:                                               ; preds = %27
  %36 = load i32, ptr %4, align 4, !tbaa !10
  %37 = add nsw i32 %36, 1
  store i32 %37, ptr %4, align 4, !tbaa !10
  br label %22, !llvm.loop !12

38:                                               ; preds = %26
  br label %39

39:                                               ; preds = %38
  %40 = load i32, ptr %2, align 4, !tbaa !10
  %41 = add nsw i32 %40, 1
  store i32 %41, ptr %2, align 4, !tbaa !10
  br label %16, !llvm.loop !14

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

43:                                               ; preds = %66, %42
  %44 = load i32, ptr %5, align 4, !tbaa !10
  %45 = load i32, ptr @n, align 4, !tbaa !10
  %46 = icmp slt i32 %44, %45
  br i1 %46, label %48, label %47

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

48:                                               ; preds = %43
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #5
  store i32 0, ptr %6, align 4, !tbaa !10
  br label %49

49:                                               ; preds = %62, %48
  %50 = load i32, ptr %6, align 4, !tbaa !10
  %51 = load i32, ptr @n, align 4, !tbaa !10
  %52 = icmp slt i32 %50, %51
  br i1 %52, label %54, label %53

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

54:                                               ; preds = %49
  %55 = load i32, ptr %5, align 4, !tbaa !10
  %56 = sext i32 %55 to i64
  %57 = getelementptr inbounds [1000 x [1000 x i32]], ptr getelementptr inbounds (%struct.Matrix, ptr @B, i32 0, i32 2), i64 0, i64 %56
  %58 = load i32, ptr %6, align 4, !tbaa !10
  %59 = sext i32 %58 to i64
  %60 = getelementptr inbounds [1000 x i32], ptr %57, i64 0, i64 %59
  %61 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef %60)
  br label %62

62:                                               ; preds = %54
  %63 = load i32, ptr %6, align 4, !tbaa !10
  %64 = add nsw i32 %63, 1
  store i32 %64, ptr %6, align 4, !tbaa !10
  br label %49, !llvm.loop !15

65:                                               ; preds = %53
  br label %66

66:                                               ; preds = %65
  %67 = load i32, ptr %5, align 4, !tbaa !10
  %68 = add nsw i32 %67, 1
  store i32 %68, ptr %5, align 4, !tbaa !10
  br label %43, !llvm.loop !16

69:                                               ; preds = %47
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #5
  store i32 0, ptr %7, align 4, !tbaa !10
  br label %70

70:                                               ; preds = %93, %69
  %71 = load i32, ptr %7, align 4, !tbaa !10
  %72 = load i32, ptr @n, align 4, !tbaa !10
  %73 = icmp slt i32 %71, %72
  br i1 %73, label %75, label %74

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

75:                                               ; preds = %70
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #5
  store i32 0, ptr %8, align 4, !tbaa !10
  br label %76

76:                                               ; preds = %89, %75
  %77 = load i32, ptr %8, align 4, !tbaa !10
  %78 = load i32, ptr @n, align 4, !tbaa !10
  %79 = icmp slt i32 %77, %78
  br i1 %79, label %81, label %80

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

81:                                               ; preds = %76
  %82 = load i32, ptr %7, align 4, !tbaa !10
  %83 = sext i32 %82 to i64
  %84 = getelementptr inbounds [1000 x [1000 x i32]], ptr getelementptr inbounds (%struct.Matrix, ptr @C, i32 0, i32 2), i64 0, i64 %83
  %85 = load i32, ptr %8, align 4, !tbaa !10
  %86 = sext i32 %85 to i64
  %87 = getelementptr inbounds [1000 x i32], ptr %84, i64 0, i64 %86
  %88 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef %87)
  br label %89

89:                                               ; preds = %81
  %90 = load i32, ptr %8, align 4, !tbaa !10
  %91 = add nsw i32 %90, 1
  store i32 %91, ptr %8, align 4, !tbaa !10
  br label %76, !llvm.loop !17

92:                                               ; preds = %80
  br label %93

93:                                               ; preds = %92
  %94 = load i32, ptr %7, align 4, !tbaa !10
  %95 = add nsw i32 %94, 1
  store i32 %95, ptr %7, align 4, !tbaa !10
  br label %70, !llvm.loop !18

96:                                               ; preds = %74
  store i8 1, ptr @flag, align 1, !tbaa !19
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #5
  store i32 0, ptr %9, align 4, !tbaa !10
  br label %97

97:                                               ; preds = %120, %96
  %98 = load i32, ptr %9, align 4, !tbaa !10
  %99 = icmp slt i32 %98, 10
  br i1 %99, label %101, label %100

100:                                              ; preds = %97
  store i32 22, ptr %3, align 4
  br label %123

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

102:                                              ; preds = %113, %101
  %103 = load i32, ptr %10, align 4, !tbaa !10
  %104 = load i32, ptr @n, align 4, !tbaa !10
  %105 = icmp slt i32 %103, %104
  br i1 %105, label %107, label %106

106:                                              ; preds = %102
  store i32 25, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #5
  br label %116

107:                                              ; preds = %102
  %108 = call i32 @rand() #5
  %109 = srem i32 %108, 2333
  %110 = load i32, ptr %10, align 4, !tbaa !10
  %111 = sext i32 %110 to i64
  %112 = getelementptr inbounds [1000 x i32], ptr getelementptr inbounds (%struct.Matrix, ptr @T, i32 0, i32 2), i64 0, i64 %111
  store i32 %109, ptr %112, align 4, !tbaa !10
  br label %113

113:                                              ; preds = %107
  %114 = load i32, ptr %10, align 4, !tbaa !10
  %115 = add nsw i32 %114, 1
  store i32 %115, ptr %10, align 4, !tbaa !10
  br label %102, !llvm.loop !21

116:                                              ; preds = %106
  call void @_ZN6Matrix8MultiplyERKS_S1_(ptr noundef nonnull align 4 dereferenceable(4000008) @T1, ptr noundef nonnull align 4 dereferenceable(4000008) @T, ptr noundef nonnull align 4 dereferenceable(4000008) @A)
  call void @_ZN6Matrix8MultiplyERKS_S1_(ptr noundef nonnull align 4 dereferenceable(4000008) @T2, ptr noundef nonnull align 4 dereferenceable(4000008) @T, ptr noundef nonnull align 4 dereferenceable(4000008) @C)
  call void @_ZN6Matrix8MultiplyERKS_S1_(ptr noundef nonnull align 4 dereferenceable(4000008) @T, ptr noundef nonnull align 4 dereferenceable(4000008) @T1, ptr noundef nonnull align 4 dereferenceable(4000008) @B)
  %117 = call noundef zeroext i1 @_ZNK6Matrix3cmpERKS_(ptr noundef nonnull align 4 dereferenceable(4000008) @T, ptr noundef nonnull align 4 dereferenceable(4000008) @T2)
  br i1 %117, label %119, label %118

118:                                              ; preds = %116
  store i8 0, ptr @flag, align 1, !tbaa !19
  store i32 22, ptr %3, align 4
  br label %123

119:                                              ; preds = %116
  br label %120

120:                                              ; preds = %119
  %121 = load i32, ptr %9, align 4, !tbaa !10
  %122 = add nsw i32 %121, 1
  store i32 %122, ptr %9, align 4, !tbaa !10
  br label %97, !llvm.loop !22

123:                                              ; preds = %118, %100
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #5
  br label %124

124:                                              ; preds = %123
  %125 = load i8, ptr @flag, align 1, !tbaa !19, !range !23, !noundef !24
  %126 = trunc i8 %125 to i1
  %127 = zext i1 %126 to i64
  %128 = select i1 %126, ptr @.str.1, ptr @.str.2
  %129 = call i32 @puts(ptr noundef %128)
  br label %11, !llvm.loop !25

130:                                              ; preds = %11
  ret i32 0
}

; Function Attrs: nounwind
declare void @srand(i32 noundef) #1

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

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

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

; Function Attrs: nounwind
declare i32 @rand() #1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN6Matrix8MultiplyERKS_S1_(ptr noundef nonnull align 4 dereferenceable(4000008), ptr noundef nonnull align 4 dereferenceable(4000008), ptr noundef nonnull align 4 dereferenceable(4000008)) #4 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZNK6Matrix3cmpERKS_(ptr noundef nonnull align 4 dereferenceable(4000008), ptr noundef nonnull align 4 dereferenceable(4000008)) #4 align 2

declare i32 @puts(ptr noundef) #2

attributes #0 = { mustprogress norecurse uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { 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 #2 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #4 = { 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 #5 = { 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 = distinct !{!17, !13}
!18 = distinct !{!18, !13}
!19 = !{!20, !20, i64 0}
!20 = !{!"bool", !8, i64 0}
!21 = distinct !{!21, !13}
!22 = distinct !{!22, !13}
!23 = !{i8 0, i8 2}
!24 = !{}
!25 = distinct !{!25, !13}


; 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, [1000 x [1000 x i32]] }

@T = external dso_local global %struct.Matrix, align 4
@A = external dso_local global %struct.Matrix, align 4
@B = external dso_local global %struct.Matrix, align 4
@C = external dso_local global %struct.Matrix, align 4
@T1 = external dso_local global %struct.Matrix, align 4
@T2 = external dso_local global %struct.Matrix, align 4
@n = external dso_local global i32, align 4
@flag = external dso_local local_unnamed_addr global i8, align 1
@.str = external hidden unnamed_addr constant [3 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [3 x i8], align 1

; Function Attrs: mustprogress norecurse nounwind uwtable
define dso_local noundef i32 @main() local_unnamed_addr #0 {
  tail call void @srand(i32 noundef 2333) #4
  %1 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @n)
  %.not50 = icmp eq i32 %1, -1
  br i1 %.not50, label %._crit_edge53, label %.lr.ph52

.lr.ph52:                                         ; preds = %0, %.loopexit
  store i32 1, ptr @T, align 4, !tbaa !5
  %2 = load i32, ptr @n, align 4, !tbaa !10
  store i32 %2, ptr getelementptr inbounds (i8, ptr @C, i64 4), align 4, !tbaa !11
  store i32 %2, ptr @C, align 4, !tbaa !5
  store i32 %2, ptr getelementptr inbounds (i8, ptr @B, i64 4), align 4, !tbaa !11
  store i32 %2, ptr @B, align 4, !tbaa !5
  store i32 %2, ptr getelementptr inbounds (i8, ptr @A, i64 4), align 4, !tbaa !11
  store i32 %2, ptr @A, align 4, !tbaa !5
  store i32 %2, ptr getelementptr inbounds (i8, ptr @T, i64 4), align 4, !tbaa !11
  %3 = icmp sgt i32 %2, 0
  br i1 %3, label %.preheader32, label %._crit_edge45

.preheader34:                                     ; preds = %._crit_edge
  %4 = icmp sgt i32 %7, 0
  br i1 %4, label %.preheader31, label %._crit_edge45

.preheader32:                                     ; preds = %.lr.ph52, %._crit_edge
  %5 = phi i32 [ %7, %._crit_edge ], [ %2, %.lr.ph52 ]
  %indvars.iv58 = phi i64 [ %indvars.iv.next59, %._crit_edge ], [ 0, %.lr.ph52 ]
  %6 = icmp sgt i32 %5, 0
  br i1 %6, label %.lr.ph, label %.preheader32.._crit_edge_crit_edge

.preheader32.._crit_edge_crit_edge:               ; preds = %.preheader32
  %.pre76 = sext i32 %5 to i64
  br label %._crit_edge

._crit_edge:                                      ; preds = %.lr.ph, %.preheader32.._crit_edge_crit_edge
  %.pre-phi = phi i64 [ %.pre76, %.preheader32.._crit_edge_crit_edge ], [ %12, %.lr.ph ]
  %7 = phi i32 [ %5, %.preheader32.._crit_edge_crit_edge ], [ %11, %.lr.ph ]
  %indvars.iv.next59 = add nuw nsw i64 %indvars.iv58, 1
  %8 = icmp slt i64 %indvars.iv.next59, %.pre-phi
  br i1 %8, label %.preheader32, label %.preheader34, !llvm.loop !12

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

.preheader33:                                     ; preds = %._crit_edge39
  %14 = icmp sgt i32 %17, 0
  br i1 %14, label %.preheader30, label %._crit_edge45

.preheader31:                                     ; preds = %.preheader34, %._crit_edge39
  %15 = phi i32 [ %17, %._crit_edge39 ], [ %7, %.preheader34 ]
  %indvars.iv64 = phi i64 [ %indvars.iv.next65, %._crit_edge39 ], [ 0, %.preheader34 ]
  %16 = icmp sgt i32 %15, 0
  br i1 %16, label %.lr.ph38, label %.preheader31.._crit_edge39_crit_edge

.preheader31.._crit_edge39_crit_edge:             ; preds = %.preheader31
  %.pre77 = sext i32 %15 to i64
  br label %._crit_edge39

._crit_edge39:                                    ; preds = %.lr.ph38, %.preheader31.._crit_edge39_crit_edge
  %.pre-phi78 = phi i64 [ %.pre77, %.preheader31.._crit_edge39_crit_edge ], [ %22, %.lr.ph38 ]
  %17 = phi i32 [ %15, %.preheader31.._crit_edge39_crit_edge ], [ %21, %.lr.ph38 ]
  %indvars.iv.next65 = add nuw nsw i64 %indvars.iv64, 1
  %18 = icmp slt i64 %indvars.iv.next65, %.pre-phi78
  br i1 %18, label %.preheader31, label %.preheader33, !llvm.loop !16

.lr.ph38:                                         ; preds = %.preheader31, %.lr.ph38
  %indvars.iv61 = phi i64 [ %indvars.iv.next62, %.lr.ph38 ], [ 0, %.preheader31 ]
  %19 = getelementptr inbounds [1000 x [1000 x i32]], ptr getelementptr inbounds (i8, ptr @B, i64 8), i64 0, i64 %indvars.iv64, i64 %indvars.iv61
  %20 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %19)
  %indvars.iv.next62 = add nuw nsw i64 %indvars.iv61, 1
  %21 = load i32, ptr @n, align 4, !tbaa !10
  %22 = sext i32 %21 to i64
  %23 = icmp slt i64 %indvars.iv.next62, %22
  br i1 %23, label %.lr.ph38, label %._crit_edge39, !llvm.loop !17

.preheader30:                                     ; preds = %.preheader33, %._crit_edge43
  %24 = phi i32 [ %26, %._crit_edge43 ], [ %17, %.preheader33 ]
  %indvars.iv70 = phi i64 [ %indvars.iv.next71, %._crit_edge43 ], [ 0, %.preheader33 ]
  %25 = icmp sgt i32 %24, 0
  br i1 %25, label %.lr.ph42, label %.preheader30.._crit_edge43_crit_edge

.preheader30.._crit_edge43_crit_edge:             ; preds = %.preheader30
  %.pre79 = sext i32 %24 to i64
  br label %._crit_edge43

._crit_edge45:                                    ; preds = %._crit_edge43, %.lr.ph52, %.preheader34, %.preheader33
  store i8 1, ptr @flag, align 1, !tbaa !18
  br label %.preheader

._crit_edge43:                                    ; preds = %.lr.ph42, %.preheader30.._crit_edge43_crit_edge
  %.pre-phi80 = phi i64 [ %.pre79, %.preheader30.._crit_edge43_crit_edge ], [ %31, %.lr.ph42 ]
  %26 = phi i32 [ %24, %.preheader30.._crit_edge43_crit_edge ], [ %30, %.lr.ph42 ]
  %indvars.iv.next71 = add nuw nsw i64 %indvars.iv70, 1
  %27 = icmp slt i64 %indvars.iv.next71, %.pre-phi80
  br i1 %27, label %.preheader30, label %._crit_edge45, !llvm.loop !20

.lr.ph42:                                         ; preds = %.preheader30, %.lr.ph42
  %indvars.iv67 = phi i64 [ %indvars.iv.next68, %.lr.ph42 ], [ 0, %.preheader30 ]
  %28 = getelementptr inbounds [1000 x [1000 x i32]], ptr getelementptr inbounds (i8, ptr @C, i64 8), i64 0, i64 %indvars.iv70, i64 %indvars.iv67
  %29 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %28)
  %indvars.iv.next68 = add nuw nsw i64 %indvars.iv67, 1
  %30 = load i32, ptr @n, align 4, !tbaa !10
  %31 = sext i32 %30 to i64
  %32 = icmp slt i64 %indvars.iv.next68, %31
  br i1 %32, label %.lr.ph42, label %._crit_edge43, !llvm.loop !21

33:                                               ; preds = %._crit_edge48
  %34 = add nuw nsw i32 %.02349, 1
  %exitcond.not = icmp eq i32 %34, 10
  br i1 %exitcond.not, label %.loopexit.loopexit, label %.preheader, !llvm.loop !22

.preheader:                                       ; preds = %._crit_edge45, %33
  %.02349 = phi i32 [ 0, %._crit_edge45 ], [ %34, %33 ]
  %35 = load i32, ptr @n, align 4, !tbaa !10
  %36 = icmp sgt i32 %35, 0
  br i1 %36, label %.lr.ph47, label %._crit_edge48

._crit_edge48:                                    ; preds = %.lr.ph47, %.preheader
  tail call void @_ZN6Matrix8MultiplyERKS_S1_(ptr noundef nonnull align 4 dereferenceable(4000008) @T1, ptr noundef nonnull align 4 dereferenceable(4000008) @T, ptr noundef nonnull align 4 dereferenceable(4000008) @A)
  tail call void @_ZN6Matrix8MultiplyERKS_S1_(ptr noundef nonnull align 4 dereferenceable(4000008) @T2, ptr noundef nonnull align 4 dereferenceable(4000008) @T, ptr noundef nonnull align 4 dereferenceable(4000008) @C)
  tail call void @_ZN6Matrix8MultiplyERKS_S1_(ptr noundef nonnull align 4 dereferenceable(4000008) @T, ptr noundef nonnull align 4 dereferenceable(4000008) @T1, ptr noundef nonnull align 4 dereferenceable(4000008) @B)
  %37 = tail call noundef zeroext i1 @_ZNK6Matrix3cmpERKS_(ptr noundef nonnull align 4 dereferenceable(4000008) @T, ptr noundef nonnull align 4 dereferenceable(4000008) @T2)
  br i1 %37, label %33, label %44

.lr.ph47:                                         ; preds = %.preheader, %.lr.ph47
  %indvars.iv73 = phi i64 [ %indvars.iv.next74, %.lr.ph47 ], [ 0, %.preheader ]
  %38 = tail call i32 @rand() #4
  %39 = srem i32 %38, 2333
  %40 = getelementptr inbounds [1000 x i32], ptr getelementptr inbounds (i8, ptr @T, i64 8), i64 0, i64 %indvars.iv73
  store i32 %39, ptr %40, align 4, !tbaa !10
  %indvars.iv.next74 = add nuw nsw i64 %indvars.iv73, 1
  %41 = load i32, ptr @n, align 4, !tbaa !10
  %42 = sext i32 %41 to i64
  %43 = icmp slt i64 %indvars.iv.next74, %42
  br i1 %43, label %.lr.ph47, label %._crit_edge48, !llvm.loop !23

44:                                               ; preds = %._crit_edge48
  store i8 0, ptr @flag, align 1, !tbaa !18
  br label %.loopexit

.loopexit.loopexit:                               ; preds = %33
  %.pre = load i8, ptr @flag, align 1, !tbaa !18, !range !24
  br label %.loopexit

.loopexit:                                        ; preds = %.loopexit.loopexit, %44
  %45 = phi i8 [ %.pre, %.loopexit.loopexit ], [ 0, %44 ]
  %46 = trunc nuw i8 %45 to i1
  %47 = select i1 %46, ptr @.str.1, ptr @.str.2
  %48 = tail call i32 @puts(ptr noundef nonnull dereferenceable(1) %47)
  %49 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @n)
  %.not = icmp eq i32 %49, -1
  br i1 %.not, label %._crit_edge53, label %.lr.ph52, !llvm.loop !25

._crit_edge53:                                    ; preds = %.loopexit, %0
  ret i32 0
}

; Function Attrs: nounwind
declare void @srand(i32 noundef) local_unnamed_addr #1

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

; Function Attrs: nounwind
declare i32 @rand() local_unnamed_addr #1

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZNK6Matrix3cmpERKS_(ptr noundef nonnull align 4 dereferenceable(4000008), ptr noundef nonnull align 4 dereferenceable(4000008)) local_unnamed_addr #3 align 2

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

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

!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !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, !14}
!13 = !{!"llvm.loop.mustprogress"}
!14 = !{!"llvm.loop.unswitch.partial.disable"}
!15 = distinct !{!15, !13}
!16 = distinct !{!16, !13, !14}
!17 = distinct !{!17, !13}
!18 = !{!19, !19, i64 0}
!19 = !{!"bool", !8, i64 0}
!20 = distinct !{!20, !13, !14}
!21 = distinct !{!21, !13}
!22 = distinct !{!22, !13}
!23 = distinct !{!23, !13}
!24 = !{i8 0, i8 2}
!25 = distinct !{!25, !13}


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