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

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

@.str.55 = external hidden unnamed_addr constant [28 x i8], align 1
@.str.56 = external hidden unnamed_addr constant [47 x i8], align 1
@.str.57 = external hidden unnamed_addr constant [50 x i8], align 1

; Function Attrs: mustprogress noreturn uwtable
declare dso_local void @_ZN6Assimp17ValidateDSProcess11ReportErrorEPKcz(ptr noundef nonnull align 8 dereferenceable(32), ptr noundef, ...) #0 align 2

; 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
declare dso_local void @_ZN6Assimp17ValidateDSProcess13ReportWarningEPKcz(ptr noundef nonnull align 8 dereferenceable(32), ptr noundef, ...) #2 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN6Assimp17ValidateDSProcess8ValidateEPK8aiString(ptr noundef nonnull align 8 dereferenceable(32), ptr noundef) #2 align 2

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN6Assimp17ValidateDSProcess8ValidateEPK6aiMeshPK6aiBonePf(ptr noundef nonnull align 8 dereferenceable(32) %0, ptr noundef %1, ptr noundef %2, ptr noundef %3) #2 align 2 {
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  %9 = alloca i32, align 4
  store ptr %0, ptr %5, align 8, !tbaa !5
  store ptr %1, ptr %6, align 8, !tbaa !5
  store ptr %2, ptr %7, align 8, !tbaa !5
  store ptr %3, ptr %8, align 8, !tbaa !5
  %10 = load ptr, ptr %5, align 8
  %11 = load ptr, ptr %7, align 8, !tbaa !5
  %12 = getelementptr inbounds %struct.aiBone, ptr %11, i32 0, i32 0
  call void @_ZN6Assimp17ValidateDSProcess8ValidateEPK8aiString(ptr noundef nonnull align 8 dereferenceable(32) %10, ptr noundef %12)
  %13 = load ptr, ptr %7, align 8, !tbaa !5
  %14 = getelementptr inbounds %struct.aiBone, ptr %13, i32 0, i32 1
  %15 = load i32, ptr %14, align 4, !tbaa !9
  %16 = icmp ne i32 %15, 0
  br i1 %16, label %18, label %17

17:                                               ; preds = %4
  call void (ptr, ptr, ...) @_ZN6Assimp17ValidateDSProcess13ReportWarningEPKcz(ptr noundef nonnull align 8 dereferenceable(32) %10, ptr noundef @.str.55)
  br label %18

18:                                               ; preds = %17, %4
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #3
  store i32 0, ptr %9, align 4, !tbaa !15
  br label %19

19:                                               ; preds = %86, %18
  %20 = load i32, ptr %9, align 4, !tbaa !15
  %21 = load ptr, ptr %7, align 8, !tbaa !5
  %22 = getelementptr inbounds %struct.aiBone, ptr %21, i32 0, i32 1
  %23 = load i32, ptr %22, align 4, !tbaa !9
  %24 = icmp ult i32 %20, %23
  br i1 %24, label %26, label %25

25:                                               ; preds = %19
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #3
  br label %89

26:                                               ; preds = %19
  %27 = load ptr, ptr %7, align 8, !tbaa !5
  %28 = getelementptr inbounds %struct.aiBone, ptr %27, i32 0, i32 4
  %29 = load ptr, ptr %28, align 8, !tbaa !16
  %30 = load i32, ptr %9, align 4, !tbaa !15
  %31 = zext i32 %30 to i64
  %32 = getelementptr inbounds %struct.aiVertexWeight, ptr %29, i64 %31
  %33 = getelementptr inbounds %struct.aiVertexWeight, ptr %32, i32 0, i32 0
  %34 = load i32, ptr %33, align 4, !tbaa !17
  %35 = load ptr, ptr %6, align 8, !tbaa !5
  %36 = getelementptr inbounds %struct.aiMesh, ptr %35, i32 0, i32 1
  %37 = load i32, ptr %36, align 4, !tbaa !19
  %38 = icmp uge i32 %34, %37
  br i1 %38, label %39, label %41

39:                                               ; preds = %26
  %40 = load i32, ptr %9, align 4, !tbaa !15
  call void (ptr, ptr, ...) @_ZN6Assimp17ValidateDSProcess11ReportErrorEPKcz(ptr noundef nonnull align 8 dereferenceable(32) %10, ptr noundef @.str.56, i32 noundef %40) #4
  unreachable

