; LLVM IR from VastoLorde95/Competitive-Programming :: Codeforces/333 Division 2/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::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl" }
%"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl" = type { %"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl_data" }
%"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl_data" = type { ptr, ptr, ptr }

@n = external dso_local global i32, align 4
@mm = external dso_local global i32, align 4
@g = external dso_local global [410 x %"class.std::vector"], align 16
@m = external dso_local global [410 x [410 x i32]], align 16
@inf = external dso_local global i32, align 4
@.str = external hidden unnamed_addr constant [5 x i8], align 1
@.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
  store i32 0, ptr %1, align 4
  %14 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef @n, ptr noundef @mm)
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #6
  store i32 0, ptr %2, align 4, !tbaa !5
  br label %15

15:                                               ; preds = %37, %0
  %16 = load i32, ptr %2, align 4, !tbaa !5
  %17 = load i32, ptr @mm, align 4, !tbaa !5
  %18 = icmp slt i32 %16, %17
  br i1 %18, label %20, label %19

19:                                               ; preds = %15
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #6
  br label %40

20:                                               ; preds = %15
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #6
  %21 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef %3, ptr noundef %4)
  %22 = load i32, ptr %3, align 4, !tbaa !5
  %23 = sext i32 %22 to i64
  %24 = getelementptr inbounds [410 x %"class.std::vector"], ptr @g, i64 0, i64 %23
  call void @_ZNSt6vectorIiSaIiEE9push_backERKi(ptr noundef nonnull align 8 dereferenceable(24) %24, ptr noundef nonnull align 4 dereferenceable(4) %4)
  %25 = load i32, ptr %4, align 4, !tbaa !5
  %26 = sext i32 %25 to i64
  %27 = getelementptr inbounds [410 x [410 x i32]], ptr @m, i64 0, i64 %26
  %28 = load i32, ptr %3, align 4, !tbaa !5
  %29 = sext i32 %28 to i64
  %30 = getelementptr inbounds [410 x i32], ptr %27, i64 0, i64 %29
  store i32 1, ptr %30, align 4, !tbaa !5
  %31 = load i32, ptr %3, align 4, !tbaa !5
  %32 = sext i32 %31 to i64
  %33 = getelementptr inbounds [410 x [410 x i32]], ptr @m, i64 0, i64 %32
  %34 = load i32, ptr %4, align 4, !tbaa !5
  %35 = sext i32 %34 to i64
  %36 = getelementptr inbounds [410 x i32], ptr %33, i64 0, i64 %35
  store i32 1, ptr %36, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #6
  br label %37

37:                                               ; preds = %20
  %38 = load i32, ptr %2, align 4, !tbaa !5
  %39 = add nsw i32 %38, 1
  store i32 %39, ptr %2, align 4, !tbaa !5
  br label %15, !llvm.loop !9

40:                                               ; preds = %19
  %41 = load i32, ptr @n, align 4, !tbaa !5
  %42 = sext i32 %41 to i64
  %43 = getelementptr inbounds [410 x i32], ptr getelementptr inbounds ([410 x [410 x i32]], ptr @m, i64 0, i64 1), i64 0, i64 %42
  %44 = load i32, ptr %43, align 4, !tbaa !5
  %45 = icmp ne i32 %44, 0
  br i1 %45, label %46, label %110

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

47:                                               ; preds = %106, %46
  %48 = load i32, ptr %5, align 4, !tbaa !5
  %49 = load i32, ptr @n, align 4, !tbaa !5
  %50 = icmp sle i32 %48, %49
  br i1 %50, label %52, label %51

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

52:                                               ; preds = %47
  %53 = load i32, ptr %5, align 4, !tbaa !5
  %54 = sext i32 %53 to i64
  %55 = getelementptr inbounds [410 x %"class.std::vector"], ptr @g, i64 0, i64 %54
  call void @_ZNSt6vectorIiSaIiEE5clearEv(ptr noundef nonnull align 8 dereferenceable(24) %55) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #6
  store i32 1, ptr %7, align 4, !tbaa !5
  br label %56

56:                                               ; preds = %102, %52
  %57 = load i32, ptr %7, align 4, !tbaa !5
  %58 = load i32, ptr @n, align 4, !tbaa !5
  %59 = icmp sle i32 %57, %58
  br i1 %59, label %61, label %60

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

