; LLVM IR from Overload-Technologies/Overload :: Dependencies/assimp/code/PostProcessing (ConvertToLHProcess)

; 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.aiNodeAnim = type { %struct.aiString, i32, ptr, i32, ptr, i32, ptr, i32, i32 }
%struct.aiString = type { i32, [1024 x i8] }
%struct.aiVectorKey = type { double, %class.aiVector3t, i32 }
%class.aiVector3t = type { float, float, float }
%struct.aiQuatKey = type <{ double, %class.aiQuaterniont, i32, [4 x i8] }>
%class.aiQuaterniont = type { float, float, float, float }

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

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

; Function Attrs: mustprogress nounwind uwtable
define dso_local void @_ZN6Assimp21MakeLeftHandedProcess16ProcessAnimationEP10aiNodeAnim(ptr noundef nonnull align 8 dereferenceable(24) %0, ptr noundef %1) #1 align 2 {
  %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
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #2
  store i32 0, ptr %5, align 4, !tbaa !9
  br label %8

8:                                                ; preds = %26, %2
  %9 = load i32, ptr %5, align 4, !tbaa !9
  %10 = load ptr, ptr %4, align 8, !tbaa !5
  %11 = getelementptr inbounds %struct.aiNodeAnim, ptr %10, i32 0, i32 1
  %12 = load i32, ptr %11, align 4, !tbaa !11
  %13 = icmp ult i32 %9, %12
  br i1 %13, label %15, label %14

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

15:                                               ; preds = %8
  %16 = load ptr, ptr %4, align 8, !tbaa !5
  %17 = getelementptr inbounds %struct.aiNodeAnim, ptr %16, i32 0, i32 2
  %18 = load ptr, ptr %17, align 8, !tbaa !15
  %19 = load i32, ptr %5, align 4, !tbaa !9
  %20 = zext i32 %19 to i64
  %21 = getelementptr inbounds %struct.aiVectorKey, ptr %18, i64 %20
  %22 = getelementptr inbounds %struct.aiVectorKey, ptr %21, i32 0, i32 1
  %23 = getelementptr inbounds %class.aiVector3t, ptr %22, i32 0, i32 2
  %24 = load float, ptr %23, align 8, !tbaa !16
  %25 = fmul float %24, -1.000000e+00
  store float %25, ptr %23, align 8, !tbaa !16
  br label %26

26:                                               ; preds = %15
  %27 = load i32, ptr %5, align 4, !tbaa !9
  %28 = add i32 %27, 1
  store i32 %28, ptr %5, align 4, !tbaa !9
  br label %8, !llvm.loop !22

29:                                               ; preds = %14
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #2
  store i32 0, ptr %6, align 4, !tbaa !9
  br label %30

30:                                               ; preds = %58, %29
  %31 = load i32, ptr %6, align 4, !tbaa !9
  %32 = load ptr, ptr %4, align 8, !tbaa !5
  %33 = getelementptr inbounds %struct.aiNodeAnim, ptr %32, i32 0, i32 3
  %34 = load i32, ptr %33, align 8, !tbaa !24
  %35 = icmp ult i32 %31, %34
  br i1 %35, label %37, label %36

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

37:                                               ; preds = %30
  %38 = load ptr, ptr %4, align 8, !tbaa !5
  %39 = getelementptr inbounds %struct.aiNodeAnim, ptr %38, i32 0, i32 4
  %40 = load ptr, ptr %39, align 8, !tbaa !25
  %41 = load i32, ptr %6, align 4, !tbaa !9
  %42 = zext i32 %41 to i64
  %43 = getelementptr inbounds %struct.aiQuatKey, ptr %40, i64 %42
  %44 = getelementptr inbounds %struct.aiQuatKey, ptr %43, i32 0, i32 1
  %45 = getelementptr inbounds %class.aiQuaterniont, ptr %44, i32 0, i32 1
  %46 = load float, ptr %45, align 4, !tbaa !26
  %47 = fmul float %46, -1.000000e+00
  store float %47, ptr %45, align 4, !tbaa !26
  %48 = load ptr, ptr %4, align 8, !tbaa !5
  %49 = getelementptr inbounds %struct.aiNodeAnim, ptr %48, i32 0, i32 4
  %50 = load ptr, ptr %49, align 8, !tbaa !25
  %51 = load i32, ptr %6, align 4, !tbaa !9
  %52 = zext i32 %51 to i64
  %53 = getelementptr inbounds %struct.aiQuatKey, ptr %50, i64 %52
  %54 = getelementptr inbounds %struct.aiQuatKey, ptr %53, i32 0, i32 1
  %55 = getelementptr inbounds %class.aiQuaterniont, ptr %54, i32 0, i32 2
  %56 = load float, ptr %55, align 8, !tbaa !29
  %57 = fmul float %56, -1.000000e+00
  store float %57, ptr %55, align 8, !tbaa !29
  br label %58

