; LLVM IR from kazunetakahashi/atcoder :: 2020/0304_ABC157/F.ll (Z9IntersectRK7SegmentS1_)

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

%"class.std::complex" = type { { x86_fp80, x86_fp80 } }

; 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) #0

; Function Attrs: mustprogress uwtable
declare dso_local noundef i32 @_Z3ccwSt7complexIeES0_S0_(ptr noundef byval(%"class.std::complex") align 16, ptr noundef byval(%"class.std::complex") align 16, ptr noundef byval(%"class.std::complex") align 16) #1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 16 dereferenceable(32) ptr @_ZNKSt6vectorISt7complexIeESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24), i64 noundef) #2 align 2

; Function Attrs: mustprogress uwtable
define dso_local noundef zeroext i1 @_Z9IntersectRK7SegmentS1_(ptr noundef nonnull align 8 dereferenceable(24) %0, ptr noundef nonnull align 8 dereferenceable(24) %1) #1 {
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  %5 = alloca %"class.std::complex", align 16
  %6 = alloca %"class.std::complex", align 16
  %7 = alloca %"class.std::complex", align 16
  %8 = alloca %"class.std::complex", align 16
  %9 = alloca %"class.std::complex", align 16
  %10 = alloca %"class.std::complex", align 16
  %11 = alloca %"class.std::complex", align 16
  %12 = alloca %"class.std::complex", align 16
  %13 = alloca %"class.std::complex", align 16
  %14 = alloca %"class.std::complex", align 16
  %15 = alloca %"class.std::complex", align 16
  %16 = alloca %"class.std::complex", align 16
  store ptr %0, ptr %3, align 8, !tbaa !5
  store ptr %1, ptr %4, align 8, !tbaa !5
  %17 = load ptr, ptr %3, align 8, !tbaa !5
  %18 = call noundef nonnull align 16 dereferenceable(32) ptr @_ZNKSt6vectorISt7complexIeESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %17, i64 noundef 0) #3
  call void @llvm.memcpy.p0.p0.i64(ptr align 16 %5, ptr align 16 %18, i64 32, i1 false), !tbaa.struct !9
  %19 = load ptr, ptr %3, align 8, !tbaa !5
  %20 = call noundef nonnull align 16 dereferenceable(32) ptr @_ZNKSt6vectorISt7complexIeESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %19, i64 noundef 1) #3
  call void @llvm.memcpy.p0.p0.i64(ptr align 16 %6, ptr align 16 %20, i64 32, i1 false), !tbaa.struct !9
  %21 = load ptr, ptr %4, align 8, !tbaa !5
  %22 = call noundef nonnull align 16 dereferenceable(32) ptr @_ZNKSt6vectorISt7complexIeESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %21, i64 noundef 0) #3
  call void @llvm.memcpy.p0.p0.i64(ptr align 16 %7, ptr align 16 %22, i64 32, i1 false), !tbaa.struct !9
  %23 = call noundef i32 @_Z3ccwSt7complexIeES0_S0_(ptr noundef byval(%"class.std::complex") align 16 %5, ptr noundef byval(%"class.std::complex") align 16 %6, ptr noundef byval(%"class.std::complex") align 16 %7)
  %24 = load ptr, ptr %3, align 8, !tbaa !5
  %25 = call noundef nonnull align 16 dereferenceable(32) ptr @_ZNKSt6vectorISt7complexIeESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %24, i64 noundef 0) #3
  call void @llvm.memcpy.p0.p0.i64(ptr align 16 %8, ptr align 16 %25, i64 32, i1 false), !tbaa.struct !9
  %26 = load ptr, ptr %3, align 8, !tbaa !5
  %27 = call noundef nonnull align 16 dereferenceable(32) ptr @_ZNKSt6vectorISt7complexIeESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %26, i64 noundef 1) #3
  call void @llvm.memcpy.p0.p0.i64(ptr align 16 %9, ptr align 16 %27, i64 32, i1 false), !tbaa.struct !9
  %28 = load ptr, ptr %4, align 8, !tbaa !5
  %29 = call noundef nonnull align 16 dereferenceable(32) ptr @_ZNKSt6vectorISt7complexIeESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %28, i64 noundef 1) #3
  call void @llvm.memcpy.p0.p0.i64(ptr align 16 %10, ptr align 16 %29, i64 32, i1 false), !tbaa.struct !9
  %30 = call noundef i32 @_Z3ccwSt7complexIeES0_S0_(ptr noundef byval(%"class.std::complex") align 16 %8, ptr noundef byval(%"class.std::complex") align 16 %9, ptr noundef byval(%"class.std::complex") align 16 %10)
  %31 = mul nsw i32 %23, %30
  %32 = icmp sle i32 %31, 0
  br i1 %32, label %33, label %50

