; LLVM IR from gem5/gem5 :: ext/mcpat/iocontrollers.ll (ZN13NIUController11computeAreaEv)

; 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.NIUController = type { %class.McPATComponent, %class.NIUParameters, %class.NIUStatistics }
%class.McPATComponent = type { ptr, %class.Component, ptr, %class.InputParameter, %"class.std::__cxx11::basic_string", double, %"class.std::vector", %class.McPATOutput, %class.statsDef, %class.statsDef, %class.powerDef, %class.powerDef }
%class.Component = type { %class.Area, %class.powerDef, %class.powerDef, double, double }
%class.Area = type { double, double, double }
%class.InputParameter = type { i32, i32, i32, i32, i32, i8, i32, i32, i32, i32, i32, i32, double, double, i32, i32, i32, i32, i32, i8, i8, i8, i8, i8, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i8, i32, i32, i32, i32, i32, i32, i32, i8, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i8, i32, i32, i32, i8, i8, i32, i32, i8, double, double, i8, i32, i32, i8 }
%"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.std::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<McPATComponent *, std::allocator<McPATComponent *>>::_Vector_impl" }
%"struct.std::_Vector_base<McPATComponent *, std::allocator<McPATComponent *>>::_Vector_impl" = type { %"struct.std::_Vector_base<McPATComponent *, std::allocator<McPATComponent *>>::_Vector_impl_data" }
%"struct.std::_Vector_base<McPATComponent *, std::allocator<McPATComponent *>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%class.McPATOutput = type { double, double, double, double, double, double }
%class.statsDef = type { %class.statsComponents, %class.statsComponents, %class.statsComponents, %class.statsComponents, %class.statsComponents, %class.statsComponents, %class.statsComponents }
%class.statsComponents = type { double, double, double }
%class.powerDef = type { %class.powerComponents, %class.powerComponents, %class.powerComponents }
%class.powerComponents = type { double, double, double, double, double }
%class.NIUParameters = type { double, i32, i32 }
%class.NIUStatistics = type { double, double }

; Function Attrs: mustprogress nounwind uwtable
define dso_local void @_ZN13NIUController11computeAreaEv(ptr noundef nonnull align 8 dereferenceable(1384) %0) unnamed_addr #0 align 2 {
  %2 = alloca ptr, align 8
  %3 = alloca double, align 8
  %4 = alloca double, align 8
  %5 = alloca double, align 8
  store ptr %0, ptr %2, align 8, !tbaa !5
  %6 = load ptr, ptr %2, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr %3) #2
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #2
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #2
  %7 = getelementptr inbounds %class.NIUController, ptr %6, i32 0, i32 1
  %8 = getelementptr inbounds %class.NIUParameters, ptr %7, i32 0, i32 2
  %9 = load i32, ptr %8, align 4, !tbaa !9
  %10 = icmp eq i32 %9, 0
  br i1 %10, label %11, label %37

11:                                               ; preds = %1
  %12 = getelementptr inbounds %class.McPATComponent, ptr %6, i32 0, i32 3
  %13 = getelementptr inbounds %class.InputParameter, ptr %12, i32 0, i32 13
  %14 = load double, ptr %13, align 8, !tbaa !33
  %15 = fdiv double %14, 6.500000e-02
  %16 = fmul double 9.150000e-01, %15
  %17 = getelementptr inbounds %class.McPATComponent, ptr %6, i32 0, i32 3
  %18 = getelementptr inbounds %class.InputParameter, ptr %17, i32 0, i32 13
  %19 = load double, ptr %18, align 8, !tbaa !33
  %20 = fdiv double %19, 6.500000e-02
  %21 = fmul double %16, %20
  store double %21, ptr %3, align 8, !tbaa !34
  %22 = getelementptr inbounds %class.McPATComponent, ptr %6, i32 0, i32 3
  %23 = getelementptr inbounds %class.InputParameter, ptr %22, i32 0, i32 13
  %24 = load double, ptr %23, align 8, !tbaa !33
  %25 = fdiv double %24, 6.500000e-02
  %26 = fmul double 0x4015111111111111, %25
  %27 = getelementptr inbounds %class.McPATComponent, ptr %6, i32 0, i32 3
  %28 = getelementptr inbounds %class.InputParameter, ptr %27, i32 0, i32 13
  %29 = load double, ptr %28, align 8, !tbaa !33
  %30 = fdiv double %29, 6.500000e-02
  %31 = fmul double %26, %30
  store double %31, ptr %4, align 8, !tbaa !34
  %32 = getelementptr inbounds %class.McPATComponent, ptr %6, i32 0, i32 3
  %33 = getelementptr inbounds %class.InputParameter, ptr %32, i32 0, i32 13
  %34 = load double, ptr %33, align 8, !tbaa !33
  %35 = fdiv double %34, 6.500000e-02
  %36 = fmul double 1.750000e+00, %35
  store double %36, ptr %5, align 8, !tbaa !34
  br label %68

