; LLVM IR from tangjz/acm-icpc :: codeforces/complete (193C)

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

@pat = external dso_local global [7 x ptr], align 16
@x = external dso_local global [7 x i32], align 16
@d = external dso_local global [7 x i32], align 16
@.str.7 = external hidden unnamed_addr constant [3 x i8], align 1
@_ZL3mat = external hidden constant [6 x [7 x i32]], align 16
@.str.8 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [4 x i8], align 1

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() #0 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  %12 = alloca i32, align 4
  %13 = alloca i32, align 4
  store i32 0, ptr %1, align 4
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #5
  store i32 0, ptr %2, align 4, !tbaa !5
  br label %14

14:                                               ; preds = %23, %0
  %15 = load i32, ptr %2, align 4, !tbaa !5
  %16 = icmp slt i32 %15, 6
  br i1 %16, label %18, label %17

17:                                               ; preds = %14
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #5
  br label %26

18:                                               ; preds = %14
  %19 = load i32, ptr %2, align 4, !tbaa !5
  %20 = sext i32 %19 to i64
  %21 = getelementptr inbounds i32, ptr @d, i64 %20
  %22 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.7, ptr noundef %21)
  br label %23

23:                                               ; preds = %18
  %24 = load i32, ptr %2, align 4, !tbaa !5
  %25 = add nsw i32 %24, 1
  store i32 %25, ptr %2, align 4, !tbaa !5
  br label %14, !llvm.loop !9

26:                                               ; preds = %17
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #5
  store i32 0, ptr %3, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #5
  store i32 2147483647, ptr %4, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #5
  store i32 0, ptr %5, align 4, !tbaa !5
  br label %27

27:                                               ; preds = %93, %26
  %28 = load i32, ptr %5, align 4, !tbaa !5
  %29 = icmp slt i32 %28, 6
  br i1 %29, label %31, label %30

30:                                               ; preds = %27
  store i32 5, ptr %6, align 4
  br label %96

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

32:                                               ; preds = %54, %31
  %33 = load i32, ptr %7, align 4, !tbaa !5
  %34 = icmp slt i32 %33, 6
  br i1 %34, label %36, label %35

35:                                               ; preds = %32
  store i32 8, ptr %6, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #5
  br label %57

36:                                               ; preds = %32
  %37 = load i32, ptr %5, align 4, !tbaa !5
  %38 = sext i32 %37 to i64
  %39 = getelementptr inbounds [6 x [7 x i32]], ptr @_ZL3mat, i64 0, i64 %38
  %40 = load i32, ptr %7, align 4, !tbaa !5
  %41 = sext i32 %40 to i64
  %42 = getelementptr inbounds [7 x i32], ptr %39, i64 0, i64 %41
  %43 = load i32, ptr %42, align 4, !tbaa !5
  %44 = load i32, ptr %7, align 4, !tbaa !5
  %45 = sext i32 %44 to i64
  %46 = getelementptr inbounds [7 x i32], ptr @d, i64 0, i64 %45
  %47 = load i32, ptr %46, align 4, !tbaa !5
  %48 = mul nsw i32 %43, %47
  %49 = load i32, ptr %5, align 4, !tbaa !5
  %50 = sext i32 %49 to i64
  %51 = getelementptr inbounds [7 x i32], ptr @x, i64 0, i64 %50
  %52 = load i32, ptr %51, align 4, !tbaa !5
  %53 = add nsw i32 %52, %48
  store i32 %53, ptr %51, align 4, !tbaa !5
  br label %54

54:                                               ; preds = %36
  %55 = load i32, ptr %7, align 4, !tbaa !5
  %56 = add nsw i32 %55, 1
  store i32 %56, ptr %7, align 4, !tbaa !5
  br label %32, !llvm.loop !11

57:                                               ; preds = %35
  %58 = load i32, ptr %5, align 4, !tbaa !5
  %59 = sext i32 %58 to i64
  %60 = getelementptr inbounds [7 x i32], ptr @x, i64 0, i64 %59
  %61 = load i32, ptr %60, align 4, !tbaa !5
  %62 = and i32 %61, 1
  %63 = icmp ne i32 %62, 0
  br i1 %63, label %64, label %66

