; LLVM IR from bqi343/cp-notebook :: Contests/USACO Solutions/2008-09 (damage2)

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

%struct.Dinic = type { [6005 x %"class.std::vector"], [6005 x i32], [6005 x i32] }
%"class.std::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<Dinic<6005>::Edge, std::allocator<Dinic<6005>::Edge>>::_Vector_impl" }
%"struct.std::_Vector_base<Dinic<6005>::Edge, std::allocator<Dinic<6005>::Edge>>::_Vector_impl" = type { %"struct.std::_Vector_base<Dinic<6005>::Edge, std::allocator<Dinic<6005>::Edge>>::_Vector_impl_data" }
%"struct.std::_Vector_base<Dinic<6005>::Edge, std::allocator<Dinic<6005>::Edge>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.std::__cxx11::basic_string" = type { %"struct.std::__cxx11::basic_string<char>::_Alloc_hider", i64, %union.anon }
%"struct.std::__cxx11::basic_string<char>::_Alloc_hider" = type { ptr }
%union.anon = type { i64, [8 x i8] }
%"class.std::allocator" = type { i8 }

@P = external dso_local global i32, align 4
@C = external dso_local global i32, align 4
@N = external dso_local global i32, align 4
@D = external dso_local global %struct.Dinic, align 8
@done = external dso_local global [3001 x i8], align 16
@.str.6 = external hidden unnamed_addr constant [8 x i8], align 1

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN2io5setIOENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE(ptr noundef) #0

declare i32 @__gxx_personality_v0(...)

; Function Attrs: mustprogress nounwind uwtable
declare void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32)) unnamed_addr #1 align 2

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

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

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() #3 personality ptr @__gxx_personality_v0 {
  %1 = alloca i32, align 4
  %2 = alloca %"class.std::__cxx11::basic_string", align 8
  %3 = alloca %"class.std::allocator", align 1
  %4 = alloca ptr, align 8
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  %12 = alloca i64, align 8
  store i32 0, ptr %1, align 4
  call void @llvm.lifetime.start.p0(i64 1, ptr %3) #4
  call void @_ZNSaIcEC2Ev(ptr noundef nonnull align 1 dereferenceable(1) %3) #4
  invoke void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEPKcRKS3_(ptr noundef nonnull align 8 dereferenceable(32) %2, ptr noundef @.str.6, ptr noundef nonnull align 1 dereferenceable(1) %3)
          to label %13 unwind label %20

13:                                               ; preds = %0
  invoke void @_ZN2io5setIOENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE(ptr noundef %2)
          to label %14 unwind label %24

14:                                               ; preds = %13
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %2) #4
  call void @_ZNSt15__new_allocatorIcED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %3) #4
  call void @llvm.lifetime.end.p0(i64 1, ptr %3) #4
  call void @_ZN2io2reIiJiiEEEvRT_DpRT0_(ptr noundef nonnull align 4 dereferenceable(4) @P, ptr noundef nonnull align 4 dereferenceable(4) @C, ptr noundef nonnull align 4 dereferenceable(4) @N)
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #4
  store i32 0, ptr %6, align 4, !tbaa !5
  br label %15

15:                                               ; preds = %40, %14
  %16 = load i32, ptr %6, align 4, !tbaa !5
  %17 = load i32, ptr @C, align 4, !tbaa !5
  %18 = icmp slt i32 %16, %17
  br i1 %18, label %29, label %19

19:                                               ; preds = %15
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #4
  br label %43

20:                                               ; preds = %0
  %21 = landingpad { ptr, i32 }
          cleanup
  %22 = extractvalue { ptr, i32 } %21, 0
  store ptr %22, ptr %4, align 8
  %23 = extractvalue { ptr, i32 } %21, 1
  store i32 %23, ptr %5, align 4
  br label %28

24:                                               ; preds = %13
  %25 = landingpad { ptr, i32 }
          cleanup
  %26 = extractvalue { ptr, i32 } %25, 0
  store ptr %26, ptr %4, align 8
  %27 = extractvalue { ptr, i32 } %25, 1
  store i32 %27, ptr %5, align 4
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %2) #4
  br label %28

28:                                               ; preds = %24, %20
  call void @_ZNSt15__new_allocatorIcED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %3) #4
  call void @llvm.lifetime.end.p0(i64 1, ptr %3) #4
  br label %96

