; LLVM IR from Try/Tempest :: Engine/thirdparty/spirv_cross (spirv_glsl)

; 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.spirv_cross::SPIREntryPoint" = type <{ %"class.spirv_cross::TypedID", [4 x i8], %"class.std::__cxx11::basic_string", %"class.std::__cxx11::basic_string", %"class.spirv_cross::SmallVector.293", %"class.spirv_cross::Bitset", %"struct.spirv_cross::SPIREntryPoint::WorkgroupSize", i32, i32, i32, i32, i8, [3 x i8] }>
%"class.spirv_cross::TypedID" = type { i32 }
%"class.std::__cxx11::basic_string" = type { %"struct.std::__cxx11::basic_string<char>::_Alloc_hider", i64, %union.anon }
%"struct.std::__cxx11::basic_string<char>::_Alloc_hider" = type { ptr }
%union.anon = type { i64, [8 x i8] }
%"class.spirv_cross::SmallVector.293" = type { %"class.spirv_cross::VectorView.294", i64, %"class.spirv_cross::AlignedBuffer.295" }
%"class.spirv_cross::VectorView.294" = type { ptr, i64 }
%"class.spirv_cross::AlignedBuffer.295" = type { [32 x i8] }
%"class.spirv_cross::Bitset" = type { i64, %"class.std::unordered_set" }
%"class.std::unordered_set" = type { %"class.std::_Hashtable.74" }
%"class.std::_Hashtable.74" = 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 }
%"struct.spirv_cross::SPIREntryPoint::WorkgroupSize" = type { i32, i32, i32, i32, i32, i32, i32 }
%"struct.spirv_cross::IVariant" = type <{ ptr, %"class.spirv_cross::TypedID.280", [4 x i8] }>
%"class.spirv_cross::TypedID.280" = type { i32 }

; 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: inlinehint mustprogress uwtable
declare dso_local noundef zeroext i1 @_ZNK11spirv_cross6Bitset3getEj(ptr noundef nonnull align 8 dereferenceable(64), i32 noundef) #1 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i32 @_ZNK11spirv_cross7TypedIDILNS_5TypesE0EEcvjEv(ptr noundef nonnull align 4 dereferenceable(4)) #2 align 2

; Function Attrs: mustprogress uwtable
define dso_local noundef i32 @_ZNK11spirv_cross12CompilerGLSL43get_constant_mapping_to_workgroup_componentERKNS_12SPIRConstantE(ptr noundef nonnull align 8 dereferenceable(9848) %0, ptr noundef nonnull align 8 dereferenceable(360) %1) #3 align 2 {
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca i32, align 4
  store ptr %0, ptr %3, align 8, !tbaa !5
  store ptr %1, ptr %4, align 8, !tbaa !5
  %7 = load ptr, ptr %3, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #5
  %8 = call noundef nonnull align 8 dereferenceable(237) ptr @_ZNK11spirv_cross8Compiler15get_entry_pointEv(ptr noundef nonnull align 8 dereferenceable(3176) %7)
  store ptr %8, ptr %5, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #5
  store i32 -1, ptr %6, align 4, !tbaa !9
  %9 = load ptr, ptr %5, align 8, !tbaa !5
  %10 = getelementptr inbounds %"struct.spirv_cross::SPIREntryPoint", ptr %9, i32 0, i32 6
  %11 = getelementptr inbounds %"struct.spirv_cross::SPIREntryPoint::WorkgroupSize", ptr %10, i32 0, i32 6
  %12 = load i32, ptr %11, align 8, !tbaa !11
  %13 = icmp eq i32 %12, 0
  br i1 %13, label %14, label %51

14:                                               ; preds = %2
  %15 = load ptr, ptr %5, align 8, !tbaa !5
  %16 = getelementptr inbounds %"struct.spirv_cross::SPIREntryPoint", ptr %15, i32 0, i32 5
  %17 = call noundef zeroext i1 @_ZNK11spirv_cross6Bitset3getEj(ptr noundef nonnull align 8 dereferenceable(64) %16, i32 noundef 38)
  br i1 %17, label %18, label %51

