; LLVM IR from lzyrapx/Competitive-Programming :: 百度之星/2016复赛/1002.ll (Z5solvev)

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

@n = 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 [15 x [36384 x i32]], align 16
@g = external dso_local global [36384 x i32], align 16
@Num = external dso_local global [36384 x i32], align 16
@p2 = external dso_local global [36384 x i32], align 16
@_ZSt3cin = external global %"class.std::basic_istream", align 8
@_ZSt4cout = external global %"class.std::basic_ostream", align 8

; Function Attrs: mustprogress uwtable
define dso_local void @_Z5solvev() #0 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  %12 = alloca i32, align 4
  %13 = alloca i32, align 4
  %14 = 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)
  %15 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %14, ptr noundef nonnull align 4 dereferenceable(4) @m)
  %16 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %15, ptr noundef nonnull align 4 dereferenceable(4) @k)
  call void @llvm.memset.p0.i64(ptr align 16 @g, i8 0, i64 145536, i1 false)
  call void @llvm.lifetime.start.p0(i64 4, ptr %1) #5
  store i32 1, ptr %1, align 4, !tbaa !5
  br label %17

17:                                               ; preds = %58, %0
  %18 = load i32, ptr %1, align 4, !tbaa !5
  %19 = load i32, ptr @m, align 4, !tbaa !5
  %20 = icmp sle i32 %18, %19
  br i1 %20, label %22, label %21

21:                                               ; preds = %17
  store i32 2, ptr %2, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %1) #5
  br label %61

22:                                               ; preds = %17
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #5
  %23 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) %3)
  %24 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %23, ptr noundef nonnull align 4 dereferenceable(4) %4)
  %25 = load i32, ptr %3, align 4, !tbaa !5
  %26 = add nsw i32 %25, -1
  store i32 %26, ptr %3, align 4, !tbaa !5
  %27 = load i32, ptr %4, align 4, !tbaa !5
  %28 = add nsw i32 %27, -1
  store i32 %28, ptr %4, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #5
  store i32 0, ptr %5, align 4, !tbaa !5
  br label %29

29:                                               ; preds = %54, %22
  %30 = load i32, ptr %5, align 4, !tbaa !5
  %31 = load i32, ptr @n, align 4, !tbaa !5
  %32 = shl i32 1, %31
  %33 = icmp slt i32 %30, %32
  br i1 %33, label %35, label %34

34:                                               ; preds = %29
  store i32 5, ptr %2, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #5
  br label %57

35:                                               ; preds = %29
  %36 = load i32, ptr %5, align 4, !tbaa !5
  %37 = load i32, ptr %3, align 4, !tbaa !5
  %38 = shl i32 1, %37
  %39 = and i32 %36, %38
  %40 = icmp ne i32 %39, 0
  br i1 %40, label %41, label %53

41:                                               ; preds = %35
  %42 = load i32, ptr %5, align 4, !tbaa !5
  %43 = load i32, ptr %4, align 4, !tbaa !5
  %44 = shl i32 1, %43
  %45 = and i32 %42, %44
  %46 = icmp ne i32 %45, 0
  br i1 %46, label %47, label %53

47:                                               ; preds = %41
  %48 = load i32, ptr %5, align 4, !tbaa !5
  %49 = sext i32 %48 to i64
  %50 = getelementptr inbounds [36384 x i32], ptr @g, i64 0, i64 %49
  %51 = load i32, ptr %50, align 4, !tbaa !5
  %52 = add nsw i32 %51, 1
  store i32 %52, ptr %50, align 4, !tbaa !5
  br label %53

53:                                               ; preds = %47, %41, %35
  br label %54

54:                                               ; preds = %53
  %55 = load i32, ptr %5, align 4, !tbaa !5
  %56 = add nsw i32 %55, 1
  store i32 %56, ptr %5, align 4, !tbaa !5
  br label %29, !llvm.loop !9

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

58:                                               ; preds = %57
  %59 = load i32, ptr %1, align 4, !tbaa !5
  %60 = add nsw i32 %59, 1
  store i32 %60, ptr %1, align 4, !tbaa !5
  br label %17, !llvm.loop !11

