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

; 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.Array.2 = type { ptr, i64, i64 }
%class.TPCCQuery = type { %class.BaseQuery, i32, i64, i64, i64, i64, i64, i64, [16 x i8], double, i8, %class.Array.2, i8, i8, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64 }
%class.BaseQuery = type { ptr, i64, %class.Array.0, %class.Array.0, %class.Array.0, %class.Array.0 }
%class.Array.0 = type { ptr, i64, i64 }
%class.TPCCClientQueryMessage = type { %class.ClientQueryMessage, i64, i64, i64, i64, i64, i64, i64, [16 x i8], i64, i8, %class.Array.2, i8, i8, i64, i64 }
%class.ClientQueryMessage = type { %class.Message, i64, i64, i64, i64, %class.Array.0 }
%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 nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #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 uwtable
declare dso_local void @_ZN18ClientQueryMessage15copy_from_queryEP9BaseQuery(ptr noundef nonnull align 8 dereferenceable(176), ptr noundef) #2 align 2

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN22TPCCClientQueryMessage15copy_from_queryEP9BaseQuery(ptr noundef nonnull align 8 dereferenceable(312) %0, ptr noundef %1) #2 align 2 {
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca %class.Array.2, align 8
  store ptr %0, ptr %3, align 8, !tbaa !5
  store ptr %1, ptr %4, align 8, !tbaa !5
  %7 = load ptr, ptr %3, align 8
  %8 = load ptr, ptr %4, align 8, !tbaa !5
  call void @_ZN18ClientQueryMessage15copy_from_queryEP9BaseQuery(ptr noundef nonnull align 8 dereferenceable(176) %7, ptr noundef %8)
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #4
  %9 = load ptr, ptr %4, align 8, !tbaa !5
  store ptr %9, ptr %5, align 8, !tbaa !5
  %10 = load ptr, ptr %5, align 8, !tbaa !5
  %11 = getelementptr inbounds %class.TPCCQuery, ptr %10, i32 0, i32 1
  %12 = load i32, ptr %11, align 8, !tbaa !9
  %13 = zext i32 %12 to i64
  %14 = getelementptr inbounds %class.TPCCClientQueryMessage, ptr %7, i32 0, i32 1
  store i64 %13, ptr %14, align 8, !tbaa !18
  %15 = load ptr, ptr %5, align 8, !tbaa !5
  %16 = getelementptr inbounds %class.TPCCQuery, ptr %15, i32 0, i32 2
  %17 = load i64, ptr %16, align 8, !tbaa !23
  %18 = getelementptr inbounds %class.TPCCClientQueryMessage, ptr %7, i32 0, i32 2
  store i64 %17, ptr %18, align 8, !tbaa !24
  %19 = load ptr, ptr %5, align 8, !tbaa !5
  %20 = getelementptr inbounds %class.TPCCQuery, ptr %19, i32 0, i32 3
  %21 = load i64, ptr %20, align 8, !tbaa !25
  %22 = getelementptr inbounds %class.TPCCClientQueryMessage, ptr %7, i32 0, i32 3
  store i64 %21, ptr %22, align 8, !tbaa !26
  %23 = load ptr, ptr %5, align 8, !tbaa !5
  %24 = getelementptr inbounds %class.TPCCQuery, ptr %23, i32 0, i32 4
  %25 = load i64, ptr %24, align 8, !tbaa !27
  %26 = getelementptr inbounds %class.TPCCClientQueryMessage, ptr %7, i32 0, i32 4
  store i64 %25, ptr %26, align 8, !tbaa !28
  %27 = load ptr, ptr %5, align 8, !tbaa !5
  %28 = getelementptr inbounds %class.TPCCQuery, ptr %27, i32 0, i32 5
  %29 = load i64, ptr %28, align 8, !tbaa !29
  %30 = getelementptr inbounds %class.TPCCClientQueryMessage, ptr %7, i32 0, i32 5
  store i64 %29, ptr %30, align 8, !tbaa !30
  %31 = load ptr, ptr %5, align 8, !tbaa !5
  %32 = getelementptr inbounds %class.TPCCQuery, ptr %31, i32 0, i32 6
  %33 = load i64, ptr %32, align 8, !tbaa !31
  %34 = getelementptr inbounds %class.TPCCClientQueryMessage, ptr %7, i32 0, i32 6
  store i64 %33, ptr %34, align 8, !tbaa !32
  %35 = load ptr, ptr %5, align 8, !tbaa !5
  %36 = getelementptr inbounds %class.TPCCQuery, ptr %35, i32 0, i32 7
  %37 = load i64, ptr %36, align 8, !tbaa !33
  %38 = getelementptr inbounds %class.TPCCClientQueryMessage, ptr %7, i32 0, i32 7
  store i64 %37, ptr %38, align 8, !tbaa !34
  %39 = getelementptr inbounds %class.TPCCClientQueryMessage, ptr %7, i32 0, i32 8
  %40 = getelementptr inbounds [16 x i8], ptr %39, i64 0, i64 0
  %41 = load ptr, ptr %5, align 8, !tbaa !5
  %42 = getelementptr inbounds %class.TPCCQuery, ptr %41, i32 0, i32 8
  %43 = getelementptr inbounds [16 x i8], ptr %42, i64 0, i64 0
  %44 = call ptr @strcpy(ptr noundef %40, ptr noundef %43) #4
  %45 = load ptr, ptr %5, align 8, !tbaa !5
  %46 = getelementptr inbounds %class.TPCCQuery, ptr %45, i32 0, i32 9
  %47 = load double, ptr %46, align 8, !tbaa !35
  %48 = fptoui double %47 to i64
  %49 = getelementptr inbounds %class.TPCCClientQueryMessage, ptr %7, i32 0, i32 9
  store i64 %48, ptr %49, align 8, !tbaa !36
  %50 = load ptr, ptr %5, align 8, !tbaa !5
  %51 = getelementptr inbounds %class.TPCCQuery, ptr %50, i32 0, i32 10
  %52 = load i8, ptr %51, align 8, !tbaa !37, !range !38, !noundef !39
  %53 = trunc i8 %52 to i1
  %54 = getelementptr inbounds %class.TPCCClientQueryMessage, ptr %7, i32 0, i32 10
  %55 = zext i1 %53 to i8
  store i8 %55, ptr %54, align 8, !tbaa !40
  %56 = getelementptr inbounds %class.TPCCClientQueryMessage, ptr %7, i32 0, i32 11
  %57 = load ptr, ptr %5, align 8, !tbaa !5
  %58 = getelementptr inbounds %class.TPCCQuery, ptr %57, i32 0, i32 11
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %6, ptr align 8 %58, i64 24, i1 false), !tbaa.struct !41
  call void @_ZN5ArrayIP7Item_noE4copyES2_(ptr noundef nonnull align 8 dereferenceable(24) %56, ptr noundef byval(%class.Array.2) align 8 %6)
  %59 = load ptr, ptr %5, align 8, !tbaa !5
  %60 = getelementptr inbounds %class.TPCCQuery, ptr %59, i32 0, i32 12
  %61 = load i8, ptr %60, align 8, !tbaa !43, !range !38, !noundef !39
  %62 = trunc i8 %61 to i1
  %63 = getelementptr inbounds %class.TPCCClientQueryMessage, ptr %7, i32 0, i32 12
  %64 = zext i1 %62 to i8
  store i8 %64, ptr %63, align 8, !tbaa !44
  %65 = load ptr, ptr %5, align 8, !tbaa !5
  %66 = getelementptr inbounds %class.TPCCQuery, ptr %65, i32 0, i32 13
  %67 = load i8, ptr %66, align 1, !tbaa !45, !range !38, !noundef !39
  %68 = trunc i8 %67 to i1
  %69 = getelementptr inbounds %class.TPCCClientQueryMessage, ptr %7, i32 0, i32 13
  %70 = zext i1 %68 to i8
  store i8 %70, ptr %69, align 1, !tbaa !46
  %71 = load ptr, ptr %5, align 8, !tbaa !5
  %72 = getelementptr inbounds %class.TPCCQuery, ptr %71, i32 0, i32 14
  %73 = load i64, ptr %72, align 8, !tbaa !47
  %74 = getelementptr inbounds %class.TPCCClientQueryMessage, ptr %7, i32 0, i32 14
  store i64 %73, ptr %74, align 8, !tbaa !48
  %75 = load ptr, ptr %5, align 8, !tbaa !5
  %76 = getelementptr inbounds %class.TPCCQuery, ptr %75, i32 0, i32 15
  %77 = load i64, ptr %76, align 8, !tbaa !49
  %78 = getelementptr inbounds %class.TPCCClientQueryMessage, ptr %7, i32 0, i32 15
  store i64 %77, ptr %78, align 8, !tbaa !50
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #4
  ret void
}

