; LLVM IR from thekyria/elabtsaot2 :: gui/powersystem_editor/powersystem_model (pwsschematicmodel)

; 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.elabtsaot::PwsModel" = type { ptr, ptr, %"class.boost::ptr_vector", %"class.boost::ptr_vector", %"class.boost::ptr_vector", %"class.boost::ptr_vector" }
%"class.boost::ptr_vector" = type { %"class.boost::ptr_sequence_adapter" }
%"class.boost::ptr_sequence_adapter" = type { %"class.boost::ptr_container_detail::reversible_ptr_container" }
%"class.boost::ptr_container_detail::reversible_ptr_container" = type { %"class.std::vector" }
%"class.std::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<void *, std::allocator<void *>>::_Vector_impl" }
%"struct.std::_Vector_base<void *, std::allocator<void *>>::_Vector_impl" = type { %"struct.std::_Vector_base<void *, std::allocator<void *>>::_Vector_impl_data" }
%"struct.std::_Vector_base<void *, std::allocator<void *>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.elabtsaot::PwsModelElement" = type { ptr, i32, i32 }

@_ZTIN9elabtsaot15PwsModelElementE = external dso_local constant { ptr, ptr }, align 8
@_ZTIN9elabtsaot24PwsSchematicModelElementE = external dso_local constant { ptr, ptr, ptr }, align 8

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

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

; Function Attrs: mustprogress uwtable
define dso_local noundef ptr @_ZN9elabtsaot17PwsSchematicModel7elementEijPi(ptr noundef nonnull align 8 dereferenceable(112) %0, i32 noundef %1, i32 noundef %2, ptr noundef %3) #2 align 2 {
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca ptr, align 8
  %10 = alloca i64, align 8
  %11 = alloca i32, align 4
  %12 = alloca i64, align 8
  %13 = alloca i64, align 8
  %14 = alloca i64, align 8
  store ptr %0, ptr %6, align 8, !tbaa !5
  store i32 %1, ptr %7, align 4, !tbaa !9
  store i32 %2, ptr %8, align 4, !tbaa !9
  store ptr %3, ptr %9, align 8, !tbaa !5
  %15 = load ptr, ptr %6, align 8
  %16 = load i32, ptr %7, align 4, !tbaa !9
  switch i32 %16, label %173 [
    i32 0, label %17
    i32 1, label %56
    i32 2, label %95
    i32 3, label %134
  ]

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

18:                                               ; preds = %50, %17
  %19 = load i64, ptr %10, align 8, !tbaa !11
  %20 = getelementptr inbounds %"class.elabtsaot::PwsModel", ptr %15, i32 0, i32 2
  %21 = call noundef i64 @_ZNK5boost20ptr_container_detail24reversible_ptr_containerINS0_15sequence_configIN9elabtsaot15PwsModelElementESt6vectorIPvSaIS6_EEEENS_20heap_clone_allocatorEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %20)
  %22 = icmp ne i64 %19, %21
  br i1 %22, label %24, label %23

23:                                               ; preds = %18
  store i32 3, ptr %11, align 4
  br label %53

24:                                               ; preds = %18
  %25 = getelementptr inbounds %"class.elabtsaot::PwsModel", ptr %15, i32 0, i32 2
  %26 = load i64, ptr %10, align 8, !tbaa !11
  %27 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZN5boost20ptr_sequence_adapterIN9elabtsaot15PwsModelElementESt6vectorIPvSaIS4_EENS_20heap_clone_allocatorEE2atEm(ptr noundef nonnull align 8 dereferenceable(24) %25, i64 noundef %26)
  %28 = getelementptr inbounds %"class.elabtsaot::PwsModelElement", ptr %27, i32 0, i32 2
  %29 = load i32, ptr %28, align 4, !tbaa !13
  %30 = load i32, ptr %8, align 4, !tbaa !9
  %31 = icmp eq i32 %29, %30
  br i1 %31, label %32, label %49

