; LLVM IR from Tunghohin/Competitive_Coding :: Codeforces/cf1598_B.ll (Z5solvev)

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

%"class.std::basic_istream" = type { ptr, i64, %"class.std::basic_ios" }
%"class.std::basic_ios" = type { %"class.std::ios_base", ptr, i8, i8, ptr, ptr, ptr, ptr }
%"class.std::ios_base" = type { ptr, i64, i64, i32, i32, i32, ptr, %"struct.std::ios_base::_Words", [8 x %"struct.std::ios_base::_Words"], i32, ptr, %"class.std::locale" }
%"struct.std::ios_base::_Words" = type { ptr, i64 }
%"class.std::locale" = type { ptr }
%"class.std::basic_ostream" = type { ptr, %"class.std::basic_ios" }

@mp = external dso_local global [1010 x [6 x i32]], align 16
@s = external dso_local global [1010 x i32], align 16
@_ZSt3cin = external global %"class.std::basic_istream", align 8
@_ZSt4cout = external global %"class.std::basic_ostream", align 8
@.str = external hidden unnamed_addr constant [4 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [5 x i8], align 1

; Function Attrs: mustprogress uwtable
define dso_local void @_Z5solvev() #0 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca i8, align 1
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  call void @llvm.lifetime.start.p0(i64 4, ptr %1) #5
  %9 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) %1)
  call void @llvm.memset.p0.i64(ptr align 16 @s, i8 0, i64 4040, i1 false)
  call void @llvm.memset.p0.i64(ptr align 16 @mp, i8 0, i64 24240, i1 false)
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #5
  store i32 1, ptr %2, align 4, !tbaa !5
  br label %10

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

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

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

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

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

20:                                               ; preds = %16
  %21 = load i32, ptr %2, align 4, !tbaa !5
  %22 = sext i32 %21 to i64
  %23 = getelementptr inbounds [1010 x [6 x i32]], ptr @mp, i64 0, i64 %22
  %24 = load i32, ptr %4, align 4, !tbaa !5
  %25 = sext i32 %24 to i64
  %26 = getelementptr inbounds [6 x i32], ptr %23, i64 0, i64 %25
  %27 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) %26)
  %28 = load i32, ptr %2, align 4, !tbaa !5
  %29 = sext i32 %28 to i64
  %30 = getelementptr inbounds [1010 x [6 x i32]], ptr @mp, i64 0, i64 %29
  %31 = load i32, ptr %4, align 4, !tbaa !5
  %32 = sext i32 %31 to i64
  %33 = getelementptr inbounds [6 x i32], ptr %30, i64 0, i64 %32
  %34 = load i32, ptr %33, align 4, !tbaa !5
  %35 = load i32, ptr %4, align 4, !tbaa !5
  %36 = sext i32 %35 to i64
  %37 = getelementptr inbounds [1010 x i32], ptr @s, i64 0, i64 %36
  %38 = load i32, ptr %37, align 4, !tbaa !5
  %39 = add nsw i32 %38, %34
  store i32 %39, ptr %37, align 4, !tbaa !5
  br label %40

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

43:                                               ; preds = %19
  br label %44

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

47:                                               ; preds = %14
  call void @llvm.lifetime.start.p0(i64 1, ptr %5) #5
  store i8 0, ptr %5, align 1, !tbaa !12
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #5
  store i32 1, ptr %6, align 4, !tbaa !5
  br label %48

48:                                               ; preds = %123, %47
  %49 = load i32, ptr %6, align 4, !tbaa !5
  %50 = icmp slt i32 %49, 5
  br i1 %50, label %51, label %55

51:                                               ; preds = %48
  %52 = load i8, ptr %5, align 1, !tbaa !12, !range !14, !noundef !15
  %53 = trunc i8 %52 to i1
  %54 = xor i1 %53, true
  br label %55

55:                                               ; preds = %51, %48
  %56 = phi i1 [ false, %48 ], [ %54, %51 ]
  br i1 %56, label %58, label %57

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

