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

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

; 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 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 i32 @_ZNK4Elem9rockIndexEv(ptr noundef nonnull align 8 dereferenceable(408)) #1 align 2

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

17:                                               ; preds = %2
  %18 = getelementptr inbounds %class.Elem, ptr %9, i32 0, i32 17
  %19 = load i8, ptr %18, align 2, !tbaa !23, !range !24, !noundef !25
  %20 = trunc i8 %19 to i1
  br i1 %20, label %22, label %21

21:                                               ; preds = %17, %2
  store i1 false, ptr %3, align 1
  br label %138

22:                                               ; preds = %17
  %23 = load ptr, ptr %5, align 8, !tbaa !5
  %24 = call noundef zeroext i1 @_ZNK5Fluid5isOilEv(ptr noundef nonnull align 8 dereferenceable(80) %23)
  br i1 %24, label %25, label %89

25:                                               ; preds = %22
  %26 = getelementptr inbounds %class.Elem, ptr %9, i32 0, i32 9
  %27 = load ptr, ptr %26, align 8, !tbaa !9
  %28 = load ptr, ptr %27, align 8, !tbaa !21
  %29 = getelementptr inbounds ptr, ptr %28, i64 19
  %30 = load ptr, ptr %29, align 8
  %31 = call noundef zeroext i1 %30(ptr noundef nonnull align 8 dereferenceable(152) %27)
  br i1 %31, label %32, label %36

32:                                               ; preds = %25
  %33 = call noundef i32 @_ZNK4Elem9rockIndexEv(ptr noundef nonnull align 8 dereferenceable(408) %9)
  %34 = icmp eq i32 %33, 0
  br i1 %34, label %35, label %36

35:                                               ; preds = %32
  store i1 false, ptr %3, align 1
  br label %138

36:                                               ; preds = %32, %25
  %37 = getelementptr inbounds %class.Apex, ptr %9, i32 0, i32 11
  %38 = load i8, ptr %37, align 1, !tbaa !26, !range !24, !noundef !25
  %39 = trunc i8 %38 to i1
  br i1 %39, label %45, label %40

40:                                               ; preds = %36
  %41 = getelementptr inbounds %class.Elem, ptr %9, i32 0, i32 22
  %42 = getelementptr inbounds %"struct.std::pair", ptr %41, i32 0, i32 0
  %43 = load i32, ptr %42, align 8, !tbaa !27
  %44 = icmp sgt i32 %43, -1
  br i1 %44, label %45, label %46

45:                                               ; preds = %40, %36
  store i1 false, ptr %3, align 1
  br label %138

46:                                               ; preds = %40
  %47 = getelementptr inbounds %class.Elem, ptr %9, i32 0, i32 9
  %48 = load ptr, ptr %47, align 8, !tbaa !9
  %49 = call noundef zeroext i1 @_ZNK9ElemModel14conductsAnyOilEv(ptr noundef nonnull align 8 dereferenceable(152) %48)
  br i1 %49, label %50, label %51

50:                                               ; preds = %46
  store i1 true, ptr %3, align 1
  br label %138

51:                                               ; preds = %46
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #3
  store i32 0, ptr %6, align 4, !tbaa !28
  br label %52

52:                                               ; preds = %78, %51
  %53 = load i32, ptr %6, align 4, !tbaa !28
  %54 = getelementptr inbounds %class.Elem, ptr %9, i32 0, i32 7
  %55 = load i32, ptr %54, align 8, !tbaa !29
  %56 = icmp slt i32 %53, %55
  br i1 %56, label %58, label %57

57:                                               ; preds = %52
  store i32 2, ptr %7, align 4
  br label %81

