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

; 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.SwapChainSupportDetails = type { %struct.VkSurfaceCapabilitiesKHR, %"class.std::vector.15", %"class.std::vector.20" }
%struct.VkSurfaceCapabilitiesKHR = type { i32, i32, %struct.VkExtent2D, %struct.VkExtent2D, %struct.VkExtent2D, i32, i32, i32, i32, i32 }
%struct.VkExtent2D = type { i32, i32 }
%"class.std::vector.15" = type { %"struct.std::_Vector_base.16" }
%"struct.std::_Vector_base.16" = type { %"struct.std::_Vector_base<VkSurfaceFormatKHR, std::allocator<VkSurfaceFormatKHR>>::_Vector_impl" }
%"struct.std::_Vector_base<VkSurfaceFormatKHR, std::allocator<VkSurfaceFormatKHR>>::_Vector_impl" = type { %"struct.std::_Vector_base<VkSurfaceFormatKHR, std::allocator<VkSurfaceFormatKHR>>::_Vector_impl_data" }
%"struct.std::_Vector_base<VkSurfaceFormatKHR, std::allocator<VkSurfaceFormatKHR>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.std::vector.20" = type { %"struct.std::_Vector_base.21" }
%"struct.std::_Vector_base.21" = type { %"struct.std::_Vector_base<VkPresentModeKHR, std::allocator<VkPresentModeKHR>>::_Vector_impl" }
%"struct.std::_Vector_base<VkPresentModeKHR, std::allocator<VkPresentModeKHR>>::_Vector_impl" = type { %"struct.std::_Vector_base<VkPresentModeKHR, std::allocator<VkPresentModeKHR>>::_Vector_impl_data" }
%"struct.std::_Vector_base<VkPresentModeKHR, std::allocator<VkPresentModeKHR>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%class.PresentationManager = type { ptr, ptr, ptr, ptr, %struct.QueueFamilyIndices, ptr, i32, %struct.VkExtent2D, %"class.std::vector.0", i8, %"class.std::vector.5", %"class.std::vector.10", %struct.SwapChainSupportDetails }
%struct.QueueFamilyIndices = type { %"class.std::optional", %"class.std::optional" }
%"class.std::optional" = type { %"struct.std::_Optional_base" }
%"struct.std::_Optional_base" = type { %"struct.std::_Optional_payload" }
%"struct.std::_Optional_payload" = type { %"struct.std::_Optional_payload_base.base", [3 x i8] }
%"struct.std::_Optional_payload_base.base" = type <{ %"union.std::_Optional_payload_base<unsigned int>::_Storage", i8 }>
%"union.std::_Optional_payload_base<unsigned int>::_Storage" = type { i32 }
%"class.std::vector.0" = type { %"struct.std::_Vector_base.1" }
%"struct.std::_Vector_base.1" = type { %"struct.std::_Vector_base<VkFramebuffer_T *, std::allocator<VkFramebuffer_T *>>::_Vector_impl" }
%"struct.std::_Vector_base<VkFramebuffer_T *, std::allocator<VkFramebuffer_T *>>::_Vector_impl" = type { %"struct.std::_Vector_base<VkFramebuffer_T *, std::allocator<VkFramebuffer_T *>>::_Vector_impl_data" }
%"struct.std::_Vector_base<VkFramebuffer_T *, std::allocator<VkFramebuffer_T *>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.std::vector.5" = type { %"struct.std::_Vector_base.6" }
%"struct.std::_Vector_base.6" = type { %"struct.std::_Vector_base<VkImage_T *, std::allocator<VkImage_T *>>::_Vector_impl" }
%"struct.std::_Vector_base<VkImage_T *, std::allocator<VkImage_T *>>::_Vector_impl" = type { %"struct.std::_Vector_base<VkImage_T *, std::allocator<VkImage_T *>>::_Vector_impl_data" }
%"struct.std::_Vector_base<VkImage_T *, std::allocator<VkImage_T *>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.std::vector.10" = type { %"struct.std::_Vector_base.11" }
%"struct.std::_Vector_base.11" = type { %"struct.std::_Vector_base<VkImageView_T *, std::allocator<VkImageView_T *>>::_Vector_impl" }
%"struct.std::_Vector_base<VkImageView_T *, std::allocator<VkImageView_T *>>::_Vector_impl" = type { %"struct.std::_Vector_base<VkImageView_T *, std::allocator<VkImageView_T *>>::_Vector_impl_data" }
%"struct.std::_Vector_base<VkImageView_T *, std::allocator<VkImageView_T *>>::_Vector_impl_data" = type { ptr, ptr, ptr }

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