64:                                               ; preds = %57
  %65 = call i32 @puts(ptr noundef @.str.8)
  store i32 0, ptr %1, align 4
  store i32 1, ptr %6, align 4
  br label %96

66:                                               ; preds = %57
  %67 = load i32, ptr %5, align 4, !tbaa !5
  %68 = sext i32 %67 to i64
  %69 = getelementptr inbounds [7 x i32], ptr @x, i64 0, i64 %68
  %70 = load i32, ptr %69, align 4, !tbaa !5
  %71 = ashr i32 %70, 1
  store i32 %71, ptr %69, align 4, !tbaa !5
  %72 = load i32, ptr %5, align 4, !tbaa !5
  %73 = sext i32 %72 to i64
  %74 = getelementptr inbounds [6 x [7 x i32]], ptr @_ZL3mat, i64 0, i64 %73
  %75 = getelementptr inbounds [7 x i32], ptr %74, i64 0, i64 6
  %76 = load i32, ptr %75, align 4, !tbaa !5
  %77 = icmp slt i32 %76, 0
  br i1 %77, label %78, label %84

78:                                               ; preds = %66
  %79 = load i32, ptr %5, align 4, !tbaa !5
  %80 = sext i32 %79 to i64
  %81 = getelementptr inbounds [7 x i32], ptr @x, i64 0, i64 %80
  %82 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %4, ptr noundef nonnull align 4 dereferenceable(4) %81)
  %83 = load i32, ptr %82, align 4, !tbaa !5
  store i32 %83, ptr %4, align 4, !tbaa !5
  br label %92

84:                                               ; preds = %66
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #5
  %85 = load i32, ptr %5, align 4, !tbaa !5
  %86 = sext i32 %85 to i64
  %87 = getelementptr inbounds [7 x i32], ptr @x, i64 0, i64 %86
  %88 = load i32, ptr %87, align 4, !tbaa !5
  %89 = sub nsw i32 0, %88
  store i32 %89, ptr %8, align 4, !tbaa !5
  %90 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %3, ptr noundef nonnull align 4 dereferenceable(4) %8)
  %91 = load i32, ptr %90, align 4, !tbaa !5
  store i32 %91, ptr %3, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #5
  br label %92

92:                                               ; preds = %84, %78
  br label %93

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

96:                                               ; preds = %64, %30
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #5
  %97 = load i32, ptr %6, align 4
  switch i32 %97, label %178 [
    i32 5, label %98
  ]

98:                                               ; preds = %96
  %99 = load i32, ptr %3, align 4, !tbaa !5
  %100 = load i32, ptr %4, align 4, !tbaa !5
  %101 = icmp sgt i32 %99, %100
  br i1 %101, label %102, label %104

102:                                              ; preds = %98
  %103 = call i32 @puts(ptr noundef @.str.8)
  store i32 0, ptr %1, align 4
  store i32 1, ptr %6, align 4
  br label %178

104:                                              ; preds = %98
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #5
  %105 = load i32, ptr %3, align 4, !tbaa !5
  store i32 %105, ptr getelementptr inbounds ([7 x i32], ptr @x, i64 0, i64 6), align 8, !tbaa !5
  store i32 %105, ptr %9, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #5
  store i32 0, ptr %10, align 4, !tbaa !5
  br label %106

106:                                              ; preds = %129, %104
  %107 = load i32, ptr %10, align 4, !tbaa !5
  %108 = icmp slt i32 %107, 6
  br i1 %108, label %110, label %109

109:                                              ; preds = %106
  store i32 11, ptr %6, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #5
  br label %132