58:                                               ; preds = %52
  %59 = getelementptr inbounds %class.Elem, ptr %9, i32 0, i32 8
  %60 = load i32, ptr %6, align 4, !tbaa !28
  %61 = sext i32 %60 to i64
  %62 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNKSt6vectorIP4ElemSaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %59, i64 noundef %61) #3
  %63 = load ptr, ptr %62, align 8, !tbaa !5
  %64 = call noundef ptr @_ZNK4Elem5modelEv(ptr noundef nonnull align 8 dereferenceable(408) %63)
  %65 = load ptr, ptr %64, align 8, !tbaa !21
  %66 = getelementptr inbounds ptr, ptr %65, i64 21
  %67 = load ptr, ptr %66, align 8
  %68 = call noundef zeroext i1 %67(ptr noundef nonnull align 8 dereferenceable(152) %64)
  br i1 %68, label %69, label %77

69:                                               ; preds = %58
  %70 = getelementptr inbounds %class.Elem, ptr %9, i32 0, i32 8
  %71 = load i32, ptr %6, align 4, !tbaa !28
  %72 = sext i32 %71 to i64
  %73 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNKSt6vectorIP4ElemSaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %70, i64 noundef %72) #3
  %74 = load ptr, ptr %73, align 8, !tbaa !5
  %75 = call noundef zeroext i1 @_ZNK4Elem12isTrappedOilEv(ptr noundef nonnull align 8 dereferenceable(408) %74)
  br i1 %75, label %77, label %76

76:                                               ; preds = %69
  store i1 true, ptr %3, align 1
  store i32 1, ptr %7, align 4
  br label %81

77:                                               ; preds = %69, %58
  br label %78

78:                                               ; preds = %77
  %79 = load i32, ptr %6, align 4, !tbaa !28
  %80 = add nsw i32 %79, 1
  store i32 %80, ptr %6, align 4, !tbaa !28
  br label %52, !llvm.loop !30

81:                                               ; preds = %76, %57
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #3
  %82 = load i32, ptr %7, align 4
  switch i32 %82, label %140 [
    i32 2, label %83
    i32 1, label %138
  ]

83:                                               ; preds = %81
  %84 = getelementptr inbounds %class.Elem, ptr %9, i32 0, i32 24
  %85 = load i32, ptr %84, align 8, !tbaa !32
  %86 = icmp eq i32 %85, 0
  br i1 %86, label %87, label %88

87:                                               ; preds = %83
  store i1 false, ptr %3, align 1
  br label %138

88:                                               ; preds = %83
  store i1 false, ptr %3, align 1
  br label %138

89:                                               ; preds = %22
  %90 = getelementptr inbounds %class.Elem, ptr %9, i32 0, i32 9
  %91 = load ptr, ptr %90, align 8, !tbaa !9
  %92 = call noundef zeroext i1 @_ZNK9ElemModel14conductsAnyOilEv(ptr noundef nonnull align 8 dereferenceable(152) %91)
  br i1 %92, label %97, label %93

93:                                               ; preds = %89
  %94 = call noundef i32 @_ZNK4Elem9rockIndexEv(ptr noundef nonnull align 8 dereferenceable(408) %9)
  %95 = icmp eq i32 %94, 0
  br i1 %95, label %96, label %97

96:                                               ; preds = %93
  store i1 false, ptr %3, align 1
  br label %138

97:                                               ; preds = %93, %89
  %98 = getelementptr inbounds %class.Apex, ptr %9, i32 0, i32 10
  %99 = load i8, ptr %98, align 8, !tbaa !33, !range !24, !noundef !25
  %100 = trunc i8 %99 to i1
  br i1 %100, label %106, label %101

101:                                              ; preds = %97
  %102 = getelementptr inbounds %class.Elem, ptr %9, i32 0, i32 21
  %103 = getelementptr inbounds %"struct.std::pair", ptr %102, i32 0, i32 0
  %104 = load i32, ptr %103, align 8, !tbaa !34
  %105 = icmp sgt i32 %104, -1
  br i1 %105, label %106, label %107

106:                                              ; preds = %101, %97
  store i1 false, ptr %3, align 1
  br label %138

