; LLVM IR from VastoLorde95/Competitive-Programming :: Codeforces/302 Division 1/Problem C (C)

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

@n = external dso_local global i32, align 4
@m = external dso_local global i32, align 4
@_Z1sB5cxx11 = external dso_local global [20 x %"class.std::__cxx11::basic_string"], align 16
@bad = external dso_local global [20 x [20 x i32]], align 16
@tot = external dso_local global [20 x [20 x i32]], align 16
@a = external dso_local global [20 x [20 x i32]], align 16
@dp = external dso_local global [1048576 x i32], align 16
@inf = external dso_local global i32, align 4
@.str = external hidden unnamed_addr constant [5 x i8], align 1
@_ZSt3cin = external global %"class.std::basic_istream", align 8
@.str.2 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [4 x i8], align 1

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

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

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

23:                                               ; preds = %18
  %24 = load i32, ptr %2, align 4, !tbaa !5
  %25 = sext i32 %24 to i64
  %26 = getelementptr inbounds [20 x %"class.std::__cxx11::basic_string"], ptr @_Z1sB5cxx11, i64 0, i64 %25
  %27 = 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) %26)
  br label %28

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

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

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

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

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

38:                                               ; preds = %51, %37
  %39 = load i32, ptr %5, align 4, !tbaa !5
  %40 = load i32, ptr @m, align 4, !tbaa !5
  %41 = icmp slt i32 %39, %40
  br i1 %41, label %43, label %42

42:                                               ; preds = %38
  store i32 8, ptr %4, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #5
  br label %54

43:                                               ; preds = %38
  %44 = load i32, ptr %3, align 4, !tbaa !5
  %45 = sext i32 %44 to i64
  %46 = getelementptr inbounds [20 x [20 x i32]], ptr @a, i64 0, i64 %45
  %47 = load i32, ptr %5, align 4, !tbaa !5
  %48 = sext i32 %47 to i64
  %49 = getelementptr inbounds [20 x i32], ptr %46, i64 0, i64 %48
  %50 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.2, ptr noundef %49)
  br label %51

51:                                               ; preds = %43
  %52 = load i32, ptr %5, align 4, !tbaa !5
  %53 = add nsw i32 %52, 1
  store i32 %53, ptr %5, align 4, !tbaa !5
  br label %38, !llvm.loop !11

54:                                               ; preds = %42
  br label %55

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

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

59:                                               ; preds = %146, %58
  %60 = load i32, ptr %6, align 4, !tbaa !5
  %61 = load i32, ptr @n, align 4, !tbaa !5
  %62 = icmp slt i32 %60, %61
  br i1 %62, label %64, label %63

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

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

65:                                               ; preds = %142, %64
  %66 = load i32, ptr %7, align 4, !tbaa !5
  %67 = load i32, ptr @m, align 4, !tbaa !5
  %68 = icmp slt i32 %66, %67
  br i1 %68, label %70, label %69

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

70:                                               ; preds = %65
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #5
  store i32 0, ptr %8, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #5
  store i32 0, ptr %9, align 4, !tbaa !5
  br label %71

71:                                               ; preds = %129, %70
  %72 = load i32, ptr %9, align 4, !tbaa !5
  %73 = load i32, ptr @n, align 4, !tbaa !5
  %74 = icmp slt i32 %72, %73
  br i1 %74, label %76, label %75

75:                                               ; preds = %71
  store i32 17, ptr %4, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #5
  br label %132

76:                                               ; preds = %71
  %77 = load i32, ptr %6, align 4, !tbaa !5
  %78 = sext i32 %77 to i64
  %79 = getelementptr inbounds [20 x %"class.std::__cxx11::basic_string"], ptr @_Z1sB5cxx11, i64 0, i64 %78
  %80 = load i32, ptr %7, align 4, !tbaa !5
  %81 = sext i32 %80 to i64
  %82 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) %79, i64 noundef %81)
  %83 = load i8, ptr %82, align 1, !tbaa !13
  %84 = sext i8 %83 to i32
  %85 = load i32, ptr %9, align 4, !tbaa !5
  %86 = sext i32 %85 to i64
  %87 = getelementptr inbounds [20 x %"class.std::__cxx11::basic_string"], ptr @_Z1sB5cxx11, i64 0, i64 %86
  %88 = load i32, ptr %7, align 4, !tbaa !5
  %89 = sext i32 %88 to i64
  %90 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) %87, i64 noundef %89)
  %91 = load i8, ptr %90, align 1, !tbaa !13
  %92 = sext i8 %91 to i32
  %93 = icmp eq i32 %84, %92
  br i1 %93, label %94, label %128

