; LLVM IR from eyangch/competitive-programming :: Codeforces/1253 (e)

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

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

@N = external dso_local global i64, align 8
@M = external dso_local global i64, align 8
@X = external dso_local global [81 x i64], align 16
@S = external dso_local global [81 x i64], align 16
@L = external dso_local global [81 x i64], align 16
@R = external dso_local global [81 x i64], align 16
@dp = external dso_local global [100001 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 i64, align 8
  %3 = alloca i64, align 8
  %4 = alloca i32, align 4
  %5 = alloca i8, align 1
  %6 = alloca i64, align 8
  %7 = alloca i64, align 8
  %8 = alloca i64, align 8
  %9 = alloca i64, align 8
  %10 = alloca i64, align 8
  %11 = alloca i64, align 8
  %12 = alloca i64, align 8
  store i32 0, ptr %1, align 4
  %13 = load ptr, ptr @_ZSt3cin, align 8, !tbaa !5
  %14 = getelementptr i8, ptr %13, i64 -24
  %15 = load i64, ptr %14, align 8
  %16 = getelementptr inbounds i8, ptr @_ZSt3cin, i64 %15
  %17 = call noundef ptr @_ZNSt9basic_iosIcSt11char_traitsIcEE3tieEPSo(ptr noundef nonnull align 8 dereferenceable(264) %16, ptr noundef null)
  %18 = call noundef zeroext i1 @_ZNSt8ios_base15sync_with_stdioEb(i1 noundef zeroext false)
  %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) @N)
  %20 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) %19, ptr noundef nonnull align 8 dereferenceable(8) @M)
  call void @llvm.lifetime.start.p0(i64 8, ptr %2) #7
  store i64 0, ptr %2, align 8, !tbaa !8
  br label %21

21:                                               ; preds = %51, %0
  %22 = load i64, ptr %2, align 8, !tbaa !8
  %23 = load i64, ptr @N, align 8, !tbaa !8
  %24 = icmp slt i64 %22, %23
  br i1 %24, label %26, label %25

25:                                               ; preds = %21
  call void @llvm.lifetime.end.p0(i64 8, ptr %2) #7
  br label %54

26:                                               ; preds = %21
  %27 = load i64, ptr %2, align 8, !tbaa !8
  %28 = getelementptr inbounds [81 x i64], ptr @X, 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)
  %30 = load i64, ptr %2, align 8, !tbaa !8
  %31 = getelementptr inbounds [81 x i64], ptr @S, i64 0, i64 %30
  %32 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) %29, ptr noundef nonnull align 8 dereferenceable(8) %31)
  %33 = load i64, ptr %2, align 8, !tbaa !8
  %34 = getelementptr inbounds [81 x i64], ptr @X, i64 0, i64 %33
  %35 = load i64, ptr %34, align 8, !tbaa !8
  %36 = load i64, ptr %2, align 8, !tbaa !8
  %37 = getelementptr inbounds [81 x i64], ptr @S, i64 0, i64 %36
  %38 = load i64, ptr %37, align 8, !tbaa !8
  %39 = sub nsw i64 %35, %38
  %40 = load i64, ptr %2, align 8, !tbaa !8
  %41 = getelementptr inbounds [81 x i64], ptr @L, i64 0, i64 %40
  store i64 %39, ptr %41, align 8, !tbaa !8
  %42 = load i64, ptr %2, align 8, !tbaa !8
  %43 = getelementptr inbounds [81 x i64], ptr @X, i64 0, i64 %42
  %44 = load i64, ptr %43, align 8, !tbaa !8
  %45 = load i64, ptr %2, align 8, !tbaa !8
  %46 = getelementptr inbounds [81 x i64], ptr @S, i64 0, i64 %45
  %47 = load i64, ptr %46, align 8, !tbaa !8
  %48 = add nsw i64 %44, %47
  %49 = load i64, ptr %2, align 8, !tbaa !8
  %50 = getelementptr inbounds [81 x i64], ptr @R, i64 0, i64 %49
  store i64 %48, ptr %50, align 8, !tbaa !8
  br label %51

51:                                               ; preds = %26
  %52 = load i64, ptr %2, align 8, !tbaa !8
  %53 = add nsw i64 %52, 1
  store i64 %53, ptr %2, align 8, !tbaa !8
  br label %21, !llvm.loop !11