37:                                               ; preds = %1
  %38 = getelementptr inbounds %class.McPATComponent, ptr %6, i32 0, i32 3
  %39 = getelementptr inbounds %class.InputParameter, ptr %38, i32 0, i32 13
  %40 = load double, ptr %39, align 8, !tbaa !33
  %41 = fdiv double %40, 6.500000e-02
  %42 = fmul double 2.400000e-01, %41
  %43 = getelementptr inbounds %class.McPATComponent, ptr %6, i32 0, i32 3
  %44 = getelementptr inbounds %class.InputParameter, ptr %43, i32 0, i32 13
  %45 = load double, ptr %44, align 8, !tbaa !33
  %46 = fdiv double %45, 6.500000e-02
  %47 = fmul double %42, %46
  store double %47, ptr %3, align 8, !tbaa !34
  %48 = getelementptr inbounds %class.McPATComponent, ptr %6, i32 0, i32 3
  %49 = getelementptr inbounds %class.InputParameter, ptr %48, i32 0, i32 13
  %50 = load double, ptr %49, align 8, !tbaa !33
  %51 = fdiv double %50, 6.500000e-02
  %52 = fmul double 1.000000e-01, %51
  %53 = getelementptr inbounds %class.McPATComponent, ptr %6, i32 0, i32 3
  %54 = getelementptr inbounds %class.InputParameter, ptr %53, i32 0, i32 13
  %55 = load double, ptr %54, align 8, !tbaa !33
  %56 = fdiv double %55, 6.500000e-02
  %57 = fmul double %52, %56
  store double %57, ptr %4, align 8, !tbaa !34
  %58 = getelementptr inbounds %class.McPATComponent, ptr %6, i32 0, i32 3
  %59 = getelementptr inbounds %class.InputParameter, ptr %58, i32 0, i32 13
  %60 = load double, ptr %59, align 8, !tbaa !33
  %61 = fdiv double %60, 6.500000e-02
  %62 = fmul double 3.500000e-01, %61
  %63 = getelementptr inbounds %class.McPATComponent, ptr %6, i32 0, i32 3
  %64 = getelementptr inbounds %class.InputParameter, ptr %63, i32 0, i32 13
  %65 = load double, ptr %64, align 8, !tbaa !33
  %66 = fdiv double %65, 6.500000e-02
  %67 = fmul double %62, %66
  store double %67, ptr %5, align 8, !tbaa !34
  br label %68

