; LLVM IR from tangjz/acm-icpc :: poj (3318)

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

@n = 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
@C = external dso_local global %struct.Matrix, align 4
@D = external dso_local global %struct.Matrix, align 4
@E = external dso_local global %struct.Matrix, align 4
@F = external dso_local global %struct.Matrix, align 4
@.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 i8, align 1
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  %12 = alloca %struct.Matrix, align 4
  %13 = alloca %struct.Matrix, align 4
  %14 = alloca %struct.Matrix, align 4
  store i32 0, ptr %1, align 4
  %15 = call i64 @time(ptr noundef null) #6
  %16 = trunc i64 %15 to i32
  call void @srand(i32 noundef %16) #6
  %17 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef @n)
  %18 = load i32, ptr @n, align 4, !tbaa !5
  store i32 %18, ptr getelementptr inbounds (%struct.Matrix, ptr @D, i32 0, i32 1), align 4, !tbaa !9
  store i32 %18, ptr getelementptr inbounds (%struct.Matrix, ptr @C, i32 0, i32 1), align 4, !tbaa !9
  store i32 %18, ptr @C, align 4, !tbaa !11
  store i32 %18, ptr getelementptr inbounds (%struct.Matrix, ptr @B, i32 0, i32 1), align 4, !tbaa !9
  store i32 %18, ptr @B, align 4, !tbaa !11
  store i32 %18, ptr getelementptr inbounds (%struct.Matrix, ptr @A, i32 0, i32 1), align 4, !tbaa !9
  store i32 %18, ptr @A, align 4, !tbaa !11
  store i32 1, ptr @D, align 4, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #6
  store i32 0, ptr %2, align 4, !tbaa !5
  br label %19

19:                                               ; preds = %42, %0
  %20 = load i32, ptr %2, align 4, !tbaa !5
  %21 = load i32, ptr @n, align 4, !tbaa !5
  %22 = icmp slt i32 %20, %21
  br i1 %22, label %24, label %23

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

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

25:                                               ; preds = %38, %24
  %26 = load i32, ptr %4, align 4, !tbaa !5
  %27 = load i32, ptr @n, align 4, !tbaa !5
  %28 = icmp slt i32 %26, %27
  br i1 %28, label %30, label %29

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

30:                                               ; preds = %25
  %31 = load i32, ptr %2, align 4, !tbaa !5
  %32 = sext i32 %31 to i64
  %33 = getelementptr inbounds [501 x [501 x i32]], ptr getelementptr inbounds (%struct.Matrix, ptr @A, i32 0, i32 2), i64 0, i64 %32
  %34 = load i32, ptr %4, align 4, !tbaa !5
  %35 = sext i32 %34 to i64
  %36 = getelementptr inbounds [501 x i32], ptr %33, i64 0, i64 %35
  %37 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef %36)
  br label %38

38:                                               ; preds = %30
  %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 %25, !llvm.loop !12

41:                                               ; preds = %29
  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 %19, !llvm.loop !14

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

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

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

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

52:                                               ; preds = %65, %51
  %53 = load i32, ptr %6, align 4, !tbaa !5
  %54 = load i32, ptr @n, align 4, !tbaa !5
  %55 = icmp slt i32 %53, %54
  br i1 %55, label %57, label %56

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

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

65:                                               ; preds = %57
  %66 = load i32, ptr %6, align 4, !tbaa !5
  %67 = add nsw i32 %66, 1
  store i32 %67, ptr %6, align 4, !tbaa !5
  br label %52, !llvm.loop !15

68:                                               ; preds = %56
  br label %69

69:                                               ; preds = %68
  %70 = load i32, ptr %5, align 4, !tbaa !5
  %71 = add nsw i32 %70, 1
  store i32 %71, ptr %5, align 4, !tbaa !5
  br label %46, !llvm.loop !16

72:                                               ; preds = %50
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #6
  store i32 0, ptr %7, align 4, !tbaa !5
  br label %73

