; 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::minkowskiDiffSimplex_t" = type { [4 x i32], [4 x i32], %class.Vector4, i32, [4 x %class.Vector3], [4 x %class.Vector3], [4 x %class.Vector3] }
%class.Vector4 = type { [4 x float] }
%class.Vector3 = type { [3 x float] }
%struct.data_minkowskiDiffSimplex_s = type { [4 x i32], [4 x i32], %struct.vector4, i32, [4 x %struct.vector3], [4 x %struct.vector3], [4 x %struct.vector3] }
%struct.vector4 = type { [4 x float] }
%struct.vector3 = type { [3 x float] }

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN8geometry10converters6to_podERK7Vector4P7vector4(ptr noundef nonnull align 4 dereferenceable(16), 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 uwtable
define dso_local void @_ZN8geometry10converters6to_podERKNS_5types22minkowskiDiffSimplex_tEP27data_minkowskiDiffSimplex_s(ptr noundef nonnull align 4 dereferenceable(196) %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
  store ptr %0, ptr %3, align 8, !tbaa !5
  store ptr %1, ptr %4, align 8, !tbaa !5
  %7 = load ptr, ptr %3, align 8, !tbaa !5
  %8 = getelementptr inbounds %"struct.geometry::types::minkowskiDiffSimplex_t", ptr %7, i32 0, i32 3
  %9 = load i32, ptr %8, align 4, !tbaa !9
  %10 = load ptr, ptr %4, align 8, !tbaa !5
  %11 = getelementptr inbounds %struct.data_minkowskiDiffSimplex_s, ptr %10, i32 0, i32 3
  store i32 %9, ptr %11, align 4, !tbaa !13
  %12 = load ptr, ptr %3, align 8, !tbaa !5
  %13 = getelementptr inbounds %"struct.geometry::types::minkowskiDiffSimplex_t", ptr %12, i32 0, i32 2
  %14 = load ptr, ptr %4, align 8, !tbaa !5
  %15 = getelementptr inbounds %struct.data_minkowskiDiffSimplex_s, ptr %14, i32 0, i32 2
  call void @_ZN8geometry10converters6to_podERK7Vector4P7vector4(ptr noundef nonnull align 4 dereferenceable(16) %13, ptr noundef %15)
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #2
  store i32 0, ptr %5, align 4, !tbaa !16
  br label %16

16:                                               ; preds = %54, %2
  %17 = load i32, ptr %5, align 4, !tbaa !16
  %18 = load ptr, ptr %3, align 8, !tbaa !5
  %19 = getelementptr inbounds %"struct.geometry::types::minkowskiDiffSimplex_t", ptr %18, i32 0, i32 3
  %20 = load i32, ptr %19, align 4, !tbaa !9
  %21 = icmp ult i32 %17, %20
  br i1 %21, label %23, label %22

22:                                               ; preds = %16
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #2
  br label %57

23:                                               ; preds = %16
  %24 = load ptr, ptr %3, align 8, !tbaa !5
  %25 = getelementptr inbounds %"struct.geometry::types::minkowskiDiffSimplex_t", ptr %24, i32 0, i32 5
  %26 = load i32, ptr %5, align 4, !tbaa !16
  %27 = zext i32 %26 to i64
  %28 = getelementptr inbounds [4 x %class.Vector3], ptr %25, i64 0, i64 %27
  %29 = load ptr, ptr %4, align 8, !tbaa !5
  %30 = getelementptr inbounds %struct.data_minkowskiDiffSimplex_s, ptr %29, i32 0, i32 5
  %31 = load i32, ptr %5, align 4, !tbaa !16
  %32 = zext i32 %31 to i64
  %33 = getelementptr inbounds [4 x %struct.vector3], ptr %30, i64 0, i64 %32
  call void @_ZN8geometry10converters6to_podERK7Vector3P7vector3(ptr noundef nonnull align 4 dereferenceable(12) %28, ptr noundef %33)
  %34 = load ptr, ptr %3, align 8, !tbaa !5
  %35 = getelementptr inbounds %"struct.geometry::types::minkowskiDiffSimplex_t", ptr %34, i32 0, i32 6
  %36 = load i32, ptr %5, align 4, !tbaa !16
  %37 = zext i32 %36 to i64
  %38 = getelementptr inbounds [4 x %class.Vector3], ptr %35, i64 0, i64 %37
  %39 = load ptr, ptr %4, align 8, !tbaa !5
  %40 = getelementptr inbounds %struct.data_minkowskiDiffSimplex_s, ptr %39, i32 0, i32 6
  %41 = load i32, ptr %5, align 4, !tbaa !16
  %42 = zext i32 %41 to i64
  %43 = getelementptr inbounds [4 x %struct.vector3], ptr %40, i64 0, i64 %42
  call void @_ZN8geometry10converters6to_podERK7Vector3P7vector3(ptr noundef nonnull align 4 dereferenceable(12) %38, ptr noundef %43)
  %44 = load ptr, ptr %3, align 8, !tbaa !5
  %45 = getelementptr inbounds %"struct.geometry::types::minkowskiDiffSimplex_t", ptr %44, i32 0, i32 4
  %46 = load i32, ptr %5, align 4, !tbaa !16
  %47 = zext i32 %46 to i64
  %48 = getelementptr inbounds [4 x %class.Vector3], ptr %45, i64 0, i64 %47
  %49 = load ptr, ptr %4, align 8, !tbaa !5
  %50 = getelementptr inbounds %struct.data_minkowskiDiffSimplex_s, ptr %49, i32 0, i32 4
  %51 = load i32, ptr %5, align 4, !tbaa !16
  %52 = zext i32 %51 to i64
  %53 = getelementptr inbounds [4 x %struct.vector3], ptr %50, i64 0, i64 %52
  call void @_ZN8geometry10converters6to_podERK7Vector3P7vector3(ptr noundef nonnull align 4 dereferenceable(12) %48, ptr noundef %53)
  br label %54

54:                                               ; preds = %23
  %55 = load i32, ptr %5, align 4, !tbaa !16
  %56 = add i32 %55, 1
  store i32 %56, ptr %5, align 4, !tbaa !16
  br label %16, !llvm.loop !17

57:                                               ; preds = %22
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #2
  store i32 0, ptr %6, align 4, !tbaa !16
  br label %58

58:                                               ; preds = %88, %57
  %59 = load i32, ptr %6, align 4, !tbaa !16
  %60 = load ptr, ptr %3, align 8, !tbaa !5
  %61 = getelementptr inbounds %"struct.geometry::types::minkowskiDiffSimplex_t", ptr %60, i32 0, i32 3
  %62 = load i32, ptr %61, align 4, !tbaa !9
  %63 = icmp ult i32 %59, %62
  br i1 %63, label %65, label %64

64:                                               ; preds = %58
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #2
  br label %91

65:                                               ; preds = %58
  %66 = load ptr, ptr %3, align 8, !tbaa !5
  %67 = getelementptr inbounds %"struct.geometry::types::minkowskiDiffSimplex_t", ptr %66, i32 0, i32 0
  %68 = load i32, ptr %6, align 4, !tbaa !16
  %69 = zext i32 %68 to i64
  %70 = getelementptr inbounds [4 x i32], ptr %67, i64 0, i64 %69
  %71 = load i32, ptr %70, align 4, !tbaa !16
  %72 = load ptr, ptr %4, align 8, !tbaa !5
  %73 = getelementptr inbounds %struct.data_minkowskiDiffSimplex_s, ptr %72, i32 0, i32 0
  %74 = load i32, ptr %6, align 4, !tbaa !16
  %75 = zext i32 %74 to i64
  %76 = getelementptr inbounds [4 x i32], ptr %73, i64 0, i64 %75
  store i32 %71, ptr %76, align 4, !tbaa !16
  %77 = load ptr, ptr %3, align 8, !tbaa !5
  %78 = getelementptr inbounds %"struct.geometry::types::minkowskiDiffSimplex_t", ptr %77, i32 0, i32 1
  %79 = load i32, ptr %6, align 4, !tbaa !16
  %80 = zext i32 %79 to i64
  %81 = getelementptr inbounds [4 x i32], ptr %78, i64 0, i64 %80
  %82 = load i32, ptr %81, align 4, !tbaa !16
  %83 = load ptr, ptr %4, align 8, !tbaa !5
  %84 = getelementptr inbounds %struct.data_minkowskiDiffSimplex_s, ptr %83, i32 0, i32 1
  %85 = load i32, ptr %6, align 4, !tbaa !16
  %86 = zext i32 %85 to i64
  %87 = getelementptr inbounds [4 x i32], ptr %84, i64 0, i64 %86
  store i32 %82, ptr %87, align 4, !tbaa !16
  br label %88

88:                                               ; preds = %65
  %89 = load i32, ptr %6, align 4, !tbaa !16
  %90 = add i32 %89, 1
  store i32 %90, ptr %6, align 4, !tbaa !16
  br label %58, !llvm.loop !19

91:                                               ; preds = %64
  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 = { 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, !12, i64 48}
!10 = !{!"_ZTSN8geometry5types22minkowskiDiffSimplex_tE", !7, i64 0, !7, i64 16, !11, i64 32, !12, i64 48, !7, i64 52, !7, i64 100, !7, i64 148}
!11 = !{!"_ZTS7Vector4", !7, i64 0}
!12 = !{!"int", !7, i64 0}
!13 = !{!14, !12, i64 48}
!14 = !{!"_ZTS27data_minkowskiDiffSimplex_s", !7, i64 0, !7, i64 16, !15, i64 32, !12, i64 48, !7, i64 52, !7, i64 100, !7, i64 148}
!15 = !{!"_ZTS7vector4", !7, i64 0}
!16 = !{!12, !12, i64 0}
!17 = distinct !{!17, !18}
!18 = !{!"llvm.loop.mustprogress"}
!19 = distinct !{!19, !18}


; 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] }

