; LLVM IR from eyangch/competitive-programming :: Codeforces/1541 (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::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<long long, std::allocator<long long>>::_Vector_impl" }
%"struct.std::_Vector_base<long long, std::allocator<long long>>::_Vector_impl" = type { %"struct.std::_Vector_base<long long, std::allocator<long long>>::_Vector_impl_data" }
%"struct.std::_Vector_base<long long, std::allocator<long long>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"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" }

@MOD = external dso_local global i64, align 8
@N = external dso_local global i64, align 8
@up = external dso_local global [10 x [200 x i64]], align 16
@de = external dso_local global [200 x i64], align 16
@dp = external dso_local global [200 x [200 x i64]], align 16
@inv2 = external dso_local global i64, align 8
@invn = external dso_local global i64, align 8
@graph = external dso_local global [200 x %"class.std::vector"], align 16
@_ZSt3cin = external global %"class.std::basic_istream", align 8
@_ZSt4cout = external global %"class.std::basic_ostream", align 8

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z3dfsxxx(i64 noundef, i64 noundef, i64 noundef) #0

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i64 @_Z3lcaxx(i64 noundef, i64 noundef) #2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i64 @_Z3invx(i64 noundef) #2

; Function Attrs: mustprogress uwtable
declare dso_local noundef i64 @_Z3dpfxx(i64 noundef, i64 noundef) #0

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

26:                                               ; preds = %45, %0
  %27 = load i64, ptr %2, align 8, !tbaa !8
  %28 = load i64, ptr @N, align 8, !tbaa !8
  %29 = sub nsw i64 %28, 1
  %30 = icmp slt i64 %27, %29
  br i1 %30, label %32, label %31

31:                                               ; preds = %26
  call void @llvm.lifetime.end.p0(i64 8, ptr %2) #6
  br label %48

32:                                               ; preds = %26
  call void @llvm.lifetime.start.p0(i64 8, ptr %3) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #6
  %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) %3)
  %34 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) %33, ptr noundef nonnull align 8 dereferenceable(8) %4)
  %35 = load i64, ptr %3, align 8, !tbaa !8
  %36 = sub nsw i64 %35, 1
  %37 = getelementptr inbounds [200 x %"class.std::vector"], ptr @graph, i64 0, i64 %36
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #6
  %38 = load i64, ptr %4, align 8, !tbaa !8
  %39 = sub nsw i64 %38, 1
  store i64 %39, ptr %5, align 8, !tbaa !8
  call void @_ZNSt6vectorIxSaIxEE9push_backEOx(ptr noundef nonnull align 8 dereferenceable(24) %37, ptr noundef nonnull align 8 dereferenceable(8) %5)
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #6
  %40 = load i64, ptr %4, align 8, !tbaa !8
  %41 = sub nsw i64 %40, 1
  %42 = getelementptr inbounds [200 x %"class.std::vector"], ptr @graph, i64 0, i64 %41
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #6
  %43 = load i64, ptr %3, align 8, !tbaa !8
  %44 = sub nsw i64 %43, 1
  store i64 %44, ptr %6, align 8, !tbaa !8
  call void @_ZNSt6vectorIxSaIxEE9push_backEOx(ptr noundef nonnull align 8 dereferenceable(24) %42, ptr noundef nonnull align 8 dereferenceable(8) %6)
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %3) #6
  br label %45

45:                                               ; preds = %32
  %46 = load i64, ptr %2, align 8, !tbaa !8
  %47 = add nsw i64 %46, 1
  store i64 %47, ptr %2, align 8, !tbaa !8
  br label %26, !llvm.loop !11

48:                                               ; preds = %31
  %49 = load i64, ptr @N, align 8, !tbaa !8
  %50 = getelementptr inbounds i64, ptr @dp, i64 %49
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #6
  store i32 1, ptr %7, align 4, !tbaa !13
  call void @_ZSt4fillIPxiEvT_S1_RKT0_(ptr noundef @dp, ptr noundef %50, ptr noundef nonnull align 4 dereferenceable(4) %7)
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #6
  store i64 1, ptr %8, align 8, !tbaa !8
  br label %51