73:                                               ; preds = %96, %72
  %74 = load i32, ptr %7, align 4, !tbaa !5
  %75 = load i32, ptr @n, align 4, !tbaa !5
  %76 = icmp slt i32 %74, %75
  br i1 %76, label %78, label %77

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

78:                                               ; preds = %73
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #6
  store i32 0, ptr %8, align 4, !tbaa !5
  br label %79

79:                                               ; preds = %92, %78
  %80 = load i32, ptr %8, align 4, !tbaa !5
  %81 = load i32, ptr @n, align 4, !tbaa !5
  %82 = icmp slt i32 %80, %81
  br i1 %82, label %84, label %83

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

84:                                               ; preds = %79
  %85 = load i32, ptr %7, align 4, !tbaa !5
  %86 = sext i32 %85 to i64
  %87 = getelementptr inbounds [501 x [501 x i32]], ptr getelementptr inbounds (%struct.Matrix, ptr @C, i32 0, i32 2), i64 0, i64 %86
  %88 = load i32, ptr %8, align 4, !tbaa !5
  %89 = sext i32 %88 to i64
  %90 = getelementptr inbounds [501 x i32], ptr %87, i64 0, i64 %89
  %91 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef %90)
  br label %92

92:                                               ; preds = %84
  %93 = load i32, ptr %8, align 4, !tbaa !5
  %94 = add nsw i32 %93, 1
  store i32 %94, ptr %8, align 4, !tbaa !5
  br label %79, !llvm.loop !17

95:                                               ; preds = %83
  br label %96

96:                                               ; preds = %95
  %97 = load i32, ptr %7, align 4, !tbaa !5
  %98 = add nsw i32 %97, 1
  store i32 %98, ptr %7, align 4, !tbaa !5
  br label %73, !llvm.loop !18

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

100:                                              ; preds = %123, %99
  %101 = load i32, ptr %10, align 4, !tbaa !5
  %102 = icmp slt i32 %101, 20
  br i1 %102, label %104, label %103

103:                                              ; preds = %100
  store i32 20, ptr %3, align 4
  br label %126

104:                                              ; preds = %100
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #6
  store i32 0, ptr %11, align 4, !tbaa !5
  br label %105

105:                                              ; preds = %116, %104
  %106 = load i32, ptr %11, align 4, !tbaa !5
  %107 = load i32, ptr @n, align 4, !tbaa !5
  %108 = icmp slt i32 %106, %107
  br i1 %108, label %110, label %109

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

110:                                              ; preds = %105
  %111 = call i32 @rand() #6
  %112 = srem i32 %111, 100
  %113 = load i32, ptr %11, align 4, !tbaa !5
  %114 = sext i32 %113 to i64
  %115 = getelementptr inbounds [501 x i32], ptr getelementptr inbounds (%struct.Matrix, ptr @D, i32 0, i32 2), i64 0, i64 %114
  store i32 %112, ptr %115, align 4, !tbaa !5
  br label %116

116:                                              ; preds = %110
  %117 = load i32, ptr %11, align 4, !tbaa !5
  %118 = add nsw i32 %117, 1
  store i32 %118, ptr %11, align 4, !tbaa !5
  br label %105, !llvm.loop !21

119:                                              ; preds = %109
  call void @llvm.lifetime.start.p0(i64 1004012, ptr %12) #6
  call void @llvm.lifetime.start.p0(i64 1004012, ptr %13) #6
  call void @_ZNK6MatrixmlERKS_(ptr dead_on_unwind writable sret(%struct.Matrix) align 4 %13, ptr noundef nonnull align 4 dereferenceable(1004012) @D, ptr noundef nonnull align 4 dereferenceable(1004012) @A)
  call void @_ZNK6MatrixmlERKS_(ptr dead_on_unwind writable sret(%struct.Matrix) align 4 %12, ptr noundef nonnull align 4 dereferenceable(1004012) %13, ptr noundef nonnull align 4 dereferenceable(1004012) @B)
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 @E, ptr align 4 %12, i64 1004012, i1 false), !tbaa.struct !22
  call void @llvm.lifetime.end.p0(i64 1004012, ptr %13) #6
  call void @llvm.lifetime.end.p0(i64 1004012, ptr %12) #6
  call void @llvm.lifetime.start.p0(i64 1004012, ptr %14) #6
  call void @_ZNK6MatrixmlERKS_(ptr dead_on_unwind writable sret(%struct.Matrix) align 4 %14, ptr noundef nonnull align 4 dereferenceable(1004012) @D, ptr noundef nonnull align 4 dereferenceable(1004012) @C)
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 @F, ptr align 4 %14, i64 1004012, i1 false), !tbaa.struct !22
  call void @llvm.lifetime.end.p0(i64 1004012, ptr %14) #6
  %120 = call noundef zeroext i1 @_ZNK6MatrixeqERKS_(ptr noundef nonnull align 4 dereferenceable(1004012) @E, ptr noundef nonnull align 4 dereferenceable(1004012) @F)
  br i1 %120, label %122, label %121

