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

; 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.aiMesh = type { i32, i32, i32, ptr, ptr, ptr, ptr, [8 x ptr], [8 x ptr], [8 x i32], ptr, i32, ptr, i32, %struct.aiString, i32, ptr, i32, %struct.aiAABB, ptr }
%struct.aiString = type { i32, [1024 x i8] }
%struct.aiAABB = type { %class.aiVector3t, %class.aiVector3t }
%class.aiVector3t = type { float, float, float }
%struct.aiBone = type { %struct.aiString, i32, ptr, ptr, ptr, %class.aiMatrix4x4t }
%class.aiMatrix4x4t = type { float, float, float, float, float, float, float, float, float, float, float, float, float, float, float, float }
%struct.aiVertexWeight = type { i32, float }

; Function Attrs: mustprogress uwtable
define dso_local noundef zeroext i1 @_Z12CompareBonesPK6aiMeshS1_(ptr noundef %0, ptr noundef %1) #0 {
  %3 = alloca i1, align 1
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  %8 = alloca ptr, align 8
  %9 = alloca ptr, align 8
  %10 = alloca i32, align 4
  store ptr %0, ptr %4, align 8, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #3
  store i32 0, ptr %6, align 4, !tbaa !9
  br label %11

11:                                               ; preds = %103, %2
  %12 = load i32, ptr %6, align 4, !tbaa !9
  %13 = load ptr, ptr %4, align 8, !tbaa !5
  %14 = getelementptr inbounds %struct.aiMesh, ptr %13, i32 0, i32 11
  %15 = load i32, ptr %14, align 8, !tbaa !11
  %16 = icmp ult i32 %12, %15
  br i1 %16, label %18, label %17

17:                                               ; preds = %11
  store i32 2, ptr %7, align 4
  br label %106

18:                                               ; preds = %11
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #3
  %19 = load ptr, ptr %4, align 8, !tbaa !5
  %20 = getelementptr inbounds %struct.aiMesh, ptr %19, i32 0, i32 12
  %21 = load ptr, ptr %20, align 8, !tbaa !18
  %22 = load i32, ptr %6, align 4, !tbaa !9
  %23 = zext i32 %22 to i64
  %24 = getelementptr inbounds ptr, ptr %21, i64 %23
  %25 = load ptr, ptr %24, align 8, !tbaa !5
  store ptr %25, ptr %8, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #3
  %26 = load ptr, ptr %5, align 8, !tbaa !5
  %27 = getelementptr inbounds %struct.aiMesh, ptr %26, i32 0, i32 12
  %28 = load ptr, ptr %27, align 8, !tbaa !18
  %29 = load i32, ptr %6, align 4, !tbaa !9
  %30 = zext i32 %29 to i64
  %31 = getelementptr inbounds ptr, ptr %28, i64 %30
  %32 = load ptr, ptr %31, align 8, !tbaa !5
  store ptr %32, ptr %9, align 8, !tbaa !5
  %33 = load ptr, ptr %8, align 8, !tbaa !5
  %34 = getelementptr inbounds %struct.aiBone, ptr %33, i32 0, i32 1
  %35 = load i32, ptr %34, align 4, !tbaa !19
  %36 = load ptr, ptr %9, align 8, !tbaa !5
  %37 = getelementptr inbounds %struct.aiBone, ptr %36, i32 0, i32 1
  %38 = load i32, ptr %37, align 4, !tbaa !19
  %39 = icmp ne i32 %35, %38
  br i1 %39, label %46, label %40

40:                                               ; preds = %18
  %41 = load ptr, ptr %8, align 8, !tbaa !5
  %42 = getelementptr inbounds %struct.aiBone, ptr %41, i32 0, i32 5
  %43 = load ptr, ptr %9, align 8, !tbaa !5
  %44 = getelementptr inbounds %struct.aiBone, ptr %43, i32 0, i32 5
  %45 = call noundef zeroext i1 @_ZNK12aiMatrix4x4tIfEneERKS0_(ptr noundef nonnull align 4 dereferenceable(64) %42, ptr noundef nonnull align 4 dereferenceable(64) %44)
  br i1 %45, label %46, label %47

46:                                               ; preds = %40, %18
  store i1 false, ptr %3, align 1
  store i32 1, ptr %7, align 4
  br label %100

47:                                               ; preds = %40
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #3
  store i32 0, ptr %10, align 4, !tbaa !9
  br label %48

48:                                               ; preds = %94, %47
  %49 = load i32, ptr %10, align 4, !tbaa !9
  %50 = load ptr, ptr %8, align 8, !tbaa !5
  %51 = getelementptr inbounds %struct.aiBone, ptr %50, i32 0, i32 1
  %52 = load i32, ptr %51, align 4, !tbaa !19
  %53 = icmp ult i32 %49, %52
  br i1 %53, label %55, label %54

