; LLVM IR from lzyrapx/Competitive-Programming :: 51Nod/1264（计算几何）（线段相交）.ll (Z12intersect_in4lineS_)

; 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.line = type { %struct.point, %struct.point }
%struct.point = type { double, double }

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i32 @_Z11dots_inline5pointS_S_(double, double, double, double, double, double) #0

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i32 @_Z13dot_online_in5point4line(double, double, ptr noundef byval(%struct.line) align 8) #0

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i32 @_Z9same_side5pointS_4line(double, double, double, double, ptr noundef byval(%struct.line) align 8) #0

; Function Attrs: mustprogress nounwind uwtable
define dso_local noundef i32 @_Z12intersect_in4lineS_(ptr noundef byval(%struct.line) align 8 %0, ptr noundef byval(%struct.line) align 8 %1) #0 {
  %3 = alloca i32, align 4
  %4 = alloca %struct.point, align 8
  %5 = alloca %struct.point, align 8
  %6 = alloca %struct.point, align 8
  %7 = alloca %struct.point, align 8
  %8 = alloca %struct.point, align 8
  %9 = alloca %struct.point, align 8
  %10 = alloca %struct.point, align 8
  %11 = alloca %struct.point, align 8
  %12 = alloca %struct.line, align 8
  %13 = alloca %struct.point, align 8
  %14 = alloca %struct.point, align 8
  %15 = alloca %struct.line, align 8
  %16 = alloca %struct.point, align 8
  %17 = alloca %struct.line, align 8
  %18 = alloca %struct.point, align 8
  %19 = alloca %struct.line, align 8
  %20 = alloca %struct.point, align 8
  %21 = alloca %struct.line, align 8
  %22 = alloca %struct.point, align 8
  %23 = alloca %struct.line, align 8
  %24 = getelementptr inbounds %struct.line, ptr %0, i32 0, i32 0
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %4, ptr align 8 %24, i64 16, i1 false), !tbaa.struct !5
  %25 = getelementptr inbounds %struct.line, ptr %0, i32 0, i32 1
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %5, ptr align 8 %25, i64 16, i1 false), !tbaa.struct !5
  %26 = getelementptr inbounds %struct.line, ptr %1, i32 0, i32 0
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %6, ptr align 8 %26, i64 16, i1 false), !tbaa.struct !5
  %27 = getelementptr inbounds { double, double }, ptr %4, i32 0, i32 0
  %28 = load double, ptr %27, align 8
  %29 = getelementptr inbounds { double, double }, ptr %4, i32 0, i32 1
  %30 = load double, ptr %29, align 8
  %31 = getelementptr inbounds { double, double }, ptr %5, i32 0, i32 0
  %32 = load double, ptr %31, align 8
  %33 = getelementptr inbounds { double, double }, ptr %5, i32 0, i32 1
  %34 = load double, ptr %33, align 8
  %35 = getelementptr inbounds { double, double }, ptr %6, i32 0, i32 0
  %36 = load double, ptr %35, align 8
  %37 = getelementptr inbounds { double, double }, ptr %6, i32 0, i32 1
  %38 = load double, ptr %37, align 8
  %39 = call noundef i32 @_Z11dots_inline5pointS_S_(double %28, double %30, double %32, double %34, double %36, double %38)
  %40 = icmp ne i32 %39, 0
  br i1 %40, label %41, label %59

41:                                               ; preds = %2
  %42 = getelementptr inbounds %struct.line, ptr %0, i32 0, i32 0
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %7, ptr align 8 %42, i64 16, i1 false), !tbaa.struct !5
  %43 = getelementptr inbounds %struct.line, ptr %0, i32 0, i32 1
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %8, ptr align 8 %43, i64 16, i1 false), !tbaa.struct !5
  %44 = getelementptr inbounds %struct.line, ptr %1, i32 0, i32 1
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %9, ptr align 8 %44, i64 16, i1 false), !tbaa.struct !5
  %45 = getelementptr inbounds { double, double }, ptr %7, i32 0, i32 0
  %46 = load double, ptr %45, align 8
  %47 = getelementptr inbounds { double, double }, ptr %7, i32 0, i32 1
  %48 = load double, ptr %47, align 8
  %49 = getelementptr inbounds { double, double }, ptr %8, i32 0, i32 0
  %50 = load double, ptr %49, align 8
  %51 = getelementptr inbounds { double, double }, ptr %8, i32 0, i32 1
  %52 = load double, ptr %51, align 8
  %53 = getelementptr inbounds { double, double }, ptr %9, i32 0, i32 0
  %54 = load double, ptr %53, align 8
  %55 = getelementptr inbounds { double, double }, ptr %9, i32 0, i32 1
  %56 = load double, ptr %55, align 8
  %57 = call noundef i32 @_Z11dots_inline5pointS_S_(double %46, double %48, double %50, double %52, double %54, double %56)
  %58 = icmp ne i32 %57, 0
  br i1 %58, label %89, label %59

