; LLVM IR from hadryansalles/Luz :: deps/imgui (imgui_impl_vulkan)

; 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.VkDescriptorSetAllocateInfo = type { i32, ptr, ptr, i32, ptr }
%struct.VkDescriptorImageInfo = type { ptr, ptr, i32 }
%struct.VkWriteDescriptorSet = type { i32, ptr, ptr, i32, i32, i32, i32, ptr, ptr, ptr }
%struct.ImGui_ImplVulkan_Data = type { %struct.ImGui_ImplVulkan_InitInfo, ptr, i64, i32, ptr, ptr, ptr, i32, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, %struct.ImGui_ImplVulkan_WindowRenderBuffers }
%struct.ImGui_ImplVulkan_InitInfo = type { ptr, ptr, ptr, i32, ptr, ptr, ptr, i32, i32, i32, i32, i8, i32, ptr, ptr, i64 }
%struct.ImGui_ImplVulkan_WindowRenderBuffers = type { i32, 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: mustprogress uwtable
declare hidden noundef ptr @_ZL31ImGui_ImplVulkan_GetBackendDatav() #1

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #2

; Function Attrs: mustprogress uwtable
declare hidden void @_ZL15check_vk_result8VkResult(i32 noundef) #1

; 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 noundef ptr @_Z27ImGui_ImplVulkan_AddTextureP11VkSampler_TP13VkImageView_T13VkImageLayout(ptr noundef %0, ptr noundef %1, i32 noundef %2) #1 {
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca i32, align 4
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  %9 = alloca ptr, align 8
  %10 = alloca %struct.VkDescriptorSetAllocateInfo, align 8
  %11 = alloca i32, align 4
  %12 = alloca [1 x %struct.VkDescriptorImageInfo], align 16
  %13 = alloca [1 x %struct.VkWriteDescriptorSet], align 16
  store ptr %0, ptr %4, align 8, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !5
  store i32 %2, ptr %6, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #4
  %14 = call noundef ptr @_ZL31ImGui_ImplVulkan_GetBackendDatav()
  store ptr %14, ptr %7, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #4
  %15 = load ptr, ptr %7, align 8, !tbaa !5
  %16 = getelementptr inbounds %struct.ImGui_ImplVulkan_Data, ptr %15, i32 0, i32 0
  store ptr %16, ptr %8, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #4
  call void @llvm.lifetime.start.p0(i64 40, ptr %10) #4
  call void @llvm.memset.p0.i64(ptr align 8 %10, i8 0, i64 40, i1 false)
  %17 = getelementptr inbounds %struct.VkDescriptorSetAllocateInfo, ptr %10, i32 0, i32 0
  store i32 34, ptr %17, align 8, !tbaa !11
  %18 = load ptr, ptr %8, align 8, !tbaa !5
  %19 = getelementptr inbounds %struct.ImGui_ImplVulkan_InitInfo, ptr %18, i32 0, i32 6
  %20 = load ptr, ptr %19, align 8, !tbaa !15
  %21 = getelementptr inbounds %struct.VkDescriptorSetAllocateInfo, ptr %10, i32 0, i32 2
  store ptr %20, ptr %21, align 8, !tbaa !21
  %22 = getelementptr inbounds %struct.VkDescriptorSetAllocateInfo, ptr %10, i32 0, i32 3
  store i32 1, ptr %22, align 8, !tbaa !22
  %23 = load ptr, ptr %7, align 8, !tbaa !5
  %24 = getelementptr inbounds %struct.ImGui_ImplVulkan_Data, ptr %23, i32 0, i32 4
  %25 = getelementptr inbounds %struct.VkDescriptorSetAllocateInfo, ptr %10, i32 0, i32 4
  store ptr %24, ptr %25, align 8, !tbaa !23
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #4
  %26 = load ptr, ptr %8, align 8, !tbaa !5
  %27 = getelementptr inbounds %struct.ImGui_ImplVulkan_InitInfo, ptr %26, i32 0, i32 2
  %28 = load ptr, ptr %27, align 8, !tbaa !24
  %29 = call i32 @vkAllocateDescriptorSets(ptr noundef %28, ptr noundef %10, ptr noundef %9)
  store i32 %29, ptr %11, align 4, !tbaa !25
  %30 = load i32, ptr %11, align 4, !tbaa !25
  call void @_ZL15check_vk_result8VkResult(i32 noundef %30)
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #4
  call void @llvm.lifetime.end.p0(i64 40, ptr %10) #4
  call void @llvm.lifetime.start.p0(i64 24, ptr %12) #4
  call void @llvm.memset.p0.i64(ptr align 16 %12, i8 0, i64 24, i1 false)
  %31 = load ptr, ptr %4, align 8, !tbaa !5
  %32 = getelementptr inbounds [1 x %struct.VkDescriptorImageInfo], ptr %12, i64 0, i64 0
  %33 = getelementptr inbounds %struct.VkDescriptorImageInfo, ptr %32, i32 0, i32 0
  store ptr %31, ptr %33, align 16, !tbaa !27
  %34 = load ptr, ptr %5, align 8, !tbaa !5
  %35 = getelementptr inbounds [1 x %struct.VkDescriptorImageInfo], ptr %12, i64 0, i64 0
  %36 = getelementptr inbounds %struct.VkDescriptorImageInfo, ptr %35, i32 0, i32 1
  store ptr %34, ptr %36, align 8, !tbaa !29
  %37 = load i32, ptr %6, align 4, !tbaa !9
  %38 = getelementptr inbounds [1 x %struct.VkDescriptorImageInfo], ptr %12, i64 0, i64 0
  %39 = getelementptr inbounds %struct.VkDescriptorImageInfo, ptr %38, i32 0, i32 2
  store i32 %37, ptr %39, align 16, !tbaa !30
  call void @llvm.lifetime.start.p0(i64 64, ptr %13) #4
  call void @llvm.memset.p0.i64(ptr align 16 %13, i8 0, i64 64, i1 false)
  %40 = getelementptr inbounds [1 x %struct.VkWriteDescriptorSet], ptr %13, i64 0, i64 0
  %41 = getelementptr inbounds %struct.VkWriteDescriptorSet, ptr %40, i32 0, i32 0
  store i32 35, ptr %41, align 16, !tbaa !31
  %42 = load ptr, ptr %9, align 8, !tbaa !5
  %43 = getelementptr inbounds [1 x %struct.VkWriteDescriptorSet], ptr %13, i64 0, i64 0
  %44 = getelementptr inbounds %struct.VkWriteDescriptorSet, ptr %43, i32 0, i32 2
  store ptr %42, ptr %44, align 16, !tbaa !34
  %45 = getelementptr inbounds [1 x %struct.VkWriteDescriptorSet], ptr %13, i64 0, i64 0
  %46 = getelementptr inbounds %struct.VkWriteDescriptorSet, ptr %45, i32 0, i32 5
  store i32 1, ptr %46, align 16, !tbaa !35
  %47 = getelementptr inbounds [1 x %struct.VkWriteDescriptorSet], ptr %13, i64 0, i64 0
  %48 = getelementptr inbounds %struct.VkWriteDescriptorSet, ptr %47, i32 0, i32 6
  store i32 1, ptr %48, align 4, !tbaa !36
  %49 = getelementptr inbounds [1 x %struct.VkDescriptorImageInfo], ptr %12, i64 0, i64 0
  %50 = getelementptr inbounds [1 x %struct.VkWriteDescriptorSet], ptr %13, i64 0, i64 0
  %51 = getelementptr inbounds %struct.VkWriteDescriptorSet, ptr %50, i32 0, i32 7
  store ptr %49, ptr %51, align 8, !tbaa !37
  %52 = load ptr, ptr %8, align 8, !tbaa !5
  %53 = getelementptr inbounds %struct.ImGui_ImplVulkan_InitInfo, ptr %52, i32 0, i32 2
  %54 = load ptr, ptr %53, align 8, !tbaa !24
  %55 = getelementptr inbounds [1 x %struct.VkWriteDescriptorSet], ptr %13, i64 0, i64 0
  call void @vkUpdateDescriptorSets(ptr noundef %54, i32 noundef 1, ptr noundef %55, i32 noundef 0, ptr noundef null)
  call void @llvm.lifetime.end.p0(i64 64, ptr %13) #4
  call void @llvm.lifetime.end.p0(i64 24, ptr %12) #4
  %56 = load ptr, ptr %9, align 8, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #4
  ret ptr %56
}

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

