; LLVM IR from abeaumont/competitive-programming :: tuenti/tuenti-challenge-8 (4)

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

@n = external dso_local global i32, align 4
@m = external dso_local global i32, align 4
@a = external dso_local global [1001 x [1001 x i8]], align 16
@v = external dso_local global [1001 x [1001 x i8]], 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 [7 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [12 x i8], align 1

; Function Attrs: mustprogress uwtable
declare dso_local noundef i32 @_Z1siiii(i32 noundef, i32 noundef, i32 noundef, i32 noundef) #0

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

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

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() #2 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  %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
  %14 = alloca i32, align 4
  %15 = alloca i32, align 4
  %16 = alloca i32, align 4
  store i32 0, ptr %1, align 4
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #5
  %17 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) %2)
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #5
  store i32 1, ptr %3, align 4, !tbaa !5
  br label %18

18:                                               ; preds = %154, %0
  %19 = load i32, ptr %3, align 4, !tbaa !5
  %20 = load i32, ptr %2, align 4, !tbaa !5
  %21 = icmp sle i32 %19, %20
  br i1 %21, label %23, label %22

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

23:                                               ; preds = %18
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #5
  %24 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) @n)
  %25 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %24, ptr noundef nonnull align 4 dereferenceable(4) @m)
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #5
  store i32 0, ptr %11, align 4, !tbaa !5
  br label %26

26:                                               ; preds = %96, %23
  %27 = load i32, ptr %11, align 4, !tbaa !5
  %28 = load i32, ptr @n, align 4, !tbaa !5
  %29 = icmp slt i32 %27, %28
  br i1 %29, label %31, label %30

30:                                               ; preds = %26
  store i32 5, ptr %4, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #5
  br label %99

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

32:                                               ; preds = %92, %31
  %33 = load i32, ptr %12, align 4, !tbaa !5
  %34 = load i32, ptr @m, align 4, !tbaa !5
  %35 = icmp slt i32 %33, %34
  br i1 %35, label %37, label %36

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

37:                                               ; preds = %32
  %38 = load i32, ptr %11, align 4, !tbaa !5
  %39 = sext i32 %38 to i64
  %40 = getelementptr inbounds [1001 x [1001 x i8]], ptr @a, i64 0, i64 %39
  %41 = load i32, ptr %12, align 4, !tbaa !5
  %42 = sext i32 %41 to i64
  %43 = getelementptr inbounds [1001 x i8], ptr %40, i64 0, i64 %42
  %44 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZStrsIcSt11char_traitsIcEERSt13basic_istreamIT_T0_ES6_RS3_(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 1 dereferenceable(1) %43)
  %45 = load i32, ptr %11, align 4, !tbaa !5
  %46 = sext i32 %45 to i64
  %47 = getelementptr inbounds [1001 x [1001 x i8]], ptr @v, i64 0, i64 %46
  %48 = load i32, ptr %12, align 4, !tbaa !5
  %49 = sext i32 %48 to i64
  %50 = getelementptr inbounds [1001 x i8], ptr %47, i64 0, i64 %49
  store i8 0, ptr %50, align 1, !tbaa !9
  %51 = load i32, ptr %11, align 4, !tbaa !5
  %52 = sext i32 %51 to i64
  %53 = getelementptr inbounds [1001 x [1001 x i8]], ptr @a, i64 0, i64 %52
  %54 = load i32, ptr %12, align 4, !tbaa !5
  %55 = sext i32 %54 to i64
  %56 = getelementptr inbounds [1001 x i8], ptr %53, i64 0, i64 %55
  %57 = load i8, ptr %56, align 1, !tbaa !11
  %58 = sext i8 %57 to i32
  %59 = icmp eq i32 %58, 80
  br i1 %59, label %60, label %63

60:                                               ; preds = %37
  %61 = load i32, ptr %11, align 4, !tbaa !5
  store i32 %61, ptr %6, align 4, !tbaa !5
  %62 = load i32, ptr %12, align 4, !tbaa !5
  store i32 %62, ptr %5, align 4, !tbaa !5
  br label %91

