; 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.std::vector.75" = type { %"struct.std::_Vector_base.76" }
%"struct.std::_Vector_base.76" = type { %"struct.std::_Vector_base<std::pair<int, int>, std::allocator<std::pair<int, int>>>::_Vector_impl" }
%"struct.std::_Vector_base<std::pair<int, int>, std::allocator<std::pair<int, int>>>::_Vector_impl" = type { %"struct.std::_Vector_base<std::pair<int, int>, std::allocator<std::pair<int, int>>>::_Vector_impl_data" }
%"struct.std::_Vector_base<std::pair<int, int>, std::allocator<std::pair<int, int>>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"struct.std::pair" = type { i32, i32 }
%"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 }

declare i32 @__gxx_personality_v0(...)

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

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

declare noundef ptr @_ZNK9elabtsaot11Powersystem6getBusEm(ptr noundef nonnull align 8 dereferenceable(480), i64 noundef) #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

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

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

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

; 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) #4

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

declare noundef ptr @_ZNK9elabtsaot11Powersystem12getGeneratorEm(ptr noundef nonnull align 8 dereferenceable(480), i64 noundef) #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)) #1

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

; Function Attrs: mustprogress uwtable
define dso_local noundef i32 @_ZN9elabtsaot17PwsSchematicModel18planarizeSchematicEPKNS_11PowersystemE(ptr noundef nonnull align 8 dereferenceable(112) %0, ptr noundef %1) #5 align 2 personality ptr @__gxx_personality_v0 {
  %3 = alloca i32, align 4
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca %"class.std::vector.75", align 8
  %7 = alloca i64, align 8
  %8 = alloca i64, align 8
  %9 = alloca ptr, align 8
  %10 = alloca i32, align 4
  %11 = alloca ptr, align 8
  %12 = alloca i32, align 4
  %13 = alloca i32, align 4
  %14 = alloca i32, align 4
  %15 = alloca %"struct.std::pair", align 4
  %16 = alloca %"class.std::vector.75", align 8
  %17 = alloca %"class.std::vector.75", align 8
  %18 = alloca %"class.std::vector.75", align 8
  %19 = alloca i32, align 4
  %20 = alloca ptr, align 8
  %21 = alloca %"class.elabtsaot::Bus", align 8
  %22 = alloca ptr, align 8
  %23 = alloca %"class.elabtsaot::Branch", align 8
  %24 = alloca ptr, align 8
  %25 = alloca %"class.elabtsaot::Generator", align 8
  %26 = alloca ptr, align 8
  %27 = alloca %"class.elabtsaot::Load", align 8
  store ptr %0, ptr %4, align 8, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !5
  %28 = load ptr, ptr %4, align 8
  call void @llvm.lifetime.start.p0(i64 24, ptr %6) #7
  call void @_ZNSt6vectorISt4pairIiiESaIS1_EEC2Ev(ptr noundef nonnull align 8 dereferenceable(24) %6) #7
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #7
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #7
  %29 = load ptr, ptr %5, align 8, !tbaa !5
  %30 = invoke noundef i64 @_ZNK9elabtsaot11Powersystem14getBranchCountEv(ptr noundef nonnull align 8 dereferenceable(480) %29)
          to label %31 unwind label %44

31:                                               ; preds = %2
  store i64 %30, ptr %8, align 8, !tbaa !9
  store i64 0, ptr %7, align 8, !tbaa !9
  br label %32

32:                                               ; preds = %86, %31
  %33 = load i64, ptr %7, align 8, !tbaa !9
  %34 = load i64, ptr %8, align 8, !tbaa !9
  %35 = icmp ne i64 %33, %34
  br i1 %35, label %36, label %96

36:                                               ; preds = %32
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #7
  %37 = load ptr, ptr %5, align 8, !tbaa !5
  %38 = load i64, ptr %7, align 8, !tbaa !9
  %39 = invoke noundef ptr @_ZNK9elabtsaot11Powersystem9getBranchEm(ptr noundef nonnull align 8 dereferenceable(480) %37, i64 noundef %38)
          to label %40 unwind label %48

40:                                               ; preds = %36
  store ptr %39, ptr %11, align 8, !tbaa !5
  %41 = load ptr, ptr %11, align 8, !tbaa !5
  %42 = icmp ne ptr %41, null
  br i1 %42, label %52, label %43

43:                                               ; preds = %40
  store i32 2, ptr %12, align 4
  br label %83

44:                                               ; preds = %96, %2
  %45 = landingpad { ptr, i32 }
          cleanup
  %46 = extractvalue { ptr, i32 } %45, 0
  store ptr %46, ptr %9, align 8
  %47 = extractvalue { ptr, i32 } %45, 1
  store i32 %47, ptr %10, align 4
  br label %262

48:                                               ; preds = %36
  %49 = landingpad { ptr, i32 }
          cleanup
  %50 = extractvalue { ptr, i32 } %49, 0
  store ptr %50, ptr %9, align 8
  %51 = extractvalue { ptr, i32 } %49, 1
  store i32 %51, ptr %10, align 4
  br label %95

52:                                               ; preds = %40
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #7
  %53 = load ptr, ptr %5, align 8, !tbaa !5
  %54 = load ptr, ptr %11, align 8, !tbaa !5
  %55 = getelementptr inbounds %"class.elabtsaot::Branch", ptr %54, i32 0, i32 2
  %56 = load i32, ptr %55, align 8, !tbaa !11
  %57 = invoke noundef i32 @_ZNK9elabtsaot11Powersystem12getBus_intIdEj(ptr noundef nonnull align 8 dereferenceable(480) %53, i32 noundef %56)
          to label %58 unwind label %71

58:                                               ; preds = %52
  store i32 %57, ptr %13, align 4, !tbaa !16
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #7
  %59 = load ptr, ptr %5, align 8, !tbaa !5
  %60 = load ptr, ptr %11, align 8, !tbaa !5
  %61 = getelementptr inbounds %"class.elabtsaot::Branch", ptr %60, i32 0, i32 3
  %62 = load i32, ptr %61, align 4, !tbaa !17
  %63 = invoke noundef i32 @_ZNK9elabtsaot11Powersystem12getBus_intIdEj(ptr noundef nonnull align 8 dereferenceable(480) %59, i32 noundef %62)
          to label %64 unwind label %75

64:                                               ; preds = %58
  store i32 %63, ptr %14, align 4, !tbaa !16
  %65 = load i32, ptr %13, align 4, !tbaa !16
  %66 = icmp slt i32 %65, 0
  br i1 %66, label %70, label %67

67:                                               ; preds = %64
  %68 = load i32, ptr %14, align 4, !tbaa !16
  %69 = icmp slt i32 %68, 0
  br i1 %69, label %70, label %79

