; LLVM IR from ShahjalalShohag/code-library :: Geometry/Geometry 2D.ll (Z24convex_line_intersectionRSt6vectorI2PTSaIS0_EES0_S0_i)

; 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 { double, double }
%"struct.std::array" = type { [2 x i32] }
%class.anon.31 = type { ptr, ptr, ptr }

; 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: mustprogress uwtable
declare dso_local void @_ZNK2PTmiERKS_(ptr dead_on_unwind noalias writable sret(%struct.PT) align 8, ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 8 dereferenceable(16)) #1 align 2

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i64 @_ZNKSt6vectorI2PTSaIS0_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24)) #3 align 2

; Function Attrs: mustprogress uwtable
declare dso_local noundef i32 @_Z14extreme_vertexRSt6vectorI2PTSaIS0_EERKS0_i(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 8 dereferenceable(16), i32 noundef) #1

; Function Attrs: mustprogress uwtable
define dso_local i64 @_Z24convex_line_intersectionRSt6vectorI2PTSaIS0_EES0_S0_i(ptr noundef nonnull align 8 dereferenceable(24) %0, ptr noundef %1, ptr noundef %2, i32 noundef %3) #1 {
  %5 = alloca %"struct.std::array", align 4
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  %11 = alloca %struct.PT, align 8
  %12 = alloca %struct.PT, align 8
  %13 = alloca i32, align 4
  %14 = alloca %struct.PT, align 8
  %15 = alloca %struct.PT, align 8
  %16 = alloca %class.anon.31, align 8
  %17 = alloca i32, align 4
  %18 = alloca %"struct.std::array", align 4
  %19 = alloca i32, align 4
  %20 = alloca i32, align 4
  %21 = alloca i32, align 4
  %22 = alloca i32, align 4
  %23 = alloca i32, align 4
  store ptr %0, ptr %6, align 8, !tbaa !5
  store ptr %1, ptr %7, align 8, !tbaa !5
  store ptr %2, ptr %8, align 8, !tbaa !5
  store i32 %3, ptr %9, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #6
  %24 = load ptr, ptr %6, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 16, ptr %11) #6
  call void @llvm.lifetime.start.p0(i64 16, ptr %12) #6
  call void @_ZNK2PTmiERKS_(ptr dead_on_unwind writable sret(%struct.PT) align 8 %12, ptr noundef nonnull align 8 dereferenceable(16) %1, ptr noundef nonnull align 8 dereferenceable(16) %2)
  call void @_ZN2PT4perpEv(ptr dead_on_unwind writable sret(%struct.PT) align 8 %11, ptr noundef nonnull align 8 dereferenceable(16) %12)
  %25 = load i32, ptr %9, align 4, !tbaa !9
  %26 = call noundef i32 @_Z14extreme_vertexRSt6vectorI2PTSaIS0_EERKS0_i(ptr noundef nonnull align 8 dereferenceable(24) %24, ptr noundef nonnull align 8 dereferenceable(16) %11, i32 noundef %25)
  call void @llvm.lifetime.end.p0(i64 16, ptr %12) #6
  call void @llvm.lifetime.end.p0(i64 16, ptr %11) #6
  store i32 %26, ptr %10, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #6
  %27 = load ptr, ptr %6, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 16, ptr %14) #6
  call void @llvm.lifetime.start.p0(i64 16, ptr %15) #6
  call void @_ZNK2PTmiERKS_(ptr dead_on_unwind writable sret(%struct.PT) align 8 %15, ptr noundef nonnull align 8 dereferenceable(16) %2, ptr noundef nonnull align 8 dereferenceable(16) %1)
  call void @_ZN2PT4perpEv(ptr dead_on_unwind writable sret(%struct.PT) align 8 %14, ptr noundef nonnull align 8 dereferenceable(16) %15)
  %28 = load i32, ptr %9, align 4, !tbaa !9
  %29 = call noundef i32 @_Z14extreme_vertexRSt6vectorI2PTSaIS0_EERKS0_i(ptr noundef nonnull align 8 dereferenceable(24) %27, ptr noundef nonnull align 8 dereferenceable(16) %14, i32 noundef %28)
  call void @llvm.lifetime.end.p0(i64 16, ptr %15) #6
  call void @llvm.lifetime.end.p0(i64 16, ptr %14) #6
  store i32 %29, ptr %13, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 24, ptr %16) #6
  %30 = getelementptr inbounds %class.anon.31, ptr %16, i32 0, i32 0
  store ptr %1, ptr %30, align 8, !tbaa !5
  %31 = getelementptr inbounds %class.anon.31, ptr %16, i32 0, i32 1
  %32 = load ptr, ptr %6, align 8, !tbaa !5
  store ptr %32, ptr %31, align 8, !tbaa !5
  %33 = getelementptr inbounds %class.anon.31, ptr %16, i32 0, i32 2
  store ptr %2, ptr %33, align 8, !tbaa !5
  %34 = load i32, ptr %10, align 4, !tbaa !9
  %35 = call noundef i32 @"_ZZ24convex_line_intersectionRSt6vectorI2PTSaIS0_EES0_S0_iENK3$_0clEi"(ptr noundef nonnull align 8 dereferenceable(24) %16, i32 noundef %34)
  %36 = icmp slt i32 %35, 0
  br i1 %36, label %41, label %37

