; LLVM IR from eyangch/competitive-programming :: Codeforces/1764/f.ll (Z3dfsx)

; 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::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<edge, std::allocator<edge>>::_Vector_impl" }
%"struct.std::_Vector_base<edge, std::allocator<edge>>::_Vector_impl" = type { %"struct.std::_Vector_base<edge, std::allocator<edge>>::_Vector_impl_data" }
%"struct.std::_Vector_base<edge, std::allocator<edge>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%struct.edge = type { i64, i64, i64 }

@N = external dso_local global i64, align 8
@F = external dso_local global [2000 x [2000 x i64]], align 16
@desc = external dso_local global [2000 x [2000 x i8]], align 16
@ans = external dso_local global %"class.std::vector", align 8
@.str = external hidden unnamed_addr constant [19 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [87 x i8], align 1
@__PRETTY_FUNCTION__._Z3dfsx = external hidden unnamed_addr constant [20 x i8], align 1

; Function Attrs: mustprogress uwtable
define dso_local void @_Z3dfsx(i64 noundef %0) #0 {
  %2 = alloca i64, align 8
  %3 = alloca i64, align 8
  %4 = alloca i64, align 8
  %5 = alloca i64, align 8
  %6 = alloca i32, align 4
  %7 = alloca i64, align 8
  %8 = alloca i64, align 8
  %9 = alloca i64, align 8
  %10 = alloca %struct.edge, align 8
  %11 = alloca i64, align 8
  store i64 %0, ptr %2, align 8, !tbaa !5
  br label %12

12:                                               ; preds = %142, %1
  call void @llvm.lifetime.start.p0(i64 8, ptr %3) #3
  store i64 -1, ptr %3, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #3
  store i64 -1, ptr %4, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #3
  store i64 0, ptr %5, align 8, !tbaa !5
  br label %13

13:                                               ; preds = %42, %12
  %14 = load i64, ptr %5, align 8, !tbaa !5
  %15 = load i64, ptr @N, align 8, !tbaa !5
  %16 = icmp slt i64 %14, %15
  br i1 %16, label %18, label %17

17:                                               ; preds = %13
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #3
  br label %45

18:                                               ; preds = %13
  %19 = load i64, ptr %2, align 8, !tbaa !5
  %20 = getelementptr inbounds [2000 x [2000 x i8]], ptr @desc, i64 0, i64 %19
  %21 = load i64, ptr %5, align 8, !tbaa !5
  %22 = getelementptr inbounds [2000 x i8], ptr %20, i64 0, i64 %21
  %23 = load i8, ptr %22, align 1, !tbaa !9, !range !11, !noundef !12
  %24 = trunc i8 %23 to i1
  br i1 %24, label %25, label %41

25:                                               ; preds = %18
  %26 = load i64, ptr %2, align 8, !tbaa !5
  %27 = getelementptr inbounds [2000 x [2000 x i64]], ptr @F, i64 0, i64 %26
  %28 = load i64, ptr %5, align 8, !tbaa !5
  %29 = getelementptr inbounds [2000 x i64], ptr %27, i64 0, i64 %28
  %30 = load i64, ptr %29, align 8, !tbaa !5
  %31 = load i64, ptr %3, align 8, !tbaa !5
  %32 = icmp sgt i64 %30, %31
  br i1 %32, label %33, label %40

33:                                               ; preds = %25
  %34 = load i64, ptr %2, align 8, !tbaa !5
  %35 = getelementptr inbounds [2000 x [2000 x i64]], ptr @F, i64 0, i64 %34
  %36 = load i64, ptr %5, align 8, !tbaa !5
  %37 = getelementptr inbounds [2000 x i64], ptr %35, i64 0, i64 %36
  %38 = load i64, ptr %37, align 8, !tbaa !5
  store i64 %38, ptr %3, align 8, !tbaa !5
  %39 = load i64, ptr %5, align 8, !tbaa !5
  store i64 %39, ptr %4, align 8, !tbaa !5
  br label %40

40:                                               ; preds = %33, %25
  br label %41

41:                                               ; preds = %40, %18
  br label %42

42:                                               ; preds = %41
  %43 = load i64, ptr %5, align 8, !tbaa !5
  %44 = add nsw i64 %43, 1
  store i64 %44, ptr %5, align 8, !tbaa !5
  br label %13, !llvm.loop !13

45:                                               ; preds = %17
  %46 = load i64, ptr %4, align 8, !tbaa !5
  %47 = xor i64 %46, -1
  %48 = icmp ne i64 %47, 0
  br i1 %48, label %50, label %49

49:                                               ; preds = %45
  store i32 3, ptr %6, align 4
  br label %140

50:                                               ; preds = %45
  %51 = load i64, ptr %2, align 8, !tbaa !5
  %52 = getelementptr inbounds [2000 x [2000 x i8]], ptr @desc, i64 0, i64 %51
  %53 = load i64, ptr %4, align 8, !tbaa !5
  %54 = getelementptr inbounds [2000 x i8], ptr %52, i64 0, i64 %53
  store i8 0, ptr %54, align 1, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #3
  %55 = load i64, ptr %2, align 8, !tbaa !5
  %56 = getelementptr inbounds [2000 x [2000 x i64]], ptr @F, i64 0, i64 %55
  %57 = load i64, ptr %2, align 8, !tbaa !5
  %58 = getelementptr inbounds [2000 x i64], ptr %56, i64 0, i64 %57
  %59 = load i64, ptr %58, align 8, !tbaa !5
  %60 = load i64, ptr %2, align 8, !tbaa !5
  %61 = getelementptr inbounds [2000 x [2000 x i64]], ptr @F, i64 0, i64 %60
  %62 = load i64, ptr %4, align 8, !tbaa !5
  %63 = getelementptr inbounds [2000 x i64], ptr %61, i64 0, i64 %62
  %64 = load i64, ptr %63, align 8, !tbaa !5
  %65 = sub nsw i64 %59, %64
  store i64 %65, ptr %7, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #3
  %66 = load i64, ptr %4, align 8, !tbaa !5
  %67 = getelementptr inbounds [2000 x [2000 x i64]], ptr @F, i64 0, i64 %66
  %68 = load i64, ptr %4, align 8, !tbaa !5
  %69 = getelementptr inbounds [2000 x i64], ptr %67, i64 0, i64 %68
  %70 = load i64, ptr %69, align 8, !tbaa !5
  %71 = load i64, ptr %2, align 8, !tbaa !5
  %72 = getelementptr inbounds [2000 x [2000 x i64]], ptr @F, i64 0, i64 %71
  %73 = load i64, ptr %4, align 8, !tbaa !5
  %74 = getelementptr inbounds [2000 x i64], ptr %72, i64 0, i64 %73
  %75 = load i64, ptr %74, align 8, !tbaa !5
  %76 = sub nsw i64 %70, %75
  store i64 %76, ptr %8, align 8, !tbaa !5
  %77 = load i64, ptr %7, align 8, !tbaa !5
  %78 = load i64, ptr %8, align 8, !tbaa !5
  %79 = add nsw i64 %77, %78
  %80 = load i64, ptr @N, align 8, !tbaa !5
  %81 = srem i64 %79, %80
  %82 = icmp eq i64 %81, 0
  br i1 %82, label %83, label %84

83:                                               ; preds = %50
  br label %86

84:                                               ; preds = %50
  call void @__assert_fail(ptr noundef @.str, ptr noundef @.str.2, i32 noundef 32, ptr noundef @__PRETTY_FUNCTION__._Z3dfsx) #4
  unreachable

85:                                               ; No predecessors!
  br label %86

86:                                               ; preds = %85, %83
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #3
  %87 = load i64, ptr %7, align 8, !tbaa !5
  %88 = load i64, ptr %8, align 8, !tbaa !5
  %89 = add nsw i64 %87, %88
  %90 = load i64, ptr @N, align 8, !tbaa !5
  %91 = sdiv i64 %89, %90
  store i64 %91, ptr %9, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 24, ptr %10) #3
  %92 = getelementptr inbounds %struct.edge, ptr %10, i32 0, i32 0
  %93 = load i64, ptr %2, align 8, !tbaa !5
  %94 = add nsw i64 %93, 1
  store i64 %94, ptr %92, align 8, !tbaa !15
  %95 = getelementptr inbounds %struct.edge, ptr %10, i32 0, i32 1
  %96 = load i64, ptr %4, align 8, !tbaa !5
  %97 = add nsw i64 %96, 1
  store i64 %97, ptr %95, align 8, !tbaa !17
  %98 = getelementptr inbounds %struct.edge, ptr %10, i32 0, i32 2
  %99 = load i64, ptr %9, align 8, !tbaa !5
  store i64 %99, ptr %98, align 8, !tbaa !18
  call void @_ZNSt6vectorI4edgeSaIS0_EE9push_backEOS0_(ptr noundef nonnull align 8 dereferenceable(24) @ans, ptr noundef nonnull align 8 dereferenceable(24) %10)
  call void @llvm.lifetime.end.p0(i64 24, ptr %10) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #3
  store i64 0, ptr %11, align 8, !tbaa !5
  br label %100