61:                                               ; preds = %21
  call void @llvm.memset.p0.i64(ptr align 16 @f, i8 0, i64 2183040, i1 false)
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #5
  store i32 0, ptr %6, align 4, !tbaa !5
  br label %62

62:                                               ; preds = %147, %61
  %63 = load i32, ptr %6, align 4, !tbaa !5
  %64 = load i32, ptr @n, align 4, !tbaa !5
  %65 = shl i32 1, %64
  %66 = icmp slt i32 %63, %65
  br i1 %66, label %68, label %67

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

68:                                               ; preds = %62
  %69 = load i32, ptr %6, align 4, !tbaa !5
  %70 = sext i32 %69 to i64
  %71 = getelementptr inbounds [36384 x i32], ptr @g, i64 0, i64 %70
  %72 = load i32, ptr %71, align 4, !tbaa !5
  %73 = sext i32 %72 to i64
  %74 = getelementptr inbounds [36384 x i32], ptr @p2, i64 0, i64 %73
  %75 = load i32, ptr %74, align 4, !tbaa !5
  %76 = load i32, ptr %6, align 4, !tbaa !5
  %77 = sext i32 %76 to i64
  %78 = getelementptr inbounds [36384 x i32], ptr @Num, i64 0, i64 %77
  store i32 %75, ptr %78, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #5
  %79 = load i32, ptr %6, align 4, !tbaa !5
  %80 = load i32, ptr %6, align 4, !tbaa !5
  %81 = sub nsw i32 0, %80
  %82 = and i32 %79, %81
  store i32 %82, ptr %7, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #5
  %83 = load i32, ptr %6, align 4, !tbaa !5
  %84 = load i32, ptr %6, align 4, !tbaa !5
  %85 = sub nsw i32 %84, 1
  %86 = and i32 %83, %85
  store i32 %86, ptr %8, align 4, !tbaa !5
  br label %87

87:                                               ; preds = %125, %68
  %88 = load i32, ptr %8, align 4, !tbaa !5
  %89 = icmp ne i32 %88, 0
  br i1 %89, label %91, label %90

90:                                               ; preds = %87
  store i32 11, ptr %2, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #5
  br label %130

91:                                               ; preds = %87
  %92 = load i32, ptr %8, align 4, !tbaa !5
  %93 = load i32, ptr %7, align 4, !tbaa !5
  %94 = and i32 %92, %93
  %95 = icmp ne i32 %94, 0
  br i1 %95, label %96, label %124

96:                                               ; preds = %91
  %97 = load i32, ptr %6, align 4, !tbaa !5
  %98 = sext i32 %97 to i64
  %99 = getelementptr inbounds [36384 x i32], ptr @Num, i64 0, i64 %98
  %100 = load i32, ptr %99, align 4, !tbaa !5
  %101 = sext i32 %100 to i64
  %102 = load i32, ptr %6, align 4, !tbaa !5
  %103 = load i32, ptr %8, align 4, !tbaa !5
  %104 = xor i32 %102, %103
  %105 = sext i32 %104 to i64
  %106 = getelementptr inbounds [36384 x i32], ptr @g, i64 0, i64 %105
  %107 = load i32, ptr %106, align 4, !tbaa !5
  %108 = sext i32 %107 to i64
  %109 = getelementptr inbounds [36384 x i32], ptr @p2, i64 0, i64 %108
  %110 = load i32, ptr %109, align 4, !tbaa !5
  %111 = sext i32 %110 to i64
  %112 = load i32, ptr %8, align 4, !tbaa !5
  %113 = sext i32 %112 to i64
  %114 = getelementptr inbounds [36384 x i32], ptr @Num, i64 0, i64 %113
  %115 = load i32, ptr %114, align 4, !tbaa !5
  %116 = sext i32 %115 to i64
  %117 = mul nsw i64 %111, %116
  %118 = sub nsw i64 %101, %117
  %119 = srem i64 %118, 1000000009
  %120 = trunc i64 %119 to i32
  %121 = load i32, ptr %6, align 4, !tbaa !5
  %122 = sext i32 %121 to i64
  %123 = getelementptr inbounds [36384 x i32], ptr @Num, i64 0, i64 %122
  store i32 %120, ptr %123, align 4, !tbaa !5
  br label %124

