; LLVM IR from VastoLorde95/Competitive-Programming :: Codeforces/145 Division 2/Problem D (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" }

@n = external dso_local global i32, align 4
@d = external dso_local global i32, align 4
@m = external dso_local global i32, align 4
@k = external dso_local global i32, align 4
@f = external dso_local global [101 x i32], align 16
@x = external dso_local global i32, align 4
@u = external dso_local global [101 x i32], align 16
@ff = external dso_local global [101 x i32], align 16
@res = external dso_local global [101 x i32], align 16
@mn = external dso_local global [101 x i32], align 16
@mx = external dso_local global [101 x i32], align 16
@_Z1tB5cxx11 = external dso_local global [101 x %"class.std::__cxx11::basic_string"], align 16
@.str = external hidden unnamed_addr constant [10 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [2 x i8], align 1
@stdin = external global ptr, align 8
@.str.3 = external hidden unnamed_addr constant [11 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [2 x i8], align 1
@stdout = external global ptr, align 8
@.str.5 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [3 x i8], align 1
@_ZSt3cin = external global %"class.std::basic_istream", align 8
@_ZSt4cout = external global %"class.std::basic_ostream", align 8

; 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 i8, align 1
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  store i32 0, ptr %1, align 4
  %12 = load ptr, ptr @stdin, align 8, !tbaa !5
  %13 = call ptr @freopen(ptr noundef @.str, ptr noundef @.str.2, ptr noundef %12)
  %14 = load ptr, ptr @stdout, align 8, !tbaa !5
  %15 = call ptr @freopen(ptr noundef @.str.3, ptr noundef @.str.4, ptr noundef %14)
  %16 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.5, ptr noundef @m, ptr noundef @k)
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #6
  store i32 1, ptr %2, align 4, !tbaa !9
  br label %17

17:                                               ; preds = %27, %0
  %18 = load i32, ptr %2, align 4, !tbaa !9
  %19 = load i32, ptr @k, align 4, !tbaa !9
  %20 = icmp sle i32 %18, %19
  br i1 %20, label %22, label %21

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

22:                                               ; preds = %17
  %23 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.6, ptr noundef @x)
  %24 = load i32, ptr @x, align 4, !tbaa !9
  %25 = sext i32 %24 to i64
  %26 = getelementptr inbounds [101 x i32], ptr @f, i64 0, i64 %25
  store i32 1, ptr %26, align 4, !tbaa !9
  br label %27

27:                                               ; preds = %22
  %28 = load i32, ptr %2, align 4, !tbaa !9
  %29 = add nsw i32 %28, 1
  store i32 %29, ptr %2, align 4, !tbaa !9
  br label %17, !llvm.loop !11

30:                                               ; preds = %21
  %31 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.6, ptr noundef @n)
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #6
  store i32 1, ptr %3, align 4, !tbaa !9
  br label %32

32:                                               ; preds = %153, %30
  %33 = load i32, ptr %3, align 4, !tbaa !9
  %34 = load i32, ptr @n, align 4, !tbaa !9
  %35 = icmp sle 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) #6
  br label %156

37:                                               ; preds = %32
  %38 = load i32, ptr %3, align 4, !tbaa !9
  %39 = sext i32 %38 to i64
  %40 = getelementptr inbounds [101 x %"class.std::__cxx11::basic_string"], ptr @_Z1tB5cxx11, 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)
  %42 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.6, ptr noundef @d)
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #6
  store i32 0, ptr %5, align 4, !tbaa !9
  br label %43

43:                                               ; preds = %72, %37
  %44 = load i32, ptr %5, align 4, !tbaa !9
  %45 = load i32, ptr @d, align 4, !tbaa !9
  %46 = icmp slt i32 %44, %45
  br i1 %46, label %48, label %47

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

48:                                               ; preds = %43
  %49 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.6, ptr noundef @x)
  %50 = load i32, ptr @x, align 4, !tbaa !9
  %51 = icmp eq i32 %50, 0
  br i1 %51, label %52, label %58

