; LLVM IR from Overload-Technologies/Overload :: Dependencies/assimp/code/Common (SceneCombiner)

; 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.aiAnimMesh = type { %struct.aiString, ptr, ptr, ptr, ptr, [8 x ptr], [8 x ptr], i32, float }
%struct.aiString = type { i32, [1024 x i8] }

; 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: nobuiltin allocsize(0)
declare noundef nonnull ptr @_Znwm(i64 noundef) #1

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

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

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN6Assimp13SceneCombiner4CopyEPP10aiAnimMeshPKS1_(ptr noundef %0, ptr noundef %1) #3 align 2 {
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %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 = icmp eq ptr null, %7
  br i1 %8, label %12, label %9

9:                                                ; preds = %2
  %10 = load ptr, ptr %4, align 8, !tbaa !5
  %11 = icmp eq ptr null, %10
  br i1 %11, label %12, label %13

12:                                               ; preds = %9, %2
  br label %69

13:                                               ; preds = %9
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #6
  %14 = call noalias noundef nonnull ptr @_Znwm(i64 noundef 1200) #7
  call void @_ZN10aiAnimMeshC2Ev(ptr noundef nonnull align 8 dereferenceable(1200) %14) #6
  %15 = load ptr, ptr %3, align 8, !tbaa !5
  store ptr %14, ptr %15, align 8, !tbaa !5
  store ptr %14, ptr %5, align 8, !tbaa !5
  %16 = load ptr, ptr %4, align 8, !tbaa !5
  %17 = load ptr, ptr %5, align 8, !tbaa !5
  %18 = call noundef nonnull align 8 dereferenceable(1200) ptr @_ZN10aiAnimMeshaSERKS_(ptr noundef nonnull align 8 dereferenceable(1200) %17, ptr noundef nonnull align 8 dereferenceable(1200) %16)
  %19 = load ptr, ptr %5, align 8, !tbaa !5
  %20 = getelementptr inbounds %struct.aiAnimMesh, ptr %19, i32 0, i32 1
  %21 = load ptr, ptr %5, align 8, !tbaa !5
  %22 = getelementptr inbounds %struct.aiAnimMesh, ptr %21, i32 0, i32 7
  %23 = load i32, ptr %22, align 8, !tbaa !9
  call void @_ZN6Assimp12GetArrayCopyI10aiVector3tIfEEEvRPT_j(ptr noundef nonnull align 8 dereferenceable(8) %20, i32 noundef %23)
  %24 = load ptr, ptr %5, align 8, !tbaa !5
  %25 = getelementptr inbounds %struct.aiAnimMesh, ptr %24, i32 0, i32 2
  %26 = load ptr, ptr %5, align 8, !tbaa !5
  %27 = getelementptr inbounds %struct.aiAnimMesh, ptr %26, i32 0, i32 7
  %28 = load i32, ptr %27, align 8, !tbaa !9
  call void @_ZN6Assimp12GetArrayCopyI10aiVector3tIfEEEvRPT_j(ptr noundef nonnull align 8 dereferenceable(8) %25, i32 noundef %28)
  %29 = load ptr, ptr %5, align 8, !tbaa !5
  %30 = getelementptr inbounds %struct.aiAnimMesh, ptr %29, i32 0, i32 3
  %31 = load ptr, ptr %5, align 8, !tbaa !5
  %32 = getelementptr inbounds %struct.aiAnimMesh, ptr %31, i32 0, i32 7
  %33 = load i32, ptr %32, align 8, !tbaa !9
  call void @_ZN6Assimp12GetArrayCopyI10aiVector3tIfEEEvRPT_j(ptr noundef nonnull align 8 dereferenceable(8) %30, i32 noundef %33)
  %34 = load ptr, ptr %5, align 8, !tbaa !5
  %35 = getelementptr inbounds %struct.aiAnimMesh, ptr %34, i32 0, i32 4
  %36 = load ptr, ptr %5, align 8, !tbaa !5
  %37 = getelementptr inbounds %struct.aiAnimMesh, ptr %36, i32 0, i32 7
  %38 = load i32, ptr %37, align 8, !tbaa !9
  call void @_ZN6Assimp12GetArrayCopyI10aiVector3tIfEEEvRPT_j(ptr noundef nonnull align 8 dereferenceable(8) %35, i32 noundef %38)
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #6
  store i32 0, ptr %6, align 4, !tbaa !14
  br label %39