51:                                               ; preds = %66, %48
  %52 = load i64, ptr %8, align 8, !tbaa !8
  %53 = load i64, ptr @N, align 8, !tbaa !8
  %54 = icmp slt i64 %52, %53
  br i1 %54, label %56, label %55

55:                                               ; preds = %51
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #6
  br label %69

56:                                               ; preds = %51
  %57 = load i64, ptr %8, align 8, !tbaa !8
  %58 = getelementptr inbounds [200 x [200 x i64]], ptr @dp, i64 0, i64 %57
  %59 = getelementptr inbounds [200 x i64], ptr %58, i64 0, i64 0
  %60 = getelementptr inbounds i64, ptr %59, i64 1
  %61 = load i64, ptr %8, align 8, !tbaa !8
  %62 = getelementptr inbounds [200 x [200 x i64]], ptr @dp, i64 0, i64 %61
  %63 = getelementptr inbounds [200 x i64], ptr %62, i64 0, i64 0
  %64 = load i64, ptr @N, align 8, !tbaa !8
  %65 = getelementptr inbounds i64, ptr %63, i64 %64
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #6
  store i32 -1, ptr %9, align 4, !tbaa !13
  call void @_ZSt4fillIPxiEvT_S1_RKT0_(ptr noundef %60, ptr noundef %65, ptr noundef nonnull align 4 dereferenceable(4) %9)
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #6
  br label %66

66:                                               ; preds = %56
  %67 = load i64, ptr %8, align 8, !tbaa !8
  %68 = add nsw i64 %67, 1
  store i64 %68, ptr %8, align 8, !tbaa !8
  br label %51, !llvm.loop !15

69:                                               ; preds = %55
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #6
  store i64 0, ptr %10, align 8, !tbaa !8
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #6
  store i64 0, ptr %11, align 8, !tbaa !8
  br label %70

70:                                               ; preds = %126, %69
  %71 = load i64, ptr %11, align 8, !tbaa !8
  %72 = load i64, ptr @N, align 8, !tbaa !8
  %73 = icmp slt i64 %71, %72
  br i1 %73, label %75, label %74

74:                                               ; preds = %70
  store i32 8, ptr %12, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #6
  br label %129

75:                                               ; preds = %70
  %76 = load i64, ptr %11, align 8, !tbaa !8
  %77 = getelementptr inbounds [200 x i64], ptr @de, i64 0, i64 %76
  store i64 0, ptr %77, align 8, !tbaa !8
  %78 = load i64, ptr %11, align 8, !tbaa !8
  %79 = load i64, ptr %11, align 8, !tbaa !8
  %80 = getelementptr inbounds [200 x i64], ptr @up, i64 0, i64 %79
  store i64 %78, ptr %80, align 8, !tbaa !8
  %81 = load i64, ptr %11, align 8, !tbaa !8
  call void @_Z3dfsxxx(i64 noundef %81, i64 noundef -1, i64 noundef 0)
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #6
  store i64 0, ptr %13, align 8, !tbaa !8
  br label %82

82:                                               ; preds = %122, %75
  %83 = load i64, ptr %13, align 8, !tbaa !8
  %84 = load i64, ptr @N, align 8, !tbaa !8
  %85 = icmp slt i64 %83, %84
  br i1 %85, label %87, label %86

86:                                               ; preds = %82
  store i32 11, ptr %12, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #6
  br label %125

87:                                               ; preds = %82
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #6
  %88 = load i64, ptr %13, align 8, !tbaa !8
  %89 = add nsw i64 %88, 1
  store i64 %89, ptr %14, align 8, !tbaa !8
  br label %90

90:                                               ; preds = %118, %87
  %91 = load i64, ptr %14, align 8, !tbaa !8
  %92 = load i64, ptr @N, align 8, !tbaa !8
  %93 = icmp slt i64 %91, %92
  br i1 %93, label %95, label %94

