; LLVM IR from eyangch/competitive-programming :: Codeforces/1481 (d)

; 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::__cxx11::basic_string" = type { %"struct.std::__cxx11::basic_string<char>::_Alloc_hider", i64, %union.anon }
%"struct.std::__cxx11::basic_string<char>::_Alloc_hider" = type { ptr }
%union.anon = type { i64, [8 x i8] }
%"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" }

@T = external dso_local global i32, align 4
@N = external dso_local global i32, align 4
@M = external dso_local global i32, align 4
@_Z1sB5cxx11 = external dso_local global [1000 x %"class.std::__cxx11::basic_string"], 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.2 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [3 x i8], align 1

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() #0 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  %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
  %17 = alloca i32, align 4
  store i32 0, ptr %1, align 4
  %18 = call noundef zeroext i1 @_ZNSt8ios_base15sync_with_stdioEb(i1 noundef zeroext false)
  %19 = load ptr, ptr @_ZSt3cin, align 8, !tbaa !5
  %20 = getelementptr i8, ptr %19, i64 -24
  %21 = load i64, ptr %20, align 8
  %22 = getelementptr inbounds i8, ptr @_ZSt3cin, i64 %21
  %23 = call noundef ptr @_ZNSt9basic_iosIcSt11char_traitsIcEE3tieEPSo(ptr noundef nonnull align 8 dereferenceable(264) %22, ptr noundef null)
  %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) @T)
  br label %25

25:                                               ; preds = %280, %0
  %26 = load i32, ptr @T, align 4, !tbaa !8
  %27 = add nsw i32 %26, -1
  store i32 %27, ptr @T, align 4, !tbaa !8
  %28 = icmp ne i32 %26, 0
  br i1 %28, label %29, label %281

29:                                               ; preds = %25
  %30 = 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)
  %31 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %30, ptr noundef nonnull align 4 dereferenceable(4) @M)
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #5
  store i32 0, ptr %2, align 4, !tbaa !8
  br label %32

32:                                               ; preds = %42, %29
  %33 = load i32, ptr %2, align 4, !tbaa !8
  %34 = load i32, ptr @N, align 4, !tbaa !8
  %35 = icmp slt i32 %33, %34
  br i1 %35, label %37, label %36

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

37:                                               ; preds = %32
  %38 = load i32, ptr %2, align 4, !tbaa !8
  %39 = sext i32 %38 to i64
  %40 = getelementptr inbounds [1000 x %"class.std::__cxx11::basic_string"], ptr @_Z1sB5cxx11, i64 0, i64 %39
  %41 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZStrsIcSt11char_traitsIcESaIcEERSt13basic_istreamIT_T0_ES7_RNSt7__cxx1112basic_stringIS4_S5_T1_EE(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(32) %40)
  br label %42

42:                                               ; preds = %37
  %43 = load i32, ptr %2, align 4, !tbaa !8
  %44 = add nsw i32 %43, 1
  store i32 %44, ptr %2, align 4, !tbaa !8
  br label %32, !llvm.loop !11

45:                                               ; preds = %36
  %46 = load i32, ptr @M, align 4, !tbaa !8
  %47 = srem i32 %46, 2
  %48 = icmp ne i32 %47, 0
  br i1 %48, label %49, label %68

49:                                               ; preds = %45
  %50 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, ptr noundef @.str)
  %51 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) %50, ptr noundef @.str.2)
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #5
  store i32 0, ptr %3, align 4, !tbaa !8
  br label %52

52:                                               ; preds = %63, %49
  %53 = load i32, ptr %3, align 4, !tbaa !8
  %54 = load i32, ptr @M, align 4, !tbaa !8
  %55 = icmp sle i32 %53, %54
  br i1 %55, label %57, label %56

56:                                               ; preds = %52
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #5
  br label %66

57:                                               ; preds = %52
  %58 = load i32, ptr %3, align 4, !tbaa !8
  %59 = srem i32 %58, 2
  %60 = add nsw i32 %59, 1
  %61 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i32 noundef %60)
  %62 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) %61, ptr noundef @.str.3)
  br label %63

63:                                               ; preds = %57
  %64 = load i32, ptr %3, align 4, !tbaa !8
  %65 = add nsw i32 %64, 1
  store i32 %65, ptr %3, align 4, !tbaa !8
  br label %52, !llvm.loop !13

66:                                               ; preds = %56
  %67 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, ptr noundef @.str.2)
  br label %280

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

69:                                               ; preds = %108, %68
  %70 = load i32, ptr %6, align 4, !tbaa !8
  %71 = load i32, ptr @N, align 4, !tbaa !8
  %72 = icmp slt i32 %70, %71
  br i1 %72, label %74, label %73

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

74:                                               ; preds = %69
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #5
  %75 = load i32, ptr %6, align 4, !tbaa !8
  %76 = add nsw i32 %75, 1
  store i32 %76, ptr %8, align 4, !tbaa !8
  br label %77

77:                                               ; preds = %104, %74
  %78 = load i32, ptr %8, align 4, !tbaa !8
  %79 = load i32, ptr @N, align 4, !tbaa !8
  %80 = icmp slt i32 %78, %79
  br i1 %80, label %82, label %81

81:                                               ; preds = %77
  store i32 13, ptr %7, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #5
  br label %107

