; LLVM IR from niessner/Matterport :: code/gaps/pkgs/R3Shapes/R3Vector.ll (ZN8R3VectordVERKS_)

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

@.str.9 = external hidden unnamed_addr constant [41 x i8], align 1
@.str.11 = external hidden unnamed_addr constant [90 x i8], align 1
@.str.12 = external hidden unnamed_addr constant [17 x i8], align 1
@.str.13 = external hidden unnamed_addr constant [17 x i8], align 1
@.str.14 = external hidden unnamed_addr constant [17 x i8], align 1

declare void @_Z7RNAbortPKcz(ptr noundef, ...) #0

; Function Attrs: mustprogress uwtable
define dso_local noundef nonnull align 8 dereferenceable(24) ptr @_ZN8R3VectordVERKS_(ptr noundef nonnull align 8 dereferenceable(24) %0, ptr noundef nonnull align 8 dereferenceable(24) %1) #1 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
  %6 = load ptr, ptr %4, align 8, !tbaa !5
  %7 = getelementptr inbounds %class.R3Vector, ptr %6, i32 0, i32 0
  %8 = getelementptr inbounds [3 x double], ptr %7, i64 0, i64 0
  %9 = load double, ptr %8, align 8, !tbaa !9
  %10 = fcmp une double %9, 0.000000e+00
  br i1 %10, label %12, label %11

11:                                               ; preds = %2
  call void (ptr, ...) @_Z7RNAbortPKcz(ptr noundef @.str.9, ptr noundef @.str.12, i32 noundef 490, ptr noundef @.str.11)
  br label %12

12:                                               ; preds = %11, %2
  %13 = load ptr, ptr %4, align 8, !tbaa !5
  %14 = getelementptr inbounds %class.R3Vector, ptr %13, i32 0, i32 0
  %15 = getelementptr inbounds [3 x double], ptr %14, i64 0, i64 0
  %16 = load double, ptr %15, align 8, !tbaa !9
  %17 = getelementptr inbounds %class.R3Vector, ptr %5, i32 0, i32 0
  %18 = getelementptr inbounds [3 x double], ptr %17, i64 0, i64 0
  %19 = load double, ptr %18, align 8, !tbaa !9
  %20 = fdiv double %19, %16
  store double %20, ptr %18, align 8, !tbaa !9
  %21 = load ptr, ptr %4, align 8, !tbaa !5
  %22 = getelementptr inbounds %class.R3Vector, ptr %21, i32 0, i32 0
  %23 = getelementptr inbounds [3 x double], ptr %22, i64 0, i64 1
  %24 = load double, ptr %23, align 8, !tbaa !9
  %25 = fcmp une double %24, 0.000000e+00
  br i1 %25, label %27, label %26

26:                                               ; preds = %12
  call void (ptr, ...) @_Z7RNAbortPKcz(ptr noundef @.str.9, ptr noundef @.str.13, i32 noundef 492, ptr noundef @.str.11)
  br label %27

27:                                               ; preds = %26, %12
  %28 = load ptr, ptr %4, align 8, !tbaa !5
  %29 = getelementptr inbounds %class.R3Vector, ptr %28, i32 0, i32 0
  %30 = getelementptr inbounds [3 x double], ptr %29, i64 0, i64 1
  %31 = load double, ptr %30, align 8, !tbaa !9
  %32 = getelementptr inbounds %class.R3Vector, ptr %5, i32 0, i32 0
  %33 = getelementptr inbounds [3 x double], ptr %32, i64 0, i64 1
  %34 = load double, ptr %33, align 8, !tbaa !9
  %35 = fdiv double %34, %31
  store double %35, ptr %33, align 8, !tbaa !9
  %36 = load ptr, ptr %4, align 8, !tbaa !5
  %37 = getelementptr inbounds %class.R3Vector, ptr %36, i32 0, i32 0
  %38 = getelementptr inbounds [3 x double], ptr %37, i64 0, i64 2
  %39 = load double, ptr %38, align 8, !tbaa !9
  %40 = fcmp une double %39, 0.000000e+00
  br i1 %40, label %42, label %41

41:                                               ; preds = %27
  call void (ptr, ...) @_Z7RNAbortPKcz(ptr noundef @.str.9, ptr noundef @.str.14, i32 noundef 494, ptr noundef @.str.11)
  br label %42

