; LLVM IR from kazunetakahashi/atcoder :: 201510_201609/1024_KUPC2015 (D)

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

%"class.std::basic_istream" = type { ptr, i64, %"class.std::basic_ios" }
%"class.std::basic_ios" = type { %"class.std::ios_base", ptr, i8, i8, ptr, ptr, ptr, ptr }
%"class.std::ios_base" = type { ptr, i64, i64, i32, i32, i32, ptr, %"struct.std::ios_base::_Words", [8 x %"struct.std::ios_base::_Words"], i32, ptr, %"class.std::locale" }
%"struct.std::ios_base::_Words" = type { ptr, i64 }
%"class.std::locale" = type { ptr }
%"class.std::basic_ostream" = type { ptr, %"class.std::basic_ios" }

@N = external dso_local global i32, align 4
@A = external dso_local global [100010 x i64], align 16
@B = external dso_local global [100010 x i64], align 16
@nissu = external dso_local global [100010 x i32], align 16
@minmon = external dso_local global [100010 x i64], align 16
@ans = external dso_local global [100010 x i64], align 16
@_ZSt3cin = external global %"class.std::basic_istream", align 8
@_ZSt4cout = external global %"class.std::basic_ostream", align 8

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() #0 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  %7 = alloca i64, align 8
  %8 = alloca i32, align 4
  store i32 0, ptr %1, align 4
  %9 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) @N)
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #6
  store i32 0, ptr %2, align 4, !tbaa !5
  br label %10

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

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

15:                                               ; preds = %10
  %16 = load i32, ptr %2, align 4, !tbaa !5
  %17 = sext i32 %16 to i64
  %18 = getelementptr inbounds [100010 x i64], ptr @A, i64 0, i64 %17
  %19 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) %18)
  br label %20

20:                                               ; preds = %15
  %21 = load i32, ptr %2, align 4, !tbaa !5
  %22 = add nsw i32 %21, 1
  store i32 %22, ptr %2, align 4, !tbaa !5
  br label %10, !llvm.loop !9

23:                                               ; preds = %14
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #6
  store i32 0, ptr %3, align 4, !tbaa !5
  br label %24

24:                                               ; preds = %50, %23
  %25 = load i32, ptr %3, align 4, !tbaa !5
  %26 = load i32, ptr @N, align 4, !tbaa !5
  %27 = icmp slt i32 %25, %26
  br i1 %27, label %29, label %28

28:                                               ; preds = %24
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #6
  br label %53

29:                                               ; preds = %24
  %30 = load i32, ptr %3, align 4, !tbaa !5
  %31 = sext i32 %30 to i64
  %32 = getelementptr inbounds [100010 x i64], ptr @B, i64 0, i64 %31
  %33 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) %32)
  %34 = load i32, ptr %3, align 4, !tbaa !5
  %35 = icmp sgt i32 %34, 0
  br i1 %35, label %36, label %49

36:                                               ; preds = %29
  %37 = load i32, ptr %3, align 4, !tbaa !5
  %38 = sub nsw i32 %37, 1
  %39 = sext i32 %38 to i64
  %40 = getelementptr inbounds [100010 x i64], ptr @B, i64 0, i64 %39
  %41 = load i32, ptr %3, align 4, !tbaa !5
  %42 = sext i32 %41 to i64
  %43 = getelementptr inbounds [100010 x i64], ptr @B, i64 0, i64 %42
  %44 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3maxIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %40, ptr noundef nonnull align 8 dereferenceable(8) %43)
  %45 = load i64, ptr %44, align 8, !tbaa !11
  %46 = load i32, ptr %3, align 4, !tbaa !5
  %47 = sext i32 %46 to i64
  %48 = getelementptr inbounds [100010 x i64], ptr @B, i64 0, i64 %47
  store i64 %45, ptr %48, align 8, !tbaa !11
  br label %49

49:                                               ; preds = %36, %29
  br label %50

50:                                               ; preds = %49
  %51 = load i32, ptr %3, align 4, !tbaa !5
  %52 = add nsw i32 %51, 1
  store i32 %52, ptr %3, align 4, !tbaa !5
  br label %24, !llvm.loop !13