58:                                               ; preds = %37
  %59 = load i32, ptr %6, align 4, !tbaa !9
  %60 = add i32 %59, 1
  store i32 %60, ptr %6, align 4, !tbaa !9
  br label %30, !llvm.loop !30

61:                                               ; preds = %36
  ret void
}

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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" }
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, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = !{!12, !10, i64 1028}
!12 = !{!"_ZTS10aiNodeAnim", !13, i64 0, !10, i64 1028, !6, i64 1032, !10, i64 1040, !6, i64 1048, !10, i64 1056, !6, i64 1064, !14, i64 1072, !14, i64 1076}
!13 = !{!"_ZTS8aiString", !10, i64 0, !7, i64 4}
!14 = !{!"_ZTS15aiAnimBehaviour", !7, i64 0}
!15 = !{!12, !6, i64 1032}
!16 = !{!17, !20, i64 16}
!17 = !{!"_ZTS11aiVectorKey", !18, i64 0, !19, i64 8, !21, i64 20}
!18 = !{!"double", !7, i64 0}
!19 = !{!"_ZTS10aiVector3tIfE", !20, i64 0, !20, i64 4, !20, i64 8}
!20 = !{!"float", !7, i64 0}
!21 = !{!"_ZTS19aiAnimInterpolation", !7, i64 0}
!22 = distinct !{!22, !23}
!23 = !{!"llvm.loop.mustprogress"}
!24 = !{!12, !10, i64 1040}
!25 = !{!12, !6, i64 1048}
!26 = !{!27, !20, i64 12}
!27 = !{!"_ZTS9aiQuatKey", !18, i64 0, !28, i64 8, !21, i64 24}
!28 = !{!"_ZTS13aiQuaterniontIfE", !20, i64 0, !20, i64 4, !20, i64 8, !20, i64 12}
!29 = !{!27, !20, i64 16}
!30 = distinct !{!30, !23}


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

%struct.aiVectorKey = type { double, %class.aiVector3t, i32 }
%class.aiVector3t = type { float, float, float }
%struct.aiQuatKey = type <{ double, %class.aiQuaterniont, i32, [4 x i8] }>
%class.aiQuaterniont = type { float, float, float, float }

; Function Attrs: mustprogress nofree norecurse nosync nounwind memory(readwrite, inaccessiblemem: none) uwtable
define dso_local void @_ZN6Assimp21MakeLeftHandedProcess16ProcessAnimationEP10aiNodeAnim(ptr nocapture noundef nonnull readnone align 8 dereferenceable(24) %0, ptr nocapture noundef readonly %1) local_unnamed_addr #0 align 2 {
  %3 = getelementptr inbounds i8, ptr %1, i64 1028
  %4 = load i32, ptr %3, align 4, !tbaa !5
  %.not = icmp eq i32 %4, 0
  br i1 %.not, label %.preheader, label %.lr.ph

.lr.ph:                                           ; preds = %2
  %5 = getelementptr inbounds i8, ptr %1, i64 1032
  %6 = load ptr, ptr %5, align 8, !tbaa !13
  %wide.trip.count = zext i32 %4 to i64
  %xtraiter = and i64 %wide.trip.count, 3
  %7 = icmp ult i32 %4, 4
  br i1 %7, label %.preheader.loopexit.unr-lcssa, label %.lr.ph.new

.lr.ph.new:                                       ; preds = %.lr.ph
  %unroll_iter = and i64 %wide.trip.count, 4294967292
  br label %16

.preheader.loopexit.unr-lcssa:                    ; preds = %16, %.lr.ph
  %indvars.iv.unr = phi i64 [ 0, %.lr.ph ], [ %indvars.iv.next.3, %16 ]
  %lcmp.mod.not = icmp eq i64 %xtraiter, 0
  br i1 %lcmp.mod.not, label %.preheader, label %.epil.preheader

.epil.preheader:                                  ; preds = %.preheader.loopexit.unr-lcssa, %.epil.preheader
  %indvars.iv.epil = phi i64 [ %indvars.iv.next.epil, %.epil.preheader ], [ %indvars.iv.unr, %.preheader.loopexit.unr-lcssa ]
  %epil.iter = phi i64 [ %epil.iter.next, %.epil.preheader ], [ 0, %.preheader.loopexit.unr-lcssa ]
  %8 = getelementptr inbounds %struct.aiVectorKey, ptr %6, i64 %indvars.iv.epil, i32 1, i32 2
  %9 = load float, ptr %8, align 8, !tbaa !14
  %10 = fneg float %9
  store float %10, ptr %8, align 8, !tbaa !14
  %indvars.iv.next.epil = add nuw nsw i64 %indvars.iv.epil, 1
  %epil.iter.next = add i64 %epil.iter, 1
  %epil.iter.cmp.not = icmp eq i64 %epil.iter.next, %xtraiter
  br i1 %epil.iter.cmp.not, label %.preheader, label %.epil.preheader, !llvm.loop !20

.preheader:                                       ; preds = %.preheader.loopexit.unr-lcssa, %.epil.preheader, %2
  %11 = getelementptr inbounds i8, ptr %1, i64 1040
  %12 = load i32, ptr %11, align 8, !tbaa !22
  %.not16 = icmp eq i32 %12, 0
  br i1 %.not16, label %._crit_edge, label %.lr.ph15

.lr.ph15:                                         ; preds = %.preheader
  %13 = getelementptr inbounds i8, ptr %1, i64 1048
  %14 = load ptr, ptr %13, align 8, !tbaa !23
  %wide.trip.count21 = zext i32 %12 to i64
  %xtraiter24 = and i64 %wide.trip.count21, 3
  %15 = icmp ult i32 %12, 4
  br i1 %15, label %._crit_edge.loopexit.unr-lcssa, label %.lr.ph15.new

.lr.ph15.new:                                     ; preds = %.lr.ph15
  %unroll_iter27 = and i64 %wide.trip.count21, 4294967292
  br label %32

16:                                               ; preds = %16, %.lr.ph.new
  %indvars.iv = phi i64 [ 0, %.lr.ph.new ], [ %indvars.iv.next.3, %16 ]
  %niter = phi i64 [ 0, %.lr.ph.new ], [ %niter.next.3, %16 ]
  %17 = getelementptr inbounds %struct.aiVectorKey, ptr %6, i64 %indvars.iv, i32 1, i32 2
  %18 = load float, ptr %17, align 8, !tbaa !14
  %19 = fneg float %18
  store float %19, ptr %17, align 8, !tbaa !14
  %indvars.iv.next = or disjoint i64 %indvars.iv, 1
  %20 = getelementptr inbounds %struct.aiVectorKey, ptr %6, i64 %indvars.iv.next, i32 1, i32 2
  %21 = load float, ptr %20, align 8, !tbaa !14
  %22 = fneg float %21
  store float %22, ptr %20, align 8, !tbaa !14
  %indvars.iv.next.1 = or disjoint i64 %indvars.iv, 2
  %23 = getelementptr inbounds %struct.aiVectorKey, ptr %6, i64 %indvars.iv.next.1, i32 1, i32 2
  %24 = load float, ptr %23, align 8, !tbaa !14
  %25 = fneg float %24
  store float %25, ptr %23, align 8, !tbaa !14
  %indvars.iv.next.2 = or disjoint i64 %indvars.iv, 3
  %26 = getelementptr inbounds %struct.aiVectorKey, ptr %6, i64 %indvars.iv.next.2, i32 1, i32 2
  %27 = load float, ptr %26, align 8, !tbaa !14
  %28 = fneg float %27
  store float %28, ptr %26, align 8, !tbaa !14
  %indvars.iv.next.3 = add nuw nsw i64 %indvars.iv, 4
  %niter.next.3 = add i64 %niter, 4
  %niter.ncmp.3 = icmp eq i64 %niter.next.3, %unroll_iter
  br i1 %niter.ncmp.3, label %.preheader.loopexit.unr-lcssa, label %16, !llvm.loop !24

._crit_edge.loopexit.unr-lcssa:                   ; preds = %32, %.lr.ph15
  %indvars.iv18.unr = phi i64 [ 0, %.lr.ph15 ], [ %indvars.iv.next19.3, %32 ]
  %lcmp.mod26.not = icmp eq i64 %xtraiter24, 0
  br i1 %lcmp.mod26.not, label %._crit_edge, label %.epil.preheader23

.epil.preheader23:                                ; preds = %._crit_edge.loopexit.unr-lcssa, %.epil.preheader23
  %indvars.iv18.epil = phi i64 [ %indvars.iv.next19.epil, %.epil.preheader23 ], [ %indvars.iv18.unr, %._crit_edge.loopexit.unr-lcssa ]
  %epil.iter25 = phi i64 [ %epil.iter25.next, %.epil.preheader23 ], [ 0, %._crit_edge.loopexit.unr-lcssa ]
  %29 = getelementptr inbounds %struct.aiQuatKey, ptr %14, i64 %indvars.iv18.epil, i32 1, i32 1
  %30 = load <2 x float>, ptr %29, align 4, !tbaa !26
  %31 = fneg <2 x float> %30
  store <2 x float> %31, ptr %29, align 4, !tbaa !26
  %indvars.iv.next19.epil = add nuw nsw i64 %indvars.iv18.epil, 1
  %epil.iter25.next = add i64 %epil.iter25, 1
  %epil.iter25.cmp.not = icmp eq i64 %epil.iter25.next, %xtraiter24
  br i1 %epil.iter25.cmp.not, label %._crit_edge, label %.epil.preheader23, !llvm.loop !27

