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

; 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.var3 = type { double, double, double }
%class.InOutBoundary = type { %class.Pore, %"class.std::vector.29" }
%class.Pore = type { %class.Elem }
%class.Elem = type { %class.Apex, [5 x %class.SlvrElm], i8, i32, ptr, double, double, i32, %"class.std::vector", ptr, double, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, %"struct.std::pair", %"struct.std::pair", %"struct.std::pair", i32, i32, i32, i32, %class.var3 }
%class.Apex = type { ptr, i8, double, double, ptr, i32, double, double, double, double, i8, i8, i8, i8, %"struct.std::pair" }
%class.SlvrElm = type { i8, i8, i8, double, double }
%"class.std::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<Elem *, std::allocator<Elem *>>::_Vector_impl" }
%"struct.std::_Vector_base<Elem *, std::allocator<Elem *>>::_Vector_impl" = type { %"struct.std::_Vector_base<Elem *, std::allocator<Elem *>>::_Vector_impl_data" }
%"struct.std::_Vector_base<Elem *, std::allocator<Elem *>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"struct.std::pair" = type { i32, double }
%"class.std::vector.29" = type { %"struct.std::_Vector_base.30" }
%"struct.std::_Vector_base.30" = type { %"struct.std::_Vector_base<Pore *, std::allocator<Pore *>>::_Vector_impl" }
%"struct.std::_Vector_base<Pore *, std::allocator<Pore *>>::_Vector_impl" = type { %"struct.std::_Vector_base<Pore *, std::allocator<Pore *>>::_Vector_impl_data" }
%"struct.std::_Vector_base<Pore *, std::allocator<Pore *>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%class.LayerApex = type { %class.Apex, i32, ptr, double, ptr, double }

@_ZTV13InOutBoundary = external dso_local unnamed_addr constant { [16 x ptr] }, align 8
@_ZTI9ElemModel = external dso_local constant { ptr, ptr }, align 8
@_ZTI7Polygon = external constant ptr

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN4PoreC2ERK10CommonDatai4var3IdEddddbbdRSt6vectorIP4ElemSaIS7_EEi(ptr noundef nonnull align 8 dereferenceable(408), ptr noundef nonnull align 8 dereferenceable(1972), i32 noundef, ptr noundef byval(%class.var3) align 8, double noundef, double noundef, double noundef, double noundef, i1 noundef zeroext, i1 noundef zeroext, double noundef, ptr noundef nonnull align 8 dereferenceable(24), i32 noundef) unnamed_addr #0 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) #1

declare i32 @__gxx_personality_v0(...)

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN13InOutBoundaryC2ERK10CommonDatai4var3IdERSt6vectorIP4ElemSaIS7_EE(ptr noundef nonnull align 8 dereferenceable(432) %0, ptr noundef nonnull align 8 dereferenceable(1972) %1, i32 noundef %2, ptr noundef byval(%class.var3) align 8 %3, ptr noundef nonnull align 8 dereferenceable(24) %4) unnamed_addr #0 align 2 personality ptr @__gxx_personality_v0 {
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca i32, align 4
  %9 = alloca ptr, align 8
  %10 = alloca %class.var3, align 8
  %11 = alloca ptr, align 8
  %12 = alloca i32, align 4
  %13 = alloca ptr, align 8
  %14 = alloca i32, align 4
  store ptr %0, ptr %6, align 8, !tbaa !5
  store ptr %1, ptr %7, align 8, !tbaa !5
  store i32 %2, ptr %8, align 4, !tbaa !9
  store ptr %4, ptr %9, align 8, !tbaa !5
  %15 = load ptr, ptr %6, align 8
  %16 = load ptr, ptr %7, align 8, !tbaa !5
  %17 = load i32, ptr %8, align 4, !tbaa !9
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %10, ptr align 8 %3, i64 24, i1 false), !tbaa.struct !11
  %18 = call double @sqrt(double noundef 3.000000e+00) #6
  %19 = fdiv double %18, 3.600000e+01
  %20 = load i32, ptr %8, align 4, !tbaa !9
  %21 = icmp sgt i32 %20, 1
  %22 = zext i1 %21 to i32
  %23 = sitofp i32 %22 to double
  %24 = fadd double %19, %23
  %25 = load ptr, ptr %9, align 8, !tbaa !5
  call void @_ZN4PoreC2ERK10CommonDatai4var3IdEddddbbdRSt6vectorIP4ElemSaIS7_EEi(ptr noundef nonnull align 8 dereferenceable(408) %15, ptr noundef nonnull align 8 dereferenceable(1972) %16, i32 noundef %17, ptr noundef byval(%class.var3) align 8 %10, double noundef 0x3D719799812DEA11, double noundef 0.000000e+00, double noundef 0.000000e+00, double noundef %24, i1 noundef zeroext false, i1 noundef zeroext false, double noundef 0.000000e+00, ptr noundef nonnull align 8 dereferenceable(24) %25, i32 noundef 0)
  store ptr getelementptr inbounds inrange(-16, 112) ({ [16 x ptr] }, ptr @_ZTV13InOutBoundary, i32 0, i32 0, i32 2), ptr %15, align 8, !tbaa !14
  %26 = getelementptr inbounds %class.InOutBoundary, ptr %15, i32 0, i32 1
  call void @_ZNSt6vectorIP4PoreSaIS1_EEC2Ev(ptr noundef nonnull align 8 dereferenceable(24) %26) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #6
  %27 = getelementptr inbounds %class.Elem, ptr %15, i32 0, i32 9
  %28 = load ptr, ptr %27, align 8, !tbaa !16
  %29 = icmp eq ptr %28, null
  br i1 %29, label %32, label %30