63:                                               ; preds = %37
  %64 = load i32, ptr %11, align 4, !tbaa !5
  %65 = sext i32 %64 to i64
  %66 = getelementptr inbounds [1001 x [1001 x i8]], ptr @a, i64 0, i64 %65
  %67 = load i32, ptr %12, align 4, !tbaa !5
  %68 = sext i32 %67 to i64
  %69 = getelementptr inbounds [1001 x i8], ptr %66, i64 0, i64 %68
  %70 = load i8, ptr %69, align 1, !tbaa !11
  %71 = sext i8 %70 to i32
  %72 = icmp eq i32 %71, 83
  br i1 %72, label %73, label %76

73:                                               ; preds = %63
  %74 = load i32, ptr %11, align 4, !tbaa !5
  store i32 %74, ptr %8, align 4, !tbaa !5
  %75 = load i32, ptr %12, align 4, !tbaa !5
  store i32 %75, ptr %7, align 4, !tbaa !5
  br label %90

76:                                               ; preds = %63
  %77 = load i32, ptr %11, align 4, !tbaa !5
  %78 = sext i32 %77 to i64
  %79 = getelementptr inbounds [1001 x [1001 x i8]], ptr @a, i64 0, i64 %78
  %80 = load i32, ptr %12, align 4, !tbaa !5
  %81 = sext i32 %80 to i64
  %82 = getelementptr inbounds [1001 x i8], ptr %79, i64 0, i64 %81
  %83 = load i8, ptr %82, align 1, !tbaa !11
  %84 = sext i8 %83 to i32
  %85 = icmp eq i32 %84, 68
  br i1 %85, label %86, label %89

86:                                               ; preds = %76
  %87 = load i32, ptr %11, align 4, !tbaa !5
  store i32 %87, ptr %10, align 4, !tbaa !5
  %88 = load i32, ptr %12, align 4, !tbaa !5
  store i32 %88, ptr %9, align 4, !tbaa !5
  br label %89

89:                                               ; preds = %86, %76
  br label %90

90:                                               ; preds = %89, %73
  br label %91

91:                                               ; preds = %90, %60
  br label %92

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

95:                                               ; preds = %36
  br label %96

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

99:                                               ; preds = %30
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #5
  %100 = load i32, ptr %8, align 4, !tbaa !5
  %101 = load i32, ptr %7, align 4, !tbaa !5
  %102 = load i32, ptr %6, align 4, !tbaa !5
  %103 = load i32, ptr %5, align 4, !tbaa !5
  %104 = call noundef i32 @_Z1siiii(i32 noundef %100, i32 noundef %101, i32 noundef %102, i32 noundef %103)
  store i32 %104, ptr %13, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #5
  store i32 0, ptr %14, align 4, !tbaa !5
  br label %105

105:                                              ; preds = %127, %99
  %106 = load i32, ptr %14, 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 11, ptr %4, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #5
  br label %130

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

111:                                              ; preds = %123, %110
  %112 = load i32, ptr %15, align 4, !tbaa !5
  %113 = load i32, ptr @m, align 4, !tbaa !5
  %114 = icmp slt i32 %112, %113
  br i1 %114, label %116, label %115

115:                                              ; preds = %111
  store i32 14, ptr %4, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #5
  br label %126

116:                                              ; preds = %111
  %117 = load i32, ptr %14, align 4, !tbaa !5
  %118 = sext i32 %117 to i64
  %119 = getelementptr inbounds [1001 x [1001 x i8]], ptr @v, i64 0, i64 %118
  %120 = load i32, ptr %15, align 4, !tbaa !5
  %121 = sext i32 %120 to i64
  %122 = getelementptr inbounds [1001 x i8], ptr %119, i64 0, i64 %121
  store i8 0, ptr %122, align 1, !tbaa !9
  br label %123

123:                                              ; preds = %116
  %124 = load i32, ptr %15, align 4, !tbaa !5
  %125 = add nsw i32 %124, 1
  store i32 %125, ptr %15, align 4, !tbaa !5
  br label %111, !llvm.loop !15