61:                                               ; preds = %56
  %62 = load i32, ptr %5, align 4, !tbaa !5
  %63 = load i32, ptr %7, align 4, !tbaa !5
  %64 = icmp eq i32 %62, %63
  br i1 %64, label %65, label %66

65:                                               ; preds = %61
  br label %102

66:                                               ; preds = %61
  %67 = load i32, ptr %5, align 4, !tbaa !5
  %68 = sext i32 %67 to i64
  %69 = getelementptr inbounds [410 x [410 x i32]], ptr @m, i64 0, i64 %68
  %70 = load i32, ptr %7, align 4, !tbaa !5
  %71 = sext i32 %70 to i64
  %72 = getelementptr inbounds [410 x i32], ptr %69, i64 0, i64 %71
  %73 = load i32, ptr %72, align 4, !tbaa !5
  %74 = sub nsw i32 1, %73
  %75 = load i32, ptr %5, align 4, !tbaa !5
  %76 = sext i32 %75 to i64
  %77 = getelementptr inbounds [410 x [410 x i32]], ptr @m, i64 0, i64 %76
  %78 = load i32, ptr %7, align 4, !tbaa !5
  %79 = sext i32 %78 to i64
  %80 = getelementptr inbounds [410 x i32], ptr %77, i64 0, i64 %79
  store i32 %74, ptr %80, align 4, !tbaa !5
  %81 = load i32, ptr %5, align 4, !tbaa !5
  %82 = sext i32 %81 to i64
  %83 = getelementptr inbounds [410 x [410 x i32]], ptr @m, i64 0, i64 %82
  %84 = load i32, ptr %7, align 4, !tbaa !5
  %85 = sext i32 %84 to i64
  %86 = getelementptr inbounds [410 x i32], ptr %83, i64 0, i64 %85
  %87 = load i32, ptr %86, align 4, !tbaa !5
  %88 = icmp eq i32 %87, 1
  br i1 %88, label %89, label %93

89:                                               ; preds = %66
  %90 = load i32, ptr %5, align 4, !tbaa !5
  %91 = sext i32 %90 to i64
  %92 = getelementptr inbounds [410 x %"class.std::vector"], ptr @g, i64 0, i64 %91
  call void @_ZNSt6vectorIiSaIiEE9push_backERKi(ptr noundef nonnull align 8 dereferenceable(24) %92, ptr noundef nonnull align 4 dereferenceable(4) %7)
  br label %101

93:                                               ; preds = %66
  %94 = load i32, ptr @inf, align 4, !tbaa !5
  %95 = load i32, ptr %5, align 4, !tbaa !5
  %96 = sext i32 %95 to i64
  %97 = getelementptr inbounds [410 x [410 x i32]], ptr @m, i64 0, i64 %96
  %98 = load i32, ptr %7, align 4, !tbaa !5
  %99 = sext i32 %98 to i64
  %100 = getelementptr inbounds [410 x i32], ptr %97, i64 0, i64 %99
  store i32 %94, ptr %100, align 4, !tbaa !5
  br label %101

101:                                              ; preds = %93, %89
  br label %102

102:                                              ; preds = %101, %65
  %103 = load i32, ptr %7, align 4, !tbaa !5
  %104 = add nsw i32 %103, 1
  store i32 %104, ptr %7, align 4, !tbaa !5
  br label %56, !llvm.loop !11

105:                                              ; preds = %60
  br label %106

106:                                              ; preds = %105
  %107 = load i32, ptr %5, align 4, !tbaa !5
  %108 = add nsw i32 %107, 1
  store i32 %108, ptr %5, align 4, !tbaa !5
  br label %47, !llvm.loop !12

109:                                              ; preds = %51
  br label %153

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

111:                                              ; preds = %149, %110
  %112 = load i32, ptr %8, align 4, !tbaa !5
  %113 = load i32, ptr @n, align 4, !tbaa !5
  %114 = icmp sle i32 %112, %113
  br i1 %114, label %116, label %115

115:                                              ; preds = %111
  store i32 11, ptr %6, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #6
  br label %152