; 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 uwtable
declare dso_local void @_ZN8geometry10converters6to_podERK7Vector4P7vector4(ptr noundef nonnull align 4 dereferenceable(16), ptr noundef) local_unnamed_addr #0

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN8geometry10converters6to_podERKNS_5types22minkowskiDiffSimplex_tEP27data_minkowskiDiffSimplex_s(ptr noundef nonnull align 4 dereferenceable(196) %0, ptr noundef %1) local_unnamed_addr #0 {
  %3 = getelementptr inbounds i8, ptr %0, i64 48
  %4 = load i32, ptr %3, align 4, !tbaa !5
  %5 = getelementptr inbounds i8, ptr %1, i64 48
  store i32 %4, ptr %5, align 4, !tbaa !11
  %6 = getelementptr inbounds i8, ptr %0, i64 32
  %7 = getelementptr inbounds i8, ptr %1, i64 32
  tail call void @_ZN8geometry10converters6to_podERK7Vector4P7vector4(ptr noundef nonnull align 4 dereferenceable(16) %6, ptr noundef nonnull %7)
  %8 = load i32, ptr %3, align 4, !tbaa !5
  %.not = icmp eq i32 %8, 0
  br i1 %.not, label %._crit_edge, label %.lr.ph

.lr.ph:                                           ; preds = %2
  %9 = getelementptr inbounds i8, ptr %0, i64 100
  %10 = getelementptr inbounds i8, ptr %1, i64 100
  %11 = getelementptr inbounds i8, ptr %0, i64 148
  %12 = getelementptr inbounds i8, ptr %1, i64 148
  %13 = getelementptr inbounds i8, ptr %0, i64 52
  %14 = getelementptr inbounds i8, ptr %1, i64 52
  br label %18