58:                                               ; preds = %55
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #5
  %59 = load i32, ptr %6, align 4, !tbaa !5
  %60 = add nsw i32 %59, 1
  store i32 %60, ptr %7, align 4, !tbaa !5
  br label %61

61:                                               ; preds = %119, %58
  %62 = load i32, ptr %7, align 4, !tbaa !5
  %63 = icmp sle i32 %62, 5
  br i1 %63, label %64, label %68

64:                                               ; preds = %61
  %65 = load i8, ptr %5, align 1, !tbaa !12, !range !14, !noundef !15
  %66 = trunc i8 %65 to i1
  %67 = xor i1 %66, true
  br label %68

68:                                               ; preds = %64, %61
  %69 = phi i1 [ false, %61 ], [ %67, %64 ]
  br i1 %69, label %71, label %70

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

71:                                               ; preds = %68
  store i8 1, ptr %5, align 1, !tbaa !12
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #5
  store i32 1, ptr %8, align 4, !tbaa !5
  br label %72

72:                                               ; preds = %97, %71
  %73 = load i32, ptr %8, align 4, !tbaa !5
  %74 = load i32, ptr %1, align 4, !tbaa !5
  %75 = icmp sle i32 %73, %74
  br i1 %75, label %77, label %76

76:                                               ; preds = %72
  store i32 14, ptr %3, align 4
  br label %100

77:                                               ; preds = %72
  %78 = load i32, ptr %8, align 4, !tbaa !5
  %79 = sext i32 %78 to i64
  %80 = getelementptr inbounds [1010 x [6 x i32]], ptr @mp, i64 0, i64 %79
  %81 = load i32, ptr %6, align 4, !tbaa !5
  %82 = sext i32 %81 to i64
  %83 = getelementptr inbounds [6 x i32], ptr %80, i64 0, i64 %82
  %84 = load i32, ptr %83, align 4, !tbaa !5
  %85 = icmp eq i32 %84, 0
  br i1 %85, label %86, label %96

86:                                               ; preds = %77
  %87 = load i32, ptr %8, align 4, !tbaa !5
  %88 = sext i32 %87 to i64
  %89 = getelementptr inbounds [1010 x [6 x i32]], ptr @mp, i64 0, i64 %88
  %90 = load i32, ptr %7, align 4, !tbaa !5
  %91 = sext i32 %90 to i64
  %92 = getelementptr inbounds [6 x i32], ptr %89, i64 0, i64 %91
  %93 = load i32, ptr %92, align 4, !tbaa !5
  %94 = icmp eq i32 %93, 0
  br i1 %94, label %95, label %96

95:                                               ; preds = %86
  store i8 0, ptr %5, align 1, !tbaa !12
  store i32 14, ptr %3, align 4
  br label %100

96:                                               ; preds = %86, %77
  br label %97

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

100:                                              ; preds = %95, %76
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #5
  br label %101

101:                                              ; preds = %100
  %102 = load i32, ptr %7, align 4, !tbaa !5
  %103 = sext i32 %102 to i64
  %104 = getelementptr inbounds [1010 x i32], ptr @s, i64 0, i64 %103
  %105 = load i32, ptr %104, align 4, !tbaa !5
  %106 = load i32, ptr %1, align 4, !tbaa !5
  %107 = sdiv i32 %106, 2
  %108 = icmp slt i32 %105, %107
  br i1 %108, label %117, label %109

109:                                              ; preds = %101
  %110 = load i32, ptr %6, align 4, !tbaa !5
  %111 = sext i32 %110 to i64
  %112 = getelementptr inbounds [1010 x i32], ptr @s, i64 0, i64 %111
  %113 = load i32, ptr %112, align 4, !tbaa !5
  %114 = load i32, ptr %1, align 4, !tbaa !5
  %115 = sdiv i32 %114, 2
  %116 = icmp slt i32 %113, %115
  br i1 %116, label %117, label %118

117:                                              ; preds = %109, %101
  store i8 0, ptr %5, align 1, !tbaa !12
  br label %118