126:                                              ; preds = %115
  br label %127

127:                                              ; preds = %126
  %128 = load i32, ptr %14, align 4, !tbaa !5
  %129 = add nsw i32 %128, 1
  store i32 %129, ptr %14, align 4, !tbaa !5
  br label %105, !llvm.loop !16

130:                                              ; preds = %109
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #5
  %131 = load i32, ptr %6, align 4, !tbaa !5
  %132 = load i32, ptr %5, align 4, !tbaa !5
  %133 = load i32, ptr %10, align 4, !tbaa !5
  %134 = load i32, ptr %9, align 4, !tbaa !5
  %135 = call noundef i32 @_Z1siiii(i32 noundef %131, i32 noundef %132, i32 noundef %133, i32 noundef %134)
  store i32 %135, ptr %16, align 4, !tbaa !5
  %136 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, ptr noundef @.str)
  %137 = load i32, ptr %3, align 4, !tbaa !5
  %138 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) %136, i32 noundef %137)
  %139 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) %138, ptr noundef @.str.3)
  %140 = load i32, ptr %13, align 4, !tbaa !5
  %141 = icmp ne i32 %140, 0
  br i1 %141, label %142, label %145

142:                                              ; preds = %130
  %143 = load i32, ptr %16, align 4, !tbaa !5
  %144 = icmp ne i32 %143, 0
  br i1 %144, label %147, label %145

145:                                              ; preds = %142, %130
  %146 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, ptr noundef @.str.4)
  br label %153

147:                                              ; preds = %142
  %148 = load i32, ptr %13, align 4, !tbaa !5
  %149 = load i32, ptr %16, align 4, !tbaa !5
  %150 = add nsw i32 %148, %149
  %151 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i32 noundef %150)
  %152 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %151, ptr noundef @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
  br label %153

153:                                              ; preds = %147, %145
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #5
  br label %154

154:                                              ; preds = %153
  %155 = load i32, ptr %3, align 4, !tbaa !5
  %156 = add nsw i32 %155, 1
  store i32 %156, ptr %3, align 4, !tbaa !5
  br label %18, !llvm.loop !17

157:                                              ; preds = %22
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #5
  %158 = load i32, ptr %1, align 4
  ret i32 %158
}

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

declare noundef nonnull align 8 dereferenceable(16) ptr @_ZStrsIcSt11char_traitsIcEERSt13basic_istreamIT_T0_ES6_RS3_(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 1 dereferenceable(1)) #3

; 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

declare noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8), i32 noundef) #3

; Function Attrs: mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef) #0 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_(ptr noundef nonnull align 8 dereferenceable(8)) #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 = { mustprogress norecurse uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { 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 = !{!10, !10, i64 0}
!10 = !{!"bool", !7, i64 0}
!11 = !{!7, !7, 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}


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

@n = external dso_local global i32, align 4
@m = external dso_local global i32, align 4
@a = external dso_local global [1001 x [1001 x i8]], align 16
@v = external dso_local local_unnamed_addr global [1001 x [1001 x i8]], 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 [7 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [12 x i8], align 1

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

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #2 {
  %1 = alloca i32, align 4
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %1) #6
  %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)
  %3 = load i32, ptr %1, align 4, !tbaa !5
  %.not108 = icmp slt i32 %3, 1
  br i1 %.not108, label %._crit_edge118, label %.lr.ph117

._crit_edge118:                                   ; preds = %58, %0
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #6
  ret i32 0

