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

; 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.NUS_binding = type { ptr, ptr, ptr, i32 }
%struct.VkBufferCreateInfo = type { i32, ptr, i32, i64, i32, i32, i32, ptr }
%struct.VkMemoryRequirements = type { i64, i64, i32 }
%struct.VkMemoryAllocateInfo = type { i32, ptr, i64, i32 }
%struct.NUS_memory_map = type { ptr, ptr, i64, %struct.NUS_binding }
%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 }

@.str = external hidden unnamed_addr constant [82 x i8], align 1
@vkCreateBuffer = external dso_local global ptr, align 8
@.str.1 = external hidden unnamed_addr constant [38 x i8], align 1
@vkGetBufferMemoryRequirements = external dso_local global ptr, align 8
@vkAllocateMemory = external dso_local global ptr, align 8
@.str.2 = external hidden unnamed_addr constant [44 x i8], align 1
@vkBindBufferMemory = external dso_local global ptr, align 8
@.str.3 = external hidden unnamed_addr constant [37 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local i32 @nus_memory_map_build(i64 noundef %0, i32 noundef %1, i32 noundef %2, ptr noundef %3) #0 {
  %5 = alloca i32, align 4
  %6 = alloca i64, align 8
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca ptr, align 8
  %10 = alloca %struct.NUS_binding, align 8
  %11 = alloca %struct.VkBufferCreateInfo, align 8
  %12 = alloca i32, align 4
  %13 = alloca %struct.VkMemoryRequirements, align 8
  %14 = alloca %struct.VkMemoryAllocateInfo, align 8
  store i64 %0, ptr %6, align 8, !tbaa !5
  store i32 %1, ptr %7, align 4, !tbaa !9
  store i32 %2, ptr %8, align 4, !tbaa !9
  store ptr %3, ptr %9, align 8, !tbaa !11
  %15 = load ptr, ptr %9, align 8, !tbaa !11
  %16 = getelementptr inbounds %struct.NUS_memory_map, ptr %15, i32 0, i32 3
  call void @llvm.lifetime.start.p0(i64 32, ptr %10) #4
  call void @nus_get_binding(ptr dead_on_unwind writable sret(%struct.NUS_binding) align 8 %10)
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %16, ptr align 8 %10, i64 32, i1 false), !tbaa.struct !13
  call void @llvm.lifetime.end.p0(i64 32, ptr %10) #4
  %17 = load i64, ptr %6, align 8, !tbaa !5
  %18 = load ptr, ptr %9, align 8, !tbaa !11
  %19 = getelementptr inbounds %struct.NUS_memory_map, ptr %18, i32 0, i32 2
  store i64 %17, ptr %19, align 8, !tbaa !14
  %20 = load i32, ptr %8, align 4, !tbaa !9
  %21 = and i32 %20, 4
  %22 = icmp ne i32 %21, 0
  br i1 %22, label %23, label %27

23:                                               ; preds = %4
  %24 = load i32, ptr %8, align 4, !tbaa !9
  %25 = xor i32 %24, 4
  store i32 %25, ptr %8, align 4, !tbaa !9
  %26 = call i32 (ptr, ...) @printf(ptr noundef @.str)
  br label %27