110:                                              ; preds = %106
  %111 = load i32, ptr %10, align 4, !tbaa !5
  %112 = sext i32 %111 to i64
  %113 = getelementptr inbounds [6 x [7 x i32]], ptr @_ZL3mat, i64 0, i64 %112
  %114 = getelementptr inbounds [7 x i32], ptr %113, i64 0, i64 6
  %115 = load i32, ptr %114, align 4, !tbaa !5
  %116 = load i32, ptr %3, align 4, !tbaa !5
  %117 = mul nsw i32 %115, %116
  %118 = load i32, ptr %10, align 4, !tbaa !5
  %119 = sext i32 %118 to i64
  %120 = getelementptr inbounds [7 x i32], ptr @x, i64 0, i64 %119
  %121 = load i32, ptr %120, align 4, !tbaa !5
  %122 = add nsw i32 %121, %117
  store i32 %122, ptr %120, align 4, !tbaa !5
  %123 = load i32, ptr %10, align 4, !tbaa !5
  %124 = sext i32 %123 to i64
  %125 = getelementptr inbounds [7 x i32], ptr @x, i64 0, i64 %124
  %126 = load i32, ptr %125, align 4, !tbaa !5
  %127 = load i32, ptr %9, align 4, !tbaa !5
  %128 = add nsw i32 %127, %126
  store i32 %128, ptr %9, align 4, !tbaa !5
  br label %129

129:                                              ; preds = %110
  %130 = load i32, ptr %10, align 4, !tbaa !5
  %131 = add nsw i32 %130, 1
  store i32 %131, ptr %10, align 4, !tbaa !5
  br label %106, !llvm.loop !13

132:                                              ; preds = %109
  %133 = load i32, ptr %9, align 4, !tbaa !5
  %134 = call i32 (ptr, ...) @printf(ptr noundef @.str.9, i32 noundef %133)
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #5
  store i32 0, ptr %11, align 4, !tbaa !5
  br label %135

135:                                              ; preds = %173, %132
  %136 = load i32, ptr %11, align 4, !tbaa !5
  %137 = icmp slt i32 %136, 4
  br i1 %137, label %139, label %138

138:                                              ; preds = %135
  store i32 14, ptr %6, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #5
  br label %176

139:                                              ; preds = %135
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #5
  store i32 0, ptr %12, align 4, !tbaa !5
  br label %140

140:                                              ; preds = %168, %139
  %141 = load i32, ptr %12, align 4, !tbaa !5
  %142 = icmp slt i32 %141, 7
  br i1 %142, label %144, label %143

143:                                              ; preds = %140
  store i32 17, ptr %6, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #5
  br label %171

144:                                              ; preds = %140
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #5
  store i32 0, ptr %13, align 4, !tbaa !5
  br label %145

145:                                              ; preds = %164, %144
  %146 = load i32, ptr %13, align 4, !tbaa !5
  %147 = load i32, ptr %12, align 4, !tbaa !5
  %148 = sext i32 %147 to i64
  %149 = getelementptr inbounds [7 x i32], ptr @x, i64 0, i64 %148
  %150 = load i32, ptr %149, align 4, !tbaa !5
  %151 = icmp slt i32 %146, %150
  br i1 %151, label %153, label %152

152:                                              ; preds = %145
  store i32 20, ptr %6, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #5
  br label %167

153:                                              ; preds = %145
  %154 = load i32, ptr %12, align 4, !tbaa !5
  %155 = sext i32 %154 to i64
  %156 = getelementptr inbounds [7 x ptr], ptr @pat, i64 0, i64 %155
  %157 = load ptr, ptr %156, align 8, !tbaa !14
  %158 = load i32, ptr %11, align 4, !tbaa !5
  %159 = sext i32 %158 to i64
  %160 = getelementptr inbounds i8, ptr %157, i64 %159
  %161 = load i8, ptr %160, align 1, !tbaa !16
  %162 = sext i8 %161 to i32
  %163 = call i32 @putchar(i32 noundef %162)
  br label %164

164:                                              ; preds = %153
  %165 = load i32, ptr %13, align 4, !tbaa !5
  %166 = add nsw i32 %165, 1
  store i32 %166, ptr %13, align 4, !tbaa !5
  br label %145, !llvm.loop !17

