; LLVM IR from Pi-Man/PiE :: source/Camera.ll (ZN3PiE6CameraC2EP10SDL_Window)

; 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.PiE::Camera" = type { ptr, %"class.std::mutex", %"struct.PiE::Matrix", %"struct.PiE::Matrix", %"struct.PiE::Matrix", %"struct.PiE::Matrix", ptr, i8, float, float, float }
%"class.std::mutex" = type { %"class.std::__mutex_base" }
%"class.std::__mutex_base" = type { %union.pthread_mutex_t }
%union.pthread_mutex_t = type { %struct.__pthread_mutex_s }
%struct.__pthread_mutex_s = type { i32, i32, i32, i32, i32, i16, i16, %struct.__pthread_internal_list }
%struct.__pthread_internal_list = type { ptr, ptr }
%"struct.PiE::Matrix" = type { %"struct.std::array" }
%"struct.std::array" = type { [16 x float] }

@_ZTVN3PiE6CameraE = external dso_local unnamed_addr constant { [6 x ptr] }, align 8

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN3PiE6CameraC2EP10SDL_Window(ptr noundef nonnull align 8 dereferenceable(328) %0, ptr noundef %1) unnamed_addr #0 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
  store ptr getelementptr inbounds inrange(-16, 32) ({ [6 x ptr] }, ptr @_ZTVN3PiE6CameraE, i32 0, i32 0, i32 2), ptr %5, align 8, !tbaa !9
  %6 = getelementptr inbounds %"struct.PiE::Camera", ptr %5, i32 0, i32 1
  call void @_ZNSt5mutexC2Ev(ptr noundef nonnull align 8 dereferenceable(40) %6) #2
  %7 = getelementptr inbounds %"struct.PiE::Camera", ptr %5, i32 0, i32 2
  call void @_ZN3PiE6MatrixIfLi4ELi4EE8IdentityEv(ptr dead_on_unwind writable sret(%"struct.PiE::Matrix") align 4 %7)
  %8 = getelementptr inbounds %"struct.PiE::Camera", ptr %5, i32 0, i32 3
  call void @_ZN3PiE6MatrixIfLi4ELi4EEC2Ev(ptr noundef nonnull align 4 dereferenceable(64) %8)
  %9 = getelementptr inbounds %"struct.PiE::Camera", ptr %5, i32 0, i32 4
  call void @_ZN3PiE6MatrixIfLi4ELi4EEC2Ev(ptr noundef nonnull align 4 dereferenceable(64) %9)
  %10 = getelementptr inbounds %"struct.PiE::Camera", ptr %5, i32 0, i32 5
  call void @_ZN3PiE6MatrixIfLi4ELi4EEC2Ev(ptr noundef nonnull align 4 dereferenceable(64) %10)
  %11 = getelementptr inbounds %"struct.PiE::Camera", ptr %5, i32 0, i32 6
  %12 = load ptr, ptr %4, align 8, !tbaa !5
  store ptr %12, ptr %11, align 8, !tbaa !11
  %13 = getelementptr inbounds %"struct.PiE::Camera", ptr %5, i32 0, i32 7
  store i8 0, ptr %13, align 8, !tbaa !19
  %14 = getelementptr inbounds %"struct.PiE::Camera", ptr %5, i32 0, i32 8
  store float 1.250000e-01, ptr %14, align 4, !tbaa !20
  %15 = getelementptr inbounds %"struct.PiE::Camera", ptr %5, i32 0, i32 9
  store float 2.560000e+02, ptr %15, align 8, !tbaa !21
  %16 = getelementptr inbounds %"struct.PiE::Camera", ptr %5, i32 0, i32 10
  store float 1.000000e+00, ptr %16, align 4, !tbaa !22
  ret void
}

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt5mutexC2Ev(ptr noundef nonnull align 8 dereferenceable(40)) unnamed_addr #1 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN3PiE6MatrixIfLi4ELi4EE8IdentityEv(ptr dead_on_unwind noalias writable sret(%"struct.PiE::Matrix") align 4) #0 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN3PiE6MatrixIfLi4ELi4EEC2Ev(ptr noundef nonnull align 4 dereferenceable(64)) unnamed_addr #1 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 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, !10, i64 0}
!10 = !{!"vtable pointer", !8, i64 0}
!11 = !{!12, !6, i64 304}
!12 = !{!"_ZTSN3PiE6CameraE", !13, i64 8, !15, i64 48, !15, i64 112, !15, i64 176, !15, i64 240, !6, i64 304, !17, i64 312, !18, i64 316, !18, i64 320, !18, i64 324}
!13 = !{!"_ZTSSt5mutex", !14, i64 0}
!14 = !{!"_ZTSSt12__mutex_base", !7, i64 0}
!15 = !{!"_ZTSN3PiE6MatrixIfLi4ELi4EEE", !16, i64 0}
!16 = !{!"_ZTSSt5arrayIfLm16EE", !7, i64 0}
!17 = !{!"bool", !7, i64 0}
!18 = !{!"float", !7, i64 0}
!19 = !{!12, !17, i64 312}
!20 = !{!12, !18, i64 316}
!21 = !{!12, !18, i64 320}
!22 = !{!12, !18, i64 324}


