; LLVM IR from kazunetakahashi/atcoder :: 2018/0930_KUPC2018 (E)

; 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" }
%class.BIT = type { i32, ptr }

@inv = external dso_local global [1000010 x i64], align 16
@fact = external dso_local global [1000010 x i64], align 16
@N = external dso_local global i32, align 4
@a = external dso_local global [200010 x i32], align 16
@b = external dso_local global [200010 x i64], align 16
@c = external dso_local global [200010 x i64], align 16
@d = external dso_local global [200010 x i64], align 16
@_ZSt3cin = external global %"class.std::basic_istream", align 8
@_ZSt4cout = external global %"class.std::basic_ostream", align 8

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_Z4initv() #0

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i64 @_Z1Cii(i32 noundef, i32 noundef) #0

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() #2 personality ptr @__gxx_personality_v0 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = alloca %class.BIT, align 8
  %4 = alloca i32, align 4
  %5 = alloca ptr, align 8
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  %8 = alloca i64, align 8
  %9 = alloca i32, align 4
  store i32 0, ptr %1, align 4
  call void @_Z4initv()
  %10 = 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)
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #6
  store i32 0, ptr %2, align 4, !tbaa !5
  br label %11

11:                                               ; preds = %26, %0
  %12 = load i32, ptr %2, align 4, !tbaa !5
  %13 = load i32, ptr @N, align 4, !tbaa !5
  %14 = icmp slt i32 %12, %13
  br i1 %14, label %16, label %15

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

16:                                               ; preds = %11
  %17 = load i32, ptr %2, align 4, !tbaa !5
  %18 = sext i32 %17 to i64
  %19 = getelementptr inbounds [200010 x i32], ptr @a, i64 0, i64 %18
  %20 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) %19)
  %21 = load i32, ptr %2, align 4, !tbaa !5
  %22 = sext i32 %21 to i64
  %23 = getelementptr inbounds [200010 x i32], ptr @a, i64 0, i64 %22
  %24 = load i32, ptr %23, align 4, !tbaa !5
  %25 = add nsw i32 %24, -1
  store i32 %25, ptr %23, align 4, !tbaa !5
  br label %26

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

29:                                               ; preds = %15
  call void @llvm.lifetime.start.p0(i64 16, ptr %3) #6
  %30 = load i32, ptr @N, align 4, !tbaa !5
  %31 = add nsw i32 %30, 1
  call void @_ZN3BITC2Ei(ptr noundef nonnull align 8 dereferenceable(16) %3, i32 noundef %31)
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #6
  store i32 0, ptr %4, align 4, !tbaa !5
  br label %32

32:                                               ; preds = %60, %29
  %33 = load i32, ptr %4, align 4, !tbaa !5
  %34 = load i32, ptr @N, align 4, !tbaa !5
  %35 = icmp slt i32 %33, %34
  br i1 %35, label %37, label %36

36:                                               ; preds = %32
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #6
  br label %67

37:                                               ; preds = %32
  %38 = load i32, ptr %4, align 4, !tbaa !5
  %39 = sext i32 %38 to i64
  %40 = getelementptr inbounds [200010 x i32], ptr @a, i64 0, i64 %39
  %41 = load i32, ptr %40, align 4, !tbaa !5
  %42 = sext i32 %41 to i64
  %43 = load i32, ptr %4, align 4, !tbaa !5
  %44 = sext i32 %43 to i64
  %45 = getelementptr inbounds [200010 x i32], ptr @a, i64 0, i64 %44
  %46 = load i32, ptr %45, align 4, !tbaa !5
  %47 = add nsw i32 %46, 1
  %48 = invoke noundef i64 @_ZN3BIT3sumEii(ptr noundef nonnull align 8 dereferenceable(16) %3, i32 noundef 1, i32 noundef %47)
          to label %49 unwind label %63