167:                                              ; preds = %152
  br label %168

168:                                              ; preds = %167
  %169 = load i32, ptr %12, align 4, !tbaa !5
  %170 = add nsw i32 %169, 1
  store i32 %170, ptr %12, align 4, !tbaa !5
  br label %140, !llvm.loop !18

171:                                              ; preds = %143
  %172 = call i32 @putchar(i32 noundef 10)
  br label %173

173:                                              ; preds = %171
  %174 = load i32, ptr %11, align 4, !tbaa !5
  %175 = add nsw i32 %174, 1
  store i32 %175, ptr %11, align 4, !tbaa !5
  br label %135, !llvm.loop !19

176:                                              ; preds = %138
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #5
  br label %177

177:                                              ; preds = %176
  store i32 0, ptr %1, align 4
  store i32 1, ptr %6, align 4
  br label %178

178:                                              ; preds = %177, %102, %96
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #5
  %179 = load i32, ptr %1, align 4
  ret i32 %179
}

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

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

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

declare i32 @puts(ptr noundef) #2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4)) #3

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4)) #3

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

; Function Attrs: inlinehint mustprogress uwtable
declare i32 @putchar(i32 noundef) #4

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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { inlinehint 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 = { inlinehint 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 #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, !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 = !{!15, !15, i64 0}
!15 = !{!"any pointer", !7, i64 0}
!16 = !{!7, !7, i64 0}
!17 = distinct !{!17, !10}
!18 = distinct !{!18, !10}
!19 = distinct !{!19, !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"

@pat = external dso_local local_unnamed_addr global [7 x ptr], align 16
@x = external dso_local global [7 x i32], align 16
@d = external dso_local global [7 x i32], align 16
@.str.7 = external hidden unnamed_addr constant [3 x i8], align 1
@_ZL3mat = external hidden local_unnamed_addr constant [6 x [7 x i32]], align 16
@.str.8 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [4 x i8], align 1

; Function Attrs: mustprogress norecurse nounwind uwtable
define dso_local noundef i32 @main() local_unnamed_addr #0 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = alloca i32, align 4
  %4 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.7, ptr noundef nonnull @d)
  %5 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.7, ptr noundef nonnull getelementptr inbounds (i8, ptr @d, i64 4))
  %6 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.7, ptr noundef nonnull getelementptr inbounds (i8, ptr @d, i64 8))
  %7 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.7, ptr noundef nonnull getelementptr inbounds (i8, ptr @d, i64 12))
  %8 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.7, ptr noundef nonnull getelementptr inbounds (i8, ptr @d, i64 16))
  %9 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.7, ptr noundef nonnull getelementptr inbounds (i8, ptr @d, i64 20))
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %1) #6
  store i32 0, ptr %1, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %2) #6
  store i32 2147483647, ptr %2, align 4, !tbaa !5
  br label %.preheader45

.preheader45:                                     ; preds = %0, %37
  %indvars.iv = phi i64 [ 0, %0 ], [ %indvars.iv.next, %37 ]
  %10 = getelementptr inbounds [7 x i32], ptr @x, i64 0, i64 %indvars.iv
  %.promoted = load i32, ptr %10, align 4, !tbaa !5
  %11 = getelementptr inbounds [6 x [7 x i32]], ptr @_ZL3mat, i64 0, i64 %indvars.iv, i64 0
  %12 = load <4 x i32>, ptr %11, align 4, !tbaa !5
  %13 = load <4 x i32>, ptr @d, align 16, !tbaa !5
  %14 = mul nsw <4 x i32> %13, %12
  %15 = getelementptr inbounds [6 x [7 x i32]], ptr @_ZL3mat, i64 0, i64 %indvars.iv, i64 4
  %16 = load i32, ptr %15, align 4, !tbaa !5
  %17 = load i32, ptr getelementptr inbounds (i8, ptr @d, i64 16), align 16, !tbaa !5
  %18 = mul nsw i32 %17, %16
  %19 = getelementptr inbounds [6 x [7 x i32]], ptr @_ZL3mat, i64 0, i64 %indvars.iv, i64 5
  %20 = load i32, ptr %19, align 4, !tbaa !5
  %21 = load i32, ptr getelementptr inbounds (i8, ptr @d, i64 20), align 4, !tbaa !5
  %22 = mul nsw i32 %21, %20
  %23 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %14)
  %op.rdx = add i32 %23, %18
  %op.rdx70 = add i32 %22, %.promoted
  %op.rdx71 = add i32 %op.rdx, %op.rdx70
  store i32 %op.rdx71, ptr %10, align 4, !tbaa !5
  %24 = and i32 %op.rdx71, 1
  %.not = icmp eq i32 %24, 0
  br i1 %.not, label %25, label %.loopexit.sink.split