59:                                               ; preds = %41, %2
  %60 = getelementptr inbounds %struct.line, ptr %0, i32 0, i32 0
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %10, ptr align 8 %60, i64 16, i1 false), !tbaa.struct !5
  %61 = getelementptr inbounds %struct.line, ptr %0, i32 0, i32 1
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %11, ptr align 8 %61, i64 16, i1 false), !tbaa.struct !5
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %12, ptr align 8 %1, i64 32, i1 false), !tbaa.struct !10
  %62 = getelementptr inbounds { double, double }, ptr %10, i32 0, i32 0
  %63 = load double, ptr %62, align 8
  %64 = getelementptr inbounds { double, double }, ptr %10, i32 0, i32 1
  %65 = load double, ptr %64, align 8
  %66 = getelementptr inbounds { double, double }, ptr %11, i32 0, i32 0
  %67 = load double, ptr %66, align 8
  %68 = getelementptr inbounds { double, double }, ptr %11, i32 0, i32 1
  %69 = load double, ptr %68, align 8
  %70 = call noundef i32 @_Z9same_side5pointS_4line(double %63, double %65, double %67, double %69, ptr noundef byval(%struct.line) align 8 %12)
  %71 = icmp ne i32 %70, 0
  br i1 %71, label %86, label %72

72:                                               ; preds = %59
  %73 = getelementptr inbounds %struct.line, ptr %1, i32 0, i32 0
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %13, ptr align 8 %73, i64 16, i1 false), !tbaa.struct !5
  %74 = getelementptr inbounds %struct.line, ptr %1, i32 0, i32 1
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %14, ptr align 8 %74, i64 16, i1 false), !tbaa.struct !5
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %15, ptr align 8 %0, i64 32, i1 false), !tbaa.struct !10
  %75 = getelementptr inbounds { double, double }, ptr %13, i32 0, i32 0
  %76 = load double, ptr %75, align 8
  %77 = getelementptr inbounds { double, double }, ptr %13, i32 0, i32 1
  %78 = load double, ptr %77, align 8
  %79 = getelementptr inbounds { double, double }, ptr %14, i32 0, i32 0
  %80 = load double, ptr %79, align 8
  %81 = getelementptr inbounds { double, double }, ptr %14, i32 0, i32 1
  %82 = load double, ptr %81, align 8
  %83 = call noundef i32 @_Z9same_side5pointS_4line(double %76, double %78, double %80, double %82, ptr noundef byval(%struct.line) align 8 %15)
  %84 = icmp ne i32 %83, 0
  %85 = xor i1 %84, true
  br label %86

86:                                               ; preds = %72, %59
  %87 = phi i1 [ false, %59 ], [ %85, %72 ]
  %88 = zext i1 %87 to i32
  store i32 %88, ptr %3, align 4
  br label %124

89:                                               ; preds = %41
  %90 = getelementptr inbounds %struct.line, ptr %0, i32 0, i32 0
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %16, ptr align 8 %90, i64 16, i1 false), !tbaa.struct !5
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %17, ptr align 8 %1, i64 32, i1 false), !tbaa.struct !10
  %91 = getelementptr inbounds { double, double }, ptr %16, i32 0, i32 0
  %92 = load double, ptr %91, align 8
  %93 = getelementptr inbounds { double, double }, ptr %16, i32 0, i32 1
  %94 = load double, ptr %93, align 8
  %95 = call noundef i32 @_Z13dot_online_in5point4line(double %92, double %94, ptr noundef byval(%struct.line) align 8 %17)
  %96 = icmp ne i32 %95, 0
  br i1 %96, label %121, label %97