68:                                               ; preds = %37, %11
  %69 = load double, ptr %3, align 8, !tbaa !34
  %70 = load double, ptr %4, align 8, !tbaa !34
  %71 = fadd double %69, %70
  %72 = load double, ptr %5, align 8, !tbaa !34
  %73 = fadd double %71, %72
  %74 = fmul double %73, 1.000000e+06
  %75 = getelementptr inbounds %class.McPATComponent, ptr %6, i32 0, i32 7
  %76 = getelementptr inbounds %class.McPATOutput, ptr %75, i32 0, i32 1
  store double %74, ptr %76, align 8, !tbaa !35
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #2
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #2
  call void @llvm.lifetime.end.p0(i64 8, ptr %3) #2
  ret void
}

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

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #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 willreturn memory(argmem: readwrite) }
attributes #2 = { 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, !18, i64 1364}
!10 = !{!"_ZTS13NIUController", !11, i64 0, !31, i64 1352, !32, i64 1368}
!11 = !{!"_ZTS14McPATComponent", !12, i64 8, !6, i64 288, !17, i64 296, !21, i64 664, !14, i64 696, !24, i64 704, !28, i64 728, !29, i64 776, !29, i64 944, !15, i64 1112, !15, i64 1232}
!12 = !{!"_ZTS9Component", !13, i64 0, !15, i64 24, !15, i64 144, !14, i64 264, !14, i64 272}
!13 = !{!"_ZTS4Area", !14, i64 0, !14, i64 8, !14, i64 16}
!14 = !{!"double", !7, i64 0}
!15 = !{!"_ZTS8powerDef", !16, i64 0, !16, i64 40, !16, i64 80}
!16 = !{!"_ZTS15powerComponents", !14, i64 0, !14, i64 8, !14, i64 16, !14, i64 24, !14, i64 32}
!17 = !{!"_ZTS14InputParameter", !18, i64 0, !18, i64 4, !18, i64 8, !18, i64 12, !18, i64 16, !19, i64 20, !18, i64 24, !18, i64 28, !18, i64 32, !18, i64 36, !18, i64 40, !18, i64 44, !14, i64 48, !14, i64 56, !18, i64 64, !18, i64 68, !18, i64 72, !18, i64 76, !18, i64 80, !19, i64 84, !19, i64 85, !19, i64 86, !19, i64 87, !19, i64 88, !18, i64 92, !18, i64 96, !18, i64 100, !18, i64 104, !18, i64 108, !18, i64 112, !18, i64 116, !18, i64 120, !18, i64 124, !18, i64 128, !18, i64 132, !18, i64 136, !18, i64 140, !18, i64 144, !18, i64 148, !20, i64 152, !18, i64 156, !19, i64 160, !18, i64 164, !18, i64 168, !18, i64 172, !18, i64 176, !18, i64 180, !18, i64 184, !18, i64 188, !19, i64 192, !18, i64 196, !18, i64 200, !18, i64 204, !18, i64 208, !18, i64 212, !18, i64 216, !18, i64 220, !18, i64 224, !18, i64 228, !18, i64 232, !18, i64 236, !18, i64 240, !18, i64 244, !18, i64 248, !18, i64 252, !18, i64 256, !18, i64 260, !18, i64 264, !18, i64 268, !18, i64 272, !18, i64 276, !18, i64 280, !18, i64 284, !18, i64 288, !18, i64 292, !18, i64 296, !19, i64 300, !18, i64 304, !18, i64 308, !18, i64 312, !19, i64 316, !19, i64 317, !18, i64 320, !18, i64 324, !19, i64 328, !14, i64 336, !14, i64 344, !19, i64 352, !18, i64 356, !18, i64 360, !19, i64 364}
!18 = !{!"int", !7, i64 0}
!19 = !{!"bool", !7, i64 0}
!20 = !{!"_ZTS9Wire_type", !7, i64 0}
!21 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE", !22, i64 0, !23, i64 8, !7, i64 16}
!22 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_Alloc_hiderE", !6, i64 0}
!23 = !{!"long", !7, i64 0}
!24 = !{!"_ZTSSt6vectorIP14McPATComponentSaIS1_EE", !25, i64 0}
!25 = !{!"_ZTSSt12_Vector_baseIP14McPATComponentSaIS1_EE", !26, i64 0}
!26 = !{!"_ZTSNSt12_Vector_baseIP14McPATComponentSaIS1_EE12_Vector_implE", !27, i64 0}
!27 = !{!"_ZTSNSt12_Vector_baseIP14McPATComponentSaIS1_EE17_Vector_impl_dataE", !6, i64 0, !6, i64 8, !6, i64 16}
!28 = !{!"_ZTS11McPATOutput", !14, i64 0, !14, i64 8, !14, i64 16, !14, i64 24, !14, i64 32, !14, i64 40}
!29 = !{!"_ZTS8statsDef", !30, i64 0, !30, i64 24, !30, i64 48, !30, i64 72, !30, i64 96, !30, i64 120, !30, i64 144}
!30 = !{!"_ZTS15statsComponents", !14, i64 0, !14, i64 8, !14, i64 16}
!31 = !{!"_ZTS13NIUParameters", !14, i64 0, !18, i64 8, !18, i64 12}
!32 = !{!"_ZTS13NIUStatistics", !14, i64 0, !14, i64 8}
!33 = !{!11, !14, i64 352}
!34 = !{!14, !14, i64 0}
!35 = !{!11, !14, i64 736}