124:                                              ; preds = %96, %91
  br label %125

125:                                              ; preds = %124
  %126 = load i32, ptr %8, align 4, !tbaa !5
  %127 = sub nsw i32 %126, 1
  %128 = load i32, ptr %6, align 4, !tbaa !5
  %129 = and i32 %127, %128
  store i32 %129, ptr %8, align 4, !tbaa !5
  br label %87, !llvm.loop !12

130:                                              ; preds = %90
  %131 = load i32, ptr %6, align 4, !tbaa !5
  %132 = sext i32 %131 to i64
  %133 = getelementptr inbounds [36384 x i32], ptr @Num, i64 0, i64 %132
  %134 = load i32, ptr %133, align 4, !tbaa !5
  %135 = add nsw i32 %134, 1000000009
  %136 = srem i32 %135, 1000000009
  %137 = load i32, ptr %6, align 4, !tbaa !5
  %138 = sext i32 %137 to i64
  %139 = getelementptr inbounds [36384 x i32], ptr @Num, i64 0, i64 %138
  store i32 %136, ptr %139, align 4, !tbaa !5
  %140 = load i32, ptr %6, align 4, !tbaa !5
  %141 = sext i32 %140 to i64
  %142 = getelementptr inbounds [36384 x i32], ptr @Num, i64 0, i64 %141
  %143 = load i32, ptr %142, align 4, !tbaa !5
  %144 = load i32, ptr %6, align 4, !tbaa !5
  %145 = sext i32 %144 to i64
  %146 = getelementptr inbounds [36384 x i32], ptr getelementptr inbounds ([15 x [36384 x i32]], ptr @f, i64 0, i64 1), i64 0, i64 %145
  store i32 %143, ptr %146, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #5
  br label %147

147:                                              ; preds = %130
  %148 = load i32, ptr %6, align 4, !tbaa !5
  %149 = add nsw i32 %148, 1
  store i32 %149, ptr %6, align 4, !tbaa !5
  br label %62, !llvm.loop !13

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

151:                                              ; preds = %236, %150
  %152 = load i32, ptr %9, align 4, !tbaa !5
  %153 = load i32, ptr @k, align 4, !tbaa !5
  %154 = icmp slt i32 %152, %153
  br i1 %154, label %156, label %155

155:                                              ; preds = %151
  store i32 14, ptr %2, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #5
  br label %239

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

157:                                              ; preds = %232, %156
  %158 = load i32, ptr %10, align 4, !tbaa !5
  %159 = load i32, ptr @n, align 4, !tbaa !5
  %160 = shl i32 1, %159
  %161 = icmp slt i32 %158, %160
  br i1 %161, label %163, label %162

162:                                              ; preds = %157
  store i32 17, ptr %2, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #5
  br label %235

163:                                              ; preds = %157
  %164 = load i32, ptr %10, align 4, !tbaa !5
  %165 = sext i32 %164 to i64
  %166 = getelementptr inbounds [36384 x i32], ptr @Num, i64 0, i64 %165
  %167 = load i32, ptr %166, align 4, !tbaa !5
  %168 = icmp ne i32 %167, 0
  br i1 %168, label %169, label %231

169:                                              ; preds = %163
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #5
  %170 = load i32, ptr %10, align 4, !tbaa !5
  %171 = load i32, ptr %10, align 4, !tbaa !5
  %172 = sub nsw i32 0, %171
  %173 = and i32 %170, %172
  store i32 %173, ptr %11, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #5
  %174 = load i32, ptr @n, align 4, !tbaa !5
  %175 = shl i32 1, %174
  %176 = sub nsw i32 %175, 1
  %177 = load i32, ptr %10, align 4, !tbaa !5
  %178 = xor i32 %176, %177
  %179 = load i32, ptr %11, align 4, !tbaa !5
  %180 = sub nsw i32 %179, 1
  %181 = xor i32 %178, %180
  store i32 %181, ptr %12, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #5
  %182 = load i32, ptr %12, align 4, !tbaa !5
  store i32 %182, ptr %13, align 4, !tbaa !5
  br label %183

