; LLVM IR from vmartinv/eldiego :: flow/min.cost.max.flow.ll (Z7addEdgeiixx)

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

@G = external dso_local global [10000 x %"class.std::vector"], align 16
@e = external dso_local global %"class.std::vector.0", align 8

; Function Attrs: mustprogress uwtable
define dso_local void @_Z7addEdgeiixx(i32 noundef %0, i32 noundef %1, i64 noundef %2, i64 noundef %3) #0 {
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  %7 = alloca i64, align 8
  %8 = alloca i64, align 8
  %9 = alloca i32, align 4
  %10 = alloca %struct.edge, align 8
  %11 = alloca i32, align 4
  %12 = alloca %struct.edge, align 8
  store i32 %0, ptr %5, align 4, !tbaa !5
  store i32 %1, ptr %6, align 4, !tbaa !5
  store i64 %2, ptr %7, align 8, !tbaa !9
  store i64 %3, ptr %8, align 8, !tbaa !9
  %13 = load i32, ptr %5, align 4, !tbaa !5
  %14 = sext i32 %13 to i64
  %15 = getelementptr inbounds [10000 x %"class.std::vector"], ptr @G, i64 0, i64 %14
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #3
  %16 = call noundef i64 @_ZNKSt6vectorI4edgeSaIS0_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) @e) #3
  %17 = trunc i64 %16 to i32
  store i32 %17, ptr %9, align 4, !tbaa !5
  call void @_ZNSt6vectorIiSaIiEE9push_backEOi(ptr noundef nonnull align 8 dereferenceable(24) %15, ptr noundef nonnull align 4 dereferenceable(4) %9)
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #3
  call void @llvm.lifetime.start.p0(i64 32, ptr %10) #3
  %18 = getelementptr inbounds %struct.edge, ptr %10, i32 0, i32 0
  %19 = load i32, ptr %5, align 4, !tbaa !5
  store i32 %19, ptr %18, align 8, !tbaa !11
  %20 = getelementptr inbounds %struct.edge, ptr %10, i32 0, i32 1
  %21 = load i32, ptr %6, align 4, !tbaa !5
  store i32 %21, ptr %20, align 4, !tbaa !13
  %22 = getelementptr inbounds %struct.edge, ptr %10, i32 0, i32 2
  %23 = load i64, ptr %7, align 8, !tbaa !9
  store i64 %23, ptr %22, align 8, !tbaa !14
  %24 = getelementptr inbounds %struct.edge, ptr %10, i32 0, i32 3
  store i64 0, ptr %24, align 8, !tbaa !15
  %25 = getelementptr inbounds %struct.edge, ptr %10, i32 0, i32 4
  %26 = load i64, ptr %8, align 8, !tbaa !9
  store i64 %26, ptr %25, align 8, !tbaa !16
  call void @_ZNSt6vectorI4edgeSaIS0_EE9push_backEOS0_(ptr noundef nonnull align 8 dereferenceable(24) @e, ptr noundef nonnull align 8 dereferenceable(32) %10)
  call void @llvm.lifetime.end.p0(i64 32, ptr %10) #3
  %27 = load i32, ptr %6, align 4, !tbaa !5
  %28 = sext i32 %27 to i64
  %29 = getelementptr inbounds [10000 x %"class.std::vector"], ptr @G, i64 0, i64 %28
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #3
  %30 = call noundef i64 @_ZNKSt6vectorI4edgeSaIS0_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) @e) #3
  %31 = trunc i64 %30 to i32
  store i32 %31, ptr %11, align 4, !tbaa !5
  call void @_ZNSt6vectorIiSaIiEE9push_backEOi(ptr noundef nonnull align 8 dereferenceable(24) %29, ptr noundef nonnull align 4 dereferenceable(4) %11)
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #3
  call void @llvm.lifetime.start.p0(i64 32, ptr %12) #3
  %32 = getelementptr inbounds %struct.edge, ptr %12, i32 0, i32 0
  %33 = load i32, ptr %6, align 4, !tbaa !5
  store i32 %33, ptr %32, align 8, !tbaa !11
  %34 = getelementptr inbounds %struct.edge, ptr %12, i32 0, i32 1
  %35 = load i32, ptr %5, align 4, !tbaa !5
  store i32 %35, ptr %34, align 4, !tbaa !13
  %36 = getelementptr inbounds %struct.edge, ptr %12, i32 0, i32 2
  store i64 0, ptr %36, align 8, !tbaa !14
  %37 = getelementptr inbounds %struct.edge, ptr %12, i32 0, i32 3
  store i64 0, ptr %37, align 8, !tbaa !15
  %38 = getelementptr inbounds %struct.edge, ptr %12, i32 0, i32 4
  %39 = load i64, ptr %8, align 8, !tbaa !9
  %40 = sub nsw i64 0, %39
  store i64 %40, ptr %38, align 8, !tbaa !16
  call void @_ZNSt6vectorI4edgeSaIS0_EE9push_backEOS0_(ptr noundef nonnull align 8 dereferenceable(24) @e, ptr noundef nonnull align 8 dereferenceable(32) %12)
  call void @llvm.lifetime.end.p0(i64 32, ptr %12) #3
  ret void
}

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i64 @_ZNKSt6vectorI4edgeSaIS0_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24)) #2 align 2