52:                                               ; preds = %48
  %53 = load i32, ptr %3, align 4, !tbaa !9
  %54 = sext i32 %53 to i64
  %55 = getelementptr inbounds [101 x i32], ptr @u, i64 0, i64 %54
  %56 = load i32, ptr %55, align 4, !tbaa !9
  %57 = add nsw i32 %56, 1
  store i32 %57, ptr %55, align 4, !tbaa !9
  br label %71

58:                                               ; preds = %48
  %59 = load i32, ptr @x, align 4, !tbaa !9
  %60 = sext i32 %59 to i64
  %61 = getelementptr inbounds [101 x i32], ptr @f, i64 0, i64 %60
  %62 = load i32, ptr %61, align 4, !tbaa !9
  %63 = icmp ne i32 %62, 0
  br i1 %63, label %64, label %70

64:                                               ; preds = %58
  %65 = load i32, ptr %3, align 4, !tbaa !9
  %66 = sext i32 %65 to i64
  %67 = getelementptr inbounds [101 x i32], ptr @ff, i64 0, i64 %66
  %68 = load i32, ptr %67, align 4, !tbaa !9
  %69 = add nsw i32 %68, 1
  store i32 %69, ptr %67, align 4, !tbaa !9
  br label %70

70:                                               ; preds = %64, %58
  br label %71

71:                                               ; preds = %70, %52
  br label %72

72:                                               ; preds = %71
  %73 = load i32, ptr %5, align 4, !tbaa !9
  %74 = add nsw i32 %73, 1
  store i32 %74, ptr %5, align 4, !tbaa !9
  br label %43, !llvm.loop !13

75:                                               ; preds = %47
  %76 = load i32, ptr @m, align 4, !tbaa !9
  %77 = load i32, ptr @d, align 4, !tbaa !9
  %78 = load i32, ptr %3, align 4, !tbaa !9
  %79 = sext i32 %78 to i64
  %80 = getelementptr inbounds [101 x i32], ptr @u, i64 0, i64 %79
  %81 = load i32, ptr %80, align 4, !tbaa !9
  %82 = sub nsw i32 %77, %81
  %83 = sub nsw i32 %76, %82
  %84 = load i32, ptr @k, align 4, !tbaa !9
  %85 = load i32, ptr %3, align 4, !tbaa !9
  %86 = sext i32 %85 to i64
  %87 = getelementptr inbounds [101 x i32], ptr @ff, i64 0, i64 %86
  %88 = load i32, ptr %87, align 4, !tbaa !9
  %89 = sub nsw i32 %84, %88
  %90 = sub nsw i32 %83, %89
  %91 = load i32, ptr %3, align 4, !tbaa !9
  %92 = sext i32 %91 to i64
  %93 = getelementptr inbounds [101 x i32], ptr @u, i64 0, i64 %92
  %94 = load i32, ptr %93, align 4, !tbaa !9
  %95 = icmp sge i32 %90, %94
  br i1 %95, label %96, label %104

96:                                               ; preds = %75
  %97 = load i32, ptr %3, align 4, !tbaa !9
  %98 = sext i32 %97 to i64
  %99 = getelementptr inbounds [101 x i32], ptr @ff, i64 0, i64 %98
  %100 = load i32, ptr %99, align 4, !tbaa !9
  %101 = load i32, ptr %3, align 4, !tbaa !9
  %102 = sext i32 %101 to i64
  %103 = getelementptr inbounds [101 x i32], ptr @mn, i64 0, i64 %102
  store i32 %100, ptr %103, align 4, !tbaa !9
  br label %133

