; LLVM IR from Rintarooo/VRPTW_ACO_Routing :: src/vehicle.ll (ZN3Car8add_nodeEP4NodePPd)

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

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN3Car8add_nodeEP4NodePPd(ptr noundef nonnull align 8 dereferenceable(48) %0, ptr noundef %1, ptr noundef %2) #0 align 2 {
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  store ptr %0, ptr %4, align 8, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !5
  store ptr %2, ptr %6, align 8, !tbaa !5
  %7 = load ptr, ptr %4, align 8
  %8 = getelementptr inbounds %class.Car, ptr %7, i32 0, i32 5
  %9 = call noundef zeroext i1 @_ZNKSt6vectorI4NodeSaIS0_EE5emptyEv(ptr noundef nonnull align 8 dereferenceable(24) %8) #2
  br i1 %9, label %36, label %10

10:                                               ; preds = %3
  %11 = load ptr, ptr %6, align 8, !tbaa !5
  %12 = getelementptr inbounds %class.Car, ptr %7, i32 0, i32 2
  %13 = load i32, ptr %12, align 8, !tbaa !9
  %14 = sext i32 %13 to i64
  %15 = getelementptr inbounds ptr, ptr %11, i64 %14
  %16 = load ptr, ptr %15, align 8, !tbaa !5
  %17 = load ptr, ptr %5, align 8, !tbaa !5
  %18 = getelementptr inbounds %class.Node, ptr %17, i32 0, i32 2
  %19 = load i32, ptr %18, align 4, !tbaa !16
  %20 = sext i32 %19 to i64
  %21 = getelementptr inbounds double, ptr %16, i64 %20
  %22 = load double, ptr %21, align 8, !tbaa !19
  %23 = fptosi double %22 to i32
  %24 = getelementptr inbounds %class.Car, ptr %7, i32 0, i32 3
  %25 = load i32, ptr %24, align 4, !tbaa !21
  %26 = sdiv i32 %23, %25
  %27 = getelementptr inbounds %class.Car, ptr %7, i32 0, i32 4
  %28 = load i32, ptr %27, align 8, !tbaa !22
  %29 = add nsw i32 %28, %26
  store i32 %29, ptr %27, align 8, !tbaa !22
  %30 = load ptr, ptr %5, align 8, !tbaa !5
  %31 = getelementptr inbounds %class.Node, ptr %30, i32 0, i32 7
  %32 = load i32, ptr %31, align 4, !tbaa !23
  %33 = getelementptr inbounds %class.Car, ptr %7, i32 0, i32 4
  %34 = load i32, ptr %33, align 8, !tbaa !22
  %35 = add nsw i32 %34, %32
  store i32 %35, ptr %33, align 8, !tbaa !22
  br label %36

36:                                               ; preds = %10, %3
  %37 = getelementptr inbounds %class.Car, ptr %7, i32 0, i32 5
  %38 = load ptr, ptr %5, align 8, !tbaa !5
  call void @_ZNSt6vectorI4NodeSaIS0_EE9push_backERKS0_(ptr noundef nonnull align 8 dereferenceable(24) %37, ptr noundef nonnull align 4 dereferenceable(32) %38)
  %39 = load ptr, ptr %5, align 8, !tbaa !5
  %40 = getelementptr inbounds %class.Node, ptr %39, i32 0, i32 3
  %41 = load i32, ptr %40, align 4, !tbaa !24
  %42 = getelementptr inbounds %class.Car, ptr %7, i32 0, i32 1
  %43 = load i32, ptr %42, align 4, !tbaa !25
  %44 = add nsw i32 %43, %41
  store i32 %44, ptr %42, align 4, !tbaa !25
  %45 = load ptr, ptr %5, align 8, !tbaa !5
  %46 = getelementptr inbounds %class.Node, ptr %45, i32 0, i32 2
  %47 = load i32, ptr %46, align 4, !tbaa !16
  %48 = getelementptr inbounds %class.Car, ptr %7, i32 0, i32 2
  store i32 %47, ptr %48, align 8, !tbaa !9
  %49 = load ptr, ptr %5, align 8, !tbaa !5
  %50 = getelementptr inbounds %class.Node, ptr %49, i32 0, i32 4
  store i8 1, ptr %50, align 4, !tbaa !26
  ret void
}

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZNKSt6vectorI4NodeSaIS0_EE5emptyEv(ptr noundef nonnull align 8 dereferenceable(24)) #1 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt6vectorI4NodeSaIS0_EE9push_backERKS0_(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 4 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 = { 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 = { 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 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !11, i64 8}
!10 = !{!"_ZTS3Car", !11, i64 0, !11, i64 4, !11, i64 8, !11, i64 12, !11, i64 16, !12, i64 24}
!11 = !{!"int", !7, i64 0}
!12 = !{!"_ZTSSt6vectorI4NodeSaIS0_EE", !13, i64 0}
!13 = !{!"_ZTSSt12_Vector_baseI4NodeSaIS0_EE", !14, i64 0}
!14 = !{!"_ZTSNSt12_Vector_baseI4NodeSaIS0_EE12_Vector_implE", !15, i64 0}
!15 = !{!"_ZTSNSt12_Vector_baseI4NodeSaIS0_EE17_Vector_impl_dataE", !6, i64 0, !6, i64 8, !6, i64 16}
!16 = !{!17, !11, i64 8}
!17 = !{!"_ZTS4Node", !11, i64 0, !11, i64 4, !11, i64 8, !11, i64 12, !18, i64 16, !11, i64 20, !11, i64 24, !11, i64 28}
!18 = !{!"bool", !7, i64 0}
!19 = !{!20, !20, i64 0}
!20 = !{!"double", !7, i64 0}
!21 = !{!10, !11, i64 12}
!22 = !{!10, !11, i64 16}
!23 = !{!17, !11, i64 28}
!24 = !{!17, !11, i64 12}
!25 = !{!10, !11, i64 4}
!26 = !{!17, !18, i64 16}


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

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN3Car8add_nodeEP4NodePPd(ptr noundef nonnull align 8 dereferenceable(48) %0, ptr noundef %1, ptr nocapture noundef readonly %2) local_unnamed_addr #0 align 2 {
  %4 = getelementptr inbounds i8, ptr %0, i64 24
  %5 = tail call noundef zeroext i1 @_ZNKSt6vectorI4NodeSaIS0_EE5emptyEv(ptr noundef nonnull align 8 dereferenceable(24) %4) #2
  br i1 %5, label %27, label %6