70:                                               ; preds = %67, %64
  store i32 1, ptr %3, align 4
  store i32 1, ptr %12, align 4
  br label %82

71:                                               ; preds = %52
  %72 = landingpad { ptr, i32 }
          cleanup
  %73 = extractvalue { ptr, i32 } %72, 0
  store ptr %73, ptr %9, align 8
  %74 = extractvalue { ptr, i32 } %72, 1
  store i32 %74, ptr %10, align 4
  br label %94

75:                                               ; preds = %58
  %76 = landingpad { ptr, i32 }
          cleanup
  %77 = extractvalue { ptr, i32 } %76, 0
  store ptr %77, ptr %9, align 8
  %78 = extractvalue { ptr, i32 } %76, 1
  store i32 %78, ptr %10, align 4
  br label %93

79:                                               ; preds = %67
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #7
  invoke void @_ZNSt4pairIiiEC2IRiS2_TnNSt9enable_ifIXaaclsr5_PCCPE22_MoveConstructiblePairIT_T0_EEclsr5_PCCPE30_ImplicitlyMoveConvertiblePairIS4_S5_EEEbE4typeELb1EEEOS4_OS5_(ptr noundef nonnull align 4 dereferenceable(8) %15, ptr noundef nonnull align 4 dereferenceable(4) %13, ptr noundef nonnull align 4 dereferenceable(4) %14)
          to label %80 unwind label %89

80:                                               ; preds = %79
  invoke void @_ZNSt6vectorISt4pairIiiESaIS1_EE9push_backERKS1_(ptr noundef nonnull align 8 dereferenceable(24) %6, ptr noundef nonnull align 4 dereferenceable(8) %15)
          to label %81 unwind label %89

81:                                               ; preds = %80
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #7
  store i32 0, ptr %12, align 4
  br label %82

82:                                               ; preds = %81, %70
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #7
  br label %83

83:                                               ; preds = %82, %43
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #7
  %84 = load i32, ptr %12, align 4
  switch i32 %84, label %260 [
    i32 0, label %85
    i32 2, label %96
  ]

85:                                               ; preds = %83
  br label %86

86:                                               ; preds = %85
  %87 = load i64, ptr %7, align 8, !tbaa !9
  %88 = add i64 %87, 1
  store i64 %88, ptr %7, align 8, !tbaa !9
  br label %32, !llvm.loop !18

89:                                               ; preds = %80, %79
  %90 = landingpad { ptr, i32 }
          cleanup
  %91 = extractvalue { ptr, i32 } %90, 0
  store ptr %91, ptr %9, align 8
  %92 = extractvalue { ptr, i32 } %90, 1
  store i32 %92, ptr %10, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #7
  br label %93

93:                                               ; preds = %89, %75
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #7
  br label %94

94:                                               ; preds = %93, %71
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #7
  br label %95

95:                                               ; preds = %94, %48
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #7
  br label %262

96:                                               ; preds = %83, %32
  %97 = load ptr, ptr %5, align 8, !tbaa !5
  %98 = invoke noundef i64 @_ZNK9elabtsaot11Powersystem11getBusCountEv(ptr noundef nonnull align 8 dereferenceable(480) %97)
          to label %99 unwind label %44

99:                                               ; preds = %96
  store i64 %98, ptr %8, align 8, !tbaa !9
  %100 = load i64, ptr %8, align 8, !tbaa !9
  %101 = icmp ule i64 %100, 0
  br i1 %101, label %102, label %103

102:                                              ; preds = %99
  store i32 2, ptr %3, align 4
  store i32 1, ptr %12, align 4
  br label %260

103:                                              ; preds = %99
  call void @llvm.lifetime.start.p0(i64 24, ptr %16) #7
  call void @_ZNSt6vectorISt4pairIiiESaIS1_EEC2Ev(ptr noundef nonnull align 8 dereferenceable(24) %16) #7
  %104 = load i64, ptr %8, align 8, !tbaa !9
  %105 = icmp ugt i64 %104, 0
  br i1 %105, label %106, label %121

106:                                              ; preds = %103
  call void @llvm.lifetime.start.p0(i64 24, ptr %17) #7
  %107 = load i64, ptr %8, align 8, !tbaa !9
  %108 = trunc i64 %107 to i32
  invoke void @_ZNSt6vectorISt4pairIiiESaIS1_EEC2ERKS3_(ptr noundef nonnull align 8 dereferenceable(24) %18, ptr noundef nonnull align 8 dereferenceable(24) %6)
          to label %109 unwind label %112

109:                                              ; preds = %106
  invoke void @_ZN9elabtsaot5graph14planarizeGraphEiSt6vectorISt4pairIiiESaIS3_EE(ptr dead_on_unwind writable sret(%"class.std::vector.75") align 8 %17, i32 noundef %108, ptr noundef %18)
          to label %110 unwind label %116

110:                                              ; preds = %109
  %111 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNSt6vectorISt4pairIiiESaIS1_EEaSEOS3_(ptr noundef nonnull align 8 dereferenceable(24) %16, ptr noundef nonnull align 8 dereferenceable(24) %17) #7
  call void @_ZNSt6vectorISt4pairIiiESaIS1_EED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %17) #7
  call void @_ZNSt6vectorISt4pairIiiESaIS1_EED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %18) #7
  call void @llvm.lifetime.end.p0(i64 24, ptr %17) #7
  br label %121

112:                                              ; preds = %106
  %113 = landingpad { ptr, i32 }
          cleanup
  %114 = extractvalue { ptr, i32 } %113, 0
  store ptr %114, ptr %9, align 8
  %115 = extractvalue { ptr, i32 } %113, 1
  store i32 %115, ptr %10, align 4
  br label %120

116:                                              ; preds = %109
  %117 = landingpad { ptr, i32 }
          cleanup
  %118 = extractvalue { ptr, i32 } %117, 0
  store ptr %118, ptr %9, align 8
  %119 = extractvalue { ptr, i32 } %117, 1
  store i32 %119, ptr %10, align 4
  call void @_ZNSt6vectorISt4pairIiiESaIS1_EED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %18) #7
  br label %120

120:                                              ; preds = %116, %112
  call void @llvm.lifetime.end.p0(i64 24, ptr %17) #7
  br label %259

121:                                              ; preds = %110, %103
  call void @llvm.lifetime.start.p0(i64 4, ptr %19) #7
  store i32 0, ptr %19, align 4, !tbaa !16
  %122 = load ptr, ptr %5, align 8, !tbaa !5
  %123 = invoke noundef i64 @_ZNK9elabtsaot11Powersystem11getBusCountEv(ptr noundef nonnull align 8 dereferenceable(480) %122)
          to label %124 unwind label %153

