; LLVM IR from FSmallenburg/EDMD :: Multi (mdMulti)

; 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.sparticle = type { double, double, double, double, double, double, double, double, double, [24 x ptr], i8, double, double, double, i8, i32, i32, i32, i32, ptr, ptr, ptr, 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
declare double @sqrt(double noundef) #2

; Function Attrs: nounwind uwtable
define dso_local double @findneighborlistupdate(ptr noundef %0) #3 {
  %2 = alloca ptr, align 8
  %3 = alloca double, align 8
  %4 = alloca double, align 8
  %5 = alloca double, align 8
  %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
  %14 = alloca double, align 8
  store ptr %0, ptr %2, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %3) #4
  %15 = load ptr, ptr %2, align 8, !tbaa !5
  %16 = getelementptr inbounds %struct.sparticle, ptr %15, i32 0, i32 0
  %17 = load double, ptr %16, align 8, !tbaa !9
  %18 = load ptr, ptr %2, align 8, !tbaa !5
  %19 = getelementptr inbounds %struct.sparticle, ptr %18, i32 0, i32 6
  %20 = load double, ptr %19, align 8, !tbaa !13
  %21 = fsub double %17, %20
  store double %21, ptr %3, align 8, !tbaa !14
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #4
  %22 = load ptr, ptr %2, align 8, !tbaa !5
  %23 = getelementptr inbounds %struct.sparticle, ptr %22, i32 0, i32 1
  %24 = load double, ptr %23, align 8, !tbaa !15
  %25 = load ptr, ptr %2, align 8, !tbaa !5
  %26 = getelementptr inbounds %struct.sparticle, ptr %25, i32 0, i32 7
  %27 = load double, ptr %26, align 8, !tbaa !16
  %28 = fsub double %24, %27
  store double %28, ptr %4, align 8, !tbaa !14
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #4
  %29 = load ptr, ptr %2, align 8, !tbaa !5
  %30 = getelementptr inbounds %struct.sparticle, ptr %29, i32 0, i32 2
  %31 = load double, ptr %30, align 8, !tbaa !17
  %32 = load ptr, ptr %2, align 8, !tbaa !5
  %33 = getelementptr inbounds %struct.sparticle, ptr %32, i32 0, i32 8
  %34 = load double, ptr %33, align 8, !tbaa !18
  %35 = fsub double %31, %34
  store double %35, ptr %5, align 8, !tbaa !14
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #4
  %36 = load ptr, ptr %2, align 8, !tbaa !5
  %37 = getelementptr inbounds %struct.sparticle, ptr %36, i32 0, i32 3
  %38 = load double, ptr %37, align 8, !tbaa !19
  store double %38, ptr %6, align 8, !tbaa !14
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #4
  %39 = load ptr, ptr %2, align 8, !tbaa !5
  %40 = getelementptr inbounds %struct.sparticle, ptr %39, i32 0, i32 4
  %41 = load double, ptr %40, align 8, !tbaa !20
  store double %41, ptr %7, align 8, !tbaa !14
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #4
  %42 = load ptr, ptr %2, align 8, !tbaa !5
  %43 = getelementptr inbounds %struct.sparticle, ptr %42, i32 0, i32 5
  %44 = load double, ptr %43, align 8, !tbaa !21
  store double %44, ptr %8, align 8, !tbaa !14
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #4
  %45 = load double, ptr %3, align 8, !tbaa !14
  %46 = load double, ptr %6, align 8, !tbaa !14
  %47 = load double, ptr %4, align 8, !tbaa !14
  %48 = load double, ptr %7, align 8, !tbaa !14
  %49 = fmul double %47, %48
  %50 = call double @llvm.fmuladd.f64(double %45, double %46, double %49)
  %51 = load double, ptr %5, align 8, !tbaa !14
  %52 = load double, ptr %8, align 8, !tbaa !14
  %53 = call double @llvm.fmuladd.f64(double %51, double %52, double %50)
  store double %53, ptr %9, align 8, !tbaa !14
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #4
  %54 = load double, ptr %6, align 8, !tbaa !14
  %55 = load double, ptr %6, align 8, !tbaa !14
  %56 = load double, ptr %7, align 8, !tbaa !14
  %57 = load double, ptr %7, align 8, !tbaa !14
  %58 = fmul double %56, %57
  %59 = call double @llvm.fmuladd.f64(double %54, double %55, double %58)
  %60 = load double, ptr %8, align 8, !tbaa !14
  %61 = load double, ptr %8, align 8, !tbaa !14
  %62 = call double @llvm.fmuladd.f64(double %60, double %61, double %59)
  store double %62, ptr %10, align 8, !tbaa !14
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #4
  %63 = load double, ptr %3, align 8, !tbaa !14
  %64 = load double, ptr %3, align 8, !tbaa !14
  %65 = load double, ptr %4, align 8, !tbaa !14
  %66 = load double, ptr %4, align 8, !tbaa !14
  %67 = fmul double %65, %66
  %68 = call double @llvm.fmuladd.f64(double %63, double %64, double %67)
  %69 = load double, ptr %5, align 8, !tbaa !14
  %70 = load double, ptr %5, align 8, !tbaa !14
  %71 = call double @llvm.fmuladd.f64(double %69, double %70, double %68)
  store double %71, ptr %11, align 8, !tbaa !14
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #4
  %72 = load ptr, ptr %2, align 8, !tbaa !5
  %73 = getelementptr inbounds %struct.sparticle, ptr %72, i32 0, i32 12
  %74 = load double, ptr %73, align 8, !tbaa !22
  %75 = fmul double 5.000000e-01, %74
  store double %75, ptr %12, align 8, !tbaa !14
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #4
  %76 = load double, ptr %9, align 8, !tbaa !14
  %77 = load double, ptr %9, align 8, !tbaa !14
  %78 = load double, ptr %10, align 8, !tbaa !14
  %79 = load double, ptr %11, align 8, !tbaa !14
  %80 = load double, ptr %12, align 8, !tbaa !14
  %81 = load double, ptr %12, align 8, !tbaa !14
  %82 = fneg double %80
  %83 = call double @llvm.fmuladd.f64(double %82, double %81, double %79)
  %84 = fmul double %78, %83
  %85 = fneg double %84
  %86 = call double @llvm.fmuladd.f64(double %76, double %77, double %85)
  store double %86, ptr %13, align 8, !tbaa !14
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #4
  %87 = load double, ptr %9, align 8, !tbaa !14
  %88 = fneg double %87
  %89 = load double, ptr %13, align 8, !tbaa !14
  %90 = call double @sqrt(double noundef %89) #4
  %91 = fadd double %88, %90
  %92 = load double, ptr %10, align 8, !tbaa !14
  %93 = fdiv double %91, %92
  store double %93, ptr %14, align 8, !tbaa !14
  %94 = load double, ptr %14, align 8, !tbaa !14
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #4
  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 8, ptr %5) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %3) #4
  ret double %94
}

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 = { 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 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !11, i64 0}
!10 = !{!"sparticle", !11, i64 0, !11, i64 8, !11, i64 16, !11, i64 24, !11, i64 32, !11, i64 40, !11, i64 48, !11, i64 56, !11, i64 64, !7, i64 72, !7, i64 264, !11, i64 272, !11, i64 280, !11, i64 288, !7, i64 296, !12, i64 300, !12, i64 304, !12, i64 308, !12, i64 312, !6, i64 320, !6, i64 328, !6, i64 336, !7, i64 344}
!11 = !{!"double", !7, i64 0}
!12 = !{!"int", !7, i64 0}
!13 = !{!10, !11, i64 48}
!14 = !{!11, !11, i64 0}
!15 = !{!10, !11, i64 8}
!16 = !{!10, !11, i64 56}
!17 = !{!10, !11, i64 16}
!18 = !{!10, !11, i64 64}
!19 = !{!10, !11, i64 24}
!20 = !{!10, !11, i64 32}
!21 = !{!10, !11, i64 40}
!22 = !{!10, !11, i64 280}