94:                                               ; preds = %76
  %95 = load i32, ptr %9, align 4, !tbaa !5
  %96 = shl i32 1, %95
  %97 = load i32, ptr %6, align 4, !tbaa !5
  %98 = sext i32 %97 to i64
  %99 = getelementptr inbounds [20 x [20 x i32]], ptr @bad, i64 0, i64 %98
  %100 = load i32, ptr %7, align 4, !tbaa !5
  %101 = sext i32 %100 to i64
  %102 = getelementptr inbounds [20 x i32], ptr %99, i64 0, i64 %101
  %103 = load i32, ptr %102, align 4, !tbaa !5
  %104 = or i32 %103, %96
  store i32 %104, ptr %102, align 4, !tbaa !5
  %105 = load i32, ptr %9, align 4, !tbaa !5
  %106 = sext i32 %105 to i64
  %107 = getelementptr inbounds [20 x [20 x i32]], ptr @a, i64 0, i64 %106
  %108 = load i32, ptr %7, align 4, !tbaa !5
  %109 = sext i32 %108 to i64
  %110 = getelementptr inbounds [20 x i32], ptr %107, i64 0, i64 %109
  %111 = load i32, ptr %110, align 4, !tbaa !5
  %112 = load i32, ptr %6, align 4, !tbaa !5
  %113 = sext i32 %112 to i64
  %114 = getelementptr inbounds [20 x [20 x i32]], ptr @tot, i64 0, i64 %113
  %115 = load i32, ptr %7, align 4, !tbaa !5
  %116 = sext i32 %115 to i64
  %117 = getelementptr inbounds [20 x i32], ptr %114, i64 0, i64 %116
  %118 = load i32, ptr %117, align 4, !tbaa !5
  %119 = add nsw i32 %118, %111
  store i32 %119, ptr %117, align 4, !tbaa !5
  %120 = load i32, ptr %9, align 4, !tbaa !5
  %121 = sext i32 %120 to i64
  %122 = getelementptr inbounds [20 x [20 x i32]], ptr @a, i64 0, i64 %121
  %123 = load i32, ptr %7, align 4, !tbaa !5
  %124 = sext i32 %123 to i64
  %125 = getelementptr inbounds [20 x i32], ptr %122, i64 0, i64 %124
  %126 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %8, ptr noundef nonnull align 4 dereferenceable(4) %125)
  %127 = load i32, ptr %126, align 4, !tbaa !5
  store i32 %127, ptr %8, align 4, !tbaa !5
  br label %128

128:                                              ; preds = %94, %76
  br label %129

129:                                              ; preds = %128
  %130 = load i32, ptr %9, align 4, !tbaa !5
  %131 = add nsw i32 %130, 1
  store i32 %131, ptr %9, align 4, !tbaa !5
  br label %71, !llvm.loop !14

132:                                              ; preds = %75
  %133 = load i32, ptr %8, align 4, !tbaa !5
  %134 = load i32, ptr %6, align 4, !tbaa !5
  %135 = sext i32 %134 to i64
  %136 = getelementptr inbounds [20 x [20 x i32]], ptr @tot, i64 0, i64 %135
  %137 = load i32, ptr %7, align 4, !tbaa !5
  %138 = sext i32 %137 to i64
  %139 = getelementptr inbounds [20 x i32], ptr %136, i64 0, i64 %138
  %140 = load i32, ptr %139, align 4, !tbaa !5
  %141 = sub nsw i32 %140, %133
  store i32 %141, ptr %139, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #5
  br label %142

142:                                              ; preds = %132
  %143 = load i32, ptr %7, align 4, !tbaa !5
  %144 = add nsw i32 %143, 1
  store i32 %144, ptr %7, align 4, !tbaa !5
  br label %65, !llvm.loop !15

145:                                              ; preds = %69
  br label %146

146:                                              ; preds = %145
  %147 = load i32, ptr %6, align 4, !tbaa !5
  %148 = add nsw i32 %147, 1
  store i32 %148, ptr %6, align 4, !tbaa !5
  br label %59, !llvm.loop !16

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

150:                                              ; preds = %161, %149
  %151 = load i32, ptr %10, align 4, !tbaa !5
  %152 = load i32, ptr @n, align 4, !tbaa !5
  %153 = shl i32 1, %152
  %154 = icmp slt i32 %151, %153
  br i1 %154, label %156, label %155

155:                                              ; preds = %150
  store i32 20, ptr %4, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #5
  br label %164

156:                                              ; preds = %150
  %157 = load i32, ptr @inf, align 4, !tbaa !5
  %158 = load i32, ptr %10, align 4, !tbaa !5
  %159 = sext i32 %158 to i64
  %160 = getelementptr inbounds [1048576 x i32], ptr @dp, i64 0, i64 %159
  store i32 %157, ptr %160, align 4, !tbaa !5
  br label %161

161:                                              ; preds = %156
  %162 = load i32, ptr %10, align 4, !tbaa !5
  %163 = add nsw i32 %162, 1
  store i32 %163, ptr %10, align 4, !tbaa !5
  br label %150, !llvm.loop !17

164:                                              ; preds = %155
  store i32 0, ptr @dp, align 16, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #5
  store i32 1, ptr %11, align 4, !tbaa !5
  br label %165

165:                                              ; preds = %254, %164
  %166 = load i32, ptr %11, align 4, !tbaa !5
  %167 = load i32, ptr @n, align 4, !tbaa !5
  %168 = shl i32 1, %167
  %169 = icmp slt i32 %166, %168
  br i1 %169, label %171, label %170

170:                                              ; preds = %165
  store i32 23, ptr %4, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #5
  br label %257

171:                                              ; preds = %165
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #5
  store i32 0, ptr %12, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #5
  %172 = load i32, ptr @n, align 4, !tbaa !5
  %173 = sub nsw i32 %172, 1
  store i32 %173, ptr %13, align 4, !tbaa !5
  br label %174

174:                                              ; preds = %187, %171
  %175 = load i32, ptr %13, align 4, !tbaa !5
  %176 = icmp sge i32 %175, 0
  br i1 %176, label %178, label %177

177:                                              ; preds = %174
  store i32 26, ptr %4, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #5
  br label %190

