; LLVM IR from ImperialCollegeLondon/pnflow :: src/pnm/pnflow/Element.ll (ZNK4Elem13addToLayerVecERK5FluidP7PolygonRSt6vectorIiSaIiEE)

; 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.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.var3 = type { double, double, 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 nounwind uwtable
declare dso_local noundef i64 @_ZNKSt6vectorIP4ElemSaIS1_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24)) #1 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(8) ptr @_ZNKSt6vectorIP4ElemSaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24), i64 noundef) #1 align 2

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

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

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

; Function Attrs: mustprogress uwtable
define dso_local noundef zeroext i1 @_ZNK4Elem13addToLayerVecERK5FluidP7PolygonRSt6vectorIiSaIiEE(ptr noundef nonnull align 8 dereferenceable(408) %0, ptr noundef nonnull align 8 dereferenceable(80) %1, ptr noundef %2, ptr noundef nonnull align 8 dereferenceable(24) %3) #2 align 2 {
  %5 = alloca i1, align 1
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  %9 = alloca ptr, align 8
  %10 = alloca i8, align 1
  %11 = alloca i32, align 4
  %12 = alloca i32, align 4
  %13 = alloca i64, align 8
  %14 = alloca i32, align 4
  %15 = alloca i32, align 4
  store ptr %0, ptr %6, align 8, !tbaa !5
  store ptr %1, ptr %7, align 8, !tbaa !5
  store ptr %2, ptr %8, align 8, !tbaa !5
  store ptr %3, ptr %9, align 8, !tbaa !5
  %16 = load ptr, ptr %6, align 8
  %17 = load ptr, ptr %8, align 8, !tbaa !5
  %18 = load ptr, ptr %17, align 8, !tbaa !9
  %19 = getelementptr inbounds ptr, ptr %18, i64 27
  %20 = load ptr, ptr %19, align 8
  %21 = call noundef zeroext i1 %20(ptr noundef nonnull align 8 dereferenceable(248) %17)
  br i1 %21, label %22, label %33

22:                                               ; preds = %4
  %23 = load ptr, ptr %8, align 8, !tbaa !5
  %24 = load ptr, ptr %23, align 8, !tbaa !9
  %25 = getelementptr inbounds ptr, ptr %24, i64 19
  %26 = load ptr, ptr %25, align 8
  %27 = call noundef zeroext i1 %26(ptr noundef nonnull align 8 dereferenceable(152) %23)
  br i1 %27, label %33, label %28

28:                                               ; preds = %22
  %29 = getelementptr inbounds %class.Elem, ptr %16, i32 0, i32 21
  %30 = getelementptr inbounds %"struct.std::pair", ptr %29, i32 0, i32 0
  %31 = load i32, ptr %30, align 8, !tbaa !11
  %32 = icmp ne i32 %31, -1
  br i1 %32, label %33, label %34

33:                                               ; preds = %28, %22, %4
  store i1 false, ptr %5, align 1
  br label %190

34:                                               ; preds = %28
  call void @llvm.lifetime.start.p0(i64 1, ptr %10) #3
  %35 = load ptr, ptr %7, align 8, !tbaa !5
  %36 = call noundef zeroext i1 @_ZNK5Fluid5isOilEv(ptr noundef nonnull align 8 dereferenceable(80) %35)
  %37 = zext i1 %36 to i8
  store i8 %37, ptr %10, align 1, !tbaa !23
  %38 = load i8, ptr %10, align 1, !tbaa !23, !range !24, !noundef !25
  %39 = trunc i8 %38 to i1
  br i1 %39, label %40, label %139

40:                                               ; preds = %34
  %41 = call noundef zeroext i1 @_ZNK4Apex15isInOilFloodVecEv(ptr noundef nonnull align 8 dereferenceable(104) %16)
  br i1 %41, label %42, label %82

42:                                               ; preds = %40
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #3
  store i32 0, ptr %11, align 4, !tbaa !26
  br label %43