declare void @vkUpdateDescriptorSets(ptr noundef, i32 noundef, ptr noundef, i32 noundef, ptr noundef) #3

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 = { nocallback nofree nounwind willreturn memory(argmem: write) }
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 = { 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, !10, i64 0}
!10 = !{!"_ZTS13VkImageLayout", !7, i64 0}
!11 = !{!12, !13, i64 0}
!12 = !{!"_ZTS27VkDescriptorSetAllocateInfo", !13, i64 0, !6, i64 8, !6, i64 16, !14, i64 24, !6, i64 32}
!13 = !{!"_ZTS15VkStructureType", !7, i64 0}
!14 = !{!"int", !7, i64 0}
!15 = !{!16, !6, i64 48}
!16 = !{!"_ZTS25ImGui_ImplVulkan_InitInfo", !6, i64 0, !6, i64 8, !6, i64 16, !14, i64 24, !6, i64 32, !6, i64 40, !6, i64 48, !14, i64 56, !14, i64 60, !14, i64 64, !17, i64 68, !18, i64 72, !19, i64 76, !6, i64 80, !6, i64 88, !20, i64 96}
!17 = !{!"_ZTS21VkSampleCountFlagBits", !7, i64 0}
!18 = !{!"bool", !7, i64 0}
!19 = !{!"_ZTS8VkFormat", !7, i64 0}
!20 = !{!"long", !7, i64 0}
!21 = !{!12, !6, i64 16}
!22 = !{!12, !14, i64 24}
!23 = !{!12, !6, i64 32}
!24 = !{!16, !6, i64 16}
!25 = !{!26, !26, i64 0}
!26 = !{!"_ZTS8VkResult", !7, i64 0}
!27 = !{!28, !6, i64 0}
!28 = !{!"_ZTS21VkDescriptorImageInfo", !6, i64 0, !6, i64 8, !10, i64 16}
!29 = !{!28, !6, i64 8}
!30 = !{!28, !10, i64 16}
!31 = !{!32, !13, i64 0}
!32 = !{!"_ZTS20VkWriteDescriptorSet", !13, i64 0, !6, i64 8, !6, i64 16, !14, i64 24, !14, i64 28, !14, i64 32, !33, i64 36, !6, i64 40, !6, i64 48, !6, i64 56}
!33 = !{!"_ZTS16VkDescriptorType", !7, i64 0}
!34 = !{!32, !6, i64 16}
!35 = !{!32, !14, i64 32}
!36 = !{!32, !33, i64 36}
!37 = !{!32, !6, i64 40}


