; LLVM IR from 2404589803/LowMemoryLLM :: src/hal/gpu (gpu_context)

; 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.GPUContext = type { ptr, ptr, ptr, ptr, ptr, ptr, ptr, i64, i64 }

@kernel_source = external hidden global ptr, align 8
@.str = external hidden unnamed_addr constant [16 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [11 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [16 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local i32 @gpu_init(ptr noundef %0) #0 {
  %2 = alloca i32, align 4
  %3 = alloca ptr, align 8
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  %6 = alloca ptr, align 8
  %7 = alloca i64, align 8
  store ptr %0, ptr %3, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #5
  %8 = call noalias ptr @malloc(i64 noundef 72) #6
  %9 = load ptr, ptr %3, align 8, !tbaa !5
  store ptr %8, ptr %9, align 8, !tbaa !5
  %10 = load ptr, ptr %3, align 8, !tbaa !5
  %11 = load ptr, ptr %10, align 8, !tbaa !5
  %12 = icmp ne ptr %11, null
  br i1 %12, label %14, label %13

13:                                               ; preds = %1
  store i32 -1, ptr %2, align 4
  store i32 1, ptr %5, align 4
  br label %139

14:                                               ; preds = %1
  %15 = load ptr, ptr %3, align 8, !tbaa !5
  %16 = load ptr, ptr %15, align 8, !tbaa !5
  call void @llvm.memset.p0.i64(ptr align 8 %16, i8 0, i64 72, i1 false)
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #5
  %17 = call i32 @clGetPlatformIDs(i32 noundef 1, ptr noundef %6, ptr noundef null)
  store i32 %17, ptr %4, align 4, !tbaa !9
  %18 = load i32, ptr %4, align 4, !tbaa !9
  %19 = icmp ne i32 %18, 0
  br i1 %19, label %20, label %21

20:                                               ; preds = %14
  br label %134

21:                                               ; preds = %14
  %22 = load ptr, ptr %6, align 8, !tbaa !5
  %23 = load ptr, ptr %3, align 8, !tbaa !5
  %24 = load ptr, ptr %23, align 8, !tbaa !5
  %25 = getelementptr inbounds %struct.GPUContext, ptr %24, i32 0, i32 2
  %26 = call i32 @clGetDeviceIDs(ptr noundef %22, i64 noundef 4, i32 noundef 1, ptr noundef %25, ptr noundef null)
  store i32 %26, ptr %4, align 4, !tbaa !9
  %27 = load i32, ptr %4, align 4, !tbaa !9
  %28 = icmp ne i32 %27, 0
  br i1 %28, label %29, label %30

29:                                               ; preds = %21
  br label %134

30:                                               ; preds = %21
  %31 = load ptr, ptr %3, align 8, !tbaa !5
  %32 = load ptr, ptr %31, align 8, !tbaa !5
  %33 = getelementptr inbounds %struct.GPUContext, ptr %32, i32 0, i32 2
  %34 = call ptr @clCreateContext(ptr noundef null, i32 noundef 1, ptr noundef %33, ptr noundef null, ptr noundef null, ptr noundef %4)
  %35 = load ptr, ptr %3, align 8, !tbaa !5
  %36 = load ptr, ptr %35, align 8, !tbaa !5
  %37 = getelementptr inbounds %struct.GPUContext, ptr %36, i32 0, i32 0
  store ptr %34, ptr %37, align 8, !tbaa !11
  %38 = load i32, ptr %4, align 4, !tbaa !9
  %39 = icmp ne i32 %38, 0
  br i1 %39, label %40, label %41

40:                                               ; preds = %30
  br label %134

41:                                               ; preds = %30
  %42 = load ptr, ptr %3, align 8, !tbaa !5
  %43 = load ptr, ptr %42, align 8, !tbaa !5
  %44 = getelementptr inbounds %struct.GPUContext, ptr %43, i32 0, i32 0
  %45 = load ptr, ptr %44, align 8, !tbaa !11
  %46 = load ptr, ptr %3, align 8, !tbaa !5
  %47 = load ptr, ptr %46, align 8, !tbaa !5
  %48 = getelementptr inbounds %struct.GPUContext, ptr %47, i32 0, i32 2
  %49 = load ptr, ptr %48, align 8, !tbaa !14
  %50 = call ptr @clCreateCommandQueue(ptr noundef %45, ptr noundef %49, i64 noundef 0, ptr noundef %4)
  %51 = load ptr, ptr %3, align 8, !tbaa !5
  %52 = load ptr, ptr %51, align 8, !tbaa !5
  %53 = getelementptr inbounds %struct.GPUContext, ptr %52, i32 0, i32 1
  store ptr %50, ptr %53, align 8, !tbaa !15
  %54 = load i32, ptr %4, align 4, !tbaa !9
  %55 = icmp ne i32 %54, 0
  br i1 %55, label %56, label %57

56:                                               ; preds = %41
  br label %134

57:                                               ; preds = %41
  %58 = load ptr, ptr %3, align 8, !tbaa !5
  %59 = load ptr, ptr %58, align 8, !tbaa !5
  %60 = getelementptr inbounds %struct.GPUContext, ptr %59, i32 0, i32 0
  %61 = load ptr, ptr %60, align 8, !tbaa !11
  %62 = call ptr @clCreateProgramWithSource(ptr noundef %61, i32 noundef 1, ptr noundef @kernel_source, ptr noundef null, ptr noundef %4)
  %63 = load ptr, ptr %3, align 8, !tbaa !5
  %64 = load ptr, ptr %63, align 8, !tbaa !5
  %65 = getelementptr inbounds %struct.GPUContext, ptr %64, i32 0, i32 3
  store ptr %62, ptr %65, align 8, !tbaa !16
  %66 = load i32, ptr %4, align 4, !tbaa !9
  %67 = icmp ne i32 %66, 0
  br i1 %67, label %68, label %69

68:                                               ; preds = %57
  br label %134

69:                                               ; preds = %57
  %70 = load ptr, ptr %3, align 8, !tbaa !5
  %71 = load ptr, ptr %70, align 8, !tbaa !5
  %72 = getelementptr inbounds %struct.GPUContext, ptr %71, i32 0, i32 3
  %73 = load ptr, ptr %72, align 8, !tbaa !16
  %74 = load ptr, ptr %3, align 8, !tbaa !5
  %75 = load ptr, ptr %74, align 8, !tbaa !5
  %76 = getelementptr inbounds %struct.GPUContext, ptr %75, i32 0, i32 2
  %77 = call i32 @clBuildProgram(ptr noundef %73, i32 noundef 1, ptr noundef %76, ptr noundef null, ptr noundef null, ptr noundef null)
  store i32 %77, ptr %4, align 4, !tbaa !9
  %78 = load i32, ptr %4, align 4, !tbaa !9
  %79 = icmp ne i32 %78, 0
  br i1 %79, label %80, label %81

80:                                               ; preds = %69
  br label %134

81:                                               ; preds = %69
  %82 = load ptr, ptr %3, align 8, !tbaa !5
  %83 = load ptr, ptr %82, align 8, !tbaa !5
  %84 = getelementptr inbounds %struct.GPUContext, ptr %83, i32 0, i32 3
  %85 = load ptr, ptr %84, align 8, !tbaa !16
  %86 = call ptr @clCreateKernel(ptr noundef %85, ptr noundef @.str, ptr noundef %4)
  %87 = load ptr, ptr %3, align 8, !tbaa !5
  %88 = load ptr, ptr %87, align 8, !tbaa !5
  %89 = getelementptr inbounds %struct.GPUContext, ptr %88, i32 0, i32 4
  store ptr %86, ptr %89, align 8, !tbaa !17
  %90 = load i32, ptr %4, align 4, !tbaa !9
  %91 = icmp ne i32 %90, 0
  br i1 %91, label %92, label %93

92:                                               ; preds = %81
  br label %134

93:                                               ; preds = %81
  %94 = load ptr, ptr %3, align 8, !tbaa !5
  %95 = load ptr, ptr %94, align 8, !tbaa !5
  %96 = getelementptr inbounds %struct.GPUContext, ptr %95, i32 0, i32 3
  %97 = load ptr, ptr %96, align 8, !tbaa !16
  %98 = call ptr @clCreateKernel(ptr noundef %97, ptr noundef @.str.1, ptr noundef %4)
  %99 = load ptr, ptr %3, align 8, !tbaa !5
  %100 = load ptr, ptr %99, align 8, !tbaa !5
  %101 = getelementptr inbounds %struct.GPUContext, ptr %100, i32 0, i32 5
  store ptr %98, ptr %101, align 8, !tbaa !18
  %102 = load i32, ptr %4, align 4, !tbaa !9
  %103 = icmp ne i32 %102, 0
  br i1 %103, label %104, label %105

104:                                              ; preds = %93
  br label %134

105:                                              ; preds = %93
  %106 = load ptr, ptr %3, align 8, !tbaa !5
  %107 = load ptr, ptr %106, align 8, !tbaa !5
  %108 = getelementptr inbounds %struct.GPUContext, ptr %107, i32 0, i32 3
  %109 = load ptr, ptr %108, align 8, !tbaa !16
  %110 = call ptr @clCreateKernel(ptr noundef %109, ptr noundef @.str.2, ptr noundef %4)
  %111 = load ptr, ptr %3, align 8, !tbaa !5
  %112 = load ptr, ptr %111, align 8, !tbaa !5
  %113 = getelementptr inbounds %struct.GPUContext, ptr %112, i32 0, i32 6
  store ptr %110, ptr %113, align 8, !tbaa !19
  %114 = load i32, ptr %4, align 4, !tbaa !9
  %115 = icmp ne i32 %114, 0
  br i1 %115, label %116, label %117

116:                                              ; preds = %105
  br label %134

117:                                              ; preds = %105
  %118 = load ptr, ptr %3, align 8, !tbaa !5
  %119 = load ptr, ptr %118, align 8, !tbaa !5
  %120 = getelementptr inbounds %struct.GPUContext, ptr %119, i32 0, i32 2
  %121 = load ptr, ptr %120, align 8, !tbaa !14
  %122 = call i32 @clGetDeviceInfo(ptr noundef %121, i32 noundef 4127, i64 noundef 8, ptr noundef %7, ptr noundef null)
  store i32 %122, ptr %4, align 4, !tbaa !9
  %123 = load i32, ptr %4, align 4, !tbaa !9
  %124 = icmp ne i32 %123, 0
  br i1 %124, label %125, label %126

125:                                              ; preds = %117
  br label %134

126:                                              ; preds = %117
  %127 = load i64, ptr %7, align 8, !tbaa !20
  %128 = load ptr, ptr %3, align 8, !tbaa !5
  %129 = load ptr, ptr %128, align 8, !tbaa !5
  %130 = getelementptr inbounds %struct.GPUContext, ptr %129, i32 0, i32 7
  store i64 %127, ptr %130, align 8, !tbaa !21
  %131 = load ptr, ptr %3, align 8, !tbaa !5
  %132 = load ptr, ptr %131, align 8, !tbaa !5
  %133 = getelementptr inbounds %struct.GPUContext, ptr %132, i32 0, i32 8
  store i64 0, ptr %133, align 8, !tbaa !22
  store i32 0, ptr %2, align 4
  store i32 1, ptr %5, align 4
  br label %138

134:                                              ; preds = %125, %116, %104, %92, %80, %68, %56, %40, %29, %20
  %135 = load ptr, ptr %3, align 8, !tbaa !5
  %136 = load ptr, ptr %135, align 8, !tbaa !5
  call void @gpu_cleanup(ptr noundef %136)
  %137 = load ptr, ptr %3, align 8, !tbaa !5
  store ptr null, ptr %137, align 8, !tbaa !5
  store i32 -1, ptr %2, align 4
  store i32 1, ptr %5, align 4
  br label %138

138:                                              ; preds = %134, %126
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #5
  br label %139

139:                                              ; preds = %138, %13
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #5
  %140 = load i32, ptr %2, align 4
  ret i32 %140
}

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

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

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

declare i32 @clGetPlatformIDs(i32 noundef, ptr noundef, ptr noundef) #4

declare i32 @clGetDeviceIDs(ptr noundef, i64 noundef, i32 noundef, ptr noundef, ptr noundef) #4

declare ptr @clCreateContext(ptr noundef, i32 noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef) #4

declare ptr @clCreateCommandQueue(ptr noundef, ptr noundef, i64 noundef, ptr noundef) #4

declare ptr @clCreateProgramWithSource(ptr noundef, i32 noundef, ptr noundef, ptr noundef, ptr noundef) #4

declare i32 @clBuildProgram(ptr noundef, i32 noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef) #4

declare ptr @clCreateKernel(ptr noundef, ptr noundef, ptr noundef) #4

declare i32 @clGetDeviceInfo(ptr noundef, i32 noundef, i64 noundef, ptr noundef, ptr noundef) #4

; Function Attrs: nounwind uwtable
declare dso_local void @gpu_cleanup(ptr noundef) #0

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

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 = { 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 #3 = { nocallback nofree nounwind willreturn memory(argmem: write) }
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 = { 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, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = !{!12, !6, i64 0}
!12 = !{!"", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !6, i64 32, !6, i64 40, !6, i64 48, !13, i64 56, !13, i64 64}
!13 = !{!"long", !7, i64 0}
!14 = !{!12, !6, i64 16}
!15 = !{!12, !6, i64 8}
!16 = !{!12, !6, i64 24}
!17 = !{!12, !6, i64 32}
!18 = !{!12, !6, i64 40}
!19 = !{!12, !6, i64 48}
!20 = !{!13, !13, i64 0}
!21 = !{!12, !13, i64 56}
!22 = !{!12, !13, i64 64}


; 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"

@kernel_source = external hidden global ptr, align 8
@.str = external hidden unnamed_addr constant [16 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [11 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [16 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local range(i32 -1, 1) i32 @gpu_init(ptr nocapture noundef %0) local_unnamed_addr #0 {
  %2 = alloca i32, align 4
  %3 = alloca ptr, align 8
  %4 = alloca i64, align 8
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %2) #4
  %calloc = tail call dereferenceable_or_null(72) ptr @calloc(i64 1, i64 72)
  store ptr %calloc, ptr %0, align 8, !tbaa !5
  %.not = icmp eq ptr %calloc, null
  br i1 %.not, label %77, label %5

5:                                                ; preds = %1
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %3) #4
  %6 = call i32 @clGetPlatformIDs(i32 noundef 1, ptr noundef nonnull %3, ptr noundef null) #4
  store i32 %6, ptr %2, align 4, !tbaa !9
  %.not25 = icmp eq i32 %6, 0
  br i1 %.not25, label %7, label %74

7:                                                ; preds = %5
  %8 = load ptr, ptr %3, align 8, !tbaa !5
  %9 = load ptr, ptr %0, align 8, !tbaa !5
  %10 = getelementptr inbounds i8, ptr %9, i64 16
  %11 = call i32 @clGetDeviceIDs(ptr noundef %8, i64 noundef 4, i32 noundef 1, ptr noundef nonnull %10, ptr noundef null) #4
  store i32 %11, ptr %2, align 4, !tbaa !9
  %.not26 = icmp eq i32 %11, 0
  br i1 %.not26, label %12, label %74

12:                                               ; preds = %7
  %13 = load ptr, ptr %0, align 8, !tbaa !5
  %14 = getelementptr inbounds i8, ptr %13, i64 16
  %15 = call ptr @clCreateContext(ptr noundef null, i32 noundef 1, ptr noundef nonnull %14, ptr noundef null, ptr noundef null, ptr noundef nonnull %2) #4
  %16 = load ptr, ptr %0, align 8, !tbaa !5
  store ptr %15, ptr %16, align 8, !tbaa !11
  %17 = load i32, ptr %2, align 4, !tbaa !9
  %.not27 = icmp eq i32 %17, 0
  br i1 %.not27, label %18, label %74

18:                                               ; preds = %12
  %19 = load ptr, ptr %0, align 8, !tbaa !5
  %20 = load ptr, ptr %19, align 8, !tbaa !11
  %21 = getelementptr inbounds i8, ptr %19, i64 16
  %22 = load ptr, ptr %21, align 8, !tbaa !14
  %23 = call ptr @clCreateCommandQueue(ptr noundef %20, ptr noundef %22, i64 noundef 0, ptr noundef nonnull %2) #4
  %24 = load ptr, ptr %0, align 8, !tbaa !5
  %25 = getelementptr inbounds i8, ptr %24, i64 8
  store ptr %23, ptr %25, align 8, !tbaa !15
  %26 = load i32, ptr %2, align 4, !tbaa !9
  %.not28 = icmp eq i32 %26, 0
  br i1 %.not28, label %27, label %74

27:                                               ; preds = %18
  %28 = load ptr, ptr %0, align 8, !tbaa !5
  %29 = load ptr, ptr %28, align 8, !tbaa !11
  %30 = call ptr @clCreateProgramWithSource(ptr noundef %29, i32 noundef 1, ptr noundef nonnull @kernel_source, ptr noundef null, ptr noundef nonnull %2) #4
  %31 = load ptr, ptr %0, align 8, !tbaa !5
  %32 = getelementptr inbounds i8, ptr %31, i64 24
  store ptr %30, ptr %32, align 8, !tbaa !16
  %33 = load i32, ptr %2, align 4, !tbaa !9
  %.not29 = icmp eq i32 %33, 0
  br i1 %.not29, label %34, label %74

34:                                               ; preds = %27
  %35 = load ptr, ptr %0, align 8, !tbaa !5
  %36 = getelementptr inbounds i8, ptr %35, i64 24
  %37 = load ptr, ptr %36, align 8, !tbaa !16
  %38 = getelementptr inbounds i8, ptr %35, i64 16
  %39 = call i32 @clBuildProgram(ptr noundef %37, i32 noundef 1, ptr noundef nonnull %38, ptr noundef null, ptr noundef null, ptr noundef null) #4
  store i32 %39, ptr %2, align 4, !tbaa !9
  %.not30 = icmp eq i32 %39, 0
  br i1 %.not30, label %40, label %74

40:                                               ; preds = %34
  %41 = load ptr, ptr %0, align 8, !tbaa !5
  %42 = getelementptr inbounds i8, ptr %41, i64 24
  %43 = load ptr, ptr %42, align 8, !tbaa !16
  %44 = call ptr @clCreateKernel(ptr noundef %43, ptr noundef nonnull @.str, ptr noundef nonnull %2) #4
  %45 = load ptr, ptr %0, align 8, !tbaa !5
  %46 = getelementptr inbounds i8, ptr %45, i64 32
  store ptr %44, ptr %46, align 8, !tbaa !17
  %47 = load i32, ptr %2, align 4, !tbaa !9
  %.not31 = icmp eq i32 %47, 0
  br i1 %.not31, label %48, label %74

48:                                               ; preds = %40
  %49 = load ptr, ptr %0, align 8, !tbaa !5
  %50 = getelementptr inbounds i8, ptr %49, i64 24
  %51 = load ptr, ptr %50, align 8, !tbaa !16
  %52 = call ptr @clCreateKernel(ptr noundef %51, ptr noundef nonnull @.str.1, ptr noundef nonnull %2) #4
  %53 = load ptr, ptr %0, align 8, !tbaa !5
  %54 = getelementptr inbounds i8, ptr %53, i64 40
  store ptr %52, ptr %54, align 8, !tbaa !18
  %55 = load i32, ptr %2, align 4, !tbaa !9
  %.not32 = icmp eq i32 %55, 0
  br i1 %.not32, label %56, label %74

56:                                               ; preds = %48
  %57 = load ptr, ptr %0, align 8, !tbaa !5
  %58 = getelementptr inbounds i8, ptr %57, i64 24
  %59 = load ptr, ptr %58, align 8, !tbaa !16
  %60 = call ptr @clCreateKernel(ptr noundef %59, ptr noundef nonnull @.str.2, ptr noundef nonnull %2) #4
  %61 = load ptr, ptr %0, align 8, !tbaa !5
  %62 = getelementptr inbounds i8, ptr %61, i64 48
  store ptr %60, ptr %62, align 8, !tbaa !19
  %63 = load i32, ptr %2, align 4, !tbaa !9
  %.not33 = icmp eq i32 %63, 0
  br i1 %.not33, label %64, label %74

64:                                               ; preds = %56
  %65 = load ptr, ptr %0, align 8, !tbaa !5
  %66 = getelementptr inbounds i8, ptr %65, i64 16
  %67 = load ptr, ptr %66, align 8, !tbaa !14
  %68 = call i32 @clGetDeviceInfo(ptr noundef %67, i32 noundef 4127, i64 noundef 8, ptr noundef nonnull %4, ptr noundef null) #4
  store i32 %68, ptr %2, align 4, !tbaa !9
  %.not34 = icmp eq i32 %68, 0
  br i1 %.not34, label %69, label %74

69:                                               ; preds = %64
  %70 = load i64, ptr %4, align 8, !tbaa !20
  %71 = load ptr, ptr %0, align 8, !tbaa !5
  %72 = getelementptr inbounds i8, ptr %71, i64 56
  store i64 %70, ptr %72, align 8, !tbaa !21
  %73 = getelementptr inbounds i8, ptr %71, i64 64
  store i64 0, ptr %73, align 8, !tbaa !22
  br label %76

74:                                               ; preds = %64, %56, %48, %40, %34, %27, %18, %12, %7, %5
  %75 = load ptr, ptr %0, align 8, !tbaa !5
  call void @gpu_cleanup(ptr noundef %75)
  store ptr null, ptr %0, align 8, !tbaa !5
  br label %76

76:                                               ; preds = %74, %69
  %.0 = phi i32 [ -1, %74 ], [ 0, %69 ]
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %3) #4
  br label %77

77:                                               ; preds = %1, %76
  %.1 = phi i32 [ %.0, %76 ], [ -1, %1 ]
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %2) #4
  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 i32 @clGetPlatformIDs(i32 noundef, ptr noundef, ptr noundef) local_unnamed_addr #2

declare i32 @clGetDeviceIDs(ptr noundef, i64 noundef, i32 noundef, ptr noundef, ptr noundef) local_unnamed_addr #2

declare ptr @clCreateContext(ptr noundef, i32 noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #2

declare ptr @clCreateCommandQueue(ptr noundef, ptr noundef, i64 noundef, ptr noundef) local_unnamed_addr #2

declare ptr @clCreateProgramWithSource(ptr noundef, i32 noundef, ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #2

declare i32 @clBuildProgram(ptr noundef, i32 noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #2

declare ptr @clCreateKernel(ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #2

declare i32 @clGetDeviceInfo(ptr noundef, i32 noundef, i64 noundef, ptr noundef, ptr noundef) local_unnamed_addr #2

; Function Attrs: nounwind uwtable
declare dso_local void @gpu_cleanup(ptr noundef) local_unnamed_addr #0

; 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 willreturn allockind("alloc,zeroed") allocsize(0,1) memory(inaccessiblemem: readwrite)
declare noalias noundef ptr @calloc(i64 noundef, i64 noundef) local_unnamed_addr #3

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 = { nofree nounwind willreturn allockind("alloc,zeroed") allocsize(0,1) memory(inaccessiblemem: readwrite) "alloc-family"="malloc" }
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/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = !{!12, !6, i64 0}
!12 = !{!"", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !6, i64 32, !6, i64 40, !6, i64 48, !13, i64 56, !13, i64 64}
!13 = !{!"long", !7, i64 0}
!14 = !{!12, !6, i64 16}
!15 = !{!12, !6, i64 8}
!16 = !{!12, !6, i64 24}
!17 = !{!12, !6, i64 32}
!18 = !{!12, !6, i64 40}
!19 = !{!12, !6, i64 48}
!20 = !{!13, !13, i64 0}
!21 = !{!12, !13, i64 56}
!22 = !{!12, !13, i64 64}


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