183:                                              ; preds = %225, %169
  %184 = load i32, ptr %13, align 4, !tbaa !5
  %185 = icmp ne i32 %184, 0
  br i1 %185, label %187, label %186

186:                                              ; preds = %183
  store i32 20, ptr %2, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #5
  br label %230

187:                                              ; preds = %183
  %188 = load i32, ptr %9, align 4, !tbaa !5
  %189 = add nsw i32 %188, 1
  %190 = sext i32 %189 to i64
  %191 = getelementptr inbounds [15 x [36384 x i32]], ptr @f, i64 0, i64 %190
  %192 = load i32, ptr %10, align 4, !tbaa !5
  %193 = load i32, ptr %13, align 4, !tbaa !5
  %194 = xor i32 %192, %193
  %195 = sext i32 %194 to i64
  %196 = getelementptr inbounds [36384 x i32], ptr %191, i64 0, i64 %195
  %197 = load i32, ptr %196, align 4, !tbaa !5
  %198 = sext i32 %197 to i64
  %199 = load i32, ptr %9, align 4, !tbaa !5
  %200 = sext i32 %199 to i64
  %201 = getelementptr inbounds [15 x [36384 x i32]], ptr @f, i64 0, i64 %200
  %202 = load i32, ptr %13, align 4, !tbaa !5
  %203 = sext i32 %202 to i64
  %204 = getelementptr inbounds [36384 x i32], ptr %201, i64 0, i64 %203
  %205 = load i32, ptr %204, align 4, !tbaa !5
  %206 = sext i32 %205 to i64
  %207 = load i32, ptr %10, align 4, !tbaa !5
  %208 = sext i32 %207 to i64
  %209 = getelementptr inbounds [36384 x i32], ptr @Num, i64 0, i64 %208
  %210 = load i32, ptr %209, align 4, !tbaa !5
  %211 = sext i32 %210 to i64
  %212 = mul nsw i64 %206, %211
  %213 = add nsw i64 %198, %212
  %214 = srem i64 %213, 1000000009
  %215 = trunc i64 %214 to i32
  %216 = load i32, ptr %9, align 4, !tbaa !5
  %217 = add nsw i32 %216, 1
  %218 = sext i32 %217 to i64
  %219 = getelementptr inbounds [15 x [36384 x i32]], ptr @f, i64 0, i64 %218
  %220 = load i32, ptr %10, align 4, !tbaa !5
  %221 = load i32, ptr %13, align 4, !tbaa !5
  %222 = xor i32 %220, %221
  %223 = sext i32 %222 to i64
  %224 = getelementptr inbounds [36384 x i32], ptr %219, i64 0, i64 %223
  store i32 %215, ptr %224, align 4, !tbaa !5
  br label %225

225:                                              ; preds = %187
  %226 = load i32, ptr %13, align 4, !tbaa !5
  %227 = sub nsw i32 %226, 1
  %228 = load i32, ptr %12, align 4, !tbaa !5
  %229 = and i32 %227, %228
  store i32 %229, ptr %13, align 4, !tbaa !5
  br label %183, !llvm.loop !14

230:                                              ; preds = %186
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #5
  br label %231

231:                                              ; preds = %230, %163
  br label %232

232:                                              ; preds = %231
  %233 = load i32, ptr %10, align 4, !tbaa !5
  %234 = add nsw i32 %233, 1
  store i32 %234, ptr %10, align 4, !tbaa !5
  br label %157, !llvm.loop !15

235:                                              ; preds = %162
  br label %236

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

