; LLVM IR from gem5/gem5 :: ext/mcpat/cacti/component.ll (ZN9Component22height_sense_amplifierEd)

; 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.TechnologyParameter = type { double, double, double, double, double, double, double, double, double, double, double, double, double, double, double, double, double, double, double, double, double, double, double, double, double, double, double, double, double, double, double, double, double, double, double, double, double, double, double, double, double, double, double, double, i64, %"class.TechnologyParameter::DeviceType", %"class.TechnologyParameter::DeviceType", %"class.TechnologyParameter::DeviceType", %"class.TechnologyParameter::DeviceType", %"class.TechnologyParameter::DeviceType", %"class.TechnologyParameter::InterconnectType", %"class.TechnologyParameter::InterconnectType", %"class.TechnologyParameter::InterconnectType", %"class.TechnologyParameter::ScalingFactor", %"class.TechnologyParameter::MemoryType", %"class.TechnologyParameter::MemoryType", %"class.TechnologyParameter::MemoryType" }
%"class.TechnologyParameter::DeviceType" = type { double, double, double, double, double, double, double, double, double, double, double, double, double, double, double, double, double, double, double, double, double }
%"class.TechnologyParameter::InterconnectType" = type { double, double, double, double, double, double, double, double }
%"class.TechnologyParameter::ScalingFactor" = type { double, double, double }
%"class.TechnologyParameter::MemoryType" = type { double, double, double, double, double, double }

@g_tp = external global %class.TechnologyParameter, align 8

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

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare double @llvm.fmuladd.f64(double, double, double) #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 nounwind uwtable
declare dso_local noundef double @_ZN9Component30compute_tr_width_after_foldingEdd(ptr noundef nonnull align 8 dereferenceable(280), double noundef, double noundef) #2 align 2

; Function Attrs: mustprogress nounwind uwtable
define dso_local noundef double @_ZN9Component22height_sense_amplifierEd(ptr noundef nonnull align 8 dereferenceable(280) %0, double noundef %1) #2 align 2 {
  %3 = alloca ptr, align 8
  %4 = alloca double, align 8
  %5 = alloca double, align 8
  %6 = alloca double, align 8
  store ptr %0, ptr %3, align 8, !tbaa !5
  store double %1, ptr %4, align 8, !tbaa !9
  %7 = load ptr, ptr %3, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #3
  %8 = load double, ptr getelementptr inbounds (%class.TechnologyParameter, ptr @g_tp, i32 0, i32 10), align 8, !tbaa !11
  %9 = load double, ptr %4, align 8, !tbaa !9
  %10 = call noundef double @_ZN9Component30compute_tr_width_after_foldingEdd(ptr noundef nonnull align 8 dereferenceable(280) %7, double noundef %8, double noundef %9)
  %11 = load double, ptr getelementptr inbounds (%class.TechnologyParameter, ptr @g_tp, i32 0, i32 13), align 8, !tbaa !18
  %12 = load double, ptr %4, align 8, !tbaa !9
  %13 = call noundef double @_ZN9Component30compute_tr_width_after_foldingEdd(ptr noundef nonnull align 8 dereferenceable(280) %7, double noundef %11, double noundef %12)
  %14 = call double @llvm.fmuladd.f64(double %10, double 2.000000e+00, double %13)
  %15 = load double, ptr getelementptr inbounds (%class.TechnologyParameter, ptr @g_tp, i32 0, i32 37), align 8, !tbaa !19
  %16 = call double @llvm.fmuladd.f64(double 2.000000e+00, double %15, double %14)
  store double %16, ptr %5, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #3
  %17 = load double, ptr getelementptr inbounds (%class.TechnologyParameter, ptr @g_tp, i32 0, i32 9), align 8, !tbaa !20
  %18 = load double, ptr %4, align 8, !tbaa !9
  %19 = call noundef double @_ZN9Component30compute_tr_width_after_foldingEdd(ptr noundef nonnull align 8 dereferenceable(280) %7, double noundef %17, double noundef %18)
  %20 = load double, ptr getelementptr inbounds (%class.TechnologyParameter, ptr @g_tp, i32 0, i32 8), align 8, !tbaa !21
  %21 = load double, ptr %4, align 8, !tbaa !9
  %22 = call noundef double @_ZN9Component30compute_tr_width_after_foldingEdd(ptr noundef nonnull align 8 dereferenceable(280) %7, double noundef %20, double noundef %21)
  %23 = call double @llvm.fmuladd.f64(double %19, double 2.000000e+00, double %22)
  %24 = load double, ptr getelementptr inbounds (%class.TechnologyParameter, ptr @g_tp, i32 0, i32 37), align 8, !tbaa !19
  %25 = call double @llvm.fmuladd.f64(double 2.000000e+00, double %24, double %23)
  store double %25, ptr %6, align 8, !tbaa !9
  %26 = load double, ptr %5, align 8, !tbaa !9
  %27 = load double, ptr %6, align 8, !tbaa !9
  %28 = fadd double %26, %27
  %29 = load double, ptr getelementptr inbounds (%class.TechnologyParameter, ptr @g_tp, i32 0, i32 36), align 8, !tbaa !22
  %30 = fadd double %28, %29
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #3
  ret double %30
}

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #2 = { 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 #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 = !{!"double", !7, i64 0}
!11 = !{!12, !10, i64 80}
!12 = !{!"_ZTS19TechnologyParameter", !10, i64 0, !10, i64 8, !10, i64 16, !10, i64 24, !10, i64 32, !10, i64 40, !10, i64 48, !10, i64 56, !10, i64 64, !10, i64 72, !10, i64 80, !10, i64 88, !10, i64 96, !10, i64 104, !10, i64 112, !10, i64 120, !10, i64 128, !10, i64 136, !10, i64 144, !10, i64 152, !10, i64 160, !10, i64 168, !10, i64 176, !10, i64 184, !10, i64 192, !10, i64 200, !10, i64 208, !10, i64 216, !10, i64 224, !10, i64 232, !10, i64 240, !10, i64 248, !10, i64 256, !10, i64 264, !10, i64 272, !10, i64 280, !10, i64 288, !10, i64 296, !10, i64 304, !10, i64 312, !10, i64 320, !10, i64 328, !10, i64 336, !10, i64 344, !13, i64 352, !14, i64 360, !14, i64 528, !14, i64 696, !14, i64 864, !14, i64 1032, !15, i64 1200, !15, i64 1264, !15, i64 1328, !16, i64 1392, !17, i64 1416, !17, i64 1464, !17, i64 1512}
!13 = !{!"long", !7, i64 0}
!14 = !{!"_ZTSN19TechnologyParameter10DeviceTypeE", !10, i64 0, !10, i64 8, !10, i64 16, !10, i64 24, !10, i64 32, !10, i64 40, !10, i64 48, !10, i64 56, !10, i64 64, !10, i64 72, !10, i64 80, !10, i64 88, !10, i64 96, !10, i64 104, !10, i64 112, !10, i64 120, !10, i64 128, !10, i64 136, !10, i64 144, !10, i64 152, !10, i64 160}
!15 = !{!"_ZTSN19TechnologyParameter16InterconnectTypeE", !10, i64 0, !10, i64 8, !10, i64 16, !10, i64 24, !10, i64 32, !10, i64 40, !10, i64 48, !10, i64 56}
!16 = !{!"_ZTSN19TechnologyParameter13ScalingFactorE", !10, i64 0, !10, i64 8, !10, i64 16}
!17 = !{!"_ZTSN19TechnologyParameter10MemoryTypeE", !10, i64 0, !10, i64 8, !10, i64 16, !10, i64 24, !10, i64 32, !10, i64 40}
!18 = !{!12, !10, i64 104}
!19 = !{!12, !10, i64 296}
!20 = !{!12, !10, i64 72}
!21 = !{!12, !10, i64 64}
!22 = !{!12, !10, i64 288}


