; LLVM IR from VastoLorde95/Competitive-Programming :: Codeforces/321 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::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" }

@dp = external dso_local global [524288 x [19 x i64]], align 16
@n = external dso_local global i32, align 4
@m = external dso_local global i32, align 4
@k = external dso_local global i32, align 4
@a = external dso_local global [19 x i64], align 16
@sp = external dso_local global [20 x [20 x i64]], align 16
@ans = external dso_local global i64, align 8
@_ZSt3cin = external global %"class.std::basic_istream", align 8
@_ZSt4cerr = external global %"class.std::basic_ostream", align 8
@_ZSt4cout = external global %"class.std::basic_ostream", align 8
@.str = external hidden unnamed_addr constant [2 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 i64, align 8
  %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 i64, align 8
  store i32 0, ptr %1, align 4
  %14 = call noundef zeroext i1 @_ZNSt8ios_base15sync_with_stdioEb(i1 noundef zeroext false)
  %15 = load ptr, ptr @_ZSt3cin, align 8, !tbaa !5
  %16 = getelementptr i8, ptr %15, i64 -24
  %17 = load i64, ptr %16, align 8
  %18 = getelementptr inbounds i8, ptr @_ZSt3cin, i64 %17
  %19 = call noundef ptr @_ZNSt9basic_iosIcSt11char_traitsIcEE3tieEPSo(ptr noundef nonnull align 8 dereferenceable(264) %18, ptr noundef null)
  %20 = load ptr, ptr @_ZSt4cerr, align 8, !tbaa !5
  %21 = getelementptr i8, ptr %20, i64 -24
  %22 = load i64, ptr %21, align 8
  %23 = getelementptr inbounds i8, ptr @_ZSt4cerr, i64 %22
  %24 = call noundef ptr @_ZNSt9basic_iosIcSt11char_traitsIcEE3tieEPSo(ptr noundef nonnull align 8 dereferenceable(264) %23, ptr noundef null)
  %25 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) @n)
  %26 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %25, ptr noundef nonnull align 4 dereferenceable(4) @m)
  %27 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %26, ptr noundef nonnull align 4 dereferenceable(4) @k)
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #8
  store i32 0, ptr %2, align 4, !tbaa !8
  br label %28

28:                                               ; preds = %38, %0
  %29 = load i32, ptr %2, align 4, !tbaa !8
  %30 = load i32, ptr @n, align 4, !tbaa !8
  %31 = icmp slt i32 %29, %30
  br i1 %31, label %33, label %32

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

33:                                               ; preds = %28
  %34 = load i32, ptr %2, align 4, !tbaa !8
  %35 = sext i32 %34 to i64
  %36 = getelementptr inbounds [19 x i64], ptr @a, i64 0, i64 %35
  %37 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) %36)
  br label %38

38:                                               ; preds = %33
  %39 = load i32, ptr %2, align 4, !tbaa !8
  %40 = add nsw i32 %39, 1
  store i32 %40, ptr %2, align 4, !tbaa !8
  br label %28, !llvm.loop !11

41:                                               ; preds = %32
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #8
  store i32 1, ptr %3, align 4, !tbaa !8
  br label %42

42:                                               ; preds = %62, %41
  %43 = load i32, ptr %3, align 4, !tbaa !8
  %44 = load i32, ptr @k, align 4, !tbaa !8
  %45 = icmp sle i32 %43, %44
  br i1 %45, label %47, label %46

46:                                               ; preds = %42
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #8
  br label %65

