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

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

@RN_EPSILON = external global double, align 8

; 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: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(72) ptr @_ZNK9RGBDImage10IntrinsicsEv(ptr noundef nonnull align 8 dereferenceable(488)) #1 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef ptr @_ZNK8R3MatrixixEi(ptr noundef nonnull align 8 dereferenceable(72), i32 noundef) #2 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef i32 @_ZNK9RGBDImage7NPixelsEi(ptr noundef nonnull align 8 dereferenceable(488), i32 noundef) #2 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef i32 @_Z8RNIsZerodd(double noundef, double noundef) #2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef double @_ZNK7R2PointixEi(ptr noundef nonnull align 8 dereferenceable(16), i32 noundef) #2 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef nonnull align 8 dereferenceable(8) ptr @_ZN7R3PointixEi(ptr noundef nonnull align 8 dereferenceable(24), i32 noundef) #2 align 2

; Function Attrs: mustprogress uwtable
define dso_local noundef i32 @_ZNK9RGBDImage22TransformImageToCameraERK7R2PointR7R3Point(ptr noundef nonnull align 8 dereferenceable(488) %0, ptr noundef nonnull align 8 dereferenceable(16) %1, ptr noundef nonnull align 8 dereferenceable(24) %2) unnamed_addr #3 align 2 {
  %4 = alloca i32, align 4
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  %11 = alloca double, align 8
  %12 = alloca ptr, align 8
  store ptr %0, ptr %5, align 8, !tbaa !5
  store ptr %1, ptr %6, align 8, !tbaa !5
  store ptr %2, ptr %7, align 8, !tbaa !5
  %13 = load ptr, ptr %5, align 8
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #4
  %14 = load ptr, ptr %6, align 8, !tbaa !5
  %15 = call noundef double @_ZNK7R2PointixEi(ptr noundef nonnull align 8 dereferenceable(16) %14, i32 noundef 0)
  %16 = fptosi double %15 to i32
  store i32 %16, ptr %8, align 4, !tbaa !9
  %17 = load i32, ptr %8, align 4, !tbaa !9
  %18 = icmp slt i32 %17, 0
  br i1 %18, label %23, label %19

19:                                               ; preds = %3
  %20 = load i32, ptr %8, align 4, !tbaa !9
  %21 = call noundef i32 @_ZNK9RGBDImage7NPixelsEi(ptr noundef nonnull align 8 dereferenceable(488) %13, i32 noundef 0)
  %22 = icmp sge i32 %20, %21
  br i1 %22, label %23, label %24

23:                                               ; preds = %19, %3
  store i32 0, ptr %4, align 4
  store i32 1, ptr %9, align 4
  br label %106

24:                                               ; preds = %19
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #4
  %25 = load ptr, ptr %6, align 8, !tbaa !5
  %26 = call noundef double @_ZNK7R2PointixEi(ptr noundef nonnull align 8 dereferenceable(16) %25, i32 noundef 1)
  %27 = fptosi double %26 to i32
  store i32 %27, ptr %10, align 4, !tbaa !9
  %28 = load i32, ptr %10, align 4, !tbaa !9
  %29 = icmp slt i32 %28, 0
  br i1 %29, label %34, label %30

30:                                               ; preds = %24
  %31 = load i32, ptr %10, align 4, !tbaa !9
  %32 = call noundef i32 @_ZNK9RGBDImage7NPixelsEi(ptr noundef nonnull align 8 dereferenceable(488) %13, i32 noundef 1)
  %33 = icmp sge i32 %31, %32
  br i1 %33, label %34, label %35

34:                                               ; preds = %30, %24
  store i32 0, ptr %4, align 4
  store i32 1, ptr %9, align 4
  br label %105

35:                                               ; preds = %30
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #4
  %36 = load i32, ptr %8, align 4, !tbaa !9
  %37 = load i32, ptr %10, align 4, !tbaa !9
  %38 = call noundef double @_ZNK9RGBDImage10PixelDepthEii(ptr noundef nonnull align 8 dereferenceable(488) %13, i32 noundef %36, i32 noundef %37)
  store double %38, ptr %11, align 8, !tbaa !11
  %39 = load double, ptr %11, align 8, !tbaa !11
  %40 = load double, ptr @RN_EPSILON, align 8, !tbaa !11
  %41 = call noundef i32 @_Z8RNIsZerodd(double noundef %39, double noundef %40)
  %42 = icmp ne i32 %41, 0
  br i1 %42, label %46, label %43

43:                                               ; preds = %35
  %44 = load double, ptr %11, align 8, !tbaa !11
  %45 = fcmp oeq double %44, -3.210000e+02
  br i1 %45, label %46, label %47