94:                                               ; preds = %90
  store i32 14, ptr %12, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #6
  br label %121

95:                                               ; preds = %90
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #6
  %96 = load i64, ptr %13, align 8, !tbaa !8
  %97 = load i64, ptr %14, align 8, !tbaa !8
  %98 = call noundef i64 @_Z3lcaxx(i64 noundef %96, i64 noundef %97)
  store i64 %98, ptr %15, align 8, !tbaa !8
  %99 = load i64, ptr %10, align 8, !tbaa !8
  %100 = load i64, ptr %14, align 8, !tbaa !8
  %101 = getelementptr inbounds [200 x i64], ptr @de, i64 0, i64 %100
  %102 = load i64, ptr %101, align 8, !tbaa !8
  %103 = load i64, ptr %15, align 8, !tbaa !8
  %104 = getelementptr inbounds [200 x i64], ptr @de, i64 0, i64 %103
  %105 = load i64, ptr %104, align 8, !tbaa !8
  %106 = sub nsw i64 %102, %105
  %107 = load i64, ptr %13, align 8, !tbaa !8
  %108 = getelementptr inbounds [200 x i64], ptr @de, i64 0, i64 %107
  %109 = load i64, ptr %108, align 8, !tbaa !8
  %110 = load i64, ptr %15, align 8, !tbaa !8
  %111 = getelementptr inbounds [200 x i64], ptr @de, i64 0, i64 %110
  %112 = load i64, ptr %111, align 8, !tbaa !8
  %113 = sub nsw i64 %109, %112
  %114 = call noundef i64 @_Z3dpfxx(i64 noundef %106, i64 noundef %113)
  %115 = add nsw i64 %99, %114
  %116 = load i64, ptr @MOD, align 8, !tbaa !8
  %117 = srem i64 %115, %116
  store i64 %117, ptr %10, align 8, !tbaa !8
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #6
  br label %118

118:                                              ; preds = %95
  %119 = load i64, ptr %14, align 8, !tbaa !8
  %120 = add nsw i64 %119, 1
  store i64 %120, ptr %14, align 8, !tbaa !8
  br label %90, !llvm.loop !16

121:                                              ; preds = %94
  br label %122

122:                                              ; preds = %121
  %123 = load i64, ptr %13, align 8, !tbaa !8
  %124 = add nsw i64 %123, 1
  store i64 %124, ptr %13, align 8, !tbaa !8
  br label %82, !llvm.loop !17

125:                                              ; preds = %86
  br label %126

126:                                              ; preds = %125
  %127 = load i64, ptr %11, align 8, !tbaa !8
  %128 = add nsw i64 %127, 1
  store i64 %128, ptr %11, align 8, !tbaa !8
  br label %70, !llvm.loop !18

129:                                              ; preds = %74
  %130 = load i64, ptr %10, align 8, !tbaa !8
  %131 = load i64, ptr @invn, align 8, !tbaa !8
  %132 = mul nsw i64 %130, %131
  %133 = load i64, ptr @MOD, align 8, !tbaa !8
  %134 = srem i64 %132, %133
  %135 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i64 noundef %134)
  %136 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c(ptr noundef nonnull align 8 dereferenceable(8) %135, i8 noundef signext 10)
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #6
  %137 = load i32, ptr %1, align 4
  ret i32 %137
}

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

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

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

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

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZSt4fillIPxiEvT_S1_RKT0_(ptr noundef, ptr noundef, ptr noundef nonnull align 4 dereferenceable(4)) #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) #5

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

