; LLVM IR from Slingshot-Physics/slingshot-community :: common/geometry/src (geometry_type_converters)

; 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.geometry::types::gaussMapMesh_t" = type { i32, i32, i32, [1000 x %"struct.geometry::types::leanNeighborTriangle_t"], [500 x %class.Vector3], [1000 x %"struct.geometry::types::gaussMapFace_t"] }
%"struct.geometry::types::leanNeighborTriangle_t" = type { [3 x i32], [3 x i32] }
%class.Vector3 = type { [3 x float] }
%"struct.geometry::types::gaussMapFace_t" = type { %class.Vector3, i32, i32 }
%struct.data_gaussMapMesh_s = type { i32, [1000 x %struct.data_leanNeighborTriangle_s], i32, [500 x %struct.vector3], i32, [1000 x %struct.data_gaussMapFace_s] }
%struct.data_leanNeighborTriangle_s = type { [3 x i32], [3 x i32] }
%struct.vector3 = type { [3 x float] }
%struct.data_gaussMapFace_s = type { %struct.vector3, i32, i32 }

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN8geometry10converters6to_podERK7Vector3P7vector3(ptr noundef nonnull align 4 dereferenceable(12), ptr noundef) #0

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN8geometry10converters6to_podERKNS_5types22leanNeighborTriangle_tEP27data_leanNeighborTriangle_s(ptr noundef nonnull align 4 dereferenceable(24), ptr noundef) #2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN8geometry10converters6to_podERKNS_5types14gaussMapFace_tEP19data_gaussMapFace_s(ptr noundef nonnull align 4 dereferenceable(20), ptr noundef) #0

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN8geometry10converters6to_podERKNS_5types14gaussMapMesh_tEP19data_gaussMapMesh_s(ptr noundef nonnull align 4 dereferenceable(50012) %0, ptr noundef %1) #0 {
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  store ptr %0, ptr %3, align 8, !tbaa !5
  store ptr %1, ptr %4, align 8, !tbaa !5
  %8 = load ptr, ptr %3, align 8, !tbaa !5
  %9 = getelementptr inbounds %"struct.geometry::types::gaussMapMesh_t", ptr %8, i32 0, i32 2
  %10 = load i32, ptr %9, align 4, !tbaa !9
  %11 = load ptr, ptr %4, align 8, !tbaa !5
  %12 = getelementptr inbounds %struct.data_gaussMapMesh_s, ptr %11, i32 0, i32 4
  store i32 %10, ptr %12, align 4, !tbaa !12
  %13 = load ptr, ptr %3, align 8, !tbaa !5
  %14 = getelementptr inbounds %"struct.geometry::types::gaussMapMesh_t", ptr %13, i32 0, i32 0
  %15 = load i32, ptr %14, align 4, !tbaa !14
  %16 = load ptr, ptr %4, align 8, !tbaa !5
  %17 = getelementptr inbounds %struct.data_gaussMapMesh_s, ptr %16, i32 0, i32 0
  store i32 %15, ptr %17, align 4, !tbaa !15
  %18 = load ptr, ptr %3, align 8, !tbaa !5
  %19 = getelementptr inbounds %"struct.geometry::types::gaussMapMesh_t", ptr %18, i32 0, i32 1
  %20 = load i32, ptr %19, align 4, !tbaa !16
  %21 = load ptr, ptr %4, align 8, !tbaa !5
  %22 = getelementptr inbounds %struct.data_gaussMapMesh_s, ptr %21, i32 0, i32 2
  store i32 %20, ptr %22, align 4, !tbaa !17
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #3
  store i32 0, ptr %5, align 4, !tbaa !18
  br label %23

23:                                               ; preds = %41, %2
  %24 = load i32, ptr %5, align 4, !tbaa !18
  %25 = load ptr, ptr %3, align 8, !tbaa !5
  %26 = getelementptr inbounds %"struct.geometry::types::gaussMapMesh_t", ptr %25, i32 0, i32 1
  %27 = load i32, ptr %26, align 4, !tbaa !16
  %28 = icmp ult i32 %24, %27
  br i1 %28, label %30, label %29

29:                                               ; preds = %23
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #3
  br label %44