30:                                               ; preds = %5
  %31 = call ptr @__dynamic_cast(ptr %28, ptr @_ZTI9ElemModel, ptr @_ZTI7Polygon, i64 0) #6
  br label %33

32:                                               ; preds = %5
  br label %33

33:                                               ; preds = %32, %30
  %34 = phi ptr [ %31, %30 ], [ null, %32 ]
  store ptr %34, ptr %11, align 8, !tbaa !5
  %35 = load ptr, ptr %11, align 8, !tbaa !5
  %36 = icmp ne ptr %35, null
  br i1 %36, label %37, label %71

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

38:                                               ; preds = %67, %37
  %39 = load i32, ptr %12, align 4, !tbaa !9
  %40 = load ptr, ptr %11, align 8, !tbaa !5
  %41 = load ptr, ptr %40, align 8, !tbaa !14
  %42 = getelementptr inbounds ptr, ptr %41, i64 24
  %43 = load ptr, ptr %42, align 8
  %44 = invoke noundef i32 %43(ptr noundef nonnull align 8 dereferenceable(248) %40)
          to label %45 unwind label %48

45:                                               ; preds = %38
  %46 = icmp slt i32 %39, %44
  br i1 %46, label %52, label %47

47:                                               ; preds = %45
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #6
  br label %70

48:                                               ; preds = %62, %59, %55, %52, %38
  %49 = landingpad { ptr, i32 }
          cleanup
  %50 = extractvalue { ptr, i32 } %49, 0
  store ptr %50, ptr %13, align 8
  %51 = extractvalue { ptr, i32 } %49, 1
  store i32 %51, ptr %14, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #6
  br label %102

52:                                               ; preds = %45
  %53 = load ptr, ptr %11, align 8, !tbaa !5
  %54 = invoke noundef ptr @_ZN7Polygon10oilLayerChEv(ptr noundef nonnull align 8 dereferenceable(248) %53)
          to label %55 unwind label %48

55:                                               ; preds = %52
  %56 = load i32, ptr %12, align 4, !tbaa !9
  %57 = sext i32 %56 to i64
  %58 = getelementptr inbounds %class.LayerApex, ptr %54, i64 %57
  invoke void @_ZN4Apex16setInWatFloodVecEb(ptr noundef nonnull align 8 dereferenceable(104) %58, i1 noundef zeroext true)
          to label %59 unwind label %48

59:                                               ; preds = %55
  %60 = load ptr, ptr %11, align 8, !tbaa !5
  %61 = invoke noundef ptr @_ZN7Polygon10oilLayerChEv(ptr noundef nonnull align 8 dereferenceable(248) %60)
          to label %62 unwind label %48

62:                                               ; preds = %59
  %63 = load i32, ptr %12, align 4, !tbaa !9
  %64 = sext i32 %63 to i64
  %65 = getelementptr inbounds %class.LayerApex, ptr %61, i64 %64
  invoke void @_ZN4Apex16setInOilFloodVecEb(ptr noundef nonnull align 8 dereferenceable(104) %65, i1 noundef zeroext true)
          to label %66 unwind label %48

