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

@.str.1 = external hidden unnamed_addr constant [117 x i8], align 1
@.str.12 = external hidden unnamed_addr constant [10 x i8], align 1
@.str.13 = external hidden unnamed_addr constant [15 x i8], align 1
@.str.14 = external hidden unnamed_addr constant [16 x i8], align 1
@.str.15 = external hidden unnamed_addr constant [13 x i8], align 1
@.str.16 = external hidden unnamed_addr constant [12 x i8], align 1
@.str.17 = external hidden unnamed_addr constant [11 x i8], align 1
@.str.18 = external hidden unnamed_addr constant [8 x i8], align 1
@.str.19 = external hidden unnamed_addr constant [14 x i8], align 1
@.str.20 = external hidden unnamed_addr constant [14 x i8], align 1
@.str.21 = external hidden unnamed_addr constant [11 x i8], align 1

declare void @_ZN6Assimp17aiAssertViolationEPKcS1_i(ptr noundef, ptr noundef, i32 noundef) #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
declare dso_local i32 @aiGetMaterialString(ptr noundef, ptr noundef, i32 noundef, i32 noundef, ptr noundef) #2

; Function Attrs: mustprogress uwtable
define dso_local i32 @aiGetMaterialTexture(ptr noundef %0, i32 noundef %1, i32 noundef %2, ptr noundef %3, ptr noundef %4, ptr noundef %5, ptr noundef %6, ptr noundef %7, ptr noundef %8, ptr noundef %9) #2 {
  %11 = alloca i32, align 4
  %12 = alloca ptr, align 8
  %13 = alloca i32, align 4
  %14 = alloca i32, align 4
  %15 = alloca ptr, align 8
  %16 = alloca ptr, align 8
  %17 = alloca ptr, align 8
  %18 = alloca ptr, align 8
  %19 = alloca ptr, align 8
  %20 = alloca ptr, align 8
  %21 = alloca ptr, align 8
  %22 = alloca i32, align 4
  %23 = alloca i32, align 4
  store ptr %0, ptr %12, align 8, !tbaa !5
  store i32 %1, ptr %13, align 4, !tbaa !9
  store i32 %2, ptr %14, align 4, !tbaa !11
  store ptr %3, ptr %15, align 8, !tbaa !5
  store ptr %4, ptr %16, align 8, !tbaa !5
  store ptr %5, ptr %17, align 8, !tbaa !5
  store ptr %6, ptr %18, align 8, !tbaa !5
  store ptr %7, ptr %19, align 8, !tbaa !5
  store ptr %8, ptr %20, align 8, !tbaa !5
  store ptr %9, ptr %21, align 8, !tbaa !5
  %24 = load ptr, ptr %12, align 8, !tbaa !5
  %25 = icmp ne ptr null, %24
  br i1 %25, label %27, label %26

26:                                               ; preds = %10
  call void @_ZN6Assimp17aiAssertViolationEPKcS1_i(ptr noundef @.str.13, ptr noundef @.str.1, i32 noundef 436)
  br label %27

27:                                               ; preds = %26, %10
  %28 = phi i1 [ true, %10 ], [ false, %26 ]
  %29 = load ptr, ptr %15, align 8, !tbaa !5
  %30 = icmp ne ptr null, %29
  br i1 %30, label %32, label %31

31:                                               ; preds = %27
  call void @_ZN6Assimp17aiAssertViolationEPKcS1_i(ptr noundef @.str.14, ptr noundef @.str.1, i32 noundef 437)
  br label %32

32:                                               ; preds = %31, %27
  %33 = phi i1 [ true, %27 ], [ false, %31 ]
  %34 = load ptr, ptr %12, align 8, !tbaa !5
  %35 = load i32, ptr %13, align 4, !tbaa !9
  %36 = load i32, ptr %14, align 4, !tbaa !11
  %37 = load ptr, ptr %15, align 8, !tbaa !5
  %38 = call i32 @aiGetMaterialString(ptr noundef %34, ptr noundef @.str.12, i32 noundef %35, i32 noundef %36, ptr noundef %37)
  %39 = icmp ne i32 0, %38
  br i1 %39, label %40, label %41

