; LLVM IR from kazunetakahashi/atcoder :: 2017/0122_AGC009 (C)

; 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
@A = external dso_local global i64, align 8
@B = external dso_local global i64, align 8
@S = external dso_local global [100010 x i64], align 16
@X = external dso_local global [100010 x i64], align 16
@Y = external dso_local global [100010 x i64], align 16
@SX = external dso_local global [100010 x i64], align 16
@SY = external dso_local global [100010 x i64], align 16
@kA = external dso_local global [100010 x i32], align 16
@kB = external dso_local global [100010 x i32], align 16
@ans = external dso_local global i64, align 8
@_ZSt3cin = external global %"class.std::basic_istream", align 8
@_ZSt4cerr = external global %"class.std::basic_ostream", align 8
@.str = external hidden unnamed_addr constant [4 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [4 x i8], align 1
@_ZSt4cout = external global %"class.std::basic_ostream", align 8
@.str.3 = external hidden unnamed_addr constant [8 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [8 x i8], align 1

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

; Function Attrs: mustprogress uwtable
declare dso_local noundef i64 @_Z7calc_SYi(i32 noundef) #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 @_Z6calc_Yi(i32 noundef) #0

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

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() #2 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = alloca i8, align 1
  %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 = alloca i32, align 4
  %15 = alloca i32, align 4
  %16 = alloca i32, align 4
  store i32 0, ptr %1, align 4
  %17 = 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)
  %18 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) %17, ptr noundef nonnull align 8 dereferenceable(8) @A)
  %19 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) %18, ptr noundef nonnull align 8 dereferenceable(8) @B)
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #5
  store i32 0, ptr %2, align 4, !tbaa !5
  br label %20

20:                                               ; preds = %30, %0
  %21 = load i32, ptr %2, align 4, !tbaa !5
  %22 = load i32, ptr @N, align 4, !tbaa !5
  %23 = icmp slt i32 %21, %22
  br i1 %23, label %25, label %24

24:                                               ; preds = %20
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #5
  br label %33

25:                                               ; preds = %20
  %26 = load i32, ptr %2, align 4, !tbaa !5
  %27 = sext i32 %26 to i64
  %28 = getelementptr inbounds [100010 x i64], ptr @S, i64 0, i64 %27
  %29 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) %28)
  br label %30

30:                                               ; preds = %25
  %31 = load i32, ptr %2, align 4, !tbaa !5
  %32 = add nsw i32 %31, 1
  store i32 %32, ptr %2, align 4, !tbaa !5
  br label %20, !llvm.loop !9

33:                                               ; preds = %24
  call void @llvm.lifetime.start.p0(i64 1, ptr %3) #5
  store i8 1, ptr %3, align 1, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #5
  store i32 0, ptr %4, align 4, !tbaa !5
  br label %34

34:                                               ; preds = %55, %33
  %35 = load i32, ptr %4, align 4, !tbaa !5
  %36 = load i32, ptr @N, align 4, !tbaa !5
  %37 = sub nsw i32 %36, 1
  %38 = icmp slt i32 %35, %37
  br i1 %38, label %40, label %39

39:                                               ; preds = %34
  store i32 5, ptr %5, align 4
  br label %58

40:                                               ; preds = %34
  %41 = load i32, ptr %4, align 4, !tbaa !5
  %42 = add nsw i32 %41, 1
  %43 = sext i32 %42 to i64
  %44 = getelementptr inbounds [100010 x i64], ptr @S, i64 0, i64 %43
  %45 = load i64, ptr %44, align 8, !tbaa !13
  %46 = load i32, ptr %4, align 4, !tbaa !5
  %47 = sext i32 %46 to i64
  %48 = getelementptr inbounds [100010 x i64], ptr @S, i64 0, i64 %47
  %49 = load i64, ptr %48, align 8, !tbaa !13
  %50 = sub nsw i64 %45, %49
  %51 = load i64, ptr @A, align 8, !tbaa !13
  %52 = icmp slt i64 %50, %51
  br i1 %52, label %53, label %54

53:                                               ; preds = %40
  store i8 0, ptr %3, align 1, !tbaa !11
  store i32 5, ptr %5, align 4
  br label %58

54:                                               ; preds = %40
  br label %55

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

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

59:                                               ; preds = %58
  %60 = load i8, ptr %3, align 1, !tbaa !11, !range !16, !noundef !17
  %61 = trunc i8 %60 to i1
  br i1 %61, label %62, label %65

62:                                               ; preds = %59
  %63 = load i64, ptr @ans, align 8, !tbaa !13
  %64 = add nsw i64 %63, 1
  store i64 %64, ptr @ans, align 8, !tbaa !13
  br label %65