43:                                               ; preds = %78, %42
  %44 = load i32, ptr %11, align 4, !tbaa !26
  %45 = load ptr, ptr %8, align 8, !tbaa !5
  %46 = load ptr, ptr %45, align 8, !tbaa !9
  %47 = getelementptr inbounds ptr, ptr %46, i64 24
  %48 = load ptr, ptr %47, align 8
  %49 = call noundef i32 %48(ptr noundef nonnull align 8 dereferenceable(248) %45)
  %50 = icmp slt i32 %44, %49
  br i1 %50, label %52, label %51

51:                                               ; preds = %43
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #3
  br label %81

52:                                               ; preds = %43
  %53 = load ptr, ptr %8, align 8, !tbaa !5
  %54 = call noundef ptr @_ZNK7Polygon13oilLayerConstEv(ptr noundef nonnull align 8 dereferenceable(248) %53)
  %55 = load i32, ptr %11, align 4, !tbaa !26
  %56 = sext i32 %55 to i64
  %57 = getelementptr inbounds %class.LayerApex, ptr %54, i64 %56
  %58 = call noundef zeroext i1 @_ZNK4Apex15isInOilFloodVecEv(ptr noundef nonnull align 8 dereferenceable(104) %57)
  br i1 %58, label %77, label %59

59:                                               ; preds = %52
  %60 = load ptr, ptr %8, align 8, !tbaa !5
  %61 = call noundef ptr @_ZNK7Polygon13oilLayerConstEv(ptr noundef nonnull align 8 dereferenceable(248) %60)
  %62 = load i32, ptr %11, align 4, !tbaa !26
  %63 = sext i32 %62 to i64
  %64 = getelementptr inbounds %class.LayerApex, ptr %61, i64 %63
  %65 = call noundef zeroext i1 @_ZNK4Apex6existsEv(ptr noundef nonnull align 8 dereferenceable(104) %64)
  br i1 %65, label %77, label %66

66:                                               ; preds = %59
  %67 = call noundef double @_ZNK4Apex7entryPcEv(ptr noundef nonnull align 8 dereferenceable(104) %16)
  %68 = load ptr, ptr %8, align 8, !tbaa !5
  %69 = call noundef ptr @_ZNK7Polygon13oilLayerConstEv(ptr noundef nonnull align 8 dereferenceable(248) %68)
  %70 = load i32, ptr %11, align 4, !tbaa !26
  %71 = sext i32 %70 to i64
  %72 = getelementptr inbounds %class.LayerApex, ptr %69, i64 %71
  %73 = call noundef double @_ZNK4Apex7entryPcEv(ptr noundef nonnull align 8 dereferenceable(104) %72)
  %74 = fcmp ogt double %67, %73
  br i1 %74, label %75, label %77

75:                                               ; preds = %66
  %76 = load ptr, ptr %9, align 8, !tbaa !5
  call void @_ZNSt6vectorIiSaIiEE9push_backERKi(ptr noundef nonnull align 8 dereferenceable(24) %76, ptr noundef nonnull align 4 dereferenceable(4) %11)
  br label %77

77:                                               ; preds = %75, %66, %59, %52
  br label %78

78:                                               ; preds = %77
  %79 = load i32, ptr %11, align 4, !tbaa !26
  %80 = add nsw i32 %79, 1
  store i32 %80, ptr %11, align 4, !tbaa !26
  br label %43, !llvm.loop !27

81:                                               ; preds = %51
  br label %113

82:                                               ; preds = %40
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #3
  store i32 0, ptr %12, align 4, !tbaa !26
  br label %83

83:                                               ; preds = %109, %82
  %84 = load i32, ptr %12, align 4, !tbaa !26
  %85 = load ptr, ptr %8, align 8, !tbaa !5
  %86 = load ptr, ptr %85, align 8, !tbaa !9
  %87 = getelementptr inbounds ptr, ptr %86, i64 24
  %88 = load ptr, ptr %87, align 8
  %89 = call noundef i32 %88(ptr noundef nonnull align 8 dereferenceable(248) %85)
  %90 = icmp slt i32 %84, %89
  br i1 %90, label %92, label %91

91:                                               ; preds = %83
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #3
  br label %112