116:                                              ; preds = %111
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #6
  store i32 1, ptr %9, align 4, !tbaa !5
  br label %117

117:                                              ; preds = %145, %116
  %118 = load i32, ptr %9, align 4, !tbaa !5
  %119 = load i32, ptr @n, align 4, !tbaa !5
  %120 = icmp sle i32 %118, %119
  br i1 %120, label %122, label %121

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

122:                                              ; preds = %117
  %123 = load i32, ptr %8, align 4, !tbaa !5
  %124 = load i32, ptr %9, align 4, !tbaa !5
  %125 = icmp eq i32 %123, %124
  br i1 %125, label %126, label %127

126:                                              ; preds = %122
  br label %145

127:                                              ; preds = %122
  %128 = load i32, ptr %8, align 4, !tbaa !5
  %129 = sext i32 %128 to i64
  %130 = getelementptr inbounds [410 x [410 x i32]], ptr @m, i64 0, i64 %129
  %131 = load i32, ptr %9, align 4, !tbaa !5
  %132 = sext i32 %131 to i64
  %133 = getelementptr inbounds [410 x i32], ptr %130, i64 0, i64 %132
  %134 = load i32, ptr %133, align 4, !tbaa !5
  %135 = icmp eq i32 %134, 0
  br i1 %135, label %136, label %144

136:                                              ; preds = %127
  %137 = load i32, ptr @inf, align 4, !tbaa !5
  %138 = load i32, ptr %8, align 4, !tbaa !5
  %139 = sext i32 %138 to i64
  %140 = getelementptr inbounds [410 x [410 x i32]], ptr @m, i64 0, i64 %139
  %141 = load i32, ptr %9, align 4, !tbaa !5
  %142 = sext i32 %141 to i64
  %143 = getelementptr inbounds [410 x i32], ptr %140, i64 0, i64 %142
  store i32 %137, ptr %143, align 4, !tbaa !5
  br label %144

144:                                              ; preds = %136, %127
  br label %145

145:                                              ; preds = %144, %126
  %146 = load i32, ptr %9, align 4, !tbaa !5
  %147 = add nsw i32 %146, 1
  store i32 %147, ptr %9, align 4, !tbaa !5
  br label %117, !llvm.loop !13

148:                                              ; preds = %121
  br label %149

149:                                              ; preds = %148
  %150 = load i32, ptr %8, align 4, !tbaa !5
  %151 = add nsw i32 %150, 1
  store i32 %151, ptr %8, align 4, !tbaa !5
  br label %111, !llvm.loop !14

152:                                              ; preds = %115
  br label %153

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

154:                                              ; preds = %209, %153
  %155 = load i32, ptr %10, align 4, !tbaa !5
  %156 = load i32, ptr @n, align 4, !tbaa !5
  %157 = icmp sle i32 %155, %156
  br i1 %157, label %159, label %158

158:                                              ; preds = %154
  store i32 17, ptr %6, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #6
  br label %212

159:                                              ; preds = %154
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #6
  store i32 1, ptr %11, align 4, !tbaa !5
  br label %160

160:                                              ; preds = %205, %159
  %161 = load i32, ptr %11, align 4, !tbaa !5
  %162 = load i32, ptr @n, align 4, !tbaa !5
  %163 = icmp sle i32 %161, %162
  br i1 %163, label %165, label %164

164:                                              ; preds = %160
  store i32 20, ptr %6, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #6
  br label %208

165:                                              ; preds = %160
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #6
  store i32 1, ptr %12, align 4, !tbaa !5
  br label %166

166:                                              ; preds = %201, %165
  %167 = load i32, ptr %12, align 4, !tbaa !5
  %168 = load i32, ptr @n, align 4, !tbaa !5
  %169 = icmp sle i32 %167, %168
  br i1 %169, label %171, label %170

170:                                              ; preds = %166
  store i32 23, ptr %6, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #6
  br label %204

