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

; Unoptimized IR (clang -disable-llvm-passes):
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

%"struct.std::pair.36" = type <{ ptr, i32, [4 x i8] }>
%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.Polygon = type { %class.VoidElem, i32, %"class.std::vector.16", ptr, ptr, i16, i8, double }
%class.VoidElem = type { %class.ElemModel, double, double, 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 }

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

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

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN7Polygon31insertWatSnapEvent_IfSnapPcHgPcER6EventsIP4Apex9PceImbCmpEd(ptr noundef nonnull align 8 dereferenceable(248) %0, ptr noundef nonnull align 8 dereferenceable(32) %1, double noundef %2) #1 align 2 {
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca double, align 8
  %7 = alloca i32, align 4
  %8 = alloca %"struct.std::pair.36", align 8
  %9 = alloca ptr, align 8
  store ptr %0, ptr %4, align 8, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !5
  store double %2, ptr %6, align 8, !tbaa !9
  %10 = load ptr, ptr %4, align 8
  %11 = getelementptr inbounds %class.ElemModel, ptr %10, i32 0, i32 6
  %12 = load ptr, ptr %11, align 8, !tbaa !11
  %13 = getelementptr inbounds %class.ElemModel, ptr %10, i32 0, i32 4
  %14 = load ptr, ptr %13, align 8, !tbaa !16
  %15 = call noundef nonnull align 8 dereferenceable(80) ptr @_ZNK7GNMData3oilEv(ptr noundef nonnull align 8 dereferenceable(984) %14)
  %16 = icmp eq ptr %12, %15
  br i1 %16, label %17, label %46

17:                                               ; preds = %3
  %18 = getelementptr inbounds %class.Polygon, ptr %10, i32 0, i32 3
  %19 = load ptr, ptr %18, align 8, !tbaa !17
  %20 = getelementptr inbounds %class.CornerApex, ptr %19, i64 0
  %21 = call noundef zeroext i1 @_ZNK10CornerApex12cornerExistsEv(ptr noundef nonnull align 8 dereferenceable(144) %20)
  br i1 %21, label %22, label %45

22:                                               ; preds = %17
  %23 = getelementptr inbounds %class.Polygon, ptr %10, i32 0, i32 3
  %24 = load ptr, ptr %23, align 8, !tbaa !17
  %25 = getelementptr inbounds %class.CornerApex, ptr %24, i64 0
  %26 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNK10CornerApex13trappedCornerEv(ptr noundef nonnull align 8 dereferenceable(144) %25)
  %27 = getelementptr inbounds %"struct.std::pair.0", ptr %26, i32 0, i32 0
  %28 = load i32, ptr %27, align 8, !tbaa !25
  %29 = icmp slt i32 %28, 0
  br i1 %29, label %30, label %45

30:                                               ; preds = %22
  %31 = getelementptr inbounds %class.ElemModel, ptr %10, i32 0, i32 3
  %32 = load ptr, ptr %31, align 8, !tbaa !27
  %33 = call noundef zeroext i1 @_ZNK4Elem12isTrappedOilEv(ptr noundef nonnull align 8 dereferenceable(408) %32)
  br i1 %33, label %45, label %34

34:                                               ; preds = %30
  %35 = getelementptr inbounds %class.ElemModel, ptr %10, i32 0, i32 3
  %36 = load ptr, ptr %35, align 8, !tbaa !27
  %37 = call noundef double @_ZNK4Apex7entryPcEv(ptr noundef nonnull align 8 dereferenceable(104) %36)
  %38 = load double, ptr %6, align 8, !tbaa !9
  %39 = fcmp ogt double %37, %38
  br i1 %39, label %40, label %44

40:                                               ; preds = %34
  %41 = load ptr, ptr %5, align 8, !tbaa !5
  %42 = getelementptr inbounds %class.ElemModel, ptr %10, i32 0, i32 3
  %43 = load ptr, ptr %42, align 8, !tbaa !27
  call void @_ZN10EventsBaseIP4ApexE11quickInsertES1_(ptr noundef nonnull align 8 dereferenceable(32) %41, ptr noundef %43)
  br label %44

44:                                               ; preds = %40, %34
  br label %45

45:                                               ; preds = %44, %30, %22, %17
  br label %111

