; LLVM IR from kazunetakahashi/atcoder :: 2018/0805_ABC104 (D)

; Unoptimized IR (clang -disable-llvm-passes):
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

%"class.std::__cxx11::basic_string" = type { %"struct.std::__cxx11::basic_string<char>::_Alloc_hider", i64, %union.anon }
%"struct.std::__cxx11::basic_string<char>::_Alloc_hider" = type { ptr }
%union.anon = type { i64, [8 x i8] }
%"class.std::basic_istream" = type { ptr, i64, %"class.std::basic_ios" }
%"class.std::basic_ios" = type { %"class.std::ios_base", ptr, i8, i8, ptr, ptr, ptr, ptr }
%"class.std::ios_base" = type { ptr, i64, i64, i32, i32, i32, ptr, %"struct.std::ios_base::_Words", [8 x %"struct.std::ios_base::_Words"], i32, ptr, %"class.std::locale" }
%"struct.std::ios_base::_Words" = type { ptr, i64 }
%"class.std::locale" = type { ptr }
%"class.std::basic_ostream" = type { ptr, %"class.std::basic_ios" }

@_Z1SB5cxx11 = external dso_local global %"class.std::__cxx11::basic_string", align 8
@N = external dso_local global i32, align 4
@cnt_A = external dso_local global [100010 x i64], align 16
@cnt_q = external dso_local global [100010 x i64], align 16
@cnt_C = external dso_local global [100010 x i64], align 16
@sum_A = external dso_local global i64, align 8
@sum_q = external dso_local global i64, align 8
@sum_C = external dso_local global i64, align 8
@_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 uwtable
declare dso_local noundef i64 @_Z5powerxx(i64 noundef, i64 noundef) #2

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() #3 {
  %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 i64, align 8
  %8 = alloca i32, align 4
  store i32 0, ptr %1, align 4
  call void @_Z4initv()
  %9 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZStrsIcSt11char_traitsIcESaIcEERSt13basic_istreamIT_T0_ES7_RNSt7__cxx1112basic_stringIS4_S5_T1_EE(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(32) @_Z1SB5cxx11)
  %10 = call noundef i64 @_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(32) @_Z1SB5cxx11) #6
  %11 = trunc i64 %10 to i32
  store i32 %11, ptr @N, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #6
  store i32 0, ptr %2, align 4, !tbaa !5
  call void @_ZSt4fillIPxiEvT_S1_RKT0_(ptr noundef @cnt_A, ptr noundef getelementptr inbounds (i64, ptr @cnt_A, i64 100010), ptr noundef nonnull align 4 dereferenceable(4) %2)
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #6
  store i32 0, ptr %3, align 4, !tbaa !5
  call void @_ZSt4fillIPxiEvT_S1_RKT0_(ptr noundef @cnt_q, ptr noundef getelementptr inbounds (i64, ptr @cnt_q, i64 100010), ptr noundef nonnull align 4 dereferenceable(4) %3)
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #6
  store i32 0, ptr %4, align 4, !tbaa !5
  call void @_ZSt4fillIPxiEvT_S1_RKT0_(ptr noundef @cnt_C, ptr noundef getelementptr inbounds (i64, ptr @cnt_C, i64 100010), ptr noundef nonnull align 4 dereferenceable(4) %4)
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #6
  store i32 0, ptr %5, align 4, !tbaa !5
  br label %12

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

16:                                               ; preds = %12
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #6
  br label %56

17:                                               ; preds = %12
  %18 = load i32, ptr %5, align 4, !tbaa !5
  %19 = sext i32 %18 to i64
  %20 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) @_Z1SB5cxx11, i64 noundef %19)
  %21 = load i8, ptr %20, align 1, !tbaa !9
  %22 = sext i8 %21 to i32
  %23 = icmp eq i32 %22, 65
  br i1 %23, label %24, label %28

24:                                               ; preds = %17
  %25 = load i32, ptr %5, align 4, !tbaa !5
  %26 = sext i32 %25 to i64
  %27 = getelementptr inbounds [100010 x i64], ptr @cnt_A, i64 0, i64 %26
  store i64 1, ptr %27, align 8, !tbaa !10
  br label %52

28:                                               ; preds = %17
  %29 = load i32, ptr %5, align 4, !tbaa !5
  %30 = sext i32 %29 to i64
  %31 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) @_Z1SB5cxx11, i64 noundef %30)
  %32 = load i8, ptr %31, align 1, !tbaa !9
  %33 = sext i8 %32 to i32
  %34 = icmp eq i32 %33, 63
  br i1 %34, label %35, label %39

35:                                               ; preds = %28
  %36 = load i32, ptr %5, align 4, !tbaa !5
  %37 = sext i32 %36 to i64
  %38 = getelementptr inbounds [100010 x i64], ptr @cnt_q, i64 0, i64 %37
  store i64 1, ptr %38, align 8, !tbaa !10
  br label %51

39:                                               ; preds = %28
  %40 = load i32, ptr %5, align 4, !tbaa !5
  %41 = sext i32 %40 to i64
  %42 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) @_Z1SB5cxx11, i64 noundef %41)
  %43 = load i8, ptr %42, align 1, !tbaa !9
  %44 = sext i8 %43 to i32
  %45 = icmp eq i32 %44, 67
  br i1 %45, label %46, label %50

46:                                               ; preds = %39
  %47 = load i32, ptr %5, align 4, !tbaa !5
  %48 = sext i32 %47 to i64
  %49 = getelementptr inbounds [100010 x i64], ptr @cnt_C, i64 0, i64 %48
  store i64 1, ptr %49, align 8, !tbaa !10
  br label %50