.lr.ph117:                                        ; preds = %0, %58
  %.0115 = phi i32 [ %59, %58 ], [ 1, %0 ]
  %.047114 = phi i32 [ %.1.lcssa, %58 ], [ undef, %0 ]
  %.048113 = phi i32 [ %.149.lcssa, %58 ], [ undef, %0 ]
  %.052112 = phi i32 [ %.153.lcssa, %58 ], [ undef, %0 ]
  %.056111 = phi i32 [ %.157.lcssa, %58 ], [ undef, %0 ]
  %.060110 = phi i32 [ %.161.lcssa, %58 ], [ undef, %0 ]
  %.064109 = phi i32 [ %.165.lcssa, %58 ], [ undef, %0 ]
  %4 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) @n)
  %5 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %4, ptr noundef nonnull align 4 dereferenceable(4) @m)
  %6 = load i32, ptr @n, align 4, !tbaa !5
  %7 = icmp sgt i32 %6, 0
  %8 = load i32, ptr @m, align 4
  %9 = icmp sgt i32 %8, 0
  %or.cond130 = select i1 %7, i1 %9, i1 false
  br i1 %or.cond130, label %.preheader71, label %._crit_edge91

.preheader71:                                     ; preds = %.lr.ph117, %._crit_edge
  %10 = phi i32 [ %29, %._crit_edge ], [ %6, %.lr.ph117 ]
  %11 = phi i32 [ %30, %._crit_edge ], [ %8, %.lr.ph117 ]
  %indvars.iv122 = phi i64 [ %indvars.iv.next123, %._crit_edge ], [ 0, %.lr.ph117 ]
  %.189 = phi i32 [ %.2.lcssa, %._crit_edge ], [ %.047114, %.lr.ph117 ]
  %.14988 = phi i32 [ %.250.lcssa, %._crit_edge ], [ %.048113, %.lr.ph117 ]
  %.15387 = phi i32 [ %.254.lcssa, %._crit_edge ], [ %.052112, %.lr.ph117 ]
  %.15786 = phi i32 [ %.258.lcssa, %._crit_edge ], [ %.056111, %.lr.ph117 ]
  %.16185 = phi i32 [ %.262.lcssa, %._crit_edge ], [ %.060110, %.lr.ph117 ]
  %.16584 = phi i32 [ %.266.lcssa, %._crit_edge ], [ %.064109, %.lr.ph117 ]
  %12 = icmp sgt i32 %11, 0
  br i1 %12, label %.lr.ph, label %._crit_edge

.lr.ph:                                           ; preds = %.preheader71
  %13 = trunc nuw nsw i64 %indvars.iv122 to i32
  br label %33

._crit_edge91:                                    ; preds = %._crit_edge, %.lr.ph117
  %.165.lcssa = phi i32 [ %.064109, %.lr.ph117 ], [ %.266.lcssa, %._crit_edge ]
  %.161.lcssa = phi i32 [ %.060110, %.lr.ph117 ], [ %.262.lcssa, %._crit_edge ]
  %.157.lcssa = phi i32 [ %.056111, %.lr.ph117 ], [ %.258.lcssa, %._crit_edge ]
  %.153.lcssa = phi i32 [ %.052112, %.lr.ph117 ], [ %.254.lcssa, %._crit_edge ]
  %.149.lcssa = phi i32 [ %.048113, %.lr.ph117 ], [ %.250.lcssa, %._crit_edge ]
  %.1.lcssa = phi i32 [ %.047114, %.lr.ph117 ], [ %.2.lcssa, %._crit_edge ]
  %14 = call noundef i32 @_Z1siiii(i32 noundef %.153.lcssa, i32 noundef %.157.lcssa, i32 noundef %.161.lcssa, i32 noundef %.165.lcssa)
  %15 = load i32, ptr @n, align 4, !tbaa !5
  %16 = icmp sgt i32 %15, 0
  br i1 %16, label %.preheader.lr.ph, label %._crit_edge107

.preheader.lr.ph:                                 ; preds = %._crit_edge91
  %17 = load i32, ptr @m, align 4, !tbaa !5
  %18 = icmp sgt i32 %17, 0
  br i1 %18, label %.preheader.us.preheader, label %._crit_edge107

.preheader.us.preheader:                          ; preds = %.preheader.lr.ph
  %19 = zext nneg i32 %17 to i64
  %wide.trip.count = zext nneg i32 %15 to i64
  %xtraiter = and i64 %wide.trip.count, 7
  %20 = icmp ult i32 %15, 8
  br i1 %20, label %._crit_edge107.loopexit.unr-lcssa, label %.preheader.us.preheader.new