46:                                               ; preds = %3
  %47 = getelementptr inbounds %class.Polygon, ptr %10, i32 0, i32 4
  %48 = load ptr, ptr %47, align 8, !tbaa !28
  %49 = getelementptr inbounds %class.LayerApex, ptr %48, i64 0
  %50 = call noundef zeroext i1 @_ZNK4Apex6existsEv(ptr noundef nonnull align 8 dereferenceable(104) %49)
  br i1 %50, label %51, label %110

51:                                               ; preds = %46
  %52 = getelementptr inbounds %class.Polygon, ptr %10, i32 0, i32 4
  %53 = load ptr, ptr %52, align 8, !tbaa !28
  %54 = getelementptr inbounds %class.LayerApex, ptr %53, i64 0
  %55 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNK9LayerApex13trappedOLayerEv(ptr noundef nonnull align 8 dereferenceable(144) %54)
  %56 = getelementptr inbounds %"struct.std::pair.0", ptr %55, i32 0, i32 0
  %57 = load i32, ptr %56, align 8, !tbaa !25
  %58 = icmp slt i32 %57, 0
  br i1 %58, label %59, label %110

59:                                               ; preds = %51
  %60 = getelementptr inbounds %class.Polygon, ptr %10, i32 0, i32 3
  %61 = load ptr, ptr %60, align 8, !tbaa !17
  %62 = getelementptr inbounds %class.CornerApex, ptr %61, i64 0
  %63 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNK10CornerApex13trappedCornerEv(ptr noundef nonnull align 8 dereferenceable(144) %62)
  %64 = getelementptr inbounds %"struct.std::pair.0", ptr %63, i32 0, i32 0
  %65 = load i32, ptr %64, align 8, !tbaa !25
  %66 = icmp slt i32 %65, 0
  br i1 %66, label %74, label %67

67:                                               ; preds = %59
  %68 = getelementptr inbounds %class.ElemModel, ptr %10, i32 0, i32 3
  %69 = load ptr, ptr %68, align 8, !tbaa !27
  %70 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNK4Elem15trappingWatBulkEv(ptr noundef nonnull align 8 dereferenceable(408) %69)
  %71 = getelementptr inbounds %"struct.std::pair.0", ptr %70, i32 0, i32 0
  %72 = load i32, ptr %71, align 8, !tbaa !25
  %73 = icmp slt i32 %72, 0
  br i1 %73, label %74, label %110

74:                                               ; preds = %67, %59
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #3
  store i32 0, ptr %7, align 4, !tbaa !29
  br label %75

75:                                               ; preds = %106, %74
  %76 = load i32, ptr %7, align 4, !tbaa !29
  %77 = getelementptr inbounds %class.Polygon, ptr %10, i32 0, i32 1
  %78 = load i32, ptr %77, align 8, !tbaa !30
  %79 = icmp slt i32 %76, %78
  br i1 %79, label %81, label %80

80:                                               ; preds = %75
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #3
  br label %109

81:                                               ; preds = %75
  %82 = getelementptr inbounds %class.Polygon, ptr %10, i32 0, i32 4
  %83 = load ptr, ptr %82, align 8, !tbaa !28
  %84 = load i32, ptr %7, align 4, !tbaa !29
  %85 = sext i32 %84 to i64
  %86 = getelementptr inbounds %class.LayerApex, ptr %83, i64 %85
  %87 = call noundef zeroext i1 @_ZNK4Apex6existsEv(ptr noundef nonnull align 8 dereferenceable(104) %86)
  br i1 %87, label %88, label %105

88:                                               ; preds = %81
  %89 = getelementptr inbounds %class.Polygon, ptr %10, i32 0, i32 4
  %90 = load ptr, ptr %89, align 8, !tbaa !28
  %91 = load i32, ptr %7, align 4, !tbaa !29
  %92 = sext i32 %91 to i64
  %93 = getelementptr inbounds %class.LayerApex, ptr %90, i64 %92
  %94 = call noundef double @_ZNK9LayerApex11layerCollPcEv(ptr noundef nonnull align 8 dereferenceable(144) %93)
  %95 = load double, ptr %6, align 8, !tbaa !9
  %96 = fcmp ogt double %94, %95
  br i1 %96, label %97, label %104

