; LLVM IR from niessner/Matterport :: code/gaps/pkgs/RGBD/RGBDImage.ll (ZN9RGBDImageC2Ev)

; 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.R4Matrix = type { [4 x [4 x double]] }
%class.RGBDImage = type { ptr, ptr, i32, %class.RNArray, i32, i32, %class.R3Affine, %class.R3Matrix, %class.R3Box, i32, ptr, ptr, ptr, i32, i32 }
%class.RNArray = type { %class.RNVArray }
%class.RNVArray = type { ptr, i32, i32 }
%class.R3Affine = type { %class.R3Transformation, %class.R4Matrix, %class.R4Matrix, %class.RNFlags }
%class.R3Transformation = type { ptr }
%class.RNFlags = type { i64 }
%class.R3Matrix = type { [3 x [3 x double]] }
%class.R3Box = type { %class.R3Solid, %class.R3Point, %class.R3Point }
%class.R3Solid = type { %class.R3Shape }
%class.R3Shape = type { ptr }
%class.R3Point = type { [3 x double] }

@_ZTV9RGBDImage = external dso_local unnamed_addr constant { [43 x ptr] }, align 8

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN9RGBDImageC2Ev(ptr noundef nonnull align 8 dereferenceable(488) %0) unnamed_addr #0 align 2 personality ptr @__gxx_personality_v0 {
  %2 = alloca ptr, align 8
  %3 = alloca %class.R4Matrix, align 8
  %4 = alloca ptr, align 8
  %5 = alloca i32, align 4
  store ptr %0, ptr %2, align 8, !tbaa !5
  %6 = load ptr, ptr %2, align 8
  store ptr getelementptr inbounds inrange(-16, 328) ({ [43 x ptr] }, ptr @_ZTV9RGBDImage, i32 0, i32 0, i32 2), ptr %6, align 8, !tbaa !9
  %7 = getelementptr inbounds %class.RGBDImage, ptr %6, i32 0, i32 1
  store ptr null, ptr %7, align 8, !tbaa !11
  %8 = getelementptr inbounds %class.RGBDImage, ptr %6, i32 0, i32 2
  store i32 -1, ptr %8, align 8, !tbaa !26
  %9 = getelementptr inbounds %class.RGBDImage, ptr %6, i32 0, i32 3
  call void @_ZN7RNArrayIP6R2GridEC2Ev(ptr noundef nonnull align 8 dereferenceable(16) %9)
  %10 = getelementptr inbounds %class.RGBDImage, ptr %6, i32 0, i32 4
  store i32 0, ptr %10, align 8, !tbaa !27
  %11 = getelementptr inbounds %class.RGBDImage, ptr %6, i32 0, i32 5
  store i32 0, ptr %11, align 4, !tbaa !28
  %12 = getelementptr inbounds %class.RGBDImage, ptr %6, i32 0, i32 6
  call void @llvm.lifetime.start.p0(i64 128, ptr %3) #4
  invoke void @_ZN8R4MatrixC1Edddddddddddddddd(ptr noundef nonnull align 8 dereferenceable(128) %3, double noundef 1.000000e+00, double noundef 0.000000e+00, double noundef 0.000000e+00, double noundef 0.000000e+00, double noundef 0.000000e+00, double noundef 1.000000e+00, double noundef 0.000000e+00, double noundef 0.000000e+00, double noundef 0.000000e+00, double noundef 0.000000e+00, double noundef 1.000000e+00, double noundef 0.000000e+00, double noundef 0.000000e+00, double noundef 0.000000e+00, double noundef 0.000000e+00, double noundef 1.000000e+00)
          to label %13 unwind label %25

13:                                               ; preds = %1
  invoke void @_ZN8R3AffineC1ERK8R4Matrixi(ptr noundef nonnull align 8 dereferenceable(272) %12, ptr noundef nonnull align 8 dereferenceable(128) %3, i32 noundef 0)
          to label %14 unwind label %25