declare i32 @__gxx_personality_v0(...)

; 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 @_ZN19PresentationManager21querySwapChainSupportERP18VkPhysicalDevice_T(ptr dead_on_unwind noalias writable sret(%struct.SwapChainSupportDetails) align 8 %0, ptr noundef nonnull align 8 dereferenceable(256) %1, ptr noundef nonnull align 8 dereferenceable(8) %2) #1 align 2 personality ptr @__gxx_personality_v0 {
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca i1, align 1
  %8 = alloca ptr, align 8
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  store ptr %0, ptr %4, align 8
  store ptr %1, ptr %5, align 8, !tbaa !5
  store ptr %2, ptr %6, align 8, !tbaa !5
  %12 = load ptr, ptr %5, align 8
  store i1 false, ptr %7, align 1
  call void @_ZN23SwapChainSupportDetailsC2Ev(ptr noundef nonnull align 8 dereferenceable(104) %0) #5
  %13 = load ptr, ptr %6, align 8, !tbaa !5
  %14 = load ptr, ptr %13, align 8, !tbaa !5
  %15 = getelementptr inbounds %class.PresentationManager, ptr %12, i32 0, i32 1
  %16 = load ptr, ptr %15, align 8, !tbaa !9
  %17 = getelementptr inbounds %struct.SwapChainSupportDetails, ptr %0, i32 0, i32 0
  %18 = invoke i32 @vkGetPhysicalDeviceSurfaceCapabilitiesKHR(ptr noundef %14, ptr noundef %16, ptr noundef %17)
          to label %19 unwind label %41

19:                                               ; preds = %3
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #5
  %20 = load ptr, ptr %6, align 8, !tbaa !5
  %21 = load ptr, ptr %20, align 8, !tbaa !5
  %22 = getelementptr inbounds %class.PresentationManager, ptr %12, i32 0, i32 1
  %23 = load ptr, ptr %22, align 8, !tbaa !9
  %24 = invoke i32 @vkGetPhysicalDeviceSurfaceFormatsKHR(ptr noundef %21, ptr noundef %23, ptr noundef %10, ptr noundef null)
          to label %25 unwind label %45

25:                                               ; preds = %19
  %26 = load i32, ptr %10, align 4, !tbaa !43
  %27 = icmp ne i32 %26, 0
  br i1 %27, label %28, label %49

28:                                               ; preds = %25
  %29 = getelementptr inbounds %struct.SwapChainSupportDetails, ptr %0, i32 0, i32 1
  %30 = load i32, ptr %10, align 4, !tbaa !43
  %31 = zext i32 %30 to i64
  invoke void @_ZNSt6vectorI18VkSurfaceFormatKHRSaIS0_EE6resizeEm(ptr noundef nonnull align 8 dereferenceable(24) %29, i64 noundef %31)
          to label %32 unwind label %45

