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

; 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::Compiler::CombinedImageSamplerUsageHandler" = type <{ %"struct.spirv_cross::Compiler::OpcodeHandler", ptr, ptr, %"class.std::unordered_map.301", %"class.std::unordered_set", i8, i8, [6 x i8] }>
%"struct.spirv_cross::Compiler::OpcodeHandler" = type { ptr }
%"class.std::unordered_map.301" = type { %"class.std::_Hashtable.302" }
%"class.std::_Hashtable.302" = 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.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.spirv_cross::SPIRFunction" = type <{ %"struct.spirv_cross::IVariant.base", %"class.spirv_cross::TypedID.163", %"class.spirv_cross::TypedID.163", [4 x i8], %"class.spirv_cross::SmallVector.223", %"class.spirv_cross::SmallVector.223", %"class.spirv_cross::SmallVector.220", %"class.spirv_cross::TypedID.165", [4 x i8], %"class.spirv_cross::SmallVector.226", %"class.spirv_cross::SmallVector.229", %"struct.spirv_cross::SPIRFunction::EntryLine", %"class.spirv_cross::SmallVector.232", %"class.spirv_cross::SmallVector.232", %"class.spirv_cross::SmallVector.7", i8, i8, i8, [5 x i8] }>
%"struct.spirv_cross::IVariant.base" = type <{ ptr, %"class.spirv_cross::TypedID.162" }>
%"class.spirv_cross::TypedID.162" = type { i32 }
%"class.spirv_cross::TypedID.163" = type { i32 }
%"class.spirv_cross::SmallVector.223" = type { %"class.spirv_cross::VectorView.224", i64, %"class.spirv_cross::AlignedBuffer.225" }
%"class.spirv_cross::VectorView.224" = type { ptr, i64 }
%"class.spirv_cross::AlignedBuffer.225" = type { [160 x i8] }
%"class.spirv_cross::SmallVector.220" = type { %"class.spirv_cross::VectorView.221", i64, %"class.spirv_cross::AlignedBuffer.222" }
%"class.spirv_cross::VectorView.221" = type { ptr, i64 }
%"class.spirv_cross::AlignedBuffer.222" = type { [32 x i8] }
%"class.spirv_cross::TypedID.165" = type { i32 }
%"class.spirv_cross::SmallVector.226" = type { %"class.spirv_cross::VectorView.227", i64, %"class.spirv_cross::AlignedBuffer.228" }
%"class.spirv_cross::VectorView.227" = type { ptr, i64 }
%"class.spirv_cross::AlignedBuffer.228" = type { [32 x i8] }
%"class.spirv_cross::SmallVector.229" = type { %"class.spirv_cross::VectorView.230", i64, %"class.spirv_cross::AlignedBuffer.231" }
%"class.spirv_cross::VectorView.230" = type { ptr, i64 }
%"class.spirv_cross::AlignedBuffer.231" = type { [128 x i8] }
%"struct.spirv_cross::SPIRFunction::EntryLine" = type { i32, i32 }
%"class.spirv_cross::SmallVector.232" = type <{ %"class.spirv_cross::VectorView.233", i64, [8 x i8] }>
%"class.spirv_cross::VectorView.233" = type { ptr, i64 }
%"class.spirv_cross::SmallVector.7" = type { %"class.spirv_cross::VectorView.8", i64, %"class.spirv_cross::AlignedBuffer.9" }
%"class.spirv_cross::VectorView.8" = type { ptr, i64 }
%"class.spirv_cross::AlignedBuffer.9" = type { [32 x i8] }
%"struct.spirv_cross::SPIRFunction::Parameter" = type <{ %"class.spirv_cross::TypedID.163", %"class.spirv_cross::TypedID.162", i32, i32, i8, [3 x i8] }>