37:                                               ; preds = %4
  %38 = load i32, ptr %13, align 4, !tbaa !9
  %39 = call noundef i32 @"_ZZ24convex_line_intersectionRSt6vectorI2PTSaIS0_EES0_S0_iENK3$_0clEi"(ptr noundef nonnull align 8 dereferenceable(24) %16, i32 noundef %38)
  %40 = icmp sgt i32 %39, 0
  br i1 %40, label %41, label %44

41:                                               ; preds = %37, %4
  %42 = getelementptr inbounds %"struct.std::array", ptr %5, i32 0, i32 0
  store i32 -1, ptr %42, align 4, !tbaa !9
  %43 = getelementptr inbounds i32, ptr %42, i64 1
  store i32 -1, ptr %43, align 4, !tbaa !9
  store i32 1, ptr %17, align 4
  br label %157

44:                                               ; preds = %37
  call void @llvm.lifetime.start.p0(i64 8, ptr %18) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %19) #6
  store i32 0, ptr %19, align 4, !tbaa !9
  br label %45

45:                                               ; preds = %101, %44
  %46 = load i32, ptr %19, align 4, !tbaa !9
  %47 = icmp slt i32 %46, 2
  br i1 %47, label %49, label %48

48:                                               ; preds = %45
  store i32 2, ptr %17, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %19) #6
  br label %104

49:                                               ; preds = %45
  call void @llvm.lifetime.start.p0(i64 4, ptr %20) #6
  %50 = load i32, ptr %13, align 4, !tbaa !9
  store i32 %50, ptr %20, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %21) #6
  %51 = load i32, ptr %10, align 4, !tbaa !9
  store i32 %51, ptr %21, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %22) #6
  %52 = load ptr, ptr %6, align 8, !tbaa !5
  %53 = call noundef i64 @_ZNKSt6vectorI2PTSaIS0_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %52) #6
  %54 = trunc i64 %53 to i32
  store i32 %54, ptr %22, align 4, !tbaa !9
  br label %55

55:                                               ; preds = %86, %49
  %56 = load i32, ptr %20, align 4, !tbaa !9
  %57 = add nsw i32 %56, 1
  %58 = load i32, ptr %22, align 4, !tbaa !9
  %59 = srem i32 %57, %58
  %60 = load i32, ptr %21, align 4, !tbaa !9
  %61 = icmp ne i32 %59, %60
  br i1 %61, label %62, label %88

62:                                               ; preds = %55
  call void @llvm.lifetime.start.p0(i64 4, ptr %23) #6
  %63 = load i32, ptr %20, align 4, !tbaa !9
  %64 = load i32, ptr %21, align 4, !tbaa !9
  %65 = add nsw i32 %63, %64
  %66 = load i32, ptr %20, align 4, !tbaa !9
  %67 = load i32, ptr %21, align 4, !tbaa !9
  %68 = icmp slt i32 %66, %67
  br i1 %68, label %69, label %70

69:                                               ; preds = %62
  br label %72

70:                                               ; preds = %62
  %71 = load i32, ptr %22, align 4, !tbaa !9
  br label %72

