; LLVM IR from mitdbg/deneva :: transport/message.ll (ZN7Message14create_messageEP10TxnManager10RemReqType)

; 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.TxnManager = type { ptr, ptr, ptr, i8, ptr, i32, i8, i32, i32, i8, i64, i64, i64, i64, ptr, ptr, ptr, i64, i8, i8, ptr, ptr, i64, i64, i64, %class.TxnStats, i32, i32, i32, i8, i32, %class.Array, i32, ptr, ptr, i32, %union.sem_t }
%class.TxnStats = type { i64, i64, i64, i64, i64, double, double, double, double, double, double, double, double, double, double, double, double, double, double, double, double, double, i64, i64, double, double, double, double, double, double, double, double }
%class.Array = type { ptr, i64, i64 }
%union.sem_t = type { i64, [24 x i8] }
%class.Message = type { ptr, i32, i64, i64, i64, i64, i64, i64, 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

; 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
declare dso_local noundef ptr @_ZN7Message14create_messageE10RemReqType(i32 noundef) #1 align 2

; Function Attrs: mustprogress uwtable
define dso_local noundef ptr @_ZN7Message14create_messageEP10TxnManager10RemReqType(ptr noundef %0, i32 noundef %1) #1 align 2 {
  %3 = alloca ptr, align 8
  %4 = alloca i32, align 4
  %5 = alloca ptr, align 8
  store ptr %0, ptr %3, align 8, !tbaa !5
  store i32 %1, ptr %4, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #2
  %6 = load i32, ptr %4, align 4, !tbaa !9
  %7 = call noundef ptr @_ZN7Message14create_messageE10RemReqType(i32 noundef %6)
  store ptr %7, ptr %5, align 8, !tbaa !5
  %8 = load ptr, ptr %5, align 8, !tbaa !5
  %9 = load ptr, ptr %3, align 8, !tbaa !5
  call void @_ZN7Message14mcopy_from_txnEP10TxnManager(ptr noundef nonnull align 8 dereferenceable(120) %8, ptr noundef %9)
  %10 = load ptr, ptr %5, align 8, !tbaa !5
  %11 = load ptr, ptr %3, align 8, !tbaa !5
  %12 = load ptr, ptr %10, align 8, !tbaa !11
  %13 = getelementptr inbounds ptr, ptr %12, i64 6
  %14 = load ptr, ptr %13, align 8
  call void %14(ptr noundef nonnull align 8 dereferenceable(120) %10, ptr noundef %11)
  %15 = load ptr, ptr %3, align 8, !tbaa !5
  %16 = getelementptr inbounds %class.TxnManager, ptr %15, i32 0, i32 25
  %17 = getelementptr inbounds %class.TxnStats, ptr %16, i32 0, i32 24
  %18 = load double, ptr %17, align 8, !tbaa !13
  %19 = load ptr, ptr %5, align 8, !tbaa !5
  %20 = getelementptr inbounds %class.Message, ptr %19, i32 0, i32 8
  store double %18, ptr %20, align 8, !tbaa !23
  %21 = load ptr, ptr %3, align 8, !tbaa !5
  %22 = getelementptr inbounds %class.TxnManager, ptr %21, i32 0, i32 25
  %23 = getelementptr inbounds %class.TxnStats, ptr %22, i32 0, i32 27
  %24 = load double, ptr %23, align 8, !tbaa !25
  %25 = load ptr, ptr %5, align 8, !tbaa !5
  %26 = getelementptr inbounds %class.Message, ptr %25, i32 0, i32 9
  store double %24, ptr %26, align 8, !tbaa !26
  %27 = load ptr, ptr %3, align 8, !tbaa !5
  %28 = getelementptr inbounds %class.TxnManager, ptr %27, i32 0, i32 25
  %29 = getelementptr inbounds %class.TxnStats, ptr %28, i32 0, i32 25
  %30 = load double, ptr %29, align 8, !tbaa !27
  %31 = load ptr, ptr %5, align 8, !tbaa !5
  %32 = getelementptr inbounds %class.Message, ptr %31, i32 0, i32 10
  store double %30, ptr %32, align 8, !tbaa !28
  %33 = load ptr, ptr %3, align 8, !tbaa !5
  %34 = getelementptr inbounds %class.TxnManager, ptr %33, i32 0, i32 25
  %35 = getelementptr inbounds %class.TxnStats, ptr %34, i32 0, i32 26
  %36 = load double, ptr %35, align 8, !tbaa !29
  %37 = load ptr, ptr %5, align 8, !tbaa !5
  %38 = getelementptr inbounds %class.Message, ptr %37, i32 0, i32 11
  store double %36, ptr %38, align 8, !tbaa !30
  %39 = load ptr, ptr %3, align 8, !tbaa !5
  %40 = getelementptr inbounds %class.TxnManager, ptr %39, i32 0, i32 25
  %41 = getelementptr inbounds %class.TxnStats, ptr %40, i32 0, i32 28
  %42 = load double, ptr %41, align 8, !tbaa !31
  %43 = load ptr, ptr %5, align 8, !tbaa !5
  %44 = getelementptr inbounds %class.Message, ptr %43, i32 0, i32 12
  store double %42, ptr %44, align 8, !tbaa !32
  %45 = load ptr, ptr %3, align 8, !tbaa !5
  %46 = getelementptr inbounds %class.TxnManager, ptr %45, i32 0, i32 25
  %47 = getelementptr inbounds %class.TxnStats, ptr %46, i32 0, i32 30
  %48 = load double, ptr %47, align 8, !tbaa !33
  %49 = load ptr, ptr %5, align 8, !tbaa !5
  %50 = getelementptr inbounds %class.Message, ptr %49, i32 0, i32 13
  store double %48, ptr %50, align 8, !tbaa !34
  %51 = load ptr, ptr %3, align 8, !tbaa !5
  %52 = getelementptr inbounds %class.TxnManager, ptr %51, i32 0, i32 25
  %53 = getelementptr inbounds %class.TxnStats, ptr %52, i32 0, i32 31
  %54 = load double, ptr %53, align 8, !tbaa !35
  %55 = load ptr, ptr %5, align 8, !tbaa !5
  %56 = getelementptr inbounds %class.Message, ptr %55, i32 0, i32 14
  store double %54, ptr %56, align 8, !tbaa !36
  %57 = load ptr, ptr %5, align 8, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #2
  ret ptr %57
}

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN7Message14mcopy_from_txnEP10TxnManager(ptr noundef nonnull align 8 dereferenceable(120), ptr noundef) #1 align 2

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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" }
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, !10, i64 0}
!10 = !{!"_ZTS10RemReqType", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"vtable pointer", !8, i64 0}
!13 = !{!14, !19, i64 368}
!14 = !{!"_ZTS10TxnManager", !6, i64 8, !6, i64 16, !15, i64 24, !6, i64 32, !16, i64 40, !15, i64 44, !16, i64 48, !16, i64 52, !15, i64 56, !17, i64 64, !17, i64 72, !17, i64 80, !17, i64 88, !6, i64 96, !6, i64 104, !6, i64 112, !17, i64 120, !15, i64 128, !15, i64 129, !6, i64 136, !6, i64 144, !17, i64 152, !17, i64 160, !17, i64 168, !18, i64 176, !16, i64 432, !16, i64 436, !16, i64 440, !15, i64 444, !20, i64 448, !21, i64 456, !16, i64 480, !6, i64 488, !6, i64 496, !22, i64 504, !7, i64 512}
!15 = !{!"bool", !7, i64 0}
!16 = !{!"int", !7, i64 0}
!17 = !{!"long", !7, i64 0}
!18 = !{!"_ZTS8TxnStats", !17, i64 0, !17, i64 8, !17, i64 16, !17, i64 24, !17, i64 32, !19, i64 40, !19, i64 48, !19, i64 56, !19, i64 64, !19, i64 72, !19, i64 80, !19, i64 88, !19, i64 96, !19, i64 104, !19, i64 112, !19, i64 120, !19, i64 128, !19, i64 136, !19, i64 144, !19, i64 152, !19, i64 160, !19, i64 168, !17, i64 176, !17, i64 184, !19, i64 192, !19, i64 200, !19, i64 208, !19, i64 216, !19, i64 224, !19, i64 232, !19, i64 240, !19, i64 248}
!19 = !{!"double", !7, i64 0}
!20 = !{!"_ZTS12CALVIN_PHASE", !7, i64 0}
!21 = !{!"_ZTS5ArrayIP5row_tE", !6, i64 0, !17, i64 8, !17, i64 16}
!22 = !{!"_ZTS8access_t", !7, i64 0}
!23 = !{!24, !19, i64 64}
!24 = !{!"_ZTS7Message", !10, i64 8, !17, i64 16, !17, i64 24, !17, i64 32, !17, i64 40, !17, i64 48, !17, i64 56, !19, i64 64, !19, i64 72, !19, i64 80, !19, i64 88, !19, i64 96, !19, i64 104, !19, i64 112}
!25 = !{!14, !19, i64 392}
!26 = !{!24, !19, i64 72}
!27 = !{!14, !19, i64 376}
!28 = !{!24, !19, i64 80}
!29 = !{!14, !19, i64 384}
!30 = !{!24, !19, i64 88}
!31 = !{!14, !19, i64 400}
!32 = !{!24, !19, i64 96}
!33 = !{!14, !19, i64 416}
!34 = !{!24, !19, i64 104}
!35 = !{!14, !19, i64 424}
!36 = !{!24, !19, i64 112}


