; LLVM IR from khushmmehta/Scorch-V :: src/ScorchVkEngine/Abstractions (ValidationLayers)

; 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.std::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<const char *, std::allocator<const char *>>::_Vector_impl" }
%"struct.std::_Vector_base<const char *, std::allocator<const char *>>::_Vector_impl" = type { %"struct.std::_Vector_base<const char *, std::allocator<const char *>>::_Vector_impl_data" }
%"struct.std::_Vector_base<const char *, std::allocator<const char *>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%class.ValidationLayers = type { %"class.std::vector", i8, ptr, %struct.VkDebugUtilsMessengerCreateInfoEXT, %"class.std::vector" }
%struct.VkDebugUtilsMessengerCreateInfoEXT = type { i32, ptr, i32, i32, i32, ptr, ptr }
%struct.VkInstanceCreateInfo = type { i32, ptr, i32, ptr, i32, ptr, i32, ptr }

; 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
define dso_local void @_ZN16ValidationLayers23passDebugDataToInstanceER20VkInstanceCreateInfo(ptr noundef nonnull align 8 dereferenceable(112) %0, ptr noundef nonnull align 8 dereferenceable(64) %1) #1 align 2 {
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  %5 = alloca %"class.std::vector", align 8
  store ptr %0, ptr %3, align 8, !tbaa !5
  store ptr %1, ptr %4, align 8, !tbaa !5
  %6 = load ptr, ptr %3, align 8
  call void @llvm.lifetime.start.p0(i64 24, ptr %5) #3
  call void @_ZN16ValidationLayers21getRequiredExtensionsEv(ptr dead_on_unwind writable sret(%"class.std::vector") align 8 %5, ptr noundef nonnull align 8 dereferenceable(112) %6)
  %7 = getelementptr inbounds %class.ValidationLayers, ptr %6, i32 0, i32 4
  %8 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNSt6vectorIPKcSaIS1_EEaSEOS3_(ptr noundef nonnull align 8 dereferenceable(24) %7, ptr noundef nonnull align 8 dereferenceable(24) %5) #3
  call void @_ZNSt6vectorIPKcSaIS1_EED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %5) #3
  call void @llvm.lifetime.end.p0(i64 24, ptr %5) #3
  %9 = getelementptr inbounds %class.ValidationLayers, ptr %6, i32 0, i32 4
  %10 = call noundef i64 @_ZNKSt6vectorIPKcSaIS1_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %9) #3
  %11 = trunc i64 %10 to i32
  %12 = load ptr, ptr %4, align 8, !tbaa !5
  %13 = getelementptr inbounds %struct.VkInstanceCreateInfo, ptr %12, i32 0, i32 6
  store i32 %11, ptr %13, align 8, !tbaa !9
  %14 = getelementptr inbounds %class.ValidationLayers, ptr %6, i32 0, i32 4
  %15 = call noundef ptr @_ZNSt6vectorIPKcSaIS1_EE4dataEv(ptr noundef nonnull align 8 dereferenceable(24) %14) #3
  %16 = load ptr, ptr %4, align 8, !tbaa !5
  %17 = getelementptr inbounds %struct.VkInstanceCreateInfo, ptr %16, i32 0, i32 7
  store ptr %15, ptr %17, align 8, !tbaa !13
  %18 = getelementptr inbounds %class.ValidationLayers, ptr %6, i32 0, i32 1
  %19 = load i8, ptr %18, align 8, !tbaa !14, !range !22, !noundef !23
  %20 = trunc i8 %19 to i1
  br i1 %20, label %21, label %35

21:                                               ; preds = %2
  %22 = getelementptr inbounds %class.ValidationLayers, ptr %6, i32 0, i32 0
  %23 = call noundef i64 @_ZNKSt6vectorIPKcSaIS1_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %22) #3
  %24 = trunc i64 %23 to i32
  %25 = load ptr, ptr %4, align 8, !tbaa !5
  %26 = getelementptr inbounds %struct.VkInstanceCreateInfo, ptr %25, i32 0, i32 4
  store i32 %24, ptr %26, align 8, !tbaa !24
  %27 = getelementptr inbounds %class.ValidationLayers, ptr %6, i32 0, i32 0
  %28 = call noundef ptr @_ZNKSt6vectorIPKcSaIS1_EE4dataEv(ptr noundef nonnull align 8 dereferenceable(24) %27) #3
  %29 = load ptr, ptr %4, align 8, !tbaa !5
  %30 = getelementptr inbounds %struct.VkInstanceCreateInfo, ptr %29, i32 0, i32 5
  store ptr %28, ptr %30, align 8, !tbaa !25
  %31 = getelementptr inbounds %class.ValidationLayers, ptr %6, i32 0, i32 3
  call void @_ZN16ValidationLayers32populateDebugMessengerCreateInfoER34VkDebugUtilsMessengerCreateInfoEXT(ptr noundef nonnull align 8 dereferenceable(48) %31)
  %32 = getelementptr inbounds %class.ValidationLayers, ptr %6, i32 0, i32 3
  %33 = load ptr, ptr %4, align 8, !tbaa !5
  %34 = getelementptr inbounds %struct.VkInstanceCreateInfo, ptr %33, i32 0, i32 1
  store ptr %32, ptr %34, align 8, !tbaa !26
  br label %40

