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

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

%struct.R3MeshProperty = type { ptr, [1024 x i8], i32, ptr, double, double, double, double, double, double }

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef i32 @_ZNK6R3Mesh9NVerticesEv(ptr noundef nonnull align 8 dereferenceable(272)) #0 align 2

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare { i64, i1 } @llvm.umul.with.overflow.i64(i64, i64) #1

; Function Attrs: nobuiltin allocsize(0)
declare noundef nonnull ptr @_Znam(i64 noundef) #2

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

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

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN14R3MeshPropertyC2ERKS_(ptr noundef nonnull align 8 dereferenceable(1096) %0, ptr noundef nonnull align 8 dereferenceable(1096) %1) unnamed_addr #4 align 2 {
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  %5 = alloca i32, align 4
  store ptr %0, ptr %3, align 8, !tbaa !5
  store ptr %1, ptr %4, align 8, !tbaa !5
  %6 = load ptr, ptr %3, align 8
  %7 = getelementptr inbounds %struct.R3MeshProperty, ptr %6, i32 0, i32 0
  %8 = load ptr, ptr %4, align 8, !tbaa !5
  %9 = getelementptr inbounds %struct.R3MeshProperty, ptr %8, i32 0, i32 0
  %10 = load ptr, ptr %9, align 8, !tbaa !9
  store ptr %10, ptr %7, align 8, !tbaa !9
  %11 = getelementptr inbounds %struct.R3MeshProperty, ptr %6, i32 0, i32 2
  store i32 0, ptr %11, align 8, !tbaa !13
  %12 = getelementptr inbounds %struct.R3MeshProperty, ptr %6, i32 0, i32 3
  store ptr null, ptr %12, align 8, !tbaa !14
  %13 = getelementptr inbounds %struct.R3MeshProperty, ptr %6, i32 0, i32 4
  %14 = load ptr, ptr %4, align 8, !tbaa !5
  %15 = getelementptr inbounds %struct.R3MeshProperty, ptr %14, i32 0, i32 4
  %16 = load double, ptr %15, align 8, !tbaa !15
  store double %16, ptr %13, align 8, !tbaa !15
  %17 = getelementptr inbounds %struct.R3MeshProperty, ptr %6, i32 0, i32 5
  %18 = load ptr, ptr %4, align 8, !tbaa !5
  %19 = getelementptr inbounds %struct.R3MeshProperty, ptr %18, i32 0, i32 5
  %20 = load double, ptr %19, align 8, !tbaa !16
  store double %20, ptr %17, align 8, !tbaa !16
  %21 = getelementptr inbounds %struct.R3MeshProperty, ptr %6, i32 0, i32 6
  %22 = load ptr, ptr %4, align 8, !tbaa !5
  %23 = getelementptr inbounds %struct.R3MeshProperty, ptr %22, i32 0, i32 6
  %24 = load double, ptr %23, align 8, !tbaa !17
  store double %24, ptr %21, align 8, !tbaa !17
  %25 = getelementptr inbounds %struct.R3MeshProperty, ptr %6, i32 0, i32 7
  %26 = load ptr, ptr %4, align 8, !tbaa !5
  %27 = getelementptr inbounds %struct.R3MeshProperty, ptr %26, i32 0, i32 7
  %28 = load double, ptr %27, align 8, !tbaa !18
  store double %28, ptr %25, align 8, !tbaa !18
  %29 = getelementptr inbounds %struct.R3MeshProperty, ptr %6, i32 0, i32 8
  %30 = load ptr, ptr %4, align 8, !tbaa !5
  %31 = getelementptr inbounds %struct.R3MeshProperty, ptr %30, i32 0, i32 8
  %32 = load double, ptr %31, align 8, !tbaa !19
  store double %32, ptr %29, align 8, !tbaa !19
  %33 = getelementptr inbounds %struct.R3MeshProperty, ptr %6, i32 0, i32 9
  %34 = load ptr, ptr %4, align 8, !tbaa !5
  %35 = getelementptr inbounds %struct.R3MeshProperty, ptr %34, i32 0, i32 9
  %36 = load double, ptr %35, align 8, !tbaa !20
  store double %36, ptr %33, align 8, !tbaa !20
  %37 = getelementptr inbounds %struct.R3MeshProperty, ptr %6, i32 0, i32 1
  %38 = getelementptr inbounds [1024 x i8], ptr %37, i64 0, i64 0
  %39 = load ptr, ptr %4, align 8, !tbaa !5
  %40 = getelementptr inbounds %struct.R3MeshProperty, ptr %39, i32 0, i32 1
  %41 = getelementptr inbounds [1024 x i8], ptr %40, i64 0, i64 0
  %42 = call ptr @strcpy(ptr noundef %38, ptr noundef %41) #6
  %43 = getelementptr inbounds %struct.R3MeshProperty, ptr %6, i32 0, i32 0
  %44 = load ptr, ptr %43, align 8, !tbaa !9
  %45 = call noundef i32 @_ZNK6R3Mesh9NVerticesEv(ptr noundef nonnull align 8 dereferenceable(272) %44)
  %46 = getelementptr inbounds %struct.R3MeshProperty, ptr %6, i32 0, i32 2
  store i32 %45, ptr %46, align 8, !tbaa !13
  %47 = getelementptr inbounds %struct.R3MeshProperty, ptr %6, i32 0, i32 2
  %48 = load i32, ptr %47, align 8, !tbaa !13
  %49 = sext i32 %48 to i64
  %50 = call { i64, i1 } @llvm.umul.with.overflow.i64(i64 %49, i64 8)
  %51 = extractvalue { i64, i1 } %50, 1
  %52 = extractvalue { i64, i1 } %50, 0
  %53 = select i1 %51, i64 -1, i64 %52
  %54 = call noalias noundef nonnull ptr @_Znam(i64 noundef %53) #7
  %55 = getelementptr inbounds %struct.R3MeshProperty, ptr %6, i32 0, i32 3
  store ptr %54, ptr %55, align 8, !tbaa !14
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #6
  store i32 0, ptr %5, align 4, !tbaa !21
  br label %56

56:                                               ; preds = %76, %2
  %57 = load i32, ptr %5, align 4, !tbaa !21
  %58 = getelementptr inbounds %struct.R3MeshProperty, ptr %6, i32 0, i32 0
  %59 = load ptr, ptr %58, align 8, !tbaa !9
  %60 = call noundef i32 @_ZNK6R3Mesh9NVerticesEv(ptr noundef nonnull align 8 dereferenceable(272) %59)
  %61 = icmp slt i32 %57, %60
  br i1 %61, label %63, label %62

62:                                               ; preds = %56
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #6
  br label %79

63:                                               ; preds = %56
  %64 = load ptr, ptr %4, align 8, !tbaa !5
  %65 = getelementptr inbounds %struct.R3MeshProperty, ptr %64, i32 0, i32 3
  %66 = load ptr, ptr %65, align 8, !tbaa !14
  %67 = load i32, ptr %5, align 4, !tbaa !21
  %68 = sext i32 %67 to i64
  %69 = getelementptr inbounds double, ptr %66, i64 %68
  %70 = load double, ptr %69, align 8, !tbaa !22
  %71 = getelementptr inbounds %struct.R3MeshProperty, ptr %6, i32 0, i32 3
  %72 = load ptr, ptr %71, align 8, !tbaa !14
  %73 = load i32, ptr %5, align 4, !tbaa !21
  %74 = sext i32 %73 to i64
  %75 = getelementptr inbounds double, ptr %72, i64 %74
  store double %70, ptr %75, align 8, !tbaa !22
  br label %76

76:                                               ; preds = %63
  %77 = load i32, ptr %5, align 4, !tbaa !21
  %78 = add nsw i32 %77, 1
  store i32 %78, ptr %5, align 4, !tbaa !21
  br label %56, !llvm.loop !23

79:                                               ; preds = %62
  ret void
}

; Function Attrs: nounwind
declare ptr @strcpy(ptr noundef, ptr noundef) #5

attributes #0 = { 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 #1 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #2 = { nobuiltin allocsize(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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #4 = { 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 #5 = { 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 #6 = { nounwind }
attributes #7 = { builtin allocsize(0) }

!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, !6, i64 0}
!10 = !{!"_ZTS14R3MeshProperty", !6, i64 0, !7, i64 8, !11, i64 1032, !6, i64 1040, !12, i64 1048, !12, i64 1056, !12, i64 1064, !12, i64 1072, !12, i64 1080, !12, i64 1088}
!11 = !{!"int", !7, i64 0}
!12 = !{!"double", !7, i64 0}
!13 = !{!10, !11, i64 1032}
!14 = !{!10, !6, i64 1040}
!15 = !{!10, !12, i64 1048}
!16 = !{!10, !12, i64 1056}
!17 = !{!10, !12, i64 1064}
!18 = !{!10, !12, i64 1072}
!19 = !{!10, !12, i64 1080}
!20 = !{!10, !12, i64 1088}
!21 = !{!11, !11, i64 0}
!22 = !{!12, !12, i64 0}
!23 = distinct !{!23, !24}
!24 = !{!"llvm.loop.mustprogress"}


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

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef i32 @_ZNK6R3Mesh9NVerticesEv(ptr noundef nonnull align 8 dereferenceable(272)) local_unnamed_addr #0 align 2

; Function Attrs: nobuiltin allocsize(0)
declare noundef nonnull ptr @_Znam(i64 noundef) local_unnamed_addr #1

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN14R3MeshPropertyC2ERKS_(ptr noundef nonnull align 8 dereferenceable(1096) %0, ptr nocapture noundef nonnull readonly align 8 dereferenceable(1096) %1) unnamed_addr #2 align 2 {
  %3 = load ptr, ptr %1, align 8, !tbaa !5
  store ptr %3, ptr %0, align 8, !tbaa !5
  %4 = getelementptr inbounds i8, ptr %0, i64 1032
  store i32 0, ptr %4, align 8, !tbaa !12
  %5 = getelementptr inbounds i8, ptr %0, i64 1040
  store ptr null, ptr %5, align 8, !tbaa !13
  %6 = getelementptr inbounds i8, ptr %0, i64 1048
  %7 = getelementptr inbounds i8, ptr %1, i64 1048
  %8 = load <2 x double>, ptr %7, align 8, !tbaa !14
  store <2 x double> %8, ptr %6, align 8, !tbaa !14
  %9 = getelementptr inbounds i8, ptr %0, i64 1064
  %10 = getelementptr inbounds i8, ptr %1, i64 1064
  %11 = load <2 x double>, ptr %10, align 8, !tbaa !14
  store <2 x double> %11, ptr %9, align 8, !tbaa !14
  %12 = getelementptr inbounds i8, ptr %0, i64 1080
  %13 = getelementptr inbounds i8, ptr %1, i64 1080
  %14 = load <2 x double>, ptr %13, align 8, !tbaa !14
  store <2 x double> %14, ptr %12, align 8, !tbaa !14
  %15 = getelementptr inbounds i8, ptr %0, i64 8
  %16 = getelementptr inbounds i8, ptr %1, i64 8
  %17 = tail call ptr @strcpy(ptr noundef nonnull dereferenceable(1) %15, ptr noundef nonnull dereferenceable(1) %16) #4
  %18 = tail call noundef i32 @_ZNK6R3Mesh9NVerticesEv(ptr noundef nonnull align 8 dereferenceable(272) %3)
  store i32 %18, ptr %4, align 8, !tbaa !12
  %19 = zext nneg i32 %18 to i64
  %20 = icmp slt i32 %18, 0
  %21 = shl nuw nsw i64 %19, 3
  %22 = select i1 %20, i64 -1, i64 %21
  %23 = tail call noalias noundef nonnull ptr @_Znam(i64 noundef %22) #5
  store ptr %23, ptr %5, align 8, !tbaa !13
  %24 = load ptr, ptr %0, align 8, !tbaa !5
  %25 = tail call noundef i32 @_ZNK6R3Mesh9NVerticesEv(ptr noundef nonnull align 8 dereferenceable(272) %24)
  %26 = icmp sgt i32 %25, 0
  br i1 %26, label %.lr.ph, label %._crit_edge

.lr.ph:                                           ; preds = %2
  %27 = getelementptr inbounds i8, ptr %1, i64 1040
  br label %28

._crit_edge:                                      ; preds = %28, %2
  ret void

28:                                               ; preds = %.lr.ph, %28
  %indvars.iv = phi i64 [ 0, %.lr.ph ], [ %indvars.iv.next, %28 ]
  %29 = load ptr, ptr %27, align 8, !tbaa !13
  %30 = getelementptr inbounds double, ptr %29, i64 %indvars.iv
  %31 = load double, ptr %30, align 8, !tbaa !14
  %32 = load ptr, ptr %5, align 8, !tbaa !13
  %33 = getelementptr inbounds double, ptr %32, i64 %indvars.iv
  store double %31, ptr %33, align 8, !tbaa !14
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %34 = load ptr, ptr %0, align 8, !tbaa !5
  %35 = tail call noundef i32 @_ZNK6R3Mesh9NVerticesEv(ptr noundef nonnull align 8 dereferenceable(272) %34)
  %36 = sext i32 %35 to i64
  %37 = icmp slt i64 %indvars.iv.next, %36
  br i1 %37, label %28, label %._crit_edge, !llvm.loop !15
}

; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: readwrite)
declare ptr @strcpy(ptr noalias noundef returned writeonly, ptr noalias nocapture noundef readonly) local_unnamed_addr #3

attributes #0 = { 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 #1 = { nobuiltin allocsize(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" }
attributes #3 = { mustprogress nofree nounwind willreturn memory(argmem: readwrite) "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 }
attributes #5 = { builtin allocsize(0) }

!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, !7, i64 0}
!6 = !{!"_ZTS14R3MeshProperty", !7, i64 0, !8, i64 8, !10, i64 1032, !7, i64 1040, !11, i64 1048, !11, i64 1056, !11, i64 1064, !11, i64 1072, !11, i64 1080, !11, i64 1088}
!7 = !{!"any pointer", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!"int", !8, i64 0}
!11 = !{!"double", !8, i64 0}
!12 = !{!6, !10, i64 1032}
!13 = !{!6, !7, i64 1040}
!14 = !{!11, !11, i64 0}
!15 = distinct !{!15, !16}
!16 = !{!"llvm.loop.mustprogress"}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GlobalOptPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LICMPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,PostOrderFunctionAttrsPass,SLPVectorizerPass,SROAPass,SimplifyCFGPass,TailCallElimPass