; LLVM IR from thekyria/elabtsaot2 :: ss_analysis (ssutils)

; 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::Branch" = type { i32, i8, i32, i32, double, double, double, double, double, double, double, double }

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

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

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

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

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN9elabtsaot7ssutils7buildCdERKNS_11PowersystemERN5boost7numeric5ublas6matrixIiNS6_18basic_column_majorImlEENS6_15unbounded_arrayIiSaIiEEEEE(ptr noundef nonnull align 8 dereferenceable(480) %0, ptr noundef nonnull align 8 dereferenceable(40) %1) #2 {
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  %5 = alloca i64, align 8
  %6 = alloca i64, align 8
  %7 = alloca i64, align 8
  %8 = alloca ptr, align 8
  %9 = alloca i64, align 8
  %10 = alloca i64, align 8
  store ptr %0, ptr %3, align 8, !tbaa !5
  store ptr %1, ptr %4, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #3
  %11 = load ptr, ptr %3, align 8, !tbaa !5
  %12 = call noundef i64 @_ZNK9elabtsaot11Powersystem11getBusCountEv(ptr noundef nonnull align 8 dereferenceable(480) %11)
  store i64 %12, ptr %5, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #3
  %13 = load ptr, ptr %3, align 8, !tbaa !5
  %14 = call noundef i64 @_ZNK9elabtsaot11Powersystem14getBranchCountEv(ptr noundef nonnull align 8 dereferenceable(480) %13)
  store i64 %14, ptr %6, align 8, !tbaa !9
  %15 = load ptr, ptr %4, align 8, !tbaa !5
  %16 = load i64, ptr %6, align 8, !tbaa !9
  %17 = load i64, ptr %5, align 8, !tbaa !9
  call void @_ZN5boost7numeric5ublas6matrixIiNS1_18basic_column_majorImlEENS1_15unbounded_arrayIiSaIiEEEE6resizeEmmb(ptr noundef nonnull align 8 dereferenceable(40) %15, i64 noundef %16, i64 noundef %17, i1 noundef zeroext true)
  %18 = load ptr, ptr %4, align 8, !tbaa !5
  call void @_ZN5boost7numeric5ublas6matrixIiNS1_18basic_column_majorImlEENS1_15unbounded_arrayIiSaIiEEEE5clearEv(ptr noundef nonnull align 8 dereferenceable(40) %18)
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #3
  store i64 0, ptr %7, align 8, !tbaa !9
  br label %19

19:                                               ; preds = %48, %2
  %20 = load i64, ptr %7, align 8, !tbaa !9
  %21 = load i64, ptr %6, align 8, !tbaa !9
  %22 = icmp ne i64 %20, %21
  br i1 %22, label %24, label %23

23:                                               ; preds = %19
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #3
  br label %51

24:                                               ; preds = %19
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #3
  %25 = load ptr, ptr %3, align 8, !tbaa !5
  %26 = load i64, ptr %7, align 8, !tbaa !9
  %27 = call noundef ptr @_ZNK9elabtsaot11Powersystem9getBranchEm(ptr noundef nonnull align 8 dereferenceable(480) %25, i64 noundef %26)
  store ptr %27, ptr %8, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #3
  %28 = load ptr, ptr %3, align 8, !tbaa !5
  %29 = load ptr, ptr %8, align 8, !tbaa !5
  %30 = getelementptr inbounds %"class.elabtsaot::Branch", ptr %29, i32 0, i32 2
  %31 = load i32, ptr %30, align 8, !tbaa !11
  %32 = call noundef i32 @_ZNK9elabtsaot11Powersystem12getBus_intIdEj(ptr noundef nonnull align 8 dereferenceable(480) %28, i32 noundef %31)
  %33 = sext i32 %32 to i64
  store i64 %33, ptr %9, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #3
  %34 = load ptr, ptr %3, align 8, !tbaa !5
  %35 = load ptr, ptr %8, align 8, !tbaa !5
  %36 = getelementptr inbounds %"class.elabtsaot::Branch", ptr %35, i32 0, i32 3
  %37 = load i32, ptr %36, align 4, !tbaa !16
  %38 = call noundef i32 @_ZNK9elabtsaot11Powersystem12getBus_intIdEj(ptr noundef nonnull align 8 dereferenceable(480) %34, i32 noundef %37)
  %39 = sext i32 %38 to i64
  store i64 %39, ptr %10, align 8, !tbaa !9
  %40 = load ptr, ptr %4, align 8, !tbaa !5
  %41 = load i64, ptr %7, align 8, !tbaa !9
  %42 = load i64, ptr %9, align 8, !tbaa !9
  %43 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZN5boost7numeric5ublas6matrixIiNS1_18basic_column_majorImlEENS1_15unbounded_arrayIiSaIiEEEEclEmm(ptr noundef nonnull align 8 dereferenceable(40) %40, i64 noundef %41, i64 noundef %42)
  store i32 1, ptr %43, align 4, !tbaa !17
  %44 = load ptr, ptr %4, align 8, !tbaa !5
  %45 = load i64, ptr %7, align 8, !tbaa !9
  %46 = load i64, ptr %10, align 8, !tbaa !9
  %47 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZN5boost7numeric5ublas6matrixIiNS1_18basic_column_majorImlEENS1_15unbounded_arrayIiSaIiEEEEclEmm(ptr noundef nonnull align 8 dereferenceable(40) %44, i64 noundef %45, i64 noundef %46)
  store i32 -1, ptr %47, align 4, !tbaa !17
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #3
  br label %48