32:                                               ; preds = %24
  %33 = load ptr, ptr %9, align 8, !tbaa !5
  %34 = icmp ne ptr %33, null
  br i1 %34, label %35, label %39

35:                                               ; preds = %32
  %36 = load i64, ptr %10, align 8, !tbaa !11
  %37 = trunc i64 %36 to i32
  %38 = load ptr, ptr %9, align 8, !tbaa !5
  store i32 %37, ptr %38, align 4, !tbaa !9
  br label %39

39:                                               ; preds = %35, %32
  %40 = getelementptr inbounds %"class.elabtsaot::PwsModel", ptr %15, i32 0, i32 2
  %41 = load i64, ptr %10, align 8, !tbaa !11
  %42 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZN5boost20ptr_sequence_adapterIN9elabtsaot15PwsModelElementESt6vectorIPvSaIS4_EENS_20heap_clone_allocatorEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %40, i64 noundef %41)
  %43 = icmp eq ptr %42, null
  br i1 %43, label %46, label %44

44:                                               ; preds = %39
  %45 = call ptr @__dynamic_cast(ptr %42, ptr @_ZTIN9elabtsaot15PwsModelElementE, ptr @_ZTIN9elabtsaot24PwsSchematicModelElementE, i64 0) #4
  br label %47

46:                                               ; preds = %39
  br label %47

47:                                               ; preds = %46, %44
  %48 = phi ptr [ %45, %44 ], [ null, %46 ]
  store ptr %48, ptr %5, align 8
  store i32 1, ptr %11, align 4
  br label %53

49:                                               ; preds = %24
  br label %50

50:                                               ; preds = %49
  %51 = load i64, ptr %10, align 8, !tbaa !11
  %52 = add i64 %51, 1
  store i64 %52, ptr %10, align 8, !tbaa !11
  br label %18, !llvm.loop !15

53:                                               ; preds = %47, %23
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #4
  %54 = load i32, ptr %11, align 4
  switch i32 %54, label %187 [
    i32 3, label %55
    i32 1, label %185
  ]

55:                                               ; preds = %53
  br label %179

56:                                               ; preds = %4
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #4
  store i64 0, ptr %12, align 8, !tbaa !11
  br label %57

57:                                               ; preds = %89, %56
  %58 = load i64, ptr %12, align 8, !tbaa !11
  %59 = getelementptr inbounds %"class.elabtsaot::PwsModel", ptr %15, i32 0, i32 3
  %60 = call noundef i64 @_ZNK5boost20ptr_container_detail24reversible_ptr_containerINS0_15sequence_configIN9elabtsaot15PwsModelElementESt6vectorIPvSaIS6_EEEENS_20heap_clone_allocatorEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %59)
  %61 = icmp ne i64 %58, %60
  br i1 %61, label %63, label %62

62:                                               ; preds = %57
  store i32 6, ptr %11, align 4
  br label %92

63:                                               ; preds = %57
  %64 = getelementptr inbounds %"class.elabtsaot::PwsModel", ptr %15, i32 0, i32 3
  %65 = load i64, ptr %12, align 8, !tbaa !11
  %66 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZN5boost20ptr_sequence_adapterIN9elabtsaot15PwsModelElementESt6vectorIPvSaIS4_EENS_20heap_clone_allocatorEE2atEm(ptr noundef nonnull align 8 dereferenceable(24) %64, i64 noundef %65)
  %67 = getelementptr inbounds %"class.elabtsaot::PwsModelElement", ptr %66, i32 0, i32 2
  %68 = load i32, ptr %67, align 4, !tbaa !13
  %69 = load i32, ptr %8, align 4, !tbaa !9
  %70 = icmp eq i32 %68, %69
  br i1 %70, label %71, label %88

71:                                               ; preds = %63
  %72 = load ptr, ptr %9, align 8, !tbaa !5
  %73 = icmp ne ptr %72, null
  br i1 %73, label %74, label %78

