; LLVM IR from ThePhysicsGuys/Physics3D :: Physics3D/geometry/shapeLibrary.ll (ZN3P3D12ShapeLibrary12createSphereEfi)

; 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.P3D::Polyhedron" = type { %"class.P3D::TriangleMesh" }
%"class.P3D::TriangleMesh" = type { %"class.P3D::MeshPrototype" }
%"class.P3D::MeshPrototype" = type { %"class.P3D::UniqueAlignedPointer", %"class.P3D::UniqueAlignedPointer.2", i32, i32 }
%"class.P3D::UniqueAlignedPointer" = type { ptr }
%"class.P3D::UniqueAlignedPointer.2" = type { ptr }
%"struct.std::pair" = type { ptr, ptr }
%"struct.P3D::Vector" = type { %union.anon }
%union.anon = type { [3 x float] }

@_ZN3P3D12ShapeLibrary11icosahedronE = external dso_local global %"class.P3D::Polyhedron", align 8

declare void @_ZN3P3D10PolyhedronC1EPKNS_6VectorIfLm3EEEPKNS_8TriangleEii(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef, ptr noundef, i32 noundef, i32 noundef) unnamed_addr #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

declare i32 @__gxx_personality_v0(...)

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZN3P3D13MeshPrototypeD2Ev(ptr noundef nonnull align 8 dereferenceable(24)) unnamed_addr #2 align 2

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN3P3D12ShapeLibrary12createSphereEfi(ptr dead_on_unwind noalias writable sret(%"class.P3D::Polyhedron") align 8 %0, float noundef %1, i32 noundef %2) #3 personality ptr @__gxx_personality_v0 {
  %4 = alloca ptr, align 8
  %5 = alloca float, align 4
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca %"class.P3D::Polyhedron", align 8
  %11 = alloca ptr, align 8
  %12 = alloca ptr, align 8
  %13 = alloca i32, align 4
  %14 = alloca ptr, align 8
  %15 = alloca i32, align 4
  %16 = alloca %"struct.std::pair", align 8
  %17 = alloca i32, align 4
  %18 = alloca %"struct.P3D::Vector", align 4
  %19 = alloca %"struct.P3D::Vector", align 4
  %20 = alloca { <2 x float>, float }, align 8
  %21 = alloca { <2 x float>, float }, align 8
  %22 = alloca i1, align 1
  store ptr %0, ptr %4, align 8
  store float %1, ptr %5, align 4, !tbaa !5
  store i32 %2, ptr %6, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #11
  store i32 12, ptr %7, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #11
  store i32 20, ptr %8, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #11
  store i32 0, ptr %9, align 4, !tbaa !9
  br label %23

23:                                               ; preds = %36, %3
  %24 = load i32, ptr %9, align 4, !tbaa !9
  %25 = load i32, ptr %6, align 4, !tbaa !9
  %26 = icmp slt i32 %24, %25
  br i1 %26, label %28, label %27

27:                                               ; preds = %23
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #11
  br label %39

28:                                               ; preds = %23
  %29 = load i32, ptr %7, align 4, !tbaa !9
  %30 = load i32, ptr %8, align 4, !tbaa !9
  %31 = mul nsw i32 %30, 3
  %32 = sdiv i32 %31, 2
  %33 = add nsw i32 %29, %32
  store i32 %33, ptr %7, align 4, !tbaa !9
  %34 = load i32, ptr %8, align 4, !tbaa !9
  %35 = mul nsw i32 %34, 4
  store i32 %35, ptr %8, align 4, !tbaa !9
  br label %36

36:                                               ; preds = %28
  %37 = load i32, ptr %9, align 4, !tbaa !9
  %38 = add nsw i32 %37, 1
  store i32 %38, ptr %9, align 4, !tbaa !9
  br label %23, !llvm.loop !11