attributes #0 = { mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { mustprogress 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 #3 = { 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 #4 = { "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 long", !10, i64 0}
!10 = !{!"omnipotent char", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = !{!14, !14, i64 0}
!14 = !{!"int", !10, i64 0}
!15 = distinct !{!15, !12}
!16 = distinct !{!16, !12}
!17 = distinct !{!17, !12}
!18 = distinct !{!18, !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::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<long long, std::allocator<long long>>::_Vector_impl" }
%"struct.std::_Vector_base<long long, std::allocator<long long>>::_Vector_impl" = type { %"struct.std::_Vector_base<long long, std::allocator<long long>>::_Vector_impl_data" }
%"struct.std::_Vector_base<long long, std::allocator<long long>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"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" }

@MOD = external dso_local local_unnamed_addr global i64, align 8
@N = external dso_local global i64, align 8
@up = external dso_local local_unnamed_addr global [10 x [200 x i64]], align 16
@de = external dso_local local_unnamed_addr global [200 x i64], align 16
@dp = external dso_local global [200 x [200 x i64]], align 16
@inv2 = external dso_local local_unnamed_addr global i64, align 8
@invn = external dso_local local_unnamed_addr global i64, align 8
@graph = external dso_local global [200 x %"class.std::vector"], align 16
@_ZSt3cin = external global %"class.std::basic_istream", align 8
@_ZSt4cout = external global %"class.std::basic_ostream", align 8

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z3dfsxxx(i64 noundef, i64 noundef, i64 noundef) local_unnamed_addr #0

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i64 @_Z3lcaxx(i64 noundef, i64 noundef) local_unnamed_addr #2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i64 @_Z3invx(i64 noundef) local_unnamed_addr #2

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

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #3 {
  %1 = alloca i64, align 8
  %2 = alloca i64, align 8
  %3 = alloca i64, align 8
  %4 = alloca i64, align 8
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  %7 = load ptr, ptr @_ZSt3cin, align 8, !tbaa !5
  %8 = getelementptr i8, ptr %7, i64 -24
  %9 = load i64, ptr %8, align 8
  %10 = getelementptr inbounds i8, ptr @_ZSt3cin, i64 %9
  %11 = tail call noundef ptr @_ZNSt9basic_iosIcSt11char_traitsIcEE3tieEPSo(ptr noundef nonnull align 8 dereferenceable(264) %10, ptr noundef null)
  %12 = tail call noundef zeroext i1 @_ZNSt8ios_base15sync_with_stdioEb(i1 noundef zeroext false)
  %13 = 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)
  %14 = tail call noundef i64 @_Z3invx(i64 noundef 2)
  store i64 %14, ptr @inv2, align 8, !tbaa !8
  %15 = load i64, ptr @N, align 8, !tbaa !8
  %16 = tail call noundef i64 @_Z3invx(i64 noundef %15)
  store i64 %16, ptr @invn, align 8, !tbaa !8
  %17 = load i64, ptr @N, align 8, !tbaa !8
  %18 = icmp sgt i64 %17, 1
  br i1 %18, label %.lr.ph, label %._crit_edge

._crit_edge:                                      ; preds = %.lr.ph, %0
  %.lcssa = phi i64 [ %17, %0 ], [ %35, %.lr.ph ]
  %19 = getelementptr inbounds i64, ptr @dp, i64 %.lcssa
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %5) #6
  store i32 1, ptr %5, align 4, !tbaa !11
  call void @_ZSt4fillIPxiEvT_S1_RKT0_(ptr noundef nonnull @dp, ptr noundef nonnull %19, ptr noundef nonnull align 4 dereferenceable(4) %5)
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %5) #6
  %20 = load i64, ptr @N, align 8, !tbaa !8
  %21 = icmp sgt i64 %20, 1
  br i1 %21, label %.lr.ph35, label %.preheader

