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

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

@.str = external hidden unnamed_addr constant [16 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [132 x i8], align 1

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN6Assimp9checkMeshEP6aiMeshR10aiVector3tIfES4_(ptr noundef %0, ptr noundef nonnull align 4 dereferenceable(12) %1, ptr noundef nonnull align 4 dereferenceable(12) %2) #0 {
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca i32, align 4
  %8 = alloca ptr, align 8
  store ptr %0, ptr %4, align 8, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !5
  store ptr %2, ptr %6, align 8, !tbaa !5
  %9 = load ptr, ptr %4, align 8, !tbaa !5
  %10 = icmp ne ptr null, %9
  br i1 %10, label %12, label %11

11:                                               ; preds = %3
  call void @_ZN6Assimp17aiAssertViolationEPKcS1_i(ptr noundef @.str, ptr noundef @.str.1, i32 noundef 56)
  br label %12

12:                                               ; preds = %11, %3
  %13 = phi i1 [ true, %3 ], [ false, %11 ]
  %14 = load ptr, ptr %4, align 8, !tbaa !5
  %15 = getelementptr inbounds %struct.aiMesh, ptr %14, i32 0, i32 1
  %16 = load i32, ptr %15, align 4, !tbaa !9
  %17 = icmp eq i32 0, %16
  br i1 %17, label %18, label %19

18:                                               ; preds = %12
  br label %121

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

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

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

27:                                               ; preds = %20
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #3
  %28 = load ptr, ptr %4, align 8, !tbaa !5
  %29 = getelementptr inbounds %struct.aiMesh, ptr %28, i32 0, i32 3
  %30 = load ptr, ptr %29, align 8, !tbaa !18
  %31 = load i32, ptr %7, align 4, !tbaa !17
  %32 = zext i32 %31 to i64
  %33 = getelementptr inbounds %class.aiVector3t, ptr %30, i64 %32
  store ptr %33, ptr %8, align 8, !tbaa !5
  %34 = load ptr, ptr %8, align 8, !tbaa !5
  %35 = getelementptr inbounds %class.aiVector3t, ptr %34, i32 0, i32 0
  %36 = load float, ptr %35, align 4, !tbaa !19
  %37 = load ptr, ptr %5, align 8, !tbaa !5
  %38 = getelementptr inbounds %class.aiVector3t, ptr %37, i32 0, i32 0
  %39 = load float, ptr %38, align 4, !tbaa !19
  %40 = fcmp olt float %36, %39
  br i1 %40, label %41, label %47

41:                                               ; preds = %27
  %42 = load ptr, ptr %8, align 8, !tbaa !5
  %43 = getelementptr inbounds %class.aiVector3t, ptr %42, i32 0, i32 0
  %44 = load float, ptr %43, align 4, !tbaa !19
  %45 = load ptr, ptr %5, align 8, !tbaa !5
  %46 = getelementptr inbounds %class.aiVector3t, ptr %45, i32 0, i32 0
  store float %44, ptr %46, align 4, !tbaa !19
  br label %47

47:                                               ; preds = %41, %27
  %48 = load ptr, ptr %8, align 8, !tbaa !5
  %49 = getelementptr inbounds %class.aiVector3t, ptr %48, i32 0, i32 1
  %50 = load float, ptr %49, align 4, !tbaa !20
  %51 = load ptr, ptr %5, align 8, !tbaa !5
  %52 = getelementptr inbounds %class.aiVector3t, ptr %51, i32 0, i32 1
  %53 = load float, ptr %52, align 4, !tbaa !20
  %54 = fcmp olt float %50, %53
  br i1 %54, label %55, label %61

55:                                               ; preds = %47
  %56 = load ptr, ptr %8, align 8, !tbaa !5
  %57 = getelementptr inbounds %class.aiVector3t, ptr %56, i32 0, i32 1
  %58 = load float, ptr %57, align 4, !tbaa !20
  %59 = load ptr, ptr %5, align 8, !tbaa !5
  %60 = getelementptr inbounds %class.aiVector3t, ptr %59, i32 0, i32 1
  store float %58, ptr %60, align 4, !tbaa !20
  br label %61

61:                                               ; preds = %55, %47
  %62 = load ptr, ptr %8, align 8, !tbaa !5
  %63 = getelementptr inbounds %class.aiVector3t, ptr %62, i32 0, i32 2
  %64 = load float, ptr %63, align 4, !tbaa !21
  %65 = load ptr, ptr %5, align 8, !tbaa !5
  %66 = getelementptr inbounds %class.aiVector3t, ptr %65, i32 0, i32 2
  %67 = load float, ptr %66, align 4, !tbaa !21
  %68 = fcmp olt float %64, %67
  br i1 %68, label %69, label %75

69:                                               ; preds = %61
  %70 = load ptr, ptr %8, align 8, !tbaa !5
  %71 = getelementptr inbounds %class.aiVector3t, ptr %70, i32 0, i32 2
  %72 = load float, ptr %71, align 4, !tbaa !21
  %73 = load ptr, ptr %5, align 8, !tbaa !5
  %74 = getelementptr inbounds %class.aiVector3t, ptr %73, i32 0, i32 2
  store float %72, ptr %74, align 4, !tbaa !21
  br label %75

75:                                               ; preds = %69, %61
  %76 = load ptr, ptr %8, align 8, !tbaa !5
  %77 = getelementptr inbounds %class.aiVector3t, ptr %76, i32 0, i32 0
  %78 = load float, ptr %77, align 4, !tbaa !19
  %79 = load ptr, ptr %6, align 8, !tbaa !5
  %80 = getelementptr inbounds %class.aiVector3t, ptr %79, i32 0, i32 0
  %81 = load float, ptr %80, align 4, !tbaa !19
  %82 = fcmp ogt float %78, %81
  br i1 %82, label %83, label %89

83:                                               ; preds = %75
  %84 = load ptr, ptr %8, align 8, !tbaa !5
  %85 = getelementptr inbounds %class.aiVector3t, ptr %84, i32 0, i32 0
  %86 = load float, ptr %85, align 4, !tbaa !19
  %87 = load ptr, ptr %6, align 8, !tbaa !5
  %88 = getelementptr inbounds %class.aiVector3t, ptr %87, i32 0, i32 0
  store float %86, ptr %88, align 4, !tbaa !19
  br label %89

89:                                               ; preds = %83, %75
  %90 = load ptr, ptr %8, align 8, !tbaa !5
  %91 = getelementptr inbounds %class.aiVector3t, ptr %90, i32 0, i32 1
  %92 = load float, ptr %91, align 4, !tbaa !20
  %93 = load ptr, ptr %6, align 8, !tbaa !5
  %94 = getelementptr inbounds %class.aiVector3t, ptr %93, i32 0, i32 1
  %95 = load float, ptr %94, align 4, !tbaa !20
  %96 = fcmp ogt float %92, %95
  br i1 %96, label %97, label %103

97:                                               ; preds = %89
  %98 = load ptr, ptr %8, align 8, !tbaa !5
  %99 = getelementptr inbounds %class.aiVector3t, ptr %98, i32 0, i32 1
  %100 = load float, ptr %99, align 4, !tbaa !20
  %101 = load ptr, ptr %6, align 8, !tbaa !5
  %102 = getelementptr inbounds %class.aiVector3t, ptr %101, i32 0, i32 1
  store float %100, ptr %102, align 4, !tbaa !20
  br label %103

103:                                              ; preds = %97, %89
  %104 = load ptr, ptr %8, align 8, !tbaa !5
  %105 = getelementptr inbounds %class.aiVector3t, ptr %104, i32 0, i32 2
  %106 = load float, ptr %105, align 4, !tbaa !21
  %107 = load ptr, ptr %6, align 8, !tbaa !5
  %108 = getelementptr inbounds %class.aiVector3t, ptr %107, i32 0, i32 2
  %109 = load float, ptr %108, align 4, !tbaa !21
  %110 = fcmp ogt float %106, %109
  br i1 %110, label %111, label %117

111:                                              ; preds = %103
  %112 = load ptr, ptr %8, align 8, !tbaa !5
  %113 = getelementptr inbounds %class.aiVector3t, ptr %112, i32 0, i32 2
  %114 = load float, ptr %113, align 4, !tbaa !21
  %115 = load ptr, ptr %6, align 8, !tbaa !5
  %116 = getelementptr inbounds %class.aiVector3t, ptr %115, i32 0, i32 2
  store float %114, ptr %116, align 4, !tbaa !21
  br label %117

117:                                              ; preds = %111, %103
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #3
  br label %118

118:                                              ; preds = %117
  %119 = load i32, ptr %7, align 4, !tbaa !17
  %120 = add i32 %119, 1
  store i32 %120, ptr %7, align 4, !tbaa !17
  br label %20, !llvm.loop !22

121:                                              ; preds = %26, %18
  ret void
}