50:                                               ; preds = %46, %39
  br label %51

51:                                               ; preds = %50, %35
  br label %52

52:                                               ; preds = %51, %24
  br label %53

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

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

57:                                               ; preds = %93, %56
  %58 = load i32, ptr %6, align 4, !tbaa !5
  %59 = load i32, ptr @N, align 4, !tbaa !5
  %60 = icmp slt i32 %58, %59
  br i1 %60, label %62, label %61

61:                                               ; preds = %57
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #6
  br label %96

62:                                               ; preds = %57
  %63 = load i32, ptr %6, align 4, !tbaa !5
  %64 = sub nsw i32 %63, 1
  %65 = sext i32 %64 to i64
  %66 = getelementptr inbounds [100010 x i64], ptr @cnt_A, i64 0, i64 %65
  %67 = load i64, ptr %66, align 8, !tbaa !10
  %68 = load i32, ptr %6, align 4, !tbaa !5
  %69 = sext i32 %68 to i64
  %70 = getelementptr inbounds [100010 x i64], ptr @cnt_A, i64 0, i64 %69
  %71 = load i64, ptr %70, align 8, !tbaa !10
  %72 = add nsw i64 %71, %67
  store i64 %72, ptr %70, align 8, !tbaa !10
  %73 = load i32, ptr %6, align 4, !tbaa !5
  %74 = sub nsw i32 %73, 1
  %75 = sext i32 %74 to i64
  %76 = getelementptr inbounds [100010 x i64], ptr @cnt_q, i64 0, i64 %75
  %77 = load i64, ptr %76, align 8, !tbaa !10
  %78 = load i32, ptr %6, align 4, !tbaa !5
  %79 = sext i32 %78 to i64
  %80 = getelementptr inbounds [100010 x i64], ptr @cnt_q, i64 0, i64 %79
  %81 = load i64, ptr %80, align 8, !tbaa !10
  %82 = add nsw i64 %81, %77
  store i64 %82, ptr %80, align 8, !tbaa !10
  %83 = load i32, ptr %6, align 4, !tbaa !5
  %84 = sub nsw i32 %83, 1
  %85 = sext i32 %84 to i64
  %86 = getelementptr inbounds [100010 x i64], ptr @cnt_C, i64 0, i64 %85
  %87 = load i64, ptr %86, align 8, !tbaa !10
  %88 = load i32, ptr %6, align 4, !tbaa !5
  %89 = sext i32 %88 to i64
  %90 = getelementptr inbounds [100010 x i64], ptr @cnt_C, i64 0, i64 %89
  %91 = load i64, ptr %90, align 8, !tbaa !10
  %92 = add nsw i64 %91, %87
  store i64 %92, ptr %90, align 8, !tbaa !10
  br label %93

93:                                               ; preds = %62
  %94 = load i32, ptr %6, align 4, !tbaa !5
  %95 = add nsw i32 %94, 1
  store i32 %95, ptr %6, align 4, !tbaa !5
  br label %57, !llvm.loop !14

96:                                               ; preds = %61
  %97 = load i32, ptr @N, align 4, !tbaa !5
  %98 = sub nsw i32 %97, 1
  %99 = sext i32 %98 to i64
  %100 = getelementptr inbounds [100010 x i64], ptr @cnt_A, i64 0, i64 %99
  %101 = load i64, ptr %100, align 8, !tbaa !10
  store i64 %101, ptr @sum_A, align 8, !tbaa !10
  %102 = load i32, ptr @N, align 4, !tbaa !5
  %103 = sub nsw i32 %102, 1
  %104 = sext i32 %103 to i64
  %105 = getelementptr inbounds [100010 x i64], ptr @cnt_q, i64 0, i64 %104
  %106 = load i64, ptr %105, align 8, !tbaa !10
  store i64 %106, ptr @sum_q, align 8, !tbaa !10
  %107 = load i32, ptr @N, align 4, !tbaa !5
  %108 = sub nsw i32 %107, 1
  %109 = sext i32 %108 to i64
  %110 = getelementptr inbounds [100010 x i64], ptr @cnt_C, i64 0, i64 %109
  %111 = load i64, ptr %110, align 8, !tbaa !10
  store i64 %111, ptr @sum_C, align 8, !tbaa !10
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #6
  store i64 0, ptr %7, align 8, !tbaa !10
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #6
  store i32 1, ptr %8, align 4, !tbaa !5
  br label %112

112:                                              ; preds = %303, %96
  %113 = load i32, ptr %8, align 4, !tbaa !5
  %114 = load i32, ptr @N, align 4, !tbaa !5
  %115 = sub nsw i32 %114, 1
  %116 = icmp slt i32 %113, %115
  br i1 %116, label %118, label %117

117:                                              ; preds = %112
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #6
  br label %306

118:                                              ; preds = %112
  %119 = load i32, ptr %8, align 4, !tbaa !5
  %120 = sext i32 %119 to i64
  %121 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) @_Z1SB5cxx11, i64 noundef %120)
  %122 = load i8, ptr %121, align 1, !tbaa !9
  %123 = sext i8 %122 to i32
  %124 = icmp eq i32 %123, 66
  br i1 %124, label %125, label %209