121:                                              ; preds = %119
  store i8 0, ptr %9, align 1, !tbaa !19
  store i32 20, ptr %3, align 4
  br label %126

122:                                              ; preds = %119
  br label %123

123:                                              ; preds = %122
  %124 = load i32, ptr %10, align 4, !tbaa !5
  %125 = add nsw i32 %124, 1
  store i32 %125, ptr %10, align 4, !tbaa !5
  br label %100, !llvm.loop !24

126:                                              ; preds = %121, %103
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #6
  br label %127

127:                                              ; preds = %126
  %128 = load i8, ptr %9, align 1, !tbaa !19, !range !25, !noundef !26
  %129 = trunc i8 %128 to i1
  %130 = zext i1 %129 to i64
  %131 = select i1 %129, ptr @.str.1, ptr @.str.2
  %132 = call i32 @puts(ptr noundef %131)
  store i32 0, ptr %1, align 4
  store i32 1, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 1, ptr %9) #6
  %133 = load i32, ptr %1, align 4
  ret i32 %133
}

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

; Function Attrs: nounwind
declare i64 @time(ptr 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 @_ZNK6MatrixmlERKS_(ptr dead_on_unwind noalias writable sret(%struct.Matrix) align 4, ptr noundef nonnull align 4 dereferenceable(1004012), ptr noundef nonnull align 4 dereferenceable(1004012)) #4 align 2

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #5

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZNK6MatrixeqERKS_(ptr noundef nonnull align 4 dereferenceable(1004012), ptr noundef nonnull align 4 dereferenceable(1004012)) #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 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #6 = { 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 = !{!10, !6, i64 4}
!10 = !{!"_ZTS6Matrix", !6, i64 0, !6, i64 4, !7, i64 8}
!11 = !{!10, !6, i64 0}
!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", !7, i64 0}
!21 = distinct !{!21, !13}
!22 = !{i64 0, i64 4, !5, i64 4, i64 4, !5, i64 8, i64 1004004, !23}
!23 = !{!7, !7, i64 0}
!24 = distinct !{!24, !13}
!25 = !{i8 0, i8 2}
!26 = !{}


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

@n = 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
@C = external dso_local global %struct.Matrix, align 4
@D = external dso_local global %struct.Matrix, align 4
@E = external dso_local global %struct.Matrix, align 4
@F = external dso_local global %struct.Matrix, align 4
@.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 {
  %1 = alloca %struct.Matrix, align 4
  %2 = alloca %struct.Matrix, align 4
  %3 = alloca %struct.Matrix, align 4
  %4 = tail call i64 @time(ptr noundef null) #6
  %5 = trunc i64 %4 to i32
  tail call void @srand(i32 noundef %5) #6
  %6 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @n)
  %7 = load i32, ptr @n, align 4, !tbaa !5
  store i32 %7, ptr getelementptr inbounds (i8, ptr @D, i64 4), align 4, !tbaa !9
  store i32 %7, ptr getelementptr inbounds (i8, ptr @C, i64 4), align 4, !tbaa !9
  store i32 %7, ptr @C, align 4, !tbaa !11
  store i32 %7, ptr getelementptr inbounds (i8, ptr @B, i64 4), align 4, !tbaa !9
  store i32 %7, ptr @B, align 4, !tbaa !11
  store i32 %7, ptr getelementptr inbounds (i8, ptr @A, i64 4), align 4, !tbaa !9
  store i32 %7, ptr @A, align 4, !tbaa !11
  store i32 1, ptr @D, align 4, !tbaa !11
  %8 = icmp sgt i32 %7, 0
  br i1 %8, label %.preheader38, label %.preheader.preheader

.preheader38:                                     ; preds = %0, %._crit_edge
  %9 = phi i32 [ %12, %._crit_edge ], [ %7, %0 ]
  %indvars.iv57 = phi i64 [ %indvars.iv.next58, %._crit_edge ], [ 0, %0 ]
  %10 = icmp sgt i32 %9, 0
  br i1 %10, label %.lr.ph, label %.preheader38.._crit_edge_crit_edge

.preheader38.._crit_edge_crit_edge:               ; preds = %.preheader38
  %.pre = sext i32 %9 to i64
  br label %._crit_edge

.preheader37:                                     ; preds = %._crit_edge
  %11 = icmp sgt i32 %12, 0
  br i1 %11, label %.preheader36, label %.preheader.preheader

._crit_edge:                                      ; preds = %.lr.ph, %.preheader38.._crit_edge_crit_edge
  %.pre-phi = phi i64 [ %.pre, %.preheader38.._crit_edge_crit_edge ], [ %17, %.lr.ph ]
  %12 = phi i32 [ %9, %.preheader38.._crit_edge_crit_edge ], [ %16, %.lr.ph ]
  %indvars.iv.next58 = add nuw nsw i64 %indvars.iv57, 1
  %13 = icmp slt i64 %indvars.iv.next58, %.pre-phi
  br i1 %13, label %.preheader38, label %.preheader37, !llvm.loop !12

.lr.ph:                                           ; preds = %.preheader38, %.lr.ph
  %indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph ], [ 0, %.preheader38 ]
  %14 = getelementptr inbounds [501 x [501 x i32]], ptr getelementptr inbounds (i8, ptr @A, i64 8), i64 0, i64 %indvars.iv57, i64 %indvars.iv
  %15 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %14)
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %16 = load i32, ptr @n, align 4, !tbaa !5
  %17 = sext i32 %16 to i64
  %18 = icmp slt i64 %indvars.iv.next, %17
  br i1 %18, label %.lr.ph, label %._crit_edge, !llvm.loop !15