; 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)
declare double @sqrt(double noundef) local_unnamed_addr #1

; Function Attrs: mustprogress nofree nounwind willreturn memory(write, argmem: readwrite) uwtable
define dso_local double @findneighborlistupdate(ptr nocapture noundef readonly %0) local_unnamed_addr #2 {
  %2 = load double, ptr %0, align 8, !tbaa !5
  %3 = getelementptr inbounds i8, ptr %0, i64 48
  %4 = load double, ptr %3, align 8, !tbaa !12
  %5 = fsub double %2, %4
  %6 = getelementptr inbounds i8, ptr %0, i64 8
  %7 = load double, ptr %6, align 8, !tbaa !13
  %8 = getelementptr inbounds i8, ptr %0, i64 56
  %9 = load double, ptr %8, align 8, !tbaa !14
  %10 = fsub double %7, %9
  %11 = getelementptr inbounds i8, ptr %0, i64 16
  %12 = load double, ptr %11, align 8, !tbaa !15
  %13 = getelementptr inbounds i8, ptr %0, i64 64
  %14 = load double, ptr %13, align 8, !tbaa !16
  %15 = fsub double %12, %14
  %16 = getelementptr inbounds i8, ptr %0, i64 24
  %17 = load double, ptr %16, align 8, !tbaa !17
  %18 = getelementptr inbounds i8, ptr %0, i64 32
  %19 = load double, ptr %18, align 8, !tbaa !18
  %20 = getelementptr inbounds i8, ptr %0, i64 40
  %21 = load double, ptr %20, align 8, !tbaa !19
  %22 = fmul double %10, %19
  %23 = tail call double @llvm.fmuladd.f64(double %5, double %17, double %22)
  %24 = tail call double @llvm.fmuladd.f64(double %15, double %21, double %23)
  %25 = fmul double %19, %19
  %26 = tail call double @llvm.fmuladd.f64(double %17, double %17, double %25)
  %27 = tail call double @llvm.fmuladd.f64(double %21, double %21, double %26)
  %28 = fmul double %10, %10
  %29 = tail call double @llvm.fmuladd.f64(double %5, double %5, double %28)
  %30 = tail call double @llvm.fmuladd.f64(double %15, double %15, double %29)
  %31 = getelementptr inbounds i8, ptr %0, i64 280
  %32 = load double, ptr %31, align 8, !tbaa !20
  %33 = fmul double %32, 5.000000e-01
  %34 = fneg double %33
  %35 = tail call double @llvm.fmuladd.f64(double %34, double %33, double %30)
  %36 = fneg double %27
  %37 = fmul double %35, %36
  %38 = tail call double @llvm.fmuladd.f64(double %24, double %24, double %37)
  %39 = tail call double @sqrt(double noundef %38) #3
  %40 = fsub double %39, %24
  %41 = fdiv double %40, %27
  ret double %41
}

attributes #0 = { mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) }
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 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 #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, !7, i64 0}
!6 = !{!"sparticle", !7, i64 0, !7, i64 8, !7, i64 16, !7, i64 24, !7, i64 32, !7, i64 40, !7, i64 48, !7, i64 56, !7, i64 64, !8, i64 72, !8, i64 264, !7, i64 272, !7, i64 280, !7, i64 288, !8, i64 296, !10, i64 300, !10, i64 304, !10, i64 308, !10, i64 312, !11, i64 320, !11, i64 328, !11, i64 336, !8, i64 344}
!7 = !{!"double", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"int", !8, i64 0}
!11 = !{!"any pointer", !8, i64 0}
!12 = !{!6, !7, i64 48}
!13 = !{!6, !7, i64 8}
!14 = !{!6, !7, i64 56}
!15 = !{!6, !7, i64 16}
!16 = !{!6, !7, i64 64}
!17 = !{!6, !7, i64 24}
!18 = !{!6, !7, i64 32}
!19 = !{!6, !7, i64 40}
!20 = !{!6, !7, i64 280}


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