65:                                               ; preds = %62, %59
  store i8 1, ptr %3, align 1, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #5
  store i32 0, ptr %6, align 4, !tbaa !5
  br label %66

66:                                               ; preds = %87, %65
  %67 = load i32, ptr %6, align 4, !tbaa !5
  %68 = load i32, ptr @N, align 4, !tbaa !5
  %69 = sub nsw i32 %68, 1
  %70 = icmp slt i32 %67, %69
  br i1 %70, label %72, label %71

71:                                               ; preds = %66
  store i32 8, ptr %5, align 4
  br label %90

72:                                               ; preds = %66
  %73 = load i32, ptr %6, align 4, !tbaa !5
  %74 = add nsw i32 %73, 1
  %75 = sext i32 %74 to i64
  %76 = getelementptr inbounds [100010 x i64], ptr @S, i64 0, i64 %75
  %77 = load i64, ptr %76, align 8, !tbaa !13
  %78 = load i32, ptr %6, align 4, !tbaa !5
  %79 = sext i32 %78 to i64
  %80 = getelementptr inbounds [100010 x i64], ptr @S, i64 0, i64 %79
  %81 = load i64, ptr %80, align 8, !tbaa !13
  %82 = sub nsw i64 %77, %81
  %83 = load i64, ptr @B, align 8, !tbaa !13
  %84 = icmp slt i64 %82, %83
  br i1 %84, label %85, label %86

85:                                               ; preds = %72
  store i8 0, ptr %3, align 1, !tbaa !11
  store i32 8, ptr %5, align 4
  br label %90

86:                                               ; preds = %72
  br label %87

87:                                               ; preds = %86
  %88 = load i32, ptr %6, align 4, !tbaa !5
  %89 = add nsw i32 %88, 1
  store i32 %89, ptr %6, align 4, !tbaa !5
  br label %66, !llvm.loop !18

90:                                               ; preds = %85, %71
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #5
  br label %91

91:                                               ; preds = %90
  %92 = load i8, ptr %3, align 1, !tbaa !11, !range !16, !noundef !17
  %93 = trunc i8 %92 to i1
  br i1 %93, label %94, label %97

94:                                               ; preds = %91
  %95 = load i64, ptr @ans, align 8, !tbaa !13
  %96 = add nsw i64 %95, 1
  store i64 %96, ptr @ans, align 8, !tbaa !13
  br label %97

97:                                               ; preds = %94, %91
  %98 = load i32, ptr @N, align 4, !tbaa !5
  %99 = sext i32 %98 to i64
  %100 = getelementptr inbounds i64, ptr @X, i64 %99
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #5
  store i32 -1, ptr %7, align 4, !tbaa !5
  call void @_ZSt4fillIPxiEvT_S1_RKT0_(ptr noundef @X, ptr noundef %100, ptr noundef nonnull align 4 dereferenceable(4) %7)
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #5
  %101 = load i32, ptr @N, align 4, !tbaa !5
  %102 = sext i32 %101 to i64
  %103 = getelementptr inbounds i64, ptr @Y, i64 %102
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #5
  store i32 -1, ptr %8, align 4, !tbaa !5
  call void @_ZSt4fillIPxiEvT_S1_RKT0_(ptr noundef @Y, ptr noundef %103, ptr noundef nonnull align 4 dereferenceable(4) %8)
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #5
  %104 = load i32, ptr @N, align 4, !tbaa !5
  %105 = sext i32 %104 to i64
  %106 = getelementptr inbounds i64, ptr @SX, i64 %105
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #5
  store i32 -1, ptr %9, align 4, !tbaa !5
  call void @_ZSt4fillIPxiEvT_S1_RKT0_(ptr noundef @SX, ptr noundef %106, ptr noundef nonnull align 4 dereferenceable(4) %9)
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #5
  %107 = load i32, ptr @N, align 4, !tbaa !5
  %108 = sext i32 %107 to i64
  %109 = getelementptr inbounds i64, ptr @SY, i64 %108
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #5
  store i32 -1, ptr %10, align 4, !tbaa !5
  call void @_ZSt4fillIPxiEvT_S1_RKT0_(ptr noundef @SY, ptr noundef %109, ptr noundef nonnull align 4 dereferenceable(4) %10)
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #5
  %110 = load i32, ptr @N, align 4, !tbaa !5
  %111 = sext i32 %110 to i64
  %112 = getelementptr inbounds i32, ptr @kA, i64 %111
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #5
  store i32 -1, ptr %11, align 4, !tbaa !5
  call void @_ZSt4fillIPiiEvT_S1_RKT0_(ptr noundef @kA, ptr noundef %112, ptr noundef nonnull align 4 dereferenceable(4) %11)
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #5
  %113 = load i32, ptr @N, align 4, !tbaa !5
  %114 = sext i32 %113 to i64
  %115 = getelementptr inbounds i32, ptr @kB, i64 %114
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #5
  store i32 -1, ptr %12, align 4, !tbaa !5
  call void @_ZSt4fillIPiiEvT_S1_RKT0_(ptr noundef @kB, ptr noundef %115, ptr noundef nonnull align 4 dereferenceable(4) %12)
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #5
  store i64 1, ptr @X, align 16, !tbaa !13
  store i64 1, ptr @Y, align 16, !tbaa !13
  %116 = load i64, ptr @X, align 16, !tbaa !13
  store i64 %116, ptr @SX, align 16, !tbaa !13
  %117 = load i64, ptr @Y, align 16, !tbaa !13
  store i64 %117, ptr @SY, align 16, !tbaa !13
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #5
  store i32 0, ptr %13, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #5
  store i32 0, ptr %14, align 4, !tbaa !5
  br label %118