66:                                               ; preds = %62
  br label %67

67:                                               ; preds = %66
  %68 = load i32, ptr %12, align 4, !tbaa !9
  %69 = add nsw i32 %68, 1
  store i32 %69, ptr %12, align 4, !tbaa !9
  br label %38, !llvm.loop !26

70:                                               ; preds = %47
  br label %71

71:                                               ; preds = %70, %33
  %72 = getelementptr inbounds %class.Elem, ptr %15, i32 0, i32 10
  store double 5.000000e-01, ptr %72, align 8, !tbaa !28
  %73 = load i32, ptr %8, align 4, !tbaa !9
  %74 = icmp eq i32 %73, 1
  %75 = getelementptr inbounds %class.Elem, ptr %15, i32 0, i32 16
  %76 = zext i1 %74 to i8
  store i8 %76, ptr %75, align 1, !tbaa !29
  %77 = load i32, ptr %8, align 4, !tbaa !9
  %78 = icmp eq i32 %77, 0
  %79 = getelementptr inbounds %class.Elem, ptr %15, i32 0, i32 15
  %80 = zext i1 %78 to i8
  store i8 %80, ptr %79, align 4, !tbaa !30
  %81 = getelementptr inbounds %class.Elem, ptr %15, i32 0, i32 16
  %82 = load i8, ptr %81, align 1, !tbaa !29, !range !31, !noundef !32
  %83 = trunc i8 %82 to i1
  %84 = getelementptr inbounds %class.Elem, ptr %15, i32 0, i32 18
  %85 = zext i1 %83 to i8
  store i8 %85, ptr %84, align 1, !tbaa !33
  %86 = getelementptr inbounds %class.Elem, ptr %15, i32 0, i32 15
  %87 = load i8, ptr %86, align 4, !tbaa !30, !range !31, !noundef !32
  %88 = trunc i8 %87 to i1
  %89 = getelementptr inbounds %class.Elem, ptr %15, i32 0, i32 19
  %90 = zext i1 %88 to i8
  store i8 %90, ptr %89, align 8, !tbaa !34
  %91 = getelementptr inbounds %class.Elem, ptr %15, i32 0, i32 17
  store i8 0, ptr %91, align 2, !tbaa !35
  %92 = getelementptr inbounds %class.Elem, ptr %15, i32 0, i32 9
  %93 = load ptr, ptr %92, align 8, !tbaa !16
  %94 = load ptr, ptr %93, align 8, !tbaa !14
  %95 = getelementptr inbounds ptr, ptr %94, i64 14
  %96 = load ptr, ptr %95, align 8
  invoke void %96(ptr noundef nonnull align 8 dereferenceable(152) %93, double noundef 0.000000e+00, i32 noundef 2, double noundef 1.800000e+02)
          to label %97 unwind label %98

97:                                               ; preds = %71
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #6
  ret void

98:                                               ; preds = %71
  %99 = landingpad { ptr, i32 }
          cleanup
  %100 = extractvalue { ptr, i32 } %99, 0
  store ptr %100, ptr %13, align 8
  %101 = extractvalue { ptr, i32 } %99, 1
  store i32 %101, ptr %14, align 4
  br label %102

102:                                              ; preds = %98, %48
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #6
  call void @_ZNSt6vectorIP4PoreSaIS1_EED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %26) #6
  call void @_ZN4ElemD2Ev(ptr noundef nonnull align 8 dereferenceable(408) %15) #6
  br label %103

103:                                              ; preds = %102
  %104 = load ptr, ptr %13, align 8
  %105 = load i32, ptr %14, align 4
  %106 = insertvalue { ptr, i32 } poison, ptr %104, 0
  %107 = insertvalue { ptr, i32 } %106, i32 %105, 1
  resume { ptr, i32 } %107
}

; Function Attrs: nounwind
declare double @sqrt(double noundef) #2

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

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

; Function Attrs: nounwind willreturn memory(read)
declare ptr @__dynamic_cast(ptr, ptr, ptr, i64) #5

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef ptr @_ZN7Polygon10oilLayerChEv(ptr noundef nonnull align 8 dereferenceable(248)) #3 align 2

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

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

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

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