74:                                               ; preds = %71
  %75 = load i64, ptr %12, align 8, !tbaa !11
  %76 = trunc i64 %75 to i32
  %77 = load ptr, ptr %9, align 8, !tbaa !5
  store i32 %76, ptr %77, align 4, !tbaa !9
  br label %78

78:                                               ; preds = %74, %71
  %79 = getelementptr inbounds %"class.elabtsaot::PwsModel", ptr %15, i32 0, i32 3
  %80 = load i64, ptr %12, align 8, !tbaa !11
  %81 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZN5boost20ptr_sequence_adapterIN9elabtsaot15PwsModelElementESt6vectorIPvSaIS4_EENS_20heap_clone_allocatorEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %79, i64 noundef %80)
  %82 = icmp eq ptr %81, null
  br i1 %82, label %85, label %83

83:                                               ; preds = %78
  %84 = call ptr @__dynamic_cast(ptr %81, ptr @_ZTIN9elabtsaot15PwsModelElementE, ptr @_ZTIN9elabtsaot24PwsSchematicModelElementE, i64 0) #4
  br label %86

85:                                               ; preds = %78
  br label %86

86:                                               ; preds = %85, %83
  %87 = phi ptr [ %84, %83 ], [ null, %85 ]
  store ptr %87, ptr %5, align 8
  store i32 1, ptr %11, align 4
  br label %92

88:                                               ; preds = %63
  br label %89

89:                                               ; preds = %88
  %90 = load i64, ptr %12, align 8, !tbaa !11
  %91 = add i64 %90, 1
  store i64 %91, ptr %12, align 8, !tbaa !11
  br label %57, !llvm.loop !17

92:                                               ; preds = %86, %62
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #4
  %93 = load i32, ptr %11, align 4
  switch i32 %93, label %187 [
    i32 6, label %94
    i32 1, label %185
  ]

94:                                               ; preds = %92
  br label %179

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

96:                                               ; preds = %128, %95
  %97 = load i64, ptr %13, align 8, !tbaa !11
  %98 = getelementptr inbounds %"class.elabtsaot::PwsModel", ptr %15, i32 0, i32 4
  %99 = call noundef i64 @_ZNK5boost20ptr_container_detail24reversible_ptr_containerINS0_15sequence_configIN9elabtsaot15PwsModelElementESt6vectorIPvSaIS6_EEEENS_20heap_clone_allocatorEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %98)
  %100 = icmp ne i64 %97, %99
  br i1 %100, label %102, label %101

101:                                              ; preds = %96
  store i32 9, ptr %11, align 4
  br label %131

102:                                              ; preds = %96
  %103 = getelementptr inbounds %"class.elabtsaot::PwsModel", ptr %15, i32 0, i32 4
  %104 = load i64, ptr %13, align 8, !tbaa !11
  %105 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZN5boost20ptr_sequence_adapterIN9elabtsaot15PwsModelElementESt6vectorIPvSaIS4_EENS_20heap_clone_allocatorEE2atEm(ptr noundef nonnull align 8 dereferenceable(24) %103, i64 noundef %104)
  %106 = getelementptr inbounds %"class.elabtsaot::PwsModelElement", ptr %105, i32 0, i32 2
  %107 = load i32, ptr %106, align 4, !tbaa !13
  %108 = load i32, ptr %8, align 4, !tbaa !9
  %109 = icmp eq i32 %107, %108
  br i1 %109, label %110, label %127

110:                                              ; preds = %102
  %111 = load ptr, ptr %9, align 8, !tbaa !5
  %112 = icmp ne ptr %111, null
  br i1 %112, label %113, label %117

113:                                              ; preds = %110
  %114 = load i64, ptr %13, align 8, !tbaa !11
  %115 = trunc i64 %114 to i32
  %116 = load ptr, ptr %9, align 8, !tbaa !5
  store i32 %115, ptr %116, align 4, !tbaa !9
  br label %117

