; LLVM IR from thekyria/elabtsaot2 :: ss_analysis/ssengine.ll (ZNK9elabtsaot8SSEngine14solvePowerFlowERNS_11PowersystemE)

; 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.boost::numeric::ublas::vector" = type { %"class.boost::numeric::ublas::unbounded_array" }
%"class.boost::numeric::ublas::unbounded_array" = type { [8 x i8], i64, ptr }
%"class.boost::numeric::ublas::matrix" = type { i64, i64, %"class.boost::numeric::ublas::unbounded_array" }

declare i32 @__gxx_personality_v0(...)

; Function Attrs: mustprogress uwtable
define dso_local noundef i32 @_ZNK9elabtsaot8SSEngine14solvePowerFlowERNS_11PowersystemE(ptr noundef nonnull align 8 dereferenceable(96) %0, ptr noundef nonnull align 8 dereferenceable(480) %1) #0 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.boost::numeric::ublas::vector", align 8
  %7 = alloca i32, align 4
  %8 = alloca ptr, align 8
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  %11 = alloca %"class.boost::numeric::ublas::matrix", align 8
  store ptr %0, ptr %4, align 8, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !5
  %12 = load ptr, ptr %4, align 8
  call void @llvm.lifetime.start.p0(i64 24, ptr %6) #4
  call void @_ZN5boost7numeric5ublas6vectorISt7complexIdENS1_15unbounded_arrayIS4_SaIS4_EEEEC2Ev(ptr noundef nonnull align 8 dereferenceable(24) %6)
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #4
  %13 = load ptr, ptr %5, align 8, !tbaa !5
  %14 = load ptr, ptr %12, align 8, !tbaa !9
  %15 = getelementptr inbounds ptr, ptr %14, i64 4
  %16 = load ptr, ptr %15, align 8
  %17 = invoke noundef i32 %16(ptr noundef nonnull align 8 dereferenceable(96) %12, ptr noundef nonnull align 8 dereferenceable(480) %13, ptr noundef nonnull align 8 dereferenceable(24) %6)
          to label %18 unwind label %23

18:                                               ; preds = %2
  store i32 %17, ptr %7, align 4, !tbaa !11
  %19 = load i32, ptr %7, align 4, !tbaa !11
  %20 = icmp ne i32 %19, 0
  br i1 %20, label %21, label %27

21:                                               ; preds = %18
  %22 = load i32, ptr %7, align 4, !tbaa !11
  store i32 %22, ptr %3, align 4
  store i32 1, ptr %10, align 4
  br label %42

23:                                               ; preds = %2
  %24 = landingpad { ptr, i32 }
          cleanup
  %25 = extractvalue { ptr, i32 } %24, 0
  store ptr %25, ptr %8, align 8
  %26 = extractvalue { ptr, i32 } %24, 1
  store i32 %26, ptr %9, align 4
  br label %44

27:                                               ; preds = %18
  call void @llvm.lifetime.start.p0(i64 40, ptr %11) #4
  invoke void @_ZN5boost7numeric5ublas6matrixISt7complexIdENS1_18basic_column_majorImlEENS1_15unbounded_arrayIS4_SaIS4_EEEEC2Ev(ptr noundef nonnull align 8 dereferenceable(40) %11)
          to label %28 unwind label %33

28:                                               ; preds = %27
  %29 = load ptr, ptr %5, align 8, !tbaa !5
  invoke void @_ZN9elabtsaot7ssutils6buildYERKNS_11PowersystemERN5boost7numeric5ublas6matrixISt7complexIdENS6_18basic_column_majorImlEENS6_15unbounded_arrayIS9_SaIS9_EEEEE(ptr noundef nonnull align 8 dereferenceable(480) %29, ptr noundef nonnull align 8 dereferenceable(40) %11)
          to label %30 unwind label %37

30:                                               ; preds = %28
  %31 = load ptr, ptr %5, align 8, !tbaa !5
  invoke void @_ZN9elabtsaot7ssutils17updatePowersystemERNS_11PowersystemERKN5boost7numeric5ublas6matrixISt7complexIdENS5_18basic_column_majorImlEENS5_15unbounded_arrayIS8_SaIS8_EEEEERKNS5_6vectorIS8_SD_EE(ptr noundef nonnull align 8 dereferenceable(480) %31, ptr noundef nonnull align 8 dereferenceable(40) %11, ptr noundef nonnull align 8 dereferenceable(24) %6)
          to label %32 unwind label %37

32:                                               ; preds = %30
  store i32 0, ptr %3, align 4
  store i32 1, ptr %10, align 4
  call void @_ZN5boost7numeric5ublas6matrixISt7complexIdENS1_18basic_column_majorImlEENS1_15unbounded_arrayIS4_SaIS4_EEEED2Ev(ptr noundef nonnull align 8 dereferenceable(40) %11) #4
  call void @llvm.lifetime.end.p0(i64 40, ptr %11) #4
  br label %42

