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

; 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: mustprogress nounwind uwtable
declare dso_local noundef double @_ZN4math7radiansIdEET_S1_(double noundef) #0

; Function Attrs: nounwind
declare double @sin(double noundef) #1

; Function Attrs: nounwind
declare double @cos(double noundef) #1

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

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

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

; Function Attrs: nounwind
declare double @sqrt(double noundef) #1

; Function Attrs: nounwind
declare double @atan2(double noundef, double noundef) #1

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

; Function Attrs: mustprogress uwtable
define dso_local noundef float @_Z34get_distance_to_point_global_wgs84ddfddfPfS_(double noundef %0, double noundef %1, float noundef %2, double noundef %3, double noundef %4, float noundef %5, ptr noundef %6, ptr noundef %7) #4 {
  %9 = alloca double, align 8
  %10 = alloca double, align 8
  %11 = alloca float, align 4
  %12 = alloca double, align 8
  %13 = alloca double, align 8
  %14 = alloca float, align 4
  %15 = alloca ptr, align 8
  %16 = alloca ptr, align 8
  %17 = alloca double, align 8
  %18 = alloca double, align 8
  %19 = alloca double, align 8
  %20 = alloca double, align 8
  %21 = alloca double, align 8
  %22 = alloca double, align 8
  %23 = alloca double, align 8
  %24 = alloca double, align 8
  %25 = alloca float, align 4
  %26 = alloca float, align 4
  store double %0, ptr %9, align 8, !tbaa !5
  store double %1, ptr %10, align 8, !tbaa !5
  store float %2, ptr %11, align 4, !tbaa !9
  store double %3, ptr %12, align 8, !tbaa !5
  store double %4, ptr %13, align 8, !tbaa !5
  store float %5, ptr %14, align 4, !tbaa !9
  store ptr %6, ptr %15, align 8, !tbaa !11
  store ptr %7, ptr %16, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 8, ptr %17) #5
  %27 = load double, ptr %12, align 8, !tbaa !5
  %28 = call noundef double @_ZN4math7radiansIdEET_S1_(double noundef %27)
  store double %28, ptr %17, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %18) #5
  %29 = load double, ptr %13, align 8, !tbaa !5
  %30 = call noundef double @_ZN4math7radiansIdEET_S1_(double noundef %29)
  store double %30, ptr %18, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %19) #5
  %31 = load double, ptr %9, align 8, !tbaa !5
  %32 = call noundef double @_ZN4math7radiansIdEET_S1_(double noundef %31)
  store double %32, ptr %19, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %20) #5
  %33 = load double, ptr %10, align 8, !tbaa !5
  %34 = call noundef double @_ZN4math7radiansIdEET_S1_(double noundef %33)
  store double %34, ptr %20, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %21) #5
  %35 = load double, ptr %19, align 8, !tbaa !5
  %36 = load double, ptr %17, align 8, !tbaa !5
  %37 = fsub double %35, %36
  store double %37, ptr %21, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %22) #5
  %38 = load double, ptr %20, align 8, !tbaa !5
  %39 = load double, ptr %18, align 8, !tbaa !5
  %40 = fsub double %38, %39
  store double %40, ptr %22, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %23) #5
  %41 = load double, ptr %21, align 8, !tbaa !5
  %42 = fdiv double %41, 2.000000e+00
  %43 = call double @sin(double noundef %42) #5
  %44 = load double, ptr %21, align 8, !tbaa !5
  %45 = fdiv double %44, 2.000000e+00
  %46 = call double @sin(double noundef %45) #5
  %47 = load double, ptr %22, align 8, !tbaa !5
  %48 = fdiv double %47, 2.000000e+00
  %49 = call double @sin(double noundef %48) #5
  %50 = load double, ptr %22, align 8, !tbaa !5
  %51 = fdiv double %50, 2.000000e+00
  %52 = call double @sin(double noundef %51) #5
  %53 = fmul double %49, %52
  %54 = load double, ptr %17, align 8, !tbaa !5
  %55 = call double @cos(double noundef %54) #5
  %56 = fmul double %53, %55
  %57 = load double, ptr %19, align 8, !tbaa !5
  %58 = call double @cos(double noundef %57) #5
  %59 = fmul double %56, %58
  %60 = call double @llvm.fmuladd.f64(double %43, double %46, double %59)
  store double %60, ptr %23, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %24) #5
  %61 = load double, ptr %23, align 8, !tbaa !5
  %62 = call double @sqrt(double noundef %61) #5
  %63 = load double, ptr %23, align 8, !tbaa !5
  %64 = fsub double 1.000000e+00, %63
  %65 = call double @sqrt(double noundef %64) #5
  %66 = call double @atan2(double noundef %62, double noundef %65) #5
  %67 = fmul double 2.000000e+00, %66
  store double %67, ptr %24, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %25) #5
  %68 = load double, ptr %24, align 8, !tbaa !5
  %69 = fmul double 6.371000e+06, %68
  %70 = fptrunc double %69 to float
  store float %70, ptr %25, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %26) #5
  %71 = load float, ptr %11, align 4, !tbaa !9
  %72 = load float, ptr %14, align 4, !tbaa !9
  %73 = fsub float %71, %72
  store float %73, ptr %26, align 4, !tbaa !9
  %74 = load float, ptr %25, align 4, !tbaa !9
  %75 = call float @llvm.fabs.f32(float %74)
  %76 = load ptr, ptr %15, align 8, !tbaa !11
  store float %75, ptr %76, align 4, !tbaa !9
  %77 = load float, ptr %26, align 4, !tbaa !9
  %78 = call float @llvm.fabs.f32(float %77)
  %79 = load ptr, ptr %16, align 8, !tbaa !11
  store float %78, ptr %79, align 4, !tbaa !9
  %80 = load float, ptr %25, align 4, !tbaa !9
  %81 = load float, ptr %25, align 4, !tbaa !9
  %82 = load float, ptr %26, align 4, !tbaa !9
  %83 = load float, ptr %26, align 4, !tbaa !9
  %84 = fmul float %82, %83
  %85 = call float @llvm.fmuladd.f32(float %80, float %81, float %84)
  %86 = call float @sqrtf(float noundef %85) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %26) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %25) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %24) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %23) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %22) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %21) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %20) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %19) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %18) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #5
  ret float %86
}

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

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