53:                                               ; preds = %28
  store i32 0, ptr @nissu, align 16, !tbaa !5
  store i64 0, ptr @minmon, align 16, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #6
  store i32 1, ptr %4, align 4, !tbaa !5
  br label %54

54:                                               ; preds = %141, %53
  %55 = load i32, ptr %4, align 4, !tbaa !5
  %56 = load i32, ptr @N, align 4, !tbaa !5
  %57 = add nsw i32 %56, 1
  %58 = icmp slt i32 %55, %57
  br i1 %58, label %60, label %59

59:                                               ; preds = %54
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #6
  br label %144

60:                                               ; preds = %54
  %61 = load i32, ptr %4, align 4, !tbaa !5
  %62 = sub nsw i32 %61, 1
  %63 = sext i32 %62 to i64
  %64 = getelementptr inbounds [100010 x i32], ptr @nissu, i64 0, i64 %63
  %65 = load i32, ptr %64, align 4, !tbaa !5
  %66 = add nsw i32 %65, 1
  %67 = load i32, ptr %4, align 4, !tbaa !5
  %68 = sext i32 %67 to i64
  %69 = getelementptr inbounds [100010 x i32], ptr @nissu, i64 0, i64 %68
  store i32 %66, ptr %69, align 4, !tbaa !5
  %70 = load i32, ptr %4, align 4, !tbaa !5
  %71 = sub nsw i32 %70, 1
  %72 = sext i32 %71 to i64
  %73 = getelementptr inbounds [100010 x i64], ptr @minmon, i64 0, i64 %72
  %74 = load i64, ptr %73, align 8, !tbaa !11
  %75 = load i32, ptr %4, align 4, !tbaa !5
  %76 = sub nsw i32 %75, 1
  %77 = sext i32 %76 to i64
  %78 = getelementptr inbounds [100010 x i64], ptr @A, i64 0, i64 %77
  %79 = load i64, ptr %78, align 8, !tbaa !11
  %80 = add nsw i64 %74, %79
  %81 = load i32, ptr %4, align 4, !tbaa !5
  %82 = sext i32 %81 to i64
  %83 = getelementptr inbounds [100010 x i64], ptr @minmon, i64 0, i64 %82
  store i64 %80, ptr %83, align 8, !tbaa !11
  %84 = load i32, ptr %4, align 4, !tbaa !5
  %85 = sext i32 %84 to i64
  %86 = getelementptr inbounds [100010 x i64], ptr @minmon, i64 0, i64 %85
  %87 = load i64, ptr %86, align 8, !tbaa !11
  %88 = icmp slt i64 %87, 0
  br i1 %88, label %89, label %140

89:                                               ; preds = %60
  %90 = load i32, ptr %4, align 4, !tbaa !5
  %91 = sub nsw i32 %90, 1
  %92 = sext i32 %91 to i64
  %93 = getelementptr inbounds [100010 x i64], ptr @B, i64 0, i64 %92
  %94 = load i64, ptr %93, align 8, !tbaa !11
  %95 = icmp eq i64 %94, 0
  br i1 %95, label %96, label %100

96:                                               ; preds = %89
  %97 = load i32, ptr %4, align 4, !tbaa !5
  %98 = sext i32 %97 to i64
  %99 = getelementptr inbounds [100010 x i32], ptr @nissu, i64 0, i64 %98
  store i32 1000000, ptr %99, align 4, !tbaa !5
  br label %139

