; LLVM IR from ChampSim/ChampSim :: src/dram_stats.ll (Zmi10dram_statsS_)

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

%struct.dram_stats = type <{ %"class.std::__cxx11::basic_string", i64, i64, i64, i32, i32, i32, i32, i32, [4 x 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] }

; Function Attrs: mustprogress nounwind uwtable
define dso_local void @_Zmi10dram_statsS_(ptr dead_on_unwind noalias writable sret(%struct.dram_stats) align 8 %0, ptr noundef %1, ptr noundef %2) #0 {
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  store ptr %0, ptr %4, align 8
  store ptr %1, ptr %5, align 8, !tbaa !5
  store ptr %2, ptr %6, align 8, !tbaa !5
  %7 = getelementptr inbounds %struct.dram_stats, ptr %2, i32 0, i32 1
  %8 = load i64, ptr %7, align 8, !tbaa !9
  %9 = getelementptr inbounds %struct.dram_stats, ptr %1, i32 0, i32 1
  %10 = load i64, ptr %9, align 8, !tbaa !9
  %11 = sub nsw i64 %10, %8
  store i64 %11, ptr %9, align 8, !tbaa !9
  %12 = getelementptr inbounds %struct.dram_stats, ptr %2, i32 0, i32 2
  %13 = load i64, ptr %12, align 8, !tbaa !15
  %14 = getelementptr inbounds %struct.dram_stats, ptr %1, i32 0, i32 2
  %15 = load i64, ptr %14, align 8, !tbaa !15
  %16 = sub i64 %15, %13
  store i64 %16, ptr %14, align 8, !tbaa !15
  %17 = getelementptr inbounds %struct.dram_stats, ptr %2, i32 0, i32 4
  %18 = load i32, ptr %17, align 8, !tbaa !16
  %19 = getelementptr inbounds %struct.dram_stats, ptr %1, i32 0, i32 4
  %20 = load i32, ptr %19, align 8, !tbaa !16
  %21 = sub i32 %20, %18
  store i32 %21, ptr %19, align 8, !tbaa !16
  %22 = getelementptr inbounds %struct.dram_stats, ptr %2, i32 0, i32 5
  %23 = load i32, ptr %22, align 4, !tbaa !17
  %24 = getelementptr inbounds %struct.dram_stats, ptr %1, i32 0, i32 5
  %25 = load i32, ptr %24, align 4, !tbaa !17
  %26 = sub i32 %25, %23
  store i32 %26, ptr %24, align 4, !tbaa !17
  %27 = getelementptr inbounds %struct.dram_stats, ptr %2, i32 0, i32 6
  %28 = load i32, ptr %27, align 8, !tbaa !18
  %29 = getelementptr inbounds %struct.dram_stats, ptr %1, i32 0, i32 6
  %30 = load i32, ptr %29, align 8, !tbaa !18
  %31 = sub i32 %30, %28
  store i32 %31, ptr %29, align 8, !tbaa !18
  %32 = getelementptr inbounds %struct.dram_stats, ptr %2, i32 0, i32 7
  %33 = load i32, ptr %32, align 4, !tbaa !19
  %34 = getelementptr inbounds %struct.dram_stats, ptr %1, i32 0, i32 7
  %35 = load i32, ptr %34, align 4, !tbaa !19
  %36 = sub i32 %35, %33
  store i32 %36, ptr %34, align 4, !tbaa !19
  %37 = getelementptr inbounds %struct.dram_stats, ptr %2, i32 0, i32 8
  %38 = load i32, ptr %37, align 8, !tbaa !20
  %39 = getelementptr inbounds %struct.dram_stats, ptr %1, i32 0, i32 8
  %40 = load i32, ptr %39, align 8, !tbaa !20
  %41 = sub i32 %40, %38
  store i32 %41, ptr %39, align 8, !tbaa !20
  call void @_ZN10dram_statsC2EOS_(ptr noundef nonnull align 8 dereferenceable(76) %0, ptr noundef nonnull align 8 dereferenceable(76) %1) #2
  ret void
}

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZN10dram_statsC2EOS_(ptr noundef nonnull align 8 dereferenceable(76), ptr noundef nonnull align 8 dereferenceable(76)) unnamed_addr #1 align 2

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 = { 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 #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, !13, i64 32}
!10 = !{!"_ZTS10dram_stats", !11, i64 0, !13, i64 32, !13, i64 40, !13, i64 48, !14, i64 56, !14, i64 60, !14, i64 64, !14, i64 68, !14, i64 72}
!11 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE", !12, i64 0, !13, i64 8, !7, i64 16}
!12 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_Alloc_hiderE", !6, i64 0}
!13 = !{!"long", !7, i64 0}
!14 = !{!"int", !7, i64 0}
!15 = !{!10, !13, i64 40}
!16 = !{!10, !14, i64 56}
!17 = !{!10, !14, i64 60}
!18 = !{!10, !14, i64 64}
!19 = !{!10, !14, i64 68}
!20 = !{!10, !14, i64 72}


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

%struct.dram_stats = type <{ %"class.std::__cxx11::basic_string", i64, i64, i64, i32, i32, i32, i32, i32, [4 x 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] }

; Function Attrs: mustprogress nounwind uwtable
define dso_local void @_Zmi10dram_statsS_(ptr dead_on_unwind noalias nonnull writable sret(%struct.dram_stats) align 8 %0, ptr noundef nonnull %1, ptr nocapture noundef readonly %2) local_unnamed_addr #0 {
  %4 = getelementptr inbounds i8, ptr %2, i64 32
  %5 = getelementptr inbounds i8, ptr %1, i64 32
  %6 = load <2 x i64>, ptr %4, align 8, !tbaa !5
  %7 = load <2 x i64>, ptr %5, align 8, !tbaa !5
  %8 = sub <2 x i64> %7, %6
  store <2 x i64> %8, ptr %5, align 8, !tbaa !5
  %9 = getelementptr inbounds i8, ptr %2, i64 56
  %10 = getelementptr inbounds i8, ptr %1, i64 56
  %11 = load <4 x i32>, ptr %9, align 8, !tbaa !9
  %12 = load <4 x i32>, ptr %10, align 8, !tbaa !9
  %13 = sub <4 x i32> %12, %11
  store <4 x i32> %13, ptr %10, align 8, !tbaa !9
  %14 = getelementptr inbounds i8, ptr %2, i64 72
  %15 = load i32, ptr %14, align 8, !tbaa !11
  %16 = getelementptr inbounds i8, ptr %1, i64 72
  %17 = load i32, ptr %16, align 8, !tbaa !11
  %18 = sub i32 %17, %15
  store i32 %18, ptr %16, align 8, !tbaa !11
  tail call void @_ZN10dram_statsC2EOS_(ptr noundef nonnull align 8 dereferenceable(76) %0, ptr noundef nonnull align 8 dereferenceable(76) %1) #2
  ret void
}

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZN10dram_statsC2EOS_(ptr noundef nonnull align 8 dereferenceable(76), ptr noundef nonnull align 8 dereferenceable(76)) unnamed_addr #1 align 2

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 = { 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 #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 = !{!"long", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = !{!12, !10, i64 72}
!12 = !{!"_ZTS10dram_stats", !13, i64 0, !6, i64 32, !6, i64 40, !6, i64 48, !10, i64 56, !10, i64 60, !10, i64 64, !10, i64 68, !10, i64 72}
!13 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE", !14, i64 0, !6, i64 8, !7, i64 16}
!14 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_Alloc_hiderE", !15, i64 0}
!15 = !{!"any pointer", !7, i64 0}


; Effective O3 passes: GlobalOptPass,InstCombinePass,PostOrderFunctionAttrsPass,SLPVectorizerPass,SROAPass,TailCallElimPass