33:                                               ; preds = %27
  %34 = landingpad { ptr, i32 }
          cleanup
  %35 = extractvalue { ptr, i32 } %34, 0
  store ptr %35, ptr %8, align 8
  %36 = extractvalue { ptr, i32 } %34, 1
  store i32 %36, ptr %9, align 4
  br label %41

37:                                               ; preds = %30, %28
  %38 = landingpad { ptr, i32 }
          cleanup
  %39 = extractvalue { ptr, i32 } %38, 0
  store ptr %39, ptr %8, align 8
  %40 = extractvalue { ptr, i32 } %38, 1
  store i32 %40, ptr %9, align 4
  call void @_ZN5boost7numeric5ublas6matrixISt7complexIdENS1_18basic_column_majorImlEENS1_15unbounded_arrayIS4_SaIS4_EEEED2Ev(ptr noundef nonnull align 8 dereferenceable(40) %11) #4
  br label %41

41:                                               ; preds = %37, %33
  call void @llvm.lifetime.end.p0(i64 40, ptr %11) #4
  br label %44

42:                                               ; preds = %32, %21
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #4
  call void @_ZN5boost7numeric5ublas6vectorISt7complexIdENS1_15unbounded_arrayIS4_SaIS4_EEEED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %6) #4
  call void @llvm.lifetime.end.p0(i64 24, ptr %6) #4
  %43 = load i32, ptr %3, align 4
  ret i32 %43

44:                                               ; preds = %41, %23
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #4
  call void @_ZN5boost7numeric5ublas6vectorISt7complexIdENS1_15unbounded_arrayIS4_SaIS4_EEEED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %6) #4
  call void @llvm.lifetime.end.p0(i64 24, ptr %6) #4
  br label %45

45:                                               ; preds = %44
  %46 = load ptr, ptr %8, align 8
  %47 = load i32, ptr %9, align 4
  %48 = insertvalue { ptr, i32 } poison, ptr %46, 0
  %49 = insertvalue { ptr, i32 } %48, i32 %47, 1
  resume { ptr, i32 } %49
}

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

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

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

declare void @_ZN9elabtsaot7ssutils6buildYERKNS_11PowersystemERN5boost7numeric5ublas6matrixISt7complexIdENS6_18basic_column_majorImlEENS6_15unbounded_arrayIS9_SaIS9_EEEEE(ptr noundef nonnull align 8 dereferenceable(480), ptr noundef nonnull align 8 dereferenceable(40)) #2

declare void @_ZN9elabtsaot7ssutils17updatePowersystemERNS_11PowersystemERKN5boost7numeric5ublas6matrixISt7complexIdENS5_18basic_column_majorImlEENS5_15unbounded_arrayIS8_SaIS8_EEEEERKNS5_6vectorIS8_SD_EE(ptr noundef nonnull align 8 dereferenceable(480), ptr noundef nonnull align 8 dereferenceable(40), ptr noundef nonnull align 8 dereferenceable(24)) #2

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZN5boost7numeric5ublas6vectorISt7complexIdENS1_15unbounded_arrayIS4_SaIS4_EEEED2Ev(ptr noundef nonnull align 8 dereferenceable(24)) unnamed_addr #3 align 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 nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nounwind }

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

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"vtable pointer", !8, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"int", !7, i64 0}


; 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.boost::numeric::ublas::vector" = type { %"class.boost::numeric::ublas::unbounded_array" }
%"class.boost::numeric::ublas::unbounded_array" = type { [8 x i8], i64, ptr }
%"class.boost::numeric::ublas::matrix" = type { i64, i64, %"class.boost::numeric::ublas::unbounded_array" }

declare i32 @__gxx_personality_v0(...)

; Function Attrs: mustprogress uwtable
define dso_local noundef i32 @_ZNK9elabtsaot8SSEngine14solvePowerFlowERNS_11PowersystemE(ptr noundef nonnull align 8 dereferenceable(96) %0, ptr noundef nonnull align 8 dereferenceable(480) %1) local_unnamed_addr #0 align 2 personality ptr @__gxx_personality_v0 {
  %3 = alloca %"class.boost::numeric::ublas::vector", align 8
  %4 = alloca %"class.boost::numeric::ublas::matrix", align 8
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %3) #4
  call void @_ZN5boost7numeric5ublas6vectorISt7complexIdENS1_15unbounded_arrayIS4_SaIS4_EEEEC2Ev(ptr noundef nonnull align 8 dereferenceable(24) %3)
  %5 = load ptr, ptr %0, align 8, !tbaa !5
  %6 = getelementptr inbounds i8, ptr %5, i64 32
  %7 = load ptr, ptr %6, align 8
  %8 = invoke noundef i32 %7(ptr noundef nonnull align 8 dereferenceable(96) %0, ptr noundef nonnull align 8 dereferenceable(480) %1, ptr noundef nonnull align 8 dereferenceable(24) %3)
          to label %9 unwind label %10

