; LLVM IR from ShahjalalShohag/code-library :: Geometry/Half Plane Intersection Dynamic.ll (Z22line_line_intersection2PTS_S_S_)

; 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.PT = type { x86_fp80, x86_fp80 }

@.str = external hidden unnamed_addr constant [15 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [107 x i8], align 1
@__PRETTY_FUNCTION__._Z22line_line_intersection2PTS_S_S_ = external hidden unnamed_addr constant [42 x i8], align 1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i32 @_Z4signe(x86_fp80 noundef) #0

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN2PTC2Eee(ptr noundef nonnull align 16 dereferenceable(32), x86_fp80 noundef, x86_fp80 noundef) unnamed_addr #0 align 2

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare x86_fp80 @llvm.fmuladd.f80(x86_fp80, x86_fp80, x86_fp80) #1

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN2PTC2ERKS_(ptr noundef nonnull align 16 dereferenceable(32), ptr noundef nonnull align 16 dereferenceable(32)) unnamed_addr #0 align 2

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef x86_fp80 @_Z5cross2PTS_(ptr noundef, ptr noundef) #3

; Function Attrs: mustprogress uwtable
define dso_local void @_Z22line_line_intersection2PTS_S_S_(ptr dead_on_unwind noalias writable sret(%struct.PT) align 16 %0, ptr noundef %1, ptr noundef %2, ptr noundef %3, ptr noundef %4) #4 {
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  %9 = alloca ptr, align 8
  %10 = alloca ptr, align 8
  %11 = alloca x86_fp80, align 16
  %12 = alloca x86_fp80, align 16
  %13 = alloca x86_fp80, align 16
  %14 = alloca %struct.PT, align 16
  %15 = alloca %struct.PT, align 16
  %16 = alloca x86_fp80, align 16
  %17 = alloca x86_fp80, align 16
  %18 = alloca x86_fp80, align 16
  %19 = alloca %struct.PT, align 16
  %20 = alloca %struct.PT, align 16
  %21 = alloca x86_fp80, align 16
  store ptr %0, ptr %6, align 8
  store ptr %1, ptr %7, align 8, !tbaa !5
  store ptr %2, ptr %8, align 8, !tbaa !5
  store ptr %3, ptr %9, align 8, !tbaa !5
  store ptr %4, ptr %10, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 16, ptr %11) #6
  %22 = getelementptr inbounds %struct.PT, ptr %1, i32 0, i32 1
  %23 = load x86_fp80, ptr %22, align 16, !tbaa !9
  %24 = getelementptr inbounds %struct.PT, ptr %2, i32 0, i32 1
  %25 = load x86_fp80, ptr %24, align 16, !tbaa !9
  %26 = fsub x86_fp80 %23, %25
  store x86_fp80 %26, ptr %11, align 16, !tbaa !12
  call void @llvm.lifetime.start.p0(i64 16, ptr %12) #6
  %27 = getelementptr inbounds %struct.PT, ptr %2, i32 0, i32 0
  %28 = load x86_fp80, ptr %27, align 16, !tbaa !13
  %29 = getelementptr inbounds %struct.PT, ptr %1, i32 0, i32 0
  %30 = load x86_fp80, ptr %29, align 16, !tbaa !13
  %31 = fsub x86_fp80 %28, %30
  store x86_fp80 %31, ptr %12, align 16, !tbaa !12
  call void @llvm.lifetime.start.p0(i64 16, ptr %13) #6
  call void @_ZN2PTC2ERKS_(ptr noundef nonnull align 16 dereferenceable(32) %14, ptr noundef nonnull align 16 dereferenceable(32) %1)
  call void @_ZN2PTC2ERKS_(ptr noundef nonnull align 16 dereferenceable(32) %15, ptr noundef nonnull align 16 dereferenceable(32) %2)
  %32 = call noundef x86_fp80 @_Z5cross2PTS_(ptr noundef %14, ptr noundef %15)
  store x86_fp80 %32, ptr %13, align 16, !tbaa !12
  call void @llvm.lifetime.start.p0(i64 16, ptr %16) #6
  %33 = getelementptr inbounds %struct.PT, ptr %3, i32 0, i32 1
  %34 = load x86_fp80, ptr %33, align 16, !tbaa !9
  %35 = getelementptr inbounds %struct.PT, ptr %4, i32 0, i32 1
  %36 = load x86_fp80, ptr %35, align 16, !tbaa !9
  %37 = fsub x86_fp80 %34, %36
  store x86_fp80 %37, ptr %16, align 16, !tbaa !12
  call void @llvm.lifetime.start.p0(i64 16, ptr %17) #6
  %38 = getelementptr inbounds %struct.PT, ptr %4, i32 0, i32 0
  %39 = load x86_fp80, ptr %38, align 16, !tbaa !13
  %40 = getelementptr inbounds %struct.PT, ptr %3, i32 0, i32 0
  %41 = load x86_fp80, ptr %40, align 16, !tbaa !13
  %42 = fsub x86_fp80 %39, %41
  store x86_fp80 %42, ptr %17, align 16, !tbaa !12
  call void @llvm.lifetime.start.p0(i64 16, ptr %18) #6
  call void @_ZN2PTC2ERKS_(ptr noundef nonnull align 16 dereferenceable(32) %19, ptr noundef nonnull align 16 dereferenceable(32) %3)
  call void @_ZN2PTC2ERKS_(ptr noundef nonnull align 16 dereferenceable(32) %20, ptr noundef nonnull align 16 dereferenceable(32) %4)
  %43 = call noundef x86_fp80 @_Z5cross2PTS_(ptr noundef %19, ptr noundef %20)
  store x86_fp80 %43, ptr %18, align 16, !tbaa !12
  call void @llvm.lifetime.start.p0(i64 16, ptr %21) #6
  %44 = load x86_fp80, ptr %11, align 16, !tbaa !12
  %45 = load x86_fp80, ptr %17, align 16, !tbaa !12
  %46 = load x86_fp80, ptr %16, align 16, !tbaa !12
  %47 = load x86_fp80, ptr %12, align 16, !tbaa !12
  %48 = fmul x86_fp80 %46, %47
  %49 = fneg x86_fp80 %48
  %50 = call x86_fp80 @llvm.fmuladd.f80(x86_fp80 %44, x86_fp80 %45, x86_fp80 %49)
  store x86_fp80 %50, ptr %21, align 16, !tbaa !12
  %51 = load x86_fp80, ptr %21, align 16, !tbaa !12
  %52 = call noundef i32 @_Z4signe(x86_fp80 noundef %51)
  %53 = icmp ne i32 %52, 0
  br i1 %53, label %54, label %55

