; LLVM IR from achilles288/robot-monitor-graphics :: src/base/cube.ll (ZNK3rmg6Cube3D12getDimensionEv)

; 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.rmg::Vec3" = type { %union.anon.0 }
%union.anon.0 = type { %struct.anon }
%struct.anon = type { float, float, float }
%"class.rmg::Cube3D" = type <{ %"class.rmg::Object3D", float, float, float, [4 x i8] }>
%"class.rmg::Object3D" = type { %"class.rmg::Object", %"struct.rmg::Mat4", %"struct.rmg::Vec3", ptr, float, float, float, ptr, ptr, %"class.rmg::internal::Pending", ptr, ptr, %"class.rmg::internal::Pending" }
%"class.rmg::Object" = type { ptr, i64, ptr, %"struct.rmg::ColorRGBA", i8, i32 }
%"struct.rmg::ColorRGBA" = type { float, float, float, float }
%"struct.rmg::Mat4" = type { %union.anon }
%union.anon = type { [4 x [4 x float]] }
%"class.rmg::internal::Pending" = type { ptr, ptr }

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZN3rmg4Vec3C2Efff(ptr noundef nonnull align 4 dereferenceable(12), float noundef, float noundef, float noundef) unnamed_addr #0 align 2

; 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: mustprogress uwtable
define dso_local { <2 x float>, float } @_ZNK3rmg6Cube3D12getDimensionEv(ptr noundef nonnull align 8 dereferenceable(228) %0) #2 align 2 {
  %2 = alloca %"struct.rmg::Vec3", align 4
  %3 = alloca ptr, align 8
  %4 = alloca { <2 x float>, float }, align 8
  store ptr %0, ptr %3, align 8, !tbaa !5
  %5 = load ptr, ptr %3, align 8
  %6 = getelementptr inbounds %"class.rmg::Cube3D", ptr %5, i32 0, i32 1
  %7 = load float, ptr %6, align 8, !tbaa !9
  %8 = getelementptr inbounds %"class.rmg::Cube3D", ptr %5, i32 0, i32 2
  %9 = load float, ptr %8, align 4, !tbaa !21
  %10 = getelementptr inbounds %"class.rmg::Cube3D", ptr %5, i32 0, i32 3
  %11 = load float, ptr %10, align 8, !tbaa !22
  call void @_ZN3rmg4Vec3C2Efff(ptr noundef nonnull align 4 dereferenceable(12) %2, float noundef %7, float noundef %9, float noundef %11)
  %12 = getelementptr inbounds %"struct.rmg::Vec3", ptr %2, i32 0, i32 0
  %13 = getelementptr inbounds %union.anon.0, ptr %12, i32 0, i32 0
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %4, ptr align 4 %13, i64 12, i1 false)
  %14 = load { <2 x float>, float }, ptr %4, align 8
  ret { <2 x float>, float } %14
}

attributes #0 = { 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 #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" }

!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, !15, i64 216}
!10 = !{!"_ZTSN3rmg6Cube3DE", !11, i64 0, !15, i64 216, !15, i64 220, !15, i64 224}
!11 = !{!"_ZTSN3rmg8Object3DE", !12, i64 0, !18, i64 48, !19, i64 112, !6, i64 128, !15, i64 136, !15, i64 140, !15, i64 144, !6, i64 152, !6, i64 160, !20, i64 168, !6, i64 184, !6, i64 192, !20, i64 200}
!12 = !{!"_ZTSN3rmg6ObjectE", !13, i64 8, !6, i64 16, !14, i64 24, !16, i64 40, !17, i64 44}
!13 = !{!"long", !7, i64 0}
!14 = !{!"_ZTSN3rmg9ColorRGBAE", !15, i64 0, !15, i64 4, !15, i64 8, !15, i64 12}
!15 = !{!"float", !7, i64 0}
!16 = !{!"bool", !7, i64 0}
!17 = !{!"_ZTSN3rmg10ObjectTypeE", !7, i64 0}
!18 = !{!"_ZTSN3rmg4Mat4E", !7, i64 0}
!19 = !{!"_ZTSN3rmg4Vec3E", !7, i64 0}
!20 = !{!"_ZTSN3rmg8internal7PendingE", !6, i64 0, !6, i64 8}
!21 = !{!10, !15, i64 220}
!22 = !{!10, !15, i64 224}


