; 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::Bus" = type { i32, %"class.std::__cxx11::basic_string", i32, double, double, double, double, double, double, double }
%"class.std::__cxx11::basic_string" = type { %"struct.std::__cxx11::basic_string<char>::_Alloc_hider", i64, %union.anon }
%"struct.std::__cxx11::basic_string<char>::_Alloc_hider" = type { ptr }
%union.anon = type { i64, [8 x i8] }
%"class.elabtsaot::Branch" = type { i32, i8, i32, i32, double, double, double, double, double, double, double, double }
%"class.elabtsaot::Generator" = type { i32, i8, %"class.std::__cxx11::basic_string", i32, double, double, %"class.std::complex", i32, double, double, double, double, double, double, double, double, double, double, double, double, double, double, double, double }
%"class.std::complex" = type { { double, double } }
%"class.elabtsaot::Load" = type { i32, i32, double, double, %"class.std::complex", double, double, double, double }
%"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 }

declare i32 @__gxx_personality_v0(...)

; Function Attrs: mustprogress uwtable
define dso_local noundef i32 @_ZN9elabtsaot17PwsSchematicModel4initEv(ptr noundef nonnull align 8 dereferenceable(112) %0) unnamed_addr #0 align 2 personality ptr @__gxx_personality_v0 {
  %2 = alloca i32, align 4
  %3 = alloca ptr, align 8
  %4 = alloca i64, align 8
  %5 = alloca i64, align 8
  %6 = alloca i32, align 4
  %7 = alloca ptr, align 8
  %8 = alloca %"class.elabtsaot::Bus", align 8
  %9 = alloca ptr, align 8
  %10 = alloca i32, align 4
  %11 = alloca ptr, align 8
  %12 = alloca %"class.elabtsaot::Branch", align 8
  %13 = alloca ptr, align 8
  %14 = alloca %"class.elabtsaot::Generator", align 8
  %15 = alloca ptr, align 8
  %16 = alloca %"class.elabtsaot::Load", align 8
  store ptr %0, ptr %3, align 8, !tbaa !5
  %17 = load ptr, ptr %3, align 8
  %18 = getelementptr inbounds %"class.elabtsaot::PwsModel", ptr %17, i32 0, i32 1
  %19 = load ptr, ptr %18, align 8, !tbaa !9
  %20 = icmp eq ptr %19, null
  br i1 %20, label %21, label %22

21:                                               ; preds = %1
  store i32 -1, ptr %2, align 4
  br label %131

22:                                               ; preds = %1
  %23 = load ptr, ptr %17, align 8, !tbaa !18
  %24 = getelementptr inbounds ptr, ptr %23, i64 4
  %25 = load ptr, ptr %24, align 8
  %26 = call noundef i32 %25(ptr noundef nonnull align 8 dereferenceable(112) %17)
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #6
  store i32 0, ptr %6, align 4, !tbaa !20
  %27 = getelementptr inbounds %"class.elabtsaot::PwsModel", ptr %17, i32 0, i32 1
  %28 = load ptr, ptr %27, align 8, !tbaa !9
  %29 = call noundef i64 @_ZNK9elabtsaot11Powersystem11getBusCountEv(ptr noundef nonnull align 8 dereferenceable(480) %28)
  store i64 %29, ptr %5, align 8, !tbaa !22
  store i64 0, ptr %4, align 8, !tbaa !22
  br label %30

30:                                               ; preds = %47, %22
  %31 = load i64, ptr %4, align 8, !tbaa !22
  %32 = load i64, ptr %5, align 8, !tbaa !22
  %33 = icmp ne i64 %31, %32
  br i1 %33, label %34, label %54

34:                                               ; preds = %30
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #6
  %35 = getelementptr inbounds %"class.elabtsaot::PwsModel", ptr %17, i32 0, i32 1
  %36 = load ptr, ptr %35, align 8, !tbaa !9
  %37 = load i64, ptr %4, align 8, !tbaa !22
  %38 = call noundef ptr @_ZNK9elabtsaot11Powersystem6getBusEm(ptr noundef nonnull align 8 dereferenceable(480) %36, i64 noundef %37)
  store ptr %38, ptr %7, align 8, !tbaa !5
  %39 = load ptr, ptr %7, align 8, !tbaa !5
  call void @_ZN9elabtsaot3BusC2ERKS0_(ptr noundef nonnull align 8 dereferenceable(104) %8, ptr noundef nonnull align 8 dereferenceable(104) %39)
  %40 = load ptr, ptr %17, align 8, !tbaa !18
  %41 = getelementptr inbounds ptr, ptr %40, i64 6
  %42 = load ptr, ptr %41, align 8
  %43 = invoke noundef i32 %42(ptr noundef nonnull align 8 dereferenceable(112) %17, ptr noundef %8, i1 noundef zeroext true, ptr noundef null)
          to label %44 unwind label %50