9:                                                ; preds = %2
  %.not = icmp eq i32 %8, 0
  br i1 %.not, label %12, label %21

10:                                               ; preds = %2
  %11 = landingpad { ptr, i32 }
          cleanup
  br label %22

12:                                               ; preds = %9
  call void @llvm.lifetime.start.p0(i64 40, ptr nonnull %4) #4
  invoke void @_ZN5boost7numeric5ublas6matrixISt7complexIdENS1_18basic_column_majorImlEENS1_15unbounded_arrayIS4_SaIS4_EEEEC2Ev(ptr noundef nonnull align 8 dereferenceable(40) %4)
          to label %13 unwind label %16

13:                                               ; preds = %12
  invoke void @_ZN9elabtsaot7ssutils6buildYERKNS_11PowersystemERN5boost7numeric5ublas6matrixISt7complexIdENS6_18basic_column_majorImlEENS6_15unbounded_arrayIS9_SaIS9_EEEEE(ptr noundef nonnull align 8 dereferenceable(480) %1, ptr noundef nonnull align 8 dereferenceable(40) %4)
          to label %14 unwind label %18

14:                                               ; preds = %13
  invoke void @_ZN9elabtsaot7ssutils17updatePowersystemERNS_11PowersystemERKN5boost7numeric5ublas6matrixISt7complexIdENS5_18basic_column_majorImlEENS5_15unbounded_arrayIS8_SaIS8_EEEEERKNS5_6vectorIS8_SD_EE(ptr noundef nonnull align 8 dereferenceable(480) %1, ptr noundef nonnull align 8 dereferenceable(40) %4, ptr noundef nonnull align 8 dereferenceable(24) %3)
          to label %15 unwind label %18

15:                                               ; preds = %14
  call void @_ZN5boost7numeric5ublas6matrixISt7complexIdENS1_18basic_column_majorImlEENS1_15unbounded_arrayIS4_SaIS4_EEEED2Ev(ptr noundef nonnull align 8 dereferenceable(40) %4) #4
  call void @llvm.lifetime.end.p0(i64 40, ptr nonnull %4) #4
  br label %21

16:                                               ; preds = %12
  %17 = landingpad { ptr, i32 }
          cleanup
  br label %20

18:                                               ; preds = %14, %13
  %19 = landingpad { ptr, i32 }
          cleanup
  call void @_ZN5boost7numeric5ublas6matrixISt7complexIdENS1_18basic_column_majorImlEENS1_15unbounded_arrayIS4_SaIS4_EEEED2Ev(ptr noundef nonnull align 8 dereferenceable(40) %4) #4
  br label %20

20:                                               ; preds = %18, %16
  %.pn = phi { ptr, i32 } [ %19, %18 ], [ %17, %16 ]
  call void @llvm.lifetime.end.p0(i64 40, ptr nonnull %4) #4
  br label %22

21:                                               ; preds = %9, %15
  call void @_ZN5boost7numeric5ublas6vectorISt7complexIdENS1_15unbounded_arrayIS4_SaIS4_EEEED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %3) #4
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %3) #4
  ret i32 %8

22:                                               ; preds = %20, %10
  %.pn.pn = phi { ptr, i32 } [ %.pn, %20 ], [ %11, %10 ]
  call void @_ZN5boost7numeric5ublas6vectorISt7complexIdENS1_15unbounded_arrayIS4_SaIS4_EEEED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %3) #4
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %3) #4
  resume { ptr, i32 } %.pn.pn
}

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

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

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

declare void @_ZN9elabtsaot7ssutils6buildYERKNS_11PowersystemERN5boost7numeric5ublas6matrixISt7complexIdENS6_18basic_column_majorImlEENS6_15unbounded_arrayIS9_SaIS9_EEEEE(ptr noundef nonnull align 8 dereferenceable(480), ptr noundef nonnull align 8 dereferenceable(40)) local_unnamed_addr #2

declare void @_ZN9elabtsaot7ssutils17updatePowersystemERNS_11PowersystemERKN5boost7numeric5ublas6matrixISt7complexIdENS5_18basic_column_majorImlEENS5_15unbounded_arrayIS8_SaIS8_EEEEERKNS5_6vectorIS8_SD_EE(ptr noundef nonnull align 8 dereferenceable(480), ptr noundef nonnull align 8 dereferenceable(40), ptr noundef nonnull align 8 dereferenceable(24)) local_unnamed_addr #2

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZN5boost7numeric5ublas6vectorISt7complexIdENS1_15unbounded_arrayIS4_SaIS4_EEEED2Ev(ptr noundef nonnull align 8 dereferenceable(24)) unnamed_addr #3 align 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 = { mustprogress 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 nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nounwind }

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

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"vtable pointer", !7, i64 0}
!7 = !{!"Simple C++ TBAA"}


; Effective O3 passes: CorrelatedValuePropagationPass,GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,SROAPass,SimplifyCFGPass