32:                                               ; preds = %28
  %33 = load ptr, ptr %6, align 8, !tbaa !5
  %34 = load ptr, ptr %33, align 8, !tbaa !5
  %35 = getelementptr inbounds %class.PresentationManager, ptr %12, i32 0, i32 1
  %36 = load ptr, ptr %35, align 8, !tbaa !9
  %37 = getelementptr inbounds %struct.SwapChainSupportDetails, ptr %0, i32 0, i32 1
  %38 = call noundef ptr @_ZNSt6vectorI18VkSurfaceFormatKHRSaIS0_EE4dataEv(ptr noundef nonnull align 8 dereferenceable(24) %37) #5
  %39 = invoke i32 @vkGetPhysicalDeviceSurfaceFormatsKHR(ptr noundef %34, ptr noundef %36, ptr noundef %10, ptr noundef %38)
          to label %40 unwind label %45

40:                                               ; preds = %32
  br label %49

41:                                               ; preds = %3
  %42 = landingpad { ptr, i32 }
          cleanup
  %43 = extractvalue { ptr, i32 } %42, 0
  store ptr %43, ptr %8, align 8
  %44 = extractvalue { ptr, i32 } %42, 1
  store i32 %44, ptr %9, align 4
  br label %80

45:                                               ; preds = %32, %28, %19
  %46 = landingpad { ptr, i32 }
          cleanup
  %47 = extractvalue { ptr, i32 } %46, 0
  store ptr %47, ptr %8, align 8
  %48 = extractvalue { ptr, i32 } %46, 1
  store i32 %48, ptr %9, align 4
  br label %77

49:                                               ; preds = %40, %25
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #5
  %50 = load ptr, ptr %6, align 8, !tbaa !5
  %51 = load ptr, ptr %50, align 8, !tbaa !5
  %52 = getelementptr inbounds %class.PresentationManager, ptr %12, i32 0, i32 1
  %53 = load ptr, ptr %52, align 8, !tbaa !9
  %54 = invoke i32 @vkGetPhysicalDeviceSurfacePresentModesKHR(ptr noundef %51, ptr noundef %53, ptr noundef %11, ptr noundef null)
          to label %55 unwind label %71

55:                                               ; preds = %49
  %56 = load i32, ptr %11, align 4, !tbaa !43
  %57 = icmp ne i32 %56, 0
  br i1 %57, label %58, label %75

58:                                               ; preds = %55
  %59 = getelementptr inbounds %struct.SwapChainSupportDetails, ptr %0, i32 0, i32 2
  %60 = load i32, ptr %11, align 4, !tbaa !43
  %61 = zext i32 %60 to i64
  invoke void @_ZNSt6vectorI16VkPresentModeKHRSaIS0_EE6resizeEm(ptr noundef nonnull align 8 dereferenceable(24) %59, i64 noundef %61)
          to label %62 unwind label %71

62:                                               ; preds = %58
  %63 = load ptr, ptr %6, align 8, !tbaa !5
  %64 = load ptr, ptr %63, align 8, !tbaa !5
  %65 = getelementptr inbounds %class.PresentationManager, ptr %12, i32 0, i32 1
  %66 = load ptr, ptr %65, align 8, !tbaa !9
  %67 = getelementptr inbounds %struct.SwapChainSupportDetails, ptr %0, i32 0, i32 2
  %68 = call noundef ptr @_ZNSt6vectorI16VkPresentModeKHRSaIS0_EE4dataEv(ptr noundef nonnull align 8 dereferenceable(24) %67) #5
  %69 = invoke i32 @vkGetPhysicalDeviceSurfacePresentModesKHR(ptr noundef %64, ptr noundef %66, ptr noundef %11, ptr noundef %68)
          to label %70 unwind label %71

70:                                               ; preds = %62
  br label %75

71:                                               ; preds = %62, %58, %49
  %72 = landingpad { ptr, i32 }
          cleanup
  %73 = extractvalue { ptr, i32 } %72, 0
  store ptr %73, ptr %8, align 8
  %74 = extractvalue { ptr, i32 } %72, 1
  store i32 %74, ptr %9, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #5
  br label %77

75:                                               ; preds = %70, %55
  store i1 true, ptr %7, align 1
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #5
  %76 = load i1, ptr %7, align 1
  br i1 %76, label %79, label %78

