; LLVM IR from niessner/Matterport :: code/gaps/pkgs/R2Shapes/R2Diad.ll (ZN6R2DiadC2ERKS_)

; 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.R2Diad = type { [2 x %class.R2Vector] }
%class.R2Vector = type { [2 x double] }

declare void @_ZN8R2VectorC1Ev(ptr noundef nonnull align 8 dereferenceable(16)) unnamed_addr #0

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN6R2DiadC2ERKS_(ptr noundef nonnull align 8 dereferenceable(32) %0, ptr noundef nonnull align 8 dereferenceable(32) %1) unnamed_addr #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 = getelementptr inbounds %class.R2Diad, ptr %5, i32 0, i32 0
  %7 = getelementptr inbounds [2 x %class.R2Vector], ptr %6, i32 0, i32 0
  %8 = getelementptr inbounds %class.R2Vector, ptr %7, i64 2
  br label %9

9:                                                ; preds = %9, %2
  %10 = phi ptr [ %7, %2 ], [ %11, %9 ]
  call void @_ZN8R2VectorC1Ev(ptr noundef nonnull align 8 dereferenceable(16) %10)
  %11 = getelementptr inbounds %class.R2Vector, ptr %10, i64 1
  %12 = icmp eq ptr %11, %8
  br i1 %12, label %13, label %9

13:                                               ; preds = %9
  %14 = load ptr, ptr %4, align 8, !tbaa !5
  %15 = getelementptr inbounds %class.R2Diad, ptr %14, i32 0, i32 0
  %16 = getelementptr inbounds [2 x %class.R2Vector], ptr %15, i64 0, i64 0
  %17 = getelementptr inbounds %class.R2Diad, ptr %5, i32 0, i32 0
  %18 = getelementptr inbounds [2 x %class.R2Vector], ptr %17, i64 0, i64 0
  %19 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZN8R2VectoraSERKS_(ptr noundef nonnull align 8 dereferenceable(16) %18, ptr noundef nonnull align 8 dereferenceable(16) %16)
  %20 = load ptr, ptr %4, align 8, !tbaa !5
  %21 = getelementptr inbounds %class.R2Diad, ptr %20, i32 0, i32 0
  %22 = getelementptr inbounds [2 x %class.R2Vector], ptr %21, i64 0, i64 1
  %23 = getelementptr inbounds %class.R2Diad, ptr %5, i32 0, i32 0
  %24 = getelementptr inbounds [2 x %class.R2Vector], ptr %23, i64 0, i64 1
  %25 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZN8R2VectoraSERKS_(ptr noundef nonnull align 8 dereferenceable(16) %24, ptr noundef nonnull align 8 dereferenceable(16) %22)
  ret void
}

declare noundef nonnull align 8 dereferenceable(16) ptr @_ZN8R2VectoraSERKS_(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 8 dereferenceable(16)) #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 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}


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

declare void @_ZN8R2VectorC1Ev(ptr noundef nonnull align 8 dereferenceable(16)) unnamed_addr #0

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN6R2DiadC2ERKS_(ptr noundef nonnull align 8 dereferenceable(32) %0, ptr noundef nonnull align 8 dereferenceable(32) %1) unnamed_addr #1 align 2 {
  tail call void @_ZN8R2VectorC1Ev(ptr noundef nonnull align 8 dereferenceable(16) %0)
  %.ptr.1 = getelementptr inbounds i8, ptr %0, i64 16
  tail call void @_ZN8R2VectorC1Ev(ptr noundef nonnull align 8 dereferenceable(16) %.ptr.1)
  %3 = tail call noundef nonnull align 8 dereferenceable(16) ptr @_ZN8R2VectoraSERKS_(ptr noundef nonnull align 8 dereferenceable(16) %0, ptr noundef nonnull align 8 dereferenceable(16) %1)
  %4 = getelementptr inbounds i8, ptr %1, i64 16
  %5 = tail call noundef nonnull align 8 dereferenceable(16) ptr @_ZN8R2VectoraSERKS_(ptr noundef nonnull align 8 dereferenceable(16) %.ptr.1, ptr noundef nonnull align 8 dereferenceable(16) %4)
  ret void
}

declare noundef nonnull align 8 dereferenceable(16) ptr @_ZN8R2VectoraSERKS_(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 8 dereferenceable(16)) local_unnamed_addr #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)"}


; Effective O3 passes: EarlyCSEPass,GVNPass,GlobalOptPass,InstCombinePass,SROAPass,TailCallElimPass