125:                                              ; preds = %118
  %126 = load i32, ptr %8, align 4, !tbaa !5
  %127 = sub nsw i32 %126, 1
  %128 = sext i32 %127 to i64
  %129 = getelementptr inbounds [100010 x i64], ptr @cnt_A, i64 0, i64 %128
  %130 = load i64, ptr %129, align 8, !tbaa !10
  %131 = load i64, ptr @sum_C, align 8, !tbaa !10
  %132 = load i32, ptr %8, align 4, !tbaa !5
  %133 = sext i32 %132 to i64
  %134 = getelementptr inbounds [100010 x i64], ptr @cnt_C, i64 0, i64 %133
  %135 = load i64, ptr %134, align 8, !tbaa !10
  %136 = sub nsw i64 %131, %135
  %137 = mul nsw i64 %130, %136
  %138 = load i64, ptr @sum_q, align 8, !tbaa !10
  %139 = call noundef i64 @_Z5powerxx(i64 noundef 3, i64 noundef %138)
  %140 = mul nsw i64 %137, %139
  %141 = srem i64 %140, 1000000007
  %142 = load i64, ptr %7, align 8, !tbaa !10
  %143 = add nsw i64 %142, %141
  store i64 %143, ptr %7, align 8, !tbaa !10
  %144 = load i64, ptr %7, align 8, !tbaa !10
  %145 = srem i64 %144, 1000000007
  store i64 %145, ptr %7, align 8, !tbaa !10
  %146 = load i32, ptr %8, align 4, !tbaa !5
  %147 = sub nsw i32 %146, 1
  %148 = sext i32 %147 to i64
  %149 = getelementptr inbounds [100010 x i64], ptr @cnt_A, i64 0, i64 %148
  %150 = load i64, ptr %149, align 8, !tbaa !10
  %151 = load i64, ptr @sum_q, align 8, !tbaa !10
  %152 = load i32, ptr %8, align 4, !tbaa !5
  %153 = sext i32 %152 to i64
  %154 = getelementptr inbounds [100010 x i64], ptr @cnt_q, i64 0, i64 %153
  %155 = load i64, ptr %154, align 8, !tbaa !10
  %156 = sub nsw i64 %151, %155
  %157 = mul nsw i64 %150, %156
  %158 = load i64, ptr @sum_q, align 8, !tbaa !10
  %159 = sub nsw i64 %158, 1
  %160 = call noundef i64 @_Z5powerxx(i64 noundef 3, i64 noundef %159)
  %161 = mul nsw i64 %157, %160
  %162 = srem i64 %161, 1000000007
  %163 = load i64, ptr %7, align 8, !tbaa !10
  %164 = add nsw i64 %163, %162
  store i64 %164, ptr %7, align 8, !tbaa !10
  %165 = load i64, ptr %7, align 8, !tbaa !10
  %166 = srem i64 %165, 1000000007
  store i64 %166, ptr %7, align 8, !tbaa !10
  %167 = load i32, ptr %8, align 4, !tbaa !5
  %168 = sub nsw i32 %167, 1
  %169 = sext i32 %168 to i64
  %170 = getelementptr inbounds [100010 x i64], ptr @cnt_q, i64 0, i64 %169
  %171 = load i64, ptr %170, align 8, !tbaa !10
  %172 = load i64, ptr @sum_C, align 8, !tbaa !10
  %173 = load i32, ptr %8, align 4, !tbaa !5
  %174 = sext i32 %173 to i64
  %175 = getelementptr inbounds [100010 x i64], ptr @cnt_C, i64 0, i64 %174
  %176 = load i64, ptr %175, align 8, !tbaa !10
  %177 = sub nsw i64 %172, %176
  %178 = mul nsw i64 %171, %177
  %179 = load i64, ptr @sum_q, align 8, !tbaa !10
  %180 = sub nsw i64 %179, 1
  %181 = call noundef i64 @_Z5powerxx(i64 noundef 3, i64 noundef %180)
  %182 = mul nsw i64 %178, %181
  %183 = srem i64 %182, 1000000007
  %184 = load i64, ptr %7, align 8, !tbaa !10
  %185 = add nsw i64 %184, %183
  store i64 %185, ptr %7, align 8, !tbaa !10
  %186 = load i64, ptr %7, align 8, !tbaa !10
  %187 = srem i64 %186, 1000000007
  store i64 %187, ptr %7, align 8, !tbaa !10
  %188 = load i32, ptr %8, align 4, !tbaa !5
  %189 = sub nsw i32 %188, 1
  %190 = sext i32 %189 to i64
  %191 = getelementptr inbounds [100010 x i64], ptr @cnt_q, i64 0, i64 %190
  %192 = load i64, ptr %191, align 8, !tbaa !10
  %193 = load i64, ptr @sum_q, align 8, !tbaa !10
  %194 = load i32, ptr %8, align 4, !tbaa !5
  %195 = sext i32 %194 to i64
  %196 = getelementptr inbounds [100010 x i64], ptr @cnt_q, i64 0, i64 %195
  %197 = load i64, ptr %196, align 8, !tbaa !10
  %198 = sub nsw i64 %193, %197
  %199 = mul nsw i64 %192, %198
  %200 = load i64, ptr @sum_q, align 8, !tbaa !10
  %201 = sub nsw i64 %200, 2
  %202 = call noundef i64 @_Z5powerxx(i64 noundef 3, i64 noundef %201)
  %203 = mul nsw i64 %199, %202
  %204 = srem i64 %203, 1000000007
  %205 = load i64, ptr %7, align 8, !tbaa !10
  %206 = add nsw i64 %205, %204
  store i64 %206, ptr %7, align 8, !tbaa !10
  %207 = load i64, ptr %7, align 8, !tbaa !10
  %208 = srem i64 %207, 1000000007
  store i64 %208, ptr %7, align 8, !tbaa !10
  br label %302

