; 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::SPIRBlock" = type { %"struct.spirv_cross::IVariant.base", i32, i32, i32, %"class.spirv_cross::TypedID.283", %"class.spirv_cross::TypedID.283", %"class.spirv_cross::TypedID.283", %"class.spirv_cross::TypedID.280", %"class.spirv_cross::TypedID.280", %"class.spirv_cross::TypedID.283", %"class.spirv_cross::TypedID.283", %"class.spirv_cross::TypedID.283", %struct.anon, %"class.spirv_cross::SmallVector.369", %"class.spirv_cross::SmallVector.372", %"class.spirv_cross::SmallVector.375", %"class.spirv_cross::SmallVector.375", %"class.spirv_cross::SmallVector.378", %"class.spirv_cross::SmallVector.378", i8, i8, i8, %"class.spirv_cross::TypedID.283", %"class.spirv_cross::TypedID.283", %"class.spirv_cross::SmallVector.293", %"class.spirv_cross::SmallVector.293", %"class.spirv_cross::SmallVector.7" }
%"struct.spirv_cross::IVariant.base" = type <{ ptr, %"class.spirv_cross::TypedID.280" }>
%"class.spirv_cross::TypedID.280" = type { i32 }
%struct.anon = type { [3 x %"class.spirv_cross::TypedID.280"], %"class.spirv_cross::TypedID.280" }
%"class.spirv_cross::SmallVector.369" = type { %"class.spirv_cross::VectorView.370", i64, %"class.spirv_cross::AlignedBuffer.371" }
%"class.spirv_cross::VectorView.370" = type { ptr, i64 }
%"class.spirv_cross::AlignedBuffer.371" = type { [96 x i8] }
%"class.spirv_cross::SmallVector.372" = type { %"class.spirv_cross::VectorView.373", i64, %"class.spirv_cross::AlignedBuffer.374" }
%"class.spirv_cross::VectorView.373" = type { ptr, i64 }
%"class.spirv_cross::AlignedBuffer.374" = type { [96 x i8] }
%"class.spirv_cross::SmallVector.375" = type { %"class.spirv_cross::VectorView.376", i64, %"class.spirv_cross::AlignedBuffer.377" }
%"class.spirv_cross::VectorView.376" = type { ptr, i64 }
%"class.spirv_cross::AlignedBuffer.377" = type { [64 x i8] }
%"class.spirv_cross::SmallVector.378" = type { %"class.spirv_cross::VectorView.379", i64, %"class.spirv_cross::AlignedBuffer.380" }
%"class.spirv_cross::VectorView.379" = type { ptr, i64 }
%"class.spirv_cross::AlignedBuffer.380" = type { [128 x i8] }
%"class.spirv_cross::TypedID.283" = type { i32 }
%"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::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] }
%"class.spirv_cross::TypedID.282" = 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: mustprogress nounwind uwtable
declare dso_local noundef i32 @_ZNK11spirv_cross7TypedIDILNS_5TypesE2EEcvjEv(ptr noundef nonnull align 4 dereferenceable(4)) #1 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN11spirv_cross12CompilerGLSL26flush_variable_declarationEj(ptr noundef nonnull align 8 dereferenceable(9848), i32 noundef) #2 align 2

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

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

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN11spirv_cross12CompilerGLSL26flush_undeclared_variablesERNS_9SPIRBlockE(ptr noundef nonnull align 8 dereferenceable(9848) %0, ptr noundef nonnull align 8 dereferenceable(976) %1) #2 align 2 {
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  store ptr %0, ptr %3, align 8, !tbaa !5
  store ptr %1, ptr %4, align 8, !tbaa !5
  %9 = load ptr, ptr %3, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #3
  %10 = load ptr, ptr %4, align 8, !tbaa !5
  %11 = getelementptr inbounds %"struct.spirv_cross::SPIRBlock", ptr %10, i32 0, i32 24
  store ptr %11, ptr %5, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #3
  %12 = load ptr, ptr %5, align 8, !tbaa !5
  %13 = call noundef ptr @_ZN11spirv_cross10VectorViewINS_7TypedIDILNS_5TypesE2EEEE5beginEv(ptr noundef nonnull align 8 dereferenceable(16) %12) #3
  store ptr %13, ptr %6, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #3
  %14 = load ptr, ptr %5, align 8, !tbaa !5
  %15 = call noundef ptr @_ZN11spirv_cross10VectorViewINS_7TypedIDILNS_5TypesE2EEEE3endEv(ptr noundef nonnull align 8 dereferenceable(16) %14) #3
  store ptr %15, ptr %7, align 8, !tbaa !5
  br label %16

16:                                               ; preds = %25, %2
  %17 = load ptr, ptr %6, align 8, !tbaa !5
  %18 = load ptr, ptr %7, align 8, !tbaa !5
  %19 = icmp ne ptr %17, %18
  br i1 %19, label %21, label %20

20:                                               ; preds = %16
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #3
  br label %28

21:                                               ; preds = %16
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #3
  %22 = load ptr, ptr %6, align 8, !tbaa !5
  store ptr %22, ptr %8, align 8, !tbaa !5
  %23 = load ptr, ptr %8, align 8, !tbaa !5
  %24 = call noundef i32 @_ZNK11spirv_cross7TypedIDILNS_5TypesE2EEcvjEv(ptr noundef nonnull align 4 dereferenceable(4) %23)
  call void @_ZN11spirv_cross12CompilerGLSL26flush_variable_declarationEj(ptr noundef nonnull align 8 dereferenceable(9848) %9, i32 noundef %24)
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #3
  br label %25

25:                                               ; preds = %21
  %26 = load ptr, ptr %6, align 8, !tbaa !5
  %27 = getelementptr inbounds %"class.spirv_cross::TypedID.282", ptr %26, i32 1
  store ptr %27, ptr %6, align 8, !tbaa !5
  br label %16

28:                                               ; preds = %20
  ret void
}

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 = { 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 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}


; 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 nounwind uwtable
declare dso_local noundef i32 @_ZNK11spirv_cross7TypedIDILNS_5TypesE2EEcvjEv(ptr noundef nonnull align 4 dereferenceable(4)) local_unnamed_addr #0 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN11spirv_cross12CompilerGLSL26flush_variable_declarationEj(ptr noundef nonnull align 8 dereferenceable(9848), i32 noundef) local_unnamed_addr #1 align 2

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

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

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN11spirv_cross12CompilerGLSL26flush_undeclared_variablesERNS_9SPIRBlockE(ptr noundef nonnull align 8 dereferenceable(9848) %0, ptr noundef nonnull align 8 dereferenceable(976) %1) local_unnamed_addr #1 align 2 {
  %3 = getelementptr inbounds i8, ptr %1, i64 808
  %4 = tail call noundef ptr @_ZN11spirv_cross10VectorViewINS_7TypedIDILNS_5TypesE2EEEE5beginEv(ptr noundef nonnull align 8 dereferenceable(16) %3) #2
  %5 = tail call noundef ptr @_ZN11spirv_cross10VectorViewINS_7TypedIDILNS_5TypesE2EEEE3endEv(ptr noundef nonnull align 8 dereferenceable(16) %3) #2
  %.not9 = icmp eq ptr %4, %5
  br i1 %.not9, label %._crit_edge, label %.lr.ph

._crit_edge:                                      ; preds = %.lr.ph, %2
  ret void

.lr.ph:                                           ; preds = %2, %.lr.ph
  %.010 = phi ptr [ %7, %.lr.ph ], [ %4, %2 ]
  %6 = tail call noundef i32 @_ZNK11spirv_cross7TypedIDILNS_5TypesE2EEcvjEv(ptr noundef nonnull align 4 dereferenceable(4) %.010)
  tail call void @_ZN11spirv_cross12CompilerGLSL26flush_variable_declarationEj(ptr noundef nonnull align 8 dereferenceable(9848) %0, i32 noundef %6)
  %7 = getelementptr inbounds i8, ptr %.010, i64 4
  %.not = icmp eq ptr %7, %5
  br i1 %.not, label %._crit_edge, label %.lr.ph
}

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" }
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 = { 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)"}


; Effective O3 passes: GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,SROAPass,SimplifyCFGPass,TailCallElimPass