; LLVM IR from aap/librw :: tools/subrast/subrast.ll (Z18PositionSubCamerasv)

; 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.rw::V3d" = type { float, float, float }

@SubCameras = external dso_local global [4 x ptr], align 16
@Yaxis = external global %"struct.rw::V3d", align 4
@Xaxis = external global %"struct.rw::V3d", align 4

; 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
define dso_local void @_Z18PositionSubCamerasv() #1 {
  %1 = alloca ptr, align 8
  %2 = alloca %"struct.rw::V3d", align 4
  %3 = alloca float, align 4
  call void @llvm.lifetime.start.p0(i64 8, ptr %1) #4
  call void @llvm.lifetime.start.p0(i64 12, ptr %2) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #4
  store float 2.500000e+00, ptr %3, align 4, !tbaa !5
  %4 = getelementptr inbounds %"struct.rw::V3d", ptr %2, i32 0, i32 1
  store float 0.000000e+00, ptr %4, align 4, !tbaa !9
  %5 = getelementptr inbounds %"struct.rw::V3d", ptr %2, i32 0, i32 0
  store float 0.000000e+00, ptr %5, align 4, !tbaa !11
  %6 = getelementptr inbounds %"struct.rw::V3d", ptr %2, i32 0, i32 2
  store float -4.000000e+00, ptr %6, align 4, !tbaa !12
  %7 = load ptr, ptr @SubCameras, align 16, !tbaa !13
  %8 = call noundef ptr @_ZNK2rw6Camera8getFrameEv(ptr noundef nonnull align 8 dereferenceable(600) %7)
  store ptr %8, ptr %1, align 8, !tbaa !13
  %9 = load ptr, ptr %1, align 8, !tbaa !13
  call void @_ZN2rw5Frame9translateEPKNS_3V3dENS_9CombineOpE(ptr noundef nonnull align 8 dereferenceable(200) %9, ptr noundef %2, i32 noundef 0)
  %10 = getelementptr inbounds %"struct.rw::V3d", ptr %2, i32 0, i32 1
  store float 0.000000e+00, ptr %10, align 4, !tbaa !9
  %11 = getelementptr inbounds %"struct.rw::V3d", ptr %2, i32 0, i32 0
  store float 0.000000e+00, ptr %11, align 4, !tbaa !11
  %12 = getelementptr inbounds %"struct.rw::V3d", ptr %2, i32 0, i32 2
  store float -2.500000e+00, ptr %12, align 4, !tbaa !12
  %13 = load ptr, ptr getelementptr inbounds ([4 x ptr], ptr @SubCameras, i64 0, i64 1), align 8, !tbaa !13
  %14 = call noundef ptr @_ZNK2rw6Camera8getFrameEv(ptr noundef nonnull align 8 dereferenceable(600) %13)
  store ptr %14, ptr %1, align 8, !tbaa !13
  %15 = load ptr, ptr %1, align 8, !tbaa !13
  call void @_ZN2rw5Frame9translateEPKNS_3V3dENS_9CombineOpE(ptr noundef nonnull align 8 dereferenceable(200) %15, ptr noundef %2, i32 noundef 0)
  %16 = getelementptr inbounds %"struct.rw::V3d", ptr %2, i32 0, i32 0
  store float -2.500000e+00, ptr %16, align 4, !tbaa !11
  %17 = getelementptr inbounds %"struct.rw::V3d", ptr %2, i32 0, i32 2
  store float 0.000000e+00, ptr %17, align 4, !tbaa !12
  %18 = getelementptr inbounds %"struct.rw::V3d", ptr %2, i32 0, i32 1
  store float 0.000000e+00, ptr %18, align 4, !tbaa !9
  %19 = load ptr, ptr getelementptr inbounds ([4 x ptr], ptr @SubCameras, i64 0, i64 2), align 16, !tbaa !13
  %20 = call noundef ptr @_ZNK2rw6Camera8getFrameEv(ptr noundef nonnull align 8 dereferenceable(600) %19)
  store ptr %20, ptr %1, align 8, !tbaa !13
  %21 = load ptr, ptr %1, align 8, !tbaa !13
  call void @_ZN2rw5Frame6rotateEPKNS_3V3dEfNS_9CombineOpE(ptr noundef nonnull align 8 dereferenceable(200) %21, ptr noundef @Yaxis, float noundef 9.000000e+01, i32 noundef 0)
  %22 = load ptr, ptr %1, align 8, !tbaa !13
  call void @_ZN2rw5Frame9translateEPKNS_3V3dENS_9CombineOpE(ptr noundef nonnull align 8 dereferenceable(200) %22, ptr noundef %2, i32 noundef 2)
  %23 = getelementptr inbounds %"struct.rw::V3d", ptr %2, i32 0, i32 2
  store float 0.000000e+00, ptr %23, align 4, !tbaa !12
  %24 = getelementptr inbounds %"struct.rw::V3d", ptr %2, i32 0, i32 0
  store float 0.000000e+00, ptr %24, align 4, !tbaa !11
  %25 = getelementptr inbounds %"struct.rw::V3d", ptr %2, i32 0, i32 1
  store float -2.500000e+00, ptr %25, align 4, !tbaa !9
  %26 = load ptr, ptr getelementptr inbounds ([4 x ptr], ptr @SubCameras, i64 0, i64 3), align 8, !tbaa !13
  %27 = call noundef ptr @_ZNK2rw6Camera8getFrameEv(ptr noundef nonnull align 8 dereferenceable(600) %26)
  store ptr %27, ptr %1, align 8, !tbaa !13
  %28 = load ptr, ptr %1, align 8, !tbaa !13
  call void @_ZN2rw5Frame6rotateEPKNS_3V3dEfNS_9CombineOpE(ptr noundef nonnull align 8 dereferenceable(200) %28, ptr noundef @Xaxis, float noundef -9.000000e+01, i32 noundef 0)
  %29 = load ptr, ptr %1, align 8, !tbaa !13
  call void @_ZN2rw5Frame9translateEPKNS_3V3dENS_9CombineOpE(ptr noundef nonnull align 8 dereferenceable(200) %29, ptr noundef %2, i32 noundef 2)
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #4
  call void @llvm.lifetime.end.p0(i64 12, ptr %2) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %1) #4
  ret void
}

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef ptr @_ZNK2rw6Camera8getFrameEv(ptr noundef nonnull align 8 dereferenceable(600)) #2 align 2

