; LLVM IR from liaojing/MorphLib :: MorphLib/Morph.ll (ZN8MorphLib6CMorph9intersectEffffffffRfS1_)

; 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: 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 float @llvm.fmuladd.f32(float, float, float) #1

; Function Attrs: mustprogress nounwind uwtable
define dso_local noundef i32 @_ZN8MorphLib6CMorph9intersectEffffffffRfS1_(ptr noundef nonnull align 8 dereferenceable(49) %0, float noundef %1, float noundef %2, float noundef %3, float noundef %4, float noundef %5, float noundef %6, float noundef %7, float noundef %8, ptr noundef nonnull align 4 dereferenceable(4) %9, ptr noundef nonnull align 4 dereferenceable(4) %10) #2 align 2 {
  %12 = alloca i32, align 4
  %13 = alloca ptr, align 8
  %14 = alloca float, align 4
  %15 = alloca float, align 4
  %16 = alloca float, align 4
  %17 = alloca float, align 4
  %18 = alloca float, align 4
  %19 = alloca float, align 4
  %20 = alloca float, align 4
  %21 = alloca float, align 4
  %22 = alloca ptr, align 8
  %23 = alloca ptr, align 8
  %24 = alloca float, align 4
  %25 = alloca i32, align 4
  store ptr %0, ptr %13, align 8, !tbaa !5
  store float %1, ptr %14, align 4, !tbaa !9
  store float %2, ptr %15, align 4, !tbaa !9
  store float %3, ptr %16, align 4, !tbaa !9
  store float %4, ptr %17, align 4, !tbaa !9
  store float %5, ptr %18, align 4, !tbaa !9
  store float %6, ptr %19, align 4, !tbaa !9
  store float %7, ptr %20, align 4, !tbaa !9
  store float %8, ptr %21, align 4, !tbaa !9
  store ptr %9, ptr %22, align 8, !tbaa !5
  store ptr %10, ptr %23, align 8, !tbaa !5
  %26 = load ptr, ptr %13, align 8
  %27 = load float, ptr %21, align 4, !tbaa !9
  %28 = load float, ptr %19, align 4, !tbaa !9
  %29 = fsub float %27, %28
  %30 = load float, ptr %16, align 4, !tbaa !9
  %31 = load float, ptr %14, align 4, !tbaa !9
  %32 = fsub float %30, %31
  %33 = load float, ptr %20, align 4, !tbaa !9
  %34 = load float, ptr %18, align 4, !tbaa !9
  %35 = fsub float %33, %34
  %36 = load float, ptr %17, align 4, !tbaa !9
  %37 = load float, ptr %15, align 4, !tbaa !9
  %38 = fsub float %36, %37
  %39 = fmul float %35, %38
  %40 = fneg float %39
  %41 = call float @llvm.fmuladd.f32(float %29, float %32, float %40)
  %42 = load ptr, ptr %23, align 8, !tbaa !5
  store float %41, ptr %42, align 4, !tbaa !9
  %43 = load float, ptr %20, align 4, !tbaa !9
  %44 = load float, ptr %18, align 4, !tbaa !9
  %45 = fsub float %43, %44
  %46 = load float, ptr %15, align 4, !tbaa !9
  %47 = load float, ptr %19, align 4, !tbaa !9
  %48 = fsub float %46, %47
  %49 = load float, ptr %21, align 4, !tbaa !9
  %50 = load float, ptr %19, align 4, !tbaa !9
  %51 = fsub float %49, %50
  %52 = load float, ptr %14, align 4, !tbaa !9
  %53 = load float, ptr %18, align 4, !tbaa !9
  %54 = fsub float %52, %53
  %55 = fmul float %51, %54
  %56 = fneg float %55
  %57 = call float @llvm.fmuladd.f32(float %45, float %48, float %56)
  %58 = load ptr, ptr %22, align 8, !tbaa !5
  store float %57, ptr %58, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %24) #3
  %59 = load float, ptr %16, align 4, !tbaa !9
  %60 = load float, ptr %14, align 4, !tbaa !9
  %61 = fsub float %59, %60
  %62 = load float, ptr %15, align 4, !tbaa !9
  %63 = load float, ptr %19, align 4, !tbaa !9
  %64 = fsub float %62, %63
  %65 = load float, ptr %17, align 4, !tbaa !9
  %66 = load float, ptr %15, align 4, !tbaa !9
  %67 = fsub float %65, %66
  %68 = load float, ptr %14, align 4, !tbaa !9
  %69 = load float, ptr %18, align 4, !tbaa !9
  %70 = fsub float %68, %69
  %71 = fmul float %67, %70
  %72 = fneg float %71
  %73 = call float @llvm.fmuladd.f32(float %61, float %64, float %72)
  store float %73, ptr %24, align 4, !tbaa !9
  %74 = load ptr, ptr %23, align 8, !tbaa !5
  %75 = load float, ptr %74, align 4, !tbaa !9
  %76 = fcmp ogt float %75, 0.000000e+00
  br i1 %76, label %77, label %87

77:                                               ; preds = %11
  %78 = load float, ptr %24, align 4, !tbaa !9
  %79 = fcmp oge float %78, 0.000000e+00
  br i1 %79, label %80, label %86