49:                                               ; preds = %37
  %50 = sub nsw i64 %42, %48
  %51 = load i32, ptr %4, align 4, !tbaa !5
  %52 = sext i32 %51 to i64
  %53 = getelementptr inbounds [200010 x i64], ptr @b, i64 0, i64 %52
  store i64 %50, ptr %53, align 8, !tbaa !11
  %54 = load i32, ptr %4, align 4, !tbaa !5
  %55 = sext i32 %54 to i64
  %56 = getelementptr inbounds [200010 x i32], ptr @a, i64 0, i64 %55
  %57 = load i32, ptr %56, align 4, !tbaa !5
  %58 = add nsw i32 %57, 1
  invoke void @_ZN3BIT3addEi(ptr noundef nonnull align 8 dereferenceable(16) %3, i32 noundef %58)
          to label %59 unwind label %63

59:                                               ; preds = %49
  br label %60

60:                                               ; preds = %59
  %61 = load i32, ptr %4, align 4, !tbaa !5
  %62 = add nsw i32 %61, 1
  store i32 %62, ptr %4, align 4, !tbaa !5
  br label %32, !llvm.loop !13

63:                                               ; preds = %49, %37
  %64 = landingpad { ptr, i32 }
          cleanup
  %65 = extractvalue { ptr, i32 } %64, 0
  store ptr %65, ptr %5, align 8
  %66 = extractvalue { ptr, i32 } %64, 1
  store i32 %66, ptr %6, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #6
  br label %236

67:                                               ; preds = %36
  %68 = load i32, ptr @N, align 4, !tbaa !5
  %69 = sub nsw i32 %68, 1
  %70 = sext i32 %69 to i64
  %71 = getelementptr inbounds [200010 x i64], ptr @c, i64 0, i64 %70
  store i64 1, ptr %71, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #6
  %72 = load i32, ptr @N, align 4, !tbaa !5
  %73 = sub nsw i32 %72, 2
  store i32 %73, ptr %7, align 4, !tbaa !5
  br label %74

74:                                               ; preds = %110, %67
  %75 = load i32, ptr %7, align 4, !tbaa !5
  %76 = icmp sge i32 %75, 0
  br i1 %76, label %78, label %77

77:                                               ; preds = %74
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #6
  br label %113

78:                                               ; preds = %74
  %79 = load i32, ptr %7, align 4, !tbaa !5
  %80 = sext i32 %79 to i64
  %81 = getelementptr inbounds [200010 x i64], ptr @b, i64 0, i64 %80
  %82 = load i64, ptr %81, align 8, !tbaa !11
  %83 = load i32, ptr @N, align 4, !tbaa !5
  %84 = sub nsw i32 %83, 1
  %85 = load i32, ptr %7, align 4, !tbaa !5
  %86 = sub nsw i32 %84, %85
  %87 = sext i32 %86 to i64
  %88 = getelementptr inbounds [1000010 x i64], ptr @fact, i64 0, i64 %87
  %89 = load i64, ptr %88, align 8, !tbaa !11
  %90 = mul nsw i64 %82, %89
  %91 = srem i64 %90, 1000000007
  %92 = load i32, ptr %7, align 4, !tbaa !5
  %93 = sext i32 %92 to i64
  %94 = getelementptr inbounds [200010 x i64], ptr @c, i64 0, i64 %93
  store i64 %91, ptr %94, align 8, !tbaa !11
  %95 = load i32, ptr %7, align 4, !tbaa !5
  %96 = add nsw i32 %95, 1
  %97 = sext i32 %96 to i64
  %98 = getelementptr inbounds [200010 x i64], ptr @c, i64 0, i64 %97
  %99 = load i64, ptr %98, align 8, !tbaa !11
  %100 = load i32, ptr %7, align 4, !tbaa !5
  %101 = sext i32 %100 to i64
  %102 = getelementptr inbounds [200010 x i64], ptr @c, i64 0, i64 %101
  %103 = load i64, ptr %102, align 8, !tbaa !11
  %104 = add nsw i64 %103, %99
  store i64 %104, ptr %102, align 8, !tbaa !11
  %105 = load i32, ptr %7, align 4, !tbaa !5
  %106 = sext i32 %105 to i64
  %107 = getelementptr inbounds [200010 x i64], ptr @c, i64 0, i64 %106
  %108 = load i64, ptr %107, align 8, !tbaa !11
  %109 = srem i64 %108, 1000000007
  store i64 %109, ptr %107, align 8, !tbaa !11
  br label %110