118:                                              ; preds = %117, %109
  br label %119

119:                                              ; preds = %118
  %120 = load i32, ptr %7, align 4, !tbaa !5
  %121 = add nsw i32 %120, 1
  store i32 %121, ptr %7, align 4, !tbaa !5
  br label %61, !llvm.loop !17

122:                                              ; preds = %70
  br label %123

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

126:                                              ; preds = %57
  %127 = load i8, ptr %5, align 1, !tbaa !12, !range !14, !noundef !15
  %128 = trunc i8 %127 to i1
  br i1 %128, label %131, label %129

129:                                              ; preds = %126
  %130 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, ptr noundef @.str)
  br label %133

131:                                              ; preds = %126
  %132 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, ptr noundef @.str.1)
  br label %133

133:                                              ; preds = %131, %129
  call void @llvm.lifetime.end.p0(i64 1, ptr %5) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %1) #5
  ret void
}

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

declare noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 4 dereferenceable(4)) #2

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #3

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

; Function Attrs: inlinehint mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef) #4

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

%"class.std::basic_istream" = type { ptr, i64, %"class.std::basic_ios" }
%"class.std::basic_ios" = type { %"class.std::ios_base", ptr, i8, i8, ptr, ptr, ptr, ptr }
%"class.std::ios_base" = type { ptr, i64, i64, i32, i32, i32, ptr, %"struct.std::ios_base::_Words", [8 x %"struct.std::ios_base::_Words"], i32, ptr, %"class.std::locale" }
%"struct.std::ios_base::_Words" = type { ptr, i64 }
%"class.std::locale" = type { ptr }
%"class.std::basic_ostream" = type { ptr, %"class.std::basic_ios" }

@mp = external dso_local global [1010 x [6 x i32]], align 16
@s = external dso_local local_unnamed_addr global [1010 x i32], align 16
@_ZSt3cin = external global %"class.std::basic_istream", align 8
@_ZSt4cout = external global %"class.std::basic_ostream", align 8
@.str = external hidden unnamed_addr constant [4 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [5 x i8], align 1

; Function Attrs: mustprogress uwtable
define dso_local void @_Z5solvev() local_unnamed_addr #0 {
  %1 = alloca i32, align 4
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %1) #5
  %2 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) %1)
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(4040) @s, i8 0, i64 4040, i1 false)
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(24240) @mp, i8 0, i64 24240, i1 false)
  %3 = load i32, ptr %1, align 4, !tbaa !5
  %.not40 = icmp slt i32 %3, 1
  br i1 %.not40, label %.preheader36, label %.preheader37