; 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.TechnologyParameter = type { double, double, double, double, double, double, double, double, double, double, double, double, double, double, double, double, double, double, double, double, double, double, double, double, double, double, double, double, double, double, double, double, double, double, double, double, double, double, double, double, double, double, double, double, i64, %"class.TechnologyParameter::DeviceType", %"class.TechnologyParameter::DeviceType", %"class.TechnologyParameter::DeviceType", %"class.TechnologyParameter::DeviceType", %"class.TechnologyParameter::DeviceType", %"class.TechnologyParameter::InterconnectType", %"class.TechnologyParameter::InterconnectType", %"class.TechnologyParameter::InterconnectType", %"class.TechnologyParameter::ScalingFactor", %"class.TechnologyParameter::MemoryType", %"class.TechnologyParameter::MemoryType", %"class.TechnologyParameter::MemoryType" }
%"class.TechnologyParameter::DeviceType" = type { double, double, double, double, double, double, double, double, double, double, double, double, double, double, double, double, double, double, double, double, double }
%"class.TechnologyParameter::InterconnectType" = type { double, double, double, double, double, double, double, double }
%"class.TechnologyParameter::ScalingFactor" = type { double, double, double }
%"class.TechnologyParameter::MemoryType" = type { double, double, double, double, double, double }

@g_tp = external local_unnamed_addr global %class.TechnologyParameter, align 8

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef double @_ZN9Component30compute_tr_width_after_foldingEdd(ptr noundef nonnull align 8 dereferenceable(280), double noundef, double noundef) local_unnamed_addr #0 align 2