54:                                               ; preds = %48
  store i32 5, ptr %7, align 4
  br label %97

55:                                               ; preds = %48
  %56 = load ptr, ptr %8, align 8, !tbaa !5
  %57 = getelementptr inbounds %struct.aiBone, ptr %56, i32 0, i32 4
  %58 = load ptr, ptr %57, align 8, !tbaa !22
  %59 = load i32, ptr %10, align 4, !tbaa !9
  %60 = zext i32 %59 to i64
  %61 = getelementptr inbounds %struct.aiVertexWeight, ptr %58, i64 %60
  %62 = getelementptr inbounds %struct.aiVertexWeight, ptr %61, i32 0, i32 0
  %63 = load i32, ptr %62, align 4, !tbaa !23
  %64 = load ptr, ptr %9, align 8, !tbaa !5
  %65 = getelementptr inbounds %struct.aiBone, ptr %64, i32 0, i32 4
  %66 = load ptr, ptr %65, align 8, !tbaa !22
  %67 = load i32, ptr %10, align 4, !tbaa !9
  %68 = zext i32 %67 to i64
  %69 = getelementptr inbounds %struct.aiVertexWeight, ptr %66, i64 %68
  %70 = getelementptr inbounds %struct.aiVertexWeight, ptr %69, i32 0, i32 0
  %71 = load i32, ptr %70, align 4, !tbaa !23
  %72 = icmp ne i32 %63, %71
  br i1 %72, label %92, label %73

73:                                               ; preds = %55
  %74 = load ptr, ptr %8, align 8, !tbaa !5
  %75 = getelementptr inbounds %struct.aiBone, ptr %74, i32 0, i32 4
  %76 = load ptr, ptr %75, align 8, !tbaa !22
  %77 = load i32, ptr %10, align 4, !tbaa !9
  %78 = zext i32 %77 to i64
  %79 = getelementptr inbounds %struct.aiVertexWeight, ptr %76, i64 %78
  %80 = getelementptr inbounds %struct.aiVertexWeight, ptr %79, i32 0, i32 1
  %81 = load float, ptr %80, align 4, !tbaa !25
  %82 = load ptr, ptr %9, align 8, !tbaa !5
  %83 = getelementptr inbounds %struct.aiBone, ptr %82, i32 0, i32 4
  %84 = load ptr, ptr %83, align 8, !tbaa !22
  %85 = load i32, ptr %10, align 4, !tbaa !9
  %86 = zext i32 %85 to i64
  %87 = getelementptr inbounds %struct.aiVertexWeight, ptr %84, i64 %86
  %88 = getelementptr inbounds %struct.aiVertexWeight, ptr %87, i32 0, i32 1
  %89 = load float, ptr %88, align 4, !tbaa !25
  %90 = fsub float %81, %89
  %91 = fcmp olt float %90, 0x3F847AE140000000
  br i1 %91, label %92, label %93

92:                                               ; preds = %73, %55
  store i1 false, ptr %3, align 1
  store i32 1, ptr %7, align 4
  br label %97

93:                                               ; preds = %73
  br label %94

94:                                               ; preds = %93
  %95 = load i32, ptr %10, align 4, !tbaa !9
  %96 = add i32 %95, 1
  store i32 %96, ptr %10, align 4, !tbaa !9
  br label %48, !llvm.loop !26

97:                                               ; preds = %92, %54
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #3
  %98 = load i32, ptr %7, align 4
  switch i32 %98, label %100 [
    i32 5, label %99
  ]

99:                                               ; preds = %97
  store i32 0, ptr %7, align 4
  br label %100

100:                                              ; preds = %99, %97, %46
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #3
  %101 = load i32, ptr %7, align 4
  switch i32 %101, label %106 [
    i32 0, label %102
  ]

102:                                              ; preds = %100
  br label %103

103:                                              ; preds = %102
  %104 = load i32, ptr %6, align 4, !tbaa !9
  %105 = add i32 %104, 1
  store i32 %105, ptr %6, align 4, !tbaa !9
  br label %11, !llvm.loop !28

106:                                              ; preds = %100, %17
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #3
  %107 = load i32, ptr %7, align 4
  switch i32 %107, label %111 [
    i32 2, label %108
    i32 1, label %109
  ]

108:                                              ; preds = %106
  store i1 true, ptr %3, align 1
  br label %109

109:                                              ; preds = %108, %106
  %110 = load i1, ptr %3, align 1
  ret i1 %110

