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

%"class.spirv_cross::TypedID.165" = type { i32 }
%"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::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] }

; 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: nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef ptr @_ZNK11spirv_cross10VectorViewINS_7TypedIDILNS_5TypesE6EEEE5beginEv(ptr noundef nonnull align 8 dereferenceable(16)) #2 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef ptr @_ZNK11spirv_cross10VectorViewINS_7TypedIDILNS_5TypesE6EEEE3endEv(ptr noundef nonnull align 8 dereferenceable(16)) #2 align 2

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

; Function Attrs: mustprogress uwtable
define dso_local noundef zeroext i1 @_ZNK11spirv_cross8Compiler30traverse_all_reachable_opcodesERKNS_12SPIRFunctionERNS0_13OpcodeHandlerE(ptr noundef nonnull align 8 dereferenceable(3176) %0, ptr noundef nonnull align 8 dereferenceable(795) %1, ptr noundef nonnull align 8 dereferenceable(8) %2) #3 align 2 {
  %4 = alloca i1, align 1
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  %9 = alloca ptr, align 8
  %10 = alloca ptr, align 8
  %11 = alloca i32, align 4
  %12 = alloca %"class.spirv_cross::TypedID.165", align 4
  store ptr %0, ptr %5, align 8, !tbaa !5
  store ptr %1, ptr %6, align 8, !tbaa !5
  store ptr %2, ptr %7, align 8, !tbaa !5
  %13 = load ptr, ptr %5, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #4
  %14 = load ptr, ptr %6, align 8, !tbaa !5
  %15 = getelementptr inbounds %"struct.spirv_cross::SPIRFunction", ptr %14, i32 0, i32 9
  store ptr %15, ptr %8, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #4
  %16 = load ptr, ptr %8, align 8, !tbaa !5
  %17 = call noundef ptr @_ZNK11spirv_cross10VectorViewINS_7TypedIDILNS_5TypesE6EEEE5beginEv(ptr noundef nonnull align 8 dereferenceable(16) %16) #4
  store ptr %17, ptr %9, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #4
  %18 = load ptr, ptr %8, align 8, !tbaa !5
  %19 = call noundef ptr @_ZNK11spirv_cross10VectorViewINS_7TypedIDILNS_5TypesE6EEEE3endEv(ptr noundef nonnull align 8 dereferenceable(16) %18) #4
  store ptr %19, ptr %10, align 8, !tbaa !5
  br label %20

20:                                               ; preds = %36, %3
  %21 = load ptr, ptr %9, align 8, !tbaa !5
  %22 = load ptr, ptr %10, align 8, !tbaa !5
  %23 = icmp ne ptr %21, %22
  br i1 %23, label %25, label %24

24:                                               ; preds = %20
  store i32 2, ptr %11, align 4
  br label %39

25:                                               ; preds = %20
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #4
  %26 = load ptr, ptr %9, align 8, !tbaa !5
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %12, ptr align 4 %26, i64 4, i1 false), !tbaa.struct !9
  %27 = call noundef i32 @_ZNK11spirv_cross7TypedIDILNS_5TypesE6EEcvjEv(ptr noundef nonnull align 4 dereferenceable(4) %12)
  %28 = call noundef nonnull align 8 dereferenceable(976) ptr @_ZNK11spirv_cross8Compiler3getINS_9SPIRBlockEEERKT_j(ptr noundef nonnull align 8 dereferenceable(3176) %13, i32 noundef %27)
  %29 = load ptr, ptr %7, align 8, !tbaa !5
  %30 = call noundef zeroext i1 @_ZNK11spirv_cross8Compiler30traverse_all_reachable_opcodesERKNS_9SPIRBlockERNS0_13OpcodeHandlerE(ptr noundef nonnull align 8 dereferenceable(3176) %13, ptr noundef nonnull align 8 dereferenceable(976) %28, ptr noundef nonnull align 8 dereferenceable(8) %29)
  br i1 %30, label %32, label %31

31:                                               ; preds = %25
  store i1 false, ptr %4, align 1
  store i32 1, ptr %11, align 4
  br label %33

32:                                               ; preds = %25
  store i32 0, ptr %11, align 4
  br label %33

33:                                               ; preds = %32, %31
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #4
  %34 = load i32, ptr %11, align 4
  switch i32 %34, label %39 [
    i32 0, label %35
  ]

35:                                               ; preds = %33
  br label %36

36:                                               ; preds = %35
  %37 = load ptr, ptr %9, align 8, !tbaa !5
  %38 = getelementptr inbounds %"class.spirv_cross::TypedID.165", ptr %37, i32 1
  store ptr %38, ptr %9, align 8, !tbaa !5
  br label %20

39:                                               ; preds = %33, %24
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #4
  %40 = load i32, ptr %11, align 4
  switch i32 %40, label %44 [
    i32 2, label %41
    i32 1, label %42
  ]

41:                                               ; preds = %39
  store i1 true, ptr %4, align 1
  br label %42

42:                                               ; preds = %41, %39
  %43 = load i1, ptr %4, align 1
  ret i1 %43

44:                                               ; preds = %39
  unreachable
}

