; LLVM IR from shupx/swarm_sync_sim :: src/fw_plane_sim/src/px4_lib/geo (geo)

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

; 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: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare float @llvm.fabs.f32(float) #1

; Function Attrs: nounwind
declare float @sqrtf(float noundef) #2

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare float @llvm.fmuladd.f32(float, float, float) #1

; Function Attrs: mustprogress nounwind uwtable
define dso_local noundef float @_Z35mavlink_wpm_distance_to_point_localffffffPfS_(float noundef %0, float noundef %1, float noundef %2, float noundef %3, float noundef %4, float noundef %5, ptr noundef %6, ptr noundef %7) #3 {
  %9 = alloca float, align 4
  %10 = alloca float, align 4
  %11 = alloca float, align 4
  %12 = alloca float, align 4
  %13 = alloca float, align 4
  %14 = alloca float, align 4
  %15 = alloca ptr, align 8
  %16 = alloca ptr, align 8
  %17 = alloca float, align 4
  %18 = alloca float, align 4
  %19 = alloca float, align 4
  store float %0, ptr %9, align 4, !tbaa !5
  store float %1, ptr %10, align 4, !tbaa !5
  store float %2, ptr %11, align 4, !tbaa !5
  store float %3, ptr %12, align 4, !tbaa !5
  store float %4, ptr %13, align 4, !tbaa !5
  store float %5, ptr %14, align 4, !tbaa !5
  store ptr %6, ptr %15, align 8, !tbaa !9
  store ptr %7, ptr %16, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %17) #4
  %20 = load float, ptr %9, align 4, !tbaa !5
  %21 = load float, ptr %12, align 4, !tbaa !5
  %22 = fsub float %20, %21
  store float %22, ptr %17, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %18) #4
  %23 = load float, ptr %10, align 4, !tbaa !5
  %24 = load float, ptr %13, align 4, !tbaa !5
  %25 = fsub float %23, %24
  store float %25, ptr %18, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %19) #4
  %26 = load float, ptr %11, align 4, !tbaa !5
  %27 = load float, ptr %14, align 4, !tbaa !5
  %28 = fsub float %26, %27
  store float %28, ptr %19, align 4, !tbaa !5
  %29 = load float, ptr %17, align 4, !tbaa !5
  %30 = load float, ptr %17, align 4, !tbaa !5
  %31 = load float, ptr %18, align 4, !tbaa !5
  %32 = load float, ptr %18, align 4, !tbaa !5
  %33 = fmul float %31, %32
  %34 = call float @llvm.fmuladd.f32(float %29, float %30, float %33)
  %35 = call float @sqrtf(float noundef %34) #4
  %36 = load ptr, ptr %15, align 8, !tbaa !9
  store float %35, ptr %36, align 4, !tbaa !5
  %37 = load float, ptr %19, align 4, !tbaa !5
  %38 = call float @llvm.fabs.f32(float %37)
  %39 = load ptr, ptr %16, align 8, !tbaa !9
  store float %38, ptr %39, align 4, !tbaa !5
  %40 = load float, ptr %17, align 4, !tbaa !5
  %41 = load float, ptr %17, align 4, !tbaa !5
  %42 = load float, ptr %18, align 4, !tbaa !5
  %43 = load float, ptr %18, align 4, !tbaa !5
  %44 = fmul float %42, %43
  %45 = call float @llvm.fmuladd.f32(float %40, float %41, float %44)
  %46 = load float, ptr %19, align 4, !tbaa !5
  %47 = load float, ptr %19, align 4, !tbaa !5
  %48 = call float @llvm.fmuladd.f32(float %46, float %47, float %45)
  %49 = call float @sqrtf(float noundef %48) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %19) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %18) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #4
  ret float %49
}

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #2 = { nounwind "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 = { 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 #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 = !{!"float", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"any pointer", !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"

; Function Attrs: mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare float @llvm.fabs.f32(float) #0

; Function Attrs: mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare float @llvm.fmuladd.f32(float, float, float) #0

; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: write) uwtable
define dso_local noundef float @_Z35mavlink_wpm_distance_to_point_localffffffPfS_(float noundef %0, float noundef %1, float noundef %2, float noundef %3, float noundef %4, float noundef %5, ptr nocapture noundef writeonly %6, ptr nocapture noundef writeonly %7) local_unnamed_addr #1 {
  %9 = fsub float %0, %3
  %10 = fsub float %1, %4
  %11 = fsub float %2, %5
  %12 = fmul float %10, %10
  %13 = tail call float @llvm.fmuladd.f32(float %9, float %9, float %12)
  %sqrt19 = tail call float @llvm.sqrt.f32(float %13)
  store float %sqrt19, ptr %6, align 4, !tbaa !5
  %14 = tail call float @llvm.fabs.f32(float %11)
  store float %14, ptr %7, align 4, !tbaa !5
  %15 = tail call float @llvm.fmuladd.f32(float %11, float %11, float %13)
  %sqrt = tail call float @llvm.sqrt.f32(float %15)
  ret float %sqrt
}

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare float @llvm.sqrt.f32(float) #2

attributes #0 = { mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #1 = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: write) 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 speculatable willreturn memory(none) }

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


; Effective O3 passes: AggressiveInstCombinePass,EarlyCSEPass,GlobalOptPass,InferFunctionAttrsPass,PostOrderFunctionAttrsPass,SROAPass,TailCallElimPass