111:                                              ; preds = %106
  unreachable
}

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

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef zeroext i1 @_ZNK12aiMatrix4x4tIfEneERKS0_(ptr noundef nonnull align 4 dereferenceable(64), ptr noundef nonnull align 4 dereferenceable(64)) #2 align 2

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

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 = { 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 #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, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = !{!12, !10, i64 216}
!12 = !{!"_ZTS6aiMesh", !10, i64 0, !10, i64 4, !10, i64 8, !6, i64 16, !6, i64 24, !6, i64 32, !6, i64 40, !7, i64 48, !7, i64 112, !7, i64 176, !6, i64 208, !10, i64 216, !6, i64 224, !10, i64 232, !13, i64 236, !10, i64 1264, !6, i64 1272, !14, i64 1280, !15, i64 1284, !6, i64 1312}
!13 = !{!"_ZTS8aiString", !10, i64 0, !7, i64 4}
!14 = !{!"_ZTS16aiMorphingMethod", !7, i64 0}
!15 = !{!"_ZTS6aiAABB", !16, i64 0, !16, i64 12}
!16 = !{!"_ZTS10aiVector3tIfE", !17, i64 0, !17, i64 4, !17, i64 8}
!17 = !{!"float", !7, i64 0}
!18 = !{!12, !6, i64 224}
!19 = !{!20, !10, i64 1028}
!20 = !{!"_ZTS6aiBone", !13, i64 0, !10, i64 1028, !6, i64 1032, !6, i64 1040, !6, i64 1048, !21, i64 1056}
!21 = !{!"_ZTS12aiMatrix4x4tIfE", !17, i64 0, !17, i64 4, !17, i64 8, !17, i64 12, !17, i64 16, !17, i64 20, !17, i64 24, !17, i64 28, !17, i64 32, !17, i64 36, !17, i64 40, !17, i64 44, !17, i64 48, !17, i64 52, !17, i64 56, !17, i64 60}
!22 = !{!20, !6, i64 1048}
!23 = !{!24, !10, i64 0}
!24 = !{!"_ZTS14aiVertexWeight", !10, i64 0, !17, i64 4}
!25 = !{!24, !17, i64 4}
!26 = distinct !{!26, !27}
!27 = !{!"llvm.loop.mustprogress"}
!28 = distinct !{!28, !27}


; 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.aiVertexWeight = type { i32, float }

; Function Attrs: mustprogress uwtable
define dso_local noundef zeroext i1 @_Z12CompareBonesPK6aiMeshS1_(ptr nocapture noundef readonly %0, ptr nocapture noundef readonly %1) local_unnamed_addr #0 {
  %3 = getelementptr inbounds i8, ptr %0, i64 216
  %4 = load i32, ptr %3, align 8, !tbaa !5
  %5 = icmp eq i32 %4, 0
  br i1 %5, label %.thread, label %.lr.ph41

.lr.ph41:                                         ; preds = %2
  %6 = getelementptr inbounds i8, ptr %0, i64 224
  %7 = getelementptr inbounds i8, ptr %1, i64 224
  br label %8

8:                                                ; preds = %.lr.ph41, %._crit_edge
  %.02739 = phi i32 [ 0, %.lr.ph41 ], [ %42, %._crit_edge ]
  %9 = load ptr, ptr %6, align 8, !tbaa !16
  %10 = zext i32 %.02739 to i64
  %11 = getelementptr inbounds ptr, ptr %9, i64 %10
  %12 = load ptr, ptr %11, align 8, !tbaa !17
  %13 = load ptr, ptr %7, align 8, !tbaa !16
  %14 = getelementptr inbounds ptr, ptr %13, i64 %10
  %15 = load ptr, ptr %14, align 8, !tbaa !17
  %16 = getelementptr inbounds i8, ptr %12, i64 1028
  %17 = load i32, ptr %16, align 4, !tbaa !18
  %18 = getelementptr inbounds i8, ptr %15, i64 1028
  %19 = load i32, ptr %18, align 4, !tbaa !18
  %.not = icmp eq i32 %17, %19
  br i1 %.not, label %20, label %.thread

20:                                               ; preds = %8
  %21 = getelementptr inbounds i8, ptr %12, i64 1056
  %22 = getelementptr inbounds i8, ptr %15, i64 1056
  %23 = tail call noundef zeroext i1 @_ZNK12aiMatrix4x4tIfEneERKS0_(ptr noundef nonnull align 4 dereferenceable(64) %21, ptr noundef nonnull align 4 dereferenceable(64) %22)
  br i1 %23, label %.thread, label %.preheader

.preheader:                                       ; preds = %20
  %24 = load i32, ptr %16, align 4, !tbaa !18
  %.not3237.not = icmp eq i32 %24, 0
  br i1 %.not3237.not, label %._crit_edge, label %.lr.ph

.lr.ph:                                           ; preds = %.preheader
  %25 = getelementptr inbounds i8, ptr %12, i64 1048
  %26 = load ptr, ptr %25, align 8, !tbaa !21
  %27 = getelementptr inbounds i8, ptr %15, i64 1048
  %28 = load ptr, ptr %27, align 8, !tbaa !21
  %wide.trip.count = zext i32 %24 to i64
  br label %30

29:                                               ; preds = %35
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
  br i1 %exitcond.not, label %._crit_edge, label %30, !llvm.loop !22

30:                                               ; preds = %.lr.ph, %29
  %indvars.iv = phi i64 [ 0, %.lr.ph ], [ %indvars.iv.next, %29 ]
  %31 = getelementptr inbounds %struct.aiVertexWeight, ptr %26, i64 %indvars.iv
  %32 = load i32, ptr %31, align 4, !tbaa !24
  %33 = getelementptr inbounds %struct.aiVertexWeight, ptr %28, i64 %indvars.iv
  %34 = load i32, ptr %33, align 4, !tbaa !24
  %.not31 = icmp eq i32 %32, %34
  br i1 %.not31, label %35, label %.thread

35:                                               ; preds = %30
  %36 = getelementptr inbounds i8, ptr %31, i64 4
  %37 = load float, ptr %36, align 4, !tbaa !26
  %38 = getelementptr inbounds i8, ptr %33, i64 4
  %39 = load float, ptr %38, align 4, !tbaa !26
  %40 = fsub float %37, %39
  %41 = fcmp olt float %40, 0x3F847AE140000000
  br i1 %41, label %.thread, label %29

._crit_edge:                                      ; preds = %29, %.preheader
  %42 = add nuw i32 %.02739, 1
  %43 = load i32, ptr %3, align 8, !tbaa !5
  %.not49 = icmp ult i32 %42, %43
  br i1 %.not49, label %8, label %.thread, !llvm.loop !27

.thread:                                          ; preds = %._crit_edge, %20, %8, %30, %35, %2
  %44 = phi i1 [ true, %2 ], [ false, %35 ], [ false, %30 ], [ true, %._crit_edge ], [ false, %20 ], [ false, %8 ]
  ret i1 %44
}

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef zeroext i1 @_ZNK12aiMatrix4x4tIfEneERKS0_(ptr noundef nonnull align 4 dereferenceable(64), ptr noundef nonnull align 4 dereferenceable(64)) local_unnamed_addr #1 align 2

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