40:                                               ; preds = %32
  store i32 -1, ptr %11, align 4
  br label %108

41:                                               ; preds = %32
  call void @llvm.lifetime.start.p0(i64 4, ptr %22) #4
  store i32 0, ptr %22, align 4, !tbaa !11
  %42 = load ptr, ptr %12, align 8, !tbaa !5
  %43 = load i32, ptr %13, align 4, !tbaa !9
  %44 = load i32, ptr %14, align 4, !tbaa !11
  %45 = call i32 @aiGetMaterialInteger(ptr noundef %42, ptr noundef @.str.15, i32 noundef %43, i32 noundef %44, ptr noundef %22)
  call void @llvm.lifetime.start.p0(i64 4, ptr %23) #4
  %46 = load i32, ptr %22, align 4, !tbaa !11
  store i32 %46, ptr %23, align 4, !tbaa !13
  %47 = load ptr, ptr %16, align 8, !tbaa !5
  %48 = icmp ne ptr %47, null
  br i1 %48, label %49, label %52

49:                                               ; preds = %41
  %50 = load i32, ptr %23, align 4, !tbaa !13
  %51 = load ptr, ptr %16, align 8, !tbaa !5
  store i32 %50, ptr %51, align 4, !tbaa !13
  br label %52

52:                                               ; preds = %49, %41
  %53 = load i32, ptr %23, align 4, !tbaa !13
  %54 = icmp eq i32 0, %53
  br i1 %54, label %55, label %64

55:                                               ; preds = %52
  %56 = load ptr, ptr %17, align 8, !tbaa !5
  %57 = icmp ne ptr %56, null
  br i1 %57, label %58, label %64

58:                                               ; preds = %55
  %59 = load ptr, ptr %12, align 8, !tbaa !5
  %60 = load i32, ptr %13, align 4, !tbaa !9
  %61 = load i32, ptr %14, align 4, !tbaa !11
  %62 = load ptr, ptr %17, align 8, !tbaa !5
  %63 = call i32 @aiGetMaterialInteger(ptr noundef %59, ptr noundef @.str.16, i32 noundef %60, i32 noundef %61, ptr noundef %62)
  br label %64

64:                                               ; preds = %58, %55, %52
  %65 = load ptr, ptr %18, align 8, !tbaa !5
  %66 = icmp ne ptr %65, null
  br i1 %66, label %67, label %73

67:                                               ; preds = %64
  %68 = load ptr, ptr %12, align 8, !tbaa !5
  %69 = load i32, ptr %13, align 4, !tbaa !9
  %70 = load i32, ptr %14, align 4, !tbaa !11
  %71 = load ptr, ptr %18, align 8, !tbaa !5
  %72 = call i32 @aiGetMaterialFloat(ptr noundef %68, ptr noundef @.str.17, i32 noundef %69, i32 noundef %70, ptr noundef %71)
  br label %73

73:                                               ; preds = %67, %64
  %74 = load ptr, ptr %19, align 8, !tbaa !5
  %75 = icmp ne ptr %74, null
  br i1 %75, label %76, label %82

76:                                               ; preds = %73
  %77 = load ptr, ptr %12, align 8, !tbaa !5
  %78 = load i32, ptr %13, align 4, !tbaa !9
  %79 = load i32, ptr %14, align 4, !tbaa !11
  %80 = load ptr, ptr %19, align 8, !tbaa !5
  %81 = call i32 @aiGetMaterialInteger(ptr noundef %77, ptr noundef @.str.18, i32 noundef %78, i32 noundef %79, ptr noundef %80)
  br label %82

82:                                               ; preds = %76, %73
  %83 = load ptr, ptr %20, align 8, !tbaa !5
  %84 = icmp ne ptr %83, null
  br i1 %84, label %85, label %98