; 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 nofree norecurse nosync nounwind willreturn memory(argmem: readwrite) uwtable
define dso_local void @_ZN13NIUController11computeAreaEv(ptr nocapture noundef nonnull align 8 dereferenceable(1384) %0) unnamed_addr #0 align 2 {
  %2 = getelementptr inbounds i8, ptr %0, i64 1364
  %3 = load i32, ptr %2, align 4, !tbaa !5
  %4 = icmp eq i32 %3, 0
  %5 = getelementptr inbounds i8, ptr %0, i64 352
  %6 = load double, ptr %5, align 8, !tbaa !32
  %7 = fdiv double %6, 6.500000e-02
  br i1 %4, label %8, label %12

8:                                                ; preds = %1
  %9 = insertelement <2 x double> poison, double %7, i64 0
  %10 = shufflevector <2 x double> %9, <2 x double> poison, <2 x i32> zeroinitializer
  %11 = fmul <2 x double> %10, <double 9.150000e-01, double 0x4015111111111111>
  br label %17

12:                                               ; preds = %1
  %13 = insertelement <2 x double> poison, double %7, i64 0
  %14 = shufflevector <2 x double> %13, <2 x double> poison, <2 x i32> zeroinitializer
  %15 = fmul <2 x double> %14, <double 2.400000e-01, double 1.000000e-01>
  %16 = fmul double %7, 3.500000e-01
  br label %17

17:                                               ; preds = %12, %8
  %.sink = phi double [ %16, %12 ], [ 1.750000e+00, %8 ]
  %18 = phi <2 x double> [ %15, %12 ], [ %11, %8 ]
  %19 = insertelement <2 x double> poison, double %7, i64 0
  %20 = shufflevector <2 x double> %19, <2 x double> poison, <2 x i32> zeroinitializer
  %21 = fmul <2 x double> %20, %18
  %22 = fmul double %7, %.sink
  %shift = shufflevector <2 x double> %21, <2 x double> poison, <2 x i32> <i32 1, i32 poison>
  %23 = fadd <2 x double> %21, %shift
  %24 = extractelement <2 x double> %23, i64 0
  %25 = fadd double %24, %22
  %26 = fmul double %25, 1.000000e+06
  %27 = getelementptr inbounds i8, ptr %0, i64 736
  store double %26, ptr %27, align 8, !tbaa !33
  ret void
}

