; LLVM IR from Slingshot-Physics/slingshot-community :: common/geometry/src (polygon)

; 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.geometry::types::polygon50_t" = type { i32, [50 x %class.Vector3] }
%class.Vector3 = type { [3 x float] }
%"struct.geometry::types::segment_t" = type { [2 x %class.Vector3] }

; Function Attrs: mustprogress uwtable
declare dso_local noundef zeroext i1 @_ZN8geometry7polygon9halfPlaneERK7Vector3S3_S3_b(ptr noundef nonnull align 4 dereferenceable(12), ptr noundef nonnull align 4 dereferenceable(12), ptr noundef nonnull align 4 dereferenceable(12), i1 noundef zeroext) #0

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

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

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZN8geometry5types11polygon50_tC2ERKS1_(ptr noundef nonnull align 4 dereferenceable(604), ptr noundef nonnull align 4 dereferenceable(604)) unnamed_addr #2 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN8geometry7polygon13orderVertsCcwERNS_5types11polygon50_tE(ptr noundef nonnull align 4 dereferenceable(604)) #0

; Function Attrs: mustprogress uwtable
declare dso_local noundef nonnull align 4 dereferenceable(12) ptr @_ZN7Vector3aSERKS_(ptr noundef nonnull align 4 dereferenceable(12), ptr noundef nonnull align 4 dereferenceable(12)) #0 align 2

; Function Attrs: mustprogress uwtable
define dso_local noundef zeroext i1 @_ZN8geometry7polygon11clipSegmentERKNS_5types11polygon50_tERKNS1_9segment_tERS5_(ptr noundef nonnull align 4 dereferenceable(604) %0, ptr noundef nonnull align 4 dereferenceable(24) %1, ptr noundef nonnull align 4 dereferenceable(24) %2) #0 {
  %4 = alloca i1, align 1
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca %"struct.geometry::types::polygon50_t", align 4
  %9 = alloca i8, align 1
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  %12 = alloca %class.Vector3, align 4
  %13 = alloca %class.Vector3, align 4
  %14 = alloca i32, align 4
  %15 = alloca [2 x i8], align 1
  store ptr %0, ptr %5, align 8, !tbaa !5
  store ptr %1, ptr %6, align 8, !tbaa !5
  store ptr %2, ptr %7, align 8, !tbaa !5
  %16 = load ptr, ptr %5, align 8, !tbaa !5
  %17 = getelementptr inbounds %"struct.geometry::types::polygon50_t", ptr %16, i32 0, i32 0
  %18 = load i32, ptr %17, align 4, !tbaa !9
  %19 = icmp ult i32 %18, 3
  br i1 %19, label %20, label %21

20:                                               ; preds = %3
  store i1 false, ptr %4, align 1
  br label %150

21:                                               ; preds = %3
  %22 = load ptr, ptr %5, align 8, !tbaa !5
  %23 = load ptr, ptr %6, align 8, !tbaa !5
  %24 = getelementptr inbounds %"struct.geometry::types::segment_t", ptr %23, i32 0, i32 0
  %25 = getelementptr inbounds [2 x %class.Vector3], ptr %24, i64 0, i64 0
  %26 = call noundef zeroext i1 @_ZN8geometry7polygon11pointInsideERKNS_5types11polygon50_tERK7Vector3(ptr noundef nonnull align 4 dereferenceable(604) %22, ptr noundef nonnull align 4 dereferenceable(12) %25)
  br i1 %26, label %27, label %37

27:                                               ; preds = %21
  %28 = load ptr, ptr %5, align 8, !tbaa !5
  %29 = load ptr, ptr %6, align 8, !tbaa !5
  %30 = getelementptr inbounds %"struct.geometry::types::segment_t", ptr %29, i32 0, i32 0
  %31 = getelementptr inbounds [2 x %class.Vector3], ptr %30, i64 0, i64 1
  %32 = call noundef zeroext i1 @_ZN8geometry7polygon11pointInsideERKNS_5types11polygon50_tERK7Vector3(ptr noundef nonnull align 4 dereferenceable(604) %28, ptr noundef nonnull align 4 dereferenceable(12) %31)
  br i1 %32, label %33, label %37