.preheader:                                       ; preds = %18
  %15 = icmp eq i32 %25, 0
  br i1 %15, label %._crit_edge, label %.lr.ph32

.lr.ph32:                                         ; preds = %.preheader
  %16 = getelementptr inbounds i8, ptr %0, i64 16
  %17 = getelementptr inbounds i8, ptr %1, i64 16
  br label %28

18:                                               ; preds = %.lr.ph, %18
  %indvars.iv = phi i64 [ 0, %.lr.ph ], [ %indvars.iv.next, %18 ]
  %19 = getelementptr inbounds [4 x %class.Vector3], ptr %9, i64 0, i64 %indvars.iv
  %20 = getelementptr inbounds [4 x %struct.vector3], ptr %10, i64 0, i64 %indvars.iv
  tail call void @_ZN8geometry10converters6to_podERK7Vector3P7vector3(ptr noundef nonnull align 4 dereferenceable(12) %19, ptr noundef nonnull %20)
  %21 = getelementptr inbounds [4 x %class.Vector3], ptr %11, i64 0, i64 %indvars.iv
  %22 = getelementptr inbounds [4 x %struct.vector3], ptr %12, i64 0, i64 %indvars.iv
  tail call void @_ZN8geometry10converters6to_podERK7Vector3P7vector3(ptr noundef nonnull align 4 dereferenceable(12) %21, ptr noundef nonnull %22)
  %23 = getelementptr inbounds [4 x %class.Vector3], ptr %13, i64 0, i64 %indvars.iv
  %24 = getelementptr inbounds [4 x %struct.vector3], ptr %14, i64 0, i64 %indvars.iv
  tail call void @_ZN8geometry10converters6to_podERK7Vector3P7vector3(ptr noundef nonnull align 4 dereferenceable(12) %23, ptr noundef nonnull %24)
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %25 = load i32, ptr %3, align 4, !tbaa !5
  %26 = zext i32 %25 to i64
  %27 = icmp ult i64 %indvars.iv.next, %26
  br i1 %27, label %18, label %.preheader, !llvm.loop !14

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