44:                                               ; preds = %34
  %45 = load i32, ptr %6, align 4, !tbaa !20
  %46 = or i32 %45, %43
  store i32 %46, ptr %6, align 4, !tbaa !20
  call void @_ZN9elabtsaot3BusD2Ev(ptr noundef nonnull align 8 dereferenceable(104) %8) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #6
  br label %47

47:                                               ; preds = %44
  %48 = load i64, ptr %4, align 8, !tbaa !22
  %49 = add i64 %48, 1
  store i64 %49, ptr %4, align 8, !tbaa !22
  br label %30, !llvm.loop !24

50:                                               ; preds = %34
  %51 = landingpad { ptr, i32 }
          cleanup
  %52 = extractvalue { ptr, i32 } %51, 0
  store ptr %52, ptr %9, align 8
  %53 = extractvalue { ptr, i32 } %51, 1
  store i32 %53, ptr %10, align 4
  call void @_ZN9elabtsaot3BusD2Ev(ptr noundef nonnull align 8 dereferenceable(104) %8) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #6
  br label %130

54:                                               ; preds = %30
  %55 = getelementptr inbounds %"class.elabtsaot::PwsModel", ptr %17, i32 0, i32 1
  %56 = load ptr, ptr %55, align 8, !tbaa !9
  %57 = call noundef i64 @_ZNK9elabtsaot11Powersystem14getBranchCountEv(ptr noundef nonnull align 8 dereferenceable(480) %56)
  store i64 %57, ptr %5, align 8, !tbaa !22
  store i64 0, ptr %4, align 8, !tbaa !22
  br label %58

58:                                               ; preds = %74, %54
  %59 = load i64, ptr %4, align 8, !tbaa !22
  %60 = load i64, ptr %5, align 8, !tbaa !22
  %61 = icmp ne i64 %59, %60
  br i1 %61, label %62, label %77

62:                                               ; preds = %58
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #6
  %63 = getelementptr inbounds %"class.elabtsaot::PwsModel", ptr %17, i32 0, i32 1
  %64 = load ptr, ptr %63, align 8, !tbaa !9
  %65 = load i64, ptr %4, align 8, !tbaa !22
  %66 = call noundef ptr @_ZNK9elabtsaot11Powersystem9getBranchEm(ptr noundef nonnull align 8 dereferenceable(480) %64, i64 noundef %65)
  store ptr %66, ptr %11, align 8, !tbaa !5
  %67 = load ptr, ptr %11, align 8, !tbaa !5
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %12, ptr align 8 %67, i64 80, i1 false), !tbaa.struct !26
  %68 = load ptr, ptr %17, align 8, !tbaa !18
  %69 = getelementptr inbounds ptr, ptr %68, i64 7
  %70 = load ptr, ptr %69, align 8
  %71 = call noundef i32 %70(ptr noundef nonnull align 8 dereferenceable(112) %17, ptr noundef byval(%"class.elabtsaot::Branch") align 8 %12, i1 noundef zeroext true, ptr noundef null)
  %72 = load i32, ptr %6, align 4, !tbaa !20
  %73 = or i32 %72, %71
  store i32 %73, ptr %6, align 4, !tbaa !20
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #6
  br label %74

74:                                               ; preds = %62
  %75 = load i64, ptr %4, align 8, !tbaa !22
  %76 = add i64 %75, 1
  store i64 %76, ptr %4, align 8, !tbaa !22
  br label %58, !llvm.loop !31