107:                                              ; preds = %101
  %108 = getelementptr inbounds %class.Elem, ptr %9, i32 0, i32 9
  %109 = load ptr, ptr %108, align 8, !tbaa !9
  %110 = call noundef zeroext i1 @_ZNK9ElemModel15conductAnyWaterEv(ptr noundef nonnull align 8 dereferenceable(152) %109)
  br i1 %110, label %111, label %112

111:                                              ; preds = %107
  store i1 true, ptr %3, align 1
  br label %138

112:                                              ; preds = %107
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #3
  store i32 0, ptr %8, align 4, !tbaa !28
  br label %113

113:                                              ; preds = %132, %112
  %114 = load i32, ptr %8, align 4, !tbaa !28
  %115 = getelementptr inbounds %class.Elem, ptr %9, i32 0, i32 7
  %116 = load i32, ptr %115, align 8, !tbaa !29
  %117 = icmp slt i32 %114, %116
  br i1 %117, label %119, label %118

118:                                              ; preds = %113
  store i32 5, ptr %7, align 4
  br label %135

119:                                              ; preds = %113
  %120 = getelementptr inbounds %class.Elem, ptr %9, i32 0, i32 8
  %121 = load i32, ptr %8, align 4, !tbaa !28
  %122 = sext i32 %121 to i64
  %123 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNKSt6vectorIP4ElemSaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %120, i64 noundef %122) #3
  %124 = load ptr, ptr %123, align 8, !tbaa !5
  %125 = call noundef ptr @_ZNK4Elem5modelEv(ptr noundef nonnull align 8 dereferenceable(408) %124)
  %126 = load ptr, ptr %125, align 8, !tbaa !21
  %127 = getelementptr inbounds ptr, ptr %126, i64 22
  %128 = load ptr, ptr %127, align 8
  %129 = call noundef zeroext i1 %128(ptr noundef nonnull align 8 dereferenceable(152) %125)
  br i1 %129, label %130, label %131

130:                                              ; preds = %119
  store i1 true, ptr %3, align 1
  store i32 1, ptr %7, align 4
  br label %135

131:                                              ; preds = %119
  br label %132

132:                                              ; preds = %131
  %133 = load i32, ptr %8, align 4, !tbaa !28
  %134 = add nsw i32 %133, 1
  store i32 %134, ptr %8, align 4, !tbaa !28
  br label %113, !llvm.loop !35

135:                                              ; preds = %130, %118
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #3
  %136 = load i32, ptr %7, align 4
  switch i32 %136, label %140 [
    i32 5, label %137
    i32 1, label %138
  ]

137:                                              ; preds = %135
  store i1 false, ptr %3, align 1
  br label %138

138:                                              ; preds = %137, %135, %111, %106, %96, %88, %87, %81, %50, %45, %35, %21
  %139 = load i1, ptr %3, align 1
  ret i1 %139

140:                                              ; preds = %135, %81
  unreachable
}

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

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

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


; 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"

; 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 #0 align 2

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

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

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

; Function Attrs: mustprogress uwtable
define dso_local noundef zeroext i1 @_ZNK4Elem20canBeAddedToEventVecERK5Fluid(ptr noundef nonnull align 8 dereferenceable(408) %0, ptr noundef nonnull align 8 dereferenceable(80) %1) local_unnamed_addr #1 align 2 {
  %3 = getelementptr inbounds i8, ptr %0, i64 288
  %4 = load ptr, ptr %3, align 8, !tbaa !5
  %5 = load ptr, ptr %4, align 8, !tbaa !20
  %6 = getelementptr inbounds i8, ptr %5, i64 160
  %7 = load ptr, ptr %6, align 8
  %8 = tail call noundef zeroext i1 %7(ptr noundef nonnull align 8 dereferenceable(152) %4, ptr noundef nonnull align 8 dereferenceable(80) %1)
  br i1 %8, label %.loopexit, label %9