39:                                               ; preds = %27
  call void @llvm.lifetime.start.p0(i64 24, ptr %10) #11
  call void @_ZN3P3D10PolyhedronC2ERKS0_(ptr noundef nonnull align 8 dereferenceable(24) %10, ptr noundef nonnull align 8 dereferenceable(24) @_ZN3P3D12ShapeLibrary11icosahedronE)
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #11
  %40 = load i32, ptr %7, align 4, !tbaa !9
  %41 = sext i32 %40 to i64
  %42 = call { i64, i1 } @llvm.umul.with.overflow.i64(i64 %41, i64 12)
  %43 = extractvalue { i64, i1 } %42, 1
  %44 = extractvalue { i64, i1 } %42, 0
  %45 = select i1 %43, i64 -1, i64 %44
  %46 = invoke noalias noundef nonnull ptr @_Znam(i64 noundef %45) #12
          to label %47 unwind label %73

47:                                               ; preds = %39
  %48 = icmp eq i64 %41, 0
  br i1 %48, label %55, label %49

49:                                               ; preds = %47
  %50 = getelementptr inbounds %"struct.P3D::Vector", ptr %46, i64 %41
  br label %51

51:                                               ; preds = %51, %49
  %52 = phi ptr [ %46, %49 ], [ %53, %51 ]
  call void @_ZN3P3D6VectorIfLm3EEC2Ev(ptr noundef nonnull align 4 dereferenceable(12) %52) #11
  %53 = getelementptr inbounds %"struct.P3D::Vector", ptr %52, i64 1
  %54 = icmp eq ptr %53, %50
  br i1 %54, label %55, label %51

55:                                               ; preds = %51, %47
  store ptr %46, ptr %11, align 8, !tbaa !13
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #11
  %56 = load i32, ptr %8, align 4, !tbaa !9
  %57 = sext i32 %56 to i64
  %58 = call { i64, i1 } @llvm.umul.with.overflow.i64(i64 %57, i64 12)
  %59 = extractvalue { i64, i1 } %58, 1
  %60 = extractvalue { i64, i1 } %58, 0
  %61 = select i1 %59, i64 -1, i64 %60
  %62 = invoke noalias noundef nonnull ptr @_Znam(i64 noundef %61) #12
          to label %63 unwind label %77

63:                                               ; preds = %55
  store ptr %62, ptr %14, align 8, !tbaa !13
  %64 = load ptr, ptr %11, align 8, !tbaa !13
  invoke void @_ZNK3P3D12TriangleMesh11getVerticesEPNS_6VectorIfLm3EEE(ptr noundef nonnull align 8 dereferenceable(24) %10, ptr noundef %64)
          to label %65 unwind label %77

65:                                               ; preds = %63
  %66 = load ptr, ptr %14, align 8, !tbaa !13
  invoke void @_ZNK3P3D12TriangleMesh12getTrianglesEPNS_8TriangleE(ptr noundef nonnull align 8 dereferenceable(24) %10, ptr noundef %66)
          to label %67 unwind label %77

67:                                               ; preds = %65
  store i32 12, ptr %7, align 4, !tbaa !9
  store i32 20, ptr %8, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #11
  store i32 0, ptr %15, align 4, !tbaa !9
  br label %68

68:                                               ; preds = %99, %67
  %69 = load i32, ptr %15, align 4, !tbaa !9
  %70 = load i32, ptr %6, align 4, !tbaa !9
  %71 = icmp slt i32 %69, %70
  br i1 %71, label %81, label %72

72:                                               ; preds = %68
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #11
  br label %106

73:                                               ; preds = %39
  %74 = landingpad { ptr, i32 }
          cleanup
  %75 = extractvalue { ptr, i32 } %74, 0
  store ptr %75, ptr %12, align 8
  %76 = extractvalue { ptr, i32 } %74, 1
  store i32 %76, ptr %13, align 4
  br label %148

77:                                               ; preds = %130, %65, %63, %55
  %78 = landingpad { ptr, i32 }
          cleanup
  %79 = extractvalue { ptr, i32 } %78, 0
  store ptr %79, ptr %12, align 8
  %80 = extractvalue { ptr, i32 } %78, 1
  store i32 %80, ptr %13, align 4
  br label %147

81:                                               ; preds = %68
  %82 = load ptr, ptr %11, align 8, !tbaa !13
  %83 = load ptr, ptr %14, align 8, !tbaa !13
  %84 = load i32, ptr %7, align 4, !tbaa !9
  %85 = load i32, ptr %8, align 4, !tbaa !9
  %86 = invoke { ptr, ptr } @_ZN3P3D12ShapeLibraryL9tesselateEPNS_6VectorIfLm3EEEPNS_8TriangleEii(ptr noundef %82, ptr noundef %83, i32 noundef %84, i32 noundef %85)
          to label %87 unwind label %102