104:                                              ; preds = %75
  %105 = load i32, ptr %3, align 4, !tbaa !9
  %106 = sext i32 %105 to i64
  %107 = getelementptr inbounds [101 x i32], ptr @ff, i64 0, i64 %106
  %108 = load i32, ptr %107, align 4, !tbaa !9
  %109 = load i32, ptr %3, align 4, !tbaa !9
  %110 = sext i32 %109 to i64
  %111 = getelementptr inbounds [101 x i32], ptr @u, i64 0, i64 %110
  %112 = load i32, ptr %111, align 4, !tbaa !9
  %113 = add nsw i32 %108, %112
  %114 = load i32, ptr @m, align 4, !tbaa !9
  %115 = load i32, ptr @d, align 4, !tbaa !9
  %116 = load i32, ptr %3, align 4, !tbaa !9
  %117 = sext i32 %116 to i64
  %118 = getelementptr inbounds [101 x i32], ptr @u, i64 0, i64 %117
  %119 = load i32, ptr %118, align 4, !tbaa !9
  %120 = sub nsw i32 %115, %119
  %121 = sub nsw i32 %114, %120
  %122 = load i32, ptr @k, align 4, !tbaa !9
  %123 = load i32, ptr %3, align 4, !tbaa !9
  %124 = sext i32 %123 to i64
  %125 = getelementptr inbounds [101 x i32], ptr @ff, i64 0, i64 %124
  %126 = load i32, ptr %125, align 4, !tbaa !9
  %127 = sub nsw i32 %122, %126
  %128 = sub nsw i32 %121, %127
  %129 = sub nsw i32 %113, %128
  %130 = load i32, ptr %3, align 4, !tbaa !9
  %131 = sext i32 %130 to i64
  %132 = getelementptr inbounds [101 x i32], ptr @mn, i64 0, i64 %131
  store i32 %129, ptr %132, align 4, !tbaa !9
  br label %133

133:                                              ; preds = %104, %96
  %134 = load i32, ptr %3, align 4, !tbaa !9
  %135 = sext i32 %134 to i64
  %136 = getelementptr inbounds [101 x i32], ptr @ff, i64 0, i64 %135
  %137 = load i32, ptr %136, align 4, !tbaa !9
  %138 = load i32, ptr %3, align 4, !tbaa !9
  %139 = sext i32 %138 to i64
  %140 = getelementptr inbounds [101 x i32], ptr @u, i64 0, i64 %139
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #6
  %141 = load i32, ptr @k, align 4, !tbaa !9
  %142 = load i32, ptr %3, align 4, !tbaa !9
  %143 = sext i32 %142 to i64
  %144 = getelementptr inbounds [101 x i32], ptr @ff, i64 0, i64 %143
  %145 = load i32, ptr %144, align 4, !tbaa !9
  %146 = sub nsw i32 %141, %145
  store i32 %146, ptr %6, align 4, !tbaa !9
  %147 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %140, ptr noundef nonnull align 4 dereferenceable(4) %6)
  %148 = load i32, ptr %147, align 4, !tbaa !9
  %149 = add nsw i32 %137, %148
  %150 = load i32, ptr %3, align 4, !tbaa !9
  %151 = sext i32 %150 to i64
  %152 = getelementptr inbounds [101 x i32], ptr @mx, i64 0, i64 %151
  store i32 %149, ptr %152, align 4, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #6
  br label %153

153:                                              ; preds = %133
  %154 = load i32, ptr %3, align 4, !tbaa !9
  %155 = add nsw i32 %154, 1
  store i32 %155, ptr %3, align 4, !tbaa !9
  br label %32, !llvm.loop !14

156:                                              ; preds = %36
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #6
  store i32 1, ptr %7, align 4, !tbaa !9
  br label %157

157:                                              ; preds = %236, %156
  %158 = load i32, ptr %7, align 4, !tbaa !9
  %159 = load i32, ptr @n, align 4, !tbaa !9
  %160 = icmp sle i32 %158, %159
  br i1 %160, label %162, label %161

161:                                              ; preds = %157
  store i32 11, ptr %4, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #6
  br label %239