97:                                               ; preds = %88
  call void @llvm.lifetime.start.p0(i64 16, ptr %8) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #3
  store ptr %10, ptr %9, align 8, !tbaa !5
  call void @_ZNSt4pairIP7PolygoniEC2IS1_RiTnNSt9enable_ifIXaaclsr5_PCCPE22_MoveConstructiblePairIT_T0_EEclsr5_PCCPE30_ImplicitlyMoveConvertiblePairIS6_S7_EEEbE4typeELb1EEEOS6_OS7_(ptr noundef nonnull align 8 dereferenceable(12) %8, ptr noundef nonnull align 8 dereferenceable(8) %9, ptr noundef nonnull align 4 dereferenceable(4) %7)
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #3
  %98 = load ptr, ptr %5, align 8, !tbaa !5
  %99 = getelementptr inbounds %class.Polygon, ptr %10, i32 0, i32 4
  %100 = load ptr, ptr %99, align 8, !tbaa !28
  %101 = load i32, ptr %7, align 4, !tbaa !29
  %102 = sext i32 %101 to i64
  %103 = getelementptr inbounds %class.LayerApex, ptr %100, i64 %102
  call void @_ZN10EventsBaseIP4ApexE11quickInsertES1_(ptr noundef nonnull align 8 dereferenceable(32) %98, ptr noundef %103)
  call void @llvm.lifetime.end.p0(i64 16, ptr %8) #3
  br label %104

104:                                              ; preds = %97, %88
  br label %105

105:                                              ; preds = %104, %81
  br label %106

106:                                              ; preds = %105
  %107 = load i32, ptr %7, align 4, !tbaa !29
  %108 = add nsw i32 %107, 1
  store i32 %108, ptr %7, align 4, !tbaa !29
  br label %75, !llvm.loop !31

109:                                              ; preds = %80
  br label %110

110:                                              ; preds = %109, %67, %51, %46
  br label %111

111:                                              ; preds = %110, %45
  ret void
}

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(80) ptr @_ZNK7GNMData3oilEv(ptr noundef nonnull align 8 dereferenceable(984)) #2 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZNK10CornerApex12cornerExistsEv(ptr noundef nonnull align 8 dereferenceable(144)) #2 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(16) ptr @_ZNK10CornerApex13trappedCornerEv(ptr noundef nonnull align 8 dereferenceable(144)) #2 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZNK4Elem12isTrappedOilEv(ptr noundef nonnull align 8 dereferenceable(408)) #2 align 2

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN10EventsBaseIP4ApexE11quickInsertES1_(ptr noundef nonnull align 8 dereferenceable(32), ptr noundef) #1 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZNK4Apex6existsEv(ptr noundef nonnull align 8 dereferenceable(104)) #2 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(16) ptr @_ZNK9LayerApex13trappedOLayerEv(ptr noundef nonnull align 8 dereferenceable(144)) #2 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(16) ptr @_ZNK4Elem15trappingWatBulkEv(ptr noundef nonnull align 8 dereferenceable(408)) #2 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef double @_ZNK9LayerApex11layerCollPcEv(ptr noundef nonnull align 8 dereferenceable(144)) #2 align 2

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

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { 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 = { 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, !6, i64 48}
!12 = !{!"_ZTS9ElemModel", !10, i64 8, !10, i64 16, !6, i64 24, !6, i64 32, !10, i64 40, !6, i64 48, !13, i64 56, !13, i64 57, !13, i64 58, !13, i64 59, !14, i64 60, !10, i64 64, !10, i64 72, !10, i64 80, !10, i64 88, !10, i64 96, !10, i64 104, !10, i64 112, !15, i64 120, !15, i64 136}
!13 = !{!"bool", !7, i64 0}
!14 = !{!"int", !7, i64 0}
!15 = !{!"_ZTSSt4pairIddE", !10, i64 0, !10, i64 8}
!16 = !{!12, !6, i64 32}
!17 = !{!18, !6, i64 216}
!18 = !{!"_ZTS7Polygon", !19, i64 0, !14, i64 184, !20, i64 192, !6, i64 216, !6, i64 224, !24, i64 232, !7, i64 234, !10, i64 240}
!19 = !{!"_ZTS8VoidElem", !12, i64 0, !10, i64 152, !10, i64 160, !10, i64 168, !10, i64 176}
!20 = !{!"_ZTSSt6vectorIdSaIdEE", !21, i64 0}
!21 = !{!"_ZTSSt12_Vector_baseIdSaIdEE", !22, i64 0}
!22 = !{!"_ZTSNSt12_Vector_baseIdSaIdEE12_Vector_implE", !23, i64 0}
!23 = !{!"_ZTSNSt12_Vector_baseIdSaIdEE17_Vector_impl_dataE", !6, i64 0, !6, i64 8, !6, i64 16}
!24 = !{!"short", !7, i64 0}
!25 = !{!26, !14, i64 0}
!26 = !{!"_ZTSSt4pairIidE", !14, i64 0, !10, i64 8}
!27 = !{!12, !6, i64 24}
!28 = !{!18, !6, i64 224}
!29 = !{!14, !14, i64 0}
!30 = !{!18, !14, i64 184}
!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"

%"struct.std::pair.36" = type <{ ptr, i32, [4 x i8] }>
%class.LayerApex = type { %class.Apex, i32, ptr, double, ptr, double }
%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 }

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

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

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN7Polygon31insertWatSnapEvent_IfSnapPcHgPcER6EventsIP4Apex9PceImbCmpEd(ptr noundef nonnull align 8 dereferenceable(248) %0, ptr noundef nonnull align 8 dereferenceable(32) %1, double noundef %2) local_unnamed_addr #1 align 2 {
  %4 = alloca i32, align 4
  %5 = alloca %"struct.std::pair.36", align 8
  %6 = alloca ptr, align 8
  %7 = getelementptr inbounds i8, ptr %0, i64 48
  %8 = load ptr, ptr %7, align 8, !tbaa !5
  %9 = getelementptr inbounds i8, ptr %0, i64 32
  %10 = load ptr, ptr %9, align 8, !tbaa !14
  %11 = tail call noundef nonnull align 8 dereferenceable(80) ptr @_ZNK7GNMData3oilEv(ptr noundef nonnull align 8 dereferenceable(984) %10)
  %12 = icmp eq ptr %8, %11
  br i1 %12, label %13, label %32