72:                                               ; preds = %70, %69
  %73 = phi i32 [ 0, %69 ], [ %71, %70 ]
  %74 = add nsw i32 %65, %73
  %75 = sdiv i32 %74, 2
  %76 = load i32, ptr %22, align 4, !tbaa !9
  %77 = srem i32 %75, %76
  store i32 %77, ptr %23, align 4, !tbaa !9
  %78 = load i32, ptr %23, align 4, !tbaa !9
  %79 = load i32, ptr %23, align 4, !tbaa !9
  %80 = call noundef i32 @"_ZZ24convex_line_intersectionRSt6vectorI2PTSaIS0_EES0_S0_iENK3$_0clEi"(ptr noundef nonnull align 8 dereferenceable(24) %16, i32 noundef %79)
  %81 = load i32, ptr %13, align 4, !tbaa !9
  %82 = call noundef i32 @"_ZZ24convex_line_intersectionRSt6vectorI2PTSaIS0_EES0_S0_iENK3$_0clEi"(ptr noundef nonnull align 8 dereferenceable(24) %16, i32 noundef %81)
  %83 = icmp eq i32 %80, %82
  br i1 %83, label %84, label %85

84:                                               ; preds = %72
  br label %86

85:                                               ; preds = %72
  br label %86

86:                                               ; preds = %85, %84
  %87 = phi ptr [ %20, %84 ], [ %21, %85 ]
  store i32 %78, ptr %87, align 4, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 4, ptr %23) #6
  br label %55, !llvm.loop !11

88:                                               ; preds = %55
  %89 = load i32, ptr %20, align 4, !tbaa !9
  %90 = load i32, ptr %21, align 4, !tbaa !9
  %91 = call noundef i32 @"_ZZ24convex_line_intersectionRSt6vectorI2PTSaIS0_EES0_S0_iENK3$_0clEi"(ptr noundef nonnull align 8 dereferenceable(24) %16, i32 noundef %90)
  %92 = icmp ne i32 %91, 0
  %93 = xor i1 %92, true
  %94 = zext i1 %93 to i32
  %95 = add nsw i32 %89, %94
  %96 = load i32, ptr %22, align 4, !tbaa !9
  %97 = srem i32 %95, %96
  %98 = load i32, ptr %19, align 4, !tbaa !9
  %99 = sext i32 %98 to i64
  %100 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt5arrayIiLm2EEixEm(ptr noundef nonnull align 4 dereferenceable(8) %18, i64 noundef %99) #6
  store i32 %97, ptr %100, align 4, !tbaa !9
  call void @_ZSt4swapIiENSt9enable_ifIXsr6__and_ISt6__not_ISt15__is_tuple_likeIT_EESt21is_move_constructibleIS3_ESt18is_move_assignableIS3_EEE5valueEvE4typeERS3_SC_(ptr noundef nonnull align 4 dereferenceable(4) %10, ptr noundef nonnull align 4 dereferenceable(4) %13) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %22) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %21) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %20) #6
  br label %101

101:                                              ; preds = %88
  %102 = load i32, ptr %19, align 4, !tbaa !9
  %103 = add nsw i32 %102, 1
  store i32 %103, ptr %19, align 4, !tbaa !9
  br label %45, !llvm.loop !13

104:                                              ; preds = %48
  %105 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt5arrayIiLm2EEixEm(ptr noundef nonnull align 4 dereferenceable(8) %18, i64 noundef 0) #6
  %106 = load i32, ptr %105, align 4, !tbaa !9
  %107 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt5arrayIiLm2EEixEm(ptr noundef nonnull align 4 dereferenceable(8) %18, i64 noundef 1) #6
  %108 = load i32, ptr %107, align 4, !tbaa !9
  %109 = icmp eq i32 %106, %108
  br i1 %109, label %110, label %115

110:                                              ; preds = %104
  %111 = getelementptr inbounds %"struct.std::array", ptr %5, i32 0, i32 0
  %112 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt5arrayIiLm2EEixEm(ptr noundef nonnull align 4 dereferenceable(8) %18, i64 noundef 0) #6
  %113 = load i32, ptr %112, align 4, !tbaa !9
  store i32 %113, ptr %111, align 4, !tbaa !9
  %114 = getelementptr inbounds i32, ptr %111, i64 1
  store i32 -1, ptr %114, align 4, !tbaa !9
  store i32 1, ptr %17, align 4
  br label %156

115:                                              ; preds = %104
  %116 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt5arrayIiLm2EEixEm(ptr noundef nonnull align 4 dereferenceable(8) %18, i64 noundef 0) #6
  %117 = load i32, ptr %116, align 4, !tbaa !9
  %118 = call noundef i32 @"_ZZ24convex_line_intersectionRSt6vectorI2PTSaIS0_EES0_S0_iENK3$_0clEi"(ptr noundef nonnull align 8 dereferenceable(24) %16, i32 noundef %117)
  %119 = icmp ne i32 %118, 0
  br i1 %119, label %155, label %120

