; LLVM IR from kazunetakahashi/atcoder :: 201610_12/1002_KUPC2016 (G)

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

@V = external dso_local global i32, align 4
@A = external dso_local global [1010 x i64], align 16
@B = external dso_local global [1010 x i64], align 16
@_ZSt3cin = external global %"class.std::basic_istream", align 8
@_ZSt4cout = external global %"class.std::basic_ostream", align 8

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z8add_edgeiixi(i32 noundef, i32 noundef, i64 noundef, i32 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 uwtable
declare dso_local noundef i64 @_Z13min_cost_flowiix(i32 noundef, i32 noundef, i64 noundef) #0

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() #2 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %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 i64, align 8
  %11 = alloca i32, align 4
  store i32 0, ptr %1, align 4
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #6
  %12 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) %2)
  %13 = load i32, ptr %2, align 4, !tbaa !5
  %14 = add nsw i32 %13, 2
  store i32 %14, ptr @V, align 4, !tbaa !5
  %15 = load i32, ptr %2, align 4, !tbaa !5
  %16 = icmp sgt i32 %15, 1010
  br i1 %16, label %17, label %18

17:                                               ; preds = %0
  store i32 0, ptr %1, align 4
  store i32 1, ptr %3, align 4
  br label %134

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

19:                                               ; preds = %29, %18
  %20 = load i32, ptr %4, align 4, !tbaa !5
  %21 = load i32, ptr %2, align 4, !tbaa !5
  %22 = icmp slt i32 %20, %21
  br i1 %22, label %24, label %23

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

24:                                               ; preds = %19
  %25 = load i32, ptr %4, align 4, !tbaa !5
  %26 = sext i32 %25 to i64
  %27 = getelementptr inbounds [1010 x i64], ptr @A, i64 0, i64 %26
  %28 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) %27)
  br label %29

29:                                               ; preds = %24
  %30 = load i32, ptr %4, align 4, !tbaa !5
  %31 = add nsw i32 %30, 1
  store i32 %31, ptr %4, align 4, !tbaa !5
  br label %19, !llvm.loop !9

32:                                               ; preds = %23
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #6
  store i32 0, ptr %5, align 4, !tbaa !5
  br label %33

33:                                               ; preds = %43, %32
  %34 = load i32, ptr %5, align 4, !tbaa !5
  %35 = load i32, ptr %2, align 4, !tbaa !5
  %36 = icmp slt i32 %34, %35
  br i1 %36, label %38, label %37

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

38:                                               ; preds = %33
  %39 = load i32, ptr %5, align 4, !tbaa !5
  %40 = sext i32 %39 to i64
  %41 = getelementptr inbounds [1010 x i64], ptr @B, i64 0, i64 %40
  %42 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) %41)
  br label %43

43:                                               ; preds = %38
  %44 = load i32, ptr %5, align 4, !tbaa !5
  %45 = add nsw i32 %44, 1
  store i32 %45, ptr %5, align 4, !tbaa !5
  br label %33, !llvm.loop !11

46:                                               ; preds = %37
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #6
  store i32 0, ptr %6, align 4, !tbaa !5
  br label %47

47:                                               ; preds = %59, %46
  %48 = load i32, ptr %6, align 4, !tbaa !5
  %49 = load i32, ptr %2, align 4, !tbaa !5
  %50 = icmp slt i32 %48, %49
  br i1 %50, label %52, label %51

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

52:                                               ; preds = %47
  %53 = load i32, ptr %2, align 4, !tbaa !5
  %54 = load i32, ptr %6, align 4, !tbaa !5
  %55 = load i32, ptr %6, align 4, !tbaa !5
  %56 = sext i32 %55 to i64
  %57 = getelementptr inbounds [1010 x i64], ptr @B, i64 0, i64 %56
  %58 = load i64, ptr %57, align 8, !tbaa !12
  call void @_Z8add_edgeiixi(i32 noundef %53, i32 noundef %54, i64 noundef %58, i32 noundef 0)
  br label %59

59:                                               ; preds = %52
  %60 = load i32, ptr %6, align 4, !tbaa !5
  %61 = add nsw i32 %60, 1
  store i32 %61, ptr %6, align 4, !tbaa !5
  br label %47, !llvm.loop !14

62:                                               ; preds = %51
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #6
  store i32 0, ptr %7, align 4, !tbaa !5
  br label %63

63:                                               ; preds = %76, %62
  %64 = load i32, ptr %7, align 4, !tbaa !5
  %65 = load i32, ptr %2, align 4, !tbaa !5
  %66 = icmp slt i32 %64, %65
  br i1 %66, label %68, label %67

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