117:                                              ; preds = %113, %110
  %118 = getelementptr inbounds %"class.elabtsaot::PwsModel", ptr %15, i32 0, i32 4
  %119 = load i64, ptr %13, align 8, !tbaa !11
  %120 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZN5boost20ptr_sequence_adapterIN9elabtsaot15PwsModelElementESt6vectorIPvSaIS4_EENS_20heap_clone_allocatorEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %118, i64 noundef %119)
  %121 = icmp eq ptr %120, null
  br i1 %121, label %124, label %122

122:                                              ; preds = %117
  %123 = call ptr @__dynamic_cast(ptr %120, ptr @_ZTIN9elabtsaot15PwsModelElementE, ptr @_ZTIN9elabtsaot24PwsSchematicModelElementE, i64 0) #4
  br label %125

124:                                              ; preds = %117
  br label %125

125:                                              ; preds = %124, %122
  %126 = phi ptr [ %123, %122 ], [ null, %124 ]
  store ptr %126, ptr %5, align 8
  store i32 1, ptr %11, align 4
  br label %131

127:                                              ; preds = %102
  br label %128

128:                                              ; preds = %127
  %129 = load i64, ptr %13, align 8, !tbaa !11
  %130 = add i64 %129, 1
  store i64 %130, ptr %13, align 8, !tbaa !11
  br label %96, !llvm.loop !18

131:                                              ; preds = %125, %101
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #4
  %132 = load i32, ptr %11, align 4
  switch i32 %132, label %187 [
    i32 9, label %133
    i32 1, label %185
  ]

133:                                              ; preds = %131
  br label %179

134:                                              ; preds = %4
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #4
  store i64 0, ptr %14, align 8, !tbaa !11
  br label %135

135:                                              ; preds = %167, %134
  %136 = load i64, ptr %14, align 8, !tbaa !11
  %137 = getelementptr inbounds %"class.elabtsaot::PwsModel", ptr %15, i32 0, i32 5
  %138 = call noundef i64 @_ZNK5boost20ptr_container_detail24reversible_ptr_containerINS0_15sequence_configIN9elabtsaot15PwsModelElementESt6vectorIPvSaIS6_EEEENS_20heap_clone_allocatorEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %137)
  %139 = icmp ne i64 %136, %138
  br i1 %139, label %141, label %140

140:                                              ; preds = %135
  store i32 12, ptr %11, align 4
  br label %170

141:                                              ; preds = %135
  %142 = getelementptr inbounds %"class.elabtsaot::PwsModel", ptr %15, i32 0, i32 5
  %143 = load i64, ptr %14, align 8, !tbaa !11
  %144 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZN5boost20ptr_sequence_adapterIN9elabtsaot15PwsModelElementESt6vectorIPvSaIS4_EENS_20heap_clone_allocatorEE2atEm(ptr noundef nonnull align 8 dereferenceable(24) %142, i64 noundef %143)
  %145 = getelementptr inbounds %"class.elabtsaot::PwsModelElement", ptr %144, i32 0, i32 2
  %146 = load i32, ptr %145, align 4, !tbaa !13
  %147 = load i32, ptr %8, align 4, !tbaa !9
  %148 = icmp eq i32 %146, %147
  br i1 %148, label %149, label %166

149:                                              ; preds = %141
  %150 = load ptr, ptr %9, align 8, !tbaa !5
  %151 = icmp ne ptr %150, null
  br i1 %151, label %152, label %156

152:                                              ; preds = %149
  %153 = load i64, ptr %14, align 8, !tbaa !11
  %154 = trunc i64 %153 to i32
  %155 = load ptr, ptr %9, align 8, !tbaa !5
  store i32 %154, ptr %155, align 4, !tbaa !9
  br label %156

156:                                              ; preds = %152, %149
  %157 = getelementptr inbounds %"class.elabtsaot::PwsModel", ptr %15, i32 0, i32 5
  %158 = load i64, ptr %14, align 8, !tbaa !11
  %159 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZN5boost20ptr_sequence_adapterIN9elabtsaot15PwsModelElementESt6vectorIPvSaIS4_EENS_20heap_clone_allocatorEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %157, i64 noundef %158)
  %160 = icmp eq ptr %159, null
  br i1 %160, label %163, label %161