118:                                              ; preds = %151, %97
  %119 = load i32, ptr %14, align 4, !tbaa !5
  %120 = load i32, ptr @N, align 4, !tbaa !5
  %121 = icmp slt i32 %119, %120
  br i1 %121, label %122, label %152

122:                                              ; preds = %118
  %123 = load i32, ptr %14, align 4, !tbaa !5
  %124 = sext i32 %123 to i64
  %125 = getelementptr inbounds [100010 x i64], ptr @S, i64 0, i64 %124
  %126 = load i64, ptr %125, align 8, !tbaa !13
  %127 = load i32, ptr %13, align 4, !tbaa !5
  %128 = sext i32 %127 to i64
  %129 = getelementptr inbounds [100010 x i64], ptr @S, i64 0, i64 %128
  %130 = load i64, ptr %129, align 8, !tbaa !13
  %131 = sub nsw i64 %126, %130
  %132 = load i64, ptr @A, align 8, !tbaa !13
  %133 = icmp sge i64 %131, %132
  br i1 %133, label %134, label %148

134:                                              ; preds = %122
  %135 = load i32, ptr %13, align 4, !tbaa !5
  %136 = load i32, ptr %14, align 4, !tbaa !5
  %137 = sext i32 %136 to i64
  %138 = getelementptr inbounds [100010 x i32], ptr @kA, i64 0, i64 %137
  store i32 %135, ptr %138, align 4, !tbaa !5
  %139 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cerr, ptr noundef @.str)
  %140 = load i32, ptr %14, align 4, !tbaa !5
  %141 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) %139, i32 noundef %140)
  %142 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) %141, ptr noundef @.str.1)
  %143 = load i32, ptr %13, align 4, !tbaa !5
  %144 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) %142, i32 noundef %143)
  %145 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %144, ptr noundef @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
  %146 = load i32, ptr %13, align 4, !tbaa !5
  %147 = add nsw i32 %146, 1
  store i32 %147, ptr %13, align 4, !tbaa !5
  br label %151

148:                                              ; preds = %122
  %149 = load i32, ptr %14, align 4, !tbaa !5
  %150 = add nsw i32 %149, 1
  store i32 %150, ptr %14, align 4, !tbaa !5
  br label %151

151:                                              ; preds = %148, %134
  br label %118, !llvm.loop !19

152:                                              ; preds = %118
  store i32 0, ptr %14, align 4, !tbaa !5
  store i32 0, ptr %13, align 4, !tbaa !5
  br label %153

153:                                              ; preds = %186, %152
  %154 = load i32, ptr %14, align 4, !tbaa !5
  %155 = load i32, ptr @N, align 4, !tbaa !5
  %156 = icmp slt i32 %154, %155
  br i1 %156, label %157, label %187

157:                                              ; preds = %153
  %158 = load i32, ptr %14, align 4, !tbaa !5
  %159 = sext i32 %158 to i64
  %160 = getelementptr inbounds [100010 x i64], ptr @S, i64 0, i64 %159
  %161 = load i64, ptr %160, align 8, !tbaa !13
  %162 = load i32, ptr %13, align 4, !tbaa !5
  %163 = sext i32 %162 to i64
  %164 = getelementptr inbounds [100010 x i64], ptr @S, i64 0, i64 %163
  %165 = load i64, ptr %164, align 8, !tbaa !13
  %166 = sub nsw i64 %161, %165
  %167 = load i64, ptr @B, align 8, !tbaa !13
  %168 = icmp sge i64 %166, %167
  br i1 %168, label %169, label %183