48:                                               ; preds = %24
  %49 = load i64, ptr %7, align 8, !tbaa !9
  %50 = add i64 %49, 1
  store i64 %50, ptr %7, align 8, !tbaa !9
  br label %19, !llvm.loop !18

51:                                               ; preds = %23
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #3
  ret void
}

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN5boost7numeric5ublas6matrixIiNS1_18basic_column_majorImlEENS1_15unbounded_arrayIiSaIiEEEE6resizeEmmb(ptr noundef nonnull align 8 dereferenceable(40), i64 noundef, i64 noundef, i1 noundef zeroext) #2 align 2

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

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

!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 = !{!12, !13, i64 12}
!17 = !{!13, !13, i64 0}
!18 = distinct !{!18, !19}
!19 = !{!"llvm.loop.mustprogress"}


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

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

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

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

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

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN9elabtsaot7ssutils7buildCdERKNS_11PowersystemERN5boost7numeric5ublas6matrixIiNS6_18basic_column_majorImlEENS6_15unbounded_arrayIiSaIiEEEEE(ptr noundef nonnull align 8 dereferenceable(480) %0, ptr noundef nonnull align 8 dereferenceable(40) %1) local_unnamed_addr #1 {
  %3 = tail call noundef i64 @_ZNK9elabtsaot11Powersystem11getBusCountEv(ptr noundef nonnull align 8 dereferenceable(480) %0)
  %4 = tail call noundef i64 @_ZNK9elabtsaot11Powersystem14getBranchCountEv(ptr noundef nonnull align 8 dereferenceable(480) %0)
  tail call void @_ZN5boost7numeric5ublas6matrixIiNS1_18basic_column_majorImlEENS1_15unbounded_arrayIiSaIiEEEE6resizeEmmb(ptr noundef nonnull align 8 dereferenceable(40) %1, i64 noundef %4, i64 noundef %3, i1 noundef zeroext true)
  tail call void @_ZN5boost7numeric5ublas6matrixIiNS1_18basic_column_majorImlEENS1_15unbounded_arrayIiSaIiEEEE5clearEv(ptr noundef nonnull align 8 dereferenceable(40) %1)
  %.not20 = icmp eq i64 %4, 0
  br i1 %.not20, label %._crit_edge, label %.lr.ph

._crit_edge:                                      ; preds = %.lr.ph, %2
  ret void

.lr.ph:                                           ; preds = %2, %.lr.ph
  %.021 = phi i64 [ %16, %.lr.ph ], [ 0, %2 ]
  %5 = tail call noundef ptr @_ZNK9elabtsaot11Powersystem9getBranchEm(ptr noundef nonnull align 8 dereferenceable(480) %0, i64 noundef %.021)
  %6 = getelementptr inbounds i8, ptr %5, i64 8
  %7 = load i32, ptr %6, align 8, !tbaa !5
  %8 = tail call noundef i32 @_ZNK9elabtsaot11Powersystem12getBus_intIdEj(ptr noundef nonnull align 8 dereferenceable(480) %0, i32 noundef %7)
  %9 = sext i32 %8 to i64
  %10 = getelementptr inbounds i8, ptr %5, i64 12
  %11 = load i32, ptr %10, align 4, !tbaa !12
  %12 = tail call noundef i32 @_ZNK9elabtsaot11Powersystem12getBus_intIdEj(ptr noundef nonnull align 8 dereferenceable(480) %0, i32 noundef %11)
  %13 = sext i32 %12 to i64
  %14 = tail call noundef nonnull align 4 dereferenceable(4) ptr @_ZN5boost7numeric5ublas6matrixIiNS1_18basic_column_majorImlEENS1_15unbounded_arrayIiSaIiEEEEclEmm(ptr noundef nonnull align 8 dereferenceable(40) %1, i64 noundef %.021, i64 noundef %9)
  store i32 1, ptr %14, align 4, !tbaa !13
  %15 = tail call noundef nonnull align 4 dereferenceable(4) ptr @_ZN5boost7numeric5ublas6matrixIiNS1_18basic_column_majorImlEENS1_15unbounded_arrayIiSaIiEEEEclEmm(ptr noundef nonnull align 8 dereferenceable(40) %1, i64 noundef %.021, i64 noundef %13)
  store i32 -1, ptr %15, align 4, !tbaa !13
  %16 = add nuw i64 %.021, 1
  %.not = icmp eq i64 %16, %4
  br i1 %.not, label %._crit_edge, label %.lr.ph, !llvm.loop !14
}

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN5boost7numeric5ublas6matrixIiNS1_18basic_column_majorImlEENS1_15unbounded_arrayIiSaIiEEEE6resizeEmmb(ptr noundef nonnull align 8 dereferenceable(40), i64 noundef, i64 noundef, i1 noundef zeroext) local_unnamed_addr #1 align 2

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

; Function Attrs: mustprogress uwtable
declare dso_local noundef nonnull align 4 dereferenceable(4) ptr @_ZN5boost7numeric5ublas6matrixIiNS1_18basic_column_majorImlEENS1_15unbounded_arrayIiSaIiEEEEclEmm(ptr noundef nonnull align 8 dereferenceable(40), i64 noundef, i64 noundef) local_unnamed_addr #1 align 2

attributes #0 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }

!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 = !{!6, !7, i64 12}
!13 = !{!7, !7, i64 0}
!14 = distinct !{!14, !15}
!15 = !{!"llvm.loop.mustprogress"}


; Effective O3 passes: GlobalOptPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,SROAPass,SimplifyCFGPass,TailCallElimPass