; Function Attrs: mustprogress nounwind uwtable
define dso_local noundef double @_ZN9Component22height_sense_amplifierEd(ptr noundef nonnull align 8 dereferenceable(280) %0, double noundef %1) local_unnamed_addr #0 align 2 {
  %3 = load double, ptr getelementptr inbounds (i8, ptr @g_tp, i64 80), align 8, !tbaa !5
  %4 = tail call noundef double @_ZN9Component30compute_tr_width_after_foldingEdd(ptr noundef nonnull align 8 dereferenceable(280) %0, double noundef %3, double noundef %1)
  %5 = load double, ptr getelementptr inbounds (i8, ptr @g_tp, i64 104), align 8, !tbaa !15
  %6 = tail call noundef double @_ZN9Component30compute_tr_width_after_foldingEdd(ptr noundef nonnull align 8 dereferenceable(280) %0, double noundef %5, double noundef %1)
  %7 = load <2 x double>, ptr getelementptr inbounds (i8, ptr @g_tp, i64 296), align 8
  %8 = load double, ptr getelementptr inbounds (i8, ptr @g_tp, i64 72), align 8, !tbaa !16
  %9 = tail call noundef double @_ZN9Component30compute_tr_width_after_foldingEdd(ptr noundef nonnull align 8 dereferenceable(280) %0, double noundef %8, double noundef %1)
  %10 = load double, ptr getelementptr inbounds (i8, ptr @g_tp, i64 64), align 8, !tbaa !17
  %11 = tail call noundef double @_ZN9Component30compute_tr_width_after_foldingEdd(ptr noundef nonnull align 8 dereferenceable(280) %0, double noundef %10, double noundef %1)
  %12 = load double, ptr getelementptr inbounds (i8, ptr @g_tp, i64 296), align 8, !tbaa !18
  %13 = insertelement <2 x double> poison, double %4, i64 0
  %14 = insertelement <2 x double> %13, double %9, i64 1
  %15 = insertelement <2 x double> poison, double %6, i64 0
  %16 = insertelement <2 x double> %15, double %11, i64 1
  %17 = tail call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %14, <2 x double> <double 2.000000e+00, double 2.000000e+00>, <2 x double> %16)
  %18 = insertelement <2 x double> %7, double %12, i64 1
  %19 = tail call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %18, <2 x double> <double 2.000000e+00, double 2.000000e+00>, <2 x double> %17)
  %shift = shufflevector <2 x double> %19, <2 x double> poison, <2 x i32> <i32 1, i32 poison>
  %20 = fadd <2 x double> %19, %shift
  %21 = extractelement <2 x double> %20, i64 0
  %22 = load double, ptr getelementptr inbounds (i8, ptr @g_tp, i64 288), align 8, !tbaa !19
  %23 = fadd double %22, %21
  ret double %23
}

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare <2 x double> @llvm.fmuladd.v2f64(<2 x double>, <2 x double>, <2 x double>) #1

attributes #0 = { 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 #1 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }

!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 80}
!6 = !{!"_ZTS19TechnologyParameter", !7, i64 0, !7, i64 8, !7, i64 16, !7, i64 24, !7, i64 32, !7, i64 40, !7, i64 48, !7, i64 56, !7, i64 64, !7, i64 72, !7, i64 80, !7, i64 88, !7, i64 96, !7, i64 104, !7, i64 112, !7, i64 120, !7, i64 128, !7, i64 136, !7, i64 144, !7, i64 152, !7, i64 160, !7, i64 168, !7, i64 176, !7, i64 184, !7, i64 192, !7, i64 200, !7, i64 208, !7, i64 216, !7, i64 224, !7, i64 232, !7, i64 240, !7, i64 248, !7, i64 256, !7, i64 264, !7, i64 272, !7, i64 280, !7, i64 288, !7, i64 296, !7, i64 304, !7, i64 312, !7, i64 320, !7, i64 328, !7, i64 336, !7, i64 344, !10, i64 352, !11, i64 360, !11, i64 528, !11, i64 696, !11, i64 864, !11, i64 1032, !12, i64 1200, !12, i64 1264, !12, i64 1328, !13, i64 1392, !14, i64 1416, !14, i64 1464, !14, i64 1512}
!7 = !{!"double", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!"long", !8, i64 0}
!11 = !{!"_ZTSN19TechnologyParameter10DeviceTypeE", !7, i64 0, !7, i64 8, !7, i64 16, !7, i64 24, !7, i64 32, !7, i64 40, !7, i64 48, !7, i64 56, !7, i64 64, !7, i64 72, !7, i64 80, !7, i64 88, !7, i64 96, !7, i64 104, !7, i64 112, !7, i64 120, !7, i64 128, !7, i64 136, !7, i64 144, !7, i64 152, !7, i64 160}
!12 = !{!"_ZTSN19TechnologyParameter16InterconnectTypeE", !7, i64 0, !7, i64 8, !7, i64 16, !7, i64 24, !7, i64 32, !7, i64 40, !7, i64 48, !7, i64 56}
!13 = !{!"_ZTSN19TechnologyParameter13ScalingFactorE", !7, i64 0, !7, i64 8, !7, i64 16}
!14 = !{!"_ZTSN19TechnologyParameter10MemoryTypeE", !7, i64 0, !7, i64 8, !7, i64 16, !7, i64 24, !7, i64 32, !7, i64 40}
!15 = !{!6, !7, i64 104}
!16 = !{!6, !7, i64 72}
!17 = !{!6, !7, i64 64}
!18 = !{!6, !7, i64 296}
!19 = !{!6, !7, i64 288}


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