171:                                              ; preds = %166
  %172 = load i32, ptr %11, align 4, !tbaa !5
  %173 = sext i32 %172 to i64
  %174 = getelementptr inbounds [410 x [410 x i32]], ptr @m, i64 0, i64 %173
  %175 = load i32, ptr %12, align 4, !tbaa !5
  %176 = sext i32 %175 to i64
  %177 = getelementptr inbounds [410 x i32], ptr %174, i64 0, i64 %176
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #6
  %178 = load i32, ptr %11, align 4, !tbaa !5
  %179 = sext i32 %178 to i64
  %180 = getelementptr inbounds [410 x [410 x i32]], ptr @m, i64 0, i64 %179
  %181 = load i32, ptr %10, align 4, !tbaa !5
  %182 = sext i32 %181 to i64
  %183 = getelementptr inbounds [410 x i32], ptr %180, i64 0, i64 %182
  %184 = load i32, ptr %183, align 4, !tbaa !5
  %185 = load i32, ptr %10, align 4, !tbaa !5
  %186 = sext i32 %185 to i64
  %187 = getelementptr inbounds [410 x [410 x i32]], ptr @m, i64 0, i64 %186
  %188 = load i32, ptr %12, align 4, !tbaa !5
  %189 = sext i32 %188 to i64
  %190 = getelementptr inbounds [410 x i32], ptr %187, i64 0, i64 %189
  %191 = load i32, ptr %190, align 4, !tbaa !5
  %192 = add nsw i32 %184, %191
  store i32 %192, ptr %13, align 4, !tbaa !5
  %193 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %177, ptr noundef nonnull align 4 dereferenceable(4) %13)
  %194 = load i32, ptr %193, align 4, !tbaa !5
  %195 = load i32, ptr %11, align 4, !tbaa !5
  %196 = sext i32 %195 to i64
  %197 = getelementptr inbounds [410 x [410 x i32]], ptr @m, i64 0, i64 %196
  %198 = load i32, ptr %12, align 4, !tbaa !5
  %199 = sext i32 %198 to i64
  %200 = getelementptr inbounds [410 x i32], ptr %197, i64 0, i64 %199
  store i32 %194, ptr %200, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #6
  br label %201

201:                                              ; preds = %171
  %202 = load i32, ptr %12, align 4, !tbaa !5
  %203 = add nsw i32 %202, 1
  store i32 %203, ptr %12, align 4, !tbaa !5
  br label %166, !llvm.loop !15

204:                                              ; preds = %170
  br label %205

205:                                              ; preds = %204
  %206 = load i32, ptr %11, align 4, !tbaa !5
  %207 = add nsw i32 %206, 1
  store i32 %207, ptr %11, align 4, !tbaa !5
  br label %160, !llvm.loop !16

208:                                              ; preds = %164
  br label %209

209:                                              ; preds = %208
  %210 = load i32, ptr %10, align 4, !tbaa !5
  %211 = add nsw i32 %210, 1
  store i32 %211, ptr %10, align 4, !tbaa !5
  br label %154, !llvm.loop !17

212:                                              ; preds = %158
  %213 = load i32, ptr @n, align 4, !tbaa !5
  %214 = sext i32 %213 to i64
  %215 = getelementptr inbounds [410 x i32], ptr getelementptr inbounds ([410 x [410 x i32]], ptr @m, i64 0, i64 1), i64 0, i64 %214
  %216 = load i32, ptr %215, align 4, !tbaa !5
  %217 = load i32, ptr @inf, align 4, !tbaa !5
  %218 = icmp eq i32 %216, %217
  br i1 %218, label %219, label %221

219:                                              ; preds = %212
  %220 = call i32 @puts(ptr noundef @.str.2)
  br label %227

221:                                              ; preds = %212
  %222 = load i32, ptr @n, align 4, !tbaa !5
  %223 = sext i32 %222 to i64
  %224 = getelementptr inbounds [410 x i32], ptr getelementptr inbounds ([410 x [410 x i32]], ptr @m, i64 0, i64 1), i64 0, i64 %223
  %225 = load i32, ptr %224, align 4, !tbaa !5
  %226 = call i32 (ptr, ...) @printf(ptr noundef @.str.3, i32 noundef %225)
  br label %227

227:                                              ; preds = %221, %219
  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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt6vectorIiSaIiEE9push_backERKi(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 4 dereferenceable(4)) #3 align 2

; 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 dso_local void @_ZNSt6vectorIiSaIiEE5clearEv(ptr noundef nonnull align 8 dereferenceable(24)) #4 align 2

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