25:                                               ; preds = %.preheader45
  %26 = ashr exact i32 %op.rdx71, 1
  store i32 %26, ptr %10, align 4, !tbaa !5
  %27 = getelementptr inbounds [6 x [7 x i32]], ptr @_ZL3mat, i64 0, i64 %indvars.iv, i64 6
  %28 = load i32, ptr %27, align 4, !tbaa !5
  %29 = icmp slt i32 %28, 0
  br i1 %29, label %30, label %33

30:                                               ; preds = %25
  %31 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %2, ptr noundef nonnull align 4 dereferenceable(4) %10)
  %32 = load i32, ptr %31, align 4, !tbaa !5
  store i32 %32, ptr %2, align 4, !tbaa !5
  br label %37

33:                                               ; preds = %25
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %3) #6
  %34 = sub nsw i32 0, %26
  store i32 %34, ptr %3, align 4, !tbaa !5
  %35 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %1, ptr noundef nonnull align 4 dereferenceable(4) %3)
  %36 = load i32, ptr %35, align 4, !tbaa !5
  store i32 %36, ptr %1, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %3) #6
  br label %37

37:                                               ; preds = %30, %33
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %exitcond = icmp eq i64 %indvars.iv.next, 6
  br i1 %exitcond, label %.critedge, label %.preheader45, !llvm.loop !9

.critedge:                                        ; preds = %37
  %38 = load i32, ptr %1, align 4, !tbaa !5
  %39 = load i32, ptr %2, align 4, !tbaa !5
  %40 = icmp sgt i32 %38, %39
  br i1 %40, label %.loopexit.sink.split, label %41

41:                                               ; preds = %.critedge
  store i32 %38, ptr getelementptr inbounds (i8, ptr @x, i64 24), align 8, !tbaa !5
  %42 = load i32, ptr getelementptr inbounds (i8, ptr @_ZL3mat, i64 24), align 8, !tbaa !5
  %43 = mul nsw i32 %42, %38
  %44 = load i32, ptr @x, align 16, !tbaa !5
  %45 = add nsw i32 %44, %43
  store i32 %45, ptr @x, align 16, !tbaa !5
  %46 = add nsw i32 %45, %38
  %47 = load i32, ptr getelementptr inbounds (i8, ptr @_ZL3mat, i64 52), align 4, !tbaa !5
  %48 = mul nsw i32 %47, %38
  %49 = load i32, ptr getelementptr inbounds (i8, ptr @x, i64 4), align 4, !tbaa !5
  %50 = add nsw i32 %49, %48
  store i32 %50, ptr getelementptr inbounds (i8, ptr @x, i64 4), align 4, !tbaa !5
  %51 = add nsw i32 %50, %46
  %52 = load i32, ptr getelementptr inbounds (i8, ptr @_ZL3mat, i64 80), align 16, !tbaa !5
  %53 = mul nsw i32 %52, %38
  %54 = load i32, ptr getelementptr inbounds (i8, ptr @x, i64 8), align 8, !tbaa !5
  %55 = add nsw i32 %54, %53
  store i32 %55, ptr getelementptr inbounds (i8, ptr @x, i64 8), align 8, !tbaa !5
  %56 = add nsw i32 %55, %51
  %57 = load i32, ptr getelementptr inbounds (i8, ptr @_ZL3mat, i64 108), align 4, !tbaa !5
  %58 = mul nsw i32 %57, %38
  %59 = load i32, ptr getelementptr inbounds (i8, ptr @x, i64 12), align 4, !tbaa !5
  %60 = add nsw i32 %59, %58
  store i32 %60, ptr getelementptr inbounds (i8, ptr @x, i64 12), align 4, !tbaa !5
  %61 = add nsw i32 %60, %56
  %62 = load i32, ptr getelementptr inbounds (i8, ptr @_ZL3mat, i64 136), align 8, !tbaa !5
  %63 = mul nsw i32 %62, %38
  %64 = load i32, ptr getelementptr inbounds (i8, ptr @x, i64 16), align 16, !tbaa !5
  %65 = add nsw i32 %64, %63
  store i32 %65, ptr getelementptr inbounds (i8, ptr @x, i64 16), align 16, !tbaa !5
  %66 = add nsw i32 %65, %61
  %67 = load i32, ptr getelementptr inbounds (i8, ptr @_ZL3mat, i64 164), align 4, !tbaa !5
  %68 = mul nsw i32 %67, %38
  %69 = load i32, ptr getelementptr inbounds (i8, ptr @x, i64 20), align 4, !tbaa !5
  %70 = add nsw i32 %69, %68
  store i32 %70, ptr getelementptr inbounds (i8, ptr @x, i64 20), align 4, !tbaa !5
  %71 = add nsw i32 %70, %66
  %72 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.9, i32 noundef %71)
  br label %.preheader44