42:                                               ; preds = %41, %27
  %43 = load ptr, ptr %4, align 8, !tbaa !5
  %44 = getelementptr inbounds %class.R3Vector, ptr %43, i32 0, i32 0
  %45 = getelementptr inbounds [3 x double], ptr %44, i64 0, i64 2
  %46 = load double, ptr %45, align 8, !tbaa !9
  %47 = getelementptr inbounds %class.R3Vector, ptr %5, i32 0, i32 0
  %48 = getelementptr inbounds [3 x double], ptr %47, i64 0, i64 2
  %49 = load double, ptr %48, align 8, !tbaa !9
  %50 = fdiv double %49, %46
  store double %50, ptr %48, align 8, !tbaa !9
  ret ptr %5
}

attributes #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 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, !10, i64 0}
!10 = !{!"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"

@.str.9 = external hidden unnamed_addr constant [41 x i8], align 1
@.str.11 = external hidden unnamed_addr constant [90 x i8], align 1
@.str.12 = external hidden unnamed_addr constant [17 x i8], align 1
@.str.13 = external hidden unnamed_addr constant [17 x i8], align 1
@.str.14 = external hidden unnamed_addr constant [17 x i8], align 1

declare void @_Z7RNAbortPKcz(ptr noundef, ...) local_unnamed_addr #0

; Function Attrs: mustprogress uwtable
define dso_local noundef nonnull align 8 dereferenceable(24) ptr @_ZN8R3VectordVERKS_(ptr noundef nonnull returned align 8 dereferenceable(24) %0, ptr nocapture noundef nonnull readonly align 8 dereferenceable(24) %1) local_unnamed_addr #1 align 2 {
  %3 = load double, ptr %1, align 8, !tbaa !5
  %4 = fcmp une double %3, 0.000000e+00
  br i1 %4, label %6, label %5

5:                                                ; preds = %2
  tail call void (ptr, ...) @_Z7RNAbortPKcz(ptr noundef nonnull @.str.9, ptr noundef nonnull @.str.12, i32 noundef 490, ptr noundef nonnull @.str.11)
  %.pre = load double, ptr %1, align 8, !tbaa !5
  br label %6

6:                                                ; preds = %5, %2
  %7 = phi double [ %.pre, %5 ], [ %3, %2 ]
  %8 = load double, ptr %0, align 8, !tbaa !5
  %9 = fdiv double %8, %7
  store double %9, ptr %0, align 8, !tbaa !5
  %10 = getelementptr inbounds i8, ptr %1, i64 8
  %11 = load double, ptr %10, align 8, !tbaa !5
  %12 = fcmp une double %11, 0.000000e+00
  br i1 %12, label %14, label %13

13:                                               ; preds = %6
  tail call void (ptr, ...) @_Z7RNAbortPKcz(ptr noundef nonnull @.str.9, ptr noundef nonnull @.str.13, i32 noundef 492, ptr noundef nonnull @.str.11)
  %.pre7 = load double, ptr %10, align 8, !tbaa !5
  br label %14

14:                                               ; preds = %13, %6
  %15 = phi double [ %.pre7, %13 ], [ %11, %6 ]
  %16 = getelementptr inbounds i8, ptr %0, i64 8
  %17 = load double, ptr %16, align 8, !tbaa !5
  %18 = fdiv double %17, %15
  store double %18, ptr %16, align 8, !tbaa !5
  %19 = getelementptr inbounds i8, ptr %1, i64 16
  %20 = load double, ptr %19, align 8, !tbaa !5
  %21 = fcmp une double %20, 0.000000e+00
  br i1 %21, label %23, label %22

22:                                               ; preds = %14
  tail call void (ptr, ...) @_Z7RNAbortPKcz(ptr noundef nonnull @.str.9, ptr noundef nonnull @.str.14, i32 noundef 494, ptr noundef nonnull @.str.11)
  %.pre8 = load double, ptr %19, align 8, !tbaa !5
  br label %23

23:                                               ; preds = %22, %14
  %24 = phi double [ %.pre8, %22 ], [ %20, %14 ]
  %25 = getelementptr inbounds i8, ptr %0, i64 16
  %26 = load double, ptr %25, align 8, !tbaa !5
  %27 = fdiv double %26, %24
  store double %27, ptr %25, align 8, !tbaa !5
  ret ptr %0
}

attributes #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 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,GVNPass,GlobalOptPass,InstCombinePass,PostOrderFunctionAttrsPass,SROAPass,TailCallElimPass