100:                                              ; preds = %135, %86
  %101 = load i64, ptr %11, align 8, !tbaa !5
  %102 = load i64, ptr @N, align 8, !tbaa !5
  %103 = icmp slt i64 %101, %102
  br i1 %103, label %105, label %104

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

105:                                              ; preds = %100
  %106 = load i64, ptr %2, align 8, !tbaa !5
  %107 = getelementptr inbounds [2000 x [2000 x i8]], ptr @desc, i64 0, i64 %106
  %108 = load i64, ptr %11, align 8, !tbaa !5
  %109 = getelementptr inbounds [2000 x i8], ptr %107, i64 0, i64 %108
  %110 = load i8, ptr %109, align 1, !tbaa !9, !range !11, !noundef !12
  %111 = trunc i8 %110 to i1
  br i1 %111, label %112, label %134

112:                                              ; preds = %105
  %113 = load i64, ptr %2, align 8, !tbaa !5
  %114 = getelementptr inbounds [2000 x [2000 x i64]], ptr @F, i64 0, i64 %113
  %115 = load i64, ptr %11, align 8, !tbaa !5
  %116 = getelementptr inbounds [2000 x i64], ptr %114, i64 0, i64 %115
  %117 = load i64, ptr %116, align 8, !tbaa !5
  %118 = load i64, ptr %4, align 8, !tbaa !5
  %119 = getelementptr inbounds [2000 x [2000 x i64]], ptr @F, i64 0, i64 %118
  %120 = load i64, ptr %11, align 8, !tbaa !5
  %121 = getelementptr inbounds [2000 x i64], ptr %119, i64 0, i64 %120
  %122 = load i64, ptr %121, align 8, !tbaa !5
  %123 = icmp slt i64 %117, %122
  br i1 %123, label %124, label %133