169:                                              ; preds = %157
  %170 = load i32, ptr %13, align 4, !tbaa !5
  %171 = load i32, ptr %14, align 4, !tbaa !5
  %172 = sext i32 %171 to i64
  %173 = getelementptr inbounds [100010 x i32], ptr @kB, i64 0, i64 %172
  store i32 %170, ptr %173, align 4, !tbaa !5
  %174 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cerr, ptr noundef @.str.2)
  %175 = load i32, ptr %14, align 4, !tbaa !5
  %176 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) %174, i32 noundef %175)
  %177 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) %176, ptr noundef @.str.1)
  %178 = load i32, ptr %13, align 4, !tbaa !5
  %179 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) %177, i32 noundef %178)
  %180 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %179, ptr noundef @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
  %181 = load i32, ptr %13, align 4, !tbaa !5
  %182 = add nsw i32 %181, 1
  store i32 %182, ptr %13, align 4, !tbaa !5
  br label %186

183:                                              ; preds = %157
  %184 = load i32, ptr %14, align 4, !tbaa !5
  %185 = add nsw i32 %184, 1
  store i32 %185, ptr %14, align 4, !tbaa !5
  br label %186

186:                                              ; preds = %183, %169
  br label %153, !llvm.loop !20

187:                                              ; preds = %153
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #5
  store i32 0, ptr %15, align 4, !tbaa !5
  br label %188

188:                                              ; preds = %203, %187
  %189 = load i32, ptr %15, align 4, !tbaa !5
  %190 = load i32, ptr @N, align 4, !tbaa !5
  %191 = sub nsw i32 %190, 1
  %192 = icmp slt i32 %189, %191
  br i1 %192, label %194, label %193

193:                                              ; preds = %188
  store i32 15, ptr %5, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #5
  br label %206

194:                                              ; preds = %188
  %195 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, ptr noundef @.str.3)
  %196 = load i32, ptr %15, align 4, !tbaa !5
  %197 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) %195, i32 noundef %196)
  %198 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) %197, ptr noundef @.str.4)
  %199 = load i32, ptr %15, align 4, !tbaa !5
  %200 = call noundef i64 @_Z6calc_Xi(i32 noundef %199)
  %201 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8) %198, i64 noundef %200)
  %202 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %201, ptr noundef @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
  br label %203

203:                                              ; preds = %194
  %204 = load i32, ptr %15, align 4, !tbaa !5
  %205 = add nsw i32 %204, 1
  store i32 %205, ptr %15, align 4, !tbaa !5
  br label %188, !llvm.loop !21

206:                                              ; preds = %193
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #5
  store i32 0, ptr %16, align 4, !tbaa !5
  br label %207

207:                                              ; preds = %222, %206
  %208 = load i32, ptr %16, align 4, !tbaa !5
  %209 = load i32, ptr @N, align 4, !tbaa !5
  %210 = sub nsw i32 %209, 1
  %211 = icmp slt i32 %208, %210
  br i1 %211, label %213, label %212

212:                                              ; preds = %207
  store i32 18, ptr %5, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #5
  br label %225

213:                                              ; preds = %207
  %214 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, ptr noundef @.str.5)
  %215 = load i32, ptr %16, align 4, !tbaa !5
  %216 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) %214, i32 noundef %215)
  %217 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) %216, ptr noundef @.str.4)
  %218 = load i32, ptr %16, align 4, !tbaa !5
  %219 = call noundef i64 @_Z6calc_Yi(i32 noundef %218)
  %220 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8) %217, i64 noundef %219)
  %221 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %220, ptr noundef @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
  br label %222

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

225:                                              ; preds = %212
  %226 = load i32, ptr @N, align 4, !tbaa !5
  %227 = sub nsw i32 %226, 2
  %228 = call noundef i64 @_Z7calc_SXi(i32 noundef %227)
  %229 = load i32, ptr @N, align 4, !tbaa !5
  %230 = sub nsw i32 %229, 2
  %231 = call noundef i64 @_Z7calc_SYi(i32 noundef %230)
  %232 = add nsw i64 %228, %231
  %233 = load i64, ptr @ans, align 8, !tbaa !13
  %234 = add nsw i64 %233, %232
  store i64 %234, ptr @ans, align 8, !tbaa !13
  %235 = load i64, ptr @ans, align 8, !tbaa !13
  %236 = srem i64 %235, 1000000007
  store i64 %236, ptr @ans, align 8, !tbaa !13
  %237 = load i64, ptr @ans, align 8, !tbaa !13
  %238 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i64 noundef %237)
  %239 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %238, ptr noundef @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #5
  call void @llvm.lifetime.end.p0(i64 1, ptr %3) #5
  %240 = load i32, ptr %1, align 4
  ret i32 %240
}

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

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

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

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