.preheader.us.preheader.new:                      ; preds = %.preheader.us.preheader
  %unroll_iter = and i64 %wide.trip.count, 2147483640
  br label %.preheader.us

.preheader.us:                                    ; preds = %.preheader.us, %.preheader.us.preheader.new
  %indvar = phi i64 [ 0, %.preheader.us.preheader.new ], [ %indvar.next.7, %.preheader.us ]
  %niter = phi i64 [ 0, %.preheader.us.preheader.new ], [ %niter.next.7, %.preheader.us ]
  %21 = mul nuw nsw i64 %indvar, 1001
  %scevgep = getelementptr i8, ptr @v, i64 %21
  call void @llvm.memset.p0.i64(ptr align 8 %scevgep, i8 0, i64 %19, i1 false), !tbaa !9
  %22 = mul nuw i64 %indvar, 1001
  %gep = getelementptr i8, ptr getelementptr (i8, ptr @v, i64 1001), i64 %22
  call void @llvm.memset.p0.i64(ptr align 1 %gep, i8 0, i64 %19, i1 false), !tbaa !9
  %23 = mul nuw i64 %indvar, 1001
  %gep131 = getelementptr i8, ptr getelementptr (i8, ptr @v, i64 2002), i64 %23
  call void @llvm.memset.p0.i64(ptr align 2 %gep131, i8 0, i64 %19, i1 false), !tbaa !9
  %24 = mul nuw i64 %indvar, 1001
  %gep132 = getelementptr i8, ptr getelementptr (i8, ptr @v, i64 3003), i64 %24
  call void @llvm.memset.p0.i64(ptr align 1 %gep132, i8 0, i64 %19, i1 false), !tbaa !9
  %25 = mul nuw i64 %indvar, 1001
  %gep133 = getelementptr i8, ptr getelementptr (i8, ptr @v, i64 4004), i64 %25
  call void @llvm.memset.p0.i64(ptr align 4 %gep133, i8 0, i64 %19, i1 false), !tbaa !9
  %26 = mul nuw i64 %indvar, 1001
  %gep134 = getelementptr i8, ptr getelementptr (i8, ptr @v, i64 5005), i64 %26
  call void @llvm.memset.p0.i64(ptr align 1 %gep134, i8 0, i64 %19, i1 false), !tbaa !9
  %27 = mul nuw i64 %indvar, 1001
  %gep135 = getelementptr i8, ptr getelementptr (i8, ptr @v, i64 6006), i64 %27
  call void @llvm.memset.p0.i64(ptr align 2 %gep135, i8 0, i64 %19, i1 false), !tbaa !9
  %28 = mul nuw i64 %indvar, 1001
  %gep136 = getelementptr i8, ptr getelementptr (i8, ptr @v, i64 7007), i64 %28
  call void @llvm.memset.p0.i64(ptr align 1 %gep136, i8 0, i64 %19, i1 false), !tbaa !9
  %indvar.next.7 = add nuw nsw i64 %indvar, 8
  %niter.next.7 = add i64 %niter, 8
  %niter.ncmp.7 = icmp eq i64 %niter.next.7, %unroll_iter
  br i1 %niter.ncmp.7, label %._crit_edge107.loopexit.unr-lcssa, label %.preheader.us, !llvm.loop !11

._crit_edge.loopexit:                             ; preds = %41
  %.pre = load i32, ptr @n, align 4, !tbaa !5
  br label %._crit_edge