27:                                               ; preds = %23, %4
  call void @llvm.lifetime.start.p0(i64 56, ptr %11) #4
  %28 = getelementptr inbounds %struct.VkBufferCreateInfo, ptr %11, i32 0, i32 0
  store i32 12, ptr %28, align 8, !tbaa !17
  %29 = getelementptr inbounds %struct.VkBufferCreateInfo, ptr %11, i32 0, i32 1
  store ptr null, ptr %29, align 8, !tbaa !19
  %30 = getelementptr inbounds %struct.VkBufferCreateInfo, ptr %11, i32 0, i32 2
  store i32 0, ptr %30, align 8, !tbaa !20
  %31 = getelementptr inbounds %struct.VkBufferCreateInfo, ptr %11, i32 0, i32 3
  %32 = load i64, ptr %6, align 8, !tbaa !5
  store i64 %32, ptr %31, align 8, !tbaa !21
  %33 = getelementptr inbounds %struct.VkBufferCreateInfo, ptr %11, i32 0, i32 4
  %34 = load i32, ptr %7, align 4, !tbaa !9
  store i32 %34, ptr %33, align 8, !tbaa !22
  %35 = getelementptr inbounds %struct.VkBufferCreateInfo, ptr %11, i32 0, i32 5
  store i32 0, ptr %35, align 4, !tbaa !23
  %36 = getelementptr inbounds %struct.VkBufferCreateInfo, ptr %11, i32 0, i32 6
  store i32 0, ptr %36, align 8, !tbaa !24
  %37 = getelementptr inbounds %struct.VkBufferCreateInfo, ptr %11, i32 0, i32 7
  store ptr null, ptr %37, align 8, !tbaa !25
  %38 = load ptr, ptr @vkCreateBuffer, align 8, !tbaa !11
  %39 = call ptr @nus_get_bound_gpu()
  %40 = getelementptr inbounds %struct.NUS_gpu, ptr %39, i32 0, i32 5
  %41 = load ptr, ptr %40, align 8, !tbaa !26
  %42 = load ptr, ptr %9, align 8, !tbaa !11
  %43 = getelementptr inbounds %struct.NUS_memory_map, ptr %42, i32 0, i32 0
  %44 = call i32 %38(ptr noundef %41, ptr noundef %11, ptr noundef null, ptr noundef %43)
  %45 = icmp ne i32 %44, 0
  br i1 %45, label %46, label %48

46:                                               ; preds = %27
  %47 = call i32 (ptr, ...) @printf(ptr noundef @.str.1)
  store i32 0, ptr %5, align 4
  store i32 1, ptr %12, align 4
  br label %92

48:                                               ; preds = %27
  call void @llvm.lifetime.start.p0(i64 24, ptr %13) #4
  %49 = load ptr, ptr @vkGetBufferMemoryRequirements, align 8, !tbaa !11
  %50 = call ptr @nus_get_bound_gpu()
  %51 = getelementptr inbounds %struct.NUS_gpu, ptr %50, i32 0, i32 5
  %52 = load ptr, ptr %51, align 8, !tbaa !26
  %53 = load ptr, ptr %9, align 8, !tbaa !11
  %54 = getelementptr inbounds %struct.NUS_memory_map, ptr %53, i32 0, i32 0
  %55 = load ptr, ptr %54, align 8, !tbaa !30
  call void %49(ptr noundef %52, ptr noundef %55, ptr noundef %13)
  call void @llvm.lifetime.start.p0(i64 32, ptr %14) #4
  %56 = getelementptr inbounds %struct.VkMemoryAllocateInfo, ptr %14, i32 0, i32 0
  store i32 5, ptr %56, align 8, !tbaa !31
  %57 = getelementptr inbounds %struct.VkMemoryAllocateInfo, ptr %14, i32 0, i32 1
  store ptr null, ptr %57, align 8, !tbaa !33
  %58 = getelementptr inbounds %struct.VkMemoryAllocateInfo, ptr %14, i32 0, i32 2
  %59 = getelementptr inbounds %struct.VkMemoryRequirements, ptr %13, i32 0, i32 0
  %60 = load i64, ptr %59, align 8, !tbaa !34
  store i64 %60, ptr %58, align 8, !tbaa !36
  %61 = getelementptr inbounds %struct.VkMemoryAllocateInfo, ptr %14, i32 0, i32 3
  %62 = call ptr @nus_get_bound_gpu()
  %63 = load i32, ptr %8, align 4, !tbaa !9
  %64 = call i32 @nus_gpu_memory_type_index(ptr noundef byval(%struct.NUS_gpu) align 8 %62, ptr noundef byval(%struct.VkMemoryRequirements) align 8 %13, i32 noundef %63)
  store i32 %64, ptr %61, align 8, !tbaa !37
  %65 = load ptr, ptr @vkAllocateMemory, align 8, !tbaa !11
  %66 = call ptr @nus_get_bound_gpu()
  %67 = getelementptr inbounds %struct.NUS_gpu, ptr %66, i32 0, i32 5
  %68 = load ptr, ptr %67, align 8, !tbaa !26
  %69 = load ptr, ptr %9, align 8, !tbaa !11
  %70 = getelementptr inbounds %struct.NUS_memory_map, ptr %69, i32 0, i32 1
  %71 = call i32 %65(ptr noundef %68, ptr noundef %14, ptr noundef null, ptr noundef %70)
  %72 = icmp ne i32 %71, 0
  br i1 %72, label %73, label %75

