; LLVM IR from Try/Tempest :: Engine/gapi/spirv/shaderanalyzer.ll (ZNK14ShaderAnalyzer13canGenerateVsEv)

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

%class.ShaderAnalyzer = type <{ i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, [768 x i32], [768 x i32], [4 x i8], %"class.std::unordered_map", ptr, %"class.libspirv::MutableBytecode", %"class.std::unordered_map.13", %"class.std::unordered_map.27", %"class.std::unordered_map.41", %"class.std::unordered_map.55", %"class.std::unordered_map.69", i32, [4 x i8] }>
%"class.std::unordered_map" = type { %"class.std::_Hashtable" }
%"class.std::_Hashtable" = type { ptr, i64, %"struct.std::__detail::_Hash_node_base", i64, %"struct.std::__detail::_Prime_rehash_policy", ptr }
%"struct.std::__detail::_Hash_node_base" = type { ptr }
%"struct.std::__detail::_Prime_rehash_policy" = type { float, i64 }
%"class.libspirv::MutableBytecode" = type { %"class.libspirv::Bytecode.base", %"class.std::vector.8" }
%"class.libspirv::Bytecode.base" = type <{ ptr, i64, i32 }>
%"class.std::vector.8" = type { %"struct.std::_Vector_base.9" }
%"struct.std::_Vector_base.9" = type { %"struct.std::_Vector_base<libspirv::Bytecode::OpCode, std::allocator<libspirv::Bytecode::OpCode>>::_Vector_impl" }
%"struct.std::_Vector_base<libspirv::Bytecode::OpCode, std::allocator<libspirv::Bytecode::OpCode>>::_Vector_impl" = type { %"struct.std::_Vector_base<libspirv::Bytecode::OpCode, std::allocator<libspirv::Bytecode::OpCode>>::_Vector_impl_data" }
%"struct.std::_Vector_base<libspirv::Bytecode::OpCode, std::allocator<libspirv::Bytecode::OpCode>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.std::unordered_map.13" = type { %"class.std::_Hashtable.14" }
%"class.std::_Hashtable.14" = type { ptr, i64, %"struct.std::__detail::_Hash_node_base", i64, %"struct.std::__detail::_Prime_rehash_policy", ptr }
%"class.std::unordered_map.27" = type { %"class.std::_Hashtable.28" }
%"class.std::_Hashtable.28" = type { ptr, i64, %"struct.std::__detail::_Hash_node_base", i64, %"struct.std::__detail::_Prime_rehash_policy", ptr }
%"class.std::unordered_map.41" = type { %"class.std::_Hashtable.42" }
%"class.std::_Hashtable.42" = type { ptr, i64, %"struct.std::__detail::_Hash_node_base", i64, %"struct.std::__detail::_Prime_rehash_policy", ptr }
%"class.std::unordered_map.55" = type { %"class.std::_Hashtable.56" }
%"class.std::_Hashtable.56" = type { ptr, i64, %"struct.std::__detail::_Hash_node_base", i64, %"struct.std::__detail::_Prime_rehash_policy", ptr }
%"class.std::unordered_map.69" = type { %"class.std::_Hashtable.70" }
%"class.std::_Hashtable.70" = type { ptr, i64, %"struct.std::__detail::_Hash_node_base", i64, %"struct.std::__detail::_Prime_rehash_policy", ptr }

; 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: mustprogress nounwind uwtable
define dso_local noundef zeroext i1 @_ZNK14ShaderAnalyzer13canGenerateVsEv(ptr noundef nonnull align 8 dereferenceable(6596) %0) #1 align 2 {
  %2 = alloca i1, align 1
  %3 = alloca ptr, align 8
  %4 = alloca i64, align 8
  %5 = alloca i32, align 4
  store ptr %0, ptr %3, align 8, !tbaa !5
  %6 = load ptr, ptr %3, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #2
  store i64 0, ptr %4, align 8, !tbaa !9
  br label %7

7:                                                ; preds = %22, %1
  %8 = load i64, ptr %4, align 8, !tbaa !9
  %9 = getelementptr inbounds %class.ShaderAnalyzer, ptr %6, i32 0, i32 12
  %10 = load i32, ptr %9, align 8, !tbaa !11
  %11 = zext i32 %10 to i64
  %12 = icmp ult i64 %8, %11
  br i1 %12, label %14, label %13