120:                                              ; preds = %115
  %121 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt5arrayIiLm2EEixEm(ptr noundef nonnull align 4 dereferenceable(8) %18, i64 noundef 1) #6
  %122 = load i32, ptr %121, align 4, !tbaa !9
  %123 = call noundef i32 @"_ZZ24convex_line_intersectionRSt6vectorI2PTSaIS0_EES0_S0_iENK3$_0clEi"(ptr noundef nonnull align 8 dereferenceable(24) %16, i32 noundef %122)
  %124 = icmp ne i32 %123, 0
  br i1 %124, label %155, label %125

125:                                              ; preds = %120
  %126 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt5arrayIiLm2EEixEm(ptr noundef nonnull align 4 dereferenceable(8) %18, i64 noundef 0) #6
  %127 = load i32, ptr %126, align 4, !tbaa !9
  %128 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt5arrayIiLm2EEixEm(ptr noundef nonnull align 4 dereferenceable(8) %18, i64 noundef 1) #6
  %129 = load i32, ptr %128, align 4, !tbaa !9
  %130 = sub nsw i32 %127, %129
  %131 = load ptr, ptr %6, align 8, !tbaa !5
  %132 = call noundef i64 @_ZNKSt6vectorI2PTSaIS0_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %131) #6
  %133 = trunc i64 %132 to i32
  %134 = add nsw i32 %130, %133
  %135 = add nsw i32 %134, 1
  %136 = sext i32 %135 to i64
  %137 = load ptr, ptr %6, align 8, !tbaa !5
  %138 = call noundef i64 @_ZNKSt6vectorI2PTSaIS0_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %137) #6
  %139 = urem i64 %136, %138
  switch i64 %139, label %154 [
    i64 0, label %140
    i64 2, label %147
  ]

140:                                              ; preds = %125
  %141 = getelementptr inbounds %"struct.std::array", ptr %5, i32 0, i32 0
  %142 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt5arrayIiLm2EEixEm(ptr noundef nonnull align 4 dereferenceable(8) %18, i64 noundef 0) #6
  %143 = load i32, ptr %142, align 4, !tbaa !9
  store i32 %143, ptr %141, align 4, !tbaa !9
  %144 = getelementptr inbounds i32, ptr %141, i64 1
  %145 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt5arrayIiLm2EEixEm(ptr noundef nonnull align 4 dereferenceable(8) %18, i64 noundef 0) #6
  %146 = load i32, ptr %145, align 4, !tbaa !9
  store i32 %146, ptr %144, align 4, !tbaa !9
  store i32 1, ptr %17, align 4
  br label %156

147:                                              ; preds = %125
  %148 = getelementptr inbounds %"struct.std::array", ptr %5, i32 0, i32 0
  %149 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt5arrayIiLm2EEixEm(ptr noundef nonnull align 4 dereferenceable(8) %18, i64 noundef 1) #6
  %150 = load i32, ptr %149, align 4, !tbaa !9
  store i32 %150, ptr %148, align 4, !tbaa !9
  %151 = getelementptr inbounds i32, ptr %148, i64 1
  %152 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt5arrayIiLm2EEixEm(ptr noundef nonnull align 4 dereferenceable(8) %18, i64 noundef 1) #6
  %153 = load i32, ptr %152, align 4, !tbaa !9
  store i32 %153, ptr %151, align 4, !tbaa !9
  store i32 1, ptr %17, align 4
  br label %156

154:                                              ; preds = %125
  br label %155

155:                                              ; preds = %154, %120, %115
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %5, ptr align 4 %18, i64 8, i1 false), !tbaa.struct !14
  store i32 1, ptr %17, align 4
  br label %156

156:                                              ; preds = %155, %147, %140, %110
  call void @llvm.lifetime.end.p0(i64 8, ptr %18) #6
  br label %157

157:                                              ; preds = %156, %41
  call void @llvm.lifetime.end.p0(i64 24, ptr %16) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #6
  %158 = getelementptr inbounds %"struct.std::array", ptr %5, i32 0, i32 0
  %159 = load i64, ptr %158, align 4
  ret i64 %159
}

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN2PT4perpEv(ptr dead_on_unwind noalias writable sret(%struct.PT) align 8, ptr noundef nonnull align 8 dereferenceable(16)) #1 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare hidden noundef i32 @"_ZZ24convex_line_intersectionRSt6vectorI2PTSaIS0_EES0_S0_iENK3$_0clEi"(ptr noundef nonnull align 8 dereferenceable(24), i32 noundef) #4 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt5arrayIiLm2EEixEm(ptr noundef nonnull align 4 dereferenceable(8), i64 noundef) #3 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZSt4swapIiENSt9enable_ifIXsr6__and_ISt6__not_ISt15__is_tuple_likeIT_EESt21is_move_constructibleIS3_ESt18is_move_assignableIS3_EEE5valueEvE4typeERS3_SC_(ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4)) #5