68:                                               ; preds = %63
  %69 = load i32, ptr %7, align 4, !tbaa !5
  %70 = load i32, ptr %2, align 4, !tbaa !5
  %71 = add nsw i32 %70, 1
  %72 = load i32, ptr %7, align 4, !tbaa !5
  %73 = sext i32 %72 to i64
  %74 = getelementptr inbounds [1010 x i64], ptr @A, i64 0, i64 %73
  %75 = load i64, ptr %74, align 8, !tbaa !12
  call void @_Z8add_edgeiixi(i32 noundef %69, i32 noundef %71, i64 noundef %75, i32 noundef 0)
  br label %76

76:                                               ; preds = %68
  %77 = load i32, ptr %7, align 4, !tbaa !5
  %78 = add nsw i32 %77, 1
  store i32 %78, ptr %7, align 4, !tbaa !5
  br label %63, !llvm.loop !15

79:                                               ; preds = %67
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #6
  store i32 0, ptr %8, align 4, !tbaa !5
  br label %80

80:                                               ; preds = %107, %79
  %81 = load i32, ptr %8, align 4, !tbaa !5
  %82 = load i32, ptr %2, align 4, !tbaa !5
  %83 = icmp slt i32 %81, %82
  br i1 %83, label %85, label %84

84:                                               ; preds = %80
  store i32 14, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #6
  br label %110

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

86:                                               ; preds = %103, %85
  %87 = load i32, ptr %9, align 4, !tbaa !5
  %88 = load i32, ptr %2, align 4, !tbaa !5
  %89 = icmp slt i32 %87, %88
  br i1 %89, label %91, label %90

90:                                               ; preds = %86
  store i32 17, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #6
  br label %106

91:                                               ; preds = %86
  %92 = load i32, ptr %8, align 4, !tbaa !5
  %93 = load i32, ptr %9, align 4, !tbaa !5
  %94 = icmp eq i32 %92, %93
  br i1 %94, label %95, label %96

95:                                               ; preds = %91
  br label %103

96:                                               ; preds = %91
  %97 = load i32, ptr %8, align 4, !tbaa !5
  %98 = load i32, ptr %9, align 4, !tbaa !5
  %99 = load i32, ptr %8, align 4, !tbaa !5
  %100 = load i32, ptr %9, align 4, !tbaa !5
  %101 = sub nsw i32 %99, %100
  %102 = call i32 @llvm.abs.i32(i32 %101, i1 true)
  call void @_Z8add_edgeiixi(i32 noundef %97, i32 noundef %98, i64 noundef 10000000000000007, i32 noundef %102)
  br label %103

103:                                              ; preds = %96, %95
  %104 = load i32, ptr %9, align 4, !tbaa !5
  %105 = add nsw i32 %104, 1
  store i32 %105, ptr %9, align 4, !tbaa !5
  br label %86, !llvm.loop !16

106:                                              ; preds = %90
  br label %107

107:                                              ; preds = %106
  %108 = load i32, ptr %8, align 4, !tbaa !5
  %109 = add nsw i32 %108, 1
  store i32 %109, ptr %8, align 4, !tbaa !5
  br label %80, !llvm.loop !17

110:                                              ; preds = %84
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #6
  store i64 0, ptr %10, align 8, !tbaa !12
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #6
  store i32 0, ptr %11, align 4, !tbaa !5
  br label %111

111:                                              ; preds = %123, %110
  %112 = load i32, ptr %11, align 4, !tbaa !5
  %113 = load i32, ptr %2, align 4, !tbaa !5
  %114 = icmp slt i32 %112, %113
  br i1 %114, label %116, label %115

115:                                              ; preds = %111
  store i32 20, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #6
  br label %126

116:                                              ; preds = %111
  %117 = load i32, ptr %11, align 4, !tbaa !5
  %118 = sext i32 %117 to i64
  %119 = getelementptr inbounds [1010 x i64], ptr @B, i64 0, i64 %118
  %120 = load i64, ptr %119, align 8, !tbaa !12
  %121 = load i64, ptr %10, align 8, !tbaa !12
  %122 = add nsw i64 %121, %120
  store i64 %122, ptr %10, align 8, !tbaa !12
  br label %123

123:                                              ; preds = %116
  %124 = load i32, ptr %11, align 4, !tbaa !5
  %125 = add nsw i32 %124, 1
  store i32 %125, ptr %11, align 4, !tbaa !5
  br label %111, !llvm.loop !18

