; LLVM IR from TheNachoBIT/GeoFenix-Engine :: Libraries/SOIL2/include (SOIL2)

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

@soilGlCompressedTexImage2D = external hidden global ptr, align 8
@has_DXT_capability = external hidden global i32, align 4
@.str.74 = external hidden unnamed_addr constant [32 x i8], align 1
@.str.75 = external hidden unnamed_addr constant [31 x i8], align 1
@.str.76 = external hidden unnamed_addr constant [37 x i8], align 1
@.str.77 = external hidden unnamed_addr constant [34 x i8], align 1

; 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: nounwind uwtable
declare dso_local i32 @SOIL_GL_ExtensionSupported(ptr noundef) #1

; Function Attrs: nounwind uwtable
define dso_local i32 @query_DXT_capability() #1 {
  %1 = alloca ptr, align 8
  %2 = load i32, ptr @has_DXT_capability, align 4, !tbaa !5
  %3 = icmp eq i32 %2, -1
  br i1 %3, label %4, label %26

4:                                                ; preds = %0
  %5 = call i32 @SOIL_GL_ExtensionSupported(ptr noundef @.str.74)
  %6 = icmp eq i32 0, %5
  br i1 %6, label %7, label %17

7:                                                ; preds = %4
  %8 = call i32 @SOIL_GL_ExtensionSupported(ptr noundef @.str.75)
  %9 = icmp eq i32 0, %8
  br i1 %9, label %10, label %17

10:                                               ; preds = %7
  %11 = call i32 @SOIL_GL_ExtensionSupported(ptr noundef @.str.76)
  %12 = icmp eq i32 0, %11
  br i1 %12, label %13, label %17

13:                                               ; preds = %10
  %14 = call i32 @SOIL_GL_ExtensionSupported(ptr noundef @.str.77)
  %15 = icmp eq i32 0, %14
  br i1 %15, label %16, label %17

16:                                               ; preds = %13
  store i32 0, ptr @has_DXT_capability, align 4, !tbaa !5
  br label %25

17:                                               ; preds = %13, %10, %7, %4
  call void @llvm.lifetime.start.p0(i64 8, ptr %1) #2
  %18 = call ptr @get_glCompressedTexImage2D_addr()
  store ptr %18, ptr %1, align 8, !tbaa !9
  %19 = load ptr, ptr %1, align 8, !tbaa !9
  %20 = icmp eq ptr null, %19
  br i1 %20, label %21, label %22

21:                                               ; preds = %17
  store i32 0, ptr @has_DXT_capability, align 4, !tbaa !5
  br label %24

22:                                               ; preds = %17
  %23 = load ptr, ptr %1, align 8, !tbaa !9
  store ptr %23, ptr @soilGlCompressedTexImage2D, align 8, !tbaa !9
  store i32 1, ptr @has_DXT_capability, align 4, !tbaa !5
  br label %24

24:                                               ; preds = %22, %21
  call void @llvm.lifetime.end.p0(i64 8, ptr %1) #2
  br label %25

25:                                               ; preds = %24, %16
  br label %26

26:                                               ; preds = %25, %0
  %27 = load i32, ptr @has_DXT_capability, align 4, !tbaa !5
  ret i32 %27
}

; Function Attrs: nounwind uwtable
declare hidden ptr @get_glCompressedTexImage2D_addr() #1

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #2 = { 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/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"any pointer", !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"

@soilGlCompressedTexImage2D = external hidden local_unnamed_addr global ptr, align 8
@has_DXT_capability = external hidden local_unnamed_addr global i32, align 4
@.str.74 = external hidden unnamed_addr constant [32 x i8], align 1
@.str.75 = external hidden unnamed_addr constant [31 x i8], align 1
@.str.76 = external hidden unnamed_addr constant [37 x i8], align 1
@.str.77 = external hidden unnamed_addr constant [34 x i8], align 1

; Function Attrs: nounwind uwtable
declare dso_local i32 @SOIL_GL_ExtensionSupported(ptr noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
define dso_local i32 @query_DXT_capability() local_unnamed_addr #0 {
  %1 = load i32, ptr @has_DXT_capability, align 4, !tbaa !5
  %2 = icmp eq i32 %1, -1
  br i1 %2, label %3, label %19

3:                                                ; preds = %0
  %4 = tail call i32 @SOIL_GL_ExtensionSupported(ptr noundef nonnull @.str.74)
  %5 = icmp eq i32 %4, 0
  br i1 %5, label %6, label %15

6:                                                ; preds = %3
  %7 = tail call i32 @SOIL_GL_ExtensionSupported(ptr noundef nonnull @.str.75)
  %8 = icmp eq i32 %7, 0
  br i1 %8, label %9, label %15

9:                                                ; preds = %6
  %10 = tail call i32 @SOIL_GL_ExtensionSupported(ptr noundef nonnull @.str.76)
  %11 = icmp eq i32 %10, 0
  br i1 %11, label %12, label %15

12:                                               ; preds = %9
  %13 = tail call i32 @SOIL_GL_ExtensionSupported(ptr noundef nonnull @.str.77)
  %14 = icmp eq i32 %13, 0
  br i1 %14, label %.sink.split, label %15

15:                                               ; preds = %12, %9, %6, %3
  %16 = tail call ptr @get_glCompressedTexImage2D_addr()
  %17 = icmp eq ptr %16, null
  br i1 %17, label %.sink.split, label %18

18:                                               ; preds = %15
  store ptr %16, ptr @soilGlCompressedTexImage2D, align 8, !tbaa !9
  br label %.sink.split

.sink.split:                                      ; preds = %18, %15, %12
  %.sink = phi i32 [ 0, %12 ], [ 1, %18 ], [ 0, %15 ]
  store i32 %.sink, ptr @has_DXT_capability, align 4, !tbaa !5
  br label %19

19:                                               ; preds = %.sink.split, %0
  %20 = phi i32 [ %1, %0 ], [ %.sink, %.sink.split ]
  ret i32 %20
}

; Function Attrs: nounwind uwtable
declare hidden ptr @get_glCompressedTexImage2D_addr() local_unnamed_addr #0

attributes #0 = { 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" }

!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/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"any pointer", !7, i64 0}


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