87:                                               ; preds = %81
  %88 = getelementptr inbounds { ptr, ptr }, ptr %16, i32 0, i32 0
  %89 = extractvalue { ptr, ptr } %86, 0
  store ptr %89, ptr %88, align 8
  %90 = getelementptr inbounds { ptr, ptr }, ptr %16, i32 0, i32 1
  %91 = extractvalue { ptr, ptr } %86, 1
  store ptr %91, ptr %90, align 8
  %92 = load i32, ptr %7, align 4, !tbaa !9
  %93 = load i32, ptr %8, align 4, !tbaa !9
  %94 = mul nsw i32 %93, 3
  %95 = sdiv i32 %94, 2
  %96 = add nsw i32 %92, %95
  store i32 %96, ptr %7, align 4, !tbaa !9
  %97 = load i32, ptr %8, align 4, !tbaa !9
  %98 = mul nsw i32 %97, 4
  store i32 %98, ptr %8, align 4, !tbaa !9
  br label %99

99:                                               ; preds = %87
  %100 = load i32, ptr %15, align 4, !tbaa !9
  %101 = add nsw i32 %100, 1
  store i32 %101, ptr %15, align 4, !tbaa !9
  br label %68, !llvm.loop !15

102:                                              ; preds = %81
  %103 = landingpad { ptr, i32 }
          cleanup
  %104 = extractvalue { ptr, i32 } %103, 0
  store ptr %104, ptr %12, align 8
  %105 = extractvalue { ptr, i32 } %103, 1
  store i32 %105, ptr %13, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #11
  br label %147

106:                                              ; preds = %72
  call void @llvm.lifetime.start.p0(i64 4, ptr %17) #11
  store i32 0, ptr %17, align 4, !tbaa !9
  br label %107

107:                                              ; preds = %127, %106
  %108 = load i32, ptr %17, align 4, !tbaa !9
  %109 = load i32, ptr %7, align 4, !tbaa !9
  %110 = icmp slt i32 %108, %109
  br i1 %110, label %112, label %111

111:                                              ; preds = %107
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #11
  br label %130

112:                                              ; preds = %107
  call void @llvm.lifetime.start.p0(i64 12, ptr %18) #11
  call void @llvm.lifetime.start.p0(i64 12, ptr %19) #11
  %113 = load ptr, ptr %11, align 8, !tbaa !13
  %114 = load i32, ptr %17, align 4, !tbaa !9
  %115 = sext i32 %114 to i64
  %116 = getelementptr inbounds %"struct.P3D::Vector", ptr %113, i64 %115
  %117 = call { <2 x float>, float } @_ZN3P3D9normalizeIfLm3EEENS_6VectorIT_XT0_EEERKS3_(ptr noundef nonnull align 4 dereferenceable(12) %116) #11
  %118 = getelementptr inbounds %"struct.P3D::Vector", ptr %19, i32 0, i32 0
  %119 = getelementptr inbounds %union.anon, ptr %118, i32 0, i32 0
  store { <2 x float>, float } %117, ptr %20, align 8
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %119, ptr align 8 %20, i64 12, i1 false)
  %120 = call { <2 x float>, float } @_ZN3P3DmlIffLm3EEENS_6VectorIDTmlixfp_Li0Efp0_EXT1_EEERKNS1_IT_XT1_EEERKT0_(ptr noundef nonnull align 4 dereferenceable(12) %19, ptr noundef nonnull align 4 dereferenceable(4) %5) #11
  %121 = getelementptr inbounds %"struct.P3D::Vector", ptr %18, i32 0, i32 0
  %122 = getelementptr inbounds %union.anon, ptr %121, i32 0, i32 0
  store { <2 x float>, float } %120, ptr %21, align 8
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %122, ptr align 8 %21, i64 12, i1 false)
  %123 = load ptr, ptr %11, align 8, !tbaa !13
  %124 = load i32, ptr %17, align 4, !tbaa !9
  %125 = sext i32 %124 to i64
  %126 = getelementptr inbounds %"struct.P3D::Vector", ptr %123, i64 %125
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %126, ptr align 4 %18, i64 12, i1 false), !tbaa.struct !16
  call void @llvm.lifetime.end.p0(i64 12, ptr %19) #11
  call void @llvm.lifetime.end.p0(i64 12, ptr %18) #11
  br label %127