.preheader36:                                     ; preds = %.preheader37, %._crit_edge43
  %19 = phi i32 [ %22, %._crit_edge43 ], [ %12, %.preheader37 ]
  %indvars.iv63 = phi i64 [ %indvars.iv.next64, %._crit_edge43 ], [ 0, %.preheader37 ]
  %20 = icmp sgt i32 %19, 0
  br i1 %20, label %.lr.ph42, label %.preheader36.._crit_edge43_crit_edge

.preheader36.._crit_edge43_crit_edge:             ; preds = %.preheader36
  %.pre75 = sext i32 %19 to i64
  br label %._crit_edge43

.preheader35:                                     ; preds = %._crit_edge43
  %21 = icmp sgt i32 %22, 0
  br i1 %21, label %.preheader34, label %.preheader.preheader

.preheader.preheader:                             ; preds = %._crit_edge47, %0, %.preheader37, %.preheader35
  br label %.preheader

._crit_edge43:                                    ; preds = %.lr.ph42, %.preheader36.._crit_edge43_crit_edge
  %.pre-phi76 = phi i64 [ %.pre75, %.preheader36.._crit_edge43_crit_edge ], [ %27, %.lr.ph42 ]
  %22 = phi i32 [ %19, %.preheader36.._crit_edge43_crit_edge ], [ %26, %.lr.ph42 ]
  %indvars.iv.next64 = add nuw nsw i64 %indvars.iv63, 1
  %23 = icmp slt i64 %indvars.iv.next64, %.pre-phi76
  br i1 %23, label %.preheader36, label %.preheader35, !llvm.loop !16

