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

; 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 }
%"class.P3D::EditableMesh" = type { %"class.P3D::MeshPrototype" }
%"struct.P3D::Vector" = type { %union.anon }
%union.anon = type { [3 x float] }

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN3P3D6VectorIfLm3EEC2Efff(ptr noundef nonnull align 4 dereferenceable(12), float noundef, float noundef, float noundef) unnamed_addr #1 align 2

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

declare void @_ZN3P3D12EditableMeshC1Eii(ptr noundef nonnull align 8 dereferenceable(24), i32 noundef, i32 noundef) unnamed_addr #2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef float @_ZN3P3D2piIfEET_v() #1

declare i32 @__gxx_personality_v0(...)

; Function Attrs: nounwind
declare double @cos(double noundef) #3

; Function Attrs: nounwind
declare double @sin(double noundef) #3

; Function Attrs: nounwind
declare void @_ZN3P3D10PolyhedronC1EONS_13MeshPrototypeE(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 8 dereferenceable(24)) unnamed_addr #3

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZN3P3D13MeshPrototypeD2Ev(ptr noundef nonnull align 8 dereferenceable(24)) unnamed_addr #4 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) #5

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN3P3D12ShapeLibrary11createTorusEffii(ptr dead_on_unwind noalias writable sret(%"class.P3D::Polyhedron") align 8 %0, float noundef %1, float noundef %2, i32 noundef %3, i32 noundef %4) #6 personality ptr @__gxx_personality_v0 {
  %6 = alloca ptr, align 8
  %7 = alloca float, align 4
  %8 = alloca float, align 4
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  %11 = alloca %"class.P3D::EditableMesh", align 8
  %12 = alloca i32, align 4
  %13 = alloca i32, align 4
  %14 = alloca float, align 4
  %15 = alloca ptr, align 8
  %16 = alloca i32, align 4
  %17 = alloca float, align 4
  %18 = alloca float, align 4
  %19 = alloca i32, align 4
  %20 = alloca float, align 4
  %21 = alloca float, align 4
  %22 = alloca float, align 4
  %23 = alloca %"struct.P3D::Vector", align 4
  %24 = alloca { <2 x float>, float }, align 4
  %25 = alloca i32, align 4
  store ptr %0, ptr %6, align 8
  store float %1, ptr %7, align 4, !tbaa !5
  store float %2, ptr %8, align 4, !tbaa !5
  store i32 %3, ptr %9, align 4, !tbaa !9
  store i32 %4, ptr %10, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 24, ptr %11) #9
  %26 = load i32, ptr %9, align 4, !tbaa !9
  %27 = load i32, ptr %10, align 4, !tbaa !9
  %28 = mul nsw i32 %26, %27
  %29 = load i32, ptr %9, align 4, !tbaa !9
  %30 = mul nsw i32 2, %29
  %31 = load i32, ptr %10, align 4, !tbaa !9
  %32 = mul nsw i32 %30, %31
  call void @_ZN3P3D12EditableMeshC1Eii(ptr noundef nonnull align 8 dereferenceable(24) %11, i32 noundef %28, i32 noundef %32)
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #9
  store i32 0, ptr %12, align 4, !tbaa !9
  br label %33

33:                                               ; preds = %121, %5
  %34 = load i32, ptr %12, align 4, !tbaa !9
  %35 = load i32, ptr %9, align 4, !tbaa !9
  %36 = icmp slt i32 %34, %35
  br i1 %36, label %38, label %37

37:                                               ; preds = %33
  store i32 2, ptr %13, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #9
  br label %125

38:                                               ; preds = %33
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #9
  %39 = invoke noundef float @_ZN3P3D2piIfEET_v()
          to label %40 unwind label %61

40:                                               ; preds = %38
  %41 = fmul float 2.000000e+00, %39
  %42 = load i32, ptr %12, align 4, !tbaa !9
  %43 = sitofp i32 %42 to float
  %44 = fmul float %41, %43
  %45 = load i32, ptr %9, align 4, !tbaa !9
  %46 = sitofp i32 %45 to float
  %47 = fdiv float %44, %46
  store float %47, ptr %14, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %17) #9
  %48 = load float, ptr %14, align 4, !tbaa !5
  %49 = fpext float %48 to double
  %50 = call double @sin(double noundef %49) #9
  %51 = fptrunc double %50 to float
  store float %51, ptr %17, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %18) #9
  %52 = load float, ptr %14, align 4, !tbaa !5
  %53 = fpext float %52 to double
  %54 = call double @cos(double noundef %53) #9
  %55 = fptrunc double %54 to float
  store float %55, ptr %18, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %19) #9
  store i32 0, ptr %19, align 4, !tbaa !9
  br label %56