127:                                              ; preds = %112
  %128 = load i32, ptr %17, align 4, !tbaa !9
  %129 = add nsw i32 %128, 1
  store i32 %129, ptr %17, align 4, !tbaa !9
  br label %107, !llvm.loop !18

130:                                              ; preds = %111
  store i1 false, ptr %22, align 1
  %131 = load ptr, ptr %11, align 8, !tbaa !13
  %132 = load ptr, ptr %14, align 8, !tbaa !13
  %133 = load i32, ptr %7, align 4, !tbaa !9
  %134 = load i32, ptr %8, align 4, !tbaa !9
  invoke void @_ZN3P3D10PolyhedronC1EPKNS_6VectorIfLm3EEEPKNS_8TriangleEii(ptr noundef nonnull align 8 dereferenceable(24) %0, ptr noundef %131, ptr noundef %132, i32 noundef %133, i32 noundef %134)
          to label %135 unwind label %77

135:                                              ; preds = %130
  %136 = load ptr, ptr %11, align 8, !tbaa !13
  %137 = icmp eq ptr %136, null
  br i1 %137, label %139, label %138

138:                                              ; preds = %135
  call void @_ZdaPv(ptr noundef %136) #13
  br label %139

139:                                              ; preds = %138, %135
  %140 = load ptr, ptr %14, align 8, !tbaa !13
  %141 = icmp eq ptr %140, null
  br i1 %141, label %143, label %142

142:                                              ; preds = %139
  call void @_ZdaPv(ptr noundef %140) #13
  br label %143

143:                                              ; preds = %142, %139
  store i1 true, ptr %22, align 1
  %144 = load i1, ptr %22, align 1
  br i1 %144, label %146, label %145

145:                                              ; preds = %143
  call void @_ZN3P3D13MeshPrototypeD2Ev(ptr noundef nonnull align 8 dereferenceable(24) %0) #11
  br label %146

146:                                              ; preds = %145, %143
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #11
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #11
  call void @_ZN3P3D13MeshPrototypeD2Ev(ptr noundef nonnull align 8 dereferenceable(24) %10) #11
  call void @llvm.lifetime.end.p0(i64 24, ptr %10) #11
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #11
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #11
  ret void

147:                                              ; preds = %102, %77
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #11
  br label %148

148:                                              ; preds = %147, %73
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #11
  call void @_ZN3P3D13MeshPrototypeD2Ev(ptr noundef nonnull align 8 dereferenceable(24) %10) #11
  call void @llvm.lifetime.end.p0(i64 24, ptr %10) #11
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #11
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #11
  br label %149

149:                                              ; preds = %148
  %150 = load ptr, ptr %12, align 8
  %151 = load i32, ptr %13, align 4
  %152 = insertvalue { ptr, i32 } poison, ptr %150, 0
  %153 = insertvalue { ptr, i32 } %152, i32 %151, 1
  resume { ptr, i32 } %153
}

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

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare { i64, i1 } @llvm.umul.with.overflow.i64(i64, i64) #5

; Function Attrs: nobuiltin allocsize(0)
declare noundef nonnull ptr @_Znam(i64 noundef) #6

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

declare void @_ZNK3P3D12TriangleMesh11getVerticesEPNS_6VectorIfLm3EEE(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef) #0

declare void @_ZNK3P3D12TriangleMesh12getTrianglesEPNS_8TriangleE(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef) #0

; Function Attrs: mustprogress uwtable
declare hidden { ptr, ptr } @_ZN3P3D12ShapeLibraryL9tesselateEPNS_6VectorIfLm3EEEPNS_8TriangleEii(ptr noundef, ptr noundef, i32 noundef, i32 noundef) #3

; Function Attrs: mustprogress nounwind uwtable
declare dso_local { <2 x float>, float } @_ZN3P3DmlIffLm3EEENS_6VectorIDTmlixfp_Li0Efp0_EXT1_EEERKNS1_IT_XT1_EEERKT0_(ptr noundef nonnull align 4 dereferenceable(12), ptr noundef nonnull align 4 dereferenceable(4)) #7