85:                                               ; preds = %82
  %86 = load ptr, ptr %12, align 8, !tbaa !5
  %87 = load i32, ptr %13, align 4, !tbaa !9
  %88 = load i32, ptr %14, align 4, !tbaa !11
  %89 = load ptr, ptr %20, align 8, !tbaa !5
  %90 = getelementptr inbounds i32, ptr %89, i64 0
  %91 = call i32 @aiGetMaterialInteger(ptr noundef %86, ptr noundef @.str.19, i32 noundef %87, i32 noundef %88, ptr noundef %90)
  %92 = load ptr, ptr %12, align 8, !tbaa !5
  %93 = load i32, ptr %13, align 4, !tbaa !9
  %94 = load i32, ptr %14, align 4, !tbaa !11
  %95 = load ptr, ptr %20, align 8, !tbaa !5
  %96 = getelementptr inbounds i32, ptr %95, i64 1
  %97 = call i32 @aiGetMaterialInteger(ptr noundef %92, ptr noundef @.str.20, i32 noundef %93, i32 noundef %94, ptr noundef %96)
  br label %98

98:                                               ; preds = %85, %82
  %99 = load ptr, ptr %21, align 8, !tbaa !5
  %100 = icmp ne ptr %99, null
  br i1 %100, label %101, label %107

101:                                              ; preds = %98
  %102 = load ptr, ptr %12, align 8, !tbaa !5
  %103 = load i32, ptr %13, align 4, !tbaa !9
  %104 = load i32, ptr %14, align 4, !tbaa !11
  %105 = load ptr, ptr %21, align 8, !tbaa !5
  %106 = call i32 @aiGetMaterialInteger(ptr noundef %102, ptr noundef @.str.21, i32 noundef %103, i32 noundef %104, ptr noundef %105)
  br label %107

107:                                              ; preds = %101, %98
  store i32 0, ptr %11, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %23) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %22) #4
  br label %108