13:                                               ; preds = %3
  %14 = getelementptr inbounds i8, ptr %0, i64 216
  %15 = load ptr, ptr %14, align 8, !tbaa !15
  %16 = tail call noundef zeroext i1 @_ZNK10CornerApex12cornerExistsEv(ptr noundef nonnull align 8 dereferenceable(144) %15)
  br i1 %16, label %17, label %78

17:                                               ; preds = %13
  %18 = load ptr, ptr %14, align 8, !tbaa !15
  %19 = tail call noundef nonnull align 8 dereferenceable(16) ptr @_ZNK10CornerApex13trappedCornerEv(ptr noundef nonnull align 8 dereferenceable(144) %18)
  %20 = load i32, ptr %19, align 8, !tbaa !23
  %21 = icmp slt i32 %20, 0
  br i1 %21, label %22, label %78

22:                                               ; preds = %17
  %23 = getelementptr inbounds i8, ptr %0, i64 24
  %24 = load ptr, ptr %23, align 8, !tbaa !25
  %25 = tail call noundef zeroext i1 @_ZNK4Elem12isTrappedOilEv(ptr noundef nonnull align 8 dereferenceable(408) %24)
  br i1 %25, label %78, label %26

26:                                               ; preds = %22
  %27 = load ptr, ptr %23, align 8, !tbaa !25
  %28 = tail call noundef double @_ZNK4Apex7entryPcEv(ptr noundef nonnull align 8 dereferenceable(104) %27)
  %29 = fcmp ogt double %28, %2
  br i1 %29, label %30, label %78

30:                                               ; preds = %26
  %31 = load ptr, ptr %23, align 8, !tbaa !25
  tail call void @_ZN10EventsBaseIP4ApexE11quickInsertES1_(ptr noundef nonnull align 8 dereferenceable(32) %1, ptr noundef %31)
  br label %78