239:                                              ; preds = %155
  %240 = load i32, ptr @k, align 4, !tbaa !5
  %241 = sext i32 %240 to i64
  %242 = getelementptr inbounds [15 x [36384 x i32]], ptr @f, i64 0, i64 %241
  %243 = load i32, ptr @n, align 4, !tbaa !5
  %244 = shl i32 1, %243
  %245 = sub nsw i32 %244, 1
  %246 = sext i32 %245 to i64
  %247 = getelementptr inbounds [36384 x i32], ptr %242, i64 0, i64 %246
  %248 = load i32, ptr %247, align 4, !tbaa !5
  %249 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i32 noundef %248)
  %250 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %249, ptr noundef @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
  ret void
}

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 nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #2

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

; Function Attrs: 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(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) #0 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)) #4

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

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

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"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}


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

@n = 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 [15 x [36384 x i32]], align 16
@g = external dso_local local_unnamed_addr global [36384 x i32], align 16
@Num = external dso_local local_unnamed_addr global [36384 x i32], align 16
@p2 = external dso_local local_unnamed_addr global [36384 x i32], align 16
@_ZSt3cin = external global %"class.std::basic_istream", align 8
@_ZSt4cout = external global %"class.std::basic_ostream", align 8

; Function Attrs: mustprogress uwtable
define dso_local void @_Z5solvev() local_unnamed_addr #0 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = 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)
  %4 = tail call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %3, ptr noundef nonnull align 4 dereferenceable(4) @m)
  %5 = tail call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %4, ptr noundef nonnull align 4 dereferenceable(4) @k)
  tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(145536) @g, i8 0, i64 145536, i1 false)
  %6 = load i32, ptr @m, align 4, !tbaa !5
  %.not69 = icmp slt i32 %6, 1
  br i1 %.not69, label %.._crit_edge73_crit_edge, label %.lr.ph72

.._crit_edge73_crit_edge:                         ; preds = %0
  %.pre = load i32, ptr @n, align 4, !tbaa !5
  %.pre113 = shl nuw i32 1, %.pre
  br label %._crit_edge73

._crit_edge73:                                    ; preds = %._crit_edge, %.._crit_edge73_crit_edge
  %.pre-phi = phi i32 [ %.pre113, %.._crit_edge73_crit_edge ], [ %11, %._crit_edge ]
  %7 = phi i32 [ %.pre, %.._crit_edge73_crit_edge ], [ %10, %._crit_edge ]
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(2183040) @f, i8 0, i64 2183040, i1 false)
  %.not = icmp eq i32 %7, 31
  br i1 %.not, label %.preheader65, label %.lr.ph81.preheader

.lr.ph81.preheader:                               ; preds = %._crit_edge73
  %smax100 = call i32 @llvm.smax.i32(i32 %.pre-phi, i32 1)
  %wide.trip.count101 = zext nneg i32 %smax100 to i64
  br label %.lr.ph81

.lr.ph72:                                         ; preds = %0, %._crit_edge
  %.05170 = phi i32 [ %27, %._crit_edge ], [ 1, %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
  %8 = 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)
  %9 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %8, ptr noundef nonnull align 4 dereferenceable(4) %2)
  %10 = load i32, ptr @n, align 4, !tbaa !5
  %11 = shl nuw i32 1, %10
  %.not94 = icmp eq i32 %10, 31
  br i1 %.not94, label %._crit_edge, label %.lr.ph

.lr.ph:                                           ; preds = %.lr.ph72
  %12 = load i32, ptr %2, align 4, !tbaa !5
  %13 = add nsw i32 %12, -1
  %14 = load i32, ptr %1, align 4, !tbaa !5
  %15 = add nsw i32 %14, -1
  %16 = shl nuw i32 1, %15
  %17 = shl nuw i32 1, %13
  %smax = call i32 @llvm.smax.i32(i32 %11, i32 1)
  %wide.trip.count = zext nneg i32 %smax to i64
  %18 = freeze i32 %17
  %19 = or i32 %16, %18
  %xtraiter = and i64 %wide.trip.count, 1
  %20 = icmp slt i32 %11, 2
  br i1 %20, label %._crit_edge.loopexit.unr-lcssa, label %.lr.ph.new

.lr.ph.new:                                       ; preds = %.lr.ph
  %unroll_iter = and i64 %wide.trip.count, 2147483646
  br label %29