.preheader37:                                     ; preds = %0, %.preheader37
  %indvars.iv = phi i64 [ %indvars.iv.next, %.preheader37 ], [ 1, %0 ]
  %4 = getelementptr inbounds [1010 x [6 x i32]], ptr @mp, i64 0, i64 %indvars.iv, i64 1
  %5 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) %4)
  %6 = load i32, ptr %4, align 4, !tbaa !5
  %7 = load i32, ptr getelementptr inbounds (i8, ptr @s, i64 4), align 4, !tbaa !5
  %8 = add nsw i32 %7, %6
  store i32 %8, ptr getelementptr inbounds (i8, ptr @s, i64 4), align 4, !tbaa !5
  %9 = getelementptr inbounds [1010 x [6 x i32]], ptr @mp, i64 0, i64 %indvars.iv, i64 2
  %10 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) %9)
  %11 = load i32, ptr %9, align 8, !tbaa !5
  %12 = load i32, ptr getelementptr inbounds (i8, ptr @s, i64 8), align 8, !tbaa !5
  %13 = add nsw i32 %12, %11
  store i32 %13, ptr getelementptr inbounds (i8, ptr @s, i64 8), align 8, !tbaa !5
  %14 = getelementptr inbounds [1010 x [6 x i32]], ptr @mp, i64 0, i64 %indvars.iv, i64 3
  %15 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) %14)
  %16 = load i32, ptr %14, align 4, !tbaa !5
  %17 = load i32, ptr getelementptr inbounds (i8, ptr @s, i64 12), align 4, !tbaa !5
  %18 = add nsw i32 %17, %16
  store i32 %18, ptr getelementptr inbounds (i8, ptr @s, i64 12), align 4, !tbaa !5
  %19 = getelementptr inbounds [1010 x [6 x i32]], ptr @mp, i64 0, i64 %indvars.iv, i64 4
  %20 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) %19)
  %21 = load i32, ptr %19, align 8, !tbaa !5
  %22 = load i32, ptr getelementptr inbounds (i8, ptr @s, i64 16), align 16, !tbaa !5
  %23 = add nsw i32 %22, %21
  store i32 %23, ptr getelementptr inbounds (i8, ptr @s, i64 16), align 16, !tbaa !5
  %24 = getelementptr inbounds [1010 x [6 x i32]], ptr @mp, i64 0, i64 %indvars.iv, i64 5
  %25 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) %24)
  %26 = load i32, ptr %24, align 4, !tbaa !5
  %27 = load i32, ptr getelementptr inbounds (i8, ptr @s, i64 20), align 4, !tbaa !5
  %28 = add nsw i32 %27, %26
  store i32 %28, ptr getelementptr inbounds (i8, ptr @s, i64 20), align 4, !tbaa !5
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %29 = load i32, ptr %1, align 4, !tbaa !5
  %30 = sext i32 %29 to i64
  %.not.not = icmp slt i64 %indvars.iv, %30
  br i1 %.not.not, label %.preheader37, label %.preheader36, !llvm.loop !9

.preheader36:                                     ; preds = %.preheader37, %0
  %.lcssa38 = phi i32 [ %3, %0 ], [ %29, %.preheader37 ]
  %.lcssa38.fr = freeze i32 %.lcssa38
  %.not3542 = icmp slt i32 %.lcssa38.fr, 1
  %31 = sdiv i32 %.lcssa38.fr, 2
  br i1 %.not3542, label %.preheader.us.us, label %.preheader36.split.preheader

.preheader36.split.preheader:                     ; preds = %.preheader36
  %32 = add nuw i32 %.lcssa38.fr, 1
  %wide.trip.count = zext i32 %32 to i64
  br label %.preheader36.split

.preheader.us.us.1.1:                             ; preds = %.loopexit.us
  %33 = load i32, ptr getelementptr inbounds (i8, ptr @s, i64 16), align 16, !tbaa !5
  %34 = icmp slt i32 %33, %31
  %35 = load i32, ptr getelementptr inbounds (i8, ptr @s, i64 8), align 8
  %36 = icmp slt i32 %35, %31
  %or.cond114 = select i1 %34, i1 true, i1 %36
  br i1 %or.cond114, label %.preheader.us.us.2.1, label %.split.us.thread

.preheader.us.us.2.1:                             ; preds = %.preheader.us.us.1.1
  %37 = load i32, ptr getelementptr inbounds (i8, ptr @s, i64 20), align 4, !tbaa !5
  %38 = icmp slt i32 %37, %31
  %39 = load i32, ptr getelementptr inbounds (i8, ptr @s, i64 8), align 8
  %40 = icmp slt i32 %39, %31
  %or.cond116 = select i1 %38, i1 true, i1 %40
  br i1 %or.cond116, label %.preheader.us.us.2108, label %.split.us.thread

.preheader.us.us.2108:                            ; preds = %.preheader.us.us.2.1
  %41 = load i32, ptr getelementptr inbounds (i8, ptr @s, i64 16), align 16, !tbaa !5
  %42 = icmp slt i32 %41, %31
  %43 = load i32, ptr getelementptr inbounds (i8, ptr @s, i64 12), align 4
  %44 = icmp slt i32 %43, %31
  %or.cond118 = select i1 %42, i1 true, i1 %44
  br i1 %or.cond118, label %.preheader.us.us.1.2, label %.split.us.thread