161:                                              ; preds = %156
  %162 = call ptr @__dynamic_cast(ptr %159, ptr @_ZTIN9elabtsaot15PwsModelElementE, ptr @_ZTIN9elabtsaot24PwsSchematicModelElementE, i64 0) #4
  br label %164

163:                                              ; preds = %156
  br label %164

164:                                              ; preds = %163, %161
  %165 = phi ptr [ %162, %161 ], [ null, %163 ]
  store ptr %165, ptr %5, align 8
  store i32 1, ptr %11, align 4
  br label %170

166:                                              ; preds = %141
  br label %167

167:                                              ; preds = %166
  %168 = load i64, ptr %14, align 8, !tbaa !11
  %169 = add i64 %168, 1
  store i64 %169, ptr %14, align 8, !tbaa !11
  br label %135, !llvm.loop !19

170:                                              ; preds = %164, %140
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #4
  %171 = load i32, ptr %11, align 4
  switch i32 %171, label %187 [
    i32 12, label %172
    i32 1, label %185
  ]

172:                                              ; preds = %170
  br label %179

173:                                              ; preds = %4
  %174 = load ptr, ptr %9, align 8, !tbaa !5
  %175 = icmp ne ptr %174, null
  br i1 %175, label %176, label %178

176:                                              ; preds = %173
  %177 = load ptr, ptr %9, align 8, !tbaa !5
  store i32 -1, ptr %177, align 4, !tbaa !9
  br label %178

178:                                              ; preds = %176, %173
  store ptr null, ptr %5, align 8
  br label %185

179:                                              ; preds = %172, %133, %94, %55
  %180 = load ptr, ptr %9, align 8, !tbaa !5
  %181 = icmp ne ptr %180, null
  br i1 %181, label %182, label %184

182:                                              ; preds = %179
  %183 = load ptr, ptr %9, align 8, !tbaa !5
  store i32 -1, ptr %183, align 4, !tbaa !9
  br label %184

184:                                              ; preds = %182, %179
  store ptr null, ptr %5, align 8
  br label %185

185:                                              ; preds = %184, %178, %170, %131, %92, %53
  %186 = load ptr, ptr %5, align 8
  ret ptr %186

187:                                              ; preds = %170, %131, %92, %53
  unreachable
}

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

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

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 willreturn memory(read) }
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 = !{!"int", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"long", !7, i64 0}
!13 = !{!14, !10, i64 12}
!14 = !{!"_ZTSN9elabtsaot15PwsModelElementE", !10, i64 8, !10, i64 12}
!15 = distinct !{!15, !16}
!16 = !{!"llvm.loop.mustprogress"}
!17 = distinct !{!17, !16}
!18 = distinct !{!18, !16}
!19 = distinct !{!19, !16}


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

@_ZTIN9elabtsaot15PwsModelElementE = external dso_local constant { ptr, ptr }, align 8
@_ZTIN9elabtsaot24PwsSchematicModelElementE = external dso_local constant { ptr, ptr, ptr }, align 8

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

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

; Function Attrs: mustprogress uwtable
define dso_local noundef ptr @_ZN9elabtsaot17PwsSchematicModel7elementEijPi(ptr noundef nonnull align 8 dereferenceable(112) %0, i32 noundef %1, i32 noundef %2, ptr noundef writeonly %3) local_unnamed_addr #1 align 2 {
  switch i32 %1, label %65 [
    i32 0, label %.preheader
    i32 1, label %.preheader89
    i32 2, label %.preheader91
    i32 3, label %.preheader93
  ]