56:                                               ; preds = %108, %40
  %57 = load i32, ptr %19, align 4, !tbaa !9
  %58 = load i32, ptr %10, align 4, !tbaa !9
  %59 = icmp slt i32 %57, %58
  br i1 %59, label %65, label %60

60:                                               ; preds = %56
  store i32 5, ptr %13, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %19) #9
  br label %120

61:                                               ; preds = %38
  %62 = landingpad { ptr, i32 }
          cleanup
  %63 = extractvalue { ptr, i32 } %62, 0
  store ptr %63, ptr %15, align 8
  %64 = extractvalue { ptr, i32 } %62, 1
  store i32 %64, ptr %16, align 4
  br label %124

65:                                               ; preds = %56
  call void @llvm.lifetime.start.p0(i64 4, ptr %20) #9
  %66 = invoke noundef float @_ZN3P3D2piIfEET_v()
          to label %67 unwind label %111

67:                                               ; preds = %65
  %68 = fmul float 2.000000e+00, %66
  %69 = load i32, ptr %19, align 4, !tbaa !9
  %70 = sitofp i32 %69 to float
  %71 = fmul float %68, %70
  %72 = load i32, ptr %10, align 4, !tbaa !9
  %73 = sitofp i32 %72 to float
  %74 = fdiv float %71, %73
  store float %74, ptr %20, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %21) #9
  %75 = load float, ptr %8, align 4, !tbaa !5
  %76 = fpext float %75 to double
  %77 = load float, ptr %20, align 4, !tbaa !5
  %78 = fpext float %77 to double
  %79 = call double @sin(double noundef %78) #9
  %80 = fmul double %76, %79
  %81 = fptrunc double %80 to float
  store float %81, ptr %21, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %22) #9
  %82 = load float, ptr %7, align 4, !tbaa !5
  %83 = fpext float %82 to double
  %84 = load float, ptr %8, align 4, !tbaa !5
  %85 = fpext float %84 to double
  %86 = load float, ptr %20, align 4, !tbaa !5
  %87 = fpext float %86 to double
  %88 = call double @cos(double noundef %87) #9
  %89 = call double @llvm.fmuladd.f64(double %85, double %88, double %83)
  %90 = fptrunc double %89 to float
  store float %90, ptr %22, align 4, !tbaa !5
  %91 = load i32, ptr %12, align 4, !tbaa !9
  %92 = load i32, ptr %10, align 4, !tbaa !9
  %93 = mul nsw i32 %91, %92
  %94 = load i32, ptr %19, align 4, !tbaa !9
  %95 = add nsw i32 %93, %94
  %96 = load float, ptr %17, align 4, !tbaa !5
  %97 = load float, ptr %22, align 4, !tbaa !5
  %98 = fmul float %96, %97
  %99 = load float, ptr %18, align 4, !tbaa !5
  %100 = load float, ptr %22, align 4, !tbaa !5
  %101 = fmul float %99, %100
  %102 = load float, ptr %21, align 4, !tbaa !5
  call void @_ZN3P3D6VectorIfLm3EEC2Efff(ptr noundef nonnull align 4 dereferenceable(12) %23, float noundef %98, float noundef %101, float noundef %102) #9
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %24, ptr align 4 %23, i64 12, i1 false)
  %103 = getelementptr inbounds { <2 x float>, float }, ptr %24, i32 0, i32 0
  %104 = load <2 x float>, ptr %103, align 4
  %105 = getelementptr inbounds { <2 x float>, float }, ptr %24, i32 0, i32 1
  %106 = load float, ptr %105, align 4
  invoke void @_ZN3P3D12EditableMesh9setVertexEiNS_6VectorIfLm3EEE(ptr noundef nonnull align 8 dereferenceable(24) %11, i32 noundef %95, <2 x float> %104, float %106)
          to label %107 unwind label %115

107:                                              ; preds = %67
  call void @llvm.lifetime.end.p0(i64 4, ptr %22) #9
  call void @llvm.lifetime.end.p0(i64 4, ptr %21) #9
  call void @llvm.lifetime.end.p0(i64 4, ptr %20) #9
  br label %108

