; LLVM IR from ImperialCollegeLondon/pnflow :: src/pnm/pnflow/ElementConstSolver.ll (ZNK4Elem22markWaterElemForSolverEPKS_6fluidf)

; 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.std::vector.31" = type { %"struct.std::_Vector_base.32" }
%"struct.std::_Vector_base.32" = type { %"struct.std::_Vector_base<const Elem *, std::allocator<const Elem *>>::_Vector_impl" }
%"struct.std::_Vector_base<const Elem *, std::allocator<const Elem *>>::_Vector_impl" = type { %"struct.std::_Vector_base<const Elem *, std::allocator<const Elem *>>::_Vector_impl_data" }
%"struct.std::_Vector_base<const Elem *, std::allocator<const Elem *>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.std::stack" = type { %"class.std::deque" }
%"class.std::deque" = type { %"class.std::_Deque_base" }
%"class.std::_Deque_base" = type { %"struct.std::_Deque_base<const Elem *, std::allocator<const Elem *>>::_Deque_impl" }
%"struct.std::_Deque_base<const Elem *, std::allocator<const Elem *>>::_Deque_impl" = type { %"struct.std::_Deque_base<const Elem *, std::allocator<const Elem *>>::_Deque_impl_data" }
%"struct.std::_Deque_base<const Elem *, std::allocator<const Elem *>>::_Deque_impl_data" = type { ptr, i64, %"struct.std::_Deque_iterator", %"struct.std::_Deque_iterator" }
%"struct.std::_Deque_iterator" = type { ptr, ptr, ptr, ptr }

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

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

declare i32 @__gxx_personality_v0(...)

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(24) ptr @_ZNK4Elem8slvrCnctE6fluidf(ptr noundef nonnull align 8 dereferenceable(408), i16 noundef zeroext) #1 align 2

; Function Attrs: mustprogress uwtable
define dso_local noundef zeroext i1 @_ZNK4Elem22markWaterElemForSolverEPKS_6fluidf(ptr noundef nonnull align 8 dereferenceable(408) %0, ptr noundef %1, i16 noundef zeroext %2) #2 align 2 personality ptr @__gxx_personality_v0 {
  %4 = alloca i1, align 1
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca i16, align 2
  %8 = alloca %"class.std::vector.31", align 8
  %9 = alloca %"class.std::stack", align 8
  %10 = alloca ptr, align 8
  %11 = alloca i32, align 4
  %12 = alloca i8, align 1
  %13 = alloca i64, align 8
  store ptr %0, ptr %5, align 8, !tbaa !5
  store ptr %1, ptr %6, align 8, !tbaa !5
  store i16 %2, ptr %7, align 2, !tbaa !9
  %14 = load ptr, ptr %5, align 8
  %15 = load ptr, ptr %6, align 8, !tbaa !5
  %16 = call noundef ptr @_ZNK4Elem5modelEv(ptr noundef nonnull align 8 dereferenceable(408) %15)
  %17 = call noundef zeroext i1 @_ZNK9ElemModel15conductAnyWaterEv(ptr noundef nonnull align 8 dereferenceable(152) %16)
  br i1 %17, label %21, label %18

18:                                               ; preds = %3
  %19 = load ptr, ptr %6, align 8, !tbaa !5
  %20 = call noundef zeroext i1 @_ZNK4Elem22connectedToEntryOrExitEv(ptr noundef nonnull align 8 dereferenceable(408) %19)
  br i1 %20, label %21, label %29

21:                                               ; preds = %18, %3
  %22 = load ptr, ptr %6, align 8, !tbaa !5
  %23 = load i16, ptr %7, align 2, !tbaa !9
  %24 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNK4Elem8slvrCnctE6fluidf(ptr noundef nonnull align 8 dereferenceable(408) %22, i16 noundef zeroext %23)
  %25 = call noundef zeroext i1 @_ZNK7SlvrElm10isSearchedEv(ptr noundef nonnull align 8 dereferenceable(24) %24)
  br i1 %25, label %29, label %26