32:                                               ; preds = %3
  %33 = getelementptr inbounds i8, ptr %0, i64 224
  %34 = load ptr, ptr %33, align 8, !tbaa !26
  %35 = tail call noundef zeroext i1 @_ZNK4Apex6existsEv(ptr noundef nonnull align 8 dereferenceable(104) %34)
  br i1 %35, label %36, label %78

36:                                               ; preds = %32
  %37 = load ptr, ptr %33, align 8, !tbaa !26
  %38 = tail call noundef nonnull align 8 dereferenceable(16) ptr @_ZNK9LayerApex13trappedOLayerEv(ptr noundef nonnull align 8 dereferenceable(144) %37)
  %39 = load i32, ptr %38, align 8, !tbaa !23
  %40 = icmp slt i32 %39, 0
  br i1 %40, label %41, label %78

41:                                               ; preds = %36
  %42 = getelementptr inbounds i8, ptr %0, i64 216
  %43 = load ptr, ptr %42, align 8, !tbaa !15
  %44 = tail call noundef nonnull align 8 dereferenceable(16) ptr @_ZNK10CornerApex13trappedCornerEv(ptr noundef nonnull align 8 dereferenceable(144) %43)
  %45 = load i32, ptr %44, align 8, !tbaa !23
  %46 = icmp slt i32 %45, 0
  br i1 %46, label %53, label %47

47:                                               ; preds = %41
  %48 = getelementptr inbounds i8, ptr %0, i64 24
  %49 = load ptr, ptr %48, align 8, !tbaa !25
  %50 = tail call noundef nonnull align 8 dereferenceable(16) ptr @_ZNK4Elem15trappingWatBulkEv(ptr noundef nonnull align 8 dereferenceable(408) %49)
  %51 = load i32, ptr %50, align 8, !tbaa !23
  %52 = icmp slt i32 %51, 0
  br i1 %52, label %53, label %78

53:                                               ; preds = %47, %41
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %4) #3
  %54 = getelementptr inbounds i8, ptr %0, i64 184
  store i32 0, ptr %4, align 4, !tbaa !27
  %55 = load i32, ptr %54, align 8, !tbaa !28
  %56 = icmp sgt i32 %55, 0
  br i1 %56, label %.lr.ph, label %._crit_edge

._crit_edge:                                      ; preds = %73, %53
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %4) #3
  br label %78

.lr.ph:                                           ; preds = %53, %73
  %storemerge5 = phi i32 [ %75, %73 ], [ 0, %53 ]
  %57 = load ptr, ptr %33, align 8, !tbaa !26
  %58 = sext i32 %storemerge5 to i64
  %59 = getelementptr inbounds %class.LayerApex, ptr %57, i64 %58
  %60 = call noundef zeroext i1 @_ZNK4Apex6existsEv(ptr noundef nonnull align 8 dereferenceable(104) %59)
  br i1 %60, label %61, label %73

61:                                               ; preds = %.lr.ph
  %62 = load ptr, ptr %33, align 8, !tbaa !26
  %63 = load i32, ptr %4, align 4, !tbaa !27
  %64 = sext i32 %63 to i64
  %65 = getelementptr inbounds %class.LayerApex, ptr %62, i64 %64
  %66 = call noundef double @_ZNK9LayerApex11layerCollPcEv(ptr noundef nonnull align 8 dereferenceable(144) %65)
  %67 = fcmp ogt double %66, %2
  br i1 %67, label %68, label %73

68:                                               ; preds = %61
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %5) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %6) #3
  store ptr %0, ptr %6, align 8, !tbaa !29
  call void @_ZNSt4pairIP7PolygoniEC2IS1_RiTnNSt9enable_ifIXaaclsr5_PCCPE22_MoveConstructiblePairIT_T0_EEclsr5_PCCPE30_ImplicitlyMoveConvertiblePairIS6_S7_EEEbE4typeELb1EEEOS6_OS7_(ptr noundef nonnull align 8 dereferenceable(12) %5, ptr noundef nonnull align 8 dereferenceable(8) %6, ptr noundef nonnull align 4 dereferenceable(4) %4)
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %6) #3
  %69 = load ptr, ptr %33, align 8, !tbaa !26
  %70 = load i32, ptr %4, align 4, !tbaa !27
  %71 = sext i32 %70 to i64
  %72 = getelementptr inbounds %class.LayerApex, ptr %69, i64 %71
  call void @_ZN10EventsBaseIP4ApexE11quickInsertES1_(ptr noundef nonnull align 8 dereferenceable(32) %1, ptr noundef %72)
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %5) #3
  br label %73