; 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

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

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 = { 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 = { 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 = !{!12, !12, i64 0}
!12 = !{!"bool", !7, i64 0}
!13 = !{!14, !14, i64 0}
!14 = !{!"long long", !7, i64 0}
!15 = distinct !{!15, !10}
!16 = !{i8 0, i8 2}
!17 = !{}
!18 = distinct !{!18, !10}
!19 = distinct !{!19, !10}
!20 = distinct !{!20, !10}
!21 = distinct !{!21, !10}
!22 = distinct !{!22, !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
@A = external dso_local global i64, align 8
@B = external dso_local global i64, align 8
@S = external dso_local global [100010 x i64], align 16
@X = external dso_local global [100010 x i64], align 16
@Y = external dso_local global [100010 x i64], align 16
@SX = external dso_local global [100010 x i64], align 16
@SY = external dso_local global [100010 x i64], align 16
@kA = external dso_local global [100010 x i32], align 16
@kB = external dso_local global [100010 x i32], align 16
@ans = external dso_local local_unnamed_addr global i64, align 8
@_ZSt3cin = external global %"class.std::basic_istream", align 8
@_ZSt4cerr = external global %"class.std::basic_ostream", align 8
@.str = external hidden unnamed_addr constant [4 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [4 x i8], align 1
@_ZSt4cout = external global %"class.std::basic_ostream", align 8
@.str.3 = external hidden unnamed_addr constant [8 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [8 x i8], align 1

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

; Function Attrs: mustprogress uwtable
declare dso_local noundef i64 @_Z7calc_SYi(i32 noundef) 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 @_Z6calc_Yi(i32 noundef) local_unnamed_addr #0

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

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #2 {
  %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 = 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)
  %8 = tail call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) %7, ptr noundef nonnull align 8 dereferenceable(8) @A)
  %9 = tail call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) %8, ptr noundef nonnull align 8 dereferenceable(8) @B)
  %10 = load i32, ptr @N, align 4, !tbaa !5
  %11 = icmp sgt i32 %10, 0
  br i1 %11, label %.lr.ph, label %.preheader58

.preheader58:                                     ; preds = %.lr.ph, %0
  %.lcssa62 = phi i32 [ %10, %0 ], [ %16, %.lr.ph ]
  %12 = load i64, ptr @A, align 8
  %13 = tail call i32 @llvm.smax.i32(i32 %.lcssa62, i32 1)
  %smax = add nsw i32 %13, -1
  %wide.trip.count = zext nneg i32 %smax to i64
  br label %19

.lr.ph:                                           ; preds = %0, %.lr.ph
  %indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph ], [ 0, %0 ]
  %14 = getelementptr inbounds [100010 x i64], ptr @S, i64 0, i64 %indvars.iv
  %15 = tail call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) %14)
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %16 = load i32, ptr @N, align 4, !tbaa !5
  %17 = sext i32 %16 to i64
  %18 = icmp slt i64 %indvars.iv.next, %17
  br i1 %18, label %.lr.ph, label %.preheader58, !llvm.loop !9

19:                                               ; preds = %.preheader58, %20
  %indvars.iv78 = phi i64 [ 0, %.preheader58 ], [ %indvars.iv.next79, %20 ]
  %exitcond.not = icmp eq i64 %indvars.iv78, %wide.trip.count
  br i1 %exitcond.not, label %.critedge, label %20

20:                                               ; preds = %19
  %indvars.iv.next79 = add nuw nsw i64 %indvars.iv78, 1
  %21 = getelementptr inbounds [100010 x i64], ptr @S, i64 0, i64 %indvars.iv.next79
  %22 = load i64, ptr %21, align 8, !tbaa !11
  %23 = getelementptr inbounds [100010 x i64], ptr @S, i64 0, i64 %indvars.iv78
  %24 = load i64, ptr %23, align 8, !tbaa !11
  %25 = sub nsw i64 %22, %24
  %26 = icmp slt i64 %25, %12
  br i1 %26, label %.loopexit59, label %19, !llvm.loop !13

.critedge:                                        ; preds = %19
  %27 = load i64, ptr @ans, align 8, !tbaa !11
  %28 = add nsw i64 %27, 1
  store i64 %28, ptr @ans, align 8, !tbaa !11
  br label %.loopexit59