; Function Attrs: nounwind
declare ptr @strcpy(ptr noundef, ptr noundef) #3

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN5ArrayIP7Item_noE4copyES2_(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef byval(%class.Array.2) align 8) #2 align 2

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { 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 #3 = { nounwind "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 #4 = { 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, !14, i64 112}
!10 = !{!"_ZTS9TPCCQuery", !11, i64 0, !14, i64 112, !12, i64 120, !12, i64 128, !12, i64 136, !12, i64 144, !12, i64 152, !12, i64 160, !7, i64 168, !15, i64 184, !16, i64 192, !17, i64 200, !16, i64 224, !16, i64 225, !12, i64 232, !12, i64 240, !12, i64 248, !12, i64 256, !12, i64 264, !12, i64 272, !12, i64 280, !12, i64 288, !12, i64 296, !12, i64 304, !12, i64 312}
!11 = !{!"_ZTS9BaseQuery", !12, i64 8, !13, i64 16, !13, i64 40, !13, i64 64, !13, i64 88}
!12 = !{!"long", !7, i64 0}
!13 = !{!"_ZTS5ArrayImE", !6, i64 0, !12, i64 8, !12, i64 16}
!14 = !{!"_ZTS11TPCCTxnType", !7, i64 0}
!15 = !{!"double", !7, i64 0}
!16 = !{!"bool", !7, i64 0}
!17 = !{!"_ZTS5ArrayIP7Item_noE", !6, i64 0, !12, i64 8, !12, i64 16}
!18 = !{!19, !12, i64 176}
!19 = !{!"_ZTS22TPCCClientQueryMessage", !20, i64 0, !12, i64 176, !12, i64 184, !12, i64 192, !12, i64 200, !12, i64 208, !12, i64 216, !12, i64 224, !7, i64 232, !12, i64 248, !16, i64 256, !17, i64 264, !16, i64 288, !16, i64 289, !12, i64 296, !12, i64 304}
!20 = !{!"_ZTS18ClientQueryMessage", !21, i64 0, !12, i64 120, !12, i64 128, !12, i64 136, !12, i64 144, !13, i64 152}
!21 = !{!"_ZTS7Message", !22, i64 8, !12, i64 16, !12, i64 24, !12, i64 32, !12, i64 40, !12, i64 48, !12, i64 56, !15, i64 64, !15, i64 72, !15, i64 80, !15, i64 88, !15, i64 96, !15, i64 104, !15, i64 112}
!22 = !{!"_ZTS10RemReqType", !7, i64 0}
!23 = !{!10, !12, i64 120}
!24 = !{!19, !12, i64 184}
!25 = !{!10, !12, i64 128}
!26 = !{!19, !12, i64 192}
!27 = !{!10, !12, i64 136}
!28 = !{!19, !12, i64 200}
!29 = !{!10, !12, i64 144}
!30 = !{!19, !12, i64 208}
!31 = !{!10, !12, i64 152}
!32 = !{!19, !12, i64 216}
!33 = !{!10, !12, i64 160}
!34 = !{!19, !12, i64 224}
!35 = !{!10, !15, i64 184}
!36 = !{!19, !12, i64 248}
!37 = !{!10, !16, i64 192}
!38 = !{i8 0, i8 2}
!39 = !{}
!40 = !{!19, !16, i64 256}
!41 = !{i64 0, i64 8, !5, i64 8, i64 8, !42, i64 16, i64 8, !42}
!42 = !{!12, !12, i64 0}
!43 = !{!10, !16, i64 224}
!44 = !{!19, !16, i64 288}
!45 = !{!10, !16, i64 225}
!46 = !{!19, !16, i64 289}
!47 = !{!10, !12, i64 232}
!48 = !{!19, !12, i64 296}
!49 = !{!10, !12, i64 240}
!50 = !{!19, !12, i64 304}


; 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.Array.2 = type { ptr, i64, i64 }

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

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN22TPCCClientQueryMessage15copy_from_queryEP9BaseQuery(ptr noundef nonnull align 8 dereferenceable(312) %0, ptr noundef %1) local_unnamed_addr #0 align 2 {
  tail call void @_ZN18ClientQueryMessage15copy_from_queryEP9BaseQuery(ptr noundef nonnull align 8 dereferenceable(176) %0, ptr noundef %1)
  %3 = getelementptr inbounds i8, ptr %1, i64 112
  %4 = load i32, ptr %3, align 8, !tbaa !5
  %5 = zext i32 %4 to i64
  %6 = getelementptr inbounds i8, ptr %0, i64 176
  store i64 %5, ptr %6, align 8, !tbaa !17
  %7 = getelementptr inbounds i8, ptr %1, i64 120
  %8 = getelementptr inbounds i8, ptr %0, i64 184
  %9 = load <2 x i64>, ptr %7, align 8, !tbaa !22
  store <2 x i64> %9, ptr %8, align 8, !tbaa !22
  %10 = getelementptr inbounds i8, ptr %1, i64 136
  %11 = getelementptr inbounds i8, ptr %0, i64 200
  %12 = load <2 x i64>, ptr %10, align 8, !tbaa !22
  store <2 x i64> %12, ptr %11, align 8, !tbaa !22
  %13 = getelementptr inbounds i8, ptr %1, i64 152
  %14 = getelementptr inbounds i8, ptr %0, i64 216
  %15 = load <2 x i64>, ptr %13, align 8, !tbaa !22
  store <2 x i64> %15, ptr %14, align 8, !tbaa !22
  %16 = getelementptr inbounds i8, ptr %0, i64 232
  %17 = getelementptr inbounds i8, ptr %1, i64 168
  %18 = tail call ptr @strcpy(ptr noundef nonnull dereferenceable(1) %16, ptr noundef nonnull dereferenceable(1) %17) #2
  %19 = getelementptr inbounds i8, ptr %1, i64 184
  %20 = load double, ptr %19, align 8, !tbaa !23
  %21 = fptoui double %20 to i64
  %22 = getelementptr inbounds i8, ptr %0, i64 248
  store i64 %21, ptr %22, align 8, !tbaa !24
  %23 = getelementptr inbounds i8, ptr %1, i64 192
  %24 = load i8, ptr %23, align 8, !tbaa !25, !range !26, !noundef !27
  %25 = getelementptr inbounds i8, ptr %0, i64 256
  store i8 %24, ptr %25, align 8, !tbaa !28
  %26 = getelementptr inbounds i8, ptr %0, i64 264
  %27 = getelementptr inbounds i8, ptr %1, i64 200
  tail call void @_ZN5ArrayIP7Item_noE4copyES2_(ptr noundef nonnull align 8 dereferenceable(24) %26, ptr noundef nonnull byval(%class.Array.2) align 8 %27)
  %28 = getelementptr inbounds i8, ptr %1, i64 224
  %29 = load i8, ptr %28, align 8, !tbaa !29, !range !26, !noundef !27
  %30 = getelementptr inbounds i8, ptr %0, i64 288
  store i8 %29, ptr %30, align 8, !tbaa !30
  %31 = getelementptr inbounds i8, ptr %1, i64 225
  %32 = load i8, ptr %31, align 1, !tbaa !31, !range !26, !noundef !27
  %33 = getelementptr inbounds i8, ptr %0, i64 289
  store i8 %32, ptr %33, align 1, !tbaa !32
  %34 = getelementptr inbounds i8, ptr %1, i64 232
  %35 = getelementptr inbounds i8, ptr %0, i64 296
  %36 = load <2 x i64>, ptr %34, align 8, !tbaa !22
  store <2 x i64> %36, ptr %35, align 8, !tbaa !22
  ret void
}

; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: readwrite)
declare ptr @strcpy(ptr noalias noundef returned writeonly, ptr noalias nocapture noundef readonly) local_unnamed_addr #1

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN5ArrayIP7Item_noE4copyES2_(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef byval(%class.Array.2) align 8) 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" }
attributes #1 = { mustprogress nofree nounwind willreturn memory(argmem: readwrite) "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, !13, i64 112}
!6 = !{!"_ZTS9TPCCQuery", !7, i64 0, !13, i64 112, !8, i64 120, !8, i64 128, !8, i64 136, !8, i64 144, !8, i64 152, !8, i64 160, !9, i64 168, !14, i64 184, !15, i64 192, !16, i64 200, !15, i64 224, !15, i64 225, !8, i64 232, !8, i64 240, !8, i64 248, !8, i64 256, !8, i64 264, !8, i64 272, !8, i64 280, !8, i64 288, !8, i64 296, !8, i64 304, !8, i64 312}
!7 = !{!"_ZTS9BaseQuery", !8, i64 8, !11, i64 16, !11, i64 40, !11, i64 64, !11, i64 88}
!8 = !{!"long", !9, i64 0}
!9 = !{!"omnipotent char", !10, i64 0}
!10 = !{!"Simple C++ TBAA"}
!11 = !{!"_ZTS5ArrayImE", !12, i64 0, !8, i64 8, !8, i64 16}
!12 = !{!"any pointer", !9, i64 0}
!13 = !{!"_ZTS11TPCCTxnType", !9, i64 0}
!14 = !{!"double", !9, i64 0}
!15 = !{!"bool", !9, i64 0}
!16 = !{!"_ZTS5ArrayIP7Item_noE", !12, i64 0, !8, i64 8, !8, i64 16}
!17 = !{!18, !8, i64 176}
!18 = !{!"_ZTS22TPCCClientQueryMessage", !19, i64 0, !8, i64 176, !8, i64 184, !8, i64 192, !8, i64 200, !8, i64 208, !8, i64 216, !8, i64 224, !9, i64 232, !8, i64 248, !15, i64 256, !16, i64 264, !15, i64 288, !15, i64 289, !8, i64 296, !8, i64 304}
!19 = !{!"_ZTS18ClientQueryMessage", !20, i64 0, !8, i64 120, !8, i64 128, !8, i64 136, !8, i64 144, !11, i64 152}
!20 = !{!"_ZTS7Message", !21, i64 8, !8, i64 16, !8, i64 24, !8, i64 32, !8, i64 40, !8, i64 48, !8, i64 56, !14, i64 64, !14, i64 72, !14, i64 80, !14, i64 88, !14, i64 96, !14, i64 104, !14, i64 112}
!21 = !{!"_ZTS10RemReqType", !9, i64 0}
!22 = !{!8, !8, i64 0}
!23 = !{!6, !14, i64 184}
!24 = !{!18, !8, i64 248}
!25 = !{!6, !15, i64 192}
!26 = !{i8 0, i8 2}
!27 = !{}
!28 = !{!18, !15, i64 256}
!29 = !{!6, !15, i64 224}
!30 = !{!18, !15, i64 288}
!31 = !{!6, !15, i64 225}
!32 = !{!18, !15, i64 289}


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