178:                                              ; preds = %174
  %179 = load i32, ptr %11, align 4, !tbaa !5
  %180 = load i32, ptr %13, align 4, !tbaa !5
  %181 = shl i32 1, %180
  %182 = and i32 %179, %181
  %183 = icmp sgt i32 %182, 0
  br i1 %183, label %184, label %186

184:                                              ; preds = %178
  %185 = load i32, ptr %13, align 4, !tbaa !5
  store i32 %185, ptr %12, align 4, !tbaa !5
  br label %186

186:                                              ; preds = %184, %178
  br label %187

187:                                              ; preds = %186
  %188 = load i32, ptr %13, align 4, !tbaa !5
  %189 = add nsw i32 %188, -1
  store i32 %189, ptr %13, align 4, !tbaa !5
  br label %174, !llvm.loop !18

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

191:                                              ; preds = %250, %190
  %192 = load i32, ptr %14, align 4, !tbaa !5
  %193 = load i32, ptr @m, align 4, !tbaa !5
  %194 = icmp slt i32 %192, %193
  br i1 %194, label %196, label %195

195:                                              ; preds = %191
  store i32 29, ptr %4, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #5
  br label %253

196:                                              ; preds = %191
  %197 = load i32, ptr %11, align 4, !tbaa !5
  %198 = sext i32 %197 to i64
  %199 = getelementptr inbounds [1048576 x i32], ptr @dp, i64 0, i64 %198
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #5
  %200 = load i32, ptr %11, align 4, !tbaa !5
  %201 = load i32, ptr %11, align 4, !tbaa !5
  %202 = load i32, ptr %12, align 4, !tbaa !5
  %203 = sext i32 %202 to i64
  %204 = getelementptr inbounds [20 x [20 x i32]], ptr @bad, i64 0, i64 %203
  %205 = load i32, ptr %14, align 4, !tbaa !5
  %206 = sext i32 %205 to i64
  %207 = getelementptr inbounds [20 x i32], ptr %204, i64 0, i64 %206
  %208 = load i32, ptr %207, align 4, !tbaa !5
  %209 = xor i32 %201, %208
  %210 = and i32 %200, %209
  %211 = sext i32 %210 to i64
  %212 = getelementptr inbounds [1048576 x i32], ptr @dp, i64 0, i64 %211
  %213 = load i32, ptr %212, align 4, !tbaa !5
  %214 = load i32, ptr %12, align 4, !tbaa !5
  %215 = sext i32 %214 to i64
  %216 = getelementptr inbounds [20 x [20 x i32]], ptr @tot, i64 0, i64 %215
  %217 = load i32, ptr %14, align 4, !tbaa !5
  %218 = sext i32 %217 to i64
  %219 = getelementptr inbounds [20 x i32], ptr %216, i64 0, i64 %218
  %220 = load i32, ptr %219, align 4, !tbaa !5
  %221 = add nsw i32 %213, %220
  store i32 %221, ptr %15, align 4, !tbaa !5
  %222 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %199, ptr noundef nonnull align 4 dereferenceable(4) %15)
  %223 = load i32, ptr %222, align 4, !tbaa !5
  %224 = load i32, ptr %11, align 4, !tbaa !5
  %225 = sext i32 %224 to i64
  %226 = getelementptr inbounds [1048576 x i32], ptr @dp, i64 0, i64 %225
  store i32 %223, ptr %226, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #5
  %227 = load i32, ptr %11, align 4, !tbaa !5
  %228 = sext i32 %227 to i64
  %229 = getelementptr inbounds [1048576 x i32], ptr @dp, i64 0, i64 %228
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #5
  %230 = load i32, ptr %11, align 4, !tbaa !5
  %231 = load i32, ptr %12, align 4, !tbaa !5
  %232 = shl i32 1, %231
  %233 = xor i32 %230, %232
  %234 = sext i32 %233 to i64
  %235 = getelementptr inbounds [1048576 x i32], ptr @dp, i64 0, i64 %234
  %236 = load i32, ptr %235, align 4, !tbaa !5
  %237 = load i32, ptr %12, align 4, !tbaa !5
  %238 = sext i32 %237 to i64
  %239 = getelementptr inbounds [20 x [20 x i32]], ptr @a, i64 0, i64 %238
  %240 = load i32, ptr %14, align 4, !tbaa !5
  %241 = sext i32 %240 to i64
  %242 = getelementptr inbounds [20 x i32], ptr %239, i64 0, i64 %241
  %243 = load i32, ptr %242, align 4, !tbaa !5
  %244 = add nsw i32 %236, %243
  store i32 %244, ptr %16, align 4, !tbaa !5
  %245 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %229, ptr noundef nonnull align 4 dereferenceable(4) %16)
  %246 = load i32, ptr %245, align 4, !tbaa !5
  %247 = load i32, ptr %11, align 4, !tbaa !5
  %248 = sext i32 %247 to i64
  %249 = getelementptr inbounds [1048576 x i32], ptr @dp, i64 0, i64 %248
  store i32 %246, ptr %249, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #5
  br label %250

250:                                              ; preds = %196
  %251 = load i32, ptr %14, align 4, !tbaa !5
  %252 = add nsw i32 %251, 1
  store i32 %252, ptr %14, align 4, !tbaa !5
  br label %191, !llvm.loop !19

253:                                              ; preds = %195
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #5
  br label %254