.preheader.us.us.1.2:                             ; preds = %.preheader.us.us.2108
  %45 = load i32, ptr getelementptr inbounds (i8, ptr @s, i64 20), align 4, !tbaa !5
  %46 = icmp slt i32 %45, %31
  %47 = load i32, ptr getelementptr inbounds (i8, ptr @s, i64 12), align 4
  %48 = icmp slt i32 %47, %31
  %or.cond120 = select i1 %46, i1 true, i1 %48
  br i1 %or.cond120, label %.preheader.us.us.3110, label %.split.us.thread

.preheader.us.us.3110:                            ; preds = %.preheader.us.us.1.2
  %49 = load i32, ptr getelementptr inbounds (i8, ptr @s, i64 20), align 4, !tbaa !5
  %50 = icmp slt i32 %49, %31
  %51 = load i32, ptr getelementptr inbounds (i8, ptr @s, i64 16), align 16
  %52 = icmp slt i32 %51, %31
  %or.cond122 = select i1 %50, i1 true, i1 %52
  br i1 %or.cond122, label %.split.us.thread97, label %.split.us.thread

.preheader.us.us:                                 ; preds = %.preheader36
  %53 = load i32, ptr getelementptr inbounds (i8, ptr @s, i64 8), align 8, !tbaa !5
  %54 = icmp slt i32 %53, %31
  %55 = load i32, ptr getelementptr inbounds (i8, ptr @s, i64 4), align 4
  %56 = icmp slt i32 %55, %31
  %or.cond124 = select i1 %54, i1 true, i1 %56
  br i1 %or.cond124, label %.preheader.us.us.1, label %.split.us.thread

.preheader.us.us.1:                               ; preds = %.preheader.us.us
  %57 = load i32, ptr getelementptr inbounds (i8, ptr @s, i64 12), align 4, !tbaa !5
  %58 = icmp slt i32 %57, %31
  %59 = load i32, ptr getelementptr inbounds (i8, ptr @s, i64 4), align 4
  %60 = icmp slt i32 %59, %31
  %or.cond126 = select i1 %58, i1 true, i1 %60
  br i1 %or.cond126, label %.preheader.us.us.2, label %.split.us.thread

.preheader.us.us.2:                               ; preds = %.preheader.us.us.1
  %61 = load i32, ptr getelementptr inbounds (i8, ptr @s, i64 16), align 16, !tbaa !5
  %62 = icmp slt i32 %61, %31
  %63 = load i32, ptr getelementptr inbounds (i8, ptr @s, i64 4), align 4
  %64 = icmp slt i32 %63, %31
  %or.cond128 = select i1 %62, i1 true, i1 %64
  br i1 %or.cond128, label %.preheader.us.us.3, label %.split.us.thread

.preheader.us.us.3:                               ; preds = %.preheader.us.us.2
  %65 = load i32, ptr getelementptr inbounds (i8, ptr @s, i64 20), align 4, !tbaa !5
  %66 = icmp slt i32 %65, %31
  %67 = load i32, ptr getelementptr inbounds (i8, ptr @s, i64 4), align 4
  %68 = icmp slt i32 %67, %31
  %or.cond130 = select i1 %66, i1 true, i1 %68
  br i1 %or.cond130, label %.loopexit.us, label %.split.us.thread

.loopexit.us:                                     ; preds = %.preheader.us.us.3
  %69 = load i32, ptr getelementptr inbounds (i8, ptr @s, i64 12), align 4, !tbaa !5
  %70 = icmp slt i32 %69, %31
  %71 = load i32, ptr getelementptr inbounds (i8, ptr @s, i64 8), align 8
  %72 = icmp slt i32 %71, %31
  %or.cond = select i1 %70, i1 true, i1 %72
  br i1 %or.cond, label %.preheader.us.us.1.1, label %.split.us.thread