.lr.ph42:                                         ; preds = %.preheader36, %.lr.ph42
  %indvars.iv60 = phi i64 [ %indvars.iv.next61, %.lr.ph42 ], [ 0, %.preheader36 ]
  %24 = getelementptr inbounds [501 x [501 x i32]], ptr getelementptr inbounds (i8, ptr @B, i64 8), i64 0, i64 %indvars.iv63, i64 %indvars.iv60
  %25 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %24)
  %indvars.iv.next61 = add nuw nsw i64 %indvars.iv60, 1
  %26 = load i32, ptr @n, align 4, !tbaa !5
  %27 = sext i32 %26 to i64
  %28 = icmp slt i64 %indvars.iv.next61, %27
  br i1 %28, label %.lr.ph42, label %._crit_edge43, !llvm.loop !17

.preheader34:                                     ; preds = %.preheader35, %._crit_edge47
  %29 = phi i32 [ %31, %._crit_edge47 ], [ %22, %.preheader35 ]
  %indvars.iv69 = phi i64 [ %indvars.iv.next70, %._crit_edge47 ], [ 0, %.preheader35 ]
  %30 = icmp sgt i32 %29, 0
  br i1 %30, label %.lr.ph46, label %.preheader34.._crit_edge47_crit_edge

.preheader34.._crit_edge47_crit_edge:             ; preds = %.preheader34
  %.pre77 = sext i32 %29 to i64
  br label %._crit_edge47

._crit_edge47:                                    ; preds = %.lr.ph46, %.preheader34.._crit_edge47_crit_edge
  %.pre-phi78 = phi i64 [ %.pre77, %.preheader34.._crit_edge47_crit_edge ], [ %36, %.lr.ph46 ]
  %31 = phi i32 [ %29, %.preheader34.._crit_edge47_crit_edge ], [ %35, %.lr.ph46 ]
  %indvars.iv.next70 = add nuw nsw i64 %indvars.iv69, 1
  %32 = icmp slt i64 %indvars.iv.next70, %.pre-phi78
  br i1 %32, label %.preheader34, label %.preheader.preheader, !llvm.loop !18

.lr.ph46:                                         ; preds = %.preheader34, %.lr.ph46
  %indvars.iv66 = phi i64 [ %indvars.iv.next67, %.lr.ph46 ], [ 0, %.preheader34 ]
  %33 = getelementptr inbounds [501 x [501 x i32]], ptr getelementptr inbounds (i8, ptr @C, i64 8), i64 0, i64 %indvars.iv69, i64 %indvars.iv66
  %34 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %33)
  %indvars.iv.next67 = add nuw nsw i64 %indvars.iv66, 1
  %35 = load i32, ptr @n, align 4, !tbaa !5
  %36 = sext i32 %35 to i64
  %37 = icmp slt i64 %indvars.iv.next67, %36
  br i1 %37, label %.lr.ph46, label %._crit_edge47, !llvm.loop !19

38:                                               ; preds = %._crit_edge51
  %39 = add nuw nsw i32 %.02552, 1
  %exitcond = icmp eq i32 %39, 20
  br i1 %exitcond, label %49, label %.preheader, !llvm.loop !20

.preheader:                                       ; preds = %.preheader.preheader, %38
  %.02552 = phi i32 [ %39, %38 ], [ 0, %.preheader.preheader ]
  %40 = load i32, ptr @n, align 4, !tbaa !5
  %41 = icmp sgt i32 %40, 0
  br i1 %41, label %.lr.ph50, label %._crit_edge51