33:                                               ; preds = %27
  %34 = load ptr, ptr %6, align 8, !tbaa !5
  %35 = load ptr, ptr %7, align 8, !tbaa !5
  %36 = call noundef nonnull align 4 dereferenceable(24) ptr @_ZN8geometry5types9segment_taSERKS1_(ptr noundef nonnull align 4 dereferenceable(24) %35, ptr noundef nonnull align 4 dereferenceable(24) %34)
  store i1 true, ptr %4, align 1
  br label %150

37:                                               ; preds = %27, %21
  call void @llvm.lifetime.start.p0(i64 604, ptr %8) #5
  %38 = load ptr, ptr %5, align 8, !tbaa !5
  call void @_ZN8geometry5types11polygon50_tC2ERKS1_(ptr noundef nonnull align 4 dereferenceable(604) %8, ptr noundef nonnull align 4 dereferenceable(604) %38)
  call void @_ZN8geometry7polygon13orderVertsCcwERNS_5types11polygon50_tE(ptr noundef nonnull align 4 dereferenceable(604) %8)
  %39 = load ptr, ptr %6, align 8, !tbaa !5
  %40 = load ptr, ptr %7, align 8, !tbaa !5
  %41 = call noundef nonnull align 4 dereferenceable(24) ptr @_ZN8geometry5types9segment_taSERKS1_(ptr noundef nonnull align 4 dereferenceable(24) %40, ptr noundef nonnull align 4 dereferenceable(24) %39)
  call void @llvm.lifetime.start.p0(i64 1, ptr %9) #5
  store i8 0, ptr %9, align 1, !tbaa !12
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #5
  store i32 0, ptr %10, align 4, !tbaa !14
  br label %42

42:                                               ; preds = %144, %37
  %43 = load i32, ptr %10, align 4, !tbaa !14
  %44 = getelementptr inbounds %"struct.geometry::types::polygon50_t", ptr %8, i32 0, i32 0
  %45 = load i32, ptr %44, align 4, !tbaa !9
  %46 = icmp ult i32 %43, %45
  br i1 %46, label %48, label %47

47:                                               ; preds = %42
  store i32 2, ptr %11, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #5
  br label %147

48:                                               ; preds = %42
  call void @llvm.lifetime.start.p0(i64 12, ptr %12) #5
  call void @_ZN7Vector3C2Ev(ptr noundef nonnull align 4 dereferenceable(12) %12)
  call void @llvm.lifetime.start.p0(i64 12, ptr %13) #5
  call void @_ZN7Vector3C2Ev(ptr noundef nonnull align 4 dereferenceable(12) %13)
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #5
  %49 = getelementptr inbounds %"struct.geometry::types::polygon50_t", ptr %8, i32 0, i32 1
  %50 = load i32, ptr %10, align 4, !tbaa !14
  %51 = zext i32 %50 to i64
  %52 = getelementptr inbounds [50 x %class.Vector3], ptr %49, i64 0, i64 %51
  %53 = getelementptr inbounds %"struct.geometry::types::polygon50_t", ptr %8, i32 0, i32 1
  %54 = load i32, ptr %10, align 4, !tbaa !14
  %55 = add i32 %54, 1
  %56 = getelementptr inbounds %"struct.geometry::types::polygon50_t", ptr %8, i32 0, i32 0
  %57 = load i32, ptr %56, align 4, !tbaa !9
  %58 = urem i32 %55, %57
  %59 = zext i32 %58 to i64
  %60 = getelementptr inbounds [50 x %class.Vector3], ptr %53, i64 0, i64 %59
  %61 = load ptr, ptr %7, align 8, !tbaa !5
  %62 = getelementptr inbounds %"struct.geometry::types::segment_t", ptr %61, i32 0, i32 0
  %63 = getelementptr inbounds [2 x %class.Vector3], ptr %62, i64 0, i64 0
  %64 = load ptr, ptr %7, align 8, !tbaa !5
  %65 = getelementptr inbounds %"struct.geometry::types::segment_t", ptr %64, i32 0, i32 0
  %66 = getelementptr inbounds [2 x %class.Vector3], ptr %65, i64 0, i64 1
  %67 = call noundef i32 @_ZN8geometry7segment12intersectionERK7Vector3S3_S3_S3_RS1_S4_f(ptr noundef nonnull align 4 dereferenceable(12) %52, ptr noundef nonnull align 4 dereferenceable(12) %60, ptr noundef nonnull align 4 dereferenceable(12) %63, ptr noundef nonnull align 4 dereferenceable(12) %66, ptr noundef nonnull align 4 dereferenceable(12) %12, ptr noundef nonnull align 4 dereferenceable(12) %13, float noundef 0x3EB0C6F7A0000000)
  store i32 %67, ptr %14, align 4, !tbaa !14
  %68 = load i32, ptr %14, align 4, !tbaa !14
  %69 = icmp sgt i32 %68, 0
  %70 = zext i1 %69 to i32
  %71 = load i8, ptr %9, align 1, !tbaa !12, !range !15, !noundef !16
  %72 = trunc i8 %71 to i1
  %73 = zext i1 %72 to i32
  %74 = or i32 %73, %70
  %75 = icmp ne i32 %74, 0
  %76 = zext i1 %75 to i8
  store i8 %76, ptr %9, align 1, !tbaa !12
  %77 = load i32, ptr %14, align 4, !tbaa !14
  switch i32 %77, label %142 [
    i32 0, label %143
    i32 1, label %78
    i32 2, label %133
  ]

