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

; 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 @stbi_convert_bit_range(i32 noundef, i32 noundef, i32 noundef) #1

; Function Attrs: nounwind uwtable
define dso_local void @stbi_decode_DXT23_alpha_block(ptr noundef %0, ptr noundef %1) #1 {
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  store ptr %0, ptr %3, align 8, !tbaa !5
  store ptr %1, ptr %4, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #2
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #2
  store i32 0, ptr %6, align 4, !tbaa !9
  store i32 3, ptr %5, align 4, !tbaa !9
  br label %7

7:                                                ; preds = %30, %2
  %8 = load i32, ptr %5, align 4, !tbaa !9
  %9 = icmp slt i32 %8, 64
  br i1 %9, label %10, label %33

10:                                               ; preds = %7
  %11 = load ptr, ptr %4, align 8, !tbaa !5
  %12 = load i32, ptr %6, align 4, !tbaa !9
  %13 = ashr i32 %12, 3
  %14 = sext i32 %13 to i64
  %15 = getelementptr inbounds i8, ptr %11, i64 %14
  %16 = load i8, ptr %15, align 1, !tbaa !11
  %17 = zext i8 %16 to i32
  %18 = load i32, ptr %6, align 4, !tbaa !9
  %19 = and i32 %18, 7
  %20 = ashr i32 %17, %19
  %21 = and i32 %20, 15
  %22 = call i32 @stbi_convert_bit_range(i32 noundef %21, i32 noundef 4, i32 noundef 8)
  %23 = trunc i32 %22 to i8
  %24 = load ptr, ptr %3, align 8, !tbaa !5
  %25 = load i32, ptr %5, align 4, !tbaa !9
  %26 = sext i32 %25 to i64
  %27 = getelementptr inbounds i8, ptr %24, i64 %26
  store i8 %23, ptr %27, align 1, !tbaa !11
  %28 = load i32, ptr %6, align 4, !tbaa !9
  %29 = add nsw i32 %28, 4
  store i32 %29, ptr %6, align 4, !tbaa !9
  br label %30

30:                                               ; preds = %10
  %31 = load i32, ptr %5, align 4, !tbaa !9
  %32 = add nsw i32 %31, 4
  store i32 %32, ptr %5, align 4, !tbaa !9
  br label %7, !llvm.loop !12

33:                                               ; preds = %7
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #2
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #2
  ret void
}

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 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = !{!7, !7, i64 0}
!12 = distinct !{!12, !13}
!13 = !{!"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"

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

; Function Attrs: nounwind uwtable
define dso_local void @stbi_decode_DXT23_alpha_block(ptr nocapture noundef writeonly %0, ptr nocapture noundef readonly %1) local_unnamed_addr #0 {
  %3 = load i8, ptr %1, align 1, !tbaa !5
  %4 = and i8 %3, 15
  %5 = zext nneg i8 %4 to i32
  %6 = tail call i32 @stbi_convert_bit_range(i32 noundef %5, i32 noundef 4, i32 noundef 8)
  %7 = trunc i32 %6 to i8
  %8 = getelementptr inbounds i8, ptr %0, i64 3
  store i8 %7, ptr %8, align 1, !tbaa !5
  %9 = load i8, ptr %1, align 1, !tbaa !5
  %10 = lshr i8 %9, 4
  %11 = zext nneg i8 %10 to i32
  %12 = tail call i32 @stbi_convert_bit_range(i32 noundef %11, i32 noundef 4, i32 noundef 8)
  %13 = trunc i32 %12 to i8
  %14 = getelementptr inbounds i8, ptr %0, i64 7
  store i8 %13, ptr %14, align 1, !tbaa !5
  %15 = getelementptr inbounds i8, ptr %1, i64 1
  %16 = load i8, ptr %15, align 1, !tbaa !5
  %17 = and i8 %16, 15
  %18 = zext nneg i8 %17 to i32
  %19 = tail call i32 @stbi_convert_bit_range(i32 noundef %18, i32 noundef 4, i32 noundef 8)
  %20 = trunc i32 %19 to i8
  %21 = getelementptr inbounds i8, ptr %0, i64 11
  store i8 %20, ptr %21, align 1, !tbaa !5
  %22 = load i8, ptr %15, align 1, !tbaa !5
  %23 = lshr i8 %22, 4
  %24 = zext nneg i8 %23 to i32
  %25 = tail call i32 @stbi_convert_bit_range(i32 noundef %24, i32 noundef 4, i32 noundef 8)
  %26 = trunc i32 %25 to i8
  %27 = getelementptr inbounds i8, ptr %0, i64 15
  store i8 %26, ptr %27, align 1, !tbaa !5
  %28 = getelementptr inbounds i8, ptr %1, i64 2
  %29 = load i8, ptr %28, align 1, !tbaa !5
  %30 = and i8 %29, 15
  %31 = zext nneg i8 %30 to i32
  %32 = tail call i32 @stbi_convert_bit_range(i32 noundef %31, i32 noundef 4, i32 noundef 8)
  %33 = trunc i32 %32 to i8
  %34 = getelementptr inbounds i8, ptr %0, i64 19
  store i8 %33, ptr %34, align 1, !tbaa !5
  %35 = load i8, ptr %28, align 1, !tbaa !5
  %36 = lshr i8 %35, 4
  %37 = zext nneg i8 %36 to i32
  %38 = tail call i32 @stbi_convert_bit_range(i32 noundef %37, i32 noundef 4, i32 noundef 8)
  %39 = trunc i32 %38 to i8
  %40 = getelementptr inbounds i8, ptr %0, i64 23
  store i8 %39, ptr %40, align 1, !tbaa !5
  %41 = getelementptr inbounds i8, ptr %1, i64 3
  %42 = load i8, ptr %41, align 1, !tbaa !5
  %43 = and i8 %42, 15
  %44 = zext nneg i8 %43 to i32
  %45 = tail call i32 @stbi_convert_bit_range(i32 noundef %44, i32 noundef 4, i32 noundef 8)
  %46 = trunc i32 %45 to i8
  %47 = getelementptr inbounds i8, ptr %0, i64 27
  store i8 %46, ptr %47, align 1, !tbaa !5
  %48 = load i8, ptr %41, align 1, !tbaa !5
  %49 = lshr i8 %48, 4
  %50 = zext nneg i8 %49 to i32
  %51 = tail call i32 @stbi_convert_bit_range(i32 noundef %50, i32 noundef 4, i32 noundef 8)
  %52 = trunc i32 %51 to i8
  %53 = getelementptr inbounds i8, ptr %0, i64 31
  store i8 %52, ptr %53, align 1, !tbaa !5
  %54 = getelementptr inbounds i8, ptr %1, i64 4
  %55 = load i8, ptr %54, align 1, !tbaa !5
  %56 = and i8 %55, 15
  %57 = zext nneg i8 %56 to i32
  %58 = tail call i32 @stbi_convert_bit_range(i32 noundef %57, i32 noundef 4, i32 noundef 8)
  %59 = trunc i32 %58 to i8
  %60 = getelementptr inbounds i8, ptr %0, i64 35
  store i8 %59, ptr %60, align 1, !tbaa !5
  %61 = load i8, ptr %54, align 1, !tbaa !5
  %62 = lshr i8 %61, 4
  %63 = zext nneg i8 %62 to i32
  %64 = tail call i32 @stbi_convert_bit_range(i32 noundef %63, i32 noundef 4, i32 noundef 8)
  %65 = trunc i32 %64 to i8
  %66 = getelementptr inbounds i8, ptr %0, i64 39
  store i8 %65, ptr %66, align 1, !tbaa !5
  %67 = getelementptr inbounds i8, ptr %1, i64 5
  %68 = load i8, ptr %67, align 1, !tbaa !5
  %69 = and i8 %68, 15
  %70 = zext nneg i8 %69 to i32
  %71 = tail call i32 @stbi_convert_bit_range(i32 noundef %70, i32 noundef 4, i32 noundef 8)
  %72 = trunc i32 %71 to i8
  %73 = getelementptr inbounds i8, ptr %0, i64 43
  store i8 %72, ptr %73, align 1, !tbaa !5
  %74 = load i8, ptr %67, align 1, !tbaa !5
  %75 = lshr i8 %74, 4
  %76 = zext nneg i8 %75 to i32
  %77 = tail call i32 @stbi_convert_bit_range(i32 noundef %76, i32 noundef 4, i32 noundef 8)
  %78 = trunc i32 %77 to i8
  %79 = getelementptr inbounds i8, ptr %0, i64 47
  store i8 %78, ptr %79, align 1, !tbaa !5
  %80 = getelementptr inbounds i8, ptr %1, i64 6
  %81 = load i8, ptr %80, align 1, !tbaa !5
  %82 = and i8 %81, 15
  %83 = zext nneg i8 %82 to i32
  %84 = tail call i32 @stbi_convert_bit_range(i32 noundef %83, i32 noundef 4, i32 noundef 8)
  %85 = trunc i32 %84 to i8
  %86 = getelementptr inbounds i8, ptr %0, i64 51
  store i8 %85, ptr %86, align 1, !tbaa !5
  %87 = load i8, ptr %80, align 1, !tbaa !5
  %88 = lshr i8 %87, 4
  %89 = zext nneg i8 %88 to i32
  %90 = tail call i32 @stbi_convert_bit_range(i32 noundef %89, i32 noundef 4, i32 noundef 8)
  %91 = trunc i32 %90 to i8
  %92 = getelementptr inbounds i8, ptr %0, i64 55
  store i8 %91, ptr %92, align 1, !tbaa !5
  %93 = getelementptr inbounds i8, ptr %1, i64 7
  %94 = load i8, ptr %93, align 1, !tbaa !5
  %95 = and i8 %94, 15
  %96 = zext nneg i8 %95 to i32
  %97 = tail call i32 @stbi_convert_bit_range(i32 noundef %96, i32 noundef 4, i32 noundef 8)
  %98 = trunc i32 %97 to i8
  %99 = getelementptr inbounds i8, ptr %0, i64 59
  store i8 %98, ptr %99, align 1, !tbaa !5
  %100 = load i8, ptr %93, align 1, !tbaa !5
  %101 = lshr i8 %100, 4
  %102 = zext nneg i8 %101 to i32
  %103 = tail call i32 @stbi_convert_bit_range(i32 noundef %102, i32 noundef 4, i32 noundef 8)
  %104 = trunc i32 %103 to i8
  %105 = getelementptr inbounds i8, ptr %0, i64 63
  store i8 %104, ptr %105, align 1, !tbaa !5
  ret void
}

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 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C/C++ TBAA"}


; Effective O3 passes: GVNPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,LoopRotatePass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass,TailCallElimPass