82:                                               ; preds = %77
  %83 = load i32, ptr %6, align 4, !tbaa !8
  %84 = sext i32 %83 to i64
  %85 = getelementptr inbounds [1000 x %"class.std::__cxx11::basic_string"], ptr @_Z1sB5cxx11, i64 0, i64 %84
  %86 = load i32, ptr %8, align 4, !tbaa !8
  %87 = sext i32 %86 to i64
  %88 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) %85, i64 noundef %87)
  %89 = load i8, ptr %88, align 1, !tbaa !14
  %90 = sext i8 %89 to i32
  %91 = load i32, ptr %8, align 4, !tbaa !8
  %92 = sext i32 %91 to i64
  %93 = getelementptr inbounds [1000 x %"class.std::__cxx11::basic_string"], ptr @_Z1sB5cxx11, i64 0, i64 %92
  %94 = load i32, ptr %6, align 4, !tbaa !8
  %95 = sext i32 %94 to i64
  %96 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) %93, i64 noundef %95)
  %97 = load i8, ptr %96, align 1, !tbaa !14
  %98 = sext i8 %97 to i32
  %99 = icmp eq i32 %90, %98
  br i1 %99, label %100, label %103

100:                                              ; preds = %82
  %101 = load i32, ptr %6, align 4, !tbaa !8
  store i32 %101, ptr %4, align 4, !tbaa !8
  %102 = load i32, ptr %8, align 4, !tbaa !8
  store i32 %102, ptr %5, align 4, !tbaa !8
  br label %103

103:                                              ; preds = %100, %82
  br label %104

104:                                              ; preds = %103
  %105 = load i32, ptr %8, align 4, !tbaa !8
  %106 = add nsw i32 %105, 1
  store i32 %106, ptr %8, align 4, !tbaa !8
  br label %77, !llvm.loop !15

107:                                              ; preds = %81
  br label %108

108:                                              ; preds = %107
  %109 = load i32, ptr %6, align 4, !tbaa !8
  %110 = add nsw i32 %109, 1
  store i32 %110, ptr %6, align 4, !tbaa !8
  br label %69, !llvm.loop !16

111:                                              ; preds = %73
  %112 = load i32, ptr %4, align 4, !tbaa !8
  %113 = icmp sgt i32 %112, -1
  br i1 %113, label %114, label %140

114:                                              ; preds = %111
  %115 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, ptr noundef @.str)
  %116 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) %115, ptr noundef @.str.2)
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #5
  store i32 0, ptr %9, align 4, !tbaa !8
  br label %117

117:                                              ; preds = %135, %114
  %118 = load i32, ptr %9, align 4, !tbaa !8
  %119 = load i32, ptr @M, align 4, !tbaa !8
  %120 = icmp sle i32 %118, %119
  br i1 %120, label %122, label %121

121:                                              ; preds = %117
  store i32 16, ptr %7, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #5
  br label %138

122:                                              ; preds = %117
  %123 = load i32, ptr %9, align 4, !tbaa !8
  %124 = srem i32 %123, 2
  %125 = icmp ne i32 %124, 0
  br i1 %125, label %126, label %128

126:                                              ; preds = %122
  %127 = load i32, ptr %4, align 4, !tbaa !8
  br label %130

128:                                              ; preds = %122
  %129 = load i32, ptr %5, align 4, !tbaa !8
  br label %130

130:                                              ; preds = %128, %126
  %131 = phi i32 [ %127, %126 ], [ %129, %128 ]
  %132 = add nsw i32 %131, 1
  %133 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i32 noundef %132)
  %134 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) %133, ptr noundef @.str.3)
  br label %135

135:                                              ; preds = %130
  %136 = load i32, ptr %9, align 4, !tbaa !8
  %137 = add nsw i32 %136, 1
  store i32 %137, ptr %9, align 4, !tbaa !8
  br label %117, !llvm.loop !17

138:                                              ; preds = %121
  %139 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, ptr noundef @.str.2)
  br label %279

140:                                              ; preds = %111
  %141 = load i32, ptr @N, align 4, !tbaa !8
  %142 = icmp slt i32 %141, 3
  br i1 %142, label %143, label %146

143:                                              ; preds = %140
  %144 = 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)
  %145 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) %144, ptr noundef @.str.2)
  br label %278

146:                                              ; preds = %140
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #5
  store i32 -1, ptr %10, align 4, !tbaa !8
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #5
  store i32 -1, ptr %11, align 4, !tbaa !8
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #5
  store i32 -1, ptr %12, align 4, !tbaa !8
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #5
  store i32 0, ptr %13, align 4, !tbaa !8
  br label %147

147:                                              ; preds = %205, %146
  %148 = load i32, ptr %13, align 4, !tbaa !8
  %149 = icmp slt i32 %148, 3
  br i1 %149, label %151, label %150

150:                                              ; preds = %147
  store i32 19, ptr %7, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #5
  br label %208

151:                                              ; preds = %147
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #5
  store i32 0, ptr %14, align 4, !tbaa !8
  br label %152

152:                                              ; preds = %201, %151
  %153 = load i32, ptr %14, align 4, !tbaa !8
  %154 = icmp slt i32 %153, 3
  br i1 %154, label %156, label %155

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

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

157:                                              ; preds = %197, %156
  %158 = load i32, ptr %15, align 4, !tbaa !8
  %159 = icmp slt i32 %158, 3
  br i1 %159, label %161, label %160

160:                                              ; preds = %157
  store i32 25, ptr %7, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #5
  br label %200

161:                                              ; preds = %157
  %162 = load i32, ptr %15, align 4, !tbaa !8
  %163 = load i32, ptr %14, align 4, !tbaa !8
  %164 = icmp eq i32 %162, %163
  br i1 %164, label %173, label %165