47:                                               ; preds = %42
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #8
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #8
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #8
  %48 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) %4)
  %49 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %48, ptr noundef nonnull align 4 dereferenceable(4) %5)
  %50 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) %49, ptr noundef nonnull align 8 dereferenceable(8) %6)
  %51 = load i32, ptr %4, align 4, !tbaa !8
  %52 = add nsw i32 %51, -1
  store i32 %52, ptr %4, align 4, !tbaa !8
  %53 = load i32, ptr %5, align 4, !tbaa !8
  %54 = add nsw i32 %53, -1
  store i32 %54, ptr %5, align 4, !tbaa !8
  %55 = load i64, ptr %6, align 8, !tbaa !13
  %56 = load i32, ptr %4, align 4, !tbaa !8
  %57 = sext i32 %56 to i64
  %58 = getelementptr inbounds [20 x [20 x i64]], ptr @sp, i64 0, i64 %57
  %59 = load i32, ptr %5, align 4, !tbaa !8
  %60 = sext i32 %59 to i64
  %61 = getelementptr inbounds [20 x i64], ptr %58, i64 0, i64 %60
  store i64 %55, ptr %61, align 8, !tbaa !13
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #8
  br label %62

62:                                               ; preds = %47
  %63 = load i32, ptr %3, align 4, !tbaa !8
  %64 = add nsw i32 %63, 1
  store i32 %64, ptr %3, align 4, !tbaa !8
  br label %42, !llvm.loop !15

65:                                               ; preds = %46
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #8
  %66 = load i32, ptr @n, align 4, !tbaa !8
  %67 = shl i32 1, %66
  store i32 %67, ptr %7, align 4, !tbaa !8
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #8
  store i32 1, ptr %8, align 4, !tbaa !8
  br label %68

68:                                               ; preds = %216, %65
  %69 = load i32, ptr %8, align 4, !tbaa !8
  %70 = load i32, ptr %7, align 4, !tbaa !8
  %71 = icmp slt i32 %69, %70
  br i1 %71, label %73, label %72

72:                                               ; preds = %68
  store i32 8, ptr %9, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #8
  br label %219

73:                                               ; preds = %68
  %74 = load i32, ptr %8, align 4, !tbaa !8
  %75 = call i32 @llvm.ctpop.i32(i32 %74)
  %76 = load i32, ptr @m, align 4, !tbaa !8
  %77 = icmp sgt i32 %75, %76
  br i1 %77, label %78, label %79

78:                                               ; preds = %73
  br label %216

79:                                               ; preds = %73
  %80 = load i32, ptr %8, align 4, !tbaa !8
  %81 = call i32 @llvm.ctpop.i32(i32 %80)
  %82 = icmp eq i32 %81, 1
  br i1 %82, label %83, label %126

83:                                               ; preds = %79
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #8
  store i32 0, ptr %10, align 4, !tbaa !8
  br label %84

84:                                               ; preds = %121, %83
  %85 = load i32, ptr %10, align 4, !tbaa !8
  %86 = load i32, ptr @n, align 4, !tbaa !8
  %87 = icmp slt i32 %85, %86
  br i1 %87, label %89, label %88

88:                                               ; preds = %84
  store i32 11, ptr %9, align 4
  br label %124

89:                                               ; preds = %84
  %90 = load i32, ptr %8, align 4, !tbaa !8
  %91 = load i32, ptr %10, align 4, !tbaa !8
  %92 = shl i32 1, %91
  %93 = and i32 %90, %92
  %94 = icmp sgt i32 %93, 0
  br i1 %94, label %95, label %120

95:                                               ; preds = %89
  %96 = load i32, ptr %10, align 4, !tbaa !8
  %97 = sext i32 %96 to i64
  %98 = getelementptr inbounds [19 x i64], ptr @a, i64 0, i64 %97
  %99 = load i64, ptr %98, align 8, !tbaa !13
  %100 = load i32, ptr %8, align 4, !tbaa !8
  %101 = sext i32 %100 to i64
  %102 = getelementptr inbounds [524288 x [19 x i64]], ptr @dp, i64 0, i64 %101
  %103 = load i32, ptr %10, align 4, !tbaa !8
  %104 = sext i32 %103 to i64
  %105 = getelementptr inbounds [19 x i64], ptr %102, i64 0, i64 %104
  store i64 %99, ptr %105, align 8, !tbaa !13
  %106 = load i32, ptr %8, align 4, !tbaa !8
  %107 = call i32 @llvm.ctpop.i32(i32 %106)
  %108 = load i32, ptr @m, align 4, !tbaa !8
  %109 = icmp eq i32 %107, %108
  br i1 %109, label %110, label %119