77:                                               ; preds = %58
  %78 = getelementptr inbounds %"class.elabtsaot::PwsModel", ptr %17, i32 0, i32 1
  %79 = load ptr, ptr %78, align 8, !tbaa !9
  %80 = call noundef i64 @_ZNK9elabtsaot11Powersystem11getGenCountEv(ptr noundef nonnull align 8 dereferenceable(480) %79)
  store i64 %80, ptr %5, align 8, !tbaa !22
  store i64 0, ptr %4, align 8, !tbaa !22
  br label %81

81:                                               ; preds = %98, %77
  %82 = load i64, ptr %4, align 8, !tbaa !22
  %83 = load i64, ptr %5, align 8, !tbaa !22
  %84 = icmp ne i64 %82, %83
  br i1 %84, label %85, label %105

85:                                               ; preds = %81
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #6
  %86 = getelementptr inbounds %"class.elabtsaot::PwsModel", ptr %17, i32 0, i32 1
  %87 = load ptr, ptr %86, align 8, !tbaa !9
  %88 = load i64, ptr %4, align 8, !tbaa !22
  %89 = call noundef ptr @_ZNK9elabtsaot11Powersystem12getGeneratorEm(ptr noundef nonnull align 8 dereferenceable(480) %87, i64 noundef %88)
  store ptr %89, ptr %13, align 8, !tbaa !5
  %90 = load ptr, ptr %13, align 8, !tbaa !5
  call void @_ZN9elabtsaot9GeneratorC2ERKS0_(ptr noundef nonnull align 8 dereferenceable(216) %14, ptr noundef nonnull align 8 dereferenceable(216) %90)
  %91 = load ptr, ptr %17, align 8, !tbaa !18
  %92 = getelementptr inbounds ptr, ptr %91, i64 8
  %93 = load ptr, ptr %92, align 8
  %94 = invoke noundef i32 %93(ptr noundef nonnull align 8 dereferenceable(112) %17, ptr noundef %14, i1 noundef zeroext true, ptr noundef null)
          to label %95 unwind label %101

95:                                               ; preds = %85
  %96 = load i32, ptr %6, align 4, !tbaa !20
  %97 = or i32 %96, %94
  store i32 %97, ptr %6, align 4, !tbaa !20
  call void @_ZN9elabtsaot9GeneratorD2Ev(ptr noundef nonnull align 8 dereferenceable(216) %14) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #6
  br label %98

98:                                               ; preds = %95
  %99 = load i64, ptr %4, align 8, !tbaa !22
  %100 = add i64 %99, 1
  store i64 %100, ptr %4, align 8, !tbaa !22
  br label %81, !llvm.loop !32

101:                                              ; preds = %85
  %102 = landingpad { ptr, i32 }
          cleanup
  %103 = extractvalue { ptr, i32 } %102, 0
  store ptr %103, ptr %9, align 8
  %104 = extractvalue { ptr, i32 } %102, 1
  store i32 %104, ptr %10, align 4
  call void @_ZN9elabtsaot9GeneratorD2Ev(ptr noundef nonnull align 8 dereferenceable(216) %14) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #6
  br label %130

105:                                              ; preds = %81
  %106 = getelementptr inbounds %"class.elabtsaot::PwsModel", ptr %17, i32 0, i32 1
  %107 = load ptr, ptr %106, align 8, !tbaa !9
  %108 = call noundef i64 @_ZNK9elabtsaot11Powersystem12getLoadCountEv(ptr noundef nonnull align 8 dereferenceable(480) %107)
  store i64 %108, ptr %5, align 8, !tbaa !22
  store i64 0, ptr %4, align 8, !tbaa !22
  br label %109

109:                                              ; preds = %125, %105
  %110 = load i64, ptr %4, align 8, !tbaa !22
  %111 = load i64, ptr %5, align 8, !tbaa !22
  %112 = icmp ne i64 %110, %111
  br i1 %112, label %113, label %128