35:                                               ; preds = %2
  %36 = load ptr, ptr %4, align 8, !tbaa !5
  %37 = getelementptr inbounds %struct.VkInstanceCreateInfo, ptr %36, i32 0, i32 4
  store i32 0, ptr %37, align 8, !tbaa !24
  %38 = load ptr, ptr %4, align 8, !tbaa !5
  %39 = getelementptr inbounds %struct.VkInstanceCreateInfo, ptr %38, i32 0, i32 1
  store ptr null, ptr %39, align 8, !tbaa !26
  br label %40

40:                                               ; preds = %35, %21
  ret void
}

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN16ValidationLayers21getRequiredExtensionsEv(ptr dead_on_unwind noalias writable sret(%"class.std::vector") align 8, ptr noundef nonnull align 8 dereferenceable(112)) #1 align 2

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt6vectorIPKcSaIS1_EED2Ev(ptr noundef nonnull align 8 dereferenceable(24)) unnamed_addr #2 align 2

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

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN16ValidationLayers32populateDebugMessengerCreateInfoER34VkDebugUtilsMessengerCreateInfoEXT(ptr noundef nonnull align 8 dereferenceable(48)) #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, !12, i64 48}
!10 = !{!"_ZTS20VkInstanceCreateInfo", !11, i64 0, !6, i64 8, !12, i64 16, !6, i64 24, !12, i64 32, !6, i64 40, !12, i64 48, !6, i64 56}
!11 = !{!"_ZTS15VkStructureType", !7, i64 0}
!12 = !{!"int", !7, i64 0}
!13 = !{!10, !6, i64 56}
!14 = !{!15, !20, i64 24}
!15 = !{!"_ZTS16ValidationLayers", !16, i64 0, !20, i64 24, !6, i64 32, !21, i64 40, !16, i64 88}
!16 = !{!"_ZTSSt6vectorIPKcSaIS1_EE", !17, i64 0}
!17 = !{!"_ZTSSt12_Vector_baseIPKcSaIS1_EE", !18, i64 0}
!18 = !{!"_ZTSNSt12_Vector_baseIPKcSaIS1_EE12_Vector_implE", !19, i64 0}
!19 = !{!"_ZTSNSt12_Vector_baseIPKcSaIS1_EE17_Vector_impl_dataE", !6, i64 0, !6, i64 8, !6, i64 16}
!20 = !{!"bool", !7, i64 0}
!21 = !{!"_ZTS34VkDebugUtilsMessengerCreateInfoEXT", !11, i64 0, !6, i64 8, !12, i64 16, !12, i64 20, !12, i64 24, !6, i64 32, !6, i64 40}
!22 = !{i8 0, i8 2}
!23 = !{}
!24 = !{!10, !12, i64 32}
!25 = !{!10, !6, i64 40}
!26 = !{!10, !6, i64 8}


; 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.std::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<const char *, std::allocator<const char *>>::_Vector_impl" }
%"struct.std::_Vector_base<const char *, std::allocator<const char *>>::_Vector_impl" = type { %"struct.std::_Vector_base<const char *, std::allocator<const char *>>::_Vector_impl_data" }
%"struct.std::_Vector_base<const char *, std::allocator<const char *>>::_Vector_impl_data" = type { ptr, ptr, ptr }

; 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 uwtable
define dso_local void @_ZN16ValidationLayers23passDebugDataToInstanceER20VkInstanceCreateInfo(ptr noundef nonnull align 8 dereferenceable(112) %0, ptr nocapture noundef nonnull writeonly align 8 dereferenceable(64) %1) local_unnamed_addr #1 align 2 {
  %3 = alloca %"class.std::vector", align 8
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %3) #3
  call void @_ZN16ValidationLayers21getRequiredExtensionsEv(ptr dead_on_unwind nonnull writable sret(%"class.std::vector") align 8 %3, ptr noundef nonnull align 8 dereferenceable(112) %0)
  %4 = getelementptr inbounds i8, ptr %0, i64 88
  %5 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNSt6vectorIPKcSaIS1_EEaSEOS3_(ptr noundef nonnull align 8 dereferenceable(24) %4, ptr noundef nonnull align 8 dereferenceable(24) %3) #3
  call void @_ZNSt6vectorIPKcSaIS1_EED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %3) #3
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %3) #3
  %6 = call noundef i64 @_ZNKSt6vectorIPKcSaIS1_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %4) #3
  %7 = trunc i64 %6 to i32
  %8 = getelementptr inbounds i8, ptr %1, i64 48
  store i32 %7, ptr %8, align 8, !tbaa !5
  %9 = call noundef ptr @_ZNSt6vectorIPKcSaIS1_EE4dataEv(ptr noundef nonnull align 8 dereferenceable(24) %4) #3
  %10 = getelementptr inbounds i8, ptr %1, i64 56
  store ptr %9, ptr %10, align 8, !tbaa !12
  %11 = getelementptr inbounds i8, ptr %0, i64 24
  %12 = load i8, ptr %11, align 8, !tbaa !13, !range !21, !noundef !22
  %13 = trunc nuw i8 %12 to i1
  br i1 %13, label %14, label %21