; Function Attrs: nounwind
declare void @_ZN4ElemD2Ev(ptr noundef nonnull align 8 dereferenceable(408)) unnamed_addr #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 nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { 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 #3 = { mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #5 = { nounwind willreturn memory(read) }
attributes #6 = { 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 = !{!"int", !7, i64 0}
!11 = !{i64 0, i64 8, !12, i64 8, i64 8, !12, i64 16, i64 8, !12}
!12 = !{!13, !13, i64 0}
!13 = !{!"double", !7, i64 0}
!14 = !{!15, !15, i64 0}
!15 = !{!"vtable pointer", !8, i64 0}
!16 = !{!17, !6, i64 288}
!17 = !{!"_ZTS4Elem", !18, i64 0, !7, i64 104, !19, i64 224, !10, i64 228, !6, i64 232, !13, i64 240, !13, i64 248, !10, i64 256, !21, i64 264, !6, i64 288, !13, i64 296, !19, i64 304, !19, i64 305, !19, i64 306, !19, i64 307, !19, i64 308, !19, i64 309, !19, i64 310, !19, i64 311, !19, i64 312, !19, i64 313, !20, i64 320, !20, i64 336, !20, i64 352, !10, i64 368, !10, i64 372, !10, i64 376, !10, i64 380, !25, i64 384}
!18 = !{!"_ZTS4Apex", !19, i64 8, !13, i64 16, !13, i64 24, !6, i64 32, !10, i64 40, !13, i64 48, !13, i64 56, !13, i64 64, !13, i64 72, !19, i64 80, !19, i64 81, !19, i64 82, !19, i64 83, !20, i64 88}
!19 = !{!"bool", !7, i64 0}
!20 = !{!"_ZTSSt4pairIidE", !10, i64 0, !13, i64 8}
!21 = !{!"_ZTSSt6vectorIP4ElemSaIS1_EE", !22, i64 0}
!22 = !{!"_ZTSSt12_Vector_baseIP4ElemSaIS1_EE", !23, i64 0}
!23 = !{!"_ZTSNSt12_Vector_baseIP4ElemSaIS1_EE12_Vector_implE", !24, i64 0}
!24 = !{!"_ZTSNSt12_Vector_baseIP4ElemSaIS1_EE17_Vector_impl_dataE", !6, i64 0, !6, i64 8, !6, i64 16}
!25 = !{!"_ZTS4var3IdE", !13, i64 0, !13, i64 8, !13, i64 16}
!26 = distinct !{!26, !27}
!27 = !{!"llvm.loop.mustprogress"}
!28 = !{!17, !13, i64 296}
!29 = !{!17, !19, i64 309}
!30 = !{!17, !19, i64 308}
!31 = !{i8 0, i8 2}
!32 = !{}
!33 = !{!17, !19, i64 311}
!34 = !{!17, !19, i64 312}
!35 = !{!17, !19, i64 310}


; 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.var3 = type { double, double, double }
%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" }
%"struct.std::pair" = type { i32, double }

@_ZTV13InOutBoundary = external dso_local unnamed_addr constant { [16 x ptr] }, align 8
@_ZTI9ElemModel = external dso_local constant { ptr, ptr }, align 8
@_ZTI7Polygon = external constant ptr

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN4PoreC2ERK10CommonDatai4var3IdEddddbbdRSt6vectorIP4ElemSaIS7_EEi(ptr noundef nonnull align 8 dereferenceable(408), ptr noundef nonnull align 8 dereferenceable(1972), i32 noundef, ptr noundef byval(%class.var3) align 8, double noundef, double noundef, double noundef, double noundef, i1 noundef zeroext, i1 noundef zeroext, double noundef, ptr noundef nonnull align 8 dereferenceable(24), i32 noundef) unnamed_addr #0 align 2