108:                                              ; preds = %107
  %109 = load i32, ptr %19, align 4, !tbaa !9
  %110 = add nsw i32 %109, 1
  store i32 %110, ptr %19, align 4, !tbaa !9
  br label %56, !llvm.loop !11

111:                                              ; preds = %65
  %112 = landingpad { ptr, i32 }
          cleanup
  %113 = extractvalue { ptr, i32 } %112, 0
  store ptr %113, ptr %15, align 8
  %114 = extractvalue { ptr, i32 } %112, 1
  store i32 %114, ptr %16, align 4
  br label %119

115:                                              ; preds = %67
  %116 = landingpad { ptr, i32 }
          cleanup
  %117 = extractvalue { ptr, i32 } %116, 0
  store ptr %117, ptr %15, align 8
  %118 = extractvalue { ptr, i32 } %116, 1
  store i32 %118, ptr %16, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %22) #9
  call void @llvm.lifetime.end.p0(i64 4, ptr %21) #9
  br label %119

119:                                              ; preds = %115, %111
  call void @llvm.lifetime.end.p0(i64 4, ptr %20) #9
  call void @llvm.lifetime.end.p0(i64 4, ptr %19) #9
  call void @llvm.lifetime.end.p0(i64 4, ptr %18) #9
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #9
  br label %124

120:                                              ; preds = %60
  call void @llvm.lifetime.end.p0(i64 4, ptr %18) #9
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #9
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #9
  br label %121

121:                                              ; preds = %120
  %122 = load i32, ptr %12, align 4, !tbaa !9
  %123 = add nsw i32 %122, 1
  store i32 %123, ptr %12, align 4, !tbaa !9
  br label %33, !llvm.loop !13

124:                                              ; preds = %119, %61
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #9
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #9
  br label %169

125:                                              ; preds = %37
  call void @llvm.lifetime.start.p0(i64 4, ptr %25) #9
  store i32 0, ptr %25, align 4, !tbaa !9
  br label %126

126:                                              ; preds = %146, %125
  %127 = load i32, ptr %25, align 4, !tbaa !9
  %128 = load i32, ptr %9, align 4, !tbaa !9
  %129 = sub nsw i32 %128, 1
  %130 = icmp slt i32 %127, %129
  br i1 %130, label %132, label %131

131:                                              ; preds = %126
  store i32 8, ptr %13, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %25) #9
  br label %153

132:                                              ; preds = %126
  %133 = load i32, ptr %25, align 4, !tbaa !9
  %134 = load i32, ptr %10, align 4, !tbaa !9
  %135 = mul nsw i32 %133, %134
  %136 = load i32, ptr %25, align 4, !tbaa !9
  %137 = add nsw i32 %136, 1
  %138 = load i32, ptr %10, align 4, !tbaa !9
  %139 = mul nsw i32 %137, %138
  %140 = load i32, ptr %10, align 4, !tbaa !9
  %141 = load i32, ptr %25, align 4, !tbaa !9
  %142 = mul nsw i32 2, %141
  %143 = load i32, ptr %10, align 4, !tbaa !9
  %144 = mul nsw i32 %142, %143
  invoke void @_ZN3P3D12ShapeLibraryL18createTriangleRingEiiiRNS_12EditableMeshEi(i32 noundef %135, i32 noundef %139, i32 noundef %140, ptr noundef nonnull align 8 dereferenceable(24) %11, i32 noundef %144)
          to label %145 unwind label %149

145:                                              ; preds = %132
  br label %146

146:                                              ; preds = %145
  %147 = load i32, ptr %25, align 4, !tbaa !9
  %148 = add nsw i32 %147, 1
  store i32 %148, ptr %25, align 4, !tbaa !9
  br label %126, !llvm.loop !14

149:                                              ; preds = %132
  %150 = landingpad { ptr, i32 }
          cleanup
  %151 = extractvalue { ptr, i32 } %150, 0
  store ptr %151, ptr %15, align 8
  %152 = extractvalue { ptr, i32 } %150, 1
  store i32 %152, ptr %16, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %25) #9
  br label %169