14:                                               ; preds = %2
  %15 = call noundef i64 @_ZNKSt6vectorIPKcSaIS1_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %0) #3
  %16 = trunc i64 %15 to i32
  %17 = getelementptr inbounds i8, ptr %1, i64 32
  store i32 %16, ptr %17, align 8, !tbaa !23
  %18 = call noundef ptr @_ZNKSt6vectorIPKcSaIS1_EE4dataEv(ptr noundef nonnull align 8 dereferenceable(24) %0) #3
  %19 = getelementptr inbounds i8, ptr %1, i64 40
  store ptr %18, ptr %19, align 8, !tbaa !24
  %20 = getelementptr inbounds i8, ptr %0, i64 40
  call void @_ZN16ValidationLayers32populateDebugMessengerCreateInfoER34VkDebugUtilsMessengerCreateInfoEXT(ptr noundef nonnull align 8 dereferenceable(48) %20)
  br label %23

21:                                               ; preds = %2
  %22 = getelementptr inbounds i8, ptr %1, i64 32
  store i32 0, ptr %22, align 8, !tbaa !23
  br label %23

23:                                               ; preds = %21, %14
  %.sink = phi ptr [ %20, %14 ], [ null, %21 ]
  %24 = getelementptr inbounds i8, ptr %1, i64 8
  store ptr %.sink, ptr %24, align 8
  ret void
}

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN16ValidationLayers21getRequiredExtensionsEv(ptr dead_on_unwind noalias writable sret(%"class.std::vector") align 8, ptr noundef nonnull align 8 dereferenceable(112)) local_unnamed_addr #1 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(24) ptr @_ZNSt6vectorIPKcSaIS1_EEaSEOS3_(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 8 dereferenceable(24)) local_unnamed_addr #2 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt6vectorIPKcSaIS1_EED2Ev(ptr noundef nonnull align 8 dereferenceable(24)) unnamed_addr #2 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i64 @_ZNKSt6vectorIPKcSaIS1_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24)) local_unnamed_addr #2 align 2

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN16ValidationLayers32populateDebugMessengerCreateInfoER34VkDebugUtilsMessengerCreateInfoEXT(ptr noundef nonnull align 8 dereferenceable(48)) local_unnamed_addr #2 align 2

attributes #0 = { mustprogress 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, !11, i64 48}
!6 = !{!"_ZTS20VkInstanceCreateInfo", !7, i64 0, !10, i64 8, !11, i64 16, !10, i64 24, !11, i64 32, !10, i64 40, !11, i64 48, !10, i64 56}
!7 = !{!"_ZTS15VkStructureType", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!"any pointer", !8, i64 0}
!11 = !{!"int", !8, i64 0}
!12 = !{!6, !10, i64 56}
!13 = !{!14, !19, i64 24}
!14 = !{!"_ZTS16ValidationLayers", !15, i64 0, !19, i64 24, !10, i64 32, !20, i64 40, !15, i64 88}
!15 = !{!"_ZTSSt6vectorIPKcSaIS1_EE", !16, i64 0}
!16 = !{!"_ZTSSt12_Vector_baseIPKcSaIS1_EE", !17, i64 0}
!17 = !{!"_ZTSNSt12_Vector_baseIPKcSaIS1_EE12_Vector_implE", !18, i64 0}
!18 = !{!"_ZTSNSt12_Vector_baseIPKcSaIS1_EE17_Vector_impl_dataE", !10, i64 0, !10, i64 8, !10, i64 16}
!19 = !{!"bool", !8, i64 0}
!20 = !{!"_ZTS34VkDebugUtilsMessengerCreateInfoEXT", !7, i64 0, !10, i64 8, !11, i64 16, !11, i64 20, !11, i64 24, !10, i64 32, !10, i64 40}
!21 = !{i8 0, i8 2}
!22 = !{}
!23 = !{!6, !11, i64 32}
!24 = !{!6, !10, i64 40}


; Effective O3 passes: EarlyCSEPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,MergedLoadStoreMotionPass,PostOrderFunctionAttrsPass,SROAPass