165:                                              ; preds = %161
  %166 = load i32, ptr %15, align 4, !tbaa !8
  %167 = load i32, ptr %13, align 4, !tbaa !8
  %168 = icmp eq i32 %166, %167
  br i1 %168, label %173, label %169

169:                                              ; preds = %165
  %170 = load i32, ptr %14, align 4, !tbaa !8
  %171 = load i32, ptr %13, align 4, !tbaa !8
  %172 = icmp eq i32 %170, %171
  br i1 %172, label %173, label %174

173:                                              ; preds = %169, %165, %161
  br label %197

174:                                              ; preds = %169
  %175 = load i32, ptr %13, align 4, !tbaa !8
  %176 = sext i32 %175 to i64
  %177 = getelementptr inbounds [1000 x %"class.std::__cxx11::basic_string"], ptr @_Z1sB5cxx11, i64 0, i64 %176
  %178 = load i32, ptr %14, align 4, !tbaa !8
  %179 = sext i32 %178 to i64
  %180 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) %177, i64 noundef %179)
  %181 = load i8, ptr %180, align 1, !tbaa !14
  %182 = sext i8 %181 to i32
  %183 = load i32, ptr %14, align 4, !tbaa !8
  %184 = sext i32 %183 to i64
  %185 = getelementptr inbounds [1000 x %"class.std::__cxx11::basic_string"], ptr @_Z1sB5cxx11, i64 0, i64 %184
  %186 = load i32, ptr %15, align 4, !tbaa !8
  %187 = sext i32 %186 to i64
  %188 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) %185, i64 noundef %187)
  %189 = load i8, ptr %188, align 1, !tbaa !14
  %190 = sext i8 %189 to i32
  %191 = icmp eq i32 %182, %190
  br i1 %191, label %192, label %196

192:                                              ; preds = %174
  %193 = load i32, ptr %13, align 4, !tbaa !8
  store i32 %193, ptr %10, align 4, !tbaa !8
  %194 = load i32, ptr %14, align 4, !tbaa !8
  store i32 %194, ptr %11, align 4, !tbaa !8
  %195 = load i32, ptr %15, align 4, !tbaa !8
  store i32 %195, ptr %12, align 4, !tbaa !8
  br label %196

196:                                              ; preds = %192, %174
  br label %197

197:                                              ; preds = %196, %173
  %198 = load i32, ptr %15, align 4, !tbaa !8
  %199 = add nsw i32 %198, 1
  store i32 %199, ptr %15, align 4, !tbaa !8
  br label %157, !llvm.loop !18

200:                                              ; preds = %160
  br label %201

201:                                              ; preds = %200
  %202 = load i32, ptr %14, align 4, !tbaa !8
  %203 = add nsw i32 %202, 1
  store i32 %203, ptr %14, align 4, !tbaa !8
  br label %152, !llvm.loop !19

204:                                              ; preds = %155
  br label %205

205:                                              ; preds = %204
  %206 = load i32, ptr %13, align 4, !tbaa !8
  %207 = add nsw i32 %206, 1
  store i32 %207, ptr %13, align 4, !tbaa !8
  br label %147, !llvm.loop !20

208:                                              ; preds = %150
  %209 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, ptr noundef @.str)
  %210 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) %209, ptr noundef @.str.2)
  %211 = load i32, ptr @M, align 4, !tbaa !8
  %212 = srem i32 %211, 4
  %213 = icmp ne i32 %212, 0
  br i1 %213, label %214, label %245

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

215:                                              ; preds = %241, %214
  %216 = load i32, ptr %16, align 4, !tbaa !8
  %217 = load i32, ptr @M, align 4, !tbaa !8
  %218 = icmp sle i32 %216, %217
  br i1 %218, label %220, label %219

219:                                              ; preds = %215
  store i32 28, ptr %7, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #5
  br label %244

220:                                              ; preds = %215
  %221 = load i32, ptr %16, align 4, !tbaa !8
  %222 = srem i32 %221, 2
  %223 = icmp ne i32 %222, 0
  br i1 %223, label %224, label %226

224:                                              ; preds = %220
  %225 = load i32, ptr %11, align 4, !tbaa !8
  br label %236

226:                                              ; preds = %220
  %227 = load i32, ptr %16, align 4, !tbaa !8
  %228 = srem i32 %227, 4
  %229 = icmp ne i32 %228, 0
  br i1 %229, label %230, label %232

230:                                              ; preds = %226
  %231 = load i32, ptr %12, align 4, !tbaa !8
  br label %234

232:                                              ; preds = %226
  %233 = load i32, ptr %10, align 4, !tbaa !8
  br label %234

234:                                              ; preds = %232, %230
  %235 = phi i32 [ %231, %230 ], [ %233, %232 ]
  br label %236

236:                                              ; preds = %234, %224
  %237 = phi i32 [ %225, %224 ], [ %235, %234 ]
  %238 = add nsw i32 %237, 1
  %239 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i32 noundef %238)
  %240 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) %239, ptr noundef @.str.3)
  br label %241

241:                                              ; preds = %236
  %242 = load i32, ptr %16, align 4, !tbaa !8
  %243 = add nsw i32 %242, 1
  store i32 %243, ptr %16, align 4, !tbaa !8
  br label %215, !llvm.loop !21

244:                                              ; preds = %219
  br label %276

245:                                              ; preds = %208
  call void @llvm.lifetime.start.p0(i64 4, ptr %17) #5
  store i32 0, ptr %17, align 4, !tbaa !8
  br label %246