._crit_edge.loopexit.unr-lcssa:                   ; preds = %43, %.lr.ph
  %indvars.iv.unr = phi i64 [ 0, %.lr.ph ], [ %indvars.iv.next.1, %43 ]
  %lcmp.mod.not = icmp ne i64 %xtraiter, 0
  %21 = trunc nuw nsw i64 %indvars.iv.unr to i32
  %22 = and i32 %19, %21
  %or.cond.not.epil = icmp eq i32 %22, %19
  %or.cond = select i1 %lcmp.mod.not, i1 %or.cond.not.epil, i1 false
  br i1 %or.cond, label %23, label %._crit_edge

23:                                               ; preds = %._crit_edge.loopexit.unr-lcssa
  %24 = getelementptr inbounds [36384 x i32], ptr @g, i64 0, i64 %indvars.iv.unr
  %25 = load i32, ptr %24, align 4, !tbaa !5
  %26 = add nsw i32 %25, 1
  store i32 %26, ptr %24, align 4, !tbaa !5
  br label %._crit_edge

._crit_edge:                                      ; preds = %._crit_edge.loopexit.unr-lcssa, %23, %.lr.ph72
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %2) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #6
  %27 = add nuw nsw i32 %.05170, 1
  %28 = load i32, ptr @m, align 4, !tbaa !5
  %.not.not = icmp slt i32 %.05170, %28
  br i1 %.not.not, label %.lr.ph72, label %._crit_edge73, !llvm.loop !9

29:                                               ; preds = %43, %.lr.ph.new
  %indvars.iv = phi i64 [ 0, %.lr.ph.new ], [ %indvars.iv.next.1, %43 ]
  %niter = phi i64 [ 0, %.lr.ph.new ], [ %niter.next.1, %43 ]
  %30 = trunc nuw nsw i64 %indvars.iv to i32
  %31 = and i32 %19, %30
  %or.cond.not = icmp eq i32 %31, %19
  br i1 %or.cond.not, label %32, label %36

32:                                               ; preds = %29
  %33 = getelementptr inbounds [36384 x i32], ptr @g, i64 0, i64 %indvars.iv
  %34 = load i32, ptr %33, align 8, !tbaa !5
  %35 = add nsw i32 %34, 1
  store i32 %35, ptr %33, align 8, !tbaa !5
  br label %36

36:                                               ; preds = %29, %32
  %indvars.iv.next = or disjoint i64 %indvars.iv, 1
  %37 = trunc nuw nsw i64 %indvars.iv.next to i32
  %38 = and i32 %19, %37
  %or.cond.not.1 = icmp eq i32 %38, %19
  br i1 %or.cond.not.1, label %39, label %43

39:                                               ; preds = %36
  %40 = getelementptr inbounds [36384 x i32], ptr @g, i64 0, i64 %indvars.iv.next
  %41 = load i32, ptr %40, align 4, !tbaa !5
  %42 = add nsw i32 %41, 1
  store i32 %42, ptr %40, align 4, !tbaa !5
  br label %43

43:                                               ; preds = %39, %36
  %indvars.iv.next.1 = add nuw nsw i64 %indvars.iv, 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_edge.loopexit.unr-lcssa, label %29, !llvm.loop !11

.preheader65:                                     ; preds = %._crit_edge78, %._crit_edge73
  %44 = load i32, ptr @k, align 4, !tbaa !5
  %45 = icmp sgt i32 %44, 1
  br i1 %45, label %.preheader.lr.ph, label %._crit_edge92

.preheader.lr.ph:                                 ; preds = %.preheader65
  %46 = icmp sgt i32 %.pre-phi, 1
  %47 = add nsw i32 %.pre-phi, -1
  br i1 %46, label %.preheader.us.preheader, label %._crit_edge92

.preheader.us.preheader:                          ; preds = %.preheader.lr.ph
  %wide.trip.count111 = zext nneg i32 %44 to i64
  %wide.trip.count106 = zext nneg i32 %.pre-phi to i64
  br label %.preheader.us