110:                                              ; preds = %95
  %111 = load i32, ptr %8, align 4, !tbaa !8
  %112 = sext i32 %111 to i64
  %113 = getelementptr inbounds [524288 x [19 x i64]], ptr @dp, i64 0, i64 %112
  %114 = load i32, ptr %10, align 4, !tbaa !8
  %115 = sext i32 %114 to i64
  %116 = getelementptr inbounds [19 x i64], ptr %113, i64 0, i64 %115
  %117 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3maxIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) @ans, ptr noundef nonnull align 8 dereferenceable(8) %116)
  %118 = load i64, ptr %117, align 8, !tbaa !13
  store i64 %118, ptr @ans, align 8, !tbaa !13
  br label %119

119:                                              ; preds = %110, %95
  store i32 11, ptr %9, align 4
  br label %124

120:                                              ; preds = %89
  br label %121

121:                                              ; preds = %120
  %122 = load i32, ptr %10, align 4, !tbaa !8
  %123 = add nsw i32 %122, 1
  store i32 %123, ptr %10, align 4, !tbaa !8
  br label %84, !llvm.loop !16

124:                                              ; preds = %119, %88
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #8
  br label %125

125:                                              ; preds = %124
  br label %216

126:                                              ; preds = %79
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #8
  store i32 0, ptr %11, align 4, !tbaa !8
  br label %127

127:                                              ; preds = %212, %126
  %128 = load i32, ptr %11, align 4, !tbaa !8
  %129 = load i32, ptr @n, align 4, !tbaa !8
  %130 = icmp slt i32 %128, %129
  br i1 %130, label %132, label %131

131:                                              ; preds = %127
  store i32 14, ptr %9, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #8
  br label %215

132:                                              ; preds = %127
  %133 = load i32, ptr %8, align 4, !tbaa !8
  %134 = load i32, ptr %11, align 4, !tbaa !8
  %135 = shl i32 1, %134
  %136 = and i32 %133, %135
  %137 = icmp sgt i32 %136, 0
  br i1 %137, label %138, label %211

138:                                              ; preds = %132
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #8
  store i32 0, ptr %12, align 4, !tbaa !8
  br label %139

139:                                              ; preds = %193, %138
  %140 = load i32, ptr %12, align 4, !tbaa !8
  %141 = load i32, ptr @n, align 4, !tbaa !8
  %142 = icmp slt i32 %140, %141
  br i1 %142, label %144, label %143

143:                                              ; preds = %139
  store i32 17, ptr %9, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #8
  br label %196

144:                                              ; preds = %139
  %145 = load i32, ptr %12, align 4, !tbaa !8
  %146 = load i32, ptr %11, align 4, !tbaa !8
  %147 = icmp ne i32 %145, %146
  br i1 %147, label %148, label %192

148:                                              ; preds = %144
  %149 = load i32, ptr %8, align 4, !tbaa !8
  %150 = load i32, ptr %12, align 4, !tbaa !8
  %151 = shl i32 1, %150
  %152 = and i32 %149, %151
  %153 = icmp sgt i32 %152, 0
  br i1 %153, label %154, label %192