113:                                              ; preds = %109
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #6
  %114 = getelementptr inbounds %"class.elabtsaot::PwsModel", ptr %17, i32 0, i32 1
  %115 = load ptr, ptr %114, align 8, !tbaa !9
  %116 = load i64, ptr %4, align 8, !tbaa !22
  %117 = call noundef ptr @_ZNK9elabtsaot11Powersystem7getLoadEm(ptr noundef nonnull align 8 dereferenceable(480) %115, i64 noundef %116)
  store ptr %117, ptr %15, align 8, !tbaa !5
  %118 = load ptr, ptr %15, align 8, !tbaa !5
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %16, ptr align 8 %118, i64 72, i1 false), !tbaa.struct !33
  %119 = load ptr, ptr %17, align 8, !tbaa !18
  %120 = getelementptr inbounds ptr, ptr %119, i64 9
  %121 = load ptr, ptr %120, align 8
  %122 = call noundef i32 %121(ptr noundef nonnull align 8 dereferenceable(112) %17, ptr noundef byval(%"class.elabtsaot::Load") align 8 %16, i1 noundef zeroext true, ptr noundef null)
  %123 = load i32, ptr %6, align 4, !tbaa !20
  %124 = or i32 %123, %122
  store i32 %124, ptr %6, align 4, !tbaa !20
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #6
  br label %125

125:                                              ; preds = %113
  %126 = load i64, ptr %4, align 8, !tbaa !22
  %127 = add i64 %126, 1
  store i64 %127, ptr %4, align 8, !tbaa !22
  br label %109, !llvm.loop !35

128:                                              ; preds = %109
  %129 = load i32, ptr %6, align 4, !tbaa !20
  store i32 %129, ptr %2, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #6
  br label %131

130:                                              ; preds = %101, %50
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #6
  br label %133

131:                                              ; preds = %128, %21
  %132 = load i32, ptr %2, align 4
  ret i32 %132

133:                                              ; preds = %130
  %134 = load ptr, ptr %9, align 8
  %135 = load i32, ptr %10, align 4
  %136 = insertvalue { ptr, i32 } poison, ptr %134, 0
  %137 = insertvalue { ptr, i32 } %136, i32 %135, 1
  resume { ptr, i32 } %137
}

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

declare noundef i64 @_ZNK9elabtsaot11Powersystem11getBusCountEv(ptr noundef nonnull align 8 dereferenceable(480)) #2

declare noundef ptr @_ZNK9elabtsaot11Powersystem6getBusEm(ptr noundef nonnull align 8 dereferenceable(480), i64 noundef) #2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZN9elabtsaot3BusC2ERKS0_(ptr noundef nonnull align 8 dereferenceable(104), ptr noundef nonnull align 8 dereferenceable(104)) unnamed_addr #3 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZN9elabtsaot3BusD2Ev(ptr noundef nonnull align 8 dereferenceable(104)) unnamed_addr #4 align 2

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

declare noundef i64 @_ZNK9elabtsaot11Powersystem14getBranchCountEv(ptr noundef nonnull align 8 dereferenceable(480)) #2

declare noundef ptr @_ZNK9elabtsaot11Powersystem9getBranchEm(ptr noundef nonnull align 8 dereferenceable(480), i64 noundef) #2

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #5

declare noundef i64 @_ZNK9elabtsaot11Powersystem11getGenCountEv(ptr noundef nonnull align 8 dereferenceable(480)) #2

declare noundef ptr @_ZNK9elabtsaot11Powersystem12getGeneratorEm(ptr noundef nonnull align 8 dereferenceable(480), i64 noundef) #2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZN9elabtsaot9GeneratorC2ERKS0_(ptr noundef nonnull align 8 dereferenceable(216), ptr noundef nonnull align 8 dereferenceable(216)) unnamed_addr #3 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZN9elabtsaot9GeneratorD2Ev(ptr noundef nonnull align 8 dereferenceable(216)) unnamed_addr #4 align 2

declare noundef i64 @_ZNK9elabtsaot11Powersystem12getLoadCountEv(ptr noundef nonnull align 8 dereferenceable(480)) #2

declare noundef ptr @_ZNK9elabtsaot11Powersystem7getLoadEm(ptr noundef nonnull align 8 dereferenceable(480), i64 noundef) #2

attributes #0 = { mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { "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 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 = { 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 #5 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #6 = { nounwind }