124:                                              ; preds = %121
  store i64 %123, ptr %8, align 8, !tbaa !9
  store i64 0, ptr %7, align 8, !tbaa !9
  br label %125

125:                                              ; preds = %150, %124
  %126 = load i64, ptr %7, align 8, !tbaa !9
  %127 = load i64, ptr %8, align 8, !tbaa !9
  %128 = icmp ne i64 %126, %127
  br i1 %128, label %129, label %166

129:                                              ; preds = %125
  call void @llvm.lifetime.start.p0(i64 8, ptr %20) #7
  %130 = load ptr, ptr %5, align 8, !tbaa !5
  %131 = load i64, ptr %7, align 8, !tbaa !9
  %132 = invoke noundef ptr @_ZNK9elabtsaot11Powersystem6getBusEm(ptr noundef nonnull align 8 dereferenceable(480) %130, i64 noundef %131)
          to label %133 unwind label %157

133:                                              ; preds = %129
  store ptr %132, ptr %20, align 8, !tbaa !5
  %134 = load ptr, ptr %20, align 8, !tbaa !5
  invoke void @_ZN9elabtsaot3BusC2ERKS0_(ptr noundef nonnull align 8 dereferenceable(104) %21, ptr noundef nonnull align 8 dereferenceable(104) %134)
          to label %135 unwind label %157

135:                                              ; preds = %133
  %136 = load i64, ptr %7, align 8, !tbaa !9
  %137 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt6vectorISt4pairIiiESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %16, i64 noundef %136) #7
  %138 = getelementptr inbounds %"struct.std::pair", ptr %137, i32 0, i32 0
  %139 = load i32, ptr %138, align 4, !tbaa !20
  %140 = mul nsw i32 60, %139
  %141 = load i64, ptr %7, align 8, !tbaa !9
  %142 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt6vectorISt4pairIiiESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %16, i64 noundef %141) #7
  %143 = getelementptr inbounds %"struct.std::pair", ptr %142, i32 0, i32 1
  %144 = load i32, ptr %143, align 4, !tbaa !22
  %145 = mul nsw i32 30, %144
  %146 = invoke noundef i32 @_ZN9elabtsaot17PwsSchematicModel13addBusElementENS_3BusEiibbPi(ptr noundef nonnull align 8 dereferenceable(112) %28, ptr noundef %21, i32 noundef %140, i32 noundef %145, i1 noundef zeroext true, i1 noundef zeroext true, ptr noundef null)
          to label %147 unwind label %161

147:                                              ; preds = %135
  %148 = load i32, ptr %19, align 4, !tbaa !16
  %149 = or i32 %148, %146
  store i32 %149, ptr %19, align 4, !tbaa !16
  call void @_ZN9elabtsaot3BusD2Ev(ptr noundef nonnull align 8 dereferenceable(104) %21) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %20) #7
  br label %150

150:                                              ; preds = %147
  %151 = load i64, ptr %7, align 8, !tbaa !9
  %152 = add i64 %151, 1
  store i64 %152, ptr %7, align 8, !tbaa !9
  br label %125, !llvm.loop !23

153:                                              ; preds = %228, %194, %166, %121
  %154 = landingpad { ptr, i32 }
          cleanup
  %155 = extractvalue { ptr, i32 } %154, 0
  store ptr %155, ptr %9, align 8
  %156 = extractvalue { ptr, i32 } %154, 1
  store i32 %156, ptr %10, align 4
  br label %258

157:                                              ; preds = %133, %129
  %158 = landingpad { ptr, i32 }
          cleanup
  %159 = extractvalue { ptr, i32 } %158, 0
  store ptr %159, ptr %9, align 8
  %160 = extractvalue { ptr, i32 } %158, 1
  store i32 %160, ptr %10, align 4
  br label %165

161:                                              ; preds = %135
  %162 = landingpad { ptr, i32 }
          cleanup
  %163 = extractvalue { ptr, i32 } %162, 0
  store ptr %163, ptr %9, align 8
  %164 = extractvalue { ptr, i32 } %162, 1
  store i32 %164, ptr %10, align 4
  call void @_ZN9elabtsaot3BusD2Ev(ptr noundef nonnull align 8 dereferenceable(104) %21) #7
  br label %165

165:                                              ; preds = %161, %157
  call void @llvm.lifetime.end.p0(i64 8, ptr %20) #7
  br label %258

166:                                              ; preds = %125
  %167 = load ptr, ptr %5, align 8, !tbaa !5
  %168 = invoke noundef i64 @_ZNK9elabtsaot11Powersystem14getBranchCountEv(ptr noundef nonnull align 8 dereferenceable(480) %167)
          to label %169 unwind label %153

169:                                              ; preds = %166
  store i64 %168, ptr %8, align 8, !tbaa !9
  store i64 0, ptr %7, align 8, !tbaa !9
  br label %170

170:                                              ; preds = %187, %169
  %171 = load i64, ptr %7, align 8, !tbaa !9
  %172 = load i64, ptr %8, align 8, !tbaa !9
  %173 = icmp ne i64 %171, %172
  br i1 %173, label %174, label %194

174:                                              ; preds = %170
  call void @llvm.lifetime.start.p0(i64 8, ptr %22) #7
  %175 = load ptr, ptr %5, align 8, !tbaa !5
  %176 = load i64, ptr %7, align 8, !tbaa !9
  %177 = invoke noundef ptr @_ZNK9elabtsaot11Powersystem9getBranchEm(ptr noundef nonnull align 8 dereferenceable(480) %175, i64 noundef %176)
          to label %178 unwind label %190

178:                                              ; preds = %174
  store ptr %177, ptr %22, align 8, !tbaa !5
  %179 = load ptr, ptr %22, align 8, !tbaa !5
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %23, ptr align 8 %179, i64 80, i1 false), !tbaa.struct !24
  %180 = load ptr, ptr %28, align 8, !tbaa !27
  %181 = getelementptr inbounds ptr, ptr %180, i64 7
  %182 = load ptr, ptr %181, align 8
  %183 = invoke noundef i32 %182(ptr noundef nonnull align 8 dereferenceable(112) %28, ptr noundef byval(%"class.elabtsaot::Branch") align 8 %23, i1 noundef zeroext true, ptr noundef null)
          to label %184 unwind label %190

184:                                              ; preds = %178
  %185 = load i32, ptr %19, align 4, !tbaa !16
  %186 = or i32 %185, %183
  store i32 %186, ptr %19, align 4, !tbaa !16
  call void @llvm.lifetime.end.p0(i64 8, ptr %22) #7
  br label %187

187:                                              ; preds = %184
  %188 = load i64, ptr %7, align 8, !tbaa !9
  %189 = add i64 %188, 1
  store i64 %189, ptr %7, align 8, !tbaa !9
  br label %170, !llvm.loop !29

