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

; 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.15 = external hidden unnamed_addr constant [18 x i8], align 1
@.str.16 = external hidden unnamed_addr constant [18 x i8], align 1
@.str.17 = external hidden unnamed_addr constant [18 x i8], align 1

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

; Function Attrs: mustprogress uwtable
define dso_local void @_ZdvRK8R3VectorS1_(ptr dead_on_unwind noalias writable sret(%class.R3Vector) align 8 %0, ptr noundef nonnull align 8 dereferenceable(24) %1, ptr noundef nonnull align 8 dereferenceable(24) %2) #1 {
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  store ptr %0, ptr %4, align 8
  store ptr %1, ptr %5, align 8, !tbaa !5
  store ptr %2, ptr %6, align 8, !tbaa !5
  %7 = load ptr, ptr %6, align 8, !tbaa !5
  %8 = getelementptr inbounds %class.R3Vector, ptr %7, i32 0, i32 0
  %9 = getelementptr inbounds [3 x double], ptr %8, i64 0, i64 0
  %10 = load double, ptr %9, align 8, !tbaa !9
  %11 = fcmp une double %10, 0.000000e+00
  br i1 %11, label %13, label %12

12:                                               ; preds = %3
  call void (ptr, ...) @_Z7RNAbortPKcz(ptr noundef @.str.9, ptr noundef @.str.15, i32 noundef 563, ptr noundef @.str.11)
  br label %13

13:                                               ; preds = %12, %3
  %14 = load ptr, ptr %6, align 8, !tbaa !5
  %15 = getelementptr inbounds %class.R3Vector, ptr %14, i32 0, i32 0
  %16 = getelementptr inbounds [3 x double], ptr %15, i64 0, i64 1
  %17 = load double, ptr %16, align 8, !tbaa !9
  %18 = fcmp une double %17, 0.000000e+00
  br i1 %18, label %20, label %19

19:                                               ; preds = %13
  call void (ptr, ...) @_Z7RNAbortPKcz(ptr noundef @.str.9, ptr noundef @.str.16, i32 noundef 564, ptr noundef @.str.11)
  br label %20

20:                                               ; preds = %19, %13
  %21 = load ptr, ptr %6, 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 2
  %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 = %20
  call void (ptr, ...) @_Z7RNAbortPKcz(ptr noundef @.str.9, ptr noundef @.str.17, i32 noundef 565, ptr noundef @.str.11)
  br label %27

27:                                               ; preds = %26, %20
  %28 = load ptr, ptr %5, 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 0
  %31 = load double, ptr %30, align 8, !tbaa !9
  %32 = load ptr, ptr %6, align 8, !tbaa !5
  %33 = getelementptr inbounds %class.R3Vector, ptr %32, i32 0, i32 0
  %34 = getelementptr inbounds [3 x double], ptr %33, i64 0, i64 0
  %35 = load double, ptr %34, align 8, !tbaa !9
  %36 = fdiv double %31, %35
  %37 = load ptr, ptr %5, align 8, !tbaa !5
  %38 = getelementptr inbounds %class.R3Vector, ptr %37, i32 0, i32 0
  %39 = getelementptr inbounds [3 x double], ptr %38, i64 0, i64 1
  %40 = load double, ptr %39, align 8, !tbaa !9
  %41 = load ptr, ptr %6, align 8, !tbaa !5
  %42 = getelementptr inbounds %class.R3Vector, ptr %41, i32 0, i32 0
  %43 = getelementptr inbounds [3 x double], ptr %42, i64 0, i64 1
  %44 = load double, ptr %43, align 8, !tbaa !9
  %45 = fdiv double %40, %44
  %46 = load ptr, ptr %5, align 8, !tbaa !5
  %47 = getelementptr inbounds %class.R3Vector, ptr %46, 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 = load ptr, ptr %6, align 8, !tbaa !5
  %51 = getelementptr inbounds %class.R3Vector, ptr %50, i32 0, i32 0
  %52 = getelementptr inbounds [3 x double], ptr %51, i64 0, i64 2
  %53 = load double, ptr %52, align 8, !tbaa !9
  %54 = fdiv double %49, %53
  call void @_ZN8R3VectorC1Eddd(ptr noundef nonnull align 8 dereferenceable(24) %0, double noundef %36, double noundef %45, double noundef %54)
  ret void
}

declare void @_ZN8R3VectorC1Eddd(ptr, double, double, double)

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"

%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.15 = external hidden unnamed_addr constant [18 x i8], align 1
@.str.16 = external hidden unnamed_addr constant [18 x i8], align 1
@.str.17 = external hidden unnamed_addr constant [18 x i8], align 1

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

; Function Attrs: mustprogress uwtable
define dso_local void @_ZdvRK8R3VectorS1_(ptr dead_on_unwind noalias writable sret(%class.R3Vector) align 8 %0, ptr nocapture noundef nonnull readonly align 8 dereferenceable(24) %1, ptr nocapture noundef nonnull readonly align 8 dereferenceable(24) %2) local_unnamed_addr #1 {
  %4 = load double, ptr %2, align 8, !tbaa !5
  %5 = fcmp une double %4, 0.000000e+00
  br i1 %5, label %7, label %6

6:                                                ; preds = %3
  tail call void (ptr, ...) @_Z7RNAbortPKcz(ptr noundef nonnull @.str.9, ptr noundef nonnull @.str.15, i32 noundef 563, ptr noundef nonnull @.str.11)
  br label %7

7:                                                ; preds = %6, %3
  %8 = getelementptr inbounds i8, ptr %2, i64 8
  %9 = load double, ptr %8, align 8, !tbaa !5
  %10 = fcmp une double %9, 0.000000e+00
  br i1 %10, label %12, label %11

11:                                               ; preds = %7
  tail call void (ptr, ...) @_Z7RNAbortPKcz(ptr noundef nonnull @.str.9, ptr noundef nonnull @.str.16, i32 noundef 564, ptr noundef nonnull @.str.11)
  br label %12

12:                                               ; preds = %11, %7
  %13 = getelementptr inbounds i8, ptr %2, i64 16
  %14 = load double, ptr %13, align 8, !tbaa !5
  %15 = fcmp une double %14, 0.000000e+00
  br i1 %15, label %17, label %16

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

17:                                               ; preds = %16, %12
  %18 = phi double [ %.pre, %16 ], [ %14, %12 ]
  %19 = load double, ptr %1, align 8, !tbaa !5
  %20 = load double, ptr %2, align 8, !tbaa !5
  %21 = fdiv double %19, %20
  %22 = getelementptr inbounds i8, ptr %1, i64 8
  %23 = load double, ptr %22, align 8, !tbaa !5
  %24 = load double, ptr %8, align 8, !tbaa !5
  %25 = fdiv double %23, %24
  %26 = getelementptr inbounds i8, ptr %1, i64 16
  %27 = load double, ptr %26, align 8, !tbaa !5
  %28 = fdiv double %27, %18
  tail call void @_ZN8R3VectorC1Eddd(ptr noundef nonnull align 8 dereferenceable(24) %0, double noundef %21, double noundef %25, double noundef %28)
  ret void
}

declare void @_ZN8R3VectorC1Eddd(ptr, double, double, double) local_unnamed_addr

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