246:                                              ; preds = %272, %245
  %247 = load i32, ptr %17, align 4, !tbaa !8
  %248 = load i32, ptr @M, align 4, !tbaa !8
  %249 = icmp sle i32 %247, %248
  br i1 %249, label %251, label %250

250:                                              ; preds = %246
  store i32 31, ptr %7, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #5
  br label %275

251:                                              ; preds = %246
  %252 = load i32, ptr %17, align 4, !tbaa !8
  %253 = srem i32 %252, 2
  %254 = icmp ne i32 %253, 0
  br i1 %254, label %255, label %265

255:                                              ; preds = %251
  %256 = load i32, ptr %17, align 4, !tbaa !8
  %257 = srem i32 %256, 4
  %258 = icmp eq i32 %257, 1
  br i1 %258, label %259, label %261

259:                                              ; preds = %255
  %260 = load i32, ptr %12, align 4, !tbaa !8
  br label %263

261:                                              ; preds = %255
  %262 = load i32, ptr %10, align 4, !tbaa !8
  br label %263

263:                                              ; preds = %261, %259
  %264 = phi i32 [ %260, %259 ], [ %262, %261 ]
  br label %267

265:                                              ; preds = %251
  %266 = load i32, ptr %11, align 4, !tbaa !8
  br label %267

267:                                              ; preds = %265, %263
  %268 = phi i32 [ %264, %263 ], [ %266, %265 ]
  %269 = add nsw i32 %268, 1
  %270 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i32 noundef %269)
  %271 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) %270, ptr noundef @.str.3)
  br label %272

272:                                              ; preds = %267
  %273 = load i32, ptr %17, align 4, !tbaa !8
  %274 = add nsw i32 %273, 1
  store i32 %274, ptr %17, align 4, !tbaa !8
  br label %246, !llvm.loop !22

275:                                              ; preds = %250
  br label %276

276:                                              ; preds = %275, %244
  %277 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, ptr noundef @.str.2)
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #5
  br label %278

278:                                              ; preds = %276, %143
  br label %279

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

280:                                              ; preds = %279, %66
  br label %25, !llvm.loop !23

281:                                              ; preds = %25
  %282 = load i32, ptr %1, align 4
  ret i32 %282
}

declare noundef zeroext i1 @_ZNSt8ios_base15sync_with_stdioEb(i1 noundef zeroext) #1

; Function Attrs: mustprogress nounwind uwtable
declare noundef ptr @_ZNSt9basic_iosIcSt11char_traitsIcEE3tieEPSo(ptr noundef nonnull align 8 dereferenceable(264), ptr noundef) #2 align 2

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

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

declare noundef nonnull align 8 dereferenceable(16) ptr @_ZStrsIcSt11char_traitsIcESaIcEERSt13basic_istreamIT_T0_ES7_RNSt7__cxx1112basic_stringIS4_S5_T1_EE(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 8 dereferenceable(32)) #1

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

; Function Attrs: mustprogress nounwind uwtable
declare noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32), i64 noundef) #2 align 2

attributes #0 = { mustprogress norecurse uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { 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 #3 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = !{!"vtable pointer", !7, i64 0}
!7 = !{!"Simple C++ TBAA"}
!8 = !{!9, !9, i64 0}
!9 = !{!"int", !10, i64 0}
!10 = !{!"omnipotent char", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = distinct !{!13, !12}
!14 = !{!10, !10, i64 0}
!15 = distinct !{!15, !12}
!16 = distinct !{!16, !12}
!17 = distinct !{!17, !12}
!18 = distinct !{!18, !12}
!19 = distinct !{!19, !12}
!20 = distinct !{!20, !12}
!21 = distinct !{!21, !12}
!22 = distinct !{!22, !12}
!23 = distinct !{!23, !12}


; 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::__cxx11::basic_string" = type { %"struct.std::__cxx11::basic_string<char>::_Alloc_hider", i64, %union.anon }
%"struct.std::__cxx11::basic_string<char>::_Alloc_hider" = type { ptr }
%union.anon = type { i64, [8 x i8] }
%"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" }

@T = external dso_local global i32, align 4
@N = external dso_local global i32, align 4
@M = external dso_local global i32, align 4
@_Z1sB5cxx11 = external dso_local global [1000 x %"class.std::__cxx11::basic_string"], 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.2 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [3 x i8], align 1

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #0 {
  %1 = tail call noundef zeroext i1 @_ZNSt8ios_base15sync_with_stdioEb(i1 noundef zeroext false)
  %2 = load ptr, ptr @_ZSt3cin, align 8, !tbaa !5
  %3 = getelementptr i8, ptr %2, i64 -24
  %4 = load i64, ptr %3, align 8
  %5 = getelementptr inbounds i8, ptr @_ZSt3cin, i64 %4
  %6 = tail call noundef ptr @_ZNSt9basic_iosIcSt11char_traitsIcEE3tieEPSo(ptr noundef nonnull align 8 dereferenceable(264) %5, ptr noundef null)
  %7 = tail call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) @T)
  %8 = load i32, ptr @T, align 4, !tbaa !8
  %9 = add nsw i32 %8, -1
  store i32 %9, ptr @T, align 4, !tbaa !8
  %.not147 = icmp eq i32 %8, 0
  br i1 %.not147, label %._crit_edge150, label %.lr.ph149

.lr.ph149:                                        ; preds = %0, %._crit_edge106
  %10 = tail 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)
  %11 = tail call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %10, ptr noundef nonnull align 4 dereferenceable(4) @M)
  %12 = load i32, ptr @N, align 4, !tbaa !8
  %13 = icmp sgt i32 %12, 0
  br i1 %13, label %.lr.ph, label %._crit_edge