.preheader93:                                     ; preds = %4
  %5 = getelementptr inbounds i8, ptr %0, i64 88
  %6 = tail call noundef i64 @_ZNK5boost20ptr_container_detail24reversible_ptr_containerINS0_15sequence_configIN9elabtsaot15PwsModelElementESt6vectorIPvSaIS6_EEEENS_20heap_clone_allocatorEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %5)
  %.not103 = icmp eq i64 %6, 0
  br i1 %.not103, label %.thread, label %.lr.ph

.preheader91:                                     ; preds = %4
  %7 = getelementptr inbounds i8, ptr %0, i64 64
  %8 = tail call noundef i64 @_ZNK5boost20ptr_container_detail24reversible_ptr_containerINS0_15sequence_configIN9elabtsaot15PwsModelElementESt6vectorIPvSaIS6_EEEENS_20heap_clone_allocatorEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %7)
  %.not56105 = icmp eq i64 %8, 0
  br i1 %.not56105, label %.thread, label %.lr.ph107

.preheader89:                                     ; preds = %4
  %9 = getelementptr inbounds i8, ptr %0, i64 40
  %10 = tail call noundef i64 @_ZNK5boost20ptr_container_detail24reversible_ptr_containerINS0_15sequence_configIN9elabtsaot15PwsModelElementESt6vectorIPvSaIS6_EEEENS_20heap_clone_allocatorEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %9)
  %.not58108 = icmp eq i64 %10, 0
  br i1 %.not58108, label %.thread, label %.lr.ph110

.preheader:                                       ; preds = %4
  %11 = getelementptr inbounds i8, ptr %0, i64 16
  %12 = tail call noundef i64 @_ZNK5boost20ptr_container_detail24reversible_ptr_containerINS0_15sequence_configIN9elabtsaot15PwsModelElementESt6vectorIPvSaIS6_EEEENS_20heap_clone_allocatorEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %11)
  %.not60111 = icmp eq i64 %12, 0
  br i1 %.not60111, label %.thread, label %.lr.ph113

.lr.ph113:                                        ; preds = %.preheader, %20
  %.045112 = phi i64 [ %21, %20 ], [ 0, %.preheader ]
  %13 = tail call noundef nonnull align 8 dereferenceable(16) ptr @_ZN5boost20ptr_sequence_adapterIN9elabtsaot15PwsModelElementESt6vectorIPvSaIS4_EENS_20heap_clone_allocatorEE2atEm(ptr noundef nonnull align 8 dereferenceable(24) %11, i64 noundef %.045112)
  %14 = getelementptr inbounds i8, ptr %13, i64 12
  %15 = load i32, ptr %14, align 4, !tbaa !5
  %16 = icmp eq i32 %15, %2
  br i1 %16, label %17, label %20

17:                                               ; preds = %.lr.ph113
  %.not61 = icmp eq ptr %3, null
  br i1 %.not61, label %23, label %18

18:                                               ; preds = %17
  %19 = trunc i64 %.045112 to i32
  store i32 %19, ptr %3, align 4, !tbaa !10
  br label %23

20:                                               ; preds = %.lr.ph113
  %21 = add i64 %.045112, 1
  %22 = tail call noundef i64 @_ZNK5boost20ptr_container_detail24reversible_ptr_containerINS0_15sequence_configIN9elabtsaot15PwsModelElementESt6vectorIPvSaIS6_EEEENS_20heap_clone_allocatorEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %11)
  %.not60 = icmp eq i64 %21, %22
  br i1 %.not60, label %.thread, label %.lr.ph113, !llvm.loop !11

23:                                               ; preds = %17, %18
  %24 = tail call noundef nonnull align 8 dereferenceable(16) ptr @_ZN5boost20ptr_sequence_adapterIN9elabtsaot15PwsModelElementESt6vectorIPvSaIS4_EENS_20heap_clone_allocatorEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %11, i64 noundef %.045112)
  %25 = tail call ptr @__dynamic_cast(ptr nonnull %24, ptr nonnull @_ZTIN9elabtsaot15PwsModelElementE, ptr nonnull @_ZTIN9elabtsaot24PwsSchematicModelElementE, i64 0) #3
  br label %68