100:                                              ; preds = %89
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #6
  %101 = load i32, ptr %4, align 4, !tbaa !5
  %102 = sext i32 %101 to i64
  %103 = getelementptr inbounds [100010 x i64], ptr @minmon, i64 0, i64 %102
  %104 = load i64, ptr %103, align 8, !tbaa !11
  %105 = mul nsw i64 -1, %104
  %106 = load i32, ptr %4, align 4, !tbaa !5
  %107 = sub nsw i32 %106, 1
  %108 = sext i32 %107 to i64
  %109 = getelementptr inbounds [100010 x i64], ptr @B, i64 0, i64 %108
  %110 = load i64, ptr %109, align 8, !tbaa !11
  %111 = add nsw i64 %105, %110
  %112 = sub nsw i64 %111, 1
  %113 = load i32, ptr %4, align 4, !tbaa !5
  %114 = sub nsw i32 %113, 1
  %115 = sext i32 %114 to i64
  %116 = getelementptr inbounds [100010 x i64], ptr @B, i64 0, i64 %115
  %117 = load i64, ptr %116, align 8, !tbaa !11
  %118 = sdiv i64 %112, %117
  %119 = trunc i64 %118 to i32
  store i32 %119, ptr %5, align 4, !tbaa !5
  %120 = load i32, ptr %5, align 4, !tbaa !5
  %121 = load i32, ptr %4, align 4, !tbaa !5
  %122 = sext i32 %121 to i64
  %123 = getelementptr inbounds [100010 x i32], ptr @nissu, i64 0, i64 %122
  %124 = load i32, ptr %123, align 4, !tbaa !5
  %125 = add nsw i32 %124, %120
  store i32 %125, ptr %123, align 4, !tbaa !5
  %126 = load i32, ptr %5, align 4, !tbaa !5
  %127 = sext i32 %126 to i64
  %128 = load i32, ptr %4, align 4, !tbaa !5
  %129 = sub nsw i32 %128, 1
  %130 = sext i32 %129 to i64
  %131 = getelementptr inbounds [100010 x i64], ptr @B, i64 0, i64 %130
  %132 = load i64, ptr %131, align 8, !tbaa !11
  %133 = mul nsw i64 %127, %132
  %134 = load i32, ptr %4, align 4, !tbaa !5
  %135 = sext i32 %134 to i64
  %136 = getelementptr inbounds [100010 x i64], ptr @minmon, i64 0, i64 %135
  %137 = load i64, ptr %136, align 8, !tbaa !11
  %138 = add nsw i64 %137, %133
  store i64 %138, ptr %136, align 8, !tbaa !11
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #6
  br label %139

139:                                              ; preds = %100, %96
  br label %140

140:                                              ; preds = %139, %60
  br label %141

141:                                              ; preds = %140
  %142 = load i32, ptr %4, align 4, !tbaa !5
  %143 = add nsw i32 %142, 1
  store i32 %143, ptr %4, align 4, !tbaa !5
  br label %54, !llvm.loop !14

144:                                              ; preds = %59
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #6
  store i32 0, ptr %6, align 4, !tbaa !5
  br label %145

145:                                              ; preds = %184, %144
  %146 = load i32, ptr %6, align 4, !tbaa !5
  %147 = load i32, ptr @N, align 4, !tbaa !5
  %148 = add nsw i32 %147, 1
  %149 = icmp slt i32 %146, %148
  br i1 %149, label %151, label %150

150:                                              ; preds = %145
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #6
  br label %187

151:                                              ; preds = %145
  %152 = load i32, ptr %6, align 4, !tbaa !5
  %153 = sext i32 %152 to i64
  %154 = getelementptr inbounds [100010 x i32], ptr @nissu, i64 0, i64 %153
  %155 = load i32, ptr %154, align 4, !tbaa !5
  %156 = load i32, ptr @N, align 4, !tbaa !5
  %157 = icmp sgt i32 %155, %156
  br i1 %157, label %158, label %162

158:                                              ; preds = %151
  %159 = load i32, ptr %6, align 4, !tbaa !5
  %160 = sext i32 %159 to i64
  %161 = getelementptr inbounds [100010 x i64], ptr @ans, i64 0, i64 %160
  store i64 -1, ptr %161, align 8, !tbaa !11
  br label %183

162:                                              ; preds = %151
  %163 = load i32, ptr %6, align 4, !tbaa !5
  %164 = sext i32 %163 to i64
  %165 = getelementptr inbounds [100010 x i64], ptr @minmon, i64 0, i64 %164
  %166 = load i64, ptr %165, align 8, !tbaa !11
  %167 = load i32, ptr %6, align 4, !tbaa !5
  %168 = sext i32 %167 to i64
  %169 = getelementptr inbounds [100010 x i64], ptr @B, i64 0, i64 %168
  %170 = load i64, ptr %169, align 8, !tbaa !11
  %171 = load i32, ptr @N, align 4, !tbaa !5
  %172 = load i32, ptr %6, align 4, !tbaa !5
  %173 = sext i32 %172 to i64
  %174 = getelementptr inbounds [100010 x i32], ptr @nissu, i64 0, i64 %173
  %175 = load i32, ptr %174, align 4, !tbaa !5
  %176 = sub nsw i32 %171, %175
  %177 = sext i32 %176 to i64
  %178 = mul nsw i64 %170, %177
  %179 = add nsw i64 %166, %178
  %180 = load i32, ptr %6, align 4, !tbaa !5
  %181 = sext i32 %180 to i64
  %182 = getelementptr inbounds [100010 x i64], ptr @ans, i64 0, i64 %181
  store i64 %179, ptr %182, align 8, !tbaa !11
  br label %183