; 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.VkDescriptorSetAllocateInfo = type { i32, ptr, ptr, i32, ptr }
%struct.VkDescriptorImageInfo = type { ptr, ptr, i32 }
%struct.VkWriteDescriptorSet = type { i32, ptr, ptr, i32, i32, i32, i32, 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 uwtable
declare hidden noundef ptr @_ZL31ImGui_ImplVulkan_GetBackendDatav() local_unnamed_addr #1

; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #2

; Function Attrs: mustprogress uwtable
declare hidden void @_ZL15check_vk_result8VkResult(i32 noundef) local_unnamed_addr #1

; 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 noundef ptr @_Z27ImGui_ImplVulkan_AddTextureP11VkSampler_TP13VkImageView_T13VkImageLayout(ptr noundef %0, ptr noundef %1, i32 noundef %2) local_unnamed_addr #1 {
  %4 = alloca ptr, align 8
  %5 = alloca %struct.VkDescriptorSetAllocateInfo, align 8
  %6 = alloca [1 x %struct.VkDescriptorImageInfo], align 16
  %7 = alloca [1 x %struct.VkWriteDescriptorSet], align 16
  %8 = tail call noundef ptr @_ZL31ImGui_ImplVulkan_GetBackendDatav()
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %4) #4
  call void @llvm.lifetime.start.p0(i64 40, ptr nonnull %5) #4
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(40) %5, i8 0, i64 32, i1 false)
  store i32 34, ptr %5, align 8, !tbaa !5
  %9 = getelementptr inbounds i8, ptr %8, i64 48
  %10 = load ptr, ptr %9, align 8, !tbaa !12
  %11 = getelementptr inbounds i8, ptr %5, i64 16
  store ptr %10, ptr %11, align 8, !tbaa !18
  %12 = getelementptr inbounds i8, ptr %5, i64 24
  store i32 1, ptr %12, align 8, !tbaa !19
  %13 = getelementptr inbounds i8, ptr %8, i64 128
  %14 = getelementptr inbounds i8, ptr %5, i64 32
  store ptr %13, ptr %14, align 8, !tbaa !20
  %15 = getelementptr inbounds i8, ptr %8, i64 16
  %16 = load ptr, ptr %15, align 8, !tbaa !21
  %17 = call i32 @vkAllocateDescriptorSets(ptr noundef %16, ptr noundef nonnull %5, ptr noundef nonnull %4)
  call void @_ZL15check_vk_result8VkResult(i32 noundef %17)
  call void @llvm.lifetime.end.p0(i64 40, ptr nonnull %5) #4
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %6) #4
  %18 = getelementptr inbounds i8, ptr %6, i64 16
  store i64 0, ptr %18, align 16
  store ptr %0, ptr %6, align 16, !tbaa !22
  %19 = getelementptr inbounds i8, ptr %6, i64 8
  store ptr %1, ptr %19, align 8, !tbaa !25
  %20 = getelementptr inbounds i8, ptr %6, i64 16
  store i32 %2, ptr %20, align 16, !tbaa !26
  call void @llvm.lifetime.start.p0(i64 64, ptr nonnull %7) #4
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(64) %7, i8 0, i64 64, i1 false)
  store i32 35, ptr %7, align 16, !tbaa !27
  %21 = load ptr, ptr %4, align 8, !tbaa !30
  %22 = getelementptr inbounds i8, ptr %7, i64 16
  store ptr %21, ptr %22, align 16, !tbaa !31
  %23 = getelementptr inbounds i8, ptr %7, i64 32
  store i32 1, ptr %23, align 16, !tbaa !32
  %24 = getelementptr inbounds i8, ptr %7, i64 36
  store i32 1, ptr %24, align 4, !tbaa !33
  %25 = getelementptr inbounds i8, ptr %7, i64 40
  store ptr %6, ptr %25, align 8, !tbaa !34
  %26 = load ptr, ptr %15, align 8, !tbaa !21
  call void @vkUpdateDescriptorSets(ptr noundef %26, i32 noundef 1, ptr noundef nonnull %7, i32 noundef 0, ptr noundef null)
  call void @llvm.lifetime.end.p0(i64 64, ptr nonnull %7) #4
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %6) #4
  %27 = load ptr, ptr %4, align 8, !tbaa !30
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #4
  ret ptr %27
}

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