.preheader44:                                     ; preds = %41, %._crit_edge.6
  %indvars.iv66 = phi i64 [ 0, %41 ], [ %indvars.iv.next67, %._crit_edge.6 ]
  %73 = load i32, ptr @x, align 16, !tbaa !5
  %74 = icmp sgt i32 %73, 0
  br i1 %74, label %.lr.ph, label %._crit_edge

._crit_edge:                                      ; preds = %.lr.ph, %.preheader44
  %75 = load i32, ptr getelementptr inbounds (i8, ptr @x, i64 4), align 4, !tbaa !5
  %76 = icmp sgt i32 %75, 0
  br i1 %76, label %.lr.ph.1, label %._crit_edge.1

.lr.ph.1:                                         ; preds = %._crit_edge, %.lr.ph.1
  %.051.1 = phi i32 [ %82, %.lr.ph.1 ], [ 0, %._crit_edge ]
  %77 = load ptr, ptr getelementptr inbounds (i8, ptr @pat, i64 8), align 8, !tbaa !11
  %78 = getelementptr inbounds i8, ptr %77, i64 %indvars.iv66
  %79 = load i8, ptr %78, align 1, !tbaa !13
  %80 = sext i8 %79 to i32
  %81 = call i32 @putchar(i32 noundef %80)
  %82 = add nuw nsw i32 %.051.1, 1
  %83 = load i32, ptr getelementptr inbounds (i8, ptr @x, i64 4), align 4, !tbaa !5
  %84 = icmp slt i32 %82, %83
  br i1 %84, label %.lr.ph.1, label %._crit_edge.1, !llvm.loop !14

._crit_edge.1:                                    ; preds = %.lr.ph.1, %._crit_edge
  %85 = load i32, ptr getelementptr inbounds (i8, ptr @x, i64 8), align 8, !tbaa !5
  %86 = icmp sgt i32 %85, 0
  br i1 %86, label %.lr.ph.2, label %._crit_edge.2

.lr.ph.2:                                         ; preds = %._crit_edge.1, %.lr.ph.2
  %.051.2 = phi i32 [ %92, %.lr.ph.2 ], [ 0, %._crit_edge.1 ]
  %87 = load ptr, ptr getelementptr inbounds (i8, ptr @pat, i64 16), align 16, !tbaa !11
  %88 = getelementptr inbounds i8, ptr %87, i64 %indvars.iv66
  %89 = load i8, ptr %88, align 1, !tbaa !13
  %90 = sext i8 %89 to i32
  %91 = call i32 @putchar(i32 noundef %90)
  %92 = add nuw nsw i32 %.051.2, 1
  %93 = load i32, ptr getelementptr inbounds (i8, ptr @x, i64 8), align 8, !tbaa !5
  %94 = icmp slt i32 %92, %93
  br i1 %94, label %.lr.ph.2, label %._crit_edge.2, !llvm.loop !14