92:                                               ; preds = %83
  %93 = load ptr, ptr %8, align 8, !tbaa !5
  %94 = call noundef ptr @_ZNK7Polygon13oilLayerConstEv(ptr noundef nonnull align 8 dereferenceable(248) %93)
  %95 = load i32, ptr %12, align 4, !tbaa !26
  %96 = sext i32 %95 to i64
  %97 = getelementptr inbounds %class.LayerApex, ptr %94, i64 %96
  %98 = call noundef zeroext i1 @_ZNK4Apex15isInOilFloodVecEv(ptr noundef nonnull align 8 dereferenceable(104) %97)
  br i1 %98, label %108, label %99

99:                                               ; preds = %92
  %100 = load ptr, ptr %8, align 8, !tbaa !5
  %101 = call noundef ptr @_ZNK7Polygon13oilLayerConstEv(ptr noundef nonnull align 8 dereferenceable(248) %100)
  %102 = load i32, ptr %12, align 4, !tbaa !26
  %103 = sext i32 %102 to i64
  %104 = getelementptr inbounds %class.LayerApex, ptr %101, i64 %103
  %105 = call noundef zeroext i1 @_ZNK4Apex6existsEv(ptr noundef nonnull align 8 dereferenceable(104) %104)
  br i1 %105, label %108, label %106

106:                                              ; preds = %99
  %107 = load ptr, ptr %9, align 8, !tbaa !5
  call void @_ZNSt6vectorIiSaIiEE9push_backERKi(ptr noundef nonnull align 8 dereferenceable(24) %107, ptr noundef nonnull align 4 dereferenceable(4) %12)
  br label %108

108:                                              ; preds = %106, %99, %92
  br label %109

109:                                              ; preds = %108
  %110 = load i32, ptr %12, align 4, !tbaa !26
  %111 = add nsw i32 %110, 1
  store i32 %111, ptr %12, align 4, !tbaa !26
  br label %83, !llvm.loop !29

112:                                              ; preds = %91
  br label %113

113:                                              ; preds = %112, %81
  %114 = load ptr, ptr %9, align 8, !tbaa !5
  %115 = call noundef zeroext i1 @_ZNKSt6vectorIiSaIiEE5emptyEv(ptr noundef nonnull align 8 dereferenceable(24) %114) #3
  br i1 %115, label %138, label %116

116:                                              ; preds = %113
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #3
  store i64 0, ptr %13, align 8, !tbaa !30
  br label %117

117:                                              ; preds = %132, %116
  %118 = load i64, ptr %13, align 8, !tbaa !30
  %119 = getelementptr inbounds %class.Elem, ptr %16, i32 0, i32 8
  %120 = call noundef i64 @_ZNKSt6vectorIP4ElemSaIS1_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %119) #3
  %121 = icmp ult i64 %118, %120
  br i1 %121, label %123, label %122

122:                                              ; preds = %117
  store i32 8, ptr %14, align 4
  br label %135

123:                                              ; preds = %117
  %124 = getelementptr inbounds %class.Elem, ptr %16, i32 0, i32 8
  %125 = load i64, ptr %13, align 8, !tbaa !30
  %126 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNKSt6vectorIP4ElemSaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %124, i64 noundef %125) #3
  %127 = load ptr, ptr %126, align 8, !tbaa !5
  %128 = call noundef ptr @_ZNK4Elem5modelEv(ptr noundef nonnull align 8 dereferenceable(408) %127)
  %129 = call noundef zeroext i1 @_ZNK9ElemModel14conductsAnyOilEv(ptr noundef nonnull align 8 dereferenceable(152) %128)
  br i1 %129, label %130, label %131

130:                                              ; preds = %123
  store i1 true, ptr %5, align 1
  store i32 1, ptr %14, align 4
  br label %135

131:                                              ; preds = %123
  br label %132

132:                                              ; preds = %131
  %133 = load i64, ptr %13, align 8, !tbaa !30
  %134 = add i64 %133, 1
  store i64 %134, ptr %13, align 8, !tbaa !30
  br label %117, !llvm.loop !32