declare void @_ZN6Assimp17aiAssertViolationEPKcS1_i(ptr noundef, ptr noundef, i32 noundef) #1

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

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #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 = { "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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 4}
!10 = !{!"_ZTS6aiMesh", !11, i64 0, !11, i64 4, !11, 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, !11, i64 216, !6, i64 224, !11, i64 232, !12, i64 236, !11, i64 1264, !6, i64 1272, !13, i64 1280, !14, i64 1284, !6, i64 1312}
!11 = !{!"int", !7, i64 0}
!12 = !{!"_ZTS8aiString", !11, i64 0, !7, i64 4}
!13 = !{!"_ZTS16aiMorphingMethod", !7, i64 0}
!14 = !{!"_ZTS6aiAABB", !15, i64 0, !15, i64 12}
!15 = !{!"_ZTS10aiVector3tIfE", !16, i64 0, !16, i64 4, !16, i64 8}
!16 = !{!"float", !7, i64 0}
!17 = !{!11, !11, i64 0}
!18 = !{!10, !6, i64 16}
!19 = !{!15, !16, i64 0}
!20 = !{!15, !16, i64 4}
!21 = !{!15, !16, i64 8}
!22 = distinct !{!22, !23}
!23 = !{!"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"

%class.aiVector3t = type { float, float, float }

@.str = external hidden unnamed_addr constant [16 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [132 x i8], align 1

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN6Assimp9checkMeshEP6aiMeshR10aiVector3tIfES4_(ptr noundef readonly %0, ptr nocapture noundef nonnull align 4 dereferenceable(12) %1, ptr nocapture noundef nonnull align 4 dereferenceable(12) %2) local_unnamed_addr #0 {
  %.not = icmp eq ptr %0, null
  br i1 %.not, label %4, label %5

4:                                                ; preds = %3
  tail call void @_ZN6Assimp17aiAssertViolationEPKcS1_i(ptr noundef nonnull @.str, ptr noundef nonnull @.str.1, i32 noundef 56)
  br label %5

5:                                                ; preds = %4, %3
  %6 = getelementptr inbounds i8, ptr %0, i64 4
  %7 = load i32, ptr %6, align 4, !tbaa !5
  %8 = icmp eq i32 %7, 0
  br i1 %8, label %.loopexit, label %.preheader

.preheader:                                       ; preds = %5
  %9 = getelementptr inbounds i8, ptr %0, i64 16
  %10 = load ptr, ptr %9, align 8, !tbaa !16
  %11 = getelementptr inbounds i8, ptr %1, i64 4
  %12 = getelementptr inbounds i8, ptr %1, i64 8
  %13 = getelementptr inbounds i8, ptr %2, i64 4
  %14 = getelementptr inbounds i8, ptr %2, i64 8
  %wide.trip.count = zext i32 %7 to i64
  br label %15

15:                                               ; preds = %.preheader, %48
  %indvars.iv = phi i64 [ 0, %.preheader ], [ %indvars.iv.next, %48 ]
  %16 = getelementptr inbounds %class.aiVector3t, ptr %10, i64 %indvars.iv
  %17 = load float, ptr %16, align 4, !tbaa !17
  %18 = load float, ptr %1, align 4, !tbaa !17
  %19 = fcmp olt float %17, %18
  br i1 %19, label %20, label %21

20:                                               ; preds = %15
  store float %17, ptr %1, align 4, !tbaa !17
  br label %21

21:                                               ; preds = %20, %15
  %22 = getelementptr inbounds i8, ptr %16, i64 4
  %23 = load float, ptr %22, align 4, !tbaa !18
  %24 = load float, ptr %11, align 4, !tbaa !18
  %25 = fcmp olt float %23, %24
  br i1 %25, label %26, label %27

26:                                               ; preds = %21
  store float %23, ptr %11, align 4, !tbaa !18
  br label %27

27:                                               ; preds = %26, %21
  %28 = getelementptr inbounds i8, ptr %16, i64 8
  %29 = load float, ptr %28, align 4, !tbaa !19
  %30 = load float, ptr %12, align 4, !tbaa !19
  %31 = fcmp olt float %29, %30
  br i1 %31, label %32, label %33

32:                                               ; preds = %27
  store float %29, ptr %12, align 4, !tbaa !19
  br label %33

33:                                               ; preds = %32, %27
  %34 = load float, ptr %16, align 4, !tbaa !17
  %35 = load float, ptr %2, align 4, !tbaa !17
  %36 = fcmp ogt float %34, %35
  br i1 %36, label %37, label %38

37:                                               ; preds = %33
  store float %34, ptr %2, align 4, !tbaa !17
  br label %38

38:                                               ; preds = %37, %33
  %39 = load float, ptr %22, align 4, !tbaa !18
  %40 = load float, ptr %13, align 4, !tbaa !18
  %41 = fcmp ogt float %39, %40
  br i1 %41, label %42, label %43

42:                                               ; preds = %38
  store float %39, ptr %13, align 4, !tbaa !18
  br label %43

43:                                               ; preds = %42, %38
  %44 = load float, ptr %28, align 4, !tbaa !19
  %45 = load float, ptr %14, align 4, !tbaa !19
  %46 = fcmp ogt float %44, %45
  br i1 %46, label %47, label %48

47:                                               ; preds = %43
  store float %44, ptr %14, align 4, !tbaa !19
  br label %48

48:                                               ; preds = %47, %43
  %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 %.loopexit, label %15, !llvm.loop !20

.loopexit:                                        ; preds = %48, %5
  ret void
}

declare void @_ZN6Assimp17aiAssertViolationEPKcS1_i(ptr noundef, ptr noundef, i32 noundef) local_unnamed_addr #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 = { "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 4}
!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 16}
!17 = !{!14, !15, i64 0}
!18 = !{!14, !15, i64 4}
!19 = !{!14, !15, i64 8}
!20 = distinct !{!20, !21}
!21 = !{!"llvm.loop.mustprogress"}


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