254:                                              ; preds = %253
  %255 = load i32, ptr %11, align 4, !tbaa !5
  %256 = add nsw i32 %255, 1
  store i32 %256, ptr %11, align 4, !tbaa !5
  br label %165, !llvm.loop !20

257:                                              ; preds = %170
  %258 = load i32, ptr @n, align 4, !tbaa !5
  %259 = shl i32 1, %258
  %260 = sub nsw i32 %259, 1
  %261 = sext i32 %260 to i64
  %262 = getelementptr inbounds [1048576 x i32], ptr @dp, i64 0, i64 %261
  %263 = load i32, ptr %262, align 4, !tbaa !5
  %264 = call i32 (ptr, ...) @printf(ptr noundef @.str.3, i32 noundef %263)
  ret i32 0
}

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

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

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) #2

; 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) #3 align 2

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

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

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

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

@n = external dso_local global i32, align 4
@m = external dso_local global i32, align 4
@_Z1sB5cxx11 = external dso_local global [20 x %"class.std::__cxx11::basic_string"], align 16
@bad = external dso_local local_unnamed_addr global [20 x [20 x i32]], align 16
@tot = external dso_local local_unnamed_addr global [20 x [20 x i32]], align 16
@a = external dso_local global [20 x [20 x i32]], align 16
@dp = external dso_local global [1048576 x i32], align 16
@inf = external dso_local local_unnamed_addr global i32, align 4
@.str = external hidden unnamed_addr constant [5 x i8], align 1
@_ZSt3cin = external global %"class.std::basic_istream", align 8
@.str.2 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [4 x i8], align 1

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #0 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = alloca i32, align 4
  %4 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @n, ptr noundef nonnull @m)
  %5 = load i32, ptr @n, align 4, !tbaa !5
  %6 = icmp sgt i32 %5, 0
  br i1 %6, label %.lr.ph, label %.lr.ph87

.preheader72:                                     ; preds = %.lr.ph
  %7 = icmp sgt i32 %12, 0
  br i1 %7, label %.preheader71.lr.ph, label %.lr.ph87

.preheader71.lr.ph:                               ; preds = %.preheader72
  %8 = load i32, ptr @m, align 4, !tbaa !5
  %9 = icmp sgt i32 %8, 0
  br i1 %9, label %.preheader71, label %.preheader68

.lr.ph:                                           ; preds = %0, %.lr.ph
  %indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph ], [ 0, %0 ]
  %10 = getelementptr inbounds [20 x %"class.std::__cxx11::basic_string"], ptr @_Z1sB5cxx11, i64 0, i64 %indvars.iv
  %11 = 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) %10)
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %12 = load i32, ptr @n, align 4, !tbaa !5
  %13 = sext i32 %12 to i64
  %14 = icmp slt i64 %indvars.iv.next, %13
  br i1 %14, label %.lr.ph, label %.preheader72, !llvm.loop !9

.preheader71:                                     ; preds = %.preheader71.lr.ph, %._crit_edge
  %15 = phi i32 [ %20, %._crit_edge ], [ %12, %.preheader71.lr.ph ]
  %16 = phi i32 [ %21, %._crit_edge ], [ %8, %.preheader71.lr.ph ]
  %indvars.iv109 = phi i64 [ %indvars.iv.next110, %._crit_edge ], [ 0, %.preheader71.lr.ph ]
  %17 = icmp sgt i32 %16, 0
  br i1 %17, label %.lr.ph76, label %._crit_edge

.preheader70:                                     ; preds = %._crit_edge
  %18 = icmp sgt i32 %20, 0
  br i1 %18, label %.preheader69.lr.ph, label %.lr.ph87

.preheader69.lr.ph:                               ; preds = %.preheader70
  %.pr = load i32, ptr @m, align 4, !tbaa !5
  %19 = icmp sgt i32 %.pr, 0
  br i1 %19, label %.preheader69, label %.preheader68

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

._crit_edge:                                      ; preds = %._crit_edge.loopexit, %.preheader71
  %20 = phi i32 [ %.pre, %._crit_edge.loopexit ], [ %15, %.preheader71 ]
  %21 = phi i32 [ %26, %._crit_edge.loopexit ], [ %16, %.preheader71 ]
  %indvars.iv.next110 = add nuw nsw i64 %indvars.iv109, 1
  %22 = sext i32 %20 to i64
  %23 = icmp slt i64 %indvars.iv.next110, %22
  br i1 %23, label %.preheader71, label %.preheader70, !llvm.loop !11

.lr.ph76:                                         ; preds = %.preheader71, %.lr.ph76
  %indvars.iv106 = phi i64 [ %indvars.iv.next107, %.lr.ph76 ], [ 0, %.preheader71 ]
  %24 = getelementptr inbounds [20 x [20 x i32]], ptr @a, i64 0, i64 %indvars.iv109, i64 %indvars.iv106
  %25 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.2, ptr noundef nonnull %24)
  %indvars.iv.next107 = add nuw nsw i64 %indvars.iv106, 1
  %26 = load i32, ptr @m, align 4, !tbaa !5
  %27 = sext i32 %26 to i64
  %28 = icmp slt i64 %indvars.iv.next107, %27
  br i1 %28, label %.lr.ph76, label %._crit_edge.loopexit, !llvm.loop !13