126:                                              ; preds = %115
  %127 = load i32, ptr %2, align 4, !tbaa !5
  %128 = load i32, ptr %2, align 4, !tbaa !5
  %129 = add nsw i32 %128, 1
  %130 = load i64, ptr %10, align 8, !tbaa !12
  %131 = call noundef i64 @_Z13min_cost_flowiix(i32 noundef %127, i32 noundef %129, i64 noundef %130)
  %132 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i64 noundef %131)
  %133 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %132, ptr noundef @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #6
  store i32 0, ptr %3, align 4
  br label %134

134:                                              ; preds = %126, %17
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #6
  %135 = load i32, ptr %3, align 4
  switch i32 %135, label %138 [
    i32 0, label %136
    i32 1, label %136
  ]

136:                                              ; preds = %134, %134
  %137 = load i32, ptr %1, align 4
  ret i32 %137

138:                                              ; preds = %134
  unreachable
}

declare noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 4 dereferenceable(4)) #3

; 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: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.abs.i32(i32, i1 immarg) #4

; 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

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

; Function Attrs: inlinehint mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_(ptr noundef nonnull align 8 dereferenceable(8)) #5

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


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

@V = external dso_local local_unnamed_addr global i32, align 4
@A = external dso_local global [1010 x i64], align 16
@B = external dso_local global [1010 x i64], align 16
@_ZSt3cin = external global %"class.std::basic_istream", align 8
@_ZSt4cout = external global %"class.std::basic_ostream", align 8

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z8add_edgeiixi(i32 noundef, i32 noundef, i64 noundef, i32 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 uwtable
declare dso_local noundef i64 @_Z13min_cost_flowiix(i32 noundef, i32 noundef, i64 noundef) local_unnamed_addr #0

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #2 {
  %1 = alloca i32, align 4
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %1) #7
  %2 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) %1)
  %3 = load i32, ptr %1, align 4, !tbaa !5
  %4 = add nsw i32 %3, 2
  store i32 %4, ptr @V, align 4, !tbaa !5
  %5 = icmp sgt i32 %3, 1010
  br i1 %5, label %66, label %.preheader46

.preheader46:                                     ; preds = %0
  %6 = icmp sgt i32 %3, 0
  br i1 %6, label %.lr.ph, label %._crit_edge60

.preheader45:                                     ; preds = %.lr.ph
  %7 = icmp sgt i32 %10, 0
  br i1 %7, label %.lr.ph49, label %._crit_edge60

.lr.ph:                                           ; preds = %.preheader46, %.lr.ph
  %indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph ], [ 0, %.preheader46 ]
  %8 = getelementptr inbounds [1010 x i64], ptr @A, i64 0, i64 %indvars.iv
  %9 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) %8)
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %10 = load i32, ptr %1, align 4, !tbaa !5
  %11 = sext i32 %10 to i64
  %12 = icmp slt i64 %indvars.iv.next, %11
  br i1 %12, label %.lr.ph, label %.preheader45, !llvm.loop !9

.preheader44:                                     ; preds = %.lr.ph49
  %13 = icmp sgt i32 %16, 0
  br i1 %13, label %.lr.ph51, label %._crit_edge60

.lr.ph49:                                         ; preds = %.preheader45, %.lr.ph49
  %indvars.iv66 = phi i64 [ %indvars.iv.next67, %.lr.ph49 ], [ 0, %.preheader45 ]
  %14 = getelementptr inbounds [1010 x i64], ptr @B, i64 0, i64 %indvars.iv66
  %15 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) %14)
  %indvars.iv.next67 = add nuw nsw i64 %indvars.iv66, 1
  %16 = load i32, ptr %1, align 4, !tbaa !5
  %17 = sext i32 %16 to i64
  %18 = icmp slt i64 %indvars.iv.next67, %17
  br i1 %18, label %.lr.ph49, label %.preheader44, !llvm.loop !11

.preheader43:                                     ; preds = %.lr.ph51
  %19 = icmp sgt i32 %24, 0
  br i1 %19, label %.lr.ph53, label %._crit_edge60

.lr.ph51:                                         ; preds = %.preheader44, %.lr.ph51
  %indvars.iv69 = phi i64 [ %indvars.iv.next70, %.lr.ph51 ], [ 0, %.preheader44 ]
  %20 = phi i32 [ %24, %.lr.ph51 ], [ %16, %.preheader44 ]
  %21 = getelementptr inbounds [1010 x i64], ptr @B, i64 0, i64 %indvars.iv69
  %22 = load i64, ptr %21, align 8, !tbaa !12
  %23 = trunc nuw nsw i64 %indvars.iv69 to i32
  call void @_Z8add_edgeiixi(i32 noundef %20, i32 noundef %23, i64 noundef %22, i32 noundef 0)
  %indvars.iv.next70 = add nuw nsw i64 %indvars.iv69, 1
  %24 = load i32, ptr %1, align 4, !tbaa !5
  %25 = sext i32 %24 to i64
  %26 = icmp slt i64 %indvars.iv.next70, %25
  br i1 %26, label %.lr.ph51, label %.preheader43, !llvm.loop !14