190:                                              ; preds = %178, %174
  %191 = landingpad { ptr, i32 }
          cleanup
  %192 = extractvalue { ptr, i32 } %191, 0
  store ptr %192, ptr %9, align 8
  %193 = extractvalue { ptr, i32 } %191, 1
  store i32 %193, ptr %10, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %22) #7
  br label %258

194:                                              ; preds = %170
  %195 = load ptr, ptr %5, align 8, !tbaa !5
  %196 = invoke noundef i64 @_ZNK9elabtsaot11Powersystem11getGenCountEv(ptr noundef nonnull align 8 dereferenceable(480) %195)
          to label %197 unwind label %153

197:                                              ; preds = %194
  store i64 %196, ptr %8, align 8, !tbaa !9
  store i64 0, ptr %7, align 8, !tbaa !9
  br label %198

198:                                              ; preds = %216, %197
  %199 = load i64, ptr %7, align 8, !tbaa !9
  %200 = load i64, ptr %8, align 8, !tbaa !9
  %201 = icmp ne i64 %199, %200
  br i1 %201, label %202, label %228

202:                                              ; preds = %198
  call void @llvm.lifetime.start.p0(i64 8, ptr %24) #7
  %203 = load ptr, ptr %5, align 8, !tbaa !5
  %204 = load i64, ptr %7, align 8, !tbaa !9
  %205 = invoke noundef ptr @_ZNK9elabtsaot11Powersystem12getGeneratorEm(ptr noundef nonnull align 8 dereferenceable(480) %203, i64 noundef %204)
          to label %206 unwind label %219

206:                                              ; preds = %202
  store ptr %205, ptr %24, align 8, !tbaa !5
  %207 = load ptr, ptr %24, align 8, !tbaa !5
  invoke void @_ZN9elabtsaot9GeneratorC2ERKS0_(ptr noundef nonnull align 8 dereferenceable(216) %25, ptr noundef nonnull align 8 dereferenceable(216) %207)
          to label %208 unwind label %219

208:                                              ; preds = %206
  %209 = load ptr, ptr %28, align 8, !tbaa !27
  %210 = getelementptr inbounds ptr, ptr %209, i64 8
  %211 = load ptr, ptr %210, align 8
  %212 = invoke noundef i32 %211(ptr noundef nonnull align 8 dereferenceable(112) %28, ptr noundef %25, i1 noundef zeroext true, ptr noundef null)
          to label %213 unwind label %223

213:                                              ; preds = %208
  %214 = load i32, ptr %19, align 4, !tbaa !16
  %215 = or i32 %214, %212
  store i32 %215, ptr %19, align 4, !tbaa !16
  call void @_ZN9elabtsaot9GeneratorD2Ev(ptr noundef nonnull align 8 dereferenceable(216) %25) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %24) #7
  br label %216

216:                                              ; preds = %213
  %217 = load i64, ptr %7, align 8, !tbaa !9
  %218 = add i64 %217, 1
  store i64 %218, ptr %7, align 8, !tbaa !9
  br label %198, !llvm.loop !30

219:                                              ; preds = %206, %202
  %220 = landingpad { ptr, i32 }
          cleanup
  %221 = extractvalue { ptr, i32 } %220, 0
  store ptr %221, ptr %9, align 8
  %222 = extractvalue { ptr, i32 } %220, 1
  store i32 %222, ptr %10, align 4
  br label %227

223:                                              ; preds = %208
  %224 = landingpad { ptr, i32 }
          cleanup
  %225 = extractvalue { ptr, i32 } %224, 0
  store ptr %225, ptr %9, align 8
  %226 = extractvalue { ptr, i32 } %224, 1
  store i32 %226, ptr %10, align 4
  call void @_ZN9elabtsaot9GeneratorD2Ev(ptr noundef nonnull align 8 dereferenceable(216) %25) #7
  br label %227

227:                                              ; preds = %223, %219
  call void @llvm.lifetime.end.p0(i64 8, ptr %24) #7
  br label %258

228:                                              ; preds = %198
  %229 = load ptr, ptr %5, align 8, !tbaa !5
  %230 = invoke noundef i64 @_ZNK9elabtsaot11Powersystem12getLoadCountEv(ptr noundef nonnull align 8 dereferenceable(480) %229)
          to label %231 unwind label %153

231:                                              ; preds = %228
  store i64 %230, ptr %8, align 8, !tbaa !9
  store i64 0, ptr %7, align 8, !tbaa !9
  br label %232

232:                                              ; preds = %249, %231
  %233 = load i64, ptr %7, align 8, !tbaa !9
  %234 = load i64, ptr %8, align 8, !tbaa !9
  %235 = icmp ne i64 %233, %234
  br i1 %235, label %236, label %256

236:                                              ; preds = %232
  call void @llvm.lifetime.start.p0(i64 8, ptr %26) #7
  %237 = load ptr, ptr %5, align 8, !tbaa !5
  %238 = load i64, ptr %7, align 8, !tbaa !9
  %239 = invoke noundef ptr @_ZNK9elabtsaot11Powersystem7getLoadEm(ptr noundef nonnull align 8 dereferenceable(480) %237, i64 noundef %238)
          to label %240 unwind label %252

240:                                              ; preds = %236
  store ptr %239, ptr %26, align 8, !tbaa !5
  %241 = load ptr, ptr %26, align 8, !tbaa !5
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %27, ptr align 8 %241, i64 72, i1 false), !tbaa.struct !31
  %242 = load ptr, ptr %28, align 8, !tbaa !27
  %243 = getelementptr inbounds ptr, ptr %242, i64 9
  %244 = load ptr, ptr %243, align 8
  %245 = invoke noundef i32 %244(ptr noundef nonnull align 8 dereferenceable(112) %28, ptr noundef byval(%"class.elabtsaot::Load") align 8 %27, i1 noundef zeroext true, ptr noundef null)
          to label %246 unwind label %252

246:                                              ; preds = %240
  %247 = load i32, ptr %19, align 4, !tbaa !16
  %248 = or i32 %247, %245
  store i32 %248, ptr %19, align 4, !tbaa !16
  call void @llvm.lifetime.end.p0(i64 8, ptr %26) #7
  br label %249

249:                                              ; preds = %246
  %250 = load i64, ptr %7, align 8, !tbaa !9
  %251 = add i64 %250, 1
  store i64 %251, ptr %7, align 8, !tbaa !9
  br label %232, !llvm.loop !33

252:                                              ; preds = %240, %236
  %253 = landingpad { ptr, i32 }
          cleanup
  %254 = extractvalue { ptr, i32 } %253, 0
  store ptr %254, ptr %9, align 8
  %255 = extractvalue { ptr, i32 } %253, 1
  store i32 %255, ptr %10, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %26) #7
  br label %258