.preheader69:                                     ; preds = %.preheader69.lr.ph, %._crit_edge84
  %29 = phi i32 [ %44, %._crit_edge84 ], [ %20, %.preheader69.lr.ph ]
  %30 = phi i32 [ %45, %._crit_edge84 ], [ %.pr, %.preheader69.lr.ph ]
  %31 = phi i32 [ %46, %._crit_edge84 ], [ %.pr, %.preheader69.lr.ph ]
  %32 = phi i32 [ %47, %._crit_edge84 ], [ %.pr, %.preheader69.lr.ph ]
  %indvars.iv118 = phi i64 [ %indvars.iv.next119, %._crit_edge84 ], [ 0, %.preheader69.lr.ph ]
  %33 = icmp sgt i32 %32, 0
  br i1 %33, label %.lr.ph83, label %._crit_edge84

.lr.ph83:                                         ; preds = %.preheader69
  %34 = getelementptr inbounds [20 x %"class.std::__cxx11::basic_string"], ptr @_Z1sB5cxx11, i64 0, i64 %indvars.iv118
  %35 = icmp sgt i32 %29, 0
  br i1 %35, label %.lr.ph83.split, label %._crit_edge84

.preheader68:                                     ; preds = %._crit_edge84, %.preheader71.lr.ph, %.preheader69.lr.ph
  %36 = phi i32 [ %20, %.preheader69.lr.ph ], [ %12, %.preheader71.lr.ph ], [ %44, %._crit_edge84 ]
  %.not99 = icmp eq i32 %36, 31
  br i1 %.not99, label %._crit_edge88.thread, label %.lr.ph87

._crit_edge88.thread:                             ; preds = %.preheader68
  store i32 0, ptr @dp, align 16, !tbaa !5
  br label %._crit_edge97

.lr.ph87:                                         ; preds = %0, %.preheader72, %.preheader70, %.preheader68
  %37 = phi i32 [ %36, %.preheader68 ], [ %20, %.preheader70 ], [ %12, %.preheader72 ], [ %5, %0 ]
  %38 = shl nuw i32 1, %37
  %39 = load i32, ptr @inf, align 4, !tbaa !5
  %min.iters.check = icmp slt i32 %38, 8
  br i1 %min.iters.check, label %scalar.ph, label %vector.ph

vector.ph:                                        ; preds = %.lr.ph87
  %40 = and i32 %38, 2147483640
  %n.vec = zext nneg i32 %40 to i64
  %broadcast.splatinsert = insertelement <4 x i32> poison, i32 %39, i64 0
  %broadcast.splat = shufflevector <4 x i32> %broadcast.splatinsert, <4 x i32> poison, <4 x i32> zeroinitializer
  br label %vector.body

vector.body:                                      ; preds = %vector.body, %vector.ph
  %index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
  %41 = getelementptr inbounds [1048576 x i32], ptr @dp, i64 0, i64 %index
  %42 = getelementptr inbounds i8, ptr %41, i64 16
  store <4 x i32> %broadcast.splat, ptr %41, align 16, !tbaa !5
  store <4 x i32> %broadcast.splat, ptr %42, align 16, !tbaa !5
  %index.next = add nuw i64 %index, 8
  %43 = icmp eq i64 %index.next, %n.vec
  br i1 %43, label %._crit_edge88, label %vector.body, !llvm.loop !14

._crit_edge84:                                    ; preds = %._crit_edge81, %.lr.ph83, %.preheader69
  %44 = phi i32 [ %29, %.preheader69 ], [ %29, %.lr.ph83 ], [ %56, %._crit_edge81 ]
  %45 = phi i32 [ %30, %.preheader69 ], [ %30, %.lr.ph83 ], [ %57, %._crit_edge81 ]
  %46 = phi i32 [ %31, %.preheader69 ], [ %31, %.lr.ph83 ], [ %57, %._crit_edge81 ]
  %47 = phi i32 [ %32, %.preheader69 ], [ %31, %.lr.ph83 ], [ %57, %._crit_edge81 ]
  %indvars.iv.next119 = add nuw nsw i64 %indvars.iv118, 1
  %48 = sext i32 %44 to i64
  %49 = icmp slt i64 %indvars.iv.next119, %48
  br i1 %49, label %.preheader69, label %.preheader68, !llvm.loop !17

.lr.ph83.split:                                   ; preds = %.lr.ph83, %._crit_edge81
  %50 = phi i32 [ %56, %._crit_edge81 ], [ %29, %.lr.ph83 ]
  %51 = phi i32 [ %57, %._crit_edge81 ], [ %30, %.lr.ph83 ]
  %52 = phi i32 [ %59, %._crit_edge81 ], [ %29, %.lr.ph83 ]
  %indvars.iv115 = phi i64 [ %indvars.iv.next116, %._crit_edge81 ], [ 0, %.lr.ph83 ]
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %1) #6
  store i32 0, ptr %1, align 4, !tbaa !5
  %53 = icmp sgt i32 %52, 0
  br i1 %53, label %.lr.ph80, label %._crit_edge81

.lr.ph80:                                         ; preds = %.lr.ph83.split
  %54 = getelementptr inbounds [20 x [20 x i32]], ptr @bad, i64 0, i64 %indvars.iv118, i64 %indvars.iv115
  %55 = getelementptr inbounds [20 x [20 x i32]], ptr @tot, i64 0, i64 %indvars.iv118, i64 %indvars.iv115
  br label %65