declare i32 @__gxx_personality_v0(...)

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN13InOutBoundaryC2ERK10CommonDatai4var3IdERSt6vectorIP4ElemSaIS7_EE(ptr noundef nonnull align 8 dereferenceable(432) %0, ptr noundef nonnull align 8 dereferenceable(1972) %1, i32 noundef %2, ptr nocapture noundef readonly byval(%class.var3) align 8 %3, ptr noundef nonnull align 8 dereferenceable(24) %4) unnamed_addr #0 align 2 personality ptr @__gxx_personality_v0 {
  %6 = icmp sgt i32 %2, 1
  %7 = uitofp i1 %6 to double
  %8 = fadd double %7, 0x3FA8A2345CC04425
  tail call void @_ZN4PoreC2ERK10CommonDatai4var3IdEddddbbdRSt6vectorIP4ElemSaIS7_EEi(ptr noundef nonnull align 8 dereferenceable(408) %0, ptr noundef nonnull align 8 dereferenceable(1972) %1, i32 noundef %2, ptr noundef nonnull byval(%class.var3) align 8 %3, double noundef 0x3D719799812DEA11, double noundef 0.000000e+00, double noundef 0.000000e+00, double noundef %8, i1 noundef zeroext false, i1 noundef zeroext false, double noundef 0.000000e+00, ptr noundef nonnull align 8 dereferenceable(24) %4, i32 noundef 0)
  store ptr getelementptr inbounds inrange(-16, 112) (i8, ptr @_ZTV13InOutBoundary, i64 16), ptr %0, align 8, !tbaa !5
  %9 = getelementptr inbounds i8, ptr %0, i64 408
  tail call void @_ZNSt6vectorIP4PoreSaIS1_EEC2Ev(ptr noundef nonnull align 8 dereferenceable(24) %9) #4
  %10 = getelementptr inbounds i8, ptr %0, i64 288
  %11 = load ptr, ptr %10, align 8, !tbaa !8, !nonnull !22, !noundef !22
  %12 = tail call ptr @__dynamic_cast(ptr nonnull %11, ptr nonnull @_ZTI9ElemModel, ptr nonnull @_ZTI7Polygon, i64 0) #4
  %.not = icmp eq ptr %12, null
  br i1 %.not, label %.thread, label %.preheader

.preheader:                                       ; preds = %5, %22
  %indvars.iv = phi i64 [ %indvars.iv.next, %22 ], [ 0, %5 ]
  %13 = load ptr, ptr %12, align 8, !tbaa !5
  %14 = getelementptr inbounds i8, ptr %13, i64 192
  %15 = load ptr, ptr %14, align 8
  %16 = invoke noundef i32 %15(ptr noundef nonnull align 8 dereferenceable(248) %12)
          to label %17 unwind label %20

17:                                               ; preds = %.preheader
  %18 = sext i32 %16 to i64
  %19 = icmp slt i64 %indvars.iv, %18
  br i1 %19, label %22, label %.thread.loopexit

20:                                               ; preds = %.preheader
  %21 = landingpad { ptr, i32 }
          cleanup
  br label %44

22:                                               ; preds = %17
  %23 = tail call noundef ptr @_ZN7Polygon10oilLayerChEv(ptr noundef nonnull align 8 dereferenceable(248) %12)
  %24 = getelementptr inbounds %class.LayerApex, ptr %23, i64 %indvars.iv
  tail call void @_ZN4Apex16setInWatFloodVecEb(ptr noundef nonnull align 8 dereferenceable(104) %24, i1 noundef zeroext true)
  %25 = tail call noundef ptr @_ZN7Polygon10oilLayerChEv(ptr noundef nonnull align 8 dereferenceable(248) %12)
  %26 = getelementptr inbounds %class.LayerApex, ptr %25, i64 %indvars.iv
  tail call void @_ZN4Apex16setInOilFloodVecEb(ptr noundef nonnull align 8 dereferenceable(104) %26, i1 noundef zeroext true)
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  br label %.preheader, !llvm.loop !23

.thread.loopexit:                                 ; preds = %17
  %.pre = load ptr, ptr %10, align 8, !tbaa !8
  br label %.thread

.thread:                                          ; preds = %.thread.loopexit, %5
  %27 = phi ptr [ %.pre, %.thread.loopexit ], [ %11, %5 ]
  %28 = getelementptr inbounds i8, ptr %0, i64 296
  store double 5.000000e-01, ptr %28, align 8, !tbaa !25
  %29 = icmp eq i32 %2, 1
  %30 = getelementptr inbounds i8, ptr %0, i64 309
  %31 = zext i1 %29 to i8
  store i8 %31, ptr %30, align 1, !tbaa !26
  %32 = icmp eq i32 %2, 0
  %33 = getelementptr inbounds i8, ptr %0, i64 308
  %34 = zext i1 %32 to i8
  store i8 %34, ptr %33, align 4, !tbaa !27
  %35 = getelementptr inbounds i8, ptr %0, i64 311
  store i8 %31, ptr %35, align 1, !tbaa !28
  %36 = getelementptr inbounds i8, ptr %0, i64 312
  store i8 %34, ptr %36, align 8, !tbaa !29
  %37 = getelementptr inbounds i8, ptr %0, i64 310
  store i8 0, ptr %37, align 2, !tbaa !30
  %38 = load ptr, ptr %27, align 8, !tbaa !5
  %39 = getelementptr inbounds i8, ptr %38, i64 112
  %40 = load ptr, ptr %39, align 8
  invoke void %40(ptr noundef nonnull align 8 dereferenceable(152) %27, double noundef 0.000000e+00, i32 noundef 2, double noundef 1.800000e+02)
          to label %41 unwind label %42