54:                                               ; preds = %25
  %55 = load i64, ptr @N, align 8, !tbaa !8
  %56 = getelementptr inbounds [81 x i64], ptr @X, i64 0, i64 %55
  store i64 0, ptr %56, align 8, !tbaa !8
  %57 = load i64, ptr @N, align 8, !tbaa !8
  %58 = getelementptr inbounds [81 x i64], ptr @S, i64 0, i64 %57
  store i64 0, ptr %58, align 8, !tbaa !8
  %59 = load i64, ptr @N, align 8, !tbaa !8
  %60 = getelementptr inbounds [81 x i64], ptr @L, i64 0, i64 %59
  store i64 0, ptr %60, align 8, !tbaa !8
  %61 = load i64, ptr @N, align 8, !tbaa !8
  %62 = getelementptr inbounds [81 x i64], ptr @R, i64 0, i64 %61
  store i64 0, ptr %62, align 8, !tbaa !8
  store i64 0, ptr @dp, align 16, !tbaa !8
  call void @llvm.lifetime.start.p0(i64 8, ptr %3) #7
  store i64 1, ptr %3, align 8, !tbaa !8
  br label %63

63:                                               ; preds = %153, %54
  %64 = load i64, ptr %3, align 8, !tbaa !8
  %65 = load i64, ptr @M, align 8, !tbaa !8
  %66 = icmp sle i64 %64, %65
  br i1 %66, label %68, label %67

67:                                               ; preds = %63
  store i32 5, ptr %4, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %3) #7
  br label %156

68:                                               ; preds = %63
  call void @llvm.lifetime.start.p0(i64 1, ptr %5) #7
  store i8 0, ptr %5, align 1, !tbaa !13
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #7
  store i64 0, ptr %6, align 8, !tbaa !8
  br label %69

69:                                               ; preds = %88, %68
  %70 = load i64, ptr %6, align 8, !tbaa !8
  %71 = load i64, ptr @N, align 8, !tbaa !8
  %72 = icmp sle i64 %70, %71
  br i1 %72, label %74, label %73

73:                                               ; preds = %69
  store i32 8, ptr %4, align 4
  br label %91

74:                                               ; preds = %69
  %75 = load i64, ptr %6, align 8, !tbaa !8
  %76 = getelementptr inbounds [81 x i64], ptr @L, i64 0, i64 %75
  %77 = load i64, ptr %76, align 8, !tbaa !8
  %78 = load i64, ptr %3, align 8, !tbaa !8
  %79 = icmp sle i64 %77, %78
  br i1 %79, label %80, label %87

80:                                               ; preds = %74
  %81 = load i64, ptr %6, align 8, !tbaa !8
  %82 = getelementptr inbounds [81 x i64], ptr @R, i64 0, i64 %81
  %83 = load i64, ptr %82, align 8, !tbaa !8
  %84 = load i64, ptr %3, align 8, !tbaa !8
  %85 = icmp sge i64 %83, %84
  br i1 %85, label %86, label %87

86:                                               ; preds = %80
  store i8 1, ptr %5, align 1, !tbaa !13
  store i32 8, ptr %4, align 4
  br label %91

87:                                               ; preds = %80, %74
  br label %88

88:                                               ; preds = %87
  %89 = load i64, ptr %6, align 8, !tbaa !8
  %90 = add nsw i64 %89, 1
  store i64 %90, ptr %6, align 8, !tbaa !8
  br label %69, !llvm.loop !15

91:                                               ; preds = %86, %73
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #7
  br label %92

92:                                               ; preds = %91
  %93 = load i8, ptr %5, align 1, !tbaa !13, !range !16, !noundef !17
  %94 = trunc i8 %93 to i1
  br i1 %94, label %95, label %102

95:                                               ; preds = %92
  %96 = load i64, ptr %3, align 8, !tbaa !8
  %97 = sub nsw i64 %96, 1
  %98 = getelementptr inbounds [100001 x i64], ptr @dp, i64 0, i64 %97
  %99 = load i64, ptr %98, align 8, !tbaa !8
  %100 = load i64, ptr %3, align 8, !tbaa !8
  %101 = getelementptr inbounds [100001 x i64], ptr @dp, i64 0, i64 %100
  store i64 %99, ptr %101, align 8, !tbaa !8
  store i32 7, ptr %4, align 4
  br label %150