46:                                               ; preds = %43, %35
  store i32 0, ptr %4, align 4
  store i32 1, ptr %9, align 4
  br label %104

47:                                               ; preds = %43
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #4
  %48 = call noundef nonnull align 8 dereferenceable(72) ptr @_ZNK9RGBDImage10IntrinsicsEv(ptr noundef nonnull align 8 dereferenceable(488) %13)
  store ptr %48, ptr %12, align 8, !tbaa !5
  %49 = load ptr, ptr %12, align 8, !tbaa !5
  %50 = call noundef ptr @_ZNK8R3MatrixixEi(ptr noundef nonnull align 8 dereferenceable(72) %49, i32 noundef 0)
  %51 = getelementptr inbounds double, ptr %50, i64 0
  %52 = load double, ptr %51, align 8, !tbaa !11
  %53 = load double, ptr @RN_EPSILON, align 8, !tbaa !11
  %54 = call noundef i32 @_Z8RNIsZerodd(double noundef %52, double noundef %53)
  %55 = icmp ne i32 %54, 0
  br i1 %55, label %56, label %57

56:                                               ; preds = %47
  store i32 0, ptr %4, align 4
  store i32 1, ptr %9, align 4
  br label %103

57:                                               ; preds = %47
  %58 = load ptr, ptr %12, align 8, !tbaa !5
  %59 = call noundef ptr @_ZNK8R3MatrixixEi(ptr noundef nonnull align 8 dereferenceable(72) %58, i32 noundef 1)
  %60 = getelementptr inbounds double, ptr %59, i64 1
  %61 = load double, ptr %60, align 8, !tbaa !11
  %62 = load double, ptr @RN_EPSILON, align 8, !tbaa !11
  %63 = call noundef i32 @_Z8RNIsZerodd(double noundef %61, double noundef %62)
  %64 = icmp ne i32 %63, 0
  br i1 %64, label %65, label %66

65:                                               ; preds = %57
  store i32 0, ptr %4, align 4
  store i32 1, ptr %9, align 4
  br label %103

66:                                               ; preds = %57
  %67 = load ptr, ptr %6, align 8, !tbaa !5
  %68 = call noundef double @_ZNK7R2PointixEi(ptr noundef nonnull align 8 dereferenceable(16) %67, i32 noundef 0)
  %69 = load ptr, ptr %12, align 8, !tbaa !5
  %70 = call noundef ptr @_ZNK8R3MatrixixEi(ptr noundef nonnull align 8 dereferenceable(72) %69, i32 noundef 0)
  %71 = getelementptr inbounds double, ptr %70, i64 2
  %72 = load double, ptr %71, align 8, !tbaa !11
  %73 = fsub double %68, %72
  %74 = load double, ptr %11, align 8, !tbaa !11
  %75 = fmul double %73, %74
  %76 = load ptr, ptr %12, align 8, !tbaa !5
  %77 = call noundef ptr @_ZNK8R3MatrixixEi(ptr noundef nonnull align 8 dereferenceable(72) %76, i32 noundef 0)
  %78 = getelementptr inbounds double, ptr %77, i64 0
  %79 = load double, ptr %78, align 8, !tbaa !11
  %80 = fdiv double %75, %79
  %81 = load ptr, ptr %7, align 8, !tbaa !5
  %82 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN7R3PointixEi(ptr noundef nonnull align 8 dereferenceable(24) %81, i32 noundef 0)
  store double %80, ptr %82, align 8, !tbaa !11
  %83 = load ptr, ptr %6, align 8, !tbaa !5
  %84 = call noundef double @_ZNK7R2PointixEi(ptr noundef nonnull align 8 dereferenceable(16) %83, i32 noundef 1)
  %85 = load ptr, ptr %12, align 8, !tbaa !5
  %86 = call noundef ptr @_ZNK8R3MatrixixEi(ptr noundef nonnull align 8 dereferenceable(72) %85, i32 noundef 1)
  %87 = getelementptr inbounds double, ptr %86, i64 2
  %88 = load double, ptr %87, align 8, !tbaa !11
  %89 = fsub double %84, %88
  %90 = load double, ptr %11, align 8, !tbaa !11
  %91 = fmul double %89, %90
  %92 = load ptr, ptr %12, align 8, !tbaa !5
  %93 = call noundef ptr @_ZNK8R3MatrixixEi(ptr noundef nonnull align 8 dereferenceable(72) %92, i32 noundef 1)
  %94 = getelementptr inbounds double, ptr %93, i64 1
  %95 = load double, ptr %94, align 8, !tbaa !11
  %96 = fdiv double %91, %95
  %97 = load ptr, ptr %7, align 8, !tbaa !5
  %98 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN7R3PointixEi(ptr noundef nonnull align 8 dereferenceable(24) %97, i32 noundef 1)
  store double %96, ptr %98, align 8, !tbaa !11
  %99 = load double, ptr %11, align 8, !tbaa !11
  %100 = fneg double %99
  %101 = load ptr, ptr %7, align 8, !tbaa !5
  %102 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN7R3PointixEi(ptr noundef nonnull align 8 dereferenceable(24) %101, i32 noundef 2)
  store double %100, ptr %102, align 8, !tbaa !11
  store i32 1, ptr %4, align 4
  store i32 1, ptr %9, align 4
  br label %103