256:                                              ; preds = %232
  %257 = load i32, ptr %19, align 4, !tbaa !16
  store i32 %257, ptr %3, align 4
  store i32 1, ptr %12, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %19) #7
  call void @_ZNSt6vectorISt4pairIiiESaIS1_EED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %16) #7
  call void @llvm.lifetime.end.p0(i64 24, ptr %16) #7
  br label %260

258:                                              ; preds = %252, %227, %190, %165, %153
  call void @llvm.lifetime.end.p0(i64 4, ptr %19) #7
  br label %259

259:                                              ; preds = %258, %120
  call void @_ZNSt6vectorISt4pairIiiESaIS1_EED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %16) #7
  call void @llvm.lifetime.end.p0(i64 24, ptr %16) #7
  br label %262

260:                                              ; preds = %256, %102, %83
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #7
  call void @_ZNSt6vectorISt4pairIiiESaIS1_EED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %6) #7
  call void @llvm.lifetime.end.p0(i64 24, ptr %6) #7
  %261 = load i32, ptr %3, align 4
  ret i32 %261

262:                                              ; preds = %259, %95, %44
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #7
  call void @_ZNSt6vectorISt4pairIiiESaIS1_EED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %6) #7
  call void @llvm.lifetime.end.p0(i64 24, ptr %6) #7
  br label %263

263:                                              ; preds = %262
  %264 = load ptr, ptr %9, align 8
  %265 = load i32, ptr %10, align 4
  %266 = insertvalue { ptr, i32 } poison, ptr %264, 0
  %267 = insertvalue { ptr, i32 } %266, i32 %265, 1
  resume { ptr, i32 } %267
}

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

declare noundef i32 @_ZNK9elabtsaot11Powersystem12getBus_intIdEj(ptr noundef nonnull align 8 dereferenceable(480), i32 noundef) #1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt4pairIiiEC2IRiS2_TnNSt9enable_ifIXaaclsr5_PCCPE22_MoveConstructiblePairIT_T0_EEclsr5_PCCPE30_ImplicitlyMoveConvertiblePairIS4_S5_EEEbE4typeELb1EEEOS4_OS5_(ptr noundef nonnull align 4 dereferenceable(8), ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4)) unnamed_addr #6 align 2

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

declare void @_ZN9elabtsaot5graph14planarizeGraphEiSt6vectorISt4pairIiiESaIS3_EE(ptr dead_on_unwind writable sret(%"class.std::vector.75") align 8, i32 noundef, ptr noundef) #1

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

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

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

; Function Attrs: mustprogress uwtable
declare dso_local noundef i32 @_ZN9elabtsaot17PwsSchematicModel13addBusElementENS_3BusEiibbPi(ptr noundef nonnull align 8 dereferenceable(112), ptr noundef, i32 noundef, i32 noundef, i1 noundef zeroext, i1 noundef zeroext, ptr noundef) #5 align 2

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

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #5 = { 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 #6 = { 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 #7 = { 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 = !{!"long", !7, i64 0}
!11 = !{!12, !13, i64 8}
!12 = !{!"_ZTSN9elabtsaot6BranchE", !13, i64 0, !14, i64 4, !13, i64 8, !13, i64 12, !15, i64 16, !15, i64 24, !15, i64 32, !15, i64 40, !15, i64 48, !15, i64 56, !15, i64 64, !15, i64 72}
!13 = !{!"int", !7, i64 0}
!14 = !{!"bool", !7, i64 0}
!15 = !{!"double", !7, i64 0}
!16 = !{!13, !13, i64 0}
!17 = !{!12, !13, i64 12}
!18 = distinct !{!18, !19}
!19 = !{!"llvm.loop.mustprogress"}
!20 = !{!21, !13, i64 0}
!21 = !{!"_ZTSSt4pairIiiE", !13, i64 0, !13, i64 4}
!22 = !{!21, !13, i64 4}
!23 = distinct !{!23, !19}
!24 = !{i64 0, i64 4, !16, i64 4, i64 1, !25, i64 8, i64 4, !16, i64 12, i64 4, !16, i64 16, i64 8, !26, i64 24, i64 8, !26, i64 32, i64 8, !26, i64 40, i64 8, !26, i64 48, i64 8, !26, i64 56, i64 8, !26, i64 64, i64 8, !26, i64 72, i64 8, !26}
!25 = !{!14, !14, i64 0}
!26 = !{!15, !15, i64 0}
!27 = !{!28, !28, i64 0}
!28 = !{!"vtable pointer", !8, i64 0}
!29 = distinct !{!29, !19}
!30 = distinct !{!30, !19}
!31 = !{i64 0, i64 4, !16, i64 4, i64 4, !16, i64 8, i64 8, !26, i64 16, i64 8, !26, i64 24, i64 16, !32, i64 40, i64 8, !26, i64 48, i64 8, !26, i64 56, i64 8, !26, i64 64, i64 8, !26}
!32 = !{!7, !7, i64 0}
!33 = distinct !{!33, !19}


; 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.75" = type { %"struct.std::_Vector_base.76" }
%"struct.std::_Vector_base.76" = type { %"struct.std::_Vector_base<std::pair<int, int>, std::allocator<std::pair<int, int>>>::_Vector_impl" }
%"struct.std::_Vector_base<std::pair<int, int>, std::allocator<std::pair<int, int>>>::_Vector_impl" = type { %"struct.std::_Vector_base<std::pair<int, int>, std::allocator<std::pair<int, int>>>::_Vector_impl_data" }
%"struct.std::_Vector_base<std::pair<int, int>, std::allocator<std::pair<int, int>>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"struct.std::pair" = type { i32, i32 }
%"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 nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #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

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

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

; Function Attrs: mustprogress uwtable
define dso_local noundef i32 @_ZN9elabtsaot17PwsSchematicModel18planarizeSchematicEPKNS_11PowersystemE(ptr noundef nonnull align 8 dereferenceable(112) %0, ptr noundef %1) local_unnamed_addr #4 align 2 personality ptr @__gxx_personality_v0 {
  %3 = alloca %"class.std::vector.75", align 8
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  %6 = alloca %"struct.std::pair", align 4
  %7 = alloca %"class.std::vector.75", align 8
  %8 = alloca %"class.std::vector.75", align 8
  %9 = alloca %"class.std::vector.75", align 8
  %10 = alloca %"class.elabtsaot::Bus", align 8
  %11 = alloca %"class.elabtsaot::Generator", align 8
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %3) #6
  call void @_ZNSt6vectorISt4pairIiiESaIS1_EEC2Ev(ptr noundef nonnull align 8 dereferenceable(24) %3) #6
  %12 = invoke noundef i64 @_ZNK9elabtsaot11Powersystem14getBranchCountEv(ptr noundef nonnull align 8 dereferenceable(480) %1)
          to label %.preheader104 unwind label %15