33:                                               ; preds = %2
  %34 = load ptr, ptr %4, align 8, !tbaa !5
  %35 = call noundef nonnull align 16 dereferenceable(32) ptr @_ZNKSt6vectorISt7complexIeESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %34, i64 noundef 0) #3
  call void @llvm.memcpy.p0.p0.i64(ptr align 16 %11, ptr align 16 %35, i64 32, i1 false), !tbaa.struct !9
  %36 = load ptr, ptr %4, align 8, !tbaa !5
  %37 = call noundef nonnull align 16 dereferenceable(32) ptr @_ZNKSt6vectorISt7complexIeESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %36, i64 noundef 1) #3
  call void @llvm.memcpy.p0.p0.i64(ptr align 16 %12, ptr align 16 %37, i64 32, i1 false), !tbaa.struct !9
  %38 = load ptr, ptr %3, align 8, !tbaa !5
  %39 = call noundef nonnull align 16 dereferenceable(32) ptr @_ZNKSt6vectorISt7complexIeESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %38, i64 noundef 0) #3
  call void @llvm.memcpy.p0.p0.i64(ptr align 16 %13, ptr align 16 %39, i64 32, i1 false), !tbaa.struct !9
  %40 = call noundef i32 @_Z3ccwSt7complexIeES0_S0_(ptr noundef byval(%"class.std::complex") align 16 %11, ptr noundef byval(%"class.std::complex") align 16 %12, ptr noundef byval(%"class.std::complex") align 16 %13)
  %41 = load ptr, ptr %4, align 8, !tbaa !5
  %42 = call noundef nonnull align 16 dereferenceable(32) ptr @_ZNKSt6vectorISt7complexIeESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %41, i64 noundef 0) #3
  call void @llvm.memcpy.p0.p0.i64(ptr align 16 %14, ptr align 16 %42, i64 32, i1 false), !tbaa.struct !9
  %43 = load ptr, ptr %4, align 8, !tbaa !5
  %44 = call noundef nonnull align 16 dereferenceable(32) ptr @_ZNKSt6vectorISt7complexIeESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %43, i64 noundef 1) #3
  call void @llvm.memcpy.p0.p0.i64(ptr align 16 %15, ptr align 16 %44, i64 32, i1 false), !tbaa.struct !9
  %45 = load ptr, ptr %3, align 8, !tbaa !5
  %46 = call noundef nonnull align 16 dereferenceable(32) ptr @_ZNKSt6vectorISt7complexIeESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %45, i64 noundef 1) #3
  call void @llvm.memcpy.p0.p0.i64(ptr align 16 %16, ptr align 16 %46, i64 32, i1 false), !tbaa.struct !9
  %47 = call noundef i32 @_Z3ccwSt7complexIeES0_S0_(ptr noundef byval(%"class.std::complex") align 16 %14, ptr noundef byval(%"class.std::complex") align 16 %15, ptr noundef byval(%"class.std::complex") align 16 %16)
  %48 = mul nsw i32 %40, %47
  %49 = icmp sle i32 %48, 0
  br label %50

50:                                               ; preds = %33, %2
  %51 = phi i1 [ false, %2 ], [ %49, %33 ]
  ret i1 %51
}

attributes #0 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #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 = !{i64 0, i64 32, !10}
!10 = !{!7, !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"

%"class.std::complex" = type { { x86_fp80, x86_fp80 } }

; Function Attrs: mustprogress 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) #0

; Function Attrs: mustprogress uwtable
declare dso_local noundef i32 @_Z3ccwSt7complexIeES0_S0_(ptr noundef byval(%"class.std::complex") align 16, ptr noundef byval(%"class.std::complex") align 16, ptr noundef byval(%"class.std::complex") align 16) local_unnamed_addr #1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 16 dereferenceable(32) ptr @_ZNKSt6vectorISt7complexIeESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24), i64 noundef) local_unnamed_addr #2 align 2