6:                                                ; preds = %3
  %7 = getelementptr inbounds i8, ptr %0, i64 8
  %8 = load i32, ptr %7, align 8, !tbaa !5
  %9 = sext i32 %8 to i64
  %10 = getelementptr inbounds ptr, ptr %2, i64 %9
  %11 = load ptr, ptr %10, align 8, !tbaa !15
  %12 = getelementptr inbounds i8, ptr %1, i64 8
  %13 = load i32, ptr %12, align 4, !tbaa !16
  %14 = sext i32 %13 to i64
  %15 = getelementptr inbounds double, ptr %11, i64 %14
  %16 = load double, ptr %15, align 8, !tbaa !19
  %17 = fptosi double %16 to i32
  %18 = getelementptr inbounds i8, ptr %0, i64 12
  %19 = load i32, ptr %18, align 4, !tbaa !21
  %20 = sdiv i32 %17, %19
  %21 = getelementptr inbounds i8, ptr %0, i64 16
  %22 = load i32, ptr %21, align 8, !tbaa !22
  %23 = add nsw i32 %22, %20
  %24 = getelementptr inbounds i8, ptr %1, i64 28
  %25 = load i32, ptr %24, align 4, !tbaa !23
  %26 = add nsw i32 %25, %23
  store i32 %26, ptr %21, align 8, !tbaa !22
  br label %27

27:                                               ; preds = %6, %3
  tail call void @_ZNSt6vectorI4NodeSaIS0_EE9push_backERKS0_(ptr noundef nonnull align 8 dereferenceable(24) %4, ptr noundef nonnull align 4 dereferenceable(32) %1)
  %28 = getelementptr inbounds i8, ptr %1, i64 12
  %29 = load i32, ptr %28, align 4, !tbaa !24
  %30 = getelementptr inbounds i8, ptr %0, i64 4
  %31 = load i32, ptr %30, align 4, !tbaa !25
  %32 = add nsw i32 %31, %29
  store i32 %32, ptr %30, align 4, !tbaa !25
  %33 = getelementptr inbounds i8, ptr %1, i64 8
  %34 = load i32, ptr %33, align 4, !tbaa !16
  %35 = getelementptr inbounds i8, ptr %0, i64 8
  store i32 %34, ptr %35, align 8, !tbaa !5
  %36 = getelementptr inbounds i8, ptr %1, i64 16
  store i8 1, ptr %36, align 4, !tbaa !26
  ret void
}

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZNKSt6vectorI4NodeSaIS0_EE5emptyEv(ptr noundef nonnull align 8 dereferenceable(24)) local_unnamed_addr #1 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt6vectorI4NodeSaIS0_EE9push_backERKS0_(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 4 dereferenceable(32)) 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 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 = { 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, !7, i64 8}
!6 = !{!"_ZTS3Car", !7, i64 0, !7, i64 4, !7, i64 8, !7, i64 12, !7, i64 16, !10, i64 24}
!7 = !{!"int", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!"_ZTSSt6vectorI4NodeSaIS0_EE", !11, i64 0}
!11 = !{!"_ZTSSt12_Vector_baseI4NodeSaIS0_EE", !12, i64 0}
!12 = !{!"_ZTSNSt12_Vector_baseI4NodeSaIS0_EE12_Vector_implE", !13, i64 0}
!13 = !{!"_ZTSNSt12_Vector_baseI4NodeSaIS0_EE17_Vector_impl_dataE", !14, i64 0, !14, i64 8, !14, i64 16}
!14 = !{!"any pointer", !8, i64 0}
!15 = !{!14, !14, i64 0}
!16 = !{!17, !7, i64 8}
!17 = !{!"_ZTS4Node", !7, i64 0, !7, i64 4, !7, i64 8, !7, i64 12, !18, i64 16, !7, i64 20, !7, i64 24, !7, i64 28}
!18 = !{!"bool", !8, i64 0}
!19 = !{!20, !20, i64 0}
!20 = !{!"double", !8, i64 0}
!21 = !{!6, !7, i64 12}
!22 = !{!6, !7, i64 16}
!23 = !{!17, !7, i64 28}
!24 = !{!17, !7, i64 12}
!25 = !{!6, !7, i64 4}
!26 = !{!17, !18, i64 16}


; Effective O3 passes: DSEPass,EarlyCSEPass,GlobalOptPass,InstCombinePass,PostOrderFunctionAttrsPass,ReassociatePass,SROAPass,TailCallElimPass