; Function Attrs: mustprogress uwtable
declare dso_local noundef nonnull align 8 dereferenceable(976) ptr @_ZNK11spirv_cross8Compiler3getINS_9SPIRBlockEEERKT_j(ptr noundef nonnull align 8 dereferenceable(3176), i32 noundef) #3 align 2

; Function Attrs: mustprogress uwtable
declare dso_local noundef zeroext i1 @_ZNK11spirv_cross8Compiler30traverse_all_reachable_opcodesERKNS_9SPIRBlockERNS0_13OpcodeHandlerE(ptr noundef nonnull align 8 dereferenceable(3176), ptr noundef nonnull align 8 dereferenceable(976), ptr noundef nonnull align 8 dereferenceable(8)) #3 align 2

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
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 = { 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 = !{i64 0, i64 4, !10}
!10 = !{!11, !11, i64 0}
!11 = !{!"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"

%"class.spirv_cross::TypedID.165" = type { i32 }

; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #0

; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #0

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef ptr @_ZNK11spirv_cross10VectorViewINS_7TypedIDILNS_5TypesE6EEEE5beginEv(ptr noundef nonnull align 8 dereferenceable(16)) local_unnamed_addr #1 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef ptr @_ZNK11spirv_cross10VectorViewINS_7TypedIDILNS_5TypesE6EEEE3endEv(ptr noundef nonnull align 8 dereferenceable(16)) local_unnamed_addr #1 align 2

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

; Function Attrs: mustprogress uwtable
define dso_local noundef zeroext i1 @_ZNK11spirv_cross8Compiler30traverse_all_reachable_opcodesERKNS_12SPIRFunctionERNS0_13OpcodeHandlerE(ptr noundef nonnull align 8 dereferenceable(3176) %0, ptr noundef nonnull align 8 dereferenceable(795) %1, ptr noundef nonnull align 8 dereferenceable(8) %2) local_unnamed_addr #2 align 2 {
  %4 = alloca %"class.spirv_cross::TypedID.165", align 4
  %5 = getelementptr inbounds i8, ptr %1, i64 456
  %6 = tail call noundef ptr @_ZNK11spirv_cross10VectorViewINS_7TypedIDILNS_5TypesE6EEEE5beginEv(ptr noundef nonnull align 8 dereferenceable(16) %5) #3
  %7 = tail call noundef ptr @_ZNK11spirv_cross10VectorViewINS_7TypedIDILNS_5TypesE6EEEE3endEv(ptr noundef nonnull align 8 dereferenceable(16) %5) #3
  %.not14 = icmp eq ptr %6, %7
  br i1 %.not14, label %._crit_edge, label %.lr.ph

.lr.ph:                                           ; preds = %3, %.lr.ph
  %.01315 = phi ptr [ %12, %.lr.ph ], [ %6, %3 ]
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %4) #3
  %8 = load i32, ptr %.01315, align 4, !tbaa !5
  store i32 %8, ptr %4, align 4, !tbaa !5
  %9 = call noundef i32 @_ZNK11spirv_cross7TypedIDILNS_5TypesE6EEcvjEv(ptr noundef nonnull align 4 dereferenceable(4) %4)
  %10 = call noundef nonnull align 8 dereferenceable(976) ptr @_ZNK11spirv_cross8Compiler3getINS_9SPIRBlockEEERKT_j(ptr noundef nonnull align 8 dereferenceable(3176) %0, i32 noundef %9)
  %11 = call noundef zeroext i1 @_ZNK11spirv_cross8Compiler30traverse_all_reachable_opcodesERKNS_9SPIRBlockERNS0_13OpcodeHandlerE(ptr noundef nonnull align 8 dereferenceable(3176) %0, ptr noundef nonnull align 8 dereferenceable(976) %10, ptr noundef nonnull align 8 dereferenceable(8) %2)
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %4) #3
  %12 = getelementptr inbounds i8, ptr %.01315, i64 4
  %.not = icmp ne ptr %12, %7
  %or.cond.not = select i1 %11, i1 %.not, i1 false
  br i1 %or.cond.not, label %.lr.ph, label %._crit_edge

._crit_edge:                                      ; preds = %.lr.ph, %3
  %.not.lcssa = phi i1 [ true, %3 ], [ %11, %.lr.ph ]
  ret i1 %.not.lcssa
}

; Function Attrs: mustprogress uwtable
declare dso_local noundef nonnull align 8 dereferenceable(976) ptr @_ZNK11spirv_cross8Compiler3getINS_9SPIRBlockEEERKT_j(ptr noundef nonnull align 8 dereferenceable(3176), i32 noundef) local_unnamed_addr #2 align 2

; Function Attrs: mustprogress uwtable
declare dso_local noundef zeroext i1 @_ZNK11spirv_cross8Compiler30traverse_all_reachable_opcodesERKNS_9SPIRBlockERNS0_13OpcodeHandlerE(ptr noundef nonnull align 8 dereferenceable(3176), ptr noundef nonnull align 8 dereferenceable(976), ptr noundef nonnull align 8 dereferenceable(8)) local_unnamed_addr #2 align 2

attributes #0 = { mustprogress 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 = { 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 = { 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 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,SROAPass,SimplifyCFGPass,TailCallElimPass