14:                                               ; preds = %13
  call void @llvm.lifetime.end.p0(i64 128, ptr %3) #4
  %15 = getelementptr inbounds %class.RGBDImage, ptr %6, i32 0, i32 7
  invoke void @_ZN8R3MatrixC1Eddddddddd(ptr noundef nonnull align 8 dereferenceable(72) %15, double noundef 1.000000e+00, double noundef 0.000000e+00, double noundef 0.000000e+00, double noundef 0.000000e+00, double noundef 1.000000e+00, double noundef 0.000000e+00, double noundef 0.000000e+00, double noundef 0.000000e+00, double noundef 1.000000e+00)
          to label %16 unwind label %29

16:                                               ; preds = %14
  %17 = getelementptr inbounds %class.RGBDImage, ptr %6, i32 0, i32 8
  invoke void @_ZN5R3BoxC1Edddddd(ptr noundef nonnull align 8 dereferenceable(56) %17, double noundef 0x47EFFFFFE0000000, double noundef 0x47EFFFFFE0000000, double noundef 0x47EFFFFFE0000000, double noundef 0xC7EFFFFFE0000000, double noundef 0xC7EFFFFFE0000000, double noundef 0xC7EFFFFFE0000000)
          to label %18 unwind label %29

18:                                               ; preds = %16
  %19 = getelementptr inbounds %class.RGBDImage, ptr %6, i32 0, i32 9
  store i32 -1, ptr %19, align 8, !tbaa !29
  %20 = getelementptr inbounds %class.RGBDImage, ptr %6, i32 0, i32 10
  store ptr null, ptr %20, align 8, !tbaa !30
  %21 = getelementptr inbounds %class.RGBDImage, ptr %6, i32 0, i32 11
  store ptr null, ptr %21, align 8, !tbaa !31
  %22 = getelementptr inbounds %class.RGBDImage, ptr %6, i32 0, i32 12
  store ptr null, ptr %22, align 8, !tbaa !32
  %23 = getelementptr inbounds %class.RGBDImage, ptr %6, i32 0, i32 13
  store i32 0, ptr %23, align 8, !tbaa !33
  %24 = getelementptr inbounds %class.RGBDImage, ptr %6, i32 0, i32 14
  store i32 0, ptr %24, align 4, !tbaa !34
  ret void

25:                                               ; preds = %13, %1
  %26 = landingpad { ptr, i32 }
          cleanup
  %27 = extractvalue { ptr, i32 } %26, 0
  store ptr %27, ptr %4, align 8
  %28 = extractvalue { ptr, i32 } %26, 1
  store i32 %28, ptr %5, align 4
  call void @llvm.lifetime.end.p0(i64 128, ptr %3) #4
  br label %33

29:                                               ; preds = %16, %14
  %30 = landingpad { ptr, i32 }
          cleanup
  %31 = extractvalue { ptr, i32 } %30, 0
  store ptr %31, ptr %4, align 8
  %32 = extractvalue { ptr, i32 } %30, 1
  store i32 %32, ptr %5, align 4
  call void @_ZN8R3AffineD1Ev(ptr noundef nonnull align 8 dereferenceable(272) %12) #4
  br label %33

33:                                               ; preds = %29, %25
  call void @_ZN8RNVArrayD2Ev(ptr noundef nonnull align 8 dereferenceable(16) %9) #4
  br label %34

34:                                               ; preds = %33
  %35 = load ptr, ptr %4, align 8
  %36 = load i32, ptr %5, align 4
  %37 = insertvalue { ptr, i32 } poison, ptr %35, 0
  %38 = insertvalue { ptr, i32 } %37, i32 %36, 1
  resume { ptr, i32 } %38
}

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN7RNArrayIP6R2GridEC2Ev(ptr noundef nonnull align 8 dereferenceable(16)) unnamed_addr #0 align 2

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