._crit_edge.2:                                    ; preds = %.lr.ph.2, %._crit_edge.1
  %95 = load i32, ptr getelementptr inbounds (i8, ptr @x, i64 12), align 4, !tbaa !5
  %96 = icmp sgt i32 %95, 0
  br i1 %96, label %.lr.ph.3, label %._crit_edge.3

.lr.ph.3:                                         ; preds = %._crit_edge.2, %.lr.ph.3
  %.051.3 = phi i32 [ %102, %.lr.ph.3 ], [ 0, %._crit_edge.2 ]
  %97 = load ptr, ptr getelementptr inbounds (i8, ptr @pat, i64 24), align 8, !tbaa !11
  %98 = getelementptr inbounds i8, ptr %97, i64 %indvars.iv66
  %99 = load i8, ptr %98, align 1, !tbaa !13
  %100 = sext i8 %99 to i32
  %101 = call i32 @putchar(i32 noundef %100)
  %102 = add nuw nsw i32 %.051.3, 1
  %103 = load i32, ptr getelementptr inbounds (i8, ptr @x, i64 12), align 4, !tbaa !5
  %104 = icmp slt i32 %102, %103
  br i1 %104, label %.lr.ph.3, label %._crit_edge.3, !llvm.loop !14

._crit_edge.3:                                    ; preds = %.lr.ph.3, %._crit_edge.2
  %105 = load i32, ptr getelementptr inbounds (i8, ptr @x, i64 16), align 16, !tbaa !5
  %106 = icmp sgt i32 %105, 0
  br i1 %106, label %.lr.ph.4, label %._crit_edge.4

.lr.ph.4:                                         ; preds = %._crit_edge.3, %.lr.ph.4
  %.051.4 = phi i32 [ %112, %.lr.ph.4 ], [ 0, %._crit_edge.3 ]
  %107 = load ptr, ptr getelementptr inbounds (i8, ptr @pat, i64 32), align 16, !tbaa !11
  %108 = getelementptr inbounds i8, ptr %107, i64 %indvars.iv66
  %109 = load i8, ptr %108, align 1, !tbaa !13
  %110 = sext i8 %109 to i32
  %111 = call i32 @putchar(i32 noundef %110)
  %112 = add nuw nsw i32 %.051.4, 1
  %113 = load i32, ptr getelementptr inbounds (i8, ptr @x, i64 16), align 16, !tbaa !5
  %114 = icmp slt i32 %112, %113
  br i1 %114, label %.lr.ph.4, label %._crit_edge.4, !llvm.loop !14

._crit_edge.4:                                    ; preds = %.lr.ph.4, %._crit_edge.3
  %115 = load i32, ptr getelementptr inbounds (i8, ptr @x, i64 20), align 4, !tbaa !5
  %116 = icmp sgt i32 %115, 0
  br i1 %116, label %.lr.ph.5, label %._crit_edge.5

.lr.ph.5:                                         ; preds = %._crit_edge.4, %.lr.ph.5
  %.051.5 = phi i32 [ %122, %.lr.ph.5 ], [ 0, %._crit_edge.4 ]
  %117 = load ptr, ptr getelementptr inbounds (i8, ptr @pat, i64 40), align 8, !tbaa !11
  %118 = getelementptr inbounds i8, ptr %117, i64 %indvars.iv66
  %119 = load i8, ptr %118, align 1, !tbaa !13
  %120 = sext i8 %119 to i32
  %121 = call i32 @putchar(i32 noundef %120)
  %122 = add nuw nsw i32 %.051.5, 1
  %123 = load i32, ptr getelementptr inbounds (i8, ptr @x, i64 20), align 4, !tbaa !5
  %124 = icmp slt i32 %122, %123
  br i1 %124, label %.lr.ph.5, label %._crit_edge.5, !llvm.loop !14