209:                                              ; preds = %118
  %210 = load i32, ptr %8, align 4, !tbaa !5
  %211 = sext i32 %210 to i64
  %212 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) @_Z1SB5cxx11, i64 noundef %211)
  %213 = load i8, ptr %212, align 1, !tbaa !9
  %214 = sext i8 %213 to i32
  %215 = icmp eq i32 %214, 63
  br i1 %215, label %216, label %301

216:                                              ; preds = %209
  %217 = load i32, ptr %8, align 4, !tbaa !5
  %218 = sub nsw i32 %217, 1
  %219 = sext i32 %218 to i64
  %220 = getelementptr inbounds [100010 x i64], ptr @cnt_A, i64 0, i64 %219
  %221 = load i64, ptr %220, align 8, !tbaa !10
  %222 = load i64, ptr @sum_C, align 8, !tbaa !10
  %223 = load i32, ptr %8, align 4, !tbaa !5
  %224 = sext i32 %223 to i64
  %225 = getelementptr inbounds [100010 x i64], ptr @cnt_C, i64 0, i64 %224
  %226 = load i64, ptr %225, align 8, !tbaa !10
  %227 = sub nsw i64 %222, %226
  %228 = mul nsw i64 %221, %227
  %229 = load i64, ptr @sum_q, align 8, !tbaa !10
  %230 = sub nsw i64 %229, 1
  %231 = call noundef i64 @_Z5powerxx(i64 noundef 3, i64 noundef %230)
  %232 = mul nsw i64 %228, %231
  %233 = srem i64 %232, 1000000007
  %234 = load i64, ptr %7, align 8, !tbaa !10
  %235 = add nsw i64 %234, %233
  store i64 %235, ptr %7, align 8, !tbaa !10
  %236 = load i64, ptr %7, align 8, !tbaa !10
  %237 = srem i64 %236, 1000000007
  store i64 %237, ptr %7, align 8, !tbaa !10
  %238 = load i32, ptr %8, align 4, !tbaa !5
  %239 = sub nsw i32 %238, 1
  %240 = sext i32 %239 to i64
  %241 = getelementptr inbounds [100010 x i64], ptr @cnt_A, i64 0, i64 %240
  %242 = load i64, ptr %241, align 8, !tbaa !10
  %243 = load i64, ptr @sum_q, align 8, !tbaa !10
  %244 = load i32, ptr %8, align 4, !tbaa !5
  %245 = sext i32 %244 to i64
  %246 = getelementptr inbounds [100010 x i64], ptr @cnt_q, i64 0, i64 %245
  %247 = load i64, ptr %246, align 8, !tbaa !10
  %248 = sub nsw i64 %243, %247
  %249 = mul nsw i64 %242, %248
  %250 = load i64, ptr @sum_q, align 8, !tbaa !10
  %251 = sub nsw i64 %250, 2
  %252 = call noundef i64 @_Z5powerxx(i64 noundef 3, i64 noundef %251)
  %253 = mul nsw i64 %249, %252
  %254 = srem i64 %253, 1000000007
  %255 = load i64, ptr %7, align 8, !tbaa !10
  %256 = add nsw i64 %255, %254
  store i64 %256, ptr %7, align 8, !tbaa !10
  %257 = load i64, ptr %7, align 8, !tbaa !10
  %258 = srem i64 %257, 1000000007
  store i64 %258, ptr %7, align 8, !tbaa !10
  %259 = load i32, ptr %8, align 4, !tbaa !5
  %260 = sub nsw i32 %259, 1
  %261 = sext i32 %260 to i64
  %262 = getelementptr inbounds [100010 x i64], ptr @cnt_q, i64 0, i64 %261
  %263 = load i64, ptr %262, align 8, !tbaa !10
  %264 = load i64, ptr @sum_C, align 8, !tbaa !10
  %265 = load i32, ptr %8, align 4, !tbaa !5
  %266 = sext i32 %265 to i64
  %267 = getelementptr inbounds [100010 x i64], ptr @cnt_C, i64 0, i64 %266
  %268 = load i64, ptr %267, align 8, !tbaa !10
  %269 = sub nsw i64 %264, %268
  %270 = mul nsw i64 %263, %269
  %271 = load i64, ptr @sum_q, align 8, !tbaa !10
  %272 = sub nsw i64 %271, 2
  %273 = call noundef i64 @_Z5powerxx(i64 noundef 3, i64 noundef %272)
  %274 = mul nsw i64 %270, %273
  %275 = srem i64 %274, 1000000007
  %276 = load i64, ptr %7, align 8, !tbaa !10
  %277 = add nsw i64 %276, %275
  store i64 %277, ptr %7, align 8, !tbaa !10
  %278 = load i64, ptr %7, align 8, !tbaa !10
  %279 = srem i64 %278, 1000000007
  store i64 %279, ptr %7, align 8, !tbaa !10
  %280 = load i32, ptr %8, align 4, !tbaa !5
  %281 = sub nsw i32 %280, 1
  %282 = sext i32 %281 to i64
  %283 = getelementptr inbounds [100010 x i64], ptr @cnt_q, i64 0, i64 %282
  %284 = load i64, ptr %283, align 8, !tbaa !10
  %285 = load i64, ptr @sum_q, align 8, !tbaa !10
  %286 = load i32, ptr %8, align 4, !tbaa !5
  %287 = sext i32 %286 to i64
  %288 = getelementptr inbounds [100010 x i64], ptr @cnt_q, i64 0, i64 %287
  %289 = load i64, ptr %288, align 8, !tbaa !10
  %290 = sub nsw i64 %285, %289
  %291 = mul nsw i64 %284, %290
  %292 = load i64, ptr @sum_q, align 8, !tbaa !10
  %293 = sub nsw i64 %292, 3
  %294 = call noundef i64 @_Z5powerxx(i64 noundef 3, i64 noundef %293)
  %295 = mul nsw i64 %291, %294
  %296 = srem i64 %295, 1000000007
  %297 = load i64, ptr %7, align 8, !tbaa !10
  %298 = add nsw i64 %297, %296
  store i64 %298, ptr %7, align 8, !tbaa !10
  %299 = load i64, ptr %7, align 8, !tbaa !10
  %300 = srem i64 %299, 1000000007
  store i64 %300, ptr %7, align 8, !tbaa !10
  br label %301