; Function Attrs: mustprogress nounwind uwtable
declare dso_local { <2 x float>, float } @_ZN3P3D9normalizeIfLm3EEENS_6VectorIT_XT0_EEERKS3_(ptr noundef nonnull align 4 dereferenceable(12)) #8

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

; Function Attrs: nobuiltin nounwind
declare void @_ZdaPv(ptr noundef) #10

attributes #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 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 = { mustprogress uwtable "min-legal-vector-width"="64" "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 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #6 = { nobuiltin allocsize(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 #7 = { 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 #8 = { mustprogress nounwind uwtable "min-legal-vector-width"="64" "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 #9 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #10 = { nobuiltin nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #11 = { nounwind }
attributes #12 = { builtin allocsize(0) }
attributes #13 = { builtin 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 = !{!"float", !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 = !{!14, !14, i64 0}
!14 = !{!"any pointer", !7, i64 0}
!15 = distinct !{!15, !12}
!16 = !{i64 0, i64 12, !17}
!17 = !{!7, !7, i64 0}
!18 = distinct !{!18, !12}


; 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.P3D::Polyhedron" = type { %"class.P3D::TriangleMesh" }
%"class.P3D::TriangleMesh" = type { %"class.P3D::MeshPrototype" }
%"class.P3D::MeshPrototype" = type { %"class.P3D::UniqueAlignedPointer", %"class.P3D::UniqueAlignedPointer.2", i32, i32 }
%"class.P3D::UniqueAlignedPointer" = type { ptr }
%"class.P3D::UniqueAlignedPointer.2" = type { ptr }
%"struct.P3D::Vector" = type { %union.anon }
%union.anon = type { [3 x float] }

@_ZN3P3D12ShapeLibrary11icosahedronE = external dso_local global %"class.P3D::Polyhedron", align 8

declare void @_ZN3P3D10PolyhedronC1EPKNS_6VectorIfLm3EEEPKNS_8TriangleEii(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef, ptr noundef, i32 noundef, i32 noundef) 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

declare i32 @__gxx_personality_v0(...)

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZN3P3D13MeshPrototypeD2Ev(ptr noundef nonnull align 8 dereferenceable(24)) unnamed_addr #2 align 2

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN3P3D12ShapeLibrary12createSphereEfi(ptr dead_on_unwind noalias writable sret(%"class.P3D::Polyhedron") align 8 %0, float noundef %1, i32 noundef %2) local_unnamed_addr #3 personality ptr @__gxx_personality_v0 {
  %4 = alloca float, align 4
  %5 = alloca %"class.P3D::Polyhedron", align 8
  %6 = alloca %"struct.P3D::Vector", align 8
  store float %1, ptr %4, align 4, !tbaa !5
  %7 = icmp sgt i32 %2, 0
  br i1 %7, label %.lr.ph.preheader, label %._crit_edge

.lr.ph.preheader:                                 ; preds = %3
  %xtraiter = and i32 %2, 3
  %8 = icmp ult i32 %2, 4
  br i1 %8, label %._crit_edge.loopexit.unr-lcssa, label %.lr.ph.preheader.new

.lr.ph.preheader.new:                             ; preds = %.lr.ph.preheader
  %unroll_iter = and i32 %2, 2147483644
  br label %.lr.ph

._crit_edge.loopexit.unr-lcssa:                   ; preds = %.lr.ph, %.lr.ph.preheader
  %.lcssa82.ph = phi i32 [ poison, %.lr.ph.preheader ], [ %32, %.lr.ph ]
  %.lcssa81.ph = phi i32 [ poison, %.lr.ph.preheader ], [ %33, %.lr.ph ]
  %.059.unr = phi i32 [ 12, %.lr.ph.preheader ], [ %32, %.lr.ph ]
  %.04158.unr = phi i32 [ 20, %.lr.ph.preheader ], [ %33, %.lr.ph ]
  %lcmp.mod.not = icmp eq i32 %xtraiter, 0
  br i1 %lcmp.mod.not, label %._crit_edge.loopexit, label %.lr.ph.epil