102:                                              ; preds = %92
  %103 = load i64, ptr %3, align 8, !tbaa !8
  %104 = getelementptr inbounds [100001 x i64], ptr @dp, i64 0, i64 %103
  store i64 1000000000, ptr %104, align 8, !tbaa !8
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #7
  store i64 0, ptr %7, align 8, !tbaa !8
  br label %105

105:                                              ; preds = %146, %102
  %106 = load i64, ptr %7, align 8, !tbaa !8
  %107 = load i64, ptr @N, align 8, !tbaa !8
  %108 = icmp sle i64 %106, %107
  br i1 %108, label %110, label %109

109:                                              ; preds = %105
  store i32 11, ptr %4, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #7
  br label %149

110:                                              ; preds = %105
  %111 = load i64, ptr %7, align 8, !tbaa !8
  %112 = getelementptr inbounds [81 x i64], ptr @R, i64 0, i64 %111
  %113 = load i64, ptr %112, align 8, !tbaa !8
  %114 = load i64, ptr %3, align 8, !tbaa !8
  %115 = icmp sgt i64 %113, %114
  br i1 %115, label %116, label %117

116:                                              ; preds = %110
  br label %146

117:                                              ; preds = %110
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #7
  %118 = load i64, ptr %3, align 8, !tbaa !8
  %119 = load i64, ptr %7, align 8, !tbaa !8
  %120 = getelementptr inbounds [81 x i64], ptr @R, i64 0, i64 %119
  %121 = load i64, ptr %120, align 8, !tbaa !8
  %122 = sub nsw i64 %118, %121
  store i64 %122, ptr %8, align 8, !tbaa !8
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #7
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #7
  store i64 0, ptr %10, align 8, !tbaa !8
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #7
  %123 = load i64, ptr %7, align 8, !tbaa !8
  %124 = getelementptr inbounds [81 x i64], ptr @L, i64 0, i64 %123
  %125 = load i64, ptr %124, align 8, !tbaa !8
  %126 = load i64, ptr %8, align 8, !tbaa !8
  %127 = sub nsw i64 %125, %126
  %128 = sub nsw i64 %127, 1
  store i64 %128, ptr %11, align 8, !tbaa !8
  %129 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3maxIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %10, ptr noundef nonnull align 8 dereferenceable(8) %11)
  %130 = load i64, ptr %129, align 8, !tbaa !8
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #7
  store i64 %130, ptr %9, align 8, !tbaa !8
  %131 = load i64, ptr %3, align 8, !tbaa !8
  %132 = getelementptr inbounds [100001 x i64], ptr @dp, i64 0, i64 %131
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #7
  %133 = load i64, ptr %9, align 8, !tbaa !8
  %134 = getelementptr inbounds [100001 x i64], ptr @dp, i64 0, i64 %133
  %135 = load i64, ptr %134, align 8, !tbaa !8
  %136 = load i64, ptr %8, align 8, !tbaa !8
  %137 = add nsw i64 %135, %136
  store i64 %137, ptr %12, align 8, !tbaa !8
  %138 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3minIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %132, ptr noundef nonnull align 8 dereferenceable(8) %12)
  %139 = load i64, ptr %138, align 8, !tbaa !8
  %140 = load i64, ptr %3, align 8, !tbaa !8
  %141 = getelementptr inbounds [100001 x i64], ptr @dp, i64 0, i64 %140
  store i64 %139, ptr %141, align 8, !tbaa !8
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #7
  %142 = load i64, ptr %3, align 8, !tbaa !8
  %143 = icmp eq i64 %142, 514
  br i1 %143, label %144, label %145

144:                                              ; preds = %117
  br label %145

145:                                              ; preds = %144, %117
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #7
  br label %146

146:                                              ; preds = %145, %116
  %147 = load i64, ptr %7, align 8, !tbaa !8
  %148 = add nsw i64 %147, 1
  store i64 %148, ptr %7, align 8, !tbaa !8
  br label %105, !llvm.loop !18

149:                                              ; preds = %109
  store i32 0, ptr %4, align 4
  br label %150

150:                                              ; preds = %149, %95
  call void @llvm.lifetime.end.p0(i64 1, ptr %5) #7
  %151 = load i32, ptr %4, align 4
  switch i32 %151, label %163 [
    i32 0, label %152
    i32 7, label %153
  ]

152:                                              ; preds = %150
  br label %153

