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

; 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.R3MeshFace = type { ptr, [3 x ptr], [3 x ptr], %class.R3Plane, %class.R3Box, double, i32, i32, i32, i32, %class.RNFlags, double, i32, ptr }
%class.R3Plane = type { %class.R3Vector, double }
%class.R3Vector = type { [3 x double] }
%class.R3Box = type { %class.R3Solid, %class.R3Point, %class.R3Point }
%class.R3Solid = type { %class.R3Shape }
%class.R3Shape = type { ptr }
%class.R3Point = type { [3 x double] }
%class.RNFlags = type { i64 }

@_ZTV10R3MeshFace = external dso_local unnamed_addr constant { [4 x ptr] }, align 8

declare i32 @__gxx_personality_v0(...)

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZN7RNFlagsC2Em(ptr noundef nonnull align 8 dereferenceable(8), i64 noundef) unnamed_addr #0 align 2

; Function Attrs: nounwind
declare void @_ZN7R3SolidD2Ev(ptr noundef nonnull align 8 dereferenceable(8)) unnamed_addr #1

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN10R3MeshFaceC2Ev(ptr noundef nonnull align 8 dereferenceable(200) %0) unnamed_addr #2 align 2 personality ptr @__gxx_personality_v0 {
  %2 = alloca ptr, align 8
  %3 = alloca ptr, align 8
  %4 = alloca i32, align 4
  store ptr %0, ptr %2, align 8, !tbaa !5
  %5 = load ptr, ptr %2, align 8
  store ptr getelementptr inbounds inrange(-16, 16) ({ [4 x ptr] }, ptr @_ZTV10R3MeshFace, i32 0, i32 0, i32 2), ptr %5, align 8, !tbaa !9
  %6 = getelementptr inbounds %class.R3MeshFace, ptr %5, i32 0, i32 3
  call void @_ZN7R3PlaneC1Edddd(ptr noundef nonnull align 8 dereferenceable(32) %6, double noundef 0.000000e+00, double noundef 0.000000e+00, double noundef 0.000000e+00, double noundef 0.000000e+00)
  %7 = getelementptr inbounds %class.R3MeshFace, ptr %5, i32 0, i32 4
  call void @_ZN5R3BoxC1Edddddd(ptr noundef nonnull align 8 dereferenceable(56) %7, double noundef 1.000000e+00, double noundef 1.000000e+00, double noundef 1.000000e+00, double noundef -1.000000e+00, double noundef -1.000000e+00, double noundef -1.000000e+00)
  %8 = getelementptr inbounds %class.R3MeshFace, ptr %5, i32 0, i32 6
  store i32 -1, ptr %8, align 8, !tbaa !11
  %9 = getelementptr inbounds %class.R3MeshFace, ptr %5, i32 0, i32 7
  store i32 -1, ptr %9, align 4, !tbaa !23
  %10 = getelementptr inbounds %class.R3MeshFace, ptr %5, i32 0, i32 8
  store i32 -1, ptr %10, align 8, !tbaa !24
  %11 = getelementptr inbounds %class.R3MeshFace, ptr %5, i32 0, i32 9
  store i32 -1, ptr %11, align 4, !tbaa !25
  %12 = getelementptr inbounds %class.R3MeshFace, ptr %5, i32 0, i32 10
  invoke void @_ZN7RNFlagsC2Em(ptr noundef nonnull align 8 dereferenceable(8) %12, i64 noundef 0)
          to label %13 unwind label %29