; 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.PiE::Matrix" = type { %"struct.std::array" }
%"struct.std::array" = type { [16 x float] }

@_ZTVN3PiE6CameraE = external dso_local unnamed_addr constant { [6 x ptr] }, align 8

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN3PiE6CameraC2EP10SDL_Window(ptr noundef nonnull align 8 dereferenceable(328) %0, ptr noundef %1) unnamed_addr #0 align 2 {
  store ptr getelementptr inbounds inrange(-16, 32) (i8, ptr @_ZTVN3PiE6CameraE, i64 16), ptr %0, align 8, !tbaa !5
  %3 = getelementptr inbounds i8, ptr %0, i64 8
  tail call void @_ZNSt5mutexC2Ev(ptr noundef nonnull align 8 dereferenceable(40) %3) #2
  %4 = getelementptr inbounds i8, ptr %0, i64 48
  tail call void @_ZN3PiE6MatrixIfLi4ELi4EE8IdentityEv(ptr dead_on_unwind nonnull writable sret(%"struct.PiE::Matrix") align 4 %4)
  %5 = getelementptr inbounds i8, ptr %0, i64 112
  tail call void @_ZN3PiE6MatrixIfLi4ELi4EEC2Ev(ptr noundef nonnull align 4 dereferenceable(64) %5)
  %6 = getelementptr inbounds i8, ptr %0, i64 176
  tail call void @_ZN3PiE6MatrixIfLi4ELi4EEC2Ev(ptr noundef nonnull align 4 dereferenceable(64) %6)
  %7 = getelementptr inbounds i8, ptr %0, i64 240
  tail call void @_ZN3PiE6MatrixIfLi4ELi4EEC2Ev(ptr noundef nonnull align 4 dereferenceable(64) %7)
  %8 = getelementptr inbounds i8, ptr %0, i64 304
  store ptr %1, ptr %8, align 8, !tbaa !8
  %9 = getelementptr inbounds i8, ptr %0, i64 312
  store i8 0, ptr %9, align 8, !tbaa !18
  %10 = getelementptr inbounds i8, ptr %0, i64 316
  store <2 x float> <float 1.250000e-01, float 2.560000e+02>, ptr %10, align 4, !tbaa !19
  %11 = getelementptr inbounds i8, ptr %0, i64 324
  store float 1.000000e+00, ptr %11, align 4, !tbaa !20
  ret void
}

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt5mutexC2Ev(ptr noundef nonnull align 8 dereferenceable(40)) unnamed_addr #1 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN3PiE6MatrixIfLi4ELi4EE8IdentityEv(ptr dead_on_unwind noalias writable sret(%"struct.PiE::Matrix") align 4) local_unnamed_addr #0 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN3PiE6MatrixIfLi4ELi4EEC2Ev(ptr noundef nonnull align 4 dereferenceable(64)) unnamed_addr #1 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 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 = !{!"vtable pointer", !7, i64 0}
!7 = !{!"Simple C++ TBAA"}
!8 = !{!9, !15, i64 304}
!9 = !{!"_ZTSN3PiE6CameraE", !10, i64 8, !13, i64 48, !13, i64 112, !13, i64 176, !13, i64 240, !15, i64 304, !16, i64 312, !17, i64 316, !17, i64 320, !17, i64 324}
!10 = !{!"_ZTSSt5mutex", !11, i64 0}
!11 = !{!"_ZTSSt12__mutex_base", !12, i64 0}
!12 = !{!"omnipotent char", !7, i64 0}
!13 = !{!"_ZTSN3PiE6MatrixIfLi4ELi4EEE", !14, i64 0}
!14 = !{!"_ZTSSt5arrayIfLm16EE", !12, i64 0}
!15 = !{!"any pointer", !12, i64 0}
!16 = !{!"bool", !12, i64 0}
!17 = !{!"float", !12, i64 0}
!18 = !{!9, !16, i64 312}
!19 = !{!17, !17, i64 0}
!20 = !{!9, !17, i64 324}


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