97:                                               ; preds = %89
  %98 = getelementptr inbounds %struct.line, ptr %0, i32 0, i32 1
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %18, ptr align 8 %98, i64 16, i1 false), !tbaa.struct !5
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %19, ptr align 8 %1, i64 32, i1 false), !tbaa.struct !10
  %99 = getelementptr inbounds { double, double }, ptr %18, i32 0, i32 0
  %100 = load double, ptr %99, align 8
  %101 = getelementptr inbounds { double, double }, ptr %18, i32 0, i32 1
  %102 = load double, ptr %101, align 8
  %103 = call noundef i32 @_Z13dot_online_in5point4line(double %100, double %102, ptr noundef byval(%struct.line) align 8 %19)
  %104 = icmp ne i32 %103, 0
  br i1 %104, label %121, label %105

105:                                              ; preds = %97
  %106 = getelementptr inbounds %struct.line, ptr %1, i32 0, i32 0
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %20, ptr align 8 %106, i64 16, i1 false), !tbaa.struct !5
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %21, ptr align 8 %0, i64 32, i1 false), !tbaa.struct !10
  %107 = getelementptr inbounds { double, double }, ptr %20, i32 0, i32 0
  %108 = load double, ptr %107, align 8
  %109 = getelementptr inbounds { double, double }, ptr %20, i32 0, i32 1
  %110 = load double, ptr %109, align 8
  %111 = call noundef i32 @_Z13dot_online_in5point4line(double %108, double %110, ptr noundef byval(%struct.line) align 8 %21)
  %112 = icmp ne i32 %111, 0
  br i1 %112, label %121, label %113

113:                                              ; preds = %105
  %114 = getelementptr inbounds %struct.line, ptr %1, i32 0, i32 1
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %22, ptr align 8 %114, i64 16, i1 false), !tbaa.struct !5
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %23, ptr align 8 %0, i64 32, i1 false), !tbaa.struct !10
  %115 = getelementptr inbounds { double, double }, ptr %22, i32 0, i32 0
  %116 = load double, ptr %115, align 8
  %117 = getelementptr inbounds { double, double }, ptr %22, i32 0, i32 1
  %118 = load double, ptr %117, align 8
  %119 = call noundef i32 @_Z13dot_online_in5point4line(double %116, double %118, ptr noundef byval(%struct.line) align 8 %23)
  %120 = icmp ne i32 %119, 0
  br label %121

121:                                              ; preds = %113, %105, %97, %89
  %122 = phi i1 [ true, %105 ], [ true, %97 ], [ true, %89 ], [ %120, %113 ]
  %123 = zext i1 %122 to i32
  store i32 %123, ptr %3, align 4
  br label %124

124:                                              ; preds = %121, %86
  %125 = load i32, ptr %3, align 4
  ret i32 %125
}

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 nounwind willreturn memory(argmem: readwrite) }

