; LLVM IR from fcimeson/cbTSP :: cbLKH/SRC (GeoConversion)

; 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: nounwind uwtable
define dso_local void @GEO2XYZ(double noundef %0, double noundef %1, ptr noundef %2, ptr noundef %3, ptr noundef %4) #0 {
  %6 = alloca double, align 8
  %7 = alloca double, align 8
  %8 = alloca ptr, align 8
  %9 = alloca ptr, align 8
  %10 = alloca ptr, align 8
  %11 = alloca double, align 8
  %12 = alloca double, align 8
  %13 = alloca double, align 8
  %14 = alloca double, align 8
  %15 = alloca double, align 8
  store double %0, ptr %6, align 8, !tbaa !5
  store double %1, ptr %7, align 8, !tbaa !5
  store ptr %2, ptr %8, align 8, !tbaa !9
  store ptr %3, ptr %9, align 8, !tbaa !9
  store ptr %4, ptr %10, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #3
  %16 = load double, ptr %6, align 8, !tbaa !5
  %17 = fptosi double %16 to i32
  %18 = sitofp i32 %17 to double
  %19 = load double, ptr %6, align 8, !tbaa !5
  %20 = load double, ptr %6, align 8, !tbaa !5
  %21 = fptosi double %20 to i32
  %22 = sitofp i32 %21 to double
  %23 = fsub double %19, %22
  %24 = fmul double 5.000000e+00, %23
  %25 = fdiv double %24, 3.000000e+00
  %26 = fadd double %18, %25
  store double %26, ptr %11, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #3
  %27 = load double, ptr %7, align 8, !tbaa !5
  %28 = fptosi double %27 to i32
  %29 = sitofp i32 %28 to double
  %30 = load double, ptr %7, align 8, !tbaa !5
  %31 = load double, ptr %7, align 8, !tbaa !5
  %32 = fptosi double %31 to i32
  %33 = sitofp i32 %32 to double
  %34 = fsub double %30, %33
  %35 = fmul double 5.000000e+00, %34
  %36 = fdiv double %35, 3.000000e+00
  %37 = fadd double %29, %36
  store double %37, ptr %12, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #3
  %38 = load double, ptr %11, align 8, !tbaa !5
  %39 = fmul double 0x400921FAFC8B007A, %38
  %40 = fdiv double %39, 1.800000e+02
  store double %40, ptr %13, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #3
  %41 = load double, ptr %12, align 8, !tbaa !5
  %42 = fmul double 0x400921FAFC8B007A, %41
  %43 = fdiv double %42, 1.800000e+02
  store double %43, ptr %14, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #3
  %44 = load double, ptr %13, align 8, !tbaa !5
  %45 = call double @cos(double noundef %44) #3
  store double %45, ptr %15, align 8, !tbaa !5
  %46 = load double, ptr %15, align 8, !tbaa !5
  %47 = fmul double 0x40B8EA6353F7CED9, %46
  %48 = load double, ptr %14, align 8, !tbaa !5
  %49 = call double @cos(double noundef %48) #3
  %50 = fmul double %47, %49
  %51 = load ptr, ptr %8, align 8, !tbaa !9
  store double %50, ptr %51, align 8, !tbaa !5
  %52 = load double, ptr %15, align 8, !tbaa !5
  %53 = fmul double 0x40B8EA6353F7CED9, %52
  %54 = load double, ptr %14, align 8, !tbaa !5
  %55 = call double @sin(double noundef %54) #3
  %56 = fmul double %53, %55
  %57 = load ptr, ptr %9, align 8, !tbaa !9
  store double %56, ptr %57, align 8, !tbaa !5
  %58 = load double, ptr %13, align 8, !tbaa !5
  %59 = call double @sin(double noundef %58) #3
  %60 = fmul double 0x40B8EA6353F7CED9, %59
  %61 = load ptr, ptr %10, align 8, !tbaa !9
  store double %60, ptr %61, align 8, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #3
  ret void
}

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

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

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

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

attributes #0 = { 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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { 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/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 nofree nounwind willreturn memory(write) uwtable
define dso_local void @GEO2XYZ(double noundef %0, double noundef %1, ptr nocapture noundef writeonly %2, ptr nocapture noundef writeonly %3, ptr nocapture noundef writeonly %4) local_unnamed_addr #0 {
  %6 = fptosi double %0 to i32
  %7 = sitofp i32 %6 to double
  %8 = fsub double %0, %7
  %9 = fmul double %8, 5.000000e+00
  %10 = fdiv double %9, 3.000000e+00
  %11 = fadd double %10, %7
  %12 = fptosi double %1 to i32
  %13 = sitofp i32 %12 to double
  %14 = fsub double %1, %13
  %15 = fmul double %14, 5.000000e+00
  %16 = fdiv double %15, 3.000000e+00
  %17 = fadd double %16, %13
  %18 = fmul double %11, 0x400921FAFC8B007A
  %19 = fdiv double %18, 1.800000e+02
  %20 = fmul double %17, 0x400921FAFC8B007A
  %21 = fdiv double %20, 1.800000e+02
  %22 = tail call double @cos(double noundef %19) #2
  %23 = fmul double %22, 0x40B8EA6353F7CED9
  %24 = tail call double @cos(double noundef %21) #2
  %25 = fmul double %23, %24
  store double %25, ptr %2, align 8, !tbaa !5
  %26 = tail call double @sin(double noundef %21) #2
  %27 = fmul double %23, %26
  store double %27, ptr %3, align 8, !tbaa !5
  %28 = tail call double @sin(double noundef %19) #2
  %29 = fmul double %28, 0x40B8EA6353F7CED9
  store double %29, ptr %4, align 8, !tbaa !5
  ret void
}

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

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

attributes #0 = { mustprogress nofree nounwind willreturn memory(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 #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 = { 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/C++ TBAA"}


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