9:                                                ; preds = %2
  %10 = getelementptr inbounds i8, ptr %0, i64 310
  %11 = load i8, ptr %10, align 2, !tbaa !22, !range !23, !noundef !24
  %12 = trunc nuw i8 %11 to i1
  br i1 %12, label %13, label %.loopexit

13:                                               ; preds = %9
  %14 = tail call noundef zeroext i1 @_ZNK5Fluid5isOilEv(ptr noundef nonnull align 8 dereferenceable(80) %1)
  %15 = load ptr, ptr %3, align 8, !tbaa !5
  br i1 %14, label %16, label %52

16:                                               ; preds = %13
  %17 = load ptr, ptr %15, align 8, !tbaa !20
  %18 = getelementptr inbounds i8, ptr %17, i64 152
  %19 = load ptr, ptr %18, align 8
  %20 = tail call noundef zeroext i1 %19(ptr noundef nonnull align 8 dereferenceable(152) %15)
  br i1 %20, label %21, label %24

21:                                               ; preds = %16
  %22 = tail call noundef i32 @_ZNK4Elem9rockIndexEv(ptr noundef nonnull align 8 dereferenceable(408) %0)
  %23 = icmp eq i32 %22, 0
  br i1 %23, label %.loopexit, label %24

24:                                               ; preds = %21, %16
  %25 = getelementptr inbounds i8, ptr %0, i64 81
  %26 = load i8, ptr %25, align 1, !tbaa !25, !range !23, !noundef !24
  %27 = trunc nuw i8 %26 to i1
  %28 = getelementptr inbounds i8, ptr %0, i64 336
  %29 = load i32, ptr %28, align 8
  %30 = icmp sgt i32 %29, -1
  %or.cond = select i1 %27, i1 true, i1 %30
  br i1 %or.cond, label %.loopexit, label %31

31:                                               ; preds = %24
  %32 = load ptr, ptr %3, align 8, !tbaa !5
  %33 = tail call noundef zeroext i1 @_ZNK9ElemModel14conductsAnyOilEv(ptr noundef nonnull align 8 dereferenceable(152) %32)
  br i1 %33, label %.loopexit, label %.preheader

.preheader:                                       ; preds = %31
  %34 = getelementptr inbounds i8, ptr %0, i64 256
  %35 = load i32, ptr %34, align 8, !tbaa !26
  %.not2432 = icmp sgt i32 %35, 0
  br i1 %.not2432, label %.lr.ph34, label %.loopexit

.lr.ph34:                                         ; preds = %.preheader
  %36 = getelementptr inbounds i8, ptr %0, i64 264
  br label %37

37:                                               ; preds = %.lr.ph34, %49
  %indvars.iv41 = phi i64 [ 0, %.lr.ph34 ], [ %indvars.iv.next42, %49 ]
  %38 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZNKSt6vectorIP4ElemSaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %36, i64 noundef %indvars.iv41) #2
  %39 = load ptr, ptr %38, align 8, !tbaa !27
  %40 = tail call noundef ptr @_ZNK4Elem5modelEv(ptr noundef nonnull align 8 dereferenceable(408) %39)
  %41 = load ptr, ptr %40, align 8, !tbaa !20
  %42 = getelementptr inbounds i8, ptr %41, i64 168
  %43 = load ptr, ptr %42, align 8
  %44 = tail call noundef zeroext i1 %43(ptr noundef nonnull align 8 dereferenceable(152) %40)
  br i1 %44, label %45, label %49

45:                                               ; preds = %37
  %46 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZNKSt6vectorIP4ElemSaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %36, i64 noundef %indvars.iv41) #2
  %47 = load ptr, ptr %46, align 8, !tbaa !27
  %48 = tail call noundef zeroext i1 @_ZNK4Elem12isTrappedOilEv(ptr noundef nonnull align 8 dereferenceable(408) %47)
  br i1 %48, label %49, label %.loopexit