162:                                              ; preds = %157
  call void @llvm.lifetime.start.p0(i64 1, ptr %8) #6
  store i8 1, ptr %8, align 1, !tbaa !15
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #6
  store i32 1, ptr %9, align 4, !tbaa !9
  br label %163

163:                                              ; preds = %185, %162
  %164 = load i32, ptr %9, align 4, !tbaa !9
  %165 = load i32, ptr @n, align 4, !tbaa !9
  %166 = icmp sle i32 %164, %165
  br i1 %166, label %168, label %167

167:                                              ; preds = %163
  store i32 14, ptr %4, align 4
  br label %188

168:                                              ; preds = %163
  %169 = load i32, ptr %7, align 4, !tbaa !9
  %170 = load i32, ptr %9, align 4, !tbaa !9
  %171 = icmp eq i32 %169, %170
  br i1 %171, label %172, label %173

172:                                              ; preds = %168
  br label %185

173:                                              ; preds = %168
  %174 = load i32, ptr %7, align 4, !tbaa !9
  %175 = sext i32 %174 to i64
  %176 = getelementptr inbounds [101 x i32], ptr @mn, i64 0, i64 %175
  %177 = load i32, ptr %176, align 4, !tbaa !9
  %178 = load i32, ptr %9, align 4, !tbaa !9
  %179 = sext i32 %178 to i64
  %180 = getelementptr inbounds [101 x i32], ptr @mx, i64 0, i64 %179
  %181 = load i32, ptr %180, align 4, !tbaa !9
  %182 = icmp slt i32 %177, %181
  br i1 %182, label %183, label %184

183:                                              ; preds = %173
  store i8 0, ptr %8, align 1, !tbaa !15
  store i32 14, ptr %4, align 4
  br label %188

184:                                              ; preds = %173
  br label %185

185:                                              ; preds = %184, %172
  %186 = load i32, ptr %9, align 4, !tbaa !9
  %187 = add nsw i32 %186, 1
  store i32 %187, ptr %9, align 4, !tbaa !9
  br label %163, !llvm.loop !17

188:                                              ; preds = %183, %167
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #6
  br label %189

189:                                              ; preds = %188
  %190 = load i8, ptr %8, align 1, !tbaa !15, !range !18, !noundef !19
  %191 = trunc i8 %190 to i1
  br i1 %191, label %192, label %196

192:                                              ; preds = %189
  %193 = load i32, ptr %7, align 4, !tbaa !9
  %194 = sext i32 %193 to i64
  %195 = getelementptr inbounds [101 x i32], ptr @res, i64 0, i64 %194
  store i32 0, ptr %195, align 4, !tbaa !9
  br label %235

196:                                              ; preds = %189
  store i8 1, ptr %8, align 1, !tbaa !15
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #6
  store i32 1, ptr %10, align 4, !tbaa !9
  br label %197

197:                                              ; preds = %219, %196
  %198 = load i32, ptr %10, align 4, !tbaa !9
  %199 = load i32, ptr @n, align 4, !tbaa !9
  %200 = icmp sle i32 %198, %199
  br i1 %200, label %202, label %201

201:                                              ; preds = %197
  store i32 17, ptr %4, align 4
  br label %222

202:                                              ; preds = %197
  %203 = load i32, ptr %7, align 4, !tbaa !9
  %204 = load i32, ptr %10, align 4, !tbaa !9
  %205 = icmp eq i32 %203, %204
  br i1 %205, label %206, label %207

206:                                              ; preds = %202
  br label %219

207:                                              ; preds = %202
  %208 = load i32, ptr %7, align 4, !tbaa !9
  %209 = sext i32 %208 to i64
  %210 = getelementptr inbounds [101 x i32], ptr @mx, i64 0, i64 %209
  %211 = load i32, ptr %210, align 4, !tbaa !9
  %212 = load i32, ptr %10, align 4, !tbaa !9
  %213 = sext i32 %212 to i64
  %214 = getelementptr inbounds [101 x i32], ptr @mn, i64 0, i64 %213
  %215 = load i32, ptr %214, align 4, !tbaa !9
  %216 = icmp slt i32 %211, %215
  br i1 %216, label %217, label %218