.preheader.us:                                    ; preds = %.preheader.us.preheader, %._crit_edge90.us
  %indvars.iv108 = phi i64 [ 1, %.preheader.us.preheader ], [ %indvars.iv.next109, %._crit_edge90.us ]
  %indvars.iv.next109 = add nuw nsw i64 %indvars.iv108, 1
  br label %48

48:                                               ; preds = %.preheader.us, %.loopexit.us
  %indvars.iv103 = phi i64 [ 1, %.preheader.us ], [ %indvars.iv.next104, %.loopexit.us ]
  %49 = getelementptr inbounds [36384 x i32], ptr @Num, i64 0, i64 %indvars.iv103
  %50 = load i32, ptr %49, align 4, !tbaa !5
  %.not59.us = icmp eq i32 %50, 0
  br i1 %.not59.us, label %.loopexit.us, label %51

51:                                               ; preds = %48
  %52 = trunc nuw nsw i64 %indvars.iv103 to i32
  %53 = xor i32 %52, -1
  %54 = trunc i64 %indvars.iv103 to i32
  %55 = add i32 %54, -1
  %56 = and i32 %55, %53
  %57 = xor i32 %47, %56
  %58 = xor i32 %57, %52
  %59 = zext i32 %57 to i64
  %.not6083.us = icmp eq i64 %indvars.iv103, %59
  br i1 %.not6083.us, label %.loopexit.us, label %.lr.ph86.us

60:                                               ; preds = %.lr.ph86.us, %60
  %.084.us = phi i32 [ %58, %.lr.ph86.us ], [ %75, %60 ]
  %61 = xor i32 %.084.us, %52
  %62 = sext i32 %61 to i64
  %63 = getelementptr inbounds [15 x [36384 x i32]], ptr @f, i64 0, i64 %indvars.iv.next109, i64 %62
  %64 = load i32, ptr %63, align 4, !tbaa !5
  %65 = sext i32 %64 to i64
  %66 = sext i32 %.084.us to i64
  %67 = getelementptr inbounds [15 x [36384 x i32]], ptr @f, i64 0, i64 %indvars.iv108, i64 %66
  %68 = load i32, ptr %67, align 4, !tbaa !5
  %69 = sext i32 %68 to i64
  %70 = mul nsw i64 %69, %76
  %71 = add nsw i64 %70, %65
  %72 = srem i64 %71, 1000000009
  %73 = trunc nsw i64 %72 to i32
  store i32 %73, ptr %63, align 4, !tbaa !5
  %74 = add nsw i32 %.084.us, -1
  %75 = and i32 %74, %58
  %.not60.us = icmp eq i32 %75, 0
  br i1 %.not60.us, label %.loopexit.us, label %60, !llvm.loop !12

.loopexit.us:                                     ; preds = %60, %51, %48
  %indvars.iv.next104 = add nuw nsw i64 %indvars.iv103, 1
  %exitcond107.not = icmp eq i64 %indvars.iv.next104, %wide.trip.count106
  br i1 %exitcond107.not, label %._crit_edge90.us, label %48, !llvm.loop !13

.lr.ph86.us:                                      ; preds = %51
  %76 = sext i32 %50 to i64
  br label %60

._crit_edge90.us:                                 ; preds = %.loopexit.us
  %exitcond112.not = icmp eq i64 %indvars.iv.next109, %wide.trip.count111
  br i1 %exitcond112.not, label %._crit_edge92, label %.preheader.us, !llvm.loop !14

.lr.ph81:                                         ; preds = %.lr.ph81.preheader, %._crit_edge78
  %indvars.iv97 = phi i64 [ 0, %.lr.ph81.preheader ], [ %indvars.iv.next98, %._crit_edge78 ]
  %indvars99 = trunc i64 %indvars.iv97 to i32
  %77 = getelementptr inbounds [36384 x i32], ptr @g, i64 0, i64 %indvars.iv97
  %78 = load i32, ptr %77, align 4, !tbaa !5
  %79 = sext i32 %78 to i64
  %80 = getelementptr inbounds [36384 x i32], ptr @p2, i64 0, i64 %79
  %81 = load i32, ptr %80, align 4, !tbaa !5
  %82 = getelementptr inbounds [36384 x i32], ptr @Num, i64 0, i64 %indvars.iv97
  store i32 %81, ptr %82, align 4, !tbaa !5
  %83 = sub nsw i32 0, %indvars99
  %84 = and i32 %indvars99, %83
  %85 = add nuw i32 %indvars99, 2147483647
  %86 = and i32 %85, %indvars99
  %.not6174 = icmp eq i32 %86, 0
  br i1 %.not6174, label %._crit_edge78, label %.lr.ph77