.lr.ph.epil:                                      ; preds = %._crit_edge.loopexit.unr-lcssa, %.lr.ph.epil
  %.059.epil = phi i32 [ %11, %.lr.ph.epil ], [ %.059.unr, %._crit_edge.loopexit.unr-lcssa ]
  %.04158.epil = phi i32 [ %12, %.lr.ph.epil ], [ %.04158.unr, %._crit_edge.loopexit.unr-lcssa ]
  %epil.iter = phi i32 [ %epil.iter.next, %.lr.ph.epil ], [ 0, %._crit_edge.loopexit.unr-lcssa ]
  %9 = lshr exact i32 %.04158.epil, 1
  %10 = add nuw nsw i32 %9, %.04158.epil
  %11 = add nuw nsw i32 %10, %.059.epil
  %12 = shl nsw i32 %.04158.epil, 2
  %epil.iter.next = add i32 %epil.iter, 1
  %epil.iter.cmp.not = icmp eq i32 %epil.iter.next, %xtraiter
  br i1 %epil.iter.cmp.not, label %._crit_edge.loopexit, label %.lr.ph.epil, !llvm.loop !9

._crit_edge.loopexit:                             ; preds = %.lr.ph.epil, %._crit_edge.loopexit.unr-lcssa
  %.lcssa82 = phi i32 [ %.lcssa82.ph, %._crit_edge.loopexit.unr-lcssa ], [ %11, %.lr.ph.epil ]
  %.lcssa81 = phi i32 [ %.lcssa81.ph, %._crit_edge.loopexit.unr-lcssa ], [ %12, %.lr.ph.epil ]
  %13 = zext nneg i32 %.lcssa82 to i64
  %14 = zext nneg i32 %.lcssa81 to i64
  %15 = mul nuw nsw i64 %14, 12
  br label %._crit_edge

._crit_edge:                                      ; preds = %._crit_edge.loopexit, %3
  %.041.lcssa = phi i64 [ 240, %3 ], [ %15, %._crit_edge.loopexit ]
  %.0.lcssa = phi i64 [ 12, %3 ], [ %13, %._crit_edge.loopexit ]
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %5) #10
  call void @_ZN3P3D10PolyhedronC2ERKS0_(ptr noundef nonnull align 8 dereferenceable(24) %5, ptr noundef nonnull align 8 dereferenceable(24) @_ZN3P3D12ShapeLibrary11icosahedronE)
  %16 = mul nuw nsw i64 %.0.lcssa, 12
  %17 = invoke noalias noundef nonnull ptr @_Znam(i64 noundef %16) #11
          to label %34 unwind label %44

.lr.ph:                                           ; preds = %.lr.ph, %.lr.ph.preheader.new
  %.059 = phi i32 [ 12, %.lr.ph.preheader.new ], [ %32, %.lr.ph ]
  %.04158 = phi i32 [ 20, %.lr.ph.preheader.new ], [ %33, %.lr.ph ]
  %niter = phi i32 [ 0, %.lr.ph.preheader.new ], [ %niter.next.3, %.lr.ph ]
  %18 = lshr exact i32 %.04158, 1
  %19 = add nuw nsw i32 %18, %.04158
  %20 = add nuw nsw i32 %19, %.059
  %21 = shl nsw i32 %.04158, 2
  %22 = lshr exact i32 %21, 1
  %23 = add nuw nsw i32 %22, %21
  %24 = add nuw nsw i32 %23, %20
  %25 = shl nsw i32 %.04158, 4
  %26 = lshr exact i32 %25, 1
  %27 = add nuw nsw i32 %26, %25
  %28 = add nuw nsw i32 %27, %24
  %29 = shl nsw i32 %.04158, 6
  %30 = lshr exact i32 %29, 1
  %31 = add nuw nsw i32 %30, %29
  %32 = add nuw nsw i32 %31, %28
  %33 = shl nsw i32 %.04158, 8
  %niter.next.3 = add i32 %niter, 4
  %niter.ncmp.3 = icmp eq i32 %niter.next.3, %unroll_iter
  br i1 %niter.ncmp.3, label %._crit_edge.loopexit.unr-lcssa, label %.lr.ph, !llvm.loop !11

34:                                               ; preds = %._crit_edge
  %35 = getelementptr inbounds %"struct.P3D::Vector", ptr %17, i64 %.0.lcssa
  br label %36