29:                                               ; preds = %15
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #4
  call void @_ZN2io2reIiJiEEEvRT_DpRT0_(ptr noundef nonnull align 4 dereferenceable(4) %7, ptr noundef nonnull align 4 dereferenceable(4) %8)
  %30 = load i32, ptr %7, align 4, !tbaa !5
  %31 = mul nsw i32 2, %30
  %32 = add nsw i32 %31, 1
  %33 = load i32, ptr %8, align 4, !tbaa !5
  %34 = mul nsw i32 2, %33
  call void @_ZN5DinicILi6005EE7addEdgeEiix(ptr noundef nonnull align 8 dereferenceable(192160) @D, i32 noundef %32, i32 noundef %34, i64 noundef 1000000007)
  %35 = load i32, ptr %8, align 4, !tbaa !5
  %36 = mul nsw i32 2, %35
  %37 = add nsw i32 %36, 1
  %38 = load i32, ptr %7, align 4, !tbaa !5
  %39 = mul nsw i32 2, %38
  call void @_ZN5DinicILi6005EE7addEdgeEiix(ptr noundef nonnull align 8 dereferenceable(192160) @D, i32 noundef %37, i32 noundef %39, i64 noundef 1000000007)
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #4
  br label %40

40:                                               ; preds = %29
  %41 = load i32, ptr %6, align 4, !tbaa !5
  %42 = add nsw i32 %41, 1
  store i32 %42, ptr %6, align 4, !tbaa !5
  br label %15, !llvm.loop !9

43:                                               ; preds = %19
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #4
  store i32 0, ptr %9, align 4, !tbaa !5
  br label %44

44:                                               ; preds = %67, %43
  %45 = load i32, ptr %9, align 4, !tbaa !5
  %46 = load i32, ptr @N, align 4, !tbaa !5
  %47 = icmp slt i32 %45, %46
  br i1 %47, label %49, label %48

48:                                               ; preds = %44
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #4
  br label %70

49:                                               ; preds = %44
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #4
  call void @_ZN2io2reIiEEvRT_(ptr noundef nonnull align 4 dereferenceable(4) %10)
  %50 = load i32, ptr %10, align 4, !tbaa !5
  %51 = sext i32 %50 to i64
  %52 = getelementptr inbounds [3001 x i8], ptr @done, i64 0, i64 %51
  %53 = load i8, ptr %52, align 1, !tbaa !11, !range !13, !noundef !14
  %54 = trunc i8 %53 to i1
  br i1 %54, label %66, label %55

55:                                               ; preds = %49
  %56 = load i32, ptr %10, align 4, !tbaa !5
  %57 = sext i32 %56 to i64
  %58 = getelementptr inbounds [3001 x i8], ptr @done, i64 0, i64 %57
  store i8 1, ptr %58, align 1, !tbaa !11
  %59 = load i32, ptr %10, align 4, !tbaa !5
  %60 = mul nsw i32 2, %59
  call void @_ZN5DinicILi6005EE7addEdgeEiix(ptr noundef nonnull align 8 dereferenceable(192160) @D, i32 noundef 0, i32 noundef %60, i64 noundef 1000000007)
  %61 = load i32, ptr %10, align 4, !tbaa !5
  %62 = mul nsw i32 2, %61
  %63 = load i32, ptr %10, align 4, !tbaa !5
  %64 = mul nsw i32 2, %63
  %65 = add nsw i32 %64, 1
  call void @_ZN5DinicILi6005EE7addEdgeEiix(ptr noundef nonnull align 8 dereferenceable(192160) @D, i32 noundef %62, i32 noundef %65, i64 noundef 1000000007)
  br label %66

66:                                               ; preds = %55, %49
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #4
  br label %67

67:                                               ; preds = %66
  %68 = load i32, ptr %9, align 4, !tbaa !5
  %69 = add nsw i32 %68, 1
  store i32 %69, ptr %9, align 4, !tbaa !5
  br label %44, !llvm.loop !15

70:                                               ; preds = %48
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #4
  store i32 1, ptr %11, align 4, !tbaa !5
  br label %71

71:                                               ; preds = %90, %70
  %72 = load i32, ptr %11, align 4, !tbaa !5
  %73 = load i32, ptr @P, align 4, !tbaa !5
  %74 = add nsw i32 %73, 1
  %75 = icmp slt i32 %72, %74
  br i1 %75, label %77, label %76

76:                                               ; preds = %71
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #4
  br label %93