108:                                              ; preds = %107, %40
  %109 = load i32, ptr %11, align 4
  ret i32 %109
}

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local i32 @aiGetMaterialInteger(ptr noundef, ptr noundef, i32 noundef, i32 noundef, ptr noundef) #3

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local i32 @aiGetMaterialFloat(ptr noundef, ptr noundef, i32 noundef, i32 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 = { 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 #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 = !{!"_ZTS13aiTextureType", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"int", !7, i64 0}
!13 = !{!14, !14, i64 0}
!14 = !{!"_ZTS16aiTextureMapping", !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.12 = external hidden unnamed_addr constant [10 x i8], align 1
@.str.13 = external hidden unnamed_addr constant [15 x i8], align 1
@.str.14 = external hidden unnamed_addr constant [16 x i8], align 1
@.str.15 = external hidden unnamed_addr constant [13 x i8], align 1
@.str.16 = external hidden unnamed_addr constant [12 x i8], align 1
@.str.17 = external hidden unnamed_addr constant [11 x i8], align 1
@.str.18 = external hidden unnamed_addr constant [8 x i8], align 1
@.str.19 = external hidden unnamed_addr constant [14 x i8], align 1
@.str.20 = external hidden unnamed_addr constant [14 x i8], align 1
@.str.21 = external hidden unnamed_addr constant [11 x i8], align 1

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

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

; Function Attrs: mustprogress 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 i32 @aiGetMaterialString(ptr noundef, ptr noundef, i32 noundef, i32 noundef, ptr noundef) local_unnamed_addr #2

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

12:                                               ; preds = %10
  tail call void @_ZN6Assimp17aiAssertViolationEPKcS1_i(ptr noundef nonnull @.str.13, ptr noundef nonnull @.str.1, i32 noundef 436)
  br label %13

13:                                               ; preds = %12, %10
  %.not49 = icmp eq ptr %3, null
  br i1 %.not49, label %14, label %15

14:                                               ; preds = %13
  tail call void @_ZN6Assimp17aiAssertViolationEPKcS1_i(ptr noundef nonnull @.str.14, ptr noundef nonnull @.str.1, i32 noundef 437)
  br label %15

15:                                               ; preds = %14, %13
  %16 = tail call i32 @aiGetMaterialString(ptr noundef %0, ptr noundef nonnull @.str.12, i32 noundef %1, i32 noundef %2, ptr noundef %3)
  %.not50 = icmp eq i32 %16, 0
  br i1 %.not50, label %17, label %41

17:                                               ; preds = %15
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %11) #4
  store i32 0, ptr %11, align 4, !tbaa !5
  %18 = call i32 @aiGetMaterialInteger(ptr noundef %0, ptr noundef nonnull @.str.15, i32 noundef %1, i32 noundef %2, ptr noundef nonnull %11)
  %19 = load i32, ptr %11, align 4, !tbaa !5
  %.not51 = icmp eq ptr %4, null
  br i1 %.not51, label %21, label %20

20:                                               ; preds = %17
  store i32 %19, ptr %4, align 4, !tbaa !9
  br label %21

21:                                               ; preds = %20, %17
  %22 = icmp eq i32 %19, 0
  %23 = icmp ne ptr %5, null
  %or.cond = and i1 %23, %22
  br i1 %or.cond, label %24, label %26

24:                                               ; preds = %21
  %25 = call i32 @aiGetMaterialInteger(ptr noundef %0, ptr noundef nonnull @.str.16, i32 noundef %1, i32 noundef %2, ptr noundef nonnull %5)
  br label %26

26:                                               ; preds = %24, %21
  %.not52 = icmp eq ptr %6, null
  br i1 %.not52, label %29, label %27

27:                                               ; preds = %26
  %28 = call i32 @aiGetMaterialFloat(ptr noundef %0, ptr noundef nonnull @.str.17, i32 noundef %1, i32 noundef %2, ptr noundef nonnull %6)
  br label %29

29:                                               ; preds = %27, %26
  %.not53 = icmp eq ptr %7, null
  br i1 %.not53, label %32, label %30

30:                                               ; preds = %29
  %31 = call i32 @aiGetMaterialInteger(ptr noundef %0, ptr noundef nonnull @.str.18, i32 noundef %1, i32 noundef %2, ptr noundef nonnull %7)
  br label %32

32:                                               ; preds = %30, %29
  %.not54 = icmp eq ptr %8, null
  br i1 %.not54, label %37, label %33

33:                                               ; preds = %32
  %34 = call i32 @aiGetMaterialInteger(ptr noundef %0, ptr noundef nonnull @.str.19, i32 noundef %1, i32 noundef %2, ptr noundef nonnull %8)
  %35 = getelementptr inbounds i8, ptr %8, i64 4
  %36 = call i32 @aiGetMaterialInteger(ptr noundef %0, ptr noundef nonnull @.str.20, i32 noundef %1, i32 noundef %2, ptr noundef nonnull %35)
  br label %37

37:                                               ; preds = %33, %32
  %.not55 = icmp eq ptr %9, null
  br i1 %.not55, label %40, label %38

38:                                               ; preds = %37
  %39 = call i32 @aiGetMaterialInteger(ptr noundef %0, ptr noundef nonnull @.str.21, i32 noundef %1, i32 noundef %2, ptr noundef nonnull %9)
  br label %40

40:                                               ; preds = %38, %37
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %11) #4
  br label %41

41:                                               ; preds = %15, %40
  %.0 = phi i32 [ 0, %40 ], [ -1, %15 ]
  ret i32 %.0
}

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local i32 @aiGetMaterialInteger(ptr noundef, ptr noundef, i32 noundef, i32 noundef, ptr noundef) local_unnamed_addr #3

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local i32 @aiGetMaterialFloat(ptr noundef, ptr noundef, i32 noundef, i32 noundef, ptr noundef) local_unnamed_addr #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 = { mustprogress 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 = { 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 #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 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"_ZTS16aiTextureMapping", !7, i64 0}


; Effective O3 passes: EarlyCSEPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,PostOrderFunctionAttrsPass,ReassociatePass,SROAPass,SimplifyCFGPass,TailCallElimPass