183:                                              ; preds = %162, %158
  br label %184

184:                                              ; preds = %183
  %185 = load i32, ptr %6, align 4, !tbaa !5
  %186 = add nsw i32 %185, 1
  store i32 %186, ptr %6, align 4, !tbaa !5
  br label %145, !llvm.loop !15

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

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

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

194:                                              ; preds = %188
  %195 = load i32, ptr %8, align 4, !tbaa !5
  %196 = sext i32 %195 to i64
  %197 = getelementptr inbounds [100010 x i64], ptr @ans, i64 0, i64 %196
  %198 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3maxIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %7, ptr noundef nonnull align 8 dereferenceable(8) %197)
  %199 = load i64, ptr %198, align 8, !tbaa !11
  store i64 %199, ptr %7, align 8, !tbaa !11
  br label %200

200:                                              ; preds = %194
  %201 = load i32, ptr %8, align 4, !tbaa !5
  %202 = add nsw i32 %201, 1
  store i32 %202, ptr %8, align 4, !tbaa !5
  br label %188, !llvm.loop !16

203:                                              ; preds = %193
  %204 = load i64, ptr %7, align 8, !tbaa !11
  %205 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i64 noundef %204)
  %206 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %205, ptr noundef @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #6
  %207 = load i32, ptr %1, align 4
  ret i32 %207
}

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

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

; 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)) #3 align 2

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

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

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

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

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


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

%"class.std::basic_istream" = type { ptr, i64, %"class.std::basic_ios" }
%"class.std::basic_ios" = type { %"class.std::ios_base", ptr, i8, i8, ptr, ptr, ptr, ptr }
%"class.std::ios_base" = type { ptr, i64, i64, i32, i32, i32, ptr, %"struct.std::ios_base::_Words", [8 x %"struct.std::ios_base::_Words"], i32, ptr, %"class.std::locale" }
%"struct.std::ios_base::_Words" = type { ptr, i64 }
%"class.std::locale" = type { ptr }
%"class.std::basic_ostream" = type { ptr, %"class.std::basic_ios" }

@N = external dso_local global i32, align 4
@A = external dso_local global [100010 x i64], align 16
@B = external dso_local global [100010 x i64], align 16
@nissu = external dso_local local_unnamed_addr global [100010 x i32], align 16
@minmon = external dso_local local_unnamed_addr global [100010 x i64], align 16
@ans = external dso_local global [100010 x i64], align 16
@_ZSt3cin = external global %"class.std::basic_istream", align 8
@_ZSt4cout = external global %"class.std::basic_ostream", align 8

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #0 {
  %1 = alloca i64, align 8
  %2 = tail call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) @N)
  %3 = load i32, ptr @N, align 4, !tbaa !5
  %4 = icmp sgt i32 %3, 0
  br i1 %4, label %.lr.ph, label %._crit_edge.thread

.preheader51:                                     ; preds = %.lr.ph
  %5 = icmp sgt i32 %11, 0
  br i1 %5, label %6, label %._crit_edge.thread

6:                                                ; preds = %.preheader51
  %7 = 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) @B)
  %.pre = load i32, ptr @N, align 4, !tbaa !5
  %8 = icmp sgt i32 %.pre, 1
  br i1 %8, label %.lr.ph54.peel.next, label %._crit_edge

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

._crit_edge.thread:                               ; preds = %.preheader51, %0
  %.lcssa.ph = phi i32 [ %11, %.preheader51 ], [ %3, %0 ]
  store i32 0, ptr @nissu, align 16, !tbaa !5
  store i64 0, ptr @minmon, align 16, !tbaa !11
  br label %.preheader