declare void @vkUpdateDescriptorSets(ptr noundef, i32 noundef, ptr noundef, i32 noundef, ptr noundef) local_unnamed_addr #3

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 nocallback nofree nounwind willreturn memory(argmem: write) }
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 = { 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, !7, i64 0}
!6 = !{!"_ZTS27VkDescriptorSetAllocateInfo", !7, i64 0, !10, i64 8, !10, i64 16, !11, i64 24, !10, i64 32}
!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 = !{!13, !10, i64 48}
!13 = !{!"_ZTS25ImGui_ImplVulkan_InitInfo", !10, i64 0, !10, i64 8, !10, i64 16, !11, i64 24, !10, i64 32, !10, i64 40, !10, i64 48, !11, i64 56, !11, i64 60, !11, i64 64, !14, i64 68, !15, i64 72, !16, i64 76, !10, i64 80, !10, i64 88, !17, i64 96}
!14 = !{!"_ZTS21VkSampleCountFlagBits", !8, i64 0}
!15 = !{!"bool", !8, i64 0}
!16 = !{!"_ZTS8VkFormat", !8, i64 0}
!17 = !{!"long", !8, i64 0}
!18 = !{!6, !10, i64 16}
!19 = !{!6, !11, i64 24}
!20 = !{!6, !10, i64 32}
!21 = !{!13, !10, i64 16}
!22 = !{!23, !10, i64 0}
!23 = !{!"_ZTS21VkDescriptorImageInfo", !10, i64 0, !10, i64 8, !24, i64 16}
!24 = !{!"_ZTS13VkImageLayout", !8, i64 0}
!25 = !{!23, !10, i64 8}
!26 = !{!23, !24, i64 16}
!27 = !{!28, !7, i64 0}
!28 = !{!"_ZTS20VkWriteDescriptorSet", !7, i64 0, !10, i64 8, !10, i64 16, !11, i64 24, !11, i64 28, !11, i64 32, !29, i64 36, !10, i64 40, !10, i64 48, !10, i64 56}
!29 = !{!"_ZTS16VkDescriptorType", !8, i64 0}
!30 = !{!10, !10, i64 0}
!31 = !{!28, !10, i64 16}
!32 = !{!28, !11, i64 32}
!33 = !{!28, !29, i64 36}
!34 = !{!28, !10, i64 40}


; Effective O3 passes: DSEPass,EarlyCSEPass,GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,SROAPass,TailCallElimPass