41:                                               ; preds = %26
  %42 = load ptr, ptr %7, align 8, !tbaa !5
  %43 = getelementptr inbounds %struct.aiBone, ptr %42, i32 0, i32 4
  %44 = load ptr, ptr %43, align 8, !tbaa !16
  %45 = load i32, ptr %9, align 4, !tbaa !15
  %46 = zext i32 %45 to i64
  %47 = getelementptr inbounds %struct.aiVertexWeight, ptr %44, i64 %46
  %48 = getelementptr inbounds %struct.aiVertexWeight, ptr %47, i32 0, i32 1
  %49 = load float, ptr %48, align 4, !tbaa !24
  %50 = fcmp une float %49, 0.000000e+00
  br i1 %50, label %51, label %61

51:                                               ; preds = %41
  %52 = load ptr, ptr %7, align 8, !tbaa !5
  %53 = getelementptr inbounds %struct.aiBone, ptr %52, i32 0, i32 4
  %54 = load ptr, ptr %53, align 8, !tbaa !16
  %55 = load i32, ptr %9, align 4, !tbaa !15
  %56 = zext i32 %55 to i64
  %57 = getelementptr inbounds %struct.aiVertexWeight, ptr %54, i64 %56
  %58 = getelementptr inbounds %struct.aiVertexWeight, ptr %57, i32 0, i32 1
  %59 = load float, ptr %58, align 4, !tbaa !24
  %60 = fcmp ogt float %59, 1.000000e+00
  br i1 %60, label %61, label %63

61:                                               ; preds = %51, %41
  %62 = load i32, ptr %9, align 4, !tbaa !15
  call void (ptr, ptr, ...) @_ZN6Assimp17ValidateDSProcess13ReportWarningEPKcz(ptr noundef nonnull align 8 dereferenceable(32) %10, ptr noundef @.str.57, i32 noundef %62)
  br label %63

63:                                               ; preds = %61, %51
  br label %64

64:                                               ; preds = %63
  %65 = load ptr, ptr %7, align 8, !tbaa !5
  %66 = getelementptr inbounds %struct.aiBone, ptr %65, i32 0, i32 4
  %67 = load ptr, ptr %66, align 8, !tbaa !16
  %68 = load i32, ptr %9, align 4, !tbaa !15
  %69 = zext i32 %68 to i64
  %70 = getelementptr inbounds %struct.aiVertexWeight, ptr %67, i64 %69
  %71 = getelementptr inbounds %struct.aiVertexWeight, ptr %70, i32 0, i32 1
  %72 = load float, ptr %71, align 4, !tbaa !24
  %73 = load ptr, ptr %8, align 8, !tbaa !5
  %74 = load ptr, ptr %7, align 8, !tbaa !5
  %75 = getelementptr inbounds %struct.aiBone, ptr %74, i32 0, i32 4
  %76 = load ptr, ptr %75, align 8, !tbaa !16
  %77 = load i32, ptr %9, align 4, !tbaa !15
  %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 0
  %81 = load i32, ptr %80, align 4, !tbaa !17
  %82 = zext i32 %81 to i64
  %83 = getelementptr inbounds float, ptr %73, i64 %82
  %84 = load float, ptr %83, align 4, !tbaa !25
  %85 = fadd float %84, %72
  store float %85, ptr %83, align 4, !tbaa !25
  br label %86

86:                                               ; preds = %64
  %87 = load i32, ptr %9, align 4, !tbaa !15
  %88 = add i32 %87, 1
  store i32 %88, ptr %9, align 4, !tbaa !15
  br label %19, !llvm.loop !26

89:                                               ; preds = %25
  ret void
}

attributes #0 = { mustprogress noreturn 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 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 }
attributes #4 = { noreturn }

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


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

@.str.55 = external hidden unnamed_addr constant [28 x i8], align 1
@.str.56 = external hidden unnamed_addr constant [47 x i8], align 1
@.str.57 = external hidden unnamed_addr constant [50 x i8], align 1

; Function Attrs: mustprogress noreturn uwtable
declare dso_local void @_ZN6Assimp17ValidateDSProcess11ReportErrorEPKcz(ptr noundef nonnull align 8 dereferenceable(32), ptr noundef, ...) local_unnamed_addr #0 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN6Assimp17ValidateDSProcess13ReportWarningEPKcz(ptr noundef nonnull align 8 dereferenceable(32), ptr noundef, ...) local_unnamed_addr #1 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN6Assimp17ValidateDSProcess8ValidateEPK8aiString(ptr noundef nonnull align 8 dereferenceable(32), ptr noundef) local_unnamed_addr #1 align 2

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN6Assimp17ValidateDSProcess8ValidateEPK6aiMeshPK6aiBonePf(ptr noundef nonnull align 8 dereferenceable(32) %0, ptr nocapture noundef readonly %1, ptr noundef %2, ptr nocapture noundef %3) local_unnamed_addr #1 align 2 {
  tail call void @_ZN6Assimp17ValidateDSProcess8ValidateEPK8aiString(ptr noundef nonnull align 8 dereferenceable(32) %0, ptr noundef %2)
  %5 = getelementptr inbounds i8, ptr %2, i64 1028
  %6 = load i32, ptr %5, align 4, !tbaa !5
  %.not = icmp eq i32 %6, 0
  br i1 %.not, label %7, label %.lr.ph