!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 = !{i64 0, i64 8, !6, i64 8, i64 8, !6}
!6 = !{!7, !7, i64 0}
!7 = !{!"double", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{i64 0, i64 8, !6, i64 8, i64 8, !6, i64 16, i64 8, !6, i64 24, i64 8, !6}


; 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.line = type { %struct.point, %struct.point }
%struct.point = type { double, double }

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i32 @_Z11dots_inline5pointS_S_(double, double, double, double, double, double) local_unnamed_addr #0

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i32 @_Z13dot_online_in5point4line(double, double, ptr noundef byval(%struct.line) align 8) local_unnamed_addr #0

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i32 @_Z9same_side5pointS_4line(double, double, double, double, ptr noundef byval(%struct.line) align 8) local_unnamed_addr #0

; Function Attrs: mustprogress nounwind uwtable
define dso_local noundef range(i32 0, 2) i32 @_Z12intersect_in4lineS_(ptr nocapture noundef readonly byval(%struct.line) align 8 %0, ptr nocapture noundef readonly byval(%struct.line) align 8 %1) local_unnamed_addr #0 {
  %.sroa.025.0.copyload = load double, ptr %0, align 8, !tbaa !5
  %.sroa.226.0..sroa_idx = getelementptr inbounds i8, ptr %0, i64 8
  %.sroa.226.0.copyload = load double, ptr %.sroa.226.0..sroa_idx, align 8, !tbaa !5
  %3 = getelementptr inbounds i8, ptr %0, i64 16
  %.sroa.023.0.copyload = load double, ptr %3, align 8, !tbaa !5
  %.sroa.224.0..sroa_idx = getelementptr inbounds i8, ptr %0, i64 24
  %.sroa.224.0.copyload = load double, ptr %.sroa.224.0..sroa_idx, align 8, !tbaa !5
  %.sroa.021.0.copyload = load double, ptr %1, align 8, !tbaa !5
  %.sroa.222.0..sroa_idx = getelementptr inbounds i8, ptr %1, i64 8
  %.sroa.222.0.copyload = load double, ptr %.sroa.222.0..sroa_idx, align 8, !tbaa !5
  %4 = tail call noundef i32 @_Z11dots_inline5pointS_S_(double %.sroa.025.0.copyload, double %.sroa.226.0.copyload, double %.sroa.023.0.copyload, double %.sroa.224.0.copyload, double %.sroa.021.0.copyload, double %.sroa.222.0.copyload)
  %.not = icmp eq i32 %4, 0
  br i1 %.not, label %8, label %5

5:                                                ; preds = %2
  %6 = getelementptr inbounds i8, ptr %1, i64 16
  %.sroa.015.0.copyload = load double, ptr %6, align 8, !tbaa !5
  %.sroa.216.0..sroa_idx = getelementptr inbounds i8, ptr %1, i64 24
  %.sroa.216.0.copyload = load double, ptr %.sroa.216.0..sroa_idx, align 8, !tbaa !5
  %7 = tail call noundef i32 @_Z11dots_inline5pointS_S_(double %.sroa.025.0.copyload, double %.sroa.226.0.copyload, double %.sroa.023.0.copyload, double %.sroa.224.0.copyload, double %.sroa.015.0.copyload, double %.sroa.216.0.copyload)
  %.not27 = icmp eq i32 %7, 0
  br i1 %.not27, label %8, label %13

8:                                                ; preds = %5, %2
  %9 = tail call noundef i32 @_Z9same_side5pointS_4line(double %.sroa.025.0.copyload, double %.sroa.226.0.copyload, double %.sroa.023.0.copyload, double %.sroa.224.0.copyload, ptr noundef nonnull byval(%struct.line) align 8 %1)
  %.not28 = icmp eq i32 %9, 0
  br i1 %.not28, label %10, label %22

10:                                               ; preds = %8
  %11 = getelementptr inbounds i8, ptr %1, i64 16
  %.sroa.07.0.copyload = load double, ptr %11, align 8, !tbaa !5
  %.sroa.28.0..sroa_idx = getelementptr inbounds i8, ptr %1, i64 24
  %.sroa.28.0.copyload = load double, ptr %.sroa.28.0..sroa_idx, align 8, !tbaa !5
  %12 = tail call noundef i32 @_Z9same_side5pointS_4line(double %.sroa.021.0.copyload, double %.sroa.222.0.copyload, double %.sroa.07.0.copyload, double %.sroa.28.0.copyload, ptr noundef nonnull byval(%struct.line) align 8 %0)
  %.not29 = icmp eq i32 %12, 0
  br label %22

13:                                               ; preds = %5
  %14 = tail call noundef i32 @_Z13dot_online_in5point4line(double %.sroa.025.0.copyload, double %.sroa.226.0.copyload, ptr noundef nonnull byval(%struct.line) align 8 %1)
  %.not30 = icmp eq i32 %14, 0
  br i1 %.not30, label %15, label %22

15:                                               ; preds = %13
  %16 = tail call noundef i32 @_Z13dot_online_in5point4line(double %.sroa.023.0.copyload, double %.sroa.224.0.copyload, ptr noundef nonnull byval(%struct.line) align 8 %1)
  %.not31 = icmp eq i32 %16, 0
  br i1 %.not31, label %17, label %22

17:                                               ; preds = %15
  %18 = tail call noundef i32 @_Z13dot_online_in5point4line(double %.sroa.021.0.copyload, double %.sroa.222.0.copyload, ptr noundef nonnull byval(%struct.line) align 8 %0)
  %.not32 = icmp eq i32 %18, 0
  br i1 %.not32, label %19, label %22

19:                                               ; preds = %17
  %20 = tail call noundef i32 @_Z13dot_online_in5point4line(double %.sroa.015.0.copyload, double %.sroa.216.0.copyload, ptr noundef nonnull byval(%struct.line) align 8 %0)
  %21 = icmp ne i32 %20, 0
  br label %22

22:                                               ; preds = %13, %15, %17, %19, %8, %10
  %.0.shrunk = phi i1 [ false, %8 ], [ %.not29, %10 ], [ true, %17 ], [ true, %15 ], [ true, %13 ], [ %21, %19 ]
  %.0 = zext i1 %.0.shrunk to i32
  ret i32 %.0
}

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" }

!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 = !{!"double", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}


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