103:                                              ; preds = %66, %65, %56
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #4
  br label %104

104:                                              ; preds = %103, %46
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #4
  br label %105

105:                                              ; preds = %104, %34
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #4
  br label %106

106:                                              ; preds = %105, %23
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #4
  %107 = load i32, ptr %4, align 4
  ret i32 %107
}

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef double @_ZNK9RGBDImage10PixelDepthEii(ptr noundef nonnull align 8 dereferenceable(488), i32 noundef, i32 noundef) #2 align 2

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #2 = { inlinehint 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 #3 = { 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 #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 = !{!"int", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"double", !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"

@RN_EPSILON = external local_unnamed_addr global double, align 8

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(72) ptr @_ZNK9RGBDImage10IntrinsicsEv(ptr noundef nonnull align 8 dereferenceable(488)) local_unnamed_addr #0 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef ptr @_ZNK8R3MatrixixEi(ptr noundef nonnull align 8 dereferenceable(72), i32 noundef) local_unnamed_addr #1 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef i32 @_ZNK9RGBDImage7NPixelsEi(ptr noundef nonnull align 8 dereferenceable(488), i32 noundef) local_unnamed_addr #1 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef i32 @_Z8RNIsZerodd(double noundef, double noundef) local_unnamed_addr #1

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef double @_ZNK7R2PointixEi(ptr noundef nonnull align 8 dereferenceable(16), i32 noundef) local_unnamed_addr #1 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef nonnull align 8 dereferenceable(8) ptr @_ZN7R3PointixEi(ptr noundef nonnull align 8 dereferenceable(24), i32 noundef) local_unnamed_addr #1 align 2

; Function Attrs: mustprogress uwtable
define dso_local noundef range(i32 0, 2) i32 @_ZNK9RGBDImage22TransformImageToCameraERK7R2PointR7R3Point(ptr noundef nonnull align 8 dereferenceable(488) %0, ptr noundef nonnull align 8 dereferenceable(16) %1, ptr noundef nonnull align 8 dereferenceable(24) %2) unnamed_addr #2 align 2 {
  %4 = tail call noundef double @_ZNK7R2PointixEi(ptr noundef nonnull align 8 dereferenceable(16) %1, i32 noundef 0)
  %5 = fptosi double %4 to i32
  %6 = icmp slt i32 %5, 0
  br i1 %6, label %57, label %7

7:                                                ; preds = %3
  %8 = tail call noundef i32 @_ZNK9RGBDImage7NPixelsEi(ptr noundef nonnull align 8 dereferenceable(488) %0, i32 noundef 0)
  %.not = icmp sgt i32 %8, %5
  br i1 %.not, label %9, label %57

9:                                                ; preds = %7
  %10 = tail call noundef double @_ZNK7R2PointixEi(ptr noundef nonnull align 8 dereferenceable(16) %1, i32 noundef 1)
  %11 = fptosi double %10 to i32
  %12 = icmp slt i32 %11, 0
  br i1 %12, label %57, label %13

13:                                               ; preds = %9
  %14 = tail call noundef i32 @_ZNK9RGBDImage7NPixelsEi(ptr noundef nonnull align 8 dereferenceable(488) %0, i32 noundef 1)
  %.not29 = icmp sgt i32 %14, %11
  br i1 %.not29, label %15, label %57

15:                                               ; preds = %13
  %16 = tail call noundef double @_ZNK9RGBDImage10PixelDepthEii(ptr noundef nonnull align 8 dereferenceable(488) %0, i32 noundef %5, i32 noundef %11)
  %17 = load double, ptr @RN_EPSILON, align 8, !tbaa !5
  %18 = tail call noundef i32 @_Z8RNIsZerodd(double noundef %16, double noundef %17)
  %19 = icmp ne i32 %18, 0
  %20 = fcmp oeq double %16, -3.210000e+02
  %or.cond = or i1 %20, %19
  br i1 %or.cond, label %57, label %21