.preheader104:                                    ; preds = %2
  %.not111 = icmp eq i64 %12, 0
  br i1 %.not111, label %.thread, label %.lr.ph

.lr.ph:                                           ; preds = %.preheader104, %35
  %.055112 = phi i64 [ %36, %35 ], [ 0, %.preheader104 ]
  %13 = invoke noundef ptr @_ZNK9elabtsaot11Powersystem9getBranchEm(ptr noundef nonnull align 8 dereferenceable(480) %1, i64 noundef %.055112)
          to label %14 unwind label %17

14:                                               ; preds = %.lr.ph
  %.not81 = icmp eq ptr %13, null
  br i1 %.not81, label %.thread, label %19

15:                                               ; preds = %.thread, %2
  %16 = landingpad { ptr, i32 }
          cleanup
  br label %116

17:                                               ; preds = %.lr.ph
  %18 = landingpad { ptr, i32 }
          cleanup
  br label %116

19:                                               ; preds = %14
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %4) #6
  %20 = getelementptr inbounds i8, ptr %13, i64 8
  %21 = load i32, ptr %20, align 8, !tbaa !5
  %22 = invoke noundef i32 @_ZNK9elabtsaot11Powersystem12getBus_intIdEj(ptr noundef nonnull align 8 dereferenceable(480) %1, i32 noundef %21)
          to label %23 unwind label %30

23:                                               ; preds = %19
  store i32 %22, ptr %4, align 4, !tbaa !12
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %5) #6
  %24 = getelementptr inbounds i8, ptr %13, i64 12
  %25 = load i32, ptr %24, align 4, !tbaa !13
  %26 = invoke noundef i32 @_ZNK9elabtsaot11Powersystem12getBus_intIdEj(ptr noundef nonnull align 8 dereferenceable(480) %1, i32 noundef %25)
          to label %27 unwind label %32

27:                                               ; preds = %23
  store i32 %26, ptr %5, align 4, !tbaa !12
  %28 = load i32, ptr %4, align 4, !tbaa !12
  %29 = or i32 %28, %26
  %or.cond.not = icmp sgt i32 %29, -1
  br i1 %or.cond.not, label %34, label %.thread99

.thread99:                                        ; preds = %27
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %5) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %4) #6
  br label %115

30:                                               ; preds = %19
  %31 = landingpad { ptr, i32 }
          cleanup
  br label %40

32:                                               ; preds = %23
  %33 = landingpad { ptr, i32 }
          cleanup
  br label %39

34:                                               ; preds = %27
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %6) #6
  call void @_ZNSt4pairIiiEC2IRiS2_TnNSt9enable_ifIXaaclsr5_PCCPE22_MoveConstructiblePairIT_T0_EEclsr5_PCCPE30_ImplicitlyMoveConvertiblePairIS4_S5_EEEbE4typeELb1EEEOS4_OS5_(ptr noundef nonnull align 4 dereferenceable(8) %6, ptr noundef nonnull align 4 dereferenceable(4) %4, ptr noundef nonnull align 4 dereferenceable(4) %5)
  invoke void @_ZNSt6vectorISt4pairIiiESaIS1_EE9push_backERKS1_(ptr noundef nonnull align 8 dereferenceable(24) %3, ptr noundef nonnull align 4 dereferenceable(8) %6)
          to label %35 unwind label %37

35:                                               ; preds = %34
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %6) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %5) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %4) #6
  %36 = add nuw i64 %.055112, 1
  %.not = icmp eq i64 %36, %12
  br i1 %.not, label %.thread, label %.lr.ph, !llvm.loop !14

37:                                               ; preds = %34
  %38 = landingpad { ptr, i32 }
          cleanup
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %6) #6
  br label %39

39:                                               ; preds = %37, %32
  %.pn = phi { ptr, i32 } [ %38, %37 ], [ %33, %32 ]
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %5) #6
  br label %40

40:                                               ; preds = %39, %30
  %.pn.pn = phi { ptr, i32 } [ %.pn, %39 ], [ %31, %30 ]
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %4) #6
  br label %116

.thread:                                          ; preds = %35, %14, %.preheader104
  %41 = invoke noundef i64 @_ZNK9elabtsaot11Powersystem11getBusCountEv(ptr noundef nonnull align 8 dereferenceable(480) %1)
          to label %42 unwind label %15

42:                                               ; preds = %.thread
  %43 = icmp eq i64 %41, 0
  br i1 %43, label %115, label %44

44:                                               ; preds = %42
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %7) #6
  call void @_ZNSt6vectorISt4pairIiiESaIS1_EEC2Ev(ptr noundef nonnull align 8 dereferenceable(24) %7) #6
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %8) #6
  invoke void @_ZNSt6vectorISt4pairIiiESaIS1_EEC2ERKS3_(ptr noundef nonnull align 8 dereferenceable(24) %9, ptr noundef nonnull align 8 dereferenceable(24) %3)
          to label %45 unwind label %50

45:                                               ; preds = %44
  %46 = trunc i64 %41 to i32
  invoke void @_ZN9elabtsaot5graph14planarizeGraphEiSt6vectorISt4pairIiiESaIS3_EE(ptr dead_on_unwind nonnull writable sret(%"class.std::vector.75") align 8 %8, i32 noundef %46, ptr noundef nonnull %9)
          to label %47 unwind label %52

47:                                               ; preds = %45
  %48 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNSt6vectorISt4pairIiiESaIS1_EEaSEOS3_(ptr noundef nonnull align 8 dereferenceable(24) %7, ptr noundef nonnull align 8 dereferenceable(24) %8) #6
  call void @_ZNSt6vectorISt4pairIiiESaIS1_EED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %8) #6
  call void @_ZNSt6vectorISt4pairIiiESaIS1_EED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %9) #6
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %8) #6
  %49 = invoke noundef i64 @_ZNK9elabtsaot11Powersystem11getBusCountEv(ptr noundef nonnull align 8 dereferenceable(480) %1)
          to label %.preheader103 unwind label %69

.preheader103:                                    ; preds = %47
  %.not87114 = icmp eq i64 %49, 0
  br i1 %.not87114, label %._crit_edge, label %.lr.ph117

50:                                               ; preds = %44
  %51 = landingpad { ptr, i32 }
          cleanup
  br label %54

52:                                               ; preds = %45
  %53 = landingpad { ptr, i32 }
          cleanup
  call void @_ZNSt6vectorISt4pairIiiESaIS1_EED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %9) #6
  br label %54

