; LLVM IR from ronan-kerviche/glip-lib :: GLIP-Lib/src/Core (HdlTextureTools)

; 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.Glip::CoreGL::HdlTextureFormatDescriptor" = type { i32, i32, i32, i32, i32, [4 x i32], [4 x i32], [4 x i32], i8, i8, i8 }

; Function Attrs: mustprogress nounwind uwtable
define dso_local noundef zeroext i1 @_ZNK4Glip6CoreGL26HdlTextureFormatDescriptor12isDepthValidEj(ptr noundef nonnull align 4 dereferenceable(72) %0, i32 noundef %1) #0 align 2 {
  %3 = alloca ptr, align 8
  %4 = alloca i32, align 4
  store ptr %0, ptr %3, align 8, !tbaa !5
  store i32 %1, ptr %4, align 4, !tbaa !9
  %5 = load ptr, ptr %3, align 8
  %6 = getelementptr inbounds %"struct.Glip::CoreGL::HdlTextureFormatDescriptor", ptr %5, i32 0, i32 7
  %7 = getelementptr inbounds [4 x i32], ptr %6, i64 0, i64 0
  %8 = load i32, ptr %7, align 4, !tbaa !9
  %9 = load i32, ptr %4, align 4, !tbaa !9
  %10 = icmp eq i32 %8, %9
  br i1 %10, label %16, label %11

11:                                               ; preds = %2
  %12 = getelementptr inbounds %"struct.Glip::CoreGL::HdlTextureFormatDescriptor", ptr %5, i32 0, i32 7
  %13 = getelementptr inbounds [4 x i32], ptr %12, i64 0, i64 0
  %14 = load i32, ptr %13, align 4, !tbaa !9
  %15 = icmp eq i32 %14, 0
  br i1 %15, label %16, label %51

16:                                               ; preds = %11, %2
  %17 = getelementptr inbounds %"struct.Glip::CoreGL::HdlTextureFormatDescriptor", ptr %5, i32 0, i32 7
  %18 = getelementptr inbounds [4 x i32], ptr %17, i64 0, i64 1
  %19 = load i32, ptr %18, align 4, !tbaa !9
  %20 = load i32, ptr %4, align 4, !tbaa !9
  %21 = icmp eq i32 %19, %20
  br i1 %21, label %27, label %22

22:                                               ; preds = %16
  %23 = getelementptr inbounds %"struct.Glip::CoreGL::HdlTextureFormatDescriptor", ptr %5, i32 0, i32 7
  %24 = getelementptr inbounds [4 x i32], ptr %23, i64 0, i64 1
  %25 = load i32, ptr %24, align 4, !tbaa !9
  %26 = icmp eq i32 %25, 0
  br i1 %26, label %27, label %51

27:                                               ; preds = %22, %16
  %28 = getelementptr inbounds %"struct.Glip::CoreGL::HdlTextureFormatDescriptor", ptr %5, i32 0, i32 7
  %29 = getelementptr inbounds [4 x i32], ptr %28, i64 0, i64 2
  %30 = load i32, ptr %29, align 4, !tbaa !9
  %31 = load i32, ptr %4, align 4, !tbaa !9
  %32 = icmp eq i32 %30, %31
  br i1 %32, label %38, label %33

33:                                               ; preds = %27
  %34 = getelementptr inbounds %"struct.Glip::CoreGL::HdlTextureFormatDescriptor", ptr %5, i32 0, i32 7
  %35 = getelementptr inbounds [4 x i32], ptr %34, i64 0, i64 2
  %36 = load i32, ptr %35, align 4, !tbaa !9
  %37 = icmp eq i32 %36, 0
  br i1 %37, label %38, label %51

38:                                               ; preds = %33, %27
  %39 = getelementptr inbounds %"struct.Glip::CoreGL::HdlTextureFormatDescriptor", ptr %5, i32 0, i32 7
  %40 = getelementptr inbounds [4 x i32], ptr %39, i64 0, i64 3
  %41 = load i32, ptr %40, align 4, !tbaa !9
  %42 = load i32, ptr %4, align 4, !tbaa !9
  %43 = icmp eq i32 %41, %42
  br i1 %43, label %49, label %44

44:                                               ; preds = %38
  %45 = getelementptr inbounds %"struct.Glip::CoreGL::HdlTextureFormatDescriptor", ptr %5, i32 0, i32 7
  %46 = getelementptr inbounds [4 x i32], ptr %45, i64 0, i64 3
  %47 = load i32, ptr %46, align 4, !tbaa !9
  %48 = icmp eq i32 %47, 0
  br label %49

49:                                               ; preds = %44, %38
  %50 = phi i1 [ true, %38 ], [ %48, %44 ]
  br label %51

51:                                               ; preds = %49, %33, %22, %11
  %52 = phi i1 [ false, %33 ], [ false, %22 ], [ false, %11 ], [ %50, %49 ]
  ret i1 %52
}

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


; 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: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local noundef zeroext i1 @_ZNK4Glip6CoreGL26HdlTextureFormatDescriptor12isDepthValidEj(ptr nocapture noundef nonnull readonly align 4 dereferenceable(72) %0, i32 noundef %1) local_unnamed_addr #0 align 2 {
  %3 = getelementptr inbounds i8, ptr %0, i64 52
  %4 = load i32, ptr %3, align 4, !tbaa !5
  %5 = icmp eq i32 %4, %1
  %6 = icmp eq i32 %4, 0
  %or.cond = or i1 %5, %6
  br i1 %or.cond, label %7, label %22

7:                                                ; preds = %2
  %8 = getelementptr inbounds i8, ptr %0, i64 56
  %9 = load i32, ptr %8, align 4, !tbaa !5
  %10 = icmp eq i32 %9, %1
  %11 = icmp eq i32 %9, 0
  %or.cond7 = or i1 %10, %11
  br i1 %or.cond7, label %12, label %22

12:                                               ; preds = %7
  %13 = getelementptr inbounds i8, ptr %0, i64 60
  %14 = load i32, ptr %13, align 4, !tbaa !5
  %15 = icmp eq i32 %14, %1
  %16 = icmp eq i32 %14, 0
  %or.cond8 = or i1 %15, %16
  br i1 %or.cond8, label %17, label %22

17:                                               ; preds = %12
  %18 = getelementptr inbounds i8, ptr %0, i64 64
  %19 = load i32, ptr %18, align 4, !tbaa !5
  %20 = icmp eq i32 %19, %1
  %21 = icmp eq i32 %19, 0
  %spec.select = or i1 %20, %21
  br label %22

22:                                               ; preds = %17, %12, %7, %2
  %23 = phi i1 [ false, %2 ], [ false, %7 ], [ false, %12 ], [ %spec.select, %17 ]
  ret i1 %23
}

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


; Effective O3 passes: EarlyCSEPass,GlobalOptPass,InstCombinePass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass