; LLVM IR from ImperialCollegeLondon/pnflow :: src/pnm/pnflow/polygon/polygon.ll (ZN7PolygonC2ER4ElemRK10CommonDataddii)

; 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.Polygon = type { %class.VoidElem, i32, %"class.std::vector.16", ptr, ptr, i16, i8, double }
%class.VoidElem = type { %class.ElemModel, double, double, double, double }
%class.ElemModel = type { ptr, double, double, ptr, ptr, double, ptr, i8, i8, i8, i8, i32, double, double, double, double, double, double, double, %"struct.std::pair", %"struct.std::pair" }
%"struct.std::pair" = type { double, double }
%"class.std::vector.16" = type { %"struct.std::_Vector_base.17" }
%"struct.std::_Vector_base.17" = type { %"struct.std::_Vector_base<double, std::allocator<double>>::_Vector_impl" }
%"struct.std::_Vector_base<double, std::allocator<double>>::_Vector_impl" = type { %"struct.std::_Vector_base<double, std::allocator<double>>::_Vector_impl_data" }
%"struct.std::_Vector_base<double, std::allocator<double>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%class.CornerApex = type { %class.Apex, ptr, double, double, double, ptr }
%class.Apex = type { ptr, i8, double, double, ptr, i32, double, double, double, double, i8, i8, i8, i8, %"struct.std::pair.0" }
%"struct.std::pair.0" = type { i32, double }
%class.LayerApex = type { %class.Apex, i32, ptr, double, ptr, double }

@_ZN9ElemModel2PIE = external constant double, align 8
@_ZTV7Polygon = external dso_local unnamed_addr constant { [32 x ptr] }, align 8

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN8VoidElemC2ER4ElemRK10CommonDataddi(ptr noundef nonnull align 8 dereferenceable(184), ptr noundef nonnull align 8 dereferenceable(408), ptr noundef nonnull align 8 dereferenceable(1972), double noundef, double noundef, i32 noundef) unnamed_addr #0 align 2

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

declare i32 @__gxx_personality_v0(...)

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

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN7PolygonC2ER4ElemRK10CommonDataddii(ptr noundef nonnull align 8 dereferenceable(248) %0, ptr noundef nonnull align 8 dereferenceable(408) %1, ptr noundef nonnull align 8 dereferenceable(1972) %2, double noundef %3, double noundef %4, i32 noundef %5, i32 noundef %6) unnamed_addr #0 align 2 personality ptr @__gxx_personality_v0 {
  %8 = alloca ptr, align 8
  %9 = alloca ptr, align 8
  %10 = alloca ptr, align 8
  %11 = alloca double, align 8
  %12 = alloca double, align 8
  %13 = alloca i32, align 4
  %14 = alloca i32, align 4
  %15 = alloca ptr, align 8
  %16 = alloca i32, align 4
  %17 = alloca i32, align 4
  store ptr %0, ptr %8, align 8, !tbaa !5
  store ptr %1, ptr %9, align 8, !tbaa !5
  store ptr %2, ptr %10, align 8, !tbaa !5
  store double %3, ptr %11, align 8, !tbaa !9
  store double %4, ptr %12, align 8, !tbaa !9
  store i32 %5, ptr %13, align 4, !tbaa !11
  store i32 %6, ptr %14, align 4, !tbaa !11
  %18 = load ptr, ptr %8, align 8
  %19 = load ptr, ptr %9, align 8, !tbaa !5
  %20 = load ptr, ptr %10, align 8, !tbaa !5
  %21 = load double, ptr %11, align 8, !tbaa !9
  %22 = load double, ptr %12, align 8, !tbaa !9
  %23 = load i32, ptr %14, align 4, !tbaa !11
  call void @_ZN8VoidElemC2ER4ElemRK10CommonDataddi(ptr noundef nonnull align 8 dereferenceable(184) %18, ptr noundef nonnull align 8 dereferenceable(408) %19, ptr noundef nonnull align 8 dereferenceable(1972) %20, double noundef %21, double noundef %22, i32 noundef %23)
  store ptr getelementptr inbounds inrange(-16, 240) ({ [32 x ptr] }, ptr @_ZTV7Polygon, i32 0, i32 0, i32 2), ptr %18, align 8, !tbaa !13
  %24 = getelementptr inbounds %class.Polygon, ptr %18, i32 0, i32 1
  %25 = load i32, ptr %13, align 4, !tbaa !11
  store i32 %25, ptr %24, align 8, !tbaa !15
  %26 = getelementptr inbounds %class.Polygon, ptr %18, i32 0, i32 2
  call void @_ZNSt6vectorIdSaIdEEC2Ev(ptr noundef nonnull align 8 dereferenceable(24) %26) #6
  %27 = getelementptr inbounds %class.Polygon, ptr %18, i32 0, i32 6
  store i8 88, ptr %27, align 2, !tbaa !26
  %28 = getelementptr inbounds %class.Polygon, ptr %18, i32 0, i32 5
  store i16 0, ptr %28, align 8, !tbaa !27
  %29 = load double, ptr @_ZN9ElemModel2PIE, align 8, !tbaa !9
  %30 = fdiv double %29, 2.000000e+00
  %31 = getelementptr inbounds %class.Polygon, ptr %18, i32 0, i32 7
  store double %30, ptr %31, align 8, !tbaa !28
  %32 = load i32, ptr %13, align 4, !tbaa !11
  %33 = sext i32 %32 to i64
  %34 = call { i64, i1 } @llvm.umul.with.overflow.i64(i64 %33, i64 144)
  %35 = extractvalue { i64, i1 } %34, 1
  %36 = extractvalue { i64, i1 } %34, 0
  %37 = call { i64, i1 } @llvm.uadd.with.overflow.i64(i64 %36, i64 8)
  %38 = extractvalue { i64, i1 } %37, 1
  %39 = or i1 %35, %38
  %40 = extractvalue { i64, i1 } %37, 0
  %41 = select i1 %39, i64 -1, i64 %40
  %42 = invoke noalias noundef nonnull ptr @_Znam(i64 noundef %41) #7
          to label %43 unwind label %83

43:                                               ; preds = %7
  store i64 %33, ptr %42, align 16
  %44 = getelementptr inbounds i8, ptr %42, i64 8
  %45 = icmp eq i64 %33, 0
  br i1 %45, label %53, label %46

46:                                               ; preds = %43
  %47 = getelementptr inbounds %class.CornerApex, ptr %44, i64 %33
  br label %48

48:                                               ; preds = %50, %46
  %49 = phi ptr [ %44, %46 ], [ %51, %50 ]
  invoke void @_ZN10CornerApexC2Ev(ptr noundef nonnull align 8 dereferenceable(144) %49)
          to label %50 unwind label %87

50:                                               ; preds = %48
  %51 = getelementptr inbounds %class.CornerApex, ptr %49, i64 1
  %52 = icmp eq ptr %51, %47
  br i1 %52, label %53, label %48

53:                                               ; preds = %50, %43
  %54 = getelementptr inbounds %class.Polygon, ptr %18, i32 0, i32 3
  store ptr %44, ptr %54, align 8, !tbaa !29
  %55 = load i32, ptr %13, align 4, !tbaa !11
  %56 = sext i32 %55 to i64
  %57 = call { i64, i1 } @llvm.umul.with.overflow.i64(i64 %56, i64 144)
  %58 = extractvalue { i64, i1 } %57, 1
  %59 = extractvalue { i64, i1 } %57, 0
  %60 = call { i64, i1 } @llvm.uadd.with.overflow.i64(i64 %59, i64 8)
  %61 = extractvalue { i64, i1 } %60, 1
  %62 = or i1 %58, %61
  %63 = extractvalue { i64, i1 } %60, 0
  %64 = select i1 %62, i64 -1, i64 %63
  %65 = invoke noalias noundef nonnull ptr @_Znam(i64 noundef %64) #7
          to label %66 unwind label %83

66:                                               ; preds = %53
  store i64 %56, ptr %65, align 16
  %67 = getelementptr inbounds i8, ptr %65, i64 8
  %68 = icmp eq i64 %56, 0
  br i1 %68, label %76, label %69

69:                                               ; preds = %66
  %70 = getelementptr inbounds %class.LayerApex, ptr %67, i64 %56
  br label %71

71:                                               ; preds = %73, %69
  %72 = phi ptr [ %67, %69 ], [ %74, %73 ]
  invoke void @_ZN9LayerApexC2Ev(ptr noundef nonnull align 8 dereferenceable(144) %72)
          to label %73 unwind label %97

73:                                               ; preds = %71
  %74 = getelementptr inbounds %class.LayerApex, ptr %72, i64 1
  %75 = icmp eq ptr %74, %70
  br i1 %75, label %76, label %71

76:                                               ; preds = %73, %66
  %77 = getelementptr inbounds %class.Polygon, ptr %18, i32 0, i32 4
  store ptr %67, ptr %77, align 8, !tbaa !30
  call void @llvm.lifetime.start.p0(i64 4, ptr %17) #6
  store i32 0, ptr %17, align 4, !tbaa !11
  br label %78

78:                                               ; preds = %132, %76
  %79 = load i32, ptr %17, align 4, !tbaa !11
  %80 = load i32, ptr %13, align 4, !tbaa !11
  %81 = icmp slt i32 %79, %80
  br i1 %81, label %107, label %82

82:                                               ; preds = %78
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #6
  br label %139

83:                                               ; preds = %53, %7
  %84 = landingpad { ptr, i32 }
          cleanup
  %85 = extractvalue { ptr, i32 } %84, 0
  store ptr %85, ptr %15, align 8
  %86 = extractvalue { ptr, i32 } %84, 1
  store i32 %86, ptr %16, align 4
  br label %140

87:                                               ; preds = %48
  %88 = landingpad { ptr, i32 }
          cleanup
  %89 = extractvalue { ptr, i32 } %88, 0
  store ptr %89, ptr %15, align 8
  %90 = extractvalue { ptr, i32 } %88, 1
  store i32 %90, ptr %16, align 4
  %91 = icmp eq ptr %44, %49
  br i1 %91, label %96, label %92

92:                                               ; preds = %92, %87
  %93 = phi ptr [ %49, %87 ], [ %94, %92 ]
  %94 = getelementptr inbounds %class.CornerApex, ptr %93, i64 -1
  call void @_ZN4ApexD2Ev(ptr noundef nonnull align 8 dereferenceable(144) %94) #6
  %95 = icmp eq ptr %94, %44
  br i1 %95, label %96, label %92

96:                                               ; preds = %92, %87
  call void @_ZdaPvm(ptr noundef %42, i64 noundef %41) #8
  br label %140

97:                                               ; preds = %71
  %98 = landingpad { ptr, i32 }
          cleanup
  %99 = extractvalue { ptr, i32 } %98, 0
  store ptr %99, ptr %15, align 8
  %100 = extractvalue { ptr, i32 } %98, 1
  store i32 %100, ptr %16, align 4
  %101 = icmp eq ptr %67, %72
  br i1 %101, label %106, label %102

102:                                              ; preds = %102, %97
  %103 = phi ptr [ %72, %97 ], [ %104, %102 ]
  %104 = getelementptr inbounds %class.LayerApex, ptr %103, i64 -1
  call void @_ZN4ApexD2Ev(ptr noundef nonnull align 8 dereferenceable(144) %104) #6
  %105 = icmp eq ptr %104, %67
  br i1 %105, label %106, label %102

106:                                              ; preds = %102, %97
  call void @_ZdaPvm(ptr noundef %65, i64 noundef %64) #8
  br label %140

107:                                              ; preds = %78
  %108 = getelementptr inbounds %class.Polygon, ptr %18, i32 0, i32 3
  %109 = load ptr, ptr %108, align 8, !tbaa !29
  %110 = load i32, ptr %17, align 4, !tbaa !11
  %111 = sext i32 %110 to i64
  %112 = getelementptr inbounds %class.CornerApex, ptr %109, i64 %111
  %113 = getelementptr inbounds %class.Polygon, ptr %18, i32 0, i32 4
  %114 = load ptr, ptr %113, align 8, !tbaa !30
  %115 = load i32, ptr %17, align 4, !tbaa !11
  %116 = sext i32 %115 to i64
  %117 = getelementptr inbounds %class.LayerApex, ptr %114, i64 %116
  %118 = load i32, ptr %17, align 4, !tbaa !11
  invoke void @_ZN10CornerApex20setCornerConnectionsEP4ApexP7Polygoni(ptr noundef nonnull align 8 dereferenceable(144) %112, ptr noundef %117, ptr noundef %18, i32 noundef %118)
          to label %119 unwind label %135

119:                                              ; preds = %107
  %120 = getelementptr inbounds %class.Polygon, ptr %18, i32 0, i32 4
  %121 = load ptr, ptr %120, align 8, !tbaa !30
  %122 = load i32, ptr %17, align 4, !tbaa !11
  %123 = sext i32 %122 to i64
  %124 = getelementptr inbounds %class.LayerApex, ptr %121, i64 %123
  %125 = getelementptr inbounds %class.Polygon, ptr %18, i32 0, i32 3
  %126 = load ptr, ptr %125, align 8, !tbaa !29
  %127 = load i32, ptr %17, align 4, !tbaa !11
  %128 = sext i32 %127 to i64
  %129 = getelementptr inbounds %class.CornerApex, ptr %126, i64 %128
  %130 = load i32, ptr %17, align 4, !tbaa !11
  invoke void @_ZN9LayerApex19setLayerConnectionsEP10CornerApexP7Polygoni(ptr noundef nonnull align 8 dereferenceable(144) %124, ptr noundef %129, ptr noundef %18, i32 noundef %130)
          to label %131 unwind label %135

131:                                              ; preds = %119
  br label %132

132:                                              ; preds = %131
  %133 = load i32, ptr %17, align 4, !tbaa !11
  %134 = add nsw i32 %133, 1
  store i32 %134, ptr %17, align 4, !tbaa !11
  br label %78, !llvm.loop !31

135:                                              ; preds = %119, %107
  %136 = landingpad { ptr, i32 }
          cleanup
  %137 = extractvalue { ptr, i32 } %136, 0
  store ptr %137, ptr %15, align 8
  %138 = extractvalue { ptr, i32 } %136, 1
  store i32 %138, ptr %16, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #6
  br label %140

139:                                              ; preds = %82
  ret void

140:                                              ; preds = %135, %106, %96, %83
  call void @_ZNSt6vectorIdSaIdEED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %26) #6
  call void @_ZN9ElemModelD2Ev(ptr noundef nonnull align 8 dereferenceable(184) %18) #6
  br label %141

141:                                              ; preds = %140
  %142 = load ptr, ptr %15, align 8
  %143 = load i32, ptr %16, align 4
  %144 = insertvalue { ptr, i32 } poison, ptr %142, 0
  %145 = insertvalue { ptr, i32 } %144, i32 %143, 1
  resume { ptr, i32 } %145
}

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

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

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

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN10CornerApexC2Ev(ptr noundef nonnull align 8 dereferenceable(144)) unnamed_addr #0 align 2

; Function Attrs: nobuiltin nounwind
declare void @_ZdaPvm(ptr noundef, i64 noundef) #5

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN9LayerApexC2Ev(ptr noundef nonnull align 8 dereferenceable(144)) unnamed_addr #0 align 2

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN10CornerApex20setCornerConnectionsEP4ApexP7Polygoni(ptr noundef nonnull align 8 dereferenceable(144), ptr noundef, ptr noundef, i32 noundef) #0 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN9LayerApex19setLayerConnectionsEP10CornerApexP7Polygoni(ptr noundef nonnull align 8 dereferenceable(144), ptr noundef, ptr noundef, i32 noundef) #2 align 2

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN9ElemModelD2Ev(ptr noundef nonnull align 8 dereferenceable(152)) 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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #4 = { 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 #5 = { 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 #6 = { nounwind }
attributes #7 = { builtin allocsize(0) }
attributes #8 = { 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 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"double", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"int", !7, i64 0}
!13 = !{!14, !14, i64 0}
!14 = !{!"vtable pointer", !8, i64 0}
!15 = !{!16, !12, i64 184}
!16 = !{!"_ZTS7Polygon", !17, i64 0, !12, i64 184, !21, i64 192, !6, i64 216, !6, i64 224, !25, i64 232, !7, i64 234, !10, i64 240}
!17 = !{!"_ZTS8VoidElem", !18, i64 0, !10, i64 152, !10, i64 160, !10, i64 168, !10, i64 176}
!18 = !{!"_ZTS9ElemModel", !10, i64 8, !10, i64 16, !6, i64 24, !6, i64 32, !10, i64 40, !6, i64 48, !19, i64 56, !19, i64 57, !19, i64 58, !19, i64 59, !12, i64 60, !10, i64 64, !10, i64 72, !10, i64 80, !10, i64 88, !10, i64 96, !10, i64 104, !10, i64 112, !20, i64 120, !20, i64 136}
!19 = !{!"bool", !7, i64 0}
!20 = !{!"_ZTSSt4pairIddE", !10, i64 0, !10, i64 8}
!21 = !{!"_ZTSSt6vectorIdSaIdEE", !22, i64 0}
!22 = !{!"_ZTSSt12_Vector_baseIdSaIdEE", !23, i64 0}
!23 = !{!"_ZTSNSt12_Vector_baseIdSaIdEE12_Vector_implE", !24, i64 0}
!24 = !{!"_ZTSNSt12_Vector_baseIdSaIdEE17_Vector_impl_dataE", !6, i64 0, !6, i64 8, !6, i64 16}
!25 = !{!"short", !7, i64 0}
!26 = !{!16, !7, i64 234}
!27 = !{!16, !25, i64 232}
!28 = !{!16, !10, i64 240}
!29 = !{!16, !6, i64 216}
!30 = !{!16, !6, i64 224}
!31 = distinct !{!31, !32}
!32 = !{!"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"

%class.CornerApex = type { %class.Apex, ptr, double, double, double, ptr }
%class.Apex = type { ptr, i8, double, double, ptr, i32, double, double, double, double, i8, i8, i8, i8, %"struct.std::pair.0" }
%"struct.std::pair.0" = type { i32, double }
%class.LayerApex = type { %class.Apex, i32, ptr, double, ptr, double }

@_ZN9ElemModel2PIE = external local_unnamed_addr constant double, align 8
@_ZTV7Polygon = external dso_local unnamed_addr constant { [32 x ptr] }, align 8

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN8VoidElemC2ER4ElemRK10CommonDataddi(ptr noundef nonnull align 8 dereferenceable(184), ptr noundef nonnull align 8 dereferenceable(408), ptr noundef nonnull align 8 dereferenceable(1972), double noundef, double noundef, i32 noundef) unnamed_addr #0 align 2

declare i32 @__gxx_personality_v0(...)

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN7PolygonC2ER4ElemRK10CommonDataddii(ptr noundef nonnull align 8 dereferenceable(248) %0, ptr noundef nonnull align 8 dereferenceable(408) %1, ptr noundef nonnull align 8 dereferenceable(1972) %2, double noundef %3, double noundef %4, i32 noundef %5, i32 noundef %6) unnamed_addr #0 align 2 personality ptr @__gxx_personality_v0 {
  tail call void @_ZN8VoidElemC2ER4ElemRK10CommonDataddi(ptr noundef nonnull align 8 dereferenceable(184) %0, ptr noundef nonnull align 8 dereferenceable(408) %1, ptr noundef nonnull align 8 dereferenceable(1972) %2, double noundef %3, double noundef %4, i32 noundef %6)
  store ptr getelementptr inbounds inrange(-16, 240) (i8, ptr @_ZTV7Polygon, i64 16), ptr %0, align 8, !tbaa !5
  %8 = getelementptr inbounds i8, ptr %0, i64 184
  store i32 %5, ptr %8, align 8, !tbaa !8
  %9 = getelementptr inbounds i8, ptr %0, i64 192
  tail call void @_ZNSt6vectorIdSaIdEEC2Ev(ptr noundef nonnull align 8 dereferenceable(24) %9) #5
  %10 = getelementptr inbounds i8, ptr %0, i64 234
  store i8 88, ptr %10, align 2, !tbaa !23
  %11 = getelementptr inbounds i8, ptr %0, i64 232
  store i16 0, ptr %11, align 8, !tbaa !24
  %12 = load double, ptr @_ZN9ElemModel2PIE, align 8, !tbaa !25
  %13 = fmul double %12, 5.000000e-01
  %14 = getelementptr inbounds i8, ptr %0, i64 240
  store double %13, ptr %14, align 8, !tbaa !26
  %15 = sext i32 %5 to i64
  %16 = tail call { i64, i1 } @llvm.umul.with.overflow.i64(i64 %15, i64 144)
  %17 = extractvalue { i64, i1 } %16, 1
  %18 = extractvalue { i64, i1 } %16, 0
  %19 = or disjoint i64 %18, 8
  %20 = select i1 %17, i64 -1, i64 %19
  %21 = invoke noalias noundef nonnull ptr @_Znam(i64 noundef %20) #6
          to label %22 unwind label %40

22:                                               ; preds = %7
  store i64 %15, ptr %21, align 16
  %.ptr27 = getelementptr inbounds i8, ptr %21, i64 8
  %23 = icmp eq i32 %5, 0
  br i1 %23, label %.loopexit45, label %24

24:                                               ; preds = %22
  %25 = getelementptr inbounds %class.CornerApex, ptr %.ptr27, i64 %15
  br label %26

26:                                               ; preds = %27, %24
  %.idx = phi i64 [ 8, %24 ], [ %.add, %27 ]
  %.ptr.ptr = getelementptr inbounds i8, ptr %21, i64 %.idx
  invoke void @_ZN10CornerApexC2Ev(ptr noundef nonnull align 8 dereferenceable(144) %.ptr.ptr)
          to label %27 unwind label %42

27:                                               ; preds = %26
  %.add = add nuw nsw i64 %.idx, 144
  %.ptr26 = getelementptr inbounds i8, ptr %21, i64 %.add
  %28 = icmp eq ptr %.ptr26, %25
  br i1 %28, label %.loopexit45, label %26

.loopexit45:                                      ; preds = %27, %22
  %29 = getelementptr inbounds i8, ptr %0, i64 216
  store ptr %.ptr27, ptr %29, align 8, !tbaa !27
  %30 = invoke noalias noundef nonnull ptr @_Znam(i64 noundef %20) #6
          to label %31 unwind label %40

31:                                               ; preds = %.loopexit45
  store i64 %15, ptr %30, align 16
  %.ptr35 = getelementptr inbounds i8, ptr %30, i64 8
  br i1 %23, label %.loopexit42.thread, label %33

.loopexit42.thread:                               ; preds = %31
  %32 = getelementptr inbounds i8, ptr %0, i64 224
  store ptr %.ptr35, ptr %32, align 8, !tbaa !28
  br label %._crit_edge

33:                                               ; preds = %31
  %34 = getelementptr inbounds %class.LayerApex, ptr %.ptr35, i64 %15
  br label %35

35:                                               ; preds = %36, %33
  %.idx32 = phi i64 [ 8, %33 ], [ %.add33, %36 ]
  %.ptr.ptr40 = getelementptr inbounds i8, ptr %30, i64 %.idx32
  invoke void @_ZN9LayerApexC2Ev(ptr noundef nonnull align 8 dereferenceable(144) %.ptr.ptr40)
          to label %36 unwind label %46

36:                                               ; preds = %35
  %.add33 = add nuw nsw i64 %.idx32, 144
  %.ptr34 = getelementptr inbounds i8, ptr %30, i64 %.add33
  %37 = icmp eq ptr %.ptr34, %34
  br i1 %37, label %.loopexit42, label %35

.loopexit42:                                      ; preds = %36
  %38 = getelementptr inbounds i8, ptr %0, i64 224
  store ptr %.ptr35, ptr %38, align 8, !tbaa !28
  %39 = icmp sgt i32 %5, 0
  br i1 %39, label %.lr.ph.preheader, label %._crit_edge

.lr.ph.preheader:                                 ; preds = %.loopexit42
  %wide.trip.count = zext nneg i32 %5 to i64
  br label %.lr.ph

._crit_edge:                                      ; preds = %55, %.loopexit42.thread, %.loopexit42
  ret void

40:                                               ; preds = %.loopexit45, %7
  %41 = landingpad { ptr, i32 }
          cleanup
  br label %62

42:                                               ; preds = %26
  %43 = landingpad { ptr, i32 }
          cleanup
  %44 = icmp eq i64 %.idx, 8
  br i1 %44, label %.loopexit44, label %.preheader43

.preheader43:                                     ; preds = %42, %.preheader43
  %.idx28 = phi i64 [ %.add29, %.preheader43 ], [ %.idx, %42 ]
  %.add29 = add nsw i64 %.idx28, -144
  %.ptr31 = getelementptr inbounds i8, ptr %21, i64 %.add29
  tail call void @_ZN4ApexD2Ev(ptr noundef nonnull align 8 dereferenceable(144) %.ptr31) #5
  %45 = icmp eq i64 %.add29, 8
  br i1 %45, label %.loopexit44, label %.preheader43

.loopexit44:                                      ; preds = %.preheader43, %42
  tail call void @_ZdaPvm(ptr noundef nonnull %21, i64 noundef %20) #7
  br label %62

46:                                               ; preds = %35
  %47 = landingpad { ptr, i32 }
          cleanup
  %48 = icmp eq i64 %.idx32, 8
  br i1 %48, label %.loopexit, label %.preheader

.preheader:                                       ; preds = %46, %.preheader
  %.idx36 = phi i64 [ %.add37, %.preheader ], [ %.idx32, %46 ]
  %.add37 = add nsw i64 %.idx36, -144
  %.ptr39 = getelementptr inbounds i8, ptr %30, i64 %.add37
  tail call void @_ZN4ApexD2Ev(ptr noundef nonnull align 8 dereferenceable(144) %.ptr39) #5
  %49 = icmp eq i64 %.add37, 8
  br i1 %49, label %.loopexit, label %.preheader

.loopexit:                                        ; preds = %.preheader, %46
  tail call void @_ZdaPvm(ptr noundef nonnull %30, i64 noundef %20) #7
  br label %62

.lr.ph:                                           ; preds = %.lr.ph.preheader, %55
  %indvars.iv = phi i64 [ 0, %.lr.ph.preheader ], [ %indvars.iv.next, %55 ]
  %50 = load ptr, ptr %29, align 8, !tbaa !27
  %51 = getelementptr inbounds %class.CornerApex, ptr %50, i64 %indvars.iv
  %52 = load ptr, ptr %38, align 8, !tbaa !28
  %53 = getelementptr inbounds %class.LayerApex, ptr %52, i64 %indvars.iv
  %54 = trunc nuw nsw i64 %indvars.iv to i32
  invoke void @_ZN10CornerApex20setCornerConnectionsEP4ApexP7Polygoni(ptr noundef nonnull align 8 dereferenceable(144) %51, ptr noundef %53, ptr noundef nonnull %0, i32 noundef %54)
          to label %55 unwind label %60

55:                                               ; preds = %.lr.ph
  %56 = load ptr, ptr %38, align 8, !tbaa !28
  %57 = getelementptr inbounds %class.LayerApex, ptr %56, i64 %indvars.iv
  %58 = load ptr, ptr %29, align 8, !tbaa !27
  %59 = getelementptr inbounds %class.CornerApex, ptr %58, i64 %indvars.iv
  tail call void @_ZN9LayerApex19setLayerConnectionsEP10CornerApexP7Polygoni(ptr noundef nonnull align 8 dereferenceable(144) %57, ptr noundef %59, ptr noundef nonnull %0, i32 noundef %54)
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
  br i1 %exitcond.not, label %._crit_edge, label %.lr.ph, !llvm.loop !29

60:                                               ; preds = %.lr.ph
  %61 = landingpad { ptr, i32 }
          cleanup
  br label %62

62:                                               ; preds = %60, %.loopexit, %.loopexit44, %40
  %.pn = phi { ptr, i32 } [ %61, %60 ], [ %47, %.loopexit ], [ %41, %40 ], [ %43, %.loopexit44 ]
  tail call void @_ZNSt6vectorIdSaIdEED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %9) #5
  tail call void @_ZN9ElemModelD2Ev(ptr noundef nonnull align 8 dereferenceable(184) %0) #5
  resume { ptr, i32 } %.pn
}

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

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

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN10CornerApexC2Ev(ptr noundef nonnull align 8 dereferenceable(144)) unnamed_addr #0 align 2