30:                                               ; preds = %23
  %31 = load ptr, ptr %3, align 8, !tbaa !5
  %32 = getelementptr inbounds %"struct.geometry::types::gaussMapMesh_t", ptr %31, i32 0, i32 4
  %33 = load i32, ptr %5, align 4, !tbaa !18
  %34 = zext i32 %33 to i64
  %35 = getelementptr inbounds [500 x %class.Vector3], ptr %32, i64 0, i64 %34
  %36 = load ptr, ptr %4, align 8, !tbaa !5
  %37 = getelementptr inbounds %struct.data_gaussMapMesh_s, ptr %36, i32 0, i32 3
  %38 = load i32, ptr %5, align 4, !tbaa !18
  %39 = zext i32 %38 to i64
  %40 = getelementptr inbounds [500 x %struct.vector3], ptr %37, i64 0, i64 %39
  call void @_ZN8geometry10converters6to_podERK7Vector3P7vector3(ptr noundef nonnull align 4 dereferenceable(12) %35, ptr noundef %40)
  br label %41

41:                                               ; preds = %30
  %42 = load i32, ptr %5, align 4, !tbaa !18
  %43 = add i32 %42, 1
  store i32 %43, ptr %5, align 4, !tbaa !18
  br label %23, !llvm.loop !19

44:                                               ; preds = %29
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #3
  store i32 0, ptr %6, align 4, !tbaa !18
  br label %45

45:                                               ; preds = %63, %44
  %46 = load i32, ptr %6, align 4, !tbaa !18
  %47 = load ptr, ptr %3, align 8, !tbaa !5
  %48 = getelementptr inbounds %"struct.geometry::types::gaussMapMesh_t", ptr %47, i32 0, i32 0
  %49 = load i32, ptr %48, align 4, !tbaa !14
  %50 = icmp ult i32 %46, %49
  br i1 %50, label %52, label %51

51:                                               ; preds = %45
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #3
  br label %66

52:                                               ; preds = %45
  %53 = load ptr, ptr %3, align 8, !tbaa !5
  %54 = getelementptr inbounds %"struct.geometry::types::gaussMapMesh_t", ptr %53, i32 0, i32 3
  %55 = load i32, ptr %6, align 4, !tbaa !18
  %56 = zext i32 %55 to i64
  %57 = getelementptr inbounds [1000 x %"struct.geometry::types::leanNeighborTriangle_t"], ptr %54, i64 0, i64 %56
  %58 = load ptr, ptr %4, align 8, !tbaa !5
  %59 = getelementptr inbounds %struct.data_gaussMapMesh_s, ptr %58, i32 0, i32 1
  %60 = load i32, ptr %6, align 4, !tbaa !18
  %61 = zext i32 %60 to i64
  %62 = getelementptr inbounds [1000 x %struct.data_leanNeighborTriangle_s], ptr %59, i64 0, i64 %61
  call void @_ZN8geometry10converters6to_podERKNS_5types22leanNeighborTriangle_tEP27data_leanNeighborTriangle_s(ptr noundef nonnull align 4 dereferenceable(24) %57, ptr noundef %62)
  br label %63

63:                                               ; preds = %52
  %64 = load i32, ptr %6, align 4, !tbaa !18
  %65 = add i32 %64, 1
  store i32 %65, ptr %6, align 4, !tbaa !18
  br label %45, !llvm.loop !21

66:                                               ; preds = %51
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #3
  store i32 0, ptr %7, align 4, !tbaa !18
  br label %67

67:                                               ; preds = %85, %66
  %68 = load i32, ptr %7, align 4, !tbaa !18
  %69 = load ptr, ptr %3, align 8, !tbaa !5
  %70 = getelementptr inbounds %"struct.geometry::types::gaussMapMesh_t", ptr %69, i32 0, i32 2
  %71 = load i32, ptr %70, align 4, !tbaa !9
  %72 = icmp ult i32 %68, %71
  br i1 %72, label %74, label %73

73:                                               ; preds = %67
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #3
  br label %88

74:                                               ; preds = %67
  %75 = load ptr, ptr %3, align 8, !tbaa !5
  %76 = getelementptr inbounds %"struct.geometry::types::gaussMapMesh_t", ptr %75, i32 0, i32 5
  %77 = load i32, ptr %7, align 4, !tbaa !18
  %78 = zext i32 %77 to i64
  %79 = getelementptr inbounds [1000 x %"struct.geometry::types::gaussMapFace_t"], ptr %76, i64 0, i64 %78
  %80 = load ptr, ptr %4, align 8, !tbaa !5
  %81 = getelementptr inbounds %struct.data_gaussMapMesh_s, ptr %80, i32 0, i32 5
  %82 = load i32, ptr %7, align 4, !tbaa !18
  %83 = zext i32 %82 to i64
  %84 = getelementptr inbounds [1000 x %struct.data_gaussMapFace_s], ptr %81, i64 0, i64 %83
  call void @_ZN8geometry10converters6to_podERKNS_5types14gaussMapFace_tEP19data_gaussMapFace_s(ptr noundef nonnull align 4 dereferenceable(20) %79, ptr noundef %84)
  br label %85