attributes #0 = { nocallback nofree nosync 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 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { 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 = { inlinehint 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 = { 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 #6 = { 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 = !{!"int", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = distinct !{!13, !12}
!14 = !{i64 0, i64 8, !15}
!15 = !{!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"

%struct.PT = type { double, double }
%class.anon.31 = type { ptr, ptr, ptr }
%"struct.std::array" = type { [2 x i32] }

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

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNK2PTmiERKS_(ptr dead_on_unwind noalias writable sret(%struct.PT) align 8, ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 8 dereferenceable(16)) local_unnamed_addr #1 align 2

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

; Function Attrs: mustprogress uwtable
declare dso_local noundef i32 @_Z14extreme_vertexRSt6vectorI2PTSaIS0_EERKS0_i(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 8 dereferenceable(16), i32 noundef) local_unnamed_addr #1

; Function Attrs: mustprogress uwtable
define dso_local i64 @_Z24convex_line_intersectionRSt6vectorI2PTSaIS0_EES0_S0_i(ptr noundef nonnull align 8 dereferenceable(24) %0, ptr noundef nonnull %1, ptr noundef nonnull %2, i32 noundef %3) local_unnamed_addr #1 {
  %5 = alloca i32, align 4
  %6 = alloca %struct.PT, align 8
  %7 = alloca %struct.PT, align 8
  %8 = alloca i32, align 4
  %9 = alloca %struct.PT, align 8
  %10 = alloca %struct.PT, align 8
  %11 = alloca %class.anon.31, align 8
  %12 = alloca %"struct.std::array", align 4
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %5) #5
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %6) #5
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %7) #5
  call void @_ZNK2PTmiERKS_(ptr dead_on_unwind nonnull writable sret(%struct.PT) align 8 %7, ptr noundef nonnull align 8 dereferenceable(16) %1, ptr noundef nonnull align 8 dereferenceable(16) %2)
  call void @_ZN2PT4perpEv(ptr dead_on_unwind nonnull writable sret(%struct.PT) align 8 %6, ptr noundef nonnull align 8 dereferenceable(16) %7)
  %13 = call noundef i32 @_Z14extreme_vertexRSt6vectorI2PTSaIS0_EERKS0_i(ptr noundef nonnull align 8 dereferenceable(24) %0, ptr noundef nonnull align 8 dereferenceable(16) %6, i32 noundef %3)
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %7) #5
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %6) #5
  store i32 %13, ptr %5, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %8) #5
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %9) #5
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %10) #5
  call void @_ZNK2PTmiERKS_(ptr dead_on_unwind nonnull writable sret(%struct.PT) align 8 %10, ptr noundef nonnull align 8 dereferenceable(16) %2, ptr noundef nonnull align 8 dereferenceable(16) %1)
  call void @_ZN2PT4perpEv(ptr dead_on_unwind nonnull writable sret(%struct.PT) align 8 %9, ptr noundef nonnull align 8 dereferenceable(16) %10)
  %14 = call noundef i32 @_Z14extreme_vertexRSt6vectorI2PTSaIS0_EERKS0_i(ptr noundef nonnull align 8 dereferenceable(24) %0, ptr noundef nonnull align 8 dereferenceable(16) %9, i32 noundef %3)
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %10) #5
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %9) #5
  store i32 %14, ptr %8, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %11) #5
  store ptr %1, ptr %11, align 8, !tbaa !9
  %15 = getelementptr inbounds i8, ptr %11, i64 8
  store ptr %0, ptr %15, align 8, !tbaa !9
  %16 = getelementptr inbounds i8, ptr %11, i64 16
  store ptr %2, ptr %16, align 8, !tbaa !9
  %17 = call noundef i32 @"_ZZ24convex_line_intersectionRSt6vectorI2PTSaIS0_EES0_S0_iENK3$_0clEi"(ptr noundef nonnull align 8 dereferenceable(24) %11, i32 noundef %13)
  %18 = icmp slt i32 %17, 0
  br i1 %18, label %108, label %19

19:                                               ; preds = %4
  %20 = call noundef i32 @"_ZZ24convex_line_intersectionRSt6vectorI2PTSaIS0_EES0_S0_iENK3$_0clEi"(ptr noundef nonnull align 8 dereferenceable(24) %11, i32 noundef %14)
  %21 = icmp sgt i32 %20, 0
  br i1 %21, label %108, label %22

22:                                               ; preds = %19
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %12) #5
  %23 = call noundef i64 @_ZNKSt6vectorI2PTSaIS0_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %0) #5
  %24 = trunc i64 %23 to i32
  %25 = add nsw i32 %14, 1
  %26 = srem i32 %25, %24
  %.not3133 = icmp eq i32 %26, %13
  br i1 %.not3133, label %._crit_edge, label %.cont

.cont:                                            ; preds = %22, %.cont
  %.035 = phi i32 [ %.0., %.cont ], [ %13, %22 ]
  %.02734 = phi i32 [ %..027, %.cont ], [ %14, %22 ]
  %27 = add nsw i32 %.035, %.02734
  %28 = icmp slt i32 %.02734, %.035
  %29 = select i1 %28, i32 0, i32 %24
  %30 = add nsw i32 %27, %29
  %31 = sdiv i32 %30, 2
  %32 = srem i32 %31, %24
  %33 = call noundef i32 @"_ZZ24convex_line_intersectionRSt6vectorI2PTSaIS0_EES0_S0_iENK3$_0clEi"(ptr noundef nonnull align 8 dereferenceable(24) %11, i32 noundef %32)
  %34 = call noundef i32 @"_ZZ24convex_line_intersectionRSt6vectorI2PTSaIS0_EES0_S0_iENK3$_0clEi"(ptr noundef nonnull align 8 dereferenceable(24) %11, i32 noundef %14)
  %35 = icmp eq i32 %33, %34
  %..027 = select i1 %35, i32 %32, i32 %.02734
  %.0. = select i1 %35, i32 %.035, i32 %32
  %36 = add nsw i32 %..027, 1
  %37 = srem i32 %36, %24
  %.not31 = icmp eq i32 %37, %.0.
  br i1 %.not31, label %._crit_edge, label %.cont, !llvm.loop !11

._crit_edge:                                      ; preds = %.cont, %22
  %.027.lcssa = phi i32 [ %14, %22 ], [ %..027, %.cont ]
  %.0.lcssa = phi i32 [ %13, %22 ], [ %.0., %.cont ]
  %38 = call noundef i32 @"_ZZ24convex_line_intersectionRSt6vectorI2PTSaIS0_EES0_S0_iENK3$_0clEi"(ptr noundef nonnull align 8 dereferenceable(24) %11, i32 noundef %.0.lcssa)
  %.not32 = icmp eq i32 %38, 0
  %39 = zext i1 %.not32 to i32
  %40 = add nsw i32 %.027.lcssa, %39
  %41 = srem i32 %40, %24
  %42 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt5arrayIiLm2EEixEm(ptr noundef nonnull align 4 dereferenceable(8) %12, i64 noundef 0) #5
  store i32 %41, ptr %42, align 4, !tbaa !5
  call void @_ZSt4swapIiENSt9enable_ifIXsr6__and_ISt6__not_ISt15__is_tuple_likeIT_EESt21is_move_constructibleIS3_ESt18is_move_assignableIS3_EEE5valueEvE4typeERS3_SC_(ptr noundef nonnull align 4 dereferenceable(4) %5, ptr noundef nonnull align 4 dereferenceable(4) %8) #5
  %43 = load i32, ptr %8, align 4, !tbaa !5
  %44 = load i32, ptr %5, align 4, !tbaa !5
  %45 = call noundef i64 @_ZNKSt6vectorI2PTSaIS0_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %0) #5
  %46 = trunc i64 %45 to i32
  %47 = add nsw i32 %43, 1
  %48 = srem i32 %47, %46
  %.not3133.1 = icmp eq i32 %48, %44
  br i1 %.not3133.1, label %._crit_edge.1, label %.cont.1

.cont.1:                                          ; preds = %._crit_edge, %.cont.1
  %.035.1 = phi i32 [ %.0..1, %.cont.1 ], [ %44, %._crit_edge ]
  %.02734.1 = phi i32 [ %..027.1, %.cont.1 ], [ %43, %._crit_edge ]
  %49 = add nsw i32 %.035.1, %.02734.1
  %50 = icmp slt i32 %.02734.1, %.035.1
  %51 = select i1 %50, i32 0, i32 %46
  %52 = add nsw i32 %49, %51
  %53 = sdiv i32 %52, 2
  %54 = srem i32 %53, %46
  %55 = call noundef i32 @"_ZZ24convex_line_intersectionRSt6vectorI2PTSaIS0_EES0_S0_iENK3$_0clEi"(ptr noundef nonnull align 8 dereferenceable(24) %11, i32 noundef %54)
  %56 = load i32, ptr %8, align 4, !tbaa !5
  %57 = call noundef i32 @"_ZZ24convex_line_intersectionRSt6vectorI2PTSaIS0_EES0_S0_iENK3$_0clEi"(ptr noundef nonnull align 8 dereferenceable(24) %11, i32 noundef %56)
  %58 = icmp eq i32 %55, %57
  %..027.1 = select i1 %58, i32 %54, i32 %.02734.1
  %.0..1 = select i1 %58, i32 %.035.1, i32 %54
  %59 = add nsw i32 %..027.1, 1
  %60 = srem i32 %59, %46
  %.not31.1 = icmp eq i32 %60, %.0..1
  br i1 %.not31.1, label %._crit_edge.1, label %.cont.1, !llvm.loop !11

._crit_edge.1:                                    ; preds = %.cont.1, %._crit_edge
  %.027.lcssa.1 = phi i32 [ %43, %._crit_edge ], [ %..027.1, %.cont.1 ]
  %.0.lcssa.1 = phi i32 [ %44, %._crit_edge ], [ %.0..1, %.cont.1 ]
  %61 = call noundef i32 @"_ZZ24convex_line_intersectionRSt6vectorI2PTSaIS0_EES0_S0_iENK3$_0clEi"(ptr noundef nonnull align 8 dereferenceable(24) %11, i32 noundef %.0.lcssa.1)
  %.not32.1 = icmp eq i32 %61, 0
  %62 = zext i1 %.not32.1 to i32
  %63 = add nsw i32 %.027.lcssa.1, %62
  %64 = srem i32 %63, %46
  %65 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt5arrayIiLm2EEixEm(ptr noundef nonnull align 4 dereferenceable(8) %12, i64 noundef 1) #5
  store i32 %64, ptr %65, align 4, !tbaa !5
  call void @_ZSt4swapIiENSt9enable_ifIXsr6__and_ISt6__not_ISt15__is_tuple_likeIT_EESt21is_move_constructibleIS3_ESt18is_move_assignableIS3_EEE5valueEvE4typeERS3_SC_(ptr noundef nonnull align 4 dereferenceable(4) %5, ptr noundef nonnull align 4 dereferenceable(4) %8) #5
  %66 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt5arrayIiLm2EEixEm(ptr noundef nonnull align 4 dereferenceable(8) %12, i64 noundef 0) #5
  %67 = load i32, ptr %66, align 4, !tbaa !5
  %68 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt5arrayIiLm2EEixEm(ptr noundef nonnull align 4 dereferenceable(8) %12, i64 noundef 1) #5
  %69 = load i32, ptr %68, align 4, !tbaa !5
  %70 = icmp eq i32 %67, %69
  %71 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt5arrayIiLm2EEixEm(ptr noundef nonnull align 4 dereferenceable(8) %12, i64 noundef 0) #5
  %72 = load i32, ptr %71, align 4, !tbaa !5
  br i1 %70, label %103, label %73

73:                                               ; preds = %._crit_edge.1
  %74 = call noundef i32 @"_ZZ24convex_line_intersectionRSt6vectorI2PTSaIS0_EES0_S0_iENK3$_0clEi"(ptr noundef nonnull align 8 dereferenceable(24) %11, i32 noundef %72)
  %.not = icmp eq i32 %74, 0
  br i1 %.not, label %75, label %102

75:                                               ; preds = %73
  %76 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt5arrayIiLm2EEixEm(ptr noundef nonnull align 4 dereferenceable(8) %12, i64 noundef 1) #5
  %77 = load i32, ptr %76, align 4, !tbaa !5
  %78 = call noundef i32 @"_ZZ24convex_line_intersectionRSt6vectorI2PTSaIS0_EES0_S0_iENK3$_0clEi"(ptr noundef nonnull align 8 dereferenceable(24) %11, i32 noundef %77)
  %.not30 = icmp eq i32 %78, 0
  br i1 %.not30, label %79, label %102

79:                                               ; preds = %75
  %80 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt5arrayIiLm2EEixEm(ptr noundef nonnull align 4 dereferenceable(8) %12, i64 noundef 0) #5
  %81 = load i32, ptr %80, align 4, !tbaa !5
  %82 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt5arrayIiLm2EEixEm(ptr noundef nonnull align 4 dereferenceable(8) %12, i64 noundef 1) #5
  %83 = load i32, ptr %82, align 4, !tbaa !5
  %84 = call noundef i64 @_ZNKSt6vectorI2PTSaIS0_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %0) #5
  %85 = trunc i64 %84 to i32
  %86 = add i32 %81, 1
  %87 = sub i32 %86, %83
  %88 = add i32 %87, %85
  %89 = sext i32 %88 to i64
  %90 = call noundef i64 @_ZNKSt6vectorI2PTSaIS0_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %0) #5
  %91 = urem i64 %89, %90
  switch i64 %91, label %102 [
    i64 0, label %92
    i64 2, label %97
  ]

92:                                               ; preds = %79
  %93 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt5arrayIiLm2EEixEm(ptr noundef nonnull align 4 dereferenceable(8) %12, i64 noundef 0) #5
  %94 = load i32, ptr %93, align 4, !tbaa !5
  %95 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt5arrayIiLm2EEixEm(ptr noundef nonnull align 4 dereferenceable(8) %12, i64 noundef 0) #5
  %96 = load i32, ptr %95, align 4, !tbaa !5
  br label %103

97:                                               ; preds = %79
  %98 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt5arrayIiLm2EEixEm(ptr noundef nonnull align 4 dereferenceable(8) %12, i64 noundef 1) #5
  %99 = load i32, ptr %98, align 4, !tbaa !5
  %100 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt5arrayIiLm2EEixEm(ptr noundef nonnull align 4 dereferenceable(8) %12, i64 noundef 1) #5
  %101 = load i32, ptr %100, align 4, !tbaa !5
  br label %103

102:                                              ; preds = %79, %75, %73
  %.sroa.0.0.copyload = load i32, ptr %12, align 4
  %.sroa.6.0..sroa_idx = getelementptr inbounds i8, ptr %12, i64 4
  %.sroa.6.0.copyload = load i32, ptr %.sroa.6.0..sroa_idx, align 4, !tbaa !13
  br label %103

103:                                              ; preds = %._crit_edge.1, %102, %97, %92
  %.sroa.0.0 = phi i32 [ %.sroa.0.0.copyload, %102 ], [ %99, %97 ], [ %94, %92 ], [ %72, %._crit_edge.1 ]
  %.sroa.6.0 = phi i32 [ %.sroa.6.0.copyload, %102 ], [ %101, %97 ], [ %96, %92 ], [ -1, %._crit_edge.1 ]
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %12) #5
  %104 = zext i32 %.sroa.6.0 to i64
  %105 = shl nuw i64 %104, 32
  %106 = zext i32 %.sroa.0.0 to i64
  %107 = or disjoint i64 %105, %106
  br label %108

108:                                              ; preds = %4, %19, %103
  %.sroa.0.0.insert.insert = phi i64 [ %107, %103 ], [ -1, %19 ], [ -1, %4 ]
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %11) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %8) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %5) #5
  ret i64 %.sroa.0.0.insert.insert
}

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN2PT4perpEv(ptr dead_on_unwind noalias writable sret(%struct.PT) align 8, ptr noundef nonnull align 8 dereferenceable(16)) local_unnamed_addr #1 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare hidden noundef i32 @"_ZZ24convex_line_intersectionRSt6vectorI2PTSaIS0_EES0_S0_iENK3$_0clEi"(ptr noundef nonnull align 8 dereferenceable(24), i32 noundef) local_unnamed_addr #3 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt5arrayIiLm2EEixEm(ptr noundef nonnull align 4 dereferenceable(8), i64 noundef) local_unnamed_addr #2 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZSt4swapIiENSt9enable_ifIXsr6__and_ISt6__not_ISt15__is_tuple_likeIT_EESt21is_move_constructibleIS3_ESt18is_move_assignableIS3_EEE5valueEvE4typeERS3_SC_(ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4)) local_unnamed_addr #4

attributes #0 = { mustprogress nocallback nofree nosync 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 = { inlinehint 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 #4 = { 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 #5 = { 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 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"any pointer", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = !{!7, !7, i64 0}


; Effective O3 passes: EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,PostOrderFunctionAttrsPass,ReassociatePass,SROAPass,SimplifyCFGPass