36:                                               ; preds = %36, %34
  %37 = phi ptr [ %17, %34 ], [ %38, %36 ]
  call void @_ZN3P3D6VectorIfLm3EEC2Ev(ptr noundef nonnull align 4 dereferenceable(12) %37) #10
  %38 = getelementptr inbounds i8, ptr %37, i64 12
  %39 = icmp eq ptr %38, %35
  br i1 %39, label %40, label %36

40:                                               ; preds = %36
  %41 = invoke noalias noundef nonnull ptr @_Znam(i64 noundef %.041.lcssa) #11
          to label %42 unwind label %46

42:                                               ; preds = %40
  invoke void @_ZNK3P3D12TriangleMesh11getVerticesEPNS_6VectorIfLm3EEE(ptr noundef nonnull align 8 dereferenceable(24) %5, ptr noundef nonnull %17)
          to label %43 unwind label %46

43:                                               ; preds = %42
  invoke void @_ZNK3P3D12TriangleMesh12getTrianglesEPNS_8TriangleE(ptr noundef nonnull align 8 dereferenceable(24) %5, ptr noundef nonnull %41)
          to label %.preheader54 unwind label %46

.preheader54:                                     ; preds = %43
  br i1 %7, label %.lr.ph64, label %.preheader

.preheader:                                       ; preds = %49, %.preheader54
  %.142.lcssa = phi i32 [ 20, %.preheader54 ], [ %53, %49 ]
  %.1.lcssa = phi i32 [ 12, %.preheader54 ], [ %52, %49 ]
  %.sroa.24.0..sroa_idx = getelementptr inbounds i8, ptr %6, i64 8
  %umax = call i32 @llvm.umax.i32(i32 %.1.lcssa, i32 1)
  %wide.trip.count = zext i32 %umax to i64
  br label %58

44:                                               ; preds = %._crit_edge
  %45 = landingpad { ptr, i32 }
          cleanup
  br label %63

46:                                               ; preds = %57, %43, %42, %40
  %47 = landingpad { ptr, i32 }
          cleanup
  br label %63

.lr.ph64:                                         ; preds = %.preheader54, %49
  %.163 = phi i32 [ %52, %49 ], [ 12, %.preheader54 ]
  %.14262 = phi i32 [ %53, %49 ], [ 20, %.preheader54 ]
  %.04861 = phi i32 [ %54, %49 ], [ 0, %.preheader54 ]
  %48 = invoke { ptr, ptr } @_ZN3P3D12ShapeLibraryL9tesselateEPNS_6VectorIfLm3EEEPNS_8TriangleEii(ptr noundef nonnull %17, ptr noundef nonnull %41, i32 noundef %.163, i32 noundef %.14262)
          to label %49 unwind label %55

49:                                               ; preds = %.lr.ph64
  %50 = lshr exact i32 %.14262, 1
  %51 = add nuw nsw i32 %50, %.14262
  %52 = add nuw nsw i32 %51, %.163
  %53 = shl nsw i32 %.14262, 2
  %54 = add nuw nsw i32 %.04861, 1
  %exitcond71.not = icmp eq i32 %54, %2
  br i1 %exitcond71.not, label %.preheader, label %.lr.ph64, !llvm.loop !13

55:                                               ; preds = %.lr.ph64
  %56 = landingpad { ptr, i32 }
          cleanup
  br label %63

57:                                               ; preds = %58
  invoke void @_ZN3P3D10PolyhedronC1EPKNS_6VectorIfLm3EEEPKNS_8TriangleEii(ptr noundef nonnull align 8 dereferenceable(24) %0, ptr noundef nonnull %17, ptr noundef nonnull %41, i32 noundef %.1.lcssa, i32 noundef %.142.lcssa)
          to label %62 unwind label %46