.loopexit59:                                      ; preds = %20, %.critedge
  %29 = load i64, ptr @B, align 8
  br label %30

30:                                               ; preds = %31, %.loopexit59
  %indvars.iv81 = phi i64 [ %indvars.iv.next82, %31 ], [ 0, %.loopexit59 ]
  %exitcond85.not = icmp eq i64 %indvars.iv81, %wide.trip.count
  br i1 %exitcond85.not, label %.critedge55, label %31

31:                                               ; preds = %30
  %indvars.iv.next82 = add nuw nsw i64 %indvars.iv81, 1
  %32 = getelementptr inbounds [100010 x i64], ptr @S, i64 0, i64 %indvars.iv.next82
  %33 = load i64, ptr %32, align 8, !tbaa !11
  %34 = getelementptr inbounds [100010 x i64], ptr @S, i64 0, i64 %indvars.iv81
  %35 = load i64, ptr %34, align 8, !tbaa !11
  %36 = sub nsw i64 %33, %35
  %37 = icmp slt i64 %36, %29
  br i1 %37, label %.loopexit, label %30, !llvm.loop !14

.critedge55:                                      ; preds = %30
  %38 = load i64, ptr @ans, align 8, !tbaa !11
  %39 = add nsw i64 %38, 1
  store i64 %39, ptr @ans, align 8, !tbaa !11
  br label %.loopexit

.loopexit:                                        ; preds = %31, %.critedge55
  %40 = sext i32 %.lcssa62 to i64
  %41 = getelementptr inbounds i64, ptr @X, i64 %40
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %1) #6
  store i32 -1, ptr %1, align 4, !tbaa !5
  call void @_ZSt4fillIPxiEvT_S1_RKT0_(ptr noundef nonnull @X, ptr noundef nonnull %41, ptr noundef nonnull align 4 dereferenceable(4) %1)
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #6
  %42 = load i32, ptr @N, align 4, !tbaa !5
  %43 = sext i32 %42 to i64
  %44 = getelementptr inbounds i64, ptr @Y, i64 %43
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %2) #6
  store i32 -1, ptr %2, align 4, !tbaa !5
  call void @_ZSt4fillIPxiEvT_S1_RKT0_(ptr noundef nonnull @Y, ptr noundef nonnull %44, ptr noundef nonnull align 4 dereferenceable(4) %2)
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %2) #6
  %45 = load i32, ptr @N, align 4, !tbaa !5
  %46 = sext i32 %45 to i64
  %47 = getelementptr inbounds i64, ptr @SX, i64 %46
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %3) #6
  store i32 -1, ptr %3, align 4, !tbaa !5
  call void @_ZSt4fillIPxiEvT_S1_RKT0_(ptr noundef nonnull @SX, ptr noundef nonnull %47, ptr noundef nonnull align 4 dereferenceable(4) %3)
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %3) #6
  %48 = load i32, ptr @N, align 4, !tbaa !5
  %49 = sext i32 %48 to i64
  %50 = getelementptr inbounds i64, ptr @SY, i64 %49
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %4) #6
  store i32 -1, ptr %4, align 4, !tbaa !5
  call void @_ZSt4fillIPxiEvT_S1_RKT0_(ptr noundef nonnull @SY, ptr noundef nonnull %50, ptr noundef nonnull align 4 dereferenceable(4) %4)
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %4) #6
  %51 = load i32, ptr @N, align 4, !tbaa !5
  %52 = sext i32 %51 to i64
  %53 = getelementptr inbounds i32, ptr @kA, i64 %52
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %5) #6
  store i32 -1, ptr %5, align 4, !tbaa !5
  call void @_ZSt4fillIPiiEvT_S1_RKT0_(ptr noundef nonnull @kA, ptr noundef nonnull %53, ptr noundef nonnull align 4 dereferenceable(4) %5)
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %5) #6
  %54 = load i32, ptr @N, align 4, !tbaa !5
  %55 = sext i32 %54 to i64
  %56 = getelementptr inbounds i32, ptr @kB, i64 %55
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %6) #6
  store i32 -1, ptr %6, align 4, !tbaa !5
  call void @_ZSt4fillIPiiEvT_S1_RKT0_(ptr noundef nonnull @kB, ptr noundef nonnull %56, ptr noundef nonnull align 4 dereferenceable(4) %6)
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %6) #6
  store i64 1, ptr @X, align 16, !tbaa !11
  store i64 1, ptr @Y, align 16, !tbaa !11
  store i64 1, ptr @SX, align 16, !tbaa !11
  store i64 1, ptr @SY, align 16, !tbaa !11
  %57 = load i32, ptr @N, align 4, !tbaa !5
  %58 = icmp sgt i32 %57, 0
  br i1 %58, label %.lr.ph66.preheader, label %._crit_edge

