; LLVM IR from RiteshKH/Particle-Swarm-Optimiztion-based-Global-Path-planning :: PSO.ll (Z7fitness5CoordS_)

; 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.Coord = type { double, double, double, double }

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

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

; Function Attrs: mustprogress uwtable
declare dso_local noundef double @_Z8shortfit5CoordS_(ptr noundef byval(%struct.Coord) align 8, ptr noundef byval(%struct.Coord) align 8) #1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef double @_Z9smoothfit5CoordS_S_(ptr noundef byval(%struct.Coord) align 8, ptr noundef byval(%struct.Coord) align 8, ptr noundef byval(%struct.Coord) align 8) #2

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare double @llvm.fmuladd.f64(double, double, double) #3

; Function Attrs: mustprogress uwtable
define dso_local noundef double @_Z7fitness5CoordS_(ptr noundef byval(%struct.Coord) align 8 %0, ptr noundef byval(%struct.Coord) align 8 %1) #1 {
  %3 = alloca %struct.Coord, align 8
  %4 = alloca double, align 8
  %5 = alloca %struct.Coord, align 8
  %6 = alloca %struct.Coord, align 8
  %7 = alloca double, align 8
  %8 = alloca %struct.Coord, align 8
  %9 = alloca %struct.Coord, align 8
  %10 = alloca %struct.Coord, align 8
  %11 = alloca double, align 8
  %12 = alloca double, align 8
  %13 = alloca double, align 8
  call void @llvm.lifetime.start.p0(i64 32, ptr %3) #5
  %14 = getelementptr inbounds %struct.Coord, ptr %3, i32 0, i32 0
  store double -5.000000e+02, ptr %14, align 8, !tbaa !5
  %15 = getelementptr inbounds %struct.Coord, ptr %3, i32 0, i32 1
  store double -1.000000e+03, ptr %15, align 8, !tbaa !10
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #5
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %5, ptr align 8 %0, i64 32, i1 false), !tbaa.struct !11
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %6, ptr align 8 %3, i64 32, i1 false), !tbaa.struct !11
  %16 = call noundef double @_Z8shortfit5CoordS_(ptr noundef byval(%struct.Coord) align 8 %5, ptr noundef byval(%struct.Coord) align 8 %6)
  store double %16, ptr %4, align 8, !tbaa !12
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #5
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %8, ptr align 8 %0, i64 32, i1 false), !tbaa.struct !11
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %9, ptr align 8 %3, i64 32, i1 false), !tbaa.struct !11
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %10, ptr align 8 %1, i64 32, i1 false), !tbaa.struct !11
  %17 = call noundef double @_Z9smoothfit5CoordS_S_(ptr noundef byval(%struct.Coord) align 8 %8, ptr noundef byval(%struct.Coord) align 8 %9, ptr noundef byval(%struct.Coord) align 8 %10)
  store double %17, ptr %7, align 8, !tbaa !12
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #5
  store double 1.000000e+00, ptr %11, align 8, !tbaa !12
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #5
  store double 1.000000e+00, ptr %12, align 8, !tbaa !12
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #5
  %18 = load double, ptr %11, align 8, !tbaa !12
  %19 = load double, ptr %4, align 8, !tbaa !12
  %20 = load double, ptr %12, align 8, !tbaa !12
  %21 = load double, ptr %7, align 8, !tbaa !12
  %22 = fmul double %20, %21
  %23 = call double @llvm.fmuladd.f64(double %18, double %19, double %22)
  store double %23, ptr %13, align 8, !tbaa !12
  %24 = load double, ptr %13, align 8, !tbaa !12
  %25 = fdiv double 1.000000e+00, %24
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #5
  call void @llvm.lifetime.end.p0(i64 32, ptr %3) #5
  ret double %25
}

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #4

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #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 nosync nounwind speculatable willreturn memory(none) }
attributes #4 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #5 = { 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 0}
!6 = !{!"_ZTS5Coord", !7, i64 0, !7, i64 8, !7, i64 16, !7, i64 24}
!7 = !{!"double", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!6, !7, i64 8}
!11 = !{i64 0, i64 8, !12, i64 8, i64 8, !12, i64 16, i64 8, !12, i64 24, i64 8, !12}
!12 = !{!7, !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.Coord = type { double, double, double, double }

; Function Attrs: mustprogress uwtable
declare dso_local noundef double @_Z8shortfit5CoordS_(ptr noundef byval(%struct.Coord) align 8, ptr noundef byval(%struct.Coord) align 8) local_unnamed_addr #0

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef double @_Z9smoothfit5CoordS_S_(ptr noundef byval(%struct.Coord) align 8, ptr noundef byval(%struct.Coord) align 8, ptr noundef byval(%struct.Coord) align 8) local_unnamed_addr #1

; Function Attrs: mustprogress uwtable
define dso_local noundef double @_Z7fitness5CoordS_(ptr nocapture noundef readonly byval(%struct.Coord) align 8 %0, ptr nocapture noundef readonly byval(%struct.Coord) align 8 %1) local_unnamed_addr #0 {
  %3 = alloca %struct.Coord, align 16
  %4 = alloca %struct.Coord, align 16
  store <2 x double> <double -5.000000e+02, double -1.000000e+03>, ptr %3, align 16, !tbaa !5
  %5 = tail call noundef double @_Z8shortfit5CoordS_(ptr noundef nonnull byval(%struct.Coord) align 8 %0, ptr noundef nonnull byval(%struct.Coord) align 8 %3)
  store <2 x double> <double -5.000000e+02, double -1.000000e+03>, ptr %4, align 16, !tbaa !5
  %6 = tail call noundef double @_Z9smoothfit5CoordS_S_(ptr noundef nonnull byval(%struct.Coord) align 8 %0, ptr noundef nonnull byval(%struct.Coord) align 8 %4, ptr noundef nonnull byval(%struct.Coord) align 8 %1)
  %7 = fadd double %5, %6
  %8 = fdiv double 1.000000e+00, %7
  ret double %8
}

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

!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 = !{!"double", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}


; Effective O3 passes: CorrelatedValuePropagationPass,DSEPass,EarlyCSEPass,GlobalOptPass,InferAlignmentPass,InferFunctionAttrsPass,InstCombinePass,MemCpyOptPass,PostOrderFunctionAttrsPass,SLPVectorizerPass,SROAPass,TailCallElimPass