13:                                               ; preds = %7
  store i32 2, ptr %5, align 4
  br label %25

14:                                               ; preds = %7
  %15 = getelementptr inbounds %class.ShaderAnalyzer, ptr %6, i32 0, i32 13
  %16 = load i64, ptr %4, align 8, !tbaa !9
  %17 = getelementptr inbounds [768 x i32], ptr %15, i64 0, i64 %16
  %18 = load i32, ptr %17, align 4, !tbaa !35
  %19 = icmp eq i32 %18, 256
  br i1 %19, label %20, label %21

20:                                               ; preds = %14
  store i1 false, ptr %2, align 1
  store i32 1, ptr %5, align 4
  br label %25

21:                                               ; preds = %14
  br label %22

22:                                               ; preds = %21
  %23 = load i64, ptr %4, align 8, !tbaa !9
  %24 = add i64 %23, 1
  store i64 %24, ptr %4, align 8, !tbaa !9
  br label %7, !llvm.loop !36

25:                                               ; preds = %20, %13
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #2
  %26 = load i32, ptr %5, align 4
  switch i32 %26, label %30 [
    i32 2, label %27
    i32 1, label %28
  ]

27:                                               ; preds = %25
  store i1 false, ptr %2, align 1
  br label %28

28:                                               ; preds = %27, %25
  %29 = load i1, ptr %2, align 1
  ret i1 %29