73:                                               ; preds = %48
  %74 = call i32 (ptr, ...) @printf(ptr noundef @.str.2)
  store i32 0, ptr %5, align 4
  store i32 1, ptr %12, align 4
  br label %91

75:                                               ; preds = %48
  %76 = load ptr, ptr @vkBindBufferMemory, align 8, !tbaa !11
  %77 = call ptr @nus_get_bound_gpu()
  %78 = getelementptr inbounds %struct.NUS_gpu, ptr %77, i32 0, i32 5
  %79 = load ptr, ptr %78, align 8, !tbaa !26
  %80 = load ptr, ptr %9, align 8, !tbaa !11
  %81 = getelementptr inbounds %struct.NUS_memory_map, ptr %80, i32 0, i32 0
  %82 = load ptr, ptr %81, align 8, !tbaa !30
  %83 = load ptr, ptr %9, align 8, !tbaa !11
  %84 = getelementptr inbounds %struct.NUS_memory_map, ptr %83, i32 0, i32 1
  %85 = load ptr, ptr %84, align 8, !tbaa !38
  %86 = call i32 %76(ptr noundef %79, ptr noundef %82, ptr noundef %85, i64 noundef 0)
  %87 = icmp ne i32 %86, 0
  br i1 %87, label %88, label %90

88:                                               ; preds = %75
  %89 = call i32 (ptr, ...) @printf(ptr noundef @.str.3)
  br label %90

90:                                               ; preds = %88, %75
  store i32 1, ptr %5, align 4
  store i32 1, ptr %12, align 4
  br label %91

91:                                               ; preds = %90, %73
  call void @llvm.lifetime.end.p0(i64 32, ptr %14) #4
  call void @llvm.lifetime.end.p0(i64 24, ptr %13) #4
  br label %92

92:                                               ; preds = %91, %46
  call void @llvm.lifetime.end.p0(i64 56, ptr %11) #4
  %93 = load i32, ptr %5, align 4
  ret i32 %93
}

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

declare void @nus_get_binding(ptr dead_on_unwind writable sret(%struct.NUS_binding) align 8) #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) #3

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

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

declare ptr @nus_get_bound_gpu() #2