26:                                               ; preds = %21
  %27 = load ptr, ptr %6, align 8, !tbaa !5
  %28 = call noundef zeroext i1 @_ZNK4Elem17isInsideSolverBoxEv(ptr noundef nonnull align 8 dereferenceable(408) %27)
  br i1 %28, label %30, label %29

29:                                               ; preds = %26, %21, %18
  store i1 false, ptr %4, align 1
  br label %113

30:                                               ; preds = %26
  call void @llvm.lifetime.start.p0(i64 24, ptr %8) #4
  call void @_ZNSt6vectorIPK4ElemSaIS2_EEC2Ev(ptr noundef nonnull align 8 dereferenceable(24) %8) #4
  call void @llvm.lifetime.start.p0(i64 80, ptr %9) #4
  invoke void @_ZNSt5stackIPK4ElemSt5dequeIS2_SaIS2_EEEC2IS5_vEEv(ptr noundef nonnull align 8 dereferenceable(80) %9)
          to label %31 unwind label %56

31:                                               ; preds = %30
  invoke void @_ZNSt5stackIPK4ElemSt5dequeIS2_SaIS2_EEE4pushERKS2_(ptr noundef nonnull align 8 dereferenceable(80) %9, ptr noundef nonnull align 8 dereferenceable(8) %6)
          to label %32 unwind label %60

32:                                               ; preds = %31
  call void @llvm.lifetime.start.p0(i64 1, ptr %12) #4
  store i8 0, ptr %12, align 1, !tbaa !11
  br label %33

33:                                               ; preds = %81, %32
  %34 = load ptr, ptr %6, align 8, !tbaa !5
  %35 = icmp ne ptr %34, null
  br i1 %35, label %36, label %82

36:                                               ; preds = %33
  %37 = load ptr, ptr %6, align 8, !tbaa !5
  %38 = load i16, ptr %7, align 2, !tbaa !9
  %39 = invoke noundef nonnull align 8 dereferenceable(24) ptr @_ZNK4Elem8slvrCnctE6fluidf(ptr noundef nonnull align 8 dereferenceable(408) %37, i16 noundef zeroext %38)
          to label %40 unwind label %64

40:                                               ; preds = %36
  invoke void @_ZNK7SlvrElm11setAllFlagsEv(ptr noundef nonnull align 8 dereferenceable(24) %39)
          to label %41 unwind label %64

41:                                               ; preds = %40
  invoke void @_ZNSt6vectorIPK4ElemSaIS2_EE9push_backERKS2_(ptr noundef nonnull align 8 dereferenceable(24) %8, ptr noundef nonnull align 8 dereferenceable(8) %6)
          to label %42 unwind label %64

42:                                               ; preds = %41
  %43 = load ptr, ptr %6, align 8, !tbaa !5
  %44 = load i16, ptr %7, align 2, !tbaa !9
  %45 = invoke noundef ptr @_ZNK4Elem16nextSuccSolvrWatERb6fluidf(ptr noundef nonnull align 8 dereferenceable(408) %43, ptr noundef nonnull align 1 dereferenceable(1) %12, i16 noundef zeroext %44)
          to label %46 unwind label %64

46:                                               ; preds = %42
  store ptr %45, ptr %6, align 8, !tbaa !5
  br label %47

47:                                               ; preds = %75, %46
  %48 = load ptr, ptr %6, align 8, !tbaa !5
  %49 = icmp ne ptr %48, null
  %50 = xor i1 %49, true
  br i1 %50, label %51, label %76

51:                                               ; preds = %47
  invoke void @_ZNSt5stackIPK4ElemSt5dequeIS2_SaIS2_EEE3popEv(ptr noundef nonnull align 8 dereferenceable(80) %9)
          to label %52 unwind label %64

52:                                               ; preds = %51
  %53 = invoke noundef zeroext i1 @_ZNKSt5stackIPK4ElemSt5dequeIS2_SaIS2_EEE5emptyEv(ptr noundef nonnull align 8 dereferenceable(80) %9)
          to label %54 unwind label %64