217:                                              ; preds = %207
  store i8 0, ptr %8, align 1, !tbaa !15
  store i32 17, ptr %4, align 4
  br label %222

218:                                              ; preds = %207
  br label %219

219:                                              ; preds = %218, %206
  %220 = load i32, ptr %10, align 4, !tbaa !9
  %221 = add nsw i32 %220, 1
  store i32 %221, ptr %10, align 4, !tbaa !9
  br label %197, !llvm.loop !20

222:                                              ; preds = %217, %201
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #6
  br label %223

223:                                              ; preds = %222
  %224 = load i8, ptr %8, align 1, !tbaa !15, !range !18, !noundef !19
  %225 = trunc i8 %224 to i1
  br i1 %225, label %226, label %230

226:                                              ; preds = %223
  %227 = load i32, ptr %7, align 4, !tbaa !9
  %228 = sext i32 %227 to i64
  %229 = getelementptr inbounds [101 x i32], ptr @res, i64 0, i64 %228
  store i32 2, ptr %229, align 4, !tbaa !9
  br label %234

230:                                              ; preds = %223
  %231 = load i32, ptr %7, align 4, !tbaa !9
  %232 = sext i32 %231 to i64
  %233 = getelementptr inbounds [101 x i32], ptr @res, i64 0, i64 %232
  store i32 1, ptr %233, align 4, !tbaa !9
  br label %234

234:                                              ; preds = %230, %226
  br label %235

235:                                              ; preds = %234, %192
  call void @llvm.lifetime.end.p0(i64 1, ptr %8) #6
  br label %236

236:                                              ; preds = %235
  %237 = load i32, ptr %7, align 4, !tbaa !9
  %238 = add nsw i32 %237, 1
  store i32 %238, ptr %7, align 4, !tbaa !9
  br label %157, !llvm.loop !21

239:                                              ; preds = %161
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #6
  store i32 1, ptr %11, align 4, !tbaa !9
  br label %240

240:                                              ; preds = %252, %239
  %241 = load i32, ptr %11, align 4, !tbaa !9
  %242 = load i32, ptr @n, align 4, !tbaa !9
  %243 = icmp sle i32 %241, %242
  br i1 %243, label %245, label %244

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

245:                                              ; preds = %240
  %246 = load i32, ptr %11, align 4, !tbaa !9
  %247 = sext i32 %246 to i64
  %248 = getelementptr inbounds [101 x i32], ptr @res, i64 0, i64 %247
  %249 = load i32, ptr %248, align 4, !tbaa !9
  %250 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i32 noundef %249)
  %251 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %250, ptr noundef @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
  br label %252

252:                                              ; preds = %245
  %253 = load i32, ptr %11, align 4, !tbaa !9
  %254 = add nsw i32 %253, 1
  store i32 %254, ptr %11, align 4, !tbaa !9
  br label %240, !llvm.loop !22

255:                                              ; preds = %244
  ret i32 0
}

declare ptr @freopen(ptr noundef, ptr noundef, ptr noundef) #1

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: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.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: 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)) #3

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

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

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

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