110:                                              ; preds = %78
  %111 = load i32, ptr %7, align 4, !tbaa !5
  %112 = add nsw i32 %111, -1
  store i32 %112, ptr %7, align 4, !tbaa !5
  br label %74, !llvm.loop !14

113:                                              ; preds = %77
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #6
  store i64 0, ptr %8, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #6
  store i32 0, ptr %9, align 4, !tbaa !5
  br label %114

114:                                              ; preds = %222, %113
  %115 = load i32, ptr %9, align 4, !tbaa !5
  %116 = load i32, ptr @N, align 4, !tbaa !5
  %117 = icmp slt i32 %115, %116
  br i1 %117, label %119, label %118

118:                                              ; preds = %114
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #6
  br label %225

119:                                              ; preds = %114
  %120 = load i32, ptr %9, align 4, !tbaa !5
  %121 = sext i32 %120 to i64
  %122 = getelementptr inbounds [200010 x i64], ptr @d, i64 0, i64 %121
  store i64 0, ptr %122, align 8, !tbaa !11
  %123 = load i32, ptr @N, align 4, !tbaa !5
  %124 = sub nsw i32 %123, 1
  %125 = load i32, ptr %9, align 4, !tbaa !5
  %126 = sub nsw i32 %124, %125
  %127 = sext i32 %126 to i64
  %128 = getelementptr inbounds [1000010 x i64], ptr @fact, i64 0, i64 %127
  %129 = load i64, ptr %128, align 8, !tbaa !11
  %130 = load i32, ptr %9, align 4, !tbaa !5
  %131 = sext i32 %130 to i64
  %132 = getelementptr inbounds [200010 x i64], ptr @b, i64 0, i64 %131
  %133 = load i64, ptr %132, align 8, !tbaa !11
  %134 = load i32, ptr %9, align 4, !tbaa !5
  %135 = sext i32 %134 to i64
  %136 = getelementptr inbounds [200010 x i64], ptr @b, i64 0, i64 %135
  %137 = load i64, ptr %136, align 8, !tbaa !11
  %138 = sub nsw i64 %137, 1
  %139 = mul nsw i64 %133, %138
  %140 = sdiv i64 %139, 2
  %141 = srem i64 %140, 1000000007
  %142 = mul nsw i64 %129, %141
  %143 = srem i64 %142, 1000000007
  %144 = load i32, ptr %9, align 4, !tbaa !5
  %145 = sext i32 %144 to i64
  %146 = getelementptr inbounds [200010 x i64], ptr @d, i64 0, i64 %145
  %147 = load i64, ptr %146, align 8, !tbaa !11
  %148 = add nsw i64 %147, %143
  store i64 %148, ptr %146, align 8, !tbaa !11
  %149 = load i32, ptr %9, align 4, !tbaa !5
  %150 = sext i32 %149 to i64
  %151 = getelementptr inbounds [200010 x i64], ptr @d, i64 0, i64 %150
  %152 = load i64, ptr %151, align 8, !tbaa !11
  %153 = srem i64 %152, 1000000007
  store i64 %153, ptr %151, align 8, !tbaa !11
  %154 = load i32, ptr %9, align 4, !tbaa !5
  %155 = sext i32 %154 to i64
  %156 = getelementptr inbounds [200010 x i64], ptr @b, i64 0, i64 %155
  %157 = load i64, ptr %156, align 8, !tbaa !11
  %158 = load i32, ptr @N, align 4, !tbaa !5
  %159 = sub nsw i32 %158, 1
  %160 = load i32, ptr %9, align 4, !tbaa !5
  %161 = sub nsw i32 %159, %160
  %162 = sext i32 %161 to i64
  %163 = getelementptr inbounds [1000010 x i64], ptr @fact, i64 0, i64 %162
  %164 = load i64, ptr %163, align 8, !tbaa !11
  %165 = mul nsw i64 %157, %164
  %166 = srem i64 %165, 1000000007
  %167 = load i32, ptr @N, align 4, !tbaa !5
  %168 = sub nsw i32 %167, 1
  %169 = load i32, ptr %9, align 4, !tbaa !5
  %170 = sub nsw i32 %168, %169
  %171 = call noundef i64 @_Z1Cii(i32 noundef %170, i32 noundef 2)
  %172 = load i64, ptr getelementptr inbounds ([1000010 x i64], ptr @inv, i64 0, i64 2), align 16, !tbaa !11
  %173 = mul nsw i64 %171, %172
  %174 = srem i64 %173, 1000000007
  %175 = mul nsw i64 %166, %174
  %176 = srem i64 %175, 1000000007
  %177 = load i32, ptr %9, align 4, !tbaa !5
  %178 = sext i32 %177 to i64
  %179 = getelementptr inbounds [200010 x i64], ptr @d, i64 0, i64 %178
  %180 = load i64, ptr %179, align 8, !tbaa !11
  %181 = add nsw i64 %180, %176
  store i64 %181, ptr %179, align 8, !tbaa !11
  %182 = load i32, ptr %9, align 4, !tbaa !5
  %183 = sext i32 %182 to i64
  %184 = getelementptr inbounds [200010 x i64], ptr @d, i64 0, i64 %183
  %185 = load i64, ptr %184, align 8, !tbaa !11
  %186 = srem i64 %185, 1000000007
  store i64 %186, ptr %184, align 8, !tbaa !11
  %187 = load i32, ptr %9, align 4, !tbaa !5
  %188 = load i32, ptr @N, align 4, !tbaa !5
  %189 = sub nsw i32 %188, 1
  %190 = icmp slt i32 %187, %189
  br i1 %190, label %191, label %213