54:                                               ; preds = %52, %50
  %.pn85 = phi { ptr, i32 } [ %53, %52 ], [ %51, %50 ]
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %8) #6
  br label %114

.lr.ph117:                                        ; preds = %.preheader103, %66
  %.156116 = phi i64 [ %68, %66 ], [ 0, %.preheader103 ]
  %.064115 = phi i32 [ %67, %66 ], [ 0, %.preheader103 ]
  %55 = invoke noundef ptr @_ZNK9elabtsaot11Powersystem6getBusEm(ptr noundef nonnull align 8 dereferenceable(480) %1, i64 noundef %.156116)
          to label %56 unwind label %71

56:                                               ; preds = %.lr.ph117
  invoke void @_ZN9elabtsaot3BusC2ERKS0_(ptr noundef nonnull align 8 dereferenceable(104) %10, ptr noundef nonnull align 8 dereferenceable(104) %55)
          to label %57 unwind label %71

57:                                               ; preds = %56
  %58 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt6vectorISt4pairIiiESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %7, i64 noundef %.156116) #6
  %59 = load i32, ptr %58, align 4, !tbaa !16
  %60 = mul nsw i32 %59, 60
  %61 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt6vectorISt4pairIiiESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %7, i64 noundef %.156116) #6
  %62 = getelementptr inbounds i8, ptr %61, i64 4
  %63 = load i32, ptr %62, align 4, !tbaa !18
  %64 = mul nsw i32 %63, 30
  %65 = invoke noundef i32 @_ZN9elabtsaot17PwsSchematicModel13addBusElementENS_3BusEiibbPi(ptr noundef nonnull align 8 dereferenceable(112) %0, ptr noundef nonnull %10, i32 noundef %60, i32 noundef %64, i1 noundef zeroext true, i1 noundef zeroext true, ptr noundef null)
          to label %66 unwind label %73

66:                                               ; preds = %57
  %67 = or i32 %65, %.064115
  call void @_ZN9elabtsaot3BusD2Ev(ptr noundef nonnull align 8 dereferenceable(104) %10) #6
  %68 = add nuw i64 %.156116, 1
  %.not87 = icmp eq i64 %68, %49
  br i1 %.not87, label %._crit_edge, label %.lr.ph117, !llvm.loop !19

69:                                               ; preds = %._crit_edge128, %._crit_edge122, %._crit_edge, %47
  %70 = landingpad { ptr, i32 }
          cleanup
  br label %114

71:                                               ; preds = %56, %.lr.ph117
  %72 = landingpad { ptr, i32 }
          cleanup
  br label %114

73:                                               ; preds = %57
  %74 = landingpad { ptr, i32 }
          cleanup
  call void @_ZN9elabtsaot3BusD2Ev(ptr noundef nonnull align 8 dereferenceable(104) %10) #6
  br label %114

._crit_edge:                                      ; preds = %66, %.preheader103
  %.064.lcssa = phi i32 [ 0, %.preheader103 ], [ %67, %66 ]
  %75 = invoke noundef i64 @_ZNK9elabtsaot11Powersystem14getBranchCountEv(ptr noundef nonnull align 8 dereferenceable(480) %1)
          to label %.preheader102 unwind label %69

.preheader102:                                    ; preds = %._crit_edge
  %.not88118 = icmp eq i64 %75, 0
  br i1 %.not88118, label %._crit_edge122, label %.lr.ph121

.lr.ph121:                                        ; preds = %.preheader102, %82
  %.257120 = phi i64 [ %84, %82 ], [ 0, %.preheader102 ]
  %.165119 = phi i32 [ %83, %82 ], [ %.064.lcssa, %.preheader102 ]
  %76 = invoke noundef ptr @_ZNK9elabtsaot11Powersystem9getBranchEm(ptr noundef nonnull align 8 dereferenceable(480) %1, i64 noundef %.257120)
          to label %77 unwind label %85

77:                                               ; preds = %.lr.ph121
  %78 = load ptr, ptr %0, align 8, !tbaa !20
  %79 = getelementptr inbounds i8, ptr %78, i64 56
  %80 = load ptr, ptr %79, align 8
  %81 = invoke noundef i32 %80(ptr noundef nonnull align 8 dereferenceable(112) %0, ptr noundef nonnull byval(%"class.elabtsaot::Branch") align 8 %76, i1 noundef zeroext true, ptr noundef null)
          to label %82 unwind label %85

82:                                               ; preds = %77
  %83 = or i32 %81, %.165119
  %84 = add nuw i64 %.257120, 1
  %.not88 = icmp eq i64 %84, %75
  br i1 %.not88, label %._crit_edge122, label %.lr.ph121, !llvm.loop !22

85:                                               ; preds = %77, %.lr.ph121
  %86 = landingpad { ptr, i32 }
          cleanup
  br label %114

._crit_edge122:                                   ; preds = %82, %.preheader102
  %.165.lcssa = phi i32 [ %.064.lcssa, %.preheader102 ], [ %83, %82 ]
  %87 = invoke noundef i64 @_ZNK9elabtsaot11Powersystem11getGenCountEv(ptr noundef nonnull align 8 dereferenceable(480) %1)
          to label %.preheader101 unwind label %69

.preheader101:                                    ; preds = %._crit_edge122
  %.not89124 = icmp eq i64 %87, 0
  br i1 %.not89124, label %._crit_edge128, label %.lr.ph127

.lr.ph127:                                        ; preds = %.preheader101, %95
  %.358126 = phi i64 [ %97, %95 ], [ 0, %.preheader101 ]
  %.266125 = phi i32 [ %96, %95 ], [ %.165.lcssa, %.preheader101 ]
  %88 = invoke noundef ptr @_ZNK9elabtsaot11Powersystem12getGeneratorEm(ptr noundef nonnull align 8 dereferenceable(480) %1, i64 noundef %.358126)
          to label %89 unwind label %98

89:                                               ; preds = %.lr.ph127
  invoke void @_ZN9elabtsaot9GeneratorC2ERKS0_(ptr noundef nonnull align 8 dereferenceable(216) %11, ptr noundef nonnull align 8 dereferenceable(216) %88)
          to label %90 unwind label %98

90:                                               ; preds = %89
  %91 = load ptr, ptr %0, align 8, !tbaa !20
  %92 = getelementptr inbounds i8, ptr %91, i64 64
  %93 = load ptr, ptr %92, align 8
  %94 = invoke noundef i32 %93(ptr noundef nonnull align 8 dereferenceable(112) %0, ptr noundef nonnull %11, i1 noundef zeroext true, ptr noundef null)
          to label %95 unwind label %100