54:                                               ; preds = %5
  br label %57

55:                                               ; preds = %5
  call void @__assert_fail(ptr noundef @.str, ptr noundef @.str.2, i32 noundef 56, ptr noundef @__PRETTY_FUNCTION__._Z22line_line_intersection2PTS_S_S_) #7
  unreachable

56:                                               ; No predecessors!
  br label %57

57:                                               ; preds = %56, %54
  %58 = load x86_fp80, ptr %12, align 16, !tbaa !12
  %59 = load x86_fp80, ptr %18, align 16, !tbaa !12
  %60 = load x86_fp80, ptr %17, align 16, !tbaa !12
  %61 = load x86_fp80, ptr %13, align 16, !tbaa !12
  %62 = fmul x86_fp80 %60, %61
  %63 = fneg x86_fp80 %62
  %64 = call x86_fp80 @llvm.fmuladd.f80(x86_fp80 %58, x86_fp80 %59, x86_fp80 %63)
  %65 = load x86_fp80, ptr %21, align 16, !tbaa !12
  %66 = fdiv x86_fp80 %64, %65
  %67 = load x86_fp80, ptr %13, align 16, !tbaa !12
  %68 = load x86_fp80, ptr %16, align 16, !tbaa !12
  %69 = load x86_fp80, ptr %11, align 16, !tbaa !12
  %70 = load x86_fp80, ptr %18, align 16, !tbaa !12
  %71 = fmul x86_fp80 %69, %70
  %72 = fneg x86_fp80 %71
  %73 = call x86_fp80 @llvm.fmuladd.f80(x86_fp80 %67, x86_fp80 %68, x86_fp80 %72)
  %74 = load x86_fp80, ptr %21, align 16, !tbaa !12
  %75 = fdiv x86_fp80 %73, %74
  call void @_ZN2PTC2Eee(ptr noundef nonnull align 16 dereferenceable(32) %0, x86_fp80 noundef %66, x86_fp80 noundef %75)
  call void @llvm.lifetime.end.p0(i64 16, ptr %21) #6
  call void @llvm.lifetime.end.p0(i64 16, ptr %18) #6
  call void @llvm.lifetime.end.p0(i64 16, ptr %17) #6
  call void @llvm.lifetime.end.p0(i64 16, ptr %16) #6
  call void @llvm.lifetime.end.p0(i64 16, ptr %13) #6
  call void @llvm.lifetime.end.p0(i64 16, ptr %12) #6
  call void @llvm.lifetime.end.p0(i64 16, ptr %11) #6
  ret void
}

