; LLVM IR from mitdbg/deneva :: system/logger.ll (ZN9LogRecord10copyRecordEPS_)

; 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.LogRecord = type <{ %struct.AriesLogRecord, i8, [7 x i8] }>
%struct.AriesLogRecord = type { i32, i64, i32, i32, i64, i32, i64 }

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN14AriesLogRecord4initEv(ptr noundef nonnull align 8 dereferenceable(48)) #0 align 2

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN9LogRecord10copyRecordEPS_(ptr noundef nonnull align 8 dereferenceable(49) %0, ptr noundef %1) #1 align 2 {
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  store ptr %0, ptr %3, align 8, !tbaa !5
  store ptr %1, ptr %4, align 8, !tbaa !5
  %5 = load ptr, ptr %3, align 8
  %6 = getelementptr inbounds %class.LogRecord, ptr %5, i32 0, i32 0
  call void @_ZN14AriesLogRecord4initEv(ptr noundef nonnull align 8 dereferenceable(48) %6)
  %7 = load ptr, ptr %4, align 8, !tbaa !5
  %8 = getelementptr inbounds %class.LogRecord, ptr %7, i32 0, i32 0
  %9 = getelementptr inbounds %struct.AriesLogRecord, ptr %8, i32 0, i32 1
  %10 = load i64, ptr %9, align 8, !tbaa !9
  %11 = getelementptr inbounds %class.LogRecord, ptr %5, i32 0, i32 0
  %12 = getelementptr inbounds %struct.AriesLogRecord, ptr %11, i32 0, i32 1
  store i64 %10, ptr %12, align 8, !tbaa !9
  %13 = load ptr, ptr %4, align 8, !tbaa !5
  %14 = getelementptr inbounds %class.LogRecord, ptr %13, i32 0, i32 0
  %15 = getelementptr inbounds %struct.AriesLogRecord, ptr %14, i32 0, i32 3
  %16 = load i32, ptr %15, align 4, !tbaa !17
  %17 = getelementptr inbounds %class.LogRecord, ptr %5, i32 0, i32 0
  %18 = getelementptr inbounds %struct.AriesLogRecord, ptr %17, i32 0, i32 3
  store i32 %16, ptr %18, align 4, !tbaa !17
  %19 = load ptr, ptr %4, align 8, !tbaa !5
  %20 = getelementptr inbounds %class.LogRecord, ptr %19, i32 0, i32 0
  %21 = getelementptr inbounds %struct.AriesLogRecord, ptr %20, i32 0, i32 2
  %22 = load i32, ptr %21, align 8, !tbaa !18
  %23 = getelementptr inbounds %class.LogRecord, ptr %5, i32 0, i32 0
  %24 = getelementptr inbounds %struct.AriesLogRecord, ptr %23, i32 0, i32 2
  store i32 %22, ptr %24, align 8, !tbaa !18
  %25 = load ptr, ptr %4, align 8, !tbaa !5
  %26 = getelementptr inbounds %class.LogRecord, ptr %25, i32 0, i32 0
  %27 = getelementptr inbounds %struct.AriesLogRecord, ptr %26, i32 0, i32 4
  %28 = load i64, ptr %27, align 8, !tbaa !19
  %29 = getelementptr inbounds %class.LogRecord, ptr %5, i32 0, i32 0
  %30 = getelementptr inbounds %struct.AriesLogRecord, ptr %29, i32 0, i32 4
  store i64 %28, ptr %30, align 8, !tbaa !19
  %31 = load ptr, ptr %4, align 8, !tbaa !5
  %32 = getelementptr inbounds %class.LogRecord, ptr %31, i32 0, i32 0
  %33 = getelementptr inbounds %struct.AriesLogRecord, ptr %32, i32 0, i32 5
  %34 = load i32, ptr %33, align 8, !tbaa !20
  %35 = getelementptr inbounds %class.LogRecord, ptr %5, i32 0, i32 0
  %36 = getelementptr inbounds %struct.AriesLogRecord, ptr %35, i32 0, i32 5
  store i32 %34, ptr %36, align 8, !tbaa !20
  %37 = load ptr, ptr %4, align 8, !tbaa !5
  %38 = getelementptr inbounds %class.LogRecord, ptr %37, i32 0, i32 0
  %39 = getelementptr inbounds %struct.AriesLogRecord, ptr %38, i32 0, i32 6
  %40 = load i64, ptr %39, align 8, !tbaa !21
  %41 = getelementptr inbounds %class.LogRecord, ptr %5, i32 0, i32 0
  %42 = getelementptr inbounds %struct.AriesLogRecord, ptr %41, i32 0, i32 6
  store i64 %40, ptr %42, align 8, !tbaa !21
  ret void
}

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 = { 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 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !13, i64 8}
!10 = !{!"_ZTS9LogRecord", !11, i64 0, !16, i64 48}
!11 = !{!"_ZTS14AriesLogRecord", !12, i64 0, !13, i64 8, !14, i64 16, !15, i64 20, !13, i64 24, !12, i64 32, !13, i64 40}
!12 = !{!"int", !7, i64 0}
!13 = !{!"long", !7, i64 0}
!14 = !{!"_ZTS10LogRecType", !7, i64 0}
!15 = !{!"_ZTS6LogIUD", !7, i64 0}
!16 = !{!"bool", !7, i64 0}
!17 = !{!10, !15, i64 20}
!18 = !{!10, !14, i64 16}
!19 = !{!10, !13, i64 24}
!20 = !{!10, !12, i64 32}
!21 = !{!10, !13, i64 40}