124:                                              ; preds = %112
  %125 = load i64, ptr %4, align 8, !tbaa !5
  %126 = getelementptr inbounds [2000 x [2000 x i8]], ptr @desc, i64 0, i64 %125
  %127 = load i64, ptr %11, align 8, !tbaa !5
  %128 = getelementptr inbounds [2000 x i8], ptr %126, i64 0, i64 %127
  store i8 1, ptr %128, align 1, !tbaa !9
  %129 = load i64, ptr %2, align 8, !tbaa !5
  %130 = getelementptr inbounds [2000 x [2000 x i8]], ptr @desc, i64 0, i64 %129
  %131 = load i64, ptr %11, align 8, !tbaa !5
  %132 = getelementptr inbounds [2000 x i8], ptr %130, i64 0, i64 %131
  store i8 0, ptr %132, align 1, !tbaa !9
  br label %133

133:                                              ; preds = %124, %112
  br label %134

134:                                              ; preds = %133, %105
  br label %135

135:                                              ; preds = %134
  %136 = load i64, ptr %11, align 8, !tbaa !5
  %137 = add nsw i64 %136, 1
  store i64 %137, ptr %11, align 8, !tbaa !5
  br label %100, !llvm.loop !19

138:                                              ; preds = %104
  %139 = load i64, ptr %4, align 8, !tbaa !5
  call void @_Z3dfsx(i64 noundef %139)
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #3
  store i32 0, ptr %6, align 4
  br label %140

140:                                              ; preds = %138, %49
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %3) #3
  %141 = load i32, ptr %6, align 4
  switch i32 %141, label %144 [
    i32 0, label %142
    i32 3, label %143
  ]

142:                                              ; preds = %140
  br label %12, !llvm.loop !20