7:                                                ; preds = %4
  tail call void (ptr, ptr, ...) @_ZN6Assimp17ValidateDSProcess13ReportWarningEPKcz(ptr noundef nonnull align 8 dereferenceable(32) %0, ptr noundef nonnull @.str.55)
  %.pre = load i32, ptr %5, align 4, !tbaa !5
  %.not23 = icmp eq i32 %.pre, 0
  br i1 %.not23, label %._crit_edge, label %.lr.ph

.lr.ph:                                           ; preds = %4, %7
  %8 = phi i32 [ %.pre, %7 ], [ %6, %4 ]
  %9 = getelementptr inbounds i8, ptr %2, i64 1048
  %10 = getelementptr inbounds i8, ptr %1, i64 4
  %.pre26 = load ptr, ptr %9, align 8, !tbaa !14
  br label %11

._crit_edge:                                      ; preds = %26, %7
  ret void

11:                                               ; preds = %.lr.ph, %26
  %12 = phi i32 [ %8, %.lr.ph ], [ %29, %26 ]
  %13 = phi ptr [ %.pre26, %.lr.ph ], [ %30, %26 ]
  %indvars.iv = phi i64 [ 0, %.lr.ph ], [ %indvars.iv.next, %26 ]
  %14 = getelementptr inbounds %struct.aiVertexWeight, ptr %13, i64 %indvars.iv
  %15 = load i32, ptr %14, align 4, !tbaa !15
  %16 = load i32, ptr %10, align 4, !tbaa !17
  %.not20 = icmp ult i32 %15, %16
  br i1 %.not20, label %19, label %17

17:                                               ; preds = %11
  %18 = trunc nuw i64 %indvars.iv to i32
  tail call void (ptr, ptr, ...) @_ZN6Assimp17ValidateDSProcess11ReportErrorEPKcz(ptr noundef nonnull align 8 dereferenceable(32) %0, ptr noundef nonnull @.str.56, i32 noundef %18) #2
  unreachable

19:                                               ; preds = %11
  %20 = getelementptr inbounds i8, ptr %14, i64 4
  %21 = load float, ptr %20, align 4, !tbaa !22
  %22 = fcmp oeq float %21, 0.000000e+00
  %23 = fcmp ogt float %21, 1.000000e+00
  %or.cond = or i1 %22, %23
  br i1 %or.cond, label %24, label %26

24:                                               ; preds = %19
  %25 = trunc nuw i64 %indvars.iv to i32
  tail call void (ptr, ptr, ...) @_ZN6Assimp17ValidateDSProcess13ReportWarningEPKcz(ptr noundef nonnull align 8 dereferenceable(32) %0, ptr noundef nonnull @.str.57, i32 noundef %25)
  %.pre27 = load ptr, ptr %9, align 8, !tbaa !14
  %.pre28 = load i32, ptr %5, align 4, !tbaa !5
  %.phi.trans.insert = getelementptr inbounds %struct.aiVertexWeight, ptr %.pre27, i64 %indvars.iv
  %.phi.trans.insert29 = getelementptr inbounds i8, ptr %.phi.trans.insert, i64 4
  %.pre30 = load float, ptr %.phi.trans.insert29, align 4, !tbaa !22
  %.pre31 = load i32, ptr %.phi.trans.insert, align 4, !tbaa !15
  br label %26

26:                                               ; preds = %19, %24
  %27 = phi i32 [ %15, %19 ], [ %.pre31, %24 ]
  %28 = phi float [ %21, %19 ], [ %.pre30, %24 ]
  %29 = phi i32 [ %12, %19 ], [ %.pre28, %24 ]
  %30 = phi ptr [ %13, %19 ], [ %.pre27, %24 ]
  %31 = zext i32 %27 to i64
  %32 = getelementptr inbounds float, ptr %3, i64 %31
  %33 = load float, ptr %32, align 4, !tbaa !23
  %34 = fadd float %28, %33
  store float %34, ptr %32, align 4, !tbaa !23
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %35 = zext i32 %29 to i64
  %36 = icmp ult i64 %indvars.iv.next, %35
  br i1 %36, label %11, label %._crit_edge, !llvm.loop !24
}

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

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


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