._crit_edge:                                      ; preds = %._crit_edge.loopexit, %.preheader71
  %29 = phi i32 [ %10, %.preheader71 ], [ %.pre, %._crit_edge.loopexit ]
  %30 = phi i32 [ %11, %.preheader71 ], [ %42, %._crit_edge.loopexit ]
  %.266.lcssa = phi i32 [ %.16584, %.preheader71 ], [ %.367, %._crit_edge.loopexit ]
  %.262.lcssa = phi i32 [ %.16185, %.preheader71 ], [ %.363, %._crit_edge.loopexit ]
  %.258.lcssa = phi i32 [ %.15786, %.preheader71 ], [ %.359, %._crit_edge.loopexit ]
  %.254.lcssa = phi i32 [ %.15387, %.preheader71 ], [ %.355, %._crit_edge.loopexit ]
  %.250.lcssa = phi i32 [ %.14988, %.preheader71 ], [ %.351, %._crit_edge.loopexit ]
  %.2.lcssa = phi i32 [ %.189, %.preheader71 ], [ %.3, %._crit_edge.loopexit ]
  %indvars.iv.next123 = add nuw nsw i64 %indvars.iv122, 1
  %31 = sext i32 %29 to i64
  %32 = icmp slt i64 %indvars.iv.next123, %31
  br i1 %32, label %.preheader71, label %._crit_edge91, !llvm.loop !13

33:                                               ; preds = %.lr.ph, %41
  %indvars.iv = phi i64 [ 0, %.lr.ph ], [ %indvars.iv.next, %41 ]
  %.277 = phi i32 [ %.189, %.lr.ph ], [ %.3, %41 ]
  %.25076 = phi i32 [ %.14988, %.lr.ph ], [ %.351, %41 ]
  %.25475 = phi i32 [ %.15387, %.lr.ph ], [ %.355, %41 ]
  %.25874 = phi i32 [ %.15786, %.lr.ph ], [ %.359, %41 ]
  %.26273 = phi i32 [ %.16185, %.lr.ph ], [ %.363, %41 ]
  %.26672 = phi i32 [ %.16584, %.lr.ph ], [ %.367, %41 ]
  %34 = getelementptr inbounds [1001 x [1001 x i8]], ptr @a, i64 0, i64 %indvars.iv122, i64 %indvars.iv
  %35 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZStrsIcSt11char_traitsIcEERSt13basic_istreamIT_T0_ES6_RS3_(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 1 dereferenceable(1) %34)
  %36 = getelementptr inbounds [1001 x [1001 x i8]], ptr @v, i64 0, i64 %indvars.iv122, i64 %indvars.iv
  store i8 0, ptr %36, align 1, !tbaa !9
  %37 = load i8, ptr %34, align 1, !tbaa !15
  %38 = trunc nuw nsw i64 %indvars.iv to i32
  switch i8 %37, label %.fold.split [
    i8 80, label %41
    i8 83, label %39
    i8 68, label %40
  ]

39:                                               ; preds = %33
  br label %41

40:                                               ; preds = %33
  br label %41

.fold.split:                                      ; preds = %33
  br label %41

41:                                               ; preds = %33, %.fold.split, %40, %39
  %.367 = phi i32 [ %.26672, %39 ], [ %.26672, %40 ], [ %38, %33 ], [ %.26672, %.fold.split ]
  %.363 = phi i32 [ %.26273, %39 ], [ %.26273, %40 ], [ %13, %33 ], [ %.26273, %.fold.split ]
  %.359 = phi i32 [ %38, %39 ], [ %.25874, %40 ], [ %.25874, %33 ], [ %.25874, %.fold.split ]
  %.355 = phi i32 [ %13, %39 ], [ %.25475, %40 ], [ %.25475, %33 ], [ %.25475, %.fold.split ]
  %.351 = phi i32 [ %.25076, %39 ], [ %38, %40 ], [ %.25076, %33 ], [ %.25076, %.fold.split ]
  %.3 = phi i32 [ %.277, %39 ], [ %13, %40 ], [ %.277, %33 ], [ %.277, %.fold.split ]
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %42 = load i32, ptr @m, align 4, !tbaa !5
  %43 = sext i32 %42 to i64
  %44 = icmp slt i64 %indvars.iv.next, %43
  br i1 %44, label %33, label %._crit_edge.loopexit, !llvm.loop !16