153:                                              ; preds = %152, %150
  %154 = load i64, ptr %3, align 8, !tbaa !8
  %155 = add nsw i64 %154, 1
  store i64 %155, ptr %3, align 8, !tbaa !8
  br label %63, !llvm.loop !19

156:                                              ; preds = %67
  %157 = load i64, ptr @M, align 8, !tbaa !8
  %158 = getelementptr inbounds [100001 x i64], ptr @dp, i64 0, i64 %157
  %159 = load i64, ptr %158, align 8, !tbaa !8
  %160 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i64 noundef %159)
  %161 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c(ptr noundef nonnull align 8 dereferenceable(8) %160, i8 noundef signext 10)
  %162 = load i32, ptr %1, align 4
  ret i32 %162

163:                                              ; preds = %150
  unreachable
}

; Function Attrs: mustprogress nounwind uwtable
declare noundef ptr @_ZNSt9basic_iosIcSt11char_traitsIcEE3tieEPSo(ptr noundef nonnull align 8 dereferenceable(264), ptr noundef) #1 align 2

declare noundef zeroext i1 @_ZNSt8ios_base15sync_with_stdioEb(i1 noundef zeroext) #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.start.p0(i64 immarg, ptr nocapture) #4

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

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

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

; Function Attrs: inlinehint mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c(ptr noundef nonnull align 8 dereferenceable(8), i8 noundef signext) #6

; 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

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 = { 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 #2 = { "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 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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #5 = { 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 #6 = { 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 #7 = { 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 = !{!"vtable pointer", !7, i64 0}
!7 = !{!"Simple C++ TBAA"}
!8 = !{!9, !9, i64 0}
!9 = !{!"long long", !10, i64 0}
!10 = !{!"omnipotent char", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = !{!14, !14, i64 0}
!14 = !{!"bool", !10, i64 0}
!15 = distinct !{!15, !12}
!16 = !{i8 0, i8 2}
!17 = !{}
!18 = distinct !{!18, !12}
!19 = distinct !{!19, !12}


; 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 i64, align 8
@M = external dso_local global i64, align 8
@X = external dso_local global [81 x i64], align 16
@S = external dso_local global [81 x i64], align 16
@L = external dso_local local_unnamed_addr global [81 x i64], align 16
@R = external dso_local local_unnamed_addr global [81 x i64], align 16
@dp = external dso_local global [100001 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 = alloca i64, align 8
  %3 = alloca i64, align 8
  %4 = load ptr, ptr @_ZSt3cin, align 8, !tbaa !5
  %5 = getelementptr i8, ptr %4, i64 -24
  %6 = load i64, ptr %5, align 8
  %7 = getelementptr inbounds i8, ptr @_ZSt3cin, i64 %6
  %8 = tail call noundef ptr @_ZNSt9basic_iosIcSt11char_traitsIcEE3tieEPSo(ptr noundef nonnull align 8 dereferenceable(264) %7, ptr noundef null)
  %9 = tail call noundef zeroext i1 @_ZNSt8ios_base15sync_with_stdioEb(i1 noundef zeroext false)
  %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) @N)
  %11 = tail call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) %10, ptr noundef nonnull align 8 dereferenceable(8) @M)
  %12 = load i64, ptr @N, align 8, !tbaa !8
  %13 = icmp sgt i64 %12, 0
  br i1 %13, label %.lr.ph, label %._crit_edge

._crit_edge:                                      ; preds = %.lr.ph, %0
  %.lcssa47 = phi i64 [ %12, %0 ], [ %30, %.lr.ph ]
  %14 = getelementptr inbounds [81 x i64], ptr @X, i64 0, i64 %.lcssa47
  store i64 0, ptr %14, align 8, !tbaa !8
  %15 = getelementptr inbounds [81 x i64], ptr @S, i64 0, i64 %.lcssa47
  store i64 0, ptr %15, align 8, !tbaa !8
  %16 = getelementptr inbounds [81 x i64], ptr @L, i64 0, i64 %.lcssa47
  store i64 0, ptr %16, align 8, !tbaa !8
  %17 = getelementptr inbounds [81 x i64], ptr @R, i64 0, i64 %.lcssa47
  store i64 0, ptr %17, align 8, !tbaa !8
  store i64 0, ptr @dp, align 16, !tbaa !8
  %18 = load i64, ptr @M, align 8, !tbaa !8
  %.not55 = icmp slt i64 %18, 1
  br i1 %.not55, label %._crit_edge58, label %.preheader