73:                                               ; preds = %.lr.ph, %68, %61
  %74 = load i32, ptr %4, align 4, !tbaa !27
  %75 = add nsw i32 %74, 1
  store i32 %75, ptr %4, align 4, !tbaa !27
  %76 = load i32, ptr %54, align 8, !tbaa !28
  %77 = icmp slt i32 %75, %76
  br i1 %77, label %.lr.ph, label %._crit_edge, !llvm.loop !30

78:                                               ; preds = %32, %36, %47, %._crit_edge, %13, %17, %22, %30, %26
  ret void
}

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(80) ptr @_ZNK7GNMData3oilEv(ptr noundef nonnull align 8 dereferenceable(984)) local_unnamed_addr #2 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZNK10CornerApex12cornerExistsEv(ptr noundef nonnull align 8 dereferenceable(144)) local_unnamed_addr #2 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(16) ptr @_ZNK10CornerApex13trappedCornerEv(ptr noundef nonnull align 8 dereferenceable(144)) local_unnamed_addr #2 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZNK4Elem12isTrappedOilEv(ptr noundef nonnull align 8 dereferenceable(408)) local_unnamed_addr #2 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef double @_ZNK4Apex7entryPcEv(ptr noundef nonnull align 8 dereferenceable(104)) local_unnamed_addr #2 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN10EventsBaseIP4ApexE11quickInsertES1_(ptr noundef nonnull align 8 dereferenceable(32), ptr noundef) local_unnamed_addr #1 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZNK4Apex6existsEv(ptr noundef nonnull align 8 dereferenceable(104)) local_unnamed_addr #2 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(16) ptr @_ZNK9LayerApex13trappedOLayerEv(ptr noundef nonnull align 8 dereferenceable(144)) local_unnamed_addr #2 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(16) ptr @_ZNK4Elem15trappingWatBulkEv(ptr noundef nonnull align 8 dereferenceable(408)) local_unnamed_addr #2 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef double @_ZNK9LayerApex11layerCollPcEv(ptr noundef nonnull align 8 dereferenceable(144)) local_unnamed_addr #2 align 2

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

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { 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, !10, i64 48}
!6 = !{!"_ZTS9ElemModel", !7, i64 8, !7, i64 16, !10, i64 24, !10, i64 32, !7, i64 40, !10, i64 48, !11, i64 56, !11, i64 57, !11, i64 58, !11, i64 59, !12, i64 60, !7, i64 64, !7, i64 72, !7, i64 80, !7, i64 88, !7, i64 96, !7, i64 104, !7, i64 112, !13, i64 120, !13, i64 136}
!7 = !{!"double", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!"any pointer", !8, i64 0}
!11 = !{!"bool", !8, i64 0}
!12 = !{!"int", !8, i64 0}
!13 = !{!"_ZTSSt4pairIddE", !7, i64 0, !7, i64 8}
!14 = !{!6, !10, i64 32}
!15 = !{!16, !10, i64 216}
!16 = !{!"_ZTS7Polygon", !17, i64 0, !12, i64 184, !18, i64 192, !10, i64 216, !10, i64 224, !22, i64 232, !8, i64 234, !7, i64 240}
!17 = !{!"_ZTS8VoidElem", !6, i64 0, !7, i64 152, !7, i64 160, !7, i64 168, !7, i64 176}
!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", !10, i64 0, !10, i64 8, !10, i64 16}
!22 = !{!"short", !8, i64 0}
!23 = !{!24, !12, i64 0}
!24 = !{!"_ZTSSt4pairIidE", !12, i64 0, !7, i64 8}
!25 = !{!6, !10, i64 24}
!26 = !{!16, !10, i64 224}
!27 = !{!12, !12, i64 0}
!28 = !{!16, !12, i64 184}
!29 = !{!10, !10, i64 0}
!30 = distinct !{!30, !31}
!31 = !{!"llvm.loop.mustprogress"}


; Effective O3 passes: EarlyCSEPass,GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LICMPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,SROAPass,SimplifyCFGPass,TailCallElimPass