.preheader42:                                     ; preds = %.lr.ph53
  %27 = icmp sgt i32 %33, 0
  br i1 %27, label %.preheader41, label %._crit_edge60

.lr.ph53:                                         ; preds = %.preheader43, %.lr.ph53
  %indvars.iv72 = phi i64 [ %indvars.iv.next73, %.lr.ph53 ], [ 0, %.preheader43 ]
  %28 = phi i32 [ %33, %.lr.ph53 ], [ %24, %.preheader43 ]
  %29 = add nsw i32 %28, 1
  %30 = getelementptr inbounds [1010 x i64], ptr @A, i64 0, i64 %indvars.iv72
  %31 = load i64, ptr %30, align 8, !tbaa !12
  %32 = trunc nuw nsw i64 %indvars.iv72 to i32
  call void @_Z8add_edgeiixi(i32 noundef %32, i32 noundef %29, i64 noundef %31, i32 noundef 0)
  %indvars.iv.next73 = add nuw nsw i64 %indvars.iv72, 1
  %33 = load i32, ptr %1, align 4, !tbaa !5
  %34 = sext i32 %33 to i64
  %35 = icmp slt i64 %indvars.iv.next73, %34
  br i1 %35, label %.lr.ph53, label %.preheader42, !llvm.loop !15

.preheader41:                                     ; preds = %.preheader42, %._crit_edge
  %36 = phi i32 [ %45, %._crit_edge ], [ %33, %.preheader42 ]
  %.03256 = phi i32 [ %46, %._crit_edge ], [ 0, %.preheader42 ]
  %37 = icmp sgt i32 %36, 0
  br i1 %37, label %.lr.ph55, label %._crit_edge

.preheader:                                       ; preds = %._crit_edge
  %38 = icmp sgt i32 %45, 0
  br i1 %38, label %.lr.ph59.preheader, label %._crit_edge60

.lr.ph59.preheader:                               ; preds = %.preheader
  %wide.trip.count = zext nneg i32 %45 to i64
  %min.iters.check = icmp ult i32 %45, 4
  br i1 %min.iters.check, label %.lr.ph59.preheader96, label %vector.ph

.lr.ph59.preheader96:                             ; preds = %middle.block, %.lr.ph59.preheader
  %indvars.iv75.ph = phi i64 [ 0, %.lr.ph59.preheader ], [ %n.vec, %middle.block ]
  %.03057.ph = phi i64 [ 0, %.lr.ph59.preheader ], [ %44, %middle.block ]
  br label %.lr.ph59

vector.ph:                                        ; preds = %.lr.ph59.preheader
  %n.vec = and i64 %wide.trip.count, 2147483644
  br label %vector.body

vector.body:                                      ; preds = %vector.body, %vector.ph
  %index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
  %vec.phi = phi <2 x i64> [ zeroinitializer, %vector.ph ], [ %41, %vector.body ]
  %vec.phi94 = phi <2 x i64> [ zeroinitializer, %vector.ph ], [ %42, %vector.body ]
  %39 = getelementptr inbounds [1010 x i64], ptr @B, i64 0, i64 %index
  %40 = getelementptr inbounds i8, ptr %39, i64 16
  %wide.load = load <2 x i64>, ptr %39, align 16, !tbaa !12
  %wide.load95 = load <2 x i64>, ptr %40, align 16, !tbaa !12
  %41 = add <2 x i64> %wide.load, %vec.phi
  %42 = add <2 x i64> %wide.load95, %vec.phi94
  %index.next = add nuw i64 %index, 4
  %43 = icmp eq i64 %index.next, %n.vec
  br i1 %43, label %middle.block, label %vector.body, !llvm.loop !16

middle.block:                                     ; preds = %vector.body
  %bin.rdx = add <2 x i64> %42, %41
  %44 = call i64 @llvm.vector.reduce.add.v2i64(<2 x i64> %bin.rdx)
  %cmp.n = icmp eq i64 %n.vec, %wide.trip.count
  br i1 %cmp.n, label %._crit_edge60, label %.lr.ph59.preheader96