301:                                              ; preds = %216, %209
  br label %302

302:                                              ; preds = %301, %125
  br label %303

303:                                              ; preds = %302
  %304 = load i32, ptr %8, align 4, !tbaa !5
  %305 = add nsw i32 %304, 1
  store i32 %305, ptr %8, align 4, !tbaa !5
  br label %112, !llvm.loop !15

306:                                              ; preds = %117
  %307 = load i64, ptr %7, align 8, !tbaa !10
  %308 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i64 noundef %307)
  %309 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %308, ptr noundef @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #6
  %310 = load i32, ptr %1, align 4
  ret i32 %310
}

declare noundef nonnull align 8 dereferenceable(16) ptr @_ZStrsIcSt11char_traitsIcESaIcEERSt13basic_istreamIT_T0_ES7_RNSt7__cxx1112basic_stringIS4_S5_T1_EE(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 8 dereferenceable(32)) #4

; Function Attrs: mustprogress nounwind uwtable
declare noundef i64 @_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(32)) #0 align 2

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

; Function Attrs: mustprogress nounwind uwtable
declare noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32), i64 noundef) #0 align 2

; Function Attrs: mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8), i64 noundef) #2 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) #2 align 2

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

attributes #0 = { mustprogress 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 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 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 #4 = { "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 = !{!7, !7, i64 0}
!10 = !{!11, !11, i64 0}
!11 = !{!"long long", !7, i64 0}
!12 = distinct !{!12, !13}
!13 = !{!"llvm.loop.mustprogress"}
!14 = distinct !{!14, !13}
!15 = distinct !{!15, !13}


; Optimized IR (opt -passes='default<O3>'):
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

%"class.std::__cxx11::basic_string" = type { %"struct.std::__cxx11::basic_string<char>::_Alloc_hider", i64, %union.anon }
%"struct.std::__cxx11::basic_string<char>::_Alloc_hider" = type { ptr }
%union.anon = type { i64, [8 x i8] }
%"class.std::basic_istream" = type { ptr, i64, %"class.std::basic_ios" }
%"class.std::basic_ios" = type { %"class.std::ios_base", ptr, i8, i8, ptr, ptr, ptr, ptr }
%"class.std::ios_base" = type { ptr, i64, i64, i32, i32, i32, ptr, %"struct.std::ios_base::_Words", [8 x %"struct.std::ios_base::_Words"], i32, ptr, %"class.std::locale" }
%"struct.std::ios_base::_Words" = type { ptr, i64 }
%"class.std::locale" = type { ptr }
%"class.std::basic_ostream" = type { ptr, %"class.std::basic_ios" }

@_Z1SB5cxx11 = external dso_local global %"class.std::__cxx11::basic_string", align 8
@N = external dso_local local_unnamed_addr global i32, align 4
@cnt_A = external dso_local global [100010 x i64], align 16
@cnt_q = external dso_local global [100010 x i64], align 16
@cnt_C = external dso_local global [100010 x i64], align 16
@sum_A = external dso_local local_unnamed_addr global i64, align 8
@sum_q = external dso_local local_unnamed_addr global i64, align 8
@sum_C = external dso_local local_unnamed_addr global i64, align 8
@_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 uwtable
declare dso_local noundef i64 @_Z5powerxx(i64 noundef, i64 noundef) local_unnamed_addr #2

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #3 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = alloca i32, align 4
  tail call void @_Z4initv()
  %4 = tail call noundef nonnull align 8 dereferenceable(16) ptr @_ZStrsIcSt11char_traitsIcESaIcEERSt13basic_istreamIT_T0_ES7_RNSt7__cxx1112basic_stringIS4_S5_T1_EE(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(32) @_Z1SB5cxx11)
  %5 = tail call noundef i64 @_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(32) @_Z1SB5cxx11) #6
  %6 = trunc i64 %5 to i32
  store i32 %6, ptr @N, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %1) #6
  store i32 0, ptr %1, align 4, !tbaa !5
  call void @_ZSt4fillIPxiEvT_S1_RKT0_(ptr noundef nonnull @cnt_A, ptr noundef nonnull getelementptr inbounds (i8, ptr @cnt_A, i64 800080), ptr noundef nonnull align 4 dereferenceable(4) %1)
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %2) #6
  store i32 0, ptr %2, align 4, !tbaa !5
  call void @_ZSt4fillIPxiEvT_S1_RKT0_(ptr noundef nonnull @cnt_q, ptr noundef nonnull getelementptr inbounds (i8, ptr @cnt_q, i64 800080), ptr noundef nonnull align 4 dereferenceable(4) %2)
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %2) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %3) #6
  store i32 0, ptr %3, align 4, !tbaa !5
  call void @_ZSt4fillIPxiEvT_S1_RKT0_(ptr noundef nonnull @cnt_C, ptr noundef nonnull getelementptr inbounds (i8, ptr @cnt_C, i64 800080), ptr noundef nonnull align 4 dereferenceable(4) %3)
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %3) #6
  %7 = load i32, ptr @N, align 4, !tbaa !5
  %8 = icmp sgt i32 %7, 0
  br i1 %8, label %.lr.ph, label %._crit_edge