154:                                              ; preds = %148
  %155 = load i32, ptr %8, align 4, !tbaa !8
  %156 = sext i32 %155 to i64
  %157 = getelementptr inbounds [524288 x [19 x i64]], ptr @dp, i64 0, i64 %156
  %158 = load i32, ptr %11, align 4, !tbaa !8
  %159 = sext i32 %158 to i64
  %160 = getelementptr inbounds [19 x i64], ptr %157, i64 0, i64 %159
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #8
  %161 = load i32, ptr %8, align 4, !tbaa !8
  %162 = load i32, ptr %11, align 4, !tbaa !8
  %163 = shl i32 1, %162
  %164 = xor i32 %161, %163
  %165 = sext i32 %164 to i64
  %166 = getelementptr inbounds [524288 x [19 x i64]], ptr @dp, i64 0, i64 %165
  %167 = load i32, ptr %12, align 4, !tbaa !8
  %168 = sext i32 %167 to i64
  %169 = getelementptr inbounds [19 x i64], ptr %166, i64 0, i64 %168
  %170 = load i64, ptr %169, align 8, !tbaa !13
  %171 = load i32, ptr %11, align 4, !tbaa !8
  %172 = sext i32 %171 to i64
  %173 = getelementptr inbounds [19 x i64], ptr @a, i64 0, i64 %172
  %174 = load i64, ptr %173, align 8, !tbaa !13
  %175 = add nsw i64 %170, %174
  %176 = load i32, ptr %12, align 4, !tbaa !8
  %177 = sext i32 %176 to i64
  %178 = getelementptr inbounds [20 x [20 x i64]], ptr @sp, i64 0, i64 %177
  %179 = load i32, ptr %11, align 4, !tbaa !8
  %180 = sext i32 %179 to i64
  %181 = getelementptr inbounds [20 x i64], ptr %178, i64 0, i64 %180
  %182 = load i64, ptr %181, align 8, !tbaa !13
  %183 = add nsw i64 %175, %182
  store i64 %183, ptr %13, align 8, !tbaa !13
  %184 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3maxIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %160, ptr noundef nonnull align 8 dereferenceable(8) %13)
  %185 = load i64, ptr %184, align 8, !tbaa !13
  %186 = load i32, ptr %8, align 4, !tbaa !8
  %187 = sext i32 %186 to i64
  %188 = getelementptr inbounds [524288 x [19 x i64]], ptr @dp, i64 0, i64 %187
  %189 = load i32, ptr %11, align 4, !tbaa !8
  %190 = sext i32 %189 to i64
  %191 = getelementptr inbounds [19 x i64], ptr %188, i64 0, i64 %190
  store i64 %185, ptr %191, align 8, !tbaa !13
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #8
  br label %192

192:                                              ; preds = %154, %148, %144
  br label %193

193:                                              ; preds = %192
  %194 = load i32, ptr %12, align 4, !tbaa !8
  %195 = add nsw i32 %194, 1
  store i32 %195, ptr %12, align 4, !tbaa !8
  br label %139, !llvm.loop !17

196:                                              ; preds = %143
  %197 = load i32, ptr %8, align 4, !tbaa !8
  %198 = call i32 @llvm.ctpop.i32(i32 %197)
  %199 = load i32, ptr @m, align 4, !tbaa !8
  %200 = icmp eq i32 %198, %199
  br i1 %200, label %201, label %210

201:                                              ; preds = %196
  %202 = load i32, ptr %8, align 4, !tbaa !8
  %203 = sext i32 %202 to i64
  %204 = getelementptr inbounds [524288 x [19 x i64]], ptr @dp, i64 0, i64 %203
  %205 = load i32, ptr %11, align 4, !tbaa !8
  %206 = sext i32 %205 to i64
  %207 = getelementptr inbounds [19 x i64], ptr %204, i64 0, i64 %206
  %208 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3maxIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) @ans, ptr noundef nonnull align 8 dereferenceable(8) %207)
  %209 = load i64, ptr %208, align 8, !tbaa !13
  store i64 %209, ptr @ans, align 8, !tbaa !13
  br label %210

210:                                              ; preds = %201, %196
  br label %211

211:                                              ; preds = %210, %132
  br label %212