143:                                              ; preds = %140
  ret void

144:                                              ; preds = %140
  unreachable
}

; 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: noreturn nounwind
declare void @__assert_fail(ptr noundef, ptr noundef, i32 noundef, ptr noundef) #2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt6vectorI4edgeSaIS0_EE9push_backEOS0_(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 8 dereferenceable(24)) #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 = { noreturn nounwind "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 = { nounwind }
attributes #4 = { noreturn 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 = !{!"long long", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"bool", !7, i64 0}
!11 = !{i8 0, i8 2}
!12 = !{}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}
!15 = !{!16, !6, i64 0}
!16 = !{!"_ZTS4edge", !6, i64 0, !6, i64 8, !6, i64 16}
!17 = !{!16, !6, i64 8}
!18 = !{!16, !6, i64 16}
!19 = distinct !{!19, !14}
!20 = distinct !{!20, !14}


; 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::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<edge, std::allocator<edge>>::_Vector_impl" }
%"struct.std::_Vector_base<edge, std::allocator<edge>>::_Vector_impl" = type { %"struct.std::_Vector_base<edge, std::allocator<edge>>::_Vector_impl_data" }
%"struct.std::_Vector_base<edge, std::allocator<edge>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%struct.edge = type { i64, i64, i64 }

@N = external dso_local local_unnamed_addr global i64, align 8
@F = external dso_local local_unnamed_addr global [2000 x [2000 x i64]], align 16
@desc = external dso_local local_unnamed_addr global [2000 x [2000 x i8]], align 16
@ans = external dso_local global %"class.std::vector", align 8
@.str = external hidden unnamed_addr constant [19 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [87 x i8], align 1
@__PRETTY_FUNCTION__._Z3dfsx = external hidden unnamed_addr constant [20 x i8], align 1

; Function Attrs: mustprogress uwtable
define dso_local void @_Z3dfsx(i64 noundef %0) local_unnamed_addr #0 {
  %2 = alloca %struct.edge, align 8
  %3 = getelementptr inbounds [2000 x [2000 x i64]], ptr @F, i64 0, i64 %0, i64 %0
  %4 = add nsw i64 %0, 1
  %5 = getelementptr inbounds i8, ptr %2, i64 8
  %6 = getelementptr inbounds i8, ptr %2, i64 16
  %7 = load i64, ptr @N, align 8, !tbaa !5
  %8 = icmp sgt i64 %7, 0
  br i1 %8, label %.lr.ph.preheader, label %._crit_edge.thread

.lr.ph.preheader:                                 ; preds = %1, %._crit_edge58
  %9 = phi i64 [ %66, %._crit_edge58 ], [ %7, %1 ]
  %xtraiter = and i64 %9, 1
  %10 = icmp eq i64 %9, 1
  br i1 %10, label %._crit_edge.unr-lcssa, label %.lr.ph.preheader.new

.lr.ph.preheader.new:                             ; preds = %.lr.ph.preheader
  %unroll_iter = and i64 %9, 9223372036854775806
  br label %.lr.ph

._crit_edge.unr-lcssa:                            ; preds = %33, %.lr.ph.preheader
  %.144.lcssa.ph = phi i64 [ poison, %.lr.ph.preheader ], [ %.144.1, %33 ]
  %.04253.unr = phi i64 [ -1, %.lr.ph.preheader ], [ %.1.1, %33 ]
  %.04352.unr = phi i64 [ -1, %.lr.ph.preheader ], [ %.144.1, %33 ]
  %.04551.unr = phi i64 [ 0, %.lr.ph.preheader ], [ %34, %33 ]
  %lcmp.mod.not = icmp eq i64 %xtraiter, 0
  br i1 %lcmp.mod.not, label %._crit_edge, label %.lr.ph.epil

.lr.ph.epil:                                      ; preds = %._crit_edge.unr-lcssa
  %11 = getelementptr inbounds [2000 x [2000 x i8]], ptr @desc, i64 0, i64 %0, i64 %.04551.unr
  %12 = load i8, ptr %11, align 1, !tbaa !9, !range !11, !noundef !12
  %13 = trunc nuw i8 %12 to i1
  br i1 %13, label %14, label %._crit_edge

14:                                               ; preds = %.lr.ph.epil
  %15 = getelementptr inbounds [2000 x [2000 x i64]], ptr @F, i64 0, i64 %0, i64 %.04551.unr
  %16 = load i64, ptr %15, align 8, !tbaa !5
  %17 = icmp sgt i64 %16, %.04253.unr
  %spec.select.epil = select i1 %17, i64 %.04551.unr, i64 %.04352.unr
  br label %._crit_edge

._crit_edge:                                      ; preds = %.lr.ph.epil, %14, %._crit_edge.unr-lcssa
  %.144.lcssa = phi i64 [ %.144.lcssa.ph, %._crit_edge.unr-lcssa ], [ %.04352.unr, %.lr.ph.epil ], [ %spec.select.epil, %14 ]
  %.not = icmp eq i64 %.144.lcssa, -1
  br i1 %.not, label %._crit_edge.thread, label %35

.lr.ph:                                           ; preds = %33, %.lr.ph.preheader.new
  %.04253 = phi i64 [ -1, %.lr.ph.preheader.new ], [ %.1.1, %33 ]
  %.04352 = phi i64 [ -1, %.lr.ph.preheader.new ], [ %.144.1, %33 ]
  %.04551 = phi i64 [ 0, %.lr.ph.preheader.new ], [ %34, %33 ]
  %niter = phi i64 [ 0, %.lr.ph.preheader.new ], [ %niter.next.1, %33 ]
  %18 = getelementptr inbounds [2000 x [2000 x i8]], ptr @desc, i64 0, i64 %0, i64 %.04551
  %19 = load i8, ptr %18, align 2, !tbaa !9, !range !11, !noundef !12
  %20 = trunc nuw i8 %19 to i1
  br i1 %20, label %21, label %.lr.ph.1

21:                                               ; preds = %.lr.ph
  %22 = getelementptr inbounds [2000 x [2000 x i64]], ptr @F, i64 0, i64 %0, i64 %.04551
  %23 = load i64, ptr %22, align 16, !tbaa !5
  %24 = icmp sgt i64 %23, %.04253
  %spec.select = select i1 %24, i64 %.04551, i64 %.04352
  %spec.select48 = call i64 @llvm.smax.i64(i64 %23, i64 %.04253)
  br label %.lr.ph.1

.lr.ph.1:                                         ; preds = %21, %.lr.ph
  %.144 = phi i64 [ %.04352, %.lr.ph ], [ %spec.select, %21 ]
  %.1 = phi i64 [ %.04253, %.lr.ph ], [ %spec.select48, %21 ]
  %25 = or disjoint i64 %.04551, 1
  %26 = getelementptr inbounds [2000 x [2000 x i8]], ptr @desc, i64 0, i64 %0, i64 %25
  %27 = load i8, ptr %26, align 1, !tbaa !9, !range !11, !noundef !12
  %28 = trunc nuw i8 %27 to i1
  br i1 %28, label %29, label %33

29:                                               ; preds = %.lr.ph.1
  %30 = getelementptr inbounds [2000 x [2000 x i64]], ptr @F, i64 0, i64 %0, i64 %25
  %31 = load i64, ptr %30, align 8, !tbaa !5
  %32 = icmp sgt i64 %31, %.1
  %spec.select.1 = select i1 %32, i64 %25, i64 %.144
  %spec.select48.1 = call i64 @llvm.smax.i64(i64 %31, i64 %.1)
  br label %33

33:                                               ; preds = %29, %.lr.ph.1
  %.144.1 = phi i64 [ %.144, %.lr.ph.1 ], [ %spec.select.1, %29 ]
  %.1.1 = phi i64 [ %.1, %.lr.ph.1 ], [ %spec.select48.1, %29 ]
  %34 = add nuw nsw i64 %.04551, 2
  %niter.next.1 = add i64 %niter, 2
  %niter.ncmp.1 = icmp eq i64 %niter.next.1, %unroll_iter
  br i1 %niter.ncmp.1, label %._crit_edge.unr-lcssa, label %.lr.ph, !llvm.loop !13

35:                                               ; preds = %._crit_edge
  %36 = getelementptr inbounds [2000 x [2000 x i8]], ptr @desc, i64 0, i64 %0, i64 %.144.lcssa
  store i8 0, ptr %36, align 1, !tbaa !9
  %37 = load i64, ptr %3, align 8, !tbaa !5
  %38 = getelementptr inbounds [2000 x [2000 x i64]], ptr @F, i64 0, i64 %0, i64 %.144.lcssa
  %39 = load i64, ptr %38, align 8, !tbaa !5
  %40 = sub nsw i64 %37, %39
  %41 = getelementptr inbounds [2000 x [2000 x i64]], ptr @F, i64 0, i64 %.144.lcssa, i64 %.144.lcssa
  %42 = load i64, ptr %41, align 8, !tbaa !5
  %43 = sub nsw i64 %42, %39
  %44 = add nsw i64 %43, %40
  %45 = srem i64 %44, %9
  %46 = sdiv i64 %44, %9
  %47 = icmp eq i64 %45, 0
  br i1 %47, label %49, label %48

48:                                               ; preds = %35
  call void @__assert_fail(ptr noundef nonnull @.str, ptr noundef nonnull @.str.2, i32 noundef 32, ptr noundef nonnull @__PRETTY_FUNCTION__._Z3dfsx) #4
  unreachable

49:                                               ; preds = %35
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %2) #5
  store i64 %4, ptr %2, align 8, !tbaa !15
  %50 = add nuw nsw i64 %.144.lcssa, 1
  store i64 %50, ptr %5, align 8, !tbaa !17
  store i64 %46, ptr %6, align 8, !tbaa !18
  call void @_ZNSt6vectorI4edgeSaIS0_EE9push_backEOS0_(ptr noundef nonnull align 8 dereferenceable(24) @ans, ptr noundef nonnull align 8 dereferenceable(24) %2)
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %2) #5
  %51 = load i64, ptr @N, align 8, !tbaa !5
  %52 = icmp sgt i64 %51, 0
  br i1 %52, label %.lr.ph57, label %._crit_edge58