77:                                               ; preds = %71
  %78 = load i32, ptr %11, align 4, !tbaa !5
  %79 = sext i32 %78 to i64
  %80 = getelementptr inbounds [3001 x i8], ptr @done, i64 0, i64 %79
  %81 = load i8, ptr %80, align 1, !tbaa !11, !range !13, !noundef !14
  %82 = trunc i8 %81 to i1
  br i1 %82, label %89, label %83

83:                                               ; preds = %77
  %84 = load i32, ptr %11, align 4, !tbaa !5
  %85 = mul nsw i32 2, %84
  %86 = load i32, ptr %11, align 4, !tbaa !5
  %87 = mul nsw i32 2, %86
  %88 = add nsw i32 %87, 1
  call void @_ZN5DinicILi6005EE7addEdgeEiix(ptr noundef nonnull align 8 dereferenceable(192160) @D, i32 noundef %85, i32 noundef %88, i64 noundef 1)
  br label %89

89:                                               ; preds = %83, %77
  br label %90

90:                                               ; preds = %89
  %91 = load i32, ptr %11, align 4, !tbaa !5
  %92 = add nsw i32 %91, 1
  store i32 %92, ptr %11, align 4, !tbaa !5
  br label %71, !llvm.loop !16

93:                                               ; preds = %76
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #4
  %94 = call noundef i64 @_ZN5DinicILi6005EE7maxFlowEii(ptr noundef nonnull align 8 dereferenceable(192160) @D, i32 noundef 0, i32 noundef 2)
  store i64 %94, ptr %12, align 8, !tbaa !17
  call void @_ZN2io2prIxEEvRKT_(ptr noundef nonnull align 8 dereferenceable(8) %12)
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #4
  %95 = load i32, ptr %1, align 4
  ret i32 %95

96:                                               ; preds = %28
  %97 = load ptr, ptr %4, align 8
  %98 = load i32, ptr %5, align 4
  %99 = insertvalue { ptr, i32 } poison, ptr %97, 0
  %100 = insertvalue { ptr, i32 } %99, i32 %98, 1
  resume { ptr, i32 } %100
}

; Function Attrs: mustprogress nounwind uwtable
declare void @_ZNSaIcEC2Ev(ptr noundef nonnull align 1 dereferenceable(1)) unnamed_addr #1 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEPKcRKS3_(ptr noundef nonnull align 8 dereferenceable(32), ptr noundef, ptr noundef nonnull align 1 dereferenceable(1)) unnamed_addr #0 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN2io2reIiJiiEEEvRT_DpRT0_(ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4)) #0

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN2io2reIiJiEEEvRT_DpRT0_(ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4)) #0

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN5DinicILi6005EE7addEdgeEiix(ptr noundef nonnull align 8 dereferenceable(192160), i32 noundef, i32 noundef, i64 noundef) #0 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN2io2reIiEEvRT_(ptr noundef nonnull align 4 dereferenceable(4)) #0

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt15__new_allocatorIcED2Ev(ptr noundef nonnull align 1 dereferenceable(1)) unnamed_addr #1 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 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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { nounwind }

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

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


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

%struct.Dinic = type { [6005 x %"class.std::vector"], [6005 x i32], [6005 x i32] }
%"class.std::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<Dinic<6005>::Edge, std::allocator<Dinic<6005>::Edge>>::_Vector_impl" }
%"struct.std::_Vector_base<Dinic<6005>::Edge, std::allocator<Dinic<6005>::Edge>>::_Vector_impl" = type { %"struct.std::_Vector_base<Dinic<6005>::Edge, std::allocator<Dinic<6005>::Edge>>::_Vector_impl_data" }
%"struct.std::_Vector_base<Dinic<6005>::Edge, std::allocator<Dinic<6005>::Edge>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.std::__cxx11::basic_string" = type { %"struct.std::__cxx11::basic_string<char>::_Alloc_hider", i64, %union.anon }
%"struct.std::__cxx11::basic_string<char>::_Alloc_hider" = type { ptr }
%union.anon = type { i64, [8 x i8] }
%"class.std::allocator" = type { i8 }

@P = external dso_local global i32, align 4
@C = external dso_local global i32, align 4
@N = external dso_local global i32, align 4
@D = external dso_local global %struct.Dinic, align 8
@done = external dso_local local_unnamed_addr global [3001 x i8], align 16
@.str.6 = external hidden unnamed_addr constant [8 x i8], align 1

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN2io5setIOENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE(ptr noundef) local_unnamed_addr #0

declare i32 @__gxx_personality_v0(...)