.lr.ph:                                           ; preds = %0, %.lr.ph
  %.048 = phi i64 [ %29, %.lr.ph ], [ 0, %0 ]
  %19 = getelementptr inbounds [81 x i64], ptr @X, i64 0, i64 %.048
  %20 = 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) %19)
  %21 = getelementptr inbounds [81 x i64], ptr @S, i64 0, i64 %.048
  %22 = tail call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) %20, ptr noundef nonnull align 8 dereferenceable(8) %21)
  %23 = load i64, ptr %19, align 8, !tbaa !8
  %24 = load i64, ptr %21, align 8, !tbaa !8
  %25 = sub nsw i64 %23, %24
  %26 = getelementptr inbounds [81 x i64], ptr @L, i64 0, i64 %.048
  store i64 %25, ptr %26, align 8, !tbaa !8
  %27 = add nsw i64 %24, %23
  %28 = getelementptr inbounds [81 x i64], ptr @R, i64 0, i64 %.048
  store i64 %27, ptr %28, align 8, !tbaa !8
  %29 = add nuw nsw i64 %.048, 1
  %30 = load i64, ptr @N, align 8, !tbaa !8
  %31 = icmp slt i64 %29, %30
  br i1 %31, label %.lr.ph, label %._crit_edge, !llvm.loop !11

.preheader:                                       ; preds = %._crit_edge, %.loopexit
  %32 = phi i64 [ %73, %.loopexit ], [ %18, %._crit_edge ]
  %33 = phi i64 [ %74, %.loopexit ], [ %.lcssa47, %._crit_edge ]
  %34 = phi i64 [ %75, %.loopexit ], [ %.lcssa47, %._crit_edge ]
  %35 = phi i64 [ %76, %.loopexit ], [ %.lcssa47, %._crit_edge ]
  %.03656 = phi i64 [ %77, %.loopexit ], [ 1, %._crit_edge ]
  %.not43.not49 = icmp slt i64 %35, 0
  br i1 %.not43.not49, label %.critedge, label %.lr.ph51

._crit_edge58:                                    ; preds = %.loopexit, %._crit_edge
  %.lcssa = phi i64 [ %18, %._crit_edge ], [ %73, %.loopexit ]
  %36 = getelementptr inbounds [100001 x i64], ptr @dp, i64 0, i64 %.lcssa
  %37 = load i64, ptr %36, align 8, !tbaa !8
  %38 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i64 noundef %37)
  %39 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c(ptr noundef nonnull align 8 dereferenceable(8) %38, i8 noundef signext 10)
  ret i32 0

.lr.ph51:                                         ; preds = %.preheader, %45
  %.03850 = phi i64 [ %46, %45 ], [ 0, %.preheader ]
  %40 = getelementptr inbounds [81 x i64], ptr @L, i64 0, i64 %.03850
  %41 = load i64, ptr %40, align 8, !tbaa !8
  %.not44 = icmp sgt i64 %41, %.03656
  br i1 %.not44, label %45, label %42

42:                                               ; preds = %.lr.ph51
  %43 = getelementptr inbounds [81 x i64], ptr @R, i64 0, i64 %.03850
  %44 = load i64, ptr %43, align 8, !tbaa !8
  %.not45 = icmp slt i64 %44, %.03656
  br i1 %.not45, label %45, label %47

45:                                               ; preds = %.lr.ph51, %42
  %46 = add nuw i64 %.03850, 1
  %exitcond.not = icmp eq i64 %.03850, %35
  br i1 %exitcond.not, label %.critedge, label %.lr.ph51, !llvm.loop !13

47:                                               ; preds = %42
  %48 = add nsw i64 %.03656, -1
  %49 = getelementptr inbounds [100001 x i64], ptr @dp, i64 0, i64 %48
  %50 = load i64, ptr %49, align 8, !tbaa !8
  %51 = getelementptr inbounds [100001 x i64], ptr @dp, i64 0, i64 %.03656
  store i64 %50, ptr %51, align 8, !tbaa !8
  br label %.loopexit

.critedge:                                        ; preds = %45, %.preheader
  %52 = getelementptr inbounds [100001 x i64], ptr @dp, i64 0, i64 %.03656
  store i64 1000000000, ptr %52, align 8, !tbaa !8
  %.not4652 = icmp slt i64 %34, 0
  br i1 %.not4652, label %.loopexit, label %.lr.ph54