; Function Attrs: nobuiltin nounwind
declare void @_ZdaPvm(ptr noundef, i64 noundef) local_unnamed_addr #4

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN9LayerApexC2Ev(ptr noundef nonnull align 8 dereferenceable(144)) unnamed_addr #0 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN4ApexD2Ev(ptr noundef nonnull align 8 dereferenceable(104)) unnamed_addr #1 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN10CornerApex20setCornerConnectionsEP4ApexP7Polygoni(ptr noundef nonnull align 8 dereferenceable(144), ptr noundef, ptr noundef, i32 noundef) local_unnamed_addr #0 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN9LayerApex19setLayerConnectionsEP10CornerApexP7Polygoni(ptr noundef nonnull align 8 dereferenceable(144), ptr noundef, ptr noundef, i32 noundef) local_unnamed_addr #1 align 2

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN9ElemModelD2Ev(ptr noundef nonnull align 8 dereferenceable(152)) unnamed_addr #1 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 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 = { mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #3 = { 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 #4 = { 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 #5 = { nounwind }
attributes #6 = { builtin allocsize(0) }
attributes #7 = { 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 = !{!"vtable pointer", !7, i64 0}
!7 = !{!"Simple C++ TBAA"}
!8 = !{!9, !16, i64 184}
!9 = !{!"_ZTS7Polygon", !10, i64 0, !16, i64 184, !18, i64 192, !14, i64 216, !14, i64 224, !22, i64 232, !13, i64 234, !12, i64 240}
!10 = !{!"_ZTS8VoidElem", !11, i64 0, !12, i64 152, !12, i64 160, !12, i64 168, !12, i64 176}
!11 = !{!"_ZTS9ElemModel", !12, i64 8, !12, i64 16, !14, i64 24, !14, i64 32, !12, i64 40, !14, i64 48, !15, i64 56, !15, i64 57, !15, i64 58, !15, i64 59, !16, i64 60, !12, i64 64, !12, i64 72, !12, i64 80, !12, i64 88, !12, i64 96, !12, i64 104, !12, i64 112, !17, i64 120, !17, i64 136}
!12 = !{!"double", !13, i64 0}
!13 = !{!"omnipotent char", !7, i64 0}
!14 = !{!"any pointer", !13, i64 0}
!15 = !{!"bool", !13, i64 0}
!16 = !{!"int", !13, i64 0}
!17 = !{!"_ZTSSt4pairIddE", !12, i64 0, !12, i64 8}
!18 = !{!"_ZTSSt6vectorIdSaIdEE", !19, i64 0}
!19 = !{!"_ZTSSt12_Vector_baseIdSaIdEE", !20, i64 0}
!20 = !{!"_ZTSNSt12_Vector_baseIdSaIdEE12_Vector_implE", !21, i64 0}
!21 = !{!"_ZTSNSt12_Vector_baseIdSaIdEE17_Vector_impl_dataE", !14, i64 0, !14, i64 8, !14, i64 16}
!22 = !{!"short", !13, i64 0}
!23 = !{!9, !13, i64 234}
!24 = !{!9, !22, i64 232}
!25 = !{!12, !12, i64 0}
!26 = !{!9, !12, i64 240}
!27 = !{!9, !14, i64 216}
!28 = !{!9, !14, i64 224}
!29 = distinct !{!29, !30}
!30 = !{!"llvm.loop.mustprogress"}


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