!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !6, i64 8}
!10 = !{!"_ZTSN9elabtsaot8PwsModelE", !6, i64 8, !11, i64 16, !11, i64 40, !11, i64 64, !11, i64 88}
!11 = !{!"_ZTSN5boost10ptr_vectorIN9elabtsaot15PwsModelElementENS_20heap_clone_allocatorEvEE", !12, i64 0}
!12 = !{!"_ZTSN5boost20ptr_sequence_adapterIN9elabtsaot15PwsModelElementESt6vectorIPvSaIS4_EENS_20heap_clone_allocatorEEE", !13, i64 0}
!13 = !{!"_ZTSN5boost20ptr_container_detail24reversible_ptr_containerINS0_15sequence_configIN9elabtsaot15PwsModelElementESt6vectorIPvSaIS6_EEEENS_20heap_clone_allocatorEEE", !14, i64 0}
!14 = !{!"_ZTSSt6vectorIPvSaIS0_EE", !15, i64 0}
!15 = !{!"_ZTSSt12_Vector_baseIPvSaIS0_EE", !16, i64 0}
!16 = !{!"_ZTSNSt12_Vector_baseIPvSaIS0_EE12_Vector_implE", !17, i64 0}
!17 = !{!"_ZTSNSt12_Vector_baseIPvSaIS0_EE17_Vector_impl_dataE", !6, i64 0, !6, i64 8, !6, i64 16}
!18 = !{!19, !19, i64 0}
!19 = !{!"vtable pointer", !8, i64 0}
!20 = !{!21, !21, i64 0}
!21 = !{!"int", !7, i64 0}
!22 = !{!23, !23, i64 0}
!23 = !{!"long", !7, i64 0}
!24 = distinct !{!24, !25}
!25 = !{!"llvm.loop.mustprogress"}
!26 = !{i64 0, i64 4, !20, i64 4, i64 1, !27, i64 8, i64 4, !20, i64 12, i64 4, !20, i64 16, i64 8, !29, i64 24, i64 8, !29, i64 32, i64 8, !29, i64 40, i64 8, !29, i64 48, i64 8, !29, i64 56, i64 8, !29, i64 64, i64 8, !29, i64 72, i64 8, !29}
!27 = !{!28, !28, i64 0}
!28 = !{!"bool", !7, i64 0}
!29 = !{!30, !30, i64 0}
!30 = !{!"double", !7, i64 0}
!31 = distinct !{!31, !25}
!32 = distinct !{!32, !25}
!33 = !{i64 0, i64 4, !20, i64 4, i64 4, !20, i64 8, i64 8, !29, i64 16, i64 8, !29, i64 24, i64 16, !34, i64 40, i64 8, !29, i64 48, i64 8, !29, i64 56, i64 8, !29, i64 64, i64 8, !29}
!34 = !{!7, !7, i64 0}
!35 = distinct !{!35, !25}


; 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.elabtsaot::Bus" = type { i32, %"class.std::__cxx11::basic_string", i32, double, double, double, double, double, double, double }
%"class.std::__cxx11::basic_string" = type { %"struct.std::__cxx11::basic_string<char>::_Alloc_hider", i64, %union.anon }
%"struct.std::__cxx11::basic_string<char>::_Alloc_hider" = type { ptr }
%union.anon = type { i64, [8 x i8] }
%"class.elabtsaot::Generator" = type { i32, i8, %"class.std::__cxx11::basic_string", i32, double, double, %"class.std::complex", i32, double, double, double, double, double, double, double, double, double, double, double, double, double, double, double, double }
%"class.std::complex" = type { { double, double } }
%"class.elabtsaot::Branch" = type { i32, i8, i32, i32, double, double, double, double, double, double, double, double }
%"class.elabtsaot::Load" = type { i32, i32, double, double, %"class.std::complex", double, double, double, double }

declare i32 @__gxx_personality_v0(...)

; Function Attrs: mustprogress uwtable
define dso_local noundef i32 @_ZN9elabtsaot17PwsSchematicModel4initEv(ptr noundef nonnull align 8 dereferenceable(112) %0) unnamed_addr #0 align 2 personality ptr @__gxx_personality_v0 {
  %2 = alloca %"class.elabtsaot::Bus", align 8
  %3 = alloca %"class.elabtsaot::Generator", align 8
  %4 = getelementptr inbounds i8, ptr %0, i64 8
  %5 = load ptr, ptr %4, align 8, !tbaa !5
  %6 = icmp eq ptr %5, null
  br i1 %6, label %.loopexit, label %7

7:                                                ; preds = %1
  %8 = load ptr, ptr %0, align 8, !tbaa !17
  %9 = getelementptr inbounds i8, ptr %8, i64 32
  %10 = load ptr, ptr %9, align 8
  %11 = tail call noundef i32 %10(ptr noundef nonnull align 8 dereferenceable(112) %0)
  %12 = load ptr, ptr %4, align 8, !tbaa !5
  %13 = tail call noundef i64 @_ZNK9elabtsaot11Powersystem11getBusCountEv(ptr noundef nonnull align 8 dereferenceable(480) %12)
  %.not41 = icmp eq i64 %13, 0
  br i1 %.not41, label %._crit_edge, label %.lr.ph

.lr.ph:                                           ; preds = %7, %20
  %.02843 = phi i64 [ %22, %20 ], [ 0, %7 ]
  %.03142 = phi i32 [ %21, %20 ], [ 0, %7 ]
  %14 = load ptr, ptr %4, align 8, !tbaa !5
  %15 = call noundef ptr @_ZNK9elabtsaot11Powersystem6getBusEm(ptr noundef nonnull align 8 dereferenceable(480) %14, i64 noundef %.02843)
  call void @_ZN9elabtsaot3BusC2ERKS0_(ptr noundef nonnull align 8 dereferenceable(104) %2, ptr noundef nonnull align 8 dereferenceable(104) %15)
  %16 = load ptr, ptr %0, align 8, !tbaa !17
  %17 = getelementptr inbounds i8, ptr %16, i64 48
  %18 = load ptr, ptr %17, align 8
  %19 = invoke noundef i32 %18(ptr noundef nonnull align 8 dereferenceable(112) %0, ptr noundef nonnull %2, i1 noundef zeroext true, ptr noundef null)
          to label %20 unwind label %23

20:                                               ; preds = %.lr.ph
  %21 = or i32 %19, %.03142
  call void @_ZN9elabtsaot3BusD2Ev(ptr noundef nonnull align 8 dereferenceable(104) %2) #4
  %22 = add nuw i64 %.02843, 1
  %.not = icmp eq i64 %22, %13
  br i1 %.not, label %._crit_edge, label %.lr.ph, !llvm.loop !19

23:                                               ; preds = %.lr.ph
  %24 = landingpad { ptr, i32 }
          cleanup
  call void @_ZN9elabtsaot3BusD2Ev(ptr noundef nonnull align 8 dereferenceable(104) %2) #4
  br label %58

._crit_edge:                                      ; preds = %20, %7
  %.031.lcssa = phi i32 [ 0, %7 ], [ %21, %20 ]
  %25 = load ptr, ptr %4, align 8, !tbaa !5
  %26 = call noundef i64 @_ZNK9elabtsaot11Powersystem14getBranchCountEv(ptr noundef nonnull align 8 dereferenceable(480) %25)
  %.not3544 = icmp eq i64 %26, 0
  br i1 %.not3544, label %._crit_edge49, label %.lr.ph48

.lr.ph48:                                         ; preds = %._crit_edge, %.lr.ph48
  %.146 = phi i64 [ %34, %.lr.ph48 ], [ 0, %._crit_edge ]
  %.13245 = phi i32 [ %33, %.lr.ph48 ], [ %.031.lcssa, %._crit_edge ]
  %27 = load ptr, ptr %4, align 8, !tbaa !5
  %28 = call noundef ptr @_ZNK9elabtsaot11Powersystem9getBranchEm(ptr noundef nonnull align 8 dereferenceable(480) %27, i64 noundef %.146)
  %29 = load ptr, ptr %0, align 8, !tbaa !17
  %30 = getelementptr inbounds i8, ptr %29, i64 56
  %31 = load ptr, ptr %30, align 8
  %32 = call noundef i32 %31(ptr noundef nonnull align 8 dereferenceable(112) %0, ptr noundef nonnull byval(%"class.elabtsaot::Branch") align 8 %28, i1 noundef zeroext true, ptr noundef null)
  %33 = or i32 %32, %.13245
  %34 = add nuw i64 %.146, 1
  %.not35 = icmp eq i64 %34, %26
  br i1 %.not35, label %._crit_edge49, label %.lr.ph48, !llvm.loop !21

._crit_edge49:                                    ; preds = %.lr.ph48, %._crit_edge
  %.132.lcssa = phi i32 [ %.031.lcssa, %._crit_edge ], [ %33, %.lr.ph48 ]
  %35 = load ptr, ptr %4, align 8, !tbaa !5
  %36 = call noundef i64 @_ZNK9elabtsaot11Powersystem11getGenCountEv(ptr noundef nonnull align 8 dereferenceable(480) %35)
  %.not3651 = icmp eq i64 %36, 0
  br i1 %.not3651, label %._crit_edge56, label %.lr.ph55

.lr.ph55:                                         ; preds = %._crit_edge49, %43
  %.253 = phi i64 [ %45, %43 ], [ 0, %._crit_edge49 ]
  %.23352 = phi i32 [ %44, %43 ], [ %.132.lcssa, %._crit_edge49 ]
  %37 = load ptr, ptr %4, align 8, !tbaa !5
  %38 = call noundef ptr @_ZNK9elabtsaot11Powersystem12getGeneratorEm(ptr noundef nonnull align 8 dereferenceable(480) %37, i64 noundef %.253)
  call void @_ZN9elabtsaot9GeneratorC2ERKS0_(ptr noundef nonnull align 8 dereferenceable(216) %3, ptr noundef nonnull align 8 dereferenceable(216) %38)
  %39 = load ptr, ptr %0, align 8, !tbaa !17
  %40 = getelementptr inbounds i8, ptr %39, i64 64
  %41 = load ptr, ptr %40, align 8
  %42 = invoke noundef i32 %41(ptr noundef nonnull align 8 dereferenceable(112) %0, ptr noundef nonnull %3, i1 noundef zeroext true, ptr noundef null)
          to label %43 unwind label %46

43:                                               ; preds = %.lr.ph55
  %44 = or i32 %42, %.23352
  call void @_ZN9elabtsaot9GeneratorD2Ev(ptr noundef nonnull align 8 dereferenceable(216) %3) #4
  %45 = add nuw i64 %.253, 1
  %.not36 = icmp eq i64 %45, %36
  br i1 %.not36, label %._crit_edge56, label %.lr.ph55, !llvm.loop !22

46:                                               ; preds = %.lr.ph55
  %47 = landingpad { ptr, i32 }
          cleanup
  call void @_ZN9elabtsaot9GeneratorD2Ev(ptr noundef nonnull align 8 dereferenceable(216) %3) #4
  br label %58

._crit_edge56:                                    ; preds = %43, %._crit_edge49
  %.233.lcssa = phi i32 [ %.132.lcssa, %._crit_edge49 ], [ %44, %43 ]
  %48 = load ptr, ptr %4, align 8, !tbaa !5
  %49 = call noundef i64 @_ZNK9elabtsaot11Powersystem12getLoadCountEv(ptr noundef nonnull align 8 dereferenceable(480) %48)
  %.not3758 = icmp eq i64 %49, 0
  br i1 %.not3758, label %.loopexit, label %.lr.ph62

.lr.ph62:                                         ; preds = %._crit_edge56, %.lr.ph62
  %.360 = phi i64 [ %57, %.lr.ph62 ], [ 0, %._crit_edge56 ]
  %.33459 = phi i32 [ %56, %.lr.ph62 ], [ %.233.lcssa, %._crit_edge56 ]
  %50 = load ptr, ptr %4, align 8, !tbaa !5
  %51 = call noundef ptr @_ZNK9elabtsaot11Powersystem7getLoadEm(ptr noundef nonnull align 8 dereferenceable(480) %50, i64 noundef %.360)
  %52 = load ptr, ptr %0, align 8, !tbaa !17
  %53 = getelementptr inbounds i8, ptr %52, i64 72
  %54 = load ptr, ptr %53, align 8
  %55 = call noundef i32 %54(ptr noundef nonnull align 8 dereferenceable(112) %0, ptr noundef nonnull byval(%"class.elabtsaot::Load") align 8 %51, i1 noundef zeroext true, ptr noundef null)
  %56 = or i32 %55, %.33459
  %57 = add nuw i64 %.360, 1
  %.not37 = icmp eq i64 %57, %49
  br i1 %.not37, label %.loopexit, label %.lr.ph62, !llvm.loop !23

58:                                               ; preds = %46, %23
  %.pn = phi { ptr, i32 } [ %24, %23 ], [ %47, %46 ]
  resume { ptr, i32 } %.pn