._crit_edge81.loopexit:                           ; preds = %83
  %.pre132 = load i32, ptr %1, align 4, !tbaa !5
  %.pre133 = load i32, ptr @m, align 4, !tbaa !5
  br label %._crit_edge81

._crit_edge81:                                    ; preds = %._crit_edge81.loopexit, %.lr.ph83.split
  %56 = phi i32 [ %84, %._crit_edge81.loopexit ], [ %50, %.lr.ph83.split ]
  %57 = phi i32 [ %.pre133, %._crit_edge81.loopexit ], [ %51, %.lr.ph83.split ]
  %58 = phi i32 [ %.pre132, %._crit_edge81.loopexit ], [ 0, %.lr.ph83.split ]
  %59 = phi i32 [ %84, %._crit_edge81.loopexit ], [ %52, %.lr.ph83.split ]
  %60 = getelementptr inbounds [20 x [20 x i32]], ptr @tot, i64 0, i64 %indvars.iv118, i64 %indvars.iv115
  %61 = load i32, ptr %60, align 4, !tbaa !5
  %62 = sub nsw i32 %61, %58
  store i32 %62, ptr %60, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #6
  %indvars.iv.next116 = add nuw nsw i64 %indvars.iv115, 1
  %63 = sext i32 %57 to i64
  %64 = icmp slt i64 %indvars.iv.next116, %63
  br i1 %64, label %.lr.ph83.split, label %._crit_edge84, !llvm.loop !18

65:                                               ; preds = %.lr.ph80, %83
  %indvars.iv112 = phi i64 [ 0, %.lr.ph80 ], [ %indvars.iv.next113, %83 ]
  %66 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) %34, i64 noundef %indvars.iv115)
  %67 = load i8, ptr %66, align 1, !tbaa !19
  %68 = getelementptr inbounds [20 x %"class.std::__cxx11::basic_string"], ptr @_Z1sB5cxx11, i64 0, i64 %indvars.iv112
  %69 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) %68, i64 noundef %indvars.iv115)
  %70 = load i8, ptr %69, align 1, !tbaa !19
  %71 = icmp eq i8 %67, %70
  br i1 %71, label %72, label %83

72:                                               ; preds = %65
  %73 = trunc nuw nsw i64 %indvars.iv112 to i32
  %74 = shl nuw i32 1, %73
  %75 = load i32, ptr %54, align 4, !tbaa !5
  %76 = or i32 %75, %74
  store i32 %76, ptr %54, align 4, !tbaa !5
  %77 = getelementptr inbounds [20 x [20 x i32]], ptr @a, i64 0, i64 %indvars.iv112, i64 %indvars.iv115
  %78 = load i32, ptr %77, align 4, !tbaa !5
  %79 = load i32, ptr %55, align 4, !tbaa !5
  %80 = add nsw i32 %79, %78
  store i32 %80, ptr %55, align 4, !tbaa !5
  %81 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %1, ptr noundef nonnull align 4 dereferenceable(4) %77)
  %82 = load i32, ptr %81, align 4, !tbaa !5
  store i32 %82, ptr %1, align 4, !tbaa !5
  br label %83

83:                                               ; preds = %65, %72
  %indvars.iv.next113 = add nuw nsw i64 %indvars.iv112, 1
  %84 = load i32, ptr @n, align 4, !tbaa !5
  %85 = sext i32 %84 to i64
  %86 = icmp slt i64 %indvars.iv.next113, %85
  br i1 %86, label %65, label %._crit_edge81.loopexit, !llvm.loop !20

._crit_edge88:                                    ; preds = %vector.body, %scalar.ph, %scalar.ph.1, %scalar.ph.2, %scalar.ph.4
  store i32 0, ptr @dp, align 16, !tbaa !5
  %87 = icmp sgt i32 %38, 1
  br i1 %87, label %.preheader67, label %._crit_edge97

scalar.ph:                                        ; preds = %.lr.ph87
  store i32 %39, ptr @dp, align 16, !tbaa !5
  %exitcond125.not = icmp slt i32 %38, 2
  br i1 %exitcond125.not, label %._crit_edge88, label %scalar.ph.1, !llvm.loop !21

scalar.ph.1:                                      ; preds = %scalar.ph
  store i32 %39, ptr getelementptr inbounds (i8, ptr @dp, i64 4), align 4, !tbaa !5
  %exitcond125.not.1 = icmp eq i32 %37, 1
  br i1 %exitcond125.not.1, label %._crit_edge88, label %scalar.ph.2, !llvm.loop !21

scalar.ph.2:                                      ; preds = %scalar.ph.1
  store i32 %39, ptr getelementptr inbounds (i8, ptr @dp, i64 8), align 8, !tbaa !5
  store i32 %39, ptr getelementptr inbounds (i8, ptr @dp, i64 12), align 4, !tbaa !5
  %exitcond125.not.3 = icmp eq i32 %37, 2
  br i1 %exitcond125.not.3, label %._crit_edge88, label %scalar.ph.4, !llvm.loop !21

scalar.ph.4:                                      ; preds = %scalar.ph.2
  store i32 %39, ptr getelementptr inbounds (i8, ptr @dp, i64 16), align 16, !tbaa !5
  store i32 %39, ptr getelementptr inbounds (i8, ptr @dp, i64 20), align 4, !tbaa !5
  store i32 %39, ptr getelementptr inbounds (i8, ptr @dp, i64 24), align 8, !tbaa !5
  br label %._crit_edge88

