; LLVM IR from gem5/gem5 :: ext/mcpat/cacti/router.ll (ZN6Router17tr_crossbar_powerEv)

; 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.Router = type { %class.Component, %class.Component, %class.Component, %class.Component, double, double, double, double, double, ptr, double, i32, i32, double, double, double, double, double, double, double, double, double, double, double, double, double, double, double, double, double }
%class.Component = type { %class.Area, %class.powerDef, %class.powerDef, double, double }
%class.Area = type { double, double, double }
%class.powerDef = type { %class.powerComponents, %class.powerComponents, %class.powerComponents }
%class.powerComponents = type { double, double, double, double, double }

; Function Attrs: mustprogress uwtable
declare dso_local noundef double @_ZN6Router16crossbar_inplineEv(ptr noundef nonnull align 8 dereferenceable(1320)) #0 align 2

; Function Attrs: mustprogress uwtable
declare dso_local noundef double @_ZN6Router16crossbar_outlineEv(ptr noundef nonnull align 8 dereferenceable(1320)) #0 align 2

; Function Attrs: mustprogress uwtable
define dso_local noundef double @_ZN6Router17tr_crossbar_powerEv(ptr noundef nonnull align 8 dereferenceable(1320) %0) #0 align 2 {
  %2 = alloca ptr, align 8
  store ptr %0, ptr %2, align 8, !tbaa !5
  %3 = load ptr, ptr %2, align 8
  %4 = call noundef double @_ZN6Router16crossbar_inplineEv(ptr noundef nonnull align 8 dereferenceable(1320) %3)
  %5 = getelementptr inbounds %class.Router, ptr %3, i32 0, i32 28
  %6 = load double, ptr %5, align 8, !tbaa !9
  %7 = fmul double %4, %6
  %8 = getelementptr inbounds %class.Router, ptr %3, i32 0, i32 28
  %9 = load double, ptr %8, align 8, !tbaa !9
  %10 = fmul double %7, %9
  %11 = getelementptr inbounds %class.Router, ptr %3, i32 0, i32 6
  %12 = load double, ptr %11, align 8, !tbaa !18
  %13 = fmul double %10, %12
  %14 = fdiv double %13, 2.000000e+00
  %15 = call noundef double @_ZN6Router16crossbar_outlineEv(ptr noundef nonnull align 8 dereferenceable(1320) %3)
  %16 = getelementptr inbounds %class.Router, ptr %3, i32 0, i32 28
  %17 = load double, ptr %16, align 8, !tbaa !9
  %18 = fmul double %15, %17
  %19 = getelementptr inbounds %class.Router, ptr %3, i32 0, i32 28
  %20 = load double, ptr %19, align 8, !tbaa !9
  %21 = fmul double %18, %20
  %22 = getelementptr inbounds %class.Router, ptr %3, i32 0, i32 6
  %23 = load double, ptr %22, align 8, !tbaa !18
  %24 = fmul double %21, %23
  %25 = fdiv double %24, 2.000000e+00
  %26 = fadd double %14, %25
  %27 = fmul double %26, 2.000000e+00
  ret double %27
}

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

!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, !13, i64 1304}
!10 = !{!"_ZTS6Router", !11, i64 0, !11, i64 280, !11, i64 560, !11, i64 840, !13, i64 1120, !13, i64 1128, !13, i64 1136, !13, i64 1144, !13, i64 1152, !6, i64 1160, !13, i64 1168, !16, i64 1176, !17, i64 1180, !13, i64 1184, !13, i64 1192, !13, i64 1200, !13, i64 1208, !13, i64 1216, !13, i64 1224, !13, i64 1232, !13, i64 1240, !13, i64 1248, !13, i64 1256, !13, i64 1264, !13, i64 1272, !13, i64 1280, !13, i64 1288, !13, i64 1296, !13, i64 1304, !13, i64 1312}
!11 = !{!"_ZTS9Component", !12, i64 0, !14, i64 24, !14, i64 144, !13, i64 264, !13, i64 272}
!12 = !{!"_ZTS4Area", !13, i64 0, !13, i64 8, !13, i64 16}
!13 = !{!"double", !7, i64 0}
!14 = !{!"_ZTS8powerDef", !15, i64 0, !15, i64 40, !15, i64 80}
!15 = !{!"_ZTS15powerComponents", !13, i64 0, !13, i64 8, !13, i64 16, !13, i64 24, !13, i64 32}
!16 = !{!"_ZTS9Wire_type", !7, i64 0}
!17 = !{!"_ZTS14Wire_placement", !7, i64 0}
!18 = !{!10, !13, i64 1136}


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