30:                                               ; preds = %25
  unreachable
}

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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" }
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++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"long", !7, i64 0}
!11 = !{!12, !13, i64 48}
!12 = !{!"_ZTS14ShaderAnalyzer", !13, i64 0, !13, i64 4, !13, i64 8, !13, i64 12, !13, i64 16, !13, i64 20, !13, i64 24, !13, i64 28, !13, i64 32, !13, i64 36, !13, i64 40, !13, i64 44, !13, i64 48, !7, i64 52, !7, i64 3124, !14, i64 6200, !6, i64 6256, !19, i64 6264, !25, i64 6312, !27, i64 6368, !29, i64 6424, !31, i64 6480, !33, i64 6536, !13, i64 6592}
!13 = !{!"int", !7, i64 0}
!14 = !{!"_ZTSSt13unordered_mapIjN14ShaderAnalyzer7VaryingESt4hashIjESt8equal_toIjESaISt4pairIKjS1_EEE", !15, i64 0}
!15 = !{!"_ZTSSt10_HashtableIjSt4pairIKjN14ShaderAnalyzer7VaryingEESaIS4_ENSt8__detail10_Select1stESt8equal_toIjESt4hashIjENS6_18_Mod_range_hashingENS6_20_Default_ranged_hashENS6_20_Prime_rehash_policyENS6_17_Hashtable_traitsILb0ELb0ELb1EEEE", !6, i64 0, !10, i64 8, !16, i64 16, !10, i64 24, !17, i64 32, !6, i64 48}
!16 = !{!"_ZTSNSt8__detail15_Hash_node_baseE", !6, i64 0}
!17 = !{!"_ZTSNSt8__detail20_Prime_rehash_policyE", !18, i64 0, !10, i64 8}
!18 = !{!"float", !7, i64 0}
!19 = !{!"_ZTSN8libspirv15MutableBytecodeE", !20, i64 0, !21, i64 24}
!20 = !{!"_ZTSN8libspirv8BytecodeE", !6, i64 0, !10, i64 8, !13, i64 16}
!21 = !{!"_ZTSSt6vectorIN8libspirv8Bytecode6OpCodeESaIS2_EE", !22, i64 0}
!22 = !{!"_ZTSSt12_Vector_baseIN8libspirv8Bytecode6OpCodeESaIS2_EE", !23, i64 0}
!23 = !{!"_ZTSNSt12_Vector_baseIN8libspirv8Bytecode6OpCodeESaIS2_EE12_Vector_implE", !24, i64 0}
!24 = !{!"_ZTSNSt12_Vector_baseIN8libspirv8Bytecode6OpCodeESaIS2_EE17_Vector_impl_dataE", !6, i64 0, !6, i64 8, !6, i64 16}
!25 = !{!"_ZTSSt13unordered_mapIjN14ShaderAnalyzer3RegESt4hashIjESt8equal_toIjESaISt4pairIKjS1_EEE", !26, i64 0}
!26 = !{!"_ZTSSt10_HashtableIjSt4pairIKjN14ShaderAnalyzer3RegEESaIS4_ENSt8__detail10_Select1stESt8equal_toIjESt4hashIjENS6_18_Mod_range_hashingENS6_20_Default_ranged_hashENS6_20_Prime_rehash_policyENS6_17_Hashtable_traitsILb0ELb0ELb1EEEE", !6, i64 0, !10, i64 8, !16, i64 16, !10, i64 24, !17, i64 32, !6, i64 48}
!27 = !{!"_ZTSSt13unordered_mapIjN14ShaderAnalyzer4TypeESt4hashIjESt8equal_toIjESaISt4pairIKjS1_EEE", !28, i64 0}
!28 = !{!"_ZTSSt10_HashtableIjSt4pairIKjN14ShaderAnalyzer4TypeEESaIS4_ENSt8__detail10_Select1stESt8equal_toIjESt4hashIjENS6_18_Mod_range_hashingENS6_20_Default_ranged_hashENS6_20_Prime_rehash_policyENS6_17_Hashtable_traitsILb0ELb0ELb1EEEE", !6, i64 0, !10, i64 8, !16, i64 16, !10, i64 24, !17, i64 32, !6, i64 48}
!29 = !{!"_ZTSSt13unordered_mapIjN14ShaderAnalyzer3VarESt4hashIjESt8equal_toIjESaISt4pairIKjS1_EEE", !30, i64 0}
!30 = !{!"_ZTSSt10_HashtableIjSt4pairIKjN14ShaderAnalyzer3VarEESaIS4_ENSt8__detail10_Select1stESt8equal_toIjESt4hashIjENS6_18_Mod_range_hashingENS6_20_Default_ranged_hashENS6_20_Prime_rehash_policyENS6_17_Hashtable_traitsILb0ELb0ELb1EEEE", !6, i64 0, !10, i64 8, !16, i64 16, !10, i64 24, !17, i64 32, !6, i64 48}
!31 = !{!"_ZTSSt13unordered_mapIjN14ShaderAnalyzer8FunctionESt4hashIjESt8equal_toIjESaISt4pairIKjS1_EEE", !32, i64 0}
!32 = !{!"_ZTSSt10_HashtableIjSt4pairIKjN14ShaderAnalyzer8FunctionEESaIS4_ENSt8__detail10_Select1stESt8equal_toIjESt4hashIjENS6_18_Mod_range_hashingENS6_20_Default_ranged_hashENS6_20_Prime_rehash_policyENS6_17_Hashtable_traitsILb0ELb0ELb1EEEE", !6, i64 0, !10, i64 8, !16, i64 16, !10, i64 24, !17, i64 32, !6, i64 48}
!33 = !{!"_ZTSSt13unordered_mapIjN14ShaderAnalyzer3CFGESt4hashIjESt8equal_toIjESaISt4pairIKjS1_EEE", !34, i64 0}
!34 = !{!"_ZTSSt10_HashtableIjSt4pairIKjN14ShaderAnalyzer3CFGEESaIS4_ENSt8__detail10_Select1stESt8equal_toIjESt4hashIjENS6_18_Mod_range_hashingENS6_20_Default_ranged_hashENS6_20_Prime_rehash_policyENS6_17_Hashtable_traitsILb0ELb0ELb1EEEE", !6, i64 0, !10, i64 8, !16, i64 16, !10, i64 24, !17, i64 32, !6, i64 48}
!35 = !{!13, !13, i64 0}
!36 = distinct !{!36, !37}
!37 = !{!"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: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable
define dso_local noundef zeroext i1 @_ZNK14ShaderAnalyzer13canGenerateVsEv(ptr nocapture noundef nonnull readonly align 8 dereferenceable(6596) %0) local_unnamed_addr #0 align 2 {
._crit_edge:
  ret i1 false
}

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


; Effective O3 passes: ADCEPass,BDCEPass,CorrelatedValuePropagationPass,EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LICMPass,LoopRotatePass,LoopSimplifyPass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass