; LLVM IR from AdarshGaur/Competitive-Programming :: Atcoder/AtCoder Beginner Contest 210 (D - National-Railway)

; 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" }

@h = external dso_local global i64, align 8
@w = external dso_local global i64, align 8
@c = external dso_local global i64, align 8
@ans = external dso_local global i64, align 8
@a = external dso_local global [1007 x [1007 x i64]], align 16
@extra = external dso_local global [1007 x [1007 x i64]], align 16
@_ZSt3cin = external global %"class.std::basic_istream", align 8
@_ZSt4cout = external global %"class.std::basic_ostream", align 8
@.str = external hidden unnamed_addr constant [2 x i8], align 1

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z5solvev() #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 norecurse uwtable
define dso_local noundef i32 @main() #2 {
  %1 = alloca i32, align 4
  %2 = alloca i64, align 8
  %3 = alloca i32, align 4
  %4 = alloca i64, align 8
  %5 = alloca i64, align 8
  %6 = alloca i64, align 8
  %7 = alloca i64, align 8
  store i32 0, ptr %1, align 4
  %8 = call noundef zeroext i1 @_ZNSt8ios_base15sync_with_stdioEb(i1 noundef zeroext false)
  %9 = load ptr, ptr @_ZSt3cin, align 8, !tbaa !5
  %10 = getelementptr i8, ptr %9, i64 -24
  %11 = load i64, ptr %10, align 8
  %12 = getelementptr inbounds i8, ptr @_ZSt3cin, i64 %11
  %13 = call noundef ptr @_ZNSt9basic_iosIcSt11char_traitsIcEE3tieEPSo(ptr noundef nonnull align 8 dereferenceable(264) %12, ptr noundef null)
  %14 = load ptr, ptr @_ZSt4cout, align 8, !tbaa !5
  %15 = getelementptr i8, ptr %14, i64 -24
  %16 = load i64, ptr %15, align 8
  %17 = getelementptr inbounds i8, ptr @_ZSt4cout, i64 %16
  %18 = call noundef i64 @_ZNSt8ios_base9precisionEl(ptr noundef nonnull align 8 dereferenceable(216) %17, i64 noundef 20)
  %19 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERl(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) @h)
  %20 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERl(ptr noundef nonnull align 8 dereferenceable(16) %19, ptr noundef nonnull align 8 dereferenceable(8) @w)
  %21 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERl(ptr noundef nonnull align 8 dereferenceable(16) %20, ptr noundef nonnull align 8 dereferenceable(8) @c)
  call void @llvm.lifetime.start.p0(i64 8, ptr %2) #6
  store i64 0, ptr %2, align 8, !tbaa !8
  br label %22

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

26:                                               ; preds = %22
  store i32 2, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %2) #6
  br label %55

27:                                               ; preds = %22
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #6
  store i64 0, ptr %4, align 8, !tbaa !8
  br label %28

28:                                               ; preds = %48, %27
  %29 = load i64, ptr %4, align 8, !tbaa !8
  %30 = load i64, ptr @w, align 8, !tbaa !8
  %31 = icmp slt i64 %29, %30
  br i1 %31, label %33, label %32

32:                                               ; preds = %28
  store i32 5, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #6
  br label %51

33:                                               ; preds = %28
  %34 = load i64, ptr %2, align 8, !tbaa !8
  %35 = getelementptr inbounds [1007 x [1007 x i64]], ptr @a, i64 0, i64 %34
  %36 = load i64, ptr %4, align 8, !tbaa !8
  %37 = getelementptr inbounds [1007 x i64], ptr %35, i64 0, i64 %36
  %38 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERl(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) %37)
  %39 = load i64, ptr %2, align 8, !tbaa !8
  %40 = getelementptr inbounds [1007 x [1007 x i64]], ptr @a, i64 0, i64 %39
  %41 = load i64, ptr %4, align 8, !tbaa !8
  %42 = getelementptr inbounds [1007 x i64], ptr %40, i64 0, i64 %41
  %43 = load i64, ptr %42, align 8, !tbaa !8
  %44 = load i64, ptr %2, align 8, !tbaa !8
  %45 = getelementptr inbounds [1007 x [1007 x i64]], ptr @extra, i64 0, i64 %44
  %46 = load i64, ptr %4, align 8, !tbaa !8
  %47 = getelementptr inbounds [1007 x i64], ptr %45, i64 0, i64 %46
  store i64 %43, ptr %47, align 8, !tbaa !8
  br label %48

48:                                               ; preds = %33
  %49 = load i64, ptr %4, align 8, !tbaa !8
  %50 = add nsw i64 %49, 1
  store i64 %50, ptr %4, align 8, !tbaa !8
  br label %28, !llvm.loop !11

51:                                               ; preds = %32
  br label %52

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

55:                                               ; preds = %26
  call void @_Z5solvev()
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #6
  store i64 0, ptr %5, align 8, !tbaa !8
  br label %56

56:                                               ; preds = %83, %55
  %57 = load i64, ptr %5, align 8, !tbaa !8
  %58 = load i64, ptr @w, align 8, !tbaa !8
  %59 = icmp slt i64 %57, %58
  br i1 %59, label %61, label %60

60:                                               ; preds = %56
  store i32 8, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #6
  br label %86

61:                                               ; preds = %56
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #6
  store i64 0, ptr %6, align 8, !tbaa !8
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #6
  %62 = load i64, ptr @h, align 8, !tbaa !8
  %63 = sub nsw i64 %62, 1
  store i64 %63, ptr %7, align 8, !tbaa !8
  br label %64

64:                                               ; preds = %79, %61
  %65 = load i64, ptr %7, align 8, !tbaa !8
  %66 = icmp sge i64 %65, 0
  br i1 %66, label %68, label %67

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

68:                                               ; preds = %64
  %69 = load i64, ptr %7, align 8, !tbaa !8
  %70 = getelementptr inbounds [1007 x [1007 x i64]], ptr @extra, i64 0, i64 %69
  %71 = load i64, ptr %5, align 8, !tbaa !8
  %72 = getelementptr inbounds [1007 x i64], ptr %70, i64 0, i64 %71
  %73 = load i64, ptr %72, align 8, !tbaa !8
  %74 = load i64, ptr %5, align 8, !tbaa !8
  %75 = getelementptr inbounds [1007 x [1007 x i64]], ptr @a, i64 0, i64 %74
  %76 = load i64, ptr %6, align 8, !tbaa !8
  %77 = add nsw i64 %76, 1
  store i64 %77, ptr %6, align 8, !tbaa !8
  %78 = getelementptr inbounds [1007 x i64], ptr %75, i64 0, i64 %76
  store i64 %73, ptr %78, align 8, !tbaa !8
  br label %79

79:                                               ; preds = %68
  %80 = load i64, ptr %7, align 8, !tbaa !8
  %81 = add nsw i64 %80, -1
  store i64 %81, ptr %7, align 8, !tbaa !8
  br label %64, !llvm.loop !14

82:                                               ; preds = %67
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #6
  br label %83

83:                                               ; preds = %82
  %84 = load i64, ptr %5, align 8, !tbaa !8
  %85 = add nsw i64 %84, 1
  store i64 %85, ptr %5, align 8, !tbaa !8
  br label %56, !llvm.loop !15

86:                                               ; preds = %60
  call void @_Z5solvev()
  %87 = load i64, ptr @ans, align 8, !tbaa !8
  %88 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEl(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i64 noundef %87)
  %89 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) %88, ptr noundef @.str)
  ret i32 0
}

declare noundef zeroext i1 @_ZNSt8ios_base15sync_with_stdioEb(i1 noundef zeroext) #3

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i64 @_ZNSt8ios_base9precisionEl(ptr noundef nonnull align 8 dereferenceable(216), i64 noundef) #4 align 2

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

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

; Function Attrs: mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEl(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 = { 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 = !{!"vtable pointer", !7, i64 0}
!7 = !{!"Simple C++ TBAA"}
!8 = !{!9, !9, i64 0}
!9 = !{!"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}


; 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" }

@h = external dso_local global i64, align 8
@w = external dso_local global i64, align 8
@c = external dso_local global i64, align 8
@ans = external dso_local local_unnamed_addr global i64, align 8
@a = external dso_local global [1007 x [1007 x i64]], align 16
@extra = external dso_local local_unnamed_addr global [1007 x [1007 x i64]], align 16
@_ZSt3cin = external global %"class.std::basic_istream", align 8
@_ZSt4cout = external global %"class.std::basic_ostream", align 8
@.str = external hidden unnamed_addr constant [2 x i8], align 1

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

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #1 {
  %1 = tail call noundef zeroext i1 @_ZNSt8ios_base15sync_with_stdioEb(i1 noundef zeroext false)
  %2 = load ptr, ptr @_ZSt3cin, align 8, !tbaa !5
  %3 = getelementptr i8, ptr %2, i64 -24
  %4 = load i64, ptr %3, align 8
  %5 = getelementptr inbounds i8, ptr @_ZSt3cin, i64 %4
  %6 = tail call noundef ptr @_ZNSt9basic_iosIcSt11char_traitsIcEE3tieEPSo(ptr noundef nonnull align 8 dereferenceable(264) %5, ptr noundef null)
  %7 = load ptr, ptr @_ZSt4cout, align 8, !tbaa !5
  %8 = getelementptr i8, ptr %7, i64 -24
  %9 = load i64, ptr %8, align 8
  %10 = getelementptr inbounds i8, ptr @_ZSt4cout, i64 %9
  %11 = tail call noundef i64 @_ZNSt8ios_base9precisionEl(ptr noundef nonnull align 8 dereferenceable(216) %10, i64 noundef 20)
  %12 = tail call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERl(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) @h)
  %13 = tail call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERl(ptr noundef nonnull align 8 dereferenceable(16) %12, ptr noundef nonnull align 8 dereferenceable(8) @w)
  %14 = tail call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERl(ptr noundef nonnull align 8 dereferenceable(16) %13, ptr noundef nonnull align 8 dereferenceable(8) @c)
  %15 = load i64, ptr @h, align 8, !tbaa !8
  %16 = icmp sgt i64 %15, 0
  %17 = load i64, ptr @w, align 8
  %18 = icmp sgt i64 %17, 0
  %or.cond = select i1 %16, i1 %18, i1 false
  br i1 %or.cond, label %.preheader, label %._crit_edge24

.preheader:                                       ; preds = %0, %._crit_edge
  %19 = phi i64 [ %39, %._crit_edge ], [ %15, %0 ]
  %20 = phi i64 [ %40, %._crit_edge ], [ %17, %0 ]
  %.02123 = phi i64 [ %41, %._crit_edge ], [ 0, %0 ]
  %21 = icmp sgt i64 %20, 0
  br i1 %21, label %.lr.ph, label %._crit_edge

._crit_edge24:                                    ; preds = %._crit_edge, %0
  tail call void @_Z5solvev()
  %22 = load i64, ptr @w, align 8, !tbaa !8
  %23 = icmp sgt i64 %22, 0
  br i1 %23, label %.lr.ph32, label %._crit_edge33

.lr.ph32:                                         ; preds = %._crit_edge24
  %24 = load i64, ptr @h, align 8, !tbaa !8
  %25 = icmp sgt i64 %24, 0
  br i1 %25, label %.lr.ph28.us.preheader, label %._crit_edge33

.lr.ph28.us.preheader:                            ; preds = %.lr.ph32
  %xtraiter = and i64 %24, 1
  %26 = icmp eq i64 %24, 1
  %unroll_iter = and i64 %24, 9223372036854775806
  %lcmp.mod.not = icmp eq i64 %xtraiter, 0
  br label %.lr.ph28.us

.lr.ph28.us:                                      ; preds = %.lr.ph28.us.preheader, %._crit_edge29.us
  %.01930.us = phi i64 [ %38, %._crit_edge29.us ], [ 0, %.lr.ph28.us.preheader ]
  br i1 %26, label %._crit_edge29.us.unr-lcssa, label %.lr.ph28.us.new

.lr.ph28.us.new:                                  ; preds = %.lr.ph28.us, %.lr.ph28.us.new
  %.0.in26.us = phi i64 [ %.0.us.1, %.lr.ph28.us.new ], [ %24, %.lr.ph28.us ]
  %.01825.us = phi i64 [ %33, %.lr.ph28.us.new ], [ 0, %.lr.ph28.us ]
  %niter = phi i64 [ %niter.next.1, %.lr.ph28.us.new ], [ 0, %.lr.ph28.us ]
  %.0.us = add nsw i64 %.0.in26.us, -1
  %27 = getelementptr inbounds [1007 x [1007 x i64]], ptr @extra, i64 0, i64 %.0.us, i64 %.01930.us
  %28 = load i64, ptr %27, align 8, !tbaa !8
  %29 = or disjoint i64 %.01825.us, 1
  %30 = getelementptr inbounds [1007 x [1007 x i64]], ptr @a, i64 0, i64 %.01930.us, i64 %.01825.us
  store i64 %28, ptr %30, align 8, !tbaa !8
  %.0.us.1 = add nsw i64 %.0.in26.us, -2
  %31 = getelementptr inbounds [1007 x [1007 x i64]], ptr @extra, i64 0, i64 %.0.us.1, i64 %.01930.us
  %32 = load i64, ptr %31, align 8, !tbaa !8
  %33 = add nuw nsw i64 %.01825.us, 2
  %34 = getelementptr inbounds [1007 x [1007 x i64]], ptr @a, i64 0, i64 %.01930.us, i64 %29
  store i64 %32, ptr %34, align 8, !tbaa !8
  %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_edge29.us.unr-lcssa, label %.lr.ph28.us.new, !llvm.loop !11

._crit_edge29.us.unr-lcssa:                       ; preds = %.lr.ph28.us.new, %.lr.ph28.us
  %.0.in26.us.unr = phi i64 [ %24, %.lr.ph28.us ], [ %.0.us.1, %.lr.ph28.us.new ]
  %.01825.us.unr = phi i64 [ 0, %.lr.ph28.us ], [ %33, %.lr.ph28.us.new ]
  br i1 %lcmp.mod.not, label %._crit_edge29.us, label %._crit_edge29.us.epilog-lcssa

._crit_edge29.us.epilog-lcssa:                    ; preds = %._crit_edge29.us.unr-lcssa
  %.0.us.epil = add nsw i64 %.0.in26.us.unr, -1
  %35 = getelementptr inbounds [1007 x [1007 x i64]], ptr @extra, i64 0, i64 %.0.us.epil, i64 %.01930.us
  %36 = load i64, ptr %35, align 8, !tbaa !8
  %37 = getelementptr inbounds [1007 x [1007 x i64]], ptr @a, i64 0, i64 %.01930.us, i64 %.01825.us.unr
  store i64 %36, ptr %37, align 8, !tbaa !8
  br label %._crit_edge29.us

._crit_edge29.us:                                 ; preds = %._crit_edge29.us.unr-lcssa, %._crit_edge29.us.epilog-lcssa
  %38 = add nuw nsw i64 %.01930.us, 1
  %exitcond36.not = icmp eq i64 %38, %22
  br i1 %exitcond36.not, label %._crit_edge33, label %.lr.ph28.us, !llvm.loop !13

._crit_edge.loopexit:                             ; preds = %.lr.ph
  %.pre = load i64, ptr @h, align 8, !tbaa !8
  br label %._crit_edge

._crit_edge:                                      ; preds = %._crit_edge.loopexit, %.preheader
  %39 = phi i64 [ %.pre, %._crit_edge.loopexit ], [ %19, %.preheader ]
  %40 = phi i64 [ %48, %._crit_edge.loopexit ], [ %20, %.preheader ]
  %41 = add nuw nsw i64 %.02123, 1
  %42 = icmp slt i64 %41, %39
  br i1 %42, label %.preheader, label %._crit_edge24, !llvm.loop !14

.lr.ph:                                           ; preds = %.preheader, %.lr.ph
  %.02022 = phi i64 [ %47, %.lr.ph ], [ 0, %.preheader ]
  %43 = getelementptr inbounds [1007 x [1007 x i64]], ptr @a, i64 0, i64 %.02123, i64 %.02022
  %44 = tail call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERl(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) %43)
  %45 = load i64, ptr %43, align 8, !tbaa !8
  %46 = getelementptr inbounds [1007 x [1007 x i64]], ptr @extra, i64 0, i64 %.02123, i64 %.02022
  store i64 %45, ptr %46, align 8, !tbaa !8
  %47 = add nuw nsw i64 %.02022, 1
  %48 = load i64, ptr @w, align 8, !tbaa !8
  %49 = icmp slt i64 %47, %48
  br i1 %49, label %.lr.ph, label %._crit_edge.loopexit, !llvm.loop !16

._crit_edge33:                                    ; preds = %._crit_edge29.us, %.lr.ph32, %._crit_edge24
  tail call void @_Z5solvev()
  %50 = load i64, ptr @ans, align 8, !tbaa !8
  %51 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEl(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i64 noundef %50)
  %52 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) %51, ptr noundef nonnull @.str)
  ret i32 0
}

declare noundef zeroext i1 @_ZNSt8ios_base15sync_with_stdioEb(i1 noundef zeroext) local_unnamed_addr #2

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i64 @_ZNSt8ios_base9precisionEl(ptr noundef nonnull align 8 dereferenceable(216), i64 noundef) local_unnamed_addr #3 align 2

; Function Attrs: mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERl(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 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

; Function Attrs: mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEl(ptr noundef nonnull align 8 dereferenceable(8), i64 noundef) local_unnamed_addr #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 = { 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 #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 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 #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" }

!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", !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}
!15 = !{!"llvm.loop.unswitch.partial.disable"}
!16 = distinct !{!16, !12}


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