._crit_edge:                                      ; preds = %.lr.ph54.peel.next, %6
  %.lcssa = phi i32 [ %.pre, %6 ], [ %21, %.lr.ph54.peel.next ]
  store i32 0, ptr @nissu, align 16, !tbaa !5
  store i64 0, ptr @minmon, align 16, !tbaa !11
  %.not55 = icmp slt i32 %.lcssa, 1
  br i1 %.not55, label %.preheader, label %.lr.ph58.preheader

.lr.ph58.preheader:                               ; preds = %._crit_edge
  %14 = add nuw i32 %.lcssa, 1
  %wide.trip.count = zext i32 %14 to i64
  br label %.lr.ph58

.lr.ph54.peel.next:                               ; preds = %6, %.lr.ph54.peel.next
  %indvars.iv70 = phi i64 [ %indvars.iv.next71, %.lr.ph54.peel.next ], [ 1, %6 ]
  %15 = getelementptr inbounds [100010 x i64], ptr @B, i64 0, i64 %indvars.iv70
  %16 = 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) %15)
  %17 = add nsw i64 %indvars.iv70, -1
  %18 = getelementptr inbounds [100010 x i64], ptr @B, i64 0, i64 %17
  %19 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3maxIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %18, ptr noundef nonnull align 8 dereferenceable(8) %15)
  %20 = load i64, ptr %19, align 8, !tbaa !11
  store i64 %20, ptr %15, align 8, !tbaa !11
  %indvars.iv.next71 = add nuw nsw i64 %indvars.iv70, 1
  %21 = load i32, ptr @N, align 4, !tbaa !5
  %22 = sext i32 %21 to i64
  %23 = icmp slt i64 %indvars.iv.next71, %22
  br i1 %23, label %.lr.ph54.peel.next, label %._crit_edge, !llvm.loop !13

.preheader:                                       ; preds = %50, %._crit_edge.thread, %._crit_edge
  %.lcssa87 = phi i32 [ %.lcssa.ph, %._crit_edge.thread ], [ %.lcssa, %._crit_edge ], [ %.lcssa, %50 ]
  %.not4859 = icmp slt i32 %.lcssa87, 0
  br i1 %.not4859, label %._crit_edge62.thread, label %.lr.ph61.preheader

._crit_edge62.thread:                             ; preds = %.preheader
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %1) #6
  store i64 0, ptr %1, align 8, !tbaa !11
  br label %._crit_edge67

.lr.ph61.preheader:                               ; preds = %.preheader
  %24 = add nuw i32 %.lcssa87, 1
  %wide.trip.count80 = zext i32 %24 to i64
  %xtraiter = and i64 %wide.trip.count80, 1
  %25 = icmp eq i32 %.lcssa87, 0
  br i1 %25, label %._crit_edge62.unr-lcssa, label %.lr.ph61.preheader.new

.lr.ph61.preheader.new:                           ; preds = %.lr.ph61.preheader
  %unroll_iter = and i64 %wide.trip.count80, 4294967294
  br label %.lr.ph61

.lr.ph58:                                         ; preds = %.lr.ph58.preheader, %50
  %26 = phi i64 [ 0, %.lr.ph58.preheader ], [ %51, %50 ]
  %27 = phi i32 [ 0, %.lr.ph58.preheader ], [ %52, %50 ]
  %indvars.iv74 = phi i64 [ 1, %.lr.ph58.preheader ], [ %indvars.iv.next75, %50 ]
  %28 = add nsw i64 %indvars.iv74, -1
  %29 = add nsw i32 %27, 1
  %30 = getelementptr inbounds [100010 x i32], ptr @nissu, i64 0, i64 %indvars.iv74
  store i32 %29, ptr %30, align 4, !tbaa !5
  %31 = getelementptr inbounds [100010 x i64], ptr @A, i64 0, i64 %28
  %32 = load i64, ptr %31, align 8, !tbaa !11
  %33 = add nsw i64 %32, %26
  %34 = getelementptr inbounds [100010 x i64], ptr @minmon, i64 0, i64 %indvars.iv74
  store i64 %33, ptr %34, align 8, !tbaa !11
  %35 = icmp slt i64 %33, 0
  br i1 %35, label %36, label %50