; Function Attrs: noreturn nounwind
declare void @__assert_fail(ptr noundef, ptr noundef, i32 noundef, ptr noundef) #5

attributes #0 = { 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 #1 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #2 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { inlinehint 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 #4 = { mustprogress 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 #5 = { noreturn 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 #6 = { nounwind }
attributes #7 = { noreturn 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, !11, i64 16}
!10 = !{!"_ZTS2PT", !11, i64 0, !11, i64 16}
!11 = !{!"long double", !7, i64 0}
!12 = !{!11, !11, i64 0}
!13 = !{!10, !11, 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"

%struct.PT = type { x86_fp80, x86_fp80 }

@.str = external hidden unnamed_addr constant [15 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [107 x i8], align 1
@__PRETTY_FUNCTION__._Z22line_line_intersection2PTS_S_S_ = external hidden unnamed_addr constant [42 x i8], align 1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i32 @_Z4signe(x86_fp80 noundef) local_unnamed_addr #0

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN2PTC2Eee(ptr noundef nonnull align 16 dereferenceable(32), x86_fp80 noundef, x86_fp80 noundef) unnamed_addr #0 align 2

; Function Attrs: mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare x86_fp80 @llvm.fmuladd.f80(x86_fp80, x86_fp80, x86_fp80) #1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN2PTC2ERKS_(ptr noundef nonnull align 16 dereferenceable(32), ptr noundef nonnull align 16 dereferenceable(32)) unnamed_addr #0 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef x86_fp80 @_Z5cross2PTS_(ptr noundef, ptr noundef) local_unnamed_addr #2

; Function Attrs: mustprogress nounwind uwtable
define dso_local void @_Z22line_line_intersection2PTS_S_S_(ptr dead_on_unwind noalias writable sret(%struct.PT) align 16 %0, ptr noundef nonnull %1, ptr noundef %2, ptr noundef %3, ptr noundef %4) local_unnamed_addr #0 {
  %6 = alloca %struct.PT, align 16
  %7 = alloca %struct.PT, align 16
  %8 = alloca %struct.PT, align 16
  %9 = alloca %struct.PT, align 16
  %10 = getelementptr inbounds i8, ptr %1, i64 16
  %11 = load x86_fp80, ptr %10, align 16, !tbaa !5
  %12 = getelementptr inbounds i8, ptr %2, i64 16
  %13 = load x86_fp80, ptr %12, align 16, !tbaa !5
  %14 = fsub x86_fp80 %11, %13
  %15 = load x86_fp80, ptr %2, align 16, !tbaa !10
  %16 = load x86_fp80, ptr %1, align 16, !tbaa !10
  %17 = fsub x86_fp80 %15, %16
  call void @_ZN2PTC2ERKS_(ptr noundef nonnull align 16 dereferenceable(32) %6, ptr noundef nonnull align 16 dereferenceable(32) %1)
  call void @_ZN2PTC2ERKS_(ptr noundef nonnull align 16 dereferenceable(32) %7, ptr noundef nonnull align 16 dereferenceable(32) %2)
  %18 = call noundef x86_fp80 @_Z5cross2PTS_(ptr noundef nonnull %6, ptr noundef nonnull %7)
  %19 = getelementptr inbounds i8, ptr %3, i64 16
  %20 = load x86_fp80, ptr %19, align 16, !tbaa !5
  %21 = getelementptr inbounds i8, ptr %4, i64 16
  %22 = load x86_fp80, ptr %21, align 16, !tbaa !5
  %23 = fsub x86_fp80 %20, %22
  %24 = load x86_fp80, ptr %4, align 16, !tbaa !10
  %25 = load x86_fp80, ptr %3, align 16, !tbaa !10
  %26 = fsub x86_fp80 %24, %25
  call void @_ZN2PTC2ERKS_(ptr noundef nonnull align 16 dereferenceable(32) %8, ptr noundef nonnull align 16 dereferenceable(32) %3)
  call void @_ZN2PTC2ERKS_(ptr noundef nonnull align 16 dereferenceable(32) %9, ptr noundef nonnull align 16 dereferenceable(32) %4)
  %27 = call noundef x86_fp80 @_Z5cross2PTS_(ptr noundef nonnull %8, ptr noundef nonnull %9)
  %28 = fneg x86_fp80 %23
  %29 = fmul x86_fp80 %17, %28
  %30 = call x86_fp80 @llvm.fmuladd.f80(x86_fp80 %14, x86_fp80 %26, x86_fp80 %29)
  %31 = call noundef i32 @_Z4signe(x86_fp80 noundef %30)
  %.not = icmp eq i32 %31, 0
  br i1 %.not, label %32, label %33

32:                                               ; preds = %5
  call void @__assert_fail(ptr noundef nonnull @.str, ptr noundef nonnull @.str.2, i32 noundef 56, ptr noundef nonnull @__PRETTY_FUNCTION__._Z22line_line_intersection2PTS_S_S_) #4
  unreachable

33:                                               ; preds = %5
  %34 = fneg x86_fp80 %26
  %35 = fmul x86_fp80 %18, %34
  %36 = call x86_fp80 @llvm.fmuladd.f80(x86_fp80 %17, x86_fp80 %27, x86_fp80 %35)
  %37 = fdiv x86_fp80 %36, %30
  %38 = fneg x86_fp80 %14
  %39 = fmul x86_fp80 %27, %38
  %40 = call x86_fp80 @llvm.fmuladd.f80(x86_fp80 %18, x86_fp80 %23, x86_fp80 %39)
  %41 = fdiv x86_fp80 %40, %30
  call void @_ZN2PTC2Eee(ptr noundef nonnull align 16 dereferenceable(32) %0, x86_fp80 noundef %37, x86_fp80 noundef %41)
  ret void
}

; Function Attrs: noreturn nounwind
declare void @__assert_fail(ptr noundef, ptr noundef, i32 noundef, ptr noundef) local_unnamed_addr #3

attributes #0 = { 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 #1 = { mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #2 = { inlinehint 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 = { noreturn 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 = { noreturn 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 16}
!6 = !{!"_ZTS2PT", !7, i64 0, !7, i64 16}
!7 = !{!"long double", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!6, !7, i64 0}


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