declare i32 @puts(ptr noundef) #1

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 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 = { 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 = distinct !{!12, !10}
!13 = distinct !{!13, !10}
!14 = distinct !{!14, !10}
!15 = distinct !{!15, !10}
!16 = distinct !{!16, !10}
!17 = distinct !{!17, !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::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl" }
%"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl" = type { %"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl_data" }
%"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl_data" = type { ptr, ptr, ptr }

@n = external dso_local global i32, align 4
@mm = external dso_local global i32, align 4
@g = external dso_local global [410 x %"class.std::vector"], align 16
@m = external dso_local global [410 x [410 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
@.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 = alloca i32, align 4
  %5 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @n, ptr noundef nonnull @mm)
  %6 = load i32, ptr @mm, align 4, !tbaa !5
  %7 = icmp sgt i32 %6, 0
  br i1 %7, label %.lr.ph, label %._crit_edge

._crit_edge:                                      ; preds = %.lr.ph, %0
  %8 = load i32, ptr @n, align 4, !tbaa !5
  %9 = sext i32 %8 to i64
  %10 = getelementptr inbounds [410 x i32], ptr getelementptr inbounds (i8, ptr @m, i64 1640), i64 0, i64 %9
  %11 = load i32, ptr %10, align 4, !tbaa !5
  %.not = icmp eq i32 %11, 0
  %.not4469 = icmp slt i32 %8, 1
  br i1 %.not, label %.preheader53, label %.preheader54

.preheader54:                                     ; preds = %._crit_edge
  br i1 %.not4469, label %._crit_edge80, label %.lr.ph64

.preheader53:                                     ; preds = %._crit_edge
  br i1 %.not4469, label %._crit_edge80, label %.preheader52.lr.ph

.preheader52.lr.ph:                               ; preds = %.preheader53
  %12 = load i32, ptr @inf, align 4
  %13 = add nuw i32 %8, 1
  %wide.trip.count92 = zext i32 %13 to i64
  %14 = zext nneg i32 %8 to i64
  %xtraiter = and i64 %14, 1
  %15 = icmp eq i32 %13, 2
  %unroll_iter = and i64 %14, 2147483646
  %lcmp.mod.not = icmp eq i64 %xtraiter, 0
  br label %.preheader52

.lr.ph:                                           ; preds = %0, %.lr.ph
  %.04056 = phi i32 [ %26, %.lr.ph ], [ 0, %0 ]
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %1) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %2) #6
  %16 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %1, ptr noundef nonnull %2)
  %17 = load i32, ptr %1, align 4, !tbaa !5
  %18 = sext i32 %17 to i64
  %19 = getelementptr inbounds [410 x %"class.std::vector"], ptr @g, i64 0, i64 %18
  call void @_ZNSt6vectorIiSaIiEE9push_backERKi(ptr noundef nonnull align 8 dereferenceable(24) %19, ptr noundef nonnull align 4 dereferenceable(4) %2)
  %20 = load i32, ptr %2, align 4, !tbaa !5
  %21 = sext i32 %20 to i64
  %22 = load i32, ptr %1, align 4, !tbaa !5
  %23 = sext i32 %22 to i64
  %24 = getelementptr inbounds [410 x [410 x i32]], ptr @m, i64 0, i64 %21, i64 %23
  store i32 1, ptr %24, align 4, !tbaa !5
  %25 = getelementptr inbounds [410 x [410 x i32]], ptr @m, i64 0, i64 %23, i64 %21
  store i32 1, ptr %25, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %2) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #6
  %26 = add nuw nsw i32 %.04056, 1
  %27 = load i32, ptr @mm, align 4, !tbaa !5
  %28 = icmp slt i32 %26, %27
  br i1 %28, label %.lr.ph, label %._crit_edge, !llvm.loop !9

.lr.ph64:                                         ; preds = %.preheader54, %._crit_edge61
  %indvars.iv = phi i64 [ %indvars.iv.next, %._crit_edge61 ], [ 1, %.preheader54 ]
  %29 = getelementptr inbounds [410 x %"class.std::vector"], ptr @g, i64 0, i64 %indvars.iv
  call void @_ZNSt6vectorIiSaIiEE5clearEv(ptr noundef nonnull align 8 dereferenceable(24) %29) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %3) #6
  store i32 1, ptr %3, align 4, !tbaa !5
  %30 = load i32, ptr @n, align 4, !tbaa !5
  %.not5057 = icmp slt i32 %30, 1
  br i1 %.not5057, label %._crit_edge61, label %.lr.ph60