80:                                               ; preds = %77
  %81 = load float, ptr %24, align 4, !tbaa !9
  %82 = load ptr, ptr %23, align 8, !tbaa !5
  %83 = load float, ptr %82, align 4, !tbaa !9
  %84 = fcmp ole float %81, %83
  br i1 %84, label %85, label %86

85:                                               ; preds = %80
  store i32 1, ptr %12, align 4
  store i32 1, ptr %25, align 4
  br label %105

86:                                               ; preds = %80, %77
  store i32 0, ptr %12, align 4
  store i32 1, ptr %25, align 4
  br label %105

87:                                               ; preds = %11
  %88 = load float, ptr %24, align 4, !tbaa !9
  %89 = fcmp ole float %88, 0.000000e+00
  br i1 %89, label %90, label %104

90:                                               ; preds = %87
  %91 = load float, ptr %24, align 4, !tbaa !9
  %92 = load ptr, ptr %23, align 8, !tbaa !5
  %93 = load float, ptr %92, align 4, !tbaa !9
  %94 = fcmp oge float %91, %93
  br i1 %94, label %95, label %104

95:                                               ; preds = %90
  %96 = load ptr, ptr %22, align 8, !tbaa !5
  %97 = load float, ptr %96, align 4, !tbaa !9
  %98 = fneg float %97
  %99 = load ptr, ptr %22, align 8, !tbaa !5
  store float %98, ptr %99, align 4, !tbaa !9
  %100 = load ptr, ptr %23, align 8, !tbaa !5
  %101 = load float, ptr %100, align 4, !tbaa !9
  %102 = fneg float %101
  %103 = load ptr, ptr %23, align 8, !tbaa !5
  store float %102, ptr %103, align 4, !tbaa !9
  store i32 1, ptr %12, align 4
  store i32 1, ptr %25, align 4
  br label %105

104:                                              ; preds = %90, %87
  store i32 0, ptr %12, align 4
  store i32 1, ptr %25, align 4
  br label %105

105:                                              ; preds = %104, %95, %86, %85
  call void @llvm.lifetime.end.p0(i64 4, ptr %24) #3
  %106 = load i32, ptr %12, align 4
  ret i32 %106
}

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #2 = { 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 #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 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"float", !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 nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare float @llvm.fmuladd.f32(float, float, float) #0

; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: readwrite) uwtable
define dso_local noundef range(i32 0, 2) i32 @_ZN8MorphLib6CMorph9intersectEffffffffRfS1_(ptr nocapture noundef nonnull readnone align 8 dereferenceable(49) %0, float noundef %1, float noundef %2, float noundef %3, float noundef %4, float noundef %5, float noundef %6, float noundef %7, float noundef %8, ptr nocapture noundef nonnull writeonly align 4 dereferenceable(4) %9, ptr nocapture noundef nonnull align 4 dereferenceable(4) %10) local_unnamed_addr #1 align 2 {
  %12 = fsub float %8, %6
  %13 = fsub float %3, %1
  %14 = fsub float %7, %5
  %15 = fsub float %4, %2
  %16 = fneg float %14
  %17 = fmul float %15, %16
  %18 = tail call float @llvm.fmuladd.f32(float %12, float %13, float %17)
  store float %18, ptr %10, align 4, !tbaa !5
  %19 = fsub float %2, %6
  %20 = fsub float %1, %5
  %21 = fneg float %12
  %22 = fmul float %20, %21
  %23 = tail call float @llvm.fmuladd.f32(float %14, float %19, float %22)
  store float %23, ptr %9, align 4, !tbaa !5
  %24 = fneg float %15
  %25 = fmul float %20, %24
  %26 = tail call float @llvm.fmuladd.f32(float %13, float %19, float %25)
  %27 = load float, ptr %10, align 4, !tbaa !5
  %28 = fcmp ogt float %27, 0.000000e+00
  br i1 %28, label %29, label %32

29:                                               ; preds = %11
  %30 = fcmp oge float %26, 0.000000e+00
  %31 = fcmp ole float %26, %27
  %or.cond.not = and i1 %30, %31
  %spec.select = zext i1 %or.cond.not to i32
  br label %39

32:                                               ; preds = %11
  %33 = fcmp ugt float %26, 0.000000e+00
  %34 = fcmp ult float %26, %27
  %or.cond41 = or i1 %33, %34
  br i1 %or.cond41, label %39, label %35

35:                                               ; preds = %32
  %36 = fneg float %23
  store float %36, ptr %9, align 4, !tbaa !5
  %37 = load float, ptr %10, align 4, !tbaa !5
  %38 = fneg float %37
  store float %38, ptr %10, align 4, !tbaa !5
  br label %39

39:                                               ; preds = %29, %32, %35
  %.0 = phi i32 [ 1, %35 ], [ 0, %32 ], [ %spec.select, %29 ]
  ret i32 %.0
}

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

!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: EarlyCSEPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,PostOrderFunctionAttrsPass,ReassociatePass,SROAPass,SimplifyCFGPass,TailCallElimPass