191:                                              ; preds = %119
  %192 = load i32, ptr %9, align 4, !tbaa !5
  %193 = sext i32 %192 to i64
  %194 = getelementptr inbounds [200010 x i64], ptr @b, i64 0, i64 %193
  %195 = load i64, ptr %194, align 8, !tbaa !11
  %196 = load i32, ptr %9, align 4, !tbaa !5
  %197 = add nsw i32 %196, 1
  %198 = sext i32 %197 to i64
  %199 = getelementptr inbounds [200010 x i64], ptr @c, i64 0, i64 %198
  %200 = load i64, ptr %199, align 8, !tbaa !11
  %201 = mul nsw i64 %195, %200
  %202 = srem i64 %201, 1000000007
  %203 = load i32, ptr %9, align 4, !tbaa !5
  %204 = sext i32 %203 to i64
  %205 = getelementptr inbounds [200010 x i64], ptr @d, i64 0, i64 %204
  %206 = load i64, ptr %205, align 8, !tbaa !11
  %207 = add nsw i64 %206, %202
  store i64 %207, ptr %205, align 8, !tbaa !11
  %208 = load i32, ptr %9, align 4, !tbaa !5
  %209 = sext i32 %208 to i64
  %210 = getelementptr inbounds [200010 x i64], ptr @d, i64 0, i64 %209
  %211 = load i64, ptr %210, align 8, !tbaa !11
  %212 = srem i64 %211, 1000000007
  store i64 %212, ptr %210, align 8, !tbaa !11
  br label %213