18:                                               ; preds = %14
  %19 = load ptr, ptr %4, align 8, !tbaa !5
  %20 = getelementptr inbounds %"struct.spirv_cross::IVariant", ptr %19, i32 0, i32 1
  %21 = call noundef i32 @_ZNK11spirv_cross7TypedIDILNS_5TypesE0EEcvjEv(ptr noundef nonnull align 4 dereferenceable(4) %20)
  %22 = load ptr, ptr %5, align 8, !tbaa !5
  %23 = getelementptr inbounds %"struct.spirv_cross::SPIREntryPoint", ptr %22, i32 0, i32 6
  %24 = getelementptr inbounds %"struct.spirv_cross::SPIREntryPoint::WorkgroupSize", ptr %23, i32 0, i32 3
  %25 = load i32, ptr %24, align 4, !tbaa !29
  %26 = icmp eq i32 %21, %25
  br i1 %26, label %27, label %28

27:                                               ; preds = %18
  store i32 0, ptr %6, align 4, !tbaa !9
  br label %50

28:                                               ; preds = %18
  %29 = load ptr, ptr %4, align 8, !tbaa !5
  %30 = getelementptr inbounds %"struct.spirv_cross::IVariant", ptr %29, i32 0, i32 1
  %31 = call noundef i32 @_ZNK11spirv_cross7TypedIDILNS_5TypesE0EEcvjEv(ptr noundef nonnull align 4 dereferenceable(4) %30)
  %32 = load ptr, ptr %5, align 8, !tbaa !5
  %33 = getelementptr inbounds %"struct.spirv_cross::SPIREntryPoint", ptr %32, i32 0, i32 6
  %34 = getelementptr inbounds %"struct.spirv_cross::SPIREntryPoint::WorkgroupSize", ptr %33, i32 0, i32 4
  %35 = load i32, ptr %34, align 8, !tbaa !30
  %36 = icmp eq i32 %31, %35
  br i1 %36, label %37, label %38

37:                                               ; preds = %28
  store i32 1, ptr %6, align 4, !tbaa !9
  br label %49

38:                                               ; preds = %28
  %39 = load ptr, ptr %4, align 8, !tbaa !5
  %40 = getelementptr inbounds %"struct.spirv_cross::IVariant", ptr %39, i32 0, i32 1
  %41 = call noundef i32 @_ZNK11spirv_cross7TypedIDILNS_5TypesE0EEcvjEv(ptr noundef nonnull align 4 dereferenceable(4) %40)
  %42 = load ptr, ptr %5, align 8, !tbaa !5
  %43 = getelementptr inbounds %"struct.spirv_cross::SPIREntryPoint", ptr %42, i32 0, i32 6
  %44 = getelementptr inbounds %"struct.spirv_cross::SPIREntryPoint::WorkgroupSize", ptr %43, i32 0, i32 5
  %45 = load i32, ptr %44, align 4, !tbaa !31
  %46 = icmp eq i32 %41, %45
  br i1 %46, label %47, label %48

47:                                               ; preds = %38
  store i32 2, ptr %6, align 4, !tbaa !9
  br label %48

48:                                               ; preds = %47, %38
  br label %49

49:                                               ; preds = %48, %37
  br label %50

50:                                               ; preds = %49, %27
  br label %51

51:                                               ; preds = %50, %14, %2
  %52 = load i32, ptr %6, align 4, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #5
  ret i32 %52
}