._crit_edge:                                      ; preds = %54, %.preheader41
  %45 = phi i32 [ %36, %.preheader41 ], [ %55, %54 ]
  %46 = add nuw nsw i32 %.03256, 1
  %47 = icmp slt i32 %46, %45
  br i1 %47, label %.preheader41, label %.preheader, !llvm.loop !19

.lr.ph55:                                         ; preds = %.preheader41, %54
  %48 = phi i32 [ %55, %54 ], [ %36, %.preheader41 ]
  %49 = phi i32 [ %56, %54 ], [ %36, %.preheader41 ]
  %.03154 = phi i32 [ %57, %54 ], [ 0, %.preheader41 ]
  %50 = icmp eq i32 %.03256, %.03154
  br i1 %50, label %54, label %51

51:                                               ; preds = %.lr.ph55
  %52 = sub nsw i32 %.03256, %.03154
  %53 = call i32 @llvm.abs.i32(i32 %52, i1 true)
  call void @_Z8add_edgeiixi(i32 noundef %.03256, i32 noundef %.03154, i64 noundef 10000000000000007, i32 noundef %53)
  %.pre = load i32, ptr %1, align 4, !tbaa !5
  br label %54

54:                                               ; preds = %.lr.ph55, %51
  %55 = phi i32 [ %48, %.lr.ph55 ], [ %.pre, %51 ]
  %56 = phi i32 [ %49, %.lr.ph55 ], [ %.pre, %51 ]
  %57 = add nuw nsw i32 %.03154, 1
  %58 = icmp slt i32 %57, %56
  br i1 %58, label %.lr.ph55, label %._crit_edge, !llvm.loop !21

._crit_edge60:                                    ; preds = %.lr.ph59, %middle.block, %.preheader46, %.preheader45, %.preheader44, %.preheader43, %.preheader42, %.preheader
  %.lcssa81 = phi i32 [ %45, %.preheader ], [ %33, %.preheader42 ], [ %24, %.preheader43 ], [ %16, %.preheader44 ], [ %10, %.preheader45 ], [ %3, %.preheader46 ], [ %45, %middle.block ], [ %45, %.lr.ph59 ]
  %.030.lcssa = phi i64 [ 0, %.preheader ], [ 0, %.preheader42 ], [ 0, %.preheader43 ], [ 0, %.preheader44 ], [ 0, %.preheader45 ], [ 0, %.preheader46 ], [ %44, %middle.block ], [ %65, %.lr.ph59 ]
  %59 = add nsw i32 %.lcssa81, 1
  %60 = call noundef i64 @_Z13min_cost_flowiix(i32 noundef %.lcssa81, i32 noundef %59, i64 noundef %.030.lcssa)
  %61 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i64 noundef %60)
  %62 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %61, ptr noundef nonnull @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
  br label %66

.lr.ph59:                                         ; preds = %.lr.ph59.preheader96, %.lr.ph59
  %indvars.iv75 = phi i64 [ %indvars.iv.next76, %.lr.ph59 ], [ %indvars.iv75.ph, %.lr.ph59.preheader96 ]
  %.03057 = phi i64 [ %65, %.lr.ph59 ], [ %.03057.ph, %.lr.ph59.preheader96 ]
  %63 = getelementptr inbounds [1010 x i64], ptr @B, i64 0, i64 %indvars.iv75
  %64 = load i64, ptr %63, align 8, !tbaa !12
  %65 = add nsw i64 %64, %.03057
  %indvars.iv.next76 = add nuw nsw i64 %indvars.iv75, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next76, %wide.trip.count
  br i1 %exitcond.not, label %._crit_edge60, label %.lr.ph59, !llvm.loop !22

66:                                               ; preds = %0, %._crit_edge60
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #7
  ret i32 0
}

declare noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 4 dereferenceable(4)) local_unnamed_addr #3

; 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 nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.abs.i32(i32, i1 immarg) #4

; 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

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

; Function Attrs: inlinehint mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_(ptr noundef nonnull align 8 dereferenceable(8)) #5

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.vector.reduce.add.v2i64(<2 x i64>) #6

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 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 nocallback nofree nosync nounwind speculatable willreturn memory(none) }
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 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #7 = { nounwind }

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

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


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GVNPass,GlobalOptPass,IndVarSimplifyPass,InferAlignmentPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LICMPass,LoopLoadEliminationPass,LoopRotatePass,LoopSimplifyCFGPass,LoopSimplifyPass,LoopUnrollPass,LoopVectorizePass,ReassociatePass,SCCPPass,SROAPass,SimpleLoopUnswitchPass,SimplifyCFGPass