; Function Attrs: mustprogress nounwind uwtable
declare void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32)) unnamed_addr #1 align 2

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

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

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #3 personality ptr @__gxx_personality_v0 {
  %1 = alloca %"class.std::__cxx11::basic_string", align 8
  %2 = alloca %"class.std::allocator", align 1
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  %6 = alloca i64, align 8
  call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %2) #4
  call void @_ZNSaIcEC2Ev(ptr noundef nonnull align 1 dereferenceable(1) %2) #4
  invoke void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEPKcRKS3_(ptr noundef nonnull align 8 dereferenceable(32) %1, ptr noundef nonnull @.str.6, ptr noundef nonnull align 1 dereferenceable(1) %2)
          to label %7 unwind label %13

7:                                                ; preds = %0
  invoke void @_ZN2io5setIOENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE(ptr noundef nonnull %1)
          to label %8 unwind label %15

8:                                                ; preds = %7
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %1) #4
  call void @_ZNSt15__new_allocatorIcED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %2) #4
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %2) #4
  call void @_ZN2io2reIiJiiEEEvRT_DpRT0_(ptr noundef nonnull align 4 dereferenceable(4) @P, ptr noundef nonnull align 4 dereferenceable(4) @C, ptr noundef nonnull align 4 dereferenceable(4) @N)
  %9 = load i32, ptr @C, align 4, !tbaa !5
  %10 = icmp sgt i32 %9, 0
  br i1 %10, label %.lr.ph, label %.preheader16

.preheader16:                                     ; preds = %.lr.ph, %8
  %11 = load i32, ptr @N, align 4, !tbaa !5
  %12 = icmp sgt i32 %11, 0
  br i1 %12, label %.lr.ph19, label %.preheader

13:                                               ; preds = %0
  %14 = landingpad { ptr, i32 }
          cleanup
  br label %17

15:                                               ; preds = %7
  %16 = landingpad { ptr, i32 }
          cleanup
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %1) #4
  br label %17

17:                                               ; preds = %15, %13
  %.pn = phi { ptr, i32 } [ %16, %15 ], [ %14, %13 ]
  call void @_ZNSt15__new_allocatorIcED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %2) #4
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %2) #4
  resume { ptr, i32 } %.pn

.lr.ph:                                           ; preds = %8, %.lr.ph
  %.01217 = phi i32 [ %28, %.lr.ph ], [ 0, %8 ]
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %3) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %4) #4
  call void @_ZN2io2reIiJiEEEvRT_DpRT0_(ptr noundef nonnull align 4 dereferenceable(4) %3, ptr noundef nonnull align 4 dereferenceable(4) %4)
  %18 = load i32, ptr %3, align 4, !tbaa !5
  %19 = shl nsw i32 %18, 1
  %20 = or disjoint i32 %19, 1
  %21 = load i32, ptr %4, align 4, !tbaa !5
  %22 = shl nsw i32 %21, 1
  call void @_ZN5DinicILi6005EE7addEdgeEiix(ptr noundef nonnull align 8 dereferenceable(192160) @D, i32 noundef %20, i32 noundef %22, i64 noundef 1000000007)
  %23 = load i32, ptr %4, align 4, !tbaa !5
  %24 = shl nsw i32 %23, 1
  %25 = or disjoint i32 %24, 1
  %26 = load i32, ptr %3, align 4, !tbaa !5
  %27 = shl nsw i32 %26, 1
  call void @_ZN5DinicILi6005EE7addEdgeEiix(ptr noundef nonnull align 8 dereferenceable(192160) @D, i32 noundef %25, i32 noundef %27, i64 noundef 1000000007)
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %4) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %3) #4
  %28 = add nuw nsw i32 %.01217, 1
  %29 = load i32, ptr @C, align 4, !tbaa !5
  %30 = icmp slt i32 %28, %29
  br i1 %30, label %.lr.ph, label %.preheader16, !llvm.loop !9

.preheader:                                       ; preds = %42, %.preheader16
  %31 = load i32, ptr @P, align 4, !tbaa !5
  %.not20 = icmp slt i32 %31, 1
  br i1 %.not20, label %._crit_edge, label %.lr.ph22

.lr.ph19:                                         ; preds = %.preheader16, %42
  %.01118 = phi i32 [ %43, %42 ], [ 0, %.preheader16 ]
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %5) #4
  call void @_ZN2io2reIiEEvRT_(ptr noundef nonnull align 4 dereferenceable(4) %5)
  %32 = load i32, ptr %5, align 4, !tbaa !5
  %33 = sext i32 %32 to i64
  %34 = getelementptr inbounds [3001 x i8], ptr @done, i64 0, i64 %33
  %35 = load i8, ptr %34, align 1, !tbaa !11, !range !13, !noundef !14
  %36 = trunc nuw i8 %35 to i1
  br i1 %36, label %42, label %37