._crit_edge107.loopexit.unr-lcssa:                ; preds = %.preheader.us, %.preheader.us.preheader
  %indvar.unr = phi i64 [ 0, %.preheader.us.preheader ], [ %indvar.next.7, %.preheader.us ]
  %lcmp.mod.not = icmp eq i64 %xtraiter, 0
  br i1 %lcmp.mod.not, label %._crit_edge107, label %.preheader.us.epil

.preheader.us.epil:                               ; preds = %._crit_edge107.loopexit.unr-lcssa, %.preheader.us.epil
  %indvar.epil = phi i64 [ %indvar.next.epil, %.preheader.us.epil ], [ %indvar.unr, %._crit_edge107.loopexit.unr-lcssa ]
  %epil.iter = phi i64 [ %epil.iter.next, %.preheader.us.epil ], [ 0, %._crit_edge107.loopexit.unr-lcssa ]
  %45 = mul nuw nsw i64 %indvar.epil, 1001
  %scevgep.epil = getelementptr i8, ptr @v, i64 %45
  call void @llvm.memset.p0.i64(ptr align 1 %scevgep.epil, i8 0, i64 %19, i1 false), !tbaa !9
  %indvar.next.epil = add nuw nsw i64 %indvar.epil, 1
  %epil.iter.next = add i64 %epil.iter, 1
  %epil.iter.cmp.not = icmp eq i64 %epil.iter.next, %xtraiter
  br i1 %epil.iter.cmp.not, label %._crit_edge107, label %.preheader.us.epil, !llvm.loop !17

._crit_edge107:                                   ; preds = %._crit_edge107.loopexit.unr-lcssa, %.preheader.us.epil, %.preheader.lr.ph, %._crit_edge91
  %46 = call noundef i32 @_Z1siiii(i32 noundef %.161.lcssa, i32 noundef %.165.lcssa, i32 noundef %.1.lcssa, i32 noundef %.149.lcssa)
  %47 = 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)
  %48 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) %47, i32 noundef %.0115)
  %49 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) %48, ptr noundef nonnull @.str.3)
  %50 = icmp ne i32 %14, 0
  %51 = icmp ne i32 %46, 0
  %or.cond = and i1 %50, %51
  br i1 %or.cond, label %54, label %52

52:                                               ; preds = %._crit_edge107
  %53 = 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.4)
  br label %58

54:                                               ; preds = %._crit_edge107
  %55 = add nsw i32 %46, %14
  %56 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i32 noundef %55)
  %57 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %56, ptr noundef nonnull @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
  br label %58

58:                                               ; preds = %54, %52
  %59 = add nuw nsw i32 %.0115, 1
  %60 = load i32, ptr %1, align 4, !tbaa !5
  %.not.not = icmp slt i32 %.0115, %60
  br i1 %.not.not, label %.lr.ph117, label %._crit_edge118, !llvm.loop !19
}

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 #3

declare noundef nonnull align 8 dereferenceable(16) ptr @_ZStrsIcSt11char_traitsIcEERSt13basic_istreamIT_T0_ES6_RS3_(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 1 dereferenceable(1)) local_unnamed_addr #3

; 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

declare noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8), i32 noundef) local_unnamed_addr #3

; Function Attrs: mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef) local_unnamed_addr #0 align 2

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

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

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 = { mustprogress norecurse uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { 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 = { nocallback nofree nounwind willreturn memory(argmem: write) }
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, !10, i64 0}
!10 = !{!"bool", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = distinct !{!13, !12, !14}
!14 = !{!"llvm.loop.unswitch.partial.disable"}
!15 = !{!7, !7, i64 0}
!16 = distinct !{!16, !12}
!17 = distinct !{!17, !18}
!18 = !{!"llvm.loop.unroll.disable"}
!19 = distinct !{!19, !12}


; Effective O3 passes: EarlyCSEPass,GVNPass,GlobalOptPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LICMPass,LoopIdiomRecognizePass,LoopInstSimplifyPass,LoopRotatePass,LoopSimplifyCFGPass,LoopSimplifyPass,LoopUnrollPass,ReassociatePass,SROAPass,SimpleLoopUnswitchPass,SimplifyCFGPass