153:                                              ; preds = %131
  %154 = load i32, ptr %9, align 4, !tbaa !9
  %155 = sub nsw i32 %154, 1
  %156 = load i32, ptr %10, align 4, !tbaa !9
  %157 = mul nsw i32 %155, %156
  %158 = load i32, ptr %10, align 4, !tbaa !9
  %159 = load i32, ptr %9, align 4, !tbaa !9
  %160 = sub nsw i32 %159, 1
  %161 = mul nsw i32 2, %160
  %162 = load i32, ptr %10, align 4, !tbaa !9
  %163 = mul nsw i32 %161, %162
  invoke void @_ZN3P3D12ShapeLibraryL18createTriangleRingEiiiRNS_12EditableMeshEi(i32 noundef %157, i32 noundef 0, i32 noundef %158, ptr noundef nonnull align 8 dereferenceable(24) %11, i32 noundef %163)
          to label %164 unwind label %165

164:                                              ; preds = %153
  call void @_ZN3P3D10PolyhedronC1EONS_13MeshPrototypeE(ptr noundef nonnull align 8 dereferenceable(24) %0, ptr noundef nonnull align 8 dereferenceable(24) %11) #9
  store i32 1, ptr %13, align 4
  call void @_ZN3P3D13MeshPrototypeD2Ev(ptr noundef nonnull align 8 dereferenceable(24) %11) #9
  call void @llvm.lifetime.end.p0(i64 24, ptr %11) #9
  ret void

165:                                              ; preds = %153
  %166 = landingpad { ptr, i32 }
          cleanup
  %167 = extractvalue { ptr, i32 } %166, 0
  store ptr %167, ptr %15, align 8
  %168 = extractvalue { ptr, i32 } %166, 1
  store i32 %168, ptr %16, align 4
  br label %169

169:                                              ; preds = %165, %149, %124
  call void @_ZN3P3D13MeshPrototypeD2Ev(ptr noundef nonnull align 8 dereferenceable(24) %11) #9
  call void @llvm.lifetime.end.p0(i64 24, ptr %11) #9
  br label %170

170:                                              ; preds = %169
  %171 = load ptr, ptr %15, align 8
  %172 = load i32, ptr %16, align 4
  %173 = insertvalue { ptr, i32 } poison, ptr %171, 0
  %174 = insertvalue { ptr, i32 } %173, i32 %172, 1
  resume { ptr, i32 } %174
}

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare double @llvm.fmuladd.f64(double, double, double) #7

declare void @_ZN3P3D12EditableMesh9setVertexEiNS_6VectorIfLm3EEE(ptr noundef nonnull align 8 dereferenceable(24), i32 noundef, <2 x float>, float) #2

; Function Attrs: mustprogress uwtable
declare hidden void @_ZN3P3D12ShapeLibraryL18createTriangleRingEiiiRNS_12EditableMeshEi(i32 noundef, i32 noundef, i32 noundef, ptr noundef nonnull align 8 dereferenceable(24), i32 noundef) #8

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #2 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind "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 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #6 = { 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 #7 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #8 = { 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 #9 = { 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 = distinct !{!13, !12}
!14 = distinct !{!14, !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 }
%"class.P3D::EditableMesh" = type { %"class.P3D::MeshPrototype" }
%"struct.P3D::Vector" = type { %union.anon }
%union.anon = type { [3 x float] }

; 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 nounwind uwtable
declare dso_local void @_ZN3P3D6VectorIfLm3EEC2Efff(ptr noundef nonnull align 4 dereferenceable(12), float noundef, float noundef, float noundef) unnamed_addr #1 align 2

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

declare void @_ZN3P3D12EditableMeshC1Eii(ptr noundef nonnull align 8 dereferenceable(24), i32 noundef, i32 noundef) unnamed_addr #2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef float @_ZN3P3D2piIfEET_v() local_unnamed_addr #1

declare i32 @__gxx_personality_v0(...)

; Function Attrs: mustprogress nofree nounwind willreturn memory(write)
declare double @cos(double noundef) local_unnamed_addr #3

; Function Attrs: mustprogress nofree nounwind willreturn memory(write)
declare double @sin(double noundef) local_unnamed_addr #3