._crit_edge.5:                                    ; preds = %.lr.ph.5, %._crit_edge.4
  %125 = load i32, ptr getelementptr inbounds (i8, ptr @x, i64 24), align 8, !tbaa !5
  %126 = icmp sgt i32 %125, 0
  br i1 %126, label %.lr.ph.6, label %._crit_edge.6

.lr.ph.6:                                         ; preds = %._crit_edge.5, %.lr.ph.6
  %.051.6 = phi i32 [ %132, %.lr.ph.6 ], [ 0, %._crit_edge.5 ]
  %127 = load ptr, ptr getelementptr inbounds (i8, ptr @pat, i64 48), align 16, !tbaa !11
  %128 = getelementptr inbounds i8, ptr %127, i64 %indvars.iv66
  %129 = load i8, ptr %128, align 1, !tbaa !13
  %130 = sext i8 %129 to i32
  %131 = call i32 @putchar(i32 noundef %130)
  %132 = add nuw nsw i32 %.051.6, 1
  %133 = load i32, ptr getelementptr inbounds (i8, ptr @x, i64 24), align 8, !tbaa !5
  %134 = icmp slt i32 %132, %133
  br i1 %134, label %.lr.ph.6, label %._crit_edge.6, !llvm.loop !14

._crit_edge.6:                                    ; preds = %.lr.ph.6, %._crit_edge.5
  %135 = call i32 @putchar(i32 noundef 10)
  %indvars.iv.next67 = add nuw nsw i64 %indvars.iv66, 1
  %exitcond69.not = icmp eq i64 %indvars.iv.next67, 4
  br i1 %exitcond69.not, label %.loopexit, label %.preheader44, !llvm.loop !15

.lr.ph:                                           ; preds = %.preheader44, %.lr.ph
  %.051 = phi i32 [ %141, %.lr.ph ], [ 0, %.preheader44 ]
  %136 = load ptr, ptr @pat, align 16, !tbaa !11
  %137 = getelementptr inbounds i8, ptr %136, i64 %indvars.iv66
  %138 = load i8, ptr %137, align 1, !tbaa !13
  %139 = sext i8 %138 to i32
  %140 = call i32 @putchar(i32 noundef %139)
  %141 = add nuw nsw i32 %.051, 1
  %142 = load i32, ptr @x, align 16, !tbaa !5
  %143 = icmp slt i32 %141, %142
  br i1 %143, label %.lr.ph, label %._crit_edge, !llvm.loop !14

.loopexit.sink.split:                             ; preds = %.preheader45, %.critedge
  %144 = call i32 @puts(ptr noundef nonnull dereferenceable(1) @.str.8)
  br label %.loopexit

.loopexit:                                        ; preds = %._crit_edge.6, %.loopexit.sink.split
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %2) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #6
  ret i32 0
}

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

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4)) local_unnamed_addr #3

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4)) local_unnamed_addr #3

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

; Function Attrs: inlinehint mustprogress nofree nounwind uwtable
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #4

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.vector.reduce.add.v4i32(<4 x i32>) #5

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 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { inlinehint 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 = { inlinehint mustprogress nofree 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 nosync nounwind speculatable willreturn memory(none) }
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 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = !{!12, !12, i64 0}
!12 = !{!"any pointer", !7, i64 0}
!13 = !{!7, !7, i64 0}
!14 = distinct !{!14, !10}
!15 = distinct !{!15, !10}


; Effective O3 passes: ConstraintEliminationPass,EarlyCSEPass,GVNPass,GlobalOptPass,IndVarSimplifyPass,InferAlignmentPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LCSSAPass,LICMPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,PostOrderFunctionAttrsPass,ReassociatePass,SLPVectorizerPass,SROAPass,SimplifyCFGPass,TailCallElimPass