85:                                               ; preds = %74
  %86 = load i32, ptr %7, align 4, !tbaa !18
  %87 = add i32 %86, 1
  store i32 %87, ptr %7, align 4, !tbaa !18
  br label %67, !llvm.loop !22

88:                                               ; preds = %73
  ret void
}

attributes #0 = { 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 willreturn memory(argmem: readwrite) }
attributes #2 = { 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 #3 = { 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, !11, i64 8}
!10 = !{!"_ZTSN8geometry5types14gaussMapMesh_tE", !11, i64 0, !11, i64 4, !11, i64 8, !7, i64 12, !7, i64 24012, !7, i64 30012}
!11 = !{!"int", !7, i64 0}
!12 = !{!13, !11, i64 30008}
!13 = !{!"_ZTS19data_gaussMapMesh_s", !11, i64 0, !7, i64 4, !11, i64 24004, !7, i64 24008, !11, i64 30008, !7, i64 30012}
!14 = !{!10, !11, i64 0}
!15 = !{!13, !11, i64 0}
!16 = !{!10, !11, i64 4}
!17 = !{!13, !11, i64 24004}
!18 = !{!11, !11, i64 0}
!19 = distinct !{!19, !20}
!20 = !{!"llvm.loop.mustprogress"}
!21 = distinct !{!21, !20}
!22 = distinct !{!22, !20}


; 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.Vector3 = type { [3 x float] }
%struct.vector3 = type { [3 x float] }
%"struct.geometry::types::leanNeighborTriangle_t" = type { [3 x i32], [3 x i32] }
%struct.data_leanNeighborTriangle_s = type { [3 x i32], [3 x i32] }
%"struct.geometry::types::gaussMapFace_t" = type { %class.Vector3, i32, i32 }
%struct.data_gaussMapFace_s = type { %struct.vector3, i32, i32 }

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN8geometry10converters6to_podERK7Vector3P7vector3(ptr noundef nonnull align 4 dereferenceable(12), ptr noundef) local_unnamed_addr #0

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN8geometry10converters6to_podERKNS_5types22leanNeighborTriangle_tEP27data_leanNeighborTriangle_s(ptr noundef nonnull align 4 dereferenceable(24), ptr noundef) local_unnamed_addr #1

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN8geometry10converters6to_podERKNS_5types14gaussMapFace_tEP19data_gaussMapFace_s(ptr noundef nonnull align 4 dereferenceable(20), ptr noundef) local_unnamed_addr #0

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN8geometry10converters6to_podERKNS_5types14gaussMapMesh_tEP19data_gaussMapMesh_s(ptr noundef nonnull align 4 dereferenceable(50012) %0, ptr noundef %1) local_unnamed_addr #0 {
  %3 = getelementptr inbounds i8, ptr %0, i64 8
  %4 = load i32, ptr %3, align 4, !tbaa !5
  %5 = getelementptr inbounds i8, ptr %1, i64 30008
  store i32 %4, ptr %5, align 4, !tbaa !10
  %6 = load i32, ptr %0, align 4, !tbaa !12
  store i32 %6, ptr %1, align 4, !tbaa !13
  %7 = getelementptr inbounds i8, ptr %0, i64 4
  %8 = load i32, ptr %7, align 4, !tbaa !14
  %9 = getelementptr inbounds i8, ptr %1, i64 24004
  store i32 %8, ptr %9, align 4, !tbaa !15
  %.not = icmp eq i32 %8, 0
  br i1 %.not, label %.preheader28, label %.lr.ph

.lr.ph:                                           ; preds = %2
  %10 = getelementptr inbounds i8, ptr %0, i64 24012
  %11 = getelementptr inbounds i8, ptr %1, i64 24008
  br label %15

.preheader28.loopexit:                            ; preds = %15
  %.pre = load i32, ptr %0, align 4, !tbaa !12
  br label %.preheader28

.preheader28:                                     ; preds = %.preheader28.loopexit, %2
  %12 = phi i32 [ %.pre, %.preheader28.loopexit ], [ %6, %2 ]
  %.not34 = icmp eq i32 %12, 0
  br i1 %.not34, label %.preheader, label %.lr.ph31

.lr.ph31:                                         ; preds = %.preheader28
  %13 = getelementptr inbounds i8, ptr %0, i64 12
  %14 = getelementptr inbounds i8, ptr %1, i64 4
  br label %24