41:                                               ; preds = %.thread
  ret void

42:                                               ; preds = %.thread
  %43 = landingpad { ptr, i32 }
          cleanup
  br label %44

44:                                               ; preds = %42, %20
  %.pn = phi { ptr, i32 } [ %43, %42 ], [ %21, %20 ]
  tail call void @_ZNSt6vectorIP4PoreSaIS1_EED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %9) #4
  tail call void @_ZN4ElemD2Ev(ptr noundef nonnull align 8 dereferenceable(408) %0) #4
  resume { ptr, i32 } %.pn
}

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

; Function Attrs: mustprogress nofree nounwind willreturn memory(read)
declare ptr @__dynamic_cast(ptr, ptr, ptr, i64) local_unnamed_addr #2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef ptr @_ZN7Polygon10oilLayerChEv(ptr noundef nonnull align 8 dereferenceable(248)) local_unnamed_addr #1 align 2

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

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

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

; Function Attrs: nounwind
declare void @_ZN4ElemD2Ev(ptr noundef nonnull align 8 dereferenceable(408)) unnamed_addr #3

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 nofree nounwind willreturn memory(read) }
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 = { 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, !14, i64 288}
!9 = !{!"_ZTS4Elem", !10, i64 0, !12, i64 104, !11, i64 224, !15, i64 228, !14, i64 232, !13, i64 240, !13, i64 248, !15, i64 256, !17, i64 264, !14, i64 288, !13, i64 296, !11, i64 304, !11, i64 305, !11, i64 306, !11, i64 307, !11, i64 308, !11, i64 309, !11, i64 310, !11, i64 311, !11, i64 312, !11, i64 313, !16, i64 320, !16, i64 336, !16, i64 352, !15, i64 368, !15, i64 372, !15, i64 376, !15, i64 380, !21, i64 384}
!10 = !{!"_ZTS4Apex", !11, i64 8, !13, i64 16, !13, i64 24, !14, i64 32, !15, i64 40, !13, i64 48, !13, i64 56, !13, i64 64, !13, i64 72, !11, i64 80, !11, i64 81, !11, i64 82, !11, i64 83, !16, i64 88}
!11 = !{!"bool", !12, i64 0}
!12 = !{!"omnipotent char", !7, i64 0}
!13 = !{!"double", !12, i64 0}
!14 = !{!"any pointer", !12, i64 0}
!15 = !{!"int", !12, i64 0}
!16 = !{!"_ZTSSt4pairIidE", !15, i64 0, !13, i64 8}
!17 = !{!"_ZTSSt6vectorIP4ElemSaIS1_EE", !18, i64 0}
!18 = !{!"_ZTSSt12_Vector_baseIP4ElemSaIS1_EE", !19, i64 0}
!19 = !{!"_ZTSNSt12_Vector_baseIP4ElemSaIS1_EE12_Vector_implE", !20, i64 0}
!20 = !{!"_ZTSNSt12_Vector_baseIP4ElemSaIS1_EE17_Vector_impl_dataE", !14, i64 0, !14, i64 8, !14, i64 16}
!21 = !{!"_ZTS4var3IdE", !13, i64 0, !13, i64 8, !13, i64 16}
!22 = !{}
!23 = distinct !{!23, !24}
!24 = !{!"llvm.loop.mustprogress"}
!25 = !{!9, !13, i64 296}
!26 = !{!9, !11, i64 309}
!27 = !{!9, !11, i64 308}
!28 = !{!9, !11, i64 311}
!29 = !{!9, !11, i64 312}
!30 = !{!9, !11, i64 310}


; Effective O3 passes: DSEPass,EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LoopSimplifyPass,LoopUnrollPass,MemCpyOptPass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass,TailCallElimPass