36:                                               ; preds = %.lr.ph58
  %37 = getelementptr inbounds [100010 x i64], ptr @B, i64 0, i64 %28
  %38 = load i64, ptr %37, align 8, !tbaa !11
  %39 = icmp eq i64 %38, 0
  br i1 %39, label %40, label %41

40:                                               ; preds = %36
  store i32 1000000, ptr %30, align 4, !tbaa !5
  br label %50

41:                                               ; preds = %36
  %42 = xor i64 %33, -1
  %43 = add i64 %38, %42
  %44 = sdiv i64 %43, %38
  %45 = trunc i64 %44 to i32
  %46 = add nsw i32 %29, %45
  store i32 %46, ptr %30, align 4, !tbaa !5
  %sext = shl i64 %44, 32
  %47 = ashr exact i64 %sext, 32
  %48 = mul nsw i64 %47, %38
  %49 = add nsw i64 %48, %33
  store i64 %49, ptr %34, align 8, !tbaa !11
  br label %50

50:                                               ; preds = %.lr.ph58, %41, %40
  %51 = phi i64 [ %33, %.lr.ph58 ], [ %49, %41 ], [ %33, %40 ]
  %52 = phi i32 [ %29, %.lr.ph58 ], [ %46, %41 ], [ 1000000, %40 ]
  %indvars.iv.next75 = add nuw nsw i64 %indvars.iv74, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next75, %wide.trip.count
  br i1 %exitcond.not, label %.preheader, label %.lr.ph58, !llvm.loop !15

._crit_edge62.unr-lcssa:                          ; preds = %91, %.lr.ph61.preheader
  %indvars.iv77.unr = phi i64 [ 0, %.lr.ph61.preheader ], [ %indvars.iv.next78.1, %91 ]
  %lcmp.mod.not = icmp eq i64 %xtraiter, 0
  br i1 %lcmp.mod.not, label %._crit_edge62, label %.lr.ph61.epil

.lr.ph61.epil:                                    ; preds = %._crit_edge62.unr-lcssa
  %53 = getelementptr inbounds [100010 x i32], ptr @nissu, i64 0, i64 %indvars.iv77.unr
  %54 = load i32, ptr %53, align 4, !tbaa !5
  %55 = icmp sgt i32 %54, %.lcssa87
  br i1 %55, label %._crit_edge62.epilog-lcssa, label %56

56:                                               ; preds = %.lr.ph61.epil
  %57 = getelementptr inbounds [100010 x i64], ptr @minmon, i64 0, i64 %indvars.iv77.unr
  %58 = load i64, ptr %57, align 8, !tbaa !11
  %59 = getelementptr inbounds [100010 x i64], ptr @B, i64 0, i64 %indvars.iv77.unr
  %60 = load i64, ptr %59, align 8, !tbaa !11
  %61 = sub nsw i32 %.lcssa87, %54
  %62 = sext i32 %61 to i64
  %63 = mul nsw i64 %60, %62
  %64 = add nsw i64 %63, %58
  br label %._crit_edge62.epilog-lcssa

._crit_edge62.epilog-lcssa:                       ; preds = %56, %.lr.ph61.epil
  %.sink.epil = phi i64 [ %64, %56 ], [ -1, %.lr.ph61.epil ]
  %65 = getelementptr inbounds [100010 x i64], ptr @ans, i64 0, i64 %indvars.iv77.unr
  store i64 %.sink.epil, ptr %65, align 8
  br label %._crit_edge62

._crit_edge62:                                    ; preds = %._crit_edge62.unr-lcssa, %._crit_edge62.epilog-lcssa
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %1) #6
  store i64 0, ptr %1, align 8, !tbaa !11
  br label %.lr.ph66

.lr.ph61:                                         ; preds = %91, %.lr.ph61.preheader.new
  %indvars.iv77 = phi i64 [ 0, %.lr.ph61.preheader.new ], [ %indvars.iv.next78.1, %91 ]
  %niter = phi i64 [ 0, %.lr.ph61.preheader.new ], [ %niter.next.1, %91 ]
  %66 = getelementptr inbounds [100010 x i32], ptr @nissu, i64 0, i64 %indvars.iv77
  %67 = load i32, ptr %66, align 8, !tbaa !5
  %68 = icmp sgt i32 %67, %.lcssa87
  br i1 %68, label %.lr.ph61.1, label %69