declare noundef nonnull align 8 dereferenceable(237) ptr @_ZNK11spirv_cross8Compiler15get_entry_pointEv(ptr noundef nonnull align 8 dereferenceable(3176)) #4

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #2 = { 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 #3 = { 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 = { "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 #5 = { 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 = !{!"int", !7, i64 0}
!11 = !{!12, !10, i64 216}
!12 = !{!"_ZTSN11spirv_cross14SPIREntryPointE", !13, i64 0, !14, i64 8, !14, i64 40, !17, i64 72, !20, i64 128, !26, i64 192, !10, i64 220, !10, i64 224, !10, i64 228, !27, i64 232, !28, i64 236}
!13 = !{!"_ZTSN11spirv_cross7TypedIDILNS_5TypesE4EEE", !10, i64 0}
!14 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE", !15, i64 0, !16, i64 8, !7, i64 16}
!15 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_Alloc_hiderE", !6, i64 0}
!16 = !{!"long", !7, i64 0}
!17 = !{!"_ZTSN11spirv_cross11SmallVectorINS_7TypedIDILNS_5TypesE2EEELm8EEE", !18, i64 0, !16, i64 16, !19, i64 24}
!18 = !{!"_ZTSN11spirv_cross10VectorViewINS_7TypedIDILNS_5TypesE2EEEEE", !6, i64 0, !16, i64 8}
!19 = !{!"_ZTSN11spirv_cross13AlignedBufferINS_7TypedIDILNS_5TypesE2EEELm8EEE", !7, i64 0}
!20 = !{!"_ZTSN11spirv_cross6BitsetE", !16, i64 0, !21, i64 8}
!21 = !{!"_ZTSSt13unordered_setIjSt4hashIjESt8equal_toIjESaIjEE", !22, i64 0}
!22 = !{!"_ZTSSt10_HashtableIjjSaIjENSt8__detail9_IdentityESt8equal_toIjESt4hashIjENS1_18_Mod_range_hashingENS1_20_Default_ranged_hashENS1_20_Prime_rehash_policyENS1_17_Hashtable_traitsILb0ELb1ELb1EEEE", !6, i64 0, !16, i64 8, !23, i64 16, !16, i64 24, !24, i64 32, !6, i64 48}
!23 = !{!"_ZTSNSt8__detail15_Hash_node_baseE", !6, i64 0}
!24 = !{!"_ZTSNSt8__detail20_Prime_rehash_policyE", !25, i64 0, !16, i64 8}
!25 = !{!"float", !7, i64 0}
!26 = !{!"_ZTSN11spirv_cross14SPIREntryPoint13WorkgroupSizeE", !10, i64 0, !10, i64 4, !10, i64 8, !10, i64 12, !10, i64 16, !10, i64 20, !10, i64 24}
!27 = !{!"_ZTSN3spv14ExecutionModelE", !7, i64 0}
!28 = !{!"bool", !7, i64 0}
!29 = !{!12, !10, i64 204}
!30 = !{!12, !10, i64 208}
!31 = !{!12, !10, i64 212}


; 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: inlinehint mustprogress uwtable
declare dso_local noundef zeroext i1 @_ZNK11spirv_cross6Bitset3getEj(ptr noundef nonnull align 8 dereferenceable(64), i32 noundef) local_unnamed_addr #0 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i32 @_ZNK11spirv_cross7TypedIDILNS_5TypesE0EEcvjEv(ptr noundef nonnull align 4 dereferenceable(4)) local_unnamed_addr #1 align 2

; Function Attrs: mustprogress uwtable
define dso_local noundef range(i32 -1, 3) i32 @_ZNK11spirv_cross12CompilerGLSL43get_constant_mapping_to_workgroup_componentERKNS_12SPIRConstantE(ptr noundef nonnull align 8 dereferenceable(9848) %0, ptr noundef nonnull align 8 dereferenceable(360) %1) local_unnamed_addr #2 align 2 {
  %3 = tail call noundef nonnull align 8 dereferenceable(237) ptr @_ZNK11spirv_cross8Compiler15get_entry_pointEv(ptr noundef nonnull align 8 dereferenceable(3176) %0)
  %4 = getelementptr inbounds i8, ptr %3, i64 216
  %5 = load i32, ptr %4, align 8, !tbaa !5
  %6 = icmp eq i32 %5, 0
  br i1 %6, label %7, label %26

7:                                                ; preds = %2
  %8 = getelementptr inbounds i8, ptr %3, i64 128
  %9 = tail call noundef zeroext i1 @_ZNK11spirv_cross6Bitset3getEj(ptr noundef nonnull align 8 dereferenceable(64) %8, i32 noundef 38)
  br i1 %9, label %10, label %26

10:                                               ; preds = %7
  %11 = getelementptr inbounds i8, ptr %1, i64 8
  %12 = tail call noundef i32 @_ZNK11spirv_cross7TypedIDILNS_5TypesE0EEcvjEv(ptr noundef nonnull align 4 dereferenceable(4) %11)
  %13 = getelementptr inbounds i8, ptr %3, i64 204
  %14 = load i32, ptr %13, align 4, !tbaa !27
  %15 = icmp eq i32 %12, %14
  br i1 %15, label %26, label %16