39:                                               ; preds = %43, %13
  %40 = load ptr, ptr %5, align 8, !tbaa !5
  %41 = load i32, ptr %6, align 4, !tbaa !14
  %42 = call noundef zeroext i1 @_ZNK10aiAnimMesh16HasTextureCoordsEj(ptr noundef nonnull align 8 dereferenceable(1200) %40, i32 noundef %41)
  br i1 %42, label %43, label %53

43:                                               ; preds = %39
  %44 = load ptr, ptr %5, align 8, !tbaa !5
  %45 = getelementptr inbounds %struct.aiAnimMesh, ptr %44, i32 0, i32 6
  %46 = load i32, ptr %6, align 4, !tbaa !14
  %47 = add i32 %46, 1
  store i32 %47, ptr %6, align 4, !tbaa !14
  %48 = zext i32 %46 to i64
  %49 = getelementptr inbounds [8 x ptr], ptr %45, i64 0, i64 %48
  %50 = load ptr, ptr %5, align 8, !tbaa !5
  %51 = getelementptr inbounds %struct.aiAnimMesh, ptr %50, i32 0, i32 7
  %52 = load i32, ptr %51, align 8, !tbaa !9
  call void @_ZN6Assimp12GetArrayCopyI10aiVector3tIfEEEvRPT_j(ptr noundef nonnull align 8 dereferenceable(8) %49, i32 noundef %52)
  br label %39, !llvm.loop !15

53:                                               ; preds = %39
  store i32 0, ptr %6, align 4, !tbaa !14
  br label %54

54:                                               ; preds = %58, %53
  %55 = load ptr, ptr %5, align 8, !tbaa !5
  %56 = load i32, ptr %6, align 4, !tbaa !14
  %57 = call noundef zeroext i1 @_ZNK10aiAnimMesh15HasVertexColorsEj(ptr noundef nonnull align 8 dereferenceable(1200) %55, i32 noundef %56)
  br i1 %57, label %58, label %68

58:                                               ; preds = %54
  %59 = load ptr, ptr %5, align 8, !tbaa !5
  %60 = getelementptr inbounds %struct.aiAnimMesh, ptr %59, i32 0, i32 5
  %61 = load i32, ptr %6, align 4, !tbaa !14
  %62 = add i32 %61, 1
  store i32 %62, ptr %6, align 4, !tbaa !14
  %63 = zext i32 %61 to i64
  %64 = getelementptr inbounds [8 x ptr], ptr %60, i64 0, i64 %63
  %65 = load ptr, ptr %5, align 8, !tbaa !5
  %66 = getelementptr inbounds %struct.aiAnimMesh, ptr %65, i32 0, i32 7
  %67 = load i32, ptr %66, align 8, !tbaa !9
  call void @_ZN6Assimp12GetArrayCopyI9aiColor4tIfEEEvRPT_j(ptr noundef nonnull align 8 dereferenceable(8) %64, i32 noundef %67)
  br label %54, !llvm.loop !17

68:                                               ; preds = %54
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #6
  br label %69