.lr.ph:                                           ; preds = %0, %.lr.ph
  %.032 = phi i64 [ %34, %.lr.ph ], [ 0, %0 ]
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %1) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %2) #6
  %22 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) %1)
  %23 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) %22, ptr noundef nonnull align 8 dereferenceable(8) %2)
  %24 = load i64, ptr %1, align 8, !tbaa !8
  %25 = add nsw i64 %24, -1
  %26 = getelementptr inbounds [200 x %"class.std::vector"], ptr @graph, i64 0, i64 %25
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %3) #6
  %27 = load i64, ptr %2, align 8, !tbaa !8
  %28 = add nsw i64 %27, -1
  store i64 %28, ptr %3, align 8, !tbaa !8
  call void @_ZNSt6vectorIxSaIxEE9push_backEOx(ptr noundef nonnull align 8 dereferenceable(24) %26, ptr noundef nonnull align 8 dereferenceable(8) %3)
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %3) #6
  %29 = load i64, ptr %2, align 8, !tbaa !8
  %30 = add nsw i64 %29, -1
  %31 = getelementptr inbounds [200 x %"class.std::vector"], ptr @graph, i64 0, i64 %30
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %4) #6
  %32 = load i64, ptr %1, align 8, !tbaa !8
  %33 = add nsw i64 %32, -1
  store i64 %33, ptr %4, align 8, !tbaa !8
  call void @_ZNSt6vectorIxSaIxEE9push_backEOx(ptr noundef nonnull align 8 dereferenceable(24) %31, ptr noundef nonnull align 8 dereferenceable(8) %4)
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %2) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %1) #6
  %34 = add nuw nsw i64 %.032, 1
  %35 = load i64, ptr @N, align 8, !tbaa !8
  %36 = add nsw i64 %35, -1
  %37 = icmp slt i64 %34, %36
  br i1 %37, label %.lr.ph, label %._crit_edge, !llvm.loop !13

.preheader:                                       ; preds = %.lr.ph35, %._crit_edge
  %38 = phi i64 [ %20, %._crit_edge ], [ %45, %.lr.ph35 ]
  %39 = icmp sgt i64 %38, 0
  br i1 %39, label %.lr.ph49, label %._crit_edge50

.lr.ph35:                                         ; preds = %._crit_edge, %.lr.ph35
  %40 = phi i64 [ %45, %.lr.ph35 ], [ %20, %._crit_edge ]
  %.03033 = phi i64 [ %44, %.lr.ph35 ], [ 1, %._crit_edge ]
  %41 = getelementptr inbounds [200 x [200 x i64]], ptr @dp, i64 0, i64 %.03033
  %42 = getelementptr inbounds i8, ptr %41, i64 8
  %43 = getelementptr inbounds i64, ptr %41, i64 %40
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %6) #6
  store i32 -1, ptr %6, align 4, !tbaa !11
  call void @_ZSt4fillIPxiEvT_S1_RKT0_(ptr noundef nonnull %42, ptr noundef nonnull %43, ptr noundef nonnull align 4 dereferenceable(4) %6)
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %6) #6
  %44 = add nuw nsw i64 %.03033, 1
  %45 = load i64, ptr @N, align 8, !tbaa !8
  %46 = icmp slt i64 %44, %45
  br i1 %46, label %.lr.ph35, label %.preheader, !llvm.loop !15

._crit_edge50:                                    ; preds = %._crit_edge45, %.preheader
  %.029.lcssa = phi i64 [ 0, %.preheader ], [ %.1.lcssa, %._crit_edge45 ]
  %47 = load i64, ptr @invn, align 8, !tbaa !8
  %48 = mul nsw i64 %47, %.029.lcssa
  %49 = load i64, ptr @MOD, align 8, !tbaa !8
  %50 = srem i64 %48, %49
  %51 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i64 noundef %50)
  %52 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c(ptr noundef nonnull align 8 dereferenceable(8) %51, i8 noundef signext 10)
  ret i32 0

.lr.ph49:                                         ; preds = %.preheader, %._crit_edge45
  %.02848 = phi i64 [ %60, %._crit_edge45 ], [ 0, %.preheader ]
  %.02947 = phi i64 [ %.1.lcssa, %._crit_edge45 ], [ 0, %.preheader ]
  %53 = getelementptr inbounds [200 x i64], ptr @de, i64 0, i64 %.02848
  store i64 0, ptr %53, align 8, !tbaa !8
  %54 = getelementptr inbounds [200 x i64], ptr @up, i64 0, i64 %.02848
  store i64 %.02848, ptr %54, align 8, !tbaa !8
  call void @_Z3dfsxxx(i64 noundef %.02848, i64 noundef -1, i64 noundef 0)
  %55 = load i64, ptr @N, align 8, !tbaa !8
  %56 = icmp sgt i64 %55, 0
  br i1 %56, label %.lr.ph44, label %._crit_edge45