95:                                               ; preds = %90
  %96 = or i32 %94, %.266125
  call void @_ZN9elabtsaot9GeneratorD2Ev(ptr noundef nonnull align 8 dereferenceable(216) %11) #6
  %97 = add nuw i64 %.358126, 1
  %.not89 = icmp eq i64 %97, %87
  br i1 %.not89, label %._crit_edge128, label %.lr.ph127, !llvm.loop !23

98:                                               ; preds = %89, %.lr.ph127
  %99 = landingpad { ptr, i32 }
          cleanup
  br label %114

100:                                              ; preds = %90
  %101 = landingpad { ptr, i32 }
          cleanup
  call void @_ZN9elabtsaot9GeneratorD2Ev(ptr noundef nonnull align 8 dereferenceable(216) %11) #6
  br label %114

._crit_edge128:                                   ; preds = %95, %.preheader101
  %.266.lcssa = phi i32 [ %.165.lcssa, %.preheader101 ], [ %96, %95 ]
  %102 = invoke noundef i64 @_ZNK9elabtsaot11Powersystem12getLoadCountEv(ptr noundef nonnull align 8 dereferenceable(480) %1)
          to label %.preheader unwind label %69

.preheader:                                       ; preds = %._crit_edge128
  %.not90130 = icmp eq i64 %102, 0
  br i1 %.not90130, label %._crit_edge134, label %.lr.ph133

.lr.ph133:                                        ; preds = %.preheader, %109
  %.4132 = phi i64 [ %111, %109 ], [ 0, %.preheader ]
  %.367131 = phi i32 [ %110, %109 ], [ %.266.lcssa, %.preheader ]
  %103 = invoke noundef ptr @_ZNK9elabtsaot11Powersystem7getLoadEm(ptr noundef nonnull align 8 dereferenceable(480) %1, i64 noundef %.4132)
          to label %104 unwind label %112

104:                                              ; preds = %.lr.ph133
  %105 = load ptr, ptr %0, align 8, !tbaa !20
  %106 = getelementptr inbounds i8, ptr %105, i64 72
  %107 = load ptr, ptr %106, align 8
  %108 = invoke noundef i32 %107(ptr noundef nonnull align 8 dereferenceable(112) %0, ptr noundef nonnull byval(%"class.elabtsaot::Load") align 8 %103, i1 noundef zeroext true, ptr noundef null)
          to label %109 unwind label %112

109:                                              ; preds = %104
  %110 = or i32 %108, %.367131
  %111 = add nuw i64 %.4132, 1
  %.not90 = icmp eq i64 %111, %102
  br i1 %.not90, label %._crit_edge134, label %.lr.ph133, !llvm.loop !24

112:                                              ; preds = %104, %.lr.ph133
  %113 = landingpad { ptr, i32 }
          cleanup
  br label %114

._crit_edge134:                                   ; preds = %109, %.preheader
  %.367.lcssa = phi i32 [ %.266.lcssa, %.preheader ], [ %110, %109 ]
  call void @_ZNSt6vectorISt4pairIiiESaIS1_EED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %7) #6
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %7) #6
  br label %115

114:                                              ; preds = %69, %85, %112, %73, %71, %100, %98, %54
  %.pn93.pn.pn = phi { ptr, i32 } [ %.pn85, %54 ], [ %86, %85 ], [ %113, %112 ], [ %70, %69 ], [ %74, %73 ], [ %72, %71 ], [ %101, %100 ], [ %99, %98 ]
  call void @_ZNSt6vectorISt4pairIiiESaIS1_EED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %7) #6
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %7) #6
  br label %116

115:                                              ; preds = %.thread99, %42, %._crit_edge134
  %.3 = phi i32 [ %.367.lcssa, %._crit_edge134 ], [ 2, %42 ], [ 1, %.thread99 ]
  call void @_ZNSt6vectorISt4pairIiiESaIS1_EED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %3) #6
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %3) #6
  ret i32 %.3

116:                                              ; preds = %17, %40, %114, %15
  %.pn93.pn.pn.pn = phi { ptr, i32 } [ %.pn93.pn.pn, %114 ], [ %16, %15 ], [ %.pn.pn, %40 ], [ %18, %17 ]
  call void @_ZNSt6vectorISt4pairIiiESaIS1_EED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %3) #6
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %3) #6
  resume { ptr, i32 } %.pn93.pn.pn.pn
}

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

declare noundef i32 @_ZNK9elabtsaot11Powersystem12getBus_intIdEj(ptr noundef nonnull align 8 dereferenceable(480), i32 noundef) local_unnamed_addr #1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt4pairIiiEC2IRiS2_TnNSt9enable_ifIXaaclsr5_PCCPE22_MoveConstructiblePairIT_T0_EEclsr5_PCCPE30_ImplicitlyMoveConvertiblePairIS4_S5_EEEbE4typeELb1EEEOS4_OS5_(ptr noundef nonnull align 4 dereferenceable(8), ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4)) unnamed_addr #5 align 2

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

declare void @_ZN9elabtsaot5graph14planarizeGraphEiSt6vectorISt4pairIiiESaIS3_EE(ptr dead_on_unwind writable sret(%"class.std::vector.75") align 8, i32 noundef, ptr noundef) local_unnamed_addr #1

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

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

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

; Function Attrs: mustprogress uwtable
declare dso_local noundef i32 @_ZN9elabtsaot17PwsSchematicModel13addBusElementENS_3BusEiibbPi(ptr noundef nonnull align 8 dereferenceable(112), ptr noundef, i32 noundef, i32 noundef, i1 noundef zeroext, i1 noundef zeroext, ptr noundef) local_unnamed_addr #4 align 2

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

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { 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 #5 = { 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 #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, !7, i64 8}
!6 = !{!"_ZTSN9elabtsaot6BranchE", !7, i64 0, !10, i64 4, !7, i64 8, !7, i64 12, !11, i64 16, !11, i64 24, !11, i64 32, !11, i64 40, !11, i64 48, !11, i64 56, !11, i64 64, !11, i64 72}
!7 = !{!"int", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!"bool", !8, i64 0}
!11 = !{!"double", !8, i64 0}
!12 = !{!7, !7, i64 0}
!13 = !{!6, !7, i64 12}
!14 = distinct !{!14, !15}
!15 = !{!"llvm.loop.mustprogress"}
!16 = !{!17, !7, i64 0}
!17 = !{!"_ZTSSt4pairIiiE", !7, i64 0, !7, i64 4}
!18 = !{!17, !7, i64 4}
!19 = distinct !{!19, !15}
!20 = !{!21, !21, i64 0}
!21 = !{!"vtable pointer", !9, i64 0}
!22 = distinct !{!22, !15}
!23 = distinct !{!23, !15}
!24 = distinct !{!24, !15}


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