attributes #0 = { 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 #1 = { 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 #2 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #4 = { 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 #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, !6, i64 0}
!6 = !{!"double", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"float", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"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 nounwind uwtable
declare dso_local noundef double @_ZN4math7radiansIdEET_S1_(double noundef) local_unnamed_addr #0

; Function Attrs: mustprogress nofree nounwind willreturn memory(write)
declare double @sin(double noundef) local_unnamed_addr #1

; Function Attrs: mustprogress nofree nounwind willreturn memory(write)
declare double @cos(double noundef) local_unnamed_addr #1

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

; Function Attrs: mustprogress nofree nounwind willreturn memory(write)
declare double @sqrt(double noundef) local_unnamed_addr #1

; Function Attrs: mustprogress nofree nounwind willreturn memory(write)
declare double @atan2(double noundef, double noundef) local_unnamed_addr #1

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

; Function Attrs: mustprogress nounwind uwtable
define dso_local noundef float @_Z34get_distance_to_point_global_wgs84ddfddfPfS_(double noundef %0, double noundef %1, float noundef %2, double noundef %3, double noundef %4, float noundef %5, ptr nocapture noundef writeonly %6, ptr nocapture noundef writeonly %7) local_unnamed_addr #0 {
  %9 = tail call noundef double @_ZN4math7radiansIdEET_S1_(double noundef %3)
  %10 = tail call noundef double @_ZN4math7radiansIdEET_S1_(double noundef %4)
  %11 = tail call noundef double @_ZN4math7radiansIdEET_S1_(double noundef %0)
  %12 = tail call noundef double @_ZN4math7radiansIdEET_S1_(double noundef %1)
  %13 = fsub double %11, %9
  %14 = fsub double %12, %10
  %15 = fmul double %13, 5.000000e-01
  %16 = tail call double @sin(double noundef %15) #4
  %17 = tail call double @sin(double noundef %15) #4
  %18 = fmul double %14, 5.000000e-01
  %19 = tail call double @sin(double noundef %18) #4
  %20 = tail call double @sin(double noundef %18) #4
  %21 = fmul double %19, %20
  %22 = tail call double @cos(double noundef %9) #4
  %23 = fmul double %21, %22
  %24 = tail call double @cos(double noundef %11) #4
  %25 = fmul double %23, %24
  %26 = tail call double @llvm.fmuladd.f64(double %16, double %17, double %25)
  %27 = tail call double @sqrt(double noundef %26) #4
  %28 = fsub double 1.000000e+00, %26
  %29 = tail call double @sqrt(double noundef %28) #4
  %30 = tail call double @atan2(double noundef %27, double noundef %29) #4
  %31 = fmul double %30, 2.000000e+00
  %32 = fmul double %31, 6.371000e+06
  %33 = fptrunc double %32 to float
  %34 = fsub float %2, %5
  %35 = tail call float @llvm.fabs.f32(float %33)
  store float %35, ptr %6, align 4, !tbaa !5
  %36 = tail call float @llvm.fabs.f32(float %34)
  store float %36, ptr %7, align 4, !tbaa !5
  %37 = fmul float %34, %34
  %38 = tail call float @llvm.fmuladd.f32(float %33, float %33, float %37)
  %sqrt = tail call float @llvm.sqrt.f32(float %38)
  ret float %sqrt
}

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

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

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


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