54:                                               ; preds = %52
  br i1 %53, label %55, label %68

55:                                               ; preds = %54
  br label %76

56:                                               ; preds = %30
  %57 = landingpad { ptr, i32 }
          cleanup
  %58 = extractvalue { ptr, i32 } %57, 0
  store ptr %58, ptr %10, align 8
  %59 = extractvalue { ptr, i32 } %57, 1
  store i32 %59, ptr %11, align 4
  br label %112

60:                                               ; preds = %31
  %61 = landingpad { ptr, i32 }
          cleanup
  %62 = extractvalue { ptr, i32 } %61, 0
  store ptr %62, ptr %10, align 8
  %63 = extractvalue { ptr, i32 } %61, 1
  store i32 %63, ptr %11, align 4
  br label %111

64:                                               ; preds = %79, %70, %68, %52, %51, %42, %41, %40, %36
  %65 = landingpad { ptr, i32 }
          cleanup
  %66 = extractvalue { ptr, i32 } %65, 0
  store ptr %66, ptr %10, align 8
  %67 = extractvalue { ptr, i32 } %65, 1
  store i32 %67, ptr %11, align 4
  br label %110

68:                                               ; preds = %54
  %69 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt5stackIPK4ElemSt5dequeIS2_SaIS2_EEE3topEv(ptr noundef nonnull align 8 dereferenceable(80) %9)
          to label %70 unwind label %64

70:                                               ; preds = %68
  %71 = load ptr, ptr %69, align 8, !tbaa !5
  store ptr %71, ptr %6, align 8, !tbaa !5
  %72 = load ptr, ptr %6, align 8, !tbaa !5
  %73 = load i16, ptr %7, align 2, !tbaa !9
  %74 = invoke noundef ptr @_ZNK4Elem16nextSuccSolvrWatERb6fluidf(ptr noundef nonnull align 8 dereferenceable(408) %72, ptr noundef nonnull align 1 dereferenceable(1) %12, i16 noundef zeroext %73)
          to label %75 unwind label %64

75:                                               ; preds = %70
  store ptr %74, ptr %6, align 8, !tbaa !5
  br label %47, !llvm.loop !13

76:                                               ; preds = %55, %47
  %77 = load ptr, ptr %6, align 8, !tbaa !5
  %78 = icmp ne ptr %77, null
  br i1 %78, label %79, label %81

79:                                               ; preds = %76
  invoke void @_ZNSt5stackIPK4ElemSt5dequeIS2_SaIS2_EEE4pushERKS2_(ptr noundef nonnull align 8 dereferenceable(80) %9, ptr noundef nonnull align 8 dereferenceable(8) %6)
          to label %80 unwind label %64

80:                                               ; preds = %79
  br label %81

81:                                               ; preds = %80, %76
  br label %33, !llvm.loop !15

82:                                               ; preds = %33
  %83 = load i8, ptr %12, align 1, !tbaa !11, !range !16, !noundef !17
  %84 = trunc i8 %83 to i1
  br i1 %84, label %107, label %85

85:                                               ; preds = %82
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #4
  store i64 0, ptr %13, align 8, !tbaa !18
  br label %86

86:                                               ; preds = %99, %85
  %87 = load i64, ptr %13, align 8, !tbaa !18
  %88 = call noundef i64 @_ZNKSt6vectorIPK4ElemSaIS2_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %8) #4
  %89 = icmp ult i64 %87, %88
  br i1 %89, label %91, label %90

90:                                               ; preds = %86
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #4
  br label %106

91:                                               ; preds = %86
  %92 = load i64, ptr %13, align 8, !tbaa !18
  %93 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIPK4ElemSaIS2_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %8, i64 noundef %92) #4
  %94 = load ptr, ptr %93, align 8, !tbaa !5
  %95 = load i16, ptr %7, align 2, !tbaa !9
  %96 = invoke noundef nonnull align 8 dereferenceable(24) ptr @_ZNK4Elem8slvrCnctE6fluidf(ptr noundef nonnull align 8 dereferenceable(408) %94, i16 noundef zeroext %95)
          to label %97 unwind label %102