; Function Attrs: mustprogress uwtable
define dso_local noundef zeroext i1 @_Z9IntersectRK7SegmentS1_(ptr noundef nonnull align 8 dereferenceable(24) %0, ptr noundef nonnull align 8 dereferenceable(24) %1) local_unnamed_addr #1 {
  %3 = alloca %"class.std::complex", align 16
  %4 = alloca %"class.std::complex", align 16
  %5 = alloca %"class.std::complex", align 16
  %6 = alloca %"class.std::complex", align 16
  %7 = alloca %"class.std::complex", align 16
  %8 = alloca %"class.std::complex", align 16
  %9 = alloca %"class.std::complex", align 16
  %10 = alloca %"class.std::complex", align 16
  %11 = tail call noundef nonnull align 16 dereferenceable(32) ptr @_ZNKSt6vectorISt7complexIeESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %0, i64 noundef 0) #3
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 16 dereferenceable(32) %3, ptr noundef nonnull align 16 dereferenceable(32) %11, i64 32, i1 false), !tbaa.struct !5
  %12 = tail call noundef nonnull align 16 dereferenceable(32) ptr @_ZNKSt6vectorISt7complexIeESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %0, i64 noundef 1) #3
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 16 dereferenceable(32) %4, ptr noundef nonnull align 16 dereferenceable(32) %12, i64 32, i1 false), !tbaa.struct !5
  %13 = tail call noundef nonnull align 16 dereferenceable(32) ptr @_ZNKSt6vectorISt7complexIeESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %1, i64 noundef 0) #3
  %14 = tail call noundef i32 @_Z3ccwSt7complexIeES0_S0_(ptr noundef nonnull byval(%"class.std::complex") align 16 %3, ptr noundef nonnull byval(%"class.std::complex") align 16 %4, ptr noundef nonnull byval(%"class.std::complex") align 16 %13)
  %15 = tail call noundef nonnull align 16 dereferenceable(32) ptr @_ZNKSt6vectorISt7complexIeESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %0, i64 noundef 0) #3
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 16 dereferenceable(32) %5, ptr noundef nonnull align 16 dereferenceable(32) %15, i64 32, i1 false), !tbaa.struct !5
  %16 = tail call noundef nonnull align 16 dereferenceable(32) ptr @_ZNKSt6vectorISt7complexIeESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %0, i64 noundef 1) #3
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 16 dereferenceable(32) %6, ptr noundef nonnull align 16 dereferenceable(32) %16, i64 32, i1 false), !tbaa.struct !5
  %17 = tail call noundef nonnull align 16 dereferenceable(32) ptr @_ZNKSt6vectorISt7complexIeESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %1, i64 noundef 1) #3
  %18 = tail call noundef i32 @_Z3ccwSt7complexIeES0_S0_(ptr noundef nonnull byval(%"class.std::complex") align 16 %5, ptr noundef nonnull byval(%"class.std::complex") align 16 %6, ptr noundef nonnull byval(%"class.std::complex") align 16 %17)
  %19 = mul nsw i32 %18, %14
  %20 = icmp slt i32 %19, 1
  br i1 %20, label %21, label %32

21:                                               ; preds = %2
  %22 = tail call noundef nonnull align 16 dereferenceable(32) ptr @_ZNKSt6vectorISt7complexIeESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %1, i64 noundef 0) #3
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 16 dereferenceable(32) %7, ptr noundef nonnull align 16 dereferenceable(32) %22, i64 32, i1 false), !tbaa.struct !5
  %23 = tail call noundef nonnull align 16 dereferenceable(32) ptr @_ZNKSt6vectorISt7complexIeESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %1, i64 noundef 1) #3
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 16 dereferenceable(32) %8, ptr noundef nonnull align 16 dereferenceable(32) %23, i64 32, i1 false), !tbaa.struct !5
  %24 = tail call noundef nonnull align 16 dereferenceable(32) ptr @_ZNKSt6vectorISt7complexIeESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %0, i64 noundef 0) #3
  %25 = tail call noundef i32 @_Z3ccwSt7complexIeES0_S0_(ptr noundef nonnull byval(%"class.std::complex") align 16 %7, ptr noundef nonnull byval(%"class.std::complex") align 16 %8, ptr noundef nonnull byval(%"class.std::complex") align 16 %24)
  %26 = tail call noundef nonnull align 16 dereferenceable(32) ptr @_ZNKSt6vectorISt7complexIeESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %1, i64 noundef 0) #3
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 16 dereferenceable(32) %9, ptr noundef nonnull align 16 dereferenceable(32) %26, i64 32, i1 false), !tbaa.struct !5
  %27 = tail call noundef nonnull align 16 dereferenceable(32) ptr @_ZNKSt6vectorISt7complexIeESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %1, i64 noundef 1) #3
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 16 dereferenceable(32) %10, ptr noundef nonnull align 16 dereferenceable(32) %27, i64 32, i1 false), !tbaa.struct !5
  %28 = tail call noundef nonnull align 16 dereferenceable(32) ptr @_ZNKSt6vectorISt7complexIeESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %0, i64 noundef 1) #3
  %29 = tail call noundef i32 @_Z3ccwSt7complexIeES0_S0_(ptr noundef nonnull byval(%"class.std::complex") align 16 %9, ptr noundef nonnull byval(%"class.std::complex") align 16 %10, ptr noundef nonnull byval(%"class.std::complex") align 16 %28)
  %30 = mul nsw i32 %29, %25
  %31 = icmp slt i32 %30, 1
  br label %32

32:                                               ; preds = %21, %2
  %33 = phi i1 [ false, %2 ], [ %31, %21 ]
  ret i1 %33
}

attributes #0 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #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 = !{i64 0, i64 32, !6}
!6 = !{!7, !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}


; Effective O3 passes: DSEPass,GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,MemCpyOptPass,ReassociatePass,SROAPass,TailCallElimPass