37:                                               ; preds = %.lr.ph19
  store i8 1, ptr %34, align 1, !tbaa !11
  %38 = shl nsw i32 %32, 1
  call void @_ZN5DinicILi6005EE7addEdgeEiix(ptr noundef nonnull align 8 dereferenceable(192160) @D, i32 noundef 0, i32 noundef %38, i64 noundef 1000000007)
  %39 = load i32, ptr %5, align 4, !tbaa !5
  %40 = shl nsw i32 %39, 1
  %41 = or disjoint i32 %40, 1
  call void @_ZN5DinicILi6005EE7addEdgeEiix(ptr noundef nonnull align 8 dereferenceable(192160) @D, i32 noundef %40, i32 noundef %41, i64 noundef 1000000007)
  br label %42

42:                                               ; preds = %37, %.lr.ph19
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %5) #4
  %43 = add nuw nsw i32 %.01118, 1
  %44 = load i32, ptr @N, align 4, !tbaa !5
  %45 = icmp slt i32 %43, %44
  br i1 %45, label %.lr.ph19, label %.preheader, !llvm.loop !15

._crit_edge:                                      ; preds = %55, %.preheader
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %6) #4
  %46 = call noundef i64 @_ZN5DinicILi6005EE7maxFlowEii(ptr noundef nonnull align 8 dereferenceable(192160) @D, i32 noundef 0, i32 noundef 2)
  store i64 %46, ptr %6, align 8, !tbaa !16
  call void @_ZN2io2prIxEEvRKT_(ptr noundef nonnull align 8 dereferenceable(8) %6)
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %6) #4
  ret i32 0

.lr.ph22:                                         ; preds = %.preheader, %55
  %47 = phi i32 [ %56, %55 ], [ %31, %.preheader ]
  %indvars.iv = phi i64 [ %indvars.iv.next, %55 ], [ 1, %.preheader ]
  %48 = getelementptr inbounds [3001 x i8], ptr @done, i64 0, i64 %indvars.iv
  %49 = load i8, ptr %48, align 1, !tbaa !11, !range !13, !noundef !14
  %50 = trunc nuw i8 %49 to i1
  br i1 %50, label %55, label %51

51:                                               ; preds = %.lr.ph22
  %indvars23 = trunc i64 %indvars.iv to i32
  %52 = shl nuw nsw i32 %indvars23, 1
  %53 = or disjoint i32 %52, 1
  %indvars.iv.tr = trunc i64 %indvars.iv to i32
  %54 = shl i32 %indvars.iv.tr, 1
  call void @_ZN5DinicILi6005EE7addEdgeEiix(ptr noundef nonnull align 8 dereferenceable(192160) @D, i32 noundef %54, i32 noundef %53, i64 noundef 1)
  %.pre = load i32, ptr @P, align 4, !tbaa !5
  br label %55

55:                                               ; preds = %.lr.ph22, %51
  %56 = phi i32 [ %47, %.lr.ph22 ], [ %.pre, %51 ]
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %57 = sext i32 %56 to i64
  %.not.not = icmp slt i64 %indvars.iv, %57
  br i1 %.not.not, label %.lr.ph22, label %._crit_edge, !llvm.loop !18
}

; Function Attrs: mustprogress nounwind uwtable
declare void @_ZNSaIcEC2Ev(ptr noundef nonnull align 1 dereferenceable(1)) unnamed_addr #1 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEPKcRKS3_(ptr noundef nonnull align 8 dereferenceable(32), ptr noundef, ptr noundef nonnull align 1 dereferenceable(1)) unnamed_addr #0 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN2io2reIiJiiEEEvRT_DpRT0_(ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4)) local_unnamed_addr #0

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN2io2reIiJiEEEvRT_DpRT0_(ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4)) local_unnamed_addr #0

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN5DinicILi6005EE7addEdgeEiix(ptr noundef nonnull align 8 dereferenceable(192160), i32 noundef, i32 noundef, i64 noundef) local_unnamed_addr #0 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN2io2reIiEEvRT_(ptr noundef nonnull align 4 dereferenceable(4)) local_unnamed_addr #0

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt15__new_allocatorIcED2Ev(ptr noundef nonnull align 1 dereferenceable(1)) unnamed_addr #1 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 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 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { nounwind }

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

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


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