declare void @_ZN2rw5Frame9translateEPKNS_3V3dENS_9CombineOpE(ptr noundef nonnull align 8 dereferenceable(200), ptr noundef, i32 noundef) #3

declare void @_ZN2rw5Frame6rotateEPKNS_3V3dEfNS_9CombineOpE(ptr noundef nonnull align 8 dereferenceable(200), ptr noundef, float noundef, i32 noundef) #3

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 = { 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 #3 = { "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 = !{!"float", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !6, i64 4}
!10 = !{!"_ZTSN2rw3V3dE", !6, i64 0, !6, i64 4, !6, i64 8}
!11 = !{!10, !6, i64 0}
!12 = !{!10, !6, i64 8}
!13 = !{!14, !14, i64 0}
!14 = !{!"any pointer", !7, i64 0}


; 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.rw::V3d" = type { float, float, float }

@SubCameras = external dso_local local_unnamed_addr global [4 x ptr], align 16
@Yaxis = external global %"struct.rw::V3d", align 4
@Xaxis = external global %"struct.rw::V3d", align 4

; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #0

; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #0

; Function Attrs: mustprogress uwtable
define dso_local void @_Z18PositionSubCamerasv() local_unnamed_addr #1 {
  %1 = alloca %"struct.rw::V3d", align 8
  call void @llvm.lifetime.start.p0(i64 12, ptr nonnull %1) #4
  %2 = getelementptr inbounds i8, ptr %1, i64 4
  store <2 x float> zeroinitializer, ptr %1, align 8, !tbaa !5
  %3 = getelementptr inbounds i8, ptr %1, i64 8
  store float -4.000000e+00, ptr %3, align 8, !tbaa !9
  %4 = load ptr, ptr @SubCameras, align 16, !tbaa !11
  %5 = tail call noundef ptr @_ZNK2rw6Camera8getFrameEv(ptr noundef nonnull align 8 dereferenceable(600) %4)
  call void @_ZN2rw5Frame9translateEPKNS_3V3dENS_9CombineOpE(ptr noundef nonnull align 8 dereferenceable(200) %5, ptr noundef nonnull %1, i32 noundef 0)
  store <2 x float> zeroinitializer, ptr %1, align 8, !tbaa !5
  store float -2.500000e+00, ptr %3, align 8, !tbaa !9
  %6 = load ptr, ptr getelementptr inbounds (i8, ptr @SubCameras, i64 8), align 8, !tbaa !11
  %7 = call noundef ptr @_ZNK2rw6Camera8getFrameEv(ptr noundef nonnull align 8 dereferenceable(600) %6)
  call void @_ZN2rw5Frame9translateEPKNS_3V3dENS_9CombineOpE(ptr noundef nonnull align 8 dereferenceable(200) %7, ptr noundef nonnull %1, i32 noundef 0)
  store float -2.500000e+00, ptr %1, align 8, !tbaa !13
  store float 0.000000e+00, ptr %3, align 8, !tbaa !9
  store float 0.000000e+00, ptr %2, align 4, !tbaa !14
  %8 = load ptr, ptr getelementptr inbounds (i8, ptr @SubCameras, i64 16), align 16, !tbaa !11
  %9 = call noundef ptr @_ZNK2rw6Camera8getFrameEv(ptr noundef nonnull align 8 dereferenceable(600) %8)
  call void @_ZN2rw5Frame6rotateEPKNS_3V3dEfNS_9CombineOpE(ptr noundef nonnull align 8 dereferenceable(200) %9, ptr noundef nonnull @Yaxis, float noundef 9.000000e+01, i32 noundef 0)
  call void @_ZN2rw5Frame9translateEPKNS_3V3dENS_9CombineOpE(ptr noundef nonnull align 8 dereferenceable(200) %9, ptr noundef nonnull %1, i32 noundef 2)
  store float 0.000000e+00, ptr %3, align 8, !tbaa !9
  store <2 x float> <float 0.000000e+00, float -2.500000e+00>, ptr %1, align 8, !tbaa !5
  %10 = load ptr, ptr getelementptr inbounds (i8, ptr @SubCameras, i64 24), align 8, !tbaa !11
  %11 = call noundef ptr @_ZNK2rw6Camera8getFrameEv(ptr noundef nonnull align 8 dereferenceable(600) %10)
  call void @_ZN2rw5Frame6rotateEPKNS_3V3dEfNS_9CombineOpE(ptr noundef nonnull align 8 dereferenceable(200) %11, ptr noundef nonnull @Xaxis, float noundef -9.000000e+01, i32 noundef 0)
  call void @_ZN2rw5Frame9translateEPKNS_3V3dENS_9CombineOpE(ptr noundef nonnull align 8 dereferenceable(200) %11, ptr noundef nonnull %1, i32 noundef 2)
  call void @llvm.lifetime.end.p0(i64 12, ptr nonnull %1) #4
  ret void
}

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef ptr @_ZNK2rw6Camera8getFrameEv(ptr noundef nonnull align 8 dereferenceable(600)) local_unnamed_addr #2 align 2

declare void @_ZN2rw5Frame9translateEPKNS_3V3dENS_9CombineOpE(ptr noundef nonnull align 8 dereferenceable(200), ptr noundef, i32 noundef) local_unnamed_addr #3

declare void @_ZN2rw5Frame6rotateEPKNS_3V3dEfNS_9CombineOpE(ptr noundef nonnull align 8 dereferenceable(200), ptr noundef, float noundef, i32 noundef) local_unnamed_addr #3

attributes #0 = { mustprogress 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 = { 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 #3 = { "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 = !{!"float", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !6, i64 8}
!10 = !{!"_ZTSN2rw3V3dE", !6, i64 0, !6, i64 4, !6, i64 8}
!11 = !{!12, !12, i64 0}
!12 = !{!"any pointer", !7, i64 0}
!13 = !{!10, !6, i64 0}
!14 = !{!10, !6, i64 4}


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