.lr.ph66.preheader:                               ; preds = %.loopexit
  %.pre86 = load i64, ptr @A, align 8, !tbaa !11
  br label %.lr.ph66

.preheader57:                                     ; preds = %79
  %59 = icmp sgt i32 %80, 0
  br i1 %59, label %.lr.ph69.preheader, label %._crit_edge

.lr.ph69.preheader:                               ; preds = %.preheader57
  %.pre89 = load i64, ptr @B, align 8, !tbaa !11
  br label %.lr.ph69

.lr.ph66:                                         ; preds = %.lr.ph66.preheader, %79
  %60 = phi i32 [ %80, %79 ], [ %57, %.lr.ph66.preheader ]
  %61 = phi i64 [ %81, %79 ], [ %.pre86, %.lr.ph66.preheader ]
  %.04165 = phi i32 [ %.1, %79 ], [ 0, %.lr.ph66.preheader ]
  %.04264 = phi i32 [ %.143, %79 ], [ 0, %.lr.ph66.preheader ]
  %62 = sext i32 %.04165 to i64
  %63 = getelementptr inbounds [100010 x i64], ptr @S, i64 0, i64 %62
  %64 = load i64, ptr %63, align 8, !tbaa !11
  %65 = sext i32 %.04264 to i64
  %66 = getelementptr inbounds [100010 x i64], ptr @S, i64 0, i64 %65
  %67 = load i64, ptr %66, align 8, !tbaa !11
  %68 = sub nsw i64 %64, %67
  %.not53 = icmp slt i64 %68, %61
  br i1 %.not53, label %77, label %69

69:                                               ; preds = %.lr.ph66
  %70 = getelementptr inbounds [100010 x i32], ptr @kA, i64 0, i64 %62
  store i32 %.04264, ptr %70, align 4, !tbaa !5
  %71 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cerr, ptr noundef nonnull @.str)
  %72 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) %71, i32 noundef %.04165)
  %73 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) %72, ptr noundef nonnull @.str.1)
  %74 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) %73, i32 noundef %.04264)
  %75 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %74, ptr noundef nonnull @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
  %76 = add nsw i32 %.04264, 1
  %.pre = load i64, ptr @A, align 8, !tbaa !11
  %.pre87 = load i32, ptr @N, align 4, !tbaa !5
  br label %79

77:                                               ; preds = %.lr.ph66
  %78 = add nsw i32 %.04165, 1
  br label %79

79:                                               ; preds = %77, %69
  %80 = phi i32 [ %.pre87, %69 ], [ %60, %77 ]
  %81 = phi i64 [ %.pre, %69 ], [ %61, %77 ]
  %.143 = phi i32 [ %76, %69 ], [ %.04264, %77 ]
  %.1 = phi i32 [ %.04165, %69 ], [ %78, %77 ]
  %82 = icmp slt i32 %.1, %80
  br i1 %82, label %.lr.ph66, label %.preheader57, !llvm.loop !15

.preheader56:                                     ; preds = %103
  %83 = icmp sgt i32 %104, 1
  br i1 %83, label %.lr.ph71, label %._crit_edge

.lr.ph69:                                         ; preds = %.lr.ph69.preheader, %103
  %84 = phi i32 [ %104, %103 ], [ %80, %.lr.ph69.preheader ]
  %85 = phi i64 [ %105, %103 ], [ %.pre89, %.lr.ph69.preheader ]
  %.268 = phi i32 [ %.3, %103 ], [ 0, %.lr.ph69.preheader ]
  %.24467 = phi i32 [ %.345, %103 ], [ 0, %.lr.ph69.preheader ]
  %86 = sext i32 %.268 to i64
  %87 = getelementptr inbounds [100010 x i64], ptr @S, i64 0, i64 %86
  %88 = load i64, ptr %87, align 8, !tbaa !11
  %89 = sext i32 %.24467 to i64
  %90 = getelementptr inbounds [100010 x i64], ptr @S, i64 0, i64 %89
  %91 = load i64, ptr %90, align 8, !tbaa !11
  %92 = sub nsw i64 %88, %91
  %.not52 = icmp slt i64 %92, %85
  br i1 %.not52, label %101, label %93