; Function Attrs: nounwind
declare void @_ZN3P3D10PolyhedronC1EONS_13MeshPrototypeE(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 8 dereferenceable(24)) unnamed_addr #4

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

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN3P3D12ShapeLibrary11createTorusEffii(ptr dead_on_unwind noalias writable sret(%"class.P3D::Polyhedron") align 8 %0, float noundef %1, float noundef %2, i32 noundef %3, i32 noundef %4) local_unnamed_addr #6 personality ptr @__gxx_personality_v0 {
  %6 = alloca %"class.P3D::EditableMesh", align 8
  %7 = alloca %"struct.P3D::Vector", align 8
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %6) #10
  %8 = mul nsw i32 %4, %3
  %9 = shl nsw i32 %3, 1
  %10 = mul nsw i32 %9, %4
  call void @_ZN3P3D12EditableMeshC1Eii(ptr noundef nonnull align 8 dereferenceable(24) %6, i32 noundef %8, i32 noundef %10)
  %11 = icmp sgt i32 %3, 0
  br i1 %11, label %.lr.ph57, label %.preheader

.lr.ph57:                                         ; preds = %5
  %12 = uitofp nneg i32 %3 to float
  %13 = icmp sgt i32 %4, 0
  %14 = sitofp i32 %4 to float
  %15 = fpext float %2 to double
  %16 = fpext float %1 to double
  %.sroa.2.0..sroa_idx = getelementptr inbounds i8, ptr %7, i64 8
  br i1 %13, label %.lr.ph.us, label %.lr.ph57.split

.lr.ph.us:                                        ; preds = %.lr.ph57, %._crit_edge.us
  %.04555.us = phi i32 [ %46, %._crit_edge.us ], [ 0, %.lr.ph57 ]
  %17 = call noundef float @_ZN3P3D2piIfEET_v()
  %18 = fmul float %17, 2.000000e+00
  %19 = uitofp nneg i32 %.04555.us to float
  %20 = fmul float %18, %19
  %21 = fdiv float %20, %12
  %22 = fpext float %21 to double
  %23 = call double @sin(double noundef %22) #10
  %24 = fptrunc double %23 to float
  %25 = call double @cos(double noundef %22) #10
  %26 = fptrunc double %25 to float
  %27 = mul nuw nsw i32 %.04555.us, %4
  br label %28

28:                                               ; preds = %.lr.ph.us, %44
  %.04854.us = phi i32 [ 0, %.lr.ph.us ], [ %45, %44 ]
  %29 = call noundef float @_ZN3P3D2piIfEET_v()
  %30 = fmul float %29, 2.000000e+00
  %31 = uitofp nneg i32 %.04854.us to float
  %32 = fmul float %30, %31
  %33 = fdiv float %32, %14
  %34 = fpext float %33 to double
  %35 = call double @sin(double noundef %34) #10
  %36 = fmul double %35, %15
  %37 = fptrunc double %36 to float
  %38 = call double @cos(double noundef %34) #10
  %39 = call double @llvm.fmuladd.f64(double %15, double %38, double %16)
  %40 = fptrunc double %39 to float
  %41 = add nuw nsw i32 %.04854.us, %27
  %42 = fmul float %24, %40
  %43 = fmul float %26, %40
  call void @_ZN3P3D6VectorIfLm3EEC2Efff(ptr noundef nonnull align 4 dereferenceable(12) %7, float noundef %42, float noundef %43, float noundef %37) #10
  %.sroa.0.0.copyload.us = load <2 x float>, ptr %7, align 8
  %.sroa.2.0.copyload.us = load float, ptr %.sroa.2.0..sroa_idx, align 8
  invoke void @_ZN3P3D12EditableMesh9setVertexEiNS_6VectorIfLm3EEE(ptr noundef nonnull align 8 dereferenceable(24) %6, i32 noundef %41, <2 x float> %.sroa.0.0.copyload.us, float %.sroa.2.0.copyload.us)
          to label %44 unwind label %.split.us

44:                                               ; preds = %28
  %45 = add nuw nsw i32 %.04854.us, 1
  %exitcond59.not = icmp eq i32 %45, %4
  br i1 %exitcond59.not, label %._crit_edge.us, label %28, !llvm.loop !5

._crit_edge.us:                                   ; preds = %44
  %46 = add nuw nsw i32 %.04555.us, 1
  %exitcond60.not = icmp eq i32 %46, %3
  br i1 %exitcond60.not, label %.preheader, label %.lr.ph.us, !llvm.loop !7

.split.us:                                        ; preds = %28
  %47 = landingpad { ptr, i32 }
          cleanup
  br label %74