._crit_edge61:                                    ; preds = %45, %.lr.ph64
  %31 = phi i32 [ %30, %.lr.ph64 ], [ %46, %45 ]
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %3) #6
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %32 = sext i32 %31 to i64
  %.not46.not = icmp slt i64 %indvars.iv, %32
  br i1 %.not46.not, label %.lr.ph64, label %.loopexit, !llvm.loop !11

.lr.ph60:                                         ; preds = %.lr.ph64, %45
  %33 = phi i32 [ %46, %45 ], [ %30, %.lr.ph64 ]
  %storemerge58 = phi i32 [ %48, %45 ], [ 1, %.lr.ph64 ]
  %34 = zext i32 %storemerge58 to i64
  %35 = icmp eq i64 %indvars.iv, %34
  br i1 %35, label %45, label %36

36:                                               ; preds = %.lr.ph60
  %37 = sext i32 %storemerge58 to i64
  %38 = getelementptr inbounds [410 x [410 x i32]], ptr @m, i64 0, i64 %indvars.iv, i64 %37
  %39 = load i32, ptr %38, align 4, !tbaa !5
  %40 = sub nsw i32 1, %39
  store i32 %40, ptr %38, align 4, !tbaa !5
  %41 = icmp eq i32 %39, 0
  br i1 %41, label %42, label %43

42:                                               ; preds = %36
  call void @_ZNSt6vectorIiSaIiEE9push_backERKi(ptr noundef nonnull align 8 dereferenceable(24) %29, ptr noundef nonnull align 4 dereferenceable(4) %3)
  %.pre = load i32, ptr %3, align 4, !tbaa !5
  %.pre103 = load i32, ptr @n, align 4, !tbaa !5
  br label %45

43:                                               ; preds = %36
  %44 = load i32, ptr @inf, align 4, !tbaa !5
  store i32 %44, ptr %38, align 4, !tbaa !5
  br label %45

45:                                               ; preds = %42, %43, %.lr.ph60
  %46 = phi i32 [ %.pre103, %42 ], [ %33, %43 ], [ %33, %.lr.ph60 ]
  %47 = phi i32 [ %.pre, %42 ], [ %storemerge58, %43 ], [ %storemerge58, %.lr.ph60 ]
  %48 = add nsw i32 %47, 1
  store i32 %48, ptr %3, align 4, !tbaa !5
  %.not50.not = icmp slt i32 %47, %46
  br i1 %.not50.not, label %.lr.ph60, label %._crit_edge61, !llvm.loop !12

.preheader52:                                     ; preds = %.preheader52.lr.ph, %._crit_edge68
  %indvars.iv89 = phi i64 [ 1, %.preheader52.lr.ph ], [ %indvars.iv.next90, %._crit_edge68 ]
  br i1 %15, label %._crit_edge68.unr-lcssa, label %.preheader52.new

._crit_edge68.unr-lcssa:                          ; preds = %68, %.preheader52
  %indvars.iv86.unr = phi i64 [ 1, %.preheader52 ], [ %indvars.iv.next87.1, %68 ]
  %49 = icmp eq i64 %indvars.iv89, %indvars.iv86.unr
  %or.cond = select i1 %lcmp.mod.not, i1 true, i1 %49
  br i1 %or.cond, label %._crit_edge68, label %50

50:                                               ; preds = %._crit_edge68.unr-lcssa
  %51 = getelementptr inbounds [410 x [410 x i32]], ptr @m, i64 0, i64 %indvars.iv89, i64 %indvars.iv86.unr
  %52 = load i32, ptr %51, align 4, !tbaa !5
  %53 = icmp eq i32 %52, 0
  br i1 %53, label %54, label %._crit_edge68

54:                                               ; preds = %50
  store i32 %12, ptr %51, align 4, !tbaa !5
  br label %._crit_edge68