212:                                              ; preds = %211
  %213 = load i32, ptr %11, align 4, !tbaa !8
  %214 = add nsw i32 %213, 1
  store i32 %214, ptr %11, align 4, !tbaa !8
  br label %127, !llvm.loop !18

215:                                              ; preds = %131
  br label %216

216:                                              ; preds = %215, %125, %78
  %217 = load i32, ptr %8, align 4, !tbaa !8
  %218 = add nsw i32 %217, 1
  store i32 %218, ptr %8, align 4, !tbaa !8
  br label %68, !llvm.loop !19

219:                                              ; preds = %72
  %220 = load i64, ptr @ans, align 8, !tbaa !13
  %221 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i64 noundef %220)
  %222 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) %221, ptr noundef @.str)
  store i32 0, ptr %1, align 4
  store i32 1, ptr %9, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #8
  %223 = load i32, ptr %1, align 4
  ret i32 %223
}

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

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

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

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

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

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

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.ctpop.i32(i32) #5

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

; Function Attrs: inlinehint mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef) #7

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

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

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

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"vtable pointer", !7, i64 0}
!7 = !{!"Simple C++ TBAA"}
!8 = !{!9, !9, i64 0}
!9 = !{!"int", !10, i64 0}
!10 = !{!"omnipotent char", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = !{!14, !14, i64 0}
!14 = !{!"long long", !10, i64 0}
!15 = distinct !{!15, !12}
!16 = distinct !{!16, !12}
!17 = distinct !{!17, !12}
!18 = distinct !{!18, !12}
!19 = distinct !{!19, !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::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" }

@dp = external dso_local global [524288 x [19 x i64]], align 16
@n = external dso_local global i32, align 4
@m = external dso_local global i32, align 4
@k = external dso_local global i32, align 4
@a = external dso_local global [19 x i64], align 16
@sp = external dso_local local_unnamed_addr global [20 x [20 x i64]], align 16
@ans = external dso_local global i64, align 8
@_ZSt3cin = external global %"class.std::basic_istream", align 8
@_ZSt4cerr = external global %"class.std::basic_ostream", align 8
@_ZSt4cout = external global %"class.std::basic_ostream", align 8
@.str = external hidden unnamed_addr constant [2 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 i64, align 8
  %4 = alloca i64, align 8
  %5 = tail call noundef zeroext i1 @_ZNSt8ios_base15sync_with_stdioEb(i1 noundef zeroext false)
  %6 = load ptr, ptr @_ZSt3cin, align 8, !tbaa !5
  %7 = getelementptr i8, ptr %6, i64 -24
  %8 = load i64, ptr %7, align 8
  %9 = getelementptr inbounds i8, ptr @_ZSt3cin, i64 %8
  %10 = tail call noundef ptr @_ZNSt9basic_iosIcSt11char_traitsIcEE3tieEPSo(ptr noundef nonnull align 8 dereferenceable(264) %9, ptr noundef null)
  %11 = load ptr, ptr @_ZSt4cerr, align 8, !tbaa !5
  %12 = getelementptr i8, ptr %11, i64 -24
  %13 = load i64, ptr %12, align 8
  %14 = getelementptr inbounds i8, ptr @_ZSt4cerr, i64 %13
  %15 = tail call noundef ptr @_ZNSt9basic_iosIcSt11char_traitsIcEE3tieEPSo(ptr noundef nonnull align 8 dereferenceable(264) %14, ptr noundef null)
  %16 = tail call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) @n)
  %17 = tail call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %16, ptr noundef nonnull align 4 dereferenceable(4) @m)
  %18 = tail call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %17, ptr noundef nonnull align 4 dereferenceable(4) @k)
  %19 = load i32, ptr @n, align 4, !tbaa !8
  %20 = icmp sgt i32 %19, 0
  br i1 %20, label %.lr.ph, label %.preheader57