28:                                               ; preds = %.lr.ph32, %28
  %indvars.iv35 = phi i64 [ 0, %.lr.ph32 ], [ %indvars.iv.next36, %28 ]
  %29 = getelementptr inbounds [4 x i32], ptr %0, i64 0, i64 %indvars.iv35
  %30 = load i32, ptr %29, align 4, !tbaa !16
  %31 = getelementptr inbounds [4 x i32], ptr %1, i64 0, i64 %indvars.iv35
  store i32 %30, ptr %31, align 4, !tbaa !16
  %32 = getelementptr inbounds [4 x i32], ptr %16, i64 0, i64 %indvars.iv35
  %33 = load i32, ptr %32, align 4, !tbaa !16
  %34 = getelementptr inbounds [4 x i32], ptr %17, i64 0, i64 %indvars.iv35
  store i32 %33, ptr %34, align 4, !tbaa !16
  %indvars.iv.next36 = add nuw nsw i64 %indvars.iv35, 1
  %35 = load i32, ptr %3, align 4, !tbaa !5
  %36 = zext i32 %35 to i64
  %37 = icmp ult i64 %indvars.iv.next36, %36
  br i1 %37, label %28, label %._crit_edge, !llvm.loop !17
}

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

!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, !10, i64 48}
!6 = !{!"_ZTSN8geometry5types22minkowskiDiffSimplex_tE", !7, i64 0, !7, i64 16, !9, i64 32, !10, i64 48, !7, i64 52, !7, i64 100, !7, i64 148}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!"_ZTS7Vector4", !7, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = !{!12, !10, i64 48}
!12 = !{!"_ZTS27data_minkowskiDiffSimplex_s", !7, i64 0, !7, i64 16, !13, i64 32, !10, i64 48, !7, i64 52, !7, i64 100, !7, i64 148}
!13 = !{!"_ZTS7vector4", !7, i64 0}
!14 = distinct !{!14, !15}
!15 = !{!"llvm.loop.mustprogress"}
!16 = !{!10, !10, i64 0}
!17 = distinct !{!17, !15}


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