declare void @_ZN8R4MatrixC1Edddddddddddddddd(ptr noundef nonnull align 8 dereferenceable(128), double noundef, double noundef, double noundef, double noundef, double noundef, double noundef, double noundef, double noundef, double noundef, double noundef, double noundef, double noundef, double noundef, double noundef, double noundef, double noundef) unnamed_addr #2

declare i32 @__gxx_personality_v0(...)

declare void @_ZN8R3AffineC1ERK8R4Matrixi(ptr noundef nonnull align 8 dereferenceable(272), ptr noundef nonnull align 8 dereferenceable(128), i32 noundef) unnamed_addr #2

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

declare void @_ZN8R3MatrixC1Eddddddddd(ptr noundef nonnull align 8 dereferenceable(72), double noundef, double noundef, double noundef, double noundef, double noundef, double noundef, double noundef, double noundef, double noundef) unnamed_addr #2

declare void @_ZN5R3BoxC1Edddddd(ptr noundef nonnull align 8 dereferenceable(56), double noundef, double noundef, double noundef, double noundef, double noundef, double noundef) unnamed_addr #2

; Function Attrs: nounwind
declare void @_ZN8R3AffineD1Ev(ptr noundef nonnull align 8 dereferenceable(272)) unnamed_addr #3

; Function Attrs: nounwind
declare void @_ZN8RNVArrayD2Ev(ptr noundef nonnull align 8 dereferenceable(16)) unnamed_addr #3

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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { "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, !10, i64 0}
!10 = !{!"vtable pointer", !8, i64 0}
!11 = !{!12, !6, i64 8}
!12 = !{!"_ZTS9RGBDImage", !6, i64 8, !13, i64 16, !14, i64 24, !13, i64 40, !13, i64 44, !16, i64 48, !21, i64 320, !22, i64 392, !13, i64 448, !6, i64 456, !6, i64 464, !6, i64 472, !13, i64 480, !13, i64 484}
!13 = !{!"int", !7, i64 0}
!14 = !{!"_ZTS7RNArrayIP6R2GridE", !15, i64 0}
!15 = !{!"_ZTS8RNVArray", !6, i64 0, !13, i64 8, !13, i64 12}
!16 = !{!"_ZTS8R3Affine", !17, i64 0, !18, i64 8, !18, i64 136, !19, i64 264}
!17 = !{!"_ZTS16R3Transformation"}
!18 = !{!"_ZTS8R4Matrix", !7, i64 0}
!19 = !{!"_ZTS7RNFlags", !20, i64 0}
!20 = !{!"long", !7, i64 0}
!21 = !{!"_ZTS8R3Matrix", !7, i64 0}
!22 = !{!"_ZTS5R3Box", !23, i64 0, !25, i64 8, !25, i64 32}
!23 = !{!"_ZTS7R3Solid", !24, i64 0}
!24 = !{!"_ZTS7R3Shape"}
!25 = !{!"_ZTS7R3Point", !7, i64 0}
!26 = !{!12, !13, i64 16}
!27 = !{!12, !13, i64 40}
!28 = !{!12, !13, i64 44}
!29 = !{!12, !13, i64 448}
!30 = !{!12, !6, i64 456}
!31 = !{!12, !6, i64 464}
!32 = !{!12, !6, i64 472}
!33 = !{!12, !13, i64 480}
!34 = !{!12, !13, i64 484}


; 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.R4Matrix = type { [4 x [4 x double]] }

@_ZTV9RGBDImage = external dso_local unnamed_addr constant { [43 x ptr] }, align 8

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN9RGBDImageC2Ev(ptr noundef nonnull align 8 dereferenceable(488) %0) unnamed_addr #0 align 2 personality ptr @__gxx_personality_v0 {
  %2 = alloca %class.R4Matrix, align 8
  store ptr getelementptr inbounds inrange(-16, 328) (i8, ptr @_ZTV9RGBDImage, i64 16), ptr %0, align 8, !tbaa !5
  %3 = getelementptr inbounds i8, ptr %0, i64 8
  store ptr null, ptr %3, align 8, !tbaa !8
  %4 = getelementptr inbounds i8, ptr %0, i64 16
  store i32 -1, ptr %4, align 8, !tbaa !25
  %5 = getelementptr inbounds i8, ptr %0, i64 24
  tail call void @_ZN7RNArrayIP6R2GridEC2Ev(ptr noundef nonnull align 8 dereferenceable(16) %5)
  %6 = getelementptr inbounds i8, ptr %0, i64 40
  store i32 0, ptr %6, align 8, !tbaa !26
  %7 = getelementptr inbounds i8, ptr %0, i64 44
  store i32 0, ptr %7, align 4, !tbaa !27
  %8 = getelementptr inbounds i8, ptr %0, i64 48
  call void @llvm.lifetime.start.p0(i64 128, ptr nonnull %2) #5
  invoke void @_ZN8R4MatrixC1Edddddddddddddddd(ptr noundef nonnull align 8 dereferenceable(128) %2, double noundef 1.000000e+00, double noundef 0.000000e+00, double noundef 0.000000e+00, double noundef 0.000000e+00, double noundef 0.000000e+00, double noundef 1.000000e+00, double noundef 0.000000e+00, double noundef 0.000000e+00, double noundef 0.000000e+00, double noundef 0.000000e+00, double noundef 1.000000e+00, double noundef 0.000000e+00, double noundef 0.000000e+00, double noundef 0.000000e+00, double noundef 0.000000e+00, double noundef 1.000000e+00)
          to label %9 unwind label %17

9:                                                ; preds = %1
  invoke void @_ZN8R3AffineC1ERK8R4Matrixi(ptr noundef nonnull align 8 dereferenceable(272) %8, ptr noundef nonnull align 8 dereferenceable(128) %2, i32 noundef 0)
          to label %10 unwind label %17

10:                                               ; preds = %9
  call void @llvm.lifetime.end.p0(i64 128, ptr nonnull %2) #5
  %11 = getelementptr inbounds i8, ptr %0, i64 320
  invoke void @_ZN8R3MatrixC1Eddddddddd(ptr noundef nonnull align 8 dereferenceable(72) %11, double noundef 1.000000e+00, double noundef 0.000000e+00, double noundef 0.000000e+00, double noundef 0.000000e+00, double noundef 1.000000e+00, double noundef 0.000000e+00, double noundef 0.000000e+00, double noundef 0.000000e+00, double noundef 1.000000e+00)
          to label %12 unwind label %19

12:                                               ; preds = %10
  %13 = getelementptr inbounds i8, ptr %0, i64 392
  invoke void @_ZN5R3BoxC1Edddddd(ptr noundef nonnull align 8 dereferenceable(56) %13, double noundef 0x47EFFFFFE0000000, double noundef 0x47EFFFFFE0000000, double noundef 0x47EFFFFFE0000000, double noundef 0xC7EFFFFFE0000000, double noundef 0xC7EFFFFFE0000000, double noundef 0xC7EFFFFFE0000000)
          to label %14 unwind label %19

14:                                               ; preds = %12
  %15 = getelementptr inbounds i8, ptr %0, i64 448
  store i32 -1, ptr %15, align 8, !tbaa !28
  %16 = getelementptr inbounds i8, ptr %0, i64 456
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(32) %16, i8 0, i64 32, i1 false)
  ret void