21:                                               ; preds = %15
  %22 = tail call noundef nonnull align 8 dereferenceable(72) ptr @_ZNK9RGBDImage10IntrinsicsEv(ptr noundef nonnull align 8 dereferenceable(488) %0)
  %23 = tail call noundef ptr @_ZNK8R3MatrixixEi(ptr noundef nonnull align 8 dereferenceable(72) %22, i32 noundef 0)
  %24 = load double, ptr %23, align 8, !tbaa !5
  %25 = load double, ptr @RN_EPSILON, align 8, !tbaa !5
  %26 = tail call noundef i32 @_Z8RNIsZerodd(double noundef %24, double noundef %25)
  %.not30 = icmp eq i32 %26, 0
  br i1 %.not30, label %27, label %57

27:                                               ; preds = %21
  %28 = tail call noundef ptr @_ZNK8R3MatrixixEi(ptr noundef nonnull align 8 dereferenceable(72) %22, i32 noundef 1)
  %29 = getelementptr inbounds i8, ptr %28, i64 8
  %30 = load double, ptr %29, align 8, !tbaa !5
  %31 = load double, ptr @RN_EPSILON, align 8, !tbaa !5
  %32 = tail call noundef i32 @_Z8RNIsZerodd(double noundef %30, double noundef %31)
  %.not31 = icmp eq i32 %32, 0
  br i1 %.not31, label %33, label %57

33:                                               ; preds = %27
  %34 = tail call noundef double @_ZNK7R2PointixEi(ptr noundef nonnull align 8 dereferenceable(16) %1, i32 noundef 0)
  %35 = tail call noundef ptr @_ZNK8R3MatrixixEi(ptr noundef nonnull align 8 dereferenceable(72) %22, i32 noundef 0)
  %36 = getelementptr inbounds i8, ptr %35, i64 16
  %37 = load double, ptr %36, align 8, !tbaa !5
  %38 = fsub double %34, %37
  %39 = fmul double %16, %38
  %40 = tail call noundef ptr @_ZNK8R3MatrixixEi(ptr noundef nonnull align 8 dereferenceable(72) %22, i32 noundef 0)
  %41 = load double, ptr %40, align 8, !tbaa !5
  %42 = fdiv double %39, %41
  %43 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZN7R3PointixEi(ptr noundef nonnull align 8 dereferenceable(24) %2, i32 noundef 0)
  store double %42, ptr %43, align 8, !tbaa !5
  %44 = tail call noundef double @_ZNK7R2PointixEi(ptr noundef nonnull align 8 dereferenceable(16) %1, i32 noundef 1)
  %45 = tail call noundef ptr @_ZNK8R3MatrixixEi(ptr noundef nonnull align 8 dereferenceable(72) %22, i32 noundef 1)
  %46 = getelementptr inbounds i8, ptr %45, i64 16
  %47 = load double, ptr %46, align 8, !tbaa !5
  %48 = fsub double %44, %47
  %49 = fmul double %16, %48
  %50 = tail call noundef ptr @_ZNK8R3MatrixixEi(ptr noundef nonnull align 8 dereferenceable(72) %22, i32 noundef 1)
  %51 = getelementptr inbounds i8, ptr %50, i64 8
  %52 = load double, ptr %51, align 8, !tbaa !5
  %53 = fdiv double %49, %52
  %54 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZN7R3PointixEi(ptr noundef nonnull align 8 dereferenceable(24) %2, i32 noundef 1)
  store double %53, ptr %54, align 8, !tbaa !5
  %55 = fneg double %16
  %56 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZN7R3PointixEi(ptr noundef nonnull align 8 dereferenceable(24) %2, i32 noundef 2)
  store double %55, ptr %56, align 8, !tbaa !5
  br label %57

57:                                               ; preds = %13, %9, %33, %21, %27, %15, %3, %7
  %.3 = phi i32 [ 0, %7 ], [ 0, %3 ], [ 0, %13 ], [ 0, %9 ], [ 0, %15 ], [ 1, %33 ], [ 0, %21 ], [ 0, %27 ]
  ret i32 %.3
}

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef double @_ZNK9RGBDImage10PixelDepthEii(ptr noundef nonnull align 8 dereferenceable(488), i32 noundef, i32 noundef) local_unnamed_addr #1 align 2

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 = { inlinehint 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 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 = !{!"double", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}


; Effective O3 passes: EarlyCSEPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,ReassociatePass,SROAPass,SimplifyCFGPass,TailCallElimPass