49:                                               ; preds = %37, %45
  %indvars.iv.next42 = add nuw nsw i64 %indvars.iv41, 1
  %50 = load i32, ptr %34, align 8, !tbaa !26
  %51 = sext i32 %50 to i64
  %.not24 = icmp slt i64 %indvars.iv.next42, %51
  br i1 %.not24, label %37, label %.loopexit, !llvm.loop !28

52:                                               ; preds = %13
  %53 = tail call noundef zeroext i1 @_ZNK9ElemModel14conductsAnyOilEv(ptr noundef nonnull align 8 dereferenceable(152) %15)
  br i1 %53, label %57, label %54

54:                                               ; preds = %52
  %55 = tail call noundef i32 @_ZNK4Elem9rockIndexEv(ptr noundef nonnull align 8 dereferenceable(408) %0)
  %56 = icmp eq i32 %55, 0
  br i1 %56, label %.loopexit, label %57

57:                                               ; preds = %54, %52
  %58 = getelementptr inbounds i8, ptr %0, i64 80
  %59 = load i8, ptr %58, align 8, !tbaa !30, !range !23, !noundef !24
  %60 = trunc nuw i8 %59 to i1
  %61 = getelementptr inbounds i8, ptr %0, i64 320
  %62 = load i32, ptr %61, align 8
  %63 = icmp sgt i32 %62, -1
  %or.cond20 = select i1 %60, i1 true, i1 %63
  br i1 %or.cond20, label %.loopexit, label %64

64:                                               ; preds = %57
  %65 = load ptr, ptr %3, align 8, !tbaa !5
  %66 = tail call noundef zeroext i1 @_ZNK9ElemModel15conductAnyWaterEv(ptr noundef nonnull align 8 dereferenceable(152) %65)
  br i1 %66, label %.loopexit, label %.preheader25

.preheader25:                                     ; preds = %64
  %67 = getelementptr inbounds i8, ptr %0, i64 256
  %68 = load i32, ptr %67, align 8, !tbaa !26
  %.not28 = icmp sgt i32 %68, 0
  br i1 %.not28, label %.lr.ph, label %.loopexit

.lr.ph:                                           ; preds = %.preheader25
  %69 = getelementptr inbounds i8, ptr %0, i64 264
  br label %73

70:                                               ; preds = %73
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %71 = load i32, ptr %67, align 8, !tbaa !26
  %72 = sext i32 %71 to i64
  %.not = icmp slt i64 %indvars.iv.next, %72
  br i1 %.not, label %73, label %.loopexit, !llvm.loop !31

73:                                               ; preds = %.lr.ph, %70
  %indvars.iv = phi i64 [ 0, %.lr.ph ], [ %indvars.iv.next, %70 ]
  %74 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZNKSt6vectorIP4ElemSaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %69, i64 noundef %indvars.iv) #2
  %75 = load ptr, ptr %74, align 8, !tbaa !27
  %76 = tail call noundef ptr @_ZNK4Elem5modelEv(ptr noundef nonnull align 8 dereferenceable(408) %75)
  %77 = load ptr, ptr %76, align 8, !tbaa !20
  %78 = getelementptr inbounds i8, ptr %77, i64 176
  %79 = load ptr, ptr %78, align 8
  %80 = tail call noundef zeroext i1 %79(ptr noundef nonnull align 8 dereferenceable(152) %76)
  br i1 %80, label %.loopexit, label %70

.loopexit:                                        ; preds = %73, %70, %45, %49, %.preheader25, %.preheader, %64, %57, %54, %31, %24, %21, %2, %9
  %.2 = phi i1 [ false, %9 ], [ false, %2 ], [ false, %21 ], [ false, %24 ], [ true, %31 ], [ false, %54 ], [ false, %57 ], [ true, %64 ], [ false, %.preheader ], [ false, %.preheader25 ], [ true, %45 ], [ false, %49 ], [ %80, %70 ], [ %80, %73 ]
  ret i1 %.2
}

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

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

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

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


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