69:                                               ; preds = %68, %12
  ret void
}

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN10aiAnimMeshC2Ev(ptr noundef nonnull align 8 dereferenceable(1200)) unnamed_addr #4 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(1200) ptr @_ZN10aiAnimMeshaSERKS_(ptr noundef nonnull align 8 dereferenceable(1200), ptr noundef nonnull align 8 dereferenceable(1200)) #5 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZNK10aiAnimMesh16HasTextureCoordsEj(ptr noundef nonnull align 8 dereferenceable(1200), i32 noundef) #4 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZNK10aiAnimMesh15HasVertexColorsEj(ptr noundef nonnull align 8 dereferenceable(1200), i32 noundef) #4 align 2

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { nobuiltin allocsize(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 = { 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 = { 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 #4 = { 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 #5 = { inlinehint 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 #6 = { nounwind }
attributes #7 = { builtin allocsize(0) }

!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 1192}
!10 = !{!"_ZTS10aiAnimMesh", !11, i64 0, !6, i64 1032, !6, i64 1040, !6, i64 1048, !6, i64 1056, !7, i64 1064, !7, i64 1128, !12, i64 1192, !13, i64 1196}
!11 = !{!"_ZTS8aiString", !12, i64 0, !7, i64 4}
!12 = !{!"int", !7, i64 0}
!13 = !{!"float", !7, i64 0}
!14 = !{!12, !12, i64 0}
!15 = distinct !{!15, !16}
!16 = !{!"llvm.loop.mustprogress"}
!17 = distinct !{!17, !16}


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

; Function Attrs: nobuiltin allocsize(0)
declare noundef nonnull ptr @_Znwm(i64 noundef) local_unnamed_addr #0

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZN6Assimp12GetArrayCopyI10aiVector3tIfEEEvRPT_j(ptr noundef nonnull align 8 dereferenceable(8), i32 noundef) local_unnamed_addr #1

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZN6Assimp12GetArrayCopyI9aiColor4tIfEEEvRPT_j(ptr noundef nonnull align 8 dereferenceable(8), i32 noundef) local_unnamed_addr #1

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN6Assimp13SceneCombiner4CopyEPP10aiAnimMeshPKS1_(ptr noundef writeonly %0, ptr noundef %1) local_unnamed_addr #2 align 2 {
  %3 = icmp eq ptr %0, null
  %4 = icmp eq ptr %1, null
  %or.cond = or i1 %3, %4
  br i1 %or.cond, label %.loopexit, label %5

5:                                                ; preds = %2
  %6 = tail call noalias noundef nonnull dereferenceable(1200) ptr @_Znwm(i64 noundef 1200) #5
  tail call void @_ZN10aiAnimMeshC2Ev(ptr noundef nonnull align 8 dereferenceable(1200) %6) #6
  store ptr %6, ptr %0, align 8, !tbaa !5
  %7 = tail call noundef nonnull align 8 dereferenceable(1200) ptr @_ZN10aiAnimMeshaSERKS_(ptr noundef nonnull align 8 dereferenceable(1200) %6, ptr noundef nonnull align 8 dereferenceable(1200) %1)
  %8 = getelementptr inbounds i8, ptr %6, i64 1032
  %9 = getelementptr inbounds i8, ptr %6, i64 1192
  %10 = load i32, ptr %9, align 8, !tbaa !9
  tail call void @_ZN6Assimp12GetArrayCopyI10aiVector3tIfEEEvRPT_j(ptr noundef nonnull align 8 dereferenceable(8) %8, i32 noundef %10)
  %11 = getelementptr inbounds i8, ptr %6, i64 1040
  %12 = load i32, ptr %9, align 8, !tbaa !9
  tail call void @_ZN6Assimp12GetArrayCopyI10aiVector3tIfEEEvRPT_j(ptr noundef nonnull align 8 dereferenceable(8) %11, i32 noundef %12)
  %13 = getelementptr inbounds i8, ptr %6, i64 1048
  %14 = load i32, ptr %9, align 8, !tbaa !9
  tail call void @_ZN6Assimp12GetArrayCopyI10aiVector3tIfEEEvRPT_j(ptr noundef nonnull align 8 dereferenceable(8) %13, i32 noundef %14)
  %15 = getelementptr inbounds i8, ptr %6, i64 1056
  %16 = load i32, ptr %9, align 8, !tbaa !9
  tail call void @_ZN6Assimp12GetArrayCopyI10aiVector3tIfEEEvRPT_j(ptr noundef nonnull align 8 dereferenceable(8) %15, i32 noundef %16)
  %17 = tail call noundef zeroext i1 @_ZNK10aiAnimMesh16HasTextureCoordsEj(ptr noundef nonnull align 8 dereferenceable(1200) %6, i32 noundef 0)
  br i1 %17, label %.lr.ph, label %.preheader

.lr.ph:                                           ; preds = %5
  %18 = getelementptr inbounds i8, ptr %6, i64 1128
  br label %21

.preheader:                                       ; preds = %21, %5
  %19 = tail call noundef zeroext i1 @_ZNK10aiAnimMesh15HasVertexColorsEj(ptr noundef nonnull align 8 dereferenceable(1200) %6, i32 noundef 0)
  br i1 %19, label %.lr.ph27, label %.loopexit

.lr.ph27:                                         ; preds = %.preheader
  %20 = getelementptr inbounds i8, ptr %6, i64 1064
  br label %27

21:                                               ; preds = %.lr.ph, %21
  %.025 = phi i32 [ 0, %.lr.ph ], [ %22, %21 ]
  %22 = add i32 %.025, 1
  %23 = zext i32 %.025 to i64
  %24 = getelementptr inbounds [8 x ptr], ptr %18, i64 0, i64 %23
  %25 = load i32, ptr %9, align 8, !tbaa !9
  tail call void @_ZN6Assimp12GetArrayCopyI10aiVector3tIfEEEvRPT_j(ptr noundef nonnull align 8 dereferenceable(8) %24, i32 noundef %25)
  %26 = tail call noundef zeroext i1 @_ZNK10aiAnimMesh16HasTextureCoordsEj(ptr noundef nonnull align 8 dereferenceable(1200) %6, i32 noundef %22)
  br i1 %26, label %21, label %.preheader, !llvm.loop !14

27:                                               ; preds = %.lr.ph27, %27
  %.126 = phi i32 [ 0, %.lr.ph27 ], [ %28, %27 ]
  %28 = add i32 %.126, 1
  %29 = zext i32 %.126 to i64
  %30 = getelementptr inbounds [8 x ptr], ptr %20, i64 0, i64 %29
  %31 = load i32, ptr %9, align 8, !tbaa !9
  tail call void @_ZN6Assimp12GetArrayCopyI9aiColor4tIfEEEvRPT_j(ptr noundef nonnull align 8 dereferenceable(8) %30, i32 noundef %31)
  %32 = tail call noundef zeroext i1 @_ZNK10aiAnimMesh15HasVertexColorsEj(ptr noundef nonnull align 8 dereferenceable(1200) %6, i32 noundef %28)
  br i1 %32, label %27, label %.loopexit, !llvm.loop !16

.loopexit:                                        ; preds = %27, %.preheader, %2
  ret void
}

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN10aiAnimMeshC2Ev(ptr noundef nonnull align 8 dereferenceable(1200)) unnamed_addr #3 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(1200) ptr @_ZN10aiAnimMeshaSERKS_(ptr noundef nonnull align 8 dereferenceable(1200), ptr noundef nonnull align 8 dereferenceable(1200)) local_unnamed_addr #4 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZNK10aiAnimMesh16HasTextureCoordsEj(ptr noundef nonnull align 8 dereferenceable(1200), i32 noundef) local_unnamed_addr #3 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZNK10aiAnimMesh15HasVertexColorsEj(ptr noundef nonnull align 8 dereferenceable(1200), i32 noundef) local_unnamed_addr #3 align 2

attributes #0 = { nobuiltin allocsize(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" }
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 = { 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 #4 = { inlinehint 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 #5 = { builtin allocsize(0) }
attributes #6 = { 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 1192}
!10 = !{!"_ZTS10aiAnimMesh", !11, i64 0, !6, i64 1032, !6, i64 1040, !6, i64 1048, !6, i64 1056, !7, i64 1064, !7, i64 1128, !12, i64 1192, !13, i64 1196}
!11 = !{!"_ZTS8aiString", !12, i64 0, !7, i64 4}
!12 = !{!"int", !7, i64 0}
!13 = !{!"float", !7, i64 0}
!14 = distinct !{!14, !15}
!15 = !{!"llvm.loop.mustprogress"}
!16 = distinct !{!16, !15}


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