97:                                               ; preds = %91
  invoke void @_ZNK7SlvrElm9clearFlagEv(ptr noundef nonnull align 8 dereferenceable(24) %96)
          to label %98 unwind label %102

98:                                               ; preds = %97
  br label %99

99:                                               ; preds = %98
  %100 = load i64, ptr %13, align 8, !tbaa !18
  %101 = add i64 %100, 1
  store i64 %101, ptr %13, align 8, !tbaa !18
  br label %86, !llvm.loop !20

102:                                              ; preds = %97, %91
  %103 = landingpad { ptr, i32 }
          cleanup
  %104 = extractvalue { ptr, i32 } %103, 0
  store ptr %104, ptr %10, align 8
  %105 = extractvalue { ptr, i32 } %103, 1
  store i32 %105, ptr %11, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #4
  br label %110

106:                                              ; preds = %90
  br label %107

107:                                              ; preds = %106, %82
  %108 = load i8, ptr %12, align 1, !tbaa !11, !range !16, !noundef !17
  %109 = trunc i8 %108 to i1
  store i1 %109, ptr %4, align 1
  call void @llvm.lifetime.end.p0(i64 1, ptr %12) #4
  call void @_ZNSt5stackIPK4ElemSt5dequeIS2_SaIS2_EEED2Ev(ptr noundef nonnull align 8 dereferenceable(80) %9) #4
  call void @llvm.lifetime.end.p0(i64 80, ptr %9) #4
  call void @_ZNSt6vectorIPK4ElemSaIS2_EED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %8) #4
  call void @llvm.lifetime.end.p0(i64 24, ptr %8) #4
  br label %113

110:                                              ; preds = %102, %64
  call void @llvm.lifetime.end.p0(i64 1, ptr %12) #4
  br label %111

111:                                              ; preds = %110, %60
  call void @_ZNSt5stackIPK4ElemSt5dequeIS2_SaIS2_EEED2Ev(ptr noundef nonnull align 8 dereferenceable(80) %9) #4
  br label %112

112:                                              ; preds = %111, %56
  call void @llvm.lifetime.end.p0(i64 80, ptr %9) #4
  call void @_ZNSt6vectorIPK4ElemSaIS2_EED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %8) #4
  call void @llvm.lifetime.end.p0(i64 24, ptr %8) #4
  br label %115

113:                                              ; preds = %107, %29
  %114 = load i1, ptr %4, align 1
  ret i1 %114

115:                                              ; preds = %112
  %116 = load ptr, ptr %10, align 8
  %117 = load i32, ptr %11, align 4
  %118 = insertvalue { ptr, i32 } poison, ptr %116, 0
  %119 = insertvalue { ptr, i32 } %118, i32 %117, 1
  resume { ptr, i32 } %119
}

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

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

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

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

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

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

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

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

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

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

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

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

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt6vectorIPK4ElemSaIS2_EED2Ev(ptr noundef nonnull align 8 dereferenceable(24)) unnamed_addr #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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef ptr @_ZNK4Elem16nextSuccSolvrWatERb6fluidf(ptr noundef nonnull align 8 dereferenceable(408), ptr noundef nonnull align 1 dereferenceable(1), i16 noundef zeroext) #3 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 = { inlinehint 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 = { 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 = !{!"_ZTS6fluidf", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"bool", !7, i64 0}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}
!15 = distinct !{!15, !14}
!16 = !{i8 0, i8 2}
!17 = !{}
!18 = !{!19, !19, i64 0}
!19 = !{!"long", !7, i64 0}
!20 = distinct !{!20, !14}


; 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.std::vector.31" = type { %"struct.std::_Vector_base.32" }
%"struct.std::_Vector_base.32" = type { %"struct.std::_Vector_base<const Elem *, std::allocator<const Elem *>>::_Vector_impl" }
%"struct.std::_Vector_base<const Elem *, std::allocator<const Elem *>>::_Vector_impl" = type { %"struct.std::_Vector_base<const Elem *, std::allocator<const Elem *>>::_Vector_impl_data" }
%"struct.std::_Vector_base<const Elem *, std::allocator<const Elem *>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.std::stack" = type { %"class.std::deque" }
%"class.std::deque" = type { %"class.std::_Deque_base" }
%"class.std::_Deque_base" = type { %"struct.std::_Deque_base<const Elem *, std::allocator<const Elem *>>::_Deque_impl" }
%"struct.std::_Deque_base<const Elem *, std::allocator<const Elem *>>::_Deque_impl" = type { %"struct.std::_Deque_base<const Elem *, std::allocator<const Elem *>>::_Deque_impl_data" }
%"struct.std::_Deque_base<const Elem *, std::allocator<const Elem *>>::_Deque_impl_data" = type { ptr, i64, %"struct.std::_Deque_iterator", %"struct.std::_Deque_iterator" }
%"struct.std::_Deque_iterator" = type { ptr, ptr, ptr, ptr }

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

declare i32 @__gxx_personality_v0(...)

; 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 nonnull align 8 dereferenceable(24) ptr @_ZNK4Elem8slvrCnctE6fluidf(ptr noundef nonnull align 8 dereferenceable(408), i16 noundef zeroext) local_unnamed_addr #1 align 2

; Function Attrs: mustprogress uwtable
define dso_local noundef zeroext i1 @_ZNK4Elem22markWaterElemForSolverEPKS_6fluidf(ptr nocapture noundef nonnull readnone align 8 dereferenceable(408) %0, ptr noundef nonnull %1, i16 noundef zeroext %2) local_unnamed_addr #2 align 2 personality ptr @__gxx_personality_v0 {
  %4 = alloca ptr, align 8
  %5 = alloca %"class.std::vector.31", align 8
  %6 = alloca %"class.std::stack", align 8
  %7 = alloca i8, align 1
  store ptr %1, ptr %4, align 8, !tbaa !5
  %8 = tail call noundef ptr @_ZNK4Elem5modelEv(ptr noundef nonnull align 8 dereferenceable(408) %1)
  %9 = tail call noundef zeroext i1 @_ZNK9ElemModel15conductAnyWaterEv(ptr noundef nonnull align 8 dereferenceable(152) %8)
  br i1 %9, label %12, label %10

10:                                               ; preds = %3
  %11 = tail call noundef zeroext i1 @_ZNK4Elem22connectedToEntryOrExitEv(ptr noundef nonnull align 8 dereferenceable(408) %1)
  br i1 %11, label %12, label %51

12:                                               ; preds = %10, %3
  %13 = tail call noundef nonnull align 8 dereferenceable(24) ptr @_ZNK4Elem8slvrCnctE6fluidf(ptr noundef nonnull align 8 dereferenceable(408) %1, i16 noundef zeroext %2)
  %14 = tail call noundef zeroext i1 @_ZNK7SlvrElm10isSearchedEv(ptr noundef nonnull align 8 dereferenceable(24) %13)
  br i1 %14, label %51, label %15

15:                                               ; preds = %12
  %16 = tail call noundef zeroext i1 @_ZNK4Elem17isInsideSolverBoxEv(ptr noundef nonnull align 8 dereferenceable(408) %1)
  br i1 %16, label %17, label %51

17:                                               ; preds = %15
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %5) #4
  call void @_ZNSt6vectorIPK4ElemSaIS2_EEC2Ev(ptr noundef nonnull align 8 dereferenceable(24) %5) #4
  call void @llvm.lifetime.start.p0(i64 80, ptr nonnull %6) #4
  invoke void @_ZNSt5stackIPK4ElemSt5dequeIS2_SaIS2_EEEC2IS5_vEEv(ptr noundef nonnull align 8 dereferenceable(80) %6)
          to label %18 unwind label %27

18:                                               ; preds = %17
  invoke void @_ZNSt5stackIPK4ElemSt5dequeIS2_SaIS2_EEE4pushERKS2_(ptr noundef nonnull align 8 dereferenceable(80) %6, ptr noundef nonnull align 8 dereferenceable(8) %4)
          to label %19 unwind label %29