._crit_edge:                                      ; preds = %._crit_edge.loopexit.unr-lcssa, %.epil.preheader23, %.preheader
  ret void

32:                                               ; preds = %32, %.lr.ph15.new
  %indvars.iv18 = phi i64 [ 0, %.lr.ph15.new ], [ %indvars.iv.next19.3, %32 ]
  %niter28 = phi i64 [ 0, %.lr.ph15.new ], [ %niter28.next.3, %32 ]
  %33 = getelementptr inbounds %struct.aiQuatKey, ptr %14, i64 %indvars.iv18, i32 1, i32 1
  %34 = load <2 x float>, ptr %33, align 4, !tbaa !26
  %35 = fneg <2 x float> %34
  store <2 x float> %35, ptr %33, align 4, !tbaa !26
  %indvars.iv.next19 = or disjoint i64 %indvars.iv18, 1
  %36 = getelementptr inbounds %struct.aiQuatKey, ptr %14, i64 %indvars.iv.next19, i32 1, i32 1
  %37 = load <2 x float>, ptr %36, align 4, !tbaa !26
  %38 = fneg <2 x float> %37
  store <2 x float> %38, ptr %36, align 4, !tbaa !26
  %indvars.iv.next19.1 = or disjoint i64 %indvars.iv18, 2
  %39 = getelementptr inbounds %struct.aiQuatKey, ptr %14, i64 %indvars.iv.next19.1, i32 1, i32 1
  %40 = load <2 x float>, ptr %39, align 4, !tbaa !26
  %41 = fneg <2 x float> %40
  store <2 x float> %41, ptr %39, align 4, !tbaa !26
  %indvars.iv.next19.2 = or disjoint i64 %indvars.iv18, 3
  %42 = getelementptr inbounds %struct.aiQuatKey, ptr %14, i64 %indvars.iv.next19.2, i32 1, i32 1
  %43 = load <2 x float>, ptr %42, align 4, !tbaa !26
  %44 = fneg <2 x float> %43
  store <2 x float> %44, ptr %42, align 4, !tbaa !26
  %indvars.iv.next19.3 = add nuw nsw i64 %indvars.iv18, 4
  %niter28.next.3 = add i64 %niter28, 4
  %niter28.ncmp.3 = icmp eq i64 %niter28.next.3, %unroll_iter27
  br i1 %niter28.ncmp.3, label %._crit_edge.loopexit.unr-lcssa, label %32, !llvm.loop !28
}

attributes #0 = { mustprogress nofree norecurse nosync nounwind memory(readwrite, inaccessiblemem: none) 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, !8, i64 1028}
!6 = !{!"_ZTS10aiNodeAnim", !7, i64 0, !8, i64 1028, !11, i64 1032, !8, i64 1040, !11, i64 1048, !8, i64 1056, !11, i64 1064, !12, i64 1072, !12, i64 1076}
!7 = !{!"_ZTS8aiString", !8, i64 0, !9, i64 4}
!8 = !{!"int", !9, i64 0}
!9 = !{!"omnipotent char", !10, i64 0}
!10 = !{!"Simple C++ TBAA"}
!11 = !{!"any pointer", !9, i64 0}
!12 = !{!"_ZTS15aiAnimBehaviour", !9, i64 0}
!13 = !{!6, !11, i64 1032}
!14 = !{!15, !18, i64 16}
!15 = !{!"_ZTS11aiVectorKey", !16, i64 0, !17, i64 8, !19, i64 20}
!16 = !{!"double", !9, i64 0}
!17 = !{!"_ZTS10aiVector3tIfE", !18, i64 0, !18, i64 4, !18, i64 8}
!18 = !{!"float", !9, i64 0}
!19 = !{!"_ZTS19aiAnimInterpolation", !9, i64 0}
!20 = distinct !{!20, !21}
!21 = !{!"llvm.loop.unroll.disable"}
!22 = !{!6, !8, i64 1040}
!23 = !{!6, !11, i64 1048}
!24 = distinct !{!24, !25}
!25 = !{!"llvm.loop.mustprogress"}
!26 = !{!18, !18, i64 0}
!27 = distinct !{!27, !21}
!28 = distinct !{!28, !25}


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