; 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 uwtable
declare dso_local noundef nonnull align 8 dereferenceable(795) ptr @_ZN11spirv_cross8Compiler3getINS_12SPIRFunctionEEERT_j(ptr noundef nonnull align 8 dereferenceable(3176), 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
declare dso_local void @_ZN11spirv_cross8Compiler32CombinedImageSamplerUsageHandler14add_dependencyEjj(ptr noundef nonnull align 8 dereferenceable(138), i32 noundef, i32 noundef) #1 align 2

; Function Attrs: mustprogress uwtable
define dso_local noundef zeroext i1 @_ZN11spirv_cross8Compiler32CombinedImageSamplerUsageHandler20begin_function_scopeEPKjj(ptr noundef nonnull align 8 dereferenceable(138) %0, ptr noundef %1, i32 noundef %2) unnamed_addr #1 align 2 {
  %4 = alloca i1, align 1
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca i32, align 4
  %8 = alloca ptr, align 8
  %9 = alloca ptr, align 8
  %10 = alloca i32, align 4
  %11 = alloca ptr, align 8
  store ptr %0, ptr %5, align 8, !tbaa !5
  store ptr %1, ptr %6, align 8, !tbaa !5
  store i32 %2, ptr %7, align 4, !tbaa !9
  %12 = load ptr, ptr %5, align 8
  %13 = load i32, ptr %7, align 4, !tbaa !9
  %14 = icmp ult i32 %13, 3
  br i1 %14, label %15, label %16

15:                                               ; preds = %3
  store i1 false, ptr %4, align 1
  br label %50

16:                                               ; preds = %3
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #3
  %17 = getelementptr inbounds %"struct.spirv_cross::Compiler::CombinedImageSamplerUsageHandler", ptr %12, i32 0, i32 1
  %18 = load ptr, ptr %17, align 8, !tbaa !11
  %19 = load ptr, ptr %6, align 8, !tbaa !5
  %20 = getelementptr inbounds i32, ptr %19, i64 2
  %21 = load i32, ptr %20, align 4, !tbaa !9
  %22 = call noundef nonnull align 8 dereferenceable(795) ptr @_ZN11spirv_cross8Compiler3getINS_12SPIRFunctionEEERT_j(ptr noundef nonnull align 8 dereferenceable(3176) %18, i32 noundef %21)
  store ptr %22, ptr %8, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #3
  %23 = load ptr, ptr %6, align 8, !tbaa !5
  %24 = getelementptr inbounds i32, ptr %23, i64 3
  store ptr %24, ptr %9, align 8, !tbaa !5
  %25 = load i32, ptr %7, align 4, !tbaa !9
  %26 = sub i32 %25, 3
  store i32 %26, ptr %7, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #3
  store i32 0, ptr %10, align 4, !tbaa !9
  br label %27

27:                                               ; preds = %46, %16
  %28 = load i32, ptr %10, align 4, !tbaa !9
  %29 = load i32, ptr %7, align 4, !tbaa !9
  %30 = icmp ult i32 %28, %29
  br i1 %30, label %32, label %31

31:                                               ; preds = %27
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #3
  br label %49

32:                                               ; preds = %27
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #3
  %33 = load ptr, ptr %8, align 8, !tbaa !5
  %34 = getelementptr inbounds %"struct.spirv_cross::SPIRFunction", ptr %33, i32 0, i32 4
  %35 = load i32, ptr %10, align 4, !tbaa !9
  %36 = zext i32 %35 to i64
  %37 = call noundef nonnull align 4 dereferenceable(17) ptr @_ZN11spirv_cross10VectorViewINS_12SPIRFunction9ParameterEEixEm(ptr noundef nonnull align 8 dereferenceable(16) %34, i64 noundef %36) #3
  store ptr %37, ptr %11, align 8, !tbaa !5
  %38 = load ptr, ptr %11, align 8, !tbaa !5
  %39 = getelementptr inbounds %"struct.spirv_cross::SPIRFunction::Parameter", ptr %38, i32 0, i32 1
  %40 = call noundef i32 @_ZNK11spirv_cross7TypedIDILNS_5TypesE0EEcvjEv(ptr noundef nonnull align 4 dereferenceable(4) %39)
  %41 = load ptr, ptr %9, align 8, !tbaa !5
  %42 = load i32, ptr %10, align 4, !tbaa !9
  %43 = zext i32 %42 to i64
  %44 = getelementptr inbounds i32, ptr %41, i64 %43
  %45 = load i32, ptr %44, align 4, !tbaa !9
  call void @_ZN11spirv_cross8Compiler32CombinedImageSamplerUsageHandler14add_dependencyEjj(ptr noundef nonnull align 8 dereferenceable(138) %12, i32 noundef %40, i32 noundef %45)
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #3
  br label %46

46:                                               ; preds = %32
  %47 = load i32, ptr %10, align 4, !tbaa !9
  %48 = add i32 %47, 1
  store i32 %48, ptr %10, align 4, !tbaa !9
  br label %27, !llvm.loop !23

49:                                               ; preds = %31
  store i1 true, ptr %4, align 1
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #3
  br label %50

50:                                               ; preds = %49, %15
  %51 = load i1, ptr %4, align 1
  ret i1 %51
}

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 4 dereferenceable(17) ptr @_ZN11spirv_cross10VectorViewINS_12SPIRFunction9ParameterEEixEm(ptr noundef nonnull align 8 dereferenceable(16), i64 noundef) #2 align 2

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 = { 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, !6, i64 8}
!12 = !{!"_ZTSN11spirv_cross8Compiler32CombinedImageSamplerUsageHandlerE", !13, i64 0, !6, i64 8, !6, i64 16, !14, i64 24, !20, i64 80, !22, i64 136, !22, i64 137}
!13 = !{!"_ZTSN11spirv_cross8Compiler13OpcodeHandlerE"}
!14 = !{!"_ZTSSt13unordered_mapIjSt13unordered_setIjSt4hashIjESt8equal_toIjESaIjEES2_S4_SaISt4pairIKjS6_EEE", !15, i64 0}
!15 = !{!"_ZTSSt10_HashtableIjSt4pairIKjSt13unordered_setIjSt4hashIjESt8equal_toIjESaIjEEESaIS9_ENSt8__detail10_Select1stES6_S4_NSB_18_Mod_range_hashingENSB_20_Default_ranged_hashENSB_20_Prime_rehash_policyENSB_17_Hashtable_traitsILb0ELb0ELb1EEEE", !6, i64 0, !16, i64 8, !17, i64 16, !16, i64 24, !18, i64 32, !6, i64 48}
!16 = !{!"long", !7, i64 0}
!17 = !{!"_ZTSNSt8__detail15_Hash_node_baseE", !6, i64 0}
!18 = !{!"_ZTSNSt8__detail20_Prime_rehash_policyE", !19, i64 0, !16, i64 8}
!19 = !{!"float", !7, i64 0}
!20 = !{!"_ZTSSt13unordered_setIjSt4hashIjESt8equal_toIjESaIjEE", !21, i64 0}
!21 = !{!"_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, !17, i64 16, !16, i64 24, !18, i64 32, !6, i64 48}
!22 = !{!"bool", !7, i64 0}
!23 = distinct !{!23, !24}
!24 = !{!"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 uwtable
declare dso_local noundef nonnull align 8 dereferenceable(795) ptr @_ZN11spirv_cross8Compiler3getINS_12SPIRFunctionEEERT_j(ptr noundef nonnull align 8 dereferenceable(3176), 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
declare dso_local void @_ZN11spirv_cross8Compiler32CombinedImageSamplerUsageHandler14add_dependencyEjj(ptr noundef nonnull align 8 dereferenceable(138), i32 noundef, i32 noundef) local_unnamed_addr #0 align 2

; Function Attrs: mustprogress uwtable
define dso_local noundef zeroext i1 @_ZN11spirv_cross8Compiler32CombinedImageSamplerUsageHandler20begin_function_scopeEPKjj(ptr noundef nonnull align 8 dereferenceable(138) %0, ptr nocapture noundef readonly %1, i32 noundef %2) unnamed_addr #0 align 2 {
  %4 = icmp ugt i32 %2, 2
  br i1 %4, label %5, label %.loopexit

5:                                                ; preds = %3
  %6 = getelementptr inbounds i8, ptr %0, i64 8
  %7 = load ptr, ptr %6, align 8, !tbaa !5
  %8 = getelementptr inbounds i8, ptr %1, i64 8
  %9 = load i32, ptr %8, align 4, !tbaa !20
  %10 = tail call noundef nonnull align 8 dereferenceable(795) ptr @_ZN11spirv_cross8Compiler3getINS_12SPIRFunctionEEERT_j(ptr noundef nonnull align 8 dereferenceable(3176) %7, i32 noundef %9)
  %11 = getelementptr inbounds i8, ptr %1, i64 12
  %12 = add i32 %2, -3
  %.not = icmp eq i32 %12, 0
  br i1 %.not, label %.loopexit, label %.lr.ph

.lr.ph:                                           ; preds = %5
  %13 = getelementptr inbounds i8, ptr %10, i64 24
  %wide.trip.count = zext i32 %12 to i64
  br label %14

14:                                               ; preds = %.lr.ph, %14
  %indvars.iv = phi i64 [ 0, %.lr.ph ], [ %indvars.iv.next, %14 ]
  %15 = tail call noundef nonnull align 4 dereferenceable(17) ptr @_ZN11spirv_cross10VectorViewINS_12SPIRFunction9ParameterEEixEm(ptr noundef nonnull align 8 dereferenceable(16) %13, i64 noundef %indvars.iv) #2
  %16 = getelementptr inbounds i8, ptr %15, i64 4
  %17 = tail call noundef i32 @_ZNK11spirv_cross7TypedIDILNS_5TypesE0EEcvjEv(ptr noundef nonnull align 4 dereferenceable(4) %16)
  %18 = getelementptr inbounds i32, ptr %11, i64 %indvars.iv
  %19 = load i32, ptr %18, align 4, !tbaa !20
  tail call void @_ZN11spirv_cross8Compiler32CombinedImageSamplerUsageHandler14add_dependencyEjj(ptr noundef nonnull align 8 dereferenceable(138) %0, i32 noundef %17, i32 noundef %19)
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
  br i1 %exitcond.not, label %.loopexit, label %14, !llvm.loop !22

.loopexit:                                        ; preds = %14, %5, %3
  ret i1 %4
}

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 4 dereferenceable(17) ptr @_ZN11spirv_cross10VectorViewINS_12SPIRFunction9ParameterEEixEm(ptr noundef nonnull align 8 dereferenceable(16), i64 noundef) local_unnamed_addr #1 align 2

attributes #0 = { 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 = { 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, !8, i64 8}
!6 = !{!"_ZTSN11spirv_cross8Compiler32CombinedImageSamplerUsageHandlerE", !7, i64 0, !8, i64 8, !8, i64 16, !11, i64 24, !17, i64 80, !19, i64 136, !19, i64 137}
!7 = !{!"_ZTSN11spirv_cross8Compiler13OpcodeHandlerE"}
!8 = !{!"any pointer", !9, i64 0}
!9 = !{!"omnipotent char", !10, i64 0}
!10 = !{!"Simple C++ TBAA"}
!11 = !{!"_ZTSSt13unordered_mapIjSt13unordered_setIjSt4hashIjESt8equal_toIjESaIjEES2_S4_SaISt4pairIKjS6_EEE", !12, i64 0}
!12 = !{!"_ZTSSt10_HashtableIjSt4pairIKjSt13unordered_setIjSt4hashIjESt8equal_toIjESaIjEEESaIS9_ENSt8__detail10_Select1stES6_S4_NSB_18_Mod_range_hashingENSB_20_Default_ranged_hashENSB_20_Prime_rehash_policyENSB_17_Hashtable_traitsILb0ELb0ELb1EEEE", !8, i64 0, !13, i64 8, !14, i64 16, !13, i64 24, !15, i64 32, !8, i64 48}
!13 = !{!"long", !9, i64 0}
!14 = !{!"_ZTSNSt8__detail15_Hash_node_baseE", !8, i64 0}
!15 = !{!"_ZTSNSt8__detail20_Prime_rehash_policyE", !16, i64 0, !13, i64 8}
!16 = !{!"float", !9, i64 0}
!17 = !{!"_ZTSSt13unordered_setIjSt4hashIjESt8equal_toIjESaIjEE", !18, i64 0}
!18 = !{!"_ZTSSt10_HashtableIjjSaIjENSt8__detail9_IdentityESt8equal_toIjESt4hashIjENS1_18_Mod_range_hashingENS1_20_Default_ranged_hashENS1_20_Prime_rehash_policyENS1_17_Hashtable_traitsILb0ELb1ELb1EEEE", !8, i64 0, !13, i64 8, !14, i64 16, !13, i64 24, !15, i64 32, !8, i64 48}
!19 = !{!"bool", !9, i64 0}
!20 = !{!21, !21, i64 0}
!21 = !{!"int", !9, i64 0}
!22 = distinct !{!22, !23}
!23 = !{!"llvm.loop.mustprogress"}


; Effective O3 passes: EarlyCSEPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LICMPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass,TailCallElimPass