; 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 ptr @_ZN7Message14create_messageE10RemReqType(i32 noundef) local_unnamed_addr #0 align 2

; Function Attrs: mustprogress uwtable
define dso_local noundef ptr @_ZN7Message14create_messageEP10TxnManager10RemReqType(ptr noundef %0, i32 noundef %1) local_unnamed_addr #0 align 2 {
  %3 = tail call noundef ptr @_ZN7Message14create_messageE10RemReqType(i32 noundef %1)
  tail call void @_ZN7Message14mcopy_from_txnEP10TxnManager(ptr noundef nonnull align 8 dereferenceable(120) %3, ptr noundef %0)
  %4 = load ptr, ptr %3, align 8, !tbaa !5
  %5 = getelementptr inbounds i8, ptr %4, i64 48
  %6 = load ptr, ptr %5, align 8
  tail call void %6(ptr noundef nonnull align 8 dereferenceable(120) %3, ptr noundef %0)
  %7 = getelementptr inbounds i8, ptr %0, i64 368
  %8 = load double, ptr %7, align 8, !tbaa !8
  %9 = getelementptr inbounds i8, ptr %3, i64 64
  store double %8, ptr %9, align 8, !tbaa !20
  %10 = getelementptr inbounds i8, ptr %0, i64 392
  %11 = load double, ptr %10, align 8, !tbaa !23
  %12 = getelementptr inbounds i8, ptr %3, i64 72
  store double %11, ptr %12, align 8, !tbaa !24
  %13 = getelementptr inbounds i8, ptr %0, i64 376
  %14 = getelementptr inbounds i8, ptr %3, i64 80
  %15 = load <2 x double>, ptr %13, align 8, !tbaa !25
  store <2 x double> %15, ptr %14, align 8, !tbaa !25
  %16 = getelementptr inbounds i8, ptr %0, i64 400
  %17 = load double, ptr %16, align 8, !tbaa !26
  %18 = getelementptr inbounds i8, ptr %3, i64 96
  store double %17, ptr %18, align 8, !tbaa !27
  %19 = getelementptr inbounds i8, ptr %0, i64 416
  %20 = getelementptr inbounds i8, ptr %3, i64 104
  %21 = load <2 x double>, ptr %19, align 8, !tbaa !25
  store <2 x double> %21, ptr %20, align 8, !tbaa !25
  ret ptr %3
}

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN7Message14mcopy_from_txnEP10TxnManager(ptr noundef nonnull align 8 dereferenceable(120), ptr noundef) local_unnamed_addr #0 align 2

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 = !{!"vtable pointer", !7, i64 0}
!7 = !{!"Simple C++ TBAA"}
!8 = !{!9, !16, i64 368}
!9 = !{!"_ZTS10TxnManager", !10, i64 8, !10, i64 16, !12, i64 24, !10, i64 32, !13, i64 40, !12, i64 44, !13, i64 48, !13, i64 52, !12, i64 56, !14, i64 64, !14, i64 72, !14, i64 80, !14, i64 88, !10, i64 96, !10, i64 104, !10, i64 112, !14, i64 120, !12, i64 128, !12, i64 129, !10, i64 136, !10, i64 144, !14, i64 152, !14, i64 160, !14, i64 168, !15, i64 176, !13, i64 432, !13, i64 436, !13, i64 440, !12, i64 444, !17, i64 448, !18, i64 456, !13, i64 480, !10, i64 488, !10, i64 496, !19, i64 504, !11, i64 512}
!10 = !{!"any pointer", !11, i64 0}
!11 = !{!"omnipotent char", !7, i64 0}
!12 = !{!"bool", !11, i64 0}
!13 = !{!"int", !11, i64 0}
!14 = !{!"long", !11, i64 0}
!15 = !{!"_ZTS8TxnStats", !14, i64 0, !14, i64 8, !14, i64 16, !14, i64 24, !14, i64 32, !16, i64 40, !16, i64 48, !16, i64 56, !16, i64 64, !16, i64 72, !16, i64 80, !16, i64 88, !16, i64 96, !16, i64 104, !16, i64 112, !16, i64 120, !16, i64 128, !16, i64 136, !16, i64 144, !16, i64 152, !16, i64 160, !16, i64 168, !14, i64 176, !14, i64 184, !16, i64 192, !16, i64 200, !16, i64 208, !16, i64 216, !16, i64 224, !16, i64 232, !16, i64 240, !16, i64 248}
!16 = !{!"double", !11, i64 0}
!17 = !{!"_ZTS12CALVIN_PHASE", !11, i64 0}
!18 = !{!"_ZTS5ArrayIP5row_tE", !10, i64 0, !14, i64 8, !14, i64 16}
!19 = !{!"_ZTS8access_t", !11, i64 0}
!20 = !{!21, !16, i64 64}
!21 = !{!"_ZTS7Message", !22, i64 8, !14, i64 16, !14, i64 24, !14, i64 32, !14, i64 40, !14, i64 48, !14, i64 56, !16, i64 64, !16, i64 72, !16, i64 80, !16, i64 88, !16, i64 96, !16, i64 104, !16, i64 112}
!22 = !{!"_ZTS10RemReqType", !11, i64 0}
!23 = !{!9, !16, i64 392}
!24 = !{!21, !16, i64 72}
!25 = !{!16, !16, i64 0}
!26 = !{!9, !16, i64 400}
!27 = !{!21, !16, i64 96}


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