!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 216}
!6 = !{!"_ZTS6aiMesh", !7, i64 0, !7, i64 4, !7, i64 8, !10, i64 16, !10, i64 24, !10, i64 32, !10, i64 40, !8, i64 48, !8, i64 112, !8, i64 176, !10, i64 208, !7, i64 216, !10, i64 224, !7, i64 232, !11, i64 236, !7, i64 1264, !10, i64 1272, !12, i64 1280, !13, i64 1284, !10, i64 1312}
!7 = !{!"int", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!"any pointer", !8, i64 0}
!11 = !{!"_ZTS8aiString", !7, i64 0, !8, i64 4}
!12 = !{!"_ZTS16aiMorphingMethod", !8, i64 0}
!13 = !{!"_ZTS6aiAABB", !14, i64 0, !14, i64 12}
!14 = !{!"_ZTS10aiVector3tIfE", !15, i64 0, !15, i64 4, !15, i64 8}
!15 = !{!"float", !8, i64 0}
!16 = !{!6, !10, i64 224}
!17 = !{!10, !10, i64 0}
!18 = !{!19, !7, i64 1028}
!19 = !{!"_ZTS6aiBone", !11, i64 0, !7, i64 1028, !10, i64 1032, !10, i64 1040, !10, i64 1048, !20, i64 1056}
!20 = !{!"_ZTS12aiMatrix4x4tIfE", !15, i64 0, !15, i64 4, !15, i64 8, !15, i64 12, !15, i64 16, !15, i64 20, !15, i64 24, !15, i64 28, !15, i64 32, !15, i64 36, !15, i64 40, !15, i64 44, !15, i64 48, !15, i64 52, !15, i64 56, !15, i64 60}
!21 = !{!19, !10, i64 1048}
!22 = distinct !{!22, !23}
!23 = !{!"llvm.loop.mustprogress"}
!24 = !{!25, !7, i64 0}
!25 = !{!"_ZTS14aiVertexWeight", !7, i64 0, !15, i64 4}
!26 = !{!25, !15, i64 4}
!27 = distinct !{!27, !23}


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