@n = external dso_local global i32, align 4
@d = external dso_local global i32, align 4
@m = external dso_local global i32, align 4
@k = external dso_local global i32, align 4
@f = external dso_local local_unnamed_addr global [101 x i32], align 16
@x = external dso_local global i32, align 4
@u = external dso_local global [101 x i32], align 16
@ff = external dso_local local_unnamed_addr global [101 x i32], align 16
@res = external dso_local local_unnamed_addr global [101 x i32], align 16
@mn = external dso_local local_unnamed_addr global [101 x i32], align 16
@mx = external dso_local local_unnamed_addr global [101 x i32], align 16
@_Z1tB5cxx11 = external dso_local global [101 x %"class.std::__cxx11::basic_string"], align 16
@.str = external hidden unnamed_addr constant [10 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [2 x i8], align 1
@stdin = external local_unnamed_addr global ptr, align 8
@.str.3 = external hidden unnamed_addr constant [11 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [2 x i8], align 1
@stdout = external local_unnamed_addr global ptr, align 8
@.str.5 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [3 x i8], align 1
@_ZSt3cin = external global %"class.std::basic_istream", align 8
@_ZSt4cout = external global %"class.std::basic_ostream", align 8

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #0 {
  %1 = alloca i32, align 4
  %2 = load ptr, ptr @stdin, align 8, !tbaa !5
  %3 = tail call ptr @freopen(ptr noundef nonnull @.str, ptr noundef nonnull @.str.2, ptr noundef %2)
  %4 = load ptr, ptr @stdout, align 8, !tbaa !5
  %5 = tail call ptr @freopen(ptr noundef nonnull @.str.3, ptr noundef nonnull @.str.4, ptr noundef %4)
  %6 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.5, ptr noundef nonnull @m, ptr noundef nonnull @k)
  %7 = load i32, ptr @k, align 4, !tbaa !9
  %.not73 = icmp slt i32 %7, 1
  br i1 %.not73, label %._crit_edge, label %.lr.ph

._crit_edge:                                      ; preds = %.lr.ph, %0
  %8 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.6, ptr noundef nonnull @n)
  %9 = load i32, ptr @n, align 4, !tbaa !9
  %.not5679 = icmp slt i32 %9, 1
  br i1 %.not5679, label %._crit_edge98, label %.lr.ph82

.lr.ph:                                           ; preds = %0, %.lr.ph
  %.05174 = phi i32 [ %14, %.lr.ph ], [ 1, %0 ]
  %10 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.6, ptr noundef nonnull @x)
  %11 = load i32, ptr @x, align 4, !tbaa !9
  %12 = sext i32 %11 to i64
  %13 = getelementptr inbounds [101 x i32], ptr @f, i64 0, i64 %12
  store i32 1, ptr %13, align 4, !tbaa !9
  %14 = add nuw nsw i32 %.05174, 1
  %15 = load i32, ptr @k, align 4, !tbaa !9
  %.not.not = icmp slt i32 %.05174, %15
  br i1 %.not.not, label %.lr.ph, label %._crit_edge, !llvm.loop !11

.preheader70:                                     ; preds = %._crit_edge78
  %.not5790 = icmp slt i32 %38, 1
  br i1 %.not5790, label %._crit_edge98, label %.preheader69.preheader

.preheader69.preheader:                           ; preds = %.preheader70
  %16 = add nuw i32 %38, 1
  %wide.trip.count113 = zext i32 %16 to i64
  br label %.preheader69

.lr.ph82:                                         ; preds = %._crit_edge, %._crit_edge78
  %indvars.iv = phi i64 [ %indvars.iv.next, %._crit_edge78 ], [ 1, %._crit_edge ]
  %17 = getelementptr inbounds [101 x %"class.std::__cxx11::basic_string"], ptr @_Z1tB5cxx11, i64 0, i64 %indvars.iv
  %18 = 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) %17)
  %19 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.6, ptr noundef nonnull @d)
  %20 = load i32, ptr @d, align 4, !tbaa !9
  %21 = icmp sgt i32 %20, 0
  br i1 %21, label %.lr.ph77, label %._crit_edge78