.preheader:                                       ; preds = %24
  %9 = icmp sgt i32 %25, 1
  br i1 %9, label %.lr.ph70.preheader, label %._crit_edge

.lr.ph70.preheader:                               ; preds = %.preheader
  %wide.trip.count = zext nneg i32 %25 to i64
  %.pre = load i64, ptr @cnt_A, align 16, !tbaa !9
  %.pre85 = load i64, ptr @cnt_q, align 16, !tbaa !9
  %.pre86 = load i64, ptr @cnt_C, align 16, !tbaa !9
  %10 = add nsw i64 %wide.trip.count, -1
  %xtraiter = and i64 %10, 1
  %11 = icmp eq i32 %25, 2
  br i1 %11, label %._crit_edge.loopexit.unr-lcssa, label %.lr.ph70.preheader.new

.lr.ph70.preheader.new:                           ; preds = %.lr.ph70.preheader
  %unroll_iter = and i64 %10, -2
  br label %.lr.ph70

.lr.ph:                                           ; preds = %0, %24
  %indvars.iv = phi i64 [ %indvars.iv.next, %24 ], [ 0, %0 ]
  %12 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) @_Z1SB5cxx11, i64 noundef %indvars.iv)
  %13 = load i8, ptr %12, align 1, !tbaa !11
  %14 = icmp eq i8 %13, 65
  br i1 %14, label %.sink.split, label %15

15:                                               ; preds = %.lr.ph
  %16 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) @_Z1SB5cxx11, i64 noundef %indvars.iv)
  %17 = load i8, ptr %16, align 1, !tbaa !11
  %18 = icmp eq i8 %17, 63
  br i1 %18, label %.sink.split, label %19

19:                                               ; preds = %15
  %20 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) @_Z1SB5cxx11, i64 noundef %indvars.iv)
  %21 = load i8, ptr %20, align 1, !tbaa !11
  %22 = icmp eq i8 %21, 67
  br i1 %22, label %.sink.split, label %24

.sink.split:                                      ; preds = %19, %15, %.lr.ph
  %cnt_A.sink = phi ptr [ @cnt_A, %.lr.ph ], [ @cnt_q, %15 ], [ @cnt_C, %19 ]
  %23 = getelementptr inbounds [100010 x i64], ptr %cnt_A.sink, i64 0, i64 %indvars.iv
  store i64 1, ptr %23, align 8, !tbaa !9
  br label %24

24:                                               ; preds = %.sink.split, %19
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %25 = load i32, ptr @N, align 4, !tbaa !5
  %26 = sext i32 %25 to i64
  %27 = icmp slt i64 %indvars.iv.next, %26
  br i1 %27, label %.lr.ph, label %.preheader, !llvm.loop !12

._crit_edge.loopexit.unr-lcssa:                   ; preds = %.lr.ph70, %.lr.ph70.preheader
  %.unr = phi i64 [ %.pre86, %.lr.ph70.preheader ], [ %67, %.lr.ph70 ]
  %.unr132 = phi i64 [ %.pre85, %.lr.ph70.preheader ], [ %64, %.lr.ph70 ]
  %.unr133 = phi i64 [ %.pre, %.lr.ph70.preheader ], [ %61, %.lr.ph70 ]
  %indvars.iv79.unr = phi i64 [ 1, %.lr.ph70.preheader ], [ %indvars.iv.next80.1, %.lr.ph70 ]
  %lcmp.mod.not = icmp eq i64 %xtraiter, 0
  br i1 %lcmp.mod.not, label %._crit_edge, label %.lr.ph70.epil

.lr.ph70.epil:                                    ; preds = %._crit_edge.loopexit.unr-lcssa
  %28 = getelementptr inbounds [100010 x i64], ptr @cnt_A, i64 0, i64 %indvars.iv79.unr
  %29 = load i64, ptr %28, align 8, !tbaa !9
  %30 = add nsw i64 %29, %.unr133
  store i64 %30, ptr %28, align 8, !tbaa !9
  %31 = getelementptr inbounds [100010 x i64], ptr @cnt_q, i64 0, i64 %indvars.iv79.unr
  %32 = load i64, ptr %31, align 8, !tbaa !9
  %33 = add nsw i64 %32, %.unr132
  store i64 %33, ptr %31, align 8, !tbaa !9
  %34 = getelementptr inbounds [100010 x i64], ptr @cnt_C, i64 0, i64 %indvars.iv79.unr
  %35 = load i64, ptr %34, align 8, !tbaa !9
  %36 = add nsw i64 %35, %.unr
  store i64 %36, ptr %34, align 8, !tbaa !9
  br label %._crit_edge