.preheader57:                                     ; preds = %.lr.ph, %0
  %21 = phi i32 [ %19, %0 ], [ %25, %.lr.ph ]
  %22 = load i32, ptr @k, align 4, !tbaa !8
  %.not60 = icmp slt i32 %22, 1
  br i1 %.not60, label %._crit_edge, label %.lr.ph62

.lr.ph:                                           ; preds = %0, %.lr.ph
  %indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph ], [ 0, %0 ]
  %23 = getelementptr inbounds [19 x i64], ptr @a, i64 0, i64 %indvars.iv
  %24 = tail call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) %23)
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %25 = load i32, ptr @n, align 4, !tbaa !8
  %26 = sext i32 %25 to i64
  %27 = icmp slt i64 %indvars.iv.next, %26
  br i1 %27, label %.lr.ph, label %.preheader57, !llvm.loop !11

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

._crit_edge:                                      ; preds = %._crit_edge.loopexit, %.preheader57
  %28 = phi i32 [ %.pre, %._crit_edge.loopexit ], [ %21, %.preheader57 ]
  %29 = shl nuw i32 1, %28
  %30 = icmp sgt i32 %29, 1
  br i1 %30, label %.lr.ph73.preheader, label %._crit_edge74

.lr.ph73.preheader:                               ; preds = %._crit_edge
  %wide.trip.count = zext nneg i32 %29 to i64
  br label %.lr.ph73

.lr.ph62:                                         ; preds = %.preheader57, %.lr.ph62
  %.04761 = phi i32 [ %42, %.lr.ph62 ], [ 1, %.preheader57 ]
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %1) #8
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %2) #8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %3) #8
  %31 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) %1)
  %32 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %31, ptr noundef nonnull align 4 dereferenceable(4) %2)
  %33 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) %32, ptr noundef nonnull align 8 dereferenceable(8) %3)
  %34 = load i32, ptr %1, align 4, !tbaa !8
  %35 = add nsw i32 %34, -1
  %36 = load i32, ptr %2, align 4, !tbaa !8
  %37 = add nsw i32 %36, -1
  %38 = load i64, ptr %3, align 8, !tbaa !13
  %39 = sext i32 %35 to i64
  %40 = sext i32 %37 to i64
  %41 = getelementptr inbounds [20 x [20 x i64]], ptr @sp, i64 0, i64 %39, i64 %40
  store i64 %38, ptr %41, align 8, !tbaa !13
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %3) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %2) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #8
  %42 = add nuw nsw i32 %.04761, 1
  %43 = load i32, ptr @k, align 4, !tbaa !8
  %.not.not = icmp slt i32 %.04761, %43
  br i1 %.not.not, label %.lr.ph62, label %._crit_edge.loopexit, !llvm.loop !15

._crit_edge74:                                    ; preds = %.loopexit, %._crit_edge
  %44 = load i64, ptr @ans, align 8, !tbaa !13
  %45 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i64 noundef %44)
  %46 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) %45, ptr noundef nonnull @.str)
  ret i32 0

.lr.ph73:                                         ; preds = %.lr.ph73.preheader, %.loopexit
  %indvars.iv84 = phi i64 [ 1, %.lr.ph73.preheader ], [ %indvars.iv.next85, %.loopexit ]
  %47 = trunc nuw nsw i64 %indvars.iv84 to i32
  %48 = call range(i32 0, 32) i32 @llvm.ctpop.i32(i32 %47)
  %49 = load i32, ptr @m, align 4, !tbaa !8
  %50 = icmp sgt i32 %48, %49
  br i1 %50, label %.loopexit, label %51

51:                                               ; preds = %.lr.ph73
  %52 = icmp eq i32 %48, 1
  %53 = load i32, ptr @n, align 4, !tbaa !8
  %54 = icmp sgt i32 %53, 0
  br i1 %52, label %.preheader54, label %.preheader55

.preheader55:                                     ; preds = %51
  br i1 %54, label %.lr.ph67, label %.loopexit