.preheader:                                       ; preds = %.lr.ph57.split, %._crit_edge.us, %5
  %48 = add nsw i32 %3, -1
  %49 = shl i32 %4, 1
  %smax = call i32 @llvm.smax.i32(i32 %48, i32 0)
  br label %59

.lr.ph57.split:                                   ; preds = %.lr.ph57, %.lr.ph57.split
  %.04555 = phi i32 [ %58, %.lr.ph57.split ], [ 0, %.lr.ph57 ]
  %50 = call noundef float @_ZN3P3D2piIfEET_v()
  %51 = fmul float %50, 2.000000e+00
  %52 = uitofp nneg i32 %.04555 to float
  %53 = fmul float %51, %52
  %54 = fdiv float %53, %12
  %55 = fpext float %54 to double
  %56 = call double @sin(double noundef %55) #10
  %57 = call double @cos(double noundef %55) #10
  %58 = add nuw nsw i32 %.04555, 1
  %exitcond.not = icmp eq i32 %58, %3
  br i1 %exitcond.not, label %.preheader, label %.lr.ph57.split, !llvm.loop !7

59:                                               ; preds = %.preheader, %64
  %.0 = phi i32 [ %66, %64 ], [ 0, %.preheader ]
  %exitcond61.not = icmp eq i32 %.0, %smax
  br i1 %exitcond61.not, label %60, label %64

60:                                               ; preds = %59
  %61 = mul nsw i32 %48, %4
  %62 = shl nsw i32 %48, 1
  %63 = mul nsw i32 %62, %4
  invoke void @_ZN3P3D12ShapeLibraryL18createTriangleRingEiiiRNS_12EditableMeshEi(i32 noundef %61, i32 noundef 0, i32 noundef %4, ptr noundef nonnull align 8 dereferenceable(24) %6, i32 noundef %63)
          to label %71 unwind label %72

64:                                               ; preds = %59
  %65 = mul nsw i32 %.0, %4
  %66 = add nuw i32 %.0, 1
  %67 = mul nsw i32 %66, %4
  %68 = mul i32 %49, %.0
  invoke void @_ZN3P3D12ShapeLibraryL18createTriangleRingEiiiRNS_12EditableMeshEi(i32 noundef %65, i32 noundef %67, i32 noundef %4, ptr noundef nonnull align 8 dereferenceable(24) %6, i32 noundef %68)
          to label %59 unwind label %69, !llvm.loop !8

69:                                               ; preds = %64
  %70 = landingpad { ptr, i32 }
          cleanup
  br label %74

71:                                               ; preds = %60
  call void @_ZN3P3D10PolyhedronC1EONS_13MeshPrototypeE(ptr noundef nonnull align 8 dereferenceable(24) %0, ptr noundef nonnull align 8 dereferenceable(24) %6) #10
  call void @_ZN3P3D13MeshPrototypeD2Ev(ptr noundef nonnull align 8 dereferenceable(24) %6) #10
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %6) #10
  ret void

72:                                               ; preds = %60
  %73 = landingpad { ptr, i32 }
          cleanup
  br label %74

74:                                               ; preds = %72, %69, %.split.us
  %.pn = phi { ptr, i32 } [ %47, %.split.us ], [ %70, %69 ], [ %73, %72 ]
  call void @_ZN3P3D13MeshPrototypeD2Ev(ptr noundef nonnull align 8 dereferenceable(24) %6) #10
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %6) #10
  resume { ptr, i32 } %.pn
}

; Function Attrs: mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare double @llvm.fmuladd.f64(double, double, double) #7

declare void @_ZN3P3D12EditableMesh9setVertexEiNS_6VectorIfLm3EEE(ptr noundef nonnull align 8 dereferenceable(24), i32 noundef, <2 x float>, float) local_unnamed_addr #2

; Function Attrs: mustprogress uwtable
declare hidden void @_ZN3P3D12ShapeLibraryL18createTriangleRingEiiiRNS_12EditableMeshEi(i32 noundef, i32 noundef, i32 noundef, ptr noundef nonnull align 8 dereferenceable(24), i32 noundef) local_unnamed_addr #8

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

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #2 = { "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 nofree nounwind willreturn memory(write) "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 = { 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 #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 = { 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 #7 = { mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #8 = { 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 #9 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #10 = { 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 = distinct !{!5, !6}
!6 = !{!"llvm.loop.mustprogress"}
!7 = distinct !{!7, !6}
!8 = distinct !{!8, !6}


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