._crit_edge:                                      ; preds = %.lr.ph70.epil, %._crit_edge.loopexit.unr-lcssa, %0, %.preheader
  %37 = phi i32 [ %25, %.preheader ], [ %7, %0 ], [ %25, %._crit_edge.loopexit.unr-lcssa ], [ %25, %.lr.ph70.epil ]
  %38 = add nsw i32 %37, -1
  %39 = sext i32 %38 to i64
  %40 = getelementptr inbounds [100010 x i64], ptr @cnt_A, i64 0, i64 %39
  %41 = load i64, ptr %40, align 8, !tbaa !9
  store i64 %41, ptr @sum_A, align 8, !tbaa !9
  %42 = getelementptr inbounds [100010 x i64], ptr @cnt_q, i64 0, i64 %39
  %43 = load i64, ptr %42, align 8, !tbaa !9
  store i64 %43, ptr @sum_q, align 8, !tbaa !9
  %44 = getelementptr inbounds [100010 x i64], ptr @cnt_C, i64 0, i64 %39
  %45 = load i64, ptr %44, align 8, !tbaa !9
  store i64 %45, ptr @sum_C, align 8, !tbaa !9
  %46 = icmp sgt i32 %37, 2
  br i1 %46, label %.lr.ph74, label %._crit_edge75

.lr.ph70:                                         ; preds = %.lr.ph70, %.lr.ph70.preheader.new
  %47 = phi i64 [ %.pre86, %.lr.ph70.preheader.new ], [ %67, %.lr.ph70 ]
  %48 = phi i64 [ %.pre85, %.lr.ph70.preheader.new ], [ %64, %.lr.ph70 ]
  %49 = phi i64 [ %.pre, %.lr.ph70.preheader.new ], [ %61, %.lr.ph70 ]
  %indvars.iv79 = phi i64 [ 1, %.lr.ph70.preheader.new ], [ %indvars.iv.next80.1, %.lr.ph70 ]
  %niter = phi i64 [ 0, %.lr.ph70.preheader.new ], [ %niter.next.1, %.lr.ph70 ]
  %50 = getelementptr inbounds [100010 x i64], ptr @cnt_A, i64 0, i64 %indvars.iv79
  %51 = load i64, ptr %50, align 8, !tbaa !9
  %52 = add nsw i64 %51, %49
  store i64 %52, ptr %50, align 8, !tbaa !9
  %53 = getelementptr inbounds [100010 x i64], ptr @cnt_q, i64 0, i64 %indvars.iv79
  %54 = load i64, ptr %53, align 8, !tbaa !9
  %55 = add nsw i64 %54, %48
  store i64 %55, ptr %53, align 8, !tbaa !9
  %56 = getelementptr inbounds [100010 x i64], ptr @cnt_C, i64 0, i64 %indvars.iv79
  %57 = load i64, ptr %56, align 8, !tbaa !9
  %58 = add nsw i64 %57, %47
  store i64 %58, ptr %56, align 8, !tbaa !9
  %indvars.iv.next80 = add nuw nsw i64 %indvars.iv79, 1
  %59 = getelementptr inbounds [100010 x i64], ptr @cnt_A, i64 0, i64 %indvars.iv.next80
  %60 = load i64, ptr %59, align 8, !tbaa !9
  %61 = add nsw i64 %60, %52
  store i64 %61, ptr %59, align 8, !tbaa !9
  %62 = getelementptr inbounds [100010 x i64], ptr @cnt_q, i64 0, i64 %indvars.iv.next80
  %63 = load i64, ptr %62, align 8, !tbaa !9
  %64 = add nsw i64 %63, %55
  store i64 %64, ptr %62, align 8, !tbaa !9
  %65 = getelementptr inbounds [100010 x i64], ptr @cnt_C, i64 0, i64 %indvars.iv.next80
  %66 = load i64, ptr %65, align 8, !tbaa !9
  %67 = add nsw i64 %66, %58
  store i64 %67, ptr %65, align 8, !tbaa !9
  %indvars.iv.next80.1 = add nuw nsw i64 %indvars.iv79, 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 %.lr.ph70, !llvm.loop !14

._crit_edge75:                                    ; preds = %139, %._crit_edge
  %.054.lcssa = phi i64 [ 0, %._crit_edge ], [ %.1, %139 ]
  %68 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i64 noundef %.054.lcssa)
  %69 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %68, ptr noundef nonnull @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
  ret i32 0

.lr.ph74:                                         ; preds = %._crit_edge, %139
  %indvars.iv82 = phi i64 [ %indvars.iv.next83, %139 ], [ 1, %._crit_edge ]
  %.05471 = phi i64 [ %.1, %139 ], [ 0, %._crit_edge ]
  %70 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) @_Z1SB5cxx11, i64 noundef %indvars.iv82)
  %71 = load i8, ptr %70, align 1, !tbaa !11
  %72 = icmp eq i8 %71, 66
  br i1 %72, label %73, label %83

73:                                               ; preds = %.lr.ph74
  %74 = add nsw i64 %indvars.iv82, -1
  %75 = getelementptr inbounds [100010 x i64], ptr @cnt_A, i64 0, i64 %74
  %76 = load i64, ptr %75, align 8, !tbaa !9
  %77 = load i64, ptr @sum_C, align 8, !tbaa !9
  %78 = getelementptr inbounds [100010 x i64], ptr @cnt_C, i64 0, i64 %indvars.iv82
  %79 = load i64, ptr %78, align 8, !tbaa !9
  %80 = sub nsw i64 %77, %79
  %81 = mul nsw i64 %80, %76
  %82 = load i64, ptr @sum_q, align 8, !tbaa !9
  br label %.sink.split87

83:                                               ; preds = %.lr.ph74
  %84 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) @_Z1SB5cxx11, i64 noundef %indvars.iv82)
  %85 = load i8, ptr %84, align 1, !tbaa !11
  %86 = icmp eq i8 %85, 63
  br i1 %86, label %87, label %139