135:                                              ; preds = %130, %122
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #3
  %136 = load i32, ptr %14, align 4
  switch i32 %136, label %189 [
    i32 8, label %137
  ]

137:                                              ; preds = %135
  br label %138

138:                                              ; preds = %137, %113
  store i1 false, ptr %5, align 1
  store i32 1, ptr %14, align 4
  br label %189

139:                                              ; preds = %34
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #3
  store i32 0, ptr %15, align 4, !tbaa !26
  br label %140

140:                                              ; preds = %181, %139
  %141 = load i32, ptr %15, align 4, !tbaa !26
  %142 = load ptr, ptr %8, align 8, !tbaa !5
  %143 = load ptr, ptr %142, align 8, !tbaa !9
  %144 = getelementptr inbounds ptr, ptr %143, i64 24
  %145 = load ptr, ptr %144, align 8
  %146 = call noundef i32 %145(ptr noundef nonnull align 8 dereferenceable(248) %142)
  %147 = icmp slt i32 %141, %146
  br i1 %147, label %149, label %148

148:                                              ; preds = %140
  store i32 11, ptr %14, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #3
  br label %184

149:                                              ; preds = %140
  %150 = load ptr, ptr %8, align 8, !tbaa !5
  %151 = call noundef ptr @_ZNK7Polygon13oilLayerConstEv(ptr noundef nonnull align 8 dereferenceable(248) %150)
  %152 = load i32, ptr %15, align 4, !tbaa !26
  %153 = sext i32 %152 to i64
  %154 = getelementptr inbounds %class.LayerApex, ptr %151, i64 %153
  %155 = call noundef zeroext i1 @_ZNK4Apex15isInWatFloodVecEv(ptr noundef nonnull align 8 dereferenceable(104) %154)
  br i1 %155, label %180, label %156

156:                                              ; preds = %149
  %157 = load ptr, ptr %8, align 8, !tbaa !5
  %158 = call noundef ptr @_ZNK7Polygon13oilLayerConstEv(ptr noundef nonnull align 8 dereferenceable(248) %157)
  %159 = load i32, ptr %15, align 4, !tbaa !26
  %160 = sext i32 %159 to i64
  %161 = getelementptr inbounds %class.LayerApex, ptr %158, i64 %160
  %162 = call noundef zeroext i1 @_ZNK4Apex6existsEv(ptr noundef nonnull align 8 dereferenceable(104) %161)
  br i1 %162, label %163, label %180

163:                                              ; preds = %156
  %164 = getelementptr inbounds %class.Elem, ptr %16, i32 0, i32 21
  %165 = getelementptr inbounds %"struct.std::pair", ptr %164, i32 0, i32 0
  %166 = load i32, ptr %165, align 8, !tbaa !11
  %167 = icmp slt i32 %166, 0
  br i1 %167, label %168, label %180

168:                                              ; preds = %163
  %169 = getelementptr inbounds %class.Elem, ptr %16, i32 0, i32 23
  %170 = getelementptr inbounds %"struct.std::pair", ptr %169, i32 0, i32 0
  %171 = load i32, ptr %170, align 8, !tbaa !33
  %172 = icmp slt i32 %171, 0
  br i1 %172, label %178, label %173

173:                                              ; preds = %168
  %174 = getelementptr inbounds %class.Elem, ptr %16, i32 0, i32 22
  %175 = getelementptr inbounds %"struct.std::pair", ptr %174, i32 0, i32 0
  %176 = load i32, ptr %175, align 8, !tbaa !34
  %177 = icmp slt i32 %176, 0
  br i1 %177, label %178, label %180

178:                                              ; preds = %173, %168
  %179 = load ptr, ptr %9, align 8, !tbaa !5
  call void @_ZNSt6vectorIiSaIiEE9push_backERKi(ptr noundef nonnull align 8 dereferenceable(24) %179, ptr noundef nonnull align 4 dereferenceable(4) %15)
  br label %180

180:                                              ; preds = %178, %173, %163, %156, %149
  br label %181