17:                                               ; preds = %9, %1
  %18 = landingpad { ptr, i32 }
          cleanup
  call void @llvm.lifetime.end.p0(i64 128, ptr nonnull %2) #5
  br label %21

19:                                               ; preds = %12, %10
  %20 = landingpad { ptr, i32 }
          cleanup
  call void @_ZN8R3AffineD1Ev(ptr noundef nonnull align 8 dereferenceable(272) %8) #5
  br label %21

21:                                               ; preds = %19, %17
  %.pn = phi { ptr, i32 } [ %20, %19 ], [ %18, %17 ]
  call void @_ZN8RNVArrayD2Ev(ptr noundef nonnull align 8 dereferenceable(16) %5) #5
  resume { ptr, i32 } %.pn
}

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN7RNArrayIP6R2GridEC2Ev(ptr noundef nonnull align 8 dereferenceable(16)) unnamed_addr #0 align 2

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

declare void @_ZN8R4MatrixC1Edddddddddddddddd(ptr noundef nonnull align 8 dereferenceable(128), double noundef, double noundef, double noundef, double noundef, double noundef, double noundef, double noundef, double noundef, double noundef, double noundef, double noundef, double noundef, double noundef, double noundef, double noundef, double noundef) unnamed_addr #2

declare i32 @__gxx_personality_v0(...)