77:                                               ; preds = %71, %45
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #5
  br label %80

78:                                               ; preds = %75
  call void @_ZN23SwapChainSupportDetailsD2Ev(ptr noundef nonnull align 8 dereferenceable(104) %0) #5
  br label %79

79:                                               ; preds = %78, %75
  ret void

80:                                               ; preds = %77, %41
  call void @_ZN23SwapChainSupportDetailsD2Ev(ptr noundef nonnull align 8 dereferenceable(104) %0) #5
  br label %81

81:                                               ; preds = %80
  %82 = load ptr, ptr %8, align 8
  %83 = load i32, ptr %9, align 4
  %84 = insertvalue { ptr, i32 } poison, ptr %82, 0
  %85 = insertvalue { ptr, i32 } %84, i32 %83, 1
  resume { ptr, i32 } %85
}

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

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

declare i32 @vkGetPhysicalDeviceSurfaceCapabilitiesKHR(ptr noundef, ptr noundef, ptr noundef) #3

declare i32 @vkGetPhysicalDeviceSurfaceFormatsKHR(ptr noundef, ptr noundef, ptr noundef, ptr noundef) #3

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt6vectorI18VkSurfaceFormatKHRSaIS0_EE6resizeEm(ptr noundef nonnull align 8 dereferenceable(24), i64 noundef) #1 align 2

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

