; LLVM IR from PyCee/NUS_library :: src/gpu (NUS_gpu)

; 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.VkQueueFamilyProperties = type { i32, i32, i32, %struct.VkExtent3D }
%struct.VkExtent3D = type { i32, i32, i32 }
%struct.NUS_gpu = type { ptr, ptr, ptr, %struct.NUS_vk_device_functions, ptr, ptr, %struct.VkPhysicalDeviceMemoryProperties, i32, i32 }
%struct.NUS_vk_device_functions = type { ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr }
%struct.VkPhysicalDeviceMemoryProperties = type { i32, [32 x %struct.VkMemoryType], i32, [16 x %struct.VkMemoryHeap] }
%struct.VkMemoryType = type { i32, i32 }
%struct.VkMemoryHeap = type { i64, i32 }
%struct.NUS_queue_family = type { ptr, ptr, i32, i32, i32, i32 }

@vkEnumerateDeviceExtensionProperties = external dso_local global ptr, align 8
@.str = external hidden unnamed_addr constant [54 x i8], align 1
@vkGetPhysicalDeviceMemoryProperties = external dso_local global ptr, align 8
@vkGetPhysicalDeviceQueueFamilyProperties = external dso_local global ptr, align 8
@.str.1 = external hidden unnamed_addr constant [68 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [46 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [48 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [41 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local i32 @nus_gpu_build(ptr noundef %0, ptr noundef %1) #0 {
  %3 = alloca i32, align 4
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  %8 = alloca %struct.VkQueueFamilyProperties, align 8
  store ptr %0, ptr %4, align 8, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #5
  %9 = load ptr, ptr %4, align 8, !tbaa !5
  %10 = load ptr, ptr %5, align 8, !tbaa !5
  %11 = getelementptr inbounds %struct.NUS_gpu, ptr %10, i32 0, i32 4
  store ptr %9, ptr %11, align 8, !tbaa !9
  %12 = load ptr, ptr @vkEnumerateDeviceExtensionProperties, align 8, !tbaa !5
  %13 = load ptr, ptr %4, align 8, !tbaa !5
  %14 = load ptr, ptr %5, align 8, !tbaa !5
  %15 = getelementptr inbounds %struct.NUS_gpu, ptr %14, i32 0, i32 8
  %16 = call i32 %12(ptr noundef %13, ptr noundef null, ptr noundef %15, ptr noundef null)
  %17 = icmp ne i32 %16, 0
  br i1 %17, label %18, label %20

18:                                               ; preds = %2
  %19 = call i32 (ptr, ...) @printf(ptr noundef @.str)
  store i32 0, ptr %3, align 4
  store i32 1, ptr %7, align 4
  br label %143

20:                                               ; preds = %2
  %21 = load ptr, ptr %5, align 8, !tbaa !5
  %22 = getelementptr inbounds %struct.NUS_gpu, ptr %21, i32 0, i32 8
  %23 = load i32, ptr %22, align 4, !tbaa !14
  %24 = zext i32 %23 to i64
  %25 = mul i64 260, %24
  %26 = call noalias ptr @malloc(i64 noundef %25) #6
  %27 = load ptr, ptr %5, align 8, !tbaa !5
  %28 = getelementptr inbounds %struct.NUS_gpu, ptr %27, i32 0, i32 1
  store ptr %26, ptr %28, align 8, !tbaa !15
  %29 = load ptr, ptr @vkEnumerateDeviceExtensionProperties, align 8, !tbaa !5
  %30 = load ptr, ptr %4, align 8, !tbaa !5
  %31 = load ptr, ptr %5, align 8, !tbaa !5
  %32 = getelementptr inbounds %struct.NUS_gpu, ptr %31, i32 0, i32 8
  %33 = load ptr, ptr %5, align 8, !tbaa !5
  %34 = getelementptr inbounds %struct.NUS_gpu, ptr %33, i32 0, i32 1
  %35 = load ptr, ptr %34, align 8, !tbaa !15
  %36 = call i32 %29(ptr noundef %30, ptr noundef null, ptr noundef %32, ptr noundef %35)
  %37 = icmp ne i32 %36, 0
  br i1 %37, label %38, label %40

38:                                               ; preds = %20
  %39 = call i32 (ptr, ...) @printf(ptr noundef @.str)
  store i32 0, ptr %3, align 4
  store i32 1, ptr %7, align 4
  br label %143

40:                                               ; preds = %20
  %41 = load ptr, ptr @vkGetPhysicalDeviceMemoryProperties, align 8, !tbaa !5
  %42 = load ptr, ptr %4, align 8, !tbaa !5
  %43 = load ptr, ptr %5, align 8, !tbaa !5
  %44 = getelementptr inbounds %struct.NUS_gpu, ptr %43, i32 0, i32 6
  call void %41(ptr noundef %42, ptr noundef %44)
  %45 = load ptr, ptr @vkGetPhysicalDeviceQueueFamilyProperties, align 8, !tbaa !5
  %46 = load ptr, ptr %5, align 8, !tbaa !5
  %47 = getelementptr inbounds %struct.NUS_gpu, ptr %46, i32 0, i32 4
  %48 = load ptr, ptr %47, align 8, !tbaa !9
  %49 = load ptr, ptr %5, align 8, !tbaa !5
  %50 = getelementptr inbounds %struct.NUS_gpu, ptr %49, i32 0, i32 7
  call void %45(ptr noundef %48, ptr noundef %50, ptr noundef null)
  %51 = load ptr, ptr %5, align 8, !tbaa !5
  %52 = getelementptr inbounds %struct.NUS_gpu, ptr %51, i32 0, i32 7
  %53 = load i32, ptr %52, align 8, !tbaa !16
  %54 = icmp eq i32 0, %53
  br i1 %54, label %55, label %57

55:                                               ; preds = %40
  %56 = call i32 (ptr, ...) @printf(ptr noundef @.str.1)
  store i32 0, ptr %3, align 4
  store i32 1, ptr %7, align 4
  br label %143

57:                                               ; preds = %40
  %58 = load ptr, ptr %5, align 8, !tbaa !5
  %59 = getelementptr inbounds %struct.NUS_gpu, ptr %58, i32 0, i32 7
  %60 = load i32, ptr %59, align 8, !tbaa !16
  %61 = zext i32 %60 to i64
  %62 = mul i64 24, %61
  %63 = call noalias ptr @malloc(i64 noundef %62) #6
  %64 = load ptr, ptr %5, align 8, !tbaa !5
  %65 = getelementptr inbounds %struct.NUS_gpu, ptr %64, i32 0, i32 2
  store ptr %63, ptr %65, align 8, !tbaa !17
  %66 = load ptr, ptr @vkGetPhysicalDeviceQueueFamilyProperties, align 8, !tbaa !5
  %67 = load ptr, ptr %4, align 8, !tbaa !5
  %68 = load ptr, ptr %5, align 8, !tbaa !5
  %69 = getelementptr inbounds %struct.NUS_gpu, ptr %68, i32 0, i32 7
  %70 = load ptr, ptr %5, align 8, !tbaa !5
  %71 = getelementptr inbounds %struct.NUS_gpu, ptr %70, i32 0, i32 2
  %72 = load ptr, ptr %71, align 8, !tbaa !17
  call void %66(ptr noundef %67, ptr noundef %69, ptr noundef %72)
  %73 = load ptr, ptr %5, align 8, !tbaa !5
  %74 = getelementptr inbounds %struct.NUS_gpu, ptr %73, i32 0, i32 7
  %75 = load i32, ptr %74, align 8, !tbaa !16
  %76 = zext i32 %75 to i64
  %77 = mul i64 32, %76
  %78 = call noalias ptr @malloc(i64 noundef %77) #6
  %79 = load ptr, ptr %5, align 8, !tbaa !5
  %80 = getelementptr inbounds %struct.NUS_gpu, ptr %79, i32 0, i32 0
  store ptr %78, ptr %80, align 8, !tbaa !18
  store i32 0, ptr %6, align 4, !tbaa !19
  br label %81

81:                                               ; preds = %106, %57
  %82 = load i32, ptr %6, align 4, !tbaa !19
  %83 = load ptr, ptr %5, align 8, !tbaa !5
  %84 = getelementptr inbounds %struct.NUS_gpu, ptr %83, i32 0, i32 7
  %85 = load i32, ptr %84, align 8, !tbaa !16
  %86 = icmp ult i32 %82, %85
  br i1 %86, label %87, label %109

87:                                               ; preds = %81
  %88 = load ptr, ptr %5, align 8, !tbaa !5
  %89 = getelementptr inbounds %struct.NUS_gpu, ptr %88, i32 0, i32 2
  %90 = load ptr, ptr %89, align 8, !tbaa !17
  %91 = load i32, ptr %6, align 4, !tbaa !19
  %92 = zext i32 %91 to i64
  %93 = getelementptr inbounds %struct.VkQueueFamilyProperties, ptr %90, i64 %92
  %94 = load i32, ptr %6, align 4, !tbaa !19
  %95 = load ptr, ptr %5, align 8, !tbaa !5
  %96 = getelementptr inbounds %struct.NUS_gpu, ptr %95, i32 0, i32 0
  %97 = load ptr, ptr %96, align 8, !tbaa !18
  %98 = load i32, ptr %6, align 4, !tbaa !19
  %99 = zext i32 %98 to i64
  %100 = getelementptr inbounds %struct.NUS_queue_family, ptr %97, i64 %99
  call void @llvm.lifetime.start.p0(i64 24, ptr %8) #5
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %8, ptr align 4 %93, i64 24, i1 false), !tbaa.struct !20
  %101 = call i32 @nus_queue_family_build(ptr noundef byval(%struct.VkQueueFamilyProperties) align 8 %8, i32 noundef %94, ptr noundef %100)
  call void @llvm.lifetime.end.p0(i64 24, ptr %8) #5
  %102 = icmp ne i32 %101, 1
  br i1 %102, label %103, label %105

103:                                              ; preds = %87
  %104 = call i32 (ptr, ...) @printf(ptr noundef @.str.2)
  store i32 0, ptr %3, align 4
  store i32 1, ptr %7, align 4
  br label %143

105:                                              ; preds = %87
  br label %106

106:                                              ; preds = %105
  %107 = load i32, ptr %6, align 4, !tbaa !19
  %108 = add i32 %107, 1
  store i32 %108, ptr %6, align 4, !tbaa !19
  br label %81, !llvm.loop !21

109:                                              ; preds = %81
  %110 = load ptr, ptr %5, align 8, !tbaa !5
  %111 = call i32 @nus_gpu_build_logical_device(ptr noundef %110)
  %112 = icmp ne i32 %111, 1
  br i1 %112, label %113, label %115

113:                                              ; preds = %109
  %114 = call i32 (ptr, ...) @printf(ptr noundef @.str.3)
  store i32 0, ptr %3, align 4
  store i32 1, ptr %7, align 4
  br label %143

115:                                              ; preds = %109
  %116 = load ptr, ptr %5, align 8, !tbaa !5
  %117 = getelementptr inbounds %struct.NUS_gpu, ptr %116, i32 0, i32 3
  call void @nus_bind_device_vulkan_library(ptr noundef byval(%struct.NUS_vk_device_functions) align 8 %117)
  store i32 0, ptr %6, align 4, !tbaa !19
  br label %118

118:                                              ; preds = %139, %115
  %119 = load i32, ptr %6, align 4, !tbaa !19
  %120 = load ptr, ptr %5, align 8, !tbaa !5
  %121 = getelementptr inbounds %struct.NUS_gpu, ptr %120, i32 0, i32 7
  %122 = load i32, ptr %121, align 8, !tbaa !16
  %123 = icmp ult i32 %119, %122
  br i1 %123, label %124, label %142

124:                                              ; preds = %118
  %125 = load ptr, ptr %5, align 8, !tbaa !5
  %126 = getelementptr inbounds %struct.NUS_gpu, ptr %125, i32 0, i32 5
  %127 = load ptr, ptr %126, align 8, !tbaa !23
  %128 = load ptr, ptr %5, align 8, !tbaa !5
  %129 = getelementptr inbounds %struct.NUS_gpu, ptr %128, i32 0, i32 0
  %130 = load ptr, ptr %129, align 8, !tbaa !18
  %131 = load i32, ptr %6, align 4, !tbaa !19
  %132 = zext i32 %131 to i64
  %133 = getelementptr inbounds %struct.NUS_queue_family, ptr %130, i64 %132
  %134 = call i32 @nus_queue_family_build_submission_queues(ptr noundef %127, ptr noundef %133)
  %135 = icmp ne i32 %134, 1
  br i1 %135, label %136, label %138

136:                                              ; preds = %124
  %137 = call i32 (ptr, ...) @printf(ptr noundef @.str.4)
  store i32 0, ptr %3, align 4
  store i32 1, ptr %7, align 4
  br label %143

138:                                              ; preds = %124
  br label %139

139:                                              ; preds = %138
  %140 = load i32, ptr %6, align 4, !tbaa !19
  %141 = add i32 %140, 1
  store i32 %141, ptr %6, align 4, !tbaa !19
  br label %118, !llvm.loop !24

142:                                              ; preds = %118
  store i32 1, ptr %3, align 4
  store i32 1, ptr %7, align 4
  br label %143

143:                                              ; preds = %142, %136, %113, %103, %55, %38, %18
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #5
  %144 = load i32, ptr %3, align 4
  ret i32 %144
}

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

declare i32 @printf(ptr noundef, ...) #2

; Function Attrs: nounwind allocsize(0)
declare noalias ptr @malloc(i64 noundef) #3

declare i32 @nus_queue_family_build(ptr noundef byval(%struct.VkQueueFamilyProperties) align 8, i32 noundef, ptr noundef) #2

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #4

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

; Function Attrs: nounwind uwtable
declare hidden i32 @nus_gpu_build_logical_device(ptr noundef) #0

declare void @nus_bind_device_vulkan_library(ptr noundef byval(%struct.NUS_vk_device_functions) align 8) #2

declare i32 @nus_queue_family_build_submission_queues(ptr noundef, ptr noundef) #2

attributes #0 = { 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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { "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 allocsize(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 #4 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #5 = { nounwind }
attributes #6 = { nounwind allocsize(0) }

!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/C++ TBAA"}
!9 = !{!10, !6, i64 600}
!10 = !{!"NUS_gpu", !6, i64 0, !6, i64 8, !6, i64 16, !11, i64 24, !6, i64 600, !6, i64 608, !12, i64 616, !13, i64 1136, !13, i64 1140}
!11 = !{!"NUS_vk_device_functions", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !6, i64 32, !6, i64 40, !6, i64 48, !6, i64 56, !6, i64 64, !6, i64 72, !6, i64 80, !6, i64 88, !6, i64 96, !6, i64 104, !6, i64 112, !6, i64 120, !6, i64 128, !6, i64 136, !6, i64 144, !6, i64 152, !6, i64 160, !6, i64 168, !6, i64 176, !6, i64 184, !6, i64 192, !6, i64 200, !6, i64 208, !6, i64 216, !6, i64 224, !6, i64 232, !6, i64 240, !6, i64 248, !6, i64 256, !6, i64 264, !6, i64 272, !6, i64 280, !6, i64 288, !6, i64 296, !6, i64 304, !6, i64 312, !6, i64 320, !6, i64 328, !6, i64 336, !6, i64 344, !6, i64 352, !6, i64 360, !6, i64 368, !6, i64 376, !6, i64 384, !6, i64 392, !6, i64 400, !6, i64 408, !6, i64 416, !6, i64 424, !6, i64 432, !6, i64 440, !6, i64 448, !6, i64 456, !6, i64 464, !6, i64 472, !6, i64 480, !6, i64 488, !6, i64 496, !6, i64 504, !6, i64 512, !6, i64 520, !6, i64 528, !6, i64 536, !6, i64 544, !6, i64 552, !6, i64 560, !6, i64 568}
!12 = !{!"VkPhysicalDeviceMemoryProperties", !13, i64 0, !7, i64 4, !13, i64 260, !7, i64 264}
!13 = !{!"int", !7, i64 0}
!14 = !{!10, !13, i64 1140}
!15 = !{!10, !6, i64 8}
!16 = !{!10, !13, i64 1136}
!17 = !{!10, !6, i64 16}
!18 = !{!10, !6, i64 0}
!19 = !{!13, !13, i64 0}
!20 = !{i64 0, i64 4, !19, i64 4, i64 4, !19, i64 8, i64 4, !19, i64 12, i64 4, !19, i64 16, i64 4, !19, i64 20, i64 4, !19}
!21 = distinct !{!21, !22}
!22 = !{!"llvm.loop.mustprogress"}
!23 = !{!10, !6, i64 608}
!24 = distinct !{!24, !22}


; 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.VkQueueFamilyProperties = type { i32, i32, i32, %struct.VkExtent3D }
%struct.VkExtent3D = type { i32, i32, i32 }
%struct.NUS_queue_family = type { ptr, ptr, i32, i32, i32, i32 }
%struct.NUS_vk_device_functions = type { ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr }

@vkEnumerateDeviceExtensionProperties = external dso_local local_unnamed_addr global ptr, align 8
@.str = external hidden unnamed_addr constant [54 x i8], align 1
@vkGetPhysicalDeviceMemoryProperties = external dso_local local_unnamed_addr global ptr, align 8
@vkGetPhysicalDeviceQueueFamilyProperties = external dso_local local_unnamed_addr global ptr, align 8
@.str.1 = external hidden unnamed_addr constant [68 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [46 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [48 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [41 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local range(i32 0, 2) i32 @nus_gpu_build(ptr noundef %0, ptr noundef %1) local_unnamed_addr #0 {
  %3 = alloca %struct.VkQueueFamilyProperties, align 8
  %4 = getelementptr inbounds i8, ptr %1, i64 600
  store ptr %0, ptr %4, align 8, !tbaa !5
  %5 = load ptr, ptr @vkEnumerateDeviceExtensionProperties, align 8, !tbaa !13
  %6 = getelementptr inbounds i8, ptr %1, i64 1140
  %7 = tail call i32 %5(ptr noundef %0, ptr noundef null, ptr noundef nonnull %6, ptr noundef null) #6
  %.not = icmp eq i32 %7, 0
  br i1 %.not, label %8, label %.loopexit.sink.split

8:                                                ; preds = %2
  %9 = load i32, ptr %6, align 4, !tbaa !14
  %10 = zext i32 %9 to i64
  %11 = mul nuw nsw i64 %10, 260
  %12 = tail call noalias ptr @malloc(i64 noundef %11) #7
  %13 = getelementptr inbounds i8, ptr %1, i64 8
  store ptr %12, ptr %13, align 8, !tbaa !15
  %14 = load ptr, ptr @vkEnumerateDeviceExtensionProperties, align 8, !tbaa !13
  %15 = tail call i32 %14(ptr noundef %0, ptr noundef null, ptr noundef nonnull %6, ptr noundef %12) #6
  %.not39 = icmp eq i32 %15, 0
  br i1 %.not39, label %16, label %.loopexit.sink.split

16:                                               ; preds = %8
  %17 = load ptr, ptr @vkGetPhysicalDeviceMemoryProperties, align 8, !tbaa !13
  %18 = getelementptr inbounds i8, ptr %1, i64 616
  tail call void %17(ptr noundef %0, ptr noundef nonnull %18) #6
  %19 = load ptr, ptr @vkGetPhysicalDeviceQueueFamilyProperties, align 8, !tbaa !13
  %20 = load ptr, ptr %4, align 8, !tbaa !5
  %21 = getelementptr inbounds i8, ptr %1, i64 1136
  tail call void %19(ptr noundef %20, ptr noundef nonnull %21, ptr noundef null) #6
  %22 = load i32, ptr %21, align 8, !tbaa !16
  %23 = icmp eq i32 %22, 0
  br i1 %23, label %.loopexit.sink.split, label %24

24:                                               ; preds = %16
  %25 = zext i32 %22 to i64
  %26 = mul nuw nsw i64 %25, 24
  %27 = tail call noalias ptr @malloc(i64 noundef %26) #7
  %28 = getelementptr inbounds i8, ptr %1, i64 16
  store ptr %27, ptr %28, align 8, !tbaa !17
  %29 = load ptr, ptr @vkGetPhysicalDeviceQueueFamilyProperties, align 8, !tbaa !13
  tail call void %29(ptr noundef %0, ptr noundef nonnull %21, ptr noundef %27) #6
  %30 = load i32, ptr %21, align 8, !tbaa !16
  %31 = zext i32 %30 to i64
  %32 = shl nuw nsw i64 %31, 5
  %33 = tail call noalias ptr @malloc(i64 noundef %32) #7
  store ptr %33, ptr %1, align 8, !tbaa !18
  %.not47 = icmp eq i32 %30, 0
  br i1 %.not47, label %._crit_edge, label %.lr.ph

34:                                               ; preds = %.lr.ph
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %35 = load i32, ptr %21, align 8, !tbaa !16
  %36 = zext i32 %35 to i64
  %37 = icmp ult i64 %indvars.iv.next, %36
  br i1 %37, label %.lr.ph, label %._crit_edge, !llvm.loop !19

.lr.ph:                                           ; preds = %24, %34
  %indvars.iv = phi i64 [ %indvars.iv.next, %34 ], [ 0, %24 ]
  %38 = load ptr, ptr %28, align 8, !tbaa !17
  %39 = getelementptr inbounds %struct.VkQueueFamilyProperties, ptr %38, i64 %indvars.iv
  %40 = load ptr, ptr %1, align 8, !tbaa !18
  %41 = getelementptr inbounds %struct.NUS_queue_family, ptr %40, i64 %indvars.iv
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %3) #6
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(24) %3, ptr noundef nonnull align 4 dereferenceable(24) %39, i64 24, i1 false), !tbaa.struct !21
  %42 = trunc nuw i64 %indvars.iv to i32
  %43 = tail call i32 @nus_queue_family_build(ptr noundef nonnull byval(%struct.VkQueueFamilyProperties) align 8 %3, i32 noundef %42, ptr noundef %41) #6
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %3) #6
  %.not42 = icmp eq i32 %43, 1
  br i1 %.not42, label %34, label %.loopexit.sink.split

._crit_edge:                                      ; preds = %34, %24
  %44 = tail call i32 @nus_gpu_build_logical_device(ptr noundef nonnull %1)
  %.not40 = icmp eq i32 %44, 1
  br i1 %.not40, label %45, label %.loopexit.sink.split

45:                                               ; preds = %._crit_edge
  %46 = getelementptr inbounds i8, ptr %1, i64 24
  tail call void @nus_bind_device_vulkan_library(ptr noundef nonnull byval(%struct.NUS_vk_device_functions) align 8 %46) #6
  %47 = load i32, ptr %21, align 8, !tbaa !16
  %.not48 = icmp eq i32 %47, 0
  br i1 %.not48, label %.loopexit, label %.lr.ph46

.lr.ph46:                                         ; preds = %45
  %48 = getelementptr inbounds i8, ptr %1, i64 608
  br label %53

49:                                               ; preds = %53
  %indvars.iv.next51 = add nuw nsw i64 %indvars.iv50, 1
  %50 = load i32, ptr %21, align 8, !tbaa !16
  %51 = zext i32 %50 to i64
  %52 = icmp ult i64 %indvars.iv.next51, %51
  br i1 %52, label %53, label %.loopexit, !llvm.loop !23

53:                                               ; preds = %.lr.ph46, %49
  %indvars.iv50 = phi i64 [ 0, %.lr.ph46 ], [ %indvars.iv.next51, %49 ]
  %54 = load ptr, ptr %48, align 8, !tbaa !24
  %55 = load ptr, ptr %1, align 8, !tbaa !18
  %56 = getelementptr inbounds %struct.NUS_queue_family, ptr %55, i64 %indvars.iv50
  %57 = tail call i32 @nus_queue_family_build_submission_queues(ptr noundef %54, ptr noundef %56) #6
  %.not41 = icmp eq i32 %57, 1
  br i1 %.not41, label %49, label %.loopexit.sink.split

.loopexit.sink.split:                             ; preds = %.lr.ph, %53, %._crit_edge, %16, %8, %2
  %.str.4.sink = phi ptr [ @.str, %2 ], [ @.str, %8 ], [ @.str.1, %16 ], [ @.str.3, %._crit_edge ], [ @.str.4, %53 ], [ @.str.2, %.lr.ph ]
  %58 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) %.str.4.sink)
  br label %.loopexit

.loopexit:                                        ; preds = %49, %.loopexit.sink.split, %45
  %.037 = phi i32 [ 1, %45 ], [ 0, %.loopexit.sink.split ], [ 1, %49 ]
  ret i32 %.037
}

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

; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2

; Function Attrs: mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite)
declare noalias noundef ptr @malloc(i64 noundef) local_unnamed_addr #3

declare i32 @nus_queue_family_build(ptr noundef byval(%struct.VkQueueFamilyProperties) align 8, i32 noundef, ptr noundef) local_unnamed_addr #4

; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #5

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

; Function Attrs: nounwind uwtable
declare hidden i32 @nus_gpu_build_logical_device(ptr noundef) local_unnamed_addr #0

declare void @nus_bind_device_vulkan_library(ptr noundef byval(%struct.NUS_vk_device_functions) align 8) local_unnamed_addr #4

declare i32 @nus_queue_family_build_submission_queues(ptr noundef, ptr noundef) local_unnamed_addr #4

attributes #0 = { 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 nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "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 = { mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite) "alloc-family"="malloc" "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 = { "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 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #6 = { nounwind }
attributes #7 = { nounwind allocsize(0) }

!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 600}
!6 = !{!"NUS_gpu", !7, i64 0, !7, i64 8, !7, i64 16, !10, i64 24, !7, i64 600, !7, i64 608, !11, i64 616, !12, i64 1136, !12, i64 1140}
!7 = !{!"any pointer", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"NUS_vk_device_functions", !7, i64 0, !7, i64 8, !7, i64 16, !7, i64 24, !7, i64 32, !7, i64 40, !7, i64 48, !7, i64 56, !7, i64 64, !7, i64 72, !7, i64 80, !7, i64 88, !7, i64 96, !7, i64 104, !7, i64 112, !7, i64 120, !7, i64 128, !7, i64 136, !7, i64 144, !7, i64 152, !7, i64 160, !7, i64 168, !7, i64 176, !7, i64 184, !7, i64 192, !7, i64 200, !7, i64 208, !7, i64 216, !7, i64 224, !7, i64 232, !7, i64 240, !7, i64 248, !7, i64 256, !7, i64 264, !7, i64 272, !7, i64 280, !7, i64 288, !7, i64 296, !7, i64 304, !7, i64 312, !7, i64 320, !7, i64 328, !7, i64 336, !7, i64 344, !7, i64 352, !7, i64 360, !7, i64 368, !7, i64 376, !7, i64 384, !7, i64 392, !7, i64 400, !7, i64 408, !7, i64 416, !7, i64 424, !7, i64 432, !7, i64 440, !7, i64 448, !7, i64 456, !7, i64 464, !7, i64 472, !7, i64 480, !7, i64 488, !7, i64 496, !7, i64 504, !7, i64 512, !7, i64 520, !7, i64 528, !7, i64 536, !7, i64 544, !7, i64 552, !7, i64 560, !7, i64 568}
!11 = !{!"VkPhysicalDeviceMemoryProperties", !12, i64 0, !8, i64 4, !12, i64 260, !8, i64 264}
!12 = !{!"int", !8, i64 0}
!13 = !{!7, !7, i64 0}
!14 = !{!6, !12, i64 1140}
!15 = !{!6, !7, i64 8}
!16 = !{!6, !12, i64 1136}
!17 = !{!6, !7, i64 16}
!18 = !{!6, !7, i64 0}
!19 = distinct !{!19, !20}
!20 = !{!"llvm.loop.mustprogress"}
!21 = !{i64 0, i64 4, !22, i64 4, i64 4, !22, i64 8, i64 4, !22, i64 12, i64 4, !22, i64 16, i64 4, !22, i64 20, i64 4, !22}
!22 = !{!12, !12, i64 0}
!23 = distinct !{!23, !20}
!24 = !{!6, !7, i64 608}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LICMPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,SROAPass,SimplifyCFGPass,TailCallElimPass