87:                                               ; preds = %83
  %88 = add nsw i64 %indvars.iv82, -1
  %89 = getelementptr inbounds [100010 x i64], ptr @cnt_A, i64 0, i64 %88
  %90 = load i64, ptr %89, align 8, !tbaa !9
  %91 = load i64, ptr @sum_C, align 8, !tbaa !9
  %92 = getelementptr inbounds [100010 x i64], ptr @cnt_C, i64 0, i64 %indvars.iv82
  %93 = load i64, ptr %92, align 8, !tbaa !9
  %94 = sub nsw i64 %91, %93
  %95 = mul nsw i64 %94, %90
  %96 = load i64, ptr @sum_q, align 8, !tbaa !9
  %97 = add nsw i64 %96, -1
  br label %.sink.split87

.sink.split87:                                    ; preds = %87, %73
  %.sink131 = phi i64 [ %82, %73 ], [ %97, %87 ]
  %.sink129 = phi i64 [ %81, %73 ], [ %95, %87 ]
  %.sink = phi ptr [ %75, %73 ], [ %89, %87 ]
  %.sink122 = phi i64 [ -1, %73 ], [ -2, %87 ]
  %.sink116 = phi i64 [ %74, %73 ], [ %88, %87 ]
  %.sink114 = phi ptr [ %78, %73 ], [ %92, %87 ]
  %.sink95 = phi i64 [ -2, %73 ], [ -3, %87 ]
  %98 = call noundef i64 @_Z5powerxx(i64 noundef 3, i64 noundef %.sink131)
  %99 = mul nsw i64 %.sink129, %98
  %100 = srem i64 %99, 1000000007
  %101 = add nsw i64 %100, %.05471
  %102 = srem i64 %101, 1000000007
  %103 = load i64, ptr %.sink, align 8, !tbaa !9
  %104 = load i64, ptr @sum_q, align 8, !tbaa !9
  %105 = getelementptr inbounds [100010 x i64], ptr @cnt_q, i64 0, i64 %indvars.iv82
  %106 = load i64, ptr %105, align 8, !tbaa !9
  %107 = sub nsw i64 %104, %106
  %108 = mul nsw i64 %107, %103
  %109 = add nsw i64 %104, %.sink122
  %110 = call noundef i64 @_Z5powerxx(i64 noundef 3, i64 noundef %109)
  %111 = mul nsw i64 %108, %110
  %112 = srem i64 %111, 1000000007
  %113 = add nsw i64 %112, %102
  %.lhs.trunc = trunc nsw i64 %113 to i32
  %114 = srem i32 %.lhs.trunc, 1000000007
  %115 = getelementptr inbounds [100010 x i64], ptr @cnt_q, i64 0, i64 %.sink116
  %116 = load i64, ptr %115, align 8, !tbaa !9
  %117 = load i64, ptr @sum_C, align 8, !tbaa !9
  %118 = load i64, ptr %.sink114, align 8, !tbaa !9
  %119 = sub nsw i64 %117, %118
  %120 = mul nsw i64 %119, %116
  %121 = load i64, ptr @sum_q, align 8, !tbaa !9
  %122 = add nsw i64 %121, %.sink122
  %123 = call noundef i64 @_Z5powerxx(i64 noundef 3, i64 noundef %122)
  %124 = mul nsw i64 %120, %123
  %125 = srem i64 %124, 1000000007
  %126 = trunc nsw i64 %125 to i32
  %.lhs.trunc58 = add nsw i32 %114, %126
  %127 = srem i32 %.lhs.trunc58, 1000000007
  %128 = load i64, ptr %115, align 8, !tbaa !9
  %129 = load i64, ptr @sum_q, align 8, !tbaa !9
  %130 = load i64, ptr %105, align 8, !tbaa !9
  %131 = sub nsw i64 %129, %130
  %132 = mul nsw i64 %131, %128
  %133 = add nsw i64 %129, %.sink95
  %134 = call noundef i64 @_Z5powerxx(i64 noundef 3, i64 noundef %133)
  %135 = mul nsw i64 %132, %134
  %136 = srem i64 %135, 1000000007
  %137 = trunc nsw i64 %136 to i32
  %.lhs.trunc60 = add nsw i32 %127, %137
  %138 = srem i32 %.lhs.trunc60, 1000000007
  %.sext61 = sext i32 %138 to i64
  br label %139

139:                                              ; preds = %.sink.split87, %83
  %.1 = phi i64 [ %.05471, %83 ], [ %.sext61, %.sink.split87 ]
  %indvars.iv.next83 = add nuw nsw i64 %indvars.iv82, 1
  %140 = load i32, ptr @N, align 4, !tbaa !5
  %141 = add nsw i32 %140, -1
  %142 = sext i32 %141 to i64
  %143 = icmp slt i64 %indvars.iv.next83, %142
  br i1 %143, label %.lr.ph74, label %._crit_edge75, !llvm.loop !15
}

declare noundef nonnull align 8 dereferenceable(16) ptr @_ZStrsIcSt11char_traitsIcESaIcEERSt13basic_istreamIT_T0_ES7_RNSt7__cxx1112basic_stringIS4_S5_T1_EE(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 8 dereferenceable(32)) local_unnamed_addr #4

; Function Attrs: mustprogress nounwind uwtable
declare noundef i64 @_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(32)) local_unnamed_addr #0 align 2

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

; Function Attrs: mustprogress nounwind uwtable
declare noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32), i64 noundef) local_unnamed_addr #0 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 #2 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 #2 align 2

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

attributes #0 = { mustprogress 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 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 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 #4 = { "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 = !{!7, !7, i64 0}
!12 = distinct !{!12, !13}
!13 = !{!"llvm.loop.mustprogress"}
!14 = distinct !{!14, !13}
!15 = distinct !{!15, !13}


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