69:                                               ; preds = %.lr.ph61
  %70 = getelementptr inbounds [100010 x i64], ptr @minmon, i64 0, i64 %indvars.iv77
  %71 = load i64, ptr %70, align 16, !tbaa !11
  %72 = getelementptr inbounds [100010 x i64], ptr @B, i64 0, i64 %indvars.iv77
  %73 = load i64, ptr %72, align 16, !tbaa !11
  %74 = sub nsw i32 %.lcssa87, %67
  %75 = sext i32 %74 to i64
  %76 = mul nsw i64 %73, %75
  %77 = add nsw i64 %76, %71
  br label %.lr.ph61.1

.lr.ph61.1:                                       ; preds = %.lr.ph61, %69
  %.sink = phi i64 [ %77, %69 ], [ -1, %.lr.ph61 ]
  %78 = getelementptr inbounds [100010 x i64], ptr @ans, i64 0, i64 %indvars.iv77
  store i64 %.sink, ptr %78, align 16
  %indvars.iv.next78 = or disjoint i64 %indvars.iv77, 1
  %79 = getelementptr inbounds [100010 x i32], ptr @nissu, i64 0, i64 %indvars.iv.next78
  %80 = load i32, ptr %79, align 4, !tbaa !5
  %81 = icmp sgt i32 %80, %.lcssa87
  br i1 %81, label %91, label %82

82:                                               ; preds = %.lr.ph61.1
  %83 = getelementptr inbounds [100010 x i64], ptr @minmon, i64 0, i64 %indvars.iv.next78
  %84 = load i64, ptr %83, align 8, !tbaa !11
  %85 = getelementptr inbounds [100010 x i64], ptr @B, i64 0, i64 %indvars.iv.next78
  %86 = load i64, ptr %85, align 8, !tbaa !11
  %87 = sub nsw i32 %.lcssa87, %80
  %88 = sext i32 %87 to i64
  %89 = mul nsw i64 %86, %88
  %90 = add nsw i64 %89, %84
  br label %91

91:                                               ; preds = %82, %.lr.ph61.1
  %.sink.1 = phi i64 [ %90, %82 ], [ -1, %.lr.ph61.1 ]
  %92 = getelementptr inbounds [100010 x i64], ptr @ans, i64 0, i64 %indvars.iv.next78
  store i64 %.sink.1, ptr %92, align 8
  %indvars.iv.next78.1 = add nuw nsw i64 %indvars.iv77, 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_edge62.unr-lcssa, label %.lr.ph61, !llvm.loop !16

._crit_edge67:                                    ; preds = %.lr.ph66, %._crit_edge62.thread
  %93 = phi i64 [ 0, %._crit_edge62.thread ], [ %98, %.lr.ph66 ]
  %94 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i64 noundef %93)
  %95 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %94, ptr noundef nonnull @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %1) #6
  ret i32 0

.lr.ph66:                                         ; preds = %._crit_edge62, %.lr.ph66
  %indvars.iv82 = phi i64 [ %indvars.iv.next83, %.lr.ph66 ], [ 0, %._crit_edge62 ]
  %96 = getelementptr inbounds [100010 x i64], ptr @ans, i64 0, i64 %indvars.iv82
  %97 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3maxIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %1, ptr noundef nonnull align 8 dereferenceable(8) %96)
  %98 = load i64, ptr %97, align 8, !tbaa !11
  store i64 %98, ptr %1, align 8, !tbaa !11
  %indvars.iv.next83 = add nuw nsw i64 %indvars.iv82, 1
  %99 = load i32, ptr @N, align 4, !tbaa !5
  %100 = sext i32 %99 to i64
  %.not49.not = icmp slt i64 %indvars.iv82, %100
  br i1 %.not49.not, label %.lr.ph66, label %._crit_edge67, !llvm.loop !17
}

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

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

; 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 #3 align 2

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

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

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

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


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