._crit_edge68:                                    ; preds = %50, %54, %._crit_edge68.unr-lcssa
  %indvars.iv.next90 = add nuw nsw i64 %indvars.iv89, 1
  %exitcond93.not = icmp eq i64 %indvars.iv.next90, %wide.trip.count92
  br i1 %exitcond93.not, label %.loopexit, label %.preheader52, !llvm.loop !13

.preheader52.new:                                 ; preds = %.preheader52, %68
  %indvars.iv86 = phi i64 [ %indvars.iv.next87.1, %68 ], [ 1, %.preheader52 ]
  %niter = phi i64 [ %niter.next.1, %68 ], [ 0, %.preheader52 ]
  %55 = icmp eq i64 %indvars.iv89, %indvars.iv86
  br i1 %55, label %61, label %56

56:                                               ; preds = %.preheader52.new
  %57 = getelementptr inbounds [410 x [410 x i32]], ptr @m, i64 0, i64 %indvars.iv89, i64 %indvars.iv86
  %58 = load i32, ptr %57, align 4, !tbaa !5
  %59 = icmp eq i32 %58, 0
  br i1 %59, label %60, label %61

60:                                               ; preds = %56
  store i32 %12, ptr %57, align 4, !tbaa !5
  br label %61

61:                                               ; preds = %56, %60, %.preheader52.new
  %indvars.iv.next87 = add nuw nsw i64 %indvars.iv86, 1
  %62 = icmp eq i64 %indvars.iv89, %indvars.iv.next87
  br i1 %62, label %68, label %63

63:                                               ; preds = %61
  %64 = getelementptr inbounds [410 x [410 x i32]], ptr @m, i64 0, i64 %indvars.iv89, i64 %indvars.iv.next87
  %65 = load i32, ptr %64, align 4, !tbaa !5
  %66 = icmp eq i32 %65, 0
  br i1 %66, label %67, label %68

67:                                               ; preds = %63
  store i32 %12, ptr %64, align 4, !tbaa !5
  br label %68

68:                                               ; preds = %67, %63, %61
  %indvars.iv.next87.1 = add nuw nsw i64 %indvars.iv86, 2
  %niter.next.1 = add i64 %niter, 2
  %niter.ncmp.1 = icmp eq i64 %niter.next.1, %unroll_iter
  br i1 %niter.ncmp.1, label %._crit_edge68.unr-lcssa, label %.preheader52.new, !llvm.loop !14

.loopexit:                                        ; preds = %._crit_edge61, %._crit_edge68
  %69 = phi i32 [ %8, %._crit_edge68 ], [ %31, %._crit_edge61 ]
  %.not4778 = icmp slt i32 %69, 1
  br i1 %.not4778, label %._crit_edge80, label %.preheader51

.preheader51:                                     ; preds = %.loopexit, %._crit_edge77
  %70 = phi i32 [ %79, %._crit_edge77 ], [ %69, %.loopexit ]
  %indvars.iv100 = phi i64 [ %indvars.iv.next101, %._crit_edge77 ], [ 1, %.loopexit ]
  %.not4875 = icmp slt i32 %70, 1
  br i1 %.not4875, label %._crit_edge77, label %.preheader

._crit_edge80:                                    ; preds = %._crit_edge77, %.preheader53, %.preheader54, %.loopexit
  %.lcssa = phi i32 [ %69, %.loopexit ], [ %8, %.preheader54 ], [ %8, %.preheader53 ], [ %79, %._crit_edge77 ]
  %71 = sext i32 %.lcssa to i64
  %72 = getelementptr inbounds [410 x i32], ptr getelementptr inbounds (i8, ptr @m, i64 1640), i64 0, i64 %71
  %73 = load i32, ptr %72, align 4, !tbaa !5
  %74 = load i32, ptr @inf, align 4, !tbaa !5
  %75 = icmp eq i32 %73, %74
  br i1 %75, label %93, label %95

.preheader:                                       ; preds = %.preheader51, %._crit_edge74
  %76 = phi i32 [ %81, %._crit_edge74 ], [ %70, %.preheader51 ]
  %77 = phi i32 [ %82, %._crit_edge74 ], [ %70, %.preheader51 ]
  %indvars.iv97 = phi i64 [ %indvars.iv.next98, %._crit_edge74 ], [ 1, %.preheader51 ]
  %.not4971 = icmp slt i32 %77, 1
  br i1 %.not4971, label %.preheader.._crit_edge74_crit_edge, label %.lr.ph73