declare i32 @vkGetPhysicalDeviceSurfacePresentModesKHR(ptr noundef, ptr noundef, ptr noundef, ptr noundef) #3

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt6vectorI16VkPresentModeKHRSaIS0_EE6resizeEm(ptr noundef nonnull align 8 dereferenceable(24), i64 noundef) #1 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef ptr @_ZNSt6vectorI16VkPresentModeKHRSaIS0_EE4dataEv(ptr noundef nonnull align 8 dereferenceable(24)) #4 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 = { inlinehint 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 = { "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 = { 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 #5 = { 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, !6, i64 8}
!10 = !{!"_ZTS19PresentationManager", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !11, i64 32, !6, i64 48, !17, i64 56, !18, i64 60, !20, i64 72, !16, i64 96, !24, i64 104, !28, i64 128, !32, i64 152}
!11 = !{!"_ZTS18QueueFamilyIndices", !12, i64 0, !12, i64 8}
!12 = !{!"_ZTSSt8optionalIjE", !13, i64 0}
!13 = !{!"_ZTSSt14_Optional_baseIjLb1ELb1EE", !14, i64 0}
!14 = !{!"_ZTSSt17_Optional_payloadIjLb1ELb1ELb1EE", !15, i64 0}
!15 = !{!"_ZTSSt22_Optional_payload_baseIjE", !7, i64 0, !16, i64 4}
!16 = !{!"bool", !7, i64 0}
!17 = !{!"_ZTS8VkFormat", !7, i64 0}
!18 = !{!"_ZTS10VkExtent2D", !19, i64 0, !19, i64 4}
!19 = !{!"int", !7, i64 0}
!20 = !{!"_ZTSSt6vectorIP15VkFramebuffer_TSaIS1_EE", !21, i64 0}
!21 = !{!"_ZTSSt12_Vector_baseIP15VkFramebuffer_TSaIS1_EE", !22, i64 0}
!22 = !{!"_ZTSNSt12_Vector_baseIP15VkFramebuffer_TSaIS1_EE12_Vector_implE", !23, i64 0}
!23 = !{!"_ZTSNSt12_Vector_baseIP15VkFramebuffer_TSaIS1_EE17_Vector_impl_dataE", !6, i64 0, !6, i64 8, !6, i64 16}
!24 = !{!"_ZTSSt6vectorIP9VkImage_TSaIS1_EE", !25, i64 0}
!25 = !{!"_ZTSSt12_Vector_baseIP9VkImage_TSaIS1_EE", !26, i64 0}
!26 = !{!"_ZTSNSt12_Vector_baseIP9VkImage_TSaIS1_EE12_Vector_implE", !27, i64 0}
!27 = !{!"_ZTSNSt12_Vector_baseIP9VkImage_TSaIS1_EE17_Vector_impl_dataE", !6, i64 0, !6, i64 8, !6, i64 16}
!28 = !{!"_ZTSSt6vectorIP13VkImageView_TSaIS1_EE", !29, i64 0}
!29 = !{!"_ZTSSt12_Vector_baseIP13VkImageView_TSaIS1_EE", !30, i64 0}
!30 = !{!"_ZTSNSt12_Vector_baseIP13VkImageView_TSaIS1_EE12_Vector_implE", !31, i64 0}
!31 = !{!"_ZTSNSt12_Vector_baseIP13VkImageView_TSaIS1_EE17_Vector_impl_dataE", !6, i64 0, !6, i64 8, !6, i64 16}
!32 = !{!"_ZTS23SwapChainSupportDetails", !33, i64 0, !35, i64 56, !39, i64 80}
!33 = !{!"_ZTS24VkSurfaceCapabilitiesKHR", !19, i64 0, !19, i64 4, !18, i64 8, !18, i64 16, !18, i64 24, !19, i64 32, !19, i64 36, !34, i64 40, !19, i64 44, !19, i64 48}
!34 = !{!"_ZTS29VkSurfaceTransformFlagBitsKHR", !7, i64 0}
!35 = !{!"_ZTSSt6vectorI18VkSurfaceFormatKHRSaIS0_EE", !36, i64 0}
!36 = !{!"_ZTSSt12_Vector_baseI18VkSurfaceFormatKHRSaIS0_EE", !37, i64 0}
!37 = !{!"_ZTSNSt12_Vector_baseI18VkSurfaceFormatKHRSaIS0_EE12_Vector_implE", !38, i64 0}
!38 = !{!"_ZTSNSt12_Vector_baseI18VkSurfaceFormatKHRSaIS0_EE17_Vector_impl_dataE", !6, i64 0, !6, i64 8, !6, i64 16}
!39 = !{!"_ZTSSt6vectorI16VkPresentModeKHRSaIS0_EE", !40, i64 0}
!40 = !{!"_ZTSSt12_Vector_baseI16VkPresentModeKHRSaIS0_EE", !41, i64 0}
!41 = !{!"_ZTSNSt12_Vector_baseI16VkPresentModeKHRSaIS0_EE12_Vector_implE", !42, i64 0}
!42 = !{!"_ZTSNSt12_Vector_baseI16VkPresentModeKHRSaIS0_EE17_Vector_impl_dataE", !6, i64 0, !6, i64 8, !6, i64 16}
!43 = !{!19, !19, 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"

%struct.SwapChainSupportDetails = type { %struct.VkSurfaceCapabilitiesKHR, %"class.std::vector.15", %"class.std::vector.20" }
%struct.VkSurfaceCapabilitiesKHR = type { i32, i32, %struct.VkExtent2D, %struct.VkExtent2D, %struct.VkExtent2D, i32, i32, i32, i32, i32 }
%struct.VkExtent2D = type { i32, i32 }
%"class.std::vector.15" = type { %"struct.std::_Vector_base.16" }
%"struct.std::_Vector_base.16" = type { %"struct.std::_Vector_base<VkSurfaceFormatKHR, std::allocator<VkSurfaceFormatKHR>>::_Vector_impl" }
%"struct.std::_Vector_base<VkSurfaceFormatKHR, std::allocator<VkSurfaceFormatKHR>>::_Vector_impl" = type { %"struct.std::_Vector_base<VkSurfaceFormatKHR, std::allocator<VkSurfaceFormatKHR>>::_Vector_impl_data" }
%"struct.std::_Vector_base<VkSurfaceFormatKHR, std::allocator<VkSurfaceFormatKHR>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.std::vector.20" = type { %"struct.std::_Vector_base.21" }
%"struct.std::_Vector_base.21" = type { %"struct.std::_Vector_base<VkPresentModeKHR, std::allocator<VkPresentModeKHR>>::_Vector_impl" }
%"struct.std::_Vector_base<VkPresentModeKHR, std::allocator<VkPresentModeKHR>>::_Vector_impl" = type { %"struct.std::_Vector_base<VkPresentModeKHR, std::allocator<VkPresentModeKHR>>::_Vector_impl_data" }
%"struct.std::_Vector_base<VkPresentModeKHR, std::allocator<VkPresentModeKHR>>::_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

declare i32 @__gxx_personality_v0(...)

; 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 @_ZN19PresentationManager21querySwapChainSupportERP18VkPhysicalDevice_T(ptr dead_on_unwind noalias nonnull writable sret(%struct.SwapChainSupportDetails) align 8 %0, ptr nocapture noundef nonnull readonly align 8 dereferenceable(256) %1, ptr nocapture noundef nonnull readonly align 8 dereferenceable(8) %2) local_unnamed_addr #1 align 2 personality ptr @__gxx_personality_v0 {
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  tail call void @_ZN23SwapChainSupportDetailsC2Ev(ptr noundef nonnull align 8 dereferenceable(104) %0) #5
  %6 = load ptr, ptr %2, align 8, !tbaa !5
  %7 = getelementptr inbounds i8, ptr %1, i64 8
  %8 = load ptr, ptr %7, align 8, !tbaa !9
  %9 = invoke i32 @vkGetPhysicalDeviceSurfaceCapabilitiesKHR(ptr noundef %6, ptr noundef %8, ptr noundef nonnull %0)
          to label %10 unwind label %24

10:                                               ; preds = %3
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %4) #5
  %11 = load ptr, ptr %2, align 8, !tbaa !5
  %12 = load ptr, ptr %7, align 8, !tbaa !9
  %13 = invoke i32 @vkGetPhysicalDeviceSurfaceFormatsKHR(ptr noundef %11, ptr noundef %12, ptr noundef nonnull %4, ptr noundef null)
          to label %14 unwind label %26