declare void @_ZN8R3AffineC1ERK8R4Matrixi(ptr noundef nonnull align 8 dereferenceable(272), ptr noundef nonnull align 8 dereferenceable(128), i32 noundef) unnamed_addr #2

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

declare void @_ZN8R3MatrixC1Eddddddddd(ptr noundef nonnull align 8 dereferenceable(72), double noundef, double noundef, double noundef, double noundef, double noundef, double noundef, double noundef, double noundef, double noundef) unnamed_addr #2

declare void @_ZN5R3BoxC1Edddddd(ptr noundef nonnull align 8 dereferenceable(56), double noundef, double noundef, double noundef, double noundef, double noundef, double noundef) unnamed_addr #2

; Function Attrs: nounwind
declare void @_ZN8R3AffineD1Ev(ptr noundef nonnull align 8 dereferenceable(272)) unnamed_addr #3

; Function Attrs: nounwind
declare void @_ZN8RNVArrayD2Ev(ptr noundef nonnull align 8 dereferenceable(16)) unnamed_addr #3

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #4

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 nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { "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 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #5 = { 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, !10, i64 8}
!9 = !{!"_ZTS9RGBDImage", !10, i64 8, !12, i64 16, !13, i64 24, !12, i64 40, !12, i64 44, !15, i64 48, !20, i64 320, !21, i64 392, !12, i64 448, !10, i64 456, !10, i64 464, !10, i64 472, !12, i64 480, !12, i64 484}
!10 = !{!"any pointer", !11, i64 0}
!11 = !{!"omnipotent char", !7, i64 0}
!12 = !{!"int", !11, i64 0}
!13 = !{!"_ZTS7RNArrayIP6R2GridE", !14, i64 0}
!14 = !{!"_ZTS8RNVArray", !10, i64 0, !12, i64 8, !12, i64 12}
!15 = !{!"_ZTS8R3Affine", !16, i64 0, !17, i64 8, !17, i64 136, !18, i64 264}
!16 = !{!"_ZTS16R3Transformation"}
!17 = !{!"_ZTS8R4Matrix", !11, i64 0}
!18 = !{!"_ZTS7RNFlags", !19, i64 0}
!19 = !{!"long", !11, i64 0}
!20 = !{!"_ZTS8R3Matrix", !11, i64 0}
!21 = !{!"_ZTS5R3Box", !22, i64 0, !24, i64 8, !24, i64 32}
!22 = !{!"_ZTS7R3Solid", !23, i64 0}
!23 = !{!"_ZTS7R3Shape"}
!24 = !{!"_ZTS7R3Point", !11, i64 0}
!25 = !{!9, !12, i64 16}
!26 = !{!9, !12, i64 40}
!27 = !{!9, !12, i64 44}
!28 = !{!9, !12, i64 448}


; Effective O3 passes: InferFunctionAttrsPass,InstCombinePass,MemCpyOptPass,SROAPass,SimplifyCFGPass,TailCallElimPass