58:                                               ; preds = %.preheader, %58
  %indvars.iv = phi i64 [ 0, %.preheader ], [ %indvars.iv.next, %58 ]
  call void @llvm.lifetime.start.p0(i64 12, ptr nonnull %6) #10
  %59 = getelementptr inbounds %"struct.P3D::Vector", ptr %17, i64 %indvars.iv
  %60 = call { <2 x float>, float } @_ZN3P3D9normalizeIfLm3EEENS_6VectorIT_XT0_EEERKS3_(ptr noundef nonnull align 4 dereferenceable(12) %59) #10
  %.fca.0.extract1 = extractvalue { <2 x float>, float } %60, 0
  %.fca.1.extract2 = extractvalue { <2 x float>, float } %60, 1
  store <2 x float> %.fca.0.extract1, ptr %6, align 8
  store float %.fca.1.extract2, ptr %.sroa.24.0..sroa_idx, align 8
  %61 = call { <2 x float>, float } @_ZN3P3DmlIffLm3EEENS_6VectorIDTmlixfp_Li0Efp0_EXT1_EEERKNS1_IT_XT1_EEERKT0_(ptr noundef nonnull align 4 dereferenceable(12) %6, ptr noundef nonnull align 4 dereferenceable(4) %4) #10
  %.fca.0.extract = extractvalue { <2 x float>, float } %61, 0
  %.fca.1.extract = extractvalue { <2 x float>, float } %61, 1
  store <2 x float> %.fca.0.extract, ptr %59, align 4
  %.sroa.4.0..sroa_idx = getelementptr inbounds i8, ptr %59, i64 8
  store float %.fca.1.extract, ptr %.sroa.4.0..sroa_idx, align 4, !tbaa !14
  call void @llvm.lifetime.end.p0(i64 12, ptr nonnull %6) #10
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %exitcond73.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
  br i1 %exitcond73.not, label %57, label %58, !llvm.loop !15

62:                                               ; preds = %57
  call void @_ZdaPv(ptr noundef nonnull %17) #12
  call void @_ZdaPv(ptr noundef nonnull %41) #12
  call void @_ZN3P3D13MeshPrototypeD2Ev(ptr noundef nonnull align 8 dereferenceable(24) %5) #10
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %5) #10
  ret void

63:                                               ; preds = %46, %55, %44
  %.pn.pn = phi { ptr, i32 } [ %45, %44 ], [ %56, %55 ], [ %47, %46 ]
  call void @_ZN3P3D13MeshPrototypeD2Ev(ptr noundef nonnull align 8 dereferenceable(24) %5) #10
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %5) #10
  resume { ptr, i32 } %.pn.pn
}

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

; Function Attrs: nobuiltin allocsize(0)
declare noundef nonnull ptr @_Znam(i64 noundef) local_unnamed_addr #5

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

declare void @_ZNK3P3D12TriangleMesh11getVerticesEPNS_6VectorIfLm3EEE(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef) local_unnamed_addr #0

declare void @_ZNK3P3D12TriangleMesh12getTrianglesEPNS_8TriangleE(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef) local_unnamed_addr #0

; Function Attrs: mustprogress uwtable
declare hidden { ptr, ptr } @_ZN3P3D12ShapeLibraryL9tesselateEPNS_6VectorIfLm3EEEPNS_8TriangleEii(ptr noundef, ptr noundef, i32 noundef, i32 noundef) local_unnamed_addr #3

; Function Attrs: mustprogress nounwind uwtable
declare dso_local { <2 x float>, float } @_ZN3P3DmlIffLm3EEENS_6VectorIDTmlixfp_Li0Efp0_EXT1_EEERKNS1_IT_XT1_EEERKT0_(ptr noundef nonnull align 4 dereferenceable(12), ptr noundef nonnull align 4 dereferenceable(4)) local_unnamed_addr #6

; Function Attrs: mustprogress nounwind uwtable
declare dso_local { <2 x float>, float } @_ZN3P3D9normalizeIfLm3EEENS_6VectorIT_XT0_EEERKS3_(ptr noundef nonnull align 4 dereferenceable(12)) local_unnamed_addr #7

; Function Attrs: nobuiltin nounwind
declare void @_ZdaPv(ptr noundef) local_unnamed_addr #8

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.umax.i32(i32, i32) #9

attributes #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 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 = { mustprogress uwtable "min-legal-vector-width"="64" "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 = { nobuiltin allocsize(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 = { 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 #7 = { mustprogress nounwind uwtable "min-legal-vector-width"="64" "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 #8 = { nobuiltin nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #9 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #10 = { nounwind }
attributes #11 = { builtin allocsize(0) }
attributes #12 = { builtin 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 = !{!"float", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.unroll.disable"}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = distinct !{!13, !12}
!14 = !{!7, !7, i64 0}
!15 = distinct !{!15, !12}


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