13:                                               ; preds = %1
  %14 = getelementptr inbounds %class.R3MeshFace, ptr %5, i32 0, i32 11
  store double 0.000000e+00, ptr %14, align 8, !tbaa !26
  %15 = getelementptr inbounds %class.R3MeshFace, ptr %5, i32 0, i32 12
  store i32 0, ptr %15, align 8, !tbaa !27
  %16 = getelementptr inbounds %class.R3MeshFace, ptr %5, i32 0, i32 13
  store ptr null, ptr %16, align 8, !tbaa !28
  %17 = getelementptr inbounds %class.R3MeshFace, ptr %5, i32 0, i32 1
  %18 = getelementptr inbounds [3 x ptr], ptr %17, i64 0, i64 2
  store ptr null, ptr %18, align 8, !tbaa !5
  %19 = getelementptr inbounds %class.R3MeshFace, ptr %5, i32 0, i32 1
  %20 = getelementptr inbounds [3 x ptr], ptr %19, i64 0, i64 1
  store ptr null, ptr %20, align 8, !tbaa !5
  %21 = getelementptr inbounds %class.R3MeshFace, ptr %5, i32 0, i32 1
  %22 = getelementptr inbounds [3 x ptr], ptr %21, i64 0, i64 0
  store ptr null, ptr %22, align 8, !tbaa !5
  %23 = getelementptr inbounds %class.R3MeshFace, ptr %5, i32 0, i32 2
  %24 = getelementptr inbounds [3 x ptr], ptr %23, i64 0, i64 2
  store ptr null, ptr %24, align 8, !tbaa !5
  %25 = getelementptr inbounds %class.R3MeshFace, ptr %5, i32 0, i32 2
  %26 = getelementptr inbounds [3 x ptr], ptr %25, i64 0, i64 1
  store ptr null, ptr %26, align 8, !tbaa !5
  %27 = getelementptr inbounds %class.R3MeshFace, ptr %5, i32 0, i32 2
  %28 = getelementptr inbounds [3 x ptr], ptr %27, i64 0, i64 0
  store ptr null, ptr %28, align 8, !tbaa !5
  ret void

29:                                               ; preds = %1
  %30 = landingpad { ptr, i32 }
          cleanup
  %31 = extractvalue { ptr, i32 } %30, 0
  store ptr %31, ptr %3, align 8
  %32 = extractvalue { ptr, i32 } %30, 1
  store i32 %32, ptr %4, align 4
  call void @_ZN7R3SolidD2Ev(ptr noundef nonnull align 8 dereferenceable(56) %7) #4
  br label %33

33:                                               ; preds = %29
  %34 = load ptr, ptr %3, align 8
  %35 = load i32, ptr %4, align 4
  %36 = insertvalue { ptr, i32 } poison, ptr %34, 0
  %37 = insertvalue { ptr, i32 } %36, i32 %35, 1
  resume { ptr, i32 } %37
}

declare void @_ZN7R3PlaneC1Edddd(ptr noundef nonnull align 8 dereferenceable(32), double noundef, double noundef, double noundef, double noundef) unnamed_addr #3

declare void @_ZN5R3BoxC1Edddddd(ptr noundef nonnull align 8 dereferenceable(56), double noundef, double noundef, double noundef, double noundef, double noundef, double noundef) unnamed_addr #3

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 = { 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 #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 = { "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 = !{!"vtable pointer", !8, i64 0}
!11 = !{!12, !20, i64 152}
!12 = !{!"_ZTS10R3MeshFace", !7, i64 8, !7, i64 32, !13, i64 56, !16, i64 88, !15, i64 144, !20, i64 152, !20, i64 156, !20, i64 160, !20, i64 164, !21, i64 168, !15, i64 176, !20, i64 184, !6, i64 192}
!13 = !{!"_ZTS7R3Plane", !14, i64 0, !15, i64 24}
!14 = !{!"_ZTS8R3Vector", !7, i64 0}
!15 = !{!"double", !7, i64 0}
!16 = !{!"_ZTS5R3Box", !17, i64 0, !19, i64 8, !19, i64 32}
!17 = !{!"_ZTS7R3Solid", !18, i64 0}
!18 = !{!"_ZTS7R3Shape"}
!19 = !{!"_ZTS7R3Point", !7, i64 0}
!20 = !{!"int", !7, i64 0}
!21 = !{!"_ZTS7RNFlags", !22, i64 0}
!22 = !{!"long", !7, i64 0}
!23 = !{!12, !20, i64 156}
!24 = !{!12, !20, i64 160}
!25 = !{!12, !20, i64 164}
!26 = !{!12, !15, i64 176}
!27 = !{!12, !20, i64 184}
!28 = !{!12, !6, i64 192}


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

@_ZTV10R3MeshFace = external dso_local unnamed_addr constant { [4 x ptr] }, align 8

declare i32 @__gxx_personality_v0(...)

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZN7RNFlagsC2Em(ptr noundef nonnull align 8 dereferenceable(8), i64 noundef) unnamed_addr #0 align 2

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN10R3MeshFaceC2Ev(ptr noundef nonnull align 8 dereferenceable(200) %0) unnamed_addr #1 align 2 personality ptr @__gxx_personality_v0 {
  store ptr getelementptr inbounds inrange(-16, 16) (i8, ptr @_ZTV10R3MeshFace, i64 16), ptr %0, align 8, !tbaa !5
  %2 = getelementptr inbounds i8, ptr %0, i64 56
  tail call void @_ZN7R3PlaneC1Edddd(ptr noundef nonnull align 8 dereferenceable(32) %2, double noundef 0.000000e+00, double noundef 0.000000e+00, double noundef 0.000000e+00, double noundef 0.000000e+00)
  %3 = getelementptr inbounds i8, ptr %0, i64 88
  tail call void @_ZN5R3BoxC1Edddddd(ptr noundef nonnull align 8 dereferenceable(56) %3, double noundef 1.000000e+00, double noundef 1.000000e+00, double noundef 1.000000e+00, double noundef -1.000000e+00, double noundef -1.000000e+00, double noundef -1.000000e+00)
  %4 = getelementptr inbounds i8, ptr %0, i64 152
  %5 = getelementptr inbounds i8, ptr %0, i64 168
  tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(16) %4, i8 -1, i64 16, i1 false)
  tail call void @_ZN7RNFlagsC2Em(ptr noundef nonnull align 8 dereferenceable(8) %5, i64 noundef 0)
  %6 = getelementptr inbounds i8, ptr %0, i64 176
  store double 0.000000e+00, ptr %6, align 8, !tbaa !8
  %7 = getelementptr inbounds i8, ptr %0, i64 184
  store i32 0, ptr %7, align 8, !tbaa !22
  %8 = getelementptr inbounds i8, ptr %0, i64 192
  store ptr null, ptr %8, align 8, !tbaa !23
  %9 = getelementptr inbounds i8, ptr %0, i64 8
  tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(48) %9, i8 0, i64 48, i1 false)
  ret void
}

declare void @_ZN7R3PlaneC1Edddd(ptr noundef nonnull align 8 dereferenceable(32), double noundef, double noundef, double noundef, double noundef) unnamed_addr #2

declare void @_ZN5R3BoxC1Edddddd(ptr noundef nonnull align 8 dereferenceable(56), double noundef, double noundef, double noundef, double noundef, double noundef, double noundef) unnamed_addr #2

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #3

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 = { 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 = { "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 nounwind willreturn memory(argmem: write) }

!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 = !{!"vtable pointer", !7, i64 0}
!7 = !{!"Simple C++ TBAA"}
!8 = !{!9, !13, i64 176}
!9 = !{!"_ZTS10R3MeshFace", !10, i64 8, !10, i64 32, !11, i64 56, !14, i64 88, !13, i64 144, !18, i64 152, !18, i64 156, !18, i64 160, !18, i64 164, !19, i64 168, !13, i64 176, !18, i64 184, !21, i64 192}
!10 = !{!"omnipotent char", !7, i64 0}
!11 = !{!"_ZTS7R3Plane", !12, i64 0, !13, i64 24}
!12 = !{!"_ZTS8R3Vector", !10, i64 0}
!13 = !{!"double", !10, i64 0}
!14 = !{!"_ZTS5R3Box", !15, i64 0, !17, i64 8, !17, i64 32}
!15 = !{!"_ZTS7R3Solid", !16, i64 0}
!16 = !{!"_ZTS7R3Shape"}
!17 = !{!"_ZTS7R3Point", !10, i64 0}
!18 = !{!"int", !10, i64 0}
!19 = !{!"_ZTS7RNFlags", !20, i64 0}
!20 = !{!"long", !10, i64 0}
!21 = !{!"any pointer", !10, i64 0}
!22 = !{!9, !18, i64 184}
!23 = !{!9, !21, i64 192}


; Effective O3 passes: EarlyCSEPass,GlobalOptPass,InstCombinePass,MemCpyOptPass,SROAPass,SimplifyCFGPass,TailCallElimPass