; Function Attrs: mustprogress uwtable
declare dso_local noundef double @_ZN6Router16crossbar_inplineEv(ptr noundef nonnull align 8 dereferenceable(1320)) local_unnamed_addr #0 align 2

; Function Attrs: mustprogress uwtable
declare dso_local noundef double @_ZN6Router16crossbar_outlineEv(ptr noundef nonnull align 8 dereferenceable(1320)) local_unnamed_addr #0 align 2

; Function Attrs: mustprogress uwtable
define dso_local noundef double @_ZN6Router17tr_crossbar_powerEv(ptr noundef nonnull align 8 dereferenceable(1320) %0) local_unnamed_addr #0 align 2 {
  %2 = tail call noundef double @_ZN6Router16crossbar_inplineEv(ptr noundef nonnull align 8 dereferenceable(1320) %0)
  %3 = getelementptr inbounds i8, ptr %0, i64 1304
  %4 = load <2 x double>, ptr %3, align 8
  %5 = getelementptr inbounds i8, ptr %0, i64 1136
  %6 = load <2 x double>, ptr %5, align 8
  %7 = tail call noundef double @_ZN6Router16crossbar_outlineEv(ptr noundef nonnull align 8 dereferenceable(1320) %0)
  %8 = load double, ptr %3, align 8, !tbaa !5
  %9 = load double, ptr %5, align 8, !tbaa !17
  %10 = insertelement <2 x double> poison, double %2, i64 0
  %11 = insertelement <2 x double> %10, double %7, i64 1
  %12 = insertelement <2 x double> %4, double %8, i64 1
  %13 = fmul <2 x double> %11, %12
  %14 = fmul <2 x double> %12, %13
  %15 = insertelement <2 x double> %6, double %9, i64 1
  %16 = fmul <2 x double> %15, %14
  %17 = fmul <2 x double> %16, <double 5.000000e-01, double 5.000000e-01>
  %shift = shufflevector <2 x double> %17, <2 x double> poison, <2 x i32> <i32 1, i32 poison>
  %18 = fadd <2 x double> %17, %shift
  %19 = extractelement <2 x double> %18, i64 0
  %20 = fmul double %19, 2.000000e+00
  ret double %20
}

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

!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, !9, i64 1304}
!6 = !{!"_ZTS6Router", !7, i64 0, !7, i64 280, !7, i64 560, !7, i64 840, !9, i64 1120, !9, i64 1128, !9, i64 1136, !9, i64 1144, !9, i64 1152, !14, i64 1160, !9, i64 1168, !15, i64 1176, !16, i64 1180, !9, i64 1184, !9, i64 1192, !9, i64 1200, !9, i64 1208, !9, i64 1216, !9, i64 1224, !9, i64 1232, !9, i64 1240, !9, i64 1248, !9, i64 1256, !9, i64 1264, !9, i64 1272, !9, i64 1280, !9, i64 1288, !9, i64 1296, !9, i64 1304, !9, i64 1312}
!7 = !{!"_ZTS9Component", !8, i64 0, !12, i64 24, !12, i64 144, !9, i64 264, !9, i64 272}
!8 = !{!"_ZTS4Area", !9, i64 0, !9, i64 8, !9, i64 16}
!9 = !{!"double", !10, i64 0}
!10 = !{!"omnipotent char", !11, i64 0}
!11 = !{!"Simple C++ TBAA"}
!12 = !{!"_ZTS8powerDef", !13, i64 0, !13, i64 40, !13, i64 80}
!13 = !{!"_ZTS15powerComponents", !9, i64 0, !9, i64 8, !9, i64 16, !9, i64 24, !9, i64 32}
!14 = !{!"any pointer", !10, i64 0}
!15 = !{!"_ZTS9Wire_type", !10, i64 0}
!16 = !{!"_ZTS14Wire_placement", !10, i64 0}
!17 = !{!6, !9, i64 1136}


; Effective O3 passes: EarlyCSEPass,GlobalOptPass,InstCombinePass,ReassociatePass,SLPVectorizerPass,SROAPass,TailCallElimPass,VectorCombinePass