.loopexit:                                        ; preds = %146, %128, %110, %92
  %.3.lcssa = phi i8 [ %.3, %92 ], [ %.3.1, %110 ], [ %.3.2, %128 ], [ %.3.3, %146 ]
  %.lcssa = phi i1 [ %94, %92 ], [ %112, %110 ], [ %130, %128 ], [ %147, %146 ]
  %73 = icmp ugt i64 %indvars.iv66, 3
  %.not32 = select i1 %73, i1 true, i1 %.lcssa
  %indvars.iv.next62 = add nuw nsw i64 %indvars.iv61, 1
  br i1 %.not32, label %.split.us, label %.preheader36.split, !llvm.loop !11

.split.us:                                        ; preds = %.loopexit
  br i1 %.lcssa, label %.split.us.thread, label %.split.us.thread97

.preheader36.split:                               ; preds = %.preheader36.split.preheader, %.loopexit
  %indvars.iv66 = phi i64 [ 1, %.preheader36.split.preheader ], [ %indvars.iv.next67, %.loopexit ]
  %indvars.iv61 = phi i64 [ 2, %.preheader36.split.preheader ], [ %indvars.iv.next62, %.loopexit ]
  %.02750 = phi i8 [ 0, %.preheader36.split.preheader ], [ %.3.lcssa, %.loopexit ]
  %indvars.iv.next67 = add nuw nsw i64 %indvars.iv66, 1
  %74 = trunc nuw i8 %.02750 to i1
  br i1 %74, label %.split.us.thread, label %.preheader.lr.ph

.preheader.lr.ph:                                 ; preds = %.preheader36.split
  %75 = getelementptr inbounds [1010 x i32], ptr @s, i64 0, i64 %indvars.iv66
  br label %76

76:                                               ; preds = %.preheader.lr.ph, %84
  %indvars.iv58 = phi i64 [ 1, %.preheader.lr.ph ], [ %indvars.iv.next59, %84 ]
  %77 = getelementptr inbounds [1010 x [6 x i32]], ptr @mp, i64 0, i64 %indvars.iv58, i64 %indvars.iv66
  %78 = load i32, ptr %77, align 4, !tbaa !5
  %79 = icmp eq i32 %78, 0
  br i1 %79, label %80, label %84

80:                                               ; preds = %76
  %81 = getelementptr inbounds [1010 x [6 x i32]], ptr @mp, i64 0, i64 %indvars.iv58, i64 %indvars.iv61
  %82 = load i32, ptr %81, align 4, !tbaa !5
  %83 = icmp eq i32 %82, 0
  br i1 %83, label %._crit_edge, label %84

84:                                               ; preds = %76, %80
  %indvars.iv.next59 = add nuw nsw i64 %indvars.iv58, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next59, %wide.trip.count
  br i1 %exitcond.not, label %._crit_edge, label %76, !llvm.loop !12

._crit_edge:                                      ; preds = %84, %80
  %.2 = phi i8 [ 0, %80 ], [ 1, %84 ]
  %85 = getelementptr inbounds [1010 x i32], ptr @s, i64 0, i64 %indvars.iv61
  %86 = load i32, ptr %85, align 4, !tbaa !5
  %87 = icmp slt i32 %86, %31
  br i1 %87, label %91, label %88

88:                                               ; preds = %._crit_edge
  %89 = load i32, ptr %75, align 4, !tbaa !5
  %90 = icmp slt i32 %89, %31
  br i1 %90, label %91, label %92

91:                                               ; preds = %88, %._crit_edge
  br label %92

92:                                               ; preds = %88, %91
  %.3 = phi i8 [ 0, %91 ], [ %.2, %88 ]
  %indvars.iv.next64 = add nuw nsw i64 %indvars.iv61, 1
  %93 = icmp ugt i64 %indvars.iv61, 4
  %94 = trunc nuw i8 %.3 to i1
  %.not34 = select i1 %93, i1 true, i1 %94
  br i1 %.not34, label %.loopexit, label %.preheader.1, !llvm.loop !13