78:                                               ; preds = %48
  call void @llvm.lifetime.start.p0(i64 2, ptr %15) #5
  %79 = getelementptr inbounds %"struct.geometry::types::polygon50_t", ptr %8, i32 0, i32 1
  %80 = load i32, ptr %10, align 4, !tbaa !14
  %81 = zext i32 %80 to i64
  %82 = getelementptr inbounds [50 x %class.Vector3], ptr %79, i64 0, i64 %81
  %83 = getelementptr inbounds %"struct.geometry::types::polygon50_t", ptr %8, i32 0, i32 1
  %84 = load i32, ptr %10, align 4, !tbaa !14
  %85 = add i32 %84, 1
  %86 = getelementptr inbounds %"struct.geometry::types::polygon50_t", ptr %8, i32 0, i32 0
  %87 = load i32, ptr %86, align 4, !tbaa !9
  %88 = urem i32 %85, %87
  %89 = zext i32 %88 to i64
  %90 = getelementptr inbounds [50 x %class.Vector3], ptr %83, i64 0, i64 %89
  %91 = load ptr, ptr %7, align 8, !tbaa !5
  %92 = getelementptr inbounds %"struct.geometry::types::segment_t", ptr %91, i32 0, i32 0
  %93 = getelementptr inbounds [2 x %class.Vector3], ptr %92, i64 0, i64 0
  %94 = call noundef zeroext i1 @_ZN8geometry7polygon9halfPlaneERK7Vector3S3_S3_b(ptr noundef nonnull align 4 dereferenceable(12) %82, ptr noundef nonnull align 4 dereferenceable(12) %90, ptr noundef nonnull align 4 dereferenceable(12) %93, i1 noundef zeroext true)
  %95 = zext i1 %94 to i8
  store i8 %95, ptr %15, align 1, !tbaa !12
  %96 = getelementptr inbounds i8, ptr %15, i64 1
  %97 = getelementptr inbounds %"struct.geometry::types::polygon50_t", ptr %8, i32 0, i32 1
  %98 = load i32, ptr %10, align 4, !tbaa !14
  %99 = zext i32 %98 to i64
  %100 = getelementptr inbounds [50 x %class.Vector3], ptr %97, i64 0, i64 %99
  %101 = getelementptr inbounds %"struct.geometry::types::polygon50_t", ptr %8, i32 0, i32 1
  %102 = load i32, ptr %10, align 4, !tbaa !14
  %103 = add i32 %102, 1
  %104 = getelementptr inbounds %"struct.geometry::types::polygon50_t", ptr %8, i32 0, i32 0
  %105 = load i32, ptr %104, align 4, !tbaa !9
  %106 = urem i32 %103, %105
  %107 = zext i32 %106 to i64
  %108 = getelementptr inbounds [50 x %class.Vector3], ptr %101, i64 0, i64 %107
  %109 = load ptr, ptr %7, align 8, !tbaa !5
  %110 = getelementptr inbounds %"struct.geometry::types::segment_t", ptr %109, i32 0, i32 0
  %111 = getelementptr inbounds [2 x %class.Vector3], ptr %110, i64 0, i64 1
  %112 = call noundef zeroext i1 @_ZN8geometry7polygon9halfPlaneERK7Vector3S3_S3_b(ptr noundef nonnull align 4 dereferenceable(12) %100, ptr noundef nonnull align 4 dereferenceable(12) %108, ptr noundef nonnull align 4 dereferenceable(12) %111, i1 noundef zeroext true)
  %113 = zext i1 %112 to i8
  store i8 %113, ptr %96, align 1, !tbaa !12
  %114 = getelementptr inbounds [2 x i8], ptr %15, i64 0, i64 0
  %115 = load i8, ptr %114, align 1, !tbaa !12, !range !15, !noundef !16
  %116 = trunc i8 %115 to i1
  br i1 %116, label %122, label %117