.lr.ph57:                                         ; preds = %49, %64
  %.055 = phi i64 [ %65, %64 ], [ 0, %49 ]
  %53 = getelementptr inbounds [2000 x [2000 x i8]], ptr @desc, i64 0, i64 %0, i64 %.055
  %54 = load i8, ptr %53, align 1, !tbaa !9, !range !11, !noundef !12
  %55 = trunc nuw i8 %54 to i1
  br i1 %55, label %56, label %64

56:                                               ; preds = %.lr.ph57
  %57 = getelementptr inbounds [2000 x [2000 x i64]], ptr @F, i64 0, i64 %0, i64 %.055
  %58 = load i64, ptr %57, align 8, !tbaa !5
  %59 = getelementptr inbounds [2000 x [2000 x i64]], ptr @F, i64 0, i64 %.144.lcssa, i64 %.055
  %60 = load i64, ptr %59, align 8, !tbaa !5
  %61 = icmp slt i64 %58, %60
  br i1 %61, label %62, label %64

62:                                               ; preds = %56
  %63 = getelementptr inbounds [2000 x [2000 x i8]], ptr @desc, i64 0, i64 %.144.lcssa, i64 %.055
  store i8 1, ptr %63, align 1, !tbaa !9
  store i8 0, ptr %53, align 1, !tbaa !9
  br label %64

64:                                               ; preds = %.lr.ph57, %62, %56
  %65 = add nuw nsw i64 %.055, 1
  %exitcond59.not = icmp eq i64 %65, %51
  br i1 %exitcond59.not, label %._crit_edge58, label %.lr.ph57, !llvm.loop !19

._crit_edge58:                                    ; preds = %64, %49
  call void @_Z3dfsx(i64 noundef %.144.lcssa)
  %66 = load i64, ptr @N, align 8, !tbaa !5
  %67 = icmp sgt i64 %66, 0
  br i1 %67, label %.lr.ph.preheader, label %._crit_edge.thread

._crit_edge.thread:                               ; preds = %._crit_edge, %._crit_edge58, %1
  ret void
}

; 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: noreturn nounwind
declare void @__assert_fail(ptr noundef, ptr noundef, i32 noundef, ptr noundef) local_unnamed_addr #2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt6vectorI4edgeSaIS0_EE9push_backEOS0_(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 8 dereferenceable(24)) local_unnamed_addr #0 align 2

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.smax.i64(i64, i64) #3

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


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