.preheader.1:                                     ; preds = %92, %102
  %indvars.iv58.1 = phi i64 [ %indvars.iv.next59.1, %102 ], [ 1, %92 ]
  %95 = getelementptr inbounds [1010 x [6 x i32]], ptr @mp, i64 0, i64 %indvars.iv58.1, i64 %indvars.iv66
  %96 = load i32, ptr %95, align 4, !tbaa !5
  %97 = icmp eq i32 %96, 0
  br i1 %97, label %98, label %102

98:                                               ; preds = %.preheader.1
  %99 = getelementptr inbounds [1010 x [6 x i32]], ptr @mp, i64 0, i64 %indvars.iv58.1, i64 %indvars.iv.next64
  %100 = load i32, ptr %99, align 4, !tbaa !5
  %101 = icmp eq i32 %100, 0
  br i1 %101, label %._crit_edge.1, label %102

102:                                              ; preds = %98, %.preheader.1
  %indvars.iv.next59.1 = add nuw nsw i64 %indvars.iv58.1, 1
  %exitcond.not.1 = icmp eq i64 %indvars.iv.next59.1, %wide.trip.count
  br i1 %exitcond.not.1, label %._crit_edge.1, label %.preheader.1, !llvm.loop !12

._crit_edge.1:                                    ; preds = %102, %98
  %.2.1 = phi i8 [ 0, %98 ], [ 1, %102 ]
  %103 = getelementptr inbounds [1010 x i32], ptr @s, i64 0, i64 %indvars.iv.next64
  %104 = load i32, ptr %103, align 4, !tbaa !5
  %105 = icmp slt i32 %104, %31
  br i1 %105, label %109, label %106

106:                                              ; preds = %._crit_edge.1
  %107 = load i32, ptr %75, align 4, !tbaa !5
  %108 = icmp slt i32 %107, %31
  br i1 %108, label %109, label %110

109:                                              ; preds = %106, %._crit_edge.1
  br label %110

110:                                              ; preds = %109, %106
  %.3.1 = phi i8 [ 0, %109 ], [ %.2.1, %106 ]
  %indvars.iv.next64.1 = add nuw nsw i64 %indvars.iv61, 2
  %111 = icmp ugt i64 %indvars.iv61, 3
  %112 = trunc nuw i8 %.3.1 to i1
  %.not34.1 = select i1 %111, i1 true, i1 %112
  br i1 %.not34.1, label %.loopexit, label %.preheader.2, !llvm.loop !13

.preheader.2:                                     ; preds = %110, %120
  %indvars.iv58.2 = phi i64 [ %indvars.iv.next59.2, %120 ], [ 1, %110 ]
  %113 = getelementptr inbounds [1010 x [6 x i32]], ptr @mp, i64 0, i64 %indvars.iv58.2, i64 %indvars.iv66
  %114 = load i32, ptr %113, align 4, !tbaa !5
  %115 = icmp eq i32 %114, 0
  br i1 %115, label %116, label %120

116:                                              ; preds = %.preheader.2
  %117 = getelementptr inbounds [1010 x [6 x i32]], ptr @mp, i64 0, i64 %indvars.iv58.2, i64 %indvars.iv.next64.1
  %118 = load i32, ptr %117, align 4, !tbaa !5
  %119 = icmp eq i32 %118, 0
  br i1 %119, label %._crit_edge.2, label %120

120:                                              ; preds = %116, %.preheader.2
  %indvars.iv.next59.2 = add nuw nsw i64 %indvars.iv58.2, 1
  %exitcond.not.2 = icmp eq i64 %indvars.iv.next59.2, %wide.trip.count
  br i1 %exitcond.not.2, label %._crit_edge.2, label %.preheader.2, !llvm.loop !12

._crit_edge.2:                                    ; preds = %120, %116
  %.2.2 = phi i8 [ 0, %116 ], [ 1, %120 ]
  %121 = getelementptr inbounds [1010 x i32], ptr @s, i64 0, i64 %indvars.iv.next64.1
  %122 = load i32, ptr %121, align 4, !tbaa !5
  %123 = icmp slt i32 %122, %31
  br i1 %123, label %127, label %124