117:                                              ; preds = %78
  %118 = load ptr, ptr %7, align 8, !tbaa !5
  %119 = getelementptr inbounds %"struct.geometry::types::segment_t", ptr %118, i32 0, i32 0
  %120 = getelementptr inbounds [2 x %class.Vector3], ptr %119, i64 0, i64 0
  %121 = call noundef nonnull align 4 dereferenceable(12) ptr @_ZN7Vector3aSERKS_(ptr noundef nonnull align 4 dereferenceable(12) %120, ptr noundef nonnull align 4 dereferenceable(12) %12)
  br label %132

122:                                              ; preds = %78
  %123 = getelementptr inbounds [2 x i8], ptr %15, i64 0, i64 1
  %124 = load i8, ptr %123, align 1, !tbaa !12, !range !15, !noundef !16
  %125 = trunc i8 %124 to i1
  br i1 %125, label %131, label %126

126:                                              ; preds = %122
  %127 = load ptr, ptr %7, align 8, !tbaa !5
  %128 = getelementptr inbounds %"struct.geometry::types::segment_t", ptr %127, i32 0, i32 0
  %129 = getelementptr inbounds [2 x %class.Vector3], ptr %128, i64 0, i64 1
  %130 = call noundef nonnull align 4 dereferenceable(12) ptr @_ZN7Vector3aSERKS_(ptr noundef nonnull align 4 dereferenceable(12) %129, ptr noundef nonnull align 4 dereferenceable(12) %12)
  br label %131

131:                                              ; preds = %126, %122
  br label %132

132:                                              ; preds = %131, %117
  store i32 5, ptr %11, align 4
  call void @llvm.lifetime.end.p0(i64 2, ptr %15) #5
  br label %143

133:                                              ; preds = %48
  %134 = load ptr, ptr %7, align 8, !tbaa !5
  %135 = getelementptr inbounds %"struct.geometry::types::segment_t", ptr %134, i32 0, i32 0
  %136 = getelementptr inbounds [2 x %class.Vector3], ptr %135, i64 0, i64 0
  %137 = call noundef nonnull align 4 dereferenceable(12) ptr @_ZN7Vector3aSERKS_(ptr noundef nonnull align 4 dereferenceable(12) %136, ptr noundef nonnull align 4 dereferenceable(12) %12)
  %138 = load ptr, ptr %7, align 8, !tbaa !5
  %139 = getelementptr inbounds %"struct.geometry::types::segment_t", ptr %138, i32 0, i32 0
  %140 = getelementptr inbounds [2 x %class.Vector3], ptr %139, i64 0, i64 1
  %141 = call noundef nonnull align 4 dereferenceable(12) ptr @_ZN7Vector3aSERKS_(ptr noundef nonnull align 4 dereferenceable(12) %140, ptr noundef nonnull align 4 dereferenceable(12) %13)
  br label %143

142:                                              ; preds = %48
  br label %143

143:                                              ; preds = %142, %133, %132, %48
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #5
  call void @llvm.lifetime.end.p0(i64 12, ptr %13) #5
  call void @llvm.lifetime.end.p0(i64 12, ptr %12) #5
  br label %144

144:                                              ; preds = %143
  %145 = load i32, ptr %10, align 4, !tbaa !14
  %146 = add i32 %145, 1
  store i32 %146, ptr %10, align 4, !tbaa !14
  br label %42, !llvm.loop !17

147:                                              ; preds = %47
  %148 = load i8, ptr %9, align 1, !tbaa !12, !range !15, !noundef !16
  %149 = trunc i8 %148 to i1
  store i1 %149, ptr %4, align 1
  store i32 1, ptr %11, align 4
  call void @llvm.lifetime.end.p0(i64 1, ptr %9) #5
  call void @llvm.lifetime.end.p0(i64 604, ptr %8) #5
  br label %150