181:                                              ; preds = %180
  %182 = load i32, ptr %15, align 4, !tbaa !26
  %183 = add nsw i32 %182, 1
  store i32 %183, ptr %15, align 4, !tbaa !26
  br label %140, !llvm.loop !35

184:                                              ; preds = %148
  %185 = load ptr, ptr %9, align 8, !tbaa !5
  %186 = call noundef zeroext i1 @_ZNKSt6vectorIiSaIiEE5emptyEv(ptr noundef nonnull align 8 dereferenceable(24) %185) #3
  br i1 %186, label %188, label %187

187:                                              ; preds = %184
  store i1 true, ptr %5, align 1
  store i32 1, ptr %14, align 4
  br label %189

188:                                              ; preds = %184
  store i1 false, ptr %5, align 1
  store i32 1, ptr %14, align 4
  br label %189

189:                                              ; preds = %188, %187, %138, %135
  call void @llvm.lifetime.end.p0(i64 1, ptr %10) #3
  br label %190

190:                                              ; preds = %189, %33
  %191 = load i1, ptr %5, align 1
  ret i1 %191
}

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

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

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

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

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

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

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

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


; 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.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 }

; 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 nounwind uwtable
declare dso_local noundef i64 @_ZNKSt6vectorIP4ElemSaIS1_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24)) local_unnamed_addr #1 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(8) ptr @_ZNKSt6vectorIP4ElemSaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24), i64 noundef) local_unnamed_addr #1 align 2

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

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

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

; Function Attrs: mustprogress uwtable
define dso_local noundef zeroext i1 @_ZNK4Elem13addToLayerVecERK5FluidP7PolygonRSt6vectorIiSaIiEE(ptr noundef nonnull align 8 dereferenceable(408) %0, ptr noundef nonnull align 8 dereferenceable(80) %1, ptr noundef %2, ptr noundef nonnull align 8 dereferenceable(24) %3) local_unnamed_addr #2 align 2 {
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  %8 = load ptr, ptr %2, align 8, !tbaa !5
  %9 = getelementptr inbounds i8, ptr %8, i64 216
  %10 = load ptr, ptr %9, align 8
  %11 = tail call noundef zeroext i1 %10(ptr noundef nonnull align 8 dereferenceable(248) %2)
  br i1 %11, label %12, label %.critedge

12:                                               ; preds = %4
  %13 = load ptr, ptr %2, align 8, !tbaa !5
  %14 = getelementptr inbounds i8, ptr %13, i64 152
  %15 = load ptr, ptr %14, align 8
  %16 = tail call noundef zeroext i1 %15(ptr noundef nonnull align 8 dereferenceable(152) %2)
  br i1 %16, label %.critedge, label %17

17:                                               ; preds = %12
  %18 = getelementptr inbounds i8, ptr %0, i64 320
  %19 = load i32, ptr %18, align 8, !tbaa !8
  %.not = icmp eq i32 %19, -1
  br i1 %.not, label %20, label %.critedge

20:                                               ; preds = %17
  %21 = tail call noundef zeroext i1 @_ZNK5Fluid5isOilEv(ptr noundef nonnull align 8 dereferenceable(80) %1)
  br i1 %21, label %22, label %95

22:                                               ; preds = %20
  %23 = tail call noundef zeroext i1 @_ZNK4Apex15isInOilFloodVecEv(ptr noundef nonnull align 8 dereferenceable(104) %0)
  br i1 %23, label %24, label %58

24:                                               ; preds = %22
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %5) #3
  store i32 0, ptr %5, align 4, !tbaa !22
  %25 = load ptr, ptr %2, align 8, !tbaa !5
  %26 = getelementptr inbounds i8, ptr %25, i64 192
  %27 = load ptr, ptr %26, align 8
  %28 = tail call noundef i32 %27(ptr noundef nonnull align 8 dereferenceable(248) %2)
  %29 = icmp sgt i32 %28, 0
  br i1 %29, label %.lr.ph37, label %._crit_edge38

._crit_edge38:                                    ; preds = %50, %24
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %5) #3
  br label %84