._crit_edge78:                                    ; preds = %111, %.lr.ph81
  %87 = phi i32 [ %81, %.lr.ph81 ], [ %112, %111 ]
  %88 = add nsw i32 %87, 1000000009
  %89 = srem i32 %88, 1000000009
  store i32 %89, ptr %82, align 4, !tbaa !5
  %90 = getelementptr inbounds [36384 x i32], ptr getelementptr inbounds (i8, ptr @f, i64 145536), i64 0, i64 %indvars.iv97
  store i32 %89, ptr %90, align 4, !tbaa !5
  %indvars.iv.next98 = add nuw nsw i64 %indvars.iv97, 1
  %exitcond102.not = icmp eq i64 %indvars.iv.next98, %wide.trip.count101
  br i1 %exitcond102.not, label %.preheader65, label %.lr.ph81, !llvm.loop !15

.lr.ph77:                                         ; preds = %.lr.ph81, %111
  %91 = phi i32 [ %112, %111 ], [ %81, %.lr.ph81 ]
  %.05475 = phi i32 [ %114, %111 ], [ %86, %.lr.ph81 ]
  %92 = and i32 %84, %.05475
  %.not62 = icmp eq i32 %92, 0
  br i1 %.not62, label %111, label %93

93:                                               ; preds = %.lr.ph77
  %94 = sext i32 %91 to i64
  %95 = xor i32 %.05475, %indvars99
  %96 = sext i32 %95 to i64
  %97 = getelementptr inbounds [36384 x i32], ptr @g, i64 0, i64 %96
  %98 = load i32, ptr %97, align 4, !tbaa !5
  %99 = sext i32 %98 to i64
  %100 = getelementptr inbounds [36384 x i32], ptr @p2, i64 0, i64 %99
  %101 = load i32, ptr %100, align 4, !tbaa !5
  %102 = sext i32 %101 to i64
  %103 = sext i32 %.05475 to i64
  %104 = getelementptr inbounds [36384 x i32], ptr @Num, i64 0, i64 %103
  %105 = load i32, ptr %104, align 4, !tbaa !5
  %106 = sext i32 %105 to i64
  %107 = mul nsw i64 %106, %102
  %108 = sub nsw i64 %94, %107
  %109 = srem i64 %108, 1000000009
  %110 = trunc nsw i64 %109 to i32
  store i32 %110, ptr %82, align 4, !tbaa !5
  br label %111

111:                                              ; preds = %.lr.ph77, %93
  %112 = phi i32 [ %91, %.lr.ph77 ], [ %110, %93 ]
  %113 = add nuw i32 %.05475, 2147483647
  %114 = and i32 %113, %indvars99
  %.not61 = icmp eq i32 %114, 0
  br i1 %.not61, label %._crit_edge78, label %.lr.ph77, !llvm.loop !16

._crit_edge92:                                    ; preds = %._crit_edge90.us, %.preheader.lr.ph, %.preheader65
  %115 = sext i32 %44 to i64
  %notmask = shl nsw i32 -1, %7
  %116 = xor i32 %notmask, -1
  %117 = zext nneg i32 %116 to i64
  %118 = getelementptr inbounds [15 x [36384 x i32]], ptr @f, i64 0, i64 %115, i64 %117
  %119 = load i32, ptr %118, align 4, !tbaa !5
  %120 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i32 noundef %119)
  %121 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %120, ptr noundef nonnull @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
  ret void
}

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 nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #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(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 #0 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)) #4

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

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


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