.preheader.._crit_edge74_crit_edge:               ; preds = %.preheader
  %.pre104 = sext i32 %77 to i64
  br label %._crit_edge74

.lr.ph73:                                         ; preds = %.preheader
  %78 = getelementptr inbounds [410 x [410 x i32]], ptr @m, i64 0, i64 %indvars.iv97, i64 %indvars.iv100
  br label %83

._crit_edge77:                                    ; preds = %._crit_edge74, %.preheader51
  %79 = phi i32 [ %70, %.preheader51 ], [ %81, %._crit_edge74 ]
  %indvars.iv.next101 = add nuw nsw i64 %indvars.iv100, 1
  %80 = sext i32 %79 to i64
  %.not47.not = icmp slt i64 %indvars.iv100, %80
  br i1 %.not47.not, label %.preheader51, label %._crit_edge80, !llvm.loop !15

._crit_edge74:                                    ; preds = %83, %.preheader.._crit_edge74_crit_edge
  %.pre-phi = phi i64 [ %.pre104, %.preheader.._crit_edge74_crit_edge ], [ %92, %83 ]
  %81 = phi i32 [ %76, %.preheader.._crit_edge74_crit_edge ], [ %91, %83 ]
  %82 = phi i32 [ %77, %.preheader.._crit_edge74_crit_edge ], [ %91, %83 ]
  %indvars.iv.next98 = add nuw nsw i64 %indvars.iv97, 1
  %.not48.not = icmp slt i64 %indvars.iv97, %.pre-phi
  br i1 %.not48.not, label %.preheader, label %._crit_edge77, !llvm.loop !17

83:                                               ; preds = %.lr.ph73, %83
  %indvars.iv94 = phi i64 [ 1, %.lr.ph73 ], [ %indvars.iv.next95, %83 ]
  %84 = getelementptr inbounds [410 x [410 x i32]], ptr @m, i64 0, i64 %indvars.iv97, i64 %indvars.iv94
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %4) #6
  %85 = load i32, ptr %78, align 4, !tbaa !5
  %86 = getelementptr inbounds [410 x [410 x i32]], ptr @m, i64 0, i64 %indvars.iv100, i64 %indvars.iv94
  %87 = load i32, ptr %86, align 4, !tbaa !5
  %88 = add nsw i32 %87, %85
  store i32 %88, ptr %4, align 4, !tbaa !5
  %89 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %84, ptr noundef nonnull align 4 dereferenceable(4) %4)
  %90 = load i32, ptr %89, align 4, !tbaa !5
  store i32 %90, ptr %84, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %4) #6
  %indvars.iv.next95 = add nuw nsw i64 %indvars.iv94, 1
  %91 = load i32, ptr @n, align 4, !tbaa !5
  %92 = sext i32 %91 to i64
  %.not49.not = icmp slt i64 %indvars.iv94, %92
  br i1 %.not49.not, label %83, label %._crit_edge74, !llvm.loop !18

93:                                               ; preds = %._crit_edge80
  %94 = call i32 @puts(ptr noundef nonnull dereferenceable(1) @.str.2)
  br label %97

95:                                               ; preds = %._crit_edge80
  %96 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %73)
  br label %97

97:                                               ; preds = %95, %93
  ret i32 0
}

; 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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt6vectorIiSaIiEE9push_backERKi(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 4 dereferenceable(4)) local_unnamed_addr #3 align 2

; 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 dso_local void @_ZNSt6vectorIiSaIiEE5clearEv(ptr noundef nonnull align 8 dereferenceable(24)) local_unnamed_addr #4 align 2

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

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

; 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 = { 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 #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 = distinct !{!12, !10}
!13 = distinct !{!13, !10}
!14 = distinct !{!14, !10}
!15 = distinct !{!15, !10, !16}
!16 = !{!"llvm.loop.unswitch.partial.disable"}
!17 = distinct !{!17, !10, !16}
!18 = distinct !{!18, !10}


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