._crit_edge:                                      ; preds = %.lr.ph, %.lr.ph149
  %.pr = phi i32 [ %12, %.lr.ph149 ], [ %18, %.lr.ph ]
  %14 = load i32, ptr @M, align 4, !tbaa !8
  %15 = and i32 %14, 1
  %.not82 = icmp eq i32 %15, 0
  br i1 %.not82, label %thread-pre-split, label %21

.lr.ph:                                           ; preds = %.lr.ph149, %.lr.ph
  %indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph ], [ 0, %.lr.ph149 ]
  %16 = getelementptr inbounds [1000 x %"class.std::__cxx11::basic_string"], ptr @_Z1sB5cxx11, i64 0, i64 %indvars.iv
  %17 = tail call noundef nonnull align 8 dereferenceable(16) ptr @_ZStrsIcSt11char_traitsIcESaIcEERSt13basic_istreamIT_T0_ES7_RNSt7__cxx1112basic_stringIS4_S5_T1_EE(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(32) %16)
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %18 = load i32, ptr @N, align 4, !tbaa !8
  %19 = sext i32 %18 to i64
  %20 = icmp slt i64 %indvars.iv.next, %19
  br i1 %20, label %.lr.ph, label %._crit_edge, !llvm.loop !11

21:                                               ; preds = %._crit_edge
  %22 = tail 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)
  %23 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) %22, ptr noundef nonnull @.str.2)
  %24 = load i32, ptr @M, align 4, !tbaa !8
  %.not91102 = icmp slt i32 %24, 0
  br i1 %.not91102, label %._crit_edge106, label %.lr.ph105

.lr.ph105:                                        ; preds = %21, %.lr.ph105
  %.079103 = phi i32 [ %29, %.lr.ph105 ], [ 0, %21 ]
  %25 = and i32 %.079103, 1
  %26 = add nuw nsw i32 %25, 1
  %27 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i32 noundef %26)
  %28 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) %27, ptr noundef nonnull @.str.3)
  %29 = add nuw nsw i32 %.079103, 1
  %30 = load i32, ptr @M, align 4, !tbaa !8
  %.not91.not = icmp slt i32 %.079103, %30
  br i1 %.not91.not, label %.lr.ph105, label %._crit_edge106, !llvm.loop !13

thread-pre-split:                                 ; preds = %._crit_edge
  %31 = icmp sgt i32 %.pr, 0
  br i1 %31, label %.lr.ph117, label %.thread

.loopexit.loopexit:                               ; preds = %40
  %.pre = sext i32 %48 to i64
  br label %.loopexit

.loopexit:                                        ; preds = %.loopexit.loopexit, %.lr.ph117
  %.pre-phi = phi i64 [ %.pre, %.loopexit.loopexit ], [ %36, %.lr.ph117 ]
  %32 = phi i32 [ %48, %.loopexit.loopexit ], [ %35, %.lr.ph117 ]
  %.177.lcssa = phi i32 [ %spec.select, %.loopexit.loopexit ], [ %.076114, %.lr.ph117 ]
  %.174.lcssa = phi i32 [ %spec.select92, %.loopexit.loopexit ], [ %.073115, %.lr.ph117 ]
  %33 = icmp slt i64 %indvars.iv.next161, %.pre-phi
  %indvars.iv.next156 = add nuw nsw i64 %indvars.iv155, 1
  br i1 %33, label %.lr.ph117, label %._crit_edge118, !llvm.loop !14

._crit_edge118:                                   ; preds = %.loopexit
  %34 = icmp sgt i32 %.177.lcssa, -1
  br i1 %34, label %51, label %62

.lr.ph117:                                        ; preds = %thread-pre-split, %.loopexit
  %35 = phi i32 [ %32, %.loopexit ], [ %.pr, %thread-pre-split ]
  %indvars.iv160 = phi i64 [ %indvars.iv.next161, %.loopexit ], [ 0, %thread-pre-split ]
  %indvars.iv155 = phi i64 [ %indvars.iv.next156, %.loopexit ], [ 1, %thread-pre-split ]
  %.073115 = phi i32 [ %.174.lcssa, %.loopexit ], [ -1, %thread-pre-split ]
  %.076114 = phi i32 [ %.177.lcssa, %.loopexit ], [ -1, %thread-pre-split ]
  %indvars.iv.next161 = add nuw nsw i64 %indvars.iv160, 1
  %36 = sext i32 %35 to i64
  %37 = icmp slt i64 %indvars.iv.next161, %36
  br i1 %37, label %.lr.ph111, label %.loopexit

.lr.ph111:                                        ; preds = %.lr.ph117
  %38 = getelementptr inbounds [1000 x %"class.std::__cxx11::basic_string"], ptr @_Z1sB5cxx11, i64 0, i64 %indvars.iv160
  %39 = trunc nuw nsw i64 %indvars.iv160 to i32
  br label %40