declare i32 @nus_gpu_memory_type_index(ptr noundef byval(%struct.NUS_gpu) align 8, ptr noundef byval(%struct.VkMemoryRequirements) align 8, i32 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 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
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 = !{!"long", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"any pointer", !7, i64 0}
!13 = !{i64 0, i64 8, !11, i64 8, i64 8, !11, i64 16, i64 8, !11, i64 24, i64 4, !9}
!14 = !{!15, !6, i64 16}
!15 = !{!"NUS_memory_map", !12, i64 0, !12, i64 8, !6, i64 16, !16, i64 24}
!16 = !{!"NUS_binding", !12, i64 0, !12, i64 8, !12, i64 16, !10, i64 24}
!17 = !{!18, !10, i64 0}
!18 = !{!"VkBufferCreateInfo", !10, i64 0, !12, i64 8, !10, i64 16, !6, i64 24, !10, i64 32, !10, i64 36, !10, i64 40, !12, i64 48}
!19 = !{!18, !12, i64 8}
!20 = !{!18, !10, i64 16}
!21 = !{!18, !6, i64 24}
!22 = !{!18, !10, i64 32}
!23 = !{!18, !10, i64 36}
!24 = !{!18, !10, i64 40}
!25 = !{!18, !12, i64 48}
!26 = !{!27, !12, i64 608}
!27 = !{!"NUS_gpu", !12, i64 0, !12, i64 8, !12, i64 16, !28, i64 24, !12, i64 600, !12, i64 608, !29, i64 616, !10, i64 1136, !10, i64 1140}
!28 = !{!"NUS_vk_device_functions", !12, i64 0, !12, i64 8, !12, i64 16, !12, i64 24, !12, i64 32, !12, i64 40, !12, i64 48, !12, i64 56, !12, i64 64, !12, i64 72, !12, i64 80, !12, i64 88, !12, i64 96, !12, i64 104, !12, i64 112, !12, i64 120, !12, i64 128, !12, i64 136, !12, i64 144, !12, i64 152, !12, i64 160, !12, i64 168, !12, i64 176, !12, i64 184, !12, i64 192, !12, i64 200, !12, i64 208, !12, i64 216, !12, i64 224, !12, i64 232, !12, i64 240, !12, i64 248, !12, i64 256, !12, i64 264, !12, i64 272, !12, i64 280, !12, i64 288, !12, i64 296, !12, i64 304, !12, i64 312, !12, i64 320, !12, i64 328, !12, i64 336, !12, i64 344, !12, i64 352, !12, i64 360, !12, i64 368, !12, i64 376, !12, i64 384, !12, i64 392, !12, i64 400, !12, i64 408, !12, i64 416, !12, i64 424, !12, i64 432, !12, i64 440, !12, i64 448, !12, i64 456, !12, i64 464, !12, i64 472, !12, i64 480, !12, i64 488, !12, i64 496, !12, i64 504, !12, i64 512, !12, i64 520, !12, i64 528, !12, i64 536, !12, i64 544, !12, i64 552, !12, i64 560, !12, i64 568}
!29 = !{!"VkPhysicalDeviceMemoryProperties", !10, i64 0, !7, i64 4, !10, i64 260, !7, i64 264}
!30 = !{!15, !12, i64 0}
!31 = !{!32, !10, i64 0}
!32 = !{!"VkMemoryAllocateInfo", !10, i64 0, !12, i64 8, !6, i64 16, !10, i64 24}
!33 = !{!32, !12, i64 8}
!34 = !{!35, !6, i64 0}
!35 = !{!"VkMemoryRequirements", !6, i64 0, !6, i64 8, !10, i64 16}
!36 = !{!32, !6, i64 16}
!37 = !{!32, !10, i64 24}
!38 = !{!15, !12, 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"

%struct.NUS_binding = type { ptr, ptr, ptr, i32 }
%struct.VkBufferCreateInfo = type { i32, ptr, i32, i64, i32, i32, i32, ptr }
%struct.VkMemoryRequirements = type { i64, i64, i32 }
%struct.VkMemoryAllocateInfo = type { i32, ptr, i64, 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 }

@.str = external hidden unnamed_addr constant [82 x i8], align 1
@vkCreateBuffer = external dso_local local_unnamed_addr global ptr, align 8
@.str.1 = external hidden unnamed_addr constant [38 x i8], align 1
@vkGetBufferMemoryRequirements = external dso_local local_unnamed_addr global ptr, align 8
@vkAllocateMemory = external dso_local local_unnamed_addr global ptr, align 8
@.str.2 = external hidden unnamed_addr constant [44 x i8], align 1
@vkBindBufferMemory = external dso_local local_unnamed_addr global ptr, align 8
@.str.3 = external hidden unnamed_addr constant [37 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local range(i32 0, 2) i32 @nus_memory_map_build(i64 noundef %0, i32 noundef %1, i32 noundef %2, ptr noundef %3) local_unnamed_addr #0 {
  %5 = alloca %struct.NUS_binding, align 8
  %6 = alloca %struct.VkBufferCreateInfo, align 8
  %7 = alloca %struct.VkMemoryRequirements, align 8
  %8 = alloca %struct.VkMemoryAllocateInfo, align 8
  %9 = getelementptr inbounds i8, ptr %3, i64 24
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %5) #5
  call void @nus_get_binding(ptr dead_on_unwind nonnull writable sret(%struct.NUS_binding) align 8 %5) #5
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(32) %9, ptr noundef nonnull align 8 dereferenceable(32) %5, i64 32, i1 false), !tbaa.struct !5
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %5) #5
  %10 = getelementptr inbounds i8, ptr %3, i64 16
  store i64 %0, ptr %10, align 8, !tbaa !12
  %11 = and i32 %2, 4
  %.not = icmp eq i32 %11, 0
  br i1 %.not, label %15, label %12

