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

; 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.Node = type { i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, double, double, double, double, double, double, i8, i8, i8 }

; 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 double @llvm.fmuladd.f64(double, double, double) #1

; Function Attrs: nounwind uwtable
define dso_local i32 @Distance_GEO(ptr noundef %0, ptr noundef %1) #2 {
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  %5 = alloca i32, align 4
  %6 = alloca double, align 8
  %7 = alloca double, align 8
  %8 = alloca double, align 8
  %9 = alloca double, align 8
  %10 = alloca double, align 8
  %11 = alloca double, align 8
  %12 = alloca double, align 8
  %13 = alloca double, align 8
  store ptr %0, ptr %3, align 8, !tbaa !5
  store ptr %1, ptr %4, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #4
  %14 = load ptr, ptr %3, align 8, !tbaa !5
  %15 = getelementptr inbounds %struct.Node, ptr %14, i32 0, i32 46
  %16 = load double, ptr %15, align 8, !tbaa !9
  %17 = fptosi double %16 to i32
  store i32 %17, ptr %5, align 4, !tbaa !13
  %18 = load ptr, ptr %3, align 8, !tbaa !5
  %19 = getelementptr inbounds %struct.Node, ptr %18, i32 0, i32 46
  %20 = load double, ptr %19, align 8, !tbaa !9
  %21 = load i32, ptr %5, align 4, !tbaa !13
  %22 = sitofp i32 %21 to double
  %23 = fsub double %20, %22
  store double %23, ptr %10, align 8, !tbaa !14
  %24 = load i32, ptr %5, align 4, !tbaa !13
  %25 = sitofp i32 %24 to double
  %26 = load double, ptr %10, align 8, !tbaa !14
  %27 = fmul double 5.000000e+00, %26
  %28 = fdiv double %27, 3.000000e+00
  %29 = fadd double %25, %28
  %30 = fmul double 0x400921FAFC8B007A, %29
  %31 = fdiv double %30, 1.800000e+02
  store double %31, ptr %6, align 8, !tbaa !14
  %32 = load ptr, ptr %3, align 8, !tbaa !5
  %33 = getelementptr inbounds %struct.Node, ptr %32, i32 0, i32 47
  %34 = load double, ptr %33, align 8, !tbaa !15
  %35 = fptosi double %34 to i32
  store i32 %35, ptr %5, align 4, !tbaa !13
  %36 = load ptr, ptr %3, align 8, !tbaa !5
  %37 = getelementptr inbounds %struct.Node, ptr %36, i32 0, i32 47
  %38 = load double, ptr %37, align 8, !tbaa !15
  %39 = load i32, ptr %5, align 4, !tbaa !13
  %40 = sitofp i32 %39 to double
  %41 = fsub double %38, %40
  store double %41, ptr %10, align 8, !tbaa !14
  %42 = load i32, ptr %5, align 4, !tbaa !13
  %43 = sitofp i32 %42 to double
  %44 = load double, ptr %10, align 8, !tbaa !14
  %45 = fmul double 5.000000e+00, %44
  %46 = fdiv double %45, 3.000000e+00
  %47 = fadd double %43, %46
  %48 = fmul double 0x400921FAFC8B007A, %47
  %49 = fdiv double %48, 1.800000e+02
  store double %49, ptr %7, align 8, !tbaa !14
  %50 = load ptr, ptr %4, align 8, !tbaa !5
  %51 = getelementptr inbounds %struct.Node, ptr %50, i32 0, i32 46
  %52 = load double, ptr %51, align 8, !tbaa !9
  %53 = fptosi double %52 to i32
  store i32 %53, ptr %5, align 4, !tbaa !13
  %54 = load ptr, ptr %4, align 8, !tbaa !5
  %55 = getelementptr inbounds %struct.Node, ptr %54, i32 0, i32 46
  %56 = load double, ptr %55, align 8, !tbaa !9
  %57 = load i32, ptr %5, align 4, !tbaa !13
  %58 = sitofp i32 %57 to double
  %59 = fsub double %56, %58
  store double %59, ptr %10, align 8, !tbaa !14
  %60 = load i32, ptr %5, align 4, !tbaa !13
  %61 = sitofp i32 %60 to double
  %62 = load double, ptr %10, align 8, !tbaa !14
  %63 = fmul double 5.000000e+00, %62
  %64 = fdiv double %63, 3.000000e+00
  %65 = fadd double %61, %64
  %66 = fmul double 0x400921FAFC8B007A, %65
  %67 = fdiv double %66, 1.800000e+02
  store double %67, ptr %8, align 8, !tbaa !14
  %68 = load ptr, ptr %4, align 8, !tbaa !5
  %69 = getelementptr inbounds %struct.Node, ptr %68, i32 0, i32 47
  %70 = load double, ptr %69, align 8, !tbaa !15
  %71 = fptosi double %70 to i32
  store i32 %71, ptr %5, align 4, !tbaa !13
  %72 = load ptr, ptr %4, align 8, !tbaa !5
  %73 = getelementptr inbounds %struct.Node, ptr %72, i32 0, i32 47
  %74 = load double, ptr %73, align 8, !tbaa !15
  %75 = load i32, ptr %5, align 4, !tbaa !13
  %76 = sitofp i32 %75 to double
  %77 = fsub double %74, %76
  store double %77, ptr %10, align 8, !tbaa !14
  %78 = load i32, ptr %5, align 4, !tbaa !13
  %79 = sitofp i32 %78 to double
  %80 = load double, ptr %10, align 8, !tbaa !14
  %81 = fmul double 5.000000e+00, %80
  %82 = fdiv double %81, 3.000000e+00
  %83 = fadd double %79, %82
  %84 = fmul double 0x400921FAFC8B007A, %83
  %85 = fdiv double %84, 1.800000e+02
  store double %85, ptr %9, align 8, !tbaa !14
  %86 = load double, ptr %7, align 8, !tbaa !14
  %87 = load double, ptr %9, align 8, !tbaa !14
  %88 = fsub double %86, %87
  %89 = call double @cos(double noundef %88) #4
  store double %89, ptr %11, align 8, !tbaa !14
  %90 = load double, ptr %6, align 8, !tbaa !14
  %91 = load double, ptr %8, align 8, !tbaa !14
  %92 = fsub double %90, %91
  %93 = call double @cos(double noundef %92) #4
  store double %93, ptr %12, align 8, !tbaa !14
  %94 = load double, ptr %6, align 8, !tbaa !14
  %95 = load double, ptr %8, align 8, !tbaa !14
  %96 = fadd double %94, %95
  %97 = call double @cos(double noundef %96) #4
  store double %97, ptr %13, align 8, !tbaa !14
  %98 = load double, ptr %11, align 8, !tbaa !14
  %99 = fadd double 1.000000e+00, %98
  %100 = load double, ptr %12, align 8, !tbaa !14
  %101 = load double, ptr %11, align 8, !tbaa !14
  %102 = fsub double 1.000000e+00, %101
  %103 = load double, ptr %13, align 8, !tbaa !14
  %104 = fmul double %102, %103
  %105 = fneg double %104
  %106 = call double @llvm.fmuladd.f64(double %99, double %100, double %105)
  %107 = fmul double 5.000000e-01, %106
  %108 = call double @acos(double noundef %107) #4
  %109 = call double @llvm.fmuladd.f64(double 0x40B8EA6353F7CED9, double %108, double 1.000000e+00)
  %110 = fptosi double %109 to i32
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #4
  ret i32 %110
}

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