213:                                              ; preds = %191, %119
  %214 = load i32, ptr %9, align 4, !tbaa !5
  %215 = sext i32 %214 to i64
  %216 = getelementptr inbounds [200010 x i64], ptr @d, i64 0, i64 %215
  %217 = load i64, ptr %216, align 8, !tbaa !11
  %218 = load i64, ptr %8, align 8, !tbaa !11
  %219 = add nsw i64 %218, %217
  store i64 %219, ptr %8, align 8, !tbaa !11
  %220 = load i64, ptr %8, align 8, !tbaa !11
  %221 = srem i64 %220, 1000000007
  store i64 %221, ptr %8, align 8, !tbaa !11
  br label %222

222:                                              ; preds = %213
  %223 = load i32, ptr %9, align 4, !tbaa !5
  %224 = add nsw i32 %223, 1
  store i32 %224, ptr %9, align 4, !tbaa !5
  br label %114, !llvm.loop !15

225:                                              ; preds = %118
  %226 = load i64, ptr %8, align 8, !tbaa !11
  %227 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i64 noundef %226)
          to label %228 unwind label %232

228:                                              ; preds = %225
  %229 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %227, ptr noundef @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
          to label %230 unwind label %232

230:                                              ; preds = %228
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #6
  call void @_ZN3BITD2Ev(ptr noundef nonnull align 8 dereferenceable(16) %3) #6
  call void @llvm.lifetime.end.p0(i64 16, ptr %3) #6
  %231 = load i32, ptr %1, align 4
  ret i32 %231

232:                                              ; preds = %228, %225
  %233 = landingpad { ptr, i32 }
          cleanup
  %234 = extractvalue { ptr, i32 } %233, 0
  store ptr %234, ptr %5, align 8
  %235 = extractvalue { ptr, i32 } %233, 1
  store i32 %235, ptr %6, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #6
  br label %236

236:                                              ; preds = %232, %63
  call void @_ZN3BITD2Ev(ptr noundef nonnull align 8 dereferenceable(16) %3) #6
  call void @llvm.lifetime.end.p0(i64 16, ptr %3) #6
  br label %237

237:                                              ; preds = %236
  %238 = load ptr, ptr %5, align 8
  %239 = load i32, ptr %6, align 4
  %240 = insertvalue { ptr, i32 } poison, ptr %238, 0
  %241 = insertvalue { ptr, i32 } %240, i32 %239, 1
  resume { ptr, i32 } %241
}

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN3BITC2Ei(ptr noundef nonnull align 8 dereferenceable(16), i32 noundef) unnamed_addr #4 align 2

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

declare i32 @__gxx_personality_v0(...)

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

; 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

; 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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN3BITD2Ev(ptr noundef nonnull align 8 dereferenceable(16)) unnamed_addr #0 align 2

attributes #0 = { 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 #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { 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 #3 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { mustprogress 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 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = !{!12, !12, i64 0}
!12 = !{!"long long", !7, i64 0}
!13 = distinct !{!13, !10}
!14 = distinct !{!14, !10}
!15 = distinct !{!15, !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" }
%class.BIT = type { i32, ptr }

@inv = external dso_local local_unnamed_addr global [1000010 x i64], align 16
@fact = external dso_local local_unnamed_addr global [1000010 x i64], align 16
@N = external dso_local global i32, align 4
@a = external dso_local global [200010 x i32], align 16
@b = external dso_local local_unnamed_addr global [200010 x i64], align 16
@c = external dso_local local_unnamed_addr global [200010 x i64], align 16
@d = external dso_local local_unnamed_addr global [200010 x i64], align 16
@_ZSt3cin = external global %"class.std::basic_istream", align 8
@_ZSt4cout = external global %"class.std::basic_ostream", align 8

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_Z4initv() local_unnamed_addr #0

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i64 @_Z1Cii(i32 noundef, i32 noundef) local_unnamed_addr #0

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #2 personality ptr @__gxx_personality_v0 {
  %1 = alloca %class.BIT, align 8
  tail call void @_Z4initv()
  %2 = 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)
  %3 = load i32, ptr @N, align 4, !tbaa !5
  %4 = icmp sgt i32 %3, 0
  br i1 %4, label %.lr.ph, label %._crit_edge