150:                                              ; preds = %147, %33, %20
  %151 = load i1, ptr %4, align 1
  ret i1 %151
}

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN7Vector3C2Ev(ptr noundef nonnull align 4 dereferenceable(12)) unnamed_addr #3 align 2

declare noundef i32 @_ZN8geometry7segment12intersectionERK7Vector3S3_S3_S3_RS1_S4_f(ptr noundef nonnull align 4 dereferenceable(12), ptr noundef nonnull align 4 dereferenceable(12), ptr noundef nonnull align 4 dereferenceable(12), ptr noundef nonnull align 4 dereferenceable(12), ptr noundef nonnull align 4 dereferenceable(12), ptr noundef nonnull align 4 dereferenceable(12), float noundef) #4

; Function Attrs: mustprogress uwtable
declare dso_local noundef zeroext i1 @_ZN8geometry7polygon11pointInsideERKNS_5types11polygon50_tERK7Vector3(ptr noundef nonnull align 4 dereferenceable(604), ptr noundef nonnull align 4 dereferenceable(12)) #0

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef nonnull align 4 dereferenceable(24) ptr @_ZN8geometry5types9segment_taSERKS1_(ptr noundef nonnull align 4 dereferenceable(24), ptr noundef nonnull align 4 dereferenceable(24)) #2 align 2

attributes #0 = { 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 #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { 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 #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 = { "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 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !11, i64 0}
!10 = !{!"_ZTSN8geometry5types11polygon50_tE", !11, i64 0, !7, i64 4}
!11 = !{!"int", !7, i64 0}
!12 = !{!13, !13, i64 0}
!13 = !{!"bool", !7, i64 0}
!14 = !{!11, !11, i64 0}
!15 = !{i8 0, i8 2}
!16 = !{}
!17 = distinct !{!17, !18}
!18 = !{!"llvm.loop.mustprogress"}


; 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.geometry::types::polygon50_t" = type { i32, [50 x %class.Vector3] }
%class.Vector3 = type { [3 x float] }

; Function Attrs: mustprogress uwtable
declare dso_local noundef zeroext i1 @_ZN8geometry7polygon9halfPlaneERK7Vector3S3_S3_b(ptr noundef nonnull align 4 dereferenceable(12), ptr noundef nonnull align 4 dereferenceable(12), ptr noundef nonnull align 4 dereferenceable(12), i1 noundef zeroext) local_unnamed_addr #0

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

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

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZN8geometry5types11polygon50_tC2ERKS1_(ptr noundef nonnull align 4 dereferenceable(604), ptr noundef nonnull align 4 dereferenceable(604)) unnamed_addr #2 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN8geometry7polygon13orderVertsCcwERNS_5types11polygon50_tE(ptr noundef nonnull align 4 dereferenceable(604)) local_unnamed_addr #0

; Function Attrs: mustprogress uwtable
declare dso_local noundef nonnull align 4 dereferenceable(12) ptr @_ZN7Vector3aSERKS_(ptr noundef nonnull align 4 dereferenceable(12), ptr noundef nonnull align 4 dereferenceable(12)) local_unnamed_addr #0 align 2

; Function Attrs: mustprogress uwtable
define dso_local noundef zeroext i1 @_ZN8geometry7polygon11clipSegmentERKNS_5types11polygon50_tERKNS1_9segment_tERS5_(ptr noundef nonnull align 4 dereferenceable(604) %0, ptr noundef nonnull align 4 dereferenceable(24) %1, ptr noundef nonnull align 4 dereferenceable(24) %2) local_unnamed_addr #0 {
  %4 = alloca %"struct.geometry::types::polygon50_t", align 4
  %5 = alloca %class.Vector3, align 4
  %6 = alloca %class.Vector3, align 4
  %7 = load i32, ptr %0, align 4, !tbaa !5
  %8 = icmp ult i32 %7, 3
  br i1 %8, label %54, label %9

9:                                                ; preds = %3
  %10 = tail call noundef zeroext i1 @_ZN8geometry7polygon11pointInsideERKNS_5types11polygon50_tERK7Vector3(ptr noundef nonnull align 4 dereferenceable(604) %0, ptr noundef nonnull align 4 dereferenceable(12) %1)
  br i1 %10, label %11, label %16