.preheader67:                                     ; preds = %._crit_edge88, %._crit_edge95
  %88 = phi i32 [ %116, %._crit_edge95 ], [ %37, %._crit_edge88 ]
  %indvars.iv129 = phi i64 [ %indvars.iv.next130, %._crit_edge95 ], [ 1, %._crit_edge88 ]
  %89 = icmp sgt i32 %88, 0
  br i1 %89, label %.lr.ph91.preheader, label %.preheader

.lr.ph91.preheader:                               ; preds = %.preheader67
  %90 = trunc nuw nsw i64 %indvars.iv129 to i32
  %xtraiter = and i32 %88, 3
  %91 = icmp ult i32 %88, 4
  br i1 %91, label %.preheader.loopexit.unr-lcssa, label %.lr.ph91.preheader.new

.lr.ph91.preheader.new:                           ; preds = %.lr.ph91.preheader
  %unroll_iter = and i32 %88, 2147483644
  br label %.lr.ph91

._crit_edge97:                                    ; preds = %._crit_edge95, %._crit_edge88.thread, %._crit_edge88
  %.lcssa = phi i32 [ %38, %._crit_edge88 ], [ -2147483648, %._crit_edge88.thread ], [ %117, %._crit_edge95 ]
  %92 = add nsw i32 %.lcssa, -1
  %93 = sext i32 %92 to i64
  %94 = getelementptr inbounds [1048576 x i32], ptr @dp, i64 0, i64 %93
  %95 = load i32, ptr %94, align 4, !tbaa !5
  %96 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %95)
  ret i32 0

.preheader.loopexit.unr-lcssa:                    ; preds = %.lr.ph91, %.lr.ph91.preheader
  %spec.select.lcssa.ph = phi i32 [ poison, %.lr.ph91.preheader ], [ %spec.select.3, %.lr.ph91 ]
  %.056.in90.unr = phi i32 [ %88, %.lr.ph91.preheader ], [ %.056.3, %.lr.ph91 ]
  %.05789.unr = phi i32 [ 0, %.lr.ph91.preheader ], [ %spec.select.3, %.lr.ph91 ]
  %lcmp.mod.not = icmp eq i32 %xtraiter, 0
  br i1 %lcmp.mod.not, label %.preheader, label %.lr.ph91.epil

.lr.ph91.epil:                                    ; preds = %.preheader.loopexit.unr-lcssa, %.lr.ph91.epil
  %.056.in90.epil = phi i32 [ %.056.epil, %.lr.ph91.epil ], [ %.056.in90.unr, %.preheader.loopexit.unr-lcssa ]
  %.05789.epil = phi i32 [ %spec.select.epil, %.lr.ph91.epil ], [ %.05789.unr, %.preheader.loopexit.unr-lcssa ]
  %epil.iter = phi i32 [ %epil.iter.next, %.lr.ph91.epil ], [ 0, %.preheader.loopexit.unr-lcssa ]
  %.056.epil = add nsw i32 %.056.in90.epil, -1
  %97 = shl nuw i32 1, %.056.epil
  %98 = and i32 %97, %90
  %.not.epil = icmp eq i32 %98, 0
  %spec.select.epil = select i1 %.not.epil, i32 %.05789.epil, i32 %.056.epil
  %epil.iter.next = add i32 %epil.iter, 1
  %epil.iter.cmp.not = icmp eq i32 %epil.iter.next, %xtraiter
  br i1 %epil.iter.cmp.not, label %.preheader, label %.lr.ph91.epil, !llvm.loop !22

.preheader:                                       ; preds = %.preheader.loopexit.unr-lcssa, %.lr.ph91.epil, %.preheader67
  %.057.lcssa = phi i32 [ 0, %.preheader67 ], [ %spec.select.lcssa.ph, %.preheader.loopexit.unr-lcssa ], [ %spec.select.epil, %.lr.ph91.epil ]
  %99 = load i32, ptr @m, align 4, !tbaa !5
  %100 = icmp sgt i32 %99, 0
  br i1 %100, label %.lr.ph94, label %._crit_edge95

.lr.ph94:                                         ; preds = %.preheader
  %101 = getelementptr inbounds [1048576 x i32], ptr @dp, i64 0, i64 %indvars.iv129
  %102 = zext nneg i32 %.057.lcssa to i64
  %103 = shl nuw i32 1, %.057.lcssa
  %104 = trunc nuw nsw i64 %indvars.iv129 to i32
  %105 = xor i32 %103, %104
  %106 = sext i32 %105 to i64
  %107 = getelementptr inbounds [1048576 x i32], ptr @dp, i64 0, i64 %106
  br label %120