; 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 nounwind uwtable
declare dso_local void @_ZN14AriesLogRecord4initEv(ptr noundef nonnull align 8 dereferenceable(48)) local_unnamed_addr #0 align 2

; Function Attrs: mustprogress nounwind uwtable
define dso_local void @_ZN9LogRecord10copyRecordEPS_(ptr noundef nonnull align 8 dereferenceable(49) %0, ptr nocapture noundef readonly %1) local_unnamed_addr #0 align 2 {
  tail call void @_ZN14AriesLogRecord4initEv(ptr noundef nonnull align 8 dereferenceable(48) %0)
  %3 = getelementptr inbounds i8, ptr %1, i64 8
  %4 = load i64, ptr %3, align 8, !tbaa !5
  %5 = getelementptr inbounds i8, ptr %0, i64 8
  store i64 %4, ptr %5, align 8, !tbaa !5
  %6 = getelementptr inbounds i8, ptr %1, i64 16
  %7 = getelementptr inbounds i8, ptr %0, i64 16
  %8 = load <2 x i32>, ptr %6, align 8, !tbaa !15
  store <2 x i32> %8, ptr %7, align 8, !tbaa !15
  %9 = getelementptr inbounds i8, ptr %1, i64 24
  %10 = load i64, ptr %9, align 8, !tbaa !16
  %11 = getelementptr inbounds i8, ptr %0, i64 24
  store i64 %10, ptr %11, align 8, !tbaa !16
  %12 = getelementptr inbounds i8, ptr %1, i64 32
  %13 = load i32, ptr %12, align 8, !tbaa !17
  %14 = getelementptr inbounds i8, ptr %0, i64 32
  store i32 %13, ptr %14, align 8, !tbaa !17
  %15 = getelementptr inbounds i8, ptr %1, i64 40
  %16 = load i64, ptr %15, align 8, !tbaa !18
  %17 = getelementptr inbounds i8, ptr %0, i64 40
  store i64 %16, ptr %17, align 8, !tbaa !18
  ret void
}

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

!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, !11, i64 8}
!6 = !{!"_ZTS9LogRecord", !7, i64 0, !14, i64 48}
!7 = !{!"_ZTS14AriesLogRecord", !8, i64 0, !11, i64 8, !12, i64 16, !13, i64 20, !11, i64 24, !8, i64 32, !11, i64 40}
!8 = !{!"int", !9, i64 0}
!9 = !{!"omnipotent char", !10, i64 0}
!10 = !{!"Simple C++ TBAA"}
!11 = !{!"long", !9, i64 0}
!12 = !{!"_ZTS10LogRecType", !9, i64 0}
!13 = !{!"_ZTS6LogIUD", !9, i64 0}
!14 = !{!"bool", !9, i64 0}
!15 = !{!9, !9, i64 0}
!16 = !{!6, !11, i64 24}
!17 = !{!6, !8, i64 32}
!18 = !{!6, !11, i64 40}


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