attributes #0 = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: readwrite) 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, !17, i64 1364}
!6 = !{!"_ZTS13NIUController", !7, i64 0, !30, i64 1352, !31, i64 1368}
!7 = !{!"_ZTS14McPATComponent", !8, i64 8, !15, i64 288, !16, i64 296, !20, i64 664, !10, i64 696, !23, i64 704, !27, i64 728, !28, i64 776, !28, i64 944, !13, i64 1112, !13, i64 1232}
!8 = !{!"_ZTS9Component", !9, i64 0, !13, i64 24, !13, i64 144, !10, i64 264, !10, i64 272}
!9 = !{!"_ZTS4Area", !10, i64 0, !10, i64 8, !10, i64 16}
!10 = !{!"double", !11, i64 0}
!11 = !{!"omnipotent char", !12, i64 0}
!12 = !{!"Simple C++ TBAA"}
!13 = !{!"_ZTS8powerDef", !14, i64 0, !14, i64 40, !14, i64 80}
!14 = !{!"_ZTS15powerComponents", !10, i64 0, !10, i64 8, !10, i64 16, !10, i64 24, !10, i64 32}
!15 = !{!"any pointer", !11, i64 0}
!16 = !{!"_ZTS14InputParameter", !17, i64 0, !17, i64 4, !17, i64 8, !17, i64 12, !17, i64 16, !18, i64 20, !17, i64 24, !17, i64 28, !17, i64 32, !17, i64 36, !17, i64 40, !17, i64 44, !10, i64 48, !10, i64 56, !17, i64 64, !17, i64 68, !17, i64 72, !17, i64 76, !17, i64 80, !18, i64 84, !18, i64 85, !18, i64 86, !18, i64 87, !18, i64 88, !17, i64 92, !17, i64 96, !17, i64 100, !17, i64 104, !17, i64 108, !17, i64 112, !17, i64 116, !17, i64 120, !17, i64 124, !17, i64 128, !17, i64 132, !17, i64 136, !17, i64 140, !17, i64 144, !17, i64 148, !19, i64 152, !17, i64 156, !18, i64 160, !17, i64 164, !17, i64 168, !17, i64 172, !17, i64 176, !17, i64 180, !17, i64 184, !17, i64 188, !18, i64 192, !17, i64 196, !17, i64 200, !17, i64 204, !17, i64 208, !17, i64 212, !17, i64 216, !17, i64 220, !17, i64 224, !17, i64 228, !17, i64 232, !17, i64 236, !17, i64 240, !17, i64 244, !17, i64 248, !17, i64 252, !17, i64 256, !17, i64 260, !17, i64 264, !17, i64 268, !17, i64 272, !17, i64 276, !17, i64 280, !17, i64 284, !17, i64 288, !17, i64 292, !17, i64 296, !18, i64 300, !17, i64 304, !17, i64 308, !17, i64 312, !18, i64 316, !18, i64 317, !17, i64 320, !17, i64 324, !18, i64 328, !10, i64 336, !10, i64 344, !18, i64 352, !17, i64 356, !17, i64 360, !18, i64 364}
!17 = !{!"int", !11, i64 0}
!18 = !{!"bool", !11, i64 0}
!19 = !{!"_ZTS9Wire_type", !11, i64 0}
!20 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE", !21, i64 0, !22, i64 8, !11, i64 16}
!21 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_Alloc_hiderE", !15, i64 0}
!22 = !{!"long", !11, i64 0}
!23 = !{!"_ZTSSt6vectorIP14McPATComponentSaIS1_EE", !24, i64 0}
!24 = !{!"_ZTSSt12_Vector_baseIP14McPATComponentSaIS1_EE", !25, i64 0}
!25 = !{!"_ZTSNSt12_Vector_baseIP14McPATComponentSaIS1_EE12_Vector_implE", !26, i64 0}
!26 = !{!"_ZTSNSt12_Vector_baseIP14McPATComponentSaIS1_EE17_Vector_impl_dataE", !15, i64 0, !15, i64 8, !15, i64 16}
!27 = !{!"_ZTS11McPATOutput", !10, i64 0, !10, i64 8, !10, i64 16, !10, i64 24, !10, i64 32, !10, i64 40}
!28 = !{!"_ZTS8statsDef", !29, i64 0, !29, i64 24, !29, i64 48, !29, i64 72, !29, i64 96, !29, i64 120, !29, i64 144}
!29 = !{!"_ZTS15statsComponents", !10, i64 0, !10, i64 8, !10, i64 16}
!30 = !{!"_ZTS13NIUParameters", !10, i64 0, !17, i64 8, !17, i64 12}
!31 = !{!"_ZTS13NIUStatistics", !10, i64 0, !10, i64 8}
!32 = !{!7, !10, i64 352}
!33 = !{!7, !10, i64 736}


; Effective O3 passes: EarlyCSEPass,GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,PostOrderFunctionAttrsPass,ReassociatePass,SLPVectorizerPass,SROAPass,SimplifyCFGPass,VectorCombinePass