._crit_edge:                                      ; preds = %.lr.ph, %0
  %.lcssa51 = phi i32 [ %3, %0 ], [ %15, %.lr.ph ]
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %1) #6
  %5 = add nsw i32 %.lcssa51, 1
  call void @_ZN3BITC2Ei(ptr noundef nonnull align 8 dereferenceable(16) %1, i32 noundef %5)
  %6 = load i32, ptr @N, align 4, !tbaa !5
  %7 = icmp sgt i32 %6, 0
  br i1 %7, label %.lr.ph55, label %.preheader.thread

.preheader.thread:                                ; preds = %._crit_edge
  %8 = add nsw i32 %6, -1
  %9 = sext i32 %8 to i64
  %10 = getelementptr inbounds [200010 x i64], ptr @c, i64 0, i64 %9
  store i64 1, ptr %10, align 8, !tbaa !9
  br label %._crit_edge64

.lr.ph:                                           ; preds = %0, %.lr.ph
  %indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph ], [ 0, %0 ]
  %11 = getelementptr inbounds [200010 x i32], ptr @a, i64 0, i64 %indvars.iv
  %12 = 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) %11)
  %13 = load i32, ptr %11, align 4, !tbaa !5
  %14 = add nsw i32 %13, -1
  store i32 %14, ptr %11, align 4, !tbaa !5
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %15 = load i32, ptr @N, align 4, !tbaa !5
  %16 = sext i32 %15 to i64
  %17 = icmp slt i64 %indvars.iv.next, %16
  br i1 %17, label %.lr.ph, label %._crit_edge, !llvm.loop !11

._crit_edge56:                                    ; preds = %35
  %18 = add nsw i32 %36, -1
  %19 = sext i32 %18 to i64
  %20 = getelementptr inbounds [200010 x i64], ptr @c, i64 0, i64 %19
  store i64 1, ptr %20, align 8, !tbaa !9
  %21 = icmp sgt i32 %36, 1
  br i1 %21, label %.lr.ph60.preheader, label %.preheader

.lr.ph60.preheader:                               ; preds = %._crit_edge56
  %22 = add nsw i32 %36, -2
  %23 = zext i32 %22 to i64
  %24 = shl nuw nsw i64 %23, 3
  %scevgep = getelementptr i8, ptr getelementptr inbounds (i8, ptr @c, i64 8), i64 %24
  %load_initial = load i64, ptr %scevgep, align 8
  br label %.lr.ph60

.lr.ph55:                                         ; preds = %._crit_edge, %35
  %indvars.iv70 = phi i64 [ %indvars.iv.next71, %35 ], [ 0, %._crit_edge ]
  %25 = getelementptr inbounds [200010 x i32], ptr @a, i64 0, i64 %indvars.iv70
  %26 = load i32, ptr %25, align 4, !tbaa !5
  %27 = add nsw i32 %26, 1
  %28 = invoke noundef i64 @_ZN3BIT3sumEii(ptr noundef nonnull align 8 dereferenceable(16) %1, i32 noundef 1, i32 noundef %27)
          to label %29 unwind label %39

29:                                               ; preds = %.lr.ph55
  %30 = sext i32 %26 to i64
  %31 = sub nsw i64 %30, %28
  %32 = getelementptr inbounds [200010 x i64], ptr @b, i64 0, i64 %indvars.iv70
  store i64 %31, ptr %32, align 8, !tbaa !9
  %33 = load i32, ptr %25, align 4, !tbaa !5
  %34 = add nsw i32 %33, 1
  invoke void @_ZN3BIT3addEi(ptr noundef nonnull align 8 dereferenceable(16) %1, i32 noundef %34)
          to label %35 unwind label %39