.loopexit:                                        ; preds = %66, %.lr.ph44
  %57 = phi i64 [ %62, %.lr.ph44 ], [ %80, %66 ]
  %.2.lcssa = phi i64 [ %.141, %.lr.ph44 ], [ %78, %66 ]
  %58 = icmp slt i64 %63, %57
  br i1 %58, label %.lr.ph44, label %._crit_edge45, !llvm.loop !16

._crit_edge45:                                    ; preds = %.loopexit, %.lr.ph49
  %59 = phi i64 [ %55, %.lr.ph49 ], [ %57, %.loopexit ]
  %.1.lcssa = phi i64 [ %.02947, %.lr.ph49 ], [ %.2.lcssa, %.loopexit ]
  %60 = add nuw nsw i64 %.02848, 1
  %61 = icmp slt i64 %60, %59
  br i1 %61, label %.lr.ph49, label %._crit_edge50, !llvm.loop !17

.lr.ph44:                                         ; preds = %.lr.ph49, %.loopexit
  %62 = phi i64 [ %57, %.loopexit ], [ %55, %.lr.ph49 ]
  %.02742 = phi i64 [ %63, %.loopexit ], [ 0, %.lr.ph49 ]
  %.141 = phi i64 [ %.2.lcssa, %.loopexit ], [ %.02947, %.lr.ph49 ]
  %63 = add nuw nsw i64 %.02742, 1
  %64 = icmp slt i64 %63, %62
  br i1 %64, label %.lr.ph39, label %.loopexit

.lr.ph39:                                         ; preds = %.lr.ph44
  %65 = getelementptr inbounds [200 x i64], ptr @de, i64 0, i64 %.02742
  br label %66

66:                                               ; preds = %.lr.ph39, %66
  %.02637 = phi i64 [ %63, %.lr.ph39 ], [ %79, %66 ]
  %.236 = phi i64 [ %.141, %.lr.ph39 ], [ %78, %66 ]
  %67 = call noundef i64 @_Z3lcaxx(i64 noundef %.02742, i64 noundef %.02637)
  %68 = getelementptr inbounds [200 x i64], ptr @de, i64 0, i64 %.02637
  %69 = load i64, ptr %68, align 8, !tbaa !8
  %70 = getelementptr inbounds [200 x i64], ptr @de, i64 0, i64 %67
  %71 = load i64, ptr %70, align 8, !tbaa !8
  %72 = sub nsw i64 %69, %71
  %73 = load i64, ptr %65, align 8, !tbaa !8
  %74 = sub nsw i64 %73, %71
  %75 = call noundef i64 @_Z3dpfxx(i64 noundef %72, i64 noundef %74)
  %76 = add nsw i64 %75, %.236
  %77 = load i64, ptr @MOD, align 8, !tbaa !8
  %78 = srem i64 %76, %77
  %79 = add nuw nsw i64 %.02637, 1
  %80 = load i64, ptr @N, align 8, !tbaa !8
  %81 = icmp slt i64 %79, %80
  br i1 %81, label %66, label %.loopexit, !llvm.loop !18
}

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

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

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

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

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZSt4fillIPxiEvT_S1_RKT0_(ptr noundef, ptr noundef, ptr noundef nonnull align 4 dereferenceable(4)) local_unnamed_addr #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 #5

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

attributes #0 = { mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { mustprogress 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 #3 = { 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 #4 = { "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 long", !10, i64 0}
!10 = !{!"omnipotent char", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"int", !10, i64 0}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}
!15 = distinct !{!15, !14}
!16 = distinct !{!16, !14}
!17 = distinct !{!17, !14}
!18 = distinct !{!18, !14}


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