11:                                               ; preds = %9
  %12 = getelementptr inbounds i8, ptr %1, i64 12
  %13 = tail call noundef zeroext i1 @_ZN8geometry7polygon11pointInsideERKNS_5types11polygon50_tERK7Vector3(ptr noundef nonnull align 4 dereferenceable(604) %0, ptr noundef nonnull align 4 dereferenceable(12) %12)
  br i1 %13, label %14, label %16

14:                                               ; preds = %11
  %15 = tail call noundef nonnull align 4 dereferenceable(24) ptr @_ZN8geometry5types9segment_taSERKS1_(ptr noundef nonnull align 4 dereferenceable(24) %2, ptr noundef nonnull align 4 dereferenceable(24) %1)
  br label %54

16:                                               ; preds = %11, %9
  call void @llvm.lifetime.start.p0(i64 604, ptr nonnull %4) #5
  call void @_ZN8geometry5types11polygon50_tC2ERKS1_(ptr noundef nonnull align 4 dereferenceable(604) %4, ptr noundef nonnull align 4 dereferenceable(604) %0)
  call void @_ZN8geometry7polygon13orderVertsCcwERNS_5types11polygon50_tE(ptr noundef nonnull align 4 dereferenceable(604) %4)
  %17 = call noundef nonnull align 4 dereferenceable(24) ptr @_ZN8geometry5types9segment_taSERKS1_(ptr noundef nonnull align 4 dereferenceable(24) %2, ptr noundef nonnull align 4 dereferenceable(24) %1)
  %18 = load i32, ptr %4, align 4, !tbaa !5
  %.not = icmp eq i32 %18, 0
  br i1 %.not, label %._crit_edge, label %.lr.ph

.lr.ph:                                           ; preds = %16
  %19 = getelementptr inbounds i8, ptr %4, i64 4
  %20 = getelementptr inbounds i8, ptr %2, i64 12
  br label %21

._crit_edge:                                      ; preds = %50, %16
  %.030.lcssa = phi i1 [ false, %16 ], [ %30, %50 ]
  call void @llvm.lifetime.end.p0(i64 604, ptr nonnull %4) #5
  br label %54

21:                                               ; preds = %.lr.ph, %50
  %indvars.iv = phi i64 [ 0, %.lr.ph ], [ %indvars.iv.next, %50 ]
  %.03033 = phi i1 [ false, %.lr.ph ], [ %30, %50 ]
  call void @llvm.lifetime.start.p0(i64 12, ptr nonnull %5) #5
  call void @_ZN7Vector3C2Ev(ptr noundef nonnull align 4 dereferenceable(12) %5)
  call void @llvm.lifetime.start.p0(i64 12, ptr nonnull %6) #5
  call void @_ZN7Vector3C2Ev(ptr noundef nonnull align 4 dereferenceable(12) %6)
  %22 = getelementptr inbounds [50 x %class.Vector3], ptr %19, i64 0, i64 %indvars.iv
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %23 = load i32, ptr %4, align 4, !tbaa !5
  %24 = trunc nuw i64 %indvars.iv.next to i32
  %25 = urem i32 %24, %23
  %26 = zext i32 %25 to i64
  %27 = getelementptr inbounds [50 x %class.Vector3], ptr %19, i64 0, i64 %26
  %28 = call noundef i32 @_ZN8geometry7segment12intersectionERK7Vector3S3_S3_S3_RS1_S4_f(ptr noundef nonnull align 4 dereferenceable(12) %22, ptr noundef nonnull align 4 dereferenceable(12) %27, ptr noundef nonnull align 4 dereferenceable(12) %2, ptr noundef nonnull align 4 dereferenceable(12) %20, ptr noundef nonnull align 4 dereferenceable(12) %5, ptr noundef nonnull align 4 dereferenceable(12) %6, float noundef 0x3EB0C6F7A0000000)
  %29 = icmp sgt i32 %28, 0
  %30 = or i1 %.03033, %29
  switch i32 %28, label %50 [
    i32 2, label %47
    i32 1, label %31
  ]