19:                                               ; preds = %18
  call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %7) #4
  store i8 0, ptr %7, align 1, !tbaa !9
  %20 = load ptr, ptr %4, align 8, !tbaa !5
  %.not22 = icmp eq ptr %20, null
  br i1 %.not22, label %.preheader, label %.lr.ph23

.lr.ph23:                                         ; preds = %19, %38
  %21 = phi ptr [ %.pre, %38 ], [ %20, %19 ]
  %22 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNK4Elem8slvrCnctE6fluidf(ptr noundef nonnull align 8 dereferenceable(408) %21, i16 noundef zeroext %2)
  call void @_ZNK7SlvrElm11setAllFlagsEv(ptr noundef nonnull align 8 dereferenceable(24) %22)
  invoke void @_ZNSt6vectorIPK4ElemSaIS2_EE9push_backERKS2_(ptr noundef nonnull align 8 dereferenceable(24) %5, ptr noundef nonnull align 8 dereferenceable(8) %4)
          to label %23 unwind label %31

23:                                               ; preds = %.lr.ph23
  %24 = load ptr, ptr %4, align 8, !tbaa !5
  %25 = call noundef ptr @_ZNK4Elem16nextSuccSolvrWatERb6fluidf(ptr noundef nonnull align 8 dereferenceable(408) %24, ptr noundef nonnull align 1 dereferenceable(1) %7, i16 noundef zeroext %2)
  store ptr %25, ptr %4, align 8, !tbaa !5
  %.not1621 = icmp eq ptr %25, null
  br i1 %.not1621, label %.lr.ph, label %.thread

.lr.ph:                                           ; preds = %23, %33
  call void @_ZNSt5stackIPK4ElemSt5dequeIS2_SaIS2_EEE3popEv(ptr noundef nonnull align 8 dereferenceable(80) %6)
  %26 = call noundef zeroext i1 @_ZNKSt5stackIPK4ElemSt5dequeIS2_SaIS2_EEE5emptyEv(ptr noundef nonnull align 8 dereferenceable(80) %6)
  br i1 %26, label %37, label %33

27:                                               ; preds = %17
  %28 = landingpad { ptr, i32 }
          cleanup
  br label %50

29:                                               ; preds = %18
  %30 = landingpad { ptr, i32 }
          cleanup
  br label %49

31:                                               ; preds = %.thread, %.lr.ph23
  %32 = landingpad { ptr, i32 }
          cleanup
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %7) #4
  br label %49

33:                                               ; preds = %.lr.ph
  %34 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt5stackIPK4ElemSt5dequeIS2_SaIS2_EEE3topEv(ptr noundef nonnull align 8 dereferenceable(80) %6)
  %35 = load ptr, ptr %34, align 8, !tbaa !5
  store ptr %35, ptr %4, align 8, !tbaa !5
  %36 = call noundef ptr @_ZNK4Elem16nextSuccSolvrWatERb6fluidf(ptr noundef nonnull align 8 dereferenceable(408) %35, ptr noundef nonnull align 1 dereferenceable(1) %7, i16 noundef zeroext %2)
  store ptr %36, ptr %4, align 8, !tbaa !5
  %.not16 = icmp eq ptr %36, null
  br i1 %.not16, label %.lr.ph, label %.thread, !llvm.loop !11

37:                                               ; preds = %.lr.ph
  %.pr = load ptr, ptr %4, align 8, !tbaa !5
  %.not17 = icmp eq ptr %.pr, null
  br i1 %.not17, label %._crit_edge, label %.thread

.thread:                                          ; preds = %33, %23, %37
  invoke void @_ZNSt5stackIPK4ElemSt5dequeIS2_SaIS2_EEE4pushERKS2_(ptr noundef nonnull align 8 dereferenceable(80) %6, ptr noundef nonnull align 8 dereferenceable(8) %4)
          to label %38 unwind label %31

38:                                               ; preds = %.thread
  %.pre = load ptr, ptr %4, align 8, !tbaa !5
  %.not = icmp eq ptr %.pre, null
  br i1 %.not, label %._crit_edge, label %.lr.ph23, !llvm.loop !13