; Function Attrs: nounwind
declare double @acos(double noundef) #3

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #2 = { 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 = { 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 #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 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !12, i64 312}
!10 = !{!"Node", !11, i64 0, !11, i64 4, !11, i64 8, !11, i64 12, !11, i64 16, !11, i64 20, !11, i64 24, !11, i64 28, !11, i64 32, !11, i64 36, !11, i64 40, !11, i64 44, !11, i64 48, !11, i64 52, !6, i64 56, !6, i64 64, !6, i64 72, !6, i64 80, !6, i64 88, !6, i64 96, !6, i64 104, !6, i64 112, !6, i64 120, !6, i64 128, !6, i64 136, !6, i64 144, !6, i64 152, !6, i64 160, !6, i64 168, !6, i64 176, !6, i64 184, !6, i64 192, !6, i64 200, !6, i64 208, !6, i64 216, !6, i64 224, !6, i64 232, !6, i64 240, !6, i64 248, !6, i64 256, !6, i64 264, !6, i64 272, !6, i64 280, !6, i64 288, !6, i64 296, !6, i64 304, !12, i64 312, !12, i64 320, !12, i64 328, !12, i64 336, !12, i64 344, !12, i64 352, !7, i64 360, !7, i64 361, !7, i64 362}
!11 = !{!"int", !7, i64 0}
!12 = !{!"double", !7, i64 0}
!13 = !{!11, !11, i64 0}
!14 = !{!12, !12, i64 0}
!15 = !{!10, !12, i64 320}


; 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 double @llvm.fmuladd.f64(double, double, double) #0