93:                                               ; preds = %.lr.ph69
  %94 = getelementptr inbounds [100010 x i32], ptr @kB, i64 0, i64 %86
  store i32 %.24467, ptr %94, align 4, !tbaa !5
  %95 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cerr, ptr noundef nonnull @.str.2)
  %96 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) %95, i32 noundef %.268)
  %97 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) %96, ptr noundef nonnull @.str.1)
  %98 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) %97, i32 noundef %.24467)
  %99 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %98, ptr noundef nonnull @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
  %100 = add nsw i32 %.24467, 1
  %.pre88 = load i64, ptr @B, align 8, !tbaa !11
  %.pre90 = load i32, ptr @N, align 4, !tbaa !5
  br label %103

101:                                              ; preds = %.lr.ph69
  %102 = add nsw i32 %.268, 1
  br label %103

103:                                              ; preds = %101, %93
  %104 = phi i32 [ %.pre90, %93 ], [ %84, %101 ]
  %105 = phi i64 [ %.pre88, %93 ], [ %85, %101 ]
  %.345 = phi i32 [ %100, %93 ], [ %.24467, %101 ]
  %.3 = phi i32 [ %.268, %93 ], [ %102, %101 ]
  %106 = icmp slt i32 %.3, %104
  br i1 %106, label %.lr.ph69, label %.preheader56, !llvm.loop !16

.preheader:                                       ; preds = %.lr.ph71
  %107 = icmp sgt i32 %115, 1
  br i1 %107, label %.lr.ph73, label %._crit_edge

.lr.ph71:                                         ; preds = %.preheader56, %.lr.ph71
  %.04070 = phi i32 [ %114, %.lr.ph71 ], [ 0, %.preheader56 ]
  %108 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, ptr noundef nonnull @.str.3)
  %109 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) %108, i32 noundef %.04070)
  %110 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) %109, ptr noundef nonnull @.str.4)
  %111 = call noundef i64 @_Z6calc_Xi(i32 noundef %.04070)
  %112 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8) %110, i64 noundef %111)
  %113 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %112, ptr noundef nonnull @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
  %114 = add nuw nsw i32 %.04070, 1
  %115 = load i32, ptr @N, align 4, !tbaa !5
  %116 = add nsw i32 %115, -1
  %117 = icmp slt i32 %114, %116
  br i1 %117, label %.lr.ph71, label %.preheader, !llvm.loop !17

._crit_edge:                                      ; preds = %.lr.ph73, %.loopexit, %.preheader57, %.preheader56, %.preheader
  %.lcssa = phi i32 [ %115, %.preheader ], [ %104, %.preheader56 ], [ %80, %.preheader57 ], [ %57, %.loopexit ], [ %136, %.lr.ph73 ]
  %118 = add nsw i32 %.lcssa, -2
  %119 = call noundef i64 @_Z7calc_SXi(i32 noundef %118)
  %120 = load i32, ptr @N, align 4, !tbaa !5
  %121 = add nsw i32 %120, -2
  %122 = call noundef i64 @_Z7calc_SYi(i32 noundef %121)
  %123 = add nsw i64 %122, %119
  %124 = load i64, ptr @ans, align 8, !tbaa !11
  %125 = add nsw i64 %123, %124
  %126 = srem i64 %125, 1000000007
  store i64 %126, ptr @ans, align 8, !tbaa !11
  %127 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i64 noundef %126)
  %128 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %127, ptr noundef nonnull @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
  ret i32 0

.lr.ph73:                                         ; preds = %.preheader, %.lr.ph73
  %.072 = phi i32 [ %135, %.lr.ph73 ], [ 0, %.preheader ]
  %129 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, ptr noundef nonnull @.str.5)
  %130 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) %129, i32 noundef %.072)
  %131 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) %130, ptr noundef nonnull @.str.4)
  %132 = call noundef i64 @_Z6calc_Yi(i32 noundef %.072)
  %133 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8) %131, i64 noundef %132)
  %134 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %133, ptr noundef nonnull @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
  %135 = add nuw nsw i32 %.072, 1
  %136 = load i32, ptr @N, align 4, !tbaa !5
  %137 = add nsw i32 %136, -1
  %138 = icmp slt i32 %135, %137
  br i1 %138, label %.lr.ph73, label %._crit_edge, !llvm.loop !18
}

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

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

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

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

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

; 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 = { 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 = { 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 = !{!12, !12, i64 0}
!12 = !{!"long long", !7, i64 0}
!13 = distinct !{!13, !10}
!14 = distinct !{!14, !10}
!15 = distinct !{!15, !10}
!16 = distinct !{!16, !10}
!17 = distinct !{!17, !10}
!18 = distinct !{!18, !10}


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