.lr.ph54:                                         ; preds = %.critedge, %70
  %53 = phi i64 [ %71, %70 ], [ %33, %.critedge ]
  %.03753 = phi i64 [ %72, %70 ], [ 0, %.critedge ]
  %54 = getelementptr inbounds [81 x i64], ptr @R, i64 0, i64 %.03753
  %55 = load i64, ptr %54, align 8, !tbaa !8
  %56 = icmp sgt i64 %55, %.03656
  br i1 %56, label %70, label %57

57:                                               ; preds = %.lr.ph54
  %58 = sub nsw i64 %.03656, %55
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %1) #7
  store i64 0, ptr %1, align 8, !tbaa !8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %2) #7
  %59 = getelementptr inbounds [81 x i64], ptr @L, i64 0, i64 %.03753
  %60 = load i64, ptr %59, align 8, !tbaa !8
  %61 = xor i64 %58, -1
  %62 = add i64 %60, %61
  store i64 %62, ptr %2, align 8, !tbaa !8
  %63 = 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) %2)
  %64 = load i64, ptr %63, align 8, !tbaa !8
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %2) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %1) #7
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %3) #7
  %65 = getelementptr inbounds [100001 x i64], ptr @dp, i64 0, i64 %64
  %66 = load i64, ptr %65, align 8, !tbaa !8
  %67 = add nsw i64 %66, %58
  store i64 %67, ptr %3, align 8, !tbaa !8
  %68 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3minIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %52, ptr noundef nonnull align 8 dereferenceable(8) %3)
  %69 = load i64, ptr %68, align 8, !tbaa !8
  store i64 %69, ptr %52, align 8, !tbaa !8
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %3) #7
  %.pre = load i64, ptr @N, align 8, !tbaa !8
  br label %70

70:                                               ; preds = %.lr.ph54, %57
  %71 = phi i64 [ %53, %.lr.ph54 ], [ %.pre, %57 ]
  %72 = add nuw nsw i64 %.03753, 1
  %.not46.not = icmp slt i64 %.03753, %71
  br i1 %.not46.not, label %.lr.ph54, label %.loopexit.loopexit, !llvm.loop !14

.loopexit.loopexit:                               ; preds = %70
  %.pre62 = load i64, ptr @M, align 8, !tbaa !8
  br label %.loopexit

.loopexit:                                        ; preds = %.loopexit.loopexit, %.critedge, %47
  %73 = phi i64 [ %.pre62, %.loopexit.loopexit ], [ %32, %.critedge ], [ %32, %47 ]
  %74 = phi i64 [ %71, %.loopexit.loopexit ], [ %33, %.critedge ], [ %33, %47 ]
  %75 = phi i64 [ %71, %.loopexit.loopexit ], [ %34, %.critedge ], [ %34, %47 ]
  %76 = phi i64 [ %71, %.loopexit.loopexit ], [ %34, %.critedge ], [ %35, %47 ]
  %77 = add nuw nsw i64 %.03656, 1
  %.not.not = icmp slt i64 %.03656, %73
  br i1 %.not.not, label %.preheader, label %._crit_edge58, !llvm.loop !15
}

; Function Attrs: mustprogress nounwind uwtable
declare noundef ptr @_ZNSt9basic_iosIcSt11char_traitsIcEE3tieEPSo(ptr noundef nonnull align 8 dereferenceable(264), ptr noundef) local_unnamed_addr #1 align 2

declare noundef zeroext i1 @_ZNSt8ios_base15sync_with_stdioEb(i1 noundef zeroext) local_unnamed_addr #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.start.p0(i64 immarg, ptr nocapture) #4

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

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

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

; Function Attrs: inlinehint mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c(ptr noundef nonnull align 8 dereferenceable(8), i8 noundef signext) local_unnamed_addr #6

; 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

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 = { 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 #2 = { "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 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 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #5 = { 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 #6 = { 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 #7 = { 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 = !{!"vtable pointer", !7, i64 0}
!7 = !{!"Simple C++ TBAA"}
!8 = !{!9, !9, i64 0}
!9 = !{!"long long", !10, i64 0}
!10 = !{!"omnipotent char", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = distinct !{!13, !12}
!14 = distinct !{!14, !12}
!15 = distinct !{!15, !12}


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