; Function Attrs: mustprogress nofree nounwind willreturn memory(write, argmem: readwrite) uwtable
define dso_local i32 @Distance_GEO(ptr nocapture noundef readonly %0, ptr nocapture noundef readonly %1) local_unnamed_addr #1 {
  %3 = getelementptr inbounds i8, ptr %0, i64 312
  %4 = load double, ptr %3, align 8, !tbaa !5
  %5 = getelementptr inbounds i8, ptr %0, i64 320
  %6 = load double, ptr %5, align 8, !tbaa !12
  %7 = getelementptr inbounds i8, ptr %1, i64 312
  %8 = load double, ptr %7, align 8, !tbaa !5
  %9 = insertelement <2 x double> poison, double %4, i64 0
  %10 = insertelement <2 x double> %9, double %8, i64 1
  %11 = fptosi <2 x double> %10 to <2 x i32>
  %12 = sitofp <2 x i32> %11 to <2 x double>
  %13 = fsub <2 x double> %10, %12
  %14 = fmul <2 x double> %13, <double 5.000000e+00, double 5.000000e+00>
  %15 = fdiv <2 x double> %14, <double 3.000000e+00, double 3.000000e+00>
  %16 = fadd <2 x double> %15, %12
  %17 = fmul <2 x double> %16, <double 0x400921FAFC8B007A, double 0x400921FAFC8B007A>
  %18 = fdiv <2 x double> %17, <double 1.800000e+02, double 1.800000e+02>
  %19 = getelementptr inbounds i8, ptr %1, i64 320
  %20 = load double, ptr %19, align 8, !tbaa !12
  %21 = insertelement <2 x double> poison, double %6, i64 0
  %22 = insertelement <2 x double> %21, double %20, i64 1
  %23 = fptosi <2 x double> %22 to <2 x i32>
  %24 = sitofp <2 x i32> %23 to <2 x double>
  %25 = fsub <2 x double> %22, %24
  %26 = fmul <2 x double> %25, <double 5.000000e+00, double 5.000000e+00>
  %27 = fdiv <2 x double> %26, <double 3.000000e+00, double 3.000000e+00>
  %28 = fadd <2 x double> %27, %24
  %29 = fmul <2 x double> %28, <double 0x400921FAFC8B007A, double 0x400921FAFC8B007A>
  %30 = fdiv <2 x double> %29, <double 1.800000e+02, double 1.800000e+02>
  %shift = shufflevector <2 x double> %30, <2 x double> poison, <2 x i32> <i32 1, i32 poison>
  %31 = fsub <2 x double> %30, %shift
  %32 = extractelement <2 x double> %31, i64 0
  %33 = tail call double @cos(double noundef %32) #3
  %34 = extractelement <2 x double> %18, i64 0
  %35 = extractelement <2 x double> %18, i64 1
  %36 = fsub double %34, %35
  %37 = tail call double @cos(double noundef %36) #3
  %38 = fadd double %34, %35
  %39 = tail call double @cos(double noundef %38) #3
  %40 = fadd double %33, 1.000000e+00
  %41 = fsub double 1.000000e+00, %33
  %42 = fneg double %41
  %43 = fmul double %39, %42
  %44 = tail call double @llvm.fmuladd.f64(double %40, double %37, double %43)
  %45 = fmul double %44, 5.000000e-01
  %46 = tail call double @acos(double noundef %45) #3
  %47 = tail call double @llvm.fmuladd.f64(double %46, double 0x40B8EA6353F7CED9, double 1.000000e+00)
  %48 = fptosi double %47 to i32
  ret i32 %48
}

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

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

attributes #0 = { mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #1 = { mustprogress nofree nounwind willreturn memory(write, argmem: readwrite) 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 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 #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, !11, i64 312}
!6 = !{!"Node", !7, i64 0, !7, i64 4, !7, i64 8, !7, i64 12, !7, i64 16, !7, i64 20, !7, i64 24, !7, i64 28, !7, i64 32, !7, i64 36, !7, i64 40, !7, i64 44, !7, i64 48, !7, i64 52, !10, i64 56, !10, i64 64, !10, i64 72, !10, i64 80, !10, i64 88, !10, i64 96, !10, i64 104, !10, i64 112, !10, i64 120, !10, i64 128, !10, i64 136, !10, i64 144, !10, i64 152, !10, i64 160, !10, i64 168, !10, i64 176, !10, i64 184, !10, i64 192, !10, i64 200, !10, i64 208, !10, i64 216, !10, i64 224, !10, i64 232, !10, i64 240, !10, i64 248, !10, i64 256, !10, i64 264, !10, i64 272, !10, i64 280, !10, i64 288, !10, i64 296, !10, i64 304, !11, i64 312, !11, i64 320, !11, i64 328, !11, i64 336, !11, i64 344, !11, i64 352, !8, i64 360, !8, i64 361, !8, i64 362}
!7 = !{!"int", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"any pointer", !8, i64 0}
!11 = !{!"double", !8, i64 0}
!12 = !{!6, !11, i64 320}


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