; 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.rmg::Vec3" = type { %union.anon.0 }
%union.anon.0 = type { %struct.anon }
%struct.anon = type { float, float, float }

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZN3rmg4Vec3C2Efff(ptr noundef nonnull align 4 dereferenceable(12), float noundef, float noundef, float noundef) unnamed_addr #0 align 2

; Function Attrs: mustprogress nounwind uwtable
define dso_local { <2 x float>, float } @_ZNK3rmg6Cube3D12getDimensionEv(ptr nocapture noundef nonnull readonly align 8 dereferenceable(228) %0) local_unnamed_addr #1 align 2 {
  %2 = alloca %"struct.rmg::Vec3", align 8
  %3 = getelementptr inbounds i8, ptr %0, i64 216
  %4 = load float, ptr %3, align 8, !tbaa !5
  %5 = getelementptr inbounds i8, ptr %0, i64 220
  %6 = load float, ptr %5, align 4, !tbaa !20
  %7 = getelementptr inbounds i8, ptr %0, i64 224
  %8 = load float, ptr %7, align 8, !tbaa !21
  call void @_ZN3rmg4Vec3C2Efff(ptr noundef nonnull align 4 dereferenceable(12) %2, float noundef %4, float noundef %6, float noundef %8)
  %.sroa.0.0.copyload = load <2 x float>, ptr %2, align 8
  %.sroa.2.0..sroa_idx = getelementptr inbounds i8, ptr %2, i64 8
  %.sroa.2.0.copyload = load float, ptr %.sroa.2.0..sroa_idx, align 8
  %.fca.0.insert = insertvalue { <2 x float>, float } poison, <2 x float> %.sroa.0.0.copyload, 0
  %.fca.1.insert = insertvalue { <2 x float>, float } %.fca.0.insert, float %.sroa.2.0.copyload, 1
  ret { <2 x float>, float } %.fca.1.insert
}

attributes #0 = { 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 #1 = { 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, !14, i64 216}
!6 = !{!"_ZTSN3rmg6Cube3DE", !7, i64 0, !14, i64 216, !14, i64 220, !14, i64 224}
!7 = !{!"_ZTSN3rmg8Object3DE", !8, i64 0, !17, i64 48, !18, i64 112, !12, i64 128, !14, i64 136, !14, i64 140, !14, i64 144, !12, i64 152, !12, i64 160, !19, i64 168, !12, i64 184, !12, i64 192, !19, i64 200}
!8 = !{!"_ZTSN3rmg6ObjectE", !9, i64 8, !12, i64 16, !13, i64 24, !15, i64 40, !16, i64 44}
!9 = !{!"long", !10, i64 0}
!10 = !{!"omnipotent char", !11, i64 0}
!11 = !{!"Simple C++ TBAA"}
!12 = !{!"any pointer", !10, i64 0}
!13 = !{!"_ZTSN3rmg9ColorRGBAE", !14, i64 0, !14, i64 4, !14, i64 8, !14, i64 12}
!14 = !{!"float", !10, i64 0}
!15 = !{!"bool", !10, i64 0}
!16 = !{!"_ZTSN3rmg10ObjectTypeE", !10, i64 0}
!17 = !{!"_ZTSN3rmg4Mat4E", !10, i64 0}
!18 = !{!"_ZTSN3rmg4Vec3E", !10, i64 0}
!19 = !{!"_ZTSN3rmg8internal7PendingE", !12, i64 0, !12, i64 8}
!20 = !{!6, !14, i64 220}
!21 = !{!6, !14, i64 224}


; Effective O3 passes: EarlyCSEPass,GlobalOptPass,InferAlignmentPass,InferFunctionAttrsPass,InstCombinePass,PostOrderFunctionAttrsPass,SROAPass