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

@.str.1 = external hidden unnamed_addr constant [127 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [29 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [13 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [40 x i8], align 1

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

declare noundef ptr @_ZN6Assimp13DefaultLogger3getEv() #0

; 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
define dso_local void @_ZN6Assimp21MakeLeftHandedProcess15ProcessMaterialEP10aiMaterial(ptr noundef nonnull align 8 dereferenceable(24) %0, ptr noundef %1) #2 align 2 {
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca i32, align 4
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  store ptr %0, ptr %3, align 8, !tbaa !5
  store ptr %1, ptr %4, align 8, !tbaa !5
  %9 = load ptr, ptr %3, align 8
  %10 = load ptr, ptr %4, align 8, !tbaa !5
  %11 = icmp eq ptr null, %10
  br i1 %11, label %12, label %14

12:                                               ; preds = %2
  %13 = call noundef ptr @_ZN6Assimp13DefaultLogger3getEv()
  call void @_ZN6Assimp6Logger5errorEPKc(ptr noundef nonnull align 8 dereferenceable(12) %13, ptr noundef @.str.5)
  br label %58

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

16:                                               ; preds = %54, %14
  %17 = load i32, ptr %6, align 4, !tbaa !9
  %18 = load ptr, ptr %5, align 8, !tbaa !5
  %19 = getelementptr inbounds %struct.aiMaterial, ptr %18, i32 0, i32 1
  %20 = load i32, ptr %19, align 8, !tbaa !11
  %21 = icmp ult i32 %17, %20
  br i1 %21, label %23, label %22

22:                                               ; preds = %16
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #4
  br label %57

23:                                               ; preds = %16
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #4
  %24 = load ptr, ptr %5, align 8, !tbaa !5
  %25 = getelementptr inbounds %struct.aiMaterial, ptr %24, i32 0, i32 0
  %26 = load ptr, ptr %25, align 8, !tbaa !13
  %27 = load i32, ptr %6, align 4, !tbaa !9
  %28 = zext i32 %27 to i64
  %29 = getelementptr inbounds ptr, ptr %26, i64 %28
  %30 = load ptr, ptr %29, align 8, !tbaa !5
  store ptr %30, ptr %7, align 8, !tbaa !5
  %31 = load ptr, ptr %7, align 8, !tbaa !5
  %32 = getelementptr inbounds %struct.aiMaterialProperty, ptr %31, i32 0, i32 0
  %33 = getelementptr inbounds %struct.aiString, ptr %32, i32 0, i32 1
  %34 = getelementptr inbounds [1024 x i8], ptr %33, i64 0, i64 0
  %35 = call i32 @strcmp(ptr noundef %34, ptr noundef @.str.6) #5
  %36 = icmp ne i32 %35, 0
  br i1 %36, label %53, label %37

37:                                               ; preds = %23
  %38 = load ptr, ptr %7, align 8, !tbaa !5
  %39 = getelementptr inbounds %struct.aiMaterialProperty, ptr %38, i32 0, i32 3
  %40 = load i32, ptr %39, align 4, !tbaa !14
  %41 = zext i32 %40 to i64
  %42 = icmp uge i64 %41, 12
  br i1 %42, label %44, label %43

43:                                               ; preds = %37
  call void @_ZN6Assimp17aiAssertViolationEPKcS1_i(ptr noundef @.str.7, ptr noundef @.str.1, i32 noundef 210)
  br label %44

44:                                               ; preds = %43, %37
  %45 = phi i1 [ true, %37 ], [ false, %43 ]
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #4
  %46 = load ptr, ptr %7, align 8, !tbaa !5
  %47 = getelementptr inbounds %struct.aiMaterialProperty, ptr %46, i32 0, i32 5
  %48 = load ptr, ptr %47, align 8, !tbaa !18
  store ptr %48, ptr %8, align 8, !tbaa !5
  %49 = load ptr, ptr %8, align 8, !tbaa !5
  %50 = getelementptr inbounds %class.aiVector3t, ptr %49, i32 0, i32 2
  %51 = load float, ptr %50, align 4, !tbaa !19
  %52 = fmul float %51, -1.000000e+00
  store float %52, ptr %50, align 4, !tbaa !19
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #4
  br label %53

53:                                               ; preds = %44, %23
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #4
  br label %54

54:                                               ; preds = %53
  %55 = load i32, ptr %6, align 4, !tbaa !9
  %56 = add i32 %55, 1
  store i32 %56, ptr %6, align 4, !tbaa !9
  br label %16, !llvm.loop !22

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

58:                                               ; preds = %57, %12
  ret void
}

declare void @_ZN6Assimp6Logger5errorEPKc(ptr noundef nonnull align 8 dereferenceable(12), ptr noundef) #0

; Function Attrs: nounwind willreturn memory(read)
declare i32 @strcmp(ptr noundef, ptr noundef) #3

attributes #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 willreturn memory(read) "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 = { nounwind }
attributes #5 = { nounwind willreturn memory(read) }

!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 8}
!12 = !{!"_ZTS10aiMaterial", !6, i64 0, !10, i64 8, !10, i64 12}
!13 = !{!12, !6, i64 0}
!14 = !{!15, !10, i64 1036}
!15 = !{!"_ZTS18aiMaterialProperty", !16, i64 0, !10, i64 1028, !10, i64 1032, !10, i64 1036, !17, i64 1040, !6, i64 1048}
!16 = !{!"_ZTS8aiString", !10, i64 0, !7, i64 4}
!17 = !{!"_ZTS18aiPropertyTypeInfo", !7, i64 0}
!18 = !{!15, !6, i64 1048}
!19 = !{!20, !21, i64 8}
!20 = !{!"_ZTS10aiVector3tIfE", !21, i64 0, !21, i64 4, !21, i64 8}
!21 = !{!"float", !7, i64 0}
!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"

@.str.1 = external hidden unnamed_addr constant [127 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [29 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [13 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [40 x i8], align 1

declare void @_ZN6Assimp17aiAssertViolationEPKcS1_i(ptr noundef, ptr noundef, i32 noundef) local_unnamed_addr #0

declare noundef ptr @_ZN6Assimp13DefaultLogger3getEv() local_unnamed_addr #0

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN6Assimp21MakeLeftHandedProcess15ProcessMaterialEP10aiMaterial(ptr nocapture noundef nonnull readnone align 8 dereferenceable(24) %0, ptr noundef readonly %1) local_unnamed_addr #1 align 2 {
  %3 = icmp eq ptr %1, null
  br i1 %3, label %6, label %.preheader

.preheader:                                       ; preds = %2
  %4 = getelementptr inbounds i8, ptr %1, i64 8
  %5 = load i32, ptr %4, align 8, !tbaa !5
  %.not13 = icmp eq i32 %5, 0
  br i1 %.not13, label %.loopexit, label %.lr.ph

6:                                                ; preds = %2
  %7 = tail call noundef ptr @_ZN6Assimp13DefaultLogger3getEv()
  tail call void @_ZN6Assimp6Logger5errorEPKc(ptr noundef nonnull align 8 dereferenceable(12) %7, ptr noundef nonnull @.str.5)
  br label %.loopexit

.lr.ph:                                           ; preds = %.preheader, %25
  %.pre15 = phi i32 [ %.pre16, %25 ], [ %5, %.preheader ]
  %8 = phi i32 [ %26, %25 ], [ %5, %.preheader ]
  %indvars.iv = phi i64 [ %indvars.iv.next, %25 ], [ 0, %.preheader ]
  %9 = load ptr, ptr %1, align 8, !tbaa !11
  %10 = getelementptr inbounds ptr, ptr %9, i64 %indvars.iv
  %11 = load ptr, ptr %10, align 8, !tbaa !12
  %12 = getelementptr inbounds i8, ptr %11, i64 4
  %13 = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %12, ptr noundef nonnull dereferenceable(1) @.str.6) #3
  %.not = icmp eq i32 %13, 0
  br i1 %.not, label %14, label %25

14:                                               ; preds = %.lr.ph
  %15 = getelementptr inbounds i8, ptr %11, i64 1036
  %16 = load i32, ptr %15, align 4, !tbaa !13
  %17 = icmp ugt i32 %16, 11
  br i1 %17, label %19, label %18

18:                                               ; preds = %14
  tail call void @_ZN6Assimp17aiAssertViolationEPKcS1_i(ptr noundef nonnull @.str.7, ptr noundef nonnull @.str.1, i32 noundef 210)
  %.pre.pre = load i32, ptr %4, align 8, !tbaa !5
  br label %19

19:                                               ; preds = %18, %14
  %.pre = phi i32 [ %.pre.pre, %18 ], [ %.pre15, %14 ]
  %20 = getelementptr inbounds i8, ptr %11, i64 1048
  %21 = load ptr, ptr %20, align 8, !tbaa !17
  %22 = getelementptr inbounds i8, ptr %21, i64 8
  %23 = load float, ptr %22, align 4, !tbaa !18
  %24 = fneg float %23
  store float %24, ptr %22, align 4, !tbaa !18
  br label %25

25:                                               ; preds = %19, %.lr.ph
  %.pre16 = phi i32 [ %.pre, %19 ], [ %.pre15, %.lr.ph ]
  %26 = phi i32 [ %.pre, %19 ], [ %8, %.lr.ph ]
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %27 = zext i32 %26 to i64
  %28 = icmp ult i64 %indvars.iv.next, %27
  br i1 %28, label %.lr.ph, label %.loopexit, !llvm.loop !21

.loopexit:                                        ; preds = %25, %.preheader, %6
  ret void
}

declare void @_ZN6Assimp6Logger5errorEPKc(ptr noundef nonnull align 8 dereferenceable(12), ptr noundef) local_unnamed_addr #0

; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare i32 @strcmp(ptr nocapture noundef, ptr nocapture noundef) local_unnamed_addr #2

attributes #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 = { mustprogress nofree nounwind willreturn memory(argmem: read) "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 willreturn memory(read) }

!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, !10, i64 8}
!6 = !{!"_ZTS10aiMaterial", !7, i64 0, !10, i64 8, !10, i64 12}
!7 = !{!"any pointer", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!"int", !8, i64 0}
!11 = !{!6, !7, i64 0}
!12 = !{!7, !7, i64 0}
!13 = !{!14, !10, i64 1036}
!14 = !{!"_ZTS18aiMaterialProperty", !15, i64 0, !10, i64 1028, !10, i64 1032, !10, i64 1036, !16, i64 1040, !7, i64 1048}
!15 = !{!"_ZTS8aiString", !10, i64 0, !8, i64 4}
!16 = !{!"_ZTS18aiPropertyTypeInfo", !8, i64 0}
!17 = !{!14, !7, i64 1048}
!18 = !{!19, !20, i64 8}
!19 = !{!"_ZTS10aiVector3tIfE", !20, i64 0, !20, i64 4, !20, i64 8}
!20 = !{!"float", !8, i64 0}
!21 = distinct !{!21, !22}
!22 = !{!"llvm.loop.mustprogress"}


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