.lr.ph91:                                         ; preds = %.lr.ph91, %.lr.ph91.preheader.new
  %.056.in90 = phi i32 [ %88, %.lr.ph91.preheader.new ], [ %.056.3, %.lr.ph91 ]
  %.05789 = phi i32 [ 0, %.lr.ph91.preheader.new ], [ %spec.select.3, %.lr.ph91 ]
  %niter = phi i32 [ 0, %.lr.ph91.preheader.new ], [ %niter.next.3, %.lr.ph91 ]
  %.056 = add nsw i32 %.056.in90, -1
  %108 = shl nuw i32 1, %.056
  %109 = and i32 %108, %90
  %.not = icmp eq i32 %109, 0
  %spec.select = select i1 %.not, i32 %.05789, i32 %.056
  %.056.1 = add nsw i32 %.056.in90, -2
  %110 = shl nuw i32 1, %.056.1
  %111 = and i32 %110, %90
  %.not.1 = icmp eq i32 %111, 0
  %spec.select.1 = select i1 %.not.1, i32 %spec.select, i32 %.056.1
  %.056.2 = add nsw i32 %.056.in90, -3
  %112 = shl nuw i32 1, %.056.2
  %113 = and i32 %112, %90
  %.not.2 = icmp eq i32 %113, 0
  %spec.select.2 = select i1 %.not.2, i32 %spec.select.1, i32 %.056.2
  %.056.3 = add nsw i32 %.056.in90, -4
  %114 = shl nuw i32 1, %.056.3
  %115 = and i32 %114, %90
  %.not.3 = icmp eq i32 %115, 0
  %spec.select.3 = select i1 %.not.3, i32 %spec.select.2, i32 %.056.3
  %niter.next.3 = add i32 %niter, 4
  %niter.ncmp.3.not = icmp eq i32 %niter.next.3, %unroll_iter
  br i1 %niter.ncmp.3.not, label %.preheader.loopexit.unr-lcssa, label %.lr.ph91, !llvm.loop !24

._crit_edge95.loopexit:                           ; preds = %120
  %.pre134 = load i32, ptr @n, align 4, !tbaa !5
  br label %._crit_edge95

._crit_edge95:                                    ; preds = %._crit_edge95.loopexit, %.preheader
  %116 = phi i32 [ %.pre134, %._crit_edge95.loopexit ], [ %88, %.preheader ]
  %indvars.iv.next130 = add nuw nsw i64 %indvars.iv129, 1
  %117 = shl nuw i32 1, %116
  %118 = sext i32 %117 to i64
  %119 = icmp slt i64 %indvars.iv.next130, %118
  br i1 %119, label %.preheader67, label %._crit_edge97, !llvm.loop !25

120:                                              ; preds = %.lr.ph94, %120
  %indvars.iv126 = phi i64 [ 0, %.lr.ph94 ], [ %indvars.iv.next127, %120 ]
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %2) #6
  %121 = getelementptr inbounds [20 x [20 x i32]], ptr @bad, i64 0, i64 %102, i64 %indvars.iv126
  %122 = load i32, ptr %121, align 4, !tbaa !5
  %123 = xor i32 %122, -1
  %124 = and i32 %104, %123
  %125 = zext nneg i32 %124 to i64
  %126 = getelementptr inbounds [1048576 x i32], ptr @dp, i64 0, i64 %125
  %127 = load i32, ptr %126, align 4, !tbaa !5
  %128 = getelementptr inbounds [20 x [20 x i32]], ptr @tot, i64 0, i64 %102, i64 %indvars.iv126
  %129 = load i32, ptr %128, align 4, !tbaa !5
  %130 = add nsw i32 %129, %127
  store i32 %130, ptr %2, align 4, !tbaa !5
  %131 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %101, ptr noundef nonnull align 4 dereferenceable(4) %2)
  %132 = load i32, ptr %131, align 4, !tbaa !5
  store i32 %132, ptr %101, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %2) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %3) #6
  %133 = load i32, ptr %107, align 4, !tbaa !5
  %134 = getelementptr inbounds [20 x [20 x i32]], ptr @a, i64 0, i64 %102, i64 %indvars.iv126
  %135 = load i32, ptr %134, align 4, !tbaa !5
  %136 = add nsw i32 %135, %133
  store i32 %136, ptr %3, align 4, !tbaa !5
  %137 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %101, ptr noundef nonnull align 4 dereferenceable(4) %3)
  %138 = load i32, ptr %137, align 4, !tbaa !5
  store i32 %138, ptr %101, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %3) #6
  %indvars.iv.next127 = add nuw nsw i64 %indvars.iv126, 1
  %139 = load i32, ptr @m, align 4, !tbaa !5
  %140 = sext i32 %139 to i64
  %141 = icmp slt i64 %indvars.iv.next127, %140
  br i1 %141, label %120, label %._crit_edge95.loopexit, !llvm.loop !26
}

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

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

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

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

; 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 #4 align 2

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

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

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

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

!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10, !12}
!12 = !{!"llvm.loop.unswitch.partial.disable"}
!13 = distinct !{!13, !10}
!14 = distinct !{!14, !10, !15, !16}
!15 = !{!"llvm.loop.isvectorized", i32 1}
!16 = !{!"llvm.loop.unroll.runtime.disable"}
!17 = distinct !{!17, !10, !12}
!18 = distinct !{!18, !10, !12}
!19 = !{!7, !7, i64 0}
!20 = distinct !{!20, !10}
!21 = distinct !{!21, !10, !16, !15}
!22 = distinct !{!22, !23}
!23 = !{!"llvm.loop.unroll.disable"}
!24 = distinct !{!24, !10}
!25 = distinct !{!25, !10}
!26 = distinct !{!26, !10}


; Effective O3 passes: CorrelatedValuePropagationPass,DSEPass,EarlyCSEPass,GVNPass,GlobalDCEPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferAlignmentPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LICMPass,LoopLoadEliminationPass,LoopRotatePass,LoopSimplifyCFGPass,LoopSimplifyPass,LoopUnrollPass,LoopVectorizePass,ReassociatePass,SCCPPass,SROAPass,SimpleLoopUnswitchPass,SimplifyCFGPass,TailCallElimPass