.lr.ph37:                                         ; preds = %24, %50
  %30 = call noundef ptr @_ZNK7Polygon13oilLayerConstEv(ptr noundef nonnull align 8 dereferenceable(248) %2)
  %31 = load i32, ptr %5, align 4, !tbaa !22
  %32 = sext i32 %31 to i64
  %33 = getelementptr inbounds %class.LayerApex, ptr %30, i64 %32
  %34 = call noundef zeroext i1 @_ZNK4Apex15isInOilFloodVecEv(ptr noundef nonnull align 8 dereferenceable(104) %33)
  br i1 %34, label %50, label %35

35:                                               ; preds = %.lr.ph37
  %36 = call noundef ptr @_ZNK7Polygon13oilLayerConstEv(ptr noundef nonnull align 8 dereferenceable(248) %2)
  %37 = load i32, ptr %5, align 4, !tbaa !22
  %38 = sext i32 %37 to i64
  %39 = getelementptr inbounds %class.LayerApex, ptr %36, i64 %38
  %40 = call noundef zeroext i1 @_ZNK4Apex6existsEv(ptr noundef nonnull align 8 dereferenceable(104) %39)
  br i1 %40, label %50, label %41

41:                                               ; preds = %35
  %42 = call noundef double @_ZNK4Apex7entryPcEv(ptr noundef nonnull align 8 dereferenceable(104) %0)
  %43 = call noundef ptr @_ZNK7Polygon13oilLayerConstEv(ptr noundef nonnull align 8 dereferenceable(248) %2)
  %44 = load i32, ptr %5, align 4, !tbaa !22
  %45 = sext i32 %44 to i64
  %46 = getelementptr inbounds %class.LayerApex, ptr %43, i64 %45
  %47 = call noundef double @_ZNK4Apex7entryPcEv(ptr noundef nonnull align 8 dereferenceable(104) %46)
  %48 = fcmp ogt double %42, %47
  br i1 %48, label %49, label %50

49:                                               ; preds = %41
  call void @_ZNSt6vectorIiSaIiEE9push_backERKi(ptr noundef nonnull align 8 dereferenceable(24) %3, ptr noundef nonnull align 4 dereferenceable(4) %5)
  br label %50

50:                                               ; preds = %.lr.ph37, %35, %41, %49
  %51 = load i32, ptr %5, align 4, !tbaa !22
  %52 = add nsw i32 %51, 1
  store i32 %52, ptr %5, align 4, !tbaa !22
  %53 = load ptr, ptr %2, align 8, !tbaa !5
  %54 = getelementptr inbounds i8, ptr %53, i64 192
  %55 = load ptr, ptr %54, align 8
  %56 = call noundef i32 %55(ptr noundef nonnull align 8 dereferenceable(248) %2)
  %57 = icmp slt i32 %52, %56
  br i1 %57, label %.lr.ph37, label %._crit_edge38, !llvm.loop !23

58:                                               ; preds = %22
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %6) #3
  store i32 0, ptr %6, align 4, !tbaa !22
  %59 = load ptr, ptr %2, align 8, !tbaa !5
  %60 = getelementptr inbounds i8, ptr %59, i64 192
  %61 = load ptr, ptr %60, align 8
  %62 = tail call noundef i32 %61(ptr noundef nonnull align 8 dereferenceable(248) %2)
  %63 = icmp sgt i32 %62, 0
  br i1 %63, label %.lr.ph34, label %._crit_edge35

._crit_edge35:                                    ; preds = %76, %58
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %6) #3
  br label %84

.lr.ph34:                                         ; preds = %58, %76
  %64 = call noundef ptr @_ZNK7Polygon13oilLayerConstEv(ptr noundef nonnull align 8 dereferenceable(248) %2)
  %65 = load i32, ptr %6, align 4, !tbaa !22
  %66 = sext i32 %65 to i64
  %67 = getelementptr inbounds %class.LayerApex, ptr %64, i64 %66
  %68 = call noundef zeroext i1 @_ZNK4Apex15isInOilFloodVecEv(ptr noundef nonnull align 8 dereferenceable(104) %67)
  br i1 %68, label %76, label %69