.preheader54:                                     ; preds = %51
  br i1 %54, label %.lr.ph69, label %.loopexit

.lr.ph69:                                         ; preds = %.preheader54, %66
  %.04568 = phi i32 [ %67, %66 ], [ 0, %.preheader54 ]
  %55 = shl nuw i32 1, %.04568
  %56 = and i32 %55, %47
  %.not53 = icmp eq i32 %56, 0
  br i1 %.not53, label %66, label %57

57:                                               ; preds = %.lr.ph69
  %58 = zext nneg i32 %.04568 to i64
  %59 = getelementptr inbounds [19 x i64], ptr @a, i64 0, i64 %58
  %60 = load i64, ptr %59, align 8, !tbaa !13
  %61 = getelementptr inbounds [524288 x [19 x i64]], ptr @dp, i64 0, i64 %indvars.iv84, i64 %58
  store i64 %60, ptr %61, align 8, !tbaa !13
  %62 = icmp eq i32 %49, 1
  br i1 %62, label %63, label %.loopexit

63:                                               ; preds = %57
  %64 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3maxIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) @ans, ptr noundef nonnull align 8 dereferenceable(8) %61)
  %65 = load i64, ptr %64, align 8, !tbaa !13
  store i64 %65, ptr @ans, align 8, !tbaa !13
  br label %.loopexit

66:                                               ; preds = %.lr.ph69
  %67 = add nuw nsw i32 %.04568, 1
  %exitcond.not = icmp eq i32 %67, %53
  br i1 %exitcond.not, label %.loopexit, label %.lr.ph69, !llvm.loop !16

.lr.ph67:                                         ; preds = %.preheader55, %106
  %68 = phi i32 [ %107, %106 ], [ %53, %.preheader55 ]
  %indvars.iv81 = phi i64 [ %indvars.iv.next82, %106 ], [ 0, %.preheader55 ]
  %69 = trunc nuw nsw i64 %indvars.iv81 to i32
  %70 = shl nuw i32 1, %69
  %71 = and i32 %70, %47
  %.not50 = icmp eq i32 %71, 0
  br i1 %.not50, label %106, label %.preheader

.preheader:                                       ; preds = %.lr.ph67
  %72 = icmp sgt i32 %68, 0
  br i1 %72, label %.lr.ph64, label %._crit_edge65

.lr.ph64:                                         ; preds = %.preheader
  %73 = getelementptr inbounds [524288 x [19 x i64]], ptr @dp, i64 0, i64 %indvars.iv84, i64 %indvars.iv81
  %74 = xor i32 %70, %47
  %75 = sext i32 %74 to i64
  %76 = getelementptr inbounds [19 x i64], ptr @a, i64 0, i64 %indvars.iv81
  br label %80

._crit_edge65:                                    ; preds = %97, %.preheader
  %77 = phi i32 [ %68, %.preheader ], [ %98, %97 ]
  %78 = load i32, ptr @m, align 4, !tbaa !8
  %79 = icmp eq i32 %48, %78
  br i1 %79, label %102, label %106

80:                                               ; preds = %.lr.ph64, %97
  %81 = phi i32 [ %68, %.lr.ph64 ], [ %98, %97 ]
  %82 = phi i32 [ %68, %.lr.ph64 ], [ %99, %97 ]
  %indvars.iv78 = phi i64 [ 0, %.lr.ph64 ], [ %indvars.iv.next79, %97 ]
  %.not51 = icmp eq i64 %indvars.iv78, %indvars.iv81
  br i1 %.not51, label %97, label %83

83:                                               ; preds = %80
  %84 = trunc nuw nsw i64 %indvars.iv78 to i32
  %85 = shl nuw i32 1, %84
  %86 = and i32 %85, %47
  %.not52 = icmp eq i32 %86, 0
  br i1 %.not52, label %97, label %87