._crit_edge78:                                    ; preds = %49, %.lr.ph82
  %.lcssa71 = phi i32 [ %20, %.lr.ph82 ], [ %51, %49 ]
  %22 = load i32, ptr @m, align 4, !tbaa !9
  %23 = getelementptr inbounds [101 x i32], ptr @u, i64 0, i64 %indvars.iv
  %24 = load i32, ptr %23, align 4, !tbaa !9
  %25 = load i32, ptr @k, align 4, !tbaa !9
  %26 = getelementptr inbounds [101 x i32], ptr @ff, i64 0, i64 %indvars.iv
  %27 = load i32, ptr %26, align 4, !tbaa !9
  %.neg61 = sub i32 %27, %25
  %.neg = sub i32 %22, %.lcssa71
  %28 = add i32 %.neg, %24
  %29 = add i32 %28, %.neg61
  %.not62 = icmp slt i32 %29, %24
  %30 = add nsw i32 %27, %24
  %31 = sub i32 %30, %29
  %.sink = select i1 %.not62, i32 %31, i32 %27
  %32 = getelementptr inbounds [101 x i32], ptr @mn, i64 0, i64 %indvars.iv
  store i32 %.sink, ptr %32, align 4
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %1) #7
  %33 = sub nsw i32 %25, %27
  store i32 %33, ptr %1, align 4, !tbaa !9
  %34 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %23, ptr noundef nonnull align 4 dereferenceable(4) %1)
  %35 = load i32, ptr %34, align 4, !tbaa !9
  %36 = add nsw i32 %35, %27
  %37 = getelementptr inbounds [101 x i32], ptr @mx, i64 0, i64 %indvars.iv
  store i32 %36, ptr %37, align 4, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #7
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %38 = load i32, ptr @n, align 4, !tbaa !9
  %39 = sext i32 %38 to i64
  %.not56.not = icmp slt i64 %indvars.iv, %39
  br i1 %.not56.not, label %.lr.ph82, label %.preheader70, !llvm.loop !13

.lr.ph77:                                         ; preds = %.lr.ph82, %49
  %.04975 = phi i32 [ %50, %49 ], [ 0, %.lr.ph82 ]
  %40 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.6, ptr noundef nonnull @x)
  %41 = load i32, ptr @x, align 4, !tbaa !9
  %42 = icmp eq i32 %41, 0
  br i1 %42, label %.sink.split, label %43

43:                                               ; preds = %.lr.ph77
  %44 = sext i32 %41 to i64
  %45 = getelementptr inbounds [101 x i32], ptr @f, i64 0, i64 %44
  %46 = load i32, ptr %45, align 4, !tbaa !9
  %.not63 = icmp eq i32 %46, 0
  br i1 %.not63, label %49, label %.sink.split

.sink.split:                                      ; preds = %43, %.lr.ph77
  %u.pn = phi ptr [ @u, %.lr.ph77 ], [ @ff, %43 ]
  %.sink125 = getelementptr inbounds [101 x i32], ptr %u.pn, i64 0, i64 %indvars.iv
  %47 = load i32, ptr %.sink125, align 4, !tbaa !9
  %48 = add nsw i32 %47, 1
  store i32 %48, ptr %.sink125, align 4, !tbaa !9
  br label %49

49:                                               ; preds = %.sink.split, %43
  %50 = add nuw nsw i32 %.04975, 1
  %51 = load i32, ptr @d, align 4, !tbaa !9
  %52 = icmp slt i32 %50, %51
  br i1 %52, label %.lr.ph77, label %._crit_edge78, !llvm.loop !14

.preheader69:                                     ; preds = %.preheader69.preheader, %..critedge_crit_edge
  %indvars.iv110 = phi i64 [ 1, %.preheader69.preheader ], [ %indvars.iv.next111, %..critedge_crit_edge ]
  %53 = getelementptr inbounds [101 x i32], ptr @mn, i64 0, i64 %indvars.iv110
  br label %54

.preheader:                                       ; preds = %..critedge_crit_edge
  br i1 %.not5790, label %._crit_edge98, label %.lr.ph97

54:                                               ; preds = %.preheader69, %62
  %indvars.iv102 = phi i64 [ 1, %.preheader69 ], [ %indvars.iv.next103, %62 ]
  %55 = icmp eq i64 %indvars.iv110, %indvars.iv102
  br i1 %55, label %62, label %56