124:                                              ; preds = %._crit_edge.2
  %125 = load i32, ptr %75, align 4, !tbaa !5
  %126 = icmp slt i32 %125, %31
  br i1 %126, label %127, label %128

127:                                              ; preds = %124, %._crit_edge.2
  br label %128

128:                                              ; preds = %127, %124
  %.3.2 = phi i8 [ 0, %127 ], [ %.2.2, %124 ]
  %indvars.iv.next64.2 = add nuw nsw i64 %indvars.iv61, 3
  %129 = icmp ugt i64 %indvars.iv61, 2
  %130 = trunc nuw i8 %.3.2 to i1
  %.not34.2 = select i1 %129, i1 true, i1 %130
  br i1 %.not34.2, label %.loopexit, label %.preheader.3, !llvm.loop !13

.preheader.3:                                     ; preds = %128, %138
  %indvars.iv58.3 = phi i64 [ %indvars.iv.next59.3, %138 ], [ 1, %128 ]
  %131 = getelementptr inbounds [1010 x [6 x i32]], ptr @mp, i64 0, i64 %indvars.iv58.3, i64 %indvars.iv66
  %132 = load i32, ptr %131, align 4, !tbaa !5
  %133 = icmp eq i32 %132, 0
  br i1 %133, label %134, label %138

134:                                              ; preds = %.preheader.3
  %135 = getelementptr inbounds [1010 x [6 x i32]], ptr @mp, i64 0, i64 %indvars.iv58.3, i64 %indvars.iv.next64.2
  %136 = load i32, ptr %135, align 4, !tbaa !5
  %137 = icmp eq i32 %136, 0
  br i1 %137, label %._crit_edge.3, label %138

138:                                              ; preds = %134, %.preheader.3
  %indvars.iv.next59.3 = add nuw nsw i64 %indvars.iv58.3, 1
  %exitcond.not.3 = icmp eq i64 %indvars.iv.next59.3, %wide.trip.count
  br i1 %exitcond.not.3, label %._crit_edge.3, label %.preheader.3, !llvm.loop !12

._crit_edge.3:                                    ; preds = %138, %134
  %.2.3 = phi i8 [ 0, %134 ], [ 1, %138 ]
  %139 = getelementptr inbounds [1010 x i32], ptr @s, i64 0, i64 %indvars.iv.next64.2
  %140 = load i32, ptr %139, align 4, !tbaa !5
  %141 = icmp slt i32 %140, %31
  br i1 %141, label %145, label %142

142:                                              ; preds = %._crit_edge.3
  %143 = load i32, ptr %75, align 4, !tbaa !5
  %144 = icmp slt i32 %143, %31
  br i1 %144, label %145, label %146

145:                                              ; preds = %142, %._crit_edge.3
  br label %146

146:                                              ; preds = %145, %142
  %.3.3 = phi i8 [ 0, %145 ], [ %.2.3, %142 ]
  %147 = trunc nuw i8 %.3.3 to i1
  br label %.loopexit

.split.us.thread:                                 ; preds = %.preheader36.split, %.loopexit.us, %.preheader.us.us.1.1, %.preheader.us.us.2.1, %.preheader.us.us.2108, %.preheader.us.us.1.2, %.preheader.us.us.3110, %.preheader.us.us, %.preheader.us.us.1, %.preheader.us.us.2, %.preheader.us.us.3, %.split.us
  br label %.split.us.thread97

.split.us.thread97:                               ; preds = %.preheader.us.us.3110, %.split.us, %.split.us.thread
  %.str.1.sink = phi ptr [ @.str.1, %.split.us.thread ], [ @.str, %.split.us ], [ @.str, %.preheader.us.us.3110 ]
  %148 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, ptr noundef nonnull %.str.1.sink)
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #5
  ret void
}

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

declare noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 4 dereferenceable(4)) local_unnamed_addr #2

; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #3

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

; Function Attrs: inlinehint mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef) local_unnamed_addr #4

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


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