._crit_edge51:                                    ; preds = %.lr.ph50, %.preheader
  call void @llvm.lifetime.start.p0(i64 1004012, ptr nonnull %1) #6
  call void @llvm.lifetime.start.p0(i64 1004012, ptr nonnull %2) #6
  call void @_ZNK6MatrixmlERKS_(ptr dead_on_unwind nonnull writable sret(%struct.Matrix) align 4 %2, ptr noundef nonnull align 4 dereferenceable(1004012) @D, ptr noundef nonnull align 4 dereferenceable(1004012) @A)
  call void @_ZNK6MatrixmlERKS_(ptr dead_on_unwind nonnull writable sret(%struct.Matrix) align 4 %1, ptr noundef nonnull align 4 dereferenceable(1004012) %2, ptr noundef nonnull align 4 dereferenceable(1004012) @B)
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 4 dereferenceable(1004012) @E, ptr noundef nonnull align 4 dereferenceable(1004012) %1, i64 1004012, i1 false), !tbaa.struct !21
  call void @llvm.lifetime.end.p0(i64 1004012, ptr nonnull %2) #6
  call void @llvm.lifetime.end.p0(i64 1004012, ptr nonnull %1) #6
  call void @llvm.lifetime.start.p0(i64 1004012, ptr nonnull %3) #6
  call void @_ZNK6MatrixmlERKS_(ptr dead_on_unwind nonnull writable sret(%struct.Matrix) align 4 %3, ptr noundef nonnull align 4 dereferenceable(1004012) @D, ptr noundef nonnull align 4 dereferenceable(1004012) @C)
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 4 dereferenceable(1004012) @F, ptr noundef nonnull align 4 dereferenceable(1004012) %3, i64 1004012, i1 false), !tbaa.struct !21
  call void @llvm.lifetime.end.p0(i64 1004012, ptr nonnull %3) #6
  %42 = call noundef zeroext i1 @_ZNK6MatrixeqERKS_(ptr noundef nonnull align 4 dereferenceable(1004012) @E, ptr noundef nonnull align 4 dereferenceable(1004012) @F)
  br i1 %42, label %38, label %49

.lr.ph50:                                         ; preds = %.preheader, %.lr.ph50
  %indvars.iv72 = phi i64 [ %indvars.iv.next73, %.lr.ph50 ], [ 0, %.preheader ]
  %43 = call i32 @rand() #6
  %44 = srem i32 %43, 100
  %45 = getelementptr inbounds [501 x i32], ptr getelementptr inbounds (i8, ptr @D, i64 8), i64 0, i64 %indvars.iv72
  store i32 %44, ptr %45, align 4, !tbaa !5
  %indvars.iv.next73 = add nuw nsw i64 %indvars.iv72, 1
  %46 = load i32, ptr @n, align 4, !tbaa !5
  %47 = sext i32 %46 to i64
  %48 = icmp slt i64 %indvars.iv.next73, %47
  br i1 %48, label %.lr.ph50, label %._crit_edge51, !llvm.loop !23

49:                                               ; preds = %._crit_edge51, %38
  %50 = phi ptr [ @.str.1, %38 ], [ @.str.2, %._crit_edge51 ]
  %51 = call i32 @puts(ptr noundef nonnull dereferenceable(1) %50)
  ret i32 0
}

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

; Function Attrs: nounwind
declare i64 @time(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: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #3

; Function Attrs: mustprogress 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() local_unnamed_addr #1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNK6MatrixmlERKS_(ptr dead_on_unwind noalias writable sret(%struct.Matrix) align 4, ptr noundef nonnull align 4 dereferenceable(1004012), ptr noundef nonnull align 4 dereferenceable(1004012)) local_unnamed_addr #4 align 2

; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #5

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZNK6MatrixeqERKS_(ptr noundef nonnull align 4 dereferenceable(1004012), ptr noundef nonnull align 4 dereferenceable(1004012)) local_unnamed_addr #4 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 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 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #6 = { 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 = !{!10, !6, i64 4}
!10 = !{!"_ZTS6Matrix", !6, i64 0, !6, i64 4, !7, i64 8}
!11 = !{!10, !6, i64 0}
!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 = distinct !{!18, !13, !14}
!19 = distinct !{!19, !13}
!20 = distinct !{!20, !13}
!21 = !{i64 0, i64 4, !5, i64 4, i64 4, !5, i64 8, i64 1004004, !22}
!22 = !{!7, !7, i64 0}
!23 = distinct !{!23, !13}


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