12:                                               ; preds = %4
  %13 = and i32 %2, -5
  %14 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str)
  br label %15

15:                                               ; preds = %12, %4
  %.013 = phi i32 [ %13, %12 ], [ %2, %4 ]
  call void @llvm.lifetime.start.p0(i64 56, ptr nonnull %6) #5
  store i32 12, ptr %6, align 8, !tbaa !16
  %16 = getelementptr inbounds i8, ptr %6, i64 8
  store ptr null, ptr %16, align 8, !tbaa !18
  %17 = getelementptr inbounds i8, ptr %6, i64 16
  store i32 0, ptr %17, align 8, !tbaa !19
  %18 = getelementptr inbounds i8, ptr %6, i64 24
  store i64 %0, ptr %18, align 8, !tbaa !20
  %19 = getelementptr inbounds i8, ptr %6, i64 32
  store i32 %1, ptr %19, align 8, !tbaa !21
  %20 = getelementptr inbounds i8, ptr %6, i64 36
  store i32 0, ptr %20, align 4, !tbaa !22
  %21 = getelementptr inbounds i8, ptr %6, i64 40
  store i32 0, ptr %21, align 8, !tbaa !23
  %22 = getelementptr inbounds i8, ptr %6, i64 48
  store ptr null, ptr %22, align 8, !tbaa !24
  %23 = load ptr, ptr @vkCreateBuffer, align 8, !tbaa !6
  %24 = call ptr @nus_get_bound_gpu() #5
  %25 = getelementptr inbounds i8, ptr %24, i64 608
  %26 = load ptr, ptr %25, align 8, !tbaa !25
  %27 = call i32 %23(ptr noundef %26, ptr noundef nonnull %6, ptr noundef null, ptr noundef nonnull %3) #5
  %.not14 = icmp eq i32 %27, 0
  br i1 %.not14, label %30, label %28

28:                                               ; preds = %15
  %29 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1)
  br label %58

30:                                               ; preds = %15
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %7) #5
  %31 = load ptr, ptr @vkGetBufferMemoryRequirements, align 8, !tbaa !6
  %32 = call ptr @nus_get_bound_gpu() #5
  %33 = getelementptr inbounds i8, ptr %32, i64 608
  %34 = load ptr, ptr %33, align 8, !tbaa !25
  %35 = load ptr, ptr %3, align 8, !tbaa !29
  call void %31(ptr noundef %34, ptr noundef %35, ptr noundef nonnull %7) #5
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %8) #5
  store i32 5, ptr %8, align 8, !tbaa !30
  %36 = getelementptr inbounds i8, ptr %8, i64 8
  store ptr null, ptr %36, align 8, !tbaa !32
  %37 = getelementptr inbounds i8, ptr %8, i64 16
  %38 = load i64, ptr %7, align 8, !tbaa !33
  store i64 %38, ptr %37, align 8, !tbaa !35
  %39 = getelementptr inbounds i8, ptr %8, i64 24
  %40 = call ptr @nus_get_bound_gpu() #5
  %41 = call i32 @nus_gpu_memory_type_index(ptr noundef byval(%struct.NUS_gpu) align 8 %40, ptr noundef nonnull byval(%struct.VkMemoryRequirements) align 8 %7, i32 noundef %.013) #5
  store i32 %41, ptr %39, align 8, !tbaa !36
  %42 = load ptr, ptr @vkAllocateMemory, align 8, !tbaa !6
  %43 = call ptr @nus_get_bound_gpu() #5
  %44 = getelementptr inbounds i8, ptr %43, i64 608
  %45 = load ptr, ptr %44, align 8, !tbaa !25
  %46 = getelementptr inbounds i8, ptr %3, i64 8
  %47 = call i32 %42(ptr noundef %45, ptr noundef nonnull %8, ptr noundef null, ptr noundef nonnull %46) #5
  %.not15 = icmp eq i32 %47, 0
  br i1 %.not15, label %48, label %.sink.split

48:                                               ; preds = %30
  %49 = load ptr, ptr @vkBindBufferMemory, align 8, !tbaa !6
  %50 = call ptr @nus_get_bound_gpu() #5
  %51 = getelementptr inbounds i8, ptr %50, i64 608
  %52 = load ptr, ptr %51, align 8, !tbaa !25
  %53 = load ptr, ptr %3, align 8, !tbaa !29
  %54 = load ptr, ptr %46, align 8, !tbaa !37
  %55 = call i32 %49(ptr noundef %52, ptr noundef %53, ptr noundef %54, i64 noundef 0) #5
  %.not16 = icmp eq i32 %55, 0
  br i1 %.not16, label %57, label %.sink.split

.sink.split:                                      ; preds = %48, %30
  %.str.3.sink = phi ptr [ @.str.2, %30 ], [ @.str.3, %48 ]
  %.0.ph = phi i32 [ 0, %30 ], [ 1, %48 ]
  %56 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) %.str.3.sink)
  br label %57

57:                                               ; preds = %.sink.split, %48
  %.0 = phi i32 [ 1, %48 ], [ %.0.ph, %.sink.split ]
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %8) #5
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %7) #5
  br label %58

58:                                               ; preds = %57, %28
  %.1 = phi i32 [ 0, %28 ], [ %.0, %57 ]
  call void @llvm.lifetime.end.p0(i64 56, ptr nonnull %6) #5
  ret i32 %.1
}

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

declare void @nus_get_binding(ptr dead_on_unwind writable sret(%struct.NUS_binding) align 8) local_unnamed_addr #2

; 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) #3

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

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

declare ptr @nus_get_bound_gpu() local_unnamed_addr #2

declare i32 @nus_gpu_memory_type_index(ptr noundef byval(%struct.NUS_gpu) align 8, ptr noundef byval(%struct.VkMemoryRequirements) align 8, i32 noundef) local_unnamed_addr #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 = { mustprogress 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 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #4 = { 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 #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 = !{i64 0, i64 8, !6, i64 8, i64 8, !6, i64 16, i64 8, !6, i64 24, i64 4, !10}
!6 = !{!7, !7, i64 0}
!7 = !{!"any pointer", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!11, !11, i64 0}
!11 = !{!"int", !8, i64 0}
!12 = !{!13, !14, i64 16}
!13 = !{!"NUS_memory_map", !7, i64 0, !7, i64 8, !14, i64 16, !15, i64 24}
!14 = !{!"long", !8, i64 0}
!15 = !{!"NUS_binding", !7, i64 0, !7, i64 8, !7, i64 16, !11, i64 24}
!16 = !{!17, !11, i64 0}
!17 = !{!"VkBufferCreateInfo", !11, i64 0, !7, i64 8, !11, i64 16, !14, i64 24, !11, i64 32, !11, i64 36, !11, i64 40, !7, i64 48}
!18 = !{!17, !7, i64 8}
!19 = !{!17, !11, i64 16}
!20 = !{!17, !14, i64 24}
!21 = !{!17, !11, i64 32}
!22 = !{!17, !11, i64 36}
!23 = !{!17, !11, i64 40}
!24 = !{!17, !7, i64 48}
!25 = !{!26, !7, i64 608}
!26 = !{!"NUS_gpu", !7, i64 0, !7, i64 8, !7, i64 16, !27, i64 24, !7, i64 600, !7, i64 608, !28, i64 616, !11, i64 1136, !11, i64 1140}
!27 = !{!"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}
!28 = !{!"VkPhysicalDeviceMemoryProperties", !11, i64 0, !8, i64 4, !11, i64 260, !8, i64 264}
!29 = !{!13, !7, i64 0}
!30 = !{!31, !11, i64 0}
!31 = !{!"VkMemoryAllocateInfo", !11, i64 0, !7, i64 8, !14, i64 16, !11, i64 24}
!32 = !{!31, !7, i64 8}
!33 = !{!34, !14, i64 0}
!34 = !{!"VkMemoryRequirements", !14, i64 0, !14, i64 8, !11, i64 16}
!35 = !{!31, !14, i64 16}
!36 = !{!31, !11, i64 24}
!37 = !{!13, !7, i64 8}


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