; LLVM IR from Overload-Technologies/Overload :: Dependencies/assimp/code/Material (MaterialSystem)

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

@.str.1 = external hidden unnamed_addr constant [117 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [16 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [23 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [36 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [18 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [42 x i8], align 1
@.str.11 = external hidden unnamed_addr constant [29 x i8], align 1

; Function Attrs: mustprogress uwtable
declare dso_local i32 @aiGetMaterialProperty(ptr noundef, ptr noundef, i32 noundef, i32 noundef, ptr noundef) #0

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

declare noundef ptr @_ZN6Assimp13DefaultLogger3getEv() #1

; Function Attrs: mustprogress uwtable
define dso_local i32 @aiGetMaterialString(ptr noundef %0, ptr noundef %1, i32 noundef %2, i32 noundef %3, ptr noundef %4) #0 {
  %6 = alloca i32, align 4
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  %11 = alloca ptr, align 8
  %12 = alloca ptr, align 8
  %13 = alloca i32, align 4
  store ptr %0, ptr %7, align 8, !tbaa !5
  store ptr %1, ptr %8, align 8, !tbaa !5
  store i32 %2, ptr %9, align 4, !tbaa !9
  store i32 %3, ptr %10, align 4, !tbaa !9
  store ptr %4, ptr %11, align 8, !tbaa !5
  %14 = load ptr, ptr %11, align 8, !tbaa !5
  %15 = icmp ne ptr %14, null
  br i1 %15, label %17, label %16

16:                                               ; preds = %5
  call void @_ZN6Assimp17aiAssertViolationEPKcS1_i(ptr noundef @.str.4, ptr noundef @.str.1, i32 noundef 380)
  br label %17

17:                                               ; preds = %16, %5
  %18 = phi i1 [ true, %5 ], [ false, %16 ]
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #4
  %19 = load ptr, ptr %7, align 8, !tbaa !5
  %20 = load ptr, ptr %8, align 8, !tbaa !5
  %21 = load i32, ptr %9, align 4, !tbaa !9
  %22 = load i32, ptr %10, align 4, !tbaa !9
  %23 = call i32 @aiGetMaterialProperty(ptr noundef %19, ptr noundef %20, i32 noundef %21, i32 noundef %22, ptr noundef %12)
  %24 = load ptr, ptr %12, align 8, !tbaa !5
  %25 = icmp ne ptr %24, null
  br i1 %25, label %27, label %26

26:                                               ; preds = %17
  store i32 -1, ptr %6, align 4
  store i32 1, ptr %13, align 4
  br label %87

27:                                               ; preds = %17
  %28 = load ptr, ptr %12, align 8, !tbaa !5
  %29 = getelementptr inbounds %struct.aiMaterialProperty, ptr %28, i32 0, i32 4
  %30 = load i32, ptr %29, align 8, !tbaa !11
  %31 = icmp eq i32 3, %30
  br i1 %31, label %32, label %84

32:                                               ; preds = %27
  %33 = load ptr, ptr %12, align 8, !tbaa !5
  %34 = getelementptr inbounds %struct.aiMaterialProperty, ptr %33, i32 0, i32 3
  %35 = load i32, ptr %34, align 4, !tbaa !15
  %36 = icmp uge i32 %35, 5
  br i1 %36, label %38, label %37

37:                                               ; preds = %32
  call void @_ZN6Assimp17aiAssertViolationEPKcS1_i(ptr noundef @.str.5, ptr noundef @.str.1, i32 noundef 389)
  br label %38

38:                                               ; preds = %37, %32
  %39 = phi i1 [ true, %32 ], [ false, %37 ]
  %40 = load ptr, ptr %12, align 8, !tbaa !5
  %41 = getelementptr inbounds %struct.aiMaterialProperty, ptr %40, i32 0, i32 5
  %42 = load ptr, ptr %41, align 8, !tbaa !16
  %43 = load i32, ptr %42, align 4, !tbaa !9
  %44 = load ptr, ptr %11, align 8, !tbaa !5
  %45 = getelementptr inbounds %struct.aiString, ptr %44, i32 0, i32 0
  store i32 %43, ptr %45, align 4, !tbaa !17
  %46 = load ptr, ptr %11, align 8, !tbaa !5
  %47 = getelementptr inbounds %struct.aiString, ptr %46, i32 0, i32 0
  %48 = load i32, ptr %47, align 4, !tbaa !17
  %49 = add i32 %48, 1
  %50 = add i32 %49, 4
  %51 = load ptr, ptr %12, align 8, !tbaa !5
  %52 = getelementptr inbounds %struct.aiMaterialProperty, ptr %51, i32 0, i32 3
  %53 = load i32, ptr %52, align 4, !tbaa !15
  %54 = icmp eq i32 %50, %53
  br i1 %54, label %56, label %55

55:                                               ; preds = %38
  call void @_ZN6Assimp17aiAssertViolationEPKcS1_i(ptr noundef @.str.10, ptr noundef @.str.1, i32 noundef 394)
  br label %56

56:                                               ; preds = %55, %38
  %57 = phi i1 [ true, %38 ], [ false, %55 ]
  %58 = load ptr, ptr %12, align 8, !tbaa !5
  %59 = getelementptr inbounds %struct.aiMaterialProperty, ptr %58, i32 0, i32 5
  %60 = load ptr, ptr %59, align 8, !tbaa !16
  %61 = load ptr, ptr %12, align 8, !tbaa !5
  %62 = getelementptr inbounds %struct.aiMaterialProperty, ptr %61, i32 0, i32 3
  %63 = load i32, ptr %62, align 4, !tbaa !15
  %64 = sub i32 %63, 1
  %65 = zext i32 %64 to i64
  %66 = getelementptr inbounds i8, ptr %60, i64 %65
  %67 = load i8, ptr %66, align 1, !tbaa !18
  %68 = icmp ne i8 %67, 0
  br i1 %68, label %69, label %70

69:                                               ; preds = %56
  call void @_ZN6Assimp17aiAssertViolationEPKcS1_i(ptr noundef @.str.6, ptr noundef @.str.1, i32 noundef 395)
  br label %70

70:                                               ; preds = %69, %56
  %71 = phi i1 [ true, %56 ], [ false, %69 ]
  %72 = load ptr, ptr %11, align 8, !tbaa !5
  %73 = getelementptr inbounds %struct.aiString, ptr %72, i32 0, i32 1
  %74 = getelementptr inbounds [1024 x i8], ptr %73, i64 0, i64 0
  %75 = load ptr, ptr %12, align 8, !tbaa !5
  %76 = getelementptr inbounds %struct.aiMaterialProperty, ptr %75, i32 0, i32 5
  %77 = load ptr, ptr %76, align 8, !tbaa !16
  %78 = getelementptr inbounds i8, ptr %77, i64 4
  %79 = load ptr, ptr %11, align 8, !tbaa !5
  %80 = getelementptr inbounds %struct.aiString, ptr %79, i32 0, i32 0
  %81 = load i32, ptr %80, align 4, !tbaa !17
  %82 = add i32 %81, 1
  %83 = zext i32 %82 to i64
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %74, ptr align 1 %78, i64 %83, i1 false)
  br label %86

84:                                               ; preds = %27
  %85 = call noundef ptr @_ZN6Assimp13DefaultLogger3getEv()
  call void @_ZN6Assimp6Logger5errorIJRA18_KcRPS2_RA29_S2_EEEvDpOT_(ptr noundef nonnull align 8 dereferenceable(12) %85, ptr noundef nonnull align 1 dereferenceable(18) @.str.7, ptr noundef nonnull align 8 dereferenceable(8) %8, ptr noundef nonnull align 1 dereferenceable(29) @.str.11)
  store i32 -1, ptr %6, align 4
  store i32 1, ptr %13, align 4
  br label %87

86:                                               ; preds = %70
  store i32 0, ptr %6, align 4
  store i32 1, ptr %13, align 4
  br label %87

87:                                               ; preds = %86, %84, %26
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #4
  %88 = load i32, ptr %6, align 4
  ret i32 %88
}

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #3

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN6Assimp6Logger5errorIJRA18_KcRPS2_RA29_S2_EEEvDpOT_(ptr noundef nonnull align 8 dereferenceable(12), ptr noundef nonnull align 1 dereferenceable(18), ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 1 dereferenceable(29)) #0 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 = { "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 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #4 = { 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, !14, i64 1040}
!12 = !{!"_ZTS18aiMaterialProperty", !13, i64 0, !10, i64 1028, !10, i64 1032, !10, i64 1036, !14, i64 1040, !6, i64 1048}
!13 = !{!"_ZTS8aiString", !10, i64 0, !7, i64 4}
!14 = !{!"_ZTS18aiPropertyTypeInfo", !7, i64 0}
!15 = !{!12, !10, i64 1036}
!16 = !{!12, !6, i64 1048}
!17 = !{!13, !10, i64 0}
!18 = !{!7, !7, i64 0}


; 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 [117 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [16 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [23 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [36 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [18 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [42 x i8], align 1
@.str.11 = external hidden unnamed_addr constant [29 x i8], align 1

; Function Attrs: mustprogress uwtable
declare dso_local i32 @aiGetMaterialProperty(ptr noundef, ptr noundef, i32 noundef, i32 noundef, ptr noundef) local_unnamed_addr #0

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

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

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

declare noundef ptr @_ZN6Assimp13DefaultLogger3getEv() local_unnamed_addr #1

; Function Attrs: mustprogress uwtable
define dso_local range(i32 -1, 1) i32 @aiGetMaterialString(ptr noundef %0, ptr noundef %1, i32 noundef %2, i32 noundef %3, ptr noundef %4) local_unnamed_addr #0 {
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  store ptr %1, ptr %6, align 8, !tbaa !5
  %.not = icmp eq ptr %4, null
  br i1 %.not, label %8, label %9

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

9:                                                ; preds = %8, %5
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %7) #4
  %10 = call i32 @aiGetMaterialProperty(ptr noundef %0, ptr noundef %1, i32 noundef %2, i32 noundef %3, ptr noundef nonnull %7)
  %11 = load ptr, ptr %7, align 8, !tbaa !5
  %.not9 = icmp eq ptr %11, null
  br i1 %.not9, label %47, label %12

12:                                               ; preds = %9
  %13 = getelementptr inbounds i8, ptr %11, i64 1040
  %14 = load i32, ptr %13, align 8, !tbaa !9
  %15 = icmp eq i32 %14, 3
  br i1 %15, label %16, label %45

16:                                               ; preds = %12
  %17 = getelementptr inbounds i8, ptr %11, i64 1036
  %18 = load i32, ptr %17, align 4, !tbaa !14
  %19 = icmp ugt i32 %18, 4
  br i1 %19, label %21, label %20

20:                                               ; preds = %16
  call void @_ZN6Assimp17aiAssertViolationEPKcS1_i(ptr noundef nonnull @.str.5, ptr noundef nonnull @.str.1, i32 noundef 389)
  %.pre = load ptr, ptr %7, align 8, !tbaa !5
  %.phi.trans.insert = getelementptr inbounds i8, ptr %.pre, i64 1036
  %.pre11 = load i32, ptr %.phi.trans.insert, align 4, !tbaa !14
  br label %21

21:                                               ; preds = %20, %16
  %22 = phi i32 [ %.pre11, %20 ], [ %18, %16 ]
  %23 = phi ptr [ %.pre, %20 ], [ %11, %16 ]
  %24 = getelementptr inbounds i8, ptr %23, i64 1048
  %25 = load ptr, ptr %24, align 8, !tbaa !15
  %26 = load i32, ptr %25, align 4, !tbaa !16
  store i32 %26, ptr %4, align 4, !tbaa !17
  %27 = add i32 %26, 5
  %28 = icmp eq i32 %27, %22
  br i1 %28, label %30, label %29

29:                                               ; preds = %21
  call void @_ZN6Assimp17aiAssertViolationEPKcS1_i(ptr noundef nonnull @.str.10, ptr noundef nonnull @.str.1, i32 noundef 394)
  %.pre12 = load ptr, ptr %7, align 8, !tbaa !5
  %.phi.trans.insert13 = getelementptr inbounds i8, ptr %.pre12, i64 1048
  %.pre14 = load ptr, ptr %.phi.trans.insert13, align 8, !tbaa !15
  %.phi.trans.insert15 = getelementptr inbounds i8, ptr %.pre12, i64 1036
  %.pre16 = load i32, ptr %.phi.trans.insert15, align 4, !tbaa !14
  br label %30

30:                                               ; preds = %29, %21
  %31 = phi i32 [ %.pre16, %29 ], [ %22, %21 ]
  %32 = phi ptr [ %.pre14, %29 ], [ %25, %21 ]
  %33 = add i32 %31, -1
  %34 = zext i32 %33 to i64
  %35 = getelementptr inbounds i8, ptr %32, i64 %34
  %36 = load i8, ptr %35, align 1, !tbaa !18
  %.not10 = icmp eq i8 %36, 0
  br i1 %.not10, label %38, label %37

37:                                               ; preds = %30
  call void @_ZN6Assimp17aiAssertViolationEPKcS1_i(ptr noundef nonnull @.str.6, ptr noundef nonnull @.str.1, i32 noundef 395)
  %.pre17 = load ptr, ptr %7, align 8, !tbaa !5
  %.phi.trans.insert18 = getelementptr inbounds i8, ptr %.pre17, i64 1048
  %.pre19 = load ptr, ptr %.phi.trans.insert18, align 8, !tbaa !15
  br label %38

38:                                               ; preds = %37, %30
  %39 = phi ptr [ %.pre19, %37 ], [ %32, %30 ]
  %40 = getelementptr inbounds i8, ptr %4, i64 4
  %41 = getelementptr inbounds i8, ptr %39, i64 4
  %42 = load i32, ptr %4, align 4, !tbaa !17
  %43 = add i32 %42, 1
  %44 = zext i32 %43 to i64
  call void @llvm.memcpy.p0.p0.i64(ptr nonnull align 4 %40, ptr nonnull align 1 %41, i64 %44, i1 false)
  br label %47

45:                                               ; preds = %12
  %46 = call noundef ptr @_ZN6Assimp13DefaultLogger3getEv()
  call void @_ZN6Assimp6Logger5errorIJRA18_KcRPS2_RA29_S2_EEEvDpOT_(ptr noundef nonnull align 8 dereferenceable(12) %46, ptr noundef nonnull align 1 dereferenceable(18) @.str.7, ptr noundef nonnull align 8 dereferenceable(8) %6, ptr noundef nonnull align 1 dereferenceable(29) @.str.11)
  br label %47

47:                                               ; preds = %9, %38, %45
  %.0 = phi i32 [ 0, %38 ], [ -1, %45 ], [ -1, %9 ]
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %7) #4
  ret i32 %.0
}

; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #3

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN6Assimp6Logger5errorIJRA18_KcRPS2_RA29_S2_EEEvDpOT_(ptr noundef nonnull align 8 dereferenceable(12), ptr noundef nonnull align 1 dereferenceable(18), ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 1 dereferenceable(29)) local_unnamed_addr #0 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 = { "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 nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #4 = { 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, !13, i64 1040}
!10 = !{!"_ZTS18aiMaterialProperty", !11, i64 0, !12, i64 1028, !12, i64 1032, !12, i64 1036, !13, i64 1040, !6, i64 1048}
!11 = !{!"_ZTS8aiString", !12, i64 0, !7, i64 4}
!12 = !{!"int", !7, i64 0}
!13 = !{!"_ZTS18aiPropertyTypeInfo", !7, i64 0}
!14 = !{!10, !12, i64 1036}
!15 = !{!10, !6, i64 1048}
!16 = !{!12, !12, i64 0}
!17 = !{!11, !12, i64 0}
!18 = !{!7, !7, i64 0}


; Effective O3 passes: BDCEPass,EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,SROAPass,SimplifyCFGPass,TailCallElimPass