.lr.ph110:                                        ; preds = %.preheader89, %33
  %.043109 = phi i64 [ %34, %33 ], [ 0, %.preheader89 ]
  %26 = tail call noundef nonnull align 8 dereferenceable(16) ptr @_ZN5boost20ptr_sequence_adapterIN9elabtsaot15PwsModelElementESt6vectorIPvSaIS4_EENS_20heap_clone_allocatorEE2atEm(ptr noundef nonnull align 8 dereferenceable(24) %9, i64 noundef %.043109)
  %27 = getelementptr inbounds i8, ptr %26, i64 12
  %28 = load i32, ptr %27, align 4, !tbaa !5
  %29 = icmp eq i32 %28, %2
  br i1 %29, label %30, label %33

30:                                               ; preds = %.lr.ph110
  %.not59 = icmp eq ptr %3, null
  br i1 %.not59, label %36, label %31

31:                                               ; preds = %30
  %32 = trunc i64 %.043109 to i32
  store i32 %32, ptr %3, align 4, !tbaa !10
  br label %36

33:                                               ; preds = %.lr.ph110
  %34 = add i64 %.043109, 1
  %35 = tail call noundef i64 @_ZNK5boost20ptr_container_detail24reversible_ptr_containerINS0_15sequence_configIN9elabtsaot15PwsModelElementESt6vectorIPvSaIS6_EEEENS_20heap_clone_allocatorEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %9)
  %.not58 = icmp eq i64 %34, %35
  br i1 %.not58, label %.thread, label %.lr.ph110, !llvm.loop !13

36:                                               ; preds = %30, %31
  %37 = tail call noundef nonnull align 8 dereferenceable(16) ptr @_ZN5boost20ptr_sequence_adapterIN9elabtsaot15PwsModelElementESt6vectorIPvSaIS4_EENS_20heap_clone_allocatorEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %9, i64 noundef %.043109)
  %38 = tail call ptr @__dynamic_cast(ptr nonnull %37, ptr nonnull @_ZTIN9elabtsaot15PwsModelElementE, ptr nonnull @_ZTIN9elabtsaot24PwsSchematicModelElementE, i64 0) #3
  br label %68

.lr.ph107:                                        ; preds = %.preheader91, %46
  %.042106 = phi i64 [ %47, %46 ], [ 0, %.preheader91 ]
  %39 = tail call noundef nonnull align 8 dereferenceable(16) ptr @_ZN5boost20ptr_sequence_adapterIN9elabtsaot15PwsModelElementESt6vectorIPvSaIS4_EENS_20heap_clone_allocatorEE2atEm(ptr noundef nonnull align 8 dereferenceable(24) %7, i64 noundef %.042106)
  %40 = getelementptr inbounds i8, ptr %39, i64 12
  %41 = load i32, ptr %40, align 4, !tbaa !5
  %42 = icmp eq i32 %41, %2
  br i1 %42, label %43, label %46

43:                                               ; preds = %.lr.ph107
  %.not57 = icmp eq ptr %3, null
  br i1 %.not57, label %49, label %44

44:                                               ; preds = %43
  %45 = trunc i64 %.042106 to i32
  store i32 %45, ptr %3, align 4, !tbaa !10
  br label %49

46:                                               ; preds = %.lr.ph107
  %47 = add i64 %.042106, 1
  %48 = tail call noundef i64 @_ZNK5boost20ptr_container_detail24reversible_ptr_containerINS0_15sequence_configIN9elabtsaot15PwsModelElementESt6vectorIPvSaIS6_EEEENS_20heap_clone_allocatorEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %7)
  %.not56 = icmp eq i64 %47, %48
  br i1 %.not56, label %.thread, label %.lr.ph107, !llvm.loop !14