56:                                               ; preds = %54
  %57 = load i32, ptr %53, align 4, !tbaa !9
  %58 = getelementptr inbounds [101 x i32], ptr @mx, i64 0, i64 %indvars.iv102
  %59 = load i32, ptr %58, align 4, !tbaa !9
  %60 = icmp slt i32 %57, %59
  br i1 %60, label %.preheader68, label %62

.preheader68:                                     ; preds = %56
  %61 = getelementptr inbounds [101 x i32], ptr @mx, i64 0, i64 %indvars.iv110
  br label %63

62:                                               ; preds = %56, %54
  %indvars.iv.next103 = add nuw nsw i64 %indvars.iv102, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next103, %wide.trip.count113
  br i1 %exitcond.not, label %..critedge_crit_edge, label %54, !llvm.loop !15

63:                                               ; preds = %.preheader68, %70
  %indvars.iv105 = phi i64 [ 1, %.preheader68 ], [ %indvars.iv.next106, %70 ]
  %64 = icmp eq i64 %indvars.iv110, %indvars.iv105
  br i1 %64, label %70, label %65

65:                                               ; preds = %63
  %66 = load i32, ptr %61, align 4, !tbaa !9
  %67 = getelementptr inbounds [101 x i32], ptr @mn, i64 0, i64 %indvars.iv105
  %68 = load i32, ptr %67, align 4, !tbaa !9
  %69 = icmp slt i32 %66, %68
  br i1 %69, label %..critedge_crit_edge, label %70

70:                                               ; preds = %65, %63
  %indvars.iv.next106 = add nuw nsw i64 %indvars.iv105, 1
  %exitcond109.not = icmp eq i64 %indvars.iv.next106, %wide.trip.count113
  br i1 %exitcond109.not, label %..critedge_crit_edge, label %63, !llvm.loop !16

..critedge_crit_edge:                             ; preds = %62, %65, %70
  %.sink126 = phi i32 [ 2, %70 ], [ 1, %65 ], [ 0, %62 ]
  %71 = getelementptr inbounds [101 x i32], ptr @res, i64 0, i64 %indvars.iv110
  store i32 %.sink126, ptr %71, align 4, !tbaa !9
  %indvars.iv.next111 = add nuw nsw i64 %indvars.iv110, 1
  %exitcond114.not = icmp eq i64 %indvars.iv.next111, %wide.trip.count113
  br i1 %exitcond114.not, label %.preheader, label %.preheader69, !llvm.loop !17

._crit_edge98:                                    ; preds = %.lr.ph97, %._crit_edge, %.preheader70, %.preheader
  ret i32 0

.lr.ph97:                                         ; preds = %.preheader, %.lr.ph97
  %indvars.iv115 = phi i64 [ %indvars.iv.next116, %.lr.ph97 ], [ 1, %.preheader ]
  %72 = getelementptr inbounds [101 x i32], ptr @res, i64 0, i64 %indvars.iv115
  %73 = load i32, ptr %72, align 4, !tbaa !9
  %74 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i32 noundef %73)
  %75 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %74, ptr noundef nonnull @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
  %indvars.iv.next116 = add nuw nsw i64 %indvars.iv115, 1
  %76 = load i32, ptr @n, align 4, !tbaa !9
  %77 = sext i32 %76 to i64
  %.not58.not = icmp slt i64 %indvars.iv115, %77
  br i1 %.not58.not, label %.lr.ph97, label %._crit_edge98, !llvm.loop !18
}

declare ptr @freopen(ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #1

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

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

; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.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)) local_unnamed_addr #1

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

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 uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef) local_unnamed_addr #5 align 2

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

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 = { 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 #3 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { 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 #6 = { 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 #7 = { 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 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = distinct !{!13, !12}
!14 = distinct !{!14, !12}
!15 = distinct !{!15, !12}
!16 = distinct !{!16, !12}
!17 = distinct !{!17, !12}
!18 = distinct !{!18, !12}


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