69:                                               ; preds = %.lr.ph34
  %70 = call noundef ptr @_ZNK7Polygon13oilLayerConstEv(ptr noundef nonnull align 8 dereferenceable(248) %2)
  %71 = load i32, ptr %6, align 4, !tbaa !22
  %72 = sext i32 %71 to i64
  %73 = getelementptr inbounds %class.LayerApex, ptr %70, i64 %72
  %74 = call noundef zeroext i1 @_ZNK4Apex6existsEv(ptr noundef nonnull align 8 dereferenceable(104) %73)
  br i1 %74, label %76, label %75

75:                                               ; preds = %69
  call void @_ZNSt6vectorIiSaIiEE9push_backERKi(ptr noundef nonnull align 8 dereferenceable(24) %3, ptr noundef nonnull align 4 dereferenceable(4) %6)
  br label %76

76:                                               ; preds = %.lr.ph34, %69, %75
  %77 = load i32, ptr %6, align 4, !tbaa !22
  %78 = add nsw i32 %77, 1
  store i32 %78, ptr %6, align 4, !tbaa !22
  %79 = load ptr, ptr %2, align 8, !tbaa !5
  %80 = getelementptr inbounds i8, ptr %79, i64 192
  %81 = load ptr, ptr %80, align 8
  %82 = call noundef i32 %81(ptr noundef nonnull align 8 dereferenceable(248) %2)
  %83 = icmp slt i32 %78, %82
  br i1 %83, label %.lr.ph34, label %._crit_edge35, !llvm.loop !25

84:                                               ; preds = %._crit_edge35, %._crit_edge38
  %85 = call noundef zeroext i1 @_ZNKSt6vectorIiSaIiEE5emptyEv(ptr noundef nonnull align 8 dereferenceable(24) %3) #3
  br i1 %85, label %.critedge, label %.preheader

.preheader:                                       ; preds = %84
  %86 = getelementptr inbounds i8, ptr %0, i64 264
  %87 = call noundef i64 @_ZNKSt6vectorIP4ElemSaIS1_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %86) #3
  %.not2839.not = icmp eq i64 %87, 0
  br i1 %.not2839.not, label %.critedge, label %.lr.ph41

88:                                               ; preds = %.lr.ph41
  %89 = add nuw i64 %.02440, 1
  %90 = call noundef i64 @_ZNKSt6vectorIP4ElemSaIS1_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %86) #3
  %.not28 = icmp ult i64 %89, %90
  br i1 %.not28, label %.lr.ph41, label %.critedge, !llvm.loop !26

.lr.ph41:                                         ; preds = %.preheader, %88
  %.02440 = phi i64 [ %89, %88 ], [ 0, %.preheader ]
  %91 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNKSt6vectorIP4ElemSaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %86, i64 noundef %.02440) #3
  %92 = load ptr, ptr %91, align 8, !tbaa !27
  %93 = call noundef ptr @_ZNK4Elem5modelEv(ptr noundef nonnull align 8 dereferenceable(408) %92)
  %94 = call noundef zeroext i1 @_ZNK9ElemModel14conductsAnyOilEv(ptr noundef nonnull align 8 dereferenceable(152) %93)
  br i1 %94, label %.critedge, label %88

95:                                               ; preds = %20
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %7) #3
  store i32 0, ptr %7, align 4, !tbaa !22
  %96 = load ptr, ptr %2, align 8, !tbaa !5
  %97 = getelementptr inbounds i8, ptr %96, i64 192
  %98 = load ptr, ptr %97, align 8
  %99 = tail call noundef i32 %98(ptr noundef nonnull align 8 dereferenceable(248) %2)
  %100 = icmp sgt i32 %99, 0
  br i1 %100, label %.lr.ph, label %._crit_edge

.lr.ph:                                           ; preds = %95
  %101 = getelementptr inbounds i8, ptr %0, i64 352
  %102 = getelementptr inbounds i8, ptr %0, i64 336
  br label %104

._crit_edge:                                      ; preds = %124, %95
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %7) #3
  %103 = call noundef zeroext i1 @_ZNKSt6vectorIiSaIiEE5emptyEv(ptr noundef nonnull align 8 dereferenceable(24) %3) #3
  %not. = xor i1 %103, true
  br label %.critedge

104:                                              ; preds = %.lr.ph, %124
  %105 = call noundef ptr @_ZNK7Polygon13oilLayerConstEv(ptr noundef nonnull align 8 dereferenceable(248) %2)
  %106 = load i32, ptr %7, align 4, !tbaa !22
  %107 = sext i32 %106 to i64
  %108 = getelementptr inbounds %class.LayerApex, ptr %105, i64 %107
  %109 = call noundef zeroext i1 @_ZNK4Apex15isInWatFloodVecEv(ptr noundef nonnull align 8 dereferenceable(104) %108)
  br i1 %109, label %124, label %110

110:                                              ; preds = %104
  %111 = call noundef ptr @_ZNK7Polygon13oilLayerConstEv(ptr noundef nonnull align 8 dereferenceable(248) %2)
  %112 = load i32, ptr %7, align 4, !tbaa !22
  %113 = sext i32 %112 to i64
  %114 = getelementptr inbounds %class.LayerApex, ptr %111, i64 %113
  %115 = call noundef zeroext i1 @_ZNK4Apex6existsEv(ptr noundef nonnull align 8 dereferenceable(104) %114)
  %116 = load i32, ptr %18, align 8
  %117 = icmp slt i32 %116, 0
  %or.cond = select i1 %115, i1 %117, i1 false
  br i1 %or.cond, label %118, label %124

118:                                              ; preds = %110
  %119 = load i32, ptr %101, align 8, !tbaa !28
  %120 = icmp slt i32 %119, 0
  %121 = load i32, ptr %102, align 8
  %122 = icmp slt i32 %121, 0
  %or.cond32 = select i1 %120, i1 true, i1 %122
  br i1 %or.cond32, label %123, label %124

123:                                              ; preds = %118
  call void @_ZNSt6vectorIiSaIiEE9push_backERKi(ptr noundef nonnull align 8 dereferenceable(24) %3, ptr noundef nonnull align 4 dereferenceable(4) %7)
  br label %124

124:                                              ; preds = %118, %104, %110, %123
  %125 = load i32, ptr %7, align 4, !tbaa !22
  %126 = add nsw i32 %125, 1
  store i32 %126, ptr %7, align 4, !tbaa !22
  %127 = load ptr, ptr %2, align 8, !tbaa !5
  %128 = getelementptr inbounds i8, ptr %127, i64 192
  %129 = load ptr, ptr %128, align 8
  %130 = call noundef i32 %129(ptr noundef nonnull align 8 dereferenceable(248) %2)
  %131 = icmp slt i32 %126, %130
  br i1 %131, label %104, label %._crit_edge, !llvm.loop !29

.critedge:                                        ; preds = %.lr.ph41, %88, %.preheader, %84, %._crit_edge, %4, %12, %17
  %.2 = phi i1 [ false, %17 ], [ false, %12 ], [ false, %4 ], [ %not., %._crit_edge ], [ false, %84 ], [ false, %.preheader ], [ %94, %88 ], [ %94, %.lr.ph41 ]
  ret i1 %.2
}

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef ptr @_ZNK7Polygon13oilLayerConstEv(ptr noundef nonnull align 8 dereferenceable(248)) 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 #1 align 2

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

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

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

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

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 = { 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 #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 = !{!"vtable pointer", !7, i64 0}
!7 = !{!"Simple C++ TBAA"}
!8 = !{!9, !15, i64 320}
!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 = !{!15, !15, i64 0}
!23 = distinct !{!23, !24}
!24 = !{!"llvm.loop.mustprogress"}
!25 = distinct !{!25, !24}
!26 = distinct !{!26, !24}
!27 = !{!14, !14, i64 0}
!28 = !{!9, !15, i64 352}
!29 = distinct !{!29, !24}


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