.loopexit:                                        ; preds = %.lr.ph62, %._crit_edge56, %1
  %.0 = phi i32 [ -1, %1 ], [ %.233.lcssa, %._crit_edge56 ], [ %56, %.lr.ph62 ]
  ret i32 %.0
}

declare noundef i64 @_ZNK9elabtsaot11Powersystem11getBusCountEv(ptr noundef nonnull align 8 dereferenceable(480)) local_unnamed_addr #1

declare noundef ptr @_ZNK9elabtsaot11Powersystem6getBusEm(ptr noundef nonnull align 8 dereferenceable(480), i64 noundef) local_unnamed_addr #1

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZN9elabtsaot3BusC2ERKS0_(ptr noundef nonnull align 8 dereferenceable(104), ptr noundef nonnull align 8 dereferenceable(104)) unnamed_addr #2 align 2

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

declare noundef i64 @_ZNK9elabtsaot11Powersystem14getBranchCountEv(ptr noundef nonnull align 8 dereferenceable(480)) local_unnamed_addr #1

declare noundef ptr @_ZNK9elabtsaot11Powersystem9getBranchEm(ptr noundef nonnull align 8 dereferenceable(480), i64 noundef) local_unnamed_addr #1

declare noundef i64 @_ZNK9elabtsaot11Powersystem11getGenCountEv(ptr noundef nonnull align 8 dereferenceable(480)) local_unnamed_addr #1

declare noundef ptr @_ZNK9elabtsaot11Powersystem12getGeneratorEm(ptr noundef nonnull align 8 dereferenceable(480), i64 noundef) local_unnamed_addr #1

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZN9elabtsaot9GeneratorC2ERKS0_(ptr noundef nonnull align 8 dereferenceable(216), ptr noundef nonnull align 8 dereferenceable(216)) unnamed_addr #2 align 2

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

declare noundef i64 @_ZNK9elabtsaot11Powersystem12getLoadCountEv(ptr noundef nonnull align 8 dereferenceable(480)) local_unnamed_addr #1

declare noundef ptr @_ZNK9elabtsaot11Powersystem7getLoadEm(ptr noundef nonnull align 8 dereferenceable(480), i64 noundef) local_unnamed_addr #1

attributes #0 = { mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { "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 = { inlinehint 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, !7, i64 8}
!6 = !{!"_ZTSN9elabtsaot8PwsModelE", !7, i64 8, !10, i64 16, !10, i64 40, !10, i64 64, !10, i64 88}
!7 = !{!"any pointer", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!"_ZTSN5boost10ptr_vectorIN9elabtsaot15PwsModelElementENS_20heap_clone_allocatorEvEE", !11, i64 0}
!11 = !{!"_ZTSN5boost20ptr_sequence_adapterIN9elabtsaot15PwsModelElementESt6vectorIPvSaIS4_EENS_20heap_clone_allocatorEEE", !12, i64 0}
!12 = !{!"_ZTSN5boost20ptr_container_detail24reversible_ptr_containerINS0_15sequence_configIN9elabtsaot15PwsModelElementESt6vectorIPvSaIS6_EEEENS_20heap_clone_allocatorEEE", !13, i64 0}
!13 = !{!"_ZTSSt6vectorIPvSaIS0_EE", !14, i64 0}
!14 = !{!"_ZTSSt12_Vector_baseIPvSaIS0_EE", !15, i64 0}
!15 = !{!"_ZTSNSt12_Vector_baseIPvSaIS0_EE12_Vector_implE", !16, i64 0}
!16 = !{!"_ZTSNSt12_Vector_baseIPvSaIS0_EE17_Vector_impl_dataE", !7, i64 0, !7, i64 8, !7, i64 16}
!17 = !{!18, !18, i64 0}
!18 = !{!"vtable pointer", !9, i64 0}
!19 = distinct !{!19, !20}
!20 = !{!"llvm.loop.mustprogress"}
!21 = distinct !{!21, !20}
!22 = distinct !{!22, !20}
!23 = distinct !{!23, !20}


; Effective O3 passes: DSEPass,EarlyCSEPass,GVNPass,GlobalOptPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,MemCpyOptPass,ReassociatePass,SROAPass,SimplifyCFGPass,TailCallElimPass