14:                                               ; preds = %10
  %15 = load i32, ptr %4, align 4, !tbaa !43
  %.not = icmp eq i32 %15, 0
  br i1 %.not, label %28, label %16

16:                                               ; preds = %14
  %17 = getelementptr inbounds i8, ptr %0, i64 56
  %18 = zext i32 %15 to i64
  invoke void @_ZNSt6vectorI18VkSurfaceFormatKHRSaIS0_EE6resizeEm(ptr noundef nonnull align 8 dereferenceable(24) %17, i64 noundef %18)
          to label %19 unwind label %26

19:                                               ; preds = %16
  %20 = load ptr, ptr %2, align 8, !tbaa !5
  %21 = load ptr, ptr %7, align 8, !tbaa !9
  %22 = call noundef ptr @_ZNSt6vectorI18VkSurfaceFormatKHRSaIS0_EE4dataEv(ptr noundef nonnull align 8 dereferenceable(24) %17) #5
  %23 = invoke i32 @vkGetPhysicalDeviceSurfaceFormatsKHR(ptr noundef %20, ptr noundef %21, ptr noundef nonnull %4, ptr noundef %22)
          to label %28 unwind label %26

24:                                               ; preds = %3
  %25 = landingpad { ptr, i32 }
          cleanup
  br label %46

26:                                               ; preds = %19, %16, %10
  %27 = landingpad { ptr, i32 }
          cleanup
  br label %45

28:                                               ; preds = %19, %14
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %5) #5
  %29 = load ptr, ptr %2, align 8, !tbaa !5
  %30 = load ptr, ptr %7, align 8, !tbaa !9
  %31 = invoke i32 @vkGetPhysicalDeviceSurfacePresentModesKHR(ptr noundef %29, ptr noundef %30, ptr noundef nonnull %5, ptr noundef null)
          to label %32 unwind label %42