31:                                               ; preds = %21
  %32 = load i32, ptr %4, align 4, !tbaa !5
  %33 = urem i32 %24, %32
  %34 = zext i32 %33 to i64
  %35 = getelementptr inbounds [50 x %class.Vector3], ptr %19, i64 0, i64 %34
  %36 = call noundef zeroext i1 @_ZN8geometry7polygon9halfPlaneERK7Vector3S3_S3_b(ptr noundef nonnull align 4 dereferenceable(12) %22, ptr noundef nonnull align 4 dereferenceable(12) %35, ptr noundef nonnull align 4 dereferenceable(12) %2, i1 noundef zeroext true)
  %37 = load i32, ptr %4, align 4, !tbaa !5
  %38 = urem i32 %24, %37
  %39 = zext i32 %38 to i64
  %40 = getelementptr inbounds [50 x %class.Vector3], ptr %19, i64 0, i64 %39
  %41 = call noundef zeroext i1 @_ZN8geometry7polygon9halfPlaneERK7Vector3S3_S3_b(ptr noundef nonnull align 4 dereferenceable(12) %22, ptr noundef nonnull align 4 dereferenceable(12) %40, ptr noundef nonnull align 4 dereferenceable(12) %20, i1 noundef zeroext true)
  br i1 %36, label %44, label %42

42:                                               ; preds = %31
  %43 = call noundef nonnull align 4 dereferenceable(12) ptr @_ZN7Vector3aSERKS_(ptr noundef nonnull align 4 dereferenceable(12) %2, ptr noundef nonnull align 4 dereferenceable(12) %5)
  br label %50

44:                                               ; preds = %31
  br i1 %41, label %50, label %45

45:                                               ; preds = %44
  %46 = call noundef nonnull align 4 dereferenceable(12) ptr @_ZN7Vector3aSERKS_(ptr noundef nonnull align 4 dereferenceable(12) %20, ptr noundef nonnull align 4 dereferenceable(12) %5)
  br label %50

47:                                               ; preds = %21
  %48 = call noundef nonnull align 4 dereferenceable(12) ptr @_ZN7Vector3aSERKS_(ptr noundef nonnull align 4 dereferenceable(12) %2, ptr noundef nonnull align 4 dereferenceable(12) %5)
  %49 = call noundef nonnull align 4 dereferenceable(12) ptr @_ZN7Vector3aSERKS_(ptr noundef nonnull align 4 dereferenceable(12) %20, ptr noundef nonnull align 4 dereferenceable(12) %6)
  br label %50

50:                                               ; preds = %42, %45, %44, %21, %47
  call void @llvm.lifetime.end.p0(i64 12, ptr nonnull %6) #5
  call void @llvm.lifetime.end.p0(i64 12, ptr nonnull %5) #5
  %51 = load i32, ptr %4, align 4, !tbaa !5
  %52 = zext i32 %51 to i64
  %53 = icmp ult i64 %indvars.iv.next, %52
  br i1 %53, label %21, label %._crit_edge, !llvm.loop !10

54:                                               ; preds = %3, %._crit_edge, %14
  %.0 = phi i1 [ true, %14 ], [ %.030.lcssa, %._crit_edge ], [ false, %3 ]
  ret i1 %.0
}

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN7Vector3C2Ev(ptr noundef nonnull align 4 dereferenceable(12)) unnamed_addr #3 align 2

declare noundef i32 @_ZN8geometry7segment12intersectionERK7Vector3S3_S3_S3_RS1_S4_f(ptr noundef nonnull align 4 dereferenceable(12), ptr noundef nonnull align 4 dereferenceable(12), ptr noundef nonnull align 4 dereferenceable(12), ptr noundef nonnull align 4 dereferenceable(12), ptr noundef nonnull align 4 dereferenceable(12), ptr noundef nonnull align 4 dereferenceable(12), float noundef) local_unnamed_addr #4

; Function Attrs: mustprogress uwtable
declare dso_local noundef zeroext i1 @_ZN8geometry7polygon11pointInsideERKNS_5types11polygon50_tERK7Vector3(ptr noundef nonnull align 4 dereferenceable(604), ptr noundef nonnull align 4 dereferenceable(12)) local_unnamed_addr #0

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef nonnull align 4 dereferenceable(24) ptr @_ZN8geometry5types9segment_taSERKS1_(ptr noundef nonnull align 4 dereferenceable(24), ptr noundef nonnull align 4 dereferenceable(24)) local_unnamed_addr #2 align 2

attributes #0 = { 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 #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { 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 #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 = { "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, !7, i64 0}
!6 = !{!"_ZTSN8geometry5types11polygon50_tE", !7, i64 0, !8, i64 4}
!7 = !{!"int", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = distinct !{!10, !11}
!11 = !{!"llvm.loop.mustprogress"}


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