16:                                               ; preds = %10
  %17 = tail call noundef i32 @_ZNK11spirv_cross7TypedIDILNS_5TypesE0EEcvjEv(ptr noundef nonnull align 4 dereferenceable(4) %11)
  %18 = getelementptr inbounds i8, ptr %3, i64 208
  %19 = load i32, ptr %18, align 8, !tbaa !28
  %20 = icmp eq i32 %17, %19
  br i1 %20, label %26, label %21

21:                                               ; preds = %16
  %22 = tail call noundef i32 @_ZNK11spirv_cross7TypedIDILNS_5TypesE0EEcvjEv(ptr noundef nonnull align 4 dereferenceable(4) %11)
  %23 = getelementptr inbounds i8, ptr %3, i64 212
  %24 = load i32, ptr %23, align 4, !tbaa !29
  %25 = icmp eq i32 %22, %24
  %spec.select = select i1 %25, i32 2, i32 -1
  br label %26

26:                                               ; preds = %21, %16, %10, %7, %2
  %.0 = phi i32 [ -1, %7 ], [ -1, %2 ], [ 0, %10 ], [ 1, %16 ], [ %spec.select, %21 ]
  ret i32 %.0
}

declare noundef nonnull align 8 dereferenceable(237) ptr @_ZNK11spirv_cross8Compiler15get_entry_pointEv(ptr noundef nonnull align 8 dereferenceable(3176)) local_unnamed_addr #3

attributes #0 = { 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 #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 = { 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 = { "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, !8, i64 216}
!6 = !{!"_ZTSN11spirv_cross14SPIREntryPointE", !7, i64 0, !11, i64 8, !11, i64 40, !15, i64 72, !18, i64 128, !24, i64 192, !8, i64 220, !8, i64 224, !8, i64 228, !25, i64 232, !26, i64 236}
!7 = !{!"_ZTSN11spirv_cross7TypedIDILNS_5TypesE4EEE", !8, i64 0}
!8 = !{!"int", !9, i64 0}
!9 = !{!"omnipotent char", !10, i64 0}
!10 = !{!"Simple C++ TBAA"}
!11 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE", !12, i64 0, !14, i64 8, !9, i64 16}
!12 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_Alloc_hiderE", !13, i64 0}
!13 = !{!"any pointer", !9, i64 0}
!14 = !{!"long", !9, i64 0}
!15 = !{!"_ZTSN11spirv_cross11SmallVectorINS_7TypedIDILNS_5TypesE2EEELm8EEE", !16, i64 0, !14, i64 16, !17, i64 24}
!16 = !{!"_ZTSN11spirv_cross10VectorViewINS_7TypedIDILNS_5TypesE2EEEEE", !13, i64 0, !14, i64 8}
!17 = !{!"_ZTSN11spirv_cross13AlignedBufferINS_7TypedIDILNS_5TypesE2EEELm8EEE", !9, i64 0}
!18 = !{!"_ZTSN11spirv_cross6BitsetE", !14, i64 0, !19, i64 8}
!19 = !{!"_ZTSSt13unordered_setIjSt4hashIjESt8equal_toIjESaIjEE", !20, i64 0}
!20 = !{!"_ZTSSt10_HashtableIjjSaIjENSt8__detail9_IdentityESt8equal_toIjESt4hashIjENS1_18_Mod_range_hashingENS1_20_Default_ranged_hashENS1_20_Prime_rehash_policyENS1_17_Hashtable_traitsILb0ELb1ELb1EEEE", !13, i64 0, !14, i64 8, !21, i64 16, !14, i64 24, !22, i64 32, !13, i64 48}
!21 = !{!"_ZTSNSt8__detail15_Hash_node_baseE", !13, i64 0}
!22 = !{!"_ZTSNSt8__detail20_Prime_rehash_policyE", !23, i64 0, !14, i64 8}
!23 = !{!"float", !9, i64 0}
!24 = !{!"_ZTSN11spirv_cross14SPIREntryPoint13WorkgroupSizeE", !8, i64 0, !8, i64 4, !8, i64 8, !8, i64 12, !8, i64 16, !8, i64 20, !8, i64 24}
!25 = !{!"_ZTSN3spv14ExecutionModelE", !9, i64 0}
!26 = !{!"bool", !9, i64 0}
!27 = !{!6, !8, i64 204}
!28 = !{!6, !8, i64 208}
!29 = !{!6, !8, i64 212}


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