15:                                               ; preds = %.lr.ph, %15
  %indvars.iv = phi i64 [ 0, %.lr.ph ], [ %indvars.iv.next, %15 ]
  %16 = getelementptr inbounds [500 x %class.Vector3], ptr %10, i64 0, i64 %indvars.iv
  %17 = getelementptr inbounds [500 x %struct.vector3], ptr %11, i64 0, i64 %indvars.iv
  tail call void @_ZN8geometry10converters6to_podERK7Vector3P7vector3(ptr noundef nonnull align 4 dereferenceable(12) %16, ptr noundef nonnull %17)
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %18 = load i32, ptr %7, align 4, !tbaa !14
  %19 = zext i32 %18 to i64
  %20 = icmp ult i64 %indvars.iv.next, %19
  br i1 %20, label %15, label %.preheader28.loopexit, !llvm.loop !16

.preheader:                                       ; preds = %24, %.preheader28
  %21 = load i32, ptr %3, align 4, !tbaa !5
  %.not35 = icmp eq i32 %21, 0
  br i1 %.not35, label %._crit_edge, label %.lr.ph33

.lr.ph33:                                         ; preds = %.preheader
  %22 = getelementptr inbounds i8, ptr %0, i64 30012
  %23 = getelementptr inbounds i8, ptr %1, i64 30012
  br label %30

24:                                               ; preds = %.lr.ph31, %24
  %indvars.iv37 = phi i64 [ 0, %.lr.ph31 ], [ %indvars.iv.next38, %24 ]
  %25 = getelementptr inbounds [1000 x %"struct.geometry::types::leanNeighborTriangle_t"], ptr %13, i64 0, i64 %indvars.iv37
  %26 = getelementptr inbounds [1000 x %struct.data_leanNeighborTriangle_s], ptr %14, i64 0, i64 %indvars.iv37
  tail call void @_ZN8geometry10converters6to_podERKNS_5types22leanNeighborTriangle_tEP27data_leanNeighborTriangle_s(ptr noundef nonnull align 4 dereferenceable(24) %25, ptr noundef nonnull %26)
  %indvars.iv.next38 = add nuw nsw i64 %indvars.iv37, 1
  %27 = load i32, ptr %0, align 4, !tbaa !12
  %28 = zext i32 %27 to i64
  %29 = icmp ult i64 %indvars.iv.next38, %28
  br i1 %29, label %24, label %.preheader, !llvm.loop !18

._crit_edge:                                      ; preds = %30, %.preheader
  ret void

30:                                               ; preds = %.lr.ph33, %30
  %indvars.iv40 = phi i64 [ 0, %.lr.ph33 ], [ %indvars.iv.next41, %30 ]
  %31 = getelementptr inbounds [1000 x %"struct.geometry::types::gaussMapFace_t"], ptr %22, i64 0, i64 %indvars.iv40
  %32 = getelementptr inbounds [1000 x %struct.data_gaussMapFace_s], ptr %23, i64 0, i64 %indvars.iv40
  tail call void @_ZN8geometry10converters6to_podERKNS_5types14gaussMapFace_tEP19data_gaussMapFace_s(ptr noundef nonnull align 4 dereferenceable(20) %31, ptr noundef nonnull %32)
  %indvars.iv.next41 = add nuw nsw i64 %indvars.iv40, 1
  %33 = load i32, ptr %3, align 4, !tbaa !5
  %34 = zext i32 %33 to i64
  %35 = icmp ult i64 %indvars.iv.next41, %34
  br i1 %35, label %30, label %._crit_edge, !llvm.loop !19
}

attributes #0 = { 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 = { 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" }

!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 8}
!6 = !{!"_ZTSN8geometry5types14gaussMapMesh_tE", !7, i64 0, !7, i64 4, !7, i64 8, !8, i64 12, !8, i64 24012, !8, i64 30012}
!7 = !{!"int", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!11, !7, i64 30008}
!11 = !{!"_ZTS19data_gaussMapMesh_s", !7, i64 0, !8, i64 4, !7, i64 24004, !8, i64 24008, !7, i64 30008, !8, i64 30012}
!12 = !{!6, !7, i64 0}
!13 = !{!11, !7, i64 0}
!14 = !{!6, !7, i64 4}
!15 = !{!11, !7, i64 24004}
!16 = distinct !{!16, !17}
!17 = !{!"llvm.loop.mustprogress"}
!18 = distinct !{!18, !17}
!19 = distinct !{!19, !17}


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