87:                                               ; preds = %83
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %4) #8
  %88 = getelementptr inbounds [524288 x [19 x i64]], ptr @dp, i64 0, i64 %75, i64 %indvars.iv78
  %89 = load i64, ptr %88, align 8, !tbaa !13
  %90 = load i64, ptr %76, align 8, !tbaa !13
  %91 = add nsw i64 %90, %89
  %92 = getelementptr inbounds [20 x [20 x i64]], ptr @sp, i64 0, i64 %indvars.iv78, i64 %indvars.iv81
  %93 = load i64, ptr %92, align 8, !tbaa !13
  %94 = add nsw i64 %91, %93
  store i64 %94, ptr %4, align 8, !tbaa !13
  %95 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3maxIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %73, ptr noundef nonnull align 8 dereferenceable(8) %4)
  %96 = load i64, ptr %95, align 8, !tbaa !13
  store i64 %96, ptr %73, align 8, !tbaa !13
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #8
  %.pre88 = load i32, ptr @n, align 4, !tbaa !8
  br label %97

97:                                               ; preds = %80, %83, %87
  %98 = phi i32 [ %81, %80 ], [ %81, %83 ], [ %.pre88, %87 ]
  %99 = phi i32 [ %82, %80 ], [ %82, %83 ], [ %.pre88, %87 ]
  %indvars.iv.next79 = add nuw nsw i64 %indvars.iv78, 1
  %100 = sext i32 %99 to i64
  %101 = icmp slt i64 %indvars.iv.next79, %100
  br i1 %101, label %80, label %._crit_edge65, !llvm.loop !17

102:                                              ; preds = %._crit_edge65
  %103 = getelementptr inbounds [524288 x [19 x i64]], ptr @dp, i64 0, i64 %indvars.iv84, i64 %indvars.iv81
  %104 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3maxIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) @ans, ptr noundef nonnull align 8 dereferenceable(8) %103)
  %105 = load i64, ptr %104, align 8, !tbaa !13
  store i64 %105, ptr @ans, align 8, !tbaa !13
  %.pre89 = load i32, ptr @n, align 4, !tbaa !8
  br label %106

106:                                              ; preds = %.lr.ph67, %102, %._crit_edge65
  %107 = phi i32 [ %68, %.lr.ph67 ], [ %.pre89, %102 ], [ %77, %._crit_edge65 ]
  %indvars.iv.next82 = add nuw nsw i64 %indvars.iv81, 1
  %108 = sext i32 %107 to i64
  %109 = icmp slt i64 %indvars.iv.next82, %108
  br i1 %109, label %.lr.ph67, label %.loopexit, !llvm.loop !18

.loopexit:                                        ; preds = %106, %66, %.preheader55, %.preheader54, %63, %57, %.lr.ph73
  %indvars.iv.next85 = add nuw nsw i64 %indvars.iv84, 1
  %exitcond87.not = icmp eq i64 %indvars.iv.next85, %wide.trip.count
  br i1 %exitcond87.not, label %._crit_edge74, label %.lr.ph73, !llvm.loop !19
}

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

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

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

; 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 uwtable
declare noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 8 dereferenceable(8)) local_unnamed_addr #4 align 2

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

; Function Attrs: mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.ctpop.i32(i32) #5

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3maxIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(8)) local_unnamed_addr #6

; Function Attrs: inlinehint mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef) local_unnamed_addr #7

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

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

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

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"vtable pointer", !7, i64 0}
!7 = !{!"Simple C++ TBAA"}
!8 = !{!9, !9, i64 0}
!9 = !{!"int", !10, i64 0}
!10 = !{!"omnipotent char", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = !{!14, !14, i64 0}
!14 = !{!"long long", !10, i64 0}
!15 = distinct !{!15, !12}
!16 = distinct !{!16, !12}
!17 = distinct !{!17, !12}
!18 = distinct !{!18, !12}
!19 = distinct !{!19, !12}


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