49:                                               ; preds = %43, %44
  %50 = tail call noundef nonnull align 8 dereferenceable(16) ptr @_ZN5boost20ptr_sequence_adapterIN9elabtsaot15PwsModelElementESt6vectorIPvSaIS4_EENS_20heap_clone_allocatorEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %7, i64 noundef %.042106)
  %51 = tail call ptr @__dynamic_cast(ptr nonnull %50, ptr nonnull @_ZTIN9elabtsaot15PwsModelElementE, ptr nonnull @_ZTIN9elabtsaot24PwsSchematicModelElementE, i64 0) #3
  br label %68

.lr.ph:                                           ; preds = %.preheader93, %59
  %.0104 = phi i64 [ %60, %59 ], [ 0, %.preheader93 ]
  %52 = tail call noundef nonnull align 8 dereferenceable(16) ptr @_ZN5boost20ptr_sequence_adapterIN9elabtsaot15PwsModelElementESt6vectorIPvSaIS4_EENS_20heap_clone_allocatorEE2atEm(ptr noundef nonnull align 8 dereferenceable(24) %5, i64 noundef %.0104)
  %53 = getelementptr inbounds i8, ptr %52, i64 12
  %54 = load i32, ptr %53, align 4, !tbaa !5
  %55 = icmp eq i32 %54, %2
  br i1 %55, label %56, label %59

56:                                               ; preds = %.lr.ph
  %.not55 = icmp eq ptr %3, null
  br i1 %.not55, label %62, label %57

57:                                               ; preds = %56
  %58 = trunc i64 %.0104 to i32
  store i32 %58, ptr %3, align 4, !tbaa !10
  br label %62

59:                                               ; preds = %.lr.ph
  %60 = add i64 %.0104, 1
  %61 = tail call noundef i64 @_ZNK5boost20ptr_container_detail24reversible_ptr_containerINS0_15sequence_configIN9elabtsaot15PwsModelElementESt6vectorIPvSaIS6_EEEENS_20heap_clone_allocatorEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %5)
  %.not = icmp eq i64 %60, %61
  br i1 %.not, label %.thread, label %.lr.ph, !llvm.loop !15

62:                                               ; preds = %56, %57
  %63 = tail call noundef nonnull align 8 dereferenceable(16) ptr @_ZN5boost20ptr_sequence_adapterIN9elabtsaot15PwsModelElementESt6vectorIPvSaIS4_EENS_20heap_clone_allocatorEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %5, i64 noundef %.0104)
  %64 = tail call ptr @__dynamic_cast(ptr nonnull %63, ptr nonnull @_ZTIN9elabtsaot15PwsModelElementE, ptr nonnull @_ZTIN9elabtsaot24PwsSchematicModelElementE, i64 0) #3
  br label %68

65:                                               ; preds = %4
  %.not63 = icmp eq ptr %3, null
  br i1 %.not63, label %68, label %66

66:                                               ; preds = %65
  store i32 -1, ptr %3, align 4, !tbaa !10
  br label %68

.thread:                                          ; preds = %59, %46, %33, %20, %.preheader93, %.preheader91, %.preheader89, %.preheader
  %.not62 = icmp eq ptr %3, null
  br i1 %.not62, label %68, label %67

67:                                               ; preds = %.thread
  store i32 -1, ptr %3, align 4, !tbaa !10
  br label %68

68:                                               ; preds = %62, %49, %36, %23, %.thread, %67, %65, %66
  %.4 = phi ptr [ %64, %62 ], [ %51, %49 ], [ %38, %36 ], [ %25, %23 ], [ null, %66 ], [ null, %65 ], [ null, %67 ], [ null, %.thread ]
  ret ptr %.4
}

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

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

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 = { mustprogress nofree nounwind willreturn memory(read) }
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, !7, i64 12}
!6 = !{!"_ZTSN9elabtsaot15PwsModelElementE", !7, i64 8, !7, i64 12}
!7 = !{!"int", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!7, !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = distinct !{!13, !12}
!14 = distinct !{!14, !12}
!15 = distinct !{!15, !12}


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