; 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::SPIRBlock" = type { %"struct.spirv_cross::IVariant.base", i32, i32, i32, %"class.spirv_cross::TypedID.165", %"class.spirv_cross::TypedID.165", %"class.spirv_cross::TypedID.165", %"class.spirv_cross::TypedID.162", %"class.spirv_cross::TypedID.162", %"class.spirv_cross::TypedID.165", %"class.spirv_cross::TypedID.165", %"class.spirv_cross::TypedID.165", %struct.anon, %"class.spirv_cross::SmallVector.208", %"class.spirv_cross::SmallVector.211", %"class.spirv_cross::SmallVector.214", %"class.spirv_cross::SmallVector.214", %"class.spirv_cross::SmallVector.217", %"class.spirv_cross::SmallVector.217", i8, i8, i8, %"class.spirv_cross::TypedID.165", %"class.spirv_cross::TypedID.165", %"class.spirv_cross::SmallVector.220", %"class.spirv_cross::SmallVector.220", %"class.spirv_cross::SmallVector.7" }
%"struct.spirv_cross::IVariant.base" = type <{ ptr, %"class.spirv_cross::TypedID.162" }>
%"class.spirv_cross::TypedID.162" = type { i32 }
%struct.anon = type { [3 x %"class.spirv_cross::TypedID.162"], %"class.spirv_cross::TypedID.162" }
%"class.spirv_cross::SmallVector.208" = type { %"class.spirv_cross::VectorView.209", i64, %"class.spirv_cross::AlignedBuffer.210" }
%"class.spirv_cross::VectorView.209" = type { ptr, i64 }
%"class.spirv_cross::AlignedBuffer.210" = type { [96 x i8] }
%"class.spirv_cross::SmallVector.211" = type { %"class.spirv_cross::VectorView.212", i64, %"class.spirv_cross::AlignedBuffer.213" }
%"class.spirv_cross::VectorView.212" = type { ptr, i64 }
%"class.spirv_cross::AlignedBuffer.213" = type { [96 x i8] }
%"class.spirv_cross::SmallVector.214" = type { %"class.spirv_cross::VectorView.215", i64, %"class.spirv_cross::AlignedBuffer.216" }
%"class.spirv_cross::VectorView.215" = type { ptr, i64 }
%"class.spirv_cross::AlignedBuffer.216" = type { [64 x i8] }
%"class.spirv_cross::SmallVector.217" = type { %"class.spirv_cross::VectorView.218", i64, %"class.spirv_cross::AlignedBuffer.219" }
%"class.spirv_cross::VectorView.218" = type { ptr, i64 }
%"class.spirv_cross::AlignedBuffer.219" = type { [128 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.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::SPIRBlock::Phi" = type { %"class.spirv_cross::TypedID.162", %"class.spirv_cross::TypedID.165", %"class.spirv_cross::TypedID.164" }
%"class.spirv_cross::TypedID.164" = 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_5TypesE6EEcvjEv(ptr noundef nonnull align 4 dereferenceable(4)) #1 align 2

; 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) #2 align 2

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

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

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

25:                                               ; preds = %42, %3
  %26 = load ptr, ptr %10, align 8, !tbaa !5
  %27 = load ptr, ptr %11, align 8, !tbaa !5
  %28 = icmp ne ptr %26, %27
  br i1 %28, label %30, label %29

29:                                               ; preds = %25
  store i32 2, ptr %12, align 4
  br label %45

30:                                               ; preds = %25
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #3
  %31 = load ptr, ptr %10, align 8, !tbaa !5
  store ptr %31, ptr %13, align 8, !tbaa !5
  %32 = load ptr, ptr %13, align 8, !tbaa !5
  %33 = getelementptr inbounds %"struct.spirv_cross::SPIRBlock::Phi", ptr %32, i32 0, i32 1
  %34 = call noundef i32 @_ZNK11spirv_cross7TypedIDILNS_5TypesE6EEcvjEv(ptr noundef nonnull align 4 dereferenceable(4) %33)
  %35 = call noundef i32 @_ZNK11spirv_cross7TypedIDILNS_5TypesE6EEcvjEv(ptr noundef nonnull align 4 dereferenceable(4) %5)
  %36 = icmp eq i32 %34, %35
  br i1 %36, label %37, label %38

37:                                               ; preds = %30
  store i1 true, ptr %4, align 1
  store i32 1, ptr %12, align 4
  br label %39

38:                                               ; preds = %30
  store i32 0, ptr %12, align 4
  br label %39

39:                                               ; preds = %38, %37
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #3
  %40 = load i32, ptr %12, align 4
  switch i32 %40, label %45 [
    i32 0, label %41
  ]

41:                                               ; preds = %39
  br label %42

42:                                               ; preds = %41
  %43 = load ptr, ptr %10, align 8, !tbaa !5
  %44 = getelementptr inbounds %"struct.spirv_cross::SPIRBlock::Phi", ptr %43, i32 1
  store ptr %44, ptr %10, align 8, !tbaa !5
  br label %25

45:                                               ; preds = %39, %29
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #3
  %46 = load i32, ptr %12, align 4
  switch i32 %46, label %48 [
    i32 2, label %47
  ]

47:                                               ; preds = %45
  store i1 false, ptr %4, align 1
  store i32 1, ptr %12, align 4
  br label %48

48:                                               ; preds = %47, %45
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #3
  %49 = load i1, ptr %4, align 1
  ret i1 %49
}

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"

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

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