32:                                               ; preds = %28
  %33 = load i32, ptr %5, align 4, !tbaa !43
  %.not12 = icmp eq i32 %33, 0
  br i1 %.not12, label %44, label %34

34:                                               ; preds = %32
  %35 = getelementptr inbounds i8, ptr %0, i64 80
  %36 = zext i32 %33 to i64
  invoke void @_ZNSt6vectorI16VkPresentModeKHRSaIS0_EE6resizeEm(ptr noundef nonnull align 8 dereferenceable(24) %35, i64 noundef %36)
          to label %37 unwind label %42

37:                                               ; preds = %34
  %38 = load ptr, ptr %2, align 8, !tbaa !5
  %39 = load ptr, ptr %7, align 8, !tbaa !9
  %40 = call noundef ptr @_ZNSt6vectorI16VkPresentModeKHRSaIS0_EE4dataEv(ptr noundef nonnull align 8 dereferenceable(24) %35) #5
  %41 = invoke i32 @vkGetPhysicalDeviceSurfacePresentModesKHR(ptr noundef %38, ptr noundef %39, ptr noundef nonnull %5, ptr noundef %40)
          to label %44 unwind label %42

42:                                               ; preds = %37, %34, %28
  %43 = landingpad { ptr, i32 }
          cleanup
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %5) #5
  br label %45

44:                                               ; preds = %37, %32
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %5) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %4) #5
  ret void

45:                                               ; preds = %42, %26
  %.pn = phi { ptr, i32 } [ %43, %42 ], [ %27, %26 ]
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %4) #5
  br label %46

46:                                               ; preds = %45, %24
  %.pn.pn = phi { ptr, i32 } [ %.pn, %45 ], [ %25, %24 ]
  call void @_ZN23SwapChainSupportDetailsD2Ev(ptr noundef nonnull align 8 dereferenceable(104) %0) #5
  resume { ptr, i32 } %.pn.pn
}

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

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