._crit_edge:                                      ; preds = %37, %38
  %.pre27 = load i8, ptr %7, align 1, !tbaa !9, !range !14
  %39 = trunc nuw i8 %.pre27 to i1
  br i1 %39, label %.loopexit, label %.preheader

.preheader:                                       ; preds = %19, %._crit_edge
  %40 = call noundef i64 @_ZNKSt6vectorIPK4ElemSaIS2_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %5) #4
  %.not26 = icmp eq i64 %40, 0
  br i1 %.not26, label %.loopexit, label %.lr.ph25

.lr.ph25:                                         ; preds = %.preheader, %.lr.ph25
  %.024 = phi i64 [ %44, %.lr.ph25 ], [ 0, %.preheader ]
  %41 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIPK4ElemSaIS2_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %5, i64 noundef %.024) #4
  %42 = load ptr, ptr %41, align 8, !tbaa !5
  %43 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNK4Elem8slvrCnctE6fluidf(ptr noundef nonnull align 8 dereferenceable(408) %42, i16 noundef zeroext %2)
  call void @_ZNK7SlvrElm9clearFlagEv(ptr noundef nonnull align 8 dereferenceable(24) %43)
  %44 = add nuw i64 %.024, 1
  %45 = call noundef i64 @_ZNKSt6vectorIPK4ElemSaIS2_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %5) #4
  %46 = icmp ult i64 %44, %45
  br i1 %46, label %.lr.ph25, label %.loopexit, !llvm.loop !15

.loopexit:                                        ; preds = %.lr.ph25, %.preheader, %._crit_edge
  %47 = load i8, ptr %7, align 1, !tbaa !9, !range !14, !noundef !16
  %48 = trunc nuw i8 %47 to i1
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %7) #4
  call void @_ZNSt5stackIPK4ElemSt5dequeIS2_SaIS2_EEED2Ev(ptr noundef nonnull align 8 dereferenceable(80) %6) #4
  call void @llvm.lifetime.end.p0(i64 80, ptr nonnull %6) #4
  call void @_ZNSt6vectorIPK4ElemSaIS2_EED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %5) #4
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %5) #4
  br label %51

49:                                               ; preds = %31, %29
  %.pn = phi { ptr, i32 } [ %32, %31 ], [ %30, %29 ]
  call void @_ZNSt5stackIPK4ElemSt5dequeIS2_SaIS2_EEED2Ev(ptr noundef nonnull align 8 dereferenceable(80) %6) #4
  br label %50

50:                                               ; preds = %49, %27
  %.pn.pn = phi { ptr, i32 } [ %.pn, %49 ], [ %28, %27 ]
  call void @llvm.lifetime.end.p0(i64 80, ptr nonnull %6) #4
  call void @_ZNSt6vectorIPK4ElemSaIS2_EED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %5) #4
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %5) #4
  resume { ptr, i32 } %.pn.pn

51:                                               ; preds = %10, %12, %15, %.loopexit
  %.014 = phi i1 [ %48, %.loopexit ], [ false, %15 ], [ false, %12 ], [ false, %10 ]
  ret i1 %.014
}

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

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

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

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

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

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

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

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

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

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i64 @_ZNKSt6vectorIPK4ElemSaIS2_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 @_ZNSt6vectorIPK4ElemSaIS2_EEixEm(ptr noundef nonnull align 8 dereferenceable(24), i64 noundef) local_unnamed_addr #1 align 2

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

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

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

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef ptr @_ZNK4Elem16nextSuccSolvrWatERb6fluidf(ptr noundef nonnull align 8 dereferenceable(408), ptr noundef nonnull align 1 dereferenceable(1), i16 noundef zeroext) local_unnamed_addr #3 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 = { inlinehint 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 = { 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 = !{!"bool", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = distinct !{!13, !12}
!14 = !{i8 0, i8 2}
!15 = distinct !{!15, !12}
!16 = !{}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass,TailCallElimPass