; 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 #1 align 2

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

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

; Function Attrs: mustprogress uwtable
define dso_local noundef zeroext i1 @_ZNK11spirv_cross8Compiler18flush_phi_requiredENS_7TypedIDILNS_5TypesE6EEES3_(ptr noundef nonnull align 8 dereferenceable(3176) %0, i32 %1, i32 %2) local_unnamed_addr #1 align 2 {
  %4 = alloca %"class.spirv_cross::TypedID.165", align 4
  %5 = alloca %"class.spirv_cross::TypedID.165", align 4
  store i32 %1, ptr %4, align 4
  store i32 %2, ptr %5, align 4
  %6 = call noundef i32 @_ZNK11spirv_cross7TypedIDILNS_5TypesE6EEcvjEv(ptr noundef nonnull align 4 dereferenceable(4) %5)
  %7 = call noundef nonnull align 8 dereferenceable(976) ptr @_ZNK11spirv_cross8Compiler3getINS_9SPIRBlockEEERKT_j(ptr noundef nonnull align 8 dereferenceable(3176) %0, i32 noundef %6)
  %8 = getelementptr inbounds i8, ptr %7, i64 192
  %9 = call noundef ptr @_ZNK11spirv_cross10VectorViewINS_9SPIRBlock3PhiEE5beginEv(ptr noundef nonnull align 8 dereferenceable(16) %8) #2
  %10 = call noundef ptr @_ZNK11spirv_cross10VectorViewINS_9SPIRBlock3PhiEE3endEv(ptr noundef nonnull align 8 dereferenceable(16) %8) #2
  %.not16.not = icmp eq ptr %9, %10
  br i1 %.not16.not, label %.critedge, label %.lr.ph

.lr.ph:                                           ; preds = %3, %.lr.ph
  %.01417 = phi ptr [ %14, %.lr.ph ], [ %9, %3 ]
  %11 = getelementptr inbounds i8, ptr %.01417, i64 4
  %12 = call noundef i32 @_ZNK11spirv_cross7TypedIDILNS_5TypesE6EEcvjEv(ptr noundef nonnull align 4 dereferenceable(4) %11)
  %13 = call noundef i32 @_ZNK11spirv_cross7TypedIDILNS_5TypesE6EEcvjEv(ptr noundef nonnull align 4 dereferenceable(4) %4)
  %.not15 = icmp eq i32 %12, %13
  %14 = getelementptr inbounds i8, ptr %.01417, i64 12
  %.not.not = icmp eq ptr %14, %10
  %or.cond = select i1 %.not15, i1 true, i1 %.not.not
  br i1 %or.cond, label %.critedge, label %.lr.ph

.critedge:                                        ; preds = %.lr.ph, %3
  %.not.lcssa = phi i1 [ false, %3 ], [ %.not15, %.lr.ph ]
  ret i1 %.not.lcssa
}

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: CorrelatedValuePropagationPass,EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,SROAPass,SimplifyCFGPass