35:                                               ; preds = %29
  %indvars.iv.next71 = add nuw nsw i64 %indvars.iv70, 1
  %36 = load i32, ptr @N, align 4, !tbaa !5
  %37 = sext i32 %36 to i64
  %38 = icmp slt i64 %indvars.iv.next71, %37
  br i1 %38, label %.lr.ph55, label %._crit_edge56, !llvm.loop !13

39:                                               ; preds = %29, %.lr.ph55
  %40 = landingpad { ptr, i32 }
          cleanup
  br label %107

.preheader:                                       ; preds = %.lr.ph60, %._crit_edge56
  %41 = icmp sgt i32 %36, 0
  br i1 %41, label %.lr.ph63, label %._crit_edge64

.lr.ph60:                                         ; preds = %.lr.ph60.preheader, %.lr.ph60
  %store_forwarded = phi i64 [ %load_initial, %.lr.ph60.preheader ], [ %54, %.lr.ph60 ]
  %indvars.iv73 = phi i64 [ %23, %.lr.ph60.preheader ], [ %indvars.iv.next74, %.lr.ph60 ]
  %42 = getelementptr inbounds [200010 x i64], ptr @b, i64 0, i64 %indvars.iv73
  %43 = load i64, ptr %42, align 8, !tbaa !9
  %44 = trunc nuw nsw i64 %indvars.iv73 to i32
  %45 = xor i32 %44, -1
  %46 = add i32 %36, %45
  %47 = sext i32 %46 to i64
  %48 = getelementptr inbounds [1000010 x i64], ptr @fact, i64 0, i64 %47
  %49 = load i64, ptr %48, align 8, !tbaa !9
  %50 = mul nsw i64 %49, %43
  %51 = srem i64 %50, 1000000007
  %52 = getelementptr inbounds [200010 x i64], ptr @c, i64 0, i64 %indvars.iv73
  %53 = add nsw i64 %51, %store_forwarded
  %54 = srem i64 %53, 1000000007
  store i64 %54, ptr %52, align 8, !tbaa !9
  %indvars.iv.next74 = add nsw i64 %indvars.iv73, -1
  %.not = icmp eq i64 %indvars.iv73, 0
  br i1 %.not, label %.preheader, label %.lr.ph60, !llvm.loop !14

._crit_edge64:                                    ; preds = %96, %.preheader.thread, %.preheader
  %.042.lcssa = phi i64 [ 0, %.preheader ], [ 0, %.preheader.thread ], [ %99, %96 ]
  %55 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i64 noundef %.042.lcssa)
          to label %102 unwind label %105

.lr.ph63:                                         ; preds = %.preheader, %96
  %indvars.iv76 = phi i64 [ %indvars.iv.next77.pre-phi, %96 ], [ 0, %.preheader ]
  %56 = phi i32 [ %83, %96 ], [ %36, %.preheader ]
  %.04261 = phi i64 [ %99, %96 ], [ 0, %.preheader ]
  %57 = getelementptr inbounds [200010 x i64], ptr @d, i64 0, i64 %indvars.iv76
  %58 = trunc nuw nsw i64 %indvars.iv76 to i32
  %59 = xor i32 %58, -1
  %60 = add i32 %56, %59
  %61 = sext i32 %60 to i64
  %62 = getelementptr inbounds [1000010 x i64], ptr @fact, i64 0, i64 %61
  %63 = load i64, ptr %62, align 8, !tbaa !9
  %64 = getelementptr inbounds [200010 x i64], ptr @b, i64 0, i64 %indvars.iv76
  %65 = load i64, ptr %64, align 8, !tbaa !9
  %66 = add nsw i64 %65, -1
  %67 = mul nsw i64 %66, %65
  %68 = sdiv i64 %67, 2
  %69 = srem i64 %68, 1000000007
  %70 = mul nsw i64 %69, %63
  %71 = srem i64 %70, 1000000007
  store i64 %71, ptr %57, align 8, !tbaa !9
  %72 = mul nsw i64 %65, %63
  %73 = srem i64 %72, 1000000007
  %74 = call noundef i64 @_Z1Cii(i32 noundef %60, i32 noundef 2)
  %75 = load i64, ptr getelementptr inbounds (i8, ptr @inv, i64 16), align 16, !tbaa !9
  %76 = mul nsw i64 %75, %74
  %77 = srem i64 %76, 1000000007
  %78 = mul nsw i64 %77, %73
  %79 = srem i64 %78, 1000000007
  %80 = load i64, ptr %57, align 8, !tbaa !9
  %81 = add nsw i64 %79, %80
  %82 = srem i64 %81, 1000000007
  store i64 %82, ptr %57, align 8, !tbaa !9
  %83 = load i32, ptr @N, align 4, !tbaa !5
  %84 = add nsw i32 %83, -1
  %85 = sext i32 %84 to i64
  %86 = icmp slt i64 %indvars.iv76, %85
  br i1 %86, label %87, label %.lr.ph63._crit_edge

.lr.ph63._crit_edge:                              ; preds = %.lr.ph63
  %.pre = add nuw nsw i64 %indvars.iv76, 1
  br label %96

87:                                               ; preds = %.lr.ph63
  %88 = load i64, ptr %64, align 8, !tbaa !9
  %89 = add nuw nsw i64 %indvars.iv76, 1
  %90 = getelementptr inbounds [200010 x i64], ptr @c, i64 0, i64 %89
  %91 = load i64, ptr %90, align 8, !tbaa !9
  %92 = mul nsw i64 %91, %88
  %93 = srem i64 %92, 1000000007
  %94 = add nsw i64 %93, %82
  %.lhs.trunc = trunc nsw i64 %94 to i32
  %95 = srem i32 %.lhs.trunc, 1000000007
  %.sext = sext i32 %95 to i64
  store i64 %.sext, ptr %57, align 8, !tbaa !9
  br label %96

96:                                               ; preds = %.lr.ph63._crit_edge, %87
  %indvars.iv.next77.pre-phi = phi i64 [ %.pre, %.lr.ph63._crit_edge ], [ %89, %87 ]
  %97 = phi i64 [ %82, %.lr.ph63._crit_edge ], [ %.sext, %87 ]
  %98 = add nsw i64 %97, %.04261
  %99 = srem i64 %98, 1000000007
  %100 = sext i32 %83 to i64
  %101 = icmp slt i64 %indvars.iv.next77.pre-phi, %100
  br i1 %101, label %.lr.ph63, label %._crit_edge64, !llvm.loop !15

102:                                              ; preds = %._crit_edge64
  %103 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %55, ptr noundef nonnull @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
          to label %104 unwind label %105

104:                                              ; preds = %102
  call void @_ZN3BITD2Ev(ptr noundef nonnull align 8 dereferenceable(16) %1) #6
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %1) #6
  ret i32 0

105:                                              ; preds = %102, %._crit_edge64
  %106 = landingpad { ptr, i32 }
          cleanup
  br label %107

107:                                              ; preds = %105, %39
  %.pn = phi { ptr, i32 } [ %40, %39 ], [ %106, %105 ]
  call void @_ZN3BITD2Ev(ptr noundef nonnull align 8 dereferenceable(16) %1) #6
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %1) #6
  resume { ptr, i32 } %.pn
}

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN3BITC2Ei(ptr noundef nonnull align 8 dereferenceable(16), i32 noundef) unnamed_addr #4 align 2

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

declare i32 @__gxx_personality_v0(...)

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN3BIT3addEi(ptr noundef nonnull align 8 dereferenceable(16), i32 noundef) local_unnamed_addr #4 align 2

; 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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN3BITD2Ev(ptr noundef nonnull align 8 dereferenceable(16)) unnamed_addr #0 align 2

attributes #0 = { 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 #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { 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 #3 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { mustprogress 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 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"long long", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = distinct !{!13, !12}
!14 = distinct !{!14, !12}
!15 = distinct !{!15, !12}


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