; LLVM IR from Discngine/fpocket :: src (energy)

; 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.s_vvertice = type { i32, i32, i32, i32, i32, float, float, float, float, i32, i32, [4 x i32], [4 x ptr], [3 x float], float }

; Function Attrs: nounwind uwtable
define dso_local zeroext i16 @grid_point_overlaps_with_alpha_sphere(ptr noundef %0, ptr noundef %1) #0 {
  %3 = alloca i16, align 2
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  store ptr %0, ptr %4, align 8, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !5
  %6 = load ptr, ptr %4, align 8, !tbaa !5
  %7 = getelementptr inbounds float, ptr %6, i64 0
  %8 = load float, ptr %7, align 4, !tbaa !9
  %9 = load ptr, ptr %4, align 8, !tbaa !5
  %10 = getelementptr inbounds float, ptr %9, i64 1
  %11 = load float, ptr %10, align 4, !tbaa !9
  %12 = load ptr, ptr %4, align 8, !tbaa !5
  %13 = getelementptr inbounds float, ptr %12, i64 2
  %14 = load float, ptr %13, align 4, !tbaa !9
  %15 = load ptr, ptr %5, align 8, !tbaa !5
  %16 = getelementptr inbounds %struct.s_vvertice, ptr %15, i32 0, i32 6
  %17 = load float, ptr %16, align 8, !tbaa !11
  %18 = load ptr, ptr %5, align 8, !tbaa !5
  %19 = getelementptr inbounds %struct.s_vvertice, ptr %18, i32 0, i32 7
  %20 = load float, ptr %19, align 4, !tbaa !14
  %21 = load ptr, ptr %5, align 8, !tbaa !5
  %22 = getelementptr inbounds %struct.s_vvertice, ptr %21, i32 0, i32 8
  %23 = load float, ptr %22, align 8, !tbaa !15
  %24 = call float @ddist(float noundef %8, float noundef %11, float noundef %14, float noundef %17, float noundef %20, float noundef %23)
  %25 = fpext float %24 to double
  %26 = load ptr, ptr %5, align 8, !tbaa !5
  %27 = getelementptr inbounds %struct.s_vvertice, ptr %26, i32 0, i32 5
  %28 = load float, ptr %27, align 4, !tbaa !16
  %29 = load ptr, ptr %5, align 8, !tbaa !5
  %30 = getelementptr inbounds %struct.s_vvertice, ptr %29, i32 0, i32 5
  %31 = load float, ptr %30, align 4, !tbaa !16
  %32 = fmul float %28, %31
  %33 = fpext float %32 to double
  %34 = fadd double %33, 1.000000e+00
  %35 = fcmp ole double %25, %34
  br i1 %35, label %36, label %37

36:                                               ; preds = %2
  store i16 1, ptr %3, align 2
  br label %38

37:                                               ; preds = %2
  store i16 0, ptr %3, align 2
  br label %38

38:                                               ; preds = %37, %36
  %39 = load i16, ptr %3, align 2
  ret i16 %39
}

declare float @ddist(float noundef, float noundef, float noundef, float noundef, float noundef, float noundef) #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 = { "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" }

!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, !10, i64 0}
!10 = !{!"float", !7, i64 0}
!11 = !{!12, !10, i64 24}
!12 = !{!"s_vvertice", !13, i64 0, !13, i64 4, !13, i64 8, !13, i64 12, !13, i64 16, !10, i64 20, !10, i64 24, !10, i64 28, !10, i64 32, !13, i64 36, !13, i64 40, !7, i64 44, !7, i64 64, !7, i64 96, !10, i64 108}
!13 = !{!"int", !7, i64 0}
!14 = !{!12, !10, i64 28}
!15 = !{!12, !10, i64 32}
!16 = !{!12, !10, i64 20}


; 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: nounwind uwtable
define dso_local zeroext range(i16 0, 2) i16 @grid_point_overlaps_with_alpha_sphere(ptr nocapture noundef readonly %0, ptr nocapture noundef readonly %1) local_unnamed_addr #0 {
  %3 = load float, ptr %0, align 4, !tbaa !5
  %4 = getelementptr inbounds i8, ptr %0, i64 4
  %5 = load float, ptr %4, align 4, !tbaa !5
  %6 = getelementptr inbounds i8, ptr %0, i64 8
  %7 = load float, ptr %6, align 4, !tbaa !5
  %8 = getelementptr inbounds i8, ptr %1, i64 24
  %9 = load float, ptr %8, align 8, !tbaa !9
  %10 = getelementptr inbounds i8, ptr %1, i64 28
  %11 = load float, ptr %10, align 4, !tbaa !12
  %12 = getelementptr inbounds i8, ptr %1, i64 32
  %13 = load float, ptr %12, align 8, !tbaa !13
  %14 = tail call float @ddist(float noundef %3, float noundef %5, float noundef %7, float noundef %9, float noundef %11, float noundef %13) #2
  %15 = fpext float %14 to double
  %16 = getelementptr inbounds i8, ptr %1, i64 20
  %17 = load float, ptr %16, align 4, !tbaa !14
  %18 = fmul float %17, %17
  %19 = fpext float %18 to double
  %20 = fadd double %19, 1.000000e+00
  %21 = fcmp oge double %20, %15
  %. = zext i1 %21 to i16
  ret i16 %.
}

declare float @ddist(float noundef, float noundef, float noundef, float noundef, float noundef, float noundef) local_unnamed_addr #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 = { "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 = !{!"float", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !6, i64 24}
!10 = !{!"s_vvertice", !11, i64 0, !11, i64 4, !11, i64 8, !11, i64 12, !11, i64 16, !6, i64 20, !6, i64 24, !6, i64 28, !6, i64 32, !11, i64 36, !11, i64 40, !7, i64 44, !7, i64 64, !7, i64 96, !6, i64 108}
!11 = !{!"int", !7, i64 0}
!12 = !{!10, !6, i64 28}
!13 = !{!10, !6, i64 32}
!14 = !{!10, !6, i64 20}


; Effective O3 passes: EarlyCSEPass,GlobalOptPass,IPSCCPPass,InstCombinePass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass,TailCallElimPass