; 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 void @_ZNSt6vectorI4edgeSaIS0_EE9push_backEOS0_(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 8 dereferenceable(32)) #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 = { 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 = !{!10, !10, i64 0}
!10 = !{!"long long", !7, i64 0}
!11 = !{!12, !6, i64 0}
!12 = !{!"_ZTS4edge", !6, i64 0, !6, i64 4, !10, i64 8, !10, i64 16, !10, i64 24}
!13 = !{!12, !6, i64 4}
!14 = !{!12, !10, i64 8}
!15 = !{!12, !10, i64 16}
!16 = !{!12, !10, i64 24}


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

@G = external dso_local global [10000 x %"class.std::vector"], align 16
@e = external dso_local global %"class.std::vector.0", align 8

; Function Attrs: mustprogress uwtable
define dso_local void @_Z7addEdgeiixx(i32 noundef %0, i32 noundef %1, i64 noundef %2, i64 noundef %3) local_unnamed_addr #0 {
  %5 = alloca i32, align 4
  %6 = alloca %struct.edge, align 8
  %7 = alloca i32, align 4
  %8 = alloca %struct.edge, align 8
  %9 = sext i32 %0 to i64
  %10 = getelementptr inbounds [10000 x %"class.std::vector"], ptr @G, i64 0, i64 %9
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %5) #4
  %11 = tail call noundef i64 @_ZNKSt6vectorI4edgeSaIS0_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) @e) #4
  %12 = trunc i64 %11 to i32
  store i32 %12, ptr %5, align 4, !tbaa !5
  call void @_ZNSt6vectorIiSaIiEE9push_backEOi(ptr noundef nonnull align 8 dereferenceable(24) %10, ptr noundef nonnull align 4 dereferenceable(4) %5)
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %5) #4
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %6) #4
  store i32 %0, ptr %6, align 8, !tbaa !9
  %13 = getelementptr inbounds i8, ptr %6, i64 4
  store i32 %1, ptr %13, align 4, !tbaa !12
  %14 = getelementptr inbounds i8, ptr %6, i64 8
  store i64 %2, ptr %14, align 8, !tbaa !13
  %15 = getelementptr inbounds i8, ptr %6, i64 16
  store i64 0, ptr %15, align 8, !tbaa !14
  %16 = getelementptr inbounds i8, ptr %6, i64 24
  store i64 %3, ptr %16, align 8, !tbaa !15
  call void @_ZNSt6vectorI4edgeSaIS0_EE9push_backEOS0_(ptr noundef nonnull align 8 dereferenceable(24) @e, ptr noundef nonnull align 8 dereferenceable(32) %6)
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %6) #4
  %17 = sext i32 %1 to i64
  %18 = getelementptr inbounds [10000 x %"class.std::vector"], ptr @G, i64 0, i64 %17
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %7) #4
  %19 = call noundef i64 @_ZNKSt6vectorI4edgeSaIS0_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) @e) #4
  %20 = trunc i64 %19 to i32
  store i32 %20, ptr %7, align 4, !tbaa !5
  call void @_ZNSt6vectorIiSaIiEE9push_backEOi(ptr noundef nonnull align 8 dereferenceable(24) %18, ptr noundef nonnull align 4 dereferenceable(4) %7)
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %7) #4
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %8) #4
  store i32 %1, ptr %8, align 8, !tbaa !9
  %21 = getelementptr inbounds i8, ptr %8, i64 4
  store i32 %0, ptr %21, align 4, !tbaa !12
  %22 = getelementptr inbounds i8, ptr %8, i64 8
  %23 = getelementptr inbounds i8, ptr %8, i64 24
  %24 = sub nsw i64 0, %3
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(16) %22, i8 0, i64 16, i1 false)
  store i64 %24, ptr %23, align 8, !tbaa !15
  call void @_ZNSt6vectorI4edgeSaIS0_EE9push_backEOS0_(ptr noundef nonnull align 8 dereferenceable(24) @e, ptr noundef nonnull align 8 dereferenceable(32) %8)
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %8) #4
  ret void
}

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

; 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 nounwind uwtable
declare dso_local noundef i64 @_ZNKSt6vectorI4edgeSaIS0_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24)) local_unnamed_addr #2 align 2

; 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 void @_ZNSt6vectorI4edgeSaIS0_EE9push_backEOS0_(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 8 dereferenceable(32)) local_unnamed_addr #0 align 2

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #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 = { 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 = { nocallback nofree nounwind willreturn memory(argmem: write) }
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 = !{!10, !6, i64 0}
!10 = !{!"_ZTS4edge", !6, i64 0, !6, i64 4, !11, i64 8, !11, i64 16, !11, i64 24}
!11 = !{!"long long", !7, i64 0}
!12 = !{!10, !6, i64 4}
!13 = !{!10, !11, i64 8}
!14 = !{!10, !11, i64 16}
!15 = !{!10, !11, i64 24}


; Effective O3 passes: EarlyCSEPass,GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,MemCpyOptPass,SROAPass,TailCallElimPass