declare i32 @vkGetPhysicalDeviceSurfaceCapabilitiesKHR(ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #3

declare i32 @vkGetPhysicalDeviceSurfaceFormatsKHR(ptr noundef, ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #3

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt6vectorI18VkSurfaceFormatKHRSaIS0_EE6resizeEm(ptr noundef nonnull align 8 dereferenceable(24), i64 noundef) local_unnamed_addr #1 align 2

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

declare i32 @vkGetPhysicalDeviceSurfacePresentModesKHR(ptr noundef, ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #3

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt6vectorI16VkPresentModeKHRSaIS0_EE6resizeEm(ptr noundef nonnull align 8 dereferenceable(24), i64 noundef) local_unnamed_addr #1 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef ptr @_ZNSt6vectorI16VkPresentModeKHRSaIS0_EE4dataEv(ptr noundef nonnull align 8 dereferenceable(24)) local_unnamed_addr #4 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 = { inlinehint 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 = { "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 = { 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 #5 = { 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, !6, i64 8}
!10 = !{!"_ZTS19PresentationManager", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !11, i64 32, !6, i64 48, !17, i64 56, !18, i64 60, !20, i64 72, !16, i64 96, !24, i64 104, !28, i64 128, !32, i64 152}
!11 = !{!"_ZTS18QueueFamilyIndices", !12, i64 0, !12, i64 8}
!12 = !{!"_ZTSSt8optionalIjE", !13, i64 0}
!13 = !{!"_ZTSSt14_Optional_baseIjLb1ELb1EE", !14, i64 0}
!14 = !{!"_ZTSSt17_Optional_payloadIjLb1ELb1ELb1EE", !15, i64 0}
!15 = !{!"_ZTSSt22_Optional_payload_baseIjE", !7, i64 0, !16, i64 4}
!16 = !{!"bool", !7, i64 0}
!17 = !{!"_ZTS8VkFormat", !7, i64 0}
!18 = !{!"_ZTS10VkExtent2D", !19, i64 0, !19, i64 4}
!19 = !{!"int", !7, i64 0}
!20 = !{!"_ZTSSt6vectorIP15VkFramebuffer_TSaIS1_EE", !21, i64 0}
!21 = !{!"_ZTSSt12_Vector_baseIP15VkFramebuffer_TSaIS1_EE", !22, i64 0}
!22 = !{!"_ZTSNSt12_Vector_baseIP15VkFramebuffer_TSaIS1_EE12_Vector_implE", !23, i64 0}
!23 = !{!"_ZTSNSt12_Vector_baseIP15VkFramebuffer_TSaIS1_EE17_Vector_impl_dataE", !6, i64 0, !6, i64 8, !6, i64 16}
!24 = !{!"_ZTSSt6vectorIP9VkImage_TSaIS1_EE", !25, i64 0}
!25 = !{!"_ZTSSt12_Vector_baseIP9VkImage_TSaIS1_EE", !26, i64 0}
!26 = !{!"_ZTSNSt12_Vector_baseIP9VkImage_TSaIS1_EE12_Vector_implE", !27, i64 0}
!27 = !{!"_ZTSNSt12_Vector_baseIP9VkImage_TSaIS1_EE17_Vector_impl_dataE", !6, i64 0, !6, i64 8, !6, i64 16}
!28 = !{!"_ZTSSt6vectorIP13VkImageView_TSaIS1_EE", !29, i64 0}
!29 = !{!"_ZTSSt12_Vector_baseIP13VkImageView_TSaIS1_EE", !30, i64 0}
!30 = !{!"_ZTSNSt12_Vector_baseIP13VkImageView_TSaIS1_EE12_Vector_implE", !31, i64 0}
!31 = !{!"_ZTSNSt12_Vector_baseIP13VkImageView_TSaIS1_EE17_Vector_impl_dataE", !6, i64 0, !6, i64 8, !6, i64 16}
!32 = !{!"_ZTS23SwapChainSupportDetails", !33, i64 0, !35, i64 56, !39, i64 80}
!33 = !{!"_ZTS24VkSurfaceCapabilitiesKHR", !19, i64 0, !19, i64 4, !18, i64 8, !18, i64 16, !18, i64 24, !19, i64 32, !19, i64 36, !34, i64 40, !19, i64 44, !19, i64 48}
!34 = !{!"_ZTS29VkSurfaceTransformFlagBitsKHR", !7, i64 0}
!35 = !{!"_ZTSSt6vectorI18VkSurfaceFormatKHRSaIS0_EE", !36, i64 0}
!36 = !{!"_ZTSSt12_Vector_baseI18VkSurfaceFormatKHRSaIS0_EE", !37, i64 0}
!37 = !{!"_ZTSNSt12_Vector_baseI18VkSurfaceFormatKHRSaIS0_EE12_Vector_implE", !38, i64 0}
!38 = !{!"_ZTSNSt12_Vector_baseI18VkSurfaceFormatKHRSaIS0_EE17_Vector_impl_dataE", !6, i64 0, !6, i64 8, !6, i64 16}
!39 = !{!"_ZTSSt6vectorI16VkPresentModeKHRSaIS0_EE", !40, i64 0}
!40 = !{!"_ZTSSt12_Vector_baseI16VkPresentModeKHRSaIS0_EE", !41, i64 0}
!41 = !{!"_ZTSNSt12_Vector_baseI16VkPresentModeKHRSaIS0_EE12_Vector_implE", !42, i64 0}
!42 = !{!"_ZTSNSt12_Vector_baseI16VkPresentModeKHRSaIS0_EE17_Vector_impl_dataE", !6, i64 0, !6, i64 8, !6, i64 16}
!43 = !{!19, !19, i64 0}


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