40:                                               ; preds = %.lr.ph111, %40
  %indvars.iv157 = phi i64 [ %indvars.iv155, %.lr.ph111 ], [ %indvars.iv.next158, %40 ]
  %.174108 = phi i32 [ %.073115, %.lr.ph111 ], [ %spec.select92, %40 ]
  %.177107 = phi i32 [ %.076114, %.lr.ph111 ], [ %spec.select, %40 ]
  %41 = tail call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) %38, i64 noundef %indvars.iv157)
  %42 = load i8, ptr %41, align 1, !tbaa !15
  %43 = getelementptr inbounds [1000 x %"class.std::__cxx11::basic_string"], ptr @_Z1sB5cxx11, i64 0, i64 %indvars.iv157
  %44 = tail call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) %43, i64 noundef %indvars.iv160)
  %45 = load i8, ptr %44, align 1, !tbaa !15
  %46 = icmp eq i8 %42, %45
  %spec.select = select i1 %46, i32 %39, i32 %.177107
  %47 = trunc nuw nsw i64 %indvars.iv157 to i32
  %spec.select92 = select i1 %46, i32 %47, i32 %.174108
  %indvars.iv.next158 = add nuw nsw i64 %indvars.iv157, 1
  %48 = load i32, ptr @N, align 4, !tbaa !8
  %49 = trunc nuw i64 %indvars.iv.next158 to i32
  %50 = icmp sgt i32 %48, %49
  br i1 %50, label %40, label %.loopexit.loopexit, !llvm.loop !16

51:                                               ; preds = %._crit_edge118
  %52 = tail 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)
  %53 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) %52, ptr noundef nonnull @.str.2)
  %54 = load i32, ptr @M, align 4, !tbaa !8
  %.not89142 = icmp slt i32 %54, 0
  br i1 %.not89142, label %._crit_edge106, label %.lr.ph145

.lr.ph145:                                        ; preds = %51, %.lr.ph145
  %.070143 = phi i32 [ %60, %.lr.ph145 ], [ 0, %51 ]
  %55 = and i32 %.070143, 1
  %.not90 = icmp eq i32 %55, 0
  %56 = select i1 %.not90, i32 %.174.lcssa, i32 %.177.lcssa
  %57 = add nsw i32 %56, 1
  %58 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i32 noundef %57)
  %59 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) %58, ptr noundef nonnull @.str.3)
  %60 = add nuw nsw i32 %.070143, 1
  %61 = load i32, ptr @M, align 4, !tbaa !8
  %.not89.not = icmp slt i32 %.070143, %61
  br i1 %.not89.not, label %.lr.ph145, label %._crit_edge106, !llvm.loop !17

62:                                               ; preds = %._crit_edge118
  %63 = icmp slt i32 %32, 3
  br i1 %63, label %.thread, label %.preheader.split.2.1.peel

.preheader.split.2.1.peel:                        ; preds = %62
  %64 = tail call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) @_Z1sB5cxx11, i64 noundef 1)
  %65 = load i8, ptr %64, align 1, !tbaa !15
  %66 = tail call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) getelementptr inbounds (i8, ptr @_Z1sB5cxx11, i64 32), i64 noundef 2)
  %67 = load i8, ptr %66, align 1, !tbaa !15
  %68 = icmp ne i8 %65, %67
  %.365.2.1.peel = select i1 %68, i32 -1, i32 1
  %.3.2.1.peel = select i1 %68, i32 -1, i32 2
  %69 = tail call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) @_Z1sB5cxx11, i64 noundef 2)
  %70 = load i8, ptr %69, align 1, !tbaa !15
  %71 = tail call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) getelementptr inbounds (i8, ptr @_Z1sB5cxx11, i64 64), i64 noundef 1)
  %72 = load i8, ptr %71, align 1, !tbaa !15
  %73 = icmp ne i8 %70, %72
  %narrow = select i1 %73, i1 %68, i1 false
  %.369.1.2.peel = sext i1 %narrow to i32
  %.365.1.2.peel = select i1 %73, i32 %.365.2.1.peel, i32 2
  %.3.1.2.peel = select i1 %73, i32 %.3.2.1.peel, i32 1
  br label %.preheader.split.1

.thread:                                          ; preds = %thread-pre-split, %62
  %74 = tail 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 %._crit_edge106

.loopexit183:                                     ; preds = %.preheader.split.preheader.1
  %75 = tail 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)
  %76 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) %75, ptr noundef nonnull @.str.2)
  %77 = load i32, ptr @M, align 4, !tbaa !8
  %78 = and i32 %77, 3
  %.not83 = icmp eq i32 %78, 0
  %.not84139 = icmp slt i32 %77, 0
  br i1 %.not83, label %.preheader95, label %.preheader97

.preheader97:                                     ; preds = %.loopexit183
  br i1 %.not84139, label %._crit_edge106, label %.lr.ph138

.preheader95:                                     ; preds = %.loopexit183
  br i1 %.not84139, label %._crit_edge106, label %.lr.ph141

.preheader.split.preheader.1:                     ; preds = %.preheader.split.2, %.preheader.split.2.thread
  %.3.2195 = phi i32 [ %.3.2, %.preheader.split.2.thread ], [ %.3.1, %.preheader.split.2 ]
  %.365.2194 = phi i32 [ %.365.2, %.preheader.split.2.thread ], [ %.365.1, %.preheader.split.2 ]
  %.369.2193 = phi i32 [ %.369.2, %.preheader.split.2.thread ], [ %.369.1, %.preheader.split.2 ]
  %79 = tail call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) %108, i64 noundef 1)
  %80 = load i8, ptr %79, align 1, !tbaa !15
  %81 = tail call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) getelementptr inbounds (i8, ptr @_Z1sB5cxx11, i64 32), i64 noundef 0)
  %82 = load i8, ptr %81, align 1, !tbaa !15
  %83 = icmp eq i8 %80, %82
  %84 = trunc nuw nsw i64 %indvars.iv179 to i32
  %.369.1171 = select i1 %83, i32 %84, i32 %.369.2193
  %.365.1172 = select i1 %83, i32 1, i32 %.365.2194
  %.3.1173 = select i1 %83, i32 0, i32 %.3.2195
  %85 = icmp eq i64 %indvars.iv179, 2
  br i1 %85, label %.loopexit183, label %86

86:                                               ; preds = %.preheader.split.preheader.1
  %87 = tail call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) %108, i64 noundef 1)
  %88 = load i8, ptr %87, align 1, !tbaa !15
  %89 = tail call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) getelementptr inbounds (i8, ptr @_Z1sB5cxx11, i64 32), i64 noundef 2)
  %90 = load i8, ptr %89, align 1, !tbaa !15
  %91 = icmp eq i8 %88, %90
  br i1 %91, label %92, label %.preheader.split.preheader.2

92:                                               ; preds = %86
  %93 = trunc nuw nsw i64 %indvars.iv179 to i32
  br label %.preheader.split.preheader.2

.preheader.split.preheader.2:                     ; preds = %92, %86, %.preheader.split.2.thread
  %.ph = phi i1 [ true, %.preheader.split.2.thread ], [ false, %86 ], [ false, %92 ]
  %.us-phi.1.ph = phi i32 [ %.369.2, %.preheader.split.2.thread ], [ %.369.1171, %86 ], [ %93, %92 ]
  %.us-phi126.1.ph = phi i32 [ %.365.2, %.preheader.split.2.thread ], [ %.365.1172, %86 ], [ 1, %92 ]
  %.us-phi127.1.ph = phi i32 [ %.3.2, %.preheader.split.2.thread ], [ %.3.1173, %86 ], [ 2, %92 ]
  %94 = tail call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) %108, i64 noundef 2)
  %95 = load i8, ptr %94, align 1, !tbaa !15
  %96 = tail call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) getelementptr inbounds (i8, ptr @_Z1sB5cxx11, i64 64), i64 noundef 0)
  %97 = load i8, ptr %96, align 1, !tbaa !15
  %98 = icmp eq i8 %95, %97
  %99 = trunc nuw nsw i64 %indvars.iv179 to i32
  %.369.2176 = select i1 %98, i32 %99, i32 %.us-phi.1.ph
  %.365.2177 = select i1 %98, i32 2, i32 %.us-phi126.1.ph
  %.3.2178 = select i1 %98, i32 0, i32 %.us-phi127.1.ph
  br i1 %.ph, label %.split.us.2, label %100

100:                                              ; preds = %.preheader.split.preheader.2
  %101 = tail call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) %108, i64 noundef 2)
  %102 = load i8, ptr %101, align 1, !tbaa !15
  %103 = tail call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) getelementptr inbounds (i8, ptr @_Z1sB5cxx11, i64 64), i64 noundef 1)
  %104 = load i8, ptr %103, align 1, !tbaa !15
  %105 = icmp eq i8 %102, %104
  br i1 %105, label %106, label %.split.us.2

106:                                              ; preds = %100
  %107 = trunc nuw nsw i64 %indvars.iv179 to i32
  br label %.split.us.2

.split.us.2:                                      ; preds = %106, %100, %.preheader.split.preheader.2
  %.us-phi.2 = phi i32 [ %.369.2176, %.preheader.split.preheader.2 ], [ %107, %106 ], [ %.369.2176, %100 ]
  %.us-phi126.2 = phi i32 [ %.365.2177, %.preheader.split.preheader.2 ], [ 2, %106 ], [ %.365.2177, %100 ]
  %.us-phi127.2 = phi i32 [ %.3.2178, %.preheader.split.preheader.2 ], [ 1, %106 ], [ %.3.2178, %100 ]
  %indvars.iv.next180 = add i64 %indvars.iv179, 1
  br label %.preheader.split.1

.preheader.split.1:                               ; preds = %.preheader.split.2.1.peel, %.split.us.2
  %indvars.iv179 = phi i64 [ 1, %.preheader.split.2.1.peel ], [ %indvars.iv.next180, %.split.us.2 ]
  %.061134 = phi i32 [ %.3.1.2.peel, %.preheader.split.2.1.peel ], [ %.us-phi127.2, %.split.us.2 ]
  %.062133 = phi i32 [ %.365.1.2.peel, %.preheader.split.2.1.peel ], [ %.us-phi126.2, %.split.us.2 ]
  %.066132 = phi i32 [ %.369.1.2.peel, %.preheader.split.2.1.peel ], [ %.us-phi.2, %.split.us.2 ]
  %108 = getelementptr inbounds [1000 x %"class.std::__cxx11::basic_string"], ptr @_Z1sB5cxx11, i64 0, i64 %indvars.iv179
  %109 = icmp eq i64 %indvars.iv179, 1
  br i1 %109, label %.preheader.split.2.thread, label %.preheader.split.2

.preheader.split.2:                               ; preds = %.preheader.split.1
  %110 = tail call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) %108, i64 noundef 0)
  %111 = load i8, ptr %110, align 1, !tbaa !15
  %112 = tail call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) @_Z1sB5cxx11, i64 noundef 1)
  %113 = load i8, ptr %112, align 1, !tbaa !15
  %114 = icmp eq i8 %111, %113
  %115 = trunc nuw nsw i64 %indvars.iv179 to i32
  %.369.1 = select i1 %114, i32 %115, i32 %.066132
  %.365.1 = select i1 %114, i32 0, i32 %.062133
  %.3.1 = select i1 %114, i32 1, i32 %.061134
  %116 = icmp eq i64 %indvars.iv179, 2
  br i1 %116, label %.preheader.split.preheader.1, label %.preheader.split.2.thread

.preheader.split.2.thread:                        ; preds = %.preheader.split.1, %.preheader.split.2
  %.3.1215 = phi i32 [ %.3.1, %.preheader.split.2 ], [ %.061134, %.preheader.split.1 ]
  %.365.1214 = phi i32 [ %.365.1, %.preheader.split.2 ], [ %.062133, %.preheader.split.1 ]
  %.369.1213 = phi i32 [ %.369.1, %.preheader.split.2 ], [ %.066132, %.preheader.split.1 ]
  %117 = tail call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) %108, i64 noundef 0)
  %118 = load i8, ptr %117, align 1, !tbaa !15
  %119 = tail call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) @_Z1sB5cxx11, i64 noundef 2)
  %120 = load i8, ptr %119, align 1, !tbaa !15
  %121 = icmp eq i8 %118, %120
  %122 = trunc nuw nsw i64 %indvars.iv179 to i32
  %.369.2 = select i1 %121, i32 %122, i32 %.369.1213
  %.365.2 = select i1 %121, i32 0, i32 %.365.1214
  %.3.2 = select i1 %121, i32 2, i32 %.3.1215
  %123 = icmp eq i64 %indvars.iv179, 1
  br i1 %123, label %.preheader.split.preheader.2, label %.preheader.split.preheader.1

.lr.ph138:                                        ; preds = %.preheader97, %.lr.ph138
  %.057137 = phi i32 [ %131, %.lr.ph138 ], [ 0, %.preheader97 ]
  %124 = and i32 %.057137, 1
  %.not87 = icmp eq i32 %124, 0
  %125 = and i32 %.057137, 2
  %.not88 = icmp eq i32 %125, 0
  %126 = select i1 %.not88, i32 %.369.1171, i32 %.3.1173
  %127 = select i1 %.not87, i32 %126, i32 %.365.1172
  %128 = add nsw i32 %127, 1
  %129 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i32 noundef %128)
  %130 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) %129, ptr noundef nonnull @.str.3)
  %131 = add nuw nsw i32 %.057137, 1
  %132 = load i32, ptr @M, align 4, !tbaa !8
  %.not86.not = icmp slt i32 %.057137, %132
  br i1 %.not86.not, label %.lr.ph138, label %._crit_edge106, !llvm.loop !18

.lr.ph141:                                        ; preds = %.preheader95, %.lr.ph141
  %.0140 = phi i32 [ %141, %.lr.ph141 ], [ 0, %.preheader95 ]
  %133 = and i32 %.0140, 1
  %.not85 = icmp eq i32 %133, 0
  %134 = and i32 %.0140, 3
  %135 = icmp eq i32 %134, 1
  %136 = select i1 %135, i32 %.3.1173, i32 %.369.1171
  %137 = select i1 %.not85, i32 %.365.1172, i32 %136
  %138 = add nsw i32 %137, 1
  %139 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i32 noundef %138)
  %140 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) %139, ptr noundef nonnull @.str.3)
  %141 = add nuw nsw i32 %.0140, 1
  %142 = load i32, ptr @M, align 4, !tbaa !8
  %.not84.not = icmp slt i32 %.0140, %142
  br i1 %.not84.not, label %.lr.ph141, label %._crit_edge106, !llvm.loop !19

._crit_edge106:                                   ; preds = %.lr.ph105, %.lr.ph138, %.lr.ph141, %.lr.ph145, %.preheader95, %.preheader97, %51, %21, %.thread
  %_ZSt4cout.sink = phi ptr [ %74, %.thread ], [ @_ZSt4cout, %21 ], [ @_ZSt4cout, %51 ], [ @_ZSt4cout, %.preheader97 ], [ @_ZSt4cout, %.preheader95 ], [ @_ZSt4cout, %.lr.ph145 ], [ @_ZSt4cout, %.lr.ph141 ], [ @_ZSt4cout, %.lr.ph138 ], [ @_ZSt4cout, %.lr.ph105 ]
  %143 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) %_ZSt4cout.sink, ptr noundef nonnull @.str.2)
  %144 = load i32, ptr @T, align 4, !tbaa !8
  %145 = add nsw i32 %144, -1
  store i32 %145, ptr @T, align 4, !tbaa !8
  %.not = icmp eq i32 %144, 0
  br i1 %.not, label %._crit_edge150, label %.lr.ph149, !llvm.loop !20

._crit_edge150:                                   ; preds = %._crit_edge106, %0
  ret i32 0
}

declare noundef zeroext i1 @_ZNSt8ios_base15sync_with_stdioEb(i1 noundef zeroext) local_unnamed_addr #1

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

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

declare noundef nonnull align 8 dereferenceable(16) ptr @_ZStrsIcSt11char_traitsIcESaIcEERSt13basic_istreamIT_T0_ES7_RNSt7__cxx1112basic_stringIS4_S5_T1_EE(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 8 dereferenceable(32)) local_unnamed_addr #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 #3

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

; Function Attrs: mustprogress nounwind uwtable
declare noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32), i64 noundef) local_unnamed_addr #2 align 2

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

!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 = !{!"vtable pointer", !7, i64 0}
!7 = !{!"Simple C++ TBAA"}
!8 = !{!9, !9, i64 0}
!9 = !{!"int", !10, i64 0}
!10 = !{!"omnipotent char", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = distinct !{!13, !12}
!14 = distinct !{!14, !12}
!15 = !{!10, !10, i64 0}
!16 = distinct !{!16, !12}
!17 = distinct !{!17, !12}
!18 = distinct !{!18, !12}
!19 = distinct !{!19, !12}
!20 = distinct !{!20, !12}


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